[PATCH 2/2] dlls/wininet/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Wed Mar 9 01:22:48 CST 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/wininet/tests/Makefile.in |    1 
 dlls/wininet/tests/ftp.c       |  204 +++---
 dlls/wininet/tests/http.c      | 1420 ++++++++++++++++++++--------------------
 dlls/wininet/tests/internet.c  |  364 +++++-----
 dlls/wininet/tests/url.c       |  166 ++---
 dlls/wininet/tests/urlcache.c  |  306 ++++-----
 6 files changed, 1230 insertions(+), 1231 deletions(-)

diff --git a/dlls/wininet/tests/Makefile.in b/dlls/wininet/tests/Makefile.in
index 0188d2aa995..ae18bb72faf 100644
--- a/dlls/wininet/tests/Makefile.in
+++ b/dlls/wininet/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = wininet.dll
 IMPORTS   = wininet crypt32 ws2_32 user32 advapi32 shell32
 
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index c7c4febf379..6523a3af29f 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -55,7 +55,7 @@ static void test_getfile_no_open(void)
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_NOT_INITIALIZED ||
          GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INTERNET_NOT_INITIALIZED or ERROR_INVALID_HANDLE (win98), got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_NOT_INITIALIZED or ERROR_INVALID_HANDLE (win98), got %ld\n", GetLastError());
 }
 
 static void test_connect(HINTERNET hInternet)
@@ -74,25 +74,25 @@ static void test_connect(HINTERNET hInternet)
     hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
     if (!hFtp)
     {
-        skip("No ftp connection could be made to ftp.winehq.org %u\n", GetLastError());
+        skip("No ftp connection could be made to ftp.winehq.org %lu\n", GetLastError());
         return;
     }
     ok(GetLastError() == ERROR_SUCCESS,
-       "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+       "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     InternetCloseHandle(hFtp);
 
     SetLastError(0xdeadbeef);
     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());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     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,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Using a NULL username and password will be interpreted as anonymous ftp. The username will be 'anonymous' the password
      * is created via some simple heuristics (see dlls/wininet/ftp.c).
@@ -109,9 +109,9 @@ static void test_connect(HINTERNET hInternet)
         SetLastError(0xdeadbeef);
         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 ( hFtp != NULL, "InternetConnect failed : %ld\n", GetLastError());
     ok ( GetLastError() == ERROR_SUCCESS,
-        "ERROR_SUCCESS, got %d\n", GetLastError());
+        "ERROR_SUCCESS, got %ld\n", GetLastError());
     InternetCloseHandle(hFtp);
 
     SetLastError(0xdeadbeef);
@@ -120,12 +120,12 @@ static void test_connect(HINTERNET hInternet)
     if (!hFtp)
     {
         ok(GetLastError() == ERROR_INTERNET_LOGIN_FAILURE,
-                "Expected ERROR_INTERNET_LOGIN_FAILURE, got %d\n", GetLastError());
+                "Expected ERROR_INTERNET_LOGIN_FAILURE, got %ld\n", GetLastError());
     }
     else
     {
         ok(GetLastError() == ERROR_SUCCESS,
-                "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+                "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
         InternetCloseHandle(hFtp);
     }
 }
@@ -139,34 +139,34 @@ static void test_createdir(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpCreateDirectoryA(NULL, "new_directory_deadbeef");
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* No directory-name */
     SetLastError(0xdeadbeef);
     bRet = FtpCreateDirectoryA(hFtp, NULL);
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Parameters are OK, but we shouldn't be allowed to create the directory */
     SetLastError(0xdeadbeef);
     bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     /* One small test to show that handle type is checked before parameters */
     SetLastError(0xdeadbeef);
     bRet = FtpCreateDirectoryA(hConnect, NULL);
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpCreateDirectoryA(hConnect, "new_directory_deadbeef");
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void test_deletefile(HINTERNET hFtp, HINTERNET hConnect)
@@ -178,34 +178,34 @@ static void test_deletefile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpDeleteFileA(NULL, "non_existent_file_deadbeef");
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* No filename */
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hFtp, NULL);
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Parameters are OK but remote file should not be there */
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     /* One small test to show that handle type is checked before parameters */
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hConnect, NULL);
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hConnect, "non_existent_file_deadbeef");
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
@@ -227,14 +227,14 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE ||
          GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_HANDLE (win98) or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE (win98) or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Test to show session handle is checked before 'condition flags' */
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(NULL, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, 5, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* Make sure we start clean */
 
@@ -246,7 +246,7 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetFileA(hFtp, NULL, "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     ok (GetFileAttributesA("should_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
     DeleteFileA("should_be_non_existing_deadbeef");
@@ -256,7 +256,7 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetFileA(hFtp, "welcome.msg", NULL, FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Zero attributes */
     bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_existing_non_deadbeef", FALSE, 0, FTP_TRANSFER_TYPE_UNKNOWN, 0);
@@ -270,7 +270,7 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, 0xffffffff, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR || GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_INVALID_PARAMETER (win98), got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_INVALID_PARAMETER (win98), got %ld\n", GetLastError());
     ok (GetFileAttributesA("should_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
     DeleteFileA("should_be_non_existing_deadbeef");
@@ -280,7 +280,7 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
     /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
     ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
@@ -294,13 +294,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     /* Create a temporary local file */
     SetLastError(0xdeadbeef);
     hFile = CreateFileA("should_also_be_non_existing_deadbeef", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-    ok ( hFile != NULL, "Error creating a local file : %d\n", GetLastError());
+    ok ( hFile != NULL, "Error creating a local file : %ld\n", GetLastError());
     CloseHandle(hFile);
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
     /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
     ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
@@ -311,7 +311,7 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_existing_non_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == TRUE, "Expected FtpGetFileA to fail\n");
-    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
 
     if (GetFileAttributesA("should_be_existing_non_deadbeef") != INVALID_FILE_ATTRIBUTES)
     {
@@ -320,21 +320,21 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
         bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
         ok ( bRet == TRUE, "Expected FtpGetFileA to succeed\n");
         ok ( GetLastError() == ERROR_SUCCESS,
-            "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+            "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
 
         /* Should fail as fFailIfExists is set to TRUE */
         SetLastError(0xdeadbeef);
         bRet = FtpGetFileA(hFtp, "welcome.msg", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
         ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
         ok ( GetLastError() == ERROR_FILE_EXISTS,
-            "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
+            "Expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
 
         /* Prove that the existence of the local file is checked first (or at least reported last) */
         SetLastError(0xdeadbeef);
         bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
         ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
         ok ( GetLastError() == ERROR_FILE_EXISTS,
-            "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
+            "Expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
 
         DeleteFileA("should_be_existing_non_deadbeef");
     }
@@ -345,20 +345,20 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE ||
          GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE (win98) or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE (win98) or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Test to show that 'session handle type' is checked before 'condition flags' */
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hConnect, "welcome.msg", "should_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, 5, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hConnect, "should_be_non_existing_deadbeef", "should_be_non_existing_deadbeef", TRUE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void trace_extended_error(DWORD error)
@@ -370,7 +370,7 @@ static void trace_extended_error(DWORD error)
     {
         char *text = HeapAlloc(GetProcessHeap(), 0, ++buflen);
         InternetGetLastResponseInfoA(&code, text, &buflen);
-        trace("%u %s\n", code, text);
+        trace("%lu %s\n", code, text);
         HeapFree(GetProcessHeap(), 0, text);
     }
 }
@@ -384,7 +384,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(NULL, "welcome.msg", GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     /* No filename */
@@ -392,7 +392,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(hFtp, NULL, GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     /* Illegal access flags */
@@ -400,7 +400,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", 0, FTP_TRANSFER_TYPE_ASCII, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     /* Illegal combination of access flags */
@@ -408,7 +408,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", GENERIC_READ|GENERIC_WRITE, FTP_TRANSFER_TYPE_ASCII, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     /* Illegal condition flags */
@@ -416,7 +416,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(hFtp, "welcome.msg", GENERIC_READ, 0xffffffff, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR || GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_INVALID_PARAMETER (win98), got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR or ERROR_INVALID_PARAMETER (win98), got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     SetLastError(0xdeadbeef);
@@ -424,7 +424,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     ok ( hOpenFile != NULL, "Expected FtpOpenFileA to succeed\n");
     ok ( GetLastError() == ERROR_SUCCESS ||
         broken(GetLastError() == ERROR_FILE_NOT_FOUND), /* Win98 */
-        "Expected ERROR_SUCCESS, got %u\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %lu\n", GetLastError());
 
     if (hOpenFile)
     {
@@ -439,7 +439,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
         error = GetLastError();
         ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
         trace_extended_error(error);
 
         SetLastError(0xdeadbeef);
@@ -447,7 +447,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
         error = GetLastError();
         ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
         trace_extended_error(error);
 
         SetLastError(0xdeadbeef);
@@ -455,7 +455,7 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
         error = GetLastError();
         ok ( bRet == FALSE || broken(bRet == TRUE), "Expected FtpGetFileA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_SUCCESS),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
         DeleteFileA("should_be_non_existing_deadbeef"); /* Just in case */
 
         SetLastError(0xdeadbeef);
@@ -463,20 +463,20 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
         error = GetLastError();
         ok ( bRet == FALSE || broken(bRet == TRUE), "Expected FtpOpenFileA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_SUCCESS),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
         InternetCloseHandle(hOpenFile2); /* Just in case */
 
         /* Create a temporary local file */
         SetLastError(0xdeadbeef);
         hFile = CreateFileA("now_existing_local", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-        ok ( hFile != NULL, "Error creating a local file : %d\n", GetLastError());
+        ok ( hFile != NULL, "Error creating a local file : %ld\n", GetLastError());
         CloseHandle(hFile);
         SetLastError(0xdeadbeef);
         bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
         error = GetLastError();
         ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
         DeleteFileA("now_existing_local");
 
         SetLastError(0xdeadbeef);
@@ -484,14 +484,14 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
         error = GetLastError();
         ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
 
         SetLastError(0xdeadbeef);
         bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
         error = GetLastError();
         ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error);
+            "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error);
     }
 
     InternetCloseHandle(hOpenFile);
@@ -501,14 +501,14 @@ static void test_openfile(HINTERNET hFtp, HINTERNET hConnect)
     hOpenFile = FtpOpenFileA(hConnect, "welcome.msg", GENERIC_READ, 5, 0);
     ok ( !hOpenFile, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
     InternetCloseHandle(hOpenFile); /* Just in case */
 
     SetLastError(0xdeadbeef);
     hOpenFile = FtpOpenFileA(hConnect, "welcome.msg", GENERIC_READ, FTP_TRANSFER_TYPE_ASCII, 0);
     ok ( hOpenFile == NULL, "Expected FtpOpenFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     InternetCloseHandle(hOpenFile); /* Just in case */
 }
@@ -532,14 +532,14 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE ||
          GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_HANDLE (win98) or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE (win98) or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Test to show session handle is checked before 'condition flags' */
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(NULL, "non_existing_local", "non_existing_remote", 5, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* Start clean */
     DeleteFileA("non_existing_local");
@@ -549,33 +549,33 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpPutFileA(hFtp, NULL, "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* No remote file given */
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hFtp, "non_existing_local", NULL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Illegal condition flags */
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hFtp, "non_existing_local", "non_existing_remote", 5, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_FILE_NOT_FOUND or ERROR_INVALID_PARAMETER (win98), got %d\n", GetLastError());
+        "Expected ERROR_FILE_NOT_FOUND or ERROR_INVALID_PARAMETER (win98), got %ld\n", GetLastError());
 
     /* Parameters are OK but local file doesn't exist */
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hFtp, "non_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_FILE_NOT_FOUND,
-        "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+        "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
 
     /* Create a temporary local file */
     SetLastError(0xdeadbeef);
     hFile = CreateFileA("now_existing_local", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-    ok ( hFile != NULL, "Error creating a local file : %d\n", GetLastError());
+    ok ( hFile != NULL, "Error creating a local file : %ld\n", GetLastError());
     CloseHandle(hFile);
 
     /* Local file exists but we shouldn't be allowed to 'put' the file */
@@ -583,7 +583,7 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     DeleteFileA("now_existing_local");
 
@@ -593,20 +593,20 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE ||
          GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE (win98) or ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE (win98) or ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Test to show that 'session handle type' is checked before 'condition flags' */
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hConnect, "non_existing_local", "non_existing_remote", 5, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hConnect, "non_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
@@ -618,41 +618,41 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpRemoveDirectoryA(NULL, "should_be_non_existing_deadbeef_dir");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* No remote directory given */
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hFtp, NULL);
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Remote directory doesn't exist */
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     /* We shouldn't be allowed to remove that directory */
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hFtp, "pub");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     /* One small test to show that handle type is checked before parameters */
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hConnect, NULL);
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hConnect, "should_be_non_existing_deadbeef_dir");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void test_renamefile(HINTERNET hFtp, HINTERNET hConnect)
@@ -664,41 +664,41 @@ static void test_renamefile(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpRenameFileA(NULL , "should_be_non_existing_deadbeef", "new");
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_HANDLE,
-        "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
 
     /* No 'existing' file */
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hFtp , NULL, "new");
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* No new file */
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", NULL);
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INVALID_PARAMETER,
-        "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+        "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* Existing file shouldn't be there */
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError());
 
     /* One small test to show that handle type is checked before parameters */
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hConnect , "should_be_non_existing_deadbeef", NULL);
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hConnect , "should_be_non_existing_deadbeef", "new");
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError());
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError());
 }
 
 static void test_command(HINTERNET hFtp)
@@ -748,36 +748,36 @@ static void test_command(HINTERNET hFtp)
         error = GetLastError();
 
         ok(ret == command_test[i].ret, "%d: expected FtpCommandA to %s\n", i, command_test[i].ret ? "succeed" : "fail");
-        ok(error == command_test[i].error, "%d: expected error %u, got %u\n", i, command_test[i].error, error);
+        ok(error == command_test[i].error, "%d: expected error %lu, got %lu\n", i, command_test[i].error, error);
 
         size = 0;
         ret = InternetGetLastResponseInfoA(&error, NULL, NULL);
-        ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %d\n", i, ret, GetLastError());
+        ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %ld\n", i, ret, GetLastError());
         ret = InternetGetLastResponseInfoA(NULL, NULL, &size);
-        ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %d\n", i, ret, GetLastError());
+        ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %ld\n", i, ret, GetLastError());
         /* Zero size */
         size = 0;
         ret = InternetGetLastResponseInfoA(&error, NULL, &size);
-        ok((ret && size == 0) || (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER), "%d: got ret %d, size %d, lasterr %d\n", i, ret, size, GetLastError());
+        ok((ret && size == 0) || (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER), "%d: got ret %d, size %ld, lasterr %ld\n", i, ret, size, GetLastError());
         /* Positive size, NULL buffer */
         size++;
         ret = InternetGetLastResponseInfoA(&error, NULL, &size);
-        ok((ret && size == 0) || (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER), "%d: got ret %d, size %u, lasterr %d\n", i, ret, size, GetLastError());
+        ok((ret && size == 0) || (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER), "%d: got ret %d, size %lu, lasterr %ld\n", i, ret, size, GetLastError());
         /* When buffer is 1 char too short, it succeeds but trims the string: */
         orig_size = size;
         buffer = HeapAlloc(GetProcessHeap(), 0, size);
         ok(buffer != NULL, "%d: no memory\n", i);
         ret = InternetGetLastResponseInfoA(&error, buffer, &size);
         ok(ret, "%d: got ret %d\n", i, ret);
-        ok(orig_size == 0 ? size == 0 : size == orig_size - 1, "%d: got orig_size %d, size %d\n", i, orig_size, size);
-        ok(size == 0 || strlen(buffer) == size, "%d: size %d, buffer size %d\n", i, size, size ? strlen(buffer) : 0);
+        ok(orig_size == 0 ? size == 0 : size == orig_size - 1, "%d: got orig_size %ld, size %ld\n", i, orig_size, size);
+        ok(size == 0 || strlen(buffer) == size, "%d: size %ld, buffer size %Id\n", i, size, size ? strlen(buffer) : 0);
         HeapFree(GetProcessHeap(), 0, buffer);
         /* Long enough buffer */
         buffer = HeapAlloc(GetProcessHeap(), 0, ++size);
         ok(buffer != NULL, "%d: no memory\n", i);
         ret = InternetGetLastResponseInfoA(&error, buffer, &size);
         ok(ret, "%d: got ret %d\n", i, ret);
-        ok(size == 0 || strlen(buffer) == size, "%d: size %d, buffer size %d\n", i, size, size ? strlen(buffer) : 0);
+        ok(size == 0 || strlen(buffer) == size, "%d: size %ld, buffer size %Id\n", i, size, size ? strlen(buffer) : 0);
         had_error_zero |= (error == 0);
         had_error_zero_size_positive |= (error == 0 && size > 0);
         HeapFree(GetProcessHeap(), 0, buffer);
@@ -805,7 +805,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
     hSearch2 = FtpFindFirstFileA(hFtp, "welcome.msg", &findData, 0, 0);
     todo_wine ok ( hSearch2 == NULL, "Expected FtpFindFirstFileA to fail\n" );
     todo_wine ok ( GetLastError() == ERROR_FTP_TRANSFER_IN_PROGRESS,
-        "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", GetLastError() );
+        "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", GetLastError() );
     InternetCloseHandle(hSearch2); /* Just in case */
 
     InternetCloseHandle(hSearch);
@@ -852,7 +852,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
     ok ( hOpenFile != NULL, "Expected FtpOpenFileA to succeed\n" );
     ok ( GetLastError() == ERROR_SUCCESS ||
         broken(GetLastError() == ERROR_FILE_NOT_FOUND), /* Win98 */
-        "Expected ERROR_SUCCESS, got %u\n", GetLastError() );
+        "Expected ERROR_SUCCESS, got %lu\n", GetLastError() );
 
     /* This should fail as the OpenFile handle wasn't closed */
     SetLastError(0xdeadbeef);
@@ -862,10 +862,10 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
          "Expected FtpFindFirstFileA to fail\n" );
     if (!hSearch)
         ok ( error == ERROR_FTP_TRANSFER_IN_PROGRESS || broken(error == ERROR_INTERNET_EXTENDED_ERROR),
-             "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %d\n", error );
+             "Expected ERROR_FTP_TRANSFER_IN_PROGRESS, got %ld\n", error );
     else
     {
-        ok( error == ERROR_SUCCESS, "wrong error %u on success\n", GetLastError() );
+        ok( error == ERROR_SUCCESS, "wrong error %lu on success\n", GetLastError() );
         InternetCloseHandle(hSearch);
     }
 
@@ -876,7 +876,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
     hSearch = FtpFindFirstFileA(hFtp, "this_file_should_not_exist", &findData, 0, 0);
     ok ( hSearch == NULL, "Expected FtpFindFirstFileA to fail\n" );
     todo_wine ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
-        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError() );
+        "Expected ERROR_INTERNET_EXTENDED_ERROR, got %ld\n", GetLastError() );
     InternetCloseHandle(hSearch); /* Just in case */
 
     /* Test using a nonexistent filename and a wildcard */
@@ -884,7 +884,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
     hSearch = FtpFindFirstFileA(hFtp, "this_file_should_not_exist*", &findData, 0, 0);
     ok ( hSearch == NULL, "Expected FtpFindFirstFileA to fail\n" );
     todo_wine ok ( GetLastError() == ERROR_NO_MORE_FILES,
-        "Expected ERROR_NO_MORE_FILES, got %d\n", GetLastError() );
+        "Expected ERROR_NO_MORE_FILES, got %ld\n", GetLastError() );
     InternetCloseHandle(hSearch); /* Just in case */
 
     /* Test using an invalid handle type */
@@ -892,7 +892,7 @@ static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
     hSearch = FtpFindFirstFileA(hConnect, "welcome.msg", &findData, 0, 0);
     ok ( hSearch == NULL, "Expected FtpFindFirstFileA to fail\n" );
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %d\n", GetLastError() );
+        "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %ld\n", GetLastError() );
     InternetCloseHandle(hSearch); /* Just in case */
 }
 
@@ -920,45 +920,45 @@ static void test_get_current_dir(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( NULL, NULL, 0 );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
-    ok ( GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got: %ld\n", GetLastError());
 
     /* test with NULL parameters instead of expected LPSTR/LPDWORD */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hFtp, NULL, 0 );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
-    ok ( GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got: %ld\n", GetLastError());
 
     /* test with no valid handle and valid parameters */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( NULL, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
-    ok ( GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got: %ld\n", GetLastError());
 
     /* test with invalid dwCurrentDirectory and all other parameters correct */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, 0 );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
-    ok ( GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got: %ld\n", GetLastError());
 
     /* test with invalid lpszCurrentDirectory and all other parameters correct */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hFtp, NULL, &dwCurrentDirectoryLen );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
-    ok ( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got: %ld\n", GetLastError());
 
     /* test to show it checks the handle type */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hConnect, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n" );
     ok ( GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE,
-    "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got: %d\n", GetLastError());
+    "Expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got: %ld\n", GetLastError());
 
     /* test for the current directory with legitimate values */
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == TRUE, "Expected FtpGetCurrentDirectoryA to pass\n" );
     ok ( !strcmp(lpszCurrentDirectory, "/pub"), "Expected returned value \"%s\" to match \"/pub\"\n", lpszCurrentDirectory);
-    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %ld\n", GetLastError());
 
     /* test for the current directory with a size only large enough to
      * fit the string and not the null terminating character */
@@ -968,7 +968,7 @@ static void test_get_current_dir(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == FALSE, "Expected FtpGetCurrentDirectoryA to fail\n");
     ok ( strcmp(lpszCurrentDirectory, "/pub"), "Expected returned value \"%s\" to not match \"/pub\"\n", lpszCurrentDirectory);
-    ok ( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got: %ld\n", GetLastError());
 
     /* test for the current directory with a size large enough to store
      * the expected string as well as the null terminating character */
@@ -977,7 +977,7 @@ static void test_get_current_dir(HINTERNET hFtp, HINTERNET hConnect)
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == TRUE, "Expected FtpGetCurrentDirectoryA to pass\n");
     ok ( !strcmp(lpszCurrentDirectory, "/pub"), "Expected returned value \"%s\" to match \"/pub\"\n", lpszCurrentDirectory);
-    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %d\n", GetLastError());
+    ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %ld\n", GetLastError());
 }
 
 static void WINAPI status_callback(HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD info_len)
@@ -988,7 +988,7 @@ static void WINAPI status_callback(HINTERNET handle, DWORD_PTR ctx, DWORD status
     case INTERNET_STATUS_NAME_RESOLVED:
     case INTERNET_STATUS_CONNECTING_TO_SERVER:
     case INTERNET_STATUS_CONNECTED_TO_SERVER:
-        trace("%p %lx %u %s %u\n", handle, ctx, status, (char *)info, info_len);
+        trace("%p %Ix %lu %s %lu\n", handle, ctx, status, (char *)info, info_len);
         break;
     default:
         break;
@@ -1008,12 +1008,12 @@ static void test_status_callbacks(HINTERNET hInternet)
                            INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 1);
     if (!hFtp)
     {
-        skip("No ftp connection could be made to ftp.winehq.org %u\n", GetLastError());
+        skip("No ftp connection could be made to ftp.winehq.org %lu\n", GetLastError());
         return;
     }
 
     ret = InternetCloseHandle(hFtp);
-    ok(ret, "InternetCloseHandle failed %u\n", GetLastError());
+    ok(ret, "InternetCloseHandle failed %lu\n", GetLastError());
 
     cb = pInternetSetStatusCallbackA(hInternet, NULL);
     ok(cb == status_callback, "expected check_status got %p\n", cb);
@@ -1036,7 +1036,7 @@ START_TEST(ftp)
 
     SetLastError(0xdeadbeef);
     hInternet = InternetOpenA("winetest", 0, NULL, NULL, 0);
-    ok(hInternet != NULL, "InternetOpen failed: %u\n", GetLastError());
+    ok(hInternet != NULL, "InternetOpen failed: %lu\n", GetLastError());
 
     hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "anonymous", "IEUser@", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
     if (!hFtp)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 706b8fa623b..98d1b74ca85 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -70,14 +70,14 @@ static BOOL https_support = TRUE;
     do { \
         if (!expect[status] && !optional[status] && wine_allow[status]) \
         { \
-            todo_wine ok(expect[status], "unexpected status %d (%s)\n", status, \
+            todo_wine ok(expect[status], "unexpected status %ld (%s)\n", status, \
                          status < MAX_INTERNET_STATUS && status_string[status] ? \
                          status_string[status] : "unknown");            \
             wine_allow[status]--; \
         } \
         else \
         { \
-            ok(expect[status] || optional[status], "unexpected status %d (%s)\n", status,   \
+            ok(expect[status] || optional[status], "unexpected status %ld (%s)\n", status,   \
                status < MAX_INTERNET_STATUS && status_string[status] ? \
                status_string[status] : "unknown");                      \
             if (expect[status]) expect[status]--; \
@@ -256,52 +256,52 @@ static void _test_status_code(unsigned line, HINTERNET req, DWORD excode, BOOL i
     code = 0xdeadbeef;
     size = sizeof(code);
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, NULL);
-    ok_(__FILE__,line)(res, "[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %lu\n", GetLastError());
     todo_wine_if (is_todo)
-        ok_(__FILE__,line)(code == excode, "code = %d, expected %d\n", code, excode);
-    ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
+        ok_(__FILE__,line)(code == excode, "code = %ld, expected %ld\n", code, excode);
+    ok_(__FILE__,line)(size == sizeof(code), "size = %lu\n", size);
 
     code = 0xdeadbeef;
     index = 0;
     size = sizeof(code);
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index);
-    ok_(__FILE__,line)(res, "[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(!index, "index = %d, expected 0\n", index);
-    ok_(__FILE__,line)(size == sizeof(code), "size = %u\n", size);
+    ok_(__FILE__,line)(res, "[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(!index, "index = %ld, expected 0\n", index);
+    ok_(__FILE__,line)(size == sizeof(code), "size = %lu\n", size);
 
-    sprintf(exbuf, "%u", excode);
+    sprintf(exbuf, "%lu", excode);
 
     size = sizeof(bufa);
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE, bufa, &size, NULL);
-    ok_(__FILE__,line)(res, "[3] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "[3] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %lu\n", GetLastError());
     todo_wine_if (is_todo)
         ok_(__FILE__,line)(!strcmp(bufa, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
-    ok_(__FILE__,line)(size == strlen(exbuf), "unexpected size %d for \"%s\"\n", size, exbuf);
+    ok_(__FILE__,line)(size == strlen(exbuf), "unexpected size %ld for \"%s\"\n", size, exbuf);
 
     size = 0;
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE, NULL, &size, NULL);
     ok_(__FILE__,line)(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-                       "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(size == strlen(exbuf)+1, "unexpected size %d for \"%s\"\n", size, exbuf);
+                       "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(size == strlen(exbuf)+1, "unexpected size %ld for \"%s\"\n", size, exbuf);
 
     size = sizeof(bufw);
     res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, bufw, &size, NULL);
-    ok_(__FILE__,line)(res, "[5] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "[5] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %lu\n", GetLastError());
     todo_wine_if (is_todo)
         ok_(__FILE__,line)(!strcmp_wa(bufw, exbuf), "unexpected status code %s, expected %s\n", bufa, exbuf);
-    ok_(__FILE__,line)(size == strlen(exbuf)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
+    ok_(__FILE__,line)(size == strlen(exbuf)*sizeof(WCHAR), "unexpected size %ld for \"%s\"\n", size, exbuf);
 
     size = 0;
     res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, bufw, &size, NULL);
     ok_(__FILE__,line)(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-                       "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(size == (strlen(exbuf)+1)*sizeof(WCHAR), "unexpected size %d for \"%s\"\n", size, exbuf);
+                       "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(size == (strlen(exbuf)+1)*sizeof(WCHAR), "unexpected size %ld for \"%s\"\n", size, exbuf);
 
     if(0) {
     size = sizeof(bufw);
     res = HttpQueryInfoW(req, HTTP_QUERY_STATUS_CODE, NULL, &size, NULL);
-    ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %u\n", GetLastError());
-    ok(size == sizeof(bufw), "unexpected size %d\n", size);
+    ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "HttpQueryInfo(HTTP_QUERY_STATUS_CODE) failed: %lu\n", GetLastError());
+    ok(size == sizeof(bufw), "unexpected size %ld\n", size);
     }
 
     code = 0xdeadbeef;
@@ -309,13 +309,13 @@ static void _test_status_code(unsigned line, HINTERNET req, DWORD excode, BOOL i
     size = sizeof(code);
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &code, &size, &index);
     ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
-                       "[7] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
+                       "[7] HttpQueryInfoA failed: %x(%ld)\n", res, GetLastError());
 
     code = 0xdeadbeef;
     size = sizeof(code);
     res = HttpQueryInfoA(req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_REQUEST_HEADERS, &code, &size, NULL);
     ok_(__FILE__,line)(!res && GetLastError() == ERROR_HTTP_INVALID_QUERY_REQUEST,
-                       "[8] HttpQueryInfoA failed: %x(%d)\n", res, GetLastError());
+                       "[8] HttpQueryInfoA failed: %x(%ld)\n", res, GetLastError());
 }
 
 #define test_request_flags(a,b) _test_request_flags(__LINE__,a,b,FALSE)
@@ -328,12 +328,12 @@ static void _test_request_flags(unsigned line, HINTERNET req, DWORD exflags, BOO
     flags = 0xdeadbeef;
     size = sizeof(flags);
     res = InternetQueryOptionW(req, INTERNET_OPTION_REQUEST_FLAGS, &flags, &size);
-    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_REQUEST_FLAGS) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_REQUEST_FLAGS) failed: %lu\n", GetLastError());
 
     /* FIXME: Remove once we have INTERNET_REQFLAG_CACHE_WRITE_DISABLED implementation */
     flags &= ~INTERNET_REQFLAG_CACHE_WRITE_DISABLED;
     todo_wine_if (is_todo)
-        ok_(__FILE__,line)(flags == exflags, "flags = %x, expected %x\n", flags, exflags);
+        ok_(__FILE__,line)(flags == exflags, "flags = %lx, expected %lx\n", flags, exflags);
 }
 
 #define test_request_url(a,b) _test_request_url(__LINE__,a,b)
@@ -344,8 +344,8 @@ static void _test_request_url(unsigned line, HINTERNET req, const char *expected
     BOOL res;
 
     res = InternetQueryOptionA(req, INTERNET_OPTION_URL, buf, &size);
-    ok_(__FILE__,line)(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(size == strlen(expected_url), "size = %u\n", size);
+    ok_(__FILE__,line)(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(size == strlen(expected_url), "size = %lu\n", size);
     ok_(__FILE__,line)(!strcmp(buf, expected_url), "unexpected URL %s, expected %s\n", buf, expected_url);
 }
 
@@ -358,9 +358,9 @@ static void _test_http_version(unsigned line, HINTERNET req)
 
     size = sizeof(v);
     res = InternetQueryOptionW(req, INTERNET_OPTION_HTTP_VERSION, &v, &size);
-    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_HTTP_VERSION) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(v.dwMajorVersion == 1, "dwMajorVersion = %d\n", v.dwMajorVersion);
-    ok_(__FILE__,line)(v.dwMinorVersion == 1, "dwMinorVersion = %d\n", v.dwMinorVersion);
+    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_HTTP_VERSION) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(v.dwMajorVersion == 1, "dwMajorVersion = %ld\n", v.dwMajorVersion);
+    ok_(__FILE__,line)(v.dwMinorVersion == 1, "dwMinorVersion = %ld\n", v.dwMinorVersion);
 }
 
 static LONG close_handle_cnt;
@@ -378,96 +378,96 @@ static VOID WINAPI callback(
     {
         case INTERNET_STATUS_RESOLVING_NAME:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESOLVING_NAME \"%s\" %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_RESOLVING_NAME \"%s\" %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
             *(LPSTR)lpvStatusInformation = '\0';
             break;
         case INTERNET_STATUS_NAME_RESOLVED:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_NAME_RESOLVED \"%s\" %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_NAME_RESOLVED \"%s\" %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
             *(LPSTR)lpvStatusInformation = '\0';
             break;
         case INTERNET_STATUS_CONNECTING_TO_SERVER:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
-            ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
+            ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %lu\n",
                dwStatusInformationLength);
             *(LPSTR)lpvStatusInformation = '\0';
             break;
         case INTERNET_STATUS_CONNECTED_TO_SERVER:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       (LPCSTR)lpvStatusInformation,dwStatusInformationLength);
-            ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %u\n",
+            ok(dwStatusInformationLength == strlen(lpvStatusInformation)+1, "unexpected size %lu\n",
                dwStatusInformationLength);
             *(LPSTR)lpvStatusInformation = '\0';
             break;
         case INTERNET_STATUS_SENDING_REQUEST:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_SENDING_REQUEST %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_SENDING_REQUEST %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_REQUEST_SENT:
             ok(dwStatusInformationLength == sizeof(DWORD),
-                "info length should be sizeof(DWORD) instead of %d\n",
+                "info length should be sizeof(DWORD) instead of %ld\n",
                 dwStatusInformationLength);
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_SENT 0x%x %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_REQUEST_SENT 0x%lx %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_RECEIVING_RESPONSE:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RECEIVING_RESPONSE %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_RECEIVING_RESPONSE %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_RESPONSE_RECEIVED:
             ok(dwStatusInformationLength == sizeof(DWORD),
-                "info length should be sizeof(DWORD) instead of %d\n",
+                "info length should be sizeof(DWORD) instead of %ld\n",
                 dwStatusInformationLength);
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_RESPONSE_RECEIVED 0x%x %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_RESPONSE_RECEIVED 0x%lx %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       *(DWORD *)lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_CTL_RESPONSE_RECEIVED:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %ld\n",
                       GetCurrentThreadId(), hInternet,dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_PREFETCH:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_PREFETCH %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_PREFETCH %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_CLOSING_CONNECTION:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CLOSING_CONNECTION %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_CLOSING_CONNECTION %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_CONNECTION_CLOSED:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_CONNECTION_CLOSED %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTION_CLOSED %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation,dwStatusInformationLength);
             break;
         case INTERNET_STATUS_HANDLE_CREATED:
             ok(dwStatusInformationLength == sizeof(HINTERNET),
-                "info length should be sizeof(HINTERNET) instead of %d\n",
+                "info length should be sizeof(HINTERNET) instead of %ld\n",
                 dwStatusInformationLength);
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CREATED %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_HANDLE_CREATED %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       *(HINTERNET *)lpvStatusInformation,dwStatusInformationLength);
             CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -475,10 +475,10 @@ static VOID WINAPI callback(
             break;
         case INTERNET_STATUS_HANDLE_CLOSING:
             ok(dwStatusInformationLength == sizeof(HINTERNET),
-                "info length should be sizeof(HINTERNET) instead of %d\n",
+                "info length should be sizeof(HINTERNET) instead of %ld\n",
                 dwStatusInformationLength);
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_HANDLE_CLOSING %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_HANDLE_CLOSING %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       *(HINTERNET *)lpvStatusInformation, dwStatusInformationLength);
             if(!InterlockedDecrement(&close_handle_cnt))
