2 * Wininet - internet tests
4 * Copyright 2005 Vijay Kiran Kamuju
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #include "wine/test.h"
32 static BOOL (WINAPI
*pCreateUrlCacheContainerA
)(DWORD
, DWORD
, DWORD
, DWORD
,
33 DWORD
, DWORD
, DWORD
, DWORD
);
34 static BOOL (WINAPI
*pCreateUrlCacheContainerW
)(DWORD
, DWORD
, DWORD
, DWORD
,
35 DWORD
, DWORD
, DWORD
, DWORD
);
36 static BOOL (WINAPI
*pInternetTimeFromSystemTimeA
)(CONST SYSTEMTIME
*,DWORD
,LPSTR
,DWORD
);
37 static BOOL (WINAPI
*pInternetTimeFromSystemTimeW
)(CONST SYSTEMTIME
*,DWORD
,LPWSTR
,DWORD
);
38 static BOOL (WINAPI
*pInternetTimeToSystemTimeA
)(LPCSTR
,SYSTEMTIME
*,DWORD
);
39 static BOOL (WINAPI
*pInternetTimeToSystemTimeW
)(LPCWSTR
,SYSTEMTIME
*,DWORD
);
40 static BOOL (WINAPI
*pIsDomainLegalCookieDomainW
)(LPCWSTR
, LPCWSTR
);
41 static DWORD (WINAPI
*pPrivacyGetZonePreferenceW
)(DWORD
, DWORD
, LPDWORD
, LPWSTR
, LPDWORD
);
42 static DWORD (WINAPI
*pPrivacySetZonePreferenceW
)(DWORD
, DWORD
, DWORD
, LPCWSTR
);
44 /* Win9x and WinMe don't have lstrcmpW */
45 static int strcmp_ww(const WCHAR
*str1
, const WCHAR
*str2
)
47 DWORD len1
= lstrlenW(str1
);
48 DWORD len2
= lstrlenW(str2
);
50 if (len1
!= len2
) return 1;
51 return memcmp(str1
, str2
, len1
* sizeof(WCHAR
));
54 /* ############################### */
56 static void test_InternetCanonicalizeUrlA(void)
64 /* Acrobat Updater 5 calls this for Adobe Reader 8.1 */
65 url
= "http://swupmf.adobe.com/manifest/50/win/AdobeUpdater.upd";
66 urllen
= lstrlenA(url
);
68 memset(buffer
, '#', sizeof(buffer
)-1);
69 buffer
[sizeof(buffer
)-1] = '\0';
70 dwSize
= 1; /* Acrobat Updater use this size */
71 SetLastError(0xdeadbeef);
72 res
= InternetCanonicalizeUrlA(url
, buffer
, &dwSize
, 0);
73 ok( !res
&& (GetLastError() == ERROR_INSUFFICIENT_BUFFER
) && (dwSize
== (urllen
+1)),
74 "got %u and %u with size %u for '%s' (%d)\n",
75 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
78 /* buffer has no space for the terminating '\0' */
79 memset(buffer
, '#', sizeof(buffer
)-1);
80 buffer
[sizeof(buffer
)-1] = '\0';
82 SetLastError(0xdeadbeef);
83 res
= InternetCanonicalizeUrlA(url
, buffer
, &dwSize
, 0);
84 /* dwSize is nr. of needed bytes with the terminating '\0' */
85 ok( !res
&& (GetLastError() == ERROR_INSUFFICIENT_BUFFER
) && (dwSize
== (urllen
+1)),
86 "got %u and %u with size %u for '%s' (%d)\n",
87 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
89 /* buffer has the required size */
90 memset(buffer
, '#', sizeof(buffer
)-1);
91 buffer
[sizeof(buffer
)-1] = '\0';
93 SetLastError(0xdeadbeef);
94 res
= InternetCanonicalizeUrlA(url
, buffer
, &dwSize
, 0);
95 /* dwSize is nr. of copied bytes without the terminating '\0' */
96 ok( res
&& (dwSize
== urllen
) && (lstrcmpA(url
, buffer
) == 0),
97 "got %u and %u with size %u for '%s' (%d)\n",
98 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
100 memset(buffer
, '#', sizeof(buffer
)-1);
101 buffer
[sizeof(buffer
)-1] = '\0';
102 dwSize
= sizeof(buffer
);
103 SetLastError(0xdeadbeef);
104 res
= InternetCanonicalizeUrlA("file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml", buffer
, &dwSize
, ICU_DECODE
| ICU_NO_ENCODE
);
105 ok(res
, "InternetCanonicalizeUrlA failed %u\n", GetLastError());
106 ok(dwSize
== lstrlenA(buffer
), "got %d expected %d\n", dwSize
, lstrlenA(buffer
));
107 ok(!lstrcmpA("file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", buffer
),
108 "got %s expected 'file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml'\n", buffer
);
110 /* buffer is larger as the required size */
111 memset(buffer
, '#', sizeof(buffer
)-1);
112 buffer
[sizeof(buffer
)-1] = '\0';
114 SetLastError(0xdeadbeef);
115 res
= InternetCanonicalizeUrlA(url
, buffer
, &dwSize
, 0);
116 /* dwSize is nr. of copied bytes without the terminating '\0' */
117 ok( res
&& (dwSize
== urllen
) && (lstrcmpA(url
, buffer
) == 0),
118 "got %u and %u with size %u for '%s' (%d)\n",
119 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
122 /* check NULL pointers */
123 memset(buffer
, '#', urllen
+ 4);
124 buffer
[urllen
+ 4] = '\0';
126 SetLastError(0xdeadbeef);
127 res
= InternetCanonicalizeUrlA(NULL
, buffer
, &dwSize
, 0);
128 ok( !res
&& (GetLastError() == ERROR_INVALID_PARAMETER
),
129 "got %u and %u with size %u for '%s' (%d)\n",
130 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
132 memset(buffer
, '#', urllen
+ 4);
133 buffer
[urllen
+ 4] = '\0';
135 SetLastError(0xdeadbeef);
136 res
= InternetCanonicalizeUrlA(url
, NULL
, &dwSize
, 0);
137 ok( !res
&& (GetLastError() == ERROR_INVALID_PARAMETER
),
138 "got %u and %u with size %u for '%s' (%d)\n",
139 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
141 memset(buffer
, '#', urllen
+ 4);
142 buffer
[urllen
+ 4] = '\0';
144 SetLastError(0xdeadbeef);
145 res
= InternetCanonicalizeUrlA(url
, buffer
, NULL
, 0);
146 ok( !res
&& (GetLastError() == ERROR_INVALID_PARAMETER
),
147 "got %u and %u with size %u for '%s' (%d)\n",
148 res
, GetLastError(), dwSize
, buffer
, lstrlenA(buffer
));
150 /* test with trailing space */
152 res
= InternetCanonicalizeUrlA("http://www.winehq.org/index.php?x= ", buffer
, &dwSize
, ICU_BROWSER_MODE
);
153 ok(res
== 1, "InternetCanonicalizeUrlA failed\n");
154 ok(!strcmp(buffer
, "http://www.winehq.org/index.php?x="), "Trailing space should have been stripped even in ICU_BROWSER_MODE (%s)\n", buffer
);
156 res
= InternetSetOptionA(NULL
, 0xdeadbeef, buffer
, sizeof(buffer
));
157 ok(!res
, "InternetSetOptionA succeeded\n");
158 ok(GetLastError() == ERROR_INTERNET_INVALID_OPTION
,
159 "InternetSetOptionA failed %u, expected ERROR_INTERNET_INVALID_OPTION\n", GetLastError());
162 /* ############################### */
164 static void test_InternetQueryOptionA(void)
166 HINTERNET hinet
,hurl
;
169 static const char useragent
[] = {"Wininet Test"};
173 hinet
= InternetOpenA(useragent
,INTERNET_OPEN_TYPE_DIRECT
,NULL
,NULL
, 0);
174 ok((hinet
!= 0x0),"InternetOpen Failed\n");
176 SetLastError(0xdeadbeef);
177 retval
=InternetQueryOptionA(NULL
,INTERNET_OPTION_USER_AGENT
,NULL
,&len
);
179 ok(retval
== 0,"Got wrong return value %d\n",retval
);
180 ok(err
== ERROR_INTERNET_INCORRECT_HANDLE_TYPE
, "Got wrong error code%d\n",err
);
182 SetLastError(0xdeadbeef);
183 len
=strlen(useragent
)+1;
184 retval
=InternetQueryOptionA(hinet
,INTERNET_OPTION_USER_AGENT
,NULL
,&len
);
186 ok(len
== strlen(useragent
)+1,"Got wrong user agent length %d instead of %d\n",len
,lstrlenA(useragent
));
187 ok(retval
== 0,"Got wrong return value %d\n",retval
);
188 ok(err
== ERROR_INSUFFICIENT_BUFFER
, "Got wrong error code %d\n",err
);
190 SetLastError(0xdeadbeef);
191 len
=strlen(useragent
)+1;
192 buffer
=HeapAlloc(GetProcessHeap(),0,len
);
193 retval
=InternetQueryOptionA(hinet
,INTERNET_OPTION_USER_AGENT
,buffer
,&len
);
195 ok(retval
== 1,"Got wrong return value %d\n",retval
);
198 ok(!strcmp(useragent
,buffer
),"Got wrong user agent string %s instead of %s\n",buffer
,useragent
);
199 ok(len
== strlen(useragent
),"Got wrong user agent length %d instead of %d\n",len
,lstrlenA(useragent
));
201 ok(err
== 0xdeadbeef, "Got wrong error code %d\n",err
);
202 HeapFree(GetProcessHeap(),0,buffer
);
204 SetLastError(0xdeadbeef);
206 buffer
=HeapAlloc(GetProcessHeap(),0,100);
207 retval
=InternetQueryOptionA(hinet
,INTERNET_OPTION_USER_AGENT
,buffer
,&len
);
209 ok(len
== strlen(useragent
) + 1,"Got wrong user agent length %d instead of %d\n", len
, lstrlenA(useragent
) + 1);
210 ok(!retval
, "Got wrong return value %d\n", retval
);
211 ok(err
== ERROR_INSUFFICIENT_BUFFER
, "Got wrong error code %d\n", err
);
212 HeapFree(GetProcessHeap(),0,buffer
);
214 hurl
= InternetConnectA(hinet
,"www.winehq.org",INTERNET_DEFAULT_HTTP_PORT
,NULL
,NULL
,INTERNET_SERVICE_HTTP
,0,0);
216 SetLastError(0xdeadbeef);
218 retval
= InternetQueryOptionA(hurl
,INTERNET_OPTION_USER_AGENT
,NULL
,&len
);
220 ok(len
== 0,"Got wrong user agent length %d instead of 0\n",len
);
221 ok(retval
== 0,"Got wrong return value %d\n",retval
);
222 ok(err
== ERROR_INTERNET_INCORRECT_HANDLE_TYPE
, "Got wrong error code %d\n",err
);
224 InternetCloseHandle(hurl
);
225 InternetCloseHandle(hinet
);
227 hinet
= InternetOpenA("",INTERNET_OPEN_TYPE_DIRECT
,NULL
,NULL
, 0);
228 ok((hinet
!= 0x0),"InternetOpen Failed\n");
230 SetLastError(0xdeadbeef);
232 retval
=InternetQueryOptionA(hinet
,INTERNET_OPTION_USER_AGENT
,NULL
,&len
);
234 ok(len
== 1,"Got wrong user agent length %d instead of %d\n",len
,1);
235 ok(retval
== 0,"Got wrong return value %d\n",retval
);
236 ok(err
== ERROR_INSUFFICIENT_BUFFER
, "Got wrong error code%d\n",err
);
238 InternetCloseHandle(hinet
);
240 hinet
= InternetOpenA(NULL
,INTERNET_OPEN_TYPE_DIRECT
,NULL
,NULL
, 0);
241 ok((hinet
!= 0x0),"InternetOpen Failed\n");
242 SetLastError(0xdeadbeef);
244 retval
=InternetQueryOptionA(hinet
,INTERNET_OPTION_USER_AGENT
,NULL
,&len
);
246 ok(len
== 1,"Got wrong user agent length %d instead of %d\n",len
,1);
247 ok(retval
== 0,"Got wrong return value %d\n",retval
);
248 ok(err
== ERROR_INSUFFICIENT_BUFFER
, "Got wrong error code%d\n",err
);
250 InternetCloseHandle(hinet
);
253 retval
= InternetQueryOptionA(NULL
, INTERNET_OPTION_MAX_CONNS_PER_SERVER
, &val
, &len
);
254 ok(retval
== TRUE
,"Got wrong return value %d\n", retval
);
255 ok(len
== sizeof(val
), "got %d\n", len
);
256 ok(val
== 2, "got %d\n", val
);
259 retval
= InternetQueryOptionA(NULL
, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
, &val
, &len
);
260 ok(retval
== TRUE
,"Got wrong return value %d\n", retval
);
261 ok(len
== sizeof(val
), "got %d\n", len
);
262 ok(val
== 4, "got %d\n", val
);
266 static void test_get_cookie(void)
271 SetLastError(0xdeadbeef);
272 ret
= InternetGetCookie("http://www.example.com", NULL
, NULL
, &len
);
273 ok(!ret
&& GetLastError() == ERROR_NO_MORE_ITEMS
,
274 "InternetGetCookie should have failed with %s and error %d\n",
275 ret
? "TRUE" : "FALSE", GetLastError());
279 static void test_complicated_cookie(void)
286 ret
= InternetSetCookie("http://www.example.com/bar",NULL
,"A=B; domain=.example.com");
287 ok(ret
== TRUE
,"InternetSetCookie failed\n");
288 ret
= InternetSetCookie("http://www.example.com/bar",NULL
,"C=D; domain=.example.com; path=/");
289 ok(ret
== TRUE
,"InternetSetCookie failed\n");
291 /* Technically illegal! domain should require 2 dots, but native wininet accepts it */
292 ret
= InternetSetCookie("http://www.example.com",NULL
,"E=F; domain=example.com");
293 ok(ret
== TRUE
,"InternetSetCookie failed\n");
294 ret
= InternetSetCookie("http://www.example.com",NULL
,"G=H; domain=.example.com; path=/foo");
295 ok(ret
== TRUE
,"InternetSetCookie failed\n");
296 ret
= InternetSetCookie("http://www.example.com/bar.html",NULL
,"I=J; domain=.example.com");
297 ok(ret
== TRUE
,"InternetSetCookie failed\n");
298 ret
= InternetSetCookie("http://www.example.com/bar/",NULL
,"K=L; domain=.example.com");
299 ok(ret
== TRUE
,"InternetSetCookie failed\n");
300 ret
= InternetSetCookie("http://www.example.com/bar/",NULL
,"M=N; domain=.example.com; path=/foo/");
301 ok(ret
== TRUE
,"InternetSetCookie failed\n");
302 ret
= InternetSetCookie("http://www.example.com/bar/",NULL
,"O=P; secure; path=/bar");
303 ok(ret
== TRUE
,"InternetSetCookie failed\n");
306 ret
= InternetGetCookie("http://testing.example.com", NULL
, buffer
, &len
);
307 ok(ret
== TRUE
,"InternetGetCookie failed\n");
308 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
309 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
310 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
311 ok(strstr(buffer
,"G=H")==NULL
,"G=H present\n");
312 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
313 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
314 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
315 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
318 ret
= InternetGetCookie("http://testing.example.com/foobar", NULL
, buffer
, &len
);
319 ok(ret
== TRUE
,"InternetGetCookie failed\n");
320 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
321 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
322 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
323 ok(strstr(buffer
,"G=H")==NULL
,"G=H present\n");
324 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
325 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
326 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
327 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
330 ret
= InternetGetCookie("http://testing.example.com/foobar/", NULL
, buffer
, &len
);
331 ok(ret
== TRUE
,"InternetGetCookie failed\n");
332 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
333 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
334 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
335 ok(strstr(buffer
,"G=H")!=NULL
,"G=H missing\n");
336 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
337 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
338 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
339 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
342 ret
= InternetGetCookie("http://testing.example.com/foo/bar", NULL
, buffer
, &len
);
343 ok(ret
== TRUE
,"InternetGetCookie failed\n");
344 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
345 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
346 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
347 ok(strstr(buffer
,"G=H")!=NULL
,"G=H missing\n");
348 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
349 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
350 ok(strstr(buffer
,"M=N")!=NULL
,"M=N missing\n");
351 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
354 ret
= InternetGetCookie("http://testing.example.com/barfoo", NULL
, buffer
, &len
);
355 ok(ret
== TRUE
,"InternetGetCookie failed\n");
356 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
357 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
358 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
359 ok(strstr(buffer
,"G=H")==NULL
,"G=H present\n");
360 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
361 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
362 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
363 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
366 ret
= InternetGetCookie("http://testing.example.com/barfoo/", NULL
, buffer
, &len
);
367 ok(ret
== TRUE
,"InternetGetCookie failed\n");
368 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
369 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
370 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
371 ok(strstr(buffer
,"G=H")==NULL
,"G=H present\n");
372 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
373 ok(strstr(buffer
,"K=L")==NULL
,"K=L present\n");
374 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
375 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
378 ret
= InternetGetCookie("http://testing.example.com/bar/foo", NULL
, buffer
, &len
);
379 ok(ret
== TRUE
,"InternetGetCookie failed\n");
380 ok(strstr(buffer
,"A=B")!=NULL
,"A=B missing\n");
381 ok(strstr(buffer
,"C=D")!=NULL
,"C=D missing\n");
382 ok(strstr(buffer
,"E=F")!=NULL
,"E=F missing\n");
383 ok(strstr(buffer
,"G=H")==NULL
,"G=H present\n");
384 ok(strstr(buffer
,"I=J")!=NULL
,"I=J missing\n");
385 ok(strstr(buffer
,"K=L")!=NULL
,"K=L missing\n");
386 ok(strstr(buffer
,"M=N")==NULL
,"M=N present\n");
387 ok(strstr(buffer
,"O=P")==NULL
,"O=P present\n");
390 static void test_null(void)
393 static const WCHAR szServer
[] = { 's','e','r','v','e','r',0 };
394 static const WCHAR szEmpty
[] = { 0 };
395 static const WCHAR szUrl
[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
396 static const WCHAR szUrlEmpty
[] = { 'h','t','t','p',':','/','/',0 };
397 static const WCHAR szExpect
[] = { 's','e','r','v','e','r',';',' ','s','e','r','v','e','r',0 };
402 SetLastError(0xdeadbeef);
403 hi
= InternetOpenW(NULL
, 0, NULL
, NULL
, 0);
404 if (hi
== NULL
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
406 win_skip("Internet*W functions are not implemented\n");
409 ok(hi
!= NULL
, "open failed\n");
411 hc
= InternetConnectW(hi
, NULL
, 0, NULL
, NULL
, 0, 0, 0);
412 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
413 ok(hc
== NULL
, "connect failed\n");
415 hc
= InternetConnectW(hi
, NULL
, 0, NULL
, NULL
, INTERNET_SERVICE_HTTP
, 0, 0);
416 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
417 ok(hc
== NULL
, "connect failed\n");
419 hc
= InternetConnectW(hi
, NULL
, 0, NULL
, NULL
, INTERNET_SERVICE_FTP
, 0, 0);
420 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
421 ok(hc
== NULL
, "connect failed\n");
423 hc
= InternetConnectW(NULL
, szServer
, 0, NULL
, NULL
, INTERNET_SERVICE_FTP
, 0, 0);
424 ok(GetLastError() == ERROR_INVALID_HANDLE
, "wrong error\n");
425 ok(hc
== NULL
, "connect failed\n");
427 hc
= InternetOpenUrlW(hi
, NULL
, NULL
, 0, 0, 0);
428 ok(GetLastError() == ERROR_INVALID_PARAMETER
||
429 GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME
, "wrong error\n");
430 ok(hc
== NULL
, "connect failed\n");
432 hc
= InternetOpenUrlW(hi
, szServer
, NULL
, 0, 0, 0);
433 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME
, "wrong error\n");
434 ok(hc
== NULL
, "connect failed\n");
436 InternetCloseHandle(hi
);
438 r
= InternetSetCookieW(NULL
, NULL
, NULL
);
439 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
440 ok(r
== FALSE
, "return wrong\n");
442 r
= InternetSetCookieW(szServer
, NULL
, NULL
);
443 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
444 ok(r
== FALSE
, "return wrong\n");
446 r
= InternetSetCookieW(szUrl
, szServer
, NULL
);
447 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "wrong error\n");
448 ok(r
== FALSE
, "return wrong\n");
450 r
= InternetSetCookieW(szUrl
, szServer
, szServer
);
451 ok(r
== TRUE
, "return wrong\n");
453 r
= InternetSetCookieW(szUrl
, NULL
, szServer
);
454 ok(r
== TRUE
, "return wrong\n");
456 r
= InternetSetCookieW(szUrl
, szServer
, szEmpty
);
457 ok(r
== TRUE
, "return wrong\n");
459 r
= InternetSetCookieW(szUrlEmpty
, szServer
, szServer
);
460 ok(r
== FALSE
, "return wrong\n");
462 r
= InternetSetCookieW(szServer
, NULL
, szServer
);
464 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME
, "wrong error\n");
466 ok(r
== FALSE
, "return wrong\n");
469 r
= InternetGetCookieW(NULL
, NULL
, NULL
, &sz
);
470 ok(GetLastError() == ERROR_INVALID_PARAMETER
|| GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME
,
471 "wrong error %u\n", GetLastError());
472 ok( r
== FALSE
, "return wrong\n");
474 r
= InternetGetCookieW(szServer
, NULL
, NULL
, &sz
);
476 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME
, "wrong error\n");
478 ok( r
== FALSE
, "return wrong\n");
481 r
= InternetGetCookieW(szUrlEmpty
, szServer
, NULL
, &sz
);
482 ok( r
== FALSE
, "return wrong\n");
485 r
= InternetGetCookieW(szUrl
, szServer
, NULL
, &sz
);
486 ok( r
== TRUE
, "return wrong\n");
488 /* sz is 14 on XP SP2 and beyond, 30 on XP SP1 and before */
489 ok( sz
== 14 || sz
== 30, "sz wrong, got %u, expected 14 or 30\n", sz
);
492 memset(buffer
, 0, sizeof buffer
);
493 r
= InternetGetCookieW(szUrl
, szServer
, buffer
, &sz
);
494 ok( r
== TRUE
, "return wrong\n");
496 /* sz == lstrlenW(buffer) only in XP SP1 */
497 ok( sz
== 1 + lstrlenW(buffer
) || sz
== lstrlenW(buffer
), "sz wrong %d\n", sz
);
499 /* before XP SP2, buffer is "server; server" */
500 ok( !strcmp_ww(szExpect
, buffer
) || !strcmp_ww(szServer
, buffer
), "cookie data wrong\n");
503 r
= InternetQueryOptionA(NULL
, INTERNET_OPTION_CONNECTED_STATE
, buffer
, &sz
);
504 ok(r
== TRUE
, "ret %d\n", r
);
507 static void test_version(void)
509 INTERNET_VERSION_INFO version
;
513 size
= sizeof(version
);
514 res
= InternetQueryOptionA(NULL
, INTERNET_OPTION_VERSION
, &version
, &size
);
515 ok(res
, "Could not get version: %u\n", GetLastError());
516 ok(version
.dwMajorVersion
== 1, "dwMajorVersion=%d, expected 1\n", version
.dwMajorVersion
);
517 ok(version
.dwMinorVersion
== 2, "dwMinorVersion=%d, expected 2\n", version
.dwMinorVersion
);
520 static void InternetTimeFromSystemTimeA_test(void)
523 static const SYSTEMTIME time
= { 2005, 1, 5, 7, 12, 6, 35, 0 };
524 char string
[INTERNET_RFC1123_BUFSIZE
];
525 static const char expect
[] = "Fri, 07 Jan 2005 12:06:35 GMT";
528 ret
= pInternetTimeFromSystemTimeA( &time
, INTERNET_RFC1123_FORMAT
, string
, sizeof(string
) );
529 ok( ret
, "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
531 ok( !memcmp( string
, expect
, sizeof(expect
) ),
532 "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
534 /* test NULL time parameter */
535 SetLastError(0xdeadbeef);
536 ret
= pInternetTimeFromSystemTimeA( NULL
, INTERNET_RFC1123_FORMAT
, string
, sizeof(string
) );
537 error
= GetLastError();
538 ok( !ret
, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
539 ok( error
== ERROR_INVALID_PARAMETER
,
540 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
543 /* test NULL string parameter */
544 SetLastError(0xdeadbeef);
545 ret
= pInternetTimeFromSystemTimeA( &time
, INTERNET_RFC1123_FORMAT
, NULL
, sizeof(string
) );
546 error
= GetLastError();
547 ok( !ret
, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
548 ok( error
== ERROR_INVALID_PARAMETER
,
549 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
552 /* test invalid format parameter */
553 SetLastError(0xdeadbeef);
554 ret
= pInternetTimeFromSystemTimeA( &time
, INTERNET_RFC1123_FORMAT
+ 1, string
, sizeof(string
) );
555 error
= GetLastError();
556 ok( !ret
, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
557 ok( error
== ERROR_INVALID_PARAMETER
,
558 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
561 /* test too small buffer size */
562 SetLastError(0xdeadbeef);
563 ret
= pInternetTimeFromSystemTimeA( &time
, INTERNET_RFC1123_FORMAT
, string
, 0 );
564 error
= GetLastError();
565 ok( !ret
, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
566 ok( error
== ERROR_INSUFFICIENT_BUFFER
,
567 "InternetTimeFromSystemTimeA failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
571 static void InternetTimeFromSystemTimeW_test(void)
574 static const SYSTEMTIME time
= { 2005, 1, 5, 7, 12, 6, 35, 0 };
575 WCHAR string
[INTERNET_RFC1123_BUFSIZE
+ 1];
576 static const WCHAR expect
[] = { 'F','r','i',',',' ','0','7',' ','J','a','n',' ','2','0','0','5',' ',
577 '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
580 ret
= pInternetTimeFromSystemTimeW( &time
, INTERNET_RFC1123_FORMAT
, string
, sizeof(string
) );
581 ok( ret
, "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
583 ok( !memcmp( string
, expect
, sizeof(expect
) ),
584 "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
586 /* test NULL time parameter */
587 SetLastError(0xdeadbeef);
588 ret
= pInternetTimeFromSystemTimeW( NULL
, INTERNET_RFC1123_FORMAT
, string
, sizeof(string
) );
589 error
= GetLastError();
590 ok( !ret
, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
591 ok( error
== ERROR_INVALID_PARAMETER
,
592 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
595 /* test NULL string parameter */
596 SetLastError(0xdeadbeef);
597 ret
= pInternetTimeFromSystemTimeW( &time
, INTERNET_RFC1123_FORMAT
, NULL
, sizeof(string
) );
598 error
= GetLastError();
599 ok( !ret
, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
600 ok( error
== ERROR_INVALID_PARAMETER
,
601 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
604 /* test invalid format parameter */
605 SetLastError(0xdeadbeef);
606 ret
= pInternetTimeFromSystemTimeW( &time
, INTERNET_RFC1123_FORMAT
+ 1, string
, sizeof(string
) );
607 error
= GetLastError();
608 ok( !ret
, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
609 ok( error
== ERROR_INVALID_PARAMETER
,
610 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
613 /* test too small buffer size */
614 SetLastError(0xdeadbeef);
615 ret
= pInternetTimeFromSystemTimeW( &time
, INTERNET_RFC1123_FORMAT
, string
, sizeof(string
)/sizeof(string
[0]) );
616 error
= GetLastError();
617 ok( !ret
, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
618 ok( error
== ERROR_INSUFFICIENT_BUFFER
,
619 "InternetTimeFromSystemTimeW failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
623 static void InternetTimeToSystemTimeA_test(void)
627 static const SYSTEMTIME expect
= { 2005, 1, 5, 7, 12, 6, 35, 0 };
628 static const char string
[] = "Fri, 07 Jan 2005 12:06:35 GMT";
629 static const char string2
[] = " fri 7 jan 2005 12 06 35";
631 ret
= pInternetTimeToSystemTimeA( string
, &time
, 0 );
632 ok( ret
, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
633 ok( !memcmp( &time
, &expect
, sizeof(expect
) ),
634 "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
636 ret
= pInternetTimeToSystemTimeA( string2
, &time
, 0 );
637 ok( ret
, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
638 ok( !memcmp( &time
, &expect
, sizeof(expect
) ),
639 "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
642 static void InternetTimeToSystemTimeW_test(void)
646 static const SYSTEMTIME expect
= { 2005, 1, 5, 7, 12, 6, 35, 0 };
647 static const WCHAR string
[] = { 'F','r','i',',',' ','0','7',' ','J','a','n',' ','2','0','0','5',' ',
648 '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
649 static const WCHAR string2
[] = { ' ','f','r','i',' ','7',' ','j','a','n',' ','2','0','0','5',' ',
650 '1','2',' ','0','6',' ','3','5',0 };
651 static const WCHAR string3
[] = { 'F','r',0 };
653 ret
= pInternetTimeToSystemTimeW( NULL
, NULL
, 0 );
654 ok( !ret
, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
656 ret
= pInternetTimeToSystemTimeW( NULL
, &time
, 0 );
657 ok( !ret
, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
659 ret
= pInternetTimeToSystemTimeW( string
, NULL
, 0 );
660 ok( !ret
, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
662 ret
= pInternetTimeToSystemTimeW( string
, &time
, 0 );
663 ok( ret
, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
665 ret
= pInternetTimeToSystemTimeW( string
, &time
, 0 );
666 ok( ret
, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
667 ok( !memcmp( &time
, &expect
, sizeof(expect
) ),
668 "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
670 ret
= pInternetTimeToSystemTimeW( string2
, &time
, 0 );
671 ok( ret
, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
672 ok( !memcmp( &time
, &expect
, sizeof(expect
) ),
673 "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
675 ret
= pInternetTimeToSystemTimeW( string3
, &time
, 0 );
676 ok( ret
, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
679 static void test_IsDomainLegalCookieDomainW(void)
683 static const WCHAR empty
[] = {0};
684 static const WCHAR dot
[] = {'.',0};
685 static const WCHAR uk
[] = {'u','k',0};
686 static const WCHAR com
[] = {'c','o','m',0};
687 static const WCHAR dot_com
[] = {'.','c','o','m',0};
688 static const WCHAR gmail_com
[] = {'g','m','a','i','l','.','c','o','m',0};
689 static const WCHAR dot_gmail_com
[] = {'.','g','m','a','i','l','.','c','o','m',0};
690 static const WCHAR mail_gmail_com
[] = {'m','a','i','l','.','g','m','a','i','l','.','c','o','m',0};
691 static const WCHAR gmail_co_uk
[] = {'g','m','a','i','l','.','c','o','.','u','k',0};
692 static const WCHAR co_uk
[] = {'c','o','.','u','k',0};
693 static const WCHAR dot_co_uk
[] = {'.','c','o','.','u','k',0};
695 SetLastError(0xdeadbeef);
696 ret
= pIsDomainLegalCookieDomainW(NULL
, NULL
);
697 error
= GetLastError();
698 if (!ret
&& error
== ERROR_CALL_NOT_IMPLEMENTED
)
700 win_skip("IsDomainLegalCookieDomainW is not implemented\n");
704 broken(ret
), /* IE6 */
705 "IsDomainLegalCookieDomainW succeeded\n");
706 ok(error
== ERROR_INVALID_PARAMETER
, "got %u expected ERROR_INVALID_PARAMETER\n", error
);
708 SetLastError(0xdeadbeef);
709 ret
= pIsDomainLegalCookieDomainW(com
, NULL
);
710 error
= GetLastError();
711 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
712 ok(error
== ERROR_INVALID_PARAMETER
, "got %u expected ERROR_INVALID_PARAMETER\n", error
);
714 SetLastError(0xdeadbeef);
715 ret
= pIsDomainLegalCookieDomainW(NULL
, gmail_com
);
716 error
= GetLastError();
717 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
718 ok(error
== ERROR_INVALID_PARAMETER
, "got %u expected ERROR_INVALID_PARAMETER\n", error
);
720 SetLastError(0xdeadbeef);
721 ret
= pIsDomainLegalCookieDomainW(empty
, gmail_com
);
722 error
= GetLastError();
723 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
724 ok(error
== ERROR_INVALID_NAME
||
725 broken(error
== ERROR_INVALID_PARAMETER
), /* IE6 */
726 "got %u expected ERROR_INVALID_NAME\n", error
);
728 SetLastError(0xdeadbeef);
729 ret
= pIsDomainLegalCookieDomainW(com
, empty
);
730 error
= GetLastError();
731 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
732 ok(error
== ERROR_INVALID_NAME
||
733 broken(error
== ERROR_INVALID_PARAMETER
), /* IE6 */
734 "got %u expected ERROR_INVALID_NAME\n", error
);
736 SetLastError(0xdeadbeef);
737 ret
= pIsDomainLegalCookieDomainW(gmail_com
, dot
);
738 error
= GetLastError();
739 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
740 ok(error
== ERROR_INVALID_NAME
||
741 broken(error
== 0xdeadbeef), /* IE6 */
742 "got %u expected ERROR_INVALID_NAME\n", error
);
744 SetLastError(0xdeadbeef);
745 ret
= pIsDomainLegalCookieDomainW(dot
, gmail_com
);
746 error
= GetLastError();
747 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
748 ok(error
== ERROR_INVALID_NAME
||
749 broken(error
== 0xdeadbeef), /* IE6 */
750 "got %u expected ERROR_INVALID_NAME\n", error
);
752 SetLastError(0xdeadbeef);
753 ret
= pIsDomainLegalCookieDomainW(com
, com
);
754 error
= GetLastError();
755 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
756 ok(error
== 0xdeadbeef, "got %u expected 0xdeadbeef\n", error
);
758 SetLastError(0xdeadbeef);
759 ret
= pIsDomainLegalCookieDomainW(com
, dot_com
);
760 error
= GetLastError();
761 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
762 ok(error
== ERROR_INVALID_NAME
||
763 broken(error
== 0xdeadbeef), /* IE6 */
764 "got %u expected ERROR_INVALID_NAME\n", error
);
766 SetLastError(0xdeadbeef);
767 ret
= pIsDomainLegalCookieDomainW(dot_com
, com
);
768 error
= GetLastError();
769 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
770 ok(error
== ERROR_INVALID_NAME
||
771 broken(error
== 0xdeadbeef), /* IE6 */
772 "got %u expected ERROR_INVALID_NAME\n", error
);
774 SetLastError(0xdeadbeef);
775 ret
= pIsDomainLegalCookieDomainW(com
, gmail_com
);
776 error
= GetLastError();
777 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
778 ok(error
== ERROR_SXS_KEY_NOT_FOUND
||
779 error
== ERROR_SUCCESS
|| /* IE8 on W2K3 */
780 error
== 0xdeadbeef, /* up to IE7 */
781 "unexpected error: %u\n", error
);
783 ret
= pIsDomainLegalCookieDomainW(gmail_com
, gmail_com
);
784 ok(ret
, "IsDomainLegalCookieDomainW failed\n");
786 SetLastError(0xdeadbeef);
787 ret
= pIsDomainLegalCookieDomainW(gmail_co_uk
, co_uk
);
788 error
= GetLastError();
789 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
790 ok(error
== ERROR_SXS_KEY_NOT_FOUND
|| /* IE8 on XP */
791 error
== ERROR_FILE_NOT_FOUND
|| /* IE8 on Vista */
792 error
== ERROR_SUCCESS
|| /* IE8 on W2K3 */
793 error
== 0xdeadbeef, /* up to IE7 */
794 "unexpected error: %u\n", error
);
796 ret
= pIsDomainLegalCookieDomainW(uk
, co_uk
);
797 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
799 ret
= pIsDomainLegalCookieDomainW(gmail_co_uk
, dot_co_uk
);
800 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
802 ret
= pIsDomainLegalCookieDomainW(gmail_co_uk
, gmail_co_uk
);
803 ok(ret
, "IsDomainLegalCookieDomainW failed\n");
805 ret
= pIsDomainLegalCookieDomainW(gmail_com
, com
);
806 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
808 SetLastError(0xdeadbeef);
809 ret
= pIsDomainLegalCookieDomainW(dot_gmail_com
, mail_gmail_com
);
810 error
= GetLastError();
811 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
812 ok(error
== ERROR_INVALID_NAME
||
813 broken(error
== 0xdeadbeef), /* IE6 */
814 "got %u expected ERROR_INVALID_NAME\n", error
);
816 ret
= pIsDomainLegalCookieDomainW(gmail_com
, mail_gmail_com
);
817 ok(ret
, "IsDomainLegalCookieDomainW failed\n");
819 ret
= pIsDomainLegalCookieDomainW(mail_gmail_com
, gmail_com
);
820 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
822 ret
= pIsDomainLegalCookieDomainW(mail_gmail_com
, com
);
823 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
825 ret
= pIsDomainLegalCookieDomainW(dot_gmail_com
, mail_gmail_com
);
826 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
828 ret
= pIsDomainLegalCookieDomainW(mail_gmail_com
, dot_gmail_com
);
829 ok(!ret
, "IsDomainLegalCookieDomainW succeeded\n");
832 static void test_PrivacyGetSetZonePreferenceW(void)
834 DWORD ret
, zone
, type
, template, old_template
;
838 ret
= pPrivacyGetZonePreferenceW(zone
, type
, NULL
, NULL
, NULL
);
839 ok(ret
== 0, "expected ret == 0, got %u\n", ret
);
842 ret
= pPrivacyGetZonePreferenceW(zone
, type
, &old_template
, NULL
, NULL
);
843 ok(ret
== 0, "expected ret == 0, got %u\n", ret
);
846 ret
= pPrivacySetZonePreferenceW(zone
, type
, template, NULL
);
847 ok(ret
== 0, "expected ret == 0, got %u\n", ret
);
850 ret
= pPrivacyGetZonePreferenceW(zone
, type
, &template, NULL
, NULL
);
851 ok(ret
== 0, "expected ret == 0, got %u\n", ret
);
852 ok(template == 5, "expected template == 5, got %u\n", template);
855 ret
= pPrivacySetZonePreferenceW(zone
, type
, old_template
, NULL
);
856 ok(ret
== 0, "expected ret == 0, got %u\n", ret
);
859 static void test_InternetSetOption(void)
861 HINTERNET ses
, con
, req
;
866 ses
= InternetOpen(NULL
, INTERNET_OPEN_TYPE_DIRECT
, NULL
, NULL
, 0);
867 ok(ses
!= 0, "InternetOpen failed: 0x%08x\n", GetLastError());
868 con
= InternetConnect(ses
, "www.winehq.org", 80, NULL
, NULL
, INTERNET_SERVICE_HTTP
, 0, 0);
869 ok(con
!= 0, "InternetConnect failed: 0x%08x\n", GetLastError());
870 req
= HttpOpenRequest(con
, "GET", "/", NULL
, NULL
, NULL
, 0, 0);
871 ok(req
!= 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
873 /* INTERNET_OPTION_POLICY tests */
874 SetLastError(0xdeadbeef);
875 ret
= InternetSetOptionW(ses
, INTERNET_OPTION_POLICY
, NULL
, 0);
876 ok(ret
== FALSE
, "InternetSetOption should've failed\n");
877 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError should've "
878 "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
880 SetLastError(0xdeadbeef);
881 ret
= InternetQueryOptionW(ses
, INTERNET_OPTION_POLICY
, NULL
, 0);
882 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
883 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError should've "
884 "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
886 /* INTERNET_OPTION_ERROR_MASK tests */
887 SetLastError(0xdeadbeef);
888 size
= sizeof(ulArg
);
889 ret
= InternetQueryOptionW(NULL
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, &size
);
890 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
891 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE
, "GetLastError() = %x\n", GetLastError());
893 SetLastError(0xdeadbeef);
895 ret
= InternetSetOption(NULL
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, sizeof(ULONG
));
896 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
897 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE
, "GetLastError() = %x\n", GetLastError());
899 SetLastError(0xdeadbeef);
901 ret
= InternetSetOption(req
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, 20);
902 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
903 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH
, "GetLastError() = %d\n", GetLastError());
905 SetLastError(0xdeadbeef);
907 ret
= InternetSetOption(req
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, sizeof(ULONG
));
908 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
909 ok(GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
911 SetLastError(0xdeadbeef);
913 ret
= InternetSetOption(req
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, sizeof(ULONG
));
914 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
915 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError() = %x\n", GetLastError());
917 SetLastError(0xdeadbeef);
919 ret
= InternetSetOption(req
, INTERNET_OPTION_ERROR_MASK
, (void*)&ulArg
, sizeof(ULONG
));
920 ok(ret
== FALSE
, "InternetQueryOption should've failed\n");
921 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError() = %x\n", GetLastError());
923 ret
= InternetCloseHandle(req
);
924 ok(ret
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
925 ret
= InternetCloseHandle(con
);
926 ok(ret
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
927 ret
= InternetCloseHandle(ses
);
928 ok(ret
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
931 #define verifyProxyEnable(e) r_verifyProxyEnable(__LINE__, e)
932 static void r_verifyProxyEnable(LONG l
, DWORD exp
)
935 DWORD type
, val
, size
= sizeof(DWORD
);
937 static const CHAR szInternetSettings
[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
938 static const CHAR szProxyEnable
[] = "ProxyEnable";
940 ret
= RegOpenKeyA(HKEY_CURRENT_USER
, szInternetSettings
, &hkey
);
941 ok_(__FILE__
,l
) (!ret
, "RegOpenKeyA failed: 0x%08x\n", ret
);
943 ret
= RegQueryValueExA(hkey
, szProxyEnable
, 0, &type
, (BYTE
*)&val
, &size
);
944 ok_(__FILE__
,l
) (!ret
, "RegQueryValueExA failed: 0x%08x\n", ret
);
945 ok_(__FILE__
,l
) (type
== REG_DWORD
, "Expected regtype to be REG_DWORD, was: %d\n", type
);
946 ok_(__FILE__
,l
) (val
== exp
, "Expected ProxyEnabled to be %d, got: %d\n", exp
, val
);
948 ret
= RegCloseKey(hkey
);
949 ok_(__FILE__
,l
) (!ret
, "RegCloseKey failed: 0x%08x\n", ret
);
952 static void test_Option_PerConnectionOption(void)
955 DWORD size
= sizeof(INTERNET_PER_CONN_OPTION_LISTW
);
956 INTERNET_PER_CONN_OPTION_LISTW list
= {size
};
957 INTERNET_PER_CONN_OPTIONW
*orig_settings
;
958 static WCHAR proxy_srvW
[] = {'p','r','o','x','y','.','e','x','a','m','p','l','e',0};
960 /* get the global IE proxy server info, to restore later */
961 list
.dwOptionCount
= 2;
962 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW
));
964 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
965 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
967 ret
= InternetQueryOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
969 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
970 orig_settings
= list
.pOptions
;
972 /* set the global IE proxy server */
973 list
.dwOptionCount
= 2;
974 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW
));
976 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
977 list
.pOptions
[0].Value
.pszValue
= proxy_srvW
;
978 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
979 list
.pOptions
[1].Value
.dwValue
= PROXY_TYPE_PROXY
;
981 ret
= InternetSetOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
983 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
985 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
987 /* get & verify the global IE proxy server */
988 list
.dwOptionCount
= 2;
989 list
.dwOptionError
= 0;
990 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW
));
992 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
993 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
995 ret
= InternetQueryOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
997 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
998 ok(!strcmp_ww(list
.pOptions
[0].Value
.pszValue
, proxy_srvW
),
999 "Retrieved proxy server should've been %s, was: %s\n",
1000 wine_dbgstr_w(proxy_srvW
), wine_dbgstr_w(list
.pOptions
[0].Value
.pszValue
));
1001 ok(list
.pOptions
[1].Value
.dwValue
== PROXY_TYPE_PROXY
,
1002 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
1003 list
.pOptions
[1].Value
.dwValue
);
1004 verifyProxyEnable(1);
1006 HeapFree(GetProcessHeap(), 0, list
.pOptions
[0].Value
.pszValue
);
1007 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1009 /* disable the proxy server */
1010 list
.dwOptionCount
= 1;
1011 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW
));
1013 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_FLAGS
;
1014 list
.pOptions
[0].Value
.dwValue
= PROXY_TYPE_DIRECT
;
1016 ret
= InternetSetOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1018 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
1020 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1022 /* verify that the proxy is disabled */
1023 list
.dwOptionCount
= 1;
1024 list
.dwOptionError
= 0;
1025 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW
));
1027 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_FLAGS
;
1029 ret
= InternetQueryOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1031 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
1032 ok(list
.pOptions
[0].Value
.dwValue
== PROXY_TYPE_DIRECT
,
1033 "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %d\n",
1034 list
.pOptions
[0].Value
.dwValue
);
1035 verifyProxyEnable(0);
1037 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1039 /* set the proxy flags to 'invalid' value */
1040 list
.dwOptionCount
= 1;
1041 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW
));
1043 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_FLAGS
;
1044 list
.pOptions
[0].Value
.dwValue
= PROXY_TYPE_PROXY
| PROXY_TYPE_DIRECT
;
1046 ret
= InternetSetOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1048 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
1050 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1052 /* verify that the proxy is enabled */
1053 list
.dwOptionCount
= 1;
1054 list
.dwOptionError
= 0;
1055 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW
));
1057 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_FLAGS
;
1059 ret
= InternetQueryOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1061 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
1062 todo_wine
ok(list
.pOptions
[0].Value
.dwValue
== (PROXY_TYPE_PROXY
| PROXY_TYPE_DIRECT
),
1063 "Retrieved flags should've been PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT, was: %d\n",
1064 list
.pOptions
[0].Value
.dwValue
);
1065 verifyProxyEnable(1);
1067 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1069 /* restore original settings */
1070 list
.dwOptionCount
= 2;
1071 list
.pOptions
= orig_settings
;
1073 ret
= InternetSetOptionW(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1075 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
1077 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1080 static void test_Option_PerConnectionOptionA(void)
1083 DWORD size
= sizeof(INTERNET_PER_CONN_OPTION_LISTA
);
1084 INTERNET_PER_CONN_OPTION_LISTA list
= {size
};
1085 INTERNET_PER_CONN_OPTIONA
*orig_settings
;
1086 char proxy_srv
[] = "proxy.example";
1088 /* get the global IE proxy server info, to restore later */
1089 list
.dwOptionCount
= 2;
1090 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA
));
1092 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
1093 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
1095 ret
= InternetQueryOptionA(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1097 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
1098 orig_settings
= list
.pOptions
;
1100 /* set the global IE proxy server */
1101 list
.dwOptionCount
= 2;
1102 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA
));
1104 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
1105 list
.pOptions
[0].Value
.pszValue
= proxy_srv
;
1106 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
1107 list
.pOptions
[1].Value
.dwValue
= PROXY_TYPE_PROXY
;
1109 ret
= InternetSetOptionA(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1111 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
1113 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1115 /* get & verify the global IE proxy server */
1116 list
.dwOptionCount
= 2;
1117 list
.dwOptionError
= 0;
1118 list
.pOptions
= HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA
));
1120 list
.pOptions
[0].dwOption
= INTERNET_PER_CONN_PROXY_SERVER
;
1121 list
.pOptions
[1].dwOption
= INTERNET_PER_CONN_FLAGS
;
1123 ret
= InternetQueryOptionA(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1125 ok(ret
== TRUE
, "InternetQueryOption should've succeeded\n");
1126 ok(!lstrcmpA(list
.pOptions
[0].Value
.pszValue
, "proxy.example"),
1127 "Retrieved proxy server should've been \"%s\", was: \"%s\"\n",
1128 proxy_srv
, list
.pOptions
[0].Value
.pszValue
);
1129 ok(list
.pOptions
[1].Value
.dwValue
== PROXY_TYPE_PROXY
,
1130 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
1131 list
.pOptions
[1].Value
.dwValue
);
1133 HeapFree(GetProcessHeap(), 0, list
.pOptions
[0].Value
.pszValue
);
1134 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1136 /* restore original settings */
1137 list
.dwOptionCount
= 2;
1138 list
.pOptions
= orig_settings
;
1140 ret
= InternetSetOptionA(NULL
, INTERNET_OPTION_PER_CONNECTION_OPTION
,
1142 ok(ret
== TRUE
, "InternetSetOption should've succeeded\n");
1144 HeapFree(GetProcessHeap(), 0, list
.pOptions
);
1147 #define FLAG_TODO 0x1
1148 #define FLAG_NEEDREQ 0x2
1149 #define FLAG_UNIMPL 0x4
1151 void test_InternetErrorDlg(void)
1153 HINTERNET ses
, con
, req
;
1157 static const struct {
1162 { ERROR_INTERNET_INCORRECT_PASSWORD
, ERROR_SUCCESS
, FLAG_NEEDREQ
},
1163 { ERROR_INTERNET_SEC_CERT_DATE_INVALID
, ERROR_CANCELLED
, 0 },
1164 { ERROR_INTERNET_SEC_CERT_CN_INVALID
, ERROR_CANCELLED
, 0 },
1165 { ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
, ERROR_SUCCESS
, 0 },
1166 { ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR
, ERROR_SUCCESS
, FLAG_TODO
},
1167 { ERROR_INTERNET_MIXED_SECURITY
, ERROR_CANCELLED
, FLAG_TODO
},
1168 { ERROR_INTERNET_CHG_POST_IS_NON_SECURE
, ERROR_CANCELLED
, FLAG_TODO
},
1169 { ERROR_INTERNET_POST_IS_NON_SECURE
, ERROR_SUCCESS
, 0 },
1170 { ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
, ERROR_CANCELLED
, FLAG_NEEDREQ
|FLAG_TODO
},
1171 { ERROR_INTERNET_INVALID_CA
, ERROR_CANCELLED
, 0 },
1172 { ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR
, ERROR_CANCELLED
, FLAG_TODO
},
1173 { ERROR_INTERNET_INSERT_CDROM
, ERROR_CANCELLED
, FLAG_TODO
|FLAG_NEEDREQ
|FLAG_UNIMPL
},
1174 { ERROR_INTERNET_SEC_CERT_ERRORS
, ERROR_CANCELLED
, 0 },
1175 { ERROR_INTERNET_SEC_CERT_REV_FAILED
, ERROR_CANCELLED
, FLAG_TODO
},
1176 { ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION
, ERROR_HTTP_COOKIE_DECLINED
, FLAG_TODO
},
1177 { ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT
, ERROR_CANCELLED
, FLAG_TODO
},
1178 { ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT
, ERROR_CANCELLED
, FLAG_TODO
},
1179 { ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION
, ERROR_CANCELLED
, FLAG_TODO
},
1180 { ERROR_INTERNET_SEC_CERT_REVOKED
, ERROR_CANCELLED
, 0 },
1181 { 0, ERROR_NOT_SUPPORTED
}
1186 res
= InternetErrorDlg(NULL
, NULL
, 12055, flags
, NULL
);
1187 ok(res
== ERROR_INVALID_HANDLE
, "Got %d\n", res
);
1189 ses
= InternetOpen(NULL
, INTERNET_OPEN_TYPE_DIRECT
, NULL
, NULL
, 0);
1190 ok(ses
!= 0, "InternetOpen failed: 0x%08x\n", GetLastError());
1191 con
= InternetConnect(ses
, "www.winehq.org", 80, NULL
, NULL
, INTERNET_SERVICE_HTTP
, 0, 0);
1192 ok(con
!= 0, "InternetConnect failed: 0x%08x\n", GetLastError());
1193 req
= HttpOpenRequest(con
, "GET", "/", NULL
, NULL
, NULL
, 0, 0);
1194 ok(req
!= 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
1196 /* NULL hwnd and FLAGS_ERROR_UI_FLAGS_NO_UI not set */
1197 for(i
= INTERNET_ERROR_BASE
; i
< INTERNET_ERROR_LAST
; i
++)
1199 res
= InternetErrorDlg(NULL
, req
, i
, flags
, NULL
);
1200 ok(res
== ERROR_INVALID_HANDLE
, "Got %d (%d)\n", res
, i
);
1203 hwnd
= GetDesktopWindow();
1204 ok(hwnd
!= NULL
, "GetDesktopWindow failed (%d)\n", GetLastError());
1206 flags
= FLAGS_ERROR_UI_FLAGS_NO_UI
;
1207 for(i
= INTERNET_ERROR_BASE
; i
< INTERNET_ERROR_LAST
; i
++)
1209 DWORD expected
, test_flags
, j
;
1211 for(j
= 0; no_ui_res
[j
].error
!= 0; ++j
)
1212 if(no_ui_res
[j
].error
== i
)
1215 test_flags
= no_ui_res
[j
].test_flags
;
1216 expected
= no_ui_res
[j
].res
;
1218 /* Try an invalid request handle */
1219 res
= InternetErrorDlg(hwnd
, (HANDLE
)0xdeadbeef, i
, flags
, NULL
);
1220 if(res
== ERROR_CALL_NOT_IMPLEMENTED
)
1222 todo_wine
ok(test_flags
& FLAG_UNIMPL
, "%i is unexpectedly unimplemented.\n", i
);
1226 todo_wine
ok(res
== ERROR_INVALID_HANDLE
, "Got %d (%d)\n", res
, i
);
1228 /* With a valid req */
1229 if(i
== ERROR_INTERNET_NEED_UI
)
1230 continue; /* Crashes on windows XP */
1232 if(i
== ERROR_INTERNET_SEC_CERT_REVOKED
)
1233 continue; /* Interactive (XP, Win7) */
1235 res
= InternetErrorDlg(hwnd
, req
, i
, flags
, NULL
);
1237 /* Handle some special cases */
1240 case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
:
1241 case ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR
:
1242 if(res
== ERROR_CANCELLED
)
1244 /* Some windows XP, w2k3 x64, W2K8 */
1245 win_skip("Skipping some tests for %d\n", i
);
1249 case ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED
:
1252 /* Windows XP, W2K3 */
1253 ok(res
== NTE_PROV_TYPE_NOT_DEF
, "Got %d\n", res
);
1254 win_skip("Skipping some tests for %d\n", i
);
1261 if(test_flags
& FLAG_TODO
)
1262 todo_wine
ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1264 ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1266 /* Same thing with NULL hwnd */
1267 res
= InternetErrorDlg(NULL
, req
, i
, flags
, NULL
);
1268 if(test_flags
& FLAG_TODO
)
1269 todo_wine
ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1271 ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1274 /* With a null req */
1275 if(test_flags
& FLAG_NEEDREQ
)
1276 expected
= ERROR_INVALID_PARAMETER
;
1278 res
= InternetErrorDlg(hwnd
, NULL
, i
, flags
, NULL
);
1279 if( test_flags
& FLAG_TODO
|| i
== ERROR_INTERNET_INCORRECT_PASSWORD
)
1280 todo_wine
ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1282 ok(res
== expected
, "Got %d, expected %d (%d)\n", res
, expected
, i
);
1285 res
= InternetCloseHandle(req
);
1286 ok(res
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1287 res
= InternetCloseHandle(con
);
1288 ok(res
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1289 res
= InternetCloseHandle(ses
);
1290 ok(res
== TRUE
, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1293 /* ############################### */
1295 START_TEST(internet
)
1298 hdll
= GetModuleHandleA("wininet.dll");
1300 if(!GetProcAddress(hdll
, "InternetGetCookieExW")) {
1301 win_skip("Too old IE (older than 6.0)\n");
1305 pCreateUrlCacheContainerA
= (void*)GetProcAddress(hdll
, "CreateUrlCacheContainerA");
1306 pCreateUrlCacheContainerW
= (void*)GetProcAddress(hdll
, "CreateUrlCacheContainerW");
1307 pInternetTimeFromSystemTimeA
= (void*)GetProcAddress(hdll
, "InternetTimeFromSystemTimeA");
1308 pInternetTimeFromSystemTimeW
= (void*)GetProcAddress(hdll
, "InternetTimeFromSystemTimeW");
1309 pInternetTimeToSystemTimeA
= (void*)GetProcAddress(hdll
, "InternetTimeToSystemTimeA");
1310 pInternetTimeToSystemTimeW
= (void*)GetProcAddress(hdll
, "InternetTimeToSystemTimeW");
1311 pIsDomainLegalCookieDomainW
= (void*)GetProcAddress(hdll
, (LPCSTR
)117);
1312 pPrivacyGetZonePreferenceW
= (void*)GetProcAddress(hdll
, "PrivacyGetZonePreferenceW");
1313 pPrivacySetZonePreferenceW
= (void*)GetProcAddress(hdll
, "PrivacySetZonePreferenceW");
1315 test_InternetCanonicalizeUrlA();
1316 test_InternetQueryOptionA();
1318 test_complicated_cookie();
1321 test_Option_PerConnectionOption();
1322 test_Option_PerConnectionOptionA();
1323 test_InternetErrorDlg();
1325 if (!pInternetTimeFromSystemTimeA
)
1326 win_skip("skipping the InternetTime tests\n");
1329 InternetTimeFromSystemTimeA_test();
1330 InternetTimeFromSystemTimeW_test();
1331 InternetTimeToSystemTimeA_test();
1332 InternetTimeToSystemTimeW_test();
1334 if (pIsDomainLegalCookieDomainW
&&
1335 ((void*)pIsDomainLegalCookieDomainW
== (void*)pCreateUrlCacheContainerA
||
1336 (void*)pIsDomainLegalCookieDomainW
== (void*)pCreateUrlCacheContainerW
))
1337 win_skip("IsDomainLegalCookieDomainW is not available on systems with IE5\n");
1338 else if (!pIsDomainLegalCookieDomainW
)
1339 win_skip("IsDomainLegalCookieDomainW (or ordinal 117) is not available\n");
1341 test_IsDomainLegalCookieDomainW();
1343 if (pPrivacyGetZonePreferenceW
&& pPrivacySetZonePreferenceW
)
1344 test_PrivacyGetSetZonePreferenceW();
1346 win_skip("Privacy[SG]etZonePreferenceW are not available\n");
1348 test_InternetSetOption();