2 * Copyright 2005-2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define NONAMELESSUNION
23 #include <wine/test.h>
34 DEFINE_GUID(CLSID_AboutProtocol
, 0x3050F406, 0x98B5, 0x11CF, 0xBB,0x82, 0x00,0xAA,0x00,0xBD,0xCE,0x0B);
36 #define DEFINE_EXPECT(func) \
37 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
39 #define SET_EXPECT(func) \
40 expect_ ## func = TRUE
42 #define CHECK_EXPECT(func) \
44 ok(expect_ ##func, "unexpected call " #func "\n"); \
45 expect_ ## func = FALSE; \
46 called_ ## func = TRUE; \
49 #define CHECK_EXPECT2(func) \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 called_ ## func = TRUE; \
55 #define CHECK_CALLED(func) \
57 ok(called_ ## func, "expected " #func "\n"); \
58 expect_ ## func = called_ ## func = FALSE; \
61 DEFINE_EXPECT(ParseUrl
);
62 DEFINE_EXPECT(QI_IInternetProtocolInfo
);
63 DEFINE_EXPECT(CreateInstance
);
64 DEFINE_EXPECT(unk_Release
);
66 static HRESULT (WINAPI
*pCoInternetCompareUrl
)(LPCWSTR
, LPCWSTR
, DWORD
);
67 static HRESULT (WINAPI
*pCoInternetGetSecurityUrl
)(LPCWSTR
, LPWSTR
*, PSUACTION
, DWORD
);
68 static HRESULT (WINAPI
*pCoInternetGetSession
)(DWORD
, IInternetSession
**, DWORD
);
69 static HRESULT (WINAPI
*pCoInternetParseUrl
)(LPCWSTR
, PARSEACTION
, DWORD
, LPWSTR
, DWORD
, DWORD
*, DWORD
);
70 static HRESULT (WINAPI
*pCoInternetQueryInfo
)(LPCWSTR
, QUERYOPTION
, DWORD
, LPVOID
, DWORD
, DWORD
*, DWORD
);
71 static HRESULT (WINAPI
*pCopyStgMedium
)(const STGMEDIUM
*, STGMEDIUM
*);
72 static HRESULT (WINAPI
*pFindMimeFromData
)(LPBC
, LPCWSTR
, LPVOID
, DWORD
, LPCWSTR
,
73 DWORD
, LPWSTR
*, DWORD
);
74 static HRESULT (WINAPI
*pObtainUserAgentString
)(DWORD
, LPSTR
, DWORD
*);
75 static HRESULT (WINAPI
*pReleaseBindInfo
)(BINDINFO
*);
76 static HRESULT (WINAPI
*pUrlMkGetSessionOption
)(DWORD
, LPVOID
, DWORD
, DWORD
*, DWORD
);
77 static HRESULT (WINAPI
*pCompareSecurityIds
)(BYTE
*,DWORD
,BYTE
*,DWORD
,DWORD
);
78 static HRESULT (WINAPI
*pCoInternetIsFeatureEnabled
)(INTERNETFEATURELIST
,DWORD
);
79 static HRESULT (WINAPI
*pCoInternetSetFeatureEnabled
)(INTERNETFEATURELIST
,DWORD
,BOOL
);
80 static HRESULT (WINAPI
*pIEInstallScope
)(DWORD
*);
82 static void test_CreateFormatEnum(void)
84 IEnumFORMATETC
*fenum
= NULL
, *fenum2
= NULL
;
89 static DVTARGETDEVICE dev
= {sizeof(dev
),0,0,0,0,{0}};
90 static FORMATETC formatetc
[] = {
98 hres
= CreateFormatEnumerator(0, formatetc
, &fenum
);
99 ok(hres
== E_FAIL
, "CreateFormatEnumerator failed: %08x, expected E_FAIL\n", hres
);
100 hres
= CreateFormatEnumerator(0, formatetc
, NULL
);
101 ok(hres
== E_INVALIDARG
, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
102 hres
= CreateFormatEnumerator(5, formatetc
, NULL
);
103 ok(hres
== E_INVALIDARG
, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
106 hres
= CreateFormatEnumerator(5, formatetc
, &fenum
);
107 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
111 hres
= IEnumFORMATETC_Next(fenum
, 2, NULL
, &ul
);
112 ok(hres
== E_INVALIDARG
, "Next failed: %08x, expected E_INVALIDARG\n", hres
);
114 hres
= IEnumFORMATETC_Next(fenum
, 0, fetc
, &ul
);
115 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
116 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
118 hres
= IEnumFORMATETC_Next(fenum
, 2, fetc
, &ul
);
119 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
120 ok(fetc
[0].lindex
== 0, "fetc[0].lindex=%d, expected 0\n", fetc
[0].lindex
);
121 ok(fetc
[1].lindex
== 1, "fetc[1].lindex=%d, expected 1\n", fetc
[1].lindex
);
122 ok(fetc
[0].ptd
== &dev
, "fetc[0].ptd=%p, expected %p\n", fetc
[0].ptd
, &dev
);
123 ok(ul
== 2, "ul=%d, expected 2\n", ul
);
125 hres
= IEnumFORMATETC_Skip(fenum
, 1);
126 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
128 hres
= IEnumFORMATETC_Next(fenum
, 4, fetc
, &ul
);
129 ok(hres
== S_FALSE
, "Next failed: %08x, expected S_FALSE\n", hres
);
130 ok(fetc
[0].lindex
== 3, "fetc[0].lindex=%d, expected 3\n", fetc
[0].lindex
);
131 ok(fetc
[1].lindex
== 4, "fetc[1].lindex=%d, expected 4\n", fetc
[1].lindex
);
132 ok(fetc
[0].ptd
== NULL
, "fetc[0].ptd=%p, expected NULL\n", fetc
[0].ptd
);
133 ok(ul
== 2, "ul=%d, expected 2\n", ul
);
135 hres
= IEnumFORMATETC_Next(fenum
, 4, fetc
, &ul
);
136 ok(hres
== S_FALSE
, "Next failed: %08x, expected S_FALSE\n", hres
);
137 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
139 hres
= IEnumFORMATETC_Next(fenum
, 0, fetc
, &ul
);
140 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
141 ok(ul
== 0, "ul=%d, expected 0\n", ul
);
143 hres
= IEnumFORMATETC_Skip(fenum
, 3);
144 ok(hres
== S_FALSE
, "Skip failed: %08x, expected S_FALSE\n", hres
);
146 hres
= IEnumFORMATETC_Reset(fenum
);
147 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
149 hres
= IEnumFORMATETC_Next(fenum
, 5, fetc
, NULL
);
150 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
151 ok(fetc
[0].lindex
== 0, "fetc[0].lindex=%d, expected 0\n", fetc
[0].lindex
);
153 hres
= IEnumFORMATETC_Reset(fenum
);
154 ok(hres
== S_OK
, "Reset failed: %08x\n", hres
);
156 hres
= IEnumFORMATETC_Skip(fenum
, 2);
157 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
159 hres
= IEnumFORMATETC_Clone(fenum
, NULL
);
160 ok(hres
== E_INVALIDARG
, "Clone failed: %08x, expected E_INVALIDARG\n", hres
);
162 hres
= IEnumFORMATETC_Clone(fenum
, &fenum2
);
163 ok(hres
== S_OK
, "Clone failed: %08x\n", hres
);
165 if(SUCCEEDED(hres
)) {
166 ok(fenum
!= fenum2
, "fenum == fenum2\n");
168 hres
= IEnumFORMATETC_Next(fenum2
, 2, fetc
, &ul
);
169 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
170 ok(fetc
[0].lindex
== 2, "fetc[0].lindex=%d, expected 2\n", fetc
[0].lindex
);
172 IEnumFORMATETC_Release(fenum2
);
175 hres
= IEnumFORMATETC_Next(fenum
, 2, fetc
, &ul
);
176 ok(hres
== S_OK
, "Next failed: %08x\n", hres
);
177 ok(fetc
[0].lindex
== 2, "fetc[0].lindex=%d, expected 2\n", fetc
[0].lindex
);
179 hres
= IEnumFORMATETC_Skip(fenum
, 1);
180 ok(hres
== S_OK
, "Skip failed: %08x\n", hres
);
182 IEnumFORMATETC_Release(fenum
);
185 static void test_RegisterFormatEnumerator(void)
187 IBindCtx
*bctx
= NULL
;
188 IEnumFORMATETC
*format
= NULL
, *format2
= NULL
;
189 IUnknown
*unk
= NULL
;
192 static FORMATETC formatetc
= {0,NULL
,0,0,0};
193 static WCHAR wszEnumFORMATETC
[] =
194 {'_','E','n','u','m','F','O','R','M','A','T','E','T','C','_',0};
196 CreateBindCtx(0, &bctx
);
198 hres
= CreateFormatEnumerator(1, &formatetc
, &format
);
199 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
203 hres
= RegisterFormatEnumerator(NULL
, format
, 0);
204 ok(hres
== E_INVALIDARG
,
205 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
206 hres
= RegisterFormatEnumerator(bctx
, NULL
, 0);
207 ok(hres
== E_INVALIDARG
,
208 "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
210 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
211 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
213 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
214 ok(hres
== S_OK
, "GetObjectParam failed: %08x\n", hres
);
215 ok(unk
== (IUnknown
*)format
, "unk != format\n");
217 hres
= RevokeFormatEnumerator(NULL
, format
);
218 ok(hres
== E_INVALIDARG
,
219 "RevokeFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres
);
221 hres
= RevokeFormatEnumerator(bctx
, format
);
222 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
224 hres
= RevokeFormatEnumerator(bctx
, format
);
225 ok(hres
== E_FAIL
, "RevokeFormatEnumerator failed: %08x, expected E_FAIL\n", hres
);
227 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
228 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
230 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
231 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
233 hres
= CreateFormatEnumerator(1, &formatetc
, &format2
);
234 ok(hres
== S_OK
, "CreateFormatEnumerator failed: %08x\n", hres
);
236 if(SUCCEEDED(hres
)) {
237 hres
= RevokeFormatEnumerator(bctx
, format
);
238 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
240 IEnumFORMATETC_Release(format2
);
243 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
244 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
246 IEnumFORMATETC_Release(format
);
248 hres
= RegisterFormatEnumerator(bctx
, format
, 0);
249 ok(hres
== S_OK
, "RegisterFormatEnumerator failed: %08x\n", hres
);
250 hres
= RevokeFormatEnumerator(bctx
, NULL
);
251 ok(hres
== S_OK
, "RevokeFormatEnumerator failed: %08x\n", hres
);
252 hres
= IBindCtx_GetObjectParam(bctx
, wszEnumFORMATETC
, &unk
);
253 ok(hres
== E_FAIL
, "GetObjectParam failed: %08x, expected E_FAIL\n", hres
);
255 IEnumFORMATETC_Release(format
);
256 IBindCtx_Release(bctx
);
259 static const WCHAR url1
[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
260 '/','b','l','a','n','k','.','h','t','m',0};
261 static const WCHAR url2
[] = {'i','n','d','e','x','.','h','t','m',0};
262 static const WCHAR url3
[] = {'f','i','l','e',':','/','/','c',':','\\','I','n','d','e','x','.','h','t','m',0};
263 static const WCHAR url4
[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
264 '%','2','e','j','p','g',0};
265 static const WCHAR url5
[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
267 static const WCHAR url6
[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
268 static const WCHAR url7
[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
269 'f','i','l','e','.','t','e','s','t',0};
270 static const WCHAR url8
[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
271 static const WCHAR url9
[] =
272 {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
273 '/','s','i','t','e','/','a','b','o','u','t',0};
274 static const WCHAR url10
[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
276 static const WCHAR url11
[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e','.','*','.',
278 static const WCHAR url4e
[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
281 static const WCHAR path3
[] = {'c',':','\\','I','n','d','e','x','.','h','t','m',0};
282 static const WCHAR path4
[] = {'s','o','m','e',' ','f','i','l','e','.','j','p','g',0};
284 static const WCHAR wszRes
[] = {'r','e','s',0};
285 static const WCHAR wszFile
[] = {'f','i','l','e',0};
286 static const WCHAR wszHttp
[] = {'h','t','t','p',0};
287 static const WCHAR wszAbout
[] = {'a','b','o','u','t',0};
288 static const WCHAR wszEmpty
[] = {0};
289 static const WCHAR wszGoogle
[] = {'g','o','o','g','l','e','.','*','.','c','o','m',0};
291 static const WCHAR wszWineHQ
[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
292 static const WCHAR wszHttpWineHQ
[] = {'h','t','t','p',':','/','/','w','w','w','.',
293 'w','i','n','e','h','q','.','o','r','g',0};
294 static const WCHAR wszHttpGoogle
[] = {'h','t','t','p',':','/','/','g','o','o','g','l','e',
295 '.','*','.','c','o','m',0};
306 LPCWSTR rootdocument
;
307 HRESULT rootdocument_hres
;
310 static const struct parse_test parse_tests
[] = {
311 {url1
, S_OK
, url1
, E_INVALIDARG
, NULL
, wszRes
, NULL
, E_FAIL
, NULL
, E_FAIL
},
312 {url2
, E_FAIL
, url2
, E_INVALIDARG
, NULL
, wszEmpty
, NULL
, E_FAIL
, NULL
, E_FAIL
},
313 {url3
, E_FAIL
, url3
, S_OK
, path3
, wszFile
, wszEmpty
, S_OK
, NULL
, E_FAIL
},
314 {url4
, E_FAIL
, url4e
, S_OK
, path4
, wszFile
, wszEmpty
, S_OK
, NULL
, E_FAIL
},
315 {url5
, E_FAIL
, url5
, E_INVALIDARG
, NULL
, wszHttp
, wszWineHQ
, S_OK
, wszHttpWineHQ
, S_OK
},
316 {url6
, S_OK
, url6
, E_INVALIDARG
, NULL
, wszAbout
, NULL
, E_FAIL
, NULL
, E_FAIL
},
317 {url11
, E_FAIL
, url11
, E_INVALIDARG
, NULL
, wszHttp
, wszGoogle
, S_OK
, wszHttpGoogle
, S_OK
}
320 static void test_CoInternetParseUrl(void)
326 static WCHAR buf
[4096];
328 memset(buf
, 0xf0, sizeof(buf
));
329 hres
= pCoInternetParseUrl(parse_tests
[0].url
, PARSE_SCHEMA
, 0, buf
,
331 ok(hres
== E_POINTER
, "schema failed: %08x, expected E_POINTER\n", hres
);
333 for(i
=0; i
< sizeof(parse_tests
)/sizeof(parse_tests
[0]); i
++) {
334 memset(buf
, 0xf0, sizeof(buf
));
335 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_SECURITY_URL
, 0, buf
,
336 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
337 ok(hres
== parse_tests
[i
].secur_hres
, "[%d] security url failed: %08x, expected %08x\n",
338 i
, hres
, parse_tests
[i
].secur_hres
);
340 memset(buf
, 0xf0, sizeof(buf
));
341 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_ENCODE
, 0, buf
,
342 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
343 ok(hres
== S_OK
, "[%d] encoding failed: %08x\n", i
, hres
);
344 ok(size
== lstrlenW(parse_tests
[i
].encoded_url
), "[%d] wrong size\n", i
);
345 ok(!lstrcmpW(parse_tests
[i
].encoded_url
, buf
), "[%d] wrong encoded url\n", i
);
347 memset(buf
, 0xf0, sizeof(buf
));
348 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_PATH_FROM_URL
, 0, buf
,
349 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
350 ok(hres
== parse_tests
[i
].path_hres
, "[%d] path failed: %08x, expected %08x\n",
351 i
, hres
, parse_tests
[i
].path_hres
);
352 if(parse_tests
[i
].path
) {
353 ok(size
== lstrlenW(parse_tests
[i
].path
), "[%d] wrong size\n", i
);
354 ok(!lstrcmpW(parse_tests
[i
].path
, buf
), "[%d] wrong path\n", i
);
357 memset(buf
, 0xf0, sizeof(buf
));
358 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_SCHEMA
, 0, buf
,
359 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
360 ok(hres
== S_OK
, "[%d] schema failed: %08x\n", i
, hres
);
361 ok(size
== lstrlenW(parse_tests
[i
].schema
), "[%d] wrong size\n", i
);
362 ok(!lstrcmpW(parse_tests
[i
].schema
, buf
), "[%d] wrong schema\n", i
);
364 if(memcmp(parse_tests
[i
].url
, wszRes
, 3*sizeof(WCHAR
))
365 && memcmp(parse_tests
[i
].url
, wszAbout
, 5*sizeof(WCHAR
))) {
366 memset(buf
, 0xf0, sizeof(buf
));
367 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_DOMAIN
, 0, buf
,
368 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
369 ok(hres
== parse_tests
[i
].domain_hres
, "[%d] domain failed: %08x\n", i
, hres
);
370 if(parse_tests
[i
].domain
)
371 ok(!lstrcmpW(parse_tests
[i
].domain
, buf
), "[%d] wrong domain, received %s\n", i
, wine_dbgstr_w(buf
));
374 memset(buf
, 0xf0, sizeof(buf
));
375 hres
= pCoInternetParseUrl(parse_tests
[i
].url
, PARSE_ROOTDOCUMENT
, 0, buf
,
376 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
377 ok(hres
== parse_tests
[i
].rootdocument_hres
, "[%d] rootdocument failed: %08x\n", i
, hres
);
378 if(parse_tests
[i
].rootdocument
)
379 ok(!lstrcmpW(parse_tests
[i
].rootdocument
, buf
), "[%d] wrong rootdocument, received %s\n", i
, wine_dbgstr_w(buf
));
383 static void test_CoInternetCompareUrl(void)
387 hres
= pCoInternetCompareUrl(url1
, url1
, 0);
388 ok(hres
== S_OK
, "CoInternetCompareUrl failed: %08x\n", hres
);
390 hres
= pCoInternetCompareUrl(url1
, url3
, 0);
391 ok(hres
== S_FALSE
, "CoInternetCompareUrl failed: %08x\n", hres
);
393 hres
= pCoInternetCompareUrl(url3
, url1
, 0);
394 ok(hres
== S_FALSE
, "CoInternetCompareUrl failed: %08x\n", hres
);
397 static const struct {
400 } query_info_tests
[] = {
411 static void test_CoInternetQueryInfo(void)
417 for(i
=0; i
< sizeof(query_info_tests
)/sizeof(query_info_tests
[0]); i
++) {
419 memset(buf
, '?', sizeof(buf
));
420 hres
= pCoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, sizeof(buf
), &cb
, 0);
421 ok(hres
== S_OK
, "[%d] CoInternetQueryInfo failed: %08x\n", i
, hres
);
422 ok(cb
== sizeof(DWORD
), "[%d] cb = %d\n", i
, cb
);
423 ok(*(DWORD
*)buf
== query_info_tests
[i
].uses_net
, "[%d] ret %x, expected %x\n",
424 i
, *(DWORD
*)buf
, query_info_tests
[i
].uses_net
);
426 hres
= pCoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, 3, &cb
, 0);
427 ok(hres
== E_FAIL
, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i
, hres
);
428 hres
= pCoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, NULL
, sizeof(buf
), &cb
, 0);
429 ok(hres
== E_FAIL
, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i
, hres
);
431 memset(buf
, '?', sizeof(buf
));
432 hres
= pCoInternetQueryInfo(query_info_tests
[0].url
, QUERY_USES_NETWORK
, 0, buf
, sizeof(buf
), NULL
, 0);
433 ok(hres
== S_OK
, "[%d] CoInternetQueryInfo failed: %08x\n", i
, hres
);
434 ok(*(DWORD
*)buf
== query_info_tests
[i
].uses_net
, "[%d] ret %x, expected %x\n",
435 i
, *(DWORD
*)buf
, query_info_tests
[i
].uses_net
);
439 static const WCHAR mimeTextHtml
[] = {'t','e','x','t','/','h','t','m','l',0};
440 static const WCHAR mimeTextPlain
[] = {'t','e','x','t','/','p','l','a','i','n',0};
441 static const WCHAR mimeTextRichtext
[] = {'t','e','x','t','/','r','i','c','h','t','e','x','t',0};
442 static const WCHAR mimeAppOctetStream
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
443 'o','c','t','e','t','-','s','t','r','e','a','m',0};
444 static const WCHAR mimeImagePjpeg
[] = {'i','m','a','g','e','/','p','j','p','e','g',0};
445 static const WCHAR mimeImageGif
[] = {'i','m','a','g','e','/','g','i','f',0};
446 static const WCHAR mimeImageBmp
[] = {'i','m','a','g','e','/','b','m','p',0};
447 static const WCHAR mimeImageXPng
[] = {'i','m','a','g','e','/','x','-','p','n','g',0};
448 static const WCHAR mimeImageTiff
[] = {'i','m','a','g','e','/','t','i','f','f',0};
449 static const WCHAR mimeVideoAvi
[] = {'v','i','d','e','o','/','a','v','i',0};
450 static const WCHAR mimeVideoMpeg
[] = {'v','i','d','e','o','/','m','p','e','g',0};
451 static const WCHAR mimeAppPostscript
[] =
452 {'a','p','p','l','i','c','a','t','i','o','n','/','p','o','s','t','s','c','r','i','p','t',0};
453 static const WCHAR mimeAppXCompressed
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
454 'x','-','c','o','m','p','r','e','s','s','e','d',0};
455 static const WCHAR mimeAppXZip
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
456 'x','-','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
457 static const WCHAR mimeAppXGzip
[] = {'a','p','p','l','i','c','a','t','i','o','n','/',
458 'x','-','g','z','i','p','-','c','o','m','p','r','e','s','s','e','d',0};
459 static const WCHAR mimeAppJava
[] = {'a','p','p','l','i','c','a','t','i','o','n','/','j','a','v','a',0};
460 static const WCHAR mimeAppPdf
[] = {'a','p','p','l','i','c','a','t','i','o','n','/','p','d','f',0};
461 static const WCHAR mimeAppXMSDownload
[] =
462 {'a','p','p','l','i','c','a','t','i','o','n','/','x','-','m','s','d','o','w','n','l','o','a','d',0};
463 static const WCHAR mimeAudioWav
[] = {'a','u','d','i','o','/','w','a','v',0};
464 static const WCHAR mimeAudioBasic
[] = {'a','u','d','i','o','/','b','a','s','i','c',0};
466 static const struct {
471 {url1
, mimeTextHtml
, S_OK
},
472 {url2
, mimeTextHtml
, S_OK
},
473 {url3
, mimeTextHtml
, S_OK
},
474 {url4
, NULL
, E_FAIL
},
475 {url5
, NULL
, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
)},
476 {url6
, NULL
, E_FAIL
},
477 {url7
, NULL
, __HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND
)}
480 static BYTE data1
[] = "test data\n";
481 static BYTE data2
[] = {31,'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0};
482 static BYTE data3
[] = {0,0,0};
483 static BYTE data4
[] = {'t','e','s',0xfa,'t',' ','d','a','t','a','\n',0,0};
484 static BYTE data5
[] = {0xa,0xa,0xa,'x',32,'x',0};
485 static BYTE data6
[] = {0xfa,0xfa,0xfa,0xfa,'\n','\r','\t','x','x','x',1};
486 static BYTE data7
[] = "<html>blahblah";
487 static BYTE data8
[] = {'t','e','s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
488 static BYTE data9
[] = {'t','e',0,'s',0xfa,'t',' ','<','h','t','m','l','>','d','a','t','a','\n',0,0};
489 static BYTE data10
[] = "<HtmL>blahblah";
490 static BYTE data11
[] = "blah<HTML>blahblah";
491 static BYTE data12
[] = "blah<HTMLblahblah";
492 static BYTE data13
[] = "blahHTML>blahblah";
493 static BYTE data14
[] = "blah<HTMblahblah";
494 static BYTE data15
[] = {0xff,0xd8};
495 static BYTE data16
[] = {0xff,0xd8,'h'};
496 static BYTE data17
[] = {0,0xff,0xd8};
497 static BYTE data18
[] = {0xff,0xd8,'<','h','t','m','l','>'};
498 static BYTE data19
[] = {'G','I','F','8','7','a'};
499 static BYTE data20
[] = {'G','I','F','8','9','a'};
500 static BYTE data21
[] = {'G','I','F','8','7'};
501 static BYTE data22
[] = {'G','i','F','8','7','a'};
502 static BYTE data23
[] = {'G','i','F','8','8','a'};
503 static BYTE data24
[] = {'g','i','f','8','7','a'};
504 static BYTE data25
[] = {'G','i','F','8','7','A'};
505 static BYTE data26
[] = {'G','i','F','8','7','a','<','h','t','m','l','>'};
506 static BYTE data27
[] = {0x30,'G','i','F','8','7','A'};
507 static BYTE data28
[] = {0x42,0x4d,0x6e,0x42,0x1c,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0x00,0x00};
508 static BYTE data29
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x','x'};
509 static BYTE data30
[] = {0x42,0x4d,'x','x','x','x',0x00,0x01,0x00,0x00,'x','x','x','x'};
510 static BYTE data31
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'<','h','t','m','l','>'};
511 static BYTE data32
[] = {0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
512 static BYTE data33
[] = {0x00,0x42,0x4d,'x','x','x','x',0x00,0x00,0x00,0x00,'x','x','x'};
513 static BYTE data34
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
514 static BYTE data35
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x','x','x','x',0};
515 static BYTE data36
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,'x','x'};
516 static BYTE data37
[] = {0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'<','h','t','m','l','>'};
517 static BYTE data38
[] = {0x00,0x89,'P','N','G',0x0d,0x0a,0x1a,0x0a,'x'};
518 static BYTE data39
[] = {0x4d,0x4d,0x00,0x2a};
519 static BYTE data40
[] = {0x4d,0x4d,0x00,0x2a,'<','h','t','m','l','>',0};
520 static BYTE data41
[] = {0x4d,0x4d,0xff};
521 static BYTE data42
[] = {0x4d,0x4d};
522 static BYTE data43
[] = {0x00,0x4d,0x4d,0x00};
523 static BYTE data44
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
524 static BYTE data45
[] = {'R','I','F','f',0xff,0xff,0xff,0xff,'A','V','I',0x20,0xff};
525 static BYTE data46
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20};
526 static BYTE data47
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x21,0xff};
527 static BYTE data48
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'A','V','I',0x20,'<','h','t','m','l','>'};
528 static BYTE data49
[] = {'R','I','F','F',0x0f,0x0f,0xf0,0xf0,'A','V','I',0x20,0xf0,0x00};
529 static BYTE data50
[] = {0x00,0x00,0x01,0xb3,0xff};
530 static BYTE data51
[] = {0x00,0x00,0x01,0xba,0xff};
531 static BYTE data52
[] = {0x00,0x00,0x01,0xb8,0xff};
532 static BYTE data53
[] = {0x00,0x00,0x01,0xba};
533 static BYTE data54
[] = {0x00,0x00,0x01,0xba,'<','h','t','m','l','>'};
534 static BYTE data55
[] = {0x1f,0x8b,'x'};
535 static BYTE data56
[] = {0x1f};
536 static BYTE data57
[] = {0x1f,0x8b,'<','h','t','m','l','>','t','e','s','t',0};
537 static BYTE data58
[] = {0x1f,0x8b};
538 static BYTE data59
[] = {0x50,0x4b,'x'};
539 static BYTE data60
[] = {0x50,0x4b};
540 static BYTE data61
[] = {0x50,0x4b,'<','h','t','m','l','>',0};
541 static BYTE data62
[] = {0xca,0xfe,0xba,0xbe,'x'};
542 static BYTE data63
[] = {0xca,0xfe,0xba,0xbe};
543 static BYTE data64
[] = {0xca,0xfe,0xba,0xbe,'<','h','t','m','l','>',0};
544 static BYTE data65
[] = {0x25,0x50,0x44,0x46,'x'};
545 static BYTE data66
[] = {0x25,0x50,0x44,0x46};
546 static BYTE data67
[] = {0x25,0x50,0x44,0x46,'x','<','h','t','m','l','>'};
547 static BYTE data68
[] = {'M','Z','x'};
548 static BYTE data69
[] = {'M','Z'};
549 static BYTE data70
[] = {'M','Z','<','h','t','m','l','>',0xff};
550 static BYTE data71
[] = {'{','\\','r','t','f',0};
551 static BYTE data72
[] = {'{','\\','r','t','f'};
552 static BYTE data73
[] = {' ','{','\\','r','t','f',' '};
553 static BYTE data74
[] = {'{','\\','r','t','f','<','h','t','m','l','>',' '};
554 static BYTE data75
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E',0xff};
555 static BYTE data76
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V','E'};
556 static BYTE data77
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'W','A','V',0xff,0xff};
557 static BYTE data78
[] = {'R','I','F','F',0xff,0xff,0xff,0xff,'<','h','t','m','l','>',0xff};
558 static BYTE data79
[] = {'%','!',0xff};
559 static BYTE data80
[] = {'%','!'};
560 static BYTE data81
[] = {'%','!','P','S','<','h','t','m','l','>'};
561 static BYTE data82
[] = {'.','s','n','d',0};
562 static BYTE data83
[] = {'.','s','n','d'};
563 static BYTE data84
[] = {'.','s','n','d',0,'<','h','t','m','l','>',1,1};
564 static BYTE data85
[] = {'.','S','N','D',0};
566 static const struct {
569 LPCWSTR mime
, mime_alt
;
571 {data1
, sizeof(data1
), mimeTextPlain
},
572 {data2
, sizeof(data2
), mimeAppOctetStream
},
573 {data3
, sizeof(data3
), mimeAppOctetStream
},
574 {data4
, sizeof(data4
), mimeAppOctetStream
},
575 {data5
, sizeof(data5
), mimeTextPlain
},
576 {data6
, sizeof(data6
), mimeTextPlain
},
577 {data7
, sizeof(data7
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
578 {data8
, sizeof(data8
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
579 {data9
, sizeof(data9
), mimeTextHtml
, mimeImagePjpeg
/* IE8 */},
580 {data10
, sizeof(data10
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
581 {data11
, sizeof(data11
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
582 {data12
, sizeof(data12
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
583 {data13
, sizeof(data13
), mimeTextPlain
},
584 {data14
, sizeof(data14
), mimeTextPlain
},
585 {data15
, sizeof(data15
), mimeTextPlain
},
586 {data16
, sizeof(data16
), mimeImagePjpeg
},
587 {data17
, sizeof(data17
), mimeAppOctetStream
},
588 {data18
, sizeof(data18
), mimeTextHtml
},
589 {data19
, sizeof(data19
), mimeImageGif
},
590 {data20
, sizeof(data20
), mimeImageGif
},
591 {data21
, sizeof(data21
), mimeTextPlain
},
592 {data22
, sizeof(data22
), mimeImageGif
},
593 {data23
, sizeof(data23
), mimeTextPlain
},
594 {data24
, sizeof(data24
), mimeImageGif
},
595 {data25
, sizeof(data25
), mimeImageGif
},
596 {data26
, sizeof(data26
), mimeTextHtml
, mimeImageGif
/* IE8 */},
597 {data27
, sizeof(data27
), mimeTextPlain
},
598 {data28
, sizeof(data28
), mimeImageBmp
},
599 {data29
, sizeof(data29
), mimeImageBmp
},
600 {data30
, sizeof(data30
), mimeAppOctetStream
},
601 {data31
, sizeof(data31
), mimeTextHtml
, mimeImageBmp
/* IE8 */},
602 {data32
, sizeof(data32
), mimeAppOctetStream
},
603 {data33
, sizeof(data33
), mimeAppOctetStream
},
604 {data34
, sizeof(data34
), mimeImageXPng
},
605 {data35
, sizeof(data35
), mimeImageXPng
},
606 {data36
, sizeof(data36
), mimeAppOctetStream
},
607 {data37
, sizeof(data37
), mimeTextHtml
, mimeImageXPng
/* IE8 */},
608 {data38
, sizeof(data38
), mimeAppOctetStream
},
609 {data39
, sizeof(data39
), mimeImageTiff
},
610 {data40
, sizeof(data40
), mimeTextHtml
, mimeImageTiff
/* IE8 */},
611 {data41
, sizeof(data41
), mimeImageTiff
},
612 {data42
, sizeof(data42
), mimeTextPlain
},
613 {data43
, sizeof(data43
), mimeAppOctetStream
},
614 {data44
, sizeof(data44
), mimeVideoAvi
},
615 {data45
, sizeof(data45
), mimeTextPlain
},
616 {data46
, sizeof(data46
), mimeTextPlain
},
617 {data47
, sizeof(data47
), mimeTextPlain
},
618 {data48
, sizeof(data48
), mimeTextHtml
, mimeVideoAvi
/* IE8 */},
619 {data49
, sizeof(data49
), mimeVideoAvi
},
620 {data50
, sizeof(data50
), mimeVideoMpeg
},
621 {data51
, sizeof(data51
), mimeVideoMpeg
},
622 {data52
, sizeof(data52
), mimeAppOctetStream
},
623 {data53
, sizeof(data53
), mimeAppOctetStream
},
624 {data54
, sizeof(data54
), mimeTextHtml
, mimeVideoMpeg
/* IE8 */},
625 {data55
, sizeof(data55
), mimeAppXGzip
},
626 {data56
, sizeof(data56
), mimeTextPlain
},
627 {data57
, sizeof(data57
), mimeTextHtml
, mimeAppXGzip
/* IE8 */},
628 {data58
, sizeof(data58
), mimeAppOctetStream
},
629 {data59
, sizeof(data59
), mimeAppXZip
},
630 {data60
, sizeof(data60
), mimeTextPlain
},
631 {data61
, sizeof(data61
), mimeTextHtml
, mimeAppXZip
/* IE8 */},
632 {data62
, sizeof(data62
), mimeAppJava
},
633 {data63
, sizeof(data63
), mimeTextPlain
},
634 {data64
, sizeof(data64
), mimeTextHtml
, mimeAppJava
/* IE8 */},
635 {data65
, sizeof(data65
), mimeAppPdf
},
636 {data66
, sizeof(data66
), mimeTextPlain
},
637 {data67
, sizeof(data67
), mimeTextHtml
, mimeAppPdf
/* IE8 */},
638 {data68
, sizeof(data68
), mimeAppXMSDownload
},
639 {data69
, sizeof(data69
), mimeTextPlain
},
640 {data70
, sizeof(data70
), mimeTextHtml
, mimeAppXMSDownload
/* IE8 */},
641 {data71
, sizeof(data71
), mimeTextRichtext
},
642 {data72
, sizeof(data72
), mimeTextPlain
},
643 {data73
, sizeof(data73
), mimeTextPlain
},
644 {data74
, sizeof(data74
), mimeTextHtml
, mimeTextRichtext
/* IE8 */},
645 {data75
, sizeof(data75
), mimeAudioWav
},
646 {data76
, sizeof(data76
), mimeTextPlain
},
647 {data77
, sizeof(data77
), mimeTextPlain
},
648 {data78
, sizeof(data78
), mimeTextHtml
, mimeTextPlain
/* IE8 */},
649 {data79
, sizeof(data79
), mimeAppPostscript
},
650 {data80
, sizeof(data80
), mimeTextPlain
},
651 {data81
, sizeof(data81
), mimeTextHtml
, mimeAppPostscript
/* IE8 */},
652 {data82
, sizeof(data82
), mimeAudioBasic
},
653 {data83
, sizeof(data83
), mimeTextPlain
},
654 {data84
, sizeof(data84
), mimeTextHtml
, mimeAudioBasic
/* IE8 */},
655 {data85
, sizeof(data85
), mimeTextPlain
}
658 static void test_FindMimeFromData(void)
664 for(i
=0; i
<sizeof(mime_tests
)/sizeof(mime_tests
[0]); i
++) {
665 mime
= (LPWSTR
)0xf0f0f0f0;
666 hres
= pFindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, NULL
, 0, &mime
, 0);
667 if(mime_tests
[i
].mime
) {
668 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
669 ok(!lstrcmpW(mime
, mime_tests
[i
].mime
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
672 ok(hres
== E_FAIL
|| hres
== mime_tests
[i
].hres
,
673 "[%d] FindMimeFromData failed: %08x, expected %08x\n",
674 i
, hres
, mime_tests
[i
].hres
);
675 ok(mime
== (LPWSTR
)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i
);
678 mime
= (LPWSTR
)0xf0f0f0f0;
679 hres
= pFindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, mimeTextPlain
, 0, &mime
, 0);
680 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
681 ok(!lstrcmpW(mime
, mimeTextPlain
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
684 mime
= (LPWSTR
)0xf0f0f0f0;
685 hres
= pFindMimeFromData(NULL
, mime_tests
[i
].url
, NULL
, 0, mimeAppOctetStream
, 0, &mime
, 0);
686 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
687 ok(!lstrcmpW(mime
, mimeAppOctetStream
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
691 for(i
=0; i
< sizeof(mime_tests2
)/sizeof(mime_tests2
[0]); i
++) {
692 hres
= pFindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
694 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
695 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
698 hres
= pFindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
699 mimeTextHtml
, 0, &mime
, 0);
700 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
701 if(!lstrcmpW(mimeAppOctetStream
, mime_tests2
[i
].mime
)
702 || !lstrcmpW(mimeTextPlain
, mime_tests2
[i
].mime
))
703 ok(!lstrcmpW(mime
, mimeTextHtml
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
705 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
708 hres
= pFindMimeFromData(NULL
, NULL
, mime_tests2
[i
].data
, mime_tests2
[i
].size
,
709 mimeImagePjpeg
, 0, &mime
, 0);
710 ok(hres
== S_OK
, "[%d] FindMimeFromData failed: %08x\n", i
, hres
);
711 if(!lstrcmpW(mimeAppOctetStream
, mime_tests2
[i
].mime
) || i
== 17)
712 ok(!lstrcmpW(mime
, mimeImagePjpeg
), "[%d] wrong mime: %s\n", i
, wine_dbgstr_w(mime
));
714 ok(!lstrcmpW(mime
, mime_tests2
[i
].mime
) ||
715 (mime_tests2
[i
].mime_alt
&& !lstrcmpW(mime
, mime_tests2
[i
].mime_alt
)),
716 "[%d] wrong mime, got %s\n", i
, wine_dbgstr_w(mime
));
721 hres
= pFindMimeFromData(NULL
, url1
, data1
, sizeof(data1
), NULL
, 0, &mime
, 0);
722 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
723 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime: %s\n", wine_dbgstr_w(mime
));
726 hres
= pFindMimeFromData(NULL
, url1
, data1
, sizeof(data1
), mimeAppOctetStream
, 0, &mime
, 0);
727 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
728 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime: %s\n", wine_dbgstr_w(mime
));
731 hres
= pFindMimeFromData(NULL
, url4
, data1
, sizeof(data1
), mimeAppOctetStream
, 0, &mime
, 0);
732 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
733 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime: %s\n", wine_dbgstr_w(mime
));
736 hres
= pFindMimeFromData(NULL
, NULL
, NULL
, 0, NULL
, 0, &mime
, 0);
737 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, excepted E_INVALIDARG\n", hres
);
739 hres
= pFindMimeFromData(NULL
, NULL
, NULL
, 0, mimeTextPlain
, 0, &mime
, 0);
740 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres
);
742 hres
= pFindMimeFromData(NULL
, NULL
, data1
, 0, NULL
, 0, &mime
, 0);
743 ok(hres
== E_FAIL
, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres
);
745 hres
= pFindMimeFromData(NULL
, url1
, data1
, 0, NULL
, 0, &mime
, 0);
746 ok(hres
== E_FAIL
, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres
);
748 hres
= pFindMimeFromData(NULL
, NULL
, data1
, 0, mimeTextPlain
, 0, &mime
, 0);
749 ok(hres
== S_OK
, "FindMimeFromData failed: %08x\n", hres
);
750 ok(!lstrcmpW(mime
, mimeTextPlain
), "wrong mime: %s\n", wine_dbgstr_w(mime
));
753 hres
= pFindMimeFromData(NULL
, NULL
, data1
, 0, mimeTextPlain
, 0, NULL
, 0);
754 ok(hres
== E_INVALIDARG
, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres
);
757 static void register_protocols(void)
759 IInternetSession
*session
;
760 IClassFactory
*factory
;
763 static const WCHAR wszAbout
[] = {'a','b','o','u','t',0};
765 hres
= pCoInternetGetSession(0, &session
, 0);
766 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
770 hres
= CoGetClassObject(&CLSID_AboutProtocol
, CLSCTX_INPROC_SERVER
, NULL
,
771 &IID_IClassFactory
, (void**)&factory
);
772 ok(hres
== S_OK
, "Could not get AboutProtocol factory: %08x\n", hres
);
776 IInternetSession_RegisterNameSpace(session
, factory
, &CLSID_AboutProtocol
,
777 wszAbout
, 0, NULL
, 0);
778 IClassFactory_Release(factory
);
780 IInternetSession_Release(session
);
783 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
784 REFIID riid
, void **ppv
)
786 ok(0, "unexpected call\n");
787 return E_NOINTERFACE
;
790 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
795 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
800 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
801 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
802 DWORD
*pcchResult
, DWORD dwReserved
)
804 CHECK_EXPECT2(ParseUrl
);
806 if(ParseAction
== PARSE_SECURITY_URL
) {
808 *pcchResult
= sizeof(url1
)/sizeof(WCHAR
);
810 if(cchResult
<sizeof(url1
)/sizeof(WCHAR
))
813 memcpy(pwzResult
, url1
, sizeof(url1
));
820 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
821 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
822 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
824 ok(0, "unexpected call\n");
828 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
829 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
831 ok(0, "unexpected call\n");
835 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
836 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
837 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
839 ok(0, "unexpected call\n");
843 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
844 InternetProtocolInfo_QueryInterface
,
845 InternetProtocolInfo_AddRef
,
846 InternetProtocolInfo_Release
,
847 InternetProtocolInfo_ParseUrl
,
848 InternetProtocolInfo_CombineUrl
,
849 InternetProtocolInfo_CompareUrl
,
850 InternetProtocolInfo_QueryInfo
853 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
855 static HRESULT qiret
;
856 static IClassFactory
*expect_cf
;
858 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
860 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
861 CHECK_EXPECT2(QI_IInternetProtocolInfo
);
862 ok(iface
== expect_cf
, "unexpected iface\n");
863 *ppv
= &protocol_info
;
867 ok(0, "unexpected call\n");
868 return E_NOINTERFACE
;
871 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
876 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
881 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
882 REFIID riid
, void **ppv
)
884 ok(0, "unexpected call\n");
888 static HRESULT WINAPI
ProtocolCF_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
889 REFIID riid
, void **ppv
)
891 CHECK_EXPECT(CreateInstance
);
893 ok(iface
== expect_cf
, "unexpected iface\n");
894 ok(pOuter
== NULL
, "pOuter = %p\n", pOuter
);
895 ok(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
), "unexpected riid\n");
896 ok(ppv
!= NULL
, "ppv == NULL\n");
898 *ppv
= &protocol_info
;
902 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
904 ok(0, "unexpected call\n");
908 static const IClassFactoryVtbl ClassFactoryVtbl
= {
909 ClassFactory_QueryInterface
,
911 ClassFactory_Release
,
912 ClassFactory_CreateInstance
,
913 ClassFactory_LockServer
916 static const IClassFactoryVtbl ProtocolCFVtbl
= {
917 ClassFactory_QueryInterface
,
919 ClassFactory_Release
,
920 ProtocolCF_CreateInstance
,
921 ClassFactory_LockServer
924 static IClassFactory test_protocol_cf
= { &ProtocolCFVtbl
};
925 static IClassFactory test_protocol_cf2
= { &ProtocolCFVtbl
};
926 static IClassFactory test_cf
= { &ClassFactoryVtbl
};
928 static void test_NameSpace(void)
930 IInternetSession
*session
;
936 static const WCHAR wszTest
[] = {'t','e','s','t',0};
938 hres
= pCoInternetGetSession(0, &session
, 0);
939 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
943 hres
= IInternetSession_RegisterNameSpace(session
, NULL
, &IID_NULL
,
944 wszTest
, 0, NULL
, 0);
945 ok(hres
== E_INVALIDARG
, "RegisterNameSpace failed: %08x\n", hres
);
947 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
949 ok(hres
== E_INVALIDARG
, "RegisterNameSpace failed: %08x\n", hres
);
951 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
952 wszTest
, 0, NULL
, 0);
953 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
955 qiret
= E_NOINTERFACE
;
956 expect_cf
= &test_protocol_cf
;
957 SET_EXPECT(QI_IInternetProtocolInfo
);
958 SET_EXPECT(CreateInstance
);
959 SET_EXPECT(ParseUrl
);
961 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
963 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
965 CHECK_CALLED(QI_IInternetProtocolInfo
);
966 CHECK_CALLED(CreateInstance
);
967 CHECK_CALLED(ParseUrl
);
970 SET_EXPECT(QI_IInternetProtocolInfo
);
971 SET_EXPECT(ParseUrl
);
973 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
975 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
977 CHECK_CALLED(QI_IInternetProtocolInfo
);
978 CHECK_CALLED(ParseUrl
);
980 SET_EXPECT(QI_IInternetProtocolInfo
);
981 SET_EXPECT(ParseUrl
);
983 hres
= pCoInternetParseUrl(url8
, PARSE_SECURITY_URL
, 0, buf
,
984 sizeof(buf
)/sizeof(WCHAR
), &size
, 0);
985 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
986 ok(size
== sizeof(url1
)/sizeof(WCHAR
), "Size = %d\n", size
);
987 if(size
== sizeof(url1
)/sizeof(WCHAR
))
988 ok(!memcmp(buf
, url1
, sizeof(url1
)), "Encoded url = %s\n", wine_dbgstr_w(buf
));
990 CHECK_CALLED(QI_IInternetProtocolInfo
);
991 CHECK_CALLED(ParseUrl
);
993 SET_EXPECT(QI_IInternetProtocolInfo
);
994 SET_EXPECT(ParseUrl
);
996 if (pCoInternetGetSecurityUrl
) {
997 hres
= pCoInternetGetSecurityUrl(url8
, &sec_url
, PSU_SECURITY_URL_ONLY
, 0);
998 ok(hres
== S_OK
, "CoInternetGetSecurityUrl failed: %08x\n", hres
);
1000 ok(lstrlenW(sec_url
)>sizeof(wszFile
)/sizeof(WCHAR
) &&
1001 !memcmp(sec_url
, wszFile
, sizeof(wszFile
)-sizeof(WCHAR
)),
1002 "Encoded url = %s\n", wine_dbgstr_w(sec_url
));
1003 CoTaskMemFree(sec_url
);
1006 CHECK_CALLED(QI_IInternetProtocolInfo
);
1007 CHECK_CALLED(ParseUrl
);
1010 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
1011 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
1013 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
1015 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
1017 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf2
, &IID_NULL
,
1018 wszTest
, 0, NULL
, 0);
1019 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
1021 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
1022 wszTest
, 0, NULL
, 0);
1023 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
1025 hres
= IInternetSession_RegisterNameSpace(session
, &test_protocol_cf
, &IID_NULL
,
1026 wszTest
, 0, NULL
, 0);
1027 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
1029 SET_EXPECT(QI_IInternetProtocolInfo
);
1030 SET_EXPECT(ParseUrl
);
1032 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
1034 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
1036 CHECK_CALLED(QI_IInternetProtocolInfo
);
1037 CHECK_CALLED(ParseUrl
);
1039 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
1040 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
1042 SET_EXPECT(QI_IInternetProtocolInfo
);
1043 SET_EXPECT(ParseUrl
);
1045 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
1047 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
1049 CHECK_CALLED(QI_IInternetProtocolInfo
);
1050 CHECK_CALLED(ParseUrl
);
1052 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
1053 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
1055 expect_cf
= &test_protocol_cf2
;
1056 SET_EXPECT(QI_IInternetProtocolInfo
);
1057 SET_EXPECT(ParseUrl
);
1059 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
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
);
1068 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, wszTest
);
1069 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
1070 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf
, NULL
);
1071 ok(hres
== E_INVALIDARG
, "UnregisterNameSpace failed: %08x\n", hres
);
1072 hres
= IInternetSession_UnregisterNameSpace(session
, NULL
, wszTest
);
1073 ok(hres
== E_INVALIDARG
, "UnregisterNameSpace failed: %08x\n", hres
);
1075 hres
= IInternetSession_UnregisterNameSpace(session
, &test_protocol_cf2
, wszTest
);
1076 ok(hres
== S_OK
, "UnregisterNameSpace failed: %08x\n", hres
);
1078 hres
= pCoInternetParseUrl(url8
, PARSE_ENCODE
, 0, buf
, sizeof(buf
)/sizeof(WCHAR
),
1080 ok(hres
== S_OK
, "CoInternetParseUrl failed: %08x\n", hres
);
1082 IInternetSession_Release(session
);
1085 static void test_MimeFilter(void)
1087 IInternetSession
*session
;
1090 static const WCHAR mimeW
[] = {'t','e','s','t','/','m','i','m','e',0};
1092 hres
= pCoInternetGetSession(0, &session
, 0);
1093 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
1097 hres
= IInternetSession_RegisterMimeFilter(session
, &test_cf
, &IID_NULL
, mimeW
);
1098 ok(hres
== S_OK
, "RegisterMimeFilter failed: %08x\n", hres
);
1100 hres
= IInternetSession_UnregisterMimeFilter(session
, &test_cf
, mimeW
);
1101 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1103 hres
= IInternetSession_UnregisterMimeFilter(session
, &test_cf
, mimeW
);
1104 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1106 hres
= IInternetSession_UnregisterMimeFilter(session
, (void*)0xdeadbeef, mimeW
);
1107 ok(hres
== S_OK
, "UnregisterMimeFilter failed: %08x\n", hres
);
1109 IInternetSession_Release(session
);
1112 static ULONG WINAPI
unk_Release(IUnknown
*iface
)
1114 CHECK_EXPECT(unk_Release
);
1118 static const IUnknownVtbl unk_vtbl
= {
1124 static void test_ReleaseBindInfo(void)
1127 IUnknown unk
= { &unk_vtbl
};
1129 pReleaseBindInfo(NULL
); /* shouldn't crash */
1131 memset(&bi
, 0, sizeof(bi
));
1132 bi
.cbSize
= sizeof(BINDINFO
);
1134 SET_EXPECT(unk_Release
);
1135 pReleaseBindInfo(&bi
);
1136 ok(bi
.cbSize
== sizeof(BINDINFO
), "bi.cbSize=%d\n", bi
.cbSize
);
1137 ok(bi
.pUnk
== NULL
, "bi.pUnk=%p, expected NULL\n", bi
.pUnk
);
1138 CHECK_CALLED(unk_Release
);
1140 memset(&bi
, 0, sizeof(bi
));
1141 bi
.cbSize
= offsetof(BINDINFO
, pUnk
);
1143 pReleaseBindInfo(&bi
);
1144 ok(bi
.cbSize
== offsetof(BINDINFO
, pUnk
), "bi.cbSize=%d\n", bi
.cbSize
);
1145 ok(bi
.pUnk
== &unk
, "bi.pUnk=%p, expected %p\n", bi
.pUnk
, &unk
);
1147 memset(&bi
, 0, sizeof(bi
));
1149 pReleaseBindInfo(&bi
);
1150 ok(!bi
.cbSize
, "bi.cbSize=%d, expected 0\n", bi
.cbSize
);
1151 ok(bi
.pUnk
== &unk
, "bi.pUnk=%p, expected %p\n", bi
.pUnk
, &unk
);
1154 static void test_CopyStgMedium(void)
1160 static WCHAR fileW
[] = {'f','i','l','e',0};
1162 memset(&src
, 0xf0, sizeof(src
));
1163 memset(&dst
, 0xe0, sizeof(dst
));
1164 memset(&empty
, 0xf0, sizeof(empty
));
1165 src
.tymed
= TYMED_NULL
;
1166 src
.pUnkForRelease
= NULL
;
1167 hres
= pCopyStgMedium(&src
, &dst
);
1168 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1169 ok(dst
.tymed
== TYMED_NULL
, "tymed=%d\n", dst
.tymed
);
1170 ok(dst
.u
.hGlobal
== empty
, "u=%p\n", dst
.u
.hGlobal
);
1171 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1173 memset(&dst
, 0xe0, sizeof(dst
));
1174 src
.tymed
= TYMED_ISTREAM
;
1176 src
.pUnkForRelease
= NULL
;
1177 hres
= pCopyStgMedium(&src
, &dst
);
1178 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1179 ok(dst
.tymed
== TYMED_ISTREAM
, "tymed=%d\n", dst
.tymed
);
1180 ok(!dst
.u
.pstm
, "pstm=%p\n", dst
.u
.pstm
);
1181 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1183 memset(&dst
, 0xe0, sizeof(dst
));
1184 src
.tymed
= TYMED_FILE
;
1185 src
.u
.lpszFileName
= fileW
;
1186 src
.pUnkForRelease
= NULL
;
1187 hres
= pCopyStgMedium(&src
, &dst
);
1188 ok(hres
== S_OK
, "CopyStgMedium failed: %08x\n", hres
);
1189 ok(dst
.tymed
== TYMED_FILE
, "tymed=%d\n", dst
.tymed
);
1190 ok(dst
.u
.lpszFileName
&& dst
.u
.lpszFileName
!= fileW
, "lpszFileName=%p\n", dst
.u
.lpszFileName
);
1191 ok(!lstrcmpW(dst
.u
.lpszFileName
, fileW
), "wrong file name\n");
1192 ok(!dst
.pUnkForRelease
, "pUnkForRelease=%p, expected NULL\n", dst
.pUnkForRelease
);
1193 ReleaseStgMedium(&dst
);
1195 hres
= pCopyStgMedium(&src
, NULL
);
1196 ok(hres
== E_POINTER
, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres
);
1197 hres
= pCopyStgMedium(NULL
, &dst
);
1198 ok(hres
== E_POINTER
, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres
);
1201 static void test_UrlMkGetSessionOption(void)
1203 DWORD encoding
, size
;
1206 size
= encoding
= 0xdeadbeef;
1207 hres
= pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1208 sizeof(encoding
), &size
, 0);
1209 ok(hres
== S_OK
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1210 ok(encoding
!= 0xdeadbeef, "encoding not changed\n");
1211 ok(size
== sizeof(encoding
), "size=%d\n", size
);
1213 size
= encoding
= 0xdeadbeef;
1214 hres
= pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1215 sizeof(encoding
)+1, &size
, 0);
1216 ok(hres
== S_OK
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1217 ok(encoding
!= 0xdeadbeef, "encoding not changed\n");
1218 ok(size
== sizeof(encoding
), "size=%d\n", size
);
1220 size
= encoding
= 0xdeadbeef;
1221 hres
= pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1222 sizeof(encoding
)-1, &size
, 0);
1223 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1224 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1225 ok(size
== 0xdeadbeef, "size=%d\n", size
);
1227 size
= encoding
= 0xdeadbeef;
1228 hres
= pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, NULL
,
1229 sizeof(encoding
)-1, &size
, 0);
1230 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1231 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1232 ok(size
== 0xdeadbeef, "size=%d\n", size
);
1234 encoding
= 0xdeadbeef;
1235 hres
= pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING
, &encoding
,
1236 sizeof(encoding
)-1, NULL
, 0);
1237 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1238 ok(encoding
== 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding
);
1241 static void test_user_agent(void)
1243 static const CHAR expected
[] = "Mozilla/4.0 (compatible; MSIE ";
1244 static char test_str
[] = "test";
1245 static char test2_str
[] = "test\0test";
1251 hres
= pObtainUserAgentString(0, NULL
, NULL
);
1252 ok(hres
== E_INVALIDARG
, "ObtainUserAgentString failed: %08x\n", hres
);
1255 hres
= pObtainUserAgentString(0, NULL
, &size
);
1256 ok(hres
== E_INVALIDARG
, "ObtainUserAgentString failed: %08x\n", hres
);
1257 ok(size
== 100, "size=%d, expected %d\n", size
, 100);
1260 hres
= pObtainUserAgentString(0, str
, &size
);
1261 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1262 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1266 hres
= pObtainUserAgentString(0, str
, &size
);
1267 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1268 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1269 ok(str
[0] == 'a', "str[0]=%c, expected 'a'\n", str
[0]);
1272 hres
= pObtainUserAgentString(1, str
, &size
);
1273 ok(hres
== E_OUTOFMEMORY
, "ObtainUserAgentString failed: %08x\n", hres
);
1274 ok(size
> 0, "size=%d, expected non-zero\n", size
);
1276 str2
= HeapAlloc(GetProcessHeap(), 0, (size
+20)*sizeof(CHAR
));
1278 hres
= pObtainUserAgentString(0, str2
, &size
);
1279 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
1280 ok(size
== saved
, "size=%d, expected %d\n", size
, saved
);
1281 ok(strlen(expected
) <= strlen(str2
) &&
1282 !memcmp(expected
, str2
, strlen(expected
)*sizeof(CHAR
)),
1283 "user agent was \"%s\", expected to start with \"%s\"\n",
1287 hres
= pObtainUserAgentString(0, str2
, &size
);
1288 ok(hres
== S_OK
, "ObtainUserAgentString failed: %08x\n", hres
);
1289 ok(size
== saved
, "size=%d, expected %d\n", size
, saved
);
1292 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 0, &size
, 0);
1293 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1294 ok(size
, "size == 0\n");
1297 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 1000, &size
, 0);
1298 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1299 ok(size
, "size == 0\n");
1303 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
+10, &size
, 0);
1304 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1305 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1306 ok(sizeof(expected
) <= strlen(str2
) && !memcmp(expected
, str2
, sizeof(expected
)-1),
1307 "user agent was \"%s\", expected to start with \"%s\"\n",
1312 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1313 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1314 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1315 ok(sizeof(expected
) <= strlen(str2
) && !memcmp(expected
, str2
, sizeof(expected
)-1),
1316 "user agent was \"%s\", expected to start with \"%s\"\n",
1321 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
-1, &size
, 0);
1322 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1323 ok(size
== saved
, "size = %d, expected %d\n", size
, saved
);
1324 ok(!str2
[0], "buf changed\n");
1328 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, NULL
, 0);
1329 ok(hres
== E_INVALIDARG
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1330 ok(!str2
[0], "buf changed\n");
1332 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, sizeof(test_str
), 0);
1333 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1337 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1338 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1339 ok(size
== sizeof(test_str
) && !memcmp(str2
, test_str
, sizeof(test_str
)), "wrong user agent\n");
1341 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test2_str
, sizeof(test2_str
), 0);
1342 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1346 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1347 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1348 ok(size
== sizeof(test_str
) && !memcmp(str2
, test_str
, sizeof(test_str
)), "wrong user agent\n");
1350 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, 2, 0);
1351 ok(hres
== S_OK
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1355 hres
= pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT
, str2
, saved
, &size
, 0);
1356 ok(hres
== E_OUTOFMEMORY
, "UrlMkGetSessionOption failed: %08x\n", hres
);
1357 ok(size
== 3 && !strcmp(str2
, "te"), "wrong user agent\n");
1359 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, test_str
, 0, 0);
1360 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1362 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, sizeof(test_str
), 0);
1363 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1365 hres
= UrlMkSetSessionOption(URLMON_OPTION_USERAGENT
, NULL
, 0, 0);
1366 ok(hres
== E_INVALIDARG
, "UrlMkSetSessionOption failed: %08x\n", hres
);
1368 HeapFree(GetProcessHeap(), 0, str2
);
1371 static void test_MkParseDisplayNameEx(void)
1373 IMoniker
*mon
= NULL
;
1380 static const WCHAR clsid_nameW
[] = {'c','l','s','i','d',':',
1381 '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
1382 '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0};
1387 LPCWSTR szDisplayName
;
1390 } invalid_parameters
[] =
1392 {NULL
, NULL
, NULL
, NULL
},
1393 {NULL
, NULL
, NULL
, &mon
},
1394 {NULL
, NULL
, &eaten
, NULL
},
1395 {NULL
, NULL
, &eaten
, &mon
},
1396 {NULL
, wszEmpty
, NULL
, NULL
},
1397 {NULL
, wszEmpty
, NULL
, &mon
},
1398 {NULL
, wszEmpty
, &eaten
, NULL
},
1399 {NULL
, wszEmpty
, &eaten
, &mon
},
1400 {&bctx
, NULL
, NULL
, NULL
},
1401 {&bctx
, NULL
, NULL
, &mon
},
1402 {&bctx
, NULL
, &eaten
, NULL
},
1403 {&bctx
, NULL
, &eaten
, &mon
},
1404 {&bctx
, wszEmpty
, NULL
, NULL
},
1405 {&bctx
, wszEmpty
, NULL
, &mon
},
1406 {&bctx
, wszEmpty
, &eaten
, NULL
},
1407 {&bctx
, wszEmpty
, &eaten
, &mon
},
1412 CreateBindCtx(0, &bctx
);
1414 for (i
= 0; i
< sizeof(invalid_parameters
)/sizeof(invalid_parameters
[0]); i
++)
1417 mon
= (IMoniker
*)0xdeadbeef;
1418 hres
= MkParseDisplayNameEx(invalid_parameters
[i
].ppbc
? *invalid_parameters
[i
].ppbc
: NULL
,
1419 invalid_parameters
[i
].szDisplayName
,
1420 invalid_parameters
[i
].pchEaten
,
1421 invalid_parameters
[i
].ppmk
);
1422 ok(hres
== E_INVALIDARG
,
1423 "[%d] Expected MkParseDisplayNameEx to return E_INVALIDARG, got %08x\n", i
, hres
);
1424 ok(eaten
== 0xdeadbeef, "[%d] Expected eaten to be 0xdeadbeef, got %u\n", i
, eaten
);
1425 ok(mon
== (IMoniker
*)0xdeadbeef, "[%d] Expected mon to be 0xdeadbeef, got %p\n", i
, mon
);
1428 hres
= MkParseDisplayNameEx(bctx
, url9
, &eaten
, &mon
);
1429 ok(hres
== S_OK
, "MkParseDisplayNameEx failed: %08x\n", hres
);
1430 ok(eaten
== sizeof(url9
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
1431 ok(mon
!= NULL
, "mon == NULL\n");
1433 hres
= IMoniker_GetDisplayName(mon
, NULL
, 0, &name
);
1434 ok(hres
== S_OK
, "GetDiasplayName failed: %08x\n", hres
);
1435 ok(!lstrcmpW(name
, url9
), "wrong display name %s\n", wine_dbgstr_w(name
));
1436 CoTaskMemFree(name
);
1438 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
1439 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
1440 ok(issys
== MKSYS_URLMONIKER
, "issys=%x\n", issys
);
1442 IMoniker_Release(mon
);
1444 hres
= MkParseDisplayNameEx(bctx
, clsid_nameW
, &eaten
, &mon
);
1445 ok(hres
== S_OK
, "MkParseDisplayNameEx failed: %08x\n", hres
);
1446 ok(eaten
== sizeof(clsid_nameW
)/sizeof(WCHAR
)-1, "eaten=%d\n", eaten
);
1447 ok(mon
!= NULL
, "mon == NULL\n");
1449 hres
= IMoniker_IsSystemMoniker(mon
, &issys
);
1450 ok(hres
== S_OK
, "IsSystemMoniker failed: %08x\n", hres
);
1451 ok(issys
== MKSYS_CLASSMONIKER
, "issys=%x\n", issys
);
1453 IMoniker_Release(mon
);
1455 hres
= MkParseDisplayNameEx(bctx
, url8
, &eaten
, &mon
);
1456 ok(FAILED(hres
), "MkParseDisplayNameEx succeeded: %08x\n", hres
);
1458 IBindCtx_Release(bctx
);
1461 static void test_IsValidURL(void)
1464 IBindCtx
*bctx
= NULL
;
1466 hr
= IsValidURL(NULL
, 0, 0);
1467 ok(hr
== E_INVALIDARG
, "Expected E_INVALIDARG, got %08x\n", hr
);
1469 hr
= IsValidURL(NULL
, wszHttpWineHQ
, 0);
1470 ok(hr
== S_OK
, "Expected S_OK, got %08x\n", hr
);
1472 CreateBindCtx(0, &bctx
);
1474 hr
= IsValidURL(bctx
, wszHttpWineHQ
, 0);
1475 ok(hr
== S_OK
, "Expected S_OK, got %08x\n", hr
);
1477 IBindCtx_Release(bctx
);
1480 static const struct {
1481 INTERNETFEATURELIST feature
;
1485 } default_feature_tests
[] = {
1486 {FEATURE_OBJECT_CACHING
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1487 {FEATURE_ZONE_ELEVATION
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1488 {FEATURE_MIME_HANDLING
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1489 {FEATURE_MIME_SNIFFING
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1490 {FEATURE_WINDOW_RESTRICTIONS
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1491 {FEATURE_WEBOC_POPUPMANAGEMENT
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1492 {FEATURE_BEHAVIORS
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1493 {FEATURE_DISABLE_MK_PROTOCOL
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1494 {FEATURE_LOCALMACHINE_LOCKDOWN
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1495 {FEATURE_SECURITYBAND
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1496 {FEATURE_RESTRICT_ACTIVEXINSTALL
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1497 {FEATURE_VALIDATE_NAVIGATE_URL
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1498 {FEATURE_RESTRICT_FILEDOWNLOAD
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1499 {FEATURE_ADDON_MANAGEMENT
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1500 {FEATURE_PROTOCOL_LOCKDOWN
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1501 {FEATURE_HTTP_USERNAME_PASSWORD_DISABLE
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1502 {FEATURE_SAFE_BINDTOOBJECT
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1503 {FEATURE_UNC_SAVEDFILECHECK
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1504 {FEATURE_GET_URL_DOM_FILEPATH_UNENCODED
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1505 {FEATURE_TABBED_BROWSING
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1506 {FEATURE_SSLUX
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1507 {FEATURE_DISABLE_NAVIGATION_SOUNDS
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1508 {FEATURE_DISABLE_LEGACY_COMPRESSION
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1509 {FEATURE_FORCE_ADDR_AND_STATUS
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1510 {FEATURE_XMLHTTP
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1511 {FEATURE_DISABLE_TELNET_PROTOCOL
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1512 {FEATURE_FEEDS
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1513 {FEATURE_BLOCK_INPUT_PROMPTS
,GET_FEATURE_FROM_PROCESS
,S_FALSE
}
1516 static void test_internet_feature_defaults(void) {
1520 for(i
= 0; i
< sizeof(default_feature_tests
)/sizeof(default_feature_tests
[0]); ++i
) {
1521 hres
= pCoInternetIsFeatureEnabled(default_feature_tests
[i
].feature
, default_feature_tests
[i
].get_flags
);
1522 if(default_feature_tests
[i
].todo
) {
1524 ok(hres
== default_feature_tests
[i
].expected
, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
1525 hres
, default_feature_tests
[i
].expected
, i
);
1527 ok(hres
== default_feature_tests
[i
].expected
, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
1528 hres
, default_feature_tests
[i
].expected
, i
);
1533 /* With older versions of IE (IE 7 and earlier), urlmon caches
1534 * the FeatureControl values from the registry when it's loaded
1535 * into memory. Newer versions of IE conditionally cache the
1536 * the FeatureControl registry values (i.e. When a call to
1537 * CoInternetIsFeatureEnabled and a corresponding CoInternetSetFeatureEnabled
1538 * call hasn't already been made for the specified Feature). Because of
1539 * this we skip these tests on IE 7 and earlier.
1541 static void test_internet_features_registry(void) {
1544 char module
[MAX_PATH
];
1546 HKEY feature_control
;
1548 DWORD value
, skip_zone
;
1549 BOOL delete_feature_key
= TRUE
;
1550 BOOL delete_feature_control_key
= FALSE
;
1552 static const char* szFeatureControlKey
= "Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl";
1553 static const char* szFeatureBehaviorsKey
= "FEATURE_BEHAVIORS";
1554 static const char* szFeatureZoneElevationKey
= "FEATURE_ZONE_ELEVATION";
1556 if(!pIEInstallScope
) {
1557 win_skip("Skipping internet feature registry tests, IE is too old...\n");
1561 res
= GetModuleFileNameA(NULL
, module
, sizeof(module
));
1562 ok(res
, "GetModuleFileName failed: %d\n", GetLastError());
1564 name
= strrchr(module
, '\\')+1;
1566 /* Some Windows machines don't have a FeatureControl key in HKCU. */
1567 res
= RegOpenKeyA(HKEY_CURRENT_USER
, szFeatureControlKey
, &feature_control
);
1568 if(res
!= ERROR_SUCCESS
) {
1569 res
= RegCreateKeyA(HKEY_CURRENT_USER
, szFeatureControlKey
, &feature_control
);
1570 ok(res
== ERROR_SUCCESS
, "RegCreateKey failed: %d\n", res
);
1571 delete_feature_control_key
= TRUE
;
1574 res
= RegOpenKeyA(feature_control
, szFeatureBehaviorsKey
, &feature
);
1575 if(res
== ERROR_SUCCESS
)
1576 /* FEATURE_BEHAVIORS already existed, so don't delete it when we're done. */
1577 delete_feature_key
= FALSE
;
1579 res
= RegCreateKeyA(feature_control
, szFeatureBehaviorsKey
, &feature
);
1580 ok(res
== ERROR_SUCCESS
, "RegCreateKey failed: %d\n", res
);
1584 res
= RegSetValueExA(feature
, name
, 0, REG_DWORD
, (BYTE
*)&value
, sizeof(DWORD
));
1585 ok(res
== ERROR_SUCCESS
, "RegSetValueEx failed: %d\n", res
);
1587 hres
= pCoInternetIsFeatureEnabled(FEATURE_BEHAVIORS
, GET_FEATURE_FROM_PROCESS
);
1588 ok(hres
== S_FALSE
, "CoInternetIsFeatureEnabled returned %08x, expected S_FALSE\n", hres
);
1590 if(delete_feature_key
) {
1591 RegCloseKey(feature
);
1592 RegDeleteKeyA(feature_control
, szFeatureBehaviorsKey
);
1594 RegDeleteValue(feature
, name
);
1595 RegCloseKey(feature
);
1598 /* IE's feature control cached the value it got from the registry earlier. */
1599 hres
= pCoInternetIsFeatureEnabled(FEATURE_BEHAVIORS
, GET_FEATURE_FROM_PROCESS
);
1600 ok(hres
== S_FALSE
, "CoInternetIsFeatureEnabled returned %08x, expected S_FALSE\n", hres
);
1602 /* Restore this feature back to its default value. */
1603 hres
= pCoInternetSetFeatureEnabled(FEATURE_BEHAVIORS
, SET_FEATURE_ON_PROCESS
, TRUE
);
1604 ok(hres
== S_OK
, "CoInternetSetFeatureEnabled failed: %08x\n", hres
);
1606 RegCloseKey(feature_control
);
1607 if(delete_feature_control_key
)
1608 RegDeleteKeyA(HKEY_CURRENT_USER
, szFeatureControlKey
);
1610 res
= RegOpenKeyA(HKEY_LOCAL_MACHINE
, szFeatureControlKey
, &feature_control
);
1611 ok(res
== ERROR_SUCCESS
, "RegOpenKey failed: %d\n", res
);
1613 res
= RegOpenKeyA(feature_control
, szFeatureZoneElevationKey
, &feature
);
1614 ok(res
== ERROR_SUCCESS
, "RegOpenKey failed: %d\n", res
);
1617 res
= RegSetValueExA(feature
, "*", 0, REG_DWORD
, (BYTE
*)&value
, sizeof(DWORD
));
1618 if (res
== ERROR_ACCESS_DENIED
)
1620 skip("Not allowed to modify zone elevation\n");
1626 ok(res
== ERROR_SUCCESS
, "RegSetValueEx failed: %d\n", res
);
1628 hres
= pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION
, GET_FEATURE_FROM_PROCESS
);
1629 ok(hres
== S_OK
, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres
);
1631 RegDeleteValueA(feature
, "*");
1632 RegCloseKey(feature
);
1633 RegCloseKey(feature_control
);
1635 /* Value is still cached from last time. */
1638 hres
= pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION
, GET_FEATURE_FROM_PROCESS
);
1639 ok(hres
== S_OK
, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres
);
1641 hres
= pCoInternetSetFeatureEnabled(FEATURE_ZONE_ELEVATION
, SET_FEATURE_ON_PROCESS
, FALSE
);
1642 ok(hres
== S_OK
, "CoInternetSetFeatureEnabled failed: %08x\n", hres
);
1645 test_internet_feature_defaults();
1648 static void test_CoInternetIsFeatureEnabled(void) {
1651 hres
= pCoInternetIsFeatureEnabled(FEATURE_ENTRY_COUNT
, GET_FEATURE_FROM_PROCESS
);
1652 ok(hres
== E_FAIL
, "CoInternetIsFeatureEnabled returned %08x, expected E_FAIL\n", hres
);
1655 static const struct {
1656 INTERNETFEATURELIST feature
;
1659 HRESULT set_expected
;
1662 HRESULT get_expected
;
1664 } internet_feature_tests
[] = {
1665 {FEATURE_OBJECT_CACHING
,SET_FEATURE_ON_PROCESS
,FALSE
,S_OK
,FALSE
,GET_FEATURE_FROM_PROCESS
,S_FALSE
},
1666 {FEATURE_WEBOC_POPUPMANAGEMENT
,SET_FEATURE_ON_PROCESS
,TRUE
,S_OK
,FALSE
,GET_FEATURE_FROM_PROCESS
,S_OK
},
1667 {FEATURE_LOCALMACHINE_LOCKDOWN
,SET_FEATURE_ON_PROCESS
,TRUE
,S_OK
,FALSE
,GET_FEATURE_FROM_PROCESS
,S_OK
}
1670 static void test_CoInternetSetFeatureEnabled(void) {
1674 hres
= pCoInternetSetFeatureEnabled(FEATURE_ENTRY_COUNT
,SET_FEATURE_ON_PROCESS
,TRUE
);
1675 ok(hres
== E_FAIL
, "CoInternetSetFeatureEnabled returned %08x, expected E_FAIL\n", hres
);
1677 for(i
= 0; i
< sizeof(internet_feature_tests
)/sizeof(internet_feature_tests
[0]); ++i
) {
1678 hres
= pCoInternetSetFeatureEnabled(internet_feature_tests
[i
].feature
, internet_feature_tests
[i
].set_flags
,
1679 internet_feature_tests
[i
].enable
);
1680 if(internet_feature_tests
[i
].set_todo
) {
1682 ok(hres
== internet_feature_tests
[i
].set_expected
, "CoInternetSetFeatureEnabled returned %08x, expected %08x on test %d\n",
1683 hres
, internet_feature_tests
[i
].set_expected
, i
);
1685 ok(hres
== internet_feature_tests
[i
].set_expected
, "CoInternetSetFeatureEnabled returned %08x, expected %08x on test %d\n",
1686 hres
, internet_feature_tests
[i
].set_expected
, i
);
1689 hres
= pCoInternetIsFeatureEnabled(internet_feature_tests
[i
].feature
, internet_feature_tests
[i
].set_flags
);
1690 if(internet_feature_tests
[i
].get_todo
) {
1692 ok(hres
== internet_feature_tests
[i
].get_expected
, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
1693 hres
, internet_feature_tests
[i
].get_expected
, i
);
1695 ok(hres
== internet_feature_tests
[i
].get_expected
, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
1696 hres
, internet_feature_tests
[i
].get_expected
, i
);
1701 static void test_internet_features(void) {
1702 if(!pCoInternetIsFeatureEnabled
|| !pCoInternetSetFeatureEnabled
) {
1703 win_skip("Skipping internet feature tests, IE is too old\n");
1707 test_internet_features_registry();
1708 test_CoInternetIsFeatureEnabled();
1709 test_CoInternetSetFeatureEnabled();
1716 hurlmon
= GetModuleHandle("urlmon.dll");
1717 pCoInternetCompareUrl
= (void *) GetProcAddress(hurlmon
, "CoInternetCompareUrl");
1718 pCoInternetGetSecurityUrl
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSecurityUrl");
1719 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
1720 pCoInternetParseUrl
= (void*) GetProcAddress(hurlmon
, "CoInternetParseUrl");
1721 pCoInternetQueryInfo
= (void*) GetProcAddress(hurlmon
, "CoInternetQueryInfo");
1722 pCopyStgMedium
= (void*) GetProcAddress(hurlmon
, "CopyStgMedium");
1723 pFindMimeFromData
= (void*) GetProcAddress(hurlmon
, "FindMimeFromData");
1724 pObtainUserAgentString
= (void*) GetProcAddress(hurlmon
, "ObtainUserAgentString");
1725 pReleaseBindInfo
= (void*) GetProcAddress(hurlmon
, "ReleaseBindInfo");
1726 pUrlMkGetSessionOption
= (void*) GetProcAddress(hurlmon
, "UrlMkGetSessionOption");
1727 pCompareSecurityIds
= (void*) GetProcAddress(hurlmon
, "CompareSecurityIds");
1728 pCoInternetIsFeatureEnabled
= (void*) GetProcAddress(hurlmon
, "CoInternetIsFeatureEnabled");
1729 pCoInternetSetFeatureEnabled
= (void*) GetProcAddress(hurlmon
, "CoInternetSetFeatureEnabled");
1730 pIEInstallScope
= (void*) GetProcAddress(hurlmon
, "IEInstallScope");
1732 if (!pCoInternetCompareUrl
|| !pCoInternetGetSecurityUrl
||
1733 !pCoInternetGetSession
|| !pCoInternetParseUrl
|| !pCompareSecurityIds
) {
1734 win_skip("Various needed functions not present, too old IE\n");
1738 OleInitialize(NULL
);
1740 register_protocols();
1742 test_CreateFormatEnum();
1743 test_RegisterFormatEnumerator();
1744 test_CoInternetParseUrl();
1745 test_CoInternetCompareUrl();
1746 test_CoInternetQueryInfo();
1747 test_FindMimeFromData();
1750 test_ReleaseBindInfo();
1751 test_CopyStgMedium();
1752 test_UrlMkGetSessionOption();
1754 test_MkParseDisplayNameEx();
1756 test_internet_features();