[PATCH 11/20] dlls/rpcrt4/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Fri Mar 4 02:25:15 CST 2022


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

---
 dlls/rpcrt4/tests/Makefile.in    |    2 
 dlls/rpcrt4/tests/cstub.c        |  106 ++++++-------
 dlls/rpcrt4/tests/ndr_marshall.c |  322 +++++++++++++++++++-------------------
 dlls/rpcrt4/tests/rpc.c          |  188 +++++++++++-----------
 dlls/rpcrt4/tests/rpc_async.c    |   20 +-
 dlls/rpcrt4/tests/server.c       |  126 +++++++--------
 6 files changed, 382 insertions(+), 382 deletions(-)

diff --git a/dlls/rpcrt4/tests/Makefile.in b/dlls/rpcrt4/tests/Makefile.in
index 195c6cd2909..1e7276c893a 100644
--- a/dlls/rpcrt4/tests/Makefile.in
+++ b/dlls/rpcrt4/tests/Makefile.in
@@ -1,7 +1,7 @@
 TESTDLL   = rpcrt4.dll
 IMPORTS   = oleaut32 ole32 rpcrt4 secur32 advapi32
 EXTRAIDLFLAGS = --prefix-server=s_
-EXTRADEFS = -DWINE_NO_LONG_TYPES -DPROXY_DELEGATION
+EXTRADEFS = -DPROXY_DELEGATION
 
 server_EXTRAIDLFLAGS = -Os --prefix-client=mixed_
 server_interp_EXTRAIDLFLAGS = -Oicf --prefix-client=interp_
diff --git a/dlls/rpcrt4/tests/cstub.c b/dlls/rpcrt4/tests/cstub.c
index e0f519fa1d6..d8b61d10a1a 100644
--- a/dlls/rpcrt4/tests/cstub.c
+++ b/dlls/rpcrt4/tests/cstub.c
@@ -499,13 +499,13 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
 
     r = NdrDllGetClassObject(&CLSID_Unknown, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              &CLSID_psfact, &PSFactoryBuffer);
-    ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%x\n", r);
+    ok(r == CLASS_E_CLASSNOTAVAILABLE, "NdrDllGetClassObject with unknown clsid should have returned CLASS_E_CLASSNOTAVAILABLE instead of 0x%lx\n", r);
     ok(ppsf == NULL, "NdrDllGetClassObject should have set ppsf to NULL on failure\n");
 
     r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              &CLSID_psfact, &PSFactoryBuffer);
 
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     ok(ppsf != NULL, "ppsf == NULL\n");
 
     proxy_vtbl = PSFactoryBuffer.pProxyFileList[0]->pProxyVtblList;
@@ -622,31 +622,31 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
         ok( proxy_vtbl[i]->header.piid == interfaces[i],
             "wrong proxy %u iid %p/%p\n", i, proxy_vtbl[i]->header.piid, interfaces[i] );
 
-    ok(PSFactoryBuffer.RefCount == 1, "ref count %d\n", PSFactoryBuffer.RefCount);
+    ok(PSFactoryBuffer.RefCount == 1, "ref count %ld\n", PSFactoryBuffer.RefCount);
     IPSFactoryBuffer_Release(ppsf);
 
     /* One can also search by IID */
     r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              &CLSID_psfact, &PSFactoryBuffer);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     ok(ppsf != NULL, "ppsf == NULL\n");
     IPSFactoryBuffer_Release(ppsf);
 
     r = NdrDllGetClassObject(&IID_if3, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              NULL, &PSFactoryBuffer);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     ok(ppsf != NULL, "ppsf == NULL\n");
     IPSFactoryBuffer_Release(ppsf);
 
     /* but only if the PS factory implements it */
     r = NdrDllGetClassObject(&IID_IDispatch, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              &CLSID_psfact, &PSFactoryBuffer);
-    ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08x\n", r);
+    ok(r == CLASS_E_CLASSNOTAVAILABLE, "ret %08lx\n", r);
 
     /* Create it again to return */
     r = NdrDllGetClassObject(&CLSID_psfact, &IID_IPSFactoryBuffer, (void**)&ppsf, proxy_file_list,
                              &CLSID_psfact, &PSFactoryBuffer);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     ok(ppsf != NULL, "ppsf == NULL\n");
 
     /* Because this PS factory is not loaded as a dll in the normal way, Windows 8 / 10
@@ -654,13 +654,13 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void)
        Registering the ifaces fixes this (in fact calling CoRegisterPSClsid() with any IID / CLSID is enough). */
 
     r = CoRegisterPSClsid(&IID_if1, &CLSID_psfact);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     r = CoRegisterPSClsid(&IID_if2, &CLSID_psfact);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     r = CoRegisterPSClsid(&IID_if3, &CLSID_psfact);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     r = CoRegisterPSClsid(&IID_if4, &CLSID_psfact);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
 
     return ppsf;
 }
@@ -712,7 +712,7 @@ static IRpcStubBuffer *create_stub(IPSFactoryBuffer *ppsf, REFIID iid, IUnknown
     HRESULT r;
 
     r = IPSFactoryBuffer_CreateStub(ppsf, iid, obj, &pstub);
-    ok(r == expected_result, "CreateStub returned %08x expected %08x\n", r, expected_result);
+    ok(r == expected_result, "CreateStub returned %08lx expected %08lx\n", r, expected_result);
     return pstub;
 }
 
@@ -789,25 +789,25 @@ static void create_proxy_test( IPSFactoryBuffer *ppsf, REFIID iid, const void *e
     ULONG count;
 
     r = IPSFactoryBuffer_CreateProxy(ppsf, NULL, iid, &proxy, (void **)&iface);
-    ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
+    ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %lx\n", r );
     ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
     count = IUnknown_Release( iface );
-    ok( count == 1, "wrong refcount %u\n", count );
+    ok( count == 1, "wrong refcount %lu\n", count );
     count = IRpcProxyBuffer_Release( proxy );
-    ok( count == 0, "wrong refcount %u\n", count );
+    ok( count == 0, "wrong refcount %lu\n", count );
 
     dummy_unknown.ref = 4;
     r = IPSFactoryBuffer_CreateProxy(ppsf, &dummy_unknown.IUnknown_iface, iid, &proxy,
             (void **)&iface);
-    ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r );
-    ok( dummy_unknown.ref == 5, "wrong refcount %u\n", dummy_unknown.ref );
+    ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %lx\n", r );
+    ok( dummy_unknown.ref == 5, "wrong refcount %lu\n", dummy_unknown.ref );
     ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl );
     count = IUnknown_Release( iface );
-    ok( count == 4, "wrong refcount %u\n", count );
-    ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
+    ok( count == 4, "wrong refcount %lu\n", count );
+    ok( dummy_unknown.ref == 4, "wrong refcount %lu\n", dummy_unknown.ref );
     count = IRpcProxyBuffer_Release( proxy );
-    ok( count == 0, "wrong refcount %u\n", count );
-    ok( dummy_unknown.ref == 4, "wrong refcount %u\n", dummy_unknown.ref );
+    ok( count == 0, "wrong refcount %lu\n", count );
+    ok( dummy_unknown.ref == 4, "wrong refcount %lu\n", dummy_unknown.ref );
 }
 
 static void test_CreateProxy( IPSFactoryBuffer *ppsf )
@@ -827,7 +827,7 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf)
     const CInterfaceStubHeader *header = &CONTAINING_RECORD(cstd_stub->lpVtbl, const CInterfaceStubVtbl, Vtbl)->header;
 
     ok(IsEqualIID(header->piid, &IID_if1), "header iid differs\n");
-    ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
+    ok(cstd_stub->RefCount == 1, "ref count %ld\n", cstd_stub->RefCount);
     /* 0xdeadbeef returned from create_stub_test_QI */
     ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
     ok(cstd_stub->pPSFactory != NULL, "pPSFactory was NULL\n");
@@ -836,7 +836,7 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf)
 
     vtbl = &create_stub_test_fail_vtbl;
     pstub = create_stub(ppsf, &IID_if1, obj, E_NOINTERFACE);
-    ok(pstub == S_OK, "create_stub failed: %u\n", GetLastError());
+    ok(pstub == S_OK, "create_stub failed: %lu\n", GetLastError());
 
 }
 
@@ -926,14 +926,14 @@ static void test_Connect(IPSFactoryBuffer *ppsf)
 
     obj = (IUnknown*)&new_vtbl;
     r = IRpcStubBuffer_Connect(pstub, obj);
-    ok(r == S_OK, "r %08x\n", r);
+    ok(r == S_OK, "r %08lx\n", r);
     ok(connect_test_orig_release_called == 1, "release called %d\n", connect_test_orig_release_called);
     ok(cstd_stub->pvServerObject == (void*)0xcafebabe, "pvServerObject %p\n", cstd_stub->pvServerObject);
 
     cstd_stub->pvServerObject = (IUnknown*)&orig_vtbl;
     obj = (IUnknown*)&new_fail_vtbl;
     r = IRpcStubBuffer_Connect(pstub, obj);
-    ok(r == E_NOINTERFACE, "r %08x\n", r);
+    ok(r == E_NOINTERFACE, "r %08lx\n", r);
     ok(cstd_stub->pvServerObject == (void*)0xdeadbeef, "pvServerObject %p\n", cstd_stub->pvServerObject);
     ok(connect_test_orig_release_called == 2, "release called %d\n", connect_test_orig_release_called);    
 
@@ -954,7 +954,7 @@ static void test_Connect(IPSFactoryBuffer *ppsf)
 
     obj = (IUnknown*)&new_vtbl;
     r = IRpcStubBuffer_Connect(pstub, obj);
-    ok(r == S_OK, "r %08x\n", r);
+    ok(r == S_OK, "r %08lx\n", r);
     ok(connect_test_base_Connect_called == 1, "connect_test_bsae_Connect called %d times\n",
        connect_test_base_Connect_called);
     ok(connect_test_orig_release_called == 3, "release called %d\n", connect_test_orig_release_called);
@@ -1004,21 +1004,21 @@ static void test_Release(IPSFactoryBuffer *ppsf)
     facbuf_refs = PSFactoryBuffer.RefCount;
 
     /* This shows that NdrCStdStubBuffer_Release doesn't call Disconnect */
-    ok(cstd_stub->RefCount == 1, "ref count %d\n", cstd_stub->RefCount);
+    ok(cstd_stub->RefCount == 1, "ref count %ld\n", cstd_stub->RefCount);
     connect_test_orig_release_called = 0;
     IRpcStubBuffer_Release(pstub);
 todo_wine {
     ok(connect_test_orig_release_called == 0, "release called %d\n", connect_test_orig_release_called);
 }
-    ok(PSFactoryBuffer.RefCount == facbuf_refs - 1, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
+    ok(PSFactoryBuffer.RefCount == facbuf_refs - 1, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
 
     /* This shows that NdrCStdStubBuffer_Release calls Release on its 2nd arg, rather than on This->pPSFactory
        (which are usually the same and indeed it's odd that _Release requires this 2nd arg). */
     pstub = create_stub(ppsf, &IID_if1, obj, S_OK);
-    ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
+    ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
     NdrCStdStubBuffer_Release(pstub, (IPSFactoryBuffer*)pretend_psfacbuf);
     ok(release_test_psfacbuf_release_called == 1, "pretend_psfacbuf_release called %d\n", release_test_psfacbuf_release_called);
-    ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %d orig %d\n", PSFactoryBuffer.RefCount, facbuf_refs);
+    ok(PSFactoryBuffer.RefCount == facbuf_refs, "factory buffer refs %ld orig %ld\n", PSFactoryBuffer.RefCount, facbuf_refs);
 }
 
 static HRESULT WINAPI delegating_invoke_test_QI(ITypeLib *pUnk, REFIID iid, void** ppv)
@@ -1142,11 +1142,11 @@ static void test_delegating_Invoke(IPSFactoryBuffer *ppsf)
     msg.dataRepresentation = NDR_LOCAL_DATA_REPRESENTATION;
     msg.iMethod = 3;
     r = IRpcStubBuffer_Invoke(pstub, &msg, pchan);
-    ok(r == S_OK, "ret %08x\n", r);
+    ok(r == S_OK, "ret %08lx\n", r);
     if(r == S_OK)
     {
-        ok(*(DWORD*)msg.Buffer == 0xabcdef, "buf[0] %08x\n", *(DWORD*)msg.Buffer);
-        ok(*((DWORD*)msg.Buffer + 1) == S_OK, "buf[1] %08x\n", *((DWORD*)msg.Buffer + 1));
+        ok(*(DWORD*)msg.Buffer == 0xabcdef, "buf[0] %08lx\n", *(DWORD*)msg.Buffer);
+        ok(*((DWORD*)msg.Buffer + 1) == S_OK, "buf[1] %08lx\n", *((DWORD*)msg.Buffer + 1));
     }
     /* free the buffer allocated by delegating_invoke_chan_get_buffer */
     HeapFree(GetProcessHeap(), 0, msg.Buffer);
@@ -1200,19 +1200,19 @@ static void test_NdrDllRegisterProxy( void )
 
 
     res = NdrDllRegisterProxy(NULL, NULL, NULL);
-    ok(res == E_HANDLE, "Incorrect return code %x\n",res);
+    ok(res == E_HANDLE, "Incorrect return code %lx\n",res);
     pf = NULL;
     res = NdrDllRegisterProxy(hmod, &pf, NULL);
-    ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
+    ok(res == E_NOINTERFACE, "Incorrect return code %lx\n",res);
     res = NdrDllRegisterProxy(hmod, proxy_file_list2, NULL);
-    ok(res == E_NOINTERFACE, "Incorrect return code %x\n",res);
+    ok(res == E_NOINTERFACE, "Incorrect return code %lx\n",res);
     /* This fails on Vista and Windows 7 due to permissions */
     res = NdrDllRegisterProxy(hmod, proxy_file_list, NULL);
-    ok(res == S_OK || res == E_ACCESSDENIED, "NdrDllRegisterProxy failed %x\n",res);
+    ok(res == S_OK || res == E_ACCESSDENIED, "NdrDllRegisterProxy failed %lx\n",res);
     if (res == S_OK)
     {
         res = NdrDllUnregisterProxy(hmod,proxy_file_list, NULL);
-        ok(res == S_OK, "NdrDllUnregisterProxy failed %x\n",res);
+        ok(res == S_OK, "NdrDllUnregisterProxy failed %lx\n",res);
     }
 }
 
