Author: akhaldi
Date: Sat Jun 3 22:39:50 2017
New Revision: 74847
URL:
http://svn.reactos.org/svn/reactos?rev=74847&view=rev
Log:
[SHLWAPI] Sync with Wine Staging 2.9. CORE-13362
98d0fa9 shlwapi: Use isalnumW() instead of isalnum() for WCHARs.
dfb846c shlwapi: Fixed error handling in StrRetToBufW.
Modified:
trunk/reactos/dll/win32/shlwapi/string.c
trunk/reactos/dll/win32/shlwapi/url.c
trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/shlwapi/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/string.c…
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/string.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/string.c [iso-8859-1] Sat Jun 3 22:39:50 2017
@@ -1500,47 +1500,58 @@
*/
HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, UINT
len)
{
- TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
-
- if (!src)
+ TRACE("dest=%p len=0x%x strret=%p pidl=%p\n", dest, len, src, pidl);
+
+ if (!dest || !len)
+ return E_FAIL;
+
+ if (!src)
+ {
+ WARN("Invalid lpStrRet would crash under Win32!\n");
+ if (dest)
+ *dest = '\0';
+ return E_FAIL;
+ }
+
+ *dest = '\0';
+
+ switch (src->uType) {
+ case STRRET_WSTR: {
+ size_t dst_len;
+ if (!src->u.pOleStr)
+ return E_FAIL;
+ dst_len = strlenW(src->u.pOleStr);
+ memcpy(dest, src->u.pOleStr, min(dst_len, len-1) * sizeof(WCHAR));
+ dest[min(dst_len, len-1)] = 0;
+ CoTaskMemFree(src->u.pOleStr);
+ if (len <= dst_len)
+ {
+ dest[0] = 0;
+ return E_NOT_SUFFICIENT_BUFFER;
+ }
+ break;
+ }
+
+ case STRRET_CSTR:
+ if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ))
+ dest[len-1] = 0;
+ break;
+
+ case STRRET_OFFSET:
+ if (pidl)
{
- WARN("Invalid lpStrRet would crash under Win32!\n");
- if (dest)
- *dest = '\0';
- return E_FAIL;
- }
-
- if (!dest || !len)
- return E_FAIL;
-
- *dest = '\0';
-
- switch (src->uType)
- {
- case STRRET_WSTR:
- lstrcpynW(dest, src->u.pOleStr, len);
- CoTaskMemFree(src->u.pOleStr);
- break;
-
- case STRRET_CSTR:
- if (!MultiByteToWideChar( CP_ACP, 0, src->u.cStr, -1, dest, len ))
- dest[len-1] = 0;
- break;
-
- case STRRET_OFFSET:
- if (pidl)
- {
- if (!MultiByteToWideChar( CP_ACP, 0,
((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
- dest, len ))
- dest[len-1] = 0;
- }
- break;
-
- default:
- FIXME("unknown type!\n");
- return E_NOTIMPL;
- }
- return S_OK;
+ if (!MultiByteToWideChar( CP_ACP, 0,
((LPCSTR)&pidl->mkid)+src->u.uOffset, -1,
+ dest, len ))
+ dest[len-1] = 0;
+ }
+ break;
+
+ default:
+ FIXME("unknown type!\n");
+ return E_NOTIMPL;
+ }
+
+ return S_OK;
}
/*************************************************************************
Modified: trunk/reactos/dll/win32/shlwapi/url.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/url.c?re…
==============================================================================
--- trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] Sat Jun 3 22:39:50 2017
@@ -794,7 +794,7 @@
process_case = 1;
break;
}
- if (isalnum(*mrelative) && (*(mrelative + 1) == ':')) {
+ if (isalnumW(*mrelative) && (*(mrelative + 1) == ':')) {
/* case that becomes "file:///" */
strcpyW(preliminary, myfilestr);
process_case = 1;
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Jun 3 22:39:50 2017
@@ -174,7 +174,7 @@
reactos/dll/win32/shdocvw # Synced to WineStaging-2.2
reactos/dll/win32/shell32 # Forked at Wine-20071011
reactos/dll/win32/shfolder # Synced to WineStaging-1.9.11
-reactos/dll/win32/shlwapi # Synced to WineStaging-2.2
+reactos/dll/win32/shlwapi # Synced to WineStaging-2.9
reactos/dll/win32/slbcsp # Synced to WineStaging-1.9.11
reactos/dll/win32/snmpapi # Synced to WineStaging-1.9.11
reactos/dll/win32/softpub # Synced to WineStaging-1.9.11