@@ -488,11 +488,11 @@ static VOID WINAPI callback(
         {
             INTERNET_ASYNC_RESULT *iar = (INTERNET_ASYNC_RESULT *)lpvStatusInformation;
             ok(dwStatusInformationLength == sizeof(INTERNET_ASYNC_RESULT),
-                "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %d\n",
+                "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %ld\n",
                 dwStatusInformationLength);
-            ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %ld\n", iar->dwResult);
+            ok(iar->dwResult == 1 || iar->dwResult == 0, "iar->dwResult = %Id\n", iar->dwResult);
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REQUEST_COMPLETE {%ld,%d} %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_REQUEST_COMPLETE {%Id,%ld} %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       iar->dwResult,iar->dwError,dwStatusInformationLength);
             req_error = iar->dwError;
@@ -502,7 +502,7 @@ static VOID WINAPI callback(
         }
         case INTERNET_STATUS_REDIRECT:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_REDIRECT \"%s\" %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_REDIRECT \"%s\" %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       (LPCSTR)lpvStatusInformation, dwStatusInformationLength);
             *(LPSTR)lpvStatusInformation = '\0';
@@ -511,13 +511,13 @@ static VOID WINAPI callback(
             break;
         case INTERNET_STATUS_INTERMEDIATE_RESPONSE:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext,
                       lpvStatusInformation, dwStatusInformationLength);
             break;
         default:
             if(winetest_debug > 1)
-                trace("%04x:Callback %p 0x%lx %d %p %d\n",
+                trace("%04lx:Callback %p 0x%Ix %ld %p %ld\n",
                       GetCurrentThreadId(), hInternet, dwContext, dwInternetStatus,
                       lpvStatusInformation, dwStatusInformationLength);
     }
@@ -534,13 +534,13 @@ static void _open_simple_request(unsigned line, test_request_t *req, const char
         int port, const char *verb, const char *url)
 {
     req->session = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok_(__FILE__,line)(req->session != NULL, "InternetOpenA failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(req->session != NULL, "InternetOpenA failed: %lu\n", GetLastError());
 
     req->connection = InternetConnectA(req->session, host, port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok_(__FILE__,line)(req->connection != NULL, "InternetConnectA failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(req->connection != NULL, "InternetConnectA failed: %lu\n", GetLastError());
 
     req->request = HttpOpenRequestA(req->connection, verb, url, NULL, NULL, NULL, 0, 0);
-    ok_(__FILE__,line)(req->request != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(req->request != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
 }
 
 #define close_request(a) _close_request(__LINE__,a)
@@ -549,11 +549,11 @@ static void _close_request(unsigned line, test_request_t *req)
     BOOL ret;
 
     ret = InternetCloseHandle(req->request);
-    ok_(__FILE__,line)(ret, "InternetCloseHandle(request) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(ret, "InternetCloseHandle(request) failed: %lu\n", GetLastError());
     ret = InternetCloseHandle(req->connection);
-    ok_(__FILE__,line)(ret, "InternetCloseHandle(connection) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(ret, "InternetCloseHandle(connection) failed: %lu\n", GetLastError());
     ret = InternetCloseHandle(req->session);
-    ok_(__FILE__,line)(ret, "InternetCloseHandle(session) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(ret, "InternetCloseHandle(session) failed: %lu\n", GetLastError());
 }
 
 #define receive_simple_request(a,b,c) _receive_simple_request(__LINE__,a,b,c)
@@ -563,7 +563,7 @@ static DWORD _receive_simple_request(unsigned line, HINTERNET req, char *buf, si
     BOOL ret;
 
     ret = InternetReadFile(req, buf, buf_size, &read);
-    ok_(__FILE__,line)(ret, "InternetReadFile failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(ret, "InternetReadFile failed: %lu\n", GetLastError());
 
     return read;
 }
@@ -576,7 +576,7 @@ static void close_async_handle(HINTERNET handle, int handle_cnt)
 
     SET_EXPECT2(INTERNET_STATUS_HANDLE_CLOSING, handle_cnt);
     res = InternetCloseHandle(handle);
-    ok(res, "InternetCloseHandle failed: %u\n", GetLastError());
+    ok(res, "InternetCloseHandle failed: %lu\n", GetLastError());
     WaitForSingleObject(complete_event, INFINITE);
     CHECK_NOTIFIED2(INTERNET_STATUS_HANDLE_CLOSING, handle_cnt);
 }
@@ -598,7 +598,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
     hi = InternetOpenA((test->flags & TESTF_COMPRESSED) ? "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" : "",
             INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags);
-    ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
+    ok((hi != 0x0),"InternetOpen failed with error %lu\n", GetLastError());
 
     if (hi == 0x0) goto abort;
 
@@ -608,7 +608,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
     hic=InternetConnectA(hi, test->host, INTERNET_INVALID_PORT_NUMBER,
                          NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
+    ok((hic != 0x0),"InternetConnect failed with error %lu\n", GetLastError());
 
     if (hic == 0x0) goto abort;
 
@@ -626,7 +626,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
          * abort.
          */
     } else  {
-        ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
+        ok((hor != 0x0),"HttpOpenRequest failed with error %lu\n", GetLastError());
     }
 
     if (hor == 0x0) goto abort;
@@ -636,8 +636,8 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
     length = sizeof(buffer);
     res = HttpQueryInfoA(hor, HTTP_QUERY_RAW_HEADERS, buffer, &length, 0x0);
-    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
-    ok(length == 0 || (length == 1 && !*buffer) /* win10 */, "HTTP_QUERY_RAW_HEADERS: expected length 0, but got %d\n", length);
+    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n", GetLastError());
+    ok(length == 0 || (length == 1 && !*buffer) /* win10 */, "HTTP_QUERY_RAW_HEADERS: expected length 0, but got %ld\n", length);
     ok(!strcmp(buffer, ""), "HTTP_QUERY_RAW_HEADERS: expected string \"\", but got \"%s\"\n", buffer);
 
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
@@ -671,7 +671,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
         res = InternetSetOptionA(hor, INTERNET_OPTION_HTTP_DECODING, &b, sizeof(b));
         ok(res || broken(!res && GetLastError() == ERROR_INTERNET_INVALID_OPTION),
-           "InternetSetOption failed: %u\n", GetLastError());
+           "InternetSetOption failed: %lu\n", GetLastError());
         if(!res)
             goto abort;
     }
@@ -690,11 +690,11 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     else
         ok(res || (GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED),
-           "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
+           "Synchronous HttpSendRequest returning 0, error %lu\n", GetLastError());
 
     if (flags & INTERNET_FLAG_ASYNC) {
         WaitForSingleObject(complete_event, INFINITE);
-        ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+        ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
     }
     HeapFree(GetProcessHeap(), 0, post_data);
 
@@ -734,15 +734,15 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
     length = 100;
     res = InternetQueryOptionA(hor,INTERNET_OPTION_URL,buffer,&length);
-    ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %d\n", GetLastError());
+    ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %ld\n", GetLastError());
 
     length = sizeof(buffer)-2;
     memset(buffer, 0x77, sizeof(buffer));
     SetLastError(0xdeadbeef);
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
-    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
+    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n", GetLastError());
     ok(GetLastError() == 0 ||
-                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
+                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %lu\n", GetLastError());
     /* show that the function writes data past the length returned */
     ok(buffer[length-2], "Expected any header character, got 0x00\n");
     ok(!buffer[length-1], "Expected 0x00, got %02X\n", buffer[length-1]);
@@ -752,22 +752,22 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     length2 = length;
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length2,0x0);
     ok(!res, "Expected 0x00, got %d\n", res);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
-    ok(length2 == length+1, "Expected %d, got %d\n", length+1, length2);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(length2 == length+1, "Expected %ld, got %ld\n", length+1, length2);
     /* the in length of the buffer must be +1 but the length returned does not count this */
     length2 = length+1;
     memset(buffer, 0x77, sizeof(buffer));
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length2,0x0);
-    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
+    ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n", GetLastError());
     ok(buffer[length2] == 0x00, "Expected 0x00, got %02X\n", buffer[length2]);
     ok(buffer[length2+1] == 0x77, "Expected 0x77, got %02X\n", buffer[length2+1]);
-    ok(length2 == length, "Value should not have changed: %d != %d\n", length2, length);
+    ok(length2 == length, "Value should not have changed: %ld != %ld\n", length2, length);
 
     length = sizeof(wbuffer)-2*sizeof(WCHAR);
     memset(wbuffer, 0x77, sizeof(wbuffer));
     res = HttpQueryInfoW(hor, HTTP_QUERY_RAW_HEADERS, wbuffer, &length, 0x0);
-    ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
-    ok(length % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %d.\n", length);
+    ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n", GetLastError());
+    ok(length % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %ld.\n", length);
     length /= sizeof(WCHAR);
     /* show that the function writes data past the length returned */
     ok(wbuffer[length-2], "Expected any header character, got 0x0000\n");
@@ -779,20 +779,20 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     length2 = length*sizeof(WCHAR);
     res = HttpQueryInfoW(hor,HTTP_QUERY_RAW_HEADERS,wbuffer,&length2,0x0);
     ok(!res, "Expected 0x00, got %d\n", res);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
-    ok(length2 % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %d.\n", length2);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(length2 % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %ld.\n", length2);
     length2 /= sizeof(WCHAR);
-    ok(length2 == length+1, "Expected %d, got %d\n", length+1, length2);
+    ok(length2 == length+1, "Expected %ld, got %ld\n", length+1, length2);
     /* the in length of the buffer must be +1 but the length returned does not count this */
     length2 = (length+1)*sizeof(WCHAR);
     memset(wbuffer, 0x77, sizeof(wbuffer));
     res = HttpQueryInfoW(hor,HTTP_QUERY_RAW_HEADERS,wbuffer,&length2,0x0);
-    ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
-    ok(length2 % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %d.\n", length2);
+    ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n", GetLastError());
+    ok(length2 % sizeof(WCHAR) == 0, "Expected that length is a multiple of sizeof(WCHAR), got %ld.\n", length2);
     length2 /= sizeof(WCHAR);
     ok(!wbuffer[length2], "Expected 0x0000, got %04X\n", wbuffer[length2]);
     ok(wbuffer[length2+1] == 0x7777, "Expected 0x7777, got %04X\n", wbuffer[length2+1]);
-    ok(length2 == length, "Value should not have changed: %d != %d\n", length2, length);
+    ok(length2 == length, "Value should not have changed: %ld != %ld\n", length2, length);
 
     test_request_url(hor, test->redirected_url);
 
@@ -802,29 +802,29 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     ok(HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,NULL,&length,&index) == FALSE,"Query worked\n");
     if(test->flags & TESTF_COMPRESSED)
         ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
-           "expected ERROR_HTTP_HEADER_NOT_FOUND, got %u\n", GetLastError());
+           "expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n", GetLastError());
     ok(index == 0, "Index was incremented\n");
 
     index = 0;
     length = 16;
     res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,&index);
-    trace("Option HTTP_QUERY_CONTENT_LENGTH -> %i  %s  (%u)\n",res,buffer,GetLastError());
+    trace("Option HTTP_QUERY_CONTENT_LENGTH -> %i  %s  (%lu)\n",res,buffer,GetLastError());
     if(test->flags & TESTF_COMPRESSED)
     {
         ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND,
-           "expected ERROR_HTTP_HEADER_NOT_FOUND, got %x (%u)\n", res, GetLastError());
+           "expected ERROR_HTTP_HEADER_NOT_FOUND, got %x (%lu)\n", res, GetLastError());
         contents_length = 0;
     }
     else
     {
         contents_length = atoi(buffer);
     }
-    ok(!res || index == 1, "Index was not incremented although result is %x (index = %u)\n", res, index);
+    ok(!res || index == 1, "Index was not incremented although result is %x (index = %lu)\n", res, index);
 
     length = 64;
     *buffer = 0;
     res = HttpQueryInfoA(hor,HTTP_QUERY_ACCEPT_RANGES,&buffer,&length,0x0);
-    trace("Option HTTP_QUERY_ACCEPT_RANGES -> %i  %s  (%u)\n",res,buffer,GetLastError());
+    trace("Option HTTP_QUERY_ACCEPT_RANGES -> %i  %s  (%lu)\n",res,buffer,GetLastError());
     accepts_ranges = res && !strcmp(buffer, "bytes");
 
     length = 100;
@@ -844,24 +844,24 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
     if (accepts_ranges)
         todo_wine ok((length == contents_length && (GetLastError() == ERROR_SUCCESS
                 || broken(GetLastError() == 0xdeadbeef))) || broken(not_supported),
-                "Got unexpected length %#x, GetLastError() %u, contents_length %u, accepts_ranges %#x.\n",
+                "Got unexpected length %#lx, GetLastError() %lu, contents_length %lu, accepts_ranges %#lx.\n",
                 length, GetLastError(), contents_length, accepts_ranges);
     else
-        ok(not_supported, "Got unexpected length %#x, GetLastError() %u.\n", length, GetLastError());
+        ok(not_supported, "Got unexpected length %#lx, GetLastError() %lu.\n", length, GetLastError());
 
     if (length != INVALID_SET_FILE_POINTER)
     {
         SetLastError(0xdeadbeef);
         length = InternetSetFilePointer(hor, 0, NULL, FILE_BEGIN, 0);
         ok(!length && (GetLastError() == ERROR_SUCCESS || broken(GetLastError() == 0xdeadbeef)),
-                "Got unexpected length %#x, GetLastError() %u.\n", length, GetLastError());
+                "Got unexpected length %#lx, GetLastError() %lu.\n", length, GetLastError());
     }
 
     SetLastError(0xdeadbeef);
     res = InternetReadFile(NULL, buffer, 100, &length);
     ok(!res, "InternetReadFile should have failed\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-        "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %u\n",
+        "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %lu\n",
         GetLastError());
 
     length = 100;
@@ -888,7 +888,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
             {
                 CHECK_NOT_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
                 if(exlen) {
-                    ok(length >= exlen, "length %u < exlen %u\n", length, exlen);
+                    ok(length >= exlen, "length %lu < exlen %lu\n", length, exlen);
                     exlen = 0;
                 }
             }
@@ -898,7 +898,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
                     trace("pending\n");
                 /* on some tests, InternetQueryDataAvailable returns non-zero length and ERROR_IO_PENDING */
                 if(!(test->flags & TESTF_CHUNKED))
-                    ok(!length, "InternetQueryDataAvailable returned ERROR_IO_PENDING and %u length\n", length);
+                    ok(!length, "InternetQueryDataAvailable returned ERROR_IO_PENDING and %lu length\n", length);
                 WaitForSingleObject(complete_event, INFINITE);
                 exlen = length;
                 ok(exlen, "length = 0\n");
@@ -907,17 +907,17 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
                 ok(req_error, "req_error = 0\n");
                 continue;
             }else {
-                ok(0, "InternetQueryDataAvailable failed: %u\n", GetLastError());
+                ok(0, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
             }
         }else {
-            ok(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
+            ok(res, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
         }
         CLEAR_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
 
         if(winetest_debug > 1)
-            trace("length %u\n", length);
+            trace("length %lu\n", length);
         if(test->flags & TESTF_CHUNKED)
-            ok(length <= 8192, "length = %d, expected <= 8192\n", length);
+            ok(length <= 8192, "length = %ld, expected <= 8192\n", length);
         if (length)
         {
             char *buffer;
@@ -928,7 +928,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
             buffer[length]=0;
 
             if(winetest_debug > 1)
-                trace("ReadFile -> %s %i\n", res ? "TRUE" : "FALSE", length);
+                trace("ReadFile -> %s %li\n", res ? "TRUE" : "FALSE", length);
 
             if(test->content)
                 ok(!strcmp(buffer, test->content), "buffer = '%s', expected '%s'\n", buffer, test->content);
@@ -961,13 +961,13 @@ static void InternetReadFile_chunked_test(void)
     trace("Starting InternetReadFile chunked test\n");
 
     hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
-    ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
+    ok((hi != 0x0),"InternetOpen failed with error %lu\n", GetLastError());
 
     if (hi == 0x0) goto abort;
 
     hic=InternetConnectA(hi, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER,
                          NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
+    ok((hic != 0x0),"InternetConnect failed with error %lu\n", GetLastError());
 
     if (hic == 0x0) goto abort;
 
@@ -982,7 +982,7 @@ static void InternetReadFile_chunked_test(void)
          * abort.
          */
     } else  {
-        ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
+        ok((hor != 0x0),"HttpOpenRequest failed with error %lu\n", GetLastError());
     }
 
     if (hor == 0x0) goto abort;
@@ -990,7 +990,7 @@ static void InternetReadFile_chunked_test(void)
     SetLastError(0xdeadbeef);
     res = HttpSendRequestA(hor, "", -1, NULL, 0);
     ok(res || (GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED),
-       "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
+       "Synchronous HttpSendRequest returning 0, error %lu\n", GetLastError());
 
     test_request_flags(hor, 0);
 
@@ -1005,7 +1005,7 @@ static void InternetReadFile_chunked_test(void)
     buffer[length]=0;
     trace("Option TRANSFER_ENCODING -> %i  %s\n",res,buffer);
     ok( res || ( proxy_active() && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND ),
-        "Failed to get TRANSFER_ENCODING option, error %u\n", GetLastError() );
+        "Failed to get TRANSFER_ENCODING option, error %lu\n", GetLastError() );
     ok( !strcmp( buffer, "chunked" ) || ( ! res && proxy_active() && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND ),
         "Wrong transfer encoding '%s'\n", buffer );
 
@@ -1013,7 +1013,7 @@ static void InternetReadFile_chunked_test(void)
     length = 16;
     res = HttpQueryInfoA(hor,HTTP_QUERY_CONTENT_LENGTH,&buffer,&length,0x0);
     ok( !res, "Found CONTENT_LENGTH option '%s'\n", buffer );
-    ok( GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Wrong error %lu\n", GetLastError() );
 
     length = 100;
     trace("Entering Query loop\n");
@@ -1022,8 +1022,8 @@ static void InternetReadFile_chunked_test(void)
     {
         res = InternetQueryDataAvailable(hor,&length,0x0,0x0);
         ok(!(!res && length != 0),"InternetQueryDataAvailable failed with non-zero length\n");
-        ok(res, "InternetQueryDataAvailable failed, error %d\n", GetLastError());
-        trace("got %u available\n",length);
+        ok(res, "InternetQueryDataAvailable failed, error %ld\n", GetLastError());
+        trace("got %lu available\n",length);
         if (length)
         {
             char *buffer = HeapAlloc(GetProcessHeap(),0,length+1);
@@ -1031,11 +1031,11 @@ static void InternetReadFile_chunked_test(void)
             SetLastError(0xdeadbeef);
             res = InternetReadFile(hor,buffer,length,&got);
             ok(GetLastError() == 0 ||
-                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
+                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %lu\n", GetLastError());
 
             buffer[got]=0;
-            trace("ReadFile -> %i %i\n",res,got);
-            ok( length == got, "only got %u of %u available\n", got, length );
+            trace("ReadFile -> %i %li\n",res,got);
+            ok( length == got, "only got %lu of %lu available\n", got, length );
             ok( buffer[got-1] == '\n', "received partial line '%s'\n", buffer );
 
             HeapFree(GetProcessHeap(),0,buffer);
@@ -1046,10 +1046,10 @@ static void InternetReadFile_chunked_test(void)
             got = 0xdeadbeef;
             SetLastError(0xdeadbeef);
             res = InternetReadFile( hor, buffer, 1, &got );
-            ok( res, "InternetReadFile failed: %u\n", GetLastError() );
+            ok( res, "InternetReadFile failed: %lu\n", GetLastError() );
             ok(GetLastError() == 0 ||
-                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
-            ok( !got, "got %u\n", got );
+                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %lu\n", GetLastError());
+            ok( !got, "got %lu\n", got );
             break;
         }
     }
@@ -1077,7 +1077,7 @@ static void InternetReadFileExA_test(int flags)
     reset_events();
 
     hi = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, flags);
-    ok((hi != 0x0),"InternetOpen failed with error %u\n", GetLastError());
+    ok((hi != 0x0),"InternetOpen failed with error %lu\n", GetLastError());
 
     if (hi == 0x0) goto abort;
 
@@ -1087,7 +1087,7 @@ static void InternetReadFileExA_test(int flags)
 
     hic=InternetConnectA(hi, "test.winehq.org", INTERNET_INVALID_PORT_NUMBER,
                          NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok((hic != 0x0),"InternetConnect failed with error %u\n", GetLastError());
+    ok((hic != 0x0),"InternetConnect failed with error %lu\n", GetLastError());
 
     if (hic == 0x0) goto abort;
 
@@ -1105,7 +1105,7 @@ static void InternetReadFileExA_test(int flags)
          * abort.
          */
     } else  {
-        ok((hor != 0x0),"HttpOpenRequest failed with error %u\n", GetLastError());
+        ok((hor != 0x0),"HttpOpenRequest failed with error %lu\n", GetLastError());
     }
 
     if (hor == 0x0) goto abort;
@@ -1142,11 +1142,11 @@ static void InternetReadFileExA_test(int flags)
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     else
         ok((rc != 0) || GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED,
-           "Synchronous HttpSendRequest returning 0, error %u\n", GetLastError());
+           "Synchronous HttpSendRequest returning 0, error %lu\n", GetLastError());
 
     if (!rc && (GetLastError() == ERROR_IO_PENDING)) {
         WaitForSingleObject(complete_event, INFINITE);
-        ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+        ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
     }
 
     if (first_connection_to_test_url)
@@ -1178,7 +1178,7 @@ static void InternetReadFileExA_test(int flags)
     if(is_ie7plus) {
         rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe);
         ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
-           "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
+           "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %lu\n",
            rc ? "TRUE" : "FALSE", GetLastError());
     }
 
@@ -1192,7 +1192,7 @@ static void InternetReadFileExA_test(int flags)
     inetbuffers.dwOffsetLow = 5678;
     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",
+        "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %lu\n",
         rc ? "TRUE" : "FALSE", GetLastError());
     HeapFree(GetProcessHeap(), 0, inetbuffers.lpvBuffer);
 
@@ -1207,12 +1207,12 @@ static void InternetReadFileExA_test(int flags)
     inetbuffers.dwOffsetHigh = 1234;
     inetbuffers.dwOffsetLow = 5678;
     rc = InternetReadFileExA(hor, &inetbuffers, 0, 0xdeadcafe);
-    ok(rc, "InternetReadFileEx failed with error %u\n", GetLastError());
-    trace("read %i bytes\n", inetbuffers.dwBufferLength);
+    ok(rc, "InternetReadFileEx failed with error %lu\n", GetLastError());
+    trace("read %li bytes\n", inetbuffers.dwBufferLength);
 
     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",
+        "InternetReadFileEx should have failed with ERROR_INVALID_HANDLE instead of %s, %lu\n",
         rc ? "TRUE" : "FALSE", GetLastError());
 
     length = 0;
@@ -1241,11 +1241,11 @@ static void InternetReadFileExA_test(int flags)
                 WaitForSingleObject(complete_event, INFINITE);
                 CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
                 CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
-                ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+                ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
             }
             else
             {
-                trace("InternetReadFileEx -> FAILED %u\n", GetLastError());
+                trace("InternetReadFileEx -> FAILED %lu\n", GetLastError());
                 break;
             }
         }
@@ -1266,11 +1266,11 @@ static void InternetReadFileExA_test(int flags)
             }
         }
 
-        trace("read %i bytes\n", inetbuffers.dwBufferLength);
+        trace("read %li bytes\n", inetbuffers.dwBufferLength);
         ((char *)inetbuffers.lpvBuffer)[inetbuffers.dwBufferLength] = '\0';
 
         ok(inetbuffers.dwOffsetHigh == 1234 && inetbuffers.dwOffsetLow == 5678,
-            "InternetReadFileEx sets offsets to 0x%x%08x\n",
+            "InternetReadFileEx sets offsets to 0x%lx%08lx\n",
             inetbuffers.dwOffsetHigh, inetbuffers.dwOffsetLow);
 
         HeapFree(GetProcessHeap(), 0, inetbuffers.lpvBuffer);
@@ -1281,7 +1281,7 @@ static void InternetReadFileExA_test(int flags)
         length += inetbuffers.dwBufferLength;
     }
     ok(length > 0, "failed to read any of the document\n");
-    trace("Finished. Read %d bytes\n", length);
+    trace("Finished. Read %ld bytes\n", length);
 
 abort:
     close_async_handle(hi, 2);
@@ -1297,26 +1297,26 @@ static void InternetOpenUrlA_test(void)
 
   ret = DeleteUrlCacheEntryA(TEST_URL);
   ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND,
-          "DeleteUrlCacheEntry returned %x, GetLastError() = %d\n", ret, GetLastError());
+          "DeleteUrlCacheEntry returned %x, GetLastError() = %ld\n", ret, GetLastError());
 
   myhinternet = InternetOpenA("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
-  ok((myhinternet != 0), "InternetOpen failed, error %u\n",GetLastError());
+  ok((myhinternet != 0), "InternetOpen failed, error %lu\n",GetLastError());
   size = 0x400;
   ret = InternetCanonicalizeUrlA(TEST_URL, buffer, &size,ICU_BROWSER_MODE);
-  ok( ret, "InternetCanonicalizeUrl failed, error %u\n",GetLastError());
+  ok( ret, "InternetCanonicalizeUrl failed, error %lu\n",GetLastError());
 
   SetLastError(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 */
-  ok((myhttp != 0),"InternetOpenUrl failed, error %u\n",GetLastError());
+  ok((myhttp != 0),"InternetOpenUrl failed, error %lu\n",GetLastError());
   ret = InternetReadFile(myhttp, buffer,0x400,&readbytes);
-  ok( ret, "InternetReadFile failed, error %u\n",GetLastError());
+  ok( ret, "InternetReadFile failed, error %lu\n",GetLastError());
   totalbytes += readbytes;
   while (readbytes && InternetReadFile(myhttp, buffer,0x400,&readbytes))
     totalbytes += readbytes;
-  trace("read 0x%08x bytes\n",totalbytes);
+  trace("read 0x%08lx bytes\n",totalbytes);
 
   InternetCloseHandle(myhttp);
   InternetCloseHandle(myhinternet);
@@ -1354,7 +1354,7 @@ static void HttpSendRequestEx_test(void)
         skip( "Network unreachable, skipping test\n" );
         goto done;
     }
-    ok( hRequest != NULL, "Failed to open request handle err %u\n", GetLastError());
+    ok( hRequest != NULL, "Failed to open request handle err %lu\n", GetLastError());
 
     test_request_flags(hRequest, INTERNET_REQFLAG_NO_HEADERS);
 
@@ -1372,8 +1372,8 @@ static void HttpSendRequestEx_test(void)
     SetLastError(0xdeadbeef);
     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);
+    ok(ret, "HttpSendRequestEx Failed with error %lu\n", error);
+    ok(error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", error);
 
     test_request_flags(hRequest, INTERNET_REQFLAG_NO_HEADERS);
 
@@ -1391,7 +1391,7 @@ static void HttpSendRequestEx_test(void)
             "Unable to read response\n");
     szBuffer[dwBytesRead] = 0;
 
-    ok(dwBytesRead == 13,"Read %u bytes instead of 13\n",dwBytesRead);
+    ok(dwBytesRead == 13,"Read %lu bytes instead of 13\n",dwBytesRead);
     ok(strncmp(szBuffer,"mode => Test\n",dwBytesRead)==0 || broken(proxy_active()),"Got string %s\n",szBuffer);
 
     ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
@@ -1414,16 +1414,16 @@ static void InternetOpenRequest_test(void)
     connect = InternetConnectA(session, NULL, INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
                               INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect == NULL, "InternetConnectA should have failed\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with NULL server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with NULL server named should have failed with ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
 
     connect = InternetConnectA(session, "", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
                               INTERNET_SERVICE_HTTP, 0, 0);
     ok(connect == NULL, "InternetConnectA should have failed\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with blank server named should have failed with ERROR_INVALID_PARAMETER instead of %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "InternetConnectA with blank server named should have failed with ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
 
     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());
+    ok(connect != NULL, "Unable to connect to http://test.winehq.org with error %ld\n", GetLastError());
 
     request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, types, INTERNET_FLAG_NO_CACHE_WRITE, 0);
     if (!request && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
@@ -1431,17 +1431,17 @@ static void InternetOpenRequest_test(void)
         skip( "Network unreachable, skipping test\n" );
         goto done;
     }
-    ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
+    ok(request != NULL, "Failed to open request handle err %lu\n", GetLastError());
 
     ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\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());
+    ok(request != NULL, "Failed to open request handle err %lu\n", GetLastError());
 
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
 done:
@@ -1481,7 +1481,7 @@ static void test_cache_read(void)
     yesterday.dwLowDateTime = li.u.LowPart;
 
     res = CreateUrlCacheEntryA(cache_only_url, sizeof(content), "", file_path, 0);
-    ok(res, "CreateUrlCacheEntryA failed: %u\n", GetLastError());
+    ok(res, "CreateUrlCacheEntryA failed: %lu\n", GetLastError());
 
     file = CreateFileA(file_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
     ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
@@ -1491,22 +1491,22 @@ static void test_cache_read(void)
 
     res = CommitUrlCacheEntryA(cache_only_url, file_path, tomorrow, yesterday, NORMAL_CACHE_ENTRY,
                                cache_headers, sizeof(cache_headers)-1, "", 0);
-    ok(res, "CommitUrlCacheEntryA failed: %u\n", GetLastError());
+    ok(res, "CommitUrlCacheEntryA failed: %lu\n", GetLastError());
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(session != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     pInternetSetStatusCallbackA(session, callback);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     connection = InternetConnectA(session, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT,
             NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok(connection != NULL,"InternetConnect failed with error %u\n", GetLastError());
+    ok(connection != NULL,"InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req = HttpOpenRequestA(connection, "GET", "/tests/cache-only", NULL, NULL, NULL, 0, 0xdeadbead);
-    ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_WINE_ALLOW(INTERNET_STATUS_CONNECTING_TO_SERVER);
@@ -1519,18 +1519,18 @@ static void test_cache_read(void)
 
     res = HttpSendRequestA(req, NULL, -1, NULL, 0);
     todo_wine
-    ok(res, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(res, "HttpSendRequest failed: %lu\n", GetLastError());
 
     if(res) {
         size = 0;
         res = InternetQueryDataAvailable(req, &size, 0, 0);
-        ok(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-        ok(size  == sizeof(content), "size = %u\n", size);
+        ok(res, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+        ok(size  == sizeof(content), "size = %lu\n", size);
 
         size = sizeof(buf);
         res = InternetReadFile(req, buf, sizeof(buf), &size);
-        ok(res, "InternetReadFile failed: %u\n", GetLastError());
-        ok(size == sizeof(content), "size = %u\n", size);
+        ok(res, "InternetReadFile failed: %lu\n", GetLastError());
+        ok(size == sizeof(content), "size = %lu\n", size);
         ok(!memcmp(content, buf, sizeof(content)), "unexpected content\n");
     }
 
@@ -1545,7 +1545,7 @@ static void test_cache_read(void)
     CLEAR_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
 
     res = DeleteUrlCacheEntryA(cache_only_url);
-    ok(res, "DeleteUrlCacheEntryA failed: %u\n", GetLastError());
+    ok(res, "DeleteUrlCacheEntryA failed: %lu\n", GetLastError());
 }
 
 static void test_http_cache(void)
@@ -1566,7 +1566,7 @@ static void test_http_cache(void)
 
     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());
+    ok(connect != NULL, "Unable to connect to http://test.winehq.org with error %ld\n", GetLastError());
 
     request = HttpOpenRequestA(connect, NULL, "/tests/hello.html", NULL, NULL, types, INTERNET_FLAG_NEED_FILE, 0);
     if (!request && GetLastError() == ERROR_INTERNET_NAME_NOT_RESOLVED)
@@ -1578,53 +1578,53 @@ static void test_http_cache(void)
 
         return;
     }
-    ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
+    ok(request != NULL, "Failed to open request handle err %lu\n", GetLastError());
 
     size = sizeof(url);
     ret = InternetQueryOptionA(request, INTERNET_OPTION_URL, url, &size);
-    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
+    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %lu\n", GetLastError());
     ok(!strcmp(url, "http://test.winehq.org/tests/hello.html"), "Wrong URL %s\n", url);
 
     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);
+    ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%lu\n", GetLastError());
+    ok(!size, "size = %ld\n", size);
 
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\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());
+    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %lu\n", GetLastError());
 
     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());
+    ok(file != INVALID_HANDLE_VALUE, "Could not create file: %lu\n", GetLastError());
     file_size = GetFileSize(file, NULL);
-    ok(file_size == 106, "file size = %u\n", file_size);
+    ok(file_size == 106, "file size = %lu\n", file_size);
 
     size = sizeof(buf);
     ret = InternetReadFile(request, buf, sizeof(buf), &size);
-    ok(ret, "InternetReadFile failed: %u\n", GetLastError());
-    ok(size == 100, "size = %u\n", size);
+    ok(ret, "InternetReadFile failed: %lu\n", GetLastError());
+    ok(size == 100, "size = %lu\n", size);
 
     file_size = GetFileSize(file, NULL);
-    ok(file_size == 106, "file size = %u\n", file_size);
+    ok(file_size == 106, "file size = %lu\n", file_size);
     CloseHandle(file);
 
     ret = DeleteFileA(file_name);
-    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%lu)\n", ret, GetLastError());
 
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
     file = CreateFileA(file_name, GENERIC_WRITE, 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());
+    ok(file != INVALID_HANDLE_VALUE, "Could not create file: %lu\n", GetLastError());
     ret = WriteFile(file, cached_content, sizeof(cached_content), &size, NULL);
-    ok(ret && size, "WriteFile failed: %d, %d\n", ret, size);
+    ok(ret && size, "WriteFile failed: %d, %ld\n", ret, size);
     ret = CommitUrlCacheEntryA(url, file_name, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0);
-    ok(ret, "CommitUrlCacheEntry failed: %d\n", GetLastError());
+    ok(ret, "CommitUrlCacheEntry failed: %ld\n", GetLastError());
     CloseHandle(file);
 
     /* Send the same request, requiring it to be retrieved from the cache */
@@ -1635,8 +1635,8 @@ static void test_http_cache(void)
 
     size = sizeof(buf);
     ret = InternetReadFile(request, buf, sizeof(buf), &size);
-    ok(ret, "InternetReadFile failed: %u\n", GetLastError());
-    ok(size == 100, "size = %u\n", size);
+    ok(ret, "InternetReadFile failed: %lu\n", GetLastError());
+    ok(size == 100, "size = %lu\n", size);
     buf[99] = 0;
     todo_wine ok(!strcmp((char*)buf, cached_content), "incorrect page data: %s\n", (char*)buf);
 
@@ -1647,20 +1647,20 @@ static void test_http_cache(void)
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
     todo_wine ok(!ret, "HttpSendRequest succeeded\n");
     if(!ret)
-        ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() = %d\n", GetLastError());
+        ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError() = %ld\n", GetLastError());
     ok(InternetCloseHandle(request), "Close request handle failed\n");
 
     request = HttpOpenRequestA(connect, NULL, "/", NULL, NULL, types, INTERNET_FLAG_NO_CACHE_WRITE, 0);
-    ok(request != NULL, "Failed to open request handle err %u\n", GetLastError());
+    ok(request != NULL, "Failed to open request handle err %lu\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);
+    ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%lu\n", GetLastError());
+    ok(!size, "size = %ld\n", size);
 
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
     size = sizeof(file_name);
     file_name[0] = 0;
@@ -1669,7 +1669,7 @@ static void test_http_cache(void)
     {
         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());
+        ok(file != INVALID_HANDLE_VALUE, "Could not create file: %lu\n", GetLastError());
         CloseHandle(file);
     }
     else
@@ -1698,44 +1698,44 @@ static void InternetLockRequestFile_test(void)
     size = sizeof(file_name);
     ret = InternetQueryOptionA(req.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);
+    ok(GetLastError() == ERROR_INTERNET_ITEM_NOT_FOUND, "GetLastError()=%lu\n", GetLastError());
+    ok(!size, "size = %ld\n", size);
 
     lock = NULL;
     ret = InternetLockRequestFile(req.request, &lock);
-    ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, "InternetLockRequestFile returned: %x(%lu)\n", ret, GetLastError());
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
     size = sizeof(file_name);
     ret = InternetQueryOptionA(req.request, INTERNET_OPTION_DATAFILE_NAME, file_name, &size);
-    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %u\n", GetLastError());
+    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %lu\n", GetLastError());
 
     ret = InternetLockRequestFile(req.request, &lock);
-    ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+    ok(ret, "InternetLockRequestFile returned: %x(%lu)\n", ret, GetLastError());
     ok(lock != NULL, "lock == NULL\n");
 
     ret = InternetLockRequestFile(req.request, &lock2);
-    ok(ret, "InternetLockRequestFile returned: %x(%u)\n", ret, GetLastError());
+    ok(ret, "InternetLockRequestFile returned: %x(%lu)\n", ret, GetLastError());
     ok(lock == lock2, "lock != lock2\n");
 
     ret = InternetUnlockRequestFile(lock2);
-    ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
+    ok(ret, "InternetUnlockRequestFile failed: %lu\n", GetLastError());
 
     ret = DeleteFileA(file_name);
-    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%lu)\n", ret, GetLastError());
 
     ok(InternetCloseHandle(req.request), "Close request handle failed\n");
 
     ret = DeleteFileA(file_name);
-    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, "Deleting file returned %x(%lu)\n", ret, GetLastError());
 
     ret = InternetUnlockRequestFile(lock);
-    ok(ret, "InternetUnlockRequestFile failed: %u\n", GetLastError());
+    ok(ret, "InternetUnlockRequestFile failed: %lu\n", GetLastError());
 
     ret = DeleteFileA(file_name);
-    ok(ret, "Deleting file returned %x(%u)\n", ret, GetLastError());
+    ok(ret, "Deleting file returned %x(%lu)\n", ret, GetLastError());
 }
 
 static void HttpHeaders_test(void)
@@ -1782,7 +1782,7 @@ static void HttpHeaders_test(void)
                 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);
-    ok(len == 5, "Invalid length (exp. 5, got %d)\n", len);
+    ok(len == 5, "Invalid length (exp. 5, got %ld)\n", len);
     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");
