2 * Copyright 2005-2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define NONAMELESSUNION
23 #include <wine/test.h>
34 DEFINE_GUID(CLSID_AboutProtocol, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
36 #define DEFINE_EXPECT(func) \
37 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
39 #define SET_EXPECT(func) \
40 expect_ ## func = TRUE
42 #define CHECK_EXPECT(func) \
44 ok(expect_ ##func, "unexpected call " #func "\n"); \
45 expect_ ## func = FALSE; \
46 called_ ## func = TRUE; \
49 #define CHECK_EXPECT2(func) \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 called_ ## func = TRUE; \
55 #define CHECK_CALLED(func) \
57 ok(called_ ## func, "expected " #func "\n"); \
58 expect_ ## func = called_ ## func = FALSE; \
61 DEFINE_EXPECT(ParseUrl);
62 DEFINE_EXPECT(QI_IInternetProtocolInfo);
63 DEFINE_EXPECT(CreateInstance);
64 DEFINE_EXPECT(unk_Release);
66 static HRESULT (WINAPI *pCoInternetCompareUrl)(LPCWSTR, LPCWSTR, DWORD);
68 static void test_CreateFormatEnum(void)
70 IEnumFORMATETC *fenum = NULL, *fenum2 = NULL;
75 static DVTARGETDEVICE dev = {sizeof(dev),0,0,0,0,{0}};
76 static FORMATETC formatetc[] = {
84 hres = CreateFormatEnumerator(0, formatetc, &fenum);
85 ok(hres == E_FAIL, "CreateFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
86 hres = CreateFormatEnumerator(0, formatetc, NULL);
87 ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
88 hres = CreateFormatEnumerator(5, formatetc, NULL);
89 ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
92 hres = CreateFormatEnumerator(5, formatetc, &fenum);
93 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
97 hres = IEnumFORMATETC_Next(fenum, 2, NULL, &ul);
98 ok(hres == E_INVALIDARG, "Next failed: %08x, expected E_INVALIDARG\n", hres);
100 hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
101 ok(hres == S_OK, "Next failed: %08x\n", hres);
102 ok(ul == 0, "ul=%d, expected 0\n", ul);
104 hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
105 ok(hres == S_OK, "Next failed: %08x\n", hres);
106 ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
107 ok(fetc[1].lindex == 1, "fetc[1].lindex=%d, expected 1\n", fetc[1].lindex);
108 ok(fetc[0].ptd == &dev, "fetc[0].ptd=%p, expected %p\n", fetc[0].ptd, &dev);
109 ok(ul == 2, "ul=%d, expected 2\n", ul);
111 hres = IEnumFORMATETC_Skip(fenum, 1);
112 ok(hres == S_OK, "Skip failed: %08x\n", hres);
114 hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
115 ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
116 ok(fetc[0].lindex == 3, "fetc[0].lindex=%d, expected 3\n", fetc[0].lindex);
117 ok(fetc[1].lindex == 4, "fetc[1].lindex=%d, expected 4\n", fetc[1].lindex);
118 ok(fetc[0].ptd == NULL, "fetc[0].ptd=%p, expected NULL\n", fetc[0].ptd);
119 ok(ul == 2, "ul=%d, expected 2\n", ul);
121 hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
122 ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
123 ok(ul == 0, "ul=%d, expected 0\n", ul);
125 hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
126 ok(hres == S_OK, "Next failed: %08x\n", hres);
127 ok(ul == 0, "ul=%d, expected 0\n", ul);
129 hres = IEnumFORMATETC_Skip(fenum, 3);
130 ok(hres == S_FALSE, "Skip failed: %08x, expected S_FALSE\n", hres);
132 hres = IEnumFORMATETC_Reset(fenum);
133 ok(hres == S_OK, "Reset failed: %08x\n", hres);
135 hres = IEnumFORMATETC_Next(fenum, 5, fetc, NULL);
136 ok(hres == S_OK, "Next failed: %08x\n", hres);
137 ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
139 hres = IEnumFORMATETC_Reset(fenum);
140 ok(hres == S_OK, "Reset failed: %08x\n", hres);
142 hres = IEnumFORMATETC_Skip(fenum, 2);
143 ok(hres == S_OK, "Skip failed: %08x\n", hres);
145 hres = IEnumFORMATETC_Clone(fenum, NULL);
146 ok(hres == E_INVALIDARG, "Clone failed: %08x, expected E_INVALIDARG\n", hres);
148 hres = IEnumFORMATETC_Clone(fenum, &fenum2);
149 ok(hres == S_OK, "Clone failed: %08x\n", hres);
151 if(SUCCEEDED(hres)) {
152 ok(fenum != fenum2, "fenum == fenum2\n");
154 hres = IEnumFORMATETC_Next(fenum2, 2, fetc, &ul);
155 ok(hres == S_OK, "Next failed: %08x\n", hres);
156 ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
158 IEnumFORMATETC_Release(fenum2);
161 hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
162 ok(hres == S_OK, "Next failed: %08x\n", hres);
163 ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
165 hres = IEnumFORMATETC_Skip(fenum, 1);
166 ok(hres == S_OK, "Skip failed: %08x\n", hres);
168 IEnumFORMATETC_Release(fenum);
171 static void test_RegisterFormatEnumerator(void)
173 IBindCtx *bctx = NULL;
174 IEnumFORMATETC *format = NULL, *format2 = NULL;
175 IUnknown *unk = NULL;
178 static FORMATETC formatetc = {0,NULL,0,0,0};
179 static WCHAR wszEnumFORMATETC[] =
180 {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0};
182 CreateBindCtx(0, &bctx);
184 hres = CreateFormatEnumerator(1, &formatetc, &format);
185 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
189 hres = RegisterFormatEnumerator(NULL, format, 0);
190 ok(hres == E_INVALIDARG,
191 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
192 hres = RegisterFormatEnumerator(bctx, NULL, 0);
193 ok(hres == E_INVALIDARG,
194 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
196 hres = RegisterFormatEnumerator(bctx, format, 0);
197 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
199 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
200 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
201 ok(unk == (IUnknown*)format, "unk != format\n");
203 hres = RevokeFormatEnumerator(NULL, format);
204 ok(hres == E_INVALIDARG,
205 "RevokeFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
207 hres = RevokeFormatEnumerator(bctx, format);
208 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
210 hres = RevokeFormatEnumerator(bctx, format);
211 ok(hres == E_FAIL, "RevokeFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
213 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
214 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
216 hres = RegisterFormatEnumerator(bctx, format, 0);
217 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
219 hres = CreateFormatEnumerator(1, &formatetc, &format2);
220 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
222 if(SUCCEEDED(hres)) {
223 hres = RevokeFormatEnumerator(bctx, format);
224 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
226 IEnumFORMATETC_Release(format2);
229 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
230 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
232 IEnumFORMATETC_Release(format);
234 hres = RegisterFormatEnumerator(bctx, format, 0);
235 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
236 hres = RevokeFormatEnumerator(bctx, NULL);
237 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
238 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
239 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
241 IEnumFORMATETC_Release(format);
242 IBindCtx_Release(bctx);
245 static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
246 '/','b','l','a','n','k','.','h','t','m',0};
247 static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0};
248 static const WCHAR url3[] = {'f','i','l','e',':','/','/','c',':','\\','I','n','d','e','x','.','h','t','m',0};
249 static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
250 '%','2','e','j','p','g',0};
251 static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
253 static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
254 static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
255 'f','i','l','e','.','t','e','s','t',0};
256 static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
257 static const WCHAR url9[] =
258 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
259 '/','s','i','t','e','/','a','b','o','u','t',0};
260 static const WCHAR url10[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
263 static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
266 static const WCHAR path3[] = {'c',':','\\','I','n','d','e','x','.','h','t','m',0};
267 static const WCHAR path4[] = {'s','o','m','e',' ','f','i','l','e','.','j','p','g',0};
269 static const WCHAR wszRes[] = {'r','e','s',0};
270 static const WCHAR wszFile[] = {'f','i','l','e',0};
271 static const WCHAR wszHttp[] = {'h','t','t','p',0};
272 static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
273 static const WCHAR wszEmpty[] = {0};
275 static const WCHAR wszWineHQ[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
276 static const WCHAR wszHttpWineHQ[] = {'h','t','t','p',':','/','/','w','w','w','.',
277 'w','i','n','e','h','q','.','o','r','g',0};
288 LPCWSTR rootdocument;
289 HRESULT rootdocument_hres;
292 static const struct parse_test parse_tests[] = {
293 {url1, S_OK, url1, E_INVALIDARG, NULL, wszRes, NULL, E_FAIL, NULL, E_FAIL},
294 {url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty, NULL, E_FAIL, NULL, E_FAIL},
295 {url3, E_FAIL, url3, S_OK, path3, wszFile, wszEmpty, S_OK, NULL, E_FAIL},
296 {url4, E_FAIL, url4e, S_OK, path4, wszFile, wszEmpty, S_OK, NULL, E_FAIL},
297 {url5, E_FAIL, url5, E_INVALIDARG, NULL, wszHttp, wszWineHQ, S_OK, wszHttpWineHQ, S_OK},
298 {url6, S_OK, url6, E_INVALIDARG, NULL, wszAbout, NULL, E_FAIL, NULL, E_FAIL},
301 static void test_CoInternetParseUrl(void)
307 static WCHAR buf[4096];
309 memset(buf, 0xf0, sizeof(buf));
310 hres = CoInternetParseUrl(parse_tests[0].url, PARSE_SCHEMA, 0, buf,
312 ok(hres == E_POINTER, "schema failed: %08x, expected E_POINTER\n", hres);
314 for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) {
315 memset(buf, 0xf0, sizeof(buf));
316 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf,
317 sizeof(buf)/sizeof(WCHAR), &size, 0);
318 ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08x, expected %08x\n",
319 i, hres, parse_tests[i].secur_hres);
321 memset(buf, 0xf0, sizeof(buf));
322 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf,
323 sizeof(buf)/sizeof(WCHAR), &size, 0);
324 ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres);
325 ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
326 ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
328 memset(buf, 0xf0, sizeof(buf));
329 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf,
330 sizeof(buf)/sizeof(WCHAR), &size, 0);
331 ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n",
332 i, hres, parse_tests[i].path_hres);
333 if(parse_tests[i].path) {
334 ok(size == lstrlenW(parse_tests[i].path), "[%d] wrong size\n", i);
335 ok(!lstrcmpW(parse_tests[i].path, buf), "[%d] wrong path\n", i);
338 memset(buf, 0xf0, sizeof(buf));
339 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_SCHEMA, 0, buf,
340 sizeof(buf)/sizeof(WCHAR), &size, 0);
341 ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres);
342 ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i);
343 ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i);
345 if(memcmp(parse_tests[i].url, wszRes, 3*sizeof(WCHAR))
346 && memcmp(parse_tests[i].url, wszAbout, 5*sizeof(WCHAR))) {
347 memset(buf, 0xf0, sizeof(buf));
348 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf,
349 sizeof(buf)/sizeof(WCHAR), &size, 0);
350 ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08x\n", i, hres);
351 if(parse_tests[i].domain)
352 ok(!lstrcmpW(parse_tests[i].domain, buf), "[%d] wrong domain, received %s\n", i, wine_dbgstr_w(buf));
355 memset(buf, 0xf0, sizeof(buf));
356 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ROOTDOCUMENT, 0, buf,
357 sizeof(buf)/sizeof(WCHAR), &size, 0);
358 ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08x\n", i, hres);
359 if(parse_tests[i].rootdocument)
360 ok(!lstrcmpW(parse_tests[i].rootdocument, buf), "[%d] wrong rootdocument, received %s\n", i, wine_dbgstr_w(buf));
364 static void test_CoInternetCompareUrl(void)
368 if (!pCoInternetCompareUrl) {
369 win_skip("CoInternetCompareUrl not found\n");
373 hres = pCoInternetCompareUrl(url1, url1, 0);
374 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
376 hres = pCoInternetCompareUrl(url1, url3, 0);
377 ok(hres == S_FALSE, "CoInternetParseUrl failed: %08x\n", hres);
379 hres = pCoInternetCompareUrl(url3, url1, 0);
380 ok(hres == S_FALSE, "CoInternetParseUrl failed: %08x\n", hres);
383 static const struct {
386 } query_info_tests[] = {
397 static void test_CoInternetQueryInfo(void)
403 for(i=0; i < sizeof(query_info_tests)/sizeof(query_info_tests[0]); i++) {
405 memset(buf, '?', sizeof(buf));
406 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), &cb, 0);
407 ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
408 ok(cb == sizeof(DWORD), "[%d] cb = %d\n", i, cb);
409 ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
410 i, *(DWORD*)buf, query_info_tests[i].uses_net);
412 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, 3, &cb, 0);
413 ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
414 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, NULL, sizeof(buf), &cb, 0);
415 ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
417 memset(buf, '?', sizeof(buf));
418 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), NULL, 0);
419 ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
420 ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
421 i, *(DWORD*)buf, query_info_tests[i].uses_net);
425 static const WCHAR mimeTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
426 static const WCHAR mimeTextPlain[] = {'t','e','x','t','/','p','l','a','i','n',0};
427 static const WCHAR mimeTextRichtext[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
428 static const WCHAR mimeAppOctetStream[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
429 'o','c','t','e','t','-','s','t','r','e','a','m',0};
430 static const WCHAR mimeImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
431 static const WCHAR mimeImageGif[] = {'i','m','a','g','e','/','g','i','f',0};
432 static const WCHAR mimeImageBmp[] = {'i','m','a','g','e','/','b','m','p',0};
433 static const WCHAR mimeImageXPng[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
434 static const WCHAR mimeImageTiff[] = {'i','m','a','g','e','/','t','i','f','f',0};
435 static const WCHAR mimeVideoAvi[] = {'v','i','d','e','o','/','a','v','i',0};
436 static const WCHAR mimeVideoMpeg[] = {'v','i','d','e','o','/','m','p','e','g',0};
437 static const WCHAR mimeAppPostscript[] =
438 {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
439 static const WCHAR mimeAppXCompressed[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
440 'x','-','c','o','m','p','r','e','s','s','e','d',0};
441 static const WCHAR mimeAppXZip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
442 'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
443 static const WCHAR mimeAppXGzip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
444 'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
445 static const WCHAR mimeAppJava[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
446 static const WCHAR mimeAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
447 static const WCHAR mimeAppXMSDownload[] =
448 {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
449 static const WCHAR mimeAudioWav[] = {'a','u','d','i','o','/','w','a','v',0};
450 static const WCHAR mimeAudioBasic[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
452 static const struct {
457 {url1, mimeTextHtml, S_OK},
458 {url2, mimeTextHtml, S_OK},
459 {url3, mimeTextHtml, S_OK},
460 {url4, NULL, E_FAIL},
461 {url5, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
462 {url6, NULL, E_FAIL},
463 {url7, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)}
466 static BYTE data1[] = "test data\n";
467 static BYTE data2[] = {31,'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0};
468 static BYTE data3[] = {0,0,0};
469 static BYTE data4[] = {'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0,0};
470 static BYTE data5[] = {0xa,0xa,0xa,'x',32,'x',0};
471 static BYTE data6[] = {0xfa,0xfa,0xfa,0xfa,'\n','\r','\t','x','x','x',1};
472 static BYTE data7[] = "<html>blahblah";
473 static BYTE data8[] = {'t','e','s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
474 static BYTE data9[] = {'t','e',0,'s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
475 static BYTE data10[] = "<HtmL>blahblah";
476 static BYTE data11[] = "blah<HTML>blahblah";
477 static BYTE data12[] = "blah<HTMLblahblah";
478 static BYTE data13[] = "blahHTML>blahblah";
479 static BYTE data14[] = "blah<HTMblahblah";
480 static BYTE data15[] = {0xff,0xd8};
481 static BYTE data16[] = {0xff,0xd8,'h'};
482 static BYTE data17[] = {0,0xff,0xd8};
483 static BYTE data18[] = {0xff,0xd8,'<','h','t','m','l','>'};
484 static BYTE data19[] = {'G','I','F','8','7','a'};
485 static BYTE data20[] = {'G','I','F','8','9','a'};
486 static BYTE data21[] = {'G','I','F','8','7'};
487 static BYTE data22[] = {'G','i','F','8','7','a'};
488 static BYTE data23[] = {'G','i','F','8','8','a'};
489 static BYTE data24[] = {'g','i','f','8','7','a'};
490 static BYTE data25[] = {'G','i','F','8','7','A'};
491 static BYTE data26[] = {'G','i','F','8','7','a','<','h','t','m','l','>'};
492 static BYTE data27[] = {0x30,'G','i','F','8','7','A'};
493 static BYTE data28[] = {0x42,0x4d,0x6e,0x42,0x1c,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00};
494 static BYTE data29[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x','x'};
495 static BYTE data30[] = {0x42,0x4d,'x','x','x','x',0x00,0x01,0x00,0x00,'x','x','x','x'};
496 static BYTE data31[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'<','h','t','m','l','>'};
497 static BYTE data32[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
498 static BYTE data33[] = {0x00,0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
499 static BYTE data34[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
500 static BYTE data35[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x','x','x','x',0};
501 static BYTE data36[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,'x','x'};
502 static BYTE data37[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'<','h','t','m','l','>'};
503 static BYTE data38[] = {0x00,0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
504 static BYTE data39[] = {0x4d,0x4d,0x00,0x2a};
505 static BYTE data40[] = {0x4d,0x4d,0x00,0x2a,'<','h','t','m','l','>',0};
506 static BYTE data41[] = {0x4d,0x4d,0xff};
507 static BYTE data42[] = {0x4d,0x4d};
508 static BYTE data43[] = {0x00,0x4d,0x4d,0x00};
509 static BYTE data44[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
510 static BYTE data45[] = {'R','I','F','f',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
511 static BYTE data46[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20};
512 static BYTE data47[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x21,0xff};
513 static BYTE data48[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,'<','h','t','m','l','>'};
514 static BYTE data49[] = {'R','I','F','F',0x0f,0x0f,0xf0,0xf0,'A','V','I',0x20,0xf0,0x00};
515 static BYTE data50[] = {0x00,0x00,0x01,0xb3,0xff};
516 static BYTE data51[] = {0x00,0x00,0x01,0xba,0xff};
517 static BYTE data52[] = {0x00,0x00,0x01,0xb8,0xff};
518 static BYTE data53[] = {0x00,0x00,0x01,0xba};
519 static BYTE data54[] = {0x00,0x00,0x01,0xba,'<','h','t','m','l','>'};
520 static BYTE data55[] = {0x1f,0x8b,'x'};
521 static BYTE data56[] = {0x1f};
522 static BYTE data57[] = {0x1f,0x8b,'<','h','t','m','l','>','t','e','s','t',0};
523 static BYTE data58[] = {0x1f,0x8b};
524 static BYTE data59[] = {0x50,0x4b,'x'};
525 static BYTE data60[] = {0x50,0x4b};
526 static BYTE data61[] = {0x50,0x4b,'<','h','t','m','l','>',0};
527 static BYTE data62[] = {0xca,0xfe,0xba,0xbe,'x'};
528 static BYTE data63[] = {0xca,0xfe,0xba,0xbe};
529 static BYTE data64[] = {0xca,0xfe,0xba,0xbe,'<','h','t','m','l','>',0};
530 static BYTE data65[] = {0x25,0x50,0x44,0x46,'x'};
531 static BYTE data66[] = {0x25,0x50,0x44,0x46};
532 static BYTE data67[] = {0x25,0x50,0x44,0x46,'x','<','h','t','m','l','>'};
533 static BYTE data68[] = {'M','Z','x'};
534 static BYTE data69[] = {'M','Z'};
535 static BYTE data70[] = {'M','Z','<','h','t','m','l','>',0xff};
536 static BYTE data71[] = {'{','\\','r','t','f',0};
537 static BYTE data72[] = {'{','\\','r','t','f'};
538 static BYTE data73[] = {' ','{','\\','r','t','f',' '};
539 static BYTE data74[] = {'{','\\','r','t','f','<','h','t','m','l','>',' '};
540 static BYTE data75[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E',0xff};
541 static BYTE data76[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E'};
542 static BYTE data77[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V',0xff,0xff};
543 static BYTE data78[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l','>',0xff};
544 static BYTE data79[] = {'%','!',0xff};
545 static BYTE data80[] = {'%','!'};
546 static BYTE data81[] = {'%','!','P','S','<','h','t','m','l','>'};
547 static BYTE data82[] = {'.','s','n','d',0};
548 static BYTE data83[] = {'.','s','n','d'};
549 static BYTE data84[] = {'.','s','n','d',0,'<','h','t','m','l','>',1,1};
550 static BYTE data85[] = {'.','S','N','D',0};
552 static const struct {
555 LPCWSTR mime, mime_alt;
557 {data1, sizeof(data1), mimeTextPlain},
558 {data2, sizeof(data2), mimeAppOctetStream},
559 {data3, sizeof(data3), mimeAppOctetStream},
560 {data4, sizeof(data4), mimeAppOctetStream},
561 {data5, sizeof(data5), mimeTextPlain},
562 {data6, sizeof(data6), mimeTextPlain},
563 {data7, sizeof(data7), mimeTextHtml, mimeTextPlain /* IE8 */},
564 {data8, sizeof(data8), mimeTextHtml, mimeTextPlain /* IE8 */},
565 {data9, sizeof(data9), mimeTextHtml, mimeImagePjpeg /* IE8 */},
566 {data10, sizeof(data10), mimeTextHtml, mimeTextPlain /* IE8 */},
567 {data11, sizeof(data11), mimeTextHtml, mimeTextPlain /* IE8 */},
568 {data12, sizeof(data12), mimeTextHtml, mimeTextPlain /* IE8 */},
569 {data13, sizeof(data13), mimeTextPlain},
570 {data14, sizeof(data14), mimeTextPlain},
571 {data15, sizeof(data15), mimeTextPlain},
572 {data16, sizeof(data16), mimeImagePjpeg},
573 {data17, sizeof(data17), mimeAppOctetStream},
574 {data18, sizeof(data18), mimeTextHtml},
575 {data19, sizeof(data19), mimeImageGif},
576 {data20, sizeof(data20), mimeImageGif},
577 {data21, sizeof(data21), mimeTextPlain},
578 {data22, sizeof(data22), mimeImageGif},
579 {data23, sizeof(data23), mimeTextPlain},
580 {data24, sizeof(data24), mimeImageGif},
581 {data25, sizeof(data25), mimeImageGif},
582 {data26, sizeof(data26), mimeTextHtml, mimeImageGif /* IE8 */},
583 {data27, sizeof(data27), mimeTextPlain},
584 {data28, sizeof(data28), mimeImageBmp},
585 {data29, sizeof(data29), mimeImageBmp},
586 {data30, sizeof(data30), mimeAppOctetStream},
587 {data31, sizeof(data31), mimeTextHtml, mimeImageBmp /* IE8 */},
588 {data32, sizeof(data32), mimeAppOctetStream},
589 {data33, sizeof(data33), mimeAppOctetStream},
590 {data34, sizeof(data34), mimeImageXPng},
591 {data35, sizeof(data35), mimeImageXPng},
592 {data36, sizeof(data36), mimeAppOctetStream},
593 {data37, sizeof(data37), mimeTextHtml, mimeImageXPng /* IE8 */},
594 {data38, sizeof(data38), mimeAppOctetStream},
595 {data39, sizeof(data39), mimeImageTiff},
596 {data40, sizeof(data40), mimeTextHtml, mimeImageTiff /* IE8 */},
597 {data41, sizeof(data41), mimeImageTiff},
598 {data42, sizeof(data42), mimeTextPlain},
599 {data43, sizeof(data43), mimeAppOctetStream},
600 {data44, sizeof(data44), mimeVideoAvi},
601 {data45, sizeof(data45), mimeTextPlain},
602 {data46, sizeof(data46), mimeTextPlain},
603 {data47, sizeof(data47), mimeTextPlain},
604 {data48, sizeof(data48), mimeTextHtml, mimeVideoAvi /* IE8 */},
605 {data49, sizeof(data49), mimeVideoAvi},
606 {data50, sizeof(data50), mimeVideoMpeg},
607 {data51, sizeof(data51), mimeVideoMpeg},
608 {data52, sizeof(data52), mimeAppOctetStream},
609 {data53, sizeof(data53), mimeAppOctetStream},
610 {data54, sizeof(data54), mimeTextHtml, mimeVideoMpeg /* IE8 */},
611 {data55, sizeof(data55), mimeAppXGzip},
612 {data56, sizeof(data56), mimeTextPlain},
613 {data57, sizeof(data57), mimeTextHtml, mimeAppXGzip /* IE8 */},
614 {data58, sizeof(data58), mimeAppOctetStream},
615 {data59, sizeof(data59), mimeAppXZip},
616 {data60, sizeof(data60), mimeTextPlain},
617 {data61, sizeof(data61), mimeTextHtml, mimeAppXZip /* IE8 */},
618 {data62, sizeof(data62), mimeAppJava},
619 {data63, sizeof(data63), mimeTextPlain},
620 {data64, sizeof(data64), mimeTextHtml, mimeAppJava /* IE8 */},
621 {data65, sizeof(data65), mimeAppPdf},
622 {data66, sizeof(data66), mimeTextPlain},
623 {data67, sizeof(data67), mimeTextHtml, mimeAppPdf /* IE8 */},
624 {data68, sizeof(data68), mimeAppXMSDownload},
625 {data69, sizeof(data69), mimeTextPlain},
626 {data70, sizeof(data70), mimeTextHtml, mimeAppXMSDownload /* IE8 */},
627 {data71, sizeof(data71), mimeTextRichtext},
628 {data72, sizeof(data72), mimeTextPlain},
629 {data73, sizeof(data73), mimeTextPlain},
630 {data74, sizeof(data74), mimeTextHtml, mimeTextRichtext /* IE8 */},
631 {data75, sizeof(data75), mimeAudioWav},
632 {data76, sizeof(data76), mimeTextPlain},
633 {data77, sizeof(data77), mimeTextPlain},
634 {data78, sizeof(data78), mimeTextHtml, mimeTextPlain /* IE8 */},
635 {data79, sizeof(data79), mimeAppPostscript},
636 {data80, sizeof(data80), mimeTextPlain},
637 {data81, sizeof(data81), mimeTextHtml, mimeAppPostscript /* IE8 */},
638 {data82, sizeof(data82), mimeAudioBasic},
639 {data83, sizeof(data83), mimeTextPlain},
640 {data84, sizeof(data84), mimeTextHtml, mimeAudioBasic /* IE8 */},
641 {data85, sizeof(data85), mimeTextPlain}
644 static void test_FindMimeFromData(void)
650 for(i=0; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
651 mime = (LPWSTR)0xf0f0f0f0;
652 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0);
653 if(mime_tests[i].mime) {
654 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
655 ok(!lstrcmpW(mime, mime_tests[i].mime), "[%d] wrong mime\n", i);
658 ok(hres == E_FAIL || hres == mime_tests[i].hres,
659 "[%d] FindMimeFromData failed: %08x, expected %08x\n",
660 i, hres, mime_tests[i].hres);
661 ok(mime == (LPWSTR)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i);
664 mime = (LPWSTR)0xf0f0f0f0;
665 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeTextPlain, 0, &mime, 0);
666 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
667 ok(!lstrcmpW(mime, mimeTextPlain), "[%d] wrong mime\n", i);
670 mime = (LPWSTR)0xf0f0f0f0;
671 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeAppOctetStream, 0, &mime, 0);
672 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
673 ok(!lstrcmpW(mime, mimeAppOctetStream), "[%d] wrong mime\n", i);
677 for(i=0; i < sizeof(mime_tests2)/sizeof(mime_tests2[0]); i++) {
678 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
680 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
681 ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
684 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
685 mimeTextHtml, 0, &mime, 0);
686 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
687 if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime)
688 || !lstrcmpW(mimeTextPlain, mime_tests2[i].mime))
689 ok(!lstrcmpW(mime, mimeTextHtml), "[%d] wrong mime\n", i);
691 ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i);
694 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
695 mimeImagePjpeg, 0, &mime, 0);
696 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
697 if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime) || i == 17)
698 ok(!lstrcmpW(mime, mimeImagePjpeg), "[%d] wrong mime\n", i);
700 ok(!lstrcmpW(mime, mime_tests2[i].mime) ||
701 (mime_tests2[i].mime_alt && !lstrcmpW(mime, mime_tests2[i].mime_alt)),
702 "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
707 hres = FindMimeFromData(NULL, url1, data1, sizeof(data1), NULL, 0, &mime, 0);
708 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
709 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
712 hres = FindMimeFromData(NULL, url1, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
713 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
714 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
717 hres = FindMimeFromData(NULL, url4, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
718 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
719 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
722 hres = FindMimeFromData(NULL, NULL, NULL, 0, NULL, 0, &mime, 0);
723 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, excepted E_INVALIDARG\n", hres);
725 hres = FindMimeFromData(NULL, NULL, NULL, 0, mimeTextPlain, 0, &mime, 0);
726 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
728 hres = FindMimeFromData(NULL, NULL, data1, 0, NULL, 0, &mime, 0);
729 ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
731 hres = FindMimeFromData(NULL, url1, data1, 0, NULL, 0, &mime, 0);
732 ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
734 hres = FindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, &mime, 0);
735 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
736 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
739 hres = FindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, NULL, 0);
740 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
743 static void register_protocols(void)
745 IInternetSession *session;
746 IClassFactory *factory;
749 static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
751 hres = CoInternetGetSession(0, &session, 0);
752 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
756 hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL,
757 &IID_IClassFactory, (void**)&factory);
758 ok(hres == S_OK, "Coud not get AboutProtocol factory: %08x\n", hres);
762 IInternetSession_RegisterNameSpace(session, factory, &CLSID_AboutProtocol,
763 wszAbout, 0, NULL, 0);
764 IClassFactory_Release(factory);
766 IInternetSession_Release(session);
769 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
770 REFIID riid, void **ppv)
772 ok(0, "unexpected call\n");
773 return E_NOINTERFACE;
776 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
781 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
786 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
787 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
788 DWORD *pcchResult, DWORD dwReserved)
790 CHECK_EXPECT2(ParseUrl);
792 if(ParseAction == PARSE_SECURITY_URL) {
794 *pcchResult = sizeof(url1)/sizeof(WCHAR);
796 if(cchResult<sizeof(url1)/sizeof(WCHAR))
799 memcpy(pwzResult, url1, sizeof(url1));
806 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
807 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
808 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
810 ok(0, "unexpected call\n");
814 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
815 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
817 ok(0, "unexpected call\n");
821 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
822 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
823 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
825 ok(0, "unexpected call\n");
829 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
830 InternetProtocolInfo_QueryInterface,
831 InternetProtocolInfo_AddRef,
832 InternetProtocolInfo_Release,
833 InternetProtocolInfo_ParseUrl,
834 InternetProtocolInfo_CombineUrl,
835 InternetProtocolInfo_CompareUrl,
836 InternetProtocolInfo_QueryInfo
839 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
841 static HRESULT qiret;
842 static IClassFactory *expect_cf;
844 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
846 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
847 CHECK_EXPECT2(QI_IInternetProtocolInfo);
848 ok(iface == expect_cf, "unexpected iface\n");
849 *ppv = &protocol_info;
853 ok(0, "unexpected call\n");
854 return E_NOINTERFACE;
857 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
862 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
867 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
868 REFIID riid, void **ppv)
870 ok(0, "unexpected call\n");
874 static HRESULT WINAPI ProtocolCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
875 REFIID riid, void **ppv)
877 CHECK_EXPECT(CreateInstance);
879 ok(iface == expect_cf, "unexpected iface\n");
880 ok(pOuter == NULL, "pOuter = %p\n", pOuter);
881 ok(IsEqualGUID(&IID_IInternetProtocolInfo, riid), "unexpected riid\n");
882 ok(ppv != NULL, "ppv == NULL\n");
884 *ppv = &protocol_info;
888 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
890 ok(0, "unexpected call\n");
894 static const IClassFactoryVtbl ClassFactoryVtbl = {
895 ClassFactory_QueryInterface,
897 ClassFactory_Release,
898 ClassFactory_CreateInstance,
899 ClassFactory_LockServer
902 static const IClassFactoryVtbl ProtocolCFVtbl = {
903 ClassFactory_QueryInterface,
905 ClassFactory_Release,
906 ProtocolCF_CreateInstance,
907 ClassFactory_LockServer
910 static IClassFactory test_protocol_cf = { &ProtocolCFVtbl };
911 static IClassFactory test_protocol_cf2 = { &ProtocolCFVtbl };
912 static IClassFactory test_cf = { &ClassFactoryVtbl };
914 static void test_NameSpace(void)
916 IInternetSession *session;
922 static const WCHAR wszTest[] = {'t','e','s','t',0};
924 hres = CoInternetGetSession(0, &session, 0);
925 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
929 hres = IInternetSession_RegisterNameSpace(session, NULL, &IID_NULL,
930 wszTest, 0, NULL, 0);
931 ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
933 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
935 ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
937 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
938 wszTest, 0, NULL, 0);
939 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
941 qiret = E_NOINTERFACE;
942 expect_cf = &test_protocol_cf;
943 SET_EXPECT(QI_IInternetProtocolInfo);
944 SET_EXPECT(CreateInstance);
945 SET_EXPECT(ParseUrl);
947 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
949 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
951 CHECK_CALLED(QI_IInternetProtocolInfo);
952 CHECK_CALLED(CreateInstance);
953 CHECK_CALLED(ParseUrl);
956 SET_EXPECT(QI_IInternetProtocolInfo);
957 SET_EXPECT(ParseUrl);
959 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
961 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
963 CHECK_CALLED(QI_IInternetProtocolInfo);
964 CHECK_CALLED(ParseUrl);
966 SET_EXPECT(QI_IInternetProtocolInfo);
967 SET_EXPECT(ParseUrl);
969 hres = CoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf,
970 sizeof(buf)/sizeof(WCHAR), &size, 0);
971 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
972 ok(size == sizeof(url1)/sizeof(WCHAR), "Size = %d\n", size);
973 if(size == sizeof(url1)/sizeof(WCHAR))
974 ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf));
976 CHECK_CALLED(QI_IInternetProtocolInfo);
977 CHECK_CALLED(ParseUrl);
979 SET_EXPECT(QI_IInternetProtocolInfo);
980 SET_EXPECT(ParseUrl);
982 hres = CoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0);
983 ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08x\n", hres);
985 ok(lstrlenW(sec_url)>sizeof(wszFile)/sizeof(WCHAR) &&
986 !memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)),
987 "Encoded url = %s\n", wine_dbgstr_w(sec_url));
988 CoTaskMemFree(sec_url);
991 CHECK_CALLED(QI_IInternetProtocolInfo);
992 CHECK_CALLED(ParseUrl);
994 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
995 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
997 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
999 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1001 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL,
1002 wszTest, 0, NULL, 0);
1003 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1005 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1006 wszTest, 0, NULL, 0);
1007 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1009 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1010 wszTest, 0, NULL, 0);
1011 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1013 SET_EXPECT(QI_IInternetProtocolInfo);
1014 SET_EXPECT(ParseUrl);
1016 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1018 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1020 CHECK_CALLED(QI_IInternetProtocolInfo);
1021 CHECK_CALLED(ParseUrl);
1023 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1024 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1026 SET_EXPECT(QI_IInternetProtocolInfo);
1027 SET_EXPECT(ParseUrl);
1029 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1031 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1033 CHECK_CALLED(QI_IInternetProtocolInfo);
1034 CHECK_CALLED(ParseUrl);
1036 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1037 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1039 expect_cf = &test_protocol_cf2;
1040 SET_EXPECT(QI_IInternetProtocolInfo);
1041 SET_EXPECT(ParseUrl);
1043 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1045 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1047 CHECK_CALLED(QI_IInternetProtocolInfo);
1048 CHECK_CALLED(ParseUrl);
1050 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1051 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1052 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1053 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1054 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL);
1055 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
1056 hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest);
1057 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
1059 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest);
1060 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1062 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1064 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1066 IInternetSession_Release(session);
1069 static void test_MimeFilter(void)
1071 IInternetSession *session;
1074 static const WCHAR mimeW[] = {'t','e','s','t','/','m','i','m','e',0};
1076 hres = CoInternetGetSession(0, &session, 0);
1077 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
1081 hres = IInternetSession_RegisterMimeFilter(session, &test_cf, &IID_NULL, mimeW);
1082 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
1084 hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
1085 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1087 hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
1088 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1090 hres = IInternetSession_UnregisterMimeFilter(session, (void*)0xdeadbeef, mimeW);
1091 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1093 IInternetSession_Release(session);
1096 static ULONG WINAPI unk_Release(IUnknown *iface)
1098 CHECK_EXPECT(unk_Release);
1102 static const IUnknownVtbl unk_vtbl = {
1108 static void test_ReleaseBindInfo(void)
1111 IUnknown unk = { &unk_vtbl };
1113 ReleaseBindInfo(NULL); /* shouldn't crash */
1115 memset(&bi, 0, sizeof(bi));
1116 bi.cbSize = sizeof(BINDINFO);
1118 SET_EXPECT(unk_Release);
1119 ReleaseBindInfo(&bi);
1120 ok(bi.cbSize == sizeof(BINDINFO), "bi.cbSize=%d\n", bi.cbSize);
1121 ok(bi.pUnk == NULL, "bi.pUnk=%p, expected NULL\n", bi.pUnk);
1122 CHECK_CALLED(unk_Release);
1124 memset(&bi, 0, sizeof(bi));
1125 bi.cbSize = offsetof(BINDINFO, pUnk);
1127 ReleaseBindInfo(&bi);
1128 ok(bi.cbSize == offsetof(BINDINFO, pUnk), "bi.cbSize=%d\n", bi.cbSize);
1129 ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
1131 memset(&bi, 0, sizeof(bi));
1133 ReleaseBindInfo(&bi);
1134 ok(!bi.cbSize, "bi.cbSize=%d, expected 0\n", bi.cbSize);
1135 ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
1138 static void test_CopyStgMedium(void)
1144 static WCHAR fileW[] = {'f','i','l','e',0};
1146 memset(&src, 0xf0, sizeof(src));
1147 memset(&dst, 0xe0, sizeof(dst));
1148 memset(&empty, 0xf0, sizeof(empty));
1149 src.tymed = TYMED_NULL;
1150 src.pUnkForRelease = NULL;
1151 hres = CopyStgMedium(&src, &dst);
1152 ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
1153 ok(dst.tymed == TYMED_NULL, "tymed=%d\n", dst.tymed);
1154 ok(dst.u.hGlobal == empty, "u=%p\n", dst.u.hGlobal);
1155 ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
1157 memset(&dst, 0xe0, sizeof(dst));
1158 src.tymed = TYMED_ISTREAM;
1160 src.pUnkForRelease = NULL;
1161 hres = CopyStgMedium(&src, &dst);
1162 ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
1163 ok(dst.tymed == TYMED_ISTREAM, "tymed=%d\n", dst.tymed);
1164 ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
1165 ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
1167 memset(&dst, 0xe0, sizeof(dst));
1168 src.tymed = TYMED_FILE;
1169 src.u.lpszFileName = fileW;
1170 src.pUnkForRelease = NULL;
1171 hres = CopyStgMedium(&src, &dst);
1172 ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
1173 ok(dst.tymed == TYMED_FILE, "tymed=%d\n", dst.tymed);
1174 ok(dst.u.lpszFileName && dst.u.lpszFileName != fileW, "lpszFileName=%p\n", dst.u.lpszFileName);
1175 ok(!lstrcmpW(dst.u.lpszFileName, fileW), "wrong file name\n");
1176 ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
1178 hres = CopyStgMedium(&src, NULL);
1179 ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
1180 hres = CopyStgMedium(NULL, &dst);
1181 ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
1184 static void test_UrlMkGetSessionOption(void)
1186 DWORD encoding, size;
1189 size = encoding = 0xdeadbeef;
1190 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1191 sizeof(encoding), &size, 0);
1192 ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
1193 ok(encoding != 0xdeadbeef, "encoding not changed\n");
1194 ok(size == sizeof(encoding), "size=%d\n", size);
1196 size = encoding = 0xdeadbeef;
1197 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1198 sizeof(encoding)+1, &size, 0);
1199 ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
1200 ok(encoding != 0xdeadbeef, "encoding not changed\n");
1201 ok(size == sizeof(encoding), "size=%d\n", size);
1203 size = encoding = 0xdeadbeef;
1204 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1205 sizeof(encoding)-1, &size, 0);
1206 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1207 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1208 ok(size == 0xdeadbeef, "size=%d\n", size);
1210 size = encoding = 0xdeadbeef;
1211 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, NULL,
1212 sizeof(encoding)-1, &size, 0);
1213 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1214 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1215 ok(size == 0xdeadbeef, "size=%d\n", size);
1217 encoding = 0xdeadbeef;
1218 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1219 sizeof(encoding)-1, NULL, 0);
1220 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1221 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1224 static void test_user_agent(void)
1226 static const CHAR expected[] = "Mozilla/4.0 (compatible; MSIE ";
1227 static char test_str[] = "test";
1228 static char test2_str[] = "test\0test";
1234 hres = ObtainUserAgentString(0, NULL, NULL);
1235 ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
1238 hres = ObtainUserAgentString(0, NULL, &size);
1239 ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
1240 ok(size == 100, "size=%d, expected %d\n", size, 100);
1243 hres = ObtainUserAgentString(0, str, &size);
1244 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1245 ok(size > 0, "size=%d, expected non-zero\n", size);
1249 hres = ObtainUserAgentString(0, str, &size);
1250 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1251 ok(size > 0, "size=%d, expected non-zero\n", size);
1252 ok(str[0] == 'a', "str[0]=%c, expected 'a'\n", str[0]);
1255 hres = ObtainUserAgentString(1, str, &size);
1256 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1257 ok(size > 0, "size=%d, expected non-zero\n", size);
1259 str2 = HeapAlloc(GetProcessHeap(), 0, (size+20)*sizeof(CHAR));
1261 hres = ObtainUserAgentString(0, str2, &size);
1262 ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
1263 ok(size == saved, "size=%d, expected %d\n", size, saved);
1264 ok(strlen(expected) <= strlen(str2) &&
1265 !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
1266 "user agent was \"%s\", expected to start with \"%s\"\n",
1270 hres = ObtainUserAgentString(0, str2, &size);
1271 ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
1272 ok(size == saved, "size=%d, expected %d\n", size, saved);
1275 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, &size, 0);
1276 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1277 ok(size, "size == 0\n");
1280 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 1000, &size, 0);
1281 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1282 ok(size, "size == 0\n");
1286 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved+10, &size, 0);
1287 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1288 ok(size == saved, "size = %d, expected %d\n", size, saved);
1289 ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
1290 "user agent was \"%s\", expected to start with \"%s\"\n",
1295 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
1296 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1297 ok(size == saved, "size = %d, expected %d\n", size, saved);
1298 ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
1299 "user agent was \"%s\", expected to start with \"%s\"\n",
1304 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved-1, &size, 0);
1305 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1306 ok(size == saved, "size = %d, expected %d\n", size, saved);
1307 ok(!str2[0], "buf changed\n");
1311 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, NULL, 0);
1312 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1313 ok(!str2[0], "buf changed\n");
1315 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, sizeof(test_str), 0);
1316 ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
1320 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
1321 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1322 ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
1324 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test2_str, sizeof(test2_str), 0);
1325 ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
1329 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
1330 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1331 ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
1333 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 2, 0);
1334 ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
1338 hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
1339 ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
1340 ok(size == 3 && !strcmp(str2, "te"), "wrong user agent\n");
1342 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 0, 0);
1343 ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
1345 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, sizeof(test_str), 0);
1346 ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
1348 hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, 0);
1349 ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
1351 HeapFree(GetProcessHeap(), 0, str2);
1354 static void test_MkParseDisplayNameEx(void)
1356 IMoniker *mon = NULL;
1363 static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
1364 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
1365 '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
1367 CreateBindCtx(0, &bctx);
1369 hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon);
1370 ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
1371 ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
1372 ok(mon != NULL, "mon == NULL\n");
1374 hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
1375 ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
1376 ok(!lstrcmpW(name, url9), "wrong display name %s\n", wine_dbgstr_w(name));
1377 CoTaskMemFree(name);
1379 hres = IMoniker_IsSystemMoniker(mon, &issys);
1380 ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
1381 ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
1383 IMoniker_Release(mon);
1385 hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon);
1386 ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
1387 ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
1388 ok(mon != NULL, "mon == NULL\n");
1390 hres = IMoniker_IsSystemMoniker(mon, &issys);
1391 ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
1392 ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
1394 IMoniker_Release(mon);
1396 hres = MkParseDisplayNameEx(bctx, url8, &eaten, &mon);
1397 ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08x\n", hres);
1399 IBindCtx_Release(bctx);
1402 static void test_IsValidURL(void)
1406 hr = IsValidURL(NULL, 0, 0);
1407 ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
1414 OleInitialize(NULL);
1416 register_protocols();
1418 hurlmon = GetModuleHandle("urlmon.dll");
1419 pCoInternetCompareUrl = (void *) GetProcAddress(hurlmon, "CoInternetCompareUrl");
1421 test_CreateFormatEnum();
1422 test_RegisterFormatEnumerator();
1423 test_CoInternetParseUrl();
1424 test_CoInternetCompareUrl();
1425 test_CoInternetQueryInfo();
1426 test_FindMimeFromData();
1429 test_ReleaseBindInfo();
1430 test_CopyStgMedium();
1431 test_UrlMkGetSessionOption();
1433 test_MkParseDisplayNameEx();