[ros-diffs] [cwittich] 45791: [SHLWAPI] sync shlwapi to wine 1.1.39

cwittich at svn.reactos.org cwittich at svn.reactos.org
Wed Mar 3 17:21:35 CET 2010


Author: cwittich
Date: Wed Mar  3 17:21:34 2010
New Revision: 45791

URL: http://svn.reactos.org/svn/reactos?rev=45791&view=rev
Log:
[SHLWAPI]
sync shlwapi to wine 1.1.39

Modified:
    trunk/reactos/dll/win32/shlwapi/msgbox.c
    trunk/reactos/dll/win32/shlwapi/ordinal.c
    trunk/reactos/dll/win32/shlwapi/reg.c
    trunk/reactos/dll/win32/shlwapi/shlwapi.rc
    trunk/reactos/dll/win32/shlwapi/shlwapi.spec
    trunk/reactos/dll/win32/shlwapi/shlwapi_De.rc
    trunk/reactos/dll/win32/shlwapi/shlwapi_Fr.rc
    trunk/reactos/dll/win32/shlwapi/shlwapi_Ja.rc
    trunk/reactos/dll/win32/shlwapi/shlwapi_No.rc
    trunk/reactos/dll/win32/shlwapi/shlwapi_Si.rc
    trunk/reactos/dll/win32/shlwapi/url.c

Modified: trunk/reactos/dll/win32/shlwapi/msgbox.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/msgbox.c?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/msgbox.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/msgbox.c [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -147,10 +147,10 @@
   WCHAR szNameBuff[MAX_PATH], szIdBuff[MAX_PATH];
   LPCWSTR szName = szNameBuff;
 
-  if (HIWORD(lpszName))
+  if (IS_INTRESOURCE(lpszName))
+    szName = (LPCWSTR)lpszName; /* Resource Id or NULL */
+  else
     MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szNameBuff, MAX_PATH);
-  else
-    szName = (LPCWSTR)lpszName; /* Resource Id or NULL */
 
   MultiByteToWideChar(CP_ACP, 0, lpszId, -1, szIdBuff, MAX_PATH);
 

Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/ordinal.c?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -46,6 +46,7 @@
 #include "shlwapi.h"
 #include "shellapi.h"
 #include "commdlg.h"
+#include "mlang.h"
 #include "mshtmhst.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
@@ -450,14 +451,14 @@
  *
  * PARAMS
  *  langbuf [O] Destination for language string
- *  buflen  [I] Length of langbuf
+ *  buflen  [I] Length of langbuf in characters
  *          [0] Success: used length of langbuf
  *
  * RETURNS
  *  Success: S_OK.   langbuf is set to the language string found.
  *  Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
  *           does not contain the setting.
- *           E_INVALIDARG, If the buffer is not big enough
+ *           HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), If the buffer is not big enough
  */
 HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
 {
@@ -468,49 +469,50 @@
 	'I','n','t','e','r','n','a','t','i','o','n','a','l',0};
     static const WCHAR valueW[] = {
 	'A','c','c','e','p','t','L','a','n','g','u','a','g','e',0};
-    static const WCHAR enusW[] = {'e','n','-','u','s',0};
     DWORD mystrlen, mytype;
+    DWORD len;
     HKEY mykey;
     HRESULT retval;
     LCID mylcid;
     WCHAR *mystr;
+    LONG lres;
+
+    TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
 
     if(!langbuf || !buflen || !*buflen)
 	return E_FAIL;
 
     mystrlen = (*buflen > 20) ? *buflen : 20 ;
-    mystr = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * mystrlen);
+    len = mystrlen * sizeof(WCHAR);
+    mystr = HeapAlloc(GetProcessHeap(), 0, len);
+    mystr[0] = 0;
     RegOpenKeyW(HKEY_CURRENT_USER, szkeyW, &mykey);