@@ -1228,7 +1228,7 @@ static HANDLE create_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: %u\n", GetLastError());
+    ok(ret, "CreateProcess failed: %lu\n", GetLastError());
     CloseHandle(pi.hThread);
     return pi.hProcess;
 }
@@ -1340,30 +1340,30 @@ static void local_server_proc(void)
 
     hr = CoRegisterClassObject(&CLSID_test1, (IUnknown *)&test_cf,
         CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &obj_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
         &aProxyFileList, &CLSID_test_ps, &gPFactory);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
         CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     SetEvent(ready_event);
 
     hr = CoWaitForMultipleHandles(0, 1000, 1, &stop_event, &index);
-    ok(hr == S_OK, "got %#x\n", hr);
-    ok(!index, "got %u\n", index);
+    ok(hr == S_OK, "got %#lx\n", hr);
+    ok(!index, "got %lu\n", index);
 
     hr = CoRevokeClassObject(ps_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoRevokeClassObject(obj_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     CoUninitialize();
     ExitProcess(0);
@@ -1387,23 +1387,23 @@ static void test_delegated_methods(void)
 
     hr = NdrDllGetClassObject(&CLSID_test_ps, &IID_IPSFactoryBuffer, (void **)&ps,
         &aProxyFileList, &CLSID_test_ps, &gPFactory);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoRegisterClassObject(&CLSID_test_ps, (IUnknown *)ps,
         CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &ps_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoRegisterPSClsid(&IID_ITest1, &CLSID_test_ps);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     hr = CoCreateInstance(&CLSID_test1, NULL, CLSCTX_LOCAL_SERVER, &IID_ITest1, (void **)&test_obj);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 
     ret = ITest1_square(test_obj, 3);
     ok(ret == 9, "got %d\n", ret);
 
     hr = ITest1_GetClassID(test_obj, &clsid);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &CLSID_test1), "got %s\n", wine_dbgstr_guid(&clsid));
 
     ITest1_Release(test_obj);
@@ -1412,7 +1412,7 @@ static void test_delegated_methods(void)
     ok(!WaitForSingleObject(process, 1000), "wait failed\n");
 
     hr = CoRevokeClassObject(ps_cookie);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 }
 
 START_TEST( cstub )
diff --git a/dlls/rpcrt4/tests/ndr_marshall.c b/dlls/rpcrt4/tests/ndr_marshall.c
index 12240e30928..5d72f5efc61 100644
--- a/dlls/rpcrt4/tests/ndr_marshall.c
+++ b/dlls/rpcrt4/tests/ndr_marshall.c
@@ -157,17 +157,17 @@ static void test_ndr_simple_type(void)
     l = 0xcafebabe;
     NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, FC_LONG);
     ok(StubMsg.Buffer == StubMsg.BufferStart + 4, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart);
-    ok(*(LONG*)StubMsg.BufferStart == l, "%d\n", *(LONG*)StubMsg.BufferStart);
+    ok(*(LONG*)StubMsg.BufferStart == l, "%ld\n", *(LONG*)StubMsg.BufferStart);
 
     StubMsg.Buffer = StubMsg.BufferStart + 1;
     NdrSimpleTypeMarshall(&StubMsg, (unsigned char*)&l, FC_LONG);
     ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart);
-    ok(*(LONG*)(StubMsg.BufferStart + 4) == l, "%d\n", *(LONG*)StubMsg.BufferStart);
+    ok(*(LONG*)(StubMsg.BufferStart + 4) == l, "%ld\n", *(LONG*)StubMsg.BufferStart);
 
     StubMsg.Buffer = StubMsg.BufferStart + 1;
     NdrSimpleTypeUnmarshall(&StubMsg, (unsigned char*)&l2, FC_LONG);
     ok(StubMsg.Buffer == StubMsg.BufferStart + 8, "%p %p\n", StubMsg.Buffer, StubMsg.BufferStart);
-    ok(l2 == l, "%d\n", l2);
+    ok(l2 == l, "%ld\n", l2);
 
     HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart);
 }
@@ -203,7 +203,7 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     NdrPointerBufferSize( &StubMsg,
                           memsrc,
                           formattypes );
-    ok(StubMsg.BufferLength >= wiredatalen, "%s: length %d\n", msgpfx, StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= wiredatalen, "%s: length %ld\n", msgpfx, StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -220,7 +220,7 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     }
     else
     {
-        ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+        ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
         ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled\n", msgpfx);
     }
 
@@ -228,32 +228,32 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     StubMsg.MemorySize = 0;
 
     size = NdrPointerMemorySize( &StubMsg, formattypes );
-    ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(size == StubMsg.MemorySize, "%s: mem size %lu size %lu\n", msgpfx, StubMsg.MemorySize, size);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
     if (formattypes[1] & FC_POINTER_DEREF)
