[PATCH 16/25] dlls/shlwapi/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Sat Mar 5 05:08:08 CST 2022


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

---
 dlls/shlwapi/tests/Makefile.in |    1 
 dlls/shlwapi/tests/assoc.c     |   50 +++----
 dlls/shlwapi/tests/clist.c     |    4 -
 dlls/shlwapi/tests/clsid.c     |   10 +
 dlls/shlwapi/tests/istream.c   |  258 +++++++++++++++++-----------------
 dlls/shlwapi/tests/ordinal.c   |  306 ++++++++++++++++++++--------------------
 dlls/shlwapi/tests/path.c      |  210 ++++++++++++++-------------
 dlls/shlwapi/tests/shreg.c     |  104 +++++++-------
 dlls/shlwapi/tests/string.c    |   52 +++----
 dlls/shlwapi/tests/thread.c    |   34 ++--
 dlls/shlwapi/tests/url.c       |  276 ++++++++++++++++++------------------
 11 files changed, 652 insertions(+), 653 deletions(-)

diff --git a/dlls/shlwapi/tests/Makefile.in b/dlls/shlwapi/tests/Makefile.in
index 5c026fd6e5d..450a3955489 100644
--- a/dlls/shlwapi/tests/Makefile.in
+++ b/dlls/shlwapi/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = shlwapi.dll
 IMPORTS   = shlwapi shell32 mlang oleaut32 ole32 user32 advapi32
 
diff --git a/dlls/shlwapi/tests/assoc.c b/dlls/shlwapi/tests/assoc.c
index 4b461128dc4..84eda1317bb 100644
--- a/dlls/shlwapi/tests/assoc.c
+++ b/dlls/shlwapi/tests/assoc.c
@@ -23,8 +23,8 @@
 #include "shlwapi.h"
 #include "shlguid.h"
 
-#define expect(expected, got) ok ( expected == got, "Expected %d, got %d\n", expected, got)
-#define expect_hr(expected, got) ok ( expected == got, "Expected %08x, got %08x\n", expected, got)
+#define expect(expected, got) ok ( expected == got, "Expected %ld, got %ld\n", expected, got)
+#define expect_hr(expected, got) ok ( expected == got, "Expected %08lx, got %08lx\n", expected, got)
 
 static HRESULT (WINAPI *pAssocQueryStringA)(ASSOCF,ASSOCSTR,LPCSTR,LPCSTR,LPSTR,LPDWORD) = NULL;
 static HRESULT (WINAPI *pAssocQueryStringW)(ASSOCF,ASSOCSTR,LPCWSTR,LPCWSTR,LPWSTR,LPDWORD) = NULL;
@@ -53,24 +53,24 @@ static void test_getstring_bad(void)
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len);
     expect_hr(E_INVALIDARG, hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len);
     ok(hr == E_FAIL ||
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
-       "Unexpected result : %08x\n", hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+       "Unexpected result : %08lx\n", hr);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     len = ARRAY_SIZE(buf);
     hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, buf, &len);
     ok(hr == E_FAIL ||
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
        hr == S_OK /* Win8 */,
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
     if (hr == S_OK)
     {
-        ok(len < ARRAY_SIZE(buf), "got %u\n", len);
+        ok(len < ARRAY_SIZE(buf), "got %lu\n", len);
         ok(!lstrcmpiW(buf + len - ARRAY_SIZE(openwith), openwith), "wrong data\n");
     }
 
@@ -78,25 +78,25 @@ static void test_getstring_bad(void)
     hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, &len);
     ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
-       "Unexpected result : %08x\n", hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+       "Unexpected result : %08lx\n", hr);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL);
     ok(hr == E_UNEXPECTED ||
        hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
 
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len);
     expect_hr(E_INVALIDARG, hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, &len);
     ok(hr == E_FAIL ||
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
-       "Unexpected result : %08x\n", hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+       "Unexpected result : %08lx\n", hr);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, &len);
@@ -104,22 +104,22 @@ static void test_getstring_bad(void)
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ ||
        hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND) /* Win8 */ ||
        hr == S_FALSE, /* Win10 */
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
     ok((hr == S_FALSE && len < ARRAY_SIZE(buf)) || len == 0xdeadbeef,
-       "got hr=%08x and len=%u\n", hr, len);
+       "got hr=%08lx and len=%lu\n", hr, len);
 
     len = 0xdeadbeef;
     hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, &len);
     ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
        hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */
        hr == E_FAIL, /* Win9x/WinMe/NT4 */
-       "Unexpected result : %08x\n", hr);
-    ok(len == 0xdeadbeef, "got %u\n", len);
+       "Unexpected result : %08lx\n", hr);
+    ok(len == 0xdeadbeef, "got %lu\n", len);
 
     hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, NULL);
     ok(hr == E_UNEXPECTED ||
        hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
 }
 
 static void test_getstring_basic(void)
@@ -164,7 +164,7 @@ static void test_getstring_basic(void)
     ok(hr == S_FALSE ||
        hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* Win9x/NT4 */ ||
        hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), /* Win8 */
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
     if (hr != S_FALSE)
     {
         HeapFree(GetProcessHeap(), 0, executableName);
@@ -255,7 +255,7 @@ static void test_getstring_no_extra(void)
     hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, NULL, buf, &len);
     ok(hr == S_OK ||
        hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), /* XP and W2K3 */
-       "Unexpected result : %08x\n", hr);
+       "Unexpected result : %08lx\n", hr);
     hr = pAssocQueryStringA(0, ASSOCSTR_EXECUTABLE, dotWinetest, "foo", buf, &len);
     expect_hr(S_OK, hr);
     ok(strstr(buf, action) != NULL,
@@ -279,19 +279,19 @@ static void test_assoc_create(void)
     }
 
     hr = pAssocCreate(IID_NULL, &IID_NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected result : %08x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected result : %08lx\n", hr);
 
     hr = pAssocCreate(CLSID_QueryAssociations, &IID_NULL, (LPVOID*)&pqa);
     ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_NOINTERFACE
-        , "Unexpected result : %08x\n", hr);
+        , "Unexpected result : %08lx\n", hr);
 
     hr = pAssocCreate(IID_NULL, &IID_IQueryAssociations, (LPVOID*)&pqa);
     ok(hr == CLASS_E_CLASSNOTAVAILABLE || hr == E_NOTIMPL || hr == E_INVALIDARG
-        , "Unexpected result : %08x\n", hr);
+        , "Unexpected result : %08lx\n", hr);
 
     hr = pAssocCreate(CLSID_QueryAssociations, &IID_IQueryAssociations, (LPVOID*)&pqa);
     ok(hr == S_OK  || hr == E_NOTIMPL /* win98 */
-        , "Unexpected result : %08x\n", hr);
+        , "Unexpected result : %08lx\n", hr);
     if(hr == S_OK)
     {
         IQueryAssociations_Release(pqa);
@@ -299,7 +299,7 @@ static void test_assoc_create(void)
 
     hr = pAssocCreate(CLSID_QueryAssociations, &IID_IUnknown, (LPVOID*)&pqa);
     ok(hr == S_OK  || hr == E_NOTIMPL /* win98 */
-        , "Unexpected result : %08x\n", hr);
+        , "Unexpected result : %08lx\n", hr);
     if(hr == S_OK)
     {
         IQueryAssociations_Release(pqa);
diff --git a/dlls/shlwapi/tests/clist.c b/dlls/shlwapi/tests/clist.c
index 0c914d608e5..5f88e92a5a6 100644
--- a/dlls/shlwapi/tests/clist.c
+++ b/dlls/shlwapi/tests/clist.c
@@ -328,7 +328,7 @@ static void test_CList(void)
       else if (inserted)
       {
         ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
-           "id %d wrong size %d\n", inserted->dwSignature, inserted->cbSize);
+           "id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
       }
       if (inserted)
       {
@@ -449,7 +449,7 @@ static void test_CList(void)
       else if (inserted)
       {
         ok(inserted->cbSize == item->cbSize + sizeof(DATABLOCK_HEADER),
-           "id %d wrong size %d\n", inserted->dwSignature, inserted->cbSize);
+           "id %ld wrong size %ld\n", inserted->dwSignature, inserted->cbSize);
       }
       ok(!inserted || inserted->dwSignature == item->dwSignature, "find got wrong item\n");
       if (inserted)
diff --git a/dlls/shlwapi/tests/clsid.c b/dlls/shlwapi/tests/clsid.c
index 7f2d375a35b..46b2a0b0185 100644
--- a/dlls/shlwapi/tests/clsid.c
+++ b/dlls/shlwapi/tests/clsid.c
@@ -116,7 +116,7 @@ static void test_ClassIDs(void)
   {
     dwLen = pSHStringFromGUIDA(*guids, szBuff, 256);
     if (!i && dwLen == S_OK) is_vista = TRUE;  /* seems to return an HRESULT on vista */
-    ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i);
+    ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for id %d\n", dwLen, i);
 
     bRet = pGUIDFromStringA(szBuff, &guid);
     ok(bRet != FALSE, "created invalid string '%s'\n", szBuff);
@@ -130,7 +130,7 @@ static void test_ClassIDs(void)
 
   /* Test endianness */
   dwLen = pSHStringFromGUIDA(&IID_Endianness, szBuff, 256);
-  ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for IID_Endianness\n", dwLen);
+  ok(dwLen == (is_vista ? S_OK : 39), "wrong size %lu for IID_Endianness\n", dwLen);
 
   ok(!strcmp(szBuff, "{01020304-0506-0708-090A-0B0C0D0E0F0A}"),
      "Endianness Broken, got '%s'\n", szBuff);
@@ -171,14 +171,14 @@ static void test_CLSIDFromProgIDWrap(void)
     pCLSIDFromProgIDWrap = (void*)GetProcAddress(hShlwapi,(char*)435);
 
     hres = pCLSIDFromProgIDWrap(wszStdPicture, &clsid);
-    ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08x\n", hres);
+    ok(hres == S_OK, "CLSIDFromProgIDWrap failed: %08lx\n", hres);
     ok(IsEqualGUID(&CLSID_StdPicture, &clsid), "wrong clsid\n");
 
     hres = pCLSIDFromProgIDWrap(NULL, &clsid);
-    ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
 
     hres = pCLSIDFromProgIDWrap(wszStdPicture, NULL);
-    ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08x, expected E_INVALIDARG\n", hres);
+    ok(hres == E_INVALIDARG, "CLSIDFromProgIDWrap failed: %08lx, expected E_INVALIDARG\n", hres);
 }
 
 START_TEST(clsid)
diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c
index 4894eabdf50..8ccb3775fa0 100644
--- a/dlls/shlwapi/tests/istream.c
+++ b/dlls/shlwapi/tests/istream.c
@@ -51,16 +51,16 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
     /* IStream_Read from the COBJMACROS is undefined by shlwapi.h, replaced by the IStream_Read helper function. */
 
     ret = stream->lpVtbl->Read(stream, NULL, 0, &count);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = stream->lpVtbl->Read(stream, data, 5, NULL);
-    ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
+    ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08lx\n", ret);
 
     ret = stream->lpVtbl->Read(stream, data, 0, NULL);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = stream->lpVtbl->Read(stream, data, 3, &count);
-    ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08x\n", ret);
+    ok(ret == S_FALSE || ret == S_OK, "expected S_FALSE or S_OK, got 0x%08lx\n", ret);
 
     /* IStream::Write */
 
@@ -70,104 +70,104 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
     if (mode == STGM_READ)
     {
         ok(ret == STG_E_ACCESSDENIED /* XP */ || broken(ret == S_OK) /* Win2000 + IE5 */,
-           "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
+           "expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
     }
     else
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     strcpy(data, "Hello");
     ret = stream->lpVtbl->Write(stream, data, 5, NULL);
     if (mode == STGM_READ)
         ok(ret == STG_E_ACCESSDENIED,
-           "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
+           "expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
     else
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     strcpy(data, "Hello");
     ret = stream->lpVtbl->Write(stream, data, 0, NULL);
     if (mode == STGM_READ)
         ok(ret == STG_E_ACCESSDENIED,
-           "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
+           "expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
     else
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     strcpy(data, "Hello");
     ret = stream->lpVtbl->Write(stream, data, 0, &count);
     if (mode == STGM_READ)
         ok(ret == STG_E_ACCESSDENIED,
-           "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
+           "expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
     else
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     strcpy(data, "Hello");
     ret = stream->lpVtbl->Write(stream, data, 3, &count);
     if (mode == STGM_READ)
         ok(ret == STG_E_ACCESSDENIED,
-           "expected STG_E_ACCESSDENIED, got 0x%08x\n", ret);
+           "expected STG_E_ACCESSDENIED, got 0x%08lx\n", ret);
     else
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     /* IStream::Seek */
 
     ret = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = IStream_Seek(stream, zero, 20, NULL);
     ok(ret == E_INVALIDARG,
-       "expected E_INVALIDARG, got 0x%08x\n", ret);
+       "expected E_INVALIDARG, got 0x%08lx\n", ret);
 
     /* IStream::CopyTo */
 
     ret = IStream_CopyTo(stream, NULL, uzero, &uret, &uret);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     clone = NULL;
     ret = IStream_CopyTo(stream, clone, uzero, &uret, &uret);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = IStream_CopyTo(stream, stream, uzero, &uret, &uret);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = IStream_CopyTo(stream, stream, uzero, &uret, NULL);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     ret = IStream_CopyTo(stream, stream, uzero, NULL, &uret);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     /* IStream::Commit */
 
     ret = IStream_Commit(stream, STGC_DEFAULT);
-    ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
     /* IStream::Revert */
 
     ret = IStream_Revert(stream);
-    ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
+    ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
 
     /* IStream::LockRegion */
 
     ret = IStream_LockRegion(stream, uzero, uzero, 0);
     ok(ret == E_NOTIMPL /* XP */ || ret == S_OK /* Vista */,
-      "expected E_NOTIMPL or S_OK, got 0x%08x\n", ret);
+      "expected E_NOTIMPL or S_OK, got 0x%08lx\n", ret);
 
     /* IStream::UnlockRegion */
 
     if (ret == E_NOTIMPL) /* XP */ {
         ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
-        ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
+        ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
     } else /* Vista */ {
         ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
-        ok(ret == S_OK, "expected S_OK, got 0x%08x\n", ret);
+        ok(ret == S_OK, "expected S_OK, got 0x%08lx\n", ret);
 
         ret = IStream_UnlockRegion(stream, uzero, uzero, 0);
-        ok(ret == STG_E_LOCKVIOLATION, "expected STG_E_LOCKVIOLATION, got 0x%08x\n", ret);
+        ok(ret == STG_E_LOCKVIOLATION, "expected STG_E_LOCKVIOLATION, got 0x%08lx\n", ret);
     }
 
     /* IStream::Stat */
 
     ret = IStream_Stat(stream, NULL, 0);
     ok(ret == STG_E_INVALIDPOINTER,
-       "expected STG_E_INVALIDPOINTER or E_NOTIMPL, got 0x%08x\n", ret);
+       "expected STG_E_INVALIDPOINTER or E_NOTIMPL, got 0x%08lx\n", ret);
 
     /* IStream::Clone */
 
@@ -175,12 +175,12 @@ static void test_IStream_invalid_operations(IStream * stream, DWORD mode)
 
     clone = NULL;
     ret = IStream_Clone(stream, &clone);
-    ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08x\n", ret);
+    ok(ret == E_NOTIMPL, "expected E_NOTIMPL, got 0x%08lx\n", ret);
     ok(clone == NULL, "expected a NULL IStream object, got %p\n", stream);
 
     if (clone) {
         refcount = IStream_Release(clone);
-        ok(refcount == 0, "expected 0, got %d\n", refcount);
+        ok(refcount == 0, "expected 0, got %ld\n", refcount);
     }
 }
 
@@ -199,63 +199,63 @@ static void test_stream_read_write(IStream *stream, DWORD mode)
     ret = stream->lpVtbl->Write(stream, "\x5e\xa7", 2, &written);
     if (mode == STGM_WRITE || mode == STGM_READWRITE)
     {
-        ok(ret == S_OK, "IStream_Write error %#x (access %#x)\n", ret, mode);
-        ok(written == 2, "expected 2, got %u\n", written);
+        ok(ret == S_OK, "IStream_Write error %#lx (access %#lx)\n", ret, mode);
+        ok(written == 2, "expected 2, got %lu\n", written);
     }
     else
     {
-        ok(ret == STG_E_ACCESSDENIED || broken(ret == S_OK) /* win2000 */, "expected STG_E_ACCESSDENIED, got %#x (access %#x)\n", ret, mode);
-        ok(written == 0xdeadbeaf || broken(written == 2) /* win2000 */, "expected 0xdeadbeaf, got %#x\n", written);
+        ok(ret == STG_E_ACCESSDENIED || broken(ret == S_OK) /* win2000 */, "expected STG_E_ACCESSDENIED, got %#lx (access %#lx)\n", ret, mode);
+        ok(written == 0xdeadbeaf || broken(written == 2) /* win2000 */, "expected 0xdeadbeaf, got %#lx\n", written);
         written = 0;
         if (ret == S_OK) return; /* no point in further testing */
     }
 
     ret = stream->lpVtbl->Seek(stream, start, STREAM_SEEK_SET, NULL);
-    ok(ret == S_OK, "Seek error %#x\n", ret);
+    ok(ret == S_OK, "Seek error %#lx\n", ret);
 
     count = 0xdeadbeaf;
     ret = stream->lpVtbl->Read(stream, buf, 2, &count);
     if (written != 0)
     {
-        ok(ret == S_OK || broken(ret == S_FALSE) /* win2000 */, "IStream_Read error %#x (access %#x, written %u)\n", ret, mode, written);
+        ok(ret == S_OK || broken(ret == S_FALSE) /* win2000 */, "IStream_Read error %#lx (access %#lx, written %lu)\n", ret, mode, written);
         if (ret == S_OK && (mode == STGM_WRITE || mode == STGM_READWRITE))
         {
-            ok(count == 2, "expected 2, got %u\n", count);
+            ok(count == 2, "expected 2, got %lu\n", count);
             ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]);
         }
         else
-            ok(count == 0, "expected 0, got %u\n", count);
+            ok(count == 0, "expected 0, got %lu\n", count);
     }
     else
     {
-        ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
-        ok(count == 0, "expected 0, got %u\n", count);
+        ok(ret == S_FALSE, "expected S_FALSE, got %#lx (access %#lx, written %lu)\n", ret, mode, written);
+        ok(count == 0, "expected 0, got %lu\n", count);
     }
 
     ret = stream->lpVtbl->Seek(stream, start, STREAM_SEEK_SET, NULL);
-    ok(ret == S_OK, "Seek error %#x\n", ret);
+    ok(ret == S_OK, "Seek error %#lx\n", ret);
 
     count = 0xdeadbeaf;
     ret = stream->lpVtbl->Read(stream, buf, 0, &count);
-    ok(ret == S_OK, "IStream_Read error %#x (access %#x, written %u)\n", ret, mode, written);
-    ok(count == 0, "expected 0, got %u\n", count);
+    ok(ret == S_OK, "IStream_Read error %#lx (access %#lx, written %lu)\n", ret, mode, written);
+    ok(count == 0, "expected 0, got %lu\n", count);
 
     count = 0xdeadbeaf;
     ret = stream->lpVtbl->Read(stream, buf, sizeof(buf), &count);
-    ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
-    ok(count == written, "expected %u, got %u\n", written, count);
+    ok(ret == S_FALSE, "expected S_FALSE, got %#lx (access %#lx, written %lu)\n", ret, mode, written);
+    ok(count == written, "expected %lu, got %lu\n", written, count);
     if (count)
         ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]);
 
     memset(&statstg, 0xff, sizeof(statstg));
     ret = IStream_Stat(stream, &statstg, 0);
-    ok(ret == S_OK, "Stat failed, hr %#x.\n", ret);
+    ok(ret == S_OK, "Stat failed, hr %#lx.\n", ret);
     ok(statstg.pwcsName != NULL, "Unexpected name %s.\n", wine_dbgstr_w(statstg.pwcsName));
     CoTaskMemFree(statstg.pwcsName);
 
     memset(&statstg, 0xff, sizeof(statstg));
     ret = IStream_Stat(stream, &statstg, STATFLAG_NONAME);
-    ok(ret == S_OK, "Stat failed, hr %#x.\n", ret);
+    ok(ret == S_OK, "Stat failed, hr %#lx.\n", ret);
     ok(statstg.pwcsName == NULL, "Unexpected name %s.\n", wine_dbgstr_w(statstg.pwcsName));
 }
 
@@ -265,17 +265,17 @@ static void test_stream_qi(IStream *stream)
     HRESULT hr;
 
     hr = IStream_QueryInterface(stream, &IID_IStream, (void **)&unk);
-    ok(SUCCEEDED(hr), "Failed to get IStream interface, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to get IStream interface, hr %#lx.\n", hr);
     IUnknown_Release(unk);
 
     unk = NULL;
     hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk);
-    ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* XP */, "Failed to get ISequentialStream interface, hr %#lx.\n", hr);
     if (unk)
         IUnknown_Release(unk);
 
     hr = IStream_QueryInterface(stream, &IID_IUnknown, (void **)&unk);
-    ok(SUCCEEDED(hr), "Failed to get IUnknown interface, hr %#x.\n", hr);
+    ok(SUCCEEDED(hr), "Failed to get IUnknown interface, hr %#lx.\n", hr);
     IUnknown_Release(unk);
 }
 
@@ -287,7 +287,7 @@ static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
     char test_file[MAX_PATH];
     static const CHAR testA_txt[] = "\\testA.txt";
 
-    trace("SHCreateStreamOnFileA: testing mode %d, STGM flags %08x\n", mode, stgm);
+    trace("SHCreateStreamOnFileA: testing mode %ld, STGM flags %08lx\n", mode, stgm);
 
     /* Don't used a fixed path for the testA.txt file */
     GetTempPathA(MAX_PATH, test_file);
@@ -305,40 +305,40 @@ static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
     ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) /* NT */ ||
        ret == HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME) /* 9x */,
        "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) "
-       "or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08x\n", ret);
+       "or HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME), got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
 
 if (0) /* This test crashes on WinXP SP2 */
 {
     ret = SHCreateStreamOnFileA(test_file, mode | stgm, NULL);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
 }
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_CONVERT | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_DELETEONRELEASE | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_TRANSACTED | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileA: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
 
     /* file does not exist */
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
-    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
+    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileA: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileA: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_CREATE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
 
     if (stream) {
@@ -346,7 +346,7 @@ if (0) /* This test crashes on WinXP SP2 */
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
     }
 
     /* NOTE: don't delete the file, as it will be used for the file exists tests. */
@@ -355,19 +355,19 @@ if (0) /* This test crashes on WinXP SP2 */
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
     }
 
     stream = NULL;
     ret = SHCreateStreamOnFileA(test_file, mode | STGM_CREATE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileA: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
 
     if (stream) {
@@ -377,10 +377,10 @@ if (0) /* This test crashes on WinXP SP2 */
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %ld\n", refcount);
 
         delret = DeleteFileA(test_file);
-        ok(delret, "SHCreateStreamOnFileA: could not delete file '%s', got error %d\n",
+        ok(delret, "SHCreateStreamOnFileA: could not delete file '%s', got error %ld\n",
            test_file, GetLastError());
     }
 }
@@ -395,7 +395,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
     CHAR  test_fileA[MAX_PATH];
     static const CHAR testW_txt[] = "\\testW.txt";
 
-    trace("SHCreateStreamOnFileW: testing mode %d, STGM flags %08x\n", mode, stgm);
+    trace("SHCreateStreamOnFileW: testing mode %ld, STGM flags %08lx\n", mode, stgm);
 
     /* Don't used a fixed path for the testW.txt file */
     GetTempPathA(MAX_PATH, test_fileA);
@@ -411,7 +411,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
         ret = SHCreateStreamOnFileW(NULL, mode | stgm, &stream);
         ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
            ret == E_INVALIDARG /* Vista */,
-          "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
+          "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08lx\n", ret);
         ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
     }
 