-    if(RegQueryValueExW(mykey, valueW, 0, &mytype, (PBYTE)mystr, &mystrlen)) {
-        /* Did not find value */
-        mylcid = GetUserDefaultLCID();
-        /* somehow the mylcid translates into "en-us"
-         *  this is similar to "LOCALE_SABBREVLANGNAME"
-         *  which could be gotten via GetLocaleInfo.
-         *  The only problem is LOCALE_SABBREVLANGUAGE" is
-         *  a 3 char string (first 2 are country code and third is
-         *  letter for "sublanguage", which does not come close to
-         *  "en-us"
-         */
-        lstrcpyW(mystr, enusW);
-        mystrlen = lstrlenW(mystr);
-    } else {
-        /* handle returned string */
-        FIXME("missing code\n");
-    }
-    memcpy( langbuf, mystr, min(*buflen,strlenW(mystr)+1)*sizeof(WCHAR) );
-
-    if(*buflen > strlenW(mystr)) {
-	*buflen = strlenW(mystr);
-	retval = S_OK;
-    } else {
-	*buflen = 0;
-	retval = E_INVALIDARG;
-	SetLastError(ERROR_INSUFFICIENT_BUFFER);
-    }
+    lres = RegQueryValueExW(mykey, valueW, 0, &mytype, (PBYTE)mystr, &len);
     RegCloseKey(mykey);
+    len = lstrlenW(mystr);
+
+    if (!lres && (*buflen > len)) {
+        lstrcpyW(langbuf, mystr);
+        *buflen = len;
+        HeapFree(GetProcessHeap(), 0, mystr);
+        return S_OK;
+    }
+
+    /* Did not find a value in the registry or the user buffer is to small */
+    mylcid = GetUserDefaultLCID();
+    retval = LcidToRfc1766W(mylcid, mystr, mystrlen);
+    len = lstrlenW(mystr);
+
+    memcpy( langbuf, mystr, min(*buflen, len+1)*sizeof(WCHAR) );
     HeapFree(GetProcessHeap(), 0, mystr);
-    return retval;
+
+    if (*buflen > len) {
+        *buflen = len;
+        return S_OK;
+    }
+
+    *buflen = 0;
+    return __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
 }
 
 /*************************************************************************
@@ -524,6 +526,8 @@
     DWORD buflenW, convlen;
     HRESULT retval;
 
+    TRACE("(%p, %p) *%p: %d\n", langbuf, buflen, buflen, buflen ? *buflen : -1);
+
     if(!langbuf || !buflen || !*buflen) return E_FAIL;
 
     buflenW = *buflen;
@@ -533,11 +537,20 @@
     if (retval == S_OK)
     {
         convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, -1, langbuf, *buflen, NULL, NULL);
+        convlen--;  /* do not count the terminating 0 */
     }
     else  /* copy partial string anyway */
     {
         convlen = WideCharToMultiByte(CP_ACP, 0, langbufW, *buflen, langbuf, *buflen, NULL, NULL);
-        if (convlen < *buflen) langbuf[convlen] = 0;
+        if (convlen < *buflen)
+        {
+            langbuf[convlen] = 0;
+            convlen--;  /* do not count the terminating 0 */
+        }
+        else
+        {
+            convlen = *buflen;
+        }
     }
     *buflen = buflenW ? convlen : 0;
 
@@ -1128,7 +1141,7 @@
  * PARAMS
  *  lpUnkSink   [I] Sink for the connection point advise call
  *  riid        [I] REFIID of connection point to advise
- *  bAdviseOnly [I] TRUE = Advise only, FALSE = Unadvise first
+ *  fConnect    [I] TRUE = Connection being establisted, FALSE = broken
  *  lpUnknown   [I] Object supporting the IConnectionPointContainer interface
  *  lpCookie    [O] Pointer to connection point cookie
  *  lppCP       [O] Destination for the IConnectionPoint found
@@ -1140,7 +1153,7 @@
  *           E_NOINTERFACE, if lpUnknown isn't an IConnectionPointContainer,
  *           Or an HRESULT error code if any call fails.
  */