@@ -1794,10 +1794,10 @@ static void HttpHeaders_test(void)
     strcpy(buffer,"Warning");
     ok(HttpQueryInfoA(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index) == FALSE,"Query succeeded on a too small buffer\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
     ok(index == 0, "Index was incremented\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 */
+    ok(len == 6, "Invalid length (exp. 6, got %ld)\n", len); /* unlike success, the length includes the NULL-terminator */
 
     /* a call with NULL will fail but will return the length */
     index = 0;
@@ -1805,8 +1805,8 @@ static void HttpHeaders_test(void)
     SetLastError(0xdeadbeef);
     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);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(len > 40, "Invalid length (exp. more than 40, got %ld)\n", len);
     ok(index == 0, "Index was incremented\n");
 
     /* even for a len that is too small */
@@ -1815,8 +1815,8 @@ static void HttpHeaders_test(void)
     SetLastError(0xdeadbeef);
     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);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(len > 40, "Invalid length (exp. more than 40, got %ld)\n", len);
     ok(index == 0, "Index was incremented\n");
 
     index = 0;
@@ -1824,8 +1824,8 @@ static void HttpHeaders_test(void)
     SetLastError(0xdeadbeef);
     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);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(len > 40, "Invalid length (exp. more than 40, got %ld)\n", len);
     ok(index == 0, "Index was incremented\n");
     oldlen = len;   /* bytes; at least long enough to hold buffer & nul */
 
@@ -1851,8 +1851,8 @@ static void HttpHeaders_test(void)
     SetLastError(0xdeadbeef);
     ok(HttpQueryInfoW(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 > 80, "Invalid length (exp. more than 80, got %d)\n", len);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected last error: %ld\n", GetLastError());
+    ok(len > 80, "Invalid length (exp. more than 80, got %ld)\n", len);
     ok(index == 0, "Index was incremented\n");
     oldlen = len;   /* bytes; at least long enough to hold buffer & nul */
 
@@ -1875,7 +1875,7 @@ static void HttpHeaders_test(void)
     memset(buffer, 'x', sizeof(buffer));
     ok(HttpQueryInfoA(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF,
                 buffer,&len,&index) == TRUE,"Query failed\n");
-    ok(len == 2 || len == 4 /* win10 */, "Expected 2 or 4, got %d\n", len);
+    ok(len == 2 || len == 4 /* win10 */, "Expected 2 or 4, got %ld\n", len);
     ok(memcmp(buffer, "\r\n\r\n", len) == 0, "Expected CRLF, got '%s'\n", buffer);
     ok(index == 0, "Index was incremented\n");
 
@@ -2043,25 +2043,25 @@ static void HttpHeaders_test(void)
     ok(strcmp(buffer,"value3")==0, "incorrect string was returned(%s)\n",buffer);
 
     ret = HttpAddRequestHeadersA(hRequest, "Authorization: Basic\r\n", -1, HTTP_ADDREQ_FLAG_ADD);
-    ok(ret, "unable to add header %u\n", GetLastError());
+    ok(ret, "unable to add header %lu\n", GetLastError());
 
     index = 0;
     buffer[0] = 0;
     len = sizeof(buffer);
     ret = HttpQueryInfoA(hRequest, HTTP_QUERY_AUTHORIZATION|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, &index);
-    ok(ret, "unable to query header %u\n", GetLastError());
+    ok(ret, "unable to query header %lu\n", GetLastError());
     ok(index == 1, "index was not incremented\n");
     ok(!strcmp(buffer, "Basic"), "incorrect string was returned (%s)\n", buffer);
 
     ret = HttpAddRequestHeadersA(hRequest, "Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE);
-    ok(ret, "unable to remove header %u\n", GetLastError());
+    ok(ret, "unable to remove header %lu\n", GetLastError());
 
     index = 0;
     len = sizeof(buffer);
     SetLastError(0xdeadbeef);
     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());
+    ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "got %lu\n", GetLastError());
 
     ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
 done:
@@ -2585,14 +2585,14 @@ static void test_basic_request(int port, const char *verb, const char *url)
     SetLastError(0xdeadbeef);
     r = HttpSendRequestA(req.request, 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: %u\n", GetLastError());
+    ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %lu\n", error);
+    ok(r, "HttpSendRequest failed: %lu\n", GetLastError());
 
     count = 0;
     memset(buffer, 0, sizeof buffer);
     SetLastError(0xdeadbeef);
     r = InternetReadFile(req.request, buffer, sizeof buffer, &count);
-    ok(r, "InternetReadFile failed %u\n", GetLastError());
+    ok(r, "InternetReadFile failed %lu\n", GetLastError());
     ok(count == sizeof page1 - 1, "count was wrong\n");
     ok(!memcmp(buffer, page1, sizeof page1), "http data wrong, got: %s\n", buffer);
 
@@ -2608,11 +2608,11 @@ static void test_proxy_indirect(int port)
     open_simple_request(&req, "localhost", port, NULL, "/test2");
 
     r = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(r, "HttpSendRequest failed %u\n", GetLastError());
+    ok(r, "HttpSendRequest failed %lu\n", GetLastError());
 
     sz = sizeof buffer;
     r = HttpQueryInfoA(req.request, HTTP_QUERY_PROXY_AUTHENTICATE, buffer, &sz, NULL);
-    ok(r || GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo failed: %d\n", GetLastError());
+    ok(r || GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfo failed: %ld\n", GetLastError());
     if (!r)
     {
         skip("missing proxy header, not testing remaining proxy headers\n");
@@ -2666,7 +2666,7 @@ static void test_proxy_direct(int port)
     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);
+        broken(error == ERROR_SUCCESS) /* WinXPProSP2 */, "got %lu\n", error);
     ok(hi == NULL || broken(!!hi) /* WinXPProSP2 */, "open should have failed\n");
 
     sprintf(buffer, "localhost:%d\n", port);
@@ -2683,70 +2683,70 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, NULL, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == 1, "got %u\n", sz);
+    ok(sz == 1, "got %lu\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, NULL, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == 1, "got %u\n", sz);
+    ok(sz == 1, "got %lu\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
-    ok(r, "unexpected failure %u\n", GetLastError());
-    ok(!sz, "got %u\n", sz);
+    ok(r, "unexpected failure %lu\n", GetLastError());
+    ok(!sz, "got %lu\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
-    ok(r, "unexpected failure %u\n", GetLastError());
-    ok(!sz, "got %u\n", sz);
+    ok(r, "unexpected failure %lu\n", GetLastError());
+    ok(!sz, "got %lu\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, NULL, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == 1, "got %u\n", sz);
+    ok(sz == 1, "got %lu\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, NULL, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == 1, "got %u\n", sz);
+    ok(sz == 1, "got %lu\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
-    ok(r, "unexpected failure %u\n", GetLastError());
-    ok(!sz, "got %u\n", sz);
+    ok(r, "unexpected failure %lu\n", GetLastError());
+    ok(!sz, "got %lu\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
-    ok(r, "unexpected failure %u\n", GetLastError());
-    ok(!sz, "got %u\n", sz);
+    ok(r, "unexpected failure %lu\n", GetLastError());
+    ok(!sz, "got %lu\n", sz);
 
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, NULL, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == 34, "got %u\n", sz);
+    ok(sz == 34, "got %lu\n", sz);
 
     sz = sizeof(buffer);
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, buffer, &sz);
-    ok(r, "unexpected failure %u\n", GetLastError());
-    ok(sz == 33, "got %u\n", sz);
+    ok(r, "unexpected failure %lu\n", GetLastError());
+    ok(sz == 33, "got %lu\n", sz);
 
     r = HttpSendRequestW(hr, NULL, 0, NULL, 0);
-    ok(r || broken(!r), "HttpSendRequest failed %u\n", GetLastError());
+    ok(r || broken(!r), "HttpSendRequest failed %lu\n", GetLastError());
     if (!r)
     {
         win_skip("skipping proxy tests on broken wininet\n");
@@ -2769,39 +2769,39 @@ static void test_proxy_direct(int port)
     sz = 3;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
-    ok(!r, "unexpected failure %u\n", GetLastError());
+    ok(!r, "unexpected failure %lu\n", GetLastError());
     ok(!buffer[0], "got %s\n", buffer);
-    ok(sz == strlen(username) + 1, "got %u\n", sz);
+    ok(sz == strlen(username) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(username) + 1, "got %u\n", sz);
+    ok(sz == strlen(username) + 1, "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PROXY_USERNAME, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (lstrlenW(usernameW) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (lstrlenW(usernameW) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(username), "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PROXY_USERNAME, bufferW, &sz);
     ok(r, "failed to get username\n");
     ok(!lstrcmpW(bufferW, usernameW), "wrong username\n");
-    ok(sz == lstrlenW(usernameW), "got %u\n", sz);
+    ok(sz == lstrlenW(usernameW), "got %lu\n", sz);
 
     r = InternetSetOptionA(hr, INTERNET_OPTION_PROXY_USERNAME, username, 1);
     ok(r, "failed to set user\n");
@@ -2811,7 +2811,7 @@ static void test_proxy_direct(int port)
     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);
+    ok(sz == strlen(username), "got %lu\n", sz);
 
     r = InternetSetOptionA(hi, INTERNET_OPTION_USER_AGENT, useragent, 1);
     ok(r, "failed to set useragent\n");
@@ -2820,31 +2820,31 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hi, INTERNET_OPTION_USER_AGENT, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(useragent) + 1, "got %u\n", sz);
+    ok(sz == strlen(useragent) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(useragent), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hi, INTERNET_OPTION_USER_AGENT, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (lstrlenW(useragentW) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (lstrlenW(useragentW) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hi, INTERNET_OPTION_USER_AGENT, bufferW, &sz);
     ok(r, "failed to get user agent\n");
     ok(!lstrcmpW(bufferW, useragentW), "wrong user agent\n");
-    ok(sz == lstrlenW(useragentW), "got %u\n", sz);
+    ok(sz == lstrlenW(useragentW), "got %lu\n", sz);
 
     r = InternetSetOptionA(hr, INTERNET_OPTION_USERNAME, username, 1);
     ok(r, "failed to set user\n");
@@ -2853,31 +2853,31 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_USERNAME, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(username) + 1, "got %u\n", sz);
+    ok(sz == strlen(username) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(username), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_USERNAME, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (lstrlenW(usernameW) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (lstrlenW(usernameW) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_USERNAME, bufferW, &sz);
     ok(r, "failed to get user\n");
     ok(!lstrcmpW(bufferW, usernameW), "wrong user\n");
-    ok(sz == lstrlenW(usernameW), "got %u\n", sz);
+    ok(sz == lstrlenW(usernameW), "got %lu\n", sz);
 
     r = InternetSetOptionA(hr, INTERNET_OPTION_PASSWORD, password, 1);
     ok(r, "failed to set password\n");
@@ -2886,31 +2886,31 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PASSWORD, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(password) + 1, "got %u\n", sz);
+    ok(sz == strlen(password) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(password), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PASSWORD, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (lstrlenW(passwordW) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (lstrlenW(passwordW) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PASSWORD, bufferW, &sz);
     ok(r, "failed to get password\n");
     ok(!lstrcmpW(bufferW, passwordW), "wrong password\n");
-    ok(sz == lstrlenW(passwordW), "got %u\n", sz);
+    ok(sz == lstrlenW(passwordW), "got %lu\n", sz);
 
     url = HeapAlloc(GetProcessHeap(), 0, strlen(url_fmt) + 11);
     sprintf(url, url_fmt, port);
@@ -2918,31 +2918,31 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_URL, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(url) + 1, "got %u\n", sz);
+    ok(sz == strlen(url) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(url), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_URL, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (strlen(url) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (strlen(url) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_URL, bufferW, &sz);
     ok(r, "failed to get url\n");
     ok(!strcmp_wa(bufferW, url), "wrong url\n");
-    ok(sz == strlen(url), "got %u\n", sz);
+    ok(sz == strlen(url), "got %lu\n", sz);
     HeapFree(GetProcessHeap(), 0, url);
 
     r = InternetSetOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, password, 4);
@@ -2952,31 +2952,31 @@ static void test_proxy_direct(int port)
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionA(hr, INTERNET_OPTION_PROXY_PASSWORD, buffer, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == strlen(password) + 1, "got %u\n", sz);
+    ok(sz == strlen(password) + 1, "got %lu\n", sz);
 
     buffer[0] = 0;
     sz = sizeof(buffer);
     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);
+    ok(sz == strlen(password), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = 0;
     SetLastError(0xdeadbeef);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PROXY_PASSWORD, bufferW, &sz);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %lu\n", GetLastError());
     ok(!r, "unexpected success\n");
-    ok(sz == (lstrlenW(passwordW) + 1) * sizeof(WCHAR), "got %u\n", sz);
+    ok(sz == (lstrlenW(passwordW) + 1) * sizeof(WCHAR), "got %lu\n", sz);
 
     bufferW[0] = 0;
     sz = sizeof(bufferW);
     r = InternetQueryOptionW(hr, INTERNET_OPTION_PROXY_PASSWORD, bufferW, &sz);
     ok(r, "failed to get password\n");
     ok(!lstrcmpW(bufferW, passwordW), "wrong password\n");
-    ok(sz == lstrlenW(passwordW), "got %u\n", sz);
+    ok(sz == lstrlenW(passwordW), "got %lu\n", sz);
 
     r = HttpSendRequestW(hr, NULL, 0, NULL, 0);
     if (!r)
@@ -2984,7 +2984,7 @@ static void test_proxy_direct(int port)
         win_skip("skipping proxy tests on broken wininet\n");
         goto done;
     }
-    ok(r, "HttpSendRequest failed %u\n", GetLastError());
+    ok(r, "HttpSendRequest failed %lu\n", GetLastError());
     sz = sizeof buffer;
     r = HttpQueryInfoA(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
     ok(r, "HttpQueryInfo failed\n");
@@ -3005,7 +3005,7 @@ static void test_proxy_direct(int port)
     ok(hr != NULL, "HttpOpenRequest failed\n");
 
     r = HttpSendRequestA(hr, NULL, 0, (char *)"data", sizeof("data"));
-    ok(r, "HttpSendRequest failed %u\n", GetLastError());
+    ok(r, "HttpSendRequest failed %lu\n", GetLastError());
 
     test_status_code(hr, 407);
 
@@ -3055,7 +3055,7 @@ static void test_header_handling_order(int port)
     size = sizeof(status);
     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);
+    ok(status == 200 || status == 400 /* IE6 */, "got status %lu, expected 200 or 400\n", status);
 
     InternetCloseHandle(request);
     InternetCloseHandle(connect);
@@ -3076,7 +3076,7 @@ static void test_header_handling_order(int port)
     size = sizeof(status);
     ret = HttpQueryInfoA( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
     ok(ret, "HttpQueryInfo failed\n");
-    ok(status == 200, "got status %u, expected 200\n", status);
+    ok(status == 200, "got status %lu, expected 200\n", status);
 
     InternetCloseHandle(request);
     InternetCloseHandle(connect);
@@ -3093,13 +3093,13 @@ static void test_header_handling_order(int port)
     data_len = sizeof(data);
     memset(data, 'a', sizeof(data));
     ret = HttpSendRequestA(request, NULL, 0, data, data_len);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
     status = 0;
     size = sizeof(status);
     ret = HttpQueryInfoA( request, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
     ok(ret, "HttpQueryInfo failed\n");
-    ok(status == 200, "got status %u, expected 200\n", status);
+    ok(status == 200, "got status %lu, expected 200\n", status);
 
     InternetCloseHandle(request);
     InternetCloseHandle(connect);
@@ -3185,7 +3185,7 @@ static void test_header_override(int port)
     ret = HttpQueryInfoA(req, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, &count);
     err = GetLastError();
     ok(!ret, "HttpQueryInfo succeeded\n");
-    ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d\n", err);
+    ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %ld\n", err);
 
     test_request_url(req, full_url);
 
@@ -3248,7 +3248,7 @@ static void test_header_override(int port)
         trace("replacing host header is not supported.\n");
 
         err = GetLastError();
-        ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %d\n", err);
+        ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "Expected error ERROR_HTTP_HEADER_NOT_FOUND, got %ld\n", err);
 
         ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
         ok(ret, "HttpSendRequest failed\n");
@@ -3269,18 +3269,18 @@ static void test_connection_closing(int port)
     reset_events();
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(session != NULL,"InternetOpen failed with error %lu\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());
+    ok(connection != NULL,"InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req = HttpOpenRequestA(connection, "GET", "/testJ", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0xdeadbeaf);
-    ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
@@ -3299,7 +3299,7 @@ static void test_connection_closing(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -3329,7 +3329,7 @@ static void test_connection_closing(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -3359,7 +3359,7 @@ static void test_connection_closing(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -3389,18 +3389,18 @@ static void test_successive_HttpSendRequest(int port)
     reset_events();
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(session != NULL,"InternetOpen failed with error %lu\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());
+    ok(connection != NULL,"InternetConnect failed with error %lu\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());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
@@ -3417,7 +3417,7 @@ static void test_successive_HttpSendRequest(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
             "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -3445,7 +3445,7 @@ static void test_successive_HttpSendRequest(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
@@ -3475,20 +3475,20 @@ static void test_no_content(int port)
     reset_events();
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(session != NULL,"InternetOpen failed with error %lu\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());
+    ok(connection != NULL,"InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req = HttpOpenRequestA(connection, "GET", "/test_no_content", NULL, NULL, NULL,
             INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RESYNCHRONIZE, 0xdeadbead);
-    ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
@@ -3506,7 +3506,7 @@ static void test_no_content(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
@@ -3544,13 +3544,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 304);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(!avail, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(!avail, "got %ld\n", avail);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, NULL, "/test_not_modified_content_length", NULL, NULL, NULL, 0, 0);
@@ -3558,13 +3558,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 304);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(avail == 10, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(avail == 10, "got %ld\n", avail);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, NULL, "/test_no_content", NULL, NULL, NULL, 0, 0);
@@ -3572,13 +3572,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 204);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(!avail, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(!avail, "got %ld\n", avail);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, NULL, "/test_no_content_content_length", NULL, NULL, NULL, 0, 0);
@@ -3586,13 +3586,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 204);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(avail == 10, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(avail == 10, "got %ld\n", avail);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, "HEAD", "/head", NULL, NULL, NULL, 0, 0);
@@ -3600,13 +3600,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 200);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(!avail, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(!avail, "got %ld\n", avail);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, "HEAD", "/head_content_length", NULL, NULL, NULL, 0, 0);
@@ -3614,13 +3614,13 @@ static void test_not_modified(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 200);
 
     avail = 0xdeadbeef;
     ret = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(ret, "InternetQueryDataAvailable failed: %u\n", GetLastError());
-    ok(!avail, "got %d\n", avail);
+    ok(ret, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
+    ok(!avail, "got %ld\n", avail);
 
     InternetCloseHandle(req);
     InternetCloseHandle(con);
@@ -3645,7 +3645,7 @@ static void test_large_header(int port)
 
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req, 200);
 
     index = 0;
@@ -3654,8 +3654,8 @@ static void test_large_header(int port)
     ret = HttpQueryInfoA(req, HTTP_QUERY_CUSTOM, buffer, &size, &index);
     error = GetLastError();
     ok(!ret, "HttpQueryInfoA succeeded\n");
-    ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %u\n", error);
-    ok(size == 4001, "got %u\n", size);
+    ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %lu\n", error);
+    ok(size == 4001, "got %lu\n", size);
 
     InternetCloseHandle(req);
     InternetCloseHandle(con);
@@ -3673,20 +3673,20 @@ static void test_conn_close(int port)
     reset_events();
 
     session = InternetOpenA("", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(session != NULL,"InternetOpen failed with error %lu\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());
+    ok(connection != NULL,"InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req = HttpOpenRequestA(connection, "GET", "/test_conn_close", NULL, NULL, NULL,
             INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RESYNCHRONIZE, 0xdeadbead);
-    ok(req != NULL, "HttpOpenRequest failed: %u\n", GetLastError());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
@@ -3702,7 +3702,7 @@ static void test_conn_close(int port)
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_COOKIE_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
@@ -3715,12 +3715,12 @@ static void test_conn_close(int port)
 
     avail = 0;
     res = InternetQueryDataAvailable(req, &avail, 0, 0);
-    ok(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
+    ok(res, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
     ok(avail != 0, "avail = 0\n");
 
     size = 0;
     res = InternetReadFile(req, buf, avail, &size);
-    ok(res, "InternetReadFile failed: %u\n", GetLastError());
+    ok(res, "InternetReadFile failed: %lu\n", GetLastError());
 
     /* IE11 calls those in InternetQueryDataAvailable call. */
     SET_OPTIONAL(INTERNET_STATUS_RECEIVING_RESPONSE);
@@ -3729,7 +3729,7 @@ static void test_conn_close(int port)
     res = InternetQueryDataAvailable(req, &avail, 0, 0);
     ok(!res && (GetLastError() == ERROR_IO_PENDING),
        "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
-    ok(!avail, "avail = %u, expected 0\n", avail);
+    ok(!avail, "avail = %lu, expected 0\n", avail);
 
     CLEAR_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
 
@@ -3738,7 +3738,7 @@ static void test_conn_close(int port)
     SET_EXPECT(INTERNET_STATUS_REQUEST_COMPLETE);
     SetEvent(conn_close_event);
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %lu\n", req_error);
     CLEAR_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
     CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
@@ -3761,10 +3761,10 @@ static void test_no_cache(int port)
     trace("Testing no-cache header\n");
 
     ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(ses != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(con != NULL, "InternetConnect failed with error %lu\n", GetLastError());
 
     req = HttpOpenRequestA(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
@@ -3773,22 +3773,22 @@ static void test_no_cache(int port)
     DeleteUrlCacheEntryA(cache_url);
 
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
         size += read;
-    ok(size == 12, "read %d bytes of data\n", size);
+    ok(size == 12, "read %ld bytes of data\n", size);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, NULL, cache_control_no_cache, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
         size += read;
-    ok(size == 0, "read %d bytes of data\n", size);
+    ok(size == 0, "read %ld bytes of data\n", size);
     InternetCloseHandle(req);
     DeleteUrlCacheEntryA(cache_url);
 
@@ -3799,11 +3799,11 @@ static void test_no_cache(int port)
     DeleteUrlCacheEntryA(cache_url);
 
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf, sizeof(buf), &read) && read)
         size += read;
-    ok(size == 12, "read %d bytes of data\n", size);
+    ok(size == 12, "read %ld bytes of data\n", size);
     InternetCloseHandle(req);
 
     ret = DeleteUrlCacheEntryA(cache_url);
@@ -3829,10 +3829,10 @@ static void test_cache_read_gzipped(int port)
     trace("Testing reading compressed content from cache\n");
 
     ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(ses != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(con != NULL, "InternetConnect failed with error %lu\n", GetLastError());
 
     req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
@@ -3846,26 +3846,26 @@ static void test_cache_read_gzipped(int port)
         InternetCloseHandle(ses);
         return;
     }
-    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n", GetLastError());
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-size, &read) && read)
         size += read;
-    ok(size == 10, "read %d bytes of data\n", size);
+    ok(size == 10, "read %ld bytes of data\n", size);
     buf[size] = 0;
     ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
 
     size = sizeof(buf)-1;
     ret = HttpQueryInfoA(req, HTTP_QUERY_CONTENT_TYPE, buf, &size, 0);
-    ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %d\n", GetLastError());
+    ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %ld\n", GetLastError());
     buf[size] = 0;
     ok(!strncmp(text_html, buf, size), "buf = %s\n", buf);
 
     size = sizeof(buf)-1;
     ret = HttpQueryInfoA(req, HTTP_QUERY_RAW_HEADERS_CRLF, buf, &size, 0);
-    ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %d\n", GetLastError());
+    ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %ld\n", GetLastError());
     buf[size] = 0;
     ok(!strncmp(raw_header, buf, size), "buf = %s\n", buf);
     InternetCloseHandle(req);
@@ -3875,26 +3875,26 @@ static void test_cache_read_gzipped(int port)
 
     ret = TRUE;
     ret = InternetSetOptionA(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
-    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n", GetLastError());
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
         size += read;
-    todo_wine ok(size == 10, "read %d bytes of data\n", size);
+    todo_wine ok(size == 10, "read %ld bytes of data\n", size);
     buf[size] = 0;
     ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
 
     size = sizeof(buf);
     ret = HttpQueryInfoA(req, HTTP_QUERY_CONTENT_ENCODING, buf, &size, 0);
     ok(!ret && GetLastError()==ERROR_HTTP_HEADER_NOT_FOUND,
-            "HttpQueryInfo(HTTP_QUERY_CONTENT_ENCODING) returned %d, %d\n",
+            "HttpQueryInfo(HTTP_QUERY_CONTENT_ENCODING) returned %d, %ld\n",
             ret, GetLastError());
 
     size = sizeof(buf)-1;
     ret = HttpQueryInfoA(req, HTTP_QUERY_CONTENT_TYPE, buf, &size, 0);
-    todo_wine ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %d\n", GetLastError());
+    todo_wine ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %ld\n", GetLastError());
     buf[size] = 0;
     todo_wine ok(!strncmp(text_html, buf, size), "buf = %s\n", buf);
     InternetCloseHandle(req);
@@ -3908,11 +3908,11 @@ static void test_cache_read_gzipped(int port)
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
         size += read;
-    ok(size == 31, "read %d bytes of data\n", size);
+    ok(size == 31, "read %ld bytes of data\n", size);
     InternetCloseHandle(req);
 
     req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, INTERNET_FLAG_FROM_CACHE, 0);
@@ -3920,18 +3920,18 @@ static void test_cache_read_gzipped(int port)
 
     ret = TRUE;
     ret = InternetSetOptionA(req, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
-    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n", GetLastError());
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
         size += read;
-    todo_wine ok(size == 31, "read %d bytes of data\n", size);
+    todo_wine ok(size == 31, "read %ld bytes of data\n", size);
 
     size = sizeof(buf);
     ret = HttpQueryInfoA(req, HTTP_QUERY_CONTENT_ENCODING, buf, &size, 0);
-    todo_wine ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_ENCODING) failed: %d\n", GetLastError());
+    todo_wine ok(ret, "HttpQueryInfo(HTTP_QUERY_CONTENT_ENCODING) failed: %ld\n", GetLastError());
     InternetCloseHandle(req);
 
     InternetCloseHandle(con);
@@ -3943,24 +3943,24 @@ static void test_cache_read_gzipped(int port)
     DeleteUrlCacheEntryA(cache_url);
 
     ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(ses != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     ret = TRUE;
     ret = InternetSetOptionA(ses, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
-    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n", GetLastError());
 
     con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(con != NULL, "InternetConnect failed with error %lu\n", GetLastError());
 
     req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
         size += read;
-    ok(size == 10, "read %d bytes of data\n", size);
+    ok(size == 10, "read %ld bytes of data\n", size);
     buf[size] = 0;
     ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
     InternetCloseHandle(req);
@@ -3974,24 +3974,24 @@ static void test_cache_read_gzipped(int port)
     DeleteUrlCacheEntryA(cache_url);
 
     ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(ses != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(con != NULL, "InternetConnect failed with error %lu\n", GetLastError());
 
     ret = TRUE;
     ret = InternetSetOptionA(con, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
-    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n", GetLastError());
 
     req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
     size = 0;
     while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
         size += read;
-    ok(size == 10, "read %d bytes of data\n", size);
+    ok(size == 10, "read %ld bytes of data\n", size);
     buf[size] = 0;
     ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
     InternetCloseHandle(req);
@@ -4025,7 +4025,7 @@ static void test_HttpSendRequestW(int port)
     ok(error == ERROR_IO_PENDING ||
        broken(error == ERROR_HTTP_HEADER_NOT_FOUND) ||  /* IE6 */
        broken(error == ERROR_INVALID_PARAMETER),        /* IE5 */
-       "got %u expected ERROR_IO_PENDING\n", error);
+       "got %lu expected ERROR_IO_PENDING\n", error);
 
     InternetCloseHandle(req);
     InternetCloseHandle(con);
@@ -4056,26 +4056,26 @@ static void test_cookie_header(int port)
     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);
+    ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %lu expected ERROR_HTTP_HEADER_NOT_FOUND\n", error);
 
     ret = HttpAddRequestHeadersA(req, "Cookie: cookie=not biscuit\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD);
-    ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError());
+    ok(ret, "HttpAddRequestHeaders failed: %lu\n", GetLastError());
 
     buffer[0] = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed: %lu\n", GetLastError());
     ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
 
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
     test_status_code(req, 200);
 
     buffer[0] = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed: %lu\n", GetLastError());
     ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer);
 
     InternetCloseHandle(req);
@@ -4098,7 +4098,7 @@ static void test_basic_authentication(int port)
     ok(request != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
 
     test_status_code(request, 200);
     test_request_flags(request, 0);
@@ -4120,7 +4120,7 @@ static void test_premature_disconnect(int port)
     ret = HttpSendRequestA(req.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);
+    todo_wine ok(err == ERROR_HTTP_INVALID_SERVER_RESPONSE, "got %lu\n", err);
 
     close_request(&req);
 }
@@ -4135,7 +4135,7 @@ static void test_invalid_response_headers(int port)
     open_simple_request(&req, "localhost", port, NULL, "/testE");
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
 
     test_status_code(req.request, 401);
     test_request_flags(req.request, 0);
@@ -4167,14 +4167,14 @@ static void test_response_without_headers(int port)
     test_request_flags(req.request, INTERNET_REQFLAG_NO_HEADERS);
 
     r = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(r, "HttpSendRequest failed %u\n", GetLastError());
+    ok(r, "HttpSendRequest failed %lu\n", GetLastError());
 
     test_request_flags_todo(req.request, INTERNET_REQFLAG_NO_HEADERS);
 
     count = 0;
     memset(buffer, 0, sizeof buffer);
     r = InternetReadFile(req.request, buffer, sizeof buffer, &count);
-    ok(r, "InternetReadFile failed %u\n", GetLastError());
+    ok(r, "InternetReadFile failed %lu\n", GetLastError());
     todo_wine ok(count == sizeof page1 - 1, "count was wrong\n");
     todo_wine ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n");
 
@@ -4184,19 +4184,19 @@ static void test_response_without_headers(int port)
     buffer[0] = 0;
     size = sizeof(buffer);
     r = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL );
-    ok(r, "HttpQueryInfo failed %u\n", GetLastError());
+    ok(r, "HttpQueryInfo failed %lu\n", GetLastError());
     ok(!strcmp(buffer, "OK"), "expected OK got: \"%s\"\n", buffer);
 
     buffer[0] = 0;
     size = sizeof(buffer);
     r = HttpQueryInfoA(req.request, HTTP_QUERY_VERSION, buffer, &size, NULL);
-    ok(r, "HttpQueryInfo failed %u\n", GetLastError());
+    ok(r, "HttpQueryInfo failed %lu\n", GetLastError());
     ok(!strcmp(buffer, "HTTP/1.0"), "expected HTTP/1.0 got: \"%s\"\n", buffer);
 
     buffer[0] = 0;
     size = sizeof(buffer);
     r = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL);
-    ok(r, "HttpQueryInfo failed %u\n", GetLastError());
+    ok(r, "HttpQueryInfo failed %lu\n", GetLastError());
     ok(!strcmp(buffer, "HTTP/1.0 200 OK"), "raw headers wrong: \"%s\"\n", buffer);
 
     close_request(&req);
@@ -4212,22 +4212,22 @@ static void test_head_request(int port)
     open_simple_request(&req, "localhost", port, "HEAD", "/test_head");
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
     len = sizeof(content_length);
     content_length = -1;
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, &content_length, &len, 0);
-    ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
-    ok(len == sizeof(DWORD), "len = %u\n", len);
-    ok(content_length == 100, "content_length = %u\n", content_length);
+    ok(ret, "HttpQueryInfo failed: %lu\n", GetLastError());
+    ok(len == sizeof(DWORD), "len = %lu\n", len);
+    ok(content_length == 100, "content_length = %lu\n", content_length);
 
     len = -1;
     ret = InternetReadFile(req.request, buf, sizeof(buf), &len);
-    ok(ret, "InternetReadFile failed: %u\n", GetLastError());
+    ok(ret, "InternetReadFile failed: %lu\n", GetLastError());
 
     len = -1;
     ret = InternetReadFile(req.request, buf, sizeof(buf), &len);
-    ok(ret, "InternetReadFile failed: %u\n", GetLastError());
+    ok(ret, "InternetReadFile failed: %lu\n", GetLastError());
 
     close_request(&req);
 }
@@ -4245,7 +4245,7 @@ static void test_HttpQueryInfo(int port)
     ret = HttpQueryInfoA(req.request, 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);
+    if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "got %lu expected ERROR_HTTP_HEADER_NOT_FOUND\n", error);
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
     ok(ret, "HttpSendRequest failed\n");
@@ -4253,48 +4253,48 @@ static void test_HttpQueryInfo(int port)
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, 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);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 1, "expected 1 got %lu\n", index);
 
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, 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);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 1, "expected 1 got %lu\n", index);
 
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 0, "expected 0 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 0, "expected 0 got %lu\n", index);
 
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 0, "expected 0 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 0, "expected 0 got %lu\n", index);
 
     index = 0xdeadbeef; /* invalid start index */
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, 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());
+       "Expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n", GetLastError());
 
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_RAW_HEADERS_CRLF, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 0, "expected 0 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 0, "expected 0 got %lu\n", index);
 
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_STATUS_TEXT, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 0, "expected 0 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 0, "expected 0 got %lu\n", index);
 
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_VERSION, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 0, "expected 0 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 0, "expected 0 got %lu\n", index);
 
     test_status_code(req.request, 200);
 
@@ -4302,31 +4302,31 @@ static void test_HttpQueryInfo(int port)
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_FORWARDED, buffer, &size, &index);
     ok(!ret, "HttpQueryInfo succeeded\n");
-    ok(index == 0xdeadbeef, "expected 0xdeadbeef got %u\n", index);
+    ok(index == 0xdeadbeef, "expected 0xdeadbeef got %lu\n", index);
 
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_SERVER, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 1, "expected 1 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 1, "expected 1 got %lu\n", index);
 
     index = 0;
     size = sizeof(buffer);
     strcpy(buffer, "Server");
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_CUSTOM, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 1, "expected 1 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 1, "expected 1 got %lu\n", index);
 
     index = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 1, "expected 1 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 1, "expected 1 got %lu\n", index);
 
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req.request, HTTP_QUERY_SET_COOKIE, buffer, &size, &index);
-    ok(ret, "HttpQueryInfo failed %u\n", GetLastError());
-    ok(index == 2, "expected 2 got %u\n", index);
+    ok(ret, "HttpQueryInfo failed %lu\n", GetLastError());
+    ok(index == 2, "expected 2 got %lu\n", index);
 
     close_request(&req);
 }
@@ -4346,55 +4346,55 @@ static void test_options(int port)
     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);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     ctx = 1;
     ret = InternetSetOptionA(ses, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
-    ok(ret, "InternetSetOption failed %u\n", GetLastError());
+    ok(ret, "InternetSetOption failed %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     size = 0;
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %lu\n", error);
 
     size = sizeof(ctx);
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE, got %lu\n", error);
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
     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);
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
+    ok(ctx == 1, "expected 1 got %Iu\n", ctx);
 
     con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
     ok(con != NULL, "InternetConnect failed\n");
@@ -4402,18 +4402,18 @@ static void test_options(int port)
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
     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);
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
+    ok(ctx == 0, "expected 0 got %Iu\n", ctx);
 
     ctx = 2;
     ret = InternetSetOptionA(con, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
-    ok(ret, "InternetSetOption failed %u\n", GetLastError());
+    ok(ret, "InternetSetOption failed %lu\n", GetLastError());
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
     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);
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
+    ok(ctx == 2, "expected 2 got %Iu\n", ctx);
 
     req = HttpOpenRequestA(con, NULL, "/test1", NULL, NULL, NULL, 0, 0);
     ok(req != NULL, "HttpOpenRequest failed\n");
@@ -4421,49 +4421,49 @@ static void test_options(int port)
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
     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);
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
+    ok(ctx == 0, "expected 0 got %Iu\n", ctx);
 
     ctx = 3;
     ret = InternetSetOptionA(req, INTERNET_OPTION_CONTEXT_VALUE, &ctx, sizeof(ctx));
-    ok(ret, "InternetSetOption failed %u\n", GetLastError());
+    ok(ret, "InternetSetOption failed %lu\n", GetLastError());
 
     ctx = 0xdeadbeef;
     size = sizeof(ctx);
     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);
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
+    ok(ctx == 3, "expected 3 got %Iu\n", ctx);
 
     size = sizeof(idsi);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO, &idsi, &size);
-    ok(ret, "InternetQueryOption failed %u\n", GetLastError());
+    ok(ret, "InternetQueryOption failed %lu\n", GetLastError());
 
     size = 0;
     SetLastError(0xdeadbeef);
     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);
+    ok(error == ERROR_INTERNET_INVALID_OPERATION, "expected ERROR_INTERNET_INVALID_OPERATION, got %lu\n", error);
 
     /* INTERNET_OPTION_PROXY */
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, NULL);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
-    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, &ctx, NULL);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
-    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     size = 0;
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, &size);
     error = GetLastError();
     ok(!ret, "InternetQueryOption succeeded\n");
