[SHLWAPI_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246

svn path=/trunk/; revision=67399
This commit is contained in:
Amine Khaldi 2015-04-25 10:59:43 +00:00
parent feb215f7d1
commit 38cd269217
4 changed files with 65 additions and 48 deletions

View file

@ -296,14 +296,14 @@ static void test_GetAcceptLanguagesA(void)
When the buffer is large enough, the default language is returned When the buffer is large enough, the default language is returned
When the buffer is too small for that fallback, win7_32 and w2k8_64 When the buffer is too small for that fallback, win7_32 and w2k8_64
fail with HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), win8 fails fail with E_NOT_SUFFICIENT_BUFFER, win8 fails with HRESULT_FROM_WIN32(ERROR_MORE_DATA),
with HRESULT_FROM_WIN32(ERROR_MORE_DATA), other versions succeed and other versions succeed and return a partial result while older os succeed
return a partial result while older os succeed and overflow the buffer */ and overflow the buffer */
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize)),
"==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
@ -315,7 +315,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize - 1)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize - 1)),
"-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
} }
@ -327,7 +327,7 @@ static void test_GetAcceptLanguagesA(void)
ok(((hr == E_INVALIDARG) && (len == 0)) || ok(((hr == E_INVALIDARG) && (len == 0)) ||
(((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) || (((hr == S_OK) && !lstrcmpA(buffer, language) && (len == lstrlenA(language))) ||
((hr == S_OK) && !memcmp(buffer, language, len)) || ((hr == S_OK) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == 1)), ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == 1)),
"=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer); "=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
@ -359,7 +359,7 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0; buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &len); hr = pGetAcceptLanguagesA( buffer, &len);
ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) || ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len), ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
"=2: got 0x%x with %d and %s\n", hr, len, buffer); "=2: got 0x%x with %d and %s\n", hr, len, buffer);
@ -368,11 +368,11 @@ static void test_GetAcceptLanguagesA(void)
buffer[maxlen] = 0; buffer[maxlen] = 0;
hr = pGetAcceptLanguagesA( buffer, &len); hr = pGetAcceptLanguagesA( buffer, &len);
/* When the buffer is too small, win7_32 and w2k8_64 and above fail with /* When the buffer is too small, win7_32 and w2k8_64 and above fail with
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), win8 ERROR_CANNOT_COPY, E_NOT_SUFFICIENT_BUFFER, win8 ERROR_CANNOT_COPY,
other versions succeed and return a partial 0 terminated result while other versions other versions succeed and return a partial 0 terminated result while other versions
fail with E_INVALIDARG and return a partial unterminated result */ fail with E_INVALIDARG and return a partial unterminated result */
ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) || ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
((hr == __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)) && !len) || ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len), ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
"=1: got 0x%x with %d and %s\n", hr, len, buffer); "=1: got 0x%x with %d and %s\n", hr, len, buffer);

View file