-        ok(size == srcsize + sizeof(void *), "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize + sizeof(void *), "%s: mem size %lu\n", msgpfx, size);
     else
-        ok(size == srcsize, "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize, "%s: mem size %lu\n", msgpfx, size);
 
     StubMsg.Buffer = StubMsg.BufferStart;
     StubMsg.MemorySize = 16;
     size = NdrPointerMemorySize( &StubMsg, formattypes );
-    ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(size == StubMsg.MemorySize, "%s: mem size %lu size %lu\n", msgpfx, StubMsg.MemorySize, size);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
     if (formattypes[1] & FC_POINTER_DEREF)
-        ok(size == srcsize + sizeof(void *) + 16, "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize + sizeof(void *) + 16, "%s: mem size %lu\n", msgpfx, size);
     else
-        ok(size == srcsize + 16, "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize + 16, "%s: mem size %lu\n", msgpfx, size);
 
     StubMsg.Buffer = StubMsg.BufferStart;
     StubMsg.MemorySize = 1;
     size = NdrPointerMemorySize( &StubMsg, formattypes );
-    ok(size == StubMsg.MemorySize, "%s: mem size %u size %u\n", msgpfx, StubMsg.MemorySize, size);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(size == StubMsg.MemorySize, "%s: mem size %lu size %lu\n", msgpfx, StubMsg.MemorySize, size);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
     if (formattypes[1] & FC_POINTER_DEREF)
-        ok(size == srcsize + sizeof(void *) + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize + sizeof(void *) + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %lu\n", msgpfx, size);
     else
-        ok(size == srcsize + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %u\n", msgpfx, size);
+        ok(size == srcsize + (srcsize == 8 ? 8 : sizeof(void *)), "%s: mem size %lu\n", msgpfx, size);
 
     size = srcsize;
     if (formattypes[1] & FC_POINTER_DEREF) size += 4;
@@ -270,8 +270,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
     ok(mem == mem_orig, "%s: mem has changed %p %p\n", msgpfx, mem, mem_orig);
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
     /* On Windows 7+ unmarshalling may involve calls to NdrFree, for unclear reasons. */
     my_free_called = 0;
@@ -297,8 +297,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     /* doesn't allocate mem in this case */
     ok(mem == mem_orig, "%s: mem has changed %p %p\n", msgpfx, mem, mem_orig);
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); 
     ok(!my_free_called, "%s: my_free got called %d times\n", msgpfx, my_free_called);
 
@@ -322,8 +322,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
         ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
         ok(mem != StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem points to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
         ok(!cmp(mem, memsrc, size), "%s: incorrectly unmarshaled\n", msgpfx);
-        ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-        ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+        ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+        ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
         ok(my_alloc_called == num_additional_allocs + 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called); 
         my_alloc_called = 0;
         NdrPointerFree(&StubMsg, mem, formattypes);
@@ -341,8 +341,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
             else
                 ok(mem == StubMsg.BufferStart + wiredatalen - srcsize, "%s: mem doesn't point to buffer %p %p\n", msgpfx, mem, StubMsg.BufferStart);
             ok(!cmp(mem, memsrc, size), "%s: incorrectly unmarshaled\n", msgpfx);
-            ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-            ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+            ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+            ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
             if (formattypes[2] != FC_ENUM16)
             {
                 ok(my_alloc_called == num_additional_allocs, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
@@ -363,8 +363,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
     ok(!!mem, "%s: mem was not allocated\n", msgpfx);
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     if (formattypes[2] == FC_ENUM16)
         ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
     else
@@ -395,8 +395,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
     ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
     ok(!!mem, "%s: mem was not allocated\n", msgpfx);
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     if (formattypes[2] == FC_ENUM16)
         ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
     else
@@ -433,8 +433,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
         HeapFree(GetProcessHeap(), 0, mem_orig);
     }
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     if (formattypes[2] == FC_ENUM16)
         ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
     else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF))
@@ -470,8 +470,8 @@ static void test_pointer_marshal(const unsigned char *formattypes,
         HeapFree(GetProcessHeap(), 0, mem_orig);
     }
     ok(!cmp(mem, memsrc, srcsize), "%s: incorrectly unmarshaled\n", msgpfx);
-    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %d\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
-    ok(StubMsg.MemorySize == 0, "%s: memorysize %d\n", msgpfx, StubMsg.MemorySize);
+    ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p len %ld\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart, wiredatalen);
+    ok(StubMsg.MemorySize == 0, "%s: memorysize %ld\n", msgpfx, StubMsg.MemorySize);
     if (formattypes[2] == FC_ENUM16)
         ok(my_alloc_called == 1, "%s: my_alloc got called %d times\n", msgpfx, my_alloc_called);
     else if ((formattypes[1] & FC_ALLOCED_ON_STACK) && (formattypes[1] & FC_POINTER_DEREF))
@@ -753,7 +753,7 @@ static void test_nontrivial_pointer_types(void)
                           &fmtstr_ref_unique_out[4] );
 
     /* Windows overestimates the buffer size */
-    ok(StubMsg.BufferLength >= 5, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= 5, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -762,7 +762,7 @@ static void test_nontrivial_pointer_types(void)
     ptr = NdrPointerMarshall( &StubMsg, (unsigned char *)p1, &fmtstr_ref_unique_out[4] );
     ok(ptr == NULL, "ret %p\n", ptr);
     size = StubMsg.Buffer - StubMsg.BufferStart;
-    ok(size == 5, "Buffer %p Start %p len %d\n", StubMsg.Buffer, StubMsg.BufferStart, size);
+    ok(size == 5, "Buffer %p Start %p len %ld\n", StubMsg.Buffer, StubMsg.BufferStart, size);
     ok(*(unsigned int *)StubMsg.BufferStart != 0, "pointer ID marshalled incorrectly\n");
     ok(*(unsigned char *)(StubMsg.BufferStart + 4) == 0x22, "char data marshalled incorrectly: 0x%x\n",
        *(unsigned char *)(StubMsg.BufferStart + 4));
@@ -893,25 +893,25 @@ static void test_simple_struct_marshal(const unsigned char *formattypes,
 
     StubMsg.BufferLength = 0;
     NdrSimpleStructBufferSize( &StubMsg, memsrc, formattypes );
-    ok(StubMsg.BufferLength >= wiredatalen, "%s: length %d\n", msgpfx, StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= wiredatalen, "%s: length %ld\n", msgpfx, StubMsg.BufferLength);
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
     StubMsg.BufferEnd = StubMsg.BufferStart + StubMsg.BufferLength;
     ptr = NdrSimpleStructMarshall( &StubMsg,  memsrc, formattypes );
     ok(ptr == NULL, "%s: ret %p\n", msgpfx, ptr);
     ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
-    ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled %08x %08x %08x\n", msgpfx, *(DWORD*)StubMsg.BufferStart,*((DWORD*)StubMsg.BufferStart+1),*((DWORD*)StubMsg.BufferStart+2));
+    ok(!memcmp(StubMsg.BufferStart, wiredata, wiredatalen), "%s: incorrectly marshaled %08lx %08lx %08lx\n", msgpfx, *(DWORD*)StubMsg.BufferStart,*((DWORD*)StubMsg.BufferStart+1),*((DWORD*)StubMsg.BufferStart+2));
 
     StubMsg.Buffer = StubMsg.BufferStart;
     StubMsg.MemorySize = 0;
     size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
     ok(size == StubMsg.MemorySize, "%s: size != MemorySize\n", msgpfx);
-    ok(size == srcsize, "%s: mem size %u\n", msgpfx, size);
+    ok(size == srcsize, "%s: mem size %lu\n", msgpfx, size);
     ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
 
     StubMsg.Buffer = StubMsg.BufferStart;
     size = NdrSimpleStructMemorySize( &StubMsg, formattypes );
     ok(size == StubMsg.MemorySize, "%s: size != MemorySize\n", msgpfx);
-    ok(StubMsg.MemorySize == ((srcsize + 3) & ~3) + srcsize, "%s: mem size %u\n", msgpfx, size);
+    ok(StubMsg.MemorySize == ((srcsize + 3) & ~3) + srcsize, "%s: mem size %lu\n", msgpfx, size);
     ok(StubMsg.Buffer - StubMsg.BufferStart == wiredatalen, "%s: Buffer %p Start %p\n", msgpfx, StubMsg.Buffer, StubMsg.BufferStart);
     size = srcsize;
     /*** Unmarshalling first with must_alloc false ***/
@@ -1370,12 +1370,12 @@ static void test_iface_ptr(void)
     IPersist_AddRef(&server_obj.IPersist_iface);
     ptr = NdrInterfacePointerMarshall(&StubMsg, (unsigned char *)&server_obj.IPersist_iface, fmtstr_ip);
     ok(!ptr, "ret %p\n", ptr);
-    ok(server_obj.ref > 2, "got %d references\n", server_obj.ref);
+    ok(server_obj.ref > 2, "got %ld references\n", server_obj.ref);
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
 
     NdrInterfacePointerFree(&StubMsg, (unsigned char *)&server_obj.IPersist_iface, fmtstr_ip);
-    ok(server_obj.ref > 1, "got %d references\n", server_obj.ref);
+    ok(server_obj.ref > 1, "got %ld references\n", server_obj.ref);
 
     StubMsg.IsClient = 1;
     my_alloc_called = my_free_called = 0;
@@ -1386,15 +1386,15 @@ static void test_iface_ptr(void)
     ok(!!proxy, "mem not alloced\n");
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
-    ok(server_obj.ref > 1, "got %d references\n", server_obj.ref);
+    ok(server_obj.ref > 1, "got %ld references\n", server_obj.ref);
 
     hr = IPersist_GetClassID(proxy, &clsid);
-    ok(hr == S_OK, "got hr %#x\n", hr);
+    ok(hr == S_OK, "got hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &IID_IPersist), "wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     ref = IPersist_Release(proxy);
-    ok(ref == 1, "got %d references\n", ref);
-    ok(server_obj.ref == 1, "got %d references\n", server_obj.ref);
+    ok(ref == 1, "got %ld references\n", ref);
+    ok(server_obj.ref == 1, "got %ld references\n", server_obj.ref);
 
     /* An existing interface pointer is released; this is necessary so that an
      * [in, out] pointer which changes does not leak references. */
@@ -1405,12 +1405,12 @@ static void test_iface_ptr(void)
     IPersist_AddRef(&server_obj.IPersist_iface);
     ptr = NdrInterfacePointerMarshall(&StubMsg, (unsigned char *)&server_obj.IPersist_iface, fmtstr_ip);
     ok(!ptr, "ret %p\n", ptr);
-    ok(server_obj.ref > 2, "got %d references\n", server_obj.ref);
+    ok(server_obj.ref > 2, "got %ld references\n", server_obj.ref);
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
 
     NdrInterfacePointerFree(&StubMsg, (unsigned char *)&server_obj.IPersist_iface, fmtstr_ip);
-    ok(server_obj.ref > 1, "got %d references\n", server_obj.ref);
+    ok(server_obj.ref > 1, "got %ld references\n", server_obj.ref);
 
     StubMsg.IsClient = 1;
     my_alloc_called = my_free_called = 0;
@@ -1422,16 +1422,16 @@ static void test_iface_ptr(void)
     ok(!!proxy && proxy != &client_obj.IPersist_iface, "mem not alloced\n");
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
-    ok(server_obj.ref > 1, "got %d references\n", server_obj.ref);
-    ok(client_obj.ref == 1, "got %d references\n", client_obj.ref);
+    ok(server_obj.ref > 1, "got %ld references\n", server_obj.ref);
+    ok(client_obj.ref == 1, "got %ld references\n", client_obj.ref);
 
     hr = IPersist_GetClassID(proxy, &clsid);
-    ok(hr == S_OK, "got hr %#x\n", hr);
+    ok(hr == S_OK, "got hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &IID_IPersist), "wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     ref = IPersist_Release(proxy);
-    ok(ref == 1, "got %d references\n", ref);
-    ok(server_obj.ref == 1, "got %d references\n", server_obj.ref);
+    ok(ref == 1, "got %ld references\n", ref);
+    ok(server_obj.ref == 1, "got %ld references\n", server_obj.ref);
 
     /* client -> server */
 
@@ -1441,7 +1441,7 @@ static void test_iface_ptr(void)
     IPersist_AddRef(&client_obj.IPersist_iface);
     ptr = NdrInterfacePointerMarshall(&StubMsg, (unsigned char *)&client_obj.IPersist_iface, fmtstr_ip);
     ok(!ptr, "ret %p\n", ptr);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
 
@@ -1454,18 +1454,18 @@ static void test_iface_ptr(void)
     ok(!!proxy, "mem not alloced\n");
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
 
     hr = IPersist_GetClassID(proxy, &clsid);
-    ok(hr == S_OK, "got hr %#x\n", hr);
+    ok(hr == S_OK, "got hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &IID_IPersist), "wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     ref = IPersist_Release(proxy);
-    ok(client_obj.ref > 1, "got %d references\n", client_obj.ref);
-    ok(ref == client_obj.ref, "expected %d references, got %d\n", client_obj.ref, ref);
+    ok(client_obj.ref > 1, "got %ld references\n", client_obj.ref);
+    ok(ref == client_obj.ref, "expected %ld references, got %ld\n", client_obj.ref, ref);
 
     NdrInterfacePointerFree(&StubMsg, (unsigned char *)proxy, fmtstr_ip);
-    ok(client_obj.ref == 1, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref == 1, "got %ld references\n", client_obj.ref);
 
     /* same, but free the interface after calling NdrInterfacePointerFree */
 
@@ -1475,7 +1475,7 @@ static void test_iface_ptr(void)
     IPersist_AddRef(&client_obj.IPersist_iface);
     ptr = NdrInterfacePointerMarshall(&StubMsg, (unsigned char *)&client_obj.IPersist_iface, fmtstr_ip);
     ok(!ptr, "ret %p\n", ptr);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
 
@@ -1488,18 +1488,18 @@ static void test_iface_ptr(void)
     ok(!!proxy, "mem not alloced\n");
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
 
     NdrInterfacePointerFree(&StubMsg, (unsigned char *)proxy, fmtstr_ip);
-    ok(client_obj.ref > 1, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 1, "got %ld references\n", client_obj.ref);
 
     hr = IPersist_GetClassID(proxy, &clsid);
-    ok(hr == S_OK, "got hr %#x\n", hr);
+    ok(hr == S_OK, "got hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &IID_IPersist), "wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     ref = IPersist_Release(proxy);
-    ok(ref == 1, "got %d references\n", ref);
-    ok(client_obj.ref == 1, "got %d references\n", client_obj.ref);
+    ok(ref == 1, "got %ld references\n", ref);
+    ok(client_obj.ref == 1, "got %ld references\n", client_obj.ref);
 
     /* An existing interface pointer is *not* released (in fact, it is ignored
      * and may be invalid). In practice it will always be NULL anyway. */
@@ -1510,7 +1510,7 @@ static void test_iface_ptr(void)
     IPersist_AddRef(&client_obj.IPersist_iface);
     ptr = NdrInterfacePointerMarshall(&StubMsg, (unsigned char *)&client_obj.IPersist_iface, fmtstr_ip);
     ok(!ptr, "ret %p\n", ptr);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
 
@@ -1524,20 +1524,20 @@ static void test_iface_ptr(void)
     ok(!!proxy && proxy != &server_obj.IPersist_iface, "mem not alloced\n");
     ok(!my_alloc_called, "alloc called %d\n", my_alloc_called);
     ok(!my_free_called, "free called %d\n", my_free_called);
-    ok(client_obj.ref > 2, "got %d references\n", client_obj.ref);
-    ok(server_obj.ref == 2, "got %d references\n", server_obj.ref);
+    ok(client_obj.ref > 2, "got %ld references\n", client_obj.ref);
+    ok(server_obj.ref == 2, "got %ld references\n", server_obj.ref);
     IPersist_Release(&server_obj.IPersist_iface);
 
     hr = IPersist_GetClassID(proxy, &clsid);
-    ok(hr == S_OK, "got hr %#x\n", hr);
+    ok(hr == S_OK, "got hr %#lx\n", hr);
     ok(IsEqualGUID(&clsid, &IID_IPersist), "wrong clsid %s\n", wine_dbgstr_guid(&clsid));
 
     ref = IPersist_Release(proxy);
-    ok(client_obj.ref > 1, "got %d references\n", client_obj.ref);
-    ok(ref == client_obj.ref, "expected %d references, got %d\n", client_obj.ref, ref);
+    ok(client_obj.ref > 1, "got %ld references\n", client_obj.ref);
+    ok(ref == client_obj.ref, "expected %ld references, got %ld\n", client_obj.ref, ref);
 
     NdrInterfacePointerFree(&StubMsg, (unsigned char *)proxy, fmtstr_ip);
-    ok(client_obj.ref == 1, "got %d references\n", client_obj.ref);
+    ok(client_obj.ref == 1, "got %ld references\n", client_obj.ref);
 
     HeapFree(GetProcessHeap(), 0, StubMsg.BufferStart);
 
@@ -1557,23 +1557,23 @@ static void test_fullpointer_xlat(void)
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 1, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x1, "RefId should be 0x1 instead of 0x%x\n", RefId);
+    ok(RefId == 0x1, "RefId should be 0x1 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x1, "RefId should be 0x1 instead of 0x%x\n", RefId);
+    ok(RefId == 0x1, "RefId should be 0x1 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebabe, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x2, "RefId should be 0x2 instead of 0x%x\n", RefId);
+    ok(RefId == 0x2, "RefId should be 0x2 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, NULL, 0, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0, "RefId should be 0 instead of 0x%x\n", RefId);
+    ok(RefId == 0, "RefId should be 0 instead of 0x%lx\n", RefId);
 
     /* "unmarshaling" phase */
 
@@ -1618,23 +1618,23 @@ static void test_fullpointer_xlat(void)
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 1, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 1, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebabe, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x2, "RefId should be 0x2 instead of 0x%x\n", RefId);
+    ok(RefId == 0x2, "RefId should be 0x2 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 0, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%x\n", RefId);
+    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
 
     /* "freeing" phase */
 
@@ -1643,11 +1643,11 @@ static void test_fullpointer_xlat(void)
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 0x20, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xcafebeef, 1, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%x\n", RefId);
+    ok(RefId == 0x3, "RefId should be 0x3 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerFree(pXlatTables, (void *)0xcafebabe);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
@@ -1657,15 +1657,15 @@ static void test_fullpointer_xlat(void)
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 0x20, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%x\n", RefId);
+    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 1, &RefId);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
-    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%x\n", RefId);
+    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerQueryPointer(pXlatTables, (void *)0xdeadbeef, 1, &RefId);
     ok(ret == 1, "ret should be 1 instead of 0x%x\n", ret);
-    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%x\n", RefId);
+    ok(RefId == 0x4, "RefId should be 0x4 instead of 0x%lx\n", RefId);
 
     ret = NdrFullPointerFree(pXlatTables, (void *)0xdeadbeef);
     ok(ret == 0, "ret should be 0 instead of 0x%x\n", ret);
@@ -1682,8 +1682,8 @@ static void test_common_stub_data( const char *prefix, const MIDL_STUB_MESSAGE *
 
 #define TEST_ZERO(field, fmt) ok(stubMsg->field == 0, "%s: " #field " should have been set to zero instead of " fmt "\n", prefix, stubMsg->field)
 #define TEST_POINTER_UNSET(field) ok(stubMsg->field == unset_ptr, "%s: " #field " should have been unset instead of %p\n", prefix, stubMsg->field)
-#define TEST_ULONG_UNSET(field) ok(stubMsg->field == 0xcccccccc, "%s: " #field " should have been unset instead of 0x%x\n", prefix, stubMsg->field)
-#define TEST_ULONG_PTR_UNSET(field) ok(stubMsg->field == (ULONG_PTR)unset_ptr, "%s: " #field " should have been unset instead of 0x%lx\n", prefix, stubMsg->field)
+#define TEST_ULONG_UNSET(field) ok(stubMsg->field == 0xcccccccc, "%s: " #field " should have been unset instead of 0x%lx\n", prefix, stubMsg->field)
+#define TEST_ULONG_PTR_UNSET(field) ok(stubMsg->field == (ULONG_PTR)unset_ptr, "%s: " #field " should have been unset instead of 0x%Ix\n", prefix, stubMsg->field)
 
     TEST_POINTER_UNSET(BufferMark);
     TEST_ULONG_UNSET(MemorySize);
@@ -1712,10 +1712,10 @@ static void test_common_stub_data( const char *prefix, const MIDL_STUB_MESSAGE *
     TEST_POINTER_UNSET(SavedHandle);
     ok(stubMsg->StubDesc == &Object_StubDesc, "%s: StubDesc should have been %p instead of %p\n",
        prefix, &Object_StubDesc, stubMsg->StubDesc);
-    TEST_ZERO(FullPtrRefId, "%d");
+    TEST_ZERO(FullPtrRefId, "%ld");
     ok( stubMsg->PointerLength == 0 ||
         broken(stubMsg->PointerLength == 1), /* win9x, nt4 */
-        "%s: pAsyncMsg should have been set to zero instead of %d\n", prefix, stubMsg->PointerLength );
+        "%s: pAsyncMsg should have been set to zero instead of %ld\n", prefix, stubMsg->PointerLength );
     TEST_ZERO(fInDontFree, "%d");
     TEST_ZERO(fDontCallFreeInst, "%d");
     ok( stubMsg->fHasReturn == 0 || broken(stubMsg->fHasReturn), /* win9x, nt4 */
@@ -1734,7 +1734,7 @@ static void test_common_stub_data( const char *prefix, const MIDL_STUB_MESSAGE *
     ok(stubMsg->fUnused2 == 0xffffcccc, "%s: fUnused2 should have been 0xffffcccc instead of 0x%x\n",
        prefix, stubMsg->fUnused2);
     ok(stubMsg->dwDestContext == MSHCTX_DIFFERENTMACHINE,
-       "%s: dwDestContext should have been MSHCTX_DIFFERENTMACHINE instead of %d\n",
+       "%s: dwDestContext should have been MSHCTX_DIFFERENTMACHINE instead of %ld\n",
        prefix, stubMsg->dwDestContext);
     TEST_ZERO(pvDestContext, "%p");
     TEST_POINTER_UNSET(SavedContextHandles);
@@ -1745,7 +1745,7 @@ static void test_common_stub_data( const char *prefix, const MIDL_STUB_MESSAGE *
     TEST_POINTER_UNSET(SizePtrOffsetArray);
     TEST_POINTER_UNSET(SizePtrLengthArray);
     TEST_POINTER_UNSET(pArgQueue);
-    TEST_ZERO(dwStubPhase, "%d");
+    TEST_ZERO(dwStubPhase, "%ld");
     /* FIXME: where does this value come from? */
     trace("%s: LowStackMark is %p\n", prefix, stubMsg->LowStackMark);
     ok( stubMsg->pAsyncMsg == 0 || broken(stubMsg->pAsyncMsg == unset_ptr), /* win9x, nt4 */
@@ -1759,7 +1759,7 @@ static void test_common_stub_data( const char *prefix, const MIDL_STUB_MESSAGE *
     TEST_POINTER_UNSET(pCSInfo);
     TEST_POINTER_UNSET(ConformanceMark);
     TEST_POINTER_UNSET(VarianceMark);
-    ok(stubMsg->Unused == (ULONG_PTR)unset_ptr, "%s: Unused should have be unset instead of 0x%lx\n",
+    ok(stubMsg->Unused == (ULONG_PTR)unset_ptr, "%s: Unused should have be unset instead of 0x%Ix\n",
        prefix, stubMsg->Unused);
     TEST_POINTER_UNSET(pContext);
     TEST_POINTER_UNSET(ContextHandleHash);
@@ -1801,7 +1801,7 @@ static void test_client_init(void)
     /* Note: ReservedForRuntime not tested */
     ok(rpcMsg.ManagerEpv == unset_ptr, "rpcMsg.ManagerEpv should have been unset instead of %p\n", rpcMsg.ManagerEpv);
     ok(rpcMsg.ImportContext == unset_ptr, "rpcMsg.ImportContext should have been unset instead of %p\n", rpcMsg.ImportContext);
-    ok(rpcMsg.RpcFlags == 0, "rpcMsg.RpcFlags should have been 0 instead of 0x%x\n", rpcMsg.RpcFlags);
+    ok(rpcMsg.RpcFlags == 0, "rpcMsg.RpcFlags should have been 0 instead of 0x%lx\n", rpcMsg.RpcFlags);
 
     ok(stubMsg.Buffer == unset_ptr, "stubMsg.Buffer should have been unset instead of %p\n",
        stubMsg.Buffer);
@@ -1809,7 +1809,7 @@ static void test_client_init(void)
        stubMsg.BufferStart);
     ok(stubMsg.BufferEnd == NULL, "stubMsg.BufferEnd should have been NULL instead of %p\n",
        stubMsg.BufferEnd);
-    ok(stubMsg.BufferLength == 0, "stubMsg.BufferLength should have been 0 instead of %u\n",
+    ok(stubMsg.BufferLength == 0, "stubMsg.BufferLength should have been 0 instead of %lu\n",
        stubMsg.BufferLength);
     ok(stubMsg.IsClient == 1, "stubMsg.IsClient should have been 1 instead of %u\n", stubMsg.IsClient);
     ok(stubMsg.ReuseBuffer == 0, "stubMsg.ReuseBuffer should have been 0 instead of %d\n",
@@ -1844,7 +1844,7 @@ static void test_server_init(void)
     ok(stubMsg.BufferStart == buffer, "stubMsg.BufferStart should have been %p instead of %p\n", buffer, stubMsg.BufferStart);
     ok(stubMsg.BufferEnd == buffer + sizeof(buffer), "stubMsg.BufferEnd should have been %p instead of %p\n", buffer + sizeof(buffer), stubMsg.BufferEnd);
     todo_wine
-    ok(stubMsg.BufferLength == 0, "stubMsg.BufferLength should have been 0 instead of %u\n", stubMsg.BufferLength);
+    ok(stubMsg.BufferLength == 0, "stubMsg.BufferLength should have been 0 instead of %lu\n", stubMsg.BufferLength);
     ok(stubMsg.IsClient == 0, "stubMsg.IsClient should have been 0 instead of %u\n", stubMsg.IsClient);
     ok(stubMsg.ReuseBuffer == 0 ||
        broken(stubMsg.ReuseBuffer == 1), /* win2k */
@@ -1885,17 +1885,17 @@ static void test_ndr_allocate(void)
         {
             trace("v2 mem list format\n");
             ok((char *)mem_list_v2 == (char *)p2 + 24, "expected mem_list_v2 pointer %p, but got %p\n", (char *)p2 + 24, mem_list_v2);
-            ok(mem_list_v2->magic == magic_MEML, "magic %08x\n", mem_list_v2->magic);
-            ok(mem_list_v2->size == 24, "wrong size for p2 %d\n", mem_list_v2->size);
-            ok(mem_list_v2->unknown == 0, "wrong unknown for p2 0x%x\n", mem_list_v2->unknown);
+            ok(mem_list_v2->magic == magic_MEML, "magic %08lx\n", mem_list_v2->magic);
+            ok(mem_list_v2->size == 24, "wrong size for p2 %ld\n", mem_list_v2->size);
+            ok(mem_list_v2->unknown == 0, "wrong unknown for p2 0x%lx\n", mem_list_v2->unknown);
             ok(mem_list_v2->next != NULL, "next NULL\n");
             mem_list_v2 = mem_list_v2->next;
             if(mem_list_v2)
             {
                 ok((char *)mem_list_v2 == (char *)p1 + 16, "expected mem_list_v2 pointer %p, but got %p\n", (char *)p1 + 16, mem_list_v2);
-                ok(mem_list_v2->magic == magic_MEML, "magic %08x\n", mem_list_v2->magic);
-                ok(mem_list_v2->size == 16, "wrong size for p1 %d\n", mem_list_v2->size);
-                ok(mem_list_v2->unknown == 0, "wrong unknown for p1 0x%x\n", mem_list_v2->unknown);
+                ok(mem_list_v2->magic == magic_MEML, "magic %08lx\n", mem_list_v2->magic);
+                ok(mem_list_v2->size == 16, "wrong size for p1 %ld\n", mem_list_v2->size);
+                ok(mem_list_v2->unknown == 0, "wrong unknown for p1 0x%lx\n", mem_list_v2->unknown);
                 ok(mem_list_v2->next == NULL, "next %p\n", mem_list_v2->next);
             }
         }
@@ -1944,7 +1944,7 @@ static void test_conformant_array(void)
     NdrConformantArrayBufferSize( &StubMsg,
                           memsrc,
                           fmtstr_conf_array );
-    ok(StubMsg.BufferLength >= 20, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= 20, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2055,7 +2055,7 @@ static void test_conformant_string(void)
     NdrPointerBufferSize( &StubMsg,
                           (unsigned char *)memsrc,
                           fmtstr_conf_str );
-    ok(StubMsg.BufferLength >= sizeof(memsrc) + 12, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= sizeof(memsrc) + 12, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2064,7 +2064,7 @@ static void test_conformant_string(void)
     ptr = NdrPointerMarshall( &StubMsg, (unsigned char *)memsrc, fmtstr_conf_str );
     ok(ptr == NULL, "ret %p\n", ptr);
     size = StubMsg.Buffer - StubMsg.BufferStart;
-    ok(size == sizeof(memsrc) + 12, "Buffer %p Start %p len %d\n",
+    ok(size == sizeof(memsrc) + 12, "Buffer %p Start %p len %ld\n",
        StubMsg.Buffer, StubMsg.BufferStart, size);
     ok(!memcmp(StubMsg.BufferStart + 12, memsrc, sizeof(memsrc)), "incorrectly marshaled\n");
 
@@ -2180,7 +2180,7 @@ static void test_nonconformant_string(void)
     StubMsg.BufferLength = 0;
 
     NdrNonConformantStringBufferSize( &StubMsg, memsrc, fmtstr_nonconf_str );
-    ok(StubMsg.BufferLength >= strlen((char *)memsrc) + 1 + 8, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= strlen((char *)memsrc) + 1 + 8, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2189,7 +2189,7 @@ static void test_nonconformant_string(void)
     ptr = NdrNonConformantStringMarshall( &StubMsg, memsrc, fmtstr_nonconf_str );
     ok(ptr == NULL, "ret %p\n", ptr);
     size = StubMsg.Buffer - StubMsg.BufferStart;
-    ok(size == strlen((char *)memsrc) + 1 + 8, "Buffer %p Start %p len %d\n",
+    ok(size == strlen((char *)memsrc) + 1 + 8, "Buffer %p Start %p len %ld\n",
        StubMsg.Buffer, StubMsg.BufferStart, size);
     ok(!memcmp(StubMsg.BufferStart + 8, memsrc, strlen((char *)memsrc) + 1), "incorrectly marshaled\n");
 
@@ -2253,7 +2253,7 @@ static void test_nonconformant_string(void)
     StubMsg.BufferLength = 0;
 
     NdrNonConformantStringBufferSize( &StubMsg, memsrc2, fmtstr_nonconf_str );
-    ok(StubMsg.BufferLength >= strlen((char *)memsrc2) + 1 + 8, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= strlen((char *)memsrc2) + 1 + 8, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2262,7 +2262,7 @@ static void test_nonconformant_string(void)
     ptr = NdrNonConformantStringMarshall( &StubMsg, memsrc2, fmtstr_nonconf_str );
     ok(ptr == NULL, "ret %p\n", ptr);
     size = StubMsg.Buffer - StubMsg.BufferStart;
-    ok(size == strlen((char *)memsrc2) + 1 + 8, "Buffer %p Start %p len %d\n",
+    ok(size == strlen((char *)memsrc2) + 1 + 8, "Buffer %p Start %p len %ld\n",
        StubMsg.Buffer, StubMsg.BufferStart, size);
     ok(!memcmp(StubMsg.BufferStart + 8, memsrc2, strlen((char *)memsrc2) + 1), "incorrectly marshaled\n");
 
@@ -2388,7 +2388,7 @@ static void test_conf_complex_struct(void)
     NdrComplexStructBufferSize( &StubMsg,
                                 (unsigned char *)memsrc,
                                 &fmtstr_complex_struct[30] );
-    ok(StubMsg.BufferLength >= 28, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= 28, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2527,7 +2527,7 @@ static void test_conf_complex_array(void)
 #endif
 
     expected_length = (4 + memsrc.dim1 * (2 + memsrc.dim2)) * 4;
-    ok(StubMsg.BufferLength >= expected_length, "length %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength >= expected_length, "length %ld\n", StubMsg.BufferLength);
 
     /*NdrGetBuffer(&_StubMsg, _StubMsg.BufferLength, NULL);*/
     StubMsg.RpcMsg->Buffer = StubMsg.BufferStart = StubMsg.Buffer = HeapAlloc(GetProcessHeap(), 0, StubMsg.BufferLength);
@@ -2546,13 +2546,13 @@ static void test_conf_complex_array(void)
 
     buf = (DWORD *)StubMsg.BufferStart;
 
-    ok(*buf == memsrc.dim1, "dim1 should have been %d instead of %08x\n", memsrc.dim1, *buf);
+    ok(*buf == memsrc.dim1, "dim1 should have been %d instead of %08lx\n", memsrc.dim1, *buf);
     buf++;
-    ok(*buf == memsrc.dim2, "dim2 should have been %d instead of %08x\n", memsrc.dim2, *buf);
+    ok(*buf == memsrc.dim2, "dim2 should have been %d instead of %08lx\n", memsrc.dim2, *buf);
     buf++;
     ok(*buf != 0, "pointer id should be non-zero\n");
     buf++;
-    ok(*buf == memsrc.dim1, "Conformance should have been %d instead of %08x\n", memsrc.dim1, *buf);
+    ok(*buf == memsrc.dim1, "Conformance should have been %d instead of %08lx\n", memsrc.dim1, *buf);
     buf++;
     for(i = 0; i < memsrc.dim1; i++)
     {
@@ -2561,11 +2561,11 @@ static void test_conf_complex_array(void)
     }
     for(i = 0; i < memsrc.dim1; i++)
     {
-        ok(*buf == memsrc.dim2, "Conformance should have been %d instead of %08x\n", memsrc.dim2, *buf);
+        ok(*buf == memsrc.dim2, "Conformance should have been %d instead of %08lx\n", memsrc.dim2, *buf);
         buf++;
         for(j = 0; j < memsrc.dim2; j++)
         {
-            ok(*buf == i * memsrc.dim2 + j, "got %08x\n", *buf);
+            ok(*buf == i * memsrc.dim2 + j, "got %08lx\n", *buf);
             buf++;
         }
     }
@@ -2585,7 +2585,7 @@ static void test_conf_complex_array(void)
     ok(ptr == NULL, "ret %p\n", ptr);
     ok(mem->dim1 == memsrc.dim1, "mem->dim1 wasn't unmarshalled correctly (%d)\n", mem->dim1);
     ok(mem->dim2 == memsrc.dim2, "mem->dim2 wasn't unmarshalled correctly (%d)\n", mem->dim2);
-    ok(mem->array[1][0] == memsrc.dim2, "mem->array[1][0] wasn't unmarshalled correctly (%d)\n", mem->array[1][0]);
+    ok(mem->array[1][0] == memsrc.dim2, "mem->array[1][0] wasn't unmarshalled correctly (%ld)\n", mem->array[1][0]);
 
     StubMsg.Buffer = StubMsg.BufferStart;
 #ifdef _WIN64
@@ -2618,11 +2618,11 @@ static void test_ndr_buffer(void)
     StubDesc.RpcInterfaceInformation = (void *)&IFoo___RpcServerInterface;
 
     status = RpcServerUseProtseqEpA(ncalrpc, 20, endpoint, NULL);
-    ok(RPC_S_OK == status, "RpcServerUseProtseqEp failed with status %u\n", status);
+    ok(RPC_S_OK == status, "RpcServerUseProtseqEp failed with status %lu\n", status);
     status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
-    ok(RPC_S_OK == status, "RpcServerRegisterIf failed with status %u\n", status);
+    ok(RPC_S_OK == status, "RpcServerRegisterIf failed with status %lu\n", status);
     status = RpcServerListen(1, 20, TRUE);
-    ok(RPC_S_OK == status, "RpcServerListen failed with status %u\n", status);
+    ok(RPC_S_OK == status, "RpcServerListen failed with status %lu\n", status);
     if (status != RPC_S_OK)
     {
         /* Failed to create a server, running client tests is useless */
@@ -2630,10 +2630,10 @@ static void test_ndr_buffer(void)
     }
 
     status = RpcStringBindingComposeA(NULL, ncalrpc, NULL, endpoint, NULL, &binding);
-    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%lu)\n", status);
 
     status = RpcBindingFromStringBindingA(binding, &Handle);
-    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n", status);
     RpcStringFreeA(&binding);
 
     NdrClientInitializeNew(&RpcMessage, &StubMsg, &StubDesc, 5);
@@ -2645,12 +2645,12 @@ static void test_ndr_buffer(void)
     ok(RpcMessage.BufferLength == 10 ||
        broken(RpcMessage.BufferLength == 12), /* win2k */
        "RpcMessage.BufferLength should have been 10 instead of %d\n", RpcMessage.BufferLength);
-    ok(RpcMessage.RpcFlags == 0, "RpcMessage.RpcFlags should have been 0x0 instead of 0x%x\n", RpcMessage.RpcFlags);
+    ok(RpcMessage.RpcFlags == 0, "RpcMessage.RpcFlags should have been 0x0 instead of 0x%lx\n", RpcMessage.RpcFlags);
     ok(StubMsg.Buffer != NULL, "Buffer should not have been NULL\n");
     ok(!StubMsg.BufferStart, "BufferStart should have been NULL instead of %p\n", StubMsg.BufferStart);
     ok(!StubMsg.BufferEnd, "BufferEnd should have been NULL instead of %p\n", StubMsg.BufferEnd);
     todo_wine
-    ok(StubMsg.BufferLength == 0, "BufferLength should have left as 0 instead of being set to %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength == 0, "BufferLength should have left as 0 instead of being set to %ld\n", StubMsg.BufferLength);
     old_buffer_valid_location = !StubMsg.fBufferValid;
     if (old_buffer_valid_location)
         ok(broken(StubMsg.CorrDespIncrement == TRUE), "fBufferValid should have been TRUE instead of 0x%x\n", StubMsg.CorrDespIncrement);
@@ -2662,9 +2662,9 @@ static void test_ndr_buffer(void)
     NdrFreeBuffer(&StubMsg);
     ok(RpcMessage.Handle != NULL, "RpcMessage.Handle should not have been NULL\n");
     ok(RpcMessage.Buffer != NULL, "RpcMessage.Buffer should not have been NULL\n");
-    ok(RpcMessage.BufferLength == prev_buffer_length, "RpcMessage.BufferLength should have been left as %d instead of %d\n", prev_buffer_length, RpcMessage.BufferLength);
+    ok(RpcMessage.BufferLength == prev_buffer_length, "RpcMessage.BufferLength should have been left as %ld instead of %d\n", prev_buffer_length, RpcMessage.BufferLength);
     ok(StubMsg.Buffer != NULL, "Buffer should not have been NULL\n");
-    ok(StubMsg.BufferLength == 1, "BufferLength should have left as 1 instead of being set to %d\n", StubMsg.BufferLength);
+    ok(StubMsg.BufferLength == 1, "BufferLength should have left as 1 instead of being set to %ld\n", StubMsg.BufferLength);
     if (old_buffer_valid_location)
         ok(broken(StubMsg.CorrDespIncrement == FALSE), "fBufferValid should have been FALSE instead of 0x%x\n", StubMsg.CorrDespIncrement);
     else
@@ -2676,7 +2676,7 @@ static void test_ndr_buffer(void)
     RpcBindingFree(&Handle);
 
     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
-    ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%lu)\n", status);
 }
 
 static void test_NdrMapCommAndFaultStatus(void)
@@ -2695,7 +2695,7 @@ static void test_NdrMapCommAndFaultStatus(void)
         ULONG expected_comm_status = 0;
         ULONG expected_fault_status = 0;
         status = NdrMapCommAndFaultStatus(&StubMsg, &comm_status, &fault_status, rpc_status);
-        ok(status == RPC_S_OK, "NdrMapCommAndFaultStatus failed with error %d\n", status);
+        ok(status == RPC_S_OK, "NdrMapCommAndFaultStatus failed with error %ld\n", status);
         switch (rpc_status)
         {
         case ERROR_INVALID_HANDLE:
@@ -2715,9 +2715,9 @@ static void test_NdrMapCommAndFaultStatus(void)
         default:
             expected_fault_status = rpc_status;
         }
-        ok(comm_status == expected_comm_status, "NdrMapCommAndFaultStatus should have mapped %d to comm status %d instead of %d\n",
+        ok(comm_status == expected_comm_status, "NdrMapCommAndFaultStatus should have mapped %ld to comm status %ld instead of %ld\n",
             rpc_status, expected_comm_status, comm_status);
-        ok(fault_status == expected_fault_status, "NdrMapCommAndFaultStatus should have mapped %d to fault status %d instead of %d\n",
+        ok(fault_status == expected_fault_status, "NdrMapCommAndFaultStatus should have mapped %ld to fault status %ld instead of %ld\n",
             rpc_status, expected_fault_status, fault_status);
     }
 }
@@ -2759,15 +2759,15 @@ static void test_NdrGetUserMarshalInfo(void)
     memset(&umi, 0xaa, sizeof(umi));
 
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
     ok( umi.InformationLevel == 1,
-       "umi.InformationLevel was %u instead of 1\n",
+       "umi.InformationLevel was %lu instead of 1\n",
         umi.InformationLevel);
     ok( U1(umi).Level1.Buffer == buffer + 15,
        "umi.Level1.Buffer was %p instead of %p\n",
         U1(umi).Level1.Buffer, buffer);
     ok( U1(umi).Level1.BufferSize == 1,
-       "umi.Level1.BufferSize was %u instead of 1\n",
+       "umi.Level1.BufferSize was %lu instead of 1\n",
         U1(umi).Level1.BufferSize);
     ok( U1(umi).Level1.pfnAllocate == my_alloc,
        "umi.Level1.pfnAllocate was %p instead of %p\n",
@@ -2793,15 +2793,15 @@ static void test_NdrGetUserMarshalInfo(void)
     memset(&umi, 0xaa, sizeof(umi));
 
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
     ok( umi.InformationLevel == 1,
-       "umi.InformationLevel was %u instead of 1\n",
+       "umi.InformationLevel was %lu instead of 1\n",
         umi.InformationLevel);
     ok( U1(umi).Level1.Buffer == NULL,
        "umi.Level1.Buffer was %p instead of NULL\n",
         U1(umi).Level1.Buffer);
     ok( U1(umi).Level1.BufferSize == 0,
-       "umi.Level1.BufferSize was %u instead of 0\n",
+       "umi.Level1.BufferSize was %lu instead of 0\n",
         U1(umi).Level1.BufferSize);
     ok( U1(umi).Level1.pfnAllocate == my_alloc,
        "umi.Level1.pfnAllocate was %p instead of %p\n",
@@ -2827,15 +2827,15 @@ static void test_NdrGetUserMarshalInfo(void)
     memset(&umi, 0xaa, sizeof(umi));
 
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
     ok( umi.InformationLevel == 1,
-       "umi.InformationLevel was %u instead of 1\n",
+       "umi.InformationLevel was %lu instead of 1\n",
         umi.InformationLevel);
     ok( U1(umi).Level1.Buffer == buffer + 15,
        "umi.Level1.Buffer was %p instead of %p\n",
         U1(umi).Level1.Buffer, buffer);
     ok( U1(umi).Level1.BufferSize == 1,
-       "umi.Level1.BufferSize was %u instead of 1\n",
+       "umi.Level1.BufferSize was %lu instead of 1\n",
         U1(umi).Level1.BufferSize);
     ok( U1(umi).Level1.pfnAllocate == my_alloc,
        "umi.Level1.pfnAllocate was %p instead of %p\n",
@@ -2861,15 +2861,15 @@ static void test_NdrGetUserMarshalInfo(void)
     memset(&umi, 0xaa, sizeof(umi));
 
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
     ok( umi.InformationLevel == 1,
-       "umi.InformationLevel was %u instead of 1\n",
+       "umi.InformationLevel was %lu instead of 1\n",
         umi.InformationLevel);
     ok( U1(umi).Level1.Buffer == NULL,
        "umi.Level1.Buffer was %p instead of NULL\n",
         U1(umi).Level1.Buffer);
     ok( U1(umi).Level1.BufferSize == 0,
-       "umi.Level1.BufferSize was %u instead of 0\n",
+       "umi.Level1.BufferSize was %lu instead of 0\n",
         U1(umi).Level1.BufferSize);
     ok( U1(umi).Level1.pfnAllocate == my_alloc,
        "umi.Level1.pfnAllocate was %p instead of %p\n",
@@ -2893,9 +2893,9 @@ static void test_NdrGetUserMarshalInfo(void)
     umcb.CBType = USER_MARSHAL_CB_MARSHALL;
 
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
     ok( U1(umi).Level1.BufferSize == 0,
-       "umi.Level1.BufferSize was %u instead of 0\n",
+       "umi.Level1.BufferSize was %lu instead of 0\n",
         U1(umi).Level1.BufferSize);
 
     /* error conditions */
@@ -2903,22 +2903,22 @@ static void test_NdrGetUserMarshalInfo(void)
     rpc_msg.BufferLength = 14;
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
     ok(status == ERROR_INVALID_USER_BUFFER,
-        "NdrGetUserMarshalInfo should have failed with ERROR_INVALID_USER_BUFFER instead of %d\n", status);
+        "NdrGetUserMarshalInfo should have failed with ERROR_INVALID_USER_BUFFER instead of %ld\n", status);
 
     rpc_msg.BufferLength = 15;
     status = NdrGetUserMarshalInfo(&umcb.Flags, 9999, &umi);
     ok(status == RPC_S_INVALID_ARG,
-        "NdrGetUserMarshalInfo should have failed with RPC_S_INVALID_ARG instead of %d\n", status);
+        "NdrGetUserMarshalInfo should have failed with RPC_S_INVALID_ARG instead of %ld\n", status);
 
     umcb.CBType = 9999;
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
-    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %d\n", status);
+    ok(status == RPC_S_OK, "NdrGetUserMarshalInfo failed with error %ld\n", status);
 
     umcb.CBType = USER_MARSHAL_CB_MARSHALL;
     umcb.Signature = 0;
     status = NdrGetUserMarshalInfo(&umcb.Flags, 1, &umi);
     ok(status == RPC_S_INVALID_ARG,
-        "NdrGetUserMarshalInfo should have failed with RPC_S_INVALID_ARG instead of %d\n", status);
+        "NdrGetUserMarshalInfo should have failed with RPC_S_INVALID_ARG instead of %ld\n", status);
 }
 
 static void test_MesEncodeFixedBufferHandleCreate(void)
@@ -2929,54 +2929,54 @@ static void test_MesEncodeFixedBufferHandleCreate(void)
     char *buffer;
 
     status = MesEncodeFixedBufferHandleCreate(NULL, 0, NULL, NULL);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesEncodeFixedBufferHandleCreate(NULL, 0, NULL, &handle);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesEncodeFixedBufferHandleCreate((char*)0xdeadbeef, 0, NULL, &handle);
-    ok(status == RPC_X_INVALID_BUFFER, "got %d\n", status);
+    ok(status == RPC_X_INVALID_BUFFER, "got %ld\n", status);
 
     buffer = (void*)((0xdeadbeef + 7) & ~7);
     status = MesEncodeFixedBufferHandleCreate(buffer, 0, NULL, &handle);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesEncodeFixedBufferHandleCreate(buffer, 0, &encoded_size, &handle);
     todo_wine
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 if (status == RPC_S_OK) {
     MesHandleFree(handle);
 }
     status = MesEncodeFixedBufferHandleCreate(buffer, 32, NULL, &handle);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesEncodeFixedBufferHandleCreate(buffer, 32, &encoded_size, &handle);
-    ok(status == RPC_S_OK, "got %d\n", status);
+    ok(status == RPC_S_OK, "got %ld\n", status);
 
     status = MesBufferHandleReset(NULL, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
         &buffer, 32, &encoded_size);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     /* convert to dynamic buffer handle */
     status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
         &buffer, 32, &encoded_size);
-    ok(status == RPC_S_OK, "got %d\n", status);
+    ok(status == RPC_S_OK, "got %ld\n", status);
 
     status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
         NULL, 32, &encoded_size);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
         &buffer, 32, NULL);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     /* invalid handle type */
     status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE+1, MES_ENCODE,
         &buffer, 32, &encoded_size);
-    ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
+    ok(status == RPC_S_INVALID_ARG, "got %ld\n", status);
 
     status = MesHandleFree(handle);
-    ok(status == RPC_S_OK, "got %d\n", status);
+    ok(status == RPC_S_OK, "got %ld\n", status);
 }
 
 static void test_NdrCorrelationInitialize(void)
diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
index 413a715e16d..a4653fd603f 100644
--- a/dlls/rpcrt4/tests/rpc.c
+++ b/dlls/rpcrt4/tests/rpc.c
@@ -242,48 +242,48 @@ static void test_rpc_ncacn_ip_tcp(void)
 
     status = RpcMgmtStopServerListening(NULL);
     ok(status == RPC_S_NOT_LISTENING,
-       "wrong RpcMgmtStopServerListening error (%u)\n", status);
+       "wrong RpcMgmtStopServerListening error (%lu)\n", status);
 
     status = RpcMgmtWaitServerListen();
     ok(status == RPC_S_NOT_LISTENING,
-       "wrong RpcMgmtWaitServerListen error status (%u)\n", status);
+       "wrong RpcMgmtWaitServerListen error status (%lu)\n", status);
 
     status = RpcServerListen(1, 20, FALSE);
     ok(status == RPC_S_NO_PROTSEQS_REGISTERED,
-       "wrong RpcServerListen error (%u)\n", status);
+       "wrong RpcServerListen error (%lu)\n", status);
 
     status = RpcServerUseProtseqEpA(ncacn_ip_tcp, 20, endpoint, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp failed (%lu)\n", status);
 
     status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed (%lu)\n", status);
 
     status = RpcServerListen(1, 20, TRUE);
-    ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcServerListen failed (%lu)\n", status);
 
     status = RpcServerListen(1, 20, TRUE);
     ok(status == RPC_S_ALREADY_LISTENING,
-       "wrong RpcServerListen error (%u)\n", status);
+       "wrong RpcServerListen error (%lu)\n", status);
 
     status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address,
                                      endpoint, NULL, &binding);
-    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%lu)\n", status);
 
     status = RpcBindingFromStringBindingA(binding, &IFoo_IfHandle);
-    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n",
+    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n",
        status);
 
     status = RpcBindingSetAuthInfoA(IFoo_IfHandle, NULL, RPC_C_AUTHN_LEVEL_NONE,
                                    RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
-    ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%lu)\n", status);
 
     status = RpcBindingInqAuthInfoA(IFoo_IfHandle, NULL, NULL, NULL, NULL, NULL);
-    ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%u)\n",
+    ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%lu)\n",
        status);
 
     status = RpcBindingSetAuthInfoA(IFoo_IfHandle, spn, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                                    RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME);
-    ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%lu)\n", status);
 
     level = authnsvc = authzsvc = 0;
     principal = (unsigned char *)0xdeadbeef;
@@ -291,33 +291,33 @@ static void test_rpc_ncacn_ip_tcp(void)
     status = RpcBindingInqAuthInfoA(IFoo_IfHandle, &principal, &level, &authnsvc,
                                    &identity, &authzsvc);
 
-    ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%lu)\n", status);
     ok(identity == NULL, "expected NULL identity, got %p\n", identity);
     ok(principal != (unsigned char *)0xdeadbeef, "expected valid principal, got %p\n", principal);
-    ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %d\n", level);
-    ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %d\n", authnsvc);
-    todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %d\n", authzsvc);
+    ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %ld\n", level);
+    ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %ld\n", authnsvc);
+    todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %ld\n", authzsvc);
     if (status == RPC_S_OK) RpcStringFreeA(&principal);
 
     status = RpcMgmtStopServerListening(NULL);
-    ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
+    ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%lu)\n",
        status);
 
     status = RpcMgmtStopServerListening(NULL);
-    ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n",
+    ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%lu)\n",
        status);
 
     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
-    ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%lu)\n", status);
 
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%lu)\n", status);
 
     status = RpcStringFreeA(&binding);
-    ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcStringFree failed (%lu)\n", status);
 
     status = RpcBindingFree(&IFoo_IfHandle);
-    ok(status == RPC_S_OK, "RpcBindingFree failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingFree failed (%lu)\n", status);
 }
 
 /* this is what's generated with MS/RPC - it includes an extra 2
@@ -363,7 +363,7 @@ static void test_towers(void)
     ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "10.0.0.1", &tower);
     ok(ret == RPC_S_OK ||
        broken(ret == RPC_S_INVALID_RPC_PROTSEQ), /* Vista */
-       "TowerConstruct failed with error %d\n", ret);
+       "TowerConstruct failed with error %ld\n", ret);
     if (ret == RPC_S_INVALID_RPC_PROTSEQ)
     {
         /* Windows Vista fails with this error and crashes if we continue */
@@ -396,7 +396,7 @@ static void test_towers(void)
     }
 
     ret = TowerExplode(tower, &object, &syntax, &protseq, &endpoint, &address);
-    ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
+    ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
     ok(!memcmp(&object, &mapi_if_id, sizeof(mapi_if_id)), "object id didn't match\n");
     ok(!memcmp(&syntax, &ndr_syntax, sizeof(syntax)), "syntax id didn't match\n");
     ok(!strcmp(protseq, "ncacn_ip_tcp"), "protseq was \"%s\" instead of \"ncacn_ip_tcp\"\n", protseq);
@@ -408,15 +408,15 @@ static void test_towers(void)
     I_RpcFree(address);
 
     ret = TowerExplode(tower, NULL, NULL, NULL, NULL, NULL);
-    ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
+    ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
 
     I_RpcFree(tower);
 
     /* test the behaviour for ip_tcp with name instead of dotted IP notation */
     ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_ip_tcp", "135", "localhost", &tower);
-    ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
+    ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
     ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
-    ok(ret == RPC_S_OK, "TowerExplode failed with error %d\n", ret);
+    ok(ret == RPC_S_OK, "TowerExplode failed with error %ld\n", ret);
     ok(!strcmp(address, "0.0.0.0") ||
        broken(!strcmp(address, "255.255.255.255")),
        "address was \"%s\" instead of \"0.0.0.0\"\n", address);
@@ -426,11 +426,11 @@ static void test_towers(void)
 
     /* test the behaviour for np with no address */
     ret = TowerConstruct(&mapi_if_id, &ndr_syntax, "ncacn_np", "\\pipe\\test", NULL, &tower);
-    ok(ret == RPC_S_OK, "TowerConstruct failed with error %d\n", ret);
+    ok(ret == RPC_S_OK, "TowerConstruct failed with error %ld\n", ret);
     ret = TowerExplode(tower, NULL, NULL, NULL, NULL, &address);
     ok(ret == RPC_S_OK ||
        broken(ret != RPC_S_OK), /* win2k, indeterminate */
-       "TowerExplode failed with error %d\n", ret);
+       "TowerExplode failed with error %ld\n", ret);
     /* Windows XP SP3 sets address to NULL */
     ok(!address || !strcmp(address, ""), "address was \"%s\" instead of \"\" or NULL (XP SP3)\n", address);
 