-HRESULT WINAPI ConnectToConnectionPoint(IUnknown* lpUnkSink, REFIID riid, BOOL bAdviseOnly,
+HRESULT WINAPI ConnectToConnectionPoint(IUnknown* lpUnkSink, REFIID riid, BOOL fConnect,
                            IUnknown* lpUnknown, LPDWORD lpCookie,
                            IConnectionPoint **lppCP)
 {
@@ -1148,7 +1161,7 @@
   IConnectionPointContainer* lpContainer;
   IConnectionPoint *lpCP;
 
-  if(!lpUnknown || (bAdviseOnly && !lpUnkSink))
+  if(!lpUnknown || (fConnect && !lpUnkSink))
     return E_FAIL;
 
   if(lppCP)
@@ -1162,9 +1175,10 @@
 
     if (SUCCEEDED(hRet))
     {
-      if(!bAdviseOnly)
+      if(!fConnect)
         hRet = IConnectionPoint_Unadvise(lpCP, *lpCookie);
-      hRet = IConnectionPoint_Advise(lpCP, lpUnkSink, lpCookie);
+      else
+        hRet = IConnectionPoint_Advise(lpCP, lpUnkSink, lpCookie);
 
       if (FAILED(hRet))
         *lpCookie = 0;
@@ -2929,20 +2943,27 @@
 {
   IEnumConnections *enumerator;
   CONNECTDATA rgcd;
+  static DISPPARAMS empty = {NULL, NULL, 0, 0};
+  DISPPARAMS* params = dispParams;
 
   HRESULT result = IConnectionPoint_EnumConnections(iCP, &enumerator);
   if (FAILED(result))
     return result;
 
+  /* Invoke is never happening with an NULL dispParams */
+  if (!params)
+    params = &empty;
+
   while(IEnumConnections_Next(enumerator, 1, &rgcd, NULL)==S_OK)
   {
     IDispatch *dispIface;
-    if (SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, iid, (LPVOID*)&dispIface)) ||
+    if ((iid && SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, iid, (LPVOID*)&dispIface))) ||
         SUCCEEDED(IUnknown_QueryInterface(rgcd.pUnk, &IID_IDispatch, (LPVOID*)&dispIface)))
     {
-      IDispatch_Invoke(dispIface, dispId, &IID_NULL, 0, DISPATCH_METHOD, dispParams, NULL, NULL, NULL);
+      IDispatch_Invoke(dispIface, dispId, &IID_NULL, 0, DISPATCH_METHOD, params, NULL, NULL, NULL);
       IDispatch_Release(dispIface);
     }
+    IUnknown_Release(rgcd.pUnk);
   }
 
   IEnumConnections_Release(enumerator);
@@ -2965,6 +2986,8 @@
     result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
     if (SUCCEEDED(result))
         result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
+    else
+        result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
 
     return result;
 }
@@ -2988,6 +3011,8 @@
   result = IConnectionPoint_GetConnectionInterface(iCP, &iid);
   if (SUCCEEDED(result))
     result = SHLWAPI_InvokeByIID(iCP, &iid, dispId, dispParams);
+  else
+    result = SHLWAPI_InvokeByIID(iCP, NULL, dispId, dispParams);
 
   return result;
 }
@@ -3901,6 +3926,8 @@
     case OS_APPLIANCE:
         FIXME("(OS_APPLIANCE) What should we return here?\n");
         return FALSE;
+    case 0x25: /*OS_VISTAORGREATER*/
+        ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 6)
     }
 
 #undef ISOS_RETURN
@@ -4697,3 +4724,78 @@
 
     return 0;
 }