@ -639,8 +639,7 @@ static void test_PathCombineA(void)
ok(str == NULL || ok(str == NULL ||
broken(str != NULL), /* Win95 and some W2K */ broken(str != NULL), /* Win95 and some W2K */
"Expected str == NULL, got %p\n", str); "Expected str == NULL, got %p\n", str);
ok(lstrlenA(dest) == 0 || ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
"Expected 0 length, got %i\n", lstrlenA(dest)); "Expected 0 length, got %i\n", lstrlenA(dest));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -729,8 +728,7 @@ static void test_PathCombineA(void)
lstrcpyA(dest, "control"); lstrcpyA(dest, "control");
str = PathCombineA(dest, "C:\\", too_long); str = PathCombineA(dest, "C:\\", too_long);
ok(str == NULL, "Expected str == NULL, got %p\n", str); ok(str == NULL, "Expected str == NULL, got %p\n", str);
ok(lstrlenA(dest) == 0 || ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
"Expected 0 length, got %i\n", lstrlenA(dest)); "Expected 0 length, got %i\n", lstrlenA(dest));
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -739,8 +737,7 @@ static void test_PathCombineA(void)
lstrcpyA(dest, "control"); lstrcpyA(dest, "control");
str = PathCombineA(dest, too_long, "one\\two\\three"); str = PathCombineA(dest, too_long, "one\\two\\three");
ok(str == NULL, "Expected str == NULL, got %p\n", str); ok(str == NULL, "Expected str == NULL, got %p\n", str);
ok(lstrlenA(dest) == 0 || ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
"Expected 0 length, got %i\n", lstrlenA(dest)); "Expected 0 length, got %i\n", lstrlenA(dest));
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -754,8 +751,7 @@ static void test_PathCombineA(void)
lstrcpyA(dest, "control"); lstrcpyA(dest, "control");
str = PathCombineA(dest, one, two); str = PathCombineA(dest, one, two);
ok(str == NULL, "Expected str == NULL, got %p\n", str); ok(str == NULL, "Expected str == NULL, got %p\n", str);
ok(lstrlenA(dest) == 0 || ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
"Expected 0 length, got %i\n", lstrlenA(dest)); "Expected 0 length, got %i\n", lstrlenA(dest));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
} }
@ -777,7 +773,7 @@ static void test_PathAddBackslash(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
str = PathAddBackslashA(path); str = PathAddBackslashA(path);
ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str); ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
ok(lstrlenA(path) == 0, "Expected empty string, got %i\n", lstrlenA(path)); ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
/* try a relative path */ /* try a relative path */
@ -922,8 +918,7 @@ static void test_PathAppendA(void)
res = PathAppendA(too_long, "two\\three"); res = PathAppendA(too_long, "two\\three");
ok(!res, "Expected failure\n"); ok(!res, "Expected failure\n");
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenA(too_long) == 0 || ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
"Expected length of too_long to be zero, got %i\n", lstrlenA(too_long)); "Expected length of too_long to be zero, got %i\n", lstrlenA(too_long));
/* pszMore is too long */ /* pszMore is too long */
@ -934,8 +929,7 @@ static void test_PathAppendA(void)
res = PathAppendA(path, too_long); res = PathAppendA(path, too_long);
ok(!res, "Expected failure\n"); ok(!res, "Expected failure\n");
todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
ok(lstrlenA(path) == 0 || ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
"Expected length of path to be zero, got %i\n", lstrlenA(path)); "Expected length of path to be zero, got %i\n", lstrlenA(path));
/* both params combined are too long */ /* both params combined are too long */
@ -946,8 +940,7 @@ static void test_PathAppendA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = PathAppendA(path, half); res = PathAppendA(path, half);
ok(!res, "Expected failure\n"); ok(!res, "Expected failure\n");
ok(lstrlenA(path) == 0 || ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
"Expected length of path to be zero, got %i\n", lstrlenA(path)); "Expected length of path to be zero, got %i\n", lstrlenA(path));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
} }
@ -1097,7 +1090,7 @@ static void test_PathFindExtensionA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ext = PathFindExtensionA(path); ext = PathFindExtensionA(path);
ok(ext == path, "Expected ext == path, got %p\n", ext); ok(ext == path, "Expected ext == path, got %p\n", ext);
ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext)); ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
/* try a path without an extension */ /* try a path without an extension */
@ -1105,7 +1098,7 @@ static void test_PathFindExtensionA(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ext = PathFindExtensionA(path); ext = PathFindExtensionA(path);
ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext); ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext);
ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext)); ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
/* try a path with an extension */ /* try a path with an extension */
@ -1174,8 +1167,7 @@ static void test_PathBuildRootA(void)
lstrcpyA(path, "aaaaaaaaa"); lstrcpyA(path, "aaaaaaaaa");
root = PathBuildRootA(path, -1); root = PathBuildRootA(path, -1);
ok(root == path, "Expected root == path, got %p\n", root); ok(root == path, "Expected root == path, got %p\n", root);
ok(!lstrcmpA(path, "aaaaaaaaa") || ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
lstrlenA(path) == 0, /* Vista */
"Expected aaaaaaaaa or empty string, got %s\n", path); "Expected aaaaaaaaa or empty string, got %s\n", path);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -1184,8 +1176,7 @@ static void test_PathBuildRootA(void)
lstrcpyA(path, "aaaaaaaaa"); lstrcpyA(path, "aaaaaaaaa");
root = PathBuildRootA(path, 26); root = PathBuildRootA(path, 26);
ok(root == path, "Expected root == path, got %p\n", root); ok(root == path, "Expected root == path, got %p\n", root);
ok(!lstrcmpA(path, "aaaaaaaaa") || ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
lstrlenA(path) == 0, /* Vista */
"Expected aaaaaaaaa or empty string, got %s\n", path); "Expected aaaaaaaaa or empty string, got %s\n", path);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -1243,8 +1234,8 @@ static void test_PathCommonPrefixA(void)
lstrcpyA(out, "aaa"); lstrcpyA(out, "aaa");
count = PathCommonPrefixA(path1, path2, out); count = PathCommonPrefixA(path1, path2, out);
ok(count == 0, "Expected 0, got %i\n", count); ok(count == 0, "Expected 0, got %i\n", count);
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
ok(lstrlenA(path1) == 0, "Expected 0 length path1, got %i\n", lstrlenA(path1)); ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1));
ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2); ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -1255,8 +1246,8 @@ static void test_PathCommonPrefixA(void)
lstrcpyA(out, "aaa"); lstrcpyA(out, "aaa");
count = PathCommonPrefixA(path1, path2, out); count = PathCommonPrefixA(path1, path2, out);
ok(count == 0, "Expected 0, got %i\n", count); ok(count == 0, "Expected 0, got %i\n", count);
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
ok(lstrlenA(path2) == 0, "Expected 0 length path2, got %i\n", lstrlenA(path2)); ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2));
ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1); ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
@ -1411,7 +1402,7 @@ static void test_PathCommonPrefixA(void)
ok(count == 0, "Expected 0, got %i\n", count); ok(count == 0, "Expected 0, got %i\n", count);
ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1); ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2); ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2);
ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
} }
@ -1631,7 +1622,7 @@ static void test_PathIsRelativeW(void)
LPWSTR path; LPWSTR path;
if (!pPathIsRelativeW) { if (!pPathIsRelativeW) {
win_skip("PathIsRelativeA not available\n"); win_skip("PathIsRelativeW not available\n");
return; return;
} }