@@ -576,7 +576,7 @@ static void test_I_RpcMapWin32Status(void)
 
         ok(win32status == expected_win32status ||
             broken(missing && win32status == rpc_status),
-            "I_RpcMapWin32Status(%d) should have returned 0x%x instead of 0x%x%s\n",
+            "I_RpcMapWin32Status(%ld) should have returned 0x%lx instead of 0x%lx%s\n",
             rpc_status, expected_win32status, win32status,
             broken(missing) ? " (or have returned with the given status)" : "");
     }
@@ -598,7 +598,7 @@ static void test_RpcStringBindingParseA(void)
 
     /* test all parameters */
     status = RpcStringBindingParseA(valid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
-    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
     ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
     ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
     ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
@@ -615,7 +615,7 @@ static void test_RpcStringBindingParseA(void)
 
     /* test all parameters with different type of string binding */
     status = RpcStringBindingParseA(valid_binding2, &uuid, &protseq, &network_addr, &endpoint, &options);
-    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
     ok(!strcmp((char *)uuid, "00000000-0000-0000-c000-000000000046"), "uuid should have been 00000000-0000-0000-C000-000000000046 instead of %s\n", uuid);
     ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
     ok(!strcmp((char *)network_addr, "."), "network_addr should have been . instead of %s\n", network_addr);
@@ -632,24 +632,24 @@ static void test_RpcStringBindingParseA(void)
 
     /* test with as many parameters NULL as possible */
     status = RpcStringBindingParseA(valid_binding, NULL, &protseq, NULL, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
     ok(!strcmp((char *)protseq, "ncacn_np"), "protseq should have been ncacn_np instead of %s\n", protseq);
     RpcStringFreeA(&protseq);
 
     /* test with invalid uuid */
     status = RpcStringBindingParseA(invalid_uuid_binding, NULL, &protseq, NULL, NULL, NULL);
-    ok(status == RPC_S_INVALID_STRING_UUID, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_UUID instead of %d\n", status);
+    ok(status == RPC_S_INVALID_STRING_UUID, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_UUID instead of %ld\n", status);
     ok(protseq == NULL, "protseq was %p instead of NULL\n", protseq);
 
     /* test with invalid endpoint */
     status = RpcStringBindingParseA(invalid_ep_binding, NULL, &protseq, NULL, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingParseA failed with error %ld\n", status);
     RpcStringFreeA(&protseq);
 
     /* test with invalid binding */
     status = RpcStringBindingParseA(invalid_binding, &uuid, &protseq, &network_addr, &endpoint, &options);
     todo_wine
-    ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_BINDING instead of %d\n", status);
+    ok(status == RPC_S_INVALID_STRING_BINDING, "RpcStringBindingParseA should have returned RPC_S_INVALID_STRING_BINDING instead of %ld\n", status);
     todo_wine
     ok(uuid == NULL, "uuid was %p instead of NULL\n", uuid);
     if (uuid)
@@ -687,9 +687,9 @@ static void test_RpcExceptionFilter(void)
         case STATUS_INSTRUCTION_MISALIGNMENT:
         case STATUS_STACK_OVERFLOW:
         case STATUS_POSSIBLE_DEADLOCK:
-            ok(retval == EXCEPTION_CONTINUE_SEARCH, "RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+            ok(retval == EXCEPTION_CONTINUE_SEARCH, "RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
                     exception, EXCEPTION_CONTINUE_SEARCH, retval);
-            ok(retval2 == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+            ok(retval2 == EXCEPTION_CONTINUE_SEARCH, "I_RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
                     exception, EXCEPTION_CONTINUE_SEARCH, retval);
             break;
         case STATUS_GUARD_PAGE_VIOLATION:
@@ -702,9 +702,9 @@ static void test_RpcExceptionFilter(void)
         }
             break;
         default:
-            ok(retval == EXCEPTION_EXECUTE_HANDLER, "RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+            ok(retval == EXCEPTION_EXECUTE_HANDLER, "RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
                    exception, EXCEPTION_EXECUTE_HANDLER, retval);
-            ok(retval2 == EXCEPTION_EXECUTE_HANDLER, "I_RpcExceptionFilter(0x%x) should have returned %d instead of %d\n",
+            ok(retval2 == EXCEPTION_EXECUTE_HANDLER, "I_RpcExceptionFilter(0x%lx) should have returned %d instead of %d\n",
                    exception, EXCEPTION_EXECUTE_HANDLER, retval);
         }
     }
@@ -721,21 +721,21 @@ static void test_RpcStringBindingFromBinding(void)
 
     status = RpcStringBindingComposeA(NULL, ncacn_np, address,
                                      endpoint, NULL, &binding);
-    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingCompose failed (%lu)\n", status);
 
     status = RpcBindingFromStringBindingA(binding, &handle);
-    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%u)\n", status);
+    ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n", status);
     RpcStringFreeA(&binding);
 
     status = RpcBindingToStringBindingA(handle, &binding);
-    ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %u\n", status);
+    ok(status == RPC_S_OK, "RpcStringBindingFromBinding failed with error %lu\n", status);
 
     ok(!strcmp((const char *)binding, "ncacn_np:.[\\\\pipe\\\\wine_rpc_test]"),
        "binding string didn't match what was expected: \"%s\"\n", binding);
     RpcStringFreeA(&binding);
 
     status = RpcBindingFree(&handle);
-    ok(status == RPC_S_OK, "RpcBindingFree failed with error %u\n", status);
+    ok(status == RPC_S_OK, "RpcBindingFree failed with error %lu\n", status);
 }
 
 static void test_UuidCreate(void)
@@ -812,7 +812,7 @@ static void test_UuidCreateSequential(void)
 
     ret = pUuidCreateSequential(&guid1);
     ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
-       "expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
+       "expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08lx\n", ret);
     version = (guid1.Data3 & 0xf000) >> 12;
     ok(version == 1, "unexpected version %d\n", version);
     if (version == 1)
@@ -842,7 +842,7 @@ static void test_UuidCreateSequential(void)
          */
         ret = pUuidCreateSequential(&guid2);
         ok(!ret || ret == RPC_S_UUID_LOCAL_ONLY,
-           "expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08x\n", ret);
+           "expected RPC_S_OK or RPC_S_UUID_LOCAL_ONLY, got %08lx\n", ret);
         version = (guid2.Data3 & 0xf000) >> 12;
         ok(version == 1, "unexpected version %d\n", version);
         ok(!memcmp(guid1.Data4, guid2.Data4, sizeof(guid2.Data4)),
@@ -866,7 +866,7 @@ static void test_RpcBindingFree(void)
 
     status = RpcBindingFree(&binding);
     ok(status == RPC_S_INVALID_BINDING,
-       "RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %d\n",
+       "RpcBindingFree should have returned RPC_S_INVALID_BINDING instead of %ld\n",
        status);
 }
 
