[SHLWAPI] Sync with Wine Staging 1.9.4. CORE-10912
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 5 Mar 2016 10:20:00 +0000 (10:20 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 5 Mar 2016 10:20:00 +0000 (10:20 +0000)
svn path=/trunk/; revision=70931

reactos/dll/win32/shlwapi/ordinal.c
reactos/dll/win32/shlwapi/shlwapi_main.c
reactos/dll/win32/shlwapi/stopwatch.c
reactos/dll/win32/shlwapi/url.c
reactos/media/doc/README.WINE

index 220b25e..7a59d77 100644 (file)
@@ -78,6 +78,12 @@ HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId,
   TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId,
         dwAccess, dwOptions);
 
+  if (!hShared)
+  {
+    TRACE("Returning handle NULL\n");
+    return NULL;
+  }
+
   /* Get dest process handle */
   if (dwDstProcId == dwMyProcId)
     hDst = GetCurrentProcess();
@@ -239,6 +245,9 @@ BOOL WINAPI SHFreeShared(HANDLE hShared, DWORD dwProcId)
 
   TRACE("(%p %d)\n", hShared, dwProcId);
 
+  if (!hShared)
+    return TRUE;
+
   /* Get a copy of the handle for our process, closing the source handle */
   hClose = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(),
                        FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
@@ -4022,7 +4031,7 @@ BOOL WINAPI IsOS(DWORD feature)
     case OS_SMALLBUSINESSSERVER:
         ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT)
     case OS_TABLETPC:
-        FIXME("(OS_TABLEPC) What should we return here?\n");
+        FIXME("(OS_TABLETPC) What should we return here?\n");
         return FALSE;
     case OS_SERVERADMINUI:
         FIXME("(OS_SERVERADMINUI) What should we return here?\n");
