[PATCH 05/20] dlls/urlmon/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Tue Mar 8 02:30:20 CST 2022


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

---
 dlls/urlmon/tests/Makefile.in |    1 
 dlls/urlmon/tests/misc.c      |  668 +++++++++++++------------
 dlls/urlmon/tests/protocol.c  |  606 +++++++++++------------
 dlls/urlmon/tests/sec_mgr.c   |  382 +++++++-------
 dlls/urlmon/tests/stream.c    |   32 +
 dlls/urlmon/tests/uri.c       | 1086 +++++++++++++++++++++--------------------
 dlls/urlmon/tests/url.c       |  558 +++++++++++----------
 7 files changed, 1666 insertions(+), 1667 deletions(-)

diff --git a/dlls/urlmon/tests/Makefile.in b/dlls/urlmon/tests/Makefile.in
index c0880892f98..7217f5326ad 100644
--- a/dlls/urlmon/tests/Makefile.in
+++ b/dlls/urlmon/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = urlmon.dll
 IMPORTS   = urlmon wininet ole32 oleaut32 shlwapi user32 advapi32
 
diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c
index a92521b12db..0575a43b097 100644
--- a/dlls/urlmon/tests/misc.c
+++ b/dlls/urlmon/tests/misc.c
@@ -116,88 +116,88 @@ static void test_CreateFormatEnum(void)
     };
 
     hres = CreateFormatEnumerator(0, formatetc, &fenum);
-    ok(hres == E_FAIL, "CreateFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "CreateFormatEnumerator failed: %08lx, expected E_FAIL\n", hres);
     hres = CreateFormatEnumerator(0, formatetc, NULL);
-    ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = CreateFormatEnumerator(5, formatetc, NULL);
-    ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CreateFormatEnumerator failed: %08lx, expected E_INVALIDARG\n", hres);
 
 
     hres = CreateFormatEnumerator(5, formatetc, &fenum);
-    ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateFormatEnumerator failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IEnumFORMATETC_Next(fenum, 2, NULL, &ul);
-    ok(hres == E_INVALIDARG, "Next failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Next failed: %08lx, expected E_INVALIDARG\n", hres);
     ul = 100;
     hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
-    ok(hres == S_OK, "Next failed: %08x\n", hres);
-    ok(ul == 0, "ul=%d, expected 0\n", ul);
+    ok(hres == S_OK, "Next failed: %08lx\n", hres);
+    ok(ul == 0, "ul=%ld, expected 0\n", ul);
 
     hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
-    ok(hres == S_OK, "Next failed: %08x\n", hres);
-    ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
-    ok(fetc[1].lindex == 1, "fetc[1].lindex=%d, expected 1\n", fetc[1].lindex);
+    ok(hres == S_OK, "Next failed: %08lx\n", hres);
+    ok(fetc[0].lindex == 0, "fetc[0].lindex=%ld, expected 0\n", fetc[0].lindex);
+    ok(fetc[1].lindex == 1, "fetc[1].lindex=%ld, expected 1\n", fetc[1].lindex);
     ok(fetc[0].ptd == &dev, "fetc[0].ptd=%p, expected %p\n", fetc[0].ptd, &dev);
-    ok(ul == 2, "ul=%d, expected 2\n", ul);
+    ok(ul == 2, "ul=%ld, expected 2\n", ul);
 
     hres = IEnumFORMATETC_Skip(fenum, 1);
-    ok(hres == S_OK, "Skip failed: %08x\n", hres);
+    ok(hres == S_OK, "Skip failed: %08lx\n", hres);
 
     hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
-    ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
-    ok(fetc[0].lindex == 3, "fetc[0].lindex=%d, expected 3\n", fetc[0].lindex);
-    ok(fetc[1].lindex == 4, "fetc[1].lindex=%d, expected 4\n", fetc[1].lindex);
+    ok(hres == S_FALSE, "Next failed: %08lx, expected S_FALSE\n", hres);
+    ok(fetc[0].lindex == 3, "fetc[0].lindex=%ld, expected 3\n", fetc[0].lindex);
+    ok(fetc[1].lindex == 4, "fetc[1].lindex=%ld, expected 4\n", fetc[1].lindex);
     ok(fetc[0].ptd == NULL, "fetc[0].ptd=%p, expected NULL\n", fetc[0].ptd);
-    ok(ul == 2, "ul=%d, expected 2\n", ul);
+    ok(ul == 2, "ul=%ld, expected 2\n", ul);
 
     hres = IEnumFORMATETC_Next(fenum, 4, fetc, &ul);
-    ok(hres == S_FALSE, "Next failed: %08x, expected S_FALSE\n", hres);
-    ok(ul == 0, "ul=%d, expected 0\n", ul);
+    ok(hres == S_FALSE, "Next failed: %08lx, expected S_FALSE\n", hres);
+    ok(ul == 0, "ul=%ld, expected 0\n", ul);
     ul = 100;
     hres = IEnumFORMATETC_Next(fenum, 0, fetc, &ul);
-    ok(hres == S_OK, "Next failed: %08x\n", hres);
-    ok(ul == 0, "ul=%d, expected 0\n", ul);
+    ok(hres == S_OK, "Next failed: %08lx\n", hres);
+    ok(ul == 0, "ul=%ld, expected 0\n", ul);
 
     hres = IEnumFORMATETC_Skip(fenum, 3);
-    ok(hres == S_FALSE, "Skip failed: %08x, expected S_FALSE\n", hres);
+    ok(hres == S_FALSE, "Skip failed: %08lx, expected S_FALSE\n", hres);
 
     hres = IEnumFORMATETC_Reset(fenum);
-    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+    ok(hres == S_OK, "Reset failed: %08lx\n", hres);
 
     hres = IEnumFORMATETC_Next(fenum, 5, fetc, NULL);
-    ok(hres == S_OK, "Next failed: %08x\n", hres);
-    ok(fetc[0].lindex == 0, "fetc[0].lindex=%d, expected 0\n", fetc[0].lindex);
+    ok(hres == S_OK, "Next failed: %08lx\n", hres);
+    ok(fetc[0].lindex == 0, "fetc[0].lindex=%ld, expected 0\n", fetc[0].lindex);
 
     hres = IEnumFORMATETC_Reset(fenum);
-    ok(hres == S_OK, "Reset failed: %08x\n", hres);
+    ok(hres == S_OK, "Reset failed: %08lx\n", hres);
 
     hres = IEnumFORMATETC_Skip(fenum, 2);
-    ok(hres == S_OK, "Skip failed: %08x\n", hres);
+    ok(hres == S_OK, "Skip failed: %08lx\n", hres);
 
     hres = IEnumFORMATETC_Clone(fenum, NULL);
-    ok(hres == E_INVALIDARG, "Clone failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Clone failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = IEnumFORMATETC_Clone(fenum, &fenum2);
-    ok(hres == S_OK, "Clone failed: %08x\n", hres);
+    ok(hres == S_OK, "Clone failed: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         ok(fenum != fenum2, "fenum == fenum2\n");
 
         hres = IEnumFORMATETC_Next(fenum2, 2, fetc, &ul);
-        ok(hres == S_OK, "Next failed: %08x\n", hres);
-        ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
+        ok(hres == S_OK, "Next failed: %08lx\n", hres);
+        ok(fetc[0].lindex == 2, "fetc[0].lindex=%ld, expected 2\n", fetc[0].lindex);
 
         IEnumFORMATETC_Release(fenum2);
     }
 
     hres = IEnumFORMATETC_Next(fenum, 2, fetc, &ul);
-    ok(hres == S_OK, "Next failed: %08x\n", hres);
-    ok(fetc[0].lindex == 2, "fetc[0].lindex=%d, expected 2\n", fetc[0].lindex);
+    ok(hres == S_OK, "Next failed: %08lx\n", hres);
+    ok(fetc[0].lindex == 2, "fetc[0].lindex=%ld, expected 2\n", fetc[0].lindex);
 
     hres = IEnumFORMATETC_Skip(fenum, 1);
-    ok(hres == S_OK, "Skip failed: %08x\n", hres);
+    ok(hres == S_OK, "Skip failed: %08lx\n", hres);
     
     IEnumFORMATETC_Release(fenum);
 }
@@ -216,61 +216,61 @@ static void test_RegisterFormatEnumerator(void)
     CreateBindCtx(0, &bctx);
 
     hres = CreateFormatEnumerator(1, &formatetc, &format);
-    ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateFormatEnumerator failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = RegisterFormatEnumerator(NULL, format, 0);
     ok(hres == E_INVALIDARG,
-            "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
+            "RegisterFormatEnumerator failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = RegisterFormatEnumerator(bctx, NULL, 0);
     ok(hres == E_INVALIDARG,
-            "RegisterFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
+            "RegisterFormatEnumerator failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = RegisterFormatEnumerator(bctx, format, 0);
-    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08lx\n", hres);
 
     hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
-    ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam failed: %08lx\n", hres);
     ok(unk == (IUnknown*)format, "unk != format\n");
 
     hres = RevokeFormatEnumerator(NULL, format);
     ok(hres == E_INVALIDARG,
-            "RevokeFormatEnumerator failed: %08x, expected E_INVALIDARG\n", hres);
+            "RevokeFormatEnumerator failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = RevokeFormatEnumerator(bctx, format);
-    ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "RevokeFormatEnumerator failed: %08lx\n", hres);
 
     hres = RevokeFormatEnumerator(bctx, format);
-    ok(hres == E_FAIL, "RevokeFormatEnumerator failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "RevokeFormatEnumerator failed: %08lx, expected E_FAIL\n", hres);
 
     hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
-    ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "GetObjectParam failed: %08lx, expected E_FAIL\n", hres);
 
     hres = RegisterFormatEnumerator(bctx, format, 0);
-    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08lx\n", hres);
 
     hres = CreateFormatEnumerator(1, &formatetc, &format2);
-    ok(hres == S_OK, "CreateFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateFormatEnumerator failed: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         hres = RevokeFormatEnumerator(bctx, format);
-        ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
+        ok(hres == S_OK, "RevokeFormatEnumerator failed: %08lx\n", hres);
 
         IEnumFORMATETC_Release(format2);
     }
 
     hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
-    ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "GetObjectParam failed: %08lx, expected E_FAIL\n", hres);
 
     IEnumFORMATETC_Release(format);
 
     hres = RegisterFormatEnumerator(bctx, format, 0);
-    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterFormatEnumerator failed: %08lx\n", hres);
     hres = RevokeFormatEnumerator(bctx, NULL);
-    ok(hres == S_OK, "RevokeFormatEnumerator failed: %08x\n", hres);
+    ok(hres == S_OK, "RevokeFormatEnumerator failed: %08lx\n", hres);
     hres = IBindCtx_GetObjectParam(bctx, wszEnumFORMATETC, &unk);
-    ok(hres == E_FAIL, "GetObjectParam failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "GetObjectParam failed: %08lx, expected E_FAIL\n", hres);
 
     IEnumFORMATETC_Release(format);
     IBindCtx_Release(bctx);
@@ -345,33 +345,33 @@ static void test_CoInternetParseUrl(void)
     memset(buf, 0xf0, sizeof(buf));
     hres = pCoInternetParseUrl(parse_tests[0].url, PARSE_SCHEMA, 0, buf,
             3, &size, 0);
-    ok(hres == E_POINTER, "schema failed: %08x, expected E_POINTER\n", hres);
+    ok(hres == E_POINTER, "schema failed: %08lx, expected E_POINTER\n", hres);
 
     for(i = 0; i < ARRAY_SIZE(parse_tests); i++) {
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SECURITY_URL, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08x, expected %08x\n",
+        ok(hres == parse_tests[i].secur_hres, "[%d] security url failed: %08lx, expected %08lx\n",
                 i, hres, parse_tests[i].secur_hres);
 
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ENCODE, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] encoding failed: %08lx\n", i, hres);
         ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
         ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
 
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_UNESCAPE, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == S_OK, "[%d] encoding failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] encoding failed: %08lx\n", i, hres);
         ok(size == lstrlenW(parse_tests[i].encoded_url), "[%d] wrong size\n", i);
         ok(!lstrcmpW(parse_tests[i].encoded_url, buf), "[%d] wrong encoded url\n", i);
 
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_PATH_FROM_URL, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08x, expected %08x\n",
+        ok(hres == parse_tests[i].path_hres, "[%d] path failed: %08lx, expected %08lx\n",
                 i, hres, parse_tests[i].path_hres);
         if(parse_tests[i].path) {
             ok(size == lstrlenW(parse_tests[i].path), "[%d] wrong size\n", i);
@@ -381,7 +381,7 @@ static void test_CoInternetParseUrl(void)
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_SCHEMA, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == S_OK, "[%d] schema failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] schema failed: %08lx\n", i, hres);
         ok(size == lstrlenW(parse_tests[i].schema), "[%d] wrong size\n", i);
         ok(!lstrcmpW(parse_tests[i].schema, buf), "[%d] wrong schema\n", i);
 
@@ -390,7 +390,7 @@ static void test_CoInternetParseUrl(void)
             memset(buf, 0xf0, sizeof(buf));
             hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_DOMAIN, 0, buf,
                     ARRAY_SIZE(buf), &size, 0);
-            ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08x\n", i, hres);
+            ok(hres == parse_tests[i].domain_hres, "[%d] domain failed: %08lx\n", i, hres);
             if(parse_tests[i].domain)
                 ok(!lstrcmpW(parse_tests[i].domain, buf), "[%d] wrong domain, received %s\n", i, wine_dbgstr_w(buf));
         }
@@ -398,7 +398,7 @@ static void test_CoInternetParseUrl(void)
         memset(buf, 0xf0, sizeof(buf));
         hres = pCoInternetParseUrl(parse_tests[i].url, PARSE_ROOTDOCUMENT, 0, buf,
                 ARRAY_SIZE(buf), &size, 0);
-        ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08x\n", i, hres);
+        ok(hres == parse_tests[i].rootdocument_hres, "[%d] rootdocument failed: %08lx\n", i, hres);
         if(parse_tests[i].rootdocument)
             ok(!lstrcmpW(parse_tests[i].rootdocument, buf), "[%d] wrong rootdocument, received %s\n", i, wine_dbgstr_w(buf));
     }
@@ -409,13 +409,13 @@ static void test_CoInternetCompareUrl(void)
     HRESULT hres;
 
     hres = pCoInternetCompareUrl(url1, url1, 0);
-    ok(hres == S_OK, "CoInternetCompareUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCompareUrl failed: %08lx\n", hres);
 
     hres = pCoInternetCompareUrl(url1, url3, 0);
-    ok(hres == S_FALSE, "CoInternetCompareUrl failed: %08x\n", hres);
+    ok(hres == S_FALSE, "CoInternetCompareUrl failed: %08lx\n", hres);
 
     hres = pCoInternetCompareUrl(url3, url1, 0);
-    ok(hres == S_FALSE, "CoInternetCompareUrl failed: %08x\n", hres);
+    ok(hres == S_FALSE, "CoInternetCompareUrl failed: %08lx\n", hres);
 }
 
 static const struct {
@@ -442,20 +442,20 @@ static void test_CoInternetQueryInfo(void)
         cb = 0xdeadbeef;
         memset(buf, '?', sizeof(buf));
         hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), &cb, 0);
-        ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
-        ok(cb == sizeof(DWORD), "[%d] cb = %d\n", i, cb);
-        ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
+        ok(hres == S_OK, "[%ld] CoInternetQueryInfo failed: %08lx\n", i, hres);
+        ok(cb == sizeof(DWORD), "[%ld] cb = %ld\n", i, cb);
+        ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%ld] ret %lx, expected %lx\n",
            i, *(DWORD*)buf, query_info_tests[i].uses_net);
 
         hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, 3, &cb, 0);
-        ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
+        ok(hres == E_FAIL, "[%ld] CoInternetQueryInfo failed: %08lx, expected E_FAIL\n", i, hres);
         hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, NULL, sizeof(buf), &cb, 0);
-        ok(hres == E_FAIL, "[%d] CoInternetQueryInfo failed: %08x, expected E_FAIL\n", i, hres);
+        ok(hres == E_FAIL, "[%ld] CoInternetQueryInfo failed: %08lx, expected E_FAIL\n", i, hres);
 
         memset(buf, '?', sizeof(buf));
         hres = pCoInternetQueryInfo(query_info_tests[0].url, QUERY_USES_NETWORK, 0, buf, sizeof(buf), NULL, 0);
-        ok(hres == S_OK, "[%d] CoInternetQueryInfo failed: %08x\n", i, hres);
-        ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%d] ret %x, expected %x\n",
+        ok(hres == S_OK, "[%ld] CoInternetQueryInfo failed: %08lx\n", i, hres);
+        ok(*(DWORD*)buf == query_info_tests[i].uses_net, "[%ld] ret %lx, expected %lx\n",
            i, *(DWORD*)buf, query_info_tests[i].uses_net);
     }
 }
@@ -715,7 +715,7 @@ static void test_FindMimeFromData(void)
         mime = (LPWSTR)0xf0f0f0f0;
         hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, NULL, 0, &mime, 0);
         if(mime_tests[i].mime) {
-            ok(hres == S_OK || broken(mime_tests[i].broken_failure), "[%d] FindMimeFromData failed: %08x\n", i, hres);
+            ok(hres == S_OK || broken(mime_tests[i].broken_failure), "[%d] FindMimeFromData failed: %08lx\n", i, hres);
             if(hres == S_OK) {
                 ok(!lstrcmpW(mime, mime_tests[i].mime)
                    || broken(mime_tests[i].broken_mime && !lstrcmpW(mime, mime_tests[i].broken_mime)),
@@ -724,20 +724,20 @@ static void test_FindMimeFromData(void)
             }
         }else {
             ok(hres == E_FAIL || hres == mime_tests[i].hres,
-               "[%d] FindMimeFromData failed: %08x, expected %08x\n",
+               "[%d] FindMimeFromData failed: %08lx, expected %08lx\n",
                i, hres, mime_tests[i].hres);
             ok(mime == (LPWSTR)0xf0f0f0f0, "[%d] mime != 0xf0f0f0f0\n", i);
         }
 
         mime = (LPWSTR)0xf0f0f0f0;
         hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, text_plainW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         ok(!lstrcmpW(mime, L"text/plain"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
 
         mime = (LPWSTR)0xf0f0f0f0;
         hres = pFindMimeFromData(NULL, mime_tests[i].url, NULL, 0, app_octet_streamW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         ok(!lstrcmpW(mime, L"application/octet-stream"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
         CoTaskMemFree(mime);
     }
@@ -745,7 +745,7 @@ static void test_FindMimeFromData(void)
     for(i = 0; i < ARRAY_SIZE(mime_tests2); i++) {
         hres = pFindMimeFromData(NULL, mime_tests2[i].url, mime_tests2[i].data, mime_tests2[i].size,
                 mime_tests2[i].proposed_mime, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         b = !lstrcmpW(mime, mime_tests2[i].mime);
         ok(b || broken(mime_tests2[i].broken_mime && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
             "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
@@ -755,7 +755,7 @@ static void test_FindMimeFromData(void)
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
                 app_octet_streamW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
                         && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
                     "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
@@ -763,7 +763,7 @@ static void test_FindMimeFromData(void)
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
                 text_plainW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         ok(!lstrcmpW(mime, mime_tests2[i].mime) || broken(mime_tests2[i].broken_mime
                     && !lstrcmpW(mime, mime_tests2[i].broken_mime)),
                 "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
@@ -771,7 +771,7 @@ static void test_FindMimeFromData(void)
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
                 text_htmlW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         if(!lstrcmpW(L"application/octet-stream", mime_tests2[i].mime)
            || !lstrcmpW(L"text/plain", mime_tests2[i].mime) || i==92)
             ok(!lstrcmpW(mime, L"text/html"), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
@@ -781,7 +781,7 @@ static void test_FindMimeFromData(void)
 
         hres = pFindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
                 image_pjpegW, 0, &mime, 0);
-        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
+        ok(hres == S_OK, "[%d] FindMimeFromData failed: %08lx\n", i, hres);
         ok(!lstrcmpW(mime, mime_tests2[i].mime_pjpeg ? mime_tests2[i].mime_pjpeg : mime_tests2[i].mime)
            || broken(!lstrcmpW(mime, mime_tests2[i].mime)),
            "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
@@ -789,24 +789,24 @@ static void test_FindMimeFromData(void)
     }
 
     hres = pFindMimeFromData(NULL, NULL, NULL, 0, NULL, 0, &mime, 0);
-    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = pFindMimeFromData(NULL, NULL, NULL, 0, text_plainW, 0, &mime, 0);
-    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = pFindMimeFromData(NULL, NULL, data1, 0, NULL, 0, &mime, 0);
-    ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "FindMimeFromData failed: %08lx, expected E_FAIL\n", hres);
 
     hres = pFindMimeFromData(NULL, url1, data1, 0, NULL, 0, &mime, 0);
-    ok(hres == E_FAIL, "FindMimeFromData failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "FindMimeFromData failed: %08lx, expected E_FAIL\n", hres);
 
     hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, &mime, 0);
-    ok(hres == S_OK, "FindMimeFromData failed: %08x\n", hres);
+    ok(hres == S_OK, "FindMimeFromData failed: %08lx\n", hres);
     ok(!lstrcmpW(mime, L"text/plain"), "wrong mime: %s\n", wine_dbgstr_w(mime));
     CoTaskMemFree(mime);
 
     hres = pFindMimeFromData(NULL, NULL, data1, 0, text_plainW, 0, NULL, 0);
-    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08lx, expected E_INVALIDARG\n", hres);
 }
 
 static void register_protocols(void)
@@ -818,13 +818,13 @@ static void register_protocols(void)
     static const WCHAR wszAbout[] = {'a','b','o','u','t',0};
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = CoGetClassObject(&CLSID_AboutProtocol, CLSCTX_INPROC_SERVER, NULL,
             &IID_IClassFactory, (void**)&factory);
-    ok(hres == S_OK, "Could not get AboutProtocol factory: %08x\n", hres);
+    ok(hres == S_OK, "Could not get AboutProtocol factory: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
@@ -1002,21 +1002,21 @@ static void test_NameSpace(void)
     static const WCHAR wszTest[] = {'t','e','s','t',0};
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSession_RegisterNameSpace(session, NULL, &IID_NULL,
                                               wszTest, 0, NULL, 0);
-    ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
                                               NULL, 0, NULL, 0);
-    ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "RegisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
                                               wszTest, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     qiret = E_NOINTERFACE;
     expect_cf = &test_protocol_cf;
@@ -1025,7 +1025,7 @@ static void test_NameSpace(void)
     SET_EXPECT(ParseUrl_ENCODE);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(CreateInstance);
@@ -1036,7 +1036,7 @@ static void test_NameSpace(void)
     SET_EXPECT(ParseUrl_ENCODE);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(ParseUrl_ENCODE);
@@ -1046,7 +1046,7 @@ static void test_NameSpace(void)
     SET_EXPECT(ParseUrl_UNESCAPE);
 
     hres = pCoInternetParseUrl(url8, PARSE_UNESCAPE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(ParseUrl_UNESCAPE);
@@ -1055,8 +1055,8 @@ static void test_NameSpace(void)
     SET_EXPECT(ParseUrl);
 
     hres = pCoInternetParseUrl(url8, PARSE_SECURITY_URL, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
-    ok(size == ARRAY_SIZE(url1), "Size = %d\n", size);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
+    ok(size == ARRAY_SIZE(url1), "Size = %ld\n", size);
     if(size == ARRAY_SIZE(url1))
         ok(!memcmp(buf, url1, sizeof(url1)), "Encoded url = %s\n", wine_dbgstr_w(buf));
 
@@ -1068,7 +1068,7 @@ static void test_NameSpace(void)
 
     if (pCoInternetGetSecurityUrl) {
         hres = pCoInternetGetSecurityUrl(url8, &sec_url, PSU_SECURITY_URL_ONLY, 0);
-        ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08x\n", hres);
+        ok(hres == S_OK, "CoInternetGetSecurityUrl failed: %08lx\n", hres);
         if(hres == S_OK) {
             ok(lstrlenW(sec_url) > ARRAY_SIZE(wszFile) &&
                     !memcmp(sec_url, wszFile, sizeof(wszFile)-sizeof(WCHAR)),
@@ -1081,71 +1081,71 @@ static void test_NameSpace(void)
     }
 
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf2, &IID_NULL,
                                               wszTest, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
                                               wszTest, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &test_protocol_cf, &IID_NULL,
                                               wszTest, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl_ENCODE);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(ParseUrl_ENCODE);
 
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
 
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl_ENCODE);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(ParseUrl_ENCODE);
 
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
 
     expect_cf = &test_protocol_cf2;
     SET_EXPECT(QI_IInternetProtocolInfo);
     SET_EXPECT(ParseUrl_ENCODE);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     CHECK_CALLED(QI_IInternetProtocolInfo);
     CHECK_CALLED(ParseUrl_ENCODE);
 
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf, NULL);
-    ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08lx\n", hres);
     hres = IInternetSession_UnregisterNameSpace(session, NULL, wszTest);
-    ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UnregisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_UnregisterNameSpace(session, &test_protocol_cf2, wszTest);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
 
     hres = pCoInternetParseUrl(url8, PARSE_ENCODE, 0, buf, ARRAY_SIZE(buf), &size, 0);
-    ok(hres == S_OK, "CoInternetParseUrl failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetParseUrl failed: %08lx\n", hres);
 
     IInternetSession_Release(session);
 }
@@ -1158,21 +1158,21 @@ static void test_MimeFilter(void)
     static const WCHAR mimeW[] = {'t','e','s','t','/','m','i','m','e',0};
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSession_RegisterMimeFilter(session, &test_cf, &IID_NULL, mimeW);
-    ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
 
     hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
-    ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
 
     hres = IInternetSession_UnregisterMimeFilter(session, &test_cf, mimeW);
-    ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
 
     hres = IInternetSession_UnregisterMimeFilter(session, (void*)0xdeadbeef, mimeW);
-    ok(hres == S_OK, "UnregisterMimeFilter failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterMimeFilter failed: %08lx\n", hres);
 
     IInternetSession_Release(session);
 }
@@ -1201,7 +1201,7 @@ static void test_ReleaseBindInfo(void)
     bi.pUnk = &unk;
     SET_EXPECT(unk_Release);
     pReleaseBindInfo(&bi);
-    ok(bi.cbSize == sizeof(BINDINFO), "bi.cbSize=%d\n", bi.cbSize);
+    ok(bi.cbSize == sizeof(BINDINFO), "bi.cbSize=%ld\n", bi.cbSize);
     ok(bi.pUnk == NULL, "bi.pUnk=%p, expected NULL\n", bi.pUnk);
     CHECK_CALLED(unk_Release);
 
@@ -1209,13 +1209,13 @@ static void test_ReleaseBindInfo(void)
     bi.cbSize = offsetof(BINDINFO, pUnk);
     bi.pUnk = &unk;
     pReleaseBindInfo(&bi);
-    ok(bi.cbSize == offsetof(BINDINFO, pUnk), "bi.cbSize=%d\n", bi.cbSize);
+    ok(bi.cbSize == offsetof(BINDINFO, pUnk), "bi.cbSize=%ld\n", bi.cbSize);
     ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
 
     memset(&bi, 0, sizeof(bi));
     bi.pUnk = &unk;
     pReleaseBindInfo(&bi);
-    ok(!bi.cbSize, "bi.cbSize=%d, expected 0\n", bi.cbSize);
+    ok(!bi.cbSize, "bi.cbSize=%ld, expected 0\n", bi.cbSize);
     ok(bi.pUnk == &unk, "bi.pUnk=%p, expected %p\n", bi.pUnk, &unk);
 }
 
@@ -1235,8 +1235,8 @@ static void test_CopyStgMedium(void)
     src.tymed = TYMED_NULL;
     src.pUnkForRelease = NULL;
     hres = pCopyStgMedium(&src, &dst);
-    ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
-    ok(dst.tymed == TYMED_NULL, "tymed=%d\n", dst.tymed);
+    ok(hres == S_OK, "CopyStgMedium failed: %08lx\n", hres);
+    ok(dst.tymed == TYMED_NULL, "tymed=%ld\n", dst.tymed);
     ok(dst.u.hGlobal == empty, "u=%p\n", dst.u.hGlobal);
     ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
 
@@ -1245,8 +1245,8 @@ static void test_CopyStgMedium(void)
     src.u.pstm = NULL;
     src.pUnkForRelease = NULL;
     hres = pCopyStgMedium(&src, &dst);
-    ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
-    ok(dst.tymed == TYMED_ISTREAM, "tymed=%d\n", dst.tymed);
+    ok(hres == S_OK, "CopyStgMedium failed: %08lx\n", hres);
+    ok(dst.tymed == TYMED_ISTREAM, "tymed=%ld\n", dst.tymed);
     ok(!dst.u.pstm, "pstm=%p\n", dst.u.pstm);
     ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
 
@@ -1255,8 +1255,8 @@ static void test_CopyStgMedium(void)
     src.u.lpszFileName = fileW;
     src.pUnkForRelease = NULL;
     hres = pCopyStgMedium(&src, &dst);
-    ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
-    ok(dst.tymed == TYMED_FILE, "tymed=%d\n", dst.tymed);
+    ok(hres == S_OK, "CopyStgMedium failed: %08lx\n", hres);
+    ok(dst.tymed == TYMED_FILE, "tymed=%ld\n", dst.tymed);
     ok(dst.u.lpszFileName && dst.u.lpszFileName != fileW, "lpszFileName=%p\n", dst.u.lpszFileName);
     ok(!lstrcmpW(dst.u.lpszFileName, fileW), "wrong file name\n");
     ok(!dst.pUnkForRelease, "pUnkForRelease=%p, expected NULL\n", dst.pUnkForRelease);
@@ -1270,8 +1270,8 @@ static void test_CopyStgMedium(void)
     src.tymed = TYMED_HGLOBAL;
     src.u.hGlobal = hg;
     hres = pCopyStgMedium(&src, &dst);
-    ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
-    ok(dst.tymed == TYMED_HGLOBAL, "tymed=%d\n", dst.tymed);
+    ok(hres == S_OK, "CopyStgMedium failed: %08lx\n", hres);
+    ok(dst.tymed == TYMED_HGLOBAL, "tymed=%ld\n", dst.tymed);
     ok(dst.u.hGlobal != hg, "got %p, %p\n", dst.u.hGlobal, hg);
     size = GlobalSize(dst.u.hGlobal);
     ok(size == 10, "got size %d\n", size);
@@ -1288,13 +1288,13 @@ static void test_CopyStgMedium(void)
     src.tymed = TYMED_HGLOBAL;
     src.u.hGlobal = NULL;
     hres = pCopyStgMedium(&src, &dst);
-    ok(hres == S_OK, "CopyStgMedium failed: %08x\n", hres);
+    ok(hres == S_OK, "CopyStgMedium failed: %08lx\n", hres);
     ok(dst.u.hGlobal == NULL, "got %p\n", dst.u.hGlobal);
 
     hres = pCopyStgMedium(&src, NULL);
-    ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
+    ok(hres == E_POINTER, "CopyStgMedium failed: %08lx, expected E_POINTER\n", hres);
     hres = pCopyStgMedium(NULL, &dst);
-    ok(hres == E_POINTER, "CopyStgMedium failed: %08x, expected E_POINTER\n", hres);
+    ok(hres == E_POINTER, "CopyStgMedium failed: %08lx, expected E_POINTER\n", hres);
 }
 
 static void test_CopyBindInfo(void)
@@ -1305,27 +1305,27 @@ static void test_CopyBindInfo(void)
     int i;
 
     hres = pCopyBindInfo(NULL, NULL);
-    ok(hres == E_POINTER, "CopyBindInfo returned %08x, expected E_POINTER\n", hres);
+    ok(hres == E_POINTER, "CopyBindInfo returned %08lx, expected E_POINTER\n", hres);
 
     memset(src, 0, sizeof(BINDINFO[2]));
     memset(dest, 0xde, sizeof(BINDINFO[2]));
     hres = pCopyBindInfo(src, dest);
-    ok(hres == E_INVALIDARG, "CopyBindInfo returned: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CopyBindInfo returned: %08lx, expected E_INVALIDARG\n", hres);
 
     memset(src, 0, sizeof(BINDINFO[2]));
     memset(dest, 0xde, sizeof(BINDINFO[2]));
     src[0].cbSize = sizeof(BINDINFO);
     dest[0].cbSize = 0;
     hres = pCopyBindInfo(src, dest);
-    ok(hres == E_INVALIDARG, "CopyBindInfo returned: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CopyBindInfo returned: %08lx, expected E_INVALIDARG\n", hres);
 
     memset(src, 0, sizeof(BINDINFO[2]));
     memset(dest, 0xde, sizeof(BINDINFO[2]));
     src[0].cbSize = 1;
     dest[0].cbSize = sizeof(BINDINFO)+sizeof(DWORD);
     hres = pCopyBindInfo(src, dest);
-    ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
-    ok(dest[0].cbSize == sizeof(BINDINFO)+sizeof(DWORD), "incorrect cbSize: %d\n", dest[0].cbSize);
+    ok(hres == S_OK, "CopyBindInfo failed: %08lx\n", hres);
+    ok(dest[0].cbSize == sizeof(BINDINFO)+sizeof(DWORD), "incorrect cbSize: %ld\n", dest[0].cbSize);
     for(i=1; i<dest[0].cbSize/sizeof(int); i++)
         ok(((int*)dest)[i] == 0, "unset values should be set to 0, got %d on %d\n", ((int*)dest)[i], i);
 
@@ -1334,7 +1334,7 @@ static void test_CopyBindInfo(void)
     src[0].cbSize = sizeof(BINDINFO)+2*sizeof(DWORD);
     dest[0].cbSize = sizeof(BINDINFO)+sizeof(DWORD);
     hres = pCopyBindInfo(src, dest);
-    ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "CopyBindInfo failed: %08lx\n", hres);
     ok(dest[1].cbSize == src[1].cbSize, "additional data should be copied\n");
     ok(dest[1].szExtraInfo != src[1].szExtraInfo,
             "data not fitting in destination buffer should not be copied\n");
@@ -1350,29 +1350,29 @@ static void test_CopyBindInfo(void)
     src[0].stgmedData.pUnkForRelease = NULL;
     dest[0].cbSize = sizeof(BINDINFO);
     hres = pCopyBindInfo(src, dest);
-    ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "CopyBindInfo failed: %08lx\n", hres);
 
-    ok(dest[0].cbSize == sizeof(BINDINFO), "incorrect cbSize: %d\n", dest[0].cbSize);
+    ok(dest[0].cbSize == sizeof(BINDINFO), "incorrect cbSize: %ld\n", dest[0].cbSize);
     ok(dest[0].szExtraInfo && !dest[0].szExtraInfo[0] && dest[0].szExtraInfo!=src[0].szExtraInfo,
             "incorrect szExtraInfo: (%p!=%p) %d\n", dest[0].szExtraInfo,
             src[0].szExtraInfo, dest[0].szExtraInfo[0]);
     ok(!memcmp(&dest[0].stgmedData, &src[0].stgmedData, sizeof(STGMEDIUM)),
             "incorrect stgmedData value\n");
-    ok(src[0].grfBindInfoF == dest[0].grfBindInfoF, "grfBindInfoF = %x, expected %x\n",
+    ok(src[0].grfBindInfoF == dest[0].grfBindInfoF, "grfBindInfoF = %lx, expected %lx\n",
             dest[0].grfBindInfoF, src[0].grfBindInfoF);
-    ok(src[0].dwBindVerb == dest[0].dwBindVerb, "dwBindVerb = %x, expected %x\n",
+    ok(src[0].dwBindVerb == dest[0].dwBindVerb, "dwBindVerb = %lx, expected %lx\n",
             dest[0].dwBindVerb, src[0].dwBindVerb);
     ok(!dest[0].szCustomVerb, "szCustmoVerb != NULL\n");
-    ok(src[0].cbstgmedData == dest[0].cbstgmedData, "cbstgmedData = %x, expected %x\n",
+    ok(src[0].cbstgmedData == dest[0].cbstgmedData, "cbstgmedData = %lx, expected %lx\n",
             dest[0].cbstgmedData, src[0].cbstgmedData);
-    ok(src[0].dwOptions == dest[0].dwOptions, "dwOptions = %x, expected %x\n",
+    ok(src[0].dwOptions == dest[0].dwOptions, "dwOptions = %lx, expected %lx\n",
             dest[0].dwOptions, src[0].dwOptions);
-    ok(src[0].dwOptionsFlags == dest[0].dwOptionsFlags, "dwOptionsFlags = %x, expected %x\n",
+    ok(src[0].dwOptionsFlags == dest[0].dwOptionsFlags, "dwOptionsFlags = %lx, expected %lx\n",
             dest[0].dwOptionsFlags, src[0].dwOptionsFlags);
-    ok(src[0].dwCodePage == dest[0].dwCodePage, "dwCodePage = %x, expected %x\n",
+    ok(src[0].dwCodePage == dest[0].dwCodePage, "dwCodePage = %lx, expected %lx\n",
             dest[0].dwCodePage, src[0].dwCodePage);
     ok(!dest[0].securityAttributes.nLength,
-            "unexpected securityAttributes.nLength value: %d\n",
+            "unexpected securityAttributes.nLength value: %ld\n",
             dest[0].securityAttributes.nLength);
     ok(!dest[0].securityAttributes.lpSecurityDescriptor,
             "unexpected securityAttributes.lpSecurityDescriptor value: %p\n",
@@ -1383,7 +1383,7 @@ static void test_CopyBindInfo(void)
     ok(!memcmp(&dest[0].iid, &src[0].iid, sizeof(IID)),
             "incorrect iid value\n");
     ok(!dest[0].pUnk, "pUnk != NULL\n");
-    ok(src[0].dwReserved == dest[0].dwReserved, "dwReserved = %x, expected %x\n",
+    ok(src[0].dwReserved == dest[0].dwReserved, "dwReserved = %lx, expected %lx\n",
             dest[0].dwReserved, src[0].dwReserved);
 
     CoTaskMemFree(src[0].szExtraInfo);
@@ -1396,9 +1396,9 @@ static void test_CopyBindInfo(void)
     src[0].securityAttributes.lpSecurityDescriptor = (void*)&sec_desc;
     src[0].securityAttributes.bInheritHandle = TRUE;
     hres = pCopyBindInfo(src, dest);
-    ok(hres == S_OK, "CopyBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "CopyBindInfo failed: %08lx\n", hres);
     ok(!dest[0].securityAttributes.nLength,
-            "unexpected securityAttributes.nLength value: %d\n",
+            "unexpected securityAttributes.nLength value: %ld\n",
             dest[0].securityAttributes.nLength);
     ok(!dest[0].securityAttributes.lpSecurityDescriptor,
             "unexpected securityAttributes.lpSecurityDescriptor value: %p\n",
@@ -1416,36 +1416,36 @@ static void test_UrlMkGetSessionOption(void)
     size = encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
                                  sizeof(encoding), &size, 0);
-    ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == S_OK, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(encoding != 0xdeadbeef, "encoding not changed\n");
-    ok(size == sizeof(encoding), "size=%d\n", size);
+    ok(size == sizeof(encoding), "size=%ld\n", size);
 
     size = encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
                                  sizeof(encoding)+1, &size, 0);
-    ok(hres == S_OK, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == S_OK, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(encoding != 0xdeadbeef, "encoding not changed\n");
-    ok(size == sizeof(encoding), "size=%d\n", size);
+    ok(size == sizeof(encoding), "size=%ld\n", size);
 
     size = encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
                                  sizeof(encoding)-1, &size, 0);
-    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
-    ok(size == 0xdeadbeef, "size=%d\n", size);
+    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
+    ok(size == 0xdeadbeef, "size=%ld\n", size);
 
     size = encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, NULL,
                                  sizeof(encoding)-1, &size, 0);
-    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
-    ok(size == 0xdeadbeef, "size=%d\n", size);
+    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
+    ok(size == 0xdeadbeef, "size=%ld\n", size);
 
     encoding = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_URL_ENCODING, &encoding,
                                  sizeof(encoding)-1, NULL, 0);
-    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
+    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(encoding == 0xdeadbeef, "encoding = %08lx, exepcted 0xdeadbeef\n", encoding);
 }
 
 static size_t check_prefix(const char *str, const char *prefix)
@@ -1473,35 +1473,35 @@ static void test_user_agent(void)
     DWORD size, saved;
 
     hres = pObtainUserAgentString(0, NULL, NULL);
-    ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08lx\n", hres);
 
     size = 100;
     hres = pObtainUserAgentString(0, NULL, &size);
-    ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size == 100, "size=%d, expected %d\n", size, 100);
+    ok(hres == E_INVALIDARG, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size == 100, "size=%ld, expected %d\n", size, 100);
 
     size = 0;
     hres = pObtainUserAgentString(0, str, &size);
-    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size > 0, "size=%d, expected non-zero\n", size);
+    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size > 0, "size=%ld, expected non-zero\n", size);
 
     size = 2;
     str[0] = 'a';
     hres = pObtainUserAgentString(0, str, &size);
-    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size > 0, "size=%d, expected non-zero\n", size);
+    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size > 0, "size=%ld, expected non-zero\n", size);
     ok(str[0] == 'a', "str[0]=%c, expected 'a'\n", str[0]);
 
     size = 0;
     hres = pObtainUserAgentString(1, str, &size);
-    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size > 0, "size=%d, expected non-zero\n", size);
+    ok(hres == E_OUTOFMEMORY, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size > 0, "size=%ld, expected non-zero\n", size);
 
     str2 = HeapAlloc(GetProcessHeap(), 0, (size+20)*sizeof(CHAR));
     saved = size;
     hres = pObtainUserAgentString(0, str2, &size);
-    ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size == saved, "size=%d, expected %d\n", size, saved);
+    ok(hres == S_OK, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size == saved, "size=%ld, expected %ld\n", size, saved);
     ok(strlen(expected) <= strlen(str2) &&
        !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
        "user agent was \"%s\", expected to start with \"%s\"\n",
@@ -1516,16 +1516,16 @@ static void test_user_agent(void)
         if (i != 7) {
             size = sizeof(ua);
             hres = pObtainUserAgentString(i | UAS_EXACTLEGACY, ua, &size);
-            ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
-            ok(size == strlen(ua) + 1, "unexpected size %u, expected %u\n", size, strlen(ua) + 1);
+            ok(hres == S_OK, "ObtainUserAgentString failed: %08lx\n", hres);
+            ok(size == strlen(ua) + 1, "unexpected size %lu, expected %Iu\n", size, strlen(ua) + 1);
             ok(!strcmp(ua, str2), "unexpected UA for version %u %s, expected %s\n",
                i, wine_dbgstr_a(ua), wine_dbgstr_a(str2));
         }
 
         size = sizeof(ua);
         hres = pObtainUserAgentString(i != 1 ? i : UAS_EXACTLEGACY | 7, ua, &size);
-        ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
-        ok(size == strlen(ua) + 1, "unexpected size %u, expected %u\n", size, strlen(ua) + 1);
+        ok(hres == S_OK, "ObtainUserAgentString failed: %08lx\n", hres);
+        ok(size == strlen(ua) + 1, "unexpected size %lu, expected %Iu\n", size, strlen(ua) + 1);
         if(i < 8 && i != 1)
             ok(!strcmp(ua, str2), "unexpected UA for version %u %s, expected %s\n",
                i, wine_dbgstr_a(ua), wine_dbgstr_a(str2));
@@ -1539,7 +1539,7 @@ static void test_user_agent(void)
             sprintf(buf, "MSIE %u.0; ", max(i, 7));
             p += check_prefix(p, buf);
         }
-        sprintf(buf, "Windows NT %u.%u; ", os_info.dwMajorVersion, os_info.dwMinorVersion);
+        sprintf(buf, "Windows NT %lu.%lu; ", os_info.dwMajorVersion, os_info.dwMinorVersion);
         p += check_prefix(p, buf);
         if(is_wow) {
             p += check_prefix(p, "WOW64; ");
@@ -1581,24 +1581,24 @@ static void test_user_agent(void)
 
     size = saved+10;
     hres = pObtainUserAgentString(0, str2, &size);
-    ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
-    ok(size == saved, "size=%d, expected %d\n", size, saved);
+    ok(hres == S_OK, "ObtainUserAgentString failed: %08lx\n", hres);
+    ok(size == saved, "size=%ld, expected %ld\n", size, saved);
 
     size = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(size, "size == 0\n");
 
     size = 0xdeadbeef;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 1000, &size, 0);
-    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(size, "size == 0\n");
 
     saved = size;
     size = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved+10, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(size == saved, "size = %d, expected %d\n", size, saved);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(size == saved, "size = %ld, expected %ld\n", size, saved);
     ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
        "user agent was \"%s\", expected to start with \"%s\"\n",
        str2, expected);
@@ -1606,8 +1606,8 @@ static void test_user_agent(void)
     size = 0;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(size == saved, "size = %d, expected %d\n", size, saved);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(size == saved, "size = %ld, expected %ld\n", size, saved);
     ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
        "user agent was \"%s\", expected to start with \"%s\"\n",
        str2, expected);
@@ -1615,51 +1615,51 @@ static void test_user_agent(void)
     size = saved;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved-1, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
-    ok(size == saved, "size = %d, expected %d\n", size, saved);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
+    ok(size == saved, "size = %ld, expected %ld\n", size, saved);
     ok(!str2[0], "buf changed\n");
 
     size = saved;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, NULL, 0);
-    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(!str2[0], "buf changed\n");
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, sizeof(test_str), 0);
-    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     size = 0;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test2_str, sizeof(test2_str), 0);
-    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     size = 0;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 2, 0);
-    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == S_OK, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     size = 0;
     str2[0] = 0;
     hres = pUrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
-    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+    ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08lx\n", hres);
     ok(size == 3 && !strcmp(str2, "te"), "wrong user agent\n");
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 0, 0);
-    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, sizeof(test_str), 0);
-    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, 0);
-    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08lx\n", hres);
 
     HeapFree(GetProcessHeap(), 0, str2);
 }
@@ -1716,40 +1716,40 @@ static void test_MkParseDisplayNameEx(void)
                                     invalid_parameters[i].pchEaten,
                                     invalid_parameters[i].ppmk);
         ok(hres == E_INVALIDARG,
-            "[%d] Expected MkParseDisplayNameEx to return E_INVALIDARG, got %08x\n", i, hres);
-        ok(eaten == 0xdeadbeef, "[%d] Expected eaten to be 0xdeadbeef, got %u\n", i, eaten);
+            "[%d] Expected MkParseDisplayNameEx to return E_INVALIDARG, got %08lx\n", i, hres);
+        ok(eaten == 0xdeadbeef, "[%d] Expected eaten to be 0xdeadbeef, got %lu\n", i, eaten);
         ok(mon == (IMoniker *)0xdeadbeef, "[%d] Expected mon to be 0xdeadbeef, got %p\n", i, mon);
     }
 
     hres = MkParseDisplayNameEx(bctx, url9, &eaten, &mon);
-    ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
-    ok(eaten == ARRAY_SIZE(url9)-1, "eaten=%d\n", eaten);
+    ok(hres == S_OK, "MkParseDisplayNameEx failed: %08lx\n", hres);
+    ok(eaten == ARRAY_SIZE(url9)-1, "eaten=%ld\n", eaten);
     ok(mon != NULL, "mon == NULL\n");
 
     hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
-    ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
+    ok(hres == S_OK, "GetDisplayName failed: %08lx\n", hres);
     ok(!lstrcmpW(name, url9), "wrong display name %s\n", wine_dbgstr_w(name));
     CoTaskMemFree(name);
 
     hres = IMoniker_IsSystemMoniker(mon, &issys);
-    ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
-    ok(issys == MKSYS_URLMONIKER, "issys=%x\n", issys);
+    ok(hres == S_OK, "IsSystemMoniker failed: %08lx\n", hres);
+    ok(issys == MKSYS_URLMONIKER, "issys=%lx\n", issys);
 
     IMoniker_Release(mon);
 
     hres = MkParseDisplayNameEx(bctx, clsid_nameW, &eaten, &mon);
-    ok(hres == S_OK, "MkParseDisplayNameEx failed: %08x\n", hres);
-    ok(eaten == ARRAY_SIZE(clsid_nameW)-1, "eaten=%d\n", eaten);
+    ok(hres == S_OK, "MkParseDisplayNameEx failed: %08lx\n", hres);
+    ok(eaten == ARRAY_SIZE(clsid_nameW)-1, "eaten=%ld\n", eaten);
     ok(mon != NULL, "mon == NULL\n");
 
     hres = IMoniker_IsSystemMoniker(mon, &issys);
-    ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres);
-    ok(issys == MKSYS_CLASSMONIKER, "issys=%x\n", issys);
+    ok(hres == S_OK, "IsSystemMoniker failed: %08lx\n", hres);
+    ok(issys == MKSYS_CLASSMONIKER, "issys=%lx\n", issys);
 
     IMoniker_Release(mon);
 
     hres = MkParseDisplayNameEx(bctx, url8, &eaten, &mon);
-    ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08x\n", hres);
+    ok(FAILED(hres), "MkParseDisplayNameEx succeeded: %08lx\n", hres);
 
     IBindCtx_Release(bctx);
 }
@@ -1760,15 +1760,15 @@ static void test_IsValidURL(void)
     IBindCtx *bctx = NULL;
 
     hr = IsValidURL(NULL, 0, 0);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
 
     hr = IsValidURL(NULL, wszHttpWineHQ, 0);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     CreateBindCtx(0, &bctx);
 
     hr = IsValidURL(bctx, wszHttpWineHQ, 0);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     IBindCtx_Release(bctx);
 }
@@ -1816,7 +1816,7 @@ static void test_internet_feature_defaults(void) {
     for(i = 0; i < ARRAY_SIZE(default_feature_tests); ++i) {
         hres = pCoInternetIsFeatureEnabled(default_feature_tests[i].feature, default_feature_tests[i].get_flags);
         todo_wine_if (default_feature_tests[i].todo)
-            ok(hres == default_feature_tests[i].expected, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
+            ok(hres == default_feature_tests[i].expected, "CoInternetIsFeatureEnabled returned %08lx, expected %08lx on test %ld\n",
                 hres, default_feature_tests[i].expected, i);
     }
 }
@@ -1851,13 +1851,13 @@ static void test_internet_features_registry(void) {
     }
 
     res = GetModuleFileNameA(NULL, module, sizeof(module));
-    ok(res, "GetModuleFileName failed: %d\n", GetLastError());
+    ok(res, "GetModuleFileName failed: %ld\n", GetLastError());
 
     name = strrchr(module, '\\')+1;
 
     /* Some Windows machines don't have a FeatureControl key in HKCU. */
     res = RegOpenKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &feature_control);
-    ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegCreateKey failed: %ld\n", res);
 
     res = RegOpenKeyA(feature_control, szFeatureBehaviorsKey, &feature);
     if(res == ERROR_SUCCESS) {
@@ -1865,15 +1865,15 @@ static void test_internet_features_registry(void) {
         delete_feature_key = FALSE;
     }else {
         res = RegCreateKeyA(feature_control, szFeatureBehaviorsKey, &feature);
-        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %ld\n", res);
     }
 
     value = 0;
     res = RegSetValueExA(feature, name, 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
-    ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %ld\n", res);
 
     hres = pCoInternetIsFeatureEnabled(FEATURE_BEHAVIORS, GET_FEATURE_FROM_PROCESS);
-    ok(hres == S_FALSE, "CoInternetIsFeatureEnabled returned %08x, expected S_FALSE\n", hres);
+    ok(hres == S_FALSE, "CoInternetIsFeatureEnabled returned %08lx, expected S_FALSE\n", hres);
 
     if(delete_feature_key) {
         RegCloseKey(feature);
@@ -1885,19 +1885,19 @@ static void test_internet_features_registry(void) {
 
     /* IE's feature control cached the value it got from the registry earlier. */
     hres = pCoInternetIsFeatureEnabled(FEATURE_BEHAVIORS, GET_FEATURE_FROM_PROCESS);
-    ok(hres == S_FALSE, "CoInternetIsFeatureEnabled returned %08x, expected S_FALSE\n", hres);
+    ok(hres == S_FALSE, "CoInternetIsFeatureEnabled returned %08lx, expected S_FALSE\n", hres);
 
     /* Restore this feature back to its default value. */
     hres = pCoInternetSetFeatureEnabled(FEATURE_BEHAVIORS, SET_FEATURE_ON_PROCESS, TRUE);
-    ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08lx\n", hres);
 
     RegCloseKey(feature_control);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szFeatureControlKey, &feature_control);
-    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res);
 
     res = RegOpenKeyA(feature_control, szFeatureZoneElevationKey, &feature);
-    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res);
 
     value = 1;
     res = RegSetValueExA(feature, "*", 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
@@ -1909,10 +1909,10 @@ static void test_internet_features_registry(void) {
     else
     {
         skip_zone = FALSE;
-        ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
+        ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %ld\n", res);
 
         hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
-        ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
+        ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08lx, expected S_OK\n", hres);
     }
     RegDeleteValueA(feature, "*");
     RegCloseKey(feature);
@@ -1922,10 +1922,10 @@ static void test_internet_features_registry(void) {
     if (!skip_zone)
     {
         hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
-        ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08x, expected S_OK\n", hres);
+        ok(hres == S_OK, "CoInternetIsFeatureEnabled returned %08lx, expected S_OK\n", hres);
 
         hres = pCoInternetSetFeatureEnabled(FEATURE_ZONE_ELEVATION, SET_FEATURE_ON_PROCESS, FALSE);
-        ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08x\n", hres);
+        ok(hres == S_OK, "CoInternetSetFeatureEnabled failed: %08lx\n", hres);
     }
 
     test_internet_feature_defaults();
@@ -1935,7 +1935,7 @@ static void test_CoInternetIsFeatureEnabled(void) {
     HRESULT hres;
 
     hres = pCoInternetIsFeatureEnabled(FEATURE_ENTRY_COUNT, GET_FEATURE_FROM_PROCESS);
-    ok(hres == E_FAIL, "CoInternetIsFeatureEnabled returned %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "CoInternetIsFeatureEnabled returned %08lx, expected E_FAIL\n", hres);
 }
 
 static const struct {
@@ -1958,18 +1958,18 @@ static void test_CoInternetSetFeatureEnabled(void) {
     DWORD i;
 
     hres = pCoInternetSetFeatureEnabled(FEATURE_ENTRY_COUNT,SET_FEATURE_ON_PROCESS,TRUE);
-    ok(hres == E_FAIL, "CoInternetSetFeatureEnabled returned %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "CoInternetSetFeatureEnabled returned %08lx, expected E_FAIL\n", hres);
 
     for(i = 0; i < ARRAY_SIZE(internet_feature_tests); ++i) {
         hres = pCoInternetSetFeatureEnabled(internet_feature_tests[i].feature, internet_feature_tests[i].set_flags,
                                             internet_feature_tests[i].enable);
         todo_wine_if (internet_feature_tests[i].set_todo)
-            ok(hres == internet_feature_tests[i].set_expected, "CoInternetSetFeatureEnabled returned %08x, expected %08x on test %d\n",
+            ok(hres == internet_feature_tests[i].set_expected, "CoInternetSetFeatureEnabled returned %08lx, expected %08lx on test %ld\n",
                 hres, internet_feature_tests[i].set_expected, i);
 
         hres = pCoInternetIsFeatureEnabled(internet_feature_tests[i].feature, internet_feature_tests[i].set_flags);
         todo_wine_if (internet_feature_tests[i].get_todo)
-            ok(hres == internet_feature_tests[i].get_expected, "CoInternetIsFeatureEnabled returned %08x, expected %08x on test %d\n",
+            ok(hres == internet_feature_tests[i].get_expected, "CoInternetIsFeatureEnabled returned %08lx, expected %08lx on test %ld\n",
                 hres, internet_feature_tests[i].get_expected, i);
 
     }
@@ -1994,14 +1994,14 @@ static void test_internet_features(void) {
         BOOL ret;
 
         res = RegCreateKeyA(HKEY_CURRENT_USER, szFeatureControlKey, &key);
-        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %ld\n", res);
 
         trace("Running features tests in a separated process.\n");
 
         winetest_get_mainargs( &argv );
         sprintf(cmdline, "\"%s\" %s internet_features", argv[0], argv[1]);
         ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-        ok(ret, "Could not create process: %u\n", GetLastError());
+        ok(ret, "Could not create process: %lu\n", GetLastError());
         wait_child_process( pi.hProcess );
         CloseHandle(pi.hThread);
         CloseHandle(pi.hProcess);
@@ -2180,11 +2180,11 @@ static DWORD WINAPI bsc_thread(void *arg)
 
     hres = CoMarshalInterface(stream, &IID_IBindStatusCallback, (IUnknown*)&BindStatusCallback,
                               MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hres == S_OK, "CoMarshalInterface failed: %08x\n", hres);
+    ok(hres == S_OK, "CoMarshalInterface failed: %08lx\n", hres);
 
     zero.QuadPart = 0;
     hres = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
-    ok(hres == S_OK, "Seek failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "Seek failed: 0x%08lx\n", hres);
 
     SetEvent(thread_ready);
 
@@ -2214,19 +2214,19 @@ static void test_bsc_marshaling(void)
     HRESULT hres;
 
     hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08x\n", hres);
+    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08lx\n", hres);
 
     thread_ready = CreateEventW(NULL, TRUE, FALSE, NULL);
     thread = CreateThread(NULL, 0, bsc_thread, stream, 0, NULL);
     WaitForSingleObject(thread_ready, INFINITE);
 
     hres = CoUnmarshalInterface(stream, &IID_IBindStatusCallback, (void**)&bsc);
-    ok(hres == S_OK, "CoUnmarshalInterface failed: %08x\n", hres);
+    ok(hres == S_OK, "CoUnmarshalInterface failed: %08lx\n", hres);
 
     hres = CreateStreamOnHGlobal(NULL, TRUE, &binding_stream);
-    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08x\n", hres);
+    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08lx\n", hres);
     hres = IStream_Write(binding_stream, "xxx", 3, NULL);
-    ok(hres == S_OK, "Write failed: %08x\n", hres);
+    ok(hres == S_OK, "Write failed: %08lx\n", hres);
 
     rem_bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
     bindf = 0xdeadbeef;
@@ -2268,22 +2268,22 @@ static void test_bsc_marshaling(void)
     unk_out.ref = 1;
 
     hres = IBindStatusCallback_GetBindInfo(bsc, &bindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-    ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+    ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
     ok(!in_bindinfo.szExtraInfo, "szExtraInfo = %s\n", wine_dbgstr_w(in_bindinfo.szExtraInfo));
-    ok(in_bindinfo.grfBindInfoF == 12, "cbSize = %u\n", in_bindinfo.grfBindInfoF);
-    ok(in_bindinfo.dwBindVerb == 13, "dwBindVerb = %u\n", in_bindinfo.dwBindVerb);
+    ok(in_bindinfo.grfBindInfoF == 12, "cbSize = %lu\n", in_bindinfo.grfBindInfoF);
+    ok(in_bindinfo.dwBindVerb == 13, "dwBindVerb = %lu\n", in_bindinfo.dwBindVerb);
     ok(!in_bindinfo.szCustomVerb, "szCustomVerb = %s\n", wine_dbgstr_w(in_bindinfo.szCustomVerb));
-    ok(in_bindinfo.cbstgmedData == 19, "cbstgmedData = %u\n", in_bindinfo.cbstgmedData);
-    ok(!in_bindinfo.dwOptions, "dwOptions = %u\n", in_bindinfo.dwOptions);
-    ok(!in_bindinfo.dwOptionsFlags, "dwOptionsFlags = %u\n", in_bindinfo.dwOptionsFlags);
-    ok(!in_bindinfo.dwCodePage, "dwCodePage = %u\n", in_bindinfo.dwCodePage);
+    ok(in_bindinfo.cbstgmedData == 19, "cbstgmedData = %lu\n", in_bindinfo.cbstgmedData);
+    ok(!in_bindinfo.dwOptions, "dwOptions = %lu\n", in_bindinfo.dwOptions);
+    ok(!in_bindinfo.dwOptionsFlags, "dwOptionsFlags = %lu\n", in_bindinfo.dwOptionsFlags);
+    ok(!in_bindinfo.dwCodePage, "dwCodePage = %lu\n", in_bindinfo.dwCodePage);
     ok(!in_bindinfo.iid.Data1, "iid = %s\n", debugstr_guid(&in_bindinfo.iid));
     ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-    ok(!in_bindinfo.dwReserved, "dwReserved = %u\n", in_bindinfo.dwReserved);
-    ok(!in_bindinfo.securityAttributes.nLength, "securityAttributes.nLength = %u\n",
+    ok(!in_bindinfo.dwReserved, "dwReserved = %lu\n", in_bindinfo.dwReserved);
+    ok(!in_bindinfo.securityAttributes.nLength, "securityAttributes.nLength = %lu\n",
        in_bindinfo.securityAttributes.nLength);
     ok(!in_bindinfo.securityAttributes.lpSecurityDescriptor,
        "securityAttributes.lpSecurityDescriptor = %p\n",
@@ -2293,22 +2293,22 @@ static void test_bsc_marshaling(void)
     ok(!in_bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
        in_bindinfo.stgmedData.pUnkForRelease);
 
-    ok(bindinfo.cbSize == sizeof(rem_bindinfo), "cbSize = %u\n", rem_bindinfo.cbSize);
+    ok(bindinfo.cbSize == sizeof(rem_bindinfo), "cbSize = %lu\n", rem_bindinfo.cbSize);
     ok(!lstrcmpW(bindinfo.szExtraInfo, L"extra info out"),
        "szExtraInfo = %s\n", wine_dbgstr_w(bindinfo.szExtraInfo));
-    ok(bindinfo.grfBindInfoF == 22, "grfBindInfoF = %u\n", rem_bindinfo.grfBindInfoF);
-    ok(bindinfo.dwBindVerb == 23, "dwBindVerb = %u\n", bindinfo.dwBindVerb);
+    ok(bindinfo.grfBindInfoF == 22, "grfBindInfoF = %lu\n", rem_bindinfo.grfBindInfoF);
+    ok(bindinfo.dwBindVerb == 23, "dwBindVerb = %lu\n", bindinfo.dwBindVerb);
     ok(bindinfo.szCustomVerb != verb_out, "szCustomVerb == inbuf\n");
     ok(!lstrcmpW(bindinfo.szCustomVerb, L"custom verb out"), "szCustomVerb = %s\n",
        wine_dbgstr_w(bindinfo.szCustomVerb));
-    ok(bindinfo.cbstgmedData == 29, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
-    ok(bindinfo.dwOptions == 24, "dwOptions = %u\n", bindinfo.dwOptions);
-    ok(bindinfo.dwOptionsFlags == 25, "dwOptionsFlags = %u\n", bindinfo.dwOptionsFlags);
-    ok(bindinfo.dwCodePage, "dwCodePage = %u\n", bindinfo.dwCodePage);
+    ok(bindinfo.cbstgmedData == 29, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
+    ok(bindinfo.dwOptions == 24, "dwOptions = %lu\n", bindinfo.dwOptions);
+    ok(bindinfo.dwOptionsFlags == 25, "dwOptionsFlags = %lu\n", bindinfo.dwOptionsFlags);
+    ok(bindinfo.dwCodePage, "dwCodePage = %lu\n", bindinfo.dwCodePage);
     ok(!bindinfo.iid.Data1, "iid = %s\n", debugstr_guid(&bindinfo.iid));
     ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-    ok(bindinfo.dwReserved == 18, "dwReserved = %u\n", bindinfo.dwReserved);
-    ok(bindinfo.securityAttributes.nLength == 30, "securityAttributes.nLength = %u\n",
+    ok(bindinfo.dwReserved == 18, "dwReserved = %lu\n", bindinfo.dwReserved);
+    ok(bindinfo.securityAttributes.nLength == 30, "securityAttributes.nLength = %lu\n",
        bindinfo.securityAttributes.nLength);
     ok(bindinfo.securityAttributes.lpSecurityDescriptor == (void*)0xdead0001,
        "securityAttributes.lpSecurityDescriptor = %p\n",
@@ -2317,14 +2317,14 @@ static void test_bsc_marshaling(void)
        bindinfo.securityAttributes.bInheritHandle);
     ok(bindinfo.stgmedData.pUnkForRelease == &unk_in.IUnknown_iface, "pUnkForRelease = %p\n",
        bindinfo.stgmedData.pUnkForRelease);
-    ok(unk_out.ref == 1, "unk_out.ref = %u\n", unk_out.ref);
+    ok(unk_out.ref == 1, "unk_out.ref = %lu\n", unk_out.ref);
 
     bindinfo.stgmedData.pUnkForRelease = NULL;
     ReleaseBindInfo(&bindinfo);
 
     zero.QuadPart = 0;
     hres = IStream_Seek(binding_stream, zero, STREAM_SEEK_SET, NULL);
-    ok(hres == S_OK, "Seek failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "Seek failed: 0x%08lx\n", hres);
 
     /* Return IStream stgmed from GetBindInfo, it's not marshaled back */
     rem_bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
@@ -2342,23 +2342,23 @@ static void test_bsc_marshaling(void)
     IStream_AddRef(binding_stream);
 
     hres = IBindStatusCallback_GetBindInfo(bsc, &bindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-    ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+    ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
     ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        in_bindinfo.stgmedData.tymed);
 
-    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
     ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        bindinfo.stgmedData.tymed);
     ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
        bindinfo.stgmedData.u.pstm);
     ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
        bindinfo.stgmedData.pUnkForRelease);
-    ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+    ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
     ReleaseBindInfo(&bindinfo);
 
@@ -2380,23 +2380,23 @@ static void test_bsc_marshaling(void)
     IStream_AddRef(binding_stream);
 
     hres = IBindStatusCallback_GetBindInfo(bsc, &bindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-    ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+    ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
     ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        in_bindinfo.stgmedData.tymed);
 
-    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
     ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        bindinfo.stgmedData.tymed);
     ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
        bindinfo.stgmedData.u.pstm);
     ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
        bindinfo.stgmedData.pUnkForRelease);
-    ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+    ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
     ReleaseBindInfo(&bindinfo);
 
@@ -2418,23 +2418,23 @@ static void test_bsc_marshaling(void)
     rem_bindinfo.cbstgmedData = 5;
 
     hres = IBindStatusCallback_GetBindInfo(bsc, &bindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-    ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+    ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+    ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
     ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        in_bindinfo.stgmedData.tymed);
 
-    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+    ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
     ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+    ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
        bindinfo.stgmedData.tymed);
     ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
        bindinfo.stgmedData.u.pstm);
     ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
        bindinfo.stgmedData.pUnkForRelease);
-    ok(bindinfo.cbstgmedData == 5, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+    ok(bindinfo.cbstgmedData == 5, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
     ReleaseBindInfo(&bindinfo);
 
@@ -2483,24 +2483,24 @@ static void test_bsc_marshaling(void)
         unk_out.ref = 1;
 
         hres = IBindStatusCallbackEx_GetBindInfoEx(callbackex, &bindf, &bindinfo, &bindf2, &reserved);
-        ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-        ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
-        ok(bindf2 == 11, "bindf2 = %x\n", bindf);
-        ok(reserved == 12, "reserved = %x\n", reserved);
+        ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+        ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
+        ok(bindf2 == 11, "bindf2 = %lx\n", bindf);
+        ok(reserved == 12, "reserved = %lx\n", reserved);
 
-        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
         ok(!in_bindinfo.szExtraInfo, "szExtraInfo = %s\n", wine_dbgstr_w(in_bindinfo.szExtraInfo));
-        ok(in_bindinfo.grfBindInfoF == 12, "cbSize = %u\n", in_bindinfo.grfBindInfoF);
-        ok(in_bindinfo.dwBindVerb == 13, "dwBindVerb = %u\n", in_bindinfo.dwBindVerb);
+        ok(in_bindinfo.grfBindInfoF == 12, "cbSize = %lu\n", in_bindinfo.grfBindInfoF);
+        ok(in_bindinfo.dwBindVerb == 13, "dwBindVerb = %lu\n", in_bindinfo.dwBindVerb);
         ok(!in_bindinfo.szCustomVerb, "szCustomVerb = %s\n", wine_dbgstr_w(in_bindinfo.szCustomVerb));
-        ok(in_bindinfo.cbstgmedData == 19, "cbstgmedData = %u\n", in_bindinfo.cbstgmedData);
-        ok(!in_bindinfo.dwOptions, "dwOptions = %u\n", in_bindinfo.dwOptions);
-        ok(!in_bindinfo.dwOptionsFlags, "dwOptionsFlags = %u\n", in_bindinfo.dwOptionsFlags);
-        ok(!in_bindinfo.dwCodePage, "dwCodePage = %u\n", in_bindinfo.dwCodePage);
+        ok(in_bindinfo.cbstgmedData == 19, "cbstgmedData = %lu\n", in_bindinfo.cbstgmedData);
+        ok(!in_bindinfo.dwOptions, "dwOptions = %lu\n", in_bindinfo.dwOptions);
+        ok(!in_bindinfo.dwOptionsFlags, "dwOptionsFlags = %lu\n", in_bindinfo.dwOptionsFlags);
+        ok(!in_bindinfo.dwCodePage, "dwCodePage = %lu\n", in_bindinfo.dwCodePage);
         ok(!in_bindinfo.iid.Data1, "iid = %s\n", debugstr_guid(&in_bindinfo.iid));
         ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-        ok(!in_bindinfo.dwReserved, "dwReserved = %u\n", in_bindinfo.dwReserved);
-        ok(!in_bindinfo.securityAttributes.nLength, "securityAttributes.nLength = %u\n",
+        ok(!in_bindinfo.dwReserved, "dwReserved = %lu\n", in_bindinfo.dwReserved);
+        ok(!in_bindinfo.securityAttributes.nLength, "securityAttributes.nLength = %lu\n",
            in_bindinfo.securityAttributes.nLength);
         ok(!in_bindinfo.securityAttributes.lpSecurityDescriptor,
            "securityAttributes.lpSecurityDescriptor = %p\n",
@@ -2510,21 +2510,21 @@ static void test_bsc_marshaling(void)
         ok(!in_bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
            in_bindinfo.stgmedData.pUnkForRelease);
 
-        ok(bindinfo.cbSize == sizeof(rem_bindinfo), "cbSize = %u\n", rem_bindinfo.cbSize);
+        ok(bindinfo.cbSize == sizeof(rem_bindinfo), "cbSize = %lu\n", rem_bindinfo.cbSize);
         ok(!lstrcmpW(bindinfo.szExtraInfo, L"extra info out"),
            "szExtraInfo = %s\n", wine_dbgstr_w(bindinfo.szExtraInfo));
-        ok(bindinfo.grfBindInfoF == 22, "grfBindInfoF = %u\n", rem_bindinfo.grfBindInfoF);
-        ok(bindinfo.dwBindVerb == 23, "dwBindVerb = %u\n", bindinfo.dwBindVerb);
+        ok(bindinfo.grfBindInfoF == 22, "grfBindInfoF = %lu\n", rem_bindinfo.grfBindInfoF);
+        ok(bindinfo.dwBindVerb == 23, "dwBindVerb = %lu\n", bindinfo.dwBindVerb);
         ok(!lstrcmpW(bindinfo.szCustomVerb, L"custom verb out"), "szCustomVerb = %s\n",
            wine_dbgstr_w(bindinfo.szCustomVerb));
-        ok(bindinfo.cbstgmedData == 29, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
-        ok(bindinfo.dwOptions == 24, "dwOptions = %u\n", bindinfo.dwOptions);
-        ok(bindinfo.dwOptionsFlags == 25, "dwOptionsFlags = %u\n", bindinfo.dwOptionsFlags);
-        ok(bindinfo.dwCodePage, "dwCodePage = %u\n", bindinfo.dwCodePage);
+        ok(bindinfo.cbstgmedData == 29, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
+        ok(bindinfo.dwOptions == 24, "dwOptions = %lu\n", bindinfo.dwOptions);
+        ok(bindinfo.dwOptionsFlags == 25, "dwOptionsFlags = %lu\n", bindinfo.dwOptionsFlags);
+        ok(bindinfo.dwCodePage, "dwCodePage = %lu\n", bindinfo.dwCodePage);
         ok(!bindinfo.iid.Data1, "iid = %s\n", debugstr_guid(&bindinfo.iid));
         ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-        ok(bindinfo.dwReserved == 18, "dwReserved = %u\n", bindinfo.dwReserved);
-        ok(bindinfo.securityAttributes.nLength == 30, "securityAttributes.nLength = %u\n",
+        ok(bindinfo.dwReserved == 18, "dwReserved = %lu\n", bindinfo.dwReserved);
+        ok(bindinfo.securityAttributes.nLength == 30, "securityAttributes.nLength = %lu\n",
            bindinfo.securityAttributes.nLength);
         ok(bindinfo.securityAttributes.lpSecurityDescriptor == (void*)0xdead0001,
            "securityAttributes.lpSecurityDescriptor = %p\n",
@@ -2533,14 +2533,14 @@ static void test_bsc_marshaling(void)
            bindinfo.securityAttributes.bInheritHandle);
         ok(bindinfo.stgmedData.pUnkForRelease == &unk_in.IUnknown_iface, "pUnkForRelease = %p\n",
            bindinfo.stgmedData.pUnkForRelease);
-        ok(unk_out.ref == 1, "unk_out.ref = %u\n", unk_out.ref);
+        ok(unk_out.ref == 1, "unk_out.ref = %lu\n", unk_out.ref);
 
         bindinfo.stgmedData.pUnkForRelease = NULL;
         ReleaseBindInfo(&bindinfo);
 
         zero.QuadPart = 0;
         hres = IStream_Seek(binding_stream, zero, STREAM_SEEK_SET, NULL);
-        ok(hres == S_OK, "Seek failed: 0x%08x\n", hres);
+        ok(hres == S_OK, "Seek failed: 0x%08lx\n", hres);
 
         /* Return IStream stgmed from GetBindInfoEx, it's not marshaled back */
         rem_bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
@@ -2558,23 +2558,23 @@ static void test_bsc_marshaling(void)
         IStream_AddRef(binding_stream);
 
         hres = IBindStatusCallbackEx_GetBindInfoEx(callbackex, &bindf, &bindinfo, &bindf2, &reserved);
-        ok(hres == S_OK, "GetBindInfoEx failed: %08x\n", hres);
-        ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+        ok(hres == S_OK, "GetBindInfoEx failed: %08lx\n", hres);
+        ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
         ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            in_bindinfo.stgmedData.tymed);
 
-        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
         ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            bindinfo.stgmedData.tymed);
         ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
            bindinfo.stgmedData.u.pstm);
         ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
            bindinfo.stgmedData.pUnkForRelease);
-        ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+        ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
         ReleaseBindInfo(&bindinfo);
 
@@ -2596,23 +2596,23 @@ static void test_bsc_marshaling(void)
         IStream_AddRef(binding_stream);
 
         hres = IBindStatusCallbackEx_GetBindInfoEx(callbackex, &bindf, &bindinfo, &bindf2, &reserved);
-        ok(hres == S_OK, "GetBindInfoEx failed: %08x\n", hres);
-        ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+        ok(hres == S_OK, "GetBindInfoEx failed: %08lx\n", hres);
+        ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
         ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            in_bindinfo.stgmedData.tymed);
 
-        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
         ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            bindinfo.stgmedData.tymed);
         ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
            bindinfo.stgmedData.u.pstm);
         ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
            bindinfo.stgmedData.pUnkForRelease);
-        ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+        ok(bindinfo.cbstgmedData == 3, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
         ReleaseBindInfo(&bindinfo);
 
@@ -2634,23 +2634,23 @@ static void test_bsc_marshaling(void)
         rem_bindinfo.cbstgmedData = 5;
 
         hres = IBindStatusCallbackEx_GetBindInfoEx(callbackex, &bindf, &bindinfo, &bindf2, &reserved);
-        ok(hres == S_OK, "GetBindInfoEx failed: %08x\n", hres);
-        ok(bindf == rem_bindf, "bindf = %x, expected %x\n", bindf, rem_bindf);
+        ok(hres == S_OK, "GetBindInfoEx failed: %08lx\n", hres);
+        ok(bindf == rem_bindf, "bindf = %lx, expected %lx\n", bindf, rem_bindf);
 
-        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %u\n", in_bindinfo.cbSize);
+        ok(in_bindinfo.cbSize == sizeof(in_bindinfo), "cbSize = %lu\n", in_bindinfo.cbSize);
         ok(!in_bindinfo.pUnk, "pUnk = %p\n", in_bindinfo.pUnk);
-        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(in_bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            in_bindinfo.stgmedData.tymed);
 
-        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %u\n", bindinfo.cbSize);
+        ok(bindinfo.cbSize == sizeof(bindinfo), "cbSize = %lu\n", bindinfo.cbSize);
         ok(!bindinfo.pUnk, "pUnk = %p\n", bindinfo.pUnk);
-        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %u\n",
+        ok(bindinfo.stgmedData.tymed == TYMED_NULL, "tymed = %lu\n",
            bindinfo.stgmedData.tymed);
         ok(!bindinfo.stgmedData.u.pstm, "stm = %p\n",
            bindinfo.stgmedData.u.pstm);
         ok(!bindinfo.stgmedData.pUnkForRelease, "pUnkForRelease = %p\n",
            bindinfo.stgmedData.pUnkForRelease);
-        ok(bindinfo.cbstgmedData == 5, "cbstgmedData = %u\n", bindinfo.cbstgmedData);
+        ok(bindinfo.cbstgmedData == 5, "cbstgmedData = %lu\n", bindinfo.cbstgmedData);
 
         ReleaseBindInfo(&bindinfo);
 
@@ -2666,9 +2666,9 @@ static void test_bsc_marshaling(void)
     stgmed.pUnkForRelease = NULL;
 
     hres = IBindStatusCallback_OnDataAvailable(bsc, 1, 10, &formatetc, &stgmed);
-    ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
+    ok(hres == S_OK, "OnDataAvailable failed: %08lx\n", hres);
 
-    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %u\n", in_stgmed.tymed);
+    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %lu\n", in_stgmed.tymed);
     ok(in_stgmed.u.pstm != NULL, "pstm = NULL\n");
     ok(!in_stgmed.pUnkForRelease, "pUnkForRelease = %p\n", in_stgmed.pUnkForRelease);
 
@@ -2680,12 +2680,12 @@ static void test_bsc_marshaling(void)
     unk_in.ref = 1;
 
     hres = IBindStatusCallback_OnDataAvailable(bsc, 1, 10, &formatetc, &stgmed);
-    ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
+    ok(hres == S_OK, "OnDataAvailable failed: %08lx\n", hres);
 
-    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %u\n", in_stgmed.tymed);
+    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %lu\n", in_stgmed.tymed);
     ok(in_stgmed.u.pstm != NULL, "pstm = NULL\n");
     ok(in_stgmed.pUnkForRelease != NULL, "pUnkForRelease = %p\n", in_stgmed.pUnkForRelease);
-    ok(unk_in.ref > 1, "ref = %u\n", unk_in.ref);
+    ok(unk_in.ref > 1, "ref = %lu\n", unk_in.ref);
 
     /* OnDataAvailable with TYMED_ISTREAM, but NULL stream */
     memset(&in_stgmed, 0xcc, sizeof(in_stgmed));
@@ -2694,9 +2694,9 @@ static void test_bsc_marshaling(void)
     stgmed.pUnkForRelease = NULL;
 
     hres = IBindStatusCallback_OnDataAvailable(bsc, 1, 10, &formatetc, &stgmed);
-    ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
+    ok(hres == S_OK, "OnDataAvailable failed: %08lx\n", hres);
 
-    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %u\n", in_stgmed.tymed);
+    ok(in_stgmed.tymed == TYMED_ISTREAM, "tymed = %lu\n", in_stgmed.tymed);
     ok(in_stgmed.u.pstm != NULL, "pstm = NULL\n");
     ok(!in_stgmed.pUnkForRelease, "pUnkForRelease = %p\n", in_stgmed.pUnkForRelease);
 
@@ -2708,12 +2708,12 @@ static void test_bsc_marshaling(void)
     unk_in.ref = 1;
 
     hres = IBindStatusCallback_OnDataAvailable(bsc, 1, 10, &formatetc, &stgmed);
-    ok(hres == S_OK, "OnDataAvailable failed: %08x\n", hres);
+    ok(hres == S_OK, "OnDataAvailable failed: %08lx\n", hres);
 
-    ok(in_stgmed.tymed == TYMED_NULL, "tymed = %u\n", in_stgmed.tymed);
+    ok(in_stgmed.tymed == TYMED_NULL, "tymed = %lu\n", in_stgmed.tymed);
     ok(!in_stgmed.u.pstm, "pstm != NULL\n");
     ok(in_stgmed.pUnkForRelease != NULL, "pUnkForRelease = %p\n", in_stgmed.pUnkForRelease);
-    ok(unk_in.ref == 1, "ref = %u\n", unk_in.ref);
+    ok(unk_in.ref == 1, "ref = %lu\n", unk_in.ref);
 
     IStream_Release(binding_stream);
     IBindStatusCallback_Release(bsc);
diff --git a/dlls/urlmon/tests/protocol.c b/dlls/urlmon/tests/protocol.c
index b997be7fa01..dcb5c852a92 100644
--- a/dlls/urlmon/tests/protocol.c
+++ b/dlls/urlmon/tests/protocol.c
@@ -261,9 +261,9 @@ static  HRESULT WINAPI HttpSecurity_GetWindow(IHttpSecurity* iface, REFGUID rgui
 
 static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD dwProblem)
 {
-    win_skip("Security problem: %u\n", dwProblem);
+    win_skip("Security problem: %lu\n", dwProblem);
     ok(dwProblem == ERROR_INTERNET_SEC_CERT_REV_FAILED || dwProblem == ERROR_INTERNET_INVALID_CA,
-       "Expected got %u security problem\n", dwProblem);
+       "Expected got %lu security problem\n", dwProblem);
 
     /* Only retry once */
     if (security_problem)
@@ -326,7 +326,7 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface,
         ok(!lstrcmpW(szURL, binding_urls[tested_protocol]), "szURL != http_url\n");
     else
         ok(!lstrcmpW(szURL, http_url), "szURL != http_url\n");
-    ok(!dwReserved, "dwReserved=%d, expected 0\n", dwReserved);
+    ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
     ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
     if(pszAdditionalHeaders)
     {
@@ -347,7 +347,7 @@ static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwR
 {
     CHECK_EXPECT(OnResponse);
 
-    ok(dwResponseCode == 200, "dwResponseCode=%d, expected 200\n", dwResponseCode);
+    ok(dwResponseCode == 200, "dwResponseCode=%ld, expected 200\n", dwResponseCode);
     ok(szResponseHeaders != NULL, "szResponseHeaders == NULL\n");
     ok(szRequestHeaders == NULL, "szRequestHeaders != NULL\n");
     ok(pszAdditionalRequestHeaders == NULL, "pszAdditionalHeaders != NULL\n");
@@ -362,12 +362,12 @@ static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
     
     CHECK_EXPECT(GetRootSecurityId);
 
-    ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
+    ok(!dwReserved, "dwReserved=%Id, expected 0\n", dwReserved);
     ok(pbSecurityId != NULL, "pbSecurityId == NULL\n");
     ok(pcbSecurityId != NULL, "pcbSecurityId == NULL\n");
 
     if(pcbSecurityId) {
-        ok(*pcbSecurityId == 512, "*pcbSecurityId=%d, expected 512\n", *pcbSecurityId);
+        ok(*pcbSecurityId == 512, "*pcbSecurityId=%ld, expected 512\n", *pcbSecurityId);
         *pcbSecurityId = sizeof(sec_id);
     }
 
@@ -516,10 +516,10 @@ static HRESULT WINAPI Stream_Read(IStream *iface, void *pv,
 {
     CHECK_EXPECT2(Stream_Read);
 
-    ok(GetCurrentThreadId() != thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() != thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     ok(pv != NULL, "pv == NULL\n");
-    ok(cb == 0x20000 || broken(cb == 0x2000), "cb = %d\n", cb);
+    ok(cb == 0x20000 || broken(cb == 0x2000), "cb = %ld\n", cb);
     ok(pcbRead != NULL, "pcbRead == NULL\n");
 
     if(post_stream_read) {
@@ -545,7 +545,7 @@ static HRESULT WINAPI Stream_Seek(IStream *iface, LARGE_INTEGER dlibMove,
     CHECK_EXPECT(Stream_Seek);
 
     ok(!dlibMove.QuadPart, "dlibMove != 0\n");
-    ok(dwOrigin == STREAM_SEEK_SET, "dwOrigin = %d\n", dwOrigin);
+    ok(dwOrigin == STREAM_SEEK_SET, "dwOrigin = %ld\n", dwOrigin);
     ok(!plibNewPosition, "plibNewPosition == NULL\n");
 
     return S_OK;
@@ -686,7 +686,7 @@ static void call_continue(PROTOCOLDATA *protocol_data)
     if(state != STATE_SENDINGREQUEST && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)))
         SET_EXPECT(ReportData);
     hres = IInternetProtocol_Continue(async_protocol, protocol_data);
-    ok(hres == S_OK, "Continue failed: %08x\n", hres);
+    ok(hres == S_OK, "Continue failed: %08lx\n", hres);
     if(tested_protocol == FTP_TEST || security_problem)
         CLEAR_CALLED(ReportData);
     else if(state != STATE_SENDINGREQUEST && (!test_redirect || !(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)))
@@ -734,13 +734,13 @@ static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOL
     ok(pProtocolData != NULL, "pProtocolData == NULL\n");
     if(binding_test) {
         ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
-        ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
+        ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %lx/%lx\n",
            pProtocolData->grfFlags, protocoldata.grfFlags );
-        ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
+        ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %lx/%lx\n",
            pProtocolData->dwState, protocoldata.dwState );
         ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
            pProtocolData->pData, protocoldata.pData );
-        ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
+        ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %lx/%lx\n",
            pProtocolData->cbData, protocoldata.cbData );
     }
 
@@ -831,7 +831,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
         if (ulStatusCode < ARRAY_SIZE(status_names))
             trace( "progress: %s %s\n", status_names[ulStatusCode], wine_dbgstr_w(szStatusText) );
         else
-            trace( "progress: %u %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) );
+            trace( "progress: %lu %s\n", ulStatusCode, wine_dbgstr_w(szStatusText) );
     }
 
     switch(ulStatusCode) {
@@ -955,7 +955,7 @@ static HRESULT WINAPI ProtocolSink_ReportProgress(IInternetProtocolSink *iface,
         if(winetest_debug > 1) trace("BINDSTATUS_RESERVED_8\n");
         break;
     default:
-        ok(0, "Unexpected status %d (%d)\n", ulStatusCode, ulStatusCode-BINDSTATUS_LAST);
+        ok(0, "Unexpected status %ld (%ld)\n", ulStatusCode, ulStatusCode-BINDSTATUS_LAST);
     };
 
     return S_OK;
@@ -971,24 +971,24 @@ static void test_http_info(IInternetProtocol *protocol)
     static const WCHAR connectionW[] = {'c','o','n','n','e','c','t','i','o','n',0};
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&info);
-    ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IWinInterHttpInfo iface: %08lx\n", hres);
 
     size = sizeof(buf);
     strcpy(buf, "connection");
     hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
     if(tested_protocol != FTP_TEST) {
-        ok(hres == S_OK, "QueryInfo failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryInfo failed: %08lx\n", hres);
 
         ok(!strcmp(buf, "Keep-Alive"), "buf = %s\n", buf);
         len = strlen(buf);
-        ok(size == len, "size = %u, expected %u\n", size, len);
+        ok(size == len, "size = %lu, expected %lu\n", size, len);
 
         size = sizeof(buf);
         memcpy(buf, connectionW, sizeof(connectionW));
         hres = IWinInetHttpInfo_QueryInfo(info, HTTP_QUERY_CUSTOM, buf, &size, NULL, NULL);
-        ok(hres == S_FALSE, "QueryInfo returned %08x\n", hres);
+        ok(hres == S_FALSE, "QueryInfo returned %08lx\n", hres);
     }else {
-        ok(hres == S_FALSE, "QueryInfo failed: %08x\n", hres);
+        ok(hres == S_FALSE, "QueryInfo failed: %08lx\n", hres);
     }
 
     IWinInetHttpInfo_Release(info);
@@ -1005,23 +1005,23 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
     if(!mimefilter_test && (tested_protocol == FILE_TEST || tested_protocol == ITS_TEST)) {
         CHECK_EXPECT2(ReportData);
 
-        ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n",
+        ok(ulProgress == ulProgressMax, "ulProgress (%ld) != ulProgressMax (%ld)\n",
            ulProgress, ulProgressMax);
         if(!file_with_hash)
-            ok(ulProgressMax == 13, "ulProgressMax=%d, expected 13\n", ulProgressMax);
+            ok(ulProgressMax == 13, "ulProgressMax=%ld, expected 13\n", ulProgressMax);
         /* BSCF_SKIPDRAINDATAFORFILEURLS added in IE8 */
         if(tested_protocol == FILE_TEST)
             ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) ||
                (grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)),
-               "grcfBSCF = %08x\n", grfBSCF);
+               "grcfBSCF = %08lx\n", grfBSCF);
         else
-            ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
+            ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08lx\n", grfBSCF);
     }else if(bind_from_cache) {
         CHECK_EXPECT(ReportData);
 
-        ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08x\n", grfBSCF);
-        ok(ulProgress == 1000, "ulProgress = %u\n", ulProgress);
-        ok(!ulProgressMax, "ulProgressMax = %u\n", ulProgressMax);
+        ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE), "grcfBSCF = %08lx\n", grfBSCF);
+        ok(ulProgress == 1000, "ulProgress = %lu\n", ulProgress);
+        ok(!ulProgressMax, "ulProgressMax = %lu\n", ulProgressMax);
     }else if(direct_read) {
         BYTE buf[14096];
         ULONG read;
@@ -1034,17 +1034,17 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
             if(short_read) {
                 ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE)
                    || grfBSCF == BSCF_FIRSTDATANOTIFICATION, /* < IE8 */
-                   "grcfBSCF = %08x\n", grfBSCF);
+                   "grcfBSCF = %08lx\n", grfBSCF);
                 CHECK_CALLED(Read); /* Set in Continue */
                 first_data_notif = FALSE;
             }else if(first_data_notif) {
-                ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
+                ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION, "grcfBSCF = %08lx\n", grfBSCF);
                 first_data_notif = FALSE;
             }else if(reported_all_data) {
                 ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION),
-                   "grcfBSCF = %08x\n", grfBSCF);
+                   "grcfBSCF = %08lx\n", grfBSCF);
             }else if(!direct_read) {
-                ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
+                ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION, "grcfBSCF = %08lx\n", grfBSCF);
             }
 
             do {
@@ -1057,11 +1057,11 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
                 if(!emulate_prot)
                     SET_EXPECT(Switch);
                 hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
-                ok(hres == E_PENDING || hres == S_FALSE || hres == S_OK, "Read failed: %08x\n", hres);
+                ok(hres == E_PENDING || hres == S_FALSE || hres == S_OK, "Read failed: %08lx\n", hres);
                 if(hres == S_OK)
                     ok(read, "read == 0\n");
                 if(reported_all_data)
-                    ok(hres == S_FALSE, "Read failed: %08x, expected S_FALSE\n", hres);
+                    ok(hres == S_FALSE, "Read failed: %08lx, expected S_FALSE\n", hres);
                 if(!emulate_prot && hres != E_PENDING)
                     CHECK_NOT_CALLED(Switch); /* otherwise checked in wait_for_switch loop */
                 if(emulate_prot)
@@ -1082,7 +1082,7 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
         }else {
             CHECK_EXPECT(ReportData2);
 
-            ok(grfBSCF & BSCF_LASTDATANOTIFICATION, "grfBSCF = %08x\n", grfBSCF);
+            ok(grfBSCF & BSCF_LASTDATANOTIFICATION, "grfBSCF = %08lx\n", grfBSCF);
 
             read = 0xdeadbeef;
             if(emulate_prot)
@@ -1090,8 +1090,8 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
             hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
             if(emulate_prot)
                 CHECK_CALLED(Read2);
-            ok(hres == S_FALSE, "Read returned: %08x, expected E_FALSE\n", hres);
-            ok(!read, "read = %d\n", read);
+            ok(hres == S_FALSE, "Read returned: %08lx, expected E_FALSE\n", hres);
+            ok(!read, "read = %ld\n", read);
         }
     }else if(!binding_test && (tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST
             || tested_protocol == FTP_TEST)) {
@@ -1100,29 +1100,29 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
         else if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
             CHECK_EXPECT(ReportData);
         else if (http_post_test)
-            ok(ulProgress == 13, "Read %u bytes instead of 13\n", ulProgress);
+            ok(ulProgress == 13, "Read %lu bytes instead of 13\n", ulProgress);
 
         if(empty_file) {
-            ok(!ulProgress, "ulProgress = %d\n", ulProgress);
-            ok(!ulProgressMax, "ulProgressMax = %d\n", ulProgressMax);
+            ok(!ulProgress, "ulProgress = %ld\n", ulProgress);
+            ok(!ulProgressMax, "ulProgressMax = %ld\n", ulProgressMax);
         }else {
             ok(ulProgress, "ulProgress == 0\n");
         }
 
         if(empty_file) {
             ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION),
-               "grcfBSCF = %08x\n", grfBSCF);
+               "grcfBSCF = %08lx\n", grfBSCF);
             first_data_notif = FALSE;
         }else if(first_data_notif) {
             ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION
                || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE),
-               "grcfBSCF = %08x\n", grfBSCF);
+               "grcfBSCF = %08lx\n", grfBSCF);
             first_data_notif = FALSE;
         } else {
             ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION
                || grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION)
                || broken(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION)),
-               "grcfBSCF = %08x\n", grfBSCF);
+               "grcfBSCF = %08lx\n", grfBSCF);
         }
 
         if((grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !binding_test)
@@ -1171,7 +1171,7 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR
     if(result_from_lock) {
         SET_EXPECT(LockRequest);
         hres = IInternetProtocol_LockRequest(binding_protocol, 0);
-        ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+        ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
         CHECK_CALLED(LockRequest);
 
         /* ReportResult is called before ReportData returns */
@@ -1191,12 +1191,12 @@ static HRESULT WINAPI ProtocolSink_ReportResult(IInternetProtocolSink *iface, HR
         return S_OK;
 
     if(tested_protocol == FTP_TEST)
-        ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08x, expected E_PENDING or S_OK\n", hrResult);
+        ok(hrResult == E_PENDING || hrResult == S_OK, "hrResult = %08lx, expected E_PENDING or S_OK\n", hrResult);
     else
-        ok(hrResult == expect_hrResult, "hrResult = %08x, expected: %08x\n",
+        ok(hrResult == expect_hrResult, "hrResult = %08lx, expected: %08lx\n",
            hrResult, expect_hrResult);
     if(SUCCEEDED(hrResult) || tested_protocol == FTP_TEST || test_abort || hrResult == INET_E_REDIRECT_FAILED)
-        ok(dwError == ERROR_SUCCESS, "dwError = %d, expected ERROR_SUCCESS\n", dwError);
+        ok(dwError == ERROR_SUCCESS, "dwError = %ld, expected ERROR_SUCCESS\n", dwError);
     else
         ok(dwError != ERROR_SUCCESS ||
            broken(tested_protocol == MK_TEST), /* WinME and NT4 */
@@ -1255,7 +1255,7 @@ static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROT
 
     SET_EXPECT(Switch);
     hres = IInternetProtocolSink_Switch(filtered_sink, pProtocolData);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     CHECK_CALLED(Switch);
 
     return S_OK;
@@ -1275,7 +1275,7 @@ static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *ifa
         ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
         break;
     default:
-        ok(0, "Unexpected status code %d\n", ulStatusCode);
+        ok(0, "Unexpected status code %ld\n", ulStatusCode);
     }
 
     return S_OK;
@@ -1295,19 +1295,19 @@ static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface,
         SET_EXPECT(Read);
         hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
         if(tested_protocol == HTTP_TEST)
-            ok(hres == S_OK || hres == E_PENDING || hres == S_FALSE, "Read failed: %08x\n", hres);
+            ok(hres == S_OK || hres == E_PENDING || hres == S_FALSE, "Read failed: %08lx\n", hres);
         else
-            ok(hres == S_OK, "Read failed: %08x\n", hres);
+            ok(hres == S_OK, "Read failed: %08lx\n", hres);
         CHECK_CALLED(Read);
 
         SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
         hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, text_htmlW);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
         CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
 
         SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
         hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
         CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
 
         /* FIXME: test BINDSTATUS_CACHEFILENAMEAVAILABLE */
@@ -1324,7 +1324,7 @@ static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface,
         SET_EXPECT(ReportData);
     }
     hres = IInternetProtocolSink_ReportData(filtered_sink, grfBSCF, ulProgress, ulProgressMax);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
     if(no_mime && prot_read<=200) {
         CHECK_CALLED(Read);
     }else if(report_mime) {
@@ -1347,13 +1347,13 @@ static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface
 
     CHECK_EXPECT(MimeFilter_ReportResult);
 
-    ok(hrResult == S_OK, "hrResult = %08x\n", hrResult);
-    ok(dwError == ERROR_SUCCESS, "dwError = %u\n", dwError);
+    ok(hrResult == S_OK, "hrResult = %08lx\n", hrResult);
+    ok(dwError == ERROR_SUCCESS, "dwError = %lu\n", dwError);
     ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
 
     SET_EXPECT(ReportResult);
     hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult);
-    ok(SUCCEEDED(hres), "ReportResult failed: %08x\n", hres);
+    ok(SUCCEEDED(hres), "ReportResult failed: %08lx\n", hres);
     CHECK_CALLED(ReportResult);
 
     return S_OK;
@@ -1426,7 +1426,7 @@ static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfB
 
     ok(grfBINDF != NULL, "grfBINDF == NULL\n");
     ok(pbindinfo != NULL, "pbindinfo == NULL\n");
-    ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %d\n", pbindinfo->cbSize);
+    ok(pbindinfo->cbSize == sizeof(BINDINFO), "wrong size of pbindinfo: %ld\n", pbindinfo->cbSize);
 
     *grfBINDF = bindf;
     if(binding_test)
@@ -1466,9 +1466,9 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS
     switch(ulStringType) {
     case BINDSTRING_ACCEPT_MIMES:
         CHECK_EXPECT(GetBindString_ACCEPT_MIMES);
-        ok(cEl == 256, "cEl=%d, expected 256\n", cEl);
+        ok(cEl == 256, "cEl=%ld, expected 256\n", cEl);
         if(pcElFetched) {
-            ok(*pcElFetched == 256, "*pcElFetched=%d, expected 256\n", *pcElFetched);
+            ok(*pcElFetched == 256, "*pcElFetched=%ld, expected 256\n", *pcElFetched);
             *pcElFetched = 1;
         }
         if(ppwzStr) {
@@ -1478,9 +1478,9 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS
         return S_OK;
     case BINDSTRING_USER_AGENT:
         CHECK_EXPECT(GetBindString_USER_AGENT);
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
         if(pcElFetched) {
-            ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
+            ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
             *pcElFetched = 1;
         }
         if(ppwzStr) {
@@ -1490,16 +1490,16 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS
         return S_OK;
     case BINDSTRING_POST_COOKIE:
         CHECK_EXPECT(GetBindString_POST_COOKIE);
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
         if(pcElFetched)
-            ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
+            ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
         return S_OK;
     case BINDSTRING_URL: {
         DWORD size;
 
         CHECK_EXPECT(GetBindString_URL);
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
-        ok(*pcElFetched == 0, "*pcElFetch=%d, expected 0\n", *pcElFetched);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
+        ok(*pcElFetched == 0, "*pcElFetch=%ld, expected 0\n", *pcElFetched);
         *pcElFetched = 1;
 
         size = (lstrlenW(binding_urls[tested_protocol])+1)*sizeof(WCHAR);
@@ -1509,17 +1509,17 @@ static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulS
     }
     case BINDSTRING_ROOTDOC_URL:
         CHECK_EXPECT(GetBindString_ROOTDOC_URL);
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
         return E_NOTIMPL;
     case BINDSTRING_ENTERPRISE_ID:
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
         return E_NOTIMPL;
     case BINDSTRING_SAMESITE_COOKIE_LEVEL:
         CHECK_EXPECT(GetBindString_SAMESITE_COOKIE_LEVEL);
-        ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+        ok(cEl == 1, "cEl=%ld, expected 1\n", cEl);
         return E_NOTIMPL;
     default:
-        ok(0, "unexpected ulStringType %d\n", ulStringType);
+        ok(0, "unexpected ulStringType %ld\n", ulStringType);
     }
 
     return E_NOTIMPL;
@@ -1572,7 +1572,7 @@ static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface)
 static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority)
 {
     CHECK_EXPECT(SetPriority);
-    ok(nPriority == ex_priority, "nPriority=%d\n", nPriority);
+    ok(nPriority == ex_priority, "nPriority=%ld\n", nPriority);
     return S_OK;
 }
 
@@ -1610,7 +1610,7 @@ static HRESULT WINAPI Protocol_Abort(IInternetProtocolEx *iface, HRESULT hrReaso
 
     SET_EXPECT(ReportResult);
     hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
-    ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
     CHECK_CALLED(ReportResult);
 
     return S_OK;
@@ -1701,25 +1701,25 @@ static DWORD WINAPI thread_proc(PVOID arg)
         hres = IInternetProtocolSink_ReportProgress(binding_sink,
                 BINDSTATUS_FINDINGRESOURCE, hostW);
         CHECK_CALLED(ReportProgress_FINDINGRESOURCE);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
 
         SET_EXPECT(ReportProgress_CONNECTING);
         hres = IInternetProtocolSink_ReportProgress(binding_sink,
                 BINDSTATUS_CONNECTING, winehq_ipW);
         CHECK_CALLED(ReportProgress_CONNECTING);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
 
         SET_EXPECT(ReportProgress_SENDINGREQUEST);
         hres = IInternetProtocolSink_ReportProgress(binding_sink,
                 BINDSTATUS_SENDINGREQUEST, NULL);
         CHECK_CALLED(ReportProgress_SENDINGREQUEST);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
 
         prot_state = 1;
         SET_EXPECT(Switch);
         hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
         CHECK_CALLED(Switch);
-        ok(hres == S_OK, "Switch failed: %08x\n", hres);
+        ok(hres == S_OK, "Switch failed: %08lx\n", hres);
 
         if(!redirect)
             break;
@@ -1733,7 +1733,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
         else
             SET_EXPECT(Switch);
         hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
-        ok(hres == S_OK, "Switch failed: %08x\n", hres);
+        ok(hres == S_OK, "Switch failed: %08lx\n", hres);
         if(mimefilter_test)
             CHECK_CALLED(MimeFilter_Switch);
         else
@@ -1750,7 +1750,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
         else
             SET_EXPECT(Switch);
         hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
-        ok(hres == S_OK, "Switch failed: %08x\n", hres);
+        ok(hres == S_OK, "Switch failed: %08lx\n", hres);
         if(mimefilter_test)
             CHECK_CALLED(MimeFilter_Switch);
         else
@@ -1762,7 +1762,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
         else
             SET_EXPECT(Switch);
         hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
-        ok(hres == S_OK, "Switch failed: %08x\n", hres);
+        ok(hres == S_OK, "Switch failed: %08lx\n", hres);
         if(mimefilter_test)
             CHECK_CALLED(MimeFilter_Switch);
         else
@@ -1784,7 +1784,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
     ok(pOIProtSink != &protocol_sink, "unexpected pOIProtSink\n");
     ok(pOIBindInfo != &bind_info, "unexpected pOIBindInfo\n");
-    ok(!pi, "pi = %x\n", pi);
+    ok(!pi, "pi = %lx\n", pi);
 
     if(binding_test)
         ok(pOIProtSink == binding_sink, "pOIProtSink != binding_sink\n");
@@ -1800,16 +1800,16 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
     if(redirect_on_continue && (bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS))
         CHECK_CALLED(QueryService_IBindCallbackRedirect);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
     CHECK_CALLED(GetBindInfo);
-    ok(cbindf == (bindf|BINDF_FROMURLMON), "bindf = %x, expected %x\n",
+    ok(cbindf == (bindf|BINDF_FROMURLMON), "bindf = %lx, expected %lx\n",
        cbindf, (bindf|BINDF_FROMURLMON));
     ok(!memcmp(&exp_bindinfo, &bindinfo, sizeof(bindinfo)), "unexpected bindinfo\n");
     pReleaseBindInfo(&bindinfo);
 
     SET_EXPECT(ReportProgress_SENDINGREQUEST);
     hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, emptyW);
-    ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres);
     CHECK_CALLED(ReportProgress_SENDINGREQUEST);
 
     if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST) {
@@ -1826,8 +1826,8 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
         hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
                                                &ua, 1, &fetched);
         CHECK_CALLED(GetBindString_USER_AGENT);
-        ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
-        ok(fetched == 1, "fetched = %d, expected 254\n", fetched);
+        ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08lx\n", hres);
+        ok(fetched == 1, "fetched = %ld, expected 254\n", fetched);
         ok(ua != NULL, "ua =  %p\n", ua);
         ok(!lstrcmpW(ua, user_agentW), "unexpected user agent %s\n", wine_dbgstr_w(ua));
         CoTaskMemFree(ua);
@@ -1839,42 +1839,42 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
         CHECK_CALLED(GetBindString_ACCEPT_MIMES);
 
         ok(hres == S_OK,
-           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
-        ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
+           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres);
+        ok(fetched == 1, "fetched = %ld, expected 1\n", fetched);
         ok(!lstrcmpW(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
         CoTaskMemFree(accept_mimes[0]);
 
         hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
                                                 (void**)&service_provider);
-        ok(hres == S_OK, "QueryInterface failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryInterface failed: %08lx\n", hres);
 
         SET_EXPECT(QueryService_HttpNegotiate);
         hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
                 &IID_IHttpNegotiate, (void**)&http_negotiate);
         CHECK_CALLED(QueryService_HttpNegotiate);
-        ok(hres == S_OK, "QueryService failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
 
         SET_EXPECT(BeginningTransaction);
         hres = IHttpNegotiate_BeginningTransaction(http_negotiate, binding_urls[tested_protocol],
                                                    NULL, 0, &additional_headers);
         CHECK_CALLED(BeginningTransaction);
         IHttpNegotiate_Release(http_negotiate);
-        ok(hres == S_OK, "BeginningTransction failed: %08x\n", hres);
+        ok(hres == S_OK, "BeginningTransction failed: %08lx\n", hres);
         ok(additional_headers == NULL, "additional_headers=%p\n", additional_headers);
 
         SET_EXPECT(QueryService_HttpNegotiate);
         hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
                 &IID_IHttpNegotiate2, (void**)&http_negotiate2);
         CHECK_CALLED(QueryService_HttpNegotiate);
-        ok(hres == S_OK, "QueryService failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
 
         size = 512;
         SET_EXPECT(GetRootSecurityId);
         hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
         CHECK_CALLED(GetRootSecurityId);
         IHttpNegotiate2_Release(http_negotiate2);
-        ok(hres == E_FAIL, "GetRootSecurityId failed: %08x, expected E_FAIL\n", hres);
-        ok(size == 13, "size=%d\n", size);
+        ok(hres == E_FAIL, "GetRootSecurityId failed: %08lx, expected E_FAIL\n", hres);
+        ok(size == 13, "size=%ld\n", size);
 
         IServiceProvider_Release(service_provider);
 
@@ -1886,7 +1886,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
     hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
             BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
-    ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
     CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
 
     if(mimefilter_test) {
@@ -1898,7 +1898,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
             mimefilter_test ? pjpegW : (expect_wsz = text_htmlW));
     ok(hres == S_OK,
-       "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
+       "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08lx\n", hres);
     if(mimefilter_test) {
         CHECK_CALLED(MimeFilter_CreateInstance);
         CHECK_CALLED(MimeFilter_Start);
@@ -1915,7 +1915,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     hres = IInternetProtocolSink_ReportData(pOIProtSink,
             BSCF_FIRSTDATANOTIFICATION | (tested_protocol == ITS_TEST ? BSCF_DATAFULLYAVAILABLE : BSCF_LASTDATANOTIFICATION),
             13, 13);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
     if(mimefilter_test)
         CHECK_CALLED(MimeFilter_ReportData);
     else
@@ -1930,13 +1930,13 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     if(tested_protocol == ITS_TEST) {
         SET_EXPECT(ReportData);
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
-        ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08lx\n", hres);
         CHECK_CALLED(ReportData);
     }
 
     if(tested_protocol == BIND_TEST) {
         hres = IInternetProtocol_Terminate(binding_protocol, 0);
-        ok(hres == E_FAIL, "Termiante failed: %08x\n", hres);
+        ok(hres == E_FAIL, "Termiante failed: %08lx\n", hres);
     }
 
     if(mimefilter_test)
@@ -1944,7 +1944,7 @@ static void protocol_start(IInternetProtocolSink *pOIProtSink, IInternetBindInfo
     else
         SET_EXPECT(ReportResult);
     hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
-    ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
     if(mimefilter_test)
         CHECK_CALLED(MimeFilter_ReportResult);
     else
@@ -1957,7 +1957,7 @@ static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocolEx *iface, LPCWSTR szU
 {
     CHECK_EXPECT(Start);
 
-    ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
+    ok(!dwReserved, "dwReserved = %Ix\n", dwReserved);
     protocol_start(pOIProtSink, pOIBindInfo, grfPI);
     return S_OK;
 }
@@ -1975,13 +1975,13 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
         return S_OK;
     if(binding_test) {
         ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
-        ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
+        ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %lx/%lx\n",
            pProtocolData->grfFlags, protocoldata.grfFlags );
-        ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
+        ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %lx/%lx\n",
            pProtocolData->dwState, protocoldata.dwState );
         ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
            pProtocolData->pData, protocoldata.pData );
-        ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
+        ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %lx/%lx\n",
            pProtocolData->cbData, protocoldata.cbData );
     }
 
@@ -2008,7 +2008,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
             SET_EXPECT(SetPriority);
             SET_EXPECT(Start);
             hres = IInternetProtocolSink_ReportResult(binding_sink, INET_E_REDIRECT_FAILED, ERROR_SUCCESS, redirect_urlW);
-            ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+            ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
             if(bindinfo_options & BINDINFO_OPTIONS_DISABLEAUTOREDIRECTS)
                 CHECK_CALLED(Redirect);
             CHECK_CALLED(ReportProgress_REDIRECTING);
@@ -2039,7 +2039,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
         IHttpNegotiate_Release(http_negotiate);
         CHECK_CALLED(OnResponse);
         IHttpNegotiate_Release(http_negotiate);
-        ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
+        ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
 
         if(mimefilter_test) {
             SET_EXPECT(MimeFilter_CreateInstance);
@@ -2058,7 +2058,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
             CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
         }
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
 
         bscf |= BSCF_FIRSTDATANOTIFICATION;
         break;
@@ -2088,7 +2088,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
     }
 
     hres = IInternetProtocolSink_ReportData(binding_sink, bscf, pr, 400);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
 
     if(mimefilter_test) {
         SET_EXPECT(MimeFilter_ReportData);
@@ -2112,7 +2112,7 @@ static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocolEx *iface,
 static HRESULT WINAPI ProtocolEmul_Terminate(IInternetProtocolEx *iface, DWORD dwOptions)
 {
     CHECK_EXPECT(Terminate);
-    ok(!dwOptions, "dwOptions=%d\n", dwOptions);
+    ok(!dwOptions, "dwOptions=%ld\n", dwOptions);
     return S_OK;
 }
 
@@ -2132,9 +2132,9 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
         if(prot_read < 300) {
             ok(pv != expect_pv, "pv == expect_pv\n");
             if(prot_read < 300)
-                ok(cb == 2048-prot_read, "cb=%d\n", cb);
+                ok(cb == 2048-prot_read, "cb=%ld\n", cb);
             else
-                ok(cb == 700, "cb=%d\n", cb);
+                ok(cb == 700, "cb=%ld\n", cb);
         }else {
             ok(expect_pv <= pv && (BYTE*)pv < (BYTE*)expect_pv + cb, "pv != expect_pv\n");
         }
@@ -2143,8 +2143,8 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
             CHECK_EXPECT(Read);
 
         ok(pv == expect_pv, "pv != expect_pv\n");
-        ok(cb == 1000, "cb=%d\n", cb);
-        ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
+        ok(cb == 1000, "cb=%ld\n", cb);
+        ok(!*pcbRead, "*pcbRead = %ld\n", *pcbRead);
     }
     ok(pcbRead != NULL, "pcbRead == NULL\n");
 
@@ -2165,7 +2165,7 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
         hres = IInternetProtocolSink_ReportData(binding_sink,
                 BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
         read_report_data--;
-        ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
         if(short_read) {
             CLEAR_CALLED(GetBindInfo); /* IE9 */
             CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
@@ -2180,7 +2180,7 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
         else
             SET_EXPECT(ReportResult);
         hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
         if(mimefilter_test)
             CHECK_CALLED(MimeFilter_ReportResult);
         else
@@ -2217,11 +2217,11 @@ static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocolEx *iface, void *pv,
 static HRESULT WINAPI ProtocolEmul_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions)
 {
     CHECK_EXPECT(LockRequest);
-    ok(dwOptions == 0, "dwOptions=%x\n", dwOptions);
+    ok(dwOptions == 0, "dwOptions=%lx\n", dwOptions);
     if(result_from_lock) {
         HRESULT hres;
         hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x, expected E_FAIL\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx, expected E_FAIL\n", hres);
     }
     return S_OK;
 }
@@ -2324,9 +2324,9 @@ static ULONG WINAPI ProtocolUnk_Release(IUnknown *iface)
          * and 1 on redirected handler. */
         ok(!This->outer_ref
            || broken(test_redirect && (This->outer_ref == -1 || This->outer_ref == 1)),
-           "outer_ref = %d\n", This->outer_ref);
+           "outer_ref = %ld\n", This->outer_ref);
         if(This->outer_ref)
-            trace("outer_ref %d\n", This->outer_ref);
+            trace("outer_ref %ld\n", This->outer_ref);
         CHECK_EXPECT(Protocol_destructor);
         heap_free(This);
     }
@@ -2370,7 +2370,7 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
     CHECK_EXPECT(MimeFilter_Start);
 
     ok(!lstrcmpW(szUrl, pjpegW), "wrong url %s\n", wine_dbgstr_w(szUrl));
-    ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
+    ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%lx, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
     ok(dwReserved, "dwReserved == 0\n");
     ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
     ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
@@ -2384,11 +2384,11 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
     }
 
     data = (void*)dwReserved;
-    ok(data->cbSize == sizeof(*data), "data->cbSize = %d\n", data->cbSize);
+    ok(data->cbSize == sizeof(*data), "data->cbSize = %ld\n", data->cbSize);
     ok(!data->pProtocolSink, "data->pProtocolSink != NULL\n");
     ok(data->pProtocol != NULL, "data->pProtocol == NULL\n");
     ok(!data->pUnk, "data->pUnk != NULL\n");
-    ok(!data->dwFilterFlags, "data->dwProtocolFlags = %x\n", data->dwFilterFlags);
+    ok(!data->dwFilterFlags, "data->dwProtocolFlags = %lx\n", data->dwFilterFlags);
     if(binding_test) {
         IInternetProtocolSink *prot_sink;
 
@@ -2414,21 +2414,21 @@ static HRESULT WINAPI MimeProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU
 
     SET_EXPECT(ReportProgress_DECODING);
     hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, pjpegW);
-    ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08lx\n", hres);
     CHECK_CALLED(ReportProgress_DECODING);
 
     SET_EXPECT(GetBindInfo);
     memset(&bindinfo, 0, sizeof(bindinfo));
     bindinfo.cbSize = sizeof(bindinfo);
     hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
-    ok(cbindf == (bindf|BINDF_FROMURLMON), "cbindf = %x, expected %x\n", cbindf, bindf);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
+    ok(cbindf == (bindf|BINDF_FROMURLMON), "cbindf = %lx, expected %lx\n", cbindf, bindf);
     CHECK_CALLED(GetBindInfo);
 
     SET_EXPECT(GetBindString_URL);
     hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched);
-    ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08x\n", hres);
-    ok(fetched == 1, "fetched = %d\n", fetched);
+    ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08lx\n", hres);
+    ok(fetched == 1, "fetched = %ld\n", fetched);
     ok(!lstrcmpW(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", wine_dbgstr_w(url_str));
     CoTaskMemFree(url_str);
     CHECK_CALLED(GetBindString_URL);
@@ -2449,11 +2449,11 @@ static HRESULT WINAPI MimeProtocol_Terminate(IInternetProtocolEx *iface, DWORD d
 
     CHECK_EXPECT(MimeFilter_Terminate);
 
-    ok(!dwOptions, "dwOptions = %x\n", dwOptions);
+    ok(!dwOptions, "dwOptions = %lx\n", dwOptions);
 
     SET_EXPECT(Terminate);
     hres = IInternetProtocol_Terminate(filtered_protocol, dwOptions);
-    ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+    ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
     CHECK_CALLED(Terminate);
 
     return S_OK;
@@ -2477,14 +2477,14 @@ static HRESULT WINAPI MimeProtocol_Read(IInternetProtocolEx *iface, void *pv,
     else
         SET_EXPECT(Read);
     hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
-    ok(hres == S_OK || hres == S_FALSE || hres == E_PENDING, "Read failed: %08x\n", hres);
+    ok(hres == S_OK || hres == S_FALSE || hres == E_PENDING, "Read failed: %08lx\n", hres);
     if(read_report_data)
         CHECK_CALLED(Read2);
     else
         CHECK_CALLED(Read);
 
     if(pcbRead) {
-        ok(*pcbRead == 0, "*pcbRead=%d, expected 0\n", *pcbRead);
+        ok(*pcbRead == 0, "*pcbRead=%ld, expected 0\n", *pcbRead);
         *pcbRead = read;
     }
 
@@ -2498,11 +2498,11 @@ static HRESULT WINAPI MimeProtocol_LockRequest(IInternetProtocolEx *iface, DWORD
 
     CHECK_EXPECT(MimeFilter_LockRequest);
 
-    ok(!dwOptions, "dwOptions = %x\n", dwOptions);
+    ok(!dwOptions, "dwOptions = %lx\n", dwOptions);
 
     SET_EXPECT(LockRequest);
     hres = IInternetProtocol_LockRequest(filtered_protocol, dwOptions);
-    ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+    ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
     CHECK_CALLED(LockRequest);
 
     return S_OK;
@@ -2516,7 +2516,7 @@ static HRESULT WINAPI MimeProtocol_UnlockRequest(IInternetProtocolEx *iface)
 
     SET_EXPECT(UnlockRequest);
     hres = IInternetProtocol_UnlockRequest(filtered_protocol);
-    ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+    ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
     CHECK_CALLED(UnlockRequest);
 
     return S_OK;
@@ -2717,18 +2717,18 @@ static void register_filter(BOOL do_register)
     HRESULT hres;
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
 
     if(do_register) {
         hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, pjpegW);
-        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
         hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gifW);
-        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
     }else {
         hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, pjpegW);
-        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
         hres = IInternetSession_UnregisterMimeFilter(session, &mimefilter_cf, gifW);
-        ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterMimeFilter failed: %08lx\n", hres);
     }
 
     IInternetSession_Release(session);
@@ -2786,20 +2786,20 @@ static void test_priority(IInternetProtocol *protocol)
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority,
                                             (void**)&priority);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetPriority_GetPriority(priority, &pr);
-    ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
-    ok(pr == 0, "pr=%d, expected 0\n", pr);
+    ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
+    ok(pr == 0, "pr=%ld, expected 0\n", pr);
 
     hres = IInternetPriority_SetPriority(priority, 1);
-    ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
+    ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
 
     hres = IInternetPriority_GetPriority(priority, &pr);
-    ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
-    ok(pr == 1, "pr=%d, expected 1\n", pr);
+    ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
+    ok(pr == 1, "pr=%ld, expected 1\n", pr);
 
     IInternetPriority_Release(priority);
 }
@@ -2811,13 +2811,13 @@ static void test_early_abort(const CLSID *clsid)
 
     hres = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+    ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
 
     hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
-    ok(hres == S_OK, "Abort failed: %08x\n", hres);
+    ok(hres == S_OK, "Abort failed: %08lx\n", hres);
 
     hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
-    ok(hres == S_OK, "Abort failed: %08x\n", hres);
+    ok(hres == S_OK, "Abort failed: %08lx\n", hres);
 
     IInternetProtocol_Release(protocol);
 }
@@ -2846,14 +2846,14 @@ static BOOL file_protocol_start(IInternetProtocol *protocol, LPCWSTR url,
 
     if(protocolex) {
         hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
-        ok(hres == S_OK, "StartEx failed: %08x\n", hres);
+        ok(hres == S_OK, "StartEx failed: %08lx\n", hres);
     }else {
         hres = IInternetProtocol_Start(protocol, url, &protocol_sink, &bind_info, 0, 0);
         if(hres == INET_E_RESOURCE_NOT_FOUND) {
             win_skip("Start failed\n");
             return FALSE;
         }
-        ok(hres == S_OK, "Start failed: %08x\n", hres);
+        ok(hres == S_OK, "Start failed: %08lx\n", hres);
     }
 
     CHECK_CALLED(GetBindInfo);
@@ -2886,13 +2886,13 @@ static void test_file_protocol_url(LPCWSTR url)
 
     hres = CoGetClassObject(&CLSID_FileProtocol, CLSCTX_INPROC_SERVER, NULL,
             &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
+    ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
     ok(hres == E_NOINTERFACE,
-            "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
+            "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
     ok(hres == S_OK, "Could not get IClassFactory interface\n");
@@ -2901,67 +2901,67 @@ static void test_file_protocol_url(LPCWSTR url)
         return;
 
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         if(file_protocol_start(protocol, url, NULL, NULL, TRUE)) {
             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
-            ok(hres == S_OK, "Read failed: %08x\n", hres);
-            ok(cb == 2, "cb=%u expected 2\n", cb);
+            ok(hres == S_OK, "Read failed: %08lx\n", hres);
+            ok(cb == 2, "cb=%lu expected 2\n", cb);
             buf[2] = 0;
             ok(!memcmp(buf, file_with_hash ? "XX" : "<H", 2), "Unexpected data %s\n", buf);
             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
-            ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+            ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
             hres = IInternetProtocol_Read(protocol, buf, sizeof(buf), &cb);
-            ok(hres == S_FALSE, "Read failed: %08x expected S_FALSE\n", hres);
-            ok(cb == 0, "cb=%u expected 0\n", cb);
+            ok(hres == S_FALSE, "Read failed: %08lx expected S_FALSE\n", hres);
+            ok(cb == 0, "cb=%lu expected 0\n", cb);
             hres = IInternetProtocol_UnlockRequest(protocol);
-            ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
         }
 
         if(file_protocol_start(protocol, url, NULL, NULL, FALSE)) {
             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
-            ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+            ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
             hres = IInternetProtocol_LockRequest(protocol, 0);
-            ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
             hres = IInternetProtocol_UnlockRequest(protocol);
-            ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
         }
 
         IInternetProtocol_Release(protocol);
     }
 
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
     if(SUCCEEDED(hres)) {
         if(file_protocol_start(protocol, url, NULL, NULL, TRUE)) {
             hres = IInternetProtocol_LockRequest(protocol, 0);
-            ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
             hres = IInternetProtocol_Terminate(protocol, 0);
-            ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+            ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
-            ok(hres == S_OK, "Read failed: %08x\n\n", hres);
+            ok(hres == S_OK, "Read failed: %08lx\n\n", hres);
             hres = IInternetProtocol_UnlockRequest(protocol);
-            ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
             todo_wine_if(file_with_hash) /* FIXME: An effect of UnlockRequest call? */
-                ok(hres == S_OK, "Read failed: %08x\n", hres);
+                ok(hres == S_OK, "Read failed: %08lx\n", hres);
             hres = IInternetProtocol_Terminate(protocol, 0);
-            ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+            ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
         }
 
         IInternetProtocol_Release(protocol);
     }
 
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
     if(SUCCEEDED(hres)) {
         if(file_protocol_start(protocol, url, NULL, NULL, TRUE)) {
             hres = IInternetProtocol_Terminate(protocol, 0);
-            ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+            ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
             hres = IInternetProtocol_Read(protocol, buf, 2, &cb);
-            ok(hres == S_OK, "Read failed: %08x\n", hres);
-            ok(cb == 2, "cb=%u expected 2\n", cb);
+            ok(hres == S_OK, "Read failed: %08lx\n", hres);
+            ok(cb == 2, "cb=%lu expected 2\n", cb);
         }
 
         IInternetProtocol_Release(protocol);
@@ -2972,36 +2972,36 @@ static void test_file_protocol_url(LPCWSTR url)
         IUri *uri;
 
         hres = pCreateUri(url, Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
-        ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
         hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
-        ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IInternetProtocolEx: %08lx\n", hres);
 
         if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
             hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
-            ok(hres == S_OK, "Read failed: %08x\n", hres);
+            ok(hres == S_OK, "Read failed: %08lx\n", hres);
             hres = IInternetProtocolEx_LockRequest(protocolex, 0);
-            ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
             hres = IInternetProtocolEx_UnlockRequest(protocolex);
-            ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
         }
 
         IUri_Release(uri);
         IInternetProtocolEx_Release(protocolex);
 
         hres = pCreateUri(url, 0, 0, &uri);
-        ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
         hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocolEx, (void**)&protocolex);
-        ok(hres == S_OK, "Could not get IInternetProtocolEx: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IInternetProtocolEx: %08lx\n", hres);
 
         if(file_protocol_start(NULL, NULL, protocolex, uri, TRUE)) {
             hres = IInternetProtocolEx_Read(protocolex, buf, 2, &cb);
-            ok(hres == S_OK, "Read failed: %08x\n", hres);
+            ok(hres == S_OK, "Read failed: %08lx\n", hres);
             hres = IInternetProtocolEx_LockRequest(protocolex, 0);
-            ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
             hres = IInternetProtocolEx_UnlockRequest(protocolex);
-            ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
         }
 
         IUri_Release(uri);
@@ -3023,7 +3023,7 @@ static void test_file_protocol_fail(void)
 
     hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+    ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
@@ -3032,7 +3032,7 @@ static void test_file_protocol_fail(void)
     hres = IInternetProtocol_Start(protocol, wszIndexHtml, &protocol_sink, &bind_info, 0, 0);
     ok(hres == MK_E_SYNTAX ||
        hres == E_INVALIDARG,
-       "Start failed: %08x, expected MK_E_SYNTAX or E_INVALIDARG\n", hres);
+       "Start failed: %08lx, expected MK_E_SYNTAX or E_INVALIDARG\n", hres);
     CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
 
     SET_EXPECT(GetBindInfo);
@@ -3043,7 +3043,7 @@ static void test_file_protocol_fail(void)
     expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
     hres = IInternetProtocol_Start(protocol, index_url, &protocol_sink, &bind_info, 0, 0);
     ok(hres == INET_E_RESOURCE_NOT_FOUND,
-            "Start failed: %08x expected INET_E_RESOURCE_NOT_FOUND\n", hres);
+            "Start failed: %08lx expected INET_E_RESOURCE_NOT_FOUND\n", hres);
     CHECK_CALLED(GetBindInfo);
     if(!(bindf & BINDF_FROMURLMON))
         CHECK_CALLED(ReportProgress_DIRECTBIND);
@@ -3054,7 +3054,7 @@ static void test_file_protocol_fail(void)
 
     hres = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IInternetProtocol, (void**)&protocol);
-    ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+    ok(hres == S_OK, "CoCreateInstance failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
@@ -3067,7 +3067,7 @@ static void test_file_protocol_fail(void)
 
     hres = IInternetProtocol_Start(protocol, index_url2, &protocol_sink, &bind_info, 0, 0);
     ok(hres == INET_E_RESOURCE_NOT_FOUND,
-            "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
+            "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND\n", hres);
     CHECK_CALLED(GetBindInfo);
     if(!(bindf & BINDF_FROMURLMON))
         CHECK_CALLED(ReportProgress_DIRECTBIND);
@@ -3076,12 +3076,12 @@ static void test_file_protocol_fail(void)
 
     SET_EXPECT(GetBindInfo);
     hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
     CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
 
     SET_EXPECT(GetBindInfo);
     hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
     CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
 
     IInternetProtocol_Release(protocol);
@@ -3230,7 +3230,7 @@ static void create_cache_entry(const WCHAR *urlw)
     yesterday.dwLowDateTime = li.u.LowPart;
 
     res = CreateUrlCacheEntryA(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");
@@ -3240,7 +3240,7 @@ static void create_cache_entry(const WCHAR *urlw)
 
     res = CommitUrlCacheEntryA(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());
 }
 
 static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
@@ -3251,7 +3251,7 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
 
     if(use_iuri && pCreateUri) {
         hres = pCreateUri(url, 0, 0, &uri);
-        ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
     }
 
     SET_EXPECT(GetBindInfo);
@@ -3279,16 +3279,16 @@ static BOOL http_protocol_start(LPCWSTR url, BOOL use_iuri)
         IInternetProtocolEx *protocolex;
 
         hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
-        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
 
         hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, 0, 0);
-        ok(hres == S_OK, "Start failed: %08x\n", hres);
+        ok(hres == S_OK, "Start failed: %08lx\n", hres);
 
         IInternetProtocolEx_Release(protocolex);
         IUri_Release(uri);
     }else {
         hres = IInternetProtocol_Start(async_protocol, url, &protocol_sink, &bind_info, 0, 0);
-        ok(hres == S_OK, "Start failed: %08x\n", hres);
+        ok(hres == S_OK, "Start failed: %08lx\n", hres);
     }
     if(FAILED(hres))
         return FALSE;
@@ -3328,13 +3328,13 @@ static void test_protocol_terminate(IInternetProtocol *protocol)
     HRESULT hres;
 
     hres = IInternetProtocol_LockRequest(protocol, 0);
-    ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+    ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
 
     hres = IInternetProtocol_Read(protocol, buf, 1, &cb);
-    ok(hres == (test_abort ? S_OK : S_FALSE), "Read failed: %08x\n", hres);
+    ok(hres == (test_abort ? S_OK : S_FALSE), "Read failed: %08lx\n", hres);
 
     hres = IInternetProtocol_Terminate(protocol, 0);
-    ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+    ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
 
     /* This wait is to give the internet handles being freed in Terminate
      * enough time to actually terminate in all cases. Internet handles
@@ -3347,7 +3347,7 @@ static void test_protocol_terminate(IInternetProtocol *protocol)
     Sleep(100);
 
     hres = IInternetProtocol_UnlockRequest(protocol);
-    ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+    ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
 }
 
 /* is_first refers to whether this is the first call to this function
@@ -3367,13 +3367,13 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
 
     hres = CoGetClassObject(prot == HTTPS_TEST ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
             CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
+    ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
     ok(hres == E_NOINTERFACE,
-        "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n",
+        "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n",
         hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
@@ -3384,7 +3384,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
 
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
                                         (void**)&async_protocol);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
     if(SUCCEEDED(hres)) {
         BYTE buf[3600];
         DWORD cb;
@@ -3443,19 +3443,19 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
             BYTE buf[1500];
 
             hres = IInternetProtocol_Read(async_protocol, buf, 100, &cb);
-            ok(hres == S_OK && cb == 100, "Read failed: %08x (%d bytes)\n", hres, cb);
+            ok(hres == S_OK && cb == 100, "Read failed: %08lx (%ld bytes)\n", hres, cb);
 
             SET_EXPECT(ReportResult);
             hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
-            ok(hres == S_OK && cb == 900, "Read failed: %08x (%d bytes)\n", hres, cb);
+            ok(hres == S_OK && cb == 900, "Read failed: %08lx (%ld bytes)\n", hres, cb);
             CHECK_CALLED(ReportResult);
 
             hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
-            ok(hres == S_FALSE && !cb, "Read failed: %08x (%d bytes)\n", hres, cb);
+            ok(hres == S_FALSE && !cb, "Read failed: %08lx (%ld bytes)\n", hres, cb);
         }else {
             hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
             ok((hres == E_PENDING && cb==0) ||
-               (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+               (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
 
             ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
             if(bindf & BINDF_FROMURLMON)
@@ -3474,7 +3474,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
                 if(hres == E_PENDING) {
                     hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
                     ok((hres == E_PENDING && cb==0) ||
-                       (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+                       (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
                     ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
                     if(bindf & BINDF_FROMURLMON)
                         CHECK_CALLED(Switch);
@@ -3486,11 +3486,11 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
 
                         SET_EXPECT(ReportResult);
                         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-                        ok(hres == S_OK, "Abort failed: %08x\n", hres);
+                        ok(hres == S_OK, "Abort failed: %08lx\n", hres);
                         CHECK_CALLED(ReportResult);
 
                         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-                        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
+                        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
                         break;
                     }
                 }else {
@@ -3502,7 +3502,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
                 }
             }
             if(!test_abort) {
-                ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+                ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
                 CHECK_CALLED(ReportResult);
             }
         }
@@ -3513,15 +3513,15 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
             CLEAR_CALLED(ReportProgress_COOKIE_SENT);
 
         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08x\n", hres);
+        ok(hres == INET_E_RESULT_DISPATCHED || hres == S_OK /* IE10 */, "Abort failed: %08lx\n", hres);
 
         test_protocol_terminate(async_protocol);
 
         hres = IInternetProtocol_Abort(async_protocol, E_ABORT, 0);
-        ok(hres == S_OK, "Abort failed: %08x\n", hres);
+        ok(hres == S_OK, "Abort failed: %08lx\n", hres);
 
         ref = IInternetProtocol_Release(async_protocol);
-        ok(!ref, "ref=%x\n", ref);
+        ok(!ref, "ref=%lx\n", ref);
     }
 
     IClassFactory_Release(factory);
@@ -3530,7 +3530,7 @@ static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags, DWORD tym
         BOOL res;
 
         res = DeleteUrlCacheEntryW(url);
-        ok(res, "DeleteUrlCacheEntryA failed: %u\n", GetLastError());
+        ok(res, "DeleteUrlCacheEntryA failed: %lu\n", GetLastError());
     }
 }
 
@@ -3642,12 +3642,12 @@ static void test_ftp_protocol(void)
     expect_hrResult = E_PENDING;
 
     hres = CoGetClassObject(&CLSID_FtpProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
+    ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
-    ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
     ok(hres == S_OK, "Could not get IClassFactory interface\n");
@@ -3658,7 +3658,7 @@ static void test_ftp_protocol(void)
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
                                         (void**)&async_protocol);
     IClassFactory_Release(factory);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
 
     test_priority(async_protocol);
 
@@ -3669,14 +3669,14 @@ static void test_ftp_protocol(void)
     SET_EXPECT(Switch);
 
     hres = IInternetProtocol_Start(async_protocol, ftp_urlW, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == S_OK, "Start failed: %08x\n", hres);
+    ok(hres == S_OK, "Start failed: %08lx\n", hres);
     CHECK_CALLED(GetBindInfo);
 
     SET_EXPECT(ReportResult);
 
     hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
     ok((hres == E_PENDING && cb==0) ||
-       (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+       (hres == S_OK && cb==1), "Read failed: %08lx (%ld bytes)\n", hres, cb);
 
     ok( WaitForSingleObject(event_complete, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
 
@@ -3692,7 +3692,7 @@ static void test_ftp_protocol(void)
             if(cb == 0) break;
     }
 
-    ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+    ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
     CHECK_CALLED(ReportResult);
     CHECK_CALLED(Switch);
 
@@ -3702,12 +3702,12 @@ static void test_ftp_protocol(void)
         IInternetProtocolEx *protocolex;
 
         hres = IInternetProtocol_QueryInterface(async_protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
-        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
         IInternetProtocolEx_Release(protocolex);
     }
 
     ref = IInternetProtocol_Release(async_protocol);
-    ok(!ref, "ref=%d\n", ref);
+    ok(!ref, "ref=%ld\n", ref);
 
     test_early_abort(&CLSID_FtpProtocol);
 }
@@ -3724,12 +3724,12 @@ static void test_gopher_protocol(void)
     hres = CoGetClassObject(&CLSID_GopherProtocol, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
     ok(hres == S_OK ||
        broken(hres == REGDB_E_CLASSNOTREG || hres == CLASS_E_CLASSNOTAVAILABLE), /* Gopher protocol has been removed as of Vista */
-       "CoGetClassObject failed: %08x\n", hres);
+       "CoGetClassObject failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
-    ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
     ok(hres == S_OK, "Could not get IClassFactory interface\n");
@@ -3740,7 +3740,7 @@ static void test_gopher_protocol(void)
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
                                         (void**)&async_protocol);
     IClassFactory_Release(factory);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
 
     test_priority(async_protocol);
 
@@ -3766,11 +3766,11 @@ static void test_mk_protocol(void)
 
     hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL,
             &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
+    ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocolInfo, (void**)&protocol_info);
     ok(hres == E_NOINTERFACE,
-        "Could not get IInternetProtocolInfo interface: %08x, expected E_NOINTERFACE\n",
+        "Could not get IInternetProtocolInfo interface: %08lx, expected E_NOINTERFACE\n",
         hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IClassFactory, (void**)&factory);
@@ -3782,12 +3782,12 @@ static void test_mk_protocol(void)
     hres = IClassFactory_CreateInstance(factory, NULL, &IID_IInternetProtocol,
                                         (void**)&protocol);
     IClassFactory_Release(factory);
-    ok(hres == S_OK, "Could not get IInternetProtocol: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol: %08lx\n", hres);
 
     SET_EXPECT(GetBindInfo);
     hres = IInternetProtocol_Start(protocol, wrong_url1, &protocol_sink, &bind_info, 0, 0);
     ok(hres == MK_E_SYNTAX || hres == INET_E_INVALID_URL,
-       "Start failed: %08x, expected MK_E_SYNTAX or INET_E_INVALID_URL\n", hres);
+       "Start failed: %08lx, expected MK_E_SYNTAX or INET_E_INVALID_URL\n", hres);
     CLEAR_CALLED(GetBindInfo);
 
     SET_EXPECT(GetBindInfo);
@@ -3800,7 +3800,7 @@ static void test_mk_protocol(void)
     hres = IInternetProtocol_Start(protocol, wrong_url2, &protocol_sink, &bind_info, 0, 0);
     ok(hres == INET_E_RESOURCE_NOT_FOUND ||
        hres == INET_E_INVALID_URL, /* win2k3 */
-       "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres);
+       "Start failed: %08lx, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres);
 
     if (hres == INET_E_RESOURCE_NOT_FOUND) {
         CHECK_CALLED(GetBindInfo);
@@ -3839,48 +3839,48 @@ static void test_CreateBinding(void)
     init_test(BIND_TEST, TEST_BINDING);
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
 
     hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, wsz_test, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
     binding_protocol = protocol;
-    ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
     ok(protocol != NULL, "protocol == NULL\n");
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
-    ok(hres == S_OK, "Could not get IInternetProtocolSink: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocolSink: %08lx\n", hres);
 
     hres = IInternetProtocol_Start(protocol, test_url, NULL, &bind_info, 0, 0);
-    ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, NULL, 0, 0);
-    ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "Start failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetPriority) failed: %08lx\n", hres);
 
     p = 0xdeadbeef;
     hres = IInternetPriority_GetPriority(priority, &p);
-    ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
-    ok(!p, "p=%d\n", p);
+    ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
+    ok(!p, "p=%ld\n", p);
 
     ex_priority = 100;
     hres = IInternetPriority_SetPriority(priority, 100);
-    ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
+    ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
 
     p = 0xdeadbeef;
     hres = IInternetPriority_GetPriority(priority, &p);
-    ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
-    ok(p == 100, "p=%d\n", p);
+    ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
+    ok(p == 100, "p=%ld\n", p);
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
-    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
 
     SET_EXPECT(QueryService_InternetProtocol);
 
@@ -3895,23 +3895,23 @@ static void test_CreateBinding(void)
     SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
     SET_EXPECT(SetPriority);
 
-    ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
+    ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
 
     expect_hrResult = S_OK;
     hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == S_OK, "Start failed: %08x\n", hres);
+    ok(hres == S_OK, "Start failed: %08lx\n", hres);
 
     CHECK_CALLED(QueryService_InternetProtocol);
 
     CHECK_CALLED(CreateInstance);
     if(no_aggregation) {
         CHECK_CALLED(CreateInstance_no_aggregation);
-        ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
-        ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
+        ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
+        ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
     }else {
-        ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %d\n",
+        ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n",
            obj_refcount(protocol));
-        ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %u\n",
+        ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n",
            protocol_emul->outer_ref);
     }
 
@@ -3925,125 +3925,125 @@ static void test_CreateBinding(void)
     if(!no_aggregation)
         SET_EXPECT(QueryInterface_IWinInetInfo);
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
-    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
     if(!no_aggregation)
         CHECK_CALLED(QueryInterface_IWinInetInfo);
 
     if(!no_aggregation)
         SET_EXPECT(QueryInterface_IWinInetInfo);
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
-    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
     if(!no_aggregation)
         CHECK_CALLED(QueryInterface_IWinInetInfo);
 
     if(!no_aggregation)
         SET_EXPECT(QueryInterface_IWinInetHttpInfo);
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&http_info);
-    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08lx\n", hres);
     if(!no_aggregation)
         CHECK_CALLED(QueryInterface_IWinInetHttpInfo);
 
     SET_EXPECT(Read);
     read = 0xdeadbeef;
     hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
-    ok(hres == S_OK, "Read failed: %08x\n", hres);
-    ok(read == 100, "read = %d\n", read);
+    ok(hres == S_OK, "Read failed: %08lx\n", hres);
+    ok(read == 100, "read = %ld\n", read);
     CHECK_CALLED(Read);
 
     SET_EXPECT(Read);
     read = 0xdeadbeef;
     hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
-    ok(hres == S_FALSE, "Read failed: %08x\n", hres);
-    ok(!read, "read = %d\n", read);
+    ok(hres == S_FALSE, "Read failed: %08lx\n", hres);
+    ok(!read, "read = %ld\n", read);
     CHECK_CALLED(Read);
 
     p = 0xdeadbeef;
     hres = IInternetPriority_GetPriority(priority, &p);
-    ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
-    ok(p == 100, "p=%d\n", p);
+    ok(hres == S_OK, "GetPriority failed: %08lx\n", hres);
+    ok(p == 100, "p=%ld\n", p);
 
     hres = IInternetPriority_SetPriority(priority, 101);
-    ok(hres == S_OK, "SetPriority failed: %08x\n", hres);
+    ok(hres == S_OK, "SetPriority failed: %08lx\n", hres);
 
     if(no_aggregation) {
-        ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
-        ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
+        ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
+        ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
     }else {
-        ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %d\n", obj_refcount(protocol));
-        ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
+        ok(obj_refcount(protocol) == 5 || broken(obj_refcount(protocol) == 4) /* before win7 */, "wrong protocol refcount %ld\n", obj_refcount(protocol));
+        ok(protocol_emul->outer_ref == 1 || broken(protocol_emul->outer_ref == 0) /* before win7 */, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
     }
 
     SET_EXPECT(Terminate);
     hres = IInternetProtocol_Terminate(protocol, 0xdeadbeef);
-    ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+    ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
     CHECK_CALLED(Terminate);
 
-    ok(obj_refcount(protocol) == 4, "wrong protocol refcount %d\n", obj_refcount(protocol));
-    ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %u\n", protocol_emul->outer_ref);
+    ok(obj_refcount(protocol) == 4, "wrong protocol refcount %ld\n", obj_refcount(protocol));
+    ok(protocol_emul->outer_ref == 0, "protocol_outer_ref = %lu\n", protocol_emul->outer_ref);
 
     SET_EXPECT(Continue);
     hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     CHECK_CALLED(Continue);
 
     SET_EXPECT(Read);
     read = 0xdeadbeef;
     hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
     if(no_aggregation) {
-        ok(hres == S_OK, "Read failed: %08x\n", hres);
-        ok(read == 100, "read = %d\n", read);
+        ok(hres == S_OK, "Read failed: %08lx\n", hres);
+        ok(read == 100, "read = %ld\n", read);
         CHECK_CALLED(Read);
     }else {
         todo_wine
-        ok(hres == E_ABORT, "Read failed: %08x\n", hres);
+        ok(hres == E_ABORT, "Read failed: %08lx\n", hres);
         todo_wine
-        ok(read == 0, "read = %d\n", read);
+        ok(read == 0, "read = %ld\n", read);
         todo_wine
         CHECK_NOT_CALLED(Read);
     }
 
     hres = IInternetProtocolSink_ReportProgress(binding_sink,
             BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
-    ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
 
     hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
-    ok(hres == E_FAIL, "ReportResult failed: %08x, expected E_FAIL\n", hres);
+    ok(hres == E_FAIL, "ReportResult failed: %08lx, expected E_FAIL\n", hres);
 
     hres = IInternetProtocolSink_ReportData(binding_sink, 0, 0, 0);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
 
     IInternetProtocolSink_Release(binding_sink);
     IInternetPriority_Release(priority);
     IInternetBindInfo_Release(prot_bind_info);
 
-    ok(obj_refcount(protocol) == 1, "wrong protocol refcount %d\n", obj_refcount(protocol));
+    ok(obj_refcount(protocol) == 1, "wrong protocol refcount %ld\n", obj_refcount(protocol));
 
     SET_EXPECT(Protocol_destructor);
     IInternetProtocol_Release(protocol);
     CHECK_CALLED(Protocol_destructor);
 
     hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
-    ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
     ok(protocol != NULL, "protocol == NULL\n");
 
     hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
-    ok(hres == S_OK, "Abort failed: %08x\n", hres);
+    ok(hres == S_OK, "Abort failed: %08lx\n", hres);
 
     hres = IInternetProtocol_Abort(protocol, E_FAIL, 0);
-    ok(hres == S_OK, "Abort failed: %08x\n", hres);
+    ok(hres == S_OK, "Abort failed: %08lx\n", hres);
 
     IInternetProtocol_Release(protocol);
 
     hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
-    ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
 
     hres = IInternetSession_CreateBinding(session, NULL, test_url, NULL, NULL, &protocol, 0);
-    ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
     ok(protocol != NULL, "protocol == NULL\n");
 
     SET_EXPECT(QueryService_InternetProtocol);
     hres = IInternetProtocol_Start(protocol, test_url, &protocol_sink, &bind_info, 0, 0);
-    ok(hres == MK_E_SYNTAX, "Start failed: %08x, expected MK_E_SYNTAX\n", hres);
+    ok(hres == MK_E_SYNTAX, "Start failed: %08lx, expected MK_E_SYNTAX\n", hres);
     CHECK_CALLED(QueryService_InternetProtocol);
 
     IInternetProtocol_Release(protocol);
@@ -4065,30 +4065,30 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
     init_test(prot, test_flags|TEST_BINDING);
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
 
     if(test_flags & TEST_EMULATEPROT) {
         hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
-        ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
     }
 
     hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
     binding_protocol = protocol;
-    ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateBinding failed: %08lx\n", hres);
     ok(protocol != NULL, "protocol == NULL\n");
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08lx\n", hres);
 
     hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetProtocolSink) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetProtocolSink) failed: %08lx\n", hres);
 
     if(test_flags & TEST_USEIURI) {
         hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex);
-        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IInternetProtocolEx iface: %08lx\n", hres);
 
         hres = pCreateUri(binding_urls[prot], Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri);
-        ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
     }
 
     ex_priority = 0;
@@ -4105,10 +4105,10 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
 
     if(protocolex) {
         hres = IInternetProtocolEx_StartEx(protocolex, uri, &protocol_sink, &bind_info, pi, 0);
-        ok(hres == S_OK, "StartEx failed: %08x\n", hres);
+        ok(hres == S_OK, "StartEx failed: %08lx\n", hres);
     }else {
         hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, pi, 0);
-        ok(hres == S_OK, "Start failed: %08x\n", hres);
+        ok(hres == S_OK, "Start failed: %08lx\n", hres);
     }
 
     CHECK_CALLED(QueryService_InternetProtocol);
@@ -4140,11 +4140,11 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
             if(test_abort && prot_state == 2) {
                 SET_EXPECT(Abort);
                 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
-                ok(hres == S_OK, "Abort failed: %08x\n", hres);
+                ok(hres == S_OK, "Abort failed: %08lx\n", hres);
                 CHECK_CALLED(Abort);
 
                 hres = IInternetProtocol_Abort(protocol, E_ABORT, 0);
-                ok(hres == S_OK, "Abort failed: %08x\n", hres);
+                ok(hres == S_OK, "Abort failed: %08lx\n", hres);
                 SetEvent(event_complete2);
                 break;
             }
@@ -4160,7 +4160,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
             else
                 SET_EXPECT(LockRequest);
             hres = IInternetProtocol_LockRequest(protocol, 0);
-            ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+            ok(hres == S_OK, "LockRequest failed: %08lx\n", hres);
             if(mimefilter_test)
                 CHECK_CALLED(MimeFilter_LockRequest);
             else
@@ -4172,7 +4172,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
         else
             SET_EXPECT(UnlockRequest);
         hres = IInternetProtocol_UnlockRequest(protocol);
-        ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+        ok(hres == S_OK, "UnlockRequest failed: %08lx\n", hres);
         if(mimefilter_test)
             CHECK_CALLED(MimeFilter_UnlockRequest);
         else
@@ -4184,7 +4184,7 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
     else
         SET_EXPECT(Terminate);
     hres = IInternetProtocol_Terminate(protocol, 0);
-    ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+    ok(hres == S_OK, "Terminate failed: %08lx\n", hres);
     if(mimefilter_test)
         CLEAR_CALLED(MimeFilter_Terminate);
     else
@@ -4197,12 +4197,12 @@ static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
 
     SET_EXPECT(Protocol_destructor);
     ref = IInternetProtocol_Release(protocol);
-    ok(!ref, "ref=%u, expected 0\n", ref);
+    ok(!ref, "ref=%lu, expected 0\n", ref);
     CHECK_CALLED(Protocol_destructor);
 
     if(test_flags & TEST_EMULATEPROT) {
         hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
-        ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+        ok(hres == S_OK, "UnregisterNameSpace failed: %08lx\n", hres);
     }
 
     IInternetSession_Release(session);
@@ -4245,18 +4245,18 @@ static void test_com_aggregation(const CLSID *clsid)
     HRESULT hres;
 
     hres = CoGetClassObject(clsid, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&class_factory);
-    ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
+    ok(hres == S_OK, "CoGetClassObject failed: %08lx\n", hres);
 
     hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "CreateInstance returned: %08x\n", hres);
+    ok(hres == S_OK, "CreateInstance returned: %08lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IInternetProtocol, (void**)&unk2);
-    ok(hres == S_OK, "Could not get IDispatch iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IDispatch iface: %08lx\n", hres);
 
     SET_EXPECT(outer_QI_test);
     hres = IUnknown_QueryInterface(unk2, &outer_test_iid, (void**)&unk3);
     CHECK_CALLED(outer_QI_test);
-    ok(hres == S_OK, "Could not get IInternetProtocol iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocol iface: %08lx\n", hres);
     ok(unk3 == (IUnknown*)0xdeadbeef, "unexpected unk2\n");
 
     IUnknown_Release(unk2);
@@ -4264,7 +4264,7 @@ static void test_com_aggregation(const CLSID *clsid)
 
     unk = (void*)0xdeadbeef;
     hres = IClassFactory_CreateInstance(class_factory, &outer, &IID_IInternetProtocol, (void**)&unk);
-    ok(hres == CLASS_E_NOAGGREGATION, "CreateInstance returned: %08x\n", hres);
+    ok(hres == CLASS_E_NOAGGREGATION, "CreateInstance returned: %08lx\n", hres);
     ok(!unk, "unk = %p\n", unk);
 
     IClassFactory_Release(class_factory);
diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c
index 4d61079ab83..2f1844ca8e8 100644
--- a/dlls/urlmon/tests/sec_mgr.c
+++ b/dlls/urlmon/tests/sec_mgr.c
@@ -291,11 +291,11 @@ static HRESULT WINAPI SecurityManager_ProcessUrlAction(IInternetSecurityManager*
         BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved)
 {
     CHECK_EXPECT(ProcessUrlAction);
-    ok(dwAction == URLACTION_FEATURE_ZONE_ELEVATION, "dwAction = %x\n", dwAction);
-    ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy);
+    ok(dwAction == URLACTION_FEATURE_ZONE_ELEVATION, "dwAction = %lx\n", dwAction);
+    ok(cbPolicy == sizeof(DWORD), "cbPolicy = %ld\n", cbPolicy);
     ok(!pContext, "pContext != NULL\n");
-    ok(dwFlags == PUAF_NOUI, "dwFlags = %x\n", dwFlags);
-    ok(dwReserved == 0, "dwReserved = %x\n", dwReserved);
+    ok(dwFlags == PUAF_NOUI, "dwFlags = %lx\n", dwFlags);
+    ok(dwReserved == 0, "dwReserved = %lx\n", dwReserved);
 
     *pPolicy = ProcessUrlAction_policy;
     return ProcessUrlAction_policy==URLPOLICY_ALLOW ? S_OK : S_FALSE;
@@ -354,7 +354,7 @@ static void test_SecurityManager(void)
     trace("Testing security manager...\n");
 
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
@@ -364,23 +364,23 @@ static void test_SecurityManager(void)
                                                      &zone, 0);
         ok(hres == secmgr_tests[i].zone_hres /* IE <=6 */
            || (FAILED(secmgr_tests[i].zone_hres) && hres == E_INVALIDARG), /* IE7 */
-           "[%d] MapUrlToZone failed: %08x, expected %08x\n",
+           "[%d] MapUrlToZone failed: %08lx, expected %08lx\n",
                 i, hres, secmgr_tests[i].zone_hres);
         if(SUCCEEDED(hres))
-            ok(zone == secmgr_tests[i].zone, "[%d] zone=%d, expected %d\n", i, zone,
+            ok(zone == secmgr_tests[i].zone, "[%d] zone=%ld, expected %ld\n", i, zone,
                secmgr_tests[i].zone);
         else
-            ok(zone == secmgr_tests[i].zone || zone == -1, "[%d] zone=%d\n", i, zone);
+            ok(zone == secmgr_tests[i].zone || zone == -1, "[%d] zone=%ld\n", i, zone);
 
         size = sizeof(buf);
         memset(buf, 0xf0, sizeof(buf));
         hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[i].url,
                 buf, &size, 0);
         ok(hres == secmgr_tests[i].secid_hres,
-           "[%d] GetSecurityId failed: %08x, expected %08x\n",
+           "[%d] GetSecurityId failed: %08lx, expected %08lx\n",
            i, hres, secmgr_tests[i].secid_hres);
         if(secmgr_tests[i].secid) {
-            ok(size == secmgr_tests[i].secid_size, "[%d] size=%d, expected %d\n",
+            ok(size == secmgr_tests[i].secid_size, "[%d] size=%ld, expected %ld\n",
                     i, size, secmgr_tests[i].secid_size);
             ok(!memcmp(buf, secmgr_tests[i].secid, size), "[%d] wrong secid\n", i);
         }
@@ -388,64 +388,64 @@ static void test_SecurityManager(void)
 
     zone = 100;
     hres = IInternetSecurityManager_MapUrlToZone(secmgr, url10, &zone, 0);
-    ok(hres == S_OK, "MapUrlToZone failed: %08x, expected S_OK\n", hres);
-    ok(zone == 3, "zone=%d, expected 3\n", zone);
+    ok(hres == S_OK, "MapUrlToZone failed: %08lx, expected S_OK\n", hres);
+    ok(zone == 3, "zone=%ld, expected 3\n", zone);
 
     /* win2k3 translates %20 into a space */
     size = sizeof(buf);
     memset(buf, 0xf0, sizeof(buf));
     hres = IInternetSecurityManager_GetSecurityId(secmgr, url10, buf, &size, 0);
-    ok(hres == S_OK, "GetSecurityId failed: %08x, expected S_OK\n", hres);
+    ok(hres == S_OK, "GetSecurityId failed: %08lx, expected S_OK\n", hres);
     ok(size == sizeof(secid10) ||
        size == sizeof(secid10_2), /* win2k3 */
-       "size=%d\n", size);
+       "size=%ld\n", size);
     ok(!memcmp(buf, secid10, sizeof(secid10)) ||
        !memcmp(buf, secid10_2, sizeof(secid10_2)), /* win2k3 */
        "wrong secid\n");
 
     zone = 100;
     hres = IInternetSecurityManager_MapUrlToZone(secmgr, url13, &zone, 0);
-    ok(hres == S_OK, "MapUrlToZone failed: %08x\n", hres);
-    ok(zone == URLZONE_INVALID || broken(zone == URLZONE_INTERNET), "zone=%d\n", zone);
+    ok(hres == S_OK, "MapUrlToZone failed: %08lx\n", hres);
+    ok(zone == URLZONE_INVALID || broken(zone == URLZONE_INTERNET), "zone=%ld\n", zone);
 
     size = sizeof(buf);
     memset(buf, 0xf0, sizeof(buf));
     hres = IInternetSecurityManager_GetSecurityId(secmgr, url13, buf, &size, 0);
-    ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityId failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityId failed: %08lx\n", hres);
 
     zone = 100;
     hres = IInternetSecurityManager_MapUrlToZone(secmgr, url14, &zone, 0);
-    ok(hres == S_OK, "MapUrlToZone failed: %08x, expected S_OK\n", hres);
-    ok(zone == URLZONE_INTERNET, "zone=%d\n", zone);
+    ok(hres == S_OK, "MapUrlToZone failed: %08lx, expected S_OK\n", hres);
+    ok(zone == URLZONE_INTERNET, "zone=%ld\n", zone);
 
     size = sizeof(buf);
     memset(buf, 0xf0, sizeof(buf));
     hres = IInternetSecurityManager_GetSecurityId(secmgr, url14, buf, &size, 0);
-    ok(hres == S_OK, "GetSecurityId failed: %08x, expected S_OK\n", hres);
-    ok(size == sizeof(secid14), "size=%d\n", size);
+    ok(hres == S_OK, "GetSecurityId failed: %08lx, expected S_OK\n", hres);
+    ok(size == sizeof(secid14), "size=%ld\n", size);
     ok(!memcmp(buf, secid14, size), "wrong secid\n");
 
     zone = 100;
     hres = IInternetSecurityManager_MapUrlToZone(secmgr, NULL, &zone, 0);
-    ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08x, expected E_INVALIDARG\n", hres);
-    ok(zone == 100 || zone == -1, "zone=%d\n", zone);
+    ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08lx, expected E_INVALIDARG\n", hres);
+    ok(zone == 100 || zone == -1, "zone=%ld\n", zone);
 
     size = sizeof(buf);
     hres = IInternetSecurityManager_GetSecurityId(secmgr, NULL, buf, &size, 0);
     ok(hres == E_INVALIDARG,
-       "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+       "GetSecurityId failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
                                                   NULL, &size, 0);
     ok(hres == E_INVALIDARG,
-       "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+       "GetSecurityId failed: %08lx, expected E_INVALIDARG\n", hres);
     hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
                                                   buf, NULL, 0);
     ok(hres == E_INVALIDARG,
-       "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+       "GetSecurityId failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = IInternetSecurityManager_ProcessUrlAction(secmgr, NULL, URLACTION_SCRIPT_RUN, (BYTE*)&policy,
             sizeof(WCHAR), NULL, 0, 0, 0);
-    ok(hres == E_INVALIDARG, "ProcessUrlAction failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "ProcessUrlAction failed: %08lx, expected E_INVALIDARG\n", hres);
 
     IInternetSecurityManager_Release(secmgr);
 }
@@ -508,23 +508,23 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag
         hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
                 sizeof(WCHAR), NULL, 0, 0, 0);
         ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
-            "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
-        ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+            "(0x%lx) got 0x%lx (expected E_FAIL)\n", action, hres);
+        ok(policy == 0xdeadbeef, "(%lx) policy=%lx\n", action, policy);
 
         policy = 0xdeadbeef;
         hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
                 sizeof(DWORD), URLZONEREG_DEFAULT);
         ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
-            "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
-        ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+            "(0x%lx) got 0x%lx (expected E_FAIL)\n", action, hres);
+        ok(policy == 0xdeadbeef, "(%lx) policy=%lx\n", action, policy);
         return;
     }
 
     policy = 0xdeadbeef;
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
             sizeof(DWORD), URLZONEREG_DEFAULT);
-    ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
-    ok(policy == reg_policy, "(%x) policy=%x, expected %x\n", action, policy, reg_policy);
+    ok(hres == S_OK, "GetZoneActionPolicy failed: %08lx\n", hres);
+    ok(policy == reg_policy, "(%lx) policy=%lx, expected %lx\n", action, policy, reg_policy);
 
     if(policy != URLPOLICY_QUERY) {
         if(winetest_interactive || ! is_ie_hardened()) {
@@ -534,37 +534,37 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag
             hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
                     sizeof(WCHAR), NULL, 0, 0, 0);
             if(reg_policy == URLPOLICY_DISALLOW)
-                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+                ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
             else
-                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-            ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+                ok(hres == S_OK, "ProcessUrlAction(%lx) failed: %08lx\n", action, hres);
+            ok(policy == 0xdeadbeef, "(%lx) policy=%lx\n", action, policy);
 
             policy = 0xdeadbeef;
             hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
                     2, NULL, 0, 0, 0);
             if(reg_policy == URLPOLICY_DISALLOW)
-                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+                ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
             else
-                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-            ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+                ok(hres == S_OK, "ProcessUrlAction(%lx) failed: %08lx\n", action, hres);
+            ok(policy == 0xdeadbeef, "(%lx) policy=%lx\n", action, policy);
 
             policy = 0xdeadbeef;
             hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
                     sizeof(DWORD), NULL, 0, 0, 0);
             if(reg_policy == URLPOLICY_DISALLOW)
-                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+                ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
             else
-                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-            ok(policy == reg_policy, "(%x) policy=%x\n", action, policy);
+                ok(hres == S_OK, "ProcessUrlAction(%lx) failed: %08lx\n", action, hres);
+            ok(policy == reg_policy, "(%lx) policy=%lx\n", action, policy);
 
             policy = 0xdeadbeef;
             hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
                     sizeof(WCHAR), (BYTE*)0xdeadbeef, 16, 0, 0);
             if(reg_policy == URLPOLICY_DISALLOW)
-                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+                ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
             else
-                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-            ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+                ok(hres == S_OK, "ProcessUrlAction(%lx) failed: %08lx\n", action, hres);
+            ok(policy == 0xdeadbeef, "(%lx) policy=%lx\n", action, policy);
 
             policy = 0xdeadbeef;
             if(expect_parse_call)
@@ -574,10 +574,10 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag
             if(expect_parse_call)
                 CHECK_CALLED(ParseUrl_SECURITY_URL_http);
             if(reg_policy == URLPOLICY_DISALLOW)
-                ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+                ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
             else
-                ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
-            ok(policy == reg_policy, "(%x) policy=%x\n", action, policy);
+                ok(hres == S_OK, "ProcessUrlAction(%lx) failed: %08lx\n", action, hres);
+            ok(policy == reg_policy, "(%lx) policy=%lx\n", action, policy);
         }else {
             skip("IE running in Enhanced Security Configuration\n");
         }
@@ -592,19 +592,19 @@ static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZ
     policy = 0xdeadbeef;
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
             sizeof(DWORD), URLZONEREG_DEFAULT);
-    ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
-    ok(policy == URLPOLICY_DISALLOW, "(%x) policy=%x, expected URLPOLICY_DISALLOW\n", action, policy);
+    ok(hres == S_OK, "GetZoneActionPolicy failed: %08lx\n", hres);
+    ok(policy == URLPOLICY_DISALLOW, "(%lx) policy=%lx, expected URLPOLICY_DISALLOW\n", action, policy);
 
     policy = 0xdeadbeef;
     hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
             sizeof(WCHAR), NULL, 0, 0, 0);
-    ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+    ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
 
     policy = 0xdeadbeef;
     hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
             sizeof(DWORD), NULL, 0, 0, 0);
-    ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
-    ok(policy == URLPOLICY_DISALLOW, "policy = %x\n", policy);
+    ok(hres == S_FALSE, "ProcessUrlAction(%lx) failed: %08lx, expected S_FALSE\n", action, hres);
+    ok(policy == URLPOLICY_DISALLOW, "policy = %lx\n", policy);
 }
 
 static void test_activex(IInternetSecurityManager *secmgr)
@@ -617,15 +617,15 @@ static void test_activex(IInternetSecurityManager *secmgr)
     policy = 0xdeadbeef;
     hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, URLACTION_ACTIVEX_RUN, (BYTE*)&policy,
             sizeof(DWORD), (BYTE*)&CLSID_TestActiveX, sizeof(CLSID), 0, 0);
-    ok(hres == S_OK, "ProcessUrlAction(URLACTION_ACTIVEX_RUN) failed: %08x\n", hres);
-    ok(policy == URLPOLICY_ALLOW || policy == URLPOLICY_DISALLOW, "policy = %x\n", policy);
+    ok(hres == S_OK, "ProcessUrlAction(URLACTION_ACTIVEX_RUN) failed: %08lx\n", hres);
+    ok(policy == URLPOLICY_ALLOW || policy == URLPOLICY_DISALLOW, "policy = %lx\n", policy);
 
     cs.clsid = CLSID_TestActiveX;
     cs.pUnk = (IUnknown*)0xdeadbeef;
     cs.dwFlags = 0;
     hres = IInternetSecurityManager_QueryCustomPolicy(secmgr, url1, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
             &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
-    ok(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "QueryCusromPolicy failed: %08x\n", hres);
+    ok(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "QueryCusromPolicy failed: %08lx\n", hres);
 }
 
 static void test_polices(void)
@@ -637,9 +637,9 @@ static void test_polices(void)
     trace("testing polices...\n");
 
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
     hres = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08lx\n", hres);
 
     test_url_action(secmgr, zonemgr, URLACTION_SCRIPT_RUN);
     test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_RUN);
@@ -671,12 +671,12 @@ static void test_zone_domain_cache(void)
             'd','o','m','a','i','n','/',0};
 
     res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains);
-    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res);
     if(res != ERROR_SUCCESS)
         return;
 
     res = RegCreateKeyA(domains, "testing.domain", &domain);
-    ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegCreateKey failed: %ld\n", res);
     if(res != ERROR_SUCCESS) {
         RegCloseKey(domains);
         return;
@@ -684,21 +684,21 @@ static void test_zone_domain_cache(void)
 
     zone = URLZONE_CUSTOM;
     res = RegSetValueExA(domain, "http", 0, REG_DWORD, (BYTE*)&zone, sizeof(DWORD));
-    ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %ld\n", res);
 
     RegCloseKey(domain);
 
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
 
     zone = URLZONE_INVALID;
     hres = IInternetSecurityManager_MapUrlToZone(secmgr, testing_domain_urlW, &zone, 0);
-    ok(hres == S_OK, "MapUrlToZone failed: %08x\n", hres);
-    todo_wine ok(zone == URLZONE_INTERNET, "Got %d, expected URLZONE_INTERNET\n", zone);
+    ok(hres == S_OK, "MapUrlToZone failed: %08lx\n", hres);
+    todo_wine ok(zone == URLZONE_INTERNET, "Got %ld, expected URLZONE_INTERNET\n", zone);
 
     /* FIXME: Play nice with ZoneMaps that existed before the test is run. */
     res = RegDeleteKeyA(domains, "testing.domain");
-    ok(res == ERROR_SUCCESS, "RegDeleteKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegDeleteKey failed: %ld\n", res);
 
     RegCloseKey(domains);
     IInternetSecurityManager_Release(secmgr);
@@ -738,7 +738,7 @@ static BOOL register_zone_domains(void)
 
     /* Some Windows versions don't seem to have a "Domains" key in their HKLM. */
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szZoneMapDomainsKey, &domains);
-    ok(res == ERROR_SUCCESS || broken(res == ERROR_FILE_NOT_FOUND), "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS || broken(res == ERROR_FILE_NOT_FOUND), "RegOpenKey failed: %ld\n", res);
     if(res == ERROR_SUCCESS) {
         HKEY domain;
         DWORD zone = URLZONE_CUSTOM;
@@ -750,37 +750,37 @@ static BOOL register_zone_domains(void)
             RegCloseKey(domains);
             return FALSE;
         }
-        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %d\n", res);
+        ok(res == ERROR_SUCCESS, "RegCreateKey failed: %ld\n", res);
 
         res = RegSetValueExA(domain, "http", 0, REG_DWORD, (BYTE*)&zone, sizeof(DWORD));
-        ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res);
+        ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %ld\n", res);
 
         RegCloseKey(domain);
         RegCloseKey(domains);
     }
 
     res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains);
-    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res);
 
     for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) {
         const zone_domain_mapping *test = zone_domain_mappings+i;
         HKEY domain;
 
         res = RegCreateKeyA(domains, test->domain, &domain);
-        ok(res == ERROR_SUCCESS, "RegCreateKey failed with %d on test %d\n", res, i);
+        ok(res == ERROR_SUCCESS, "RegCreateKey failed with %ld on test %ld\n", res, i);
 
         /* Only set the value if there's no subdomain. */
         if(!test->subdomain) {
             res = RegSetValueExA(domain, test->scheme, 0, REG_DWORD, (BYTE*)&test->zone, sizeof(DWORD));
-            ok(res == ERROR_SUCCESS, "RegSetValueEx failed with %d on test %d\n", res, i);
+            ok(res == ERROR_SUCCESS, "RegSetValueEx failed with %ld on test %ld\n", res, i);
         } else {
             HKEY subdomain;
 
             res = RegCreateKeyA(domain, test->subdomain, &subdomain);
-            ok(res == ERROR_SUCCESS, "RegCreateKey failed with %d on test %d\n", res, i);
+            ok(res == ERROR_SUCCESS, "RegCreateKey failed with %ld on test %ld\n", res, i);
 
             res = RegSetValueExA(subdomain, test->scheme, 0, REG_DWORD, (BYTE*)&test->zone, sizeof(DWORD));
-            ok(res == ERROR_SUCCESS, "RegSetValueEx failed with %d on test %d\n", res, i);
+            ok(res == ERROR_SUCCESS, "RegSetValueEx failed with %ld on test %ld\n", res, i);
 
             RegCloseKey(subdomain);
         }
@@ -798,14 +798,14 @@ static void unregister_zone_domains(void)
     DWORD res, i;
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szZoneMapDomainsKey, &domains);
-    ok(res == ERROR_SUCCESS || broken(res == ERROR_FILE_NOT_FOUND), "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS || broken(res == ERROR_FILE_NOT_FOUND), "RegOpenKey failed: %ld\n", res);
     if(res == ERROR_SUCCESS) {
         RegDeleteKeyA(domains, "local.machine");
         RegCloseKey(domains);
     }
 
     res = RegOpenKeyA(HKEY_CURRENT_USER, szZoneMapDomainsKey, &domains);
-    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %d\n", res);
+    ok(res == ERROR_SUCCESS, "RegOpenKey failed: %ld\n", res);
 
     for(i = 0; i < ARRAY_SIZE(zone_domain_mappings); ++i) {
         const zone_domain_mapping *test = zone_domain_mappings+i;
@@ -844,7 +844,7 @@ static void run_child_process(void)
     winetest_get_mainargs(&argv);
     sprintf(cmdline, "\"%s\" %s domain_tests", argv[0], argv[1]);
     ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-    ok(ret, "Failed to spawn child process: %u\n", GetLastError());
+    ok(ret, "Failed to spawn child process: %lu\n", GetLastError());
     wait_child_process(pi.hProcess);
     CloseHandle(pi.hThread);
     CloseHandle(pi.hProcess);
@@ -899,7 +899,7 @@ static void test_zone_domain_mappings(void)
     trace("testing zone domain mappings...\n");
 
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, szZoneMapDomainsKey, &domains);
     if(res == ERROR_SUCCESS) {
@@ -907,8 +907,8 @@ static void test_zone_domain_mappings(void)
                 '.','m','a','c','h','i','n','e','/',0};
 
         hres = IInternetSecurityManager_MapUrlToZone(secmgr, local_machineW, &zone, 0);
-        ok(hres == S_OK, "MapUrlToZone failed: %08x\n", hres);
-        ok(zone == URLZONE_CUSTOM, "Expected URLZONE_CUSTOM, but got %d\n", zone);
+        ok(hres == S_OK, "MapUrlToZone failed: %08lx\n", hres);
+        ok(zone == URLZONE_CUSTOM, "Expected URLZONE_CUSTOM, but got %ld\n", zone);
 
         RegCloseKey(domains);
     }
@@ -918,10 +918,10 @@ static void test_zone_domain_mappings(void)
         zone = URLZONE_INVALID;
 
         hres = IInternetSecurityManager_MapUrlToZone(secmgr, test->url, &zone, 0);
-        ok(hres == S_OK, "MapUrlToZone failed: %08x\n", hres);
+        ok(hres == S_OK, "MapUrlToZone failed: %08lx\n", hres);
         todo_wine_if (test->todo)
             ok(zone == test->zone || broken(test->broken_zone == zone),
-                "Expected %d, but got %d on test %d\n", test->zone, zone, i);
+                "Expected %ld, but got %ld on test %ld\n", test->zone, zone, i);
     }
 
     IInternetSecurityManager_Release(secmgr);
@@ -955,17 +955,17 @@ static void test_CoInternetCreateZoneManager(void)
     trace("simple zone manager tests...\n");
 
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%lx\n", hr);
     if (FAILED(hr))
         return;
 
     hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IUnknown, (void **) &punk);
-    ok(SUCCEEDED(hr), "got 0x%x with %p (expected Success)\n", hr, punk);
+    ok(SUCCEEDED(hr), "got 0x%lx with %p (expected Success)\n", hr, punk);
     if (punk)
         IUnknown_Release(punk);
 
     hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IInternetZoneManager, (void **) &punk);
-    ok(SUCCEEDED(hr), "got 0x%x with %p (expected Success)\n", hr, punk);
+    ok(SUCCEEDED(hr), "got 0x%lx with %p (expected Success)\n", hr, punk);
     if (punk)
         IUnknown_Release(punk);
 
@@ -976,7 +976,7 @@ static void test_CoInternetCreateZoneManager(void)
 
         hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IInternetZoneManagerEx2, (void **) &punk);
         ok(hr == S_OK || broken(hr == E_NOINTERFACE /* some W2K3 */),
-           "got 0x%x (expected S_OK)\n", hr);
+           "got 0x%lx (expected S_OK)\n", hr);
         if (punk)
             IUnknown_Release(punk);
         else
@@ -987,7 +987,7 @@ static void test_CoInternetCreateZoneManager(void)
         win_skip("InternetZoneManagerEx not supported\n");
 
     hr = IInternetZoneManager_Release(zonemgr);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
 }
 
@@ -1003,62 +1003,62 @@ static void test_CreateZoneEnumerator(void)
     trace("testing zone enumerator...\n");
 
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%lx\n", hr);
     if (FAILED(hr))
         return;
 
     dwEnum=0xdeadbeef;
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, NULL, 0);
     ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef),
-        "got 0x%x with 0x%x (expected E_INVALIDARG with 0xdeadbeef)\n", hr, dwEnum);
+        "got 0x%lx with 0x%lx (expected E_INVALIDARG with 0xdeadbeef)\n", hr, dwEnum);
 
     dwCount=0xdeadbeef;
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, NULL, &dwCount, 0);
     ok((hr == E_INVALIDARG) && (dwCount == 0xdeadbeef),
-        "got 0x%x and 0x%x (expected E_INVALIDARG and 0xdeadbeef)\n", hr, dwCount);
+        "got 0x%lx and 0x%lx (expected E_INVALIDARG and 0xdeadbeef)\n", hr, dwCount);
 
     dwEnum=0xdeadbeef;
     dwCount=0xdeadbeef;
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0xffffffff);
     ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
-        "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+        "got 0x%lx with 0x%lx and 0x%lx (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
         hr, dwEnum, dwCount);
 
     dwEnum=0xdeadbeef;
     dwCount=0xdeadbeef;
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 1);
     ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
-        "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+        "got 0x%lx with 0x%lx and 0x%lx (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
         hr, dwEnum, dwCount);
 
     dwEnum=0xdeadbeef;
     dwCount=0xdeadbeef;
     /* Normal use */
     hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     if (SUCCEEDED(hr)) {
         dwEnum2=0xdeadbeef;
         dwCount2=0xdeadbeef;
         hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum2, &dwCount2, 0);
-        ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+        ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
         if (SUCCEEDED(hr)) {
             /* native urlmon has an incrementing counter for dwEnum */
             hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum2);
-            ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+            ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
         }
 
         hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
-        ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+        ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
         /* Destroy the Enumerator twice is detected and handled in native urlmon */
         hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
-        ok((hr == E_INVALIDARG), "got 0x%x (expected E_INVALIDARG)\n", hr);
+        ok((hr == E_INVALIDARG), "got 0x%lx (expected E_INVALIDARG)\n", hr);
     }
 
     /* ::Release succeed also, when a ::DestroyZoneEnumerator is missing */
     hr = IInternetZoneManager_Release(zonemgr);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 }
 
 static void test_GetZoneActionPolicy(void)
@@ -1071,35 +1071,35 @@ static void test_GetZoneActionPolicy(void)
     trace("testing GetZoneActionPolixy...\n");
 
     hres = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
             sizeof(DWORD), URLZONEREG_DEFAULT);
-    ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
+    ok(hres == S_OK, "GetZoneActionPolicy failed: %08lx\n", hres);
     ok(*(DWORD*)buf == URLPOLICY_CREDENTIALS_SILENT_LOGON_OK ||
             *(DWORD*)buf == URLPOLICY_CREDENTIALS_MUST_PROMPT_USER ||
             *(DWORD*)buf == URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT ||
             *(DWORD*)buf == URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY,
-            "unexpected policy=%d\n", *(DWORD*)buf);
+            "unexpected policy=%ld\n", *(DWORD*)buf);
 
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, NULL,
             sizeof(DWORD), URLZONEREG_DEFAULT);
-    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
             2, URLZONEREG_DEFAULT);
-    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1fff, buf,
             sizeof(DWORD), URLZONEREG_DEFAULT);
     ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
-            "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
+            "(0x%lx) got 0x%lx (expected E_FAIL)\n", action, hres);
 
     hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 13, action, buf,
             sizeof(DWORD), URLZONEREG_DEFAULT);
-    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08lx, expected E_INVALIDARG\n", hres);
 
     IInternetZoneManager_Release(zonemgr);
 }
@@ -1116,7 +1116,7 @@ static void test_GetZoneAt(void)
     trace("testing GetZoneAt...\n");
 
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%lx\n", hr);
     if (FAILED(hr))
         return;
 
@@ -1132,27 +1132,27 @@ static void test_GetZoneAt(void)
     dwZone = 0xdeadbeef;
     hr = IInternetZoneManager_GetZoneAt(zonemgr, 0xdeadbeef, 0, &dwZone);
     ok(hr == E_INVALIDARG,
-        "got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
+        "got 0x%lx with 0x%lx (expected E_INVALIDARG)\n", hr, dwZone);
 
     for (i = 0; i < dwCount; i++)
     {
         dwZone = 0xdeadbeef;
         hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, i, &dwZone);
-        ok(hr == S_OK, "#%d: got x%x with %d (expected S_OK)\n", i, hr, dwZone);
+        ok(hr == S_OK, "#%ld: got x%lx with %ld (expected S_OK)\n", i, hr, dwZone);
     }
 
     dwZone = 0xdeadbeef;
     /* MSDN (index .. must be .. less than or equal to) is wrong */
     hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, dwCount, &dwZone);
     ok(hr == E_INVALIDARG,
-        "got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
+        "got 0x%lx with 0x%lx (expected E_INVALIDARG)\n", hr, dwZone);
 
     hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
 cleanup:
     hr = IInternetZoneManager_Release(zonemgr);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 }
 
 static void test_GetZoneAttributes(void)
@@ -1166,7 +1166,7 @@ static void test_GetZoneAttributes(void)
     trace("testing GetZoneAttributes...\n");
 
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%lx\n", hr);
     if (FAILED(hr))
         return;
 
@@ -1174,41 +1174,41 @@ static void test_GetZoneAttributes(void)
     for (i = 0; i < 5; i++) {
         memset(buffer, -1, sizeof(buffer));
         hr = IInternetZoneManager_GetZoneAttributes(zonemgr, i, pZA);
-        ok(hr == S_OK, "#%d: got 0x%x (expected S_OK)\n", i, hr);
+        ok(hr == S_OK, "#%ld: got 0x%lx (expected S_OK)\n", i, hr);
     }
 
     /* IE8 no longer set cbSize */
     memset(buffer, -1, sizeof(buffer));
     pZA->cbSize = 0;
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
     ok((pZA->cbSize == 0) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
-        "got cbSize = %d (expected 0)\n", pZA->cbSize);
+        "got cbSize = %ld (expected 0)\n", pZA->cbSize);
 
     memset(buffer, -1, sizeof(buffer));
     pZA->cbSize = 64;
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
     ok((pZA->cbSize == 64) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
-        "got cbSize = %d (expected 64)\n", pZA->cbSize);
+        "got cbSize = %ld (expected 64)\n", pZA->cbSize);
 
     memset(buffer, -1, sizeof(buffer));
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
     ok((pZA->cbSize == 0xffffffff) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
-        "got cbSize = 0x%x (expected 0xffffffff)\n", pZA->cbSize);
+        "got cbSize = 0x%lx (expected 0xffffffff)\n", pZA->cbSize);
 
     /* IE8 up to IE10 don't fail on invalid zones */
     memset(buffer, -1, sizeof(buffer));
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0xdeadbeef, pZA);
     ok(hr == S_OK || hr == E_FAIL || hr == E_POINTER,
-        "got 0x%x (expected S_OK or E_FAIL)\n", hr);
+        "got 0x%lx (expected S_OK or E_FAIL)\n", hr);
 
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
 
     hr = IInternetZoneManager_Release(zonemgr);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 }
 
 static void test_SetZoneAttributes(void)
@@ -1223,25 +1223,25 @@ static void test_SetZoneAttributes(void)
 
     trace("testing SetZoneAttributes...\n");
     hr = pCoInternetCreateZoneManager(NULL, &zonemgr, 0);
-    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+    ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%lx\n", hr);
     if (FAILED(hr))
         return;
 
     memset(buffer, -1, sizeof(buffer));
     hr = IInternetZoneManager_GetZoneAttributes(zonemgr, URLZONE_LOCAL_MACHINE, pZA);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     sprintf(regpath, "%s\\Zones\\%d", szInternetSettingsKey, URLZONE_CUSTOM);
     res = RegCreateKeyA(HKEY_CURRENT_USER, regpath, &hkey);
     RegCloseKey(hkey);
 
-    ok(res == ERROR_SUCCESS, "got %d (expected ERROR_SUCCESS)\n", res);
+    ok(res == ERROR_SUCCESS, "got %ld (expected ERROR_SUCCESS)\n", res);
     if (res != ERROR_SUCCESS)
         goto cleanup;
 
     pZA->cbSize = sizeof(ZONEATTRIBUTES);
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
 
     /* normal use */
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
@@ -1249,20 +1249,20 @@ static void test_SetZoneAttributes(void)
         win_skip("SetZoneAttributes not supported: IE too old\n");
         goto cleanup;
     }
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     /* native urlmon ignores cbSize */
     pZA->cbSize = sizeof(ZONEATTRIBUTES) + sizeof(DWORD);
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
-    ok(hr == S_OK, "got 0x%x for sizeof(ZONEATTRIBUTES) + sizeof(DWORD) (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx for sizeof(ZONEATTRIBUTES) + sizeof(DWORD) (expected S_OK)\n", hr);
 
     pZA->cbSize = sizeof(ZONEATTRIBUTES) - sizeof(DWORD);
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
-    ok(hr == S_OK, "got 0x%x for sizeof(ZONEATTRIBUTES) - sizeof(DWORD) (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx for sizeof(ZONEATTRIBUTES) - sizeof(DWORD) (expected S_OK)\n", hr);
 
     pZA->cbSize = 0;
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
-    ok(hr == S_OK, "got 0x%x for size 0 (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx for size 0 (expected S_OK)\n", hr);
 
     /* The key for the zone must be present, when calling SetZoneAttributes */
     myRegDeleteTreeA(HKEY_CURRENT_USER, regpath);
@@ -1270,12 +1270,12 @@ static void test_SetZoneAttributes(void)
        All newer IE return S_OK without saving the zone attributes to the registry.
        This is a Windows bug, but we have to accept that as standard */
     hr = IInternetZoneManager_SetZoneAttributes(zonemgr, URLZONE_CUSTOM, pZA);
-    ok((hr == S_OK) || broken(hr == E_FAIL), "got 0x%x (expected S_OK)\n", hr);
+    ok((hr == S_OK) || broken(hr == E_FAIL), "got 0x%lx (expected S_OK)\n", hr);
 
     /* SetZoneAttributes did not create the directory */
     res = RegOpenKeyA(HKEY_CURRENT_USER, regpath, &hkey);
     ok((res == ERROR_FILE_NOT_FOUND) && (hkey == NULL),
-        "got %u with %p (expected ERROR_FILE_NOT_FOUND with NULL)\n", res, hkey);
+        "got %lu with %p (expected ERROR_FILE_NOT_FOUND with NULL)\n", res, hkey);
 
     if (hkey) RegCloseKey(hkey);
 
@@ -1284,7 +1284,7 @@ cleanup:
     myRegDeleteTreeA(HKEY_CURRENT_USER, regpath);
 
     hr = IInternetZoneManager_Release(zonemgr);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 }
 
 
@@ -1298,20 +1298,20 @@ static void test_InternetSecurityMarshalling(void)
     trace("testing marshalling...\n");
 
     hres = pCoInternetCreateSecurityManager(NULL, &secmgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSecurityManager_QueryInterface(secmgr, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "QueryInterface returned: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface returned: %08lx\n", hres);
 
     hres = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08x\n", hres);
+    ok(hres == S_OK, "CreateStreamOnHGlobal returned: %08lx\n", hres);
 
     hres = CoMarshalInterface(stream, &IID_IInternetSecurityManager, unk, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
     /* Not supported in W98 */
     ok(hres == S_OK || broken(hres == REGDB_E_IIDNOTREG),
-        "CoMarshalInterface returned: %08x\n", hres);
+        "CoMarshalInterface returned: %08lx\n", hres);
 
     IStream_Release(stream);
     IUnknown_Release(unk);
@@ -1336,17 +1336,17 @@ static void test_InternetGetSecurityUrl(void)
 
     for(i = 0; i < ARRAY_SIZE(in); i++) {
         hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_DEFAULT, 0);
-        ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
+        ok(hres == S_OK, "(%ld) CoInternetGetSecurityUrl returned: %08lx\n", i, hres);
         if(hres == S_OK) {
-            ok(!strcmp_w(sec, out_default[i]), "(%d) Got %s, expected %s\n",
+            ok(!strcmp_w(sec, out_default[i]), "(%ld) Got %s, expected %s\n",
                     i, wine_dbgstr_w(sec), wine_dbgstr_w(out_default[i]));
             CoTaskMemFree(sec);
         }
 
         hres = pCoInternetGetSecurityUrl(in[i], &sec, PSU_SECURITY_URL_ONLY, 0);
-        ok(hres == S_OK, "(%d) CoInternetGetSecurityUrl returned: %08x\n", i, hres);
+        ok(hres == S_OK, "(%ld) CoInternetGetSecurityUrl returned: %08lx\n", i, hres);
         if(hres == S_OK) {
-            ok(!strcmp_w(sec, out_securl[i]), "(%d) Got %s, expected %s\n",
+            ok(!strcmp_w(sec, out_securl[i]), "(%ld) Got %s, expected %s\n",
                     i, wine_dbgstr_w(sec), wine_dbgstr_w(out_securl[i]));
             CoTaskMemFree(sec);
         }
@@ -1357,7 +1357,7 @@ static void test_InternetGetSecurityUrl(void)
     SET_EXPECT(ParseUrl_SECURITY_DOMAIN_expected);
 
     hres = pCoInternetGetSecurityUrl(security_url2W, &sec, PSU_DEFAULT, 0);
-    ok(hres == S_OK, "CoInternetGetSecurityUrl returned 0x%08x, expected S_OK\n", hres);
+    ok(hres == S_OK, "CoInternetGetSecurityUrl returned 0x%08lx, expected S_OK\n", hres);
 
     CHECK_CALLED(ParseUrl_SECURITY_URL_input2);
     CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
@@ -1393,30 +1393,30 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
 
     ok(pwzResult != NULL, "pwzResult == NULL\n");
     ok(pcchResult != NULL, "pcchResult == NULL\n");
-    ok(!dwParseFlags, "Expected 0, but got 0x%08x\n", dwParseFlags);
+    ok(!dwParseFlags, "Expected 0, but got 0x%08lx\n", dwParseFlags);
 
     switch(ParseAction) {
     case PARSE_SECURITY_URL:
         if(!strcmp_w(pwzUrl, security_urlW)) {
             CHECK_EXPECT(ParseUrl_SECURITY_URL_input);
-            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %d\n", cchResult);
+            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %ld\n", cchResult);
             ret = security_expectedW;
         } else if(!strcmp_w(pwzUrl, security_url2W)) {
             CHECK_EXPECT(ParseUrl_SECURITY_URL_input2);
-            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %d\n", cchResult);
+            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %ld\n", cchResult);
             ret = security_expectedW;
         } else if(!strcmp_w(pwzUrl, security_expectedW)) {
             CHECK_EXPECT(ParseUrl_SECURITY_URL_expected);
-            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %d\n", cchResult);
+            ok(cchResult == lstrlenW(pwzUrl)+1, "Got %ld\n", cchResult);
             ret = security_expectedW;
         } else if(!strcmp_w(pwzUrl, winetest_to_httpW)) {
             switch(++called_securl_http) {
             case 1:
-                ok(cchResult == lstrlenW(pwzUrl)+1, "Got %d\n", cchResult);
+                ok(cchResult == lstrlenW(pwzUrl)+1, "Got %ld\n", cchResult);
                 break;
             case 2:
                 CHECK_EXPECT(ParseUrl_SECURITY_URL_http);
-                ok(cchResult == lstrlenW(url9)+1, "Got %d\n", cchResult);
+                ok(cchResult == lstrlenW(url9)+1, "Got %ld\n", cchResult);
                 break;
             default:
                 todo_wine CHECK_EXPECT(ParseUrl_SECURITY_URL_http);
@@ -1432,7 +1432,7 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
 
         ok(!strcmp_w(pwzUrl, security_expectedW), "Expected %s but got %s\n",
             wine_dbgstr_w(security_expectedW), wine_dbgstr_w(pwzUrl));
-        ok(cchResult == lstrlenW(pwzUrl)+1, "Got %d\n", cchResult);
+        ok(cchResult == lstrlenW(pwzUrl)+1, "Got %ld\n", cchResult);
         ret = security_expectedW;
         break;
     default:
@@ -1535,13 +1535,13 @@ static void register_protocols(void)
     HRESULT hres;
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
             winetestW, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     IInternetSession_Release(session);
 }
@@ -1551,12 +1551,12 @@ static void unregister_protocols(void) {
     HRESULT hr;
 
     hr = pCoInternetGetSession(0, &session, 0);
-    ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInternetGetSession failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         return;
 
     hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
-    ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
 
     IInternetSession_Release(session);
 }
@@ -1592,36 +1592,36 @@ static void test_InternetGetSecurityUrlEx(void)
     trace("testing CoInternetGetSecurityUrlEx...\n");
 
     hr = pCoInternetGetSecurityUrlEx(NULL, NULL, PSU_DEFAULT, 0);
-    ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08x, expected E_INVALIDARG\n", hr);
+    ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08lx, expected E_INVALIDARG\n", hr);
 
     result = (void*) 0xdeadbeef;
     hr = pCoInternetGetSecurityUrlEx(NULL, &result, PSU_DEFAULT, 0);
-    ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08x, expected E_INVALIDARG\n", hr);
+    ok(hr == E_INVALIDARG, "CoInternetGetSecurityUrlEx returned 0x%08lx, expected E_INVALIDARG\n", hr);
     ok(result == (void*) 0xdeadbeef, "'result' was %p\n", result);
 
     for(i = 0; i < ARRAY_SIZE(sec_url_ex_tests); ++i) {
         uri = NULL;
 
         hr = pCreateUri(sec_url_ex_tests[i].uri, sec_url_ex_tests[i].create_flags, 0, &uri);
-        ok(hr == S_OK, "CreateUri returned 0x%08x on test %d\n", hr, i);
+        ok(hr == S_OK, "CreateUri returned 0x%08lx on test %ld\n", hr, i);
         if(hr == S_OK) {
             result = NULL;
 
             hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_DEFAULT, 0);
             todo_wine_if (sec_url_ex_tests[i].todo) {
                 ok(hr == sec_url_ex_tests[i].default_hres,
-                    "CoInternetGetSecurityUrlEx returned 0x%08x, expected 0x%08x on test %d\n",
+                    "CoInternetGetSecurityUrlEx returned 0x%08lx, expected 0x%08lx on test %ld\n",
                     hr, sec_url_ex_tests[i].default_hres, i);
             }
             if(SUCCEEDED(hr)) {
                 BSTR received;
 
                 hr = IUri_GetDisplayUri(result, &received);
-                ok(hr == S_OK, "GetDisplayUri returned 0x%08x on test %d\n", hr, i);
+                ok(hr == S_OK, "GetDisplayUri returned 0x%08lx on test %ld\n", hr, i);
                 if(hr == S_OK) {
                     todo_wine_if (sec_url_ex_tests[i].todo) {
                         ok(!lstrcmpW(sec_url_ex_tests[i].default_uri, received),
-                            "Expected %s but got %s on test %d\n",
+                            "Expected %s but got %s on test %ld\n",
                             wine_dbgstr_w(sec_url_ex_tests[i].default_uri), wine_dbgstr_w(received), i);
                     }
                 }
@@ -1633,18 +1633,18 @@ static void test_InternetGetSecurityUrlEx(void)
             hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_SECURITY_URL_ONLY, 0);
             todo_wine_if (sec_url_ex_tests[i].todo) {
                 ok(hr == sec_url_ex_tests[i].default_hres,
-                    "CoInternetGetSecurityUrlEx returned 0x%08x, expected 0x%08x on test %d\n",
+                    "CoInternetGetSecurityUrlEx returned 0x%08lx, expected 0x%08lx on test %ld\n",
                     hr, sec_url_ex_tests[i].default_hres, i);
             }
             if(SUCCEEDED(hr)) {
                 BSTR received;
 
                 hr = IUri_GetDisplayUri(result, &received);
-                ok(hr == S_OK, "GetDisplayUri returned 0x%08x on test %d\n", hr, i);
+                ok(hr == S_OK, "GetDisplayUri returned 0x%08lx on test %ld\n", hr, i);
                 if(hr == S_OK) {
                     todo_wine_if (sec_url_ex_tests[i].todo) {
                         ok(!lstrcmpW(sec_url_ex_tests[i].default_uri, received),
-                            "Expected %s but got %s on test %d\n",
+                            "Expected %s but got %s on test %ld\n",
                             wine_dbgstr_w(sec_url_ex_tests[i].default_uri), wine_dbgstr_w(received), i);
                     }
                 }
@@ -1665,14 +1665,14 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
     trace("testing CoInternetGetSecurityUrlEx for pluggable protocols...\n");
 
     hr = pCreateUri(security_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "CreateUri returned 0x%08x\n", hr);
+    ok(hr == S_OK, "CreateUri returned 0x%08lx\n", hr);
     if(hr == S_OK) {
         SET_EXPECT(ParseUrl_SECURITY_URL_input);
         SET_EXPECT(ParseUrl_SECURITY_URL_expected);
         SET_EXPECT(ParseUrl_SECURITY_DOMAIN_expected);
 
         hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_DEFAULT, 0);
-        ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08x, expected S_OK\n", hr);
+        ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08lx, expected S_OK\n", hr);
 
         CHECK_CALLED(ParseUrl_SECURITY_URL_input);
         CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
@@ -1682,7 +1682,7 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
             BSTR received = NULL;
 
             hr = IUri_GetAbsoluteUri(result, &received);
-            ok(hr == S_OK, "GetAbsoluteUri returned 0x%08x\n", hr);
+            ok(hr == S_OK, "GetAbsoluteUri returned 0x%08lx\n", hr);
             if(hr == S_OK) {
                 ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
                     wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
@@ -1697,7 +1697,7 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
         SET_EXPECT(ParseUrl_SECURITY_URL_expected);
 
         hr = pCoInternetGetSecurityUrlEx(uri, &result, PSU_SECURITY_URL_ONLY, 0);
-        ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08x, expected S_OK\n", hr);
+        ok(hr == S_OK, "CoInternetGetSecurityUrlEx returned 0x%08lx, expected S_OK\n", hr);
 
         CHECK_CALLED(ParseUrl_SECURITY_URL_input);
         CHECK_CALLED(ParseUrl_SECURITY_URL_expected);
@@ -1706,7 +1706,7 @@ static void test_InternetGetSecurityUrlEx_Pluggable(void)
             BSTR received = NULL;
 
             hr = IUri_GetAbsoluteUri(result, &received);
-            ok(hr == S_OK, "GetAbsoluteUri returned 0x%08x\n", hr);
+            ok(hr == S_OK, "GetAbsoluteUri returned 0x%08lx\n", hr);
             if(hr == S_OK) {
                 ok(!strcmp_w(security_expectedW, received), "Expected %s but got %s\n",
                     wine_dbgstr_w(security_expectedW), wine_dbgstr_w(received));
@@ -1768,34 +1768,34 @@ static void test_SecurityManagerEx2(void)
     trace("Testing SecurityManagerEx2...\n");
 
     hres = pCoInternetCreateSecurityManager(NULL, &sec_mgr, 0);
-    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08lx\n", hres);
 
     hres = IInternetSecurityManager_QueryInterface(sec_mgr, &IID_IInternetSecurityManagerEx2, (void**)&sec_mgr2);
-    ok(hres == S_OK, "QueryInterface(IID_IInternetSecurityManagerEx2) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IInternetSecurityManagerEx2) failed: %08lx\n", hres);
 
     zone = 0xdeadbeef;
 
     hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, NULL, &zone, 0, NULL, NULL);
-    ok(hres == E_INVALIDARG, "MapUrlToZoneEx2 returned %08x, expected E_INVALIDARG\n", hres);
-    ok(zone == URLZONE_INVALID, "zone was %d\n", zone);
+    ok(hres == E_INVALIDARG, "MapUrlToZoneEx2 returned %08lx, expected E_INVALIDARG\n", hres);
+    ok(zone == URLZONE_INVALID, "zone was %ld\n", zone);
 
     hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, NULL, buf, &buf_size, 0);
-    ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08x, expected E_INVALIDARG\n", hres);
-    ok(buf_size == sizeof(buf), "buf_size was %d\n", buf_size);
+    ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08lx, expected E_INVALIDARG\n", hres);
+    ok(buf_size == sizeof(buf), "buf_size was %ld\n", buf_size);
 
     hres = pCreateUri(url5, 0, 0, &uri);
-    ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
     hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, uri, NULL, 0, NULL, NULL);
-    ok(hres == E_INVALIDARG, "MapToUrlZoneEx2 returned %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "MapToUrlZoneEx2 returned %08lx, expected E_INVALIDARG\n", hres);
 
     buf_size = sizeof(buf);
     hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, NULL, &buf_size, 0);
-    ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityIdEx2 failed: %08x\n", hres);
-    ok(buf_size == sizeof(buf), "bug_size was %d\n", buf_size);
+    ok(hres == E_INVALIDARG || broken(hres == S_OK), "GetSecurityIdEx2 failed: %08lx\n", hres);
+    ok(buf_size == sizeof(buf), "bug_size was %ld\n", buf_size);
 
     hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, NULL, 0);
-    ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "GetSecurityIdEx2 returned %08lx, expected E_INVALIDARG\n", hres);
 
     IUri_Release(uri);
 
@@ -1804,13 +1804,13 @@ static void test_SecurityManagerEx2(void)
         zone = URLZONE_INVALID;
 
         hres = pCreateUri(sec_mgr_ex2_tests[i].uri, sec_mgr_ex2_tests[i].create_flags, 0, &uri);
-        ok(hres == S_OK, "CreateUri returned %08x for '%s'\n", hres, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
+        ok(hres == S_OK, "CreateUri returned %08lx for '%s'\n", hres, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
 
         hres = IInternetSecurityManagerEx2_MapUrlToZoneEx2(sec_mgr2, uri, &zone, 0, NULL, NULL);
         todo_wine_if (sec_mgr_ex2_tests[i].map_todo) {
-            ok(hres == sec_mgr_ex2_tests[i].map_hres, "MapUrlToZoneEx2 returned %08x, expected %08x for '%s'\n",
+            ok(hres == sec_mgr_ex2_tests[i].map_hres, "MapUrlToZoneEx2 returned %08lx, expected %08lx for '%s'\n",
                 hres, sec_mgr_ex2_tests[i].map_hres, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
-            ok(zone == sec_mgr_ex2_tests[i].zone, "Expected zone %d, but got %d for '%s'\n", sec_mgr_ex2_tests[i].zone,
+            ok(zone == sec_mgr_ex2_tests[i].zone, "Expected zone %ld, but got %ld for '%s'\n", sec_mgr_ex2_tests[i].zone,
                 zone, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
         }
 
@@ -1819,10 +1819,10 @@ static void test_SecurityManagerEx2(void)
 
         hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, 0);
         todo_wine_if (sec_mgr_ex2_tests[i].secid_todo) {
-            ok(hres == sec_mgr_ex2_tests[i].secid_hres, "GetSecurityIdEx2 returned %08x, expected %08x on test '%s'\n",
+            ok(hres == sec_mgr_ex2_tests[i].secid_hres, "GetSecurityIdEx2 returned %08lx, expected %08lx on test '%s'\n",
                 hres, sec_mgr_ex2_tests[i].secid_hres, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
             if(sec_mgr_ex2_tests[i].secid) {
-                ok(buf_size == sec_mgr_ex2_tests[i].secid_size, "Got wrong security id size=%d, expected %d on test '%s'\n",
+                ok(buf_size == sec_mgr_ex2_tests[i].secid_size, "Got wrong security id size=%ld, expected %ld on test '%s'\n",
                     buf_size, sec_mgr_ex2_tests[i].secid_size, wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
                 ok(!memcmp(buf, sec_mgr_ex2_tests[i].secid, sec_mgr_ex2_tests[i].secid_size), "Got wrong security id on test '%s'\n",
                     wine_dbgstr_w(sec_mgr_ex2_tests[i].uri));
@@ -1833,22 +1833,22 @@ static void test_SecurityManagerEx2(void)
     }
 
     hres = pCreateUri(url15, 0, 0, &uri);
-    ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
     buf_size = sizeof(buf);
     memset(buf, 0xf0, buf_size);
 
     hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, (DWORD_PTR)domainW);
-    ok(hres == S_OK, "GetSecurityIdEx2 failed: %08x\n", hres);
-    todo_wine ok(buf_size == sizeof(secid13), "buf_size was %d\n", buf_size);
+    ok(hres == S_OK, "GetSecurityIdEx2 failed: %08lx\n", hres);
+    todo_wine ok(buf_size == sizeof(secid13), "buf_size was %ld\n", buf_size);
     todo_wine ok(!memcmp(buf, secid13, sizeof(secid13)), "Got wrong secid\n");
 
     buf_size = sizeof(buf);
     memset(buf, 0xf0, buf_size);
 
     hres = IInternetSecurityManagerEx2_GetSecurityIdEx2(sec_mgr2, uri, buf, &buf_size, 0);
-    ok(hres == S_OK, "GetSecurityIdEx2 failed: %08x\n", hres);
-    ok(buf_size == sizeof(secid13_2), "buf_size was %d\n", buf_size);
+    ok(hres == S_OK, "GetSecurityIdEx2 failed: %08lx\n", hres);
+    ok(buf_size == sizeof(secid13_2), "buf_size was %ld\n", buf_size);
     ok(!memcmp(buf, secid13_2, sizeof(secid13_2)), "Got wrong secid\n");
 
     IUri_Release(uri);
@@ -1889,9 +1889,9 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
 
 
     hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS);
-    ok(SUCCEEDED(hres), "CoInternetIsFeatureEnabled returned %x\n", hres);
+    ok(SUCCEEDED(hres), "CoInternetIsFeatureEnabled returned %lx\n", hres);
 
-    trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%x)\n", hres);
+    trace("Testing CoInternetIsFeatureZoneElevationEnabled... (%lx)\n", hres);
 
     for(i = 0; i < ARRAY_SIZE(testcases); i++) {
         if(hres==S_OK && testcases[i].flags == GET_FEATURE_FROM_PROCESS)
@@ -1915,7 +1915,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
         }
         hres = pCoInternetIsFeatureZoneElevationEnabled(testcases[i].url_from, testcases[i].url_to,
                 &security_manager, testcases[i].flags);
-        ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureZoneElevationEnabled returned %x\n", i, hres);
+        ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureZoneElevationEnabled returned %lx\n", i, hres);
         if(testcases[i].policy_flags != -1)
             CHECK_CALLED(ProcessUrlAction);
 
@@ -1923,7 +1923,7 @@ static void test_CoInternetIsFeatureZoneElevationEnabled(void)
             SET_EXPECT(ProcessUrlAction);
         hres = pCoInternetIsFeatureEnabledForUrl(FEATURE_ZONE_ELEVATION,
                 testcases[i].flags, testcases[i].url_to, &security_manager);
-        ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureEnabledForUrl returned %x\n", i, hres);
+        ok(hres == testcases[i].hres, "%d) CoInternetIsFeatureEnabledForUrl returned %lx\n", i, hres);
         if(testcases[i].policy_flags != -1)
             CHECK_CALLED(ProcessUrlAction);
     }
diff --git a/dlls/urlmon/tests/stream.c b/dlls/urlmon/tests/stream.c
index ef96eb6ea15..a30236386ac 100644
--- a/dlls/urlmon/tests/stream.c
+++ b/dlls/urlmon/tests/stream.c
@@ -167,7 +167,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulP
             ok(szStatusText != NULL, "szStatusText == NULL\n");
             break;
         default:
-            todo_wine { ok(0, "unexpected code %d\n", ulStatusCode); }
+            todo_wine { ok(0, "unexpected code %ld\n", ulStatusCode); }
     };
     return S_OK;
 }
@@ -179,7 +179,7 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallback *iface, HRESUL
     /* ignore DNS failure */
     if (hresult != HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED))
     {
-        ok(SUCCEEDED(hresult), "Download failed: %08x\n", hresult);
+        ok(SUCCEEDED(hresult), "Download failed: %08lx\n", hresult);
         ok(szError == NULL, "szError should be NULL\n");
     }
 
@@ -216,14 +216,14 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR
         if(pformatetc) {
             ok(pformatetc->cfFormat == 0xc02d, "clipformat=%x\n", pformatetc->cfFormat);
             ok(pformatetc->ptd == NULL, "ptd = %p\n", pformatetc->ptd);
-            ok(pformatetc->dwAspect == 1, "dwAspect=%u\n", pformatetc->dwAspect);
-            ok(pformatetc->lindex == -1, "lindex=%d\n", pformatetc->lindex);
-            ok(pformatetc->tymed == TYMED_ISTREAM, "tymed=%u\n", pformatetc->tymed);
+            ok(pformatetc->dwAspect == 1, "dwAspect=%lu\n", pformatetc->dwAspect);
+            ok(pformatetc->lindex == -1, "lindex=%ld\n", pformatetc->lindex);
+            ok(pformatetc->tymed == TYMED_ISTREAM, "tymed=%lu\n", pformatetc->tymed);
         }
 
         ok(pstgmed != NULL, "stgmeg == NULL\n");
         if(pstgmed) {
-            ok(pstgmed->tymed == TYMED_ISTREAM, "tymed=%u\n", pstgmed->tymed);
+            ok(pstgmed->tymed == TYMED_ISTREAM, "tymed=%lu\n", pstgmed->tymed);
             ok(U(*pstgmed).pstm != NULL, "pstm == NULL\n");
             ok(pstgmed->pUnkForRelease != NULL, "pUnkForRelease == NULL\n");
         }
@@ -232,7 +232,7 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWOR
     if(U(*pstgmed).pstm) {
         do hres = IStream_Read(U(*pstgmed).pstm, buf, 512, &read);
         while(hres == S_OK);
-        ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08x\n", hres);
+        ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08lx\n", hres);
     }
 
     return S_OK;
@@ -297,11 +297,11 @@ static void test_URLOpenBlockingStreamW(void)
     char buffer[256];
 
     hr = URLOpenBlockingStreamW(NULL, NULL, &pStream, 0, &BindStatusCallback);
-    ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08lx\n", hr);
     if (0)  /* crashes on Win2k */
     {
         hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, NULL, 0, &BindStatusCallback);
-        ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
+        ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08lx\n", hr);
     }
 
     SET_EXPECT(GetBindInfo);
@@ -314,7 +314,7 @@ static void test_URLOpenBlockingStreamW(void)
     SET_EXPECT(OnStopBinding);
 
     hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, &pStream, 0, &BindStatusCallback);
-    ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08lx\n", hr);
 
     CHECK_CALLED(GetBindInfo);
     todo_wine CHECK_CALLED(QueryInterface_IServiceProvider);
@@ -330,21 +330,21 @@ static void test_URLOpenBlockingStreamW(void)
     {
         buffer[0] = 0;
         hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL);
-        ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr);
+        ok(hr == S_OK, "IStream_Read failed with error 0x%08lx\n", hr);
         ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n");
 
         IStream_Release(pStream);
     }
 
     hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, &pStream, 0, NULL);
-    ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08lx\n", hr);
 
     ok(pStream != NULL, "pStream is NULL\n");
     if(pStream)
     {
         buffer[0] = 0;
         hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL);
-        ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr);
+        ok(hr == S_OK, "IStream_Read failed with error 0x%08lx\n", hr);
         ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n");
 
         IStream_Release(pStream);
@@ -356,7 +356,7 @@ static void test_URLOpenStreamW(void)
     HRESULT hr;
 
     hr = URLOpenStreamW(NULL, NULL, 0, &BindStatusCallback);
-    ok(hr == E_INVALIDARG, "URLOpenStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "URLOpenStreamW should have failed with E_INVALIDARG instead of 0x%08lx\n", hr);
 
     SET_EXPECT(GetBindInfo);
     SET_EXPECT(QueryInterface_IServiceProvider);
@@ -369,7 +369,7 @@ static void test_URLOpenStreamW(void)
     SET_EXPECT(OnStopBinding);
 
     hr = URLOpenStreamW(NULL, INDEX_HTML, 0, &BindStatusCallback);
-    ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08lx\n", hr);
 
     CHECK_CALLED(GetBindInfo);
     todo_wine CHECK_CALLED(QueryInterface_IServiceProvider);
@@ -382,7 +382,7 @@ static void test_URLOpenStreamW(void)
     CHECK_CALLED(OnStopBinding);
 
     hr = URLOpenStreamW(NULL, INDEX_HTML, 0, NULL);
-    ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08lx\n", hr);
 }
 
 START_TEST(stream)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index b161d1f3eec..a3161b8e401 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -7772,7 +7772,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetFragment(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7780,7 +7780,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetHost(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7788,7 +7788,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetPassword(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7796,7 +7796,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetPath(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7804,7 +7804,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetQuery(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7812,7 +7812,7 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetSchemeName(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
@@ -7820,12 +7820,12 @@ static void change_property(IUriBuilder *builder, const uri_builder_property *pr
         hr = IUriBuilder_SetUserName(builder, valueW);
         todo_wine_if(prop->todo) {
             ok(hr == prop->expected,
-                "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_SetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, prop->expected, test_index);
         }
         break;
     default:
-        trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
+        trace("Unsupported operation for %d on uri_builder_tests[%ld].\n", prop->property, test_index);
     }
 
     heap_free(valueW);
@@ -7843,7 +7843,7 @@ static void test_CreateUri_InvalidFlags(void) {
         IUri *uri = (void*) 0xdeadbeef;
 
         hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
-        ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
+        ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx, flags=0x%08lx\n",
                 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
         ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
     }
@@ -7857,20 +7857,20 @@ static void test_CreateUri_InvalidArgs(void) {
     static const WCHAR emptyW[] = {0};
 
     hr = pCreateUri(http_urlW, 0, 0, NULL);
-    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
 
     hr = pCreateUri(NULL, 0, 0, &uri);
-    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
     ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
 
     uri = (void*) 0xdeadbeef;
     hr = pCreateUri(invalidW, 0, 0, &uri);
-    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
 
     uri = (void*) 0xdeadbeef;
     hr = pCreateUri(emptyW, 0, 0, &uri);
-    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
 }
 
@@ -7886,7 +7886,7 @@ static void test_CreateUri_InvalidUri(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.flags, 0, &uri);
         todo_wine_if(test.todo)
-            ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
+            ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on invalid_uri_tests[%ld].\n",
                 hr, E_INVALIDARG, i);
         if(uri) IUri_Release(uri);
 
@@ -7901,16 +7901,16 @@ static void test_IUri_GetPropertyBSTR(void) {
 
     /* Make sure GetPropertyBSTR handles invalid args correctly. */
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         BSTR received = NULL;
 
         hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
-        ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         /* Make sure it handles an invalid Uri_PROPERTY correctly. */
         hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
-        ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
+        ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08lx, expected E_INVALIDARG or S_OK.\n", hr);
         if(SUCCEEDED(hr)) {
             ok(received != NULL, "Error: Expected the string not to be NULL.\n");
             ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
@@ -7922,7 +7922,7 @@ static void test_IUri_GetPropertyBSTR(void) {
         /* Make sure it handles the ZONE property correctly. */
         received = NULL;
         hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
-        ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
+        ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, S_FALSE);
         ok(received != NULL, "Error: Expected the string not to be NULL.\n");
         ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
         SysFreeString(received);
@@ -7937,7 +7937,7 @@ static void test_IUri_GetPropertyBSTR(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
                     hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -7952,11 +7952,11 @@ static void test_IUri_GetPropertyBSTR(void) {
                 todo_wine_if(prop.todo) {
                     ok(hr == prop.expected ||
                        (prop.value2 && hr == prop.expected2),
-                       "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
+                       "GetPropertyBSTR returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].str_props[%ld].\n",
                             hr, prop.expected, i, j);
                     ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
                        broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                            "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
+                            "Expected %s but got %s on uri_tests[%ld].str_props[%ld].\n",
                             prop.value, wine_dbgstr_w(received), i, j);
                 }
 
@@ -7976,16 +7976,16 @@ static void test_IUri_GetPropertyDWORD(void) {
     DWORD i;
 
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         DWORD received = 0xdeadbeef;
 
         hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
-        ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
         hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
-        ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
-        ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
+        ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
+        ok(received == 0, "Error: Expected received=%d but instead received=%ld.\n", 0, received);
     }
     if(uri) IUri_Release(uri);
 
@@ -7997,7 +7997,7 @@ static void test_IUri_GetPropertyDWORD(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
                     hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -8010,9 +8010,9 @@ static void test_IUri_GetPropertyDWORD(void) {
 
                 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
                 todo_wine_if(prop.todo) {
-                    ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
+                    ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].dword_props[%ld].\n",
                             hr, prop.expected, i, j);
-                    ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
+                    ok(prop.value == received, "Expected %ld but got %ld on uri_tests[%ld].dword_props[%ld].\n",
                             prop.value, received, i, j);
                 }
             }
@@ -8032,52 +8032,52 @@ static void test_IUri_GetStrProperties(void) {
 
     /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         hr = IUri_GetAbsoluteUri(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetAuthority(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetDisplayUri(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetDomain(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetDomain returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetExtension(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetExtension returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetFragment(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetHost(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetPassword(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetPassword returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetPath(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetPath returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetPathAndQuery(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetQuery(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetRawUri(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetSchemeName(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetUserInfo(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         hr = IUri_GetUserName(uri, NULL);
-        ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: GetUserName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
     }
     if(uri) IUri_Release(uri);
 
@@ -8089,7 +8089,7 @@ static void test_IUri_GetStrProperties(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                     hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -8100,10 +8100,10 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
             hr = IUri_GetAbsoluteUri(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
                 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                        "Error: Expected %s but got %s on uri_tests[%d].\n",
+                        "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8113,9 +8113,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_AUTHORITY];
             hr = IUri_GetAuthority(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8125,10 +8125,10 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
             hr = IUri_GetDisplayUri(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
                 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                        "Error: Expected %s but got %s on uri_tests[%d].\n",
+                        "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8139,10 +8139,10 @@ static void test_IUri_GetStrProperties(void) {
             hr = IUri_GetDomain(uri, &received);
             todo_wine_if(prop.todo) {
                 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
-                   "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                   "Error: GetDomain returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
                 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
-                   "Error: Expected %s but got %s on uri_tests[%d].\n",
+                   "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8152,9 +8152,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_EXTENSION];
             hr = IUri_GetExtension(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetExtension returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8164,9 +8164,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_FRAGMENT];
             hr = IUri_GetFragment(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetFragment returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8176,9 +8176,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_HOST];
             hr = IUri_GetHost(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetHost returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8188,9 +8188,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_PASSWORD];
             hr = IUri_GetPassword(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetPassword returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8200,9 +8200,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_PATH];
             hr = IUri_GetPath(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetPath returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8212,9 +8212,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
             hr = IUri_GetPathAndQuery(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8224,9 +8224,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_QUERY];
             hr = IUri_GetQuery(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8236,9 +8236,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_RAW_URI];
             hr = IUri_GetRawUri(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8248,9 +8248,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
             hr = IUri_GetSchemeName(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8260,9 +8260,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_USER_INFO];
             hr = IUri_GetUserInfo(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8272,9 +8272,9 @@ static void test_IUri_GetStrProperties(void) {
             prop = test.str_props[Uri_PROPERTY_USER_NAME];
             hr = IUri_GetUserName(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetUserName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
+                ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
                         prop.value, wine_dbgstr_w(received), i);
             }
             SysFreeString(received);
@@ -8293,19 +8293,19 @@ static void test_IUri_GetDwordProperties(void) {
 
     /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         hr = IUri_GetHostType(uri, NULL);
-        ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
         hr = IUri_GetPort(uri, NULL);
-        ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
         hr = IUri_GetScheme(uri, NULL);
-        ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
         hr = IUri_GetZone(uri, NULL);
-        ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     }
     if(uri) IUri_Release(uri);
 
@@ -8317,7 +8317,7 @@ static void test_IUri_GetDwordProperties(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                     hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -8333,9 +8333,9 @@ static void test_IUri_GetDwordProperties(void) {
             prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
             hr = IUri_GetHostType(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetHostType returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
+                ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
             }
             received = -9999999;
 
@@ -8343,9 +8343,9 @@ static void test_IUri_GetDwordProperties(void) {
             prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
             hr = IUri_GetPort(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetPort returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
+                ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
             }
             received = -9999999;
 
@@ -8353,9 +8353,9 @@ static void test_IUri_GetDwordProperties(void) {
             prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
             hr = IUri_GetScheme(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetScheme returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
+                ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
             }
             received = -9999999;
 
@@ -8363,9 +8363,9 @@ static void test_IUri_GetDwordProperties(void) {
             prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
             hr = IUri_GetZone(uri, &received);
             todo_wine_if(prop.todo) {
-                ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
+                ok(hr == prop.expected, "Error: GetZone returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
                         hr, prop.expected, i);
-                ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
+                ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
             }
         }
 
@@ -8382,16 +8382,16 @@ static void test_IUri_GetPropertyLength(void) {
 
     /* Make sure it handles invalid args correctly. */
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         DWORD received = 0xdeadbeef;
 
         hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
-        ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
         hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
-        ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
-        ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
+        ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
+        ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08lx.\n", received);
     }
     if(uri) IUri_Release(uri);
 
@@ -8403,7 +8403,7 @@ static void test_IUri_GetPropertyLength(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_test[%ld].\n",
                     hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -8426,11 +8426,11 @@ static void test_IUri_GetPropertyLength(void) {
                 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
                 todo_wine_if(prop.todo) {
                     ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
-                       "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
+                       "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].str_props[%ld].\n",
                             hr, prop.expected, i, j);
                     ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
                        broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
-                            "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
+                            "Error: Expected a length of %ld but got %ld on uri_tests[%ld].str_props[%ld].\n",
                             expectedLen, receivedLen, i, j);
                 }
             }
@@ -8472,10 +8472,10 @@ static void test_IUri_GetProperties(void) {
     DWORD i;
 
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         hr = IUri_GetProperties(uri, NULL);
-        ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     }
     if(uri) IUri_Release(uri);
 
@@ -8487,14 +8487,14 @@ static void test_IUri_GetProperties(void) {
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
 
         if(SUCCEEDED(hr)) {
             DWORD received = 0, expected_props, mask;
             DWORD j;
 
             hr = IUri_GetProperties(uri, &received);
-            ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             expected_props = compute_expected_props(&test, &mask);
 
@@ -8502,9 +8502,9 @@ static void test_IUri_GetProperties(void) {
                 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
                 if(mask & (1 << j)) {
                     if(expected_props & (1 << j))
-                        ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
+                        ok(received & (1 << j), "Error: Expected flag for property %ld on uri_tests[%ld].\n", j, i);
                     else
-                        ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
+                        ok(!(received & (1 << j)), "Error: Received flag for property %ld when not expected on uri_tests[%ld].\n", j, i);
                 }
             }
         }
@@ -8521,10 +8521,10 @@ static void test_IUri_HasProperty(void) {
     DWORD i;
 
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
-        ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     }
     if(uri) IUri_Release(uri);
 
@@ -8537,7 +8537,7 @@ static void test_IUri_HasProperty(void) {
 
         hr = pCreateUri(uriW, test.create_flags, 0, &uri);
         todo_wine_if(test.create_todo)
-            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
+            ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
 
         if(SUCCEEDED(hr)) {
             DWORD expected_props, j, mask;
@@ -8549,14 +8549,14 @@ static void test_IUri_HasProperty(void) {
                 BOOL received = -1;
 
                 hr = IUri_HasProperty(uri, j, &received);
-                ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
+                ok(hr == S_OK, "Error: HasProperty returned 0x%08lx, expected 0x%08lx for property %ld on uri_tests[%ld].\n",
                         hr, S_OK, j, i);
 
                 if(mask & (1 << j)) {
                     if(expected_props & (1 << j)) {
-                        ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
+                        ok(received == TRUE, "Error: Expected to have property %ld on uri_tests[%ld].\n", j, i);
                     } else {
-                        ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
+                        ok(received == FALSE, "Error: Wasn't expecting to have property %ld on uri_tests[%ld].\n", j, i);
                     }
                 }
             }
@@ -8796,26 +8796,26 @@ static void test_IUri_IsEqual(void) {
 
     /* Make sure IsEqual handles invalid args correctly. */
     hres = pCreateUri(http_urlW, 0, 0, &uriA);
-    ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
+    ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
     hres = pCreateUri(http_urlW, 0, 0, &uriB);
-    ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
+    ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
 
     equal = -1;
     hres = IUri_IsEqual(uriA, NULL, &equal);
-    ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
+    ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
     ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
 
     hres = IUri_IsEqual(uriA, uriB, NULL);
-    ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
+    ok(hres == E_POINTER, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, E_POINTER);
 
     equal = FALSE;
     hres = IUri_IsEqual(uriA, uriA, &equal);
-    ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
+    ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
     ok(equal, "Error: Expected equal URIs.\n");
 
     equal = FALSE;
     hres = IUri_IsEqual(uriA, uriB, &equal);
-    ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
+    ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
     ok(equal, "Error: Expected equal URIs.\n");
 
     IUri_Release(uriA);
@@ -8833,16 +8833,16 @@ static void test_IUri_IsEqual(void) {
         uriB_W = a2w(test.b);
 
         hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
-        ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
+        ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].a\n", hres, S_OK, i);
 
         hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
-        ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
+        ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].b\n", hres, S_OK, i);
 
         equal = -1;
         hres = IUri_IsEqual(uriA, uriB, &equal);
         todo_wine_if(test.todo) {
-            ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
-            ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
+            ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
+            ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
         }
 
         custom_uri.uri = uriB;
@@ -8850,8 +8850,8 @@ static void test_IUri_IsEqual(void) {
         equal = -1;
         hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal);
         todo_wine {
-            ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
-            ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
+            ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
+            ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
         }
 
         if(uriA) IUri_Release(uriA);
@@ -8868,16 +8868,16 @@ static void test_CreateUriWithFragment_InvalidArgs(void) {
     const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
 
     hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
-    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
 
     hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
-    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
     /* Original URI can't already contain a fragment component. */
     uri = (void*) 0xdeadbeef;
     hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
-    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
     ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
 }
 
@@ -8890,7 +8890,7 @@ static void test_CreateUriWithFragment_InvalidFlags(void) {
         IUri *uri = (void*) 0xdeadbeef;
 
         hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
-        ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
+        ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx. flags=0x%08lx.\n",
             hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
         ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
     }
@@ -8911,7 +8911,7 @@ static void test_CreateUriWithFragment(void) {
         hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
         todo_wine_if(test.expected_todo)
             ok(hr == test.create_expected,
-                "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
+                "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
                 hr, test.create_expected, i);
 
         if(SUCCEEDED(hr)) {
@@ -8919,9 +8919,9 @@ static void test_CreateUriWithFragment(void) {
 
             hr = IUri_GetAbsoluteUri(uri, &received);
             todo_wine_if(test.expected_todo) {
-                ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
+                ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
                     hr, S_OK, i);
-                ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
+                ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%ld].\n",
                     test.expected_uri, wine_dbgstr_w(received), i);
             }
 
@@ -8940,26 +8940,26 @@ static void test_CreateIUriBuilder(void) {
     IUri *uri;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
-    ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
+    ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx\n",
         hr, E_POINTER);
 
     /* CreateIUriBuilder increases the ref count of the IUri it receives. */
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         ULONG cur_count, orig_count;
 
         orig_count = get_refcnt(uri);
         hr = pCreateIUriBuilder(uri, 0, 0, &builder);
-        ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
         ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
 
         cur_count = get_refcnt(uri);
-        ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
+        ok(cur_count == orig_count+1, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count+1, cur_count);
 
         if(builder) IUriBuilder_Release(builder);
         cur_count = get_refcnt(uri);
-        ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
+        ok(cur_count == orig_count, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count, cur_count);
     }
     if(uri) IUri_Release(uri);
 }
@@ -8972,7 +8972,7 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t
     hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
     todo_wine_if(test->uri_todo)
         ok(hr == test->uri_hres,
-            "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, test->uri_hres, test_index);
 
     if(SUCCEEDED(hr)) {
@@ -8985,12 +8985,12 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t
             hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
+                    "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(!strcmp_aw(prop.expected, received),
-                        "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
+                        "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                         prop.expected, wine_dbgstr_w(received), test_index, i);
             }
             SysFreeString(received);
@@ -9003,12 +9003,12 @@ static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_t
             hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                    "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(received == prop.expected,
-                        "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                        "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                         prop.expected, received, test_index, i);
             }
         }
@@ -9024,7 +9024,7 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui
     hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
     todo_wine_if(test->uri_simple_todo)
         ok(hr == test->uri_simple_hres,
-            "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, test->uri_simple_hres, test_index);
 
     if(SUCCEEDED(hr)) {
@@ -9037,12 +9037,12 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui
             hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
+                    "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(!strcmp_aw(prop.expected, received),
-                        "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
+                        "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                         prop.expected, wine_dbgstr_w(received), test_index, i);
             }
             SysFreeString(received);
@@ -9055,12 +9055,12 @@ static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_bui
             hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                    "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(received == prop.expected,
-                        "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                        "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                         prop.expected, received, test_index, i);
             }
         }
@@ -9077,7 +9077,7 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_
                                         test->uri_with_encode_flags, 0, &uri);
     todo_wine_if(test->uri_with_todo)
         ok(hr == test->uri_with_hres,
-            "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, test->uri_with_hres, test_index);
 
     if(SUCCEEDED(hr)) {
@@ -9090,12 +9090,12 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_
             hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
+                    "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(!strcmp_aw(prop.expected, received),
-                        "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
+                        "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
                         prop.expected, wine_dbgstr_w(received), test_index, i);
             }
             SysFreeString(received);
@@ -9108,12 +9108,12 @@ static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_
             hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
             todo_wine_if(prop.todo)
                 ok(hr == prop.result,
-                    "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                    "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                     hr, prop.result, test_index, i);
             if(SUCCEEDED(hr)) {
                 todo_wine_if(prop.todo)
                     ok(received == prop.expected,
-                        "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
+                        "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
                         prop.expected, received, test_index, i);
             }
         }
@@ -9126,84 +9126,84 @@ static void test_IUriBuilder_CreateInvalidArgs(void) {
     HRESULT hr;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
-    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         IUri *test = NULL, *uri = (void*) 0xdeadbeef;
 
         /* Test what happens if the IUriBuilder doesn't have a IUri set. */
         hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
+        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
 
         uri = (void*) 0xdeadbeef;
         hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
-        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
+        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_NOTIMPL);
         ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
 
         hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
 
         uri = (void*) 0xdeadbeef;
         hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
-        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_NOTIMPL);
         ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
 
         hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
 
         uri = (void*) 0xdeadbeef;
         hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
-        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_NOTIMPL);
         ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
 
         hr = pCreateUri(http_urlW, 0, 0, &test);
-        ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
         if(SUCCEEDED(hr)) {
             hr = IUriBuilder_SetIUri(builder, test);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
             uri = NULL;
             hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             ok(uri != NULL, "Error: The uri was NULL.\n");
             if(uri) IUri_Release(uri);
 
             uri = NULL;
             hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             ok(uri != NULL, "Error: uri was NULL.\n");
             if(uri) IUri_Release(uri);
 
             uri = NULL;
             hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             ok(uri != NULL, "Error: uri was NULL.\n");
             if(uri) IUri_Release(uri);
 
             hr = IUriBuilder_SetFragment(builder, NULL);
-            ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
             uri = (void*) 0xdeadbeef;
             hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
-            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
 
             uri = (void*) 0xdeadbeef;
             hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
-            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
 
             uri = (void*) 0xdeadbeef;
             hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
-            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_NOTIMPL);
             ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
         }
@@ -9218,119 +9218,119 @@ static void test_IUriBuilder_GetInvalidArgs(void) {
     HRESULT hr;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
-    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         LPCWSTR received = (void*) 0xdeadbeef;
         DWORD len = -1, port = -1;
         BOOL set = -1;
 
         hr = IUriBuilder_GetFragment(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         hr = IUriBuilder_GetFragment(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         hr = IUriBuilder_GetFragment(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetHost(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetHost(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetHost(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetPassword(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetPassword(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetPassword(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetPath(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetPath(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetPath(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetPort(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         hr = IUriBuilder_GetPort(builder, NULL, &port);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
+        ok(!port, "Error: Expected port to be 0, but was %ld instead.\n", port);
         hr = IUriBuilder_GetPort(builder, &set, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
 
         hr = IUriBuilder_GetQuery(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetQuery(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetQuery(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
 
         hr = IUriBuilder_GetUserName(builder, NULL, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         received = (void*) 0xdeadbeef;
         hr = IUriBuilder_GetUserName(builder, NULL, &received);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
         ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
         len = -1;
         hr = IUriBuilder_GetUserName(builder, &len, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
-        ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
+        ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
     }
     if(builder) IUriBuilder_Release(builder);
 }
@@ -9356,13 +9356,13 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
         hr = IUriBuilder_GetFragment(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9373,7 +9373,7 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9382,12 +9382,12 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
 
                 hr = IUriBuilder_GetFragment(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9396,30 +9396,30 @@ static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder
 
                 hr = IUri_GetFragment(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetFragment to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetFragment(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9451,13 +9451,13 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
         hr = IUriBuilder_GetHost(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9468,7 +9468,7 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9477,12 +9477,12 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
 
                 hr = IUriBuilder_GetHost(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9491,30 +9491,30 @@ static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_tes
 
                 hr = IUri_GetHost(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetHost to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetHost(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9546,13 +9546,13 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
         hr = IUriBuilder_GetPassword(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9563,7 +9563,7 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9572,12 +9572,12 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
 
                 hr = IUriBuilder_GetPassword(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9586,30 +9586,30 @@ static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder
 
                 hr = IUri_GetPassword(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetPassword to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetPassword(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9641,13 +9641,13 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
         hr = IUriBuilder_GetPath(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9658,7 +9658,7 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9667,12 +9667,12 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
 
                 hr = IUriBuilder_GetPath(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9681,30 +9681,30 @@ static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_tes
 
                 hr = IUri_GetPath(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetPath to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetPath(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9725,14 +9725,14 @@ static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_tes
         hr = IUriBuilder_GetPort(builder, &has_port, &received);
         todo_wine_if(test->port_prop.todo) {
             ok(hr == S_OK,
-                "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, S_OK, test_index);
             if(SUCCEEDED(hr)) {
                 ok(has_port == test->port_prop.set,
-                   "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%ld].\n",
                    test->port_prop.set, has_port, test_index);
                 ok(received == test->port_prop.value,
-                   "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected port to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    test->port_prop.value, received, test_index);
             }
         }
@@ -9741,19 +9741,19 @@ static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_tes
 
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
                 hr = IUriBuilder_GetPort(builder, &has_port, &received);
                 ok(hr == S_OK,
-                    "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_OK, test_index);
                 if(SUCCEEDED(hr)) {
                     ok(has_port == FALSE,
-                        "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
+                        "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%ld].\n",
                         has_port, test_index);
-                    ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9761,19 +9761,19 @@ static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_tes
 
                 hr = IUri_GetPort(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_Port to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
 
                 hr = IUriBuilder_GetPort(builder, &has_port, &received);
                 ok(hr == S_OK,
-                    "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_OK, test_index);
                 if(SUCCEEDED(hr)) {
                     ok(!has_port,
-                        "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
+                        "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%ld].\n",
                         test_index);
                     ok(received == expected,
-                        "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                        "Error: Expected received to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                         expected, received, test_index);
                 }
             }
@@ -9803,13 +9803,13 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
         hr = IUriBuilder_GetQuery(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9820,7 +9820,7 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9829,12 +9829,12 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
 
                 hr = IUriBuilder_GetQuery(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9843,30 +9843,30 @@ static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_te
 
                 hr = IUri_GetQuery(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetQuery to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetQuery(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9898,13 +9898,13 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
         hr = IUriBuilder_GetSchemeName(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -9915,7 +9915,7 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -9924,12 +9924,12 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
 
                 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -9938,30 +9938,30 @@ static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_build
 
                 hr = IUri_GetSchemeName(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -9993,13 +9993,13 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
         hr = IUriBuilder_GetUserName(builder, &len, &received);
         todo_wine_if(prop->todo) {
             ok(hr == (expected ? S_OK : S_FALSE),
-                "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, (expected ? S_OK : S_FALSE), test_index);
             if(SUCCEEDED(hr)) {
-                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
+                ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
                    expected, wine_dbgstr_w(received), test_index);
                 ok(expected_len == len,
-                   "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                   "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
                    expected_len, len, test_index);
             }
         }
@@ -10010,7 +10010,7 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
         IUri *uri = NULL;
         hr = IUriBuilder_GetIUri(builder, &uri);
         ok(hr == S_OK,
-            "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
             hr, S_OK, test_index);
         if(SUCCEEDED(hr)) {
             if(!uri) {
@@ -10019,12 +10019,12 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
 
                 hr = IUriBuilder_GetUserName(builder, &len, &received);
                 ok(hr == S_FALSE,
-                    "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                    "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                     hr, S_FALSE, test_index);
                 if(SUCCEEDED(hr)) {
-                    ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                    ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                         len, test_index);
-                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
+                    ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
                         received, test_index);
                 }
             } else {
@@ -10033,30 +10033,30 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
 
                 hr = IUri_GetUserName(uri, &expected);
                 ok(SUCCEEDED(hr),
-                    "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
+                    "Error: Expected IUri_GetUserName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
                     hr, test_index);
                 has_prop = hr == S_OK;
 
                 hr = IUriBuilder_GetUserName(builder, &len, &received);
                 if(has_prop) {
                     ok(hr == S_OK,
-                        "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_OK, test_index);
                     if(SUCCEEDED(hr)) {
                         ok(!lstrcmpW(expected, received),
-                            "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
+                            "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
                             wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
                         ok(lstrlenW(expected) == len,
-                            "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
+                            "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
                             lstrlenW(expected), len, test_index);
                     }
                 } else {
                     ok(hr == S_FALSE,
-                        "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, S_FALSE, test_index);
                     if(SUCCEEDED(hr)) {
-                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
-                        ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
+                        ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
+                        ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
                             len, test_index);
                     }
                 }
@@ -10081,14 +10081,14 @@ static void test_IUriBuilder(void) {
         if(test.uri) {
             uriW = a2w(test.uri);
             hr = pCreateUri(uriW, test.create_flags, 0, &uri);
-            ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+            ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, S_OK, i);
             if(FAILED(hr)) continue;
         }
         hr = pCreateIUriBuilder(uri, 0, 0, &builder);
         todo_wine_if(test.create_builder_todo)
             ok(hr == test.create_builder_expected,
-                "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, test.create_builder_expected, i);
         if(SUCCEEDED(hr)) {
             DWORD j;
@@ -10115,17 +10115,17 @@ static void test_IUriBuilder(void) {
                 modified = TRUE;
                 todo_wine_if(test.port_prop.todo)
                     ok(hr == test.port_prop.expected,
-                        "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                        "Error: IUriBuilder_SetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                         hr, test.port_prop.expected, i);
             }
 
             hr = IUriBuilder_HasBeenModified(builder, &received);
             ok(hr == S_OK,
-                "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
+                "Error IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
                 hr, S_OK, i);
             if(SUCCEEDED(hr))
                 ok(received == modified,
-                    "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
+                    "Error: Expected received to be %d but was %d instead on uri_builder_tests[%ld].\n",
                     modified, received, i);
 
             /* Test the "Get*" functions. */
@@ -10153,98 +10153,98 @@ static void test_IUriBuilder_HasBeenModified(void) {
     IUriBuilder *builder = NULL;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
-    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
         IUri *uri = NULL;
         BOOL received;
 
         hr = IUriBuilder_HasBeenModified(builder, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
 
         hr = IUriBuilder_SetHost(builder, hostW);
-        ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n",
             hr, S_OK);
 
         hr = IUriBuilder_HasBeenModified(builder, &received);
-        ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
             hr, S_OK);
         if(SUCCEEDED(hr))
             ok(received == TRUE, "Error: Expected received to be TRUE.\n");
 
         hr = pCreateUri(http_urlW, 0, 0, &uri);
-        ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
         if(SUCCEEDED(hr)) {
             LPCWSTR prop;
             DWORD len = -1;
 
             hr = IUriBuilder_SetIUri(builder, uri);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
 
             hr = IUriBuilder_HasBeenModified(builder, &received);
-            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
 
             /* Test what happens with you call SetIUri with the same IUri again. */
             hr = IUriBuilder_SetHost(builder, hostW);
-            ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             hr = IUriBuilder_HasBeenModified(builder, &received);
-            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
 
             hr = IUriBuilder_SetIUri(builder, uri);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
              * reset any of the changes that were made to the IUriBuilder.
              */
             hr = IUriBuilder_HasBeenModified(builder, &received);
-            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
 
             hr = IUriBuilder_GetHost(builder, &len, &prop);
-            ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
                     wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
-                ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
+                ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %ld instead.\n",
                     lstrlenW(hostW), len);
             }
 
             hr = IUriBuilder_SetIUri(builder, NULL);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             hr = IUriBuilder_SetHost(builder, hostW);
-            ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             hr = IUriBuilder_HasBeenModified(builder, &received);
-            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
 
             hr = IUriBuilder_SetIUri(builder, NULL);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%09lx.\n", hr, S_OK);
 
             hr = IUriBuilder_HasBeenModified(builder, &received);
-            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
 
             hr = IUriBuilder_GetHost(builder, &len, &prop);
-            ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
                     wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
-                ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
+                ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %ld instead.\n",
                     lstrlenW(hostW), len);
             }
         }
@@ -10259,12 +10259,12 @@ static void test_IUriBuilder_IUriProperty(void) {
     HRESULT hr;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
-    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         IUri *uri = NULL;
 
         hr = IUriBuilder_GetIUri(builder, NULL);
-        ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
 
         hr = pCreateUri(http_urlW, 0, 0, &uri);
@@ -10277,25 +10277,25 @@ static void test_IUriBuilder_IUriProperty(void) {
             hr = IUriBuilder_SetIUri(builder, uri);
             cur_count = get_refcnt(uri);
             if(SUCCEEDED(hr))
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
 
             hr = IUriBuilder_SetIUri(builder, NULL);
             cur_count = get_refcnt(uri);
             if(SUCCEEDED(hr))
-                ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count, cur_count);
 
             /* CreateUri* functions will return back the same IUri if nothing has changed. */
             hr = IUriBuilder_SetIUri(builder, uri);
-            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             orig_count = get_refcnt(uri);
 
             hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
                     uri, test);
@@ -10304,10 +10304,10 @@ static void test_IUriBuilder_IUriProperty(void) {
 
             test = NULL;
             hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
             }
@@ -10318,7 +10318,7 @@ static void test_IUriBuilder_IUriProperty(void) {
              */
             test = NULL;
             hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
 
@@ -10329,10 +10329,10 @@ static void test_IUriBuilder_IUriProperty(void) {
              */
             test = NULL;
             hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
             }
@@ -10340,10 +10340,10 @@ static void test_IUriBuilder_IUriProperty(void) {
 
             test = NULL;
             hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
             }
@@ -10351,11 +10351,11 @@ static void test_IUriBuilder_IUriProperty(void) {
 
             test = NULL;
             hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
             }
@@ -10366,7 +10366,7 @@ static void test_IUriBuilder_IUriProperty(void) {
              */
             test = NULL;
             hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr))
                 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
 
@@ -10377,10 +10377,10 @@ static void test_IUriBuilder_IUriProperty(void) {
              */
             test = NULL;
             hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
-            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 cur_count = get_refcnt(uri);
-                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
+                ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
                     orig_count+1, cur_count);
                 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
             }
@@ -10397,7 +10397,7 @@ static void test_IUriBuilder_RemoveProperties(void) {
     DWORD i;
 
     hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
-    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+    ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
     if(SUCCEEDED(hr)) {
         /* Properties that can't be removed. */
         const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
@@ -10407,11 +10407,11 @@ static void test_IUriBuilder_RemoveProperties(void) {
             hr = IUriBuilder_RemoveProperties(builder, i << 1);
             if((i << 1) & invalid) {
                 ok(hr == E_INVALIDARG,
-                    "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
+                    "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
                     hr, E_INVALIDARG, i);
             } else {
                 ok(hr == S_OK,
-                    "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
+                    "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
                     hr, S_OK, i);
             }
         }
@@ -10420,7 +10420,7 @@ static void test_IUriBuilder_RemoveProperties(void) {
          * Uri_HAS flags.
          */
         hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
-        ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_INVALIDARG);
     }
     if(builder) IUriBuilder_Release(builder);
@@ -10438,14 +10438,14 @@ static void test_IUriBuilder_RemoveProperties(void) {
             hr = pCreateIUriBuilder(uri, 0, 0, &builder);
             todo_wine_if(test.create_builder_todo)
                 ok(hr == test.create_builder_expected,
-                    "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
+                    "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
                     hr, test.create_builder_expected, i);
 
             if(SUCCEEDED(hr)) {
                 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
                 todo_wine_if(test.remove_todo)
                     ok(hr == test.remove_expected,
-                        "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
+                        "Error: IUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
                         hr, test.remove_expected, i);
                 if(SUCCEEDED(hr)) {
                     IUri *result = NULL;
@@ -10453,15 +10453,15 @@ static void test_IUriBuilder_RemoveProperties(void) {
                     hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
                     todo_wine_if(test.expected_todo)
                         ok(hr == test.expected_hres,
-                            "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
+                            "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on test %ld.\n",
                             hr, test.expected_hres, i);
                     if(SUCCEEDED(hr)) {
                         BSTR received = NULL;
 
                         hr = IUri_GetAbsoluteUri(result, &received);
-                        ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
+                        ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
                         ok(!strcmp_aw(test.expected_uri, received),
-                            "Error: Expected %s but got %s instead on test %d.\n",
+                            "Error: Expected %s but got %s instead on test %ld.\n",
                             test.expected_uri, wine_dbgstr_w(received), i);
                         SysFreeString(received);
                     }
@@ -10484,18 +10484,18 @@ static void test_IUriBuilder_Misc(void) {
         IUriBuilder *builder;
 
         hr = pCreateIUriBuilder(uri, 0, 0, &builder);
-        ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
         if(SUCCEEDED(hr)) {
             BOOL has = -1;
             DWORD port = -1;
 
             hr = IUriBuilder_GetPort(builder, &has, &port);
-            ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
             if(SUCCEEDED(hr)) {
                 /* 'has' will be set to FALSE, even though uri had a port. */
                 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
                 /* Still sets 'port' to 80. */
-                ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
+                ok(port == 80, "Error: Expected the port to be 80, but, was %ld instead.\n", port);
             }
         }
         if(builder) IUriBuilder_Release(builder);
@@ -10510,33 +10510,33 @@ static void test_IUriBuilderFactory(void) {
     IUriBuilder *builder;
 
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         factory = NULL;
         hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
-        ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
+        ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx.\n", hr);
         ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
 
         if(SUCCEEDED(hr)) {
             builder = (void*) 0xdeadbeef;
             hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
-            ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_INVALIDARG);
             ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
 
             builder = (void*) 0xdeadbeef;
             hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
-            ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_INVALIDARG);
             ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
 
             hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
-            ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_POINTER);
 
             builder = NULL;
             hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
-            ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr)) {
                 IUri *tmp = (void*) 0xdeadbeef;
@@ -10544,41 +10544,41 @@ static void test_IUriBuilderFactory(void) {
                 DWORD result_len;
 
                 hr = IUriBuilder_GetIUri(builder, &tmp);
-                ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
+                ok(hr == S_OK, "Error: GetIUri returned 0x%08lx, expected 0x%08lx.\n",
                     hr, S_OK);
                 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
 
                 hr = IUriBuilder_GetHost(builder, &result_len, &result);
-                ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
+                ok(hr == S_FALSE, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n",
                     hr, S_FALSE);
             }
             if(builder) IUriBuilder_Release(builder);
 
             builder = (void*) 0xdeadbeef;
             hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
-            ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_INVALIDARG);
             ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
 
             builder = (void*) 0xdeadbeef;
             hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
-            ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_INVALIDARG);
             ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
 
             hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
-            ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, E_POINTER);
 
             builder = NULL;
             hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
-            ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
+            ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
                 hr, S_OK);
             if(SUCCEEDED(hr)) {
                 IUri *tmp = NULL;
 
                 hr = IUriBuilder_GetIUri(builder, &tmp);
-                ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
+                ok(hr == S_OK, "Error: GetIUri return 0x%08lx, expected 0x%08lx.\n",
                     hr, S_OK);
                 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
                 if(tmp) IUri_Release(tmp);
@@ -10597,26 +10597,26 @@ static void test_CoInternetCombineIUri(void) {
 
     base = NULL;
     hr = pCreateUri(http_urlW, 0, 0, &base);
-    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         result = (void*) 0xdeadbeef;
         hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
-        ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
         ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
     }
 
     relative = NULL;
     hr = pCreateUri(http_urlW, 0, 0, &relative);
-    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         result = (void*) 0xdeadbeef;
         hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
-        ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+        ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
         ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
     }
 
     hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
-    ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
 
     if(base) IUri_Release(base);
     if(relative) IUri_Release(relative);
@@ -10625,12 +10625,12 @@ static void test_CoInternetCombineIUri(void) {
         LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
 
         hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
-        ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
+        ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
         if(SUCCEEDED(hr)) {
             LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
 
             hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
-            ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
+            ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
             if(SUCCEEDED(hr)) {
                 result = NULL;
 
@@ -10638,7 +10638,7 @@ static void test_CoInternetCombineIUri(void) {
                 todo_wine_if(uri_combine_tests[i].todo)
                     ok(hr == uri_combine_tests[i].expected ||
                        broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
-                        "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
+                        "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
                         hr, uri_combine_tests[i]. expected, i);
                 if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
                     DWORD j;
@@ -10650,11 +10650,11 @@ static void test_CoInternetCombineIUri(void) {
                         hr = IUri_GetPropertyBSTR(result, j, &received, 0);
                         todo_wine_if(prop.todo) {
                             ok(hr == prop.expected,
-                                "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
+                                "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
                                 hr, prop.expected, i, j);
                             ok(!strcmp_aw(prop.value, received) ||
                                broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                                "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                                "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
                                 prop.value, wine_dbgstr_w(received), i, j);
                         }
                         SysFreeString(received);
@@ -10667,10 +10667,10 @@ static void test_CoInternetCombineIUri(void) {
                         hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
                         todo_wine_if(prop.todo) {
                             ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
-                                "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
+                                "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
                                 hr, prop.expected, i, j);
                             if(!prop.broken_combine_hres || hr != S_FALSE)
-                                ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
+                                ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
                                     prop.value, received, i, j);
                         }
                     }
@@ -10710,8 +10710,8 @@ static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface
     ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
         wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
     ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
-    ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
-    ok(cchResult == 200, "Error: Got %d.\n", cchResult);
+    ok(dwParseFlags == parse_flags, "Error: Expected 0x%08lx, but got 0x%08lx.\n", parse_flags, dwParseFlags);
+    ok(cchResult == 200, "Error: Got %ld.\n", cchResult);
 
     memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
     *pcchResult = lstrlenW(parse_resultW);
@@ -10729,8 +10729,8 @@ static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
     ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
         wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
     ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
-        "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
-    ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
+        "Error: Expected 0, but got 0x%08lx.\n", dwCombineFlags);
+    ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %ld.\n", cchResult);
 
     memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
     *pcchResult = lstrlenW(combine_resultW);
@@ -10815,13 +10815,13 @@ static void register_protocols(void)
     HRESULT hres;
 
     hres = pCoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
             winetestW, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     IInternetSession_Release(session);
 }
@@ -10831,12 +10831,12 @@ static void unregister_protocols(void) {
     HRESULT hr;
 
     hr = pCoInternetGetSession(0, &session, 0);
-    ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInternetGetSession failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         return;
 
     hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
-    ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
 
     IInternetSession_Release(session);
 }
@@ -10846,12 +10846,12 @@ static void test_CoInternetCombineIUri_Pluggable(void) {
     IUri *base = NULL;
 
     hr = pCreateUri(combine_baseW, 0, 0, &base);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         IUri *relative = NULL;
 
         hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
-        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
         if(SUCCEEDED(hr)) {
             IUri *result = NULL;
 
@@ -10859,14 +10859,14 @@ static void test_CoInternetCombineIUri_Pluggable(void) {
 
             hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
                                         &result, 0);
-            ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+            ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
             CHECK_CALLED(CombineUrl);
 
             if(SUCCEEDED(hr)) {
                 BSTR received = NULL;
                 hr = IUri_GetAbsoluteUri(result, &received);
-                ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
+                ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
                 if(SUCCEEDED(hr)) {
                     ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
                         wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
@@ -10887,29 +10887,29 @@ static void test_CoInternetCombineUrlEx(void) {
 
     base = NULL;
     hr = pCreateUri(http_urlW, 0, 0, &base);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         result = (void*) 0xdeadbeef;
         hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
-        ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_UNEXPECTED);
         ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
     }
 
     result = (void*) 0xdeadbeef;
     hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
-    ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
+    ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
         hr, E_INVALIDARG);
     ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
 
     result = (void*) 0xdeadbeef;
     hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
-    ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
+    ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
         hr, E_UNEXPECTED);
     ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
 
     hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
-    ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
+    ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
         hr, E_POINTER);
     if(base) IUri_Release(base);
 
@@ -10917,7 +10917,7 @@ static void test_CoInternetCombineUrlEx(void) {
         LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
 
         hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
-        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
+        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
         if(SUCCEEDED(hr)) {
             LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
 
@@ -10926,7 +10926,7 @@ static void test_CoInternetCombineUrlEx(void) {
             todo_wine_if(uri_combine_tests[i].todo)
                 ok(hr == uri_combine_tests[i].expected ||
                    broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
-                    "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
+                    "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
                     hr, uri_combine_tests[i]. expected, i);
             if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
                 DWORD j;
@@ -10939,11 +10939,11 @@ static void test_CoInternetCombineUrlEx(void) {
                     hr = IUri_GetPropertyBSTR(result, j, &received, 0);
                     todo_wine_if(prop.todo) {
                         ok(hr == prop.expected,
-                            "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
+                            "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
                             hr, prop.expected, i, j);
                         ok(!strcmp_aw(value, received) ||
                            broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
-                            "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
+                            "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
                             value, wine_dbgstr_w(received), i, j);
                     }
                     SysFreeString(received);
@@ -10956,10 +10956,10 @@ static void test_CoInternetCombineUrlEx(void) {
                     hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
                     todo_wine_if(prop.todo) {
                         ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
-                            "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
+                            "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
                             hr, prop.expected, i, j);
                         if(!prop.broken_combine_hres || hr != S_FALSE)
-                            ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
+                            ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
                                 prop.value, received, i, j);
                     }
                 }
@@ -10977,7 +10977,7 @@ static void test_CoInternetCombineUrlEx_Pluggable(void) {
     IUri *base = NULL;
 
     hr = pCreateUri(combine_baseW, 0, 0, &base);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         IUri *result = NULL;
 
@@ -10985,14 +10985,14 @@ static void test_CoInternetCombineUrlEx_Pluggable(void) {
 
         hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
                                      &result, 0);
-        ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
         CHECK_CALLED(CombineUrl);
 
         if(SUCCEEDED(hr)) {
             BSTR received = NULL;
             hr = IUri_GetAbsoluteUri(result, &received);
-            ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
+            ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
             if(SUCCEEDED(hr)) {
                 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
                     wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
@@ -11013,56 +11013,56 @@ static void test_CoInternetParseIUri_InvalidArgs(void) {
     DWORD i, len;
 
     hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
-    ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+    ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
         hr, E_INVALIDARG);
-    ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+    ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
     hr = pCreateUri(http_urlW, 0, 0, &uri);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         DWORD expected_len;
 
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
-        ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_INVALIDARG);
-        ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+        ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
         hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
-        ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_POINTER);
 
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
-        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
+        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx expected 0x%08lx.\n",
             hr, E_FAIL);
-        ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+        ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
-        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_FAIL);
-        ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+        ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
-        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_FAIL);
-        ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+        ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
-        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+        ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, E_FAIL);
-        ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
+        ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
 
         expected_len = lstrlenW(http_urlW);
         result = -1;
         hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
         ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
-            "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
+            "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
             hr, STRSAFE_E_INSUFFICIENT_BUFFER);
-        ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
+        ok(result == expected_len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
             expected_len, result);
     }
     if(uri) IUri_Release(uri);
@@ -11079,15 +11079,15 @@ static void test_CoInternetParseIUri_InvalidArgs(void) {
     memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
 
     hr = pCreateUri(longurl, 0, 0, &uri);
-    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         result = -1;
         memset(longurl, 0xcc, len*sizeof(WCHAR));
         hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
-        ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
+        ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08lx.\n", hr);
         ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
             wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
-        ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
+        ok(result == len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
             len, result);
     }
     heap_free(longurl);
@@ -11106,7 +11106,7 @@ static void test_CoInternetParseIUri(void) {
 
         uriW = a2w(test.uri);
         hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
-        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
+        ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_parse_tests[%ld].\n", hr, i);
         if(SUCCEEDED(hr)) {
             WCHAR result[INTERNET_MAX_URL_LENGTH+1];
             DWORD result_len = -1;
@@ -11114,19 +11114,19 @@ static void test_CoInternetParseIUri(void) {
             hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
             todo_wine_if(test.todo)
                 ok(hr == test.expected,
-                    "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
+                    "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx on uri_parse_tests[%ld].\n",
                     hr, test.expected, i);
             if(SUCCEEDED(hr)) {
                 DWORD len = lstrlenA(test.property);
                 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
-                    "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n",
+                    "Error: Expected %s but got %s instead on uri_parse_tests[%ld] - %s.\n",
                     test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
                 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
-                    "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n",
+                    "Error: Expected %ld, but got %ld instead on uri_parse_tests[%ld] - %s.\n",
                     len, result_len, i, wine_dbgstr_w(uriW));
             } else {
                 ok(!result_len,
-                    "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
+                    "Error: Expected 'result_len' to be 0, but was %ld on uri_parse_tests[%ld].\n",
                     result_len, i);
             }
         }
@@ -11140,7 +11140,7 @@ static void test_CoInternetParseIUri_Pluggable(void) {
     IUri *uri = NULL;
 
     hr = pCreateUri(parse_urlW, 0, 0, &uri);
-    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
+    ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08lx.\n", hr);
     if(SUCCEEDED(hr)) {
         WCHAR result[200];
         DWORD result_len;
@@ -11151,12 +11151,12 @@ static void test_CoInternetParseIUri_Pluggable(void) {
         parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
 
         hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
-        ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
+        ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
 
         CHECK_CALLED(ParseUrl);
 
         if(SUCCEEDED(hr)) {
-            ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
+            ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %ld.\n",
                 lstrlenW(parse_resultW), result_len);
             ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
                 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
@@ -11256,7 +11256,7 @@ static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *
     HRESULT hres;
 
     hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
-    ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
+    ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08lx\n", hres);
     ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
             wine_dbgstr_w(display_name), exurl);
 
@@ -11272,17 +11272,17 @@ static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
     HRESULT hres;
 
     hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
-    ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IUriContainer iface: %08lx\n", hres);
 
     uri = NULL;
     hres = IUriContainer_GetIUri(uri_container, &uri);
     IUriContainer_Release(uri_container);
-    ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
+    ok(hres == S_OK, "GetIUri failed: %08lx\n", hres);
     ok(uri != NULL, "uri == NULL\n");
 
     hres = IUri_GetDisplayUri(uri, &display_uri);
     IUri_Release(uri);
-    ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
+    ok(hres == S_OK, "GetDisplayUri failed: %08lx\n", hres);
     ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
             wine_dbgstr_w(display_uri), exurl);
     SysFreeString(display_uri);
@@ -11302,56 +11302,56 @@ static void test_CreateURLMoniker(void)
 
         if(base_url) {
             hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
-            ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+            ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
             hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
-            ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
+            ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
         }else {
             base_uri = NULL;
             base_mon = NULL;
         }
 
         hres = CreateURLMoniker(base_mon, url, &mon);
-        ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
         test_urlmon_display_name(mon, test->legacy_url);
         test_display_uri(mon, test->legacy_url);
         IMoniker_Release(mon);
 
         hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
-        ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
         test_urlmon_display_name(mon, test->legacy_url);
         test_display_uri(mon, test->legacy_url);
         IMoniker_Release(mon);
 
         hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
-        ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
         test_urlmon_display_name(mon, test->uniform_url);
         test_display_uri(mon, test->uniform_url);
         IMoniker_Release(mon);
 
         hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
-        ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
         test_urlmon_display_name(mon, test->no_canon_url);
         test_display_uri(mon, test->no_canon_url);
         IMoniker_Release(mon);
 
         hres = pCreateUri(url, test->uri_flags, 0, &uri);
-        ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
 
         hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
-        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
         test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
         test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
         IMoniker_Release(mon);
 
         hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
-        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
         test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
         test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
         IMoniker_Release(mon);
 
         hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
-        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
         test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
         test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
         IMoniker_Release(mon);
@@ -11415,44 +11415,44 @@ static void test_IPersistStream(void)
 
         uriW = a2w(test->uri);
         hr = pCreateUri(uriW, test->create_flags, 0, &uri);
-        ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
+        ok(hr == S_OK, "%d) CreateUri failed 0x%08lx, expected S_OK..\n", i, hr);
 
         hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
-        ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
 
         hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-        ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
+        ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08lx.\n", hr);
         hr = IPersistStream_IsDirty(persist_stream);
-        ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
+        ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
         hr = IPersistStream_Save(persist_stream, stream, FALSE);
-        ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Save failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IPersistStream_IsDirty(persist_stream);
-        ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
+        ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
         no_off.QuadPart = 0;
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
-        ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) GetSizeMax failed 0x%08lx, expected S_OK.\n", i, hr);
         ok(U(size).LowPart+2 == U(max_size).LowPart,
-                "%d) Written data size is %d, max_size %d.\n",
+                "%d) Written data size is %ld, max_size %ld.\n",
                 i, U(size).LowPart, U(max_size).LowPart);
 
         hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
-        ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
-        ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
+        ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
+        ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %ld, expected %ld\n",
                 i, dw_data[0]-2, U(size).LowPart);
         hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
-        ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
-        ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
-        ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
+        ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
+        ok(dw_data[0] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[0]);
+        ok(dw_data[1] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[1]);
         ok(dw_data[2] == add_default_flags(test->create_flags),
-                "%d) Incorrect value %x, expected %x (creation flags).\n",
+                "%d) Incorrect value %lx, expected %x (creation flags).\n",
                 i, dw_data[2], add_default_flags(test->create_flags));
-        ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
-        ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
-        ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
+        ok(dw_data[3] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[3]);
+        ok(dw_data[4] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[4]);
+        ok(dw_data[5] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[5]);
 
         props_no = 0;
         for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
@@ -11473,17 +11473,17 @@ static void test_IPersistStream(void)
             props_no = 1;
 
         hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
-        ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
-        ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
+        ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
+        ok(props == props_no, "%d) Properties no is %ld, expected %ld.\n", i, props, props_no);
 
         dw_data[2] = 0;
         dw_data[3] = -1;
         while(props) {
             hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
-            ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
+            ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
             props--;
             ok(dw_data[2]<props_order[dw_data[0]],
-                    "%d) Incorrect properties order (%d, %d)\n",
+                    "%d) Incorrect properties order (%ld, %ld)\n",
                     i, dw_data[0], dw_data[3]);
             dw_data[2] = props_order[dw_data[0]];
             dw_data[3] = dw_data[0];
@@ -11491,41 +11491,41 @@ static void test_IPersistStream(void)
             if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
                 const uri_str_property *prop = test->str_props+dw_data[0];
                 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
-                ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
+                ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
                 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
-                        "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
+                        "%d) Expected %s but got %s (%ld).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
             } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
                 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
-                ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
+                ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %ld (%ld)\n", i, dw_data[1], dw_data[0]);
                 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
-                ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
-                ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
+                ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
+                ok(prop->value == dw_data[1], "%d) Expected %ld but got %ld (%ld).\n", i, prop->value, dw_data[1], dw_data[0]);
             } else {
-                ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
+                ok(FALSE, "%d) Incorrect property type (%ld)\n", i, dw_data[0]);
                 break;
             }
         }
-        ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
+        ok(props == 0, "%d) Not all properties were processed %ld. Next property type: %ld\n",
                 i, props, dw_data[0]);
 
         IUri_Release(uri);
 
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IPersistStream_GetClassID(persist_stream, &curi);
-        ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) GetClassID failed 0x%08lx, expected S_OK.\n", i, hr);
         ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
         IPersistStream_Release(persist_stream);
 
         hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
                 &IID_IUri, (void**)&uri);
-        ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
+        ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
         hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
-        ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IPersistStream_Load(persist_stream, stream);
-        ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Load failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IUri_GetRawUri(uri, &raw_uri);
-        ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
         ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
                 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
                     && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
@@ -11535,69 +11535,69 @@ static void test_IPersistStream(void)
         IPersistStream_Release(persist_stream);
 
         hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
-        ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
-        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
-        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
-        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
-        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
-        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
                 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
-        ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) MarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
                 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
-        ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
+        ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
         hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
                 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
-        ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08lx, expected S_OK.\n", i, hr);
         ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
 
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
-        ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
-        ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
+        ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
+        ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %ld, expected %ld\n",
                 i, dw_data[0]-2, U(size).LowPart);
-        ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
+        ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %ld, expected MSHCTX_LOCAL.\n",
                 i, dw_data[1]);
-        ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
+        ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
                 i, dw_data[2], dw_data[0]-8);
         if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
                 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
                  || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
                  || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
             U(max_size).LowPart += 3*sizeof(DWORD);
-        ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
+        ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
                 i, dw_data[2], U(max_size).LowPart);
         IMarshal_Release(marshal);
         IUri_Release(uri);
 
         hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
                 &IID_IUri, (void**)&uri);
-        ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
+        ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
         hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
-        ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
         IUri_Release(uri);
         hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
-        ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
         hr = IUri_GetRawUri(uri, &raw_uri);
-        ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
+        ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
         ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
                 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
                     && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
@@ -11632,72 +11632,72 @@ static void test_UninitializedUri(void)
     }
 
     hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
-    ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
+    ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %lx.\n", hr);
     hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
-    ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
+    ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %lx.\n", hr);
 
     hr = IUri_GetAbsoluteUri(uri, NULL);
-    ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetAbsoluteUri(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetAuthority(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetAuthority returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetDisplayUri(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetDisplayUri returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetDomain(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetDomain returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetExtension(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetExtension returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetFragment(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetFragment returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetHost(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetHost returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetHostType(uri, &dword);
-    ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetHostType returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPassword(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPassword(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPathAndQuery(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPort(uri, &dword);
-    ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPort returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetProperties(uri, &dword);
-    ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetProperties returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
-    ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
-    ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
-    ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetPropertyLength returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetQuery(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetQuery returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetRawUri(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetRawUri returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetScheme(uri, &dword);
-    ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetScheme returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetSchemeName(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetSchemeName returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetUserInfo(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetUserInfo returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetUserName(uri, &bstr);
-    ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetUserName returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_GetZone(uri, &dword);
-    ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "GetZone returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUri_IsEqual(uri, uri, &eq);
-    ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "IsEqual returned %lx, expected E_UNEXPECTED.\n", hr);
 
     hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
-    ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
+    ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %lx, expected E_UNEXPECTED.\n", hr);
     hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
-    ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
+    ok(hr == S_OK, "CreateIUriBuilder returned %lx, expected S_OK.\n", hr);
     IUriBuilder_Release(ub);
 
     hr = IPersistStream_GetSizeMax(ps, &ui);
-    ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
-    ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
+    ok(hr == S_OK, "GetSizeMax returned %lx, expected S_OK.\n", hr);
+    ok(ui.u.LowPart == 34, "ui.LowPart = %ld, expected 34.\n", ui.u.LowPart);
     hr = IPersistStream_IsDirty(ps);
-    ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
+    ok(hr == S_FALSE, "IsDirty returned %lx, expected S_FALSE.\n", hr);
 
     IPersistStream_Release(ps);
     IUriBuilderFactory_Release(ubf);
diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c
index 2f2667cea2d..cfd29910f35 100644
--- a/dlls/urlmon/tests/url.c
+++ b/dlls/urlmon/tests/url.c
@@ -244,29 +244,29 @@ static void test_CreateURLMoniker(LPCWSTR url1, LPCWSTR url2)
 
     hr = CreateURLMoniker(NULL, NULL, NULL);
     ok(hr == E_INVALIDARG,
-       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08x\n", hr);
+       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08lx\n", hr);
 
     mon1 = (IMoniker *)0xdeadbeef;
     hr = CreateURLMoniker(NULL, NULL, &mon1);
     ok(hr == E_INVALIDARG,
-       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08x\n", hr);
+       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08lx\n", hr);
     ok(mon1 == NULL, "Expected the output pointer to be NULL, got %p\n", mon1);
 
     hr = CreateURLMoniker(NULL, emptyW, NULL);
     ok(hr == E_INVALIDARG,
-       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08x\n", hr);
+       "Expected CreateURLMoniker to return E_INVALIDARG, got 0x%08lx\n", hr);
 
     hr = CreateURLMoniker(NULL, emptyW, &mon1);
     ok(hr == S_OK ||
        broken(hr == MK_E_SYNTAX), /* IE5/IE5.01/IE6 SP2 */
-       "Expected CreateURLMoniker to return S_OK, got 0x%08x\n", hr);
+       "Expected CreateURLMoniker to return S_OK, got 0x%08lx\n", hr);
     if(mon1) IMoniker_Release(mon1);
 
     hr = CreateURLMoniker(NULL, url1, &mon1);
-    ok(hr == S_OK, "failed to create moniker: 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to create moniker: 0x%08lx\n", hr);
     if(hr == S_OK) {
         hr = CreateURLMoniker(mon1, url2, &mon2);
-        ok(hr == S_OK, "failed to create moniker: 0x%08x\n", hr);
+        ok(hr == S_OK, "failed to create moniker: 0x%08lx\n", hr);
     }
     if(mon1) IMoniker_Release(mon1);
     if(mon2) IMoniker_Release(mon2);
@@ -286,22 +286,22 @@ static void test_create(void)
 
     mon = (void*)0xdeadbeef;
     hr = CreateURLMoniker(NULL, relativeW, &mon);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CreateBindCtx(0, &bctx);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     stream = (void*)0xdeadbeef;
     hr = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&stream);
-    todo_wine ok(hr == INET_E_UNKNOWN_PROTOCOL, "got 0x%08x\n", hr);
+    todo_wine ok(hr == INET_E_UNKNOWN_PROTOCOL, "got 0x%08lx\n", hr);
     ok(stream == NULL, "got %p\n", stream);
 
     hr = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     stream = (void*)0xdeadbeef;
     hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IStream, (void**)&stream);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(stream == NULL || broken(stream == (void*)0xdeadbeef) /* starting XP SP3 it's set to null */,
         "got %p\n", stream);
 
@@ -309,16 +309,16 @@ static void test_create(void)
 
     mon = (void*)0xdaedbeef;
     hr = CreateURLMoniker(NULL, winetest_data_urlW, &mon);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     stream = (void*)0xdeadbeef;
     hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IStream, (void**)&stream);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(stream == NULL || broken(stream == (void*)0xdeadbeef) /* starting XP SP3 it's set to null */,
         "got %p\n", stream);
 
     hr = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     IMoniker_Release(mon);
     IBindCtx_Release(bctx);
@@ -343,7 +343,7 @@ static ULONG WINAPI Priority_Release(IInternetPriority *iface)
 static HRESULT WINAPI Priority_SetPriority(IInternetPriority *iface, LONG nPriority)
 {
     CHECK_EXPECT(SetPriority);
-    ok(!nPriority, "nPriority = %d\n", nPriority);
+    ok(!nPriority, "nPriority = %ld\n", nPriority);
     return S_OK;
 }
 
@@ -409,10 +409,10 @@ static void test_switch_fail(void)
     tested_switch_fail = TRUE;
 
     hres = IBinding_QueryInterface(current_binding, &IID_IInternetProtocolSink, (void**)&binding_sink);
-    ok(hres == S_OK, "Could not get IInternetProtocolSink iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IInternetProtocolSink iface: %08lx\n", hres);
     if(SUCCEEDED(hres)) {
         hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
-        ok(hres == E_FAIL, "Switch failed: %08x, expected E_FAIL\n", hres);
+        ok(hres == E_FAIL, "Switch failed: %08lx, expected E_FAIL\n", hres);
         IInternetProtocolSink_Release(binding_sink);
     }
 }
@@ -430,7 +430,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     }
     hres = IInternetProtocolSink_ReportProgress(protocol_sink,
             BINDSTATUS_FINDINGRESOURCE, wszWineHQSite);
-    ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
     if(!no_callback) {
         ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
         if(bind_to_object)
@@ -447,7 +447,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     }
     hres = IInternetProtocolSink_ReportProgress(protocol_sink,
             BINDSTATUS_CONNECTING, wszWineHQIP);
-    ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
     if(!no_callback) {
         ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
         if(bind_to_object)
@@ -464,7 +464,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     }
     hres = IInternetProtocolSink_ReportProgress(protocol_sink,
             BINDSTATUS_SENDINGREQUEST, NULL);
-    ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
     if(!no_callback) {
         ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
         if(bind_to_object)
@@ -479,7 +479,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
         else
             SET_EXPECT(OnProgress_REDIRECTING);
         hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_REDIRECTING, winetest_data_urlW);
-        ok(hres == S_OK, "ReportProgress(BINDSTATUS_REFIRECTING) failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress(BINDSTATUS_REFIRECTING) failed: %08lx\n", hres);
         ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
         if(bind_to_object)
             CHECK_CALLED(Obj_OnProgress_REDIRECTING);
@@ -492,7 +492,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     SET_EXPECT(Continue);
     prot_state = 1;
     hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
 
     CHECK_CALLED(Continue);
@@ -520,7 +520,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     SET_EXPECT(Continue);
     prot_state = 2;
     hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
     CHECK_CALLED(Continue);
     if(test_abort) {
@@ -539,7 +539,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     SET_EXPECT(Continue);
     prot_state = 2;
     hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
     CHECK_CALLED(Continue);
     CHECK_CALLED(Read);
@@ -551,7 +551,7 @@ static DWORD WINAPI thread_proc(PVOID arg)
     SET_EXPECT(Continue);
     prot_state = 3;
     hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
-    ok(hres == S_OK, "Switch failed: %08x\n", hres);
+    ok(hres == S_OK, "Switch failed: %08lx\n", hres);
     ok( WaitForSingleObject(complete_event, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
     CHECK_CALLED(Continue);
     CHECK_CALLED(Read);
@@ -587,14 +587,14 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         ok(szUrl && !lstrcmpW(szUrl, current_url), "wrong url %s\n", wine_dbgstr_w(szUrl));
     ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
     ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
-    ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI);
-    ok(dwReserved == 0, "dwReserved=%lx, expected 0\n", dwReserved);
+    ok(grfPI == 0, "grfPI=%ld, expected 0\n", grfPI);
+    ok(dwReserved == 0, "dwReserved=%Ix, expected 0\n", dwReserved);
 
     if(!filedwl_api && binding_hres != S_OK) {
         SET_EXPECT(OnStopBinding);
         SET_EXPECT(Terminate);
         hres = IInternetProtocolSink_ReportResult(pOIProtSink, binding_hres, 0, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
         CHECK_CALLED(OnStopBinding);
         CHECK_CALLED(Terminate);
 
@@ -604,12 +604,12 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     memset(&bindinfo, 0, sizeof(bindinfo));
     bindinfo.cbSize = 0;
     hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bind_info, &bindinfo);
-    ok(hres == E_INVALIDARG, "GetBindInfo returned: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "GetBindInfo returned: %08lx, expected E_INVALIDARG\n", hres);
 
     memset(&bindinfo, 0, sizeof(bindinfo));
     bindinfo.cbSize = sizeof(bindinfo);
     hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bind_info, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
 
     ok(bind_info & BINDF_FROMURLMON, "BINDF_FROMURLMON is not set\n");
 
@@ -621,25 +621,25 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
 
     bind_info &= ~(BINDF_NEEDFILE|BINDF_FROMURLMON);
     if(filedwl_api || no_callback)
-        ok(bind_info == BINDF_PULLDATA, "bind_info = %x, expected BINDF_PULLDATA\n", bind_info);
+        ok(bind_info == BINDF_PULLDATA, "bind_info = %lx, expected BINDF_PULLDATA\n", bind_info);
     else
-        ok(bind_info == (bindf & ~(BINDF_NEEDFILE|BINDF_FROMURLMON)), "bind_info = %x, expected %x\n",
+        ok(bind_info == (bindf & ~(BINDF_NEEDFILE|BINDF_FROMURLMON)), "bind_info = %lx, expected %lx\n",
            bind_info, (bindf & ~(BINDF_NEEDFILE|BINDF_FROMURLMON)));
 
-    ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize = %d\n", bindinfo.cbSize);
+    ok(bindinfo.cbSize == sizeof(bindinfo), "bindinfo.cbSize = %ld\n", bindinfo.cbSize);
     ok(!bindinfo.szExtraInfo, "bindinfo.szExtraInfo = %p\n", bindinfo.szExtraInfo);
     ok(!memcmp(&bindinfo.stgmedData, &stgmed_zero, sizeof(STGMEDIUM)), "wrong stgmedData\n");
-    ok(!bindinfo.grfBindInfoF, "bindinfo.grfBindInfoF = %d\n", bindinfo.grfBindInfoF);
-    ok(!bindinfo.dwBindVerb, "bindinfo.dwBindVerb = %d\n", bindinfo.dwBindVerb);
+    ok(!bindinfo.grfBindInfoF, "bindinfo.grfBindInfoF = %ld\n", bindinfo.grfBindInfoF);
+    ok(!bindinfo.dwBindVerb, "bindinfo.dwBindVerb = %ld\n", bindinfo.dwBindVerb);
     ok(!bindinfo.szCustomVerb, "bindinfo.szCustomVerb = %p\n", bindinfo.szCustomVerb);
-    ok(!bindinfo.cbstgmedData, "bindinfo.cbstgmedData = %d\n", bindinfo.cbstgmedData);
-    ok(bindinfo.dwOptions == (bind_to_object ? 0x100000 : 0), "bindinfo.dwOptions = %x\n", bindinfo.dwOptions);
-    ok(!bindinfo.dwOptionsFlags, "bindinfo.dwOptionsFlags = %d\n", bindinfo.dwOptionsFlags);
-    ok(!bindinfo.dwCodePage, "bindinfo.dwCodePage = %d\n", bindinfo.dwCodePage);
+    ok(!bindinfo.cbstgmedData, "bindinfo.cbstgmedData = %ld\n", bindinfo.cbstgmedData);
+    ok(bindinfo.dwOptions == (bind_to_object ? 0x100000 : 0), "bindinfo.dwOptions = %lx\n", bindinfo.dwOptions);
+    ok(!bindinfo.dwOptionsFlags, "bindinfo.dwOptionsFlags = %ld\n", bindinfo.dwOptionsFlags);
+    ok(!bindinfo.dwCodePage, "bindinfo.dwCodePage = %ld\n", bindinfo.dwCodePage);
     ok(!memcmp(&bindinfo.securityAttributes, &sa_zero, sizeof(sa_zero)), "wrong bindinfo.securityAttributes\n");
     ok(IsEqualGUID(&bindinfo.iid, &IID_NULL), "wrong bindinfo.iid\n");
     ok(!bindinfo.pUnk, "bindinfo.pUnk = %p\n", bindinfo.pUnk);
-    ok(!bindinfo.dwReserved, "bindinfo.dwReserved = %d\n", bindinfo.dwReserved);
+    ok(!bindinfo.dwReserved, "bindinfo.dwReserved = %ld\n", bindinfo.dwReserved);
 
     if(only_check_prot_args)
         return E_FAIL;
@@ -649,7 +649,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
                 BINDSTATUS_DIRECTBIND, NULL);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres);
 
     case FILE_TEST:
     case ITS_TEST:
@@ -660,7 +660,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
                 BINDSTATUS_SENDINGREQUEST, emptyW);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_SENDINGREQUEST) failed: %08lx\n", hres);
         if(bind_to_object)
             CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
         else
@@ -691,37 +691,37 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         CLEAR_CALLED(QueryService_IInternetBindInfo); /* IE <8 */
 
         ok(hres == E_NOINTERFACE,
-           "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
-        ok(fetched == 256, "fetched = %d, expected 254\n", fetched);
+           "GetBindString(BINDSTRING_USER_AGETNT) failed: %08lx\n", hres);
+        ok(fetched == 256, "fetched = %ld, expected 254\n", fetched);
         ok(ua == (LPWSTR)0xdeadbeef, "ua =  %p\n", ua);
 
         hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES,
                                                accept_mimes, 256, &fetched);
         ok(hres == S_OK,
-           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
-        ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
+           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres);
+        ok(fetched == 1, "fetched = %ld, expected 1\n", fetched);
         ok(!lstrcmpW(wszMimes, accept_mimes[0]), "unexpected mimes\n");
         CoTaskMemFree(accept_mimes[0]);
 
         hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES,
                                                NULL, 256, &fetched);
         ok(hres == E_INVALIDARG,
-           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
+           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres);
 
         hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_ACCEPT_MIMES,
                                                accept_mimes, 256, NULL);
         ok(hres == E_INVALIDARG,
-           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
+           "GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08lx\n", hres);
 
         hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
                                                 (void**)&service_provider);
-        ok(hres == S_OK, "QueryInterface failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryInterface failed: %08lx\n", hres);
 
         SET_EXPECT(QueryInterface_IHttpNegotiate);
         hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
                 &IID_IHttpNegotiate, (void**)&http_negotiate);
         CLEAR_CALLED(QueryInterface_IHttpNegotiate); /* IE <8 */
-        ok(hres == S_OK, "QueryService failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
 
         if(!no_callback) {
             SET_EXPECT(BeginningTransaction);
@@ -734,14 +734,14 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
             CHECK_CALLED(BeginningTransaction);
         }
         IHttpNegotiate_Release(http_negotiate);
-        ok(hres == S_OK, "BeginningTransction failed: %08x\n", hres);
+        ok(hres == S_OK, "BeginningTransction failed: %08lx\n", hres);
         ok(additional_headers == NULL, "additional_headers=%p\n", additional_headers);
 
         SET_EXPECT(QueryInterface_IHttpNegotiate2);
         hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
                 &IID_IHttpNegotiate2, (void**)&http_negotiate2);
         CLEAR_CALLED(QueryInterface_IHttpNegotiate2); /* IE <8 */
-        ok(hres == S_OK, "QueryService failed: %08x\n", hres);
+        ok(hres == S_OK, "QueryService failed: %08lx\n", hres);
 
         size = 512;
         if(!no_callback) {
@@ -754,8 +754,8 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
             CHECK_CALLED(GetRootSecurityId);
         }
         IHttpNegotiate2_Release(http_negotiate2);
-        ok(hres == E_FAIL, "GetRootSecurityId failed: %08x, expected E_FAIL\n", hres);
-        ok(size == (no_callback ? 512 : 13), "size=%d\n", size);
+        ok(hres == E_FAIL, "GetRootSecurityId failed: %08lx, expected E_FAIL\n", hres);
+        ok(size == (no_callback ? 512 : 13), "size=%ld\n", size);
 
         if(!no_callback) {
             SET_EXPECT(QueryService_IHttpSecurity);
@@ -763,7 +763,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         }
         hres = IServiceProvider_QueryService(service_provider, &IID_IHttpSecurity,
                 &IID_IHttpSecurity, (void**)&http_security);
-        ok(hres == (no_callback ? E_NOINTERFACE : S_OK), "QueryService failed: 0x%08x\n", hres);
+        ok(hres == (no_callback ? E_NOINTERFACE : S_OK), "QueryService failed: 0x%08lx\n", hres);
         if(!no_callback) {
             CHECK_CALLED(QueryService_IHttpSecurity);
             CHECK_CALLED(QueryInterface_IHttpSecurity);
@@ -781,7 +781,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
             data.grfFlags = PI_FORCE_ASYNC;
             prot_state = 0;
             hres = IInternetProtocolSink_Switch(pOIProtSink, &data);
-            ok(hres == S_OK, "Switch failed: %08x\n", hres);
+            ok(hres == S_OK, "Switch failed: %08lx\n", hres);
             SET_EXPECT(Continue);
             SetEvent(complete_event2);
             return E_PENDING;
@@ -795,7 +795,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
                 BINDSTATUS_CACHEFILENAMEAVAILABLE, file_url+7);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
 
         if(bind_to_object)
             SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
@@ -804,7 +804,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink,
                 BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextHtml);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08lx\n", hres);
         if(bind_to_object)
             CHECK_CALLED(Obj_OnProgress_MIMETYPEAVAILABLE);
         else
@@ -813,12 +813,12 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
         SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, wszTextHtml);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
         CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
     }else {
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
     }
 
     if(test_protocol == ABOUT_TEST)
@@ -858,7 +858,7 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     }
 
     hres = IInternetProtocolSink_ReportData(pOIProtSink, bscf, 13, 13);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
 
     CHECK_CALLED(Read);
     if(bind_to_object) {
@@ -893,19 +893,19 @@ static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
     if(test_protocol == ITS_TEST) {
         SET_EXPECT(Read);
         hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_BEGINDOWNLOADDATA, NULL);
-        ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress(BINDSTATUS_BEGINDOWNLOADDATA) failed: %08lx\n", hres);
         CHECK_CALLED(Read);
     }else if(!bind_to_object && test_protocol == FILE_TEST) {
         SET_EXPECT(Read);
         hres = IInternetProtocolSink_ReportData(pOIProtSink, bscf, 13, 13);
-        ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
         CHECK_CALLED(Read);
     }
 
     if(test_protocol != WINETEST_SYNC_TEST) {
         SET_EXPECT(Terminate);
         hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
         CHECK_CALLED(Terminate);
     }
 
@@ -920,7 +920,7 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
 
     CHECK_EXPECT(Continue);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     if(!bind_to_object)
         ok(reported_url && !lstrcmpW(reported_url, current_url), "wrong url %s\n", wine_dbgstr_w(reported_url));
@@ -933,12 +933,12 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
     case 0:
         hres = IInternetProtocolSink_ReportProgress(protocol_sink,
                     BINDSTATUS_SENDINGREQUEST, NULL);
-        ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress failed: %08lx\n", hres);
 
         hres = IInternetProtocolSink_ReportProgress(protocol_sink,
                 BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
         ok(hres == S_OK,
-                "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
+                "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
 
         bscf |= BSCF_FIRSTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION;
         break;
@@ -965,21 +965,21 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
             CHECK_CALLED(OnResponse);
         }
         IHttpNegotiate_Release(http_negotiate);
-        ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
+        ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
 
         if(test_protocol == HTTPS_TEST || test_redirect) {
             hres = IInternetProtocolSink_ReportProgress(protocol_sink, BINDSTATUS_ACCEPTRANGES, NULL);
-            ok(hres == S_OK, "ReportProgress(BINDSTATUS_ACCEPTRANGES) failed: %08x\n", hres);
+            ok(hres == S_OK, "ReportProgress(BINDSTATUS_ACCEPTRANGES) failed: %08lx\n", hres);
         }
 
         hres = IInternetProtocolSink_ReportProgress(protocol_sink,
                 BINDSTATUS_MIMETYPEAVAILABLE, wszTextHtml);
         ok(hres == S_OK,
-           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
+           "ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08lx\n", hres);
 
         hres = IInternetProtocolSink_ReportProgress(protocol_sink,
             BINDSTATUS_CACHEFILENAMEAVAILABLE, use_cache_file ? cache_file_name : cache_fileW);
-        ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08lx\n", hres);
 
         bscf |= BSCF_FIRSTDATANOTIFICATION;
         break;
@@ -991,14 +991,14 @@ static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
     }
 
     hres = IInternetProtocolSink_ReportData(protocol_sink, bscf, 100, 400);
-    ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
 
     if(prot_state != 2 || !test_abort)
         SET_EXPECT(Read);
     switch(prot_state) {
     case 0:
         hres = IInternetProtocolSink_ReportResult(protocol_sink, S_OK, 0, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
         SET_EXPECT(OnProgress_SENDINGREQUEST);
         SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
         SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
@@ -1050,11 +1050,11 @@ static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
 
     CHECK_EXPECT(Abort);
 
-    ok(hrReason == E_ABORT, "hrReason = %08x\n", hrReason);
-    ok(!dwOptions, "dwOptions = %x\n", dwOptions);
+    ok(hrReason == E_ABORT, "hrReason = %08lx\n", hrReason);
+    ok(!dwOptions, "dwOptions = %lx\n", dwOptions);
 
     hres = IInternetProtocolSink_ReportResult(protocol_sink, E_ABORT, ERROR_SUCCESS, NULL);
-    ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+    ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
 
     return S_OK;
 }
@@ -1063,7 +1063,7 @@ static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptio
 {
     CHECK_EXPECT(Terminate);
 
-    ok(dwOptions == 0, "dwOptions=%d, expected 0\n", dwOptions);
+    ok(dwOptions == 0, "dwOptions=%ld, expected 0\n", dwOptions);
 
     if(protocol_sink) {
         IInternetProtocolSink_Release(protocol_sink);
@@ -1138,10 +1138,10 @@ static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
 
             hres = IInternetProtocolSink_ReportData(protocol_sink,
                     BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 2000, 2000);
-            ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+            ok(hres == S_OK, "ReportData failed: %08lx\n", hres);
 
             hres = IInternetProtocolSink_ReportResult(protocol_sink, S_OK, 0, NULL);
-            ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+            ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
 
             return S_FALSE;
         case 4:
@@ -1157,12 +1157,12 @@ static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
 
     if(test_protocol == WINETEST_SYNC_TEST) {
         hres = IInternetProtocolSink_ReportResult(protocol_sink, S_OK, 0, NULL);
-        ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+        ok(hres == S_OK, "ReportResult failed: %08lx\n", hres);
 
         SET_EXPECT(OnStopBinding);
     }
 
-    ok(*pcbRead == 0, "*pcbRead=%d, expected 0\n", *pcbRead);
+    ok(*pcbRead == 0, "*pcbRead=%ld, expected 0\n", *pcbRead);
     read += *pcbRead = sizeof(data)-1;
     memcpy(pv, data, sizeof(data));
     return S_OK;
@@ -1238,10 +1238,10 @@ static HRESULT WINAPI HttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface,
     else
         CHECK_EXPECT(BeginningTransaction);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     ok(!lstrcmpW(szURL, current_url), "szURL != current_url\n");
-    ok(!dwReserved, "dwReserved=%d, expected 0\n", dwReserved);
+    ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
     ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
     if(pszAdditionalHeaders)
         ok(*pszAdditionalHeaders == NULL, "*pszAdditionalHeaders != NULL\n");
@@ -1254,9 +1254,9 @@ static HRESULT WINAPI HttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD dwR
 {
     CHECK_EXPECT(OnResponse);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
-    ok(dwResponseCode == 200, "dwResponseCode=%d, expected 200\n", dwResponseCode);
+    ok(dwResponseCode == 200, "dwResponseCode=%ld, expected 200\n", dwResponseCode);
     ok(szResponseHeaders != NULL, "szResponseHeaders == NULL\n");
     ok(szRequestHeaders == NULL, "szRequestHeaders != NULL\n");
     /* Note: in protocol.c tests, OnResponse pszAdditionalRequestHeaders _is_ NULL */
@@ -1274,9 +1274,9 @@ static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
 
     CHECK_EXPECT(GetRootSecurityId);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
-    ok(!dwReserved, "dwReserved=%ld, expected 0\n", dwReserved);
+    ok(!dwReserved, "dwReserved=%Id, expected 0\n", dwReserved);
     ok(pbSecurityId != NULL, "pbSecurityId == NULL\n");
     ok(pcbSecurityId != NULL, "pcbSecurityId == NULL\n");
 
@@ -1284,7 +1284,7 @@ static HRESULT WINAPI HttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface,
         return E_NOTIMPL;
 
     if(pcbSecurityId) {
-        ok(*pcbSecurityId == 512, "*pcbSecurityId=%d, expected 512\n", *pcbSecurityId);
+        ok(*pcbSecurityId == 512, "*pcbSecurityId=%ld, expected 512\n", *pcbSecurityId);
         *pcbSecurityId = sizeof(sec_id);
     }
 
@@ -1353,13 +1353,13 @@ static HRESULT WINAPI HttpSecurity_OnSecurityProblem(IHttpSecurity *iface, DWORD
     if(!security_problem) {
         ok(dwProblem == ERROR_INTERNET_SEC_CERT_CN_INVALID ||
            broken(dwProblem == ERROR_INTERNET_SEC_CERT_ERRORS) /* Some versions of IE6 */,
-           "Got problem: %d\n", dwProblem);
+           "Got problem: %ld\n", dwProblem);
         security_problem = dwProblem;
 
         if(dwProblem == ERROR_INTERNET_SEC_CERT_ERRORS)
             binding_hres = INET_E_SECURITY_PROBLEM;
     }else
-        ok(dwProblem == security_problem, "Got problem: %d\n", dwProblem);
+        ok(dwProblem == security_problem, "Got problem: %ld\n", dwProblem);
 
     return onsecurityproblem_hres;
 }
@@ -1460,28 +1460,28 @@ static void test_WinInetHttpInfo(IWinInetHttpInfo *http_info, DWORD progress)
     hres = IWinInetHttpInfo_QueryInfo(http_info, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER,
             &status, &size, NULL, NULL);
     ok(hres == expect || ((progress == BINDSTATUS_COOKIE_SENT || progress == BINDSTATUS_PROXYDETECTING) && hres == S_FALSE),
-       "progress %u: hres = %x, expected %x\n", progress, hres, expect);
+       "progress %lu: hres = %lx, expected %lx\n", progress, hres, expect);
     if(hres == S_OK) {
         if(download_state == BEFORE_DOWNLOAD && progress != BINDSTATUS_MIMETYPEAVAILABLE && progress != BINDSTATUS_DECODING)
-            ok(status == 0, "progress %u: status = %d\n", progress, status);
+            ok(status == 0, "progress %lu: status = %ld\n", progress, status);
         else
-            ok(status == HTTP_STATUS_OK, "progress %u: status = %d\n", progress, status);
-        ok(size == sizeof(DWORD), "size = %d\n", size);
+            ok(status == HTTP_STATUS_OK, "progress %lu: status = %ld\n", progress, status);
+        ok(size == sizeof(DWORD), "size = %ld\n", size);
     }
 
     size = sizeof(DWORD);
     hres = IWinInetHttpInfo_QueryOption(http_info, INTERNET_OPTION_HANDLE_TYPE, &status, &size);
     if(test_protocol == FTP_TEST) {
         if(download_state==BEFORE_DOWNLOAD && progress!=BINDSTATUS_MIMETYPEAVAILABLE)
-            ok(hres == E_FAIL, "hres = %x\n", hres);
+            ok(hres == E_FAIL, "hres = %lx\n", hres);
         else
-            ok(hres == S_OK, "hres = %x\n", hres);
+            ok(hres == S_OK, "hres = %lx\n", hres);
 
         if(hres == S_OK)
-            ok(status == INTERNET_HANDLE_TYPE_FTP_FILE, "status = %d\n", status);
+            ok(status == INTERNET_HANDLE_TYPE_FTP_FILE, "status = %ld\n", status);
     } else {
-        ok(hres == S_OK, "hres = %x\n", hres);
-        ok(status == INTERNET_HANDLE_TYPE_HTTP_REQUEST, "status = %d\n", status);
+        ok(hres == S_OK, "hres = %lx\n", hres);
+        ok(status == INTERNET_HANDLE_TYPE_HTTP_REQUEST, "status = %ld\n", status);
     }
 }
 
@@ -1489,7 +1489,7 @@ static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallbackEx *iface, REF
 {
     if (winetest_debug > 1) trace("IBindStatusCallback::QueryInterface(%s)\n", debugstr_guid(riid));
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     if(IsEqualGUID(&IID_IInternetProtocol, riid)) {
         CHECK_EXPECT2(QueryInterface_IInternetProtocol);
@@ -1566,10 +1566,10 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWO
     else
         CHECK_EXPECT(OnStartBinding);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     ok(pib != NULL, "pib should not be NULL\n");
-    ok(dwReserved == 0xff, "dwReserved=%x\n", dwReserved);
+    ok(dwReserved == 0xff, "dwReserved=%lx\n", dwReserved);
 
     if(pib == (void*)0xdeadbeef)
         return S_OK;
@@ -1582,23 +1582,23 @@ static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWO
         IMoniker_Release(mon);
 
     hres = IBinding_QueryInterface(pib, &IID_IWinInetHttpInfo, (void**)&http_info);
-    ok(hres == E_NOINTERFACE, "Could not get IID_IWinInetHttpInfo: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "Could not get IID_IWinInetHttpInfo: %08lx\n", hres);
 
     if(0) { /* crashes with native urlmon */
         hres = IBinding_GetBindResult(pib, NULL, &res, &res_str, NULL);
-        ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
+        ok(hres == E_INVALIDARG, "GetBindResult failed: %08lx\n", hres);
     }
     hres = IBinding_GetBindResult(pib, &clsid, NULL, &res_str, NULL);
-    ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "GetBindResult failed: %08lx\n", hres);
     hres = IBinding_GetBindResult(pib, &clsid, &res, NULL, NULL);
-    ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "GetBindResult failed: %08lx\n", hres);
     hres = IBinding_GetBindResult(pib, &clsid, &res, &res_str, (void*)0xdeadbeef);
-    ok(hres == E_INVALIDARG, "GetBindResult failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "GetBindResult failed: %08lx\n", hres);
 
     hres = IBinding_GetBindResult(pib, &clsid, &res, &res_str, NULL);
-    ok(hres == S_OK, "GetBindResult failed: %08x, expected S_OK\n", hres);
+    ok(hres == S_OK, "GetBindResult failed: %08lx, expected S_OK\n", hres);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "incorrect clsid: %s\n", wine_dbgstr_guid(&clsid));
-    ok(!res, "incorrect res: %x\n", res);
+    ok(!res, "incorrect res: %lx\n", res);
     ok(!res_str, "incorrect res_str: %s\n", wine_dbgstr_w(res_str));
 
     if(abort_start) {
@@ -1624,10 +1624,10 @@ static HRESULT WINAPI statusclb_OnLowResource(IBindStatusCallbackEx *iface, DWOR
 static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG ulProgress,
         ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 {
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     if (winetest_debug > 1)
-        trace("IBindStatusCallbackEx::OnProgress(progress %u/%u, code %u, text %s)\n",
+        trace("IBindStatusCallbackEx::OnProgress(progress %lu/%lu, code %lu, text %s)\n",
                 ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText));
 
     switch(ulStatusCode) {
@@ -1721,11 +1721,11 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
 
             SET_EXPECT(Abort);
             hres = IBinding_Abort(current_binding);
-            ok(hres == S_OK, "Abort failed: %08x\n", hres);
+            ok(hres == S_OK, "Abort failed: %08lx\n", hres);
             CHECK_CALLED(Abort);
 
             hres = IBinding_Abort(current_binding);
-            ok(hres == E_FAIL, "Abort failed: %08x\n", hres);
+            ok(hres == E_FAIL, "Abort failed: %08lx\n", hres);
 
             binding_hres = E_ABORT;
         }
@@ -1771,7 +1771,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
         else
             CHECK_EXPECT(Obj_OnProgress_CLASSIDAVAILABLE);
         hr = CLSIDFromString((LPCOLESTR)szStatusText, &clsid);
-        ok(hr == S_OK, "CLSIDFromString failed with error 0x%08x\n", hr);
+        ok(hr == S_OK, "CLSIDFromString failed with error 0x%08lx\n", hr);
         ok(IsEqualCLSID(&clsid, &CLSID_HTMLDocument),
             "Expected clsid to be CLSID_HTMLDocument instead of %s\n", wine_dbgstr_guid(&clsid));
         break;
@@ -1793,7 +1793,7 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
     case BINDSTATUS_DECODING:
         break;
     default:
-        ok(0, "unexpected code %d\n", ulStatusCode);
+        ok(0, "unexpected code %ld\n", ulStatusCode);
     };
 
     if(current_binding) {
@@ -1802,11 +1802,11 @@ static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG u
 
         hres = IBinding_QueryInterface(current_binding, &IID_IWinInetHttpInfo, (void**)&http_info);
         if(!emulate_protocol && test_protocol != FILE_TEST && is_urlmon_protocol(test_protocol)) {
-            ok(hres == S_OK, "Could not get IWinInetHttpInfo iface: %08x\n", hres);
+            ok(hres == S_OK, "Could not get IWinInetHttpInfo iface: %08lx\n", hres);
             test_WinInetHttpInfo(http_info, ulStatusCode);
         } else
             ok(hres == E_NOINTERFACE,
-               "QueryInterface(IID_IWinInetHttpInfo) returned: %08x, expected E_NOINTERFACE\n", hres);
+               "QueryInterface(IID_IWinInetHttpInfo) returned: %08lx, expected E_NOINTERFACE\n", hres);
         if(SUCCEEDED(hres))
             IWinInetHttpInfo_Release(http_info);
     }
@@ -1824,10 +1824,10 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
         stopped_binding = TRUE;
     }
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     if(only_check_prot_args) {
-        todo_wine ok(hresult == S_OK, "Got %08x\n", hresult);
+        todo_wine ok(hresult == S_OK, "Got %08lx\n", hresult);
         return S_OK;
     }
 
@@ -1837,13 +1837,13 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
 
     if(filedwl_api) {
         if(!abort_progress && !abort_start)
-            ok(SUCCEEDED(hresult), "binding failed: %08x\n", hresult);
+            ok(SUCCEEDED(hresult), "binding failed: %08lx\n", hresult);
         else if(abort_start && abort_hres == E_NOTIMPL)
-            todo_wine ok(hresult == S_FALSE, "binding failed: %08x, expected S_FALSE\n", hresult);
+            todo_wine ok(hresult == S_FALSE, "binding failed: %08lx, expected S_FALSE\n", hresult);
         else
-            ok(hresult == E_ABORT, "binding failed: %08x, expected E_ABORT\n", hresult);
+            ok(hresult == E_ABORT, "binding failed: %08lx, expected E_ABORT\n", hresult);
     } else
-        ok(hresult == binding_hres, "binding failed: %08x, expected %08x\n", hresult, binding_hres);
+        ok(hresult == binding_hres, "binding failed: %08lx, expected %08lx\n", hresult, binding_hres);
     ok(szError == NULL, "szError should be NULL\n");
 
     if(current_binding) {
@@ -1853,8 +1853,8 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
         HRESULT hres;
 
         hres = IBinding_GetBindResult(current_binding, &clsid, &res, &res_str, NULL);
-        ok(hres == S_OK, "GetBindResult failed: %08x, expected S_OK\n", hres);
-        ok(res == hresult, "res = %08x, expected %08x\n", res, binding_hres);
+        ok(hres == S_OK, "GetBindResult failed: %08lx, expected S_OK\n", hres);
+        ok(res == hresult, "res = %08lx, expected %08lx\n", res, binding_hres);
         ok(!res_str, "incorrect res_str = %s\n", wine_dbgstr_w(res_str));
 
         if(hresult==S_OK || (abort_start && hresult!=S_FALSE) || hresult == REGDB_E_CLASSNOTREG) {
@@ -1900,7 +1900,7 @@ static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRES
         HANDLE file = CreateFileW(http_cache_file, DELETE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
                                   NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         ok(file == INVALID_HANDLE_VALUE, "expected INVALID_HANDLE_VALUE, got %p\n", file);
-        ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %u\n", GetLastError());
+        ok(GetLastError() == ERROR_SHARING_VIOLATION, "expected ERROR_SHARING_VIOLATION, got %lu\n", GetLastError());
         http_cache_file[0] = 0;
     }
 
@@ -1916,7 +1916,7 @@ static HRESULT WINAPI statusclb_GetBindInfo(IBindStatusCallbackEx *iface, DWORD
     else
         CHECK_EXPECT(GetBindInfo);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     *grfBINDF = bindf;
     cbSize = pbindinfo->cbSize;
@@ -1935,19 +1935,19 @@ static void test_stream_seek(IStream *stream)
     pos.QuadPart = 0;
     new_pos.QuadPart = 0xdeadbeef;
     hres = IStream_Seek(stream, pos, STREAM_SEEK_SET, &new_pos);
-    ok(hres == S_OK, "Seek failed: %08x\n", hres);
+    ok(hres == S_OK, "Seek failed: %08lx\n", hres);
     ok(!new_pos.QuadPart, "new_pos.QuadPart != 0\n");
 
     pos.QuadPart = 0;
     new_pos.QuadPart = 0xdeadbeef;
     hres = IStream_Seek(stream, pos, STREAM_SEEK_END, &new_pos);
-    ok(hres == S_OK, "Seek failed: %08x\n", hres);
+    ok(hres == S_OK, "Seek failed: %08lx\n", hres);
     ok(new_pos.QuadPart, "new_pos.QuadPart = 0\n");
 
     pos.QuadPart = 0;
     new_pos.QuadPart = 0xdeadbeef;
     hres = IStream_Seek(stream, pos, 100, &new_pos);
-    ok(hres == E_FAIL, "Seek failed: %08x\n", hres);
+    ok(hres == E_FAIL, "Seek failed: %08lx\n", hres);
     ok(new_pos.QuadPart == 0xdeadbeef, "unexpected new_pos.QuadPart\n");
 }
 
@@ -1964,7 +1964,7 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
 
     CHECK_EXPECT2(OnDataAvailable);
 
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     ok(download_state == DOWNLOADING || download_state == END_DOWNLOAD,
        "Download state was %d, expected DOWNLOADING or END_DOWNLOAD\n",
@@ -1972,7 +1972,7 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
     data_available = TRUE;
 
     if(bind_to_object && !is_async_prot)
-        ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION), "grfBSCF = %x\n", grfBSCF);
+        ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION), "grfBSCF = %lx\n", grfBSCF);
 
     ok(pformatetc != NULL, "pformatetc == NULL\n");
     if(pformatetc) {
@@ -1980,20 +1980,20 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
             INT ret;
             clipfmt[0] = 0;
             ret = GetClipboardFormatNameA(pformatetc->cfFormat, clipfmt, sizeof(clipfmt)-1);
-            ok(ret, "GetClipboardFormatName failed, error %d\n", GetLastError());
+            ok(ret, "GetClipboardFormatName failed, error %ld\n", GetLastError());
             ok(!strcmp(clipfmt, mime_type), "clipformat %x != mime_type, \"%s\" != \"%s\"\n",
                pformatetc->cfFormat, clipfmt, mime_type);
         } else {
             ok(pformatetc->cfFormat == 0, "clipformat=%x\n", pformatetc->cfFormat);
         }
         ok(pformatetc->ptd == NULL, "ptd = %p\n", pformatetc->ptd);
-        ok(pformatetc->dwAspect == 1, "dwAspect=%u\n", pformatetc->dwAspect);
-        ok(pformatetc->lindex == -1, "lindex=%d\n", pformatetc->lindex);
-        ok(pformatetc->tymed == tymed, "tymed=%u, expected %u\n", pformatetc->tymed, tymed);
+        ok(pformatetc->dwAspect == 1, "dwAspect=%lu\n", pformatetc->dwAspect);
+        ok(pformatetc->lindex == -1, "lindex=%ld\n", pformatetc->lindex);
+        ok(pformatetc->tymed == tymed, "tymed=%lu, expected %lu\n", pformatetc->tymed, tymed);
     }
 
     ok(pstgmed != NULL, "stgmeg == NULL\n");
-    ok(pstgmed->tymed == tymed, "tymed=%u, expected %u\n", pstgmed->tymed, tymed);
+    ok(pstgmed->tymed == tymed, "tymed=%lu, expected %lu\n", pstgmed->tymed, tymed);
     ok(pstgmed->pUnkForRelease != NULL, "pUnkForRelease == NULL\n");
 
     switch(pstgmed->tymed) {
@@ -2007,37 +2007,37 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
 
             hres = IStream_Write(stream, buf, 10, NULL);
             ok(hres == STG_E_ACCESSDENIED,
-               "Write failed: %08x, expected STG_E_ACCESSDENIED\n", hres);
+               "Write failed: %08lx, expected STG_E_ACCESSDENIED\n", hres);
 
             hres = IStream_Commit(stream, 0);
-            ok(hres == E_NOTIMPL, "Commit failed: %08x, expected E_NOTIMPL\n", hres);
+            ok(hres == E_NOTIMPL, "Commit failed: %08lx, expected E_NOTIMPL\n", hres);
 
             hres = IStream_Revert(stream);
-            ok(hres == E_NOTIMPL, "Revert failed: %08x, expected E_NOTIMPL\n", hres);
+            ok(hres == E_NOTIMPL, "Revert failed: %08lx, expected E_NOTIMPL\n", hres);
 
             hres = IStream_Stat(stream, NULL, STATFLAG_NONAME);
-            ok(hres == E_FAIL, "hres = %x\n", hres);
+            ok(hres == E_FAIL, "hres = %lx\n", hres);
             if(use_cache_file && emulate_protocol) {
                 hres = IStream_Stat(stream, &stat, STATFLAG_DEFAULT);
-                ok(hres == S_OK, "hres = %x\n", hres);
+                ok(hres == S_OK, "hres = %lx\n", hres);
                 ok(!lstrcmpW(stat.pwcsName, cache_file_name),
                         "stat.pwcsName = %s, cache_file_name = %s\n",
                         wine_dbgstr_w(stat.pwcsName), wine_dbgstr_w(cache_file_name));
                 CoTaskMemFree(stat.pwcsName);
                 ok(U(stat.cbSize).LowPart == (bindf&BINDF_ASYNCHRONOUS?0:6500),
-                        "stat.cbSize.LowPart = %u\n", U(stat.cbSize).LowPart);
+                        "stat.cbSize.LowPart = %lu\n", U(stat.cbSize).LowPart);
             } else {
                 hres = IStream_Stat(stream, &stat, STATFLAG_NONAME);
-                ok(hres == S_OK, "hres = %x\n", hres);
+                ok(hres == S_OK, "hres = %lx\n", hres);
                 ok(!stat.pwcsName || broken(stat.pwcsName!=NULL),
                         "stat.pwcsName = %s\n", wine_dbgstr_w(stat.pwcsName));
             }
-            ok(stat.type == STGTY_STREAM, "stat.type = %x\n", stat.type);
+            ok(stat.type == STGTY_STREAM, "stat.type = %lx\n", stat.type);
             ok(U(stat.cbSize).HighPart == 0, "stat.cbSize.HighPart != 0\n");
-            ok(stat.grfMode == (U(stat.cbSize).LowPart?GENERIC_READ:0), "stat.grfMode = %x\n", stat.grfMode);
-            ok(stat.grfLocksSupported == 0, "stat.grfLocksSupported = %x\n", stat.grfLocksSupported);
-            ok(stat.grfStateBits == 0, "stat.grfStateBits = %x\n", stat.grfStateBits);
-            ok(stat.reserved == 0, "stat.reserved = %x\n", stat.reserved);
+            ok(stat.grfMode == (U(stat.cbSize).LowPart?GENERIC_READ:0), "stat.grfMode = %lx\n", stat.grfMode);
+            ok(stat.grfLocksSupported == 0, "stat.grfLocksSupported = %lx\n", stat.grfLocksSupported);
+            ok(stat.grfStateBits == 0, "stat.grfStateBits = %lx\n", stat.grfStateBits);
+            ok(stat.reserved == 0, "stat.reserved = %lx\n", stat.reserved);
         }
 
         if(callback_read) {
@@ -2046,7 +2046,7 @@ static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DW
                 if(test_protocol == HTTP_TEST && emulate_protocol && read)
                     ok(buf[0] == (use_cache_file && !(bindf&BINDF_ASYNCHRONOUS) ? 'X' : '?'), "buf[0] = '%c'\n", buf[0]);
             }while(hres == S_OK);
-            ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08x\n", hres);
+            ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08lx\n", hres);
         }
 
         if(use_cache_file && (grfBSCF & BSCF_FIRSTDATANOTIFICATION) && !(bindf & BINDF_PULLDATA))
@@ -2209,7 +2209,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
         {'C','B','i','n','d','i','n','g',' ','C','o','n','t','e','x','t',0};
 
     CHECK_EXPECT(Load);
-    ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
+    ok(GetCurrentThreadId() == thread_id, "wrong thread %ld\n", GetCurrentThreadId());
 
     if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
         ok(!fFullyAvailable, "fFullyAvailable = %x\n", fFullyAvailable);
@@ -2217,15 +2217,15 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
         ok(fFullyAvailable, "fFullyAvailable = %x\n", fFullyAvailable);
     ok(pimkName != NULL, "pimkName == NULL\n");
     ok(pibc != NULL, "pibc == NULL\n");
-    ok(grfMode == 0x12, "grfMode = %x\n", grfMode);
+    ok(grfMode == 0x12, "grfMode = %lx\n", grfMode);
 
     hres = IBindCtx_GetObjectParam(pibc, cbinding_contextW, &unk);
-    ok(hres == S_OK, "GetObjectParam(CBinding Context) failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam(CBinding Context) failed: %08lx\n", hres);
     if(SUCCEEDED(hres)) {
         IBinding *binding;
 
         hres = IUnknown_QueryInterface(unk, &IID_IBinding, (void**)&binding);
-        ok(hres == S_OK, "Could not get IBinding: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IBinding: %08lx\n", hres);
 
         IBinding_Release(binding);
         IUnknown_Release(unk);
@@ -2233,7 +2233,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = RegisterBindStatusCallback(pibc, (IBindStatusCallback*)&bsc, NULL, 0);
-    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
@@ -2252,7 +2252,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
         SET_EXPECT(OnStopBinding);
 
     hres = IMoniker_BindToStorage(pimkName, pibc, NULL, &IID_IStream, (void**)&unk);
-    ok(hres == S_OK, "Load failed: %08x\n", hres);
+    ok(hres == S_OK, "Load failed: %08lx\n", hres);
 
     CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
     CHECK_CALLED(GetBindInfo);
@@ -2406,30 +2406,30 @@ static void test_CreateAsyncBindCtx(void)
     BIND_OPTS bindopts;
 
     hres = CreateAsyncBindCtx(0, NULL, NULL, &bctx);
-    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed. expected: E_INVALIDARG, got: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed. expected: E_INVALIDARG, got: %08lx\n", hres);
     ok(bctx == (IBindCtx*)0x0ff00ff0, "bctx should not be changed\n");
 
     hres = CreateAsyncBindCtx(0, NULL, NULL, NULL);
-    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed. expected: E_INVALIDARG, got: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed. expected: E_INVALIDARG, got: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
-    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     bindopts.cbStruct = sizeof(bindopts);
     hres = IBindCtx_GetBindOptions(bctx, &bindopts);
-    ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08x\n", hres);
+    ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08lx\n", hres);
     ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
-                "bindopts.grfFlags = %08x, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
+                "bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
     ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
-                "bindopts.grfMode = %08x, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
+                "bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
                 bindopts.grfMode);
     ok(bindopts.dwTickCountDeadline == 0,
-                "bindopts.dwTickCountDeadline = %08x, expected: 0\n", bindopts.dwTickCountDeadline);
+                "bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
 
     hres = IBindCtx_QueryInterface(bctx, &IID_IAsyncBindCtx, (void**)&unk);
-    ok(hres == E_NOINTERFACE, "QueryInterface(IID_IAsyncBindCtx) failed: %08x, expected E_NOINTERFACE\n", hres);
+    ok(hres == E_NOINTERFACE, "QueryInterface(IID_IAsyncBindCtx) failed: %08lx, expected E_NOINTERFACE\n", hres);
     if(SUCCEEDED(hres))
         IUnknown_Release(unk);
 
@@ -2452,41 +2452,41 @@ static void test_CreateAsyncBindCtxEx(void)
     }
 
     hres = pCreateAsyncBindCtxEx(NULL, 0, NULL, NULL, NULL, 0);
-    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = pCreateAsyncBindCtxEx(NULL, 0, NULL, NULL, &bctx, 0);
-    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         bindopts.cbStruct = sizeof(bindopts);
         hres = IBindCtx_GetBindOptions(bctx, &bindopts);
-        ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08x\n", hres);
+        ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08lx\n", hres);
         ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
-                "bindopts.grfFlags = %08x, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
+                "bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
         ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
-                "bindopts.grfMode = %08x, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
+                "bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
                 bindopts.grfMode);
         ok(bindopts.dwTickCountDeadline == 0,
-                "bindopts.dwTickCountDeadline = %08x, expected: 0\n", bindopts.dwTickCountDeadline);
+                "bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
 
         IBindCtx_Release(bctx);
     }
 
     CreateBindCtx(0, &bctx_arg);
     hres = pCreateAsyncBindCtxEx(NULL, 0, NULL, NULL, &bctx, 0);
-    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         bindopts.cbStruct = sizeof(bindopts);
         hres = IBindCtx_GetBindOptions(bctx, &bindopts);
-        ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08x\n", hres);
+        ok(hres == S_OK, "IBindCtx_GetBindOptions failed: %08lx\n", hres);
         ok(bindopts.grfFlags == BIND_MAYBOTHERUSER,
-                "bindopts.grfFlags = %08x, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
+                "bindopts.grfFlags = %08lx, expected: BIND_MAYBOTHERUSER\n", bindopts.grfFlags);
         ok(bindopts.grfMode == (STGM_READWRITE | STGM_SHARE_EXCLUSIVE),
-                "bindopts.grfMode = %08x, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
+                "bindopts.grfMode = %08lx, expected: STGM_READWRITE | STGM_SHARE_EXCLUSIVE\n",
                 bindopts.grfMode);
         ok(bindopts.dwTickCountDeadline == 0,
-                "bindopts.dwTickCountDeadline = %08x, expected: 0\n", bindopts.dwTickCountDeadline);
+                "bindopts.dwTickCountDeadline = %08lx, expected: 0\n", bindopts.dwTickCountDeadline);
 
         IBindCtx_Release(bctx);
     }
@@ -2495,27 +2495,27 @@ static void test_CreateAsyncBindCtxEx(void)
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = pCreateAsyncBindCtxEx(NULL, 0, (IBindStatusCallback*)&bsc, NULL, &bctx, 0);
-    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     hres = IBindCtx_QueryInterface(bctx, &IID_IAsyncBindCtx, (void**)&unk);
-    ok(hres == S_OK, "QueryInterface(IID_IAsyncBindCtx) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IAsyncBindCtx) failed: %08lx\n", hres);
     if(SUCCEEDED(hres))
         IUnknown_Release(unk);
 
     IBindCtx_Release(bctx);
 
     hres = CreateBindCtx(0, &bctx2);
-    ok(hres == S_OK, "CreateBindCtx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateBindCtx failed: %08lx\n", hres);
 
     hres = pCreateAsyncBindCtxEx(bctx2, 0, NULL, NULL, &bctx, 0);
-    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
 
     hres = IBindCtx_RegisterObjectParam(bctx2, testW, (IUnknown*)&Protocol);
-    ok(hres == S_OK, "RegisterObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterObjectParam failed: %08lx\n", hres);
 
     hres = IBindCtx_GetObjectParam(bctx, testW, &unk);
-    ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam failed: %08lx\n", hres);
     ok(unk == (IUnknown*)&Protocol, "unexpected unk %p\n", unk);
 
     IBindCtx_Release(bctx);
@@ -2541,7 +2541,7 @@ static void test_GetBindInfoEx(IBindStatusCallback *holder)
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
     SET_EXPECT(GetBindInfoEx);
     hres = IBindStatusCallback_GetBindInfo(holder, &bindf, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
     CHECK_CALLED(GetBindInfoEx);
 
@@ -2549,7 +2549,7 @@ static void test_GetBindInfoEx(IBindStatusCallback *holder)
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
     SET_EXPECT(GetBindInfoEx);
     hres = IBindStatusCallbackEx_GetBindInfoEx(bscex, &bindf, &bindinfo, &bindf2, &dw);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
     CHECK_CALLED(GetBindInfoEx);
 
@@ -2559,11 +2559,11 @@ static void test_GetBindInfoEx(IBindStatusCallback *holder)
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
     SET_EXPECT(GetBindInfo);
     hres = IBindStatusCallbackEx_GetBindInfoEx(bscex, &bindf, &bindinfo, &bindf2, &dw);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
     CHECK_CALLED(GetBindInfo);
-    ok(bindf2 == 0xdeadbeef, "bindf2 = %x\n", bindf2);
-    ok(dw == 0xdeadbeef, "dw = %x\n", dw);
+    ok(bindf2 == 0xdeadbeef, "bindf2 = %lx\n", bindf2);
+    ok(dw == 0xdeadbeef, "dw = %lx\n", dw);
 
     IBindStatusCallbackEx_Release(bscex);
 }
@@ -2583,13 +2583,13 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
     HRESULT hres;
 
     hres = IBindStatusCallback_QueryInterface(holder, &IID_IServiceProvider, (void**)&serv_prov);
-    ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IServiceProvider interface: %08lx\n", hres);
 
     dw = 0xdeadbeef;
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
     SET_EXPECT(GetBindInfo);
     hres = IBindStatusCallback_GetBindInfo(holder, &dw, &bindinfo);
-    ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+    ok(hres == S_OK, "GetBindInfo failed: %08lx\n", hres);
     CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
     CHECK_CALLED(GetBindInfo);
 
@@ -2597,16 +2597,16 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
 
     SET_EXPECT(OnStartBinding);
     hres = IBindStatusCallback_OnStartBinding(holder, 0, (void*)0xdeadbeef);
-    ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "OnStartBinding failed: %08lx\n", hres);
     CHECK_CALLED(OnStartBinding);
 
     hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate, (void**)&http_negotiate);
-    ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IHttpNegotiate);
     hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate, &IID_IHttpNegotiate,
                                          (void**)&http_negotiate_serv);
-    ok(hres == S_OK, "Could not get IHttpNegotiate service: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IHttpNegotiate service: %08lx\n", hres);
     CLEAR_CALLED(QueryInterface_IHttpNegotiate); /* IE <8 */
 
     ok(http_negotiate == http_negotiate_serv, "http_negotiate != http_negotiate_serv\n");
@@ -2617,14 +2617,14 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
     hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, current_url, emptyW, 0, &wstr);
     CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
     CHECK_CALLED(BeginningTransaction);
-    ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
+    ok(hres == S_OK, "BeginningTransaction failed: %08lx\n", hres);
     ok(wstr == NULL, "wstr = %p\n", wstr);
 
     IHttpNegotiate_Release(http_negotiate_serv);
 
     hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate, &IID_IHttpNegotiate,
                                          (void**)&http_negotiate_serv);
-    ok(hres == S_OK, "Could not get IHttpNegotiate service: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IHttpNegotiate service: %08lx\n", hres);
     ok(http_negotiate == http_negotiate_serv, "http_negotiate != http_negotiate_serv\n");
     IHttpNegotiate_Release(http_negotiate_serv);
 
@@ -2635,14 +2635,14 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
         SET_EXPECT(QueryInterface_IHttpNegotiate2);
         hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate2, &IID_IHttpNegotiate2,
                                              (void**)&http_negotiate2_serv);
-        ok(hres == S_OK, "Could not get IHttpNegotiate2 service: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IHttpNegotiate2 service: %08lx\n", hres);
         CLEAR_CALLED(QueryInterface_IHttpNegotiate2); /* IE <8 */
         ok(http_negotiate2 == http_negotiate2_serv, "http_negotiate != http_negotiate_serv\n");
 
         SET_EXPECT(QueryInterface_IHttpNegotiate2);
         SET_EXPECT(GetRootSecurityId);
         hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
-        ok(hres == E_NOTIMPL, "GetRootSecurityId failed: %08x\n", hres);
+        ok(hres == E_NOTIMPL, "GetRootSecurityId failed: %08lx\n", hres);
         CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2); /* IE8 */
         CHECK_CALLED(GetRootSecurityId);
 
@@ -2655,27 +2655,27 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
 
     SET_EXPECT(OnProgress_FINDINGRESOURCE);
     hres = IBindStatusCallback_OnProgress(holder, 0, 0, BINDSTATUS_FINDINGRESOURCE, NULL);
-    ok(hres == S_OK, "OnProgress failed: %08x\n", hres);
+    ok(hres == S_OK, "OnProgress failed: %08lx\n", hres);
     CHECK_CALLED(OnProgress_FINDINGRESOURCE);
 
     SET_EXPECT(QueryInterface_IHttpNegotiate);
     SET_EXPECT(OnResponse);
     wstr = (void*)0xdeadbeef;
     hres = IHttpNegotiate_OnResponse(http_negotiate, 200, emptyW, NULL, NULL);
-    ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
+    ok(hres == S_OK, "OnResponse failed: %08lx\n", hres);
     CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
     CHECK_CALLED(OnResponse);
 
     IHttpNegotiate_Release(http_negotiate);
 
     hres = IBindStatusCallback_QueryInterface(holder, &IID_IAuthenticate, (void**)&authenticate);
-    ok(hres == S_OK, "Could not get IAuthenticate interface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IAuthenticate interface: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IAuthenticate);
     SET_EXPECT(QueryService_IAuthenticate);
     hres = IServiceProvider_QueryService(serv_prov, &IID_IAuthenticate, &IID_IAuthenticate,
                                          (void**)&authenticate_serv);
-    ok(hres == S_OK, "Could not get IAuthenticate service: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IAuthenticate service: %08lx\n", hres);
     CLEAR_CALLED(QueryInterface_IAuthenticate); /* IE <8 */
     CLEAR_CALLED(QueryService_IAuthenticate); /* IE <8 */
     ok(authenticate == authenticate_serv, "authenticate != authenticate_serv\n");
@@ -2683,32 +2683,32 @@ static BOOL test_bscholder(IBindStatusCallback *holder)
 
     hres = IServiceProvider_QueryService(serv_prov, &IID_IAuthenticate, &IID_IAuthenticate,
                                          (void**)&authenticate_serv);
-    ok(hres == S_OK, "Could not get IAuthenticate service: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IAuthenticate service: %08lx\n", hres);
     ok(authenticate == authenticate_serv, "authenticate != authenticate_serv\n");
 
     IAuthenticate_Release(authenticate);
     IAuthenticate_Release(authenticate_serv);
 
     hres = IBindStatusCallback_QueryInterface(holder, &IID_IInternetBindInfo, (void**)&bind_info);
-    ok(hres == S_OK || broken(hres == E_NOINTERFACE /* win2k */), "Could not get IInternetBindInfo interface: %08x\n", hres);
+    ok(hres == S_OK || broken(hres == E_NOINTERFACE /* win2k */), "Could not get IInternetBindInfo interface: %08lx\n", hres);
 
     if(SUCCEEDED(hres)) {
         hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_USER_AGENT, &wstr, 1, &dw);
-        ok(hres == E_NOINTERFACE, "GetBindString(BINDSTRING_USER_AGENT) failed: %08x\n", hres);
+        ok(hres == E_NOINTERFACE, "GetBindString(BINDSTRING_USER_AGENT) failed: %08lx\n", hres);
 
         IInternetBindInfo_Release(bind_info);
     }
 
     SET_EXPECT(OnStopBinding);
     hres = IBindStatusCallback_OnStopBinding(holder, S_OK, NULL);
-    ok(hres == S_OK, "OnStopBinding failed: %08x\n", hres);
+    ok(hres == S_OK, "OnStopBinding failed: %08lx\n", hres);
     CHECK_CALLED(OnStopBinding);
 
     SET_EXPECT(QueryInterface_IInternetProtocol);
     SET_EXPECT(QueryService_IInternetProtocol);
     hres = IServiceProvider_QueryService(serv_prov, &IID_IInternetProtocol, &IID_IInternetProtocol,
                                          (void**)&protocol);
-    ok(hres == E_NOINTERFACE, "QueryService(IInternetProtocol) failed: %08x\n", hres);
+    ok(hres == E_NOINTERFACE, "QueryService(IInternetProtocol) failed: %08lx\n", hres);
     CHECK_CALLED(QueryInterface_IInternetProtocol);
     CHECK_CALLED(QueryService_IInternetProtocol);
 
@@ -2727,18 +2727,18 @@ static BOOL test_RegisterBindStatusCallback(void)
     strict_bsc_qi = TRUE;
 
     hres = CreateBindCtx(0, &bindctx);
-    ok(hres == S_OK, "BindCtx failed: %08x\n", hres);
+    ok(hres == S_OK, "BindCtx failed: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IServiceProvider);
 
     hres = IBindCtx_RegisterObjectParam(bindctx, BSCBHolder, (IUnknown*)&bsc);
-    ok(hres == S_OK, "RegisterObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterObjectParam failed: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IBindStatusCallback);
     SET_EXPECT(QueryInterface_IBindStatusCallbackHolder);
     prevbsc = (void*)0xdeadbeef;
     hres = RegisterBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc, &prevbsc, 0);
-    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08lx\n", hres);
     ok(prevbsc == (IBindStatusCallback*)&bsc, "prevbsc=%p\n", prevbsc);
     CHECK_CALLED(QueryInterface_IBindStatusCallback);
     CHECK_CALLED(QueryInterface_IBindStatusCallbackHolder);
@@ -2746,11 +2746,11 @@ static BOOL test_RegisterBindStatusCallback(void)
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     hres = IBindCtx_GetObjectParam(bindctx, BSCBHolder, &unk);
-    ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam failed: %08lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&clb);
     IUnknown_Release(unk);
-    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08lx\n", hres);
     ok(clb != (IBindStatusCallback*)&bsc, "bsc == clb\n");
 
     if(!test_bscholder(clb))
@@ -2759,53 +2759,53 @@ static BOOL test_RegisterBindStatusCallback(void)
     IBindStatusCallback_Release(clb);
 
     hres = RevokeBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc);
-    ok(hres == S_OK, "RevokeBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RevokeBindStatusCallback failed: %08lx\n", hres);
 
     unk = (void*)0xdeadbeef;
     hres = IBindCtx_GetObjectParam(bindctx, BSCBHolder, &unk);
-    ok(hres == E_FAIL, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == E_FAIL, "GetObjectParam failed: %08lx\n", hres);
     ok(unk == NULL, "unk != NULL\n");
 
     if(unk)
         IUnknown_Release(unk);
 
     hres = RevokeBindStatusCallback(bindctx, (void*)0xdeadbeef);
-    ok(hres == S_OK, "RevokeBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RevokeBindStatusCallback failed: %08lx\n", hres);
 
     hres = RevokeBindStatusCallback(NULL, (void*)0xdeadbeef);
-    ok(hres == E_INVALIDARG, "RevokeBindStatusCallback failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "RevokeBindStatusCallback failed: %08lx\n", hres);
 
     hres = RevokeBindStatusCallback(bindctx, NULL);
-    ok(hres == E_INVALIDARG, "RevokeBindStatusCallback failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "RevokeBindStatusCallback failed: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     prevbsc = (void*)0xdeadbeef;
     hres = RegisterBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc, &prevbsc, 0);
-    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08lx\n", hres);
     ok(!prevbsc, "prevbsc=%p\n", prevbsc);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     hres = IBindCtx_GetObjectParam(bindctx, BSCBHolder, &unk);
-    ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam failed: %08lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&prev_clb);
     IUnknown_Release(unk);
-    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08lx\n", hres);
     ok(prev_clb != (IBindStatusCallback*)&bsc, "bsc == clb\n");
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     prevbsc = (void*)0xdeadbeef;
     hres = RegisterBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc2, &prevbsc, 0);
-    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterBindStatusCallback failed: %08lx\n", hres);
     ok(prevbsc == (IBindStatusCallback*)&bsc, "prevbsc != bsc\n");
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     hres = IBindCtx_GetObjectParam(bindctx, BSCBHolder, &unk);
-    ok(hres == S_OK, "GetObjectParam failed: %08x\n", hres);
+    ok(hres == S_OK, "GetObjectParam failed: %08lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&clb);
     IUnknown_Release(unk);
-    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08lx\n", hres);
     ok(prev_clb  == clb, "bsc != clb\n");
 
     IBindStatusCallback_Release(clb);
@@ -2955,13 +2955,13 @@ static void test_MonikerComposeWith(void)
     CreateBindCtx(0, &bind);
     for(i = 0; i < ARRAY_SIZE( data ); i++){
         hres = CreateURLMoniker(NULL, data[i].l, &lmon);
-        ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+        ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
         hres = CreateURLMoniker(NULL, data[i].r, &rmon);
-        ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+        ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
 
         hres = IMoniker_ComposeWith(lmon, rmon, FALSE, &outmon);
         ok(hres == S_OK,
-            "ComposeWith failed: l: %s, r: %s, ret: %08x\n", wine_dbgstr_w(data[i].l), wine_dbgstr_w(data[i].r), hres);
+            "ComposeWith failed: l: %s, r: %s, ret: %08lx\n", wine_dbgstr_w(data[i].l), wine_dbgstr_w(data[i].r), hres);
 
         IMoniker_GetClassID(outmon, &clsid);
         ok(IsEqualCLSID(&clsid, &CLSID_StdURLMoniker),
@@ -2978,22 +2978,22 @@ static void test_MonikerComposeWith(void)
     IBindCtx_Release(bind);
 
     hres = CreateURLMoniker(NULL, data[0].l, &lmon);
-    ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+    ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
     hres = CreateURLMoniker(NULL, data[0].r, &rmon);
-    ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+    ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
     hres = CreateFileMoniker(L"/a/b", &filemon);
-    ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+    ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
 
     hres = IMoniker_ComposeWith(lmon, NULL, FALSE, &outmon);
-    ok(hres == E_INVALIDARG, "ComposeWith error: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "ComposeWith error: %08lx\n", hres);
 
     hres = IMoniker_ComposeWith(lmon, rmon, FALSE, NULL);
-    ok(hres == E_INVALIDARG, "ComposeWith error: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "ComposeWith error: %08lx\n", hres);
 
     hres = IMoniker_ComposeWith(lmon, filemon, TRUE, &outmon);
-    ok(hres == MK_E_NEEDGENERIC, "ComposeWith error: %08x\n", hres);
+    ok(hres == MK_E_NEEDGENERIC, "ComposeWith error: %08lx\n", hres);
     hres = IMoniker_ComposeWith(lmon, filemon, FALSE, &outmon);
-    ok(hres == S_OK, "ComposeWith error: %08x\n", hres);
+    ok(hres == S_OK, "ComposeWith error: %08lx\n", hres);
 
     IMoniker_GetClassID(outmon, &clsid);
     ok(IsEqualCLSID(&clsid, &CLSID_CompositeMoniker),
@@ -3022,18 +3022,18 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
 
     if(no_callback) {
         hres = CreateBindCtx(0, &bctx);
-        ok(hres == S_OK, "CreateBindCtx failed: %08x\n", hres);
+        ok(hres == S_OK, "CreateBindCtx failed: %08lx\n", hres);
     }else {
         SET_EXPECT(QueryInterface_IServiceProvider);
         hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
-        ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
+        ok(hres == S_OK, "CreateAsyncBindCtx failed: %08lx\n\n", hres);
         CHECK_CALLED(QueryInterface_IServiceProvider);
         if(FAILED(hres))
             return;
 
         SET_EXPECT(QueryInterface_IServiceProvider);
         hres = RegisterBindStatusCallback(bctx, (IBindStatusCallback*)&bsc, &previousclb, 0);
-        ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
+        ok(hres == S_OK, "RegisterBindStatusCallback failed: %08lx\n", hres);
         ok(previousclb == (IBindStatusCallback*)&bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc);
         CHECK_CALLED(QueryInterface_IServiceProvider);
         if(previousclb)
@@ -3041,7 +3041,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
     }
 
     hres = CreateURLMoniker(NULL, current_url, &mon);
-    ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+    ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
@@ -3058,7 +3058,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         IBinding_Release(bind);
 
     hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
-    ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
+    ok(hres == S_OK, "GetDisplayName failed %08lx\n", hres);
     ok(!lstrcmpW(display_name, current_url), "GetDisplayName got wrong name %s, expected %s\n",
        wine_dbgstr_w(display_name), wine_dbgstr_w(current_url));
     CoTaskMemFree(display_name);
@@ -3150,33 +3150,33 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
     }
 
     if(only_check_prot_args) {
-        ok(hres == E_FAIL, "Got %08x\n", hres);
+        ok(hres == E_FAIL, "Got %08lx\n", hres);
         CHECK_CALLED(OnStopBinding);
     } else if(abort_start)
-        ok(hres == abort_hres, "IMoniker_BindToStorage failed: %08x, expected %08x\n", hres, abort_hres);
+        ok(hres == abort_hres, "IMoniker_BindToStorage failed: %08lx, expected %08lx\n", hres, abort_hres);
     else if(abort_progress)
-        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08lx\n", hres);
     else if(no_callback) {
         if(emulate_protocol)
             ok( WaitForSingleObject(complete_event2, 90000) == WAIT_OBJECT_0, "wait timed out\n" );
-        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk != NULL, "unk == NULL\n");
     }else if(!(bindf & BINDF_ASYNCHRONOUS) && tymed == TYMED_FILE) {
-        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk == NULL, "unk != NULL\n");
     }else if(((bindf & BINDF_ASYNCHRONOUS) && !data_available)
        || (tymed == TYMED_FILE && test_protocol == FILE_TEST)) {
-        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk == NULL, "istr should be NULL\n");
     }else if(tymed == TYMED_FILE && test_protocol == ABOUT_TEST) {
         ok(hres == INET_E_DATA_NOT_AVAILABLE,
-           "IMoniker_BindToStorage failed: %08x, expected INET_E_DATA_NOT_AVAILABLE\n", hres);
+           "IMoniker_BindToStorage failed: %08lx, expected INET_E_DATA_NOT_AVAILABLE\n", hres);
         ok(unk == NULL, "istr should be NULL\n");
     }else if((flags & BINDTEST_INVALID_CN) && binding_hres != S_OK) {
-        ok(hres == binding_hres, "Got %08x\n", hres);
+        ok(hres == binding_hres, "Got %08lx\n", hres);
         ok(unk == NULL, "Got %p\n", unk);
     }else if((flags & BINDTEST_INVALID_CN) && invalid_cn_accepted) {
-        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk != NULL, "unk == NULL\n");
         if(unk == NULL) {
             ok(0, "Expected security problem to be ignored.\n");
@@ -3184,7 +3184,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
             binding_hres = INET_E_INVALID_CERTIFICATE;
         }
     }else {
-        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk != NULL, "unk == NULL\n");
     }
     if(unk && callback_read && !no_callback) {
@@ -3324,7 +3324,7 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
         IStream *stream;
 
         hres = IUnknown_QueryInterface(unk, &IID_IStream, (void**)&stream);
-        ok(hres == S_OK, "Could not get IStream iface: %08x\n", hres);
+        ok(hres == S_OK, "Could not get IStream iface: %08lx\n", hres);
         IUnknown_Release(unk);
 
         do {
@@ -3334,8 +3334,8 @@ static void test_BindToStorage(int protocol, DWORD flags, DWORD t)
             if(emulate_protocol && test_protocol == HTTP_TEST && read)
                 ok(buf[0] == (use_cache_file && !(bindf&BINDF_ASYNCHRONOUS) ? 'X' : '?'), "buf[0] = '%c'\n", buf[0]);
         }while(hres == S_OK);
-        ok(hres == S_FALSE, "IStream_Read returned %08x\n", hres);
-        ok(!read, "read = %d\n", read);
+        ok(hres == S_FALSE, "IStream_Read returned %08lx\n", hres);
+        ok(!read, "read = %ld\n", read);
 
         IStream_Release(stream);
     }
@@ -3361,13 +3361,13 @@ static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&objbsc, NULL, &bctx);
-    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08lx\n\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
     if(FAILED(hres))
         return;
 
     hres = CreateURLMoniker(NULL, current_url, &mon);
-    ok(hres == S_OK, "failed to create moniker: %08x\n", hres);
+    ok(hres == S_OK, "failed to create moniker: %08lx\n", hres);
     if(FAILED(hres)) {
         IBindCtx_Release(bctx);
         return;
@@ -3379,7 +3379,7 @@ static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
         IBinding_Release(bind);
 
     hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
-    ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
+    ok(hres == S_OK, "GetDisplayName failed %08lx\n", hres);
     ok(!lstrcmpW(display_name, current_url), "GetDisplayName got wrong name\n");
     CoTaskMemFree(display_name);
 
@@ -3448,13 +3448,13 @@ static void test_BindToObject(int protocol, DWORD flags, HRESULT exhres)
     }
 
     if(FAILED(exhres)) {
-        ok(hres == exhres, "BindToObject failed:  %08x, expected %08x\n", hres, exhres);
+        ok(hres == exhres, "BindToObject failed:  %08lx, expected %08lx\n", hres, exhres);
         ok(!unk, "unk = %p, expected NULL\n", unk);
     }else if(bindf & BINDF_ASYNCHRONOUS) {
-        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToObject failed: %08x\n", hres);
+        ok(hres == MK_S_ASYNCHRONOUS, "IMoniker_BindToObject failed: %08lx\n", hres);
         ok(unk == NULL, "istr should be NULL\n");
     }else {
-        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK, "IMoniker_BindToStorage failed: %08lx\n", hres);
         ok(unk != NULL, "unk == NULL\n");
         if(emulate_protocol)
             ok(unk == (IUnknown*)&PersistMoniker, "unk != PersistMoniker\n");
@@ -3588,7 +3588,7 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
     }
 
     hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
-    ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
+    ok(hres == S_OK, "URLDownloadToFile failed: %08lx\n", hres);
 
     CHECK_CALLED(GetBindInfo);
     CHECK_CALLED(QueryInterface_IInternetProtocol);
@@ -3635,16 +3635,16 @@ static void test_URLDownloadToFile(DWORD prot, BOOL emul)
     }
 
     res = DeleteFileA(dwl_htmlA);
-    ok(res, "DeleteFile failed: %u\n", GetLastError());
+    ok(res, "DeleteFile failed: %lu\n", GetLastError());
 
     if(prot != FILE_TEST || emul)
         return;
 
     hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, NULL);
-    ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
+    ok(hres == S_OK, "URLDownloadToFile failed: %08lx\n", hres);
 
     res = DeleteFileA(dwl_htmlA);
-    ok(res, "DeleteFile failed: %u\n", GetLastError());
+    ok(res, "DeleteFile failed: %lu\n", GetLastError());
 }
 
 static void test_URLDownloadToFile_abort(void)
@@ -3668,7 +3668,7 @@ static void test_URLDownloadToFile_abort(void)
     SET_EXPECT(OnStopBinding);
 
     hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
-    ok(hres == E_ABORT, "URLDownloadToFile failed: %08x, expected E_ABORT\n", hres);
+    ok(hres == E_ABORT, "URLDownloadToFile failed: %08lx, expected E_ABORT\n", hres);
 
     CHECK_CALLED(GetBindInfo);
     CHECK_CALLED(QueryInterface_IInternetProtocol);
@@ -3695,7 +3695,7 @@ static void test_URLDownloadToFile_abort(void)
 
     abort_hres = E_ABORT;
     hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
-    ok(hres == E_ABORT, "URLDownloadToFile failed: %08x, expected E_ABORT\n", hres);
+    ok(hres == E_ABORT, "URLDownloadToFile failed: %08lx, expected E_ABORT\n", hres);
 
     CHECK_CALLED(GetBindInfo);
     todo_wine CHECK_CALLED(QueryInterface_IInternetProtocol);
@@ -3730,7 +3730,7 @@ static void test_URLDownloadToFile_abort(void)
      */
     abort_hres = E_NOTIMPL;
     hres = URLDownloadToFileW(NULL, current_url, dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
-    ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
+    ok(hres == S_OK, "URLDownloadToFile failed: %08lx\n", hres);
 
     CHECK_CALLED(GetBindInfo);
     CHECK_CALLED(QueryInterface_IInternetProtocol);
@@ -3827,11 +3827,11 @@ static void test_ReportResult(HRESULT exhres)
     binding_hres = exhres;
 
     hres = CreateURLMoniker(NULL, about_blankW, &mon);
-    ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
-    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08lx\n\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
@@ -3844,10 +3844,10 @@ static void test_ReportResult(HRESULT exhres)
 
     hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
     if(SUCCEEDED(exhres))
-        ok(hres == S_OK || hres == MK_S_ASYNCHRONOUS, "BindToStorage failed: %08x\n", hres);
+        ok(hres == S_OK || hres == MK_S_ASYNCHRONOUS, "BindToStorage failed: %08lx\n", hres);
     else
         ok(hres == exhres || hres == MK_S_ASYNCHRONOUS,
-           "BindToStorage failed: %08x, expected %08x or MK_S_ASYNCHRONOUS\n", hres, exhres);
+           "BindToStorage failed: %08lx, expected %08lx or MK_S_ASYNCHRONOUS\n", hres, exhres);
 
     CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
     CHECK_CALLED(GetBindInfo);
@@ -3871,17 +3871,17 @@ static void test_BindToStorage_fail(void)
     HRESULT hres;
 
     hres = CreateURLMoniker(NULL, about_blankW, &mon);
-    ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = pCreateAsyncBindCtxEx(NULL, 0, NULL, NULL, &bctx, 0);
-    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08lx\n", hres);
 
     unk = (void*)0xdeadbeef;
     hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
     ok(hres == MK_E_SYNTAX || hres == INET_E_DATA_NOT_AVAILABLE,
-       "hres=%08x, expected MK_E_SYNTAX or INET_E_DATA_NOT_AVAILABLE\n", hres);
+       "hres=%08lx, expected MK_E_SYNTAX or INET_E_DATA_NOT_AVAILABLE\n", hres);
     ok(unk == NULL, "got %p\n", unk);
 
     IBindCtx_Release(bctx);
@@ -3902,29 +3902,29 @@ static void test_StdURLMoniker(void)
 
     hres = CoCreateInstance(&IID_IInternet, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
             &IID_IMoniker, (void**)&mon);
-    ok(hres == S_OK, "Could not create IInternet instance: %08x\n", hres);
+    ok(hres == S_OK, "Could not create IInternet instance: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IMoniker_QueryInterface(mon, &IID_IAsyncMoniker, (void**)&async_mon);
-    ok(hres == S_OK, "Could not get IAsyncMoniker iface: %08x\n", hres);
+    ok(hres == S_OK, "Could not get IAsyncMoniker iface: %08lx\n", hres);
     ok(mon == async_mon, "mon != async_mon\n");
     IMoniker_Release(async_mon);
 
     hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
-    ok(hres == E_OUTOFMEMORY, "GetDisplayName failed: %08x, expected E_OUTOFMEMORY\n", hres);
+    ok(hres == E_OUTOFMEMORY, "GetDisplayName failed: %08lx, expected E_OUTOFMEMORY\n", hres);
 
     if(pCreateUri) {
       IUriContainer *uri_container;
       IUri *uri;
 
       hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
-      ok(hres == S_OK, "Could not get IUriMoniker iface: %08x\n", hres);
+      ok(hres == S_OK, "Could not get IUriMoniker iface: %08lx\n", hres);
 
 
       uri = (void*)0xdeadbeef;
       hres = IUriContainer_GetIUri(uri_container, &uri);
-      ok(hres == S_FALSE, "GetIUri failed: %08x\n", hres);
+      ok(hres == S_FALSE, "GetIUri failed: %08lx\n", hres);
       ok(!uri, "uri = %p, expected NULL\n", uri);
 
       IUriContainer_Release(uri_container);
@@ -3932,18 +3932,18 @@ static void test_StdURLMoniker(void)
 
     SET_EXPECT(QueryInterface_IServiceProvider);
     hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
-    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
+    ok(hres == S_OK, "CreateAsyncBindCtx failed: %08lx\n\n", hres);
     CHECK_CALLED(QueryInterface_IServiceProvider);
 
     if(pCreateUri) { /* Skip these tests on old IEs */
         unk = (void*)0xdeadbeef;
         hres = IMoniker_BindToStorage(mon, bctx, NULL, &IID_IStream, (void**)&unk);
-        ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08x, expected MK_E_SYNTAX\n", hres);
+        ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08lx, expected MK_E_SYNTAX\n", hres);
         ok(!unk, "unk = %p\n", unk);
 
         unk = (void*)0xdeadbeef;
         hres = IMoniker_BindToObject(mon, bctx, NULL, &IID_IUnknown, (void**)&unk);
-        ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08x, expected MK_E_SYNTAX\n", hres);
+        ok(hres == MK_E_SYNTAX, "BindToStorage failed: %08lx, expected MK_E_SYNTAX\n", hres);
         ok(!unk, "unk = %p\n", unk);
     }
 
@@ -3958,13 +3958,13 @@ static void register_protocols(void)
     static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
 
     hres = CoInternetGetSession(0, &session, 0);
-    ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
+    ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
     if(FAILED(hres))
         return;
 
     hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
             winetestW, 0, NULL, 0);
-    ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+    ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
 
     IInternetSession_Release(session);
 }
@@ -3988,7 +3988,7 @@ static BOOL can_do_https(void)
     ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
     ok(ret || broken(GetLastError() == ERROR_INTERNET_CANNOT_CONNECT)
            || broken(GetLastError() == ERROR_INTERNET_SECURITY_CHANNEL_ERROR) /* WinXP */,
-        "request failed: %u\n", GetLastError());
+        "request failed: %lu\n", GetLastError());
 
     InternetCloseHandle(req);
     InternetCloseHandle(con);




More information about the wine-devel mailing list