[PATCH 15/28] dlls/rpcrt4: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Thu Feb 17 00:11:49 CST 2022


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

---
 dlls/rpcrt4/Makefile.in         |    2 -
 dlls/rpcrt4/cproxy.c            |    6 +-
 dlls/rpcrt4/cstub.c             |    8 +-
 dlls/rpcrt4/ndr_clientserver.c  |    4 +
 dlls/rpcrt4/ndr_contexthandle.c |   12 ++-
 dlls/rpcrt4/ndr_es.c            |   32 ++++----
 dlls/rpcrt4/ndr_fullpointer.c   |    8 +-
 dlls/rpcrt4/ndr_marshall.c      |  150 ++++++++++++++++++++-------------------
 dlls/rpcrt4/ndr_ole.c           |    8 +-
 dlls/rpcrt4/ndr_stubless.c      |   30 ++++----
 dlls/rpcrt4/ndr_typelib.c       |    6 +-
 dlls/rpcrt4/rpc_assoc.c         |    2 -
 dlls/rpcrt4/rpc_async.c         |    2 -
 dlls/rpcrt4/rpc_binding.c       |   58 ++++++++-------
 dlls/rpcrt4/rpc_epmap.c         |   20 +++--
 dlls/rpcrt4/rpc_message.c       |   62 ++++++++--------
 dlls/rpcrt4/rpc_server.c        |   40 +++++-----
 dlls/rpcrt4/rpc_transport.c     |   76 ++++++++++----------
 dlls/rpcrt4/rpcrt4_main.c       |   12 ++-
 19 files changed, 269 insertions(+), 269 deletions(-)

diff --git a/dlls/rpcrt4/Makefile.in b/dlls/rpcrt4/Makefile.in
index 1ad225735d2..2aa2a5376aa 100644
--- a/dlls/rpcrt4/Makefile.in
+++ b/dlls/rpcrt4/Makefile.in
@@ -1,4 +1,4 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES -D_RPCRT4_ -DMSWMSG
+EXTRADEFS = -D_RPCRT4_ -DMSWMSG
 MODULE    = rpcrt4.dll
 IMPORTLIB = rpcrt4
 IMPORTS   = uuid advapi32
diff --git a/dlls/rpcrt4/cproxy.c b/dlls/rpcrt4/cproxy.c
index 968c7b51568..da3e19e50f3 100644
--- a/dlls/rpcrt4/cproxy.c
+++ b/dlls/rpcrt4/cproxy.c
@@ -289,7 +289,7 @@ BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num )
 
     if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
     {
-        FIXME( "%u methods not supported\n", num );
+        FIXME( "%lu methods not supported\n", num );
         return FALSE;
     }
     for (i = 0; i < (num - 3 + BLOCK_SIZE - 1) / BLOCK_SIZE; i++)