-    ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %u\n", error);
+    ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %lu\n", error);
     ok(size >= sizeof(INTERNET_PROXY_INFOA), "expected size to be greater or equal to the struct size\n");
 
     InternetCloseHandle(req);
@@ -4528,8 +4528,8 @@ static void test_http_status(int port)
 
         size = sizeof(buf);
         res = HttpQueryInfoA(req.request, 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",
+        ok(res, "HttpQueryInfo failed: %lu\n", GetLastError());
+        ok(!strcmp(buf, http_status_tests[i].status_text), "[%lu] Unexpected status text \"%s\", expected \"%s\"\n",
            i, buf, http_status_tests[i].status_text);
 
         close_request(&req);
@@ -4551,7 +4551,7 @@ static void test_cache_control_verb(int port)
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(request, 200);
     InternetCloseHandle(request);
 
@@ -4559,7 +4559,7 @@ static void test_cache_control_verb(int port)
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(request, 200);
     InternetCloseHandle(request);
 
@@ -4567,7 +4567,7 @@ static void test_cache_control_verb(int port)
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(request, 200);
     InternetCloseHandle(request);
 
@@ -4575,7 +4575,7 @@ static void test_cache_control_verb(int port)
                               INTERNET_FLAG_NO_CACHE_WRITE, 0);
     ok(request != NULL, "HttpOpenRequest failed\n");
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(request, 200);
     InternetCloseHandle(request);
 
@@ -4593,13 +4593,13 @@ static void test_request_content_length(int port)
     open_simple_request(&req, "localhost", port, "POST", "/test_request_content_length");
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(req.request, 200);
 
     SetEvent(complete_event);
 
     ret = HttpSendRequestA(req.request, NULL, 0, data, sizeof(data));
-    ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed %lu\n", GetLastError());
     test_status_code(req.request, 200);
 
     SetEvent(complete_event);
@@ -4660,33 +4660,33 @@ static void test_basic_auth_credentials_reuse(int port)
 
     con = InternetConnectA( ses, "localhost", port, "user", "pwd",
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "user"), "got %s\n", buffer);
-    ok(size == 4, "got %u\n", size);
+    ok(size == 4, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "pwd"), "got %s\n", buffer);
-    ok(size == 3, "got %u\n", size);
+    ok(size == 3, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4697,33 +4697,33 @@ static void test_basic_auth_credentials_reuse(int port)
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL,
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "PUT", "/upload2.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "user"), "got %s\n", buffer);
-    ok(size == 4, "got %u\n", size);
+    ok(size == 4, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "pwd"), "got %s\n", buffer);
-    ok(size == 3, "got %u\n", size);
+    ok(size == 3, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4742,33 +4742,33 @@ static void test_basic_auth_credentials_end_session(int port)
 
     con = InternetConnectA( ses, "localhost", port, "user", "pwd",
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "user"), "got %s\n", buffer);
-    ok(size == 4, "got %u\n", size);
+    ok(size == 4, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "pwd"), "got %s\n", buffer);
-    ok(size == 3, "got %u\n", size);
+    ok(size == 3, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == HTTP_STATUS_OK, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == HTTP_STATUS_OK, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4779,37 +4779,37 @@ static void test_basic_auth_credentials_end_session(int port)
 
     /* Clear the cached credentials */
     ret = InternetSetOptionA(ses,  INTERNET_OPTION_END_BROWSER_SESSION, NULL, 0);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL,
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "PUT", "/upload2.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, ""), "got %s\n", buffer);
-    ok(size == 0, "got %u\n", size);
+    ok(size == 0, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, ""), "got %s\n", buffer);
-    ok(size == 0, "got %u\n", size);
+    ok(size == 0, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == HTTP_STATUS_BAD_REQUEST, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == HTTP_STATUS_BAD_REQUEST, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4828,33 +4828,33 @@ static void test_basic_auth_credentials_different(int port)
 
     con = InternetConnectA( ses, "localhost", port, "user", "pwd",
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "user"), "got %s\n", buffer);
-    ok(size == 4, "got %u\n", size);
+    ok(size == 4, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "pwd"), "got %s\n", buffer);
-    ok(size == 3, "got %u\n", size);
+    ok(size == 3, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4865,33 +4865,33 @@ static void test_basic_auth_credentials_different(int port)
 
     con = InternetConnectA( ses, "localhost", port, "user1", "pwd1",
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload3.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_USERNAME, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "user1"), "got %s\n", buffer);
-    ok(size == 5, "got %u\n", size);
+    ok(size == 5, "got %lu\n", size);
 
     size = sizeof(buffer);
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_PASSWORD, buffer, &size);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
     ok(!strcmp(buffer, "pwd1"), "got %s\n", buffer);
-    ok(size == 4, "got %u\n", size);
+    ok(size == 4, "got %lu\n", size);
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4912,13 +4912,13 @@ static void test_basic_auth_credentials_manual(int port)
 
     /* Clear the cached credentials */
     ret = InternetSetOptionA(ses,  INTERNET_OPTION_END_BROWSER_SESSION, NULL, 0);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     /* Set Authorization Header */
     ret = HttpAddRequestHeadersA(req, "Authorization: Basic dXNlcjpwd2Q=\r\n", ~0u,
@@ -4926,13 +4926,13 @@ static void test_basic_auth_credentials_manual(int port)
     ok(ret, "HttpAddRequestHeaders Failed\n");
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4943,19 +4943,19 @@ static void test_basic_auth_credentials_manual(int port)
     ok( ses != NULL, "InternetOpenA failed\n" );
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 401, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 401, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -4965,10 +4965,10 @@ static void test_basic_auth_credentials_manual(int port)
     ok( ses != NULL, "InternetOpenA failed\n" );
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload4.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     /* Set Authorization Header */
     ret = HttpAddRequestHeadersA(req, "Authorization: Bearer dXNlcjE6cHdkMQ==\r\n", ~0u,
@@ -4976,13 +4976,13 @@ static void test_basic_auth_credentials_manual(int port)
     ok(ret, "HttpAddRequestHeaders Failed\n");
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -5003,23 +5003,23 @@ static void test_basic_auth_credentials_cached_manual(int port)
 
     /* Clear the cached credentials */
     ret = InternetSetOptionA(ses,  INTERNET_OPTION_END_BROWSER_SESSION, NULL, 0);
-    ok(ret, "unexpected failure %u\n", GetLastError());
+    ok(ret, "unexpected failure %lu\n", GetLastError());
 
      con = InternetConnectA( ses, "localhost", port, "user", "pwd",
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 200, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 200, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -5029,10 +5029,10 @@ static void test_basic_auth_credentials_cached_manual(int port)
     ok( ses != NULL, "InternetOpenA failed\n" );
 
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, "HEAD", "/upload4.txt", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     /* Setting an Authorization Header doesn't override the cached one. */
     ret = HttpAddRequestHeadersA(req, "Authorization: Bearer dXNlcjE6cHdkMQ==\r\n", ~0u,
@@ -5040,13 +5040,13 @@ static void test_basic_auth_credentials_cached_manual(int port)
     ok(ret, "HttpAddRequestHeaders Failed\n");
 
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
-    ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
+    ok( ret, "HttpSendRequestA failed %lu\n", GetLastError() );
 
     status = 0xdeadbeef;
     size = sizeof(status);
     ret = HttpQueryInfoA( req, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL );
-    ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
-    ok( status == 201, "got %u\n", status );
+    ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
+    ok( status == 201, "got %lu\n", status );
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
@@ -5071,12 +5071,12 @@ static void test_async_read(int port)
 
     SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
     CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
 
     SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
     req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
     CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
 
     SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT );
@@ -5094,9 +5094,9 @@ static void test_async_read(int port)
     SetLastError( 0xdeadbeef );
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
     ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" );
-    ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %lu\n", GetLastError() );
     WaitForSingleObject( complete_event, INFINITE );
-    ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+    ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error );
 
     CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT );
     CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY );
@@ -5124,21 +5124,21 @@ static void test_async_read(int port)
 
         ret = InternetReadFileExA( req, &ib, 0, 0xdeadbeef );
         if (!count) /* the first part should arrive immediately */
-            ok( ret, "InternetReadFileExA failed %u\n", GetLastError() );
+            ok( ret, "InternetReadFileExA failed %lu\n", GetLastError() );
         if (!ret)
         {
-            ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %lu\n", GetLastError() );
             CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
             SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
             if (!pending_reads++)
             {
                 res = WaitForSingleObject( complete_event, 0 );
-                ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res );
+                ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %lu\n", res );
                 SetEvent( conn_wait_event );
             }
             res = WaitForSingleObject( complete_event, INFINITE );
-            ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res );
-            ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+            ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %lu\n", res );
+            ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error );
             todo_wine_if( pending_reads > 1 )
             ok( ib.dwBufferLength != 0, "expected ib.dwBufferLength != 0\n" );
             CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
@@ -5150,7 +5150,7 @@ static void test_async_read(int port)
         if (!ib.dwBufferLength) break;
     }
 
-    ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads );
+    ok( pending_reads == 1, "expected 1 pending read, got %lu\n", pending_reads );
     ok( !strcmp(buffer, page1), "unexpected buffer content\n" );
     close_async_handle( ses, 2 );
     ResetEvent( conn_wait_event );
@@ -5162,12 +5162,12 @@ static void test_async_read(int port)
 
     SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
     con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
     CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
 
     SET_EXPECT( INTERNET_STATUS_HANDLE_CREATED );
     req = HttpOpenRequestA( con, "GET", "/async_read", NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
     CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
 
     SET_OPTIONAL( INTERNET_STATUS_COOKIE_SENT );
@@ -5185,9 +5185,9 @@ static void test_async_read(int port)
     SetLastError( 0xdeadbeef );
     ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
     ok( !ret, "HttpSendRequestA unexpectedly succeeded\n" );
-    ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %lu\n", GetLastError() );
     WaitForSingleObject( complete_event, INFINITE );
-    ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+    ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error );
 
     CLEAR_NOTIFIED( INTERNET_STATUS_COOKIE_SENT );
     CLEAR_NOTIFIED( INTERNET_STATUS_DETECTING_PROXY );
@@ -5211,22 +5211,22 @@ static void test_async_read(int port)
         bytes = 0xdeadbeef;
         ret = InternetReadFile( req, buffer + count, min(16, sizeof(buffer) - count), &bytes );
         if (!count) /* the first part should arrive immediately */
-            ok( ret, "InternetReadFile failed %u\n", GetLastError() );
+            ok( ret, "InternetReadFile failed %lu\n", GetLastError() );
         if (!ret)
         {
-            ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError() );
-            ok( bytes == 0, "expected 0, got %u\n", bytes );
+            ok( GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %lu\n", GetLastError() );
+            ok( bytes == 0, "expected 0, got %lu\n", bytes );
             CHECK_NOTIFIED( INTERNET_STATUS_RECEIVING_RESPONSE );
             SET_EXPECT( INTERNET_STATUS_REQUEST_COMPLETE );
             if (!pending_reads++)
             {
                 res = WaitForSingleObject( complete_event, 0 );
-                ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", res );
+                ok( res == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %lu\n", res );
                 SetEvent( conn_wait_event );
             }
             res = WaitForSingleObject( complete_event, INFINITE );
-            ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", res );
-            ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error );
+            ok( res == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %lu\n", res );
+            ok( req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error );
             todo_wine_if( pending_reads > 1 )
             ok( bytes != 0, "expected bytes != 0\n" );
             CHECK_NOTIFIED( INTERNET_STATUS_RESPONSE_RECEIVED );
@@ -5238,7 +5238,7 @@ static void test_async_read(int port)
         if (!bytes) break;
     }
 
-    ok( pending_reads == 1, "expected 1 pending read, got %u\n", pending_reads );
+    ok( pending_reads == 1, "expected 1 pending read, got %lu\n", pending_reads );
     ok( !strcmp(buffer, page1), "unexpected buffer content\n" );
     close_async_handle( ses, 2 );
 }
@@ -5308,7 +5308,7 @@ static void send_socket_request(test_request_t *req, BOOL new_connection)
     SetLastError(0xdeadbeef);
     ret = HttpSendRequestA(req->request, NULL, 0, NULL, 0);
     ok(!ret, "HttpSendRequestA unexpectedly succeeded\n");
-    ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_IO_PENDING, "expected ERROR_IO_PENDING, got %lu\n", GetLastError());
 
     if(new_connection)
         WaitForSingleObject(server_req_rec_event, INFINITE);
@@ -5336,13 +5336,13 @@ static void open_socket_request(int port, test_request_t *req, const char *verb)
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req->connection = InternetConnectA(req->session, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0xdeadbeef);
-    ok(req->connection != NULL, "InternetConnectA failed %u\n", GetLastError());
+    ok(req->connection != NULL, "InternetConnectA failed %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED );
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req->request = HttpOpenRequestA(req->connection, "GET", verb ? verb : "/socket",
                                     NULL, NULL, NULL, INTERNET_FLAG_RELOAD, 0xdeadbeef);
-    ok(req->request != NULL, "HttpOpenRequestA failed %u\n", GetLastError());
+    ok(req->request != NULL, "HttpOpenRequestA failed %lu\n", GetLastError());
     CHECK_NOTIFIED( INTERNET_STATUS_HANDLE_CREATED );
 
     send_socket_request(req, !verb);
@@ -5368,10 +5368,10 @@ static void open_read_test_request(int port, test_request_t *req, const char *re
         CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
         CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
         todo_wine
-        ok(received_response_size == strlen(response), "received_response_size = %u\n", received_response_size);
+        ok(received_response_size == strlen(response), "received_response_size = %lu\n", received_response_size);
     }
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 }
 
 #define readex_expect_sync_data_len(a,b,c,d,e,f,g) _readex_expect_sync_data_len(__LINE__,a,b,c,d,e,f,g)
@@ -5389,15 +5389,15 @@ static void _readex_expect_sync_data_len(unsigned line, HINTERNET req, DWORD fla
     memset(buf->lpvBuffer, 0xff, buf_size);
     buf->dwBufferLength = buf_size;
     ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
-    ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(buf->dwBufferLength == len, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, len);
+    ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(buf->dwBufferLength == len, "dwBufferLength = %lu, expected %lu\n", buf->dwBufferLength, len);
     if(len && exdata)
         ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "Unexpected data\n");
 
     if(!skip_receive_notification_tests && expect_receive) {
         CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
         CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
-        ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
+        ok_(__FILE__,line)(received_response_size == len, "received_response_size = %lu\n", received_response_size);
     }
 }
 
@@ -5422,16 +5422,16 @@ static void _read_expect_sync_data_len(unsigned line, HINTERNET req, void *buf,
 
     memset(buf, 0xff, buf_size);
     ret = InternetReadFile(req, buf, buf_size, &ret_size);
-    ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %u\n", GetLastError());
-    ok_(__FILE__,line)(ret_size == len, "dwBufferLength = %u, expected %u\n", ret_size, len);
+    ok_(__FILE__,line)(ret, "InternetReadFileExW failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)(ret_size == len, "dwBufferLength = %lu, expected %lu\n", ret_size, len);
     if(len && exdata)
         ok_(__FILE__,line)(!memcmp(buf, exdata, len), "Unexpected data\n");
 
     CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
     CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED);
     CLEAR_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok_(__FILE__,line)(received_response_size == len, "received_response_size = %u\n", received_response_size);
-    ok_(__FILE__,line)(!req_error, "req_error = %u\n", req_error);
+    ok_(__FILE__,line)(received_response_size == len, "received_response_size = %lu\n", received_response_size);
+    ok_(__FILE__,line)(!req_error, "req_error = %lu\n", req_error);
 }
 
 #define read_expect_sync_data(a,b,c,d) _read_expect_sync_data(__LINE__,a,b,c,d)
@@ -5471,11 +5471,11 @@ static void _send_response_and_wait(unsigned line, const char *response, BOOL do
     if(!skip_receive_notification_tests && expected_receive_size != -1)
         todo_wine_if(received_response_size != expected_receive_size) /* FIXME! remove when wine is fixed */
         ok_(__FILE__,line)(received_response_size == expected_receive_size,
-                           "received_response_size = %u\n", received_response_size);
-    ok_(__FILE__,line)(req_error == expected_req_error, "req_error = %u, expected %u\n", req_error, expected_req_error);
+                           "received_response_size = %lu\n", received_response_size);
+    ok_(__FILE__,line)(req_error == expected_req_error, "req_error = %lu, expected %lu\n", req_error, expected_req_error);
 
     /* If IRF_NO_WAIT is used, buffer is not changed. */
-    ok_(__FILE__,line)(*ret_size == expected_size, "dwBufferLength = %u\n", *ret_size);
+    ok_(__FILE__,line)(*ret_size == expected_size, "dwBufferLength = %lu\n", *ret_size);
     if(exdata)
         ok_(__FILE__,line)(!memcmp(buf, exdata, strlen(exdata)), "unexpected buffer data\n");
     else if(buf)
@@ -5516,8 +5516,8 @@ static void _readex_expect_async(unsigned line, HINTERNET req, DWORD flags, INTE
     memset(buf->lpvBuffer, 0, max(buf_size, sizeof(DWORD)));
     buf->dwBufferLength = buf_size;
     ret = InternetReadFileExW(req, buf, flags, 0xdeadbeef);
-    ok_(__FILE__,line)(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%u)\n", ret, GetLastError());
-    ok_(__FILE__,line)(buf->dwBufferLength == buf_size, "dwBufferLength = %u, expected %u\n", buf->dwBufferLength, buf_size);
+    ok_(__FILE__,line)(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%lu)\n", ret, GetLastError());
+    ok_(__FILE__,line)(buf->dwBufferLength == buf_size, "dwBufferLength = %lu, expected %lu\n", buf->dwBufferLength, buf_size);
     if(exdata) {
         len = strlen(exdata);
         ok_(__FILE__,line)(!memcmp(buf->lpvBuffer, exdata, len), "unexpected buffer data\n");
@@ -5540,8 +5540,8 @@ static void read_expect_async(HINTERNET req, void *buf, DWORD buf_size, DWORD *r
     *ret_size = 0xdeadbeef;
     memset(buf, 0, buf_size);
     ret = InternetReadFile(req, buf, buf_size, ret_size);
-    ok(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%u)\n", ret, GetLastError());
-    ok(*ret_size == 0, "dwBufferLength = %u\n", *ret_size);
+    ok(!ret && GetLastError() == ERROR_IO_PENDING, "InternetReadFileExW returned %x (%lu)\n", ret, GetLastError());
+    ok(*ret_size == 0, "dwBufferLength = %lu\n", *ret_size);
     if(exdata) {
         len = strlen(exdata);
         ok(!memcmp(buf, exdata, len), "unexpected buffer data\n");
@@ -5561,9 +5561,9 @@ static DWORD _expect_data_available(unsigned line, HINTERNET req, int exsize)
     BOOL res;
 
     res = InternetQueryDataAvailable(req, &size, 0, 0);
-    ok_(__FILE__,line)(res, "InternetQueryDataAvailable failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "InternetQueryDataAvailable failed: %lu\n", GetLastError());
     if(exsize != -1)
-        ok_(__FILE__,line)(size  == exsize, "size = %u, expected %u\n", size, exsize);
+        ok_(__FILE__,line)(size  == exsize, "size = %lu, expected %u\n", size, exsize);
 
     return size;
 }
@@ -5579,8 +5579,8 @@ static void _async_query_data_available(unsigned line, HINTERNET req, DWORD *siz
     *size = 0xdeadbeef;
     res = InternetQueryDataAvailable(req, size, 0, 0);
     ok_(__FILE__,line)(!res && GetLastError() == ERROR_IO_PENDING,
-                       "InternetQueryDataAvailable returned: %x(%u)\n", res, GetLastError());
-    ok_(__FILE__,line)(!*size, "size = %u\n", *size);
+                       "InternetQueryDataAvailable returned: %x(%lu)\n", res, GetLastError());
+    ok_(__FILE__,line)(!*size, "size = %lu\n", *size);
 
     if(!skip_receive_notification_tests)
         CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE);
@@ -5758,7 +5758,7 @@ static void test_http_read(int port)
 
     send_response_len_and_wait(20000, TRUE, &ib);
     avail = expect_data_available(req.request, -1);
-    ok(avail <= 20000, "avail = %u\n", avail);
+    ok(avail <= 20000, "avail = %lu\n", avail);
 
     SET_WINE_ALLOW(INTERNET_STATUS_CLOSING_CONNECTION);
     SET_WINE_ALLOW(INTERNET_STATUS_CONNECTION_CLOSED);
@@ -5852,7 +5852,7 @@ static void test_long_url(int port)
     open_simple_request(&req, "localhost", port, NULL, long_path);
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req.request, 200);
 
     receive_simple_request(req.request, buf, sizeof(buf));
@@ -5862,9 +5862,9 @@ static void test_long_url(int port)
 
     size = sizeof(buf);
     ret = InternetQueryOptionA(req.request, INTERNET_OPTION_URL, buf, &size);
-    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %u\n", GetLastError());
+    ok(ret, "InternetQueryOptionA(INTERNET_OPTION_URL) failed: %lu\n", GetLastError());
     len = strlen(url);
-    ok(size == len, "size = %u, expected %u\n", size, len);
+    ok(size == len, "size = %lu, expected %lu\n", size, len);
     ok(!strcmp(buf, url), "Wrong URL %s, expected %s\n", buf, url);
 
     close_request(&req);
@@ -5907,7 +5907,7 @@ static void test_persistent_connection(int port)
                        "2\r\nab\r\n");
     WaitForSingleObject(complete_event, INFINITE);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "ab", 0);
     readex_expect_async(req.request, IRF_ASYNC, &ib, sizeof(buf), NULL);
@@ -5925,7 +5925,7 @@ static void test_persistent_connection(int port)
                        "2\r\nab\r\n");
     WaitForSingleObject(complete_event, INFINITE);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, 3, "ab", 0);
     readex_expect_async(req.request, IRF_ASYNC, &ib, 3, NULL);
@@ -5946,7 +5946,7 @@ static void test_persistent_connection(int port)
                        "\r\n");
     WaitForSingleObject(complete_event, INFINITE);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     test_status_code(req.request, 201);
     close_async_handle(req.session, 2);
@@ -5963,7 +5963,7 @@ static void test_persistent_connection(int port)
                        "2\r\nab\r\n");
     WaitForSingleObject(complete_event, INFINITE);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     readex_expect_sync_data(req.request, IRF_NO_WAIT, &ib, sizeof(buf), "ab", 0);
     readex_expect_async(req.request, IRF_ASYNC, &ib, sizeof(buf), NULL);
@@ -6034,7 +6034,7 @@ static void test_redirect(int port)
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT);
     CHECK_NOTIFIED(INTERNET_STATUS_REDIRECT);
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     test_status_code(req.request, 200);
 
@@ -6057,7 +6057,7 @@ static void test_redirect(int port)
     WaitForSingleObject(complete_event, INFINITE);
 
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %lu\n", req_error);
 
     sprintf(expect_url, "http://localhost:%u/socket", port);
     test_request_url(req.request, expect_url);
@@ -6082,7 +6082,7 @@ static void test_redirect(int port)
     WaitForSingleObject(complete_event, INFINITE);
 
     CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE);
-    ok(req_error == ERROR_INTERNET_INVALID_URL, "expected ERROR_INTERNET_INVALID_URL, got %u\n", req_error);
+    ok(req_error == ERROR_INTERNET_INVALID_URL, "expected ERROR_INTERNET_INVALID_URL, got %lu\n", req_error);
 
     sprintf(expect_url, "http://localhost:%u/socket", port);
     test_request_url(req.request, expect_url);
@@ -6102,7 +6102,7 @@ static void test_remove_dot_segments(int port)
     open_simple_request(&req, "localhost", port, NULL, "/A/../B/./C/../../test_remove_dot_segments");
 
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
     test_status_code(req.request, 200);
 
     close_request(&req);
@@ -6137,7 +6137,7 @@ static void test_large_content(int port)
     {
         content_length = tests[i].content_length;
         ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
-        ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
+        ok(ret, "HttpSendRequest failed: %lu\n", GetLastError());
 
         len = ~0;
         sizelen = sizeof(len);
@@ -6149,18 +6149,18 @@ static void test_large_content(int port)
             ok(ret, "HttpQueryInfo should have succeeded\n");
             ok(GetLastError() == ERROR_SUCCESS ||
                 broken(GetLastError() == 0xdeadbeef), /* xp, 2k8, vista */
-                "expected ERROR_SUCCESS, got %x\n", GetLastError());
-            ok(len == (DWORD)tests[i].content_length, "expected %u, got %u\n",
+                "expected ERROR_SUCCESS, got %lx\n", GetLastError());
+            ok(len == (DWORD)tests[i].content_length, "expected %lu, got %lu\n",
                 (DWORD)tests[i].content_length, len);
         }
         else
         {
             ok(!ret, "HttpQueryInfo should have failed\n");
             ok(GetLastError() == ERROR_HTTP_INVALID_HEADER,
-                "expected ERROR_HTTP_INVALID_HEADER, got %x\n", GetLastError());
-            ok(len == ~0, "expected ~0, got %u\n", len);
+                "expected ERROR_HTTP_INVALID_HEADER, got %lx\n", GetLastError());
+            ok(len == ~0, "expected ~0, got %lu\n", len);
         }
-        ok(sizelen == sizeof(DWORD), "sizelen %u\n", sizelen);
+        ok(sizelen == sizeof(DWORD), "sizelen %lu\n", sizelen);
     }
 
     /* test argument size */
@@ -6171,9 +6171,9 @@ static void test_large_content(int port)
                          &len64, &len, 0);
     ok(!ret, "HttpQueryInfo should have failed\n");
     ok(GetLastError() == ERROR_HTTP_INVALID_HEADER,
-        "expected ERROR_HTTP_INVALID_HEADER, got %x\n", GetLastError());
-    ok(sizelen == sizeof(DWORD64), "sizelen %u\n", sizelen);
-    ok(len64 == ~0, "len64 %x%08x\n", (DWORD)(len64 >> 32), (DWORD)len64);
+        "expected ERROR_HTTP_INVALID_HEADER, got %lx\n", GetLastError());
+    ok(sizelen == sizeof(DWORD64), "sizelen %lu\n", sizelen);
+    ok(len64 == ~0, "len64 %lx%08lx\n", (DWORD)(len64 >> 32), (DWORD)len64);
 
     close_request(&req);
 
@@ -6346,7 +6346,7 @@ static void test_cert_struct_string(HINTERNET req, const INTERNET_CERTIFICATE_IN
     SetLastError(0xdeadbeef);
     memset(actual, 0x55, sizeof(actual));
     res = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE, actual, &size);
-    ok(res, "InternetQueryOption failed: %u\n", GetLastError());
+    ok(res, "InternetQueryOption failed: %lu\n", GetLastError());
 
     FileTimeToSystemTime(&info->ftStart, &start);
     FileTimeToSystemTime(&info->ftExpiry, &expiry);
@@ -6360,15 +6360,15 @@ static void test_cert_struct_string(HINTERNET req, const INTERNET_CERTIFICATE_IN
              start_date, start_time, expiry_date, expiry_time,
              info->lpszSignatureAlgName, info->lpszEncryptionAlgName, info->lpszProtocolName,
              info->dwKeySize >= 128 ? "High" : "Low", info->dwKeySize);
-    ok(size == strlen(actual), "size = %u\n", size);
+    ok(size == strlen(actual), "size = %lu\n", size);
     ok(!strcmp(actual, expect), "expected:\n%s\nactual:\n%s\n", expect, actual);
 
     --size;
     SetLastError(0xdeadbeef);
     memset(actual, 0x55, sizeof(actual));
     res = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE, actual, &size);
-    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == 1, "unexpected size: %u\n", size);
+    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == 1, "unexpected size: %lu\n", size);
     ok(actual[0] == 0x55, "unexpected byte: %02x\n", actual[0]);
 }
 
@@ -6388,15 +6388,15 @@ static void test_cert_struct(HINTERNET req, const cert_struct_test_t *test)
         return;
     }
 
-    ok(res, "InternetQueryOption failed: %u\n", GetLastError());
-    ok(size == sizeof(info), "size = %u\n", size);
+    ok(res, "InternetQueryOption failed: %lu\n", GetLastError());
+    ok(size == sizeof(info), "size = %lu\n", size);
 
     ok(!strcmp(info.lpszSubjectInfo, test->ex_subject), "lpszSubjectInfo = %s\n", info.lpszSubjectInfo);
     ok(!strcmp(info.lpszIssuerInfo, test->ex_issuer), "lpszIssuerInfo = %s\n", info.lpszIssuerInfo);
     ok(!info.lpszSignatureAlgName, "lpszSignatureAlgName = %s\n", info.lpszSignatureAlgName);
     ok(!info.lpszEncryptionAlgName, "lpszEncryptionAlgName = %s\n", info.lpszEncryptionAlgName);
     ok(!info.lpszProtocolName, "lpszProtocolName = %s\n", info.lpszProtocolName);
-    ok(info.dwKeySize >= 128 && info.dwKeySize <= 256, "dwKeySize = %u\n", info.dwKeySize);
+    ok(info.dwKeySize >= 128 && info.dwKeySize <= 256, "dwKeySize = %lu\n", info.dwKeySize);
 
     if (is_lang_english())
         test_cert_struct_string(req, &info);
@@ -6423,25 +6423,25 @@ static void _test_security_info(unsigned line, const char *urlc, DWORD error, DW
     flags = 0xdeadbeef;
     res = pInternetGetSecurityInfoByURLA(url, &chain, &flags);
     if(error == ERROR_SUCCESS) {
-        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
+        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %lu\n", GetLastError());
         ok_(__FILE__,line)(chain != NULL, "chain = NULL\n");
-        ok_(__FILE__,line)(flags == ex_flags, "flags = %x\n", flags);
+        ok_(__FILE__,line)(flags == ex_flags, "flags = %lx\n", flags);
         CertFreeCertificateChain(chain);
 
         SetLastError(0xdeadbeef);
         res = pInternetGetSecurityInfoByURLA(url, NULL, NULL);
         ok_(__FILE__,line)(!res && GetLastError() == ERROR_INVALID_PARAMETER,
-                           "InternetGetSecurityInfoByURLA returned: %x(%u)\n", res, GetLastError());
+                           "InternetGetSecurityInfoByURLA returned: %x(%lu)\n", res, GetLastError());
 
         res = pInternetGetSecurityInfoByURLA(url, &chain, NULL);
-        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
+        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %lu\n", GetLastError());
         CertFreeCertificateChain(chain);
 
         res = pInternetGetSecurityInfoByURLA(url, NULL, &flags);
-        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
+        ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %lu\n", GetLastError());
     }else {
         ok_(__FILE__,line)(!res && GetLastError() == error,
-                           "InternetGetSecurityInfoByURLA returned: %x(%u), expected %u\n", res, GetLastError(), error);
+                           "InternetGetSecurityInfoByURLA returned: %x(%lu), expected %lu\n", res, GetLastError(), error);
     }
 }
 
@@ -6454,16 +6454,16 @@ static void _test_secflags_option(unsigned line, HINTERNET req, DWORD ex_flags,
     flags = 0xdeadbeef;
     size = sizeof(flags);
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
-    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS flags = %x, expected %x\n",
+    ok_(__FILE__,line)(res, "InternetQueryOptionW(INTERNET_OPTION_SECURITY_FLAGS) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS flags = %lx, expected %lx\n",
                        flags, ex_flags);
 
     /* Option 98 is undocumented and seems to be the same as INTERNET_OPTION_SECURITY_FLAGS */
     flags = 0xdeadbeef;
     size = sizeof(flags);
     res = InternetQueryOptionW(req, 98, &flags, &size);
-    ok_(__FILE__,line)(res, "InternetQueryOptionW(98) failed: %u\n", GetLastError());
-    ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS(98) flags = %x, expected %x\n",
+    ok_(__FILE__,line)(res, "InternetQueryOptionW(98) failed: %lu\n", GetLastError());
+    ok_(__FILE__,line)((flags & ~opt_flags) == ex_flags, "INTERNET_OPTION_SECURITY_FLAGS(98) flags = %lx, expected %lx\n",
                        flags, ex_flags);
 }
 
@@ -6473,7 +6473,7 @@ static void _set_secflags(unsigned line, HINTERNET req, BOOL use_undoc, DWORD fl
     BOOL res;
 
     res = InternetSetOptionW(req, use_undoc ? 99 : INTERNET_OPTION_SECURITY_FLAGS, &flags, sizeof(flags));
-    ok_(__FILE__,line)(res, "InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(res, "InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed: %lu\n", GetLastError());
 }
 
 static void test_security_flags(void)
@@ -6501,7 +6501,7 @@ static void test_security_flags(void)
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     conn = InternetConnectA(ses, "test.winehq.com", INTERNET_DEFAULT_HTTPS_PORT,
                             NULL, NULL, INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0xdeadbeef);
-    ok(conn != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(conn != NULL, "InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
@@ -6535,7 +6535,7 @@ static void test_security_flags(void)
 
     flags = SECURITY_FLAG_IGNORE_CERT_CN_INVALID|SECURITY_FLAG_SECURE;
     res = InternetSetOptionW(req, 99, &flags, sizeof(flags));
-    ok(!res && GetLastError() == ERROR_INTERNET_OPTION_NOT_SETTABLE, "InternetSetOption(99) failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_INTERNET_OPTION_NOT_SETTABLE, "InternetSetOption(99) failed: %lu\n", GetLastError());
 
     SET_EXPECT(INTERNET_STATUS_RESOLVING_NAME);
     SET_EXPECT(INTERNET_STATUS_NAME_RESOLVED);
@@ -6554,10 +6554,10 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
 
     res = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %lu\n", GetLastError());
 
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %d\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %ld\n", req_error);
 
     CHECK_NOTIFIED(INTERNET_STATUS_RESOLVING_NAME);
     CHECK_NOTIFIED(INTERNET_STATUS_NAME_RESOLVED);
@@ -6578,12 +6578,12 @@ static void test_security_flags(void)
             |SECURITY_FLAG_IGNORE_REVOCATION|SECURITY_FLAG_IGNORE_CERT_CN_INVALID|SECURITY_FLAG_STRENGTH_STRONG, 0);
 
     res = InternetReadFile(req, buf, sizeof(buf), &size);
-    ok(res, "InternetReadFile failed: %u\n", GetLastError());
+    ok(res, "InternetReadFile failed: %lu\n", GetLastError());
     ok(size, "size = 0\n");
 
     /* Collect all existing persistent connections */
     res = InternetSetOptionA(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
-    ok(res, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
+    ok(res, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n", GetLastError());
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     req = HttpOpenRequestA(conn, "GET", "/tests/hello.html", NULL, NULL, NULL,
@@ -6594,7 +6594,7 @@ static void test_security_flags(void)
 
     flags = INTERNET_ERROR_MASK_COMBINED_SEC_CERT|INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY;
     res = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&flags, sizeof(flags));
-    ok(res, "InternetQueryOption(INTERNET_OPTION_ERROR_MASK failed: %u\n", GetLastError());
+    ok(res, "InternetQueryOption(INTERNET_OPTION_ERROR_MASK failed: %lu\n", GetLastError());
 
     SET_EXPECT(INTERNET_STATUS_CONNECTING_TO_SERVER);
     SET_EXPECT(INTERNET_STATUS_CONNECTED_TO_SERVER);
@@ -6609,17 +6609,17 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
     res = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %lu\n", GetLastError());
 
     WaitForSingleObject(complete_event, INFINITE);
     todo_wine
     ok(req_error == ERROR_INTERNET_SEC_CERT_ERRORS,
-       "req_error = %d\n", req_error);
+       "req_error = %ld\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);
+    ok(res || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %lu\n", size);
     cert = HeapAlloc(GetProcessHeap(), 0, size);
     cert->lpszSubjectInfo = NULL;
     cert->lpszIssuerInfo = NULL;
@@ -6628,7 +6628,7 @@ static void test_security_flags(void)
     cert->lpszProtocolName = (char *)0xdeadbeef;
     cert->dwKeySize = 0xdeadbeef;
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, cert, &size);
-    ok(res, "InternetQueryOption failed: %u\n", GetLastError());
+    ok(res, "InternetQueryOption failed: %lu\n", GetLastError());
     if (res)
     {
         ok(cert->lpszSubjectInfo && strlen(cert->lpszSubjectInfo) > 1, "expected a non-empty subject name\n");
@@ -6645,27 +6645,27 @@ static void test_security_flags(void)
 
     SetLastError(0xdeadbeef);
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE, NULL, NULL);
-    ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_INVALID_PARAMETER, "InternetQueryOption failed: %ld\n", GetLastError());
 
     size = 0;
     SetLastError(0xdeadbeef);
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE, NULL, &size);
-    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == 1, "unexpected size: %u\n", size);
+    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == 1, "unexpected size: %lu\n", size);
 
     size = 42;
     SetLastError(0xdeadbeef);
     memset(buf, 0x55, sizeof(buf));
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE, buf, &size);
-    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == 1, "unexpected size: %u\n", size);
+    ok(!res && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == 1, "unexpected size: %lu\n", size);
     ok(buf[0] == 0x55, "unexpected byte: %02x\n", buf[0]);
 
     size = sizeof(buf);
     SetLastError(0xdeadbeef);
     res = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE, buf, &size);