@@ -896,10 +896,10 @@ static void test_RpcIfInqId(void)
     if (0)
     {
         status = pRpcIfInqId(NULL, &if_id);
-        ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#x.\n", RPC_S_INVALID_ARG, status);
+        ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#lx.\n", RPC_S_INVALID_ARG, status);
 
         status = pRpcIfInqId((RPC_IF_HANDLE)&server_interface, NULL);
-        ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#x.\n", RPC_S_INVALID_ARG, status);
+        ok(status == RPC_S_INVALID_ARG, "Expected %#x, got %#lx.\n", RPC_S_INVALID_ARG, status);
     }
 
     test_handles[0] = (RPC_IF_HANDLE)&server_interface;
@@ -909,7 +909,7 @@ static void test_RpcIfInqId(void)
     {
         memset(&if_id, 0, sizeof(if_id));
         status = pRpcIfInqId(test_handles[test_idx], &if_id);
-        ok(status == RPC_S_OK, "Test %u: Expected %#x, got %#x.\n", test_idx, RPC_S_OK, status);
+        ok(status == RPC_S_OK, "Test %u: Expected %#x, got %#lx.\n", test_idx, RPC_S_OK, status);
         ok(!memcmp(&if_id.Uuid, &guid, sizeof(guid)), "Test %u: Expected UUID %s, got %s.\n", test_idx,
                 wine_dbgstr_guid(&guid), wine_dbgstr_guid(&if_id.Uuid));
         ok(if_id.VersMajor == 1, "Test %u: Expected major version 1, got %hu.\n", test_idx,
@@ -931,35 +931,35 @@ static void test_RpcServerInqDefaultPrincName(void)
     GetUserNameExA( NameSamCompatible, username, &len );
 
     ret = RpcServerInqDefaultPrincNameA( 0, NULL );
-    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
+    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
 
     ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, NULL );
-    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
+    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
 
     principal = (RPC_CSTR)0xdeadbeef;
     ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_DEFAULT, &principal );
