diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 84f945f14e6..6d656208df4 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -668,7 +668,7 @@ init SHLWAPI_LibMain @ stdcall UrlGetPartA(str ptr ptr long long) UrlGetPartA @ stdcall UrlGetPartW(wstr ptr ptr long long) UrlGetPartW @ stdcall UrlHashA(str ptr long) UrlHashA -@ stub UrlHashW +@ stdcall UrlHashW(wstr ptr long) UrlHashW @ stdcall UrlIsA(str long) UrlIsA @ stdcall UrlIsNoHistoryA(str) UrlIsNoHistoryA @ stdcall UrlIsNoHistoryW(wstr) UrlIsNoHistoryW diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c index fce2bb953d9..2d5d9877a56 100644 --- a/dlls/shlwapi/url.c +++ b/dlls/shlwapi/url.c @@ -1172,7 +1172,29 @@ HRESULT WINAPI UrlHashA(LPCSTR pszUrl, unsigned char *lpDest, INT nDestLen) return E_INVALIDARG; HashData(pszUrl, strlen(pszUrl), lpDest, nDestLen); - return NOERROR; + return S_OK; +} + +/************************************************************************* + * UrlHashW [SHLWAPI.@] + * + * See UrlHashA. + */ +HRESULT WINAPI UrlHashW(LPCWSTR pszUrl, unsigned char *lpDest, INT nDestLen) +{ + char szUrl[MAX_PATH]; + + TRACE("(%s,%p,%d)\n",debugstr_w(pszUrl), lpDest, nDestLen); + + if (IsBadStringPtrW(pszUrl, -1) || IsBadWritePtr(lpDest, nDestLen)) + return E_INVALIDARG; + + /* 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); + HashData(szUrl, strlen(szUrl), lpDest, nDestLen); + return S_OK; } /*************************************************************************