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 void test_CreateFormatEnum(void)
68 IEnumFORMATETC
*fenum
= NULL
, *fenum2
= NULL
;
73 static DVTARGETDEVICE dev
= {sizeof(dev
),0,0,0,0,{0}};
74 static FORMATETC formatetc
[] = {
82 hres
= CreateFormatEnumerator(0, formatetc
, &fenum
);
83 ok(hres
== E_FAIL
, "CreateFormatEnumerator failed: %08x, expected E_FAIL\n", hres
);
84 hres
= CreateFormatEnumerator(0, formatetc
, NULL
);
85 ok(hres
== E_INVALIDARG
, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
86 hres
= CreateFormatEnumerator(5, formatetc
, NULL
);
87 ok(hres
== E_INVALIDARG
, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
90 hres
= CreateFormatEnumerator(5, formatetc
, &fenum
);
91 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
95 hres
= IEnumFORMATETC_Next(fenum
, 2, NULL
, &ul
);
96 ok(hres
== E_INVALIDARG
, "Next failed: %08x, expected E_INVALIDARG\n", hres
);
98 hres
= IEnumFORMATETC_Next(fenum
, 0, fetc
, &ul
);
99 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
100 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
102 hres
= IEnumFORMATETC_Next(fenum
, 2, fetc
, &ul
);
103 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
104 ok(fetc
[0].lindex
== 0, "fetc[0].lindex=%d, expected 0\n", fetc
[0].lindex
);
105 ok(fetc
[1].lindex
== 1, "fetc[1].lindex=%d, expected 1\n", fetc
[1].lindex
);
106 ok(fetc
[0].ptd
== &dev
, "fetc[0].ptd=%p, expected %p\n", fetc
[0].ptd
, &dev
);
107 ok(ul
== 2, "ul=%d, expected 2\n", ul
);
109 hres
= IEnumFORMATETC_Skip(fenum
, 1);
110 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
112 hres
= IEnumFORMATETC_Next(fenum
, 4, fetc
, &ul
);
113 ok(hres
== S_FALSE
, "Next failed: %08x, expected S_FALSE\n", hres
);
114 ok(fetc
[0].lindex
== 3, "fetc[0].lindex=%d, expected 3\n", fetc
[0].lindex
);
115 ok(fetc
[1].lindex
== 4, "fetc[1].lindex=%d, expected 4\n", fetc
[1].lindex
);
116 ok(fetc
[0].ptd
== NULL
, "fetc[0].ptd=%p, expected NULL\n", fetc
[0].ptd
);
117 ok(ul
== 2, "ul=%d, expected 2\n", ul
);
119 hres
= IEnumFORMATETC_Next(fenum
, 4, fetc
, &ul
);
120 ok(hres
== S_FALSE
, "Next failed: %08x, expected S_FALSE\n", hres
);
121 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
123 hres
= IEnumFORMATETC_Next(fenum
, 0, fetc
, &ul
);
124 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
125 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
127 hres
= IEnumFORMATETC_Skip(fenum
, 3);
128 ok(hres
== S_FALSE
, "Skip failed: %08x, expected S_FALSE\n", hres
);
130 hres
= IEnumFORMATETC_Reset(fenum
);
131 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
133 hres
= IEnumFORMATETC_Next(fenum
, 5, fetc
, NULL
);
134 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
135 ok(fetc
[0].lindex
== 0, "fetc[0].lindex=%d, expected 0\n", fetc
[0].lindex
);
137 hres
= IEnumFORMATETC_Reset(fenum
);
138 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
140 hres
= IEnumFORMATETC_Skip(fenum
, 2);
141 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
143 hres
= IEnumFORMATETC_Clone(fenum
, NULL
);
144 ok(hres
== E_INVALIDARG
, "Clone failed: %08x, expected E_INVALIDARG\n", hres
);
146 hres
= IEnumFORMATETC_Clone(fenum
, &fenum2
);
147 ok(hres
== S_OK
, "Clone failed: %08x\n", hres
);
149 if(SUCCEEDED(hres
)) {
150 ok(fenum
!= fenum2
, "fenum == fenum2\n");
152 hres
= IEnumFORMATETC_Next(fenum2
, 2, fetc
, &ul
);
153 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
154 ok(fetc
[0].lindex
== 2, "fetc[0].lindex=%d, expected 2\n", fetc
[0].lindex
);
156 IEnumFORMATETC_Release(fenum2
);
159 hres
= IEnumFORMATETC_Next(fenum
, 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 hres
= IEnumFORMATETC_Skip(fenum
, 1);
164 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
166 IEnumFORMATETC_Release(fenum
);
169 static void test_RegisterFormatEnumerator(void)
171 IBindCtx
*bctx
= NULL
;
172 IEnumFORMATETC
*format
= NULL
, *format2
= NULL
;
173 IUnknown
*unk
= NULL
;
176 static FORMATETC formatetc
= {0,NULL
,0,0,0};
177 static WCHAR wszEnumFORMATETC
[] =
178 {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0};
180 CreateBindCtx(0, &bctx
);
182 hres
= CreateFormatEnumerator(1, &formatetc
, &format
);
183 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
187 hres
= RegisterFormatEnumerator(NULL
, format
, 0);
188 ok(hres
== E_INVALIDARG
,
189 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
190 hres
= RegisterFormatEnumerator(bctx
, NULL
, 0);
191 ok(hres
== E_INVALIDARG
,
192 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
194 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
195 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
197 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
198 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
199 ok(unk
== (IUnknown
*)format
, "unk != format\n");
201 hres
= RevokeFormatEnumerator(NULL
, format
);
202 ok(hres
== E_INVALIDARG
,
203 "RevokeFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
205 hres
= RevokeFormatEnumerator(bctx
, format
);
206 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
208 hres
= RevokeFormatEnumerator(bctx
, format
);
209 ok(hres
== E_FAIL
, "RevokeFormatEnumerator failed: %08x, expected E_FAIL\n", hres
);
211 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
212 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
214 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
215 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
217 hres
= CreateFormatEnumerator(1, &formatetc
, &format2
);
218 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
220 if(SUCCEEDED(hres
)) {
221 hres
= RevokeFormatEnumerator(bctx
, format
);
222 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
224 IEnumFORMATETC_Release(format2
);
227 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
228 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
230 IEnumFORMATETC_Release(format
);
232 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
233 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
234 hres
= RevokeFormatEnumerator(bctx
, NULL
);
235 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
236 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
237 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
239 IEnumFORMATETC_Release(format
);
240 IBindCtx_Release(bctx
);
243 static const WCHAR url1
[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
244 '/','b','l','a','n','k','.','h','t','m',0};
245 static const WCHAR url2
[] = {'i','n','d','e','x','.','h','t','m',0};
246 static const WCHAR url3
[] = {'f','i','l','e',':','/','/','c',':','\\','I','n','d','e','x','.','h','t','m',0};
247 static const WCHAR url4
[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
248 '%','2','e','j','p','g',0};
249 static const WCHAR url5
[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
251 static const WCHAR url6
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
252 static const WCHAR url7
[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
253 'f','i','l','e','.','t','e','s','t',0};
254 static const WCHAR url8
[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
255 static const WCHAR url9
[] =
256 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
257 '/','s','i','t','e','/','a','b','o','u','t',0};
258 static const WCHAR url10
[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
261 static const WCHAR url4e
[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
264 static const WCHAR path3
[] = {'c',':','\\','I','n','d','e','x','.','h','t','m',0};
265 static const WCHAR path4
[] = {'s','o','m','e',' ','f','i','l','e','.','j','p','g',0};
267 static const WCHAR wszRes
[] = {'r','e','s',0};
268 static const WCHAR wszFile
[] = {'f','i','l','e',0};
269 static const WCHAR wszHttp
[] = {'h','t','t','p',0};
270 static const WCHAR wszAbout
[] = {'a','b','o','u','t',0};
271 static const WCHAR wszEmpty
[] = {0};
282 static const struct parse_test parse_tests
[] = {
283 {url1
, S_OK
, url1
, E_INVALIDARG
, NULL
, wszRes
},
284 {url2
, E_FAIL
, url2
, E_INVALIDARG
, NULL
, wszEmpty
},
285 {url3
, E_FAIL
, url3
, S_OK
, path3
, wszFile
},
286 {url4
, E_FAIL
, url4e
, S_OK
, path4
, wszFile
},
287 {url5
, E_FAIL
, url5
, E_INVALIDARG
, NULL
, wszHttp
},
288 {url6
, S_OK
, url6
, E_INVALIDARG
, NULL
, wszAbout
}
291 static void test_CoInternetParseUrl(void)
297 static WCHAR buf
[4096];
299 memset(buf
, 0xf0, sizeof(buf
));
300 hres
= CoInternetParseUrl(parse_tests
[0].url
, PARSE_SCHEMA
, 0, buf
,
302 ok(hres
== E_POINTER
, "schema failed: %08x, expected E_POINTER\n", hres
);
304 for(i
=0; i
< sizeof(parse_tests
)/sizeof(parse_tests
[0]); i
++) {
305 memset(buf
, 0xf0, sizeof(buf
));
306 hres
= CoInternetParseUrl(parse_tests
[i
].url
, PARSE_SECURITY_URL
, 0, buf
,
307 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
308 ok(hres
== parse_tests
[i
].secur_hres
, "[%d] security url failed: %08x, expected %08x\n",
309 i
, hres
, parse_tests
[i
].secur_hres
);
311 memset(buf
, 0xf0, sizeof(buf
));
312 hres
= CoInternetParseUrl(parse_tests
[i
].url
, PARSE_ENCODE
, 0, buf
,
313 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
314 ok(hres
== S_OK
, "[%d] encoding failed: %08x\n", i
, hres
);
315 ok(size
== lstrlenW(parse_tests
[i
].encoded_url
), "[%d] wrong size\n", i
);
316 ok(!lstrcmpW(parse_tests
[i
].encoded_url
, buf
), "[%d] wrong encoded url\n", i
);
318 memset(buf
, 0xf0, sizeof(buf
));
319 hres
= CoInternetParseUrl(parse_tests
[i
].url
, PARSE_PATH_FROM_URL
, 0, buf
,
320 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
321 ok(hres
== parse_tests
[i
].path_hres
, "[%d] path failed: %08x, expected %08x\n",
322 i
, hres
, parse_tests
[i
].path_hres
);
323 if(parse_tests
[i
].path
) {
324 ok(size
== lstrlenW(parse_tests
[i
].path
), "[%d] wrong size\n", i
);
325 ok(!lstrcmpW(parse_tests
[i
].path
, buf
), "[%d] wrong path\n", i
);
328 memset(buf
, 0xf0, sizeof(buf
));
329 hres
= CoInternetParseUrl(parse_tests
[i
].url
, PARSE_SCHEMA
, 0, buf
,
330 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
331 ok(hres
== S_OK
, "[%d] schema failed: %08x\n", i
, hres
);
332 ok(size
== lstrlenW(parse_tests
[i
].schema
), "[%d] wrong size\n", i
);
333 ok(!lstrcmpW(parse_tests
[i
].schema
, buf
), "[%d] wrong schema\n", i
);
337 static void test_CoInternetCompareUrl(void)
341 hres
= CoInternetCompareUrl(url1
, url1
, 0);
342 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
344 hres
= CoInternetCompareUrl(url1
, url3
, 0);
345 ok(hres
== S_FALSE
, "CoInternetParseUrl failed: %08x\n", hres
);
347 hres
= CoInternetCompareUrl(url3
, url1
, 0);
348 ok(hres
== S_FALSE
, "CoInternetParseUrl failed: %08x\n", hres
);
351 static const struct {
354 } query_info_tests
[] = {
365 static void test_CoInternetQueryInfo(void)
371 for(i
=0; i
< sizeof(query_info_tests
)/sizeof(query_info_tests
[0]); i
++) {
373 memset(buf
, '?', sizeof(buf
));
374 hres
= CoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, sizeof(buf
), &cb
, 0);
375 ok(hres
== S_OK
, "[%d] CoInternetQueryInfo failed: %08x\n", i
, hres
);
376 ok(cb
== sizeof(DWORD
), "[%d] cb = %d\n", i
, cb
);
377 ok(*(DWORD
*)buf
== query_info_tests
[i
].uses_net
, "[%d] ret %x, expected %x\n",
378 i
, *(DWORD
*)buf
, query_info_tests
[i
].uses_net
);
380 hres
= CoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, 3, &cb
, 0);
381 ok(hres
== E_FAIL
, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i
, hres
);
382 hres
= CoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, NULL
, sizeof(buf
), &cb
, 0);
383 ok(hres
== E_FAIL
, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i
, hres
);
385 memset(buf
, '?', sizeof(buf
));
386 hres
= CoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, sizeof(buf
), NULL
, 0);
387 ok(hres
== S_OK
, "[%d] CoInternetQueryInfo failed: %08x\n", i
, hres
);
388 ok(*(DWORD
*)buf
== query_info_tests
[i
].uses_net
, "[%d] ret %x, expected %x\n",
389 i
, *(DWORD
*)buf
, query_info_tests
[i
].uses_net
);
393 static const WCHAR mimeTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
394 static const WCHAR mimeTextPlain
[] = {'t','e','x','t','/','p','l','a','i','n',0};
395 static const WCHAR mimeTextRichtext
[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
396 static const WCHAR mimeAppOctetStream
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
397 'o','c','t','e','t','-','s','t','r','e','a','m',0};
398 static const WCHAR mimeImagePjpeg
[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
399 static const WCHAR mimeImageGif
[] = {'i','m','a','g','e','/','g','i','f',0};
400 static const WCHAR mimeImageBmp
[] = {'i','m','a','g','e','/','b','m','p',0};
401 static const WCHAR mimeImageXPng
[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
402 static const WCHAR mimeImageTiff
[] = {'i','m','a','g','e','/','t','i','f','f',0};
403 static const WCHAR mimeVideoAvi
[] = {'v','i','d','e','o','/','a','v','i',0};
404 static const WCHAR mimeVideoMpeg
[] = {'v','i','d','e','o','/','m','p','e','g',0};
405 static const WCHAR mimeAppPostscript
[] =
406 {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
407 static const WCHAR mimeAppXCompressed
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
408 'x','-','c','o','m','p','r','e','s','s','e','d',0};
409 static const WCHAR mimeAppXZip
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
410 'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
411 static const WCHAR mimeAppXGzip
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
412 'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
413 static const WCHAR mimeAppJava
[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
414 static const WCHAR mimeAppPdf
[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
415 static const WCHAR mimeAppXMSDownload
[] =
416 {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
417 static const WCHAR mimeAudioWav
[] = {'a','u','d','i','o','/','w','a','v',0};
418 static const WCHAR mimeAudioBasic
[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
420 static const struct {
425 {url1
, mimeTextHtml
, S_OK
},
426 {url2
, mimeTextHtml
, S_OK
},
427 {url3
, mimeTextHtml
, S_OK
},
428 {url4
, NULL
, E_FAIL
},
429 {url5
, NULL
, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
)},
430 {url6
, NULL
, E_FAIL
},
431 {url7
, NULL
, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
)}
434 static BYTE data1
[] = "test data\n";
435 static BYTE data2
[] = {31,'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0};
436 static BYTE data3
[] = {0,0,0};
437 static BYTE data4
[] = {'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0,0};
438 static BYTE data5
[] = {0xa,0xa,0xa,'x',32,'x',0};
439 static BYTE data6
[] = {0xfa,0xfa,0xfa,0xfa,'\n','\r','\t','x','x','x',1};
440 static BYTE data7
[] = "<html>blahblah";
441 static BYTE data8
[] = {'t','e','s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
442 static BYTE data9
[] = {'t','e',0,'s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
443 static BYTE data10
[] = "<HtmL>blahblah";
444 static BYTE data11
[] = "blah<HTML>blahblah";
445 static BYTE data12
[] = "blah<HTMLblahblah";
446 static BYTE data13
[] = "blahHTML>blahblah";
447 static BYTE data14
[] = "blah<HTMblahblah";
448 static BYTE data15
[] = {0xff,0xd8};
449 static BYTE data16
[] = {0xff,0xd8,'h'};
450 static BYTE data17
[] = {0,0xff,0xd8};
451 static BYTE data18
[] = {0xff,0xd8,'<','h','t','m','l','>'};
452 static BYTE data19
[] = {'G','I','F','8','7','a'};
453 static BYTE data20
[] = {'G','I','F','8','9','a'};
454 static BYTE data21
[] = {'G','I','F','8','7'};
455 static BYTE data22
[] = {'G','i','F','8','7','a'};
456 static BYTE data23
[] = {'G','i','F','8','8','a'};
457 static BYTE data24
[] = {'g','i','f','8','7','a'};
458 static BYTE data25
[] = {'G','i','F','8','7','A'};
459 static BYTE data26
[] = {'G','i','F','8','7','a','<','h','t','m','l','>'};
460 static BYTE data27
[] = {0x30,'G','i','F','8','7','A'};
461 static BYTE data28
[] = {0x42,0x4d,0x6e,0x42,0x1c,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00};
462 static BYTE data29
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x','x'};
463 static BYTE data30
[] = {0x42,0x4d,'x','x','x','x',0x00,0x01,0x00,0x00,'x','x','x','x'};
464 static BYTE data31
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'<','h','t','m','l','>'};
465 static BYTE data32
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
466 static BYTE data33
[] = {0x00,0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
467 static BYTE data34
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
468 static BYTE data35
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x','x','x','x',0};
469 static BYTE data36
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,'x','x'};
470 static BYTE data37
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'<','h','t','m','l','>'};
471 static BYTE data38
[] = {0x00,0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
472 static BYTE data39
[] = {0x4d,0x4d,0x00,0x2a};
473 static BYTE data40
[] = {0x4d,0x4d,0x00,0x2a,'<','h','t','m','l','>',0};
474 static BYTE data41
[] = {0x4d,0x4d,0xff};
475 static BYTE data42
[] = {0x4d,0x4d};
476 static BYTE data43
[] = {0x00,0x4d,0x4d,0x00};
477 static BYTE data44
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
478 static BYTE data45
[] = {'R','I','F','f',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
479 static BYTE data46
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20};
480 static BYTE data47
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x21,0xff};
481 static BYTE data48
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,'<','h','t','m','l','>'};
482 static BYTE data49
[] = {'R','I','F','F',0x0f,0x0f,0xf0,0xf0,'A','V','I',0x20,0xf0,0x00};
483 static BYTE data50
[] = {0x00,0x00,0x01,0xb3,0xff};
484 static BYTE data51
[] = {0x00,0x00,0x01,0xba,0xff};
485 static BYTE data52
[] = {0x00,0x00,0x01,0xb8,0xff};
486 static BYTE data53
[] = {0x00,0x00,0x01,0xba};
487 static BYTE data54
[] = {0x00,0x00,0x01,0xba,'<','h','t','m','l','>'};
488 static BYTE data55
[] = {0x1f,0x8b,'x'};
489 static BYTE data56
[] = {0x1f};
490 static BYTE data57
[] = {0x1f,0x8b,'<','h','t','m','l','>','t','e','s','t',0};
491 static BYTE data58
[] = {0x1f,0x8b};
492 static BYTE data59
[] = {0x50,0x4b,'x'};
493 static BYTE data60
[] = {0x50,0x4b};
494 static BYTE data61
[] = {0x50,0x4b,'<','h','t','m','l','>',0};
495 static BYTE data62
[] = {0xca,0xfe,0xba,0xbe,'x'};
496 static BYTE data63
[] = {0xca,0xfe,0xba,0xbe};
497 static BYTE data64
[] = {0xca,0xfe,0xba,0xbe,'<','h','t','m','l','>',0};
498 static BYTE data65
[] = {0x25,0x50,0x44,0x46,'x'};
499 static BYTE data66
[] = {0x25,0x50,0x44,0x46};
500 static BYTE data67
[] = {0x25,0x50,0x44,0x46,'x','<','h','t','m','l','>'};
501 static BYTE data68
[] = {'M','Z','x'};
502 static BYTE data69
[] = {'M','Z'};
503 static BYTE data70
[] = {'M','Z','<','h','t','m','l','>',0xff};
504 static BYTE data71
[] = {'{','\\','r','t','f',0};
505 static BYTE data72
[] = {'{','\\','r','t','f'};
506 static BYTE data73
[] = {' ','{','\\','r','t','f',' '};
507 static BYTE data74
[] = {'{','\\','r','t','f','<','h','t','m','l','>',' '};
508 static BYTE data75
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E',0xff};
509 static BYTE data76
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E'};
510 static BYTE data77
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V',0xff,0xff};
511 static BYTE data78
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l','>',0xff};
512 static BYTE data79
[] = {'%','!',0xff};
513 static BYTE data80
[] = {'%','!'};
514 static BYTE data81
[] = {'%','!','P','S','<','h','t','m','l','>'};
515 static BYTE data82
[] = {'.','s','n','d',0};
516 static BYTE data83
[] = {'.','s','n','d'};
517 static BYTE data84
[] = {'.','s','n','d',0,'<','h','t','m','l','>',1,1};
518 static BYTE data85
[] = {'.','S','N','D',0};
520 static const struct {
523 LPCWSTR mime
, mime_alt
;
525 {data1
, sizeof(data1
), mimeTextPlain
},
526 {data2
, sizeof(data2
), mimeAppOctetStream
},
527 {data3
, sizeof(data3
), mimeAppOctetStream
},
528 {data4
, sizeof(data4
), mimeAppOctetStream
},
529 {data5
, sizeof(data5
), mimeTextPlain
},
530 {data6
, sizeof(data6
), mimeTextPlain
},
531 {data7
, sizeof(data7
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
532 {data8
, sizeof(data8
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
533 {data9
, sizeof(data9
), mimeTextHtml
, mimeImagePjpeg
/* IE8 */},
534 {data10
, sizeof(data10
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
535 {data11
, sizeof(data11
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
536 {data12
, sizeof(data12
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
537 {data13
, sizeof(data13
), mimeTextPlain
},
538 {data14
, sizeof(data14
), mimeTextPlain
},
539 {data15
, sizeof(data15
), mimeTextPlain
},
540 {data16
, sizeof(data16
), mimeImagePjpeg
},
541 {data17
, sizeof(data17
), mimeAppOctetStream
},
542 {data18
, sizeof(data18
), mimeTextHtml
},
543 {data19
, sizeof(data19
), mimeImageGif
},
544 {data20
, sizeof(data20
), mimeImageGif
},
545 {data21
, sizeof(data21
), mimeTextPlain
},
546 {data22
, sizeof(data22
), mimeImageGif
},
547 {data23
, sizeof(data23
), mimeTextPlain
},
548 {data24
, sizeof(data24
), mimeImageGif
},
549 {data25
, sizeof(data25
), mimeImageGif
},
550 {data26
, sizeof(data26
), mimeTextHtml
, mimeImageGif
/* IE8 */},
551 {data27
, sizeof(data27
), mimeTextPlain
},
552 {data28
, sizeof(data28
), mimeImageBmp
},
553 {data29
, sizeof(data29
), mimeImageBmp
},
554 {data30
, sizeof(data30
), mimeAppOctetStream
},
555 {data31
, sizeof(data31
), mimeTextHtml
, mimeImageBmp
/* IE8 */},
556 {data32
, sizeof(data32
), mimeAppOctetStream
},
557 {data33
, sizeof(data33
), mimeAppOctetStream
},
558 {data34
, sizeof(data34
), mimeImageXPng
},
559 {data35
, sizeof(data35
), mimeImageXPng
},
560 {data36
, sizeof(data36
), mimeAppOctetStream
},
561 {data37
, sizeof(data37
), mimeTextHtml
, mimeImageXPng
/* IE8 */},
562 {data38
, sizeof(data38
), mimeAppOctetStream
},
563 {data39
, sizeof(data39
), mimeImageTiff
},
564 {data40
, sizeof(data40
), mimeTextHtml
, mimeImageTiff
/* IE8 */},
565 {data41
, sizeof(data41
), mimeImageTiff
},
566 {data42
, sizeof(data42
), mimeTextPlain
},
567 {data43
, sizeof(data43
), mimeAppOctetStream
},
568 {data44
, sizeof(data44
), mimeVideoAvi
},
569 {data45
, sizeof(data45
), mimeTextPlain
},
570 {data46
, sizeof(data46
), mimeTextPlain
},
571 {data47
, sizeof(data47
), mimeTextPlain
},
572 {data48
, sizeof(data48
), mimeTextHtml
, mimeVideoAvi
/* IE8 */},
573 {data49
, sizeof(data49
), mimeVideoAvi
},
574 {data50
, sizeof(data50
), mimeVideoMpeg
},
575 {data51
, sizeof(data51
), mimeVideoMpeg
},
576 {data52
, sizeof(data52
), mimeAppOctetStream
},
577 {data53
, sizeof(data53
), mimeAppOctetStream
},
578 {data54
, sizeof(data54
), mimeTextHtml
, mimeVideoMpeg
/* IE8 */},
579 {data55
, sizeof(data55
), mimeAppXGzip
},
580 {data56
, sizeof(data56
), mimeTextPlain
},
581 {data57
, sizeof(data57
), mimeTextHtml
, mimeAppXGzip
/* IE8 */},
582 {data58
, sizeof(data58
), mimeAppOctetStream
},
583 {data59
, sizeof(data59
), mimeAppXZip
},
584 {data60
, sizeof(data60
), mimeTextPlain
},
585 {data61
, sizeof(data61
), mimeTextHtml
, mimeAppXZip
/* IE8 */},
586 {data62
, sizeof(data62
), mimeAppJava
},
587 {data63
, sizeof(data63
), mimeTextPlain
},
588 {data64
, sizeof(data64
), mimeTextHtml
, mimeAppJava
/* IE8 */},
589 {data65
, sizeof(data65
), mimeAppPdf
},
590 {data66
, sizeof(data66
), mimeTextPlain
},
591 {data67
, sizeof(data67
), mimeTextHtml
, mimeAppPdf
/* IE8 */},
592 {data68
, sizeof(data68
), mimeAppXMSDownload
},
593 {data69
, sizeof(data69
), mimeTextPlain
},
594 {data70
, sizeof(data70
), mimeTextHtml
, mimeAppXMSDownload
/* IE8 */},
595 {data71
, sizeof(data71
), mimeTextRichtext
},
596 {data72
, sizeof(data72
), mimeTextPlain
},
597 {data73
, sizeof(data73
), mimeTextPlain
},
598 {data74
, sizeof(data74
), mimeTextHtml
, mimeTextRichtext
/* IE8 */},
599 {data75
, sizeof(data75
), mimeAudioWav
},
600 {data76
, sizeof(data76
), mimeTextPlain
},
601 {data77
, sizeof(data77
), mimeTextPlain
},
602 {data78
, sizeof(data78
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
603 {data79
, sizeof(data79
), mimeAppPostscript
},
604 {data80
, sizeof(data80
), mimeTextPlain
},
605 {data81
, sizeof(data81
), mimeTextHtml
, mimeAppPostscript
/* IE8 */},
606 {data82
, sizeof(data82
), mimeAudioBasic
},
607 {data83
, sizeof(data83
), mimeTextPlain
},
608 {data84
, sizeof(data84
), mimeTextHtml
, mimeAudioBasic
/* IE8 */},
609 {data85
, sizeof(data85
), mimeTextPlain
}
612 static void test_FindMimeFromData(void)
618 for(i
=0; i
<sizeof(mime_tests
)/sizeof(mime_tests
[0]); i
++) {
619 mime
= (LPWSTR
)0xf0f0f0f0;
620 hres
= FindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, NULL
, 0, &mime
, 0);
621 if(mime_tests
[i
].mime
) {
622 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
623 ok(!lstrcmpW(mime
, mime_tests
[i
].mime
), "[%d] wrong mime\n", i
);
626 ok(hres
== E_FAIL
|| hres
== mime_tests
[i
].hres
,
627 "[%d] FindMimeFromData failed: %08x, expected %08x\n",
628 i
, hres
, mime_tests
[i
].hres
);
629 ok(mime
== (LPWSTR
)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i
);
632 mime
= (LPWSTR
)0xf0f0f0f0;
633 hres
= FindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, mimeTextPlain
, 0, &mime
, 0);
634 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
635 ok(!lstrcmpW(mime
, mimeTextPlain
), "[%d] wrong mime\n", i
);
638 mime
= (LPWSTR
)0xf0f0f0f0;
639 hres
= FindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, mimeAppOctetStream
, 0, &mime
, 0);
640 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
641 ok(!lstrcmpW(mime
, mimeAppOctetStream
), "[%d] wrong mime\n", i
);
645 for(i
=0; i
< sizeof(mime_tests2
)/sizeof(mime_tests2
[0]); i
++) {
646 hres
= FindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
648 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
649 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
652 hres
= FindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
653 mimeTextHtml
, 0, &mime
, 0);
654 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
655 if(!lstrcmpW(mimeAppOctetStream
, mime_tests2
[i
].mime
)
656 || !lstrcmpW(mimeTextPlain
, mime_tests2
[i
].mime
))
657 ok(!lstrcmpW(mime
, mimeTextHtml
), "[%d] wrong mime\n", i
);
659 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
), "[%d] wrong mime\n", i
);
662 hres
= FindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
663 mimeImagePjpeg
, 0, &mime
, 0);
664 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
665 if(!lstrcmpW(mimeAppOctetStream
, mime_tests2
[i
].mime
) || i
== 17)
666 ok(!lstrcmpW(mime
, mimeImagePjpeg
), "[%d] wrong mime\n", i
);
668 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
) ||
669 (mime_tests2
[i
].mime_alt
&& !lstrcmpW(mime
, mime_tests2
[i
].mime_alt
)),
670 "[%d] wrong mime, got %s\n", i
, wine_dbgstr_w(mime
));
675 hres
= FindMimeFromData(NULL
, url1
, data1
, sizeof(data1
), NULL
, 0, &mime
, 0);
676 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
677 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime\n");
680 hres
= FindMimeFromData(NULL
, url1
, 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");
685 hres
= FindMimeFromData(NULL
, url4
, data1
, sizeof(data1
), mimeAppOctetStream
, 0, &mime
, 0);
686 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
687 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime\n");
690 hres
= FindMimeFromData(NULL
, NULL
, NULL
, 0, NULL
, 0, &mime
, 0);
691 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, excepted E_INVALIDARG\n", hres
);
693 hres
= FindMimeFromData(NULL
, NULL
, NULL
, 0, mimeTextPlain
, 0, &mime
, 0);
694 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres
);
696 hres
= FindMimeFromData(NULL
, NULL
, data1
, 0, NULL
, 0, &mime
, 0);
697 ok(hres
== E_FAIL
, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres
);
699 hres
= FindMimeFromData(NULL
, url1
, data1
, 0, NULL
, 0, &mime
, 0);
700 ok(hres
== E_FAIL
, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres
);
702 hres
= FindMimeFromData(NULL
, NULL
, data1
, 0, mimeTextPlain
, 0, &mime
, 0);
703 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
704 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime\n");
707 hres
= FindMimeFromData(NULL
, NULL
, data1
, 0, mimeTextPlain
, 0, NULL
, 0);
708 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres
);
711 static void register_protocols(void)
713 IInternetSession
*session
;
714 IClassFactory
*factory
;
717 static const WCHAR wszAbout
[] = {'a','b','o','u','t',0};
719 hres
= CoInternetGetSession(0, &session
, 0);
720 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
724 hres
= CoGetClassObject(&CLSID_AboutProtocol
, CLSCTX_INPROC_SERVER
, NULL
,
725 &IID_IClassFactory
, (void**)&factory
);
726 ok(hres
== S_OK
, "Coud not get AboutProtocol factory: %08x\n", hres
);
730 IInternetSession_RegisterNameSpace(session
, factory
, &CLSID_AboutProtocol
,
731 wszAbout
, 0, NULL
, 0);
732 IClassFactory_Release(factory
);
734 IInternetSession_Release(session
);
737 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
738 REFIID riid
, void **ppv
)
740 ok(0, "unexpected call\n");
741 return E_NOINTERFACE
;
744 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
749 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
754 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
755 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
756 DWORD
*pcchResult
, DWORD dwReserved
)
758 CHECK_EXPECT(ParseUrl
);
762 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
763 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
764 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
766 ok(0, "unexpected call\n");
770 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
771 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
773 ok(0, "unexpected call\n");
777 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
778 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
779 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
781 ok(0, "unexpected call\n");
785 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
786 InternetProtocolInfo_QueryInterface
,
787 InternetProtocolInfo_AddRef
,
788 InternetProtocolInfo_Release
,
789 InternetProtocolInfo_ParseUrl
,
790 InternetProtocolInfo_CombineUrl
,
791 InternetProtocolInfo_CompareUrl
,
792 InternetProtocolInfo_QueryInfo
795 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
797 static HRESULT qiret
;
798 static IClassFactory
*expect_cf
;
800 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
802 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
803 CHECK_EXPECT(QI_IInternetProtocolInfo
);
804 ok(iface
== expect_cf
, "unexpected iface\n");
805 *ppv
= &protocol_info
;
809 ok(0, "unexpected call\n");
810 return E_NOINTERFACE
;
813 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
818 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
823 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
824 REFIID riid
, void **ppv
)
826 ok(0, "unexpected call\n");
830 static HRESULT WINAPI
ProtocolCF_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
831 REFIID riid
, void **ppv
)
833 CHECK_EXPECT(CreateInstance
);
835 ok(iface
== expect_cf
, "unexpected iface\n");
836 ok(pOuter
== NULL
, "pOuter = %p\n", pOuter
);
837 ok(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
), "unexpected riid\n");
838 ok(ppv
!= NULL
, "ppv == NULL\n");
840 *ppv
= &protocol_info
;
844 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
846 ok(0, "unexpected call\n");
850 static const IClassFactoryVtbl ClassFactoryVtbl
= {
851 ClassFactory_QueryInterface
,
853 ClassFactory_Release
,
854 ClassFactory_CreateInstance
,
855 ClassFactory_LockServer
858 static const IClassFactoryVtbl ProtocolCFVtbl
= {
859 ClassFactory_QueryInterface
,
861 ClassFactory_Release
,
862 ProtocolCF_CreateInstance
,
863 ClassFactory_LockServer
866 static IClassFactory test_protocol_cf
= { &ProtocolCFVtbl
};
867 static IClassFactory test_protocol_cf2
= { &ProtocolCFVtbl
};
868 static IClassFactory test_cf
= { &ClassFactoryVtbl
};
870 static void test_NameSpace(void)
872 IInternetSession
*session
;
877 static const WCHAR wszTest
[] = {'t','e','s','t',0};
879 hres
= CoInternetGetSession(0, &session
, 0);
880 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
884 hres
= IInternetSession_RegisterNameSpace(session
, NULL
, &IID_NULL
,
885 wszTest
, 0, NULL
, 0);
886 ok(hres
== E_INVALIDARG
, "RegisterNameSpace failed: %08x\n", hres
);
888 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
890 ok(hres
== E_INVALIDARG
, "RegisterNameSpace failed: %08x\n", hres
);
892 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
893 wszTest
, 0, NULL
, 0);
894 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
896 qiret
= E_NOINTERFACE
;
897 expect_cf
= &test_protocol_cf
;
898 SET_EXPECT(QI_IInternetProtocolInfo
);
899 SET_EXPECT(CreateInstance
);
900 SET_EXPECT(ParseUrl
);
902 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
904 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
906 CHECK_CALLED(QI_IInternetProtocolInfo
);
907 CHECK_CALLED(CreateInstance
);
908 CHECK_CALLED(ParseUrl
);
911 SET_EXPECT(QI_IInternetProtocolInfo
);
912 SET_EXPECT(ParseUrl
);
914 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
916 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
918 CHECK_CALLED(QI_IInternetProtocolInfo
);
919 CHECK_CALLED(ParseUrl
);
921 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
922 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
924 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
926 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
928 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf2
, &IID_NULL
,
929 wszTest
, 0, NULL
, 0);
930 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
932 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
933 wszTest
, 0, NULL
, 0);
934 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
936 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
937 wszTest
, 0, NULL
, 0);
938 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
940 SET_EXPECT(QI_IInternetProtocolInfo
);
941 SET_EXPECT(ParseUrl
);
943 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
945 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
947 CHECK_CALLED(QI_IInternetProtocolInfo
);
948 CHECK_CALLED(ParseUrl
);
950 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
951 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
953 SET_EXPECT(QI_IInternetProtocolInfo
);
954 SET_EXPECT(ParseUrl
);
956 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
958 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
960 CHECK_CALLED(QI_IInternetProtocolInfo
);
961 CHECK_CALLED(ParseUrl
);
963 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
964 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
966 expect_cf
= &test_protocol_cf2
;
967 SET_EXPECT(QI_IInternetProtocolInfo
);
968 SET_EXPECT(ParseUrl
);
970 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
972 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
974 CHECK_CALLED(QI_IInternetProtocolInfo
);
975 CHECK_CALLED(ParseUrl
);
977 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
978 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
979 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
980 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
981 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, NULL
);
982 ok(hres
== E_INVALIDARG
, "UnregisterNameSpace failed: %08x\n", hres
);
983 hres
= IInternetSession_UnregisterNameSpace(session
, NULL
, wszTest
);
984 ok(hres
== E_INVALIDARG
, "UnregisterNameSpace failed: %08x\n", hres
);
986 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf2
, wszTest
);
987 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
989 hres
= CoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
991 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
993 IInternetSession_Release(session
);
996 static void test_MimeFilter(void)
998 IInternetSession
*session
;
1001 static const WCHAR mimeW
[] = {'t','e','s','t','/','m','i','m','e',0};
1003 hres
= CoInternetGetSession(0, &session
, 0);
1004 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
1008 hres
= IInternetSession_RegisterMimeFilter(session
, &test_cf
, &IID_NULL
, mimeW
);
1009 ok(hres
== S_OK
, "RegisterMimeFilter failed: %08x\n", hres
);
1011 hres
= IInternetSession_UnregisterMimeFilter(session
, &test_cf
, mimeW
);
1012 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1014 hres
= IInternetSession_UnregisterMimeFilter(session
, &test_cf
, mimeW
);
1015 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1017 hres
= IInternetSession_UnregisterMimeFilter(session
, (void*)0xdeadbeef, mimeW
);
1018 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1020 IInternetSession_Release(session
);
1023 static ULONG WINAPI
unk_Release(IUnknown
*iface
)
1025 CHECK_EXPECT(unk_Release
);
1029 static const IUnknownVtbl unk_vtbl
= {
1035 static void test_ReleaseBindInfo(void)
1038 IUnknown unk
= { &unk_vtbl
};
1040 ReleaseBindInfo(NULL
); /* shouldn't crash */
1042 memset(&bi
, 0, sizeof(bi
));
1043 bi
.cbSize
= sizeof(BINDINFO
);
1045 SET_EXPECT(unk_Release
);
1046 ReleaseBindInfo(&bi
);
1047 ok(bi
.cbSize
== sizeof(BINDINFO
), "bi.cbSize=%d\n", bi
.cbSize
);
1048 ok(bi
.pUnk
== NULL
, "bi.pUnk=%p, expected NULL\n", bi
.pUnk
);
1049 CHECK_CALLED(unk_Release
);
1051 memset(&bi
, 0, sizeof(bi
));
1052 bi
.cbSize
= offsetof(BINDINFO
, pUnk
);
1054 ReleaseBindInfo(&bi
);
1055 ok(bi
.cbSize
== offsetof(BINDINFO
, pUnk
), "bi.cbSize=%d\n", bi
.cbSize
);
1056 ok(bi
.pUnk
== &unk
, "bi.pUnk=%p, expected %p\n", bi
.pUnk
, &unk
);
1058 memset(&bi
, 0, sizeof(bi
));
1060 ReleaseBindInfo(&bi
);
1061 ok(!bi
.cbSize
, "bi.cbSize=%d, expected 0\n", bi
.cbSize
);
1062 ok(bi
.pUnk
== &unk
, "bi.pUnk=%p, expected %p\n", bi
.pUnk
, &unk
);
1065 static void test_CopyStgMedium(void)
1071 static WCHAR fileW
[] = {'f','i','l','e',0};
1073 memset(&src
, 0xf0, sizeof(src
));
1074 memset(&dst
, 0xe0, sizeof(dst
));
1075 memset(&empty
, 0xf0, sizeof(empty
));
1076 src
.tymed
= TYMED_NULL
;
1077 src
.pUnkForRelease
= NULL
;
1078 hres
= CopyStgMedium(&src
, &dst
);
1079 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1080 ok(dst
.tymed
== TYMED_NULL
, "tymed=%d\n", dst
.tymed
);
1081 ok(dst
.u
.hGlobal
== empty
, "u=%p\n", dst
.u
.hGlobal
);
1082 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1084 memset(&dst
, 0xe0, sizeof(dst
));
1085 src
.tymed
= TYMED_ISTREAM
;
1087 src
.pUnkForRelease
= NULL
;
1088 hres
= CopyStgMedium(&src
, &dst
);
1089 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1090 ok(dst
.tymed
== TYMED_ISTREAM
, "tymed=%d\n", dst
.tymed
);
1091 ok(!dst
.u
.pstm
, "pstm=%p\n", dst
.u
.pstm
);
1092 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1094 memset(&dst
, 0xe0, sizeof(dst
));
1095 src
.tymed
= TYMED_FILE
;
1096 src
.u
.lpszFileName
= fileW
;
1097 src
.pUnkForRelease
= NULL
;
1098 hres
= CopyStgMedium(&src
, &dst
);
1099 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1100 ok(dst
.tymed
== TYMED_FILE
, "tymed=%d\n", dst
.tymed
);
1101 ok(dst
.u
.lpszFileName
&& dst
.u
.lpszFileName
!= fileW
, "lpszFileName=%p\n", dst
.u
.lpszFileName
);
1102 ok(!lstrcmpW(dst
.u
.lpszFileName
, fileW
), "wrong file name\n");
1103 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1105 hres
= CopyStgMedium(&src
, NULL
);
1106 ok(hres
== E_POINTER
, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres
);
1107 hres
= CopyStgMedium(NULL
, &dst
);
1108 ok(hres
== E_POINTER
, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres
);
1111 static void test_UrlMkGetSessionOption(void)
1113 DWORD encoding
, size
;
1116 size
= encoding
= 0xdeadbeef;
1117 hres
= UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1118 sizeof(encoding
), &size
, 0);
1119 ok(hres
== S_OK
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1120 ok(encoding
!= 0xdeadbeef, "encoding not changed\n");
1121 ok(size
== sizeof(encoding
), "size=%d\n", size
);
1123 size
= encoding
= 0xdeadbeef;
1124 hres
= UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1125 sizeof(encoding
)+1, &size
, 0);
1126 ok(hres
== S_OK
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1127 ok(encoding
!= 0xdeadbeef, "encoding not changed\n");
1128 ok(size
== sizeof(encoding
), "size=%d\n", size
);
1130 size
= encoding
= 0xdeadbeef;
1131 hres
= UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1132 sizeof(encoding
)-1, &size
, 0);
1133 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1134 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1135 ok(size
== 0xdeadbeef, "size=%d\n", size
);
1137 size
= encoding
= 0xdeadbeef;
1138 hres
= UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, NULL
,
1139 sizeof(encoding
)-1, &size
, 0);
1140 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1141 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1142 ok(size
== 0xdeadbeef, "size=%d\n", size
);
1144 encoding
= 0xdeadbeef;
1145 hres
= UrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1146 sizeof(encoding
)-1, NULL
, 0);
1147 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1148 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1151 static void test_user_agent(void)
1153 static const CHAR expected
[] = "Mozilla/4.0 (compatible; MSIE ";
1154 static char test_str
[] = "test";
1155 static char test2_str
[] = "test\0test";
1161 hres
= ObtainUserAgentString(0, NULL
, NULL
);
1162 ok(hres
== E_INVALIDARG
, "ObtainUserAgentString failed: %08x\n", hres
);
1165 hres
= ObtainUserAgentString(0, NULL
, &size
);
1166 ok(hres
== E_INVALIDARG
, "ObtainUserAgentString failed: %08x\n", hres
);
1167 ok(size
== 100, "size=%d, expected %d\n", size
, 100);
1170 hres
= ObtainUserAgentString(0, str
, &size
);
1171 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1172 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1176 hres
= ObtainUserAgentString(0, str
, &size
);
1177 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1178 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1179 ok(str
[0] == 'a', "str[0]=%c, expected 'a'\n", str
[0]);
1182 hres
= ObtainUserAgentString(1, str
, &size
);
1183 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1184 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1186 str2
= HeapAlloc(GetProcessHeap(), 0, (size
+20)*sizeof(CHAR
));
1188 hres
= ObtainUserAgentString(0, str2
, &size
);
1189 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
1190 ok(size
== saved
, "size=%d, expected %d\n", size
, saved
);
1191 ok(strlen(expected
) <= strlen(str2
) &&
1192 !memcmp(expected
, str2
, strlen(expected
)*sizeof(CHAR
)),
1193 "user agent was \"%s\", expected to start with \"%s\"\n",
1197 hres
= ObtainUserAgentString(0, str2
, &size
);
1198 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
1199 ok(size
== saved
, "size=%d, expected %d\n", size
, saved
);
1202 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 0, &size
, 0);
1203 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1204 ok(size
, "size == 0\n");
1207 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 1000, &size
, 0);
1208 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1209 ok(size
, "size == 0\n");
1213 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
+10, &size
, 0);
1214 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1215 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1216 ok(sizeof(expected
) <= strlen(str2
) && !memcmp(expected
, str2
, sizeof(expected
)-1),
1217 "user agent was \"%s\", expected to start with \"%s\"\n",
1222 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1223 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1224 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1225 ok(sizeof(expected
) <= strlen(str2
) && !memcmp(expected
, str2
, sizeof(expected
)-1),
1226 "user agent was \"%s\", expected to start with \"%s\"\n",
1231 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
-1, &size
, 0);
1232 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1233 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1234 ok(!str2
[0], "buf changed\n");
1238 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, NULL
, 0);
1239 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1240 ok(!str2
[0], "buf changed\n");
1242 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, sizeof(test_str
), 0);
1243 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1247 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1248 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1249 ok(size
== sizeof(test_str
) && !memcmp(str2
, test_str
, sizeof(test_str
)), "wrong user agent\n");
1251 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test2_str
, sizeof(test2_str
), 0);
1252 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1256 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1257 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1258 ok(size
== sizeof(test_str
) && !memcmp(str2
, test_str
, sizeof(test_str
)), "wrong user agent\n");
1260 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, 2, 0);
1261 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1265 hres
= UrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1266 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1267 ok(size
== 3 && !strcmp(str2
, "te"), "wrong user agent\n");
1269 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, 0, 0);
1270 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1272 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, sizeof(test_str
), 0);
1273 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1275 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 0, 0);
1276 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1278 HeapFree(GetProcessHeap(), 0, str2
);
1281 static void test_MkParseDisplayNameEx(void)
1283 IMoniker
*mon
= NULL
;
1290 static const WCHAR clsid_nameW
[] = {'c','l','s','i','d',':',
1291 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
1292 '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
1294 CreateBindCtx(0, &bctx
);
1296 hres
= MkParseDisplayNameEx(bctx
, url9
, &eaten
, &mon
);
1297 ok(hres
== S_OK
, "MkParseDisplayNameEx failed: %08x\n", hres
);
1298 ok(eaten
== sizeof(url9
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
1299 ok(mon
!= NULL
, "mon == NULL\n");
1301 hres
= IMoniker_GetDisplayName(mon
, NULL
, 0, &name
);
1302 ok(hres
== S_OK
, "GetDiasplayName failed: %08x\n", hres
);
1303 ok(!lstrcmpW(name
, url9
), "wrong display name %s\n", wine_dbgstr_w(name
));
1304 CoTaskMemFree(name
);
1306 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
1307 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
1308 ok(issys
== MKSYS_URLMONIKER
, "issys=%x\n", issys
);
1310 IMoniker_Release(mon
);
1312 hres
= MkParseDisplayNameEx(bctx
, clsid_nameW
, &eaten
, &mon
);
1313 ok(hres
== S_OK
, "MkParseDisplayNameEx failed: %08x\n", hres
);
1314 ok(eaten
== sizeof(clsid_nameW
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
1315 ok(mon
!= NULL
, "mon == NULL\n");
1317 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
1318 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
1319 ok(issys
== MKSYS_CLASSMONIKER
, "issys=%x\n", issys
);
1321 IMoniker_Release(mon
);
1323 hres
= MkParseDisplayNameEx(bctx
, url8
, &eaten
, &mon
);
1324 ok(FAILED(hres
), "MkParseDisplayNameEx succeeded: %08x\n", hres
);
1326 IBindCtx_Release(bctx
);
1329 static void test_IsValidURL(void)
1333 hr
= IsValidURL(NULL
, 0, 0);
1334 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %08x\n", hr
);
1339 OleInitialize(NULL
);
1341 register_protocols();
1343 test_CreateFormatEnum();
1344 test_RegisterFormatEnumerator();
1345 test_CoInternetParseUrl();
1346 test_CoInternetCompareUrl();
1347 test_CoInternetQueryInfo();
1348 test_FindMimeFromData();
1351 test_ReleaseBindInfo();
1352 test_CopyStgMedium();
1353 test_UrlMkGetSessionOption();
1355 test_MkParseDisplayNameEx();