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 /* ############################### */
46 static void test_InternetCanonicalizeUrlA(void)
54 /* Acrobat Updater 5 calls this for Adobe Reader 8.1 */
55 url = "http://swupmf.adobe.com/manifest/50/win/AdobeUpdater.upd";
56 urllen = lstrlenA(url);
58 memset(buffer, '#', sizeof(buffer)-1);
59 buffer[sizeof(buffer)-1] = '\0';
60 dwSize = 1; /* Acrobat Updater use this size */
61 SetLastError(0xdeadbeef);
62 res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
63 ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
64 "got %u and %u with size %u for '%s' (%d)\n",
65 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
68 /* buffer has no space for the terminating '\0' */
69 memset(buffer, '#', sizeof(buffer)-1);
70 buffer[sizeof(buffer)-1] = '\0';
72 SetLastError(0xdeadbeef);
73 res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
74 /* dwSize is nr. of needed bytes with the terminating '\0' */
75 ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
76 "got %u and %u with size %u for '%s' (%d)\n",
77 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
79 /* buffer has the required size */
80 memset(buffer, '#', sizeof(buffer)-1);
81 buffer[sizeof(buffer)-1] = '\0';
83 SetLastError(0xdeadbeef);
84 res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
85 /* dwSize is nr. of copied bytes without the terminating '\0' */
86 ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
87 "got %u and %u with size %u for '%s' (%d)\n",
88 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
90 memset(buffer, '#', sizeof(buffer)-1);
91 buffer[sizeof(buffer)-1] = '\0';
92 dwSize = sizeof(buffer);
93 SetLastError(0xdeadbeef);
94 res = InternetCanonicalizeUrlA("file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml", buffer, &dwSize, ICU_DECODE | ICU_NO_ENCODE);
95 ok(res, "InternetCanonicalizeUrlA failed %u\n", GetLastError());
96 ok(dwSize == lstrlenA(buffer), "got %d expected %d\n", dwSize, lstrlenA(buffer));
97 ok(!lstrcmpA("file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", buffer),
98 "got %s expected 'file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml'\n", buffer);
100 /* buffer is larger as the required size */
101 memset(buffer, '#', sizeof(buffer)-1);
102 buffer[sizeof(buffer)-1] = '\0';
104 SetLastError(0xdeadbeef);
105 res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
106 /* dwSize is nr. of copied bytes without the terminating '\0' */
107 ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
108 "got %u and %u with size %u for '%s' (%d)\n",
109 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
112 /* check NULL pointers */
113 memset(buffer, '#', urllen + 4);
114 buffer[urllen + 4] = '\0';
116 SetLastError(0xdeadbeef);
117 res = InternetCanonicalizeUrlA(NULL, buffer, &dwSize, 0);
118 ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
119 "got %u and %u with size %u for '%s' (%d)\n",
120 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
122 memset(buffer, '#', urllen + 4);
123 buffer[urllen + 4] = '\0';
125 SetLastError(0xdeadbeef);
126 res = InternetCanonicalizeUrlA(url, NULL, &dwSize, 0);
127 ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
128 "got %u and %u with size %u for '%s' (%d)\n",
129 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
131 memset(buffer, '#', urllen + 4);
132 buffer[urllen + 4] = '\0';
134 SetLastError(0xdeadbeef);
135 res = InternetCanonicalizeUrlA(url, buffer, NULL, 0);
136 ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
137 "got %u and %u with size %u for '%s' (%d)\n",
138 res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
140 /* test with trailing space */
142 res = InternetCanonicalizeUrlA("http://www.winehq.org/index.php?x= ", buffer, &dwSize, ICU_BROWSER_MODE);
143 ok(res == 1, "InternetCanonicalizeUrlA failed\n");
144 ok(!strcmp(buffer, "http://www.winehq.org/index.php?x="), "Trailing space should have been stripped even in ICU_BROWSER_MODE (%s)\n", buffer);
146 res = InternetSetOptionA(NULL, 0xdeadbeef, buffer, sizeof(buffer));
147 ok(!res, "InternetSetOptionA succeeded\n");
148 ok(GetLastError() == ERROR_INTERNET_INVALID_OPTION,
149 "InternetSetOptionA failed %u, expected ERROR_INTERNET_INVALID_OPTION\n", GetLastError());
152 /* ############################### */
154 static void test_InternetQueryOptionA(void)
156 HINTERNET hinet,hurl;
159 static const char useragent[] = {"Wininet Test"};
164 hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
165 ok((hinet != 0x0),"InternetOpen Failed\n");
167 SetLastError(0xdeadbeef);
168 retval=InternetQueryOptionA(NULL,INTERNET_OPTION_USER_AGENT,NULL,&len);
170 ok(retval == 0,"Got wrong return value %d\n",retval);
171 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code%d\n",err);
173 SetLastError(0xdeadbeef);
174 len=strlen(useragent)+1;
175 retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
177 ok(len == strlen(useragent)+1,"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
178 ok(retval == 0,"Got wrong return value %d\n",retval);
179 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %d\n",err);
181 SetLastError(0xdeadbeef);
182 len=strlen(useragent)+1;
183 buffer=HeapAlloc(GetProcessHeap(),0,len);
184 retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,buffer,&len);
186 ok(retval == 1,"Got wrong return value %d\n",retval);
189 ok(!strcmp(useragent,buffer),"Got wrong user agent string %s instead of %s\n",buffer,useragent);
190 ok(len == strlen(useragent),"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
192 ok(err == 0xdeadbeef, "Got wrong error code %d\n",err);
193 HeapFree(GetProcessHeap(),0,buffer);
195 SetLastError(0xdeadbeef);
197 buffer=HeapAlloc(GetProcessHeap(),0,100);
198 retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,buffer,&len);
200 ok(len == strlen(useragent) + 1,"Got wrong user agent length %d instead of %d\n", len, lstrlenA(useragent) + 1);
201 ok(!retval, "Got wrong return value %d\n", retval);
202 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %d\n", err);
203 HeapFree(GetProcessHeap(),0,buffer);
205 hurl = InternetConnectA(hinet,"www.winehq.org",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
207 SetLastError(0xdeadbeef);
209 retval = InternetQueryOptionA(hurl,INTERNET_OPTION_USER_AGENT,NULL,&len);
211 ok(len == 0,"Got wrong user agent length %d instead of 0\n",len);
212 ok(retval == 0,"Got wrong return value %d\n",retval);
213 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
215 SetLastError(0xdeadbeef);
217 retval = InternetQueryOptionA(hurl,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len);
218 err = GetLastError();
219 ok(retval == 0,"Got wrong return value %d\n",retval);
220 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
221 ok(len == sizeof(DWORD), "len = %d\n", len);
223 SetLastError(0xdeadbeef);
225 retval = InternetQueryOptionA(NULL,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len);
226 err = GetLastError();
227 ok(retval == 0,"Got wrong return value %d\n",retval);
228 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
229 ok(!len, "len = %d\n", len);
231 InternetCloseHandle(hurl);
232 InternetCloseHandle(hinet);
234 hinet = InternetOpenA("",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
235 ok((hinet != 0x0),"InternetOpen Failed\n");
237 SetLastError(0xdeadbeef);
239 retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
241 ok(len == 1,"Got wrong user agent length %d instead of %d\n",len,1);
242 ok(retval == 0,"Got wrong return value %d\n",retval);
243 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%d\n",err);
245 InternetCloseHandle(hinet);
248 res = InternetSetOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, sizeof(val));
249 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%u)\n", GetLastError());
252 res = InternetQueryOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
253 ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
254 ok(val == 12345, "val = %d\n", val);
255 ok(len == sizeof(val), "len = %d\n", len);
257 hinet = InternetOpenA(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
258 ok((hinet != 0x0),"InternetOpen Failed\n");
259 SetLastError(0xdeadbeef);
261 retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
263 ok(len == 1,"Got wrong user agent length %d instead of %d\n",len,1);
264 ok(retval == 0,"Got wrong return value %d\n",retval);
265 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%d\n",err);
269 res = InternetQueryOptionA(hinet, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
270 ok(!res, "InternetQueryOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
271 ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %u\n", GetLastError());
274 res = InternetSetOptionA(hinet, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
275 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
276 ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %u\n", GetLastError());
279 res = InternetQueryOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
280 ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
281 ok(val == 12345, "val = %d\n", val);
282 ok(len == sizeof(val), "len = %d\n", len);
285 res = InternetSetOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, sizeof(val));
286 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%u)\n", GetLastError());
289 res = InternetQueryOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
290 ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
291 ok(val == 1, "val = %d\n", val);
292 ok(len == sizeof(val), "len = %d\n", len);
295 res = InternetQueryOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
296 ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
297 ok(val == 12345, "val = %d\n", val);
298 ok(len == sizeof(val), "len = %d\n", len);
300 InternetCloseHandle(hinet);
303 static void test_max_conns(void)
310 res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
311 ok(res,"Got wrong return value %x\n", res);
312 ok(len == sizeof(val), "got %d\n", len);
313 ok(val == 2, "got %d\n", val);
317 res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER, &val, &len);
318 ok(res,"Got wrong return value %x\n", res);
319 ok(len == sizeof(val), "got %d\n", len);
320 ok(val == 4, "got %d\n", val);
323 res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
324 ok(res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) failed: %x\n", res);
328 res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
329 ok(res,"Got wrong return value %x\n", res);
330 ok(len == sizeof(val), "got %d\n", len);
331 ok(val == 3, "got %d\n", val);
334 res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
335 ok(!res || broken(res), /* <= w2k3 */
336 "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER, 0) succeeded\n");
337 if (!res) ok(GetLastError() == ERROR_BAD_ARGUMENTS, "GetLastError() = %u\n", GetLastError());
340 res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val)-1);
341 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
342 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %u\n", GetLastError());
345 res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val)+1);
346 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
347 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %u\n", GetLastError());
350 static void test_get_cookie(void)
355 SetLastError(0xdeadbeef);
356 ret = InternetGetCookie("http://www.example.com", NULL, NULL, &len);
357 ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS,
358 "InternetGetCookie should have failed with %s and error %d\n",
359 ret ? "TRUE" : "FALSE", GetLastError());
363 static void test_complicated_cookie(void)
370 ret = InternetSetCookie("http://www.example.com/bar",NULL,"A=B; domain=.example.com");
371 ok(ret == TRUE,"InternetSetCookie failed\n");
372 ret = InternetSetCookie("http://www.example.com/bar",NULL,"C=D; domain=.example.com; path=/");
373 ok(ret == TRUE,"InternetSetCookie failed\n");
375 /* Technically illegal! domain should require 2 dots, but native wininet accepts it */
376 ret = InternetSetCookie("http://www.example.com",NULL,"E=F; domain=example.com");
377 ok(ret == TRUE,"InternetSetCookie failed\n");
378 ret = InternetSetCookie("http://www.example.com",NULL,"G=H; domain=.example.com; path=/foo");
379 ok(ret == TRUE,"InternetSetCookie failed\n");
380 ret = InternetSetCookie("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
381 ok(ret == TRUE,"InternetSetCookie failed\n");
382 ret = InternetSetCookie("http://www.example.com/bar/",NULL,"K=L; domain=.example.com");
383 ok(ret == TRUE,"InternetSetCookie failed\n");
384 ret = InternetSetCookie("http://www.example.com/bar/",NULL,"M=N; domain=.example.com; path=/foo/");
385 ok(ret == TRUE,"InternetSetCookie failed\n");
386 ret = InternetSetCookie("http://www.example.com/bar/",NULL,"O=P; secure; path=/bar");
387 ok(ret == TRUE,"InternetSetCookie failed\n");
390 ret = InternetGetCookie("http://testing.example.com", NULL, buffer, &len);
391 ok(ret == TRUE,"InternetGetCookie failed\n");
392 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
393 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
394 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
395 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
396 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
397 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
398 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
399 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
402 ret = InternetGetCookie("http://testing.example.com/foobar", NULL, buffer, &len);
403 ok(ret == TRUE,"InternetGetCookie failed\n");
404 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
405 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
406 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
407 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
408 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
409 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
410 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
411 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
414 ret = InternetGetCookie("http://testing.example.com/foobar/", NULL, buffer, &len);
415 ok(ret == TRUE,"InternetGetCookie failed\n");
416 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
417 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
418 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
419 ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
420 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
421 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
422 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
423 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
426 ret = InternetGetCookie("http://testing.example.com/foo/bar", NULL, buffer, &len);
427 ok(ret == TRUE,"InternetGetCookie failed\n");
428 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
429 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
430 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
431 ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
432 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
433 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
434 ok(strstr(buffer,"M=N")!=NULL,"M=N missing\n");
435 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
438 ret = InternetGetCookie("http://testing.example.com/barfoo", NULL, buffer, &len);
439 ok(ret == TRUE,"InternetGetCookie failed\n");
440 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
441 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
442 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
443 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
444 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
445 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
446 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
447 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
450 ret = InternetGetCookie("http://testing.example.com/barfoo/", NULL, buffer, &len);
451 ok(ret == TRUE,"InternetGetCookie failed\n");
452 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
453 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
454 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
455 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
456 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
457 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
458 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
459 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
462 ret = InternetGetCookie("http://testing.example.com/bar/foo", NULL, buffer, &len);
463 ok(ret == TRUE,"InternetGetCookie failed\n");
464 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
465 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
466 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
467 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
468 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
469 ok(strstr(buffer,"K=L")!=NULL,"K=L missing\n");
470 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
471 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
474 static void test_null(void)
477 static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
478 static const WCHAR szEmpty[] = { 0 };
479 static const WCHAR szUrl[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
480 static const WCHAR szUrlEmpty[] = { 'h','t','t','p',':','/','/',0 };
481 static const WCHAR szExpect[] = { 's','e','r','v','e','r',';',' ','s','e','r','v','e','r',0 };
486 SetLastError(0xdeadbeef);
487 hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
488 if (hi == NULL && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
490 win_skip("Internet*W functions are not implemented\n");
493 ok(hi != NULL, "open failed\n");
495 hc = InternetConnectW(hi, NULL, 0, NULL, NULL, 0, 0, 0);
496 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
497 ok(hc == NULL, "connect failed\n");
499 hc = InternetConnectW(hi, NULL, 0, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
500 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
501 ok(hc == NULL, "connect failed\n");
503 hc = InternetConnectW(hi, NULL, 0, NULL, NULL, INTERNET_SERVICE_FTP, 0, 0);
504 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
505 ok(hc == NULL, "connect failed\n");
507 hc = InternetConnectW(NULL, szServer, 0, NULL, NULL, INTERNET_SERVICE_FTP, 0, 0);
508 ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error\n");
509 ok(hc == NULL, "connect failed\n");
511 hc = InternetOpenUrlW(hi, NULL, NULL, 0, 0, 0);
512 ok(GetLastError() == ERROR_INVALID_PARAMETER ||
513 GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
514 ok(hc == NULL, "connect failed\n");
516 hc = InternetOpenUrlW(hi, szServer, NULL, 0, 0, 0);
517 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
518 ok(hc == NULL, "connect failed\n");
520 InternetCloseHandle(hi);
522 r = InternetSetCookieW(NULL, NULL, NULL);
523 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
524 ok(r == FALSE, "return wrong\n");
526 r = InternetSetCookieW(szServer, NULL, NULL);
527 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
528 ok(r == FALSE, "return wrong\n");
530 r = InternetSetCookieW(szUrl, szServer, NULL);
531 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
532 ok(r == FALSE, "return wrong\n");
534 r = InternetSetCookieW(szUrl, szServer, szServer);
535 ok(r == TRUE, "return wrong\n");
537 r = InternetSetCookieW(szUrl, NULL, szServer);
538 ok(r == TRUE, "return wrong\n");
540 r = InternetSetCookieW(szUrl, szServer, szEmpty);
541 ok(r == TRUE, "return wrong\n");
543 r = InternetSetCookieW(szUrlEmpty, szServer, szServer);
544 ok(r == FALSE, "return wrong\n");
546 r = InternetSetCookieW(szServer, NULL, szServer);
548 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
550 ok(r == FALSE, "return wrong\n");
553 r = InternetGetCookieW(NULL, NULL, NULL, &sz);
554 ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME,
555 "wrong error %u\n", GetLastError());
556 ok( r == FALSE, "return wrong\n");
558 r = InternetGetCookieW(szServer, NULL, NULL, &sz);
560 ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME, "wrong error\n");
562 ok( r == FALSE, "return wrong\n");
565 r = InternetGetCookieW(szUrlEmpty, szServer, NULL, &sz);
566 ok( r == FALSE, "return wrong\n");
569 r = InternetGetCookieW(szUrl, szServer, NULL, &sz);
570 ok( r == TRUE, "return wrong\n");
572 /* sz is 14 on XP SP2 and beyond, 30 on XP SP1 and before */
573 ok( sz == 14 || sz == 30, "sz wrong, got %u, expected 14 or 30\n", sz);
576 memset(buffer, 0, sizeof buffer);
577 r = InternetGetCookieW(szUrl, szServer, buffer, &sz);
578 ok( r == TRUE, "return wrong\n");
580 /* sz == lstrlenW(buffer) only in XP SP1 */
581 ok( sz == 1 + lstrlenW(buffer) || sz == lstrlenW(buffer), "sz wrong %d\n", sz);
583 /* before XP SP2, buffer is "server; server" */
584 ok( !lstrcmpW(szExpect, buffer) || !lstrcmpW(szServer, buffer), "cookie data wrong\n");
587 r = InternetQueryOptionA(NULL, INTERNET_OPTION_CONNECTED_STATE, buffer, &sz);
588 ok(r == TRUE, "ret %d\n", r);
591 static void test_version(void)
593 INTERNET_VERSION_INFO version;
597 size = sizeof(version);
598 res = InternetQueryOptionA(NULL, INTERNET_OPTION_VERSION, &version, &size);
599 ok(res, "Could not get version: %u\n", GetLastError());
600 ok(version.dwMajorVersion == 1, "dwMajorVersion=%d, expected 1\n", version.dwMajorVersion);
601 ok(version.dwMinorVersion == 2, "dwMinorVersion=%d, expected 2\n", version.dwMinorVersion);
604 static void InternetTimeFromSystemTimeA_test(void)
607 static const SYSTEMTIME time = { 2005, 1, 5, 7, 12, 6, 35, 0 };
608 char string[INTERNET_RFC1123_BUFSIZE];
609 static const char expect[] = "Fri, 07 Jan 2005 12:06:35 GMT";
612 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
613 ok( ret, "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
615 ok( !memcmp( string, expect, sizeof(expect) ),
616 "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
618 /* test NULL time parameter */
619 SetLastError(0xdeadbeef);
620 ret = pInternetTimeFromSystemTimeA( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
621 error = GetLastError();
622 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
623 ok( error == ERROR_INVALID_PARAMETER,
624 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
627 /* test NULL string parameter */
628 SetLastError(0xdeadbeef);
629 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
630 error = GetLastError();
631 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
632 ok( error == ERROR_INVALID_PARAMETER,
633 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
636 /* test invalid format parameter */
637 SetLastError(0xdeadbeef);
638 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
639 error = GetLastError();
640 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
641 ok( error == ERROR_INVALID_PARAMETER,
642 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
645 /* test too small buffer size */
646 SetLastError(0xdeadbeef);
647 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, 0 );
648 error = GetLastError();
649 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
650 ok( error == ERROR_INSUFFICIENT_BUFFER,
651 "InternetTimeFromSystemTimeA failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
655 static void InternetTimeFromSystemTimeW_test(void)
658 static const SYSTEMTIME time = { 2005, 1, 5, 7, 12, 6, 35, 0 };
659 WCHAR string[INTERNET_RFC1123_BUFSIZE + 1];
660 static const WCHAR expect[] = { 'F','r','i',',',' ','0','7',' ','J','a','n',' ','2','0','0','5',' ',
661 '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
664 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
665 ok( ret, "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
667 ok( !memcmp( string, expect, sizeof(expect) ),
668 "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
670 /* test NULL time parameter */
671 SetLastError(0xdeadbeef);
672 ret = pInternetTimeFromSystemTimeW( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
673 error = GetLastError();
674 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
675 ok( error == ERROR_INVALID_PARAMETER,
676 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
679 /* test NULL string parameter */
680 SetLastError(0xdeadbeef);
681 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
682 error = GetLastError();
683 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
684 ok( error == ERROR_INVALID_PARAMETER,
685 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
688 /* test invalid format parameter */
689 SetLastError(0xdeadbeef);
690 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
691 error = GetLastError();
692 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
693 ok( error == ERROR_INVALID_PARAMETER,
694 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
697 /* test too small buffer size */
698 SetLastError(0xdeadbeef);
699 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string)/sizeof(string[0]) );
700 error = GetLastError();
701 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
702 ok( error == ERROR_INSUFFICIENT_BUFFER,
703 "InternetTimeFromSystemTimeW failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
707 static void InternetTimeToSystemTimeA_test(void)
711 static const SYSTEMTIME expect = { 2005, 1, 5, 7, 12, 6, 35, 0 };
712 static const char string[] = "Fri, 07 Jan 2005 12:06:35 GMT";
713 static const char string2[] = " fri 7 jan 2005 12 06 35";
715 ret = pInternetTimeToSystemTimeA( string, &time, 0 );
716 ok( ret, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
717 ok( !memcmp( &time, &expect, sizeof(expect) ),
718 "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
720 ret = pInternetTimeToSystemTimeA( string2, &time, 0 );
721 ok( ret, "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
722 ok( !memcmp( &time, &expect, sizeof(expect) ),
723 "InternetTimeToSystemTimeA failed (%u)\n", GetLastError() );
726 static void InternetTimeToSystemTimeW_test(void)
730 static const SYSTEMTIME expect = { 2005, 1, 5, 7, 12, 6, 35, 0 };
731 static const WCHAR string[] = { 'F','r','i',',',' ','0','7',' ','J','a','n',' ','2','0','0','5',' ',
732 '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
733 static const WCHAR string2[] = { ' ','f','r','i',' ','7',' ','j','a','n',' ','2','0','0','5',' ',
734 '1','2',' ','0','6',' ','3','5',0 };
735 static const WCHAR string3[] = { 'F','r',0 };
737 ret = pInternetTimeToSystemTimeW( NULL, NULL, 0 );
738 ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
740 ret = pInternetTimeToSystemTimeW( NULL, &time, 0 );
741 ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
743 ret = pInternetTimeToSystemTimeW( string, NULL, 0 );
744 ok( !ret, "InternetTimeToSystemTimeW succeeded (%u)\n", GetLastError() );
746 ret = pInternetTimeToSystemTimeW( string, &time, 0 );
747 ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
749 ret = pInternetTimeToSystemTimeW( string, &time, 0 );
750 ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
751 ok( !memcmp( &time, &expect, sizeof(expect) ),
752 "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
754 ret = pInternetTimeToSystemTimeW( string2, &time, 0 );
755 ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
756 ok( !memcmp( &time, &expect, sizeof(expect) ),
757 "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
759 ret = pInternetTimeToSystemTimeW( string3, &time, 0 );
760 ok( ret, "InternetTimeToSystemTimeW failed (%u)\n", GetLastError() );
763 static void test_IsDomainLegalCookieDomainW(void)
767 static const WCHAR empty[] = {0};
768 static const WCHAR dot[] = {'.',0};
769 static const WCHAR uk[] = {'u','k',0};
770 static const WCHAR com[] = {'c','o','m',0};
771 static const WCHAR dot_com[] = {'.','c','o','m',0};
772 static const WCHAR gmail_com[] = {'g','m','a','i','l','.','c','o','m',0};
773 static const WCHAR dot_gmail_com[] = {'.','g','m','a','i','l','.','c','o','m',0};
774 static const WCHAR mail_gmail_com[] = {'m','a','i','l','.','g','m','a','i','l','.','c','o','m',0};
775 static const WCHAR gmail_co_uk[] = {'g','m','a','i','l','.','c','o','.','u','k',0};
776 static const WCHAR co_uk[] = {'c','o','.','u','k',0};
777 static const WCHAR dot_co_uk[] = {'.','c','o','.','u','k',0};
779 SetLastError(0xdeadbeef);
780 ret = pIsDomainLegalCookieDomainW(NULL, NULL);
781 error = GetLastError();
782 if (!ret && error == ERROR_CALL_NOT_IMPLEMENTED)
784 win_skip("IsDomainLegalCookieDomainW is not implemented\n");
788 broken(ret), /* IE6 */
789 "IsDomainLegalCookieDomainW succeeded\n");
790 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
792 SetLastError(0xdeadbeef);
793 ret = pIsDomainLegalCookieDomainW(com, NULL);
794 error = GetLastError();
795 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
796 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
798 SetLastError(0xdeadbeef);
799 ret = pIsDomainLegalCookieDomainW(NULL, gmail_com);
800 error = GetLastError();
801 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
802 ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
804 SetLastError(0xdeadbeef);
805 ret = pIsDomainLegalCookieDomainW(empty, gmail_com);
806 error = GetLastError();
807 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
808 ok(error == ERROR_INVALID_NAME ||
809 broken(error == ERROR_INVALID_PARAMETER), /* IE6 */
810 "got %u expected ERROR_INVALID_NAME\n", error);
812 SetLastError(0xdeadbeef);
813 ret = pIsDomainLegalCookieDomainW(com, empty);
814 error = GetLastError();
815 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
816 ok(error == ERROR_INVALID_NAME ||
817 broken(error == ERROR_INVALID_PARAMETER), /* IE6 */
818 "got %u expected ERROR_INVALID_NAME\n", error);
820 SetLastError(0xdeadbeef);
821 ret = pIsDomainLegalCookieDomainW(gmail_com, dot);
822 error = GetLastError();
823 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
824 ok(error == ERROR_INVALID_NAME ||
825 broken(error == 0xdeadbeef), /* IE6 */
826 "got %u expected ERROR_INVALID_NAME\n", error);
828 SetLastError(0xdeadbeef);
829 ret = pIsDomainLegalCookieDomainW(dot, gmail_com);
830 error = GetLastError();
831 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
832 ok(error == ERROR_INVALID_NAME ||
833 broken(error == 0xdeadbeef), /* IE6 */
834 "got %u expected ERROR_INVALID_NAME\n", error);
836 SetLastError(0xdeadbeef);
837 ret = pIsDomainLegalCookieDomainW(com, com);
838 error = GetLastError();
839 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
840 ok(error == 0xdeadbeef, "got %u expected 0xdeadbeef\n", error);
842 SetLastError(0xdeadbeef);
843 ret = pIsDomainLegalCookieDomainW(com, dot_com);
844 error = GetLastError();
845 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
846 ok(error == ERROR_INVALID_NAME ||
847 broken(error == 0xdeadbeef), /* IE6 */
848 "got %u expected ERROR_INVALID_NAME\n", error);
850 SetLastError(0xdeadbeef);
851 ret = pIsDomainLegalCookieDomainW(dot_com, com);
852 error = GetLastError();
853 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
854 ok(error == ERROR_INVALID_NAME ||
855 broken(error == 0xdeadbeef), /* IE6 */
856 "got %u expected ERROR_INVALID_NAME\n", error);
858 SetLastError(0xdeadbeef);
859 ret = pIsDomainLegalCookieDomainW(com, gmail_com);
860 error = GetLastError();
861 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
862 ok(error == ERROR_SXS_KEY_NOT_FOUND ||
863 error == ERROR_SUCCESS || /* IE8 on W2K3 */
864 error == 0xdeadbeef, /* up to IE7 */
865 "unexpected error: %u\n", error);
867 ret = pIsDomainLegalCookieDomainW(gmail_com, gmail_com);
868 ok(ret, "IsDomainLegalCookieDomainW failed\n");
870 SetLastError(0xdeadbeef);
871 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, co_uk);
872 error = GetLastError();
873 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
874 ok(error == ERROR_SXS_KEY_NOT_FOUND || /* IE8 on XP */
875 error == ERROR_FILE_NOT_FOUND || /* IE8 on Vista */
876 error == ERROR_SUCCESS || /* IE8 on W2K3 */
877 error == 0xdeadbeef, /* up to IE7 */
878 "unexpected error: %u\n", error);
880 ret = pIsDomainLegalCookieDomainW(uk, co_uk);
881 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
883 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, dot_co_uk);
884 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
886 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, gmail_co_uk);
887 ok(ret, "IsDomainLegalCookieDomainW failed\n");
889 ret = pIsDomainLegalCookieDomainW(gmail_com, com);
890 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
892 SetLastError(0xdeadbeef);
893 ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
894 error = GetLastError();
895 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
896 ok(error == ERROR_INVALID_NAME ||
897 broken(error == 0xdeadbeef), /* IE6 */
898 "got %u expected ERROR_INVALID_NAME\n", error);
900 ret = pIsDomainLegalCookieDomainW(gmail_com, mail_gmail_com);
901 ok(ret, "IsDomainLegalCookieDomainW failed\n");
903 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, gmail_com);
904 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
906 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, com);
907 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
909 ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
910 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
912 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, dot_gmail_com);
913 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
916 static void test_PrivacyGetSetZonePreferenceW(void)
918 DWORD ret, zone, type, template, old_template;
922 ret = pPrivacyGetZonePreferenceW(zone, type, NULL, NULL, NULL);
923 ok(ret == 0, "expected ret == 0, got %u\n", ret);
926 ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, NULL, NULL);
927 ok(ret == 0, "expected ret == 0, got %u\n", ret);
930 ret = pPrivacySetZonePreferenceW(zone, type, template, NULL);
931 ok(ret == 0, "expected ret == 0, got %u\n", ret);
934 ret = pPrivacyGetZonePreferenceW(zone, type, &template, NULL, NULL);
935 ok(ret == 0, "expected ret == 0, got %u\n", ret);
936 ok(template == 5, "expected template == 5, got %u\n", template);
939 ret = pPrivacySetZonePreferenceW(zone, type, old_template, NULL);
940 ok(ret == 0, "expected ret == 0, got %u\n", ret);
943 static void test_InternetSetOption(void)
945 HINTERNET ses, con, req;
950 ses = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
951 ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
952 con = InternetConnect(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
953 ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
954 req = HttpOpenRequest(con, "GET", "/", NULL, NULL, NULL, 0, 0);
955 ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
957 /* INTERNET_OPTION_POLICY tests */
958 SetLastError(0xdeadbeef);
959 ret = InternetSetOptionW(ses, INTERNET_OPTION_POLICY, NULL, 0);
960 ok(ret == FALSE, "InternetSetOption should've failed\n");
961 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
962 "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
964 SetLastError(0xdeadbeef);
965 ret = InternetQueryOptionW(ses, INTERNET_OPTION_POLICY, NULL, 0);
966 ok(ret == FALSE, "InternetQueryOption should've failed\n");
967 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
968 "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
970 /* INTERNET_OPTION_ERROR_MASK tests */
971 SetLastError(0xdeadbeef);
972 size = sizeof(ulArg);
973 ret = InternetQueryOptionW(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, &size);
974 ok(ret == FALSE, "InternetQueryOption should've failed\n");
975 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
977 SetLastError(0xdeadbeef);
979 ret = InternetSetOption(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
980 ok(ret == FALSE, "InternetQueryOption should've failed\n");
981 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
983 SetLastError(0xdeadbeef);
985 ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
986 ok(ret == FALSE, "InternetQueryOption should've failed\n");
987 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %d\n", GetLastError());
989 SetLastError(0xdeadbeef);
991 ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
992 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
993 ok(GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
995 SetLastError(0xdeadbeef);
997 ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
998 ok(ret == FALSE, "InternetQueryOption should've failed\n");
999 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
1001 SetLastError(0xdeadbeef);
1003 ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
1004 ok(ret == FALSE, "InternetQueryOption should've failed\n");
1005 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
1007 ret = InternetCloseHandle(req);
1008 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1009 ret = InternetCloseHandle(con);
1010 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1011 ret = InternetCloseHandle(ses);
1012 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1015 #define verifyProxyEnable(e) r_verifyProxyEnable(__LINE__, e)
1016 static void r_verifyProxyEnable(LONG l, DWORD exp)
1019 DWORD type, val, size = sizeof(DWORD);
1021 static const CHAR szInternetSettings[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
1022 static const CHAR szProxyEnable[] = "ProxyEnable";
1024 ret = RegOpenKeyA(HKEY_CURRENT_USER, szInternetSettings, &hkey);
1025 ok_(__FILE__,l) (!ret, "RegOpenKeyA failed: 0x%08x\n", ret);
1027 ret = RegQueryValueExA(hkey, szProxyEnable, 0, &type, (BYTE*)&val, &size);
1028 ok_(__FILE__,l) (!ret, "RegQueryValueExA failed: 0x%08x\n", ret);
1029 ok_(__FILE__,l) (type == REG_DWORD, "Expected regtype to be REG_DWORD, was: %d\n", type);
1030 ok_(__FILE__,l) (val == exp, "Expected ProxyEnabled to be %d, got: %d\n", exp, val);
1032 ret = RegCloseKey(hkey);
1033 ok_(__FILE__,l) (!ret, "RegCloseKey failed: 0x%08x\n", ret);
1036 static void test_Option_PerConnectionOption(void)
1039 DWORD size = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
1040 INTERNET_PER_CONN_OPTION_LISTW list = {size};
1041 INTERNET_PER_CONN_OPTIONW *orig_settings;
1042 static WCHAR proxy_srvW[] = {'p','r','o','x','y','.','e','x','a','m','p','l','e',0};
1044 /* get the global IE proxy server info, to restore later */
1045 list.dwOptionCount = 2;
1046 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW));
1048 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1049 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1051 ret = InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1053 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1054 orig_settings = list.pOptions;
1056 /* set the global IE proxy server */
1057 list.dwOptionCount = 2;
1058 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW));
1060 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1061 list.pOptions[0].Value.pszValue = proxy_srvW;
1062 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1063 list.pOptions[1].Value.dwValue = PROXY_TYPE_PROXY;
1065 ret = InternetSetOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1067 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1069 HeapFree(GetProcessHeap(), 0, list.pOptions);
1071 /* get & verify the global IE proxy server */
1072 list.dwOptionCount = 2;
1073 list.dwOptionError = 0;
1074 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONW));
1076 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1077 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1079 ret = InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1081 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1082 ok(!lstrcmpW(list.pOptions[0].Value.pszValue, proxy_srvW),
1083 "Retrieved proxy server should've been %s, was: %s\n",
1084 wine_dbgstr_w(proxy_srvW), wine_dbgstr_w(list.pOptions[0].Value.pszValue));
1085 ok(list.pOptions[1].Value.dwValue == PROXY_TYPE_PROXY,
1086 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
1087 list.pOptions[1].Value.dwValue);
1088 verifyProxyEnable(1);
1090 HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
1091 HeapFree(GetProcessHeap(), 0, list.pOptions);
1093 /* disable the proxy server */
1094 list.dwOptionCount = 1;
1095 list.pOptions = HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW));
1097 list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
1098 list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT;
1100 ret = InternetSetOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1102 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1104 HeapFree(GetProcessHeap(), 0, list.pOptions);
1106 /* verify that the proxy is disabled */
1107 list.dwOptionCount = 1;
1108 list.dwOptionError = 0;
1109 list.pOptions = HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW));
1111 list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
1113 ret = InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1115 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1116 ok(list.pOptions[0].Value.dwValue == PROXY_TYPE_DIRECT,
1117 "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %d\n",
1118 list.pOptions[0].Value.dwValue);
1119 verifyProxyEnable(0);
1121 HeapFree(GetProcessHeap(), 0, list.pOptions);
1123 /* set the proxy flags to 'invalid' value */
1124 list.dwOptionCount = 1;
1125 list.pOptions = HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW));
1127 list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
1128 list.pOptions[0].Value.dwValue = PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT;
1130 ret = InternetSetOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1132 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1134 HeapFree(GetProcessHeap(), 0, list.pOptions);
1136 /* verify that the proxy is enabled */
1137 list.dwOptionCount = 1;
1138 list.dwOptionError = 0;
1139 list.pOptions = HeapAlloc(GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW));
1141 list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
1143 ret = InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1145 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1146 todo_wine ok(list.pOptions[0].Value.dwValue == (PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT),
1147 "Retrieved flags should've been PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT, was: %d\n",
1148 list.pOptions[0].Value.dwValue);
1149 verifyProxyEnable(1);
1151 HeapFree(GetProcessHeap(), 0, list.pOptions);
1153 /* restore original settings */
1154 list.dwOptionCount = 2;
1155 list.pOptions = orig_settings;
1157 ret = InternetSetOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1159 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1161 HeapFree(GetProcessHeap(), 0, list.pOptions);
1164 static void test_Option_PerConnectionOptionA(void)
1167 DWORD size = sizeof(INTERNET_PER_CONN_OPTION_LISTA);
1168 INTERNET_PER_CONN_OPTION_LISTA list = {size};
1169 INTERNET_PER_CONN_OPTIONA *orig_settings;
1170 char proxy_srv[] = "proxy.example";
1172 /* get the global IE proxy server info, to restore later */
1173 list.dwOptionCount = 2;
1174 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA));
1176 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1177 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1179 ret = InternetQueryOptionA(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1181 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1182 orig_settings = list.pOptions;
1184 /* set the global IE proxy server */
1185 list.dwOptionCount = 2;
1186 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA));
1188 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1189 list.pOptions[0].Value.pszValue = proxy_srv;
1190 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1191 list.pOptions[1].Value.dwValue = PROXY_TYPE_PROXY;
1193 ret = InternetSetOptionA(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1195 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1197 HeapFree(GetProcessHeap(), 0, list.pOptions);
1199 /* get & verify the global IE proxy server */
1200 list.dwOptionCount = 2;
1201 list.dwOptionError = 0;
1202 list.pOptions = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(INTERNET_PER_CONN_OPTIONA));
1204 list.pOptions[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1205 list.pOptions[1].dwOption = INTERNET_PER_CONN_FLAGS;
1207 ret = InternetQueryOptionA(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1209 ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
1210 ok(!lstrcmpA(list.pOptions[0].Value.pszValue, "proxy.example"),
1211 "Retrieved proxy server should've been \"%s\", was: \"%s\"\n",
1212 proxy_srv, list.pOptions[0].Value.pszValue);
1213 ok(list.pOptions[1].Value.dwValue == PROXY_TYPE_PROXY,
1214 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
1215 list.pOptions[1].Value.dwValue);
1217 HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
1218 HeapFree(GetProcessHeap(), 0, list.pOptions);
1220 /* restore original settings */
1221 list.dwOptionCount = 2;
1222 list.pOptions = orig_settings;
1224 ret = InternetSetOptionA(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
1226 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1228 HeapFree(GetProcessHeap(), 0, list.pOptions);
1231 #define FLAG_TODO 0x1
1232 #define FLAG_NEEDREQ 0x2
1233 #define FLAG_UNIMPL 0x4
1235 static void test_InternetErrorDlg(void)
1237 HINTERNET ses, con, req;
1241 static const struct {
1246 { ERROR_INTERNET_INCORRECT_PASSWORD , ERROR_SUCCESS, FLAG_NEEDREQ },
1247 { ERROR_INTERNET_SEC_CERT_DATE_INVALID , ERROR_CANCELLED, 0 },
1248 { ERROR_INTERNET_SEC_CERT_CN_INVALID , ERROR_CANCELLED, 0 },
1249 { ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR , ERROR_SUCCESS, 0 },
1250 { ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR , ERROR_SUCCESS, FLAG_TODO },
1251 { ERROR_INTERNET_MIXED_SECURITY , ERROR_CANCELLED, FLAG_TODO },
1252 { ERROR_INTERNET_CHG_POST_IS_NON_SECURE , ERROR_CANCELLED, FLAG_TODO },
1253 { ERROR_INTERNET_POST_IS_NON_SECURE , ERROR_SUCCESS, 0 },
1254 { ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED, ERROR_CANCELLED, FLAG_NEEDREQ|FLAG_TODO },
1255 { ERROR_INTERNET_INVALID_CA , ERROR_CANCELLED, 0 },
1256 { ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR, ERROR_CANCELLED, FLAG_TODO },
1257 { ERROR_INTERNET_INSERT_CDROM , ERROR_CANCELLED, FLAG_TODO|FLAG_NEEDREQ|FLAG_UNIMPL },
1258 { ERROR_INTERNET_SEC_CERT_ERRORS , ERROR_CANCELLED, 0 },
1259 { ERROR_INTERNET_SEC_CERT_REV_FAILED , ERROR_CANCELLED, 0 },
1260 { ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION , ERROR_HTTP_COOKIE_DECLINED, FLAG_TODO },
1261 { ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT , ERROR_CANCELLED, FLAG_TODO },
1262 { ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT, ERROR_CANCELLED, FLAG_TODO },
1263 { ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION, ERROR_CANCELLED, FLAG_TODO },
1264 { ERROR_INTERNET_SEC_CERT_REVOKED , ERROR_CANCELLED, 0 },
1265 { 0, ERROR_NOT_SUPPORTED }
1270 res = InternetErrorDlg(NULL, NULL, 12055, flags, NULL);
1271 ok(res == ERROR_INVALID_HANDLE, "Got %d\n", res);
1273 ses = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
1274 ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
1275 con = InternetConnect(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
1276 ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
1277 req = HttpOpenRequest(con, "GET", "/", NULL, NULL, NULL, 0, 0);
1278 ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
1280 /* NULL hwnd and FLAGS_ERROR_UI_FLAGS_NO_UI not set */
1281 for(i = INTERNET_ERROR_BASE; i < INTERNET_ERROR_LAST; i++)
1283 res = InternetErrorDlg(NULL, req, i, flags, NULL);
1284 ok(res == ERROR_INVALID_HANDLE, "Got %d (%d)\n", res, i);
1287 hwnd = GetDesktopWindow();
1288 ok(hwnd != NULL, "GetDesktopWindow failed (%d)\n", GetLastError());
1290 flags = FLAGS_ERROR_UI_FLAGS_NO_UI;
1291 for(i = INTERNET_ERROR_BASE; i < INTERNET_ERROR_LAST; i++)
1293 DWORD expected, test_flags, j;
1295 for(j = 0; no_ui_res[j].error != 0; ++j)
1296 if(no_ui_res[j].error == i)
1299 test_flags = no_ui_res[j].test_flags;
1300 expected = no_ui_res[j].res;
1302 /* Try an invalid request handle */
1303 res = InternetErrorDlg(hwnd, (HANDLE)0xdeadbeef, i, flags, NULL);
1304 if(res == ERROR_CALL_NOT_IMPLEMENTED)
1306 ok(test_flags & FLAG_UNIMPL, "%i is unexpectedly unimplemented.\n", i);
1310 ok(res == ERROR_INVALID_HANDLE, "Got %d (%d)\n", res, i);
1312 /* With a valid req */
1313 if(i == ERROR_INTERNET_NEED_UI)
1314 continue; /* Crashes on windows XP */
1316 if(i == ERROR_INTERNET_SEC_CERT_REVOKED)
1317 continue; /* Interactive (XP, Win7) */
1319 res = InternetErrorDlg(hwnd, req, i, flags, NULL);
1321 /* Handle some special cases */
1324 case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR:
1325 case ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR:
1326 if(res == ERROR_CANCELLED)
1328 /* Some windows XP, w2k3 x64, W2K8 */
1329 win_skip("Skipping some tests for %d\n", i);
1333 case ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED:
1336 /* Windows XP, W2K3 */
1337 ok(res == NTE_PROV_TYPE_NOT_DEF, "Got %d\n", res);
1338 win_skip("Skipping some tests for %d\n", i);
1345 if(test_flags & FLAG_TODO)
1346 todo_wine ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1348 ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1350 /* Same thing with NULL hwnd */
1351 res = InternetErrorDlg(NULL, req, i, flags, NULL);
1352 if(test_flags & FLAG_TODO)
1353 todo_wine ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1355 ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1358 /* With a null req */
1359 if(test_flags & FLAG_NEEDREQ)
1360 expected = ERROR_INVALID_PARAMETER;
1362 res = InternetErrorDlg(hwnd, NULL, i, flags, NULL);
1363 if( test_flags & FLAG_TODO || i == ERROR_INTERNET_INCORRECT_PASSWORD)
1364 todo_wine ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1366 ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
1369 res = InternetCloseHandle(req);
1370 ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1371 res = InternetCloseHandle(con);
1372 ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1373 res = InternetCloseHandle(ses);
1374 ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
1377 /* ############################### */
1379 START_TEST(internet)
1382 hdll = GetModuleHandleA("wininet.dll");
1384 if(!GetProcAddress(hdll, "InternetGetCookieExW")) {
1385 win_skip("Too old IE (older than 6.0)\n");
1389 pCreateUrlCacheContainerA = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerA");
1390 pCreateUrlCacheContainerW = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerW");
1391 pInternetTimeFromSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeA");
1392 pInternetTimeFromSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeW");
1393 pInternetTimeToSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeA");
1394 pInternetTimeToSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeW");
1395 pIsDomainLegalCookieDomainW = (void*)GetProcAddress(hdll, (LPCSTR)117);
1396 pPrivacyGetZonePreferenceW = (void*)GetProcAddress(hdll, "PrivacyGetZonePreferenceW");
1397 pPrivacySetZonePreferenceW = (void*)GetProcAddress(hdll, "PrivacySetZonePreferenceW");
1399 test_InternetCanonicalizeUrlA();
1400 test_InternetQueryOptionA();
1402 test_complicated_cookie();
1405 test_Option_PerConnectionOption();
1406 test_Option_PerConnectionOptionA();
1407 test_InternetErrorDlg();
1410 if (!pInternetTimeFromSystemTimeA)
1411 win_skip("skipping the InternetTime tests\n");
1414 InternetTimeFromSystemTimeA_test();
1415 InternetTimeFromSystemTimeW_test();
1416 InternetTimeToSystemTimeA_test();
1417 InternetTimeToSystemTimeW_test();
1419 if (pIsDomainLegalCookieDomainW &&
1420 ((void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerA ||
1421 (void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerW))
1422 win_skip("IsDomainLegalCookieDomainW is not available on systems with IE5\n");
1423 else if (!pIsDomainLegalCookieDomainW)
1424 win_skip("IsDomainLegalCookieDomainW (or ordinal 117) is not available\n");
1426 test_IsDomainLegalCookieDomainW();
1428 if (pPrivacyGetZonePreferenceW && pPrivacySetZonePreferenceW)
1429 test_PrivacyGetSetZonePreferenceW();
1431 win_skip("Privacy[SG]etZonePreferenceW are not available\n");
1433 test_InternetSetOption();