+
+/***********************************************************************
+ *             SHVerbExistsNA [SHLWAPI.196]
+ *
+ *
+ * PARAMS
+ *
+ *  verb [I] a string, often appears to be an extension.
+ *
+ *  Other parameters currently unknown.
+ *
+ * RETURNS
+ *  unknown
+ */
+INT WINAPI SHVerbExistsNA(LPSTR verb, PVOID pUnknown, PVOID pUnknown2, DWORD dwUnknown3)
+{
+    FIXME("(%s, %p, %p, %i) STUB\n",verb, pUnknown, pUnknown2, dwUnknown3);
+    return 0;
+}
+
+/*************************************************************************
+ *      @	[SHLWAPI.538]
+ *
+ *  Undocumented:  Implementation guessed at via Name and behavior
+ *
+ * PARAMS
+ *  lpUnknown [I] Object to get an IServiceProvider interface from
+ *  riid      [I] Function requested for QueryService call
+ *  lppOut    [O] Destination for the service interface pointer
+ *
+ * RETURNS
+ *  Success: S_OK. lppOut contains an object providing the requested service
+ *  Failure: An HRESULT error code
+ *
+ * NOTES
+ *  lpUnknown is expected to support the IServiceProvider interface.
+ */
+HRESULT WINAPI IUnknown_QueryServiceForWebBrowserApp(IUnknown* lpUnknown,
+        REFGUID riid, LPVOID *lppOut)
+{
+    FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut);
+    return IUnknown_QueryService(lpUnknown,&IID_IWebBrowserApp,riid,lppOut);
+}
+
+/**************************************************************************
+ *  SHPropertyBag_ReadLONG (SHLWAPI.496)
+ *
+ * This function asks a property bag to read a named property as a LONG.
+ *
+ * PARAMS
+ *  ppb: a IPropertyBag interface
+ *  pszPropName:  Unicode string that names the property
+ *  pValue: address to receive the property value as a 32-bit signed integer
+ *
+ * RETURNS
+ *  0 for Success
+ */
+BOOL WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LPLONG pValue)
+{
+    VARIANT var;
+    HRESULT hr;
+    TRACE("%p %s %p\n", ppb,debugstr_w(pszPropName),pValue);
+    if (!pszPropName || !ppb || !pValue)
+        return E_INVALIDARG;
+    V_VT(&var) = VT_I4;
+    hr = IPropertyBag_Read(ppb, pszPropName, &var, NULL);
+    if (SUCCEEDED(hr))
+    {
+        if (V_VT(&var) == VT_I4)
+            *pValue = V_I4(&var);
+        else
+            hr = DISP_E_BADVARTYPE;
+    }
+    return hr;
+}