View file

@ -1064,7 +1064,7 @@ if (0)
memset(wbuf, 0xbf, sizeof(wbuf)); memset(wbuf, 0xbf, sizeof(wbuf));
strret.uType = STRRET_WSTR; strret.uType = STRRET_WSTR;
U(strret).pOleStr = StrDupW(wstr1); U(strret).pOleStr = StrDupW(wstr1);
expect_eq2(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x"); expect_eq2(pStrRetToBufW(&strret, NULL, wbuf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
expect_eq(wbuf[9], 0, WCHAR, "%x"); expect_eq(wbuf[9], 0, WCHAR, "%x");
expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x"); expect_eq(wbuf[10], (WCHAR)0xbfbf, WCHAR, "%x");
} }
@ -1076,7 +1076,7 @@ if (0)
memset(buf, 0xbf, sizeof(buf)); memset(buf, 0xbf, sizeof(buf));
strret.uType = STRRET_CSTR; strret.uType = STRRET_CSTR;
StrCpyNA(U(strret).cStr, str1, MAX_PATH); StrCpyNA(U(strret).cStr, str1, MAX_PATH);
expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) /* Vista */, HRESULT, "%x"); expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
expect_eq(buf[9], 0, CHAR, "%x"); expect_eq(buf[9], 0, CHAR, "%x");
expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x"); expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
} }

View file

@ -200,7 +200,15 @@ static const TEST_URL_CANONICALIZE TEST_CANONICALIZE[] = {
{"res://c:\\tests/res\\foo%20bar/strange\\sth", URL_UNESCAPE, S_OK, "res://c:\\tests/res\\foo bar/strange\\sth", FALSE}, {"res://c:\\tests/res\\foo%20bar/strange\\sth", URL_UNESCAPE, S_OK, "res://c:\\tests/res\\foo bar/strange\\sth", FALSE},
{"A", 0, S_OK, "A", FALSE}, {"A", 0, S_OK, "A", FALSE},
{"../A", 0, S_OK, "../A", FALSE}, {"../A", 0, S_OK, "../A", FALSE},
{".\\A", 0, S_OK, ".\\A", FALSE},
{"A\\.\\B", 0, S_OK, "A\\.\\B", FALSE},
{"A/../B", 0, S_OK, "B", TRUE}, {"A/../B", 0, S_OK, "B", TRUE},
{"A/../B/./../C", 0, S_OK, "C", TRUE},
{"A/../B/./../C", URL_DONT_SIMPLIFY, S_OK, "A/../B/./../C", FALSE},
{".", 0, S_OK, "/", TRUE},
{"./A", 0, S_OK, "A", TRUE},
{"A/./B", 0, S_OK, "A/B", TRUE},
{"/:test\\", 0, S_OK, "/:test\\", TRUE},
{"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/, {"/uri-res/N2R?urn:sha1:B3K", URL_DONT_ESCAPE_EXTRA_INFO | URL_WININET_COMPATIBILITY /*0x82000000*/, S_OK, "/uri-res/N2R?urn:sha1:B3K", FALSE} /*LimeWire online installer calls this*/,
{"http:www.winehq.org/dir/../index.html", 0, S_OK, "http:www.winehq.org/index.html"}, {"http:www.winehq.org/dir/../index.html", 0, S_OK, "http:www.winehq.org/index.html"},
{"http://localhost/test.html", URL_FILE_USE_PATHURL, S_OK, "http://localhost/test.html"}, {"http://localhost/test.html", URL_FILE_USE_PATHURL, S_OK, "http://localhost/test.html"},
@ -315,6 +323,7 @@ typedef struct _TEST_URL_COMBINE {
DWORD flags; DWORD flags;
HRESULT expectret; HRESULT expectret;
const char *expecturl; const char *expecturl;
BOOL todo;
} TEST_URL_COMBINE; } TEST_URL_COMBINE;
static const TEST_URL_COMBINE TEST_COMBINE[] = { static const TEST_URL_COMBINE TEST_COMBINE[] = {
@ -336,6 +345,15 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = {
{"http://www.winehq.org/test14#aaa/bbb#ccc", "#", 0, S_OK, "http://www.winehq.org/test14#"}, {"http://www.winehq.org/test14#aaa/bbb#ccc", "#", 0, S_OK, "http://www.winehq.org/test14#"},
{"http://www.winehq.org/tests/?query=x/y/z", "tests15", 0, S_OK, "http://www.winehq.org/tests/tests15"}, {"http://www.winehq.org/tests/?query=x/y/z", "tests15", 0, S_OK, "http://www.winehq.org/tests/tests15"},
{"http://www.winehq.org/tests/?query=x/y/z#example", "tests16", 0, S_OK, "http://www.winehq.org/tests/tests16"}, {"http://www.winehq.org/tests/?query=x/y/z#example", "tests16", 0, S_OK, "http://www.winehq.org/tests/tests16"},
{"http://www.winehq.org/tests17", ".", 0, S_OK, "http://www.winehq.org/"},
{"http://www.winehq.org/tests18/test", ".", 0, S_OK, "http://www.winehq.org/tests18/"},
{"http://www.winehq.org/tests19/test", "./", 0, S_OK, "http://www.winehq.org/tests19/", FALSE},
{"http://www.winehq.org/tests20/test", "/", 0, S_OK, "http://www.winehq.org/", FALSE},
{"http://www.winehq.org/tests/test", "./test21", 0, S_OK, "http://www.winehq.org/tests/test21", FALSE},
{"http://www.winehq.org/tests/test", "./test22/../test", 0, S_OK, "http://www.winehq.org/tests/test", FALSE},
{"http://www.winehq.org/tests/", "http://www.winehq.org:80/tests23", 0, S_OK, "http://www.winehq.org/tests23", TRUE},
{"http://www.winehq.org/tests/", "tests24/./test/../test", 0, S_OK, "http://www.winehq.org/tests/tests24/test", FALSE},
{"http://www.winehq.org/tests/./tests25", "./", 0, S_OK, "http://www.winehq.org/tests/", FALSE},
{"file:///C:\\dir\\file.txt", "test.txt", 0, S_OK, "file:///C:/dir/test.txt"}, {"file:///C:\\dir\\file.txt", "test.txt", 0, S_OK, "file:///C:/dir/test.txt"},
{"file:///C:\\dir\\file.txt#hash\\hash", "test.txt", 0, S_OK, "file:///C:/dir/file.txt#hash/test.txt"}, {"file:///C:\\dir\\file.txt#hash\\hash", "test.txt", 0, S_OK, "file:///C:/dir/file.txt#hash/test.txt"},
{"file:///C:\\dir\\file.html#hash\\hash", "test.html", 0, S_OK, "file:///C:/dir/test.html"}, {"file:///C:\\dir\\file.html#hash\\hash", "test.html", 0, S_OK, "file:///C:/dir/test.html"},
@ -1095,7 +1113,7 @@ static void test_UrlCanonicalizeW(void)
/* ########################### */ /* ########################### */
static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, HRESULT dwExpectReturn, const char *szExpectUrl) static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFlags, HRESULT dwExpectReturn, const char *szExpectUrl, BOOL todo)
{ {
HRESULT hr; HRESULT hr;
CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH]; CHAR szReturnUrl[INTERNET_MAX_URL_LENGTH];
@ -1120,34 +1138,42 @@ static void test_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFla
dwSize = 0; dwSize = 0;
hr = pUrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags); hr = pUrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER); ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1); ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
dwSize--; dwSize--;
hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags); hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == E_POINTER, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, E_POINTER); ok(hr == E_POINTER, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1); ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags); hr = pUrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
ok(hr == dwExpectReturn, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn); ok(hr == dwExpectReturn, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn);
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if(SUCCEEDED(hr)) { if (todo)
ok(strcmp(szReturnUrl,szExpectUrl)==0, "Expected %s, but got %s\n", szExpectUrl, szReturnUrl); {
todo_wine ok(dwSize == dwExpectLen && (!SUCCEEDED(hr) || strcmp(szReturnUrl, szExpectUrl)==0),
"Expected %s (len=%d), but got %s (len=%d)\n", szExpectUrl, dwExpectLen, SUCCEEDED(hr) ? szReturnUrl : "(null)", dwSize);
}
else
{
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if (SUCCEEDED(hr))
ok(strcmp(szReturnUrl, szExpectUrl)==0, "Expected %s, but got %s\n", szExpectUrl, szReturnUrl);
} }
if (pUrlCombineW) { if (pUrlCombineW) {
dwSize = 0; dwSize = 0;
hr = pUrlCombineW(wszUrl1, wszUrl2, NULL, &dwSize, dwFlags); hr = pUrlCombineW(wszUrl1, wszUrl2, NULL, &dwSize, dwFlags);
ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER); ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1); ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
dwSize--; dwSize--;
hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags); hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
ok(hr == E_POINTER, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, E_POINTER); ok(hr == E_POINTER, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1); ok(todo || dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags); hr = pUrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
ok(hr == dwExpectReturn, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn); ok(hr == dwExpectReturn, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, dwExpectReturn);
ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen); ok(todo || dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
if(SUCCEEDED(hr)) { if(SUCCEEDED(hr)) {
wszConvertedUrl = GetWideString(szReturnUrl); wszConvertedUrl = GetWideString(szReturnUrl);
ok(lstrcmpW(wszReturnUrl, wszConvertedUrl)==0, "Strings didn't match between ascii and unicode UrlCombine!\n"); ok(lstrcmpW(wszReturnUrl, wszConvertedUrl)==0, "Strings didn't match between ascii and unicode UrlCombine!\n");
@ -1167,7 +1193,7 @@ static void test_UrlCombine(void)
unsigned int i; unsigned int i;
for(i=0; i<sizeof(TEST_COMBINE)/sizeof(TEST_COMBINE[0]); i++) { for(i=0; i<sizeof(TEST_COMBINE)/sizeof(TEST_COMBINE[0]); i++) {
test_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags, test_url_combine(TEST_COMBINE[i].url1, TEST_COMBINE[i].url2, TEST_COMBINE[i].flags,
TEST_COMBINE[i].expectret, TEST_COMBINE[i].expecturl); TEST_COMBINE[i].expectret, TEST_COMBINE[i].expecturl, TEST_COMBINE[i].todo);
} }
} }