-    ok(res && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size < sizeof(buf), "unexpected size: %u\n", size);
+    ok(res && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size < sizeof(buf), "unexpected size: %lu\n", size);
 
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTING_TO_SERVER, 2);
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTED_TO_SERVER, 2);
@@ -6676,7 +6676,7 @@ static void test_security_flags(void)
     CLEAR_NOTIFIED(INTERNET_STATUS_DETECTING_PROXY);
 
     if(req_error != ERROR_INTERNET_SEC_CERT_ERRORS) {
-        skip("Unexpected cert errors %u, skipping security flags tests\n", req_error);
+        skip("Unexpected cert errors %lu, skipping security flags tests\n", req_error);
 
         close_async_handle(ses, 3);
         return;
@@ -6684,7 +6684,7 @@ static void test_security_flags(void)
 
     size = sizeof(buf);
     res = HttpQueryInfoA(req, HTTP_QUERY_CONTENT_ENCODING, buf, &size, 0);
-    ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfoA(HTTP_QUERY_CONTENT_ENCODING) failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "HttpQueryInfoA(HTTP_QUERY_CONTENT_ENCODING) failed: %lu\n", GetLastError());
 
     test_request_flags(req, 8);
     /* IE11 finds both rev failure and invalid CA. Previous versions required rev failure
@@ -6703,10 +6703,10 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
     res = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %lu\n", GetLastError());
 
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_INTERNET_INVALID_CA || req_error == ERROR_INTERNET_SEC_CERT_ERRORS, "req_error = %d\n", req_error);
+    ok(req_error == ERROR_INTERNET_INVALID_CA || req_error == ERROR_INTERNET_SEC_CERT_ERRORS, "req_error = %ld\n", req_error);
 
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
     CHECK_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
@@ -6740,10 +6740,10 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_DETECTING_PROXY);
 
     res = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %lu\n", GetLastError());
 
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %d\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %ld\n", req_error);
 
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTING_TO_SERVER, 2);
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTED_TO_SERVER, 2);
@@ -6766,14 +6766,14 @@ static void test_security_flags(void)
             _SECURITY_FLAG_CERT_INVALID_CA);
 
     res = InternetReadFile(req, buf, sizeof(buf), &size);
-    ok(res, "InternetReadFile failed: %u\n", GetLastError());
+    ok(res, "InternetReadFile failed: %lu\n", GetLastError());
     ok(size, "size = 0\n");
 
     close_async_handle(ses, 3);
 
     /* Collect all existing persistent connections */
     res = InternetSetOptionA(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
-    ok(res, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
+    ok(res, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n", GetLastError());
 
     /* Make another request, without setting security flags */
 
@@ -6785,7 +6785,7 @@ static void test_security_flags(void)
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
     conn = InternetConnectA(ses, "test.winehq.com", INTERNET_DEFAULT_HTTPS_PORT,
                             NULL, NULL, INTERNET_SERVICE_HTTP, INTERNET_FLAG_SECURE, 0xdeadbeef);
-    ok(conn != NULL, "InternetConnect failed with error %u\n", GetLastError());
+    ok(conn != NULL, "InternetConnect failed with error %lu\n", GetLastError());
     CHECK_NOTIFIED(INTERNET_STATUS_HANDLE_CREATED);
 
     SET_EXPECT(INTERNET_STATUS_HANDLE_CREATED);
@@ -6813,10 +6813,10 @@ static void test_security_flags(void)
     SET_OPTIONAL(INTERNET_STATUS_COOKIE_SENT);
 
     res = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "HttpSendRequest failed: %lu\n", GetLastError());
 
     WaitForSingleObject(complete_event, INFINITE);
-    ok(req_error == ERROR_SUCCESS, "req_error = %d\n", req_error);
+    ok(req_error == ERROR_SUCCESS, "req_error = %ld\n", req_error);
 
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTING_TO_SERVER, 2);
     CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTED_TO_SERVER, 2);
@@ -6834,7 +6834,7 @@ static void test_security_flags(void)
             |SECURITY_FLAG_IGNORE_REVOCATION|_SECURITY_FLAG_CERT_INVALID_CA, 0);
 
     res = InternetReadFile(req, buf, sizeof(buf), &size);
-    ok(res, "InternetReadFile failed: %u\n", GetLastError());
+    ok(res, "InternetReadFile failed: %lu\n", GetLastError());
     ok(size, "size = 0\n");
 
     close_async_handle(ses, 2);
@@ -6873,7 +6873,7 @@ static void test_secure_connection(void)
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     err = GetLastError();
     ok(ret || broken(err == ERROR_INTERNET_CANNOT_CONNECT) ||
-              broken(err == ERROR_INTERNET_SECURITY_CHANNEL_ERROR), "HttpSendRequest failed: %u\n", err);
+              broken(err == ERROR_INTERNET_SECURITY_CHANNEL_ERROR), "HttpSendRequest failed: %lu\n", err);
     if (!ret)
     {
         win_skip("Cannot connect to https.\n");
@@ -6883,7 +6883,7 @@ static void test_secure_connection(void)
 
     size = sizeof(flags);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size);
-    ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret, "InternetQueryOption failed: %ld\n", GetLastError());
     ok(flags & SECURITY_FLAG_SECURE, "expected secure flag to be set\n");
 
     test_cert_struct(req, &test_winehq_org_cert);
@@ -6892,7 +6892,7 @@ static void test_secure_connection(void)
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
     ok(ret || GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE /* < IE8 */,
-       "InternetQueryOption failed: %u\n", GetLastError());
+       "InternetQueryOption failed: %lu\n", GetLastError());
     if (ret) CertFreeCertificateChain(chain);
 
     /* Querying the same option through InternetQueryOptionW still results in
@@ -6901,13 +6901,13 @@ static void test_secure_connection(void)
     size = 0;
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                                NULL, &size);
-    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %d\n", size);
+    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %ld\n", size);
     certificate_structW = HeapAlloc(GetProcessHeap(), 0, size);
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                               certificate_structW, &size);
     certificate_structA = (INTERNET_CERTIFICATE_INFOA *)certificate_structW;
-    ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret, "InternetQueryOption failed: %ld\n", GetLastError());
     if (ret)
     {
         ok(certificate_structA->lpszSubjectInfo &&
@@ -6930,12 +6930,12 @@ static void test_secure_connection(void)
     SetLastError(0xdeadbeef);
     size = sizeof(certstr1);
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE, certstr1, &size);
-    ok(ret && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     size2 = sizeof(certstr2);
     ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE, certstr2, &size2);
-    ok(ret && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret && GetLastError() == ERROR_SUCCESS, "InternetQueryOption failed: %ld\n", GetLastError());
 
     ok(size == size2, "expected same size\n");
     ok(!strcmp(certstr1, certstr2), "expected same string\n");
@@ -6958,21 +6958,21 @@ static void test_secure_connection(void)
     ok(req != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed: %d\n", GetLastError());
+    ok(ret, "HttpSendRequest failed: %ld\n", GetLastError());
 
     size = sizeof(flags);
     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);
+    ok(ret, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(flags & SECURITY_FLAG_SECURE, "expected secure flag to be set, got %lx\n", flags);
 
     ret = InternetQueryOptionA(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                                NULL, &size);
-    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %d\n", size);
+    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == sizeof(INTERNET_CERTIFICATE_INFOA), "size = %ld\n", size);
     certificate_structA = HeapAlloc(GetProcessHeap(), 0, size);
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                                certificate_structA, &size);
-    ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret, "InternetQueryOption failed: %ld\n", GetLastError());
     if (ret)
     {
         ok(certificate_structA->lpszSubjectInfo &&
@@ -6998,13 +6998,13 @@ static void test_secure_connection(void)
     size = 0;
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                                NULL, &size);
-    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %d\n", GetLastError());
-    ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %d\n", size);
+    ok(ret || GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetQueryOption failed: %ld\n", GetLastError());
+    ok(size == sizeof(INTERNET_CERTIFICATE_INFOW), "size = %ld\n", size);
     certificate_structW = HeapAlloc(GetProcessHeap(), 0, size);
     ret = InternetQueryOptionW(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
                                certificate_structW, &size);
     certificate_structA = (INTERNET_CERTIFICATE_INFOA *)certificate_structW;
-    ok(ret, "InternetQueryOption failed: %d\n", GetLastError());
+    ok(ret, "InternetQueryOption failed: %ld\n", GetLastError());
     if (ret)
     {
         ok(certificate_structA->lpszSubjectInfo &&
@@ -7050,7 +7050,7 @@ static void test_user_agent_header(void)
     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);
+    ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n", err);
 
     ret = HttpAddRequestHeadersA(req, "User-Agent: Gizmo Project\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD_IF_NEW);
     ok(ret, "HttpAddRequestHeaders succeeded\n");
@@ -7069,7 +7069,7 @@ static void test_user_agent_header(void)
     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);
+    ok(err == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n", err);
 
     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");
@@ -7077,7 +7077,7 @@ static void test_user_agent_header(void)
     buffer[0] = 0;
     size = sizeof(buffer);
     ret = HttpQueryInfoA(req, HTTP_QUERY_ACCEPT | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed: %lu\n", GetLastError());
     ok(!strcmp(buffer, "audio/*, image/*, text/*"), "got '%s' expected 'audio/*, image/*, text/*'\n", buffer);
 
     InternetCloseHandle(req);
@@ -7097,7 +7097,7 @@ static void test_bogus_accept_types_array(void)
     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());
+    ok(req != NULL, "HttpOpenRequest failed: %lu\n", GetLastError());
 
     buffer[0] = 0;
     size = sizeof(buffer);
@@ -7105,7 +7105,7 @@ static void test_bogus_accept_types_array(void)
     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);
+    if (!ret) ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n", error);
     ok(broken(!strcmp(buffer, ", */*, %p, , , */*")) /* IE6 */ ||
        broken(!strcmp(buffer, "*/*, %p, */*")) /* IE7/8 */ ||
        !strcmp(buffer, ""), "got '%s' expected ''\n", buffer);
@@ -7127,11 +7127,11 @@ static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID
     struct context *ctx = (struct context *)context;
 
     if(winetest_debug > 1)
-        trace("%p 0x%08lx %u %p 0x%08x\n", handle, context, status, info, size);
+        trace("%p 0x%08Ix %lu %p 0x%08lx\n", handle, context, status, info, size);
 
     switch(status) {
     case INTERNET_STATUS_REQUEST_COMPLETE:
-        trace("request handle: 0x%08lx\n", result->dwResult);
+        trace("request handle: 0x%08Ix\n", result->dwResult);
         ctx->req = (HINTERNET)result->dwResult;
         SetEvent(ctx->event);
         break;
@@ -7148,7 +7148,7 @@ static void WINAPI cb(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID
     case INTERNET_STATUS_CONNECTED_TO_SERVER: {
         char *str = info;
         ok(str[0] && str[1], "Got string: %s\n", str);
-        ok(size == strlen(str)+1, "unexpected size %u\n", size);
+        ok(size == strlen(str)+1, "unexpected size %lu\n", size);
     }
     }
 }
@@ -7163,7 +7163,7 @@ static void test_open_url_async(void)
 
     /* Collect all existing persistent connections */
     ret = InternetSetOptionA(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
-    ok(ret, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n", GetLastError());
 
     /*
      * Some versions of IE6 fail those tests. They pass some notification data as UNICODE string, while
@@ -7183,12 +7183,12 @@ static void test_open_url_async(void)
     ret = InternetSetOptionA(NULL, INTERNET_OPTION_CALLBACK, &cb, sizeof(DWORD_PTR));
     error = GetLastError();
     ok(!ret, "InternetSetOptionA succeeded\n");
-    ok(error == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "got %u expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE\n", error);
+    ok(error == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "got %lu expected ERROR_INTERNET_INCORRECT_HANDLE_TYPE\n", error);
 
     ret = InternetSetOptionA(ses, INTERNET_OPTION_CALLBACK, &cb, sizeof(DWORD_PTR));
     error = GetLastError();
     ok(!ret, "InternetSetOptionA failed\n");
-    ok(error == ERROR_INTERNET_OPTION_NOT_SETTABLE, "got %u expected ERROR_INTERNET_OPTION_NOT_SETTABLE\n", error);
+    ok(error == ERROR_INTERNET_OPTION_NOT_SETTABLE, "got %lu expected ERROR_INTERNET_OPTION_NOT_SETTABLE\n", error);
 
     pInternetSetStatusCallbackW(ses, cb);
     ResetEvent(ctx.event);
@@ -7201,9 +7201,9 @@ static void test_open_url_async(void)
     type = 0;
     size = sizeof(type);
     ret = InternetQueryOptionA(ctx.req, INTERNET_OPTION_HANDLE_TYPE, &type, &size);
-    ok(ret, "InternetQueryOption failed: %u\n", GetLastError());
+    ok(ret, "InternetQueryOption failed: %lu\n", GetLastError());
     ok(type == INTERNET_HANDLE_TYPE_HTTP_REQUEST,
-       "expected INTERNET_HANDLE_TYPE_HTTP_REQUEST, got %u\n", type);
+       "expected INTERNET_HANDLE_TYPE_HTTP_REQUEST, got %lu\n", type);
 
     size = 0;
     ret = HttpQueryInfoA(ctx.req, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &size, NULL);
@@ -7272,12 +7272,12 @@ static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DW
     }else if(status == INTERNET_STATUS_REQUEST_COMPLETE) {
         INTERNET_ASYNC_RESULT *ar = (INTERNET_ASYNC_RESULT*)buffer;
 
-        ok(buflen == sizeof(*ar), "unexpected buflen = %d\n", buflen);
+        ok(buflen == sizeof(*ar), "unexpected buflen = %ld\n", buflen);
         if(info->expect_result == ERROR_SUCCESS) {
-            ok(ar->dwResult == 1, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
+            ok(ar->dwResult == 1, "ar->dwResult = %Id, expected 1\n", ar->dwResult);
         }else {
-            ok(!ar->dwResult, "ar->dwResult = %ld, expected 1\n", ar->dwResult);
-            ok(ar->dwError == info->expect_result, "ar->dwError = %d, expected %d\n", ar->dwError, info->expect_result);
+            ok(!ar->dwResult, "ar->dwResult = %Id, expected 1\n", ar->dwResult);
+            ok(ar->dwError == info->expect_result, "ar->dwError = %ld, expected %ld\n", ar->dwError, info->expect_result);
         }
     }
 
@@ -7301,16 +7301,16 @@ static void CALLBACK check_notification( HINTERNET handle, DWORD_PTR context, DW
 
     if (!info->test[i].todo)
     {
-        ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
+        ok( status_ok, "%u: expected status %u got %lu\n", info->line, info->test[i].status, status );
         ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
 
         if (info->test[i].async)
-            ok(info->thread != GetCurrentThreadId(), "%u: expected thread %u got %u\n",
+            ok(info->thread != GetCurrentThreadId(), "%u: expected thread %lu got %lu\n",
                info->line, info->thread, GetCurrentThreadId());
     }
     else
     {
-        todo_wine ok( status_ok, "%u: expected status %u got %u\n", info->line, info->test[i].status, status );
+        todo_wine ok( status_ok, "%u: expected status %u got %lu\n", info->line, info->test[i].status, status );
         if (status_ok)
             todo_wine ok( function_ok, "%u: expected function %u got %u\n", info->line, info->test[i].function, info->function );
     }
@@ -7483,13 +7483,13 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
 
     setup_test( &info, internet_connect, __LINE__, ERROR_SUCCESS );
     con = InternetConnectA( ses, nd->host, 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, (DWORD_PTR)&info );
-    ok( con != NULL, "InternetConnect failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnect failed %lu\n", GetLastError() );
 
     WaitForSingleObject( info.wait, 10000 );
 
     setup_test( &info, http_open_request, __LINE__, ERROR_SUCCESS );
     req = HttpOpenRequestA( con, nd->method, nd->path, NULL, NULL, accept, 0, (DWORD_PTR)&info );
-    ok( req != NULL, "HttpOpenRequest failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequest failed %lu\n", GetLastError() );
 
     WaitForSingleObject( info.wait, 10000 );
 
@@ -7504,11 +7504,11 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
     setup_test( &info, http_send_request_ex, __LINE__,
             nd->expect_conn_failure ? ERROR_INTERNET_NAME_NOT_RESOLVED : ERROR_SUCCESS );
     ret = HttpSendRequestExA( req, nd->data ? &b : NULL, NULL, 0x28, 0 );
-    ok( !ret && GetLastError() == ERROR_IO_PENDING, "HttpSendRequestExA failed %d %u\n", ret, GetLastError() );
+    ok( !ret && GetLastError() == ERROR_IO_PENDING, "HttpSendRequestExA failed %d %lu\n", ret, GetLastError() );
 
     error = WaitForSingleObject( info.wait, 10000 );
     if(error != WAIT_OBJECT_0) {
-        skip("WaitForSingleObject returned %d, assuming DNS problem\n", error);
+        skip("WaitForSingleObject returned %ld, assuming DNS problem\n", error);
         info.is_aborted = TRUE;
         goto abort;
     }
@@ -7517,13 +7517,13 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
     SetLastError( 0xdeadbeef );
     ret = HttpQueryInfoA( req, HTTP_QUERY_CONTENT_ENCODING, buffer, &size, 0 );
     error = GetLastError();
-    ok( !ret, "HttpQueryInfoA failed %u\n", GetLastError() );
+    ok( !ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
     if(nd->expect_conn_failure) {
-        ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND got %u\n", error );
+        ok(error == ERROR_HTTP_HEADER_NOT_FOUND, "expected ERROR_HTTP_HEADER_NOT_FOUND got %lu\n", error );
     }else {
         todo_wine
         ok(error == ERROR_INTERNET_INCORRECT_HANDLE_STATE,
-            "expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %u\n", error );
+            "expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %lu\n", error );
     }
 
     if (nd->data)
@@ -7532,8 +7532,8 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
         size = strlen( nd->data );
         setup_test( &info, internet_writefile, __LINE__, ERROR_SUCCESS );
         ret = InternetWriteFile( req, nd->data, size, &written );
-        ok( ret, "InternetWriteFile failed %u\n", GetLastError() );
-        ok( written == size, "expected %u got %u\n", written, size );
+        ok( ret, "InternetWriteFile failed %lu\n", GetLastError() );
+        ok( written == size, "expected %lu got %lu\n", written, size );
 
         WaitForSingleObject( info.wait, 10000 );
 
@@ -7541,7 +7541,7 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
         ret = HttpEndRequestA( req, (void *)nd->data, 0x28, 0 );
         error = GetLastError();
         ok( !ret, "HttpEndRequestA succeeded\n" );
-        ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error );
+        ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %lu\n", error );
     }
 
     SetLastError( 0xdeadbeef );
@@ -7550,7 +7550,7 @@ static void test_async_HttpSendRequestEx(const struct notification_data *nd)
     ret = HttpEndRequestA( req, NULL, 0x28, 0 );
     error = GetLastError();
     ok( !ret, "HttpEndRequestA succeeded\n" );
-    ok( error == ERROR_IO_PENDING, "expected ERROR_IO_PENDING got %u\n", error );
+    ok( error == ERROR_IO_PENDING, "expected ERROR_IO_PENDING got %lu\n", error );
 
     WaitForSingleObject( info.wait, 10000 );
 
@@ -7576,7 +7576,7 @@ static void WINAPI closetest_callback(HINTERNET hInternet, DWORD_PTR dwContext,
     BOOL res;
 
     if(winetest_debug > 1)
-        trace("closetest_callback %p: %d\n", hInternet, dwInternetStatus);
+        trace("closetest_callback %p: %ld\n", hInternet, dwInternetStatus);
 
     ok(hInternet == closetest_session || hInternet == closetest_conn || hInternet == closetest_req,
        "Unexpected hInternet %p\n", hInternet);
@@ -7586,7 +7586,7 @@ static void WINAPI closetest_callback(HINTERNET hInternet, DWORD_PTR dwContext,
     len = sizeof(type);
     res = InternetQueryOptionA(closetest_req, INTERNET_OPTION_HANDLE_TYPE, &type, &len);
     ok(!res && GetLastError() == ERROR_INVALID_HANDLE,
-       "InternetQueryOptionA(%p INTERNET_OPTION_HANDLE_TYPE) failed: %x %u, expected TRUE ERROR_INVALID_HANDLE\n",
+       "InternetQueryOptionA(%p INTERNET_OPTION_HANDLE_TYPE) failed: %x %lu, expected TRUE ERROR_INVALID_HANDLE\n",
        closetest_req, res, GetLastError());
 }
 
@@ -7596,13 +7596,13 @@ static void test_InternetCloseHandle(void)
     BOOL res;
 
     closetest_session = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, INTERNET_FLAG_ASYNC);
-    ok(closetest_session != NULL,"InternetOpen failed with error %u\n", GetLastError());
+    ok(closetest_session != NULL,"InternetOpen failed with error %lu\n", GetLastError());
 
     pInternetSetStatusCallbackA(closetest_session, closetest_callback);
 
     closetest_conn = InternetConnectA(closetest_session, "source.winehq.org", INTERNET_INVALID_PORT_NUMBER,
             NULL, NULL, INTERNET_SERVICE_HTTP, 0x0, 0xdeadbeef);
-    ok(closetest_conn != NULL,"InternetConnect failed with error %u\n", GetLastError());
+    ok(closetest_conn != NULL,"InternetConnect failed with error %lu\n", GetLastError());
 
     closetest_req = HttpOpenRequestA(closetest_conn, "GET", "winegecko.php", NULL, NULL, NULL,
             INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_RESYNCHRONIZE, 0xdeadbead);
@@ -7614,22 +7614,22 @@ static void test_InternetCloseHandle(void)
     test_request_flags(closetest_req, INTERNET_REQFLAG_NO_HEADERS);
 
     res = InternetCloseHandle(closetest_session);
-    ok(res, "InternetCloseHandle failed: %u\n", GetLastError());
+    ok(res, "InternetCloseHandle failed: %lu\n", GetLastError());
     closetest_closed = TRUE;
     trace("Closed session handle\n");
 
     res = InternetCloseHandle(closetest_conn);
-    ok(!res && GetLastError() == ERROR_INVALID_HANDLE, "InternetCloseConnection(conn) failed: %x %u\n",
+    ok(!res && GetLastError() == ERROR_INVALID_HANDLE, "InternetCloseConnection(conn) failed: %x %lu\n",
        res, GetLastError());
 
     res = InternetCloseHandle(closetest_req);
-    ok(!res && GetLastError() == ERROR_INVALID_HANDLE, "InternetCloseConnection(req) failed: %x %u\n",
+    ok(!res && GetLastError() == ERROR_INVALID_HANDLE, "InternetCloseConnection(req) failed: %x %lu\n",
        res, GetLastError());
 
     len = sizeof(flags);
     res = InternetQueryOptionA(closetest_req, INTERNET_OPTION_REQUEST_FLAGS, &flags, &len);
     ok(!res && GetLastError() == ERROR_INVALID_HANDLE,
-       "InternetQueryOptionA(%p INTERNET_OPTION_REQUEST_FLAGS) failed: %x %u, expected TRUE ERROR_INVALID_HANDLE\n",
+       "InternetQueryOptionA(%p INTERNET_OPTION_REQUEST_FLAGS) failed: %x %lu, expected TRUE ERROR_INVALID_HANDLE\n",
        closetest_req, res, GetLastError());
 }
 
@@ -7645,7 +7645,7 @@ static void test_connection_failure(void)
     ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
     error = GetLastError();
     ok(!ret, "unexpected success\n");
-    ok(error == ERROR_INTERNET_CANNOT_CONNECT, "wrong error %u\n", error);
+    ok(error == ERROR_INTERNET_CANNOT_CONNECT, "wrong error %lu\n", error);
 
     close_request(&req);
 }
@@ -7675,12 +7675,12 @@ static void test_default_service_port(void)
     error = GetLastError();
     ok(!ret, "HttpSendRequest succeeded\n");
     ok(error == ERROR_INTERNET_SECURITY_CHANNEL_ERROR || error == ERROR_INTERNET_CANNOT_CONNECT,
-       "got %u\n", error);
+       "got %lu\n", error);
 
     size = sizeof(buffer);
     memset(buffer, 0, sizeof(buffer));
     ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed with error %lu\n", GetLastError());
     ok(!strcmp(buffer, "test.winehq.org:80"), "Expected test.winehg.org:80, got '%s'\n", buffer);
 
     InternetCloseHandle(request);
@@ -7699,12 +7699,12 @@ static void test_default_service_port(void)
         win_skip("Can't make https connection\n");
         goto done;
     }
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
 
     size = sizeof(buffer);
     memset(buffer, 0, sizeof(buffer));
     ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed with error %lu\n", GetLastError());
     ok(!strcmp(buffer, "test.winehq.org"), "Expected test.winehg.org, got '%s'\n", buffer);
 
     InternetCloseHandle(request);
@@ -7718,12 +7718,12 @@ static void test_default_service_port(void)
     ok(request != NULL, "HttpOpenRequest failed\n");
 
     ret = HttpSendRequestA(request, NULL, 0, NULL, 0);
-    ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
+    ok(ret, "HttpSendRequest failed with error %lu\n", GetLastError());
 
     size = sizeof(buffer);
     memset(buffer, 0, sizeof(buffer));
     ret = HttpQueryInfoA(request, HTTP_QUERY_HOST | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
-    ok(ret, "HttpQueryInfo failed with error %u\n", GetLastError());
+    ok(ret, "HttpQueryInfo failed with error %lu\n", GetLastError());
     ok(!strcmp(buffer, "test.winehq.org:443"), "Expected test.winehg.org:443, got '%s'\n", buffer);
 
 done:
@@ -7779,7 +7779,7 @@ static void WINAPI header_cb( HINTERNET handle, DWORD_PTR ctx, DWORD status, LPV
     if (status == INTERNET_STATUS_SENDING_REQUEST)
     {
         ret = HttpAddRequestHeadersA( handle, "winetest: winetest", ~0u, HTTP_ADDREQ_FLAG_ADD );
-        ok( ret, "HttpAddRequestHeadersA failed %u\n", GetLastError() );
+        ok( ret, "HttpAddRequestHeadersA failed %lu\n", GetLastError() );
         SetEvent( (HANDLE)ctx );
     }
     else if (status == INTERNET_STATUS_REQUEST_SENT)
@@ -7788,7 +7788,7 @@ static void WINAPI header_cb( HINTERNET handle, DWORD_PTR ctx, DWORD status, LPV
         size = sizeof(buf);
         ret = HttpQueryInfoA( handle, HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                               buf, &size, &index );
-        ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
+        ok( ret, "HttpQueryInfoA failed %lu\n", GetLastError() );
         ok( strstr( buf, "winetest: winetest" ) != NULL, "header missing\n" );
         SetEvent( (HANDLE)ctx );
     }
@@ -7806,10 +7806,10 @@ static void test_concurrent_header_access(void)
 
     con = InternetConnectA( ses, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, NULL, "/", NULL, NULL, NULL, 0, (DWORD_PTR)wait );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     pInternetSetStatusCallbackA( req, header_cb );
 
@@ -7841,25 +7841,25 @@ static void test_cert_string(void)
 
     con = InternetConnectA( ses, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, NULL, NULL,
                             INTERNET_SERVICE_HTTP, 0, 0 );
-    ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+    ok( con != NULL, "InternetConnectA failed %lu\n", GetLastError() );
 
     req = HttpOpenRequestA( con, NULL, "/", NULL, NULL, NULL, 0, 0 );
-    ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+    ok( req != NULL, "HttpOpenRequestA failed %lu\n", GetLastError() );
 
     size = sizeof(actual);
     SetLastError( 0xdeadbeef );
     memset( actual, 0x55, sizeof(actual) );
     res = InternetQueryOptionA( req, INTERNET_OPTION_SECURITY_CERTIFICATE, actual, &size );
     ok( !res && GetLastError() == ERROR_INTERNET_INVALID_OPERATION,
-        "InternetQueryOption failed: %u\n", GetLastError() );
-    ok( size == 0, "unexpected size: %u\n", size );
+        "InternetQueryOption failed: %lu\n", GetLastError() );
+    ok( size == 0, "unexpected size: %lu\n", size );
     ok( actual[0] == 0x55, "unexpected byte: %02x\n", actual[0] );
 
     size = sizeof(chain);
     SetLastError(0xdeadbeef);
     res = InternetQueryOptionA(req, INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT, &chain, &size);
     ok(!res && (GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_STATE),
-       "InternetQueryOption failed: %u\n", GetLastError());
+       "InternetQueryOption failed: %lu\n", GetLastError());
 
     InternetCloseHandle( req );
     InternetCloseHandle( con );
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 19d6ae7e639..5083596f9df 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -68,7 +68,7 @@ static void test_InternetCanonicalizeUrlA(void)
     SetLastError(0xdeadbeef);
     res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
     ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
 
@@ -80,7 +80,7 @@ static void test_InternetCanonicalizeUrlA(void)
     res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
     /* dwSize is nr. of needed bytes with the terminating '\0' */
     ok( !res && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) && (dwSize == (urllen+1)),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
     /* buffer has the required size */
@@ -91,7 +91,7 @@ static void test_InternetCanonicalizeUrlA(void)
     res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
     /* dwSize is nr. of copied bytes without the terminating '\0' */
     ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
     memset(buffer, '#', sizeof(buffer)-1);
@@ -99,8 +99,8 @@ static void test_InternetCanonicalizeUrlA(void)
     dwSize = sizeof(buffer);
     SetLastError(0xdeadbeef);
     res = InternetCanonicalizeUrlA("file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml", buffer, &dwSize, ICU_DECODE | ICU_NO_ENCODE);
-    ok(res, "InternetCanonicalizeUrlA failed %u\n", GetLastError());
-    ok(dwSize == lstrlenA(buffer), "got %d expected %d\n", dwSize, lstrlenA(buffer));
+    ok(res, "InternetCanonicalizeUrlA failed %lu\n", GetLastError());
+    ok(dwSize == lstrlenA(buffer), "got %ld expected %d\n", dwSize, lstrlenA(buffer));
     ok(!lstrcmpA("file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", buffer),
        "got %s expected 'file://C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml'\n", buffer);
 
@@ -112,7 +112,7 @@ static void test_InternetCanonicalizeUrlA(void)
     res = InternetCanonicalizeUrlA(url, buffer, &dwSize, 0);
     /* dwSize is nr. of copied bytes without the terminating '\0' */
     ok( res && (dwSize == urllen) && (lstrcmpA(url, buffer) == 0),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
 
@@ -123,7 +123,7 @@ static void test_InternetCanonicalizeUrlA(void)
     SetLastError(0xdeadbeef);
     res = InternetCanonicalizeUrlA(NULL, buffer, &dwSize, 0);
     ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
     memset(buffer, '#', urllen + 4);
@@ -132,7 +132,7 @@ static void test_InternetCanonicalizeUrlA(void)
     SetLastError(0xdeadbeef);
     res = InternetCanonicalizeUrlA(url, NULL, &dwSize, 0);
     ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
     memset(buffer, '#', urllen + 4);
@@ -141,7 +141,7 @@ static void test_InternetCanonicalizeUrlA(void)
     SetLastError(0xdeadbeef);
     res = InternetCanonicalizeUrlA(url, buffer, NULL, 0);
     ok( !res && (GetLastError() == ERROR_INVALID_PARAMETER),
-        "got %u and %u with size %u for '%s' (%d)\n",
+        "got %lu and %lu with size %lu for '%s' (%d)\n",
         res, GetLastError(), dwSize, buffer, lstrlenA(buffer));
 
     /* test with trailing space */
@@ -153,7 +153,7 @@ static void test_InternetCanonicalizeUrlA(void)
     res = InternetSetOptionA(NULL, 0xdeadbeef, buffer, sizeof(buffer));
     ok(!res, "InternetSetOptionA succeeded\n");
     ok(GetLastError() == ERROR_INTERNET_INVALID_OPTION,
-       "InternetSetOptionA failed %u, expected ERROR_INTERNET_INVALID_OPTION\n", GetLastError());
+       "InternetSetOptionA failed %lu, expected ERROR_INTERNET_INVALID_OPTION\n", GetLastError());
 }
 
 /* ############################### */
@@ -171,8 +171,8 @@ static void test_InternetQueryOptionA(void)
   SetLastError(0xdeadbeef);
   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_INFOA) && len != 0xdeadbeef,"len = %u\n", len);
+  ok(!retval && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got wrong error %x(%lu)\n", retval, GetLastError());
+  ok(len >= sizeof(INTERNET_PROXY_INFOA) && len != 0xdeadbeef,"len = %lu\n", len);
 
   hinet = InternetOpenA(useragent,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
   ok((hinet != 0x0),"InternetOpen Failed\n");
@@ -181,15 +181,15 @@ static void test_InternetQueryOptionA(void)
   retval=InternetQueryOptionA(NULL,INTERNET_OPTION_USER_AGENT,NULL,&len);
   err=GetLastError();
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code%d\n",err);
+  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code%ld\n",err);
 
   SetLastError(0xdeadbeef);
   len=strlen(useragent)+1;
   retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
   err=GetLastError();
-  ok(len == strlen(useragent)+1,"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
+  ok(len == strlen(useragent)+1,"Got wrong user agent length %ld instead of %d\n",len,lstrlenA(useragent));
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %d\n",err);
+  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %ld\n",err);
 
   len=strlen(useragent)+1;
   buffer=HeapAlloc(GetProcessHeap(),0,len);
@@ -198,7 +198,7 @@ static void test_InternetQueryOptionA(void)
   if (retval)
   {
       ok(!strcmp(useragent,buffer),"Got wrong user agent string %s instead of %s\n",buffer,useragent);
-      ok(len == strlen(useragent),"Got wrong user agent length %d instead of %d\n",len,lstrlenA(useragent));
+      ok(len == strlen(useragent),"Got wrong user agent length %ld instead of %d\n",len,lstrlenA(useragent));
   }
   HeapFree(GetProcessHeap(),0,buffer);
 
@@ -207,9 +207,9 @@ static void test_InternetQueryOptionA(void)
   buffer=HeapAlloc(GetProcessHeap(),0,100);
   retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,buffer,&len);
   err=GetLastError();
-  ok(len == strlen(useragent) + 1,"Got wrong user agent length %d instead of %d\n", len, lstrlenA(useragent) + 1);
+  ok(len == strlen(useragent) + 1,"Got wrong user agent length %ld instead of %d\n", len, lstrlenA(useragent) + 1);
   ok(!retval, "Got wrong return value %d\n", retval);
-  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %d\n", err);
+  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code %ld\n", err);
   HeapFree(GetProcessHeap(),0,buffer);
 
   hurl = InternetConnectA(hinet,"www.winehq.org",INTERNET_DEFAULT_HTTP_PORT,NULL,NULL,INTERNET_SERVICE_HTTP,0,0);
@@ -218,25 +218,25 @@ static void test_InternetQueryOptionA(void)
   len=0;
   retval = InternetQueryOptionA(hurl,INTERNET_OPTION_USER_AGENT,NULL,&len);
   err=GetLastError();
-  ok(len == 0,"Got wrong user agent length %d instead of 0\n",len);
+  ok(len == 0,"Got wrong user agent length %ld instead of 0\n",len);
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
+  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
 
   SetLastError(0xdeadbeef);
   len = sizeof(DWORD);
   retval = InternetQueryOptionA(hurl,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len);
   err = GetLastError();
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
-  ok(len == sizeof(DWORD), "len = %d\n", len);
+  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
+  ok(len == sizeof(DWORD), "len = %ld\n", len);
 
   SetLastError(0xdeadbeef);
   len = sizeof(DWORD);
   retval = InternetQueryOptionA(NULL,INTERNET_OPTION_REQUEST_FLAGS,NULL,&len);
   err = GetLastError();
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %d\n",err);
-  ok(!len, "len = %d\n", len);
+  ok(err == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "Got wrong error code %ld\n",err);
+  ok(!len, "len = %ld\n", len);
 
   InternetCloseHandle(hurl);
   InternetCloseHandle(hinet);
@@ -248,21 +248,21 @@ static void test_InternetQueryOptionA(void)
   len=0;
   retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
   err=GetLastError();
-  ok(len == 1,"Got wrong user agent length %d instead of %d\n",len,1);
+  ok(len == 1,"Got wrong user agent length %ld instead of %d\n",len,1);
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%d\n",err);
+  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%ld\n",err);
 
   InternetCloseHandle(hinet);
 
   val = 12345;
   res = InternetSetOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, sizeof(val));
-  ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%u)\n", GetLastError());
+  ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
 
   len = sizeof(val);
   res = InternetQueryOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