@@ -320,7 +320,7 @@ HRESULT StdProxy_Construct(REFIID riid,
   if (ProxyInfo->TableVersion > 1) {
     ULONG count = ProxyInfo->pStubVtblList[Index]->header.DispatchTableCount;
     vtbl = (CInterfaceProxyVtbl *)((const void **)vtbl + 1);
-    TRACE("stubless vtbl %p: count=%d\n", vtbl->Vtbl, count );
+    TRACE("stubless vtbl %p: count=%ld\n", vtbl->Vtbl, count );
     fill_stubless_table( (IUnknownVtbl *)vtbl->Vtbl, count );
   }
 
@@ -592,7 +592,7 @@ void WINAPI NdrProxyFreeBuffer(void *This,
  */
 HRESULT WINAPI NdrProxyErrorHandler(DWORD dwExceptionCode)
 {
-  WARN("(0x%08x): a proxy call failed\n", dwExceptionCode);
+  WARN("(0x%08lx): a proxy call failed\n", dwExceptionCode);
 
   if (FAILED(dwExceptionCode))
     return dwExceptionCode;
diff --git a/dlls/rpcrt4/cstub.c b/dlls/rpcrt4/cstub.c
index 1903a5f0c9d..a6ec4caaadf 100644
--- a/dlls/rpcrt4/cstub.c
+++ b/dlls/rpcrt4/cstub.c
@@ -248,7 +248,7 @@ static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num)
 
     if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
     {
-        FIXME( "%u methods not supported\n", num );
+        FIXME( "%lu methods not supported\n", num );
         return FALSE;
     }
     vtbl->QueryInterface = delegating_QueryInterface;
@@ -270,7 +270,7 @@ BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num)
 
     if (num - 3 > BLOCK_SIZE * MAX_BLOCKS)
     {
-        FIXME( "%u methods not supported\n", num );
+        FIXME( "%lu methods not supported\n", num );
         return FALSE;
     }
     vtbl->QueryInterface = IUnknown_QueryInterface_Proxy;
@@ -328,7 +328,7 @@ void release_delegating_vtbl(IUnknownVtbl *vtbl)
 
     EnterCriticalSection(&delegating_vtbl_section);
     table->ref--;
-    TRACE("ref now %d\n", table->ref);
+    TRACE("ref now %ld\n", table->ref);
     if(table->ref == 0 && table != current_vtbl)
     {
         TRACE("... and we're not current so free'ing\n");
@@ -508,7 +508,7 @@ HRESULT WINAPI CStdStubBuffer_Invoke(LPRPCSTUBBUFFER iface,
   __EXCEPT(stub_filter)
   {
     DWORD dwExceptionCode = GetExceptionCode();
-    WARN("a stub call failed with exception 0x%08x (%d)\n", dwExceptionCode, dwExceptionCode);
+    WARN("a stub call failed with exception 0x%08lx (%ld)\n", dwExceptionCode, dwExceptionCode);
     if (FAILED(dwExceptionCode))
       hr = dwExceptionCode;
     else
diff --git a/dlls/rpcrt4/ndr_clientserver.c b/dlls/rpcrt4/ndr_clientserver.c
index 66fe33b2839..d4ba2ffa5e0 100644
--- a/dlls/rpcrt4/ndr_clientserver.c
+++ b/dlls/rpcrt4/ndr_clientserver.c
@@ -164,7 +164,7 @@ unsigned char *WINAPI NdrGetBuffer(PMIDL_STUB_MESSAGE stubmsg, ULONG buflen, RPC
 {
   RPC_STATUS status;
 
-  TRACE("(stubmsg == ^%p, buflen == %u, handle == %p)\n", stubmsg, buflen, handle);
+  TRACE("(stubmsg == ^%p, buflen == %lu, handle == %p)\n", stubmsg, buflen, handle);
   
   stubmsg->RpcMsg->Handle = handle;
   stubmsg->RpcMsg->BufferLength = buflen;
@@ -233,7 +233,7 @@ RPC_STATUS RPC_ENTRY NdrMapCommAndFaultStatus( PMIDL_STUB_MESSAGE pStubMsg,
                                                ULONG *pFaultStatus,
                                                RPC_STATUS Status )
 {
-    TRACE("(%p, %p, %p, %d)\n", pStubMsg, pCommStatus, pFaultStatus, Status);
+    TRACE("(%p, %p, %p, %ld)\n", pStubMsg, pCommStatus, pFaultStatus, Status);
 
     switch (Status)
     {
diff --git a/dlls/rpcrt4/ndr_contexthandle.c b/dlls/rpcrt4/ndr_contexthandle.c
index 36deb41d812..00057508753 100644
--- a/dlls/rpcrt4/ndr_contexthandle.c
+++ b/dlls/rpcrt4/ndr_contexthandle.c
@@ -210,7 +210,7 @@ void WINAPI NDRCContextUnmarshall(NDR_CCONTEXT *CContext,
 {
     RPC_STATUS status;
 
-    TRACE("*%p=(%p) %p %p %08x\n",
+    TRACE("*%p=(%p) %p %p %08lx\n",
           CContext, *CContext, hBinding, pBuff, DataRepresentation);
 
     EnterCriticalSection(&ndr_context_cs);
@@ -258,7 +258,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
     RPC_STATUS status;
     ndr_context_handle *ndr = pBuff;
 
-    TRACE("(%p %p %p %p %p %u)\n",
+    TRACE("(%p %p %p %p %p %lu)\n",
           hBinding, SContext, pBuff, userRunDownIn, CtxGuard, Flags);
 
     if (!binding->server || !binding->Assoc)
@@ -298,7 +298,7 @@ void WINAPI NDRSContextMarshall2(RPC_BINDING_HANDLE hBinding,
 NDR_SCONTEXT WINAPI NDRSContextUnmarshall(void *pBuff,
                                           ULONG DataRepresentation)
 {
-    TRACE("(%p %08x)\n", pBuff, DataRepresentation);
+    TRACE("(%p %08lx)\n", pBuff, DataRepresentation);
     return NDRSContextUnmarshall2(I_RpcGetCurrentCallHandle(), pBuff,
                                   DataRepresentation, NULL,
                                   RPC_CONTEXT_HANDLE_DEFAULT_FLAGS);
@@ -311,7 +311,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshallEx(RPC_BINDING_HANDLE hBinding,
                                             void *pBuff,
                                             ULONG DataRepresentation)
 {
-    TRACE("(%p %p %08x)\n", hBinding, pBuff, DataRepresentation);
+    TRACE("(%p %p %08lx)\n", hBinding, pBuff, DataRepresentation);
     return NDRSContextUnmarshall2(hBinding, pBuff, DataRepresentation, NULL,
                                   RPC_CONTEXT_HANDLE_DEFAULT_FLAGS);
 }
@@ -329,7 +329,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
     RPC_STATUS status;
     const ndr_context_handle *context_ndr = pBuff;
 
-    TRACE("(%p %p %08x %p %u)\n",
+    TRACE("(%p %p %08lx %p %lu)\n",
           hBinding, pBuff, DataRepresentation, CtxGuard, Flags);
 
     if (!binding->server || !binding->Assoc)
@@ -343,7 +343,7 @@ NDR_SCONTEXT WINAPI NDRSContextUnmarshall2(RPC_BINDING_HANDLE hBinding,
     {
         if (context_ndr->attributes)
         {
-            ERR("non-null attributes 0x%x\n", context_ndr->attributes);
+            ERR("non-null attributes 0x%lx\n", context_ndr->attributes);
             status = RPC_X_SS_CONTEXT_MISMATCH;
         }
         else
diff --git a/dlls/rpcrt4/ndr_es.c b/dlls/rpcrt4/ndr_es.c
index a756b178c5d..f7fb45feee1 100644
--- a/dlls/rpcrt4/ndr_es.c
+++ b/dlls/rpcrt4/ndr_es.c
@@ -130,7 +130,7 @@ RPC_STATUS WINAPI MesBufferHandleReset(handle_t Handle, ULONG HandleStyle,
 {
     MIDL_ES_MESSAGE *pEsMsg = (MIDL_ES_MESSAGE *)Handle;
 
-    TRACE("(%p, %u, %d, %p, %u, %p)\n", Handle, HandleStyle, Operation, Buffer,
+    TRACE("(%p, %lu, %d, %p, %lu, %p)\n", Handle, HandleStyle, Operation, Buffer,
         BufferSize, EncodedSize);
 
     if (!Handle || !Buffer || !EncodedSize)
@@ -186,7 +186,7 @@ RPC_STATUS RPC_ENTRY MesEncodeFixedBufferHandleCreate(
     MIDL_ES_MESSAGE *pEsMsg;
     RPC_STATUS status;
 
-    TRACE("(%p, %d, %p, %p)\n", Buffer, BufferSize, pEncodedSize, pHandle);
+    TRACE("(%p, %ld, %p, %p)\n", Buffer, BufferSize, pEncodedSize, pHandle);
 
     if ((status = validate_mes_buffer_pointer(Buffer)))
         return status;
@@ -251,7 +251,7 @@ RPC_STATUS RPC_ENTRY MesDecodeBufferHandleCreate(
     MIDL_ES_MESSAGE *pEsMsg;
     RPC_STATUS status;
 
-    TRACE("(%p, %d, %p)\n", Buffer, BufferSize, pHandle);
+    TRACE("(%p, %ld, %p)\n", Buffer, BufferSize, pHandle);
 
     if ((status = validate_mes_buffer_pointer(Buffer)))
         return status;
@@ -277,17 +277,17 @@ static void es_data_alloc(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
     if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
     {
         unsigned int tmpsize = size;
-        TRACE("%d with incremental handle\n", size);
+        TRACE("%ld with incremental handle\n", size);
         pEsMsg->Alloc(pEsMsg->UserState, (char **)&pEsMsg->StubMsg.Buffer, &tmpsize);
         if (tmpsize < size)
         {
-            ERR("not enough bytes allocated - requested %d, got %d\n", size, tmpsize);
+            ERR("not enough bytes allocated - requested %ld, got %d\n", size, tmpsize);
             RpcRaiseException(RPC_S_OUT_OF_MEMORY);
         }
     }
     else if (pEsMsg->HandleStyle == MES_FIXED_BUFFER_HANDLE)
     {
-        TRACE("%d with fixed buffer handle\n", size);
+        TRACE("%ld with fixed buffer handle\n", size);
         pEsMsg->StubMsg.Buffer = pEsMsg->Buffer;
     }
     pEsMsg->StubMsg.RpcMsg->Buffer = pEsMsg->StubMsg.BufferStart = pEsMsg->StubMsg.Buffer;
@@ -298,17 +298,17 @@ static void es_data_read(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
     if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
     {
         unsigned int tmpsize = size;
-        TRACE("%d from incremental handle\n", size);
+        TRACE("%ld from incremental handle\n", size);
         pEsMsg->Read(pEsMsg->UserState, (char **)&pEsMsg->StubMsg.Buffer, &tmpsize);
         if (tmpsize < size)
         {
-            ERR("not enough bytes read - requested %d, got %d\n", size, tmpsize);
+            ERR("not enough bytes read - requested %ld, got %d\n", size, tmpsize);
             RpcRaiseException(RPC_S_OUT_OF_MEMORY);
         }
     }
     else
     {
-        TRACE("%d from fixed or dynamic buffer handle\n", size);
+        TRACE("%ld from fixed or dynamic buffer handle\n", size);
         /* FIXME: validate BufferSize? */
         pEsMsg->StubMsg.Buffer = pEsMsg->Buffer;
         pEsMsg->Buffer += size;
@@ -323,12 +323,12 @@ static void es_data_write(MIDL_ES_MESSAGE *pEsMsg, ULONG size)
 {
     if (pEsMsg->HandleStyle == MES_INCREMENTAL_HANDLE)
     {
-        TRACE("%d to incremental handle\n", size);
+        TRACE("%ld to incremental handle\n", size);
         pEsMsg->Write(pEsMsg->UserState, (char *)pEsMsg->StubMsg.BufferStart, size);
     }
     else
     {
-        TRACE("%d to dynamic or fixed buffer handle\n", size);
+        TRACE("%ld to dynamic or fixed buffer handle\n", size);
         *pEsMsg->pEncodedSize += size;
     }
 }
@@ -386,7 +386,7 @@ static void mes_proc_header_unmarshal(MIDL_ES_MESSAGE *pEsMsg)
     pEsMsg->ProcNumber = *(DWORD *)pEsMsg->StubMsg.Buffer;
     pEsMsg->StubMsg.Buffer += 4;
     if (*(DWORD *)pEsMsg->StubMsg.Buffer != 0x00000001)
-        FIXME("unknown value 0x%08x, expected 0x00000001\n", *(DWORD *)pEsMsg->StubMsg.Buffer);
+        FIXME("unknown value 0x%08lx, expected 0x00000001\n", *(DWORD *)pEsMsg->StubMsg.Buffer);
     pEsMsg->StubMsg.Buffer += 4;
     pEsMsg->ByteCount = *(DWORD *)pEsMsg->StubMsg.Buffer;
     pEsMsg->StubMsg.Buffer += 4;
@@ -416,7 +416,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
     /* Later NDR language versions probably won't be backwards compatible */
     if (pStubDesc->Version > 0x50002)
     {
-        FIXME("Incompatible stub description version: 0x%x\n", pStubDesc->Version);
+        FIXME("Incompatible stub description version: 0x%lx\n", pStubDesc->Version);
         RpcRaiseException(RPC_X_WRONG_STUB_VERSION);
     }
 
@@ -457,7 +457,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
     }
 
     TRACE("stack size: 0x%x\n", stack_size);
-    TRACE("proc num: %d\n", pEsMsg->ProcNumber);
+    TRACE("proc num: %ld\n", pEsMsg->ProcNumber);
 
     memset(&rpcMsg, 0, sizeof(rpcMsg));
     pEsMsg->StubMsg.RpcMsg = &rpcMsg;
@@ -470,8 +470,8 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
         pEsMsg->StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT);
 
     TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
-    TRACE("stubdesc version = 0x%x\n", pStubDesc->Version);
-    TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
+    TRACE("stubdesc version = 0x%lx\n", pStubDesc->Version);
+    TRACE("MIDL stub version = 0x%lx\n", pStubDesc->MIDLVersion);
 
     /* needed for conformance of top-level objects */
     va_start( args, pFormat );
diff --git a/dlls/rpcrt4/ndr_fullpointer.c b/dlls/rpcrt4/ndr_fullpointer.c
index 2bbd2b2b1aa..e4c959ce90a 100644
--- a/dlls/rpcrt4/ndr_fullpointer.c
+++ b/dlls/rpcrt4/ndr_fullpointer.c
@@ -35,7 +35,7 @@ PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers,
     ULONG NumberOfBuckets;
     PFULL_PTR_XLAT_TABLES pXlatTables = HeapAlloc(GetProcessHeap(), 0, sizeof(*pXlatTables));
 
-    TRACE("(%d, %d)\n", NumberOfPointers, XlatSide);
+    TRACE("(%ld, %d)\n", NumberOfPointers, XlatSide);
 
     if (!NumberOfPointers) NumberOfPointers = 512;
     NumberOfBuckets = ((NumberOfPointers + 3) & ~3) - 1;
@@ -48,7 +48,7 @@ PFULL_PTR_XLAT_TABLES WINAPI NdrFullPointerXlatInit(ULONG NumberOfPointers,
             sizeof(unsigned char) * NumberOfPointers);
     pXlatTables->RefIdToPointer.NumberOfEntries = NumberOfPointers;
 
-    TRACE("NumberOfBuckets = %d\n", NumberOfBuckets);
+    TRACE("NumberOfBuckets = %ld\n", NumberOfBuckets);
     pXlatTables->PointerToRefId.XlatTable =
         HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
             sizeof(PFULL_PTR_TO_REFID_ELEMENT) * NumberOfBuckets);
@@ -159,7 +159,7 @@ int WINAPI NdrFullPointerQueryRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
                                     ULONG RefId, unsigned char QueryType,
                                     void **ppPointer)
 {
-    TRACE("(%p, 0x%x, %d, %p)\n", pXlatTables, RefId, QueryType, ppPointer);
+    TRACE("(%p, 0x%lx, %d, %p)\n", pXlatTables, RefId, QueryType, ppPointer);
 
     if (!RefId)
         return 1;
@@ -192,7 +192,7 @@ void WINAPI NdrFullPointerInsertRefId(PFULL_PTR_XLAT_TABLES pXlatTables,
     unsigned int i;
     PFULL_PTR_TO_REFID_ELEMENT XlatTableEntry;
 
-    TRACE("(%p, 0x%x, %p)\n", pXlatTables, RefId, pPointer);
+    TRACE("(%p, 0x%lx, %p)\n", pXlatTables, RefId, pPointer);
 
     /* simple hashing algorithm, don't know whether it matches native */
     for (i = 0; i < sizeof(pPointer); i++)
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 764b304a047..d0d2e19342c 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -121,9 +121,9 @@ static inline void align_pointer_offset_clear( unsigned char **ptr, unsigned cha
 }
 
 #define STD_OVERFLOW_CHECK(_Msg) do { \
-    TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \
+    TRACE("buffer=%ld/%ld\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \
     if (_Msg->Buffer > (unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength) \
-        ERR("buffer overflow %d bytes\n", (ULONG)(_Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength))); \
+        ERR("buffer overflow %ld bytes\n", (ULONG)(_Msg->Buffer - ((unsigned char *)_Msg->RpcMsg->Buffer + _Msg->BufferLength))); \
   } while (0)
 
 #define NDR_POINTER_ID_BASE 0x20000
@@ -428,7 +428,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len)
     /* check for overflow */
     if (adjusted_len < len)
     {
-        ERR("overflow of adjusted_len %ld, len %ld\n", adjusted_len, len);
+        ERR("overflow of adjusted_len %Id, len %Id\n", adjusted_len, len);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
 
@@ -477,7 +477,7 @@ static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRIN
       RpcRaiseException(RPC_X_BAD_STUB_DATA);
   pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
   pStubMsg->Buffer += 4;
-  TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount);
+  TRACE("unmarshalled conformance is %Id\n", pStubMsg->MaxCount);
   return SkipConformance(pStubMsg, pFormat);
 }
 
@@ -495,15 +495,15 @@ static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_S
     RpcRaiseException(RPC_X_BAD_STUB_DATA);
   pStubMsg->Offset      = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
   pStubMsg->Buffer += 4;
-  TRACE("offset is %d\n", pStubMsg->Offset);
+  TRACE("offset is %ld\n", pStubMsg->Offset);
   pStubMsg->ActualCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer);
   pStubMsg->Buffer += 4;
-  TRACE("variance is %d\n", pStubMsg->ActualCount);
+  TRACE("variance is %ld\n", pStubMsg->ActualCount);
 
   if ((pStubMsg->ActualCount > MaxValue) ||
       (pStubMsg->ActualCount + pStubMsg->Offset > MaxValue))
   {
-    ERR("invalid array bound(s): ActualCount = %d, Offset = %d, MaxValue = %d\n",
+    ERR("invalid array bound(s): ActualCount = %ld, Offset = %ld, MaxValue = %ld\n",
         pStubMsg->ActualCount, pStubMsg->Offset, MaxValue);
     RpcRaiseException(RPC_S_INVALID_BOUND);
     return NULL;
@@ -589,7 +589,7 @@ PFORMAT_STRING ComputeConformanceOrVariance(
     break;
   case FC_CONSTANT_CONFORMANCE:
     data = ofs | ((DWORD)pFormat[1] << 16);
-    TRACE("constant conformance, val=%ld\n", data);
+    TRACE("constant conformance, val=%Id\n", data);
     *pCount = data;
     goto finish_conf;
   case FC_TOP_LEVEL_MULTID_CONFORMANCE:
@@ -661,7 +661,7 @@ PFORMAT_STRING ComputeConformanceOrVariance(
     FIXME("unknown conformance data type %x\n", dtype);
     goto done_conf_grab;
   }
-  TRACE("dereferenced data type %x at %p, got %ld\n", dtype, ptr, data);
+  TRACE("dereferenced data type %x at %p, got %Id\n", dtype, ptr, data);
 
 done_conf_grab:
   switch (pFormat[1]) {
@@ -687,7 +687,7 @@ done_conf_grab:
   }
 
 finish_conf:
-  TRACE("resulting conformance is %ld\n", *pCount);
+  TRACE("resulting conformance is %Id\n", *pCount);
 
   return SkipConformance(pStubMsg, pFormat);
 }
@@ -722,7 +722,7 @@ static inline void safe_buffer_length_increment(MIDL_STUB_MESSAGE *pStubMsg, ULO
 {
     if (pStubMsg->BufferLength + size < pStubMsg->BufferLength) /* integer overflow of pStubMsg->BufferSize */
     {
-        ERR("buffer length overflow - BufferLength = %u, size = %u\n",
+        ERR("buffer length overflow - BufferLength = %lu, size = %lu\n",
             pStubMsg->BufferLength, size);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
@@ -736,7 +736,7 @@ static inline void safe_copy_from_buffer(MIDL_STUB_MESSAGE *pStubMsg, void *p, U
     if ((pStubMsg->Buffer + size < pStubMsg->Buffer) || /* integer overflow of pStubMsg->Buffer */
         (pStubMsg->Buffer + size > pStubMsg->BufferEnd))
     {
-        ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %u\n",
+        ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %lu\n",
             pStubMsg->Buffer, pStubMsg->BufferEnd, size);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
@@ -752,7 +752,7 @@ static inline void safe_copy_to_buffer(MIDL_STUB_MESSAGE *pStubMsg, const void *
     if ((pStubMsg->Buffer + size < pStubMsg->Buffer) || /* integer overflow of pStubMsg->Buffer */
         (pStubMsg->Buffer + size > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength))
     {
-        ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %u\n",
+        ERR("buffer overflow - Buffer = %p, BufferEnd = %p, size = %lu\n",
             pStubMsg->Buffer, (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength,
             size);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
@@ -771,7 +771,7 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO
     if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) ||
         (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd))
     {
-        ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize,
+        ERR("bufsize 0x%lx exceeded buffer end %p of buffer %p\n", bufsize,
             pStubMsg->BufferEnd, pStubMsg->Buffer);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
@@ -779,14 +779,14 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO
     /* strings must always have null terminating bytes */
     if (bufsize < esize)
     {
-        ERR("invalid string length of %d\n", bufsize / esize);
+        ERR("invalid string length of %ld\n", bufsize / esize);
         RpcRaiseException(RPC_S_INVALID_BOUND);
     }
 
     for (i = bufsize - esize; i < bufsize; i++)
         if (pStubMsg->Buffer[i] != 0)
         {
-            ERR("string not null-terminated at byte position %d, data is 0x%x\n",
+            ERR("string not null-terminated at byte position %ld, data is 0x%x\n",
                 i, pStubMsg->Buffer[i]);
             RpcRaiseException(RPC_S_INVALID_BOUND);
         }
@@ -843,13 +843,13 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
     else
       pointer_needs_marshaling = FALSE;
     pointer_id = Pointer ? NDR_POINTER_ID(pStubMsg) : 0;
-    TRACE("writing 0x%08x to buffer\n", pointer_id);
+    TRACE("writing 0x%08lx to buffer\n", pointer_id);
     NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
     break;
   case FC_FP:
     pointer_needs_marshaling = !NdrFullPointerQueryPointer(
       pStubMsg->FullPtrXlatTables, Pointer, 1, &pointer_id);
-    TRACE("writing 0x%08x to buffer\n", pointer_id);
+    TRACE("writing 0x%08lx to buffer\n", pointer_id);
     NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
     break;
   default:
@@ -905,7 +905,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
     break;
   case FC_UP: /* unique pointer */
     pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
-    TRACE("pointer_id is 0x%08x\n", pointer_id);
+    TRACE("pointer_id is 0x%08lx\n", pointer_id);
     if (pointer_id)
       pointer_needs_unmarshaling = TRUE;
     else {
@@ -915,7 +915,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
     break;
   case FC_OP: /* object pointer - we must free data before overwriting it */
     pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
-    TRACE("pointer_id is 0x%08x\n", pointer_id);
+    TRACE("pointer_id is 0x%08lx\n", pointer_id);
 
     /* An object pointer always allocates new memory (it cannot point to the
      * buffer). */
@@ -933,7 +933,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
     break;
   case FC_FP:
     pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
-    TRACE("pointer_id is 0x%08x\n", pointer_id);
+    TRACE("pointer_id is 0x%08lx\n", pointer_id);
     pointer_needs_unmarshaling = !NdrFullPointerQueryRefId(
       pStubMsg->FullPtrXlatTables, pointer_id, 1, (void **)pPointer);
     break;
@@ -1079,7 +1079,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
   case FC_UP: /* unique pointer */
   case FC_OP: /* object pointer - we must free data before overwriting it */
     pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
-    TRACE("pointer_id is 0x%08x\n", pointer_id);
+    TRACE("pointer_id is 0x%08lx\n", pointer_id);
     if (pointer_id)
       pointer_needs_sizing = TRUE;
     else
@@ -1089,7 +1089,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
   {
     void *pointer;
     pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
-    TRACE("pointer_id is 0x%08x\n", pointer_id);
+    TRACE("pointer_id is 0x%08lx\n", pointer_id);
     pointer_needs_sizing = !NdrFullPointerQueryRefId(
       pStubMsg->FullPtrXlatTables, pointer_id, 1, &pointer);
     break;
@@ -1693,7 +1693,7 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
     case FC_ERROR_STATUS_T:
     case FC_ENUM32:
         BASE_TYPE_UNMARSHALL(ULONG);
-        TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
+        TRACE("value: 0x%08lx\n", *(ULONG *)pMemory);
         break;
    case FC_FLOAT:
         BASE_TYPE_UNMARSHALL(float);
@@ -1720,14 +1720,14 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
         /* 32-bits on the wire, but int_ptr in memory */
         *(INT_PTR *)pMemory = *(INT *)pStubMsg->Buffer;
         pStubMsg->Buffer += sizeof(INT);
-        TRACE("value: 0x%08lx\n", *(INT_PTR *)pMemory);
+        TRACE("value: 0x%08Ix\n", *(INT_PTR *)pMemory);
         break;
     case FC_UINT3264:
         align_pointer(&pStubMsg->Buffer, sizeof(UINT));
         /* 32-bits on the wire, but int_ptr in memory */
         *(UINT_PTR *)pMemory = *(UINT *)pStubMsg->Buffer;
         pStubMsg->Buffer += sizeof(UINT);
-        TRACE("value: 0x%08lx\n", *(UINT_PTR *)pMemory);
+        TRACE("value: 0x%08Ix\n", *(UINT_PTR *)pMemory);
         break;
     case FC_IGNORE:
         break;
@@ -2225,13 +2225,13 @@ static inline ULONG array_read_variance_and_unmarshall(
 
     if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
     {
-      ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
+      ERR("buffer size %ld must equal memory size %Id for non-sized conformant strings\n",
           pStubMsg->ActualCount, pStubMsg->MaxCount);
       RpcRaiseException(RPC_S_INVALID_BOUND);
     }
     if (pStubMsg->Offset)
     {
-      ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
+      ERR("conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
       RpcRaiseException(RPC_S_INVALID_BOUND);
     }
 
@@ -2356,13 +2356,13 @@ static inline void array_memory_size(
 
     if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
     {
-      ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
+      ERR("buffer size %ld must equal memory size %Id for non-sized conformant strings\n",
           pStubMsg->ActualCount, pStubMsg->MaxCount);
       RpcRaiseException(RPC_S_INVALID_BOUND);
     }
     if (pStubMsg->Offset)
     {
-      ERR("conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
+      ERR("conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
       RpcRaiseException(RPC_S_INVALID_BOUND);
     }
 
@@ -2636,7 +2636,7 @@ unsigned char *  WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu
   ReadVariance(pStubMsg, NULL, maxsize);
   if (pStubMsg->Offset)
   {
-    ERR("non-conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
+    ERR("non-conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
     RpcRaiseException(RPC_S_INVALID_BOUND);
   }
 
@@ -2728,7 +2728,7 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
 
   if (pStubMsg->Offset)
   {
-    ERR("non-conformant strings can't have Offset (%d)\n", pStubMsg->Offset);
+    ERR("non-conformant strings can't have Offset (%ld)\n", pStubMsg->Offset);
     RpcRaiseException(RPC_S_INVALID_BOUND);
   }
 
@@ -2869,7 +2869,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
     case FC_ENUM16:
     {
       USHORT val = *(DWORD *)pMemory;
-      TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory);
+      TRACE("enum16=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
       if (32767 < *(DWORD*)pMemory)
         RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
       safe_copy_to_buffer(pStubMsg, &val, 2);
@@ -2879,7 +2879,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
     case FC_LONG:
     case FC_ULONG:
     case FC_ENUM32:
-      TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory);
+      TRACE("long=%ld <= %p\n", *(DWORD*)pMemory, pMemory);
       safe_copy_to_buffer(pStubMsg, pMemory, 4);
       pMemory += 4;
       break;
@@ -2887,7 +2887,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
     case FC_UINT3264:
     {
       UINT val = *(UINT_PTR *)pMemory;
-      TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory);
+      TRACE("int3264=%Id <= %p\n", *(UINT_PTR *)pMemory, pMemory);
       safe_copy_to_buffer(pStubMsg, &val, sizeof(UINT));
       pMemory += sizeof(UINT_PTR);
       break;
@@ -2970,7 +2970,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
       pFormat += 2;
       desc = pFormat + *(const SHORT*)pFormat;
       size = EmbeddedComplexSize(pStubMsg, desc);
-      TRACE("embedded complex (size=%d) <= %p\n", size, pMemory);
+      TRACE("embedded complex (size=%ld) <= %p\n", size, pMemory);
       m = NdrMarshaller[*desc & NDR_TABLE_MASK];
       if (m)
       {
@@ -3031,7 +3031,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
       WORD val;
       safe_copy_from_buffer(pStubMsg, &val, 2);
       *(DWORD*)pMemory = val;
-      TRACE("enum16=%d => %p\n", *(DWORD*)pMemory, pMemory);
+      TRACE("enum16=%ld => %p\n", *(DWORD*)pMemory, pMemory);
       if (32767 < *(DWORD*)pMemory)
         RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE);
       pMemory += 4;
@@ -3041,7 +3041,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
     case FC_ULONG:
     case FC_ENUM32:
       safe_copy_from_buffer(pStubMsg, pMemory, 4);
-      TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory);
+      TRACE("long=%ld => %p\n", *(DWORD*)pMemory, pMemory);
       pMemory += 4;
       break;
     case FC_INT3264:
@@ -3049,7 +3049,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
       INT val;
       safe_copy_from_buffer(pStubMsg, &val, 4);
       *(INT_PTR *)pMemory = val;
-      TRACE("int3264=%ld => %p\n", *(INT_PTR*)pMemory, pMemory);
+      TRACE("int3264=%Id => %p\n", *(INT_PTR*)pMemory, pMemory);
       pMemory += sizeof(INT_PTR);
       break;
     }
@@ -3058,7 +3058,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
       UINT val;
       safe_copy_from_buffer(pStubMsg, &val, 4);
       *(UINT_PTR *)pMemory = val;
-      TRACE("uint3264=%ld => %p\n", *(UINT_PTR*)pMemory, pMemory);
+      TRACE("uint3264=%Id => %p\n", *(UINT_PTR*)pMemory, pMemory);
       pMemory += sizeof(UINT_PTR);
       break;
     }
@@ -3140,7 +3140,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
       pFormat += 2;
       desc = pFormat + *(const SHORT*)pFormat;
       size = EmbeddedComplexSize(pStubMsg, desc);
-      TRACE("embedded complex (size=%d) => %p\n", size, pMemory);
+      TRACE("embedded complex (size=%ld) => %p\n", size, pMemory);
       if (fMustAlloc)
         /* we can't pass fMustAlloc=TRUE into the marshaller for this type
          * since the type is part of the memory block that is encompassed by
@@ -3629,7 +3629,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
 
     /* save it for use by embedded pointer code later */
     pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
-    TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - pStubMsg->Buffer));
+    TRACE("difference = 0x%lx\n", (ULONG)(pStubMsg->PointerBufferMark - pStubMsg->Buffer));
     pointer_buffer_mark_set = TRUE;
 
     /* restore the original buffer length */
@@ -3715,7 +3715,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
 
     /* save it for use by embedded pointer code later */
     pStubMsg->PointerBufferMark = pStubMsg->Buffer;
-    TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->PointerBufferMark - saved_buffer));
+    TRACE("difference = 0x%lx\n", (ULONG)(pStubMsg->PointerBufferMark - saved_buffer));
     pointer_buffer_mark_set = TRUE;
 
     /* restore the original buffer */
@@ -3803,7 +3803,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
     /* save it for use by embedded pointer code later */
     pStubMsg->PointerLength = pStubMsg->BufferLength;
     pointer_length_set = 1;
-    TRACE("difference = 0x%x\n", pStubMsg->PointerLength - saved_buffer_length);
+    TRACE("difference = 0x%lx\n", pStubMsg->PointerLength - saved_buffer_length);
 
     /* restore the original buffer length */
     pStubMsg->BufferLength = saved_buffer_length;
@@ -4186,7 +4186,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
 
     /* save it for use by embedded pointer code later */
     pStubMsg->PointerBufferMark = (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength;
-    TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer));
+    TRACE("difference = 0x%lx\n", (ULONG)(pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer));
     pointer_buffer_mark_set = TRUE;
 
     /* restore fields */
@@ -4242,7 +4242,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
   NdrComplexArrayMemorySize(pStubMsg, pFormat);
   pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded;
 
-  TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - saved_buffer));
+  TRACE("difference = 0x%lx\n", (ULONG)(pStubMsg->Buffer - saved_buffer));
   if (!pStubMsg->PointerBufferMark)
   {
     /* save it for use by embedded pointer code later */
@@ -4362,10 +4362,10 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
   pFormat += 4;
 
   pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def);
-  TRACE("conformance = %ld\n", pStubMsg->MaxCount);
+  TRACE("conformance = %Id\n", pStubMsg->MaxCount);
 
   pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
-  TRACE("variance = %d\n", pStubMsg->ActualCount);
+  TRACE("variance = %ld\n", pStubMsg->ActualCount);
 
   count = pStubMsg->ActualCount;
   for (i = 0; i < count; i++)
@@ -4533,7 +4533,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
     align_length(&pStubMsg->BufferLength, (flags & 0xf) + 1);
 
   if (bufsize) {
-    TRACE("size=%d\n", bufsize);
+    TRACE("size=%ld\n", bufsize);
     safe_buffer_length_increment(pStubMsg, bufsize);
   }
   else
@@ -4612,7 +4612,7 @@ RPC_STATUS RPC_ENTRY NdrGetUserMarshalInfo(ULONG *flags, ULONG level, NDR_USER_M
 {
     USER_MARSHAL_CB *umcb = CONTAINING_RECORD(flags, USER_MARSHAL_CB, Flags);
 
-    TRACE("(%p,%u,%p)\n", flags, level, umi);
+    TRACE("(%p,%lu,%p)\n", flags, level, umi);
 
     if (level != 1)
         return RPC_S_INVALID_ARG;
@@ -4680,7 +4680,7 @@ void WINAPI NdrConvert( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat )
  */
 void WINAPI NdrConvert2( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, LONG NumberParams )
 {
-  FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %d): stub.\n",
+  FIXME("(pStubMsg == ^%p, pFormat == ^%p, NumberParams == %ld): stub.\n",
     pStubMsg, pFormat, NumberParams);
   /* FIXME: since this stub doesn't do any converting, the proper behavior
      is to raise an exception */
@@ -4739,7 +4739,7 @@ unsigned char *  WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
     bufsize = safe_multiply(esize, pStubMsg->MaxCount);
     if (pCStructFormat->memory_size + bufsize < pCStructFormat->memory_size) /* integer overflow */
     {
-        ERR("integer overflow of memory_size %u with bufsize %u\n",
+        ERR("integer overflow of memory_size %u with bufsize %lu\n",
             pCStructFormat->memory_size, bufsize);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
@@ -4794,7 +4794,7 @@ unsigned char *  WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs
     bufsize = safe_multiply(esize, pStubMsg->MaxCount);
     if (pCStructFormat->memory_size + bufsize < pCStructFormat->memory_size) /* integer overflow */
     {
-        ERR("integer overflow of memory_size %u with bufsize %u\n",
+        ERR("integer overflow of memory_size %u with bufsize %lu\n",
             pCStructFormat->memory_size, bufsize);
         RpcRaiseException(RPC_X_BAD_STUB_DATA);
     }
@@ -5706,13 +5706,13 @@ static PFORMAT_STRING get_arm_offset_from_union_arm_selector(PMIDL_STUB_MESSAGE
     {
         if(type == 0xffff)
         {
-            ERR("no arm for 0x%x and no default case\n", discriminant);
+            ERR("no arm for 0x%lx and no default case\n", discriminant);
             RpcRaiseException(RPC_S_INVALID_TAG);
             return NULL;
         }
         if(type == 0)
         {
-            TRACE("falling back to empty default case for 0x%x\n", discriminant);
+            TRACE("falling back to empty default case for 0x%lx\n", discriminant);
             return NULL;
         }
     }
@@ -6032,7 +6032,7 @@ unsigned char *  WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg
     align_pointer_clear(&pStubMsg->Buffer, increment);
 
     switch_value = get_discriminant(switch_type, pMemory);
-    TRACE("got switch value 0x%x\n", switch_value);
+    TRACE("got switch value 0x%lx\n", switch_value);
 
     NdrBaseTypeMarshall(pStubMsg, pMemory, &switch_type);
     pMemory += increment;
@@ -6063,7 +6063,7 @@ unsigned char *  WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubM
 
     align_pointer(&pStubMsg->Buffer, increment);
     switch_value = get_discriminant(switch_type, pStubMsg->Buffer);
-    TRACE("got switch value 0x%x\n", switch_value);
+    TRACE("got switch value 0x%lx\n", switch_value);
 
     size = *(const unsigned short*)pFormat + increment;
     if (!fMustAlloc && !*ppMemory)
@@ -6105,7 +6105,7 @@ void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
 
     align_length(&pStubMsg->BufferLength, increment);
     switch_value = get_discriminant(switch_type, pMemory);
-    TRACE("got switch value 0x%x\n", switch_value);
+    TRACE("got switch value 0x%lx\n", switch_value);
 
     /* Add discriminant size */
     NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&switch_value, &switch_type);
@@ -6130,7 +6130,7 @@ ULONG WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
 
     align_pointer(&pStubMsg->Buffer, increment);
     switch_value = get_discriminant(switch_type, pStubMsg->Buffer);
-    TRACE("got switch value 0x%x\n", switch_value);
+    TRACE("got switch value 0x%lx\n", switch_value);
 
     pStubMsg->Memory += increment;
 
@@ -6156,7 +6156,7 @@ void WINAPI NdrEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
     pFormat++;
 
     switch_value = get_discriminant(switch_type, pMemory);
-    TRACE("got switch value 0x%x\n", switch_value);
+    TRACE("got switch value 0x%lx\n", switch_value);
 
     pMemory += increment;
 
@@ -6179,7 +6179,7 @@ unsigned char *  WINAPI NdrNonEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStub
     pFormat++;
 
     pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
-    TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
+    TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
     /* Marshall discriminant */
     NdrBaseTypeMarshall(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
 
@@ -6248,7 +6248,7 @@ unsigned char *  WINAPI NdrNonEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pSt
 
     /* Unmarshall discriminant */
     discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
-    TRACE("unmarshalled discriminant %x\n", discriminant);
+    TRACE("unmarshalled discriminant %lx\n", discriminant);
 
     pFormat += *(const SHORT*)pFormat;
 
@@ -6286,7 +6286,7 @@ void WINAPI NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
     pFormat++;
 
     pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
-    TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
+    TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
     /* Add discriminant size */
     NdrBaseTypeBufferSize(pStubMsg, (unsigned char *)&pStubMsg->MaxCount, &switch_type);
 
@@ -6304,7 +6304,7 @@ ULONG WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
     pFormat++;
     /* Unmarshall discriminant */
     discriminant = unmarshall_discriminant(pStubMsg, &pFormat);
-    TRACE("unmarshalled discriminant 0x%x\n", discriminant);
+    TRACE("unmarshalled discriminant 0x%lx\n", discriminant);
 
     return union_arm_memory_size(pStubMsg, discriminant, pFormat + *(const SHORT*)pFormat);
 }
@@ -6321,7 +6321,7 @@ void WINAPI NdrNonEncapsulatedUnionFree(PMIDL_STUB_MESSAGE pStubMsg,
     pFormat++;
 
     pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, 0);
-    TRACE("got switch value 0x%lx\n", pStubMsg->MaxCount);
+    TRACE("got switch value 0x%Ix\n", pStubMsg->MaxCount);
 
     union_arm_free(pStubMsg, pMemory, pStubMsg->MaxCount, pFormat + *(const SHORT*)pFormat);
 }
@@ -6479,7 +6479,7 @@ unsigned char *WINAPI NdrRangeUnmarshall(
     }
     base_type = pRange->flags_type & 0xf;
 
-    TRACE("base_type = 0x%02x, low_value = %d, high_value = %d\n",
+    TRACE("base_type = 0x%02x, low_value = %ld, high_value = %ld\n",
         base_type, pRange->low_value, pRange->high_value);
 
 #define RANGE_UNMARSHALL(mem_type, wire_type, format_spec) \
@@ -6533,12 +6533,12 @@ unsigned char *WINAPI NdrRangeUnmarshall(
         break;
     case FC_LONG:
     case FC_ENUM32:
-        RANGE_UNMARSHALL(LONG, LONG, "%d");
-        TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
+        RANGE_UNMARSHALL(LONG, LONG, "%ld");
+        TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
         break;
     case FC_ULONG:
-        RANGE_UNMARSHALL(ULONG, ULONG, "%u");
-        TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
+        RANGE_UNMARSHALL(ULONG, ULONG, "%lu");
+        TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
         break;
     case FC_ENUM16:
         RANGE_UNMARSHALL(UINT, USHORT, "%u");
@@ -6643,7 +6643,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
     case FC_ENUM32:
         align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG));
         safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG));
-        TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
+        TRACE("value: 0x%08lx\n", *(ULONG *)pMemory);
         break;
     case FC_FLOAT:
         align_pointer_clear(&pStubMsg->Buffer, sizeof(float));
@@ -6735,7 +6735,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
     case FC_ERROR_STATUS_T:
     case FC_ENUM32:
         BASE_TYPE_UNMARSHALL(ULONG);
-        TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
+        TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory);
         break;
    case FC_FLOAT:
         BASE_TYPE_UNMARSHALL(float);
@@ -6775,7 +6775,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
                 *ppMemory = NdrAllocate(pStubMsg, sizeof(INT_PTR));
             safe_copy_from_buffer(pStubMsg, &val, sizeof(INT));
             **(INT_PTR **)ppMemory = val;
-            TRACE("value: 0x%08lx\n", **(INT_PTR **)ppMemory);
+            TRACE("value: 0x%08Ix\n", **(INT_PTR **)ppMemory);
         }
         break;
     case FC_UINT3264:
@@ -6790,7 +6790,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
                 *ppMemory = NdrAllocate(pStubMsg, sizeof(UINT_PTR));
             safe_copy_from_buffer(pStubMsg, &val, sizeof(UINT));
             **(UINT_PTR **)ppMemory = val;
-            TRACE("value: 0x%08lx\n", **(UINT_PTR **)ppMemory);
+            TRACE("value: 0x%08Ix\n", **(UINT_PTR **)ppMemory);
         }
         break;
     case FC_IGNORE:
@@ -7263,7 +7263,7 @@ void WINAPI NdrCorrelationInitialize(PMIDL_STUB_MESSAGE pStubMsg, void *pMemory,
     static int once;
 
     if (!once++)
-        FIXME("(%p, %p, %d, 0x%x): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
+        FIXME("(%p, %p, %ld, 0x%lx): semi-stub\n", pStubMsg, pMemory, CacheSize, Flags);
 
     if (pStubMsg->CorrDespIncrement == 0)
         pStubMsg->CorrDespIncrement = 2; /* size of the normal (non-range) /robust payload */
diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c
index c8026c0ff15..c5e0b34ecc5 100644
--- a/dlls/rpcrt4/ndr_ole.c
+++ b/dlls/rpcrt4/ndr_ole.c
@@ -116,7 +116,7 @@ static ULONG WINAPI RpcStream_Release(LPSTREAM iface)
   RpcStreamImpl *This = impl_from_IStream(iface);
   ULONG ref = InterlockedDecrement( &This->RefCount );
   if (!ref) {
-    TRACE("size=%d\n", *This->size);
+    TRACE("size=%ld\n", *This->size);
     This->pMsg->Buffer = This->data + *This->size;
     HeapFree(GetProcessHeap(),0,This);
   }
@@ -203,7 +203,7 @@ static HRESULT WINAPI RpcStream_CopyTo(IStream *iface, IStream *dest,
 static HRESULT WINAPI RpcStream_Commit(IStream *iface, DWORD flags)
 {
   RpcStreamImpl *This = impl_from_IStream(iface);
-  FIXME("(%p)->(0x%08x): stub\n", This, flags);
+  FIXME("(%p)->(0x%08lx): stub\n", This, flags);
   return E_NOTIMPL;
 }
 
@@ -276,7 +276,7 @@ static HRESULT RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init, ULONG *s
   This->data = pStubMsg->Buffer + sizeof(DWORD);
   This->pos = 0;
   if (init) *This->size = 0;
-  TRACE("init size=%d\n", *This->size);
+  TRACE("init size=%ld\n", *This->size);
 
   if (size) *size = *This->size;
   *stream = &This->IStream_iface;
@@ -382,7 +382,7 @@ void WINAPI NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
   COM_GetMarshalSizeMax(&size, riid, (LPUNKNOWN)pMemory,
                         pStubMsg->dwDestContext, pStubMsg->pvDestContext,
                         MSHLFLAGS_NORMAL);
-  TRACE("size=%d\n", size);
+  TRACE("size=%ld\n", size);
   pStubMsg->BufferLength += sizeof(DWORD) + size;
 }
 
diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index 815b8ecce23..e15c93d2310 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -184,7 +184,7 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
         break;
     case FC_BOGUS_ARRAY:
         pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]);
-        TRACE("conformance = %ld\n", pStubMsg->MaxCount);
+        TRACE("conformance = %Id\n", pStubMsg->MaxCount);
         pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount);
         size = ComplexStructSize(pStubMsg, pFormat);
         size *= pStubMsg->MaxCount;
@@ -873,7 +873,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
 
     TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat);
 
-    TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
+    TRACE("NDR Version: 0x%lx\n", pStubDesc->Version);
 
     if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
     {
@@ -891,7 +891,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
     TRACE("stack size: 0x%x\n", stack_size);
     TRACE("proc num: %d\n", procedure_number);
     TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
-    TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
+    TRACE("MIDL stub version = 0x%lx\n", pStubDesc->MIDLVersion);
 
     pHandleFormat = pFormat;
 
@@ -998,7 +998,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
                 number_of_params, Oif_flags, ext_flags, pProcHeader);
     }
 
-    TRACE("RetVal = 0x%lx\n", RetVal);
+    TRACE("RetVal = 0x%Ix\n", RetVal);
     return RetVal;
 }
 
@@ -1344,7 +1344,7 @@ LONG WINAPI NdrStubCall2(
     pFormat = pServerInfo->ProcString + pServerInfo->FmtStringOffset[pRpcMsg->ProcNum];
     pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
 
-    TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
+    TRACE("NDR Version: 0x%lx\n", pStubDesc->Version);
 
     if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
     {
@@ -1496,7 +1496,7 @@ LONG WINAPI NdrStubCall2(
 
                 if (retval_ptr)
                 {
-                    TRACE("stub implementation returned 0x%lx\n", retval);
+                    TRACE("stub implementation returned 0x%Ix\n", retval);
                     *retval_ptr = retval;
                 }
                 else
@@ -1616,7 +1616,7 @@ static void do_ndr_async_client_call( const MIDL_STUB_DESC *pStubDesc, PFORMAT_S
     /* Later NDR language versions probably won't be backwards compatible */
     if (pStubDesc->Version > 0x60001)
     {
-        FIXME("Incompatible stub description version: 0x%x\n", pStubDesc->Version);
+        FIXME("Incompatible stub description version: 0x%lx\n", pStubDesc->Version);
         RpcRaiseException(RPC_X_WRONG_STUB_VERSION);
     }
 
@@ -1657,7 +1657,7 @@ static void do_ndr_async_client_call( const MIDL_STUB_DESC *pStubDesc, PFORMAT_S
     NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDesc, procedure_number);
 
     TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
-    TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion);
+    TRACE("MIDL stub version = 0x%lx\n", pStubDesc->MIDLVersion);
 
     /* needed for conformance of top-level objects */
     pStubMsg->StackTop = I_RpcAllocate(async_call_data->stack_size);
@@ -1808,7 +1808,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
         }
         __EXCEPT_ALL
         {
-            FIXME("exception %x during ndr_async_client_call()\n", GetExceptionCode());
+            FIXME("exception %lx during ndr_async_client_call()\n", GetExceptionCode());
             ret = GetExceptionCode();
         }
         __ENDTRY
@@ -1816,7 +1816,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
     else
         do_ndr_async_client_call( pStubDesc, pFormat, stack_top);
 
-    TRACE("returning %ld\n", ret);
+    TRACE("returning %Id\n", ret);
     return ret;
 }
 
@@ -1897,7 +1897,7 @@ cleanup:
     I_RpcFree(pStubMsg->StackTop);
     I_RpcFree(async_call_data);
 
-    TRACE("-- 0x%x\n", status);
+    TRACE("-- 0x%lx\n", status);
     return status;
 }
 
@@ -1963,7 +1963,7 @@ void RPC_ENTRY NdrAsyncServerCall(PRPC_MESSAGE pRpcMsg)
     pFormat = pServerInfo->ProcString + pServerInfo->FmtStringOffset[pRpcMsg->ProcNum];
     pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0];
 
-    TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
+    TRACE("NDR Version: 0x%lx\n", pStubDesc->Version);
 
     async_call_data = I_RpcAllocate(sizeof(*async_call_data) + sizeof(MIDL_STUB_MESSAGE) + sizeof(RPC_MESSAGE));
     if (!async_call_data) RpcRaiseException(RPC_X_NO_MEMORY);
@@ -2143,7 +2143,7 @@ RPC_STATUS NdrpCompleteAsyncServerCall(RPC_ASYNC_STATE *pAsync, void *Reply)
 
     if (async_call_data->retval_ptr)
     {
-        TRACE("stub implementation returned 0x%lx\n", *(LONG_PTR *)Reply);
+        TRACE("stub implementation returned 0x%Ix\n", *(LONG_PTR *)Reply);
         *async_call_data->retval_ptr = *(LONG_PTR *)Reply;
     }
     else
@@ -2219,7 +2219,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr64_client_call( MIDL_STUBLESS_PROXY_INFO *info
 {
     ULONG_PTR i;
 
-    TRACE("info %p, proc %u, retval %p, stack_top %p, fpu_stack %p\n",
+    TRACE("info %p, proc %lu, retval %p, stack_top %p, fpu_stack %p\n",
             info, proc, retval, stack_top, fpu_stack);
 
     for (i = 0; i < info->nCount; ++i)
@@ -2279,7 +2279,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr64_async_client_call( MIDL_STUBLESS_PROXY_INFO
 {
     ULONG_PTR i;
 
-    TRACE("info %p, proc %u, retval %p, stack_top %p, fpu_stack %p\n",
+    TRACE("info %p, proc %lu, retval %p, stack_top %p, fpu_stack %p\n",
             info, proc, retval, stack_top, fpu_stack);
 
     for (i = 0; i < info->nCount; ++i)
diff --git a/dlls/rpcrt4/ndr_typelib.c b/dlls/rpcrt4/ndr_typelib.c
index f1f25885b75..ff1d1025838 100644
--- a/dlls/rpcrt4/ndr_typelib.c
+++ b/dlls/rpcrt4/ndr_typelib.c
@@ -1318,7 +1318,7 @@ static ULONG WINAPI typelib_proxy_Release(IRpcProxyBuffer *iface)
     struct typelib_proxy *proxy = CONTAINING_RECORD(iface, struct typelib_proxy, proxy.IRpcProxyBuffer_iface);
     ULONG refcount = InterlockedDecrement(&proxy->proxy.RefCount);
 
-    TRACE("(%p) decreasing refs to %d\n", proxy, refcount);
+    TRACE("(%p) decreasing refs to %ld\n", proxy, refcount);
 
     if (!refcount)
     {
@@ -1455,7 +1455,7 @@ static ULONG WINAPI typelib_stub_Release(IRpcStubBuffer *iface)
     struct typelib_stub *stub = CONTAINING_RECORD(iface, struct typelib_stub, stub.stub_buffer);
     ULONG refcount = InterlockedDecrement(&stub->stub.stub_buffer.RefCount);
 
-    TRACE("(%p) decreasing refs to %d\n", stub, refcount);
+    TRACE("(%p) decreasing refs to %ld\n", stub, refcount);
 
     if (!refcount)
     {
@@ -1488,7 +1488,7 @@ static HRESULT typelib_stub_init(struct typelib_stub *stub, IUnknown *server,
             (void **)&stub->stub.stub_buffer.pvServerObject);
     if (FAILED(hr))
     {
-        WARN("Failed to get interface %s, hr %#x.\n",
+        WARN("Failed to get interface %s, hr %#lx.\n",
                 debugstr_guid(stub->stub_vtbl.header.piid), hr);
         stub->stub.stub_buffer.pvServerObject = server;
         IUnknown_AddRef(server);
diff --git a/dlls/rpcrt4/rpc_assoc.c b/dlls/rpcrt4/rpc_assoc.c
index ab865c2de14..80851c8cddd 100644
--- a/dlls/rpcrt4/rpc_assoc.c
+++ b/dlls/rpcrt4/rpc_assoc.c
@@ -251,7 +251,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
     status = RPCRT4_ReceiveWithAuth(conn, &response_hdr, &msg, &auth_data, &auth_length);
     if (status != RPC_S_OK)
     {
-        ERR("receive failed with error %d\n", status);
+        ERR("receive failed with error %ld\n", status);
         return status;
     }
 
diff --git a/dlls/rpcrt4/rpc_async.c b/dlls/rpcrt4/rpc_async.c
index 00c2d6bede8..d194496812b 100644
--- a/dlls/rpcrt4/rpc_async.c
+++ b/dlls/rpcrt4/rpc_async.c
@@ -143,7 +143,7 @@ RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply)
  */
 RPC_STATUS WINAPI RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode)
 {
-    FIXME("(%p, %d/0x%x): stub\n", pAsync, ExceptionCode, ExceptionCode);
+    FIXME("(%p, %ld/0x%lx): stub\n", pAsync, ExceptionCode, ExceptionCode);
     return RPC_S_INVALID_ASYNC_HANDLE;
 }
 
diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index 56502e4eb34..ba7ef418419 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -1390,7 +1390,7 @@ BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQuali
     if (!qos1 || !qos2)
         return FALSE;
 
-    TRACE("qos1 = { %d %d %d %d }, qos2 = { %d %d %d %d }\n",
+    TRACE("qos1 = { %ld %ld %ld %ld }, qos2 = { %ld %ld %ld %ld }\n",
         qos1->qos->Capabilities, qos1->qos->IdentityTracking,
         qos1->qos->ImpersonationType, qos1->qos->AdditionalSecurityInfoType,
         qos2->qos->Capabilities, qos2->qos->IdentityTracking,
@@ -1481,7 +1481,7 @@ RpcBindingInqAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName,
     RPC_STATUS status;
     RPC_WSTR principal;
 
-    TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
+    TRACE("%p %p %p %p %p %p %lu %p\n", Binding, ServerPrincName, AuthnLevel,
           AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
 
     status = RpcBindingInqAuthInfoExW(Binding, ServerPrincName ? &principal : NULL, AuthnLevel,
@@ -1506,7 +1506,7 @@ RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName,
 {
     RpcBinding *bind = Binding;
 
-    TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel,
+    TRACE("%p %p %p %p %p %p %lu %p\n", Binding, ServerPrincName, AuthnLevel,
           AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS);
 
     if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH;
@@ -1595,7 +1595,7 @@ RpcBindingInqAuthClientExA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
     RPC_STATUS status;
     RPC_WSTR principal;
 
-    TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
+    TRACE("%p %p %p %p %p %p 0x%lx\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
           AuthnSvc, AuthzSvc, Flags);
 
     status = RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName ? &principal : NULL,
@@ -1620,7 +1620,7 @@ RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
 {
     RpcBinding *bind;
 
-    TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
+    TRACE("%p %p %p %p %p %p 0x%lx\n", ClientBinding, Privs, ServerPrincName, AuthnLevel,
           AuthnSvc, AuthzSvc, Flags);
 
     if (!ClientBinding) ClientBinding = I_RpcGetCurrentCallHandle();
@@ -1676,21 +1676,21 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
   PSecPkgInfoA packages;
   ULONG cbMaxToken;
 
-  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_a((const char*)ServerPrincName),
+  TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_a((const char*)ServerPrincName),
         AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
 
   if (SecurityQos)
   {
       RPC_STATUS status;
 
-      TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
+      TRACE("SecurityQos { Version=%ld, Capabilities=0x%lx, IdentityTracking=%ld, ImpersonationLevel=%ld",
             SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
       if (SecurityQos->Version >= 2)
       {
           const RPC_SECURITY_QOS_V2_A *SecurityQos2 = (const RPC_SECURITY_QOS_V2_A *)SecurityQos;
-          TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
+          TRACE(", AdditionalSecurityInfoType=%ld", SecurityQos2->AdditionalSecurityInfoType);
           if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
-              TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
+              TRACE(", { %p, 0x%lx, %ld, %ld, %p(%lu), %s }",
                     SecurityQos2->u.HttpCredentials->TransportCredentials,
                     SecurityQos2->u.HttpCredentials->Flags,
                     SecurityQos2->u.HttpCredentials->AuthenticationTarget,
@@ -1726,21 +1726,21 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
 
   if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
   {
-    FIXME("unknown AuthnLevel %u\n", AuthnLevel);
+    FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
     return RPC_S_UNKNOWN_AUTHN_LEVEL;
   }
 
   /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
   if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
   {
-    FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
+    FIXME("unsupported AuthzSvr %lu\n", AuthzSvr);
     return RPC_S_UNKNOWN_AUTHZ_SERVICE;
   }
 
   r = EnumerateSecurityPackagesA(&package_count, &packages);
   if (r != SEC_E_OK)
   {
-    ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", r);
+    ERR("EnumerateSecurityPackagesA failed with error 0x%08lx\n", r);
     return RPC_S_SEC_PKG_ERROR;
   }
 
@@ -1750,12 +1750,12 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
 
   if (i == package_count)
   {
-    FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
+    FIXME("unsupported AuthnSvc %lu\n", AuthnSvc);
     FreeContextBuffer(packages);
     return RPC_S_UNKNOWN_AUTHN_SERVICE;
   }
 
-  TRACE("found package %s for service %u\n", packages[i].Name, AuthnSvc);
+  TRACE("found package %s for service %lu\n", packages[i].Name, AuthnSvc);
   r = AcquireCredentialsHandleA(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
                                 AuthIdentity, NULL, NULL, &cred, &exp);
   cbMaxToken = packages[i].cbMaxToken;
@@ -1785,7 +1785,7 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName,
   }
   else
   {
-    ERR("AcquireCredentialsHandleA failed with error 0x%08x\n", r);
+    ERR("AcquireCredentialsHandleA failed with error 0x%08lx\n", r);
     return RPC_S_SEC_PKG_ERROR;
   }
 }
@@ -1807,21 +1807,21 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
   PSecPkgInfoW packages;
   ULONG cbMaxToken;
 
-  TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName),
+  TRACE("%p %s %lu %lu %p %lu %p\n", Binding, debugstr_w(ServerPrincName),
         AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos);
 
   if (SecurityQos)
   {
       RPC_STATUS status;
 
-      TRACE("SecurityQos { Version=%d, Capabilities=0x%x, IdentityTracking=%d, ImpersonationLevel=%d",
+      TRACE("SecurityQos { Version=%ld, Capabilities=0x%lx, IdentityTracking=%ld, ImpersonationLevel=%ld",
             SecurityQos->Version, SecurityQos->Capabilities, SecurityQos->IdentityTracking, SecurityQos->ImpersonationType);
       if (SecurityQos->Version >= 2)
       {
           const RPC_SECURITY_QOS_V2_W *SecurityQos2 = (const RPC_SECURITY_QOS_V2_W *)SecurityQos;
-          TRACE(", AdditionalSecurityInfoType=%d", SecurityQos2->AdditionalSecurityInfoType);
+          TRACE(", AdditionalSecurityInfoType=%ld", SecurityQos2->AdditionalSecurityInfoType);
           if (SecurityQos2->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)
-              TRACE(", { %p, 0x%x, %d, %d, %p(%u), %s }",
+              TRACE(", { %p, 0x%lx, %ld, %ld, %p(%lu), %s }",
                     SecurityQos2->u.HttpCredentials->TransportCredentials,
                     SecurityQos2->u.HttpCredentials->Flags,
                     SecurityQos2->u.HttpCredentials->AuthenticationTarget,
@@ -1857,21 +1857,21 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
 
   if (AuthnLevel > RPC_C_AUTHN_LEVEL_PKT_PRIVACY)
   {
-    FIXME("unknown AuthnLevel %u\n", AuthnLevel);
+    FIXME("unknown AuthnLevel %lu\n", AuthnLevel);
     return RPC_S_UNKNOWN_AUTHN_LEVEL;
   }
 
   /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */
   if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT)
   {
-    FIXME("unsupported AuthzSvr %u\n", AuthzSvr);
+    FIXME("unsupported AuthzSvr %lu\n", AuthzSvr);
     return RPC_S_UNKNOWN_AUTHZ_SERVICE;
   }
 
   r = EnumerateSecurityPackagesW(&package_count, &packages);
   if (r != SEC_E_OK)
   {
-    ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", r);
+    ERR("EnumerateSecurityPackagesW failed with error 0x%08lx\n", r);
     return RPC_S_SEC_PKG_ERROR;
   }
 
@@ -1881,12 +1881,12 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
 
   if (i == package_count)
   {
-    FIXME("unsupported AuthnSvc %u\n", AuthnSvc);
+    FIXME("unsupported AuthnSvc %lu\n", AuthnSvc);
     FreeContextBuffer(packages);
     return RPC_S_UNKNOWN_AUTHN_SERVICE;
   }
 
-  TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), AuthnSvc);
+  TRACE("found package %s for service %lu\n", debugstr_w(packages[i].Name), AuthnSvc);
   r = AcquireCredentialsHandleW(NULL, packages[i].Name, SECPKG_CRED_OUTBOUND, NULL,
                                 AuthIdentity, NULL, NULL, &cred, &exp);
   cbMaxToken = packages[i].cbMaxToken;
@@ -1916,7 +1916,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName,
   }
   else
   {
-    ERR("AcquireCredentialsHandleW failed with error 0x%08x\n", r);
+    ERR("AcquireCredentialsHandleW failed with error 0x%08lx\n", r);
     return RPC_S_SEC_PKG_ERROR;
   }
 }
@@ -1928,7 +1928,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
 RpcBindingSetAuthInfoA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, ULONG AuthnLevel,
                         ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
 {
-    TRACE("%p %s %u %u %p %u\n", Binding, debugstr_a((const char*)ServerPrincName),
+    TRACE("%p %s %lu %lu %p %lu\n", Binding, debugstr_a((const char*)ServerPrincName),
           AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
     return RpcBindingSetAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
 }
@@ -1940,7 +1940,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
 RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel,
                         ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr )
 {
-    TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName),
+    TRACE("%p %s %lu %lu %p %lu\n", Binding, debugstr_w(ServerPrincName),
           AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr);
     return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL);
 }
@@ -1950,7 +1950,7 @@ RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, UL
  */
 RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Option, ULONG_PTR OptionValue)
 {
-    TRACE("(%p, %d, %ld)\n", BindingHandle, Option, OptionValue);
+    TRACE("(%p, %ld, %Id)\n", BindingHandle, Option, OptionValue);
 
     switch (Option)
     {
@@ -1969,7 +1969,7 @@ RPC_STATUS WINAPI RpcBindingSetOption(RPC_BINDING_HANDLE BindingHandle, ULONG Op
         break;
     }
     default:
-        FIXME("option %u not supported\n", Option);
+        FIXME("option %lu not supported\n", Option);
         break;
     }
     return RPC_S_OK;
diff --git a/dlls/rpcrt4/rpc_epmap.c b/dlls/rpcrt4/rpc_epmap.c
index 35af454ce95..2ef5f6a8860 100644
--- a/dlls/rpcrt4/rpc_epmap.c
+++ b/dlls/rpcrt4/rpc_epmap.c
@@ -116,7 +116,7 @@ static BOOL start_rpcss(void)
         } while (status.dwCurrentState == SERVICE_START_PENDING);
 
         if (status.dwCurrentState != SERVICE_RUNNING)
-            WARN( "RpcSs failed to start %u\n", status.dwCurrentState );
+            WARN( "RpcSs failed to start %lu\n", status.dwCurrentState );
     }
     else ERR( "failed to start RpcSs service\n" );
 
@@ -206,12 +206,12 @@ static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bindin
   TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
   for (i=0; i<BindingVector->Count; i++) {
     RpcBinding* bind = BindingVector->BindingH[i];
-    TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
-    TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
+    TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
+    TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
   }
   if (UuidVector) {
     for (i=0; i<UuidVector->Count; i++)
-      TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
+      TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
   }
 
   if (!BindingVector->Count) return RPC_S_OK;
@@ -270,7 +270,7 @@ static RPC_STATUS epm_register( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bindin
                   continue;
           }
           if (status2 != RPC_S_OK)
-              ERR("ept_insert failed with error %d\n", status2);
+              ERR("ept_insert failed with error %ld\n", status2);
           status = status2; /* FIXME: convert status? */
           break;
       }
@@ -354,12 +354,12 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
   TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
   for (i=0; i<BindingVector->Count; i++) {
     RpcBinding* bind = BindingVector->BindingH[i];
-    TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
-    TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
+    TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
+    TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
   }
   if (UuidVector) {
     for (i=0; i<UuidVector->Count; i++)
-      TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
+      TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
   }
 
   entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1));
@@ -407,7 +407,7 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
       if (status2 == RPC_S_SERVER_UNAVAILABLE)
           status2 = EPT_S_NOT_REGISTERED;
       if (status2 != RPC_S_OK)
-          ERR("ept_insert failed with error %d\n", status2);
+          ERR("ept_insert failed with error %ld\n", status2);
       status = status2; /* FIXME: convert status? */
   }
   RpcBindingFree(&handle);
@@ -501,7 +501,7 @@ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE
     if (!resolved_endpoint)
     {
       status = TowerExplode(towers[i], NULL, NULL, NULL, &resolved_endpoint, NULL);
-      TRACE("status = %d\n", status);
+      TRACE("status = %ld\n", status);
     }
     I_RpcFree(towers[i]);
   }
diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c
index 59cd438a26a..4a6ebf434f2 100644
--- a/dlls/rpcrt4/rpc_message.c
+++ b/dlls/rpcrt4/rpc_message.c
@@ -524,7 +524,7 @@ BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data,
         data_len -= 24;
         break;
       default:
-        FIXME("unimplemented type 0x%x\n", type);
+        FIXME("unimplemented type 0x%lx\n", type);
         break;
     }
   }
@@ -554,7 +554,7 @@ static unsigned char *RPCRT4_NextHttpHeaderField(unsigned char *data)
     case 0x1:
       return data + 24;
     default:
-      FIXME("unimplemented type 0x%x\n", type);
+      FIXME("unimplemented type 0x%lx\n", type);
       return data;
   }
 }
@@ -580,7 +580,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x00000002)
   {
-    ERR("invalid type 0x%08x\n", type);
+    ERR("invalid type 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   *field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -608,7 +608,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x00000006)
   {
-    ERR("invalid type for field 1: 0x%08x\n", type);
+    ERR("invalid type for field 1: 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   *field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -617,7 +617,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x00000000)
   {
-    ERR("invalid type for field 2: 0x%08x\n", type);
+    ERR("invalid type for field 2: 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   *bytes_until_next_packet = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -626,7 +626,7 @@ RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x00000002)
   {
-    ERR("invalid type for field 3: 0x%08x\n", type);
+    ERR("invalid type for field 3: 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   *field3 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -655,12 +655,12 @@ RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x0000000d)
   {
-    ERR("invalid type for field 1: 0x%08x\n", type);
+    ERR("invalid type for field 1: 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   if (*(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data) != (server ? 0x3 : 0x0))
   {
-    ERR("invalid type for 0xd field data: 0x%08x\n", *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data));
+    ERR("invalid type for 0xd field data: 0x%08lx\n", *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data));
     return RPC_S_PROTOCOL_ERROR;
   }
   data = RPCRT4_NextHttpHeaderField(data);
@@ -668,7 +668,7 @@ RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header,
   type = READ_HTTP_PAYLOAD_FIELD_TYPE(data);
   if (type != 0x00000001)
   {
-    ERR("invalid type for field 2: 0x%08x\n", type);
+    ERR("invalid type for field 2: 0x%08lx\n", type);
     return RPC_S_PROTOCOL_ERROR;
   }
   *bytes_transmitted = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data);
@@ -714,7 +714,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
             sec_status = EncryptMessage(&Connection->ctx, 0, &message, 0 /* FIXME */);
             if (sec_status != SEC_E_OK)
             {
-                ERR("EncryptMessage failed with 0x%08x\n", sec_status);
+                ERR("EncryptMessage failed with 0x%08lx\n", sec_status);
                 return RPC_S_SEC_PKG_ERROR;
             }
         }
@@ -723,7 +723,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
             sec_status = MakeSignature(&Connection->ctx, 0, &message, 0 /* FIXME */);
             if (sec_status != SEC_E_OK)
             {
-                ERR("MakeSignature failed with 0x%08x\n", sec_status);
+                ERR("MakeSignature failed with 0x%08lx\n", sec_status);
                 return RPC_S_SEC_PKG_ERROR;
             }
         }
@@ -735,7 +735,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
             sec_status = DecryptMessage(&Connection->ctx, &message, 0 /* FIXME */, 0);
             if (sec_status != SEC_E_OK)
             {
-                ERR("DecryptMessage failed with 0x%08x\n", sec_status);
+                ERR("DecryptMessage failed with 0x%08lx\n", sec_status);
                 return RPC_S_SEC_PKG_ERROR;
             }
         }
@@ -744,7 +744,7 @@ RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection,
             sec_status = VerifySignature(&Connection->ctx, &message, 0 /* FIXME */, NULL);
             if (sec_status != SEC_E_OK)
             {
-                ERR("VerifySignature failed with 0x%08x\n", sec_status);
+                ERR("VerifySignature failed with 0x%08lx\n", sec_status);
                 return RPC_S_SEC_PKG_ERROR;
             }
         }
@@ -945,11 +945,11 @@ RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time,
   }
   if (FAILED(r))
   {
-      WARN("InitializeSecurityContext failed with error 0x%08x\n", r);
+      WARN("InitializeSecurityContext failed with error 0x%08lx\n", r);
       goto failed;
   }
 
-  TRACE("r = 0x%08x, attr = 0x%08x\n", r, conn->attr);
+  TRACE("r = 0x%08lx, attr = 0x%08lx\n", r, conn->attr);
   continue_needed = ((r == SEC_I_CONTINUE_NEEDED) ||
                      (r == SEC_I_COMPLETE_AND_CONTINUE));
 
@@ -959,19 +959,19 @@ RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time,
       r = CompleteAuthToken(&conn->ctx, &out_desc);
       if (FAILED(r))
       {
-          WARN("CompleteAuthToken failed with error 0x%08x\n", r);
+          WARN("CompleteAuthToken failed with error 0x%08lx\n", r);
           goto failed;
       }
   }
 
-  TRACE("cbBuffer = %d\n", out.cbBuffer);
+  TRACE("cbBuffer = %ld\n", out.cbBuffer);
 
   if (!continue_needed)
   {
       r = QueryContextAttributesA(&conn->ctx, SECPKG_ATTR_SIZES, &secctx_sizes);
       if (FAILED(r))
       {
-          WARN("QueryContextAttributes failed with error 0x%08x\n", r);
+          WARN("QueryContextAttributes failed with error 0x%08lx\n", r);
           goto failed;
       }
       conn->signature_auth_len = secctx_sizes.cbMaxSignature;
@@ -997,7 +997,7 @@ RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge,
   unsigned char *out_buffer;
   unsigned int out_len = 0;
 
-  TRACE("challenge %s, %d bytes\n", challenge, count);
+  TRACE("challenge %s, %ld bytes\n", challenge, count);
 
   status = rpcrt4_conn_authorize(conn, FALSE, challenge, count, NULL, &out_len);
   if (status) return status;
@@ -1138,7 +1138,7 @@ RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn)
         return RPC_S_NO_CONTEXT_AVAILABLE;
     sec_status = ImpersonateSecurityContext(&conn->ctx);
     if (sec_status != SEC_E_OK)
-        WARN("ImpersonateSecurityContext returned 0x%08x\n", sec_status);
+        WARN("ImpersonateSecurityContext returned 0x%08lx\n", sec_status);
     switch (sec_status)
     {
     case SEC_E_UNSUPPORTED_FUNCTION:
@@ -1166,7 +1166,7 @@ RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn)
         return RPC_S_NO_CONTEXT_AVAILABLE;
     sec_status = RevertSecurityContext(&conn->ctx);
     if (sec_status != SEC_E_OK)
-        WARN("RevertSecurityContext returned 0x%08x\n", sec_status);
+        WARN("RevertSecurityContext returned 0x%08lx\n", sec_status);
     switch (sec_status)
     {
     case SEC_E_UNSUPPORTED_FUNCTION:
@@ -1210,7 +1210,7 @@ RPC_STATUS RPCRT4_default_inquire_auth_client(
         *authz_svc = RPC_C_AUTHZ_NONE;
     }
     if (flags)
-        FIXME("flags 0x%x not implemented\n", flags);
+        FIXME("flags 0x%lx not implemented\n", flags);
 
     return RPC_S_OK;
 }
@@ -1300,7 +1300,7 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
   /* read packet common header */
   dwRead = rpcrt4_conn_read(Connection, &common_hdr, sizeof(common_hdr));
   if (dwRead != sizeof(common_hdr)) {
-    WARN("Short read of header, %d bytes\n", dwRead);
+    WARN("Short read of header, %ld bytes\n", dwRead);
     status = RPC_S_CALL_FAILED;
     goto fail;
   }
@@ -1321,7 +1321,7 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
   /* read the rest of packet header */
   dwRead = rpcrt4_conn_read(Connection, &(*Header)->common + 1, hdr_length - sizeof(common_hdr));
   if (dwRead != hdr_length - sizeof(common_hdr)) {
-    WARN("bad header length, %d bytes, hdr_length %d\n", dwRead, hdr_length);
+    WARN("bad header length, %ld bytes, hdr_length %ld\n", dwRead, hdr_length);
     status = RPC_S_CALL_FAILED;
     goto fail;
   }
@@ -1338,7 +1338,7 @@ static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, Rpc
     dwRead = rpcrt4_conn_read(Connection, *Payload, common_hdr.frag_len - hdr_length);
     if (dwRead != common_hdr.frag_len - hdr_length)
     {
-      WARN("bad data length, %d/%d\n", dwRead, common_hdr.frag_len - hdr_length);
+      WARN("bad data length, %ld/%ld\n", dwRead, common_hdr.frag_len - hdr_length);
       status = RPC_S_CALL_FAILED;
       goto fail;
     }
@@ -1442,14 +1442,14 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
 
     if ((CurrentHeader->common.frag_len < hdr_length) ||
         (CurrentHeader->common.frag_len - hdr_length < header_auth_len)) {
-      WARN("frag_len %d too small for hdr_length %d and auth_len %d\n",
+      WARN("frag_len %d too small for hdr_length %ld and auth_len %d\n",
         CurrentHeader->common.frag_len, hdr_length, CurrentHeader->common.auth_len);
       status = RPC_S_PROTOCOL_ERROR;
       goto fail;
     }
 
     if (CurrentHeader->common.auth_len != auth_length) {
-      WARN("auth_len header field changed from %d to %d\n",
+      WARN("auth_len header field changed from %ld to %d\n",
         auth_length, CurrentHeader->common.auth_len);
       status = RPC_S_PROTOCOL_ERROR;
       goto fail;
@@ -1463,7 +1463,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
 
     data_length = CurrentHeader->common.frag_len - hdr_length - header_auth_len;
     if (data_length + buffer_length > pMsg->BufferLength) {
-      TRACE("allocation hint exceeded, new buffer length = %d\n",
+      TRACE("allocation hint exceeded, new buffer length = %ld\n",
         data_length + buffer_length);
       pMsg->BufferLength = data_length + buffer_length;
       status = I_RpcReAllocateBuffer(pMsg);
@@ -1741,7 +1741,7 @@ static DWORD WINAPI async_notifier_proc(LPVOID p)
             QueueUserAPC(async_apc_notifier_proc, state->u.APC.hThread, (ULONG_PTR)state);
             break;
         case RpcNotificationTypeIoc:
-            TRACE("RpcNotificationTypeIoc %p, 0x%x, 0x%lx, %p\n",
+            TRACE("RpcNotificationTypeIoc %p, 0x%lx, 0x%Ix, %p\n",
                 state->u.IOC.hIOPort, state->u.IOC.dwNumberOfBytesTransferred,
                 state->u.IOC.dwCompletionKey, state->u.IOC.lpOverlapped);
             PostQueuedCompletionStatus(state->u.IOC.hIOPort,
@@ -1867,7 +1867,7 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
   conn = pMsg->ReservedForRuntime;
   status = RPCRT4_Receive(conn, &hdr, pMsg);
   if (status != RPC_S_OK) {
-    WARN("receive failed with error %x\n", status);
+    WARN("receive failed with error %lx\n", status);
     goto fail;
   }
 
@@ -1976,6 +1976,6 @@ RPC_STATUS WINAPI I_RpcAsyncSetHandle(PRPC_MESSAGE pMsg, PRPC_ASYNC_STATE pAsync
  */
 RPC_STATUS WINAPI I_RpcAsyncAbortCall(PRPC_ASYNC_STATE pAsync, ULONG ExceptionCode)
 {
-    FIXME("(%p, %d): stub\n", pAsync, ExceptionCode);
+    FIXME("(%p, %ld): stub\n", pAsync, ExceptionCode);
     return RPC_S_INVALID_ASYNC_HANDLE;
 }
diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c
index 12260b7298b..cb62c59e368 100644
--- a/dlls/rpcrt4/rpc_server.c
+++ b/dlls/rpcrt4/rpc_server.c
@@ -190,7 +190,7 @@ static RpcPktHdr *handle_bind_error(RpcConnection *conn, RPC_STATUS error)
         reject_reason = REJECT_INVALID_CHECKSUM;
         break;
     default:
-        FIXME("unexpected status value %d\n", error);
+        FIXME("unexpected status value %ld\n", error);
         /* fall through */
     case RPC_S_INVALID_BOUND:
         reject_reason = REJECT_REASON_NOT_SPECIFIED;
@@ -435,7 +435,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *
   __TRY {
     if (func) func(msg);
   } __EXCEPT_ALL {
-    WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
+    WARN("exception caught with code 0x%08lx = %ld\n", GetExceptionCode(), GetExceptionCode());
     exception = TRUE;
     if (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
       status = ERROR_NOACCESS;
@@ -558,7 +558,7 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
 
     status = RPCRT4_ReceiveWithAuth(conn, &hdr, msg, &auth_data, &auth_length);
     if (status != RPC_S_OK) {
-      WARN("receive failed with error %x\n", status);
+      WARN("receive failed with error %lx\n", status);
       HeapFree(GetProcessHeap(), 0, msg);
       break;
     }
@@ -588,7 +588,7 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
       packet->auth_data = auth_data;
       packet->auth_length = auth_length;
       if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) {
-        ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError());
+        ERR("couldn't queue work item for worker thread, error was %ld\n", GetLastError());
         HeapFree(GetProcessHeap(), 0, packet);
         status = RPC_S_OUT_OF_RESOURCES;
       } else {
@@ -613,7 +613,7 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
     HeapFree(GetProcessHeap(), 0, auth_data);
 
     if (status != RPC_S_OK) {
-      WARN("processing packet failed with error %u\n", status);
+      WARN("processing packet failed with error %lu\n", status);
       break;
     }
   }
@@ -627,7 +627,7 @@ void RPCRT4_new_client(RpcConnection* conn)
   HANDLE thread = CreateThread(NULL, 0, RPCRT4_io_thread, conn, 0, NULL);
   if (!thread) {
     DWORD err = GetLastError();
-    ERR("failed to create thread, error=%08x\n", err);
+    ERR("failed to create thread, error=%08lx\n", err);
     RPCRT4_ReleaseConnection(conn);
   }
   /* we could set conn->thread, but then we'd have to make the io_thread wait
@@ -1020,7 +1020,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExA( RPC_CSTR Protseq, UINT MaxCalls, RPC
   RpcServerProtseq* ps;
   RPC_STATUS status;
 
-  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a((const char *)Protseq),
+  TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a((const char *)Protseq),
        MaxCalls, debugstr_a((const char *)Endpoint), SecurityDescriptor,
        lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
 
@@ -1042,7 +1042,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC
   LPSTR ProtseqA;
   LPSTR EndpointA;
 
-  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls,
+  TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_w( Protseq ), MaxCalls,
        debugstr_w( Endpoint ), SecurityDescriptor,
        lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
 
@@ -1170,7 +1170,7 @@ RPC_STATUS WINAPI RpcServerRegisterIf3( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid,
     for (i=0; i<If->DispatchTable->DispatchTableCount; i++) {
       TRACE("   entry %d: %p\n", i, If->DispatchTable->DispatchTable[i]);
     }
-    TRACE("  reserved: %ld\n", If->DispatchTable->Reserved);
+    TRACE("  reserved: %Id\n", If->DispatchTable->Reserved);
   }
   TRACE(" protseq endpoint count: %d\n", If->RpcProtseqEndpointCount);
   TRACE(" default manager epv: %p\n", If->DefaultManagerEpv);
@@ -1345,7 +1345,7 @@ static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_
     sec_status = EnumerateSecurityPackagesW(&package_count, &packages);
     if (sec_status != SEC_E_OK)
     {
-        ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", sec_status);
+        ERR("EnumerateSecurityPackagesW failed with error 0x%08lx\n", sec_status);
         return RPC_S_SEC_PKG_ERROR;
     }
 
@@ -1355,12 +1355,12 @@ static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_
 
     if (i == package_count)
     {
-        WARN("unsupported AuthnSvc %u\n", auth_type);
+        WARN("unsupported AuthnSvc %lu\n", auth_type);
         FreeContextBuffer(packages);
         return RPC_S_UNKNOWN_AUTHN_SERVICE;
     }
 
-    TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), auth_type);
+    TRACE("found package %s for service %lu\n", debugstr_w(packages[i].Name), auth_type);
     *packages_buf = packages;
     *ret = packages + i;
     return RPC_S_OK;
@@ -1421,7 +1421,7 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG Au
     WCHAR *principal_name = NULL;
     RPC_STATUS status;
 
-    TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
+    TRACE("(%s,%lu,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
 
     if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName)))
         return RPC_S_OUT_OF_RESOURCES;
@@ -1444,7 +1444,7 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG Au
     ULONG max_token;
     RPC_STATUS status;
 
-    TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
+    TRACE("(%s,%lu,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
 
     status = find_security_package(AuthnSvc, &packages, &package);
     if (status != RPC_S_OK)
@@ -1487,7 +1487,7 @@ RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA(ULONG AuthnSvc, RPC_CSTR *Pri
     RPC_STATUS ret;
     RPC_WSTR principalW;
 
-    TRACE("%u, %p\n", AuthnSvc, PrincName);
+    TRACE("%lu, %p\n", AuthnSvc, PrincName);
 
     if ((ret = RpcServerInqDefaultPrincNameW( AuthnSvc, &principalW )) == RPC_S_OK)
     {
@@ -1504,7 +1504,7 @@ RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *Pri
 {
     ULONG len = 0;
 
-    FIXME("%u, %p\n", AuthnSvc, PrincName);
+    FIXME("%lu, %p\n", AuthnSvc, PrincName);
 
     if (AuthnSvc != RPC_C_AUTHN_WINNT) return RPC_S_UNKNOWN_AUTHN_SERVICE;
 
@@ -1576,7 +1576,7 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
       if (!wait_thread)
           break;
 
-      TRACE("waiting for thread %u\n", GetThreadId(wait_thread));
+      TRACE("waiting for thread %lu\n", GetThreadId(wait_thread));
       LeaveCriticalSection(&listen_cs);
       WaitForSingleObject(wait_thread, INFINITE);
       EnterCriticalSection(&listen_cs);
@@ -1639,7 +1639,7 @@ RPC_STATUS WINAPI I_RpcServerStopListening( void )
  */
 UINT WINAPI I_RpcWindowProc( void *hWnd, UINT Message, UINT wParam, ULONG lParam )
 {
-  FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
+  FIXME( "(%p,%08x,%08x,%08lx): stub\n", hWnd, Message, wParam, lParam );
 
   return 0;
 }
@@ -1693,7 +1693,7 @@ RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
 RPC_STATUS WINAPI RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE Binding, ULONG InquiryType,
     RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
 {
-  FIXME("(%p,%u,%p,%u,%p,%p): stub\n",
+  FIXME("(%p,%lu,%p,%lu,%p,%p): stub\n",
         Binding, InquiryType, IfId, VersOption, ObjectUuid, InquiryContext);
   return RPC_S_INVALID_BINDING;
 }
@@ -1733,7 +1733,7 @@ RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN fn)
  */
 RPC_STATUS WINAPI RpcMgmtSetServerStackSize(ULONG ThreadStackSize)
 {
-  FIXME("(0x%x): stub\n", ThreadStackSize);
+  FIXME("(0x%lx): stub\n", ThreadStackSize);
   return RPC_S_OK;
 }
 
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index d1a2f99c147..82798a5a80d 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -101,7 +101,7 @@ static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *conn)
                                         RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
     if (connection->pipe == INVALID_HANDLE_VALUE)
     {
-        WARN("CreateNamedPipe failed with error %d\n", GetLastError());
+        WARN("CreateNamedPipe failed with error %ld\n", GetLastError());
         if (GetLastError() == ERROR_FILE_EXISTS)
             return RPC_S_DUPLICATE_ENDPOINT;
         else
@@ -154,12 +154,12 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname,
         TRACE("retrying busy server\n");
         continue;
       }
-      TRACE("connection failed, error=%x\n", err);
+      TRACE("connection failed, error=%lx\n", err);
       return RPC_S_SERVER_TOO_BUSY;
     }
     if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
       err = GetLastError();
-      WARN("connection failed, error=%x\n", err);
+      WARN("connection failed, error=%lx\n", err);
       return RPC_S_SERVER_UNAVAILABLE;
     }
   }
@@ -214,7 +214,7 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq
     DWORD process_id = GetCurrentProcessId();
     ULONG id = InterlockedIncrement(&lrpc_nameless_id);
     snprintf(generated_endpoint, sizeof(generated_endpoint),
-             "LRPC%08x.%08x", process_id, id);
+             "LRPC%08lx.%08lx", process_id, id);
     endpoint = generated_endpoint;
   }
 
@@ -274,7 +274,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protse
     DWORD process_id = GetCurrentProcessId();
     ULONG id = InterlockedExchangeAdd(&np_nameless_id, 1 );
     snprintf(generated_endpoint, sizeof(generated_endpoint),
-             "\\\\pipe\\\\%08x.%03x", process_id, id);
+             "\\\\pipe\\\\%08lx.%03lx", process_id, id);
     endpoint = generated_endpoint;
   }
 
@@ -317,7 +317,7 @@ static RPC_STATUS rpcrt4_ncacn_np_handoff(RpcConnection *old_conn, RpcConnection
   new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
   if (!GetComputerNameA(new_conn->NetworkAddr, &len))
   {
-    ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
+    ERR("Failed to retrieve the computer name, error %lu\n", GetLastError());
     return RPC_S_OUT_OF_RESOURCES;
   }
 
@@ -365,7 +365,7 @@ static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection
   new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
   if (!GetComputerNameA(new_conn->NetworkAddr, &len))
   {
-    ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
+    ERR("Failed to retrieve the computer name, error %lu\n", GetLastError());
     return RPC_S_OUT_OF_RESOURCES;
   }
 
@@ -595,7 +595,7 @@ static RPC_STATUS rpcrt4_conn_np_impersonate_client(RpcConnection *conn)
     if (!ret)
     {
         DWORD error = GetLastError();
-        WARN("ImpersonateNamedPipeClient failed with error %u\n", error);
+        WARN("ImpersonateNamedPipeClient failed with error %lu\n", error);
         switch (error)
         {
         case ERROR_CANNOT_IMPERSONATE:
@@ -617,7 +617,7 @@ static RPC_STATUS rpcrt4_conn_np_revert_to_self(RpcConnection *conn)
     ret = RevertToSelf();
     if (!ret)
     {
-        WARN("RevertToSelf failed with error %u\n", GetLastError());
+        WARN("RevertToSelf failed with error %lu\n", GetLastError());
         return RPC_S_NO_CONTEXT_AVAILABLE;
     }
     return RPC_S_OK;
@@ -677,7 +677,7 @@ static void *rpcrt4_protseq_np_get_wait_array(RpcServerProtseq *protseq, void *p
             case STATUS_PENDING:
                 break;
             default:
-                ERR("pipe listen error %x\n", status);
+                ERR("pipe listen error %lx\n", status);
                 continue;
             }
 
@@ -738,7 +738,7 @@ static int rpcrt4_protseq_np_wait_for_new_connection(RpcServerProtseq *protseq,
         return 0;
     else if (res == WAIT_FAILED)
     {
-        ERR("wait failed with error %d\n", GetLastError());
+        ERR("wait failed with error %ld\n", GetLastError());
         return -1;
     }
     else
@@ -755,7 +755,7 @@ static int rpcrt4_protseq_np_wait_for_new_connection(RpcServerProtseq *protseq,
                 if (conn->io_status.Status == STATUS_SUCCESS || conn->io_status.Status == STATUS_PIPE_CONNECTED)
                     cconn = rpcrt4_spawn_connection(&conn->common);
                 else
-                    ERR("listen failed %x\n", conn->io_status.Status);
+                    ERR("listen failed %lx\n", conn->io_status.Status);
                 break;
             }
         }
@@ -867,7 +867,7 @@ static RPC_STATUS rpcrt4_ncalrpc_inquire_auth_client(
     RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name,
     ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
 {
-    TRACE("(%p, %p, %p, %p, %p, %p, 0x%x)\n", conn, privs,
+    TRACE("(%p, %p, %p, %p, %p, %p, 0x%lx)\n", conn, privs,
           server_princ_name, authn_level, authn_svc, authz_svc, flags);
 
     if (privs)
@@ -888,7 +888,7 @@ static RPC_STATUS rpcrt4_ncalrpc_inquire_auth_client(
         *authz_svc = RPC_C_AUTHZ_NONE;
     }
     if (flags)
-        FIXME("flags 0x%x not implemented\n", flags);
+        FIXME("flags 0x%lx not implemented\n", flags);
 
     return RPC_S_OK;
 }
@@ -1082,7 +1082,7 @@ static BOOL rpcrt4_sock_wait_for_recv(RpcConnection_tcp *tcpc)
   case WAIT_OBJECT_0 + 1:
     return FALSE;
   default:
-    ERR("WaitForMultipleObjects() failed with error %d\n", GetLastError());
+    ERR("WaitForMultipleObjects() failed with error %ld\n", GetLastError());
     return FALSE;
   }
 }
@@ -1101,7 +1101,7 @@ static BOOL rpcrt4_sock_wait_for_send(RpcConnection_tcp *tcpc)
   case WAIT_OBJECT_0:
     return TRUE;
   default:
-    ERR("WaitForMultipleObjects() failed with error %d\n", GetLastError());
+    ERR("WaitForMultipleObjects() failed with error %ld\n", GetLastError());
     return FALSE;
   }
 }
@@ -1597,7 +1597,7 @@ static int rpcrt4_protseq_sock_wait_for_new_connection(RpcServerProtseq *protseq
         return 0;
     if (res == WAIT_FAILED)
     {
-        ERR("wait failed with error %d\n", GetLastError());
+        ERR("wait failed with error %ld\n", GetLastError());
         return -1;
     }
 
@@ -1689,7 +1689,7 @@ static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret
 
     if(GetLastError() != ERROR_IO_PENDING) {
         RpcHttpAsyncData_Release(async_data);
-        ERR("Request failed with error %d\n", GetLastError());
+        ERR("Request failed with error %ld\n", GetLastError());
         return RPC_S_SERVER_UNAVAILABLE;
     }
 
@@ -1863,7 +1863,7 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
         ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
     }
 
-    ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
+    ERR("server returned: %ld %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
     if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text);
 
     if (status_code == HTTP_STATUS_DENIED)
@@ -1952,7 +1952,7 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
         HeapFree(GetProcessHeap(), 0, user);
         HeapFree(GetProcessHeap(), 0, proxy);
         HeapFree(GetProcessHeap(), 0, servername);
-        ERR("InternetOpenW failed with error %d\n", GetLastError());
+        ERR("InternetOpenW failed with error %ld\n", GetLastError());
         return RPC_S_SERVER_UNAVAILABLE;
     }
     InternetSetStatusCallbackW(httpc->app_info, rpcrt4_http_internet_callback);
@@ -1986,7 +1986,7 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
 
     if (!httpc->session)
     {
-        ERR("InternetConnectW failed with error %d\n", GetLastError());
+        ERR("InternetConnectW failed with error %ld\n", GetLastError());
         HeapFree(GetProcessHeap(), 0, servername);
         return RPC_S_SERVER_UNAVAILABLE;
     }
@@ -2029,7 +2029,7 @@ static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, H
     HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
     async_data->inet_buffers.lpvBuffer = NULL;
 
-    TRACE("%p %p %u -> %u\n", req, buffer, count, status);
+    TRACE("%p %p %u -> %lu\n", req, buffer, count, status);
     return status == RPC_S_OK ? count : -1;
 }
 
@@ -2100,7 +2100,7 @@ static RPC_STATUS rpcrt4_http_prepare_in_pipe(HINTERNET in_request, RpcHttpAsync
     RPCRT4_FreeHeader(hdr);
     if (!ret)
     {
-        ERR("InternetWriteFile failed with error %d\n", GetLastError());
+        ERR("InternetWriteFile failed with error %ld\n", GetLastError());
         return RPC_S_SERVER_UNAVAILABLE;
     }
 
@@ -2201,7 +2201,7 @@ static RPC_STATUS rpcrt4_http_prepare_out_pipe(HINTERNET out_request, RpcHttpAsy
                                             &field1);
     HeapFree(GetProcessHeap(), 0, data_from_server);
     if (status != RPC_S_OK) return status;
-    TRACE("received (%d) from first prepare header\n", field1);
+    TRACE("received (%ld) from first prepare header\n", field1);
 
     for (;;)
     {
@@ -2224,7 +2224,7 @@ static RPC_STATUS rpcrt4_http_prepare_out_pipe(HINTERNET out_request, RpcHttpAsy
                                             &field3);
     HeapFree(GetProcessHeap(), 0, data_from_server);
     if (status != RPC_S_OK) return status;
-    TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1, *flow_control_increment, field3);
+    TRACE("received (0x%08lx 0x%08lx %ld) from second prepare header\n", field1, *flow_control_increment, field3);
 
     return RPC_S_OK;
 }
@@ -2536,7 +2536,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
         }
         else
         {
-            ERR("InitializeSecurityContextW failed with error 0x%08x\n", ret);
+            ERR("InitializeSecurityContextW failed with error 0x%08lx\n", ret);
             HeapFree(GetProcessHeap(), 0, out.pvBuffer);
             break;
         }
@@ -2544,7 +2544,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
         break;
     }
     default:
-        FIXME("scheme %u not supported\n", creds->AuthnSchemes[0]);
+        FIXME("scheme %lu not supported\n", creds->AuthnSchemes[0]);
         break;
     }
 
@@ -2584,7 +2584,7 @@ static RPC_STATUS insert_authorization_header(HINTERNET request, ULONG scheme, c
         scheme_len = ARRAY_SIZE(ntlmW);
         break;
     default:
-        ERR("unknown scheme %u\n", scheme);
+        ERR("unknown scheme %lu\n", scheme);
         return RPC_S_SERVER_UNAVAILABLE;
     }
     if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR))))
@@ -2780,7 +2780,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
                                          flags, (DWORD_PTR)httpc->async_data);
     if (!httpc->in_request)
     {
-        ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
+        ERR("HttpOpenRequestW failed with error %ld\n", GetLastError());
         HeapFree(GetProcessHeap(), 0, url);
         return RPC_S_SERVER_UNAVAILABLE;
     }
@@ -2807,7 +2807,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
     HeapFree(GetProcessHeap(), 0, url);
     if (!httpc->out_request)
     {
-        ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
+        ERR("HttpOpenRequestW failed with error %ld\n", GetLastError());
         return RPC_S_SERVER_UNAVAILABLE;
     }
 
@@ -2881,7 +2881,7 @@ again:
   /* read packet common header */
   dwRead = rpcrt4_ncacn_http_read(Connection, &common_hdr, sizeof(common_hdr));
   if (dwRead != sizeof(common_hdr)) {
-    WARN("Short read of header, %d bytes\n", dwRead);
+    WARN("Short read of header, %ld bytes\n", dwRead);
     status = RPC_S_PROTOCOL_ERROR;
     goto fail;
   }
@@ -2914,7 +2914,7 @@ again:
   /* read the rest of packet header */
   dwRead = rpcrt4_ncacn_http_read(Connection, &(*Header)->common + 1, hdr_length - sizeof(common_hdr));
   if (dwRead != hdr_length - sizeof(common_hdr)) {
-    WARN("bad header length, %d bytes, hdr_length %d\n", dwRead, hdr_length);
+    WARN("bad header length, %ld bytes, hdr_length %ld\n", dwRead, hdr_length);
     status = RPC_S_PROTOCOL_ERROR;
     goto fail;
   }
@@ -2931,7 +2931,7 @@ again:
     dwRead = rpcrt4_ncacn_http_read(Connection, *Payload, common_hdr.frag_len - hdr_length);
     if (dwRead != common_hdr.frag_len - hdr_length)
     {
-      WARN("bad data length, %d/%d\n", dwRead, common_hdr.frag_len - hdr_length);
+      WARN("bad data length, %ld/%ld\n", dwRead, common_hdr.frag_len - hdr_length);
       status = RPC_S_PROTOCOL_ERROR;
       goto fail;
     }
@@ -2969,7 +2969,7 @@ again:
                                                  &pipe_uuid);
       if (status != RPC_S_OK)
         goto fail;
-      TRACE("received http flow control header (0x%x, 0x%x, %s)\n",
+      TRACE("received http flow control header (0x%lx, 0x%lx, %s)\n",
             bytes_transmitted, flow_control_increment, debugstr_guid(&pipe_uuid));
       /* FIXME: do something with parsed data */
     }
@@ -2991,7 +2991,7 @@ again:
 
   httpc->bytes_received += common_hdr.frag_len;
 
-  TRACE("httpc->bytes_received = 0x%x\n", httpc->bytes_received);
+  TRACE("httpc->bytes_received = 0x%lx\n", httpc->bytes_received);
 
   if (httpc->bytes_received > httpc->flow_control_mark)
   {
@@ -3003,7 +3003,7 @@ again:
     {
       DWORD bytes_written;
       BOOL ret2;
-      TRACE("sending flow control packet at 0x%x\n", httpc->bytes_received);
+      TRACE("sending flow control packet at 0x%lx\n", httpc->bytes_received);
       ret2 = InternetWriteFile(httpc->in_request, hdr, hdr->common.frag_len, &bytes_written);
       RPCRT4_FreeHeader(hdr);
       if (ret2)
@@ -3358,7 +3358,7 @@ void rpcrt4_conn_release_and_wait(RpcConnection *connection)
 RpcConnection *RPCRT4_GrabConnection(RpcConnection *connection)
 {
     LONG ref = InterlockedIncrement(&connection->ref);
-    TRACE("%p ref=%u\n", connection, ref);
+    TRACE("%p ref=%lu\n", connection, ref);
     return connection;
 }
 
@@ -3383,7 +3383,7 @@ void RPCRT4_ReleaseConnection(RpcConnection *connection)
         ref = InterlockedDecrement(&connection->ref);
     }
 
-    TRACE("%p ref=%u\n", connection, ref);
+    TRACE("%p ref=%lu\n", connection, ref);
 
     if (!ref)
     {
diff --git a/dlls/rpcrt4/rpcrt4_main.c b/dlls/rpcrt4/rpcrt4_main.c
index a1848ef28e5..d7073b550dd 100644
--- a/dlls/rpcrt4/rpcrt4_main.c
+++ b/dlls/rpcrt4/rpcrt4_main.c
@@ -752,7 +752,7 @@ void WINAPI I_RpcFree(void *Object)
  */
 LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
 {
-    TRACE("(%d)\n", status);
+    TRACE("(%ld)\n", status);
     switch (status)
     {
     case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
@@ -871,7 +871,7 @@ LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
  */
 int WINAPI RpcExceptionFilter(ULONG ExceptionCode)
 {
-    TRACE("0x%x\n", ExceptionCode);
+    TRACE("0x%lx\n", ExceptionCode);
     switch (ExceptionCode)
     {
     case STATUS_DATATYPE_MISALIGNMENT:
@@ -920,7 +920,7 @@ RPC_STATUS RPC_ENTRY RpcErrorSaveErrorInfo(RPC_ERROR_ENUM_HANDLE *EnumHandle, vo
  */
 RPC_STATUS RPC_ENTRY RpcErrorLoadErrorInfo(void *ErrorBlob, SIZE_T BlobSize, RPC_ERROR_ENUM_HANDLE *EnumHandle)
 {
-    FIXME("(%p %lu %p): stub\n", ErrorBlob, BlobSize, EnumHandle);
+    FIXME("(%p %Iu %p): stub\n", ErrorBlob, BlobSize, EnumHandle);
     return ERROR_CALL_NOT_IMPLEMENTED;
 }
 
@@ -938,7 +938,7 @@ RPC_STATUS RPC_ENTRY RpcErrorGetNextRecord(RPC_ERROR_ENUM_HANDLE *EnumHandle, BO
  */
 RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG Timeout)
 {
-    FIXME("(%d): stub\n", Timeout);
+    FIXME("(%ld): stub\n", Timeout);
     return RPC_S_OK;
 }
 
@@ -1077,7 +1077,7 @@ RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout)
 {
     DWORD target_tid;
 
-    FIXME("(%p, %d)\n", ThreadHandle, Timeout);
+    FIXME("(%p, %ld)\n", ThreadHandle, Timeout);
 
     target_tid = GetThreadId(ThreadHandle);
     if (!target_tid)
@@ -1085,7 +1085,7 @@ RPC_STATUS RPC_ENTRY RpcCancelThreadEx(void* ThreadHandle, LONG Timeout)
 
     if (Timeout)
     {
-        FIXME("(%p, %d)\n", ThreadHandle, Timeout);
+        FIXME("(%p, %ld)\n", ThreadHandle, Timeout);
         return RPC_S_OK;
     }
     else




More information about the wine-devel mailing list