ReactOS 0.4.17-dev-1190-g4c812f4
internet.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wininet.h"
#include "winineti.h"
#include "winerror.h"
#include "winreg.h"
#include "winnls.h"
#include "wchar.h"
#include "wine/test.h"
Include dependency graph for internet.c:

Go to the source code of this file.

Macros

#define ERROR_WINHTTP_AUTODETECTION_FAILED   12180
 
#define FLAG_NEEDREQ   0x1
 
#define FLAG_UNIMPL   0x2
 

Functions

static BOOL (WINAPI *pCreateUrlCacheContainerA)(DWORD
 
static DWORD (WINAPI *pPrivacyGetZonePreferenceW)(DWORD
 
static void test_InternetCanonicalizeUrlA (void)
 
static void test_InternetQueryOptionA (void)
 
static void test_max_conns (void)
 
static void test_get_cookie (void)
 
static void test_complicated_cookie (void)
 
static void test_cookie_attrs (void)
 
static void test_cookie_url (void)
 
static void test_null (void)
 
static void test_version (void)
 
static void InternetTimeFromSystemTimeA_test (void)
 
static void InternetTimeFromSystemTimeW_test (void)
 
static void test_InternetTimeToSystemTime (void)
 
static void test_IsDomainLegalCookieDomainW (void)
 
static void test_PrivacyGetSetZonePreferenceW (void)
 
static void test_InternetSetOption (void)
 
static void test_end_browser_session (void)
 
static void test_Option_PerConnectionOption (void)
 
static void test_Option_PerConnectionOptionA (void)
 
static void test_InternetErrorDlg (void)
 
static void test_InternetGetConnectedStateExA (void)
 
static void test_InternetGetConnectedStateExW (void)
 
static void test_format_message (HMODULE hdll)
 
 START_TEST (internet)
 

Variables

static DWORD
 
static LPSTR
 
static LPWSTR
 
static LPCWSTR
 
static LPDWORD
 
static LPCSTR
 
static LPVOID
 

Macro Definition Documentation

◆ ERROR_WINHTTP_AUTODETECTION_FAILED

#define ERROR_WINHTTP_AUTODETECTION_FAILED   12180

Definition at line 53 of file internet.c.

◆ FLAG_NEEDREQ

#define FLAG_NEEDREQ   0x1

Definition at line 1616 of file internet.c.

◆ FLAG_UNIMPL

#define FLAG_UNIMPL   0x2

Definition at line 1617 of file internet.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI *  pCreateUrlCacheContainerA)
static

◆ DWORD()

static DWORD ( WINAPI *  pPrivacyGetZonePreferenceW)
static

◆ InternetTimeFromSystemTimeA_test()

static void InternetTimeFromSystemTimeA_test ( void  )
static

Definition at line 997 of file internet.c.

998{
999 BOOL ret;
1000 static const SYSTEMTIME time = { 2005, 1, 5, 7, 12, 6, 35, 0 };
1001 char string[INTERNET_RFC1123_BUFSIZE];
1002 static const char expect[] = "Fri, 07 Jan 2005 12:06:35 GMT";
1003 DWORD error;
1004
1005 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
1006 ok( ret, "InternetTimeFromSystemTimeA failed (%lu)\n", GetLastError() );
1007
1008 ok( !memcmp( string, expect, sizeof(expect) ),
1009 "InternetTimeFromSystemTimeA failed (%lu)\n", GetLastError() );
1010
1011 /* test NULL time parameter */
1012 SetLastError(0xdeadbeef);
1013 ret = pInternetTimeFromSystemTimeA( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
1014 error = GetLastError();
1015 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
1017 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1018 error );
1019
1020 /* test NULL string parameter */
1021 SetLastError(0xdeadbeef);
1022 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
1023 error = GetLastError();
1024 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
1026 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1027 error );
1028
1029 /* test invalid format parameter */
1030 SetLastError(0xdeadbeef);
1031 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
1032 error = GetLastError();
1033 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
1035 "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1036 error );
1037
1038 /* test too small buffer size */
1039 SetLastError(0xdeadbeef);
1040 ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, 0 );
1041 error = GetLastError();
1042 ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
1044 "InternetTimeFromSystemTimeA failed with ERROR_INSUFFICIENT_BUFFER instead of %lu\n",
1045 error );
1046}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
return ret
Definition: mutex.c:147
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define INTERNET_RFC1123_FORMAT
Definition: wininet.h:407
#define INTERNET_RFC1123_BUFSIZE
Definition: wininet.h:408

Referenced by START_TEST().

◆ InternetTimeFromSystemTimeW_test()

static void InternetTimeFromSystemTimeW_test ( void  )
static

Definition at line 1048 of file internet.c.

1049{
1050 BOOL ret;
1051 static const SYSTEMTIME time = { 2005, 1, 5, 7, 12, 6, 35, 0 };
1052 WCHAR string[INTERNET_RFC1123_BUFSIZE + 1];
1053 static const WCHAR expect[] = { 'F','r','i',',',' ','0','7',' ','J','a','n',' ','2','0','0','5',' ',
1054 '1','2',':','0','6',':','3','5',' ','G','M','T',0 };
1055 DWORD error;
1056
1057 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
1058 ok( ret, "InternetTimeFromSystemTimeW failed (%lu)\n", GetLastError() );
1059
1060 ok( !memcmp( string, expect, sizeof(expect) ),
1061 "InternetTimeFromSystemTimeW failed (%lu)\n", GetLastError() );
1062
1063 /* test NULL time parameter */
1064 SetLastError(0xdeadbeef);
1065 ret = pInternetTimeFromSystemTimeW( NULL, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
1066 error = GetLastError();
1067 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
1069 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1070 error );
1071
1072 /* test NULL string parameter */
1073 SetLastError(0xdeadbeef);
1074 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, NULL, sizeof(string) );
1075 error = GetLastError();
1076 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
1078 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1079 error );
1080
1081 /* test invalid format parameter */
1082 SetLastError(0xdeadbeef);
1083 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT + 1, string, sizeof(string) );
1084 error = GetLastError();
1085 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
1087 "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
1088 error );
1089
1090 /* test too small buffer size */
1091 SetLastError(0xdeadbeef);
1092 ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, ARRAY_SIZE(string));
1093 error = GetLastError();
1094 ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
1096 "InternetTimeFromSystemTimeW failed with ERROR_INSUFFICIENT_BUFFER instead of %lu\n",
1097 error );
1098}
#define ARRAY_SIZE(A)
Definition: main.h:20
short WCHAR
Definition: pedump.c:58

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( internet  )

Definition at line 2042 of file internet.c.