-  ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
-  ok(val == 12345, "val = %d\n", val);
-  ok(len == sizeof(val), "len = %d\n", len);
+  ok(res, "InternetQueryOptionA failed %ld)\n", GetLastError());
+  ok(val == 12345, "val = %ld\n", val);
+  ok(len == sizeof(val), "len = %ld\n", len);
 
   hinet = InternetOpenA(NULL,INTERNET_OPEN_TYPE_DIRECT,NULL,NULL, 0);
   ok((hinet != 0x0),"InternetOpen Failed\n");
@@ -270,42 +270,42 @@ static void test_InternetQueryOptionA(void)
   len=0;
   retval=InternetQueryOptionA(hinet,INTERNET_OPTION_USER_AGENT,NULL,&len);
   err=GetLastError();
-  ok(len == 1,"Got wrong user agent length %d instead of %d\n",len,1);
+  ok(len == 1,"Got wrong user agent length %ld instead of %d\n",len,1);
   ok(retval == 0,"Got wrong return value %d\n",retval);
-  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%d\n",err);
+  ok(err == ERROR_INSUFFICIENT_BUFFER, "Got wrong error code%ld\n",err);
 
   len = sizeof(val);
   val = 0xdeadbeef;
   res = InternetQueryOptionA(hinet, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
   ok(!res, "InternetQueryOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
-  ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %u\n", GetLastError());
+  ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %lu\n", GetLastError());
 
   val = 2;
   res = InternetSetOptionA(hinet, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
   ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
-  ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %u\n", GetLastError());
+  ok(GetLastError() == ERROR_INTERNET_INVALID_OPERATION, "GetLastError() = %lu\n", GetLastError());
 
   len = sizeof(val);
   res = InternetQueryOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
-  ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
-  ok(val == 12345, "val = %d\n", val);
-  ok(len == sizeof(val), "len = %d\n", len);
+  ok(res, "InternetQueryOptionA failed %ld)\n", GetLastError());
+  ok(val == 12345, "val = %ld\n", val);
+  ok(len == sizeof(val), "len = %ld\n", len);
 
   val = 1;
   res = InternetSetOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, sizeof(val));
-  ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%u)\n", GetLastError());
+  ok(res, "InternetSetOptionA(INTERNET_OPTION_CONNECT_TIMEOUT) failed (%lu)\n", GetLastError());
 
   len = sizeof(val);
   res = InternetQueryOptionA(hinet, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
-  ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
-  ok(val == 1, "val = %d\n", val);
-  ok(len == sizeof(val), "len = %d\n", len);
+  ok(res, "InternetQueryOptionA failed %ld)\n", GetLastError());
+  ok(val == 1, "val = %ld\n", val);
+  ok(len == sizeof(val), "len = %ld\n", len);
 
   len = sizeof(val);
   res = InternetQueryOptionA(NULL, INTERNET_OPTION_CONNECT_TIMEOUT, &val, &len);
-  ok(res, "InternetQueryOptionA failed %d)\n", GetLastError());
-  ok(val == 12345, "val = %d\n", val);
-  ok(len == sizeof(val), "len = %d\n", len);
+  ok(res, "InternetQueryOptionA failed %ld)\n", GetLastError());
+  ok(val == 12345, "val = %ld\n", val);
+  ok(len == sizeof(val), "len = %ld\n", len);
 
   InternetCloseHandle(hinet);
 }
@@ -319,15 +319,15 @@ static void test_max_conns(void)
     val = 0xdeadbeef;
     res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
     ok(res,"Got wrong return value %x\n", res);
-    ok(len == sizeof(val), "got %d\n", len);
-    trace("INTERNET_OPTION_MAX_CONNS_PER_SERVER: %d\n", val);
+    ok(len == sizeof(val), "got %ld\n", len);
+    trace("INTERNET_OPTION_MAX_CONNS_PER_SERVER: %ld\n", val);
 
     len = sizeof(val);
     val = 0xdeadbeef;
     res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER, &val, &len);
     ok(res,"Got wrong return value %x\n", res);
-    ok(len == sizeof(val), "got %d\n", len);
-    trace("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: %d\n", val);
+    ok(len == sizeof(val), "got %ld\n", len);
+    trace("INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER: %ld\n", val);
 
     val = 3;
     res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
@@ -337,24 +337,24 @@ static void test_max_conns(void)
     val = 0xdeadbeef;
     res = InternetQueryOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, &len);
     ok(res,"Got wrong return value %x\n", res);
-    ok(len == sizeof(val), "got %d\n", len);
-    ok(val == 3, "got %d\n", val);
+    ok(len == sizeof(val), "got %ld\n", len);
+    ok(val == 3, "got %ld\n", val);
 
     val = 0;
     res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val));
     ok(!res || broken(res), /* <= w2k3 */
        "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER, 0) succeeded\n");
-    if (!res) ok(GetLastError() == ERROR_BAD_ARGUMENTS, "GetLastError() = %u\n", GetLastError());
+    if (!res) ok(GetLastError() == ERROR_BAD_ARGUMENTS, "GetLastError() = %lu\n", GetLastError());
 
     val = 2;
     res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val)-1);
     ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
-    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %lu\n", GetLastError());
 
     val = 2;
     res = InternetSetOptionA(NULL, INTERNET_OPTION_MAX_CONNS_PER_SERVER, &val, sizeof(val)+1);
     ok(!res, "InternetSetOptionA(INTERNET_OPTION_MAX_CONNS_PER_SERVER) succeeded\n");
-    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %lu\n", GetLastError());
 }
 
 static void test_get_cookie(void)
@@ -366,9 +366,9 @@ static void test_get_cookie(void)
   SetLastError(0xdeadbeef);
   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",
+    "InternetGetCookie should have failed with %s and error %ld\n",
     ret ? "TRUE" : "FALSE", GetLastError());
-  ok(!len, "len = %u\n", len);
+  ok(!len, "len = %lu\n", len);
 }
 
 
@@ -405,13 +405,13 @@ static void test_complicated_cookie(void)
   len = 1024;
   ret = InternetGetCookieA("http://testing.example.com", NULL, NULL, &len);
   ok(ret == TRUE,"InternetGetCookie failed\n");
-  ok(len == 19, "len = %u\n", len);
+  ok(len == 19, "len = %lu\n", len);
 
   len = 1024;
   memset(buffer, 0xac, sizeof(buffer));
   ret = InternetGetCookieA("http://testing.example.com", NULL, buffer, &len);
   ok(ret == TRUE,"InternetGetCookie failed\n");
-  ok(len == 19, "len = %u\n", len);
+  ok(len == 19, "len = %lu\n", len);
   ok(strlen(buffer) == 18, "strlen(buffer) = %u\n", lstrlenA(buffer));
   ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
   ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
@@ -426,27 +426,27 @@ static void test_complicated_cookie(void)
   memset(buffer, 0xac, sizeof(buffer));
   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);
+     "InternetGetCookie returned: %x(%lu), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
+  ok(len == 19, "len = %lu\n", len);
 
   len = 1024;
   ret = InternetGetCookieW(testing_example_comW, NULL, NULL, &len);
   ok(ret == TRUE,"InternetGetCookieW failed\n");
-  ok(len == 38, "len = %u\n", len);
+  ok(len == 38, "len = %lu\n", len);
 
   len = 1024;
   memset(wbuf, 0xac, sizeof(wbuf));
   ret = InternetGetCookieW(testing_example_comW, NULL, wbuf, &len);
   ok(ret == TRUE,"InternetGetCookieW failed\n");
-  ok(len == 19 || broken(len==18), "len = %u\n", len);
+  ok(len == 19 || broken(len==18), "len = %lu\n", len);
   ok(lstrlenW(wbuf) == 18, "strlenW(wbuf) = %u\n", lstrlenW(wbuf));
 
   len = 10;
   memset(wbuf, 0xac, sizeof(wbuf));
   ret = InternetGetCookieW(testing_example_comW, NULL, wbuf, &len);
   ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-     "InternetGetCookieW returned: %x(%u), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
-  ok(len == 38, "len = %u\n", len);
+     "InternetGetCookieW returned: %x(%lu), expected ERROR_INSUFFICIENT_BUFFER\n", ret, GetLastError());
+  ok(len == 38, "len = %lu\n", len);
 
   len = 1024;
   ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
@@ -511,7 +511,7 @@ static void test_complicated_cookie(void)
   len = 1024;
   ret = InternetGetCookieA("http://testing.example.com/bar/foo", NULL, buffer, &len);
   ok(ret == TRUE,"InternetGetCookie failed\n");
-  ok(len == 24, "len = %u\n", len);
+  ok(len == 24, "len = %lu\n", len);
   ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
   ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
   ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
@@ -525,38 +525,38 @@ static void test_complicated_cookie(void)
   len = 1024;
   ret = InternetGetCookieA("http://testing.example.com/bar/foo", "A", buffer, &len);
   ok(ret == TRUE,"InternetGetCookie failed\n");
-  ok(len == 24, "len = %u\n", len);
+  ok(len == 24, "len = %lu\n", len);
 
   /* test persistent cookies */
   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());
+  ok(ret, "InternetSetCookie failed with error %ld\n", GetLastError());
 
   /* test invalid expires parameter */
   ret = InternetSetCookieA("http://testing.example.com", NULL, "Q=R; expires=");
-  ok(ret, "InternetSetCookie failed %#x.\n", GetLastError());
+  ok(ret, "InternetSetCookie failed %#lx.\n", GetLastError());
   len = 1024;
   memset(buffer, 0xac, sizeof(buffer));
   ret = InternetGetCookieA("http://testing.example.com/", NULL, buffer, &len);
-  ok(ret, "InternetGetCookie failed %#x.\n", GetLastError());
-  ok(len == 29, "got len %u.\n", len);
+  ok(ret, "InternetGetCookie failed %#lx.\n", GetLastError());
+  ok(len == 29, "got len %lu.\n", len);
   ok(!!strstr(buffer, "Q=R"), "cookie is not present.\n");
 
   len = sizeof(buffer);
   ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
-  ok(ret, "got error %#x\n", GetLastError());
-  ok(len == 29, "got len %u\n", len);
+  ok(ret, "got error %#lx\n", GetLastError());
+  ok(len == 29, "got len %lu\n", len);
   ok(!!strstr(buffer, "A=B"), "cookie is not present\n");
 
   /* remove persistent cookie */
   ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B");
-  ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
+  ok(ret, "InternetSetCookie failed with error %ld\n", GetLastError());
 
   /* try setting cookie for different domain */
   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());
+  ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %ld\n", GetLastError());
   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());
+  ok(ret, "InternetSetCookie failed with error: %ld\n", GetLastError());
   ret = InternetSetCookieA("http://www.aaa.example.com.pl/bar",NULL,"E=F; domain=com.pl");
   todo_wine ok(!ret, "InternetSetCookie succeeded\n");
 }
@@ -573,45 +573,45 @@ static void test_cookie_attrs(void)
     }
 
     ret = InternetSetCookieA("http://cookie.attrs.com/bar", NULL, "A=data; httponly");
-    ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%lu)\n", ret, GetLastError());
 
     SetLastError(0xdeadbeef);
     state = InternetSetCookieExA("http://cookie.attrs.com/bar", NULL, "A=data; httponly", 0, 0);
     ok(state == COOKIE_STATE_REJECT && GetLastError() == ERROR_INVALID_OPERATION,
-       "InternetSetCookieEx returned: %x (%u)\n", ret, GetLastError());
+       "InternetSetCookieEx returned: %x (%lu)\n", ret, GetLastError());
 
     size = sizeof(buf);
     ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
-    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%lu)\n", ret, GetLastError());
 
     state = InternetSetCookieExA("http://cookie.attrs.com/bar",NULL,"A=data; httponly", INTERNET_COOKIE_HTTPONLY, 0);
-    ok(state == COOKIE_STATE_ACCEPT,"InternetSetCookieEx failed: %u\n", GetLastError());
+    ok(state == COOKIE_STATE_ACCEPT,"InternetSetCookieEx failed: %lu\n", GetLastError());
 
     size = sizeof(buf);
     ret = InternetGetCookieA("http://cookie.attrs.com/", NULL, buf, &size);
-    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned: %x (%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned: %x (%lu)\n", ret, GetLastError());
 
     size = sizeof(buf);
     ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, 0, NULL);
-    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieEx returned: %x (%lu)\n", ret, GetLastError());
 
     size = sizeof(buf);
     ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
-    ok(ret, "InternetGetCookieEx failed: %u\n", GetLastError());
+    ok(ret, "InternetGetCookieEx failed: %lu\n", GetLastError());
     ok(!strcmp(buf, "A=data"), "data = %s\n", buf);
 
     /* Try to override httponly cookie with non-httponly one */
     ret = InternetSetCookieA("http://cookie.attrs.com/bar", NULL, "A=test");
-    ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%u)\n", ret, GetLastError());
+    ok(!ret && GetLastError() == ERROR_INVALID_OPERATION, "InternetSetCookie returned: %x (%lu)\n", ret, GetLastError());
 
     SetLastError(0xdeadbeef);
     state = InternetSetCookieExA("http://cookie.attrs.com/bar", NULL, "A=data", 0, 0);
     ok(state == COOKIE_STATE_REJECT && GetLastError() == ERROR_INVALID_OPERATION,
-       "InternetSetCookieEx returned: %x (%u)\n", ret, GetLastError());
+       "InternetSetCookieEx returned: %x (%lu)\n", ret, GetLastError());
 
     size = sizeof(buf);
     ret = InternetGetCookieExA("http://cookie.attrs.com/", NULL, buf, &size, INTERNET_COOKIE_HTTPONLY, NULL);
-    ok(ret, "InternetGetCookieEx failed: %u\n", GetLastError());
+    ok(ret, "InternetGetCookieEx failed: %lu\n", GetLastError());
     ok(!strcmp(buf, "A=data"), "data = %s\n", buf);
 
 }
@@ -629,22 +629,22 @@ static void test_cookie_url(void)
     len = sizeof(buf);
     res = InternetGetCookieA("about:blank", NULL, buf, &len);
     ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
-       "InternetGetCookeA failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+       "InternetGetCookeA failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
 
     len = ARRAY_SIZE(bufw);
     res = InternetGetCookieW(about_blankW, NULL, bufw, &len);
     ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
-       "InternetGetCookeW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+       "InternetGetCookeW failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
 
     len = sizeof(buf);
     res = pInternetGetCookieExA("about:blank", NULL, buf, &len, 0, NULL);
     ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
-       "InternetGetCookeExA failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+       "InternetGetCookeExA failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
 
     len = ARRAY_SIZE(bufw);
     res = pInternetGetCookieExW(about_blankW, NULL, bufw, &len, 0, NULL);
     ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
-       "InternetGetCookeExW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+       "InternetGetCookeExW failed: %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
 
     p = long_url + strlen(long_url);
     memset(p, 'x', long_url+sizeof(long_url)-p);
@@ -652,16 +652,16 @@ static void test_cookie_url(void)
     p[0] = '/';
     p[2] = 0;
     res = InternetSetCookieA(long_url, NULL, "A=B");
-    ok(res, "InternetSetCookieA failed: %u\n", GetLastError());
+    ok(res, "InternetSetCookieA failed: %lu\n", GetLastError());
 
     len = sizeof(buf);
     res = InternetGetCookieA(long_url, NULL, buf, &len);
-    ok(res, "InternetGetCookieA failed: %u\n", GetLastError());
+    ok(res, "InternetGetCookieA failed: %lu\n", GetLastError());
     ok(!strcmp(buf, "A=B"), "buf = %s\n", buf);
 
     len = sizeof(buf);
     res = InternetGetCookieA("http://long.url.test.com/", NULL, buf, &len);
-    ok(!res && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieA failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieA failed: %lu\n", GetLastError());
 }
 
 static void test_null(void)
@@ -744,7 +744,7 @@ static void test_null(void)
   sz = 0;
   r = InternetGetCookieW(NULL, NULL, NULL, &sz);
   ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME,
-     "wrong error %u\n", GetLastError());
+     "wrong error %lu\n", GetLastError());
   ok( r == FALSE, "return wrong\n");
 
   r = InternetGetCookieW(szServer, NULL, NULL, &sz);
@@ -762,7 +762,7 @@ static void test_null(void)
   ok( r == TRUE, "return wrong\n");
 
   /* sz is 14 on XP SP2 and beyond, 30 on XP SP1 and before, 16 on IE11 */
-  ok( sz == 14 || sz == 16 || sz == 30, "sz wrong, got %u, expected 14, 16 or 30\n", sz);
+  ok( sz == 14 || sz == 16 || sz == 30, "sz wrong, got %lu, expected 14, 16 or 30\n", sz);
 
   sz = 0x20;
   memset(buffer, 0, sizeof buffer);
@@ -770,7 +770,7 @@ static void test_null(void)
   ok( r == TRUE, "return wrong\n");
 
   /* sz == lstrlenW(buffer) only in XP SP1 */
-  ok( sz == 1 + lstrlenW(buffer) || sz == lstrlenW(buffer), "sz wrong %d\n", sz);
+  ok( sz == 1 + lstrlenW(buffer) || sz == lstrlenW(buffer), "sz wrong %ld\n", sz);
 
   /* before XP SP2, buffer is "server; server" */
   ok( !lstrcmpW(szExpect, buffer) || !lstrcmpW(szServer, buffer) || !lstrcmpW(szServer2, buffer),
@@ -789,9 +789,9 @@ static void test_version(void)
 
     size = sizeof(version);
     res = InternetQueryOptionA(NULL, INTERNET_OPTION_VERSION, &version, &size);
-    ok(res, "Could not get version: %u\n", GetLastError());
-    ok(version.dwMajorVersion == 1, "dwMajorVersion=%d, expected 1\n", version.dwMajorVersion);
-    ok(version.dwMinorVersion == 2, "dwMinorVersion=%d, expected 2\n", version.dwMinorVersion);
+    ok(res, "Could not get version: %lu\n", GetLastError());
+    ok(version.dwMajorVersion == 1, "dwMajorVersion=%ld, expected 1\n", version.dwMajorVersion);
+    ok(version.dwMinorVersion == 2, "dwMinorVersion=%ld, expected 2\n", version.dwMinorVersion);
 }
 
 static void InternetTimeFromSystemTimeA_test(void)
@@ -803,10 +803,10 @@ static void InternetTimeFromSystemTimeA_test(void)
     DWORD error;
 
     ret = pInternetTimeFromSystemTimeA( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
-    ok( ret, "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
+    ok( ret, "InternetTimeFromSystemTimeA failed (%lu)\n", GetLastError() );
 
     ok( !memcmp( string, expect, sizeof(expect) ),
-        "InternetTimeFromSystemTimeA failed (%u)\n", GetLastError() );
+        "InternetTimeFromSystemTimeA failed (%lu)\n", GetLastError() );
 
     /* test NULL time parameter */
     SetLastError(0xdeadbeef);
@@ -814,7 +814,7 @@ static void InternetTimeFromSystemTimeA_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test NULL string parameter */
@@ -823,7 +823,7 @@ static void InternetTimeFromSystemTimeA_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test invalid format parameter */
@@ -832,7 +832,7 @@ static void InternetTimeFromSystemTimeA_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeA failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test too small buffer size */
@@ -841,7 +841,7 @@ static void InternetTimeFromSystemTimeA_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeA should have returned FALSE\n" );
     ok( error == ERROR_INSUFFICIENT_BUFFER,
-        "InternetTimeFromSystemTimeA failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
+        "InternetTimeFromSystemTimeA failed with ERROR_INSUFFICIENT_BUFFER instead of %lu\n",
         error );
 }
 
@@ -855,10 +855,10 @@ static void InternetTimeFromSystemTimeW_test(void)
     DWORD error;
 
     ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string) );
-    ok( ret, "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
+    ok( ret, "InternetTimeFromSystemTimeW failed (%lu)\n", GetLastError() );
 
     ok( !memcmp( string, expect, sizeof(expect) ),
-        "InternetTimeFromSystemTimeW failed (%u)\n", GetLastError() );
+        "InternetTimeFromSystemTimeW failed (%lu)\n", GetLastError() );
 
     /* test NULL time parameter */
     SetLastError(0xdeadbeef);
@@ -866,7 +866,7 @@ static void InternetTimeFromSystemTimeW_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test NULL string parameter */
@@ -875,7 +875,7 @@ static void InternetTimeFromSystemTimeW_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test invalid format parameter */
@@ -884,7 +884,7 @@ static void InternetTimeFromSystemTimeW_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
     ok( error == ERROR_INVALID_PARAMETER,
-        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %u\n",
+        "InternetTimeFromSystemTimeW failed with ERROR_INVALID_PARAMETER instead of %lu\n",
         error );
 
     /* test too small buffer size */
@@ -893,7 +893,7 @@ static void InternetTimeFromSystemTimeW_test(void)
     error = GetLastError();
     ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
     ok( error == ERROR_INSUFFICIENT_BUFFER,
-        "InternetTimeFromSystemTimeW failed with ERROR_INSUFFICIENT_BUFFER instead of %u\n",
+        "InternetTimeFromSystemTimeW failed with ERROR_INSUFFICIENT_BUFFER instead of %lu\n",
         error );
 }
 
@@ -946,7 +946,7 @@ static void test_InternetTimeToSystemTime(void)
         ret = pInternetTimeToSystemTimeA(test->string, NULL, 0);
         ok(!ret, "InternetTimeToSystemTimeA succeeded.\n");
         ret = pInternetTimeToSystemTimeA(test->string, &time, 0);
-        ok(ret, "InternetTimeToSystemTimeA failed: %u.\n", GetLastError());
+        ok(ret, "InternetTimeToSystemTimeA failed: %lu.\n", GetLastError());
         todo_wine_if(test->todo)
         ok(!test->match || !memcmp(&time, test->expect, sizeof(*test->expect)),
            "Got unexpected system time.\n");
@@ -957,7 +957,7 @@ static void test_InternetTimeToSystemTime(void)
         ret = pInternetTimeToSystemTimeW(buffer, NULL, 0);
         ok(!ret, "InternetTimeToSystemTimeW succeeded.\n");
         ret = pInternetTimeToSystemTimeW(buffer, &time, 0);
-        ok(ret, "InternetTimeToSystemTimeW failed: %u.\n", GetLastError());
+        ok(ret, "InternetTimeToSystemTimeW failed: %lu.\n", GetLastError());
         todo_wine_if(test->todo)
         ok(!test->match || !memcmp(&time, test->expect, sizeof(*test->expect)),
            "Got unexpected system time.\n");
@@ -1090,32 +1090,32 @@ static void test_PrivacyGetSetZonePreferenceW(void)
     zone = 3;
     type = 0;
     ret = pPrivacyGetZonePreferenceW(zone, type, NULL, NULL, NULL);
-    ok(ret == 0, "expected ret == 0, got %u\n", ret);
+    ok(ret == 0, "expected ret == 0, got %lu\n", ret);
 
     old_template = 0;
     ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, NULL, NULL);
-    ok(ret == 0, "expected ret == 0, got %u\n", ret);
+    ok(ret == 0, "expected ret == 0, got %lu\n", ret);
 
-    trace("template %u\n", old_template);
+    trace("template %lu\n", old_template);
 
     if(old_template == PRIVACY_TEMPLATE_ADVANCED) {
         pref_size = ARRAY_SIZE(pref);
         ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, pref, &pref_size);
-        ok(ret == 0, "expected ret == 0, got %u\n", ret);
+        ok(ret == 0, "expected ret == 0, got %lu\n", ret);
     }
 
     template = 5;
     ret = pPrivacySetZonePreferenceW(zone, type, template, NULL);
-    ok(ret == 0, "expected ret == 0, got %u\n", ret);
+    ok(ret == 0, "expected ret == 0, got %lu\n", ret);
 
     template = 0;
     ret = pPrivacyGetZonePreferenceW(zone, type, &template, NULL, NULL);
-    ok(ret == 0, "expected ret == 0, got %u\n", ret);
-    ok(template == 5, "expected template == 5, got %u\n", template);
+    ok(ret == 0, "expected ret == 0, got %lu\n", ret);
+    ok(template == 5, "expected template == 5, got %lu\n", template);
 
     template = 5;
     ret = pPrivacySetZonePreferenceW(zone, type, old_template, pref_size ? pref : NULL);
-    ok(ret == 0, "expected ret == 0, got %u\n", ret);
+    ok(ret == 0, "expected ret == 0, got %lu\n", ret);
 }
 
 static void test_InternetSetOption(void)
@@ -1126,43 +1126,43 @@ static void test_InternetSetOption(void)
     BOOL ret;
 
     ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
+    ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
     con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
+    ok(con != 0, "InternetConnect failed: 0x%08lx\n", GetLastError());
     req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
-    ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
+    ok(req != 0, "HttpOpenRequest failed: 0x%08lx\n", GetLastError());
 
     /* INTERNET_OPTION_POLICY tests */
     SetLastError(0xdeadbeef);
     ret = InternetSetOptionW(ses, INTERNET_OPTION_POLICY, NULL, 0);
     ok(ret == FALSE, "InternetSetOption should've failed\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
-            "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
+            "given ERROR_INVALID_PARAMETER, gave: 0x%08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = InternetQueryOptionW(ses, INTERNET_OPTION_POLICY, NULL, 0);
     ok(ret == FALSE, "InternetQueryOption should've failed\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should've "
-            "given ERROR_INVALID_PARAMETER, gave: 0x%08x\n", GetLastError());
+            "given ERROR_INVALID_PARAMETER, gave: 0x%08lx\n", GetLastError());
 
     /* INTERNET_OPTION_ERROR_MASK tests */
     SetLastError(0xdeadbeef);
     size = sizeof(ulArg);
     ret = InternetQueryOptionW(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, &size);
     ok(ret == FALSE, "InternetQueryOption should've failed\n");
-    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ulArg = 11;
     ret = InternetSetOptionA(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ulArg = 11;
     ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %ld\n", GetLastError());
 
     ulArg = 11;
     ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
@@ -1172,13 +1172,13 @@ static void test_InternetSetOption(void)
     ulArg = 4;
     ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ulArg = 16;
     ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %lx\n", GetLastError());
 
     ret = InternetSetOptionA(req, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
     ok(ret == TRUE, "InternetSetOption should've succeeded\n");
@@ -1195,19 +1195,19 @@ static void test_InternetSetOption(void)
     SetLastError(0xdeadbeef);
     ret = InternetSetOptionA(req, INTERNET_OPTION_REFRESH, NULL, 0);
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = InternetSetOptionA(con, INTERNET_OPTION_REFRESH, NULL, 0);
     ok(ret == FALSE, "InternetSetOption should've failed\n");
-    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %lu\n", GetLastError());
 
     ret = InternetCloseHandle(req);
-    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
     ret = InternetCloseHandle(con);
-    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
     ret = InternetCloseHandle(ses);
-    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(ret == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
 }
 
 static void test_end_browser_session(void)
@@ -1224,12 +1224,12 @@ static void test_end_browser_session(void)
     ok(len != 0, "len = 0\n");
 
     ret = InternetSetOptionA(NULL, INTERNET_OPTION_END_BROWSER_SESSION, NULL, 0);
-    ok(ret, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %u\n", GetLastError());
+    ok(ret, "InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n", GetLastError());
 
     len = 1024;
     ret = InternetGetCookieA("http://www.example.com/test_end", NULL, NULL, &len);
-    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned %x (%u)\n", ret, GetLastError());
-    ok(!len, "len = %u\n", len);
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookie returned %x (%lu)\n", ret, GetLastError());
+    ok(!len, "len = %lu\n", len);
 }
 
 #define verifyProxyEnable(e) r_verifyProxyEnable(__LINE__, e)
@@ -1242,15 +1242,15 @@ static void r_verifyProxyEnable(LONG l, DWORD exp)
     static const CHAR szProxyEnable[] = "ProxyEnable";
 
     ret = RegOpenKeyA(HKEY_CURRENT_USER, szInternetSettings, &hkey);
-    ok_(__FILE__,l) (!ret, "RegOpenKeyA failed: 0x%08x\n", ret);
+    ok_(__FILE__,l) (!ret, "RegOpenKeyA failed: 0x%08lx\n", ret);
 
     ret = RegQueryValueExA(hkey, szProxyEnable, 0, &type, (BYTE*)&val, &size);
-    ok_(__FILE__,l) (!ret, "RegQueryValueExA failed: 0x%08x\n", ret);
-    ok_(__FILE__,l) (type == REG_DWORD, "Expected regtype to be REG_DWORD, was: %d\n", type);
-    ok_(__FILE__,l) (val == exp, "Expected ProxyEnabled to be %d, got: %d\n", exp, val);
+    ok_(__FILE__,l) (!ret, "RegQueryValueExA failed: 0x%08lx\n", ret);
+    ok_(__FILE__,l) (type == REG_DWORD, "Expected regtype to be REG_DWORD, was: %ld\n", type);
+    ok_(__FILE__,l) (val == exp, "Expected ProxyEnabled to be %ld, got: %ld\n", exp, val);
 
     ret = RegCloseKey(hkey);
-    ok_(__FILE__,l) (!ret, "RegCloseKey failed: 0x%08x\n", ret);
+    ok_(__FILE__,l) (!ret, "RegCloseKey failed: 0x%08lx\n", ret);
 }
 
 static void test_Option_PerConnectionOption(void)
@@ -1303,7 +1303,7 @@ static void test_Option_PerConnectionOption(void)
             "Retrieved proxy server should've been %s, was: %s\n",
             wine_dbgstr_w(proxy_srvW), wine_dbgstr_w(list.pOptions[0].Value.pszValue));
     ok(list.pOptions[1].Value.dwValue == PROXY_TYPE_PROXY,
-            "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
+            "Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld\n",
             list.pOptions[1].Value.dwValue);
     verifyProxyEnable(1);
 
@@ -1334,7 +1334,7 @@ static void test_Option_PerConnectionOption(void)
             &list, &size);
     ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
     ok(list.pOptions[0].Value.dwValue == PROXY_TYPE_DIRECT,
-            "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %d\n",
+            "Retrieved flags should've been PROXY_TYPE_DIRECT, was: %ld\n",
             list.pOptions[0].Value.dwValue);
     verifyProxyEnable(0);
 
@@ -1364,7 +1364,7 @@ static void test_Option_PerConnectionOption(void)
             &list, &size);
     ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
     todo_wine ok(list.pOptions[0].Value.dwValue == (PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT),
-            "Retrieved flags should've been PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT, was: %d\n",
+            "Retrieved flags should've been PROXY_TYPE_PROXY | PROXY_TYPE_DIRECT, was: %ld\n",
             list.pOptions[0].Value.dwValue);
     verifyProxyEnable(1);
 
@@ -1431,7 +1431,7 @@ static void test_Option_PerConnectionOptionA(void)
             "Retrieved proxy server should've been \"%s\", was: \"%s\"\n",
             proxy_srv, list.pOptions[0].Value.pszValue);
     ok(list.pOptions[1].Value.dwValue == PROXY_TYPE_PROXY,
-            "Retrieved flags should've been PROXY_TYPE_PROXY, was: %d\n",
+            "Retrieved flags should've been PROXY_TYPE_PROXY, was: %ld\n",
             list.pOptions[1].Value.dwValue);
 
     HeapFree(GetProcessHeap(), 0, list.pOptions[0].Value.pszValue);
@@ -1514,17 +1514,17 @@ static void test_InternetErrorDlg(void)
     };
 
     res = InternetErrorDlg(NULL, NULL, ERROR_INTERNET_SEC_CERT_ERRORS, 0, NULL);
-    ok(res == ERROR_INVALID_HANDLE, "Got %d\n", res);
+    ok(res == ERROR_INVALID_HANDLE, "Got %ld\n", res);
 
     ses = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
