[WININET_WINETEST]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Apr 2014 17:50:30 +0000 (17:50 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Apr 2014 17:50:30 +0000 (17:50 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62994

rostests/winetests/wininet/ftp.c
rostests/winetests/wininet/http.c
rostests/winetests/wininet/internet.c
rostests/winetests/wininet/url.c
rostests/winetests/wininet/urlcache.c
rostests/winetests/wininet/wininet_test.h

index 5c19cd8..edeab54 100644 (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);
index 8f3fc9f..b0481c7 100644 (file)
@@ -474,7 +474,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     const char *types[2] = { "*", NULL };
     HINTERNET hi, hic = 0, hor = 0;
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     trace("Starting InternetReadFile test with flags 0x%x on url %s\n",flags,test->url);
 
@@ -561,7 +561,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     if(test->flags & TESTF_COMPRESSED) {
         BOOL b = TRUE;
 
-        res = InternetSetOption(hor, INTERNET_OPTION_HTTP_DECODING, &b, sizeof(b));
+        res = InternetSetOptionA(hor, INTERNET_OPTION_HTTP_DECODING, &b, sizeof(b));
         ok(res || broken(!res && GetLastError() == ERROR_INTERNET_INVALID_OPTION),
            "InternetSetOption failed: %u\n", GetLastError());
         if(!res)
@@ -739,7 +739,7 @@ static void InternetReadFile_chunked_test(void)
 {
     BOOL res;
     CHAR buffer[4000];
-    DWORD length;
+    DWORD length, got;
     const char *types[2] = { "*", NULL };
     HINTERNET hi, hic = 0, hor = 0;
 
@@ -819,7 +819,6 @@ static void InternetReadFile_chunked_test(void)
         trace("got %u available\n",length);
         if (length)
         {
-            DWORD got;
             char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
 
             res = InternetReadFile(hor,buffer,length,&got);
@@ -833,7 +832,13 @@ static void InternetReadFile_chunked_test(void)
             if (!got) break;
         }
         if (length == 0)
+        {
+            got = 0xdeadbeef;
+            res = InternetReadFile( hor, buffer, 1, &got );
+            ok( res, "InternetReadFile failed: %u\n", GetLastError() );
+            ok( !got, "got %u\n", got );
             break;
+        }
     }
 abort:
     trace("aborting\n");
@@ -853,9 +858,9 @@ static void InternetReadFileExA_test(int flags)
     DWORD length;
     const char *types[2] = { "*", NULL };
     HINTERNET hi, hic = 0, hor = 0;
-    INTERNET_BUFFERS inetbuffers;
+    INTERNET_BUFFERSA inetbuffers;
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     trace("Starting InternetReadFileExA test with flags 0x%x\n",flags);
 
@@ -967,14 +972,14 @@ static void InternetReadFileExA_test(int flags)
     CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
 
     /* tests invalid dwStructSize */
-    inetbuffers.dwStructSize = sizeof(INTERNET_BUFFERS)+1;
+    inetbuffers.dwStructSize = sizeof(inetbuffers)+1;
     inetbuffers.lpcszHeader = NULL;
     inetbuffers.dwHeadersLength = 0;
     inetbuffers.dwBufferLength = 10;
     inetbuffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, 10);
     inetbuffers.dwOffsetHigh = 1234;
     inetbuffers.dwOffsetLow = 5678;
-    rc = InternetReadFileEx(hor, &inetbuffers, 0, 0xdeadcafe);
+    rc = InternetReadFileExA(hor, &inetbuffers, 0, 0xdeadcafe);
     ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
         "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
         rc ? "TRUE" : "FALSE", GetLastError());
@@ -983,8 +988,8 @@ static void InternetReadFileExA_test(int flags)
     test_request_flags(hor, 0);
 
     /* tests to see whether lpcszHeader is used - it isn't */
-    inetbuffers.dwStructSize = sizeof(INTERNET_BUFFERS);
-    inetbuffers.lpcszHeader = (LPCTSTR)0xdeadbeef;
+    inetbuffers.dwStructSize = sizeof(inetbuffers);
+    inetbuffers.lpcszHeader = (LPCSTR)0xdeadbeef;
     inetbuffers.dwHeadersLength = 255;
     inetbuffers.dwBufferLength = 0;
     inetbuffers.lpvBuffer = NULL;
@@ -992,7 +997,7 @@ static void InternetReadFileExA_test(int flags)
     inetbuffers.dwOffsetLow = 5678;
     SET_EXPECT(INTERNET_STATUS_RECEIVING_RESPONSE);
     SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
-    rc = InternetReadFileEx(hor, &inetbuffers, 0, 0xdeadcafe);
+    rc = InternetReadFileExA(hor, &inetbuffers, 0, 0xdeadcafe);
     ok(rc, "InternetReadFileEx failed with error %u\n", GetLastError());
     trace("read %i bytes\n", inetbuffers.dwBufferLength);
     todo_wine
@@ -1001,7 +1006,7 @@ static void InternetReadFileExA_test(int flags)
         CHECK_NOT_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
     }
 
-    rc = InternetReadFileEx(NULL, &inetbuffers, 0, 0xdeadcafe);
+    rc = InternetReadFileExA(NULL, &inetbuffers, 0, 0xdeadcafe);
     ok(!rc && (GetLastError() == ERROR_INVALID_HANDLE),
         "InternetReadFileEx should have failed with ERROR_INVALID_HANDLE instead of %s, %u\n",
         rc ? "TRUE" : "FALSE", GetLastError());
@@ -1011,7 +1016,7 @@ static void InternetReadFileExA_test(int flags)
 
     while (TRUE)
     {
-        inetbuffers.dwStructSize = sizeof(INTERNET_BUFFERS);
+        inetbuffers.dwStructSize = sizeof(inetbuffers);
         inetbuffers.dwBufferLength = 1024;
         inetbuffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, inetbuffers.dwBufferLength+1);
         inetbuffers.dwOffsetHigh = 1234;
@@ -1089,18 +1094,18 @@ static void InternetOpenUrlA_test(void)
   DWORD size, readbytes, totalbytes=0;
   BOOL ret;
 
-  ret = DeleteUrlCacheEntry(TEST_URL);
+  ret = DeleteUrlCacheEntryA(TEST_URL);
   ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND,
           "DeleteUrlCacheEntry returned %x, GetLastError() = %d\n", ret, GetLastError());
 