2043{
2044 HMODULE hdll;
2045 hdll = GetModuleHandleA("wininet.dll");
2046
2047 pCreateUrlCacheContainerA = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerA");
2048 pCreateUrlCacheContainerW = (void*)GetProcAddress(hdll, "CreateUrlCacheContainerW");
2049 pInternetTimeFromSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeA");
2050 pInternetTimeFromSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeFromSystemTimeW");
2051 pInternetTimeToSystemTimeA = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeA");
2052 pInternetTimeToSystemTimeW = (void*)GetProcAddress(hdll, "InternetTimeToSystemTimeW");
2053 pIsDomainLegalCookieDomainW = (void*)GetProcAddress(hdll, (LPCSTR)117);
2054 pPrivacyGetZonePreferenceW = (void*)GetProcAddress(hdll, "PrivacyGetZonePreferenceW");
2055 pPrivacySetZonePreferenceW = (void*)GetProcAddress(hdll, "PrivacySetZonePreferenceW");
2056 pInternetGetCookieExA = (void*)GetProcAddress(hdll, "InternetGetCookieExA");
2057 pInternetGetCookieExW = (void*)GetProcAddress(hdll, "InternetGetCookieExW");
2058 pInternetGetConnectedStateExA = (void*)GetProcAddress(hdll, "InternetGetConnectedStateExA");
2059 pInternetGetConnectedStateExW = (void*)GetProcAddress(hdll, "InternetGetConnectedStateExW");
2060
2061 if(!pInternetGetCookieExW) {
2062 win_skip("Too old IE (older than 6.0)\n");
2063 return;
2064 }
2065
2074 test_version();
2075 test_null();
2080
2081 if (!pInternetTimeFromSystemTimeA)
2082 win_skip("skipping the InternetTime tests\n");
2083 else
2084 {
2088 }
2089 if (pIsDomainLegalCookieDomainW &&
2090 ((void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerA ||
2091 (void*)pIsDomainLegalCookieDomainW == (void*)pCreateUrlCacheContainerW))
2092 win_skip("IsDomainLegalCookieDomainW is not available on systems with IE5\n");
2093 else if (!pIsDomainLegalCookieDomainW)
2094 win_skip("IsDomainLegalCookieDomainW (or ordinal 117) is not available\n");
2095 else
2097
2098 if (pPrivacyGetZonePreferenceW && pPrivacySetZonePreferenceW)
2100 else
2101 win_skip("Privacy[SG]etZonePreferenceW are not available\n");
2102
2106}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define win_skip
Definition: minitest.h:67
static void test_PrivacyGetSetZonePreferenceW(void)
Definition: internet.c:1290
static void test_Option_PerConnectionOption(void)
Definition: internet.c:1440
static void test_IsDomainLegalCookieDomainW(void)
Definition: internet.c:1174
static void test_get_cookie(void)
Definition: internet.c:560
static void test_InternetQueryOptionA(void)
Definition: internet.c:167
static void test_cookie_url(void)
Definition: internet.c:819
static void test_InternetErrorDlg(void)
Definition: internet.c:1619
static void test_InternetCanonicalizeUrlA(void)
Definition: internet.c:59
static void test_max_conns(void)
Definition: internet.c:513
static void test_InternetSetOption(void)
Definition: internet.c:1326
static void test_InternetGetConnectedStateExA(void)
Definition: internet.c:1768
static void test_Option_PerConnectionOptionA(void)
Definition: internet.c:1539
static void test_InternetTimeToSystemTime(void)
Definition: internet.c:1100
static void test_end_browser_session(void)
Definition: internet.c:1418
static void test_InternetGetConnectedStateExW(void)
Definition: internet.c:1865
static void test_cookie_attrs(void)
Definition: internet.c:764
static void test_complicated_cookie(void)
Definition: internet.c:575
static void test_null(void)
Definition: internet.c:867
static void InternetTimeFromSystemTimeW_test(void)
Definition: internet.c:1048
static void test_version(void)
Definition: internet.c:984
static void test_format_message(HMODULE hdll)
Definition: internet.c:1981
static void InternetTimeFromSystemTimeA_test(void)
Definition: internet.c:997
static PVOID hdll
Definition: shimdbg.c:126
const char * LPCSTR
Definition: typedefs.h:52

◆ test_complicated_cookie()

static void test_complicated_cookie ( void  )
static

Definition at line 575 of file internet.c.

576{
577 DWORD len;
578 BOOL ret;
579
580 CHAR buffer[1024];
581 WCHAR wbuf[1024];
582
583 static const WCHAR testing_example_comW[] =
584 {'h','t','t','p',':','/','/','t','e','s','t','i','n','g','.','e','x','a','m','p','l','e','.','c','o','m',0};
585
586 ret = InternetSetCookieA("http://www.example.com/bar",NULL,"A=B; domain=.example.com");
587 ok(ret == TRUE,"InternetSetCookie failed\n");
588 ret = InternetSetCookieA("http://www.example.com/bar",NULL,"C=D; domain=.example.com; path=/");
589 ok(ret == TRUE,"InternetSetCookie failed\n");
590
591 /* Technically illegal! domain should require 2 dots, but native wininet accepts it */
592 ret = InternetSetCookieA("http://www.example.com",NULL,"E=F; domain=example.com");
593 ok(ret == TRUE,"InternetSetCookie failed\n");
594 ret = InternetSetCookieA("http://www.example.com",NULL,"G=H; domain=.example.com; invalid=attr; path=/foo");
595 ok(ret == TRUE,"InternetSetCookie failed\n");
596 ret = InternetSetCookieA("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
597 ok(ret == TRUE,"InternetSetCookie failed\n");
598 ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"K=L; domain=.example.com");
599 ok(ret == TRUE,"InternetSetCookie failed\n");
600 ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"M=N; domain=.example.com; path=/foo/");
601 ok(ret == TRUE,"InternetSetCookie failed\n");
602 ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"O=P; secure; path=/bar");
603 ok(ret == TRUE,"InternetSetCookie failed\n");
604
605 len = 1024;
606 ret = InternetGetCookieA("http://testing.example.com", NULL, NULL, &len);
607 ok(ret == TRUE,"InternetGetCookie failed\n");
608 ok(len == 19, "len = %lu\n", len);
609
610 len = 1024;
611 memset(buffer, 0xac, sizeof(buffer));
612 ret = InternetGetCookieA("http://testing.example.com", NULL, buffer, &len);
613 ok(ret == TRUE,"InternetGetCookie failed\n");
614 ok(len == 19, "len = %lu\n", len);
615 ok(strlen(buffer) == 18, "strlen(buffer) = %Iu\n", strlen(buffer));
616 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
617 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
618 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
619 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
620 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
621 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
622 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
623 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
624
625 len = 10;
626 memset(buffer, 0xac, sizeof(buffer));
627 ret = InternetGetCookieA("http://testing.example.com", NULL, buffer, &len);
629 "InternetGetCookie returned: %x(%lu), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
630 ok(len == 19, "len = %lu\n", len);
631
632 len = 1024;
633 ret = InternetGetCookieW(testing_example_comW, NULL, NULL, &len);
634 ok(ret == TRUE,"InternetGetCookieW failed\n");
635 ok(len == 38, "len = %lu\n", len);
636
637 len = 1024;
638 memset(wbuf, 0xac, sizeof(wbuf));
639 ret = InternetGetCookieW(testing_example_comW, NULL, wbuf, &len);
640 ok(ret == TRUE,"InternetGetCookieW failed\n");
641 ok(len == 19 || broken(len==18), "len = %lu\n", len);
642 ok(lstrlenW(wbuf) == 18, "strlenW(wbuf) = %u\n", lstrlenW(wbuf));
643
644 len = 10;
645 memset(wbuf, 0xac, sizeof(wbuf));
646 ret = InternetGetCookieW(testing_example_comW, NULL, wbuf, &len);
648 "InternetGetCookieW returned: %x(%lu), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
649 ok(len == 38, "len = %lu\n", len);
650
651 len = 1024;
652 ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
653 ok(ret == TRUE,"InternetGetCookie failed\n");
654 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
655 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
656 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
657 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
658 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
659 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
660 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
661 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
662
663 len = 1024;
664 ret = InternetGetCookieA("http://testing.example.com/foobar/", NULL, buffer, &len);
665 ok(ret == TRUE,"InternetGetCookie failed\n");
666 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
667 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
668 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
669 ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
670 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
671 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
672 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
673 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
674
675 len = 1024;
676 ret = InternetGetCookieA("http://testing.example.com/foo/bar", NULL, buffer, &len);
677 ok(ret == TRUE,"InternetGetCookie failed\n");
678 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
679 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
680 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
681 ok(strstr(buffer,"G=H")!=NULL,"G=H missing\n");
682 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
683 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
684 ok(strstr(buffer,"M=N")!=NULL,"M=N missing\n");
685 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
686
687 len = 1024;
688 ret = InternetGetCookieA("http://testing.example.com/barfoo", NULL, buffer, &len);
689 ok(ret == TRUE,"InternetGetCookie failed\n");
690 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
691 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
692 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
693 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
694 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
695 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
696 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
697 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
698
699 len = 1024;
700 ret = InternetGetCookieA("http://testing.example.com/barfoo/", NULL, buffer, &len);
701 ok(ret == TRUE,"InternetGetCookie failed\n");
702 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
703 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
704 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
705 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
706 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
707 ok(strstr(buffer,"K=L")==NULL,"K=L present\n");
708 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
709 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
710
711 len = 1024;
712 ret = InternetGetCookieA("http://testing.example.com/bar/foo", NULL, buffer, &len);
713 ok(ret == TRUE,"InternetGetCookie failed\n");
714 ok(len == 24, "len = %lu\n", len);
715 ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
716 ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
717 ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
718 ok(strstr(buffer,"G=H")==NULL,"G=H present\n");
719 ok(strstr(buffer,"I=J")!=NULL,"I=J missing\n");
720 ok(strstr(buffer,"K=L")!=NULL,"K=L missing\n");
721 ok(strstr(buffer,"M=N")==NULL,"M=N present\n");
722 ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
723
724 /* Cookie name argument is not implemented */
725 len = 1024;
726 ret = InternetGetCookieA("http://testing.example.com/bar/foo", "A", buffer, &len);
727 ok(ret == TRUE,"InternetGetCookie failed\n");
728 ok(len == 24, "len = %lu\n", len);
729
730 /* test persistent cookies */
731 ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B; expires=Fri, 01-Jan-2038 00:00:00 GMT");
732 ok(ret, "InternetSetCookie failed with error %ld\n", GetLastError());
733
734 /* test invalid expires parameter */
735 ret = InternetSetCookieA("http://testing.example.com", NULL, "Q=R; expires=");
736 ok(ret, "InternetSetCookie failed %#lx.\n", GetLastError());
737 len = 1024;
738 memset(buffer, 0xac, sizeof(buffer));
739 ret = InternetGetCookieA("http://testing.example.com/", NULL, buffer, &len);
740 ok(ret, "InternetGetCookie failed %#lx.\n", GetLastError());
741 ok(len == 29, "got len %lu.\n", len);
742 ok(!!strstr(buffer, "Q=R"), "cookie is not present.\n");
743
744 len = sizeof(buffer);
745 ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
746 ok(ret, "got error %#lx\n", GetLastError());
747 ok(len == 29, "got len %lu\n", len);
748 ok(!!strstr(buffer, "A=B"), "cookie is not present\n");
749
750 /* remove persistent cookie */
751 ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B");
752 ok(ret, "InternetSetCookie failed with error %ld\n", GetLastError());
753
754 /* try setting cookie for different domain */
755 ret = InternetSetCookieA("http://www.aaa.example.com/bar",NULL,"E=F; domain=different.com");
756 ok(!ret, "InternetSetCookie succeeded\n");
757 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %ld\n", GetLastError());
758 ret = InternetSetCookieA("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=example.com.pl");
759 ok(ret, "InternetSetCookie failed with error: %ld\n", GetLastError());
760 ret = InternetSetCookieA("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=com.pl");
761 todo_wine ok(!ret, "InternetSetCookie succeeded\n");
762}
#define broken(x)
Definition: atltest.h:178
#define TRUE
Definition: types.h:120
#define lstrlenW
Definition: compat.h:750
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP char *__cdecl strstr(const char *, const char *)
Definition: string.c:3420
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722
#define todo_wine
Definition: minitest.h:80
char CHAR
Definition: pedump.c:57
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI InternetGetCookieA(const char *url, const char *name, char *data, DWORD *size)
Definition: cookie.c:862
BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName, LPCSTR lpCookieData)
Definition: cookie.c:1139
BOOL WINAPI InternetGetCookieW(const WCHAR *url, const WCHAR *name, WCHAR *data, DWORD *size)
Definition: cookie.c:792

Referenced by START_TEST().

◆ test_cookie_attrs()

static void test_cookie_attrs ( void  )
static

Definition at line 764 of file internet.c.

765{
766 char buf[100];
768 BOOL ret;
769
770 if(!GetProcAddress(GetModuleHandleA("wininet.dll"), "DeleteWpadCacheForNetworks")) {
771 win_skip("Skipping cookie attributes tests. Too old IE.\n");
772 return;
773 }
774
775 ret = InternetSetCookieA("http://cookie.attrs.com/bar", NULL, "A=data; httponly");
776 ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%lu)\n", ret, GetLastError());
777
778 SetLastError(0xdeadbeef);
779 state = InternetSetCookieExA("http://cookie.attrs.com/bar", NULL, "A=data; httponly", 0, 0);
781 "InternetSetCookieEx returned: %x (%lu)\n", ret, GetLastError());
782
783 size = sizeof(buf);
784 ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
785 ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%lu)\n", ret, GetLastError());
786
787 state = InternetSetCookieExA("http://cookie.attrs.com/bar",NULL,"A=data; httponly", INTERNET_COOKIE_HTTPONLY, 0);
788 ok(state == COOKIE_STATE_ACCEPT,"InternetSetCookieEx failed: %lu\n", GetLastError());
789
790 size = sizeof(buf);
791 ret = InternetGetCookieA("http://cookie.attrs.com/", NULL, buf, &size);
792 ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned: %x (%lu)\n", ret, GetLastError());
793
794 size = sizeof(buf);
795 ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, 0, NULL);
796 ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%lu)\n", ret, GetLastError());
797
798 size = sizeof(buf);
799 ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
800 ok(ret, "InternetGetCookieEx failed: %lu\n", GetLastError());
801 ok(!strcmp(buf, "A=data"), "data = %s\n", buf);
802
803 /* Try to override httponly cookie with non-httponly one */
804 ret = InternetSetCookieA("http://cookie.attrs.com/bar", NULL, "A=test");
805 ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%lu)\n", ret, GetLastError());
806
807 SetLastError(0xdeadbeef);
808 state = InternetSetCookieExA("http://cookie.attrs.com/bar", NULL, "A=data", 0, 0);
810 "InternetSetCookieEx returned: %x (%lu)\n", ret, GetLastError());
811
812 size = sizeof(buf);
813 ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
814 ok(ret, "InternetGetCookieEx failed: %lu\n", GetLastError());
815 ok(!strcmp(buf, "A=data"), "data = %s\n", buf);
816
817}
static int state
Definition: maze.c:121
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_INVALID_OPERATION
Definition: winerror.h:1689
DWORD WINAPI InternetSetCookieExA(LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData, DWORD dwFlags, DWORD_PTR dwReserved)
Definition: cookie.c:1165
BOOL WINAPI InternetGetCookieExA(LPCSTR lpszUrl, LPCSTR lpszCookieName, LPSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved)
Definition: cookie.c:809
#define INTERNET_COOKIE_HTTPONLY
Definition: wininet.h:1828
@ COOKIE_STATE_ACCEPT
Definition: wininet.h:1792
@ COOKIE_STATE_REJECT
Definition: wininet.h:1796

Referenced by START_TEST().

◆ test_cookie_url()

static void test_cookie_url ( void  )
static

Definition at line 819 of file internet.c.