Modified: trunk/reactos/dll/win32/shlwapi/reg.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/reg.c?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/reg.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/reg.c [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -1138,68 +1138,6 @@
 }
 
 /*************************************************************************
- * SHRegGetValueA   [SHLWAPI.@]
- *
- * Get a value from the registry.
- *
- * PARAMS
- *   hKey       [I] Handle to registry key
- *   lpszSubKey [I] Name of sub key containing value to get
- *   lpszValue  [I] Name of value to get
- *   srrf       [I] Flags for restricting returned data
- *   pwType     [O] Pointer to the values type
- *   pvData     [O] Pointer to the values data
- *   pcbData    [O] Pointer to the values size
- *
- * RETURNS
- *   Success: ERROR_SUCCESS. Output parameters contain the details read.
- *   Failure: An error code from RegOpenKeyExA() or SHQueryValueExA().
- */
-DWORD WINAPI SHRegGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, DWORD srrfFlags,
-                         LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
-{
-  DWORD dwRet = 0;
-  HKEY hSubKey = 0;
-
-  TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
-        debugstr_a(lpszValue), pwType, pvData, pcbData);
-  FIXME("Semi-Stub: Find meaning and implement handling of SRFF Flags 0x%08x\n", srrfFlags);
-
-  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
-  if (! dwRet)
-  {
-    /* SHQueryValueEx expands Environment strings */
-    dwRet = SHQueryValueExA(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
-    RegCloseKey(hSubKey);
-  }
-  return dwRet;
-}
-
-/*************************************************************************
- * SHReg GetRegValueW   [SHLWAPI.@]
- *
- * See SHGetValueA.
- */
-DWORD WINAPI SHRegGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, DWORD srrfFlags,
-                         LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
-{
-  DWORD dwRet = 0;
-  HKEY hSubKey = 0;
-
-  TRACE("(hkey=%p,%s,%s,0x%08x, %p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
-        debugstr_w(lpszValue), srrfFlags,pwType, pvData, pcbData);
-  FIXME("Semi-Stub: Find meaning and implement handling of SRFF Flags 0x%08x\n", srrfFlags);
-
-  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
-  if (! dwRet)
-  {
-    dwRet = SHQueryValueExW(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
-    RegCloseKey(hSubKey);
-  }
-  return dwRet;
-}
-
-/*************************************************************************
  * SHGetValueW   [SHLWAPI.@]
  *
  * See SHGetValueA.

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -26,26 +26,29 @@
 #include "version.rc"
 
 #include "shlwapi_Da.rc"
-#include "shlwapi_De.rc"
 #include "shlwapi_En.rc"
 #include "shlwapi_Eo.rc"
 #include "shlwapi_Es.rc"
 #include "shlwapi_Fi.rc"
-#include "shlwapi_Fr.rc"
 #include "shlwapi_Hu.rc"
 #include "shlwapi_It.rc"
-#include "shlwapi_Ja.rc"
 #include "shlwapi_Ko.rc"
-#include "shlwapi_Lt.rc"
 #include "shlwapi_Nl.rc"
-#include "shlwapi_No.rc"
 #include "shlwapi_Pl.rc"
 #include "shlwapi_Pt.rc"
-#include "shlwapi_Ro.rc"
-#include "shlwapi_Ru.rc"
-#include "shlwapi_Si.rc"
 #include "shlwapi_Sk.rc"
 #include "shlwapi_Sv.rc"
 #include "shlwapi_Tr.rc"
 #include "shlwapi_Uk.rc"
 #include "shlwapi_Zh.rc"
+
+/* UTF-8 */
+
+#include "shlwapi_De.rc"
+#include "shlwapi_Fr.rc"
+#include "shlwapi_Ja.rc"
+#include "shlwapi_Lt.rc"
+#include "shlwapi_No.rc"
+#include "shlwapi_Ro.rc"
+#include "shlwapi_Ru.rc"
+#include "shlwapi_Si.rc"

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.spec
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.spec?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -193,7 +193,7 @@
 193 stdcall -noname SHGetCurColorRes()
 194 stdcall -noname SHWaitForSendMessageThread(ptr long)
 195 stdcall -noname SHIsExpandableFolder(ptr ptr)
-196 stdcall -noname DnsRecordSetCompare(ptr ptr ptr ptr) dnsapi.DnsRecordSetCompare
+196 stdcall -noname SHVerbExistsNA(str ptr ptr long)
 197 stdcall -noname SHFillRectClr(long ptr long)
 198 stdcall -noname SHSearchMapInt(ptr ptr long long)
 199 stdcall -noname IUnknown_Set(ptr ptr)
@@ -460,8 +460,8 @@
 460 stdcall -noname SHExpandEnvironmentStringsW(wstr ptr long) kernel32.ExpandEnvironmentStringsW
 461 stdcall -noname SHGetAppCompatFlags(long)
 462 stdcall -noname UrlFixupW(wstr wstr long)
-463 stub -noname SHExpandEnvironmentStringsForUserA
-464 stub -noname SHExpandEnvironmentStringsForUserW
+463 stdcall -noname SHExpandEnvironmentStringsForUserA(ptr str ptr long) userenv.ExpandEnvironmentStringsForUserA
+464 stdcall -noname SHExpandEnvironmentStringsForUserW(ptr wstr ptr long) userenv.ExpandEnvironmentStringsForUserW
 465 stub -noname PathUnExpandEnvStringsForUserA
 466 stub -noname PathUnExpandEnvStringsForUserW
 467 stub -noname SHRunIndirectRegClientCommand
@@ -493,7 +493,7 @@
 493 stub -noname SHPropertyBag_ReadType
 494 stub -noname SHPropertyBag_ReadStr
 495 stub -noname SHPropertyBag_WriteStr
-496 stub -noname SHPropertyBag_ReadLONG
+496 stdcall -noname SHPropertyBag_ReadLONG(ptr wstr ptr)
 497 stub -noname SHPropertyBag_WriteLONG
 498 stub -noname SHPropertyBag_ReadBOOLOld
 499 stub -noname SHPropertyBag_WriteBOOL
@@ -531,7 +531,7 @@
 535 stub -noname SHPropertyBag_Delete
 536 stub -noname IUnknown_QueryServicePropertyBag
 537 stub -noname SHBoolSystemParametersInfo
-538 stub -noname IUnknown_QueryServiceForWebBrowserApp
+538 stdcall -noname IUnknown_QueryServiceForWebBrowserApp(ptr ptr ptr)
 539 stub -noname IUnknown_ShowBrowserBar
 540 stub -noname SHInvokeCommandOnContextMenu
 541 stub -noname SHInvokeCommandsOnContextMen
@@ -725,8 +725,8 @@
 @ stdcall SHRegGetPathW(long wstr wstr ptr long)
 @ stdcall SHRegGetUSValueA ( str str ptr ptr ptr long ptr long )
 @ stdcall SHRegGetUSValueW ( wstr wstr ptr ptr ptr long ptr long )
-@ stdcall SHRegGetValueA ( long str str long ptr ptr ptr )
-@ stdcall SHRegGetValueW ( long wstr wstr long ptr ptr ptr )
+@ stdcall SHRegGetValueA ( long str str long ptr ptr ptr ) advapi32.RegGetValueA
+@ stdcall SHRegGetValueW ( long wstr wstr long ptr ptr ptr ) advapi32.RegGetValueW
 @ stdcall SHRegOpenUSKeyA ( str long long long long )
 @ stdcall SHRegOpenUSKeyW ( wstr long long long long )
 @ stdcall SHRegQueryInfoUSKeyA ( long ptr ptr ptr ptr long )

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi_De.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi_De.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi_De.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi_De.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -45,4 +45,3 @@
     IDS_TIME_INTERVAL_MINUTES  " Min"
     IDS_TIME_INTERVAL_SECONDS  " Sek"
 }
