push a18c97e3310ae68c9cf1d09430f25ca292f320eb
[wine/hacks.git] / dlls / urlmon / tests / misc.c
blob1ed76146ae04342a74c07a94726b821faa902ebf
1 /*
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
19 #define COBJMACROS
20 #define CONST_VTABLE
21 #define NONAMELESSUNION
23 #include <wine/test.h>
24 #include <stdarg.h>
25 #include <stddef.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "ole2.h"
30 #include "urlmon.h"
32 #include "initguid.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) \
43 do { \
44 ok(expect_ ##func, "unexpected call " #func "\n"); \
45 expect_ ## func = FALSE; \
46 called_ ## func = TRUE; \
47 }while(0)
49 #define CHECK_EXPECT2(func) \
50 do { \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 called_ ## func = TRUE; \
53 }while(0)
55 #define CHECK_CALLED(func) \
56 do { \
57 ok(called_ ## func, "expected " #func "\n"); \
58 expect_ ## func = called_ ## func = FALSE; \
59 }while(0)
61 DEFINE_EXPECT(ParseUrl);
62 DEFINE_EXPECT(QI_IInternetProtocolInfo);
63 DEFINE_EXPECT(CreateInstance);
64 DEFINE_EXPECT(unk_Release);
66 static const char *debugstr_w(LPCWSTR str)
68 static char buf[1024];
69 WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
70 return buf;
73 static void test_CreateFormatEnum(void)
75 IEnumFORMATETC *fenum = NULL, *fenum2 = NULL;
76 FORMATETC fetc[5];
77 ULONG ul;
78 HRESULT hres;
80 static DVTARGETDEVICE dev = {sizeof(dev),0,0,0,0,{0}};
81 static FORMATETC formatetc[] = {
82 {0,&dev,0,0,0},
83 {0,&dev,0,1,0},
84 {0,NULL,0,2,0},
85 {0,NULL,0,3,0},
86 {0,NULL,0,4,0}
89 hres = CreateFormatEnumerator(0, formatetc, &fenum);
90 ok(hres == E_FAIL, "CreateFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
91 hres = CreateFormatEnumerator(0, formatetc, NULL);
92 ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
93 hres = CreateFormatEnumerator(5, formatetc, NULL);
94 ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
97 hres = CreateFormatEnumerator(5, formatetc, &fenum);
98 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
99 if(FAILED(hres))
100 return;
102 hres = IEnumFORMATETC_Next(fenum, 2, NULL, &ul);
103 ok(hres == E_INVALIDARG, "Next failed: %08x, expected E_INVALIDARG\n", hres);
104 ul = 100;
105 hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
106 ok(hres == S_OK, "Next failed: %08x\n", hres);
107 ok(ul == 0, "ul=%d, expected 0\n", ul);
109 hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
110 ok(hres == S_OK, "Next failed: %08x\n", hres);
111 ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
112 ok(fetc[1].lindex == 1, "fetc[1].lindex=%d, expected 1\n", fetc[1].lindex);
113 ok(fetc[0].ptd == &dev, "fetc[0].ptd=%p, expected %p\n", fetc[0].ptd, &dev);
114 ok(ul == 2, "ul=%d, expected 2\n", ul);
116 hres = IEnumFORMATETC_Skip(fenum, 1);
117 ok(hres == S_OK, "Skip failed: %08x\n", hres);
119 hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
120 ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
121 ok(fetc[0].lindex == 3, "fetc[0].lindex=%d, expected 3\n", fetc[0].lindex);
122 ok(fetc[1].lindex == 4, "fetc[1].lindex=%d, expected 4\n", fetc[1].lindex);
123 ok(fetc[0].ptd == NULL, "fetc[0].ptd=%p, expected NULL\n", fetc[0].ptd);
124 ok(ul == 2, "ul=%d, expected 2\n", ul);
126 hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
127 ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
128 ok(ul == 0, "ul=%d, expected 0\n", ul);
129 ul = 100;
130 hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
131 ok(hres == S_OK, "Next failed: %08x\n", hres);
132 ok(ul == 0, "ul=%d, expected 0\n", ul);
134 hres = IEnumFORMATETC_Skip(fenum, 3);
135 ok(hres == S_FALSE, "Skip failed: %08x, expected S_FALSE\n", hres);
137 hres = IEnumFORMATETC_Reset(fenum);
138 ok(hres == S_OK, "Reset failed: %08x\n", hres);
140 hres = IEnumFORMATETC_Next(fenum, 5, fetc, NULL);
141 ok(hres == S_OK, "Next failed: %08x\n", hres);
142 ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
144 hres = IEnumFORMATETC_Reset(fenum);
145 ok(hres == S_OK, "Reset failed: %08x\n", hres);
147 hres = IEnumFORMATETC_Skip(fenum, 2);
148 ok(hres == S_OK, "Skip failed: %08x\n", hres);
150 hres = IEnumFORMATETC_Clone(fenum, NULL);
151 ok(hres == E_INVALIDARG, "Clone failed: %08x, expected E_INVALIDARG\n", hres);
153 hres = IEnumFORMATETC_Clone(fenum, &fenum2);
154 ok(hres == S_OK, "Clone failed: %08x\n", hres);
156 if(SUCCEEDED(hres)) {
157 ok(fenum != fenum2, "fenum == fenum2\n");
159 hres = IEnumFORMATETC_Next(fenum2, 2, fetc, &ul);
160 ok(hres == S_OK, "Next failed: %08x\n", hres);
161 ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
163 IEnumFORMATETC_Release(fenum2);
166 hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
167 ok(hres == S_OK, "Next failed: %08x\n", hres);
168 ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
170 hres = IEnumFORMATETC_Skip(fenum, 1);
171 ok(hres == S_OK, "Skip failed: %08x\n", hres);
173 IEnumFORMATETC_Release(fenum);
176 static void test_RegisterFormatEnumerator(void)
178 IBindCtx *bctx = NULL;
179 IEnumFORMATETC *format = NULL, *format2 = NULL;
180 IUnknown *unk = NULL;
181 HRESULT hres;
183 static FORMATETC formatetc = {0,NULL,0,0,0};
184 static WCHAR wszEnumFORMATETC[] =
185 {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0};
187 CreateBindCtx(0, &bctx);
189 hres = CreateFormatEnumerator(1, &formatetc, &format);
190 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
191 if(FAILED(hres))
192 return;
194 hres = RegisterFormatEnumerator(NULL, format, 0);
195 ok(hres == E_INVALIDARG,
196 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
197 hres = RegisterFormatEnumerator(bctx, NULL, 0);
198 ok(hres == E_INVALIDARG,
199 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
201 hres = RegisterFormatEnumerator(bctx, format, 0);
202 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
204 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
205 ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
206 ok(unk == (IUnknown*)format, "unk != format\n");
208 hres = RevokeFormatEnumerator(NULL, format);
209 ok(hres == E_INVALIDARG,
210 "RevokeFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
212 hres = RevokeFormatEnumerator(bctx, format);
213 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
215 hres = RevokeFormatEnumerator(bctx, format);
216 ok(hres == E_FAIL, "RevokeFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
218 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
219 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
221 hres = RegisterFormatEnumerator(bctx, format, 0);
222 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
224 hres = CreateFormatEnumerator(1, &formatetc, &format2);
225 ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
227 if(SUCCEEDED(hres)) {
228 hres = RevokeFormatEnumerator(bctx, format);
229 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
231 IEnumFORMATETC_Release(format2);
234 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
235 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
237 IEnumFORMATETC_Release(format);
239 hres = RegisterFormatEnumerator(bctx, format, 0);
240 ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
241 hres = RevokeFormatEnumerator(bctx, NULL);
242 ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
243 hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
244 ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
246 IEnumFORMATETC_Release(format);
247 IBindCtx_Release(bctx);
250 static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
251 '/','b','l','a','n','k','.','h','t','m',0};
252 static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0};
253 static const WCHAR url3[] = {'f','i','l','e',':','c',':','\\','I','n','d','e','x','.','h','t','m',0};
254 static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
255 '%','2','e','j','p','g',0};
256 static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
257 '.','o','r','g',0};
258 static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
259 static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
260 'f','i','l','e','.','t','e','s','t',0};
261 static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
262 static const WCHAR url9[] =
263 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
264 '/','s','i','t','e','/','a','b','o','u','t',0};
267 static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
268 '.','j','p','g',0};
270 static const WCHAR path3[] = {'c',':','\\','I','n','d','e','x','.','h','t','m',0};
271 static const WCHAR path4[] = {'s','o','m','e',' ','f','i','l','e','.','j','p','g',0};
273 static const WCHAR wszRes[] = {'r','e','s',0};
274 static const WCHAR wszFile[] = {'f','i','l','e',0};
275 static const WCHAR wszHttp[] = {'h','t','t','p',0};
276 static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
277 static const WCHAR wszEmpty[] = {0};
279 struct parse_test {
280 LPCWSTR url;
281 HRESULT secur_hres;
282 LPCWSTR encoded_url;
283 HRESULT path_hres;
284 LPCWSTR path;
285 LPCWSTR schema;
288 static const struct parse_test parse_tests[] = {
289 {url1, S_OK, url1, E_INVALIDARG, NULL, wszRes},
290 {url2, E_FAIL, url2, E_INVALIDARG, NULL, wszEmpty},
291 {url3, E_FAIL, url3, S_OK, path3, wszFile},
292 {url4, E_FAIL, url4e, S_OK, path4, wszFile},
293 {url5, E_FAIL, url5, E_INVALIDARG, NULL, wszHttp},
294 {url6, S_OK, url6, E_INVALIDARG, NULL, wszAbout}
297 static void test_CoInternetParseUrl(void)
299 HRESULT hres;
300 DWORD size;
301 int i;
303 static WCHAR buf[4096];
305 memset(buf, 0xf0, sizeof(buf));
306 hres = CoInternetParseUrl(parse_tests[0].url, PARSE_SCHEMA, 0, buf,
307 3, &size, 0);
308 ok(hres == E_POINTER, "schema failed: %08x, expected E_POINTER\n", hres);
310 for(i=0; i < sizeof(parse_tests)/sizeof(parse_tests[0]); i++) {
311 memset(buf, 0xf0, sizeof(buf));
312 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf,
313 sizeof(buf)/sizeof(WCHAR), &size, 0);
314 ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08x, expected %08x\n",
315 i, hres, parse_tests[i].secur_hres);
317 memset(buf, 0xf0, sizeof(buf));
318 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf,
319 sizeof(buf)/sizeof(WCHAR), &size, 0);
320 ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres);
321 ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
322 ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
324 memset(buf, 0xf0, sizeof(buf));
325 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf,
326 sizeof(buf)/sizeof(WCHAR), &size, 0);
327 ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n",
328 i, hres, parse_tests[i].path_hres);
329 if(parse_tests[i].path) {
330 ok(size == lstrlenW(parse_tests[i].path), "[%d] wrong size\n", i);
331 ok(!lstrcmpW(parse_tests[i].path, buf), "[%d] wrong path\n", i);
334 memset(buf, 0xf0, sizeof(buf));
335 hres = CoInternetParseUrl(parse_tests[i].url, PARSE_SCHEMA, 0, buf,
336 sizeof(buf)/sizeof(WCHAR), &size, 0);
337 ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres);
338 ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i);
339 ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i);
343 static void test_CoInternetCompareUrl(void)
345 HRESULT hres;
347 hres = CoInternetCompareUrl(url1, url1, 0);
348 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
350 hres = CoInternetCompareUrl(url1, url3, 0);
351 ok(hres == S_FALSE, "CoInternetParseUrl failed: %08x\n", hres);
353 hres = CoInternetCompareUrl(url3, url1, 0);
354 ok(hres == S_FALSE, "CoInternetParseUrl failed: %08x\n", hres);
357 static const struct {
358 LPCWSTR url;
359 DWORD uses_net;
360 } query_info_tests[] = {
361 {url1, 0},
362 {url2, 0},
363 {url3, 0},
364 {url4, 0},
365 {url5, 0},
366 {url6, 0},
367 {url7, 0},
368 {url8, 0}
371 static void test_CoInternetQueryInfo(void)
373 BYTE buf[100];
374 DWORD cb, i;
375 HRESULT hres;
377 for(i=0; i < sizeof(query_info_tests)/sizeof(query_info_tests[0]); i++) {
378 cb = 0xdeadbeef;
379 memset(buf, '?', sizeof(buf));
380 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), &cb, 0);
381 ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
382 ok(cb == sizeof(DWORD), "[%d] cb = %d\n", i, cb);
383 ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
384 i, *(DWORD*)buf, query_info_tests[i].uses_net);
386 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, 3, &cb, 0);
387 ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
388 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, NULL, sizeof(buf), &cb, 0);
389 ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
391 memset(buf, '?', sizeof(buf));
392 hres = CoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), NULL, 0);
393 ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
394 ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
395 i, *(DWORD*)buf, query_info_tests[i].uses_net);
399 static const WCHAR mimeTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
400 static const WCHAR mimeTextPlain[] = {'t','e','x','t','/','p','l','a','i','n',0};
401 static const WCHAR mimeTextRichtext[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
402 static const WCHAR mimeAppOctetStream[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
403 'o','c','t','e','t','-','s','t','r','e','a','m',0};
404 static const WCHAR mimeImagePjpeg[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
405 static const WCHAR mimeImageGif[] = {'i','m','a','g','e','/','g','i','f',0};
406 static const WCHAR mimeImageBmp[] = {'i','m','a','g','e','/','b','m','p',0};
407 static const WCHAR mimeImageXPng[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
408 static const WCHAR mimeImageTiff[] = {'i','m','a','g','e','/','t','i','f','f',0};
409 static const WCHAR mimeVideoAvi[] = {'v','i','d','e','o','/','a','v','i',0};
410 static const WCHAR mimeVideoMpeg[] = {'v','i','d','e','o','/','m','p','e','g',0};
411 static const WCHAR mimeAppPostscript[] =
412 {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
413 static const WCHAR mimeAppXCompressed[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
414 'x','-','c','o','m','p','r','e','s','s','e','d',0};
415 static const WCHAR mimeAppXZip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
416 'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
417 static const WCHAR mimeAppXGzip[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
418 'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
419 static const WCHAR mimeAppJava[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
420 static const WCHAR mimeAppPdf[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
421 static const WCHAR mimeAppXMSDownload[] =
422 {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
423 static const WCHAR mimeAudioWav[] = {'a','u','d','i','o','/','w','a','v',0};
425 static const struct {
426 LPCWSTR url;
427 LPCWSTR mime;
428 HRESULT hres;
429 } mime_tests[] = {
430 {url1, mimeTextHtml, S_OK},
431 {url2, mimeTextHtml, S_OK},
432 {url3, mimeTextHtml, S_OK},
433 {url4, NULL, E_FAIL},
434 {url5, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)},
435 {url6, NULL, E_FAIL},
436 {url7, NULL, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)}
439 static BYTE data1[] = "test data\n";
440 static BYTE data2[] = {31,'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0};
441 static BYTE data3[] = {0,0,0};
442 static BYTE data4[] = {'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0,0};
443 static BYTE data5[] = {0xa,0xa,0xa,'x',32,'x',0};
444 static BYTE data6[] = {0xfa,0xfa,0xfa,0xfa,'\n','\r','\t','x','x','x',1};
445 static BYTE data7[] = "<html>blahblah";
446 static BYTE data8[] = {'t','e','s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
447 static BYTE data9[] = {'t','e',0,'s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
448 static BYTE data10[] = "<HtmL>blahblah";
449 static BYTE data11[] = "blah<HTML>blahblah";
450 static BYTE data12[] = "blah<HTMLblahblah";
451 static BYTE data13[] = "blahHTML>blahblah";
452 static BYTE data14[] = "blah<HTMblahblah";
453 static BYTE data15[] = {0xff,0xd8};
454 static BYTE data16[] = {0xff,0xd8,'h'};
455 static BYTE data17[] = {0,0xff,0xd8};
456 static BYTE data18[] = {0xff,0xd8,'<','h','t','m','l','>'};
457 static BYTE data19[] = {'G','I','F','8','7','a'};
458 static BYTE data20[] = {'G','I','F','8','9','a'};
459 static BYTE data21[] = {'G','I','F','8','7'};
460 static BYTE data22[] = {'G','i','F','8','7','a'};
461 static BYTE data23[] = {'G','i','F','8','8','a'};
462 static BYTE data24[] = {'g','i','f','8','7','a'};
463 static BYTE data25[] = {'G','i','F','8','7','A'};
464 static BYTE data26[] = {'G','i','F','8','7','a','<','h','t','m','l','>'};
465 static BYTE data27[] = {0x30,'G','i','F','8','7','A'};
466 static BYTE data28[] = {0x42,0x4d,0x6e,0x42,0x1c,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00};
467 static BYTE data29[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x','x'};
468 static BYTE data30[] = {0x42,0x4d,'x','x','x','x',0x00,0x01,0x00,0x00,'x','x','x','x'};
469 static BYTE data31[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'<','h','t','m','l','>'};
470 static BYTE data32[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
471 static BYTE data33[] = {0x00,0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
472 static BYTE data34[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
473 static BYTE data35[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x','x','x','x',0};
474 static BYTE data36[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,'x','x'};
475 static BYTE data37[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'<','h','t','m','l','>'};
476 static BYTE data38[] = {0x00,0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
477 static BYTE data39[] = {0x4d,0x4d,0x00,0x2a};
478 static BYTE data40[] = {0x4d,0x4d,0x00,0x2a,'<','h','t','m','l','>',0};
479 static BYTE data41[] = {0x4d,0x4d,0xff};
480 static BYTE data42[] = {0x4d,0x4d};
481 static BYTE data43[] = {0x00,0x4d,0x4d,0x00};
482 static BYTE data44[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
483 static BYTE data45[] = {'R','I','F','f',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
484 static BYTE data46[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20};
485 static BYTE data47[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x21,0xff};
486 static BYTE data48[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,'<','h','t','m','l','>'};
487 static BYTE data49[] = {'R','I','F','F',0x0f,0x0f,0xf0,0xf0,'A','V','I',0x20,0xf0,0x00};
488 static BYTE data50[] = {0x00,0x00,0x01,0xb3,0xff};
489 static BYTE data51[] = {0x00,0x00,0x01,0xba,0xff};
490 static BYTE data52[] = {0x00,0x00,0x01,0xb8,0xff};
491 static BYTE data53[] = {0x00,0x00,0x01,0xba};
492 static BYTE data54[] = {0x00,0x00,0x01,0xba,'<','h','t','m','l','>'};
493 static BYTE data55[] = {0x1f,0x8b,'x'};
494 static BYTE data56[] = {0x1f};
495 static BYTE data57[] = {0x1f,0x8b,'<','h','t','m','l','>','t','e','s','t',0};
496 static BYTE data58[] = {0x1f,0x8b};
497 static BYTE data59[] = {0x50,0x4b,'x'};
498 static BYTE data60[] = {0x50,0x4b};
499 static BYTE data61[] = {0x50,0x4b,'<','h','t','m','l','>',0};
500 static BYTE data62[] = {0xca,0xfe,0xba,0xbe,'x'};
501 static BYTE data63[] = {0xca,0xfe,0xba,0xbe};
502 static BYTE data64[] = {0xca,0xfe,0xba,0xbe,'<','h','t','m','l','>',0};
503 static BYTE data65[] = {0x25,0x50,0x44,0x46,'x'};
504 static BYTE data66[] = {0x25,0x50,0x44,0x46};
505 static BYTE data67[] = {0x25,0x50,0x44,0x46,'x','<','h','t','m','l','>'};
506 static BYTE data68[] = {'M','Z','x'};
507 static BYTE data69[] = {'M','Z'};
508 static BYTE data70[] = {'M','Z','<','h','t','m','l','>',0xff};
509 static BYTE data71[] = {'{','\\','r','t','f',0};
510 static BYTE data72[] = {'{','\\','r','t','f'};
511 static BYTE data73[] = {' ','{','\\','r','t','f',' '};
512 static BYTE data74[] = {'{','\\','r','t','f','<','h','t','m','l','>',' '};
513 static BYTE data75[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E',0xff};
514 static BYTE data76[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E'};
515 static BYTE data77[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V',0xff,0xff};
516 static BYTE data78[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l','>',0xff};
517 static BYTE data79[] = {'%','!',0xff};
518 static BYTE data80[] = {'%','!'};
519 static BYTE data81[] = {'%','!','P','S','<','h','t','m','l','>'};
521 static const struct {
522 BYTE *data;
523 DWORD size;
524 LPCWSTR mime;
525 } mime_tests2[] = {
526 {data1, sizeof(data1), mimeTextPlain},
527 {data2, sizeof(data2), mimeAppOctetStream},
528 {data3, sizeof(data3), mimeAppOctetStream},
529 {data4, sizeof(data4), mimeAppOctetStream},
530 {data5, sizeof(data5), mimeTextPlain},
531 {data6, sizeof(data6), mimeTextPlain},
532 {data7, sizeof(data7), mimeTextHtml},
533 {data8, sizeof(data8), mimeTextHtml},
534 {data9, sizeof(data9), mimeTextHtml},
535 {data10, sizeof(data10), mimeTextHtml},
536 {data11, sizeof(data11), mimeTextHtml},
537 {data12, sizeof(data12), mimeTextHtml},
538 {data13, sizeof(data13), mimeTextPlain},
539 {data14, sizeof(data14), mimeTextPlain},
540 {data15, sizeof(data15), mimeTextPlain},
541 {data16, sizeof(data16), mimeImagePjpeg},
542 {data17, sizeof(data17), mimeAppOctetStream},
543 {data18, sizeof(data18), mimeTextHtml},
544 {data19, sizeof(data19), mimeImageGif},
545 {data20, sizeof(data20), mimeImageGif},
546 {data21, sizeof(data21), mimeTextPlain},
547 {data22, sizeof(data22), mimeImageGif},
548 {data23, sizeof(data23), mimeTextPlain},
549 {data24, sizeof(data24), mimeImageGif},
550 {data25, sizeof(data25), mimeImageGif},
551 {data26, sizeof(data26), mimeTextHtml},
552 {data27, sizeof(data27), mimeTextPlain},
553 {data28, sizeof(data28), mimeImageBmp},
554 {data29, sizeof(data29), mimeImageBmp},
555 {data30, sizeof(data30), mimeAppOctetStream},
556 {data31, sizeof(data31), mimeTextHtml},
557 {data32, sizeof(data32), mimeAppOctetStream},
558 {data33, sizeof(data33), mimeAppOctetStream},
559 {data34, sizeof(data34), mimeImageXPng},
560 {data35, sizeof(data35), mimeImageXPng},
561 {data36, sizeof(data36), mimeAppOctetStream},
562 {data37, sizeof(data37), mimeTextHtml},
563 {data38, sizeof(data38), mimeAppOctetStream},
564 {data39, sizeof(data39), mimeImageTiff},
565 {data40, sizeof(data40), mimeTextHtml},
566 {data41, sizeof(data41), mimeImageTiff},
567 {data42, sizeof(data42), mimeTextPlain},
568 {data43, sizeof(data43), mimeAppOctetStream},
569 {data44, sizeof(data44), mimeVideoAvi},
570 {data45, sizeof(data45), mimeTextPlain},
571 {data46, sizeof(data46), mimeTextPlain},
572 {data47, sizeof(data47), mimeTextPlain},
573 {data48, sizeof(data48), mimeTextHtml},
574 {data49, sizeof(data49), mimeVideoAvi},
575 {data50, sizeof(data50), mimeVideoMpeg},
576 {data51, sizeof(data51), mimeVideoMpeg},
577 {data52, sizeof(data52), mimeAppOctetStream},
578 {data53, sizeof(data53), mimeAppOctetStream},
579 {data54, sizeof(data54), mimeTextHtml},
580 {data55, sizeof(data55), mimeAppXGzip},
581 {data56, sizeof(data56), mimeTextPlain},
582 {data57, sizeof(data57), mimeTextHtml},
583 {data58, sizeof(data58), mimeAppOctetStream},
584 {data59, sizeof(data59), mimeAppXZip},
585 {data60, sizeof(data60), mimeTextPlain},
586 {data61, sizeof(data61), mimeTextHtml},
587 {data62, sizeof(data62), mimeAppJava},
588 {data63, sizeof(data63), mimeTextPlain},
589 {data64, sizeof(data64), mimeTextHtml},
590 {data65, sizeof(data65), mimeAppPdf},
591 {data66, sizeof(data66), mimeTextPlain},
592 {data67, sizeof(data67), mimeTextHtml},
593 {data68, sizeof(data68), mimeAppXMSDownload},
594 {data69, sizeof(data69), mimeTextPlain},
595 {data70, sizeof(data70), mimeTextHtml},
596 {data71, sizeof(data71), mimeTextRichtext},
597 {data72, sizeof(data72), mimeTextPlain},
598 {data73, sizeof(data73), mimeTextPlain},
599 {data74, sizeof(data74), mimeTextHtml},
600 {data75, sizeof(data75), mimeAudioWav},
601 {data76, sizeof(data76), mimeTextPlain},
602 {data77, sizeof(data77), mimeTextPlain},
603 {data78, sizeof(data78), mimeTextHtml},
604 {data79, sizeof(data79), mimeAppPostscript},
605 {data80, sizeof(data80), mimeTextPlain},
606 {data81, sizeof(data81), mimeTextHtml}
609 static void test_FindMimeFromData(void)
611 HRESULT hres;
612 LPWSTR mime;
613 int i;
615 for(i=0; i<sizeof(mime_tests)/sizeof(mime_tests[0]); i++) {
616 mime = (LPWSTR)0xf0f0f0f0;
617 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0);
618 if(mime_tests[i].mime) {
619 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
620 ok(!lstrcmpW(mime, mime_tests[i].mime), "[%d] wrong mime\n", i);
621 CoTaskMemFree(mime);
622 }else {
623 ok(hres == E_FAIL || hres == mime_tests[i].hres,
624 "[%d] FindMimeFromData failed: %08x, expected %08x\n",
625 i, hres, mime_tests[i].hres);
626 ok(mime == (LPWSTR)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i);
629 mime = (LPWSTR)0xf0f0f0f0;
630 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeTextPlain, 0, &mime, 0);
631 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
632 ok(!lstrcmpW(mime, mimeTextPlain), "[%d] wrong mime\n", i);
633 CoTaskMemFree(mime);
635 mime = (LPWSTR)0xf0f0f0f0;
636 hres = FindMimeFromData(NULL, mime_tests[i].url, NULL, 0, mimeAppOctetStream, 0, &mime, 0);
637 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
638 ok(!lstrcmpW(mime, mimeAppOctetStream), "[%d] wrong mime\n", i);
639 CoTaskMemFree(mime);
642 for(i=0; i < sizeof(mime_tests2)/sizeof(mime_tests2[0]); i++) {
643 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
644 NULL, 0, &mime, 0);
645 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
646 ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, debugstr_w(mime));
647 CoTaskMemFree(mime);
649 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
650 mimeTextHtml, 0, &mime, 0);
651 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
652 if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime)
653 || !lstrcmpW(mimeTextPlain, mime_tests2[i].mime))
654 ok(!lstrcmpW(mime, mimeTextHtml), "[%d] wrong mime\n", i);
655 else
656 ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i);
657 CoTaskMemFree(mime);
659 hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
660 mimeImagePjpeg, 0, &mime, 0);
661 ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
662 if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime) || i == 17)
663 ok(!lstrcmpW(mime, mimeImagePjpeg), "[%d] wrong mime\n", i);
664 else
665 ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i);
667 CoTaskMemFree(mime);
670 hres = FindMimeFromData(NULL, url1, data1, sizeof(data1), NULL, 0, &mime, 0);
671 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
672 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
673 CoTaskMemFree(mime);
675 hres = FindMimeFromData(NULL, url1, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
676 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
677 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
678 CoTaskMemFree(mime);
680 hres = FindMimeFromData(NULL, url4, data1, sizeof(data1), mimeAppOctetStream, 0, &mime, 0);
681 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
682 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
683 CoTaskMemFree(mime);
685 hres = FindMimeFromData(NULL, NULL, NULL, 0, NULL, 0, &mime, 0);
686 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, excepted E_INVALIDARG\n", hres);
688 hres = FindMimeFromData(NULL, NULL, NULL, 0, mimeTextPlain, 0, &mime, 0);
689 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
691 hres = FindMimeFromData(NULL, NULL, data1, 0, NULL, 0, &mime, 0);
692 ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
694 hres = FindMimeFromData(NULL, url1, data1, 0, NULL, 0, &mime, 0);
695 ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
697 hres = FindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, &mime, 0);
698 ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
699 ok(!lstrcmpW(mime, mimeTextPlain), "wrong mime\n");
700 CoTaskMemFree(mime);
702 hres = FindMimeFromData(NULL, NULL, data1, 0, mimeTextPlain, 0, NULL, 0);
703 ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
706 static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0};
707 static const BYTE secid4[] ={'f','i','l','e',':',3,0,0,0};
708 static const BYTE secid5[] = {'h','t','t','p',':','w','w','w','.','w','i','n','e','h','q',
709 '.','o','r','g',3,0,0,0};
710 static const BYTE secid6[] = {'a','b','o','u','t',':','b','l','a','n','k',3,0,0,0};
711 static const BYTE secid7[] = {'f','t','p',':','w','i','n','e','h','q','.','o','r','g',
712 3,0,0,0};
714 static struct secmgr_test {
715 LPCWSTR url;
716 DWORD zone;
717 HRESULT zone_hres;
718 DWORD secid_size;
719 const BYTE *secid;
720 HRESULT secid_hres;
721 } secmgr_tests[] = {
722 {url1, 0, S_OK, sizeof(secid1), secid1, S_OK},
723 {url2, 100, 0x80041001, 0, NULL, E_INVALIDARG},
724 {url3, 0, S_OK, sizeof(secid1), secid1, S_OK},
725 {url4, 3, S_OK, sizeof(secid4), secid4, S_OK},
726 {url5, 3, S_OK, sizeof(secid5), secid5, S_OK},
727 {url6, 3, S_OK, sizeof(secid6), secid6, S_OK},
728 {url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
731 static void test_SecurityManager(void)
733 int i;
734 IInternetSecurityManager *secmgr = NULL;
735 BYTE buf[512];
736 DWORD zone, size;
737 HRESULT hres;
739 hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
740 ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
741 if(FAILED(hres))
742 return;
744 for(i=0; i < sizeof(secmgr_tests)/sizeof(secmgr_tests[0]); i++) {
745 zone = 100;
746 hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url,
747 &zone, 0);
748 ok(hres == secmgr_tests[i].zone_hres,
749 "[%d] MapUrlToZone failed: %08x, expected %08x\n",
750 i, hres, secmgr_tests[i].zone_hres);
751 if(SUCCEEDED(hres))
752 ok(zone == secmgr_tests[i].zone, "[%d] zone=%d, expected %d\n", i, zone,
753 secmgr_tests[i].zone);
754 else
755 ok(zone == secmgr_tests[i].zone || zone == -1, "[%d] zone=%d\n", i, zone);
757 size = sizeof(buf);
758 memset(buf, 0xf0, sizeof(buf));
759 hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[i].url,
760 buf, &size, 0);
761 ok(hres == secmgr_tests[i].secid_hres,
762 "[%d] GetSecurityId failed: %08x, expected %08x\n",
763 i, hres, secmgr_tests[i].secid_hres);
764 if(secmgr_tests[i].secid) {
765 ok(size == secmgr_tests[i].secid_size, "[%d] size=%d, expected %d\n",
766 i, size, secmgr_tests[i].secid_size);
767 ok(!memcmp(buf, secmgr_tests[i].secid, size), "[%d] wrong secid\n", i);
771 zone = 100;
772 hres = IInternetSecurityManager_MapUrlToZone(secmgr, NULL, &zone, 0);
773 ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08x, expected E_INVALIDARG\n", hres);
774 ok(zone == 100 || zone == -1, "zone=%d\n", zone);
776 size = sizeof(buf);
777 hres = IInternetSecurityManager_GetSecurityId(secmgr, NULL, buf, &size, 0);
778 ok(hres == E_INVALIDARG,
779 "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
780 hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
781 NULL, &size, 0);
782 ok(hres == E_INVALIDARG,
783 "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
784 hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
785 buf, NULL, 0);
786 ok(hres == E_INVALIDARG,
787 "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
789 IInternetSecurityManager_Release(secmgr);
792 static void test_ZoneManager(void)
794 IInternetZoneManager *zonemgr = NULL;
795 BYTE buf[32];
796 HRESULT hres;
798 hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
799 ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
800 if(FAILED(hres))
801 return;
803 hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1a10, buf,
804 sizeof(DWORD), URLZONEREG_DEFAULT);
805 ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
806 ok(*(DWORD*)buf == 1, "policy=%d, expected 1\n", *(DWORD*)buf);
808 hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1a10, NULL,
809 sizeof(DWORD), URLZONEREG_DEFAULT);
810 ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
812 hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1a10, buf,
813 2, URLZONEREG_DEFAULT);
814 ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
816 hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1fff, buf,
817 sizeof(DWORD), URLZONEREG_DEFAULT);
818 ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres);
820 hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 13, 0x1a10, buf,
821 sizeof(DWORD), URLZONEREG_DEFAULT);
822 ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
824 IInternetZoneManager_Release(zonemgr);
827 static void register_protocols(void)
829 IInternetSession *session;
830 IClassFactory *factory;
831 HRESULT hres;
833 static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
835 hres = CoInternetGetSession(0, &session, 0);
836 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
837 if(FAILED(hres))
838 return;
840 hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL,
841 &IID_IClassFactory, (void**)&factory);
842 ok(hres == S_OK, "Coud not get AboutProtocol factory: %08x\n", hres);
843 if(FAILED(hres))
844 return;
846 IInternetSession_RegisterNameSpace(session, factory, &CLSID_AboutProtocol,
847 wszAbout, 0, NULL, 0);
848 IClassFactory_Release(factory);
850 IInternetSession_Release(session);
853 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
854 REFIID riid, void **ppv)
856 ok(0, "unexpected call\n");
857 return E_NOINTERFACE;
860 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
862 return 2;
865 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
867 return 1;
870 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
871 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
872 DWORD *pcchResult, DWORD dwReserved)
874 CHECK_EXPECT(ParseUrl);
875 return E_NOTIMPL;
878 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
879 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
880 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
882 ok(0, "unexpected call\n");
883 return E_NOTIMPL;
886 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
887 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
889 ok(0, "unexpected call\n");
890 return E_NOTIMPL;
893 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
894 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
895 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
897 ok(0, "unexpected call\n");
898 return E_NOTIMPL;
901 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
902 InternetProtocolInfo_QueryInterface,
903 InternetProtocolInfo_AddRef,
904 InternetProtocolInfo_Release,
905 InternetProtocolInfo_ParseUrl,
906 InternetProtocolInfo_CombineUrl,
907 InternetProtocolInfo_CompareUrl,
908 InternetProtocolInfo_QueryInfo
911 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
913 static HRESULT qiret;
914 static IClassFactory *expect_cf;
916 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
918 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
919 CHECK_EXPECT(QI_IInternetProtocolInfo);
920 ok(iface == expect_cf, "unexpected iface\n");
921 *ppv = &protocol_info;
922 return qiret;
925 ok(0, "unexpected call\n");
926 return E_NOINTERFACE;
929 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
931 return 2;
934 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
936 return 1;
939 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
940 REFIID riid, void **ppv)
942 ok(0, "unexpected call\n");
943 return E_NOTIMPL;
946 static HRESULT WINAPI ProtocolCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
947 REFIID riid, void **ppv)
949 CHECK_EXPECT(CreateInstance);
951 ok(iface == expect_cf, "unexpected iface\n");
952 ok(pOuter == NULL, "pOuter = %p\n", pOuter);
953 ok(IsEqualGUID(&IID_IInternetProtocolInfo, riid), "unexpected riid\n");
954 ok(ppv != NULL, "ppv == NULL\n");
956 *ppv = &protocol_info;
957 return S_OK;
960 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
962 ok(0, "unexpected call\n");
963 return S_OK;
966 static const IClassFactoryVtbl ClassFactoryVtbl = {
967 ClassFactory_QueryInterface,
968 ClassFactory_AddRef,
969 ClassFactory_Release,
970 ClassFactory_CreateInstance,
971 ClassFactory_LockServer
974 static const IClassFactoryVtbl ProtocolCFVtbl = {
975 ClassFactory_QueryInterface,
976 ClassFactory_AddRef,
977 ClassFactory_Release,
978 ProtocolCF_CreateInstance,
979 ClassFactory_LockServer
982 static IClassFactory test_protocol_cf = { &ProtocolCFVtbl };
983 static IClassFactory test_protocol_cf2 = { &ProtocolCFVtbl };
984 static IClassFactory test_cf = { &ClassFactoryVtbl };
986 static void test_NameSpace(void)
988 IInternetSession *session;
989 WCHAR buf[200];
990 DWORD size;
991 HRESULT hres;
993 static const WCHAR wszTest[] = {'t','e','s','t',0};
995 hres = CoInternetGetSession(0, &session, 0);
996 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
997 if(FAILED(hres))
998 return;
1000 hres = IInternetSession_RegisterNameSpace(session, NULL, &IID_NULL,
1001 wszTest, 0, NULL, 0);
1002 ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
1004 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1005 NULL, 0, NULL, 0);
1006 ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
1008 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1009 wszTest, 0, NULL, 0);
1010 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1012 qiret = E_NOINTERFACE;
1013 expect_cf = &test_protocol_cf;
1014 SET_EXPECT(QI_IInternetProtocolInfo);
1015 SET_EXPECT(CreateInstance);
1016 SET_EXPECT(ParseUrl);
1018 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1019 &size, 0);
1020 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1022 CHECK_CALLED(QI_IInternetProtocolInfo);
1023 CHECK_CALLED(CreateInstance);
1024 CHECK_CALLED(ParseUrl);
1026 qiret = S_OK;
1027 SET_EXPECT(QI_IInternetProtocolInfo);
1028 SET_EXPECT(ParseUrl);
1030 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1031 &size, 0);
1032 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1034 CHECK_CALLED(QI_IInternetProtocolInfo);
1035 CHECK_CALLED(ParseUrl);
1037 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1038 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1040 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1041 &size, 0);
1042 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1044 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL,
1045 wszTest, 0, NULL, 0);
1046 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1048 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1049 wszTest, 0, NULL, 0);
1050 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1052 hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
1053 wszTest, 0, NULL, 0);
1054 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
1056 SET_EXPECT(QI_IInternetProtocolInfo);
1057 SET_EXPECT(ParseUrl);
1059 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1060 &size, 0);
1061 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1063 CHECK_CALLED(QI_IInternetProtocolInfo);
1064 CHECK_CALLED(ParseUrl);
1066 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1067 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1069 SET_EXPECT(QI_IInternetProtocolInfo);
1070 SET_EXPECT(ParseUrl);
1072 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1073 &size, 0);
1074 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1076 CHECK_CALLED(QI_IInternetProtocolInfo);
1077 CHECK_CALLED(ParseUrl);
1079 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1080 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1082 expect_cf = &test_protocol_cf2;
1083 SET_EXPECT(QI_IInternetProtocolInfo);
1084 SET_EXPECT(ParseUrl);
1086 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1087 &size, 0);
1088 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1090 CHECK_CALLED(QI_IInternetProtocolInfo);
1091 CHECK_CALLED(ParseUrl);
1093 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1094 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1095 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
1096 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1097 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL);
1098 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
1099 hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest);
1100 ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
1102 hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest);
1103 ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
1105 hres = CoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, sizeof(buf)/sizeof(WCHAR),
1106 &size, 0);
1107 ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
1109 IInternetSession_Release(session);
1112 static void test_MimeFilter(void)
1114 IInternetSession *session;
1115 HRESULT hres;
1117 static const WCHAR mimeW[] = {'t','e','s','t','/','m','i','m','e',0};
1119 hres = CoInternetGetSession(0, &session, 0);
1120 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
1121 if(FAILED(hres))
1122 return;
1124 hres = IInternetSession_RegisterMimeFilter(session, &test_cf, &IID_NULL, mimeW);
1125 ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
1127 hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
1128 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1130 hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
1131 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1133 hres = IInternetSession_UnregisterMimeFilter(session, (void*)0xdeadbeef, mimeW);
1134 ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
1136 IInternetSession_Release(session);
1139 static ULONG WINAPI unk_Release(IUnknown *iface)
1141 CHECK_EXPECT(unk_Release);
1142 return 0;
1145 static const IUnknownVtbl unk_vtbl = {
1146 (void*)0xdeadbeef,
1147 (void*)0xdeadbeef,
1148 unk_Release
1151 static void test_ReleaseBindInfo(void)
1153 BINDINFO bi;
1154 IUnknown unk = { &unk_vtbl };
1156 ReleaseBindInfo(NULL); /* shouldn't crash */
1158 memset(&bi, 0, sizeof(bi));
1159 bi.cbSize = sizeof(BINDINFO);
1160 bi.pUnk = &unk;
1161 SET_EXPECT(unk_Release);
1162 ReleaseBindInfo(&bi);
1163 ok(bi.cbSize == sizeof(BINDINFO), "bi.cbSize=%d\n", bi.cbSize);
1164 ok(bi.pUnk == NULL, "bi.pUnk=%p, expected NULL\n", bi.pUnk);
1165 CHECK_CALLED(unk_Release);
1167 memset(&bi, 0, sizeof(bi));
1168 bi.cbSize = offsetof(BINDINFO, pUnk);
1169 bi.pUnk = &unk;
1170 ReleaseBindInfo(&bi);
1171 ok(bi.cbSize == offsetof(BINDINFO, pUnk), "bi.cbSize=%d\n", bi.cbSize);
1172 ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
1174 memset(&bi, 0, sizeof(bi));
1175 bi.pUnk = &unk;
1176 ReleaseBindInfo(&bi);
1177 ok(!bi.cbSize, "bi.cbSize=%d, expected 0\n", bi.cbSize);
1178 ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
1181 static void test_CopyStgMedium(void)
1183 STGMEDIUM src, dst;
1184 HRESULT hres;
1186 memset(&src, 0xf0, sizeof(src));
1187 memset(&dst, 0xe0, sizeof(dst));
1188 src.tymed = TYMED_NULL;
1189 src.pUnkForRelease = NULL;
1190 hres = CopyStgMedium(&src, &dst);
1191 ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
1192 ok(dst.tymed == TYMED_NULL, "tymed=%d\n", dst.tymed);
1193 ok(dst.u.hGlobal == (void*)0xf0f0f0f0, "u=%p\n", dst.u.hGlobal);
1194 ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
1196 memset(&dst, 0xe0, sizeof(dst));
1197 src.tymed = TYMED_ISTREAM;
1198 src.u.pstm = NULL;
1199 src.pUnkForRelease = NULL;
1200 hres = CopyStgMedium(&src, &dst);
1201 ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
1202 ok(dst.tymed == TYMED_ISTREAM, "tymed=%d\n", dst.tymed);
1203 ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
1204 ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
1206 hres = CopyStgMedium(&src, NULL);
1207 ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
1208 hres = CopyStgMedium(NULL, &dst);
1209 ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
1212 static void test_UrlMkGetSessionOption(void)
1214 DWORD encoding, size;
1215 HRESULT hres;
1217 size = encoding = 0xdeadbeef;
1218 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1219 sizeof(encoding), &size, 0);
1220 ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
1221 ok(encoding != 0xdeadbeef, "encoding not changed\n");
1222 ok(size == sizeof(encoding), "size=%d\n", size);
1224 size = encoding = 0xdeadbeef;
1225 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1226 sizeof(encoding)+1, &size, 0);
1227 ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
1228 ok(encoding != 0xdeadbeef, "encoding not changed\n");
1229 ok(size == sizeof(encoding), "size=%d\n", size);
1231 size = encoding = 0xdeadbeef;
1232 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1233 sizeof(encoding)-1, &size, 0);
1234 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1235 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1236 ok(size == 0xdeadbeef, "size=%d\n", size);
1238 size = encoding = 0xdeadbeef;
1239 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, NULL,
1240 sizeof(encoding)-1, &size, 0);
1241 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1242 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1243 ok(size == 0xdeadbeef, "size=%d\n", size);
1245 encoding = 0xdeadbeef;
1246 hres = UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
1247 sizeof(encoding)-1, NULL, 0);
1248 ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
1249 ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
1252 static void test_ObtainUserAgentString(void)
1254 static const CHAR expected[] = "Mozilla/4.0 (compatible; MSIE ";
1255 static CHAR str[3];
1256 LPSTR str2 = NULL;
1257 HRESULT hres;
1258 DWORD size, saved;
1260 hres = ObtainUserAgentString(0, NULL, NULL);
1261 ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
1263 size = 100;
1264 hres = ObtainUserAgentString(0, NULL, &size);
1265 ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
1266 ok(size == 100, "size=%d, expected %d\n", size, 100);
1268 size = 0;
1269 hres = ObtainUserAgentString(0, str, &size);
1270 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1271 ok(size > 0, "size=%d, expected non-zero\n", size);
1273 size = 2;
1274 str[0] = 'a';
1275 hres = ObtainUserAgentString(0, str, &size);
1276 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1277 ok(size > 0, "size=%d, expected non-zero\n", size);
1278 ok(str[0] == 'a', "str[0]=%c, expected 'a'\n", str[0]);
1280 size = 0;
1281 hres = ObtainUserAgentString(1, str, &size);
1282 ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
1283 ok(size > 0, "size=%d, expected non-zero\n", size);
1285 str2 = HeapAlloc(GetProcessHeap(), 0, (size+20)*sizeof(CHAR));
1286 if (!str2)
1288 skip("skipping rest of ObtainUserAgent tests, out of memory\n");
1290 else
1292 saved = size;
1293 hres = ObtainUserAgentString(0, str2, &size);
1294 ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
1295 ok(size == saved, "size=%d, expected %d\n", size, saved);
1296 ok(strlen(expected) <= strlen(str2) &&
1297 !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
1298 "user agent was \"%s\", expected to start with \"%s\"\n",
1299 str2, expected);
1301 size = saved+10;
1302 hres = ObtainUserAgentString(0, str2, &size);
1303 ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
1304 ok(size == saved, "size=%d, expected %d\n", size, saved);
1306 HeapFree(GetProcessHeap(), 0, str2);
1309 static void test_MkParseDisplayNameEx(void)
1311 IMoniker *mon = NULL;
1312 LPWSTR name;
1313 DWORD issys;
1314 ULONG eaten = 0;
1315 IBindCtx *bctx;
1316 HRESULT hres;
1318 static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
1319 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
1320 '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
1322 CreateBindCtx(0, &bctx);
1324 hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon);
1325 ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
1326 ok(eaten == sizeof(url9)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
1327 ok(mon != NULL, "mon == NULL\n");
1329 hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
1330 ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
1331 ok(!lstrcmpW(name, url9), "wrong display name %s\n", debugstr_w(name));
1332 CoTaskMemFree(name);
1334 hres = IMoniker_IsSystemMoniker(mon, &issys);
1335 ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
1336 ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
1338 IMoniker_Release(mon);
1340 hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon);
1341 ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
1342 ok(eaten == sizeof(clsid_nameW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten);
1343 ok(mon != NULL, "mon == NULL\n");
1345 hres = IMoniker_IsSystemMoniker(mon, &issys);
1346 ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
1347 ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
1349 IMoniker_Release(mon);
1351 hres = MkParseDisplayNameEx(bctx, url8, &eaten, &mon);
1352 ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08x\n", hres);
1354 IBindCtx_Release(bctx);
1357 START_TEST(misc)
1359 OleInitialize(NULL);
1361 register_protocols();
1363 test_CreateFormatEnum();
1364 test_RegisterFormatEnumerator();
1365 test_CoInternetParseUrl();
1366 test_CoInternetCompareUrl();
1367 test_CoInternetQueryInfo();
1368 test_FindMimeFromData();
1369 test_SecurityManager();
1370 test_ZoneManager();
1371 test_NameSpace();
1372 test_MimeFilter();
1373 test_ReleaseBindInfo();
1374 test_CopyStgMedium();
1375 test_UrlMkGetSessionOption();
1376 test_ObtainUserAgentString();
1377 test_MkParseDisplayNameEx();
1379 OleUninitialize();