-    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %u\n", ret );
+    ok( ret == RPC_S_UNKNOWN_AUTHN_SERVICE, "got %lu\n", ret );
     ok( principal == (RPC_CSTR)0xdeadbeef, "got unexpected principal\n" );
 
     saved_principal = (RPC_CSTR)0xdeadbeef;
     ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &saved_principal );
-    ok( ret == RPC_S_OK, "got %u\n", ret );
+    ok( ret == RPC_S_OK, "got %lu\n", ret );
     ok( saved_principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
     ok( !strcmp( (const char *)saved_principal, username ), "got \'%s\'\n", saved_principal );
     trace("%s\n", saved_principal);
 
     ret = RpcServerRegisterAuthInfoA( (RPC_CSTR)"wine\\test", RPC_C_AUTHN_WINNT, NULL, NULL );
-    ok( ret == RPC_S_OK, "got %u\n", ret );
+    ok( ret == RPC_S_OK, "got %lu\n", ret );
 
     principal = (RPC_CSTR)0xdeadbeef;
     ret = RpcServerInqDefaultPrincNameA( RPC_C_AUTHN_WINNT, &principal );
-    ok( ret == RPC_S_OK, "got %u\n", ret );
+    ok( ret == RPC_S_OK, "got %lu\n", ret );
     ok( principal != (RPC_CSTR)0xdeadbeef, "expected valid principal\n" );
     ok( !strcmp( (const char *)principal, username ), "got \'%s\'\n", principal );
     RpcStringFreeA( &principal );
 
     ret = RpcServerRegisterAuthInfoA( saved_principal, RPC_C_AUTHN_WINNT, NULL, NULL );
-    ok( ret == RPC_S_OK, "got %u\n", ret );
+    ok( ret == RPC_S_OK, "got %lu\n", ret );
 
     RpcStringFreeA( &saved_principal );
     HeapFree( GetProcessHeap(), 0, username );
@@ -970,7 +970,7 @@ static void test_RpcServerRegisterAuthInfo(void)
     RPC_STATUS status;
 
     status = RpcServerRegisterAuthInfoW(NULL, 600, NULL, NULL);
-    ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %x\n", status);
+    ok(status == RPC_S_UNKNOWN_AUTHN_SERVICE, "status = %lx\n", status);
 }
 
 static void test_RpcServerUseProtseq(void)