-#pragma code_page(default)

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi_Fr.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi_Fr.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi_Fr.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi_Fr.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -46,4 +46,3 @@
     IDS_TIME_INTERVAL_MINUTES  " min"
     IDS_TIME_INTERVAL_SECONDS  " sec"
 }
-#pragma code_page(default)

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi_Ja.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi_Ja.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi_Ja.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi_Ja.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -46,4 +46,3 @@
     IDS_TIME_INTERVAL_MINUTES  " min"
     IDS_TIME_INTERVAL_SECONDS  " sec"
 }
-#pragma code_page(default)

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi_No.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi_No.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi_No.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi_No.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -43,4 +43,3 @@
     IDS_TIME_INTERVAL_MINUTES  " min"
     IDS_TIME_INTERVAL_SECONDS  " sec"
 }
-#pragma code_page(default)

Modified: trunk/reactos/dll/win32/shlwapi/shlwapi_Si.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi_Si.rc?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/shlwapi_Si.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/shlwapi_Si.rc [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -45,4 +45,3 @@
     IDS_TIME_INTERVAL_MINUTES  " min"
     IDS_TIME_INTERVAL_SECONDS  " sek"
 }
-#pragma code_page(default)

Modified: trunk/reactos/dll/win32/shlwapi/url.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/url.c?rev=45791&r1=45790&r2=45791&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] Wed Mar  3 17:21:34 2010
@@ -33,6 +33,7 @@
 #include "winternl.h"
 #define NO_SHLWAPI_STREAM
 #include "shlwapi.h"
+#include "intshcut.h"
 #include "wine/debug.h"
 
 HMODULE WINAPI MLLoadLibraryW(LPCWSTR,HMODULE,DWORD);
@@ -157,8 +158,8 @@
         ptr++;
 
     if (*ptr != ':' || ptr <= x+1) {
-	y->pszProtocol = NULL;
-	return 0x80041001;
+        y->pszProtocol = NULL;
+        return URL_E_INVALID_SYNTAX;
     }
 
     y->pszProtocol = x;
@@ -191,8 +192,8 @@
         ptr++;
 
     if (*ptr != ':' || ptr <= x+1) {
-	y->pszProtocol = NULL;
-	return 0x80041001;
+        y->pszProtocol = NULL;
+        return URL_E_INVALID_SYNTAX;
     }
 
     y->pszProtocol = x;
@@ -283,6 +284,7 @@
     WCHAR slash = '/';
 
     static const WCHAR wszFile[] = {'f','i','l','e',':'};