@@ -419,22 +419,22 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
     {
         /* This test crashes on WinXP SP2 */
             ret = SHCreateStreamOnFileW(test_file, mode | stgm, NULL);
-            ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
+            ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
     }
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_CONVERT | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_DELETEONRELEASE | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_TRANSACTED | stgm, &stream);
-    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08x\n", ret);
+    ok(ret == E_INVALIDARG, "SHCreateStreamOnFileW: expected E_INVALIDARG, got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
 
     /* file does not exist */
@@ -446,12 +446,12 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
         return;
     }
 
-    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
+    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "SHCreateStreamOnFileW: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileW: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_CREATE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
 
     if (stream) {
@@ -459,7 +459,7 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
     }
 
     /* NOTE: don't delete the file, as it will be used for the file exists tests. */
@@ -468,19 +468,19 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_FAILIFTHERE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
     }
 
     stream = NULL;
     ret = SHCreateStreamOnFileW(test_file, mode | STGM_CREATE | stgm, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileW: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
 
     if (stream) {
@@ -490,10 +490,10 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %ld\n", refcount);
 
         delret = DeleteFileA(test_fileA);
-        ok(delret, "SHCreateStreamOnFileW: could not delete the test file, got error %d\n",
+        ok(delret, "SHCreateStreamOnFileW: could not delete the test file, got error %ld\n",
            GetLastError());
     }
 }
@@ -511,7 +511,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
     BOOL delret;
 
     if (winetest_debug > 1)
-        trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
+        trace("SHCreateStreamOnFileEx: testing mode %ld, STGM flags %08lx\n", mode, stgm);
 
     /* Don't used a fixed path for the testEx.txt file */
     GetTempPathA(MAX_PATH, test_fileA);
@@ -527,7 +527,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         ret = SHCreateStreamOnFileEx(NULL, mode, 0, FALSE, NULL, &stream);
         ok(ret == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) || /* XP */
            ret == E_INVALIDARG /* Vista */,
-          "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08x\n", ret);
+          "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) or E_INVALIDARG, got 0x%08lx\n", ret);
         ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
     }
 
@@ -541,7 +541,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
     ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
         ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
         "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
-        "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
+        "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08lx\n", ret);
 
     ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
 
@@ -549,7 +549,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
     {
         /* This test crashes on WinXP SP2 */
         ret = SHCreateStreamOnFileEx(test_file, mode, 0, FALSE, NULL, NULL);
-        ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08x\n", ret);
+        ok(ret == E_INVALIDARG, "SHCreateStreamOnFileEx: expected E_INVALIDARG, got 0x%08lx\n", ret);
     }
 
     /* file does not exist */
@@ -558,7 +558,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
     ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
     if ((stgm & STGM_TRANSACTED) == STGM_TRANSACTED && mode == STGM_READ) {
         ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* XP */ || ret == E_INVALIDARG /* Vista */,
-          "SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08x\n", ret);
+          "SHCreateStreamOnFileEx: expected E_INVALIDARG or HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got 0x%08lx\n", ret);
 
         if (ret == E_INVALIDARG) {
             skip("SHCreateStreamOnFileEx: STGM_TRANSACTED not supported in this configuration.\n");
@@ -568,7 +568,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         ok( ret == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) ||
             ret == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
             "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) or "
-            "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08x\n", ret);
+            "HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got 0x%08lx\n", ret);
     }
     ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
 
@@ -581,7 +581,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         return;
     }
 
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
@@ -589,10 +589,10 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
 
         delret = DeleteFileA(test_fileA);
-        ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+        ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
            GetLastError());
     }
 
@@ -603,17 +603,17 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         Sleep(1000);
         ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
     }
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
 
         delret = DeleteFileA(test_fileA);
-        ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+        ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
            GetLastError());
     }
 
@@ -624,14 +624,14 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
         Sleep(1000);
         ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
     }
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
     }
 
     /* NOTE: don't delete the file, as it will be used for the file exists tests. */
@@ -640,47 +640,47 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
 
     stream = NULL;
     ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, FALSE, NULL, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
     }
 
     stream = NULL;
     ret = SHCreateStreamOnFileEx(test_file, mode | STGM_FAILIFTHERE | stgm, 0, TRUE, NULL, &stream);
-    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), got 0x%08x\n", ret);
+    ok(ret == HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), "SHCreateStreamOnFileEx: expected HRESULT_FROM_WIN32(ERROR_FILE_EXISTS), got 0x%08lx\n", ret);
     ok(stream == NULL, "SHCreateStreamOnFileEx: expected a NULL IStream object, got %p\n", stream);
 
     stream = NULL;
     ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, FALSE, NULL, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
     }
 
     stream = NULL;
     ret = SHCreateStreamOnFileEx(test_file, mode | STGM_CREATE | stgm, 0, TRUE, NULL, &stream);
-    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08x\n", ret);
+    ok(ret == S_OK, "SHCreateStreamOnFileEx: expected S_OK, got 0x%08lx\n", ret);
     ok(stream != NULL, "SHCreateStreamOnFileEx: expected a valid IStream object, got NULL\n");
 
     if (stream) {
         test_IStream_invalid_operations(stream, mode);
 
         refcount = IStream_Release(stream);
-        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
+        ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %ld\n", refcount);
     }
 
     delret = DeleteFileA(test_fileA);
-    ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+    ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %ld\n",
        GetLastError());
 }
 
@@ -699,32 +699,32 @@ static void test_SHCreateStreamOnFileEx_CopyTo(void)
 
     GetTempPathW(MAX_PATH, tmpPath);
     ret = GetTempFileNameW(tmpPath, prefix, 0, srcFileName);
-    ok(ret != 0, "GetTempFileName failed, got error %d\n", GetLastError());
+    ok(ret != 0, "GetTempFileName failed, got error %ld\n", GetLastError());
     ret = GetTempFileNameW(tmpPath, prefix, 0, dstFileName);
-    ok(ret != 0, "GetTempFileName failed, got error %d\n", GetLastError());
+    ok(ret != 0, "GetTempFileName failed, got error %ld\n", GetLastError());
 
     ret = SHCreateStreamOnFileEx(srcFileName, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, FILE_ATTRIBUTE_TEMPORARY, FALSE, NULL, &src);
-    ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08x\n", ret);
+    ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08lx\n", ret);
 
     written.QuadPart = 0;
     ret = IStream_Write(src, srcContents, sizeof(srcContents), &U(written).LowPart);
-    ok(SUCCEEDED(ret), "ISequentialStream_Write failed with ret=0x%08x\n", ret);
+    ok(SUCCEEDED(ret), "ISequentialStream_Write failed with ret=0x%08lx\n", ret);
 
     distance.QuadPart = 0;
     ret = IStream_Seek(src, distance, STREAM_SEEK_SET, &written);
-    ok(SUCCEEDED(ret), "ISequentialStream_Seek failed with ret=0x%08x\n", ret);
+    ok(SUCCEEDED(ret), "ISequentialStream_Seek failed with ret=0x%08lx\n", ret);
 
     ret = SHCreateStreamOnFileEx(dstFileName, STGM_CREATE | STGM_READWRITE | STGM_DELETEONRELEASE, FILE_ATTRIBUTE_TEMPORARY, FALSE, NULL, &dst);
-    ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08x\n", ret);
+    ok(SUCCEEDED(ret), "SHCreateStreamOnFileEx failed with ret=0x%08lx\n", ret);
 
     /* Test using a count larger than the source file, so that the Read operation will fall short */
     count.QuadPart = 2;
 
     ret = IStream_CopyTo(src, dst, count, &read, &written);
-    ok(SUCCEEDED(ret), "CopyTo failed with ret=0x%08x\n", ret);
+    ok(SUCCEEDED(ret), "CopyTo failed with ret=0x%08lx\n", ret);
 
-    ok(read.QuadPart == 1, "read does not match size: %d != 1\n", U(read).LowPart);
-    ok(written.QuadPart == 1, "written does not match size: %d != 1\n", U(written).LowPart);
+    ok(read.QuadPart == 1, "read does not match size: %ld != 1\n", U(read).LowPart);
+    ok(written.QuadPart == 1, "written does not match size: %ld != 1\n", U(written).LowPart);
 
     IStream_Release(dst);
     IStream_Release(src);
@@ -754,64 +754,64 @@ static void test_SHCreateMemStream(void)
     ok(stream != NULL, "Failed to create a stream.\n");
 
     hr = IStream_QueryInterface(stream, &IID_ISequentialStream, (void **)&unk);
-    ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#x.\n", hr);
+    ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* WinXP */, "Failed to QI, hr %#lx.\n", hr);
     if (unk)
         IUnknown_Release(unk);
 
     num = ~0;
     hr = IStream_Read(stream, buff, sizeof(buff), &num);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
-    ok(num == 0, "expected 0, got 0x%08x\n", num);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
+    ok(num == 0, "expected 0, got 0x%08lx\n", num);
 
     num = ~0;
     memset(buff, 0x55, sizeof(buff));
     hr = IStream_Write(stream, buff, sizeof(buff), &num);
-    ok(hr == S_OK, "Failed to write, hr %#x.\n", hr);
-    ok(num == sizeof(buff), "expected %u, got %u\n", sizeof(buff), num);
+    ok(hr == S_OK, "Failed to write, hr %#lx.\n", hr);
+    ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
 
     off.QuadPart = 0;
     hr = IStream_Seek(stream, off, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "Failed to seek, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
 
     num = ~0;
     memset(buff, 0, sizeof(buff));
     hr = IStream_Read(stream, buff, sizeof(buff), &num);
-    ok(hr == S_OK, "Failed to read, hr %#x.\n", hr);
-    ok(num == sizeof(buff), "expected %u, got %u\n", sizeof(buff), num);
+    ok(hr == S_OK, "Failed to read, hr %#lx.\n", hr);
+    ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
     for (i = 0; i < ARRAY_SIZE(buff); i++)
-        ok(buff[i] == 0x55, "expected 0x55, got 0x%02x at %u\n", buff[i], i);
+        ok(buff[i] == 0x55, "expected 0x55, got 0x%02x at %lu\n", buff[i], i);
 
     num = ~0;
     hr = IStream_Read(stream, buff, sizeof(buff), &num);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
-    ok(num == 0, "expected 0, got 0x%08x\n", num);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
+    ok(num == 0, "expected 0, got 0x%08lx\n", num);
 
     num = ~0;
     memset(buff, 0x11, sizeof(buff));
     hr = IStream_Write(stream, buff, sizeof(buff), &num);
-    ok(hr == S_OK, "Failed to write, hr %#x.\n", hr);
-    ok(num == sizeof(buff), "expected %u, got %u\n", sizeof(buff), num);
+    ok(hr == S_OK, "Failed to write, hr %#lx.\n", hr);
+    ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
 
     off.QuadPart = -sizeof(buff);
     hr = IStream_Seek(stream, off, STREAM_SEEK_CUR, NULL);
-    ok(hr == S_OK, "Failed to seek, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to seek, hr %#lx.\n", hr);
 
     num = ~0;
     memset(buff, 0, sizeof(buff));
     hr = IStream_Read(stream, buff, sizeof(buff), &num);
-    ok(hr == S_OK, "Failed to read, hr %#x.\n", hr);
-    ok(num == sizeof(buff), "expected %u, got %u\n", sizeof(buff), num);
+    ok(hr == S_OK, "Failed to read, hr %#lx.\n", hr);
+    ok(num == sizeof(buff), "expected %Iu, got %lu\n", sizeof(buff), num);
     for (i = 0; i < ARRAY_SIZE(buff); i++)
-        ok(buff[i] == 0x11, "expected 0x11, got 0x%02x at %u\n", buff[i], i);
+        ok(buff[i] == 0x11, "expected 0x11, got 0x%02x at %lu\n", buff[i], i);
 
     num = ~0;
     hr = IStream_Read(stream, buff, sizeof(buff), &num);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
-    ok(num == 0, "expected 0, got 0x%08x\n", num);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
+    ok(num == 0, "expected 0, got 0x%08lx\n", num);
 
     hr = IStream_Clone(stream, &stream2);
     todo_wine
-    ok(hr == S_OK || broken(hr == E_NOTIMPL) /* < Win8 */, "Failed to clone a stream, hr %#x.\n", hr);
+    ok(hr == S_OK || broken(hr == E_NOTIMPL) /* < Win8 */, "Failed to clone a stream, hr %#lx.\n", hr);
     if (hr == S_OK)
         IStream_Release(stream2);
 
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index bac91c4c9d8..603a2ac2a76 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -197,7 +197,7 @@ static void test_GetAcceptLanguagesA(void)
     /* Get the original Value */
     lres = RegOpenKeyA(HKEY_CURRENT_USER, ie_international, &hroot);
     if (lres) {
-        skip("RegOpenKey(%s) failed: %d\n", ie_international, lres);
+        skip("RegOpenKey(%s) failed: %ld\n", ie_international, lres);
         return;
     }
     len = sizeof(original);
@@ -230,7 +230,7 @@ static void test_GetAcceptLanguagesA(void)
     hr = pGetAcceptLanguagesA( buffer, &len);
 
     if (hr != S_OK) {
-        win_skip("GetAcceptLanguagesA failed with 0x%x\n", hr);
+        win_skip("GetAcceptLanguagesA failed with 0x%lx\n", hr);
         goto restore_original;
     }
 
@@ -238,7 +238,7 @@ static void test_GetAcceptLanguagesA(void)
         /* some windows versions use "lang" or "lang-country" as default */
         language[0] = 0;
         hr = LcidToRfc1766A(lcid, language, sizeof(language));
-        ok(hr == S_OK, "LcidToRfc1766A returned 0x%x and %s\n", hr, language);
+        ok(hr == S_OK, "LcidToRfc1766A returned 0x%lx and %s\n", hr, language);
     }
 
     ok(!lstrcmpA(buffer, language),
@@ -255,7 +255,7 @@ static void test_GetAcceptLanguagesA(void)
         exactsize = lstrlenA(entry);
 
         lres = RegSetValueExA(hroot, acceptlanguage, 0, REG_SZ, (const BYTE *) entry, exactsize + 1);
-        ok(!lres, "got %d for RegSetValueExA: %s\n", lres, entry);
+        ok(!lres, "got %ld for RegSetValueExA: %s\n", lres, entry);
 
         /* len includes space for the terminating 0 before vista/w2k8 */
         len = exactsize + 2;
@@ -266,7 +266,7 @@ static void test_GetAcceptLanguagesA(void)
             (SUCCEEDED(hr) &&
             ((len == exactsize) || (len == exactsize+1)) &&
             !lstrcmpA(buffer, entry)),
-            "+2_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+            "+2_#%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
 
         len = exactsize + 1;
         memset(buffer, '#', maxlen);
@@ -276,7 +276,7 @@ static void test_GetAcceptLanguagesA(void)
             (SUCCEEDED(hr) &&
             ((len == exactsize) || (len == exactsize+1)) &&
             !lstrcmpA(buffer, entry)),
-            "+1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+            "+1_#%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
 
         len = exactsize;
         memset(buffer, '#', maxlen);
@@ -296,7 +296,7 @@ static void test_GetAcceptLanguagesA(void)
             ((hr == S_OK) && !memcmp(buffer, language, len)) ||
             ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
             ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize)),
-            "==_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+            "==_#%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
 
         if (exactsize > 1) {
             len = exactsize - 1;
@@ -308,7 +308,7 @@ static void test_GetAcceptLanguagesA(void)
                 ((hr == S_OK) && !memcmp(buffer, language, len)) ||
                 ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
                 ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == exactsize - 1)),
-                "-1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+                "-1_#%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
         }
 
         len = 1;
@@ -320,7 +320,7 @@ static void test_GetAcceptLanguagesA(void)
             ((hr == S_OK) && !memcmp(buffer, language, len)) ||
             ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
             ((hr == __HRESULT_FROM_WIN32(ERROR_MORE_DATA)) && len == 1)),
-            "=1_#%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+            "=1_#%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
 
         len = maxlen;
         hr = pGetAcceptLanguagesA( NULL, &len);
@@ -329,7 +329,7 @@ static void test_GetAcceptLanguagesA(void)
            since w2k8: S_OK and needed size (excluding 0), win8 S_OK and size including 0. */
         ok( ((hr == S_OK) && ((len == exactsize) || (len == exactsize + 1))) ||
             ((hr == E_FAIL) && (len == maxlen)),
-            "NULL,max #%d: got 0x%x with %d and %s\n", i, hr, len, buffer);
+            "NULL,max #%d: got 0x%lx with %ld and %s\n", i, hr, len, buffer);
 
         i++;
     }
@@ -342,7 +342,7 @@ static void test_GetAcceptLanguagesA(void)
     buffer[maxlen] = 0;
     hr = pGetAcceptLanguagesA( buffer, &len);
     ok( ((hr == S_OK) && (len == lstrlenA(language))),
-        "max: got 0x%x with %d and %s (expected S_OK with %d and '%s'\n",
+        "max: got 0x%lx with %ld and %s (expected S_OK with %d and '%s'\n",
         hr, len, buffer, lstrlenA(language), language);
 
     len = 2;
@@ -352,7 +352,7 @@ static void test_GetAcceptLanguagesA(void)
     ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
         ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
         ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
-        "=2: got 0x%x with %d and %s\n", hr, len, buffer);
+        "=2: got 0x%lx with %ld and %s\n", hr, len, buffer);
 
     len = 1;
     memset(buffer, '#', maxlen);
@@ -365,7 +365,7 @@ static void test_GetAcceptLanguagesA(void)
     ok( (((hr == S_OK) || (hr == E_INVALIDARG)) && !memcmp(buffer, language, len)) ||
         ((hr == E_NOT_SUFFICIENT_BUFFER) && !len) ||
         ((hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)) && !len),
-        "=1: got 0x%x with %d and %s\n", hr, len, buffer);
+        "=1: got 0x%lx with %ld and %s\n", hr, len, buffer);
 
     len = 0;
     memset(buffer, '#', maxlen);
@@ -373,26 +373,26 @@ static void test_GetAcceptLanguagesA(void)
     hr = pGetAcceptLanguagesA( buffer, &len);
     /* w2k3 and below: E_FAIL, since w2k8: E_INVALIDARG, win8 ERROR_CANNOT_COPY */
     ok((hr == E_FAIL) || (hr == E_INVALIDARG) || (hr == __HRESULT_FROM_WIN32(ERROR_CANNOT_COPY)),
-        "got 0x%x\n", hr);
+        "got 0x%lx\n", hr);
 
     memset(buffer, '#', maxlen);
     buffer[maxlen] = 0;
     hr = pGetAcceptLanguagesA( buffer, NULL);
     /* w2k3 and below: E_FAIL, since w2k8: E_INVALIDARG */
     ok((hr == E_FAIL) || (hr == E_INVALIDARG),
-        "got 0x%x (expected E_FAIL or E_INVALIDARG)\n", hr);
+        "got 0x%lx (expected E_FAIL or E_INVALIDARG)\n", hr);
 
 
     hr = pGetAcceptLanguagesA( NULL, NULL);
     /* w2k3 and below: E_FAIL, since w2k8: E_INVALIDARG */
     ok((hr == E_FAIL) || (hr == E_INVALIDARG),
-        "got 0x%x (expected E_FAIL or E_INVALIDARG)\n", hr);
+        "got 0x%lx (expected E_FAIL or E_INVALIDARG)\n", hr);
 
 restore_original:
     if (!res_query) {
         len = lstrlenA(original);
         lres = RegSetValueExA(hroot, acceptlanguage, 0, REG_SZ, (const BYTE *) original, len ? len + 1: 0);
-        ok(!lres, "RegSetValueEx(%s) failed: %d\n", original, lres);
+        ok(!lres, "RegSetValueEx(%s) failed: %ld\n", original, lres);
     }
     else
     {
@@ -460,25 +460,25 @@ static void test_alloc_shared(int argc, char **argv)
 
     procid=GetCurrentProcessId();
     hmem=pSHAllocShared(NULL,10,procid);
-    ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %u\n", GetLastError());
+    ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %lu\n", GetLastError());
     ret = pSHFreeShared(hmem, procid);
-    ok( ret, "SHFreeShared failed: %u\n", GetLastError());
+    ok( ret, "SHFreeShared failed: %lu\n", GetLastError());
 
     val.value = 0x12345678;
     val.handle = 0;
     hmem = pSHAllocShared(&val, sizeof(val), procid);
-    ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %u\n", GetLastError());
+    ok(hmem!=NULL,"SHAllocShared(NULL...) failed: %lu\n", GetLastError());
 
     p=pSHLockShared(hmem,procid);
-    ok(p!=NULL,"SHLockShared failed: %u\n", GetLastError());
+    ok(p!=NULL,"SHLockShared failed: %lu\n", GetLastError());
     if (p!=NULL)
-        ok(p->value == 0x12345678, "Wrong value in shared memory: %d instead of %d\n", p->value, 0x12345678);
+        ok(p->value == 0x12345678, "Wrong value in shared memory: %ld instead of %d\n", p->value, 0x12345678);
     ret = pSHUnlockShared(p);
-    ok( ret, "SHUnlockShared failed: %u\n", GetLastError());
+    ok( ret, "SHUnlockShared failed: %lu\n", GetLastError());
 
-    sprintf(cmdline, "%s %s %d %p", argv[0], argv[1], procid, hmem);
+    sprintf(cmdline, "%s %s %ld %p", argv[0], argv[1], procid, hmem);
     ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-    ok(ret, "could not create child process error: %u\n", GetLastError());
+    ok(ret, "could not create child process error: %lu\n", GetLastError());
     if (ret)
     {
         wait_child_process(pi.hProcess);
@@ -486,37 +486,37 @@ static void test_alloc_shared(int argc, char **argv)
         CloseHandle(pi.hProcess);
 
         p = pSHLockShared(hmem, procid);
-        ok(p != NULL,"SHLockShared failed: %u\n", GetLastError());
+        ok(p != NULL,"SHLockShared failed: %lu\n", GetLastError());
         if (p != NULL && p->value != 0x12345678)
         {
-            ok(p->value == 0x12345679, "Wrong value in shared memory: %d instead of %d\n", p->value, 0x12345679);
+            ok(p->value == 0x12345679, "Wrong value in shared memory: %ld instead of %d\n", p->value, 0x12345679);
             hmem2 = p->handle;
             ok(hmem2 != NULL, "Expected handle in shared memory\n");
         }
         ret = pSHUnlockShared(p);
-        ok(ret, "SHUnlockShared failed: %u\n", GetLastError());
+        ok(ret, "SHUnlockShared failed: %lu\n", GetLastError());
     }
 
     ret = pSHFreeShared(hmem, procid);
-    ok( ret, "SHFreeShared failed: %u\n", GetLastError());
+    ok( ret, "SHFreeShared failed: %lu\n", GetLastError());
 
     if (hmem2)
     {
         p = pSHLockShared(hmem2, procid);
-        ok(p != NULL,"SHLockShared failed: %u\n", GetLastError());
+        ok(p != NULL,"SHLockShared failed: %lu\n", GetLastError());
         if (p != NULL)
-            ok(p->value == 0xDEADBEEF, "Wrong value in shared memory: %d instead of %d\n", p->value, 0xDEADBEEF);
+            ok(p->value == 0xDEADBEEF, "Wrong value in shared memory: %ld instead of %d\n", p->value, 0xDEADBEEF);
         ret = pSHUnlockShared(p);
-        ok(ret, "SHUnlockShared failed: %u\n", GetLastError());
+        ok(ret, "SHUnlockShared failed: %lu\n", GetLastError());
 
         ret = pSHFreeShared(hmem2, procid);
-        ok(ret, "SHFreeShared failed: %u\n", GetLastError());
+        ok(ret, "SHFreeShared failed: %lu\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
     ret = pSHFreeShared(NULL, procid);
-    ok(ret, "SHFreeShared failed: %u\n", GetLastError());
-    ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %u\n", GetLastError());
+    ok(ret, "SHFreeShared failed: %lu\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %lu\n", GetLastError());
 }
 
 static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
@@ -527,36 +527,36 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
 
     /* test directly accessing shared memory of a remote process */
     p = pSHLockShared(hmem, procid);
-    ok(p != NULL || broken(p == NULL) /* Windows 7/8 */, "SHLockShared failed: %u\n", GetLastError());
+    ok(p != NULL || broken(p == NULL) /* Windows 7/8 */, "SHLockShared failed: %lu\n", GetLastError());
     if (p == NULL)
     {
         win_skip("Subprocess failed to modify shared memory, skipping test\n");
         return;
     }
 
-    ok(p->value == 0x12345678, "Wrong value in shared memory: %d instead of %d\n", p->value, 0x12345678);
+    ok(p->value == 0x12345678, "Wrong value in shared memory: %ld instead of %d\n", p->value, 0x12345678);
     p->value++;
 
     val.value = 0xDEADBEEF;
     val.handle = 0;
     p->handle = pSHAllocShared(&val, sizeof(val), procid);
-    ok(p->handle != NULL, "SHAllocShared failed: %u\n", GetLastError());
+    ok(p->handle != NULL, "SHAllocShared failed: %lu\n", GetLastError());
 
     ret = pSHUnlockShared(p);
-    ok(ret, "SHUnlockShared failed: %u\n", GetLastError());
+    ok(ret, "SHUnlockShared failed: %lu\n", GetLastError());
 
     /* test SHMapHandle */
     SetLastError(0xdeadbeef);
     hmem2 = pSHMapHandle(NULL, procid, GetCurrentProcessId(), 0, 0);
     ok(hmem2 == NULL, "expected NULL, got new handle\n");
-    ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "last error should not have changed, got %lu\n", GetLastError());
 
     hmem2 = pSHMapHandle(hmem, procid, GetCurrentProcessId(), 0, 0);
 
     /* It seems like Windows Vista/2008 uses a different internal implementation
      * for shared memory, and calling SHMapHandle fails. */
     ok(hmem2 != NULL || broken(hmem2 == NULL),
-       "SHMapHandle failed: %u\n", GetLastError());
+       "SHMapHandle failed: %lu\n", GetLastError());
     if (hmem2 == NULL)
     {
         win_skip("Subprocess failed to map shared memory, skipping test\n");
@@ -564,16 +564,16 @@ static void test_alloc_shared_remote(DWORD procid, HANDLE hmem)
     }
 
     p = pSHLockShared(hmem2, GetCurrentProcessId());