-  myhinternet = InternetOpen("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
+  myhinternet = InternetOpenA("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
   ok((myhinternet != 0), "InternetOpen failed, error %u\n",GetLastError());
   size = 0x400;
-  ret = InternetCanonicalizeUrl(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
+  ret = InternetCanonicalizeUrlA(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
   ok( ret, "InternetCanonicalizeUrl failed, error %u\n",GetLastError());
 
   SetLastError(0);
-  myhttp = InternetOpenUrl(myhinternet, TEST_URL, 0, 0,
+  myhttp = InternetOpenUrlA(myhinternet, TEST_URL, 0, 0,
                           INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);
   if (GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
     return; /* WinXP returns this when not connected to the net */
@@ -1115,7 +1120,7 @@ static void InternetOpenUrlA_test(void)
   InternetCloseHandle(myhttp);
   InternetCloseHandle(myhinternet);
 
-  ret = DeleteUrlCacheEntry(TEST_URL);
+  ret = DeleteUrlCacheEntryA(TEST_URL);
   ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "INTERNET_FLAG_NO_CACHE_WRITE flag doesn't work\n");
 }
 
@@ -1125,7 +1130,7 @@ static void HttpSendRequestEx_test(void)
     HINTERNET hConnect;
     HINTERNET hRequest;
 
-    INTERNET_BUFFERS BufferIn;
+    INTERNET_BUFFERSA BufferIn;
     DWORD dwBytesWritten, dwBytesRead, error;
     CHAR szBuffer[256];
     int i;
@@ -1134,14 +1139,14 @@ static void HttpSendRequestEx_test(void)
     static char szPostData[] = "mode=Test";
     static const char szContentType[] = "Content-Type: application/x-www-form-urlencoded";
 
-    hSession = InternetOpen("Wine Regression Test",
+    hSession = InternetOpenA("Wine Regression Test",
             INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
     ok( hSession != NULL ,"Unable to open Internet session\n");
-    hConnect = InternetConnect(hSession, "crossover.codeweavers.com",
+    hConnect = InternetConnectA(hSession, "crossover.codeweavers.com",
             INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0,
             0);
     ok( hConnect != NULL, "Unable to connect to http://crossover.codeweavers.com\n");
-    hRequest = HttpOpenRequest(hConnect, "POST", "/posttest.php",
+    hRequest = HttpOpenRequestA(hConnect, "POST", "/posttest.php",
             NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
     {
@@ -1152,8 +1157,8 @@ static void HttpSendRequestEx_test(void)
 
     test_request_flags(hRequest, INTERNET_REQFLAG_NO_HEADERS);
 
-    BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS);
-    BufferIn.Next = (LPINTERNET_BUFFERS)0xdeadcab;
+    BufferIn.dwStructSize = sizeof(BufferIn);
+    BufferIn.Next = (INTERNET_BUFFERSA*)0xdeadcab;
     BufferIn.lpcszHeader = szContentType;
     BufferIn.dwHeadersLength = sizeof(szContentType)-1;
     BufferIn.dwHeadersTotal = sizeof(szContentType)-1;
@@ -1164,7 +1169,7 @@ static void HttpSendRequestEx_test(void)
     BufferIn.dwOffsetHigh = 0;
 
     SetLastError(0xdeadbeef);
-    ret = HttpSendRequestEx(hRequest, &BufferIn, NULL, 0 ,0);
+    ret = HttpSendRequestExA(hRequest, &BufferIn, NULL, 0 ,0);
     error = GetLastError();
     ok(ret, "HttpSendRequestEx Failed with error %u\n", error);
     ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", error);
@@ -1177,7 +1182,7 @@ static void HttpSendRequestEx_test(void)
 
     test_request_flags(hRequest, INTERNET_REQFLAG_NO_HEADERS);
 
-    ok(HttpEndRequest(hRequest, NULL, 0, 0), "HttpEndRequest Failed\n");
+    ok(HttpEndRequestA(hRequest, NULL, 0, 0), "HttpEndRequest Failed\n");
 
     test_request_flags(hRequest, 0);
 
@@ -1227,14 +1232,14 @@ static void InternetOpenRequest_test(void)
     }
     ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
     request = HttpOpenRequestW(connect, NULL, slash, NULL, NULL, typesW, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
@@ -1260,7 +1265,7 @@ static void test_cache_read(void)
 
     trace("Testing cache read...\n");
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     for(i = 0; i < sizeof(content); i++)
         content[i] = '0' + (i%10);
@@ -1386,14 +1391,14 @@ static void test_http_cache(void)
     ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
     ok(!size, "size = %d\n", size);
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
 
     size = sizeof(file_name);
     ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size);
     ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError());
 
-    file = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+    file = CreateFileA(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL, NULL);
     ok(file != INVALID_HANDLE_VALUE, "Could not create file: %u\n", GetLastError());
     file_size = GetFileSize(file, NULL);
@@ -1408,17 +1413,20 @@ static void test_http_cache(void)
     ok(file_size == 106, "file size = %u\n", file_size);
     CloseHandle(file);
 
+    ret = DeleteFileA(file_name);
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
-    file = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
+    file = CreateFileA(file_name, GENERIC_READ, 0, NULL, OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL, NULL);
     ok(file != INVALID_HANDLE_VALUE, "Could not create file: %u\n", GetLastError());
     CloseHandle(file);
 
     /* Send the same request, requiring it to be retrieved from the cache */
-    request = HttpOpenRequest(connect, "GET", "/tests/hello.html", NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
+    request = HttpOpenRequestA(connect, "GET", "/tests/hello.html", NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     size = sizeof(buf);
@@ -1437,7 +1445,7 @@ static void test_http_cache(void)
     ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
     ok(!size, "size = %d\n", size);
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
 
     size = sizeof(file_name);
@@ -1445,7 +1453,7 @@ static void test_http_cache(void)
     ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size);
     if (ret)
     {
-        file = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
+        file = CreateFileA(file_name, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                       FILE_ATTRIBUTE_NORMAL, NULL);
         ok(file != INVALID_HANDLE_VALUE, "Could not create file: %u\n", GetLastError());
         CloseHandle(file);
@@ -1463,6 +1471,78 @@ static void test_http_cache(void)
     test_cache_read();
 }
 
+static void InternetLockRequestFile_test(void)
+{
+    HINTERNET session, connect, request;
+    char file_name[MAX_PATH];
+    HANDLE lock, lock2;
+    DWORD size;
+    BOOL ret;
+
+    static const char *types[] = { "*", "", NULL };
+
+    session = InternetOpenA("Wine Regression Test", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+    ok(session != NULL ,"Unable to open Internet session\n");
+
+    connect = InternetConnectA(session, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
+                              INTERNET_SERVICE_HTTP, 0, 0);
+    ok(connect != NULL, "Unable to connect to http://test.winehq.org with error %d\n", GetLastError());
+
+    request = HttpOpenRequestA(connect, NULL, "/tests/hello.html", NULL, NULL, types, INTERNET_FLAG_NEED_FILE|INTERNET_FLAG_RELOAD, 0);
+    if (!request && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
+    {
+        skip( "Network unreachable, skipping test\n" );
+
+        ok(InternetCloseHandle(connect), "Close connect handle failed\n");
+        ok(InternetCloseHandle(session), "Close session handle failed\n");
+
+        return;
+    }
+    ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
+
+    size = sizeof(file_name);
+    ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size);
+    ok(!ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
+    ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%u\n", GetLastError());
+    ok(!size, "size = %d\n", size);
+
+    lock = NULL;
+    ret = InternetLockRequestFile(request, &lock);
+    ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
+    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+
+    size = sizeof(file_name);
+    ret = InternetQueryOptionA(request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size);
+    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError());
+
+    ret = InternetLockRequestFile(request, &lock);
+    ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+    ok(lock != NULL, "lock == NULL\n");
+
+    ret = InternetLockRequestFile(request, &lock2);
+    ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+    ok(lock == lock2, "lock != lock2\n");
+
+    ret = InternetUnlockRequestFile(lock2);
+    ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
+
+    ret = DeleteFileA(file_name);
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+
+    ok(InternetCloseHandle(request), "Close request handle failed\n");
+
+    ret = DeleteFileA(file_name);
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+
+    ret = InternetUnlockRequestFile(lock);
+    ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
+
+    ret = DeleteFileA(file_name);
+    ok(ret, "Deleting file returned %x(%u)\n", ret, GetLastError());
+}
+
 static void HttpHeaders_test(void)
 {
     HINTERNET hSession;
@@ -1473,15 +1553,16 @@ static void HttpHeaders_test(void)
     DWORD     len = 256;
     DWORD     oldlen;
     DWORD     index = 0;
+    BOOL      ret;
 
-    hSession = InternetOpen("Wine Regression Test",
+    hSession = InternetOpenA("Wine Regression Test",
             INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0);
     ok( hSession != NULL ,"Unable to open Internet session\n");
-    hConnect = InternetConnect(hSession, "crossover.codeweavers.com",
+    hConnect = InternetConnectA(hSession, "crossover.codeweavers.com",
             INTERNET_DEFAULT_HTTP_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0,
             0);
     ok( hConnect != NULL, "Unable to connect to http://crossover.codeweavers.com\n");
-    hRequest = HttpOpenRequest(hConnect, "POST", "/posttest.php",
+    hRequest = HttpOpenRequestA(hConnect, "POST", "/posttest.php",
             NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     if (!hRequest && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
     {
@@ -1493,16 +1574,16 @@ static void HttpHeaders_test(void)
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                buffer,&len,&index)==0,"Warning hearder reported as Existing\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test1",-1,HTTP_ADDREQ_FLAG_ADD),
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test1",-1,HTTP_ADDREQ_FLAG_ADD),
             "Failed to add new header\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
@@ -1510,13 +1591,13 @@ static void HttpHeaders_test(void)
     ok((len < sizeof(buffer)) && (buffer[len] == 0), "Buffer not NULL-terminated\n"); /* len show only 5 characters but the buffer is NULL-terminated*/
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index)==0,"Second Index Should Not Exist\n");
 
     index = 0;
     len = 5; /* could store the string but not the NULL terminator */
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index) == FALSE,"Query succeeded on a too small buffer\n");
     ok(strcmp(buffer,"Warning")==0, "incorrect string was returned(%s)\n",buffer); /* string not touched */
     ok(len == 6, "Invalid length (exp. 6, got %d)\n", len); /* unlike success, the length includes the NULL-terminator */
@@ -1525,7 +1606,7 @@ static void HttpHeaders_test(void)
     index = 0;
     len = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 NULL,&len,&index) == FALSE,"Query worked\n");
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
     ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
@@ -1535,7 +1616,7 @@ static void HttpHeaders_test(void)
     index = 0;
     len = 15;
     SetLastError(0xdeadbeef);
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 NULL,&len,&index) == FALSE,"Query worked\n");
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
     ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
@@ -1544,7 +1625,7 @@ static void HttpHeaders_test(void)
     index = 0;
     len = 0;
     SetLastError(0xdeadbeef);
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 NULL,&len,&index) == FALSE,"Query worked\n");
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
     ok(len > 40, "Invalid length (exp. more than 40, got %d)\n", len);
@@ -1556,7 +1637,7 @@ static void HttpHeaders_test(void)
     index = 0;
     len = sizeof(buffer);
     memset(buffer, 'x', sizeof(buffer));
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(len + sizeof(CHAR) <= oldlen, "Result longer than advertised\n");
     ok((len < sizeof(buffer)-sizeof(CHAR)) && (buffer[len/sizeof(CHAR)] == 0),"No NUL at end\n");
@@ -1595,193 +1676,193 @@ static void HttpHeaders_test(void)
     index = 0;
     len = sizeof(buffer);
     memset(buffer, 'x', sizeof(buffer));
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF,
                 buffer,&len,&index) == TRUE,"Query failed\n");
     ok(len == 2, "Expected 2, got %d\n", len);
     ok(strcmp(buffer, "\r\n") == 0, "Expected CRLF, got '%s'\n", buffer);
     ok(index == 0, "Index was incremented\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test2",-1,HTTP_ADDREQ_FLAG_ADD),
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test2",-1,HTTP_ADDREQ_FLAG_ADD),
             "Failed to add duplicate header using HTTP_ADDREQ_FLAG_ADD\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test1")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test3",-1,HTTP_ADDREQ_FLAG_REPLACE), "Failed to replace header using HTTP_ADDREQ_FLAG_REPLACE\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test3",-1,HTTP_ADDREQ_FLAG_REPLACE), "Failed to replace header using HTTP_ADDREQ_FLAG_REPLACE\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test4",-1,HTTP_ADDREQ_FLAG_ADD_IF_NEW)==0, "HTTP_ADDREQ_FLAG_ADD_IF_NEW replaced existing header\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1,HTTP_ADDREQ_FLAG_ADD_IF_NEW)==0, "HTTP_ADDREQ_FLAG_ADD_IF_NEW replaced existing header\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test2")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test4",-1, HTTP_ADDREQ_FLAG_COALESCE), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test4",-1, HTTP_ADDREQ_FLAG_COALESCE), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test2, test4")==0, "incorrect string was returned(%s)\n", buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test5",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test5",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test2, test4, test5")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test6",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test6",-1, HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON), "HTTP_ADDREQ_FLAG_COALESCE Did not work\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test2, test4, test5; test6")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
-    ok(HttpAddRequestHeaders(hRequest,"Warning:test7",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE), "HTTP_ADDREQ_FLAG_ADD with HTTP_ADDREQ_FLAG_REPALCE Did not work\n");
+    ok(HttpAddRequestHeadersA(hRequest,"Warning:test7",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE), "HTTP_ADDREQ_FLAG_ADD with HTTP_ADDREQ_FLAG_REPALCE Did not work\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"test3")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Failed to get second header\n");
     ok(index == 2, "Index was not incremented\n");
     ok(strcmp(buffer,"test7")==0, "incorrect string was returned(%s)\n",buffer);
     len = sizeof(buffer);
     strcpy(buffer,"Warning");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
     /* Ensure that blank headers are ignored and don't cause a failure */
-    ok(HttpAddRequestHeaders(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
+    ok(HttpAddRequestHeadersA(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"BlankTest");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
 
     /* Ensure that malformed header separators are ignored and don't cause a failure */
-    ok(HttpAddRequestHeaders(hRequest,"\r\rMalformedTest:value\n\nMalformedTestTwo: value2\rMalformedTestThree: value3\n\n\r\r\n",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE),
+    ok(HttpAddRequestHeadersA(hRequest,"\r\rMalformedTest:value\n\nMalformedTestTwo: value2\rMalformedTestThree: value3\n\n\r\r\n",-1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE),
         "Failed to add header with malformed entries in list\n");
 
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"MalformedTest");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"MalformedTestTwo");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"value2")==0, "incorrect string was returned(%s)\n",buffer);
     index = 0;
     len = sizeof(buffer);
     strcpy(buffer,"MalformedTestThree");
-    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
+    ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"value3")==0, "incorrect string was returned(%s)\n",buffer);
 
-    ok(HttpAddRequestHeaders(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD),
-       "unable to add header %u\n", GetLastError());
+    ret = HttpAddRequestHeadersA(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD);
+    ok(ret, "unable to add header %u\n", GetLastError());
 
     index = 0;
     buffer[0] = 0;
     len = sizeof(buffer);