820{
821 char long_url[5000] = "http://long.url.test.com/", *p;
822 WCHAR bufw[512];
823 char buf[512];
824 DWORD len;
825 BOOL res;
826
827 static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
828
829 len = sizeof(buf);
830 res = InternetGetCookieA("about:blank", NULL, buf, &len);
832 "InternetGetCookeA failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
833
834 len = ARRAY_SIZE(bufw);
837 "InternetGetCookeW failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
838
839 len = sizeof(buf);
840 res = pInternetGetCookieExA("about:blank", NULL, buf, &len, 0, NULL);
842 "InternetGetCookeExA failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
843
844 len = ARRAY_SIZE(bufw);
845 res = pInternetGetCookieExW(about_blankW, NULL, bufw, &len, 0, NULL);
847 "InternetGetCookeExW failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
848
849 p = long_url + strlen(long_url);
850 memset(p, 'x', long_url+sizeof(long_url)-p);
851 p += (long_url+sizeof(long_url)-p) - 3;
852 p[0] = '/';
853 p[2] = 0;
854 res = InternetSetCookieA(long_url, NULL, "A=B");
855 ok(res, "InternetSetCookieA failed: %lu\n", GetLastError());
856
857 len = sizeof(buf);
858 res = InternetGetCookieA(long_url, NULL, buf, &len);
859 ok(res, "InternetGetCookieA failed: %lu\n", GetLastError());
860 ok(!strcmp(buf, "A=B"), "buf = %s\n", buf);
861
862 len = sizeof(buf);
863 res = InternetGetCookieA("http://long.url.test.com/", NULL, buf, &len);
864 ok(!res && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieA failed: %lu\n", GetLastError());
865}
GLuint res
Definition: glext.h:9613
GLfloat GLfloat p
Definition: glext.h:8902
static const WCHAR about_blankW[]
Definition: persist.c:24

Referenced by START_TEST().

◆ test_end_browser_session()

static void test_end_browser_session ( void  )
static

Definition at line 1418 of file internet.c.

1419{
1420 DWORD len;
1421 BOOL ret;
1422
1423 ret = InternetSetCookieA("http://www.example.com/test_end", NULL, "A=B");
1424 ok(ret == TRUE, "InternetSetCookie failed\n");
1425
1426 len = 1024;
1427 ret = InternetGetCookieA("http://www.example.com/test_end", NULL, NULL, &len);
1428 ok(ret == TRUE,"InternetGetCookie failed\n");
1429 ok(len != 0, "len = 0\n");
1430
1432 ok(ret, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n", GetLastError());
1433
1434 len = 1024;
1435 ret = InternetGetCookieA("http://www.example.com/test_end", NULL, NULL, &len);
1436 ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned %x (%lu)\n", ret, GetLastError());
1437 ok(!len, "len = %lu\n", len);
1438}
BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:3727
#define INTERNET_OPTION_END_BROWSER_SESSION
Definition: wininet.h:736

Referenced by START_TEST().

◆ test_format_message()

static void test_format_message ( HMODULE  hdll)
static

Definition at line 1981 of file internet.c.

1982{
1983 DWORD ret;
1984 CHAR out[0x100];
1985
1986 /* These messages come from wininet and not the system. */
1989 ok(ret == 0, "FormatMessageA returned %ld\n", ret);
1990
1993 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
1994
1997 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
1998
2001 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2002
2005 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2006
2009 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2010
2013 ok(ret != 0 || broken(!ret) /* XP, w2k3 */, "FormatMessageA returned %ld\n", ret);
2014
2017 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2018
2021 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2022
2025 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2026
2029 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2030
2033 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2034
2037 ok(ret != 0, "FormatMessageA returned %ld\n", ret);
2038}
DWORD WINAPI FormatMessageA(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:483
#define LANG_NEUTRAL
Definition: nls.h:22
#define MAKELANGID(p, s)
Definition: nls.h:15
#define SUBLANG_NEUTRAL
Definition: nls.h:167
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:399
#define ERROR_INTERNET_SEC_CERT_CN_INVALID
Definition: wininet.h:2026
#define ERROR_INTERNET_INVALID_URL
Definition: wininet.h:1994
#define ERROR_INTERNET_OPERATION_CANCELLED
Definition: wininet.h:2006
#define ERROR_INTERNET_ITEM_NOT_FOUND
Definition: wininet.h:2017
#define ERROR_INTERNET_TIMEOUT
Definition: wininet.h:1991
#define ERROR_INTERNET_CONNECTION_ABORTED
Definition: wininet.h:2019
#define ERROR_INTERNET_SEC_CERT_DATE_INVALID
Definition: wininet.h:2025
#define ERROR_INTERNET_INVALID_OPERATION
Definition: wininet.h:2005
#define ERROR_INTERNET_CANNOT_CONNECT
Definition: wininet.h:2018
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define ERROR_INTERNET_UNRECOGNIZED_SCHEME
Definition: wininet.h:1995
#define ERROR_INTERNET_INTERNAL_ERROR
Definition: wininet.h:1993

Referenced by START_TEST().

◆ test_get_cookie()

static void test_get_cookie ( void  )
static

Definition at line 560 of file internet.c.

561{
562 DWORD len;
563 BOOL ret;
564
565 len = 1024;
566 SetLastError(0xdeadbeef);
567 ret = InternetGetCookieA("http://www.example.com", NULL, NULL, &len);
569 "InternetGetCookie should have failed with %s and error %ld\n",
570 ret ? "TRUE" : "FALSE", GetLastError());
571 ok(!len, "len = %lu\n", len);
572}

Referenced by START_TEST().

◆ test_InternetCanonicalizeUrlA()

static void test_InternetCanonicalizeUrlA ( void  )
static

Definition at line 59 of file internet.c.

60{
61 CHAR buffer[256];
62 LPCSTR url;
63 DWORD urllen;
65 DWORD res;
66
67 /* Acrobat Updater 5 calls this for Adobe Reader 8.1 */
68 url = "http://swupmf.adobe.com/manifest/50/win/AdobeUpdater.upd";
69 urllen = strlen(url);
70
71 memset(buffer, '#', sizeof(buffer)-1);
72 buffer[sizeof(buffer)-1] = '\0';
73 dwSize = 1; /* Acrobat Updater use this size */
74 SetLastError(0xdeadbeef);
76 ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
77 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
79
80
81 /* buffer has no space for the terminating '\0' */
82 memset(buffer, '#', sizeof(buffer)-1);
83 buffer[sizeof(buffer)-1] = '\0';
84 dwSize = urllen;
85 SetLastError(0xdeadbeef);
87 /* dwSize is nr. of needed bytes with the terminating '\0' */
88 ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
89 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
91
92 /* buffer has the required size */
93 memset(buffer, '#', sizeof(buffer)-1);
94 buffer[sizeof(buffer)-1] = '\0';
95 dwSize = urllen+1;
96 SetLastError(0xdeadbeef);
98 /* dwSize is nr. of copied bytes without the terminating '\0' */
99 ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
100 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
102
103 memset(buffer, '#', sizeof(buffer)-1);
104 buffer[sizeof(buffer)-1] = '\0';
105 dwSize = sizeof(buffer);
106 SetLastError(0xdeadbeef);
107 res = InternetCanonicalizeUrlA("file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml", buffer, &dwSize, ICU_DECODE | ICU_NO_ENCODE);
108 ok(res, "InternetCanonicalizeUrlA failed %lu\n", GetLastError());
109 ok(dwSize == strlen(buffer), "got %ld expected %Iu\n", dwSize, strlen(buffer));
110 ok(!lstrcmpA("file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", buffer),
111 "got %s expected 'file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml'\n", buffer);
112
113 /* buffer is larger as the required size */
114 memset(buffer, '#', sizeof(buffer)-1);
115 buffer[sizeof(buffer)-1] = '\0';
116 dwSize = urllen+2;
117 SetLastError(0xdeadbeef);
119 /* dwSize is nr. of copied bytes without the terminating '\0' */
120 ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
121 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
123
124
125 /* check NULL pointers */
126 memset(buffer, '#', urllen + 4);
127 buffer[urllen + 4] = '\0';
128 dwSize = urllen+1;
129 SetLastError(0xdeadbeef);
132 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
134
135 memset(buffer, '#', urllen + 4);
136 buffer[urllen + 4] = '\0';
137 dwSize = urllen+1;
138 SetLastError(0xdeadbeef);
141 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
143
144 memset(buffer, '#', urllen + 4);
145 buffer[urllen + 4] = '\0';
146 dwSize = urllen+1;
147 SetLastError(0xdeadbeef);
150 "got %lu and %lu with size %lu for '%s' (%Iu)\n",
152
153 /* test with trailing space */
154 dwSize = 256;
155 res = InternetCanonicalizeUrlA("http://www.winehq.org/index.php?x= ", buffer, &dwSize, ICU_BROWSER_MODE);
156 ok(res == 1, "InternetCanonicalizeUrlA failed\n");
157 ok(!strcmp(buffer, "http://www.winehq.org/index.php?x="), "Trailing space should have been stripped even in ICU_BROWSER_MODE (%s)\n", buffer);
158
159 res = InternetSetOptionA(NULL, 0xdeadbeef, buffer, sizeof(buffer));
160 ok(!res, "InternetSetOptionA succeeded\n");
162 "InternetSetOptionA failed %lu, expected ERROR_INTERNET_INVALID_OPTION\n", GetLastError());
163}
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
Definition: internet.c:2411
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static const WCHAR url[]
Definition: encode.c:1384
#define ICU_DECODE
Definition: winhttp.h:353
#define ICU_BROWSER_MODE
Definition: winhttp.h:356
#define ICU_NO_ENCODE
Definition: winhttp.h:352
#define ERROR_INTERNET_INVALID_OPTION
Definition: wininet.h:1998

Referenced by START_TEST().

◆ test_InternetErrorDlg()

static void test_InternetErrorDlg ( void  )
static

Definition at line 1619 of file internet.c.

1620{
1621 HINTERNET ses, con, req;
1622 DWORD res;
1623 HWND hwnd;
1624 ULONG i;
1625 static const struct {
1626 DWORD error;
1627 DWORD res;
1628 DWORD test_flags;
1629 } no_ui_res[] = {
1650 };
1651
1653 ok(res == ERROR_INVALID_HANDLE, "Got %ld\n", res);
1654
1656 ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
1657 con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
1658 ok(con != 0, "InternetConnect failed: 0x%08lx\n", GetLastError());
1659 req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
1660 ok(req != 0, "HttpOpenRequest failed: 0x%08lx\n", GetLastError());
1661
1663 ok(hwnd != NULL, "GetDesktopWindow failed (%ld)\n", GetLastError());
1664
1666 {
1667 DWORD expected = ERROR_CANCELLED, expected2 = ERROR_SUCCESS, broken2, test_flags = 0, j;
1668
1669 for (j = 0; j < ARRAY_SIZE(no_ui_res); ++j)
1670 {
1671 if (no_ui_res[j].error == i)
1672 {
1673 test_flags = no_ui_res[j].test_flags;
1674 expected = no_ui_res[j].res;
1675 expected2 = no_ui_res[j].res;
1676 }
1677 }
1678
1679 /* Try an invalid request handle */
1682 {
1683 ok(test_flags & FLAG_UNIMPL, "%li is unexpectedly unimplemented.\n", i);
1684 continue;
1685 }
1686 else
1687 ok(res == ERROR_INVALID_HANDLE, "Got %ld (%ld)\n", res, i);
1688
1689 /* With a valid req */
1691 continue; /* Crashes on windows XP */
1692
1694 continue; /* Interactive (XP, Win7) */
1696 continue; /* Interactive (Win10 1607+) */
1697
1699
1700 /* Handle some special cases */
1701 broken2 = expected2;
1702 switch(i)
1703 {
1705 if (broken(res == ERROR_CANCELLED)) /* before win10 returns ERROR_CANCELLED */
1706 {
1708 expected2 = broken2 = ERROR_CANCELLED;
1709 }
1710 break;
1712 if (res == ERROR_CANCELLED)
1713 {
1715 expected2 = ERROR_CANCELLED;
1716 broken2 = ERROR_SUCCESS; /* win10 1607 */
1717 break;
1718 }
1719 /* fall through */
1720 default:
1721 if(broken(expected == ERROR_CANCELLED && res == ERROR_NOT_SUPPORTED)) /* XP, Win7, Win8 */
1722 {
1724 expected2 = broken2 = ERROR_SUCCESS;
1725 }
1726 break;
1727 }
1728
1729 ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
1730
1731 /* Same thing with NULL hwnd */
1733 ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
1734
1736 ok(res == expected2 || broken(res == broken2),
1737 "Got %ld, expected %ld (%ld)\n", res, expected2, i);
1738
1739 /* With a null req */
1740 if(test_flags & FLAG_NEEDREQ)
1741 {
1743 expected2 = ERROR_INVALID_PARAMETER;
1744 }
1745
1747 ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
1748
1750 ok(res == expected2 || broken(res == broken2),
1751 "Got %ld, expected %ld (%ld)\n", res, expected2, i);
1752 }
1753
1755 ok(res == ERROR_SUCCESS, "Got %ld, expected ERROR_SUCCESS\n", res);
1756
1758 ok(res == ERROR_SUCCESS, "Got %ld, expected ERROR_SUCCESS\n", res);
1759
1760 res = InternetCloseHandle(req);
1761 ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1762 res = InternetCloseHandle(con);
1763 ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1764 res = InternetCloseHandle(ses);
1765 ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1766}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest, DWORD dwError, DWORD dwFlags, LPVOID *lppvData)
Definition: dialogs.c:491
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:1393
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1411
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1841
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1748
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
BOOL expected
Definition: store.c:2000
#define FLAG_UNIMPL
Definition: internet.c:1617
#define FLAG_NEEDREQ
Definition: internet.c:1616
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
uint32_t ULONG
Definition: typedefs.h:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define ERROR_CANCELLED
Definition: winerror.h:1055
#define INTERNET_ERROR_BASE
Definition: wininet.h:1988
#define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR
Definition: wininet.h:2027
#define FLAGS_ERROR_UI_FILTER_FOR_ERRORS
Definition: wininet.h:1906
#define ERROR_INTERNET_NEED_UI
Definition: wininet.h:2023
#define ERROR_INTERNET_INSERT_CDROM
Definition: wininet.h:2040
#define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT
Definition: wininet.h:2076
#define ERROR_INTERNET_INVALID_CA
Definition: wininet.h:2033
#define ERROR_INTERNET_INCORRECT_PASSWORD
Definition: wininet.h:2003
#define ERROR_INTERNET_CHG_POST_IS_NON_SECURE
Definition: wininet.h:2030
#define INTERNET_OPEN_TYPE_DIRECT
Definition: wininet.h:522
#define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED
Definition: wininet.h:2032
#define ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION
Definition: wininet.h:2066
#define FLAGS_ERROR_UI_FLAGS_NO_UI
Definition: wininet.h:1909
#define ERROR_HTTP_COOKIE_DECLINED
Definition: wininet.h:2067
#define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION
Definition: wininet.h:2068
#define ERROR_INTERNET_MIXED_SECURITY
Definition: wininet.h:2029
#define ERROR_INTERNET_SEC_CERT_WEAK_SIGNATURE
Definition: wininet.h:2045
#define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR
Definition: wininet.h:2039
#define INTERNET_ERROR_LAST
Definition: wininet.h:2084
#define ERROR_INTERNET_POST_IS_NON_SECURE
Definition: wininet.h:2031
#define ERROR_INTERNET_SEC_CERT_REV_FAILED
Definition: wininet.h:2044
#define ERROR_INTERNET_SEC_CERT_REVOKED
Definition: wininet.h:2078
#define ERROR_INTERNET_SEC_CERT_ERRORS
Definition: wininet.h:2042
#define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT
Definition: wininet.h:2075
#define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR
Definition: wininet.h:2028
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
#define ERROR_INTERNET_PROXY_ALERT
Definition: winineti.h:112