-    ok(p != NULL, "SHLockShared failed: %u\n", GetLastError());
+    ok(p != NULL, "SHLockShared failed: %lu\n", GetLastError());
 
     if (p != NULL)
-        ok(p->value == 0x12345679, "Wrong value in shared memory: %d instead of %d\n", p->value, 0x12345679);
+        ok(p->value == 0x12345679, "Wrong value in shared memory: %ld instead of %d\n", p->value, 0x12345679);
 
     ret = pSHUnlockShared(p);
-    ok(ret, "SHUnlockShared failed: %u\n", GetLastError());
+    ok(ret, "SHUnlockShared failed: %lu\n", GetLastError());
 
     ret = pSHFreeShared(hmem2, GetCurrentProcessId());
-    ok(ret, "SHFreeShared failed: %u\n", GetLastError());
+    ok(ret, "SHFreeShared failed: %lu\n", GetLastError());
 }
 
 static void test_fdsa(void)
@@ -608,52 +608,52 @@ static void test_fdsa(void)
     memset(&info, 0, sizeof(info));
 
     ok(pFDSA_Initialize(block_size, inc, &info, mem, init_blocks), "FDSA_Initialize rets FALSE\n");
-    ok(info.num_items == 0, "num_items = %d\n", info.num_items);
+    ok(info.num_items == 0, "num_items = %ld\n", info.num_items);
     ok(info.mem == mem, "mem = %p\n", info.mem);
-    ok(info.blocks_alloced == init_blocks, "blocks_alloced = %d\n", info.blocks_alloced);
+    ok(info.blocks_alloced == init_blocks, "blocks_alloced = %ld\n", info.blocks_alloced);
     ok(info.inc == inc, "inc = %d\n", info.inc);
     ok(info.block_size == block_size, "block_size = %d\n", info.block_size);
     ok(info.flags == 0, "flags = %d\n", info.flags);
 
     ret = pFDSA_InsertItem(&info, 1234, "1234567890");
-    ok(ret == 0, "ret = %d\n", ret);
-    ok(info.num_items == 1, "num_items = %d\n", info.num_items);
+    ok(ret == 0, "ret = %ld\n", ret);
+    ok(info.num_items == 1, "num_items = %ld\n", info.num_items);
     ok(info.mem == mem, "mem = %p\n", info.mem);
-    ok(info.blocks_alloced == init_blocks, "blocks_alloced = %d\n", info.blocks_alloced);
+    ok(info.blocks_alloced == init_blocks, "blocks_alloced = %ld\n", info.blocks_alloced);
     ok(info.inc == inc, "inc = %d\n", info.inc);
     ok(info.block_size == block_size, "block_size = %d\n", info.block_size);
     ok(info.flags == 0, "flags = %d\n", info.flags);
 
     ret = pFDSA_InsertItem(&info, 1234, "abcdefghij");
-    ok(ret == 1, "ret = %d\n", ret);
+    ok(ret == 1, "ret = %ld\n", ret);
 
     ret = pFDSA_InsertItem(&info, 1, "klmnopqrst");
-    ok(ret == 1, "ret = %d\n", ret);
+    ok(ret == 1, "ret = %ld\n", ret);
 
     ret = pFDSA_InsertItem(&info, 0, "uvwxyzABCD");
-    ok(ret == 0, "ret = %d\n", ret);
+    ok(ret == 0, "ret = %ld\n", ret);
     ok(info.mem == mem, "mem = %p\n", info.mem);
     ok(info.flags == 0, "flags = %d\n", info.flags);
 
     /* This next InsertItem will cause shlwapi to allocate its own mem buffer */
     ret = pFDSA_InsertItem(&info, 0, "EFGHIJKLMN");
-    ok(ret == 0, "ret = %d\n", ret);
+    ok(ret == 0, "ret = %ld\n", ret);
     ok(info.mem != mem, "mem = %p\n", info.mem);
-    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
+    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %ld\n", info.blocks_alloced);
     ok(info.flags == 0x1, "flags = %d\n", info.flags);
 
     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCD1234567890klmnopqrstabcdefghij", 50), "mem %s\n", (char*)info.mem);
 
     ok(pFDSA_DeleteItem(&info, 2), "rets FALSE\n");
     ok(info.mem != mem, "mem = %p\n", info.mem);
-    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
+    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %ld\n", info.blocks_alloced);
     ok(info.flags == 0x1, "flags = %d\n", info.flags);
 
     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCDklmnopqrstabcdefghij", 40), "mem %s\n", (char*)info.mem);
 
     ok(pFDSA_DeleteItem(&info, 3), "rets FALSE\n");
     ok(info.mem != mem, "mem = %p\n", info.mem);
-    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %d\n", info.blocks_alloced);
+    ok(info.blocks_alloced == init_blocks + inc, "blocks_alloced = %ld\n", info.blocks_alloced);
     ok(info.flags == 0x1, "flags = %d\n", info.flags);
 
     ok(!memcmp(info.mem, "EFGHIJKLMNuvwxyzABCDklmnopqrst", 30), "mem %s\n", (char*)info.mem);
@@ -716,11 +716,11 @@ static void test_GetShellSecurityDescriptor(void)
         ok(IsValidSecurityDescriptor(psd), "returned value is not valid SD\n");
 
         ret = GetSecurityDescriptorControl(psd, &control, &dwRev);
-        ok(ret, "GetSecurityDescriptorControl failed with error %u\n", GetLastError());
+        ok(ret, "GetSecurityDescriptorControl failed with error %lu\n", GetLastError());
         ok(0 == (control & SE_SELF_RELATIVE), "SD should be absolute\n");
 
         ret = GetSecurityDescriptorDacl(psd, &bHasDacl, &pAcl, &bDefaulted);
-        ok(ret, "GetSecurityDescriptorDacl failed with error %u\n", GetLastError());
+        ok(ret, "GetSecurityDescriptorDacl failed with error %lu\n", GetLastError());
 
         ok(bHasDacl, "SD has no DACL\n");
         if (bHasDacl)
@@ -735,36 +735,36 @@ static void test_GetShellSecurityDescriptor(void)
                 ok(IsValidAcl(pAcl), "DACL is not valid\n");
 
                 ret = GetAclInformation(pAcl, &asiSize, sizeof(asiSize), AclSizeInformation);
-                ok(ret, "GetAclInformation failed with error %u\n", GetLastError());
+                ok(ret, "GetAclInformation failed with error %lu\n", GetLastError());
 
-                ok(asiSize.AceCount == 3, "Incorrect number of ACEs: %d entries\n", asiSize.AceCount);
+                ok(asiSize.AceCount == 3, "Incorrect number of ACEs: %ld entries\n", asiSize.AceCount);
                 if (asiSize.AceCount == 3)
                 {
                     ACCESS_ALLOWED_ACE *paaa; /* will use for DENIED too */
 
                     ret = GetAce(pAcl, 0, (LPVOID*)&paaa);
-                    ok(ret, "GetAce failed with error %u\n", GetLastError());
+                    ok(ret, "GetAce failed with error %lu\n", GetLastError());
                     ok(paaa->Header.AceType == ACCESS_ALLOWED_ACE_TYPE, 
                             "Invalid ACE type %d\n", paaa->Header.AceType); 
                     ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
-                    ok(paaa->Mask == GENERIC_ALL, "Invalid ACE mask %x\n", paaa->Mask);
+                    ok(paaa->Mask == GENERIC_ALL, "Invalid ACE mask %lx\n", paaa->Mask);
 
                     ret = GetAce(pAcl, 1, (LPVOID*)&paaa);
-                    ok(ret, "GetAce failed with error %u\n", GetLastError());
+                    ok(ret, "GetAce failed with error %lu\n", GetLastError());
                     ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE, 
                             "Invalid ACE type %d\n", paaa->Header.AceType); 
                     /* first one of two ACEs generated from inheritable entry - without inheritance */
                     ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
-                    ok(paaa->Mask == GENERIC_WRITE, "Invalid ACE mask %x\n", paaa->Mask);
+                    ok(paaa->Mask == GENERIC_WRITE, "Invalid ACE mask %lx\n", paaa->Mask);
 
                     ret = GetAce(pAcl, 2, (LPVOID*)&paaa);
-                    ok(ret, "GetAce failed with error %u\n", GetLastError());
+                    ok(ret, "GetAce failed with error %lu\n", GetLastError());
                     ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE, 
                             "Invalid ACE type %d\n", paaa->Header.AceType); 
                     /* second ACE - with inheritance */
                     ok(paaa->Header.AceFlags == MY_INHERITANCE,
                             "Invalid ACE flags %x\n", paaa->Header.AceFlags);
-                    ok(paaa->Mask == GENERIC_READ, "Invalid ACE mask %x\n", paaa->Mask);
+                    ok(paaa->Mask == GENERIC_READ, "Invalid ACE mask %lx\n", paaa->Mask);
                 }
             }
         }
@@ -782,17 +782,17 @@ static void test_SHPackDispParams(void)
     memset(&params, 0xc0, sizeof(params));
     memset(vars, 0xc0, sizeof(vars));
     hres = pSHPackDispParams(&params, vars, 1, VT_I4, 0xdeadbeef);
-    ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
+    ok(hres == S_OK, "SHPackDispParams failed: %08lx\n", hres);
     ok(params.cArgs == 1, "params.cArgs = %d\n", params.cArgs);
     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
     ok(params.rgvarg == vars, "params.rgvarg = %p\n", params.rgvarg);
     ok(V_VT(vars) == VT_I4, "V_VT(var) = %d\n", V_VT(vars));
-    ok(V_I4(vars) == 0xdeadbeef, "failed %x\n", V_I4(vars));
+    ok(V_I4(vars) == 0xdeadbeef, "failed %lx\n", V_I4(vars));
 
     memset(&params, 0xc0, sizeof(params));
     hres = pSHPackDispParams(&params, NULL, 0, 0);
-    ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
+    ok(hres == S_OK, "SHPackDispParams failed: %08lx\n", hres);
     ok(params.cArgs == 0, "params.cArgs = %d\n", params.cArgs);
     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
@@ -802,17 +802,17 @@ static void test_SHPackDispParams(void)
     memset(&params, 0xc0, sizeof(params));
     hres = pSHPackDispParams(&params, vars, 4, VT_BSTR, (void*)0xdeadbeef, VT_EMPTY, 10,
             VT_I4, 100, VT_DISPATCH, (void*)0xdeadbeef);
-    ok(hres == S_OK, "SHPackDispParams failed: %08x\n", hres);
+    ok(hres == S_OK, "SHPackDispParams failed: %08lx\n", hres);
     ok(params.cArgs == 4, "params.cArgs = %d\n", params.cArgs);
     ok(params.cNamedArgs == 0, "params.cNamedArgs = %d\n", params.cArgs);
     ok(params.rgdispidNamedArgs == NULL, "params.rgdispidNamedArgs = %p\n", params.rgdispidNamedArgs);
     ok(params.rgvarg == vars, "params.rgvarg = %p\n", params.rgvarg);
     ok(V_VT(vars) == VT_DISPATCH, "V_VT(vars[0]) = %x\n", V_VT(vars));
-    ok(V_I4(vars) == 0xdeadbeef, "V_I4(vars[0]) = %x\n", V_I4(vars));
+    ok(V_I4(vars) == 0xdeadbeef, "V_I4(vars[0]) = %lx\n", V_I4(vars));
     ok(V_VT(vars+1) == VT_I4, "V_VT(vars[1]) = %d\n", V_VT(vars+1));
-    ok(V_I4(vars+1) == 100, "V_I4(vars[1]) = %x\n", V_I4(vars+1));
+    ok(V_I4(vars+1) == 100, "V_I4(vars[1]) = %lx\n", V_I4(vars+1));
     ok(V_VT(vars+2) == VT_I4, "V_VT(vars[2]) = %d\n", V_VT(vars+2));
-    ok(V_I4(vars+2) == 10, "V_I4(vars[2]) = %x\n", V_I4(vars+2));
+    ok(V_I4(vars+2) == 10, "V_I4(vars[2]) = %lx\n", V_I4(vars+2));
     ok(V_VT(vars+3) == VT_BSTR, "V_VT(vars[3]) = %d\n", V_VT(vars+3));
     ok(V_BSTR(vars+3) == (void*)0xdeadbeef, "V_BSTR(vars[3]) = %p\n", V_BSTR(vars+3));
 }
@@ -964,13 +964,13 @@ static HRESULT WINAPI Disp_Invoke(
         EXCEPINFO *pExcepInfo,
         UINT *puArgErr)
 {
-    trace("%p %x %s %x %x %p %p %p %p\n", This, dispIdMember, wine_dbgstr_guid(riid), lcid, wFlags,
+    trace("%p %lx %s %lx %x %p %p %p %p\n", This, dispIdMember, wine_dbgstr_guid(riid), lcid, wFlags,
           pDispParams, pVarResult, pExcepInfo, puArgErr);
 
     ok(dispIdMember == 0xa0 || dispIdMember == 0xa1, "Unknown dispIdMember\n");
     ok(pDispParams != NULL, "Invoked with NULL pDispParams\n");
     ok(wFlags == DISPATCH_METHOD, "Wrong flags %x\n",wFlags);
-    ok(lcid == 0,"Wrong lcid %x\n",lcid);
+    ok(lcid == 0,"Wrong lcid %lx\n",lcid);
     if (dispIdMember == 0xa0)
     {
         ok(pDispParams->cArgs == 0, "params.cArgs = %d\n", pDispParams->cArgs);
@@ -986,7 +986,7 @@ static HRESULT WINAPI Disp_Invoke(
         ok(V_VT(pDispParams->rgvarg) == VT_BSTR, "V_VT(var) = %d\n", V_VT(pDispParams->rgvarg));
         ok(V_I4(pDispParams->rgvarg) == 0xdeadcafe , "failed %p\n", V_BSTR(pDispParams->rgvarg));
         ok(V_VT(pDispParams->rgvarg+1) == VT_I4, "V_VT(var) = %d\n", V_VT(pDispParams->rgvarg+1));
-        ok(V_I4(pDispParams->rgvarg+1) == 0xdeadbeef, "failed %x\n", V_I4(pDispParams->rgvarg+1));
+        ok(V_I4(pDispParams->rgvarg+1) == 0xdeadbeef, "failed %lx\n", V_I4(pDispParams->rgvarg+1));
     }
 
     return ERROR_SUCCESS;
@@ -1461,32 +1461,32 @@ static void test_IConnectionPoint(void)
 
     rc = pConnectToConnectionPoint((IUnknown*)&dispatch->IDispatch_iface, &IID_NULL, TRUE,
                                    (IUnknown*)&container->IConnectionPointContainer_iface, &cookie, &point);
-    ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
+    ok(rc == S_OK, "pConnectToConnectionPoint failed with %lx\n",rc);
     ok(point != NULL, "returned ConnectionPoint is NULL\n");
     ok(cookie != 0xffffffff, "invalid cookie returned\n");
 
     rc = pIConnectionPoint_SimpleInvoke(point,0xa0,NULL);
-    ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
+    ok(rc == S_OK, "pConnectToConnectionPoint failed with %lx\n",rc);
 
     memset(&params, 0xc0, sizeof(params));
     memset(vars, 0xc0, sizeof(vars));
     rc = pSHPackDispParams(&params, vars, 2, VT_I4, 0xdeadbeef, VT_BSTR, 0xdeadcafe);
-    ok(rc == S_OK, "SHPackDispParams failed: %08x\n", rc);
+    ok(rc == S_OK, "SHPackDispParams failed: %08lx\n", rc);
 
     rc = pIConnectionPoint_SimpleInvoke(point,0xa1,&params);
-    ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
+    ok(rc == S_OK, "pConnectToConnectionPoint failed with %lx\n",rc);
 
     rc = pConnectToConnectionPoint(NULL, &IID_NULL, FALSE,
                                    (IUnknown*)&container->IConnectionPointContainer_iface, &cookie, NULL);
-    ok(rc == S_OK, "pConnectToConnectionPoint failed with %x\n",rc);
+    ok(rc == S_OK, "pConnectToConnectionPoint failed with %lx\n",rc);
 
 /* MSDN says this should be required but it crashes on XP
     IUnknown_Release(point);
 */
     ref = IConnectionPointContainer_Release(&container->IConnectionPointContainer_iface);
-    ok(ref == 0, "leftover IConnectionPointContainer reference %i\n",ref);
+    ok(ref == 0, "leftover IConnectionPointContainer reference %li\n",ref);
     ref = IDispatch_Release(&dispatch->IDispatch_iface);
-    ok(ref == 0, "leftover IDispatch reference %i\n",ref);
+    ok(ref == 0, "leftover IDispatch reference %li\n",ref);
 }
 
 typedef struct _propbag
@@ -1585,16 +1585,16 @@ static void test_SHPropertyBag_ReadLONG(void)
 
     out = 0xfeedface;
     rc = pSHPropertyBag_ReadLONG(NULL, szName1, &out);
-    ok(rc == E_INVALIDARG || broken(rc == S_OK), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK), "incorrect return %lx\n",rc);
     ok(out == 0xfeedface, "value should not have changed\n");
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, NULL, &out);
-    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %lx\n",rc);
     ok(out == 0xfeedface, "value should not have changed\n");
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, NULL);
-    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
+    ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %lx\n",rc);
     rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, &out);
-    ok(rc == DISP_E_BADVARTYPE || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
-    ok(out == 0xfeedface  || broken(out == 0xfeedfa00), "value should not have changed %x\n",out);
+    ok(rc == DISP_E_BADVARTYPE || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %lx\n",rc);
+    ok(out == 0xfeedface  || broken(out == 0xfeedfa00), "value should not have changed %lx\n",out);
     IPropertyBag_Release(&pb->IPropertyBag_iface);
 }
 
@@ -1623,9 +1623,9 @@ static void test_SHSetWindowBits(void)
     /* null window */
     SetLastError(0xdeadbeef);
     style = pSHSetWindowBits(NULL, GWL_STYLE, 0, 0);
-    ok(style == 0, "expected 0 retval, got %d\n", style);
+    ok(style == 0, "expected 0 retval, got %ld\n", style);
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE,
-        "expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
+        "expected ERROR_INVALID_WINDOW_HANDLE, got %ld\n", GetLastError());
 
     /* zero mask, zero flags */
     styleold = GetWindowLongA(hwnd, GWL_STYLE);
@@ -1638,19 +1638,19 @@ static void test_SHSetWindowBits(void)
     ok(styleold & WS_VISIBLE, "expected WS_VISIBLE\n");
     style = pSHSetWindowBits(hwnd, GWL_STYLE, WS_VISIBLE, 0);
 
-    ok(style == styleold, "expected previous style, got %x\n", style);
+    ok(style == styleold, "expected previous style, got %lx\n", style);
     ok((GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE) == 0, "expected updated style\n");
 
     /* test mask, unset style bit used */
     styleold = GetWindowLongA(hwnd, GWL_STYLE);
     style = pSHSetWindowBits(hwnd, GWL_STYLE, WS_VISIBLE, 0);
-    ok(style == styleold, "expected previous style, got %x\n", style);
+    ok(style == styleold, "expected previous style, got %lx\n", style);
     ok(styleold == GetWindowLongA(hwnd, GWL_STYLE), "expected to keep old style\n");
 
     /* set back with flags */
     styleold = GetWindowLongA(hwnd, GWL_STYLE);
     style = pSHSetWindowBits(hwnd, GWL_STYLE, WS_VISIBLE, WS_VISIBLE);
-    ok(style == styleold, "expected previous style, got %x\n", style);
+    ok(style == styleold, "expected previous style, got %lx\n", style);
     ok(GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE, "expected updated style\n");
 
     /* reset and try to set without a mask */
@@ -1658,7 +1658,7 @@ static void test_SHSetWindowBits(void)
     ok((GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE) == 0, "expected updated style\n");
     styleold = GetWindowLongA(hwnd, GWL_STYLE);
     style = pSHSetWindowBits(hwnd, GWL_STYLE, 0, WS_VISIBLE);
-    ok(style == styleold, "expected previous style, got %x\n", style);
+    ok(style == styleold, "expected previous style, got %lx\n", style);
     ok((GetWindowLongA(hwnd, GWL_STYLE) & WS_VISIBLE) == 0, "expected updated style\n");
 
     DestroyWindow(hwnd);