-    ok(ses != 0, "InternetOpen failed: 0x%08x\n", GetLastError());
+    ok(ses != 0, "InternetOpen failed: 0x%08lx\n", GetLastError());
     con = InternetConnectA(ses, "www.winehq.org", 80, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
-    ok(con != 0, "InternetConnect failed: 0x%08x\n", GetLastError());
+    ok(con != 0, "InternetConnect failed: 0x%08lx\n", GetLastError());
     req = HttpOpenRequestA(con, "GET", "/", NULL, NULL, NULL, 0, 0);
-    ok(req != 0, "HttpOpenRequest failed: 0x%08x\n", GetLastError());
+    ok(req != 0, "HttpOpenRequest failed: 0x%08lx\n", GetLastError());
 
     hwnd = GetDesktopWindow();
-    ok(hwnd != NULL, "GetDesktopWindow failed (%d)\n", GetLastError());
+    ok(hwnd != NULL, "GetDesktopWindow failed (%ld)\n", GetLastError());
 
     for(i = INTERNET_ERROR_BASE; i < INTERNET_ERROR_LAST; i++)
     {
@@ -1544,11 +1544,11 @@ static void test_InternetErrorDlg(void)
         res = InternetErrorDlg(hwnd, (HANDLE)0xdeadbeef, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
         if(res == ERROR_CALL_NOT_IMPLEMENTED)
         {
-            ok(test_flags & FLAG_UNIMPL, "%i is unexpectedly unimplemented.\n", i);
+            ok(test_flags & FLAG_UNIMPL, "%li is unexpectedly unimplemented.\n", i);
             continue;
         }
         else
-            ok(res == ERROR_INVALID_HANDLE, "Got %d (%d)\n", res, i);
+            ok(res == ERROR_INVALID_HANDLE, "Got %ld (%ld)\n", res, i);
 
         /* With a valid req */
         if(i == ERROR_INTERNET_NEED_UI)
@@ -1580,14 +1580,14 @@ static void test_InternetErrorDlg(void)
             break;
         }
 
-        ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
+        ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
 
         /* Same thing with NULL hwnd */
         res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-        ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
+        ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
 
         res = InternetErrorDlg(NULL, req, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-        ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
+        ok(res == expected2, "Got %ld, expected %ld (%ld)\n", res, expected2, i);
 
         /* With a null req */
         if(test_flags & FLAG_NEEDREQ)
@@ -1597,24 +1597,24 @@ static void test_InternetErrorDlg(void)
         }
 
         res = InternetErrorDlg(hwnd, NULL, i, FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-        ok(res == expected, "Got %d, expected %d (%d)\n", res, expected, i);
+        ok(res == expected, "Got %ld, expected %ld (%ld)\n", res, expected, i);
 
         res = InternetErrorDlg(NULL, NULL, i, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-        ok(res == expected2, "Got %d, expected %d (%d)\n", res, expected2, i);
+        ok(res == expected2, "Got %ld, expected %ld (%ld)\n", res, expected2, i);
     }
 
     res = InternetErrorDlg(NULL, req, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-    ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res);
+    ok(res == ERROR_SUCCESS, "Got %ld, expected ERROR_SUCCESS\n", res);
 
     res = InternetErrorDlg(NULL, NULL, 0xdeadbeef, FLAGS_ERROR_UI_FILTER_FOR_ERRORS | FLAGS_ERROR_UI_FLAGS_NO_UI, NULL);
-    ok(res == ERROR_SUCCESS, "Got %d, expected ERROR_SUCCESS\n", res);
+    ok(res == ERROR_SUCCESS, "Got %ld, expected ERROR_SUCCESS\n", res);
 
     res = InternetCloseHandle(req);
-    ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
     res = InternetCloseHandle(con);
-    ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
     res = InternetCloseHandle(ses);
-    ok(res == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
+    ok(res == TRUE, "InternetCloseHandle failed: 0x%08lx\n", GetLastError());
 }
 
 static void test_InternetGetConnectedStateExA(void)
@@ -1631,7 +1631,7 @@ static void test_InternetGetConnectedStateExA(void)
     flags = 0;
     buffer[0] = 0;
     res = pInternetGetConnectedStateExA(&flags, buffer, sizeof(buffer), 0);
-    trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, buffer);
+    trace("Internet Connection: Flags 0x%02lx - Name '%s'\n", flags, buffer);
     todo_wine
     ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
     if(!res) {
@@ -1688,14 +1688,14 @@ static void test_InternetGetConnectedStateExA(void)
     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));
+    ok(sz - 1 == strlen(buffer), "Expected %lu bytes, got %u\n", sz - 1, lstrlenA(buffer));
 
     buffer[0] = 0;
     flags = 0;
     res = pInternetGetConnectedStateExA(&flags, buffer, sz / 2, 0);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
     ok(flags, "Expected at least one flag set\n");
-    ok(sz / 2 - 1 == strlen(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1, lstrlenA(buffer));
+    ok(sz / 2 - 1 == strlen(buffer), "Expected %lu bytes, got %u\n", sz / 2 - 1, lstrlenA(buffer));
 
     buffer[0] = 0;
     flags = 0;
@@ -1733,7 +1733,7 @@ static void test_InternetGetConnectedStateExW(void)
     flags = 0;
     buffer[0] = 0;
     res = pInternetGetConnectedStateExW(&flags, buffer, ARRAY_SIZE(buffer), 0);
-    trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
+    trace("Internet Connection: Flags 0x%02lx - Name '%s'\n", flags, wine_dbgstr_w(buffer));
     todo_wine
     ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
     if(!res) {
@@ -1793,7 +1793,7 @@ static void test_InternetGetConnectedStateExW(void)
     if (flags & INTERNET_CONNECTION_MODEM)
         ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
     else
-        ok(sz - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenW(buffer));
+        ok(sz - 1 == lstrlenW(buffer), "Expected %lu bytes, got %u\n", sz - 1, lstrlenW(buffer));
 
     buffer[0] = 0;
     flags = 0;
@@ -1803,7 +1803,7 @@ static void test_InternetGetConnectedStateExW(void)
     if (flags & INTERNET_CONNECTION_MODEM)
         ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
     else
-        ok(sz / 2 - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1, lstrlenW(buffer));
+        ok(sz / 2 - 1 == lstrlenW(buffer), "Expected %lu bytes, got %u\n", sz / 2 - 1, lstrlenW(buffer));
 
     buffer[0] = 0;
     flags = 0;
@@ -1838,55 +1838,55 @@ static void test_format_message(HMODULE hdll)
     /* These messages come from wininet and not the system. */
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM , NULL, ERROR_INTERNET_TIMEOUT,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret == 0, "FormatMessageA returned %d\n", ret);
+    ok(ret == 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_TIMEOUT,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_INTERNAL_ERROR,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_INVALID_URL,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_UNRECOGNIZED_SCHEME,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_NAME_NOT_RESOLVED,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_INVALID_OPERATION,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0 || broken(!ret) /* XP, w2k3 */, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0 || broken(!ret) /* XP, w2k3 */, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_OPERATION_CANCELLED,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_ITEM_NOT_FOUND,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_CANNOT_CONNECT,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_CONNECTION_ABORTED,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_SEC_CERT_DATE_INVALID,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 
     ret = FormatMessageA(FORMAT_MESSAGE_FROM_HMODULE, hdll, ERROR_INTERNET_SEC_CERT_CN_INVALID,
                          MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out), NULL);
-    ok(ret != 0, "FormatMessageA returned %d\n", ret);
+    ok(ret != 0, "FormatMessageA returned %ld\n", ret);
 }
 
 /* ############################### */
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 59b66a5404c..aa8977973a6 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -212,14 +212,14 @@ static void test_crack_url(const crack_url_test_t *test)
     zero_compsA(&url, 1, 1, 1, 1, 1, 1);
 
     b = InternetCrackUrlA(test->url, strlen(test->url), 0, &url);
-    ok(b, "InternetCrackUrl failed with error %d\n", GetLastError());
+    ok(b, "InternetCrackUrl failed with error %ld\n", GetLastError());
 
     if(test->scheme_off == -1)
         ok(!url.lpszScheme, "[%s] url.lpszScheme = %p, expected NULL\n", test->url, url.lpszScheme);
     else
         ok(url.lpszScheme == test->url+test->scheme_off, "[%s] url.lpszScheme = %p, expected %p\n",
            test->url, url.lpszScheme, test->url+test->scheme_off);
-    ok(url.dwSchemeLength == test->scheme_len, "[%s] url.lpszSchemeLength = %d, expected %d\n",
+    ok(url.dwSchemeLength == test->scheme_len, "[%s] url.lpszSchemeLength = %ld, expected %d\n",
        test->url, url.dwSchemeLength, test->scheme_len);
 
     ok(url.nScheme == test->scheme, "[%s] url.nScheme = %d, expected %d\n", test->url, url.nScheme, test->scheme);
@@ -233,7 +233,7 @@ static void test_crack_url(const crack_url_test_t *test)
         win_skip("skipping broken dwHostNameLength result\n");
         return;
     }
-    ok(url.dwHostNameLength == test->host_len, "[%s] url.lpszHostNameLength = %d, expected %d\n",
+    ok(url.dwHostNameLength == test->host_len, "[%s] url.lpszHostNameLength = %ld, expected %d\n",
        test->url, url.dwHostNameLength, test->host_len);
 
     ok(url.nPort == test->port, "[%s] nPort = %d, expected %d\n", test->url, url.nPort, test->port);
@@ -243,7 +243,7 @@ static void test_crack_url(const crack_url_test_t *test)
     else
         ok(url.lpszUserName == test->url+test->user_off, "[%s] url.lpszUserName = %p, expected %p\n",
            test->url, url.lpszUserName, test->url+test->user_off);
-    ok(url.dwUserNameLength == test->user_len, "[%s] url.lpszUserNameLength = %d, expected %d\n",
+    ok(url.dwUserNameLength == test->user_len, "[%s] url.lpszUserNameLength = %ld, expected %d\n",
        test->url, url.dwUserNameLength, test->user_len);
 
     if(test->pass_off == -1)
@@ -251,7 +251,7 @@ static void test_crack_url(const crack_url_test_t *test)
     else
         ok(url.lpszPassword == test->url+test->pass_off, "[%s] url.lpszPassword = %p, expected %p\n",
            test->url, url.lpszPassword, test->url+test->pass_off);
-    ok(url.dwPasswordLength == test->pass_len, "[%s] url.lpszPasswordLength = %d, expected %d\n",
+    ok(url.dwPasswordLength == test->pass_len, "[%s] url.lpszPasswordLength = %ld, expected %d\n",
        test->url, url.dwPasswordLength, test->pass_len);
 
     if(test->path_off == -1)
@@ -259,7 +259,7 @@ static void test_crack_url(const crack_url_test_t *test)
     else
         ok(url.lpszUrlPath == test->url+test->path_off, "[%s] url.lpszUrlPath = %p, expected %p\n",
            test->url, url.lpszUrlPath, test->url+test->path_off);
-    ok(url.dwUrlPathLength == test->path_len, "[%s] url.lpszUrlPathLength = %d, expected %d\n",
+    ok(url.dwUrlPathLength == test->path_len, "[%s] url.lpszUrlPathLength = %ld, expected %d\n",
        test->url, url.dwUrlPathLength, test->path_len);
 
     if(test->extra_off == -1)
@@ -267,7 +267,7 @@ static void test_crack_url(const crack_url_test_t *test)
     else
         ok(url.lpszExtraInfo == test->url+test->extra_off, "[%s] url.lpszExtraInfo = %p, expected %p\n",
            test->url, url.lpszExtraInfo, test->url+test->extra_off);
-    ok(url.dwExtraInfoLength == test->extra_len, "[%s] url.lpszExtraInfoLength = %d, expected %d\n",
+    ok(url.dwExtraInfoLength == test->extra_len, "[%s] url.lpszExtraInfoLength = %ld, expected %d\n",
        test->url, url.dwExtraInfoLength, test->extra_len);
 
     /* test InternetCrackUrlW with NULL buffers */
@@ -287,26 +287,26 @@ static void test_crack_url(const crack_url_test_t *test)
         HeapFree(GetProcessHeap(), 0, buf);
         return;
     }
-    ok(b, "InternetCrackUrl failed with error %d\n", GetLastError());
+    ok(b, "InternetCrackUrl failed with error %ld\n", GetLastError());
 
     if(test->scheme_off == -1)
         ok(!urlw.lpszScheme, "[%s] urlw.lpszScheme = %p, expected NULL\n", test->url, urlw.lpszScheme);
     else
         ok(urlw.lpszScheme == buf+test->scheme_off, "[%s] urlw.lpszScheme = %p, expected %p\n",
            test->url, urlw.lpszScheme, buf+test->scheme_off);
-    ok(urlw.dwSchemeLength == test->scheme_len, "[%s] urlw.lpszSchemeLength = %d, expected %d\n",
+    ok(urlw.dwSchemeLength == test->scheme_len, "[%s] urlw.lpszSchemeLength = %ld, expected %d\n",
        test->url, urlw.dwSchemeLength, test->scheme_len);
 
     ok(urlw.nScheme == test->scheme, "[%s] urlw.nScheme = %d, expected %d\n", test->url, urlw.nScheme, test->scheme);
 
     if(test->host_off == -1) {
         ok(!urlw.lpszHostName, "[%s] urlw.lpszHostName = %p, expected NULL\n", test->url, urlw.lpszHostName);
-        ok(urlw.dwHostNameLength == 0 || broken(urlw.dwHostNameLength == 1), "[%s] urlw.lpszHostNameLength = %d, expected %d\n",
+        ok(urlw.dwHostNameLength == 0 || broken(urlw.dwHostNameLength == 1), "[%s] urlw.lpszHostNameLength = %ld, expected %d\n",
            test->url, urlw.dwHostNameLength, test->host_len);
     }else {
         ok(urlw.lpszHostName == buf+test->host_off, "[%s] urlw.lpszHostName = %p, expected %p\n",
            test->url, urlw.lpszHostName, test->url+test->host_off);
-        ok(urlw.dwHostNameLength == test->host_len, "[%s] urlw.lpszHostNameLength = %d, expected %d\n",
+        ok(urlw.dwHostNameLength == test->host_len, "[%s] urlw.lpszHostNameLength = %ld, expected %d\n",
            test->url, urlw.dwHostNameLength, test->host_len);
     }
 
@@ -314,23 +314,23 @@ static void test_crack_url(const crack_url_test_t *test)
 
     if(test->user_off == -1) {
         ok(!urlw.lpszUserName, "[%s] urlw.lpszUserName = %p\n", test->url, urlw.lpszUserName);
-        ok(urlw.dwUserNameLength == 0 || broken(urlw.dwUserNameLength == 1), "[%s] urlw.lpszUserNameLength = %d, expected %d\n",
+        ok(urlw.dwUserNameLength == 0 || broken(urlw.dwUserNameLength == 1), "[%s] urlw.lpszUserNameLength = %ld, expected %d\n",
            test->url, urlw.dwUserNameLength, test->user_len);
     }else {
         ok(urlw.lpszUserName == buf+test->user_off, "[%s] urlw.lpszUserName = %p, expected %p\n",
            test->url, urlw.lpszUserName, buf+test->user_off);
-        ok(urlw.dwUserNameLength == test->user_len, "[%s] urlw.lpszUserNameLength = %d, expected %d\n",
+        ok(urlw.dwUserNameLength == test->user_len, "[%s] urlw.lpszUserNameLength = %ld, expected %d\n",
            test->url, urlw.dwUserNameLength, test->user_len);
     }
 
     if(test->pass_off == -1) {
         ok(!urlw.lpszPassword, "[%s] urlw.lpszPassword = %p\n", test->url, urlw.lpszPassword);
-        ok(urlw.dwPasswordLength == 0 || broken(urlw.dwPasswordLength), "[%s] urlw.lpszPasswordLength = %d, expected %d\n",
+        ok(urlw.dwPasswordLength == 0 || broken(urlw.dwPasswordLength), "[%s] urlw.lpszPasswordLength = %ld, expected %d\n",
            test->url, urlw.dwPasswordLength, test->pass_len);
     }else {
         ok(urlw.lpszPassword == buf+test->pass_off, "[%s] urlw.lpszPassword = %p, expected %p\n",
            test->url, urlw.lpszPassword, buf+test->pass_off);
-        ok(urlw.dwPasswordLength == test->pass_len, "[%s] urlw.lpszPasswordLength = %d, expected %d\n",
+        ok(urlw.dwPasswordLength == test->pass_len, "[%s] urlw.lpszPasswordLength = %ld, expected %d\n",
            test->url, urlw.dwPasswordLength, test->pass_len);
     }
 
@@ -339,17 +339,17 @@ static void test_crack_url(const crack_url_test_t *test)
     else
         ok(urlw.lpszUrlPath == buf+test->path_off, "[%s] urlw.lpszUrlPath = %p, expected %p\n",
            test->url, urlw.lpszUrlPath, buf+test->path_off);
-    ok(urlw.dwUrlPathLength == test->path_len, "[%s] urlw.lpszUrlPathLength = %d, expected %d\n",
+    ok(urlw.dwUrlPathLength == test->path_len, "[%s] urlw.lpszUrlPathLength = %ld, expected %d\n",
        test->url, urlw.dwUrlPathLength, test->path_len);
 
     if(test->extra_off == -1) {
         ok(!urlw.lpszExtraInfo, "[%s] url.lpszExtraInfo = %p, expected NULL\n", test->url, urlw.lpszExtraInfo);
-        ok(urlw.dwExtraInfoLength == 0 || broken(urlw.dwExtraInfoLength == 1), "[%s] urlw.lpszExtraInfoLength = %d, expected %d\n",
+        ok(urlw.dwExtraInfoLength == 0 || broken(urlw.dwExtraInfoLength == 1), "[%s] urlw.lpszExtraInfoLength = %ld, expected %d\n",
            test->url, urlw.dwExtraInfoLength, test->extra_len);
     }else {
         ok(urlw.lpszExtraInfo == buf+test->extra_off, "[%s] urlw.lpszExtraInfo = %p, expected %p\n",
            test->url, urlw.lpszExtraInfo, buf+test->extra_off);
-        ok(urlw.dwExtraInfoLength == test->extra_len, "[%s] urlw.lpszExtraInfoLength = %d, expected %d\n",
+        ok(urlw.dwExtraInfoLength == test->extra_len, "[%s] urlw.lpszExtraInfoLength = %ld, expected %d\n",
            test->url, urlw.dwExtraInfoLength, test->extra_len);
     }
 
@@ -376,9 +376,9 @@ static void test_crack_url(const crack_url_test_t *test)
     url.dwExtraInfoLength = buf_len;
 
     b = InternetCrackUrlA(test->url, strlen(test->url), 0, &url);
-    ok(b, "InternetCrackUrlA failed with error %d\n", GetLastError());
+    ok(b, "InternetCrackUrlA failed with error %ld\n", GetLastError());
 
-    ok(url.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %d\n",
+    ok(url.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %ld\n",
        test->url, url.dwSchemeLength);
     ok(!strcmp(scheme_a, test->exp_scheme), "[%s] Got wrong scheme, expected: %s, got: %s\n",
        test->url, test->exp_scheme, scheme_a);
@@ -386,7 +386,7 @@ static void test_crack_url(const crack_url_test_t *test)
     ok(url.nScheme == test->scheme, "[%s] Got wrong nScheme, expected: %d, got: %d\n",
        test->url, test->scheme, url.nScheme);
 
-    ok(url.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %d\n",
+    ok(url.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %ld\n",
        test->url, url.dwHostNameLength);
     ok(!strcmp(hostname_a, test->exp_hostname), "[%s] Got wrong hostname, expected: %s, got: %s\n",
        test->url, test->exp_hostname, hostname_a);
@@ -394,22 +394,22 @@ static void test_crack_url(const crack_url_test_t *test)
     ok(url.nPort == test->port, "[%s] Got wrong port, expected: %d, got: %d\n",
        test->url, test->port, url.nPort);
 
-    ok(url.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %d\n",
+    ok(url.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %ld\n",
        test->url, url.dwUserNameLength);
     ok(!strcmp(username_a, test->exp_username), "[%s] Got wrong username, expected: %s, got: %s\n",
        test->url, test->exp_username, username_a);
 
-    ok(url.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %d\n",
+    ok(url.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %ld\n",
        test->url, url.dwPasswordLength);
     ok(!strcmp(password_a, test->exp_password), "[%s] Got wrong password, expected: %s, got: %s\n",
        test->url, test->exp_password, password_a);
 
-    ok(url.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %d\n",
+    ok(url.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %ld\n",
        test->url, url.dwUrlPathLength);
     ok(!strcmp(urlpath_a, test->exp_urlpath), "[%s] Got wrong urlpath, expected: %s, got: %s\n",
        test->url, test->exp_urlpath, urlpath_a);
 
-    ok(url.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %d\n",
+    ok(url.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %ld\n",
        test->url, url.dwExtraInfoLength);
     ok(!strcmp(extrainfo_a, test->exp_extrainfo), "[%s] Got wrong extrainfo, expected: %s, got: %s\n",
        test->url, test->exp_extrainfo, extrainfo_a);
@@ -431,9 +431,9 @@ static void test_crack_url(const crack_url_test_t *test)
     urlw.dwExtraInfoLength = buf_len;
 
     b = InternetCrackUrlW(buf, lstrlenW(buf), 0, &urlw);
-    ok(b, "InternetCrackUrlW failed with error %d\n", GetLastError());
+    ok(b, "InternetCrackUrlW failed with error %ld\n", GetLastError());
 
-    ok(urlw.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %d\n",
+    ok(urlw.dwSchemeLength == strlen(test->exp_scheme), "[%s] Got wrong scheme length: %ld\n",
        test->url, urlw.dwSchemeLength);
     ok(!strcmp_wa(scheme_w, test->exp_scheme), "[%s] Got wrong scheme, expected: %s, got: %s\n",
        test->url, test->exp_scheme, wine_dbgstr_w(scheme_w));
@@ -441,7 +441,7 @@ static void test_crack_url(const crack_url_test_t *test)
     ok(urlw.nScheme == test->scheme, "[%s] Got wrong nScheme, expected: %d, got: %d\n",
        test->url, test->scheme, urlw.nScheme);
 
-    ok(urlw.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %d\n",
+    ok(urlw.dwHostNameLength == strlen(test->exp_hostname), "[%s] Got wrong hostname length: %ld\n",
        test->url, urlw.dwHostNameLength);
     ok(!strcmp_wa(hostname_w, test->exp_hostname), "[%s] Got wrong hostname, expected: %s, got: %s\n",
        test->url, test->exp_hostname, wine_dbgstr_w(hostname_w));
@@ -449,22 +449,22 @@ static void test_crack_url(const crack_url_test_t *test)
     ok(urlw.nPort == test->port, "[%s] Got wrong port, expected: %d, got: %d\n",
        test->url, test->port, urlw.nPort);
 
-    ok(urlw.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %d\n",
+    ok(urlw.dwUserNameLength == strlen(test->exp_username), "[%s] Got wrong username length: %ld\n",
        test->url, urlw.dwUserNameLength);
     ok(!strcmp_wa(username_w, test->exp_username), "[%s] Got wrong username, expected: %s, got: %s\n",
        test->url, test->exp_username, wine_dbgstr_w(username_w));
 
-    ok(urlw.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %d\n",
+    ok(urlw.dwPasswordLength == strlen(test->exp_password), "[%s] Got wrong password length: %ld\n",
        test->url, urlw.dwPasswordLength);
     ok(!strcmp_wa(password_w, test->exp_password), "[%s] Got wrong password, expected: %s, got: %s\n",
        test->url, test->exp_password, wine_dbgstr_w(password_w));
 
-    ok(urlw.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %d\n",
+    ok(urlw.dwUrlPathLength == strlen(test->exp_urlpath), "[%s] Got wrong urlpath length: %ld\n",
        test->url, urlw.dwUrlPathLength);
     ok(!strcmp_wa(urlpath_w, test->exp_urlpath), "[%s] Got wrong urlpath, expected: %s, got: %s\n",
        test->url, test->exp_urlpath, wine_dbgstr_w(urlpath_w));
 
-    ok(urlw.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %d\n",
+    ok(urlw.dwExtraInfoLength == strlen(test->exp_extrainfo), "[%s] Got wrong extrainfo length: %ld\n",
        test->url, urlw.dwExtraInfoLength);
     ok(!strcmp_wa(extrainfo_w, test->exp_extrainfo), "[%s] Got wrong extrainfo, expected: %s, got: %s\n",
        test->url, test->exp_extrainfo, wine_dbgstr_w(extrainfo_w));
@@ -507,12 +507,12 @@ static void test_long_url(void)
     zero_compsA(&url_comp, 0, 0, 0, 0, 0, 100);
     url_comp.lpszExtraInfo = long_buf;
     b = InternetCrackUrlA(long_url, strlen(long_url), 0, &url_comp);
-    ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %d\n", b, GetLastError());
+    ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %ld\n", b, GetLastError());
 
     zero_compsA(&url_comp, 4, 0, 0, 0, 0, 0);
     url_comp.lpszScheme = long_buf;
     b = InternetCrackUrlA(long_url, strlen(long_url), 0, &url_comp);
-    ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %d\n", b, GetLastError());
+    ok(!b && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "InternetCrackUrlA returned %x with error %ld\n", b, GetLastError());
 }
 
 static void InternetCrackUrl_test(void)
@@ -549,21 +549,21 @@ static void InternetCrackUrl_test(void)
   SetLastError(0xdeadbeef);
   ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
   GLE = GetLastError();
-  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%d (expected to return %d)\n",
+  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%ld (expected to return %d)\n",
     ret, GLE, firstret);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 0, 1024, 1024, 1024);
   SetLastError(0xdeadbeef);
   ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
   GLE = GetLastError();
-  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%d (expected to return %d)\n",
+  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%ld (expected to return %d)\n",
     ret, GLE, firstret);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 0, 1024, 1024);
   SetLastError(0xdeadbeef);
   ret = InternetCrackUrlA(TEST_URL3, 0, ICU_DECODE, &urlComponents);
   GLE = GetLastError();
-  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%d (expected to return %d)\n",
+  ok(ret==firstret && (GLE==firstGLE), "InternetCrackUrl returned %d with GLE=%ld (expected to return %d)\n",
     ret, GLE, firstret);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 0, 1024);
@@ -572,7 +572,7 @@ static void InternetCrackUrl_test(void)
   GLE = GetLastError();
   todo_wine
   ok(ret==0 && (GLE==ERROR_INVALID_HANDLE || GLE==ERROR_INSUFFICIENT_BUFFER),
-     "InternetCrackUrl returned %d with GLE=%d (expected to return 0 and ERROR_INVALID_HANDLE or ERROR_INSUFFICIENT_BUFFER)\n",
+     "InternetCrackUrl returned %d with GLE=%ld (expected to return 0 and ERROR_INVALID_HANDLE or ERROR_INSUFFICIENT_BUFFER)\n",
     ret, GLE);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 0);
@@ -581,7 +581,7 @@ static void InternetCrackUrl_test(void)
   GLE = GetLastError();
   todo_wine
   ok(ret==0 && (GLE==ERROR_INVALID_HANDLE || GLE==ERROR_INSUFFICIENT_BUFFER),
-     "InternetCrackUrl returned %d with GLE=%d (expected to return 0 and ERROR_INVALID_HANDLE or ERROR_INSUFFICIENT_BUFFER)\n",
+     "InternetCrackUrl returned %d with GLE=%ld (expected to return 0 and ERROR_INVALID_HANDLE or ERROR_INSUFFICIENT_BUFFER)\n",
     ret, GLE);
 
   copy_compsA(&urlSrc, &urlComponents, 0, 0, 0, 0, 0, 0);
@@ -589,12 +589,12 @@ static void InternetCrackUrl_test(void)
   GLE = GetLastError();
   todo_wine
   ok(ret==0 && GLE==ERROR_INVALID_PARAMETER,
-     "InternetCrackUrl returned %d with GLE=%d (expected to return 0 and ERROR_INVALID_PARAMETER)\n",
+     "InternetCrackUrl returned %d with GLE=%ld (expected to return 0 and ERROR_INVALID_PARAMETER)\n",
     ret, GLE);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
   ret = InternetCrackUrlA("about://host/blank", 0,0,&urlComponents);
-  ok(ret, "InternetCrackUrl failed with %d\n", GetLastError());
+  ok(ret, "InternetCrackUrl failed with %ld\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);
   ok(!strcmp(urlComponents.lpszUrlPath, "/blank"), "lpszUrlPath was \"%s\" instead of \"/blank\"\n", urlComponents.lpszUrlPath);
@@ -605,7 +605,7 @@ static void InternetCrackUrl_test(void)
   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);
+  ok(GLE == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GLE);
 
   /* try an empty lpszUrl, GetLastError returns 12006, whatever that means
    * we just need to fail and not return success
@@ -658,9 +658,9 @@ static void InternetCrackUrl_test(void)
    * that length, it stops there. */
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
   ret = InternetCrackUrlA("http://x.org", 13 /* includes the nul */, 0, &urlComponents);
-  ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError());
+  ok(ret, "InternetCrackUrlA failed with error %ld\n", GetLastError());
   ok(urlComponents.dwHostNameLength == 5,
-     "Expected dwHostNameLength of 5, got %d\n", urlComponents.dwHostNameLength);
+     "Expected dwHostNameLength of 5, got %ld\n", urlComponents.dwHostNameLength);
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
   ret = InternetCrackUrlA("http://\0x.org", 13, 0, &urlComponents);
@@ -668,9 +668,9 @@ static void InternetCrackUrl_test(void)
 
   copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 1024, 1024);
   ret = InternetCrackUrlA("http://x.org\0/x", 15, 0, &urlComponents);
-  ok(ret, "InternetCrackUrlA failed with error %d\n", GetLastError());
+  ok(ret, "InternetCrackUrlA failed with error %ld\n", GetLastError());
   ok(urlComponents.dwUrlPathLength == 0,
-    "Expected dwUrlPathLength of 0, got %d\n", urlComponents.dwUrlPathLength);
+    "Expected dwUrlPathLength of 0, got %ld\n", urlComponents.dwUrlPathLength);
 }
 
 static void InternetCrackUrlW_test(void)
@@ -721,7 +721,7 @@ static void InternetCrackUrlW_test(void)
     ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
     ok( error == ERROR_INVALID_PARAMETER ||
         broken(error == ERROR_INTERNET_UNRECOGNIZED_SCHEME), /* IE5 */
-        "expected ERROR_INVALID_PARAMETER got %u\n", error);
+        "expected ERROR_INVALID_PARAMETER got %lu\n", error);
 
     if (error == ERROR_INVALID_PARAMETER)
     {
@@ -730,7 +730,7 @@ static void InternetCrackUrlW_test(void)
         r = InternetCrackUrlW(url, 0, 0, NULL );
         error = GetLastError();
         ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
-        ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
+        ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %lu\n", error);
     }
 
     r = InternetCrackUrlW(url, 0, 0, &comp );
@@ -804,7 +804,7 @@ static void InternetCrackUrlW_test(void)
     r = InternetCrackUrlW(url2, 0, 0, &comp);
     ok(!r, "InternetCrackUrl should have failed\n");
     ok(GetLastError() == ERROR_INTERNET_UNRECOGNIZED_SCHEME,
-        "InternetCrackUrl should have failed with error ERROR_INTERNET_UNRECOGNIZED_SCHEME instead of error %d\n",
+        "InternetCrackUrl should have failed with error ERROR_INTERNET_UNRECOGNIZED_SCHEME instead of error %ld\n",
         GetLastError());
 
     /* Test to see whether cracking a URL without a filename initializes urlpart */
@@ -854,9 +854,9 @@ static void InternetCrackUrlW_test(void)
     comp.lpszHostName = host;
     comp.dwHostNameLength = ARRAY_SIZE(host);
     r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp);
-    ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
+    ok(r, "InternetCrackUrlW failed with error %ld\n", GetLastError());
     ok(comp.dwHostNameLength == 5,
-        "Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength);
+        "Expected dwHostNameLength of 5, got %ld\n", comp.dwHostNameLength);
 
     host[0] = 0;
     memset(&comp, 0, sizeof(comp));
@@ -875,9 +875,9 @@ static void InternetCrackUrlW_test(void)
     comp.lpszUrlPath = urlpart;
     comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
     r = InternetCrackUrlW(url5, 15, 0, &comp);
-    ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
+    ok(r, "InternetCrackUrlW failed with error %ld\n", GetLastError());
     ok(comp.dwUrlPathLength == 0,
-        "Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength);
+        "Expected dwUrlPathLength of 0, got %ld\n", comp.dwUrlPathLength);
 }
 
 static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
@@ -932,8 +932,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(NULL, 0, NULL, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INVALID_PARAMETER,
-		"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-	ok(len == -1, "Expected len -1, got %d\n", len);
+		"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
+	ok(len == -1, "Expected len -1, got %ld\n", len);
 
 	/* test zero'ed lpUrlComponents */
 	ZeroMemory(&urlComp, sizeof(urlComp));
@@ -941,8 +941,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, NULL, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INVALID_PARAMETER,
-		"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-	ok(len == -1, "Expected len -1, got %d\n", len);
+		"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
+	ok(len == -1, "Expected len -1, got %ld\n", len);
 
 	/* test valid lpUrlComponents, NULL lpdwUrlLength */
 	fill_url_components(&urlComp);
@@ -950,7 +950,7 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, NULL, NULL);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INVALID_PARAMETER,
-		"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+		"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
 	/* test valid lpUrlComponents, empty szUrl
 	 * lpdwUrlLength is size of buffer required on exit, including
@@ -960,8 +960,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, NULL, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-		"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
-	ok(len == 51, "Expected len 51, got %d\n", len);
+		"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
+	ok(len == 51, "Expected len 51, got %ld\n", len);
 
 	/* test correct size, NULL szUrl */
 	fill_url_components(&urlComp);
@@ -969,8 +969,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, NULL, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-		"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
-	ok(len == 51, "Expected len 51, got %d\n", len);
+		"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
+	ok(len == 51, "Expected len 51, got %ld\n", len);
 
 	/* test valid lpUrlComponents, alloc-ed szUrl, small size */
 	SetLastError(0xdeadbeef);
@@ -979,8 +979,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-		"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
-	ok(len == 51, "Expected len 51, got %d\n", len);
+		"Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
+	ok(len == 51, "Expected len 51, got %ld\n", len);
 
 	/* alloc-ed szUrl, NULL lpszScheme
 	 * shows that it uses nScheme instead
@@ -988,7 +988,7 @@ static void InternetCreateUrlA_test(void)
 	urlComp.lpszScheme = NULL;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL1), "Expected %s, got %s\n", CREATE_URL1, szUrl);
 
 	/* alloc-ed szUrl, invalid nScheme
@@ -999,14 +999,14 @@ static void InternetCreateUrlA_test(void)
 	len++;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 
 	/* test valid lpUrlComponents, alloc-ed szUrl */
 	fill_url_components(&urlComp);
 	len = 51;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 	ok(strstr(szUrl, "80") == NULL, "Didn't expect to find 80 in szUrl\n");
 	ok(!strcmp(szUrl, CREATE_URL1), "Expected %s, got %s\n", CREATE_URL1, szUrl);
 
@@ -1016,7 +1016,7 @@ static void InternetCreateUrlA_test(void)
 	len = 42;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 41, "Expected len 41, got %d\n", len);
+	ok(len == 41, "Expected len 41, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL2), "Expected %s, got %s\n", CREATE_URL2, szUrl);
 
 	/* valid username, empty password */
@@ -1025,7 +1025,7 @@ static void InternetCreateUrlA_test(void)
 	len = 51;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL3), "Expected %s, got %s\n", CREATE_URL3, szUrl);
 
 	/* valid password, NULL username
@@ -1038,8 +1038,8 @@ static void InternetCreateUrlA_test(void)
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(!ret, "Expected failure\n");
 	ok(GetLastError() == ERROR_INVALID_PARAMETER,
-		"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
-	ok(len == 42, "Expected len 42, got %d\n", len);
+		"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
+	ok(len == 42, "Expected len 42, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL3), "Expected %s, got %s\n", CREATE_URL3, szUrl);
 
 	/* valid password, empty username
@@ -1050,7 +1050,7 @@ static void InternetCreateUrlA_test(void)
 	len = 51;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL5), "Expected %s, got %s\n", CREATE_URL5, szUrl);
 
 	/* NULL username, NULL password */
@@ -1060,7 +1060,7 @@ static void InternetCreateUrlA_test(void)
 	len = 42;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 32, "Expected len 32, got %d\n", len);
+	ok(len == 32, "Expected len 32, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL4), "Expected %s, got %s\n", CREATE_URL4, szUrl);
 
 	/* empty username, empty password */
@@ -1070,7 +1070,7 @@ static void InternetCreateUrlA_test(void)
 	len = 51;
 	ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 50, "Expected len 50, got %d\n", len);
+	ok(len == 50, "Expected len 50, got %ld\n", len);
 	ok(!strcmp(szUrl, CREATE_URL5), "Expected %s, got %s\n", CREATE_URL5, szUrl);
 
 	/* shows that nScheme is ignored, as the appearance of the port number
@@ -1084,7 +1084,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL6), "Expected len %d, got %d\n", lstrlenA(CREATE_URL6) + 1, len);
+	ok(len == strlen(CREATE_URL6), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL6) + 1, len);
 	ok(!strcmp(szUrl, CREATE_URL6), "Expected %s, got %s\n", CREATE_URL6, szUrl);
 
 	/* if lpszScheme != "http" or nPort != 80, display nPort */
@@ -1095,7 +1095,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == 53, "Expected len 53, got %d\n", len);
+	ok(len == 53, "Expected len 53, got %ld\n", len);
 	ok(strstr(szUrl, "42") != NULL, "Expected to find 42 in szUrl\n");
 	ok(!strcmp(szUrl, CREATE_URL7), "Expected %s, got %s\n", CREATE_URL7, szUrl);
 
@@ -1121,7 +1121,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL1), "Expected len %d, got %d\n", lstrlenA(CREATE_URL1), len);
+	ok(len == strlen(CREATE_URL1), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL1), len);
 	ok(!strcmp(szUrl, CREATE_URL1), "Expected %s, got %s\n", CREATE_URL1, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1146,7 +1146,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL8), "Expected len %d, got %d\n", lstrlenA(CREATE_URL8), len);
+	ok(len == strlen(CREATE_URL8), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL8), len);
 	ok(!strcmp(szUrl, CREATE_URL8), "Expected %s, got %s\n", CREATE_URL8, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1162,7 +1162,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL9), "Expected len %d, got %d\n", lstrlenA(CREATE_URL9), len);
+	ok(len == strlen(CREATE_URL9), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL9), len);
 	ok(!strcmp(szUrl, CREATE_URL9), "Expected %s, got %s\n", CREATE_URL9, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1177,7 +1177,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL10), "Expected len %d, got %d\n", lstrlenA(CREATE_URL10), len);
+	ok(len == strlen(CREATE_URL10), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL10), len);
 	ok(!strcmp(szUrl, CREATE_URL10), "Expected %s, got %s\n", CREATE_URL10, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1190,7 +1190,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL11), "Expected len %d, got %d\n", lstrlenA(CREATE_URL11), len);
+	ok(len == strlen(CREATE_URL11), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL11), len);
 	ok(!strcmp(szUrl, CREATE_URL11), "Expected %s, got %s\n", CREATE_URL11, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1207,7 +1207,7 @@ static void InternetCreateUrlA_test(void)
 	szUrl = HeapAlloc(GetProcessHeap(), 0, ++len);
 	ret = InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
 	ok(ret, "Expected success\n");
-	ok(len == strlen(CREATE_URL12), "Expected len %d, got %d\n", lstrlenA(CREATE_URL12), len);
+	ok(len == strlen(CREATE_URL12), "Expected len %d, got %ld\n", lstrlenA(CREATE_URL12), len);
 	ok(!strcmp(szUrl, CREATE_URL12), "Expected %s, got %s\n", CREATE_URL12, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
@@ -1227,7 +1227,7 @@ static void InternetCreateUrlA_test(void)
     szUrl = HeapAlloc(GetProcessHeap(), 0, len);
     InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
     ok(ret, "Expected success\n");
-    ok(len == strlen(CREATE_URL13), "Got len %u\n", len);
+    ok(len == strlen(CREATE_URL13), "Got len %lu\n", len);
     ok(!strcmp(szUrl, CREATE_URL13), "Expected \"%s\", got \"%s\"\n", CREATE_URL13, szUrl);
 
     HeapFree(GetProcessHeap(), 0, szUrl);
diff --git a/dlls/wininet/tests/urlcache.c b/dlls/wininet/tests/urlcache.c
index f8ba90f7ab0..777fab18640 100644
--- a/dlls/wininet/tests/urlcache.c
+++ b/dlls/wininet/tests/urlcache.c
@@ -51,7 +51,7 @@ static BOOL ie10_cache = FALSE;
 
 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(lpCacheEntryInfo->dwStructSize == sizeof(*lpCacheEntryInfo), "%s: dwStructSize was %ld\n", returnedfrom, lpCacheEntryInfo->dwStructSize);
     ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url), "%s: lpszSourceUrlName should be %s instead of %s\n", returnedfrom, test_url, lpCacheEntryInfo->lpszSourceUrlName);
     ok(!strcmp(lpCacheEntryInfo->lpszLocalFileName, filenameA), "%s: lpszLocalFileName should be %s instead of %s\n", returnedfrom, filenameA, lpCacheEntryInfo->lpszLocalFileName);
     ok(!strcmp(lpCacheEntryInfo->lpszFileExtension, "html"), "%s: lpszFileExtension should be html instead of %s\n", returnedfrom, lpCacheEntryInfo->lpszFileExtension);
@@ -70,11 +70,11 @@ static void test_find_url_cache_entriesA(void)
     SetLastError(0xdeadbeef);
     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());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "FindFirstUrlCacheEntry should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo * sizeof(char));
     cbCacheEntryInfoSaved = cbCacheEntryInfo;
     hEnumHandle = FindFirstUrlCacheEntryA(NULL, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(hEnumHandle != NULL, "FindFirstUrlCacheEntry failed with error %ld\n", GetLastError());
     while (TRUE)
     {
         if (!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_url))
@@ -98,11 +98,11 @@ static void test_find_url_cache_entriesA(void)
         if (!ret)
             break;
     }