-    ok(HttpQueryInfo(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index),
-       "unable to query header %u\n", GetLastError());
+    ret = HttpQueryInfoA(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index);
+    ok(ret, "unable to query header %u\n", GetLastError());
     ok(index == 1, "index was not incremented\n");
     ok(!strcmp(buffer, "Basic"), "incorrect string was returned (%s)\n", buffer);
 
-    ok(HttpAddRequestHeaders(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE),
-       "unable to remove header %u\n", GetLastError());
+    ret = HttpAddRequestHeadersA(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE);
+    ok(ret, "unable to remove header %u\n", GetLastError());
 
     index = 0;
     len = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    ok(!HttpQueryInfo(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index),
+    ok(!HttpQueryInfoA(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index),
        "header still present\n");
     ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "got %u\n", GetLastError());
 
@@ -1851,14 +1932,14 @@ static const char page1[] =
 static const char ok_with_length[] =
 "HTTP/1.1 200 OK\r\n"
 "Connection: Keep-Alive\r\n"
-"Content-Length: 23\r\n\r\n"
-"abc\r\nHTTP/1.1 211 OK\r\n\r\n";
+"Content-Length: 18\r\n\r\n"
+"HTTP/1.1 211 OK\r\n\r\n";
 
 static const char ok_with_length2[] =
 "HTTP/1.1 210 OK\r\n"
 "Connection: Keep-Alive\r\n"
-"Content-Length: 24\r\n\r\n"
-"abc\r\nHTTP/1.1 211 OK\r\n\r\n";
+"Content-Length: 19\r\n\r\n"
+"HTTP/1.1 211 OK\r\n\r\n";
 
 struct server_info {
     HANDLE hEvent;
@@ -1878,7 +1959,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
     WSADATA wsaData;
     int last_request = 0;
     char host_header[22];
-    static int test_b = 0;
+    static BOOL test_b = FALSE;
     static int test_no_cache = 0;
 
     WSAStartup(MAKEWORD(1,1), &wsaData);
@@ -2018,7 +2099,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
         }
         if (!test_b && strstr(buffer, "/testB HTTP/1.1"))
         {
-            test_b = 1;
+            test_b = TRUE;
             send(c, okmsg, sizeof okmsg-1, 0);
             recvfrom(c, buffer, sizeof buffer, 0, NULL, NULL);
             send(c, okmsg, sizeof okmsg-1, 0);
@@ -2071,6 +2152,12 @@ static DWORD CALLBACK server_thread(LPVOID param)
                 count = 0;
             }
         }
+        if (strstr(buffer, "GET /testH"))
+        {
+            send(c, ok_with_length2, sizeof(ok_with_length2)-1, 0);
+            recvfrom(c, buffer, sizeof(buffer), 0, NULL, NULL);
+            send(c, ok_with_length, sizeof(ok_with_length)-1, 0);
+        }
 
         if (strstr(buffer, "GET /test_no_content"))
         {
@@ -2114,7 +2201,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
             if (!memcmp(buffer, "GET ", sizeof("GET ")-1) &&
                 !strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0);
             else if (strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0);
-            send(c, notokmsg, sizeof(notokmsg)-1, 0);
+            else send(c, notokmsg, sizeof(notokmsg)-1, 0);
         }
         if (strstr(buffer, "GET /test_premature_disconnect"))
             trace("closing connection\n");
@@ -2131,19 +2218,22 @@ static DWORD CALLBACK server_thread(LPVOID param)
 static void test_basic_request(int port, const char *verb, const char *url)
 {
     HINTERNET hi, hc, hr;
-    DWORD r, count;
+    DWORD r, count, error;
     char buffer[0x100];
 
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(hi != NULL, "open failed\n");
 
-    hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(hc != NULL, "connect failed\n");
 
-    hr = HttpOpenRequest(hc, verb, url, NULL, NULL, NULL, 0, 0);
+    hr = HttpOpenRequestA(hc, verb, url, NULL, NULL, NULL, 0, 0);
     ok(hr != NULL, "HttpOpenRequest failed\n");
 
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    SetLastError(0xdeadbeef);
+    r = HttpSendRequestA(hr, NULL, 0, NULL, 0);
+    error = GetLastError();
+    ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error);
     ok(r, "HttpSendRequest failed\n");
 
     count = 0;
@@ -2159,52 +2249,26 @@ static void test_basic_request(int port, const char *verb, const char *url)
     InternetCloseHandle(hi);
 }
 
-static void test_last_error(int port)
-{
-    HINTERNET hi, hc, hr;
-    DWORD error;
-    BOOL r;
-
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(hi != NULL, "open failed\n");
-
-    hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(hc != NULL, "connect failed\n");
-
-    hr = HttpOpenRequest(hc, NULL, "/test1", NULL, NULL, NULL, 0, 0);
-    ok(hr != NULL, "HttpOpenRequest failed\n");
-
-    SetLastError(0xdeadbeef);
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
-    error = GetLastError();
-    ok(r, "HttpSendRequest failed\n");
-    ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error);
-
-    InternetCloseHandle(hr);
-    InternetCloseHandle(hc);
-    InternetCloseHandle(hi);
-}
-
 static void test_proxy_indirect(int port)
 {
     HINTERNET hi, hc, hr;
     DWORD r, sz;
     char buffer[0x40];
 
-    hi = InternetOpen(NULL, 0, NULL, NULL, 0);
+    hi = InternetOpenA(NULL, 0, NULL, NULL, 0);
     ok(hi != NULL, "open failed\n");
 
-    hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(hc != NULL, "connect failed\n");
 
-    hr = HttpOpenRequest(hc, NULL, "/test2", NULL, NULL, NULL, 0, 0);
+    hr = HttpOpenRequestA(hc, NULL, "/test2", NULL, NULL, NULL, 0, 0);
     ok(hr != NULL, "HttpOpenRequest failed\n");
 
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    r = HttpSendRequestA(hr, NULL, 0, NULL, 0);
     ok(r, "HttpSendRequest failed %u\n", GetLastError());
 
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_PROXY_AUTHENTICATE, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_PROXY_AUTHENTICATE, buffer, &sz, NULL);
     ok(r || GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo failed: %d\n", GetLastError());
     if (!r)
     {
@@ -2217,22 +2281,22 @@ static void test_proxy_indirect(int port)
     test_request_flags(hr, 0);
 
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &sz, NULL);
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "Proxy Authentication Required"), "proxy text wrong\n");
 
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_VERSION, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &sz, NULL);
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "HTTP/1.1"), "http version wrong\n");
 
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_SERVER, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_SERVER, buffer, &sz, NULL);
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "winetest"), "http server wrong\n");
 
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_CONTENT_ENCODING, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_CONTENT_ENCODING, buffer, &sz, NULL);
     ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo should fail\n");
     ok(r == FALSE, "HttpQueryInfo failed\n");
 
@@ -2248,99 +2312,99 @@ static void test_proxy_direct(int port)
     DWORD r, sz, error;
     char buffer[0x40], *url;
     WCHAR bufferW[0x40];
+    static const char url_fmt[] = "http://test.winehq.org:%u/test2";
     static CHAR username[] = "mike",
                 password[] = "1101",
-                useragent[] = "winetest",
-                url_fmt[] = "http://test.winehq.org:%u/test2";
-    static WCHAR usernameW[] = {'m','i','k','e',0},
-                 passwordW[] = {'1','1','0','1',0},
-                 useragentW[] = {'w','i','n','e','t','e','s','t',0};
+                useragent[] = "winetest";
+    static const WCHAR usernameW[]  = {'m','i','k','e',0},
+                       passwordW[]  = {'1','1','0','1',0},
+                       useragentW[] = {'w','i','n','e','t','e','s','t',0};
 
     /* specify proxy type without the proxy and bypass */
     SetLastError(0xdeadbeef);
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0);
+    hi = InternetOpenW(NULL, INTERNET_OPEN_TYPE_PROXY, NULL, NULL, 0);
     error = GetLastError();
     ok(error == ERROR_INVALID_PARAMETER ||
         broken(error == ERROR_SUCCESS) /* WinXPProSP2 */, "got %u\n", error);
     ok(hi == NULL || broken(!!hi) /* WinXPProSP2 */, "open should have failed\n");
 
     sprintf(buffer, "localhost:%d\n", port);
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_PROXY, buffer, NULL, 0);
+    hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_PROXY, buffer, NULL, 0);
     ok(hi != NULL, "open failed\n");
 
     /* try connect without authorization */