@@ -1687,7 +1687,7 @@ static void test_SHFormatDateTimeA(void)
     buff[0] = 'a'; buff[1] = 0;
     ret = pSHFormatDateTimeA(&filetime, NULL, buff, 0);
     ok(ret == 0, "got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(buff[0] == 'a', "expected same string, got %s\n", buff);
 
     /* flags needs to have FDTF_NOAUTOREADINGORDER for these tests to succeed on Vista+ */
@@ -1697,20 +1697,20 @@ static void test_SHFormatDateTimeA(void)
     SetLastError(0xdeadbeef);
     ret = pSHFormatDateTimeA(&filetime, &flags, buff, sizeof(buff));
     ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     flags = FDTF_NOAUTOREADINGORDER | FDTF_SHORTDATE | FDTF_LONGDATE;
     SetLastError(0xdeadbeef);
     ret = pSHFormatDateTimeA(&filetime, &flags, buff, sizeof(buff));
     ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     flags =  FDTF_SHORTDATE | FDTF_LTRDATE | FDTF_RTLDATE;
     SetLastError(0xdeadbeef);
     ret = pSHFormatDateTimeA(&filetime, &flags, buff, sizeof(buff));
     ok(ret == lstrlenA(buff)+1, "got %d\n", ret);
     ok(GetLastError() == 0xdeadbeef,
-        "expected 0xdeadbeef, got %d\n", GetLastError());
+        "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     flags = FDTF_DEFAULT;
     ret = pSHFormatDateTimeA(&filetime, &flags, buff, sizeof(buff));
@@ -1850,13 +1850,13 @@ if (0)
     SetLastError(0xdeadbeef);
     ret = pSHFormatDateTimeW(&filetime, NULL, NULL, 0);
     ok(ret == 0, "expected 0, got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     buff[0] = 'a'; buff[1] = 0;
     ret = pSHFormatDateTimeW(&filetime, NULL, buff, 0);
     ok(ret == 0, "expected 0, got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(buff[0] == 'a', "expected same string\n");
 
     /* all combinations documented as invalid succeeded */
@@ -1865,14 +1865,14 @@ if (0)
     ret = pSHFormatDateTimeW(&filetime, &flags, buff, ARRAY_SIZE(buff));
     ok(ret == lstrlenW(buff)+1 || ret == lstrlenW(buff),
        "expected %d or %d, got %d\n", lstrlenW(buff)+1, lstrlenW(buff), ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     flags = FDTF_SHORTDATE | FDTF_LONGDATE;
     SetLastError(0xdeadbeef);
     ret = pSHFormatDateTimeW(&filetime, &flags, buff, ARRAY_SIZE(buff));
     ok(ret == lstrlenW(buff)+1 || ret == lstrlenW(buff),
        "expected %d or %d, got %d\n", lstrlenW(buff)+1, lstrlenW(buff), ret);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     flags = FDTF_SHORTDATE | FDTF_LTRDATE | FDTF_RTLDATE;
     SetLastError(0xdeadbeef);
@@ -1881,7 +1881,7 @@ if (0)
     ok(ret == lstrlenW(buff)+1 || ret == lstrlenW(buff),
        "expected %d or %d, got %d\n", lstrlenW(buff)+1, lstrlenW(buff), ret);
     ok(GetLastError() == 0xdeadbeef,
-        "expected 0xdeadbeef, got %d\n", GetLastError());
+        "expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* now check returned strings */
     flags = FDTF_SHORTTIME;
@@ -2044,7 +2044,7 @@ static void test_SHGetObjectCompatFlags(void)
 
     /* null args */
     ret = pSHGetObjectCompatFlags(NULL, NULL);
-    ok(ret == 0, "got %d\n", ret);
+    ok(ret == 0, "got %ld\n", ret);
 
     ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, compat_path, &root);
     if (ret != ERROR_SUCCESS)
@@ -2080,7 +2080,7 @@ static void test_SHGetObjectCompatFlags(void)
 
             pGUIDFromStringA(keyA, &clsid);
             got = pSHGetObjectCompatFlags(NULL, &clsid);
-            ok(got == expected, "got 0x%08x, expected 0x%08x. Key %s\n", got, expected, keyA);
+            ok(got == expected, "got 0x%08lx, expected 0x%08lx. Key %s\n", got, expected, keyA);
 
             RegCloseKey(clsid_key);
         }
@@ -2304,7 +2304,7 @@ static void test_IUnknown_QueryServiceExec(void)
     hr = pIUnknown_QueryServiceExec(NULL, &dummy_serviceid, &dummy_groupid, 0, 0, 0, 0);
     ok(hr == E_FAIL ||
        hr == E_NOTIMPL, /* win 8 */
-       "got 0x%08x\n", hr);
+       "got 0x%08lx\n", hr);
 
     /* expected trace:
        IUnknown_QueryServiceExec( ptr1, serviceid, groupid, arg1, arg2, arg3, arg4);
@@ -2320,7 +2320,7 @@ static void test_IUnknown_QueryServiceExec(void)
 
     init_call_trace(&trace_got);
     hr = pIUnknown_QueryServiceExec((IUnknown*)provider, &dummy_serviceid, &dummy_groupid, 0x1, 0x2, (void*)0x3, (void*)0x4);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     ok_trace(&trace_expected, &trace_got);
 
@@ -2414,7 +2414,7 @@ static void test_IUnknown_ProfferService(void)
     hr = pIUnknown_ProfferService(NULL, &dummy_serviceid, 0, 0);
     ok(hr == E_FAIL ||
        hr == E_NOTIMPL, /* win 8 */
-       "got 0x%08x\n", hr);
+       "got 0x%08lx\n", hr);
 
     /* expected trace:
        IUnknown_ProfferService( ptr1, serviceid, arg1, arg2);
@@ -2435,8 +2435,8 @@ static void test_IUnknown_ProfferService(void)
     init_call_trace(&trace_got);
     cookie = 0;
     hr = pIUnknown_ProfferService((IUnknown*)proff, &dummy_serviceid, provider, &cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(cookie == 0xdeadbeef, "got %x\n", cookie);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(cookie == 0xdeadbeef, "got %lx\n", cookie);
 
     ok_trace(&trace_expected, &trace_got);
     free_call_trace(&trace_got);
@@ -2450,10 +2450,10 @@ static void test_IUnknown_ProfferService(void)
     add_call(&trace_expected, 4, (void*)(DWORD_PTR)cookie, 0, 0, 0, 0);
 
     init_call_trace(&trace_got);
-    ok(cookie != 0, "got %x\n", cookie);
+    ok(cookie != 0, "got %lx\n", cookie);
     hr = pIUnknown_ProfferService((IUnknown*)proff, &dummy_serviceid, 0, &cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(cookie == 0, "got %x\n", cookie);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(cookie == 0, "got %lx\n", cookie);
     ok_trace(&trace_expected, &trace_got);
     free_call_trace(&trace_got);
     free_call_trace(&trace_expected);
@@ -2477,7 +2477,7 @@ static void test_SHCreateWorkerWindowA(void)
     ok(lstrcmpA(classA, "WorkerA") == 0, "expected WorkerA class, got %s\n", classA);
 
     ret = GetWindowLongPtrA(hwnd, 0);
-    ok(ret == 0, "got %ld\n", ret);
+    ok(ret == 0, "got %Id\n", ret);
 
     /* class info */
     memset(&cliA, 0, sizeof(cliA));
@@ -2498,19 +2498,19 @@ static void test_SHCreateWorkerWindowA(void)
     ok(lstrcmpA(classA, "WorkerA") == 0, "expected WorkerA class, got %s\n", classA);
 
     ret = GetWindowLongPtrA(hwnd, 0);
-    ok(ret == 0xdeadbeef, "got %ld\n", ret);
+    ok(ret == 0xdeadbeef, "got %Id\n", ret);
 
     /* test exstyle */
     ret = GetWindowLongA(hwnd, GWL_EXSTYLE);
     ok(ret == WS_EX_WINDOWEDGE ||
-       ret == (WS_EX_WINDOWEDGE|WS_EX_LAYOUTRTL) /* systems with RTL locale */, "0x%08lx\n", ret);
+       ret == (WS_EX_WINDOWEDGE|WS_EX_LAYOUTRTL) /* systems with RTL locale */, "0x%08Ix\n", ret);
 
     DestroyWindow(hwnd);
 
     hwnd = pSHCreateWorkerWindowA(0, NULL, WS_EX_TOOLWINDOW, 0, 0, 0);
     ret = GetWindowLongA(hwnd, GWL_EXSTYLE);
     ok(ret == (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW) ||
-       ret == (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_LAYOUTRTL) /* systems with RTL locale */, "0x%08lx\n", ret);
+       ret == (WS_EX_WINDOWEDGE|WS_EX_TOOLWINDOW|WS_EX_LAYOUTRTL) /* systems with RTL locale */, "0x%08Ix\n", ret);
     DestroyWindow(hwnd);
 }
 
@@ -2643,16 +2643,16 @@ static void test_SHIShellFolder_EnumObjects(void)
     /* SHIShellFolder_EnumObjects doesn't QI the object for IShellFolder */
     enm = (IEnumIDList*)0xdeadbeef;
     hres = pSHIShellFolder_EnumObjects(&ShellFolder, NULL, 0, &enm);
-    ok(hres == S_OK, "SHIShellFolder_EnumObjects failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "SHIShellFolder_EnumObjects failed: 0x%08lx\n", hres);
     ok(enm == (IEnumIDList*)0xcafebabe, "Didn't get expected enumerator location, instead: %p\n", enm);
 
     /* SHIShellFolder_EnumObjects isn't strict about the IShellFolder object */
     hres = SHGetDesktopFolder(&folder);
-    ok(hres == S_OK, "SHGetDesktopFolder failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "SHGetDesktopFolder failed: 0x%08lx\n", hres);
 
     enm = NULL;
     hres = pSHIShellFolder_EnumObjects(folder, NULL, 0, &enm);
-    ok(hres == S_OK, "SHIShellFolder_EnumObjects failed: 0x%08x\n", hres);
+    ok(hres == S_OK, "SHIShellFolder_EnumObjects failed: 0x%08lx\n", hres);
     ok(enm != NULL, "Didn't get an enumerator\n");
     if(enm)
         IEnumIDList_Release(enm);
@@ -2729,27 +2729,27 @@ static void test_SHGetIniString(void)
     }
 
     ret = pSHGetIniStringW(TestAppW, AKeyW, out, 0, pathW);
-    ok(ret == 0, "SHGetIniStringW should have given 0, instead: %d\n", ret);
+    ok(ret == 0, "SHGetIniStringW should have given 0, instead: %ld\n", ret);
 
     /* valid arguments */
     out[0] = 0;
     SetLastError(0xdeadbeef);
     ret = pSHGetIniStringW(TestAppW, NULL, out, ARRAY_SIZE(out), pathW);
-    ok(ret == 4, "SHGetIniStringW should have given 4, instead: %d\n", ret);
-    ok(!lstrcmpW(out, AKeyW), "Expected %s, got: %s, %d\n",
+    ok(ret == 4, "SHGetIniStringW should have given 4, instead: %ld\n", ret);
+    ok(!lstrcmpW(out, AKeyW), "Expected %s, got: %s, %ld\n",
                 wine_dbgstr_w(AKeyW), wine_dbgstr_w(out), GetLastError());
 
     ret = pSHGetIniStringW(TestAppW, AKeyW, out, ARRAY_SIZE(out), pathW);
-    ok(ret == 1, "SHGetIniStringW should have given 1, instead: %d\n", ret);
+    ok(ret == 1, "SHGetIniStringW should have given 1, instead: %ld\n", ret);
     ok(!lstrcmpW(out, L"1"), "Expected L\"1\", got: %s\n", wine_dbgstr_w(out));
 
     ret = pSHGetIniStringW(TestAppW, AnotherKeyW, out, ARRAY_SIZE(out), pathW);
-    ok(ret == 4, "SHGetIniStringW should have given 4, instead: %d\n", ret);
+    ok(ret == 4, "SHGetIniStringW should have given 4, instead: %ld\n", ret);
     ok(!lstrcmpW(out, L"asdf"), "Expected L\"asdf\", got: %s\n", wine_dbgstr_w(out));
 
     out[0] = 1;
     ret = pSHGetIniStringW(TestAppW, JunkKeyW, out, ARRAY_SIZE(out), pathW);
-    ok(ret == 0, "SHGetIniStringW should have given 0, instead: %d\n", ret);
+    ok(ret == 0, "SHGetIniStringW should have given 0, instead: %ld\n", ret);
     ok(*out == 0, "Expected L\"\", got: %s\n", wine_dbgstr_w(out));
 
     DeleteFileW(pathW);
@@ -2854,40 +2854,40 @@ static void test_SHGetShellKey(void)
 
     size = sizeof(data);
     hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, &data, &size);
-    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %x\n", hres);
+    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %lx\n", hres);
 
     data = 1234;
     hres = pSKSetValueW(SHKEY_Root_HKLM, WineTestW, NULL, REG_DWORD, &data, sizeof(DWORD));
-    ok(hres == S_OK, "hres = %x\n", hres);
+    ok(hres == S_OK, "hres = %lx\n", hres);
 
     size = 1;
     hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, NULL, &size);
-    ok(hres == S_OK, "hres = %x\n", hres);
-    ok(size == sizeof(DWORD), "size = %d\n", size);
+    ok(hres == S_OK, "hres = %lx\n", hres);
+    ok(size == sizeof(DWORD), "size = %ld\n", size);
 
     data = 0xdeadbeef;
     hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, &data, &size);
-    ok(hres == S_OK, "hres = %x\n", hres);
-    ok(size == sizeof(DWORD), "size = %d\n", size);
-    ok(data == 1234, "data = %d\n", data);
+    ok(hres == S_OK, "hres = %lx\n", hres);
+    ok(size == sizeof(DWORD), "size = %ld\n", size);
+    ok(data == 1234, "data = %ld\n", data);
 
     hres = pSKAllocValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, (void**)&alloc_data, &size);
-    ok(hres == S_OK, "hres= %x\n", hres);
-    ok(size == sizeof(DWORD), "size = %d\n", size);
+    ok(hres == S_OK, "hres= %lx\n", hres);
+    ok(size == sizeof(DWORD), "size = %ld\n", size);
     if (SUCCEEDED(hres))
     {
-        ok(*alloc_data == 1234, "*alloc_data = %d\n", *alloc_data);
+        ok(*alloc_data == 1234, "*alloc_data = %ld\n", *alloc_data);
         LocalFree(alloc_data);
     }
 
     hres = pSKDeleteValueW(SHKEY_Root_HKLM, WineTestW, NULL);
-    ok(hres == S_OK, "hres = %x\n", hres);
+    ok(hres == S_OK, "hres = %lx\n", hres);
 
     hres = pSKDeleteValueW(SHKEY_Root_HKLM, WineTestW, NULL);
-    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %x\n", hres);
+    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %lx\n", hres);
 
     hres = pSKGetValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, &data, &size);
-    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %x\n", hres);
+    ok(hres == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "hres = %lx\n", hres);
 
     hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
     ok(hkey != NULL, "Can't create key\n");
@@ -2953,21 +2953,21 @@ static void test_SHSetParentHwnd(void)
     ret = GetParent(hwnd);
     ok(ret == NULL, "got %p\n", ret);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
+    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08lx\n", style);
     ret = pSHSetParentHwnd(hwnd, NULL);
     ok(ret == NULL, "got %p\n", ret);
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
+    ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08lx\n", style);
 
     /* reset to null parent from not null */
     ret = GetParent(hwnd2);
     ok(ret == hwnd, "got %p\n", ret);
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
+    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08lx\n", style);
     ret = pSHSetParentHwnd(hwnd2, NULL);
     ok(ret == NULL, "got %p\n", ret);
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_POPUP|WS_CHILD)) == WS_POPUP, "got style 0x%08x\n", style);
+    ok((style & (WS_POPUP|WS_CHILD)) == WS_POPUP, "got style 0x%08lx\n", style);
     ret = GetParent(hwnd2);
     ok(ret == NULL, "got %p\n", ret);
 
@@ -2975,13 +2975,13 @@ static void test_SHSetParentHwnd(void)
     style = GetWindowLongA(hwnd2, GWL_STYLE);
     SetWindowLongA(hwnd2, GWL_STYLE, style & ~(WS_CHILD|WS_POPUP));
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_CHILD|WS_POPUP)) == 0, "got 0x%08x\n", style);
+    ok((style & (WS_CHILD|WS_POPUP)) == 0, "got 0x%08lx\n", style);
 
     ret = pSHSetParentHwnd(hwnd2, hwnd);
     todo_wine ok(ret == NULL, "got %p\n", ret);
 
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
+    ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08lx\n", style);
     ret = GetParent(hwnd2);
     ok(ret == hwnd, "got %p\n", ret);
 
@@ -2992,7 +2992,7 @@ static void test_SHSetParentHwnd(void)
     ret = pSHSetParentHwnd(hwnd2, hwnd);
     todo_wine ok(ret == NULL, "got %p\n", ret);
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
+    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08lx\n", style);
     ret = GetParent(hwnd2);
     ok(ret == hwnd, "got %p\n", ret);
 
@@ -3002,7 +3002,7 @@ static void test_SHSetParentHwnd(void)
     ret = pSHSetParentHwnd(hwnd2, hwnd);
     todo_wine ok(ret == hwnd, "got %p\n", ret);
     style = GetWindowLongA(hwnd2, GWL_STYLE);
-    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
+    ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08lx\n", style);
     ret = GetParent(hwnd2);
     ok(ret == hwnd, "got %p\n", ret);
 
@@ -3078,14 +3078,14 @@ static void test_IUnknown_GetClassID(void)
     memset(&clsid, 0xcc, sizeof(clsid));
     memset(&clsid3, 0xcc, sizeof(clsid3));
     hr = pIUnknown_GetClassID(NULL, &clsid);
-    ok(hr == E_FAIL, "got 0x%08x\n", hr);
+    ok(hr == E_FAIL, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k, winxp, win2k3 */,
         "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     memset(&clsid, 0xcc, sizeof(clsid));
     memset(&clsid2, 0xab, sizeof(clsid2));
     hr = pIUnknown_GetClassID((IUnknown*)&testpersist, &clsid);
-    ok(hr == 0x8fff2222, "got 0x%08x\n", hr);
+    ok(hr == 0x8fff2222, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &clsid2) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k3 */,
         "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
@@ -3094,7 +3094,7 @@ static void test_IUnknown_GetClassID(void)
     memset(&clsid2, 0xab, sizeof(clsid2));
     memset(&clsid3, 0xcc, sizeof(clsid3));
     hr = pIUnknown_GetClassID((IUnknown*)&testpersist2, &clsid);
-    ok(hr == 0x8fff2222, "got 0x%08x\n", hr);
+    ok(hr == 0x8fff2222, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &clsid2) || broken(IsEqualCLSID(&clsid, &clsid3)) /* win2k3 */,
         "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 }
@@ -3104,7 +3104,7 @@ static void test_DllGetVersion(void)
     HRESULT hr;
 
     hr = pDllGetVersion(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 }
 
 START_TEST(ordinal)
@@ -3121,7 +3121,7 @@ START_TEST(ordinal)
     {
         DWORD procid;
         HANDLE hmem;
-        sscanf(argv[2], "%d", &procid);
+        sscanf(argv[2], "%ld", &procid);
         sscanf(argv[3], "%p", &hmem);
         test_alloc_shared_remote(procid, hmem);
         return;
diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c
index dbe1f36fbfd..4614d3fea25 100644
--- a/dlls/shlwapi/tests/path.c
+++ b/dlls/shlwapi/tests/path.c
@@ -279,19 +279,19 @@ static void test_PathCreateFromUrl(void)
     /* Won't say how much is needed without a buffer */
     len = 0xdeca;
     ret = pPathCreateFromUrlA("file://foo", NULL, &len, 0);
-    ok(ret == E_INVALIDARG, "got 0x%08x expected E_INVALIDARG\n", ret);
-    ok(len == 0xdeca, "got %x expected 0xdeca\n", len);
+    ok(ret == E_INVALIDARG, "got 0x%08lx expected E_INVALIDARG\n", ret);
+    ok(len == 0xdeca, "got %lx expected 0xdeca\n", len);
 
     /* Test the decoding itself */
     for (i = 0; i < ARRAY_SIZE(TEST_PATHFROMURL); i++) {
         len = INTERNET_MAX_URL_LENGTH;
         ret = pPathCreateFromUrlA(TEST_PATHFROMURL[i].url, ret_path, &len, 0);
         todo_wine_if (TEST_PATHFROMURL[i].todo & 0x1)
-            ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url %s\n", ret, TEST_PATHFROMURL[i].url);
+            ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url %s\n", ret, TEST_PATHFROMURL[i].url);
         if(SUCCEEDED(ret) && TEST_PATHFROMURL[i].path) {
             if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
                 ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path,  TEST_PATHFROMURL[i].url);
-                ok(len == strlen(ret_path), "ret len %d from url %s\n", len, TEST_PATHFROMURL[i].url);
+                ok(len == strlen(ret_path), "ret len %ld from url %s\n", len, TEST_PATHFROMURL[i].url);
             } else todo_wine
                 /* Wrong string, don't bother checking the length */
                 ok(!lstrcmpiA(ret_path, TEST_PATHFROMURL[i].path), "got %s expected %s from url %s\n", ret_path, TEST_PATHFROMURL[i].path,  TEST_PATHFROMURL[i].url);
@@ -304,12 +304,12 @@ static void test_PathCreateFromUrl(void)
             ret = pPathCreateFromUrlW(urlW, ret_pathW, &len, 0);
             WideCharToMultiByte(CP_ACP, 0, ret_pathW, -1, ret_path, sizeof(ret_path),NULL,NULL);
             todo_wine_if (TEST_PATHFROMURL[i].todo & 0x1)
-                ok(ret == TEST_PATHFROMURL[i].ret, "ret %08x from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
+                ok(ret == TEST_PATHFROMURL[i].ret, "ret %08lx from url L\"%s\"\n", ret, TEST_PATHFROMURL[i].url);
             if(SUCCEEDED(ret) && TEST_PATHFROMURL[i].path) {
                 if(!(TEST_PATHFROMURL[i].todo & 0x2)) {
                     ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
                        ret_path, TEST_PATHFROMURL[i].path, TEST_PATHFROMURL[i].url);
-                    ok(len == lstrlenW(ret_pathW), "ret len %d from url L\"%s\"\n", len, TEST_PATHFROMURL[i].url);
+                    ok(len == lstrlenW(ret_pathW), "ret len %ld from url L\"%s\"\n", len, TEST_PATHFROMURL[i].url);
                 } else todo_wine
                     /* Wrong string, don't bother checking the length */
                     ok(!lstrcmpiW(ret_pathW, pathW), "got %s expected %s from url L\"%s\"\n",
@@ -321,9 +321,9 @@ static void test_PathCreateFromUrl(void)
                 /* Check what happens if the buffer is too small */
                 len2 = 2;
                 ret = pPathCreateFromUrlW(urlW, ret_pathW, &len2, 0);
-                ok(ret == E_POINTER, "ret %08x, expected E_POINTER from url %s\n", ret, TEST_PATHFROMURL[i].url);
+                ok(ret == E_POINTER, "ret %08lx, expected E_POINTER from url %s\n", ret, TEST_PATHFROMURL[i].url);
                 todo_wine_if (TEST_PATHFROMURL[i].todo & 0x4)
-                    ok(len2 == len + 1, "got len = %d expected %d from url %s\n", len2, len + 1, TEST_PATHFROMURL[i].url);
+                    ok(len2 == len + 1, "got len = %ld expected %ld from url %s\n", len2, len + 1, TEST_PATHFROMURL[i].url);
             }
 
             FreeWideString(urlW);
@@ -338,7 +338,7 @@ static void test_PathCreateFromUrl(void)
 
         pathW = NULL;
         ret = pPathCreateFromUrlAlloc(fileW, &pathW, 0);
-        ok(ret == S_OK, "got 0x%08x expected S_OK\n", ret);
+        ok(ret == S_OK, "got 0x%08lx expected S_OK\n", ret);
         ok(lstrcmpiW(pathW, fooW) == 0, "got %s expected %s\n", wine_dbgstr_w(pathW), wine_dbgstr_w(fooW));
         HeapFree(GetProcessHeap(), 0, pathW);
     }
@@ -566,19 +566,19 @@ static void test_PathCombineA(void)
     SetLastError(0xdeadbeef);
     str = PathCombineA(NULL, "C:\\", "one\\two\\three");
     ok(str == NULL, "Expected NULL, got %p\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try NULL dest and NULL directory */
     SetLastError(0xdeadbeef);
     str = PathCombineA(NULL, NULL, "one\\two\\three");
     ok(str == NULL, "Expected NULL, got %p\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try all NULL*/
     SetLastError(0xdeadbeef);
     str = PathCombineA(NULL, NULL, NULL);
     ok(str == NULL, "Expected NULL, got %p\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try NULL file part */
     SetLastError(0xdeadbeef);
@@ -586,7 +586,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", NULL);
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try empty file part */
     SetLastError(0xdeadbeef);
@@ -594,7 +594,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try empty directory and file part */
     SetLastError(0xdeadbeef);
@@ -604,7 +604,7 @@ static void test_PathCombineA(void)
     ok(!lstrcmpA(str, "\\") ||
        broken(!lstrcmpA(str, "control")), /* Win95 and some W2K */
        "Expected \\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try NULL directory */
     SetLastError(0xdeadbeef);
@@ -612,7 +612,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, NULL, "one\\two\\three");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "one\\two\\three"), "Expected one\\two\\three, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try NULL directory and empty file part */
     SetLastError(0xdeadbeef);
@@ -624,7 +624,7 @@ static void test_PathCombineA(void)
        "Expected \\, got %s\n", str);
     ok(GetLastError() == 0xdeadbeef ||
        broken(GetLastError() == ERROR_INVALID_PARAMETER), /* Win95 */
-       "Expected 0xdeadbeef, got %d\n", GetLastError());
+       "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try NULL directory and file part */
     SetLastError(0xdeadbeef);
@@ -635,7 +635,7 @@ static void test_PathCombineA(void)
        "Expected str == NULL, got %p\n", str);
     ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
        "Expected 0 length, got %i\n", lstrlenA(dest));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try directory without backslash */
     SetLastError(0xdeadbeef);
@@ -643,7 +643,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:", "one\\two\\three");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try directory with backslash */
     SetLastError(0xdeadbeef);
@@ -651,7 +651,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "one\\two\\three");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try directory with backslash and file with prepended backslash */
     SetLastError(0xdeadbeef);