Referenced by START_TEST().

◆ test_InternetGetConnectedStateExA()

static void test_InternetGetConnectedStateExA ( void  )
static

Definition at line 1768 of file internet.c.

1769{
1770 BOOL res;
1771 CHAR buffer[256];
1772 DWORD flags, sz;
1773
1774 if(!pInternetGetConnectedStateExA) {
1775 win_skip("InternetGetConnectedStateExA is not supported\n");
1776 return;
1777 }
1778
1779 flags = 0;
1780 buffer[0] = 0;
1781 res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
1782 trace("Internet Connection: Flags 0x%02lx - Name '%s'\n", flags, buffer);
1783 ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
1784 if(!res) {
1785 win_skip("InternetGetConnectedStateExA tests require a valid connection\n");
1786 return;
1787 }
1788
1789 res = pInternetGetConnectedStateExA(NULL, NULL, 0, 0);
1790 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1791
1792 flags = 0;
1793 res = pInternetGetConnectedStateExA(&flags, NULL, 0, 0);
1794 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1796 {
1797 ok(flags & INTERNET_CONNECTION_MODEM, "Modem connection flag missing\n");
1798 ok(flags & ~INTERNET_CONNECTION_LAN, "Mixed Modem and LAN flags\n");
1799 }
1800 else
1801 {
1802 ok(flags & INTERNET_CONNECTION_LAN, "LAN connection flag missing\n");
1803 ok(flags & ~INTERNET_CONNECTION_MODEM, "Mixed Modem and LAN flags\n");
1804 }
1805
1806 buffer[0] = 0;
1807 flags = 0;
1808 res = pInternetGetConnectedStateExA(&flags, buffer, 0, 0);
1809 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1810 ok(flags, "Expected at least one flag set\n");
1811 ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
1812
1813 buffer[0] = 0;
1814 res = pInternetGetConnectedStateExA(NULL, buffer, sizeof(buffer), 0);
1815 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1816 ok(buffer[0], "Expected a connection name\n");
1817
1818 buffer[0] = 0;
1819 flags = 0;
1820 res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
1821 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1822 ok(flags, "Expected at least one flag set\n");
1823 ok(buffer[0], "Expected a connection name\n");
1824 sz = strlen(buffer);
1825
1826 flags = 0;
1827 res = pInternetGetConnectedStateExA(&flags, NULL, sizeof(buffer), 0);
1828 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1829 ok(flags, "Expected at least one flag set\n");
1830
1831 /* no space for complete string this time, double-byte characters get truncated */
1832 memset(buffer, 'z', sizeof(buffer) - 1);
1833 buffer[sizeof(buffer) - 1] = 0;
1834 flags = 0;
1835 res = pInternetGetConnectedStateExA(&flags, buffer, sz, 0);
1836 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1837 ok(flags, "Expected at least one flag set\n");
1838 ok(sz - 1 == strlen(buffer), "Expected len %lu, got %Iu: %s\n", sz - 1, strlen(buffer), wine_dbgstr_a(buffer));
1839
1840 memset(buffer, 'z', sizeof(buffer) - 1);
1841 buffer[sizeof(buffer) - 1] = 0;
1842 flags = 0;
1843 res = pInternetGetConnectedStateExA(&flags, buffer, sz / 2, 0);
1844 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1845 ok(flags, "Expected at least one flag set\n");
1846 ok(sz / 2 - 1 == strlen(buffer), "Expected len %lu, got %Iu: %s\n", sz / 2 - 1, strlen(buffer), wine_dbgstr_a(buffer));
1847
1848 memset(buffer, 'z', sizeof(buffer) - 1);
1849 buffer[sizeof(buffer) - 1] = 0;
1850 flags = 0;
1851 res = pInternetGetConnectedStateExA(&flags, buffer, 2, 0);
1852 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1853 ok(flags, "Expected at least one flag set\n");
1854 ok(strlen(buffer) == 1, "Expected len 1, got %Iu: %s\n", strlen(buffer), wine_dbgstr_a(buffer));
1855
1856 memset(buffer, 'z', sizeof(buffer) - 1);
1857 buffer[sizeof(buffer) - 1] = 0;
1858 flags = 0;
1859 res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
1860 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1861 ok(flags, "Expected at least one flag set\n");
1862 ok(!buffer[0], "Expected len 0, got %Iu: %s\n", strlen(buffer), wine_dbgstr_a(buffer));
1863}
#define trace
Definition: atltest.h:70
GLbitfield flags
Definition: glext.h:7161
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160
#define INTERNET_CONNECTION_MODEM
Definition: wininet.h:2538
#define INTERNET_CONNECTION_LAN
Definition: wininet.h:2539
#define INTERNET_CONNECTION_CONFIGURED
Definition: wininet.h:2544
#define INTERNET_RAS_INSTALLED
Definition: wininet.h:2542

Referenced by START_TEST().

◆ test_InternetGetConnectedStateExW()

static void test_InternetGetConnectedStateExW ( void  )
static

Definition at line 1865 of file internet.c.

