[PATCH 14/20] dlls/ole32/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Wed Mar 2 02:04:21 CST 2022


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

---
 dlls/ole32/tests/Makefile.in      |    1 
 dlls/ole32/tests/clipboard.c      |  570 +++++++++---------
 dlls/ole32/tests/compobj.c        |  882 ++++++++++++++--------------
 dlls/ole32/tests/defaulthandler.c |   48 +-
 dlls/ole32/tests/dragdrop.c       |   40 +
 dlls/ole32/tests/errorinfo.c      |    8 
 dlls/ole32/tests/hglobalstream.c  |  144 ++---
 dlls/ole32/tests/marshal.c        |  248 ++++----
 dlls/ole32/tests/moniker.c        | 1162 +++++++++++++++++++------------------
 dlls/ole32/tests/ole2.c           |  826 +++++++++++++-------------
 dlls/ole32/tests/ole_server.c     |   86 +--
 dlls/ole32/tests/propvariant.c    |   72 +-
 dlls/ole32/tests/stg_prop.c       |  238 ++++----
 dlls/ole32/tests/storage32.c      |  724 ++++++++++++-----------
 dlls/ole32/tests/usrmarshal.c     |  238 ++++----
 15 files changed, 2643 insertions(+), 2644 deletions(-)

diff --git a/dlls/ole32/tests/Makefile.in b/dlls/ole32/tests/Makefile.in
index 2cc40927a5d..17710fb9a9a 100644
--- a/dlls/ole32/tests/Makefile.in
+++ b/dlls/ole32/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = ole32.dll
 IMPORTS   = oleaut32 ole32 user32 uuid gdi32 advapi32
 
diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c
index 97575371edc..998454e78c2 100644
--- a/dlls/ole32/tests/clipboard.c
+++ b/dlls/ole32/tests/clipboard.c
@@ -46,7 +46,7 @@ static inline char *dump_fmtetc(FORMATETC *fmt)
 {
     static char buf[100];
 
-    sprintf(buf, "cf %04x ptd %p aspect %x lindex %d tymed %x",
+    sprintf(buf, "cf %04x ptd %p aspect %lx lindex %ld tymed %lx",
              fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed);
     return buf;
 }
@@ -153,7 +153,7 @@ static HRESULT WINAPI EnumFormatImpl_Next(IEnumFORMATETC *iface, ULONG celt,
     ULONG count, i;
 
     if (winetest_debug > 1)
-        trace("next: count %d cur %d\n", celt, This->cur);
+        trace("next: count %ld cur %d\n", celt, This->cur);
 
     if(!rgelt)
         return E_INVALIDARG;
@@ -274,7 +274,7 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
 
     DataObjectImpl_GetData_calls++;
 
-    ok(pmedium->tymed == 0, "pmedium->tymed = %u\n", pmedium->tymed);
+    ok(pmedium->tymed == 0, "pmedium->tymed = %lu\n", pmedium->tymed);
     ok(U(*pmedium).hGlobal == NULL, "pmedium->hGlobal = %p\n", U(*pmedium).hGlobal);
     ok(pmedium->pUnkForRelease == NULL, "pmedium->pUnkForRelease = %p\n", pmedium->pUnkForRelease);
 
@@ -373,7 +373,7 @@ static HRESULT WINAPI DataObjectImpl_EnumFormatEtc(IDataObject* iface, DWORD dwD
     DataObjectImpl_EnumFormatEtc_calls++;
 
     if(dwDirection != DATADIR_GET) {
-        ok(0, "unexpected direction %d\n", dwDirection);
+        ok(0, "unexpected direction %ld\n", dwDirection);
         return E_NOTIMPL;
     }
     return EnumFormatImpl_Create(This->fmtetc, This->fmtetc_cnt, ppenumFormatEtc);
@@ -510,18 +510,18 @@ static void test_get_clipboard_uninitialized(void)
 
     pDObj = (IDataObject *)0xdeadbeef;
     hr = OleGetClipboard(&pDObj);
-    ok(hr == S_OK, "OleGetClipboard() got 0x%08x instead of 0x%08x\n", hr, S_OK);
+    ok(hr == S_OK, "OleGetClipboard() got 0x%08lx instead of 0x%08lx\n", hr, S_OK);
     ok(!!pDObj && pDObj != (IDataObject *)0xdeadbeef, "Got unexpected pDObj %p.\n", pDObj);
 
     /* COM is still not initialized. */
     hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "Got unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "Got unexpected hr %#lx.\n", hr);
 
     hr = OleFlushClipboard();
-    ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == E_FAIL, "Got unexpected hr %#lx.\n", hr);
 
     hr = OleIsCurrentClipboard(pDObj);
-    ok(hr == S_FALSE, "Got unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Got unexpected hr %#lx.\n", hr);
 
     IDataObject_Release(pDObj);
 }
@@ -534,10 +534,10 @@ static void test_get_clipboard(void)
     STGMEDIUM stgmedium;
 
     hr = OleGetClipboard(NULL);
-    ok(hr == E_INVALIDARG, "OleGetClipboard(NULL) should return E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "OleGetClipboard(NULL) should return E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = OleGetClipboard(&data_obj);
-    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08lx\n", hr);
 
     /* test IDataObject_QueryGetData */
 
@@ -546,31 +546,31 @@ static void test_get_clipboard(void)
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == S_OK, "IDataObject_QueryGetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_QueryGetData failed with error 0x%08lx\n", hr);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.dwAspect = 0xdeadbeef;
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08lx\n", hr);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.dwAspect = DVASPECT_THUMBNAIL;
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08lx\n", hr);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.lindex = 256;
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
     ok(hr == DV_E_FORMATETC || broken(hr == S_OK),
-        "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+        "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08lx\n", hr);
 
     InitFormatEtc(fmtetc, CF_RIFF, TYMED_HGLOBAL);
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == DV_E_CLIPFORMAT, "IDataObject_QueryGetData should have failed with DV_E_CLIPFORMAT instead of 0x%08x\n", hr);
+    ok(hr == DV_E_CLIPFORMAT, "IDataObject_QueryGetData should have failed with DV_E_CLIPFORMAT instead of 0x%08lx\n", hr);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_FILE);
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == S_OK, "IDataObject_QueryGetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_QueryGetData failed with error 0x%08lx\n", hr);
 
     expect_DataObjectImpl_QueryGetData = TRUE;
 
@@ -580,25 +580,25 @@ static void test_get_clipboard(void)
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.dwAspect = 0xdeadbeef;
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.dwAspect = DVASPECT_THUMBNAIL;
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.lindex = 256;
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == DV_E_FORMATETC || broken(hr == S_OK), "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC || broken(hr == S_OK), "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08lx\n", hr);
     if (hr == S_OK)
     {
         /* undo the unexpected success */
@@ -608,15 +608,15 @@ static void test_get_clipboard(void)
 
     InitFormatEtc(fmtetc, CF_RIFF, TYMED_HGLOBAL);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_FILE);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == DV_E_TYMED, "IDataObject_GetData should have failed with DV_E_TYMED instead of 0x%08x\n", hr);
+    ok(hr == DV_E_TYMED, "IDataObject_GetData should have failed with DV_E_TYMED instead of 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
-    ok(DataObjectImpl_GetData_calls == 6, "DataObjectImpl_GetData should have been called 6 times instead of %d times\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetData_calls == 6, "DataObjectImpl_GetData should have been called 6 times instead of %ld times\n", DataObjectImpl_GetData_calls);
 
     IDataObject_Release(data_obj);
 }
@@ -630,16 +630,16 @@ static void test_enum_fmtetc(IDataObject *src)
     DWORD count = 0;
 
     hr = OleGetClipboard(&data);
-    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08lx\n", hr);
 
     hr = IDataObject_EnumFormatEtc(data, DATADIR_SET, &enum_fmt);
     ok(hr == E_NOTIMPL ||
        broken(hr == E_INVALIDARG), /* win98 (not win98SE) */
-       "got %08x\n", hr);
+       "got %08lx\n", hr);
 
     DataObjectImpl_EnumFormatEtc_calls = 0;
     hr = IDataObject_EnumFormatEtc(data, DATADIR_GET, &enum_fmt);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(DataObjectImpl_EnumFormatEtc_calls == 0, "EnumFormatEtc was called\n");
     if (FAILED(hr))
     {
@@ -653,32 +653,32 @@ static void test_enum_fmtetc(IDataObject *src)
     {
         ok(src != NULL, "shouldn't be here\n");
         hr = IEnumFORMATETC_Next(src_enum, 1, &src_fmt, NULL);
-        ok(hr == S_OK, "%d: got %08x\n", count, hr);
-        trace("%d: %s\n", count, dump_fmtetc(&fmt));
-        ok(fmt.cfFormat == src_fmt.cfFormat, "%d: %04x %04x\n", count, fmt.cfFormat, src_fmt.cfFormat);
-        ok(fmt.dwAspect == src_fmt.dwAspect, "%d: %08x %08x\n", count, fmt.dwAspect, src_fmt.dwAspect);
-        ok(fmt.lindex == src_fmt.lindex, "%d: %08x %08x\n", count, fmt.lindex, src_fmt.lindex);
-        ok(fmt.tymed == src_fmt.tymed, "%d: %08x %08x\n", count, fmt.tymed, src_fmt.tymed);
+        ok(hr == S_OK, "%ld: got %08lx\n", count, hr);
+        trace("%ld: %s\n", count, dump_fmtetc(&fmt));
+        ok(fmt.cfFormat == src_fmt.cfFormat, "%ld: %04x %04x\n", count, fmt.cfFormat, src_fmt.cfFormat);
+        ok(fmt.dwAspect == src_fmt.dwAspect, "%ld: %08lx %08lx\n", count, fmt.dwAspect, src_fmt.dwAspect);
+        ok(fmt.lindex == src_fmt.lindex, "%ld: %08lx %08lx\n", count, fmt.lindex, src_fmt.lindex);
+        ok(fmt.tymed == src_fmt.tymed, "%ld: %08lx %08lx\n", count, fmt.tymed, src_fmt.tymed);
         if(fmt.ptd)
         {
-            ok(src_fmt.ptd != NULL, "%d: expected non-NULL\n", count);
+            ok(src_fmt.ptd != NULL, "%ld: expected non-NULL\n", count);
             CoTaskMemFree(fmt.ptd);
             CoTaskMemFree(src_fmt.ptd);
         }
         count++;
     }
 
-    ok(hr == S_FALSE, "%d: got %08x\n", count, hr);
+    ok(hr == S_FALSE, "%ld: got %08lx\n", count, hr);
 
     if(src)
     {
         hr = IEnumFORMATETC_Next(src_enum, 1, &src_fmt, NULL);
-        ok(hr == S_FALSE, "%d: got %08x\n", count, hr);
+        ok(hr == S_FALSE, "%ld: got %08lx\n", count, hr);
         IEnumFORMATETC_Release(src_enum);
     }
 
     hr = IEnumFORMATETC_Reset(enum_fmt);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     if(src) /* Exercise the enumerator a bit */
     {
@@ -686,24 +686,24 @@ static void test_enum_fmtetc(IDataObject *src)
         FORMATETC third_fmt;
 
         hr = IEnumFORMATETC_Next(enum_fmt, 1, &third_fmt, NULL);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         hr = IEnumFORMATETC_Next(enum_fmt, 1, &third_fmt, NULL);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         hr = IEnumFORMATETC_Next(enum_fmt, 1, &third_fmt, NULL);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
 
         hr = IEnumFORMATETC_Reset(enum_fmt);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         hr = IEnumFORMATETC_Skip(enum_fmt, 2);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
 
         hr = IEnumFORMATETC_Clone(enum_fmt, &clone);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         ok(fmt.cfFormat == third_fmt.cfFormat, "formats don't match\n");
         hr = IEnumFORMATETC_Next(clone, 1, &fmt, NULL);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
         ok(fmt.cfFormat == third_fmt.cfFormat, "formats don't match\n");
         IEnumFORMATETC_Release(clone);
     }
@@ -746,7 +746,7 @@ static void test_cf_dataobject(IDataObject *data)
             HWND clip_owner = GetClipboardOwner();
 
             found_dataobject = TRUE;
-            ok(size >= sizeof(*ptr), "size %d\n", size);
+            ok(size >= sizeof(*ptr), "size %ld\n", size);
             if(data)
                 ok(*ptr == clip_owner, "hwnd %p clip_owner %p\n", *ptr, clip_owner);
             else /* ole clipboard flushed */
@@ -788,7 +788,7 @@ static void test_cf_dataobject(IDataObject *data)
                     CLIPFORMAT cfs_seen[10];
 
                     hr = IDataObject_EnumFormatEtc(data, DATADIR_GET, &enum_fmt);
-                    ok(hr == S_OK, "got %08x\n", hr);
+                    ok(hr == S_OK, "got %08lx\n", hr);
                     fmt_ptr = priv->fmts;
 
                     while(IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL) == S_OK)
@@ -798,11 +798,11 @@ static void test_cf_dataobject(IDataObject *data)
 
                         ok(fmt_ptr->fmt.cfFormat == fmt.cfFormat,
                            "got %08x expected %08x\n", fmt_ptr->fmt.cfFormat, fmt.cfFormat);
-                        ok(fmt_ptr->fmt.dwAspect == fmt.dwAspect, "got %08x expected %08x\n",
+                        ok(fmt_ptr->fmt.dwAspect == fmt.dwAspect, "got %08lx expected %08lx\n",
                            fmt_ptr->fmt.dwAspect, fmt.dwAspect);
-                        ok(fmt_ptr->fmt.lindex == fmt.lindex, "got %08x expected %08x\n",
+                        ok(fmt_ptr->fmt.lindex == fmt.lindex, "got %08lx expected %08lx\n",
                            fmt_ptr->fmt.lindex, fmt.lindex);
-                        ok(fmt_ptr->fmt.tymed == fmt.tymed, "got %08x expected %08x\n",
+                        ok(fmt_ptr->fmt.tymed == fmt.tymed, "got %08lx expected %08lx\n",
                            fmt_ptr->fmt.tymed, fmt.tymed);
                         for(i = 0; i < count; i++)
                             if(fmt_ptr->fmt.cfFormat == cfs_seen[i])
@@ -813,8 +813,8 @@ static void test_cf_dataobject(IDataObject *data)
                         cfs_seen[count] = fmt.cfFormat;
                         ok(fmt_ptr->first_use_of_cf != seen_cf, "got %08x expected %08x\n",
                            fmt_ptr->first_use_of_cf, !seen_cf);
-                        ok(fmt_ptr->res[0] == 0, "got %08x\n", fmt_ptr->res[0]);
-                        ok(fmt_ptr->res[1] == 0, "got %08x\n", fmt_ptr->res[1]);
+                        ok(fmt_ptr->res[0] == 0, "got %08lx\n", fmt_ptr->res[0]);
+                        ok(fmt_ptr->res[1] == 0, "got %08lx\n", fmt_ptr->res[1]);
                         if(fmt.ptd)
                         {
                             DVTARGETDEVICE *target;
@@ -827,16 +827,16 @@ static void test_cf_dataobject(IDataObject *data)
                         fmt_ptr++;
                         count++;
                     }
-                    ok(priv->res1 == 0, "got %08x\n", priv->res1);
-                    ok(priv->res2 == 1, "got %08x\n", priv->res2);
-                    ok(priv->count == count, "got %08x expected %08x\n", priv->count, count);
-                    ok(priv->res3[0] == 0, "got %08x\n", priv->res3[0]);
+                    ok(priv->res1 == 0, "got %08lx\n", priv->res1);
+                    ok(priv->res2 == 1, "got %08lx\n", priv->res2);
+                    ok(priv->count == count, "got %08lx expected %08lx\n", priv->count, count);
+                    ok(priv->res3[0] == 0, "got %08lx\n", priv->res3[0]);
 
                     /* win64 sets the lsb */
                     if(sizeof(fmt_ptr->fmt.ptd) == 8)
-                        todo_wine ok(priv->res3[1] == 1, "got %08x\n", priv->res3[1]);
+                        todo_wine ok(priv->res3[1] == 1, "got %08lx\n", priv->res3[1]);
                     else
-                        ok(priv->res3[1] == 0, "got %08x\n", priv->res3[1]);
+                        ok(priv->res3[1] == 0, "got %08lx\n", priv->res3[1]);
 
                     GlobalUnlock(h);
                     IEnumFORMATETC_Release(enum_fmt);
@@ -851,11 +851,11 @@ static void test_cf_dataobject(IDataObject *data)
 
             DataObjectImpl_GetDataHere_calls = 0;
             h = GetClipboardData(cf);
-            ok(DataObjectImpl_GetDataHere_calls == 1, "got %d\n", DataObjectImpl_GetDataHere_calls);
+            ok(DataObjectImpl_GetDataHere_calls == 1, "got %ld\n", DataObjectImpl_GetDataHere_calls);
             ptr = GlobalLock(h);
             size = GlobalSize(h);
             ok(size == strlen(cmpl_stm_data),
-               "expected %d got %d\n", lstrlenA(cmpl_stm_data), size);
+               "expected %d got %ld\n", lstrlenA(cmpl_stm_data), size);
             ok(!memcmp(ptr, cmpl_stm_data, strlen(cmpl_stm_data)), "mismatch\n");
             GlobalUnlock(h);
         }
@@ -867,11 +867,11 @@ static void test_cf_dataobject(IDataObject *data)
 
             DataObjectImpl_GetDataHere_calls = 0;
             h = GetClipboardData(cf);
-            ok(DataObjectImpl_GetDataHere_calls == 0, "got %d\n", DataObjectImpl_GetDataHere_calls);
+            ok(DataObjectImpl_GetDataHere_calls == 0, "got %ld\n", DataObjectImpl_GetDataHere_calls);
             ptr = GlobalLock(h);
             size = GlobalSize(h);
             ok(size == strlen(cmpl_text_data) + 1,
-               "expected %d got %d\n", lstrlenA(cmpl_text_data) + 1, size);
+               "expected %d got %ld\n", lstrlenA(cmpl_text_data) + 1, size);
             ok(!memcmp(ptr, cmpl_text_data, strlen(cmpl_text_data) + 1), "mismatch\n");
             GlobalUnlock(h);
         }
@@ -889,32 +889,32 @@ static void test_complex_get_clipboard(void)
     STGMEDIUM stgmedium;
 
     hr = OleGetClipboard(&data_obj);
-    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleGetClipboard failed with error 0x%08lx\n", hr);
 
     DataObjectImpl_GetData_calls = 0;
 
     InitFormatEtc(fmtetc, CF_METAFILEPICT, TYMED_MFPICT);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_METAFILEPICT, TYMED_HGLOBAL);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_ENHMETAFILE, TYMED_HGLOBAL);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == DV_E_TYMED, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_ENHMETAFILE, TYMED_ENHMF);
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium);
 
     ok(DataObjectImpl_GetData_calls == 5,
-            "DataObjectImpl_GetData called 5 times instead of %d times\n",
+            "DataObjectImpl_GetData called 5 times instead of %ld times\n",
             DataObjectImpl_GetData_calls);
     IDataObject_Release(data_obj);
 }
@@ -934,51 +934,51 @@ static void test_set_clipboard(void)
     cf_onemore = RegisterClipboardFormatA("one more format");
 
     hr = DataObjectImpl_CreateText("data1", &data1);
-    ok(hr == S_OK, "Failed to create data1 object: 0x%08x\n", hr);
+    ok(hr == S_OK, "Failed to create data1 object: 0x%08lx\n", hr);
     if(FAILED(hr))
         return;
     hr = DataObjectImpl_CreateText("data2", &data2);
-    ok(hr == S_OK, "Failed to create data2 object: 0x%08x\n", hr);
+    ok(hr == S_OK, "Failed to create data2 object: 0x%08lx\n", hr);
     if(FAILED(hr))
         return;
     hr = DataObjectImpl_CreateComplex(&data_cmpl);
-    ok(hr == S_OK, "Failed to create complex data object: 0x%08x\n", hr);
+    ok(hr == S_OK, "Failed to create complex data object: 0x%08lx\n", hr);
     if(FAILED(hr))
         return;
 
     hr = OleSetClipboard(data1);
-    ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard should have failed with CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard should have failed with CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
 
     CoInitialize(NULL);
     hr = OleSetClipboard(data1);
-    ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard failed with 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard failed with 0x%08lx\n", hr);
     CoUninitialize();
 
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleInitialize failed with error 0x%08lx\n", hr);
 
     hr = OleSetClipboard(data1);
-    ok(hr == S_OK, "failed to set clipboard to data1, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to set clipboard to data1, hr = 0x%08lx\n", hr);
 
     test_cf_dataobject(data1);
 
     hr = OleIsCurrentClipboard(data1);
-    ok(hr == S_OK, "expected current clipboard to be data1, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "expected current clipboard to be data1, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(data2);
-    ok(hr == S_FALSE, "did not expect current clipboard to be data2, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "did not expect current clipboard to be data2, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(NULL);
-    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08lx\n", hr);
 
     test_get_clipboard();
 
     hr = OleSetClipboard(data2);
-    ok(hr == S_OK, "failed to set clipboard to data2, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to set clipboard to data2, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(data1);
-    ok(hr == S_FALSE, "did not expect current clipboard to be data1, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "did not expect current clipboard to be data1, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(data2);
-    ok(hr == S_OK, "expected current clipboard to be data2, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "expected current clipboard to be data2, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(NULL);
-    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08lx\n", hr);
 
     /* put a format directly onto the clipboard to show
        OleFlushClipboard doesn't empty the clipboard */
@@ -997,13 +997,13 @@ static void test_set_clipboard(void)
     ok( CloseClipboard(), "CloseClipboard failed\n" );
 
     hr = OleFlushClipboard();
-    ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(data1);
-    ok(hr == S_FALSE, "did not expect current clipboard to be data1, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "did not expect current clipboard to be data1, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(data2);
-    ok(hr == S_FALSE, "did not expect current clipboard to be data2, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "did not expect current clipboard to be data2, hr = 0x%08lx\n", hr);
     hr = OleIsCurrentClipboard(NULL);
-    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08lx\n", hr);
 
     /* format should survive the flush */
     ok( OpenClipboard(NULL), "OpenClipboard failed\n" );
@@ -1017,7 +1017,7 @@ static void test_set_clipboard(void)
     test_cf_dataobject(NULL);
 
     hr = OleSetClipboard(NULL);
-    ok(hr == S_OK, "Failed to clear clipboard, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "Failed to clear clipboard, hr = 0x%08lx\n", hr);
 
     OpenClipboard(NULL);
     h = GetClipboardData(cf_onemore);
@@ -1026,23 +1026,23 @@ static void test_set_clipboard(void)
 
     trace("setting complex\n");
     hr = OleSetClipboard(data_cmpl);
-    ok(hr == S_OK, "failed to set clipboard to complex data, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to set clipboard to complex data, hr = 0x%08lx\n", hr);
     test_complex_get_clipboard();
     test_cf_dataobject(data_cmpl);
     test_enum_fmtetc(data_cmpl);
 
     hr = OleSetClipboard(NULL);
-    ok(hr == S_OK, "failed to clear clipboard, hr = 0x%08x.\n", hr);
+    ok(hr == S_OK, "failed to clear clipboard, hr = 0x%08lx.\n", hr);
 
     test_no_cf_dataobject();
     test_enum_fmtetc(NULL);
 
     ref = IDataObject_Release(data1);
-    ok(ref == 0, "expected data1 ref=0, got %d\n", ref);
+    ok(ref == 0, "expected data1 ref=0, got %ld\n", ref);
     ref = IDataObject_Release(data2);
-    ok(ref == 0, "expected data2 ref=0, got %d\n", ref);
+    ok(ref == 0, "expected data2 ref=0, got %ld\n", ref);
     ref = IDataObject_Release(data_cmpl);
-    ok(ref == 0, "expected data_cmpl ref=0, got %d\n", ref);
+    ok(ref == 0, "expected data_cmpl ref=0, got %ld\n", ref);
 
     OleUninitialize();
 }
@@ -1065,7 +1065,7 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
             /* this demonstrates an issue in Qt where it will free the data while it's being set */
             HRESULT hr = OleIsCurrentClipboard( clip_data );
             ok( hr == (wm_drawclipboard > 1) ? S_OK : S_FALSE,
-                "OleIsCurrentClipboard returned %x\n", hr );
+                "OleIsCurrentClipboard returned %lx\n", hr );
         }
         break;
     case WM_CHANGECBCHAIN:
@@ -1101,7 +1101,7 @@ static void test_set_clipboard_DRAWCLIPBOARD(void)
     HANDLE thread;
 
     hr = DataObjectImpl_CreateText("data", &data);
-    ok(hr == S_OK, "Failed to create data object: 0x%08x\n", hr);
+    ok(hr == S_OK, "Failed to create data object: 0x%08lx\n", hr);
 
     memset(&cls, 0, sizeof(cls));
     cls.lpfnWndProc = clipboard_wnd_proc;
@@ -1110,33 +1110,33 @@ static void test_set_clipboard_DRAWCLIPBOARD(void)
     RegisterClassA(&cls);
 
     viewer = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
-    ok(viewer != NULL, "CreateWindow failed: %d\n", GetLastError());
+    ok(viewer != NULL, "CreateWindow failed: %ld\n", GetLastError());
     next_wnd = SetClipboardViewer( viewer );
 
     ret = SendMessageA( viewer, WM_USER, 0, 0 );
     ok( ret == 1, "%u WM_DRAWCLIPBOARD received\n", ret );
 
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleInitialize failed with error 0x%08lx\n", hr);
 
     ret = SendMessageA( viewer, WM_USER, 0, 0 );
     ok( !ret, "%u WM_DRAWCLIPBOARD received\n", ret );
 
     thread = CreateThread(NULL, 0, set_clipboard_thread, NULL, 0, NULL);
-    ok(thread != NULL, "CreateThread failed (%d)\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed (%ld)\n", GetLastError());
     ret = WaitForSingleObject(thread, 5000);
     ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", ret);
 
     clip_data = data;
     hr = OleSetClipboard(data);
-    ok(hr == S_OK, "failed to set clipboard to data, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to set clipboard to data, hr = 0x%08lx\n", hr);
 
     ret = SendMessageA( viewer, WM_USER, 0, 0 );
     ok( ret == 2, "%u WM_DRAWCLIPBOARD received\n", ret );
 
     clip_data = NULL;
     hr = OleFlushClipboard();
-    ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08x\n", hr);
+    ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08lx\n", hr);
     ret = IDataObject_Release(data);
     ok(ret == 0, "got %d\n", ret);
 
@@ -1167,41 +1167,41 @@ static void test_consumer_refs(void)
        a different data object */
 
     hr = DataObjectImpl_CreateText("data1", &src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     hr = DataObjectImpl_CreateText("data2", &src2);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get1);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get2);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     ok(get1 == get2, "data objects differ\n");
     refs = IDataObject_Release(get2);
-    ok(refs == (get1 == get2 ? 1 : 0), "got %d\n", refs);
+    ok(refs == (get1 == get2 ? 1 : 0), "got %ld\n", refs);
 
     OleFlushClipboard();
 
     DataObjectImpl_GetData_calls = 0;
     hr = IDataObject_GetData(get1, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(DataObjectImpl_GetData_calls == 0, "GetData called\n");
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     hr = OleGetClipboard(&get2);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     ok(get1 != get2, "data objects match\n");
 
     hr = OleSetClipboard(NULL);
-    ok(hr == S_OK, "Failed to clear clipboard, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear clipboard, hr %#lx.\n", hr);
 
     hr = OleGetClipboard(&get3);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     ok(get1 != get3, "data objects match\n");
     ok(get2 != get3, "data objects match\n");
@@ -1214,75 +1214,75 @@ static void test_consumer_refs(void)
        takes a ref on our src data obj. */
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     old_refs = count_refs(src);
 
     hr = OleGetClipboard(&get1);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     refs = count_refs(src);
-    ok(refs == old_refs, "%d %d\n", refs, old_refs);
+    ok(refs == old_refs, "%ld %ld\n", refs, old_refs);
 
     DataObjectImpl_GetData_calls = 0;
     hr = IDataObject_GetData(get1, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n");
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
     refs = count_refs(src);
-    ok(refs == old_refs + 1, "%d %d\n", refs, old_refs);
+    ok(refs == old_refs + 1, "%ld %ld\n", refs, old_refs);
 
     OleFlushClipboard();
 
     DataObjectImpl_GetData_calls = 0;
     hr = IDataObject_GetData(get1, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n");
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     refs = count_refs(src);
-    ok(refs == 2, "%d\n", refs);
+    ok(refs == 2, "%ld\n", refs);
 
     IDataObject_Release(get1);
 
     refs = count_refs(src);
-    ok(refs == 1, "%d\n", refs);
+    ok(refs == 1, "%ld\n", refs);
 
     /* Now set a second src object before the call to GetData
        and show that GetData calls that second src. */
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     old_refs = count_refs(src);
 
     hr = OleGetClipboard(&get1);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     refs = count_refs(src);
-    ok(refs == old_refs, "%d %d\n", refs, old_refs);
+    ok(refs == old_refs, "%ld %ld\n", refs, old_refs);
 
     hr = OleSetClipboard(src2);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     old_refs = count_refs(src2);
 
     DataObjectImpl_GetData_calls = 0;
     hr = IDataObject_GetData(get1, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n");
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     refs = count_refs(src);
-    ok(refs == 1, "%d\n", refs);
+    ok(refs == 1, "%ld\n", refs);
     refs = count_refs(src2);
-    ok(refs == old_refs + 1, "%d %d\n", refs, old_refs);
+    ok(refs == old_refs + 1, "%ld %ld\n", refs, old_refs);
 
     hr = OleSetClipboard(NULL);
-    ok(hr == S_OK, "Failed to clear clipboard, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear clipboard, hr %#lx.\n", hr);
 
     refs = count_refs(src2);
-    ok(refs == 2, "%d\n", refs);
+    ok(refs == 2, "%ld\n", refs);
 
     IDataObject_Release(get1);
 
@@ -1291,25 +1291,25 @@ static void test_consumer_refs(void)
     /* Show that OleUninitialize() doesn't release the
        dataobject's ref, and thus the object is leaked. */
     old_refs = count_refs(src);
-    ok(old_refs == 1, "%d\n", old_refs);
+    ok(old_refs == 1, "%ld\n", old_refs);
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "Failed to clear clipboard, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear clipboard, hr %#lx.\n", hr);
     refs = count_refs(src);
-    ok(refs > old_refs, "%d %d\n", refs, old_refs);
+    ok(refs > old_refs, "%ld %ld\n", refs, old_refs);
 
     OleUninitialize();
     refs = count_refs(src);
-    ok(refs == 2, "%d\n", refs);
+    ok(refs == 2, "%ld\n", refs);
 
     OleInitialize(NULL);
     hr = OleSetClipboard(NULL);
-    ok(hr == S_OK, "Failed to clear clipboard, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear clipboard, hr %#lx.\n", hr);
 
     OleUninitialize();
 
     refs = count_refs(src);
-    ok(refs == 2, "%d\n", refs);
+    ok(refs == 2, "%ld\n", refs);
 
     IDataObject_Release(src);
 }
@@ -1322,12 +1322,12 @@ static HGLOBAL create_storage(void)
     HRESULT hr;
 
     hr = CreateILockBytesOnHGlobal(NULL, FALSE, &ilb);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     IStorage_Release(stg);
     hr = GetHGlobalFromILockBytes(ilb, &hg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ILockBytes_Release(ilb);
     return hg;
 }
@@ -1344,109 +1344,109 @@ static void test_flushed_getdata(void)
     OleInitialize(NULL);
 
     hr = DataObjectImpl_CreateComplex(&src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleFlushClipboard();
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     /* global format -> global & stream */
 
     InitFormatEtc(fmt, CF_TEXT, TYMED_HGLOBAL);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, CF_TEXT, TYMED_ISTREAM);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == E_FAIL, "got %08x\n", hr);
+    ok(hr == E_FAIL, "got %08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, CF_TEXT, 0xffff);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     /* stream format -> global & stream */
 
     InitFormatEtc(fmt, cf_stream, TYMED_ISTREAM);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_stream, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == E_FAIL, "got %08x\n", hr);
+    ok(hr == E_FAIL, "got %08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_stream, TYMED_HGLOBAL);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_stream, 0xffff);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     /* storage format -> global, stream & storage */
 
     InitFormatEtc(fmt, cf_storage, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) {
         hr = IStorage_Stat(med.u.pstg, &stat, STATFLAG_NONAME);
-        ok(hr == S_OK, "got %08x\n", hr);
-        ok(stat.grfMode == (STGM_SHARE_EXCLUSIVE | STGM_READWRITE), "got %08x\n", stat.grfMode);
+        ok(hr == S_OK, "got %08lx\n", hr);
+        ok(stat.grfMode == (STGM_SHARE_EXCLUSIVE | STGM_READWRITE), "got %08lx\n", stat.grfMode);
         ReleaseStgMedium(&med);
     }
 
     InitFormatEtc(fmt, cf_storage, TYMED_ISTREAM);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_storage, TYMED_HGLOBAL);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_storage, TYMED_HGLOBAL | TYMED_ISTREAM);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_storage, 0xffff);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     /* complex format with target device */
 
     InitFormatEtc(fmt, cf_another, 0xffff);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     if (0)  /* Causes crashes on both Wine and Windows */
@@ -1466,8 +1466,8 @@ static void test_flushed_getdata(void)
         memcpy(fmt.ptd->tdData + sizeof(device_name), &dm, dm.dmSize + dm.dmDriverExtra);
 
         hr = IDataObject_GetData(get, &fmt, &med);
-        ok(hr == S_OK, "got %08x\n", hr);
-        ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+        ok(hr == S_OK, "got %08lx\n", hr);
+        ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
         if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
         HeapFree(GetProcessHeap(), 0, fmt.ptd);
@@ -1476,43 +1476,43 @@ static void test_flushed_getdata(void)
     /* CF_ENHMETAFILE format */
     InitFormatEtc(fmt, CF_ENHMETAFILE, TYMED_ENHMF);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     IDataObject_Release(get);
     IDataObject_Release(src);
 
     hr = DataObjectImpl_CreateFromHGlobal(create_storage(), &src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
     IDataObject_Release(get);
 
     hr = OleFlushClipboard();
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, CF_TEXT, 0xffff);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     IDataObject_Release(get);
@@ -1570,22 +1570,22 @@ static void test_nonole_clipboard(void)
     HDROP hdrop;
 
     r = OpenClipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     OleInitialize(NULL);
 
     /* empty clipboard */
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     hr = IDataObject_EnumFormatEtc(get, DATADIR_GET, &enum_fmt);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_FALSE, "got %08x\n", hr);
+    ok(hr == S_FALSE, "got %08lx\n", hr);
     IEnumFORMATETC_Release(enum_fmt);
 
     IDataObject_Release(get);
@@ -1599,7 +1599,7 @@ static void test_nonole_clipboard(void)
     hdrop = create_dropped_file();
 
     r = OpenClipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     h = SetClipboardData(CF_TEXT, htext);
     ok(h == htext, "got %p\n", h);
     h = SetClipboardData(cf_onemore, hblob);
@@ -1611,12 +1611,12 @@ static void test_nonole_clipboard(void)
     h = SetClipboardData(CF_HDROP, hdrop);
     ok(h == hdrop, "got %p\n", h);
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     hr = IDataObject_EnumFormatEtc(get, DATADIR_GET, &enum_fmt);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     if (FAILED(hr))
     {
         skip("EnumFormatEtc failed, skipping tests.\n");
@@ -1624,104 +1624,104 @@ static void test_nonole_clipboard(void)
     }
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == CF_TEXT, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == cf_onemore, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == CF_ENHMETAFILE, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == TYMED_ENHMF, "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == TYMED_ENHMF, "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == cf_storage, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == CF_HDROP, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr); /* User32 adds some synthesised formats */
+    ok(hr == S_OK, "got %08lx\n", hr); /* User32 adds some synthesised formats */
 
     ok(fmt.cfFormat == CF_LOCALE, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    todo_wine ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    todo_wine ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     ok(fmt.cfFormat == CF_OEMTEXT, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == CF_UNICODETEXT, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == (TYMED_ISTREAM | TYMED_HGLOBAL), "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ok(fmt.cfFormat == CF_METAFILEPICT, "cf %04x\n", fmt.cfFormat);
     ok(fmt.ptd == NULL, "ptd %p\n", fmt.ptd);
-    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %x\n", fmt.dwAspect);
-    ok(fmt.lindex == -1, "lindex %d\n", fmt.lindex);
-    ok(fmt.tymed == TYMED_MFPICT, "tymed %x\n", fmt.tymed);
+    ok(fmt.dwAspect == DVASPECT_CONTENT, "aspect %lx\n", fmt.dwAspect);
+    ok(fmt.lindex == -1, "lindex %ld\n", fmt.lindex);
+    ok(fmt.tymed == TYMED_MFPICT, "tymed %lx\n", fmt.tymed);
 
     hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
-    ok(hr == S_FALSE, "got %08x\n", hr);
+    ok(hr == S_FALSE, "got %08lx\n", hr);
     IEnumFORMATETC_Release(enum_fmt);
 
     InitFormatEtc(fmt, CF_ENHMETAFILE, TYMED_ENHMF);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     obj_type = GetObjectType(U(med).hEnhMetaFile);
-    ok(obj_type == OBJ_ENHMETAFILE, "got %d\n", obj_type);
+    ok(obj_type == OBJ_ENHMETAFILE, "got %ld\n", obj_type);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     InitFormatEtc(fmt, cf_storage, TYMED_ISTORAGE);
     hr = IDataObject_GetData(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
 
     IDataObject_Release(get);
 
     r = OpenClipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     OleUninitialize();
 }
@@ -1736,13 +1736,13 @@ static void test_getdatahere(void)
     OleInitialize(NULL);
 
     hr = DataObjectImpl_CreateComplex(&src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleSetClipboard(src);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = OleGetClipboard(&get);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     /* global format -> global & stream */
 
@@ -1755,11 +1755,11 @@ static void test_getdatahere(void)
     med.tymed = TYMED_HGLOBAL;
     U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 1, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 1, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 1, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 1, "called %ld\n", DataObjectImpl_GetData_calls);
 
     InitFormatEtc(fmt, CF_TEXT, 0);
 
@@ -1767,41 +1767,41 @@ static void test_getdatahere(void)
     med.tymed = TYMED_HGLOBAL;
     U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 2, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 1, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 2, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 1, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_HGLOBAL;
     U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 1);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == E_FAIL, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == E_FAIL, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 3, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 1, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 3, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 1, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTREAM;
     CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 4, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 1, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 4, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 1, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTORAGE;
     StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == E_FAIL, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == E_FAIL, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 5, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 1, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 5, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 1, "called %ld\n", DataObjectImpl_GetData_calls);
 
     InitFormatEtc(fmt, cf_stream, 0);
 
@@ -1809,31 +1809,31 @@ static void test_getdatahere(void)
     med.tymed = TYMED_HGLOBAL;
     U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 7, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 2, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 7, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 2, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTREAM;
     CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 8, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 2, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 8, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 2, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTORAGE;
     StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == E_FAIL, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == E_FAIL, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 9, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 2, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 9, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 2, "called %ld\n", DataObjectImpl_GetData_calls);
 
     InitFormatEtc(fmt, cf_storage, 0);
 
@@ -1841,31 +1841,31 @@ static void test_getdatahere(void)
     med.tymed = TYMED_HGLOBAL;
     U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 3000);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 11, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 3, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 11, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 3, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTREAM;
     CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 12, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 3, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 12, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 3, "called %ld\n", DataObjectImpl_GetData_calls);
 
     med.pUnkForRelease = NULL;
     med.tymed = TYMED_ISTORAGE;
     StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
     hr = IDataObject_GetDataHere(get, &fmt, &med);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
     ReleaseStgMedium(&med);
-    ok(DataObjectImpl_GetDataHere_calls == 13, "called %d\n", DataObjectImpl_GetDataHere_calls);
-    ok(DataObjectImpl_GetData_calls == 3, "called %d\n", DataObjectImpl_GetData_calls);
+    ok(DataObjectImpl_GetDataHere_calls == 13, "called %ld\n", DataObjectImpl_GetDataHere_calls);
+    ok(DataObjectImpl_GetData_calls == 3, "called %ld\n", DataObjectImpl_GetData_calls);
 
 
     IDataObject_Release(get);
@@ -1893,15 +1893,15 @@ static void test_multithreaded_clipboard(void)
     OleInitialize(NULL);
 
     hr = OleGetClipboard(&data_obj);
-    ok(hr == S_OK, "OleGetClipboard returned %x\n", hr);
+    ok(hr == S_OK, "OleGetClipboard returned %lx\n", hr);
 
     thread = CreateThread(NULL, 0, test_data_obj, data_obj, 0, NULL);
-    ok(thread != NULL, "CreateThread failed (%d)\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed (%ld)\n", GetLastError());
     ret = WaitForSingleObject(thread, 5000);
-    ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lx\n", ret);
 
     hr = OleGetClipboard(&data_obj);
-    ok(hr == S_OK, "OleGetClipboard returned %x\n", hr);
+    ok(hr == S_OK, "OleGetClipboard returned %lx\n", hr);
     IDataObject_Release(data_obj);
 
     OleUninitialize();
@@ -1918,7 +1918,7 @@ static void test_get_clipboard_locked(void)
     /* lock clipboard */
     OpenClipboard(NULL);
     hr = OleGetClipboard(&pDObj);
-    todo_wine ok(hr == CLIPBRD_E_CANT_OPEN, "OleGetClipboard() got 0x%08x instead of 0x%08x\n", hr, CLIPBRD_E_CANT_OPEN);
+    todo_wine ok(hr == CLIPBRD_E_CANT_OPEN, "OleGetClipboard() got 0x%08lx instead of 0x%08lx\n", hr, CLIPBRD_E_CANT_OPEN);
     todo_wine ok(pDObj == NULL, "OleGetClipboard() got 0x%p instead of NULL\n",pDObj);
     if (pDObj) IDataObject_Release(pDObj);
     CloseClipboard();
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 1dcc3bff811..8467e86a66f 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -84,9 +84,9 @@ static HRESULT (WINAPI * pCoCreateInstanceFromApp)(REFCLSID clsid, IUnknown *out
 
 static BOOL   (WINAPI *pIsWow64Process)(HANDLE, LPBOOL);
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
-#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
-#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
+#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %ld\n", cLocks)
+#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %ld\n", cLocks)
 
 static const CLSID CLSID_non_existent =   { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
 static const CLSID CLSID_StdFont = { 0x0be35203, 0x8f91, 0x11ce, { 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51 } };
@@ -205,7 +205,7 @@ static BOOL create_manifest_file(const char *filename, const char *manifest)
     manifest_len = strlen(manifest);
     file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                        FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
     if(file == INVALID_HANDLE_VALUE)
         return FALSE;
     WriteFile(file, manifest, manifest_len, &size, NULL);
@@ -222,7 +222,7 @@ static void extract_resource(const char *name, const char *type, const char *pat
     void *ptr;
 
     file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create a file at %s, error %d.\n", path, GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create a file at %s, error %ld.\n", path, GetLastError());
 
     res = FindResourceA(NULL, name, type);
     ok(res != 0, "Failed to find resource.\n");
@@ -250,15 +250,15 @@ static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
 
     handle = CreateActCtxW(&actctx);
     ok(handle != INVALID_HANDLE_VALUE || broken(handle == INVALID_HANDLE_VALUE) /* some old XP/2k3 versions */,
-        "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
+        "handle == INVALID_HANDLE_VALUE, error %lu\n", GetLastError());
     if (handle == INVALID_HANDLE_VALUE)
     {
-        win_skip("activation context generation failed, some tests will be skipped. Error %d\n", GetLastError());
+        win_skip("activation context generation failed, some tests will be skipped. Error %ld\n", GetLastError());
         handle = NULL;
     }
 
-    ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%d\n", actctx.cbSize);
-    ok(actctx.dwFlags == 0, "actctx.dwFlags=%d\n", actctx.dwFlags);
+    ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%ld\n", actctx.cbSize);
+    ok(actctx.dwFlags == 0, "actctx.dwFlags=%ld\n", actctx.dwFlags);
     ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
     ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
     ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
@@ -272,7 +272,7 @@ static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie)
     if (handle)
     {
         ret = ActivateActCtx(handle, cookie);
-        ok(ret, "ActivateActCtx failed: %u\n", GetLastError());
+        ok(ret, "ActivateActCtx failed: %lu\n", GetLastError());
     }
 
     return handle;
@@ -283,7 +283,7 @@ static void deactivate_context(HANDLE handle, ULONG_PTR cookie)
     BOOL ret;
 
     ret = DeactivateActCtx(0, cookie);
-    ok(ret, "Failed to deactivate context, error %d.\n", GetLastError());
+    ok(ret, "Failed to deactivate context, error %ld.\n", GetLastError());
     ReleaseActCtx(handle);
 }
 
@@ -384,7 +384,7 @@ static void test_ProgIDFromCLSID(void)
     HRESULT hr;
 
     hr = ProgIDFromCLSID(&CLSID_StdFont, &progid);
-    ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08lx\n", hr);
     if (hr == S_OK)
     {
         ok(!lstrcmpiW(progid, stdfont), "Didn't get expected prog ID\n");
@@ -393,36 +393,36 @@ static void test_ProgIDFromCLSID(void)
 
     progid = (LPWSTR)0xdeadbeef;
     hr = ProgIDFromCLSID(&CLSID_non_existent, &progid);
-    ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08lx\n", hr);
     ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid);
 
     hr = ProgIDFromCLSID(&CLSID_StdFont, NULL);
-    ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08lx\n", hr);
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
         static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0};
 
         hr = ProgIDFromCLSID(&CLSID_non_existent, &progid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid));
         CoTaskMemFree(progid);
 
         /* try something registered and redirected */
         progid = NULL;
         hr = ProgIDFromCLSID(&CLSID_StdFont, &progid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid));
         CoTaskMemFree(progid);
 
         /* classes without default progid, progid list is not used */
         progid = (void *)0xdeadbeef;
         hr = ProgIDFromCLSID(&IID_Testiface5, &progid);
-        ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08x, progid %p\n", hr, progid);
+        ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
 
         progid = (void *)0xdeadbeef;
         hr = ProgIDFromCLSID(&IID_Testiface6, &progid);
-        ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08x, progid %p\n", hr, progid);
+        ok(hr == REGDB_E_CLASSNOTREG && progid == NULL, "got 0x%08lx, progid %p\n", hr, progid);
 
         deactivate_context(handle, cookie);
     }
@@ -434,7 +434,7 @@ static void test_CLSIDFromProgID(void)
     HANDLE handle;
     CLSID clsid;
     HRESULT hr = CLSIDFromProgID(stdfont, &clsid);
-    ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
 
     hr = CLSIDFromString(stdfont, &clsid);
@@ -444,20 +444,20 @@ static void test_CLSIDFromProgID(void)
     /* test some failure cases */
 
     hr = CLSIDFromProgID(wszNonExistent, NULL);
-    ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CLSIDFromProgID(NULL, &clsid);
-    ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CLSIDFromProgID should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     memset(&clsid, 0xcc, sizeof(clsid));
     hr = CLSIDFromProgID(wszNonExistent, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n");
 
     /* fails without proper context */
     memset(&clsid, 0xcc, sizeof(clsid));
     hr = CLSIDFromProgID(progidW, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n");
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
@@ -466,16 +466,16 @@ static void test_CLSIDFromProgID(void)
 
         memset(&clsid, 0xcc, sizeof(clsid));
         hr = CLSIDFromProgID(wszNonExistent, &clsid);
-        ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
+        ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
         ok(IsEqualCLSID(&clsid, &CLSID_NULL), "should have zero CLSID on failure\n");
 
         /* CLSIDFromString() doesn't check activation context */
         hr = CLSIDFromString(progidW, &clsid);
-        ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
+        ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
 
         clsid = CLSID_NULL;
         hr = CLSIDFromProgID(progidW, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         /* it returns generated CLSID here */
         ok(!IsEqualCLSID(&clsid, &CLSID_non_existent) && !IsEqualCLSID(&clsid, &CLSID_NULL),
                  "got wrong clsid %s\n", wine_dbgstr_guid(&clsid));
@@ -483,7 +483,7 @@ static void test_CLSIDFromProgID(void)
         /* duplicate progid present in context - returns generated guid here too */
         clsid = CLSID_NULL;
         hr = CLSIDFromProgID(stdfont, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         clsid1 = CLSID_StdFont;
         /* that's where it differs from StdFont */
         clsid1.Data4[7] = 0x52;
@@ -506,13 +506,13 @@ static void test_CLSIDFromString(void)
 
     memset(&clsid, 0xab, sizeof(clsid));
     hr = CLSIDFromString(NULL, &clsid);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
 
     /* string is longer, but starts with a valid CLSID */
     memset(&clsid, 0, sizeof(clsid));
     hr = CLSIDFromString(cf_brokenW, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &IID_IClassFactory), "got %s\n", wine_dbgstr_guid(&clsid));
 
     lstrcpyW(wszCLSID_Broken, wszCLSID_StdFont);
@@ -522,50 +522,50 @@ static void test_CLSIDFromString(void)
 
     memset(&clsid, 0, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
 
     wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = 'A';
     memset(&clsid, 0, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
 
     wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)] = '\0';
     memset(&clsid, 0, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
 
     wszCLSID_Broken[lstrlenW(wszCLSID_StdFont)-1] = '\0';
     memset(&clsid, 0, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n");
 
     memset(&clsid, 0xcc, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken+1, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid wasn't equal to CLSID_NULL\n");
 
     wszCLSID_Broken[9] = '*';
     memset(&clsid, 0xcc, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(clsid.Data1 == CLSID_StdFont.Data1, "Got %s\n", debugstr_guid(&clsid));
     ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
 
     wszCLSID_Broken[3] = '*';
     memset(&clsid, 0xcc, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
     ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
 
     wszCLSID_Broken[3] = '\0';
     memset(&clsid, 0xcc, sizeof(CLSID));
     hr = CLSIDFromString(wszCLSID_Broken, &clsid);
-    ok(hr == CO_E_CLASSSTRING, "Got %08x\n", hr);
+    ok(hr == CO_E_CLASSSTRING, "Got %08lx\n", hr);
     ok(clsid.Data1 == 0xb, "Got %s\n", debugstr_guid(&clsid));
     ok(clsid.Data2 == 0xcccc, "Got %04x\n", clsid.Data2);
 }
@@ -584,51 +584,51 @@ static void test_IIDFromString(void)
     IID iid;
 
     hr = IIDFromString(wszCLSID_StdFont, &iid);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(IsEqualIID(&iid, &CLSID_StdFont), "got iid %s\n", wine_dbgstr_guid(&iid));
 
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(NULL, &iid);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(IsEqualIID(&iid, &CLSID_NULL), "got iid %s\n", wine_dbgstr_guid(&iid));
 
     hr = IIDFromString(cfW, &iid);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(IsEqualIID(&iid, &IID_IClassFactory), "got iid %s\n", wine_dbgstr_guid(&iid));
 
     /* string starts with a valid IID but is longer */
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(cf_brokenW, &iid);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
 
     /* invalid IID in a valid format */
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(brokenW, &iid);
-    ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
+    ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
 
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(broken2W, &iid);
-    ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
+    ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0x00000001, "Got %s\n", debugstr_guid(&iid));
 
     /* format is broken, but string length is okay */
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(broken3W, &iid);
-    ok(hr == CO_E_IIDSTRING, "got 0x%08x\n", hr);
+    ok(hr == CO_E_IIDSTRING, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
 
     /* invalid string */
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(wszNonExistent, &iid);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
 
     /* valid ProgID */
     memset(&iid, 0xab, sizeof(iid));
     hr = IIDFromString(stdfont, &iid);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(iid.Data1 == 0xabababab, "Got %s\n", debugstr_guid(&iid));
 }
 
@@ -641,7 +641,7 @@ static void test_StringFromGUID2(void)
   SetLastError(0xdeadbeef);
   len = StringFromGUID2(NULL,str,50);
   ok(len == 0, "len: %d (expected 0)\n", len);
-  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %x\n", GetLastError());
+  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %lx\n", GetLastError());
 
   /* Test corner cases for buffer size */
   len = StringFromGUID2(&CLSID_StdFont,str,50);
@@ -672,7 +672,7 @@ static void _test_apt_type(APTTYPE expected_type, APTTYPEQUALIFIER expected_qual
 
     hr = pCoGetApartmentType(&type, &qualifier);
     ok_(__FILE__, line)(hr == S_OK || (type == APTTYPE_CURRENT && hr == CO_E_NOTINITIALIZED),
-            "Unexpected hr %#x.\n", hr);
+            "Unexpected hr %#lx.\n", hr);
     ok_(__FILE__, line)(type == expected_type, "Wrong apartment type %d, expected %d\n", type, expected_type);
     ok_(__FILE__, line)(qualifier == expected_qualifier, "Wrong apartment qualifier %d, expected %d\n", qualifier,
         expected_qualifier);
@@ -686,20 +686,20 @@ static void test_CoCreateInstance(void)
 
     pUnk = (IUnknown *)0xdeadbeef;
     hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
     ok(pUnk == NULL, "CoCreateInstance should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
 
     OleInitialize(NULL);
 
     /* test errors returned for non-registered clsids */
     hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
     hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered inproc handler should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
     hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered local server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
     hr = CoCreateInstance(&CLSID_non_existent, NULL, CLSCTX_REMOTE_SERVER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance for non-registered remote server should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
     if(hr == REGDB_E_CLASSNOTREG)
@@ -714,7 +714,7 @@ static void test_CoCreateInstance(void)
     OleUninitialize();
 
     hr = CoCreateInstance(rclsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
 
     test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
 }
@@ -752,13 +752,13 @@ static void test_CoGetClassObject(void)
     LONG res;
 
     hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoGetClassObject should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
     ok(pUnk == NULL, "CoGetClassObject should have changed the passed in pointer to NULL, instead of %p\n", pUnk);
 
     hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, NULL);
     ok(hr == E_INVALIDARG ||
        broken(hr == CO_E_NOTINITIALIZED), /* win9x */
-       "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+       "CoGetClassObject should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
 
@@ -777,37 +777,37 @@ static void test_CoGetClassObject(void)
 
         res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
                              KEY_ALL_ACCESS, NULL, &hkey, NULL);
-        ok(!res, "RegCreateKeyEx returned %d\n", res);
+        ok(!res, "RegCreateKeyEx returned %ld\n", res);
 
         res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
-        ok(!res, "RegOverridePredefKey returned %d\n", res);
+        ok(!res, "RegOverridePredefKey returned %ld\n", res);
 
         hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08x\n", hr);
+        ok(hr == S_OK, "CoGetClassObject should have returned S_OK instead of 0x%08lx\n", hr);
 
         res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
-        ok(!res, "RegOverridePredefKey returned %d\n", res);
+        ok(!res, "RegOverridePredefKey returned %ld\n", res);
 
         if (hr == S_OK) IUnknown_Release(pUnk);
         RegCloseKey(hkey);
     }
 
     hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     IUnknown_Release(pUnk);
 
     /* context redefines FreeMarshaler CLSID */
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
         hr = CoGetClassObject(&CLSID_InProcFreeMarshaler, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         IUnknown_Release(pUnk);
 
         hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#x.\n", hr);
+        ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
 
         hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
         deactivate_context(handle, cookie);
     }
@@ -820,10 +820,10 @@ static void test_CoGetClassObject(void)
 
         /* This one will load test dll and get back specific error code. */
         hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#x.\n", hr);
+        ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
 
         hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
-        ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+        ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
 
         memset(&data, 0, sizeof(data));
         data.cbSize = sizeof(data);
@@ -876,7 +876,7 @@ static void test_CoCreateInstanceEx(void)
 
     create_instance_iid = IID_NULL;
     hr = CoCreateInstanceEx(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &qi_res);
-    ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08x\n", hr);
+    ok(hr == E_NOINTERFACE, "CoCreateInstanceEx failed: %08lx\n", hr);
     ok(IsEqualGUID(&create_instance_iid, qi_res.pIID), "Unexpected CreateInstance iid %s\n",
        wine_dbgstr_guid(&create_instance_iid));
 
@@ -994,14 +994,14 @@ static void test_CoRegisterMessageFilter(void)
 
     hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
     ok(hr == CO_E_NOT_SUPPORTED,
-        "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
+        "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
         hr);
 
     CoInitializeEx(NULL, COINIT_MULTITHREADED);
     prev_filter = (IMessageFilter *)0xdeadbeef;
     hr = CoRegisterMessageFilter(&MessageFilter, &prev_filter);
     ok(hr == CO_E_NOT_SUPPORTED,
-        "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08x\n",
+        "CoRegisterMessageFilter should have failed with CO_E_NOT_SUPPORTED instead of 0x%08lx\n",
         hr);
     ok(prev_filter == (IMessageFilter *)0xdeadbeef,
         "prev_filter should have been set to %p\n", prev_filter);
@@ -1223,7 +1223,7 @@ static void test_CoRegisterPSClsid(void)
     DWORD tid;
 
     hr = CoRegisterPSClsid(&IID_IWineTest, &CLSID_WineTestPSFactoryBuffer);
-    ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoRegisterPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
 
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
@@ -1240,7 +1240,7 @@ static void test_CoRegisterPSClsid(void)
                    wine_dbgstr_guid(&CLSID_WineTestPSFactoryBuffer), wine_dbgstr_guid(&clsid));
 
     thread = CreateThread(NULL, 0, register_ps_clsid_thread, NULL, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
     CloseHandle(thread);
 
@@ -1254,7 +1254,7 @@ static void test_CoRegisterPSClsid(void)
 
     SET_EXPECT(CreateStub);
     hr = CoMarshalInterface(stream, &IID_IWineTest, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "CoMarshalInterface should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
     CHECK_CALLED(CreateStub, 1);
 
     hr = CoGetPSClsid(&IID_IEnumOLEVERB, &clsid);
@@ -1268,11 +1268,11 @@ static void test_CoRegisterPSClsid(void)
 
     SET_EXPECT(CreateStub);
     hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, (IUnknown*)&EnumOLEVERB, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
+    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
     CHECK_CALLED(CreateStub, 1);
 
     hr = CoMarshalInterface(stream, &IID_IEnumOLEVERB, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
+    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
 
     IStream_Release(stream);
     IPSFactoryBuffer_Release(ps_factory_buffer);
@@ -1286,10 +1286,10 @@ static void test_CoRegisterPSClsid(void)
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     hr = CoGetPSClsid(&IID_IWineTest, &clsid);
-    ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
 
     hr = CoGetPSClsid(&IID_TestPS, &clsid);
-    ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_IIDNOTREG, "CoGetPSClsid should have returned REGDB_E_IIDNOTREG instead of 0x%08lx\n", hr);
 
     CoUninitialize();
 
@@ -1304,7 +1304,7 @@ static void test_CoRegisterPSClsid(void)
                    wine_dbgstr_guid(&CLSID_WineTestPSFactoryBuffer), wine_dbgstr_guid(&clsid));
 
     thread = CreateThread(NULL, 0, register_ps_clsid_thread, NULL, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok(!WaitForSingleObject(thread, 10000), "wait timed out\n");
     CloseHandle(thread);
 
@@ -1329,7 +1329,7 @@ static void test_CoGetPSClsid(void)
 
     hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
     ok(hr == CO_E_NOTINITIALIZED,
-       "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n",
+       "CoGetPSClsid should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n",
        hr);
 
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -1339,12 +1339,12 @@ static void test_CoGetPSClsid(void)
 
     hr = CoGetPSClsid(&IID_IWineTest, &clsid);
     ok(hr == REGDB_E_IIDNOTREG,
-       "CoGetPSClsid for random IID returned 0x%08x instead of REGDB_E_IIDNOTREG\n",
+       "CoGetPSClsid for random IID returned 0x%08lx instead of REGDB_E_IIDNOTREG\n",
        hr);
 
     hr = CoGetPSClsid(&IID_IClassFactory, NULL);
     ok(hr == E_INVALIDARG,
-       "CoGetPSClsid for null clsid returned 0x%08x instead of E_INVALIDARG\n",
+       "CoGetPSClsid for null clsid returned 0x%08lx instead of E_INVALIDARG\n",
        hr);
 
     if (!pRegOverridePredefKey)
@@ -1358,56 +1358,56 @@ static void test_CoGetPSClsid(void)
 
     res = RegCreateKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0,
                           KEY_ALL_ACCESS, NULL, &hkey, NULL);
-    ok(!res, "RegCreateKeyEx returned %d\n", res);
+    ok(!res, "RegCreateKeyEx returned %ld\n", res);
 
     res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey);
-    ok(!res, "RegOverridePredefKey returned %d\n", res);
+    ok(!res, "RegOverridePredefKey returned %ld\n", res);
 
     hr = CoGetPSClsid(&IID_IClassFactory, &clsid);
     ok_ole_success(hr, "CoGetPSClsid");
 
     res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, NULL);
-    ok(!res, "RegOverridePredefKey returned %d\n", res);
+    ok(!res, "RegOverridePredefKey returned %ld\n", res);
 
     RegCloseKey(hkey);
 
     /* not registered CLSID */
     hr = CoGetPSClsid(&IID_Testiface, &clsid);
-    ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
+    ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
         memset(&clsid, 0, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         memset(&clsid, 0, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface2, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         memset(&clsid, 0, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface3, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         memset(&clsid, 0xaa, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface4, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         memset(&clsid, 0xaa, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface7, &clsid);
-        ok(hr == S_OK, "Failed to get PS CLSID, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to get PS CLSID, hr %#lx.\n", hr);
         ok(IsEqualGUID(&clsid, &IID_Testiface7), "Unexpected CLSID %s.\n", wine_dbgstr_guid(&clsid));
 
         /* register same interface and try to get CLSID back */
         hr = CoRegisterPSClsid(&IID_Testiface, &IID_Testiface4);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         memset(&clsid, 0, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface, &clsid);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
         ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         deactivate_context(handle, cookie);
@@ -1424,11 +1424,11 @@ static void test_CoGetPSClsid(void)
         REGSAM opposite = is_win64 ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
 
         hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
-        ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr);
+        ok(hr == REGDB_E_IIDNOTREG, "got 0x%08lx\n", hr);
 
         res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Interface",
                               0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_iface, NULL);
-        ok(!res, "RegCreateKeyEx returned %d\n", res);
+        ok(!res, "RegCreateKeyEx returned %ld\n", res);
         res = RegCreateKeyExA(hkey_iface, clsidDeadBeef,
                               0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey, NULL);
         if (res == ERROR_ACCESS_DENIED)
@@ -1437,12 +1437,12 @@ static void test_CoGetPSClsid(void)
             goto cleanup;
         }
 
-        ok(!res, "RegCreateKeyEx returned %d\n", res);
+        ok(!res, "RegCreateKeyEx returned %ld\n", res);
         res = RegCreateKeyExA(hkey, "ProxyStubClsid32",
                               0, NULL, 0, KEY_ALL_ACCESS | opposite, NULL, &hkey_psclsid, NULL);
-        ok(!res, "RegCreateKeyEx returned %d\n", res);
+        ok(!res, "RegCreateKeyEx returned %ld\n", res);
         res = RegSetValueExA(hkey_psclsid, NULL, 0, REG_SZ, (const BYTE *)clsidA, strlen(clsidA)+1);
-        ok(!res, "RegSetValueEx returned %d\n", res);
+        ok(!res, "RegSetValueEx returned %ld\n", res);
         RegCloseKey(hkey_psclsid);
 
         hr = CoGetPSClsid(&IID_DeadBeef, &clsid);
@@ -1450,10 +1450,10 @@ static void test_CoGetPSClsid(void)
         ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", wine_dbgstr_guid(&clsid));
 
         res = pRegDeleteKeyExA(hkey, "ProxyStubClsid32", opposite, 0);
-        ok(!res, "RegDeleteKeyEx returned %d\n", res);
+        ok(!res, "RegDeleteKeyEx returned %ld\n", res);
         RegCloseKey(hkey);
         res = pRegDeleteKeyExA(hkey_iface, clsidDeadBeef, opposite, 0);
-        ok(!res, "RegDeleteKeyEx returned %d\n", res);
+        ok(!res, "RegDeleteKeyEx returned %ld\n", res);
 
     cleanup:
         RegCloseKey(hkey_iface);
@@ -1470,24 +1470,24 @@ static void test_CoUnmarshalInterface(void)
     HRESULT hr;
 
     hr = CoUnmarshalInterface(NULL, &IID_IUnknown, (void **)&pProxy);
-    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
     ok_ole_success(hr, "CreateStreamOnHGlobal");
 
     hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
     todo_wine
-    ok(hr == CO_E_NOTINITIALIZED, "CoUnmarshalInterface should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoUnmarshalInterface should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
 
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
-    ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
+    ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
 
     CoUninitialize();
 
     hr = CoUnmarshalInterface(pStream, &IID_IUnknown, NULL);
-    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     IStream_Release(pStream);
 }
@@ -1500,7 +1500,7 @@ static void test_CoGetInterfaceAndReleaseStream(void)
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     hr = CoGetInterfaceAndReleaseStream(NULL, &IID_IUnknown, (void**)&pUnk);
-    ok(hr == E_INVALIDARG, "hr %08x\n", hr);
+    ok(hr == E_INVALIDARG, "hr %08lx\n", hr);
 
     CoUninitialize();
 }
@@ -1518,17 +1518,17 @@ static void test_CoMarshalInterface(void)
     ok_ole_success(hr, "CreateStreamOnHGlobal");
 
     hr = CoMarshalInterface(pStream, &IID_IUnknown, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CoMarshalInterface(NULL, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoMarshalInterface should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CoMarshalInterface(pStream, &IID_IUnknown, (IUnknown *)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
     ok_ole_success(hr, "CoMarshalInterface");
 
     /* stream not rewound */
     hr = CoReleaseMarshalData(pStream);
-    ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
+    ok(hr == STG_E_READFAULT, "CoReleaseMarshalData should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
 
     hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
     ok_ole_success(hr, "IStream_Seek");
@@ -1552,10 +1552,10 @@ static void test_CoMarshalInterThreadInterfaceInStream(void)
     cLocks = 0;
 
     hr = CoMarshalInterThreadInterfaceInStream(&IID_IUnknown, (IUnknown *)&Test_ClassFactory, NULL);
-    ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CoMarshalInterThreadInterfaceInStream(&IID_IUnknown, NULL, &pStream);
-    ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoMarshalInterThreadInterfaceInStream should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     ok_no_locks();
 
@@ -1657,27 +1657,27 @@ static void test_CoRegisterClassObject(void)
     /* test that object is accessible */
     hr = CoRegisterClassObject(&CLSID_WineOOPTest, (IUnknown *)&Test_ClassFactory, CLSCTX_INPROC_SERVER,
         REGCLS_MULTIPLEUSE, &cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     IClassFactory_Release(pcf);
 
     /* context now contains CLSID_WineOOPTest, test if registered one could still be used */
     if ((handle = activate_context(actctx_manifest, &ctxcookie)))
     {
         hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
-        ok(hr == 0x80001234 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#x.\n", hr);
+        ok(hr == 0x80001234 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#lx.\n", hr);
 
         deactivate_context(handle, ctxcookie);
     }
 
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&pcf);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     IClassFactory_Release(pcf);
 
     hr = CoRevokeClassObject(cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     CoUninitialize();
 }
@@ -1781,24 +1781,24 @@ static void test_registered_object_thread_affinity(void)
     ok_ole_success(hr, "CoRegisterClassObject");
 
     thread = CreateThread(NULL, 0, get_class_object_thread, (LPVOID)CLSCTX_INPROC_SERVER, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     GetExitCodeThread(thread, &exitcode);
     hr = exitcode;
     ok(hr == REGDB_E_CLASSNOTREG, "CoGetClassObject on inproc object "
        "registered in different thread should return REGDB_E_CLASSNOTREG "
-       "instead of 0x%08x\n", hr);
+       "instead of 0x%08lx\n", hr);
 
     hr = get_class_object(CLSCTX_INPROC_SERVER);
     ok(hr == S_OK, "CoGetClassObject on inproc object registered in same "
-       "thread should return S_OK instead of 0x%08x\n", hr);
+       "thread should return S_OK instead of 0x%08lx\n", hr);
 
     thread = CreateThread(NULL, 0, register_class_object_thread, NULL, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok ( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     GetExitCodeThread(thread, &exitcode);
     hr = exitcode;
-    ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08x\n", hr);
+    ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different thread should return S_OK instead of 0x%08lx\n", hr);
 
     hr = CoRevokeClassObject(cookie);
     ok_ole_success(hr, "CoRevokeClassObject");
@@ -1810,7 +1810,7 @@ static void test_registered_object_thread_affinity(void)
     ok_ole_success(hr, "CoRegisterClassObject");
 
     thread = CreateThread(NULL, 0, get_class_object_proxy_thread, (LPVOID)CLSCTX_LOCAL_SERVER, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     while (MsgWaitForMultipleObjects(1, &thread, FALSE, 10000, QS_ALLINPUT) == WAIT_OBJECT_0 + 1)
     {
         MSG msg;
@@ -1824,27 +1824,27 @@ static void test_registered_object_thread_affinity(void)
     hr = exitcode;
     ok(hr == S_OK, "CoGetClassObject on local server object "
        "registered in different thread should return S_OK "
-       "instead of 0x%08x\n", hr);
+       "instead of 0x%08lx\n", hr);
 
     hr = get_class_object(CLSCTX_LOCAL_SERVER);
     ok(hr == S_OK, "CoGetClassObject on local server object registered in same "
-       "thread should return S_OK instead of 0x%08x\n", hr);
+       "thread should return S_OK instead of 0x%08lx\n", hr);
 
     thread = CreateThread(NULL, 0, revoke_class_object_thread, (LPVOID)(DWORD_PTR)cookie, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     GetExitCodeThread(thread, &exitcode);
     hr = exitcode;
     ok(hr == RPC_E_WRONG_THREAD || broken(hr == S_OK) /* win8 */, "CoRevokeClassObject called from different "
-       "thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08x\n", hr);
+       "thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08lx\n", hr);
 
     thread = CreateThread(NULL, 0, register_class_object_thread, NULL, 0, &tid);
-    ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed with error %ld\n", GetLastError());
     ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     GetExitCodeThread(thread, &exitcode);
     hr = exitcode;
     ok(hr == S_OK, "CoRegisterClassObject with same CLSID but in different "
-        "thread should return S_OK instead of 0x%08x\n", hr);
+        "thread should return S_OK instead of 0x%08lx\n", hr);
 
     hr = CoRevokeClassObject(cookie);
     ok_ole_success(hr, "CoRevokeClassObject");
@@ -1924,7 +1924,7 @@ static void test_CoGetObjectContext(void)
     }
 
     hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&pComThreadingInfo);
-    ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
     ok(pComThreadingInfo == NULL, "pComThreadingInfo should have been set to NULL\n");
 
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
@@ -1936,16 +1936,16 @@ static void test_CoGetObjectContext(void)
 
     threadinginfo2 = NULL;
     hr = pCoGetObjectContext(&IID_IComThreadingInfo, (void **)&threadinginfo2);
-    ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
     ok(pComThreadingInfo == threadinginfo2, "got different instance\n");
     IComThreadingInfo_Release(threadinginfo2);
 
     hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     id = id2 = GUID_NULL;
     hr = IComThreadingInfo_GetCurrentLogicalThreadId(pComThreadingInfo, &id);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CoGetCurrentLogicalThreadId(&id2);
     ok(IsEqualGUID(&id, &id2), "got %s, expected %s\n", wine_dbgstr_guid(&id), wine_dbgstr_guid(&id2));
@@ -1959,13 +1959,13 @@ static void test_CoGetObjectContext(void)
     ok(thdtype == THDTYPE_PROCESSMESSAGES, "thread type should be THDTYPE_PROCESSMESSAGES instead of %d\n", thdtype);
 
     refs = IComThreadingInfo_Release(pComThreadingInfo);
-    ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
+    ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
 
     hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
     ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
 
     refs = IContextCallback_Release(pContextCallback);
-    ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
+    ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
 
     CoUninitialize();
 
@@ -1983,19 +1983,19 @@ static void test_CoGetObjectContext(void)
     ok(thdtype == THDTYPE_BLOCKMESSAGES, "thread type should be THDTYPE_BLOCKMESSAGES instead of %d\n", thdtype);
 
     refs = IComThreadingInfo_Release(pComThreadingInfo);
-    ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
+    ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %ld refs\n", refs);
 
     hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
     ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
 
     refs = IContextCallback_Release(pContextCallback);
-    ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
+    ok(refs == 0, "pContextCallback should have 0 refs instead of %ld refs\n", refs);
 
     hr = pCoGetObjectContext(&IID_IObjContext, (void **)&pObjContext);
     ok_ole_success(hr, "CoGetObjectContext");
 
     refs = IObjContext_Release(pObjContext);
-    ok(refs == 0, "pObjContext should have 0 refs instead of %d refs\n", refs);
+    ok(refs == 0, "pObjContext should have 0 refs instead of %ld refs\n", refs);
 
     CoUninitialize();
 }
@@ -2070,14 +2070,14 @@ static void test_CoGetCallContext(void)
     test_object->refs = 1;
 
     hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
-    ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
+    ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
 
     pUnk = (IUnknown*)0xdeadbeef;
     hr = pCoSwitchCallContext(&test_object->IUnknown_iface, &pUnk);
     ok_ole_success(hr, "CoSwitchCallContext");
     ok(pUnk == NULL, "expected NULL, got %p\n", pUnk);
     refs = IUnknown_AddRef(&test_object->IUnknown_iface);
-    ok(refs == 2, "Expected refcount 2, got %d\n", refs);
+    ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
     IUnknown_Release(&test_object->IUnknown_iface);
 
     pUnk = (IUnknown*)0xdeadbeef;
@@ -2086,7 +2086,7 @@ static void test_CoGetCallContext(void)
     ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
        &test_object->IUnknown_iface, pUnk);
     refs = IUnknown_AddRef(&test_object->IUnknown_iface);
-    ok(refs == 3, "Expected refcount 3, got %d\n", refs);
+    ok(refs == 3, "Expected refcount 3, got %ld\n", refs);
     IUnknown_Release(&test_object->IUnknown_iface);
     IUnknown_Release(pUnk);
 
@@ -2096,11 +2096,11 @@ static void test_CoGetCallContext(void)
     ok(pUnk == &test_object->IUnknown_iface, "expected %p, got %p\n",
        &test_object->IUnknown_iface, pUnk);
     refs = IUnknown_AddRef(&test_object->IUnknown_iface);
-    ok(refs == 2, "Expected refcount 2, got %d\n", refs);
+    ok(refs == 2, "Expected refcount 2, got %ld\n", refs);
     IUnknown_Release(&test_object->IUnknown_iface);
 
     hr = CoGetCallContext(&IID_IUnknown, (void**)&pUnk);
-    ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08x\n", hr);
+    ok(hr == RPC_E_CALL_COMPLETE, "Expected RPC_E_CALL_COMPLETE, got 0x%08lx\n", hr);
 
     IUnknown_Release(&test_object->IUnknown_iface);
 
@@ -2122,8 +2122,8 @@ static void test_CoGetContextToken(void)
 
     token = 0xdeadbeef;
     hr = pCoGetContextToken(&token);
-    ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08x\n", hr);
-    ok(token == 0xdeadbeef, "Expected 0, got 0x%lx\n", token);
+    ok(hr == CO_E_NOTINITIALIZED, "Expected CO_E_NOTINITIALIZED, got 0x%08lx\n", hr);
+    ok(token == 0xdeadbeef, "Expected 0, got 0x%Ix\n", token);
 
     test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
 
@@ -2132,49 +2132,49 @@ static void test_CoGetContextToken(void)
     test_apt_type(APTTYPE_MAINSTA, APTTYPEQUALIFIER_NONE);
 
     hr = pCoGetContextToken(NULL);
-    ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08x\n", hr);
+    ok(hr == E_POINTER, "Expected E_POINTER, got 0x%08lx\n", hr);
 
     token = 0;
     hr = pCoGetContextToken(&token);
-    ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
     ok(token, "Expected token != 0\n");
 
     token2 = 0;
     hr = pCoGetContextToken(&token2);
-    ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
     ok(token2 == token, "got different token\n");
 
     refs = IUnknown_AddRef((IUnknown *)token);
-    ok(refs == 1, "Expected 1, got %u\n", refs);
+    ok(refs == 1, "Expected 1, got %lu\n", refs);
 
     hr = pCoGetObjectContext(&IID_IObjContext, (void **)&ctx);
-    ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
     ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
 
     refs = IObjContext_AddRef(ctx);
-    ok(refs == 3, "Expected 3, got %u\n", refs);
+    ok(refs == 3, "Expected 3, got %lu\n", refs);
 
     refs = IObjContext_Release(ctx);
-    ok(refs == 2, "Expected 2, got %u\n", refs);
+    ok(refs == 2, "Expected 2, got %lu\n", refs);
 
     refs = IUnknown_Release((IUnknown *)token);
-    ok(refs == 1, "Expected 1, got %u\n", refs);
+    ok(refs == 1, "Expected 1, got %lu\n", refs);
 
     /* CoGetContextToken does not add a reference */
     token = 0;
     hr = pCoGetContextToken(&token);
-    ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got 0x%08lx\n", hr);
     ok(token, "Expected token != 0\n");
     ok(ctx == (IObjContext *)token, "Expected interface pointers to be the same\n");
 
     refs = IObjContext_AddRef(ctx);
-    ok(refs == 2, "Expected 1, got %u\n", refs);
+    ok(refs == 2, "Expected 1, got %lu\n", refs);
 
     refs = IObjContext_Release(ctx);
-    ok(refs == 1, "Expected 0, got %u\n", refs);
+    ok(refs == 1, "Expected 0, got %lu\n", refs);
 
     refs = IObjContext_Release(ctx);
-    ok(refs == 0, "Expected 0, got %u\n", refs);
+    ok(refs == 0, "Expected 0, got %lu\n", refs);
 
     CoUninitialize();
 }
@@ -2190,38 +2190,38 @@ static void test_TreatAsClass(void)
     LONG lr;
 
     hr = CoGetTreatAsClass(&deadbeef,&out);
-    ok (hr == S_FALSE, "expected S_FALSE got %x\n",hr);
+    ok (hr == S_FALSE, "expected S_FALSE got %lx\n",hr);
     ok (IsEqualGUID(&out,&deadbeef), "expected to get same clsid back\n");
 
     hr = CoGetTreatAsClass(NULL, &out);
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08x\n", hr);
+    ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
     ok(IsEqualGUID(&out, &deadbeef), "expected no change to the clsid\n");
 
     hr = CoGetTreatAsClass(&deadbeef, NULL);
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08x\n", hr);
+    ok(hr == E_INVALIDARG, "expected E_INVALIDARG got %08lx\n", hr);
 
     lr = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &clsidkey);
-    ok(!lr, "Couldn't open CLSID key, error %d\n", lr);
+    ok(!lr, "Couldn't open CLSID key, error %ld\n", lr);
 
     lr = RegCreateKeyExA(clsidkey, deadbeefA, 0, NULL, 0, KEY_WRITE, NULL, &deadbeefkey, NULL);
     if (lr) {
-        win_skip("CoGetTreatAsClass() tests will be skipped (failed to create a test key, error %d)\n", lr);
+        win_skip("CoGetTreatAsClass() tests will be skipped (failed to create a test key, error %ld)\n", lr);
         RegCloseKey(clsidkey);
         return;
     }
 
     hr = CoTreatAsClass(&deadbeef, &deadbeef);
-    ok(hr == REGDB_E_WRITEREGDB, "CoTreatAsClass gave wrong error: %08x\n", hr);
+    ok(hr == REGDB_E_WRITEREGDB, "CoTreatAsClass gave wrong error: %08lx\n", hr);
 
     hr = CoTreatAsClass(&deadbeef, &CLSID_FileProtocol);
     if(hr == REGDB_E_WRITEREGDB){
         win_skip("Insufficient privileges to use CoTreatAsClass\n");
         goto exit;
     }
-    ok(hr == S_OK, "CoTreatAsClass failed: %08x\n", hr);
+    ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
 
     hr = CoGetTreatAsClass(&deadbeef, &out);
-    ok(hr == S_OK, "CoGetTreatAsClass failed: %08x\n",hr);
+    ok(hr == S_OK, "CoGetTreatAsClass failed: %08lx\n",hr);
     ok(IsEqualGUID(&out, &CLSID_FileProtocol), "expected to get substituted clsid\n");
 
     OleInitialize(NULL);
@@ -2233,7 +2233,7 @@ static void test_TreatAsClass(void)
         goto exit;
     }
 
-    ok(hr == S_OK, "CoCreateInstance failed: %08x\n", hr);
+    ok(hr == S_OK, "CoCreateInstance failed: %08lx\n", hr);
     if(pIP){
         IInternetProtocol_Release(pIP);
         pIP = NULL;
@@ -2245,29 +2245,29 @@ static void test_TreatAsClass(void)
 
         mqi.pIID = &IID_IInternetProtocol;
         hr = pCoCreateInstanceFromApp(&deadbeef, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
-        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
         hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, &IID_IInternetProtocol,
                 (void **)&pIP);
-        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
         hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         IUnknown_Release(pIP);
     }
 
     hr = CoTreatAsClass(&deadbeef, &CLSID_NULL);
-    ok(hr == S_OK, "CoTreatAsClass failed: %08x\n", hr);
+    ok(hr == S_OK, "CoTreatAsClass failed: %08lx\n", hr);
 
     hr = CoGetTreatAsClass(&deadbeef, &out);
-    ok(hr == S_FALSE, "expected S_FALSE got %08x\n", hr);
+    ok(hr == S_FALSE, "expected S_FALSE got %08lx\n", hr);
     ok(IsEqualGUID(&out, &deadbeef), "expected to get same clsid back\n");
 
     /* bizarrely, native's CoTreatAsClass takes some time to take effect in CoCreateInstance */
     Sleep(200);
 
     hr = CoCreateInstance(&deadbeef, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pIP);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance gave wrong error: %08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance gave wrong error: %08lx\n", hr);
 
     if(pIP)
         IInternetProtocol_Release(pIP);
@@ -2284,16 +2284,16 @@ static void test_CoInitializeEx(void)
     HRESULT hr;
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
 
     /* Calling OleInitialize for the first time should yield S_OK even with
      * apartment already initialized by previous CoInitialize(Ex) calls. */
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "OleInitialize failed with error 0x%08lx\n", hr);
 
     /* Subsequent calls to OleInitialize should return S_FALSE */
     hr = OleInitialize(NULL);
-    ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
+    ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08lx\n", hr);
 
     /* Cleanup */
     CoUninitialize();
@@ -2309,59 +2309,59 @@ static void test_OleInitialize_InitCounting(void)
 
     /* 1. OleInitialize fails but OleUninitialize is still called: apartment stays initialized */
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    ok(hr == S_OK, "CoInitializeEx(COINIT_MULTITHREADED) failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx(COINIT_MULTITHREADED) failed with error 0x%08lx\n", hr);
 
     hr = OleInitialize(NULL);
-    ok(hr == RPC_E_CHANGED_MODE, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", RPC_E_CHANGED_MODE, hr);
+    ok(hr == RPC_E_CHANGED_MODE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", RPC_E_CHANGED_MODE, hr);
     OleUninitialize();
 
     pUnk = (IUnknown *)0xdeadbeef;
     hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == S_OK, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
+    ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
     if (pUnk) IUnknown_Release(pUnk);
 
     CoUninitialize();
 
     /* 2. Extra multiple OleUninitialize: apartment stays initialized until CoUninitialize */
     hr = CoInitialize(NULL);
-    ok(hr == S_OK, "CoInitialize() failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
 
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
+    ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
     OleUninitialize();
     OleUninitialize();
     OleUninitialize();
 
     pUnk = (IUnknown *)0xdeadbeef;
     hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == S_OK, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
+    ok(hr == S_OK, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
     if (pUnk) IUnknown_Release(pUnk);
 
     CoUninitialize();
 
     pUnk = (IUnknown *)0xdeadbeef;
     hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", CO_E_NOTINITIALIZED, hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
     if (pUnk) IUnknown_Release(pUnk);
 
     /* 3. CoUninitialize does not formally deinit Ole */
     hr = CoInitialize(NULL);
-    ok(hr == S_OK, "CoInitialize() failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitialize() failed with error 0x%08lx\n", hr);
 
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_OK, hr);
+    ok(hr == S_OK, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_OK, hr);
 
     CoUninitialize();
     CoUninitialize();
 
     pUnk = (IUnknown *)0xdeadbeef;
     hr = CoCreateInstance(rclsid, NULL, 0x17, &IID_IUnknown, (void **)&pUnk);
-    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08x instead of 0x%08x\n", CO_E_NOTINITIALIZED, hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned 0x%08lx instead of 0x%08lx\n", CO_E_NOTINITIALIZED, hr);
       /* COM is not initialized anymore */
     if (pUnk) IUnknown_Release(pUnk);
 
     hr = OleInitialize(NULL);
-    ok(hr == S_FALSE, "OleInitialize should have returned 0x%08x instead of 0x%08x\n", S_FALSE, hr);
+    ok(hr == S_FALSE, "OleInitialize should have returned 0x%08lx instead of 0x%08lx\n", S_FALSE, hr);
       /* ... but native OleInit returns S_FALSE as if Ole is considered initialized */
 
     OleUninitialize();
@@ -2376,36 +2376,36 @@ static void test_OleRegGetMiscStatus(void)
     HRESULT hr;
 
     hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     status = 0xdeadbeef;
     hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
-    ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
-    ok(status == 0, "got 0x%08x\n", status);
+    ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
+    ok(status == 0, "got 0x%08lx\n", status);
 
     status = -1;
     hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(status == 0, "got 0x%08x\n", status);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(status == 0, "got 0x%08lx\n", status);
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
         status = 0;
         hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
-        ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
+        ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
 
         /* context data takes precedence over registration info */
         status = 0;
         hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
-        ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
+        ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08lx\n", status);
 
         /* there's no such attribute in context */
         status = -1;
         hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
-        ok(status == 0, "got 0x%08x\n", status);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
+        ok(status == 0, "got 0x%08lx\n", status);
 
         deactivate_context(handle, cookie);
     }
@@ -2441,19 +2441,19 @@ static void test_OleRegGetUserType(void)
 
     for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
         hr = OleRegGetUserType(&CLSID_Testclass, form, NULL);
-        ok(hr == E_INVALIDARG, "form %u: got 0x%08x\n", form, hr);
+        ok(hr == E_INVALIDARG, "form %lu: got 0x%08lx\n", form, hr);
 
         str = (void*)0xdeadbeef;
         hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
-        ok(hr == REGDB_E_CLASSNOTREG, "form %u: got 0x%08x\n", form, hr);
-        ok(str == NULL, "form %u: got %p\n", form, str);
+        ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
+        ok(str == NULL, "form %lu: got %p\n", form, str);
 
         /* same string returned for StdFont for all form types */
         str = NULL;
         hr = OleRegGetUserType(&CLSID_StdFont, form, &str);
-        ok(hr == S_OK, "form %u: got 0x%08x\n", form, hr);
+        ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
         ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
-            "form %u, got %s\n", form, wine_dbgstr_w(str));
+            "form %lu, got %s\n", form, wine_dbgstr_w(str));
         CoTaskMemFree(str);
     }
 
@@ -2462,15 +2462,15 @@ static void test_OleRegGetUserType(void)
         for (form = 0; form <= USERCLASSTYPE_APPNAME+1; form++) {
             str = (void*)0xdeadbeef;
             hr = OleRegGetUserType(&CLSID_Testclass, form, &str);
-            ok(hr == REGDB_E_CLASSNOTREG, "form %u: got 0x%08x\n", form, hr);
-            ok(str == NULL, "form %u: got %s\n", form, wine_dbgstr_w(str));
+            ok(hr == REGDB_E_CLASSNOTREG, "form %lu: got 0x%08lx\n", form, hr);
+            ok(str == NULL, "form %lu: got %s\n", form, wine_dbgstr_w(str));
 
             /* same string returned for StdFont for all form types */
             str = NULL;
             hr = OleRegGetUserType(&CLSID_StdFont, form, &str);
-            ok(hr == S_OK, "form %u: got 0x%08x\n", form, hr);
+            ok(hr == S_OK, "form %lu: got 0x%08lx\n", form, hr);
             ok(!lstrcmpW(str, stdfont_usertypeW) || !lstrcmpW(str, stdfont2_usertypeW) /* winxp */,
-                "form %u, got %s\n", form, wine_dbgstr_w(str));
+                "form %lu, got %s\n", form, wine_dbgstr_w(str));
             CoTaskMemFree(str);
         }
 
@@ -2494,13 +2494,13 @@ static void test_OleRegGetUserType(void)
         return;
     }
 
-    ok(!ret, "failed to create a key, error %d\n", ret);
+    ok(!ret, "failed to create a key, error %ld\n", ret);
 
     ret = RegSetValueExW(classkey, NULL, 0, REG_SZ, (const BYTE*)defvalueW, sizeof(defvalueW));
-    ok(!ret, "got error %d\n", ret);
+    ok(!ret, "got error %ld\n", ret);
 
     ret = RegCreateKeyExA(classkey, "AuxUserType", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &auxhkey, NULL);
-    ok(!ret, "got error %d\n", ret);
+    ok(!ret, "got error %ld\n", ret);
 
     /* populate AuxUserType */
     for (i = 0; i <= 4; i++) {
@@ -2508,46 +2508,46 @@ static void test_OleRegGetUserType(void)
 
         sprintf(name, "AuxUserType\\%d", i);
         ret = RegCreateKeyExA(classkey, name, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL);
-        ok(!ret, "got error %d\n", ret);
+        ok(!ret, "got error %ld\n", ret);
 
         ret = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const BYTE*)auxvalues[i], strlen(auxvalues[i]));
-        ok(!ret, "got error %d\n", ret);
+        ok(!ret, "got error %ld\n", ret);
         RegCloseKey(hkey);
     }
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, 0, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, auxvalue0W), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_FULL, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_SHORT, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, auxvalue2W), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, auxvalue3W), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+1, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, auxvalue4W), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
     str = NULL;
     hr = OleRegGetUserType(&CLSID_non_existent, USERCLASSTYPE_APPNAME+2, &str);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!lstrcmpW(str, defvalueW), "got %s\n", wine_dbgstr_w(str));
     CoTaskMemFree(str);
 
@@ -2572,7 +2572,7 @@ static void test_CoCreateGuid(void)
     HRESULT hr;
 
     hr = CoCreateGuid(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 }
 
 static void CALLBACK apc_test_proc(ULONG_PTR param)
@@ -2650,7 +2650,7 @@ static void _cowait_msgs_expect_queued(unsigned line, HWND hwnd, UINT expected_m
     BOOL success;
 
     success = PeekMessageA(&msg, hwnd, expected_msg, expected_msg, PM_REMOVE);
-    ok_(__FILE__,line)(success, "PeekMessageA failed: %u\n", GetLastError());
+    ok_(__FILE__,line)(success, "PeekMessageA failed: %lu\n", GetLastError());
     if(success)
         ok_(__FILE__,line)(msg.message == expected_msg, "unexpected message %u, expected %u\n",
                            msg.message, expected_msg);
@@ -2683,13 +2683,13 @@ static DWORD CALLBACK cowait_unmarshal_thread(void *arg)
 
     zero.QuadPart = 0;
     hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "Seek failed: %08x\n", hr);
+    ok(hr == S_OK, "Seek failed: %08lx\n", hr);
 
     hr = CoUnmarshalInterface(stream, &IID_IUnknown, (void**)&unk);
-    ok(hr == S_OK, "CoUnmarshalInterface failed: %08x\n", hr);
+    ok(hr == S_OK, "CoUnmarshalInterface failed: %08lx\n", hr);
 
     hr = IUnknown_QueryInterface(unk, &IID_IEnumOLEVERB, (void**)&enum_verb);
-    ok(hr == S_OK, "QueryInterface failed: %08x\n", hr);
+    ok(hr == S_OK, "QueryInterface failed: %08lx\n", hr);
 
     IEnumOLEVERB_Release(enum_verb);
     IUnknown_Release(unk);
@@ -2711,24 +2711,24 @@ static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
     int ret;
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
 
     hWnd = CreateWindowExA(0, cls_name, "Test (thread)", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
-    ok(hWnd != 0, "CreateWindowExA failed %u\n", GetLastError());
+    ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_USER, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index==0 || index==0xdeadbeef/* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_USER, WM_USER, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
@@ -2738,8 +2738,8 @@ static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
     PostMessageA(NULL, uMSG, 0, 0);
 
     hr = CoWaitForMultipleHandles(COWAIT_ALERTABLE, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
 
     /* Make sure message was peeked at */
     ret = MsgWaitForMultipleObjectsEx(0, NULL, 2, QS_ALLPOSTMESSAGE, MWMO_ALERTABLE);
@@ -2753,13 +2753,13 @@ static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
     CoUninitialize();
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "CreateStreamOnHGlobal failed: %08x\n", hr);
+    ok(hr == S_OK, "CreateStreamOnHGlobal failed: %08lx\n", hr);
 
     hr = CoMarshalInterface(stream, &IID_IUnknown, &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08x\n", hr);
+    ok(hr == S_OK, "CoMarshalInterface should have returned S_OK instead of 0x%08lx\n", hr);
 
     event = CreateEventW(NULL, TRUE, FALSE, NULL);
 
@@ -2767,19 +2767,19 @@ static DWORD CALLBACK test_CoWaitForMultipleHandles_thread(LPVOID arg)
     PostThreadMessageW(GetCurrentThreadId(), WM_QUIT, 0, 0);
 
     hr = CoRegisterMessageFilter(&MessageFilter, NULL);
-    ok(hr == S_OK, "CoRegisterMessageFilter failed: %08x\n", hr);
+    ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
 
     thread = CreateThread(NULL, 0, cowait_unmarshal_thread, stream, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 50, 1, &event, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
     hr = CoWaitForMultipleHandles(0, 200, 1, &thread, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
     ok(index == WAIT_OBJECT_0, "cowait_unmarshal_thread didn't finish\n");
     CloseHandle(thread);
 
     hr = CoRegisterMessageFilter(NULL, NULL);
-    ok(hr == S_OK, "CoRegisterMessageFilter failed: %08x\n", hr);
+    ok(hr == S_OK, "CoRegisterMessageFilter failed: %08lx\n", hr);
 
     IStream_Release(stream);
 
@@ -2799,7 +2799,7 @@ static void test_CoWaitForMultipleHandles(void)
     MSG msg;
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed with error 0x%08lx\n", hr);
 
     memset(&wc, 0, sizeof(wc));
     wc.cbSize        = sizeof(wc);
@@ -2810,60 +2810,60 @@ static void test_CoWaitForMultipleHandles(void)
     wc.lpszClassName = cls_name;
     wc.lpfnWndProc   = cowait_window_proc;
     success = RegisterClassExA(&wc) != 0;
-    ok(success, "RegisterClassExA failed %u\n", GetLastError());
+    ok(success, "RegisterClassExA failed %lu\n", GetLastError());
 
     hWnd = CreateWindowExA(0, cls_name, "Test", WS_TILEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0);
-    ok(hWnd != 0, "CreateWindowExA failed %u\n", GetLastError());
+    ok(hWnd != 0, "CreateWindowExA failed %lu\n", GetLastError());
     handles[0] = CreateSemaphoreA(NULL, 1, 1, NULL);
-    ok(handles[0] != 0, "CreateSemaphoreA failed %u\n", GetLastError());
+    ok(handles[0] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
     handles[1] = CreateSemaphoreA(NULL, 1, 1, NULL);
-    ok(handles[1] != 0, "CreateSemaphoreA failed %u\n", GetLastError());
+    ok(handles[1] != 0, "CreateSemaphoreA failed %lu\n", GetLastError());
 
     /* test without flags */
 
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 0, handles, NULL);
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 0, NULL, &index);
-    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08x\n", hr);
-    ok(index == 0, "expected index 0, got %u\n", index);
+    ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got 0x%08lx\n", hr);
+    ok(index == 0, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 0, handles, &index);
-    ok(hr == RPC_E_NO_SYNC, "expected RPC_E_NO_SYNC, got 0x%08x\n", hr);
-    ok(index == 0, "expected index 0, got %u\n", index);
+    ok(hr == RPC_E_NO_SYNC, "expected RPC_E_NO_SYNC, got 0x%08lx\n", hr);
+    ok(index == 0, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 1, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == 0, "expected index 0, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == 0, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == 1, "expected index 1, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == 1, "expected index 1, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
 
@@ -2871,10 +2871,10 @@ static void test_CoWaitForMultipleHandles(void)
 
     index = 0xdeadbeef;
     thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
     index = WaitForSingleObject(thread, 200);
@@ -2883,10 +2883,10 @@ static void test_CoWaitForMultipleHandles(void)
 
     index = 0xdeadbeef;
     thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
     index = WaitForSingleObject(thread, 200);
@@ -2901,16 +2901,16 @@ static void test_CoWaitForMultipleHandles(void)
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(COWAIT_WAITALL, 50, 2, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == 0, "expected index 0, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == 0, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
 
@@ -2922,34 +2922,34 @@ static void test_CoWaitForMultipleHandles(void)
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(COWAIT_ALERTABLE, 50, 1, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == 0, "expected index 0, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == 0, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(COWAIT_ALERTABLE, 50, 2, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == 1, "expected index 1, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == 1, "expected index 1, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(COWAIT_ALERTABLE, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
 
     index = 0xdeadbeef;
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     success = QueueUserAPC(apc_test_proc, GetCurrentThread(), 0);
-    ok(success, "QueueUserAPC failed %u\n", GetLastError());
+    ok(success, "QueueUserAPC failed %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(COWAIT_ALERTABLE, 50, 2, handles, &index);
-    ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr);
-    ok(index == WAIT_IO_COMPLETION, "expected index WAIT_IO_COMPLETION, got %u\n", index);
+    ok(hr == S_OK, "expected S_OK, got 0x%08lx\n", hr);
+    ok(index == WAIT_IO_COMPLETION, "expected index WAIT_IO_COMPLETION, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(success, "CoWaitForMultipleHandles unexpectedly pumped messages\n");
 
@@ -2960,8 +2960,8 @@ static void test_CoWaitForMultipleHandles(void)
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_NOREMOVE);
     ok(success, "PeekMessageA returned FALSE\n");
     hr = CoWaitForMultipleHandles(0, 50, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump any messages\n");
 
@@ -2970,12 +2970,12 @@ static void test_CoWaitForMultipleHandles(void)
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_NOREMOVE);
     ok(success, "PeekMessageA returned FALSE\n");
     thread = CreateThread(NULL, 0, release_semaphore_thread, handles[1], 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(COWAIT_INPUTAVAILABLE, 50, 2, handles, &index);
     ok(hr == RPC_S_CALLPENDING || broken(hr == E_INVALIDARG) || broken(hr == S_OK) /* Win 8 */,
-       "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+       "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
     if (hr != S_OK) ReleaseSemaphore(handles[1], 1, NULL);
-    ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(index == 0 || broken(index == 1) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success || broken(success && hr == E_INVALIDARG),
        "CoWaitForMultipleHandles didn't pump any messages\n");
@@ -2989,10 +2989,10 @@ static void test_CoWaitForMultipleHandles(void)
     PostMessageA(hWnd, WM_USER+1, 0, 0);
     PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
     thread = CreateThread(NULL, 0, send_and_post_user_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
 
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
 
     cowait_msgs_expect_notified(WM_DDE_FIRST);
     cowait_msgs_expect_notified(WM_DDE_FIRST+1);
@@ -3011,9 +3011,9 @@ static void test_CoWaitForMultipleHandles(void)
     PostMessageA(hWnd, WM_QUIT, 40, 0);
     memset(&msg, 0, sizeof(msg));
     success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
-    ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+    ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
     ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
-    ok(msg.wParam == 40, "expected msg.wParam = 40, got %lu\n", msg.wParam);
+    ok(msg.wParam == 40, "expected msg.wParam = 40, got %Iu\n", msg.wParam);
     success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
     ok(!success, "PeekMessageA succeeded\n");
 
@@ -3024,10 +3024,10 @@ static void test_CoWaitForMultipleHandles(void)
     PostMessageA(hWnd, WM_USER+1, 0, 0);
     PostMessageA(hWnd, WM_DDE_FIRST+1, 0, 0);
     thread = CreateThread(NULL, 0, send_and_post_user_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
 
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
 
     cowait_msgs_expect_notified(WM_DDE_FIRST);
     cowait_msgs_expect_notified(WM_DDE_FIRST+1);
@@ -3044,13 +3044,13 @@ static void test_CoWaitForMultipleHandles(void)
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     PostMessageA(hWnd, WM_QUIT, 41, 0);
     thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     todo_wine
-    ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %u\n", GetLastError());
+    ok(success || broken(!success) /* Win 2000/XP/8 */, "PeekMessageA failed, error %lu\n", GetLastError());
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "PeekMessageA succeeded\n");
     memset(&msg, 0, sizeof(msg));
@@ -3060,7 +3060,7 @@ static void test_CoWaitForMultipleHandles(void)
     if (success)
     {
         ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
-        ok(msg.wParam == 41, "expected msg.wParam = 41, got %lu\n", msg.wParam);
+        ok(msg.wParam == 41, "expected msg.wParam = 41, got %Iu\n", msg.wParam);
     }
     index = WaitForSingleObject(thread, 200);
     ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
@@ -3070,17 +3070,17 @@ static void test_CoWaitForMultipleHandles(void)
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     PostMessageA(hWnd, WM_QUIT, 42, 0);
     thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
-    ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
     hr = CoWaitForMultipleHandles(0, 500, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+    ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+    ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
     ok(!success, "CoWaitForMultipleHandles didn't pump all WM_DDE_FIRST messages\n");
     memset(&msg, 0, sizeof(msg));
     success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
-    ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+    ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
     ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
-    ok(msg.wParam == 42, "expected msg.wParam = 42, got %lu\n", msg.wParam);
+    ok(msg.wParam == 42, "expected msg.wParam = 42, got %Iu\n", msg.wParam);
     index = WaitForSingleObject(thread, 200);
     ok(index == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(thread);
@@ -3088,13 +3088,13 @@ static void test_CoWaitForMultipleHandles(void)
     PostQuitMessage(43);
     memset(&msg, 0, sizeof(msg));
     success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
-    ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %u\n", GetLastError());
+    ok(success || broken(!success) /* Win 8 */, "PeekMessageA failed, error %lu\n", GetLastError());
     if (!success)
         win_skip("PostQuitMessage didn't queue a WM_QUIT message, skipping tests\n");
     else
     {
         ok(msg.message == WM_QUIT, "expected msg.message = WM_QUIT, got %u\n", msg.message);
-        ok(msg.wParam == 43, "expected msg.wParam = 43, got %lu\n", msg.wParam);
+        ok(msg.wParam == 43, "expected msg.wParam = 43, got %Iu\n", msg.wParam);
         success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
         ok(!success, "PeekMessageA succeeded\n");
 
@@ -3102,12 +3102,12 @@ static void test_CoWaitForMultipleHandles(void)
         PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
         PostQuitMessage(44);
         thread = CreateThread(NULL, 0, post_message_thread, hWnd, 0, &tid);
-        ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+        ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
         hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-        ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-        ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+        ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+        ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
         success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
-        ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+        ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
         success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
         ok(!success, "PeekMessageA succeeded\n");
         success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
@@ -3120,12 +3120,12 @@ static void test_CoWaitForMultipleHandles(void)
         PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
         PostQuitMessage(45);
         thread = CreateThread(NULL, 0, send_message_thread, hWnd, 0, &tid);
-        ok(thread != NULL, "CreateThread failed, error %u\n", GetLastError());
+        ok(thread != NULL, "CreateThread failed, error %lu\n", GetLastError());
         hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-        ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08x\n", hr);
-        ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %u\n", index);
+        ok(hr == RPC_S_CALLPENDING, "expected RPC_S_CALLPENDING, got 0x%08lx\n", hr);
+        ok(index == 0 || broken(index == 0xdeadbeef) /* Win 8 */, "expected index 0, got %lu\n", index);
         success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
-        ok(success, "PeekMessageA failed, error %u\n", GetLastError());
+        ok(success, "PeekMessageA failed, error %lu\n", GetLastError());
         success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
         ok(!success, "PeekMessageA succeeded\n");
         success = PeekMessageA(&msg, hWnd, WM_QUIT, WM_QUIT, PM_REMOVE);
@@ -3146,22 +3146,22 @@ static void test_CoWaitForMultipleHandles(void)
     /* If COM was not initialized, messages are neither pumped nor peeked at */
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "got %#x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
     success = MsgWaitForMultipleObjectsEx(0, NULL, 2, QS_ALLPOSTMESSAGE, MWMO_ALERTABLE);
     ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
-    ok(success, "PeekMessage failed: %u\n", GetLastError());
+    ok(success, "PeekMessage failed: %lu\n", GetLastError());
 
     /* same in an MTA */
     CoInitializeEx(NULL, COINIT_MULTITHREADED);
 
     PostMessageA(hWnd, WM_DDE_FIRST, 0, 0);
     hr = CoWaitForMultipleHandles(0, 100, 2, handles, &index);
-    ok(hr == RPC_S_CALLPENDING, "got %#x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "got %#lx\n", hr);
     success = MsgWaitForMultipleObjectsEx(0, NULL, 2, QS_ALLPOSTMESSAGE, MWMO_ALERTABLE);
     ok(success == 0, "MsgWaitForMultipleObjects returned %x\n", success);
     success = PeekMessageA(&msg, hWnd, WM_DDE_FIRST, WM_DDE_FIRST, PM_REMOVE);
-    ok(success, "PeekMessage failed: %u\n", GetLastError());
+    ok(success, "PeekMessage failed: %lu\n", GetLastError());
 
     CoUninitialize();
 
@@ -3170,7 +3170,7 @@ static void test_CoWaitForMultipleHandles(void)
     DestroyWindow(hWnd);
 
     success = UnregisterClassA(cls_name, GetModuleHandleA(0));
-    ok(success, "UnregisterClass failed %u\n", GetLastError());
+    ok(success, "UnregisterClass failed %lu\n", GetLastError());
 }
 
 static void test_CoGetMalloc(void)
@@ -3186,32 +3186,32 @@ static void test_CoGetMalloc(void)
 
     imalloc = (void*)0xdeadbeef;
     hr = CoGetMalloc(0, &imalloc);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(imalloc == NULL, "got %p\n", imalloc);
 
     imalloc = (void*)0xdeadbeef;
     hr = CoGetMalloc(MEMCTX_SHARED, &imalloc);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(imalloc == NULL, "got %p\n", imalloc);
 
     imalloc = (void*)0xdeadbeef;
     hr = CoGetMalloc(MEMCTX_MACSYSTEM, &imalloc);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(imalloc == NULL, "got %p\n", imalloc);
 
     imalloc = (void*)0xdeadbeef;
     hr = CoGetMalloc(MEMCTX_UNKNOWN, &imalloc);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(imalloc == NULL, "got %p\n", imalloc);
 
     imalloc = (void*)0xdeadbeef;
     hr = CoGetMalloc(MEMCTX_SAME, &imalloc);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(imalloc == NULL, "got %p\n", imalloc);
 
     imalloc = NULL;
     hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(imalloc != NULL, "got %p\n", imalloc);
 
     /* DidAlloc() */
@@ -3255,31 +3255,31 @@ static void test_CoGetApartmentType(void)
     }
 
     hr = pCoGetApartmentType(NULL, NULL);
-    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
 
     type = 0xdeadbeef;
     hr = pCoGetApartmentType(&type, NULL);
-    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
     ok(type == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", type);
 
     qualifier = 0xdeadbeef;
     hr = pCoGetApartmentType(NULL, &qualifier);
-    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
     ok(qualifier == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", qualifier);
 
     type = 0xdeadbeef;
     qualifier = 0xdeadbeef;
     hr = pCoGetApartmentType(&type, &qualifier);
-    ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08x\n", hr);
+    ok(hr == CO_E_NOTINITIALIZED, "CoGetApartmentType succeeded, error: 0x%08lx\n", hr);
     ok(type == APTTYPE_CURRENT, "Expected APTTYPE_CURRENT, got %u\n", type);
     ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
 
     type = 0xdeadbeef;
     qualifier = 0xdeadbeef;
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
     hr = pCoGetApartmentType(&type, &qualifier);
-    ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
     ok(type == APTTYPE_MAINSTA, "Expected APTTYPE_MAINSTA, got %u\n", type);
     ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
     CoUninitialize();
@@ -3287,9 +3287,9 @@ static void test_CoGetApartmentType(void)
     type = 0xdeadbeef;
     qualifier = 0xdeadbeef;
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoInitializeEx failed, error: 0x%08lx\n", hr);
     hr = pCoGetApartmentType(&type, &qualifier);
-    ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08x\n", hr);
+    ok(hr == S_OK, "CoGetApartmentType failed, error: 0x%08lx\n", hr);
     ok(type == APTTYPE_MTA, "Expected APTTYPE_MTA, got %u\n", type);
     ok(qualifier == APTTYPEQUALIFIER_NONE, "Expected APTTYPEQUALIFIER_NONE, got %u\n", qualifier);
     CoUninitialize();
@@ -3413,23 +3413,23 @@ static void test_IMallocSpy(void)
     HRESULT hr;
 
     hr = CoRegisterMallocSpy(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = CoRevokeMallocSpy();
-    ok(hr == CO_E_OBJNOTREG, "got 0x%08x\n", hr);
+    ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
 
     hr = CoRegisterMallocSpy(&testspy);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CoRegisterMallocSpy(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = CoRegisterMallocSpy(&testspy);
-    ok(hr == CO_E_OBJISREG, "got 0x%08x\n", hr);
+    ok(hr == CO_E_OBJISREG, "got 0x%08lx\n", hr);
 
     imalloc = NULL;
     hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(imalloc != NULL, "got %p\n", imalloc);
 
     IMalloc_Free(imalloc, NULL);
@@ -3437,10 +3437,10 @@ static void test_IMallocSpy(void)
     IMalloc_Release(imalloc);
 
     hr = CoRevokeMallocSpy();
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CoRevokeMallocSpy();
-    ok(hr == CO_E_OBJNOTREG, "got 0x%08x\n", hr);
+    ok(hr == CO_E_OBJNOTREG, "got 0x%08lx\n", hr);
 }
 
 static void test_CoGetCurrentLogicalThreadId(void)
@@ -3449,11 +3449,11 @@ static void test_CoGetCurrentLogicalThreadId(void)
     GUID id;
 
     hr = CoGetCurrentLogicalThreadId(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     id = GUID_NULL;
     hr = CoGetCurrentLogicalThreadId(&id);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(!IsEqualGUID(&id, &GUID_NULL), "got null id\n");
 }
 
@@ -3487,14 +3487,14 @@ static BOOL revoke_spies_on_uninit;
 static HRESULT WINAPI testinitialize_PreInitialize(IInitializeSpy *iface, DWORD coinit, DWORD aptrefs)
 {
     CHECK_EXPECT2(PreInitialize);
-    ok(coinit == expected_coinit_flags, "Unexpected init flags %#x, expected %#x.\n", coinit, expected_coinit_flags);
+    ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
     return S_OK;
 }
 
 static HRESULT WINAPI testinitialize_PostInitialize(IInitializeSpy *iface, HRESULT hr, DWORD coinit, DWORD aptrefs)
 {
     CHECK_EXPECT2(PostInitialize);
-    ok(coinit == expected_coinit_flags, "Unexpected init flags %#x, expected %#x.\n", coinit, expected_coinit_flags);
+    ok(coinit == expected_coinit_flags, "Unexpected init flags %#lx, expected %#lx.\n", coinit, expected_coinit_flags);
     return hr;
 }
 
@@ -3505,13 +3505,13 @@ static HRESULT WINAPI testinitialize_PreUninitialize(IInitializeSpy *iface, DWOR
     if (revoke_spies_on_uninit)
     {
         hr = CoRevokeInitializeSpy(init_cookies[0]);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
 
         hr = CoRevokeInitializeSpy(init_cookies[1]);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
 
         hr = CoRevokeInitializeSpy(init_cookies[2]);
-        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(hr == S_OK, "got 0x%08lx\n", hr);
 
         revoke_spies_on_uninit = FALSE;
     }
@@ -3542,10 +3542,10 @@ static DWORD WINAPI test_init_spies_proc(void *arg)
     HRESULT hr;
 
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED | COINIT_DISABLE_OLE1DDE);
-    ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
 
     hr = CoRevokeInitializeSpy(init_cookies[2]);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     CoUninitialize();
     return 0;
@@ -3558,63 +3558,63 @@ static void test_IInitializeSpy(BOOL mt)
     if (mt)
     {
         hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-        ok(hr == S_OK, "CoInitializeEx failed: %#x\n", hr);
+        ok(hr == S_OK, "CoInitializeEx failed: %#lx\n", hr);
     }
 
     hr = CoRegisterInitializeSpy(NULL, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     init_cookies[0].QuadPart = 1;
     hr = CoRegisterInitializeSpy(NULL, &init_cookies[0]);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(init_cookies[0].QuadPart == 1, "got wrong cookie\n");
 
     hr = CoRegisterInitializeSpy(&testinitialize, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     init_cookies[0].HighPart = 0;
     init_cookies[0].LowPart = 1;
     hr = CoRegisterInitializeSpy(&testinitialize, &init_cookies[0]);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(init_cookies[0].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[0].HighPart,
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(init_cookies[0].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[0].HighPart,
         GetCurrentThreadId());
-    if (!mt) ok(init_cookies[0].LowPart == 0, "got wrong low part 0x%x\n", init_cookies[0].LowPart);
+    if (!mt) ok(init_cookies[0].LowPart == 0, "got wrong low part 0x%lx\n", init_cookies[0].LowPart);
 
     /* register same instance one more time */
     init_cookies[1].HighPart = 0;
     init_cookies[1].LowPart = 0;
     hr = CoRegisterInitializeSpy(&testinitialize, &init_cookies[1]);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[1].HighPart,
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
         GetCurrentThreadId());
-    if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%x\n", init_cookies[1].LowPart);
+    if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
 
     init_cookies[2].HighPart = 0;
     init_cookies[2].LowPart = 0;
     hr = CoRegisterInitializeSpy(&testinitialize, &init_cookies[2]);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(init_cookies[2].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[2].HighPart,
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(init_cookies[2].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[2].HighPart,
         GetCurrentThreadId());
-    if (!mt) ok(init_cookies[2].LowPart == 2, "got wrong low part 0x%x\n", init_cookies[2].LowPart);
+    if (!mt) ok(init_cookies[2].LowPart == 2, "got wrong low part 0x%lx\n", init_cookies[2].LowPart);
 
     hr = CoRevokeInitializeSpy(init_cookies[1]);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = CoRevokeInitializeSpy(init_cookies[1]);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     init_cookies[1].HighPart = 0;
     init_cookies[1].LowPart = 0;
     hr = CoRegisterInitializeSpy(&testinitialize, &init_cookies[1]);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08x, expected 0x%08x\n", init_cookies[1].HighPart,
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
+    ok(init_cookies[1].HighPart == GetCurrentThreadId(), "got high part 0x%08lx, expected 0x%08lx\n", init_cookies[1].HighPart,
         GetCurrentThreadId());
-    if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%x\n", init_cookies[1].LowPart);
+    if (!mt) ok(init_cookies[1].LowPart == 1, "got wrong low part 0x%lx\n", init_cookies[1].LowPart);
 
     SET_EXPECT(PreInitialize);
     SET_EXPECT(PostInitialize);
     hr = CoInitializeEx(NULL, expected_coinit_flags = ((mt ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED) | COINIT_DISABLE_OLE1DDE));
-    ok(hr == (mt ? S_FALSE : S_OK), "Failed to initialize COM, hr %#x.\n", hr);
+    ok(hr == (mt ? S_FALSE : S_OK), "Failed to initialize COM, hr %#lx.\n", hr);
     CHECK_CALLED(PreInitialize, 3);
     CHECK_CALLED(PostInitialize, 3);
 
@@ -3622,14 +3622,14 @@ static void test_IInitializeSpy(BOOL mt)
     {
         HANDLE thread;
         thread = CreateThread(NULL, 0, test_init_spies_proc, NULL, 0, NULL);
-        ok(thread != NULL, "CreateThread failed: %u\n", GetLastError());
+        ok(thread != NULL, "CreateThread failed: %lu\n", GetLastError());
         ok(!WaitForSingleObject(thread, 1000), "wait failed\n");
     }
 
     SET_EXPECT(PreInitialize);
     SET_EXPECT(PostInitialize);
     hr = CoInitializeEx(NULL, expected_coinit_flags = ((mt ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED) | COINIT_DISABLE_OLE1DDE));
-    ok(hr == S_FALSE, "Failed to initialize COM, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to initialize COM, hr %#lx.\n", hr);
     CHECK_CALLED(PreInitialize, 3);
     CHECK_CALLED(PostInitialize, 3);
 
@@ -3657,7 +3657,7 @@ static void test_IInitializeSpy(BOOL mt)
     SET_EXPECT(PreInitialize);
     SET_EXPECT(PostInitialize);
     hr = CoInitializeEx(NULL, expected_coinit_flags = ((mt ? COINIT_MULTITHREADED : COINIT_APARTMENTTHREADED) | COINIT_DISABLE_OLE1DDE));
-    ok(hr == S_OK, "Failed to initialize COM, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to initialize COM, hr %#lx.\n", hr);
     CHECK_CALLED(PreInitialize, 3);
     CHECK_CALLED(PostInitialize, 3);
 
@@ -3810,7 +3810,7 @@ static void test_CoGetInstanceFromFile(void)
     HRESULT hr;
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     /* CLSID is not specified, file does not exist */
     mqi[0].pIID = &IID_IUnknown;
@@ -3818,66 +3818,66 @@ static void test_CoGetInstanceFromFile(void)
     mqi[0].hr = E_NOTIMPL;
     hr = CoGetInstanceFromFile(NULL, NULL, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
     todo_wine
-    ok(hr == MK_E_CANTOPENFILE, "got 0x%08x\n", hr);
+    ok(hr == MK_E_CANTOPENFILE, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == E_NOINTERFACE, "got 0x%08lx\n", mqi[0].hr);
 
     /* class is not available */
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = NULL;
     mqi[0].hr = E_NOTIMPL;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
-    ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == REGDB_E_CLASSNOTREG, "got 0x%08lx\n", mqi[0].hr);
 
     hr = CoRegisterClassObject(clsid, (IUnknown*)&getinstance_cf, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE,
         &cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = (void*)0xdeadbeef;
     mqi[0].hr = S_OK;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
 todo_wine {
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
 }
-    ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
 
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = (void*)0xdeadbeef;
     mqi[0].hr = E_NOTIMPL;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
 todo_wine {
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == (void*)0xdeadbeef, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == E_NOTIMPL, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == E_NOTIMPL, "got 0x%08lx\n", mqi[0].hr);
 }
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = NULL;
     mqi[0].hr = E_NOTIMPL;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
 
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = NULL;
     mqi[0].hr = S_OK;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
 
     mqi[0].pIID = &IID_IUnknown;
     mqi[0].pItf = NULL;
     mqi[0].hr = S_OK;
     g_persistfile_qi_ret = S_FALSE;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 1, mqi);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf != NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == S_OK, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == S_OK, "got 0x%08lx\n", mqi[0].hr);
     g_persistfile_qi_ret = S_OK;
 
     mqi[0].pIID = &IID_IUnknown;
@@ -3888,11 +3888,11 @@ todo_wine {
     mqi[1].hr = S_OK;
     g_persistfile_qi_ret = 0x8000efef;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
-    ok(hr == 0x8000efef, "got 0x%08x\n", hr);
+    ok(hr == 0x8000efef, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == 0x8000efef, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == 0x8000efef, "got 0x%08lx\n", mqi[0].hr);
     ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
-    ok(mqi[1].hr == 0x8000efef, "got 0x%08x\n", mqi[1].hr);
+    ok(mqi[1].hr == 0x8000efef, "got 0x%08lx\n", mqi[1].hr);
     g_persistfile_qi_ret = S_OK;
 
     mqi[0].pIID = &IID_IUnknown;
@@ -3903,15 +3903,15 @@ todo_wine {
     mqi[1].hr = S_OK;
     g_persistfile_load_ret = 0x8000fefe;
     hr = CoGetInstanceFromFile(NULL, clsid, NULL, CLSCTX_INPROC_SERVER, STGM_READ, (OLECHAR*)filenameW, 2, mqi);
-    ok(hr == 0x8000fefe, "got 0x%08x\n", hr);
+    ok(hr == 0x8000fefe, "got 0x%08lx\n", hr);
     ok(mqi[0].pItf == NULL, "got %p\n", mqi[0].pItf);
-    ok(mqi[0].hr == 0x8000fefe, "got 0x%08x\n", mqi[0].hr);
+    ok(mqi[0].hr == 0x8000fefe, "got 0x%08lx\n", mqi[0].hr);
     ok(mqi[1].pItf == NULL, "got %p\n", mqi[1].pItf);
-    ok(mqi[1].hr == 0x8000fefe, "got 0x%08x\n", mqi[1].hr);
+    ok(mqi[1].hr == 0x8000fefe, "got 0x%08lx\n", mqi[1].hr);
     g_persistfile_load_ret = S_OK;
 
     hr = CoRevokeClassObject(cookie);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     CoUninitialize();
 }
@@ -3926,7 +3926,7 @@ static void test_GlobalOptions(void)
 
     hres = CoCreateInstance(&CLSID_GlobalOptions, NULL, CLSCTX_INPROC_SERVER,
             &IID_IGlobalOptions, (void**)&global_options);
-    ok(hres == S_OK || broken(hres == E_NOINTERFACE), "CoCreateInstance(CLSID_GlobalOptions) failed: %08x\n", hres);
+    ok(hres == S_OK || broken(hres == E_NOINTERFACE), "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
     if(FAILED(hres))
     {
         win_skip("CLSID_GlobalOptions not available\n");
@@ -3935,22 +3935,22 @@ static void test_GlobalOptions(void)
     }
 
     hres = IGlobalOptions_Query(global_options, 0, &value);
-    ok(FAILED(hres), "Unexpected hr %#x.\n", hres);
+    ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
 
     hres = IGlobalOptions_Query(global_options, COMGLB_PROPERTIES_RESERVED3 + 1, &value);
-    ok(FAILED(hres), "Unexpected hr %#x.\n", hres);
+    ok(FAILED(hres), "Unexpected hr %#lx.\n", hres);
 
     value = ~0u;
     hres = IGlobalOptions_Query(global_options, COMGLB_EXCEPTION_HANDLING, &value);
-    ok(hres == S_OK || broken(hres == E_FAIL) /* Vista */, "Unexpected hr %#x.\n", hres);
+    ok(hres == S_OK || broken(hres == E_FAIL) /* Vista */, "Unexpected hr %#lx.\n", hres);
     if (SUCCEEDED(hres))
-        ok(value == COMGLB_EXCEPTION_HANDLE, "Unexpected value %ld.\n", value);
+        ok(value == COMGLB_EXCEPTION_HANDLE, "Unexpected value %Id.\n", value);
 
     IGlobalOptions_Release(global_options);
 
     hres = CoCreateInstance(&CLSID_GlobalOptions, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
             &IID_IGlobalOptions, (void**)&global_options);
-    ok(hres == E_INVALIDARG, "CoCreateInstance(CLSID_GlobalOptions) failed: %08x\n", hres);
+    ok(hres == E_INVALIDARG, "CoCreateInstance(CLSID_GlobalOptions) failed: %08lx\n", hres);
 
     CoUninitialize();
 }
@@ -4014,7 +4014,7 @@ static DWORD CALLBACK implicit_mta_proc(void *param)
     ok_ole_success(hr, "CoRevokeClassObject");
 
     hr = CoRegisterMessageFilter(NULL, NULL);
-    ok(hr == CO_E_NOT_SUPPORTED, "got %#x\n", hr);
+    ok(hr == CO_E_NOT_SUPPORTED, "got %#lx\n", hr);
 
     hr = CoLockObjectExternal(&Test_Unknown, TRUE, TRUE);
     ok_ole_success(hr, "CoLockObjectExternal");
@@ -4053,7 +4053,7 @@ static void test_CoGetCurrentProcess(void)
     HANDLE thread;
 
     id = CoGetCurrentProcess();
-    ok(!!id && id != GetCurrentProcessId() && id != GetCurrentThreadId(), "Unexpected result %d.\n", id);
+    ok(!!id && id != GetCurrentProcessId() && id != GetCurrentThreadId(), "Unexpected result %ld.\n", id);
 
     id2 = 0;
     thread = CreateThread(NULL, 0, co_get_current_process_thread, &id2, 0, NULL);
@@ -4079,40 +4079,40 @@ static void test_mta_usage(void)
 
     cookie = 0;
     hr = pCoIncrementMTAUsage(&cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
 
     cookie2 = 0;
     hr = pCoIncrementMTAUsage(&cookie2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(cookie2 != NULL && cookie2 != cookie, "Unexpected cookie %p.\n", cookie2);
 
     test_apt_type(APTTYPE_MTA, APTTYPEQUALIFIER_IMPLICIT_MTA);
 
     hr = pCoDecrementMTAUsage(cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     test_apt_type(APTTYPE_MTA, APTTYPEQUALIFIER_IMPLICIT_MTA);
 
     hr = pCoDecrementMTAUsage(cookie2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE);
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     test_apt_type(APTTYPE_MAINSTA, APTTYPEQUALIFIER_NONE);
 
     cookie = 0;
     hr = pCoIncrementMTAUsage(&cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(cookie != NULL, "Unexpected cookie %p.\n", cookie);
 
     test_apt_type(APTTYPE_MAINSTA, APTTYPEQUALIFIER_NONE);
 
     hr = pCoDecrementMTAUsage(cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     CoUninitialize();
 
@@ -4152,11 +4152,11 @@ static void test_CoCreateInstanceFromApp(void)
         memset(&mqi, 0, sizeof(mqi));
         mqi.pIID = &IID_IUnknown;
         hr = pCoCreateInstanceFromApp(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         IUnknown_Release(mqi.pItf);
 
         hr = CoCreateInstance(supported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         IUnknown_Release(unk);
     }
 
@@ -4165,54 +4165,54 @@ static void test_CoCreateInstanceFromApp(void)
         memset(&mqi, 0, sizeof(mqi));
         mqi.pIID = &IID_IUnknown;
         hr = pCoCreateInstanceFromApp(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
-        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
         hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
                 &IID_IUnknown, (void **)&unk);
-        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+        ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
         hr = CoCreateInstance(unsupported_classes[i], NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         IUnknown_Release(unk);
     }
 
     /* Locally registered classes are filtered out. */
     hr = CoRegisterClassObject(&CLSID_WineOOPTest, (IUnknown *)&Test_ClassFactory, CLSCTX_INPROC_SERVER,
             REGCLS_MULTIPLEUSE, &cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&unk);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER, NULL,
             &IID_IClassFactory, (void **)&unk);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
-    ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
 
     hr = CoCreateInstance(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
             &IID_IUnknown, (void **)&unk);
-    ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
     memset(&mqi, 0, sizeof(mqi));
     mqi.pIID = &IID_IUnknown;
     hr = pCoCreateInstanceFromApp(&CLSID_WineOOPTest, NULL, CLSCTX_INPROC_SERVER, NULL, 1, &mqi);
-    ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#x.\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "Unexpected hr %#lx.\n", hr);
 
     hr = CoRevokeClassObject(cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     /* Activation context */
     if ((handle = activate_context(actctx_manifest, &actctx_cookie)))
     {
         hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
-        ok(hr == 0x80001235, "Unexpected hr %#x.\n", hr);
+        ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
 
         hr = CoCreateInstance(&IID_Testiface7, NULL, CLSCTX_INPROC_SERVER | CLSCTX_APPCONTAINER,
                 &IID_IUnknown, (void **)&unk);
-        ok(hr == 0x80001235, "Unexpected hr %#x.\n", hr);
+        ok(hr == 0x80001235, "Unexpected hr %#lx.\n", hr);
 
         deactivate_context(handle, actctx_cookie);
     }
@@ -4226,56 +4226,56 @@ static void test_call_cancellation(void)
 
     /* Cancellation is disabled initially. */
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
 
     hr = CoEnableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
 
     hr = CoEnableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     /* Counter is not affected by initialization. */
     hr = CoInitialize(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
 
     hr = CoEnableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     CoUninitialize();
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
 
     /* It's cumulative. */
     hr = CoEnableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoEnableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CoDisableCallCancellation(NULL);
-    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_CANCEL_DISABLED, "Unexpected hr %#lx.\n", hr);
 }
 
 enum oletlsflags
@@ -4307,12 +4307,12 @@ static DWORD CALLBACK oletlsdata_test_thread(void *arg)
     HRESULT hr;
 
     hr = CoCreateInstance(&CLSID_InternetZoneManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&unk);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IUnknown_Release(unk);
 
     /* Flag is not set for implicit MTA. */
     flags = get_oletlsflags();
-    ok(!(flags & OLETLS_MULTITHREADED), "Unexpected flags %#x.\n", flags);
+    ok(!(flags & OLETLS_MULTITHREADED), "Unexpected flags %#lx.\n", flags);
 
     return 0;
 }
@@ -4326,47 +4326,47 @@ static void test_oletlsdata(void)
 
     /* STA */
     hr = CoInitialize(NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     flags = get_oletlsflags();
-    ok(flags & OLETLS_APARTMENTTHREADED && !(flags & OLETLS_DISABLE_OLE1DDE), "Unexpected flags %#x.\n", flags);
+    ok(flags & OLETLS_APARTMENTTHREADED && !(flags & OLETLS_DISABLE_OLE1DDE), "Unexpected flags %#lx.\n", flags);
     CoUninitialize();
     flags = get_oletlsflags();
-    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#x.\n", flags);
+    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
 
     hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     flags = get_oletlsflags();
-    ok(flags & OLETLS_APARTMENTTHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#x.\n", flags);
+    ok(flags & OLETLS_APARTMENTTHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
     CoUninitialize();
     flags = get_oletlsflags();
-    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#x.\n", flags);
+    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
 
     /* MTA */
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     flags = get_oletlsflags();
-    ok(flags & OLETLS_MULTITHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#x.\n", flags);
+    ok(flags & OLETLS_MULTITHREADED && flags & OLETLS_DISABLE_OLE1DDE, "Unexpected flags %#lx.\n", flags);
 
     /* Implicit case. */
     thread = CreateThread(NULL, 0, oletlsdata_test_thread, NULL, 0, &flags);
-    ok(thread != NULL, "Failed to create a test thread, error %d.\n", GetLastError());
+    ok(thread != NULL, "Failed to create a test thread, error %ld.\n", GetLastError());
     ok(!WaitForSingleObject(thread, 5000), "Wait timed out.\n");
     CloseHandle(thread);
 
     CoUninitialize();
     flags = get_oletlsflags();
-    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#x.\n", flags);
+    ok(!(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED | OLETLS_DISABLE_OLE1DDE)), "Unexpected flags %#lx.\n", flags);
 
     /* Thread ID. */
     flags = get_oletlsflags();
-    ok(!(flags & OLETLS_UUIDINITIALIZED), "Unexpected flags %#x.\n", flags);
+    ok(!(flags & OLETLS_UUIDINITIALIZED), "Unexpected flags %#lx.\n", flags);
 
     hr = CoGetCurrentLogicalThreadId(&guid);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     flags = get_oletlsflags();
     ok(flags & OLETLS_UUIDINITIALIZED && !(flags & (OLETLS_APARTMENTTHREADED | OLETLS_MULTITHREADED)),
-            "Unexpected flags %#x.\n", flags);
+            "Unexpected flags %#lx.\n", flags);
 }
 
 START_TEST(compobj)
diff --git a/dlls/ole32/tests/defaulthandler.c b/dlls/ole32/tests/defaulthandler.c
index 83851102ef2..45118295c81 100644
--- a/dlls/ole32/tests/defaulthandler.c
+++ b/dlls/ole32/tests/defaulthandler.c
@@ -101,30 +101,30 @@ static void test_olestream(void)
     ole_stream_header_t header;
 
     hr = create_storage(&stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm);
-    ok(hr == STG_E_FILENOTFOUND, "got %08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "got %08lx\n", hr);
 
     hr = OleCreateDefaultHandler(&non_existent_class, 0, &IID_IOleObject, (void**)&ole_obj);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = IOleObject_QueryInterface(ole_obj, &IID_IPersistStorage, (void**)&persist);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_InitNew(persist, stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     hr = IStream_Read(stm, &header, sizeof(header), &read);
-    ok(hr == S_OK, "got %08x\n", hr);
-    ok(read == sizeof(header), "read %d\n", read);
-    ok(header.version == 0x02000001, "got version %08x\n", header.version);
-    ok(header.flags == 0x0, "got flags %08x\n", header.flags);
-    ok(header.link_update_opt == 0x0, "got link update option %08x\n", header.link_update_opt);
-    ok(header.res == 0x0, "got reserved %08x\n", header.res);
-    ok(header.moniker_size == 0x0, "got moniker size %08x\n", header.moniker_size);
+    ok(hr == S_OK, "got %08lx\n", hr);
+    ok(read == sizeof(header), "read %ld\n", read);
+    ok(header.version == 0x02000001, "got version %08lx\n", header.version);
+    ok(header.flags == 0x0, "got flags %08lx\n", header.flags);
+    ok(header.link_update_opt == 0x0, "got link update option %08lx\n", header.link_update_opt);
+    ok(header.res == 0x0, "got reserved %08lx\n", header.res);
+    ok(header.moniker_size == 0x0, "got moniker size %08lx\n", header.moniker_size);
 
     IStream_Release(stm);
 
@@ -247,17 +247,17 @@ static void test_default_handler_run(void)
 
     hres = CoRegisterClassObject(&test_server_clsid, (IUnknown*)&ClassFactory,
             CLSCTX_INPROC_SERVER, 0, &class_reg);
-    ok(hres == S_OK, "CoRegisterClassObject failed: %x\n", hres);
+    ok(hres == S_OK, "CoRegisterClassObject failed: %lx\n", hres);
 
     hres = OleCreateDefaultHandler(&test_server_clsid, NULL, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "OleCreateDefaultHandler failed: %x\n", hres);
+    ok(hres == S_OK, "OleCreateDefaultHandler failed: %lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&ro);
-    ok(hres == S_OK, "QueryInterface(IRunnableObject) failed: %x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IRunnableObject) failed: %lx\n", hres);
     IUnknown_Release(unk);
 
     hres = IRunnableObject_Run(ro, NULL);
-    ok(hres == REGDB_E_CLASSNOTREG, "Run returned: %x, expected REGDB_E_CLASSNOTREG\n", hres);
+    ok(hres == REGDB_E_CLASSNOTREG, "Run returned: %lx, expected REGDB_E_CLASSNOTREG\n", hres);
     IRunnableObject_Release(ro);
 
     SET_EXPECT(CF_QueryInterface_IMarshal);
@@ -266,28 +266,28 @@ static void test_default_handler_run(void)
 
     hres = CoRegisterClassObject(&test_server_clsid, (IUnknown*)&ClassFactory,
             CLSCTX_LOCAL_SERVER, 0, &class_reg);
-    ok(hres == S_OK, "CoRegisterClassObject failed: %x\n", hres);
+    ok(hres == S_OK, "CoRegisterClassObject failed: %lx\n", hres);
 
     hres = OleCreateDefaultHandler(&test_server_clsid, NULL, &IID_IUnknown, (void**)&unk);
-    ok(hres == S_OK, "OleCreateDefaultHandler failed: %x\n", hres);
+    ok(hres == S_OK, "OleCreateDefaultHandler failed: %lx\n", hres);
 
     hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
-    ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %lx\n", hres);
 
     hres = IOleObject_QueryInterface(oleobj, &IID_IPersistStorage, (void**)&persist);
-    ok(hres == S_OK, "QueryInterface(IID_IPersistStorage) failed: %x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IID_IPersistStorage) failed: %lx\n", hres);
     IPersistStorage_Release(persist);
     IOleObject_Release(oleobj);
 
     hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&ro);
-    ok(hres == S_OK, "QueryInterface(IRunnableObject) failed: %x\n", hres);
+    ok(hres == S_OK, "QueryInterface(IRunnableObject) failed: %lx\n", hres);
     IUnknown_Release(unk);
 
     SET_EXPECT(CF_QueryInterface_ClassFactory);
     SET_EXPECT(CF_CreateInstance);
     hres = IRunnableObject_Run(ro, NULL);
     todo_wine
-    ok(hres == S_OK, "Run failed: %x\n", hres);
+    ok(hres == S_OK, "Run failed: %lx\n", hres);
     CHECK_CALLED(CF_QueryInterface_ClassFactory);
     CHECK_CALLED(CF_CreateInstance);
     IRunnableObject_Release(ro);
@@ -297,7 +297,7 @@ static void test_default_handler_run(void)
     hres = CoCreateInstance(&test_server_clsid, NULL, CLSCTX_LOCAL_SERVER,
                             &IID_IOleObject, (void**)&oleobj);
     todo_wine
-    ok(hres == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %x\n", hres);
+    ok(hres == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %lx\n", hres);
     todo_wine
     CHECK_NOT_CALLED(CF_QueryInterface_ClassFactory);
     todo_wine
diff --git a/dlls/ole32/tests/dragdrop.c b/dlls/ole32/tests/dragdrop.c
index 62ac15d8fc7..cc24efdcbd2 100644
--- a/dlls/ole32/tests/dragdrop.c
+++ b/dlls/ole32/tests/dragdrop.c
@@ -89,7 +89,7 @@ static HRESULT check_expect_(enum method func, DWORD expect_param, DWORD *set_pa
         if (call_ptr->method == func) break;
     } while ((++call_ptr)->method != end_seq);
 
-    ok_( file, line )( expect_param == call_ptr->expect_param, "%s: unexpected param %08x expected %08x\n",
+    ok_( file, line )( expect_param == call_ptr->expect_param, "%s: unexpected param %08lx expected %08lx\n",
                        method_names[func], expect_param, call_ptr->expect_param );
     if (set_param) *set_param = call_ptr->set_param;
     hr = call_ptr->set_ret;
@@ -263,7 +263,7 @@ static int droptarget_refs;
 static int test_reentrance;
 
 /* helper macros to make tests a bit leaner */
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
 static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget* iface, REFIID riid,
                                                 void** ppvObject)
@@ -430,7 +430,7 @@ static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface,
     static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
     HRESULT hr = check_expect(EnumFMT_Next, 0, NULL);
 
-    ok(celt == 1, "celt = %d\n", celt);
+    ok(celt == 1, "celt = %ld\n", celt);
     ok(rgelt != NULL, "rgelt == NULL\n");
     ok(pceltFetched == NULL, "pceltFetched != NULL\n");
 
@@ -624,18 +624,18 @@ static void test_Register_Revoke(void)
     hr = RegisterDragDrop(hwnd, &DropTarget);
     ok(hr == E_OUTOFMEMORY ||
         broken(hr == CO_E_NOTINITIALIZED), /* NT4 */
-        "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr);
+        "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08lx\n", hr);
 
     OleInitialize(NULL);
 
     hr = RegisterDragDrop(hwnd, NULL);
-    ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = RegisterDragDrop(NULL, &DropTarget);
-    ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
+    ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
 
     hr = RegisterDragDrop((HWND)0xdeadbeef, &DropTarget);
-    ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
+    ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
 
     ok(droptarget_refs == 0, "DropTarget refs should be zero not %d\n", droptarget_refs);
     hr = RegisterDragDrop(hwnd, &DropTarget);
@@ -646,7 +646,7 @@ static void test_Register_Revoke(void)
     ok(prop == &DropTarget, "expected IDropTarget pointer %p, got %p\n", &DropTarget, prop);
 
     hr = RegisterDragDrop(hwnd, &DropTarget);
-    ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08x\n", hr);
+    ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08lx\n", hr);
 
     ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
     OleUninitialize();
@@ -662,7 +662,7 @@ static void test_Register_Revoke(void)
     }
 
     hr = RevokeDragDrop(NULL);
-    ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
+    ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
 
     DestroyWindow(hwnd);
 
@@ -674,12 +674,12 @@ static void test_Register_Revoke(void)
         NULL, NULL, NULL);
 
     hr = RegisterDragDrop(hwnd, &DropTarget);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     DestroyWindow(hwnd);
 
     hr = RevokeDragDrop(hwnd);
-    ok(hr == DRAGDROP_E_INVALIDHWND, "got 0x%08x\n", hr);
+    ok(hr == DRAGDROP_E_INVALIDHWND, "got 0x%08lx\n", hr);
 
     OleUninitialize();
 }
@@ -698,32 +698,32 @@ static void test_DoDragDrop(void)
     ok(IsWindow(hwnd), "failed to create window\n");
 
     hr = OleInitialize(NULL);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = RegisterDragDrop(hwnd, &DropTarget);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     /* incomplete arguments set */
     hr = DoDragDrop(NULL, NULL, 0, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(NULL, &DropSource, 0, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(&DataObject, NULL, 0, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(NULL, NULL, 0, &effect);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(&DataObject, &DropSource, 0, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(NULL, &DropSource, 0, &effect);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = DoDragDrop(&DataObject, NULL, 0, &effect);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     ShowWindow(hwnd, SW_SHOW);
     GetWindowRect(hwnd, &rect);
diff --git a/dlls/ole32/tests/errorinfo.c b/dlls/ole32/tests/errorinfo.c
index bb350aea73d..f0e7cf02648 100644
--- a/dlls/ole32/tests/errorinfo.c
+++ b/dlls/ole32/tests/errorinfo.c
@@ -29,7 +29,7 @@
 
 #include "wine/test.h"
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
 static const CLSID CLSID_WineTest =
 { /* 9474ba1a-258b-490b-bc13-516e9239ace0 */
@@ -101,17 +101,17 @@ static void test_error_info(void)
     IErrorInfo_Release(pErrorInfo);
 
     hr = GetErrorInfo(0, &pErrorInfo);
-    ok(hr == S_FALSE, "GetErrorInfo should have returned S_FALSE instead of 0x%08x\n", hr);
+    ok(hr == S_FALSE, "GetErrorInfo should have returned S_FALSE instead of 0x%08lx\n", hr);
     ok(!pErrorInfo, "pErrorInfo should be set to NULL\n");
 
     hr = SetErrorInfo(0, NULL);
     ok_ole_success(hr, "SetErrorInfo");
 
     hr = GetErrorInfo(0xdeadbeef, &pErrorInfo);
-    ok(hr == E_INVALIDARG, "GetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "GetErrorInfo should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = SetErrorInfo(0xdeadbeef, NULL);
-    ok(hr == E_INVALIDARG, "SetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "SetErrorInfo should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 }
 
 START_TEST(errorinfo)
diff --git a/dlls/ole32/tests/hglobalstream.c b/dlls/ole32/tests/hglobalstream.c
index 5bcf9abfbda..237bcca9251 100644
--- a/dlls/ole32/tests/hglobalstream.c
+++ b/dlls/ole32/tests/hglobalstream.c
@@ -29,7 +29,7 @@
 
 #include "wine/test.h"
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
 static char const * const *expected_method_list;
 
@@ -56,7 +56,7 @@ static void test_streamonhglobal(void)
     HRESULT hr;
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
 
     ull.QuadPart = sizeof(data);
     hr = IStream_SetSize(pStream, ull);
@@ -72,7 +72,7 @@ static void test_streamonhglobal(void)
     /* should return S_OK, not S_FALSE */
     hr = IStream_Read(pStream, buffer, sizeof(buffer), &read);
     ok_ole_success(hr, "IStream_Read");
-    ok(read == sizeof(data), "IStream_Read returned read %d\n", read);
+    ok(read == sizeof(data), "IStream_Read returned read %ld\n", read);
 
     /* ignores HighPart */
     ull.u.HighPart = -1;
@@ -93,8 +93,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- invalid seek argument */
     ull.u.HighPart = 0xCAFECAFE;
@@ -102,9 +102,9 @@ static void test_streamonhglobal(void)
     ll.u.HighPart = 0;
     ll.u.LowPart = 123;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_END+1, &ull);
-    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should not have changed HighPart, got %d\n", ull.u.HighPart);
+    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08lx\n", hr);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should not have changed HighPart, got %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid position argument (seek to beginning) */
     ull.u.HighPart = 0xCAFECAFE;
@@ -113,8 +113,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid position argument (seek to end) */
     ull.u.HighPart = 0xCAFECAFE;
@@ -123,8 +123,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_END, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- ignore HighPart in the move value (seek from current position) */
     ll.u.HighPart = 0;
@@ -138,8 +138,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- ignore HighPart in the move value (seek to beginning) */
     ll.u.HighPart = 0;
@@ -153,8 +153,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0, "should have set LowPart to 0 instead of %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- invalid LowPart value (seek before start of stream) */
     ll.u.HighPart = 0;
@@ -167,9 +167,9 @@ static void test_streamonhglobal(void)
     ll.u.HighPart = 0;
     ll.u.LowPart = 0x80000000;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
-    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08lx\n", hr);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid LowPart value (seek to start of stream) */
     ll.u.HighPart = 0;
@@ -183,8 +183,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = -(DWORD)sizeof(data);
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0, "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0, "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- invalid LowPart value (seek to start of stream-1) */
     ll.u.HighPart = 0;
@@ -197,9 +197,9 @@ static void test_streamonhglobal(void)
     ll.u.HighPart = 0;
     ll.u.LowPart = -(DWORD)sizeof(data)-1;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
-    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08lx\n", hr);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid LowPart value (seek forward to 0x80000000) */
     ll.u.HighPart = 0;
@@ -213,8 +213,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0x80000000 - sizeof(data);
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0x80000000, "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0x80000000, "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- invalid LowPart value (seek to beginning) */
     ll.u.HighPart = 0;
@@ -227,9 +227,9 @@ static void test_streamonhglobal(void)
     ll.u.HighPart = 0;
     ll.u.LowPart = 0x80000000;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
-    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08x\n", hr);
-    ok(ull.u.LowPart == sizeof(data), "LowPart set to %d\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(hr == STG_E_SEEKERROR, "IStream_Seek should have returned STG_E_SEEKERROR instead of 0x%08lx\n", hr);
+    ok(ull.u.LowPart == sizeof(data), "LowPart set to %ld\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid LowPart value (seek to beginning) */
     ull.u.HighPart = 0xCAFECAFE;
@@ -238,8 +238,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0x7FFFFFFF;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_SET, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08lx\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- valid LowPart value (seek from current position) */
     ll.u.HighPart = 0;
@@ -253,8 +253,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 0x7FFFFFFF;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08x\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0x7FFFFFFF, "should have set LowPart to 0x7FFFFFFF instead of %08lx\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- second seek allows you to go past 0x7FFFFFFF size */
     ull.u.HighPart = 0xCAFECAFE;
@@ -263,8 +263,8 @@ static void test_streamonhglobal(void)
     ll.u.LowPart = 9;
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok_ole_success(hr, "IStream_Seek");
-    ok(ull.u.LowPart == 0x80000008, "should have set LowPart to 0x80000008 instead of %08x\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+    ok(ull.u.LowPart == 0x80000008, "should have set LowPart to 0x80000008 instead of %08lx\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     /* IStream_Seek -- seek wraps position/size on integer overflow, but not on win8 */
     ull.u.HighPart = 0xCAFECAFE;
@@ -274,10 +274,10 @@ static void test_streamonhglobal(void)
     hr = IStream_Seek(pStream, ll, STREAM_SEEK_CUR, &ull);
     ok(hr == S_OK || hr == STG_E_SEEKERROR /* win8 */, "IStream_Seek\n");
     if (SUCCEEDED(hr))
-        ok(ull.u.LowPart == 0x00000007, "should have set LowPart to 0x00000007 instead of %08x\n", ull.u.LowPart);
+        ok(ull.u.LowPart == 0x00000007, "should have set LowPart to 0x00000007 instead of %08lx\n", ull.u.LowPart);
     else
-        ok(ull.u.LowPart == 0x80000008, "should have set LowPart to 0x80000008 instead of %08x\n", ull.u.LowPart);
-    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %d\n", ull.u.HighPart);
+        ok(ull.u.LowPart == 0x80000008, "should have set LowPart to 0x80000008 instead of %08lx\n", ull.u.LowPart);
+    ok(ull.u.HighPart == 0, "should have set HighPart to 0 instead of %ld\n", ull.u.HighPart);
 
     hr = IStream_Commit(pStream, STGC_DEFAULT);
     ok_ole_success(hr, "IStream_Commit");
@@ -286,18 +286,18 @@ static void test_streamonhglobal(void)
     ok_ole_success(hr, "IStream_Revert");
 
     hr = IStream_LockRegion(pStream, ull, ull, LOCK_WRITE);
-    ok(hr == STG_E_INVALIDFUNCTION, "IStream_LockRegion should have returned STG_E_INVALIDFUNCTION instead of 0x%08x\n", hr);
+    ok(hr == STG_E_INVALIDFUNCTION, "IStream_LockRegion should have returned STG_E_INVALIDFUNCTION instead of 0x%08lx\n", hr);
 
     hr = IStream_Stat(pStream, &statstg, STATFLAG_DEFAULT);
     ok_ole_success(hr, "IStream_Stat");
-    ok(statstg.type == STGTY_STREAM, "statstg.type should have been STGTY_STREAM instead of %d\n", statstg.type);
+    ok(statstg.type == STGTY_STREAM, "statstg.type should have been STGTY_STREAM instead of %ld\n", statstg.type);
 
     /* test OOM condition */
     ull.u.HighPart = -1;
     ull.u.LowPart = -1;
     hr = IStream_SetSize(pStream, ull);
     ok(hr == E_OUTOFMEMORY || broken(hr == S_OK), /* win9x */
-       "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr);
+       "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08lx\n", hr);
 
     IStream_Release(pStream);
 }
@@ -437,15 +437,15 @@ static void test_copyto(void)
 
     hr = IStream_Write(pStream, szHello, sizeof(szHello), &written);
     ok_ole_success(hr, "IStream_Write");
-    ok(written == sizeof(szHello), "only %d bytes written\n", written);
+    ok(written == sizeof(szHello), "only %ld bytes written\n", written);
 
     hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
     ok_ole_success(hr, "IStream_Seek");
 
     cb.QuadPart = sizeof(szHello);
     hr = IStream_CopyTo(pStream, &Test_Stream, cb, &ullRead, &ullWritten);
-    ok(ullWritten.QuadPart == 5, "ullWritten was %d instead\n", (ULONG)ullWritten.QuadPart);
-    ok(ullRead.QuadPart == sizeof(szHello), "only %d bytes read\n", (ULONG)ullRead.QuadPart);
+    ok(ullWritten.QuadPart == 5, "ullWritten was %ld instead\n", (ULONG)ullWritten.QuadPart);
+    ok(ullRead.QuadPart == sizeof(szHello), "only %ld bytes read\n", (ULONG)ullRead.QuadPart);
     ok_ole_success(hr, "IStream_CopyTo");
 
     ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
@@ -480,7 +480,7 @@ static void test_freed_hglobal(void)
     ULONG read, written;
 
     hglobal = GlobalAlloc(GMEM_DDESHARE|GMEM_NODISCARD|GMEM_MOVEABLE, strlen(teststring) + 1);
-    ok(hglobal != NULL, "GlobalAlloc failed with error %d\n", GetLastError());
+    ok(hglobal != NULL, "GlobalAlloc failed with error %ld\n", GetLastError());
     p = GlobalLock(hglobal);
     strcpy(p, teststring);
     GlobalUnlock(hglobal);
@@ -493,7 +493,7 @@ static void test_freed_hglobal(void)
     ok(!strcmp(buffer, teststring), "buffer data %s differs\n", buffer);
     ok(read == sizeof(teststring) ||
        broken(read == ((sizeof(teststring) + 3) & ~3)), /* win9x rounds the size */
-       "read should be sizeof(teststring) instead of %d\n", read);
+       "read should be sizeof(teststring) instead of %ld\n", read);
 
     GlobalFree(hglobal);
 
@@ -502,15 +502,15 @@ static void test_freed_hglobal(void)
     hr = IStream_Read(pStream, buffer, sizeof(buffer), &read);
     ok_ole_success(hr, "IStream_Read");
     ok(buffer[0] == 0, "buffer data should be untouched\n");
-    ok(read == 0, "read should be 0 instead of %d\n", read);
+    ok(read == 0, "read should be 0 instead of %ld\n", read);
 
     ull.QuadPart = sizeof(buffer);
     hr = IStream_SetSize(pStream, ull);
-    ok(hr == E_OUTOFMEMORY, "IStream_SetSize with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08x\n", hr);
+    ok(hr == E_OUTOFMEMORY, "IStream_SetSize with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08lx\n", hr);
 
     hr = IStream_Write(pStream, buffer, sizeof(buffer), &written);
-    ok(hr == E_OUTOFMEMORY, "IStream_Write with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08x\n", hr);
-    ok(written == 0, "written should be 0 instead of %d\n", written);
+    ok(hr == E_OUTOFMEMORY, "IStream_Write with invalid HGLOBAL should return E_OUTOFMEMORY instead of 0x%08lx\n", hr);
+    ok(written == 0, "written should be 0 instead of %ld\n", written);
 
     IStream_Release(pStream);
 }
@@ -526,21 +526,21 @@ static void stream_info(IStream *stream, HGLOBAL *hmem, int *size, int *pos)
     *size = *pos = -1;
 
     hr = GetHGlobalFromStream(stream, hmem);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     memset(&stat, 0x55, sizeof(stat));
     hr = IStream_Stat(stream, &stat, STATFLAG_DEFAULT);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
-    ok(stat.type == STGTY_STREAM, "unexpected %#x\n", stat.type);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
+    ok(stat.type == STGTY_STREAM, "unexpected %#lx\n", stat.type);
     ok(!stat.pwcsName, "unexpected %p\n", stat.pwcsName);
     ok(IsEqualIID(&stat.clsid, &GUID_NULL), "unexpected %s\n", wine_dbgstr_guid(&stat.clsid));
-    ok(!stat.cbSize.HighPart, "unexpected %#x\n", stat.cbSize.HighPart);
+    ok(!stat.cbSize.HighPart, "unexpected %#lx\n", stat.cbSize.HighPart);
     *size = stat.cbSize.LowPart;
 
     offset.QuadPart = 0;
     hr = IStream_Seek(stream, offset, STREAM_SEEK_CUR, &newpos);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
-    ok(!newpos.HighPart, "unexpected %#x\n", newpos.HighPart);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
+    ok(!newpos.HighPart, "unexpected %#lx\n", newpos.HighPart);
     *pos = newpos.LowPart;
 }
 
@@ -559,13 +559,13 @@ static void test_IStream_Clone(void)
     orig_hmem = GlobalAlloc(GMEM_MOVEABLE, 0);
     ok(orig_hmem != 0, "unexpected %p\n", orig_hmem);
     hr = CreateStreamOnHGlobal(orig_hmem, TRUE, &stream);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = GetHGlobalFromStream(stream, NULL);
-    ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
+    ok(hr == E_INVALIDARG, "unexpected %#lx\n", hr);
 
     hr = GetHGlobalFromStream(NULL, &hmem);
-    ok(hr == E_INVALIDARG, "unexpected %#x\n", hr);
+    ok(hr == E_INVALIDARG, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem == orig_hmem, "handles should match\n");
@@ -573,10 +573,10 @@ static void test_IStream_Clone(void)
     ok(pos == 0, "unexpected %d\n", pos);
 
     hr = IStream_Clone(stream, &clone);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = IStream_Write(stream, hello, sizeof(hello), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem == orig_hmem, "handles should match\n");
@@ -590,12 +590,12 @@ static void test_IStream_Clone(void)
 
     buf[0] = 0;
     hr = IStream_Read(clone, buf, sizeof(buf), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     ok(!strcmp(buf, hello), "wrong stream contents\n");
 
     newsize.QuadPart = 0x8000;
     hr = IStream_SetSize(stream, newsize);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem == orig_hmem, "handles should match\n");
@@ -614,10 +614,10 @@ static void test_IStream_Clone(void)
     orig_hmem = GlobalAlloc(GMEM_FIXED, 1);
     ok(orig_hmem != 0, "unexpected %p\n", orig_hmem);
     hr = CreateStreamOnHGlobal(orig_hmem, TRUE, &stream);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = IStream_Clone(stream, &clone);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem == orig_hmem, "handles should match\n");
@@ -631,7 +631,7 @@ static void test_IStream_Clone(void)
 
     newsize.QuadPart = 0x8000;
     hr = IStream_SetSize(stream, newsize);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem != 0, "unexpected %p\n", hmem);
@@ -649,10 +649,10 @@ static void test_IStream_Clone(void)
 
     /* test Release of cloned stream */
     hr = CreateStreamOnHGlobal(0, TRUE, &stream);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = IStream_Clone(stream, &clone);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(stream, &hmem, &size, &pos);
     ok(hmem != 0, "unexpected %p\n", hmem);
@@ -669,7 +669,7 @@ static void test_IStream_Clone(void)
 
     newsize.QuadPart = 0x8000;
     hr = IStream_SetSize(clone, newsize);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(clone, &hmem_clone, &size, &pos);
     ok(hmem_clone == hmem, "handles should match\n");
@@ -677,7 +677,7 @@ static void test_IStream_Clone(void)
     ok(pos == 0, "unexpected %d\n", pos);
 
     hr = IStream_Write(clone, hello, sizeof(hello), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     stream_info(clone, &hmem_clone, &size, &pos);
     ok(hmem_clone == hmem, "handles should match\n");
@@ -686,11 +686,11 @@ static void test_IStream_Clone(void)
 
     offset.QuadPart = 0;
     hr = IStream_Seek(clone, offset, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     buf[0] = 0;
     hr = IStream_Read(clone, buf, sizeof(buf), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     ok(!strcmp(buf, hello), "wrong stream contents\n");
 
     stream_info(clone, &hmem_clone, &size, &pos);
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index a1cd3dccb15..6e21ed1889b 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -67,11 +67,11 @@ static const GUID CLSID_ft_unmarshaler_1809 = {0x00000359, 0x0000, 0x0000, {0xc0
 static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID);
 
 /* helper macros to make tests a bit leaner */
-#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
-#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)
-#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
+#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %ld\n", cLocks)
+#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %ld\n", cLocks)
+#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error %#08lx\n", hr)
 #define ok_non_zero_external_conn() do {if (with_external_conn) ok(external_connections, "got no external connections\n");} while(0);
-#define ok_zero_external_conn() do {if (with_external_conn) ok(!external_connections, "got %d external connections\n", external_connections);} while(0);
+#define ok_zero_external_conn() do {if (with_external_conn) ok(!external_connections, "got %ld external connections\n", external_connections);} while(0);
 #define ok_last_release_closes(b) do {if (with_external_conn) ok(last_release_closes == b, "got %d expected %d\n", last_release_closes, b);} while(0);
 
 #define OBJREF_SIGNATURE (0x574f454d)
@@ -490,8 +490,8 @@ static HRESULT WINAPI RpcStubBuffer_Invoke(IRpcStubBuffer *iface, RPCOLEMESSAGE
     CHECK_EXPECT(Invoke);
 
     hr = IRpcChannelBuffer_GetDestCtx(_pRpcChannelBuffer, &dest_context, &dest_context_data);
-    ok(hr == S_OK, "GetDestCtx failed: %08x\n", hr);
-    ok(dest_context == MSHCTX_INPROC, "desc_context = %x\n", dest_context);
+    ok(hr == S_OK, "GetDestCtx failed: %08lx\n", hr);
+    ok(dest_context == MSHCTX_INPROC, "desc_context = %lx\n", dest_context);
     ok(!dest_context_data, "desc_context_data = %p\n", dest_context_data);
 
     return IRpcStubBuffer_Invoke(This->buffer, _prpcmsg, _pRpcChannelBuffer);
@@ -580,7 +580,7 @@ static HRESULT WINAPI PSFactoryBuffer_CreateStub(IPSFactoryBuffer *iface, REFIID
     stub->ref = 1;
 
     hr = IPSFactoryBuffer_CreateStub(ps_factory_buffer, riid, server, &stub->buffer);
-    ok(hr == S_OK, "CreateStub failed: %08x\n", hr);
+    ok(hr == S_OK, "CreateStub failed: %08lx\n", hr);
 
     *ppStub = &stub->IRpcStubBuffer_iface;
     return S_OK;
@@ -625,7 +625,7 @@ static DWORD CALLBACK host_object_proc(LPVOID p)
     if(data->register_object) {
         hr = CoRegisterClassObject(data->register_clsid, data->register_object,
             CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &registration_key);
-        ok(hr == S_OK, "CoRegisterClassObject failed: %08x\n", hr);
+        ok(hr == S_OK, "CoRegisterClassObject failed: %08lx\n", hr);
     }
 
     if (data->filter)
@@ -698,7 +698,7 @@ static void release_host_object(DWORD tid, WPARAM wp)
 static void end_host_object(DWORD tid, HANDLE thread)
 {
     BOOL ret = PostThreadMessageA(tid, WM_QUIT, 0, 0);
-    ok(ret, "PostThreadMessage failed with error %d\n", GetLastError());
+    ok(ret, "PostThreadMessage failed with error %ld\n", GetLastError());
     /* be careful of races - don't return until hosting thread has terminated */
     ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     CloseHandle(thread);
@@ -714,7 +714,7 @@ static void test_no_marshaler(void)
     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
     ok_ole_success(hr, CreateStreamOnHGlobal);
     hr = CoMarshalInterface(pStream, &IID_IWineTest, (IUnknown*)&Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == E_NOINTERFACE, "CoMarshalInterface should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+    ok(hr == E_NOINTERFACE, "CoMarshalInterface should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     IStream_Release(pStream);
 }
@@ -815,7 +815,7 @@ static void test_marshal_and_unmarshal_invalid(void)
     if (pProxy)
     {
         hr = IClassFactory_CreateInstance(pProxy, NULL, &IID_IUnknown, &dummy);
-        ok(hr == RPC_E_DISCONNECTED, "Remote call should have returned RPC_E_DISCONNECTED, instead of 0x%08x\n", hr);
+        ok(hr == RPC_E_DISCONNECTED, "Remote call should have returned RPC_E_DISCONNECTED, instead of 0x%08lx\n", hr);
 
         IClassFactory_Release(pProxy);
     }
@@ -848,7 +848,7 @@ static void test_same_apartment_unmarshal_failure(void)
     ok_ole_success(hr, IStream_Seek);
 
     hr = CoUnmarshalInterface(pStream, &IID_IParseDisplayName, (void **)&pProxy);
-    ok(hr == E_NOINTERFACE, "CoUnmarshalInterface should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+    ok(hr == E_NOINTERFACE, "CoUnmarshalInterface should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     ok_no_locks();
     ok_zero_external_conn();
@@ -1078,7 +1078,7 @@ static void test_proxy_marshal_and_unmarshal_weak(void)
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
     hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy2);
     todo_wine
-    ok(hr == CO_E_OBJNOTREG, "CoUnmarshalInterface should return CO_E_OBJNOTREG instead of 0x%08x\n", hr);
+    ok(hr == CO_E_OBJNOTREG, "CoUnmarshalInterface should return CO_E_OBJNOTREG instead of 0x%08lx\n", hr);
 
     ok_no_locks();
     ok_zero_external_conn();
@@ -1119,7 +1119,7 @@ static void test_proxy_marshal_and_unmarshal_strong(void)
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
     /* marshal the proxy */
     hr = CoMarshalInterface(pStream, &IID_IClassFactory, pProxy, MSHCTX_INPROC, NULL, MSHLFLAGS_TABLESTRONG);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ok_more_than_one_lock();
     ok_non_zero_external_conn();
@@ -1227,10 +1227,10 @@ static void test_marshal_proxy_apartment_shutdown(void)
     ok_last_release_closes(TRUE);
 
     hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IUnknown, (void **)&unk);
-    ok(hr == CO_E_OBJNOTCONNECTED, "got %#x\n", hr);
+    ok(hr == CO_E_OBJNOTCONNECTED, "got %#lx\n", hr);
 
     ref = IClassFactory_Release(proxy);
-    ok(!ref, "got %d refs\n", ref);
+    ok(!ref, "got %ld refs\n", ref);
 
     ok_no_locks();
 
@@ -1320,22 +1320,22 @@ static void test_marshal_channel_buffer(void)
 
     hr = CoRegisterClassObject(&CLSID_WineTestPSFactoryBuffer, (IUnknown *)&PSFactoryBuffer,
         CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &registration_key);
-    ok(hr == S_OK, "CoRegisterClassObject failed: %08x\n", hr);
+    ok(hr == S_OK, "CoRegisterClassObject failed: %08lx\n", hr);
 
     hr = CoRegisterPSClsid(&IID_IOleWindow, &CLSID_WineTestPSFactoryBuffer);
-    ok(hr == S_OK, "CoRegisterPSClsid failed: %08x\n", hr);
+    ok(hr == S_OK, "CoRegisterPSClsid failed: %08lx\n", hr);
 
     SET_EXPECT(CreateStub);
     SET_EXPECT(CreateProxy);
     hr = IUnknown_QueryInterface(proxy, &IID_IOleWindow, (void**)&ole_window);
-    ok(hr == S_OK, "Could not get IOleWindow iface: %08x\n", hr);
+    ok(hr == S_OK, "Could not get IOleWindow iface: %08lx\n", hr);
     CHECK_CALLED(CreateStub);
     CHECK_CALLED(CreateProxy);
 
     SET_EXPECT(Invoke);
     SET_EXPECT(GetWindow);
     hr = IOleWindow_GetWindow(ole_window, &hwnd);
-    ok(hr == S_OK, "GetWindow failed: %08x\n", hr);
+    ok(hr == S_OK, "GetWindow failed: %08lx\n", hr);
     ok((DWORD)(DWORD_PTR)hwnd == 0xdeadbeef, "hwnd = %p\n", hwnd);
     CHECK_CALLED(Invoke);
     CHECK_CALLED(GetWindow);
@@ -1348,7 +1348,7 @@ static void test_marshal_channel_buffer(void)
     CHECK_CALLED(Disconnect);
 
     hr = CoRevokeClassObject(registration_key);
-    ok(hr == S_OK, "CoRevokeClassObject failed: %08x\n", hr);
+    ok(hr == S_OK, "CoRevokeClassObject failed: %08lx\n", hr);
 
     end_host_object(tid, thread);
 }
@@ -1414,8 +1414,8 @@ static HRESULT WINAPI CustomMarshal_MarshalInterface(IMarshal *iface, IStream *s
 
     hr = IStream_Stat(stream, &stat, STATFLAG_DEFAULT);
     ok_ole_success(hr, IStream_Stat);
-    ok(U(stat.cbSize).LowPart == 0, "stream is not empty (%d)\n", U(stat.cbSize).LowPart);
-    ok(U(stat.cbSize).HighPart == 0, "stream is not empty (%d)\n", U(stat.cbSize).HighPart);
+    ok(U(stat.cbSize).LowPart == 0, "stream is not empty (%ld)\n", U(stat.cbSize).LowPart);
+    ok(U(stat.cbSize).HighPart == 0, "stream is not empty (%ld)\n", U(stat.cbSize).HighPart);
 
     hr = CoGetStandardMarshal(riid, (IUnknown*)iface,
             dwDestContext, NULL, mshlflags, &std_marshal);
@@ -1511,7 +1511,7 @@ static void test_StdMarshal_custom_marshaling(void)
             MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
     ok_ole_success(hr, CoGetMarshalSizeMax);
     CHECK_CALLED(CustomMarshal_GetMarshalSizeMax);
-    ok(size == sizeof(OBJREF), "size = %d, expected %d\n", size, (int)sizeof(OBJREF));
+    ok(size == sizeof(OBJREF), "size = %ld, expected %d\n", size, (int)sizeof(OBJREF));
 }
 
 static void test_DfMarshal_custom_marshaling(void)
@@ -1540,17 +1540,17 @@ static void test_DfMarshal_custom_marshaling(void)
     size = FIELD_OFFSET(OBJREF, u_objref.u_custom.pData);
     hr = IStream_Read(stream, &objref, size, &read);
     ok_ole_success(hr, IStream_Read);
-    ok(read == size, "read = %d, expected %d\n", read, size);
-    ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %x\n",
+    ok(read == size, "read = %ld, expected %ld\n", read, size);
+    ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %lx\n",
             objref.signature);
-    ok(objref.flags == OBJREF_CUSTOM, "objref.flags = %x\n", objref.flags);
+    ok(objref.flags == OBJREF_CUSTOM, "objref.flags = %lx\n", objref.flags);
     ok(IsEqualIID(&objref.iid, &IID_IUnknown), "objref.iid = %s\n",
             wine_dbgstr_guid(&objref.iid));
     ok(IsEqualIID(&objref.u_objref.u_custom.clsid, &CLSID_DfMarshal),
             "custom.clsid = %s\n", wine_dbgstr_guid(&objref.u_objref.u_custom.clsid));
-    ok(!objref.u_objref.u_custom.cbExtension, "custom.cbExtension = %d\n",
+    ok(!objref.u_objref.u_custom.cbExtension, "custom.cbExtension = %ld\n",
             objref.u_objref.u_custom.cbExtension);
-    ok(!objref.u_objref.u_custom.size, "custom.size = %d\n",
+    ok(!objref.u_objref.u_custom.size, "custom.size = %ld\n",
             objref.u_objref.u_custom.size);
 
     IStream_Release(stream);
@@ -1560,7 +1560,7 @@ static void test_DfMarshal_custom_marshaling(void)
             MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
     ok_ole_success(hr, CoGetMarshalSizeMax);
     CHECK_CALLED(CustomMarshal_GetMarshalSizeMax);
-    ok(size == sizeof(OBJREF), "size = %d, expected %d\n", size, (int)sizeof(OBJREF));
+    ok(size == sizeof(OBJREF), "size = %ld, expected %d\n", size, (int)sizeof(OBJREF));
 }
 
 static void test_CoGetStandardMarshal(void)
@@ -1593,7 +1593,7 @@ static void test_CoGetStandardMarshal(void)
     hr = CoGetMarshalSizeMax(&read, &IID_IUnknown, &Test_Unknown,
             MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
     ok_ole_success(hr, CoGetMarshalSizeMax);
-    ok(size == read, "IMarshal_GetMarshalSizeMax size = %d, expected %d\n", size, read);
+    ok(size == read, "IMarshal_GetMarshalSizeMax size = %ld, expected %ld\n", size, read);
 
     hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUnknown,
             &Test_Unknown, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
@@ -1604,15 +1604,15 @@ static void test_CoGetStandardMarshal(void)
     size = FIELD_OFFSET(OBJREF, u_objref.u_standard.saResAddr.aStringArray);
     hr = IStream_Read(stream, &objref, size, &read);
     ok_ole_success(hr, IStream_Read);
-    ok(read == size, "read = %d, expected %d\n", read, size);
-    ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %x\n",
+    ok(read == size, "read = %ld, expected %ld\n", read, size);
+    ok(objref.signature == OBJREF_SIGNATURE, "objref.signature = %lx\n",
             objref.signature);
-    ok(objref.flags == OBJREF_STANDARD, "objref.flags = %x\n", objref.flags);
+    ok(objref.flags == OBJREF_STANDARD, "objref.flags = %lx\n", objref.flags);
     ok(IsEqualIID(&objref.iid, &IID_IUnknown), "objref.iid = %s\n",
             wine_dbgstr_guid(&objref.iid));
     stdobjref = &objref.u_objref.u_standard.std;
-    ok(stdobjref->flags == 0, "stdobjref.flags = %d\n", stdobjref->flags);
-    ok(stdobjref->cPublicRefs == 5, "stdobjref.cPublicRefs = %d\n",
+    ok(stdobjref->flags == 0, "stdobjref.flags = %ld\n", stdobjref->flags);
+    ok(stdobjref->cPublicRefs == 5, "stdobjref.cPublicRefs = %ld\n",
             stdobjref->cPublicRefs);
     dualstringarr = &objref.u_objref.u_standard.saResAddr;
     ok(dualstringarr->wNumEntries == 0, "dualstringarr.wNumEntries = %d\n",
@@ -1978,7 +1978,7 @@ static void test_tableweak_marshal_releasedata2(void)
     todo_wine
     {
     ok(hr == CO_E_OBJNOTREG,
-       "CoUnmarshalInterface should have failed with CO_E_OBJNOTREG, but returned 0x%08x instead\n",
+       "CoUnmarshalInterface should have failed with CO_E_OBJNOTREG, but returned 0x%08lx instead\n",
        hr);
     }
     IStream_Release(pStream);
@@ -2389,7 +2389,7 @@ static void test_disconnect_stub(void)
     ok_non_zero_external_conn();
 
     hr = CoDisconnectObject(NULL, 0);
-    ok( hr == E_INVALIDARG, "wrong status %x\n", hr );
+    ok( hr == E_INVALIDARG, "wrong status %lx\n", hr );
 }
 
 /* tests failure case of a same-thread marshal and unmarshal twice */
@@ -2422,7 +2422,7 @@ static void test_normal_marshal_and_unmarshal_twice(void)
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
     hr = CoUnmarshalInterface(pStream, &IID_IClassFactory, (void **)&pProxy2);
     ok(hr == CO_E_OBJNOTCONNECTED,
-        "CoUnmarshalInterface should have failed with error CO_E_OBJNOTCONNECTED for double unmarshal, instead of 0x%08x\n", hr);
+        "CoUnmarshalInterface should have failed with error CO_E_OBJNOTCONNECTED for double unmarshal, instead of 0x%08lx\n", hr);
 
     IStream_Release(pStream);
 
@@ -2451,14 +2451,14 @@ static void test_hresult_marshaling(void)
     hr = IStream_Read(pStream, &hr_marshaled, sizeof(HRESULT), NULL);
     ok_ole_success(hr, IStream_Read);
 
-    ok(hr_marshaled == E_DEADBEEF, "Didn't marshal HRESULT as expected: got value 0x%08x instead\n", hr_marshaled);
+    ok(hr_marshaled == E_DEADBEEF, "Didn't marshal HRESULT as expected: got value 0x%08lx instead\n", hr_marshaled);
 
     hr_marshaled = 0;
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
     hr = CoUnmarshalHresult(pStream, &hr_marshaled);
     ok_ole_success(hr, CoUnmarshalHresult);
 
-    ok(hr_marshaled == E_DEADBEEF, "Didn't marshal HRESULT as expected: got value 0x%08x instead\n", hr_marshaled);
+    ok(hr_marshaled == E_DEADBEEF, "Didn't marshal HRESULT as expected: got value 0x%08lx instead\n", hr_marshaled);
 
     IStream_Release(pStream);
 }
@@ -2472,15 +2472,15 @@ static DWORD CALLBACK bad_thread_proc(LPVOID p)
     IUnknown * proxy = NULL;
 
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (LPVOID*)&proxy);
-    todo_wine ok(hr == CO_E_NOTINITIALIZED, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == CO_E_NOTINITIALIZED, "Got hr %#lx.\n", hr);
 
     hr = IClassFactory_QueryInterface(cf, &IID_IMultiQI, (LPVOID *)&proxy);
-    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#lx.\n", hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(proxy);
 
     hr = IClassFactory_QueryInterface(cf, &IID_IStream, (LPVOID *)&proxy);
-    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#lx.\n", hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(proxy);
 
@@ -2489,11 +2489,11 @@ static DWORD CALLBACK bad_thread_proc(LPVOID p)
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (LPVOID*)&proxy);
     if (proxy) IUnknown_Release(proxy);
     ok(hr == RPC_E_WRONG_THREAD,
-        "COM should have failed with RPC_E_WRONG_THREAD on using proxy from wrong apartment, but instead returned 0x%08x\n",
+        "COM should have failed with RPC_E_WRONG_THREAD on using proxy from wrong apartment, but instead returned 0x%08lx\n",
         hr);
 
     hr = IClassFactory_QueryInterface(cf, &IID_IStream, (LPVOID *)&proxy);
-    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == RPC_E_WRONG_THREAD, "Got hr %#lx.\n", hr);
 
     /* now be really bad and release the proxy from the wrong apartment */
     IClassFactory_Release(cf);
@@ -2653,7 +2653,7 @@ static void test_message_filter(void)
     ok_more_than_one_lock();
 
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (LPVOID*)&proxy);
-    ok(hr == RPC_E_CALL_REJECTED, "Call should have returned RPC_E_CALL_REJECTED, but return 0x%08x instead\n", hr);
+    ok(hr == RPC_E_CALL_REJECTED, "Call should have returned RPC_E_CALL_REJECTED, but return 0x%08lx instead\n", hr);
     if (proxy) IUnknown_Release(proxy);
     proxy = NULL;
 
@@ -2690,7 +2690,7 @@ static void test_bad_marshal_stream(void)
 
     /* try to read beyond end of stream */
     hr = CoReleaseMarshalData(pStream);
-    ok(hr == STG_E_READFAULT, "Should have failed with STG_E_READFAULT, but returned 0x%08x instead\n", hr);
+    ok(hr == STG_E_READFAULT, "Should have failed with STG_E_READFAULT, but returned 0x%08lx instead\n", hr);
 
     /* now release for real */
     IStream_Seek(pStream, ullZero, STREAM_SEEK_SET, NULL);
@@ -2821,16 +2821,16 @@ static void test_proxybuffer(REFIID riid)
     /* release our reference to the outer unknown object - the PS factory
      * buffer will have AddRef's it in the CreateProxy call */
     refs = IUnknown_Release(&pUnkOuter->IUnknown_iface);
-    ok(refs == 1, "Ref count of outer unknown should have been 1 instead of %d\n", refs);
+    ok(refs == 1, "Ref count of outer unknown should have been 1 instead of %ld\n", refs);
 
     /* Not checking return, unreliable on native. Maybe it leaks references? */
     IPSFactoryBuffer_Release(psfb);
 
     refs = IUnknown_Release((IUnknown *)lpvtbl);
-    ok(refs == 0, "Ref-count leak of %d on IRpcProxyBuffer\n", refs);
+    ok(refs == 0, "Ref-count leak of %ld on IRpcProxyBuffer\n", refs);
 
     refs = IRpcProxyBuffer_Release(proxy);
-    ok(refs == 0, "Ref-count leak of %d on IRpcProxyBuffer\n", refs);
+    ok(refs == 0, "Ref-count leak of %ld on IRpcProxyBuffer\n", refs);
 }
 
 static void test_stubbuffer(REFIID riid)
@@ -2862,7 +2862,7 @@ static void test_stubbuffer(REFIID riid)
     ok_no_locks();
 
     refs = IRpcStubBuffer_Release(stub);
-    ok(refs == 0, "Ref-count leak of %d on IRpcProxyBuffer\n", refs);
+    ok(refs == 0, "Ref-count leak of %ld on IRpcProxyBuffer\n", refs);
 }
 
 static HWND hwnd_app;
@@ -2925,7 +2925,7 @@ static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
         /* note the use of the magic IID_IWineTest value to tell remote thread
          * to try to send a message back to us */
         hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IWineTest, (void **)&object);
-        ok(hr == S_FALSE, "expected S_FALSE, got %d\n", hr);
+        ok(hr == S_FALSE, "expected S_FALSE, got %ld\n", hr);
 
         IClassFactory_Release(proxy);
 
@@ -2965,7 +2965,7 @@ static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
         * WM_QUIT message doesn't stop the call from succeeding */
         PostMessageA(hwnd, WM_QUIT, 0, 0);
         hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IUnknown, (void **)&object);
-	ok(hr == S_FALSE, "IClassFactory_CreateInstance returned 0x%08x, expected S_FALSE\n", hr);
+	ok(hr == S_FALSE, "IClassFactory_CreateInstance returned 0x%08lx, expected S_FALSE\n", hr);
 
         IClassFactory_Release(proxy);
 
@@ -2997,7 +2997,7 @@ static LRESULT CALLBACK window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l
          * messages should fail */
         hr = IClassFactory_CreateInstance(proxy, NULL, &IID_IUnknown, (void **)&object);
         ok(hr == RPC_E_CANTCALLOUT_ININPUTSYNCCALL,
-           "COM call during processing of sent message should return RPC_E_CANTCALLOUT_ININPUTSYNCCALL instead of 0x%08x\n", hr);
+           "COM call during processing of sent message should return RPC_E_CANTCALLOUT_ININPUTSYNCCALL instead of 0x%08lx\n", hr);
 
         IClassFactory_Release(proxy);
 
@@ -3153,15 +3153,15 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *
     if (mshctx == MSHCTX_INPROC)
     {
         DWORD expected_size = round_global_size(3*sizeof(DWORD) + sizeof(GUID));
-        ok(size == expected_size, "expected size %u, got %u\n", expected_size, size);
+        ok(size == expected_size, "expected size %lu, got %lu\n", expected_size, size);
 
-        ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%x, but got 0x%x for mshctx\n", mshlflags, *(DWORD *)marshal_data);
+        ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%lx, but got 0x%lx for mshctx\n", mshlflags, *(DWORD *)marshal_data);
         marshal_data += sizeof(DWORD);
         ok(*(void **)marshal_data == ptr, "expected %p, but got %p for mshctx\n", ptr, *(void **)marshal_data);
         marshal_data += sizeof(void *);
         if (sizeof(void*) == 4 && size >= 3*sizeof(DWORD))
         {
-            ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%x\n", *(DWORD *)marshal_data);
+            ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%lx\n", *(DWORD *)marshal_data);
             marshal_data += sizeof(DWORD);
         }
         if (size >= 3*sizeof(DWORD) + sizeof(GUID) && winetest_debug > 1)
@@ -3171,7 +3171,7 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *
     }
     else
     {
-        ok(size > sizeof(DWORD), "size should have been > sizeof(DWORD), not %d\n", size);
+        ok(size > sizeof(DWORD), "size should have been > sizeof(DWORD), not %ld\n", size);
         ok(*(DWORD *)marshal_data == 0x574f454d /* MEOW */,
             "marshal data should be filled by standard marshal and start with MEOW signature\n");
     }
@@ -3206,8 +3206,8 @@ static void test_freethreadedmarshaler(void)
     expected_size = sizeof(DWORD) /* flags */ + sizeof(UINT64) + sizeof(GUID);
     hr = IMarshal_GetMarshalSizeMax(pFTMarshal, &IID_IClassFactory, &Test_ClassFactory, MSHCTX_INPROC,
             NULL, MSHLFLAGS_NORMAL, &size);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(size == expected_size, "Unexpected marshal size %u, expected %u.\n", size, expected_size);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(size == expected_size, "Unexpected marshal size %lu, expected %lu.\n", size, expected_size);
 
     hr = IMarshal_GetUnmarshalClass(pFTMarshal, &IID_IClassFactory,
             &Test_ClassFactory, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &clsid);
@@ -3357,10 +3357,10 @@ static HRESULT reg_unreg_wine_test_class(BOOL Register)
             skip("Not authorized to modify the Classes key\n");
             return E_FAIL;
         }
-        ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %d\n", error);
+        ok(error == ERROR_SUCCESS, "RegCreateKeyEx failed with error %ld\n", error);
         if (error != ERROR_SUCCESS) hr = E_FAIL;
         error = RegSetValueExA(hkey, NULL, 0, REG_SZ, (const unsigned char *)"\"ole32.dll\"", strlen("\"ole32.dll\"") + 1);
-        ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %d\n", error);
+        ok(error == ERROR_SUCCESS, "RegSetValueEx failed with error %ld\n", error);
         if (error != ERROR_SUCCESS) hr = E_FAIL;
         RegCloseKey(hkey);
     }
@@ -3388,7 +3388,7 @@ static void test_inproc_handler(void)
     if (SUCCEEDED(hr))
     {
         hr = IUnknown_QueryInterface(pObject, &IID_IWineTest, (void **)&pObject2);
-        ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface on handler for invalid interface returned 0x%08x instead of E_NOINTERFACE\n", hr);
+        ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface on handler for invalid interface returned 0x%08lx instead of E_NOINTERFACE\n", hr);
 
         /* it's a handler as it supports IOleObject */
         hr = IUnknown_QueryInterface(pObject, &IID_IOleObject, (void **)&pObject2);
@@ -3481,7 +3481,7 @@ static void test_handler_marshaling(void)
         ok_more_than_one_lock();
 
         hr = IUnknown_QueryInterface(pProxy, &IID_IWineTest, (void **)&pObject);
-        ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface with unknown IID should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+        ok(hr == E_NOINTERFACE, "IUnknown_QueryInterface with unknown IID should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
         /* it's a handler as it supports IOleObject */
         hr = IUnknown_QueryInterface(pProxy, &IID_IOleObject, (void **)&pObject);
@@ -3541,7 +3541,7 @@ static void test_client_security(void)
     if (SUCCEEDED(IClassFactory_QueryInterface(pProxy, &IID_IRemUnknown, (void **)&pProxy2)))
     {
         hr = IUnknown_QueryInterface(pProxy2, &IID_IUnknown, (void **)&pUnknown2);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
         ok(pUnknown1 == pUnknown2, "both proxy's IUnknowns should be the same - %p, %p\n", pUnknown1, pUnknown2);
         IUnknown_Release(pUnknown2);
@@ -3559,7 +3559,7 @@ static void test_client_security(void)
     todo_wine ok_ole_success(hr, "IClientSecurity_QueryBlanket (all NULLs)");
 
     hr = IClientSecurity_QueryBlanket(pCliSec, (IUnknown *)pMarshal, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    todo_wine ok(hr == E_NOINTERFACE, "IClientSecurity_QueryBlanket with local interface should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+    todo_wine ok(hr == E_NOINTERFACE, "IClientSecurity_QueryBlanket with local interface should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     hr = IClientSecurity_QueryBlanket(pCliSec, (IUnknown *)pProxy, &dwAuthnSvc, &dwAuthzSvc, &pServerPrincName, &dwAuthnLevel, &dwImpLevel, &pAuthInfo, &dwCapabilities);
     todo_wine ok_ole_success(hr, "IClientSecurity_QueryBlanket");
@@ -3568,13 +3568,13 @@ static void test_client_security(void)
     todo_wine ok_ole_success(hr, "IClientSecurity_SetBlanket");
 
     hr = IClassFactory_CreateInstance(pProxy, NULL, &IID_IWineTest, &pv);
-    ok(hr == E_NOINTERFACE, "COM call should have succeeded instead of returning 0x%08x\n", hr);
+    ok(hr == E_NOINTERFACE, "COM call should have succeeded instead of returning 0x%08lx\n", hr);
 
     hr = IClientSecurity_SetBlanket(pCliSec, (IUnknown *)pMarshal, dwAuthnSvc, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities);
-    todo_wine ok(hr == E_NOINTERFACE, "IClientSecurity_SetBlanket with local interface should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+    todo_wine ok(hr == E_NOINTERFACE, "IClientSecurity_SetBlanket with local interface should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     hr = IClientSecurity_SetBlanket(pCliSec, (IUnknown *)pProxy, 0xdeadbeef, dwAuthzSvc, pServerPrincName, dwAuthnLevel, dwImpLevel, pAuthInfo, dwCapabilities);
-    todo_wine ok(hr == E_INVALIDARG, "IClientSecurity_SetBlanke with invalid dwAuthnSvc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    todo_wine ok(hr == E_INVALIDARG, "IClientSecurity_SetBlanke with invalid dwAuthnSvc should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     CoTaskMemFree(pServerPrincName);
 
@@ -3647,12 +3647,12 @@ static HRESULT WINAPI local_server_GetClassID(IPersist *iface, CLSID *clsid)
 
     /* Test calling CoDisconnectObject within a COM call */
     hr = CoDisconnectObject((IUnknown *)iface, 0);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     /* Initialize and uninitialize the apartment to show that we
      * remain in the autojoined mta */
     hr = CoInitializeEx( NULL, COINIT_MULTITHREADED );
-    ok( hr == S_FALSE, "got %08x\n", hr );
+    ok( hr == S_FALSE, "got %08lx\n", hr );
     CoUninitialize();
 
     return S_OK;
@@ -3798,7 +3798,7 @@ static HANDLE create_target_process(const char *arg)
     winetest_get_mainargs( &argv );
     sprintf(cmdline, "\"%s\" %s %s", argv[0], argv[1], arg);
     ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-    ok(ret, "CreateProcess failed with error: %u\n", GetLastError());
+    ok(ret, "CreateProcess failed with error: %lu\n", GetLastError());
     if (pi.hThread) CloseHandle(pi.hThread);
     return pi.hProcess;
 }
@@ -3830,7 +3830,7 @@ static void test_local_server(void)
      * class in the registry */
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER,
         NULL, &IID_IClassFactory, (LPVOID*)&cf);
-    todo_wine ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == REGDB_E_CLASSNOTREG, "Got hr %#lx.\n", hr);
 
     /* Resume the object suspended above ... */
     hr = CoResumeClassObjects();
@@ -3865,7 +3865,7 @@ static void test_local_server(void)
     /* try to connect again after SCM has suspended registered class objects */
     hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, NULL,
         &IID_IClassFactory, (LPVOID*)&cf);
-    todo_wine ok(hr == CO_E_SERVER_STOPPING || hr == REGDB_E_CLASSNOTREG /* Win10 1709+ */, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == CO_E_SERVER_STOPPING || hr == REGDB_E_CLASSNOTREG /* Win10 1709+ */, "Got hr %#lx.\n", hr);
 
     hr = CoRevokeClassObject(cookie);
     ok_ole_success(hr, CoRevokeClassObject);
@@ -3873,7 +3873,7 @@ static void test_local_server(void)
     CloseHandle(heventShutdown);
 
     process = create_target_process("-Embedding");
-    ok(process != NULL, "couldn't start local server process, error was %d\n", GetLastError());
+    ok(process != NULL, "couldn't start local server process, error was %ld\n", GetLastError());
 
     ready_event = CreateEventA(NULL, FALSE, FALSE, "Wine COM Test Ready Event");
     ok( !WaitForSingleObject(ready_event, 10000), "wait timed out\n" );
@@ -3922,7 +3922,7 @@ static DWORD CALLBACK get_global_interface_proc(LPVOID pv)
 	IClassFactory *cf;
 
 	hr = IGlobalInterfaceTable_GetInterfaceFromGlobal(params->git, params->cookie, &IID_IClassFactory, (void **)&cf);
-	ok(hr == CO_E_NOTINITIALIZED, "Got hr %#x.\n", hr);
+	ok(hr == CO_E_NOTINITIALIZED, "Got hr %#lx.\n", hr);
 
 	CoInitialize(NULL);
 
@@ -3952,10 +3952,10 @@ static void test_globalinterfacetable(void)
 	cLocks = 0;
 
 	hr = pDllGetClassObject(&CLSID_StdGlobalInterfaceTable, &IID_IClassFactory, (void**)&cf);
-	ok(hr == S_OK, "got 0x%08x\n", hr);
+	ok(hr == S_OK, "got 0x%08lx\n", hr);
 
 	hr = IClassFactory_QueryInterface(cf, &IID_IGlobalInterfaceTable, (void**)&object);
-	ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
+	ok(hr == E_NOINTERFACE, "got 0x%08lx\n", hr);
 
 	IClassFactory_Release(cf);
 
@@ -3963,14 +3963,14 @@ static void test_globalinterfacetable(void)
 	ok_ole_success(hr, CoCreateInstance);
 
 	ref = IGlobalInterfaceTable_AddRef(git);
-	ok(ref == 1, "ref=%d\n", ref);
+	ok(ref == 1, "ref=%ld\n", ref);
 	ref = IGlobalInterfaceTable_AddRef(git);
-	ok(ref == 1, "ref=%d\n", ref);
+	ok(ref == 1, "ref=%ld\n", ref);
 
 	ref = IGlobalInterfaceTable_Release(git);
-	ok(ref == 1, "ref=%d\n", ref);
+	ok(ref == 1, "ref=%ld\n", ref);
 	ref = IGlobalInterfaceTable_Release(git);
-	ok(ref == 1, "ref=%d\n", ref);
+	ok(ref == 1, "ref=%ld\n", ref);
 
 	hr = IGlobalInterfaceTable_RegisterInterfaceInGlobal(git, (IUnknown *)&Test_ClassFactory, &IID_IClassFactory, &cookie);
 	ok_ole_success(hr, IGlobalInterfaceTable_RegisterInterfaceInGlobal);
@@ -4012,7 +4012,7 @@ static void test_globalinterfacetable(void)
 	IGlobalInterfaceTable_Release(git);
 
     hr = CoGetClassObject(&CLSID_StdGlobalInterfaceTable, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&cf);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IClassFactory_Release(cf);
 }
 
@@ -4027,77 +4027,77 @@ static void test_manualresetevent(void)
     HRESULT hr;
 
     hr = pDllGetClassObject(&CLSID_ManualResetEvent, &IID_IClassFactory, (void **)&factory);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IClassFactory_Release(factory);
 
     hr = CoGetClassObject(&CLSID_ManualResetEvent, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void **)&factory);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IClassFactory_Release(factory);
 
     hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&punk);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     ok(!!punk, "Got NULL.\n");
     IUnknown_Release(punk);
 
     hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_ISynchronize, (void**)&psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     ok(!!psync1, "Got NULL.\n");
 
     hr = ISynchronize_Wait(psync1, 0, 5);
-    ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "Got 0x%08lx\n", hr);
 
     hr = ISynchronize_Reset(psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Signal(psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Wait(psync1, 0, 5);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Wait(psync1, 0, 5);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Reset(psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Wait(psync1, 0, 5);
-    ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "Got 0x%08lx\n", hr);
 
     hr = CoCreateInstance(&CLSID_ManualResetEvent, NULL, CLSCTX_INPROC_SERVER, &IID_ISynchronize, (void**)&psync2);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     ok(!!psync2, "Got NULL.\n");
     ok(psync1 != psync2, "psync1 == psync2.\n");
 
     hr = ISynchronize_QueryInterface(psync2, &IID_ISynchronizeHandle, (void**)&sync_handle);
-    ok(hr == S_OK, "QueryInterface(IID_ISynchronizeHandle) failed: %08x\n", hr);
+    ok(hr == S_OK, "QueryInterface(IID_ISynchronizeHandle) failed: %08lx\n", hr);
 
     handle = NULL;
     hr = ISynchronizeHandle_GetHandle(sync_handle, &handle);
-    ok(hr == S_OK, "GetHandle failed: %08x\n", hr);
+    ok(hr == S_OK, "GetHandle failed: %08lx\n", hr);
     ok(handle != NULL && handle != INVALID_HANDLE_VALUE, "handle = %p\n", handle);
 
     ISynchronizeHandle_Release(sync_handle);
 
     hr = ISynchronize_Wait(psync2, 0, 5);
-    ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "Got 0x%08lx\n", hr);
 
     hr = ISynchronize_Reset(psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Reset(psync2);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Signal(psync1);
-    ok(hr == S_OK, "Got 0x%08x\n", hr);
+    ok(hr == S_OK, "Got 0x%08lx\n", hr);
     hr = ISynchronize_Wait(psync2, 0, 5);
-    ok(hr == RPC_S_CALLPENDING, "Got 0x%08x\n", hr);
+    ok(hr == RPC_S_CALLPENDING, "Got 0x%08lx\n", hr);
 
     ref = ISynchronize_AddRef(psync1);
-    ok(ref == 2, "Got ref: %d\n", ref);
+    ok(ref == 2, "Got ref: %ld\n", ref);
     ref = ISynchronize_AddRef(psync1);
-    ok(ref == 3, "Got ref: %d\n", ref);
+    ok(ref == 3, "Got ref: %ld\n", ref);
     ref = ISynchronize_Release(psync1);
-    ok(ref == 2, "Got nonzero ref: %d\n", ref);
+    ok(ref == 2, "Got nonzero ref: %ld\n", ref);
     ref = ISynchronize_Release(psync2);
-    ok(!ref, "Got nonzero ref: %d\n", ref);
+    ok(!ref, "Got nonzero ref: %ld\n", ref);
     ref = ISynchronize_Release(psync1);
-    ok(ref == 1, "Got nonzero ref: %d\n", ref);
+    ok(ref == 1, "Got nonzero ref: %ld\n", ref);
     ref = ISynchronize_Release(psync1);
-    ok(!ref, "Got nonzero ref: %d\n", ref);
+    ok(!ref, "Got nonzero ref: %ld\n", ref);
 }
 
 static DWORD CALLBACK implicit_mta_unmarshal_proc(void *param)
@@ -4120,7 +4120,7 @@ static DWORD CALLBACK implicit_mta_unmarshal_proc(void *param)
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void **)&proxy);
-    ok(hr == RPC_E_WRONG_THREAD, "got %#x\n", hr);
+    ok(hr == RPC_E_WRONG_THREAD, "got %#lx\n", hr);
 
     CoUninitialize();
 
@@ -4150,7 +4150,7 @@ static DWORD CALLBACK implicit_mta_use_proc(void *param)
     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
     hr = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void **)&proxy);
-    ok(hr == RPC_E_WRONG_THREAD, "got %#x\n", hr);
+    ok(hr == RPC_E_WRONG_THREAD, "got %#lx\n", hr);
 
     CoUninitialize();
     return 0;
@@ -4301,8 +4301,8 @@ static void WINAPI TestChannelHook_ClientGetSize(
 
     if (info->cbSize == sizeof(*info))
     {
-        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
-        ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%lx instead of 0x%lx\n", info->dwServerPid, GetCurrentProcessId());
+        ok(info->iMethod == method, "iMethod was %ld should be %d\n", info->iMethod, method);
         ok(!info->pObject, "pObject should be NULL\n");
         if (method == 3)
             causality = info->uCausality;
@@ -4328,8 +4328,8 @@ static void WINAPI TestChannelHook_ClientFillBuffer(
 
     if (info->cbSize == sizeof(*info))
     {
-        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
-        ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%lx instead of 0x%lx\n", info->dwServerPid, GetCurrentProcessId());
+        ok(info->iMethod == method, "iMethod was %ld should be %d\n", info->iMethod, method);
         ok(!info->pObject, "pObject should be NULL\n");
         ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
     }
@@ -4351,12 +4351,12 @@ static void WINAPI TestChannelHook_ClientNotify(
 {
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
 
-    if (winetest_debug > 1) trace("IChannelHook::ClientNotify(hr %#x)\n", hrFault);
+    if (winetest_debug > 1) trace("IChannelHook::ClientNotify(hr %#lx)\n", hrFault);
 
     if (info->cbSize == sizeof(*info))
     {
-        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
-        ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%lx instead of 0x%lx\n", info->dwServerPid, GetCurrentProcessId());
+        ok(info->iMethod == method, "iMethod was %ld should be %d\n", info->iMethod, method);
         todo_wine {
             ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
         }
@@ -4380,13 +4380,13 @@ static void WINAPI TestChannelHook_ServerNotify(
 
     if (info->cbSize == sizeof(*info))
     {
-        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
-        ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%lx instead of 0x%lx\n", info->dwServerPid, GetCurrentProcessId());
+        ok(info->iMethod == method, "iMethod was %ld should be %d\n", info->iMethod, method);
         ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
         ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
     }
 
-    ok(cbDataSize == 1, "cbDataSize should have been 1 instead of %d\n", cbDataSize);
+    ok(cbDataSize == 1, "cbDataSize should have been 1 instead of %ld\n", cbDataSize);
     ok(*(unsigned char *)pDataBuffer == 0xcc, "pDataBuffer should have contained 0xcc instead of 0x%x\n", *(unsigned char *)pDataBuffer);
     ok(IsEqualGUID(uExtent, &EXTENTID_WineTest), "uExtent wasn't correct\n");
 }
@@ -4400,12 +4400,12 @@ static void WINAPI TestChannelHook_ServerGetSize(
 {
     SChannelHookCallInfo *info = (SChannelHookCallInfo *)riid;
 
-    if (winetest_debug > 1) trace("IChannelHook::ServerGetSize(iid %s, hr %#x)\n", debugstr_guid(riid), hrFault);
+    if (winetest_debug > 1) trace("IChannelHook::ServerGetSize(iid %s, hr %#lx)\n", debugstr_guid(riid), hrFault);
 
     if (info->cbSize == sizeof(*info))
     {
-        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%x instead of 0x%x\n", info->dwServerPid, GetCurrentProcessId());
-        ok(info->iMethod == method, "iMethod was %d should be %d\n", info->iMethod, method);
+        ok(info->dwServerPid == GetCurrentProcessId(), "dwServerPid was 0x%lx instead of 0x%lx\n", info->dwServerPid, GetCurrentProcessId());
+        ok(info->iMethod == method, "iMethod was %ld should be %d\n", info->iMethod, method);
         ok(info->pObject != NULL, "pObject shouldn't be NULL\n");
         ok(IsEqualGUID(&info->uCausality, &causality), "causality wasn't correct\n");
     }
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c
index ec4273284e3..a507c63171c 100644
--- a/dlls/ole32/tests/moniker.c
+++ b/dlls/ole32/tests/moniker.c
@@ -46,12 +46,12 @@ static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOO
     expected_hr = supported ? S_OK : E_NOINTERFACE;
 
     hr = IUnknown_QueryInterface(iface, iid, (void **)&unk);
-    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr);
+    ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr);
     if (SUCCEEDED(hr))
         IUnknown_Release(unk);
 }
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error %#08lx\n", hr)
 
 static char const * const *expected_method_list;
 
@@ -95,9 +95,9 @@ static void _test_moniker_type(IMoniker *moniker, DWORD type, BOOL todo, int lin
     HRESULT hr;
 
     hr = IMoniker_IsSystemMoniker(moniker, &type2);
-    ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     todo_wine_if(todo)
-    ok_(__FILE__, line)(type2 == type, "Unexpected moniker type %d.\n", type2);
+    ok_(__FILE__, line)(type2 == type, "Unexpected moniker type %ld.\n", type2);
 }
 
 #define TEST_DISPLAY_NAME(m,name) _test_moniker_name(m, name, __LINE__)
@@ -108,10 +108,10 @@ static void _test_moniker_name(IMoniker *moniker, const WCHAR *name, int line)
     HRESULT hr;
 
     hr = CreateBindCtx(0, &pbc);
-    ok_(__FILE__, line)(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
+    ok_(__FILE__, line)(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, pbc, NULL, &display_name);
-    ok_(__FILE__, line)(hr == S_OK, "Failed to get display name, hr %#x.\n", hr);
+    ok_(__FILE__, line)(hr == S_OK, "Failed to get display name, hr %#lx.\n", hr);
     ok_(__FILE__, line)(!lstrcmpW(display_name, name), "Unexpected display name %s.\n", wine_dbgstr_w(display_name));
 
     CoTaskMemFree(display_name);
@@ -126,20 +126,20 @@ static IMoniker *create_antimoniker(DWORD level)
     HRESULT hr;
 
     hr = CreateAntiMoniker(&moniker);
-    ok(hr == S_OK, "Failed to create antimoniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create antimoniker, hr %#lx.\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
 
     hr = IStream_Write(stream, &level, sizeof(level), NULL);
-    ok(hr == S_OK, "Failed to write contents, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to write contents, hr %#lx.\n", hr);
 
     pos.QuadPart = 0;
     hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "Failed to rewind, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to rewind, hr %#lx.\n", hr);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Failed to load, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to load, hr %#lx.\n", hr);
 
     IStream_Release(stream);
 
@@ -205,14 +205,14 @@ static HRESULT create_moniker_parse_desc(const char *desc, unsigned int *eaten,
 
             comp_len = 0;
             hr = create_moniker_parse_desc(desc, &comp_len, &left);
-            ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+            ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
             *eaten += comp_len;
             desc += comp_len;
 
             comp_len = 0;
             hr = create_moniker_parse_desc(desc, &comp_len, &right);
-            ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+            ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
             *eaten += comp_len;
 
@@ -285,8 +285,8 @@ static ULONG WINAPI ExternalConnection_Release(IExternalConnection *iface)
 static DWORD WINAPI ExternalConnection_AddConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved)
 {
     struct test_factory *factory = impl_from_IExternalConnection(iface);
-    ok(extconn == EXTCONN_STRONG, "Unexpected connection type %d\n", extconn);
-    ok(!reserved, "reserved = %x\n", reserved);
+    ok(extconn == EXTCONN_STRONG, "Unexpected connection type %ld\n", extconn);
+    ok(!reserved, "reserved = %lx\n", reserved);
     return ++factory->external_connections;
 }
 
@@ -294,8 +294,8 @@ static DWORD WINAPI ExternalConnection_ReleaseConnection(IExternalConnection *if
         DWORD reserved, BOOL fLastReleaseCloses)
 {
     struct test_factory *factory = impl_from_IExternalConnection(iface);
-    ok(extconn == EXTCONN_STRONG, "Unexpected connection type %d\n", extconn);
-    ok(!reserved, "reserved = %x\n", reserved);
+    ok(extconn == EXTCONN_STRONG, "Unexpected connection type %ld\n", extconn);
+    ok(!reserved, "reserved = %lx\n", reserved);
     return --factory->external_connections;
 }
 
@@ -946,10 +946,10 @@ static void test_ROT(void)
     /* try with our own moniker that doesn't support IROTData */
     hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
             &test_moniker->IMoniker_iface, &dwCookie);
-    ok(hr == S_OK, "Failed to register interface, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to register interface, hr %#lx.\n", hr);
     ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
     ok(factory.external_connections == 1, "external_connections = %d\n", factory.external_connections);
-    ok(factory.refcount > 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     expected_method_list = methods_isrunning_no_ROTData;
     hr = IRunningObjectTable_IsRunning(pROT, &test_moniker->IMoniker_iface);
@@ -959,7 +959,7 @@ static void test_ROT(void)
     hr = IRunningObjectTable_Revoke(pROT, dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Revoke);
     ok(!factory.external_connections, "external_connections = %d\n", factory.external_connections);
-    ok(factory.refcount == 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     expected_method_list = methods_register;
     /* try with our own moniker */
@@ -968,7 +968,7 @@ static void test_ROT(void)
             &test_moniker->IMoniker_iface, &dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Register);
     ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list);
-    ok(factory.refcount > 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     expected_method_list = methods_isrunning;
     hr = IRunningObjectTable_IsRunning(pROT, &test_moniker->IMoniker_iface);
@@ -978,7 +978,7 @@ static void test_ROT(void)
 
     hr = IRunningObjectTable_Revoke(pROT, dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Revoke);
-    ok(factory.refcount == 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     hr = CreateFileMoniker(wszFileName, &pMoniker);
     ok_ole_success(hr, CreateClassMoniker);
@@ -988,21 +988,21 @@ static void test_ROT(void)
     hr = IRunningObjectTable_Register(pROT, 0, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Register);
     ok(!factory.external_connections, "external_connections = %d\n", factory.external_connections);
-    ok(factory.refcount > 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     hr = IRunningObjectTable_Revoke(pROT, dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Revoke);
-    ok(factory.refcount == 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     /* test flags: ROTFLAGS_REGISTRATIONKEEPSALIVE */
     hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
             pMoniker, &dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Register);
-    ok(factory.refcount > 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     hr = IRunningObjectTable_Revoke(pROT, dwCookie);
     ok_ole_success(hr, IRunningObjectTable_Revoke);
-    ok(factory.refcount == 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     /* test flags: ROTFLAGS_REGISTRATIONKEEPSALIVE|ROTFLAGS_ALLOWANYCLIENT */
     /* only succeeds when process is started by SCM and has LocalService
@@ -1010,36 +1010,36 @@ static void test_ROT(void)
     hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT,
             (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
     todo_wine {
-    ok(hr == CO_E_WRONG_SERVER_IDENTITY, "Unexpected hr %#x.\n", hr);
+    ok(hr == CO_E_WRONG_SERVER_IDENTITY, "Unexpected hr %#lx.\n", hr);
     }
     if (SUCCEEDED(hr))
     {
         hr = IRunningObjectTable_Revoke(pROT, dwCookie);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     }
 
     hr = IRunningObjectTable_Register(pROT, 0xdeadbeef, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie);
-    ok(hr == E_INVALIDARG, "IRunningObjectTable_Register should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IRunningObjectTable_Register should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     IMoniker_Release(pMoniker);
     IMoniker_Release(&test_moniker->IMoniker_iface);
 
     /* Pointer moniker does not implement IROTData or display name */
     hr = CreatePointerMoniker(NULL, &pMoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
             pMoniker, &dwCookie);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(pMoniker);
 
     hr = create_moniker_from_desc("I1", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = CreatePointerMoniker((IUnknown *)moniker, &pMoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)&factory.IClassFactory_iface,
             pMoniker, &dwCookie);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(pMoniker);
     IMoniker_Release(moniker);
 
@@ -1069,9 +1069,9 @@ static void test_ROT_multiple_entries(void)
     ok_ole_success(hr, IRunningObjectTable_Register);
 
     hr = IRunningObjectTable_Register(pROT, 0, (IUnknown *)&factory.IClassFactory_iface, pMoniker, &dwCookie2);
-    ok(hr == MK_S_MONIKERALREADYREGISTERED, "IRunningObjectTable_Register should have returned MK_S_MONIKERALREADYREGISTERED instead of 0x%08x\n", hr);
+    ok(hr == MK_S_MONIKERALREADYREGISTERED, "IRunningObjectTable_Register should have returned MK_S_MONIKERALREADYREGISTERED instead of 0x%08lx\n", hr);
 
-    ok(dwCookie1 != dwCookie2, "cookie returned for registering duplicate object shouldn't match cookie of original object (0x%x)\n", dwCookie1);
+    ok(dwCookie1 != dwCookie2, "cookie returned for registering duplicate object shouldn't match cookie of original object (0x%lx)\n", dwCookie1);
 
     hr = IRunningObjectTable_GetObject(pROT, pMoniker, &pObject);
     ok_ole_success(hr, IRunningObjectTable_GetObject);
@@ -1237,8 +1237,8 @@ static void test_MkParseDisplayName(void)
                                 invalid_parameters[i].szDisplayName,
                                 invalid_parameters[i].pchEaten,
                                 invalid_parameters[i].ppmk);
-        ok(hr == E_INVALIDARG, "[%d] MkParseDisplayName should have failed with E_INVALIDARG instead of 0x%08x\n", i, hr);
-        ok(eaten == 0xdeadbeef, "[%d] Processed character count should have been 0xdeadbeef instead of %u\n", i, eaten);
+        ok(hr == E_INVALIDARG, "[%d] MkParseDisplayName should have failed with E_INVALIDARG instead of 0x%08lx\n", i, hr);
+        ok(eaten == 0xdeadbeef, "[%d] Processed character count should have been 0xdeadbeef instead of %lu\n", i, eaten);
         ok(pmk == (IMoniker *)0xdeadbeef, "[%d] Output moniker pointer should have been 0xdeadbeef instead of %p\n", i, pmk);
     }
 
@@ -1246,8 +1246,8 @@ static void test_MkParseDisplayName(void)
     pmk = (IMoniker *)0xdeadbeef;
     hr = MkParseDisplayName(pbc, wszNonExistentProgId, &eaten, &pmk);
     todo_wine
-    ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr);
-    ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
+    ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
+    ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
     ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
 
     /* no special handling of "clsid:" without the string form of the clsid
@@ -1256,8 +1256,8 @@ static void test_MkParseDisplayName(void)
     pmk = (IMoniker *)0xdeadbeef;
     hr = MkParseDisplayName(pbc, wszDisplayNameClsid, &eaten, &pmk);
     todo_wine
-    ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr);
-    ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
+    ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
+    ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
     ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
 
     /* shows clsid has higher precedence than a running object */
@@ -1272,7 +1272,7 @@ static void test_MkParseDisplayName(void)
     hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
     ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
-        "Processed character count should have been 43 instead of %u\n", eaten);
+        "Processed character count should have been 43 instead of %lu\n", eaten);
     if (pmk)
     {
         TEST_MONIKER_TYPE(pmk, MKSYS_CLASSMONIKER);
@@ -1293,7 +1293,7 @@ static void test_MkParseDisplayName(void)
     hr = MkParseDisplayName(pbc, wszDisplayNameRunning, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
     ok(eaten == ARRAY_SIZE(wszDisplayNameRunning) - 1,
-        "Processed character count should have been 15 instead of %u\n", eaten);
+        "Processed character count should have been 15 instead of %lu\n", eaten);
     if (pmk)
     {
         TEST_MONIKER_TYPE(pmk, MKSYS_FILEMONIKER);
@@ -1310,7 +1310,7 @@ static void test_MkParseDisplayName(void)
     hr = MkParseDisplayName(pbc, wszDisplayNameProgId1, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
     ok(eaten == ARRAY_SIZE(wszDisplayNameProgId1) - 1,
-        "Processed character count should have been 8 instead of %u\n", eaten);
+        "Processed character count should have been 8 instead of %lu\n", eaten);
     if (pmk)
     {
         TEST_MONIKER_TYPE(pmk, MKSYS_ANTIMONIKER);
@@ -1321,7 +1321,7 @@ static void test_MkParseDisplayName(void)
     hr = MkParseDisplayName(pbc, wszDisplayNameProgId2, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
     ok(eaten == ARRAY_SIZE(wszDisplayNameProgId2) - 1,
-        "Processed character count should have been 8 instead of %u\n", eaten);
+        "Processed character count should have been 8 instead of %lu\n", eaten);
     if (pmk)
     {
         TEST_MONIKER_TYPE(pmk, MKSYS_ANTIMONIKER);
@@ -1332,8 +1332,8 @@ static void test_MkParseDisplayName(void)
     pmk = (IMoniker *)0xdeadbeef;
     hr = MkParseDisplayName(pbc, wszDisplayNameProgIdFail, &eaten, &pmk);
     todo_wine
-    ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr);
-    ok(eaten == 0, "Processed character count should have been 0 instead of %u\n", eaten);
+    ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
+    ok(eaten == 0, "Processed character count should have been 0 instead of %lu\n", eaten);
     ok(pmk == NULL, "Output moniker pointer should have been NULL instead of %p\n", pmk);
 
     hr = CoRevokeClassObject(pdwReg1);
@@ -1345,7 +1345,7 @@ static void test_MkParseDisplayName(void)
         ARRAY_SIZE(wszDisplayNameFile));
     hr = MkParseDisplayName(pbc, wszDisplayNameFile, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
-    ok(eaten == len - 1, "Processed character count should have been %d instead of %u\n", len - 1, eaten);
+    ok(eaten == len - 1, "Processed character count should have been %d instead of %lu\n", len - 1, eaten);
     if (pmk)
     {
         TEST_MONIKER_TYPE(pmk, MKSYS_FILEMONIKER);
@@ -1355,7 +1355,7 @@ static void test_MkParseDisplayName(void)
     hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
     ok_ole_success(hr, MkParseDisplayName);
     ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
-        "Processed character count should have been 43 instead of %u\n", eaten);
+        "Processed character count should have been 43 instead of %lu\n", eaten);
 
     if (pmk)
     {
@@ -1373,29 +1373,29 @@ static void test_MkParseDisplayName(void)
     ok_ole_success(hr, CreateBindCtx);
 
     hr = CreateFileMoniker(wszFileName1, &pmk1);
-    ok(hr == S_OK, "Failed to create file moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create file moniker, hr %#lx.\n", hr);
     hr = CreateFileMoniker(wszFileName2, &pmk2);
-    ok(hr == S_OK, "Failed to create file moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create file moniker, hr %#lx.\n", hr);
     hr = IBindCtx_GetRunningObjectTable(pbc, &pprot);
-    ok(hr == S_OK, "Failed to get ROT, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get ROT, hr %#lx.\n", hr);
 
     /* Check EnumMoniker before registering */
     hr = IRunningObjectTable_EnumRunning(pprot, &spEM1);
-    ok(hr == S_OK, "Failed to get enum object, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
     hr = IEnumMoniker_QueryInterface(spEM1, &IID_IUnknown, (void *)&lpEM1);
     /* Register a couple of Monikers and check is ok */
-    ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
 
     matchCnt = count_moniker_matches(pbc, spEM1);
 
     hr = IRunningObjectTable_Register(pprot, ROTFLAGS_REGISTRATIONKEEPSALIVE, lpEM1, pmk1, &pdwReg1);
-    ok(hr == S_OK, "Failed to register object, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to register object, hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Register(pprot, ROTFLAGS_REGISTRATIONKEEPSALIVE, lpEM1, pmk2, &pdwReg2);
-    ok(hr == S_OK, "Failed to register object, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to register object, hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_EnumRunning(pprot, &spEM2);
-    ok(hr == S_OK, "Failed to get enum object, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
 
     matchCnt = count_moniker_matches(pbc, spEM2);
     ok(matchCnt==2, "Number of matches should be equal to 2 not %i\n", matchCnt);
@@ -1410,9 +1410,9 @@ static void test_MkParseDisplayName(void)
     ok(matchCnt==2, "Number of matches should be equal to 2 not %i\n", matchCnt);
 
     hr = IRunningObjectTable_Revoke(pprot,pdwReg1);
-    ok(hr == S_OK, "Failed to revoke, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to revoke, hr %#lx.\n", hr);
     hr = IRunningObjectTable_Revoke(pprot,pdwReg2);
-    ok(hr == S_OK, "Failed to revoke, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to revoke, hr %#lx.\n", hr);
     IUnknown_Release(lpEM1);
     IEnumMoniker_Release(spEM1);
     IEnumMoniker_Release(spEM2);
@@ -1726,13 +1726,13 @@ static void test_moniker(
     IMoniker * moniker_proxy;
 
     hr = IMoniker_IsDirty(moniker);
-    ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", testname, hr);
+    ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", testname, hr);
 
     /* Display Name */
     TEST_DISPLAY_NAME(moniker, expected_display_name);
 
     hr = IMoniker_IsDirty(moniker);
-    ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", testname, hr);
+    ok(hr == S_FALSE, "%s: IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", testname, hr);
 
     /* IROTData::GetComparisonData test */
 
@@ -1746,7 +1746,7 @@ static void test_moniker(
 
     /* first check we have the right amount of data */
     ok(moniker_size == sizeof_expected_moniker_comparison_data,
-        "%s: Size of comparison data differs (expected %d, actual %d)\n",
+        "%s: Size of comparison data differs (expected %d, actual %ld)\n",
         testname, sizeof_expected_moniker_comparison_data, moniker_size);
 
     /* then do a byte-by-byte comparison */
@@ -1782,9 +1782,9 @@ static void test_moniker(
     IMoniker_IsSystemMoniker(moniker, &moniker_type);
 
     hr = IMoniker_GetSizeMax(moniker, &max_size);
-    ok(hr == S_OK, "Failed to get max size, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get max size, hr %#lx.\n", hr);
     todo_wine_if(moniker_type == MKSYS_GENERICCOMPOSITE)
-    ok(expected_max_size == max_size.u.LowPart, "%s: unexpected max size %u.\n", testname, max_size.u.LowPart);
+    ok(expected_max_size == max_size.u.LowPart, "%s: unexpected max size %lu.\n", testname, max_size.u.LowPart);
 
     hr = IMoniker_Save(moniker, stream, TRUE);
     ok_ole_success(hr, IMoniker_Save);
@@ -1798,7 +1798,7 @@ static void test_moniker(
 
     /* first check we have the right amount of data */
     ok(moniker_size == round_global_size(sizeof_expected_moniker_saved_data),
-        "%s: Size of saved data differs (expected %d, actual %d)\n",
+        "%s: Size of saved data differs (expected %ld, actual %ld)\n",
         testname, (DWORD)round_global_size(sizeof_expected_moniker_saved_data), moniker_size);
 
     /* then do a byte-by-byte comparison */
@@ -1845,7 +1845,7 @@ static void test_moniker(
 
     /* first check we have the right amount of data */
     ok(moniker_size == round_global_size(sizeof_expected_moniker_marshal_data),
-        "%s: Size of marshaled data differs (expected %d, actual %d)\n",
+        "%s: Size of marshaled data differs (expected %ld, actual %ld)\n",
         testname, (DWORD)round_global_size(sizeof_expected_moniker_marshal_data), moniker_size);
 
     /* then do a byte-by-byte comparison */
@@ -1920,15 +1920,15 @@ static void test_class_moniker(void)
     DWORD *data;
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(tests); ++i)
     {
         eaten = 0xdeadbeef;
         hr = MkParseDisplayName(bindctx, tests[i].name, &eaten, &moniker);
         todo_wine_if(i == 5)
-        ok(hr == tests[i].hr, "%u: unexpected hr %#x.\n", i, hr);
-        ok(eaten == tests[i].eaten, "%u: unexpected eaten length %u, expected %u.\n", i, eaten, tests[i].eaten);
+        ok(hr == tests[i].hr, "%u: unexpected hr %#lx.\n", i, hr);
+        ok(eaten == tests[i].eaten, "%u: unexpected eaten length %lu, expected %lu.\n", i, eaten, tests[i].eaten);
         if (SUCCEEDED(hr))
         {
             TEST_MONIKER_TYPE(moniker, MKSYS_CLASSMONIKER);
@@ -1938,35 +1938,35 @@ static void test_class_moniker(void)
 
     /* Extended syntax, handled by class moniker directly, only CLSID is meaningful for equality. */
     hr = MkParseDisplayName(bindctx, L"clsid:11111111-0000-0000-2222-444444444444;extra data:", &eaten, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(eaten == 54, "Unexpected length %u.\n", eaten);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(eaten == 54, "Unexpected length %lu.\n", eaten);
 
     hr = MkParseDisplayName(bindctx, L"clsid:11111111-0000-0000-2222-444444444444;different extra data:", &eaten, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     TEST_DISPLAY_NAME(moniker, L"clsid:11111111-0000-0000-2222-444444444444;extra data:");
     TEST_MONIKER_TYPE(moniker, MKSYS_CLASSMONIKER);
     hr = IMoniker_GetSizeMax(moniker, &size);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(size.LowPart == 44, "Unexpected size %u.\n", size.LowPart);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(size.LowPart == 44, "Unexpected size %lu.\n", size.LowPart);
 
     TEST_MONIKER_TYPE(moniker2, MKSYS_CLASSMONIKER);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker2, moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker2);
     IMoniker_Release(moniker);
 
     /* From persistent state */
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateClassMoniker(&GUID_NULL, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     check_interface(moniker, &IID_IMoniker, TRUE);
     check_interface(moniker, &IID_IPersist, TRUE);
@@ -1976,44 +1976,44 @@ static void test_class_moniker(void)
     check_interface(moniker, &IID_IMarshal, TRUE);
 
     hr = IMoniker_GetSizeMax(moniker, &size);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(size.QuadPart == 20, "Unexpected size %u.\n", size.LowPart);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(size.QuadPart == 20, "Unexpected size %lu.\n", size.LowPart);
 
     hr = IStream_Write(stream, &CLSID_StdComponentCategoriesMgr, sizeof(CLSID), NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     length = 5 * sizeof(WCHAR);
     hr = IStream_Write(stream, &length, sizeof(length), NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IStream_Write(stream, L"data", length, NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     pos.QuadPart = 0;
     hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetSizeMax(moniker, &size);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(size.QuadPart == 30, "Unexpected size %u.\n", size.LowPart);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(size.QuadPart == 30, "Unexpected size %lu.\n", size.LowPart);
     TEST_DISPLAY_NAME(moniker, L"clsid:0002E005-0000-0000-C000-000000000046data:");
     IStream_Release(stream);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = GetHGlobalFromStream(stream, &hglobal);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Save(moniker, stream, FALSE);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     length = GlobalSize(hglobal);
     data = GlobalLock(hglobal);
-    ok(length == 30, "Unexpected stream size %u.\n", length);
+    ok(length == 30, "Unexpected stream size %lu.\n", length);
     ok(IsEqualGUID((CLSID *)data, &CLSID_StdComponentCategoriesMgr), "Unexpected clsid.\n");
     data += sizeof(CLSID) / sizeof(*data);
-    ok(*data == 10, "Unexpected data length %u.\n", *data);
+    ok(*data == 10, "Unexpected data length %lu.\n", *data);
     data++;
     ok(!lstrcmpW((WCHAR *)data, L"data"), "Unexpected data.\n");
 
@@ -2021,10 +2021,10 @@ static void test_class_moniker(void)
 
     /* Extra data does not affect comparison */
     hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &length);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(length == sizeof(expected_class_moniker_comparison_data), "Unexpected comparison data length %u.\n", length);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(length == sizeof(expected_class_moniker_comparison_data), "Unexpected comparison data length %lu.\n", length);
     ok(!memcmp(buffer, expected_class_moniker_comparison_data, length), "Unexpected data.\n");
     IROTData_Release(rotdata);
 
@@ -2034,11 +2034,11 @@ static void test_class_moniker(void)
     ok_ole_success(hr, CreateClassMoniker);
 
     hr = IMoniker_GetSizeMax(moniker, &size);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(size.LowPart == 20, "Unexpected size %u.\n", size.LowPart);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(size.LowPart == 20, "Unexpected size %lu.\n", size.LowPart);
 
     hr = IMoniker_QueryInterface(moniker, &CLSID_ClassMoniker, (void **)&unknown);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
     IUnknown_Release(unknown);
 
@@ -2054,7 +2054,7 @@ static void test_class_moniker(void)
     ok_ole_success(hr, IMoniker_Hash);
 
     ok(hash == CLSID_StdComponentCategoriesMgr.Data1,
-        "Hash value != Data1 field of clsid, instead was 0x%08x\n",
+        "Hash value != Data1 field of clsid, instead was 0x%08lx\n",
         hash);
 
     /* IsSystemMoniker test */
@@ -2062,13 +2062,13 @@ static void test_class_moniker(void)
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
-    ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
-    ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08x\n", hr);
+    ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     ok_ole_success(hr, IMoniker_BindToObject);
@@ -2079,30 +2079,30 @@ static void test_class_moniker(void)
     IUnknown_Release(unknown);
 
     hr = IMoniker_Inverse(moniker, &inverse);
-    ok(hr == S_OK, "Failed to get inverse, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
     IMoniker_Release(inverse);
 
     /* Reduce() */
     hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(reduced == moniker, "Unexpected moniker.\n");
     IMoniker_Release(reduced);
 
     /* Enum() */
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     hr = IMoniker_Enum(moniker, FALSE, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     IBindCtx_Release(bindctx);
 
@@ -2111,35 +2111,35 @@ static void test_class_moniker(void)
     /* C + A -> () */
     anti = create_antimoniker(1);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(anti);
 
     /* C + A2 -> () */
     anti = create_antimoniker(2);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(anti);
 
     /* C + (A,I) -> I */
     hr = create_moniker_from_desc("CA1I1", &c);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
     IMoniker_Release(moniker2);
     IMoniker_Release(c);
 
     /* C + (A2,I) -> I */
     hr = create_moniker_from_desc("CA1I1", &c);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
     IMoniker_Release(moniker2);
     IMoniker_Release(c);
@@ -2161,12 +2161,12 @@ static void test_file_moniker(WCHAR* path)
     ok_ole_success(hr, CreateFileMoniker); 
 
     hr = IMoniker_QueryInterface(moniker1, &CLSID_FileMoniker, (void **)&unk);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(unk == (IUnknown *)moniker1, "Unexpected interface.\n");
     IUnknown_Release(unk);
 
     hr = IMoniker_Inverse(moniker1, &inverse);
-    ok(hr == S_OK, "Failed to get inverse, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
     IMoniker_Release(inverse);
 
@@ -2190,41 +2190,41 @@ static void test_file_moniker(WCHAR* path)
 
     /* Reduce() */
     hr = CreateBindCtx(0, &bind_ctx);
-    ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
 
     hr = IMoniker_Reduce(moniker1, NULL, MKRREDUCE_ALL, NULL, &reduced);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     m3 = anti = create_antimoniker(1);
     hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, &m3, &reduced);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(reduced == moniker1, "Unexpected moniker.\n");
     ok(m3 == anti, "Unexpected pointer.\n");
     IMoniker_Release(reduced);
     IMoniker_Release(anti);
 
     hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, &reduced);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(reduced == moniker1, "Unexpected moniker.\n");
     IMoniker_Release(reduced);
 
     /* Enum() */
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker1, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker1, FALSE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     hr = IMoniker_Enum(moniker1, FALSE, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     IBindCtx_Release(bind_ctx);
 
@@ -2236,17 +2236,17 @@ static void test_file_moniker(WCHAR* path)
     /* F + A -> () */
     anti = create_antimoniker(1);
     hr = IMoniker_ComposeWith(moniker1, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(anti);
 
     /* I + A2 -> (A) */
     anti = create_antimoniker(2);
     hr = IMoniker_ComposeWith(moniker1, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
     hr = IMoniker_Hash(moniker2, &hash);
-    ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
     ok(hash == 0x80000001, "Unexpected hash.\n");
     IMoniker_Release(moniker2);
 
@@ -2305,11 +2305,11 @@ static void test_file_monikers(void)
 
     hr = StgCreateStorageEx(filename, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, STGFMT_STORAGE,
             0, NULL, NULL, &IID_IStorage, (void **)&storage);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IStorage_Release(storage);
 
     hr = CreateFileMoniker(filename, &moniker);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     check_interface(moniker, &IID_IMoniker, TRUE);
     todo_wine
@@ -2320,33 +2320,33 @@ static void test_file_monikers(void)
     check_interface(moniker, &IID_IMarshal, TRUE);
 
     hr = IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IStorage, (void **)&storage);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
-    ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#x.\n", hr);
+    ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#lx.\n", hr);
 
     bind_opts.cbStruct = sizeof(bind_opts);
     bind_opts.grfMode = STGM_READWRITE | STGM_SHARE_DENY_WRITE;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
-    ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#x.\n", hr);
+    ok(hr == STG_E_INVALIDFLAG, "Unexpected hr %#lx.\n", hr);
 
     bind_opts.grfMode = STGM_READ | STGM_SHARE_DENY_WRITE;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IStorage, (void **)&storage);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     memset(&statstg, 0, sizeof(statstg));
     hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(statstg.grfMode == (STGM_READ | STGM_SHARE_DENY_WRITE), "Unexpected mode %#x.\n", statstg.grfMode);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(statstg.grfMode == (STGM_READ | STGM_SHARE_DENY_WRITE), "Unexpected mode %#lx.\n", statstg.grfMode);
 
     IStorage_Release(storage);
     IBindCtx_Release(bindctx);
@@ -2356,16 +2356,16 @@ static void test_file_monikers(void)
 
     /* IsEqual() */
     hr = CreateFileMoniker(L"test.bmp", &moniker);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = CreateFileMoniker(L"TEST.bmp", &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker2);
     IMoniker_Release(moniker);
@@ -2454,10 +2454,10 @@ static void test_item_moniker(void)
     IStream *stream;
 
     hr = CreateItemMoniker(NULL, wszObjectName, &moniker);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_QueryInterface(moniker, &CLSID_ItemMoniker, (void **)&unknown);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
     IUnknown_Release(unknown);
 
@@ -2470,7 +2470,7 @@ static void test_item_moniker(void)
     IMoniker_Release(moniker);
 
     hr = CreateItemMoniker(L"", wszObjectName, &moniker);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     test_moniker("item moniker 3", moniker,
         expected_item_moniker_marshal_data3, sizeof(expected_item_moniker_marshal_data3),
@@ -2481,7 +2481,7 @@ static void test_item_moniker(void)
     IMoniker_Release(moniker);
 
     hr = CreateItemMoniker(L"&&", wszObjectName, &moniker);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     test_moniker("item moniker 4", moniker,
         expected_item_moniker_marshal_data4, sizeof(expected_item_moniker_marshal_data4),
@@ -2492,7 +2492,7 @@ static void test_item_moniker(void)
     IMoniker_Release(moniker);
 
     hr = CreateItemMoniker(L"ab", wszObjectName, &moniker);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     test_moniker("item moniker 5", moniker,
         expected_item_moniker_marshal_data5, sizeof(expected_item_moniker_marshal_data5),
@@ -2502,29 +2502,29 @@ static void test_item_moniker(void)
 
     /* Serialize and load back. */
     hr = CreateItemMoniker(NULL, L"object", &moniker2);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(item_moniker_data); ++i)
     {
         pos.QuadPart = 0;
         hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "Failed to seek stream, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to seek stream, hr %#lx.\n", hr);
 
         hr = IStream_Write(stream, item_moniker_data[i].data, item_moniker_data[i].data_len, NULL);
-        ok(hr == S_OK, "Failed to write stream contents, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to write stream contents, hr %#lx.\n", hr);
 
         pos.QuadPart = 0;
         hr = IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "Failed to seek stream, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to seek stream, hr %#lx.\n", hr);
 
         hr = IMoniker_Load(moniker2, stream);
-        ok(hr == S_OK, "Failed to load moniker, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to load moniker, hr %#lx.\n", hr);
 
         TEST_DISPLAY_NAME(moniker2, item_moniker_data[i].display_name);
     }
@@ -2539,11 +2539,11 @@ static void test_item_moniker(void)
     for (i = 0; i < ARRAY_SIZE(hash_tests); ++i)
     {
         hr = CreateItemMoniker(hash_tests[i].delim, hash_tests[i].item, &moniker);
-        ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
         hr = IMoniker_Hash(moniker, &hash);
-        ok(hr == S_OK, "Failed to get hash value, hr %#x.\n", hr);
-        ok(hash == hash_tests[i].hash, "%d: unexpected hash value %#x.\n", i, hash);
+        ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
+        ok(hash == hash_tests[i].hash, "%ld: unexpected hash value %#lx.\n", i, hash);
 
         IMoniker_Release(moniker);
     }
@@ -2564,154 +2564,154 @@ static void test_item_moniker(void)
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
-    ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08lx\n", hr);
 
     hr = IMoniker_IsRunning(moniker, NULL, &container_moniker->IMoniker_iface, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08x\n", hr);
+    ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08lx\n", hr);
 
     hr = CreateItemMoniker(wszDelimiter, wszObjectName, &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
 
     /* Different moniker as newly running. */
     hr = CreateItemMoniker(wszDelimiter, L"Item123", &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
-    ok(hr == S_OK, "Failed to get ROT, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get ROT, hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker, moniker, &cookie);
-    ok(hr == S_OK, "Failed to register, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to register, hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_IsRunning(rot, moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker2);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Revoke(rot, cookie);
-    ok(hr == S_OK, "Failed to revoke registration, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to revoke registration, hr %#lx.\n", hr);
 
     IRunningObjectTable_Release(rot);
 
     expected_method_list = methods_isrunning;
     hr = IMoniker_IsRunning(moniker, bindctx, &container_moniker->IMoniker_iface, NULL);
-    ok(hr == 0x8beef000, "Unexpected hr %#x.\n", hr);
+    ok(hr == 0x8beef000, "Unexpected hr %#lx.\n", hr);
 
     expected_method_list = methods_isrunning;
     hr = IMoniker_IsRunning(moniker, bindctx, &container_moniker->IMoniker_iface, moniker2);
-    ok(hr == 0x8beef000, "Unexpected hr %#x.\n", hr);
+    ok(hr == 0x8beef000, "Unexpected hr %#lx.\n", hr);
     expected_method_list = NULL;
 
     IMoniker_Release(moniker2);
 
     /* BindToObject() */
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
-    ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.cbStruct = sizeof(bind_opts);
     hr = IBindCtx_GetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to get bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get bind options, hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 1;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
-    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 2499;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
-    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 2500;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_BindToObject(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
-    ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#lx.\n", hr);
 
     /* BindToStorage() */
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
-    ok(hr == 0x8bee0001, "Unexpected hr %#x.\n", hr);
+    ok(hr == 0x8bee0001, "Unexpected hr %#lx.\n", hr);
 
     /* ParseDisplayName() */
     hr = IMoniker_ParseDisplayName(moniker, bindctx, NULL, displayname, &eaten, &moniker2);
-    ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_SYNTAX, "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 0;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
-    ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_INDEFINITE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 1;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
-    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 2499;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
-    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_IMMEDIATE), "Unexpected hr %#lx.\n", hr);
 
     bind_opts.dwTickCountDeadline = 2500;
     hr = IBindCtx_SetBindOptions(bindctx, &bind_opts);
-    ok(hr == S_OK, "Failed to set bind options, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set bind options, hr %#lx.\n", hr);
     hr = IMoniker_ParseDisplayName(moniker, bindctx, &container_moniker->IMoniker_iface, displayname, &eaten, &moniker2);
-    ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#x.\n", hr);
+    ok(hr == (0x8bee0000 | BINDSPEED_MODERATE), "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(&container_moniker->IMoniker_iface);
 
     IBindCtx_Release(bindctx);
 
     hr = IMoniker_Inverse(moniker, &inverse);
-    ok(hr == S_OK, "Failed to get inverse, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
     IMoniker_Release(inverse);
 
     /* Reduce() */
     hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(reduced == moniker, "Unexpected moniker.\n");
     IMoniker_Release(reduced);
 
     /* Enum() */
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     hr = IMoniker_Enum(moniker, FALSE, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker);
 
@@ -2719,16 +2719,16 @@ static void test_item_moniker(void)
     for (i = 0; i < ARRAY_SIZE(isequal_tests); ++i)
     {
         hr = CreateItemMoniker(isequal_tests[i].delim1, isequal_tests[i].item1, &moniker);
-        ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
         hr = CreateItemMoniker(isequal_tests[i].delim2, isequal_tests[i].item2, &moniker2);
-        ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
         hr = IMoniker_IsEqual(moniker, moniker2);
-        ok(hr == isequal_tests[i].hr, "%d: unexpected result %#x.\n", i, hr);
+        ok(hr == isequal_tests[i].hr, "%ld: unexpected result %#lx.\n", i, hr);
 
         hr = IMoniker_IsEqual(moniker2, moniker);
-        ok(hr == isequal_tests[i].hr, "%d: unexpected result %#x.\n", i, hr);
+        ok(hr == isequal_tests[i].hr, "%ld: unexpected result %#lx.\n", i, hr);
 
         IMoniker_Release(moniker);
         IMoniker_Release(moniker2);
@@ -2736,7 +2736,7 @@ static void test_item_moniker(void)
 
     /* Default instance. */
     hr = CoCreateInstance(&CLSID_ItemMoniker, NULL, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker);
-    ok(hr == S_OK, "Failed to create item moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create item moniker, hr %#lx.\n", hr);
 
     test_moniker("item moniker 6", moniker,
         expected_item_moniker_marshal_data6, sizeof(expected_item_moniker_marshal_data6),
@@ -2745,28 +2745,28 @@ static void test_item_moniker(void)
         34, L"");
 
     hr = CoCreateInstance(&CLSID_ItemMoniker, (IUnknown *)moniker, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker2);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker);
 
     /* ComposeWith() */
     hr = CreateItemMoniker(L"!", L"Item", &moniker);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     /* I + A -> () */
     anti = create_antimoniker(1);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(anti);
 
     /* I + A2 -> A */
     anti = create_antimoniker(2);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
     hr = IMoniker_Hash(moniker2, &hash);
-    ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
     ok(hash == 0x80000001, "Unexpected hash.\n");
     IMoniker_Release(moniker2);
 
@@ -2777,14 +2777,14 @@ static void test_item_moniker(void)
     /* Simplification has to through generic composite logic,
        even when resolved to non-composite, generic composite option has to be enabled. */
     hr = create_moniker_from_desc("CA1A3", &c);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
     hr = IMoniker_Hash(moniker2, &hash);
-    ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
     ok(hash == 0x80000003, "Unexpected hash.\n");
     IMoniker_Release(moniker2);
     IMoniker_Release(c);
@@ -2793,25 +2793,25 @@ static void test_item_moniker(void)
 
     /* CommonPrefixWith */
     hr = CreateItemMoniker(L"!", L"Item", &moniker);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
     hr = CreateItemMoniker(L"#", L"Item", &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected object.\n");
     IMoniker_Release(moniker3);
 
     IMoniker_Release(moniker2);
 
     hr = CreateItemMoniker(L"!", L"Item2", &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     moniker3 = (void *)0xdeadbeef;
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
     todo_wine
 {
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
     ok(!moniker3, "Unexpected object.\n");
 }
 
@@ -2821,19 +2821,19 @@ static void test_item_moniker(void)
 
     /* RelativePathTo() */
     hr = create_moniker_from_desc("I1", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = create_moniker_from_desc("I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, NULL, &moniker2);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, moniker1, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     moniker2 = (void *)0xdeadbeef;
     hr = IMoniker_RelativePathTo(moniker, moniker1, &moniker2);
-    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
 
     IMoniker_Release(moniker1);
@@ -2847,13 +2847,13 @@ static void stream_write_dword(IStream *stream, DWORD value)
 
     pos.QuadPart = 0;
     hr = IStream_Seek(stream, pos, 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);
 
     hr = IStream_Write(stream, &value, sizeof(value), NULL);
-    ok(hr == S_OK, "Stream write failed, hr %#x.\n", hr);
+    ok(hr == S_OK, "Stream write failed, hr %#lx.\n", hr);
 
     hr = IStream_Seek(stream, pos, 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);
 }
 
 static void test_anti_moniker(void)
@@ -2880,7 +2880,7 @@ static void test_anti_moniker(void)
     check_interface(moniker, &IID_IMarshal, TRUE);
 
     hr = IMoniker_QueryInterface(moniker, &CLSID_AntiMoniker, (void **)&unknown);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
     IUnknown_Release(unknown);
 
@@ -2894,14 +2894,14 @@ static void test_anti_moniker(void)
     hr = IMoniker_Hash(moniker, &hash);
     ok_ole_success(hr, IMoniker_Hash);
     ok(hash == 0x80000001,
-        "Hash value != 0x80000001, instead was 0x%08x\n",
+        "Hash value != 0x80000001, instead was 0x%08lx\n",
         hash);
 
     /* IsSystemMoniker test */
     TEST_MONIKER_TYPE(moniker, MKSYS_ANTIMONIKER);
 
     hr = IMoniker_Inverse(moniker, &inverse);
-    ok(hr == MK_E_NOINVERSE, "IMoniker_Inverse should have returned MK_E_NOINVERSE instead of 0x%08x\n", hr);
+    ok(hr == MK_E_NOINVERSE, "IMoniker_Inverse should have returned MK_E_NOINVERSE instead of 0x%08lx\n", hr);
     ok(inverse == NULL, "inverse should have been set to NULL instead of %p\n", inverse);
 
     hr = CreateBindCtx(0, &bindctx);
@@ -2909,28 +2909,28 @@ static void test_anti_moniker(void)
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08x\n", hr);
+    ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08lx\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
-    ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_NOTIMPL, "IMoniker_BindToObject should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_BindToObject should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_NOTIMPL, "IMoniker_BindToStorage should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_BindToStorage should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     /* ComposeWith */
     hr = CreateAntiMoniker(&moniker2);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
     moniker3 = moniker;
     hr = IMoniker_ComposeWith(moniker, moniker2, TRUE, &moniker3);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     ok(!moniker3, "Unexpected interface.\n");
 
     hr = IMoniker_ComposeWith(moniker, moniker2, FALSE, &moniker3);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker3, MKSYS_GENERICCOMPOSITE);
     IMoniker_Release(moniker3);
 
@@ -2938,15 +2938,15 @@ static void test_anti_moniker(void)
 
     /* Load with composed number > 1. */
     hr = CreateAntiMoniker(&moniker2);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
 
     stream_write_dword(stream, 2);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     test_moniker("anti moniker 2", moniker,
         expected_anti_moniker_marshal_data2, sizeof(expected_anti_moniker_marshal_data2),
@@ -2955,14 +2955,14 @@ static void test_anti_moniker(void)
         20, L"\\..\\..");
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker2, moniker);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == S_OK, "Failed to get hash value, hr %#x.\n", hr);
-    ok(hash == 0x80000002, "Unexpected hash value %#x.\n", hash);
+    ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
+    ok(hash == 0x80000002, "Unexpected hash value %#lx.\n", hash);
 
     /* Display name reflects anti combination. */
     TEST_DISPLAY_NAME(moniker, L"\\..\\..");
@@ -2971,36 +2971,36 @@ static void test_anti_moniker(void)
     stream_write_dword(stream, 0xfffff);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == S_OK, "Failed to get hash value, hr %#x.\n", hr);
-    ok(hash == 0x800fffff, "Unexpected hash value %#x.\n", hash);
+    ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
+    ok(hash == 0x800fffff, "Unexpected hash value %#lx.\n", hash);
 
     stream_write_dword(stream, 0xfffff + 1);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == S_OK, "Failed to get hash value, hr %#x.\n", hr);
-    ok(hash == 0x800fffff, "Unexpected hash value %#x.\n", hash);
+    ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
+    ok(hash == 0x800fffff, "Unexpected hash value %#lx.\n", hash);
 
     /* Zero combining counter is also valid. */
     stream_write_dword(stream, 0);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker2, moniker);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == S_OK, "Failed to get hash value, hr %#x.\n", hr);
-    ok(hash == 0x80000000, "Unexpected hash value %#x.\n", hash);
+    ok(hr == S_OK, "Failed to get hash value, hr %#lx.\n", hr);
+    ok(hash == 0x80000000, "Unexpected hash value %#lx.\n", hash);
 
     TEST_DISPLAY_NAME(moniker, L"");
 
@@ -3008,98 +3008,98 @@ static void test_anti_moniker(void)
     stream_write_dword(stream, 1);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker2, moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     /* Reduce() */
     hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &reduced);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(reduced == moniker, "Unexpected moniker.\n");
     IMoniker_Release(reduced);
 
     /* Enum() */
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker, "Unexpected pointer.\n");
 
     hr = IMoniker_Enum(moniker, FALSE, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     /* CommonPrefixWith() */
     stream_write_dword(stream, 0);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
     hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
     stream_write_dword(stream, 10);
 
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     stream_write_dword(stream, 5);
 
     hr = IMoniker_Load(moniker2, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
     hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
-    ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker2, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
     /* Now same length, 0 or 2 */
     stream_write_dword(stream, 0);
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     stream_write_dword(stream, 0);
     hr = IMoniker_Load(moniker2, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
     stream_write_dword(stream, 2);
     hr = IMoniker_Load(moniker, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     stream_write_dword(stream, 2);
     hr = IMoniker_Load(moniker2, stream);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected prefix moniker.\n");
     IMoniker_Release(moniker3);
 
@@ -3111,26 +3111,26 @@ static void test_anti_moniker(void)
     /* RelativePathTo() */
     moniker = create_antimoniker(1);
     hr = create_moniker_from_desc("I1", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, NULL, &moniker3);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, moniker2, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker2, "Unexpected object.\n");
     IMoniker_Release(moniker3);
     IMoniker_Release(moniker2);
 
     moniker2 = create_antimoniker(2);
     hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker2, "Unexpected object.\n");
     IMoniker_Release(moniker3);
     hr = IMoniker_RelativePathTo(moniker2, moniker, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker3 == moniker, "Unexpected object.\n");
     IMoniker_Release(moniker3);
 
@@ -3178,7 +3178,7 @@ static void test_generic_composite_moniker(void)
     ULONG len;
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create bind context, hr %#lx.\n", hr);
 
     for (i = 0; i < ARRAY_SIZE(simplify_tests); ++i)
     {
@@ -3189,20 +3189,20 @@ static void test_generic_composite_moniker(void)
         winetest_push_context("simplify[%u]", i);
 
         hr = create_moniker_from_desc(simplify_tests[i].left, &left);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         hr = create_moniker_from_desc(simplify_tests[i].right, &right);
-        ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
         hr = CreateGenericComposite(left, right, &composite);
-        ok(hr == S_OK, "Failed to create a composite, hr %#x.\n", hr);
+        ok(hr == S_OK, "Failed to create a composite, hr %#lx.\n", hr);
 
         if (composite)
         {
             hr = IMoniker_IsSystemMoniker(composite, &moniker_type);
-            ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-            ok(moniker_type == simplify_tests[i].result_type, "Unexpected result type %u.\n", moniker_type);
+            ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+            ok(moniker_type == simplify_tests[i].result_type, "Unexpected result type %lu.\n", moniker_type);
 
             hr = IMoniker_GetDisplayName(composite, bindctx, NULL, &name);
-            ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+            ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
             ok(!lstrcmpW(name, simplify_tests[i].name), "Unexpected result name %s.\n", wine_dbgstr_w(name));
             CoTaskMemFree(name);
 
@@ -3218,11 +3218,11 @@ static void test_generic_composite_moniker(void)
     }
 
     hr = CreateItemMoniker(L"!", L"Test", &moniker1);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
     hr = CreateItemMoniker(L"#", L"Wine", &moniker2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
     hr = CreateGenericComposite(moniker1, moniker2, &moniker);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     check_interface(moniker, &IID_IMoniker, TRUE);
     todo_wine
@@ -3232,13 +3232,13 @@ static void test_generic_composite_moniker(void)
     check_interface(moniker, &IID_IMarshal, TRUE);
 
     hr = CreateGenericComposite(moniker1, moniker2, &moniker);
-    ok(hr == S_OK, "Failed to create composite, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create composite, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
 
     /* Generic composite is special, as it does not addref in this case. */
     hr = IMoniker_QueryInterface(moniker, &CLSID_CompositeMoniker, (void **)&unknown);
     todo_wine
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     if (SUCCEEDED(hr))
         ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
 
@@ -3254,7 +3254,7 @@ static void test_generic_composite_moniker(void)
     ok_ole_success(hr, IMoniker_Hash);
 
     ok(hash == 0xd87,
-        "Hash value != 0xd87, instead was 0x%08x\n",
+        "Hash value != 0xd87, instead was 0x%08lx\n",
         hash);
 
     /* IsSystemMoniker test */
@@ -3265,88 +3265,88 @@ static void test_generic_composite_moniker(void)
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
-    ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08lx\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, bindctx, moniker1, moniker);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsRunning(moniker, NULL, moniker1, moniker);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
-    ok(hr == MK_E_NOTBINDABLE, "IMoniker_GetTimeOfLastChange should return MK_E_NOTBINDABLE, not 0x%08x\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "IMoniker_GetTimeOfLastChange should return MK_E_NOTBINDABLE, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IMoniker_BindToStorage should return E_INVALIDARG, not 0x%08lx\n", hr);
 
     hr = IMoniker_Inverse(moniker, &inverse);
-    ok(hr == S_OK, "Failed to get inverse, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
     IMoniker_Release(inverse);
 
     /* BindToObject() */
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker,
             moniker, &cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IUnknown_Release(unknown);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IMoniker, (void **)&unknown);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IUnknown_Release(unknown);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IDispatch, (void **)&unknown);
-    ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Revoke(rot, cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker);
 
     /* BindToObject() with moniker at left */
     hr = CreatePointerMoniker((IUnknown *)rot, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     /* (I1,P) */
     hr = create_moniker_from_desc("I1", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateGenericComposite(moniker2, moniker, &moniker3);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToObject(moniker3, bindctx, moniker2, &IID_IMoniker, (void **)&unknown);
-    ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
 
     /* Register (I1,I1,P), check if ROT is used for left != NULL case  */
     hr = CreateGenericComposite(moniker2, moniker3, &moniker4);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     cookie = 0;
     hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker4,
             moniker4, &cookie);
     todo_wine
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_BindToObject(moniker3, bindctx, moniker2, &IID_IMoniker, (void **)&unknown);
-    ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Revoke(rot, cookie);
     todo_wine
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker3);
     IMoniker_Release(moniker2);
@@ -3356,77 +3356,77 @@ static void test_generic_composite_moniker(void)
 
     /* Uninitialized composite */
     hr = CoCreateInstance(&CLSID_CompositeMoniker, NULL, CLSCTX_SERVER, &IID_IMoniker, (void **)&moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
     /* Exact error is E_OUTOFMEMORY */
     hr = IMoniker_Save(moniker, stream, TRUE);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
     IStream_Release(stream);
 
     hash = 0xdeadbeef;
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == E_UNEXPECTED, "Unexpected hr %#x.\n", hr);
-    ok(hash == 0xdeadbeef, "Unexpected hash %#x.\n", hash);
+    ok(hr == E_UNEXPECTED, "Unexpected hr %#lx.\n", hr);
+    ok(hash == 0xdeadbeef, "Unexpected hash %#lx.\n", hash);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IROTData_GetComparisonData(rotdata, NULL, 0, &len);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
     IROTData_Release(rotdata);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &len);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
     hr = IMarshal_MarshalInterface(marshal, stream, &IID_IMoniker, NULL, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
     IMarshal_Release(marshal);
 
     IMoniker_Release(moniker);
 
     /* GetTimeOfLastChange() */
     hr = create_moniker_from_desc("CI1I2", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = create_moniker_from_desc("I1", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     /* See if non-generic composition is possible */
     hr = IMoniker_ComposeWith(moniker1, moniker, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
 
     hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
-    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
-    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, NULL, NULL, &ft);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker,
             moniker, &cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
-    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
 
     hr = IRunningObjectTable_Revoke(rot, cookie);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     IRunningObjectTable_Release(rot);
 
@@ -3435,53 +3435,53 @@ static void test_generic_composite_moniker(void)
 
     /* CommonPrefixWith() */
     hr = create_moniker_from_desc("CI1I2", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = create_moniker_from_desc("CI1I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker1, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     moniker2 = (void *)0xdeadbeef;
     hr = IMoniker_CommonPrefixWith(moniker, NULL, &moniker2);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
 
     /* With itself */
     hr = IMoniker_CommonPrefixWith(moniker, moniker, &moniker2);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK && moniker2 != moniker, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK && moniker2 != moniker, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
 
     /* Equal composites */
     hr = IMoniker_CommonPrefixWith(moniker, moniker1, &moniker2);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     ok(moniker2 != moniker && moniker2 != moniker1, "Unexpected object.\n");
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
 
     hr = create_moniker_from_desc("I2", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
 
     hr = create_moniker_from_desc("I1", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &moniker3);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker2, moniker3);
     ok(hr == S_OK && moniker3 != moniker2, "Unexpected object.\n");
     IMoniker_Release(moniker3);
 
     hr = IMoniker_CommonPrefixWith(moniker2, moniker, &moniker3);
     todo_wine
-    ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
     if (SUCCEEDED(hr))
     {
         hr = IMoniker_IsEqual(moniker2, moniker3);
@@ -3496,31 +3496,31 @@ static void test_generic_composite_moniker(void)
 
     /* IsEqual() */
     hr = create_moniker_from_desc("CI1I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = create_moniker_from_desc("CI1I2", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker1, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker1, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker1, moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
     IMoniker_Release(moniker1);
 
     /* ComposeWith() */
     hr = create_moniker_from_desc("CI1I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = create_moniker_from_desc("I3", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_ComposeWith(moniker1, NULL, FALSE, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(moniker == moniker1, "Unexpected pointer.\n");
     IMoniker_Release(moniker);
 
     hr = IMoniker_ComposeWith(moniker1, NULL, TRUE, &moniker);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     ok(!moniker, "Unexpected pointer.\n");
 
     IMoniker_Release(moniker2);
@@ -3528,29 +3528,29 @@ static void test_generic_composite_moniker(void)
 
     /* Inverse() */
     hr = create_moniker_from_desc("CI1I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_Inverse(moniker1, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_Inverse(moniker1, &inverse);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
     TEST_DISPLAY_NAME(inverse, L"\\..\\..");
     IMoniker_Release(inverse);
     IMoniker_Release(moniker1);
 
     hr = create_moniker_from_desc("CA1A2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     inverse = (void *)0xdeadbeef;
     hr = IMoniker_Inverse(moniker1, &inverse);
-    ok(hr == MK_E_NOINVERSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOINVERSE, "Unexpected hr %#lx.\n", hr);
     ok(!inverse, "Unexpected pointer.\n");
     IMoniker_Release(moniker1);
 
     hr = create_moniker_from_desc("CI1A2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     inverse = (void *)0xdeadbeef;
     hr = IMoniker_Inverse(moniker1, &inverse);
-    ok(hr == MK_E_NOINVERSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOINVERSE, "Unexpected hr %#lx.\n", hr);
     ok(!inverse, "Unexpected pointer.\n");
     IMoniker_Release(moniker1);
 
@@ -3558,13 +3558,13 @@ static void test_generic_composite_moniker(void)
     m = create_test_moniker();
     m->inverse = "I5";
     hr = create_moniker_from_desc("I1", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = CreateGenericComposite(moniker1, &m->IMoniker_iface, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_GENERICCOMPOSITE);
     inverse = (void *)0xdeadbeef;
     hr = IMoniker_Inverse(moniker2, &inverse);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!inverse, "Unexpected pointer.\n");
     IMoniker_Release(moniker1);
 
@@ -3573,9 +3573,9 @@ static void test_generic_composite_moniker(void)
     m2->inverse = "I4";
 
     hr = CreateGenericComposite(&m2->IMoniker_iface, &m->IMoniker_iface, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_Inverse(moniker2, &inverse);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_GENERICCOMPOSITE);
     TEST_DISPLAY_NAME(inverse, L"!I5!I4");
     IMoniker_Release(inverse);
@@ -3588,25 +3588,25 @@ static void test_generic_composite_moniker(void)
 
     /* One component does not support it. */
     hr = create_moniker_from_desc("CPI1", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &str);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &str);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
 
     /* Comparison data, pointer component does not support it. */
     hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     len = 0;
     hr = IROTData_GetComparisonData(rotdata, buffer, sizeof(buffer), &len);
 todo_wine {
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
-    ok(!len, "Unexpected length %u.\n", len);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
+    ok(!len, "Unexpected length %lu.\n", len);
 }
     IROTData_Release(rotdata);
 
@@ -3614,17 +3614,17 @@ todo_wine {
 
     /* Reduce() */
     hr = create_moniker_from_desc("CI1I2", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_Reduce(moniker, NULL, MKRREDUCE_ALL, NULL, &moniker2);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Reduce(moniker, bindctx, MKRREDUCE_ALL, NULL, &moniker2);
-    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#lx.\n", hr);
     ok(moniker2 == moniker, "Unexpected object.\n");
     IMoniker_Release(moniker2);
 
@@ -3632,171 +3632,171 @@ todo_wine {
 
     /* Enum() */
     hr = create_moniker_from_desc("CI1CI2I3", &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Enum(moniker, FALSE, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     /* Forward direction */
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Next(enummoniker, 0, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     moniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
 
     len = 1;
     moniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(!len, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(!len, "Unexpected count %lu.\n", len);
     ok(!moniker2, "Unexpected pointer.\n");
 
     hr = IEnumMoniker_Skip(enummoniker, 0);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I1");
     IMoniker_Release(moniker2);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I2");
     IMoniker_Release(moniker2);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I3");
     IMoniker_Release(moniker2);
 
     len = 1;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
-    ok(!len, "Unexpected count %u.\n", len);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
+    ok(!len, "Unexpected count %lu.\n", len);
 
     hr = IEnumMoniker_Skip(enummoniker, 0);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Skip(enummoniker, 1);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Clone(enummoniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     enummoniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker2, "Unexpected pointer.\n");
 
     hr = IEnumMoniker_Reset(enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Skip(enummoniker, 2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I3");
     IMoniker_Release(moniker2);
 
     enummoniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker2, "Unexpected pointer.\n");
 
     IEnumMoniker_Release(enummoniker);
 
     /* Backward direction */
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == S_OK, "Failed to get enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enumerator, hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Next(enummoniker, 0, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     moniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, NULL);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
 
     len = 1;
     moniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Next(enummoniker, 0, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(!len, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(!len, "Unexpected count %lu.\n", len);
     ok(!moniker2, "Unexpected pointer.\n");
 
     hr = IEnumMoniker_Skip(enummoniker, 0);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I3");
     IMoniker_Release(moniker2);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I2");
     IMoniker_Release(moniker2);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I1");
     IMoniker_Release(moniker2);
 
     len = 1;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
-    ok(!len, "Unexpected count %u.\n", len);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
+    ok(!len, "Unexpected count %lu.\n", len);
 
     hr = IEnumMoniker_Skip(enummoniker, 0);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Skip(enummoniker, 1);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Clone(enummoniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     enummoniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker2, "Unexpected pointer.\n");
 
     hr = IEnumMoniker_Reset(enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IEnumMoniker_Skip(enummoniker, 2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     len = 0;
     hr = IEnumMoniker_Next(enummoniker, 1, &moniker2, &len);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-    ok(len == 1, "Unexpected count %u.\n", len);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
+    ok(len == 1, "Unexpected count %lu.\n", len);
     TEST_DISPLAY_NAME(moniker2, L"!I1");
     IMoniker_Release(moniker2);
 
     enummoniker2 = (void *)0xdeadbeef;
     hr = IEnumMoniker_Clone(enummoniker, &enummoniker2);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     ok(!enummoniker2, "Unexpected pointer.\n");
 
     IEnumMoniker_Release(enummoniker);
@@ -3805,15 +3805,15 @@ todo_wine {
 
     /* RelativePathTo() */
     hr = create_moniker_from_desc("CI1I2", &moniker1);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = create_moniker_from_desc("CI2I3", &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_RelativePathTo(moniker1, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker1, moniker2, &moniker3);
-    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#lx.\n", hr);
 
     IBindCtx_Release(bindctx);
 }
@@ -3837,10 +3837,10 @@ static void test_pointer_moniker(void)
     test_factory_init(&factory);
 
     hr = CreatePointerMoniker((IUnknown *)&factory.IClassFactory_iface, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = CreatePointerMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     check_interface(moniker, &IID_IMoniker, TRUE);
     todo_wine
@@ -3851,42 +3851,42 @@ static void test_pointer_moniker(void)
     check_interface(moniker, &IID_IROTData, FALSE);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IMoniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_QueryInterface(moniker, &CLSID_PointerMoniker, (void **)&unknown);
     ok(unknown == (IUnknown *)moniker, "Unexpected interface.\n");
     IUnknown_Release(unknown);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
-    ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
 
     hr = IMarshal_GetUnmarshalClass(marshal, NULL, NULL, 0, NULL, 0, &clsid);
-    ok(hr == S_OK, "Failed to get class, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get class, hr %#lx.\n", hr);
     ok(IsEqualGUID(&clsid, &CLSID_PointerMoniker), "Unexpected class %s.\n", wine_dbgstr_guid(&clsid));
 
     hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, CLSCTX_INPROC, NULL, 0, &size);
-    ok(hr == S_OK, "Failed to get marshal size, hr %#x.\n", hr);
-    ok(size > 0, "Unexpected size %d.\n", size);
+    ok(hr == S_OK, "Failed to get marshal size, hr %#lx.\n", hr);
+    ok(size > 0, "Unexpected size %ld.\n", size);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx.\n", hr);
 
     hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == S_OK, "Failed to marshal moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to marshal moniker, hr %#lx.\n", hr);
 
     pos.QuadPart = 0;
     IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
     hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker2);
-    ok(hr == S_OK, "Failed to unmarshal, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to unmarshal, hr %#lx.\n", hr);
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Expected equal moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Expected equal moniker, hr %#lx.\n", hr);
     IMoniker_Release(moniker2);
 
     IStream_Release(stream);
 
     IMarshal_Release(marshal);
 
-    ok(factory.refcount > 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     /* Display Name */
 
@@ -3894,20 +3894,20 @@ static void test_pointer_moniker(void)
     ok_ole_success(hr, CreateBindCtx);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     display_name = (void *)0xdeadbeef;
     hr = IMoniker_GetDisplayName(moniker, NULL, NULL, &display_name);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     ok(!display_name, "Unexpected pointer.\n");
 
     IBindCtx_Release(bindctx);
 
     hr = IMoniker_IsDirty(moniker);
-    ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", hr);
+    ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", hr);
 
     /* Saving */
 
@@ -3915,20 +3915,20 @@ static void test_pointer_moniker(void)
     ok_ole_success(hr, CreateStreamOnHGlobal);
 
     hr = IMoniker_Save(moniker, stream, TRUE);
-    ok(hr == E_NOTIMPL, "IMoniker_Save should have returned E_NOTIMPL instead of 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_Save should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
 
     IStream_Release(stream);
 
     /* Hashing */
     hr = IMoniker_Hash(moniker, &hash);
     ok_ole_success(hr, IMoniker_Hash);
-    ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#x.\n", hash);
+    ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#lx.\n", hash);
 
     /* IsSystemMoniker test */
     TEST_MONIKER_TYPE(moniker, MKSYS_POINTERMONIKER);
 
     hr = IMoniker_Inverse(moniker, &inverse);
-    ok(hr == S_OK, "Failed to get inverse, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
     IMoniker_Release(inverse);
 
@@ -3937,10 +3937,10 @@ static void test_pointer_moniker(void)
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
-    ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08lx\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
-    ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IMoniker_GetTimeOfLastChange should return E_NOTIMPL, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     ok_ole_success(hr, IMoniker_BindToObject);
@@ -3952,62 +3952,62 @@ static void test_pointer_moniker(void)
 
     IMoniker_Release(moniker);
 
-    ok(factory.refcount == 1, "Unexpected factory refcount %u.\n", factory.refcount);
+    ok(factory.refcount == 1, "Unexpected factory refcount %lu.\n", factory.refcount);
 
     hr = CreatePointerMoniker(NULL, &moniker);
     ok_ole_success(hr, CreatePointerMoniker);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08x\n", hr);
+    ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
-    ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08x\n", hr);
+    ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
 
     IBindCtx_Release(bindctx);
 
     /* Enum() */
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker);
 
     /* CommonPrefixWith() */
     hr = CreatePointerMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
     hr = CreatePointerMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker2);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, NULL, &prefix);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     ok(prefix == moniker, "Unexpected pointer.\n");
     IMoniker_Release(prefix);
 
     IMoniker_Release(moniker2);
 
     hr = CreatePointerMoniker((IUnknown *)moniker, &moniker2);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx.\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     IMoniker_Release(moniker2);
 
@@ -4016,14 +4016,14 @@ static void test_pointer_moniker(void)
     /* P + A -> () */
     anti = create_antimoniker(1);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(anti);
 
     /* P + A2 -> A */
     anti = create_antimoniker(2);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
-    ok(hr == S_OK, "Failed to compose, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
     IMoniker_Release(moniker2);
 
@@ -4034,43 +4034,43 @@ static void test_pointer_moniker(void)
 
     /* P + (A,A3) -> A3 */
     hr = create_moniker_from_desc("CA1A3", &c);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
     hr = IMoniker_Hash(moniker2, &hash);
-    ok(hr == S_OK, "Failed to get hash, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get hash, hr %#lx.\n", hr);
     ok(hash == 0x80000003, "Unexpected hash.\n");
     IMoniker_Release(moniker2);
     IMoniker_Release(c);
 
     /* P + (A,I) -> I */
     hr = create_moniker_from_desc("CA1I1", &c);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, TRUE, &moniker2);
-    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_ComposeWith(moniker, c, FALSE, &moniker2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker2, MKSYS_ITEMMONIKER);
     IMoniker_Release(moniker2);
     IMoniker_Release(c);
 
     /* RelativePathTo() */
     hr = create_moniker_from_desc("I1", &moniker3);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     moniker2 = (void *)0xdeadbeef;
     hr = IMoniker_RelativePathTo(moniker, NULL, &moniker2);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     hr = IMoniker_RelativePathTo(moniker, moniker3, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
     moniker2 = (void *)0xdeadbeef;
     hr = IMoniker_RelativePathTo(moniker, moniker3, &moniker2);
-    ok(hr == E_NOTIMPL, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
     ok(!moniker2, "Unexpected pointer.\n");
     IMoniker_Release(moniker3);
 
@@ -4097,13 +4097,13 @@ static void test_objref_moniker(void)
     test_factory_init(&factory);
 
     hr = CreateObjrefMoniker((IUnknown *)&factory.IClassFactory_iface, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
 
     hr = CreateObjrefMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IMoniker, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_QueryInterface(moniker, &CLSID_PointerMoniker, (void **)&unknown);
     ok(unknown == (IUnknown *)moniker, "Unexpected interface\n");
@@ -4114,78 +4114,78 @@ static void test_objref_moniker(void)
     IUnknown_Release(unknown);
 
     hr = IMoniker_QueryInterface(moniker, &IID_IMarshal, (void **)&marshal);
-    ok(hr == S_OK, "Failed to get interface, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to get interface, hr %#lx\n", hr);
 
     hr = IMarshal_GetUnmarshalClass(marshal, NULL, NULL, 0, NULL, 0, &clsid);
-    ok(hr == S_OK, "Failed to get class, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to get class, hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &CLSID_ObjrefMoniker), "Unexpected class %s\n", wine_dbgstr_guid(&clsid));
 
     hr = IMarshal_GetMarshalSizeMax(marshal, &IID_IMoniker, NULL, CLSCTX_INPROC, NULL, 0, &size);
-    ok(hr == S_OK, "Failed to get marshal size, hr %#x\n", hr);
-    ok(size > 0, "Unexpected size %d\n", size);
+    ok(hr == S_OK, "Failed to get marshal size, hr %#lx\n", hr);
+    ok(size > 0, "Unexpected size %ld\n", size);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "Failed to create a stream, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to create a stream, hr %#lx\n", hr);
 
     hr = CoMarshalInterface(stream, &IID_IMoniker, (IUnknown *)moniker, MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL);
-    ok(hr == S_OK, "Failed to marshal moniker, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to marshal moniker, hr %#lx\n", hr);
 
     pos.QuadPart = 0;
     IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
     hr = CoUnmarshalInterface(stream, &IID_IMoniker, (void **)&moniker2);
-    ok(hr == S_OK, "Failed to unmarshal, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to unmarshal, hr %#lx\n", hr);
     hr = IMoniker_IsEqual(moniker, moniker2);
     todo_wine
-    ok(hr == S_OK, "Expected equal moniker, hr %#x\n", hr);
+    ok(hr == S_OK, "Expected equal moniker, hr %#lx\n", hr);
     IMoniker_Release(moniker2);
 
     IStream_Release(stream);
 
     IMarshal_Release(marshal);
 
-    ok(factory.refcount > 1, "Unexpected factory refcount %u\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu\n", factory.refcount);
 
     /* Display Name */
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "CreateBindCtx failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CreateBindCtx failed: 0x%08lx\n", hr);
 
     hr = IMoniker_GetDisplayName(moniker, bindctx, NULL, &display_name);
     todo_wine
-    ok(hr == S_OK, "IMoniker_GetDisplayName failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_GetDisplayName failed: 0x%08lx\n", hr);
 
     IBindCtx_Release(bindctx);
 
     hr = IMoniker_IsDirty(moniker);
-    ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08x\n", hr);
+    ok(hr == S_FALSE, "IMoniker_IsDirty should return S_FALSE, not 0x%08lx\n", hr);
 
     /* IROTData::GetComparisonData test */
 
     hr = IMoniker_QueryInterface(moniker, &IID_IROTData, (void **)&rotdata);
-    ok(hr == E_NOINTERFACE, "IMoniker_QueryInterface(IID_IROTData) should have returned E_NOINTERFACE instead of 0x%08x\n", hr);
+    ok(hr == E_NOINTERFACE, "IMoniker_QueryInterface(IID_IROTData) should have returned E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     /* Saving */
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
-    ok(hr == S_OK, "CreateStreamOnHGlobal failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CreateStreamOnHGlobal failed: 0x%08lx\n", hr);
 
     hr = IMoniker_Save(moniker, stream, TRUE);
     todo_wine
-    ok(hr == S_OK, "IMoniker_Save failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_Save failed: 0x%08lx\n", hr);
 
     IStream_Release(stream);
 
     /* Hashing */
     hr = IMoniker_Hash(moniker, &hash);
-    ok(hr == S_OK, "IMoniker_Hash failed: 0x%08x\n", hr);
-    ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#x\n", hash);
+    ok(hr == S_OK, "IMoniker_Hash failed: 0x%08lx\n", hr);
+    ok(hash == PtrToUlong(&factory.IClassFactory_iface), "Unexpected hash value %#lx\n", hash);
 
     /* IsSystemMoniker test */
     TEST_MONIKER_TYPE(moniker, MKSYS_OBJREFMONIKER);
 
     hr = IMoniker_Inverse(moniker, &inverse);
     todo_wine
-    ok(hr == S_OK, "Failed to get inverse, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to get inverse, hr %#lx\n", hr);
 if (hr == S_OK)
 {
     TEST_MONIKER_TYPE(inverse, MKSYS_ANTIMONIKER);
@@ -4193,85 +4193,85 @@ if (hr == S_OK)
 }
 
     hr = CreateBindCtx(0, &bindctx);
-    ok(hr == S_OK, "CreateBindCtx failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CreateBindCtx failed: 0x%08lx\n", hr);
 
     /* IsRunning test */
     hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
     todo_wine
-    ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_IsRunning should return S_OK, not 0x%08lx\n", hr);
 
     hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &filetime);
-    ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08x\n", hr);
+    ok(hr == MK_E_UNAVAILABLE, "IMoniker_GetTimeOfLastChange should return MK_E_UNAVAILABLE, not 0x%08lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     todo_wine
-    ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08lx\n", hr);
     if (hr == S_OK)
         IUnknown_Release(unknown);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     todo_wine
-    ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IMoniker_BindToObject failed: 0x%08lx\n", hr);
     if (hr == S_OK)
         IUnknown_Release(unknown);
 
     IMoniker_Release(moniker);
 
     todo_wine
-    ok(factory.refcount > 1, "Unexpected factory refcount %u\n", factory.refcount);
+    ok(factory.refcount > 1, "Unexpected factory refcount %lu\n", factory.refcount);
 
     hr = CreateObjrefMoniker(NULL, &moniker);
-    ok(hr == S_OK, "CreateObjrefMoniker failed, hr %#x\n", hr);
+    ok(hr == S_OK, "CreateObjrefMoniker failed, hr %#lx\n", hr);
 
     hr = IMoniker_BindToObject(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     todo_wine
-    ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08x\n", hr);
+    ok(hr == E_UNEXPECTED, "IMoniker_BindToObject should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
 
     hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
     todo_wine
-    ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08x\n", hr);
+    ok(hr == E_UNEXPECTED, "IMoniker_BindToStorage should have returned E_UNEXPECTED instead of 0x%08lx\n", hr);
 
     IBindCtx_Release(bindctx);
 
     /* Enum() */
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, TRUE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
     ok(enummoniker == NULL, "got %p\n", enummoniker);
 
     enummoniker = (void *)0xdeadbeef;
     hr = IMoniker_Enum(moniker, FALSE, &enummoniker);
-    ok(hr == S_OK, "Unexpected hr %#x\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
     ok(enummoniker == NULL, "got %p\n", enummoniker);
 
     IMoniker_Release(moniker);
 
     /* CommonPrefixWith() */
     hr = CreateObjrefMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker);
-    ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#x\n", hr);
+    ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#lx\n", hr);
 
     hr = CreateObjrefMoniker((IUnknown *)&factory.IClassFactory_iface, &moniker2);
-    ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#x\n", hr);
+    ok(hr == S_OK, "CreateObjrefMoniker failed: hr %#lx\n", hr);
 
     hr = IMoniker_IsEqual(moniker, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
     todo_wine
-    ok(hr == S_OK, "Unexpected hr %#x\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, NULL);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, NULL, &prefix);
     todo_wine
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
     todo_wine
-    ok(hr == MK_S_US, "Unexpected hr %#x\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx\n", hr);
 if (hr == S_OK)
 {
     ok(prefix == moniker, "Unexpected pointer\n");
@@ -4281,15 +4281,15 @@ if (hr == S_OK)
     IMoniker_Release(moniker2);
 
     hr = CreateObjrefMoniker((IUnknown *)moniker, &moniker2);
-    ok(hr == S_OK, "Failed to create moniker, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to create moniker, hr %#lx\n", hr);
 
     hr = IMoniker_IsEqual(moniker, moniker2);
     todo_wine
-    ok(hr == S_FALSE, "Unexpected hr %#x\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx\n", hr);
 
     hr = IMoniker_CommonPrefixWith(moniker, moniker2, &prefix);
     todo_wine
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx\n", hr);
 
     IMoniker_Release(moniker2);
 
@@ -4299,7 +4299,7 @@ if (hr == S_OK)
     anti = create_antimoniker(1);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
     todo_wine
-    ok(hr == S_OK, "Failed to compose, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx\n", hr);
     if (hr == S_OK)
         ok(!moniker2, "Unexpected pointer\n");
     IMoniker_Release(anti);
@@ -4308,7 +4308,7 @@ if (hr == S_OK)
     anti = create_antimoniker(2);
     hr = IMoniker_ComposeWith(moniker, anti, TRUE, &moniker2);
     todo_wine
-    ok(hr == S_OK, "Failed to compose, hr %#x\n", hr);
+    ok(hr == S_OK, "Failed to compose, hr %#lx\n", hr);
 if (hr == S_OK)
 {
     TEST_MONIKER_TYPE(moniker2, MKSYS_ANTIMONIKER);
@@ -4335,22 +4335,22 @@ static void test_bind_context(void)
     static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0};
 
     hr = CreateBindCtx(0, NULL);
-    ok(hr == E_INVALIDARG, "CreateBindCtx with NULL ppbc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CreateBindCtx with NULL ppbc should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CreateBindCtx(0xdeadbeef, &pBindCtx);
-    ok(hr == E_INVALIDARG, "CreateBindCtx with reserved value non-zero should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "CreateBindCtx with reserved value non-zero should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CreateBindCtx(0, &pBindCtx);
     ok_ole_success(hr, "CreateBindCtx");
 
     hr = IBindCtx_GetRunningObjectTable(pBindCtx, NULL);
-    ok(FAILED(hr), "Unexpected hr %#x.\n", hr);
+    ok(FAILED(hr), "Unexpected hr %#lx.\n", hr);
 
     hr = IBindCtx_GetRunningObjectTable(pBindCtx, &rot);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
 
     hr = GetRunningObjectTable(0, &rot2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(rot == rot2, "Unexpected ROT instance.\n");
     IRunningObjectTable_Release(rot);
     IRunningObjectTable_Release(rot2);
@@ -4359,36 +4359,36 @@ static void test_bind_context(void)
     hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
     ok_ole_success(hr, "IBindCtx_GetBindOptions");
     ok(bind_opts.cbStruct == sizeof(BIND_OPTS3) || broken(bind_opts.cbStruct == sizeof(BIND_OPTS2)) /* XP */,
-        "Unexpected bind_opts.cbStruct %d.\n", bind_opts.cbStruct);
+        "Unexpected bind_opts.cbStruct %ld.\n", bind_opts.cbStruct);
 
     bind_opts.cbStruct = sizeof(BIND_OPTS);
     hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
     ok_ole_success(hr, "IBindCtx_GetBindOptions");
-    ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct);
+    ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %ld\n", bind_opts.cbStruct);
 
     memset(&bind_opts, 0xfe, sizeof(bind_opts));
     bind_opts.cbStruct = sizeof(bind_opts);
     hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
     ok_ole_success(hr, "IBindCtx_GetBindOptions");
     ok(bind_opts.cbStruct == sizeof(bind_opts) || bind_opts.cbStruct == sizeof(BIND_OPTS2) /* XP */,
-        "Unexpected bind_opts.cbStruct %d.\n", bind_opts.cbStruct);
-    ok(bind_opts.grfFlags == 0, "bind_opts.grfFlags was 0x%x instead of 0\n", bind_opts.grfFlags);
-    ok(bind_opts.grfMode == STGM_READWRITE, "bind_opts.grfMode was 0x%x instead of STGM_READWRITE\n", bind_opts.grfMode);
-    ok(bind_opts.dwTickCountDeadline == 0, "bind_opts.dwTickCountDeadline was %d instead of 0\n", bind_opts.dwTickCountDeadline);
-    ok(bind_opts.dwTrackFlags == 0, "bind_opts.dwTrackFlags was 0x%x instead of 0\n", bind_opts.dwTrackFlags);
+        "Unexpected bind_opts.cbStruct %ld.\n", bind_opts.cbStruct);
+    ok(bind_opts.grfFlags == 0, "bind_opts.grfFlags was 0x%lx instead of 0\n", bind_opts.grfFlags);
+    ok(bind_opts.grfMode == STGM_READWRITE, "bind_opts.grfMode was 0x%lx instead of STGM_READWRITE\n", bind_opts.grfMode);
+    ok(bind_opts.dwTickCountDeadline == 0, "bind_opts.dwTickCountDeadline was %ld instead of 0\n", bind_opts.dwTickCountDeadline);
+    ok(bind_opts.dwTrackFlags == 0, "bind_opts.dwTrackFlags was 0x%lx instead of 0\n", bind_opts.dwTrackFlags);
     ok(bind_opts.dwClassContext == (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER),
-        "bind_opts.dwClassContext should have been 0x15 instead of 0x%x\n", bind_opts.dwClassContext);
-    ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%x instead of 0x%x\n", GetThreadLocale(), bind_opts.locale);
+        "bind_opts.dwClassContext should have been 0x15 instead of 0x%lx\n", bind_opts.dwClassContext);
+    ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%lx instead of 0x%lx\n", GetThreadLocale(), bind_opts.locale);
     ok(bind_opts.pServerInfo == NULL, "bind_opts.pServerInfo should have been NULL instead of %p\n", bind_opts.pServerInfo);
     if (bind_opts.cbStruct >= sizeof(BIND_OPTS3))
         ok(bind_opts.hwnd == NULL, "Unexpected bind_opts.hwnd %p.\n", bind_opts.hwnd);
 
     bind_opts.cbStruct = -1;
     hr = IBindCtx_SetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
-    ok(hr == E_INVALIDARG, "IBindCtx_SetBindOptions with bad cbStruct should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IBindCtx_SetBindOptions with bad cbStruct should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = IBindCtx_RegisterObjectParam(pBindCtx, (WCHAR *)wszParamName, NULL);
-    ok(hr == E_INVALIDARG, "IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IBindCtx_RegisterObjectParam should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     unknown = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown));
     unknown->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl;
@@ -4401,21 +4401,21 @@ static void test_bind_context(void)
     IUnknown_Release(param_obj);
 
     hr = IBindCtx_GetObjectParam(pBindCtx, (WCHAR *)wszNonExistent, &param_obj);
-    ok(hr == E_FAIL, "IBindCtx_GetObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08x\n", hr);
+    ok(hr == E_FAIL, "IBindCtx_GetObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08lx\n", hr);
     ok(param_obj == NULL, "IBindCtx_GetObjectParam with nonexistent key should have set output parameter to NULL instead of %p\n", param_obj);
 
     hr = IBindCtx_RevokeObjectParam(pBindCtx, (WCHAR *)wszNonExistent);
-    ok(hr == E_FAIL, "IBindCtx_RevokeObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08x\n", hr);
+    ok(hr == E_FAIL, "IBindCtx_RevokeObjectParam with nonexistent key should have failed with E_FAIL instead of 0x%08lx\n", hr);
 
     hr = IBindCtx_EnumObjectParam(pBindCtx, &pEnumString);
-    ok(hr == E_NOTIMPL, "IBindCtx_EnumObjectParam should have returned E_NOTIMPL instead of 0x%08x\n", hr);
+    ok(hr == E_NOTIMPL, "IBindCtx_EnumObjectParam should have returned E_NOTIMPL instead of 0x%08lx\n", hr);
     ok(!pEnumString, "pEnumString should be NULL\n");
 
     hr = IBindCtx_RegisterObjectBound(pBindCtx, NULL);
     ok_ole_success(hr, "IBindCtx_RegisterObjectBound(NULL)");
 
     hr = IBindCtx_RevokeObjectBound(pBindCtx, NULL);
-    ok(hr == E_INVALIDARG, "IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "IBindCtx_RevokeObjectBound(NULL) should have return E_INVALIDARG instead of 0x%08lx\n", hr);
 
     unknown2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown));
     unknown2->IUnknown_iface.lpVtbl = &HeapUnknown_Vtbl;
@@ -4427,15 +4427,15 @@ static void test_bind_context(void)
     ok_ole_success(hr, "IBindCtx_RevokeObjectBound");
 
     hr = IBindCtx_RevokeObjectBound(pBindCtx, &unknown2->IUnknown_iface);
-    ok(hr == MK_E_NOTBOUND, "IBindCtx_RevokeObjectBound with not bound object should have returned MK_E_NOTBOUND instead of 0x%08x\n", hr);
+    ok(hr == MK_E_NOTBOUND, "IBindCtx_RevokeObjectBound with not bound object should have returned MK_E_NOTBOUND instead of 0x%08lx\n", hr);
 
     IBindCtx_Release(pBindCtx);
 
     refs = IUnknown_Release(&unknown->IUnknown_iface);
-    ok(!refs, "object param should have been destroyed, instead of having %d refs\n", refs);
+    ok(!refs, "object param should have been destroyed, instead of having %ld refs\n", refs);
 
     refs = IUnknown_Release(&unknown2->IUnknown_iface);
-    ok(!refs, "bound object should have been destroyed, instead of having %d refs\n", refs);
+    ok(!refs, "bound object should have been destroyed, instead of having %ld refs\n", refs);
 }
 
 static void test_save_load_filemoniker(void)
@@ -4510,83 +4510,83 @@ static void test_MonikerCommonPrefixWith(void)
     moniker = (void *)0xdeadbeef;
     hr = MonikerCommonPrefixWith(NULL, NULL, &moniker);
 todo_wine {
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
     ok(!moniker, "Unexpected pointer.\n");
 }
     if (hr == E_NOTIMPL)
         return;
 
     hr = CreateItemMoniker(L"!", L"Item", &item);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     moniker = (void *)0xdeadbeef;
     hr = MonikerCommonPrefixWith(item, NULL, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
     ok(!moniker, "Unexpected pointer.\n");
 
     moniker = (void *)0xdeadbeef;
     hr = MonikerCommonPrefixWith(NULL, item, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
     ok(!moniker, "Unexpected pointer.\n");
 
     hr = MonikerCommonPrefixWith(item, item, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateFileMoniker(L"C:\\test.txt", &file1);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = MonikerCommonPrefixWith(file1, NULL, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     hr = MonikerCommonPrefixWith(NULL, file1, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     /* F x F */
     hr = MonikerCommonPrefixWith(file1, file1, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateFileMoniker(L"C:\\a\\test.txt", &file2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     /* F1 x F2 */
     hr = MonikerCommonPrefixWith(file1, file2, &moniker);
-    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_E_NOPREFIX, "Unexpected hr %#lx.\n", hr);
 
     hr = CreateGenericComposite(file1, item, &composite);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     hr = CreateGenericComposite(file2, item, &composite2);
-    ok(hr == S_OK, "Failed to create a moniker, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create a moniker, hr %#lx.\n", hr);
 
     /* F x (F,I) -> F */
     hr = MonikerCommonPrefixWith(file1, composite, &moniker);
-    ok(hr == MK_S_ME, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_ME, "Unexpected hr %#lx.\n", hr);
     ok(moniker == file1, "Unexpected pointer.\n");
     IMoniker_Release(moniker);
 
     /* F1 x (F2,I) -> F */
     hr = MonikerCommonPrefixWith(file1, composite2, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker, MKSYS_FILEMONIKER);
     TEST_DISPLAY_NAME(moniker, L"C:\\");
     IMoniker_Release(moniker);
 
     /* (F2,I) x F1 -> F */
     hr = MonikerCommonPrefixWith(composite2, file1, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker, MKSYS_FILEMONIKER);
     TEST_DISPLAY_NAME(moniker, L"C:\\");
     IMoniker_Release(moniker);
 
     /* (F,I) x (F) -> F */
     hr = MonikerCommonPrefixWith(composite, file1, &moniker);
-    ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_HIM, "Unexpected hr %#lx.\n", hr);
     ok(moniker == file1, "Unexpected pointer.\n");
     IMoniker_Release(moniker);
 
     /* (F,I) x (F,I) -> (F,I) */
     hr = MonikerCommonPrefixWith(composite, composite, &moniker);
-    ok(hr == MK_S_US, "Unexpected hr %#x.\n", hr);
+    ok(hr == MK_S_US, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
     TEST_DISPLAY_NAME(moniker, L"C:\\test.txt!Item");
     ok(moniker != composite, "Unexpected pointer.\n");
@@ -4594,7 +4594,7 @@ todo_wine {
 
     /* (F1,I) x (F2,I) -> () */
     hr = MonikerCommonPrefixWith(composite, composite2, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     ok(!moniker, "Unexpected pointer %p.\n", moniker);
 
     IMoniker_Release(composite2);
@@ -4602,11 +4602,11 @@ todo_wine {
 
     /* (I1,(I2,I3)) x ((I1,I2),I4) */
     hr = create_moniker_from_desc("CI1CI2I3", &composite);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = create_moniker_from_desc("CCI1I2I4", &composite2);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     hr = MonikerCommonPrefixWith(composite, composite2, &moniker);
-    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
     TEST_MONIKER_TYPE(moniker, MKSYS_GENERICCOMPOSITE);
     TEST_DISPLAY_NAME(moniker, L"!I1!I2");
     IMoniker_Release(moniker);
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index c463e74c8cb..f910fc1427d 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -33,7 +33,7 @@
 
 #include "wine/test.h"
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
 #define DEFINE_EXPECT(func) \
     static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
@@ -163,11 +163,11 @@ static void inline check_expected_method_fmt(const char *method_name, const FORM
             {
                 ok(fmt->cfFormat == expected_method_list->fmt.cfFormat, "got cf %04x vs %04x\n",
                    fmt->cfFormat, expected_method_list->fmt.cfFormat );
-                ok(fmt->dwAspect == expected_method_list->fmt.dwAspect, "got aspect %d vs %d\n",
+                ok(fmt->dwAspect == expected_method_list->fmt.dwAspect, "got aspect %ld vs %ld\n",
                    fmt->dwAspect, expected_method_list->fmt.dwAspect );
-                ok(fmt->lindex == expected_method_list->fmt.lindex, "got lindex %d vs %d\n",
+                ok(fmt->lindex == expected_method_list->fmt.lindex, "got lindex %ld vs %ld\n",
                    fmt->lindex, expected_method_list->fmt.lindex );
-                ok(fmt->tymed == expected_method_list->fmt.tymed, "got tymed %d vs %d\n",
+                ok(fmt->tymed == expected_method_list->fmt.tymed, "got tymed %ld vs %ld\n",
                    fmt->tymed, expected_method_list->fmt.tymed );
             }
         }
@@ -515,7 +515,7 @@ static HRESULT WINAPI OleObject_GetMiscStatus
 {
     CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus");
 
-    ok(aspect == DVASPECT_CONTENT, "got aspect %d\n", aspect);
+    ok(aspect == DVASPECT_CONTENT, "got aspect %ld\n", aspect);
 
     if (g_GetMiscStatusFailsWith == S_OK)
     {
@@ -697,11 +697,11 @@ static HRESULT WINAPI OleObjectCache_Cache
             ok((pformatetc->ptd != NULL) == (g_expected_fetc->ptd != NULL),
                     "ptd: %p\n", pformatetc->ptd);
             ok(pformatetc->dwAspect == g_expected_fetc->dwAspect,
-                    "dwAspect: %x\n", pformatetc->dwAspect);
+                    "dwAspect: %lx\n", pformatetc->dwAspect);
             ok(pformatetc->lindex == g_expected_fetc->lindex,
-                    "lindex: %x\n", pformatetc->lindex);
+                    "lindex: %lx\n", pformatetc->lindex);
             ok(pformatetc->tymed == g_expected_fetc->tymed,
-                    "tymed: %x\n", pformatetc->tymed);
+                    "tymed: %lx\n", pformatetc->tymed);
         }
     } else
         ok(pformatetc == NULL, "pformatetc should be NULL\n");
@@ -907,7 +907,7 @@ static HRESULT WINAPI viewobject_Draw(IViewObject *iface, DWORD aspect, LONG ind
     LPCRECTL bounds, LPCRECTL wbounds, BOOL (STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue),
     ULONG_PTR dwContinue)
 {
-    ok(index == -1, "index=%d\n", index);
+    ok(index == -1, "index=%ld\n", index);
     return S_OK;
 }
 
@@ -1024,21 +1024,21 @@ static void test_OleCreate(IStorage *pStorage)
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     expected_method_list = methods_olerender_draw;
     hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_DRAW, NULL, NULL, pStorage, (void **)&pObject);
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     expected_method_list = methods_olerender_draw_with_site;
     hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_DRAW, NULL, (IOleClientSite*)0xdeadbeef, pStorage, (void **)&pObject);
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     /* GetMiscStatus fails */
     g_GetMiscStatusFailsWith = 0x8fafefaf;
@@ -1047,7 +1047,7 @@ static void test_OleCreate(IStorage *pStorage)
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
     g_GetMiscStatusFailsWith = S_OK;
 
     formatetc.cfFormat = CF_TEXT;
@@ -1059,20 +1059,20 @@ static void test_OleCreate(IStorage *pStorage)
     hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_FORMAT, &formatetc, (IOleClientSite *)0xdeadbeef, pStorage, (void **)&pObject);
     ok(hr == S_OK ||
        broken(hr == E_INVALIDARG), /* win2k */
-       "OleCreate failed with error 0x%08x\n", hr);
+       "OleCreate failed with error 0x%08lx\n", hr);
     if (pObject)
     {
         IOleObject_Release(pObject);
         CHECK_NO_EXTRA_METHODS();
     }
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     expected_method_list = methods_olerender_asis;
     hr = OleCreate(&CLSID_Equation3, &IID_IOleObject, OLERENDER_ASIS, NULL, NULL, pStorage, (void **)&pObject);
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     formatetc.cfFormat = 0;
     formatetc.tymed = TYMED_NULL;
@@ -1090,7 +1090,7 @@ static void test_OleCreate(IStorage *pStorage)
     ok_ole_success(hr, "OleCreate");
     IOleObject_Release(pObject);
     CHECK_NO_EXTRA_METHODS();
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
     g_expected_fetc = NULL;
 }
 
@@ -1115,18 +1115,18 @@ static void test_OleLoad(IStorage *pStorage)
     hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject);
     ok(hr == S_OK ||
        broken(hr == E_INVALIDARG), /* win98 and win2k */
-       "OleLoad failed with error 0x%08x\n", hr);
+       "OleLoad failed with error 0x%08lx\n", hr);
     if(pObject)
     {
         DWORD dwStatus = 0xdeadbeef;
         hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus);
-        ok(hr == E_FAIL, "Got 0x%08x\n", hr);
-        ok(dwStatus == 0x1234, "Got 0x%08x\n", dwStatus);
+        ok(hr == E_FAIL, "Got 0x%08lx\n", hr);
+        ok(dwStatus == 0x1234, "Got 0x%08lx\n", dwStatus);
 
         IOleObject_Release(pObject);
         CHECK_NO_EXTRA_METHODS();
     }
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
     g_GetMiscStatusFailsWith = S_OK;
 
     /* Test again, let IOleObject_GetMiscStatus succeed. */
@@ -1134,18 +1134,18 @@ static void test_OleLoad(IStorage *pStorage)
     hr = OleLoad(pStorage, &IID_IOleObject, (IOleClientSite *)0xdeadbeef, (void **)&pObject);
     ok(hr == S_OK ||
        broken(hr == E_INVALIDARG), /* win98 and win2k */
-       "OleLoad failed with error 0x%08x\n", hr);
+       "OleLoad failed with error 0x%08lx\n", hr);
     if (pObject)
     {
         DWORD dwStatus = 0xdeadbeef;
         hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus);
-        ok(hr == S_OK, "Got 0x%08x\n", hr);
-        ok(dwStatus == 1, "Got 0x%08x\n", dwStatus);
+        ok(hr == S_OK, "Got 0x%08lx\n", hr);
+        ok(dwStatus == 1, "Got 0x%08lx\n", dwStatus);
 
         IOleObject_Release(pObject);
         CHECK_NO_EXTRA_METHODS();
     }
-    ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     for (fmt = CF_TEXT; fmt < CF_MAX; fmt++)
     {
@@ -1163,21 +1163,21 @@ static void test_OleLoad(IStorage *pStorage)
         for (i = 0; i < 7; i++)
         {
             hr = StgCreateDocfile(NULL, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &stg);
-            ok(hr == S_OK, "StgCreateDocfile error %#x\n", hr);
+            ok(hr == S_OK, "StgCreateDocfile error %#lx\n", hr);
 
             hr = IStorage_SetClass(stg, &CLSID_WineTest);
-            ok(hr == S_OK, "SetClass error %#x\n", hr);
+            ok(hr == S_OK, "SetClass error %#lx\n", hr);
 
             hr = IStorage_CreateStream(stg, olrepres, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stream);
-            ok(hr == S_OK, "CreateStream error %#x\n", hr);
+            ok(hr == S_OK, "CreateStream error %#lx\n", hr);
 
             data = ~0;
             hr = IStream_Write(stream, &data, sizeof(data), NULL);
-            ok(hr == S_OK, "Write error %#x\n", hr);
+            ok(hr == S_OK, "Write error %#lx\n", hr);
 
             data = fmt;
             hr = IStream_Write(stream, &data, sizeof(data), NULL);
-            ok(hr == S_OK, "Write error %#x\n", hr);
+            ok(hr == S_OK, "Write error %#lx\n", hr);
 
             switch (fmt)
             {
@@ -1211,10 +1211,10 @@ static void test_OleLoad(IStorage *pStorage)
             header.dwObjectExtentY = 1;
             header.dwSize = data_size;
             hr = IStream_Write(stream, &header, sizeof(header), NULL);
-            ok(hr == S_OK, "Write error %#x\n", hr);
+            ok(hr == S_OK, "Write error %#lx\n", hr);
 
             hr = IStream_Write(stream, buf, data_size, NULL);
-            ok(hr == S_OK, "Write error %#x\n", hr);
+            ok(hr == S_OK, "Write error %#lx\n", hr);
 
             IStream_Release(stream);
 
@@ -1225,19 +1225,19 @@ static void test_OleLoad(IStorage *pStorage)
                 IStorage_Release(stg);
                 continue;
             }
-            ok(hr == S_OK, "OleLoad error %#x: cfFormat = %u, advf = %#x\n", hr, fmt, header.advf);
+            ok(hr == S_OK, "OleLoad error %#lx: cfFormat = %lu, advf = %#lx\n", hr, fmt, header.advf);
 
             hdc = CreateCompatibleDC(0);
             SetRect(&rc, 0, 0, 100, 100);
             hr = OleDraw(obj, DVASPECT_CONTENT, hdc, &rc);
             DeleteDC(hdc);
             if (fmt == CF_METAFILEPICT)
-                ok(hr == S_OK, "OleDraw error %#x: cfFormat = %u, advf = %#x\n", hr, fmt, header.advf);
+                ok(hr == S_OK, "OleDraw error %#lx: cfFormat = %lu, advf = %#lx\n", hr, fmt, header.advf);
             else if (fmt == CF_ENHMETAFILE)
                 todo_wine
-                ok(hr == S_OK, "OleDraw error %#x: cfFormat = %u, advf = %#x\n", hr, fmt, header.advf);
+                ok(hr == S_OK, "OleDraw error %#lx: cfFormat = %lu, advf = %#lx\n", hr, fmt, header.advf);
             else
-                ok(hr == OLE_E_BLANK || hr == OLE_E_NOTRUNNING || hr == E_FAIL, "OleDraw should fail: %#x, cfFormat = %u, advf = %#x\n", hr, fmt, header.advf);
+                ok(hr == OLE_E_BLANK || hr == OLE_E_NOTRUNNING || hr == E_FAIL, "OleDraw should fail: %#lx, cfFormat = %lu, advf = %#lx\n", hr, fmt, header.advf);
 
             IUnknown_Release(obj);
             IStorage_Release(stg);
@@ -1534,7 +1534,7 @@ static void check_enum_cache(IOleCache2 *cache, const STATDATA *expect, int num)
     HRESULT hr;
 
     hr = IOleCache2_EnumCache( cache, &enum_stat );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     while (IEnumSTATDATA_Next(enum_stat, 1, &stat, NULL) == S_OK)
     {
@@ -1542,15 +1542,15 @@ static void check_enum_cache(IOleCache2 *cache, const STATDATA *expect, int num)
             stat.formatetc.cfFormat, expect->formatetc.cfFormat );
         ok( !stat.formatetc.ptd == !expect->formatetc.ptd, "got %p expect %p\n",
             stat.formatetc.ptd, expect->formatetc.ptd );
-        ok( stat.formatetc.dwAspect == expect->formatetc.dwAspect, "got %d expect %d\n",
+        ok( stat.formatetc.dwAspect == expect->formatetc.dwAspect, "got %ld expect %ld\n",
             stat.formatetc.dwAspect, expect->formatetc.dwAspect );
-        ok( stat.formatetc.lindex == expect->formatetc.lindex, "got %d expect %d\n",
+        ok( stat.formatetc.lindex == expect->formatetc.lindex, "got %ld expect %ld\n",
             stat.formatetc.lindex, expect->formatetc.lindex );
-        ok( stat.formatetc.tymed == expect->formatetc.tymed, "got %d expect %d\n",
+        ok( stat.formatetc.tymed == expect->formatetc.tymed, "got %ld expect %ld\n",
             stat.formatetc.tymed, expect->formatetc.tymed );
-        ok( stat.advf == expect->advf, "got %d expect %d\n", stat.advf, expect->advf );
+        ok( stat.advf == expect->advf, "got %ld expect %ld\n", stat.advf, expect->advf );
         ok( stat.pAdvSink == 0, "got %p\n", stat.pAdvSink );
-        ok( stat.dwConnection == expect->dwConnection, "got %d expect %d\n", stat.dwConnection, expect->dwConnection );
+        ok( stat.dwConnection == expect->dwConnection, "got %ld expect %ld\n", stat.dwConnection, expect->dwConnection );
         num--;
         expect++;
     }
@@ -1632,15 +1632,15 @@ static void test_data_cache(void)
 
     /* requested is not IUnknown */
     hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IOleCache2, (void**)&pOleCache);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(unk != (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
     ok(unk != (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
     IOleCache2_Release(pOleCache);
@@ -1648,13 +1648,13 @@ static void test_data_cache(void)
     IUnknown_Release(unk);
 
     hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void**)&unk2);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     ok(unk == (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
     ok(unk == (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
     ok(unk == unk2, "got %p, expected %p\n", unk2, unk);
@@ -1689,16 +1689,16 @@ static void test_data_cache(void)
     ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
 
     hr = IOleCache2_Uncache(pOleCache, 0xdeadbeef);
-    ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
+    ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%lx\n", hr);
 
     /* Both tests crash on NT4 and below. StgCreatePropSetStg is only available on w2k and above. */
     if (GetProcAddress(GetModuleHandleA("ole32.dll"), "StgCreatePropSetStg"))
     {
         hr = IOleCache2_Cache(pOleCache, NULL, 0, &dwConnection);
-        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
         hr = IOleCache2_Cache(pOleCache, NULL, 0, NULL);
-        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+        ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
     }
     else
     {
@@ -1717,15 +1717,15 @@ static void test_data_cache(void)
                 (fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
                 (fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
                 (fmtetc.cfFormat == CF_ENHMETAFILE && fmtetc.tymed == TYMED_ENHMF))
-                ok(hr == S_OK, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned S_OK instead of 0x%08x\n",
+                ok(hr == S_OK, "IOleCache_Cache cfFormat = %d, tymed = %ld should have returned S_OK instead of 0x%08lx\n",
                     fmtetc.cfFormat, fmtetc.tymed, hr);
             else if (fmtetc.tymed == TYMED_HGLOBAL)
                 ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED ||
                    broken(hr == S_OK && fmtetc.cfFormat == CF_BITMAP) /* Win9x & NT4 */,
-                    "IOleCache_Cache cfFormat = %d, tymed = %d should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08x\n",
+                    "IOleCache_Cache cfFormat = %d, tymed = %ld should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08lx\n",
                     fmtetc.cfFormat, fmtetc.tymed, hr);
             else
-                ok(hr == DV_E_TYMED, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned DV_E_TYMED instead of 0x%08x\n",
+                ok(hr == DV_E_TYMED, "IOleCache_Cache cfFormat = %d, tymed = %ld should have returned DV_E_TYMED instead of 0x%08lx\n",
                     fmtetc.cfFormat, fmtetc.tymed, hr);
             if (SUCCEEDED(hr))
             {
@@ -1758,7 +1758,7 @@ static void test_data_cache(void)
 
     fmtetc.dwAspect = DVASPECT_CONTENT;
     hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
-    ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08lx\n", hr);
 
     fmtetc.dwAspect = DVASPECT_ICON;
     hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
@@ -1769,7 +1769,7 @@ static void test_data_cache(void)
     todo_wine {
     ok_ole_success(hr, "IViewObject_Freeze");
     hr = IViewObject_Freeze(pViewObject, DVASPECT_CONTENT, -1, NULL, &dwFreeze);
-    ok(hr == OLE_E_BLANK, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_BLANK, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08lx\n", hr);
     }
 
     rcBounds.left = 0;
@@ -1782,7 +1782,7 @@ static void test_data_cache(void)
     ok_ole_success(hr, "IViewObject_Draw");
 
     hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
-    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08lx\n", hr);
 
     /* a NULL draw_continue fn ptr */
     hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef);
@@ -1792,7 +1792,7 @@ static void test_data_cache(void)
     hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef);
     ok(hr == E_ABORT ||
        broken(hr == S_OK), /* win9x may skip the callbacks */
-       "IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr);
+       "IViewObject_Draw with draw_continue_false returns 0x%08lx\n", hr);
 
     DeleteDC(hdcMem);
 
@@ -1806,7 +1806,7 @@ static void test_data_cache(void)
     ok_ole_success(hr, "IPersistStorage_SaveCompleted");
 
     hr = IPersistStorage_IsDirty(pPS);
-    ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
+    ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%lx\n", hr);
 
     IPersistStorage_Release(pPS);
     IViewObject_Release(pViewObject);
@@ -1833,7 +1833,7 @@ static void test_data_cache(void)
     ok_ole_success(hr, "IPersistStorage_Load");
 
     hr = IPersistStorage_IsDirty(pPS);
-    ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
+    ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%lx\n", hr);
 
     fmtetc.cfFormat = 0;
     fmtetc.dwAspect = DVASPECT_ICON;
@@ -1841,7 +1841,7 @@ static void test_data_cache(void)
     fmtetc.ptd = NULL;
     fmtetc.tymed = TYMED_MFPICT;
     hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
-    ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
+    ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%lx\n", hr);
 
     rcBounds.left = 0;
     rcBounds.top = 0;
@@ -1853,7 +1853,7 @@ static void test_data_cache(void)
     ok_ole_success(hr, "IViewObject_Draw");
 
     hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
-    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08lx\n", hr);
 
     /* unload the cached storage object, causing it to be reloaded */
     hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
@@ -1869,12 +1869,12 @@ static void test_data_cache(void)
     hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
     ok_ole_success(hr, "IOleCache2_DiscardCache");
     hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
-    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08lx\n", hr);
 
     DeleteDC(hdcMem);
 
     hr = IOleCache2_InitCache(pOleCache, &DataObject);
-    ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
+    ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08lx\n", hr);
 
     IPersistStorage_Release(pPS);
     IViewObject_Release(pViewObject);
@@ -1900,44 +1900,44 @@ static void test_data_cache(void)
     ok_ole_success(hr, "IOleCache_Cache");
 
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == OLE_E_BLANK, "got %08x\n", hr);
+    ok(hr == OLE_E_BLANK, "got %08lx\n", hr);
 
     fmtetc.cfFormat = cf_test_1;
     fmtetc.dwAspect = DVASPECT_CONTENT;
     fmtetc.tymed = TYMED_HGLOBAL;
 
     hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
-    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
+    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08lx\n", hr);
 
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == OLE_E_BLANK, "got %08x\n", hr);
+    ok(hr == OLE_E_BLANK, "got %08lx\n", hr);
 
     fmtetc.cfFormat = cf_test_2;
     hr = IOleCache2_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
-    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
+    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08lx\n", hr);
 
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == OLE_E_BLANK, "got %08x\n", hr);
+    ok(hr == OLE_E_BLANK, "got %08lx\n", hr);
 
     hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);
     ok_ole_success(hr, "IOleCacheControl_OnRun");
 
     fmtetc.cfFormat = cf_test_3;
     hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
-    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
+    ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08lx\n", hr);
 
     fmtetc.cfFormat = cf_test_1;
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == OLE_E_BLANK, "got %08x\n", hr);
+    ok(hr == OLE_E_BLANK, "got %08lx\n", hr);
 
     fmtetc.cfFormat = cf_test_2;
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     ReleaseStgMedium(&stgmedium);
 
     fmtetc.cfFormat = cf_test_3;
     hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
-    ok(hr == OLE_E_BLANK, "got %08x\n", hr);
+    ok(hr == OLE_E_BLANK, "got %08lx\n", hr);
 
     IOleCacheControl_Release(pOleCacheControl);
     IDataObject_Release(pCacheDataObject);
@@ -1971,18 +1971,18 @@ static IStorage *create_storage( int num )
     ULONG written;
 
     hr = StgCreateDocfile( NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &stg );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     hr = IStorage_SetClass( stg, &CLSID_Picture_Dib );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     hr = IStorage_CreateStream( stg, CONTENTS, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stm );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     if (num == 1) /* Set biXPelsPerMeter = 0 */
     {
         file_dib[0x26] = 0;
         file_dib[0x27] = 0;
     }
     hr = IStream_Write( stm, file_dib, sizeof(file_dib), &written );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     IStream_Release( stm );
     return stg;
 }
@@ -2009,31 +2009,31 @@ static void test_data_cache_dib_contents_stream(int num)
     };
 
     hr = CreateDataCache( NULL, &CLSID_Picture_Metafile, &IID_IUnknown, (void **)&unk );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     hr = IUnknown_QueryInterface( unk, &IID_IPersistStorage, (void **)&persist );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     hr = IUnknown_QueryInterface( unk, &IID_IDataObject, (void **)&data );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     hr = IUnknown_QueryInterface( unk, &IID_IViewObject2, (void **)&view );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     hr = IUnknown_QueryInterface( unk, &IID_IOleCache2, (void **)&cache );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
 
     stg = create_storage( num );
 
     hr = IPersistStorage_Load( persist, stg );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     IStorage_Release( stg );
 
     hr = IPersistStorage_GetClassID( persist, &cls );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     ok( IsEqualCLSID( &cls, &CLSID_Picture_Dib ), "class id mismatch\n" );
 
     hr = IDataObject_GetData( data, &fmt, &med );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
-    ok( med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
+    ok( med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed );
     ok( GlobalSize( U(med).hGlobal ) >= sizeof(dib_white) - sizeof(BITMAPFILEHEADER),
-        "got %lu\n", GlobalSize( U(med).hGlobal ) );
+        "got %Iu\n", GlobalSize( U(med).hGlobal ) );
     ptr = GlobalLock( U(med).hGlobal );
 
     expect_info = *(BITMAPINFOHEADER *)(file_dib + sizeof(BITMAPFILEHEADER));
@@ -2053,19 +2053,19 @@ static void test_data_cache_dib_contents_stream(int num)
     check_enum_cache( cache, enum_expect, 2 );
 
     hr = IViewObject2_GetExtent( view, DVASPECT_CONTENT, -1, NULL, &sz );
-    ok( SUCCEEDED(hr), "got %08x\n", hr );
+    ok( SUCCEEDED(hr), "got %08lx\n", hr );
     if (num == 0)
     {
-        ok( sz.cx == 1000, "got %d\n", sz.cx );
-        ok( sz.cy == 250, "got %d\n", sz.cy );
+        ok( sz.cx == 1000, "got %ld\n", sz.cx );
+        ok( sz.cy == 250, "got %ld\n", sz.cy );
     }
     else
     {
         HDC hdc = GetDC( 0 );
         LONG x = 2 * 2540 / GetDeviceCaps( hdc, LOGPIXELSX );
         LONG y = 1 * 2540 / GetDeviceCaps( hdc, LOGPIXELSY );
-        ok( sz.cx == x, "got %d %d\n", sz.cx, x );
-        ok( sz.cy == y, "got %d %d\n", sz.cy, y );
+        ok( sz.cx == x, "got %ld %ld\n", sz.cx, x );
+        ok( sz.cy == y, "got %ld %ld\n", sz.cy, y );
 
         ReleaseDC( 0, hdc );
     }
@@ -2091,8 +2091,8 @@ static void check_dib_size( HGLOBAL h, int cx, int cy )
     BITMAPINFO *info;
 
     info = GlobalLock( h );
-    ok( info->bmiHeader.biWidth == cx, "got %d expect %d\n", info->bmiHeader.biWidth, cx );
-    ok( info->bmiHeader.biHeight == cy, "got %d expect %d\n", info->bmiHeader.biHeight, cy );
+    ok( info->bmiHeader.biWidth == cx, "got %ld expect %d\n", info->bmiHeader.biWidth, cx );
+    ok( info->bmiHeader.biHeight == cy, "got %ld expect %d\n", info->bmiHeader.biHeight, cy );
     GlobalUnlock( h );
 }
 
@@ -2120,7 +2120,7 @@ static void test_data_cache_cache(void)
     };
 
     hr = CreateDataCache( NULL, &CLSID_NULL, &IID_IOleCache2, (void **)&cache );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* create a dib entry which will also create a bitmap entry too */
     fmt.cfFormat = CF_DIB;
@@ -2130,8 +2130,8 @@ static void test_data_cache_cache(void)
     fmt.tymed = TYMED_HGLOBAL;
 
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( conn == 2, "got %d\n", conn );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( conn == 2, "got %ld\n", conn );
     expect[0].dwConnection = conn;
     expect[1].dwConnection = conn;
 
@@ -2142,15 +2142,15 @@ static void test_data_cache_cache(void)
     fmt.tymed = TYMED_GDI;
 
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == CACHE_S_SAMECACHE, "got %08x\n", hr );
+    ok( hr == CACHE_S_SAMECACHE, "got %08lx\n", hr );
 
     /* metafile */
     fmt.cfFormat = CF_METAFILEPICT;
     fmt.tymed = TYMED_MFPICT;
 
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( conn == 3, "got %d\n", conn );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( conn == 3, "got %ld\n", conn );
     expect[2].dwConnection = conn;
 
     check_enum_cache( cache, expect,  3);
@@ -2160,21 +2160,21 @@ static void test_data_cache_cache(void)
     fmt.tymed = TYMED_ENHMF;
 
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( conn == 4, "got %d\n", conn );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( conn == 4, "got %ld\n", conn );
     expect[3].dwConnection = conn;
 
     check_enum_cache( cache, expect, 4 );
 
     /* uncache everything */
     hr = IOleCache2_Uncache( cache, expect[3].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, expect[2].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, expect[0].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, expect[0].dwConnection );
-    ok( hr == OLE_E_NOCONNECTION, "got %08x\n", hr );
+    ok( hr == OLE_E_NOCONNECTION, "got %08lx\n", hr );
 
     check_enum_cache( cache, expect, 0 );
 
@@ -2183,7 +2183,7 @@ static void test_data_cache_cache(void)
     fmt.tymed = TYMED_GDI;
 
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     expect[0].dwConnection = conn;
     expect[1].dwConnection = conn;
@@ -2192,24 +2192,24 @@ static void test_data_cache_cache(void)
 
     /* Try setting a 1x1 bitmap */
     hr = IOleCache2_QueryInterface( cache, &IID_IDataObject, (void **) &data );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     create_bitmap( &med );
 
     hr = IOleCache2_SetData( cache, &fmt, &med, TRUE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( med.tymed == TYMED_GDI, "got %d\n", med.tymed );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( med.tymed == TYMED_GDI, "got %ld\n", med.tymed );
     check_bitmap_size( U(med).hBitmap, 1, 1 );
     ReleaseStgMedium( &med );
 
     fmt.cfFormat = CF_DIB;
     fmt.tymed = TYMED_HGLOBAL;
     hr = IDataObject_GetData( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( med.tymed == TYMED_HGLOBAL, "got %d\n", med.tymed );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( med.tymed == TYMED_HGLOBAL, "got %ld\n", med.tymed );
     check_dib_size( U(med).hGlobal, 1, 1 );
     ReleaseStgMedium( &med );
 
@@ -2219,96 +2219,96 @@ static void test_data_cache_cache(void)
     create_dib( &med );
 
     hr = IOleCache2_SetData( cache, &fmt, &med, TRUE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     fmt.cfFormat = CF_BITMAP;
     fmt.tymed = TYMED_GDI;
     hr = IDataObject_GetData( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( med.tymed == TYMED_GDI, "got %d\n", med.tymed );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( med.tymed == TYMED_GDI, "got %ld\n", med.tymed );
     check_bitmap_size( U(med).hBitmap, 2, 1 );
     ReleaseStgMedium( &med );
 
     fmt.cfFormat = CF_DIB;
     fmt.tymed = TYMED_HGLOBAL;
     hr = IDataObject_GetData( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
-    ok( med.tymed == TYMED_HGLOBAL, "got %d\n", med.tymed );
+    ok( hr == S_OK, "got %08lx\n", hr );
+    ok( med.tymed == TYMED_HGLOBAL, "got %ld\n", med.tymed );
     check_dib_size( U(med).hGlobal, 2, 1 );
     ReleaseStgMedium( &med );
 
     /* uncache everything */
     hr = IOleCache2_Uncache( cache, conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* view caching */
     fmt.cfFormat = 0;
     fmt.tymed = TYMED_ENHMF;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     view_caching[0].dwConnection = conn;
 
     fmt.tymed = TYMED_HGLOBAL;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == CACHE_S_SAMECACHE, "got %08x\n", hr );
+    ok( hr == CACHE_S_SAMECACHE, "got %08lx\n", hr );
 
     fmt.dwAspect = DVASPECT_THUMBNAIL;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     view_caching[1].dwConnection = conn;
 
     fmt.dwAspect = DVASPECT_DOCPRINT;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     view_caching[2].dwConnection = conn;
 
     /* DVASPECT_ICON view cache gets mapped to CF_METAFILEPICT */
     fmt.dwAspect = DVASPECT_ICON;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     view_caching[3].dwConnection = conn;
 
     check_enum_cache( cache, view_caching, 4 );
 
     /* uncache everything */
     hr = IOleCache2_Uncache( cache, view_caching[3].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, view_caching[2].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, view_caching[1].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, view_caching[0].dwConnection );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* Only able to set cfFormat == CF_METAFILEPICT (or == 0, see above) for DVASPECT_ICON */
     fmt.dwAspect = DVASPECT_ICON;
     fmt.cfFormat = CF_DIB;
     fmt.tymed = TYMED_HGLOBAL;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == DV_E_FORMATETC, "got %08x\n", hr );
+    ok( hr == DV_E_FORMATETC, "got %08lx\n", hr );
     fmt.cfFormat = CF_BITMAP;
     fmt.tymed = TYMED_GDI;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == DV_E_FORMATETC, "got %08x\n", hr );
+    ok( hr == DV_E_FORMATETC, "got %08lx\n", hr );
     fmt.cfFormat = CF_ENHMETAFILE;
     fmt.tymed = TYMED_ENHMF;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == DV_E_FORMATETC, "got %08x\n", hr );
+    ok( hr == DV_E_FORMATETC, "got %08lx\n", hr );
     fmt.cfFormat = CF_METAFILEPICT;
     fmt.tymed = TYMED_MFPICT;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* uncache everything */
     hr = IOleCache2_Uncache( cache, conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* tymed == 0 */
     fmt.cfFormat = CF_ENHMETAFILE;
     fmt.dwAspect = DVASPECT_CONTENT;
     fmt.tymed = 0;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == DV_E_TYMED, "got %08x\n", hr );
+    ok( hr == DV_E_TYMED, "got %08lx\n", hr );
 
     IDataObject_Release( data );
     IOleCache2_Release( cache );
@@ -2320,30 +2320,30 @@ static void test_data_cache_cache(void)
     fmt.dwAspect = DVASPECT_CONTENT;
     fmt.tymed = TYMED_HGLOBAL;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == CACHE_S_SAMECACHE, "got %08x\n", hr );
+    ok( hr == CACHE_S_SAMECACHE, "got %08lx\n", hr );
 
     /* aspect other than DVASPECT_CONTENT should fail */
     fmt.dwAspect = DVASPECT_THUMBNAIL;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( FAILED(hr), "got %08x\n", hr );
+    ok( FAILED(hr), "got %08lx\n", hr );
 
     fmt.dwAspect = DVASPECT_DOCPRINT;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( FAILED(hr), "got %08x\n", hr );
+    ok( FAILED(hr), "got %08lx\n", hr );
 
     /* try caching another clip format */
     fmt.cfFormat = CF_METAFILEPICT;
     fmt.dwAspect = DVASPECT_CONTENT;
     fmt.tymed = TYMED_MFPICT;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( FAILED(hr), "got %08x\n", hr );
+    ok( FAILED(hr), "got %08lx\n", hr );
 
     /* As an exception, it's possible to add an icon aspect */
     fmt.cfFormat = CF_METAFILEPICT;
     fmt.dwAspect = DVASPECT_ICON;
     fmt.tymed = TYMED_MFPICT;
     hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     IOleCache2_Release( cache );
 }
@@ -2379,13 +2379,13 @@ static void test_data_cache_init(void)
     for (i = 0; i < ARRAY_SIZE(data); i++)
     {
         hr = CreateDataCache( NULL, data[i].clsid, &IID_IOleCache2, (void **)&cache );
-        ok( hr == S_OK, "got %08x\n", hr );
+        ok( hr == S_OK, "got %08lx\n", hr );
 
         check_enum_cache( cache, enum_expect + data[i].enum_start , data[i].enum_num );
 
         IOleCache2_QueryInterface( cache, &IID_IPersistStorage, (void **) &persist );
         hr = IPersistStorage_GetClassID( persist, &clsid );
-        ok( hr == S_OK, "got %08x\n", hr );
+        ok( hr == S_OK, "got %08lx\n", hr );
         ok( IsEqualCLSID( &clsid, data[i].clsid ), "class id mismatch %s %s\n", wine_dbgstr_guid( &clsid ),
             wine_dbgstr_guid( data[i].clsid ) );
 
@@ -2430,72 +2430,72 @@ static void test_data_cache_initnew(void)
     };
 
     hr = StgCreateDocfile( NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &stg_dib );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     hr = IStorage_SetClass( stg_dib, &CLSID_Picture_Dib );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = StgCreateDocfile( NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &stg_mf );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     hr = IStorage_SetClass( stg_mf, &CLSID_Picture_Metafile );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = StgCreateDocfile( NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &stg_wine );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
     hr = IStorage_SetClass( stg_wine, &CLSID_WineTestOld );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = CreateDataCache( NULL, &CLSID_WineTestOld, &IID_IOleCache2, (void **)&cache );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     IOleCache2_QueryInterface( cache, &IID_IPersistStorage, (void **) &persist );
 
     hr = IPersistStorage_InitNew( persist, stg_dib );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_GetClassID( persist, &clsid );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( IsEqualCLSID( &clsid, &CLSID_Picture_Dib ), "got %s\n", wine_dbgstr_guid( &clsid ) );
 
     check_enum_cache( cache, initnew_expect, 2 );
 
     hr = IPersistStorage_InitNew( persist, stg_mf );
-    ok( hr == CO_E_ALREADYINITIALIZED, "got %08x\n", hr);
+    ok( hr == CO_E_ALREADYINITIALIZED, "got %08lx\n", hr);
 
     hr = IPersistStorage_HandsOffStorage( persist );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_GetClassID( persist, &clsid );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( IsEqualCLSID( &clsid, &CLSID_Picture_Dib ), "got %s\n", wine_dbgstr_guid( &clsid ) );
 
     hr = IPersistStorage_InitNew( persist, stg_mf );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_GetClassID( persist, &clsid );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( IsEqualCLSID( &clsid, &CLSID_Picture_Metafile ), "got %s\n", wine_dbgstr_guid( &clsid ) );
 
     check_enum_cache( cache, initnew2_expect, 3 );
 
     hr = IPersistStorage_HandsOffStorage( persist );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_InitNew( persist, stg_dib );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_GetClassID( persist, &clsid );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( IsEqualCLSID( &clsid, &CLSID_Picture_Dib ), "got %s\n", wine_dbgstr_guid( &clsid ) );
 
     check_enum_cache( cache, initnew3_expect, 5 );
 
     hr = IPersistStorage_HandsOffStorage( persist );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_InitNew( persist, stg_wine );
-    ok( hr == S_OK, "got %08x\n", hr);
+    ok( hr == S_OK, "got %08lx\n", hr);
 
     hr = IPersistStorage_GetClassID( persist, &clsid );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     ok( IsEqualCLSID( &clsid, &CLSID_WineTestOld ), "got %s\n", wine_dbgstr_guid( &clsid ) );
 
     check_enum_cache( cache, initnew4_expect, 5 );
@@ -2539,273 +2539,273 @@ static void test_data_cache_updatecache( void )
     };
 
     hr = CreateDataCache( NULL, &CLSID_WineTestOld, &IID_IOleCache2, (void **)&cache );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     IOleCache2_QueryInterface(cache, &IID_IDataObject, (void **)&data);
 
     data_object_format = NULL;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IOleCache2_Cache( cache, &dib_fmt, 0, &conn[0] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08x\n", hr );
+    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &dib_fmt;
     data_object_dib = dib_white;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_white, sizeof(dib_white)), "Media didn't match.\n");
 
     hr = IOleCache2_Cache(cache, &emf_fmt, 0, &conn[1]);
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     data_object_dib = dib_black;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_black, sizeof(dib_black)), "Media didn't match.\n");
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_ENHMF, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_ENHMF, "Got unexpected tymed %lu.\n", medium.tymed);
 
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &wmf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_ENHMF, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_ENHMF, "Got unexpected tymed %lu.\n", medium.tymed);
 
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_Uncache( cache, conn[1] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_Cache( cache, &wmf_fmt, 0, &conn[1] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08x\n", hr );
+    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &wmf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &wmf_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_Uncache( cache, conn[1] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     hr = IOleCache2_Uncache( cache, conn[0] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* Test view caching. */
 
     hr = IOleCache2_Cache( cache, &view_fmt, 0, &conn[0] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     view_cache[0].dwConnection = conn[0];
 
     data_object_format = NULL;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08x\n", hr );
+    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08lx\n", hr );
 
     check_enum_cache( cache, view_cache, 1 );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &view_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &dib_fmt;
     data_object_dib = dib_white;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     view_cache_after_dib[0].dwConnection = view_cache_after_dib[1].dwConnection = view_cache[0].dwConnection;
     check_enum_cache( cache, view_cache_after_dib, 2 );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_white, sizeof(dib_white)), "Media didn't match.\n");
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &view_fmt, &medium);
-    todo_wine ok(hr == DV_E_CLIPFORMAT, "Got hr %#x.\n", hr);
+    todo_wine ok(hr == DV_E_CLIPFORMAT, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ALL, NULL );
-    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08x\n", hr );
+    ok( hr == CACHE_E_NOCACHE_UPDATED, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_Uncache( cache, conn[0] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     /* Try some different flags */
 
     hr = IOleCache2_Cache( cache, &dib_fmt, 0, &conn[0] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IOleCache2_Cache( cache, &emf_fmt, ADVF_NODATA, &conn[1] );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     data_object_format = &dib_fmt;
     data_object_dib = dib_white;
     hr = IOleCache2_UpdateCache(cache, &DataObject, UPDFCACHE_IFBLANK, NULL);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_white, sizeof(dib_white)), "Media didn't match.\n");
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_dib = dib_black;
     hr = IOleCache2_UpdateCache(cache, &DataObject, UPDFCACHE_IFBLANK, NULL);
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_white, sizeof(dib_white)), "Media didn't match.\n");
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_IFBLANK , NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
-    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %u.\n", medium.tymed);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
+    ok(medium.tymed == TYMED_HGLOBAL, "Got unexpected tymed %lu.\n", medium.tymed);
     ok(compare_global(U(medium).hGlobal, dib_white, sizeof(dib_white)), "Media didn't match.\n");
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_DiscardCache( cache, DISCARDCACHE_NOSAVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_IFBLANK | UPDFCACHE_NODATACACHE, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_DiscardCache( cache, DISCARDCACHE_NOSAVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     data_object_format = &dib_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ONLYIFBLANK | UPDFCACHE_NORMALCACHE, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ONLYIFBLANK | UPDFCACHE_NORMALCACHE, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_IFBLANK | UPDFCACHE_NORMALCACHE, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     hr = IOleCache2_DiscardCache( cache, DISCARDCACHE_NOSAVE );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     data_object_format = &dib_fmt;
     hr = IOleCache2_InitCache( cache, &DataObject );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     data_object_format = &emf_fmt;
     hr = IOleCache2_UpdateCache( cache, &DataObject, UPDFCACHE_ONLYIFBLANK | UPDFCACHE_NORMALCACHE, NULL );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     hr = IDataObject_GetData(data, &dib_fmt, &medium);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
     hr = IDataObject_GetData(data, &emf_fmt, &medium);
-    ok(hr == OLE_E_BLANK, "Got hr %#x.\n", hr);
+    ok(hr == OLE_E_BLANK, "Got hr %#lx.\n", hr);
 
     IDataObject_Release(data);
     IOleCache2_Release( cache );
@@ -2839,13 +2839,13 @@ static void test_default_handler(void)
     };
 
     hr = CoCreateInstance(&CLSID_WineTest, NULL, CLSCTX_INPROC_HANDLER, &IID_IOleObject, (void **)&pObject);
-    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed with REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "CoCreateInstance should have failed with REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = OleCreateDefaultHandler(&CLSID_WineTest, NULL, &IID_IOleObject, (void **)&pObject);
     ok_ole_success(hr, "OleCreateDefaultHandler");
 
     hr = IOleObject_QueryInterface(pObject, &IID_IOleInPlaceObject, (void **)&pInPlaceObj);
-    ok(hr == E_NOINTERFACE, "IOleObject_QueryInterface(&IID_IOleInPlaceObject) should return E_NOINTERFACE instead of 0x%08x\n", hr);
+    ok(hr == E_NOINTERFACE, "IOleObject_QueryInterface(&IID_IOleInPlaceObject) should return E_NOINTERFACE instead of 0x%08lx\n", hr);
 
     hr = IOleObject_Advise(pObject, &AdviseSink, &dwAdvConn);
     ok_ole_success(hr, "IOleObject_Advise");
@@ -2856,7 +2856,7 @@ static void test_default_handler(void)
     /* FIXME: test IOleObject_EnumAdvise */
 
     hr = IOleObject_EnumVerbs(pObject, &pEnumVerbs);
-    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_EnumVerbs should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_EnumVerbs should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = IOleObject_GetClientSite(pObject, &pClientSite);
     ok_ole_success(hr, "IOleObject_GetClientSite");
@@ -2866,15 +2866,15 @@ static void test_default_handler(void)
 
     hr = IOleObject_GetClipboardData(pObject, 0, &pDataObject);
     ok(hr == OLE_E_NOTRUNNING,
-       "IOleObject_GetClipboardData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n",
+       "IOleObject_GetClipboardData should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n",
        hr);
 
     hr = IOleObject_GetExtent(pObject, DVASPECT_CONTENT, &sizel);
-    ok(hr == OLE_E_BLANK, "IOleObject_GetExtent should have returned OLE_E_BLANK instead of 0x%08x\n",
+    ok(hr == OLE_E_BLANK, "IOleObject_GetExtent should have returned OLE_E_BLANK instead of 0x%08lx\n",
        hr);
 
     hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus);
-    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_GetMiscStatus should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_GetMiscStatus should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = IOleObject_GetUserClassID(pObject, &clsid);
     ok_ole_success(hr, "IOleObject_GetUserClassID");
@@ -2887,20 +2887,20 @@ static void test_default_handler(void)
     }
 
     hr = IOleObject_InitFromData(pObject, NULL, TRUE, 0);
-    ok(hr == OLE_E_NOTRUNNING, "IOleObject_InitFromData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IOleObject_InitFromData should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     hr = IOleObject_IsUpToDate(pObject);
-    ok(hr == OLE_E_NOTRUNNING, "IOleObject_IsUpToDate should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IOleObject_IsUpToDate should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     palette.palNumEntries = 1;
     palette.palVersion = 2;
     memset(&palette.palPalEntry[0], 0, sizeof(palette.palPalEntry[0]));
     hr = IOleObject_SetColorScheme(pObject, &palette);
-    ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetColorScheme should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetColorScheme should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     sizel.cx = sizel.cy = 0;
     hr = IOleObject_SetExtent(pObject, DVASPECT_CONTENT, &sizel);
-    ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetExtent should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IOleObject_SetExtent should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     hr = IOleObject_SetHostNames(pObject, wszHostName, NULL);
     ok_ole_success(hr, "IOleObject_SetHostNames");
@@ -2912,11 +2912,11 @@ static void test_default_handler(void)
     IMoniker_Release(pMoniker);
 
     hr = IOleObject_GetMoniker(pObject, OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_CONTAINER, &pMoniker);
-    ok(hr == E_FAIL, "IOleObject_GetMoniker should have returned E_FAIL instead of 0x%08x\n", hr);
+    ok(hr == E_FAIL, "IOleObject_GetMoniker should have returned E_FAIL instead of 0x%08lx\n", hr);
 
     hr = IOleObject_Update(pObject);
     todo_wine
-    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Update should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Update should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = IOleObject_QueryInterface(pObject, &IID_IDataObject, (void **)&pDataObject);
     ok_ole_success(hr, "IOleObject_QueryInterface");
@@ -2943,7 +2943,7 @@ static void test_default_handler(void)
     fmtetc.lindex = -1;
     fmtetc.tymed = TYMED_ENHMF;
     hr = IDataObject_QueryGetData(pDataObject, &fmtetc);
-    ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     fmtetc.cfFormat = CF_TEXT;
     fmtetc.ptd = NULL;
@@ -2951,7 +2951,7 @@ static void test_default_handler(void)
     fmtetc.lindex = -1;
     fmtetc.tymed = TYMED_NULL;
     hr = IDataObject_QueryGetData(pDataObject, &fmtetc);
-    ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
+    ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08lx\n", hr);
 
     hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnableObject);
     ok_ole_success(hr, "IOleObject_QueryInterface");
@@ -2960,7 +2960,7 @@ static void test_default_handler(void)
     ok_ole_success(hr, "IRunnableObject_SetContainedObject");
 
     hr = IRunnableObject_Run(pRunnableObject, NULL);
-    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Run should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_Run should have returned REGDB_E_CLASSNOTREG instead of 0x%08lx\n", hr);
 
     hr = IOleObject_Close(pObject, OLECLOSE_NOSAVE);
     ok_ole_success(hr, "IOleObject_Close");
@@ -2984,25 +2984,25 @@ static void test_default_handler(void)
 
             g_QIFailsWith = E_FAIL;
             hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk);
-            ok(hr == E_FAIL, "Got 0x%08x\n", hr);
+            ok(hr == E_FAIL, "Got 0x%08lx\n", hr);
 
             g_QIFailsWith = E_NOINTERFACE;
             hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk);
-            ok(hr == E_NOINTERFACE, "Got 0x%08x\n", hr);
+            ok(hr == E_NOINTERFACE, "Got 0x%08lx\n", hr);
 
             g_QIFailsWith = CO_E_OBJNOTCONNECTED;
             hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk);
-            ok(hr == CO_E_OBJNOTCONNECTED, "Got 0x%08x\n", hr);
+            ok(hr == CO_E_OBJNOTCONNECTED, "Got 0x%08lx\n", hr);
 
             g_QIFailsWith = 0x87654321;
             hr = IOleObject_QueryInterface(pObject, &IID_WineTest, (void**)&punk);
-            ok(hr == 0x87654321, "Got 0x%08x\n", hr);
+            ok(hr == 0x87654321, "Got 0x%08lx\n", hr);
 
             IOleObject_Release(pObject);
         }
 
         CHECK_NO_EXTRA_METHODS();
-        todo_wine ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+        todo_wine ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
         hr = CoRevokeClassObject(dwRegister);
         ok_ole_success(hr, "CoRevokeClassObject");
@@ -3033,21 +3033,21 @@ static void test_runnable(void)
     ret = OleIsRunning(object);
     ok(ret == TRUE, "Object should be running\n");
     CHECK_NO_EXTRA_METHODS();
-    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     g_isRunning = FALSE;
     expected_method_list = methods_query_runnable;
     ret = OleIsRunning(object);
     ok(ret == FALSE, "Object should not be running\n");
     CHECK_NO_EXTRA_METHODS();
-    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     g_showRunnable = FALSE;  /* QueryInterface(IID_IRunnableObject, ...) will fail */
     expected_method_list = methods_no_runnable;
     ret = OleIsRunning(object);
     ok(ret == TRUE, "Object without IRunnableObject should be running\n");
     CHECK_NO_EXTRA_METHODS();
-    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %d.\n", ole_object_refcount);
+    todo_wine ok(!ole_object_refcount, "Got outstanding refcount %ld.\n", ole_object_refcount);
 
     g_isRunning = TRUE;
     g_showRunnable = TRUE;
@@ -3133,10 +3133,10 @@ static void test_OleRun(void)
 
     /* doesn't support IRunnableObject */
     hr = OleRun(&unknown);
-    ok(hr == S_OK, "OleRun failed 0x%08x\n", hr);
+    ok(hr == S_OK, "OleRun failed 0x%08lx\n", hr);
 
     hr = OleRun((IUnknown*)&testrunnable);
-    ok(hr == 0xdeadc0de, "got 0x%08x\n", hr);
+    ok(hr == 0xdeadc0de, "got 0x%08lx\n", hr);
 }
 
 static void test_OleLockRunning(void)
@@ -3144,7 +3144,7 @@ static void test_OleLockRunning(void)
     HRESULT hr;
 
     hr = OleLockRunning(&unknown, TRUE, FALSE);
-    ok(hr == S_OK, "OleLockRunning failed 0x%08x\n", hr);
+    ok(hr == S_OK, "OleLockRunning failed 0x%08lx\n", hr);
 }
 
 static void test_OleDraw(void)
@@ -3153,13 +3153,13 @@ static void test_OleDraw(void)
     RECT rect;
 
     hr = OleDraw((IUnknown*)&viewobject, 0, (HDC)0x1, NULL);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
 
     hr = OleDraw(NULL, 0, (HDC)0x1, NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = OleDraw(NULL, 0, (HDC)0x1, &rect);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 }
 
 static const WCHAR olepres0W[] = {2,'O','l','e','P','r','e','s','0','0','0',0};
@@ -3198,14 +3198,14 @@ static HRESULT WINAPI Storage_CreateStream(IStorage *iface, LPCOLESTR pwcsName,
         CHECK_EXPECT(Storage_CreateStream_CompObj);
         *ppstm = comp_obj_stream;
 
-        todo_wine ok(grfMode == (STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
+        todo_wine ok(grfMode == (STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %lx\n", grfMode);
     }
     else if (!lstrcmpW(pwcsName, olepres0W))
     {
         CHECK_EXPECT(Storage_CreateStream_OlePres);
         *ppstm = olepres_stream;
 
-        todo_wine ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
+        todo_wine ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %lx\n", grfMode);
     }
     else
     {
@@ -3219,15 +3219,15 @@ static HRESULT WINAPI Storage_CreateStream(IStorage *iface, LPCOLESTR pwcsName,
 #endif
     }
 
-    ok(!reserved1, "reserved1 = %x\n", reserved1);
-    ok(!reserved2, "reserved2 = %x\n", reserved2);
+    ok(!reserved1, "reserved1 = %lx\n", reserved1);
+    ok(!reserved2, "reserved2 = %lx\n", reserved2);
     ok(!!ppstm, "ppstm = NULL\n");
 
     IStream_AddRef(*ppstm);
     hr = IStream_Seek(*ppstm, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
     hr = IStream_SetSize(*ppstm, size);
-    ok(hr == S_OK, "IStream_SetSize returned %x\n", hr);
+    ok(hr == S_OK, "IStream_SetSize returned %lx\n", hr);
     return S_OK;
 }
 
@@ -3239,45 +3239,45 @@ static HRESULT WINAPI Storage_OpenStream(IStorage *iface, LPCOLESTR pwcsName, vo
     HRESULT hr;
 
     ok(!reserved1, "reserved1 = %p\n", reserved1);
-    ok(!reserved2, "reserved2 = %x\n", reserved2);
+    ok(!reserved2, "reserved2 = %lx\n", reserved2);
     ok(!!ppstm, "ppstm = NULL\n");
 
     if(!lstrcmpW(pwcsName, comp_objW)) {
         CHECK_EXPECT2(Storage_OpenStream_CompObj);
-        ok(grfMode == STGM_SHARE_EXCLUSIVE, "grfMode = %x\n", grfMode);
+        ok(grfMode == STGM_SHARE_EXCLUSIVE, "grfMode = %lx\n", grfMode);
 
         *ppstm = comp_obj_stream;
         IStream_AddRef(comp_obj_stream);
         hr = IStream_Seek(comp_obj_stream, pos, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+        ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
         return S_OK;
     }else if(!lstrcmpW(pwcsName, ole1W)) {
         CHECK_EXPECT(Storage_OpenStream_Ole);
 
         if (!ole_stream)
         {
-            ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READ), "grfMode = %x\n", grfMode);
+            ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READ), "grfMode = %lx\n", grfMode);
 
             *ppstm = NULL;
             return STG_E_FILENOTFOUND;
         }
 
-        ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
+        ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %lx\n", grfMode);
 
         *ppstm = ole_stream;
         IStream_AddRef(ole_stream);
         hr = IStream_Seek(ole_stream, pos, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+        ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
         return S_OK;
 
     }else if(!lstrcmpW(pwcsName, olepres0W)) {
         CHECK_EXPECT(Storage_OpenStream_OlePres);
-        ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
+        ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %lx\n", grfMode);
 
         *ppstm = olepres_stream;
         IStream_AddRef(olepres_stream);
         hr = IStream_Seek(olepres_stream, pos, STREAM_SEEK_SET, NULL);
-        ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+        ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
         return S_OK;
     }
 
@@ -3375,7 +3375,7 @@ static HRESULT WINAPI Storage_Stat(IStorage *iface, STATSTG *pstatstg, DWORD grf
 {
     CHECK_EXPECT2(Storage_Stat);
     ok(pstatstg != NULL, "pstatstg = NULL\n");
-    ok(grfStatFlag == STATFLAG_NONAME, "grfStatFlag = %x\n", grfStatFlag);
+    ok(grfStatFlag == STATFLAG_NONAME, "grfStatFlag = %lx\n", grfStatFlag);
 
     memset(pstatstg, 0, sizeof(STATSTG));
     pstatstg->type = STGTY_STORAGE;
@@ -3447,18 +3447,18 @@ static void test_OleDoAutoConvert(void)
     HRESULT hr;
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &comp_obj_stream);
-    ok(hr == S_OK, "CreateStreamOnHGlobal returned %x\n", hr);
+    ok(hr == S_OK, "CreateStreamOnHGlobal returned %lx\n", hr);
     hr = IStream_Write(comp_obj_stream, (char*)&comp_obj_data, sizeof(comp_obj_data), NULL);
-    ok(hr == S_OK, "IStream_Write returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Write returned %lx\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &ole_stream);
-    ok(hr == S_OK, "CreateStreamOnHGlobal returned %x\n", hr);
+    ok(hr == S_OK, "CreateStreamOnHGlobal returned %lx\n", hr);
     hr = IStream_Write(ole_stream, (char*)&ole_data, sizeof(ole_data), NULL);
-    ok(hr == S_OK, "IStream_Write returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Write returned %lx\n", hr);
 
     clsid = IID_WineTest;
     hr = OleDoAutoConvert(NULL, &clsid);
-    ok(hr == E_INVALIDARG, "OleDoAutoConvert returned %x\n", hr);
+    ok(hr == E_INVALIDARG, "OleDoAutoConvert returned %lx\n", hr);
     ok(IsEqualIID(&clsid, &IID_NULL), "clsid = %s\n", wine_dbgstr_guid(&clsid));
 
     if(0) /* crashes on Win7 */
@@ -3467,7 +3467,7 @@ static void test_OleDoAutoConvert(void)
     clsid = IID_WineTest;
     SET_EXPECT(Storage_Stat);
     hr = OleDoAutoConvert(&Storage, &clsid);
-    ok(hr == REGDB_E_CLASSNOTREG, "OleDoAutoConvert returned %x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "OleDoAutoConvert returned %lx\n", hr);
     CHECK_CALLED(Storage_Stat);
     ok(IsEqualIID(&clsid, &CLSID_WineTestOld), "clsid = %s\n", wine_dbgstr_guid(&clsid));
 
@@ -3477,14 +3477,14 @@ static void test_OleDoAutoConvert(void)
     ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0,
             KEY_READ | KEY_WRITE | KEY_CREATE_SUB_KEY, NULL, &root, NULL);
     if(ret != ERROR_SUCCESS) {
-        win_skip("not enough permissions to create CLSID key (%u)\n", ret);
+        win_skip("not enough permissions to create CLSID key (%lu)\n", ret);
         return;
     }
 
     clsid = IID_WineTest;
     SET_EXPECT(Storage_Stat);
     hr = OleDoAutoConvert(&Storage, &clsid);
-    ok(hr == REGDB_E_KEYMISSING, "OleDoAutoConvert returned %x\n", hr);
+    ok(hr == REGDB_E_KEYMISSING, "OleDoAutoConvert returned %lx\n", hr);
     CHECK_CALLED(Storage_Stat);
     ok(IsEqualIID(&clsid, &CLSID_WineTestOld), "clsid = %s\n", wine_dbgstr_guid(&clsid));
 
@@ -3502,7 +3502,7 @@ static void test_OleDoAutoConvert(void)
     SET_EXPECT(Storage_CreateStream_CompObj);
     SET_EXPECT(Storage_OpenStream_Ole);
     hr = OleDoAutoConvert(&Storage, &clsid);
-    ok(hr == S_OK, "OleDoAutoConvert returned %x\n", hr);
+    ok(hr == S_OK, "OleDoAutoConvert returned %lx\n", hr);
     CHECK_CALLED(Storage_Stat);
     CHECK_CALLED(Storage_OpenStream_CompObj);
     CHECK_CALLED(Storage_SetClass);
@@ -3511,58 +3511,58 @@ static void test_OleDoAutoConvert(void)
     ok(IsEqualIID(&clsid, &CLSID_WineTest), "clsid = %s\n", wine_dbgstr_guid(&clsid));
 
     hr = IStream_Seek(comp_obj_stream, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
     hr = IStream_Read(comp_obj_stream, &comp_obj_data, sizeof(comp_obj_data), NULL);
-    ok(hr == S_OK, "IStream_Read returned %x\n", hr);
-    ok(comp_obj_data.reserved1 == 0xfffe0001, "reserved1 = %x\n", comp_obj_data.reserved1);
-    ok(comp_obj_data.version == 0xa03, "version = %x\n", comp_obj_data.version);
-    ok(comp_obj_data.reserved2[0] == -1, "reserved2[0] = %x\n", comp_obj_data.reserved2[0]);
+    ok(hr == S_OK, "IStream_Read returned %lx\n", hr);
+    ok(comp_obj_data.reserved1 == 0xfffe0001, "reserved1 = %lx\n", comp_obj_data.reserved1);
+    ok(comp_obj_data.version == 0xa03, "version = %lx\n", comp_obj_data.version);
+    ok(comp_obj_data.reserved2[0] == -1, "reserved2[0] = %lx\n", comp_obj_data.reserved2[0]);
     ok(IsEqualIID(comp_obj_data.reserved2+1, &CLSID_WineTestOld), "reserved2 = %s\n", wine_dbgstr_guid((CLSID*)(comp_obj_data.reserved2+1)));
-    ok(!comp_obj_data.ansi_user_type_len, "ansi_user_type_len = %d\n", comp_obj_data.ansi_user_type_len);
-    ok(!comp_obj_data.ansi_clipboard_format_len, "ansi_clipboard_format_len = %d\n", comp_obj_data.ansi_clipboard_format_len);
-    ok(!comp_obj_data.reserved3, "reserved3 = %x\n", comp_obj_data.reserved3);
-    ok(comp_obj_data.unicode_marker == 0x71b239f4, "unicode_marker = %x\n", comp_obj_data.unicode_marker);
-    ok(!comp_obj_data.unicode_user_type_len, "unicode_user_type_len = %d\n", comp_obj_data.unicode_user_type_len);
-    ok(!comp_obj_data.unicode_clipboard_format_len, "unicode_clipboard_format_len = %d\n", comp_obj_data.unicode_clipboard_format_len);
-    ok(!comp_obj_data.reserved4, "reserved4 %d\n", comp_obj_data.reserved4);
+    ok(!comp_obj_data.ansi_user_type_len, "ansi_user_type_len = %ld\n", comp_obj_data.ansi_user_type_len);
+    ok(!comp_obj_data.ansi_clipboard_format_len, "ansi_clipboard_format_len = %ld\n", comp_obj_data.ansi_clipboard_format_len);
+    ok(!comp_obj_data.reserved3, "reserved3 = %lx\n", comp_obj_data.reserved3);
+    ok(comp_obj_data.unicode_marker == 0x71b239f4, "unicode_marker = %lx\n", comp_obj_data.unicode_marker);
+    ok(!comp_obj_data.unicode_user_type_len, "unicode_user_type_len = %ld\n", comp_obj_data.unicode_user_type_len);
+    ok(!comp_obj_data.unicode_clipboard_format_len, "unicode_clipboard_format_len = %ld\n", comp_obj_data.unicode_clipboard_format_len);
+    ok(!comp_obj_data.reserved4, "reserved4 %ld\n", comp_obj_data.reserved4);
 
     hr = IStream_Seek(ole_stream, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
     hr = IStream_Read(ole_stream, &ole_data, sizeof(ole_data), NULL);
-    ok(hr == S_OK, "IStream_Read returned %x\n", hr);
-    ok(ole_data.version == 0, "version = %x\n", ole_data.version);
-    ok(ole_data.flags == 4, "flags = %x\n", ole_data.flags);
+    ok(hr == S_OK, "IStream_Read returned %lx\n", hr);
+    ok(ole_data.version == 0, "version = %lx\n", ole_data.version);
+    ok(ole_data.flags == 4, "flags = %lx\n", ole_data.flags);
     for(i=2; i<sizeof(ole_data)/sizeof(DWORD); i++)
-        ok(((DWORD*)&ole_data)[i] == 0, "ole_data[%d] = %x\n", i, ((DWORD*)&ole_data)[i]);
+        ok(((DWORD*)&ole_data)[i] == 0, "ole_data[%ld] = %lx\n", i, ((DWORD*)&ole_data)[i]);
 
     SET_EXPECT(Storage_OpenStream_Ole);
     hr = SetConvertStg(&Storage, TRUE);
-    ok(hr == S_OK, "SetConvertStg returned %x\n", hr);
+    ok(hr == S_OK, "SetConvertStg returned %lx\n", hr);
     CHECK_CALLED(Storage_OpenStream_Ole);
 
     SET_EXPECT(Storage_OpenStream_CompObj);
     SET_EXPECT(Storage_Stat);
     SET_EXPECT(Storage_CreateStream_CompObj);
     hr = WriteFmtUserTypeStg(&Storage, 0, NULL);
-    ok(hr == S_OK, "WriteFmtUserTypeStg returned %x\n", hr);
+    ok(hr == S_OK, "WriteFmtUserTypeStg returned %lx\n", hr);
     todo_wine CHECK_CALLED(Storage_OpenStream_CompObj);
     CHECK_CALLED(Storage_Stat);
     CHECK_CALLED(Storage_CreateStream_CompObj);
     hr = IStream_Seek(comp_obj_stream, pos, STREAM_SEEK_SET, NULL);
-    ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
+    ok(hr == S_OK, "IStream_Seek returned %lx\n", hr);
     hr = IStream_Read(comp_obj_stream, &comp_obj_data, sizeof(comp_obj_data), NULL);
-    ok(hr == S_OK, "IStream_Read returned %x\n", hr);
-    ok(comp_obj_data.reserved1 == 0xfffe0001, "reserved1 = %x\n", comp_obj_data.reserved1);
-    ok(comp_obj_data.version == 0xa03, "version = %x\n", comp_obj_data.version);
-    ok(comp_obj_data.reserved2[0] == -1, "reserved2[0] = %x\n", comp_obj_data.reserved2[0]);
+    ok(hr == S_OK, "IStream_Read returned %lx\n", hr);
+    ok(comp_obj_data.reserved1 == 0xfffe0001, "reserved1 = %lx\n", comp_obj_data.reserved1);
+    ok(comp_obj_data.version == 0xa03, "version = %lx\n", comp_obj_data.version);
+    ok(comp_obj_data.reserved2[0] == -1, "reserved2[0] = %lx\n", comp_obj_data.reserved2[0]);
     ok(IsEqualIID(comp_obj_data.reserved2+1, &CLSID_WineTestOld), "reserved2 = %s\n", wine_dbgstr_guid((CLSID*)(comp_obj_data.reserved2+1)));
-    ok(!comp_obj_data.ansi_user_type_len, "ansi_user_type_len = %d\n", comp_obj_data.ansi_user_type_len);
-    ok(!comp_obj_data.ansi_clipboard_format_len, "ansi_clipboard_format_len = %d\n", comp_obj_data.ansi_clipboard_format_len);
-    ok(!comp_obj_data.reserved3, "reserved3 = %x\n", comp_obj_data.reserved3);
-    ok(comp_obj_data.unicode_marker == 0x71b239f4, "unicode_marker = %x\n", comp_obj_data.unicode_marker);
-    ok(!comp_obj_data.unicode_user_type_len, "unicode_user_type_len = %d\n", comp_obj_data.unicode_user_type_len);
-    ok(!comp_obj_data.unicode_clipboard_format_len, "unicode_clipboard_format_len = %d\n", comp_obj_data.unicode_clipboard_format_len);
-    ok(!comp_obj_data.reserved4, "reserved4 %d\n", comp_obj_data.reserved4);
+    ok(!comp_obj_data.ansi_user_type_len, "ansi_user_type_len = %ld\n", comp_obj_data.ansi_user_type_len);
+    ok(!comp_obj_data.ansi_clipboard_format_len, "ansi_clipboard_format_len = %ld\n", comp_obj_data.ansi_clipboard_format_len);
+    ok(!comp_obj_data.reserved3, "reserved3 = %lx\n", comp_obj_data.reserved3);
+    ok(comp_obj_data.unicode_marker == 0x71b239f4, "unicode_marker = %lx\n", comp_obj_data.unicode_marker);
+    ok(!comp_obj_data.unicode_user_type_len, "unicode_user_type_len = %ld\n", comp_obj_data.unicode_user_type_len);
+    ok(!comp_obj_data.unicode_clipboard_format_len, "unicode_clipboard_format_len = %ld\n", comp_obj_data.unicode_clipboard_format_len);
+    ok(!comp_obj_data.reserved4, "reserved4 %ld\n", comp_obj_data.reserved4);
 
     ret = IStream_Release(comp_obj_stream);
     ok(!ret, "comp_obj_stream was not freed\n");
@@ -3570,9 +3570,9 @@ static void test_OleDoAutoConvert(void)
     ok(!ret, "ole_stream was not freed\n");
 
     ret = RegDeleteKeyA(root, "AutoConvertTo");
-    ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret);
+    ok(ret == ERROR_SUCCESS, "RegDeleteKey error %lu\n", ret);
     ret = RegDeleteKeyA(root, "");
-    ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret);
+    ok(ret == ERROR_SUCCESS, "RegDeleteKey error %lu\n", ret);
     RegCloseKey(root);
 }
 
@@ -3610,28 +3610,28 @@ static void test_data_cache_save(void)
     PresentationDataHeader hdr;
 
     hr = CreateILockBytesOnHGlobal(0, TRUE, &ilb);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0,  &doc);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     ILockBytes_Release(ilb);
 
     hr = IStorage_SetClass(doc, &CLSID_WineTest);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = IStorage_CreateStream(doc, contentsW, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     hr = IStream_Write(stm, bmpimage, sizeof(bmpimage), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     IStream_Release(stm);
 
     hr = IStorage_CreateStream(doc, olepres0W, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     clipformat[0] = -1;
     clipformat[1] = CF_METAFILEPICT;
     hr = IStream_Write(stm, clipformat, sizeof(clipformat), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hdr.tdSize = sizeof(hdr.tdSize);
     hdr.dvAspect = DVASPECT_CONTENT;
@@ -3642,31 +3642,31 @@ static void test_data_cache_save(void)
     hdr.dwObjectExtentY = 0;
     hdr.dwSize = sizeof(mf_blank_bits);
     hr = IStream_Write(stm, &hdr, sizeof(hdr), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     hr = IStream_Write(stm, mf_blank_bits, sizeof(mf_blank_bits), NULL);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     IStream_Release(stm);
 
     hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IUnknown, (void **)&cache);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     hr = IOleCache2_QueryInterface(cache, &IID_IPersistStorage, (void **)&stg);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     hr = IPersistStorage_Load(stg, doc);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     IStorage_Release(doc);
 
     hr = IPersistStorage_IsDirty(stg);
-    ok(hr == S_FALSE, "unexpected %#x\n", hr);
+    ok(hr == S_FALSE, "unexpected %#lx\n", hr);
 
     ole_stream = NULL;
     hr = CreateStreamOnHGlobal(NULL, TRUE, &olepres_stream);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     /* FIXME: remove this stream once Wine is fixed */
     hr = CreateStreamOnHGlobal(NULL, TRUE, &contents_stream);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     SET_EXPECT(Storage_CreateStream_OlePres);
     SET_EXPECT(Storage_OpenStream_OlePres);
@@ -3675,7 +3675,7 @@ static void test_data_cache_save(void)
     Storage_DestroyElement_limit = 50;
     Storage_SetClass_CLSID = &CLSID_NULL;
     hr = IPersistStorage_Save(stg, &Storage, FALSE);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     CHECK_CALLED(Storage_CreateStream_OlePres);
     todo_wine
     CHECK_CALLED(Storage_OpenStream_OlePres);
@@ -3866,12 +3866,12 @@ static void check_storage_contents(IStorage *stg, const struct storage_def *stg_
     *matched_streams = 0;
 
     hr = IStorage_Stat(stg, &stat, STATFLAG_NONAME);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
     ok(IsEqualCLSID(stg_def->clsid, &stat.clsid), "expected %s, got %s\n",
        wine_dbgstr_guid(stg_def->clsid), wine_dbgstr_guid(&stat.clsid));
 
     hr = IStorage_EnumElements(stg, 0, NULL, 0, &enumstg);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     for (;;)
     {
@@ -3885,18 +3885,18 @@ static void check_storage_contents(IStorage *stg, const struct storage_def *stg_
 
         hr = IEnumSTATSTG_Next(enumstg, 1, &stat, NULL);
         if(hr == S_FALSE) break;
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         if (winetest_debug > 1)
-            trace("name %s, type %u, size %d, clsid %s\n",
+            trace("name %s, type %lu, size %ld, clsid %s\n",
                 wine_dbgstr_w(stat.pwcsName), stat.type, stat.cbSize.u.LowPart, wine_dbgstr_guid(&stat.clsid));
 
-        ok(stat.type == STGTY_STREAM, "unexpected %#x\n", stat.type);
+        ok(stat.type == STGTY_STREAM, "unexpected %#lx\n", stat.type);
 
         WideCharToMultiByte(CP_ACP, 0, stat.pwcsName, -1, name, sizeof(name), NULL, NULL);
 
         hr = IStorage_OpenStream(stg, stat.pwcsName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         if (!memcmp(name, "\2OlePres", 8))
         {
@@ -3908,27 +3908,27 @@ static void check_storage_contents(IStorage *stg, const struct storage_def *stg_
                 header_size = FIELD_OFFSET(PresentationDataHeader, unknown7);
 
             hr = IStream_Read(stream, &header, header_size, &bytes);
-            ok(hr == S_OK, "unexpected %#x\n", hr);
-            ok(bytes == header_size, "read %u bytes, expected %u\n", bytes, header_size);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
+            ok(bytes == header_size, "read %lu bytes, expected %lu\n", bytes, header_size);
 
             if (winetest_debug > 1)
-                trace("header: tdSize %#x, dvAspect %#x, lindex %#x, advf %#x, unknown7 %#x, dwObjectExtentX %#x, dwObjectExtentY %#x, dwSize %#x\n",
+                trace("header: tdSize %#lx, dvAspect %#x, lindex %#lx, advf %#lx, unknown7 %#lx, dwObjectExtentX %#lx, dwObjectExtentY %#lx, dwSize %#lx\n",
                     header.tdSize, header.dvAspect, header.lindex, header.advf, header.unknown7,
                     header.dwObjectExtentX, header.dwObjectExtentY, header.dwSize);
         }
 
         memset(data, 0, sizeof(data));
         hr = IStream_Read(stream, data, sizeof(data), &bytes);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         if (winetest_debug > 1)
-            trace("stream data (%u bytes): %02x %02x %02x %02x\n", bytes, data[0], data[1], data[2], data[3]);
+            trace("stream data (%lu bytes): %02x %02x %02x %02x\n", bytes, data[0], data[1], data[2], data[3]);
 
         for (i = 0; i < stg_def->stream_count; i++)
         {
             if (seen_stream[i]) continue;
 
             if (winetest_debug > 1)
-                trace("%s/%s, %d/%d, %d/%d, %d/%d\n",
+                trace("%s/%s, %d/%d, %d/%d, %d/%ld\n",
                     stg_def->stream[i].name, name,
                     stg_def->stream[i].cf, clipformat,
                     stg_def->stream[i].dvAspect, header.dvAspect,
@@ -4043,10 +4043,10 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
     int i;
 
     hr = StgCreateDocfile(NULL, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &stg);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     hr = IStorage_SetClass(stg, stg_def->clsid);
-    ok(hr == S_OK, "unexpected %#x\n", hr);
+    ok(hr == S_OK, "unexpected %#lx\n", hr);
 
     for (i = 0; i < stg_def->stream_count; i++)
     {
@@ -4054,7 +4054,7 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
 
         MultiByteToWideChar(CP_ACP, 0, stg_def->stream[i].name, -1, name, 32);
         hr = IStorage_CreateStream(stg, name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         if (stg_def->stream[i].cf != -1)
         {
@@ -4072,7 +4072,7 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
                 clipformat[0] = 0;
                 hr = IStream_Write(stm, &clipformat[0], sizeof(clipformat[0]), NULL);
             }
-            ok(hr == S_OK, "unexpected %#x\n", hr);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
 
             hdr.tdSize = sizeof(hdr.tdSize);
             hdr.dvAspect = stg_def->stream[i].dvAspect;
@@ -4083,13 +4083,13 @@ static IStorage *create_storage_from_def(const struct storage_def *stg_def)
             hdr.dwObjectExtentY = 0;
             hdr.dwSize = stg_def->stream[i].data_size;
             hr = IStream_Write(stm, &hdr, sizeof(hdr), NULL);
-            ok(hr == S_OK, "unexpected %#x\n", hr);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
         }
 
         if (stg_def->stream[i].data_size)
         {
             hr = IStream_Write(stm, stg_def->stream[i].data, stg_def->stream[i].data_size, NULL);
-            ok(hr == S_OK, "unexpected %#x\n", hr);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
         }
 
         IStream_Release(stm);
@@ -4317,39 +4317,39 @@ static void test_data_cache_save_data(void)
     for (pdata = data; pdata->clsid != NULL; pdata++)
     {
         hr = CreateDataCache(NULL, pdata->clsid, &IID_IOleCache2, (void **)&cache);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         for (i = 0; i < pdata->num_fmts; i++)
         {
             hr = IOleCache2_Cache(cache, &pdata->fmts[i], 0, &dummy);
-            ok(SUCCEEDED(hr), "unexpected %#x\n", hr);
+            ok(SUCCEEDED(hr), "unexpected %#lx\n", hr);
             if (i < pdata->num_set)
             {
                 get_stgmedium(pdata->fmts[i].cfFormat, &stgmeds[i]);
                 get_stgdef(&pdata->stg_def, pdata->fmts[i].cfFormat, &stgmeds[i], i);
                 hr = IOleCache2_SetData(cache, &pdata->fmts[i], &stgmeds[i], FALSE);
-                ok(hr == S_OK, "unexpected %#x\n", hr);
+                ok(hr == S_OK, "unexpected %#lx\n", hr);
             }
         }
 
         /* create Storage in memory where we'll save cache */
         hr = CreateILockBytesOnHGlobal(0, TRUE, &ilb);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         hr = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &doc);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         ILockBytes_Release(ilb);
         hr = IStorage_SetClass(doc, &CLSID_WineTestOld);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         hr = IOleCache2_QueryInterface(cache, &IID_IPersistStorage, (void **)&persist);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         /* cache entries are dirty. test saving them to stg */
         hr = IPersistStorage_Save(persist, doc, FALSE);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         hr = IPersistStorage_IsDirty(persist);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         check_storage_contents(doc, &pdata->stg_def, &enumerated_streams, &matched_streams);
         ok(enumerated_streams == matched_streams, "enumerated %d != matched %d\n",
@@ -4362,24 +4362,24 @@ static void test_data_cache_save_data(void)
 
         /* now test _Load/_GetData using the storage we used for _Save */
         hr = CreateDataCache(NULL, pdata->clsid, &IID_IOleCache2, (void **)&cache);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         hr = IOleCache2_QueryInterface(cache, &IID_IPersistStorage, (void **)&persist);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         hr = IStorage_SetClass(doc, pdata->clsid);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         hr = IPersistStorage_Load(persist, doc);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         hr = IOleCache2_QueryInterface(cache, &IID_IDataObject, (void **)&odata);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         for (i = 0; i < pdata->num_set; i++)
         {
             hr = IDataObject_GetData(odata, &pdata->fmts[i], &stgmed);
-            ok(hr == S_OK, "unexpected %#x\n", hr);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
 
             hr = stgmedium_cmp(&stgmeds[i], &stgmed);
-            ok(hr == S_OK, "unexpected %#x\n", hr);
+            ok(hr == S_OK, "unexpected %#lx\n", hr);
             ReleaseStgMedium(&stgmed);
             ReleaseStgMedium(&stgmeds[i]);
         }
@@ -4435,22 +4435,22 @@ static void test_data_cache_contents(void)
            enumerated_streams, test_data[i].in->stream_count);
 
         hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IUnknown, (void **)&cache);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         hr = IOleCache2_QueryInterface(cache, &IID_IPersistStorage, (void **)&stg);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
         hr = IPersistStorage_Load(stg, doc1);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         IStorage_Release(doc1);
 
         hr = StgCreateDocfile(NULL, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &doc2);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         hr = IPersistStorage_IsDirty(stg);
-        ok(hr == S_FALSE, "%d: unexpected %#x\n", i, hr);
+        ok(hr == S_FALSE, "%d: unexpected %#lx\n", i, hr);
 
         hr = IPersistStorage_Save(stg, doc2, FALSE);
-        ok(hr == S_OK, "unexpected %#x\n", hr);
+        ok(hr == S_OK, "unexpected %#lx\n", hr);
 
         IPersistStorage_Release(stg);
 
@@ -4508,30 +4508,30 @@ static void test_OleCreateStaticFromData(void)
 
 
     hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
-    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08lx.\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
                                       0, &storage);
-    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08lx.\n", hr);
     ILockBytes_Release(ilb);
 
     hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
                                  &dib_fmt, NULL, NULL, (void **)&ole_obj);
-    ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
+    ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08lx.\n", hr);
 
     hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
                                  &dib_fmt, NULL, storage, NULL);
-    ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
+    ok(hr == E_INVALIDARG, "OleCreateStaticFromData should fail: 0x%08lx.\n", hr);
 
     /* CF_DIB */
     data_object_format = &dib_fmt;
     data_object_dib = dib_white;
     hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
                                  &dib_fmt, NULL, storage, (void **)&ole_obj);
-    ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08lx.\n", hr);
     hr = IOleObject_QueryInterface(ole_obj, &IID_IPersist, (void **)&persist);
-    ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08lx.\n", hr);
     hr = IPersist_GetClassID(persist, &clsid);
-    ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08lx.\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_Picture_Dib), "Got wrong clsid: %s, expected: %s.\n",
        wine_dbgstr_guid(&clsid), wine_dbgstr_guid(&CLSID_Picture_Dib));
     hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
@@ -4552,19 +4552,19 @@ static void test_OleCreateStaticFromData(void)
 
     /* CF_ENHMETAFILE */
     hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
-    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08lx.\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
                                       0, &storage);
-    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08lx.\n", hr);
     ILockBytes_Release(ilb);
     data_object_format = &emf_fmt;
     hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
                                  &emf_fmt, NULL, storage, (void **)&ole_obj);
-    ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "OleCreateStaticFromData failed: 0x%08lx.\n", hr);
     hr = IOleObject_QueryInterface(ole_obj, &IID_IPersist, (void **)&persist);
-    ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "IOleObject_QueryInterface failed: 0x%08lx.\n", hr);
     hr = IPersist_GetClassID(persist, &clsid);
-    ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "IPersist_GetClassID failed: 0x%08lx.\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_Picture_EnhMetafile), "Got wrong clsid: %s, expected: %s.\n",
        wine_dbgstr_guid(&clsid), wine_dbgstr_guid(&CLSID_Picture_EnhMetafile));
     hr = IStorage_Stat(storage, &statstg, STATFLAG_NONAME);
@@ -4585,28 +4585,28 @@ static void test_OleCreateStaticFromData(void)
 
     /* CF_TEXT */
     hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
-    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08lx.\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
                                       0, &storage);
-    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08lx.\n", hr);
     ILockBytes_Release(ilb);
     data_object_format = &text_fmt;
     hr = OleCreateStaticFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT,
                                  &text_fmt, NULL, storage, (void **)&ole_obj);
-    ok(hr == DV_E_CLIPFORMAT, "OleCreateStaticFromData should fail: 0x%08x.\n", hr);
+    ok(hr == DV_E_CLIPFORMAT, "OleCreateStaticFromData should fail: 0x%08lx.\n", hr);
     IStorage_Release(storage);
 
     hr = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
-    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "CreateILockBytesOnHGlobal failed: 0x%08lx.\n", hr);
     hr = StgCreateDocfileOnILockBytes(ilb, STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_READWRITE,
                                       0, &storage);
-    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "StgCreateDocfileOnILockBytes failed: 0x%08lx.\n", hr);
     ILockBytes_Release(ilb);
     data_object_format = &dib_fmt;
     expected_method_list = methods_create_from_dib;
     hr = OleCreateFromData(&DataObject, &IID_IOleObject, OLERENDER_FORMAT, &dib_fmt, NULL,
                            storage, (void **)&ole_obj);
-    todo_wine ok(hr == DV_E_FORMATETC, "OleCreateFromData should failed: 0x%08x.\n", hr);
+    todo_wine ok(hr == DV_E_FORMATETC, "OleCreateFromData should failed: 0x%08lx.\n", hr);
     IStorage_Release(storage);
 }
 
diff --git a/dlls/ole32/tests/ole_server.c b/dlls/ole32/tests/ole_server.c
index a5e0a334491..0e0473ad0f3 100644
--- a/dlls/ole32/tests/ole_server.c
+++ b/dlls/ole32/tests/ole_server.c
@@ -114,7 +114,7 @@ static ULONG WINAPI UnknownImpl_AddRef(IUnknown *iface)
 
     InterlockedIncrement(&obj_ref);
 
-    trace("server: unknown_AddRef: %p, ref %u\n", iface, ref);
+    trace("server: unknown_AddRef: %p, ref %lu\n", iface, ref);
     return ref;
 }
 
@@ -125,7 +125,7 @@ static ULONG WINAPI UnknownImpl_Release(IUnknown *iface)
 
     InterlockedDecrement(&obj_ref);
 
-    trace("server: unknown_Release: %p, ref %u\n", iface, ref);
+    trace("server: unknown_Release: %p, ref %lu\n", iface, ref);
     if (ref == 0) HeapFree(GetProcessHeap(), 0, This);
     return ref;
 }
@@ -176,7 +176,7 @@ static ULONG WINAPI ClassFactoryImpl_AddRef(IClassFactory *iface)
 
     InterlockedIncrement(&class_ref);
 
-    trace("server: factory_AddRef: %p, ref %u\n", iface, ref);
+    trace("server: factory_AddRef: %p, ref %lu\n", iface, ref);
     return ref;
 }
 
@@ -187,7 +187,7 @@ static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface)
 
     InterlockedDecrement(&class_ref);
 
-    trace("server: factory_Release: %p, ref %u\n", iface, ref);
+    trace("server: factory_Release: %p, ref %lu\n", iface, ref);
     return ref;
 }
 
@@ -218,7 +218,7 @@ static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL loc
 {
     ULONG ref = lock ? InterlockedIncrement(&server_locks) : InterlockedDecrement(&server_locks);
 
-    trace("server: factory_LockServer: %p,%d, ref %u\n", iface, lock, ref);
+    trace("server: factory_LockServer: %p,%d, ref %lu\n", iface, lock, ref);
     return S_OK;
 }
 
@@ -238,7 +238,7 @@ static void ole_server(void)
     HRESULT hr;
     DWORD key;
 
-    trace("server: starting %u\n", GetCurrentProcessId());
+    trace("server: starting %lu\n", GetCurrentProcessId());
 
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
     if (hr == S_OK)
@@ -251,9 +251,9 @@ static void ole_server(void)
             HANDLE done_event, init_done_event;
 
             done_event = OpenEventA(SYNCHRONIZE, FALSE, "ole_server_done_event");
-            ok(done_event != 0, "server: OpenEvent error %d\n", GetLastError());
+            ok(done_event != 0, "server: OpenEvent error %ld\n", GetLastError());
             init_done_event = OpenEventA(EVENT_MODIFY_STATE, FALSE, "ole_server_init_done_event");
-            ok(init_done_event != 0, "server: OpenEvent error %d\n", GetLastError());
+            ok(init_done_event != 0, "server: OpenEvent error %ld\n", GetLastError());
 
             SetEvent(init_done_event);
 
@@ -261,9 +261,9 @@ static void ole_server(void)
             WaitForSingleObject(done_event, INFINITE);
 
             /* 1 remainining class ref is supposed to be cleared by CoRevokeClassObject */
-            ok(class_ref == 1, "expected 1 class refs, got %d\n", class_ref);
-            ok(!obj_ref, "expected 0 object refs, got %d\n", obj_ref);
-            ok(!server_locks, "expected 0 server locks, got %d\n", server_locks);
+            ok(class_ref == 1, "expected 1 class refs, got %ld\n", class_ref);
+            ok(!obj_ref, "expected 0 object refs, got %ld\n", obj_ref);
+            ok(!server_locks, "expected 0 server locks, got %ld\n", server_locks);
 
             CloseHandle(done_event);
             CloseHandle(init_done_event);
@@ -280,7 +280,7 @@ static void ole_server(void)
         trace("server: ret CoUninitialize\n");
     }
 
-    trace("server: exiting %u\n", GetCurrentProcessId());
+    trace("server: exiting %lu\n", GetCurrentProcessId());
 }
 
 /******************************* OLE client *******************************/
@@ -303,12 +303,12 @@ static BOOL register_server(const char *server, BOOL inproc_handler)
     if (ret == ERROR_SUCCESS)
     {
         ret = RegSetValueA(root, "LocalServer32", REG_SZ, server_path, strlen(server_path));
-        ok(ret == ERROR_SUCCESS, "RegSetValue error %u\n", ret);
+        ok(ret == ERROR_SUCCESS, "RegSetValue error %lu\n", ret);
 
         if (inproc_handler)
         {
             ret = RegSetValueA(root, "InprocHandler32", REG_SZ, "ole32.dll", 9);
-            ok(ret == ERROR_SUCCESS, "RegSetValue error %u\n", ret);
+            ok(ret == ERROR_SUCCESS, "RegSetValue error %lu\n", ret);
         }
 
         RegCloseKey(root);
@@ -332,11 +332,11 @@ static void unregister_server(void)
     if (ret == ERROR_SUCCESS)
     {
         ret = RegDeleteKeyA(root, "InprocHandler32");
-        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret);
+        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %lu\n", ret);
         ret = RegDeleteKeyA(root, "LocalServer32");
-        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret);
+        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %lu\n", ret);
         ret = RegDeleteKeyA(root, "");
-        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret);
+        ok(ret == ERROR_SUCCESS, "RegDeleteKey error %lu\n", ret);
         RegCloseKey(root);
     }
 }
@@ -362,7 +362,7 @@ static HANDLE start_server(const char *argv0)
 
     sprintf(cmdline, "\"%s\" ole_server -server", argv0);
     ret = CreateProcessA(argv0, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi);
-    ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError());
+    ok(ret, "CreateProcess(%s) error %ld\n", cmdline, GetLastError());
     if (!ret) return 0;
 
     CloseHandle(pi.hThread);
@@ -390,9 +390,9 @@ START_TEST(ole_server)
     argc = winetest_get_mainargs(&argv);
 
     done_event = CreateEventA(NULL, TRUE, FALSE, "ole_server_done_event");
-    ok(done_event != 0, "CreateEvent error %d\n", GetLastError());
+    ok(done_event != 0, "CreateEvent error %ld\n", GetLastError());
     init_done_event = CreateEventA(NULL, TRUE, FALSE, "ole_server_init_done_event");
-    ok(init_done_event != 0, "CreateEvent error %d\n", GetLastError());
+    ok(init_done_event != 0, "CreateEvent error %ld\n", GetLastError());
 
     if (argc > 2)
     {
@@ -428,10 +428,10 @@ START_TEST(ole_server)
     WaitForSingleObject(init_done_event, 5000);
 
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    ok(hr == S_OK, "OleInitialize error %#x\n", hr);
+    ok(hr == S_OK, "OleInitialize error %#lx\n", hr);
 
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&unknown);
-    ok(hr == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %#x\n", hr);
+    ok(hr == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %#lx\n", hr);
 
     if (!register_server(argv[0], TRUE))
     {
@@ -443,13 +443,13 @@ START_TEST(ole_server)
     trace("call CoCreateInstance(&IID_NULL)\n");
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_NULL, (void **)&unknown);
     trace("ret CoCreateInstance(&IID_NULL)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     /* in-process handler supports IID_IUnknown starting from Vista */
     trace("call CoCreateInstance(&IID_IUnknown)\n");
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&unknown);
     trace("ret CoCreateInstance(&IID_IUnknown)\n");
-    ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* XP,win2000 and earlier */, "CoCreateInstance(IID_IUnknown) error %#x\n", hr);
+    ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* XP,win2000 and earlier */, "CoCreateInstance(IID_IUnknown) error %#lx\n", hr);
     if (hr != S_OK)
     {
         win_skip("In-process handler doesn't support IID_IUnknown on this platform\n");
@@ -459,92 +459,92 @@ START_TEST(ole_server)
     trace("call CoCreateInstance(&IID_IOleObject)\n");
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_IOleObject, (void **)&oleobj);
     trace("ret CoCreateInstance(&IID_IOleObject)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     trace("call IUnknown_QueryInterface(&IID_IRunnableObject)\n");
     hr = IUnknown_QueryInterface(unknown, &IID_IRunnableObject, (void **)&runobj);
     trace("ret IUnknown_QueryInterface(&IID_IRunnableObject)\n");
-    ok(hr == S_OK, "QueryInterface(&IID_IRunnableObject) error %#x\n", hr);
+    ok(hr == S_OK, "QueryInterface(&IID_IRunnableObject) error %#lx\n", hr);
 
     ret = IRunnableObject_IsRunning(runobj);
-    ok(!ret, "expected 0, got %d\n", ret);
+    ok(!ret, "expected 0, got %ld\n", ret);
 
     trace("call OleRun\n");
     hr = OleRun(unknown);
     trace("ret OleRun\n");
     todo_wine
-    ok(hr == S_OK, "OleRun error %#x\n", hr);
+    ok(hr == S_OK, "OleRun error %#lx\n", hr);
 
     ret = IRunnableObject_IsRunning(runobj);
     todo_wine
-    ok(ret == 1, "expected 1, got %d\n", ret);
+    ok(ret == 1, "expected 1, got %ld\n", ret);
 
     trace("call IRunnableObject_Release\n");
     ret = IRunnableObject_Release(runobj);
     trace("ret IRunnableObject_Release\n");
-    ok(ret == 1, "expected ref 1, got %u\n", ret);
+    ok(ret == 1, "expected ref 1, got %lu\n", ret);
 
     trace("call IUnknown_QueryInterface(&IID_IOleObject)\n");
     hr = IUnknown_QueryInterface(unknown, &IID_IOleObject, (void **)&oleobj);
     trace("ret IUnknown_QueryInterface(&IID_IOleObject)\n");
-    ok(hr == S_OK, "QueryInterface(&IID_IOleObject) error %#x\n", hr);
+    ok(hr == S_OK, "QueryInterface(&IID_IOleObject) error %#lx\n", hr);
 
     trace("call IOleObject_Release\n");
     ret = IOleObject_Release(oleobj);
     trace("ret IOleObject_Release\n");
-    ok(ret == 1, "expected ref 1, got %u\n", ret);
+    ok(ret == 1, "expected ref 1, got %lu\n", ret);
 
     trace("call IUnknown_Release\n");
     ret = IUnknown_Release(unknown);
     trace("ret IUnknown_Release\n");
-    ok(!ret, "expected ref 0, got %u\n", ret);
+    ok(!ret, "expected ref 0, got %lu\n", ret);
 
 test_local_server:
     /* local server supports IID_IUnknown */
     trace("call CoCreateInstance(&IID_IUnknown)\n");
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&unknown);
     trace("ret CoCreateInstance(&IID_IUnknown)\n");
-    ok(hr == S_OK, "CoCreateInstance(IID_IUnknown) error %#x\n", hr);
+    ok(hr == S_OK, "CoCreateInstance(IID_IUnknown) error %#lx\n", hr);
 
     trace("call IUnknown_QueryInterface(&IID_IRunnableObject)\n");
     hr = IUnknown_QueryInterface(unknown, &IID_IRunnableObject, (void **)&runobj);
     trace("ret IUnknown_QueryInterface(&IID_IRunnableObject)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     trace("call OleRun\n");
     hr = OleRun(unknown);
     trace("ret OleRun\n");
-    ok(hr == S_OK, "OleRun error %#x\n", hr);
+    ok(hr == S_OK, "OleRun error %#lx\n", hr);
 
     trace("call IUnknown_QueryInterface(&IID_IOleObject)\n");
     hr = IUnknown_QueryInterface(unknown, &IID_IOleObject, (void **)&oleobj);
     trace("ret IUnknown_QueryInterface(&IID_IOleObject)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     trace("call IUnknown_Release\n");
     ret = IUnknown_Release(unknown);
     trace("ret IUnknown_Release\n");
-    ok(!ret, "expected ref 0, got %u\n", ret);
+    ok(!ret, "expected ref 0, got %lu\n", ret);
 
     trace("call CoGetClassObject(&IID_IClassFactory)\n");
     hr = CoGetClassObject(&clsid, CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void **)&factory);
     trace("ret CoGetClassObject(&IID_IClassFactory)\n");
-    ok(hr == S_OK, "CoGetClassObject error %#x\n", hr);
+    ok(hr == S_OK, "CoGetClassObject error %#lx\n", hr);
 
     trace("call IClassFactory_CreateInstance(&IID_NULL)\n");
     hr = IClassFactory_CreateInstance(factory, NULL, &IID_NULL, (void **)&oleobj);
     trace("ret IClassFactory_CreateInstance(&IID_NULL)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     trace("call IClassFactory_CreateInstance(&IID_IOleObject)\n");
     hr = IClassFactory_CreateInstance(factory, NULL, &IID_IOleObject, (void **)&oleobj);
     trace("ret IClassFactory_CreateInstance(&IID_IOleObject)\n");
-    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr);
+    ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#lx\n", hr);
 
     trace("call IClassFactory_Release\n");
     ret = IClassFactory_Release(factory);
     trace("ret IClassFactory_Release\n");
-    ok(!ret, "expected ref 0, got %u\n", ret);
+    ok(!ret, "expected ref 0, got %lu\n", ret);
 
     trace("signalling termination\n");
     SetEvent(done_event);
@@ -557,7 +557,7 @@ test_local_server:
 
     if (info->child_failures)
     {
-        trace("%d failures in child process\n", info->child_failures);
+        trace("%ld failures in child process\n", info->child_failures);
         winetest_add_failures(info->child_failures);
     }
 }
diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c
index 2b7e6d72851..01def6b15a8 100644
--- a/dlls/ole32/tests/propvariant.c
+++ b/dlls/ole32/tests/propvariant.c
@@ -162,17 +162,17 @@ static void expect(HRESULT hr, VARTYPE vt, BOOL copy, int line)
     if(flags == PROP_INV)
     {
         if (copy && (vt & VT_VECTOR))
-            ok(hr == DISP_E_BADVARTYPE || hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08x (line %d)\n", wine_vtypes[idx], modifier, hr, line);
+            ok(hr == DISP_E_BADVARTYPE || hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08lx (line %d)\n", wine_vtypes[idx], modifier, hr, line);
         else
-            ok(hr == (copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER), "%s (%s): got %08x (line %d)\n", wine_vtypes[idx], modifier, hr, line);
+            ok(hr == (copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER), "%s (%s): got %08lx (line %d)\n", wine_vtypes[idx], modifier, hr, line);
     }
     else if(flags == PROP_V0)
-        ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
+        ok(hr == S_OK, "%s (%s): got %08lx\n", wine_vtypes[idx], modifier, hr);
     else todo_wine_if(flags & PROP_TODO)
     {
         if(hr != S_OK)
             win_skip("%s (%s): unsupported\n", wine_vtypes[idx], modifier);
-        else ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr);
+        else ok(hr == S_OK, "%s (%s): got %08lx\n", wine_vtypes[idx], modifier, hr);
     }
 }
 
@@ -186,9 +186,9 @@ static void test_validtypes(void)
 
     memset(&propvar, 0x55, sizeof(propvar));
     hr = PropVariantClear(&propvar);
-    ok(hr == STG_E_INVALIDPARAMETER, "expected STG_E_INVALIDPARAMETER, got %08x\n", hr);
+    ok(hr == STG_E_INVALIDPARAMETER, "expected STG_E_INVALIDPARAMETER, got %08lx\n", hr);
     ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
-    ok(U(propvar).uhVal.QuadPart == 0, "expected 0, got %#x/%#x\n",
+    ok(U(propvar).uhVal.QuadPart == 0, "expected 0, got %#lx/%#lx\n",
        U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
 
     for (i = 0; i < ARRAY_SIZE(valid_types); i++)
@@ -212,7 +212,7 @@ static void test_validtypes(void)
         if (hr == S_OK)
         {
             ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
-            ok(U(copy).uhVal.QuadPart == U(propvar).uhVal.QuadPart, "%u: expected %#x/%#x, got %#x/%#x\n",
+            ok(U(copy).uhVal.QuadPart == U(propvar).uhVal.QuadPart, "%u: expected %#lx/%#lx, got %#lx/%#lx\n",
                i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart,
                U(copy).uhVal.u.LowPart, U(copy).uhVal.u.HighPart);
         }
@@ -224,7 +224,7 @@ static void test_validtypes(void)
         hr = PropVariantClear(&propvar);
         expect(hr, vt, FALSE, __LINE__);
         ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
-        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
+        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#lx/%#lx\n",
            i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
 
         memset(&propvar, 0x55, sizeof(propvar));
@@ -236,7 +236,7 @@ static void test_validtypes(void)
         if (hr == S_OK)
         {
             ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
-            ok(U(copy).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
+            ok(U(copy).uhVal.QuadPart == 0, "%u: expected 0, got %#lx/%#lx\n",
                i, U(copy).uhVal.u.LowPart, U(copy).uhVal.u.HighPart);
         }
         else
@@ -247,7 +247,7 @@ static void test_validtypes(void)
         hr = PropVariantClear(&propvar);
         expect(hr, vt, FALSE, __LINE__);
         ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
-        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
+        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#lx/%#lx\n",
            i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
 
         memset(&propvar, 0x55, sizeof(propvar));
@@ -260,7 +260,7 @@ static void test_validtypes(void)
         if (hr == S_OK)
         {
             ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
-            ok(!U(copy).caub.cElems, "%u: expected 0, got %d\n", i, U(copy).caub.cElems);
+            ok(!U(copy).caub.cElems, "%u: expected 0, got %ld\n", i, U(copy).caub.cElems);
             ok(!U(copy).caub.pElems, "%u: expected NULL, got %p\n", i, U(copy).caub.pElems);
         }
         else
@@ -271,7 +271,7 @@ static void test_validtypes(void)
         hr = PropVariantClear(&propvar);
         expect(hr, vt, FALSE, __LINE__);
         ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
-        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
+        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#lx/%#lx\n",
            i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
 
         memset(&propvar, 0x55, sizeof(propvar));
@@ -283,7 +283,7 @@ static void test_validtypes(void)
         if (hr == S_OK)
         {
             ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
-            ok(U(copy).uhVal.QuadPart == U(propvar).uhVal.QuadPart, "%u: expected %#x/%#x, got %#x/%#x\n",
+            ok(U(copy).uhVal.QuadPart == U(propvar).uhVal.QuadPart, "%u: expected %#lx/%#lx, got %#lx/%#lx\n",
                i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart,
                U(copy).uhVal.u.LowPart, U(copy).uhVal.u.HighPart);
         }
@@ -295,7 +295,7 @@ static void test_validtypes(void)
         hr = PropVariantClear(&propvar);
         expect(hr, vt, FALSE, __LINE__);
         ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt);
-        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n",
+        ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#lx/%#lx\n",
            i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
     }
 }
@@ -371,14 +371,14 @@ static void test_copy(void)
     propvarSrc.vt = VT_BSTR;
     U(propvarSrc).bstrVal = SysAllocStringLen(L"Test Str\0ing", 12);
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
-    ok(hr == S_OK, "Failed to copy propvar, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to copy propvar, hr %#lx.\n", hr);
     ok(SysStringLen(U(propvarDst).bstrVal) == 8, "Unexpected copy length.\n");
     ok(SysStringLen(U(propvarSrc).bstrVal) == 12, "Unexpected source length.\n");
     ok(!lstrcmpW(U(propvarSrc).bstrVal, U(propvarDst).bstrVal), "BSTR not copied properly\n");
     hr = PropVariantClear(&propvarSrc);
-    ok(hr == S_OK, "Failed to clear propvar, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear propvar, hr %#lx.\n", hr);
     hr = PropVariantClear(&propvarDst);
-    ok(hr == S_OK, "Failed to clear propvar, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to clear propvar, hr %#lx.\n", hr);
 
     propvarSrc.vt = VT_LPWSTR;
     U(propvarSrc).pwszVal = wszTestString;
@@ -401,12 +401,12 @@ static void test_copy(void)
     propvarSrc.vt = VT_UNKNOWN;
     U(propvarSrc).punkVal = &unk_obj.IUnknown_iface;
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
-    ok(hr == S_OK, "PropVariantCopy(...VT_UNKNOWN...) failed: 0x%08x.\n", hr);
+    ok(hr == S_OK, "PropVariantCopy(...VT_UNKNOWN...) failed: 0x%08lx.\n", hr);
     ok(U(propvarDst).punkVal == &unk_obj.IUnknown_iface, "Got wrong IUnknown pointer\n");
-    ok(unk_obj.ref == 2, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(unk_obj.ref == 2, "got wrong refcount: %ld.\n", unk_obj.ref);
     hr = PropVariantClear(&propvarDst);
-    ok(hr == S_OK, "PropVariantClear(...VT_UNKNOWN...) failed: 0x%08x.\n", hr);
-    ok(unk_obj.ref == 1, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(hr == S_OK, "PropVariantClear(...VT_UNKNOWN...) failed: 0x%08lx.\n", hr);
+    ok(unk_obj.ref == 1, "got wrong refcount: %ld.\n", unk_obj.ref);
     memset(&propvarSrc, 0, sizeof(propvarSrc));
 
     sabound.lLbound = 0;
@@ -416,19 +416,19 @@ static void test_copy(void)
     SafeArrayPutElement(sa, &saindex, &unk_obj.IUnknown_iface);
     saindex = 1;
     SafeArrayPutElement(sa, &saindex, &unk_obj.IUnknown_iface);
-    ok(unk_obj.ref == 3, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(unk_obj.ref == 3, "got wrong refcount: %ld.\n", unk_obj.ref);
 
     propvarSrc.vt = VT_ARRAY | VT_UNKNOWN;
     U(propvarSrc).parray = sa;
     hr = PropVariantCopy(&propvarDst, &propvarSrc);
-    ok(hr == S_OK, "PropVariantCopy(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08x.\n", hr);
-    ok(unk_obj.ref == 5, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(hr == S_OK, "PropVariantCopy(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08lx.\n", hr);
+    ok(unk_obj.ref == 5, "got wrong refcount: %ld.\n", unk_obj.ref);
     hr = PropVariantClear(&propvarDst);
-    ok(hr == S_OK, "PropVariantClear(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08x.\n", hr);
-    ok(unk_obj.ref == 3, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(hr == S_OK, "PropVariantClear(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08lx.\n", hr);
+    ok(unk_obj.ref == 3, "got wrong refcount: %ld.\n", unk_obj.ref);
     hr = PropVariantClear(&propvarSrc);
-    ok(hr == S_OK, "PropVariantClear(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08x.\n", hr);
-    ok(unk_obj.ref == 1, "got wrong refcount: %d.\n", unk_obj.ref);
+    ok(hr == S_OK, "PropVariantClear(...VT_ARRAY|VT_UNKNOWN...) failed: 0x%08lx.\n", hr);
+    ok(unk_obj.ref == 1, "got wrong refcount: %ld.\n", unk_obj.ref);
     memset(&propvarSrc, 0, sizeof(propvarSrc));
 }
 
@@ -570,7 +570,7 @@ static void test_propertytovariant(void)
 
     ok(ret == 0, "StgConvertPropertyToVariant returned %i\n", ret);
     ok(propvar.vt == VT_I4, "unexpected vt %x\n", propvar.vt);
-    ok(U(propvar).lVal == 0xfeabcdef, "unexpected lVal %x\n", U(propvar).lVal);
+    ok(U(propvar).lVal == 0xfeabcdef, "unexpected lVal %lx\n", U(propvar).lVal);
 
     ret = pStgConvertPropertyToVariant((SERIALIZEDPROPERTYVALUE*)serialized_bstr_wc,
         CP_WINUNICODE, &propvar, &allocator);
@@ -622,7 +622,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == NULL, "got nonnull propvalue\n");
-    todo_wine ok(len == 8, "unexpected length %d\n", len);
+    todo_wine ok(len == 8, "unexpected length %ld\n", len);
 
     if (len == 0xdeadbeef)
     {
@@ -635,7 +635,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
-    ok(len == 8, "unexpected length %d\n", len);
+    ok(len == 8, "unexpected length %ld\n", len);
     ok(!memcmp(propvalue, serialized_i4, 8), "got wrong data\n");
 
     propvar.vt = VT_EMPTY;
@@ -645,9 +645,9 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
-    ok(len == 4 || broken(len == 0) /* before Vista */, "unexpected length %d\n", len);
+    ok(len == 4 || broken(len == 0) /* before Vista */, "unexpected length %ld\n", len);
     if (len) ok(!memcmp(propvalue, serialized_empty, 4), "got wrong data\n");
-    else ok(propvalue->dwType == 0xdeadbeef, "unexpected type %d\n", propvalue->dwType);
+    else ok(propvalue->dwType == 0xdeadbeef, "unexpected type %ld\n", propvalue->dwType);
 
     propvar.vt = VT_NULL;
     len = 20;
@@ -655,7 +655,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
-    ok(len == 4, "unexpected length %d\n", len);
+    ok(len == 4, "unexpected length %ld\n", len);
     ok(!memcmp(propvalue, serialized_null, 4), "got wrong data\n");
 
     test_string_bstr = SysAllocString(test_string);
@@ -667,7 +667,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
-    ok(len == 20, "unexpected length %d\n", len);
+    ok(len == 20, "unexpected length %ld\n", len);
     ok(!memcmp(propvalue, serialized_bstr_wc, 20), "got wrong data\n");
 
     len = 20;
@@ -675,7 +675,7 @@ static void test_varianttoproperty(void)
         0, FALSE, 0);
 
     ok(propvalue == own_propvalue, "unexpected propvalue %p\n", propvalue);
-    ok(len == 16, "unexpected length %d\n", len);
+    ok(len == 16, "unexpected length %ld\n", len);
     ok(!memcmp(propvalue, serialized_bstr_mb, 16), "got wrong data\n");
 
     SysFreeString(test_string_bstr);
diff --git a/dlls/ole32/tests/stg_prop.c b/dlls/ole32/tests/stg_prop.c
index 967a1788333..6298c7ba9f9 100644
--- a/dlls/ole32/tests/stg_prop.c
+++ b/dlls/ole32/tests/stg_prop.c
@@ -59,34 +59,34 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
 
     hr = StgCreateDocfile(filename,
      STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, &storage);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
 
     if(propSetStorage)
     {
         hr = StgCreatePropSetStg(storage, 0, propSetStorage);
-        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
         hr = IPropertySetStorage_Create(*propSetStorage,
          &FMTID_SummaryInformation, NULL, PROPSETFLAG_ANSI,
          STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
          &propertyStorage);
-        ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
     }
     else
     {
         hr = IStorage_CreateStream(storage, szSummaryInfo,
          STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
-        ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
 
         hr = StgCreatePropStg((IUnknown *)stream, &FMTID_SummaryInformation,
          NULL, PROPSETFLAG_ANSI, 0, &propertyStorage);
-        ok(hr == S_OK, "StgCreatePropStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropStg failed: 0x%08lx\n", hr);
     }
 
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 0, NULL, NULL, 0);
-    ok(hr == S_OK, "WriteMultiple with 0 args failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple with 0 args failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, NULL, NULL, 0);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
 
     /* test setting one that I can't set */
     spec.ulKind = PRSPEC_PROPID;
@@ -95,7 +95,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     U(var).lVal = 1;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
     ok(hr == STG_E_INVALIDPARAMETER,
-     "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n", hr);
+     "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
 
     /* test setting one by name with an invalid propidNameFirst */
     spec.ulKind = PRSPEC_LPWSTR;
@@ -103,7 +103,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var,
      PID_DICTIONARY);
     ok(hr == STG_E_INVALIDPARAMETER,
-     "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n", hr);
+     "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
 
     /* test setting behavior (case-sensitive) */
     spec.ulKind = PRSPEC_PROPID;
@@ -111,14 +111,14 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     U(var).lVal = 1;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
     ok(hr == STG_E_INVALIDPARAMETER,
-     "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n", hr);
+     "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
 
     /* set one by value.. */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_FIRST_USABLE;
     U(var).lVal = 1;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
 
     /* set one by name */
     spec.ulKind = PRSPEC_LPWSTR;
@@ -126,7 +126,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     U(var).lVal = 2;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var,
      PID_FIRST_USABLE);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
 
     /* set a string value */
     spec.ulKind = PRSPEC_PROPID;
@@ -134,7 +134,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     var.vt = VT_LPSTR;
     U(var).pszVal = val;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
 
     /* set a clipboard value */
     spec.ulKind = PRSPEC_PROPID;
@@ -145,35 +145,35 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     clipdata.pClipData = clipcontent;
     U(var).pclipdata = &clipdata;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
 
 
     /* check reading */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 0, NULL, NULL);
-    ok(hr == S_FALSE, "ReadMultiple with 0 args failed: 0x%08x\n", hr);
+    ok(hr == S_FALSE, "ReadMultiple with 0 args failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, NULL, NULL);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     /* read by propid */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_FIRST_USABLE;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I4 && U(var).lVal == 1,
-     "Didn't get expected type or value for property (got type %d, value %d)\n",
+     "Didn't get expected type or value for property (got type %d, value %ld)\n",
      var.vt, U(var).lVal);
     /* read by name */
     spec.ulKind = PRSPEC_LPWSTR;
     U(spec).lpwstr = propName;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I4 && U(var).lVal == 2,
-     "Didn't get expected type or value for property (got type %d, value %d)\n",
+     "Didn't get expected type or value for property (got type %d, value %ld)\n",
      var.vt, U(var).lVal);
     /* read string value */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PIDSI_AUTHOR;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_LPSTR && !lstrcmpA(U(var).pszVal, val),
      "Didn't get expected type or value for property (got type %d, value %s)\n",
      var.vt, U(var).pszVal);
@@ -183,7 +183,7 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PIDSI_THUMBNAIL;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_CF, "variant type wrong\n");
     ok(U(var).pclipdata->ulClipFmt == CF_ENHMETAFILE,
         "clipboard type wrong\n");
@@ -195,54 +195,54 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
 
     /* check deleting */
     hr = IPropertyStorage_DeleteMultiple(propertyStorage, 0, NULL);
-    ok(hr == S_OK, "DeleteMultiple with 0 args failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "DeleteMultiple with 0 args failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, NULL);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     /* contrary to what the docs say, you can't delete the dictionary */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_DICTIONARY;
     hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
     ok(hr == STG_E_INVALIDPARAMETER,
-     "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n", hr);
+     "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
     /* now delete the first value.. */
     U(spec).propid = PID_FIRST_USABLE;
     hr = IPropertyStorage_DeleteMultiple(propertyStorage, 1, &spec);
-    ok(hr == S_OK, "DeleteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "DeleteMultiple failed: 0x%08lx\n", hr);
     /* and check that it's no longer readable */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08x\n", hr);
+    ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08lx\n", hr);
 
     hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
-    ok(hr == S_OK, "Commit failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
 
     /* check reverting */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_FIRST_USABLE;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_Revert(propertyStorage);
-    ok(hr == S_OK, "Revert failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "Revert failed: 0x%08lx\n", hr);
     /* now check that it's still not there */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08x\n", hr);
+    ok(hr == S_FALSE, "Expected S_FALSE, got 0x%08lx\n", hr);
     /* set an integer value again */
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_FIRST_USABLE;
     var.vt = VT_I4;
     U(var).lVal = 1;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* commit it */
     hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
-    ok(hr == S_OK, "Commit failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
     /* set it to a string value */
     var.vt = VT_LPSTR;
     U(var).pszVal = val;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* revert it */
     hr = IPropertyStorage_Revert(propertyStorage);
-    ok(hr == S_OK, "Revert failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "Revert failed: 0x%08lx\n", hr);
     /* Oddly enough, there's no guarantee that a successful revert actually
      * implies the value wasn't saved.  Maybe transactional mode needs to be
      * used for that?
@@ -256,40 +256,40 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     /* now open it again */
     hr = StgOpenStorage(filename, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
      NULL, 0, &storage);
-    ok(hr == S_OK, "StgOpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgOpenStorage failed: 0x%08lx\n", hr);
 
     if(propSetStorage)
     {
         hr = StgCreatePropSetStg(storage, 0, propSetStorage);
-        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
         hr = IPropertySetStorage_Open(*propSetStorage, &FMTID_SummaryInformation,
          STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &propertyStorage);
-        ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08lx\n", hr);
     }
     else
     {
         hr = IStorage_OpenStream(storage, szSummaryInfo,
          0, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream);
-        ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08lx\n", hr);
 
         hr = StgOpenPropStg((IUnknown *)stream, &FMTID_SummaryInformation,
          PROPSETFLAG_DEFAULT, 0, &propertyStorage);
-        ok(hr == S_OK, "StgOpenPropStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgOpenPropStg failed: 0x%08lx\n", hr);
     }
 
     /* check properties again */
     spec.ulKind = PRSPEC_LPWSTR;
     U(spec).lpwstr = propName;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I4 && U(var).lVal == 2,
-     "Didn't get expected type or value for property (got type %d, value %d)\n",
+     "Didn't get expected type or value for property (got type %d, value %ld)\n",
      var.vt, U(var).lVal);
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PIDSI_AUTHOR;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_LPSTR && !lstrcmpA(U(var).pszVal, val),
      "Didn't get expected type or value for property (got type %d, value %s)\n",
      var.vt, U(var).pszVal);
@@ -305,28 +305,28 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     /* Test creating a property set storage with a random GUID */
     hr = StgCreateDocfile(filename,
      STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, &storage);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
 
     if(propSetStorage)
     {
         hr = StgCreatePropSetStg(storage, 0, propSetStorage);
-        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
         hr = IPropertySetStorage_Create(*propSetStorage,
          &anyOldGuid, NULL, PROPSETFLAG_ANSI,
          STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
          &propertyStorage);
-        ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
     }
     else
     {
         hr = IStorage_CreateStream(storage, szSummaryInfo,
          STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stream);
-        ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
 
         hr = StgCreatePropStg((IUnknown *)stream, &anyOldGuid, NULL,
          PROPSETFLAG_DEFAULT, 0, &propertyStorage);
-        ok(hr == S_OK, "StgCreatePropStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropStg failed: 0x%08lx\n", hr);
     }
 
     spec.ulKind = PRSPEC_PROPID;
@@ -334,10 +334,10 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     var.vt = VT_I4;
     U(var).lVal = 1;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
 
     hr = IPropertyStorage_Commit(propertyStorage, STGC_DEFAULT);
-    ok(hr == S_OK, "Commit failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "Commit failed: 0x%08lx\n", hr);
 
     IPropertyStorage_Release(propertyStorage);
     if(propSetStorage) IPropertySetStorage_Release(*propSetStorage);
@@ -347,35 +347,35 @@ static void testPropsHelper(IPropertySetStorage **propSetStorage)
     /* now open it again */
     hr = StgOpenStorage(filename, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE,
      NULL, 0, &storage);
-    ok(hr == S_OK, "StgOpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgOpenStorage failed: 0x%08lx\n", hr);
 
     if(propSetStorage)
     {
         hr = StgCreatePropSetStg(storage, 0, propSetStorage);
-        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
         hr = IPropertySetStorage_Open(*propSetStorage, &anyOldGuid,
          STGM_READWRITE | STGM_SHARE_EXCLUSIVE, &propertyStorage);
-        ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IPropertySetStorage_Open failed: 0x%08lx\n", hr);
     }
     else
     {
         hr = IStorage_OpenStream(storage, szSummaryInfo,
          0, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stream);
-        ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "IStorage_OpenStream failed: 0x%08lx\n", hr);
 
         hr = StgOpenPropStg((IUnknown *)stream, &anyOldGuid,
          PROPSETFLAG_DEFAULT, 0, &propertyStorage);
-        ok(hr == S_OK, "StgOpenPropStg failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "StgOpenPropStg failed: 0x%08lx\n", hr);
     }
 
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_FIRST_USABLE;
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
 
     ok(var.vt == VT_I4 && U(var).lVal == 1,
-     "Didn't get expected type or value for property (got type %d, value %d)\n",
+     "Didn't get expected type or value for property (got type %d, value %ld)\n",
      var.vt, U(var).lVal);
 
     IPropertyStorage_Release(propertyStorage);
@@ -413,42 +413,42 @@ static void testCodepage(void)
 
     hr = StgCreateDocfile(fileName,
      STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, &storage);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
 
     hr = StgCreatePropSetStg(storage, 0, &propSetStorage);
-    ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
     hr = IPropertySetStorage_Create(propSetStorage,
      &FMTID_SummaryInformation, NULL, PROPSETFLAG_DEFAULT,
      STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
      &propertyStorage);
-    ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
 
     PropVariantInit(&var);
     spec.ulKind = PRSPEC_PROPID;
     U(spec).propid = PID_CODEPAGE;
     /* check code page before it's been explicitly set */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I2 && U(var).iVal == 1200,
      "Didn't get expected type or value for property\n");
     /* Set the code page to ascii */
     var.vt = VT_I2;
     U(var).iVal = 1252;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* check code page */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I2 && U(var).iVal == 1252,
      "Didn't get expected type or value for property\n");
     /* Set code page to Unicode */
     U(var).iVal = 1200;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* check code page */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I2 && U(var).iVal == 1200,
      "Didn't get expected type or value for property\n");
     /* Set a string value */
@@ -457,9 +457,9 @@ static void testCodepage(void)
     var.vt = VT_LPSTR;
     U(var).pszVal = aval;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_LPSTR && !strcmp(U(var).pszVal, "hi"),
      "Didn't get expected type or value for property\n");
     PropVariantClear(&var);
@@ -471,9 +471,9 @@ static void testCodepage(void)
     var.vt = VT_LPSTR;
     U(var).pszVal = (LPSTR)wval;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_LPSTR && !strcmp(U(var).pszVal, "h"),
      "Didn't get expected type or value for property\n");
     PropVariantClear(&var);
@@ -485,7 +485,7 @@ static void testCodepage(void)
     U(var).iVal = 1200;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
     ok(hr == STG_E_INVALIDPARAMETER,
-     "Expected STG_E_INVALIDPARAMETER, got 0x%08x\n", hr);
+     "Expected STG_E_INVALIDPARAMETER, got 0x%08lx\n", hr);
 
     IPropertyStorage_Release(propertyStorage);
     IPropertySetStorage_Release(propSetStorage);
@@ -496,28 +496,28 @@ static void testCodepage(void)
     /* same tests, but with PROPSETFLAG_ANSI */
     hr = StgCreateDocfile(fileName,
      STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, &storage);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
 
     hr = StgCreatePropSetStg(storage, 0, &propSetStorage);
-    ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreatePropSetStg failed: 0x%08lx\n", hr);
 
     hr = IPropertySetStorage_Create(propSetStorage,
      &FMTID_SummaryInformation, NULL, PROPSETFLAG_ANSI,
      STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
      &propertyStorage);
-    ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IPropertySetStorage_Create failed: 0x%08lx\n", hr);
 
     /* check code page before it's been explicitly set */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I2, "Didn't get expected type for property (%u)\n", var.vt);
     /* Set code page to Unicode */
     U(var).iVal = 1200;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* check code page */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_I2 && U(var).iVal == 1200,
      "Didn't get expected type or value for property\n");
     /* This test is commented out for documentation.  It fails under Wine,
@@ -529,7 +529,7 @@ static void testCodepage(void)
     /* Set code page to 950 (Traditional Chinese) */
     U(var).iVal = 950;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* Try writing an invalid string: lead byte 0x81 is unused in Traditional
      * Chinese.
      */
@@ -538,10 +538,10 @@ static void testCodepage(void)
     var.vt = VT_LPSTR;
     U(var).pszVal = (LPSTR)strVal;
     hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0);
-    ok(hr == S_OK, "WriteMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "WriteMultiple failed: 0x%08lx\n", hr);
     /* Check returned string */
     hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var);
-    ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "ReadMultiple failed: 0x%08lx\n", hr);
     ok(var.vt == VT_LPSTR && !strcmp(U(var).pszVal, (LPCSTR)strVal),
      "Didn't get expected type or value for property\n");
     }
@@ -568,57 +568,57 @@ static void testFmtId(void)
     HRESULT hr;
 
     hr = FmtIdToPropStgName(NULL, name);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     hr = FmtIdToPropStgName(&FMTID_SummaryInformation, NULL);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     hr = FmtIdToPropStgName(&FMTID_SummaryInformation, name);
-    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
     ok(!memcmp(name, szSummaryInfo, (lstrlenW(szSummaryInfo) + 1) *
      sizeof(WCHAR)), "Got wrong name for FMTID_SummaryInformation\n");
     hr = FmtIdToPropStgName(&FMTID_DocSummaryInformation, name);
-    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
     ok(!memcmp(name, szDocSummaryInfo, (lstrlenW(szDocSummaryInfo) + 1) *
      sizeof(WCHAR)), "Got wrong name for FMTID_DocSummaryInformation\n");
     hr = FmtIdToPropStgName(&FMTID_UserDefinedProperties, name);
-    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
     ok(!memcmp(name, szDocSummaryInfo, (lstrlenW(szDocSummaryInfo) + 1) *
      sizeof(WCHAR)), "Got wrong name for FMTID_DocSummaryInformation\n");
     hr = FmtIdToPropStgName(&IID_IPropertySetStorage, name);
-    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "FmtIdToPropStgName failed: 0x%08lx\n", hr);
     ok(!memcmp(name, szIID_IPropSetStg, (lstrlenW(szIID_IPropSetStg) + 1) *
      sizeof(WCHAR)), "Got wrong name for IID_IPropertySetStorage\n");
 
     /* test args first */
     hr = PropStgNameToFmtId(NULL, NULL);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     hr = PropStgNameToFmtId(NULL, &fmtid);
-    ok(hr == STG_E_INVALIDNAME, "Expected STG_E_INVALIDNAME, got 0x%08x\n",
+    ok(hr == STG_E_INVALIDNAME, "Expected STG_E_INVALIDNAME, got 0x%08lx\n",
      hr);
     hr = PropStgNameToFmtId(szDocSummaryInfo, NULL);
-    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got 0x%08lx\n", hr);
     /* test the known format IDs */
     hr = PropStgNameToFmtId(szSummaryInfo, &fmtid);
-    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
     ok(!memcmp(&fmtid, &FMTID_SummaryInformation, sizeof(fmtid)),
      "Got unexpected FMTID, expected FMTID_SummaryInformation\n");
     hr = PropStgNameToFmtId(szDocSummaryInfo, &fmtid);
-    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
     ok(!memcmp(&fmtid, &FMTID_DocSummaryInformation, sizeof(fmtid)),
      "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
     /* test another GUID */
     hr = PropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
-    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
     ok(!memcmp(&fmtid, &IID_IPropertySetStorage, sizeof(fmtid)),
      "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
     /* now check case matching */
     CharUpperW(szDocSummaryInfo + 1);
     hr = PropStgNameToFmtId(szDocSummaryInfo, &fmtid);
-    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
     ok(!memcmp(&fmtid, &FMTID_DocSummaryInformation, sizeof(fmtid)),
      "Got unexpected FMTID, expected FMTID_DocSummaryInformation\n");
     CharUpperW(szIID_IPropSetStg + 1);
     hr = PropStgNameToFmtId(szIID_IPropSetStg, &fmtid);
-    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "PropStgNameToFmtId failed: 0x%08lx\n", hr);
     ok(!memcmp(&fmtid, &IID_IPropertySetStorage, sizeof(fmtid)),
      "Got unexpected FMTID, expected IID_IPropertySetStorage\n");
 }
@@ -639,91 +639,91 @@ static void test_propertyset_storage_enum(void)
     ok(ret, "Failed to get temporary file name.\n");
 
     hr = StgCreateDocfile(filename, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, &storage);
-    ok(hr == S_OK, "Failed to crate storage, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to crate storage, hr %#lx.\n", hr);
 
     hr = StgCreatePropSetStg(storage, 0, &ps_storage);
-    ok(hr == S_OK, "Failed to create property set storage, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create property set storage, hr %#lx.\n", hr);
 
     hr = IPropertySetStorage_Create(ps_storage, &FMTID_SummaryInformation, &IID_IUnknown, PROPSETFLAG_ANSI,
             STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, &prop_storage);
-    ok(hr == S_OK, "Failed to create property storage, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create property storage, hr %#lx.\n", hr);
 
     hr = IPropertyStorage_Stat(prop_storage, &psstg);
-    ok(hr == S_OK, "Failed to get prop storage stats, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get prop storage stats, hr %#lx.\n", hr);
     todo_wine
     ok(IsEqualCLSID(&psstg.clsid, &IID_IUnknown), "Unexpected storage clsid %s.\n", wine_dbgstr_guid(&psstg.clsid));
 
     hr = IPropertySetStorage_Enum(ps_storage, NULL);
-    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
 
     hr = IPropertySetStorage_Enum(ps_storage, &ps_enum);
-    ok(hr == S_OK, "Failed to get enum object, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum object, hr %#lx.\n", hr);
 
     memset(&psstg, 0, sizeof(psstg));
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_OK, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
     ok(fetched == 1, "Unexpected fetched count.\n");
     ok(IsEqualCLSID(&psstg.fmtid, &FMTID_SummaryInformation), "Unexpected fmtid %s.\n",
             wine_dbgstr_guid(&psstg.fmtid));
-    ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#x / %#x.\n",
+    ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#lx / %#lx.\n",
             psstg.mtime.dwHighDateTime, psstg.mtime.dwLowDateTime);
 
     memset(&ftime, 0, sizeof(ftime));
     ftime.dwLowDateTime = 1;
     hr = IPropertyStorage_SetTimes(prop_storage, NULL, NULL, &ftime);
     todo_wine
-    ok(hr == S_OK, "Failed to set storage times, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to set storage times, hr %#lx.\n", hr);
 
     hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
-    ok(hr == S_OK, "Failed to reset enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
     memset(&psstg, 0, sizeof(psstg));
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_OK, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
     ok(fetched == 1, "Unexpected fetched count.\n");
     ok(IsEqualCLSID(&psstg.fmtid, &FMTID_SummaryInformation), "Unexpected fmtid %s.\n",
             wine_dbgstr_guid(&psstg.fmtid));
-    ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#x / %#x.\n",
+    ok(psstg.mtime.dwHighDateTime == 0 && psstg.mtime.dwLowDateTime == 0, "Unexpected mtime %#lx / %#lx.\n",
             psstg.mtime.dwHighDateTime, psstg.mtime.dwLowDateTime);
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
 
     hr = IPropertySetStorage_Create(ps_storage, &FMTID_SummaryInformation, &IID_IUnknown, PROPSETFLAG_ANSI,
             STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE, &prop_storage2);
-    ok(hr == S_OK, "Failed to create property storage, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to create property storage, hr %#lx.\n", hr);
 
     hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
-    ok(hr == S_OK, "Failed to reset enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_OK, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to get enum item, hr %#lx.\n", hr);
     ok(fetched == 1, "Unexpected fetched count.\n");
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_FALSE, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
 
     /* Skipping. */
     hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
-    ok(hr == S_OK, "Failed to reset enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 2);
     todo_wine
-    ok(hr == S_FALSE, "Failed to skip, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to skip, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
     todo_wine
-    ok(hr == S_FALSE, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
 
     hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
-    ok(hr == S_OK, "Failed to reset enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 1);
-    ok(hr == S_OK, "Failed to skip, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to skip, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
     todo_wine
-    ok(hr == S_FALSE, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
 
     hr = IEnumSTATPROPSETSTG_Reset(ps_enum);
-    ok(hr == S_OK, "Failed to reset enumerator, hr %#x.\n", hr);
+    ok(hr == S_OK, "Failed to reset enumerator, hr %#lx.\n", hr);
 todo_wine {
     hr = IEnumSTATPROPSETSTG_Skip(ps_enum, 0);
-    ok(hr == S_FALSE, "Failed to skip, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to skip, hr %#lx.\n", hr);
     hr = IEnumSTATPROPSETSTG_Next(ps_enum, 1, &psstg, &fetched);
-    ok(hr == S_FALSE, "Failed to get enum item, hr %#x.\n", hr);
+    ok(hr == S_FALSE, "Failed to get enum item, hr %#lx.\n", hr);
 }
     IEnumSTATPROPSETSTG_Release(ps_enum);
 
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 9f4311cd07c..58cf91b0d92 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -33,7 +33,7 @@
 
 DEFINE_GUID( test_stg_cls, 0x88888888, 0x0425, 0x0000, 0,0,0,0,0,0,0,0);
 
-#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
+#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error %#08lx\n", hr)
 
 static CHAR filenameA[MAX_PATH];
 static WCHAR filename[MAX_PATH];
@@ -250,7 +250,7 @@ static void CreateTestLockBytes(TestLockBytes **This)
 static void DeleteTestLockBytes(TestLockBytes *This)
 {
     ok(This->ILockBytes_iface.lpVtbl == &TestLockBytes_Vtbl, "test lock bytes %p deleted with incorrect vtable\n", This);
-    ok(This->ref == 1, "test lock bytes %p deleted with %i references instead of 1\n", This, This->ref);
+    ok(This->ref == 1, "test lock bytes %p deleted with %li references instead of 1\n", This, This->ref);
     HeapFree(GetProcessHeap(), 0, This->contents);
     HeapFree(GetProcessHeap(), 0, This);
 }
@@ -519,7 +519,7 @@ static void test_storage_stream(void)
     ok(r==STG_E_INVALIDNAME, "IStorage->CreateStream wrong error\n");
     r = IStorage_CreateStream(stg, longname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm );
     ok(r==STG_E_INVALIDNAME || broken(r==S_OK) /* nt4 */,
-       "IStorage->CreateStream wrong error, got %d GetLastError()=%d\n", r, GetLastError());
+       "IStorage->CreateStream wrong error, got %ld GetLastError()=%ld\n", r, GetLastError());
     r = IStorage_CreateStream(stg, stmname, STGM_READWRITE, 0, 0, &stm );
     ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n");
     r = IStorage_CreateStream(stg, stmname, STGM_READ, 0, 0, &stm );
@@ -537,9 +537,9 @@ static void test_storage_stream(void)
 
     /* test for support interfaces */
     r = IStream_QueryInterface(stm, &IID_IPersist, (void**)&unk);
-    ok(r==E_NOINTERFACE, "got 0x%08x\n", r);
+    ok(r==E_NOINTERFACE, "got 0x%08lx\n", r);
     r = IStream_QueryInterface(stm, &IID_IPersistStream, (void**)&unk);
-    ok(r==E_NOINTERFACE, "got 0x%08x\n", r);
+    ok(r==E_NOINTERFACE, "got 0x%08lx\n", r);
 
     r = IStream_Release(stm);
     ok(r == 0, "wrong ref count\n");
@@ -658,7 +658,7 @@ static void test_storage_stream(void)
     ok(r==S_OK, "IStorage->CreateStream failed\n");
 
     r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &p);
-    ok(r==STG_E_REVERTED, "overwritten stream should return STG_E_REVERTED instead of 0x%08x\n", r);
+    ok(r==STG_E_REVERTED, "overwritten stream should return STG_E_REVERTED instead of 0x%08lx\n", r);
 
     r = IStream_Release(stm2);
     ok(r == 0, "wrong ref count\n");
@@ -676,7 +676,7 @@ static void test_storage_stream(void)
     if (stg)
     {
         r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
-        ok(r == STG_E_INVALIDFLAG, "IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08x\n", r);
+        ok(r == STG_E_INVALIDFLAG, "IStorage->OpenStream should return STG_E_INVALIDFLAG instead of 0x%08lx\n", r);
         IStorage_Release(stg);
     }
 
@@ -747,7 +747,7 @@ static void test_open_storage(void)
     /* try opening a nonexistent file - it should not create it */
     stgm = STGM_DIRECT | STGM_SHARE_EXCLUSIVE | STGM_READWRITE;
     r = StgOpenStorage( filename, NULL, stgm, NULL, 0, &stg);
-    ok(r!=S_OK, "StgOpenStorage failed: 0x%08x\n", r);
+    ok(r!=S_OK, "StgOpenStorage failed: 0x%08lx\n", r);
     if (r==S_OK) IStorage_Release(stg);
     ok(!is_existing_file(filenameA), "StgOpenStorage should not create a file\n");
     DeleteFileA(filenameA);
@@ -1040,10 +1040,10 @@ static void test_storage_refcount(void)
     ok (r == STG_E_REVERTED, "stat should fail\n");
 
     r = IStream_Write( stm, "Test string", strlen("Test string"), NULL);
-    ok (r == STG_E_REVERTED, "IStream_Write should return STG_E_REVERTED instead of 0x%08x\n", r);
+    ok (r == STG_E_REVERTED, "IStream_Write should return STG_E_REVERTED instead of 0x%08lx\n", r);
 
     r = IStream_Read( stm, buffer, sizeof(buffer), NULL);
-    ok (r == STG_E_REVERTED, "IStream_Read should return STG_E_REVERTED instead of 0x%08x\n", r);
+    ok (r == STG_E_REVERTED, "IStream_Read should return STG_E_REVERTED instead of 0x%08lx\n", r);
 
     r = IStream_Release(stm);
     ok (r == 0, "stream not released\n");
@@ -1051,19 +1051,19 @@ static void test_storage_refcount(void)
     /* tests that STGM_PRIORITY doesn't prevent readwrite access from other
      * StgOpenStorage calls in transacted mode */
     r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stgprio);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
 
     /* non-transacted mode read/write fails */
     r = StgOpenStorage( filename, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg);
-    ok(r==STG_E_LOCKVIOLATION, "StgOpenStorage should return STG_E_LOCKVIOLATION instead of 0x%08x\n", r);
+    ok(r==STG_E_LOCKVIOLATION, "StgOpenStorage should return STG_E_LOCKVIOLATION instead of 0x%08lx\n", r);
 
     /* non-transacted mode read-only succeeds */
     r = StgOpenStorage( filename, NULL, STGM_SHARE_DENY_WRITE|STGM_READ, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
     IStorage_Release(stg);
 
     r = StgOpenStorage( filename, NULL, STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
     if(stg)
     {
         static const WCHAR stgname[] = { ' ',' ',' ','2','9',0 };
@@ -1074,40 +1074,40 @@ static void test_storage_refcount(void)
         STATSTG statstg;
 
         r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
-        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r);
-        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
-        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart);
-        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart);
+        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08lx\n", r);
+        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
+        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %ld\n", U(statstg.cbSize).LowPart);
+        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %ld\n", U(statstg.cbSize).HighPart);
         ok(statstg.grfMode == (STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE),
-            "Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode);
-        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
+            "Statstg grfMode should have been 0x10022 instead of 0x%lx\n", statstg.grfMode);
+        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
         ok(IsEqualCLSID(&statstg.clsid, &test_stg_cls), "Statstg clsid is not test_stg_cls\n");
-        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
-        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
+        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
+        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
 
         r = IStorage_CreateStorage( stg, stgname, STGM_SHARE_EXCLUSIVE, 0, 0, &stg2 );
-        ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08x\n", r);
+        ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08lx\n", r);
 
         r = IStorage_Stat( stg2, &statstg, STATFLAG_DEFAULT );
-        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r);
+        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08lx\n", r);
         ok(!memcmp(statstg.pwcsName, stgname, sizeof(stgname)),
             "Statstg pwcsName should have been the name the storage was created with\n");
-        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
-        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart);
-        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart);
+        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
+        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %ld\n", U(statstg.cbSize).LowPart);
+        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %ld\n", U(statstg.cbSize).HighPart);
         ok(statstg.grfMode == STGM_SHARE_EXCLUSIVE,
-            "Statstg grfMode should have been STGM_SHARE_EXCLUSIVE instead of 0x%x\n", statstg.grfMode);
-        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
+            "Statstg grfMode should have been STGM_SHARE_EXCLUSIVE instead of 0x%lx\n", statstg.grfMode);
+        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
         ok(IsEqualCLSID(&statstg.clsid, &CLSID_NULL), "Statstg clsid is not CLSID_NULL\n");
-        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
-        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
+        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
+        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
         CoTaskMemFree(statstg.pwcsName);
 
         r = IStorage_CreateStorage( stg2, stgname2, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stg3 );
-        ok(r == STG_E_ACCESSDENIED, "CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08x\n", r);
+        ok(r == STG_E_ACCESSDENIED, "CreateStorage should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
 
         r = IStorage_CreateStream( stg2, stmname2, STGM_CREATE|STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
-        ok(r == STG_E_ACCESSDENIED, "CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08x\n", r);
+        ok(r == STG_E_ACCESSDENIED, "CreateStream should have returned STG_E_ACCESSDENIED instead of 0x%08lx\n", r);
 
         IStorage_Release(stg2);
 
@@ -1117,7 +1117,7 @@ static void test_storage_refcount(void)
 
     /* Multiple STGM_PRIORITY opens are possible. */
     r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
     if(stg)
     {
         r = IStorage_Release(stg);
@@ -1125,7 +1125,7 @@ static void test_storage_refcount(void)
     }
 
     r = StgOpenStorage( NULL, stgprio, STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
     if(stg)
     {
         static const WCHAR stgname[] = { ' ',' ',' ','2','9',0 };
@@ -1133,24 +1133,24 @@ static void test_storage_refcount(void)
         STATSTG statstg;
 
         r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME );
-        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r);
-        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type);
-        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart);
-        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart);
+        ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08lx\n", r);
+        ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %ld\n", statstg.type);
+        ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %ld\n", U(statstg.cbSize).LowPart);
+        ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %ld\n", U(statstg.cbSize).HighPart);
         ok(statstg.grfMode == (STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE),
-            "Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode);
-        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported);
+            "Statstg grfMode should have been 0x10022 instead of 0x%lx\n", statstg.grfMode);
+        ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %ld\n", statstg.grfLocksSupported);
         ok(IsEqualCLSID(&statstg.clsid, &test_stg_cls), "Statstg clsid is not test_stg_cls\n");
-        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits);
-        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved);
+        ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %ld\n", statstg.grfStateBits);
+        ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %ld\n", statstg.reserved);
 
         r = IStorage_CreateStorage( stg, stgname, STGM_SHARE_EXCLUSIVE, 0, 0, &stg2 );
-        ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08x\n", r);
+        ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08lx\n", r);
 
         IStorage_Release(stg2);
 
         r = IStorage_Commit( stg, 0 );
-        ok(r == S_OK, "Commit should have succeeded instead of returning 0x%08x\n", r);
+        ok(r == S_OK, "Commit should have succeeded instead of returning 0x%08lx\n", r);
 
         r = IStorage_Release(stg);
         ok(r == 0, "wrong ref count\n");
@@ -1174,34 +1174,34 @@ static void test_writeclassstg(void)
     ok(r==S_OK, "StgCreateDocfile failed\n");
 
     r = ReadClassStg( NULL, NULL );
-    ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
+    ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08lX\n", r);
 
     memset(&temp_cls, 0xcc, sizeof(temp_cls));
     memset(&cls2, 0xcc, sizeof(cls2));
     r = ReadClassStg( NULL, &temp_cls );
-    ok(r == E_INVALIDARG, "got 0x%08x\n", r);
+    ok(r == E_INVALIDARG, "got 0x%08lx\n", r);
     ok(IsEqualCLSID(&temp_cls, &cls2), "got wrong clsid\n");
 
     r = ReadClassStg( stg, NULL );
-    ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
+    ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08lX\n", r);
 
     temp_cls.Data1 = 0xdeadbeef;
     r = ReadClassStg( stg, &temp_cls );
-    ok(r == S_OK, "ReadClassStg failed with 0x%08X\n", r);
+    ok(r == S_OK, "ReadClassStg failed with 0x%08lX\n", r);
 
     ok(IsEqualCLSID(&temp_cls, &CLSID_NULL), "ReadClassStg returned wrong clsid\n");
 
     r = WriteClassStg( NULL, NULL );
-    ok(r == E_INVALIDARG, "WriteClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
+    ok(r == E_INVALIDARG, "WriteClassStg should return E_INVALIDARG instead of 0x%08lX\n", r);
 
     r = WriteClassStg( stg, NULL );
-    ok(r == STG_E_INVALIDPOINTER, "WriteClassStg should return STG_E_INVALIDPOINTER instead of 0x%08X\n", r);
+    ok(r == STG_E_INVALIDPOINTER, "WriteClassStg should return STG_E_INVALIDPOINTER instead of 0x%08lX\n", r);
 
     r = WriteClassStg( stg, &test_stg_cls );
-    ok( r == S_OK, "WriteClassStg failed with 0x%08X\n", r);
+    ok( r == S_OK, "WriteClassStg failed with 0x%08lX\n", r);
 
     r = ReadClassStg( stg, &temp_cls );
-    ok( r == S_OK, "ReadClassStg failed with 0x%08X\n", r);
+    ok( r == S_OK, "ReadClassStg failed with 0x%08lX\n", r);
     ok(IsEqualCLSID(&temp_cls, &test_stg_cls), "ReadClassStg returned wrong clsid\n");
 
     r = IStorage_Release( stg );
@@ -1255,7 +1255,7 @@ static void test_streamenum(void)
         CoTaskMemFree(stat.pwcsName);
 
     r = IEnumSTATSTG_Release(ee);
-    ok(r==S_OK, "EnumSTATSTG_Release failed with error 0x%08x\n", r);
+    ok(r==S_OK, "EnumSTATSTG_Release failed with error 0x%08lx\n", r);
 
     /* second enum... destroy the stream before reading */
     r = IStorage_EnumElements(stg, 0, NULL, 0, &ee);
@@ -1288,7 +1288,7 @@ static void test_streamenum(void)
     ok(r==S_OK, "IStorage->CreateStream failed\n");
 
     r = IStream_Release(stm);
-    ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Stream_Release failed with error 0x%08lx\n", r);
 
     count = 0xf00;
     r = IEnumSTATSTG_Next(ee, 1, &stat, &count);
@@ -1305,7 +1305,7 @@ static void test_streamenum(void)
     ok(r==S_OK, "IStorage->CreateStream failed\n");
 
     r = IStream_Release(stm);
-    ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Stream_Release failed with error 0x%08lx\n", r);
 
     count = 0xf00;
     r = IEnumSTATSTG_Next(ee, 1, &stat, &count);
@@ -1323,7 +1323,7 @@ static void test_streamenum(void)
     ok(r==S_OK, "IStorage->CreateStream failed\n");
 
     r = IStream_Release(stm);
-    ok(r==S_OK, "Stream_Release failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Stream_Release failed with error 0x%08lx\n", r);
 
     r = IEnumSTATSTG_Reset(ee);
     ok(r==S_OK, "IEnumSTATSTG->Reset failed\n");
@@ -1379,7 +1379,7 @@ static void test_streamenum(void)
                             STGM_READWRITE |STGM_TRANSACTED, NULL, 0, &stg);
     ok(r==STG_E_SHAREVIOLATION ||
        r==STG_E_LOCKVIOLATION, /* XP-SP2/W2K3-SP1 and below */
-       "StgCreateDocfile failed, res=%x\n", r);
+       "StgCreateDocfile failed, res=%lx\n", r);
 
     r = IEnumSTATSTG_Release(ee);
     ok (r == 0, "enum not released\n");
@@ -1415,13 +1415,13 @@ static void test_transact(void)
     IStream_Release(stm);
 
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
         /* Create two substorages but only commit one */
         r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
@@ -1430,7 +1430,7 @@ static void test_transact(void)
         ok(r==S_OK, "IStorage->Commit failed\n");
 
         r = IStorage_CreateStorage(stg2, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
@@ -1451,7 +1451,7 @@ static void test_transact(void)
     ok(r==S_OK, "IStream->Commit failed\n");
 
     r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
         IStorage_Release(stg2);
@@ -1469,46 +1469,46 @@ static void test_transact(void)
         return;
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm );
-    ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStorage(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08lx\n", r);
     if (r == S_OK)
         IStream_Release(stm);
 
     r = IStorage_OpenStorage(stg, stgname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08lx\n", r);
     if (r == S_OK)
         IStorage_Release(stg2);
 
     r = IStorage_OpenStorage(stg, stmname2, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r);
+    ok(r==S_OK, "IStorage->OpenStream should succeed %08lx\n", r);
     if (r == S_OK)
         IStream_Release(stm);
 
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==S_OK, "IStorage->OpenStorage should succeed %08x\n", r);
+    ok(r==S_OK, "IStorage->OpenStorage should succeed %08lx\n", r);
     if (r == S_OK)
     {
         r = IStorage_OpenStorage(stg2, stgname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg3 );
-        ok(r==S_OK, "IStorage->OpenStorage should succeed %08x\n", r);
+        ok(r==S_OK, "IStorage->OpenStorage should succeed %08lx\n", r);
         if (r == S_OK)
             IStorage_Release(stg3);
 
         r = IStorage_OpenStorage(stg2, stgname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg3 );
-        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08x\n", r);
+        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08lx\n", r);
         if (r == S_OK)
             IStorage_Release(stg3);
 
@@ -1540,33 +1540,33 @@ static void test_substorage_share(void)
 
     /* create a read/write storage and try to open it again */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
         r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
 
         r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage should fail %08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
 
         /* cannot rename the storage while it's open */
         r = IStorage_RenameElement(stg, stgname, othername);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08lx\n", r);
         if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stgname);
 
         /* destroying an object while it's open invalidates it */
         r = IStorage_DestroyElement(stg, stgname);
-        ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08lx\n", r);
 
         r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-        ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08x\n", r);
+        ok(r==STG_E_REVERTED, "IStorage->CreateStream failed, hr=%08lx\n", r);
 
         if (r == S_OK)
             IStream_Release(stm);
@@ -1576,33 +1576,33 @@ static void test_substorage_share(void)
 
     /* create a read/write stream and try to open it again */
     r = IStorage_CreateStream(stg, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
         r = IStorage_OpenStream(stg, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm2);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08lx\n", r);
 
         if (r == S_OK)
             IStream_Release(stm2);
 
         r = IStorage_OpenStream(stg, stmname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm2);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStream should fail %08lx\n", r);
 
         if (r == S_OK)
             IStream_Release(stm2);
 
         /* cannot rename the stream while it's open */
         r = IStorage_RenameElement(stg, stmname, othername);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->RenameElement should fail %08lx\n", r);
         if (SUCCEEDED(r)) IStorage_RenameElement(stg, othername, stmname);
 
         /* destroying an object while it's open invalidates it */
         r = IStorage_DestroyElement(stg, stmname);
-        ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->DestroyElement failed, hr=%08lx\n", r);
 
         r = IStream_Write(stm, "this shouldn't work\n", 20, NULL);
-        ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
+        ok(r==STG_E_REVERTED, "IStream_Write should fail %08lx\n", r);
 
         IStream_Release(stm);
     }
@@ -1640,13 +1640,13 @@ static void test_revert(void)
     ok(r==S_OK, "IStream->Write failed\n");
 
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
         /* Create two substorages but only commit one */
         r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
@@ -1655,7 +1655,7 @@ static void test_revert(void)
         ok(r==S_OK, "IStorage->Commit failed\n");
 
         r = IStorage_CreateStorage(stg2, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
         if (r == S_OK)
             IStorage_Release(stg3);
@@ -1669,23 +1669,23 @@ static void test_revert(void)
     ok(r==S_OK, "IStream->Write failed\n");
 
     r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     r = IStorage_Revert(stg);
-    ok(r==S_OK, "Storage_Revert failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Storage_Revert failed with error 0x%08lx\n", r);
 
     /* all open objects become invalid */
     r = IStream_Write(stm, "this shouldn't work\n", 20, NULL);
-    ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
+    ok(r==STG_E_REVERTED, "IStream_Write should fail %08lx\n", r);
 
     r = IStream_Write(stm2, "this shouldn't work\n", 20, NULL);
-    ok(r==STG_E_REVERTED, "IStream_Write should fail %08x\n", r);
+    ok(r==STG_E_REVERTED, "IStream_Write should fail %08lx\n", r);
 
     r = IStorage_Stat(stg2, &statstg, STATFLAG_NONAME);
-    ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+    ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08lx\n", r);
 
     r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
-    ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+    ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08lx\n", r);
 
     IStream_Release(stm);
     IStream_Release(stm2);
@@ -1693,46 +1693,46 @@ static void test_revert(void)
     IStorage_Release(stg3);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_DENY_NONE|STGM_READ, 0, &stm );
-    ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFLAG, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_DELETEONRELEASE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_INVALIDFUNCTION, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStorage(stg, stmname, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08lx\n", r);
     if (r == S_OK)
         IStream_Release(stm);
 
     r = IStorage_OpenStorage(stg, stgname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08lx\n", r);
     if (r == S_OK)
         IStorage_Release(stg2);
 
     r = IStorage_OpenStorage(stg, stmname2, NULL, STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream failed %08lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-    ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r);
+    ok(r==S_OK, "IStorage->OpenStream should succeed %08lx\n", r);
     if (r == S_OK)
         IStream_Release(stm);
 
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg2 );
-    ok(r==S_OK, "IStorage->OpenStorage should succeed %08x\n", r);
+    ok(r==S_OK, "IStorage->OpenStorage should succeed %08lx\n", r);
     if (r == S_OK)
     {
         r = IStorage_OpenStorage(stg2, stgname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg3 );
-        ok(r==S_OK, "IStorage->OpenStorage should succeed %08x\n", r);
+        ok(r==S_OK, "IStorage->OpenStorage should succeed %08lx\n", r);
         if (r == S_OK)
             IStorage_Release(stg3);
 
         r = IStorage_OpenStorage(stg2, stgname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg3 );
-        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08x\n", r);
+        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStorage should fail %08lx\n", r);
         if (r == S_OK)
             IStorage_Release(stg3);
 
@@ -1753,10 +1753,10 @@ static void test_revert(void)
     ok(r==S_OK, "IStorage->CreateStream failed\n");
 
     r = IStorage_Revert(stg);
-    ok(r==S_OK, "IStorage->Revert failed %08x\n", r);
+    ok(r==S_OK, "IStorage->Revert failed %08lx\n", r);
 
     r = IStream_Write(stm, "this works\n", 11, NULL);
-    ok(r==S_OK, "IStream_Write should succeed %08x\n", r);
+    ok(r==S_OK, "IStream_Write should succeed %08lx\n", r);
 
     IStream_Release(stm);
     IStorage_Release(stg);
@@ -1785,7 +1785,7 @@ static void test_parent_free(void)
 
     /* create a new storage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
@@ -1802,21 +1802,21 @@ static void test_parent_free(void)
 
         /* free the parent */
         ref = IStorage_Release(stg2);
-        ok(ref == 0, "IStorage still has %u references\n", ref);
+        ok(ref == 0, "IStorage still has %lu references\n", ref);
 
         /* child objects are invalid */
         if (r == S_OK)
         {
             r = IStream_Write(stm, "this should fail\n", 17, NULL);
-            ok(r==STG_E_REVERTED, "IStream->Write should fail, hr=%x\n", r);
+            ok(r==STG_E_REVERTED, "IStream->Write should fail, hr=%lx\n", r);
 
             IStream_Release(stm);
 
             r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
-            ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+            ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08lx\n", r);
 
             r = IStorage_SetStateBits(stg3, 1, 1);
-            ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+            ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08lx\n", r);
 
             IStorage_Release(stg3);
         }
@@ -1847,7 +1847,7 @@ static void test_nonroot_transacted(void)
 
     /* create a transacted substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
@@ -1869,12 +1869,12 @@ static void test_nonroot_transacted(void)
 
         /* check that Commit and Revert really worked */
         r = IStorage_OpenStream(stg2, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-        ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r);
+        ok(r==S_OK, "IStorage->OpenStream should succeed %08lx\n", r);
         if (r == S_OK)
             IStream_Release(stm);
 
         r = IStorage_OpenStream(stg2, stmname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r);
+        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08lx\n", r);
         if (r == S_OK)
             IStream_Release(stm);
 
@@ -1883,19 +1883,19 @@ static void test_nonroot_transacted(void)
 
     /* create a read-only transacted substorage */
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, NULL, 0, &stg2);
-    ok(r==S_OK, "IStorage->OpenStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->OpenStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
         /* The storage can be modified. */
         r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
         if (r == S_OK)
             IStorage_Release(stg3);
 
         /* But changes cannot be committed. */
         r = IStorage_Commit(stg2, 0);
-        ok(r==STG_E_ACCESSDENIED, "IStorage->Commit should fail, hr=%08x\n", r);
+        ok(r==STG_E_ACCESSDENIED, "IStorage->Commit should fail, hr=%08lx\n", r);
 
         IStorage_Release(stg2);
     }
@@ -1909,7 +1909,7 @@ static void test_nonroot_transacted(void)
 
     /* create a transacted substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     if (r == S_OK)
     {
@@ -1931,12 +1931,12 @@ static void test_nonroot_transacted(void)
 
         /* check that Commit and Revert really worked */
         r = IStorage_OpenStream(stg2, stmname, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-        ok(r==S_OK, "IStorage->OpenStream should succeed %08x\n", r);
+        ok(r==S_OK, "IStorage->OpenStream should succeed %08lx\n", r);
         if (r == S_OK)
             IStream_Release(stm);
 
         r = IStorage_OpenStream(stg2, stmname2, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
-        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08x\n", r);
+        ok(r==STG_E_FILENOTFOUND, "IStorage->OpenStream should fail %08lx\n", r);
         if (r == S_OK)
             IStream_Release(stm);
 
@@ -1957,7 +1957,7 @@ static void test_ReadClassStm(void)
     static const LARGE_INTEGER llZero;
 
     hr = ReadClassStm(NULL, &clsid);
-    ok(hr == E_INVALIDARG, "ReadClassStm should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "ReadClassStm should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
     ok_ole_success(hr, "CreateStreamOnHGlobal");
@@ -1965,17 +1965,17 @@ static void test_ReadClassStm(void)
     ok_ole_success(hr, "WriteClassStm");
 
     hr = ReadClassStm(pStream, NULL);
-    ok(hr == E_INVALIDARG, "ReadClassStm should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "ReadClassStm should have returned E_INVALIDARG instead of 0x%08lx\n", hr);
 
     memset(&clsid, 0xcc, sizeof(clsid));
     memset(&clsid2, 0xcc, sizeof(clsid2));
     hr = ReadClassStm(NULL, &clsid);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &clsid2), "got wrong clsid\n");
 
     /* test not rewound stream */
     hr = ReadClassStm(pStream, &clsid);
-    ok(hr == STG_E_READFAULT, "ReadClassStm should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
+    ok(hr == STG_E_READFAULT, "ReadClassStm should have returned STG_E_READFAULT instead of 0x%08lx\n", hr);
     ok(IsEqualCLSID(&clsid, &CLSID_NULL), "clsid should have been zeroed\n");
 
     hr = IStream_Seek(pStream, llZero, STREAM_SEEK_SET, NULL);
@@ -2088,13 +2088,13 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD
             lasterr = GetLastError();
 
             ok((hfile != INVALID_HANDLE_VALUE) == ares[idx].gothandle,
-               "(%d, handle, %d): Expected %d, got %d\n",
+               "(%ld, handle, %d): Expected %d, got %d\n",
                line, idx, ares[idx].gothandle,
                (hfile != INVALID_HANDLE_VALUE));
 
             ok(lasterr == ares[idx].lasterr ||
                broken(lasterr == 0xdeadbeef) /* win9x */,
-               "(%d, lasterr, %d): Expected %d, got %d\n",
+               "(%ld, lasterr, %d): Expected %ld, got %ld\n",
                line, idx, ares[idx].lasterr, lasterr);
 
             CloseHandle(hfile);
@@ -2115,12 +2115,12 @@ static void test_access(void)
     /* STGM_TRANSACTED */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
                           STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create);
 
     hr = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create_commit);
 
@@ -2133,12 +2133,12 @@ static void test_access(void)
     /* STGM_DIRECT */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
                           STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &stg);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create);
 
     hr = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create_commit);
 
@@ -2151,12 +2151,12 @@ static void test_access(void)
     /* STGM_SHARE_DENY_NONE */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
                           STGM_SHARE_DENY_NONE | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create);
 
     hr = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create_commit);
 
@@ -2169,12 +2169,12 @@ static void test_access(void)
     /* STGM_SHARE_DENY_READ */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
                           STGM_SHARE_DENY_READ | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create);
 
     hr = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create_commit);
 
@@ -2187,12 +2187,12 @@ static void test_access(void)
     /* STGM_SHARE_DENY_WRITE */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE |
                           STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create);
 
     hr = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
+    ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
 
     test_file_access(fileA, create_commit);
 
@@ -2204,11 +2204,11 @@ static void test_access(void)
 
     /* STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE - reader mode for direct SWMR mode */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     IStorage_Release(stg);
 
     hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg);
-    ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08x\n", hr);
+    ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08lx\n", hr);
     if(hr != S_OK)
        return;
 
@@ -2230,15 +2230,15 @@ static void test_readonly(void)
     static const WCHAR streamW[] = {'s','t','r','e','a','m',0};
 
     hr = StgCreateDocfile( fileW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
-    ok(hr == S_OK, "should succeed, res=%x\n", hr);
+    ok(hr == S_OK, "should succeed, res=%lx\n", hr);
     if (SUCCEEDED(hr))
     {
         hr = IStorage_CreateStorage( stg, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stg2 );
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
         if (SUCCEEDED(hr))
         {
             hr = IStorage_CreateStream( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stream );
-            ok(hr == S_OK, "should succeed, res=%x\n", hr);
+            ok(hr == S_OK, "should succeed, res=%lx\n", hr);
             if (SUCCEEDED(hr))
                 IStream_Release(stream);
             IStorage_Release(stg2);
@@ -2248,44 +2248,44 @@ static void test_readonly(void)
 
     /* re-open read only */
     hr = StgOpenStorage( fileW, NULL, STGM_TRANSACTED | STGM_SHARE_DENY_NONE | STGM_READ, NULL, 0, &stg);
-    ok(hr == S_OK, "should succeed, res=%x\n", hr);
+    ok(hr == S_OK, "should succeed, res=%lx\n", hr);
     if (SUCCEEDED(hr))
     {
         hr = IStorage_OpenStorage( stg, storageW, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, NULL, 0, &stg2 );
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
         if (SUCCEEDED(hr))
         {
             /* CreateStream on read-only storage, name exists */
             hr = IStorage_CreateStream( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stream );
-            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%lx\n", hr);
             if (SUCCEEDED(hr))
                 IStream_Release(stream);
 
             /* CreateStream on read-only storage, name does not exist */
             hr = IStorage_CreateStream( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stream );
-            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%lx\n", hr);
             if (SUCCEEDED(hr))
                 IStream_Release(stream);
 
             /* CreateStorage on read-only storage, name exists */
             hr = IStorage_CreateStorage( stg2, streamW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
-            ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_FILEALREADYEXISTS, "should fail, res=%lx\n", hr);
             if (SUCCEEDED(hr))
                 IStorage_Release(stg3);
 
             /* CreateStorage on read-only storage, name does not exist */
             hr = IStorage_CreateStorage( stg2, storageW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READ, 0, 0, &stg3 );
-            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%lx\n", hr);
             if (SUCCEEDED(hr))
                 IStorage_Release(stg3);
 
             /* DestroyElement on read-only storage, name exists */
             hr = IStorage_DestroyElement( stg2, streamW );
-            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%lx\n", hr);
 
             /* DestroyElement on read-only storage, name does not exist */
             hr = IStorage_DestroyElement( stg2, storageW );
-            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%x\n", hr);
+            ok(hr == STG_E_ACCESSDENIED, "should fail, res=%lx\n", hr);
 
             IStorage_Release(stg2);
         }
@@ -2314,61 +2314,61 @@ static void test_simple(void)
     DeleteFileA(filenameA);
 
     r = StgCreateDocfile( filename, STGM_SIMPLE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStorage_CreateStorage(stg, stgname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stg2);
-    ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r);
+    ok(r == STG_E_INVALIDFUNCTION, "got %08lx\n", r);
     if (SUCCEEDED(r)) IStorage_Release(stg2);
 
     r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
-    ok(r == STG_E_INVALIDFLAG, "got %08x\n", r);
+    ok(r == STG_E_INVALIDFLAG, "got %08lx\n", r);
     r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     upos.QuadPart = 6000;
     r = IStream_SetSize(stm, upos);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStream_Write(stm, "foo", 3, &count);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(count == 3, "got %d\n", count);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(count == 3, "got %ld\n", count);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, STREAM_SEEK_CUR, &upos);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(upos.QuadPart == 3, "got %d\n", upos.u.LowPart);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(upos.QuadPart == 3, "got %ld\n", upos.u.LowPart);
 
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME);
     ok(r == S_OK ||
        broken(r == STG_E_INVALIDFUNCTION), /* NT4 and below */
-       "got %08x\n", r);
+       "got %08lx\n", r);
     if (r == S_OK)
-        ok(stat.cbSize.QuadPart == 3, "got %d\n", stat.cbSize.u.LowPart);
+        ok(stat.cbSize.QuadPart == 3, "got %ld\n", stat.cbSize.u.LowPart);
 
     pos.QuadPart = 1;
     r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &upos);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(upos.QuadPart == 1, "got %d\n", upos.u.LowPart);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(upos.QuadPart == 1, "got %ld\n", upos.u.LowPart);
 
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME);
     ok(r == S_OK ||
        broken(r == STG_E_INVALIDFUNCTION), /* NT4 and below */
-       "got %08x\n", r);
+       "got %08lx\n", r);
     if (r == S_OK)
-        ok(stat.cbSize.QuadPart == 1, "got %d\n", stat.cbSize.u.LowPart);
+        ok(stat.cbSize.QuadPart == 1, "got %ld\n", stat.cbSize.u.LowPart);
 
     IStream_Release(stm);
 
     r = IStorage_CreateStream(stg, stmname2, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     upos.QuadPart = 100;
     r = IStream_SetSize(stm, upos);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStream_Write(stm, "foo", 3, &count);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(count == 3, "got %d\n", count);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(count == 3, "got %ld\n", count);
 
     IStream_Release(stm);
 
@@ -2382,27 +2382,27 @@ static void test_simple(void)
         DeleteFileA(filenameA);
         return;
     }
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, NULL, 0, &stg2);
-    ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r);
+    ok(r == STG_E_INVALIDFUNCTION, "got %08lx\n", r);
     if (SUCCEEDED(r)) IStorage_Release(stg2);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(stat.cbSize.QuadPart == 6000, "got %d\n", stat.cbSize.u.LowPart);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(stat.cbSize.QuadPart == 6000, "got %ld\n", stat.cbSize.u.LowPart);
 
     IStream_Release(stm);
 
     r = IStorage_OpenStream(stg, stmname2, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
-    ok(r == S_OK, "got %08x\n", r);
+    ok(r == S_OK, "got %08lx\n", r);
 
     r = IStream_Stat(stm, &stat, STATFLAG_NONAME);
-    ok(r == S_OK, "got %08x\n", r);
-    ok(stat.cbSize.QuadPart == 4096, "got %d\n", stat.cbSize.u.LowPart);
+    ok(r == S_OK, "got %08lx\n", r);
+    ok(stat.cbSize.QuadPart == 4096, "got %ld\n", stat.cbSize.u.LowPart);
 
     IStream_Release(stm);
 
@@ -2424,17 +2424,17 @@ static void test_fmtusertypestg(void)
     static const STATSTG statstg_null;
 
     hr = StgCreateDocfile( fileW, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
-    ok(hr == S_OK, "should succeed, res=%x\n", hr);
+    ok(hr == S_OK, "should succeed, res=%lx\n", hr);
 
     if (SUCCEEDED(hr))
     {
         /* try to write the stream */
         hr = WriteFmtUserTypeStg(stg, 0, userTypeW);
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
 
         /* check that the stream was created */
         hr = IStorage_EnumElements(stg, 0, NULL, 0, &stat);
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
         if (SUCCEEDED(hr))
         {
             BOOL found = FALSE;
@@ -2456,11 +2456,11 @@ static void test_fmtusertypestg(void)
 
         /* re-write the stream */
         hr = WriteFmtUserTypeStg(stg, 0, userTypeW);
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
 
         /* check that the stream is still there */
         hr = IStorage_EnumElements(stg, 0, NULL, 0, &stat);
-        ok(hr == S_OK, "should succeed, res=%x\n", hr);
+        ok(hr == S_OK, "should succeed, res=%lx\n", hr);
         if (SUCCEEDED(hr))
         {
             BOOL found = FALSE;
@@ -2502,12 +2502,12 @@ static void test_references(void)
         IStorage_Release(stg);
 
         hr = StgOpenStorage( filename, NULL, STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, NULL, 0, &stg);
-        ok(hr==S_OK, "StgOpenStorage failed (result=%x)\n",hr);
+        ok(hr==S_OK, "StgOpenStorage failed (result=%lx)\n",hr);
 
         if (SUCCEEDED(hr))
         {
             hr = IStorage_CreateStorage(stg,StorName,STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,0,&stg2);
-            ok(hr == S_OK, "IStorage_CreateStorage failed (result=%x)\n",hr);
+            ok(hr == S_OK, "IStorage_CreateStorage failed (result=%lx)\n",hr);
 
             if (SUCCEEDED(hr))
             {
@@ -2544,38 +2544,38 @@ static HRESULT create_test_file(IStorage *dest)
     HRESULT hr;
 
     hr = IStorage_CreateStorage(dest, stgA_name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stgA);
-    ok(hr == S_OK, "IStorage_CreateStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IStorage_CreateStorage failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     hr = IStorage_CreateStream(stgA, strmA_name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &strmA);
-    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     hr = IStream_Write(strmA, strmA_name, strmA_name_size, &bytes);
-    ok(hr == S_OK && bytes == strmA_name_size, "IStream_Write failed: 0x%08x, %d of %d bytes written\n", hr, bytes, strmA_name_size);
+    ok(hr == S_OK && bytes == strmA_name_size, "IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n", hr, bytes, strmA_name_size);
 
     hr = IStorage_CreateStorage(dest, stgB_name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stgB);
-    ok(hr == S_OK, "IStorage_CreateStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IStorage_CreateStorage failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     hr = IStorage_CreateStream(stgB, strmB_name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &strmB);
-    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     hr = IStream_Write(strmB, strmB_name, strmB_name_size, &bytes);
-    ok(hr == S_OK && bytes == strmB_name_size, "IStream_Write failed: 0x%08x, %d of %d bytes written\n", hr, bytes, strmB_name_size);
+    ok(hr == S_OK && bytes == strmB_name_size, "IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n", hr, bytes, strmB_name_size);
 
     hr = IStorage_CreateStream(dest, strmC_name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &strmC);
-    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "IStorage_CreateStream failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     hr = IStream_Write(strmC, strmC_name, strmC_name_size, &bytes);
-    ok(hr == S_OK && bytes == strmC_name_size, "IStream_Write failed: 0x%08x, %d of %d bytes written\n", hr, bytes, strmC_name_size);
+    ok(hr == S_OK && bytes == strmC_name_size, "IStream_Write failed: 0x%08lx, %ld of %ld bytes written\n", hr, bytes, strmC_name_size);
 
 cleanup:
     if(strmC)
@@ -2601,7 +2601,7 @@ static void test_copyto(void)
 
     /* create & populate file1 */
     hr = StgCreateDocfile(file1_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file1);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
@@ -2611,33 +2611,33 @@ static void test_copyto(void)
 
     /* create file2 */
     hr = StgCreateDocfile(file2_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file2);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* copy file1 into file2 */
     hr = IStorage_CopyTo(file1, 0, NULL, NULL, NULL);
-    ok(hr == STG_E_INVALIDPOINTER, "CopyTo should give STG_E_INVALIDPONITER, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_INVALIDPOINTER, "CopyTo should give STG_E_INVALIDPONITER, gave: 0x%08lx\n", hr);
 
     hr = IStorage_CopyTo(file1, 0, NULL, NULL, file2);
-    ok(hr == S_OK, "CopyTo failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CopyTo failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* verify that all of file1 was copied */
     hr = IStorage_OpenStorage(file2, stgA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == S_OK, "OpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStorage failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         hr = IStorage_OpenStream(stg_tmp, strmA_name, NULL,
                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-        ok(hr == S_OK, "OpenStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "OpenStream failed: 0x%08lx\n", hr);
 
         if(SUCCEEDED(hr)){
             memset(buf, 0, sizeof(buf));
             hr = IStream_Read(strm_tmp, buf, sizeof(buf), NULL);
-            ok(hr == S_OK, "Read failed: 0x%08x\n", hr);
+            ok(hr == S_OK, "Read failed: 0x%08lx\n", hr);
             if(SUCCEEDED(hr))
                 ok(strcmp_ww(buf, strmA_name) == 0,
                         "Expected %s to be read, got %s\n", wine_dbgstr_w(strmA_name), wine_dbgstr_w(buf));
@@ -2650,17 +2650,17 @@ static void test_copyto(void)
 
     hr = IStorage_OpenStorage(file2, stgB_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == S_OK, "OpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStorage failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         hr = IStorage_OpenStream(stg_tmp, strmB_name, NULL,
                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-        ok(hr == S_OK, "OpenStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "OpenStream failed: 0x%08lx\n", hr);
 
         if(SUCCEEDED(hr)){
             memset(buf, 0, sizeof(buf));
             hr = IStream_Read(strm_tmp, buf, sizeof(buf), NULL);
-            ok(hr == S_OK, "Read failed: 0x%08x\n", hr);
+            ok(hr == S_OK, "Read failed: 0x%08lx\n", hr);
             if(SUCCEEDED(hr))
                 ok(strcmp_ww(buf, strmB_name) == 0,
                         "Expected %s to be read, got %s\n", wine_dbgstr_w(strmB_name), wine_dbgstr_w(buf));
@@ -2673,12 +2673,12 @@ static void test_copyto(void)
 
     hr = IStorage_OpenStream(file2, strmC_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == S_OK, "OpenStream failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStream failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         memset(buf, 0, sizeof(buf));
         hr = IStream_Read(strm_tmp, buf, sizeof(buf), NULL);
-        ok(hr == S_OK, "Read failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "Read failed: 0x%08lx\n", hr);
         if(SUCCEEDED(hr))
             ok(strcmp_ww(buf, strmC_name) == 0,
                     "Expected %s to be read, got %s\n", wine_dbgstr_w(strmC_name), wine_dbgstr_w(buf));
@@ -2707,7 +2707,7 @@ static void test_copyto_snbexclusions(void)
 
     /* create & populate file1 */
     hr = StgCreateDocfile(file1_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file1);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
@@ -2717,42 +2717,42 @@ static void test_copyto_snbexclusions(void)
 
     /* create file2 */
     hr = StgCreateDocfile(file2_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file2);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* copy file1 to file2 with name exclusions */
     hr = IStorage_CopyTo(file1, 0, NULL, (SNB)snb_exclude, file2);
-    ok(hr == S_OK, "CopyTo failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CopyTo failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* verify that file1 copied over, respecting exclusions */
     hr = IStorage_OpenStorage(file2, stgA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStorage_Release(stg_tmp);
 
     hr = IStorage_OpenStream(file2, strmA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStream_Release(strm_tmp);
 
     hr = IStorage_OpenStorage(file2, stgB_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == S_OK, "OpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStorage failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         hr = IStorage_OpenStream(stg_tmp, strmB_name, NULL,
                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-        ok(hr == S_OK, "OpenStream failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "OpenStream failed: 0x%08lx\n", hr);
 
         if(SUCCEEDED(hr)){
             memset(buf, 0, sizeof(buf));
             hr = IStream_Read(strm_tmp, buf, sizeof(buf), NULL);
-            ok(hr == S_OK, "Read failed: 0x%08x\n", hr);
+            ok(hr == S_OK, "Read failed: 0x%08lx\n", hr);
             if(SUCCEEDED(hr))
                 ok(strcmp_ww(buf, strmB_name) == 0,
                         "Expected %s to be read, got %s\n", wine_dbgstr_w(strmB_name), wine_dbgstr_w(buf));
@@ -2765,7 +2765,7 @@ static void test_copyto_snbexclusions(void)
 
     hr = IStorage_OpenStream(file2, strmC_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStream_Release(strm_tmp);
 
@@ -2788,7 +2788,7 @@ static void test_copyto_iidexclusions_storage(void)
 
     /* create & populate file1 */
     hr = StgCreateDocfile(file1_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file1);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
@@ -2798,49 +2798,49 @@ static void test_copyto_iidexclusions_storage(void)
 
     /* create file2 */
     hr = StgCreateDocfile(file2_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file2);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* copy file1 to file2 with iid exclusions */
     hr = IStorage_CopyTo(file1, 1, &IID_IStorage, NULL, file2);
-    ok(hr == S_OK, "CopyTo failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CopyTo failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* verify that file1 copied over, respecting exclusions */
     hr = IStorage_OpenStorage(file2, stgA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStorage_Release(stg_tmp);
 
     hr = IStorage_OpenStream(file2, strmA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStream_Release(strm_tmp);
 
     hr = IStorage_OpenStorage(file2, stgB_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStorage should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStorage_Release(stg_tmp);
 
     hr = IStorage_OpenStream(file2, strmB_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStream_Release(strm_tmp);
 
     hr = IStorage_OpenStream(file2, strmC_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == S_OK, "OpenStream failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStream failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         memset(buf, 0, sizeof(buf));
         hr = IStream_Read(strm_tmp, buf, sizeof(buf), NULL);
-        ok(hr == S_OK, "Read failed: 0x%08x\n", hr);
+        ok(hr == S_OK, "Read failed: 0x%08lx\n", hr);
         if(SUCCEEDED(hr))
             ok(strcmp_ww(buf, strmC_name) == 0,
                     "Expected %s to be read, got %s\n", wine_dbgstr_w(strmC_name), wine_dbgstr_w(buf));
@@ -2866,7 +2866,7 @@ static void test_copyto_iidexclusions_stream(void)
 
     /* create & populate file1 */
     hr = StgCreateDocfile(file1_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file1);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
@@ -2876,25 +2876,25 @@ static void test_copyto_iidexclusions_stream(void)
 
     /* create file2 */
     hr = StgCreateDocfile(file2_name, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &file2);
-    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "StgCreateDocfile failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* copy file1 to file2 with iid exclusions */
     hr = IStorage_CopyTo(file1, 1, &IID_IStream, NULL, file2);
-    ok(hr == S_OK, "CopyTo failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "CopyTo failed: 0x%08lx\n", hr);
     if(FAILED(hr))
         goto cleanup;
 
     /* verify that file1 copied over, respecting exclusions */
     hr = IStorage_OpenStorage(file2, stgA_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == S_OK, "OpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStorage failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         hr = IStorage_OpenStream(stg_tmp, strmA_name, NULL,
                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-        ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+        ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
         if(SUCCEEDED(hr))
             IStream_Release(strm_tmp);
 
@@ -2903,12 +2903,12 @@ static void test_copyto_iidexclusions_stream(void)
 
     hr = IStorage_OpenStorage(file2, stgB_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg_tmp);
-    ok(hr == S_OK, "OpenStorage failed: 0x%08x\n", hr);
+    ok(hr == S_OK, "OpenStorage failed: 0x%08lx\n", hr);
 
     if(SUCCEEDED(hr)){
         hr = IStorage_OpenStream(stg_tmp, strmB_name, NULL,
                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-        ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+        ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
         if(SUCCEEDED(hr))
             IStream_Release(strm_tmp);
 
@@ -2917,7 +2917,7 @@ static void test_copyto_iidexclusions_stream(void)
 
     hr = IStorage_OpenStream(file2, strmC_name, NULL,
             STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &strm_tmp);
-    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "OpenStream should give STG_E_FILENOTFOUND, gave: 0x%08lx\n", hr);
     if(SUCCEEDED(hr))
         IStream_Release(strm_tmp);
 
@@ -2951,25 +2951,25 @@ static void test_rename(void)
 
     /* create a substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* create a stream in the substorage */
     r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08lx\n", r);
     IStream_Release(stm);
 
     /* rename the stream */
     r = IStorage_RenameElement(stg2, stmname, stmname2);
-    ok(r==S_OK, "IStorage->RenameElement failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->RenameElement failed, hr=%08lx\n", r);
 
     /* cannot open stream with old name */
     r = IStorage_OpenStream(stg2, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm);
-    ok(r==STG_E_FILENOTFOUND, "IStorage_OpenStream should fail, hr=%08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage_OpenStream should fail, hr=%08lx\n", r);
     if (SUCCEEDED(r)) IStream_Release(stm);
 
     /* can open stream with new name */
     r = IStorage_OpenStream(stg2, stmname2, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm);
-    ok(r==S_OK, "IStorage_OpenStream failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage_OpenStream failed, hr=%08lx\n", r);
     if (SUCCEEDED(r)) IStream_Release(stm);
 
     IStorage_Release(stg2);
@@ -2979,17 +2979,17 @@ static void test_rename(void)
 
     /* cannot open storage with old name */
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg2);
-    ok(r==STG_E_FILENOTFOUND, "IStorage_OpenStream should fail, hr=%08x\n", r);
+    ok(r==STG_E_FILENOTFOUND, "IStorage_OpenStream should fail, hr=%08lx\n", r);
     if (SUCCEEDED(r)) IStorage_Release(stg2);
 
     /* can open storage with new name */
     r = IStorage_OpenStorage(stg, stgname2, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg2);
-    ok(r==S_OK, "IStorage_OpenStream should fail, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage_OpenStream should fail, hr=%08lx\n", r);
     if (SUCCEEDED(r))
     {
         /* opened storage still has the stream */
         r = IStorage_OpenStream(stg2, stmname2, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm);
-        ok(r==S_OK, "IStorage_OpenStream failed, hr=%08x\n", r);
+        ok(r==S_OK, "IStorage_OpenStream failed, hr=%08lx\n", r);
         if (SUCCEEDED(r)) IStream_Release(stm);
 
         IStorage_Release(stg2);
@@ -3019,7 +3019,7 @@ static void test_toplevel_stat(void)
     ok(r==S_OK, "StgCreateDocfile failed\n");
 
     r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT );
-    ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Storage_Stat failed with error 0x%08lx\n", r);
     ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n",
         wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName));
     CoTaskMemFree(stat.pwcsName);
@@ -3027,10 +3027,10 @@ static void test_toplevel_stat(void)
     IStorage_Release( stg );
 
     r = StgOpenStorage( filename, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
 
     r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT );
-    ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Storage_Stat failed with error 0x%08lx\n", r);
     ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n",
         wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName));
     CoTaskMemFree(stat.pwcsName);
@@ -3054,7 +3054,7 @@ static void test_toplevel_stat(void)
     ok(r==S_OK, "StgCreateDocfile failed\n");
 
     r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT );
-    ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Storage_Stat failed with error 0x%08lx\n", r);
     ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n",
         wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName));
     CoTaskMemFree(stat.pwcsName);
@@ -3062,10 +3062,10 @@ static void test_toplevel_stat(void)
     IStorage_Release( stg );
 
     r = StgOpenStorage( rel_path, NULL, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed with error 0x%08lx\n", r);
 
     r = IStorage_Stat( stg, &stat, STATFLAG_DEFAULT );
-    ok(r==S_OK, "Storage_Stat failed with error 0x%08x\n", r);
+    ok(r==S_OK, "Storage_Stat failed with error 0x%08lx\n", r);
     ok(!strcmp_ww(stat.pwcsName, filename), "expected %s, got %s\n",
         wine_dbgstr_w(filename), wine_dbgstr_w(stat.pwcsName));
     CoTaskMemFree(stat.pwcsName);
@@ -3095,11 +3095,11 @@ static void test_substorage_enum(void)
 
     /* create a substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* create an enumelements */
     r = IStorage_EnumElements(stg2, 0, NULL, 0, &ee);
-    ok(r==S_OK, "IStorage->EnumElements failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->EnumElements failed, hr=%08lx\n", r);
 
     /* release the substorage */
     ref = IStorage_Release(stg2);
@@ -3107,14 +3107,14 @@ static void test_substorage_enum(void)
 
     /* reopening fails, because the substorage is really still open */
     r = IStorage_OpenStorage(stg, stgname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage failed, hr=%08x\n", r);
+    ok(r==STG_E_ACCESSDENIED, "IStorage->OpenStorage failed, hr=%08lx\n", r);
 
     /* destroying the storage invalidates the enumerator */
     r = IStorage_DestroyElement(stg, stgname);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     r = IEnumSTATSTG_Reset(ee);
-    ok(r==STG_E_REVERTED, "IEnumSTATSTG->Reset failed, hr=%08x\n", r);
+    ok(r==STG_E_REVERTED, "IEnumSTATSTG->Reset failed, hr=%08lx\n", r);
 
     IEnumSTATSTG_Release(ee);
 
@@ -3143,29 +3143,29 @@ static void test_copyto_locking(void)
 
     /* create a substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* create another substorage */
     r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg3);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* add a stream, and leave it open */
     r = IStorage_CreateStream(stg2, stmname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed, hr=%08lx\n", r);
 
     /* Try to copy the storage while the stream is open */
     r = IStorage_CopyTo(stg2, 0, NULL, NULL, stg3);
-    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     IStream_Release(stm);
 
     /* create a substorage */
     r = IStorage_CreateStorage(stg2, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg4);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* Try to copy the storage while the substorage is open */
     r = IStorage_CopyTo(stg2, 0, NULL, NULL, stg3);
-    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     IStorage_Release(stg4);
     IStorage_Release(stg3);
@@ -3193,31 +3193,31 @@ static void test_copyto_recursive(void)
 
     /* create a substorage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* copy the parent to the child */
     r = IStorage_CopyTo(stg, 0, NULL, NULL, stg2);
-    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     /* create a transacted substorage */
     r = IStorage_CreateStorage(stg, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg3);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* copy the parent to the transacted child */
     r = IStorage_CopyTo(stg, 0, NULL, NULL, stg2);
-    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     /* create a transacted subsubstorage */
     r = IStorage_CreateStorage(stg3, stgname2, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, 0, &stg4);
-    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08lx\n", r);
 
     /* copy the parent to the transacted child of the transacted child */
     r = IStorage_CopyTo(stg, 0, NULL, NULL, stg4);
-    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==STG_E_ACCESSDENIED, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     /* copy the parent but exclude storage objects */
     r = IStorage_CopyTo(stg, 1, &IID_IStorage, NULL, stg4);
-    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08x\n", r);
+    ok(r==S_OK, "IStorage->CopyTo failed, hr=%08lx\n", r);
 
     IStorage_Release(stg4);
     IStorage_Release(stg3);
@@ -3238,38 +3238,38 @@ static void test_hglobal_storage_creation(void)
     ULARGE_INTEGER offset;
 
     r = CreateILockBytesOnHGlobal(NULL, TRUE, &ilb);
-    ok(r == S_OK, "CreateILockBytesOnHGlobal failed, hr=%x\n", r);
+    ok(r == S_OK, "CreateILockBytesOnHGlobal failed, hr=%lx\n", r);
 
     offset.QuadPart = 0;
     memset(junk, 0xaa, 512);
     r = ILockBytes_WriteAt(ilb, offset, junk, 512, NULL);
-    ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%x\n", r);
+    ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%lx\n", r);
 
     offset.QuadPart = 2000;
     r = ILockBytes_WriteAt(ilb, offset, junk, 512, NULL);
-    ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%x\n", r);
+    ok(r == S_OK, "ILockBytes_WriteAt failed, hr=%lx\n", r);
 
     r = StgCreateDocfileOnILockBytes(ilb, STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0,  &stg);
-    ok(r == S_OK, "StgCreateDocfileOnILockBytes failed, hr=%x\n", r);
+    ok(r == S_OK, "StgCreateDocfileOnILockBytes failed, hr=%lx\n", r);
 
     IStorage_Release(stg);
 
     r = StgOpenStorageOnILockBytes(ilb, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE,
         NULL, 0, &stg);
-    ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%x\n", r);
+    ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%lx\n", r);
 
     if (SUCCEEDED(r))
     {
         r = IStorage_Stat(stg, &stat, STATFLAG_NONAME);
-        ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%x\n", r);
+        ok(r == S_OK, "StgOpenStorageOnILockBytes failed, hr=%lx\n", r);
         ok(IsEqualCLSID(&stat.clsid, &GUID_NULL), "unexpected CLSID value\n");
 
         IStorage_Release(stg);
     }
 
     r = ILockBytes_Stat(ilb, &stat, STATFLAG_NONAME);
-    ok(r == S_OK, "ILockBytes_Stat failed, hr=%x\n", r);
-    ok(stat.cbSize.u.LowPart < 2512, "expected truncated size, got %d\n", stat.cbSize.u.LowPart);
+    ok(r == S_OK, "ILockBytes_Stat failed, hr=%lx\n", r);
+    ok(stat.cbSize.u.LowPart < 2512, "expected truncated size, got %ld\n", stat.cbSize.u.LowPart);
 
     ILockBytes_Release(ilb);
 }
@@ -3281,22 +3281,22 @@ static void test_convert(void)
     HRESULT hr;
 
     hr = GetConvertStg(NULL);
-    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+    ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
 
     hr = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
     ok(hr == S_OK, "StgCreateDocfile failed\n");
     hr = GetConvertStg(stg);
-    ok(hr == STG_E_FILENOTFOUND, "got 0x%08x\n", hr);
+    ok(hr == STG_E_FILENOTFOUND, "got 0x%08lx\n", hr);
     hr = SetConvertStg(stg, TRUE);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = SetConvertStg(stg, TRUE);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = GetConvertStg(stg);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = SetConvertStg(stg, FALSE);
-    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(hr == S_OK, "got 0x%08lx\n", hr);
     hr = GetConvertStg(stg);
-    ok(hr == S_FALSE, "got 0x%08x\n", hr);
+    ok(hr == S_FALSE, "got 0x%08lx\n", hr);
 
     IStorage_Release(stg);
 
@@ -3314,40 +3314,40 @@ static void test_direct_swmr(void)
     /* it's possible to create in writer mode */
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_DIRECT_SWMR, 0, &stg);
     todo_wine
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 if (hr == S_OK) {
     IStorage_Release(stg);
     DeleteFileW(fileW);
 }
 
     hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     IStorage_Release(stg);
 
     /* reader mode */
     hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg);
-    ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08x\n", hr);
+    ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08lx\n", hr);
     if(hr == S_OK)
     {
        hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock);
-       ok(hr == E_NOINTERFACE, "got %08x\n", hr);
+       ok(hr == E_NOINTERFACE, "got %08lx\n", hr);
        IStorage_Release(stg);
     }
 
     /* writer mode */
     hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READWRITE | STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
     if(hr == S_OK)
     {
         ref = IStorage_AddRef(stg);
         IStorage_Release(stg);
 
         hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
 
         ref2 = IStorage_AddRef(stg);
         IStorage_Release(stg);
-        ok(ref2 == ref + 1, "got %u\n", ref2);
+        ok(ref2 == ref + 1, "got %lu\n", ref2);
 
         IDirectWriterLock_Release(dwlock);
         IStorage_Release(stg);
@@ -3425,22 +3425,22 @@ static void check_sharing(LPCWSTR filename, const struct lock_test *current,
         if (!current->todo || (current->sharing & sharing))
             ok(current->sharing & sharing ||
                 broken(!(current->sharing & sharing) && access == GENERIC_WRITE && (current->stg_mode & 0xf) != STGM_READ) /* win2k */,
-                "file with mode %x should not be openable with %s permission\n", current->stg_mode, desc);
+                "file with mode %lx should not be openable with %s permission\n", current->stg_mode, desc);
         else
         {
             todo_wine ok(current->sharing & sharing ||
                 broken(!(current->sharing & sharing) && access == GENERIC_WRITE && (current->stg_mode & 0xf) != STGM_READ) /* win2k */,
-                "file with mode %x should not be openable with %s permission\n", current->stg_mode, desc);
+                "file with mode %lx should not be openable with %s permission\n", current->stg_mode, desc);
             *any_failure = TRUE;
         }
     }
     else
     {
         if (!current->todo || !(current->sharing & sharing))
-            ok(!(current->sharing & sharing), "file with mode %x should be openable with %s permission\n", current->stg_mode, desc);
+            ok(!(current->sharing & sharing), "file with mode %lx should be openable with %s permission\n", current->stg_mode, desc);
         else
         {
-            todo_wine ok(!(current->sharing & sharing), "file with mode %x should be openable with %s permission\n", current->stg_mode, desc);
+            todo_wine ok(!(current->sharing & sharing), "file with mode %lx should be openable with %s permission\n", current->stg_mode, desc);
             *any_failure = TRUE;
         }
     }
@@ -3452,20 +3452,20 @@ static void check_access(LPCWSTR filename, const struct lock_test *current,
     if (can_open(filename, open_mode, (FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE) & ~sharing))
     {
         if (!current->todo || !(current->access & access))
-            ok(!(current->access & access), "file with mode %x should not be openable without %s sharing\n", current->stg_mode, desc);
+            ok(!(current->access & access), "file with mode %lx should not be openable without %s sharing\n", current->stg_mode, desc);
         else
         {
-            todo_wine ok(!(current->access & access), "file with mode %x should not be openable without %s sharing\n", current->stg_mode, desc);
+            todo_wine ok(!(current->access & access), "file with mode %lx should not be openable without %s sharing\n", current->stg_mode, desc);
             *any_failure = TRUE;
         }
     }
     else
     {
         if (!current->todo || (current->access & access))
-            ok(current->access & access, "file with mode %x should be openable without %s sharing\n", current->stg_mode, desc);
+            ok(current->access & access, "file with mode %lx should be openable without %s sharing\n", current->stg_mode, desc);
         else
         {
-            todo_wine ok(current->access & access, "file with mode %x should be openable without %s sharing\n", current->stg_mode, desc);
+            todo_wine ok(current->access & access, "file with mode %lx should be openable without %s sharing\n", current->stg_mode, desc);
             *any_failure = TRUE;
         }
     }
@@ -3487,18 +3487,18 @@ static void test_locking(void)
         if (current->create)
         {
             hr = StgCreateDocfile(filename, current->stg_mode, 0, &stg);
-            ok(SUCCEEDED(hr), "StgCreateDocfile with mode %x failed with hr %x\n", current->stg_mode, hr);
+            ok(SUCCEEDED(hr), "StgCreateDocfile with mode %lx failed with hr %lx\n", current->stg_mode, hr);
             if (FAILED(hr)) continue;
         }
         else
         {
             hr = StgCreateDocfile(filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg);
-            ok(SUCCEEDED(hr), "StgCreateDocfile failed with hr %x\n", hr);
+            ok(SUCCEEDED(hr), "StgCreateDocfile failed with hr %lx\n", hr);
             if (FAILED(hr)) continue;
             IStorage_Release(stg);
 
             hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg);
-            ok(SUCCEEDED(hr), "StgOpenStorage with mode %x failed with hr %x\n", current->stg_mode, hr);
+            ok(SUCCEEDED(hr), "StgOpenStorage with mode %lx failed with hr %lx\n", current->stg_mode, hr);
             if (FAILED(hr))
             {
                 DeleteFileW(filename);
@@ -3522,7 +3522,7 @@ static void test_locking(void)
             check_access(filename, current, DELETE, FILE_SHARE_DELETE, "DELETE", open_mode, &any_failure);
 
             hfile = CreateFileW(filename, open_mode, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-            ok(hfile != INVALID_HANDLE_VALUE, "couldn't open file with mode %x\n", current->stg_mode);
+            ok(hfile != INVALID_HANDLE_VALUE, "couldn't open file with mode %lx\n", current->stg_mode);
 
             ol.u.s.OffsetHigh = 0;
             ol.hEvent = NULL;
@@ -3548,12 +3548,12 @@ static void test_locking(void)
                     expect_locked = FALSE;
 
                 if (!current->todo || locked == expect_locked)
-                    ok(locked == expect_locked, "byte %x of file with mode %x is %slocked but should %sbe\n",
+                    ok(locked == expect_locked, "byte %lx of file with mode %lx is %slocked but should %sbe\n",
                        ol.u.s.Offset, current->stg_mode, locked?"":"not ", expect_locked?"":"not ");
                 else
                 {
                     any_failure = TRUE;
-                    todo_wine ok(locked == expect_locked, "byte %x of file with mode %x is %slocked but should %sbe\n",
+                    todo_wine ok(locked == expect_locked, "byte %lx of file with mode %lx is %slocked but should %sbe\n",
                               ol.u.s.Offset, current->stg_mode, locked?"":"not ", expect_locked?"":"not ");
                 }
             }
@@ -3571,7 +3571,7 @@ static void test_locking(void)
             const int* next_range = current->fail_ranges;
 
             hfile = CreateFileW(filename, open_mode, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-            ok(hfile != INVALID_HANDLE_VALUE, "couldn't open file with mode %x\n", current->stg_mode);
+            ok(hfile != INVALID_HANDLE_VALUE, "couldn't open file with mode %lx\n", current->stg_mode);
 
             ol.u.s.OffsetHigh = 0;
             ol.hEvent = NULL;
@@ -3589,7 +3589,7 @@ static void test_locking(void)
                     LockFileEx(hfile, LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &ol);
 
                 hr = StgOpenStorage(filename, NULL, current->stg_mode, NULL, 0, &stg);
-                ok(hr == S_OK || hr == STG_E_LOCKVIOLATION || hr == STG_E_SHAREVIOLATION, "failed with unexpected hr %x\n", hr);
+                ok(hr == S_OK || hr == STG_E_LOCKVIOLATION || hr == STG_E_SHAREVIOLATION, "failed with unexpected hr %lx\n", hr);
                 if (SUCCEEDED(hr)) IStorage_Release(stg);
 
                 UnlockFileEx(hfile, 0, 1, 0, &ol);
@@ -3607,12 +3607,12 @@ static void test_locking(void)
                 }
 
                 if (!current->todo || failed == expect_failed)
-                    ok(failed == expect_failed, "open with byte %x locked, mode %x %s but should %s\n",
+                    ok(failed == expect_failed, "open with byte %lx locked, mode %lx %s but should %s\n",
                        ol.u.s.Offset, current->stg_mode, failed?"failed":"succeeded", expect_failed?"fail":"succeed");
                 else
                 {
                     any_failure = TRUE;
-                    todo_wine ok(failed == expect_failed, "open with byte %x locked, mode %x %s but should %s\n",
+                    todo_wine ok(failed == expect_failed, "open with byte %lx locked, mode %lx %s but should %s\n",
                                  ol.u.s.Offset, current->stg_mode, failed?"failed":"succeeded", expect_failed?"fail":"succeed");
                 }
             }
@@ -3623,7 +3623,7 @@ static void test_locking(void)
         DeleteFileW(filename);
 
         if (current->todo && !any_failure)
-            todo_wine ok(1, "tests succeeded for mode %x\n", current->stg_mode);
+            todo_wine ok(1, "tests succeeded for mode %lx\n", current->stg_mode);
     }
 }
 
@@ -3644,99 +3644,99 @@ static void test_transacted_shared(void)
     /* create a new transacted storage with a stream */
     r = StgCreateDocfile(filename, STGM_CREATE |
                             STGM_READWRITE |STGM_TRANSACTED, 0, &stg);
-    ok(r==S_OK, "StgCreateDocfile failed %x\n", r);
+    ok(r==S_OK, "StgCreateDocfile failed %lx\n", r);
 
     r = WriteClassStg(stg, &test_stg_cls);
-    ok(r == S_OK, "WriteClassStg failed %x\n", r);
+    ok(r == S_OK, "WriteClassStg failed %lx\n", r);
 
     r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed %lx\n", r);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "aaa", 3, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     /* open a second transacted read/write storage */
     r = StgOpenStorage(filename, NULL, STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_DENY_NONE, NULL, 0, &stgrw);
-    ok(r==S_OK, "StgOpenStorage failed %x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed %lx\n", r);
 
     /* update stream on the first storage and commit */
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "ccc", 3, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     /* update again without committing */
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "ddd", 3, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     IStream_Release(stm);
 
     /* we can still read the old content from the second storage */
     r = IStorage_OpenStream(stgrw, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm);
-    ok(r==S_OK, "IStorage->OpenStream failed %x\n", r);
+    ok(r==S_OK, "IStorage->OpenStream failed %lx\n", r);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Read(stm, buffer, sizeof(buffer), &bytesread);
-    ok(r==S_OK, "IStream->Read failed %x\n", r);
-    ok(bytesread == 3, "read wrong number of bytes %i\n", bytesread);
+    ok(r==S_OK, "IStream->Read failed %lx\n", r);
+    ok(bytesread == 3, "read wrong number of bytes %li\n", bytesread);
     ok(memcmp(buffer, "aaa", 3) == 0, "wrong data\n");
 
     /* and overwrite the data */
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "bbb", 3, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     IStream_Release(stm);
 
     /* commit fails because we're out of date */
     r = IStorage_Commit(stgrw, STGC_ONLYIFCURRENT);
-    ok(r==STG_E_NOTCURRENT, "IStorage->Commit failed %x\n", r);
+    ok(r==STG_E_NOTCURRENT, "IStorage->Commit failed %lx\n", r);
 
     /* unless we force it */
     r = IStorage_Commit(stgrw, STGC_DEFAULT);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     /* reverting gets us back to the last commit from the same storage */
     r = IStorage_Revert(stg);
-    ok(r==S_OK, "IStorage->Revert failed %x\n", r);
+    ok(r==S_OK, "IStorage->Revert failed %lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname, NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed %lx\n", r);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, 0, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Read(stm, buffer, sizeof(buffer), &bytesread);
-    ok(r==S_OK, "IStream->Read failed %x\n", r);
-    ok(bytesread == 3, "read wrong number of bytes %i\n", bytesread);
+    ok(r==S_OK, "IStream->Read failed %lx\n", r);
+    ok(bytesread == 3, "read wrong number of bytes %li\n", bytesread);
     ok(memcmp(buffer, "ccc", 3) == 0, "wrong data\n");
 
     /* and committing fails forever */
     r = IStorage_Commit(stg, STGC_ONLYIFCURRENT);
-    ok(r==STG_E_NOTCURRENT, "IStorage->Commit failed %x\n", r);
+    ok(r==STG_E_NOTCURRENT, "IStorage->Commit failed %lx\n", r);
 
     IStream_Release(stm);
 
@@ -3764,71 +3764,71 @@ static void test_overwrite(void)
     DeleteFileA(filenameA);
 
     r = StgCreateDocfile(filename, STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED, 0, &stg);
-    ok(r==S_OK, "StgCreateDocfile failed %x\n", r);
+    ok(r==S_OK, "StgCreateDocfile failed %lx\n", r);
 
     r = WriteClassStg(stg, &test_stg_cls);
-    ok(r == S_OK, "WriteClassStg failed %x\n", r);
+    ok(r == S_OK, "WriteClassStg failed %lx\n", r);
 
     r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed %lx\n", r);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     memset(buffer, 'a', sizeof(buffer));
     for (i=0; i<4; i++)
     {
         /* Write enough bytes to pass the minimum storage file size */
         r = IStream_Write(stm, buffer, sizeof(buffer), NULL);
-        ok(r==S_OK, "IStream->Write failed %x\n", r);
+        ok(r==S_OK, "IStream->Write failed %lx\n", r);
     }
 
     r = IStorage_Commit(stg, STGC_DEFAULT);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     hfile = CreateFileA(filenameA, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
         NULL, OPEN_EXISTING, 0, NULL);
-    ok(hfile != NULL, "couldn't open file %d\n", GetLastError());
+    ok(hfile != NULL, "couldn't open file %ld\n", GetLastError());
 
     orig_size = GetFileSize(hfile, NULL);
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "b", 1, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     r = IStorage_Commit(stg, STGC_OVERWRITE);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     new_size = GetFileSize(hfile, NULL);
 
-    todo_wine ok(new_size == orig_size, "file grew from %d bytes to %d\n", orig_size, new_size);
+    todo_wine ok(new_size == orig_size, "file grew from %ld bytes to %ld\n", orig_size, new_size);
 
     IStream_Release(stm);
 
     IStorage_RenameElement(stg, stmname, stmname2);
 
     r = IStorage_Commit(stg, STGC_OVERWRITE);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     new_size = GetFileSize(hfile, NULL);
 
-    todo_wine ok(new_size == orig_size, "file grew from %d bytes to %d\n", orig_size, new_size);
+    todo_wine ok(new_size == orig_size, "file grew from %ld bytes to %ld\n", orig_size, new_size);
 
     IStorage_Release(stg);
 
     r = StgOpenStorage(filename, NULL, STGM_READWRITE | STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE, NULL, 0, &stg);
-    ok(r==S_OK, "StgOpenStorage failed %x\n", r);
+    ok(r==S_OK, "StgOpenStorage failed %lx\n", r);
 
     r = IStorage_OpenStream(stg, stmname2, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm);
-    ok(r==S_OK, "IStorage->CreateStream failed %x\n", r);
+    ok(r==S_OK, "IStorage->CreateStream failed %lx\n", r);
 
     r = IStream_Read(stm, buffer, sizeof(buffer), &bytesread);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
-    ok(bytesread == sizeof(buffer), "only read %d bytes\n", bytesread);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
+    ok(bytesread == sizeof(buffer), "only read %ld bytes\n", bytesread);
     ok(buffer[0] == 'b', "unexpected data at byte 0\n");
 
     for (i=1; i<sizeof(buffer); i++)
@@ -3838,17 +3838,17 @@ static void test_overwrite(void)
 
     pos.QuadPart = 0;
     r = IStream_Seek(stm, pos, STREAM_SEEK_SET, &upos);
-    ok(r==S_OK, "IStream->Seek failed %x\n", r);
+    ok(r==S_OK, "IStream->Seek failed %lx\n", r);
 
     r = IStream_Write(stm, "c", 1, NULL);
-    ok(r==S_OK, "IStream->Write failed %x\n", r);
+    ok(r==S_OK, "IStream->Write failed %lx\n", r);
 
     r = IStorage_Commit(stg, STGC_OVERWRITE);
-    ok(r==S_OK, "IStorage->Commit failed %x\n", r);
+    ok(r==S_OK, "IStorage->Commit failed %lx\n", r);
 
     new_size = GetFileSize(hfile, NULL);
 
-    todo_wine ok(new_size == orig_size, "file grew from %d bytes to %d\n", orig_size, new_size);
+    todo_wine ok(new_size == orig_size, "file grew from %ld bytes to %ld\n", orig_size, new_size);
 
     IStream_Release(stm);
 
@@ -3870,10 +3870,10 @@ static void test_custom_lockbytes(void)
     CreateTestLockBytes(&lockbytes);
 
     hr = StgCreateDocfileOnILockBytes(&lockbytes->ILockBytes_iface, STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED, 0, &stg);
-    ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %x\n", hr);
+    ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %lx\n", hr);
 
     hr = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm);
-    ok(hr==S_OK, "IStorage_CreateStream failed %x\n", hr);
+    ok(hr==S_OK, "IStorage_CreateStream failed %lx\n", hr);
 
     IStream_Write(stm, "Hello World!", 12, NULL);
     IStream_Release(stm);
@@ -3881,9 +3881,9 @@ static void test_custom_lockbytes(void)
     memset(lockbytes->contents, 0, lockbytes->buffer_size);
 
     hr = IStorage_Commit(stg, 0);
-    ok(hr==S_OK, "IStorage_Commit failed %x\n", hr);
+    ok(hr==S_OK, "IStorage_Commit failed %lx\n", hr);
 
-    ok(*(DWORD *)lockbytes->contents == 0xe011cfd0, "contents: %08x\n", *(DWORD *)lockbytes->contents);
+    ok(*(DWORD *)lockbytes->contents == 0xe011cfd0, "contents: %08lx\n", *(DWORD *)lockbytes->contents);
 
     IStorage_Release(stg);
 
@@ -3892,34 +3892,34 @@ static void test_custom_lockbytes(void)
     lockbytes->locks_supported = LOCK_WRITE|LOCK_EXCLUSIVE|LOCK_ONLYONCE;
 
     hr = StgCreateDocfileOnILockBytes(&lockbytes->ILockBytes_iface, STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED, 0, &stg);
-    ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %x\n", hr);
+    ok(hr==S_OK, "StgCreateDocfileOnILockBytes failed %lx\n", hr);
 
     hr = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, 0, &stm);
-    ok(hr==S_OK, "IStorage_CreateStream failed %x\n", hr);
+    ok(hr==S_OK, "IStorage_CreateStream failed %lx\n", hr);
 
     IStream_Write(stm, "Hello World!", 12, NULL);
     IStream_Release(stm);
 
     hr = IStorage_Commit(stg, 0);
-    ok(hr==S_OK, "IStorage_Commit failed %x\n", hr);
+    ok(hr==S_OK, "IStorage_Commit failed %lx\n", hr);
 
     ok(lockbytes->lock_called, "expected LockRegion to be called\n");
 
-    ok(*(DWORD *)lockbytes->contents == 0xe011cfd0, "contents: %08x\n", *(DWORD *)lockbytes->contents);
+    ok(*(DWORD *)lockbytes->contents == 0xe011cfd0, "contents: %08lx\n", *(DWORD *)lockbytes->contents);
 
     memset(lockbytes->contents, 0, lockbytes->buffer_size);
 
     hr = IStorage_Commit(stg, 0);
-    ok(hr==STG_E_INVALIDHEADER, "IStorage_Commit should fail: %x\n", hr);
+    ok(hr==STG_E_INVALIDHEADER, "IStorage_Commit should fail: %lx\n", hr);
 
-    ok(*(DWORD *)lockbytes->contents == 0, "contents: %08x\n", *(DWORD *)lockbytes->contents);
+    ok(*(DWORD *)lockbytes->contents == 0, "contents: %08lx\n", *(DWORD *)lockbytes->contents);
 
     IStorage_Release(stg);
 
     lockbytes->lock_hr = STG_E_INVALIDFUNCTION;
 
     hr = StgCreateDocfileOnILockBytes(&lockbytes->ILockBytes_iface, STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED, 0, &stg);
-    ok(hr==STG_E_INVALIDFUNCTION, "StgCreateDocfileOnILockBytes failed %x\n", hr);
+    ok(hr==STG_E_INVALIDFUNCTION, "StgCreateDocfileOnILockBytes failed %lx\n", hr);
 
     DeleteTestLockBytes(lockbytes);
 }
@@ -3931,7 +3931,7 @@ START_TEST(storage32)
     GetTempPathA(MAX_PATH, temp);
     if(!GetTempFileNameA(temp, "stg", 0, filenameA))
     {
-        win_skip("Could not create temp file, %u\n", GetLastError());
+        win_skip("Could not create temp file, %lu\n", GetLastError());
         return;
     }
     MultiByteToWideChar(CP_ACP, 0, filenameA, -1, filename, MAX_PATH);
diff --git a/dlls/ole32/tests/usrmarshal.c b/dlls/ole32/tests/usrmarshal.c
index fa281abbaaf..96cb0b4c669 100644
--- a/dlls/ole32/tests/usrmarshal.c
+++ b/dlls/ole32/tests/usrmarshal.c
@@ -110,11 +110,11 @@ static DWORD CALLBACK host_object_proc(LPVOID p)
         IMessageFilter * prev_filter = NULL;
         hr = CoRegisterMessageFilter(data->filter, &prev_filter);
         if (prev_filter) IMessageFilter_Release(prev_filter);
-        ok(hr == S_OK, "got %08x\n", hr);
+        ok(hr == S_OK, "got %08lx\n", hr);
     }
 
     hr = CoMarshalInterface(data->stream, &data->iid, data->object, MSHCTX_INPROC, NULL, data->marshal_flags);
-    ok(hr == S_OK, "got %08x\n", hr);
+    ok(hr == S_OK, "got %08lx\n", hr);
 
     /* force the message queue to be created before signaling parent thread */
     PeekMessageA(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
@@ -164,7 +164,7 @@ static DWORD start_host_object2(IStream *stream, REFIID riid, IUnknown *object,
 static void end_host_object(DWORD tid, HANDLE thread)
 {
     BOOL ret = PostThreadMessageA(tid, WM_QUIT, 0, 0);
-    ok(ret, "PostThreadMessage failed with error %d\n", GetLastError());
+    ok(ret, "PostThreadMessage failed with error %ld\n", GetLastError());
     /* be careful of races - don't return until hosting thread has terminated */
     ok( !WaitForSingleObject(thread, 10000), "wait timed out\n" );
     CloseHandle(thread);
@@ -196,19 +196,19 @@ static void test_marshal_CLIPFORMAT(void)
     size = CLIPFORMAT_UserSize(&umcb.Flags, 1, &cf);
     ok(size == 12 + sizeof(cf_marshaled) ||
        broken(size == 16 + sizeof(cf_marshaled)),  /* win64 adds 4 extra (unused) bytes */
-              "CLIPFORMAT: Wrong size %d\n", size);
+              "CLIPFORMAT: Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     memset( buffer, 0xcc, size );
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = CLIPFORMAT_UserMarshal(&umcb.Flags, buffer + 1, &cf);
     ok(buffer_end == buffer + 12 + sizeof(cf_marshaled), "got %p buffer %p\n", buffer_end, buffer);
-    ok(*(LONG *)(buffer + 4) == WDT_REMOTE_CALL, "CLIPFORMAT: Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(LONG *)(buffer + 0));
-    ok(*(DWORD *)(buffer + 8) == cf, "CLIPFORMAT: Marshaled value should be 0x%04x instead of 0x%04x\n", cf, *(DWORD *)(buffer + 4));
+    ok(*(LONG *)(buffer + 4) == WDT_REMOTE_CALL, "CLIPFORMAT: Context should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(LONG *)(buffer + 0));
+    ok(*(DWORD *)(buffer + 8) == cf, "CLIPFORMAT: Marshaled value should be 0x%04x instead of 0x%04lx\n", cf, *(DWORD *)(buffer + 4));
     ok(!memcmp(buffer + 12, cf_marshaled, min( sizeof(cf_marshaled), size-12 )), "Marshaled data differs\n");
     if (size > sizeof(cf_marshaled) + 12)  /* make sure the extra bytes are not used */
         for (i = sizeof(cf_marshaled) + 12; i < size; i++)
-            ok( buffer[i] == 0xcc, "buffer offset %u has been set to %x\n", i, buffer[i] );
+            ok( buffer[i] == 0xcc, "buffer offset %lu has been set to %x\n", i, buffer[i] );
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = CLIPFORMAT_UserUnmarshal(&umcb.Flags, buffer + 1, &cf2);
@@ -233,15 +233,15 @@ static void test_marshal_HWND(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = HWND_UserSize(&umcb.Flags, 1, &hwnd);
-    ok(size == 4 + sizeof(*wirehwnd), "Wrong size %d\n", size);
+    ok(size == 4 + sizeof(*wirehwnd), "Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HWND_UserMarshal(&umcb.Flags, buffer + 1, &hwnd);
     ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer);
     wirehwnd = (wireHWND)(buffer + 4);
-    ok(wirehwnd->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehwnd->fContext);
-    ok(wirehwnd->u.hInproc == (LONG_PTR)hwnd, "Marshaled value should be %p instead of %x\n", hwnd, wirehwnd->u.hRemote);
+    ok(wirehwnd->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", wirehwnd->fContext);
+    ok(wirehwnd->u.hInproc == (LONG_PTR)hwnd, "Marshaled value should be %p instead of %lx\n", hwnd, wirehwnd->u.hRemote);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HWND_UserUnmarshal(&umcb.Flags, buffer + 1, &hwnd2);
@@ -270,12 +270,12 @@ static void test_marshal_HGLOBAL(void)
     size = HGLOBAL_UserSize(&umcb.Flags, 0, &hglobal);
     /* native is poorly programmed and allocates 4/8 bytes more than it needs to
      * here - Wine doesn't have to emulate that */
-    ok((size == 8) || broken(size == 12) || broken(size == 16), "Size should be 8, instead of %d\n", size);
+    ok((size == 8) || broken(size == 12) || broken(size == 16), "Size should be 8, instead of %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal);
     wirehglobal = buffer;
-    ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(ULONG *)wirehglobal);
+    ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(ULONG *)wirehglobal);
     wirehglobal += sizeof(ULONG);
     ok(*(ULONG *)wirehglobal == 0, "buffer+4 should be HGLOBAL\n");
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
@@ -305,20 +305,20 @@ static void test_marshal_HGLOBAL(void)
         ok(size == expected_size ||
            broken(size == expected_size + 4) ||
            broken(size == expected_size + 8),
-           "%d: got size %d\n", block_size, size);
+           "%ld: got size %ld\n", block_size, size);
         buffer = HeapAlloc(GetProcessHeap(), 0, size);
         init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
         HGLOBAL_UserMarshal(&umcb.Flags, buffer, &hglobal);
         wirehglobal = buffer;
-        ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(ULONG *)wirehglobal);
+        ok(*(ULONG *)wirehglobal == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(ULONG *)wirehglobal);
         wirehglobal += sizeof(ULONG);
         ok(*(ULONG *)wirehglobal == (ULONG)(ULONG_PTR)hglobal, "buffer+0x4 should be HGLOBAL\n");
         wirehglobal += sizeof(ULONG);
-        ok(*(ULONG *)wirehglobal == actual_size, "%d: buffer+0x8 %08x\n", block_size, *(ULONG *)wirehglobal);
+        ok(*(ULONG *)wirehglobal == actual_size, "%ld: buffer+0x8 %08lx\n", block_size, *(ULONG *)wirehglobal);
         wirehglobal += sizeof(ULONG);
         ok(*(ULONG *)wirehglobal == (ULONG)(ULONG_PTR)hglobal, "buffer+0xc should be HGLOBAL\n");
         wirehglobal += sizeof(ULONG);
-        ok(*(ULONG *)wirehglobal == actual_size, "%d: buffer+0x10 %08x\n", block_size, *(ULONG *)wirehglobal);
+        ok(*(ULONG *)wirehglobal == actual_size, "%ld: buffer+0x10 %08lx\n", block_size, *(ULONG *)wirehglobal);
         wirehglobal += sizeof(ULONG);
         for (i = 0; i < block_size; i++)
             ok(wirehglobal[i] == i, "buffer+0x%x should be %d\n", 0x10 + i, i);
@@ -357,21 +357,21 @@ static void test_marshal_HENHMETAFILE(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = HENHMETAFILE_UserSize(&umcb.Flags, 1, &hemf);
-    ok(size > 24, "size should be at least 24 bytes, not %d\n", size);
+    ok(size > 24, "size should be at least 24 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = HENHMETAFILE_UserMarshal(&umcb.Flags, buffer + 1, &hemf);
     ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer);
     wirehemf = buffer + 4;
-    ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehemf);
     wirehemf += sizeof(DWORD);
-    ok(*(DWORD *)wirehemf == (DWORD)(DWORD_PTR)hemf, "wirestgm + 0x4 should be hemf instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == (DWORD)(DWORD_PTR)hemf, "wirestgm + 0x4 should be hemf instead of 0x%08lx\n", *(DWORD *)wirehemf);
     wirehemf += sizeof(DWORD);
-    ok(*(DWORD *)wirehemf == (size - 0x14), "wirestgm + 0x8 should be size - 0x14 instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == (size - 0x14), "wirestgm + 0x8 should be size - 0x14 instead of 0x%08lx\n", *(DWORD *)wirehemf);
     wirehemf += sizeof(DWORD);
-    ok(*(DWORD *)wirehemf == (size - 0x14), "wirestgm + 0xc should be size - 0x14 instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == (size - 0x14), "wirestgm + 0xc should be size - 0x14 instead of 0x%08lx\n", *(DWORD *)wirehemf);
     wirehemf += sizeof(DWORD);
-    ok(*(DWORD *)wirehemf == EMR_HEADER, "wirestgm + 0x10 should be EMR_HEADER instead of %d\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == EMR_HEADER, "wirestgm + 0x10 should be EMR_HEADER instead of %ld\n", *(DWORD *)wirehemf);
     /* ... rest of data not tested - refer to tests for GetEnhMetaFileBits
      * at this point */
 
@@ -389,15 +389,15 @@ static void test_marshal_HENHMETAFILE(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = HENHMETAFILE_UserSize(&umcb.Flags, 1, &hemf);
-    ok(size == 12, "size should be 12 bytes, not %d\n", size);
+    ok(size == 12, "size should be 12 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = HENHMETAFILE_UserMarshal(&umcb.Flags, buffer + 1, &hemf);
     ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer);
     wirehemf = buffer + 4;
-    ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehemf);
     wirehemf += sizeof(DWORD);
-    ok(*(DWORD *)wirehemf == (DWORD)(DWORD_PTR)hemf, "wirestgm + 0x4 should be hemf instead of 0x%08x\n", *(DWORD *)wirehemf);
+    ok(*(DWORD *)wirehemf == (DWORD)(DWORD_PTR)hemf, "wirestgm + 0x4 should be hemf instead of 0x%08lx\n", *(DWORD *)wirehemf);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = HENHMETAFILE_UserUnmarshal(&umcb.Flags, buffer + 1, &hemf2);
@@ -431,20 +431,20 @@ static void test_marshal_HMETAFILE(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf);
-    ok(size > 20, "size should be at least 20 bytes, not %d\n", size);
+    ok(size > 20, "size should be at least 20 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf);
     wirehmf = buffer;
-    ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
-    ok(*(DWORD *)wirehmf == (DWORD)(DWORD_PTR)hmf, "wirestgm + 0x4 should be hmf instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == (DWORD)(DWORD_PTR)hmf, "wirestgm + 0x4 should be hmf instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
-    ok(*(DWORD *)wirehmf == (size - 0x10), "wirestgm + 0x8 should be size - 0x10 instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == (size - 0x10), "wirestgm + 0x8 should be size - 0x10 instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
-    ok(*(DWORD *)wirehmf == (size - 0x10), "wirestgm + 0xc should be size - 0x10 instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == (size - 0x10), "wirestgm + 0xc should be size - 0x10 instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
-    ok(*(WORD *)wirehmf == 1, "wirestgm + 0x10 should be 1 instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(WORD *)wirehmf == 1, "wirestgm + 0x10 should be 1 instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
     /* ... rest of data not tested - refer to tests for GetMetaFileBits
      * at this point */
@@ -460,14 +460,14 @@ static void test_marshal_HMETAFILE(void)
     hmf = NULL;
 
     size = HMETAFILE_UserSize(&umcb.Flags, 0, &hmf);
-    ok(size == 8, "size should be 8 bytes, not %d\n", size);
+    ok(size == 8, "size should be 8 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     HMETAFILE_UserMarshal(&umcb.Flags, buffer, &hmf);
     wirehmf = buffer;
-    ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
-    ok(*(DWORD *)wirehmf == (DWORD)(DWORD_PTR)hmf, "wirestgm + 0x4 should be hmf instead of 0x%08x\n", *(DWORD *)wirehmf);
+    ok(*(DWORD *)wirehmf == (DWORD)(DWORD_PTR)hmf, "wirestgm + 0x4 should be hmf instead of 0x%08lx\n", *(DWORD *)wirehmf);
     wirehmf += sizeof(DWORD);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
@@ -503,36 +503,36 @@ static void test_marshal_HMETAFILEPICT(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = HMETAFILEPICT_UserSize(&umcb.Flags, 1, &hmfp);
-    ok(size > 24, "size should be at least 24 bytes, not %d\n", size);
+    ok(size > 24, "size should be at least 24 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer + 1, &hmfp);
     wirehmfp = buffer + 4;
-    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)hmfp, "wirestgm + 0x4 should be hmf instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)hmfp, "wirestgm + 0x4 should be hmf instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == MM_ISOTROPIC, "wirestgm + 0x8 should be MM_ISOTROPIC instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == MM_ISOTROPIC, "wirestgm + 0x8 should be MM_ISOTROPIC instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == 1, "wirestgm + 0xc should be 1 instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == 1, "wirestgm + 0xc should be 1 instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == 2, "wirestgm + 0x10 should be 2 instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == 2, "wirestgm + 0x10 should be 2 instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == USER_MARSHAL_PTR_PREFIX, "wirestgm + 0x14 should be \"User\" instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == USER_MARSHAL_PTR_PREFIX, "wirestgm + 0x14 should be \"User\" instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x18 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x18 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
     pmfp = GlobalLock(hmfp);
-    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)pmfp->hMF, "wirestgm + 0x1c should be pmfp->hMF instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)pmfp->hMF, "wirestgm + 0x1c should be pmfp->hMF instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     GlobalUnlock(hmfp);
     wirehmfp += sizeof(DWORD);
     /* Note use (buffer_end - buffer) instead of size here, because size is an
      * overestimate with native */
-    ok(*(DWORD *)wirehmfp == (buffer_end - buffer - 0x2c), "wirestgm + 0x20 should be size - 0x34 instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == (buffer_end - buffer - 0x2c), "wirestgm + 0x20 should be size - 0x34 instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == (buffer_end - buffer - 0x2c), "wirestgm + 0x24 should be size - 0x34 instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == (buffer_end - buffer - 0x2c), "wirestgm + 0x24 should be size - 0x34 instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(WORD *)wirehmfp == 1, "wirehmfp + 0x28 should be 1 instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(WORD *)wirehmfp == 1, "wirehmfp + 0x28 should be 1 instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     /* ... rest of data not tested - refer to tests for GetMetaFileBits
      * at this point */
 
@@ -552,15 +552,15 @@ static void test_marshal_HMETAFILEPICT(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = HMETAFILEPICT_UserSize(&umcb.Flags, 1, &hmfp);
-    ok(size == 12, "size should be 12 bytes, not %d\n", size);
+    ok(size == 12, "size should be 12 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = HMETAFILEPICT_UserMarshal(&umcb.Flags, buffer + 1, &hmfp);
     ok(buffer_end == buffer + size, "got %p buffer %p\n", buffer_end, buffer);
     wirehmfp = buffer + 4;
-    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == WDT_REMOTE_CALL, "wirestgm + 0x0 should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
-    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)hmfp, "wirestgm + 0x4 should be hmf instead of 0x%08x\n", *(DWORD *)wirehmfp);
+    ok(*(DWORD *)wirehmfp == (DWORD)(DWORD_PTR)hmfp, "wirestgm + 0x4 should be hmf instead of 0x%08lx\n", *(DWORD *)wirehmfp);
     wirehmfp += sizeof(DWORD);
 
     hmfp2 = NULL;
@@ -702,7 +702,7 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client,
     unk = NULL;
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, umcb_ctx);
     size = WdtpInterfacePointer_UserSize(&umcb.Flags, ctx, 0, unk, &IID_IUnknown);
-    ok(size == 0, "size should be 0 bytes, not %d\n", size);
+    ok(size == 0, "size should be 0 bytes, not %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, ctx, buffer, unk, &IID_IUnknown);
     ok(buffer_end == buffer, "buffer_end %p buffer %p\n", buffer_end, buffer);
@@ -721,23 +721,23 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client,
     marshal_size = pos.u.LowPart;
     marshal_data = GlobalLock(h);
     todo_wine
-    ok(Test_Unknown.refs == 2, "got %d\n", Test_Unknown.refs);
+    ok(Test_Unknown.refs == 2, "got %ld\n", Test_Unknown.refs);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, umcb_ctx);
     size = WdtpInterfacePointer_UserSize(&umcb.Flags, ctx, 0, unk, &IID_IUnknown);
-    ok(size >= marshal_size + 2 * sizeof(DWORD), "marshal size %x got %x\n", marshal_size, size);
+    ok(size >= marshal_size + 2 * sizeof(DWORD), "marshal size %lx got %lx\n", marshal_size, size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, umcb_ctx);
     buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, ctx, buffer, unk, &IID_IUnknown);
     todo_wine
-    ok(Test_Unknown.refs == 2, "got %d\n", Test_Unknown.refs);
+    ok(Test_Unknown.refs == 2, "got %ld\n", Test_Unknown.refs);
     wireip = buffer;
 
     ok(buffer_end == buffer + marshal_size + 2 * sizeof(DWORD), "buffer_end %p buffer %p\n", buffer_end, buffer);
 
-    ok(*(DWORD *)wireip == marshal_size, "wireip + 0x0 should be %x instead of %x\n", marshal_size, *(DWORD *)wireip);
+    ok(*(DWORD *)wireip == marshal_size, "wireip + 0x0 should be %lx instead of %lx\n", marshal_size, *(DWORD *)wireip);
     wireip += sizeof(DWORD);
-    ok(*(DWORD *)wireip == marshal_size, "wireip + 0x4 should be %x instead of %x\n", marshal_size, *(DWORD *)wireip);
+    ok(*(DWORD *)wireip == marshal_size, "wireip + 0x4 should be %lx instead of %lx\n", marshal_size, *(DWORD *)wireip);
     wireip += sizeof(DWORD);
 
     ok(!memcmp(marshal_data, wireip, marshal_size), "buffer mismatch\n");
@@ -756,8 +756,8 @@ static void marshal_WdtpInterfacePointer(DWORD umcb_ctx, DWORD ctx, BOOL client,
 
     WdtpInterfacePointer_UserUnmarshal(&umcb.Flags, buffer, &unk2, &IID_IUnknown);
     ok(unk2 != NULL, "IUnknown object didn't unmarshal properly\n");
-    ok(Test_Unknown.refs == 2, "got %d\n", Test_Unknown.refs);
-    ok(Test_Unknown2.refs == 0, "got %d\n", Test_Unknown2.refs);
+    ok(Test_Unknown.refs == 2, "got %ld\n", Test_Unknown.refs);
+    ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
     HeapFree(GetProcessHeap(), 0, buffer);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
     IUnknown_Release(unk2);
@@ -820,14 +820,14 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med);
-    ok(size == expect_size, "size %d should be %d bytes\n", size, expect_size);
+    ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med);
     ok(buffer_end - buffer == expect_buffer_end - expect_buffer, "buffer size mismatch\n");
-    ok(*(DWORD*)buffer == TYMED_NULL, "got %08x\n", *(DWORD*)buffer);
-    ok(*((DWORD*)buffer+1) != 0, "got %08x\n", *((DWORD*)buffer+1));
+    ok(*(DWORD*)buffer == TYMED_NULL, "got %08lx\n", *(DWORD*)buffer);
+    ok(*((DWORD*)buffer+1) != 0, "got %08lx\n", *((DWORD*)buffer+1));
     ok(!memcmp(buffer+8, expect_buffer + 8, expect_buffer_end - expect_buffer - 8), "buffer mismatch\n");
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
@@ -842,9 +842,9 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
 
-    ok(med2.tymed == TYMED_NULL, "got tymed %x\n", med2.tymed);
+    ok(med2.tymed == TYMED_NULL, "got tymed %lx\n", med2.tymed);
     ok(med2.pUnkForRelease != NULL, "Incorrectly unmarshalled\n");
-    ok(Test_Unknown2.refs == 0, "got %d\n", Test_Unknown2.refs);
+    ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
 
     HeapFree(GetProcessHeap(), 0, buffer);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
@@ -858,7 +858,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     STGMEDIUM_UserFree(&umcb.Flags, &med2);
 
-    ok(Test_Unknown.refs == 1, "got %d\n", Test_Unknown.refs);
+    ok(Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs);
 
     HeapFree(GetProcessHeap(), 0, expect_buffer);
 
@@ -887,16 +887,16 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med);
-    ok(size == expect_size, "size %d should be %d bytes\n", size, expect_size);
+    ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     memset(buffer, 0xcc, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med);
     ok(buffer_end - buffer == expect_buffer_end - expect_buffer, "buffer size mismatch\n");
-    ok(*(DWORD*)buffer == TYMED_ISTREAM, "got %08x\n", *(DWORD*)buffer);
-    ok(*((DWORD*)buffer+1) != 0, "got %08x\n", *((DWORD*)buffer+1));
-    ok(*((DWORD*)buffer+2) != 0, "got %08x\n", *((DWORD*)buffer+2));
+    ok(*(DWORD*)buffer == TYMED_ISTREAM, "got %08lx\n", *(DWORD*)buffer);
+    ok(*((DWORD*)buffer+1) != 0, "got %08lx\n", *((DWORD*)buffer+1));
+    ok(*((DWORD*)buffer+2) != 0, "got %08lx\n", *((DWORD*)buffer+2));
     ok(!memcmp(buffer + 12, expect_buffer + 12, (buffer_end - buffer) - 12), "buffer mismatch\n");
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
@@ -912,11 +912,11 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
 
-    ok(med2.tymed == TYMED_ISTREAM, "got tymed %x\n", med2.tymed);
+    ok(med2.tymed == TYMED_ISTREAM, "got tymed %lx\n", med2.tymed);
     ok(U(med2).pstm != NULL, "Incorrectly unmarshalled\n");
     ok(med2.pUnkForRelease != NULL, "Incorrectly unmarshalled\n");
-    ok(Test_Stream2.refs == 0, "got %d\n", Test_Stream2.refs);
-    ok(Test_Unknown2.refs == 0, "got %d\n", Test_Unknown2.refs);
+    ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs);
+    ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
 
     HeapFree(GetProcessHeap(), 0, buffer);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
@@ -930,8 +930,8 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     STGMEDIUM_UserFree(&umcb.Flags, &med2);
 
-    ok(Test_Unknown.refs == 1, "got %d\n", Test_Unknown.refs);
-    ok(Test_Stream.refs == 1, "got %d\n", Test_Stream.refs);
+    ok(Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs);
+    ok(Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs);
 
     HeapFree(GetProcessHeap(), 0, expect_buffer);
 
@@ -946,16 +946,16 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
     size = STGMEDIUM_UserSize(&umcb.Flags, 0, &med);
-    ok(size == expect_size, "size %d should be %d bytes\n", size, expect_size);
+    ok(size == expect_size, "size %ld should be %ld bytes\n", size, expect_size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     memset(buffer, 0xcc, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     buffer_end = STGMEDIUM_UserMarshal(&umcb.Flags, buffer, &med);
     ok(buffer_end - buffer == expect_size, "buffer size mismatch\n");
-    ok(*(DWORD*)buffer == TYMED_ISTREAM, "got %08x\n", *(DWORD*)buffer);
-    ok(*((DWORD*)buffer+1) == 0, "got %08x\n", *((DWORD*)buffer+1));
-    ok(*((DWORD*)buffer+2) == 0, "got %08x\n", *((DWORD*)buffer+2));
+    ok(*(DWORD*)buffer == TYMED_ISTREAM, "got %08lx\n", *(DWORD*)buffer);
+    ok(*((DWORD*)buffer+1) == 0, "got %08lx\n", *((DWORD*)buffer+1));
+    ok(*((DWORD*)buffer+2) == 0, "got %08lx\n", *((DWORD*)buffer+2));
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_DIFFERENTMACHINE);
     umcb.pStubMsg->IsClient = client;
@@ -970,11 +970,11 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
 
     STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
 
-    ok(med2.tymed == TYMED_ISTREAM, "got tymed %x\n", med2.tymed);
+    ok(med2.tymed == TYMED_ISTREAM, "got tymed %lx\n", med2.tymed);
     ok(U(med2).pstm == NULL, "Incorrectly unmarshalled\n");
     ok(med2.pUnkForRelease == &Test_Unknown2.IUnknown_iface, "Incorrectly unmarshalled\n");
-    ok(Test_Stream2.refs == 0, "got %d\n", Test_Stream2.refs);
-    ok(Test_Unknown2.refs == 1, "got %d\n", Test_Unknown2.refs);
+    ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs);
+    ok(Test_Unknown2.refs == 1, "got %ld\n", Test_Unknown2.refs);
 
     HeapFree(GetProcessHeap(), 0, buffer);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
@@ -1011,12 +1011,12 @@ static void test_marshal_SNB(void)
     snb = NULL;
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = SNB_UserSize(&umcb.Flags, 3, &snb);
-    ok(size == 16, "Size should be 16, instead of %d\n", size);
+    ok(size == 16, "Size should be 16, instead of %ld\n", size);
 
     /* NULL block */
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = SNB_UserSize(&umcb.Flags, 0, &snb);
-    ok(size == 12, "Size should be 12, instead of %d\n", size);
+    ok(size == 12, "Size should be 12, instead of %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
@@ -1024,9 +1024,9 @@ static void test_marshal_SNB(void)
     ok(mbuf == buffer + size, "got %p, %p\n", mbuf, buffer + size);
 
     wiresnb = (RemSNB*)buffer;
-    ok(wiresnb->ulCntStr == 0, "got %u\n", wiresnb->ulCntStr);
-    ok(wiresnb->ulCntChar == 0, "got %u\n", wiresnb->ulCntChar);
-    ok(*(ULONG*)wiresnb->rgString == 0, "got %u\n", *(ULONG*)wiresnb->rgString);
+    ok(wiresnb->ulCntStr == 0, "got %lu\n", wiresnb->ulCntStr);
+    ok(wiresnb->ulCntChar == 0, "got %lu\n", wiresnb->ulCntChar);
+    ok(*(ULONG*)wiresnb->rgString == 0, "got %lu\n", *(ULONG*)wiresnb->rgString);
 
     snb2 = NULL;
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
@@ -1054,17 +1054,17 @@ static void test_marshal_SNB(void)
     snb = (SNB)src;
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = SNB_UserSize(&umcb.Flags, 0, &snb);
-    ok(size == 38, "Size should be 38, instead of %d\n", size);
+    ok(size == 38, "Size should be 38, instead of %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     SNB_UserMarshal(&umcb.Flags, buffer, &snb);
 
     wiresnb = (RemSNB*)buffer;
-    ok(wiresnb->ulCntStr == 13, "got %u\n", wiresnb->ulCntStr);
-    ok(wiresnb->ulCntChar == 2, "got %u\n", wiresnb->ulCntChar);
+    ok(wiresnb->ulCntStr == 13, "got %lu\n", wiresnb->ulCntStr);
+    ok(wiresnb->ulCntChar == 2, "got %lu\n", wiresnb->ulCntChar);
     /* payload length is stored one more time, as ULONG */
-    ok(*(ULONG*)wiresnb->rgString == wiresnb->ulCntStr, "got %u\n", *(ULONG*)wiresnb->rgString);
+    ok(*(ULONG*)wiresnb->rgString == wiresnb->ulCntStr, "got %lu\n", *(ULONG*)wiresnb->rgString);
     dataW = &wiresnb->rgString[2];
     ok(!lstrcmpW(dataW, str1W), "marshalled string 0: %s\n", wine_dbgstr_w(dataW));
     dataW += ARRAY_SIZE(str1W);
@@ -1106,15 +1106,15 @@ static void test_marshal_HDC(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = HDC_UserSize(&umcb.Flags, 1, &hdc);
-    ok(size == 4 + sizeof(*wirehdc), "Wrong size %d\n", size);
+    ok(size == 4 + sizeof(*wirehdc), "Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HDC_UserMarshal(&umcb.Flags, buffer + 1, &hdc);
     ok(buffer_end == buffer + 4 + sizeof(*wirehdc), "got %p buffer %p\n", buffer_end, buffer);
     wirehdc = (wireHDC)(buffer + 4);
-    ok(wirehdc->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehdc->fContext);
-    ok(wirehdc->u.hInproc == (LONG_PTR)hdc, "Marshaled value should be %p instead of %x\n", hdc, wirehdc->u.hRemote);
+    ok(wirehdc->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", wirehdc->fContext);
+    ok(wirehdc->u.hInproc == (LONG_PTR)hdc, "Marshaled value should be %p instead of %lx\n", hdc, wirehdc->u.hRemote);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HDC_UserUnmarshal(&umcb.Flags, buffer + 1, &hdc2);
@@ -1143,15 +1143,15 @@ static void test_marshal_HICON(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = HICON_UserSize(&umcb.Flags, 1, &hIcon);
-    ok(size == 4 + sizeof(*wirehicon), "Wrong size %d\n", size);
+    ok(size == 4 + sizeof(*wirehicon), "Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HICON_UserMarshal(&umcb.Flags, buffer + 1, &hIcon);
     ok(buffer_end == buffer + 4 + sizeof(*wirehicon), "got %p buffer %p\n", buffer_end, buffer);
     wirehicon = (wireHICON)(buffer + 4);
-    ok(wirehicon->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehicon->fContext);
-    ok(wirehicon->u.hInproc == (LONG_PTR)hIcon, "Marshaled value should be %p instead of %x\n", hIcon, wirehicon->u.hRemote);
+    ok(wirehicon->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", wirehicon->fContext);
+    ok(wirehicon->u.hInproc == (LONG_PTR)hIcon, "Marshaled value should be %p instead of %lx\n", hIcon, wirehicon->u.hRemote);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HICON_UserUnmarshal(&umcb.Flags, buffer + 1, &hIcon2);
@@ -1184,15 +1184,15 @@ static void test_marshal_HBRUSH(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_LOCAL);
     size = HBRUSH_UserSize(&umcb.Flags, 1, &hBrush);
-    ok(size == 4 + sizeof(*wirehbrush), "Wrong size %d\n", size);
+    ok(size == 4 + sizeof(*wirehbrush), "Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HBRUSH_UserMarshal(&umcb.Flags, buffer + 1, &hBrush);
     ok(buffer_end == buffer + 4 + sizeof(*wirehbrush), "got %p buffer %p\n", buffer_end, buffer);
     wirehbrush = (wireHBRUSH)(buffer + 4);
-    ok(wirehbrush->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", wirehbrush->fContext);
-    ok(wirehbrush->u.hInproc == (LONG_PTR)hBrush, "Marshaled value should be %p instead of %x\n", hBrush, wirehbrush->u.hRemote);
+    ok(wirehbrush->fContext == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", wirehbrush->fContext);
+    ok(wirehbrush->u.hInproc == (LONG_PTR)hBrush, "Marshaled value should be %p instead of %lx\n", hBrush, wirehbrush->u.hRemote);
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HBRUSH_UserUnmarshal(&umcb.Flags, buffer + 1, &hBrush2);
@@ -1226,13 +1226,13 @@ static void test_marshal_HBITMAP(void)
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_INPROC);
     size = HBITMAP_UserSize(&umcb.Flags, 1, &hBitmap);
-    ok(size == 0xc, "Wrong size %d\n", size);
+    ok(size == 0xc, "Wrong size %ld\n", size);
     buffer = HeapAlloc(GetProcessHeap(), 0, size + 4);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC);
     buffer_end = HBITMAP_UserMarshal(&umcb.Flags, buffer + 1, &hBitmap);
-    ok(buffer_end == buffer + 0xc, "HBITMAP_UserMarshal() returned wrong size %d\n", (LONG)(buffer_end - buffer));
-    ok(*(ULONG *)(buffer + 0x4) == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08x\n", *(ULONG *)(buffer + 0x4));
-    ok(*(ULONG *)(buffer + 0x8) == (ULONG)(ULONG_PTR)hBitmap, "wirestgm + 0x4 should be bitmap handle instead of 0x%08x\n", *(ULONG *)(buffer + 0x8));
+    ok(buffer_end == buffer + 0xc, "HBITMAP_UserMarshal() returned wrong size %ld\n", (LONG)(buffer_end - buffer));
+    ok(*(ULONG *)(buffer + 0x4) == WDT_INPROC_CALL, "Context should be WDT_INPROC_CALL instead of 0x%08lx\n", *(ULONG *)(buffer + 0x4));
+    ok(*(ULONG *)(buffer + 0x8) == (ULONG)(ULONG_PTR)hBitmap, "wirestgm + 0x4 should be bitmap handle instead of 0x%08lx\n", *(ULONG *)(buffer + 0x8));
 
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_INPROC);
     HBITMAP_UserUnmarshal(&umcb.Flags, buffer + 1, &hBitmap2);
@@ -1246,15 +1246,15 @@ static void test_marshal_HBITMAP(void)
     size = HBITMAP_UserSize(&umcb.Flags, 1, &hBitmap);
     ok(size == 0x10 + header_size + bitmap_size ||
        broken(size == 0x14 + header_size + bitmap_size), /* Windows adds 4 extra (unused) bytes */
-       "Wrong size %d\n", size);
+       "Wrong size %ld\n", size);
 
     buffer = HeapAlloc(GetProcessHeap(), 0, size + 4);
     init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, buffer, size, MSHCTX_LOCAL);
     buffer_end = HBITMAP_UserMarshal(&umcb.Flags, buffer + 1, &hBitmap);
-    ok(buffer_end == buffer + 0x10 + header_size + bitmap_size, "HBITMAP_UserMarshal() returned wrong size %d\n", (LONG)(buffer_end - buffer));
-    ok(*(ULONG *)(buffer + 0x4) == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08x\n", *(ULONG *)buffer);
-    ok(*(ULONG *)(buffer + 0x8) == (ULONG)(ULONG_PTR)hBitmap, "wirestgm + 0x4 should be bitmap handle instead of 0x%08x\n", *(ULONG *)(buffer + 0x4));
-    ok(*(ULONG *)(buffer + 0xc) == (ULONG)(ULONG_PTR)bitmap_size, "wirestgm + 0x8 should be bitmap size instead of 0x%08x\n", *(ULONG *)(buffer + 0x4));
+    ok(buffer_end == buffer + 0x10 + header_size + bitmap_size, "HBITMAP_UserMarshal() returned wrong size %ld\n", (LONG)(buffer_end - buffer));
+    ok(*(ULONG *)(buffer + 0x4) == WDT_REMOTE_CALL, "Context should be WDT_REMOTE_CALL instead of 0x%08lx\n", *(ULONG *)buffer);
+    ok(*(ULONG *)(buffer + 0x8) == (ULONG)(ULONG_PTR)hBitmap, "wirestgm + 0x4 should be bitmap handle instead of 0x%08lx\n", *(ULONG *)(buffer + 0x4));
+    ok(*(ULONG *)(buffer + 0xc) == (ULONG)(ULONG_PTR)bitmap_size, "wirestgm + 0x8 should be bitmap size instead of 0x%08lx\n", *(ULONG *)(buffer + 0x4));
     ok(!memcmp(buffer + 0x10, bitmap, header_size), "buffer mismatch\n");
     ok(!memcmp(buffer + 0x10 + header_size, bmp_bits, bitmap_size), "buffer mismatch\n");
 
@@ -1347,12 +1347,12 @@ static void test_GetDataHere_Proxy(void)
     STGMEDIUM med;
 
     hr = CreateStreamOnHGlobal( NULL, TRUE, &stm );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     tid = start_host_object2( stm, &IID_IDataObject, (IUnknown *)&obj.IDataObject_iface, MSHLFLAGS_NORMAL, NULL, &thread );
 
     IStream_Seek( stm, zero, STREAM_SEEK_SET, NULL );
     hr = CoUnmarshalInterface( stm, &IID_IDataObject, (void **)&data );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     IStream_Release( stm );
 
     Test_Stream.refs = 1;
@@ -1368,33 +1368,33 @@ static void test_GetDataHere_Proxy(void)
 
     fmt.tymed = med.tymed = TYMED_NULL;
     hr = IDataObject_GetDataHere( data, &fmt, &med );
-    ok( hr == DV_E_TYMED, "got %08x\n", hr );
+    ok( hr == DV_E_TYMED, "got %08lx\n", hr );
 
     for (fmt.tymed = TYMED_HGLOBAL; fmt.tymed <= TYMED_ENHMF; fmt.tymed <<= 1)
     {
         med.tymed = fmt.tymed;
         hr = IDataObject_GetDataHere( data, &fmt, &med );
-        ok( hr == (fmt.tymed <= TYMED_ISTORAGE ? S_OK : DV_E_TYMED), "got %08x for tymed %d\n", hr, fmt.tymed );
-        ok( Test_Unknown.refs == 1, "got %d\n", Test_Unknown.refs );
+        ok( hr == (fmt.tymed <= TYMED_ISTORAGE ? S_OK : DV_E_TYMED), "got %08lx for tymed %ld\n", hr, fmt.tymed );
+        ok( Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs );
     }
 
     fmt.tymed = TYMED_ISTREAM;
     med.tymed = TYMED_ISTORAGE;
     hr = IDataObject_GetDataHere( data, &fmt, &med );
-    ok( hr == DV_E_TYMED, "got %08x\n", hr );
+    ok( hr == DV_E_TYMED, "got %08lx\n", hr );
 
     fmt.tymed = med.tymed = TYMED_ISTREAM;
     U(med).pstm = &Test_Stream.IStream_iface;
     med.pUnkForRelease = &Test_Unknown.IUnknown_iface;
 
     hr = IDataObject_GetDataHere( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     ok( U(med).pstm == &Test_Stream.IStream_iface, "stm changed\n" );
     ok( med.pUnkForRelease == &Test_Unknown.IUnknown_iface, "punk changed\n" );
 
-    ok( Test_Stream.refs == 1, "got %d\n", Test_Stream.refs );
-    ok( Test_Unknown.refs == 1, "got %d\n", Test_Unknown.refs );
+    ok( Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs );
+    ok( Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs );
 
     fmt.cfFormat = 2;
     fmt.tymed = med.tymed = TYMED_ISTREAM;
@@ -1402,14 +1402,14 @@ static void test_GetDataHere_Proxy(void)
     med.pUnkForRelease = &Test_Unknown.IUnknown_iface;
 
     hr = IDataObject_GetDataHere( data, &fmt, &med );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
     ok( U(med).pstm == &Test_Stream.IStream_iface, "stm changed\n" );
     ok( med.pUnkForRelease == &Test_Unknown.IUnknown_iface, "punk changed\n" );
 
-    ok( Test_Stream.refs == 1, "got %d\n", Test_Stream.refs );
-    ok( Test_Unknown.refs == 1, "got %d\n", Test_Unknown.refs );
-    ok( Test_Stream2.refs == 0, "got %d\n", Test_Stream2.refs );
+    ok( Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs );
+    ok( Test_Unknown.refs == 1, "got %ld\n", Test_Unknown.refs );
+    ok( Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs );
 
     IDataObject_Release( data );
     end_host_object( tid, thread );




More information about the wine-devel mailing list