@@ -659,7 +659,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "\\one\\two\\three");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try previous test, with backslash appended as well */
     SetLastError(0xdeadbeef);
@@ -667,13 +667,13 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "\\one\\two\\three\\");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a relative directory */
     SetLastError(0xdeadbeef);
     lstrcpyA(dest, "control");
     str = PathCombineA(dest, "relative\\dir", "\\one\\two\\three\\");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     /* Vista fails which probably makes sense as PathCombineA expects an absolute dir */
     if (str)
     {
@@ -687,7 +687,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "one/two/three\\");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one/two/three\\"), "Expected one/two/three\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a really weird directory */
     SetLastError(0xdeadbeef);
@@ -695,7 +695,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\/\\/", "\\one\\two\\three\\");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try periods */
     SetLastError(0xdeadbeef);
@@ -703,7 +703,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "one\\..\\two\\.\\three");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\two\\three"), "Expected C:\\two\\three, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try .. as file */
     /* try forward slashes */
@@ -712,7 +712,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "C:\\", "..");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "C:\\"), "Expected C:\\, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try relative paths */
     /* try forward slashes */
@@ -721,7 +721,7 @@ static void test_PathCombineA(void)
     str = PathCombineA(dest, "../../../one/two/", "*");
     ok(str == dest, "Expected str == dest, got %p\n", str);
     ok(!lstrcmpA(str, "../../../one/two/\\*"), "Expected ../../../one/two/\\*, got %s\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     memset(too_long, 'a', LONG_LEN);
     too_long[LONG_LEN - 1] = '\0';
@@ -733,7 +733,7 @@ static void test_PathCombineA(void)
     ok(str == NULL, "Expected str == NULL, got %p\n", str);
     ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
        "Expected 0 length, got %i\n", lstrlenA(dest));
-    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a directory longer than MAX_PATH */
     SetLastError(0xdeadbeef);
@@ -742,7 +742,7 @@ static void test_PathCombineA(void)
     ok(str == NULL, "Expected str == NULL, got %p\n", str);
     ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
        "Expected 0 length, got %i\n", lstrlenA(dest));
-    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     memset(one, 'b', HALF_LEN);
     memset(two, 'c', HALF_LEN);
@@ -756,7 +756,7 @@ static void test_PathCombineA(void)
     ok(str == NULL, "Expected str == NULL, got %p\n", str);
     ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */
        "Expected 0 length, got %i\n", lstrlenA(dest));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathAddBackslash(void)
@@ -769,7 +769,7 @@ static void test_PathAddBackslash(void)
     SetLastError(0xdeadbeef);
     str = PathAddBackslashA(NULL);
     ok(str == NULL, "Expected str == NULL, got %p\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try an empty path */
     path[0] = '\0';
@@ -777,7 +777,7 @@ static void test_PathAddBackslash(void)
     str = PathAddBackslashA(path);
     ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
     ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a relative path */
     lstrcpyA(path, "one\\two");
@@ -785,7 +785,7 @@ static void test_PathAddBackslash(void)
     str = PathAddBackslashA(path);
     ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
     ok(!lstrcmpA(path, "one\\two\\"), "Expected one\\two\\, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try periods */
     lstrcpyA(path, "one\\..\\two");
@@ -793,7 +793,7 @@ static void test_PathAddBackslash(void)
     str = PathAddBackslashA(path);
     ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
     ok(!lstrcmpA(path, "one\\..\\two\\"), "Expected one\\..\\two\\, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try just a space */
     lstrcpyA(path, " ");
@@ -801,7 +801,7 @@ static void test_PathAddBackslash(void)
     str = PathAddBackslashA(path);
     ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
     ok(!lstrcmpA(path, " \\"), "Expected  \\, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* path already has backslash */
     lstrcpyA(path, "C:\\one\\");
@@ -809,7 +809,7 @@ static void test_PathAddBackslash(void)
     str = PathAddBackslashA(path);
     ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str);
     ok(!lstrcmpA(path, "C:\\one\\"), "Expected C:\\one\\, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     memset(too_long, 'a', LONG_LEN);
     too_long[LONG_LEN - 1] = '\0';
@@ -818,7 +818,7 @@ static void test_PathAddBackslash(void)
     SetLastError(0xdeadbeef);
     str = PathAddBackslashA(too_long);
     ok(str == NULL, "Expected str == NULL, got %p\n", str);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathAppendA(void)
@@ -834,28 +834,28 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, NULL);
     ok(!res, "Expected failure\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
 
     /* try empty pszMore */
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one"), "Expected C:\\one, got %s\n", path);
 
     /* try NULL pszPath */
     SetLastError(0xdeadbeef);
     res = PathAppendA(NULL, "two\\three");
     ok(!res, "Expected failure\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try empty pszPath */
     path[0] = '\0';
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "two\\three");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "two\\three"), "Expected \\two\\three, got %s\n", path);
 
     /* try empty pszPath and empty pszMore */
@@ -863,7 +863,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "\\"), "Expected \\, got %s\n", path);
 
     /* try legit params */
@@ -871,7 +871,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "two\\three");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
 
     /* try pszPath with backslash after it */
@@ -879,7 +879,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "two\\three");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
 
     /* try pszMore with backslash before it */
@@ -887,7 +887,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "\\two\\three");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one\\two\\three"), "Expected C:\\one\\two\\three, got %s\n", path);
 
     /* try pszMore with backslash after it */
@@ -895,7 +895,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "two\\three\\");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one\\two\\three\\"), "Expected C:\\one\\two\\three\\, got %s\n", path);
 
     /* try spaces in pszPath */
@@ -903,7 +903,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, "two\\three");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C: \\ one \\two\\three"), "Expected C: \\ one \\two\\three, got %s\n", path);
 
     /* try spaces in pszMore */
@@ -911,7 +911,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, " two \\ three ");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(path, "C:\\one\\ two \\ three "), "Expected 'C:\\one\\ two \\ three ', got %s\n", path);
 
     /* pszPath is too long */
@@ -920,7 +920,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(too_long, "two\\three");
     ok(!res, "Expected failure\n");
-    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */
        "Expected length of too_long to be zero, got %i\n", lstrlenA(too_long));
 
@@ -931,7 +931,7 @@ static void test_PathAppendA(void)
     SetLastError(0xdeadbeef);
     res = PathAppendA(path, too_long);
     ok(!res, "Expected failure\n");
-    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */
        "Expected length of path to be zero, got %i\n", lstrlenA(path));
 
@@ -945,7 +945,7 @@ static void test_PathAppendA(void)
     ok(!res, "Expected failure\n");
     ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */
        "Expected length of path to be zero, got %i\n", lstrlenA(path));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathCanonicalizeA(void)
@@ -960,7 +960,7 @@ static void test_PathCanonicalizeA(void)
     res = PathCanonicalizeA(dest, NULL);
     ok(!res, "Expected failure\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER, 
-       "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     ok(dest[0] == 0 || !lstrcmpA(dest, "test"),
        "Expected either an empty string (Vista) or test, got %s\n", dest);
 
@@ -969,7 +969,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "\\") ||
        broken(!lstrcmpA(dest, "test")), /* Win95 and some W2K */
        "Expected \\, got %s\n", dest);
@@ -979,14 +979,14 @@ static void test_PathCanonicalizeA(void)
     res = PathCanonicalizeA(NULL, "C:\\");
     ok(!res, "Expected failure\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER, 
-       "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* try empty dest */
     dest[0] = '\0';
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
 
     /* try non-empty dest */
@@ -994,7 +994,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\"), "Expected C:\\, got %s\n", dest);
 
     /* try a space for source */
@@ -1002,7 +1002,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, " ");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, " "), "Expected ' ', got %s\n", dest);
 
     /* try a relative path */
@@ -1010,7 +1010,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "one\\two");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "one\\two"), "Expected one\\two, got %s\n", dest);
 
     /* try current dir and previous dir */
@@ -1018,7 +1018,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\one\\.\\..\\two\\three\\..");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\two"), "Expected C:\\two, got %s\n", dest);
 
     /* try simple forward slashes */
@@ -1026,7 +1026,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\one/two/three\\four/five\\six");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\one/two/three\\four/five\\six"),
        "Expected C:\\one/two/three\\four/five\\six, got %s\n", dest);
 
@@ -1035,7 +1035,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\one/.\\two");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\one/.\\two"), "Expected C:\\one/.\\two, got %s\n", dest);
 
     /* try simple forward slashes with change dir */
@@ -1043,7 +1043,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\one/.\\two\\..");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\one/.") ||
        !lstrcmpA(dest, "C:\\one/"), /* Vista */
        "Expected \"C:\\one/.\" or \"C:\\one/\", got \"%s\"\n", dest);
@@ -1053,7 +1053,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "../../one/two/");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "../../one/two/"), "Expected ../../one/two/, got %s\n", dest);
 
     /* try relative forward slashes */
@@ -1061,7 +1061,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "../../one/two/\\*");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "../../one/two/\\*"), "Expected ../../one/two/\\*, got %s\n", dest);
 
     /* try forward slashes with change dirs
@@ -1072,7 +1072,7 @@ static void test_PathCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     res = PathCanonicalizeA(dest, "C:\\one/.\\..\\two/three\\..\\four/.five");
     ok(res, "Expected success\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     ok(!lstrcmpA(dest, "C:\\four/.five"), "Expected C:\\four/.five, got %s\n", dest);
 
     /* try src is too long */
@@ -1087,7 +1087,7 @@ static void test_PathCanonicalizeA(void)
     todo_wine
     {
         ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_FILENAME_EXCED_RANGE /* Vista */,
-        "Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %d\n", GetLastError());
+        "Expected 0xdeadbeef or ERROR_FILENAME_EXCED_RANGE, got %ld\n", GetLastError());
     }
     ok(lstrlenA(too_long) == LONG_LEN - 1, "Expected length LONG_LEN - 1, got %i\n", lstrlenA(too_long));
 }
@@ -1102,7 +1102,7 @@ static void test_PathFindExtensionA(void)
     SetLastError(0xdeadbeef);
     ext = PathFindExtensionA(NULL);
     ok(ext == NULL, "Expected NULL, got %p\n", ext);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try an empty path */
     path[0] = '\0';
@@ -1110,7 +1110,7 @@ static void test_PathFindExtensionA(void)
     ext = PathFindExtensionA(path);
     ok(ext == path, "Expected ext == path, got %p\n", ext);
     ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a path without an extension */
     lstrcpyA(path, "file");
@@ -1118,7 +1118,7 @@ static void test_PathFindExtensionA(void)
     ext = PathFindExtensionA(path);
     ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext);
     ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a path with an extension */
     lstrcpyA(path, "file.txt");
@@ -1127,7 +1127,7 @@ static void test_PathFindExtensionA(void)
     ok(ext == path + lstrlenA("file"),
        "Expected ext == path + lstrlenA(\"file\"), got %p\n", ext);
     ok(!lstrcmpA(ext, ".txt"), "Expected .txt, got %s\n", ext);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a path with two extensions */
     lstrcpyA(path, "file.txt.doc");
@@ -1136,7 +1136,7 @@ static void test_PathFindExtensionA(void)
     ok(ext == path + lstrlenA("file.txt"),
        "Expected ext == path + lstrlenA(\"file.txt\"), got %p\n", ext);
     ok(!lstrcmpA(ext, ".doc"), "Expected .txt, got %s\n", ext);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a path longer than MAX_PATH without an extension*/
     memset(too_long, 'a', LONG_LEN);
@@ -1144,7 +1144,7 @@ static void test_PathFindExtensionA(void)
     SetLastError(0xdeadbeef);
     ext = PathFindExtensionA(too_long);
     ok(ext == too_long + LONG_LEN - 1, "Expected ext == too_long + LONG_LEN - 1, got %p\n", ext);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try a path longer than MAX_PATH with an extension*/
     memset(too_long, 'a', LONG_LEN);
@@ -1155,7 +1155,7 @@ static void test_PathFindExtensionA(void)
     ext = PathFindExtensionA(too_long);
     ok(ext == too_long + 300, "Expected ext == too_long + 300, got %p\n", ext);
     ok(lstrlenA(ext) == LONG_LEN - 301, "Expected LONG_LEN - 301, got %i\n", lstrlenA(ext));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathBuildRootA(void)
@@ -1178,7 +1178,7 @@ static void test_PathBuildRootA(void)
         root = PathBuildRootA(path, j);
         ok(root == path, "Expected root == path, got %p\n", root);
         ok(!lstrcmpA(root, root_expected[j]), "Expected %s, got %s\n", root_expected[j], root);
-        ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+        ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
     }
 
     /* test a negative drive number */
@@ -1188,7 +1188,7 @@ static void test_PathBuildRootA(void)
     ok(root == path, "Expected root == path, got %p\n", root);
     ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
        "Expected aaaaaaaaa or empty string, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* test a drive number greater than 25 */
     SetLastError(0xdeadbeef);
@@ -1197,7 +1197,7 @@ static void test_PathBuildRootA(void)
     ok(root == path, "Expected root == path, got %p\n", root);
     ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */
        "Expected aaaaaaaaa or empty string, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* length of path is less than 4 */
     SetLastError(0xdeadbeef);
@@ -1205,13 +1205,13 @@ static void test_PathBuildRootA(void)
     root = PathBuildRootA(path, 0);
     ok(root == path, "Expected root == path, got %p\n", root);
     ok(!lstrcmpA(path, "A:\\"), "Expected A:\\, got %s\n", path);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* path is NULL */
     SetLastError(0xdeadbeef);
     root = PathBuildRootA(NULL, 0);
     ok(root == NULL, "Expected root == NULL, got %p\n", root);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathCommonPrefixA(void)
@@ -1231,7 +1231,7 @@ static void test_PathCommonPrefixA(void)
         ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
     }
     ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* test NULL path2 */
     SetLastError(0xdeadbeef);
@@ -1244,7 +1244,7 @@ static void test_PathCommonPrefixA(void)
         ok(!lstrcmpA(out, "aaa"), "Expected aaa, got %s\n", out);
     }
     ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* test empty path1 */
     SetLastError(0xdeadbeef);
@@ -1256,7 +1256,7 @@ static void test_PathCommonPrefixA(void)
     ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
     ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1));
     ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* test empty path1 */
     SetLastError(0xdeadbeef);
@@ -1268,7 +1268,7 @@ static void test_PathCommonPrefixA(void)
     ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
     ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2));
     ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* paths are legit, out is NULL */
     SetLastError(0xdeadbeef);
@@ -1278,7 +1278,7 @@ static void test_PathCommonPrefixA(void)
     ok(count == 3, "Expected 3, got %i\n", count);
     ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
     ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* all parameters legit */
     SetLastError(0xdeadbeef);
@@ -1290,7 +1290,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1);
     ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2);
     ok(!lstrcmpA(out, "C:\\"), "Expected C:\\, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* path1 and path2 not the same, but common prefix */
     SetLastError(0xdeadbeef);
@@ -1302,7 +1302,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "C:\\one\\two"), "Expected C:\\one\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "C:\\one\\three"), "Expected C:\\one\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "C:\\one"), "Expected C:\\one, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try . prefix */
     SetLastError(0xdeadbeef);
@@ -1314,7 +1314,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\.two"), "Expected one\\.two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\.three"), "Expected one\\.three, got %s\n", path2);
     ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try .. prefix */
     SetLastError(0xdeadbeef);
@@ -1326,7 +1326,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\..two"), "Expected one\\..two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\..three"), "Expected one\\..three, got %s\n", path2);
     ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try ... prefix */
     SetLastError(0xdeadbeef);
@@ -1338,7 +1338,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\...two"), "Expected one\\...two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\...three"), "Expected one\\...three, got %s\n", path2);
     ok(!lstrcmpA(out, "one"), "Expected one, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try .\ prefix */
     SetLastError(0xdeadbeef);
@@ -1350,7 +1350,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\.\\two"), "Expected one\\.\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\.\\three"), "Expected one\\.\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "one\\."), "Expected one\\., got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try ..\ prefix */
     SetLastError(0xdeadbeef);
@@ -1362,7 +1362,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\..\\three"), "Expected one\\..\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "one\\.."), "Expected one\\.., got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try ...\\ prefix */
     SetLastError(0xdeadbeef);
@@ -1374,7 +1374,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\...\\two"), "Expected one\\...\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\...\\three"), "Expected one\\...\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "one\\..."), "Expected one\\..., got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try prefix that is not an msdn labeled prefix type */
     SetLastError(0xdeadbeef);
@@ -1386,7 +1386,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "same"), "Expected same, got %s\n", path1);
     ok(!lstrcmpA(path2, "same"), "Expected same, got %s\n", path2);
     ok(!lstrcmpA(out, "same"), "Expected same, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try . after directory */
     SetLastError(0xdeadbeef);
@@ -1398,7 +1398,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\mid.\\two"), "Expected one\\mid.\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\mid.\\three"), "Expected one\\mid.\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "one\\mid."), "Expected one\\mid., got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try . in the middle of a directory */
     SetLastError(0xdeadbeef);
@@ -1410,7 +1410,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\mid.end\\two"), "Expected one\\mid.end\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "one\\mid.end\\three"), "Expected one\\mid.end\\three, got %s\n", path2);
     ok(!lstrcmpA(out, "one\\mid.end"), "Expected one\\mid.end, got %s\n", out);
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 
     /* try comparing a .. with the expanded path */
     SetLastError(0xdeadbeef);
@@ -1422,7 +1422,7 @@ static void test_PathCommonPrefixA(void)
     ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1);
     ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2);
     ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out));
-    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", GetLastError());
 }
 
 static void test_PathUnquoteSpaces(void)
@@ -1464,7 +1464,7 @@ static void test_PathGetDriveNumber(void)
     SetLastError(0xdeadbeef);
     ret = PathGetDriveNumberA(NULL);
     ok(ret == -1, "got %d\n", ret);
-    ok(GetLastError() == 0xdeadbeef, "got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "got %ld\n", GetLastError());
 
     ret = PathGetDriveNumberA(test1A);
     ok(ret == 0, "got %d\n", ret);
@@ -1507,20 +1507,20 @@ static void test_PathUnExpandEnvStrings(void)
     ok(ret, "got %d\n", ret);
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsA(envvarA, buff, sizeof(buff));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
 
     ret = GetEnvironmentVariableW(computernameW, envvarW, ARRAY_SIZE(envvarW));
     ok(ret, "got %d\n", ret);
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsW(envvarW, buffW, ARRAY_SIZE(buffW));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
 
     /* something that can't be represented with env var */
     strcpy(path, "somepath_name");
     strcpy(buff, "xx");
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
     ok(buff[0] == 'x', "wrong return string %s\n", buff);
 
     len = GetSystemDirectoryA(path, MAX_PATH);
@@ -1540,7 +1540,7 @@ static void test_PathUnExpandEnvStrings(void)
     strcpy(buff, "xx");
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsA(path, buff, sizeof(sysrootA));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
     ok(buff[0] == 'x', "wrong return string %s\n", buff);
 
     /* enough size */
@@ -1573,7 +1573,7 @@ static void test_PathUnExpandEnvStrings(void)
     strcat(path, sysdrvA);
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsA(path, buff, sizeof(buff));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
 
     ret = SetEnvironmentVariableA("SystemDrive", envvarA);
     ok(ret, "got %d\n", ret);
@@ -1585,7 +1585,7 @@ static void test_PathUnExpandEnvStrings(void)
     buffW[0] = 'x'; buffW[1] = 0;
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(buffW));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
     ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
 
     len = GetSystemDirectoryW(pathW, MAX_PATH);
@@ -1599,14 +1599,14 @@ static void test_PathUnExpandEnvStrings(void)
     buffW[0] = 'x'; buffW[1] = 0;
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsW(pathW, buffW, 5);
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
     ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
 
     /* buffer size is enough to hold variable name only */
     buffW[0] = 'x'; buffW[1] = 0;
     SetLastError(0xdeadbeef);
     ret = pPathUnExpandEnvStringsW(pathW, buffW, ARRAY_SIZE(sysrootW));
-    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %d\n", ret, GetLastError());
+    ok(!ret && GetLastError() == 0xdeadbeef, "got %d, error %ld\n", ret, GetLastError());
     ok(buffW[0] == 'x', "wrong return string %s\n", wine_dbgstr_w(buffW));
 
     /* enough size */