-    ok(ret, "FindNextUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "FindNextUrlCacheEntry failed with error %ld\n", GetLastError());
     ok(found, "Committed url cache entry not found during enumeration\n");
 
     ret = FindCloseUrlCache(hEnumHandle);
-    ok(ret, "FindCloseUrlCache failed with error %d\n", GetLastError());
+    ok(ret, "FindCloseUrlCache failed with error %ld\n", GetLastError());
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 }
 
@@ -116,24 +116,24 @@ static void test_GetUrlCacheEntryInfoExA(void)
     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());
+       "GetUrlCacheEntryInfoEx with NULL URL and NULL args should have set last error to ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
 
     cbCacheEntryInfo = sizeof(INTERNET_CACHE_ENTRY_INFOA);
     SetLastError(0xdeadbeef);
     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());
+       "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %ld\n", GetLastError());
 
     ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0);
-    ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfoEx with NULL args failed with error %ld\n", GetLastError());
 
     cbCacheEntryInfo = 0;
     SetLastError(0xdeadbeef);
     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());
+       "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %ld\n", GetLastError());
 
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
 
@@ -141,30 +141,30 @@ static void test_GetUrlCacheEntryInfoExA(void)
     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());
+            "GetUrlCacheEntryInfoEx should have set last error to ERROR_FILE_NOT_FOUND instead of %ld\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());
+    ok(ret || broken(old_ie && !ret), "GetUrlCacheEntryInfoExW failed with error %ld\n", GetLastError());
 
     ret = GetUrlCacheEntryInfoExA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, NULL, NULL, NULL, 0);
-    ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfoEx failed with error %ld\n", GetLastError());
 
     if (ret) check_cache_entry_infoA("GetUrlCacheEntryInfoEx", lpCacheEntryInfo);
 
     lpCacheEntryInfo->CacheEntryType |= 0x10000000; /* INSTALLED_CACHE_ENTRY */
     ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, CACHE_ENTRY_ATTRIBUTE_FC);
-    ok(ret, "SetUrlCacheEntryInfoA failed with error %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfoA failed with error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetUrlCacheEntryInfoExA(test_url, NULL, NULL, NULL, NULL, NULL, 0x200 /*GET_INSTALLED_ENTRY*/);
-    ok(ret, "GetUrlCacheEntryInfoEx failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfoEx failed with error %ld\n", GetLastError());
 
     cbCacheEntryInfo = 100000;
     SetLastError(0xdeadbeef);
     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());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetUrlCacheEntryInfoEx should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %ld\n", GetLastError());
 
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 
@@ -173,12 +173,12 @@ static void test_GetUrlCacheEntryInfoExA(void)
     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());
+       "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     SetLastError(0xdeadbeef);
     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());
+       "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 }
 
 static void test_RetrieveUrlCacheEntryA(void)
@@ -190,7 +190,7 @@ static void test_RetrieveUrlCacheEntryA(void)
     SetLastError(0xdeadbeef);
     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());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
 
     if (0)
     {
@@ -198,14 +198,14 @@ static void test_RetrieveUrlCacheEntryA(void)
         SetLastError(0xdeadbeef);
         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());
+        ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
     cbCacheEntryInfo = 100000;
     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());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_PARAMETER instead of %ld\n", GetLastError());
 }
 
 static void test_IsUrlCacheEntryExpiredA(void)
@@ -228,7 +228,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ret = IsUrlCacheEntryExpiredA(NULL, 0, &ft);
     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",
+       "expected time to be unchanged, got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
     ret = IsUrlCacheEntryExpiredA(test_url, 0, NULL);
     ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
@@ -242,7 +242,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ret = IsUrlCacheEntryExpiredA(test_url, 0, &ft);
     ok(!ret, "expected FALSE\n");
     ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
-       "expected time (0,0), got (%u,%u)\n",
+       "expected time (0,0), got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
 
     /* Same behavior with bogus flags. */
@@ -251,17 +251,17 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ret = IsUrlCacheEntryExpiredA(test_url, 0xffffffff, &ft);
     ok(!ret, "expected FALSE\n");
     ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
-       "expected time (0,0), got (%u,%u)\n",
+       "expected time (0,0), got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
 
     /* Set the expire time to a point in the past.. */
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     info = HeapAlloc(GetProcessHeap(), 0, size);
     ret = GetUrlCacheEntryInfoA(test_url, info, &size);
-    ok(ret, "GetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed: %ld\n", GetLastError());
     GetSystemTimeAsFileTime(&info->ExpireTime);
     exp_time.u.LowPart = info->ExpireTime.dwLowDateTime;
     exp_time.u.HighPart = info->ExpireTime.dwHighDateTime;
@@ -269,7 +269,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
     info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
     info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
     ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_EXPTIME_FC);
-    ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfo failed: %ld\n", GetLastError());
     ft.dwLowDateTime = 0xdeadbeef;
     ft.dwHighDateTime = 0xbaadf00d;
     /* and the entry should be expired. */
@@ -277,14 +277,14 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ok(ret, "expected TRUE\n");
     /* The modified time returned is 0. */
     ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
-       "expected time (0,0), got (%u,%u)\n",
+       "expected time (0,0), got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
     /* Set the expire time to a point in the future.. */
     exp_time.QuadPart += 20 * 60 * (ULONGLONG)10000000;
     info->ExpireTime.dwLowDateTime = exp_time.u.LowPart;
     info->ExpireTime.dwHighDateTime = exp_time.u.HighPart;
     ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_EXPTIME_FC);
-    ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfo failed: %ld\n", GetLastError());
     ft.dwLowDateTime = 0xdeadbeef;
     ft.dwHighDateTime = 0xbaadf00d;
     /* and the entry should no longer be expired. */
@@ -292,19 +292,19 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ok(!ret, "expected FALSE\n");
     /* The modified time returned is still 0. */
     ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
-       "expected time (0,0), got (%u,%u)\n",
+       "expected time (0,0), got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
     /* Set the modified time... */
     GetSystemTimeAsFileTime(&info->LastModifiedTime);
     ret = SetUrlCacheEntryInfoA(test_url, info, CACHE_ENTRY_MODTIME_FC);
-    ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfo failed: %ld\n", GetLastError());
     /* and the entry should still be unexpired.. */
     ret = IsUrlCacheEntryExpiredA(test_url, 0, &ft);
     ok(!ret, "expected FALSE\n");
     /* but the modified time returned is the last modified time just set. */
     ok(ft.dwLowDateTime == info->LastModifiedTime.dwLowDateTime &&
        ft.dwHighDateTime == info->LastModifiedTime.dwHighDateTime,
-       "expected time (%u,%u), got (%u,%u)\n",
+       "expected time (%lu,%lu), got (%lu,%lu)\n",
        info->LastModifiedTime.dwLowDateTime,
        info->LastModifiedTime.dwHighDateTime,
        ft.dwLowDateTime, ft.dwHighDateTime);
@@ -316,7 +316,7 @@ static void test_IsUrlCacheEntryExpiredA(void)
     ret = IsUrlCacheEntryExpiredA(uncached_url, 0, &ft);
     ok(ret != ie10_cache, "IsUrlCacheEntryExpiredA returned %x\n", ret);
     ok(!ft.dwLowDateTime && !ft.dwHighDateTime,
-       "expected time (0,0), got (%u,%u)\n",
+       "expected time (0,0), got (%lu,%lu)\n",
        ft.dwLowDateTime, ft.dwHighDateTime);
 }
 
@@ -327,7 +327,7 @@ static void _check_file_exists(LONG l, LPCSTR filename)
     file = CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE,
                        NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     ok_(__FILE__,l)(file != INVALID_HANDLE_VALUE,
-                    "expected file to exist, CreateFile failed with error %d\n",
+                    "expected file to exist, CreateFile failed with error %ld\n",
                     GetLastError());
     CloseHandle(file);
 }
@@ -357,10 +357,10 @@ static void create_and_write_file(LPCSTR filename, void *data, DWORD len)
     file = CreateFileA(filename, GENERIC_WRITE,
                        FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
                        FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed with error %d\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed with error %ld\n", GetLastError());
 
     ret = WriteFile(file, data, len, &written, NULL);
-    ok(ret, "WriteFile failed with error %d\n", GetLastError());
+    ok(ret, "WriteFile failed with error %ld\n", GetLastError());
 
     CloseHandle(file);
 }
@@ -380,10 +380,10 @@ static void test_urlcacheA(void)
     int len;
 
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
 
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA1);
     DeleteFileA(filenameA1);
 
@@ -392,24 +392,24 @@ static void test_urlcacheA(void)
     create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
 
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     cbCacheEntryInfo = 0;
     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());
+       "GetUrlCacheEntryInfo should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     ok(!memcmp(&lpCacheEntryInfo->ExpireTime, &filetime_zero, sizeof(FILETIME)),
        "expected zero ExpireTime\n");
     ok(!memcmp(&lpCacheEntryInfo->LastModifiedTime, &filetime_zero, sizeof(FILETIME)),
        "expected zero LastModifiedTime\n");
     ok(lpCacheEntryInfo->CacheEntryType == (NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY) ||
        broken(lpCacheEntryInfo->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
-       "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
+       "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08lx\n",
        lpCacheEntryInfo->CacheEntryType);
-    ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %d\n",
+    ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %ld\n",
        U(*lpCacheEntryInfo).dwExemptDelta);
 
     /* Make sure there is a notable change in timestamps */
@@ -419,15 +419,15 @@ static void test_urlcacheA(void)
     GetSystemTimeAsFileTime(&now);
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     cbCacheEntryInfo = 0;
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo2 = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url1, lpCacheEntryInfo2, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     /* but it does change the time.. */
     ok(memcmp(&lpCacheEntryInfo2->ExpireTime, &filetime_zero, sizeof(FILETIME)),
        "expected positive ExpireTime\n");
@@ -435,11 +435,11 @@ static void test_urlcacheA(void)
        "expected positive LastModifiedTime\n");
     ok(lpCacheEntryInfo2->CacheEntryType == (NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY) ||
        broken(lpCacheEntryInfo2->CacheEntryType == NORMAL_CACHE_ENTRY /* NT4/W2k */),
-       "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08x\n",
+       "expected type NORMAL_CACHE_ENTRY|URLHISTORY_CACHE_ENTRY, got %08lx\n",
        lpCacheEntryInfo2->CacheEntryType);
     /* and set the headers. */
     ok(lpCacheEntryInfo2->dwHeaderInfoSize == 19,
-        "expected headers size 19, got %d\n",
+        "expected headers size 19, got %ld\n",
         lpCacheEntryInfo2->dwHeaderInfoSize);
     /* Hit rate gets incremented by 1 */
     ok((lpCacheEntryInfo->dwHitRate + 1) == lpCacheEntryInfo2->dwHitRate,
@@ -456,18 +456,18 @@ static void test_urlcacheA(void)
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo2);
 
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
 
     cbCacheEntryInfo = 0;
     SetLastError(0xdeadbeef);
     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());
+       "RetrieveUrlCacheEntryFile should have set last error to ERROR_INSUFFICIENT_BUFFER instead of %ld\n", GetLastError());
 
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo, 0);
-    ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
+    ok(ret, "RetrieveUrlCacheEntryFile failed with error %ld\n", GetLastError());
 
     if (ret) check_cache_entry_infoA("RetrieveUrlCacheEntryFile", lpCacheEntryInfo);
 
@@ -478,12 +478,12 @@ static void test_urlcacheA(void)
     ret = RetrieveUrlCacheEntryFileA(test_url1, NULL, &cbCacheEntryInfo, 0);
     ok(!ret, "RetrieveUrlCacheEntryFile should have failed\n");
     ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-       "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %d\n", GetLastError());
+       "RetrieveUrlCacheEntryFile should have set last error to ERROR_INVALID_DATA instead of %ld\n", GetLastError());
 
     if (pUnlockUrlCacheEntryFileA)
     {
         ret = pUnlockUrlCacheEntryFileA(test_url, 0);
-        ok(ret, "UnlockUrlCacheEntryFileA failed with error %d\n", GetLastError());
+        ok(ret, "UnlockUrlCacheEntryFileA failed with error %ld\n", GetLastError());
     }
 
     /* test Find*UrlCacheEntry functions */
@@ -496,9 +496,9 @@ static void test_urlcacheA(void)
     if (pDeleteUrlCacheEntryA)
     {
         ret = pDeleteUrlCacheEntryA(test_url);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
         ret = pDeleteUrlCacheEntryA(test_url1);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
@@ -507,10 +507,10 @@ static void test_urlcacheA(void)
 
     /* Creating two entries with the same URL */
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
 
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
 
     ok(lstrcmpiA(filenameA, filenameA1), "expected a different file name\n");
 
@@ -522,12 +522,12 @@ static void test_urlcacheA(void)
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     check_file_exists(filenameA1);
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     /* By committing the same URL a second time, the prior entry is
      * overwritten...
      */
@@ -536,16 +536,16 @@ static void test_urlcacheA(void)
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     /* with the previous entry type retained.. */
     ok(lpCacheEntryInfo->CacheEntryType & NORMAL_CACHE_ENTRY,
-       "expected cache entry type NORMAL_CACHE_ENTRY, got %d (0x%08x)\n",
+       "expected cache entry type NORMAL_CACHE_ENTRY, got %ld (0x%08lx)\n",
        lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
     /* and the headers overwritten.. */
-    ok(!lpCacheEntryInfo->dwHeaderInfoSize, "expected headers size 0, got %d\n",
+    ok(!lpCacheEntryInfo->dwHeaderInfoSize, "expected headers size 0, got %ld\n",
        lpCacheEntryInfo->dwHeaderInfoSize);
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
     /* and the previous filename shouldn't exist. */
@@ -555,7 +555,7 @@ static void test_urlcacheA(void)
     if (pDeleteUrlCacheEntryA)
     {
         ret = pDeleteUrlCacheEntryA(test_url);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
         check_file_not_exists(filenameA);
         check_file_not_exists(filenameA1);
         /* Just in case, clean up files */
@@ -567,22 +567,22 @@ static void test_urlcacheA(void)
      * unlocked:
      */
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
 
     cbCacheEntryInfo = 0;
     SetLastError(0xdeadbeef);
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
 
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = RetrieveUrlCacheEntryFileA(test_url, lpCacheEntryInfo,
             &cbCacheEntryInfo, 0);
-    ok(ret, "RetrieveUrlCacheEntryFile failed with error %d\n", GetLastError());
+    ok(ret, "RetrieveUrlCacheEntryFile failed with error %ld\n", GetLastError());
 
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 
@@ -591,16 +591,16 @@ static void test_urlcacheA(void)
         ret = pDeleteUrlCacheEntryA(test_url);
         ok(!ret, "Expected failure\n");
         ok(GetLastError() == ERROR_SHARING_VIOLATION,
-           "Expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
+           "Expected ERROR_SHARING_VIOLATION, got %ld\n", GetLastError());
         check_file_exists(filenameA);
     }
 
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     memset(lpCacheEntryInfo, 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     ok(lpCacheEntryInfo->CacheEntryType & 0x400000,
-        "CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08x)\n",
+        "CacheEntryType hasn't PENDING_DELETE_CACHE_ENTRY set, (flags %08lx)\n",
         lpCacheEntryInfo->CacheEntryType);
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 
@@ -608,7 +608,7 @@ static void test_urlcacheA(void)
     {
         check_file_exists(filenameA);
         ret = pUnlockUrlCacheEntryFileA(test_url, 0);
-        ok(ret, "UnlockUrlCacheEntryFileA failed: %d\n", GetLastError());
+        ok(ret, "UnlockUrlCacheEntryFileA failed: %ld\n", GetLastError());
         /* By unlocking the already-deleted cache entry, the file associated
          * with it is deleted..
          */
@@ -622,14 +622,14 @@ static void test_urlcacheA(void)
         ret = pDeleteUrlCacheEntryA(test_url);
         ok(!ret, "Expected failure\n");
         ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-           "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+           "expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     }
 
     /* Test whether preventing a file from being deleted causes
      * DeleteUrlCacheEntryA to fail.
      */
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
 
     create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
     check_file_exists(filenameA);
@@ -637,17 +637,17 @@ static void test_urlcacheA(void)
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     hFile = CreateFileA(filenameA, GENERIC_READ, 0, NULL, OPEN_EXISTING,
             FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed: %d\n",
+    ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA failed: %ld\n",
        GetLastError());
     if (pDeleteUrlCacheEntryA)
     {
         /* DeleteUrlCacheEntryA should succeed.. */
         ret = pDeleteUrlCacheEntryA(test_url);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
     }
     CloseHandle(hFile);
     if (pDeleteUrlCacheEntryA)
@@ -656,7 +656,7 @@ static void test_urlcacheA(void)
         ret = pDeleteUrlCacheEntryA(test_url);
         ok(!ret, "Expected failure\n");
         ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-           "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+           "expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     }
     /* and the file should be untouched. */
     check_file_exists(filenameA);
@@ -671,126 +671,126 @@ static void test_urlcacheA(void)
             NULL);
     ok(ret == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
     if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER,
-            "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+            "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     SetLastError(0xdeadbeef);
     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 == ie10_cache, "CommitUrlCacheEntryA returned %x\n", ret);
     if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER,
-            "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+            "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     cbCacheEntryInfo = 0;
     SetLastError(0xdeadbeef);
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\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",
+       "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %ld (0x%08lx)\n",
        lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
     ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
-       "expected dwExemptDelta 86400, got %d\n",
+       "expected dwExemptDelta 86400, got %ld\n",
        U(*lpCacheEntryInfo).dwExemptDelta);
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
     if (pDeleteUrlCacheEntryA)
     {
         ret = pDeleteUrlCacheEntryA(test_url);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
         /* When explicitly deleting the cache entry, the file is also deleted */
         check_file_not_exists(filenameA);
     }
     /* Test once again, setting the exempt delta via SetUrlCacheEntryInfo */
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     create_and_write_file(filenameA, &zero_byte, sizeof(zero_byte));
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     cbCacheEntryInfo = 0;
     SetLastError(0xdeadbeef);
     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());
+       "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\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",
+       "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %ld (0x%08lx)\n",
        lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
     ok(U(*lpCacheEntryInfo).dwExemptDelta == 86400,
-       "expected dwExemptDelta 86400, got %d\n",
+       "expected dwExemptDelta 86400, got %ld\n",
        U(*lpCacheEntryInfo).dwExemptDelta);
     U(*lpCacheEntryInfo).dwExemptDelta = 0;
     ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
             CACHE_ENTRY_EXEMPT_DELTA_FC);
-    ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfo failed: %ld\n", GetLastError());
     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",
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
+    ok(!U(*lpCacheEntryInfo).dwExemptDelta, "expected dwExemptDelta 0, got %ld\n",
        U(*lpCacheEntryInfo).dwExemptDelta);
     /* See whether a sticky cache entry has the flag cleared once the exempt
      * delta is meaningless.
      */
     ok(lpCacheEntryInfo->CacheEntryType & (NORMAL_CACHE_ENTRY|STICKY_CACHE_ENTRY),
-       "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %d (0x%08x)\n",
+       "expected cache entry type NORMAL_CACHE_ENTRY | STICKY_CACHE_ENTRY, got %ld (0x%08lx)\n",
        lpCacheEntryInfo->CacheEntryType, lpCacheEntryInfo->CacheEntryType);
 
     /* Recommit of Url entry keeps dwExemptDelta */
     U(*lpCacheEntryInfo).dwExemptDelta = 8600;
     ret = SetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo,
             CACHE_ENTRY_EXEMPT_DELTA_FC);
-    ok(ret, "SetUrlCacheEntryInfo failed: %d\n", GetLastError());
+    ok(ret, "SetUrlCacheEntryInfo failed: %ld\n", GetLastError());
 
     ret = CreateUrlCacheEntryA(test_url, 0, "html", filenameA1, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     create_and_write_file(filenameA1, &zero_byte, sizeof(zero_byte));
 
     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());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
 
     ret = GetUrlCacheEntryInfoA(test_url, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     ok(U(*lpCacheEntryInfo).dwExemptDelta == 8600 || (ie10_cache && U(*lpCacheEntryInfo).dwExemptDelta == 86400),
-       "expected dwExemptDelta 8600, got %d\n", U(*lpCacheEntryInfo).dwExemptDelta);
+       "expected dwExemptDelta 8600, got %ld\n", U(*lpCacheEntryInfo).dwExemptDelta);
 
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 
     if (pDeleteUrlCacheEntryA)
     {
         ret = pDeleteUrlCacheEntryA(test_url);
-        ok(ret, "DeleteUrlCacheEntryA failed with error %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntryA failed with error %ld\n", GetLastError());
         check_file_not_exists(filenameA);
     }
 
     /* Test if files with identical hash keys are handled correctly */
     ret = CommitUrlCacheEntryA(test_hash_collisions1, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
-    ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
     ret = CommitUrlCacheEntryA(test_hash_collisions2, NULL, filetime_zero, filetime_zero, NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
-    ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
 
     cbCacheEntryInfo = 0;
     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());
+            "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_hash_collisions1, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions1),
             "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
@@ -799,42 +799,42 @@ static void test_urlcacheA(void)
     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());
+            "expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     lpCacheEntryInfo = HeapAlloc(GetProcessHeap(), 0, cbCacheEntryInfo);
     ret = GetUrlCacheEntryInfoA(test_hash_collisions2, lpCacheEntryInfo, &cbCacheEntryInfo);
-    ok(ret, "GetUrlCacheEntryInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetUrlCacheEntryInfo failed with error %ld\n", GetLastError());
     ok(!strcmp(lpCacheEntryInfo->lpszSourceUrlName, test_hash_collisions2),
             "got incorrect entry: %s\n", lpCacheEntryInfo->lpszSourceUrlName);
     HeapFree(GetProcessHeap(), 0, lpCacheEntryInfo);
 
     if (pDeleteUrlCacheEntryA) {
         ret = pDeleteUrlCacheEntryA(test_hash_collisions1);
-        ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntry failed: %ld\n", GetLastError());
         ret = pDeleteUrlCacheEntryA(test_hash_collisions2);
-        ok(ret, "DeleteUrlCacheEntry failed: %d\n", GetLastError());
+        ok(ret, "DeleteUrlCacheEntry failed: %ld\n", GetLastError());
     }
 
     len = strlen(long_url);
     memset(long_url+len, 'a', sizeof(long_url)-len);
     long_url[sizeof(long_url)-1] = 0;
     ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     DeleteFileA(filenameA);
 
     ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     DeleteFileA(filenameA);
 
     long_url[250] = 0;
     ret = CreateUrlCacheEntryA(long_url, 0, NULL, filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     DeleteFileA(filenameA);
 
     ret = CreateUrlCacheEntryA(long_url, 0, "extension", filenameA, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
     check_file_exists(filenameA);
     DeleteFileA(filenameA);
 }
@@ -900,88 +900,88 @@ static void test_urlcacheW(void)
         SetLastError(0xdeadbeef);
         ret = CreateUrlCacheEntryW(urls[i].url, 0, NULL, bufW, 0);
         if(urls[i].err != 0) {
-            ok(!ret, "%d) CreateUrlCacheEntryW succeeded\n", i);
-            ok(urls[i].err == GetLastError(), "%d) GetLastError() = %d\n", i, GetLastError());
+            ok(!ret, "%ld) CreateUrlCacheEntryW succeeded\n", i);
+            ok(urls[i].err == GetLastError(), "%ld) GetLastError() = %ld\n", i, GetLastError());
             continue;
         }
-        ok(ret, "%d) CreateUrlCacheEntryW failed: %d\n", i, GetLastError());
+        ok(ret, "%ld) CreateUrlCacheEntryW failed: %ld\n", i, GetLastError());
 
         /* dwHeaderSize is ignored, pass 0 to prove it */
         ret = CommitUrlCacheEntryW(urls[i].url, bufW, filetime_zero, filetime_zero,
                 NORMAL_CACHE_ENTRY, urls[i].header_info, 0, urls[i].extension, NULL);
-        ok(ret, "%d) CommitUrlCacheEntryW failed: %d\n", i, GetLastError());
+        ok(ret, "%ld) CommitUrlCacheEntryW failed: %ld\n", i, GetLastError());
 
         SetLastError(0xdeadbeef);
         size = 0;
         ret = GetUrlCacheEntryInfoW(urls[i].url, NULL, &size);
         ok(!ret && GetLastError()==ERROR_INSUFFICIENT_BUFFER,
-                "%d) GetLastError() = %d\n", i, GetLastError());
+                "%ld) GetLastError() = %ld\n", i, GetLastError());
         entry_infoW = HeapAlloc(GetProcessHeap(), 0, size);
         ret = GetUrlCacheEntryInfoW(urls[i].url, entry_infoW, &size);
-        ok(ret, "%d) GetUrlCacheEntryInfoW failed: %d\n", i, GetLastError());
+        ok(ret, "%ld) GetUrlCacheEntryInfoW failed: %ld\n", i, GetLastError());
 
         ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, NULL, &size);
         ok(!ret && GetLastError()==ERROR_INSUFFICIENT_BUFFER,
-                "%d) GetLastError() = %d\n", i, GetLastError());
+                "%ld) GetLastError() = %ld\n", i, GetLastError());
         entry_infoA = HeapAlloc(GetProcessHeap(), 0, size);
         ret = GetUrlCacheEntryInfoA(urls[i].encoded_url, entry_infoA, &size);
-        ok(ret, "%d) GetUrlCacheEntryInfoA failed: %d\n", i, GetLastError());
+        ok(ret, "%ld) GetUrlCacheEntryInfoA failed: %ld\n", i, GetLastError());
 
         ok(entry_infoW->dwStructSize == entry_infoA->dwStructSize,
-                "%d) entry_infoW->dwStructSize = %d, expected %d\n",
+                "%ld) entry_infoW->dwStructSize = %ld, expected %ld\n",
                 i, entry_infoW->dwStructSize, entry_infoA->dwStructSize);
         ok(!lstrcmpW(urls[i].url, entry_infoW->lpszSourceUrlName),
-                "%d) entry_infoW->lpszSourceUrlName = %s\n",
+                "%ld) entry_infoW->lpszSourceUrlName = %s\n",
                 i, wine_dbgstr_w(entry_infoW->lpszSourceUrlName));
         ok(!lstrcmpA(urls[i].encoded_url, entry_infoA->lpszSourceUrlName),
-                "%d) entry_infoA->lpszSourceUrlName = %s\n",
+                "%ld) entry_infoA->lpszSourceUrlName = %s\n",
                 i, entry_infoA->lpszSourceUrlName);
         ok(entry_infoW->CacheEntryType == entry_infoA->CacheEntryType,
-                "%d) entry_infoW->CacheEntryType = %x, expected %x\n",
+                "%ld) entry_infoW->CacheEntryType = %lx, expected %lx\n",
                 i, entry_infoW->CacheEntryType, entry_infoA->CacheEntryType);
         ok(entry_infoW->dwUseCount == entry_infoA->dwUseCount,
-                "%d) entry_infoW->dwUseCount = %d, expected %d\n",
+                "%ld) entry_infoW->dwUseCount = %ld, expected %ld\n",
                 i, entry_infoW->dwUseCount, entry_infoA->dwUseCount);
         ok(entry_infoW->dwHitRate == entry_infoA->dwHitRate,
-                "%d) entry_infoW->dwHitRate = %d, expected %d\n",
+                "%ld) entry_infoW->dwHitRate = %ld, expected %ld\n",
                 i, entry_infoW->dwHitRate, entry_infoA->dwHitRate);
         ok(entry_infoW->dwSizeLow == entry_infoA->dwSizeLow,
-                "%d) entry_infoW->dwSizeLow = %d, expected %d\n",
+                "%ld) entry_infoW->dwSizeLow = %ld, expected %ld\n",
                 i, entry_infoW->dwSizeLow, entry_infoA->dwSizeLow);
         ok(entry_infoW->dwSizeHigh == entry_infoA->dwSizeHigh,
-                "%d) entry_infoW->dwSizeHigh = %d, expected %d\n",
+                "%ld) entry_infoW->dwSizeHigh = %ld, expected %ld\n",
                 i, entry_infoW->dwSizeHigh, entry_infoA->dwSizeHigh);
         ok(!memcmp(&entry_infoW->LastModifiedTime, &entry_infoA->LastModifiedTime, sizeof(FILETIME)),
-                "%d) entry_infoW->LastModifiedTime is incorrect\n", i);
+                "%ld) entry_infoW->LastModifiedTime is incorrect\n", i);
         ok(!memcmp(&entry_infoW->ExpireTime, &entry_infoA->ExpireTime, sizeof(FILETIME)),
-                "%d) entry_infoW->ExpireTime is incorrect\n", i);
+                "%ld) entry_infoW->ExpireTime is incorrect\n", i);
         ok(!memcmp(&entry_infoW->LastAccessTime, &entry_infoA->LastAccessTime, sizeof(FILETIME)),
-                "%d) entry_infoW->LastAccessTime is incorrect\n", i);
+                "%ld) entry_infoW->LastAccessTime is incorrect\n", i);
         ok(!memcmp(&entry_infoW->LastSyncTime, &entry_infoA->LastSyncTime, sizeof(FILETIME)),
-                "%d) entry_infoW->LastSyncTime is incorrect\n", i);
+                "%ld) entry_infoW->LastSyncTime is incorrect\n", i);
 
         MultiByteToWideChar(CP_ACP, 0, entry_infoA->lpszLocalFileName, -1, bufW, MAX_PATH);
         ok(!lstrcmpW(entry_infoW->lpszLocalFileName, bufW),
-                "%d) entry_infoW->lpszLocalFileName = %s, expected %s\n",
+                "%ld) entry_infoW->lpszLocalFileName = %s, expected %s\n",
                 i, wine_dbgstr_w(entry_infoW->lpszLocalFileName), wine_dbgstr_w(bufW));
 
         if(!urls[i].header_info[0]) {
             ok(!entry_infoW->lpHeaderInfo, "entry_infoW->lpHeaderInfo != NULL\n");
         }else {
             ok(!lstrcmpW((WCHAR*)entry_infoW->lpHeaderInfo, urls[i].header_info),
-                    "%d) entry_infoW->lpHeaderInfo = %s\n",
+                    "%ld) entry_infoW->lpHeaderInfo = %s\n",
                     i, wine_dbgstr_w((WCHAR*)entry_infoW->lpHeaderInfo));
         }
 
         if(!urls[i].extension[0]) {
             ok(!entry_infoW->lpszFileExtension || (ie10_cache && !entry_infoW->lpszFileExtension[0]),
-                    "%d) entry_infoW->lpszFileExtension = %s\n",
+                    "%ld) 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) ||
                     (ie10_cache && !lstrcmpW(entry_infoW->lpszFileExtension, urls[i].extension)),
-                    "%d) entry_infoW->lpszFileExtension = %s, expected %s\n",
+                    "%ld) entry_infoW->lpszFileExtension = %s, expected %s\n",
                     i, wine_dbgstr_w(entry_infoW->lpszFileExtension), wine_dbgstr_w(bufW));
         }
 
@@ -990,7 +990,7 @@ static void test_urlcacheW(void)
 
         if(pDeleteUrlCacheEntryA) {
             ret = pDeleteUrlCacheEntryA(urls[i].encoded_url);
-            ok(ret, "%d) DeleteUrlCacheEntryW failed: %d\n", i, GetLastError());
+            ok(ret, "%ld) DeleteUrlCacheEntryW failed: %ld\n", i, GetLastError());
         }
     }
 }
@@ -1004,7 +1004,7 @@ static void test_FindCloseUrlCache(void)
     r = FindCloseUrlCache(NULL);
     err = GetLastError();
     ok(0 == r, "expected 0, got %d\n", r);
-    ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err);
+    ok(ERROR_INVALID_HANDLE == err, "expected %d, got %ld\n", ERROR_INVALID_HANDLE, err);
 }
 
 static void test_GetDiskInfoA(void)
@@ -1018,16 +1018,16 @@ static void test_GetDiskInfoA(void)
     if ((p = strchr(path, '\\'))) *++p = 0;
 
     ret = GetDiskInfoA(path, &cluster_size, &free, &total);
-    ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
+    ok(ret, "GetDiskInfoA failed %lu\n", GetLastError());
 
     ret = GetDiskInfoA(path, &cluster_size, &free, NULL);
-    ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
+    ok(ret, "GetDiskInfoA failed %lu\n", GetLastError());
 
     ret = GetDiskInfoA(path, &cluster_size, NULL, NULL);
-    ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
+    ok(ret, "GetDiskInfoA failed %lu\n", GetLastError());
 
     ret = GetDiskInfoA(path, NULL, NULL, NULL);
-    ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
+    ok(ret, "GetDiskInfoA failed %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     strcpy(p, "\\non\\existing\\path");
@@ -1038,13 +1038,13 @@ static void test_GetDiskInfoA(void)
        "GetDiskInfoA succeeded\n");
     ok(error == ERROR_PATH_NOT_FOUND ||
        broken(old_ie && error == 0xdeadbeef), /* < IE7 */
-       "got %u expected ERROR_PATH_NOT_FOUND\n", error);
+       "got %lu expected ERROR_PATH_NOT_FOUND\n", error);
 
     SetLastError(0xdeadbeef);
     ret = GetDiskInfoA(NULL, NULL, NULL, NULL);
     error = GetLastError();
     ok(!ret, "GetDiskInfoA succeeded\n");
-    ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
+    ok(error == ERROR_INVALID_PARAMETER, "got %lu expected ERROR_INVALID_PARAMETER\n", error);
 }
 
 static BOOL cache_entry_exists(const char *url)
@@ -1054,7 +1054,7 @@ static BOOL cache_entry_exists(const char *url)
     BOOL ret;
 
     ret = GetUrlCacheEntryInfoA(url, (void*)buf, &size);
-    ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "GetUrlCacheEntryInfoA returned %x (%u)\n", ret, GetLastError());
+    ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "GetUrlCacheEntryInfoA returned %x (%lu)\n", ret, GetLastError());
 
     return ret;
 }
@@ -1070,13 +1070,13 @@ static void test_trailing_slash(void)
 
 
     ret = CreateUrlCacheEntryA(url_with_slash, 0, "html", filename, 0);
-    ok(ret, "CreateUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CreateUrlCacheEntry failed with error %ld\n", GetLastError());
 
     create_and_write_file(filename, &zero_byte, sizeof(zero_byte));
 
     ret = CommitUrlCacheEntryA("Visited: http://testing.cache.com/", NULL, filetime_zero, filetime_zero,
             NORMAL_CACHE_ENTRY, NULL, 0, "html", NULL);
-    ok(ret, "CommitUrlCacheEntry failed with error %d\n", GetLastError());
+    ok(ret, "CommitUrlCacheEntry failed with error %ld\n", GetLastError());
 
     ok(cache_entry_exists("Visited: http://testing.cache.com/"), "cache entry does not exist\n");
     ok(!cache_entry_exists("Visited: http://testing.cache.com"), "cache entry exists\n");
@@ -1115,12 +1115,12 @@ static void get_cache_path(DWORD flags, char path[MAX_PATH], char path_win8[MAX_
         break;
 
     default:
-        ok(0, "unexpected flags %#x\n", flags);
+        ok(0, "unexpected flags %#lx\n", flags);
         break;
     }
 
     ret = SHGetSpecialFolderPathA(0, path, folder, FALSE);
-    ok(ret, "SHGetSpecialFolderPath error %u\n", GetLastError());
+    ok(ret, "SHGetSpecialFolderPath error %lu\n", GetLastError());
 
     strcpy(path_win8, path);
     strcat(path_win8, suffix_win8);
@@ -1168,14 +1168,14 @@ static void test_GetUrlCacheConfigInfo(void)
         ret = GetUrlCacheConfigInfoA(td[i].info, NULL, td[i].flags);
         ok(ret == td[i].ret, "%d: expected %d, got %d\n", i, td[i].ret, ret);
         if (!ret)
-            ok(GetLastError() == td[i].error, "%d: expected %u, got %u\n", i, td[i].error, GetLastError());
+            ok(GetLastError() == td[i].error, "%d: expected %lu, got %lu\n", i, td[i].error, GetLastError());
         else
         {
             char path[MAX_PATH], path_win8[MAX_PATH];
 
             get_cache_path(td[i].flags, path, path_win8);
 
-            ok(info.dwStructSize == td[i].dwStructSize, "got %u\n", info.dwStructSize);
+            ok(info.dwStructSize == td[i].dwStructSize, "got %lu\n", info.dwStructSize);
             ok(!lstrcmpA(info.CachePath, path) || !lstrcmpA(info.CachePath, path_win8),
                "%d: expected %s or %s, got %s\n", i, path, path_win8, info.CachePath);
         }




More information about the wine-devel mailing list