[WININET_WINETEST]

* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62994
This commit is contained in:
Amine Khaldi 2014-04-26 17:50:30 +00:00
parent 698bb7c11c
commit d4ce7ec2a8
6 changed files with 993 additions and 623 deletions

View file

@ -74,7 +74,7 @@ static void test_connect(HINTERNET hInternet)
*/
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if (hFtp) /* some servers accept an empty password */
{
ok ( GetLastError() == ERROR_SUCCESS, "ERROR_SUCCESS, got %d\n", GetLastError());
@ -85,13 +85,13 @@ static void test_connect(HINTERNET hInternet)
"Expected ERROR_INTERNET_LOGIN_FAILURE, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, NULL, "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, NULL, "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
ok ( hFtp == NULL, "Expected InternetConnect to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", "IEUser@",
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", "IEUser@",
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
ok(!hFtp, "Expected InternetConnect to fail\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
@ -105,19 +105,19 @@ static void test_connect(HINTERNET hInternet)
*/
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, NULL, NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, NULL, NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if (!hFtp && (GetLastError() == ERROR_INTERNET_LOGIN_FAILURE))
{
/* We are most likely running on a clean Wine install or a Windows install where the registry key is removed */
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
}
ok ( hFtp != NULL, "InternetConnect failed : %d\n", GetLastError());
ok ( GetLastError() == ERROR_SUCCESS,
"ERROR_SUCCESS, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", NULL,
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", NULL,
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if (!hFtp)
{
@ -749,7 +749,7 @@ static void test_command(HINTERNET hFtp, HINTERNET hConnect)
static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
{
WIN32_FIND_DATA findData;
WIN32_FIND_DATAA findData;
HINTERNET hSearch;
HINTERNET hSearch2;
HINTERNET hOpenFile;
@ -946,7 +946,7 @@ static void test_status_callbacks(HINTERNET hInternet)
cb = pInternetSetStatusCallbackA(hInternet, status_callback);
ok(cb == NULL, "expected NULL got %p\n", cb);
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL,
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL,
INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 1);
if (!hFtp)
{
@ -977,17 +977,17 @@ START_TEST(ftp)
pInternetSetStatusCallbackA = (void*)GetProcAddress(hWininet, "InternetSetStatusCallbackA");
SetLastError(0xdeadbeef);
hInternet = InternetOpen("winetest", 0, NULL, NULL, 0);
hInternet = InternetOpenA("winetest", 0, NULL, NULL, 0);
ok(hInternet != NULL, "InternetOpen failed: %u\n", GetLastError());
hFtp = InternetConnect(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", NULL, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
if (!hFtp)
{
InternetCloseHandle(hInternet);
skip("No ftp connection could be made to ftp.winehq.org\n");
return;
}
hHttp = InternetConnect(hInternet, "www.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
hHttp = InternetConnectA(hInternet, "www.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (!hHttp)
{
InternetCloseHandle(hFtp);

File diff suppressed because it is too large Load diff

View file

@ -35,8 +35,8 @@ static BOOL (WINAPI *pCreateUrlCacheContainerA)(DWORD, DWORD, DWORD, DWORD,
DWORD, DWORD, DWORD, DWORD);
static BOOL (WINAPI *pCreateUrlCacheContainerW)(DWORD, DWORD, DWORD, DWORD,
DWORD, DWORD, DWORD, DWORD);
static BOOL (WINAPI *pInternetTimeFromSystemTimeA)(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD);
static BOOL (WINAPI *pInternetTimeFromSystemTimeW)(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD);
static BOOL (WINAPI *pInternetTimeFromSystemTimeA)(const SYSTEMTIME *, DWORD, LPSTR, DWORD);
static BOOL (WINAPI *pInternetTimeFromSystemTimeW)(const SYSTEMTIME *, DWORD, LPWSTR, DWORD);
static BOOL (WINAPI *pInternetTimeToSystemTimeA)(LPCSTR ,SYSTEMTIME *,DWORD);
static BOOL (WINAPI *pInternetTimeToSystemTimeW)(LPCWSTR ,SYSTEMTIME *,DWORD);
static BOOL (WINAPI *pIsDomainLegalCookieDomainW)(LPCWSTR, LPCWSTR);
@ -44,6 +44,8 @@ static DWORD (WINAPI *pPrivacyGetZonePreferenceW)(DWORD, DWORD, LPDWORD, LPWSTR,
static DWORD (WINAPI *pPrivacySetZonePreferenceW)(DWORD, DWORD, DWORD, LPCWSTR);
static BOOL (WINAPI *pInternetGetCookieExA)(LPCSTR,LPCSTR,LPSTR,LPDWORD,DWORD,LPVOID);
static BOOL (WINAPI *pInternetGetCookieExW)(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD,DWORD,LPVOID);
static BOOL (WINAPI *pInternetGetConnectedStateExA)(LPDWORD,LPSTR,DWORD,DWORD);
static BOOL (WINAPI *pInternetGetConnectedStateExW)(LPDWORD,LPWSTR,DWORD,DWORD);
/* ############################### */
@ -169,7 +171,7 @@ static void test_InternetQueryOptionA(void)
len = 0xdeadbeef;
retval = InternetQueryOptionA(NULL, INTERNET_OPTION_PROXY, NULL, &len);
ok(!retval && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got wrong error %x(%u)\n", retval, GetLastError());
ok(len >= sizeof(INTERNET_PROXY_INFO) && len != 0xdeadbeef,"len = %u\n", len);
ok(len >= sizeof(INTERNET_PROXY_INFOA) && len != 0xdeadbeef,"len = %u\n", len);
hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
ok((hinet != 0x0),"InternetOpen Failed\n");
@ -363,7 +365,7 @@ static void test_get_cookie(void)
BOOL ret;
SetLastError(0xdeadbeef);
ret = InternetGetCookie("http://www.example.com", NULL, NULL, &len);
ret = InternetGetCookieA("http://www.example.com", NULL, NULL, &len);
ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS,
"InternetGetCookie should have failed with %s and error %d\n",
ret ? "TRUE" : "FALSE", GetLastError());
@ -382,33 +384,33 @@ static void test_complicated_cookie(void)
static const WCHAR testing_example_comW[] =
{'h','t','t','p',':','/','/','t','e','s','t','i','n','g','.','e','x','a','m','p','l','e','.','c','o','m',0};
ret = InternetSetCookie("http://www.example.com/bar",NULL,"A=B; domain=.example.com");
ret = InternetSetCookieA("http://www.example.com/bar",NULL,"A=B; domain=.example.com");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com/bar",NULL,"C=D; domain=.example.com; path=/");
ret = InternetSetCookieA("http://www.example.com/bar",NULL,"C=D; domain=.example.com; path=/");
ok(ret == TRUE,"InternetSetCookie failed\n");
/* Technically illegal! domain should require 2 dots, but native wininet accepts it */
ret = InternetSetCookie("http://www.example.com",NULL,"E=F; domain=example.com");
ret = InternetSetCookieA("http://www.example.com",NULL,"E=F; domain=example.com");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com",NULL,"G=H; domain=.example.com; path=/foo");
ret = InternetSetCookieA("http://www.example.com",NULL,"G=H; domain=.example.com; path=/foo");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
ret = InternetSetCookieA("http://www.example.com/bar.html",NULL,"I=J; domain=.example.com");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com/bar/",NULL,"K=L; domain=.example.com");
ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"K=L; domain=.example.com");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com/bar/",NULL,"M=N; domain=.example.com; path=/foo/");
ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"M=N; domain=.example.com; path=/foo/");
ok(ret == TRUE,"InternetSetCookie failed\n");
ret = InternetSetCookie("http://www.example.com/bar/",NULL,"O=P; secure; path=/bar");
ret = InternetSetCookieA("http://www.example.com/bar/",NULL,"O=P; secure; path=/bar");
ok(ret == TRUE,"InternetSetCookie failed\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com", NULL, NULL, &len);
ret = InternetGetCookieA("http://testing.example.com", NULL, NULL, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(len == 19, "len = %u\n", len);
len = 1024;
memset(buffer, 0xac, sizeof(buffer));
ret = InternetGetCookie("http://testing.example.com", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(len == 19, "len = %u\n", len);
ok(strlen(buffer) == 18, "strlen(buffer) = %u\n", lstrlenA(buffer));
@ -423,7 +425,7 @@ static void test_complicated_cookie(void)
len = 10;
memset(buffer, 0xac, sizeof(buffer));
ret = InternetGetCookie("http://testing.example.com", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com", NULL, buffer, &len);
ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"InternetGetCookie returned: %x(%u), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
ok(len == 19, "len = %u\n", len);
@ -448,7 +450,7 @@ static void test_complicated_cookie(void)
ok(len == 38, "len = %u\n", len);
len = 1024;
ret = InternetGetCookie("http://testing.example.com/foobar", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@ -460,7 +462,7 @@ static void test_complicated_cookie(void)
ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com/foobar/", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/foobar/", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@ -472,7 +474,7 @@ static void test_complicated_cookie(void)
ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com/foo/bar", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/foo/bar", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@ -484,7 +486,7 @@ static void test_complicated_cookie(void)
ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com/barfoo", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/barfoo", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@ -496,7 +498,7 @@ static void test_complicated_cookie(void)
ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com/barfoo/", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/barfoo/", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@ -508,7 +510,7 @@ static void test_complicated_cookie(void)
ok(strstr(buffer,"O=P")==NULL,"O=P present\n");
len = 1024;
ret = InternetGetCookie("http://testing.example.com/bar/foo", NULL, buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/bar/foo", NULL, buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(len == 24, "len = %u\n", 24);
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
@ -522,40 +524,40 @@ static void test_complicated_cookie(void)
/* Cookie name argument is not implemented */
len = 1024;
ret = InternetGetCookie("http://testing.example.com/bar/foo", "A", buffer, &len);
ret = InternetGetCookieA("http://testing.example.com/bar/foo", "A", buffer, &len);
ok(ret == TRUE,"InternetGetCookie failed\n");
ok(len == 24, "len = %u\n", 24);
/* test persistent cookies */
ret = InternetSetCookie("http://testing.example.com", NULL, "A=B; expires=Fri, 01-Jan-2038 00:00:00 GMT");
ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B; expires=Fri, 01-Jan-2038 00:00:00 GMT");
ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
len = sizeof(user);
ret = GetUserName(user, &len);
ret = GetUserNameA(user, &len);
ok(ret, "GetUserName failed with error %d\n", GetLastError());
for(; len>0; len--)
user[len-1] = tolower(user[len-1]);
sprintf(buffer, "Cookie:%s@testing.example.com/", user);
ret = GetUrlCacheEntryInfo(buffer, NULL, &len);
ret = GetUrlCacheEntryInfoA(buffer, NULL, &len);
ok(!ret, "GetUrlCacheEntryInfo succeeded\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetLastError() = %d\n", GetLastError());
/* remove persistent cookie */
ret = InternetSetCookie("http://testing.example.com", NULL, "A=B");
ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B");
ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
ret = GetUrlCacheEntryInfo(buffer, NULL, &len);
ret = GetUrlCacheEntryInfoA(buffer, NULL, &len);
ok(!ret, "GetUrlCacheEntryInfo succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() = %d\n", GetLastError());
/* try setting cookie for different domain */
ret = InternetSetCookie("http://www.aaa.example.com/bar",NULL,"E=F; domain=different.com");
ret = InternetSetCookieA("http://www.aaa.example.com/bar",NULL,"E=F; domain=different.com");
ok(!ret, "InternetSetCookie succeeded\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %d\n", GetLastError());
ret = InternetSetCookie("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=example.com.pl");
ret = InternetSetCookieA("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=example.com.pl");
ok(ret, "InternetSetCookie failed with error: %d\n", GetLastError());
ret = InternetSetCookie("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=com.pl");
ret = InternetSetCookieA("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=com.pl");
todo_wine ok(!ret, "InternetSetCookie succeeded\n");
}
@ -1026,11 +1028,11 @@ static void test_InternetSetOption(void)
DWORD size;
BOOL ret;
ses = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
con = InternetConnect(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
req = HttpOpenRequest(con, "GET", "/", NULL, NULL, NULL, 0, 0);
req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
/* INTERNET_OPTION_POLICY tests */
@ -1055,31 +1057,31 @@ static void test_InternetSetOption(void)
SetLastError(0xdeadbeef);
ulArg = 11;
ret = InternetSetOption(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ret = InternetSetOptionA(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ok(ret == FALSE, "InternetQueryOption should've failed\n");
ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 11;
ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
ok(ret == FALSE, "InternetQueryOption should've failed\n");
ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %d\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 11;
ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
ok(GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 4;
ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ok(ret == FALSE, "InternetQueryOption should've failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 16;
ret = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
ok(ret == FALSE, "InternetQueryOption should've failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
@ -1349,11 +1351,11 @@ static void test_InternetErrorDlg(void)
res = InternetErrorDlg(NULL, NULL, 12055, flags, NULL);
ok(res == ERROR_INVALID_HANDLE, "Got %d\n", res);
ses = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
con = InternetConnect(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
req = HttpOpenRequest(con, "GET", "/", NULL, NULL, NULL, 0, 0);
req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
/* NULL hwnd and FLAGS_ERROR_UI_FLAGS_NO_UI not set */
@ -1453,6 +1455,140 @@ static void test_InternetErrorDlg(void)
ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
}
static void test_InternetGetConnectedStateExA(void)
{
BOOL res;
CHAR buffer[256];
DWORD flags, sz;
if(!pInternetGetConnectedStateExA) {
win_skip("InternetGetConnectedStateExA is not supported\n");
return;
}
res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
if(!res) {
win_skip("InternetGetConnectedStateExA tests require a valid connection\n");
return;
}
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, buffer);
res = pInternetGetConnectedStateExA(NULL, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExA(&flags, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
buffer[0] = 0;
res = pInternetGetConnectedStateExA(NULL, buffer, sizeof(buffer), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
sz = strlen(buffer);
ok(sz > 0, "Expected a connection name\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
sz = strlen(buffer);
ok(sz > 0, "Expected a connection name\n");
/* no space for complete string this time */
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, sz, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(sz - 1 == strlen(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenA(buffer));
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer));
}
static void test_InternetGetConnectedStateExW(void)
{
BOOL res;
WCHAR buffer[256];
DWORD flags, sz;
if(!pInternetGetConnectedStateExW) {
win_skip("InternetGetConnectedStateExW is not supported\n");
return;
}
res = pInternetGetConnectedStateExW(&flags, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
if(!res) {
win_skip("InternetGetConnectedStateExW tests require a valid connection\n");
return;
}
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
todo_wine
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
buffer[0] = 0;
res = pInternetGetConnectedStateExW(NULL, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
sz = lstrlenW(buffer);
ok(sz > 0, "Expected a connection name\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
sz = lstrlenW(buffer);
ok(sz > 0, "Expected a connection name\n");
/* no space for complete string this time */
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, sz, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(sz - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenW(buffer));
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer));
}
/* ############################### */
START_TEST(internet)
@ -1471,6 +1607,8 @@ START_TEST(internet)
pPrivacySetZonePreferenceW = (void*)GetProcAddress(hdll, "PrivacySetZonePreferenceW");
pInternetGetCookieExA = (void*)GetProcAddress(hdll, "InternetGetCookieExA");
pInternetGetCookieExW = (void*)GetProcAddress(hdll, "InternetGetCookieExW");
pInternetGetConnectedStateExA = (void*)GetProcAddress(hdll, "InternetGetConnectedStateExA");
pInternetGetConnectedStateExW = (void*)GetProcAddress(hdll, "InternetGetConnectedStateExW");
if(!pInternetGetCookieExW) {
win_skip("Too old IE (older than 6.0)\n");
@ -1479,6 +1617,8 @@ START_TEST(internet)
test_InternetCanonicalizeUrlA();
test_InternetQueryOptionA();
test_InternetGetConnectedStateExA();
test_InternetGetConnectedStateExW();
test_get_cookie();
test_complicated_cookie();
test_cookie_url();

View file

@ -517,7 +517,7 @@ static void InternetCrackUrl_test(void)
ret, GLE);
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
ret = InternetCrackUrl("about://host/blank", 0,0,&urlComponents);
ret = InternetCrackUrlA("about://host/blank", 0,0,&urlComponents);
ok(ret, "InternetCrackUrl failed with %d\n", GetLastError());
ok(!strcmp(urlComponents.lpszScheme, "about"), "lpszScheme was \"%s\" instead of \"about\"\n", urlComponents.lpszScheme);
ok(!strcmp(urlComponents.lpszHostName, "host"), "lpszHostName was \"%s\" instead of \"host\"\n", urlComponents.lpszHostName);
@ -526,7 +526,7 @@ static void InternetCrackUrl_test(void)
/* try a NULL lpszUrl */
SetLastError(0xdeadbeef);
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
ret = InternetCrackUrl(NULL, 0, 0, &urlComponents);
ret = InternetCrackUrlA(NULL, 0, 0, &urlComponents);
GLE = GetLastError();
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
ok(GLE == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GLE);
@ -536,7 +536,7 @@ static void InternetCrackUrl_test(void)
*/
SetLastError(0xdeadbeef);
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
ret = InternetCrackUrl("", 0, 0, &urlComponents);
ret = InternetCrackUrlA("", 0, 0, &urlComponents);
GLE = GetLastError();
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
ok(GLE != 0xdeadbeef && GLE != ERROR_SUCCESS, "Expected GLE to represent a failure\n");
@ -746,7 +746,7 @@ static void InternetCrackUrlW_test(void)
ok( urlpart[0] == 0, "urlpart should be empty\n");
}
static void fill_url_components(LPURL_COMPONENTS lpUrlComponents)
static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
{
static CHAR http[] = "http",
winehq[] = "www.winehq.org",
@ -755,7 +755,7 @@ static void fill_url_components(LPURL_COMPONENTS lpUrlComponents)
site_about[] = "/site/about",
empty[] = "";
lpUrlComponents->dwStructSize = sizeof(URL_COMPONENTS);
lpUrlComponents->dwStructSize = sizeof(URL_COMPONENTSA);
lpUrlComponents->lpszScheme = http;
lpUrlComponents->dwSchemeLength = strlen(lpUrlComponents->lpszScheme);
lpUrlComponents->nScheme = INTERNET_SCHEME_HTTP;
@ -774,7 +774,7 @@ static void fill_url_components(LPURL_COMPONENTS lpUrlComponents)
static void InternetCreateUrlA_test(void)
{
URL_COMPONENTS urlComp;
URL_COMPONENTSA urlComp;
LPSTR szUrl;
DWORD len = -1;
BOOL ret;
@ -802,7 +802,7 @@ static void InternetCreateUrlA_test(void)
ok(len == -1, "Expected len -1, got %d\n", len);
/* test zero'ed lpUrlComponents */
ZeroMemory(&urlComp, sizeof(URL_COMPONENTS));
ZeroMemory(&urlComp, sizeof(urlComp));
SetLastError(0xdeadbeef);
ret = InternetCreateUrlA(&urlComp, 0, NULL, &len);
ok(!ret, "Expected failure\n");
@ -992,7 +992,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = http;
urlComp.dwSchemeLength = 0;
urlComp.nScheme = INTERNET_SCHEME_HTTP;
@ -1017,7 +1017,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = https;
urlComp.dwSchemeLength = 0;
urlComp.nScheme = INTERNET_SCHEME_HTTP;
@ -1042,7 +1042,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = about;
urlComp.dwSchemeLength = 5;
urlComp.lpszUrlPath = blank;
@ -1058,7 +1058,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = about;
urlComp.lpszHostName = host;
urlComp.lpszUrlPath = blank;
@ -1073,7 +1073,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.nPort = 8080;
urlComp.lpszScheme = about;
len = strlen(CREATE_URL11);
@ -1086,7 +1086,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = http;
urlComp.dwSchemeLength = 0;
urlComp.nScheme = INTERNET_SCHEME_HTTP;
@ -1103,7 +1103,7 @@ static void InternetCreateUrlA_test(void)
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
urlComp.dwStructSize = sizeof(URL_COMPONENTS);
urlComp.dwStructSize = sizeof(urlComp);
urlComp.lpszScheme = http;
urlComp.dwSchemeLength = strlen(urlComp.lpszScheme);
urlComp.lpszHostName = localhost;

View file

@ -47,8 +47,9 @@ static BOOL (WINAPI *pUnlockUrlCacheEntryFileA)(LPCSTR,DWORD);
static char filenameA[MAX_PATH + 1];
static char filenameA1[MAX_PATH + 1];
static BOOL old_ie = FALSE;
static BOOL ie10_cache = FALSE;
static void check_cache_entry_infoA(const char *returnedfrom, LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo)
static void check_cache_entry_infoA(const char *returnedfrom, INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo)
{
ok(lpCacheEntryInfo->dwStructSize == sizeof(*lpCacheEntryInfo), "%s: dwStructSize was %d\n", returnedfrom, lpCacheEntryInfo->dwStructSize);
ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom, test_url, lpCacheEntryInfo->lpszSourceUrlName);
@ -63,16 +64,16 @@ static void test_find_url_cache_entriesA(void)
BOOL found = FALSE;
DWORD cbCacheEntryInfo;
DWORD cbCacheEntryInfoSaved;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo;
INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
hEnumHandle = FindFirstUrlCacheEntry(NULL, NULL, &cbCacheEntryInfo);
hEnumHandle = FindFirstUrlCacheEntryA(NULL, NULL, &cbCacheEntryInfo);
ok(!hEnumHandle, "FindFirstUrlCacheEntry should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo * sizeof(char));
cbCacheEntryInfoSaved = cbCacheEntryInfo;
hEnumHandle = FindFirstUrlCacheEntry(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
hEnumHandle = FindFirstUrlCacheEntryA(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
while (TRUE)
{
@ -84,14 +85,14 @@ static void test_find_url_cache_entriesA(void)
}
SetLastError(0xdeadbeef);
cbCacheEntryInfo = cbCacheEntryInfoSaved;
ret = FindNextUrlCacheEntry(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
if (!ret)
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
lpCacheEntryInfo = HeapReAlloc(GetProcessHeap(), 0, lpCacheEntryInfo, cbCacheEntryInfo);
cbCacheEntryInfoSaved = cbCacheEntryInfo;
ret = FindNextUrlCacheEntry(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = FindNextUrlCacheEntryA(hEnumHandle, lpCacheEntryInfo, &cbCacheEntryInfo);
}
}
if (!ret)
@ -108,27 +109,27 @@ static void test_GetUrlCacheEntryInfoExA(void)
{
BOOL ret;
DWORD cbCacheEntryInfo, cbRedirectUrl;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo;
INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(NULL, NULL, NULL, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA(NULL, NULL, NULL, NULL, NULL, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFO);
cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFOA);
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx("", NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA("", NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
ret = GetUrlCacheEntryInfoEx(test_url, NULL, NULL, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
@ -136,16 +137,16 @@ static void test_GetUrlCacheEntryInfoExA(void)
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
ok(!ret, "GetUrlCacheEntryInfoEx succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
ok(ret == ie10_cache, "GetUrlCacheEntryInfoEx returned %x\n", ret);
if (!ret) ok(GetLastError() == ERROR_FILE_NOT_FOUND,
"GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %d\n", GetLastError());
/* Unicode version of function seems to ignore 0x200 flag */
ret = GetUrlCacheEntryInfoExW(test_urlW, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
ok(ret || broken(old_ie && !ret), "GetUrlCacheEntryInfoExW failed with error %d\n", GetLastError());
ret = GetUrlCacheEntryInfoEx(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
@ -155,12 +156,12 @@ static void test_GetUrlCacheEntryInfoExA(void)
ok(ret, "SetUrlCacheEntryInfoA failed with error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
cbCacheEntryInfo = 100000;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx with zero-length buffer should fail\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
@ -168,12 +169,12 @@ static void test_GetUrlCacheEntryInfoExA(void)
/* Querying the redirect URL fails with ERROR_INVALID_PARAMETER */
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, &cbRedirectUrl, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfoEx(test_url, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
ret = GetUrlCacheEntryInfoExA(test_url, NULL, &cbCacheEntryInfo, NULL, &cbRedirectUrl, NULL, 0);
ok(!ret, "GetUrlCacheEntryInfoEx should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
@ -186,7 +187,7 @@ static void test_RetrieveUrlCacheEntryA(void)
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = RetrieveUrlCacheEntryFile(NULL, NULL, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
@ -194,14 +195,14 @@ static void test_RetrieveUrlCacheEntryA(void)
{
/* Crashes on Win9x, NT4 and W2K */
SetLastError(0xdeadbeef);
ret = RetrieveUrlCacheEntryFile(test_url, NULL, NULL, 0);
ret = RetrieveUrlCacheEntryFileA(test_url, NULL, NULL, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
}
SetLastError(0xdeadbeef);
cbCacheEntryInfo = 100000;
ret = RetrieveUrlCacheEntryFile(NULL, NULL, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(NULL, NULL, &cbCacheEntryInfo, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
}
@ -213,23 +214,23 @@ static void test_IsUrlCacheEntryExpiredA(void)
BOOL ret;
FILETIME ft;
DWORD size;
LPINTERNET_CACHE_ENTRY_INFO info;
INTERNET_CACHE_ENTRY_INFOA *info;
ULARGE_INTEGER exp_time;
/* The function returns TRUE when the output time is NULL or the tested URL
* is NULL.
*/
ret = IsUrlCacheEntryExpiredA(NULL, 0, NULL);
ok(ret, "expected TRUE\n");
ok(!ret == ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
ft.dwLowDateTime = 0xdeadbeef;
ft.dwHighDateTime = 0xbaadf00d;
ret = IsUrlCacheEntryExpiredA(NULL, 0, &ft);
ok(ret, "expected TRUE\n");
ok(!ret == ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
ok(ft.dwLowDateTime == 0xdeadbeef && ft.dwHighDateTime == 0xbaadf00d,
"expected time to be unchanged, got (%u,%u)\n",
ft.dwLowDateTime, ft.dwHighDateTime);
ret = IsUrlCacheEntryExpiredA(test_url, 0, NULL);
ok(ret, "expected TRUE\n");
ok(!ret == ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
/* The return value should indicate whether the URL is expired,
* and the filetime indicates the last modified time, but a cache entry
@ -253,12 +254,12 @@ static void test_IsUrlCacheEntryExpiredA(void)
ft.dwLowDateTime, ft.dwHighDateTime);
/* Set the expire time to a point in the past.. */
ret = GetUrlCacheEntryInfo(test_url, NULL, &size);
ret = GetUrlCacheEntryInfoA(test_url, NULL, &size);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
info = HeapAlloc(GetProcessHeap(), 0, size);
ret = GetUrlCacheEntryInfo(test_url, info, &size);
ret = GetUrlCacheEntryInfoA(test_url, info, &size);
ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
GetSystemTimeAsFileTime(&info->ExpireTime);
exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
@ -266,7 +267,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
exp_time.QuadPart -= 10 * 60 * (ULONGLONG)10000000;
info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
ret = SetUrlCacheEntryInfo(test_url, info, CACHE_ENTRY_EXPTIME_FC);
ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_EXPTIME_FC);
ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
ft.dwLowDateTime = 0xdeadbeef;
ft.dwHighDateTime = 0xbaadf00d;
@ -281,7 +282,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
exp_time.QuadPart += 20 * 60 * (ULONGLONG)10000000;
info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
ret = SetUrlCacheEntryInfo(test_url, info, CACHE_ENTRY_EXPTIME_FC);
ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_EXPTIME_FC);
ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
ft.dwLowDateTime = 0xdeadbeef;
ft.dwHighDateTime = 0xbaadf00d;
@ -294,7 +295,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
ft.dwLowDateTime, ft.dwHighDateTime);
/* Set the modified time... */
GetSystemTimeAsFileTime(&info->LastModifiedTime);
ret = SetUrlCacheEntryInfo(test_url, info, CACHE_ENTRY_MODTIME_FC);
ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_MODTIME_FC);
ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
/* and the entry should still be unexpired.. */
ret = IsUrlCacheEntryExpiredA(test_url, 0, &ft);
@ -312,7 +313,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
ft.dwLowDateTime = 0xdeadbeef;
ft.dwHighDateTime = 0xbaadf00d;
ret = IsUrlCacheEntryExpiredA(uncached_url, 0, &ft);
ok(ret, "expected TRUE\n");
ok(!ret == ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
"expected time (0,0), got (%u,%u)\n",
ft.dwLowDateTime, ft.dwHighDateTime);
@ -369,16 +370,16 @@ static void test_urlcacheA(void)
BOOL ret;
HANDLE hFile;
BYTE zero_byte = 0;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo;
LPINTERNET_CACHE_ENTRY_INFO lpCacheEntryInfo2;
INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo;
INTERNET_CACHE_ENTRY_INFOA *lpCacheEntryInfo2;
DWORD cbCacheEntryInfo;
static const FILETIME filetime_zero;
FILETIME now;
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA1, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
check_file_exists(filenameA1);
DeleteFileA(filenameA1);
@ -387,15 +388,15 @@ static void test_urlcacheA(void)
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
ret = CommitUrlCacheEntry(test_url1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ret = CommitUrlCacheEntryA(test_url1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
ret = GetUrlCacheEntryInfo(test_url1, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(!memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
"expected zero ExpireTime\n");
@ -413,16 +414,16 @@ static void test_urlcacheA(void)
/* A subsequent commit with a different time/type doesn't change most of the entry */
GetSystemTimeAsFileTime(&now);
ret = CommitUrlCacheEntry(test_url1, NULL, now, now, NORMAL_CACHE_ENTRY,
ret = CommitUrlCacheEntryA(test_url1, NULL, now, now, NORMAL_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), NULL, NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
ret = GetUrlCacheEntryInfo(test_url1, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url1, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
/* but it does change the time.. */
ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
@ -451,18 +452,18 @@ static void test_urlcacheA(void)
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = RetrieveUrlCacheEntryFile(test_url, NULL, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = RetrieveUrlCacheEntryFile(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
@ -471,9 +472,9 @@ static void test_urlcacheA(void)
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = RetrieveUrlCacheEntryFile(test_url1, NULL, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(test_url1, NULL, &cbCacheEntryInfo, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INVALID_DATA,
ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
if (pUnlockUrlCacheEntryFileA)
@ -498,14 +499,14 @@ static void test_urlcacheA(void)
}
SetLastError(0xdeadbeef);
ret = DeleteFile(filenameA);
ret = DeleteFileA(filenameA);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "local file should no longer exist\n");
/* Creating two entries with the same URL */
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA1, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
@ -515,13 +516,13 @@ static void test_urlcacheA(void)
check_file_exists(filenameA);
check_file_exists(filenameA1);
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
strlen(ok_header), "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
check_file_exists(filenameA);
check_file_exists(filenameA1);
ret = CommitUrlCacheEntry(test_url, filenameA1, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero,
filetime_zero, COOKIE_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
/* By committing the same URL a second time, the prior entry is
@ -529,12 +530,12 @@ static void test_urlcacheA(void)
*/
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(test_url, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
/* with the previous entry type retained.. */
ok(lpCacheEntryInfo->CacheEntryType & NORMAL_CACHE_ENTRY,
@ -562,21 +563,21 @@ static void test_urlcacheA(void)
/* Check whether a retrieved cache entry can be deleted before it's
* unlocked:
*/
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = RetrieveUrlCacheEntryFile(test_url, NULL, &cbCacheEntryInfo, 0);
ret = RetrieveUrlCacheEntryFileA(test_url, NULL, &cbCacheEntryInfo, 0);
ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = RetrieveUrlCacheEntryFile(test_url, lpCacheEntryInfo,
ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo,
&cbCacheEntryInfo, 0);
ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
@ -593,7 +594,7 @@ static void test_urlcacheA(void)
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(lpCacheEntryInfo->CacheEntryType & 0x400000,
"CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08x)\n",
@ -624,13 +625,13 @@ static void test_urlcacheA(void)
/* Test whether preventing a file from being deleted causes
* DeleteUrlCacheEntryA to fail.
*/
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
check_file_exists(filenameA);
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero,
filetime_zero, NORMAL_CACHE_ENTRY, (LPBYTE)ok_header,
strlen(ok_header), "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
@ -662,35 +663,35 @@ static void test_urlcacheA(void)
* must have been set already.
*/
SetLastError(0xdeadbeef);
ret = CommitUrlCacheEntry(test_url, NULL, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
STICKY_CACHE_ENTRY, (LPBYTE)ok_header, strlen(ok_header), "html",
NULL);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CommitUrlCacheEntry(test_url, NULL, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, NULL, filetime_zero, filetime_zero,
NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), "html", NULL);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(test_url, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(lpCacheEntryInfo->CacheEntryType & (NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY),
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
@ -707,21 +708,21 @@ static void test_urlcacheA(void)
check_file_not_exists(filenameA);
}
/* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
ret = CommitUrlCacheEntry(test_url, filenameA, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA, filetime_zero, filetime_zero,
NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
SetLastError(0xdeadbeef);
ret = GetUrlCacheEntryInfo(test_url, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(lpCacheEntryInfo->CacheEntryType & (NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY),
"expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
@ -733,7 +734,7 @@ static void test_urlcacheA(void)
ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
CACHE_ENTRY_EXEMPT_DELTA_FC);
ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
U(*lpCacheEntryInfo).dwExemptDelta);
@ -750,20 +751,19 @@ static void test_urlcacheA(void)
CACHE_ENTRY_EXEMPT_DELTA_FC);
ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
ret = CreateUrlCacheEntry(test_url, 0, "html", filenameA1, 0);
ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
create_and_write_file(filenameA1, &zero_byte, sizeof(zero_byte));
ret = CommitUrlCacheEntry(test_url, filenameA1, filetime_zero, filetime_zero,
ret = CommitUrlCacheEntryA(test_url, filenameA1, filetime_zero, filetime_zero,
NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY,
(LPBYTE)ok_header, strlen(ok_header), "html", NULL);
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
ret = GetUrlCacheEntryInfo(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600,
"expected dwExemptDelta 8600, got %d\n",
U(*lpCacheEntryInfo).dwExemptDelta);
ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600 || (ie10_cache && U(*lpCacheEntryInfo).dwExemptDelta == 86400),
"expected dwExemptDelta 8600, got %d\n", U(*lpCacheEntryInfo).dwExemptDelta);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
@ -781,24 +781,24 @@ static void test_urlcacheA(void)
ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
cbCacheEntryInfo = 0;
ret = GetUrlCacheEntryInfo(test_hash_collisions1, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_hash_collisions1, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions1),
"got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
cbCacheEntryInfo = 0;
ret = GetUrlCacheEntryInfo(test_hash_collisions2, NULL, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_hash_collisions2, NULL, &cbCacheEntryInfo);
ok(!ret, "GetUrlCacheEntryInfo should have failed\n");
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
"expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
ret = GetUrlCacheEntryInfo(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
ret = GetUrlCacheEntryInfoA(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions2),
"got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
@ -866,11 +866,24 @@ static void test_urlcacheW(void)
return;
}
if(ie10_cache) {
if(!MultiByteToWideChar(CP_ACP, 0, urls[6].encoded_url, -1,
urls[6].url, sizeof(urls[6].url)/sizeof(WCHAR)))
urls[6].url[0] = 0;
trace("converted url in test 6: %s\n", wine_dbgstr_w(urls[6].url));
}
for(i=0; i<sizeof(urls)/sizeof(*urls); i++) {
INTERNET_CACHE_ENTRY_INFOA *entry_infoA;
INTERNET_CACHE_ENTRY_INFOW *entry_infoW;
DWORD size;
if(!urls[i].url[0]) {
win_skip("No UTF16 version of url (%d)\n", i);
continue;
}
SetLastError(0xdeadbeef);
ret = CreateUrlCacheEntryW(urls[i].url, 0, NULL, bufW, 0);
if(urls[i].err != 0) {
@ -952,10 +965,13 @@ static void test_urlcacheW(void)
}
if(!urls[i].extension[0]) {
ok(!entry_infoW->lpszFileExtension, "entry_infoW->lpszFileExtension != NULL\n");
ok(!entry_infoW->lpszFileExtension || (ie10_cache && !entry_infoW->lpszFileExtension[0]),
"%d) entry_infoW->lpszFileExtension = %s\n",
i, wine_dbgstr_w(entry_infoW->lpszFileExtension));
}else {
MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszFileExtension, -1, bufW, MAX_PATH);
ok(!lstrcmpW(entry_infoW->lpszFileExtension, bufW),
ok(!lstrcmpW(entry_infoW->lpszFileExtension, bufW) ||
(ie10_cache && !lstrcmpW(entry_infoW->lpszFileExtension, urls[i].extension)),
"%d) entry_infoW->lpszFileExtension = %s, expected %s\n",
i, wine_dbgstr_w(entry_infoW->lpszFileExtension), wine_dbgstr_w(bufW));
}
@ -1034,6 +1050,11 @@ START_TEST(urlcache)
if(!GetProcAddress(hdll, "InternetGetSecurityInfoByURL")) /* < IE7 */
old_ie = TRUE;
if(GetProcAddress(hdll, "CreateUrlCacheEntryExW")) {
trace("Running tests on IE10 or newer\n");
ie10_cache = TRUE;
}
pDeleteUrlCacheEntryA = (void*)GetProcAddress(hdll, "DeleteUrlCacheEntryA");
pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
test_urlcacheA();

View file

@ -24,7 +24,7 @@
* between the A and W versions, we just define a set of macros so the
* generated tests work anyway.
*/
#ifndef GOPHER_ABSTRACT_ATTRIBUTE_TYPE
#ifndef __WINESRC__
#define GOPHER_ABSTRACT_ATTRIBUTE_TYPEA GOPHER_ABSTRACT_ATTRIBUTE_TYPE
#define GOPHER_ABSTRACT_ATTRIBUTE_TYPEW GOPHER_ABSTRACT_ATTRIBUTE_TYPE