diff --git a/dlls/shlwapi/tests/shreg.c b/dlls/shlwapi/tests/shreg.c
index ca7fbad289e..3ce0551db39 100644
--- a/dlls/shlwapi/tests/shreg.c
+++ b/dlls/shlwapi/tests/shreg.c
@@ -83,7 +83,7 @@ static HKEY create_test_entries(void)
         SetEnvironmentVariableA("FOO", sEnvvar2);
 
         ret = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKey);
-	ok( ERROR_SUCCESS == ret, "RegCreateKeyA failed, ret=%u\n", ret);
+	ok( ERROR_SUCCESS == ret, "RegCreateKeyA failed, ret=%lu\n", ret);
 
 	if (hKey)
 	{
@@ -98,13 +98,13 @@ static HKEY create_test_entries(void)
 	nExpectedLen1 = strlen(sTestpath1) - strlen("%LONGSYSTEMVAR%") + strlen(sEnvvar1) + 1;
 	nExpectedLen2 = strlen(sTestpath2) - strlen("%FOO%") + strlen(sEnvvar2) + 1;
 	/* ExpandEnvironmentStringsA on NT4 returns 2x the correct result */
-	trace("sExplen1 = (%d)\n", nExpLen1);
+	trace("sExplen1 = (%ld)\n", nExpLen1);
 	if (nExpectedLen1 != nExpLen1)
-            trace( "Expanding %s failed (expected %d) - known bug in NT4\n", sTestpath1, nExpectedLen1 );
+            trace( "Expanding %s failed (expected %ld) - known bug in NT4\n", sTestpath1, nExpectedLen1 );
 
-        trace("sExplen2 = (%d)\n", nExpLen2);
+        trace("sExplen2 = (%ld)\n", nExpLen2);
 	if (nExpectedLen2 != nExpLen2)
-            trace( "Expanding %s failed (expected %d) - known bug in NT4\n", sTestpath2, nExpectedLen2 );	
+            trace( "Expanding %s failed (expected %ld) - known bug in NT4\n", sTestpath2, nExpectedLen2 );	
 
 	/* Make sure we carry on with correct values */
 	nExpLen1 = nExpectedLen1; 
@@ -123,21 +123,21 @@ static void test_SHGetValue(void)
 	dwSize = MAX_PATH;
 	dwType = -1;
         dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &dwType, buf, &dwSize);
-	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
+	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%lu\n", dwRet);
         ok( 0 == strcmp(sExpTestpath1, buf) ||
             broken(0 == strcmp(sTestpath1, buf)), /* IE4.x */
             "Comparing of (%s) with (%s) failed\n", buf, sExpTestpath1);
         ok( REG_SZ == dwType ||
             broken(REG_EXPAND_SZ == dwType), /* IE4.x */
-            "Expected REG_SZ, got (%u)\n", dwType);
+            "Expected REG_SZ, got (%lu)\n", dwType);
 
 	strcpy(buf, sEmptyBuffer);
 	dwSize = MAX_PATH;
 	dwType = -1;
         dwRet = SHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &dwType, buf, &dwSize);
-	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%u\n", dwRet);
+	ok( ERROR_SUCCESS == dwRet, "SHGetValueA failed, ret=%lu\n", dwRet);
 	ok( 0 == strcmp(sTestpath1, buf) , "Comparing of (%s) with (%s) failed\n", buf, sTestpath1);
-	ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
+	ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
 }
 
 static void test_SHRegGetValue(void)
@@ -151,31 +151,31 @@ static void test_SHRegGetValue(void)
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
-    ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%lu\n", ret);
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_SZ, &type, data, &size);
-    ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%lu\n", ret);
     ok(!strcmp(data, sExpTestpath1), "data = %s, expected %s\n", data, sExpTestpath1);
-    ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
+    ok(type == REG_SZ, "type = %ld, expected REG_SZ\n", type);
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_DWORD, &type, data, &size);
-    ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%lu\n", ret);
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
-    ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%lu\n", ret);
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_SZ, &type, data, &size);
-    ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%lu\n", ret);
     ok(!strcmp(data, sTestpath1), "data = %s, expected %s\n", data, sTestpath1);
-    ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
+    ok(type == REG_SZ, "type = %ld, expected REG_SZ\n", type);
 
     size = MAX_PATH;
     ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_QWORD, &type, data, &size);
-    ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
+    ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%lu\n", ret);
 }
 
 static void test_SHGetRegPath(void)
@@ -188,7 +188,7 @@ static void test_SHGetRegPath(void)
 
 	strcpy(buf, sEmptyBuffer);
         dwRet = (*pSHRegGetPathA)(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", buf, 0);
-	ok( ERROR_SUCCESS == dwRet, "SHRegGetPathA failed, ret=%u\n", dwRet);
+	ok( ERROR_SUCCESS == dwRet, "SHRegGetPathA failed, ret=%lu\n", dwRet);
 	ok( 0 == strcmp(sExpTestpath1, buf) , "Comparing (%s) with (%s) failed\n", buf, sExpTestpath1);
 }
 
@@ -204,7 +204,7 @@ static void test_SHQueryValueEx(void)
 
         sTestedFunction = "RegOpenKeyExA";
         dwRet = RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0,  KEY_QUERY_VALUE, &hKey);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
 
 	/****** SHQueryValueExA ******/
 
@@ -215,15 +215,15 @@ static void test_SHQueryValueEx(void)
 	 * Case 1.1 All arguments are NULL
 	 */
         dwRet = SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
 
 	/*
 	 * Case 1.2 dwType is set
 	 */
 	dwType = -1;
         dwRet = SHQueryValueExA( hKey, "Test1", NULL, &dwType, NULL, NULL);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
-	ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
+	ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
 
 	/*
 	 * dwSize is set
@@ -231,18 +231,18 @@ static void test_SHQueryValueEx(void)
 	 */
 	dwSize = 6;
         dwRet = SHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &dwSize);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
-	ok( dwSize == nUsedBuffer1, "Buffer sizes (%u) and (%u) are not equal\n", dwSize, nUsedBuffer1);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
+	ok( dwSize == nUsedBuffer1, "Buffer sizes (%lu) and (%lu) are not equal\n", dwSize, nUsedBuffer1);
 
 	/*
          * dwExpanded > dwUnExpanded
 	 */
 	dwSize = 6;
         dwRet = SHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &dwSize);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
         ok( dwSize >= nUsedBuffer2 ||
             broken(dwSize == (strlen(sTestpath2) + 1)), /* < IE4.x */
-            "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
+            "Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
 
 	/*
 	 * Case 1 string shrinks during expanding
@@ -251,12 +251,12 @@ static void test_SHQueryValueEx(void)
 	dwSize = 6;
 	dwType = -1;
 	dwRet = SHQueryValueExA( hKey, "Test1", NULL, &dwType, buf, &dwSize);
-	ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
+	ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
 	ok( 0 == strcmp(sEmptyBuffer, buf) , "Comparing (%s) with (%s) failed\n", buf, sEmptyBuffer);
-	ok( dwSize == nUsedBuffer1, "Buffer sizes (%u) and (%u) are not equal\n", dwSize, nUsedBuffer1);
+	ok( dwSize == nUsedBuffer1, "Buffer sizes (%lu) and (%lu) are not equal\n", dwSize, nUsedBuffer1);
         ok( REG_SZ == dwType ||
             broken(REG_EXPAND_SZ == dwType), /* < IE6 */
-            "Expected REG_SZ, got (%u)\n", dwType);
+            "Expected REG_SZ, got (%lu)\n", dwType);
 
 	/*
 	 * string grows during expanding
@@ -266,14 +266,14 @@ static void test_SHQueryValueEx(void)
 	dwSize = 6;
 	dwType = -1;
 	dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, buf, &dwSize);
-	ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
+	ok( ERROR_MORE_DATA == dwRet, "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
 	ok( 0 == strcmp(sEmptyBuffer, buf) , "Comparing (%s) with (%s) failed\n", buf, sEmptyBuffer);
         ok( dwSize >= nUsedBuffer2 ||
             broken(dwSize == (strlen(sTestpath2) + 1)), /* < IE6 */
-            "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
+            "Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
         ok( REG_SZ == dwType ||
             broken(REG_EXPAND_SZ == dwType), /* < IE6 */
-            "Expected REG_SZ, got (%u)\n", dwType);
+            "Expected REG_SZ, got (%lu)\n", dwType);
 
         /*
          * string grows during expanding
@@ -288,7 +288,7 @@ static void test_SHQueryValueEx(void)
         ok( ERROR_MORE_DATA == dwRet ||
             broken(ERROR_ENVVAR_NOT_FOUND == dwRet) || /* IE5.5 */
             broken(ERROR_SUCCESS == dwRet), /* < IE5.5*/
-            "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
+            "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
 
         todo_wine
         {
@@ -298,8 +298,8 @@ static void test_SHQueryValueEx(void)
 
         ok( dwSize >= nUsedBuffer2 ||
             broken(dwSize == (strlen("") + 1)), /* < IE 5.5 */
-            "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
-        ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
+            "Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
+        ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
 
 	/*
          * string grows during expanding
@@ -314,7 +314,7 @@ static void test_SHQueryValueEx(void)
         ok( ERROR_MORE_DATA == dwRet ||
             broken(ERROR_ENVVAR_NOT_FOUND == dwRet) || /* IE5.5 */
             broken(ERROR_SUCCESS == dwRet), /* < IE5.5 */
-            "Expected ERROR_MORE_DATA, got (%u)\n", dwRet);
+            "Expected ERROR_MORE_DATA, got (%lu)\n", dwRet);
 
         todo_wine
         {
@@ -326,8 +326,8 @@ static void test_SHQueryValueEx(void)
         ok( dwSize >= nUsedBuffer2 ||
             broken(dwSize == (strlen(sEnvvar2) + 1)) || /* IE4.01 SP1 (W98) and IE5 (W98SE) */
             broken(dwSize == (strlen("") + 1)), /* IE4.01 (NT4) and IE5.x (W2K) */
-            "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
-	ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
+            "Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
+	ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
 
 	/*
 	 * The buffer is NULL but the size is set
@@ -336,11 +336,11 @@ static void test_SHQueryValueEx(void)
 	dwSize = 6;
 	dwType = -1;
 	dwRet = SHQueryValueExA( hKey, "Test3", NULL, &dwType, NULL, &dwSize);
-	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%u\n", sTestedFunction, dwRet);
+	ok( ERROR_SUCCESS == dwRet, "%s failed, ret=%lu\n", sTestedFunction, dwRet);
         ok( dwSize >= nUsedBuffer2 ||
             broken(dwSize == (strlen(sTestpath2) + 1)), /* IE4.01 SP1 (Win98) */
-            "Buffer size (%u) should be >= (%u)\n", dwSize, nUsedBuffer2);
-	ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
+            "Buffer size (%lu) should be >= (%lu)\n", dwSize, nUsedBuffer2);
+	ok( REG_SZ == dwType , "Expected REG_SZ, got (%lu)\n", dwType);
 
 	RegCloseKey(hKey);
 }
@@ -368,7 +368,7 @@ static void test_SHCopyKey(void)
         dwRet = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst);
         if (dwRet || !hKeyDst)
 	{
-                ok( 0, "Destination couldn't be created, RegCreateKeyA returned (%u)\n", dwRet);
+                ok( 0, "Destination couldn't be created, RegCreateKeyA returned (%lu)\n", dwRet);
 		return;
 	}
 
@@ -376,13 +376,13 @@ static void test_SHCopyKey(void)
         dwRet = RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc);
         if (dwRet || !hKeySrc)
 	{
-                ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
+                ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
                 RegCloseKey(hKeyDst);
 		return;
 	}
 
         dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
-        ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
+        ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%lu)\n", dwRet);
 
 	RegCloseKey(hKeySrc);
 	RegCloseKey(hKeyDst);
@@ -392,7 +392,7 @@ static void test_SHCopyKey(void)
         dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Shell Folders", &hKeyDst);
         if (dwRet || !hKeyDst)
 	{
-                ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
+                ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
 		return;
 	}
 
@@ -433,7 +433,7 @@ static void test_SHDeleteKey(void)
     {
 
         dwRet = SHDeleteKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC");
-        ok ( ERROR_SUCCESS == dwRet, "SHDeleteKey failed, ret=(%u)\n", dwRet);
+        ok ( ERROR_SUCCESS == dwRet, "SHDeleteKey failed, ret=(%lu)\n", dwRet);
 
         dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC", &hKeyS);
         ok ( ERROR_FILE_NOT_FOUND == dwRet, "SHDeleteKey did not delete\n");
@@ -457,7 +457,7 @@ static void test_SHRegCreateUSKeyW(void)
     }
 
     ret = pSHRegCreateUSKeyW(subkeyW, KEY_ALL_ACCESS, NULL, NULL, SHREGSET_FORCE_HKCU);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 }
 
 static void test_SHRegCloseUSKey(void)
@@ -473,20 +473,20 @@ static void test_SHRegCloseUSKey(void)
     }
 
     ret = pSHRegCloseUSKey(NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     ret = pSHRegOpenUSKeyW(localW, KEY_ALL_ACCESS, NULL, &key, FALSE);
-    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+    ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
 
     ret = pSHRegCloseUSKey(key);
-    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+    ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
 
     /* Test with limited rights, specially without KEY_SET_VALUE */
     ret = pSHRegOpenUSKeyW(localW, KEY_QUERY_VALUE, NULL, &key, FALSE);
-    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+    ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
 
     ret = pSHRegCloseUSKey(key);
-    ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+    ok(ret == ERROR_SUCCESS, "got %ld\n", ret);
 }
 
 START_TEST(shreg)
diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c
index 77c108e38bf..d988e26acb4 100644
--- a/dlls/shlwapi/tests/string.c
+++ b/dlls/shlwapi/tests/string.c
@@ -772,7 +772,7 @@ static void test_StrFromTimeIntervalA(void)
   {
     StrFromTimeIntervalA(szBuff, 256, result->ms, result->digits);
 
-    ok(!strcmp(result->time_interval, szBuff), "Formatted %d %d wrong: %s\n",
+    ok(!strcmp(result->time_interval, szBuff), "Formatted %ld %d wrong: %s\n",
        result->ms, result->digits, szBuff);
     result++;
   }
@@ -867,14 +867,14 @@ static void test_StrRetToBSTR(void)
     bstr = 0;
     ret = pStrRetToBSTR(&strret, NULL, &bstr);
     ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
-       "STRRET_WSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
+       "STRRET_WSTR: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
     SysFreeString(bstr);
 
     strret.uType = STRRET_CSTR;
     lstrcpyA(U(strret).cStr, "Test");
     ret = pStrRetToBSTR(&strret, NULL, &bstr);
     ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
-       "STRRET_CSTR: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
+       "STRRET_CSTR: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
     SysFreeString(bstr);
 
     strret.uType = STRRET_OFFSET;
@@ -882,7 +882,7 @@ static void test_StrRetToBSTR(void)
     strcpy((char*)&iidl, " Test");
     ret = pStrRetToBSTR(&strret, iidl, &bstr);
     ok(ret == S_OK && bstr && !wcscmp(bstr, szTestW),
-       "STRRET_OFFSET: dup failed, ret=0x%08x, bstr %p\n", ret, bstr);
+       "STRRET_OFFSET: dup failed, ret=0x%08lx, bstr %p\n", ret, bstr);
     SysFreeString(bstr);
 
     /* Native crashes if str is NULL */
@@ -987,7 +987,7 @@ static void test_SHAnsiToAnsi(void)
   memset(dest, '\n', sizeof(dest));
   dwRet = pSHAnsiToAnsi("hello", dest, ARRAY_SIZE(dest));
   ok(dwRet == 6 && !memcmp(dest, "hello\0\n\n", sizeof(dest)),
-     "SHAnsiToAnsi: expected 6, \"hello\\0\\n\\n\", got %d, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
+     "SHAnsiToAnsi: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
      dwRet, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
 }
 
@@ -1014,7 +1014,7 @@ static void test_SHUnicodeToUnicode(void)
   memcpy(dest, lpInit, sizeof(lpInit));
   dwRet = pSHUnicodeToUnicode(lpSrc, dest, ARRAY_SIZE(dest));
   ok(dwRet == 6 && !memcmp(dest, lpRes, sizeof(dest)),
-     "SHUnicodeToUnicode: expected 6, \"hello\\0\\n\\n\", got %d, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
+     "SHUnicodeToUnicode: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
      dwRet, dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);
 }
 
@@ -1098,7 +1098,7 @@ if (0)
         U(strret).pOleStr = StrDupW(wstr1);
         hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
         ok(hres == E_NOT_SUFFICIENT_BUFFER || broken(hres == S_OK) /* winxp */,
-           "StrRetToBufW returned %08x\n", hres);
+           "StrRetToBufW returned %08lx\n", hres);
         if (hres == E_NOT_SUFFICIENT_BUFFER)
             expect_eq(wbuf[0], 0, WCHAR, "%x");
         expect_eq(wbuf[9], 0, WCHAR, "%x");
@@ -1108,14 +1108,14 @@ if (0)
         strret.uType = STRRET_CSTR;
         StrCpyNA(U(strret).cStr, str1, MAX_PATH);
         hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
-        ok(hres == S_OK, "StrRetToBufW returned %08x\n", hres);
+        ok(hres == S_OK, "StrRetToBufW returned %08lx\n", hres);
         ok(!memcmp(wbuf, wstr1, 9*sizeof(WCHAR)) && !wbuf[9], "StrRetToBuf returned %s\n", wine_dbgstr_w(wbuf));
 
         memset(wbuf, 0xbf, sizeof(wbuf));
         strret.uType = STRRET_WSTR;
         U(strret).pOleStr = NULL;
         hres = pStrRetToBufW(&strret, NULL, wbuf, 10);
-        ok(hres == E_FAIL, "StrRetToBufW returned %08x\n", hres);
+        ok(hres == E_FAIL, "StrRetToBufW returned %08lx\n", hres);
         ok(!wbuf[0], "StrRetToBuf returned %s\n", wine_dbgstr_w(wbuf));
     }
     else
@@ -1126,7 +1126,7 @@ if (0)
         memset(buf, 0xbf, sizeof(buf));
         strret.uType = STRRET_CSTR;
         StrCpyNA(U(strret).cStr, str1, MAX_PATH);
-        expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%x");
+        expect_eq2(pStrRetToBufA(&strret, NULL, buf, 10), S_OK, E_NOT_SUFFICIENT_BUFFER /* Vista */, HRESULT, "%lx");
         expect_eq(buf[9], 0, CHAR, "%x");
         expect_eq(buf[10], (CHAR)0xbf, CHAR, "%x");
     }
@@ -1554,43 +1554,43 @@ static void test_StrCatChainW(void)
 
     /* Test with NULL buffer */
     ret = pStrCatChainW(NULL, 0, 0, beefW);
-    ok(ret == 0, "Expected StrCatChainW to return 0, got %u\n", ret);
+    ok(ret == 0, "Expected StrCatChainW to return 0, got %lu\n", ret);
 
     /* Test with empty buffer */
     memset(buf, 0x11, sizeof(buf));
     ret = pStrCatChainW(buf, 0, 0, beefW);