+    static const WCHAR wszRes[] = {'r','e','s',':'};
     static const WCHAR wszLocalhost[] = {'l','o','c','a','l','h','o','s','t'};
 
     TRACE("(%s, %p, %p, 0x%08x) *pcchCanonicalized: %d\n", debugstr_w(pszUrl), pszCanonicalized,
@@ -303,6 +305,11 @@
     if((dwFlags & URL_FILE_USE_PATHURL) && nByteLen >= sizeof(wszFile)
             && !memcmp(wszFile, pszUrl, sizeof(wszFile)))
         slash = '\\';
+
+    if(nByteLen >= sizeof(wszRes) && !memcmp(wszRes, pszUrl, sizeof(wszRes))) {
+        dwFlags &= ~URL_FILE_USE_PATHURL;
+        slash = '\0';
+    }
 
     /*
      * state =
@@ -368,10 +375,12 @@
             wk1 += nWkLen;
             wk2 += nWkLen;
 
-            while(mp < wk2) {
-                if(*mp == '/' || *mp == '\\')
-                    *mp = slash;
-                mp++;
+            if(slash) {
+                while(mp < wk2) {
+                    if(*mp == '/' || *mp == '\\')
+                        *mp = slash;
+                    mp++;
+                }
             }
             break;
         case 4:
@@ -380,13 +389,20 @@
             while(isalnumW(*wk1) || (*wk1 == '-') || (*wk1 == '.') || (*wk1 == ':'))
                 *wk2++ = *wk1++;
             state = 5;
-            if (!*wk1)
-                *wk2++ = slash;
+            if (!*wk1) {
+                if(slash)
+                    *wk2++ = slash;
+                else
+                    *wk2++ = '/';
+            }
             break;
         case 5:
             if (*wk1 != '/' && *wk1 != '\\') {state = 3; break;}
             while(*wk1 == '/' || *wk1 == '\\') {
-                *wk2++ = slash;
+                if(slash)
+                    *wk2++ = slash;
+                else
+                    *wk2++ = *wk1;
                 wk1++;
             }
             state = 6;
@@ -419,7 +435,10 @@
                     wk2 += nLen;
                     wk1 += nLen;
                 }
-                *wk2++ = slash;
+                if(slash)
+                    *wk2++ = slash;
+                else
+                    *wk2++ = *wk1;
                 wk1++;
 
                 if (*wk1 == '.') {
@@ -436,7 +455,10 @@
                             /* case /../ -> need to backup wk2 */
                             TRACE("found '/../'\n");
                             *(wk2-1) = '\0';  /* set end of string */
-                            mp = strrchrW(root, slash);
+                            mp = strrchrW(root, '/');
+                            mp2 = strrchrW(root, '\\');
+                            if(mp2 && (!mp || mp2 < mp))
+                                mp = mp2;
                             if (mp && (mp >= root)) {
                                 /* found valid backup point */
                                 wk2 = mp + 1;
@@ -1379,8 +1401,7 @@
 {
   INT srcCount = nSrcLen - 1, destCount = nDestLen - 1;
 
-  if (IsBadReadPtr(lpSrc, nSrcLen) ||
-      IsBadWritePtr(lpDest, nDestLen))
+  if (!lpSrc || !lpDest)
     return E_INVALIDARG;
 
   while (destCount >= 0)
@@ -1856,7 +1877,8 @@
                  (*start == '_') ||
                  (*start == '+') ||
                  (*start == '-') ||
-                 (*start == '.')) {
+                 (*start == '.') ||
+                 (*start == ' ')) {
 		start++;
 		(*size)++;
             } else if (*start == '%') {
@@ -1886,7 +1908,8 @@
 	while (cont) {
 	    if (isalnumW(*start) ||
                 (*start == '-') ||
-                (*start == '.') ) {
+                (*start == '.') ||
+                (*start == ' ') ) {
 		start++;
 		(*size)++;
 	    }
@@ -1915,7 +1938,7 @@
     work = URL_ScanID(pl->pScheme, &pl->szScheme, SCHEME);
     if (!*work || (*work != ':')) goto ErrorExit;
     work++;
-    if ((*work != '/') || (*(work+1) != '/')) goto ErrorExit;
+    if ((*work != '/') || (*(work+1) != '/')) goto SuccessExit;
     pl->pUserName = work + 2;
     work = URL_ScanID(pl->pUserName, &pl->szUserName, USERPASS);
     if (*work == ':' ) {
@@ -1956,6 +1979,7 @@
         pl->pQuery = strchrW(work, '?');
 	if (pl->pQuery) pl->szQuery = strlenW(pl->pQuery);
     }
+  SuccessExit:
     TRACE("parse successful: scheme=%p(%d), user=%p(%d), pass=%p(%d), host=%p(%d), port=%p(%d), query=%p(%d)\n",
 	  pl->pScheme, pl->szScheme,
 	  pl->pUserName, pl->szUserName,
@@ -2002,7 +2026,7 @@
     len = INTERNET_MAX_URL_LENGTH;
     ret = UrlGetPartW(in, out, &len, dwPart, dwFlags);
 
-    if (ret != S_OK) {
+    if (FAILED(ret)) {
 	HeapFree(GetProcessHeap(), 0, in);
 	return ret;
     }
@@ -2013,10 +2037,10 @@
 	HeapFree(GetProcessHeap(), 0, in);
 	return E_POINTER;
     }
-    WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0);
-    *pcchOut = len2;
+    len2 = WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0);
+    *pcchOut = len2-1;
     HeapFree(GetProcessHeap(), 0, in);
-    return S_OK;
+    return ret;
 }
 
 /*************************************************************************
@@ -2029,11 +2053,17 @@
 {
     WINE_PARSE_URL pl;
     HRESULT ret;
-    DWORD size, schsize;
+    DWORD scheme, size, schsize;
     LPCWSTR addr, schaddr;
 
     TRACE("(%s %p %p(%d) %08x %08x)\n",
 	  debugstr_w(pszIn), pszOut, pcchOut, *pcchOut, dwPart, dwFlags);
+
+    addr = strchrW(pszIn, ':');
+    if(!addr)
+        return E_FAIL;
+
+    scheme = get_scheme_code(pszIn, addr-pszIn);
 
     ret = URL_ParseUrl(pszIn, &pl);
     if (ret == S_OK) {
@@ -2048,6 +2078,26 @@
 	    break;
 
 	case URL_PART_HOSTNAME:
+            switch(scheme) {
+            case URL_SCHEME_FTP:
+            case URL_SCHEME_HTTP:
+            case URL_SCHEME_GOPHER:
+            case URL_SCHEME_TELNET:
+            case URL_SCHEME_FILE:
+            case URL_SCHEME_HTTPS:
+                break;
+            default:
+                return E_FAIL;
+            }
+
+            if(scheme==URL_SCHEME_FILE && (!pl.szHostName ||
+                        (pl.szHostName==1 && *(pl.pHostName+1)==':'))) {
+                if(pcchOut)
+                    *pszOut = '\0';
+                *pcchOut = 0;
+                return S_FALSE;
+            }
+
 	    if (!pl.szHostName) return E_INVALIDARG;
 	    addr = pl.pHostName;
 	    size = pl.szHostName;
@@ -2099,7 +2149,13 @@
 	    *pcchOut = size;
 	}
 	TRACE("len=%d %s\n", *pcchOut, debugstr_w(pszOut));
-    }
+    }else if(dwPart==URL_PART_HOSTNAME && scheme==URL_SCHEME_FILE) {
+        if(*pcchOut)
+            *pszOut = '\0';
+        *pcchOut = 0;
+        return S_FALSE;
+    }
+
     return ret;
 }
 
@@ -2259,7 +2315,7 @@
  */
 HRESULT WINAPI SHAutoComplete(HWND hwndEdit, DWORD dwFlags)
 {
-  FIXME("SHAutoComplete stub\n");
+  FIXME("stub\n");
   return S_FALSE;
 }
 
@@ -2350,7 +2406,7 @@
           dwResLen = strlenW(lpszRes) + 1;
           if (dwDestLen >= dwResLen + 1)
           {
-            lpszDest[szResLen + dwPathLen + dwResLen] = '/';
+            lpszDest[szResLen + dwPathLen-1] = '/';
             memcpy(lpszDest + szResLen + dwPathLen, lpszRes, dwResLen * sizeof(WCHAR));
             hRet = S_OK;
           }
@@ -2386,7 +2442,7 @@
     if (!url)
         return E_FAIL;
 
-    srcLen = lstrlenW(url);
+    srcLen = lstrlenW(url) + 1;
 
     /* For now just copy the URL directly */
     lstrcpynW(translatedUrl, url, (maxChars < srcLen) ? maxChars : srcLen);




More information about the Ros-diffs mailing list