@@ -993,12 +993,12 @@ static void test_RpcServerUseProtseq(void)
     else
     {
         binding_count_before = bindings->Count;
-        ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
+        ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
         for (i = 0; i < bindings->Count; i++)
         {
             RPC_CSTR str_bind;
             status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
-            ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
+            ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %ld\n", status);
             if (lstrlenA((const char *)str_bind) > 12 && !memcmp(str_bind, "ncacn_ip_tcp", 12))
                 iptcp_registered = TRUE;
             if (lstrlenA((const char *)str_bind) > 8 && !memcmp(str_bind, "ncacn_np", 8))
@@ -1014,7 +1014,7 @@ static void test_RpcServerUseProtseq(void)
      * RpcServerUseProtseq(...) */
     status = RpcServerUseProtseqEpA(ncalrpc, 0, NULL, NULL);
     ok(status == RPC_S_OK || broken(status == RPC_S_INVALID_ENDPOINT_FORMAT),
-       "RpcServerUseProtseqEp with NULL endpoint failed with status %d\n",
+       "RpcServerUseProtseqEp with NULL endpoint failed with status %ld\n",
        status);
 
     /* register protocol sequences without explicit endpoints */
@@ -1022,28 +1022,28 @@ static void test_RpcServerUseProtseq(void)
     if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
         win_skip("ncacn_np not supported\n");
     else
-        ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
+        ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %ld\n", status);
     if (status == RPC_S_OK && !np_registered) endpoints_registered++;
 
     status = RpcServerUseProtseqA(iptcp, 0, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %ld\n", status);
     if (status == RPC_S_OK && !iptcp_registered) endpoints_registered++;
 
     status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
     if (status == RPC_S_OK && !ncalrpc_registered) endpoints_registered++;
 
     status = RpcServerInqBindings(&bindings);
-    ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
     binding_count_after1 = bindings->Count;
     ok(binding_count_after1 == binding_count_before + endpoints_registered,
-       "wrong binding count - before: %u, after %u, endpoints registered %u\n",
+       "wrong binding count - before: %lu, after %lu, endpoints registered %lu\n",
        binding_count_before, binding_count_after1, endpoints_registered);
     for (i = 0; i < bindings->Count; i++)
     {
         RPC_CSTR str_bind;
         status = RpcBindingToStringBindingA(bindings->BindingH[i], &str_bind);
-        ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %d\n", status);
+        ok(status == RPC_S_OK, "RpcBindingToStringBinding failed with status %ld\n", status);
         trace("string binding: %s\n", str_bind);
         RpcStringFreeA(&str_bind);
     }
@@ -1054,19 +1054,19 @@ static void test_RpcServerUseProtseq(void)
     if (status == RPC_S_PROTSEQ_NOT_SUPPORTED)
         win_skip("ncacn_np not supported\n");
     else
-        ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status);
+        ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %ld\n", status);
 
     status = RpcServerUseProtseqA(iptcp, 0, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %ld\n", status);
 
     status = RpcServerUseProtseqA(ncalrpc, 0, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
 
     status = RpcServerInqBindings(&bindings);
-    ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %ld\n", status);
     binding_count_after2 = bindings->Count;
     ok(binding_count_after2 == binding_count_after1,
-       "bindings should have been re-used - after1: %u after2: %u\n",
+       "bindings should have been re-used - after1: %lu after2: %lu\n",
        binding_count_after1, binding_count_after2);
     RpcBindingVectorFree(&bindings);
 }
@@ -1080,48 +1080,48 @@ static void test_endpoint_mapper(RPC_CSTR protseq, RPC_CSTR address)
     unsigned char *binding;
 
     status = RpcServerRegisterIf(IFoo_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "%s: RpcServerRegisterIf failed (%u)\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcServerRegisterIf failed (%lu)\n", protseq, status);
 
     status = RpcServerInqBindings(&binding_vector);
-    ok(status == RPC_S_OK, "%s: RpcServerInqBindings failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcServerInqBindings failed with error %lu\n", protseq, status);
 
     /* register endpoints created in test_RpcServerUseProtseq */
     status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, annotation);
-    ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %lu\n", protseq, status);
     /* reregister the same endpoint with no annotation */
     status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, NULL);
-    ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %lu\n", protseq, status);
 
     status = RpcStringBindingComposeA(NULL, protseq, address,
                                      NULL, NULL, &binding);
-    ok(status == RPC_S_OK, "%s: RpcStringBindingCompose failed (%u)\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcStringBindingCompose failed (%lu)\n", protseq, status);
 
     status = RpcBindingFromStringBindingA(binding, &handle);
-    ok(status == RPC_S_OK, "%s: RpcBindingFromStringBinding failed (%u)\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcBindingFromStringBinding failed (%lu)\n", protseq, status);
 
     RpcStringFreeA(&binding);
 
     status = RpcBindingReset(handle);
-    ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %lu\n", protseq, status);
 
     status = RpcEpResolveBinding(handle, IFoo_v0_0_s_ifspec);
     ok(status == RPC_S_OK || broken(status == RPC_S_SERVER_UNAVAILABLE), /* win9x */
-       "%s: RpcEpResolveBinding failed with error %u\n", protseq, status);
+       "%s: RpcEpResolveBinding failed with error %lu\n", protseq, status);
 
     status = RpcBindingReset(handle);
-    ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcBindingReset failed with error %lu\n", protseq, status);
 
     status = RpcBindingFree(&handle);
-    ok(status == RPC_S_OK, "%s: RpcBindingFree failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcBindingFree failed with error %lu\n", protseq, status);
 
     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
-    ok(status == RPC_S_OK, "%s: RpcServerUnregisterIf failed (%u)\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcServerUnregisterIf failed (%lu)\n", protseq, status);
 
     status = RpcEpUnregister(IFoo_v0_0_s_ifspec, binding_vector, NULL);
-    ok(status == RPC_S_OK, "%s: RpcEpUnregisterA failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcEpUnregisterA failed with error %lu\n", protseq, status);
 
     status = RpcBindingVectorFree(&binding_vector);
-    ok(status == RPC_S_OK, "%s: RpcBindingVectorFree failed with error %u\n", protseq, status);
+    ok(status == RPC_S_OK, "%s: RpcBindingVectorFree failed with error %lu\n", protseq, status);
 }
 
 static BOOL is_process_elevated(void)
@@ -1152,18 +1152,18 @@ static BOOL is_firewall_enabled(void)
 
     hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
                            (void **)&mgr );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
 done:
     if (policy) INetFwPolicy_Release( policy );
@@ -1198,23 +1198,23 @@ static HRESULT set_firewall( enum firewall_op op )
 
     hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
                            (void **)&mgr );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
                            &IID_INetFwAuthorizedApplication, (void **)&app );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
@@ -1223,7 +1223,7 @@ static HRESULT set_firewall( enum firewall_op op )
     name = SysAllocString( L"rpcrt4_test" );
     hr = INetFwAuthorizedApplication_put_Name( app, name );
     SysFreeString( name );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     if (op == APP_ADD)
@@ -1278,7 +1278,7 @@ START_TEST( rpc )
         HRESULT hr = set_firewall(APP_ADD);
         if (hr != S_OK)
         {
-            skip("can't authorize app in firewall %08x\n", hr);
+            skip("can't authorize app in firewall %08lx\n", hr);
             return;
         }
     }
diff --git a/dlls/rpcrt4/tests/rpc_async.c b/dlls/rpcrt4/tests/rpc_async.c
index 15c57fefb57..0552560bf06 100644
--- a/dlls/rpcrt4/tests/rpc_async.c
+++ b/dlls/rpcrt4/tests/rpc_async.c
@@ -34,27 +34,27 @@ static void test_RpcAsyncInitializeHandle(void)
     void *unset_ptr;
 
     status = RpcAsyncInitializeHandle((PRPC_ASYNC_STATE)buffer, sizeof(buffer));
-    ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with large Size should have returned ERROR_INVALID_PARAMETER instead of %d\n", status);
+    ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with large Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
 
     status = RpcAsyncInitializeHandle(&async, sizeof(async) - 1);
-    ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with small Size should have returned ERROR_INVALID_PARAMETER instead of %d\n", status);
+    ok(status == ERROR_INVALID_PARAMETER, "RpcAsyncInitializeHandle with small Size should have returned ERROR_INVALID_PARAMETER instead of %ld\n", status);
 
     memset(&async, 0xcc, sizeof(async));
     memset(&unset_ptr, 0xcc, sizeof(unset_ptr));
     status = RpcAsyncInitializeHandle(&async, sizeof(async));
-    ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
 
     ok(async.Size == sizeof(async), "async.Size wrong: %d\n", async.Size);
-    ok(async.Signature == 0x43595341, "async.Signature should be 0x43595341, but is 0x%x instead\n", async.Signature);
-    ok(async.Lock == 0, "async.Lock should be 0, but is %d instead\n", async.Lock);
-    ok(async.Flags == 0, "async.Flags should be 0, but is %d instead\n", async.Flags);
+    ok(async.Signature == 0x43595341, "async.Signature should be 0x43595341, but is 0x%lx instead\n", async.Signature);
+    ok(async.Lock == 0, "async.Lock should be 0, but is %ld instead\n", async.Lock);
+    ok(async.Flags == 0, "async.Flags should be 0, but is %ld instead\n", async.Flags);
     ok(async.StubInfo == NULL, "async.StubInfo should be NULL, not %p\n", async.StubInfo);
     ok(async.UserInfo == unset_ptr, "async.UserInfo should be unset, not %p\n", async.UserInfo);
     ok(async.RuntimeInfo == NULL, "async.RuntimeInfo should be NULL, not %p\n", async.RuntimeInfo);
     ok(async.Event == 0xcccccccc, "async.Event should be unset, not %d\n", async.Event);
     ok(async.NotificationType == 0xcccccccc, "async.NotificationType should be unset, not %d\n", async.NotificationType);
     for (i = 0; i < 4; i++)
-        ok(async.Reserved[i] == 0x0, "async.Reserved[%d] should be 0x0, not 0x%lx\n", i, async.Reserved[i]);
+        ok(async.Reserved[i] == 0x0, "async.Reserved[%d] should be 0x0, not 0x%Ix\n", i, async.Reserved[i]);
 }
 
 static void test_RpcAsyncGetCallStatus(void)
@@ -63,16 +63,16 @@ static void test_RpcAsyncGetCallStatus(void)
     RPC_STATUS status;
 
     status = RpcAsyncInitializeHandle(&async, sizeof(async));
-    ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %d\n", status);
+    ok(status == RPC_S_OK, "RpcAsyncInitializeHandle failed with error %ld\n", status);
 
     status = RpcAsyncGetCallStatus(&async);
     todo_wine
-    ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %d\n", status);
+    ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
 
     memset(&async, 0, sizeof(async));
     status = RpcAsyncGetCallStatus(&async);
     todo_wine
-    ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %d\n", status);
+    ok(status == RPC_S_INVALID_BINDING, "RpcAsyncGetCallStatus should have returned RPC_S_INVALID_BINDING instead of %ld\n", status);
 }
 
 START_TEST( rpc_async )
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index d11145b24d3..253fd817a48 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -916,7 +916,7 @@ void __cdecl s_context_handle_test(void)
     /* marshal a context handle with NULL userContext */
     memset(buf, 0xcc, sizeof(buf));
     pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
-    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
+    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
     ok(UuidIsNil((UUID *)&buf[4], &status), "uuid should have been nil\n");
 
     h = pNDRSContextUnmarshall2(binding, NULL, NDR_LOCAL_DATA_REPRESENTATION, NULL, 0);