-    ok(ret == 0, "Expected StrCatChainW to return 0, got %u\n", ret);
+    ok(ret == 0, "Expected StrCatChainW to return 0, got %lu\n", ret);
     ok(buf[0] == 0x1111, "Expected buf[0] = 0x1111, got %x\n", buf[0]);
 
     memcpy(buf, deadbeefW, sizeof(deadbeefW));
     ret = pStrCatChainW(buf, 0, -1, beefW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
 
     /* Append data to existing string with offset = -1 */
     memset(buf, 0x11, sizeof(buf));
     ret = pStrCatChainW(buf, 32, 0, deadW);
-    ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
+    ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
     ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     ret = pStrCatChainW(buf, 32, -1, beefW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
 
     /* Append data at a fixed offset */
     memset(buf, 0x11, sizeof(buf));
     ret = pStrCatChainW(buf, 32, 0, deadW);
-    ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
+    ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
     ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     ret = pStrCatChainW(buf, 32, 4, beefW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
 
     /* Buffer exactly sufficient for string + terminating null */
     memset(buf, 0x11, sizeof(buf));
     ret = pStrCatChainW(buf, 5, 0, deadW);
-    ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
+    ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
     ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     /* Buffer too small, string will be truncated */
@@ -1604,14 +1604,14 @@ static void test_StrCatChainW(void)
         win_skip("Windows2000/XP behaviour detected for StrCatChainW, skipping tests\n");
         return;
     }
-    ok(ret == 3, "Expected StrCatChainW to return 3, got %u\n", ret);
+    ok(ret == 3, "Expected StrCatChainW to return 3, got %lu\n", ret);
     ok(!memcmp(buf, deadW, 3 * sizeof(WCHAR)), "Buffer contains wrong data\n");
     ok(!buf[3], "String is not nullterminated\n");
     ok(buf[4] == 0x1111, "Expected buf[4] = 0x1111, got %x\n", buf[4]);
 
     /* Overwrite part of an existing string */
     ret = pStrCatChainW(buf, 4, 1, beefW);
-    ok(ret == 3, "Expected StrCatChainW to return 3, got %u\n", ret);
+    ok(ret == 3, "Expected StrCatChainW to return 3, got %lu\n", ret);
     ok(buf[0] == 'D', "Expected buf[0] = 'D', got %x\n", buf[0]);
     ok(buf[1] == 'B', "Expected buf[1] = 'B', got %x\n", buf[1]);
     ok(buf[2] == 'e', "Expected buf[2] = 'e', got %x\n", buf[2]);
@@ -1623,35 +1623,35 @@ static void test_StrCatChainW(void)
     memcpy(buf, deadbeefW, sizeof(deadbeefW));
     memcpy(buf + 9, deadW, sizeof(deadW));
     ret = pStrCatChainW(buf, 9, 8, beefW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
     ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     /* Offset points at the end of the buffer */
     ret = pStrCatChainW(buf, 9, 9, beefW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
     ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     /* Offset points outside of the buffer */
     ret = pStrCatChainW(buf, 9, 10, beefW);
-    ok(ret == 10, "Expected StrCatChainW to return 10, got %u\n", ret);
+    ok(ret == 10, "Expected StrCatChainW to return 10, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
     ok(!memcmp(buf + 9, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
 
     /* The same but without nullterminated string */
     memcpy(buf, deadbeefW, sizeof(deadbeefW));
     ret = pStrCatChainW(buf, 5, -1, deadW);
-    ok(ret == 8, "Expected StrCatChainW to return 8, got %u\n", ret);
+    ok(ret == 8, "Expected StrCatChainW to return 8, got %lu\n", ret);
     ok(!memcmp(buf, deadbeefW, sizeof(deadbeefW)), "Buffer contains wrong data\n");
 
     ret = pStrCatChainW(buf, 5, 5, deadW);
-    ok(ret == 4, "Expected StrCatChainW to return 4, got %u\n", ret);
+    ok(ret == 4, "Expected StrCatChainW to return 4, got %lu\n", ret);
     ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
     ok(buf[5] == 'e', "Expected buf[5] = 'e', got %x\n", buf[5]);
 
     ret = pStrCatChainW(buf, 5, 6, deadW);
-    ok(ret == 6, "Expected StrCatChainW to return 6, got %u\n", ret);
+    ok(ret == 6, "Expected StrCatChainW to return 6, got %lu\n", ret);
     ok(!memcmp(buf, deadW, sizeof(deadW)), "Buffer contains wrong data\n");
     ok(buf[5] == 'e', "Expected buf[5] = 'e', got %x\n", buf[5]);
 }
diff --git a/dlls/shlwapi/tests/thread.c b/dlls/shlwapi/tests/thread.c
index 34eb98ca607..65a13a3ef49 100644
--- a/dlls/shlwapi/tests/thread.c
+++ b/dlls/shlwapi/tests/thread.c
@@ -104,44 +104,44 @@ static void test_SHCreateThreadRef(void)
 
     /* start with a clean state */
     hr = pSHSetThreadRef(NULL);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     pobj = NULL;
     refcount = 0xdeadbeef;
     hr = pSHCreateThreadRef(&refcount, &pobj);
     ok((hr == S_OK) && pobj && (refcount == 1),
-        "got 0x%x and %p with %d (expected S_OK and '!= NULL' with 1)\n",
+        "got 0x%lx and %p with %ld (expected S_OK and '!= NULL' with 1)\n",
         hr, pobj, refcount);
 
     /* the object is not automatic set as ThreadRef */
     punk = NULL;
     hr = pSHGetThreadRef(&punk);
     ok( (hr == E_NOINTERFACE) && (punk == NULL),
-        "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
+        "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
 
     /* set the object */
     hr = pSHSetThreadRef(pobj);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     /* read back */
     punk = NULL;
     hr = pSHGetThreadRef(&punk);
     ok( (hr == S_OK) && (punk == pobj) && (refcount == 2),
-        "got 0x%x and %p with %d (expected S_OK and %p with 2)\n",
+        "got 0x%lx and %p with %ld (expected S_OK and %p with 2)\n",
         hr, punk, refcount, pobj);
 
     /* free the ref from SHGetThreadRef */
     if (SUCCEEDED(hr)) {
         hr = IUnknown_Release(pobj);
         ok((hr == 1) && (hr == refcount),
-            "got %d with %d (expected 1 with 1)\n", hr, refcount);
+            "got %ld with %ld (expected 1 with 1)\n", hr, refcount);
     }
 
     /* free the object */
     if (pobj) {
         hr = IUnknown_Release(pobj);
         ok((hr == 0) && (hr == refcount),
-            "got %d with %d (expected 0 with 0)\n", hr, refcount);
+            "got %ld with %ld (expected 0 with 0)\n", hr, refcount);
     }
 
     if (0) {
@@ -149,25 +149,25 @@ static void test_SHCreateThreadRef(void)
            but the object no longer exist after the *_Release */
         punk = NULL;
         hr = pSHGetThreadRef(&punk);
-        trace("got 0x%x and %p with %d\n", hr, punk, refcount);
+        trace("got 0x%lx and %p with %ld\n", hr, punk, refcount);
     }
 
     /* remove the dead object pointer */
     hr = pSHSetThreadRef(NULL);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     /* parameter check */
     if (0) {
         /* vista: E_INVALIDARG, XP: crash */
         pobj = NULL;
         hr = pSHCreateThreadRef(NULL, &pobj);
-        ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+        ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
 
         refcount = 0xdeadbeef;
         /* vista: E_INVALIDARG, XP: crash */
         hr = pSHCreateThreadRef(&refcount, NULL);
         ok( (hr == E_INVALIDARG) && (refcount == 0xdeadbeef),
-            "got 0x%x with 0x%x (expected E_INVALIDARG and oxdeadbeef)\n",
+            "got 0x%lx with 0x%lx (expected E_INVALIDARG and oxdeadbeef)\n",
             hr, refcount);
     }
 }
@@ -187,7 +187,7 @@ static void test_SHGetThreadRef(void)
     punk = NULL;
     hr = pSHGetThreadRef(&punk);
     ok( (hr == E_NOINTERFACE) && (punk == NULL),
-        "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
+        "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
 
     if (0) {
         /* this crash on Windows */
@@ -210,7 +210,7 @@ static void test_SHSetThreadRef(void)
 
     /* start with a clean state */
     hr = pSHSetThreadRef(NULL);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     /* build and set out object */
     init_threadref(&ref, &refcount);
@@ -218,7 +218,7 @@ static void test_SHSetThreadRef(void)
     refcount = 1;
     hr = pSHSetThreadRef(&ref.IUnknown_iface);
     ok( (hr == S_OK) && (refcount == 1) && (!AddRef_called),
-        "got 0x%x with %d, %d (expected S_OK with 1, 0)\n",
+        "got 0x%lx with %ld, %ld (expected S_OK with 1, 0)\n",
         hr, refcount, AddRef_called);
 
     /* read back our object */
@@ -227,17 +227,17 @@ static void test_SHSetThreadRef(void)
     punk = NULL;
     hr = pSHGetThreadRef(&punk);
     ok( (hr == S_OK) && (punk == &ref.IUnknown_iface) && (refcount == 2) && (AddRef_called == 1),
-        "got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)\n",
+        "got 0x%lx and %p with %ld, %ld (expected S_OK and %p with 2, 1)\n",
         hr, punk, refcount, AddRef_called, &ref);
 
     /* clear the object pointer */
     hr = pSHSetThreadRef(NULL);
-    ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+    ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
 
     /* verify, that our object is no longer known as ThreadRef */
     hr = pSHGetThreadRef(&punk);
     ok( (hr == E_NOINTERFACE) && (punk == NULL),
-        "got 0x%x and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
+        "got 0x%lx and %p (expected E_NOINTERFACE and NULL)\n", hr, punk);
 
 }
 
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index c6c7e26cec6..476358c6d45 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -489,17 +489,17 @@ static void test_UrlApplyScheme(void)
         strcpy(newurl, "untouched");
         res = UrlApplySchemeA(TEST_APPLY[i].url, newurl, &len, TEST_APPLY[i].flags);
         ok( res == TEST_APPLY[i].res,
-            "#%dA: got HRESULT 0x%x (expected 0x%x)\n", i, res, TEST_APPLY[i].res);
+            "#%ldA: got HRESULT 0x%lx (expected 0x%lx)\n", i, res, TEST_APPLY[i].res);
         if (res == S_OK)
         {
-            ok(len == strlen(newurl), "Test %u: Expected length %u, got %u.\n", i, strlen(newurl), len);
-            ok(!strcmp(newurl, TEST_APPLY[i].newurl), "Test %u: Expected %s, got %s.\n",
+            ok(len == strlen(newurl), "Test %lu: Expected length %Iu, got %lu.\n", i, strlen(newurl), len);
+            ok(!strcmp(newurl, TEST_APPLY[i].newurl), "Test %lu: Expected %s, got %s.\n",
                     i, debugstr_a(TEST_APPLY[i].newurl), debugstr_a(newurl));
         }
         else
         {
-            ok(len == ARRAY_SIZE(newurl), "Test %u: Got length %u.\n", i, len);
-            ok(!strcmp(newurl, "untouched"), "Test %u: Got %s.\n", i, debugstr_a(newurl));
+            ok(len == ARRAY_SIZE(newurl), "Test %lu: Got length %lu.\n", i, len);
+            ok(!strcmp(newurl, "untouched"), "Test %lu: Got %s.\n", i, debugstr_a(newurl));
         }
 
         /* returned length is in character */
@@ -510,17 +510,17 @@ static void test_UrlApplyScheme(void)
         wcscpy(newurlW, L"untouched");
         res = UrlApplySchemeW(urlW, newurlW, &len, TEST_APPLY[i].flags);
         ok( res == TEST_APPLY[i].res,
-            "#%dW: got HRESULT 0x%x (expected 0x%x)\n", i, res, TEST_APPLY[i].res);
+            "#%ldW: got HRESULT 0x%lx (expected 0x%lx)\n", i, res, TEST_APPLY[i].res);
         if (res == S_OK)
         {
-            ok(len == wcslen(newurlW), "Test %u: Expected length %u, got %u.\n", i, wcslen(newurlW), len);
-            ok(!wcscmp(newurlW, expectW), "Test %u: Expected %s, got %s.\n",
+            ok(len == wcslen(newurlW), "Test %lu: Expected length %Iu, got %lu.\n", i, wcslen(newurlW), len);
+            ok(!wcscmp(newurlW, expectW), "Test %lu: Expected %s, got %s.\n",
                     i, debugstr_w(expectW), debugstr_w(newurlW));
         }
         else
         {
-            ok(len == ARRAY_SIZE(newurlW), "Test %u: Got length %u.\n", i, len);
-            ok(!wcscmp(newurlW, L"untouched"), "Test %u: Got %s.\n", i, debugstr_w(newurlW));
+            ok(len == ARRAY_SIZE(newurlW), "Test %lu: Got length %lu.\n", i, len);
+            ok(!wcscmp(newurlW, L"untouched"), "Test %lu: Got %s.\n", i, debugstr_w(newurlW));
         }
     }
 
@@ -528,28 +528,28 @@ static void test_UrlApplyScheme(void)
     lstrcpyA(newurl, untouchedA);
     len = lstrlenA(TEST_APPLY[0].newurl);
     res = UrlApplySchemeA(TEST_APPLY[0].url, newurl, &len, TEST_APPLY[0].flags);
-    ok(res == E_POINTER, "got HRESULT 0x%x (expected E_POINTER)\n", res);
+    ok(res == E_POINTER, "got HRESULT 0x%lx (expected E_POINTER)\n", res);
     /* The returned length include the space for the terminating 0 */
     i = lstrlenA(TEST_APPLY[0].newurl)+1;
-    ok(len == i, "got len %d (expected %d)\n", len, i);
+    ok(len == i, "got len %ld (expected %ld)\n", len, i);
     ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected '%s')\n", newurl, untouchedA);
 
     /* NULL as parameter. The length and the buffer are not modified */
     lstrcpyA(newurl, untouchedA);
     len = ARRAY_SIZE(newurl);
     res = UrlApplySchemeA(NULL, newurl, &len, TEST_APPLY[0].flags);
-    ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n", res);
-    ok(len == ARRAY_SIZE(newurl), "got len %d\n", len);
+    ok(res == E_INVALIDARG, "got HRESULT 0x%lx (expected E_INVALIDARG)\n", res);
+    ok(len == ARRAY_SIZE(newurl), "got len %ld\n", len);
     ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected '%s')\n", newurl, untouchedA);
 
     len = ARRAY_SIZE(newurl);
     res = UrlApplySchemeA(TEST_APPLY[0].url, NULL, &len, TEST_APPLY[0].flags);
-    ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n", res);
-    ok(len == ARRAY_SIZE(newurl), "got len %d\n", len);
+    ok(res == E_INVALIDARG, "got HRESULT 0x%lx (expected E_INVALIDARG)\n", res);
+    ok(len == ARRAY_SIZE(newurl), "got len %ld\n", len);
 
     lstrcpyA(newurl, untouchedA);
     res = UrlApplySchemeA(TEST_APPLY[0].url, newurl, NULL, TEST_APPLY[0].flags);
-    ok(res == E_INVALIDARG, "got HRESULT 0x%x (expected E_INVALIDARG)\n", res);
+    ok(res == E_INVALIDARG, "got HRESULT 0x%lx (expected E_INVALIDARG)\n", res);
     ok(!lstrcmpA(newurl, untouchedA), "got '%s' (expected '%s')\n", newurl, untouchedA);
 
 }
@@ -565,12 +565,12 @@ static void hash_url(const char* szUrl)
   DWORD cbSize = sizeof(DWORD);
   DWORD dwHash1, dwHash2;
   res = UrlHashA(szTestUrl, (LPBYTE)&dwHash1, cbSize);
-  ok(res == S_OK, "UrlHashA returned 0x%x (expected S_OK) for %s\n", res, szUrl);
+  ok(res == S_OK, "UrlHashA returned 0x%lx (expected S_OK) for %s\n", res, szUrl);
 
   res = UrlHashW(wszTestUrl, (LPBYTE)&dwHash2, cbSize);
-  ok(res == S_OK, "UrlHashW returned 0x%x (expected S_OK) for %s\n", res, szUrl);
+  ok(res == S_OK, "UrlHashW returned 0x%lx (expected S_OK) for %s\n", res, szUrl);
   ok(dwHash1 == dwHash2,
-      "Hashes didn't match (A: 0x%x, W: 0x%x) for %s\n", dwHash1, dwHash2, szUrl);
+      "Hashes didn't match (A: 0x%lx, W: 0x%lx) for %s\n", dwHash1, dwHash2, szUrl);
   FreeWideString(wszTestUrl);
 }
 
@@ -751,23 +751,23 @@ static void test_UrlGetPart(void)
     winetest_mute_threshold = 5;
 
     hr = UrlGetPartA(NULL, NULL, NULL, URL_PART_SCHEME, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = UrlGetPartA(NULL, buffer, &size, URL_PART_SCHEME, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = UrlGetPartA("res://some.dll/find.dlg", NULL, &size, URL_PART_SCHEME, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     hr = UrlGetPartA("res://some.dll/find.dlg", buffer, NULL, URL_PART_SCHEME, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
 
     size = 0;
     strcpy(buffer, "x");
     hr = UrlGetPartA("hi", buffer, &size, URL_PART_SCHEME, 0);
-    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
     ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
-    ok(!size, "Got size %u.\n", size);
+    ok(!size, "Got size %lu.\n", size);
 
     for (i = 0; i < ARRAY_SIZE(tests); ++i)
     {
@@ -777,7 +777,7 @@ static void test_UrlGetPart(void)
         DWORD flags = tests[i].flags;
         DWORD part = tests[i].part;
 
-        winetest_push_context("URL %s, part %#x, flags %#x", debugstr_a(url), part, flags);
+        winetest_push_context("URL %s, part %#lx, flags %#lx", debugstr_a(url), part, flags);
 
         size = 1;
         strcpy(buffer, "x");
@@ -785,14 +785,14 @@ static void test_UrlGetPart(void)
         todo_wine_if (tests[i].todo_hr)
         {
             if (tests[i].hr == S_OK)
-                ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+                ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
             else
-                ok(hr == tests[i].hr, "Got hr %#x.\n", hr);
+                ok(hr == tests[i].hr, "Got hr %#lx.\n", hr);
         }
 
         if (hr == S_FALSE)
         {
-            ok(!size, "Got size %u.\n", size);
+            ok(!size, "Got size %lu.\n", size);
             ok(!buffer[0], "Got result %s.\n", debugstr_a(buffer));
         }
         else
@@ -802,12 +802,12 @@ static void test_UrlGetPart(void)
                 if (expect)
                 {
                     todo_wine_if (tests[i].todo_hr || tests[i].todo_result)
-                        ok(size == strlen(expect) + 1, "Got size %u.\n", size);
+                        ok(size == strlen(expect) + 1, "Got size %lu.\n", size);
                 }
             }
             else
             {
-                ok(size == 1, "Got size %u.\n", size);
+                ok(size == 1, "Got size %lu.\n", size);
             }
             ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
         }
@@ -816,10 +816,10 @@ static void test_UrlGetPart(void)
         strcpy(buffer, "x");
         hr = UrlGetPartA(url, buffer, &size, part, flags);
         todo_wine_if (tests[i].todo_hr)
-            ok(hr == tests[i].hr, "Got hr %#x.\n", hr);
+            ok(hr == tests[i].hr, "Got hr %#lx.\n", hr);
         if (SUCCEEDED(hr))
         {
-            ok(size == strlen(buffer), "Got size %u.\n", size);
+            ok(size == strlen(buffer), "Got size %lu.\n", size);
             if (expect)
             {
                 todo_wine_if (tests[i].todo_hr || tests[i].todo_result)
@@ -828,7 +828,7 @@ static void test_UrlGetPart(void)
         }
         else
         {
-            ok(size == sizeof(buffer), "Got size %u.\n", size);
+            ok(size == sizeof(buffer), "Got size %lu.\n", size);
             ok(!strcmp(buffer, "x"), "Got result %s.\n", debugstr_a(buffer));
         }
 
@@ -840,14 +840,14 @@ static void test_UrlGetPart(void)
         todo_wine_if (tests[i].todo_hr || tests[i].hr == S_FALSE)
         {
             if (tests[i].hr == S_OK)
-                ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+                ok(hr == E_POINTER, "Got hr %#lx.\n", hr);
             else
-                ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#x.\n", hr);
+                ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
         }
 
         if (SUCCEEDED(hr))
         {
-            ok(!size, "Got size %u.\n", size);
+            ok(!size, "Got size %lu.\n", size);
             ok(!buffer[0], "Got result %s.\n", debugstr_a(buffer));
         }
         else
@@ -857,12 +857,12 @@ static void test_UrlGetPart(void)
                 if (expect)
                 {
                     todo_wine_if (tests[i].todo_hr || tests[i].todo_result)
-                        ok(size == strlen(expect) + 1, "Got size %u.\n", size);
+                        ok(size == strlen(expect) + 1, "Got size %lu.\n", size);
                 }
             }
             else
             {
-                ok(size == 1, "Got size %u.\n", size);
+                ok(size == 1, "Got size %lu.\n", size);
             }
             ok(!wcscmp(bufferW, L"x"), "Got result %s.\n", debugstr_w(bufferW));
         }
@@ -871,16 +871,16 @@ static void test_UrlGetPart(void)
         wcscpy(bufferW, L"x");
         hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
         todo_wine_if ((tests[i].hr == S_FALSE || tests[i].todo_hr) && strcmp(url, "a:") && strcmp(url, "0:"))
-            ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#x.\n", hr);
+            ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
         if (SUCCEEDED(hr))
         {
-            ok(size == wcslen(bufferW), "Got size %u.\n", size);
+            ok(size == wcslen(bufferW), "Got size %lu.\n", size);
             MultiByteToWideChar(CP_ACP, 0, buffer, -1, expectW, ARRAY_SIZE(expectW));
             ok(!wcscmp(bufferW, expectW), "Got result %s.\n", debugstr_w(bufferW));
         }
         else
         {
-            ok(size == ARRAY_SIZE(bufferW), "Got size %u.\n", size);
+            ok(size == ARRAY_SIZE(bufferW), "Got size %lu.\n", size);
             ok(!wcscmp(bufferW, L"x"), "Got result %s.\n", debugstr_w(bufferW));
         }
 
@@ -904,18 +904,18 @@ static void check_url_canonicalize(int index, const char *szUrl, DWORD dwFlags,
 
     dwSize = INTERNET_MAX_URL_LENGTH;
     ret = UrlCanonicalizeA(szUrl, NULL, &dwSize, dwFlags);
-    ok(ret == E_INVALIDARG, "Got unexpected hr %#x for index %d.\n", ret, index);
+    ok(ret == E_INVALIDARG, "Got unexpected hr %#lx for index %d.\n", ret, index);
     ret = UrlCanonicalizeA(szUrl, szReturnUrl, &dwSize, dwFlags);
     ok(ret == S_OK || (!szUrl[0] && ret == S_FALSE) /* Vista+ */,
-            "Got unexpected hr %#x for index %d.\n", ret, index);
+            "Got unexpected hr %#lx for index %d.\n", ret, index);
     todo_wine_if (todo)
-        ok(strcmp(szReturnUrl,szExpectUrl)==0, "UrlCanonicalizeA dwFlags 0x%08x url '%s' Expected \"%s\", but got \"%s\", index %d\n", dwFlags, szUrl, szExpectUrl, szReturnUrl, index);
+        ok(strcmp(szReturnUrl,szExpectUrl)==0, "UrlCanonicalizeA dwFlags 0x%08lx url '%s' Expected \"%s\", but got \"%s\", index %d\n", dwFlags, szUrl, szExpectUrl, szReturnUrl, index);
 
     dwSize = INTERNET_MAX_URL_LENGTH;
     ret = UrlCanonicalizeW(wszUrl, NULL, &dwSize, dwFlags);
-    ok(ret == E_INVALIDARG, "Got unexpected hr %#x for index %d.\n", ret, index);
+    ok(ret == E_INVALIDARG, "Got unexpected hr %#lx for index %d.\n", ret, index);
     ret = UrlCanonicalizeW(wszUrl, wszReturnUrl, &dwSize, dwFlags);
-    ok(ret == S_OK, "Got unexpected hr %#x for index %d.\n", ret, index);
+    ok(ret == S_OK, "Got unexpected hr %#lx for index %d.\n", ret, index);
 
     wszConvertedUrl = GetWideString(szReturnUrl);
     ok(lstrcmpW(wszReturnUrl, wszConvertedUrl)==0,
@@ -935,36 +935,36 @@ static void test_UrlEscapeA(void)
     char empty_string[] = "";
 
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", NULL, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 0, "got %d, expected %d\n", size, 0);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 0, "got %ld, expected %d\n", size, 0);
 
     size = 0;
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 0, "got %d, expected %d\n", size, 0);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 0, "got %ld, expected %d\n", size, 0);
 
     size = 1;
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", NULL, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 1, "got %d, expected %d\n", size, 1);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 1, "got %ld, expected %d\n", size, 1);
 
     size = 1;
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, NULL, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 1, "got %d, expected %d\n", size, 1);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 1, "got %ld, expected %d\n", size, 1);
 
     size = 1;
     empty_string[0] = 127;
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_POINTER, "got %x, expected %x\n", ret, E_POINTER);
-    ok(size == 34, "got %d, expected %d\n", size, 34);
+    ok(ret == E_POINTER, "got %lx, expected %lx\n", ret, E_POINTER);
+    ok(size == 34, "got %ld, expected %d\n", size, 34);
     ok(empty_string[0] == 127, "String has changed, empty_string[0] = %d\n", empty_string[0]);
 
     size = 1;
     empty_string[0] = 127;
     ret = UrlEscapeA("/woningplan/woonkamer basis.swf", empty_string, &size, URL_ESCAPE_AS_UTF8);
-    ok(ret == E_NOTIMPL, "Got unexpected hr %#x.\n", ret);
-    ok(size == 1, "Got unexpected size %u.\n", size);
+    ok(ret == E_NOTIMPL, "Got unexpected hr %#lx.\n", ret);
+    ok(size == 1, "Got unexpected size %lu.\n", size);
     ok(empty_string[0] == 127, "String has changed, empty_string[0] = %d\n", empty_string[0]);
 
     for (i = 0; i < ARRAY_SIZE(TEST_ESCAPE); i++) {
@@ -972,7 +972,7 @@ static void test_UrlEscapeA(void)
 
         size = INTERNET_MAX_URL_LENGTH;
         ret = UrlEscapeA(TEST_ESCAPE[i].url, ret_url, &size, TEST_ESCAPE[i].flags);
-        ok(ret == S_OK, "Got unexpected hr %#x for %s.\n", ret, debugstr_a(TEST_ESCAPE[i].url));
+        ok(ret == S_OK, "Got unexpected hr %#lx for %s.\n", ret, debugstr_a(TEST_ESCAPE[i].url));
         ok(!strcmp(ret_url, TEST_ESCAPE[i].expecturl), "Expected \"%s\", but got \"%s\" for \"%s\"\n",
             TEST_ESCAPE[i].expecturl, ret_url, TEST_ESCAPE[i].url);
     }