-    hc = InternetConnect(hi, "test.winehq.org", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    hc = InternetConnectA(hi, "test.winehq.org", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(hc != NULL, "connect failed\n");
 
-    hr = HttpOpenRequest(hc, NULL, "/test2", NULL, NULL, NULL, 0, 0);
+    hr = HttpOpenRequestA(hc, NULL, "/test2", NULL, NULL, NULL, 0, 0);
     ok(hr != NULL, "HttpOpenRequest failed\n");
 
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_PASSWORD, NULL, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, NULL, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == 1, "got %u\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, NULL, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, NULL, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == 1, "got %u\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
     ok(r, "unexpected failure %u\n", GetLastError());
     ok(!sz, "got %u\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
     ok(r, "unexpected failure %u\n", GetLastError());
     ok(!sz, "got %u\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PASSWORD, NULL, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, NULL, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == 1, "got %u\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_USERNAME, NULL, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, NULL, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == 1, "got %u\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
     ok(r, "unexpected failure %u\n", GetLastError());
     ok(!sz, "got %u\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
     ok(r, "unexpected failure %u\n", GetLastError());
     ok(!sz, "got %u\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_URL, NULL, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, NULL, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == 34, "got %u\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_URL, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, buffer, &sz);
     ok(r, "unexpected failure %u\n", GetLastError());
     ok(sz == 33, "got %u\n", sz);
 
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    r = HttpSendRequestW(hr, NULL, 0, NULL, 0);
     ok(r || broken(!r), "HttpSendRequest failed %u\n", GetLastError());
     if (!r)
     {
@@ -2351,19 +2415,19 @@ static void test_proxy_direct(int port)
     test_status_code(hr, 407);
 
     /* set the user + password then try again */
-    r = InternetSetOption(hi, INTERNET_OPTION_PROXY_USERNAME, username, 4);
+    r = InternetSetOptionA(hi, INTERNET_OPTION_PROXY_USERNAME, username, 4);
     ok(!r, "unexpected success\n");
 
-    r = InternetSetOption(hc, INTERNET_OPTION_PROXY_USERNAME, username, 4);
+    r = InternetSetOptionA(hc, INTERNET_OPTION_PROXY_USERNAME, username, 4);
     ok(r, "failed to set user\n");
 
-    r = InternetSetOption(hr, INTERNET_OPTION_PROXY_USERNAME, username, 4);
+    r = InternetSetOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, username, 4);
     ok(r, "failed to set user\n");
 
     buffer[0] = 0;
     sz = 3;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
     ok(!r, "unexpected failure %u\n", GetLastError());
     ok(!buffer[0], "got %s\n", buffer);
     ok(sz == strlen(username) + 1, "got %u\n", sz);
@@ -2371,7 +2435,7 @@ static void test_proxy_direct(int port)
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(username) + 1, "got %u\n", sz);
@@ -2386,7 +2450,7 @@ static void test_proxy_direct(int port)
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
     ok(r, "failed to get username\n");
     ok(!strcmp(buffer, username), "got %s\n", buffer);
     ok(sz == strlen(username), "got %u\n", sz);
@@ -2398,30 +2462,30 @@ static void test_proxy_direct(int port)
     ok(!lstrcmpW(bufferW, usernameW), "wrong username\n");
     ok(sz == lstrlenW(usernameW), "got %u\n", sz);
 
-    r = InternetSetOption(hr, INTERNET_OPTION_PROXY_USERNAME, username, 1);
+    r = InternetSetOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, username, 1);
     ok(r, "failed to set user\n");
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
     ok(r, "failed to get username\n");
     ok(!strcmp(buffer, username), "got %s\n", buffer);
     ok(sz == strlen(username), "got %u\n", sz);
 
-    r = InternetSetOption(hi, INTERNET_OPTION_USER_AGENT, useragent, 1);
+    r = InternetSetOptionA(hi, INTERNET_OPTION_USER_AGENT, useragent, 1);
     ok(r, "failed to set useragent\n");
 
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hi, INTERNET_OPTION_USER_AGENT, buffer, &sz);
+    r = InternetQueryOptionA(hi, INTERNET_OPTION_USER_AGENT, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(useragent) + 1, "got %u\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hi, INTERNET_OPTION_USER_AGENT, buffer, &sz);
+    r = InternetQueryOptionA(hi, INTERNET_OPTION_USER_AGENT, buffer, &sz);
     ok(r, "failed to get user agent\n");
     ok(!strcmp(buffer, useragent), "got %s\n", buffer);
     ok(sz == strlen(useragent), "got %u\n", sz);
@@ -2441,20 +2505,20 @@ static void test_proxy_direct(int port)
     ok(!lstrcmpW(bufferW, useragentW), "wrong user agent\n");
     ok(sz == lstrlenW(useragentW), "got %u\n", sz);
 
-    r = InternetSetOption(hr, INTERNET_OPTION_USERNAME, username, 1);
+    r = InternetSetOptionA(hr, INTERNET_OPTION_USERNAME, username, 1);
     ok(r, "failed to set user\n");
 
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(username) + 1, "got %u\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
     ok(r, "failed to get user\n");
     ok(!strcmp(buffer, username), "got %s\n", buffer);
     ok(sz == strlen(username), "got %u\n", sz);
@@ -2474,20 +2538,20 @@ static void test_proxy_direct(int port)
     ok(!lstrcmpW(bufferW, usernameW), "wrong user\n");
     ok(sz == lstrlenW(usernameW), "got %u\n", sz);
 
-    r = InternetSetOption(hr, INTERNET_OPTION_PASSWORD, password, 1);
+    r = InternetSetOptionA(hr, INTERNET_OPTION_PASSWORD, password, 1);
     ok(r, "failed to set password\n");
 
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(password) + 1, "got %u\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
     ok(r, "failed to get password\n");
     ok(!strcmp(buffer, password), "got %s\n", buffer);
     ok(sz == strlen(password), "got %u\n", sz);
@@ -2512,14 +2576,14 @@ static void test_proxy_direct(int port)
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_URL, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(url) + 1, "got %u\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_URL, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, buffer, &sz);
     ok(r, "failed to get url\n");
     ok(!strcmp(buffer, url), "got %s\n", buffer);
     ok(sz == strlen(url), "got %u\n", sz);
@@ -2540,20 +2604,20 @@ static void test_proxy_direct(int port)
     ok(sz == strlen(url), "got %u\n", sz);
     HeapFree(GetProcessHeap(), 0, url);
 
-    r = InternetSetOption(hr, INTERNET_OPTION_PROXY_PASSWORD, password, 4);
+    r = InternetSetOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, password, 4);
     ok(r, "failed to set password\n");
 
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
     ok(!r, "unexpected success\n");
     ok(sz == strlen(password) + 1, "got %u\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
-    r = InternetQueryOption(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
+    r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
     ok(r, "failed to get password\n");
     ok(!strcmp(buffer, password), "got %s\n", buffer);
     ok(sz == strlen(password), "got %u\n", sz);
@@ -2573,7 +2637,7 @@ static void test_proxy_direct(int port)
     ok(!lstrcmpW(bufferW, passwordW), "wrong password\n");
     ok(sz == lstrlenW(passwordW), "got %u\n", sz);
 
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    r = HttpSendRequestW(hr, NULL, 0, NULL, 0);
     if (!r)
     {
         win_skip("skipping proxy tests on broken wininet\n");
@@ -2581,7 +2645,7 @@ static void test_proxy_direct(int port)
     }
     ok(r, "HttpSendRequest failed %u\n", GetLastError());
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "200"), "proxy code wrong\n");
 
@@ -2593,27 +2657,27 @@ done:
 
 static void test_header_handling_order(int port)
 {
-    static char authorization[] = "Authorization: Basic dXNlcjpwd2Q=";
-    static char connection[]    = "Connection: Close";
+    static const char authorization[] = "Authorization: Basic dXNlcjpwd2Q=";
+    static const char connection[]    = "Connection: Close";
 
     static const char *types[2] = { "*", NULL };
     HINTERNET session, connect, request;
     DWORD size, status;
     BOOL ret;
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, NULL, "/test3", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    request = HttpOpenRequestA(connect, NULL, "/test3", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpAddRequestHeaders(request, authorization, ~0u, HTTP_ADDREQ_FLAG_ADD);
+    ret = HttpAddRequestHeadersA(request, authorization, ~0u, HTTP_ADDREQ_FLAG_ADD);
     ok(ret, "HttpAddRequestHeaders failed\n");
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     test_status_code(request, 200);
@@ -2621,32 +2685,32 @@ static void test_header_handling_order(int port)
 
     InternetCloseHandle(request);
 
-    request = HttpOpenRequest(connect, NULL, "/test4", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    request = HttpOpenRequestA(connect, NULL, "/test4", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(request, connection, ~0u, NULL, 0);
+    ret = HttpSendRequestA(request, connection, ~0u, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     status = 0;
     size = sizeof(status);
-    ret = HttpQueryInfo( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
+    ret = HttpQueryInfoA( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
     ok(ret, "HttpQueryInfo failed\n");
     ok(status == 200 || status == 400 /* IE6 */, "got status %u, expected 200 or 400\n", status);
 
     InternetCloseHandle(request);
 
-    request = HttpOpenRequest(connect, "POST", "/test7", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    request = HttpOpenRequestA(connect, "POST", "/test7", NULL, NULL, types, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpAddRequestHeaders(request, "Content-Length: 100\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
+    ret = HttpAddRequestHeadersA(request, "Content-Length: 100\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     ok(ret, "HttpAddRequestHeaders failed\n");
 
-    ret = HttpSendRequest(request, connection, ~0u, NULL, 0);
+    ret = HttpSendRequestA(request, connection, ~0u, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     status = 0;
     size = sizeof(status);
-    ret = HttpQueryInfo( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
+    ret = HttpQueryInfoA( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
     ok(ret, "HttpQueryInfo failed\n");
     ok(status == 200 || status == 400 /* IE6 */, "got status %u, expected 200 or 400\n", status);
 
@@ -2660,46 +2724,46 @@ static void test_connection_header(int port)
     HINTERNET ses, con, req;
     BOOL ret;
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    req = HttpOpenRequest(con, NULL, "/test8", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    req = HttpOpenRequestA(con, NULL, "/test8", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     test_status_code(req, 200);
 
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, NULL, "/test9", NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, "/test9", NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     test_status_code(req, 200);
 
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, NULL, "/test9", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
+    req = HttpOpenRequestA(con, NULL, "/test9", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     test_status_code(req, 200);
 
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, "POST", "/testA", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
+    req = HttpOpenRequestA(con, "POST", "/testA", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     test_status_code(req, 200);
@@ -2714,24 +2778,24 @@ static void test_http1_1(int port)
     HINTERNET ses, con, req;
     BOOL ret;
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    req = HttpOpenRequest(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    req = HttpOpenRequestA(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     if (ret)
     {
         InternetCloseHandle(req);
 
-        req = HttpOpenRequest(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+        req = HttpOpenRequestA(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
         ok(req != NULL, "HttpOpenRequest failed\n");
 
-        ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+        ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
         ok(ret, "HttpSendRequest failed\n");
     }
 
@@ -2745,7 +2809,7 @@ static void test_connection_closing(int port)
     HINTERNET session, connection, req;
     DWORD res;
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
@@ -2812,22 +2876,21 @@ static void test_connection_closing(int port)
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
-    todo_wine CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
-    todo_wine CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
+    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
+    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
     CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
     CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
 
-    test_status_code_todo(req, 210);
+    test_status_code(req, 210);
 
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
     SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
     SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER);
     SET_EXPECT(INTERNET_STATUS_SENDING_REQUEST);
-    SET_WINE_ALLOW(INTERNET_STATUS_SENDING_REQUEST);
     SET_EXPECT(INTERNET_STATUS_REQUEST_SENT);
     SET_EXPECT(INTERNET_STATUS_RECEIVING_RESPONSE);
     SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
@@ -2845,7 +2908,7 @@ static void test_connection_closing(int port)
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
-    todo_wine CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
+    CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
     CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
@@ -2853,7 +2916,7 @@ static void test_connection_closing(int port)
     CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
 
-    test_status_code_todo(req, 200);
+    test_status_code(req, 200);
 
     SET_WINE_ALLOW(INTERNET_STATUS_CLOSING_CONNECTION);
     SET_WINE_ALLOW(INTERNET_STATUS_CONNECTION_CLOSED);
@@ -2862,6 +2925,90 @@ static void test_connection_closing(int port)
     CloseHandle(hCompleteEvent);
 }
 
+static void test_successive_HttpSendRequest(int port)
+{
+    HINTERNET session, connection, req;
+    DWORD res;
+
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+
+    session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
+    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+
+    pInternetSetStatusCallbackA(session, callback);
+
+    SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
+    connection = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
+    ok(connection != NULL,"InternetConnect failed with error %u\n", GetLastError());
+    CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
+
+    SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
+    req = HttpOpenRequestA(connection, "GET", "/testH", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0xdeadbeaf);
+    ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
+
+    SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
+    SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
+    SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
+    SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER);
+    SET_EXPECT(INTERNET_STATUS_SENDING_REQUEST);
+    SET_EXPECT(INTERNET_STATUS_REQUEST_SENT);
+    SET_EXPECT(INTERNET_STATUS_RECEIVING_RESPONSE);
+    SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
+    SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
+
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
+    ok(!res && (GetLastError() == ERROR_IO_PENDING),
+            "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
+    WaitForSingleObject(hCompleteEvent, INFINITE);
+    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+
+    CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
+    CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
+    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
+    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
+    CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
+    CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
+    CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
+    CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
+    CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
+
+    test_status_code(req, 210);
+
+    SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
+    SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
+    SET_EXPECT(INTERNET_STATUS_SENDING_REQUEST);
+    SET_EXPECT(INTERNET_STATUS_REQUEST_SENT);
+    SET_EXPECT(INTERNET_STATUS_RECEIVING_RESPONSE);
+    SET_EXPECT(INTERNET_STATUS_RESPONSE_RECEIVED);
+    SET_OPTIONAL(INTERNET_STATUS_CLOSING_CONNECTION);
+    SET_OPTIONAL(INTERNET_STATUS_CONNECTION_CLOSED);
+    SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
+
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
+    ok(!res && (GetLastError() == ERROR_IO_PENDING),
+       "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
+    WaitForSingleObject(hCompleteEvent, INFINITE);
+    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+
+    CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
+    CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
+    CHECK_NOTIFIED(INTERNET_STATUS_SENDING_REQUEST);
+    CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
+    CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
+    CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
+    CLEAR_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+    CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
+    CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
+
+    test_status_code(req, 200);
+
+    SET_WINE_ALLOW(INTERNET_STATUS_CLOSING_CONNECTION);
+    SET_WINE_ALLOW(INTERNET_STATUS_CONNECTION_CLOSED);
+
+    close_async_handle(session, hCompleteEvent, 2);
+    CloseHandle(hCompleteEvent);
+}
 
 static void test_no_content(int port)
 {
@@ -2870,7 +3017,7 @@ static void test_no_content(int port)
 
     trace("Testing 204 no content response...\n");
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
@@ -2913,12 +3060,17 @@ static void test_no_content(int port)
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
     CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
-    CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
-    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
 
     close_async_handle(session, hCompleteEvent, 2);
     CloseHandle(hCompleteEvent);
+
+    /*
+     * The connection should be closed before closing handle. This is true for most
+     * wininet versions (including Wine), but some old win2k versions fail to do that.
+     */
+    CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+    CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
 }
 
 static void test_conn_close(int port)
@@ -2929,8 +3081,8 @@ static void test_conn_close(int port)
 
     trace("Testing connection close connection...\n");
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-    conn_close_event = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+    conn_close_event = CreateEventW(NULL, FALSE, FALSE, NULL);
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
@@ -2991,11 +3143,7 @@ static void test_conn_close(int port)
     SET_EXPECT(INTERNET_STATUS_CONNECTION_CLOSED);
     SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
     SetEvent(conn_close_event);
-#ifdef ROSTESTS_73_FIXED
     WaitForSingleObject(hCompleteEvent, INFINITE);
-#else /* ROSTESTS_73_FIXED */
-    ok(WaitForSingleObject(hCompleteEvent, 5000) == WAIT_OBJECT_0, "Wait timed out\n");
-#endif /* ROSTESTS_73_FIXED */
     ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
     CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
@@ -3018,19 +3166,19 @@ static void test_no_cache(int port)
 
     trace("Testing no-cache header\n");
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
 
-    req = HttpOpenRequest(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     sprintf(cache_url, cache_url_fmt, port, cache_control_no_cache);
-    DeleteUrlCacheEntry(cache_url);
+    DeleteUrlCacheEntryA(cache_url);
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
@@ -3038,25 +3186,25 @@ static void test_no_cache(int port)
     ok(size == 12, "read %d bytes of data\n", size);
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
         size += read;
     ok(size == 0, "read %d bytes of data\n", size);
     InternetCloseHandle(req);
-    DeleteUrlCacheEntry(cache_url);
+    DeleteUrlCacheEntryA(cache_url);
 
-    req = HttpOpenRequest(con, NULL, cache_control_no_store, NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, cache_control_no_store, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     sprintf(cache_url, cache_url_fmt, port, cache_control_no_store);
-    DeleteUrlCacheEntry(cache_url);
+    DeleteUrlCacheEntryA(cache_url);
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
@@ -3064,7 +3212,7 @@ static void test_no_cache(int port)
     ok(size == 12, "read %d bytes of data\n", size);
     InternetCloseHandle(req);
 
-    ret = DeleteUrlCacheEntry(cache_url);
+    ret = DeleteUrlCacheEntryA(cache_url);
     ok(!ret && GetLastError()==ERROR_FILE_NOT_FOUND, "cache entry should not exist\n");
 
     InternetCloseHandle(con);
@@ -3086,17 +3234,17 @@ static void test_cache_read_gzipped(int port)
 
     trace("Testing reading compressed content from cache\n");
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
 
-    req = HttpOpenRequest(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = TRUE;
-    ret = InternetSetOption(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
+    ret = InternetSetOptionA(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
     if(!ret && GetLastError()==ERROR_INTERNET_INVALID_OPTION) {
         win_skip("INTERNET_OPTION_HTTP_DECODING not supported\n");
         InternetCloseHandle(req);
@@ -3106,7 +3254,7 @@ static void test_cache_read_gzipped(int port)
     }
     ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
 
-    ret = HttpSendRequest(req, "Accept-Encoding: gzip", -1, NULL, 0);
+    ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-size, &read) && read)
@@ -3128,14 +3276,14 @@ static void test_cache_read_gzipped(int port)
     ok(!strncmp(raw_header, buf, size), "buf = %s\n", buf);
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, NULL, get_gzip, NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
+    req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = TRUE;
-    ret = InternetSetOption(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
+    ret = InternetSetOptionA(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
     ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
 
-    ret = HttpSendRequest(req, "Accept-Encoding: gzip", -1, NULL, 0);
+    ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
@@ -3160,12 +3308,12 @@ static void test_cache_read_gzipped(int port)
     /* Decompression doesn't work while reading from cache */
     test_cache_gzip = 0;
     sprintf(cache_url, cache_url_fmt, port, get_gzip);
-    DeleteUrlCacheEntry(cache_url);
+    DeleteUrlCacheEntryA(cache_url);
 
-    req = HttpOpenRequest(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, "Accept-Encoding: gzip", -1, NULL, 0);
+    ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
@@ -3173,14 +3321,14 @@ static void test_cache_read_gzipped(int port)
     ok(size == 31, "read %d bytes of data\n", size);
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, NULL, get_gzip, NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
+    req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = TRUE;
-    ret = InternetSetOption(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
+    ret = InternetSetOptionA(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
     ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
 
-    ret = HttpSendRequest(req, "Accept-Encoding: gzip", -1, NULL, 0);
+    ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
     ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
@@ -3195,7 +3343,7 @@ static void test_cache_read_gzipped(int port)
     InternetCloseHandle(con);
     InternetCloseHandle(ses);
 
-    DeleteUrlCacheEntry(cache_url);
+    DeleteUrlCacheEntryA(cache_url);
 }
 
 static void test_HttpSendRequestW(int port)
@@ -3205,13 +3353,13 @@ static void test_HttpSendRequestW(int port)
     DWORD error;
     BOOL ret;
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    req = HttpOpenRequest(con, NULL, "/test1", NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, "/test1", NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     SetLastError(0xdeadbeef);
@@ -3235,42 +3383,42 @@ static void test_cookie_header(int port)
     BOOL ret;
     char buffer[64];
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    InternetSetCookie("http://localhost", "cookie", "biscuit");
+    InternetSetCookieA("http://localhost", "cookie", "biscuit");
 
-    req = HttpOpenRequest(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     buffer[0] = 0;
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    ret = HttpQueryInfo(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     error = GetLastError();
     ok(!ret, "HttpQueryInfo succeeded\n");
     ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %u expected ERROR_HTTP_HEADER_NOT_FOUND\n", error);
 
-    ret = HttpAddRequestHeaders(req, "Cookie: cookie=not biscuit\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD);
+    ret = HttpAddRequestHeadersA(req, "Cookie: cookie=not biscuit\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD);
     ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError());
 
     buffer[0] = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
     ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
 
     test_status_code(req, 200);
 
     buffer[0] = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
     ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer);
 
@@ -3284,16 +3432,16 @@ static void test_basic_authentication(int port)
     HINTERNET session, connect, request;
     BOOL ret;
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "localhost", port, "user", "pwd", INTERNET_SERVICE_HTTP, 0, 0);
+    connect = InternetConnectA(session, "localhost", port, "user", "pwd", INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, NULL, "/test3", NULL, NULL, NULL, 0, 0);
+    request = HttpOpenRequestA(connect, NULL, "/test3", NULL, NULL, NULL, 0, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
 
     test_status_code(request, 200);
@@ -3310,17 +3458,17 @@ static void test_premature_disconnect(int port)
     DWORD err;
     BOOL ret;
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, NULL, "/premature_disconnect", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+    request = HttpOpenRequestA(connect, NULL, "/premature_disconnect", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
     SetLastError(0xdeadbeef);
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     err = GetLastError();
     todo_wine ok(!ret, "HttpSendRequest succeeded\n");
     todo_wine ok(err == ERROR_HTTP_INVALID_SERVER_RESPONSE, "got %u\n", err);
@@ -3337,16 +3485,16 @@ static void test_invalid_response_headers(int port)
     BOOL ret;
     char buffer[256];
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, NULL, "/testE", NULL, NULL, NULL, 0, 0);
+    request = HttpOpenRequestA(connect, NULL, "/testE", NULL, NULL, NULL, 0, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
 
     test_status_code(request, 401);
@@ -3354,14 +3502,14 @@ static void test_invalid_response_headers(int port)
 
     buffer[0] = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo( request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA( request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL);
     ok(ret, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "HTTP/1.0 401 Anonymous requests or requests on unsecure channel are not allowed"),
        "headers wrong \"%s\"\n", buffer);
 
     buffer[0] = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo( request, HTTP_QUERY_SERVER, buffer, &size, NULL);
+    ret = HttpQueryInfoA( request, HTTP_QUERY_SERVER, buffer, &size, NULL);
     ok(ret, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "winetest"), "server wrong \"%s\"\n", buffer);
 
@@ -3377,21 +3525,21 @@ static void test_response_without_headers(int port)
     char buffer[1024];
 
     SetLastError(0xdeadbeef);
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(hi != NULL, "open failed %u\n", GetLastError());
 
     SetLastError(0xdeadbeef);
-    hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(hc != NULL, "connect failed %u\n", GetLastError());
 
     SetLastError(0xdeadbeef);
-    hr = HttpOpenRequest(hc, NULL, "/testG", NULL, NULL, NULL, 0, 0);
+    hr = HttpOpenRequestA(hc, NULL, "/testG", NULL, NULL, NULL, 0, 0);
     ok(hr != NULL, "HttpOpenRequest failed %u\n", GetLastError());
 
     test_request_flags(hr, INTERNET_REQFLAG_NO_HEADERS);
 
     SetLastError(0xdeadbeef);
-    r = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    r = HttpSendRequestA(hr, NULL, 0, NULL, 0);
     ok(r, "HttpSendRequest failed %u\n", GetLastError());
 
     test_request_flags_todo(hr, INTERNET_REQFLAG_NO_HEADERS);
@@ -3410,21 +3558,21 @@ static void test_response_without_headers(int port)
     buffer[0] = 0;
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL );
+    r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL );
     ok(r, "HttpQueryInfo failed %u\n", GetLastError());
     ok(!strcmp(buffer, "OK"), "expected OK got: \"%s\"\n", buffer);
 
     buffer[0] = 0;
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = HttpQueryInfo(hr, HTTP_QUERY_VERSION, buffer, &size, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &size, NULL);
     ok(r, "HttpQueryInfo failed %u\n", GetLastError());
     ok(!strcmp(buffer, "HTTP/1.0"), "expected HTTP/1.0 got: \"%s\"\n", buffer);
 
     buffer[0] = 0;
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    r = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL);
+    r = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL);
     ok(r, "HttpQueryInfo failed %u\n", GetLastError());
     ok(!strcmp(buffer, "HTTP/1.0 200 OK"), "raw headers wrong: \"%s\"\n", buffer);
 
@@ -3436,69 +3584,71 @@ static void test_response_without_headers(int port)
 static void test_HttpQueryInfo(int port)
 {
     HINTERNET hi, hc, hr;
-    DWORD size, index;
+    DWORD size, index, error;
     char buffer[1024];
     BOOL ret;
 
-    hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(hi != NULL, "InternetOpen failed\n");
 
-    hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(hc != NULL, "InternetConnect failed\n");
 
-    hr = HttpOpenRequest(hc, NULL, "/testD", NULL, NULL, NULL, 0, 0);
+    hr = HttpOpenRequestA(hc, NULL, "/testD", NULL, NULL, NULL, 0, 0);
     ok(hr != NULL, "HttpOpenRequest failed\n");
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index);
-    ok(!ret && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo failed %u\n", GetLastError());
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index);
+    error = GetLastError();
+    ok(!ret || broken(ret), "HttpQueryInfo succeeded\n");
+    if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %u expected ERROR_HTTP_HEADER_NOT_FOUND\n", error);
 
-    ret = HttpSendRequest(hr, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(hr, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 1, "expected 1 got %u\n", index);
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_DATE | HTTP_QUERY_FLAG_SYSTEMTIME, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_DATE | HTTP_QUERY_FLAG_SYSTEMTIME, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 1, "expected 1 got %u\n", index);
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 0, "expected 0 got %u\n", index);
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 0, "expected 0 got %u\n", index);
 
     index = 0xdeadbeef; /* invalid start index */
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
     todo_wine ok(!ret, "HttpQueryInfo should have failed\n");
     todo_wine ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
        "Expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", GetLastError());
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 0, "expected 0 got %u\n", index);
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 0, "expected 0 got %u\n", index);
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_VERSION, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_VERSION, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 0, "expected 0 got %u\n", index);
 
@@ -3506,31 +3656,31 @@ static void test_HttpQueryInfo(int port)
 
     index = 0xdeadbeef;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_FORWARDED, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_FORWARDED, buffer, &size, &index);
     ok(!ret, "HttpQueryInfo succeeded\n");
     ok(index == 0xdeadbeef, "expected 0xdeadbeef got %u\n", index);
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_SERVER, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_SERVER, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 1, "expected 1 got %u\n", index);
 
     index = 0;
     size = sizeof(buffer);
     strcpy(buffer, "Server");
-    ret = HttpQueryInfo(hr, HTTP_QUERY_CUSTOM, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_CUSTOM, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 1, "expected 1 got %u\n", index);
 
     index = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 1, "expected 1 got %u\n", index);
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
+    ret = HttpQueryInfoA(hr, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
     ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
     ok(index == 2, "expected 2 got %u\n", index);
 
@@ -3547,108 +3697,108 @@ static void test_options(int port)
     DWORD_PTR ctx;
     BOOL ret;
 
-    ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
     SetLastError(0xdeadbeef);
-    ret = InternetSetOption(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, 0);
+    ret = InternetSetOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, 0);
     error = GetLastError();
     ok(!ret, "InternetSetOption succeeded\n");
     ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
 
     SetLastError(0xdeadbeef);
-    ret = InternetSetOption(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, sizeof(ctx));
+    ret = InternetSetOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, sizeof(ctx));
     ok(!ret, "InternetSetOption succeeded\n");
     error = GetLastError();
     ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
 
     SetLastError(0xdeadbeef);
-    ret = InternetSetOption(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, 0);
+    ret = InternetSetOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, 0);
     ok(!ret, "InternetSetOption succeeded\n");
     error = GetLastError();
     ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
 
     ctx = 1;
-    ret = InternetSetOption(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
+    ret = InternetSetOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
     ok(ret, "InternetSetOption failed %u\n", GetLastError());
 
     SetLastError(0xdeadbeef);
-    ret = InternetQueryOption(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, NULL);
+    ret = InternetQueryOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, NULL);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
     ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
 
     SetLastError(0xdeadbeef);
-    ret = InternetQueryOption(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, NULL);
+    ret = InternetQueryOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, NULL);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
     ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
 
     size = 0;
     SetLastError(0xdeadbeef);
-    ret = InternetQueryOption(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, &size);
+    ret = InternetQueryOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, NULL, &size);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
     ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %u\n", error);
 
     size = sizeof(ctx);
     SetLastError(0xdeadbeef);
-    ret = InternetQueryOption(NULL, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(NULL, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
     ok(error == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %u\n", error);
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
-    ret = InternetQueryOption(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
     ok(ctx == 1, "expected 1 got %lu\n", ctx);
 
-    con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
-    ret = InternetQueryOption(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
     ok(ctx == 0, "expected 0 got %lu\n", ctx);
 
     ctx = 2;
-    ret = InternetSetOption(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
+    ret = InternetSetOptionA(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
     ok(ret, "InternetSetOption failed %u\n", GetLastError());
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
-    ret = InternetQueryOption(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
     ok(ctx == 2, "expected 2 got %lu\n", ctx);
 
-    req = HttpOpenRequest(con, NULL, "/test1", NULL, NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, NULL, "/test1", NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
-    ret = InternetQueryOption(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
     ok(ctx == 0, "expected 0 got %lu\n", ctx);
 
     ctx = 3;
-    ret = InternetSetOption(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
+    ret = InternetSetOptionA(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
     ok(ret, "InternetSetOption failed %u\n", GetLastError());
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
-    ret = InternetQueryOption(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
     ok(ctx == 3, "expected 3 got %lu\n", ctx);
 
     size = sizeof(idsi);
-    ret = InternetQueryOption(req, INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO, &idsi, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO, &idsi, &size);
     ok(ret, "InternetQueryOption failed %u\n", GetLastError());
 
     size = 0;
     SetLastError(0xdeadbeef);
-    ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
     ok(error == ERROR_INTERNET_INVALID_OPERATION, "expected ERROR_INTERNET_INVALID_OPERATION, got %u\n", error);
@@ -3727,22 +3877,22 @@ static void test_http_status(int port)
     for(i=0; i < sizeof(http_status_tests)/sizeof(*http_status_tests); i++) {
         send_buffer = http_status_tests[i].response_text;
 
-        ses = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+        ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
         ok(ses != NULL, "InternetOpen failed\n");
 
-        con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+        con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
         ok(con != NULL, "InternetConnect failed\n");
 
-        req = HttpOpenRequest(con, NULL, "/send_from_buffer", NULL, NULL, NULL, 0, 0);
+        req = HttpOpenRequestA(con, NULL, "/send_from_buffer", NULL, NULL, NULL, 0, 0);
         ok(req != NULL, "HttpOpenRequest failed\n");
 
-        res = HttpSendRequest(req, NULL, 0, NULL, 0);
+        res = HttpSendRequestA(req, NULL, 0, NULL, 0);
         ok(res, "HttpSendRequest failed\n");
 
         test_status_code(req, http_status_tests[i].status_code);
 
         size = sizeof(buf);
-        res = HttpQueryInfo(req, HTTP_QUERY_STATUS_TEXT, buf, &size, NULL);
+        res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_TEXT, buf, &size, NULL);
         ok(res, "HttpQueryInfo failed: %u\n", GetLastError());
         ok(!strcmp(buf, http_status_tests[i].status_text), "[%u] Unexpected status text \"%s\", expected \"%s\"\n",
            i, buf, http_status_tests[i].status_text);
@@ -3758,41 +3908,44 @@ static void test_cache_control_verb(int port)
     HINTERNET session, connect, request;
     BOOL ret;
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    connect = InternetConnectA(session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, "RPC_OUT_DATA", "/test_cache_control_verb", NULL, NULL, NULL,
+    request = HttpOpenRequestA(connect, "RPC_OUT_DATA", "/test_cache_control_verb", NULL, NULL, NULL,
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
     test_status_code(request, 200);
+    InternetCloseHandle(request);
 
-    request = HttpOpenRequest(connect, "POST", "/test_cache_control_verb", NULL, NULL, NULL,
+    request = HttpOpenRequestA(connect, "POST", "/test_cache_control_verb", NULL, NULL, NULL,
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
     test_status_code(request, 200);
+    InternetCloseHandle(request);
 
-    request = HttpOpenRequest(connect, "HEAD", "/test_cache_control_verb", NULL, NULL, NULL,
+    request = HttpOpenRequestA(connect, "HEAD", "/test_cache_control_verb", NULL, NULL, NULL,
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
     test_status_code(request, 200);
+    InternetCloseHandle(request);
 
-    request = HttpOpenRequest(connect, "GET", "/test_cache_control_verb", NULL, NULL, NULL,
+    request = HttpOpenRequestA(connect, "GET", "/test_cache_control_verb", NULL, NULL, NULL,
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed %u\n", GetLastError());
     test_status_code(request, 200);
-
     InternetCloseHandle(request);
+
     InternetCloseHandle(connect);
     InternetCloseHandle(session);
 }
@@ -3803,7 +3956,7 @@ static void test_http_connection(void)
     HANDLE hThread;
     DWORD id = 0, r;
 
-    si.hEvent = CreateEvent(NULL, 0, 0, NULL);
+    si.hEvent = CreateEventW(NULL, 0, 0, NULL);
     si.port = 7531;
 
     hThread = CreateThread(NULL, 0, server_thread, (LPVOID) &si, 0, &id);
@@ -3831,7 +3984,6 @@ static void test_http_connection(void)
     test_response_without_headers(si.port);
     test_HttpQueryInfo(si.port);
     test_HttpSendRequestW(si.port);
-    test_last_error(si.port);
     test_options(si.port);
     test_no_content(si.port);
     test_conn_close(si.port);
@@ -3841,6 +3993,7 @@ static void test_http_connection(void)
     test_premature_disconnect(si.port);
     test_connection_closing(si.port);
     test_cache_control_verb(si.port);
+    test_successive_HttpSendRequest(si.port);
 
     /* send the basic request again to shutdown the server thread */
     test_basic_request(si.port, "GET", "/quit");
@@ -3865,9 +4018,9 @@ typedef struct {
 } cert_struct_test_t;
 
 static const cert_struct_test_t test_winehq_org_cert = {
-    "0mJuv1t-1CFypQkyTZwfvjHHBAbnUndG\r\n"
+    "6JcR7G3G8tgjkeoMcitK-bTbzcpumDSy\r\n"
     "GT98380011\r\n"
-    "See www.rapidssl.com/resources/cps (c)13\r\n"
+    "See www.rapidssl.com/resources/cps (c)14\r\n"
     "Domain Control Validated - RapidSSL(R)\r\n"
     "*.winehq.org",
 
@@ -3900,7 +4053,7 @@ static void test_cert_struct(HINTERNET req, const cert_struct_test_t *test)
     memset(&info, 0x5, sizeof(info));
 
     size = sizeof(info);
-    res = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, &info, &size);
+    res = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, &info, &size);
     ok(res, "InternetQueryOption failed: %u\n", GetLastError());
     ok(size == sizeof(info), "size = %u\n", size);
 
@@ -3973,6 +4126,7 @@ static void _set_secflags(unsigned line, HINTERNET req, BOOL use_undoc, DWORD fl
 
 static void test_security_flags(void)
 {
+    INTERNET_CERTIFICATE_INFOA *cert;
     HINTERNET ses, conn, req;
     DWORD size, flags;
     char buf[100];
@@ -3980,9 +4134,9 @@ static void test_security_flags(void)
 
     trace("Testing security flags...\n");
 
-    hCompleteEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+    hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
 
-    ses = InternetOpen("WineTest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
+    ses = InternetOpenA("WineTest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(ses != NULL, "InternetOpen failed\n");
 
     pInternetSetStatusCallbackA(ses, &callback);
@@ -3994,7 +4148,7 @@ static void test_security_flags(void)
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
-    req = HttpOpenRequest(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
+    req = HttpOpenRequestA(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
                           INTERNET_FLAG_SECURE|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE,
                           0xdeadbeef);
     ok(req != NULL, "HttpOpenRequest failed\n");
@@ -4039,7 +4193,7 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
 
-    res = HttpSendRequest(req, NULL, 0, NULL, 0);
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
 
     WaitForSingleObject(hCompleteEvent, INFINITE);
@@ -4070,14 +4224,14 @@ static void test_security_flags(void)
     ok(res, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
-    req = HttpOpenRequest(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
+    req = HttpOpenRequestA(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
                           INTERNET_FLAG_SECURE|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE,
                           0xdeadbeef);
     ok(req != NULL, "HttpOpenRequest failed\n");
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     flags = INTERNET_ERROR_MASK_COMBINED_SEC_CERT|INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY;
-    res = InternetSetOption(req, INTERNET_OPTION_ERROR_MASK, (void*)&flags, sizeof(flags));
+    res = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&flags, sizeof(flags));
     ok(res, "InternetQueryOption(INTERNET_OPTION_ERROR_MASK failed: %u\n", GetLastError());
 
     SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
@@ -4088,13 +4242,37 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
-    res = HttpSendRequest(req, NULL, 0, NULL, 0);
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
 
     WaitForSingleObject(hCompleteEvent, INFINITE);
     ok(req_error == ERROR_INTERNET_SEC_CERT_REV_FAILED || broken(req_error == ERROR_INTERNET_SEC_CERT_ERRORS),
        "req_error = %d\n", req_error);
 
+    size = 0;
+    res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size);
+    ok(res || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %u\n", size);
+    cert = HeapAlloc(GetProcessHeap(), 0, size);
+    cert->lpszSubjectInfo = NULL;
+    cert->lpszIssuerInfo = NULL;
+    cert->lpszSignatureAlgName = (char *)0xdeadbeef;
+    cert->lpszEncryptionAlgName = (char *)0xdeadbeef;
+    cert->lpszProtocolName = (char *)0xdeadbeef;
+    cert->dwKeySize = 0xdeadbeef;
+    res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, cert, &size);
+    ok(res, "InternetQueryOption failed: %u\n", GetLastError());
+    if (res)
+    {
+        ok(cert->lpszSubjectInfo && strlen(cert->lpszSubjectInfo) > 1, "expected a non-empty subject name\n");
+        ok(cert->lpszIssuerInfo && strlen(cert->lpszIssuerInfo) > 1, "expected a non-empty issuer name\n");
+        ok(!cert->lpszSignatureAlgName, "unexpected signature algorithm name\n");
+        ok(!cert->lpszEncryptionAlgName, "unexpected encryption algorithm name\n");
+        ok(!cert->lpszProtocolName, "unexpected protocol name\n");
+        ok(cert->dwKeySize != 0xdeadbeef, "unexpected key size\n");
+    }
+    HeapFree(GetProcessHeap(), 0, cert);
+
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
     CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
@@ -4129,7 +4307,7 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
-    res = HttpSendRequest(req, NULL, 0, NULL, 0);
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
 
     WaitForSingleObject(hCompleteEvent, INFINITE);
@@ -4162,7 +4340,7 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
-    res = HttpSendRequest(req, NULL, 0, NULL, 0);
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
 
     WaitForSingleObject(hCompleteEvent, INFINITE);
@@ -4197,7 +4375,7 @@ static void test_security_flags(void)
 
     /* Make another request, without setting security flags */
 
-    ses = InternetOpen("WineTest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
+    ses = InternetOpenA("WineTest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(ses != NULL, "InternetOpen failed\n");
 
     pInternetSetStatusCallbackA(ses, &callback);
@@ -4209,7 +4387,7 @@ static void test_security_flags(void)
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
-    req = HttpOpenRequest(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
+    req = HttpOpenRequestA(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
                           INTERNET_FLAG_SECURE|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE,
                           0xdeadbeef);
     ok(req != NULL, "HttpOpenRequest failed\n");
@@ -4228,7 +4406,7 @@ static void test_security_flags(void)
     SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
 
-    res = HttpSendRequest(req, NULL, 0, NULL, 0);
+    res = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
 
     WaitForSingleObject(hCompleteEvent, INFINITE);
@@ -4272,23 +4450,23 @@ static void test_secure_connection(void)
     INTERNET_CERTIFICATE_INFOW *certificate_structW = NULL;
     BOOL ret;
 
-    ses = InternetOpen("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+    ses = InternetOpenA("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "test.winehq.org",
+    con = InternetConnectA(ses, "test.winehq.org",
                           INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL,
                           INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    req = HttpOpenRequest(con, "GET", "/tests/hello.html", NULL, NULL, NULL,
+    req = HttpOpenRequestA(con, "GET", "/tests/hello.html", NULL, NULL, NULL,
                           INTERNET_FLAG_SECURE, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %d\n", GetLastError());
 
     size = sizeof(flags);
-    ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
     ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
     ok(flags & SECURITY_FLAG_SECURE, "expected secure flag to be set\n");
 
@@ -4310,7 +4488,7 @@ static void test_secure_connection(void)
     ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
     ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %d\n", size);
     certificate_structW = HeapAlloc(GetProcessHeap(), 0, size);
-    ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                               certificate_structW, &size);
     certificate_structA = (INTERNET_CERTIFICATE_INFOA *)certificate_structW;
     ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
@@ -4350,11 +4528,11 @@ static void test_secure_connection(void)
                           INTERNET_FLAG_SECURE|INTERNET_FLAG_RELOAD, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
-    ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed: %d\n", GetLastError());
 
     size = sizeof(flags);
-    ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
+    ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
     ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
     ok(flags & SECURITY_FLAG_SECURE, "expected secure flag to be set, got %x\n", flags);
 
@@ -4429,47 +4607,47 @@ static void test_user_agent_header(void)
     char buffer[64];
     BOOL ret;
 
-    ses = InternetOpen("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+    ses = InternetOpenA("Gizmo5", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
     ok(ses != NULL, "InternetOpen failed\n");
 
-    con = InternetConnect(ses, "test.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    con = InternetConnectA(ses, "test.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
 
-    req = HttpOpenRequest(con, "GET", "/tests/hello.html", "HTTP/1.0", NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, "GET", "/tests/hello.html", "HTTP/1.0", NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_USER_AGENT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_USER_AGENT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     err = GetLastError();
     ok(!ret, "HttpQueryInfo succeeded\n");
     ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", err);
 
-    ret = HttpAddRequestHeaders(req, "User-Agent: Gizmo Project\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
+    ret = HttpAddRequestHeadersA(req, "User-Agent: Gizmo Project\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     ok(ret, "HttpAddRequestHeaders succeeded\n");
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_USER_AGENT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_USER_AGENT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     err = GetLastError();
     ok(ret, "HttpQueryInfo failed\n");
     ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", err);
 
     InternetCloseHandle(req);
 
-    req = HttpOpenRequest(con, "GET", "/", "HTTP/1.0", NULL, NULL, 0, 0);
+    req = HttpOpenRequestA(con, "GET", "/", "HTTP/1.0", NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     err = GetLastError();
     ok(!ret, "HttpQueryInfo succeeded\n");
     ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", err);
 
-    ret = HttpAddRequestHeaders(req, "Accept: audio/*, image/*, text/*\r\nUser-Agent: Gizmo Project\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
+    ret = HttpAddRequestHeadersA(req, "Accept: audio/*, image/*, text/*\r\nUser-Agent: Gizmo Project\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     ok(ret, "HttpAddRequestHeaders failed\n");
 
     buffer[0] = 0;
     size = sizeof(buffer);
-    ret = HttpQueryInfo(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
     ok(!strcmp(buffer, "audio/*, image/*, text/*"), "got '%s' expected 'audio/*, image/*, text/*'\n", buffer);
 
@@ -4486,16 +4664,16 @@ static void test_bogus_accept_types_array(void)
     char buffer[32];
     BOOL ret;
 
-    ses = InternetOpen("MERONG(0.9/;p)", INTERNET_OPEN_TYPE_DIRECT, "", "", 0);
-    con = InternetConnect(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    req = HttpOpenRequest(con, "POST", "/post/post_action.php", "HTTP/1.0", "", types, INTERNET_FLAG_FORMS_SUBMIT, 0);
+    ses = InternetOpenA("MERONG(0.9/;p)", INTERNET_OPEN_TYPE_DIRECT, "", "", 0);
+    con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+    req = HttpOpenRequestA(con, "POST", "/post/post_action.php", "HTTP/1.0", "", types, INTERNET_FLAG_FORMS_SUBMIT, 0);
 
     ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
 
     buffer[0] = 0;
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
-    ret = HttpQueryInfo(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
+    ret = HttpQueryInfoA(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
     error = GetLastError();
     ok(!ret || broken(ret), "HttpQueryInfo succeeded\n");
     if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", error);
@@ -4530,7 +4708,7 @@ static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID
     case INTERNET_STATUS_HANDLE_CLOSING: {
         DWORD type = INTERNET_HANDLE_TYPE_CONNECT_HTTP, size = sizeof(type);
 
-        if (InternetQueryOption(handle, INTERNET_OPTION_HANDLE_TYPE, &type, &size))
+        if (InternetQueryOptionA(handle, INTERNET_OPTION_HANDLE_TYPE, &type, &size))
             ok(type != INTERNET_HANDLE_TYPE_CONNECT_HTTP, "unexpected callback\n");
         SetEvent(ctx->event);
         break;
@@ -4568,9 +4746,9 @@ static void test_open_url_async(void)
     }
 
     ctx.req = NULL;
-    ctx.event = CreateEvent(NULL, TRUE, FALSE, "Z:_home_hans_jaman-installer.exe_ev1");
+    ctx.event = CreateEventA(NULL, TRUE, FALSE, "Z:_home_hans_jaman-installer.exe_ev1");
 
-    ses = InternetOpen("AdvancedInstaller", 0, NULL, NULL, INTERNET_FLAG_ASYNC);
+    ses = InternetOpenA("AdvancedInstaller", 0, NULL, NULL, INTERNET_FLAG_ASYNC);
     ok(ses != NULL, "InternetOpen failed\n");
 
     SetLastError(0xdeadbeef);
@@ -4587,20 +4765,20 @@ static void test_open_url_async(void)
     pInternetSetStatusCallbackW(ses, cb);
     ResetEvent(ctx.event);
 
-    req = InternetOpenUrl(ses, "http://test.winehq.org", NULL, 0, 0, (DWORD_PTR)&ctx);
+    req = InternetOpenUrlA(ses, "http://test.winehq.org", NULL, 0, 0, (DWORD_PTR)&ctx);
     ok(!req && GetLastError() == ERROR_IO_PENDING, "InternetOpenUrl failed\n");
 
     WaitForSingleObject(ctx.event, INFINITE);
 
     type = 0;
     size = sizeof(type);
-    ret = InternetQueryOption(ctx.req, INTERNET_OPTION_HANDLE_TYPE, &type, &size);
+    ret = InternetQueryOptionA(ctx.req, INTERNET_OPTION_HANDLE_TYPE, &type, &size);
     ok(ret, "InternetQueryOption failed: %u\n", GetLastError());
     ok(type == INTERNET_HANDLE_TYPE_HTTP_REQUEST,
        "expected INTERNET_HANDLE_TYPE_HTTP_REQUEST, got %u\n", type);
 
     size = 0;
-    ret = HttpQueryInfo(ctx.req, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &size, NULL);
+    ret = HttpQueryInfoA(ctx.req, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &size, NULL);
     ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "HttpQueryInfo failed\n");
     ok(size > 0, "expected size > 0\n");
 
@@ -4626,9 +4804,9 @@ struct notification
 {
     enum api     function; /* api responsible for notification */
     unsigned int status;   /* status received */
-    int          async;    /* delivered from another thread? */
-    int          todo;
-    int          optional;
+    BOOL         async;    /* delivered from another thread? */
+    BOOL         todo;
+    BOOL         optional;
 };
 
 struct info
@@ -4734,66 +4912,95 @@ struct notification_data
 
 static const struct notification async_send_request_ex_test[] =
 {
-    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_COOKIE_SENT, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_NAME_RESOLVED, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_CONNECTING_TO_SERVER, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_CONNECTED_TO_SERVER, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_SENDING_REQUEST, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_REQUEST_SENT, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { internet_writefile,    INTERNET_STATUS_SENDING_REQUEST, 0 },
-    { internet_writefile,    INTERNET_STATUS_REQUEST_SENT, 0 },
-    { http_end_request,      INTERNET_STATUS_RECEIVING_RESPONSE, 1 },
-    { http_end_request,      INTERNET_STATUS_RESPONSE_RECEIVED, 1 },
-    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
+    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_COOKIE_SENT, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_NAME_RESOLVED, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTING_TO_SERVER, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTED_TO_SERVER, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_SENDING_REQUEST, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_SENT, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { internet_writefile,    INTERNET_STATUS_SENDING_REQUEST, FALSE },
+    { internet_writefile,    INTERNET_STATUS_REQUEST_SENT, FALSE },
+    { http_end_request,      INTERNET_STATUS_RECEIVING_RESPONSE, TRUE },
+    { http_end_request,      INTERNET_STATUS_RESPONSE_RECEIVED, TRUE },
+    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, }
 };
 
 static const struct notification async_send_request_ex_test2[] =
 {
-    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_COOKIE_SENT, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_NAME_RESOLVED, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_CONNECTING_TO_SERVER, 1, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_CONNECTED_TO_SERVER, 1, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_SENDING_REQUEST, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_REQUEST_SENT, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { http_end_request,      INTERNET_STATUS_RECEIVING_RESPONSE, 1 },
-    { http_end_request,      INTERNET_STATUS_RESPONSE_RECEIVED, 1 },
-    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
+    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_COOKIE_SENT, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_NAME_RESOLVED, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTING_TO_SERVER, TRUE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTED_TO_SERVER, TRUE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_SENDING_REQUEST, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_SENT, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { http_end_request,      INTERNET_STATUS_RECEIVING_RESPONSE, TRUE },
+    { http_end_request,      INTERNET_STATUS_RESPONSE_RECEIVED, TRUE },
+    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, }
 };
 
 static const struct notification async_send_request_ex_resolve_failure_test[] =
 {
-    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, 0 },
-    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, 1, 0, 1 },
-    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, 1 },
-    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0, 1 },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, },
-    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, 0, }
+    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED, FALSE },
+    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED, FALSE, FALSE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING, FALSE, }
+};
+
+static const struct notification async_send_request_ex_chunked_test[] =
+{
+    { internet_connect,      INTERNET_STATUS_HANDLE_CREATED },
+    { http_open_request,     INTERNET_STATUS_HANDLE_CREATED },
+    { http_send_request_ex,  INTERNET_STATUS_DETECTING_PROXY, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_COOKIE_SENT, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_RESOLVING_NAME, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_NAME_RESOLVED, TRUE, FALSE, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTING_TO_SERVER, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_CONNECTED_TO_SERVER, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_SENDING_REQUEST, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_SENT, TRUE },
+    { http_send_request_ex,  INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { http_end_request,      INTERNET_STATUS_RECEIVING_RESPONSE, TRUE },
+    { http_end_request,      INTERNET_STATUS_RESPONSE_RECEIVED, TRUE },
+    { http_end_request,      INTERNET_STATUS_REQUEST_COMPLETE, TRUE },
+    { internet_close_handle, INTERNET_STATUS_CLOSING_CONNECTION },
+    { internet_close_handle, INTERNET_STATUS_CONNECTION_CLOSED },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING },
+    { internet_close_handle, INTERNET_STATUS_HANDLE_CLOSING }
 };
 
 static const struct notification_data notification_data[] = {
+    {
+        async_send_request_ex_chunked_test,
+        sizeof(async_send_request_ex_chunked_test)/sizeof(async_send_request_ex_chunked_test[0]),
+        "GET",
+        "test.winehq.org",
+        "tests/data.php"
+    },
     {
         async_send_request_ex_test,
         sizeof(async_send_request_ex_test)/sizeof(async_send_request_ex_test[0]),
@@ -4837,23 +5044,23 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
     info.test  = nd->test;
     info.count = nd->count;
     info.index = 0;
-    info.wait = CreateEvent( NULL, FALSE, FALSE, NULL );
+    info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
     info.thread = GetCurrentThreadId();
     info.is_aborted = FALSE;
 
-    ses = InternetOpen( "winetest", 0, NULL, NULL, INTERNET_FLAG_ASYNC );
+    ses = InternetOpenA( "winetest", 0, NULL, NULL, INTERNET_FLAG_ASYNC );
     ok( ses != NULL, "InternetOpen failed\n" );
 
     pInternetSetStatusCallbackA( ses, check_notification );
 
     setup_test( &info, internet_connect, __LINE__, ERROR_SUCCESS );
-    con = InternetConnect( ses, nd->host, 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)&info );
+    con = InternetConnectA( ses, nd->host, 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)&info );
     ok( con != NULL, "InternetConnect failed %u\n", GetLastError() );
 
     WaitForSingleObject( info.wait, 10000 );
 
     setup_test( &info, http_open_request, __LINE__, ERROR_SUCCESS );
-    req = HttpOpenRequest( con, nd->method, nd->path, NULL, NULL, accept, 0, (DWORD_PTR)&info );
+    req = HttpOpenRequestA( con, nd->method, nd->path, NULL, NULL, accept, 0, (DWORD_PTR)&info );
     ok( req != NULL, "HttpOpenRequest failed %u\n", GetLastError() );
 
     WaitForSingleObject( info.wait, 10000 );
@@ -5012,7 +5219,7 @@ static void test_connection_failure(void)
     ok(request != NULL, "failed to get request handle\n");
 
     SetLastError(0xdeadbeef);
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     error = GetLastError();
     ok(!ret, "unexpected success\n");
     ok(error == ERROR_INTERNET_CANNOT_CONNECT, "wrong error %u\n", error);
@@ -5028,18 +5235,18 @@ static void test_default_service_port(void)
     DWORD error;
     BOOL ret;
 
-    session = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+    session = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
     ok(session != NULL, "InternetOpen failed\n");
 
-    connect = InternetConnect(session, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER, NULL, NULL,
+    connect = InternetConnectA(session, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER, NULL, NULL,
                               INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect != NULL, "InternetConnect failed\n");
 
-    request = HttpOpenRequest(connect, NULL, "/", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
+    request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, NULL, INTERNET_FLAG_SECURE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
 
     SetLastError(0xdeadbeef);
-    ret = HttpSendRequest(request, NULL, 0, NULL, 0);
+    ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     error = GetLastError();
     ok(!ret, "HttpSendRequest succeeded\n");
     ok(error == ERROR_INTERNET_SECURITY_CHANNEL_ERROR || error == ERROR_INTERNET_CANNOT_CONNECT,
@@ -5116,8 +5323,10 @@ START_TEST(http)
     test_async_HttpSendRequestEx(&notification_data[0]);
     test_async_HttpSendRequestEx(&notification_data[1]);
     test_async_HttpSendRequestEx(&notification_data[2]);
+    test_async_HttpSendRequestEx(&notification_data[3]);
     InternetOpenRequest_test();
     test_http_cache();
+    InternetLockRequestFile_test();
     InternetOpenUrlA_test();
     HttpHeaders_test();
     test_http_connection();
index c928076..2d2a866 100644 (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();
index 95d7fca..794fc3d 100644 (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;
index 5671606..38af420 100644 (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();
index c6ca43d..62668bf 100644 (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