1866{
1867 BOOL res;
1868 WCHAR buffer[256];
1869 DWORD flags, sz;
1870
1871 if(!pInternetGetConnectedStateExW) {
1872 win_skip("InternetGetConnectedStateExW is not supported\n");
1873 return;
1874 }
1875
1876 flags = 0;
1877 wcscpy(buffer, L"wine");
1878 SetLastError(0xdeadbeef);
1879 res = pInternetGetConnectedStateExW(&flags, buffer, ARRAY_SIZE(buffer), 0);
1880 trace("Internet Connection: Flags 0x%02lx - Name %s\n", flags, wine_dbgstr_w(buffer));
1881 ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
1882 if(!res) {
1884 ok(error == ERROR_SUCCESS, "Last error = %#lx\n", error);
1885 ok(!buffer[0], "Expected empty connection name, got %s\n", wine_dbgstr_w(buffer));
1886
1887 skip("InternetGetConnectedStateExW tests require a valid connection\n");
1888 return;
1889 }
1890
1891 res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0);
1892 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1893
1894 SetLastError(0xdeadbeef);
1895 res = pInternetGetConnectedStateExW(NULL, NULL, 0, 1);
1896 ok(res == FALSE, "Expected TRUE, got %d\n", res);
1897 ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected gle %lu\n", GetLastError());
1898
1899 flags = 0;
1900 res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0);
1901 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1903 {
1904 ok(flags & INTERNET_CONNECTION_MODEM, "Modem connection flag missing\n");
1905 ok(flags & ~INTERNET_CONNECTION_LAN, "Mixed Modem and LAN flags\n");
1906 }
1907 else
1908 {
1909 ok(flags & INTERNET_CONNECTION_LAN, "LAN connection flag missing\n");
1910 ok(flags & ~INTERNET_CONNECTION_MODEM, "Mixed Modem and LAN flags\n");
1911 }
1912
1913 buffer[0] = 0;
1914 flags = 0;
1915 res = pInternetGetConnectedStateExW(&flags, buffer, 0, 0);
1916 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1917 ok(flags, "Expected at least one flag set\n");
1918 ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
1919
1920 buffer[0] = 0;
1921 res = pInternetGetConnectedStateExW(NULL, buffer, ARRAY_SIZE(buffer), 0);
1922 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1923 ok(buffer[0], "Expected a connection name\n");
1924
1925 buffer[0] = 0;
1926 flags = 0;
1927 res = pInternetGetConnectedStateExW(&flags, buffer, ARRAY_SIZE(buffer), 0);
1928 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1929 ok(flags, "Expected at least one flag set\n");
1930 ok(buffer[0], "Expected a connection name\n");
1931 sz = lstrlenW(buffer);
1932
1933 flags = 0;
1934 res = pInternetGetConnectedStateExW(&flags, NULL, ARRAY_SIZE(buffer), 0);
1935 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1936 ok(flags, "Expected at least one flag set\n");
1937
1938 /* no space for complete string this time */
1939 wmemset(buffer, 'z', ARRAY_SIZE(buffer) - 1);
1940 buffer[ARRAY_SIZE(buffer) - 1] = 0;
1941 flags = 0;
1942 res = pInternetGetConnectedStateExW(&flags, buffer, sz, 0);
1943 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1944 ok(flags, "Expected at least one flag set\n");
1946 ok(!buffer[0], "Expected len 0, got %u: %s\n", lstrlenW(buffer), wine_dbgstr_w(buffer));
1947 else
1948 ok(sz - 1 == lstrlenW(buffer), "Expected len %lu, got %u: %s\n", sz - 1, lstrlenW(buffer), wine_dbgstr_w(buffer));
1949
1950 wmemset(buffer, 'z', ARRAY_SIZE(buffer) - 1);
1951 buffer[ARRAY_SIZE(buffer) - 1] = 0;
1952 flags = 0;
1953 res = pInternetGetConnectedStateExW(&flags, buffer, sz / 2, 0);
1954 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1955 ok(flags, "Expected at least one flag set\n");
1957 ok(!buffer[0], "Expected len 0, got %u: %s\n", lstrlenW(buffer), wine_dbgstr_w(buffer));
1958 else
1959 ok(sz / 2 - 1 == lstrlenW(buffer), "Expected len %lu, got %u: %s\n", sz / 2 - 1, lstrlenW(buffer), wine_dbgstr_w(buffer));
1960
1961 wmemset(buffer, 'z', ARRAY_SIZE(buffer) - 1);
1962 buffer[ARRAY_SIZE(buffer) - 1] = 0;
1963 flags = 0;
1964 res = pInternetGetConnectedStateExW(&flags, buffer, 2, 0);
1965 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1966 ok(flags, "Expected at least one flag set\n");
1968 ok(!buffer[0], "Expected len 0, got %u: %s\n", lstrlenW(buffer), wine_dbgstr_w(buffer));
1969 else
1970 ok(lstrlenW(buffer) == 1, "Expected len 1, got %u: %s\n", lstrlenW(buffer), wine_dbgstr_w(buffer));
1971
1972 wmemset(buffer, 'z', ARRAY_SIZE(buffer) - 1);
1973 buffer[ARRAY_SIZE(buffer) - 1] = 0;
1974 flags = 0;
1975 res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
1976 ok(res == TRUE, "Expected TRUE, got %d\n", res);
1977 ok(flags, "Expected at least one flag set\n");
1978 ok(!buffer[0], "Expected len 0, got %u: %s\n", lstrlenW(buffer), wine_dbgstr_w(buffer));
1979}
#define skip(...)
Definition: atltest.h:64
#define FALSE
Definition: types.h:117
static wchar_t *__cdecl wmemset(wchar_t *s, wchar_t c, size_t n)
Definition: wchar.h:77
#define L(x)
Definition: resources.c:13
#define wine_dbgstr_w
Definition: kernel32.h:34
wcscpy

Referenced by START_TEST().

◆ test_InternetQueryOptionA()

static void test_InternetQueryOptionA ( void  )
static

Definition at line 167 of file internet.c.