@@ -991,56 +991,56 @@ static void test_UrlEscapeW(void)
     /* Check error paths */
 
     ret = UrlEscapeW(L"/test", NULL, NULL, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
 
     size = 0;
     ret = UrlEscapeW(L"/test", NULL, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 0, "got %d, expected %d\n", size, 0);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 0, "got %ld, expected %d\n", size, 0);
 
     ret = UrlEscapeW(L"/test", empty_string, NULL, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
 
     size = 0;
     ret = UrlEscapeW(L"/test", empty_string, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 0, "got %d, expected %d\n", size, 0);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 0, "got %ld, expected %d\n", size, 0);
 
     ret = UrlEscapeW(L"/test", NULL, NULL, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
 
     size = 1;
     ret = UrlEscapeW(L"/test", NULL, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
-    ok(size == 1, "got %d, expected %d\n", size, 1);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
+    ok(size == 1, "got %ld, expected %d\n", size, 1);
 
     ret = UrlEscapeW(L"/test", empty_string, NULL, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_INVALIDARG, "got %x, expected %x\n", ret, E_INVALIDARG);
+    ok(ret == E_INVALIDARG, "got %lx, expected %lx\n", ret, E_INVALIDARG);
 
     size = 1;
     ret = UrlEscapeW(L"/test", empty_string, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_POINTER, "got %x, expected %x\n", ret, E_POINTER);
-    ok(size == 6, "got %d, expected %d\n", size, 6);
+    ok(ret == E_POINTER, "got %lx, expected %lx\n", ret, E_POINTER);
+    ok(size == 6, "got %ld, expected %d\n", size, 6);
 
     /* Check actual escaping */
 
     size = ARRAY_SIZE(overwrite);
     ret = UrlEscapeW(overwrite, overwrite, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == S_OK, "got %x, expected S_OK\n", ret);
-    ok(size == 9, "got %d, expected 9\n", size);
+    ok(ret == S_OK, "got %lx, expected S_OK\n", ret);
+    ok(size == 9, "got %ld, expected 9\n", size);
     ok(!wcscmp(overwrite, L"foo%20bar"), "Got unexpected string %s.\n", debugstr_w(overwrite));
 
     size = 1;
     wc = 127;
     ret = UrlEscapeW(overwrite, &wc, &size, URL_ESCAPE_SPACES_ONLY);
-    ok(ret == E_POINTER, "got %x, expected %x\n", ret, E_POINTER);
-    ok(size == 10, "got %d, expected 10\n", size);
+    ok(ret == E_POINTER, "got %lx, expected %lx\n", ret, E_POINTER);
+    ok(size == 10, "got %ld, expected 10\n", size);
     ok(wc == 127, "String has changed, wc = %d\n", wc);
 
     /* non-ASCII range */
     size = ARRAY_SIZE(ret_urlW);
     ret = UrlEscapeW(L"ftp\x1f\xff\xfa\x2122q/", ret_urlW, &size, 0);
-    ok(ret == S_OK, "got %x, expected S_OK\n", ret);
+    ok(ret == S_OK, "got %lx, expected S_OK\n", ret);
     ok(!wcscmp(ret_urlW, L"ftp%1F%FF%FA\x2122q/"), "Got unexpected string %s.\n", debugstr_w(ret_urlW));
 
     for (i = 0; i < ARRAY_SIZE(TEST_ESCAPE); i++) {
@@ -1051,8 +1051,8 @@ static void test_UrlEscapeW(void)
         urlW = GetWideString(TEST_ESCAPE[i].url);
         expected_urlW = GetWideString(TEST_ESCAPE[i].expecturl);
         ret = UrlEscapeW(urlW, ret_urlW, &size, TEST_ESCAPE[i].flags);
-        ok(ret == S_OK, "Got unexpected hr %#x for %s.\n", ret, debugstr_w(urlW));
-        ok(!lstrcmpW(ret_urlW, expected_urlW), "Expected %s, but got %s for %s flags %08x\n",
+        ok(ret == S_OK, "Got unexpected hr %#lx for %s.\n", ret, debugstr_w(urlW));
+        ok(!lstrcmpW(ret_urlW, expected_urlW), "Expected %s, but got %s for %s flags %08lx\n",
             wine_dbgstr_w(expected_urlW), wine_dbgstr_w(ret_urlW), wine_dbgstr_w(urlW), TEST_ESCAPE[i].flags);
         FreeWideString(urlW);
         FreeWideString(expected_urlW);
@@ -1063,7 +1063,7 @@ static void test_UrlEscapeW(void)
 
         size = INTERNET_MAX_URL_LENGTH;
         ret = UrlEscapeW(TEST_ESCAPEW[i].url, ret_url, &size, TEST_ESCAPEW[i].flags);
-        ok(ret == S_OK, "Got unexpected hr %#x for %s.\n", ret, debugstr_w(TEST_ESCAPEW[i].url));
+        ok(ret == S_OK, "Got unexpected hr %#lx for %s.\n", ret, debugstr_w(TEST_ESCAPEW[i].url));
         ok(!wcscmp(ret_url, TEST_ESCAPEW[i].expecturl)
                 || broken(!wcscmp(ret_url, TEST_ESCAPEW[i].win7url)),
                 "Expected %s, but got %s for %s.\n", debugstr_w(TEST_ESCAPEW[i].expecturl),
@@ -1087,18 +1087,18 @@ static void test_UrlCanonicalizeA(void)
     /* Parameter checks */
     dwSize = ARRAY_SIZE(szReturnUrl);
     hr = UrlCanonicalizeA(NULL, szReturnUrl, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     dwSize = ARRAY_SIZE(szReturnUrl);
     hr = UrlCanonicalizeA(winehqA, NULL, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, NULL, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     dwSize = 0;
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     /* buffer has no space for the result */
     dwSize=urllen-1;
@@ -1107,7 +1107,7 @@ static void test_UrlCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY  | URL_ESCAPE_UNSAFE);
     ok( (hr == E_POINTER) && (dwSize == (urllen + 1)),
-        "got 0x%x with %u and size %u for '%s' and %u (expected 'E_POINTER' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for '%s' and %u (expected 'E_POINTER' and size %lu)\n",
         hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen+1);
 
     /* buffer has no space for the terminating '\0' */
@@ -1117,7 +1117,7 @@ static void test_UrlCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == E_POINTER) && (dwSize == (urllen + 1)),
-        "got 0x%x with %u and size %u for '%s' and %u (expected 'E_POINTER' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for '%s' and %u (expected 'E_POINTER' and size %lu)\n",
         hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen+1);
 
     /* buffer has the required size */
@@ -1127,7 +1127,7 @@ static void test_UrlCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == S_OK) && (dwSize == urllen),
-        "got 0x%x with %u and size %u for '%s' and %u (expected 'S_OK' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for '%s' and %u (expected 'S_OK' and size %lu)\n",
         hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen);
 
     /* buffer is larger as the required size */
@@ -1137,7 +1137,7 @@ static void test_UrlCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == S_OK) && (dwSize == urllen),
-        "got 0x%x with %u and size %u for '%s' and %u (expected 'S_OK' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for '%s' and %u (expected 'S_OK' and size %lu)\n",
         hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), urllen);
 
     /* length is set to 0 */
@@ -1147,7 +1147,7 @@ static void test_UrlCanonicalizeA(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeA(winehqA, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == E_INVALIDARG) && (dwSize == 0),
-            "got 0x%x with %u and size %u for '%s' and %u (expected 'E_INVALIDARG' and size %u)\n",
+            "got 0x%lx with %lu and size %lu for '%s' and %u (expected 'E_INVALIDARG' and size %u)\n",
             hr, GetLastError(), dwSize, szReturnUrl, lstrlenA(szReturnUrl), 0);
 
     /* url length > INTERNET_MAX_URL_SIZE */
@@ -1156,7 +1156,7 @@ static void test_UrlCanonicalizeA(void)
     memcpy(longurl, winehqA, sizeof(winehqA)-1);
     longurl[sizeof(longurl)-1] = '\0';
     hr = UrlCanonicalizeA(longurl, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
-    ok(hr == S_OK, "hr = %x\n", hr);
+    ok(hr == S_OK, "hr = %lx\n", hr);
 
     /* test url-modification */
     for (i = 0; i < ARRAY_SIZE(TEST_CANONICALIZE); i++) {
@@ -1180,18 +1180,18 @@ static void test_UrlCanonicalizeW(void)
     /* Parameter checks */
     dwSize = ARRAY_SIZE(szReturnUrl);
     hr = UrlCanonicalizeW(NULL, szReturnUrl, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     dwSize = ARRAY_SIZE(szReturnUrl);
     hr = UrlCanonicalizeW(winehqW, NULL, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, NULL, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     dwSize = 0;
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, &dwSize, URL_UNESCAPE);
-    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
 
     /* buffer has no space for the result */
     dwSize = (urllen-1);
@@ -1200,7 +1200,7 @@ static void test_UrlCanonicalizeW(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == E_POINTER) && (dwSize == (urllen + 1)),
-        "got 0x%x with %u and size %u for %u (expected 'E_POINTER' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for %u (expected 'E_POINTER' and size %lu)\n",
         hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen+1);
 
 
@@ -1211,7 +1211,7 @@ static void test_UrlCanonicalizeW(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == E_POINTER) && (dwSize == (urllen + 1)),
-        "got 0x%x with %u and size %u for %u (expected 'E_POINTER' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for %u (expected 'E_POINTER' and size %lu)\n",
         hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen+1);
 
     /* buffer has the required size */
@@ -1221,7 +1221,7 @@ static void test_UrlCanonicalizeW(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == S_OK) && (dwSize == urllen),
-        "got 0x%x with %u and size %u for %u (expected 'S_OK' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for %u (expected 'S_OK' and size %lu)\n",
         hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen);
 
     /* buffer is larger as the required size */
@@ -1231,7 +1231,7 @@ static void test_UrlCanonicalizeW(void)
     SetLastError(0xdeadbeef);
     hr = UrlCanonicalizeW(winehqW, szReturnUrl, &dwSize, URL_WININET_COMPATIBILITY | URL_ESCAPE_UNSAFE);
     ok( (hr == S_OK) && (dwSize == urllen),
-        "got 0x%x with %u and size %u for %u (expected 'S_OK' and size %u)\n",
+        "got 0x%lx with %lu and size %lu for %u (expected 'S_OK' and size %lu)\n",
         hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen);
 
     /* check that the characters 1..32 are chopped from the end of the string */
@@ -1268,36 +1268,36 @@ static void check_url_combine(const char *szUrl1, const char *szUrl2, DWORD dwFl
     wszExpectUrl = GetWideString(szExpectUrl);
 
     hr = UrlCombineA(szUrl1, szUrl2, NULL, NULL, dwFlags);
-    ok(hr == E_INVALIDARG, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
+    ok(hr == E_INVALIDARG, "UrlCombineA returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
 
     dwSize = 0;
     hr = UrlCombineA(szUrl1, szUrl2, NULL, &dwSize, dwFlags);
-    ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
-    ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
+    ok(hr == E_POINTER, "Checking length of string, return was 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
+    ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
 
     dwSize--;
     hr = UrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
-    ok(hr == E_POINTER, "UrlCombineA returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
-    ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
+    ok(hr == E_POINTER, "UrlCombineA returned 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
+    ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
 
     hr = UrlCombineA(szUrl1, szUrl2, szReturnUrl, &dwSize, dwFlags);
-    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
+    ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+    ok(dwSize == dwExpectLen, "Got length %ld, expected %ld\n", dwSize, dwExpectLen);
     ok(!strcmp(szReturnUrl, szExpectUrl), "Expected %s, got %s.\n", szExpectUrl, szReturnUrl);
 
     dwSize = 0;
     hr = UrlCombineW(wszUrl1, wszUrl2, NULL, &dwSize, dwFlags);
-    ok(hr == E_POINTER, "Checking length of string, return was 0x%08x, expected 0x%08x\n", hr, E_POINTER);
-    ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
+    ok(hr == E_POINTER, "Checking length of string, return was 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
+    ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
 
     dwSize--;
     hr = UrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
-    ok(hr == E_POINTER, "UrlCombineW returned 0x%08x, expected 0x%08x\n", hr, E_POINTER);
-    ok(dwSize == dwExpectLen+1, "Got length %d, expected %d\n", dwSize, dwExpectLen+1);
+    ok(hr == E_POINTER, "UrlCombineW returned 0x%08lx, expected 0x%08lx\n", hr, E_POINTER);
+    ok(dwSize == dwExpectLen+1, "Got length %ld, expected %ld\n", dwSize, dwExpectLen+1);
 
     hr = UrlCombineW(wszUrl1, wszUrl2, wszReturnUrl, &dwSize, dwFlags);
-    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-    ok(dwSize == dwExpectLen, "Got length %d, expected %d\n", dwSize, dwExpectLen);
+    ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+    ok(dwSize == dwExpectLen, "Got length %ld, expected %ld\n", dwSize, dwExpectLen);
     wszConvertedUrl = GetWideString(szReturnUrl);
     ok(!wcscmp(wszReturnUrl, wszConvertedUrl), "Expected %s, got %s.\n",
             debugstr_w(wszConvertedUrl), debugstr_w(wszReturnUrl));
@@ -1331,20 +1331,20 @@ static void test_UrlCreateFromPath(void)
     for (i = 0; i < ARRAY_SIZE(TEST_URLFROMPATH); i++) {
         len = INTERNET_MAX_URL_LENGTH;
         ret = UrlCreateFromPathA(TEST_URLFROMPATH[i].path, ret_url, &len, 0);
-        ok(ret == TEST_URLFROMPATH[i].ret, "ret %08x from path %s\n", ret, TEST_URLFROMPATH[i].path);
+        ok(ret == TEST_URLFROMPATH[i].ret, "ret %08lx from path %s\n", ret, TEST_URLFROMPATH[i].path);
         ok(!lstrcmpiA(ret_url, TEST_URLFROMPATH[i].url), "url %s from path %s\n", ret_url, TEST_URLFROMPATH[i].path);
-        ok(len == strlen(ret_url), "ret len %d from path %s\n", len, TEST_URLFROMPATH[i].path);
+        ok(len == strlen(ret_url), "ret len %ld from path %s\n", len, TEST_URLFROMPATH[i].path);
 
         len = INTERNET_MAX_URL_LENGTH;
         pathW = GetWideString(TEST_URLFROMPATH[i].path);
         urlW = GetWideString(TEST_URLFROMPATH[i].url);
         ret = UrlCreateFromPathW(pathW, ret_urlW, &len, 0);
         WideCharToMultiByte(CP_ACP, 0, ret_urlW, -1, ret_url, sizeof(ret_url),0,0);
-        ok(ret == TEST_URLFROMPATH[i].ret, "ret %08x from path L\"%s\", expected %08x\n",
+        ok(ret == TEST_URLFROMPATH[i].ret, "ret %08lx from path L\"%s\", expected %08lx\n",
             ret, TEST_URLFROMPATH[i].path, TEST_URLFROMPATH[i].ret);
         ok(!lstrcmpiW(ret_urlW, urlW), "got %s expected %s from path L\"%s\"\n",
             ret_url, TEST_URLFROMPATH[i].url, TEST_URLFROMPATH[i].path);
-        ok(len == lstrlenW(ret_urlW), "ret len %d from path L\"%s\"\n", len, TEST_URLFROMPATH[i].path);
+        ok(len == lstrlenW(ret_urlW), "ret len %ld from path L\"%s\"\n", len, TEST_URLFROMPATH[i].path);
         FreeWideString(urlW);
         FreeWideString(pathW);
     }
@@ -1356,9 +1356,9 @@ static void test_UrlIs_null(DWORD flag)
 {
     BOOL ret;
     ret = UrlIsA(NULL, flag);
-    ok(ret == FALSE, "pUrlIsA(NULL, %d) failed\n", flag);
+    ok(ret == FALSE, "pUrlIsA(NULL, %ld) failed\n", flag);
     ret = UrlIsW(NULL, flag);
-    ok(ret == FALSE, "pUrlIsW(NULL, %d) failed\n", flag);
+    ok(ret == FALSE, "pUrlIsW(NULL, %ld) failed\n", flag);
 }
 
 static void test_UrlIs(void)
@@ -1431,7 +1431,7 @@ static void test_UrlUnescape(void)
         dwEscaped=INTERNET_MAX_URL_LENGTH;
         res = UrlUnescapeA(TEST_URL_UNESCAPE[i].url, szReturnUrl, &dwEscaped, 0);
         ok(res == S_OK,
-            "UrlUnescapeA returned 0x%x (expected S_OK) for \"%s\"\n",
+            "UrlUnescapeA returned 0x%lx (expected S_OK) for \"%s\"\n",
             res, TEST_URL_UNESCAPE[i].url);
         ok(strcmp(szReturnUrl,TEST_URL_UNESCAPE[i].expect)==0, "Expected \"%s\", but got \"%s\" from \"%s\"\n", TEST_URL_UNESCAPE[i].expect, szReturnUrl, TEST_URL_UNESCAPE[i].url);
 
@@ -1439,7 +1439,7 @@ static void test_UrlUnescape(void)
         /* if we set the buffer pointer to NULL here, UrlUnescape fails and the string is not converted */
         res = UrlUnescapeA(TEST_URL_UNESCAPE[i].url, szReturnUrl, NULL, 0);
         ok(res == E_INVALIDARG,
-            "UrlUnescapeA returned 0x%x (expected E_INVALIDARG) for \"%s\"\n",
+            "UrlUnescapeA returned 0x%lx (expected E_INVALIDARG) for \"%s\"\n",
             res, TEST_URL_UNESCAPE[i].url);
         ok(strcmp(szReturnUrl,"")==0, "Expected empty string\n");
 
@@ -1448,7 +1448,7 @@ static void test_UrlUnescape(void)
         expected_urlW = GetWideString(TEST_URL_UNESCAPE[i].expect);
         res = UrlUnescapeW(urlW, ret_urlW, &dwEscaped, 0);
         ok(res == S_OK,
-            "UrlUnescapeW returned 0x%x (expected S_OK) for \"%s\"\n",
+            "UrlUnescapeW returned 0x%lx (expected S_OK) for \"%s\"\n",
             res, TEST_URL_UNESCAPE[i].url);
 
         WideCharToMultiByte(CP_ACP,0,ret_urlW,-1,szReturnUrl,INTERNET_MAX_URL_LENGTH,0,0);
@@ -1461,23 +1461,23 @@ static void test_UrlUnescape(void)
 
     dwEscaped = sizeof(inplace);
     res = UrlUnescapeA(inplace, NULL, &dwEscaped, URL_UNESCAPE_INPLACE);
-    ok(res == S_OK, "UrlUnescapeA returned 0x%x (expected S_OK)\n", res);
+    ok(res == S_OK, "UrlUnescapeA returned 0x%lx (expected S_OK)\n", res);
     ok(!strcmp(inplace, expected), "got %s expected %s\n", inplace, expected);
-    ok(dwEscaped == 27, "got %d expected 27\n", dwEscaped);
+    ok(dwEscaped == 27, "got %ld expected 27\n", dwEscaped);
 
     /* if we set the buffer pointer to NULL, the string apparently still gets converted (Google Lively does this) */
     res = UrlUnescapeA(another_inplace, NULL, NULL, URL_UNESCAPE_INPLACE);
-    ok(res == S_OK, "UrlUnescapeA returned 0x%x (expected S_OK)\n", res);
+    ok(res == S_OK, "UrlUnescapeA returned 0x%lx (expected S_OK)\n", res);
     ok(!strcmp(another_inplace, expected), "got %s expected %s\n", another_inplace, expected);
 
     dwEscaped = sizeof(inplaceW);
     res = UrlUnescapeW(inplaceW, NULL, &dwEscaped, URL_UNESCAPE_INPLACE);
-    ok(res == S_OK, "UrlUnescapeW returned 0x%x (expected S_OK)\n", res);
-    ok(dwEscaped == 50, "got %d expected 50\n", dwEscaped);
+    ok(res == S_OK, "UrlUnescapeW returned 0x%lx (expected S_OK)\n", res);
+    ok(dwEscaped == 50, "got %ld expected 50\n", dwEscaped);
 
     /* if we set the buffer pointer to NULL, the string apparently still gets converted (Google Lively does this) */
     res = UrlUnescapeW(another_inplaceW, NULL, NULL, URL_UNESCAPE_INPLACE);
-    ok(res == S_OK, "UrlUnescapeW returned 0x%x (expected S_OK)\n", res);
+    ok(res == S_OK, "UrlUnescapeW returned 0x%lx (expected S_OK)\n", res);
 
     ok(lstrlenW(another_inplaceW) == 24, "got %d expected 24\n", lstrlenW(another_inplaceW));
 }
@@ -1518,7 +1518,7 @@ static void test_ParseURL(void)
         memset(&parseda, 0xd0, sizeof(parseda));
         parseda.cbSize = sizeof(parseda);
         hres = ParseURLA(test->url, &parseda);
-        ok(hres == test->hres, "ParseURL failed: %08x, expected %08x\n", hres, test->hres);
+        ok(hres == test->hres, "ParseURL failed: %08lx, expected %08lx\n", hres, test->hres);
         if(hres == S_OK) {
             ok(parseda.pszProtocol == test->url, "parseda.pszProtocol = %s, expected %s\n",
                parseda.pszProtocol, test->url);
@@ -1541,7 +1541,7 @@ static void test_ParseURL(void)
         memset(&parsedw, 0xd0, sizeof(parsedw));
         parsedw.cbSize = sizeof(parsedw);
         hres = ParseURLW(url, &parsedw);
-        ok(hres == test->hres, "ParseURL failed: %08x, expected %08x\n", hres, test->hres);
+        ok(hres == test->hres, "ParseURL failed: %08lx, expected %08lx\n", hres, test->hres);
         if(hres == S_OK) {
             ok(parsedw.pszProtocol == url, "parsedw.pszProtocol = %s, expected %s\n",
                wine_dbgstr_w(parsedw.pszProtocol), wine_dbgstr_w(url));
@@ -1582,28 +1582,28 @@ static void test_HashData(void)
 
     /* Test hashing with identically sized input/output buffers. */
     res = HashData(input, 16, output, 16);
-    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
+    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08lx\n", res);
     ok(!memcmp(output, expected, sizeof(expected)), "data didn't match\n");
 
     /* Test hashing with larger output buffer. */
     res = HashData(input, 16, output, 32);
-    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
+    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08lx\n", res);
     ok(!memcmp(output, expected2, sizeof(expected2)), "data didn't match\n");
 
     /* Test hashing with smaller input buffer. */
     res = HashData(input, 8, output, 16);
-    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
+    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08lx\n", res);
     ok(!memcmp(output, expected3, sizeof(expected3)), "data didn't match\n");
 
     /* Test passing NULL pointers for input/output parameters. */
     res = HashData(NULL, 0, NULL, 0);
-    ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
+    ok(res == E_INVALIDARG, "Got unexpected hr %#lx.\n", res);
 
     res = HashData(input, 0, NULL, 0);
-    ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
+    ok(res == E_INVALIDARG, "Got unexpected hr %#lx.\n", res);
 
     res = HashData(NULL, 0, output, 0);
-    ok(res == E_INVALIDARG, "Got unexpected hr %#x.\n", res);
+    ok(res == E_INVALIDARG, "Got unexpected hr %#lx.\n", res);
 
     /* Test passing valid pointers with sizes of zero. */
     for (i = 0; i < ARRAY_SIZE(input); i++)
@@ -1613,7 +1613,7 @@ static void test_HashData(void)
         output[i] = 0xFF;
 
     res = HashData(input, 0, output, 0);
-    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
+    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08lx\n", res);
 
     /* The buffers should be unchanged. */
     for (i = 0; i < ARRAY_SIZE(input); i++)
@@ -1624,12 +1624,12 @@ static void test_HashData(void)
 
     /* Input/output parameters are not validated. */
     res = HashData((BYTE *)0xdeadbeef, 0, (BYTE *)0xdeadbeef, 0);
-    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08x\n", res);
+    ok(res == S_OK, "Expected HashData to return S_OK, got 0x%08lx\n", res);
 
     if (0)
     {
         res = HashData((BYTE *)0xdeadbeef, 1, (BYTE *)0xdeadbeef, 1);
-        trace("HashData returned 0x%08x\n", res);
+        trace("HashData returned 0x%08lx\n", res);
     }
 }
 




More information about the wine-devel mailing list