[PATCH 4/4] dlls/ntdll: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Wed Feb 16 01:32:02 CST 2022


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

---
 dlls/ntdll/Makefile.in         |    2 -
 dlls/ntdll/actctx.c            |   34 ++++++++-------
 dlls/ntdll/atom.c              |    2 -
 dlls/ntdll/debugbuffer.c       |   40 +++++++++---------
 dlls/ntdll/error.c             |    2 -
 dlls/ntdll/exception.c         |   24 +++++------
 dlls/ntdll/handletable.c       |    4 +-
 dlls/ntdll/heap.c              |   88 ++++++++++++++++++++--------------------
 dlls/ntdll/loader.c            |   54 ++++++++++++-------------
 dlls/ntdll/locale.c            |   22 +++++-----
 dlls/ntdll/misc.c              |   20 +++++----
 dlls/ntdll/path.c              |    4 +-
 dlls/ntdll/reg.c               |   10 ++---
 dlls/ntdll/relay.c             |   28 ++++++-------
 dlls/ntdll/resource.c          |    4 +-
 dlls/ntdll/rtl.c               |   26 ++++++------
 dlls/ntdll/rtlbitmap.c         |   32 +++++++--------
 dlls/ntdll/rtlstr.c            |    2 -
 dlls/ntdll/sec.c               |   36 ++++++++--------
 dlls/ntdll/signal_i386.c       |   28 ++++++-------
 dlls/ntdll/signal_x86_64.c     |   28 ++++++-------
 dlls/ntdll/sync.c              |    8 ++--
 dlls/ntdll/thread.c            |   12 +++--
 dlls/ntdll/threadpool.c        |   26 ++++++------
 dlls/ntdll/unix/cdrom.c        |   17 ++++----
 dlls/ntdll/unix/debug.c        |   10 ++---
 dlls/ntdll/unix/env.c          |    2 -
 dlls/ntdll/unix/file.c         |    2 +
 dlls/ntdll/unix/loader.c       |   10 ++---
 dlls/ntdll/unix/process.c      |   14 +++---
 dlls/ntdll/unix/registry.c     |    2 +
 dlls/ntdll/unix/security.c     |    2 +
 dlls/ntdll/unix/serial.c       |    4 +-
 dlls/ntdll/unix/server.c       |    4 +-
 dlls/ntdll/unix/signal_arm.c   |    2 +
 dlls/ntdll/unix/signal_arm64.c |    2 +
 dlls/ntdll/unix/signal_i386.c  |   22 +++++-----
 dlls/ntdll/unix/socket.c       |   14 +++---
 dlls/ntdll/unix/sync.c         |    2 +
 dlls/ntdll/unix/system.c       |    2 +
 dlls/ntdll/unix/tape.c         |   30 +++++++-------
 dlls/ntdll/unix/thread.c       |   15 ++++---
 dlls/ntdll/unix/virtual.c      |    2 +
 dlls/ntdll/version.c           |    6 +--
 44 files changed, 359 insertions(+), 341 deletions(-)

diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index 9cf9b0979f4..185bc563e68 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -1,4 +1,4 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES -D_NTSYSTEM_ -D_ACRTIMP= -DWINBASEAPI=
+EXTRADEFS = -D_NTSYSTEM_ -D_ACRTIMP= -DWINBASEAPI=
 MODULE    = ntdll.dll
 UNIXLIB   = ntdll.so
 IMPORTLIB = ntdll
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 9fa93a3b5e3..70d01300f53 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -877,7 +877,7 @@ static void free_entity_array(struct entity_array *array)
             RtlFreeHeap(GetProcessHeap(), 0, entity->u.settings.ns);
             break;
         default:
-            FIXME("Unknown entity kind %d\n", entity->kind);
+            FIXME("Unknown entity kind %ld\n", entity->kind);
         }
     }
     RtlFreeHeap( GetProcessHeap(), 0, array->base );
@@ -2988,7 +2988,7 @@ static NTSTATUS get_manifest_in_associated_manifest( struct actctx_loader* acl,
 
     if (!((ULONG_PTR)resname >> 16)) resid = (ULONG_PTR)resname & 0xffff;
 
-    TRACE( "looking for manifest associated with %s id %lu\n", debugstr_w(filename), resid );
+    TRACE( "looking for manifest associated with %s id %Iu\n", debugstr_w(filename), resid );
 
     if (module) /* use the module filename */
     {
@@ -3450,7 +3450,7 @@ static struct string_index *find_string_index(const struct strsection_header *se
                 break;
             }
             else
-                WARN("hash collision 0x%08x, %s, %s\n", hash, debugstr_us(name), debugstr_us(&str));
+                WARN("hash collision 0x%08lx, %s, %s\n", hash, debugstr_us(name), debugstr_us(&str));
         }
         iter++;
     }
@@ -3710,7 +3710,7 @@ static NTSTATUS find_window_class(ACTIVATION_CONTEXT* actctx, const UNICODE_STRI
                 break;
             }
             else
-                WARN("hash collision 0x%08x, %s, %s\n", hash, debugstr_us(name), debugstr_us(&str));
+                WARN("hash collision 0x%08lx, %s, %s\n", hash, debugstr_us(name), debugstr_us(&str));
         }
         iter++;
     }
@@ -4811,10 +4811,10 @@ static NTSTATUS find_string(ACTIVATION_CONTEXT* actctx, ULONG section_kind,
         status = find_progid_redirection(actctx, section_name, data);
         break;
     case ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE:
-        FIXME("Unsupported yet section_kind %x\n", section_kind);
+        FIXME("Unsupported yet section_kind %lx\n", section_kind);
         return STATUS_SXS_SECTION_NOT_FOUND;
     default:
-        WARN("Unknown section_kind %x\n", section_kind);
+        WARN("Unknown section_kind %lx\n", section_kind);
         return STATUS_SXS_SECTION_NOT_FOUND;
     }
 
@@ -4848,7 +4848,7 @@ static NTSTATUS find_guid(ACTIVATION_CONTEXT* actctx, ULONG section_kind,
         status = find_clr_surrogate(actctx, guid, data);
         break;
     default:
-        WARN("Unknown section_kind %x\n", section_kind);
+        WARN("Unknown section_kind %lx\n", section_kind);
         return STATUS_SXS_SECTION_NOT_FOUND;
     }
 
@@ -4917,7 +4917,7 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
     HANDLE file = 0;
     struct actctx_loader acl;
 
