shlwapi: Fix returned result code and size in UrlCanonicalizeA.
This commit is contained in:
parent
80192b93eb
commit
1d87649f3c
|
@ -268,11 +268,11 @@ HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized,
|
||||||
LPDWORD pcchCanonicalized, DWORD dwFlags)
|
LPDWORD pcchCanonicalized, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
LPWSTR base, canonical;
|
LPWSTR base, canonical;
|
||||||
DWORD ret, len, len2;
|
HRESULT ret;
|
||||||
|
DWORD len, len2;
|
||||||
|
|
||||||
TRACE("(%s %p %p 0x%08x) using W version\n",
|
TRACE("(%s, %p, %p, 0x%08x) *pcchCanonicalized: %d\n", debugstr_a(pszUrl), pszCanonicalized,
|
||||||
debugstr_a(pszUrl), pszCanonicalized,
|
pcchCanonicalized, dwFlags, pcchCanonicalized ? *pcchCanonicalized : -1);
|
||||||
pcchCanonicalized, dwFlags);
|
|
||||||
|
|
||||||
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
|
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -286,19 +286,19 @@ HRESULT WINAPI UrlCanonicalizeA(LPCSTR pszUrl, LPSTR pszCanonicalized,
|
||||||
|
|
||||||
ret = UrlCanonicalizeW(base, canonical, &len, dwFlags);
|
ret = UrlCanonicalizeW(base, canonical, &len, dwFlags);
|
||||||
if (ret != S_OK) {
|
if (ret != S_OK) {
|
||||||
HeapFree(GetProcessHeap(), 0, base);
|
*pcchCanonicalized = len * 2;
|
||||||
return ret;
|
HeapFree(GetProcessHeap(), 0, base);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
len2 = WideCharToMultiByte(0, 0, canonical, len, 0, 0, 0, 0);
|
len2 = WideCharToMultiByte(0, 0, canonical, -1, 0, 0, 0, 0);
|
||||||
if (len2 > *pcchCanonicalized) {
|
if (len2 > *pcchCanonicalized) {
|
||||||
*pcchCanonicalized = len;
|
*pcchCanonicalized = len2;
|
||||||
HeapFree(GetProcessHeap(), 0, base);
|
HeapFree(GetProcessHeap(), 0, base);
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
}
|
}
|
||||||
WideCharToMultiByte(0, 0, canonical, len+1, pszCanonicalized,
|
WideCharToMultiByte(0, 0, canonical, -1, pszCanonicalized, *pcchCanonicalized, 0, 0);
|
||||||
*pcchCanonicalized, 0, 0);
|
*pcchCanonicalized = len;
|
||||||
*pcchCanonicalized = len2;
|
|
||||||
HeapFree(GetProcessHeap(), 0, base);
|
HeapFree(GetProcessHeap(), 0, base);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -320,8 +320,8 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|
||||||
|
|
||||||
static const WCHAR wszFile[] = {'f','i','l','e',':'};
|
static const WCHAR wszFile[] = {'f','i','l','e',':'};
|
||||||
|
|
||||||
TRACE("(%s %p %p 0x%08x)\n", debugstr_w(pszUrl), pszCanonicalized,
|
TRACE("(%s, %p, %p, 0x%08x) *pcchCanonicalized: %d\n", debugstr_w(pszUrl), pszCanonicalized,
|
||||||
pcchCanonicalized, dwFlags);
|
pcchCanonicalized, dwFlags, pcchCanonicalized ? *pcchCanonicalized : -1);
|
||||||
|
|
||||||
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
|
if(!pszUrl || !pszCanonicalized || !pcchCanonicalized)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
Loading…
Reference in New Issue