Commit 9b43174f authored by Detlef Riekenberg's avatar Detlef Riekenberg Committed by Alexandre Julliard

wininet: Fix flags and SetLastError for InternetCanonicalizeUrlA/W.

parent 1d87649f
......@@ -1506,7 +1506,11 @@ BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer,
LPDWORD lpdwBufferLength, DWORD dwFlags)
{
HRESULT hr;
DWORD dwURLFlags= 0x80000000; /* Don't know what this means */
DWORD dwURLFlags = URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE;
TRACE("(%s, %p, %p, 0x%08x) bufferlength: %d\n", debugstr_a(lpszUrl), lpszBuffer,
lpdwBufferLength, lpdwBufferLength ? *lpdwBufferLength : -1, dwFlags);
if(dwFlags & ICU_DECODE)
{
dwURLFlags |= URL_UNESCAPE;
......@@ -1518,20 +1522,25 @@ BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer,
dwURLFlags |= URL_UNESCAPE;
dwFlags &= ~ICU_ESCAPE;
}
if(dwFlags & ICU_BROWSER_MODE)
{
dwURLFlags |= URL_BROWSER_MODE;
dwFlags &= ~ICU_BROWSER_MODE;
}
if(dwFlags)
FIXME("Unhandled flags 0x%08x\n", dwFlags);
TRACE("%s %p %p %08x\n", debugstr_a(lpszUrl), lpszBuffer,
lpdwBufferLength, dwURLFlags);
if(dwFlags & ICU_NO_ENCODE)
{
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
dwFlags ^= ICU_NO_ENCODE;
dwURLFlags ^= URL_ESCAPE_UNSAFE;
dwFlags &= ~ICU_NO_ENCODE;
}
if (dwFlags) FIXME("Unhandled flags 0x%08x\n", dwFlags);
hr = UrlCanonicalizeA(lpszUrl, lpszBuffer, lpdwBufferLength, dwURLFlags);
if (hr == E_POINTER) SetLastError(ERROR_INSUFFICIENT_BUFFER);
if (hr == E_INVALIDARG) SetLastError(ERROR_INVALID_PARAMETER);
return (hr == S_OK) ? TRUE : FALSE;
}
......@@ -1550,7 +1559,11 @@ BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer,
LPDWORD lpdwBufferLength, DWORD dwFlags)
{
HRESULT hr;
DWORD dwURLFlags= 0x80000000; /* Don't know what this means */
DWORD dwURLFlags = URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE;
TRACE("(%s, %p, %p, 0x%08x) bufferlength: %d\n", debugstr_w(lpszUrl), lpszBuffer,
lpdwBufferLength, lpdwBufferLength ? *lpdwBufferLength : -1, dwFlags);
if(dwFlags & ICU_DECODE)
{
dwURLFlags |= URL_UNESCAPE;
......@@ -1562,24 +1575,31 @@ BOOL WINAPI InternetCanonicalizeUrlW(LPCWSTR lpszUrl, LPWSTR lpszBuffer,
dwURLFlags |= URL_UNESCAPE;
dwFlags &= ~ICU_ESCAPE;
}
if(dwFlags & ICU_BROWSER_MODE)
{
dwURLFlags |= URL_BROWSER_MODE;
dwFlags &= ~ICU_BROWSER_MODE;
}
if(dwFlags)
FIXME("Unhandled flags 0x%08x\n", dwFlags);
TRACE("%s %p %p %08x\n", debugstr_w(lpszUrl), lpszBuffer,
lpdwBufferLength, dwURLFlags);
if(dwFlags & ICU_NO_ENCODE)
{
/* Flip this bit to correspond to URL_ESCAPE_UNSAFE */
dwFlags ^= ICU_NO_ENCODE;
dwURLFlags ^= URL_ESCAPE_UNSAFE;
dwFlags &= ~ICU_NO_ENCODE;
}
if (dwFlags) FIXME("Unhandled flags 0x%08x\n", dwFlags);
hr = UrlCanonicalizeW(lpszUrl, lpszBuffer, lpdwBufferLength, dwURLFlags);
if (hr == E_POINTER) SetLastError(ERROR_INSUFFICIENT_BUFFER);
if (hr == E_INVALIDARG) SetLastError(ERROR_INVALID_PARAMETER);
return (hr == S_OK) ? TRUE : FALSE;
}
/* #################################################### */
static INTERNET_STATUS_CALLBACK set_status_callback(
LPWININETHANDLEHEADER lpwh, INTERNET_STATUS_CALLBACK callback, BOOL unicode)
{
......
......@@ -46,7 +46,6 @@ static void test_InternetCanonicalizeUrlA(void)
dwSize = 1; /* Acrobat Updater use this size */
SetLastError(0xdeadbeef);
res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
todo_wine
ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
"got %u and %u with size %u for '%s' (%d)\n",
res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
......@@ -59,7 +58,6 @@ static void test_InternetCanonicalizeUrlA(void)
SetLastError(0xdeadbeef);
res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
/* dwSize is nr. of needed bytes with the terminating '\0' */
todo_wine
ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
"got %u and %u with size %u for '%s' (%d)\n",
res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment