From: Alex Henrie alexhenrie24@gmail.com
--- dlls/urlmon/tests/misc.c | 179 ++++++++++++---------------- dlls/urlmon/tests/protocol.c | 225 ++++++++++++++--------------------- dlls/urlmon/tests/sec_mgr.c | 70 +++++------ dlls/urlmon/tests/uri.c | 30 ++--- dlls/urlmon/tests/url.c | 60 ++++------ 5 files changed, 227 insertions(+), 337 deletions(-)
diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c index e65feed7318..b00d978af07 100644 --- a/dlls/urlmon/tests/misc.c +++ b/dlls/urlmon/tests/misc.c @@ -274,41 +274,26 @@ static void test_RegisterFormatEnumerator(void) IEnumFORMATETC_Release(format); IBindCtx_Release(bctx); } -static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l', - '/','b','l','a','n','k','.','h','t','m',0}; -static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0}; -static const WCHAR url3[] = {'f','i','l','e',':','/','/','c',':','\','I','n','d','e','x','.','h','t','m',0}; -static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e', - '%','2','e','j','p','g',0}; -static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q', - '.','o','r','g',0}; -static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; -static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/', - 'f','i','l','e','.','t','e','s','t',0}; -static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0}; -static const WCHAR url9[] = - {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g', - '/','s','i','t','e','/','a','b','o','u','t',0}; -static const WCHAR url10[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e','.','*','.', - 'c','o','m',0}; -static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e', - '.','j','p','g',0}; - -static const WCHAR path3[] = {'c',':','\','I','n','d','e','x','.','h','t','m',0}; -static const WCHAR path4[] = {'s','o','m','e',' ','f','i','l','e','.','j','p','g',0}; - -static const WCHAR wszRes[] = {'r','e','s',0}; -static const WCHAR wszFile[] = {'f','i','l','e',0}; -static const WCHAR wszHttp[] = {'h','t','t','p',0}; -static const WCHAR wszAbout[] = {'a','b','o','u','t',0}; -static const WCHAR wszEmpty[] = {0}; -static const WCHAR wszGoogle[] = {'g','o','o','g','l','e','.','*','.','c','o','m',0}; - -static const WCHAR wszWineHQ[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR wszHttpWineHQ[] = {'h','t','t','p',':','/','/','w','w','w','.', - 'w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR wszHttpGoogle[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e', - '.','*','.','c','o','m',0}; +static const WCHAR url1[] = L"res://mshtml.dll/blank.htm"; +static const WCHAR url2[] = L"index.htm"; +static const WCHAR url3[] = L"file://c:\Index.htm"; +static const WCHAR url4[] = L"file:some%20file%2ejpg"; +static const WCHAR url5[] = L"http://www.winehq.org"; +static const WCHAR url6[] = L"about:blank"; +static const WCHAR url7[] = L"ftp://winehq.org/file.test"; +static const WCHAR url8[] = L"test:123abc"; +static const WCHAR url9[] = L"http://www.winehq.org/site/about"; +static const WCHAR url10[] = L"http://google.*.com"; +static const WCHAR url4e[] = L"file:some file.jpg"; + +static const WCHAR path3[] = L"c:\Index.htm"; +static const WCHAR path4[] = L"some file.jpg"; + +static const WCHAR wszGoogle[] = L"google.*.com"; + +static const WCHAR wszWineHQ[] = L"www.winehq.org"; +static const WCHAR wszHttpWineHQ[] = L"http://www.winehq.org"; +static const WCHAR wszHttpGoogle[] = L"http://google.*.com";
struct parse_test { LPCWSTR url; @@ -324,13 +309,13 @@ struct parse_test { };
static const struct parse_test parse_tests[] = { - {url1, S_OK, url1, E_INVALIDARG, NULL, wszRes, NULL, E_FAIL, NULL, E_FAIL}, - {url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty, NULL, E_FAIL, NULL, E_FAIL}, - {url3, E_FAIL, url3, S_OK, path3, wszFile, wszEmpty, S_OK, NULL, E_FAIL}, - {url4, E_FAIL, url4e, S_OK, path4, wszFile, wszEmpty, S_OK, NULL, E_FAIL}, - {url5, E_FAIL, url5, E_INVALIDARG, NULL, wszHttp, wszWineHQ, S_OK, wszHttpWineHQ, S_OK}, - {url6, S_OK, url6, E_INVALIDARG, NULL, wszAbout, NULL, E_FAIL, NULL, E_FAIL}, - {url10, E_FAIL, url10, E_INVALIDARG,NULL, wszHttp, wszGoogle, S_OK, wszHttpGoogle, S_OK} + {url1, S_OK, url1, E_INVALIDARG, NULL, L"res", NULL, E_FAIL, NULL, E_FAIL}, + {url2, E_FAIL, url2, E_INVALIDARG, NULL, L"", NULL, E_FAIL, NULL, E_FAIL}, + {url3, E_FAIL, url3, S_OK, path3, L"file", L"", S_OK, NULL, E_FAIL}, + {url4, E_FAIL, url4e, S_OK, path4, L"file", L"", S_OK, NULL, E_FAIL}, + {url5, E_FAIL, url5, E_INVALIDARG, NULL, L"http", wszWineHQ, S_OK, wszHttpWineHQ, S_OK}, + {url6, S_OK, url6, E_INVALIDARG, NULL, L"about", NULL, E_FAIL, NULL, E_FAIL}, + {url10, E_FAIL, url10, E_INVALIDARG, NULL, L"http", wszGoogle, S_OK, wszHttpGoogle, S_OK} };
static void test_CoInternetParseUrl(void) @@ -384,8 +369,8 @@ static void test_CoInternetParseUrl(void) ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i); ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i);
- if(memcmp(parse_tests[i].url, wszRes, 3*sizeof(WCHAR)) - && memcmp(parse_tests[i].url, wszAbout, 5*sizeof(WCHAR))) { + if(memcmp(parse_tests[i].url, L"res", sizeof(L"res")-sizeof(WCHAR)) + && memcmp(parse_tests[i].url, L"about", sizeof(L"about")-sizeof(WCHAR))) { memset(buf, 0xf0, sizeof(buf)); hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf, ARRAY_SIZE(buf), &size, 0); @@ -715,12 +700,6 @@ static void test_FindMimeFromData(void) BYTE b; int i;
- static const WCHAR app_octet_streamW[] = - {'a','p','p','l','i','c','a','t','i','o','n','/','o','c','t','e','t','-','s','t','r','e','a','m',0}; - static const WCHAR image_pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0}; - static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; - static const WCHAR text_plainW[] = {'t','e','x','t','/','p','l','a','i','n',0}; - for(i = 0; i < ARRAY_SIZE(mime_tests); i++) { mime = (LPWSTR)0xf0f0f0f0; hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0); @@ -740,13 +719,13 @@ static void test_FindMimeFromData(void) }
mime = (LPWSTR)0xf0f0f0f0; - hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, text_plainW, 0, &mime, 0); + hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, L"text/plain", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); ok(!lstrcmpW(mime, L"text/plain"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime)); CoTaskMemFree(mime);
mime = (LPWSTR)0xf0f0f0f0; - hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, app_octet_streamW, 0, &mime, 0); + hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, L"application/octet-stream", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); ok(!lstrcmpW(mime, L"application/octet-stream"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime)); CoTaskMemFree(mime); @@ -764,7 +743,7 @@ static void test_FindMimeFromData(void) continue;
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, - app_octet_streamW, 0, &mime, 0); + L"application/octet-stream", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime && !lstrcmpW(mime, mime_tests2[i].broken_mime)), @@ -772,7 +751,7 @@ static void test_FindMimeFromData(void) CoTaskMemFree(mime);
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, - text_plainW, 0, &mime, 0); + L"text/plain", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime && !lstrcmpW(mime, mime_tests2[i].broken_mime)), @@ -780,7 +759,7 @@ static void test_FindMimeFromData(void) CoTaskMemFree(mime);
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, - text_htmlW, 0, &mime, 0); + L"text/html", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); if(!lstrcmpW(L"application/octet-stream", mime_tests2[i].mime) || !lstrcmpW(L"text/plain", mime_tests2[i].mime) || i==92) @@ -790,7 +769,7 @@ static void test_FindMimeFromData(void) CoTaskMemFree(mime);
hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size, - image_pjpegW, 0, &mime, 0); + L"image/pjpeg", 0, &mime, 0); ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres); ok(!lstrcmpW(mime, mime_tests2[i].mime_pjpeg ? mime_tests2[i].mime_pjpeg : mime_tests2[i].mime) || broken(!lstrcmpW(mime, mime_tests2[i].mime)), @@ -801,7 +780,7 @@ static void test_FindMimeFromData(void) hres = pFindMimeFromData(NULL, NULL, NULL, 0, NULL, 0, &mime, 0); ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres);
- hres = pFindMimeFromData(NULL, NULL, NULL, 0, text_plainW, 0, &mime, 0); + hres = pFindMimeFromData(NULL, NULL, NULL, 0, L"text/plain", 0, &mime, 0); ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres);
hres = pFindMimeFromData(NULL, NULL, data1, 0, NULL, 0, &mime, 0); @@ -810,12 +789,12 @@ static void test_FindMimeFromData(void) hres = pFindMimeFromData(NULL, url1, data1, 0, NULL, 0, &mime, 0); ok(hres == E_FAIL, "FindMimeFromData failed: %08lx, expected E_FAIL\n", hres);
- hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, &mime, 0); + hres = pFindMimeFromData(NULL, NULL, data1, 0, L"text/plain", 0, &mime, 0); ok(hres == S_OK, "FindMimeFromData failed: %08lx\n", hres); ok(!lstrcmpW(mime, L"text/plain"), "wrong mime: %s\n", wine_dbgstr_w(mime)); CoTaskMemFree(mime);
- hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, NULL, 0); + hres = pFindMimeFromData(NULL, NULL, data1, 0, L"text/plain", 0, NULL, 0); ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres); }
@@ -825,8 +804,6 @@ static void register_protocols(void) IClassFactory *factory; HRESULT hres;
- static const WCHAR wszAbout[] = {'a','b','o','u','t',0}; - hres = pCoInternetGetSession(0, &session, 0); ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres); if(FAILED(hres)) @@ -839,7 +816,7 @@ static void register_protocols(void) return;
IInternetSession_RegisterNameSpace(session, factory, &CLSID_AboutProtocol, - wszAbout, 0, NULL, 0); + L"about", 0, NULL, 0); IClassFactory_Release(factory);
IInternetSession_Release(session); @@ -1009,15 +986,13 @@ static void test_NameSpace(void) DWORD size; HRESULT hres;
- static const WCHAR wszTest[] = {'t','e','s','t',0}; - hres = pCoInternetGetSession(0, &session, 0); ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres); if(FAILED(hres)) return;
hres = IInternetSession_RegisterNameSpace(session, NULL, &IID_NULL, - wszTest, 0, NULL, 0); + L"test", 0, NULL, 0); ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, @@ -1025,7 +1000,7 @@ static void test_NameSpace(void) ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, - wszTest, 0, NULL, 0); + L"test", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
qiret = E_NOINTERFACE; @@ -1080,8 +1055,8 @@ static void test_NameSpace(void) hres = pCoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0); ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08lx\n", hres); if(hres == S_OK) { - ok(lstrlenW(sec_url) > ARRAY_SIZE(wszFile) && - !memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)), + ok(lstrlenW(sec_url) > ARRAY_SIZE(L"file") && + !memcmp(sec_url, L"file", sizeof(L"file")-sizeof(WCHAR)), "Encoded url = %s\n", wine_dbgstr_w(sec_url)); CoTaskMemFree(sec_url); } @@ -1090,22 +1065,22 @@ static void test_NameSpace(void) CHECK_CALLED(ParseUrl); }
- hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL, - wszTest, 0, NULL, 0); + L"test", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, - wszTest, 0, NULL, 0); + L"test", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL, - wszTest, 0, NULL, 0); + L"test", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
SET_EXPECT(QI_IInternetProtocolInfo); @@ -1117,7 +1092,7 @@ static void test_NameSpace(void) CHECK_CALLED(QI_IInternetProtocolInfo); CHECK_CALLED(ParseUrl_ENCODE);
- hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
SET_EXPECT(QI_IInternetProtocolInfo); @@ -1129,7 +1104,7 @@ static void test_NameSpace(void) CHECK_CALLED(QI_IInternetProtocolInfo); CHECK_CALLED(ParseUrl_ENCODE);
- hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
expect_cf = &test_protocol_cf2; @@ -1142,16 +1117,16 @@ static void test_NameSpace(void) CHECK_CALLED(QI_IInternetProtocolInfo); CHECK_CALLED(ParseUrl_ENCODE);
- hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres); - hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres); hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL); ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08lx\n", hres); - hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, NULL, L"test"); ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08lx\n", hres);
- hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest); + hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0); @@ -1165,23 +1140,21 @@ static void test_MimeFilter(void) IInternetSession *session; HRESULT hres;
- static const WCHAR mimeW[] = {'t','e','s','t','/','m','i','m','e',0}; - hres = pCoInternetGetSession(0, &session, 0); ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres); if(FAILED(hres)) return;
- hres = IInternetSession_RegisterMimeFilter(session, &test_cf, &IID_NULL, mimeW); + hres = IInternetSession_RegisterMimeFilter(session, &test_cf, &IID_NULL, L"test/mime"); ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
- hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW); + hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, L"test/mime"); ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
- hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW); + hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, L"test/mime"); ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
- hres = IInternetSession_UnregisterMimeFilter(session, (void*)0xdeadbeef, mimeW); + hres = IInternetSession_UnregisterMimeFilter(session, (void*)0xdeadbeef, L"test/mime"); ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
IInternetSession_Release(session); @@ -1237,7 +1210,7 @@ static void test_CopyStgMedium(void) HRESULT hres; int size;
- static WCHAR fileW[] = {'f','i','l','e',0}; + static WCHAR fileW[] = L"file";
memset(&src, 0xf0, sizeof(src)); memset(&dst, 0xe0, sizeof(dst)); @@ -1703,9 +1676,7 @@ static void test_MkParseDisplayNameEx(void) IBindCtx *bctx; HRESULT hres;
- static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':', - '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8', - '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0}; + static const WCHAR clsid_nameW[] = L"clsid:20D04FE0-3AEA-1069-A2D8-08002B30309D:";
const struct { @@ -1715,22 +1686,22 @@ static void test_MkParseDisplayNameEx(void) LPMONIKER *ppmk; } invalid_parameters[] = { - {NULL, NULL, NULL, NULL}, - {NULL, NULL, NULL, &mon}, - {NULL, NULL, &eaten, NULL}, - {NULL, NULL, &eaten, &mon}, - {NULL, wszEmpty, NULL, NULL}, - {NULL, wszEmpty, NULL, &mon}, - {NULL, wszEmpty, &eaten, NULL}, - {NULL, wszEmpty, &eaten, &mon}, - {&bctx, NULL, NULL, NULL}, - {&bctx, NULL, NULL, &mon}, - {&bctx, NULL, &eaten, NULL}, - {&bctx, NULL, &eaten, &mon}, - {&bctx, wszEmpty, NULL, NULL}, - {&bctx, wszEmpty, NULL, &mon}, - {&bctx, wszEmpty, &eaten, NULL}, - {&bctx, wszEmpty, &eaten, &mon}, + {NULL, NULL, NULL, NULL}, + {NULL, NULL, NULL, &mon}, + {NULL, NULL, &eaten, NULL}, + {NULL, NULL, &eaten, &mon}, + {NULL, L"", NULL, NULL}, + {NULL, L"", NULL, &mon}, + {NULL, L"", &eaten, NULL}, + {NULL, L"", &eaten, &mon}, + {&bctx, NULL, NULL, NULL}, + {&bctx, NULL, NULL, &mon}, + {&bctx, NULL, &eaten, NULL}, + {&bctx, NULL, &eaten, &mon}, + {&bctx, L"", NULL, NULL}, + {&bctx, L"", NULL, &mon}, + {&bctx, L"", &eaten, NULL}, + {&bctx, L"", &eaten, &mon}, };
int i; diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c index 2affa2ef12a..a3e5b695404 100644 --- a/dlls/urlmon/tests/protocol.c +++ b/dlls/urlmon/tests/protocol.c @@ -132,20 +132,10 @@ DEFINE_EXPECT(Redirect); DEFINE_EXPECT(outer_QI_test); DEFINE_EXPECT(Protocol_destructor);
-static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0}; -static const WCHAR index_url[] = - {'f','i','l','e',':','i','n','d','e','x','.','h','t','m','l',0}; - -static const WCHAR acc_mimeW[] = {'*','/','*',0}; -static const WCHAR user_agentW[] = {'W','i','n','e',0}; -static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; -static const WCHAR hostW[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR winehq_ipW[] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0}; -static const WCHAR emptyW[] = {0}; -static const WCHAR pjpegW[] = {'i','m','a','g','e','/','p','j','p','e','g',0}; -static const WCHAR gifW[] = {'i','m','a','g','e','/','g','i','f',0}; -static const WCHAR null_guid[] = {'{','0','0','0','0','0','0','0','0','-','0','0','0','0','-', - '0','0','0','0','-','0','0','0','0','-','0','0','0','0','0','0','0','0','0','0','0','0','}',0}; +static const WCHAR user_agentW[] = L"Wine"; +static const WCHAR hostW[] = L"www.winehq.org"; +static const WCHAR winehq_ipW[] = L"209.46.25.134"; +static const WCHAR null_guid[] = L"{00000000-0000-0000-0000-000000000000}"; static WCHAR protocol_clsid[CHARS_IN_GUID];
static HRESULT expect_hrResult; @@ -196,27 +186,23 @@ typedef struct { static Protocol *protocol_emul;
static const WCHAR protocol_names[][10] = { - {'f','i','l','e',0}, - {'h','t','t','p',0}, - {'h','t','t','p','s',0}, - {'f','t','p',0}, - {'m','k',0}, - {'i','t','s',0}, - {'t','e','s','t',0} + L"file", + L"http", + L"https", + L"ftp", + L"mk", + L"its", + L"test" };
static const WCHAR binding_urls[][130] = { - {'f','i','l','e',':','t','e','s','t','.','h','t','m','l',0}, - {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.', - 'o','r','g','/','s','i','t','e','/','a','b','o','u','t',0}, - {'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s', - '.','c','o','m','/','t','e','s','t','.','h','t','m','l',0}, - {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g', - '/','p','u','b','/','o','t','h','e','r', - '/','w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0}, - {'m','k',':','t','e','s','t',0}, - {'i','t','s',':','t','e','s','t','.','c','h','m',':',':','/','b','l','a','n','k','.','h','t','m','l',0}, - {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0} + L"file:test.html", + L"http://www.winehq.org/site/about", + L"https://www.codeweavers.com/test.html", + L"ftp://ftp.winehq.org/pub/other/winelogo.xcf.tar.bz2", + L"mk:test", + L"its:test.chm::/blank.html", + L"test://file.html" };
static const CHAR post_data[] = "mode=Test"; @@ -319,10 +305,7 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface, { LPWSTR addl_headers;
- static const WCHAR wszHeaders[] = - {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ','a','p','p','l','i','c','a','t', - 'i','o','n','/','x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o', - 'd','e','d','\r','\n',0}; + static const WCHAR wszHeaders[] = L"Content-Type: application/x-www-form-urlencoded\r\n";
CHECK_EXPECT(BeginningTransaction);
@@ -826,8 +809,6 @@ static const char *status_names[] = static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText) { - static const WCHAR text_plain[] = {'t','e','x','t','/','p','l','a','i','n',0}; - if (winetest_debug > 1) { if (ulStatusCode < ARRAY_SIZE(status_names)) @@ -850,19 +831,19 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, if(tested_protocol == BIND_TEST) ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText %s\n", wine_dbgstr_w(szStatusText)); else if (http_post_test) - ok(lstrlenW(text_plain) <= lstrlenW(szStatusText) && - !memcmp(szStatusText, text_plain, lstrlenW(text_plain)*sizeof(WCHAR)), + ok(lstrlenW(L"text/plain") <= lstrlenW(szStatusText) && + !memcmp(szStatusText, L"text/plain", sizeof(L"text/plain")-sizeof(WCHAR)), "szStatusText != text/plain\n"); else if(empty_file) ok(!lstrcmpW(szStatusText, L"text/javascript"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText)); else if((pi & PI_MIMEVERIFICATION) && emulate_prot && !mimefilter_test && tested_protocol==HTTP_TEST && !short_read) - ok(lstrlenW(gifW) <= lstrlenW(szStatusText) && - !memcmp(szStatusText, gifW, lstrlenW(gifW)*sizeof(WCHAR)), + ok(lstrlenW(L"image/gif") <= lstrlenW(szStatusText) && + !memcmp(szStatusText, L"image/gif", sizeof(L"image/gif")-sizeof(WCHAR)), "szStatusText != image/gif\n"); else if(!mimefilter_test) - ok(lstrlenW(text_htmlW) <= lstrlenW(szStatusText) && - !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)), + ok(lstrlenW(L"text/html") <= lstrlenW(szStatusText) && + !memcmp(szStatusText, L"text/html", sizeof(L"text/html")-sizeof(WCHAR)), "szStatusText != text/html\n"); } break; @@ -874,8 +855,8 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, CHECK_EXPECT2(ReportProgress_RAWMIMETYPE); ok(szStatusText != NULL, "szStatusText == NULL\n"); if(szStatusText) - ok(lstrlenW(szStatusText) < lstrlenW(text_htmlW) || - !memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)), + ok(lstrlenW(szStatusText) < lstrlenW(L"text/html") || + !memcmp(szStatusText, L"text/html", sizeof(L"text/html")-sizeof(WCHAR)), "szStatusText != text/html\n"); break; case BINDSTATUS_CACHEFILENAMEAVAILABLE: @@ -948,7 +929,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface, break; case BINDSTATUS_DECODING: CHECK_EXPECT(ReportProgress_DECODING); - ok(!lstrcmpW(szStatusText, pjpegW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText)); + ok(!lstrcmpW(szStatusText, L"image/pjpeg"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText)); break; case BINDSTATUS_RESERVED_7: if(winetest_debug > 1) trace("BINDSTATUS_RESERVED_7\n"); @@ -970,8 +951,6 @@ static void test_http_info(IInternetProtocol *protocol) DWORD size, len; HRESULT hres;
- static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0}; - hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info); ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08lx\n", hres);
@@ -986,7 +965,7 @@ static void test_http_info(IInternetProtocol *protocol) ok(size == len, "size = %lu, expected %lu\n", size, len);
size = sizeof(buf); - memcpy(buf, connectionW, sizeof(connectionW)); + memcpy(buf, L"connection", sizeof(L"connection")); hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL); ok(hres == S_FALSE, "QueryInfo returned %08lx\n", hres); }else { @@ -1303,12 +1282,12 @@ static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface, CHECK_CALLED(Read);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE); - hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, text_htmlW); + hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres); CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE); - hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW); + hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres); CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
@@ -1474,8 +1453,8 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS *pcElFetched = 1; } if(ppwzStr) { - *ppwzStr = CoTaskMemAlloc(sizeof(acc_mimeW)); - memcpy(*ppwzStr, acc_mimeW, sizeof(acc_mimeW)); + *ppwzStr = CoTaskMemAlloc(sizeof(L"*/*")); + memcpy(*ppwzStr, L"*/*", sizeof(L"*/*")); } return S_OK; case BINDSTRING_USER_AGENT: @@ -1810,7 +1789,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo pReleaseBindInfo(&bindinfo);
SET_EXPECT(ReportProgress_SENDINGREQUEST); - hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, emptyW); + hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, L""); ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres); CHECK_CALLED(ReportProgress_SENDINGREQUEST);
@@ -1843,7 +1822,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo ok(hres == S_OK, "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres); ok(fetched == 1, "fetched = %ld, expected 1\n", fetched); - ok(!lstrcmpW(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0])); + ok(!lstrcmpW(L"*/*", accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0])); CoTaskMemFree(accept_mimes[0]);
hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider, @@ -1887,7 +1866,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE); hres = IInternetProtocolSink_ReportProgress(pOIProtSink, - BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW); + BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = L""); ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres); CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
@@ -1898,7 +1877,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo } SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE); hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, - mimefilter_test ? pjpegW : (expect_wsz = text_htmlW)); + mimefilter_test ? L"image/pjpeg" : (expect_wsz = L"text/html")); ok(hres == S_OK, "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08lx\n", hres); if(mimefilter_test) { @@ -1991,9 +1970,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface, case 1: { IServiceProvider *service_provider; IHttpNegotiate *http_negotiate; - static const WCHAR header[] = {'?',0}; - static const WCHAR redirect_urlW[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g', - '/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0}; + static const WCHAR redirect_urlW[] = L"http://test.winehq.org/tests/hello.html";
if(redirect_on_continue) { redirect_on_continue = FALSE; @@ -2037,7 +2014,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface, ok(hres == S_OK, "Could not get IHttpNegotiate\n");
SET_EXPECT(OnResponse); - hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL); + hres = IHttpNegotiate_OnResponse(http_negotiate, 200, L"?", NULL, NULL); IHttpNegotiate_Release(http_negotiate); CHECK_CALLED(OnResponse); IHttpNegotiate_Release(http_negotiate); @@ -2051,7 +2028,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface, SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE); } hres = IInternetProtocolSink_ReportProgress(binding_sink, - BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? pjpegW : text_htmlW); + BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? L"image/pjpeg" : L"text/html"); if(mimefilter_test) { CHECK_CALLED(MimeFilter_CreateInstance); CHECK_CALLED(MimeFilter_Start); @@ -2371,7 +2348,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
CHECK_EXPECT(MimeFilter_Start);
- ok(!lstrcmpW(szUrl, pjpegW), "wrong url %s\n", wine_dbgstr_w(szUrl)); + ok(!lstrcmpW(szUrl, L"image/pjpeg"), "wrong url %s\n", wine_dbgstr_w(szUrl)); ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%lx, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI); ok(dwReserved, "dwReserved == 0\n"); ok(pOIProtSink != NULL, "pOIProtSink == NULL\n"); @@ -2415,7 +2392,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU filtered_sink = pOIProtSink;
SET_EXPECT(ReportProgress_DECODING); - hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, pjpegW); + hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, L"image/pjpeg"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08lx\n", hres); CHECK_CALLED(ReportProgress_DECODING);
@@ -2723,14 +2700,14 @@ static void register_filter(BOOL do_register) ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
if(do_register) { - hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, pjpegW); + hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, L"image/pjpeg"); ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres); - hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gifW); + hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, L"image/gif"); ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres); }else { - hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, pjpegW); + hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, L"image/pjpeg"); ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres); - hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gifW); + hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, L"image/gif"); ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres); }
@@ -3022,9 +2999,6 @@ static void test_file_protocol_fail(void) IInternetProtocol *protocol; HRESULT hres;
- static const WCHAR index_url2[] = - {'f','i','l','e',':','/','/','i','n','d','e','x','.','h','t','m','l',0}; - hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IInternetProtocol, (void**)&protocol); ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres); @@ -3033,7 +3007,7 @@ static void test_file_protocol_fail(void)
SET_EXPECT(GetBindInfo); expect_hrResult = MK_E_SYNTAX; - hres = IInternetProtocol_Start(protocol, wszIndexHtml, &protocol_sink, &bind_info, 0, 0); + hres = IInternetProtocol_Start(protocol, L"index.html", &protocol_sink, &bind_info, 0, 0); ok(hres == MK_E_SYNTAX || hres == E_INVALIDARG, "Start failed: %08lx, expected MK_E_SYNTAX or E_INVALIDARG\n", hres); @@ -3045,7 +3019,7 @@ static void test_file_protocol_fail(void) SET_EXPECT(ReportProgress_SENDINGREQUEST); SET_EXPECT(ReportResult); expect_hrResult = INET_E_RESOURCE_NOT_FOUND; - hres = IInternetProtocol_Start(protocol, index_url, &protocol_sink, &bind_info, 0, 0); + hres = IInternetProtocol_Start(protocol, L"file:index.html", &protocol_sink, &bind_info, 0, 0); ok(hres == INET_E_RESOURCE_NOT_FOUND, "Start failed: %08lx expected INET_E_RESOURCE_NOT_FOUND\n", hres); CHECK_CALLED(GetBindInfo); @@ -3069,7 +3043,7 @@ static void test_file_protocol_fail(void) SET_EXPECT(ReportResult); expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
- hres = IInternetProtocol_Start(protocol, index_url2, &protocol_sink, &bind_info, 0, 0); + hres = IInternetProtocol_Start(protocol, L"file://index.html", &protocol_sink, &bind_info, 0, 0); ok(hres == INET_E_RESOURCE_NOT_FOUND, "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND\n", hres); CHECK_CALLED(GetBindInfo); @@ -3084,7 +3058,7 @@ static void test_file_protocol_fail(void) CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
SET_EXPECT(GetBindInfo); - hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0); + hres = IInternetProtocol_Start(protocol, L"", &protocol_sink, &bind_info, 0, 0); ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres); CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
@@ -3097,18 +3071,13 @@ static void test_file_protocol(void) { ULONG len; HANDLE file;
- static const WCHAR wszFile[] = {'f','i','l','e',':',0}; - static const WCHAR wszFile2[] = {'f','i','l','e',':','/','/',0}; - static const WCHAR wszFile3[] = {'f','i','l','e',':','/','/','/',0}; - static const WCHAR wszFile4[] = {'f','i','l','e',':','\','\',0}; static const char html_doc[] = "<HTML></HTML>"; - static const WCHAR fragmentW[] = {'#','f','r','a','g',0};
trace("Testing file protocol...\n"); init_test(FILE_TEST, 0);
SetLastError(0xdeadbeef); - file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + file = CreateFileW(L"index.html", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); if(file == INVALID_HANDLE_VALUE) @@ -3116,74 +3085,74 @@ static void test_file_protocol(void) { WriteFile(file, html_doc, sizeof(html_doc)-1, &size, NULL); CloseHandle(file);
- file_name = wszIndexHtml; + file_name = L"index.html"; bindf = 0; - test_file_protocol_url(index_url); + test_file_protocol_url(L"file:index.html"); bindf = BINDF_FROMURLMON; - test_file_protocol_url(index_url); + test_file_protocol_url(L"file:index.html"); bindf = BINDF_FROMURLMON | BINDF_NEEDFILE; - test_file_protocol_url(index_url); + test_file_protocol_url(L"file:index.html");
- memcpy(buf, wszFile, sizeof(wszFile)); - len = ARRAY_SIZE(wszFile)-1; + memcpy(buf, L"file:", sizeof(L"file:")); + len = ARRAY_SIZE(L"file:")-1; len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\'; - memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); + memcpy(buf+len, L"index.html", sizeof(L"index.html"));
- file_name = buf + ARRAY_SIZE(wszFile)-1; + file_name = buf + ARRAY_SIZE(L"file:")-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf);
- memcpy(buf, wszFile2, sizeof(wszFile2)); + memcpy(buf, L"file://", sizeof(L"file://")); len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\'; - memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+ARRAY_SIZE(wszFile2)-1, file_name_buf); + memcpy(file_name_buf+len, L"index.html", sizeof(L"index.html")); + lstrcpyW(buf+ARRAY_SIZE(L"file://")-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf);
- buf[ARRAY_SIZE(wszFile2)] = '|'; + buf[ARRAY_SIZE(L"file://")] = '|'; test_file_protocol_url(buf);
- memcpy(buf, wszFile3, sizeof(wszFile3)); - len = ARRAY_SIZE(wszFile3)-1; + memcpy(buf, L"file:///", sizeof(L"file:///")); + len = ARRAY_SIZE(L"file:///")-1; len += GetCurrentDirectoryW(ARRAY_SIZE(buf)-len, buf+len); buf[len++] = '\'; - memcpy(buf+len, wszIndexHtml, sizeof(wszIndexHtml)); + memcpy(buf+len, L"index.html", sizeof(L"index.html"));
- file_name = buf + ARRAY_SIZE(wszFile3)-1; + file_name = buf + ARRAY_SIZE(L"file:///")-1; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf);
- memcpy(buf, wszFile4, sizeof(wszFile4)); + memcpy(buf, L"file:\\", sizeof(L"file:\\")); len = GetCurrentDirectoryW(ARRAY_SIZE(file_name_buf), file_name_buf); file_name_buf[len++] = '\'; - memcpy(file_name_buf+len, wszIndexHtml, sizeof(wszIndexHtml)); - lstrcpyW(buf+ARRAY_SIZE(wszFile4)-1, file_name_buf); + memcpy(file_name_buf+len, L"index.html", sizeof(L"index.html")); + lstrcpyW(buf+ARRAY_SIZE(L"file:\\")-1, file_name_buf); file_name = file_name_buf; bindf = 0; test_file_protocol_url(buf); bindf = BINDF_FROMURLMON; test_file_protocol_url(buf);
- buf[ARRAY_SIZE(wszFile4)] = '|'; + buf[ARRAY_SIZE(L"file:\\")] = '|'; test_file_protocol_url(buf);
/* Fragment part of URL is skipped if the file doesn't exist. */ - lstrcatW(buf, fragmentW); + lstrcatW(buf, L"#frag"); test_file_protocol_url(buf);
/* Fragment part is considered a part of the file name, if the file exists. */ len = lstrlenW(file_name_buf); - lstrcpyW(file_name_buf+len, fragmentW); - file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + lstrcpyW(file_name_buf+len, L"#frag"); + file = CreateFileW(L"index.html", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); WriteFile(file, "XXX", 3, &size, NULL); @@ -3193,7 +3162,7 @@ static void test_file_protocol(void) { file_with_hash = TRUE; test_file_protocol_url(buf);
- DeleteFileW(wszIndexHtml); + DeleteFileW(L"index.html"); DeleteFileW(file_name_buf);
bindf = 0; @@ -3562,22 +3531,11 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
static void test_http_protocol(void) { - static const WCHAR posttest_url[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','p','o','s','t','.','p','h','p',0}; - static const WCHAR redirect_url[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','r','e','d','i','r','e','c','t',0}; - static const WCHAR winetest_url[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','d','a','t','a','.','p','h','p',0}; - static const WCHAR empty_url[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','e','m','p','t','y','.','j','s',0}; - static const WCHAR cache_only_url[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','c','a','c','h','e','-','o','n','l','y',0}; - + static const WCHAR posttest_url[] = L"http://test.winehq.org/tests/post.php"; + static const WCHAR redirect_url[] = L"http://test.winehq.org/tests/redirect"; + static const WCHAR winetest_url[] = L"http://test.winehq.org/tests/data.php"; + static const WCHAR empty_url[] = L"http://test.winehq.org/tests/empty.js"; + static const WCHAR cache_only_url[] = L"http://test.winehq.org/tests/cache-only";
trace("Testing http protocol (not from urlmon)...\n"); bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA; @@ -3639,9 +3597,7 @@ static void test_http_protocol(void)
static void test_https_protocol(void) { - static const WCHAR https_winehq_url[] = - {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0}; + static const WCHAR https_winehq_url[] = L"https://test.winehq.org/tests/hello.html";
trace("Testing https protocol (from urlmon)...\n"); bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE; @@ -3659,9 +3615,7 @@ static void test_ftp_protocol(void) DWORD cb, ret; HRESULT hres;
- static const WCHAR ftp_urlW[] = {'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g', - '/','p','u','b','/','o','t','h','e','r','/', - 'w','i','n','e','l','o','g','o','.','x','c','f','.','t','a','r','.','b','z','2',0}; + static const WCHAR ftp_urlW[] = L"ftp://ftp.winehq.org/pub/other/winelogo.xcf.tar.bz2";
trace("Testing ftp protocol...\n");
@@ -3793,9 +3747,8 @@ static void test_mk_protocol(void) IUnknown *unk; HRESULT hres;
- static const WCHAR wrong_url1[] = {'t','e','s','t',':','@','M','S','I','T','S','t','o','r','e', - ':',':','/','t','e','s','t','.','h','t','m','l',0}; - static const WCHAR wrong_url2[] = {'m','k',':','/','t','e','s','t','.','h','t','m','l',0}; + static const WCHAR wrong_url1[] = L"test:@MSITStore::/test.html"; + static const WCHAR wrong_url2[] = L"mk:/test.html";
trace("Testing mk protocol...\n"); init_test(MK_TEST, 0); @@ -3867,9 +3820,7 @@ static void test_CreateBinding(void) DWORD read; HRESULT hres;
- static const WCHAR test_url[] = - {'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}; - static const WCHAR wsz_test[] = {'t','e','s','t',0}; + static const WCHAR test_url[] = L"test://file.html";
trace("Testing CreateBinding%s...\n", no_aggregation ? "(no aggregation)" : ""); init_test(BIND_TEST, TEST_BINDING); @@ -3877,7 +3828,7 @@ static void test_CreateBinding(void) hres = pCoInternetGetSession(0, &session, 0); ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
- hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, wsz_test, 0, NULL, 0); + hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, L"test", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0); @@ -4039,7 +3990,7 @@ static void test_CreateBinding(void) }
hres = IInternetProtocolSink_ReportProgress(binding_sink, - BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW); + BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = L""); ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL); @@ -4070,7 +4021,7 @@ static void test_CreateBinding(void)
IInternetProtocol_Release(protocol);
- hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test); + hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, L"test"); ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0); diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c index c28f0eb6f7c..e98a7d19a83 100644 --- a/dlls/urlmon/tests/sec_mgr.c +++ b/dlls/urlmon/tests/sec_mgr.c @@ -83,36 +83,29 @@ static HRESULT (WINAPI *pCoInternetIsFeatureEnabled)(INTERNETFEATURELIST, DWORD) static HRESULT (WINAPI *pCoInternetIsFeatureEnabledForUrl)(INTERNETFEATURELIST, DWORD, LPCWSTR, IInternetSecurityManager*); static HRESULT (WINAPI *pCoInternetIsFeatureZoneElevationEnabled)(LPCWSTR, LPCWSTR, IInternetSecurityManager*, DWORD);
-static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l', - '/','b','l','a','n','k','.','h','t','m',0}; -static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0}; -static const WCHAR url3[] = {'f','i','l','e',':','/','/','c',':','\','I','n','d','e','x','.','h','t','m',0}; -static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e', - '%','2','e','j','p','g',0}; -static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','z','o','n','e','3', - '.','w','i','n','e','t','e','s','t',0}; -static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; -static const WCHAR url7[] = {'f','t','p',':','/','/','z','o','n','e','3', - '.','w','i','n','e','t','e','s','t','/','f','i','l','e','.','t','e','s','t',0}; -static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0}; -static const WCHAR url9[] = {'h','t','t','p',':','/','/','w','w','w','.','z','o','n','e','3', - '.','w','i','n','e','t','e','s','t', '/','s','i','t','e','/','a','b','o','u','t',0}; -static const WCHAR url10[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e', - '.','j','p','g',0}; -static const WCHAR url11[] = {'f','i','l','e',':','/','/','c',':','/','I','n','d','e','x','.','h','t','m',0}; -static const WCHAR url12[] = {'f','i','l','e',':','/','/','/','c',':','/','I','n','d','e','x','.','h','t','m',0}; -static const WCHAR url13[] = {'h','t','t','p',':','g','o','o','g','l','e','.','c','o','m',0}; -static const WCHAR url14[] = {'z','i','p',':','t','e','s','t','i','n','g','.','c','o','m','/','t','e','s','t','i','n','g',0}; -static const WCHAR url15[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e','.','c','o','m','.','u','k',0}; -static const WCHAR url16[] = {'f','i','l','e',':','/','/','/','c',':',0}; -static const WCHAR url17[] = {'f','i','l','e',':','/','/','/','c',':','c','\',0}; -static const WCHAR url18[] = {'c',':','\','t','e','s','t','.','h','t','m',0}; - -static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0}; -static const WCHAR security_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t','i','n','g',0}; -static const WCHAR security_url2W[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t','i','n','g','2',0}; -static const WCHAR security_expectedW[] = {'w','i','n','e','t','e','s','t',':','z','i','p',0}; -static const WCHAR winetest_to_httpW[] = {'w','i','n','e','t','e','s','t',':','h',0}; +static const WCHAR url1[] = L"res://mshtml.dll/blank.htm"; +static const WCHAR url2[] = L"index.htm"; +static const WCHAR url3[] = L"file://c:\Index.htm"; +static const WCHAR url4[] = L"file:some%20file%2e.jpg"; +static const WCHAR url5[] = L"http://www.zone3.winetest"; +static const WCHAR url6[] = L"about:blank"; +static const WCHAR url7[] = L"ftp://zone3.winetest/file.test"; +static const WCHAR url8[] = L"test:123abc"; +static const WCHAR url9[] = L"http://www.zone3.winetest/site/about"; +static const WCHAR url10[] = L"file://some%20file.jpg"; +static const WCHAR url11[] = L"file://c:/Index.htm"; +static const WCHAR url12[] = L"file:///c:/Index.htm"; +static const WCHAR url13[] = L"http:google.com"; +static const WCHAR url14[] = L"zip:testing.com/testing"; +static const WCHAR url15[] = L"http://google.com.uk"; +static const WCHAR url16[] = L"file:///c:"; +static const WCHAR url17[] = L"file:///c:c\"; +static const WCHAR url18[] = L"c:\test.htm"; + +static const WCHAR security_urlW[] = L"winetest:testing"; +static const WCHAR security_url2W[] = L"winetest:testing2"; +static const WCHAR security_expectedW[] = L"winetest:zip"; +static const WCHAR winetest_to_httpW[] = L"winetest:h";
static const char *szZoneMapDomainsKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains"; static const char *szInternetSettingsKey = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; @@ -666,8 +659,7 @@ static void test_zone_domain_cache(void) IInternetSecurityManager *secmgr = NULL; HKEY domains, domain;
- static const WCHAR testing_domain_urlW[] = {'h','t','t','p',':','/','/','t','e','s','t','i','n','g','.', - 'd','o','m','a','i','n','/',0}; + static const WCHAR testing_domain_urlW[] = L"http://testing.domain/";
res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains); ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res); @@ -902,8 +894,7 @@ static void test_zone_domain_mappings(void)
res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szZoneMapDomainsKey, &domains); if(res == ERROR_SUCCESS) { - static const WCHAR local_machineW[] = {'h','t','t','p',':','/','/','t','e','s','t','.','l','o','c','a','l', - '.','m','a','c','h','i','n','e','/',0}; + static const WCHAR local_machineW[] = L"http://test.local.machine/";
hres = IInternetSecurityManager_MapUrlToZone(secmgr, local_machineW, &zone, 0); ok(hres == S_OK, "MapUrlToZone failed: %08lx\n", hres); @@ -1352,9 +1343,8 @@ static void test_InternetSecurityMarshalling(void)
static void test_InternetGetSecurityUrl(void) { - const WCHAR url5_out[] = {'h','t','t','p',':','w','w','w','.','z','o','n','e','3', - '.','w','i','n','e','t','e','s','t',0}; - const WCHAR url7_out[] = {'f','t','p',':','z','o','n','e','3','.','w','i','n','e','t','e','s','t',0}; + const WCHAR url5_out[] = L"http:www.zone3.winetest"; + const WCHAR url7_out[] = L"ftp:zone3.winetest";
const WCHAR *in[] = {url2, url3, url4, url5, url7, url8, url9, url10}; const WCHAR *out_default[] = {url2, url3, url4, url5_out, url7_out, url8, url5_out, url10}; @@ -1572,7 +1562,7 @@ static void register_protocols(void) return;
hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL, - winetestW, 0, NULL, 0); + L"winetest", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
IInternetSession_Release(session); @@ -1587,7 +1577,7 @@ static void unregister_protocols(void) { if(FAILED(hr)) return;
- hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW); + hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, L"winetest"); ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
IInternetSession_Release(session); @@ -1790,7 +1780,7 @@ static void test_SecurityManagerEx2(void) IInternetSecurityManagerEx2 *sec_mgr2; IUri *uri = NULL;
- static const WCHAR domainW[] = {'c','o','m','.','u','k',0}; + static const WCHAR domainW[] = L"com.uk";
if(!pCreateUri) { win_skip("Skipping SecurityManagerEx2, IE is too old\n"); diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 2c9f7736ffa..a26036f69ef 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -78,20 +78,15 @@ static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWO static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD); static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
-static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q', - '.','o','r','g','/',0}; -static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q', - '.','o','r','g','/','#','F','r','a','g',0}; +static const WCHAR http_urlW[] = L"http://www.winehq.org/"; +static const WCHAR http_url_fragW[] = L"http://www.winehq.org/#Frag";
-static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t', - 'e','s','t','i','n','g',0}; -static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0}; -static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0}; +static const WCHAR combine_baseW[] = L"winetest:?testing"; +static const WCHAR combine_relativeW[] = L"?test"; +static const WCHAR combine_resultW[] = L"zip:test";
-static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0}; - -static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0}; -static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0}; +static const WCHAR parse_urlW[] = L"winetest:test"; +static const WCHAR parse_resultW[] = L"zip:test";
static PARSEACTION parse_action; static DWORD parse_flags; @@ -8242,9 +8237,6 @@ static void test_CreateUri_InvalidArgs(void) { HRESULT hr; IUri *uri = (void*) 0xdeadbeef;
- const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0}; - static const WCHAR emptyW[] = {0}; - hr = pCreateUri(http_urlW, 0, 0, NULL); ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
@@ -8253,12 +8245,12 @@ static void test_CreateUri_InvalidArgs(void) { ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
uri = (void*) 0xdeadbeef; - hr = pCreateUri(invalidW, 0, 0, &uri); + hr = pCreateUri(L"invalid", 0, 0, &uri); ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG); ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
uri = (void*) 0xdeadbeef; - hr = pCreateUri(emptyW, 0, 0, &uri); + hr = pCreateUri(L"", 0, 0, &uri); ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG); ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri); } @@ -11237,7 +11229,7 @@ static void register_protocols(void) return;
hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL, - winetestW, 0, NULL, 0); + L"winetest", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
IInternetSession_Release(session); @@ -11252,7 +11244,7 @@ static void unregister_protocols(void) { if(FAILED(hr)) return;
- hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW); + hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, L"winetest"); ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
IInternetSession_Release(session); diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index de4664cffdf..f899cf7a93c 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -148,24 +148,18 @@ DEFINE_EXPECT(GetWindow_IWindowForBindingUI); DEFINE_EXPECT(GetWindow_ICodeInstall); DEFINE_EXPECT(OnSecurityProblem);
-static const WCHAR winetest_data_urlW[] = - {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/', - 't','e','s','t','s','/','d','a','t','a','.','p','h','p',0}; -static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; +static const WCHAR winetest_data_urlW[] = L"http://test.winehq.org/tests/data.php";
-static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; - -static WCHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 }; +static WCHAR BSCBHolder[] = L"_BSCB_Holder_";
#define WINEHQ_IP "4.4.81.126" static const WCHAR wszWineHQSite[] = L"gitlab.winehq.org"; static const WCHAR wszWineHQIP[] = L"" WINEHQ_IP; static const CHAR wszIndexHtmlA[] = "index.html"; -static const WCHAR cache_fileW[] = {'c',':','\','c','a','c','h','e','.','h','t','m',0}; +static const WCHAR cache_fileW[] = L"c:\cache.htm"; static const CHAR dwl_htmlA[] = "dwl.html"; -static const WCHAR dwl_htmlW[] = {'d','w','l','.','h','t','m','l',0}; +static const WCHAR dwl_htmlW[] = L"dwl.html"; static const CHAR test_txtA[] = "test.txt"; -static const WCHAR emptyW[] = {0};
static BOOL stopped_binding = FALSE, stopped_obj_binding = FALSE, emulate_protocol = FALSE, data_available = FALSE, http_is_first = TRUE, bind_to_object = FALSE, filedwl_api, post_test; @@ -251,11 +245,11 @@ static void test_CreateURLMoniker(LPCWSTR url1, LPCWSTR url2) "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08lx\n", hr); ok(mon1 == NULL, "Expected the output pointer to be NULL, got %p\n", mon1);
- hr = CreateURLMoniker(NULL, emptyW, NULL); + hr = CreateURLMoniker(NULL, L"", NULL); ok(hr == E_INVALIDARG, "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08lx\n", hr);
- hr = CreateURLMoniker(NULL, emptyW, &mon1); + hr = CreateURLMoniker(NULL, L"", &mon1); ok(hr == S_OK || broken(hr == MK_E_SYNTAX), /* IE5/IE5.01/IE6 SP2 */ "Expected CreateURLMoniker to return S_OK, got 0x%08lx\n", hr); @@ -273,18 +267,15 @@ static void test_CreateURLMoniker(LPCWSTR url1, LPCWSTR url2)
static void test_create(void) { - static const WCHAR relativeW[] = {'a','/','b','.','t','x','t',0}; IStream *stream; IMoniker *mon; IBindCtx *bctx; HRESULT hr;
- static const WCHAR TEST_PART_URL_1[] = {'/','t','e','s','t','s','/','d','a','t','a','.','p','h','p',0}; - - test_CreateURLMoniker(winetest_data_urlW, TEST_PART_URL_1); + test_CreateURLMoniker(winetest_data_urlW, L"/tests/data.php");
mon = (void*)0xdeadbeef; - hr = CreateURLMoniker(NULL, relativeW, &mon); + hr = CreateURLMoniker(NULL, L"a/b.txt", &mon); ok(hr == S_OK, "got 0x%08lx\n", hr);
hr = CreateBindCtx(0, &bctx); @@ -657,7 +648,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, else SET_EXPECT(OnProgress_SENDINGREQUEST); hres = IInternetProtocolSink_ReportProgress(pOIProtSink, - BINDSTATUS_SENDINGREQUEST, emptyW); + BINDSTATUS_SENDINGREQUEST, L""); ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres); if(bind_to_object) @@ -682,8 +673,6 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, DWORD fetched = 256, size = 100; DWORD tid;
- static const WCHAR wszMimes[] = {'*','/','*',0}; - SET_EXPECT(QueryService_IInternetBindInfo); hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT, &ua, 1, &fetched); @@ -699,7 +688,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, ok(hres == S_OK, "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres); ok(fetched == 1, "fetched = %ld, expected 1\n", fetched); - ok(!lstrcmpW(wszMimes, accept_mimes[0]), "unexpected mimes\n"); + ok(!lstrcmpW(L"*/*", accept_mimes[0]), "unexpected mimes\n"); CoTaskMemFree(accept_mimes[0]);
hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES, @@ -801,7 +790,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, else SET_EXPECT(OnProgress_MIMETYPEAVAILABLE); hres = IInternetProtocolSink_ReportProgress(pOIProtSink, - BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextHtml); + BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08lx\n", hres); if(bind_to_object) @@ -810,12 +799,12 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE); }else if(test_protocol == WINETEST_SYNC_TEST) { SET_EXPECT(OnProgress_MIMETYPEAVAILABLE); - hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextHtml); + hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres); CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE); }else { - hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml); + hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres); } @@ -935,7 +924,7 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface, ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
hres = IInternetProtocolSink_ReportProgress(protocol_sink, - BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml); + BINDSTATUS_MIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
@@ -972,7 +961,7 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface, }
hres = IInternetProtocolSink_ReportProgress(protocol_sink, - BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml); + BINDSTATUS_MIMETYPEAVAILABLE, L"text/html"); ok(hres == S_OK, "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
@@ -2139,7 +2128,7 @@ static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPER switch(mkp) { case MIMETYPEPROP: CHECK_EXPECT(PutProperty_MIMETYPEPROP); - ok(!lstrcmpW(val, wszTextHtml), "val = %s\n", wine_dbgstr_w(val)); + ok(!lstrcmpW(val, L"text/html"), "val = %s\n", wine_dbgstr_w(val)); break; case CLASSIDPROP: CHECK_EXPECT(PutProperty_CLASSIDPROP); @@ -2204,8 +2193,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva IUnknown *unk; HRESULT hres;
- static WCHAR cbinding_contextW[] = - {'C','B','i','n','d','i','n','g',' ','C','o','n','t','e','x','t',0}; + static WCHAR cbinding_contextW[] = L"CBinding Context";
CHECK_EXPECT(Load); ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId()); @@ -2443,7 +2431,7 @@ static void test_CreateAsyncBindCtxEx(void) BIND_OPTS bindopts; HRESULT hres;
- static WCHAR testW[] = {'t','e','s','t',0}; + static WCHAR testW[] = L"test";
if (!pCreateAsyncBindCtxEx) { win_skip("CreateAsyncBindCtxEx not present\n"); @@ -2613,7 +2601,7 @@ static BOOL test_bscholder(IBindStatusCallback *holder) wstr = (void*)0xdeadbeef; SET_EXPECT(QueryInterface_IHttpNegotiate); SET_EXPECT(BeginningTransaction); - hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, current_url, emptyW, 0, &wstr); + hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, current_url, L"", 0, &wstr); CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */ CHECK_CALLED(BeginningTransaction); ok(hres == S_OK, "BeginningTransaction failed: %08lx\n", hres); @@ -2660,7 +2648,7 @@ static BOOL test_bscholder(IBindStatusCallback *holder) SET_EXPECT(QueryInterface_IHttpNegotiate); SET_EXPECT(OnResponse); wstr = (void*)0xdeadbeef; - hres = IHttpNegotiate_OnResponse(http_negotiate, 200, emptyW, NULL, NULL); + hres = IHttpNegotiate_OnResponse(http_negotiate, 200, L"", NULL, NULL); ok(hres == S_OK, "OnResponse failed: %08lx\n", hres); CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */ CHECK_CALLED(OnResponse); @@ -3825,7 +3813,7 @@ static void test_ReportResult(HRESULT exhres) init_bind_test(ABOUT_TEST, BINDTEST_EMULATE, TYMED_ISTREAM); binding_hres = exhres;
- hres = CreateURLMoniker(NULL, about_blankW, &mon); + hres = CreateURLMoniker(NULL, L"about:blank", &mon); ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
SET_EXPECT(QueryInterface_IServiceProvider); @@ -3869,7 +3857,7 @@ static void test_BindToStorage_fail(void) IUnknown *unk; HRESULT hres;
- hres = CreateURLMoniker(NULL, about_blankW, &mon); + hres = CreateURLMoniker(NULL, L"about:blank", &mon); ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres); if(FAILED(hres)) return; @@ -3954,15 +3942,13 @@ static void register_protocols(void) IInternetSession *session; HRESULT hres;
- static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0}; - hres = CoInternetGetSession(0, &session, 0); ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres); if(FAILED(hres)) return;
hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL, - winetestW, 0, NULL, 0); + L"winetest", 0, NULL, 0); ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
IInternetSession_Release(session);