@@ -4819,7 +4828,7 @@ typedef struct SHELL_USER_PERMISSION { /* ...and this should be in shlwapi.h */
  * NOTES
  *  Call should free returned descriptor with LocalFree
  */
-PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
+PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
 {
     PSID *sidlist;
     PSID  cur_user = NULL;
index d4f9e36..bf4cf72 100644 (file)
@@ -85,6 +85,9 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
 
   TRACE("(%p)\n",pdvi);
 
+  if (!pdvi)
+    return E_INVALIDARG;
+
   switch (pdvi2->info1.cbSize)
   {
   case sizeof(DLLVERSIONINFO2):
@@ -98,7 +101,7 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
     pdvi2->info1.dwPlatformID = DLLVER_PLATFORM_WINDOWS;
     return S_OK;
  }
- if (pdvi)
  WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
+
+ WARN("pdvi->cbSize = %d, unhandled\n", pdvi2->info1.cbSize);
  return E_INVALIDARG;
 }
index 28c85c3..60dc1a6 100644 (file)
@@ -175,16 +175,16 @@ void WINAPI StopWatch_MarkJavaStop(LPCWSTR lpszEvent, HWND hWnd, DWORD dwReserve
  */
 DWORD WINAPI GetPerfTime(void)
 {
-  static LONG64 iCounterFreq = 0;
+  static LARGE_INTEGER iCounterFreq = { {0} };
   LARGE_INTEGER iCounter;
 
   TRACE("()\n");
 
-  if (!iCounterFreq)
-   QueryPerformanceFrequency((LARGE_INTEGER*)&iCounterFreq);
+  if (!iCounterFreq.QuadPart)
+   QueryPerformanceFrequency(&iCounterFreq);
 
   QueryPerformanceCounter(&iCounter);
-  iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq;
+  iCounter.QuadPart = iCounter.QuadPart * 1000 / iCounterFreq.QuadPart;
   return iCounter.u.LowPart;
 }
 
index 62ee506..9cfe9cf 100644 (file)
@@ -946,6 +946,8 @@ HRESULT WINAPI UrlEscapeA(
 
     if(!RtlCreateUnicodeStringFromAsciiz(&urlW, pszUrl))
         return E_INVALIDARG;
+    if(dwFlags & URL_ESCAPE_AS_UTF8)
+        return E_NOTIMPL;
     if((ret = UrlEscapeW(urlW.Buffer, escapedW, &lenW, dwFlags)) == E_POINTER) {
         escapedW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
         ret = UrlEscapeW(urlW.Buffer, escapedW, &lenW, dwFlags);
@@ -982,6 +984,9 @@ static inline BOOL URL_NeedEscapeW(WCHAR ch, DWORD flags, DWORD int_flags)
     if ((flags & URL_ESCAPE_PERCENT) && (ch == '%'))
        return TRUE;
 
+    if ((flags & URL_ESCAPE_AS_UTF8) && (ch >= 0x80))
+       return TRUE;
+
     if (ch <= 31 || (ch >= 127 && ch <= 255) )
        return TRUE;
 
@@ -1057,8 +1062,8 @@ HRESULT WINAPI UrlEscapeW(
     LPCWSTR src;
     DWORD needed = 0, ret;
     BOOL stop_escaping = FALSE;
-    WCHAR next[5], *dst, *dst_ptr;
-    INT len;
+    WCHAR next[12], *dst, *dst_ptr;
+    INT i, len;
     PARSEDURLW parsed_url;
     DWORD int_flags;
     DWORD slashes = 0;
@@ -1073,7 +1078,8 @@ HRESULT WINAPI UrlEscapeW(
     if(dwFlags & ~(URL_ESCAPE_SPACES_ONLY |
                   URL_ESCAPE_SEGMENT_ONLY |
                   URL_DONT_ESCAPE_EXTRA_INFO |
-                  URL_ESCAPE_PERCENT))
+                  URL_ESCAPE_PERCENT |
+                  URL_ESCAPE_AS_UTF8))
         FIXME("Unimplemented flags: %08x\n", dwFlags);
 
     dst_ptr = dst = HeapAlloc(GetProcessHeap(), 0, *pcchEscaped*sizeof(WCHAR));
@@ -1176,10 +1182,39 @@ HRESULT WINAPI UrlEscapeW(
             if(cur == '\\' && (int_flags & WINE_URL_BASH_AS_SLASH) && !stop_escaping) cur = '/';
 
             if(URL_NeedEscapeW(cur, dwFlags, int_flags) && stop_escaping == FALSE) {
-                next[0] = '%';
-                next[1] = hexDigits[(cur >> 4) & 0xf];
-                next[2] = hexDigits[cur & 0xf];
-                len = 3;
+                if(dwFlags & URL_ESCAPE_AS_UTF8) {
+                    char utf[16];
+
+                    if ((cur >= 0xd800 && cur <= 0xdfff) &&
+                        (src[1] >= 0xdc00 && src[1] <= 0xdfff))
+                    {
+                        len = WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, src, 2,
+                                                   utf, sizeof(utf), NULL, NULL );
+                        src++;
+                    }
+                    else
+                        len = WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, &cur, 1,
+                                                   utf, sizeof(utf), NULL, NULL );
+
+                    if (!len) {
+                        utf[0] = 0xef;
+                        utf[1] = 0xbf;
+                        utf[2] = 0xbd;
+                        len = 3;
+                    }
+
+                    for(i = 0; i < len; i++) {
+                        next[i*3+0] = '%';
+                        next[i*3+1] = hexDigits[(utf[i] >> 4) & 0xf];
+                        next[i*3+2] = hexDigits[utf[i] & 0xf];
+                    }
+                    len *= 3;
+                } else {
+                    next[0] = '%';
+                    next[1] = hexDigits[(cur >> 4) & 0xf];
+                    next[2] = hexDigits[cur & 0xf];
+                    len = 3;
+                }
             } else {
                 next[0] = cur;
                 len = 1;
index 97d8d8b..e6c4716 100644 (file)
@@ -177,7 +177,7 @@ reactos/dll/win32/shdoclc             # Synced to WineStaging-1.7.55
 reactos/dll/win32/shdocvw             # Synced to WineStaging-1.7.55
 reactos/dll/win32/shell32             # Forked at Wine-20071011
 reactos/dll/win32/shfolder            # Synced to WineStaging-1.7.55
-reactos/dll/win32/shlwapi             # Synced to WineStaging-1.7.55
+reactos/dll/win32/shlwapi             # Synced to WineStaging-1.9.4
 reactos/dll/win32/slbcsp              # Synced to WineStaging-1.7.55
 reactos/dll/win32/snmpapi             # Synced to WineStaging-1.7.55
 reactos/dll/win32/softpub             # Synced to WineStaging-1.7.55