-    TRACE("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
+    TRACE("%p %08lx\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
 
     if (!pActCtx || pActCtx->cbSize < sizeof(*pActCtx) ||
         (pActCtx->dwFlags & ~ACTCTX_FLAGS_ALL))
@@ -5100,7 +5100,7 @@ NTSTATUS WINAPI RtlActivateActivationContextEx( ULONG flags, TEB *teb, HANDLE ha
     RtlAddRefActivationContext( handle );
 
     *cookie = (ULONG_PTR)frame;
-    TRACE( "%p cookie=%lx\n", handle, *cookie );
+    TRACE( "%p cookie=%Ix\n", handle, *cookie );
     return STATUS_SUCCESS;
 }
 
@@ -5112,7 +5112,7 @@ void WINAPI RtlDeactivateActivationContext( ULONG flags, ULONG_PTR cookie )
 {
     RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame, *top;
 
-    TRACE( "%x cookie=%lx\n", flags, cookie );
+    TRACE( "%lx cookie=%Ix\n", flags, cookie );
 
     /* find the right frame */
     top = NtCurrentTeb()->ActivationContextStack.ActiveFrame;
@@ -5200,7 +5200,7 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
     ACTIVATION_CONTEXT *actctx;
     NTSTATUS status;
 
-    TRACE("%08x %p %p %u %p %ld %p\n", flags, handle,
+    TRACE("%08lx %p %p %lu %p %Id %p\n", flags, handle,
           subinst, class, buffer, bufsize, retlen);
 
     if (retlen) *retlen = 0;
@@ -5437,7 +5437,7 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle
         break;
 
     default:
-        FIXME( "class %u not implemented\n", class );
+        FIXME( "class %lu not implemented\n", class );
         return STATUS_NOT_IMPLEMENTED;
     }
     return STATUS_SUCCESS;
@@ -5455,7 +5455,7 @@ NTSTATUS WINAPI RtlFindActivationContextSectionString( ULONG flags, const GUID *
     PACTCTX_SECTION_KEYED_DATA data = ptr;
     NTSTATUS status = STATUS_SXS_KEY_NOT_FOUND;
 
-    TRACE("%08x %s %u %s %p\n", flags, debugstr_guid(guid), section_kind,
+    TRACE("%08lx %s %lu %s %p\n", flags, debugstr_guid(guid), section_kind,
           debugstr_us(section_name), data);
 
     if (guid)
@@ -5465,7 +5465,7 @@ NTSTATUS WINAPI RtlFindActivationContextSectionString( ULONG flags, const GUID *
     }
     if (flags & ~FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX)
     {
-        FIXME("unknown flags %08x\n", flags);
+        FIXME("unknown flags %08lx\n", flags);
         return STATUS_INVALID_PARAMETER;
     }
     if ((data && data->cbSize < offsetof(ACTCTX_SECTION_KEYED_DATA, ulAssemblyRosterIndex)) ||
@@ -5499,7 +5499,7 @@ NTSTATUS WINAPI RtlFindActivationContextSectionGuid( ULONG flags, const GUID *ex
     ACTCTX_SECTION_KEYED_DATA *data = ptr;
     NTSTATUS status = STATUS_SXS_KEY_NOT_FOUND;
 
-    TRACE("%08x %s %u %s %p\n", flags, debugstr_guid(extguid), section_kind, debugstr_guid(guid), data);
+    TRACE("%08lx %s %lu %s %p\n", flags, debugstr_guid(extguid), section_kind, debugstr_guid(guid), data);
 
     if (extguid)
     {
@@ -5509,7 +5509,7 @@ NTSTATUS WINAPI RtlFindActivationContextSectionGuid( ULONG flags, const GUID *ex
 
     if (flags & ~FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX)
     {
-        FIXME("unknown flags %08x\n", flags);
+        FIXME("unknown flags %08lx\n", flags);
         return STATUS_INVALID_PARAMETER;
     }
 
@@ -5541,7 +5541,7 @@ NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings( DWORD flags, HANDL
 
     if (flags)
     {
-        WARN( "unknown flags %08x\n", flags );
+        WARN( "unknown flags %08lx\n", flags );
         return STATUS_INVALID_PARAMETER;
     }
 
diff --git a/dlls/ntdll/atom.c b/dlls/ntdll/atom.c
index adde3208e88..650210cc2cc 100644
--- a/dlls/ntdll/atom.c
+++ b/dlls/ntdll/atom.c
@@ -245,7 +245,7 @@ NTSTATUS WINAPI RtlQueryAtomInAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom, UL
         if (!*len) status = STATUS_BUFFER_TOO_SMALL;
         *len = wlen;
     }
-    TRACE( "%p %x -> %s (%x)\n",
+    TRACE( "%p %x -> %s (%lx)\n",
            table, atom, len ? debugstr_wn(name, wlen / sizeof(WCHAR)) : "(null)", status );
     return status;
 }
diff --git a/dlls/ntdll/debugbuffer.c b/dlls/ntdll/debugbuffer.c
index 9f5d214aacb..50816f634e7 100644
--- a/dlls/ntdll/debugbuffer.c
+++ b/dlls/ntdll/debugbuffer.c
@@ -36,17 +36,17 @@ static void dump_DEBUG_MODULE_INFORMATION(const DEBUG_MODULE_INFORMATION *iBuf)
 {
   TRACE( "MODULE_INFORMATION:%p\n", iBuf );
   if (NULL == iBuf) return ;
-  TRACE( "Base:%d\n", iBuf->Base );
-  TRACE( "Size:%d\n", iBuf->Size );
-  TRACE( "Flags:%d\n", iBuf->Flags );
+  TRACE( "Base:%ld\n", iBuf->Base );
+  TRACE( "Size:%ld\n", iBuf->Size );
+  TRACE( "Flags:%ld\n", iBuf->Flags );
 }
 
 static void dump_DEBUG_HEAP_INFORMATION(const DEBUG_HEAP_INFORMATION *iBuf)
 {
   TRACE( "HEAP_INFORMATION:%p\n", iBuf );
   if (NULL == iBuf) return ;
-  TRACE( "Base:%d\n", iBuf->Base );
-  TRACE( "Flags:%d\n", iBuf->Flags );
+  TRACE( "Base:%ld\n", iBuf->Base );
+  TRACE( "Flags:%ld\n", iBuf->Flags );
 }
 
 static void dump_DEBUG_LOCK_INFORMATION(const DEBUG_LOCK_INFORMATION *iBuf)
@@ -58,13 +58,13 @@ static void dump_DEBUG_LOCK_INFORMATION(const DEBUG_LOCK_INFORMATION *iBuf)
   TRACE( "Address:%p\n", iBuf->Address );
   TRACE( "Type:%d\n", iBuf->Type );
   TRACE( "CreatorBackTraceIndex:%d\n", iBuf->CreatorBackTraceIndex );
-  TRACE( "OwnerThreadId:%d\n", iBuf->OwnerThreadId );
-  TRACE( "ActiveCount:%d\n", iBuf->ActiveCount );
-  TRACE( "ContentionCount:%d\n", iBuf->ContentionCount );
-  TRACE( "EntryCount:%d\n", iBuf->EntryCount );
-  TRACE( "RecursionCount:%d\n", iBuf->RecursionCount );
-  TRACE( "NumberOfSharedWaiters:%d\n", iBuf->NumberOfSharedWaiters );
-  TRACE( "NumberOfExclusiveWaiters:%d\n", iBuf->NumberOfExclusiveWaiters );
+  TRACE( "OwnerThreadId:%ld\n", iBuf->OwnerThreadId );
+  TRACE( "ActiveCount:%ld\n", iBuf->ActiveCount );
+  TRACE( "ContentionCount:%ld\n", iBuf->ContentionCount );
+  TRACE( "EntryCount:%ld\n", iBuf->EntryCount );
+  TRACE( "RecursionCount:%ld\n", iBuf->RecursionCount );
+  TRACE( "NumberOfSharedWaiters:%ld\n", iBuf->NumberOfSharedWaiters );
+  TRACE( "NumberOfExclusiveWaiters:%ld\n", iBuf->NumberOfExclusiveWaiters );
 }
 
 static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf)
@@ -73,13 +73,13 @@ static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf)
   TRACE( "SectionHandle:%p\n", iBuf->SectionHandle);
   TRACE( "SectionBase:%p\n", iBuf->SectionBase);
   TRACE( "RemoteSectionBase:%p\n", iBuf->RemoteSectionBase);
-  TRACE( "SectionBaseDelta:%d\n", iBuf->SectionBaseDelta);
+  TRACE( "SectionBaseDelta:%ld\n", iBuf->SectionBaseDelta);
   TRACE( "EventPairHandle:%p\n", iBuf->EventPairHandle);
   TRACE( "RemoteThreadHandle:%p\n", iBuf->RemoteThreadHandle);
-  TRACE( "InfoClassMask:%x\n", iBuf->InfoClassMask);
-  TRACE( "SizeOfInfo:%d\n", iBuf->SizeOfInfo);
-  TRACE( "AllocatedSize:%d\n", iBuf->AllocatedSize);
-  TRACE( "SectionSize:%d\n", iBuf->SectionSize);
+  TRACE( "InfoClassMask:%lx\n", iBuf->InfoClassMask);
+  TRACE( "SizeOfInfo:%ld\n", iBuf->SizeOfInfo);
+  TRACE( "AllocatedSize:%ld\n", iBuf->AllocatedSize);
+  TRACE( "SectionSize:%ld\n", iBuf->SectionSize);
   TRACE( "BackTraceInfo:%p\n", iBuf->BackTraceInformation);
   dump_DEBUG_MODULE_INFORMATION(iBuf->ModuleInformation);
   dump_DEBUG_HEAP_INFORMATION(iBuf->HeapInformation);
@@ -89,13 +89,13 @@ static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf)
 PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(IN ULONG iSize, IN BOOLEAN iEventPair) 
 {
    PDEBUG_BUFFER oBuf;
-   FIXME("(%d, %d): stub\n", iSize, iEventPair);
+   FIXME("(%ld, %d): stub\n", iSize, iEventPair);
    if (iSize < sizeof(DEBUG_BUFFER)) {
      iSize = sizeof(DEBUG_BUFFER);
    }
    oBuf = RtlAllocateHeap(GetProcessHeap(), 0, iSize);
    memset(oBuf, 0, iSize);
-   FIXME("(%d, %d): returning %p\n", iSize, iEventPair, oBuf);
+   FIXME("(%ld, %d): returning %p\n", iSize, iEventPair, oBuf);
    return oBuf;
 }
 
@@ -124,7 +124,7 @@ NTSTATUS WINAPI RtlQueryProcessDebugInformation(IN ULONG iProcessId, IN ULONG iD
     if ((status = NtOpenProcess( &process, PROCESS_QUERY_LIMITED_INFORMATION, NULL, &cid ))) return status;
     NtClose( process );
 
-   FIXME("(%d, %x, %p): stub\n", iProcessId, iDebugInfoMask, iBuf);
+   FIXME("(%ld, %lx, %p): stub\n", iProcessId, iDebugInfoMask, iBuf);
    iBuf->InfoClassMask = iDebugInfoMask;
    
    if (iDebugInfoMask & PDI_MODULES) {
diff --git a/dlls/ntdll/error.c b/dlls/ntdll/error.c
index 9d413b54c85..5412b19907c 100644
--- a/dlls/ntdll/error.c
+++ b/dlls/ntdll/error.c
@@ -59,7 +59,7 @@ ULONG WINAPI RtlNtStatusToDosErrorNoTeb( NTSTATUS status )
 
     ret = map_status( status );
     if (ret == ERROR_MR_MID_NOT_FOUND && status != STATUS_MESSAGE_NOT_FOUND)
-        WARN( "no mapping for %08x\n", status );
+        WARN( "no mapping for %08lx\n", status );
     return ret;
 }
 
diff --git a/dlls/ntdll/exception.c b/dlls/ntdll/exception.c
index c3714e8369b..22c9c829a4d 100644
--- a/dlls/ntdll/exception.c
+++ b/dlls/ntdll/exception.c
@@ -166,10 +166,10 @@ LONG call_vectored_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
         RtlFreeHeap( GetProcessHeap(), 0, to_free );
         to_free = NULL;
 
-        TRACE( "calling handler at %p code=%x flags=%x\n",
+        TRACE( "calling handler at %p code=%lx flags=%lx\n",
                func, rec->ExceptionCode, rec->ExceptionFlags );
         ret = func( &except_ptrs );
-        TRACE( "handler at %p returned %x\n", func, ret );
+        TRACE( "handler at %p returned %lx\n", func, ret );
 
         RtlEnterCriticalSection( &vectored_handlers_section );
         ptr = list_next( &vectored_exception_handlers, ptr );
@@ -351,7 +351,7 @@ BOOLEAN CDECL RtlAddFunctionTable( RUNTIME_FUNCTION *table, DWORD count, ULONG_P
 {
     struct dynamic_unwind_entry *entry;
 
-    TRACE( "%p %u %lx\n", table, count, addr );
+    TRACE( "%p %lu %Ix\n", table, count, addr );
 
     /* NOTE: Windows doesn't check if table is aligned or a NULL pointer */
 
@@ -383,7 +383,7 @@ BOOLEAN CDECL RtlInstallFunctionTableCallback( ULONG_PTR table, ULONG_PTR base,
 {
     struct dynamic_unwind_entry *entry;
 
-    TRACE( "%lx %lx %d %p %p %s\n", table, base, length, callback, context, wine_dbgstr_w(dll) );
+    TRACE( "%Ix %Ix %ld %p %p %s\n", table, base, length, callback, context, wine_dbgstr_w(dll) );
 
     /* NOTE: Windows doesn't check if the provided callback is a NULL pointer */
 
@@ -419,7 +419,7 @@ DWORD WINAPI RtlAddGrowableFunctionTable( void **table, RUNTIME_FUNCTION *functi
 {
     struct dynamic_unwind_entry *entry;
 
-    TRACE( "%p, %p, %u, %u, %lx, %lx\n", table, functions, count, max_count, base, end );
+    TRACE( "%p, %p, %lu, %lu, %Ix, %Ix\n", table, functions, count, max_count, base, end );
 
     entry = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*entry) );
     if (!entry)
@@ -450,7 +450,7 @@ void WINAPI RtlGrowFunctionTable( void *table, DWORD count )
 {
     struct dynamic_unwind_entry *entry;
 
-    TRACE( "%p, %u\n", table, count );
+    TRACE( "%p, %lu\n", table, count );
 
     RtlEnterCriticalSection( &dynamic_unwind_section );
     LIST_FOR_EACH_ENTRY( entry, &dynamic_unwind_list, struct dynamic_unwind_entry, entry )
@@ -612,7 +612,7 @@ PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry( ULONG_PTR pc, ULONG_PTR *base,
     if (!(func = lookup_function_info( pc, base, &module )))
     {
         *base = 0;
-        WARN( "no exception table found for %lx\n", pc );
+        WARN( "no exception table found for %Ix\n", pc );
     }
     return func;
 }
@@ -782,7 +782,7 @@ NTSTATUS WINAPI RtlGetExtendedContextLength2( ULONG context_flags, ULONG *length
     ULONG64 supported_mask;
     ULONG64 size;
 
-    TRACE( "context_flags %#x, length %p, compaction_mask %s.\n", context_flags, length,
+    TRACE( "context_flags %#lx, length %p, compaction_mask %s.\n", context_flags, length,
             wine_dbgstr_longlong(compaction_mask) );
 
     if (!(p = context_get_parameters( context_flags )))
@@ -828,7 +828,7 @@ NTSTATUS WINAPI RtlInitializeExtendedContext2( void *context, ULONG context_flag
     ULONG64 supported_mask = 0;
     CONTEXT_EX *c_ex;
 
-    TRACE( "context %p, context_flags %#x, context_ex %p, compaction_mask %s.\n",
+    TRACE( "context %p, context_flags %#lx, context_ex %p, compaction_mask %s.\n",
             context, context_flags, context_ex, wine_dbgstr_longlong(compaction_mask));
 
     if (!(p = context_get_parameters( context_flags )))
@@ -891,7 +891,7 @@ NTSTATUS WINAPI RtlInitializeExtendedContext( void *context, ULONG context_flags
 void * WINAPI RtlLocateExtendedFeature2( CONTEXT_EX *context_ex, ULONG feature_id,
         XSTATE_CONFIGURATION *xstate_config, ULONG *length )
 {
-    TRACE( "context_ex %p, feature_id %u, xstate_config %p, length %p.\n",
+    TRACE( "context_ex %p, feature_id %lu, xstate_config %p, length %p.\n",
             context_ex, feature_id, xstate_config, length );
 
     if (!xstate_config)
@@ -970,7 +970,7 @@ NTSTATUS WINAPI RtlCopyContext( CONTEXT *dst, DWORD context_flags, CONTEXT *src
     static const DWORD arch_mask = CONTEXT_i386 | CONTEXT_AMD64;
     BYTE *d, *s;
 
-    TRACE("dst %p, context_flags %#x, src %p.\n", dst, context_flags, src);
+    TRACE("dst %p, context_flags %#lx, src %p.\n", dst, context_flags, src);
 
     if (context_flags & 0x40 && !RtlGetEnabledExtendedFeatures( ~(ULONG64)0 )) return STATUS_NOT_SUPPORTED;
 
@@ -1017,7 +1017,7 @@ NTSTATUS WINAPI RtlCopyExtendedContext( CONTEXT_EX *dst, ULONG context_flags, CO
     unsigned int start;
     BYTE *d, *s;
 
-    TRACE( "dst %p, context_flags %#x, src %p.\n", dst, context_flags, src );
+    TRACE( "dst %p, context_flags %#lx, src %p.\n", dst, context_flags, src );
 
     if (!(p = context_get_parameters( context_flags )))
         return STATUS_INVALID_PARAMETER;
diff --git a/dlls/ntdll/handletable.c b/dlls/ntdll/handletable.c
index c05cd929e2c..debea997e05 100644
--- a/dlls/ntdll/handletable.c
+++ b/dlls/ntdll/handletable.c
@@ -47,7 +47,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
  */
 void WINAPI RtlInitializeHandleTable(ULONG MaxHandleCount, ULONG HandleSize, RTL_HANDLE_TABLE * HandleTable)
 {
-    TRACE("(%u, %u, %p)\n", MaxHandleCount, HandleSize, HandleTable);
+    TRACE("(%lu, %lu, %p)\n", MaxHandleCount, HandleSize, HandleTable);
 
     memset(HandleTable, 0, sizeof(*HandleTable));
     HandleTable->MaxHandleCount = MaxHandleCount;
@@ -292,7 +292,7 @@ BOOLEAN WINAPI RtlIsValidIndexHandle(const RTL_HANDLE_TABLE * HandleTable, ULONG
 {
     RTL_HANDLE * Handle;
 
-    TRACE("(%p, %u, %p)\n", HandleTable, Index, ValidHandle);
+    TRACE("(%p, %lu, %p)\n", HandleTable, Index, ValidHandle);
     Handle = (RTL_HANDLE *)
         ((char *)HandleTable->FirstHandle + Index * HandleTable->HandleSize);
 
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 346bcf3c10c..067f0068674 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -345,7 +345,7 @@ static void HEAP_Dump( HEAP *heap )
 
     TRACE( "\nFree lists:\n Block   Stat   Size    Id\n" );
     for (i = 0; i < HEAP_NB_FREE_LISTS; i++)
-        TRACE( "%p free %08lx prev=%p next=%p\n",
+        TRACE( "%p free %08Ix prev=%p next=%p\n",
                  &heap->freeList[i].arena, i < HEAP_NB_SMALL_FREE_LISTS ?
                  HEAP_MIN_ARENA_SIZE + i * ALIGNMENT : HEAP_freeListSizes[i - HEAP_NB_SMALL_FREE_LISTS],
                  LIST_ENTRY( heap->freeList[i].arena.entry.prev, ARENA_FREE, entry ),
@@ -354,7 +354,7 @@ static void HEAP_Dump( HEAP *heap )
     LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry )
     {
         SIZE_T freeSize = 0, usedSize = 0, arenaSize = subheap->headerSize;
-        TRACE( "\n\nSub-heap %p: base=%p size=%08lx committed=%08lx\n",
+        TRACE( "\n\nSub-heap %p: base=%p size=%08Ix committed=%08Ix\n",
                  subheap, subheap->base, subheap->size, subheap->commitSize );
 
         TRACE( "\n Block    Arena   Stat   Size    Id\n" );
@@ -364,7 +364,7 @@ static void HEAP_Dump( HEAP *heap )
             if (*(DWORD *)ptr & ARENA_FLAG_FREE)
             {
                 ARENA_FREE *pArena = (ARENA_FREE *)ptr;
-                TRACE( "%p %08x free %08x prev=%p next=%p\n",
+                TRACE( "%p %08lx free %08lx prev=%p next=%p\n",
                          pArena, pArena->magic,
                          pArena->size & ARENA_SIZE_MASK,
                          LIST_ENTRY( pArena->entry.prev, ARENA_FREE, entry ),
@@ -376,7 +376,7 @@ static void HEAP_Dump( HEAP *heap )
             else if (*(DWORD *)ptr & ARENA_FLAG_PREV_FREE)
             {
                 ARENA_INUSE *pArena = (ARENA_INUSE *)ptr;
-                TRACE( "%p %08x Used %08x back=%p\n",
+                TRACE( "%p %08x Used %08lx back=%p\n",
                         pArena, pArena->magic, pArena->size & ARENA_SIZE_MASK, *((ARENA_FREE **)pArena - 1) );
                 ptr += sizeof(*pArena) + (pArena->size & ARENA_SIZE_MASK);
                 arenaSize += sizeof(ARENA_INUSE);
@@ -385,7 +385,7 @@ static void HEAP_Dump( HEAP *heap )
             else
             {
                 ARENA_INUSE *pArena = (ARENA_INUSE *)ptr;
-                TRACE( "%p %08x %s %08x\n",
+                TRACE( "%p %08x %s %08lx\n",
                          pArena, pArena->magic, pArena->magic == ARENA_INUSE_MAGIC ? "used" : "pend",
                          pArena->size & ARENA_SIZE_MASK );
                 ptr += sizeof(*pArena) + (pArena->size & ARENA_SIZE_MASK);
@@ -393,7 +393,7 @@ static void HEAP_Dump( HEAP *heap )
                 usedSize += pArena->size & ARENA_SIZE_MASK;
             }
         }
-        TRACE( "\nTotal: Size=%08lx Committed=%08lx Free=%08lx Used=%08lx Arenas=%08lx (%ld%%)\n\n",
+        TRACE( "\nTotal: Size=%08Ix Committed=%08Ix Free=%08Ix Used=%08Ix Arenas=%08Ix (%Id%%)\n\n",
 	      subheap->size, subheap->commitSize, freeSize, usedSize,
 	      arenaSize, (arenaSize * 100) / subheap->size );
     }
@@ -405,7 +405,7 @@ static void HEAP_DumpEntry( LPPROCESS_HEAP_ENTRY entry )
     WORD rem_flags;
     TRACE( "Dumping entry %p\n", entry );
     TRACE( "lpData\t\t: %p\n", entry->lpData );
-    TRACE( "cbData\t\t: %08x\n", entry->cbData);
+    TRACE( "cbData\t\t: %08lx\n", entry->cbData);
     TRACE( "cbOverhead\t: %08x\n", entry->cbOverhead);
     TRACE( "iRegionIndex\t: %08x\n", entry->iRegionIndex);
     TRACE( "WFlags\t\t: ");
@@ -434,8 +434,8 @@ static void HEAP_DumpEntry( LPPROCESS_HEAP_ENTRY entry )
     }
     if (entry->wFlags & PROCESS_HEAP_REGION)
     {
-        TRACE( "Region.dwCommittedSize\t:%08x\n",entry->u.Region.dwCommittedSize);
-        TRACE( "Region.dwUnCommittedSize\t:%08x\n",entry->u.Region.dwUnCommittedSize);
+        TRACE( "Region.dwCommittedSize\t:%08lx\n",entry->u.Region.dwCommittedSize);
+        TRACE( "Region.dwUnCommittedSize\t:%08lx\n",entry->u.Region.dwUnCommittedSize);
         TRACE( "Region.lpFirstBlock\t:%p\n",entry->u.Region.lpFirstBlock);
         TRACE( "Region.lpLastBlock\t:%p\n",entry->u.Region.lpLastBlock);
     }
@@ -531,7 +531,7 @@ static inline BOOL HEAP_Commit( SUBHEAP *subheap, ARENA_INUSE *pArena, SIZE_T da
     if (NtAllocateVirtualMemory( NtCurrentProcess(), &ptr, 0,
                                  &size, MEM_COMMIT, get_protection_type( subheap->heap->flags ) ))
     {
-        WARN("Could not commit %08lx bytes at %p for heap %p\n",
+        WARN("Could not commit %08Ix bytes at %p for heap %p\n",
                  size, ptr, subheap->heap );
         return FALSE;
     }
@@ -560,7 +560,7 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
 
     if (NtFreeVirtualMemory( NtCurrentProcess(), &addr, &decommit_size, MEM_DECOMMIT ))
     {
-        WARN("Could not decommit %08lx bytes at %p for heap %p\n",
+        WARN("Could not decommit %08Ix bytes at %p for heap %p\n",
              decommit_size, (char *)subheap->base + size, subheap->heap );
         return FALSE;
     }
@@ -728,7 +728,7 @@ static void *allocate_large_block( HEAP *heap, DWORD flags, SIZE_T size )
     if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0, &block_size,
                                  MEM_COMMIT, get_protection_type( flags )))
     {
-        WARN("Could not allocate block for %08lx bytes\n", size );
+        WARN("Could not allocate block for %08Ix bytes\n", size );
         return NULL;
     }
     arena = address;
@@ -785,7 +785,7 @@ static void *realloc_large_block( HEAP *heap, DWORD flags, void *ptr, SIZE_T siz
     if (flags & HEAP_REALLOC_IN_PLACE_ONLY) return NULL;
     if (!(new_ptr = allocate_large_block( heap, flags, size )))
     {
-        WARN("Could not allocate block for %08lx bytes\n", size );
+        WARN("Could not allocate block for %08Ix bytes\n", size );
         return NULL;
     }
     memcpy( new_ptr, ptr, arena->data_size );
@@ -834,13 +834,13 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
     {
         if (quiet == NOISY)
         {
-            ERR( "Heap %p: invalid large arena %p values %x/%x\n",
+            ERR( "Heap %p: invalid large arena %p values %lx/%lx\n",
                  heap, arena, arena->size, arena->magic );
             if (TRACE_ON(heap)) HEAP_Dump( heap );
         }
         else if (WARN_ON(heap))
         {
-            WARN( "Heap %p: invalid large arena %p values %x/%x\n",
+            WARN( "Heap %p: invalid large arena %p values %lx/%lx\n",
                   heap, arena, arena->size, arena->magic );
             if (TRACE_ON(heap)) HEAP_Dump( heap );
         }
@@ -848,7 +848,7 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
     }
     if (arena->data_size > arena->block_size - sizeof(*arena))
     {
-        ERR( "Heap %p: invalid large arena %p size %lx/%lx\n",
+        ERR( "Heap %p: invalid large arena %p size %Ix/%Ix\n",
              heap, arena, arena->data_size, arena->block_size );
         return FALSE;
     }
@@ -860,7 +860,7 @@ static BOOL validate_large_arena( HEAP *heap, const ARENA_LARGE *arena, BOOL qui
         for (i = 0; i < unused; i++)
         {
             if (data[i] == ARENA_TAIL_FILLER) continue;
-            ERR("Heap %p: block %p tail overwritten at %p (byte %lu/%lu == 0x%02x)\n",
+            ERR("Heap %p: block %p tail overwritten at %p (byte %Iu/%Iu == 0x%02x)\n",
                 heap, arena + 1, data + i, i, unused, data[i] );
             return FALSE;
         }
@@ -891,13 +891,13 @@ static SUBHEAP *HEAP_CreateSubHeap( HEAP *heap, LPVOID address, DWORD flags,
         if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0, &totalSize,
                                      MEM_RESERVE, get_protection_type( flags ) ))
         {
-            WARN("Could not allocate %08lx bytes\n", totalSize );
+            WARN("Could not allocate %08Ix bytes\n", totalSize );
             return NULL;
         }
         if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0,
                                      &commitSize, MEM_COMMIT, get_protection_type( flags ) ))
         {
-            WARN("Could not commit %08lx bytes for sub-heap %p\n", commitSize, address );
+            WARN("Could not commit %08Ix bytes for sub-heap %p\n", commitSize, address );
             return NULL;
         }
     }
@@ -1025,7 +1025,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
 
     if (!(heap->flags & HEAP_GROWABLE))
     {
-        WARN("Not enough space in heap %p for %08lx bytes\n", heap, size );
+        WARN("Not enough space in heap %p for %08Ix bytes\n", heap, size );
         return NULL;
     }
     /* make sure that we have a big enough size *committed* to fit another
@@ -1049,7 +1049,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size,
                                       max( heap->grow_size, total_size ) );
     }
 
-    TRACE("created new sub-heap %p of %08lx bytes for heap %p\n",
+    TRACE("created new sub-heap %p of %08Ix bytes for heap %p\n",
           subheap, subheap->size, heap );
 
     *ppSubHeap = subheap;
@@ -1095,14 +1095,14 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
     /* Check magic number */
     if (pArena->magic != ARENA_FREE_MAGIC)
     {
-        ERR("Heap %p: invalid free arena magic %08x for %p\n", subheap->heap, pArena->magic, pArena );
+        ERR("Heap %p: invalid free arena magic %08lx for %p\n", subheap->heap, pArena->magic, pArena );
         return FALSE;
     }
     /* Check size flags */
     if (!(pArena->size & ARENA_FLAG_FREE) ||
         (pArena->size & ARENA_FLAG_PREV_FREE))
     {
-        ERR("Heap %p: bad flags %08x for free arena %p\n",
+        ERR("Heap %p: bad flags %08lx for free arena %p\n",
             subheap->heap, pArena->size & ~ARENA_SIZE_MASK, pArena );
         return FALSE;
     }
@@ -1110,7 +1110,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
     size = pArena->size & ARENA_SIZE_MASK;
     if ((char *)(pArena + 1) + size > heapEnd)
     {
-        ERR("Heap %p: bad size %08lx for free arena %p\n", subheap->heap, size, pArena );
+        ERR("Heap %p: bad size %08Ix for free arena %p\n", subheap->heap, size, pArena );
         return FALSE;
     }
     /* Check that next pointer is valid */
@@ -1174,7 +1174,7 @@ static BOOL HEAP_ValidateFreeArena( SUBHEAP *subheap, ARENA_FREE *pArena )
         {
             if (*ptr != ARENA_FREE_FILLER)
             {
-                ERR("Heap %p: free block %p overwritten at %p by %08x\n",
+                ERR("Heap %p: free block %p overwritten at %p by %08lx\n",
                     subheap->heap, (ARENA_INUSE *)pArena + 1, ptr, *ptr );
                 return FALSE;
             }
@@ -1229,7 +1229,7 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
     /* Check size flags */
     if (pArena->size & ARENA_FLAG_FREE)
     {
-        ERR("Heap %p: bad flags %08x for in-use arena %p\n",
+        ERR("Heap %p: bad flags %08lx for in-use arena %p\n",
             subheap->heap, pArena->size & ~ARENA_SIZE_MASK, pArena );
         return FALSE;
     }
@@ -1238,14 +1238,14 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
     if ((const char *)(pArena + 1) + size > heapEnd ||
         (const char *)(pArena + 1) + size < (const char *)(pArena + 1))
     {
-        ERR("Heap %p: bad size %08lx for in-use arena %p\n", subheap->heap, size, pArena );
+        ERR("Heap %p: bad size %08Ix for in-use arena %p\n", subheap->heap, size, pArena );
         return FALSE;
     }
     /* Check next arena PREV_FREE flag */
     if (((const char *)(pArena + 1) + size < heapEnd) &&
         (*(const DWORD *)((const char *)(pArena + 1) + size) & ARENA_FLAG_PREV_FREE))
     {
-        ERR("Heap %p: in-use arena %p next block %p has PREV_FREE flag %x\n",
+        ERR("Heap %p: in-use arena %p next block %p has PREV_FREE flag %lx\n",
             subheap->heap, pArena, (const char *)(pArena + 1) + size,*(const DWORD *)((const char *)(pArena + 1) + size) );
         return FALSE;
     }
@@ -1279,7 +1279,7 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
     /* Check unused size */
     if (pArena->unused_bytes > size)
     {
-        ERR("Heap %p: invalid unused size %08x/%08lx\n", subheap->heap, pArena->unused_bytes, size );
+        ERR("Heap %p: invalid unused size %08x/%08Ix\n", subheap->heap, pArena->unused_bytes, size );
         return FALSE;
     }
     /* Check unused bytes */
@@ -1292,7 +1292,7 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
         {
             if (*ptr != ARENA_FREE_FILLER)
             {
-                ERR("Heap %p: free block %p overwritten at %p by %08x\n",
+                ERR("Heap %p: free block %p overwritten at %p by %08lx\n",
                     subheap->heap, pArena + 1, ptr, *ptr );
                 if (!*ptr) { HEAP_Dump( subheap->heap ); DbgBreakPoint(); }
                 return FALSE;
@@ -1307,7 +1307,7 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
         for (i = 0; i < pArena->unused_bytes; i++)
         {
             if (data[i] == ARENA_TAIL_FILLER) continue;
-            ERR("Heap %p: block %p tail overwritten at %p (byte %u/%u == 0x%02x)\n",
+            ERR("Heap %p: block %p tail overwritten at %p (byte %lu/%u == 0x%02x)\n",
                 subheap->heap, pArena + 1, data + i, i, pArena->unused_bytes, data[i] );
             return FALSE;
         }
@@ -1424,11 +1424,11 @@ static BOOL validate_block_pointer( HEAP *heap, SUBHEAP **ret_subheap, const ARE
     else if (arena->magic != ARENA_INUSE_MAGIC)
         WARN( "Heap %p: invalid in-use arena magic %08x for %p\n", subheap->heap, arena->magic, arena );
     else if (arena->size & ARENA_FLAG_FREE)
-        ERR( "Heap %p: bad flags %08x for in-use arena %p\n",
+        ERR( "Heap %p: bad flags %08lx for in-use arena %p\n",
              subheap->heap, arena->size & ~ARENA_SIZE_MASK, arena );
     else if ((const char *)(arena + 1) + (arena->size & ARENA_SIZE_MASK) > (const char *)subheap->base + subheap->size ||
              (const char *)(arena + 1) + (arena->size & ARENA_SIZE_MASK) < (const char *)(arena + 1))
-        ERR( "Heap %p: bad size %08x for in-use arena %p\n",
+        ERR( "Heap %p: bad size %08lx for in-use arena %p\n",
              subheap->heap, arena->size & ARENA_SIZE_MASK, arena );
     else
         ret = TRUE;
@@ -1676,7 +1676,7 @@ void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_
         void *ret = allocate_large_block( heap, flags, size );
         if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
         if (!ret && (flags & HEAP_GENERATE_EXCEPTIONS)) RtlRaiseStatus( STATUS_NO_MEMORY );
-        TRACE("(%p,%08x,%08lx): returning %p\n", heap, flags, size, ret );
+        TRACE("(%p,%08lx,%08Ix): returning %p\n", heap, flags, size, ret );
         return ret;
     }
 
@@ -1684,7 +1684,7 @@ void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_
 
     if (!(pArena = HEAP_FindFreeBlock( heapPtr, rounded_size, &subheap )))
     {
-        TRACE("(%p,%08x,%08lx): returning NULL\n",
+        TRACE("(%p,%08lx,%08Ix): returning NULL\n",
                   heap, flags, size  );
         if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
         if (flags & HEAP_GENERATE_EXCEPTIONS) RtlRaiseStatus( STATUS_NO_MEMORY );
@@ -1714,7 +1714,7 @@ void * WINAPI DECLSPEC_HOTPATCH RtlAllocateHeap( HANDLE heap, ULONG flags, SIZE_
 
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
 
-    TRACE("(%p,%08x,%08lx): returning %p\n", heap, flags, size, pInUse + 1 );
+    TRACE("(%p,%08lx,%08Ix): returning %p\n", heap, flags, size, pInUse + 1 );
     return pInUse + 1;
 }
 
@@ -1767,13 +1767,13 @@ BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE heap, ULONG flags, void *pt
         HEAP_MakeInUseBlockFree( subheap, pInUse );
 
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
-    TRACE("(%p,%08x,%p): returning TRUE\n", heap, flags, ptr );
+    TRACE("(%p,%08lx,%p): returning TRUE\n", heap, flags, ptr );
     return TRUE;
 
 error:
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
     RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
-    TRACE("(%p,%08x,%p): returning FALSE\n", heap, flags, ptr );
+    TRACE("(%p,%08lx,%p): returning FALSE\n", heap, flags, ptr );
     return FALSE;
 }
 
@@ -1908,20 +1908,20 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size
     ret = pArena + 1;
 done:
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
-    TRACE("(%p,%08x,%p,%08lx): returning %p\n", heap, flags, ptr, size, ret );
+    TRACE("(%p,%08lx,%p,%08Ix): returning %p\n", heap, flags, ptr, size, ret );
     return ret;
 
 oom:
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
     if (flags & HEAP_GENERATE_EXCEPTIONS) RtlRaiseStatus( STATUS_NO_MEMORY );
     RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_NO_MEMORY );
-    TRACE("(%p,%08x,%p,%08lx): returning NULL\n", heap, flags, ptr, size );
+    TRACE("(%p,%08lx,%p,%08Ix): returning NULL\n", heap, flags, ptr, size );
     return NULL;
 
 error:
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
     RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
-    TRACE("(%p,%08x,%p,%08lx): returning NULL\n", heap, flags, ptr, size );
+    TRACE("(%p,%08lx,%p,%08Ix): returning NULL\n", heap, flags, ptr, size );
     return NULL;
 }
 
@@ -1944,7 +1944,7 @@ error:
 ULONG WINAPI RtlCompactHeap( HANDLE heap, ULONG flags )
 {
     static BOOL reported;
-    if (!reported++) FIXME( "(%p, 0x%x) stub\n", heap, flags );
+    if (!reported++) FIXME( "(%p, 0x%lx) stub\n", heap, flags );
     return 0;
 }
 
@@ -2041,7 +2041,7 @@ SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr )
     }
     if (!(flags & HEAP_NO_SERIALIZE)) RtlLeaveCriticalSection( &heapPtr->critSection );
 
-    TRACE("(%p,%08x,%p): returning %08lx\n", heap, flags, ptr, ret );
+    TRACE("(%p,%08lx,%p): returning %08Ix\n", heap, flags, ptr, ret );
     return ret;
 }
 
@@ -2254,6 +2254,6 @@ NTSTATUS WINAPI RtlQueryHeapInformation( HANDLE heap, HEAP_INFORMATION_CLASS inf
  */
 NTSTATUS WINAPI RtlSetHeapInformation( HANDLE heap, HEAP_INFORMATION_CLASS info_class, PVOID info, SIZE_T size)
 {
-    FIXME("%p %d %p %ld stub\n", heap, info_class, info, size);
+    FIXME("%p %d %p %Id stub\n", heap, info_class, info, size);
     return STATUS_SUCCESS;
 }
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 2c3e62f6e25..2c2c1e6a373 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -463,12 +463,12 @@ static void call_ldr_notifications( ULONG reason, LDR_DATA_TABLE_ENTRY *module )
 
     LIST_FOR_EACH_ENTRY_SAFE( notify, notify_next, &ldr_notifications, struct ldr_notification, entry )
     {
-        TRACE_(relay)("\1Call LDR notification callback (proc=%p,reason=%u,data=%p,context=%p)\n",
+        TRACE_(relay)("\1Call LDR notification callback (proc=%p,reason=%lu,data=%p,context=%p)\n",
                 notify->callback, reason, &data, notify->context );
 
         notify->callback(reason, &data, notify->context);
 
-        TRACE_(relay)("\1Ret  LDR notification callback (proc=%p,reason=%u,data=%p,context=%p)\n",
+        TRACE_(relay)("\1Ret  LDR notification callback (proc=%p,reason=%lu,data=%p,context=%p)\n",
                 notify->callback, reason, &data, notify->context );
     }
 }
@@ -820,7 +820,7 @@ static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY
 
     if (ordinal >= exports->NumberOfFunctions)
     {
-        TRACE("	ordinal %d out of range!\n", ordinal + exports->Base );
+        TRACE("	ordinal %ld out of range!\n", ordinal + exports->Base );
         return NULL;
     }
     if (!functions[ordinal]) return NULL;
@@ -963,7 +963,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
             ERR("Library %s (which is needed by %s) not found\n",
                 name, debugstr_w(current_modref->ldr.FullDllName.Buffer));
         else
-            ERR("Loading library %s (which is needed by %s) failed (error %x).\n",
+            ERR("Loading library %s (which is needed by %s) failed (error %lx).\n",
                 name, debugstr_w(current_modref->ldr.FullDllName.Buffer), status);
         return FALSE;
     }
@@ -1132,7 +1132,7 @@ static SHORT alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
             break;
     }
 
-    TRACE( "module %p data %p-%p zerofill %u index %p callback %p flags %x -> slot %u\n", mod->DllBase,
+    TRACE( "module %p data %p-%p zerofill %lu index %p callback %p flags %lx -> slot %lu\n", mod->DllBase,
            (void *)dir->StartAddressOfRawData, (void *)dir->EndAddressOfRawData, dir->SizeOfZeroFill,
            (void *)dir->AddressOfIndex, (void *)dir->AddressOfCallBacks, dir->Characteristics, i );
 
@@ -1160,7 +1160,7 @@ static SHORT alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
 #ifdef __x86_64__  /* macOS-specific hack */
             if (teb->Reserved5[0]) ((TEB *)teb->Reserved5[0])->ThreadLocalStoragePointer = new;
 #endif
-            TRACE( "thread %04lx tls block %p -> %p\n", (ULONG_PTR)teb->ClientId.UniqueThread, old, new );
+            TRACE( "thread %04Ix tls block %p -> %p\n", (ULONG_PTR)teb->ClientId.UniqueThread, old, new );
             /* FIXME: can't free old block here, should be freed at thread exit */
         }
 
@@ -1177,7 +1177,7 @@ static SHORT alloc_tls_slot( LDR_DATA_TABLE_ENTRY *mod )
         memcpy( new_ptr, (void *)dir->StartAddressOfRawData, size );
         memset( (char *)new_ptr + size, 0, dir->SizeOfZeroFill );
 
-        TRACE( "thread %04lx slot %u: %u/%u bytes at %p\n",
+        TRACE( "thread %04Ix slot %lu: %lu/%lu bytes at %p\n",
                (ULONG_PTR)teb->ClientId.UniqueThread, i, size, dir->SizeOfZeroFill, new_ptr );
 
         RtlFreeHeap( GetProcessHeap(), 0,
@@ -1405,7 +1405,7 @@ static NTSTATUS alloc_thread_tls(void)
         memcpy( pointers[i], (void *)dir->StartAddressOfRawData, size );
         memset( (char *)pointers[i] + size, 0, dir->SizeOfZeroFill );
 
-        TRACE( "thread %04x slot %u: %u/%u bytes at %p\n",
+        TRACE( "thread %04lx slot %u: %u/%lu bytes at %p\n",
                GetCurrentThreadId(), i, size, dir->SizeOfZeroFill, pointers[i] );
     }
     NtCurrentTeb()->ThreadLocalStoragePointer = pointers;
@@ -1439,7 +1439,7 @@ static void call_tls_callbacks( HMODULE module, UINT reason )
         }
         __EXCEPT_ALL
         {
-            TRACE_(relay)("\1exception %08x in TLS callback (proc=%p,module=%p,reason=%s,reserved=0)\n",
+            TRACE_(relay)("\1exception %08lx in TLS callback (proc=%p,module=%p,reason=%s,reserved=0)\n",
                           GetExceptionCode(), callback, module, reason_names[reason] );
             return;
         }
@@ -1488,7 +1488,7 @@ static NTSTATUS MODULE_InitDLL( WINE_MODREF *wm, UINT reason, LPVOID lpReserved
     __EXCEPT_ALL
     {
         status = GetExceptionCode();
-        TRACE_(relay)("\1exception %08x in PE entry point (proc=%p,module=%p,reason=%s,res=%p)\n",
+        TRACE_(relay)("\1exception %08lx in PE entry point (proc=%p,module=%p,reason=%s,res=%p)\n",
                       status, entry, module, reason_names[reason], lpReserved );
     }
     __ENDTRY
@@ -1746,13 +1746,13 @@ NTSTATUS WINAPI LdrRegisterDllNotification(ULONG flags, PLDR_DLL_NOTIFICATION_FU
 {
     struct ldr_notification *notify;
 
-    TRACE( "(%x, %p, %p, %p)\n", flags, callback, context, cookie );
+    TRACE( "(%lx, %p, %p, %p)\n", flags, callback, context, cookie );
 
     if (!callback || !cookie)
         return STATUS_INVALID_PARAMETER;
 
     if (flags)
-        FIXME( "ignoring flags %x\n", flags );
+        FIXME( "ignoring flags %lx\n", flags );
 
     notify = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*notify) );
     if (!notify) return STATUS_NO_MEMORY;
@@ -1794,7 +1794,7 @@ NTSTATUS WINAPI LdrUnregisterDllNotification( void *cookie )
  */
 NTSTATUS WINAPI LdrLockLoaderLock( ULONG flags, ULONG *result, ULONG_PTR *magic )
 {
-    if (flags & ~0x2) FIXME( "flags %x not supported\n", flags );
+    if (flags & ~0x2) FIXME( "flags %lx not supported\n", flags );
 
     if (result) *result = 0;
     if (magic) *magic = 0;
@@ -2585,7 +2585,7 @@ static WINE_MODREF *build_main_module(void)
     RtlFreeUnicodeString( &nt_name );
     if (!status) return wm;
 failed:
-    MESSAGE( "wine: failed to create main module for %s, status %x\n",
+    MESSAGE( "wine: failed to create main module for %s, status %lx\n",
              debugstr_us(&params->ImagePathName), status );
     NtTerminateProcess( GetCurrentProcess(), status );
     return NULL;  /* unreached */
@@ -3045,7 +3045,7 @@ done:
     if (nts == STATUS_SUCCESS)
         TRACE("Loaded module %s at %p\n", debugstr_us(&nt_name), (*pwm)->ldr.DllBase);
     else
-        WARN("Failed to load module %s; status=%x\n", debugstr_w(libname), nts);
+        WARN("Failed to load module %s; status=%lx\n", debugstr_w(libname), nts);
 
     if (mapping) NtClose( mapping );
     RtlFreeUnicodeString( &nt_name );
@@ -3139,7 +3139,7 @@ NTSTATUS WINAPI LdrGetDllHandleEx( ULONG flags, LPCWSTR load_path, ULONG *dll_ch
     WCHAR *dllname;
     HANDLE mapping;
 
-    TRACE( "flags %#x, load_path %p, dll_characteristics %p, name %p, base %p.\n",
+    TRACE( "flags %#lx, load_path %p, dll_characteristics %p, name %p, base %p.\n",
             flags, load_path, dll_characteristics, name, base );
 
     if (flags & ~valid_flags) return STATUS_INVALID_PARAMETER;
@@ -3148,7 +3148,7 @@ NTSTATUS WINAPI LdrGetDllHandleEx( ULONG flags, LPCWSTR load_path, ULONG *dll_ch
                  == (LDR_GET_DLL_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | LDR_GET_DLL_HANDLE_EX_FLAG_PIN))
         return STATUS_INVALID_PARAMETER;
 
-    if (flags & ~supported_flags) FIXME( "Unsupported flags %#x.\n", flags );
+    if (flags & ~supported_flags) FIXME( "Unsupported flags %#lx.\n", flags );
     if (dll_characteristics) FIXME( "dll_characteristics unsupported.\n" );
 
     dllname = append_dll_ext( name->Buffer );
@@ -3198,7 +3198,7 @@ NTSTATUS WINAPI LdrAddRefDll( ULONG flags, HMODULE module )
     NTSTATUS ret = STATUS_SUCCESS;
     WINE_MODREF *wm;
 
-    if (flags & ~LDR_ADDREF_DLL_PIN) FIXME( "%p flags %x not implemented\n", module, flags );
+    if (flags & ~LDR_ADDREF_DLL_PIN) FIXME( "%p flags %lx not implemented\n", module, flags );
 
     RtlEnterCriticalSection( &loader_section );
 
@@ -3459,7 +3459,7 @@ void* WINAPI LdrResolveDelayLoadedAPI( void* base, const IMAGE_DELAYLOAD_DESCRIP
     FARPROC fp;
     DWORD id;
 
-    TRACE( "(%p, %p, %p, %p, %p, 0x%08x)\n", base, desc, dllhook, syshook, addr, flags );
+    TRACE( "(%p, %p, %p, %p, %p, 0x%08lx)\n", base, desc, dllhook, syshook, addr, flags );
 
     phmod = get_rva(base, desc->ModuleHandleRVA);
     pIAT = get_rva(base, desc->ImportAddressTableRVA);
@@ -3862,7 +3862,7 @@ static void init_wow64( CONTEXT *context )
 
         if ((status = load_dll( NULL, wow64_path, 0, &wm, FALSE )))
         {
-            ERR( "could not load %s, status %x\n", debugstr_w(wow64_path), status );
+            ERR( "could not load %s, status %lx\n", debugstr_w(wow64_path), status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
         wow64 = wm->ldr.DllBase;
@@ -3898,7 +3898,7 @@ static void map_wow64cpu(void)
     if ((status = NtOpenFile( &file, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ,
                               FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE )))
     {
-        WARN("failed to open wow64cpu, status %#x\n", status);
+        WARN("failed to open wow64cpu, status %#lx\n", status);
         return;
     }
     if (!NtCreateSection( &section, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY |
@@ -4013,7 +4013,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
 
         if ((status = load_dll( NULL, L"kernel32.dll", 0, &kernel32, FALSE )) != STATUS_SUCCESS)
         {
-            MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
+            MESSAGE( "wine: could not load kernel32.dll, status %lx\n", status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
         kernel32_handle = kernel32->ldr.DllBase;
@@ -4022,7 +4022,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
         if ((status = LdrGetProcedureAddress( kernel32_handle, &func_name,
                                               0, (void **)&pBaseThreadInitThunk )) != STATUS_SUCCESS)
         {
-            MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %x\n", status );
+            MESSAGE( "wine: could not find BaseThreadInitThunk in kernel32.dll, status %lx\n", status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
         RtlInitAnsiString( &func_name, "CtrlRoutine" );
@@ -4036,7 +4036,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
 
         if (status)
         {
-            ERR( "Importing dlls for %s failed, status %x\n",
+            ERR( "Importing dlls for %s failed, status %lx\n",
                  debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
@@ -4059,7 +4059,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
         attach_done = 1;
         if ((status = alloc_thread_tls()) != STATUS_SUCCESS)
         {
-            ERR( "TLS init  failed when loading %s, status %x\n",
+            ERR( "TLS init  failed when loading %s, status %lx\n",
                  debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
@@ -4070,7 +4070,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
         if ((status = process_attach( node_ntdll, context ))
              || (status = process_attach( node_kernel32, context )))
         {
-            ERR( "Initializing system dll for %s failed, status %x\n",
+            ERR( "Initializing system dll for %s failed, status %lx\n",
                  debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
@@ -4080,7 +4080,7 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
             if (last_failed_modref)
                 ERR( "%s failed to initialize, aborting\n",
                      debugstr_w(last_failed_modref->ldr.BaseDllName.Buffer) + 1 );
-            ERR( "Initializing dlls for %s failed, status %x\n",
+            ERR( "Initializing dlls for %s failed, status %lx\n",
                  debugstr_w(NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer), status );
             NtTerminateProcess( GetCurrentProcess(), status );
         }
diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index fe185d403f2..e4531f1ea5c 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -537,7 +537,7 @@ static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG
     NTSTATUS status;
     ULONG len;
 
-    FIXME("(0x%x %p %p %p) returning a dummy value (current locale)\n", flags, count, buffer, size);
+    FIXME("(0x%lx %p %p %p) returning a dummy value (current locale)\n", flags, count, buffer, size);
 
     status = load_string( (flags & MUI_LANGUAGE_ID) ? LOCALE_ILANGUAGE : LOCALE_SNAME,
                           lang, name, ARRAY_SIZE(name) );
@@ -556,7 +556,7 @@ static NTSTATUS get_dummy_preferred_ui_language( DWORD flags, LANGID lang, ULONG
     }
     *size = len;
     *count = 1;
-    TRACE("returned variable content: %d, \"%s\", %d\n", *count, debugstr_w(buffer), *size);
+    TRACE("returned variable content: %ld, \"%s\", %ld\n", *count, debugstr_w(buffer), *size);
     return STATUS_SUCCESS;
 
 }
@@ -568,7 +568,7 @@ NTSTATUS WINAPI RtlGetProcessPreferredUILanguages( DWORD flags, ULONG *count, WC
 {
     LANGID ui_language;
 
-    FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size );
+    FIXME( "%08lx, %p, %p %p\n", flags, count, buffer, size );
 
     NtQueryDefaultUILanguage( &ui_language );
     return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
@@ -599,7 +599,7 @@ NTSTATUS WINAPI RtlGetThreadPreferredUILanguages( DWORD flags, ULONG *count, WCH
 {
     LANGID ui_language;
 
-    FIXME( "%08x, %p, %p %p\n", flags, count, buffer, size );
+    FIXME( "%08lx, %p, %p %p\n", flags, count, buffer, size );
 
     NtQueryDefaultUILanguage( &ui_language );
     return get_dummy_preferred_ui_language( flags, ui_language, count, buffer, size );
@@ -628,7 +628,7 @@ NTSTATUS WINAPI RtlGetUserPreferredUILanguages( DWORD flags, ULONG unknown, ULON
  */
 NTSTATUS WINAPI RtlSetProcessPreferredUILanguages( DWORD flags, PCZZWSTR buffer, ULONG *count )
 {
-    FIXME( "%u, %p, %p\n", flags, buffer, count );
+    FIXME( "%lu, %p, %p\n", flags, buffer, count );
     return STATUS_SUCCESS;
 }
 
@@ -638,7 +638,7 @@ NTSTATUS WINAPI RtlSetProcessPreferredUILanguages( DWORD flags, PCZZWSTR buffer,
  */
 NTSTATUS WINAPI RtlSetThreadPreferredUILanguages( DWORD flags, PCZZWSTR buffer, ULONG *count )
 {
-    FIXME( "%u, %p, %p\n", flags, buffer, count );
+    FIXME( "%lu, %p, %p\n", flags, buffer, count );
     return STATUS_SUCCESS;
 }
 
@@ -1239,7 +1239,7 @@ NTSTATUS WINAPI RtlLocaleNameToLcid( const WCHAR *name, LCID *lcid, ULONG flags
     return STATUS_INVALID_PARAMETER_1;
 
 found:
-    TRACE( "%s -> %04x\n", debugstr_w(name), *lcid );
+    TRACE( "%s -> %04lx\n", debugstr_w(name), *lcid );
     return STATUS_SUCCESS;
 }
 
@@ -1536,7 +1536,7 @@ NTSTATUS WINAPI RtlNormalizeString( ULONG form, const WCHAR *src, INT src_len, W
     const struct norm_table *info;
     NTSTATUS status = STATUS_SUCCESS;
 
-    TRACE( "%x %s %d %p %d\n", form, debugstr_wn(src, src_len), src_len, dst, *dst_len );
+    TRACE( "%lx %s %d %p %d\n", form, debugstr_wn(src, src_len), src_len, dst, *dst_len );
 
     if ((status = load_norm_table( form, &info ))) return status;
 
@@ -1631,7 +1631,7 @@ NTSTATUS WINAPI RtlIdnToAscii( DWORD flags, const WCHAR *src, INT srclen, WCHAR
     unsigned int ch, buffer[64];
     int i, len, start, end, out_label, out = 0, normlen = ARRAY_SIZE(normstr);
 
-    TRACE( "%x %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
+    TRACE( "%lx %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
 
     if ((status = load_norm_table( 13, &info ))) return status;
 
@@ -1740,7 +1740,7 @@ NTSTATUS WINAPI RtlIdnToNameprepUnicode( DWORD flags, const WCHAR *src, INT srcl
     if (flags & ~(IDN_ALLOW_UNASSIGNED | IDN_USE_STD3_ASCII_RULES)) return STATUS_INVALID_PARAMETER;
     if (!src || srclen < -1) return STATUS_INVALID_PARAMETER;
 
-    TRACE( "%x %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
+    TRACE( "%lx %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
 
     if ((status = load_norm_table( 13, &info ))) return status;
 
@@ -1813,7 +1813,7 @@ NTSTATUS WINAPI RtlIdnToUnicode( DWORD flags, const WCHAR *src, INT srclen, WCHA
     if (!src || srclen < -1) return STATUS_INVALID_PARAMETER;
     if (srclen == -1) srclen = wcslen( src ) + 1;
 
-    TRACE( "%x %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
+    TRACE( "%lx %s %p %d\n", flags, debugstr_wn(src, srclen), dst, *dstlen );
 
     if ((status = load_norm_table( 13, &info ))) return status;
 
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 3bef5a561c8..5df196677b7 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -132,7 +132,7 @@ NTSTATUS WINAPI WinSqmEndSession(HANDLE session)
  */
 void WINAPI WinSqmIncrementDWORD(DWORD unk1, DWORD unk2, DWORD unk3)
 {
-    FIXME("(%d, %d, %d): stub\n", unk1, unk2, unk3);
+    FIXME("(%ld, %ld, %ld): stub\n", unk1, unk2, unk3);
 }
 
 /*********************************************************************
@@ -149,7 +149,7 @@ BOOL WINAPI WinSqmIsOptedIn(void)
  */
 HANDLE WINAPI WinSqmStartSession(GUID *sessionguid, DWORD sessionid, DWORD unknown1)
 {
-    FIXME("(%p, 0x%x, 0x%x): stub\n", sessionguid, sessionid, unknown1);
+    FIXME("(%p, 0x%lx, 0x%lx): stub\n", sessionguid, sessionid, unknown1);
     return INVALID_HANDLE_VALUE;
 }
 
@@ -158,7 +158,7 @@ HANDLE WINAPI WinSqmStartSession(GUID *sessionguid, DWORD sessionid, DWORD unkno
  */
 void WINAPI WinSqmSetDWORD(HANDLE session, DWORD datapoint_id, DWORD datapoint_value)
 {
-    FIXME("(%p, %d, %d): stub\n", session, datapoint_id, datapoint_value);
+    FIXME("(%p, %ld, %ld): stub\n", session, datapoint_id, datapoint_value);
 }
 
 /******************************************************************************
@@ -168,7 +168,7 @@ ULONG WINAPI EtwEventActivityIdControl(ULONG code, GUID *guid)
 {
     static int once;
 
-    if (!once++) FIXME("0x%x, %p: stub\n", code, guid);
+    if (!once++) FIXME("0x%lx, %p: stub\n", code, guid);
     return ERROR_SUCCESS;
 }
 
@@ -210,7 +210,7 @@ ULONG WINAPI EtwEventUnregister( REGHANDLE handle )
 ULONG WINAPI EtwEventSetInformation( REGHANDLE handle, EVENT_INFO_CLASS class, void *info,
                                      ULONG length )
 {
-    FIXME("(%s, %u, %p, %u) stub\n", wine_dbgstr_longlong(handle), class, info, length);
+    FIXME("(%s, %u, %p, %lu) stub\n", wine_dbgstr_longlong(handle), class, info, length);
     return ERROR_SUCCESS;
 }
 
@@ -230,7 +230,7 @@ ULONG WINAPI EtwEventWriteString( REGHANDLE handle, UCHAR level, ULONGLONG keywo
 ULONG WINAPI EtwEventWriteTransfer( REGHANDLE handle, PCEVENT_DESCRIPTOR descriptor, LPCGUID activity,
                                     LPCGUID related, ULONG count, PEVENT_DATA_DESCRIPTOR data )
 {
-    FIXME("%s, %p, %s, %s, %u, %p: stub\n", wine_dbgstr_longlong(handle), descriptor,
+    FIXME("%s, %p, %s, %s, %lu, %p: stub\n", wine_dbgstr_longlong(handle), descriptor,
           debugstr_guid(activity), debugstr_guid(related), count, data);
     return ERROR_SUCCESS;
 }
@@ -260,7 +260,7 @@ ULONG WINAPI EtwRegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
                 TRACE_GUID_REGISTRATION *TraceGuidReg, const WCHAR *MofImagePath,
                 const WCHAR *MofResourceName, TRACEHANDLE *RegistrationHandle )
 {
-    WARN("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
+    WARN("(%p, %p, %s, %lu, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
           debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
           debugstr_w(MofResourceName), RegistrationHandle);
 
@@ -285,7 +285,7 @@ ULONG WINAPI EtwRegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
                 TRACE_GUID_REGISTRATION *TraceGuidReg, const char *MofImagePath,
                 const char *MofResourceName, TRACEHANDLE *RegistrationHandle )
 {
-    WARN("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
+    WARN("(%p, %p, %s, %lu, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
           debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
           debugstr_a(MofResourceName), RegistrationHandle);
     return ERROR_SUCCESS;
@@ -318,7 +318,7 @@ BOOLEAN WINAPI EtwEventEnabled( REGHANDLE handle, const EVENT_DESCRIPTOR *descri
 ULONG WINAPI EtwEventWrite( REGHANDLE handle, const EVENT_DESCRIPTOR *descriptor, ULONG count,
     EVENT_DATA_DESCRIPTOR *data )
 {
-    FIXME("(%s, %p, %u, %p): stub\n", wine_dbgstr_longlong(handle), descriptor, count, data);
+    FIXME("(%s, %p, %lu, %p): stub\n", wine_dbgstr_longlong(handle), descriptor, count, data);
     return ERROR_SUCCESS;
 }
 
@@ -364,7 +364,7 @@ ULONG WINAPI EtwLogTraceEvent( TRACEHANDLE SessionHandle, PEVENT_TRACE_HEADER Ev
 ULONG WINAPI EtwTraceMessageVa( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number,
                                 va_list args )
 {
-    FIXME("(%s %x %s %d) : stub\n", wine_dbgstr_longlong(handle), flags, debugstr_guid(guid), number);
+    FIXME("(%s %lx %s %d) : stub\n", wine_dbgstr_longlong(handle), flags, debugstr_guid(guid), number);
     return ERROR_SUCCESS;
 }
 
diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index cccd000a6c6..f919ad1d957 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -714,7 +714,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer,
     DWORD       dosdev;
     DWORD       reqsize;
 
-    TRACE("(%s %u %p %p)\n", debugstr_w(name), size, buffer, file_part);
+    TRACE("(%s %lu %p %p)\n", debugstr_w(name), size, buffer, file_part);
 
     if (!name || !*name) return 0;
 
@@ -870,7 +870,7 @@ ULONG WINAPI RtlGetCurrentDirectory_U(ULONG buflen, LPWSTR buf)
     UNICODE_STRING*     us;
     ULONG               len;
 
-    TRACE("(%u %p)\n", buflen, buf);
+    TRACE("(%lu %p)\n", buflen, buf);
 
     RtlAcquirePebLock();
 
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index 294b724a5e5..98f56bc4b08 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -229,7 +229,7 @@ NTSTATUS WINAPI RtlOpenCurrentUser(
 	UNICODE_STRING ObjectName;
 	NTSTATUS ret;
 
-	TRACE("(0x%08x, %p)\n",DesiredAccess, KeyHandle);
+	TRACE("(0x%08lx, %p)\n",DesiredAccess, KeyHandle);
 
         if ((ret = RtlFormatCurrentUserKeyPath(&ObjectName))) return ret;
 	InitializeObjectAttributes(&ObjectAttributes,&ObjectName,OBJ_CASE_INSENSITIVE,0, NULL);
@@ -475,7 +475,7 @@ NTSTATUS WINAPI RtlQueryRegistryValues(IN ULONG RelativeTo, IN PCWSTR Path,
     NTSTATUS status=STATUS_SUCCESS, ret = STATUS_SUCCESS;
     INT i;
 
-    TRACE("(%d, %s, %p, %p, %p)\n", RelativeTo, debugstr_w(Path), QueryTable, Context, Environment);
+    TRACE("(%ld, %s, %p, %p, %p)\n", RelativeTo, debugstr_w(Path), QueryTable, Context, Environment);
 
     if(Path == NULL)
         return STATUS_INVALID_PARAMETER;
@@ -643,7 +643,7 @@ NTSTATUS WINAPI RtlCheckRegistryKey(IN ULONG RelativeTo, IN PWSTR Path)
     HANDLE handle;
     NTSTATUS status;
 
-    TRACE("(%d, %s)\n", RelativeTo, debugstr_w(Path));
+    TRACE("(%ld, %s)\n", RelativeTo, debugstr_w(Path));
 
     if(!RelativeTo && (Path == NULL || Path[0] == 0))
         return STATUS_OBJECT_PATH_SYNTAX_BAD;
@@ -712,7 +712,7 @@ NTSTATUS WINAPI RtlDeleteRegistryValue(IN ULONG RelativeTo, IN PCWSTR Path, IN P
     HANDLE handle;
     UNICODE_STRING Value;
 
-    TRACE("(%d, %s, %s)\n", RelativeTo, debugstr_w(Path), debugstr_w(ValueName));
+    TRACE("(%ld, %s, %s)\n", RelativeTo, debugstr_w(Path), debugstr_w(ValueName));
 
     RtlInitUnicodeString(&Value, ValueName);
     if(RelativeTo == RTL_REGISTRY_HANDLE)
@@ -750,7 +750,7 @@ NTSTATUS WINAPI RtlWriteRegistryValue( ULONG RelativeTo, PCWSTR path, PCWSTR nam
     NTSTATUS status;
     UNICODE_STRING str;
 
-    TRACE( "(%d, %s, %s) -> %d: %p [%d]\n", RelativeTo, debugstr_w(path), debugstr_w(name),
+    TRACE( "(%ld, %s, %s) -> %ld: %p [%ld]\n", RelativeTo, debugstr_w(path), debugstr_w(name),
            type, data, length );
 
     RtlInitUnicodeString( &str, name );
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index be2dc833377..5a551e9046a 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -324,11 +324,11 @@ DECLSPEC_HIDDEN void * WINAPI relay_trace_entry( struct relay_descr *descr, unsi
         switch (arg_types[i])
         {
         case 'j': /* int64 */
-            TRACE( "%x%08x", stack[pos+1], stack[pos] );
+            TRACE( "%lx%08lx", stack[pos+1], stack[pos] );
             pos += 2;
             break;
         case 'k': /* int128 */
-            TRACE( "{%08x,%08x,%08x,%08x}", stack[pos], stack[pos+1], stack[pos+2], stack[pos+3] );
+            TRACE( "{%08lx,%08lx,%08lx,%08lx}", stack[pos], stack[pos+1], stack[pos+2], stack[pos+3] );
             pos += 4;
             break;
         case 's': /* str */
@@ -346,7 +346,7 @@ DECLSPEC_HIDDEN void * WINAPI relay_trace_entry( struct relay_descr *descr, unsi
             break;
         case 'i': /* long */
         default:
-            TRACE( "%08x", stack[pos++] );
+            TRACE( "%08lx", stack[pos++] );
             break;
         }
         if (!is_ret_val( arg_types[i+1] )) TRACE( "," );
@@ -357,7 +357,7 @@ DECLSPEC_HIDDEN void * WINAPI relay_trace_entry( struct relay_descr *descr, unsi
         *nb_args |= 0x80000000;  /* thiscall/fastcall */
         if (arg_types[1] == 't') *nb_args |= 0x40000000;  /* fastcall */
     }
-    TRACE( ") ret=%08x\n", stack[-1] );
+    TRACE( ") ret=%08lx\n", stack[-1] );
     return entry_point->orig_func;
 }
 
@@ -730,13 +730,13 @@ DECLSPEC_HIDDEN void * WINAPI relay_trace_entry( struct relay_descr *descr, unsi
             break;
         case 'i': /* long */
         default:
-            TRACE( "%08zx", stack[i] );
+            TRACE( "%08Ix", stack[i] );
             break;
         }
         if (!is_ret_val( arg_types[i+1] )) TRACE( "," );
     }
     *nb_args = i;
-    TRACE( ") ret=%08zx\n", stack[-1] );
+    TRACE( ") ret=%08Ix\n", stack[-1] );
     return entry_point->orig_func;
 }
 
@@ -746,7 +746,7 @@ DECLSPEC_HIDDEN void * WINAPI relay_trace_entry( struct relay_descr *descr, unsi
 DECLSPEC_HIDDEN void WINAPI relay_trace_exit( struct relay_descr *descr, unsigned int idx,
                                               INT_PTR retaddr, INT_PTR retval )
 {
-    TRACE( "\1Ret  %s() retval=%08zx ret=%08zx\n",
+    TRACE( "\1Ret  %s() retval=%08Ix ret=%08Ix\n",
            func_name( descr->private, LOWORD(idx) ), retval, retaddr );
 }
 
@@ -1157,7 +1157,7 @@ static void SNOOP_PrintArg(DWORD x)
 {
     int i,nostring;
 
-    TRACE_(snoop)("%08x",x);
+    TRACE_(snoop)("%08lx",x);
     if (IS_INTARG(x) || TRACE_ON(seh)) return; /* trivial reject to avoid faults */
     __TRY
     {
@@ -1255,7 +1255,7 @@ void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Entry( void **stack )
         if (!TRACE_ON(snoop)) return;
 
 	if (fun->name) TRACE_(snoop)("\1CALL %s.%s(", dll->name, fun->name);
-	else TRACE_(snoop)("\1CALL %s.%d(", dll->name, dll->ordbase+ret->ordinal);
+	else TRACE_(snoop)("\1CALL %s.%ld(", dll->name, dll->ordbase+ret->ordinal);
 	if (fun->nrofargs>0) {
 		max = fun->nrofargs; if (max>16) max=16;
 		for (i=0;i<max;i++)
@@ -1271,7 +1271,7 @@ void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Entry( void **stack )
                                             0,16*sizeof(DWORD));
 		memcpy(ret->args, stack + 2, sizeof(DWORD)*16);
 	}
-	TRACE_(snoop)(") ret=%08x\n",(DWORD)ret->origreturn);
+	TRACE_(snoop)(") ret=%08lx\n",(DWORD)ret->origreturn);
 }
 
 void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Return( void **stack )
@@ -1300,7 +1300,7 @@ void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Return( void **stack )
                 if (fun->name)
                     TRACE_(snoop)("\1RET  %s.%s(", ret->dll->name, fun->name);
                 else
-                    TRACE_(snoop)("\1RET  %s.%d(", ret->dll->name, ret->dll->ordbase+ret->ordinal);
+                    TRACE_(snoop)("\1RET  %s.%ld(", ret->dll->name, ret->dll->ordbase+ret->ordinal);
 
 		max = fun->nrofargs;
 		if (max>16) max=16;
@@ -1310,17 +1310,17 @@ void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Return( void **stack )
                     SNOOP_PrintArg(ret->args[i]);
                     if (i<max-1) TRACE_(snoop)(",");
                 }
-		TRACE_(snoop)(") retval=%08x ret=%08x\n", retval, (DWORD)ret->origreturn );
+		TRACE_(snoop)(") retval=%08lx ret=%08lx\n", retval, (DWORD)ret->origreturn );
 		RtlFreeHeap(GetProcessHeap(),0,ret->args);
 		ret->args = NULL;
 	}
         else
         {
             if (fun->name)
-		TRACE_(snoop)("\1RET  %s.%s() retval=%08x ret=%08x\n",
+		TRACE_(snoop)("\1RET  %s.%s() retval=%08lx ret=%08lx\n",
                         ret->dll->name, fun->name, retval, (DWORD)ret->origreturn);
             else
-		TRACE_(snoop)("\1RET  %s.%d() retval=%08x ret=%08x\n",
+		TRACE_(snoop)("\1RET  %s.%ld() retval=%08lx ret=%08lx\n",
 			ret->dll->name,ret->dll->ordbase+ret->ordinal,
 			retval, (DWORD)ret->origreturn);
         }
diff --git a/dlls/ntdll/resource.c b/dlls/ntdll/resource.c
index 58a0fc7d2e2..39ce638c103 100644
--- a/dlls/ntdll/resource.c
+++ b/dlls/ntdll/resource.c
@@ -266,7 +266,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrFindResourceDirectory_U( HMODULE hmod, cons
 
     __TRY
     {
-	if (info) TRACE( "module %p type %s name %s lang %04x level %d\n",
+	if (info) TRACE( "module %p type %s name %s lang %04lx level %ld\n",
                      hmod, debugstr_w((LPCWSTR)info->Type),
                      level > 1 ? debugstr_w((LPCWSTR)info->Name) : "",
                      level > 2 ? info->Language : 0, level );
@@ -294,7 +294,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrFindResource_U( HMODULE hmod, const LDR_RES
 
     __TRY
     {
-	if (info) TRACE( "module %p type %s name %s lang %04x level %d\n",
+	if (info) TRACE( "module %p type %s name %s lang %04lx level %ld\n",
                      hmod, debugstr_w((LPCWSTR)info->Type),
                      level > 1 ? debugstr_w((LPCWSTR)info->Name) : "",
                      level > 2 ? info->Language : 0, level );
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 11067f44941..68f6e843891 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -355,7 +355,7 @@ NTSTATUS WINAPI vDbgPrintExWithPrefix( LPCSTR prefix, ULONG id, ULONG level, LPC
     len += _vsnprintf( buf + len, sizeof(buf) - len, fmt, args );
     end = buf + len - 1;
 
-    WARN_(debugstr)(*end == '\n' ? "%08x:%08x: %s" : "%08x:%08x: %s\n", id, level_mask, buf);
+    WARN_(debugstr)(*end == '\n' ? "%08lx:%08lx: %s" : "%08lx:%08lx: %s\n", id, level_mask, buf);
 
     if (level_mask & (1 << DPFLTR_ERROR_LEVEL) && NtCurrentTeb()->Peb->BeingDebugged)
     {
@@ -469,7 +469,7 @@ ULONG WINAPI RtlNumberGenericTableElements(RTL_GENERIC_TABLE *table)
  */
 void * WINAPI RtlGetElementGenericTable(RTL_GENERIC_TABLE *table, ULONG index)
 {
-    FIXME("(%p, %u) stub!\n", table, index);
+    FIXME("(%p, %lu) stub!\n", table, index);
     return NULL;
 }
 
@@ -601,7 +601,7 @@ void WINAPI RtlCopyMemory(void *dest, const void *src, SIZE_T len)
  */
 void WINAPI RtlAssert(void *assertion, void *filename, ULONG linenumber, char *message)
 {
-    FIXME("(%s, %s, %u, %s): stub\n", debugstr_a((char*)assertion), debugstr_a((char*)filename),
+    FIXME("(%s, %s, %lu, %s): stub\n", debugstr_a((char*)assertion), debugstr_a((char*)filename),
         linenumber, debugstr_a(message));
 }
 
@@ -620,7 +620,7 @@ void WINAPI RtlAssert(void *assertion, void *filename, ULONG linenumber, char *m
  */
 VOID WINAPI RtlFillMemoryUlong(ULONG* lpDest, ULONG ulCount, ULONG ulValue)
 {
-  TRACE("(%p,%d,%d)\n", lpDest, ulCount, ulValue);
+  TRACE("(%p,%ld,%ld)\n", lpDest, ulCount, ulValue);
 
   ulCount /= sizeof(ULONG);
   while(ulCount--)
@@ -644,7 +644,7 @@ DWORD WINAPI RtlComputeCrc32(DWORD dwInitial, const BYTE *pData, INT iLen)
 {
   DWORD crc = ~dwInitial;
 
-  TRACE("(%d,%p,%d)\n", dwInitial, pData, iLen);
+  TRACE("(%ld,%p,%d)\n", dwInitial, pData, iLen);
 
   while (iLen > 0)
   {
@@ -1349,7 +1349,7 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExW(const IN_ADDR *pin, USHORT port, LPWST
     if (!pin || !buffer || !psize)
         return STATUS_INVALID_PARAMETER;
 
-    TRACE("(%p:0x%x, %d, %p, %p:%d)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
+    TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
 
     needed = swprintf(tmp_ip, ARRAY_SIZE(tmp_ip), L"%u.%u.%u.%u",
                       pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
@@ -1382,7 +1382,7 @@ NTSTATUS WINAPI RtlIpv4AddressToStringExA(const IN_ADDR *pin, USHORT port, LPSTR
     if (!pin || !buffer || !psize)
         return STATUS_INVALID_PARAMETER;
 
-    TRACE("(%p:0x%x, %d, %p, %p:%d)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
+    TRACE("(%p:0x%lx, %d, %p, %p:%ld)\n", pin, pin->S_un.S_addr, port, buffer, psize, *psize);
 
     needed = sprintf(tmp_ip, "%u.%u.%u.%u",
                      pin->S_un.S_un_b.s_b1, pin->S_un.S_un_b.s_b2,
@@ -1463,7 +1463,7 @@ NTSTATUS WINAPI RtlIpv6AddressToStringExA(const IN6_ADDR *address, ULONG scope,
     ULONG needed;
     NTSTATUS ret;
 
-    TRACE("(%p %u %u %p %p)\n", address, scope, port, str, size);
+    TRACE("(%p %lu %u %p %p)\n", address, scope, port, str, size);
 
     if (!address || !str || !size)
         return STATUS_INVALID_PARAMETER;
@@ -1509,7 +1509,7 @@ NTSTATUS WINAPI RtlIpv6AddressToStringExA(const IN6_ADDR *address, ULONG scope,
         p = RtlIpv4AddressToStringA((IN_ADDR *)(address->s6_words + 6), p);
     }
 
-    if (scope) p += sprintf(p, "%%%u", scope);
+    if (scope) p += sprintf(p, "%%%lu", scope);
 
     if (port) p += sprintf(p, "]:%u", ntohs(port));
 
@@ -1863,7 +1863,7 @@ NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG unco
                                   PUCHAR compressed, ULONG compressed_size, ULONG chunk_size,
                                   PULONG final_size, PVOID workspace)
 {
-    FIXME("0x%04x, %p, %u, %p, %u, %u, %p, %p: semi-stub\n", format, uncompressed,
+    FIXME("0x%04x, %p, %lu, %p, %lu, %lu, %p, %p: semi-stub\n", format, uncompressed,
           uncompressed_size, compressed, compressed_size, chunk_size, final_size, workspace);
 
     switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
@@ -2066,7 +2066,7 @@ NTSTATUS WINAPI RtlDecompressFragment(USHORT format, PUCHAR uncompressed, ULONG
                                PUCHAR compressed, ULONG compressed_size, ULONG offset,
                                PULONG final_size, PVOID workspace)
 {
-    TRACE("0x%04x, %p, %u, %p, %u, %u, %p, %p\n", format, uncompressed,
+    TRACE("0x%04x, %p, %lu, %p, %lu, %lu, %p, %p\n", format, uncompressed,
           uncompressed_size, compressed, compressed_size, offset, final_size, workspace);
 
     switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
@@ -2092,7 +2092,7 @@ NTSTATUS WINAPI RtlDecompressFragment(USHORT format, PUCHAR uncompressed, ULONG
 NTSTATUS WINAPI RtlDecompressBuffer(USHORT format, PUCHAR uncompressed, ULONG uncompressed_size,
                                     PUCHAR compressed, ULONG compressed_size, PULONG final_size)
 {
-    TRACE("0x%04x, %p, %u, %p, %u, %p\n", format, uncompressed,
+    TRACE("0x%04x, %p, %lu, %p, %lu, %p\n", format, uncompressed,
         uncompressed_size, compressed, compressed_size, final_size);
 
     return RtlDecompressFragment(format, uncompressed, uncompressed_size,
@@ -2191,7 +2191,7 @@ void WINAPI RtlInitializeGenericTableAvl(PRTL_AVL_TABLE table, PRTL_AVL_COMPARE_
  */
 void WINAPI RtlInsertElementGenericTableAvl(PRTL_AVL_TABLE table, void *buffer, ULONG size, BOOL *element)
 {
-    FIXME("%p %p %u %p: stub\n", table, buffer, size, element);
+    FIXME("%p %p %lu %p: stub\n", table, buffer, size, element);
 }
 
 /*********************************************************************
diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c
index 16761f3449d..a86c234f778 100644
--- a/dlls/ntdll/rtlbitmap.c
+++ b/dlls/ntdll/rtlbitmap.c
@@ -74,7 +74,7 @@ static const signed char NTDLL_mostSignificant[16] = {
  */
 VOID WINAPI RtlInitializeBitMap(PRTL_BITMAP lpBits, PULONG lpBuff, ULONG ulSize)
 {
-  TRACE("(%p,%p,%u)\n", lpBits,lpBuff,ulSize);
+  TRACE("(%p,%p,%lu)\n", lpBits,lpBuff,ulSize);
   lpBits->SizeOfBitMap = ulSize;
   lpBits->Buffer = lpBuff;
 }
@@ -130,7 +130,7 @@ VOID WINAPI RtlSetBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
 {
   LPBYTE lpOut;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulStart, ulCount);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount);
 
   if (!lpBits || !ulCount ||
       ulStart >= lpBits->SizeOfBitMap ||
@@ -191,7 +191,7 @@ VOID WINAPI RtlClearBits(PRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
 {
   LPBYTE lpOut;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulStart, ulCount);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount);
 
   if (!lpBits || !ulCount ||
       ulStart >= lpBits->SizeOfBitMap ||
@@ -254,7 +254,7 @@ BOOLEAN WINAPI RtlAreBitsSet(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount)
   LPBYTE lpOut;
   ULONG ulRemainder;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulStart, ulCount);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount);
 
   if (!lpBits || !ulCount ||
       ulStart >= lpBits->SizeOfBitMap ||
@@ -327,7 +327,7 @@ BOOLEAN WINAPI RtlAreBitsClear(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount
   LPBYTE lpOut;
   ULONG ulRemainder;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulStart, ulCount);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount);
 
   if (!lpBits || !ulCount ||
       ulStart >= lpBits->SizeOfBitMap ||
@@ -395,7 +395,7 @@ ULONG WINAPI RtlFindSetBits(PCRTL_BITMAP lpBits, ULONG ulCount, ULONG ulHint)
 {
   ULONG ulPos, ulEnd;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulCount, ulHint);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulCount, ulHint);
 
   if (!lpBits || !ulCount || ulCount > lpBits->SizeOfBitMap)
     return ~0U;
@@ -442,7 +442,7 @@ ULONG WINAPI RtlFindClearBits(PCRTL_BITMAP lpBits, ULONG ulCount, ULONG ulHint)
 {
   ULONG ulPos, ulEnd;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulCount, ulHint);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulCount, ulHint);
 
   if (!lpBits || !ulCount || ulCount > lpBits->SizeOfBitMap)
     return ~0U;
@@ -489,7 +489,7 @@ ULONG WINAPI RtlFindSetBitsAndClear(PRTL_BITMAP lpBits, ULONG ulCount, ULONG ulH
 {
   ULONG ulPos;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulCount, ulHint);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulCount, ulHint);
 
   ulPos = RtlFindSetBits(lpBits, ulCount, ulHint);
   if (ulPos != ~0U)
@@ -514,7 +514,7 @@ ULONG WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP lpBits, ULONG ulCount, ULONG ulH
 {
   ULONG ulPos;
 
-  TRACE("(%p,%u,%u)\n", lpBits, ulCount, ulHint);
+  TRACE("(%p,%lu,%lu)\n", lpBits, ulCount, ulHint);
 
   ulPos = RtlFindClearBits(lpBits, ulCount, ulHint);
   if (ulPos != ~0U)
@@ -882,7 +882,7 @@ ULONG WINAPI RtlFindNextForwardRunSet(PCRTL_BITMAP lpBits, ULONG ulStart, PULONG
 {
   ULONG ulSize = 0;
 
-  TRACE("(%p,%u,%p)\n", lpBits, ulStart, lpPos);
+  TRACE("(%p,%lu,%p)\n", lpBits, ulStart, lpPos);
 
   if (lpBits && ulStart < lpBits->SizeOfBitMap && lpPos)
     *lpPos = NTDLL_FindSetRun(lpBits, ulStart, &ulSize);
@@ -909,7 +909,7 @@ ULONG WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP lpBits, ULONG ulStart, PULO
 {
   ULONG ulSize = 0;
 
-  TRACE("(%p,%u,%p)\n", lpBits, ulStart, lpPos);
+  TRACE("(%p,%lu,%p)\n", lpBits, ulStart, lpPos);
 
   if (lpBits && ulStart < lpBits->SizeOfBitMap && lpPos)
     *lpPos = NTDLL_FindClearRun(lpBits, ulStart, &ulSize);
@@ -934,7 +934,7 @@ ULONG WINAPI RtlFindNextForwardRunClear(PCRTL_BITMAP lpBits, ULONG ulStart, PULO
  */
 ULONG WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP lpBits, ULONG ulStart, PULONG lpPos)
 {
-  FIXME("(%p,%u,%p)-stub!\n", lpBits, ulStart, lpPos);
+  FIXME("(%p,%lu,%p)-stub!\n", lpBits, ulStart, lpPos);
   return 0;
 }
 
@@ -955,7 +955,7 @@ ULONG WINAPI RtlFindLastBackwardRunSet(PCRTL_BITMAP lpBits, ULONG ulStart, PULON
  */
 ULONG WINAPI RtlFindLastBackwardRunClear(PCRTL_BITMAP lpBits, ULONG ulStart, PULONG lpPos)
 {
-  FIXME("(%p,%u,%p)-stub!\n", lpBits, ulStart, lpPos);
+  FIXME("(%p,%lu,%p)-stub!\n", lpBits, ulStart, lpPos);
   return 0;
 }
 
@@ -971,7 +971,7 @@ static ULONG NTDLL_FindRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries,
   BOOL bNeedSort = ulCount > 1;
   ULONG ulPos = 0, ulRuns = 0;
 
-  TRACE("(%p,%p,%d,%d)\n", lpBits, lpSeries, ulCount, bLongest);
+  TRACE("(%p,%p,%ld,%d)\n", lpBits, lpSeries, ulCount, bLongest);
 
   if (!ulCount)
     return ~0U;
@@ -1033,7 +1033,7 @@ static ULONG NTDLL_FindRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries,
 ULONG WINAPI RtlFindSetRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries,
                             ULONG ulCount, BOOLEAN bLongest)
 {
-  TRACE("(%p,%p,%u,%d)\n", lpBits, lpSeries, ulCount, bLongest);
+  TRACE("(%p,%p,%lu,%d)\n", lpBits, lpSeries, ulCount, bLongest);
 
   return NTDLL_FindRuns(lpBits, lpSeries, ulCount, bLongest, NTDLL_FindSetRun);
 }
@@ -1055,7 +1055,7 @@ ULONG WINAPI RtlFindSetRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries,
 ULONG WINAPI RtlFindClearRuns(PCRTL_BITMAP lpBits, PRTL_BITMAP_RUN lpSeries,
                               ULONG ulCount, BOOLEAN bLongest)
 {
-  TRACE("(%p,%p,%u,%d)\n", lpBits, lpSeries, ulCount, bLongest);
+  TRACE("(%p,%p,%lu,%d)\n", lpBits, lpSeries, ulCount, bLongest);
 
   return NTDLL_FindRuns(lpBits, lpSeries, ulCount, bLongest, NTDLL_FindClearRun);
 }
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 2260ecab2fd..13f91533100 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1835,7 +1835,7 @@ NTSTATUS WINAPI RtlFormatMessageEx( const WCHAR *src, ULONG width, BOOLEAN ignor
     WCHAR *line  = buffer;                         /* start of last line */
     WCHAR *space = NULL;                           /* last space */
 
-    if (flags) FIXME( "%s unknown flags %x\n", debugstr_w(src), flags );
+    if (flags) FIXME( "%s unknown flags %lx\n", debugstr_w(src), flags );
 
     args_data.last  = 0;
     args_data.array = is_array ? (ULONG_PTR *)args : NULL;
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index eccfc82ce8c..776371414bc 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -136,7 +136,7 @@ NTSTATUS WINAPI RtlAllocateAndInitializeSid (
 {
     SID *tmp_sid;
 
-    TRACE("(%p, 0x%04x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,%p)\n",
+    TRACE("(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)\n",
 		pIdentifierAuthority,nSubAuthorityCount,
 		nSubAuthority0, nSubAuthority1,	nSubAuthority2, nSubAuthority3,
 		nSubAuthority4, nSubAuthority5,	nSubAuthority6, nSubAuthority7, pSid);
@@ -553,7 +553,7 @@ NTSTATUS WINAPI RtlValidSecurityDescriptor(
 BOOLEAN WINAPI RtlValidRelativeSecurityDescriptor(PSECURITY_DESCRIPTOR descriptor,
     ULONG length, SECURITY_INFORMATION info)
 {
-    FIXME("%p,%u,%d: semi-stub\n", descriptor, length, info);
+    FIXME("%p,%lu,%ld: semi-stub\n", descriptor, length, info);
     return RtlValidSecurityDescriptor(descriptor) == STATUS_SUCCESS;
 }
 
@@ -843,7 +843,7 @@ NTSTATUS WINAPI RtlMakeSelfRelativeSD(
     SECURITY_DESCRIPTOR* pAbs = pAbsoluteSecurityDescriptor;
     SECURITY_DESCRIPTOR_RELATIVE *pRel = pSelfRelativeSecurityDescriptor;
 
-    TRACE(" %p %p %p(%d)\n", pAbs, pRel, lpdwBufferLength,
+    TRACE(" %p %p %p(%ld)\n", pAbs, pRel, lpdwBufferLength,
         lpdwBufferLength ? *lpdwBufferLength: -1);
 
     if (!lpdwBufferLength || !pAbs)
@@ -1114,7 +1114,7 @@ NTSTATUS WINAPI RtlAbsoluteToSelfRelativeSD(
  */
 NTSTATUS WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev)
 {
-	TRACE("%p 0x%08x 0x%08x\n", acl, size, rev);
+	TRACE("%p 0x%08lx 0x%08lx\n", acl, size, rev);
 
 	if (rev < MIN_ACL_REVISION || rev > MAX_ACL_REVISION)
 		return STATUS_INVALID_PARAMETER;
@@ -1217,7 +1217,7 @@ NTSTATUS  WINAPI RtlDeleteAce(PACL pAcl, DWORD dwAceIndex)
 		pAcl->AceCount--;
 	}
 
-	TRACE("pAcl=%p dwAceIndex=%d status=0x%08x\n", pAcl, dwAceIndex, status);
+	TRACE("pAcl=%p dwAceIndex=%ld status=0x%08lx\n", pAcl, dwAceIndex, status);
 
 	return status;
 }
@@ -1244,7 +1244,7 @@ NTSTATUS WINAPI RtlAddAccessAllowedAceEx(
 	IN DWORD AccessMask,
 	IN PSID pSid)
 {
-   TRACE("(%p,0x%08x,0x%08x,%p)\n", pAcl, dwAceRevision, AccessMask, pSid);
+   TRACE("(%p,0x%08lx,0x%08lx,%p)\n", pAcl, dwAceRevision, AccessMask, pSid);
 
     return add_access_ace(pAcl, dwAceRevision, AceFlags,
                           AccessMask, pSid, ACCESS_ALLOWED_ACE_TYPE);
@@ -1262,7 +1262,7 @@ NTSTATUS WINAPI RtlAddAccessAllowedObjectAce(
     IN GUID* pInheritedObjectTypeGuid,
     IN PSID pSid)
 {
-    FIXME("%p %x %x %x %p %p %p - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
+    FIXME("%p %lx %lx %lx %p %p %p - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
           pObjectTypeGuid, pInheritedObjectTypeGuid, pSid);
     return STATUS_NOT_IMPLEMENTED;
 }
@@ -1289,7 +1289,7 @@ NTSTATUS WINAPI RtlAddAccessDeniedAceEx(
 	IN DWORD AccessMask,
 	IN PSID pSid)
 {
-   TRACE("(%p,0x%08x,0x%08x,%p)\n", pAcl, dwAceRevision, AccessMask, pSid);
+   TRACE("(%p,0x%08lx,0x%08lx,%p)\n", pAcl, dwAceRevision, AccessMask, pSid);
 
     return add_access_ace(pAcl, dwAceRevision, AceFlags,
                           AccessMask, pSid, ACCESS_DENIED_ACE_TYPE);
@@ -1307,7 +1307,7 @@ NTSTATUS WINAPI RtlAddAccessDeniedObjectAce(
     IN GUID* pInheritedObjectTypeGuid,
     IN PSID pSid)
 {
-    FIXME("%p %x %x %x %p %p %p - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
+    FIXME("%p %lx %lx %lx %p %p %p - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
           pObjectTypeGuid, pInheritedObjectTypeGuid, pSid);
     return STATUS_NOT_IMPLEMENTED;
 }
@@ -1324,7 +1324,7 @@ NTSTATUS WINAPI RtlAddAuditAccessAceEx(
     IN BOOL bAuditSuccess, 
     IN BOOL bAuditFailure) 
 { 
-    TRACE("(%p,%d,0x%08x,0x%08x,%p,%u,%u)\n",pAcl,dwAceRevision,dwAceFlags,dwAccessMask,
+    TRACE("(%p,%ld,0x%08lx,0x%08lx,%p,%u,%u)\n",pAcl,dwAceRevision,dwAceFlags,dwAccessMask,
           pSid,bAuditSuccess,bAuditFailure);
 
     if (bAuditSuccess)
@@ -1365,7 +1365,7 @@ NTSTATUS WINAPI RtlAddAuditAccessObjectAce(
     IN BOOL bAuditSuccess,
     IN BOOL bAuditFailure)
 {
-    FIXME("%p %x %x %x %p %p %p %d %d - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
+    FIXME("%p %lx %lx %lx %p %p %p %d %d - stub\n", pAcl, dwAceRevision, dwAceFlags, dwAccessMask,
           pObjectTypeGuid, pInheritedObjectTypeGuid, pSid, bAuditSuccess, bAuditFailure);
     return STATUS_NOT_IMPLEMENTED;
 }
@@ -1385,7 +1385,7 @@ NTSTATUS WINAPI RtlAddMandatoryAce(
                                      SYSTEM_MANDATORY_LABEL_NO_READ_UP |
                                      SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP;
 
-    TRACE("(%p, %u, 0x%08x, 0x%08x, %u, %p)\n", pAcl, dwAceRevision, dwAceFlags,
+    TRACE("(%p, %lu, 0x%08lx, 0x%08lx, %lu, %p)\n", pAcl, dwAceRevision, dwAceFlags,
                                                 dwMandatoryFlags, dwAceType, pSid);
 
     if (dwAceType != SYSTEM_MANDATORY_LABEL_ACE_TYPE)
@@ -1445,7 +1445,7 @@ NTSTATUS WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
 {
 	PACE_HEADER ace;
 
-	TRACE("(%p,%d,%p)\n",pAcl,dwAceIndex,pAce);
+	TRACE("(%p,%ld,%p)\n",pAcl,dwAceIndex,pAce);
 
 	if (dwAceIndex >= pAcl->AceCount)
 		return STATUS_INVALID_PARAMETER;
@@ -1494,7 +1494,7 @@ RtlAdjustPrivilege(ULONG Privilege,
     HANDLE TokenHandle;
     NTSTATUS Status;
 
-    TRACE("(%d, %s, %s, %p)\n", Privilege, Enable ? "TRUE" : "FALSE",
+    TRACE("(%ld, %s, %s, %p)\n", Privilege, Enable ? "TRUE" : "FALSE",
         CurrentThread ? "TRUE" : "FALSE", Enabled);
 
     if (CurrentThread)
@@ -1513,7 +1513,7 @@ RtlAdjustPrivilege(ULONG Privilege,
 
     if (Status)
     {
-        WARN("Retrieving token handle failed (Status %x)\n", Status);
+        WARN("Retrieving token handle failed (Status %lx)\n", Status);
         return Status;
     }
 
@@ -1538,7 +1538,7 @@ RtlAdjustPrivilege(ULONG Privilege,
     }
     if (Status)
     {
-        WARN("NtAdjustPrivilegesToken() failed (Status %x)\n", Status);
+        WARN("NtAdjustPrivilegesToken() failed (Status %lx)\n", Status);
         return Status;
     }
 
@@ -1658,7 +1658,7 @@ NTSTATUS WINAPI RtlQueryInformationAcl(
 {
     NTSTATUS status = STATUS_SUCCESS;
 
-    TRACE("pAcl=%p pAclInfo=%p len=%d, class=%d\n", 
+    TRACE("pAcl=%p pAclInfo=%p len=%ld, class=%d\n", 
         pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass);
 
     switch (dwAclInformationClass)
@@ -1687,7 +1687,7 @@ NTSTATUS WINAPI RtlQueryInformationAcl(
                 paclsize->AclBytesInUse = acl_bytesInUse(pAcl);
 		if (pAcl->AclSize < paclsize->AclBytesInUse)
                 {
-                    WARN("Acl uses %d bytes, but only has %d allocated!  Returning smaller of the two values.\n", pAcl->AclSize, paclsize->AclBytesInUse);
+                    WARN("Acl uses %d bytes, but only has %ld allocated!  Returning smaller of the two values.\n", pAcl->AclSize, paclsize->AclBytesInUse);
                     paclsize->AclBytesFree = 0;
                     paclsize->AclBytesInUse = pAcl->AclSize;
                 }
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index 14971032ce6..b3e91cbb31e 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -135,10 +135,10 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *context )
         }
 
         /* Call handler */
-        TRACE( "calling handler at %p code=%x flags=%x\n",
+        TRACE( "calling handler at %p code=%lx flags=%lx\n",
                frame->Handler, rec->ExceptionCode, rec->ExceptionFlags );
         res = EXC_CallHandler( rec, frame, context, &dispatch, frame->Handler, raise_handler );
-        TRACE( "handler at %p returned %x\n", frame->Handler, res );
+        TRACE( "handler at %p returned %lx\n", frame->Handler, res );
 
         if (frame == nested_frame)
         {
@@ -175,11 +175,11 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     NTSTATUS status;
     DWORD c;
 
-    TRACE( "code=%x flags=%x addr=%p ip=%08x tid=%04x\n",
+    TRACE( "code=%lx flags=%lx addr=%p ip=%08lx tid=%04lx\n",
            rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
            context->Eip, GetCurrentThreadId() );
     for (c = 0; c < rec->NumberParameters; c++)
-        TRACE( " info[%d]=%08lx\n", c, rec->ExceptionInformation[c] );
+        TRACE( " info[%ld]=%08lx\n", c, rec->ExceptionInformation[c] );
 
     if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
     {
@@ -194,7 +194,7 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     }
     else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
     {
-        WARN( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
+        WARN( "Thread %04lx renamed to %s\n", rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
     }
     else if (rec->ExceptionCode == DBG_PRINTEXCEPTION_C)
     {
@@ -207,14 +207,14 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     else
     {
         if (rec->ExceptionCode == STATUS_ASSERTION_FAILURE)
-            ERR( "%s exception (code=%x) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
+            ERR( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
         else
-            WARN( "%s exception (code=%x) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
+            WARN( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
 
-        TRACE(" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",
+        TRACE(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
               context->Eax, context->Ebx, context->Ecx,
               context->Edx, context->Esi, context->Edi );
-        TRACE(" ebp=%08x esp=%08x cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x flags=%08x\n",
+        TRACE(" ebp=%08lx esp=%08lx cs=%04lx ss=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx flags=%08lx\n",
               context->Ebp, context->Esp, context->SegCs, context->SegSs, context->SegDs,
               context->SegEs, context->SegFs, context->SegGs, context->EFlags );
     }
@@ -368,10 +368,10 @@ void WINAPI DECLSPEC_HIDDEN __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEn
 
     pRecord->ExceptionFlags |= EH_UNWINDING | (pEndFrame ? 0 : EH_EXIT_UNWIND);
 
-    TRACE( "code=%x flags=%x\n", pRecord->ExceptionCode, pRecord->ExceptionFlags );
-    TRACE( "eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",
+    TRACE( "code=%lx flags=%lx\n", pRecord->ExceptionCode, pRecord->ExceptionFlags );
+    TRACE( "eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
            context->Eax, context->Ebx, context->Ecx, context->Edx, context->Esi, context->Edi );
-    TRACE( "ebp=%08x esp=%08x eip=%08x cs=%04x ds=%04x fs=%04x gs=%04x flags=%08x\n",
+    TRACE( "ebp=%08lx esp=%08lx eip=%08lx cs=%04x ds=%04x fs=%04x gs=%04x flags=%08lx\n",
            context->Ebp, context->Esp, context->Eip, LOWORD(context->SegCs), LOWORD(context->SegDs),
            LOWORD(context->SegFs), LOWORD(context->SegGs), context->EFlags );
 
@@ -386,10 +386,10 @@ void WINAPI DECLSPEC_HIDDEN __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEn
         if (!is_valid_frame( frame )) raise_status( STATUS_BAD_STACK, pRecord );
 
         /* Call handler */
-        TRACE( "calling handler at %p code=%x flags=%x\n",
+        TRACE( "calling handler at %p code=%lx flags=%lx\n",
                frame->Handler, pRecord->ExceptionCode, pRecord->ExceptionFlags );
         res = EXC_CallHandler( pRecord, frame, context, &dispatch, frame->Handler, unwind_handler );
-        TRACE( "handler at %p returned %x\n", frame->Handler, res );
+        TRACE( "handler at %p returned %lx\n", frame->Handler, res );
 
         switch(res)
         {
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 7e77329363c..14e55942af3 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -129,7 +129,7 @@ static void dump_unwind_info( ULONG64 base, RUNTIME_FUNCTION *function )
     struct UNWIND_INFO *info;
     unsigned int i, count;
 
-    TRACE( "**** func %x-%x\n", function->BeginAddress, function->EndAddress );
+    TRACE( "**** func %lx-%lx\n", function->BeginAddress, function->EndAddress );
     for (;;)
     {
         if (function->UnwindData & 1)
@@ -372,7 +372,7 @@ static DWORD call_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCHER_C
     TRACE_(seh)( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
                  dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
     res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, context, dispatch );
-    TRACE_(seh)( "handler at %p returned %u\n", dispatch->LanguageHandler, res );
+    TRACE_(seh)( "handler at %p returned %lu\n", dispatch->LanguageHandler, res );
 
     rec->ExceptionFlags &= EH_NONCONTINUABLE;
     __wine_pop_frame( &frame );
@@ -394,7 +394,7 @@ static DWORD call_teb_handler( EXCEPTION_RECORD *rec, CONTEXT *context, DISPATCH
     TRACE_(seh)( "calling TEB handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
                  teb_frame->Handler, rec, teb_frame, dispatch->ContextRecord, dispatch );
     res = teb_frame->Handler( rec, teb_frame, context, (EXCEPTION_REGISTRATION_RECORD**)dispatch );
-    TRACE_(seh)( "handler at %p returned %u\n", teb_frame->Handler, res );
+    TRACE_(seh)( "handler at %p returned %lu\n", teb_frame->Handler, res );
     return res;
 }
 
@@ -506,11 +506,11 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     NTSTATUS status;
     DWORD c;
 
-    TRACE_(seh)( "code=%x flags=%x addr=%p ip=%p tid=%04x\n",
+    TRACE_(seh)( "code=%lx flags=%lx addr=%p ip=%p tid=%04lx\n",
                  rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
                  (void *)context->Rip, GetCurrentThreadId() );
     for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++)
-        TRACE( " info[%d]=%016I64x\n", c, rec->ExceptionInformation[c] );
+        TRACE( " info[%ld]=%016I64x\n", c, rec->ExceptionInformation[c] );
 
     if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
     {
@@ -525,7 +525,7 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     }
     else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
     {
-        WARN_(seh)( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2],
+        WARN_(seh)( "Thread %04lx renamed to %s\n", (DWORD)rec->ExceptionInformation[2],
                     debugstr_a((char *)rec->ExceptionInformation[1]) );
     }
     else if (rec->ExceptionCode == DBG_PRINTEXCEPTION_C)
@@ -539,9 +539,9 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
     else
     {
         if (rec->ExceptionCode == STATUS_ASSERTION_FAILURE)
-            ERR_(seh)( "%s exception (code=%x) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
+            ERR_(seh)( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
         else
-            WARN_(seh)( "%s exception (code=%x) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
+            WARN_(seh)( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
 
         TRACE_(seh)( " rax=%016I64x rbx=%016I64x rcx=%016I64x rdx=%016I64x\n",
                      context->Rax, context->Rbx, context->Rcx, context->Rdx );
@@ -853,7 +853,7 @@ PVOID WINAPI RtlVirtualUnwind( ULONG type, ULONG64 base, ULONG64 pc,
     unsigned int i, prolog_offset;
     BOOL mach_frame = FALSE;
 
-    TRACE( "type %x rip %p rsp %p\n", type, (void *)pc, (void *)context->Rsp );
+    TRACE( "type %lx rip %p rsp %p\n", type, (void *)pc, (void *)context->Rsp );
     if (TRACE_ON(seh)) dump_unwind_info( base, function );
 
     frame = *frame_ret = context->Rsp;
@@ -1020,7 +1020,7 @@ static DWORD call_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT *dis
     TRACE( "calling handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
            dispatch->LanguageHandler, rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
     res = dispatch->LanguageHandler( rec, (void *)dispatch->EstablisherFrame, dispatch->ContextRecord, dispatch );
-    TRACE( "handler %p returned %x\n", dispatch->LanguageHandler, res );
+    TRACE( "handler %p returned %lx\n", dispatch->LanguageHandler, res );
 
     __wine_pop_frame( &frame.frame );
 
@@ -1051,7 +1051,7 @@ static DWORD call_teb_unwind_handler( EXCEPTION_RECORD *rec, DISPATCHER_CONTEXT
     TRACE( "calling TEB handler %p (rec=%p, frame=%p context=%p, dispatch=%p)\n",
            teb_frame->Handler, rec, teb_frame, dispatch->ContextRecord, dispatch );
     res = teb_frame->Handler( rec, teb_frame, dispatch->ContextRecord, (EXCEPTION_REGISTRATION_RECORD**)dispatch );
-    TRACE( "handler at %p returned %u\n", teb_frame->Handler, res );
+    TRACE( "handler at %p returned %lu\n", teb_frame->Handler, res );
 
     switch (res)
     {
@@ -1272,10 +1272,10 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
 
     rec->ExceptionFlags |= EH_UNWINDING | (end_frame ? 0 : EH_EXIT_UNWIND);
 
-    TRACE( "code=%x flags=%x end_frame=%p target_ip=%p rip=%016I64x\n",
+    TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p rip=%016I64x\n",
            rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip, context->Rip );
     for (i = 0; i < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); i++)
-        TRACE( " info[%d]=%016I64x\n", i, rec->ExceptionInformation[i] );
+        TRACE( " info[%ld]=%016I64x\n", i, rec->ExceptionInformation[i] );
     TRACE(" rax=%016I64x rbx=%016I64x rcx=%016I64x rdx=%016I64x\n",
           context->Rax, context->Rbx, context->Rcx, context->Rdx );
     TRACE(" rsi=%016I64x rdi=%016I64x rbp=%016I64x rsp=%016I64x\n",
@@ -1529,7 +1529,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
     ULONG i;
     USHORT num_entries = 0;
 
-    TRACE( "(%u, %u, %p, %p)\n", skip, count, buffer, hash );
+    TRACE( "(%lu, %lu, %p, %p)\n", skip, count, buffer, hash );
 
     RtlCaptureContext( &context );
     dispatch.TargetIp      = 0;
diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c
index 43864325b35..f9f906df723 100644
--- a/dlls/ntdll/sync.c
+++ b/dlls/ntdll/sync.c
@@ -218,7 +218,7 @@ NTSTATUS WINAPI RtlInitializeCriticalSectionAndSpinCount( RTL_CRITICAL_SECTION *
 NTSTATUS WINAPI RtlInitializeCriticalSectionEx( RTL_CRITICAL_SECTION *crit, ULONG spincount, ULONG flags )
 {
     if (flags & (RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN|RTL_CRITICAL_SECTION_FLAG_STATIC_INIT))
-        FIXME("(%p,%u,0x%08x) semi-stub\n", crit, spincount, flags);
+        FIXME("(%p,%lu,0x%08lx) semi-stub\n", crit, spincount, flags);
 
     /* FIXME: if RTL_CRITICAL_SECTION_FLAG_STATIC_INIT is given, we should use
      * memory from a static pool to hold the debug info. Then heap.c could pass
@@ -314,14 +314,14 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
             const char *name = NULL;
             if (crit_section_has_debuginfo( crit )) name = (char *)crit->DebugInfo->Spare[0];
             if (!name) name = "?";
-            ERR( "section %p %s wait timed out in thread %04x, blocked by %04x, retrying (60 sec)\n",
+            ERR( "section %p %s wait timed out in thread %04lx, blocked by %04lx, retrying (60 sec)\n",
                  crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) );
             status = wait_semaphore( crit, 60 );
             timeout -= 60;
 
             if ( status == STATUS_TIMEOUT && TRACE_ON(relay) )
             {
-                ERR( "section %p %s wait timed out in thread %04x, blocked by %04x, retrying (5 min)\n",
+                ERR( "section %p %s wait timed out in thread %04lx, blocked by %04lx, retrying (5 min)\n",
                      crit, debugstr_a(name), GetCurrentThreadId(), HandleToULong(crit->OwningThread) );
                 status = wait_semaphore( crit, 300 );
                 timeout -= 300;
@@ -936,7 +936,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
         list_remove( &entry.entry );
     spin_unlock( &queue->lock );
 
-    TRACE("returning %#x\n", ret);
+    TRACE("returning %#lx\n", ret);
 
     if (ret == STATUS_ALERTED) ret = STATUS_SUCCESS;
     return ret;
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 37dc7c8ab37..7b838eba575 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -146,10 +146,10 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
     if (TRACE_ON(timestamp))
     {
         ULONG ticks = NtGetTickCount();
-        pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 );
+        pos += sprintf( pos, "%3lu.%03lu:", ticks / 1000, ticks % 1000 );
     }
-    if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", GetCurrentProcessId() );
-    pos += sprintf( pos, "%04x:", GetCurrentThreadId() );
+    if (TRACE_ON(pid)) pos += sprintf( pos, "%04lx:", GetCurrentProcessId() );
+    pos += sprintf( pos, "%04lx:", GetCurrentThreadId() );
     if (function && cls < ARRAY_SIZE( classes ))
         pos += snprintf( pos, sizeof(info->output) - (pos - info->output), "%s:%s:%s ",
                          classes[cls], channel->name, function );
@@ -312,7 +312,7 @@ NTSTATUS WINAPI RtlCreateUserStack( SIZE_T commit, SIZE_T reserve, ULONG zero_bi
     PROCESS_STACK_ALLOCATION_INFORMATION alloc;
     NTSTATUS status;
 
-    TRACE("commit %#lx, reserve %#lx, zero_bits %u, commit_align %#lx, reserve_align %#lx, stack %p\n",
+    TRACE("commit %#Ix, reserve %#Ix, zero_bits %lu, commit_align %#Ix, reserve_align %#Ix, stack %p\n",
             commit, reserve, zero_bits, commit_align, reserve_align, stack);
 
     if (!commit_align || !reserve_align)
@@ -645,10 +645,10 @@ void WINAPI DECLSPEC_HOTPATCH RtlProcessFlsData( void *teb_fls_data, ULONG flags
     TEB_FLS_DATA *fls = teb_fls_data;
     unsigned int i, index;
 
-    TRACE_(thread)( "teb_fls_data %p, flags %#x.\n", teb_fls_data, flags );
+    TRACE_(thread)( "teb_fls_data %p, flags %#lx.\n", teb_fls_data, flags );
 
     if (flags & ~3)
-        FIXME_(thread)( "Unknown flags %#x.\n", flags );
+        FIXME_(thread)( "Unknown flags %#lx.\n", flags );
 
     if (!fls)
         return;
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index 827232b2143..069b5a6d2c5 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -434,7 +434,7 @@ NTSTATUS WINAPI RtlQueueWorkItem( PRTL_WORK_ITEM_ROUTINE function, PVOID context
     struct rtl_work_item *item;
     NTSTATUS status;
 
-    TRACE( "%p %p %u\n", function, context, flags );
+    TRACE( "%p %p %lu\n", function, context, flags );
 
     item = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*item) );
     if (!item)
@@ -468,7 +468,7 @@ static DWORD CALLBACK iocp_poller(LPVOID Arg)
         NTSTATUS res = NtRemoveIoCompletion( cport, (PULONG_PTR)&callback, (PULONG_PTR)&overlapped, &iosb, NULL );
         if (res)
         {
-            ERR("NtRemoveIoCompletion failed: 0x%x\n", res);
+            ERR("NtRemoveIoCompletion failed: 0x%lx\n", res);
         }
         else
         {
@@ -507,7 +507,7 @@ NTSTATUS WINAPI RtlSetIoCompletionCallback(HANDLE FileHandle, PRTL_OVERLAPPED_CO
     IO_STATUS_BLOCK iosb;
     FILE_COMPLETION_INFORMATION info;
 
-    if (Flags) FIXME("Unknown value Flags=0x%x\n", Flags);
+    if (Flags) FIXME("Unknown value Flags=0x%lx\n", Flags);
 
     if (!old_threadpool.compl_port)
     {
@@ -1518,13 +1518,13 @@ static void CALLBACK ioqueue_thread_proc( void *param )
     {
         RtlLeaveCriticalSection( &ioqueue.cs );
         if ((status = NtRemoveIoCompletion( ioqueue.port, &key, &value, &iosb, NULL )))
-            ERR("NtRemoveIoCompletion failed, status %#x.\n", status);
+            ERR("NtRemoveIoCompletion failed, status %#lx.\n", status);
         RtlEnterCriticalSection( &ioqueue.cs );
 
         destroy = skip = FALSE;
         io = (struct threadpool_object *)key;
 
-        TRACE( "io %p, iosb.Status %#x.\n", io, iosb.u.Status );
+        TRACE( "io %p, iosb.Status %#lx.\n", io, iosb.u.Status );
 
         if (io && (io->shutdown || io->u.io.shutting_down))
         {
@@ -1906,7 +1906,7 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
     if (environment)
     {
         if (environment->Version != 1 && environment->Version != 3)
-            FIXME( "unsupported environment version %u\n", environment->Version );
+            FIXME( "unsupported environment version %lu\n", environment->Version );
 
         object->group = impl_from_TP_CLEANUP_GROUP( environment->CleanupGroup );
         object->group_cancel_callback   = environment->CleanupGroupCancelCallback;
@@ -2233,7 +2233,7 @@ static void tp_object_execute( struct threadpool_object *object, BOOL wait_threa
 
         case TP_OBJECT_TYPE_WAIT:
         {
-            TRACE( "executing wait callback %p(%p, %p, %p, %u)\n",
+            TRACE( "executing wait callback %p(%p, %p, %p, %lu)\n",
                    object->u.wait.callback, callback_instance, object->userdata, object, wait_result );
             object->u.wait.callback( callback_instance, object->userdata, (TP_WAIT *)object, wait_result );
             TRACE( "callback %p returned\n", object->u.wait.callback );
@@ -2242,7 +2242,7 @@ static void tp_object_execute( struct threadpool_object *object, BOOL wait_threa
 
         case TP_OBJECT_TYPE_IO:
         {
-            TRACE( "executing I/O callback %p(%p, %p, %#lx, %p, %p)\n",
+            TRACE( "executing I/O callback %p(%p, %p, %#Ix, %p, %p)\n",
                     object->u.io.callback, callback_instance, object->userdata,
                     completion.cvalue, &completion.iosb, (TP_IO *)object );
             object->u.io.callback( callback_instance, object->userdata,
@@ -2652,7 +2652,7 @@ VOID WINAPI TpCallbackReleaseSemaphoreOnCompletion( TP_CALLBACK_INSTANCE *instan
 {
     struct threadpool_instance *this = impl_from_TP_CALLBACK_INSTANCE( instance );
 
-    TRACE( "%p %p %u\n", instance, semaphore, count );
+    TRACE( "%p %p %lu\n", instance, semaphore, count );
 
     if (!this->cleanup.semaphore)
     {
@@ -2913,7 +2913,7 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
 {
     struct threadpool *this = impl_from_TP_POOL( pool );
 
-    TRACE( "%p %u\n", pool, maximum );
+    TRACE( "%p %lu\n", pool, maximum );
 
     RtlEnterCriticalSection( &this->cs );
     this->max_workers = max( maximum, 1 );
@@ -2929,7 +2929,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
     struct threadpool *this = impl_from_TP_POOL( pool );
     NTSTATUS status = STATUS_SUCCESS;
 
-    TRACE( "%p %u\n", pool, minimum );
+    TRACE( "%p %lu\n", pool, minimum );
 
     RtlEnterCriticalSection( &this->cs );
 
@@ -2960,7 +2960,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
     BOOL submit_timer = FALSE;
     ULONGLONG timestamp;
 
-    TRACE( "%p %p %u %u\n", timer, timeout, period, window_length );
+    TRACE( "%p %p %lu %lu\n", timer, timeout, period, window_length );
 
     RtlEnterCriticalSection( &timerqueue.cs );
 
@@ -3260,7 +3260,7 @@ NTSTATUS WINAPI RtlRegisterWait( HANDLE *out, HANDLE handle, RTL_WAITORTIMERCALL
     NTSTATUS status;
     TP_WAIT *wait;
 
-    TRACE( "out %p, handle %p, callback %p, context %p, milliseconds %u, flags %x\n",
+    TRACE( "out %p, handle %p, callback %p, context %p, milliseconds %lu, flags %lx\n",
             out, handle, callback, context, milliseconds, flags );
 
     memset( &environment, 0, sizeof(environment) );
diff --git a/dlls/ntdll/unix/cdrom.c b/dlls/ntdll/unix/cdrom.c
index c6b0e56476b..3eac0b990ea 100644
--- a/dlls/ntdll/unix/cdrom.c
+++ b/dlls/ntdll/unix/cdrom.c
@@ -1448,7 +1448,7 @@ static NTSTATUS CDROM_SetVolume(int fd, const VOLUME_CONTROL* vc)
  *      to check the correct sector type.
  *
  */
-static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, DWORD len, DWORD* sz)
+static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, unsigned int len, DWORD* sz)
 {
     int         ret = STATUS_NOT_SUPPORTED;
     int         io = -1;
@@ -1456,8 +1456,8 @@ static NTSTATUS CDROM_RawRead(int fd, const RAW_READ_INFO* raw, void* buffer, DW
     dk_cd_read_t cdrd;
 #endif
 
-    TRACE("RAW_READ_INFO: DiskOffset=%i,%i SectorCount=%i TrackMode=%i\n buffer=%p len=%i sz=%p\n",
-          raw->DiskOffset.u.HighPart, raw->DiskOffset.u.LowPart, raw->SectorCount, raw->TrackMode, buffer, len, sz);
+    TRACE("RAW_READ_INFO: DiskOffset=%s SectorCount=%i TrackMode=%i\n buffer=%p len=%i sz=%p\n",
+          wine_dbgstr_longlong(raw->DiskOffset.QuadPart), (unsigned int)raw->SectorCount, raw->TrackMode, buffer, len, sz);
 
     if (len < raw->SectorCount * 2352) return STATUS_BUFFER_TOO_SMALL;
 
@@ -2034,7 +2034,6 @@ static NTSTATUS DVD_StartSession(int fd, const DVD_SESSION_ID *sid_in, PDVD_SESS
     memset( &auth_info, 0, sizeof( auth_info ) );
     auth_info.type = DVD_LU_SEND_AGID;
     if (sid_in) auth_info.lsa.agid = *(const int*)sid_in; /* ?*/
-
     TRACE("fd 0x%08x\n",fd);
     ret =CDROM_GetStatusCode(ioctl(fd, DVD_AUTH, &auth_info));
     *sid_out = auth_info.lsa.agid;
@@ -3056,11 +3055,13 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc
         else if (out_size < sz) status = STATUS_BUFFER_TOO_SMALL;
         else
         {
-            TRACE("before in 0x%08x out 0x%08x\n",(in_buffer)?*(PDVD_SESSION_ID)in_buffer:0,
-                  *(PDVD_SESSION_ID)out_buffer);
+            TRACE("before in 0x%08x out 0x%08x\n",
+                  (in_buffer) ? (unsigned int)*(PDVD_SESSION_ID)in_buffer : 0,
+                  (unsigned int)*(PDVD_SESSION_ID)out_buffer);
             status = DVD_StartSession(fd, in_buffer, out_buffer);
-            TRACE("before in 0x%08x out 0x%08x\n",(in_buffer)?*(PDVD_SESSION_ID)in_buffer:0,
-                  *(PDVD_SESSION_ID)out_buffer);
+            TRACE("before in 0x%08x out 0x%08x\n",
+                  (in_buffer) ? (unsigned int)*(PDVD_SESSION_ID)in_buffer : 0,
+                  (unsigned int)*(PDVD_SESSION_ID)out_buffer);
         }
         break;
     case IOCTL_DVD_END_SESSION:
diff --git a/dlls/ntdll/unix/debug.c b/dlls/ntdll/unix/debug.c
index e91cf95ada4..a8ac7b4666f 100644
--- a/dlls/ntdll/unix/debug.c
+++ b/dlls/ntdll/unix/debug.c
@@ -302,8 +302,8 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
             unsigned int ticks = NtGetTickCount();
             pos += sprintf( pos, "%3u.%03u:", ticks / 1000, ticks % 1000 );
         }
-        if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", GetCurrentProcessId() );
-        pos += sprintf( pos, "%04x:", GetCurrentThreadId() );
+        if (TRACE_ON(pid)) pos += sprintf( pos, "%04x:", (unsigned int)GetCurrentProcessId() );
+        pos += sprintf( pos, "%04x:", (unsigned int)GetCurrentThreadId() );
     }
     if (function && cls < ARRAY_SIZE( classes ))
         pos += snprintf( pos, sizeof(info->output) - (pos - info->output), "%s:%s:%s ",
@@ -339,8 +339,8 @@ void dbg_init(void)
 NTSTATUS WINAPI NtTraceControl( ULONG code, void *inbuf, ULONG inbuf_len,
                                 void *outbuf, ULONG outbuf_len, ULONG *size )
 {
-    FIXME( "code %u, inbuf %p, inbuf_len %u, outbuf %p, outbuf_len %u, size %p\n", code, inbuf, inbuf_len,
-           outbuf, outbuf_len, size );
+    FIXME( "code %u, inbuf %p, inbuf_len %u, outbuf %p, outbuf_len %u, size %p\n",
+           (unsigned int)code, inbuf, (unsigned int)inbuf_len, outbuf, (unsigned int)outbuf_len, size );
     return STATUS_SUCCESS;
 }
 
@@ -350,7 +350,7 @@ NTSTATUS WINAPI NtTraceControl( ULONG code, void *inbuf, ULONG inbuf_len,
  */
 NTSTATUS WINAPI NtSetDebugFilterState( ULONG component_id, ULONG level, BOOLEAN state )
 {
-    FIXME( "component_id %#x, level %u, state %#x stub.\n", component_id, level, state );
+    FIXME( "component_id %#x, level %u, state %#x stub.\n", (unsigned int)component_id, (unsigned int)level, state );
 
     return STATUS_SUCCESS;
 }
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index ffa6fcd3657..5b57d5daedd 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1906,7 +1906,7 @@ static void run_wineboot( WCHAR *env, SIZE_T size )
 
     if (status)
     {
-        ERR( "failed to start wineboot %x\n", status );
+        ERR( "failed to start wineboot %x\n", (unsigned int)status );
         NtClose( handles[0] );
         return;
     }
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a29b5cbb980..cd0df7c8c32 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -26,6 +26,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <assert.h>
 #include <sys/types.h>
 #include <dirent.h>
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index 96301b1654e..46d6d74c891 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -761,7 +761,7 @@ NTSTATUS exec_wineloader( char **argv, int socketfd, const pe_image_info_t *pe_i
 
     sprintf( socket_env, "WINESERVERSOCKET=%u", socketfd );
     sprintf( preloader_reserve, "WINEPRELOADRESERVE=%x%08x-%x%08x",
-             (ULONG)(res_start >> 32), (ULONG)res_start, (ULONG)(res_end >> 32), (ULONG)res_end );
+             (unsigned int)(res_start >> 32), (unsigned int)res_start, (unsigned int)(res_end >> 32), (unsigned int)res_end );
 
     putenv( preloader_reserve );
     putenv( socket_env );
@@ -1843,7 +1843,7 @@ NTSTATUS load_main_exe( const WCHAR *dos_name, const char *unix_name, const WCHA
 
 failed:
     MESSAGE( "wine: failed to open %s: %x\n",
-             unix_name ? debugstr_a(unix_name) : debugstr_w(dos_name), status );
+             unix_name ? debugstr_a(unix_name) : debugstr_w(dos_name), (unsigned int)status );
     NtTerminateProcess( GetCurrentProcess(), status );
     return status;  /* unreached */
 }
@@ -1868,7 +1868,7 @@ NTSTATUS load_start_exe( WCHAR **image, void **module )
     status = find_builtin_dll( &nt_name, module, &size, &main_image_info, current_machine, FALSE );
     if (status)
     {
-        MESSAGE( "wine: failed to load start.exe: %x\n", status );
+        MESSAGE( "wine: failed to load start.exe: %x\n", (unsigned int)status );
         NtTerminateProcess( GetCurrentProcess(), status );
     }
     return status;
@@ -1985,7 +1985,7 @@ static void load_ntdll(void)
         status = open_builtin_so_file( name, &attr, &module, &info, current_machine, FALSE );
     }
     if (status == STATUS_IMAGE_NOT_AT_BASE) relocate_ntdll( module );
-    else if (status) fatal_error( "failed to load %s error %x\n", name, status );
+    else if (status) fatal_error( "failed to load %s error %x\n", name, (unsigned int)status );
     free( name );
     load_ntdll_functions( module );
     ntdll_module = module;
@@ -2019,7 +2019,7 @@ static void load_wow64_ntdll( USHORT machine )
         TRACE("loaded %s at %p\n", debugstr_w(path), module );
         break;
     default:
-        ERR( "failed to load %s error %x\n", debugstr_w(path), status );
+        ERR( "failed to load %s error %x\n", debugstr_w(path), (unsigned int)status );
         break;
     }
     free( path );
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c
index 99c8e37053c..a310f0cdf1c 100644
--- a/dlls/ntdll/unix/process.c
+++ b/dlls/ntdll/unix/process.c
@@ -701,13 +701,13 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
 
     if (thread_flags & THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER)
     {
-        WARN( "Invalid thread flags %#x.\n", thread_flags );
+        WARN( "Invalid thread flags %#x.\n", (unsigned int)thread_flags );
 
         return STATUS_INVALID_PARAMETER;
     }
 
     if (thread_flags & ~THREAD_CREATE_FLAGS_CREATE_SUSPENDED)
-        FIXME( "Unsupported thread flags %#x.\n", thread_flags );
+        FIXME( "Unsupported thread flags %#x.\n", (unsigned int)thread_flags );
 
     for (i = 0; i < attr_count; i++)
     {
@@ -888,7 +888,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
     }
 
     TRACE( "%s pid %04x tid %04x handles %p/%p\n", debugstr_us(&path),
-           HandleToULong(id.UniqueProcess), HandleToULong(id.UniqueThread),
+           (unsigned int)HandleToULong(id.UniqueProcess), (unsigned int)HandleToULong(id.UniqueThread),
            process_handle, thread_handle );
 
     /* update output attributes */
@@ -1069,7 +1069,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
     NTSTATUS ret = STATUS_SUCCESS;
     ULONG len = 0;
 
-    TRACE( "(%p,0x%08x,%p,0x%08x,%p)\n", handle, class, info, size, ret_len );
+    TRACE( "(%p,0x%08x,%p,0x%08x,%p)\n", handle, class, info, (unsigned int)size, ret_len );
 
     switch (class)
     {
@@ -1462,7 +1462,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
         break;
 
     case ProcessCookie:
-        FIXME( "ProcessCookie (%p,%p,0x%08x,%p) stub\n", handle, info, size, ret_len );
+        FIXME( "ProcessCookie (%p,%p,0x%08x,%p) stub\n", handle, info, (unsigned int)size, ret_len );
         if (handle == NtCurrentProcess())
         {
             len = sizeof(ULONG);
@@ -1496,7 +1496,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
 
     default:
         FIXME("(%p,info_class=%d,%p,0x%08x,%p) Unknown information class\n",
-              handle, class, info, size, ret_len );
+              handle, class, info, (unsigned int)size, ret_len );
         ret = STATUS_INVALID_INFO_CLASS;
         break;
     }
@@ -1624,7 +1624,7 @@ NTSTATUS WINAPI NtSetInformationProcess( HANDLE handle, PROCESSINFOCLASS class,
         return ret;
 
     default:
-        FIXME( "(%p,0x%08x,%p,0x%08x) stub\n", handle, class, info, size );
+        FIXME( "(%p,0x%08x,%p,0x%08x) stub\n", handle, class, info, (unsigned int)size );
         ret = STATUS_NOT_IMPLEMENTED;
         break;
     }
diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c
index 6628454440a..2ac1e24b275 100644
--- a/dlls/ntdll/unix/registry.c
+++ b/dlls/ntdll/unix/registry.c
@@ -25,6 +25,8 @@
 #pragma makedep unix
 #endif
 
+#define WINE_NO_LONG_TYPES
+
 #include <stdarg.h>
 #include <string.h>
 
diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
index 2955355353e..8dceab00f55 100644
--- a/dlls/ntdll/unix/security.c
+++ b/dlls/ntdll/unix/security.c
@@ -23,6 +23,8 @@
 #pragma makedep unix
 #endif
 
+#define WINE_NO_LONG_TYPES
+
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/dlls/ntdll/unix/serial.c b/dlls/ntdll/unix/serial.c
index 664d3a92aa3..afa05a8dbb6 100644
--- a/dlls/ntdll/unix/serial.c
+++ b/dlls/ntdll/unix/serial.c
@@ -549,7 +549,7 @@ static NTSTATUS set_baud_rate(int fd, const SERIAL_BAUD_RATE* sbr)
                  "hardware. I hope you know what you are doing.  Any disruption Wine\n"
                  "has caused to your linux system can be undone with setserial\n"
                  "(see man setserial). If you have incapacitated a Hayes type modem,\n"
-                 "reset it and it will probably recover.\n", sbr->BaudRate, arby);
+                 "reset it and it will probably recover.\n", (unsigned int)sbr->BaudRate, arby);
             ioctl(fd, TIOCSSERIAL, &nuts);
             cfsetospeed( &port, B38400 );
         }
@@ -756,7 +756,7 @@ static NTSTATUS set_line_control(int fd, const SERIAL_LINE_CONTROL* slc)
 
 static NTSTATUS set_queue_size(int fd, const SERIAL_QUEUE_SIZE* sqs)
 {
-    FIXME("insize %d outsize %d unimplemented stub\n", sqs->InSize, sqs->OutSize);
+    FIXME("insize %d outsize %d unimplemented stub\n", (unsigned int)sqs->InSize, (unsigned int)sqs->OutSize);
     return STATUS_SUCCESS;
 }
 
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 3c3bd0af5a5..c81591f85a5 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -159,7 +159,7 @@ static DECLSPEC_NORETURN void server_protocol_error( const char *err, ... )
     va_list args;
 
     va_start( args, err );
-    fprintf( stderr, "wine client error:%x: ", GetCurrentThreadId() );
+    fprintf( stderr, "wine client error:%x: ", (unsigned int)GetCurrentThreadId() );
     vfprintf( stderr, err, args );
     va_end( args );
     abort_thread(1);
@@ -171,7 +171,7 @@ static DECLSPEC_NORETURN void server_protocol_error( const char *err, ... )
  */
 static DECLSPEC_NORETURN void server_protocol_perror( const char *err )
 {
-    fprintf( stderr, "wine client error:%x: ", GetCurrentThreadId() );
+    fprintf( stderr, "wine client error:%x: ", (unsigned int)GetCurrentThreadId() );
     perror( err );
     abort_thread(1);
 }
diff --git a/dlls/ntdll/unix/signal_arm.c b/dlls/ntdll/unix/signal_arm.c
index a1bcb0ddd32..bba57ae818a 100644
--- a/dlls/ntdll/unix/signal_arm.c
+++ b/dlls/ntdll/unix/signal_arm.c
@@ -27,6 +27,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <assert.h>
 #include <pthread.h>
 #include <signal.h>
diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c
index 94f280e218a..36dc6717f64 100644
--- a/dlls/ntdll/unix/signal_arm64.c
+++ b/dlls/ntdll/unix/signal_arm64.c
@@ -26,6 +26,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <assert.h>
 #include <pthread.h>
 #include <signal.h>
diff --git a/dlls/ntdll/unix/signal_i386.c b/dlls/ntdll/unix/signal_i386.c
index 6bb5649e2b5..c5429cbabdc 100644
--- a/dlls/ntdll/unix/signal_i386.c
+++ b/dlls/ntdll/unix/signal_i386.c
@@ -1114,16 +1114,16 @@ NTSTATUS WINAPI NtGetContextThread( HANDLE handle, CONTEXT *context )
     }
 
     if (context->ContextFlags & (CONTEXT_INTEGER & ~CONTEXT_i386))
-        TRACE( "%p: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n", handle,
+        TRACE( "%p: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n", handle,
                context->Eax, context->Ebx, context->Ecx, context->Edx, context->Esi, context->Edi );
     if (context->ContextFlags & (CONTEXT_CONTROL & ~CONTEXT_i386))
-        TRACE( "%p: ebp=%08x esp=%08x eip=%08x cs=%04x ss=%04x flags=%08x\n", handle,
+        TRACE( "%p: ebp=%08lx esp=%08lx eip=%08lx cs=%04lx ss=%04lx flags=%08lx\n", handle,
                context->Ebp, context->Esp, context->Eip, context->SegCs, context->SegSs, context->EFlags );
     if (context->ContextFlags & (CONTEXT_SEGMENTS & ~CONTEXT_i386))
-        TRACE( "%p: ds=%04x es=%04x fs=%04x gs=%04x\n", handle,
+        TRACE( "%p: ds=%04lx es=%04lx fs=%04lx gs=%04lx\n", handle,
                context->SegDs, context->SegEs, context->SegFs, context->SegGs );
     if (context->ContextFlags & (CONTEXT_DEBUG_REGISTERS & ~CONTEXT_i386))
-        TRACE( "%p: dr0=%08x dr1=%08x dr2=%08x dr3=%08x dr6=%08x dr7=%08x\n", handle,
+        TRACE( "%p: dr0=%08lx dr1=%08lx dr2=%08lx dr3=%08lx dr6=%08lx dr7=%08lx\n", handle,
                context->Dr0, context->Dr1, context->Dr2, context->Dr3, context->Dr6, context->Dr7 );
 
     return STATUS_SUCCESS;
@@ -1247,7 +1247,7 @@ static inline BOOL check_invalid_gs( ucontext_t *sigcontext, CONTEXT *context )
         instr++;
         continue;
     case 0x65:  /* %gs: */
-        TRACE( "%04x/%04x at %p, fixing up\n", context->SegGs, system_gs, instr );
+        TRACE( "%04lx/%04x at %p, fixing up\n", context->SegGs, system_gs, instr );
         GS_sig(sigcontext) = system_gs;
         return TRUE;
     default:
@@ -1321,7 +1321,7 @@ static BOOL check_atl_thunk( ucontext_t *sigcontext, EXCEPTION_RECORD *rec, CONT
                                                  &thunk_copy.t1.this, sizeof(DWORD) ))
         {
             EIP_sig(sigcontext) = (DWORD_PTR)(&thunk->t1.func + 1) + thunk_copy.t1.func;
-            TRACE( "emulating ATL thunk type 1 at %p, func=%08x arg=%08x\n",
+            TRACE( "emulating ATL thunk type 1 at %p, func=%08x arg=%08lx\n",
                    thunk, EIP_sig(sigcontext), thunk_copy.t1.this );
             return TRUE;
         }
@@ -1704,15 +1704,15 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr,
 
     if (!is_inside_syscall( sigcontext ) && !ntdll_get_thread_data()->jmp_buf) return FALSE;
 
-    TRACE( "code=%x flags=%x addr=%p ip=%08x tid=%04x\n",
+    TRACE( "code=%lx flags=%lx addr=%p ip=%08lx tid=%04lx\n",
            rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress,
            context->Eip, GetCurrentThreadId() );
     for (i = 0; i < rec->NumberParameters; i++)
-        TRACE( " info[%d]=%08lx\n", i, rec->ExceptionInformation[i] );
-    TRACE(" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",
+        TRACE( " info[%ld]=%08lx\n", i, rec->ExceptionInformation[i] );
+    TRACE(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
           context->Eax, context->Ebx, context->Ecx,
           context->Edx, context->Esi, context->Edi );
-    TRACE(" ebp=%08x esp=%08x cs=%04x ds=%04x es=%04x fs=%04x gs=%04x flags=%08x\n",
+    TRACE(" ebp=%08lx esp=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx flags=%08lx\n",
           context->Ebp, context->Esp, context->SegCs, context->SegDs,
           context->SegEs, context->SegFs, context->SegGs, context->EFlags );
 
@@ -1730,7 +1730,7 @@ static BOOL handle_syscall_fault( ucontext_t *sigcontext, void *stack_ptr,
     }
     else
     {
-        TRACE( "returning to user mode ip=%08x ret=%08x\n", frame->eip, rec->ExceptionCode );
+        TRACE( "returning to user mode ip=%08lx ret=%08lx\n", frame->eip, rec->ExceptionCode );
         stack = (DWORD *)frame;
         *(--stack) = rec->ExceptionCode;
         *(--stack) = (DWORD)frame;
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 5f814e8a2dc..dfc5505f686 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -562,7 +562,7 @@ static int wow64_translate_control( const WSABUF *control64, struct afd_wsabuf_3
     }
 
     control32->len = ptr32 - buf32;
-    FIXME("-> %d\n", control32->len);
+    FIXME("-> %d\n", (unsigned int)control32->len);
     return 1;
 }
 
@@ -657,7 +657,7 @@ static BOOL async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
     struct async_recv_ioctl *async = user;
     int fd, needs_close;
 
-    TRACE( "%#x\n", *status );
+    TRACE( "%#x\n", (unsigned int)*status );
 
     if (*status == STATUS_ALERTED)
     {
@@ -665,7 +665,7 @@ static BOOL async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
             return TRUE;
 
         *status = try_recv( fd, async, info );
-        TRACE( "got status %#x, %#lx bytes read\n", *status, *info );
+        TRACE( "got status %#x, %#lx bytes read\n", (unsigned int)*status, *info );
         if (needs_close) close( fd );
 
         if (*status == STATUS_DEVICE_NOT_READY)
@@ -843,7 +843,7 @@ static BOOL async_send_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
     struct async_send_ioctl *async = user;
     int fd, needs_close;
 
-    TRACE( "%#x\n", *status );
+    TRACE( "%#x\n", (unsigned int)*status );
 
     if (*status == STATUS_ALERTED)
     {
@@ -851,7 +851,7 @@ static BOOL async_send_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
             return TRUE;
 
         *status = try_send( fd, async );
-        TRACE( "got status %#x\n", *status );
+        TRACE( "got status %#x\n", (unsigned int)*status );
 
         if (needs_close) close( fd );
 
@@ -1018,7 +1018,7 @@ static BOOL async_transmit_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
     int sock_fd, file_fd = -1, sock_needs_close = FALSE, file_needs_close = FALSE;
     struct async_transmit_ioctl *async = user;
 
-    TRACE( "%#x\n", *status );
+    TRACE( "%#x\n", (unsigned int)*status );
 
     if (*status == STATUS_ALERTED)
     {
@@ -1032,7 +1032,7 @@ static BOOL async_transmit_proc( void *user, ULONG_PTR *info, NTSTATUS *status )
         }
 
         *status = try_transmit( sock_fd, file_fd, async );
-        TRACE( "got status %#x\n", *status );
+        TRACE( "got status %#x\n", (unsigned int)*status );
 
         if (sock_needs_close) close( sock_fd );
         if (file_needs_close) close( file_fd );
diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c
index ee25dfd0099..196b4e25cb1 100644
--- a/dlls/ntdll/unix/sync.c
+++ b/dlls/ntdll/unix/sync.c
@@ -27,6 +27,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 4052d28f644..f7fd85bc171 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -24,6 +24,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <fcntl.h>
 #include <string.h>
 #include <stdarg.h>
diff --git a/dlls/ntdll/unix/tape.c b/dlls/ntdll/unix/tape.c
index 73ff6f936b8..b25cbbec768 100644
--- a/dlls/ntdll/unix/tape.c
+++ b/dlls/ntdll/unix/tape.c
@@ -66,7 +66,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(tape);
 
-static const char *io2str( DWORD io )
+static const char *io2str( unsigned int io )
 {
     switch (io)
     {
@@ -109,7 +109,7 @@ static NTSTATUS TAPE_CreatePartition( int fd, const TAPE_CREATE_PARTITION *data
     struct mtop cmd;
 
     TRACE( "fd: %d method: 0x%08x count: 0x%08x size: 0x%08x\n",
-           fd, data->Method, data->Count, data->Size );
+           fd, (unsigned int)data->Method, (unsigned int)data->Count, (unsigned int)data->Size );
 
     if (data->Count > 1)
     {
@@ -131,7 +131,7 @@ static NTSTATUS TAPE_CreatePartition( int fd, const TAPE_CREATE_PARTITION *data
         break;
 #endif
     default:
-        ERR( "Unhandled method: 0x%08x\n", data->Method );
+        ERR( "Unhandled method: 0x%08x\n", (unsigned int)data->Method );
         return STATUS_INVALID_PARAMETER;
     }
 
@@ -151,7 +151,7 @@ static NTSTATUS TAPE_Erase( int fd, const TAPE_ERASE *data )
     struct mtop cmd;
 
     TRACE( "fd: %d type: 0x%08x immediate: 0x%02x\n",
-           fd, data->Type, data->Immediate );
+           fd, (unsigned int)data->Type, data->Immediate );
 
     switch (data->Type)
     {
@@ -164,7 +164,7 @@ static NTSTATUS TAPE_Erase( int fd, const TAPE_ERASE *data )
         cmd.mt_count = 0;
         break;
     default:
-        ERR( "Unhandled type: 0x%08x\n", data->Type );
+        ERR( "Unhandled type: 0x%08x\n", (unsigned int)data->Type );
         return STATUS_INVALID_PARAMETER;
     }
 
@@ -253,7 +253,7 @@ static NTSTATUS TAPE_GetMediaParams( int fd, TAPE_GET_MEDIA_PARAMETERS *data )
 /******************************************************************
  *      TAPE_GetPosition
  */
-static NTSTATUS TAPE_GetPosition( int fd, ULONG type, TAPE_GET_POSITION *data )
+static NTSTATUS TAPE_GetPosition( int fd, unsigned int type, TAPE_GET_POSITION *data )
 {
 #ifdef HAVE_SYS_MTIO_H
     struct mtget get;
@@ -312,7 +312,7 @@ static NTSTATUS TAPE_Prepare( int fd, const TAPE_PREPARE *data )
     struct mtop cmd;
 
     TRACE( "fd: %d type: 0x%08x immediate: 0x%02x\n",
-           fd, data->Operation, data->Immediate );
+           fd, (unsigned int)data->Operation, data->Immediate );
 
     switch (data->Operation)
     {
@@ -345,7 +345,7 @@ static NTSTATUS TAPE_Prepare( int fd, const TAPE_PREPARE *data )
         /* Native ignores this if the drive doesn't support it */
         return STATUS_SUCCESS;
     default:
-        ERR( "Unhandled operation: 0x%08x\n", data->Operation );
+        ERR( "Unhandled operation: 0x%08x\n", (unsigned int)data->Operation );
         return STATUS_INVALID_PARAMETER;
     }
 
@@ -367,7 +367,7 @@ static NTSTATUS TAPE_SetDriveParams( int fd, const TAPE_SET_DRIVE_PARAMETERS *da
     TRACE( "fd: %d ECC: 0x%02x, compression: 0x%02x padding: 0x%02x\n",
             fd, data->ECC, data->Compression, data->DataPadding );
     TRACE( "setmarks: 0x%02x zonesize: 0x%08x\n",
-           data->ReportSetmarks, data->EOTWarningZoneSize );
+           data->ReportSetmarks, (unsigned int)data->EOTWarningZoneSize );
 
     if (data->ECC || data->DataPadding || data->ReportSetmarks ||
         data->EOTWarningZoneSize ) WARN( "Setting not supported\n" );
@@ -390,7 +390,7 @@ static NTSTATUS TAPE_SetMediaParams( int fd, const TAPE_SET_MEDIA_PARAMETERS *da
 #ifdef HAVE_SYS_MTIO_H
     struct mtop cmd;
 
-    TRACE( "fd: %d blocksize: 0x%08x\n", fd, data->BlockSize );
+    TRACE( "fd: %d blocksize: 0x%08x\n", fd, (unsigned int)data->BlockSize );
 
     cmd.mt_op = MTSETBLK;
     cmd.mt_count = data->BlockSize;
@@ -411,8 +411,8 @@ static NTSTATUS TAPE_SetPosition( int fd, const TAPE_SET_POSITION *data )
     struct mtop cmd;
 
     TRACE( "fd: %d method: 0x%08x partition: 0x%08x offset: 0x%s immediate: 0x%02x\n",
-           fd, data->Method, data->Partition, wine_dbgstr_longlong(data->Offset.QuadPart),
-           data->Immediate );
+           fd, (unsigned int)data->Method, (unsigned int)data->Partition,
+           wine_dbgstr_longlong(data->Offset.QuadPart), data->Immediate );
 
     if (sizeof(cmd.mt_count) < sizeof(data->Offset.QuadPart) &&
         (int)data->Offset.QuadPart != data->Offset.QuadPart)
@@ -467,7 +467,7 @@ static NTSTATUS TAPE_SetPosition( int fd, const TAPE_SET_POSITION *data )
         WARN( "Positioning method not supported\n" );
         return STATUS_INVALID_PARAMETER;
     default:
-        ERR( "Unhandled method: 0x%08x\n", data->Method );
+        ERR( "Unhandled method: 0x%08x\n", (unsigned int)data->Method );
         return STATUS_INVALID_PARAMETER;
     }
 
@@ -487,7 +487,7 @@ static NTSTATUS TAPE_WriteMarks( int fd, const TAPE_WRITE_MARKS *data )
     struct mtop cmd;
 
     TRACE( "fd: %d type: 0x%08x count: 0x%08x immediate: 0x%02x\n",
-           fd, data->Type, data->Count, data->Immediate );
+           fd, (unsigned int)data->Type, (unsigned int)data->Count, data->Immediate );
 
     switch (data->Type)
     {
@@ -504,7 +504,7 @@ static NTSTATUS TAPE_WriteMarks( int fd, const TAPE_WRITE_MARKS *data )
         cmd.mt_count = data->Count;
         break;
     default:
-        ERR( "Unhandled type: 0x%08x\n", data->Type );
+        ERR( "Unhandled type: 0x%08x\n", (unsigned int)data->Type );
         return STATUS_INVALID_PARAMETER;
     }
 
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 6f5f3995c2e..9040d59d36d 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -1229,7 +1229,7 @@ NTSTATUS WINAPI NtCreateThread( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRI
                                 HANDLE process, CLIENT_ID *id, CONTEXT *ctx, INITIAL_TEB *teb,
                                 BOOLEAN suspended )
 {
-    FIXME( "%p %d %p %p %p %p %p %d, stub!\n", handle, access, attr, process, id, ctx, teb, suspended );
+    FIXME( "%p %d %p %p %p %p %p %d, stub!\n", handle, (unsigned int)access, attr, process, id, ctx, teb, suspended );
     return STATUS_NOT_IMPLEMENTED;
 }
 
@@ -1254,7 +1254,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
     NTSTATUS status;
 
     if (flags & ~supported_flags)
-        FIXME( "Unsupported flags %#x.\n", flags );
+        FIXME( "Unsupported flags %#x.\n", (unsigned int)flags );
 
     if (zero_bits > 21 && zero_bits < 32) return STATUS_INVALID_PARAMETER_3;
 #ifndef _WIN64
@@ -1517,7 +1517,8 @@ NTSTATUS WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context, BOOL
         ERR_(seh)("Process attempted to continue execution after noncontinuable exception.\n");
     else
         ERR_(seh)("Unhandled exception code %x flags %x addr %p\n",
-                  rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
+                  (unsigned int)rec->ExceptionCode, (unsigned int)rec->ExceptionFlags,
+                  rec->ExceptionAddress );
 
     NtTerminateProcess( NtCurrentProcess(), rec->ExceptionCode );
     return STATUS_SUCCESS;
@@ -1854,7 +1855,7 @@ NTSTATUS WINAPI NtQueryInformationThread( HANDLE handle, THREADINFOCLASS class,
 {
     NTSTATUS status;
 
-    TRACE("(%p,%d,%p,%x,%p)\n", handle, class, data, length, ret_len);
+    TRACE("(%p,%d,%p,%x,%p)\n", handle, class, data, (unsigned int)length, ret_len);
 
     switch (class)
     {
@@ -2111,7 +2112,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
 {
     NTSTATUS status;
 
-    TRACE("(%p,%d,%p,%x)\n", handle, class, data, length);
+    TRACE("(%p,%d,%p,%x)\n", handle, class, data, (unsigned int)length);
 
     switch (class)
     {
@@ -2303,7 +2304,7 @@ ULONG WINAPI NtGetCurrentProcessorNumber(void)
                 {
                     if (thread_mask != processor_mask)
                         FIXME( "need multicore support (%d processors)\n",
-                               peb->NumberOfProcessors );
+                               (unsigned int)peb->NumberOfProcessors );
                     return processor;
                 }
             }
@@ -2324,7 +2325,7 @@ NTSTATUS WINAPI NtGetNextThread( HANDLE process, HANDLE thread, ACCESS_MASK acce
     NTSTATUS ret;
 
     TRACE( "process %p, thread %p, access %#x, attributes %#x, flags %#x, handle %p.\n",
-            process, thread, access, attributes, flags, handle );
+           process, thread, (unsigned int)access, (unsigned int)attributes, (unsigned int)flags, handle );
 
     SERVER_START_REQ( get_next_thread )
     {
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 94b300c5057..d20b9871283 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -24,6 +24,8 @@
 
 #include "config.h"
 
+#define WINE_NO_LONG_TYPES
+
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c
index 492c24cc636..eb81ec6f73d 100644
--- a/dlls/ntdll/version.c
+++ b/dlls/ntdll/version.c
@@ -525,7 +525,7 @@ done:
     NtCurrentTeb()->Peb->OSBuildNumber  = current_version->dwBuildNumber;
     NtCurrentTeb()->Peb->OSPlatformId   = current_version->dwPlatformId;
 
-    TRACE( "got %d.%d platform %d build %x name %s service pack %d.%d product %d\n",
+    TRACE( "got %ld.%ld platform %ld build %lx name %s service pack %d.%d product %d\n",
            current_version->dwMajorVersion, current_version->dwMinorVersion,
            current_version->dwPlatformId, current_version->dwBuildNumber,
            debugstr_w(current_version->szCSDVersion),
@@ -544,7 +544,7 @@ done:
 BOOLEAN WINAPI RtlGetProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion,
                                  DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType)
 {
-    TRACE("(%d, %d, %d, %d, %p)\n", dwOSMajorVersion, dwOSMinorVersion,
+    TRACE("(%ld, %ld, %ld, %ld, %p)\n", dwOSMajorVersion, dwOSMinorVersion,
           dwSpMajorVersion, dwSpMinorVersion, pdwReturnedProductType);
 
     if (!pdwReturnedProductType)
@@ -681,7 +681,7 @@ NTSTATUS WINAPI RtlVerifyVersionInfo( const RTL_OSVERSIONINFOEXW *info,
     RTL_OSVERSIONINFOEXW ver;
     NTSTATUS status;
 
-    TRACE("(%p,0x%x,0x%s)\n", info, dwTypeMask, wine_dbgstr_longlong(dwlConditionMask));
+    TRACE("(%p,0x%lx,0x%s)\n", info, dwTypeMask, wine_dbgstr_longlong(dwlConditionMask));
 
     ver.dwOSVersionInfoSize = sizeof(ver);
     if ((status = RtlGetVersion( &ver )) != STATUS_SUCCESS) return status;




More information about the wine-devel mailing list