168{
169 HINTERNET hinet,hurl;
170 DWORD len, val;
172 DWORD err;
173 static const char useragent[] = {"Wininet Test"};
174 char proxy[256];
175 char *buffer;
176 BOOL retval, res;
177
178 SetLastError(0xdeadfeed);
179 memset(proxy, 0, sizeof(proxy));
181 todo_wine ok((res && proxy[0]) ||
183 "unexpected DHCP proxy result: %d gle %lu proxy %s\n", res, GetLastError(), proxy);
184
185 SetLastError(0xdeadfeed);
186 memset(proxy, 0, sizeof(proxy));
188 todo_wine ok((res && proxy[0]) ||
191 "unexpected DNS proxy result: %d gle %lu proxy %s\n", res, GetLastError(), proxy);
192
193 SetLastError(0xdeadbeef);
194 len = 0xdeadbeef;
196 ok(!retval && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got wrong error %x(%lu)\n", retval, GetLastError());
197 ok(len >= sizeof(INTERNET_PROXY_INFOA) && len != 0xdeadbeef,"len = %lu\n", len);
198
201 ok(retval, "Failed (%lu)\n", GetLastError());
202 ok(len >= sizeof(INTERNET_PROXY_INFOA) && len != 0xdeadbeef, "len = %lu\n", len);
204
205 hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
206 ok((hinet != 0x0),"InternetOpen Failed\n");
207
208 SetLastError(0xdeadbeef);
211 ok(retval == 0,"Got wrong return value %d\n",retval);
212 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code%ld\n",err);
213
214 SetLastError(0xdeadbeef);
215 len=strlen(useragent)+1;
218 ok(len == strlen(useragent)+1,"Got wrong user agent length %ld instead of %Iu\n",len,strlen(useragent));
219 ok(retval == 0,"Got wrong return value %d\n",retval);
220 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %ld\n",err);
221
222 len=strlen(useragent)+1;
225 ok(retval == 1,"Got wrong return value %d\n",retval);
226 if (retval)
227 {
228 ok(!strcmp(useragent,buffer),"Got wrong user agent string %s instead of %s\n",buffer,useragent);
229 ok(len == strlen(useragent),"Got wrong user agent length %ld instead of %Iu\n",len,strlen(useragent));
230 }
232
233 SetLastError(0xdeadbeef);
234 len=0;
238 ok(len == strlen(useragent) + 1,"Got wrong user agent length %ld instead of %Iu\n", len, strlen(useragent) + 1);
239 ok(!retval, "Got wrong return value %d\n", retval);
240 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %ld\n", err);
242
244
245 SetLastError(0xdeadbeef);
246 len=0;
249 ok(len == 0,"Got wrong user agent length %ld instead of 0\n",len);
250 ok(retval == 0,"Got wrong return value %d\n",retval);
251 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
252
253 SetLastError(0xdeadbeef);
254 len = sizeof(DWORD);
256 err = GetLastError();
257 ok(retval == 0,"Got wrong return value %d\n",retval);
258 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
259 ok(len == sizeof(DWORD), "len = %ld\n", len);
260
261 SetLastError(0xdeadbeef);
262 len = sizeof(DWORD);
264 err = GetLastError();
265 ok(retval == 0,"Got wrong return value %d\n",retval);
266 ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
267 ok(!len, "len = %ld\n", len);
268
270 InternetCloseHandle(hinet);
271
273 ok((hinet != 0x0),"InternetOpen Failed\n");
274
275 SetLastError(0xdeadbeef);
276 len=0;
279 ok(len == 1,"Got wrong user agent length %ld instead of %d\n",len,1);
280 ok(retval == 0,"Got wrong return value %d\n",retval);
281 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%ld\n",err);
282
283 InternetCloseHandle(hinet);
284
285 /* Connect timeout */
286 val = 12345;
288 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
289
290 len = sizeof(val);
292 ok(res, "InternetQueryOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed %ld)\n", GetLastError());
293 ok(val == 12345, "val = %ld\n", val);
294 ok(len == sizeof(val), "len = %ld\n", len);
295
296 /* Receive Timeout */
297 val = 54321;
299 ok(res, "InternetSetOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
300
301 len = sizeof(val);
303 ok(res, "InternetQueryOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed %ld)\n", GetLastError());
304 ok(val == 54321, "val = %ld\n", val);
305 ok(len == sizeof(val), "len = %ld\n", len);
306
307 /* Send Timeout */
308 val = 12345;
310 ok(res, "InternetSetOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
311
312 len = sizeof(val);
314 ok(res, "InternetQueryOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed %ld)\n", GetLastError());
315 ok(val == 12345, "val = %ld\n", val);
316 ok(len == sizeof(val), "len = %ld\n", len);
317
318 /* Data Receive Timeout */
319 val = 54321;
321 ok(res, "InternetSetOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
322
323 len = sizeof(val);
325 ok(res, "InternetQueryOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed %ld)\n", GetLastError());
326 ok(val == 54321, "val = %ld\n", val);
327 ok(len == sizeof(val), "len = %ld\n", len);
328
329 /* Data Send Timeout */
330 val = 12345;
332 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
333
334 val = 0xdeadbeef;
335 len = sizeof(val);
337 ok(res, "InternetQueryOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed %ld)\n", GetLastError());
338 ok(val == 12345, "val = %ld\n", val);
339 ok(len == sizeof(val), "len = %ld\n", len);
340
342 ok((hinet != 0x0),"InternetOpen Failed\n");
343 SetLastError(0xdeadbeef);
344 len=0;
347 ok(len == 1,"Got wrong user agent length %ld instead of %d\n",len,1);
348 ok(retval == 0,"Got wrong return value %d\n",retval);
349 ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%ld\n",err);
350
351 len = sizeof(val);
352 val = 0xdeadbeef;
354 ok(!res, "InternetQueryOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
355 ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %lu\n", GetLastError());
356
357 /* Connect Timeout */
358 val = 2;
360 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
361 ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %lu\n", GetLastError());
362
363 len = sizeof(val);
365 ok(res, "InternetQueryOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed %ld)\n", GetLastError());
366 ok(val == 12345, "val = %ld\n", val);
367 ok(len == sizeof(val), "len = %ld\n", len);
368
369 val = 1;
371 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
372
373 len = sizeof(val);
375 ok(res, "InternetQueryOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed %ld)\n", GetLastError());
376 ok(val == 1, "val = %ld\n", val);
377 ok(len == sizeof(val), "len = %ld\n", len);
378
379 /* Receive Timeout */
380 val = 60;
382 ok(res, "InternetSetOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
383
384 len = sizeof(val);
386 ok(res, "InternetQueryOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed %ld)\n", GetLastError());
387 ok(val == 60, "val = %ld\n", val);
388 ok(len == sizeof(val), "len = %ld\n", len);
389
390 /* Send Timeout */
391 val = 120;
393 ok(res, "InternetSetOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
394
395 len = sizeof(val);
397 ok(res, "InternetQueryOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed %ld)\n", GetLastError());
398 ok(val == 120, "val = %ld\n", val);
399 ok(len == sizeof(val), "len = %ld\n", len);
400
401 /* Data Receive Timeout */
402 val = 60;
404 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
405
406 len = sizeof(val);
408 ok(res, "InternetQueryOptionA(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) failed %ld)\n", GetLastError());
409 ok(val == 60, "val = %ld\n", val);
410 ok(len == sizeof(val), "len = %ld\n", len);
411
412 /* Data Send Timeout */
413 val = 120;
415 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
416
417 len = sizeof(val);
419 ok(res, "InternetQueryOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed %ld)\n", GetLastError());
420 ok(val == 120, "val = %ld\n", val);
421 ok(len == sizeof(val), "len = %ld\n", len);
422
423 /* Timeout inheritance */
424 val = 15000;
425 len = sizeof(val);
427 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
429 ok(res, "InternetSetOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
431 ok(res, "InternetSetOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
433 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
435 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
436
438
439 val = 0xdeadbeef;
441 ok(val == 15000, "failed to inherit INTERNET_OPTION_CONNECT_TIMEOUT on child connection (found %ld) - Error: %ld)\n", val, GetLastError());
442
443 val = 0xdeadbeef;
445 ok(val == 15000, "failed to inherit INTERNET_OPTION_SEND_TIMEOUT on child connection (found %ld) - Error: %ld)\n", val, GetLastError());
446
447 val = 0xdeadbeef;
449 ok(val == 15000, "failed to inherit INTERNET_OPTION_RECEIVE_TIMEOUT on child connection (found %ld) - Error: %ld)\n", val, GetLastError());
450
451 val = 0xdeadbeef;
453 ok(val == 15000, "failed to inherit INTERNET_OPTION_DATA_SEND_TIMEOUTt on child connection (found %ld) - Error: %ld)\n", val, GetLastError());
454
455 val = 0xdeadbeef;
457 ok(val == 15000, "failed to inherit INTERNET_OPTION_DATA_RECEIVE_TIMEOUT on child connection (found %ld) - Error: %ld)\n", val, GetLastError());
458
459 val = 12345;
461 ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
462
463 val = 0xdeadbeef;
465 ok(val == 15000, "Connection handle inherited value (INTERNET_OPTION_CONNECT_TIMEOUT) as %ld\n", val);
467 ok(val == 12345, "Parent handle set from inherited value (INTERNET_OPTION_CONNECT_TIMEOUT) as %ld\n", val);
468
469 val = 12345;
471 ok(res, "InternetSetOptionA(INTERNET_OPTION_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
472
473 val = 0xdeadbeef;
475 ok(val == 15000, "Connection handle inherited value (INTERNET_OPTION_SEND_TIMEOUT) as %ld\n", val);
477 ok(val == 12345, "Parent handle set from inherited value (INTERNET_OPTION_SEND_TIMEOUT) as %ld\n", val);
478
479 val = 12345;
481 ok(res, "InternetSetOptionA(INTERNET_OPTION_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
482
483 val = 0xdeadbeef;
485 ok(val == 15000, "Connection handle inherited value (INTERNET_OPTION_RECEIVE_TIMEOUT) as %ld\n", val);
487 ok(val == 12345, "Parent handle set from inherited value (INTERNET_OPTION_RECEIVE_TIMEOUT) as %ld\n", val);
488
489 val = 12345;
491 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_SEND_TIMEOUT) failed (%lu)\n", GetLastError());
492
493 val = 0xdeadbeef;
495 ok(val == 15000, "Connection handle inherited value (INTERNET_OPTION_DATA_SEND_TIMEOUT) as %ld\n", val);
497 ok(val == 12345, "Parent handle set from inherited value (INTERNET_OPTION_DATA_SEND_TIMEOUT) as %ld\n", val);
498
499 val = 12345;
501 ok(res, "InternetSetOptionA(INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) failed (%lu)\n", GetLastError());
502
503 val = 0xdeadbeef;
505 ok(val == 15000, "Connection handle inherited value (INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) as %ld\n", val);
507 ok(val == 12345, "Parent handle set from inherited value (INTERNET_OPTION_DATA_RECEIVE_TIMEOUT) as %ld\n", val);
508
510 InternetCloseHandle(hinet);
511}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:3286
BOOL WINAPI DetectAutoProxyUrl(LPSTR lpszAutoProxyUrl, DWORD dwAutoProxyUrlLength, DWORD dwDetectFlags)
Definition: internet.c:589
int proxy
Definition: main.c:67
GLuint GLfloat * val
Definition: glext.h:7180
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
#define ERROR_WINHTTP_AUTODETECTION_FAILED
Definition: internet.c:53
#define DWORD
Definition: nt_native.h:44
#define err(...)
int retval
Definition: wcstombs.cpp:91
#define ERROR_NOT_FOUND
Definition: winerror.h:1014
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:41
#define INTERNET_OPTION_DATA_SEND_TIMEOUT
Definition: wininet.h:708
#define INTERNET_OPTION_USER_AGENT
Definition: wininet.h:735
#define INTERNET_OPTION_CONNECT_TIMEOUT
Definition: wininet.h:701
#define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT
Definition: wininet.h:709
#define INTERNET_OPTION_MAX_CONNS_PER_SERVER
Definition: wininet.h:763
#define INTERNET_OPTION_PROXY
Definition: wininet.h:732
#define PROXY_AUTO_DETECT_TYPE_DHCP
Definition: wininet.h:2603
#define INTERNET_OPTION_SEND_TIMEOUT
Definition: wininet.h:704
#define INTERNET_OPTION_RECEIVE_TIMEOUT
Definition: wininet.h:706
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
Definition: wininet.h:2007
#define INTERNET_OPTION_REQUEST_FLAGS
Definition: wininet.h:718
#define PROXY_AUTO_DETECT_TYPE_DNS_A
Definition: wininet.h:2604

Referenced by START_TEST().

◆ test_InternetSetOption()

static void test_InternetSetOption ( void  )
static

Definition at line 1326 of file internet.c.

1327{
1328 HINTERNET ses, con, req;
1329 ULONG ulArg;
1330 DWORD size;
1331 BOOL ret;
1332
1334 ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
1335 con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
1336 ok(con != 0, "InternetConnect failed: 0x%08lx\n", GetLastError());
1337 req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
1338 ok(req != 0, "HttpOpenRequest failed: 0x%08lx\n", GetLastError());
1339
1340 /* INTERNET_OPTION_POLICY tests */
1341 SetLastError(0xdeadbeef);
1343 ok(ret == FALSE, "InternetSetOption should've failed\n");
1344 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
1345 "given ERROR_INVALID_PARAMETER, gave: 0x%08lx\n", GetLastError());
1346
1347 SetLastError(0xdeadbeef);
1349 ok(ret == FALSE, "InternetQueryOption should've failed\n");
1350 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
1351 "given ERROR_INVALID_PARAMETER, gave: 0x%08lx\n", GetLastError());
1352
1353 /* INTERNET_OPTION_ERROR_MASK tests */
1354 SetLastError(0xdeadbeef);
1355 size = sizeof(ulArg);
1357 ok(ret == FALSE, "InternetQueryOption should've failed\n");
1358 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lx\n", GetLastError());
1359
1360 SetLastError(0xdeadbeef);
1361 ulArg = 11;
1362 ret = InternetSetOptionA(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
1363 ok(ret == FALSE, "InternetSetOption should've failed\n");
1364 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lx\n", GetLastError());
1365
1366 SetLastError(0xdeadbeef);
1367 ulArg = 11;
1368 ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
1369 ok(ret == FALSE, "InternetSetOption should've failed\n");
1370 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %ld\n", GetLastError());
1371
1372 ulArg = 11;
1373 ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
1374 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1375
1376 SetLastError(0xdeadbeef);
1377 ulArg = 4;
1378 ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
1379 ok(ret == FALSE, "InternetSetOption should've failed\n");
1380 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %lx\n", GetLastError());
1381
1382 SetLastError(0xdeadbeef);
1383 ulArg = 16;
1384 ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
1385 ok(ret == FALSE, "InternetSetOption should've failed\n");
1386 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %lx\n", GetLastError());
1387
1389 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1390
1392 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1393
1395 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1396
1398 ok(ret == TRUE, "InternetSetOption should've succeeded\n");
1399
1400 SetLastError(0xdeadbeef);
1402 ok(ret == FALSE, "InternetSetOption should've failed\n");
1403 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lu\n", GetLastError());
1404
1405 SetLastError(0xdeadbeef);
1407 ok(ret == FALSE, "InternetSetOption should've failed\n");
1408 ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lu\n", GetLastError());
1409
1410 ret = InternetCloseHandle(req);
1411 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1412 ret = InternetCloseHandle(con);
1413 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1414 ret = InternetCloseHandle(ses);
1415 ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
1416}
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
Definition: internet.c:3253
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
Definition: internet.c:3457
#define INTERNET_OPTION_ERROR_MASK
Definition: wininet.h:755
#define INTERNET_OPTION_POLICY
Definition: wininet.h:742
#define INTERNET_OPTION_REFRESH
Definition: wininet.h:731
#define ERROR_INTERNET_BAD_OPTION_LENGTH
Definition: wininet.h:1999
#define INTERNET_OPTION_SETTINGS_CHANGED
Definition: wininet.h:733

Referenced by START_TEST().

◆ test_InternetTimeToSystemTime()

static void test_InternetTimeToSystemTime ( void  )
static

Definition at line 1100 of file internet.c.

1101{
1102 BOOL ret;
1103 unsigned int i;
1105 WCHAR buffer[64];
1106 static const SYSTEMTIME expect1 = { 2005, 1, 5, 7, 12, 6, 35, 0 };
1107 static const SYSTEMTIME expect2 = { 2022, 1, 2, 11, 11, 13, 5, 0 };
1108
1109 static const struct test_data
1110 {
1111 const char *string;
1112 const SYSTEMTIME *expect;
1113 BOOL match;
1114 BOOL todo;
1115 }
1116 test_data[] =
1117 {
1118 { "Fri, 07 Jan 2005 12:06:35 GMT", &expect1, TRUE },
1119 { "Fri, 07 Jan 2005 12:06:35 UTC", &expect1, TRUE },
1120 { " fri, 7 jan 2005 12 06 35", &expect1, TRUE },
1121 { "Fri, 07-01-2005 12:06:35", &expect1, TRUE },
1122 { "5, 07-01-2005 12:06:35 GMT", &expect1, TRUE },
1123 { "5, 07-01-2005 12:06:35 UTC", &expect1, TRUE },
1124 { "5, 07-01-2005 12:06:35 GMT;", &expect1, TRUE },
1125 { "5, 07-01-2005 12:06:35 GMT123", &expect1, TRUE },
1126 { "2, 11 01 2022 11 13 05", &expect2, TRUE },
1127 { "2, 11-01-2022 11#13^05", &expect2, TRUE },
1128 { "2, 11*01/2022 11+13=05", &expect2, TRUE },
1129 { "2, 11-Jan-2022 11:13:05", &expect2, TRUE },
1130 { "Fr", NULL, FALSE },
1131 { "Fri Jan 7 12:06:35 2005", &expect1, TRUE, TRUE },
1132 { "Fri Jan 7 12:06:35 2005 GMT", &expect1, TRUE, TRUE },
1133 { "Fri Jan 7 12:06:35 2005 UTC", &expect1, TRUE, TRUE },
1134 };
1135
1136 ret = pInternetTimeToSystemTimeA(NULL, NULL, 0);
1137 ok(!ret, "InternetTimeToSystemTimeA succeeded.\n");
1138 ret = pInternetTimeToSystemTimeA(NULL, &time, 0);
1139 ok(!ret, "InternetTimeToSystemTimeA succeeded.\n");
1140 ret = pInternetTimeToSystemTimeW(NULL, NULL, 0);
1141 ok(!ret, "InternetTimeToSystemTimeW succeeded.\n");
1142 ret = pInternetTimeToSystemTimeW(NULL, &time, 0);
1143 ok(!ret, "InternetTimeToSystemTimeW succeeded.\n");
1144
1145 for (i = 0; i < ARRAY_SIZE(test_data); ++i)
1146 {
1147 const struct test_data *test = &test_data[i];
1148 winetest_push_context("Test %u", i);
1149
1150 memset(&time, 0, sizeof(time));
1151 ret = pInternetTimeToSystemTimeA(test->string, NULL, 0);
1152 ok(!ret, "InternetTimeToSystemTimeA succeeded.\n");
1153 ret = pInternetTimeToSystemTimeA(test->string, &time, 0);
1154 ok(ret, "InternetTimeToSystemTimeA failed: %lu.\n", GetLastError());
1155 todo_wine_if(test->todo)
1157 "Got unexpected system time.\n");
1158
1160
1161 memset(&time, 0, sizeof(time));
1162 ret = pInternetTimeToSystemTimeW(buffer, NULL, 0);
1163 ok(!ret, "InternetTimeToSystemTimeW succeeded.\n");
1164 ret = pInternetTimeToSystemTimeW(buffer, &time, 0);
1165 ok(ret, "InternetTimeToSystemTimeW failed: %lu.\n", GetLastError());
1168 "Got unexpected system time.\n");
1169
1171 }
1172}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
void CDECL unexpected(void)
Definition: cpp.c:711
_ACRTIMP int __cdecl system(const char *)
Definition: process.c:1297
BOOL WINAPI InternetTimeToSystemTimeW(LPCWSTR string, SYSTEMTIME *time, DWORD reserved)
Definition: internet.c:3979
GLdouble n
Definition: glext.h:7729
#define todo_wine_if(is_todo)
Definition: minitest.h:81
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
#define expect2(expected1, expected2, got1, got2)
Definition: listview.c:50
BOOL todo
Definition: filedlg.c:313
#define test
Definition: rosglue.h:37
Definition: match.c:28
const char * string
Definition: metadata.c:423
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by START_TEST().

◆ test_IsDomainLegalCookieDomainW()

static void test_IsDomainLegalCookieDomainW ( void  )
static

Definition at line 1174 of file internet.c.

1175{
1176 BOOL ret;
1177 static const WCHAR empty[] = {0};
1178 static const WCHAR dot[] = {'.',0};
1179 static const WCHAR uk[] = {'u','k',0};
1180 static const WCHAR com[] = {'c','o','m',0};
1181 static const WCHAR dot_com[] = {'.','c','o','m',0};
1182 static const WCHAR gmail_com[] = {'g','m','a','i','l','.','c','o','m',0};
1183 static const WCHAR dot_gmail_com[] = {'.','g','m','a','i','l','.','c','o','m',0};
1184 static const WCHAR www_gmail_com[] = {'w','w','w','.','g','m','a','i','l','.','c','o','m',0};
1185 static const WCHAR www_mail_gmail_com[] = {'w','w','w','.','m','a','i','l','.','g','m','a','i','l','.','c','o','m',0};
1186 static const WCHAR mail_gmail_com[] = {'m','a','i','l','.','g','m','a','i','l','.','c','o','m',0};
1187 static const WCHAR gmail_co_uk[] = {'g','m','a','i','l','.','c','o','.','u','k',0};
1188 static const WCHAR co_uk[] = {'c','o','.','u','k',0};
1189 static const WCHAR dot_co_uk[] = {'.','c','o','.','u','k',0};
1190
1191 SetLastError(0xdeadbeef);
1192 ret = pIsDomainLegalCookieDomainW(NULL, NULL);
1194 {
1195 win_skip("IsDomainLegalCookieDomainW is not implemented\n");
1196 return;
1197 }
1198 ok(!ret ||
1199 broken(ret), /* IE6 */
1200 "IsDomainLegalCookieDomainW succeeded\n");
1201
1202 SetLastError(0xdeadbeef);
1203 ret = pIsDomainLegalCookieDomainW(com, NULL);
1204 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1205
1206 SetLastError(0xdeadbeef);
1207 ret = pIsDomainLegalCookieDomainW(NULL, gmail_com);
1208 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1209
1210 SetLastError(0xdeadbeef);
1211 ret = pIsDomainLegalCookieDomainW(empty, gmail_com);
1212 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1213
1214 SetLastError(0xdeadbeef);
1215 ret = pIsDomainLegalCookieDomainW(com, empty);
1216 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1217
1218 SetLastError(0xdeadbeef);
1219 ret = pIsDomainLegalCookieDomainW(gmail_com, dot);
1220 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1221
1222 SetLastError(0xdeadbeef);
1223 ret = pIsDomainLegalCookieDomainW(dot, gmail_com);
1224 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1225
1226 SetLastError(0xdeadbeef);
1227 ret = pIsDomainLegalCookieDomainW(com, com);
1228 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1229
1230 SetLastError(0xdeadbeef);
1231 ret = pIsDomainLegalCookieDomainW(com, dot_com);
1232 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1233
1234 SetLastError(0xdeadbeef);
1235 ret = pIsDomainLegalCookieDomainW(dot_com, com);
1236 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1237
1238 SetLastError(0xdeadbeef);
1239 ret = pIsDomainLegalCookieDomainW(com, gmail_com);
1240 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1241
1242 ret = pIsDomainLegalCookieDomainW(gmail_com, gmail_com);
1243 ok(ret, "IsDomainLegalCookieDomainW failed\n");
1244
1245 ret = pIsDomainLegalCookieDomainW(gmail_com, www_gmail_com);
1246 ok(ret, "IsDomainLegalCookieDomainW failed\n");
1247
1248 ret = pIsDomainLegalCookieDomainW(gmail_com, www_mail_gmail_com);
1249 ok(ret, "IsDomainLegalCookieDomainW failed\n");
1250
1251 SetLastError(0xdeadbeef);
1252 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, co_uk);
1253 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1254
1255 ret = pIsDomainLegalCookieDomainW(uk, co_uk);
1256 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1257
1258 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, dot_co_uk);
1259 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1260
1261 ret = pIsDomainLegalCookieDomainW(co_uk, gmail_co_uk);
1262 todo_wine ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1263
1264 ret = pIsDomainLegalCookieDomainW(gmail_co_uk, gmail_co_uk);
1265 ok(ret, "IsDomainLegalCookieDomainW failed\n");
1266
1267 ret = pIsDomainLegalCookieDomainW(gmail_com, com);
1268 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1269
1270 SetLastError(0xdeadbeef);
1271 ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
1272 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1273
1274 ret = pIsDomainLegalCookieDomainW(gmail_com, mail_gmail_com);
1275 ok(ret, "IsDomainLegalCookieDomainW failed\n");
1276
1277 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, gmail_com);
1278 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1279
1280 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, com);
1281 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1282
1283 ret = pIsDomainLegalCookieDomainW(dot_gmail_com, mail_gmail_com);
1284 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1285
1286 ret = pIsDomainLegalCookieDomainW(mail_gmail_com, dot_gmail_com);
1287 ok(!ret, "IsDomainLegalCookieDomainW succeeded\n");
1288}
static const WCHAR empty[1]
Definition: string.c:47
IUnknown uk
Definition: typelib.c:8336

Referenced by START_TEST().

◆ test_max_conns()

static void test_max_conns ( void  )
static

Definition at line 513 of file internet.c.

514{
515 DWORD len, val;
516 BOOL res;
517
518 len = sizeof(val);
519 val = 0xdeadbeef;
521 ok(res,"Got wrong return value %x\n", res);
522 ok(len == sizeof(val), "got %ld\n", len);
523 trace("INTERNET_OPTION_MAX_CONNS_PER_SERVER: %ld\n", val);
524
525 len = sizeof(val);
526 val = 0xdeadbeef;
528 ok(res,"Got wrong return value %x\n", res);
529 ok(len == sizeof(val), "got %ld\n", len);
530 trace("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: %ld\n", val);
531
532 val = 3;
534 ok(res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) failed: %x\n", res);
535
536 len = sizeof(val);
537 val = 0xdeadbeef;
539 ok(res,"Got wrong return value %x\n", res);
540 ok(len == sizeof(val), "got %ld\n", len);
541 ok(val == 3, "got %ld\n", val);
542
543 val = 0;
545 ok(!res || broken(res), /* <= w2k3 */
546 "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER, 0) succeeded\n");
547 if (!res) ok(GetLastError() == ERROR_BAD_ARGUMENTS, "GetLastError() = %lu\n", GetLastError());
548
549 val = 2;
551 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
552 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %lu\n", GetLastError());
553
554 val = 2;
556 ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
557 ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %lu\n", GetLastError());
558}
#define ERROR_BAD_ARGUMENTS
Definition: winerror.h:354
#define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: wininet.h:764

Referenced by START_TEST().

◆ test_null()

static void test_null ( void  )
static

Definition at line 867 of file internet.c.

868{
869 HINTERNET hi, hc;
870 static const WCHAR szServer[] = { 's','e','r','v','e','r',0 };
871 static const WCHAR szServer2[] = { 's','e','r','v','e','r','=',0 };
872 static const WCHAR szEmpty[] = { 0 };
873 static const WCHAR szUrl[] = { 'h','t','t','p',':','/','/','a','.','b','.','c',0 };
874 static const WCHAR szUrlEmpty[] = { 'h','t','t','p',':','/','/',0 };
875 static const WCHAR szExpect[] = { 's','e','r','v','e','r',';',' ','s','e','r','v','e','r',0 };
876 WCHAR buffer[0x20];
877 BOOL r;
878 DWORD sz;
879
880 SetLastError(0xdeadbeef);
881 hi = InternetOpenW(NULL, 0, NULL, NULL, 0);
883 {
884 win_skip("Internet*W functions are not implemented\n");
885 return;
886 }
887 ok(hi != NULL, "open failed\n");
888
889 hc = InternetConnectW(hi, NULL, 0, NULL, NULL, 0, 0, 0);
890 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
891 ok(hc == NULL, "connect failed\n");
892
894 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
895 ok(hc == NULL, "connect failed\n");
896
897 hc = InternetConnectW(hi, NULL, 0, NULL, NULL, INTERNET_SERVICE_FTP, 0, 0);
898 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
899 ok(hc == NULL, "connect failed\n");
900
901 hc = InternetConnectW(NULL, szServer, 0, NULL, NULL, INTERNET_SERVICE_FTP, 0, 0);
902 ok(GetLastError() == ERROR_INVALID_HANDLE, "wrong error\n");
903 ok(hc == NULL, "connect failed\n");
904
905 hc = InternetOpenUrlW(hi, NULL, NULL, 0, 0, 0);
908 ok(hc == NULL, "connect failed\n");
909
910 hc = InternetOpenUrlW(hi, szServer, NULL, 0, 0, 0);
912 ok(hc == NULL, "connect failed\n");
913
915
917 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
918 ok(r == FALSE, "return wrong\n");
919
920 r = InternetSetCookieW(szServer, NULL, NULL);
921 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
922 ok(r == FALSE, "return wrong\n");
923
924 r = InternetSetCookieW(szUrl, szServer, NULL);
925 ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error\n");
926 ok(r == FALSE, "return wrong\n");
927
928 r = InternetSetCookieW(szUrl, szServer, szServer);
929 ok(r == TRUE, "return wrong\n");
930
931 r = InternetSetCookieW(szUrl, NULL, szServer);
932 ok(r == TRUE, "return wrong\n");
933
934 r = InternetSetCookieW(szUrl, szServer, szEmpty);
935 ok(r == TRUE, "return wrong\n");
936
937 r = InternetSetCookieW(szUrlEmpty, szServer, szServer);
938 ok(r == FALSE, "return wrong\n");
939
940 r = InternetSetCookieW(szServer, NULL, szServer);
942 ok(r == FALSE, "return wrong\n");
943
944 sz = 0;
947 "wrong error %lu\n", GetLastError());
948 ok( r == FALSE, "return wrong\n");
949
950 r = InternetGetCookieW(szServer, NULL, NULL, &sz);
951 todo_wine {
953 }
954 ok( r == FALSE, "return wrong\n");
955
956 sz = 0;
957 r = InternetGetCookieW(szUrlEmpty, szServer, NULL, &sz);
958 ok( r == FALSE, "return wrong\n");
959
960 sz = 0;
961 r = InternetGetCookieW(szUrl, szServer, NULL, &sz);
962 ok( r == TRUE, "return wrong\n");
963
964 /* sz is 14 on XP SP2 and beyond, 30 on XP SP1 and before, 16 on IE11 */
965 ok( sz == 14 || sz == 16 || sz == 30, "sz wrong, got %lu, expected 14, 16 or 30\n", sz);
966
967 sz = 0x20;
968 memset(buffer, 0, sizeof buffer);
969 r = InternetGetCookieW(szUrl, szServer, buffer, &sz);
970 ok( r == TRUE, "return wrong\n");
971
972 /* sz == lstrlenW(buffer) only in XP SP1 */
973 ok( sz == 1 + lstrlenW(buffer) || sz == lstrlenW(buffer), "sz wrong %ld\n", sz);
974
975 /* before XP SP2, buffer is "server; server" */
976 ok( !lstrcmpW(szExpect, buffer) || !lstrcmpW(szServer, buffer) || !lstrcmpW(szServer2, buffer),
977 "cookie data wrong %s\n", wine_dbgstr_w(buffer));
978
979 sz = sizeof(buffer);
981 ok(r == TRUE, "ret %d\n", r);
982}
static const WCHAR szEmpty[]
Definition: help.c:53
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, LPCWSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:4341
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1685
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1334
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BOOL WINAPI InternetSetCookieW(const WCHAR *url, const WCHAR *name, const WCHAR *data)
Definition: cookie.c:1122
#define INTERNET_OPTION_CONNECTED_STATE
Definition: wininet.h:744
#define INTERNET_SERVICE_FTP
Definition: wininet.h:560

Referenced by START_TEST().

◆ test_Option_PerConnectionOption()

static void test_Option_PerConnectionOption ( void  )
static

Definition at line 1440 of file internet.c.

1441{
1442 BOOL ret;
1445 INTERNET_PER_CONN_OPTIONW orig_settings[2], options[2];
1446 static WCHAR proxy_srvW[] = L"proxy.example";
1447 HINTERNET ses;
1448
1450 ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
1451
1452 /* get the process IE proxy server info, to restore later */
1453 list.dwOptionCount = 2;
1454 list.pOptions = orig_settings;
1455 orig_settings[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1456 orig_settings[1].dwOption = INTERNET_PER_CONN_FLAGS;
1457
1459 ok(ret, "InternetQueryOption should've succeeded\n");
1460
1461 /* set the process IE proxy server */
1462 list.pOptions = options;
1464 options[0].Value.pszValue = proxy_srvW;
1465 options[1].dwOption = INTERNET_PER_CONN_FLAGS;
1466 options[1].Value.dwValue = PROXY_TYPE_PROXY;
1467
1469 ok(ret, "InternetSetOption should've succeeded\n");
1470
1471 /* get & verify the process IE proxy server */
1472 options[0].Value.pszValue = NULL;
1473 options[1].Value.dwValue = 0;
1474
1476 ok(ret, "InternetQueryOption should've succeeded\n");
1477 ok(!lstrcmpW(options[0].Value.pszValue, proxy_srvW),
1478 "Retrieved proxy server should've been %s, was: %s\n",
1479 wine_dbgstr_w(proxy_srvW), wine_dbgstr_w(options[0].Value.pszValue));
1480 ok(options[1].Value.dwValue == PROXY_TYPE_PROXY,
1481 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld\n",
1482 options[1].Value.dwValue);
1483
1484 ret = HeapValidate(GetProcessHeap(), 0, options[0].Value.pszValue);
1485 ok(ret, "HeapValidate failed, last error %lu\n", GetLastError());
1486 GlobalFree(options[0].Value.pszValue);
1487
1488 /* verify that global proxy settings were not changed */
1490 ok(ret, "InternetQueryOption should've succeeded\n");
1491 ok(lstrcmpW(options[0].Value.pszValue, proxy_srvW),
1492 "Retrieved proxy server should've been %s, was: %s\n",
1493 wine_dbgstr_w(proxy_srvW), wine_dbgstr_w(options[0].Value.pszValue));
1494
1495 /* disable the proxy server */
1496 list.dwOptionCount = 1;
1497 options[0].dwOption = INTERNET_PER_CONN_FLAGS;
1498 options[0].Value.dwValue = PROXY_TYPE_DIRECT;
1499
1501 ok(ret, "InternetSetOption should've succeeded\n");
1502
1503 /* verify that the proxy is disabled */
1504 options[0].Value.dwValue = 0;
1505
1507 ok(ret, "InternetQueryOption should've succeeded\n");
1508 ok(options[0].Value.dwValue == PROXY_TYPE_DIRECT,
1509 "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %ld\n",
1510 options[0].Value.dwValue);
1511
1512 /* set the proxy flags to 'invalid' value */
1513 options[0].dwOption = INTERNET_PER_CONN_FLAGS;
1514 options[0].Value.dwValue = PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT;
1515
1517 ok(ret, "InternetSetOption should've succeeded\n");
1518
1519 /* verify that the proxy is enabled */
1520 options[0].Value.dwValue = 0;
1521
1523 ok(ret, "InternetQueryOption should've succeeded\n");
1525 "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %ld\n",
1526 options[0].Value.dwValue);
1527
1528 /* restore original settings */
1529 list.dwOptionCount = 2;
1530 list.pOptions = orig_settings;
1531
1533 ok(ret, "InternetSetOption should've succeeded\n");
1534
1535 GlobalFree(orig_settings[0].Value.pszValue);
1537}
Definition: list.h:39
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
Definition: heapmem.c:156
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define INTERNET_PER_CONN_FLAGS
Definition: wininet.h:334
#define PROXY_TYPE_DIRECT
Definition: wininet.h:346
struct _INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LISTW
#define INTERNET_PER_CONN_PROXY_SERVER
Definition: wininet.h:335
#define INTERNET_OPTION_PER_CONNECTION_OPTION
Definition: wininet.h:765
#define PROXY_TYPE_PROXY
Definition: wininet.h:347

Referenced by START_TEST().

◆ test_Option_PerConnectionOptionA()

static void test_Option_PerConnectionOptionA ( void  )
static

Definition at line 1539 of file internet.c.

1540{
1541 BOOL ret;
1544 INTERNET_PER_CONN_OPTIONA orig_settings[2], options[2];
1545 char proxy_srv[] = "proxy.example";
1546 HINTERNET ses;
1547
1549 ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
1550
1551 /* get the process IE proxy server info, to restore later */
1552 list.dwOptionCount = 2;
1553 list.pOptions = orig_settings;
1554 orig_settings[0].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
1555 orig_settings[1].dwOption = INTERNET_PER_CONN_FLAGS;
1556
1558 &list, &size);
1559 ok(ret, "InternetQueryOption should've succeeded\n");
1560
1561 /* set the process IE proxy server */
1562 list.pOptions = options;
1564 options[0].Value.pszValue = proxy_srv;
1565 options[1].dwOption = INTERNET_PER_CONN_FLAGS;
1566 options[1].Value.dwValue = PROXY_TYPE_PROXY;
1567
1569 &list, size);
1570 ok(ret, "InternetSetOption should've succeeded\n");
1571
1572 /* get & verify the process IE proxy server */
1573 options[0].Value.pszValue = NULL;
1574 options[1].Value.dwValue = 0;
1575
1577 &list, &size);
1578 ok(ret, "InternetQueryOption should've succeeded\n");
1579 ok(!lstrcmpA(options[0].Value.pszValue, "proxy.example"),
1580 "Retrieved proxy server should've been \"%s\", was: \"%s\"\n",
1581 proxy_srv, options[0].Value.pszValue);
1582 ok(options[1].Value.dwValue == PROXY_TYPE_PROXY,
1583 "Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld\n",
1584 options[1].Value.dwValue);
1585
1586 GlobalFree(options[0].Value.pszValue);
1587
1588 /* test with NULL as proxy server */
1589 list.dwOptionCount = 1;
1591 options[0].Value.pszValue = NULL;
1592
1594 ok(ret, "InternetSetOption should've succeeded\n");
1595
1596 /* get & verify the proxy server */
1597 options[0].Value.dwValue = 0xdeadbeef;
1598
1600 ok(ret, "InternetQueryOption should've succeeded\n");
1601 ok(!options[0].Value.pszValue,
1602 "Retrieved proxy server should've been NULL, was: \"%s\"\n",
1603 options[0].Value.pszValue);
1604
1605 /* restore original settings */
1606 list.dwOptionCount = 2;
1607 list.pOptions = orig_settings;
1608
1610 ok(ret, "InternetSetOption should've succeeded\n");
1611
1612 GlobalFree(orig_settings[0].Value.pszValue);
1614}
struct _INTERNET_PER_CONN_OPTION_LISTA INTERNET_PER_CONN_OPTION_LISTA

