Author: akhaldi Date: Sun Mar 24 12:35:51 2013 New Revision: 58600
URL: http://svn.reactos.org/svn/reactos?rev=58600&view=rev Log: [SHLWAPI] * Sync with Wine 1.5.26.
Modified: trunk/reactos/dll/win32/shlwapi/istream.c trunk/reactos/dll/win32/shlwapi/ordinal.c trunk/reactos/dll/win32/shlwapi/path.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/string.c trunk/reactos/dll/win32/shlwapi/thread.c trunk/reactos/dll/win32/shlwapi/url.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/shlwapi/istream.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/istream.c... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/istream.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/istream.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -531,7 +531,7 @@ if (!lpszPath) return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
- MultiByteToWideChar(0, 0, lpszPath, -1, szPath, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, szPath, MAX_PATH); return SHCreateStreamOnFileW(szPath, dwMode, lppStream); }
Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/ordinal.c... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -639,25 +639,6 @@ return 0; memcpy(lpszDest, xguid, iLen*sizeof(WCHAR)); return iLen; -} - -/************************************************************************* - * @ [SHLWAPI.29] - * - * Determine if a Unicode character is a space. - * - * PARAMS - * wc [I] Character to check. - * - * RETURNS - * TRUE, if wc is a space, - * FALSE otherwise. - */ -BOOL WINAPI IsCharSpaceW(WCHAR wc) -{ - WORD CharType; - - return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_SPACE); }
/************************************************************************* @@ -2680,7 +2661,7 @@ lpSubKey = strRegistryPolicyW;
retval = RegOpenKeyW(HKEY_LOCAL_MACHINE, lpSubKey, &hKey); - if (retval != ERROR_SUCCESS) + if (retval != ERROR_SUCCESS) retval = RegOpenKeyW(HKEY_CURRENT_USER, lpSubKey, &hKey); if (retval != ERROR_SUCCESS) return 0; @@ -2728,7 +2709,7 @@ /* we have a known policy */
/* check if this policy has been cached */ - if (*polArr == SHELL_NO_POLICY) + if (*polArr == SHELL_NO_POLICY) *polArr = SHGetRestriction(initial, polTable->appstr, polTable->keystr); return *polArr; }
Modified: trunk/reactos/dll/win32/shlwapi/path.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/path.c?re... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -3246,6 +3246,9 @@ HRESULT ret; DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
+ if (!pszUrl || !pszPath || !pcchPath || !*pcchPath) + return E_INVALIDARG; + if(!RtlCreateUnicodeStringFromAsciiz(&urlW, pszUrl)) return E_INVALIDARG; if((ret = PathCreateFromUrlW(urlW.Buffer, pathW, &lenW, dwReserved)) == E_POINTER) { @@ -3287,61 +3290,156 @@ LPDWORD pcchPath, DWORD dwReserved) { static const WCHAR file_colon[] = { 'f','i','l','e',':',0 }; - HRESULT hr; - DWORD nslashes = 0; - WCHAR *ptr; + static const WCHAR localhost[] = { 'l','o','c','a','l','h','o','s','t',0 }; + DWORD nslashes, unescape, len; + const WCHAR *src; + WCHAR *tpath, *dst; + HRESULT ret;
TRACE("(%s,%p,%p,0x%08x)\n", debugstr_w(pszUrl), pszPath, pcchPath, dwReserved);
if (!pszUrl || !pszPath || !pcchPath || !*pcchPath) return E_INVALIDARG;
- - if (strncmpW(pszUrl, file_colon, 5)) + if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5, + file_colon, 5) != CSTR_EQUAL) return E_INVALIDARG; pszUrl += 5; - - while(*pszUrl == '/' || *pszUrl == '\') { + ret = S_OK; + + src = pszUrl; + nslashes = 0; + while (*src == '/' || *src == '\') { nslashes++; - pszUrl++; - } - - if(isalphaW(*pszUrl) && (pszUrl[1] == ':' || pszUrl[1] == '|') && (pszUrl[2] == '/' || pszUrl[2] == '\')) - nslashes = 0; - - switch(nslashes) { + src++; + } + + /* We need a temporary buffer so we can compute what size to ask for. + * We know that the final string won't be longer than the current pszUrl + * plus at most two backslashes. All the other transformations make it + * shorter. + */ + len = 2 + lstrlenW(pszUrl) + 1; + if (*pcchPath < len) + tpath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + else + tpath = pszPath; + + len = 0; + dst = tpath; + unescape = 1; + switch (nslashes) + { + case 0: + /* 'file:' + escaped DOS path */ + break; + case 1: + /* 'file:/' + escaped DOS path */ + /* fall through */ + case 3: + /* 'file:///' (implied localhost) + escaped DOS path */ + if (!isalphaW(*src) || (src[1] != ':' && src[1] != '|')) + src -= 1; + break; case 2: - pszUrl -= 2; + if (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, src, 9, + localhost, 9) == CSTR_EQUAL && + (src[9] == '/' || src[9] == '\')) + { + /* 'file://localhost/' + escaped DOS path */ + src += 10; + } + else if (isalphaW(*src) && (src[1] == ':' || src[1] == '|')) + { + /* 'file://' + unescaped DOS path */ + unescape = 0; + } + else + { + /* 'file://hostname:port/path' (where path is escaped) + * or 'file:' + escaped UNC path (\server\share\path) + * The second form is clearly specific to Windows and it might + * even be doing a network lookup to try to figure it out. + */ + while (*src && *src != '/' && *src != '\') + src++; + len = src - pszUrl; + StrCpyNW(dst, pszUrl, len + 1); + dst += len; + if (isalphaW(src[1]) && (src[2] == ':' || src[2] == '|')) + { + /* 'Forget' to add a trailing '/', just like Windows */ + src++; + } + } break; - case 0: - break; + case 4: + /* 'file://' + unescaped UNC path (\server\share\path) */ + unescape = 0; + if (isalphaW(*src) && (src[1] == ':' || src[1] == '|')) + break; + /* fall through */ default: - pszUrl -= 1; - break; - } - - hr = UrlUnescapeW((LPWSTR)pszUrl, pszPath, pcchPath, 0); - if(hr != S_OK) return hr; - - for(ptr = pszPath; *ptr; ptr++) - if(*ptr == '/') *ptr = '\'; - - while(*pszPath == '\') - pszPath++; - - if(isalphaW(*pszPath) && pszPath[1] == '|' && pszPath[2] == '\') /* c|\ -> c:\ */ - pszPath[1] = ':'; - - if(nslashes == 2 && (ptr = strchrW(pszPath, '\'))) { /* \host\c:\ -> \hostc:\ */ - ptr++; - if(isalphaW(*ptr) && (ptr[1] == ':' || ptr[1] == '|') && ptr[2] == '\') { - memmove(ptr - 1, ptr, (strlenW(ptr) + 1) * sizeof(WCHAR)); - (*pcchPath)--; + /* 'file:/...' + escaped UNC path (\server\share\path) */ + src -= 2; + } + + /* Copy the remainder of the path */ + len += lstrlenW(src); + StrCpyW(dst, src); + + /* First do the Windows-specific path conversions */ + for (dst = tpath; *dst; dst++) + if (*dst == '/') *dst = '\'; + if (isalphaW(*tpath) && tpath[1] == '|') + tpath[1] = ':'; /* c| -> c: */ + + /* And only then unescape the path (i.e. escaped slashes are left as is) */ + if (unescape) + { + ret = UrlUnescapeW(tpath, NULL, &len, URL_UNESCAPE_INPLACE); + if (ret == S_OK) + { + /* When working in-place UrlUnescapeW() does not set len */ + len = lstrlenW(tpath); } }
- TRACE("Returning %s\n",debugstr_w(pszPath)); - + if (*pcchPath < len + 1) + { + ret = E_POINTER; + *pcchPath = len + 1; + } + else + { + *pcchPath = len; + if (tpath != pszPath) + StrCpyW(pszPath, tpath); + } + if (tpath != pszPath) + HeapFree(GetProcessHeap(), 0, tpath); + + TRACE("Returning (%u) %s\n", *pcchPath, debugstr_w(pszPath)); + return ret; +} + +/************************************************************************* + * PathCreateFromUrlAlloc [SHLWAPI.@] + */ +HRESULT WINAPI PathCreateFromUrlAlloc(LPCWSTR pszUrl, LPWSTR *pszPath, + DWORD dwReserved) +{ + WCHAR pathW[MAX_PATH]; + DWORD size; + HRESULT hr; + + size = MAX_PATH; + hr = PathCreateFromUrlW(pszUrl, pathW, &size, dwReserved); + if (SUCCEEDED(hr)) + { + /* Yes, this is supposed to crash if pszPath is NULL */ + *pszPath = StrDupW(pathW); + } 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... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/reg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/reg.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -2232,7 +2232,7 @@ TRACE("(hkey=%p,%s,%p08x,%d)\n", hKeySrc, debugstr_a(lpszSrcSubKey), hKeyDst, dwReserved);
if (lpszSrcSubKey) - MultiByteToWideChar(0, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, lpszSrcSubKey, -1, szSubKeyW, MAX_PATH);
return SHCopyKeyW(hKeySrc, lpszSrcSubKey ? szSubKeyW : NULL, hKeyDst, dwReserved); }
Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.r... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.rc [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -1,5 +1,5 @@ /* - * Top level resource file for shlwapi + * Resources for shlwapi * * Copyright 2004 Jon Griffiths *
Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.s... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -566,6 +566,8 @@ @ stdcall HashData (ptr long ptr long) @ stdcall IntlStrEqWorkerA(long str str long) StrIsIntlEqualA @ stdcall IntlStrEqWorkerW(long wstr wstr long) StrIsIntlEqualW +@ stdcall IsCharSpaceA(long) +@ stdcall IsInternetESCEnabled() @ stdcall PathAddBackslashA (str) @ stdcall PathAddBackslashW (wstr) @ stdcall PathAddExtensionA (str str) @@ -586,6 +588,7 @@ @ stdcall PathCompactPathW(long wstr long) @ stdcall PathCreateFromUrlA(str ptr ptr long) @ stdcall PathCreateFromUrlW(wstr ptr ptr long) +@ stdcall PathCreateFromUrlAlloc(wstr ptr long) @ stdcall PathFileExistsA (str) @ stdcall PathFileExistsW (wstr) @ stdcall PathFindExtensionA (str)
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] Sun Mar 24 12:35:51 2013 @@ -1891,7 +1891,7 @@
if (lpszStr) { - len = MultiByteToWideChar(0, 0, lpszStr, -1, 0, 0) * sizeof(WCHAR); + len = MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, NULL, 0) * sizeof(WCHAR); *lppszDest = CoTaskMemAlloc(len); } else @@ -1899,7 +1899,7 @@
if (*lppszDest) { - MultiByteToWideChar(0, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpszStr, -1, *lppszDest, len/sizeof(WCHAR)); hRet = S_OK; } else @@ -2828,3 +2828,28 @@ HeapFree(GetProcessHeap(), 0, dllname); return hr; } + +BOOL WINAPI IsCharSpaceA(CHAR c) +{ + WORD CharType; + return GetStringTypeA(GetSystemDefaultLCID(), CT_CTYPE1, &c, 1, &CharType) && (CharType & C1_SPACE); +} + +/************************************************************************* + * @ [SHLWAPI.29] + * + * Determine if a Unicode character is a space. + * + * PARAMS + * wc [I] Character to check. + * + * RETURNS + * TRUE, if wc is a space, + * FALSE otherwise. + */ +BOOL WINAPI IsCharSpaceW(WCHAR wc) +{ + WORD CharType; + + return GetStringTypeW(CT_CTYPE1, &wc, 1, &CharType) && (CharType & C1_SPACE); +}
Modified: trunk/reactos/dll/win32/shlwapi/thread.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/thread.c?... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/thread.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/thread.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -534,7 +534,7 @@ TRACE("(%s,%d)\n", debugstr_a(lpszName), iInitial);
if (lpszName) - MultiByteToWideChar(0, 0, lpszName, -1, szBuff, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, lpszName, -1, szBuff, MAX_PATH); return SHGlobalCounterCreateNamedW(lpszName ? szBuff : NULL, iInitial); }
Modified: trunk/reactos/dll/win32/shlwapi/url.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/url.c?rev... ============================================================================== --- trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -270,8 +270,8 @@
ret = UrlCanonicalizeW(url, canonical, pcchCanonicalized, dwFlags); if(ret == S_OK) - WideCharToMultiByte(0, 0, canonical, -1, pszCanonicalized, - *pcchCanonicalized+1, 0, 0); + WideCharToMultiByte(CP_ACP, 0, canonical, -1, pszCanonicalized, + *pcchCanonicalized+1, NULL, NULL);
HeapFree(GetProcessHeap(), 0, url); HeapFree(GetProcessHeap(), 0, canonical); @@ -631,8 +631,8 @@ relative = base + INTERNET_MAX_URL_LENGTH; combined = relative + INTERNET_MAX_URL_LENGTH;
- MultiByteToWideChar(0, 0, pszBase, -1, base, INTERNET_MAX_URL_LENGTH); - MultiByteToWideChar(0, 0, pszRelative, -1, relative, INTERNET_MAX_URL_LENGTH); + MultiByteToWideChar(CP_ACP, 0, pszBase, -1, base, INTERNET_MAX_URL_LENGTH); + MultiByteToWideChar(CP_ACP, 0, pszRelative, -1, relative, INTERNET_MAX_URL_LENGTH); len = *pcchCombined;
ret = UrlCombineW(base, relative, pszCombined?combined:NULL, &len, dwFlags); @@ -642,14 +642,14 @@ return ret; }
- len2 = WideCharToMultiByte(0, 0, combined, len, 0, 0, 0, 0); + len2 = WideCharToMultiByte(CP_ACP, 0, combined, len, NULL, 0, NULL, NULL); if (len2 > *pcchCombined) { *pcchCombined = len2; HeapFree(GetProcessHeap(), 0, base); return E_POINTER; } - WideCharToMultiByte(0, 0, combined, len+1, pszCombined, (*pcchCombined)+1, - 0, 0); + WideCharToMultiByte(CP_ACP, 0, combined, len+1, pszCombined, (*pcchCombined)+1, + NULL, NULL); *pcchCombined = len2; HeapFree(GetProcessHeap(), 0, base); return S_OK; @@ -1601,7 +1601,7 @@ /* Win32 hashes the data as an ASCII string, presumably so that both A+W * return the same digests for the same URL. */ - WideCharToMultiByte(0, 0, pszUrl, -1, szUrl, MAX_PATH, 0, 0); + WideCharToMultiByte(CP_ACP, 0, pszUrl, -1, szUrl, MAX_PATH, NULL, NULL); HashData((const BYTE*)szUrl, (int)strlen(szUrl), lpDest, nDestLen); return S_OK; } @@ -1670,7 +1670,7 @@ WCHAR value[MAX_PATH], data[MAX_PATH]; WCHAR Wxx, Wyy;
- MultiByteToWideChar(0, 0, + MultiByteToWideChar(CP_ACP, 0, "Software\Microsoft\Windows\CurrentVersion\URL\Prefixes", -1, reg_path, MAX_PATH); RegOpenKeyExW(HKEY_LOCAL_MACHINE, reg_path, 0, 1, &newkey); @@ -1868,7 +1868,8 @@ return FALSE;
case URLIS_FILEURL: - return !StrCmpNA("file:", pszUrl, 5); + return (CompareStringA(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5, + "file:", 5) == CSTR_EQUAL);
case URLIS_DIRECTORY: last = pszUrl + strlen(pszUrl) - 1; @@ -1893,7 +1894,7 @@ */ BOOL WINAPI UrlIsW(LPCWSTR pszUrl, URLIS Urlis) { - static const WCHAR stemp[] = { 'f','i','l','e',':',0 }; + static const WCHAR file_colon[] = { 'f','i','l','e',':',0 }; PARSEDURLW base; DWORD res1; LPCWSTR last; @@ -1921,7 +1922,8 @@ return FALSE;
case URLIS_FILEURL: - return !strncmpW(stemp, pszUrl, 5); + return (CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, pszUrl, 5, + file_colon, 5) == CSTR_EQUAL);
case URLIS_DIRECTORY: last = pszUrl + strlenW(pszUrl) - 1; @@ -2199,7 +2201,7 @@ (2*INTERNET_MAX_URL_LENGTH) * sizeof(WCHAR)); out = in + INTERNET_MAX_URL_LENGTH;
- MultiByteToWideChar(0, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH); + MultiByteToWideChar(CP_ACP, 0, pszIn, -1, in, INTERNET_MAX_URL_LENGTH);
len = INTERNET_MAX_URL_LENGTH; ret = UrlGetPartW(in, out, &len, dwPart, dwFlags); @@ -2209,13 +2211,13 @@ return ret; }
- len2 = WideCharToMultiByte(0, 0, out, len, 0, 0, 0, 0); + len2 = WideCharToMultiByte(CP_ACP, 0, out, len, NULL, 0, NULL, NULL); if (len2 > *pcchOut) { *pcchOut = len2+1; HeapFree(GetProcessHeap(), 0, in); return E_POINTER; } - len2 = WideCharToMultiByte(0, 0, out, len+1, pszOut, *pcchOut, 0, 0); + len2 = WideCharToMultiByte(CP_ACP, 0, out, len+1, pszOut, *pcchOut, NULL, NULL); *pcchOut = len2-1; HeapFree(GetProcessHeap(), 0, in); return ret; @@ -2529,7 +2531,7 @@ hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags, lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen); if (SUCCEEDED(hRet) && lpszDest) - WideCharToMultiByte(CP_ACP, 0, szDest, -1, lpszDest, dwDestLen, 0, 0); + WideCharToMultiByte(CP_ACP, 0, szDest, -1, lpszDest, dwDestLen, NULL, NULL);
return hRet; } @@ -2623,3 +2625,12 @@
return S_OK; } + +/************************************************************************* + * IsInternetESCEnabled [SHLWAPI.@] + */ +BOOL WINAPI IsInternetESCEnabled(void) +{ + FIXME(": stub\n"); + return FALSE; +}
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=5... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Mar 24 12:35:51 2013 @@ -164,7 +164,7 @@ reactos/dll/win32/shdocvw # Autosync reactos/dll/win32/shell32 # Forked at Wine-20071011 reactos/dll/win32/shfolder # Autosync -reactos/dll/win32/shlwapi # Synced to Wine-1.5.13 +reactos/dll/win32/shlwapi # Synced to Wine-1.5.26 reactos/dll/win32/slbcsp # Synced to Wine-1.5.19 reactos/dll/win32/snmpapi # Synced to Wine-1.5.19 reactos/dll/win32/softpub # Synced to Wine-1.5.19