@@ -926,7 +926,7 @@ void __cdecl s_context_handle_test(void)
     memset(buf, 0xcc, sizeof(buf));
     h->userContext = (void *)0xdeadbeef;
     pNDRSContextMarshall2(binding, h, buf, NULL, NULL, 0);
-    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
+    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
     ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
 
     /* raises ERROR_INVALID_HANDLE exception on Vista upwards */
@@ -943,7 +943,7 @@ void __cdecl s_context_handle_test(void)
     memset(buf, 0xcc, sizeof(buf));
     h->userContext = (void *)0xcafebabe;
     pNDRSContextMarshall2(binding, h, buf, NULL, &server_if.InterfaceId, 0);
-    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%x\n", *(ULONG *)buf);
+    ok(*(ULONG *)buf == 0, "attributes should have been set to 0 instead of 0x%lx\n", *(ULONG *)buf);
     ok(!UuidIsNil((UUID *)&buf[4], &status), "uuid should not have been nil\n");
 
     h = pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if.InterfaceId, 0);
@@ -984,7 +984,7 @@ void __cdecl s_context_handle_test(void)
     binding = NULL;
     status = RpcBindingServerFromClient(NULL, &binding);
 
-    ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+    ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
     ok(binding != NULL, "binding is NULL\n");
 
     if (status == RPC_S_OK && binding != NULL)
@@ -997,11 +997,11 @@ void __cdecl s_context_handle_test(void)
         unsigned char* network_options = NULL;
 
         status = RpcBindingToStringBindingA(binding, &string_binding);
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         ok(string_binding != NULL, "string_binding is NULL\n");
 
         status = RpcStringBindingParseA(string_binding, &object_uuid, &protseq, &network_address, &endpoint, &network_options);
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         ok(protseq != NULL && *protseq != '\0', "protseq is %s\n", protseq);
         ok(network_address != NULL && *network_address != '\0', "network_address is %s\n", network_address);
 
@@ -1085,7 +1085,7 @@ void __cdecl s_stop_autolisten(void)
     RPC_STATUS status;
     status = RpcServerUnregisterIf(NULL, NULL, FALSE);
     todo_wine
-    ok(status == RPC_S_UNKNOWN_MGR_TYPE, "got %u\n", status);
+    ok(status == RPC_S_UNKNOWN_MGR_TYPE, "got %lu\n", status);
 }
 
 void __cdecl s_ip_test(ipu_t *a)
@@ -1094,7 +1094,7 @@ void __cdecl s_ip_test(ipu_t *a)
     HRESULT hr;
 
     hr = IStream_Stat(a->tagged_union.stream, &st, STATFLAG_NONAME);
-    ok(hr == S_OK, "got %#x\n", hr);
+    ok(hr == S_OK, "got %#lx\n", hr);
 }
 
 int __cdecl s_sum_ptr_array(int *a[2])
@@ -1377,7 +1377,7 @@ union_tests(void)
   CreateStreamOnHGlobal(NULL, TRUE, &ipu.tagged_union.stream);
   ip_test(&ipu);
   ref = IStream_Release(ipu.tagged_union.stream);
-  ok(!ref, "got %u refs\n", ref);
+  ok(!ref, "got %lu refs\n", ref);
 
   CoUninitialize();
 }
@@ -1837,7 +1837,7 @@ void __cdecl s_authinfo_test(unsigned int protseq, int secure)
             win_skip("RpcBindingInqAuthClientA not supported\n");
             return;
         }
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         ok(privs != (RPC_AUTHZ_HANDLE)0xdeadbeef, "privs unchanged\n");
         ok(principal != (unsigned char *)0xdeadbeef, "principal unchanged\n");
         if (protseq != RPC_PROTSEQ_LRPC)
@@ -1862,27 +1862,27 @@ void __cdecl s_authinfo_test(unsigned int protseq, int secure)
         RpcStringFreeA(&principal);
 
         status = RpcBindingInqAuthClientA(NULL, &privs, &principal, &level, &authnsvc, NULL);
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         RpcStringFreeA(&principal);
 
         status = RpcBindingInqAuthClientExA(NULL, &privs, &principal, &level, &authnsvc, NULL, 0);
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         RpcStringFreeA(&principal);
 
         status = RpcImpersonateClient(NULL);
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
         status = RpcRevertToSelf();
-        ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+        ok(status == RPC_S_OK, "expected RPC_S_OK got %lu\n", status);
 
     }
     else
     {
         status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL);
-        ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %u\n", status);
+        ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %lu\n", status);
         ok(privs == (RPC_AUTHZ_HANDLE)0xdeadbeef, "got %p\n", privs);
         ok(principal == (unsigned char *)0xdeadbeef, "got %s\n", principal);
-        ok(level == 0xdeadbeef, "got %u\n", level);
-        ok(authnsvc == 0xdeadbeef, "got %u\n", authnsvc);
+        ok(level == 0xdeadbeef, "got %lu\n", level);
+        ok(authnsvc == 0xdeadbeef, "got %lu\n", authnsvc);
     }
 }
 
@@ -1920,7 +1920,7 @@ set_auth_info(RPC_BINDING_HANDLE handle)
 
     status = pRpcBindingSetAuthInfoExA(handle, (RPC_CSTR)domain_and_user, RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
                                        RPC_C_AUTHN_WINNT, NULL, 0, &qos);
-    ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %d\n", status);
+    ok(status == RPC_S_OK, "RpcBindingSetAuthInfoExA failed %ld\n", status);
 }
 
 #define test_is_server_listening(a,b) _test_is_server_listening(__LINE__,a,b)
@@ -1928,7 +1928,7 @@ static void _test_is_server_listening(unsigned line, RPC_BINDING_HANDLE binding,
 {
     RPC_STATUS status;
     status = RpcMgmtIsServerListening(binding);
-    ok_(__FILE__,line)(status == expected_status, "RpcMgmtIsServerListening returned %u, expected %u\n",
+    ok_(__FILE__,line)(status == expected_status, "RpcMgmtIsServerListening returned %lu, expected %lu\n",
                        status, expected_status);
 }
 
@@ -1939,7 +1939,7 @@ static void _test_is_server_listening2(unsigned line, RPC_BINDING_HANDLE binding
     RPC_STATUS status;
     status = RpcMgmtIsServerListening(binding);
     ok_(__FILE__,line)(status == expected_status || status == expected_status2,
-                       "RpcMgmtIsServerListening returned %u, expected %u or %u\n",
+                       "RpcMgmtIsServerListening returned %lu, expected %lu or %lu\n",
                        status, expected_status, expected_status2);
 }
 
@@ -2069,16 +2069,16 @@ server(void)
   CoInitializeEx(NULL, COINIT_MULTITHREADED);
 
   iptcp_status = RpcServerUseProtseqEpA(iptcp, 20, port, NULL);
-  ok(iptcp_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %d\n", iptcp_status);
+  ok(iptcp_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_ip_tcp) failed with status %ld\n", iptcp_status);
 
   ncalrpc_status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
-  ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", ncalrpc_status);
+  ok(ncalrpc_status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", ncalrpc_status);
 
   np_status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
   if (np_status == RPC_S_PROTSEQ_NOT_SUPPORTED)
     skip("Protocol sequence ncacn_np is not supported\n");
   else
-    ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", np_status);
+    ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", np_status);
 
   if (pRpcServerRegisterIfEx)
   {
@@ -2086,25 +2086,25 @@ server(void)
     status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
                                     RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,
                                     RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %ld\n", status);
     status = pRpcServerRegisterIfEx(s_IInterpServer_v0_0_s_ifspec, NULL, NULL,
                                     RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,
                                     RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %ld\n", status);
   }
   else
   {
     status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
     status = RpcServerRegisterIf(s_IInterpServer_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
   }
   test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
   status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
-  ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
+  ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
   test_is_server_listening(NULL, RPC_S_OK);
   stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
-  ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
+  ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
 
   if (iptcp_status == RPC_S_OK)
     run_client("tcp_basic");
@@ -2141,7 +2141,7 @@ server(void)
   if (ret == WAIT_OBJECT_0)
   {
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
   }
 
   CloseHandle(stop_event);
@@ -2152,12 +2152,12 @@ server(void)
     status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
         RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH | RPC_IF_AUTOLISTEN,
         RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf() failed: %u\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf() failed: %lu\n", status);
 
     run_client("ncalrpc_autolisten");
 
     status = RpcServerUnregisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, TRUE);
-    ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %u\n", status);
+    ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %lu\n", status);
   }
 
   CoUninitialize();
@@ -2185,7 +2185,7 @@ static DWORD WINAPI wait_listen_proc(void *arg)
 
     trace("waiting\n");
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
     trace("done\n");
 
     return 0;
@@ -2198,13 +2198,13 @@ static void test_stop_wait_for_call(unsigned char *binding)
     DWORD ret;
 
     status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
-    ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
     test_is_server_listening(NULL, RPC_S_OK);
 
     stop_wait_event = CreateEventW(NULL, FALSE, FALSE, NULL);
-    ok(stop_wait_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
+    ok(stop_wait_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
     stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
-    ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
+    ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
 
     wait_listen_thread = CreateThread(NULL, 0, wait_listen_proc, 0, 0, NULL);
     ok(wait_listen_thread != NULL, "CreateThread failed\n");
@@ -2226,7 +2226,7 @@ static void test_stop_wait_for_call(unsigned char *binding)
     SetEvent(stop_wait_event);
 
     ret = WaitForSingleObject(wait_listen_thread, 10000);
-    ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject returned %u\n", ret);
+    ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject returned %lu\n", ret);
 
     CloseHandle(wait_listen_thread);
 
@@ -2247,28 +2247,28 @@ static void test_server_listening(void)
     RPC_STATUS status;
 
     status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", status);
 
     status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
 
     test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
     status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
-    ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
     test_is_server_listening(NULL, RPC_S_OK);
 
     status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
-    ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %d\n", status);
+    ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %ld\n", status);
 
     status = RpcMgmtStopServerListening(NULL);
     ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
     test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
 
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
 
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %d\n", status);
+    ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %ld\n", status);
 
     /* test that server stop waits for a call in progress */
     status = RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding);
@@ -2281,7 +2281,7 @@ static void test_server_listening(void)
 
     /* repeat the test using ncalrpc */
     status = RpcServerUseProtseqEpA(ncalrpc, 0, guid, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncalrpc) failed with status %ld\n", status);
 
     status = RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding);
     ok(status == RPC_S_OK, "RpcStringBindingCompose\n");
@@ -2305,9 +2305,9 @@ static HANDLE create_server_process(void)
     startup.cb = sizeof startup;
 
     ready_event = CreateEventW(&sec_attr, TRUE, FALSE, NULL);
-    ok(ready_event != NULL, "CreateEvent failed: %u\n", GetLastError());
+    ok(ready_event != NULL, "CreateEvent failed: %lu\n", GetLastError());
 
-    sprintf(cmdline, "%s server run %lx", progname, (UINT_PTR)ready_event);
+    sprintf(cmdline, "%s server run %Ix", progname, (UINT_PTR)ready_event);
     trace("running server process...\n");
     ok(CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
     ret = WaitForSingleObject(ready_event, 10000);
@@ -2326,26 +2326,26 @@ static void run_server(HANDLE ready_event)
     BOOL ret;
 
     status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
-    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", status);
 
     status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
-    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %ld\n", status);
 
     test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
     status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
-    ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcServerListen failed with status %ld\n", status);
 
     stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
-    ok(stop_event != NULL, "CreateEvent failed with error %d\n", GetLastError());
+    ok(stop_event != NULL, "CreateEvent failed with error %ld\n", GetLastError());
 
     ret = SetEvent(ready_event);
-    ok(ret, "SetEvent failed: %u\n", GetLastError());
+    ok(ret, "SetEvent failed: %lu\n", GetLastError());
 
     ret = WaitForSingleObject(stop_event, 5000);
     ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
 
     status = RpcMgmtWaitServerListen();
-    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %ld\n", status);
 
     CloseHandle(stop_event);
     stop_event = NULL;
@@ -2376,7 +2376,7 @@ static void test_reconnect(void)
     for (i = 0; i < ARRAY_SIZE(threads); i++)
     {
         threads[i] = CreateThread(NULL, 0, basic_tests_thread, 0, 0, NULL);
-        ok(threads[i] != NULL, "CreateThread failed: %u\n", GetLastError());
+        ok(threads[i] != NULL, "CreateThread failed: %lu\n", GetLastError());
     }
 
     for (i = 0; i < ARRAY_SIZE(threads); i++)
@@ -2432,18 +2432,18 @@ static BOOL is_firewall_enabled(void)
 
     hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
                            (void **)&mgr );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
 
 done:
     if (policy) INetFwPolicy_Release( policy );
@@ -2478,23 +2478,23 @@ static HRESULT set_firewall( enum firewall_op op )
 
     hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
                            (void **)&mgr );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
                            &IID_INetFwAuthorizedApplication, (void **)&app );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
@@ -2503,7 +2503,7 @@ static HRESULT set_firewall( enum firewall_op op )
     name = SysAllocString( L"rpcrt4_test" );
     hr = INetFwAuthorizedApplication_put_Name( app, name );
     SysFreeString( name );
-    ok( hr == S_OK, "got %08x\n", hr );
+    ok( hr == S_OK, "got %08lx\n", hr );
     if (hr != S_OK) goto done;
 
     if (op == APP_ADD)
@@ -2562,7 +2562,7 @@ START_TEST(server)
     else if(!strcmp(argv[2], "run"))
     {
       ULONG event;
-      sscanf(argv[3], "%x", &event);
+      sscanf(argv[3], "%lx", &event);
       run_server(ULongToHandle(event));
     }
   }
@@ -2580,7 +2580,7 @@ START_TEST(server)
         }
         else
         {
-          skip("can't authorize app in firewall %08x\n", hr);
+          skip("can't authorize app in firewall %08lx\n", hr);
         }
       }
       else




More information about the wine-devel mailing list