Referenced by START_TEST().

◆ test_PrivacyGetSetZonePreferenceW()

static void test_PrivacyGetSetZonePreferenceW ( void  )
static

Definition at line 1290 of file internet.c.

1291{
1292 DWORD ret, zone, type, template, old_template, pref_size = 0;
1293 WCHAR pref[256];
1294
1295 zone = 3;
1296 type = 0;
1297 ret = pPrivacyGetZonePreferenceW(zone, type, NULL, NULL, NULL);
1298 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1299
1300 old_template = 0;
1301 ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, NULL, NULL);
1302 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1303
1304 trace("template %lu\n", old_template);
1305
1306 if(old_template == PRIVACY_TEMPLATE_ADVANCED) {
1307 pref_size = ARRAY_SIZE(pref);
1308 ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, pref, &pref_size);
1309 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1310 }
1311
1312 template = 5;
1313 ret = pPrivacySetZonePreferenceW(zone, type, template, NULL);
1314 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1315
1316 template = 0;
1317 ret = pPrivacyGetZonePreferenceW(zone, type, &template, NULL, NULL);
1318 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1319 ok(template == 5, "expected template == 5, got %lu\n", template);
1320
1321 template = 5;
1322 ret = pPrivacySetZonePreferenceW(zone, type, old_template, pref_size ? pref : NULL);
1323 ok(ret == 0, "expected ret == 0, got %lu\n", ret);
1324}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD zone
Definition: sec_mgr.c:1728
#define PRIVACY_TEMPLATE_ADVANCED
Definition: wininet.h:1962

Referenced by START_TEST().

◆ test_version()

static void test_version ( void  )
static

Definition at line 984 of file internet.c.

985{
987 DWORD size;
988 BOOL res;
989
990 size = sizeof(version);
992 ok(res, "Could not get version: %lu\n", GetLastError());
993 ok(version.dwMajorVersion == 1, "dwMajorVersion=%ld, expected 1\n", version.dwMajorVersion);
994 ok(version.dwMinorVersion == 2, "dwMinorVersion=%ld, expected 2\n", version.dwMinorVersion);
995}
static const WCHAR version[]
Definition: asmname.c:66
#define INTERNET_OPTION_VERSION
Definition: wininet.h:734

Referenced by START_TEST().

Variable Documentation

◆ DWORD

Definition at line 36 of file internet.c.

◆ LPCSTR

Definition at line 47 of file internet.c.

◆ LPCWSTR

Definition at line 44 of file internet.c.

◆ LPDWORD

Definition at line 45 of file internet.c.

◆ LPSTR

Definition at line 40 of file internet.c.

◆ LPVOID

Definition at line 47 of file internet.c.

◆ LPWSTR

Definition at line 41 of file internet.c.