[PATCH] dlls/ntdll/tests/exception.c: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Fri Mar 18 02:34:07 CDT 2022


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

---
 dlls/ntdll/tests/exception.c | 1307 +++++++++++++++++++++---------------------
 1 file changed, 654 insertions(+), 653 deletions(-)

diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index 442aadfd784..c4413d4d66e 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -17,6 +17,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -217,19 +218,19 @@ static void test_debugger_xstate(HANDLE thread, CONTEXT *ctx, int stage)
 
     length = sizeof(context_buffer);
     bret = pInitializeContext(context_buffer, ctx->ContextFlags | CONTEXT_XSTATE, &xctx, &length);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
     ymm = pLocateXStateFeature(xctx, XSTATE_AVX, &length);
     ok(!!ymm, "Got zero ymm.\n");
     memset(ymm, 0xcc, sizeof(*ymm));
 
     xmm = pLocateXStateFeature(xctx, XSTATE_LEGACY_SSE, &length);
-    ok(length == sizeof(*xmm) * (sizeof(void *) == 8 ? 16 : 8), "Got unexpected length %#x.\n", length);
+    ok(length == sizeof(*xmm) * (sizeof(void *) == 8 ? 16 : 8), "Got unexpected length %#lx.\n", length);
     ok(!!xmm, "Got zero xmm.\n");
     memset(xmm, 0xcc, length);
 
     status = pNtGetContextThread(thread, xctx);
-    ok(!status, "NtSetContextThread failed with 0x%x\n", status);
+    ok(!status, "NtSetContextThread failed with 0x%lx\n", status);
 
     c_ex = (CONTEXT_EX *)(xctx + 1);
     xs = (XSTATE *)((char *)c_ex + c_ex->XState.Offset);
@@ -253,7 +254,7 @@ static void test_debugger_xstate(HANDLE thread, CONTEXT *ctx, int stage)
     ymm->Ymm0.High = ymm->Ymm0.Low;
 
     status = pNtSetContextThread(thread, xctx);
-    ok(!status, "NtSetContextThread failed with 0x%x\n", status);
+    ok(!status, "NtSetContextThread failed with 0x%lx\n", status);
 }
 #endif
 
@@ -451,7 +452,7 @@ static LONG CALLBACK rtlraiseexception_vectored_handler(EXCEPTION_POINTERS *Exce
 {
     PCONTEXT context = ExceptionInfo->ContextRecord;
     PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p context.Eip:%x\n", rec->ExceptionCode,
+    trace("vect. handler %08lx addr:%p context.Eip:%lx\n", rec->ExceptionCode,
           rec->ExceptionAddress, context->Eip);
 
     ok(rec->ExceptionAddress == (char *)code_mem + 0xb
@@ -461,7 +462,7 @@ static LONG CALLBACK rtlraiseexception_vectored_handler(EXCEPTION_POINTERS *Exce
     if (NtCurrentTeb()->Peb->BeingDebugged)
         ok((void *)context->Eax == pRtlRaiseException ||
            broken( is_wow64 && context->Eax == 0xf00f00f1 ), /* broken on vista */
-           "debugger managed to modify Eax to %x should be %p\n",
+           "debugger managed to modify Eax to %lx should be %p\n",
            context->Eax, pRtlRaiseException);
 
     /* check that context.Eip is fixed up only for EXCEPTION_BREAKPOINT
@@ -472,14 +473,14 @@ static LONG CALLBACK rtlraiseexception_vectored_handler(EXCEPTION_POINTERS *Exce
         ok(context->Eip == (DWORD)code_mem + 0xa ||
            (is_wow64 && context->Eip == (DWORD)code_mem + 0xb) ||
            broken(context->Eip == (DWORD)code_mem + 0xd) /* w2008 */,
-           "Eip at %x instead of %x or %x\n", context->Eip,
+           "Eip at %lx instead of %lx or %lx\n", context->Eip,
            (DWORD)code_mem + 0xa, (DWORD)code_mem + 0xb);
     }
     else
     {
         ok(context->Eip == (DWORD)code_mem + 0xb ||
            broken(context->Eip == (DWORD)code_mem + 0xd) /* w2008 */,
-           "Eip at %x instead of %x\n", context->Eip, (DWORD)code_mem + 0xb);
+           "Eip at %lx instead of %lx\n", context->Eip, (DWORD)code_mem + 0xb);
     }
 
     /* test if context change is preserved from vectored handler to stack handlers */
@@ -490,7 +491,7 @@ static LONG CALLBACK rtlraiseexception_vectored_handler(EXCEPTION_POINTERS *Exce
 static DWORD rtlraiseexception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
                       CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
 {
-    trace( "exception: %08x flags:%x addr:%p context: Eip:%x\n",
+    trace( "exception: %08lx flags:%lx addr:%p context: Eip:%lx\n",
            rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Eip );
 
     ok(rec->ExceptionAddress == (char *)code_mem + 0xb
@@ -499,7 +500,7 @@ static DWORD rtlraiseexception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR
 
     ok( context->ContextFlags == CONTEXT_ALL || context->ContextFlags == (CONTEXT_ALL | CONTEXT_XSTATE) ||
         broken(context->ContextFlags == CONTEXT_FULL),  /* win2003 */
-        "wrong context flags %x\n", context->ContextFlags );
+        "wrong context flags %lx\n", context->ContextFlags );
 
     /* check that context.Eip is fixed up only for EXCEPTION_BREAKPOINT
      * even if raised by RtlRaiseException
@@ -509,18 +510,18 @@ static DWORD rtlraiseexception_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR
         ok(context->Eip == (DWORD)code_mem + 0xa ||
            (is_wow64 && context->Eip == (DWORD)code_mem + 0xb) ||
            broken(context->Eip == (DWORD)code_mem + 0xd) /* w2008 */,
-           "Eip at %x instead of %x or %x\n", context->Eip,
+           "Eip at %lx instead of %lx or %lx\n", context->Eip,
            (DWORD)code_mem + 0xa, (DWORD)code_mem + 0xb);
     }
     else
     {
         ok(context->Eip == (DWORD)code_mem + 0xb ||
            broken(context->Eip == (DWORD)code_mem + 0xd) /* w2008 */,
-           "Eip at %x instead of %x\n", context->Eip, (DWORD)code_mem + 0xb);
+           "Eip at %lx instead of %lx\n", context->Eip, (DWORD)code_mem + 0xb);
     }
 
     if(have_vectored_api)
-        ok(context->Eax == 0xf00f00f0, "Eax is %x, should have been set to 0xf00f00f0 in vectored handler\n",
+        ok(context->Eax == 0xf00f00f0, "Eax is %lx, should have been set to 0xf00f00f0 in vectored handler\n",
            context->Eax);
 
     /* give the debugger a chance to examine the state a second time */
@@ -603,16 +604,16 @@ static DWORD unwind_expected_eax;
 static DWORD unwind_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
                              CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher )
 {
-    trace("exception: %08x flags:%x addr:%p context: Eip:%x\n",
+    trace("exception: %08lx flags:%lx addr:%p context: Eip:%lx\n",
           rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Eip);
 
-    ok(rec->ExceptionCode == STATUS_UNWIND, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == STATUS_UNWIND, "ExceptionCode is %08lx instead of %08lx\n",
        rec->ExceptionCode, STATUS_UNWIND);
     ok(rec->ExceptionAddress == (char *)code_mem + 0x22 || broken(TRUE) /* Win10 1709 */,
        "ExceptionAddress at %p instead of %p\n", rec->ExceptionAddress, (char *)code_mem + 0x22);
-    ok(context->Eip == (DWORD)code_mem + 0x22, "context->Eip is %08x instead of %08x\n",
+    ok(context->Eip == (DWORD)code_mem + 0x22, "context->Eip is %08lx instead of %08lx\n",
        context->Eip, (DWORD)code_mem + 0x22);
-    ok(context->Eax == unwind_expected_eax, "context->Eax is %08x instead of %08x\n",
+    ok(context->Eax == unwind_expected_eax, "context->Eax is %08lx instead of %08lx\n",
        context->Eax, unwind_expected_eax);
 
     context->Eax += 1;
@@ -662,14 +663,14 @@ static void test_unwind(void)
     /* test unwind to current frame */
     unwind_expected_eax = 0xDEAD0000;
     retval = func(pRtlUnwind, frame2, NULL, 0xDEAD0000);
-    ok(retval == 0xDEAD0000, "RtlUnwind returned eax %08x instead of %08x\n", retval, 0xDEAD0000);
+    ok(retval == 0xDEAD0000, "RtlUnwind returned eax %08lx instead of %08x\n", retval, 0xDEAD0000);
     ok(NtCurrentTeb()->Tib.ExceptionList == frame2, "Exception record points to %p instead of %p\n",
        NtCurrentTeb()->Tib.ExceptionList, frame2);
 
     /* unwind to frame1 */
     unwind_expected_eax = 0xDEAD0000;
     retval = func(pRtlUnwind, frame1, NULL, 0xDEAD0000);
-    ok(retval == 0xDEAD0001, "RtlUnwind returned eax %08x instead of %08x\n", retval, 0xDEAD0001);
+    ok(retval == 0xDEAD0001, "RtlUnwind returned eax %08lx instead of %08x\n", retval, 0xDEAD0001);
     ok(NtCurrentTeb()->Tib.ExceptionList == frame1, "Exception record points to %p instead of %p\n",
        NtCurrentTeb()->Tib.ExceptionList, frame1);
 
@@ -684,14 +685,14 @@ static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *fram
     unsigned int i, parameter_count, entry = except - exceptions;
 
     got_exception++;
-    trace( "exception %u: %x flags:%x addr:%p\n",
+    trace( "exception %u: %lx flags:%lx addr:%p\n",
            entry, rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
 
     ok( rec->ExceptionCode == except->status ||
         (except->alt_status != 0 && rec->ExceptionCode == except->alt_status),
-        "%u: Wrong exception code %x/%x\n", entry, rec->ExceptionCode, except->status );
+        "%u: Wrong exception code %lx/%lx\n", entry, rec->ExceptionCode, except->status );
     ok( context->Eip == (DWORD_PTR)code_mem + except->offset,
-        "%u: Unexpected eip %#x/%#lx\n", entry,
+        "%u: Unexpected eip %#lx/%#lx\n", entry,
         context->Eip, (DWORD_PTR)code_mem + except->offset );
     ok( rec->ExceptionAddress == (char*)context->Eip ||
         (rec->ExceptionCode == STATUS_BREAKPOINT && rec->ExceptionAddress == (char*)context->Eip + 1),
@@ -706,7 +707,7 @@ static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *fram
         parameter_count = except->alt_nb_params;
 
     ok( rec->NumberParameters == parameter_count,
-        "%u: Unexpected parameter count %u/%u\n", entry, rec->NumberParameters, parameter_count );
+        "%u: Unexpected parameter count %lu/%u\n", entry, rec->NumberParameters, parameter_count );
 
     /* Most CPUs (except Intel Core apparently) report a segment limit violation */
     /* instead of page faults for accesses beyond 0xffffffff */
@@ -728,14 +729,14 @@ static DWORD handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *fram
     {
         for (i = 0; i < rec->NumberParameters; i++)
             ok( rec->ExceptionInformation[i] == except->params[i],
-                "%u: Wrong parameter %d: %lx/%x\n",
+                "%u: Wrong parameter %d: %lx/%lx\n",
                 entry, i, rec->ExceptionInformation[i], except->params[i] );
     }
     else
     {
         for (i = 0; i < rec->NumberParameters; i++)
             ok( rec->ExceptionInformation[i] == except->alt_params[i],
-                "%u: Wrong parameter %d: %lx/%x\n",
+                "%u: Wrong parameter %d: %lx/%lx\n",
                 entry, i, rec->ExceptionInformation[i], except->alt_params[i] );
     }
 
@@ -792,7 +793,7 @@ static DWORD dreg_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD
 }
 
 #define CHECK_DEBUG_REG(n, m) \
-    ok((ctx.Dr##n & m) == test->dr##n, "(%d) failed to set debug register " #n " to %x, got %x\n", \
+    ok((ctx.Dr##n & m) == test->dr##n, "(%d) failed to set debug register " #n " to %lx, got %lx\n", \
        test_num, test->dr##n, ctx.Dr##n)
 
 static void check_debug_registers(int test_num, const struct dbgreg_test *test)
@@ -802,7 +803,7 @@ static void check_debug_registers(int test_num, const struct dbgreg_test *test)
 
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
     status = pNtGetContextThread(GetCurrentThread(), &ctx);
-    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
 
     CHECK_DEBUG_REG(0, ~0);
     CHECK_DEBUG_REG(1, ~0);
@@ -831,7 +832,7 @@ static DWORD single_step_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_
         /* show that the last single step exception on the popf instruction
          * (which removed the TF bit), still is a EXCEPTION_SINGLE_STEP exception */
         ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
-            "exception is not EXCEPTION_SINGLE_STEP: %x\n", rec->ExceptionCode);
+            "exception is not EXCEPTION_SINGLE_STEP: %lx\n", rec->ExceptionCode);
     }
 
     return ExceptionContinueExecution;
@@ -906,11 +907,11 @@ static DWORD bpx_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *
 {
     got_exception++;
     ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
-        "wrong exception code: %x\n", rec->ExceptionCode);
+        "wrong exception code: %lx\n", rec->ExceptionCode);
 
     if(got_exception == 1) {
         /* hw bp exception on first nop */
-        ok( context->Eip == (DWORD)code_mem, "eip is wrong:  %x instead of %x\n",
+        ok( context->Eip == (DWORD)code_mem, "eip is wrong:  %lx instead of %lx\n",
                                              context->Eip, (DWORD)code_mem);
         ok( (context->Dr6 & 0xf) == 1, "B0 flag is not set in Dr6\n");
         ok( !(context->Dr6 & 0x4000), "BS flag is set in Dr6\n");
@@ -918,7 +919,7 @@ static DWORD bpx_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *
         context->EFlags |= 0x100;       /* enable single stepping */
     } else if(  got_exception == 2) {
         /* single step exception on second nop */
-        ok( context->Eip == (DWORD)code_mem + 1, "eip is wrong: %x instead of %x\n",
+        ok( context->Eip == (DWORD)code_mem + 1, "eip is wrong: %lx instead of %lx\n",
                                                  context->Eip, (DWORD)code_mem + 1);
         ok( (context->Dr6 & 0x4000), "BS flag is not set in Dr6\n");
        /* depending on the win version the B0 bit is already set here as well
@@ -926,7 +927,7 @@ static DWORD bpx_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *
         context->EFlags |= 0x100;
     } else if( got_exception == 3) {
         /* hw bp exception on second nop */
-        ok( context->Eip == (DWORD)code_mem + 1, "eip is wrong: %x instead of %x\n",
+        ok( context->Eip == (DWORD)code_mem + 1, "eip is wrong: %lx instead of %lx\n",
                                                  context->Eip, (DWORD)code_mem + 1);
         ok( (context->Dr6 & 0xf) == 1, "B0 flag is not set in Dr6\n");
         ok( !(context->Dr6 & 0x4000), "BS flag is set in Dr6\n");
@@ -934,7 +935,7 @@ static DWORD bpx_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *
         context->EFlags |= 0x100;
     } else {
         /* single step exception on ret */
-        ok( context->Eip == (DWORD)code_mem + 2, "eip is wrong: %x instead of %x\n",
+        ok( context->Eip == (DWORD)code_mem + 2, "eip is wrong: %lx instead of %lx\n",
                                                  context->Eip, (DWORD)code_mem + 2);
         ok( (context->Dr6 & 0xf) == 0, "B0...3 flags in Dr6 shouldn't be set\n");
         ok( (context->Dr6 & 0x4000), "BS flag is not set in Dr6\n");
@@ -952,7 +953,7 @@ static DWORD int3_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD
 {
     ok( rec->ExceptionAddress == code_mem, "exception address not at: %p, but at %p\n",
                                            code_mem,  rec->ExceptionAddress);
-    ok( context->Eip == (DWORD)code_mem, "eip not at: %p, but at %#x\n", code_mem, context->Eip);
+    ok( context->Eip == (DWORD)code_mem, "eip not at: %p, but at %#lx\n", code_mem, context->Eip);
     if(context->Eip == (DWORD)code_mem) context->Eip++; /* skip breakpoint */
 
     return ExceptionContinueExecution;
@@ -1020,7 +1021,7 @@ static void test_exceptions(void)
     ctx.Dr7 = 3;
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
     res = pNtSetContextThread( GetCurrentThread(), &ctx);
-    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", res);
+    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", res);
 
     got_exception = 0;
     run_exception_test(bpx_handler, NULL, dummy_code, sizeof(dummy_code), 0);
@@ -1031,7 +1032,7 @@ static void test_exceptions(void)
 
     /* test that hardware breakpoints are not inherited by created threads */
     res = pNtSetContextThread( GetCurrentThread(), &ctx );
-    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", res );
 
     h = CreateThread( NULL, 0, hw_reg_exception_thread, 0, 0, NULL );
     WaitForSingleObject( h, 10000 );
@@ -1040,13 +1041,13 @@ static void test_exceptions(void)
     h = CreateThread( NULL, 0, hw_reg_exception_thread, (void *)4, CREATE_SUSPENDED, NULL );
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
     res = pNtGetContextThread( h, &ctx );
-    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", res );
-    ok( ctx.Dr0 == 0, "dr0 %x\n", ctx.Dr0 );
-    ok( ctx.Dr7 == 0, "dr7 %x\n", ctx.Dr7 );
+    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", res );
+    ok( ctx.Dr0 == 0, "dr0 %lx\n", ctx.Dr0 );
+    ok( ctx.Dr7 == 0, "dr7 %lx\n", ctx.Dr7 );
     ctx.Dr0 = (DWORD)code_mem;
     ctx.Dr7 = 3;
     res = pNtSetContextThread( h, &ctx );
-    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", res );
     ResumeThread( h );
     WaitForSingleObject( h, 10000 );
     CloseHandle( h );
@@ -1054,7 +1055,7 @@ static void test_exceptions(void)
     ctx.Dr0 = 0;
     ctx.Dr7 = 0;
     res = pNtSetContextThread( GetCurrentThread(), &ctx );
-    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", res );
 }
 
 static void test_debugger(DWORD cont_status)
@@ -1079,7 +1080,7 @@ static void test_debugger(DWORD cont_status)
 
     sprintf(cmdline, "%s %s %s %p", my_argv[0], my_argv[1], "debuggee", &test_stage);
     ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
-    ok(ret, "could not create child process error: %u\n", GetLastError());
+    ok(ret, "could not create child process error: %lu\n", GetLastError());
     if (!ret)
         return;
 
@@ -1090,11 +1091,11 @@ static void test_debugger(DWORD cont_status)
 
         ret = ContinueDebugEvent(de.dwProcessId, de.dwThreadId, 0xdeadbeef);
         ok(!ret, "ContinueDebugEvent unexpectedly succeeded\n");
-        ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %u\n", GetLastError());
+        ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %lu\n", GetLastError());
 
         if (de.dwThreadId != pi.dwThreadId)
         {
-            trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode);
+            trace("event %ld not coming from main thread, ignoring\n", de.dwDebugEventCode);
             ContinueDebugEvent(de.dwProcessId, de.dwThreadId, cont_status);
             continue;
         }
@@ -1115,16 +1116,16 @@ static void test_debugger(DWORD cont_status)
             counter++;
             status = pNtReadVirtualMemory(pi.hProcess, &code_mem, &code_mem_address,
                                           sizeof(code_mem_address), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             ctx.ContextFlags = CONTEXT_FULL | CONTEXT_EXTENDED_REGISTERS;
             status = pNtGetContextThread(pi.hThread, &ctx);
-            ok(!status, "NtGetContextThread failed with 0x%x\n", status);
+            ok(!status, "NtGetContextThread failed with 0x%lx\n", status);
 
-            trace("exception 0x%x at %p firstchance=%d Eip=0x%x, Eax=0x%x\n",
+            trace("exception 0x%lx at %p firstchance=%ld Eip=0x%lx, Eax=0x%lx\n",
                   de.u.Exception.ExceptionRecord.ExceptionCode,
                   de.u.Exception.ExceptionRecord.ExceptionAddress, de.u.Exception.dwFirstChance, ctx.Eip, ctx.Eax);
 
@@ -1148,7 +1149,7 @@ static void test_debugger(DWORD cont_status)
             {
                 if (stage == 1)
                 {
-                    ok((char *)ctx.Eip == (char *)code_mem_address + 0xb, "Eip at %x instead of %p\n",
+                    ok((char *)ctx.Eip == (char *)code_mem_address + 0xb, "Eip at %lx instead of %p\n",
                        ctx.Eip, (char *)code_mem_address + 0xb);
                     /* setting the context from debugger does not affect the context that the
                      * exception handler gets, except on w2008 */
@@ -1162,7 +1163,7 @@ static void test_debugger(DWORD cont_status)
                     if (de.u.Exception.dwFirstChance)
                     {
                         /* debugger gets first chance exception with unmodified ctx.Eip */
-                        ok((char *)ctx.Eip == (char *)code_mem_address + 0xb, "Eip at 0x%x instead of %p\n",
+                        ok((char *)ctx.Eip == (char *)code_mem_address + 0xb, "Eip at 0x%lx instead of %p\n",
                            ctx.Eip, (char *)code_mem_address + 0xb);
                         ctx.Eip = (UINT_PTR)code_mem_address + 0xd;
                         ctx.Eax = 0xf00f00f1;
@@ -1179,7 +1180,7 @@ static void test_debugger(DWORD cont_status)
                             ok((char *)ctx.Eip == (char *)code_mem_address + 0xa ||
                                (is_wow64 && (char *)ctx.Eip == (char *)code_mem_address + 0xb) ||
                                broken((char *)ctx.Eip == (char *)code_mem_address + 0xd) /* w2008 */,
-                               "Eip at 0x%x instead of %p\n",
+                               "Eip at 0x%lx instead of %p\n",
                                 ctx.Eip, (char *)code_mem_address + 0xa);
                             /* need to fixup Eip for debuggee */
                             if ((char *)ctx.Eip == (char *)code_mem_address + 0xa)
@@ -1188,7 +1189,7 @@ static void test_debugger(DWORD cont_status)
                         else
                             ok((char *)ctx.Eip == (char *)code_mem_address + 0xb ||
                                broken((char *)ctx.Eip == (char *)code_mem_address + 0xd) /* w2008 */,
-                               "Eip at 0x%x instead of %p\n",
+                               "Eip at 0x%lx instead of %p\n",
                                ctx.Eip, (char *)code_mem_address + 0xb);
                         /* here we handle exception */
                     }
@@ -1196,28 +1197,28 @@ static void test_debugger(DWORD cont_status)
                 else if (stage == 7 || stage == 8)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT,
-                       "expected EXCEPTION_BREAKPOINT, got %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode);
+                       "expected EXCEPTION_BREAKPOINT, got %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode);
                     ok((char *)ctx.Eip == (char *)code_mem_address + 0x1d,
-                       "expected Eip = %p, got 0x%x\n", (char *)code_mem_address + 0x1d, ctx.Eip);
+                       "expected Eip = %p, got 0x%lx\n", (char *)code_mem_address + 0x1d, ctx.Eip);
 
                     if (stage == 8) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
                 }
                 else if (stage == 9 || stage == 10)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT,
-                       "expected EXCEPTION_BREAKPOINT, got %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode);
+                       "expected EXCEPTION_BREAKPOINT, got %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode);
                     ok((char *)ctx.Eip == (char *)code_mem_address + 2,
-                       "expected Eip = %p, got 0x%x\n", (char *)code_mem_address + 2, ctx.Eip);
+                       "expected Eip = %p, got 0x%lx\n", (char *)code_mem_address + 2, ctx.Eip);
 
                     if (stage == 10) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
                 }
                 else if (stage == 11 || stage == 12 || stage == 13)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_INVALID_HANDLE,
-                       "unexpected exception code %08x, expected %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode,
+                       "unexpected exception code %08lx, expected %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode,
                        EXCEPTION_INVALID_HANDLE);
                     ok(de.u.Exception.ExceptionRecord.NumberParameters == 0,
-                       "unexpected number of parameters %d, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters);
+                       "unexpected number of parameters %ld, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters);
 
                     if (stage == 12|| stage == 13) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
                 }
@@ -1229,26 +1230,26 @@ static void test_debugger(DWORD cont_status)
                 {
                     USHORT ss;
                     __asm__( "movw %%ss,%0" : "=r" (ss) );
-                    ok( ctx.SegSs == ss, "wrong ss %04x / %04x\n", ctx.SegSs, ss );
-                    ok( ctx.SegFs != ctx.SegSs, "wrong fs %04x / %04x\n", ctx.SegFs, ctx.SegSs );
+                    ok( ctx.SegSs == ss, "wrong ss %04lx / %04x\n", ctx.SegSs, ss );
+                    ok( ctx.SegFs != ctx.SegSs, "wrong fs %04lx / %04lx\n", ctx.SegFs, ctx.SegSs );
                     if (is_wow64) todo_wine
                     {
-                        ok( ctx.SegDs == ctx.SegSs, "wrong ds %04x / %04x\n", ctx.SegDs, ctx.SegSs );
-                        ok( ctx.SegEs == ctx.SegSs, "wrong es %04x / %04x\n", ctx.SegEs, ctx.SegSs );
-                        ok( ctx.SegGs == ctx.SegSs, "wrong gs %04x / %04x\n", ctx.SegGs, ctx.SegSs );
+                        ok( ctx.SegDs == ctx.SegSs, "wrong ds %04lx / %04lx\n", ctx.SegDs, ctx.SegSs );
+                        ok( ctx.SegEs == ctx.SegSs, "wrong es %04lx / %04lx\n", ctx.SegEs, ctx.SegSs );
+                        ok( ctx.SegGs == ctx.SegSs, "wrong gs %04lx / %04lx\n", ctx.SegGs, ctx.SegSs );
                     }
                     else
                     {
-                        ok( !ctx.SegDs, "wrong ds %04x / %04x\n", ctx.SegDs, ctx.SegSs );
-                        ok( !ctx.SegEs, "wrong es %04x / %04x\n", ctx.SegEs, ctx.SegSs );
-                        ok( !ctx.SegGs, "wrong gs %04x / %04x\n", ctx.SegGs, ctx.SegSs );
+                        ok( !ctx.SegDs, "wrong ds %04lx / %04lx\n", ctx.SegDs, ctx.SegSs );
+                        ok( !ctx.SegEs, "wrong es %04lx / %04lx\n", ctx.SegEs, ctx.SegSs );
+                        ok( !ctx.SegGs, "wrong gs %04lx / %04lx\n", ctx.SegGs, ctx.SegSs );
                     }
                 }
                 else
                     ok(FALSE, "unexpected stage %u\n", stage);
 
                 status = pNtSetContextThread(pi.hThread, &ctx);
-                ok(!status, "NtSetContextThread failed with 0x%x\n", status);
+                ok(!status, "NtSetContextThread failed with 0x%lx\n", status);
             }
         }
         else if (de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT)
@@ -1258,7 +1259,7 @@ static void test_debugger(DWORD cont_status)
 
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             ok(!de.u.DebugString.fUnicode, "unexpected unicode debug string event\n");
             ok(de.u.DebugString.nDebugStringLength < sizeof(buffer) - 1, "buffer not large enough to hold %d bytes\n",
@@ -1267,7 +1268,7 @@ static void test_debugger(DWORD cont_status)
             memset(buffer, 0, sizeof(buffer));
             status = pNtReadVirtualMemory(pi.hProcess, de.u.DebugString.lpDebugStringData, buffer,
                                           de.u.DebugString.nDebugStringLength, &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             if (stage == 3 || stage == 4)
                 ok(!strcmp(buffer, "Hello World"), "got unexpected debug string '%s'\n", buffer);
@@ -1282,13 +1283,13 @@ static void test_debugger(DWORD cont_status)
 
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             if (stage == 5 || stage == 6)
             {
-                ok(de.u.RipInfo.dwError == 0x11223344, "got unexpected rip error code %08x, expected %08x\n",
+                ok(de.u.RipInfo.dwError == 0x11223344, "got unexpected rip error code %08lx, expected %08x\n",
                    de.u.RipInfo.dwError, 0x11223344);
-                ok(de.u.RipInfo.dwType  == 0x55667788, "got unexpected rip type %08x, expected %08x\n",
+                ok(de.u.RipInfo.dwType  == 0x55667788, "got unexpected rip type %08lx, expected %08x\n",
                    de.u.RipInfo.dwType, 0x55667788);
             }
             else
@@ -1303,9 +1304,9 @@ static void test_debugger(DWORD cont_status)
 
     wait_child_process( pi.hProcess );
     ret = CloseHandle(pi.hThread);
-    ok(ret, "error %u\n", GetLastError());
+    ok(ret, "error %lu\n", GetLastError());
     ret = CloseHandle(pi.hProcess);
-    ok(ret, "error %u\n", GetLastError());
+    ok(ret, "error %lu\n", GetLastError());
 
     return;
 }
@@ -1329,13 +1330,13 @@ static DWORD simd_fault_handler( EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_R
             skip("system doesn't support SIMD exceptions\n");
         else {
             ok( rec->ExceptionCode ==  STATUS_FLOAT_MULTIPLE_TRAPS,
-                "exception code: %#x, should be %#x\n",
+                "exception code: %#lx, should be %#lx\n",
                 rec->ExceptionCode,  STATUS_FLOAT_MULTIPLE_TRAPS);
-            ok( rec->NumberParameters == is_wow64 ? 2 : 1, "# of params: %i\n", rec->NumberParameters);
+            ok( rec->NumberParameters == is_wow64 ? 2 : 1, "# of params: %li\n", rec->NumberParameters);
             ok( rec->ExceptionInformation[0] == 0, "param #1: %lx, should be 0\n", rec->ExceptionInformation[0]);
             if (rec->NumberParameters == 2)
                 ok( rec->ExceptionInformation[1] == ((XSAVE_FORMAT *)context->ExtendedRegisters)->MxCsr,
-                    "param #1: %lx / %x\n", rec->ExceptionInformation[1],
+                    "param #1: %lx / %lx\n", rec->ExceptionInformation[1],
                     ((XSAVE_FORMAT *)context->ExtendedRegisters)->MxCsr);
         }
         context->Eip += 3; /* skip divps */
@@ -1478,18 +1479,18 @@ static void test_fpu_exceptions(void)
     memset(&info, 0, sizeof(info));
     run_exception_test(fpu_exception_handler, &info, fpu_exception_test_ie, sizeof(fpu_exception_test_ie), 0);
     ok(info.exception_code == EXCEPTION_FLT_STACK_CHECK,
-            "Got exception code %#x, expected EXCEPTION_FLT_STACK_CHECK\n", info.exception_code);
+            "Got exception code %#lx, expected EXCEPTION_FLT_STACK_CHECK\n", info.exception_code);
     ok(info.exception_offset == 0x19 || info.exception_offset == info.eip_offset,
-       "Got exception offset %#x, expected 0x19\n", info.exception_offset);
-    ok(info.eip_offset == 0x1b, "Got EIP offset %#x, expected 0x1b\n", info.eip_offset);
+       "Got exception offset %#lx, expected 0x19\n", info.exception_offset);
+    ok(info.eip_offset == 0x1b, "Got EIP offset %#lx, expected 0x1b\n", info.eip_offset);
 
     memset(&info, 0, sizeof(info));
     run_exception_test(fpu_exception_handler, &info, fpu_exception_test_de, sizeof(fpu_exception_test_de), 0);
     ok(info.exception_code == EXCEPTION_FLT_DIVIDE_BY_ZERO,
-            "Got exception code %#x, expected EXCEPTION_FLT_DIVIDE_BY_ZERO\n", info.exception_code);
+            "Got exception code %#lx, expected EXCEPTION_FLT_DIVIDE_BY_ZERO\n", info.exception_code);
     ok(info.exception_offset == 0x17 || info.exception_offset == info.eip_offset,
-       "Got exception offset %#x, expected 0x17\n", info.exception_offset);
-    ok(info.eip_offset == 0x19, "Got EIP offset %#x, expected 0x19\n", info.eip_offset);
+       "Got exception offset %#lx, expected 0x17\n", info.exception_offset);
+    ok(info.eip_offset == 0x19, "Got EIP offset %#lx, expected 0x19\n", info.eip_offset);
 }
 
 struct dpe_exception_info {
@@ -1504,9 +1505,9 @@ static DWORD dpe_exception_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION
     struct dpe_exception_info *info = *(struct dpe_exception_info **)(frame + 1);
 
     ok(rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION,
-       "Exception code %08x\n", rec->ExceptionCode);
+       "Exception code %08lx\n", rec->ExceptionCode);
     ok(rec->NumberParameters == 2,
-       "Parameter count: %d\n", rec->NumberParameters);
+       "Parameter count: %ld\n", rec->NumberParameters);
     ok((LPVOID)rec->ExceptionInformation[1] == code_mem,
        "Exception address: %p, expected %p\n",
        (LPVOID)rec->ExceptionInformation[1], code_mem);
@@ -1535,14 +1536,14 @@ static void test_dpe_exceptions(void)
         skip("This software platform does not support DEP\n");
         return;
     }
-    ok(stat == STATUS_INFO_LENGTH_MISMATCH, "buffer too small: %08x\n", stat);
+    ok(stat == STATUS_INFO_LENGTH_MISMATCH, "buffer too small: %08lx\n", stat);
 
     /* Query DEP */
     stat = pNtQueryInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val, &len);
-    ok(stat == STATUS_SUCCESS, "querying DEP: status %08x\n", stat);
+    ok(stat == STATUS_SUCCESS, "querying DEP: status %08lx\n", stat);
     if(stat == STATUS_SUCCESS)
     {
-        ok(len == sizeof val, "returned length: %d\n", len);
+        ok(len == sizeof val, "returned length: %ld\n", len);
         if(val & MEM_EXECUTE_OPTION_PERMANENT)
         {
             skip("toggling DEP impossible - status locked\n");
@@ -1559,7 +1560,7 @@ static void test_dpe_exceptions(void)
         /* Enable DEP */
         val = MEM_EXECUTE_OPTION_DISABLE;
         stat = pNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val);
-        ok(stat == STATUS_SUCCESS, "enabling DEP: status %08x\n", stat);
+        ok(stat == STATUS_SUCCESS, "enabling DEP: status %08lx\n", stat);
     }
 
     if(can_test_with)
@@ -1594,7 +1595,7 @@ static void test_dpe_exceptions(void)
         /* Disable DEP */
         val = MEM_EXECUTE_OPTION_ENABLE;
         stat = pNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val);
-        ok(stat == STATUS_SUCCESS, "disabling DEP: status %08x\n", stat);
+        ok(stat == STATUS_SUCCESS, "disabling DEP: status %08lx\n", stat);
     }
 
     /* page is read without exec here */
@@ -1621,18 +1622,18 @@ static void test_dpe_exceptions(void)
         /* Turn off DEP permanently */
         val = MEM_EXECUTE_OPTION_ENABLE | MEM_EXECUTE_OPTION_PERMANENT;
         stat = pNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val);
-        ok(stat == STATUS_SUCCESS, "disabling DEP permanently: status %08x\n", stat);
+        ok(stat == STATUS_SUCCESS, "disabling DEP permanently: status %08lx\n", stat);
     }
 
     /* Try to turn off DEP */
     val = MEM_EXECUTE_OPTION_ENABLE;
     stat = pNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val);
-    ok(stat == STATUS_ACCESS_DENIED, "disabling DEP while permanent: status %08x\n", stat);
+    ok(stat == STATUS_ACCESS_DENIED, "disabling DEP while permanent: status %08lx\n", stat);
 
     /* Try to turn on DEP */
     val = MEM_EXECUTE_OPTION_DISABLE;
     stat = pNtSetInformationProcess(GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val);
-    ok(stat == STATUS_ACCESS_DENIED, "enabling DEP while permanent: status %08x\n", stat);
+    ok(stat == STATUS_ACCESS_DENIED, "enabling DEP while permanent: status %08lx\n", stat);
 }
 
 static void test_thread_context(void)
@@ -1699,25 +1700,25 @@ static void test_thread_context(void)
     memcpy( func_ptr, call_func, sizeof(call_func) );
 
 #define COMPARE(reg) \
-    ok( context.reg == expect.reg, "wrong " #reg " %08x/%08x\n", context.reg, expect.reg )
+    ok( context.reg == expect.reg, "wrong " #reg " %08lx/%08lx\n", context.reg, expect.reg )
 
     memset( &context, 0xcc, sizeof(context) );
     memset( &expect, 0xcc, sizeof(expect) );
     func_ptr( &expect, pRtlCaptureContext, &context, 0, &new_x87_control );
-    trace( "expect: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x ebp=%08x esp=%08x "
-           "eip=%08x cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x prev=%08x\n",
+    trace( "expect: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx esp=%08lx "
+           "eip=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx ss=%04lx flags=%08lx prev=%08lx\n",
            expect.Eax, expect.Ebx, expect.Ecx, expect.Edx, expect.Esi, expect.Edi,
            expect.Ebp, expect.Esp, expect.Eip, expect.SegCs, expect.SegDs, expect.SegEs,
            expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, expect.prev_frame );
-    trace( "actual: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x ebp=%08x esp=%08x "
-           "eip=%08x cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
+    trace( "actual: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx esp=%08lx "
+           "eip=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx ss=%04lx flags=%08lx\n",
            context.Eax, context.Ebx, context.Ecx, context.Edx, context.Esi, context.Edi,
            context.Ebp, context.Esp, context.Eip, context.SegCs, context.SegDs, context.SegEs,
            context.SegFs, context.SegGs, context.SegSs, context.EFlags );
 
     ok( context.ContextFlags == (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS) ||
         broken( context.ContextFlags == 0xcccccccc ),  /* <= vista */
-        "wrong flags %08x\n", context.ContextFlags );
+        "wrong flags %08lx\n", context.ContextFlags );
     COMPARE( Eax );
     COMPARE( Ebx );
     COMPARE( Ecx );
@@ -1733,23 +1734,23 @@ static void test_thread_context(void)
     COMPARE( SegSs );
     COMPARE( EFlags );
     /* Ebp is from the previous stackframe */
-    ok( context.Ebp == expect.prev_frame, "wrong Ebp %08x/%08x\n", context.Ebp, expect.prev_frame );
+    ok( context.Ebp == expect.prev_frame, "wrong Ebp %08lx/%08lx\n", context.Ebp, expect.prev_frame );
     /* Esp is the value on entry to the previous stackframe */
-    ok( context.Esp == expect.Ebp + 8, "wrong Esp %08x/%08x\n", context.Esp, expect.Ebp + 8 );
+    ok( context.Esp == expect.Ebp + 8, "wrong Esp %08lx/%08lx\n", context.Esp, expect.Ebp + 8 );
 
     memset( &context, 0xcc, sizeof(context) );
     memset( &expect, 0xcc, sizeof(expect) );
     context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT;
 
     status = func_ptr( &expect, pNtGetContextThread, (void *)GetCurrentThread(), &context, &new_x87_control );
-    ok( status == STATUS_SUCCESS, "NtGetContextThread failed %08x\n", status );
-    trace( "expect: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x ebp=%08x esp=%08x "
-           "eip=%08x cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x prev=%08x\n",
+    ok( status == STATUS_SUCCESS, "NtGetContextThread failed %08lx\n", status );
+    trace( "expect: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx esp=%08lx "
+           "eip=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx ss=%04lx flags=%08lx prev=%08lx\n",
            expect.Eax, expect.Ebx, expect.Ecx, expect.Edx, expect.Esi, expect.Edi,
            expect.Ebp, expect.Esp, expect.Eip, expect.SegCs, expect.SegDs, expect.SegEs,
            expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, expect.prev_frame );
-    trace( "actual: eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x ebp=%08x esp=%08x "
-           "eip=%08x cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
+    trace( "actual: eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx ebp=%08lx esp=%08lx "
+           "eip=%08lx cs=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx ss=%04lx flags=%08lx\n",
            context.Eax, context.Ebx, context.Ecx, context.Edx, context.Esi, context.Edi,
            context.Ebp, context.Esp, context.Eip, context.SegCs, context.SegDs, context.SegEs,
            context.SegFs, context.SegGs, context.SegSs, context.EFlags );
@@ -1760,21 +1761,21 @@ static void test_thread_context(void)
     COMPARE( Ebp );
     /* Esp is the stack upon entry to NtGetContextThread */
     ok( context.Esp == expect.Esp - 12 || context.Esp == expect.Esp - 16,
-        "wrong Esp %08x/%08x\n", context.Esp, expect.Esp );
+        "wrong Esp %08lx/%08lx\n", context.Esp, expect.Esp );
     /* Eip is somewhere close to the NtGetContextThread implementation */
     ok( (char *)context.Eip >= (char *)pNtGetContextThread - 0x40000 &&
         (char *)context.Eip <= (char *)pNtGetContextThread + 0x40000,
-        "wrong Eip %08x/%08x\n", context.Eip, (DWORD)pNtGetContextThread );
+        "wrong Eip %08lx/%08lx\n", context.Eip, (DWORD)pNtGetContextThread );
     /* segment registers clear the high word */
-    ok( context.SegCs == LOWORD(expect.SegCs), "wrong SegCs %08x/%08x\n", context.SegCs, expect.SegCs );
-    ok( context.SegDs == LOWORD(expect.SegDs), "wrong SegDs %08x/%08x\n", context.SegDs, expect.SegDs );
-    ok( context.SegEs == LOWORD(expect.SegEs), "wrong SegEs %08x/%08x\n", context.SegEs, expect.SegEs );
-    ok( context.SegFs == LOWORD(expect.SegFs), "wrong SegFs %08x/%08x\n", context.SegFs, expect.SegFs );
-    ok( context.SegGs == LOWORD(expect.SegGs), "wrong SegGs %08x/%08x\n", context.SegGs, expect.SegGs );
-    ok( context.SegSs == LOWORD(expect.SegSs), "wrong SegSs %08x/%08x\n", context.SegSs, expect.SegGs );
+    ok( context.SegCs == LOWORD(expect.SegCs), "wrong SegCs %08lx/%08lx\n", context.SegCs, expect.SegCs );
+    ok( context.SegDs == LOWORD(expect.SegDs), "wrong SegDs %08lx/%08lx\n", context.SegDs, expect.SegDs );
+    ok( context.SegEs == LOWORD(expect.SegEs), "wrong SegEs %08lx/%08lx\n", context.SegEs, expect.SegEs );
+    ok( context.SegFs == LOWORD(expect.SegFs), "wrong SegFs %08lx/%08lx\n", context.SegFs, expect.SegFs );
+    ok( context.SegGs == LOWORD(expect.SegGs), "wrong SegGs %08lx/%08lx\n", context.SegGs, expect.SegGs );
+    ok( context.SegSs == LOWORD(expect.SegSs), "wrong SegSs %08lx/%08lx\n", context.SegSs, expect.SegGs );
 
     ok( LOWORD(context.FloatSave.ControlWord) == LOWORD(expect.x87_control),
-            "wrong x87 control word %#x/%#x.\n", context.FloatSave.ControlWord, expect.x87_control );
+            "wrong x87 control word %#lx/%#lx.\n", context.FloatSave.ControlWord, expect.x87_control );
     ok( LOWORD(expect.x87_control) == LOWORD(new_x87_control),
             "x87 control word changed in NtGetContextThread() %#x/%#x.\n",
             LOWORD(expect.x87_control), LOWORD(new_x87_control) );
@@ -1811,7 +1812,7 @@ static DWORD dbg_except_continue_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGIST
 {
     ok(hook_called, "Hook was not called.\n");
 
-    ok(rec->ExceptionCode == 0x80000003, "Got unexpected ExceptionCode %#x.\n", rec->ExceptionCode);
+    ok(rec->ExceptionCode == 0x80000003, "Got unexpected ExceptionCode %#lx.\n", rec->ExceptionCode);
 
     got_exception = 1;
     dbg_except_continue_handler_eip = (void *)context->Eip;
@@ -1829,10 +1830,10 @@ static LONG WINAPI dbg_except_continue_vectored_handler(struct _EXCEPTION_POINTE
     EXCEPTION_RECORD *rec = e->ExceptionRecord;
     CONTEXT *context = e->ContextRecord;
 
-    trace("dbg_except_continue_vectored_handler, code %#x, eip %#x, ExceptionAddress %p.\n",
+    trace("dbg_except_continue_vectored_handler, code %#lx, eip %#lx, ExceptionAddress %p.\n",
             rec->ExceptionCode, context->Eip, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == 0x80000003, "Got unexpected ExceptionCode %#x.\n", rec->ExceptionCode);
+    ok(rec->ExceptionCode == 0x80000003, "Got unexpected ExceptionCode %#lx.\n", rec->ExceptionCode);
 
     got_exception = 1;
 
@@ -1853,13 +1854,13 @@ static LONG WINAPI dbg_except_continue_vectored_handler(struct _EXCEPTION_POINTE
 static void CDECL hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTEXT *context)
 {
     trace("rec %p, context %p.\n", rec, context);
-    trace("context->Eip %#x, context->Esp %#x, ContextFlags %#x.\n",
+    trace("context->Eip %#lx, context->Esp %#lx, ContextFlags %#lx.\n",
             context->Eip, context->Esp, context->ContextFlags);
 
     hook_called = TRUE;
     /* Broken on Win2008, probably rec offset in stack is different. */
     ok(rec->ExceptionCode == 0x80000003 || broken(!rec->ExceptionCode),
-            "Got unexpected ExceptionCode %#x.\n", rec->ExceptionCode);
+            "Got unexpected ExceptionCode %#lx.\n", rec->ExceptionCode);
 
     hook_KiUserExceptionDispatcher_eip = (void *)context->Eip;
     hook_exception_address = rec->ExceptionAddress;
@@ -1945,11 +1946,11 @@ static void test_kiuserexceptiondispatcher(void)
     *(unsigned int *)(hook_trampoline + 8) = (ULONG_PTR)&pKiUserExceptionDispatcher;
 
     ret = VirtualProtect(hook_trampoline, ARRAY_SIZE(hook_trampoline), PAGE_EXECUTE_READWRITE, &old_protect1);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
 
     ret = VirtualProtect(pKiUserExceptionDispatcher, sizeof(saved_KiUserExceptionDispatcher_bytes),
             PAGE_EXECUTE_READWRITE, &old_protect2);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
 
     memcpy(saved_KiUserExceptionDispatcher_bytes, pKiUserExceptionDispatcher,
             sizeof(saved_KiUserExceptionDispatcher_bytes));
@@ -1972,9 +1973,9 @@ static void test_kiuserexceptiondispatcher(void)
     ok(got_exception, "Handler was not called.\n");
     ok(hook_called, "Hook was not called.\n");
 
-    ok(test_kiuserexceptiondispatcher_regs.new_eax == 0xdeadbeef, "Got unexpected eax %#x.\n",
+    ok(test_kiuserexceptiondispatcher_regs.new_eax == 0xdeadbeef, "Got unexpected eax %#lx.\n",
             test_kiuserexceptiondispatcher_regs.new_eax);
-    ok(test_kiuserexceptiondispatcher_regs.new_esi == 0xdeadbeef, "Got unexpected esi %#x.\n",
+    ok(test_kiuserexceptiondispatcher_regs.new_esi == 0xdeadbeef, "Got unexpected esi %#lx.\n",
             test_kiuserexceptiondispatcher_regs.new_esi);
     ok(test_kiuserexceptiondispatcher_regs.old_edi
             == test_kiuserexceptiondispatcher_regs.new_edi, "edi does not match.\n");
@@ -2015,9 +2016,9 @@ static void test_kiuserexceptiondispatcher(void)
     RemoveVectoredExceptionHandler(vectored_handler);
     ret = VirtualProtect(pKiUserExceptionDispatcher, sizeof(saved_KiUserExceptionDispatcher_bytes),
             old_protect2, &old_protect2);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
     ret = VirtualProtect(hook_trampoline, ARRAY_SIZE(hook_trampoline), old_protect1, &old_protect1);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
 }
 
 #elif defined(__x86_64__)
@@ -2186,7 +2187,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test )
 
             if (ctx_ptr.IntegerContext[j])
             {
-                ok( k < nb_regs || broken( broken_k < nb_regs ), "%u/%u: register %s should not be set to %lx\n",
+                ok( k < nb_regs || broken( broken_k < nb_regs ), "%u/%u: register %s should not be set to %Ix\n",
                     testnum, i, reg_names[j], *(&context.Rax + j) );
                 ok( k == nb_regs || *(&context.Rax + j) == test->results[i].regs[k][1]
                         || broken( broken_k == nb_regs || *(&context.Rax + j)
@@ -2415,7 +2416,7 @@ static PVOID CALLBACK test_consolidate_dummy(EXCEPTION_RECORD *rec)
 {
     CONTEXT *ctx = (CONTEXT *)rec->ExceptionInformation[1];
     consolidate_dummy_called = 1;
-    ok(ctx->Rip == 0xdeadbeef, "test_consolidate_dummy failed for Rip, expected: 0xdeadbeef, got: %lx\n", ctx->Rip);
+    ok(ctx->Rip == 0xdeadbeef, "test_consolidate_dummy failed for Rip, expected: 0xdeadbeef, got: %Ix\n", ctx->Rip);
     return (PVOID)rec->ExceptionInformation[2];
 }
 
@@ -2446,7 +2447,7 @@ static void test_restore_context(void)
         ok(0, "shouldn't be reached\n");
     }
     else
-        ok(pass < 4, "unexpected pass %d\n", pass);
+        ok(pass < 4, "unexpected pass %ld\n", pass);
 
     /* test with jmp using RltRestoreContext */
     pass = 0;
@@ -2461,7 +2462,7 @@ static void test_restore_context(void)
         rec.NumberParameters = 1;
         rec.ExceptionInformation[0] = (DWORD64)&buf;
 
-        ok(buf.MxCsr == 0x1f80, "Got unexpected MxCsr %#x.\n", buf.MxCsr);
+        ok(buf.MxCsr == 0x1f80, "Got unexpected MxCsr %#lx.\n", buf.MxCsr);
         ok(buf.FpCsr == 0x27f, "Got unexpected FpCsr %#x.\n", buf.FpCsr);
         buf.FpCsr = 0x7f;
         buf.MxCsr = 0x3f80;
@@ -2471,30 +2472,30 @@ static void test_restore_context(void)
     }
     else if (pass == 4)
     {
-        ok(buf.Rbx == ctx.Rbx, "longjmp failed for Rbx, expected: %lx, got: %lx\n", buf.Rbx, ctx.Rbx);
-        ok(buf.Rsp == ctx.Rsp, "longjmp failed for Rsp, expected: %lx, got: %lx\n", buf.Rsp, ctx.Rsp);
-        ok(buf.Rbp == ctx.Rbp, "longjmp failed for Rbp, expected: %lx, got: %lx\n", buf.Rbp, ctx.Rbp);
-        ok(buf.Rsi == ctx.Rsi, "longjmp failed for Rsi, expected: %lx, got: %lx\n", buf.Rsi, ctx.Rsi);
-        ok(buf.Rdi == ctx.Rdi, "longjmp failed for Rdi, expected: %lx, got: %lx\n", buf.Rdi, ctx.Rdi);
-        ok(buf.R12 == ctx.R12, "longjmp failed for R12, expected: %lx, got: %lx\n", buf.R12, ctx.R12);
-        ok(buf.R13 == ctx.R13, "longjmp failed for R13, expected: %lx, got: %lx\n", buf.R13, ctx.R13);
-        ok(buf.R14 == ctx.R14, "longjmp failed for R14, expected: %lx, got: %lx\n", buf.R14, ctx.R14);
-        ok(buf.R15 == ctx.R15, "longjmp failed for R15, expected: %lx, got: %lx\n", buf.R15, ctx.R15);
+        ok(buf.Rbx == ctx.Rbx, "longjmp failed for Rbx, expected: %Ix, got: %Ix\n", buf.Rbx, ctx.Rbx);
+        ok(buf.Rsp == ctx.Rsp, "longjmp failed for Rsp, expected: %Ix, got: %Ix\n", buf.Rsp, ctx.Rsp);
+        ok(buf.Rbp == ctx.Rbp, "longjmp failed for Rbp, expected: %Ix, got: %Ix\n", buf.Rbp, ctx.Rbp);
+        ok(buf.Rsi == ctx.Rsi, "longjmp failed for Rsi, expected: %Ix, got: %Ix\n", buf.Rsi, ctx.Rsi);
+        ok(buf.Rdi == ctx.Rdi, "longjmp failed for Rdi, expected: %Ix, got: %Ix\n", buf.Rdi, ctx.Rdi);
+        ok(buf.R12 == ctx.R12, "longjmp failed for R12, expected: %Ix, got: %Ix\n", buf.R12, ctx.R12);
+        ok(buf.R13 == ctx.R13, "longjmp failed for R13, expected: %Ix, got: %Ix\n", buf.R13, ctx.R13);
+        ok(buf.R14 == ctx.R14, "longjmp failed for R14, expected: %Ix, got: %Ix\n", buf.R14, ctx.R14);
+        ok(buf.R15 == ctx.R15, "longjmp failed for R15, expected: %Ix, got: %Ix\n", buf.R15, ctx.R15);
 
         fltsave = &buf.Xmm6;
         for (i = 0; i < 10; i++)
         {
             ok(fltsave[i].Part[0] == ctx.FltSave.XmmRegisters[i + 6].Low,
-                "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6,
+                "longjmp failed for Xmm%d, expected %Ix, got %Ix\n", i + 6,
                 fltsave[i].Part[0], ctx.FltSave.XmmRegisters[i + 6].Low);
 
             ok(fltsave[i].Part[1] == ctx.FltSave.XmmRegisters[i + 6].High,
-                "longjmp failed for Xmm%d, expected %lx, got %lx\n", i + 6,
+                "longjmp failed for Xmm%d, expected %Ix, got %Ix\n", i + 6,
                 fltsave[i].Part[1], ctx.FltSave.XmmRegisters[i + 6].High);
         }
         ok(ctx.FltSave.ControlWord == 0x7f, "Got unexpected float control word %#x.\n", ctx.FltSave.ControlWord);
-        ok(ctx.MxCsr == 0x3f80, "Got unexpected MxCsr %#x.\n", ctx.MxCsr);
-        ok(ctx.FltSave.MxCsr == 0x3f80, "Got unexpected MxCsr %#x.\n", ctx.FltSave.MxCsr);
+        ok(ctx.MxCsr == 0x3f80, "Got unexpected MxCsr %#lx.\n", ctx.MxCsr);
+        ok(ctx.FltSave.MxCsr == 0x3f80, "Got unexpected MxCsr %#lx.\n", ctx.FltSave.MxCsr);
         buf.FpCsr = 0x27f;
         buf.MxCsr = 0x1f80;
         pRtlRestoreContext(&ctx, &rec);
@@ -2503,10 +2504,10 @@ static void test_restore_context(void)
     else if (pass == 5)
     {
         ok(ctx.FltSave.ControlWord == 0x27f, "Got unexpected float control word %#x.\n", ctx.FltSave.ControlWord);
-        ok(ctx.FltSave.MxCsr == 0x1f80, "Got unexpected MxCsr %#x.\n", ctx.MxCsr);
+        ok(ctx.FltSave.MxCsr == 0x1f80, "Got unexpected MxCsr %#lx.\n", ctx.MxCsr);
     }
     else
-        ok(0, "unexpected pass %d\n", pass);
+        ok(0, "unexpected pass %ld\n", pass);
 
     /* test with jmp through RtlUnwindEx */
     pass = 0;
@@ -2526,7 +2527,7 @@ static void test_restore_context(void)
         ok(0, "shouldn't be reached\n");
     }
     else
-        ok(pass == 4, "unexpected pass %d\n", pass);
+        ok(pass == 4, "unexpected pass %ld\n", pass);
 
 
     /* test with consolidate */
@@ -2549,7 +2550,7 @@ static void test_restore_context(void)
     else if (pass == 3)
         ok(consolidate_dummy_called, "test_consolidate_dummy not called\n");
     else
-        ok(0, "unexpected pass %d\n", pass);
+        ok(0, "unexpected pass %ld\n", pass);
 }
 
 static RUNTIME_FUNCTION* CALLBACK dynamic_unwind_callback( DWORD64 pc, PVOID context )
@@ -2588,7 +2589,7 @@ static void test_dynamic_unwind(void)
     ok( func == NULL,
         "RtlLookupFunctionEntry returned unexpected function, expected: NULL, got: %p\n", func );
     ok( !base || broken(base == 0xdeadbeef),
-        "RtlLookupFunctionEntry modified base address, expected: 0, got: %lx\n", base );
+        "RtlLookupFunctionEntry modified base address, expected: 0, got: %Ix\n", base );
 
     /* Test with pointer inside of our function */
     base = 0xdeadbeef;
@@ -2596,7 +2597,7 @@ static void test_dynamic_unwind(void)
     ok( func == runtime_func,
         "RtlLookupFunctionEntry didn't return expected function, expected: %p, got: %p\n", runtime_func, func );
     ok( base == (ULONG_PTR)code_mem,
-        "RtlLookupFunctionEntry returned invalid base, expected: %lx, got: %lx\n", (ULONG_PTR)code_mem, base );
+        "RtlLookupFunctionEntry returned invalid base, expected: %Ix, got: %Ix\n", (ULONG_PTR)code_mem, base );
 
     /* Test RtlDeleteFunctionTable */
     ok( pRtlDeleteFunctionTable( runtime_func ),
@@ -2641,12 +2642,12 @@ static void test_dynamic_unwind(void)
     /* Test RtlInstallFunctionTableCallback with both low bits unset */
     table = (ULONG_PTR)code_mem;
     ok( !pRtlInstallFunctionTableCallback( table, (ULONG_PTR)code_mem, code_offset + 32, &dynamic_unwind_callback, (PVOID*)&count, NULL ),
-        "RtlInstallFunctionTableCallback returned success for table = %lx\n", table );
+        "RtlInstallFunctionTableCallback returned success for table = %Ix\n", table );
 
     /* Test RtlInstallFunctionTableCallback with both low bits set */
     table = (ULONG_PTR)code_mem | 0x3;
     ok( pRtlInstallFunctionTableCallback( table, (ULONG_PTR)code_mem, code_offset + 32, &dynamic_unwind_callback, (PVOID*)&count, NULL ),
-        "RtlInstallFunctionTableCallback failed for table = %lx\n", table );
+        "RtlInstallFunctionTableCallback failed for table = %Ix\n", table );
 
     /* Lookup function outside of any function table */
     count = 0;
@@ -2655,9 +2656,9 @@ static void test_dynamic_unwind(void)
     ok( func == NULL,
         "RtlLookupFunctionEntry returned unexpected function, expected: NULL, got: %p\n", func );
     ok( !base || broken(base == 0xdeadbeef),
-        "RtlLookupFunctionEntry modified base address, expected: 0, got: %lx\n", base );
+        "RtlLookupFunctionEntry modified base address, expected: 0, got: %Ix\n", base );
     ok( !count,
-        "RtlLookupFunctionEntry issued %d unexpected calls to dynamic_unwind_callback\n", count );
+        "RtlLookupFunctionEntry issued %ld unexpected calls to dynamic_unwind_callback\n", count );
 
     /* Test with pointer inside of our function */
     count = 0;
@@ -2666,9 +2667,9 @@ static void test_dynamic_unwind(void)
     ok( func != NULL && func->BeginAddress == code_offset + 16 && func->EndAddress == code_offset + 32,
         "RtlLookupFunctionEntry didn't return expected function, got: %p\n", func );
     ok( base == (ULONG_PTR)code_mem,
-        "RtlLookupFunctionEntry returned invalid base, expected: %lx, got: %lx\n", (ULONG_PTR)code_mem, base );
+        "RtlLookupFunctionEntry returned invalid base, expected: %Ix, got: %Ix\n", (ULONG_PTR)code_mem, base );
     ok( count == 1,
-        "RtlLookupFunctionEntry issued %d calls to dynamic_unwind_callback, expected: 1\n", count );
+        "RtlLookupFunctionEntry issued %ld calls to dynamic_unwind_callback, expected: 1\n", count );
 
     /* Clean up again */
     ok( pRtlDeleteFunctionTable( (PRUNTIME_FUNCTION)table ),
@@ -2694,26 +2695,26 @@ static void test_dynamic_unwind(void)
 
     growable_table = NULL;
     status = pRtlAddGrowableFunctionTable( &growable_table, runtime_func, 1, 1, (ULONG_PTR)code_mem, (ULONG_PTR)code_mem + 64 );
-    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#x.\n", runtime_func, status );
+    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#lx.\n", runtime_func, status );
     ok(growable_table != 0, "Unexpected table value.\n");
     pRtlDeleteGrowableFunctionTable( growable_table );
 
     growable_table = NULL;
     status = pRtlAddGrowableFunctionTable( &growable_table, runtime_func, 2, 2, (ULONG_PTR)code_mem, (ULONG_PTR)code_mem + 64 );
-    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#x.\n", runtime_func, status );
+    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#lx.\n", runtime_func, status );
     ok(growable_table != 0, "Unexpected table value.\n");
     pRtlDeleteGrowableFunctionTable( growable_table );
 
     growable_table = NULL;
     status = pRtlAddGrowableFunctionTable( &growable_table, runtime_func, 1, 2, (ULONG_PTR)code_mem, (ULONG_PTR)code_mem + 64 );
-    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#x.\n", runtime_func, status );
+    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#lx.\n", runtime_func, status );
     ok(growable_table != 0, "Unexpected table value.\n");
     pRtlDeleteGrowableFunctionTable( growable_table );
 
     growable_table = NULL;
     status = pRtlAddGrowableFunctionTable( &growable_table, runtime_func, 0, 2, (ULONG_PTR)code_mem,
             (ULONG_PTR)code_mem + code_offset + 64 );
-    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#x.\n", runtime_func, status );
+    ok(!status, "RtlAddGrowableFunctionTable failed for runtime_func = %p (aligned), %#lx.\n", runtime_func, status );
     ok(growable_table != 0, "Unexpected table value.\n");
 
     /* Current count is 0. */
@@ -2728,7 +2729,7 @@ static void test_dynamic_unwind(void)
     ok( func == runtime_func,
         "RtlLookupFunctionEntry didn't return expected function, expected: %p, got: %p\n", runtime_func, func );
     ok( base == (ULONG_PTR)code_mem,
-        "RtlLookupFunctionEntry returned invalid base, expected: %lx, got: %lx\n", (ULONG_PTR)code_mem, base );
+        "RtlLookupFunctionEntry returned invalid base, expected: %Ix, got: %Ix\n", (ULONG_PTR)code_mem, base );
 
     /* Second function is inaccessible yet. */
     base = 0xdeadbeef;
@@ -2743,7 +2744,7 @@ static void test_dynamic_unwind(void)
     ok( func == runtime_func + 1,
         "RtlLookupFunctionEntry didn't return expected function, expected: %p, got: %p\n", runtime_func, func );
     ok( base == (ULONG_PTR)code_mem,
-        "RtlLookupFunctionEntry returned invalid base, expected: %lx, got: %lx\n", (ULONG_PTR)code_mem, base );
+        "RtlLookupFunctionEntry returned invalid base, expected: %Ix, got: %Ix\n", (ULONG_PTR)code_mem, base );
 
     pRtlDeleteGrowableFunctionTable( growable_table );
 }
@@ -2753,7 +2754,7 @@ static void WINAPI termination_handler(ULONG flags, ULONG64 frame)
 {
     termination_handler_called++;
 
-    ok(flags == 1 || broken(flags == 0x401), "flags = %x\n", flags);
+    ok(flags == 1 || broken(flags == 0x401), "flags = %lx\n", flags);
     ok(frame == 0x1234, "frame = %p\n", (void*)frame);
 }
 
@@ -2792,13 +2793,13 @@ static void test___C_specific_handler(void)
     ok(ret == ExceptionContinueSearch, "__C_specific_handler returned %x\n", ret);
     ok(termination_handler_called == 1, "termination_handler_called = %d\n",
             termination_handler_called);
-    ok(dispatch.ScopeIndex == 1, "dispatch.ScopeIndex = %d\n", dispatch.ScopeIndex);
+    ok(dispatch.ScopeIndex == 1, "dispatch.ScopeIndex = %ld\n", dispatch.ScopeIndex);
 
     ret = p__C_specific_handler(&rec, frame, &context, &dispatch);
     ok(ret == ExceptionContinueSearch, "__C_specific_handler returned %x\n", ret);
     ok(termination_handler_called == 1, "termination_handler_called = %d\n",
             termination_handler_called);
-    ok(dispatch.ScopeIndex == 1, "dispatch.ScopeIndex = %d\n", dispatch.ScopeIndex);
+    ok(dispatch.ScopeIndex == 1, "dispatch.ScopeIndex = %ld\n", dispatch.ScopeIndex);
 }
 
 /* This is heavily based on the i386 exception tests. */
@@ -3016,14 +3017,14 @@ static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame,
     USHORT ds, es, fs, gs, ss;
 
     got_exception++;
-    trace( "exception %u: %x flags:%x addr:%p\n",
+    trace( "exception %u: %lx flags:%lx addr:%p\n",
            entry, rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
 
     ok( rec->ExceptionCode == except->status ||
         (except->alt_status != 0 && rec->ExceptionCode == except->alt_status),
-        "%u: Wrong exception code %x/%x\n", entry, rec->ExceptionCode, except->status );
+        "%u: Wrong exception code %lx/%lx\n", entry, rec->ExceptionCode, except->status );
     ok( context->Rip == (DWORD_PTR)code_mem + except->offset,
-        "%u: Unexpected eip %#lx/%#lx\n", entry,
+        "%u: Unexpected eip %#Ix/%#Ix\n", entry,
         context->Rip, (DWORD_PTR)code_mem + except->offset );
     ok( rec->ExceptionAddress == (char*)context->Rip ||
         (rec->ExceptionCode == STATUS_BREAKPOINT && rec->ExceptionAddress == (char*)context->Rip + 1),
@@ -3057,7 +3058,7 @@ static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame,
         parameter_count = except->alt_nb_params;
 
     ok( rec->NumberParameters == parameter_count,
-        "%u: Unexpected parameter count %u/%u\n", entry, rec->NumberParameters, parameter_count );
+        "%u: Unexpected parameter count %lu/%u\n", entry, rec->NumberParameters, parameter_count );
 
     /* Most CPUs (except Intel Core apparently) report a segment limit violation */
     /* instead of page faults for accesses beyond 0xffffffffffffffff */
@@ -3079,14 +3080,14 @@ static DWORD WINAPI handler( EXCEPTION_RECORD *rec, ULONG64 frame,
     {
         for (i = 0; i < rec->NumberParameters; i++)
             ok( rec->ExceptionInformation[i] == except->params[i],
-                "%u: Wrong parameter %d: %lx/%lx\n",
+                "%u: Wrong parameter %d: %Ix/%Ix\n",
                 entry, i, rec->ExceptionInformation[i], except->params[i] );
     }
     else
     {
         for (i = 0; i < rec->NumberParameters; i++)
             ok( rec->ExceptionInformation[i] == except->alt_params[i],
-                "%u: Wrong parameter %d: %lx/%lx\n",
+                "%u: Wrong parameter %d: %Ix/%Ix\n",
                 entry, i, rec->ExceptionInformation[i], except->alt_params[i] );
     }
 
@@ -3136,7 +3137,7 @@ static int check_debug_registers(int test_num, const struct dbgreg_test *test)
 
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
     status = pNtGetContextThread(GetCurrentThread(), &ctx);
-    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
+    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
 
     if (!ctx.Dr0 && !ctx.Dr1 && !ctx.Dr2 && !ctx.Dr3 && !ctx.Dr6 && !ctx.Dr7)
     {
@@ -3179,7 +3180,7 @@ static DWORD WINAPI single_step_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
         /* show that the last single step exception on the popf instruction
          * (which removed the TF bit), still is a EXCEPTION_SINGLE_STEP exception */
         ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
-            "exception is not EXCEPTION_SINGLE_STEP: %x\n", rec->ExceptionCode);
+            "exception is not EXCEPTION_SINGLE_STEP: %lx\n", rec->ExceptionCode);
     }
     return ExceptionContinueExecution;
 }
@@ -3245,7 +3246,7 @@ static DWORD WINAPI bpx_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
 {
     got_exception++;
     ok( rec->ExceptionCode == EXCEPTION_SINGLE_STEP,
-        "wrong exception code: %x\n", rec->ExceptionCode);
+        "wrong exception code: %lx\n", rec->ExceptionCode);
 
     if(got_exception == 1) {
         /* hw bp exception on first nop */
@@ -3298,7 +3299,7 @@ static DWORD WINAPI int3_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
 /* trap unhandled exceptions */
 static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
 {
-    printf( "%04x unhandled exception %08x at %p rip %p eflags %x\n",
+    printf( "%04lx unhandled exception %08lx at %p rip %p eflags %lx\n",
             GetCurrentProcessId(),
             ptrs->ExceptionRecord->ExceptionCode, ptrs->ExceptionRecord->ExceptionAddress,
             (void *)ptrs->ContextRecord->Rip, ptrs->ContextRecord->EFlags );
@@ -3336,7 +3337,7 @@ static void test_exceptions(void)
         ctx.Dr7 = 1;
         ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
         res = pNtSetContextThread( GetCurrentThread(), &ctx );
-        ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", res);
+        ok( res == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", res);
 
         got_exception = 0;
         run_exception_test(bpx_handler, NULL, dummy_code, sizeof(dummy_code), 0);
@@ -3368,7 +3369,7 @@ static void test_exceptions(void)
     /* test segment registers */
     ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_SEGMENTS;
     res = pNtGetContextThread( GetCurrentThread(), &ctx );
-    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", res );
     __asm__ volatile( "movw %%ds,%0" : "=g" (ds) );
     __asm__ volatile( "movw %%es,%0" : "=g" (es) );
     __asm__ volatile( "movw %%fs,%0" : "=g" (fs) );
@@ -3389,14 +3390,14 @@ static void test_exceptions(void)
     ctx.SegEs = ctx.SegFs;
     ctx.SegFs = ctx.SegSs;
     res = pNtSetContextThread( GetCurrentThread(), &ctx );
-    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", res );
     __asm__ volatile( "movw %%ds,%0" : "=g" (ds) );
     __asm__ volatile( "movw %%es,%0" : "=g" (es) );
     __asm__ volatile( "movw %%fs,%0" : "=g" (fs) );
     __asm__ volatile( "movw %%gs,%0" : "=g" (gs) );
     __asm__ volatile( "movw %%ss,%0" : "=g" (ss) );
     res = pNtGetContextThread( GetCurrentThread(), &ctx );
-    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", res );
+    ok( res == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", res );
     ok( ctx.SegDs == ds, "wrong ds %04x / %04x\n", ctx.SegDs, ds );
     ok( ctx.SegEs == es, "wrong es %04x / %04x\n", ctx.SegEs, es );
     ok( ctx.SegFs == fs, "wrong fs %04x / %04x\n", ctx.SegFs, fs );
@@ -3431,11 +3432,11 @@ static DWORD WINAPI simd_fault_handler( EXCEPTION_RECORD *rec, ULONG64 frame,
         else
         {
             ULONG expect = *stage == 2 ? EXCEPTION_FLT_DIVIDE_BY_ZERO : EXCEPTION_FLT_INVALID_OPERATION;
-            ok( rec->ExceptionCode == expect, "exception code: %#x, should be %#x\n",
+            ok( rec->ExceptionCode == expect, "exception code: %#lx, should be %#lx\n",
                 rec->ExceptionCode, expect );
-            ok( rec->NumberParameters == 2, "# of params: %i, should be 2\n", rec->NumberParameters);
-            ok( rec->ExceptionInformation[0] == 0, "param #0: %lx\n", rec->ExceptionInformation[0]);
-            ok( rec->ExceptionInformation[1] == context->MxCsr, "param #1: %lx / %lx\n",
+            ok( rec->NumberParameters == 2, "# of params: %li, should be 2\n", rec->NumberParameters);
+            ok( rec->ExceptionInformation[0] == 0, "param #0: %Ix\n", rec->ExceptionInformation[0]);
+            ok( rec->ExceptionInformation[1] == context->MxCsr, "param #1: %Ix / %lx\n",
                 rec->ExceptionInformation[1], context->MxCsr);
         }
         context->Rip += 3; /* skip divps */
@@ -3532,15 +3533,15 @@ static LONG CALLBACK dpe_handler(EXCEPTION_POINTERS *info)
     EXCEPTION_RECORD *rec = info->ExceptionRecord;
     DWORD old_prot;
 
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
     got_exception++;
 
     ok(rec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION,
-        "got %#x\n", rec->ExceptionCode);
-    ok(rec->NumberParameters == 2, "got %u params\n", rec->NumberParameters);
+        "got %#lx\n", rec->ExceptionCode);
+    ok(rec->NumberParameters == 2, "got %lu params\n", rec->NumberParameters);
     ok(rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT,
-        "got %#lx\n", rec->ExceptionInformation[0]);
+        "got %#Ix\n", rec->ExceptionInformation[0]);
     ok((void *)rec->ExceptionInformation[1] == code_mem,
         "got %p\n", (void *)rec->ExceptionInformation[1]);
 
@@ -3558,19 +3559,19 @@ static void test_dpe_exceptions(void)
     void *handler;
 
     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val, &len );
-    ok( status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "got status %08x\n", status );
+    ok( status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "got status %08lx\n", status );
     if (!status)
     {
-        ok( len == sizeof(val), "wrong len %u\n", len );
+        ok( len == sizeof(val), "wrong len %lu\n", len );
         ok( val == (MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT |
                     MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION),
-            "wrong val %08x\n", val );
+            "wrong val %08lx\n", val );
     }
-    else ok( len == 0xdeadbeef, "wrong len %u\n", len );
+    else ok( len == 0xdeadbeef, "wrong len %lu\n", len );
 
     val = MEM_EXECUTE_OPTION_DISABLE;
     status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &val, sizeof val );
-    ok( status == STATUS_INVALID_PARAMETER, "got status %08x\n", status );
+    ok( status == STATUS_INVALID_PARAMETER, "got status %08lx\n", status );
 
     memcpy(code_mem, ret, sizeof(ret));
 
@@ -3622,7 +3623,7 @@ static void rtlraiseexception_handler_( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR
     if (unhandled_handler) rtlraiseexception_unhandled_handler_called = 1;
     else rtlraiseexception_handler_called = 1;
 
-    trace( "exception: %08x flags:%x addr:%p context: Rip:%p\n",
+    trace( "exception: %08lx flags:%lx addr:%p context: Rip:%p\n",
            rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, (void *)context->Rip );
 
     ok( rec->ExceptionAddress == (char *)code_mem + 0x10
@@ -3632,7 +3633,7 @@ static void rtlraiseexception_handler_( EXCEPTION_RECORD *rec, EXCEPTION_REGISTR
     ok( context->ContextFlags == CONTEXT_ALL || context->ContextFlags == (CONTEXT_ALL | CONTEXT_XSTATE)
         || context->ContextFlags == (CONTEXT_FULL | CONTEXT_SEGMENTS)
         || context->ContextFlags == (CONTEXT_FULL | CONTEXT_SEGMENTS | CONTEXT_XSTATE),
-        "wrong context flags %x\n", context->ContextFlags );
+        "wrong context flags %lx\n", context->ContextFlags );
 
     /* check that pc is fixed up only for EXCEPTION_BREAKPOINT
      * even if raised by RtlRaiseException
@@ -3679,7 +3680,7 @@ static LONG CALLBACK rtlraiseexception_vectored_handler(EXCEPTION_POINTERS *Exce
     PCONTEXT context = ExceptionInfo->ContextRecord;
     PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
 
-    trace( "vect. handler %08x addr:%p Rip:%p\n", rec->ExceptionCode, rec->ExceptionAddress, (void *)context->Rip );
+    trace( "vect. handler %08lx addr:%p Rip:%p\n", rec->ExceptionCode, rec->ExceptionAddress, (void *)context->Rip );
 
     ok( rec->ExceptionAddress == (char *)code_mem + 0x10
         || broken(rec->ExceptionAddress == code_mem || !rec->ExceptionAddress ) /* 2008 */,
@@ -3782,7 +3783,7 @@ static void test_debugger(DWORD cont_status)
 
     sprintf(cmdline, "%s %s %s %p", my_argv[0], my_argv[1], "debuggee", &test_stage);
     ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
-    ok(ret, "could not create child process error: %u\n", GetLastError());
+    ok(ret, "could not create child process error: %lu\n", GetLastError());
     if (!ret)
         return;
 
@@ -3793,11 +3794,11 @@ static void test_debugger(DWORD cont_status)
 
         ret = ContinueDebugEvent(de.dwProcessId, de.dwThreadId, 0xdeadbeef);
         ok(!ret, "ContinueDebugEvent unexpectedly succeeded\n");
-        ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %u\n", GetLastError());
+        ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected last error: %lu\n", GetLastError());
 
         if (de.dwThreadId != pi.dwThreadId)
         {
-            trace("event %d not coming from main thread, ignoring\n", de.dwDebugEventCode);
+            trace("event %ld not coming from main thread, ignoring\n", de.dwDebugEventCode);
             ContinueDebugEvent(de.dwProcessId, de.dwThreadId, cont_status);
             continue;
         }
@@ -3818,16 +3819,16 @@ static void test_debugger(DWORD cont_status)
             counter++;
             status = pNtReadVirtualMemory(pi.hProcess, &code_mem, &code_mem_address,
                                           sizeof(code_mem_address), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             ctx.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS;
             status = pNtGetContextThread(pi.hThread, &ctx);
-            ok(!status, "NtGetContextThread failed with 0x%x\n", status);
+            ok(!status, "NtGetContextThread failed with 0x%lx\n", status);
 
-            trace("exception 0x%x at %p firstchance=%d Rip=%p, Rax=%p\n",
+            trace("exception 0x%lx at %p firstchance=%ld Rip=%p, Rax=%p\n",
                   de.u.Exception.ExceptionRecord.ExceptionCode,
                   de.u.Exception.ExceptionRecord.ExceptionAddress,
                   de.u.Exception.dwFirstChance, (char *)ctx.Rip, (char *)ctx.Rax);
@@ -3884,7 +3885,7 @@ static void test_debugger(DWORD cont_status)
                                (char *)ctx.Rip, (char *)code_mem_address + 0xf);
                             ctx.Rip += 1;
                         }
-                        else ok((char *)ctx.Rip == (char *)code_mem_address + 0x10, "Rip at 0x%x instead of %p\n",
+                        else ok((char *)ctx.Rip == (char *)code_mem_address + 0x10, "Rip at 0x%I64x instead of %p\n",
                                 ctx.Rip, (char *)code_mem_address + 0x10);
                         /* here we handle exception */
                     }
@@ -3892,7 +3893,7 @@ static void test_debugger(DWORD cont_status)
                 else if (stage == 7 || stage == 8)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT,
-                       "expected EXCEPTION_BREAKPOINT, got %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode);
+                       "expected EXCEPTION_BREAKPOINT, got %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode);
                     ok((char *)ctx.Rip == (char *)code_mem_address + 0x30,
                        "expected Rip = %p, got %p\n", (char *)code_mem_address + 0x30, (char *)ctx.Rip);
                     if (stage == 8) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
@@ -3900,7 +3901,7 @@ static void test_debugger(DWORD cont_status)
                 else if (stage == 9 || stage == 10)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT,
-                       "expected EXCEPTION_BREAKPOINT, got %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode);
+                       "expected EXCEPTION_BREAKPOINT, got %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode);
                     ok((char *)ctx.Rip == (char *)code_mem_address + 2,
                        "expected Rip = %p, got %p\n", (char *)code_mem_address + 2, (char *)ctx.Rip);
                     if (stage == 10) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
@@ -3908,10 +3909,10 @@ static void test_debugger(DWORD cont_status)
                 else if (stage == 11 || stage == 12 || stage == 13)
                 {
                     ok(de.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_INVALID_HANDLE,
-                       "unexpected exception code %08x, expected %08x\n", de.u.Exception.ExceptionRecord.ExceptionCode,
+                       "unexpected exception code %08lx, expected %08lx\n", de.u.Exception.ExceptionRecord.ExceptionCode,
                        EXCEPTION_INVALID_HANDLE);
                     ok(de.u.Exception.ExceptionRecord.NumberParameters == 0,
-                       "unexpected number of parameters %d, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters);
+                       "unexpected number of parameters %ld, expected 0\n", de.u.Exception.ExceptionRecord.NumberParameters);
 
                     if (stage == 12|| stage == 13) continuestatus = DBG_EXCEPTION_NOT_HANDLED;
                 }
@@ -3933,9 +3934,9 @@ static void test_debugger(DWORD cont_status)
                     ctx.SegEs = ctx.SegFs;
                     ctx.SegGs = 0;
                     status = pNtSetContextThread( pi.hThread, &ctx );
-                    ok( status == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", status );
+                    ok( status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status );
                     status = pNtGetContextThread( pi.hThread, &ctx );
-                    ok( status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status );
+                    ok( status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status );
                     todo_wine ok( ctx.SegSs == ss, "wrong ss %04x / %04x\n", ctx.SegSs, ss );
                     ok( ctx.SegDs == ctx.SegSs, "wrong ds %04x / %04x\n", ctx.SegDs, ctx.SegSs );
                     ok( ctx.SegEs == ctx.SegSs, "wrong es %04x / %04x\n", ctx.SegEs, ctx.SegSs );
@@ -3946,7 +3947,7 @@ static void test_debugger(DWORD cont_status)
                     ok(FALSE, "unexpected stage %u\n", stage);
 
                 status = pNtSetContextThread(pi.hThread, &ctx);
-                ok(!status, "NtSetContextThread failed with 0x%x\n", status);
+                ok(!status, "NtSetContextThread failed with 0x%lx\n", status);
             }
         }
         else if (de.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT)
@@ -3956,7 +3957,7 @@ static void test_debugger(DWORD cont_status)
 
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             ok(!de.u.DebugString.fUnicode, "unexpected unicode debug string event\n");
             ok(de.u.DebugString.nDebugStringLength < sizeof(buffer) - 1, "buffer not large enough to hold %d bytes\n",
@@ -3965,7 +3966,7 @@ static void test_debugger(DWORD cont_status)
             memset(buffer, 0, sizeof(buffer));
             status = pNtReadVirtualMemory(pi.hProcess, de.u.DebugString.lpDebugStringData, buffer,
                                           de.u.DebugString.nDebugStringLength, &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             if (stage == 3 || stage == 4)
                 ok(!strcmp(buffer, "Hello World"), "got unexpected debug string '%s'\n", buffer);
@@ -3980,13 +3981,13 @@ static void test_debugger(DWORD cont_status)
 
             status = pNtReadVirtualMemory(pi.hProcess, &test_stage, &stage,
                                           sizeof(stage), &size_read);
-            ok(!status,"NtReadVirtualMemory failed with 0x%x\n", status);
+            ok(!status,"NtReadVirtualMemory failed with 0x%lx\n", status);
 
             if (stage == 5 || stage == 6)
             {
-                ok(de.u.RipInfo.dwError == 0x11223344, "got unexpected rip error code %08x, expected %08x\n",
+                ok(de.u.RipInfo.dwError == 0x11223344, "got unexpected rip error code %08lx, expected %08x\n",
                    de.u.RipInfo.dwError, 0x11223344);
-                ok(de.u.RipInfo.dwType  == 0x55667788, "got unexpected rip type %08x, expected %08x\n",
+                ok(de.u.RipInfo.dwType  == 0x55667788, "got unexpected rip type %08lx, expected %08x\n",
                    de.u.RipInfo.dwType, 0x55667788);
             }
             else
@@ -4001,9 +4002,9 @@ static void test_debugger(DWORD cont_status)
 
     wait_child_process( pi.hProcess );
     ret = CloseHandle(pi.hThread);
-    ok(ret, "error %u\n", GetLastError());
+    ok(ret, "error %lu\n", GetLastError());
     ret = CloseHandle(pi.hProcess);
-    ok(ret, "error %u\n", GetLastError());
+    ok(ret, "error %lu\n", GetLastError());
 }
 
 static void test_thread_context(void)
@@ -4087,16 +4088,16 @@ static void test_thread_context(void)
     func_ptr( &context, 0, &expect, pRtlCaptureContext );
     trace( "expect: rax=%p rbx=%p rcx=%p rdx=%p rsi=%p rdi=%p "
            "r8=%p r9=%p r10=%p r11=%p r12=%p r13=%p r14=%p r15=%p "
-           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x prev=%08x\n",
+           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08I64x prev=%p\n",
            (void *)expect.Rax, (void *)expect.Rbx, (void *)expect.Rcx, (void *)expect.Rdx,
            (void *)expect.Rsi, (void *)expect.Rdi, (void *)expect.R8, (void *)expect.R9,
            (void *)expect.R10, (void *)expect.R11, (void *)expect.R12, (void *)expect.R13,
            (void *)expect.R14, (void *)expect.R15, (void *)expect.Rbp, (void *)expect.Rsp,
            (void *)expect.Rip, expect.SegCs, expect.SegDs, expect.SegEs,
-           expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, expect.prev_frame );
+           expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, (void*)expect.prev_frame );
     trace( "actual: rax=%p rbx=%p rcx=%p rdx=%p rsi=%p rdi=%p "
            "r8=%p r9=%p r10=%p r11=%p r12=%p r13=%p r14=%p r15=%p "
-           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
+           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08lx\n",
            (void *)context.Rax, (void *)context.Rbx, (void *)context.Rcx, (void *)context.Rdx,
            (void *)context.Rsi, (void *)context.Rdi, (void *)context.R8, (void *)context.R9,
            (void *)context.R10, (void *)context.R11, (void *)context.R12, (void *)context.R13,
@@ -4105,7 +4106,7 @@ static void test_thread_context(void)
            context.SegFs, context.SegGs, context.SegSs, context.EFlags );
 
     ok( context.ContextFlags == (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT),
-        "wrong flags %08x\n", context.ContextFlags );
+        "wrong flags %08lx\n", context.ContextFlags );
     COMPARE( Rax );
     COMPARE( Rbx );
     COMPARE( Rcx );
@@ -4144,19 +4145,19 @@ static void test_thread_context(void)
     context.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT;
 
     status = func_ptr( GetCurrentThread(), &context, &expect, pNtGetContextThread );
-    ok( status == STATUS_SUCCESS, "NtGetContextThread failed %08x\n", status );
+    ok( status == STATUS_SUCCESS, "NtGetContextThread failed %08lx\n", status );
     trace( "expect: rax=%p rbx=%p rcx=%p rdx=%p rsi=%p rdi=%p "
            "r8=%p r9=%p r10=%p r11=%p r12=%p r13=%p r14=%p r15=%p "
-           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x prev=%08x\n",
+           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08I64x prev=%p\n",
            (void *)expect.Rax, (void *)expect.Rbx, (void *)expect.Rcx, (void *)expect.Rdx,
            (void *)expect.Rsi, (void *)expect.Rdi, (void *)expect.R8, (void *)expect.R9,
            (void *)expect.R10, (void *)expect.R11, (void *)expect.R12, (void *)expect.R13,
            (void *)expect.R14, (void *)expect.R15, (void *)expect.Rbp, (void *)expect.Rsp,
            (void *)expect.Rip, expect.SegCs, expect.SegDs, expect.SegEs,
-           expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, expect.prev_frame );
+           expect.SegFs, expect.SegGs, expect.SegSs, expect.EFlags, (void*)expect.prev_frame );
     trace( "actual: rax=%p rbx=%p rcx=%p rdx=%p rsi=%p rdi=%p "
            "r8=%p r9=%p r10=%p r11=%p r12=%p r13=%p r14=%p r15=%p "
-           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08x\n",
+           "rbp=%p rsp=%p rip=%p cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x flags=%08lx\n",
            (void *)context.Rax, (void *)context.Rbx, (void *)context.Rcx, (void *)context.Rdx,
            (void *)context.Rsi, (void *)context.Rdi, (void *)context.R8, (void *)context.R9,
            (void *)context.R10, (void *)context.R11, (void *)context.R12, (void *)context.R13,
@@ -4221,45 +4222,45 @@ static void test_wow64_context(void)
     memset(&ctx, 0x55, sizeof(ctx));
     ctx.ContextFlags = WOW64_CONTEXT_ALL;
     ret = pRtlWow64GetThreadContext( GetCurrentThread(), &ctx );
-    ok(ret == STATUS_INVALID_PARAMETER || broken(ret == STATUS_PARTIAL_COPY), "got %#x\n", ret);
+    ok(ret == STATUS_INVALID_PARAMETER || broken(ret == STATUS_PARTIAL_COPY), "got %#lx\n", ret);
 
     sprintf( cmdline, "\"%s\" /c for /l %%n in () do @echo >nul", appname );
     r = CreateProcessA( appname, cmdline, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, &si, &pi);
-    ok( r, "failed to start %s err %u\n", appname, GetLastError() );
+    ok( r, "failed to start %s err %lu\n", appname, GetLastError() );
 
     ret = pRtlWow64GetThreadContext( pi.hThread, &ctx );
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok(ctx.ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#x\n", ctx.ContextFlags);
-    ok(!ctx.Ebp, "got ebp %08x\n", ctx.Ebp);
-    ok(!ctx.Ecx, "got ecx %08x\n", ctx.Ecx);
-    ok(!ctx.Edx, "got edx %08x\n", ctx.Edx);
-    ok(!ctx.Esi, "got esi %08x\n", ctx.Esi);
-    ok(!ctx.Edi, "got edi %08x\n", ctx.Edi);
-    ok((ctx.EFlags & ~2) == 0x200, "got eflags %08x\n", ctx.EFlags);
-    ok((WORD) ctx.FloatSave.ControlWord == 0x27f, "got control word %08x\n",
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok(ctx.ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#lx\n", ctx.ContextFlags);
+    ok(!ctx.Ebp, "got ebp %08lx\n", ctx.Ebp);
+    ok(!ctx.Ecx, "got ecx %08lx\n", ctx.Ecx);
+    ok(!ctx.Edx, "got edx %08lx\n", ctx.Edx);
+    ok(!ctx.Esi, "got esi %08lx\n", ctx.Esi);
+    ok(!ctx.Edi, "got edi %08lx\n", ctx.Edi);
+    ok((ctx.EFlags & ~2) == 0x200, "got eflags %08lx\n", ctx.EFlags);
+    ok((WORD) ctx.FloatSave.ControlWord == 0x27f, "got control word %08lx\n",
         ctx.FloatSave.ControlWord);
     ok(*(WORD *)ctx.ExtendedRegisters == 0x27f, "got SSE control word %04x\n",
        *(WORD *)ctx.ExtendedRegisters);
 
     ret = pRtlWow64SetThreadContext( pi.hThread, &ctx );
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
 
     pNtQueryInformationThread( pi.hThread, ThreadBasicInformation, &info, sizeof(info), NULL );
     if (!ReadProcessMemory( pi.hProcess, info.TebBaseAddress, &teb, sizeof(teb), &res )) res = 0;
-    ok( res == sizeof(teb), "wrong len %lx\n", res );
+    ok( res == sizeof(teb), "wrong len %Ix\n", res );
 
     memset( &teb32, 0, sizeof(teb32) );
     if (teb.WowTebOffset > 1)
     {
         if (!ReadProcessMemory( pi.hProcess, (char *)info.TebBaseAddress + teb.WowTebOffset,
                                 &teb32, sizeof(teb32), &res )) res = 0;
-        ok( res == sizeof(teb32), "wrong len %lx\n", res );
+        ok( res == sizeof(teb32), "wrong len %Ix\n", res );
 
         ok( ((ctx.Esp + 0xfff) & ~0xfff) == teb32.Tib.StackBase,
-            "esp is not at top of stack: %08x / %08x\n", ctx.Esp, teb32.Tib.StackBase );
+            "esp is not at top of stack: %08lx / %08lx\n", ctx.Esp, teb32.Tib.StackBase );
         ok( ULongToPtr( teb32.Tib.StackBase ) <= teb.DeallocationStack ||
             ULongToPtr( teb32.DeallocationStack ) >= teb.Tib.StackBase,
-            "stacks overlap %08x-%08x / %p-%p\n", teb32.DeallocationStack, teb32.Tib.StackBase,
+            "stacks overlap %08lx-%08lx / %p-%p\n", teb32.DeallocationStack, teb32.Tib.StackBase,
             teb.DeallocationStack, teb.Tib.StackBase );
     }
 
@@ -4270,29 +4271,29 @@ static void test_wow64_context(void)
         cpu_size = 0x1000 - ((ULONG_PTR)teb.TlsSlots[WOW64_TLS_CPURESERVED] & 0xfff);
         cpu = malloc( cpu_size );
         if (!ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res )) res = 0;
-        ok( res == cpu_size, "wrong len %lx\n", res );
+        ok( res == cpu_size, "wrong len %Ix\n", res );
         ok( cpu->Machine == IMAGE_FILE_MACHINE_I386, "wrong machine %04x\n", cpu->Machine );
         ret = pRtlWow64GetCpuAreaInfo( cpu, 0, &cpu_info );
-        ok( !ret, "RtlWow64GetCpuAreaInfo failed %x\n", ret );
+        ok( !ret, "RtlWow64GetCpuAreaInfo failed %lx\n", ret );
         ctx_ptr = (WOW64_CONTEXT *)cpu_info.Context;
         ok(!*(void **)cpu_info.ContextEx, "got context_ex %p\n", *(void **)cpu_info.ContextEx);
-        ok(ctx_ptr->ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#x\n", ctx_ptr->ContextFlags);
-        ok(ctx_ptr->Eax == ctx.Eax, "got eax %08x / %08x\n", ctx_ptr->Eax, ctx.Eax);
-        ok(ctx_ptr->Ebx == ctx.Ebx, "got ebx %08x / %08x\n", ctx_ptr->Ebx, ctx.Ebx);
-        ok(ctx_ptr->Ecx == ctx.Ecx, "got ecx %08x / %08x\n", ctx_ptr->Ecx, ctx.Ecx);
-        ok(ctx_ptr->Edx == ctx.Edx, "got edx %08x / %08x\n", ctx_ptr->Edx, ctx.Edx);
-        ok(ctx_ptr->Ebp == ctx.Ebp, "got ebp %08x / %08x\n", ctx_ptr->Ebp, ctx.Ebp);
-        ok(ctx_ptr->Esi == ctx.Esi, "got esi %08x / %08x\n", ctx_ptr->Esi, ctx.Esi);
-        ok(ctx_ptr->Edi == ctx.Edi, "got edi %08x / %08x\n", ctx_ptr->Edi, ctx.Edi);
-        ok(ctx_ptr->SegCs == ctx.SegCs, "got cs %04x / %04x\n", ctx_ptr->SegCs, ctx.SegCs);
-        ok(ctx_ptr->SegDs == ctx.SegDs, "got ds %04x / %04x\n", ctx_ptr->SegDs, ctx.SegDs);
-        ok(ctx_ptr->SegEs == ctx.SegEs, "got es %04x / %04x\n", ctx_ptr->SegEs, ctx.SegEs);
-        ok(ctx_ptr->SegFs == ctx.SegFs, "got fs %04x / %04x\n", ctx_ptr->SegFs, ctx.SegFs);
-        ok(ctx_ptr->SegGs == ctx.SegGs, "got gs %04x / %04x\n", ctx_ptr->SegGs, ctx.SegGs);
-        ok(ctx_ptr->SegSs == ctx.SegSs, "got ss %04x / %04x\n", ctx_ptr->SegSs, ctx.SegSs);
-        ok(ctx_ptr->EFlags == ctx.EFlags, "got eflags %08x / %08x\n", ctx_ptr->EFlags, ctx.EFlags);
+        ok(ctx_ptr->ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#lx\n", ctx_ptr->ContextFlags);
+        ok(ctx_ptr->Eax == ctx.Eax, "got eax %08lx / %08lx\n", ctx_ptr->Eax, ctx.Eax);
+        ok(ctx_ptr->Ebx == ctx.Ebx, "got ebx %08lx / %08lx\n", ctx_ptr->Ebx, ctx.Ebx);
+        ok(ctx_ptr->Ecx == ctx.Ecx, "got ecx %08lx / %08lx\n", ctx_ptr->Ecx, ctx.Ecx);
+        ok(ctx_ptr->Edx == ctx.Edx, "got edx %08lx / %08lx\n", ctx_ptr->Edx, ctx.Edx);
+        ok(ctx_ptr->Ebp == ctx.Ebp, "got ebp %08lx / %08lx\n", ctx_ptr->Ebp, ctx.Ebp);
+        ok(ctx_ptr->Esi == ctx.Esi, "got esi %08lx / %08lx\n", ctx_ptr->Esi, ctx.Esi);
+        ok(ctx_ptr->Edi == ctx.Edi, "got edi %08lx / %08lx\n", ctx_ptr->Edi, ctx.Edi);
+        ok(ctx_ptr->SegCs == ctx.SegCs, "got cs %04lx / %04lx\n", ctx_ptr->SegCs, ctx.SegCs);
+        ok(ctx_ptr->SegDs == ctx.SegDs, "got ds %04lx / %04lx\n", ctx_ptr->SegDs, ctx.SegDs);
+        ok(ctx_ptr->SegEs == ctx.SegEs, "got es %04lx / %04lx\n", ctx_ptr->SegEs, ctx.SegEs);
+        ok(ctx_ptr->SegFs == ctx.SegFs, "got fs %04lx / %04lx\n", ctx_ptr->SegFs, ctx.SegFs);
+        ok(ctx_ptr->SegGs == ctx.SegGs, "got gs %04lx / %04lx\n", ctx_ptr->SegGs, ctx.SegGs);
+        ok(ctx_ptr->SegSs == ctx.SegSs, "got ss %04lx / %04lx\n", ctx_ptr->SegSs, ctx.SegSs);
+        ok(ctx_ptr->EFlags == ctx.EFlags, "got eflags %08lx / %08lx\n", ctx_ptr->EFlags, ctx.EFlags);
         ok((WORD)ctx_ptr->FloatSave.ControlWord == ctx.FloatSave.ControlWord,
-           "got control word %08x / %08x\n", ctx_ptr->FloatSave.ControlWord, ctx.FloatSave.ControlWord);
+           "got control word %08lx / %08lx\n", ctx_ptr->FloatSave.ControlWord, ctx.FloatSave.ControlWord);
         ok(*(WORD *)ctx_ptr->ExtendedRegisters == *(WORD *)ctx.ExtendedRegisters,
            "got SSE control word %04x / %04x\n", *(WORD *)ctx_ptr->ExtendedRegisters,
            *(WORD *)ctx.ExtendedRegisters);
@@ -4300,11 +4301,11 @@ static void test_wow64_context(void)
         ecx = ctx.Ecx;
         ctx.Ecx = 0x12345678;
         ret = pRtlWow64SetThreadContext( pi.hThread, &ctx );
-        ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+        ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
         if (!ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res )) res = 0;
-        ok( res == cpu_size, "wrong len %lx\n", res );
+        ok( res == cpu_size, "wrong len %Ix\n", res );
         todo_wine
-        ok( ctx_ptr->Ecx == 0x12345678, "got ecx %08x\n", ctx_ptr->Ecx );
+        ok( ctx_ptr->Ecx == 0x12345678, "got ecx %08lx\n", ctx_ptr->Ecx );
         ctx.Ecx = ecx;
         pRtlWow64SetThreadContext( pi.hThread, &ctx );
     }
@@ -4313,37 +4314,37 @@ static void test_wow64_context(void)
     memset( &context, 0x55, sizeof(context) );
     context.ContextFlags = CONTEXT_ALL;
     ret = pNtGetContextThread( pi.hThread, &context );
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok( context.ContextFlags == CONTEXT_ALL, "got context flags %#x\n", context.ContextFlags );
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok( context.ContextFlags == CONTEXT_ALL, "got context flags %#lx\n", context.ContextFlags );
     todo_wine
-    ok( !context.Rax, "rax is not zero %lx\n", context.Rax );
+    ok( !context.Rax, "rax is not zero %Ix\n", context.Rax );
     todo_wine
-    ok( !context.Rbx, "rbx is not zero %lx\n", context.Rbx );
-    ok( !context.Rsi, "rsi is not zero %lx\n", context.Rsi );
-    ok( !context.Rdi, "rdi is not zero %lx\n", context.Rdi );
-    ok( !context.Rbp, "rbp is not zero %lx\n", context.Rbp );
-    ok( !context.R8, "r8 is not zero %lx\n", context.R8 );
-    ok( !context.R9, "r9 is not zero %lx\n", context.R9 );
-    ok( !context.R10, "r10 is not zero %lx\n", context.R10 );
-    ok( !context.R11, "r11 is not zero %lx\n", context.R11 );
-    ok( !context.R12, "r12 is not zero %lx\n", context.R12 );
-    ok( !context.R13, "r13 is not zero %lx\n", context.R13 );
-    ok( !context.R14, "r14 is not zero %lx\n", context.R14 );
-    ok( !context.R15, "r15 is not zero %lx\n", context.R15 );
+    ok( !context.Rbx, "rbx is not zero %Ix\n", context.Rbx );
+    ok( !context.Rsi, "rsi is not zero %Ix\n", context.Rsi );
+    ok( !context.Rdi, "rdi is not zero %Ix\n", context.Rdi );
+    ok( !context.Rbp, "rbp is not zero %Ix\n", context.Rbp );
+    ok( !context.R8, "r8 is not zero %Ix\n", context.R8 );
+    ok( !context.R9, "r9 is not zero %Ix\n", context.R9 );
+    ok( !context.R10, "r10 is not zero %Ix\n", context.R10 );
+    ok( !context.R11, "r11 is not zero %Ix\n", context.R11 );
+    ok( !context.R12, "r12 is not zero %Ix\n", context.R12 );
+    ok( !context.R13, "r13 is not zero %Ix\n", context.R13 );
+    ok( !context.R14, "r14 is not zero %Ix\n", context.R14 );
+    ok( !context.R15, "r15 is not zero %Ix\n", context.R15 );
     todo_wine
     ok( ((ULONG_PTR)context.Rsp & ~0xfff) == ((ULONG_PTR)teb.Tib.StackBase & ~0xfff),
         "rsp is not at top of stack %p / %p\n", (void *)context.Rsp, teb.Tib.StackBase );
     todo_wine
-    ok( context.EFlags == 0x200, "wrong flags %08x\n", context.EFlags );
-    ok( context.MxCsr == 0x1f80, "wrong mxcsr %08x\n", context.MxCsr );
+    ok( context.EFlags == 0x200, "wrong flags %08lx\n", context.EFlags );
+    ok( context.MxCsr == 0x1f80, "wrong mxcsr %08lx\n", context.MxCsr );
     ok( context.FltSave.ControlWord == 0x27f, "wrong control %08x\n", context.FltSave.ControlWord );
     todo_wine
     ok( context.SegCs != ctx.SegCs, "wrong cs %04x\n", context.SegCs );
-    ok( context.SegDs == ctx.SegDs, "wrong ds %04x / %04x\n", context.SegDs, ctx.SegDs  );
-    ok( context.SegEs == ctx.SegEs, "wrong es %04x / %04x\n", context.SegEs, ctx.SegEs  );
-    ok( context.SegFs == ctx.SegFs, "wrong fs %04x / %04x\n", context.SegFs, ctx.SegFs  );
-    ok( context.SegGs == ctx.SegGs, "wrong gs %04x / %04x\n", context.SegGs, ctx.SegGs  );
-    ok( context.SegSs == ctx.SegSs, "wrong ss %04x / %04x\n", context.SegSs, ctx.SegSs  );
+    ok( context.SegDs == ctx.SegDs, "wrong ds %04x / %04lx\n", context.SegDs, ctx.SegDs  );
+    ok( context.SegEs == ctx.SegEs, "wrong es %04x / %04lx\n", context.SegEs, ctx.SegEs  );
+    ok( context.SegFs == ctx.SegFs, "wrong fs %04x / %04lx\n", context.SegFs, ctx.SegFs  );
+    ok( context.SegGs == ctx.SegGs, "wrong gs %04x / %04lx\n", context.SegGs, ctx.SegGs  );
+    ok( context.SegSs == ctx.SegSs, "wrong ss %04x / %04lx\n", context.SegSs, ctx.SegSs  );
 
     cs32 = ctx.SegCs;
     cs64 = context.SegCs;
@@ -4361,7 +4362,7 @@ static void test_wow64_context(void)
         memset( &context, 0x55, sizeof(context) );
         context.ContextFlags = CONTEXT_ALL;
         ret = pNtGetContextThread( pi.hThread, &context );
-        ok( ret == STATUS_SUCCESS, "got %#x\n", ret );
+        ok( ret == STATUS_SUCCESS, "got %#lx\n", ret );
         if (ret) break;
         if (context.SegCs == cs32 && got32) continue;
         if (context.SegCs == cs64 && got64) continue;
@@ -4374,30 +4375,30 @@ static void test_wow64_context(void)
         memset( &ctx, 0x55, sizeof(ctx) );
         ctx.ContextFlags = WOW64_CONTEXT_ALL;
         ret = pRtlWow64GetThreadContext( pi.hThread, &ctx );
-        ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-        ok( ctx.ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#x\n", ctx.ContextFlags );
+        ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+        ok( ctx.ContextFlags == WOW64_CONTEXT_ALL, "got context flags %#lx\n", ctx.ContextFlags );
         if (context.SegCs == cs32)
         {
             trace( "in 32-bit mode %04x\n", context.SegCs );
-            ok( ctx.Eip == context.Rip, "cs32: eip %08x / %p\n", ctx.Eip, (void *)context.Rip );
-            ok( ctx.Ebp == context.Rbp, "cs32: ebp %08x / %p\n", ctx.Ebp, (void *)context.Rbp );
-            ok( ctx.Esp == context.Rsp, "cs32: esp %08x / %p\n", ctx.Esp, (void *)context.Rsp );
-            ok( ctx.Eax == context.Rax, "cs32: eax %08x / %p\n", ctx.Eax, (void *)context.Rax );
-            ok( ctx.Ebx == context.Rbx, "cs32: ebx %08x / %p\n", ctx.Ebx, (void *)context.Rbx );
+            ok( ctx.Eip == context.Rip, "cs32: eip %08lx / %p\n", ctx.Eip, (void *)context.Rip );
+            ok( ctx.Ebp == context.Rbp, "cs32: ebp %08lx / %p\n", ctx.Ebp, (void *)context.Rbp );
+            ok( ctx.Esp == context.Rsp, "cs32: esp %08lx / %p\n", ctx.Esp, (void *)context.Rsp );
+            ok( ctx.Eax == context.Rax, "cs32: eax %08lx / %p\n", ctx.Eax, (void *)context.Rax );
+            ok( ctx.Ebx == context.Rbx, "cs32: ebx %08lx / %p\n", ctx.Ebx, (void *)context.Rbx );
             ok( ctx.Ecx == context.Rcx || broken(ctx.Ecx == (ULONG)context.Rcx),
-                "cs32: ecx %08x / %p\n", ctx.Ecx, (void *)context.Rcx );
-            ok( ctx.Edx == context.Rdx, "cs32: edx %08x / %p\n", ctx.Edx, (void *)context.Rdx );
-            ok( ctx.Esi == context.Rsi, "cs32: esi %08x / %p\n", ctx.Esi, (void *)context.Rsi );
-            ok( ctx.Edi == context.Rdi, "cs32: edi %08x / %p\n", ctx.Edi, (void *)context.Rdi );
-            ok( ctx.SegCs == cs32, "cs32: wrong cs %04x / %04x\n", ctx.SegCs, cs32 );
-            ok( ctx.SegDs == context.SegDs, "cs32: wrong ds %04x / %04x\n", ctx.SegDs, context.SegDs );
-            ok( ctx.SegEs == context.SegEs, "cs32: wrong es %04x / %04x\n", ctx.SegEs, context.SegEs );
-            ok( ctx.SegFs == context.SegFs, "cs32: wrong fs %04x / %04x\n", ctx.SegFs, context.SegFs );
-            ok( ctx.SegGs == context.SegGs, "cs32: wrong gs %04x / %04x\n", ctx.SegGs, context.SegGs );
-            ok( ctx.SegSs == context.SegSs, "cs32: wrong ss %04x / %04x\n", ctx.SegSs, context.SegSs );
+                "cs32: ecx %08lx / %p\n", ctx.Ecx, (void *)context.Rcx );
+            ok( ctx.Edx == context.Rdx, "cs32: edx %08lx / %p\n", ctx.Edx, (void *)context.Rdx );
+            ok( ctx.Esi == context.Rsi, "cs32: esi %08lx / %p\n", ctx.Esi, (void *)context.Rsi );
+            ok( ctx.Edi == context.Rdi, "cs32: edi %08lx / %p\n", ctx.Edi, (void *)context.Rdi );
+            ok( ctx.SegCs == cs32, "cs32: wrong cs %04lx / %04x\n", ctx.SegCs, cs32 );
+            ok( ctx.SegDs == context.SegDs, "cs32: wrong ds %04lx / %04x\n", ctx.SegDs, context.SegDs );
+            ok( ctx.SegEs == context.SegEs, "cs32: wrong es %04lx / %04x\n", ctx.SegEs, context.SegEs );
+            ok( ctx.SegFs == context.SegFs, "cs32: wrong fs %04lx / %04x\n", ctx.SegFs, context.SegFs );
+            ok( ctx.SegGs == context.SegGs, "cs32: wrong gs %04lx / %04x\n", ctx.SegGs, context.SegGs );
+            ok( ctx.SegSs == context.SegSs, "cs32: wrong ss %04lx / %04x\n", ctx.SegSs, context.SegSs );
             if (teb32.DeallocationStack)
                 ok( ctx.Esp >= teb32.DeallocationStack && ctx.Esp <= teb32.Tib.StackBase,
-                    "cs32: esp not inside 32-bit stack %08x / %08x-%08x\n", ctx.Esp,
+                    "cs32: esp not inside 32-bit stack %08lx / %08lx-%08lx\n", ctx.Esp,
                     teb32.DeallocationStack, teb32.Tib.StackBase );
             /* r12 points to the TEB */
             ok( (void *)context.R12 == info.TebBaseAddress,
@@ -4417,9 +4418,9 @@ static void test_wow64_context(void)
                 /* in 32-bit mode, the 32-bit context is the current cpu context, not the stored one */
                 if (!ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED],
                                         cpu, cpu_size, &res )) res = 0;
-                ok( res == cpu_size, "wrong len %lx\n", res );
+                ok( res == cpu_size, "wrong len %Ix\n", res );
                 ok(ctx_ptr->ContextFlags == WOW64_CONTEXT_ALL,
-                   "cs32: got context flags %#x\n", ctx_ptr->ContextFlags);
+                   "cs32: got context flags %#lx\n", ctx_ptr->ContextFlags);
 
                 /* changing either context changes the actual cpu context */
                 rcx = context.Rcx;
@@ -4429,17 +4430,17 @@ static void test_wow64_context(void)
                 memset( &ctx, 0x55, sizeof(ctx) );
                 ctx.ContextFlags = WOW64_CONTEXT_ALL;
                 pRtlWow64GetThreadContext( pi.hThread, &ctx );
-                ok( ctx.Ecx == 0x87654321, "cs64: ecx set to %08x\n", ctx.Ecx );
+                ok( ctx.Ecx == 0x87654321, "cs64: ecx set to %08lx\n", ctx.Ecx );
                 ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res );
-                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08x\n", ctx_ptr->Ecx );
+                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08lx\n", ctx_ptr->Ecx );
                 ctx.Ecx = 0x33334444;
                 pRtlWow64SetThreadContext( pi.hThread, &ctx );
                 memset( &ctx, 0x55, sizeof(ctx) );
                 ctx.ContextFlags = WOW64_CONTEXT_ALL;
                 pRtlWow64GetThreadContext( pi.hThread, &ctx );
-                ok( ctx.Ecx == 0x33334444, "cs64: ecx set to %08x\n", ctx.Ecx );
+                ok( ctx.Ecx == 0x33334444, "cs64: ecx set to %08lx\n", ctx.Ecx );
                 ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res );
-                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08x\n", ctx_ptr->Ecx );
+                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08lx\n", ctx_ptr->Ecx );
                 memset( &context, 0x55, sizeof(context) );
                 context.ContextFlags = CONTEXT_ALL;
                 pNtGetContextThread( pi.hThread, &context );
@@ -4453,16 +4454,16 @@ static void test_wow64_context(void)
         else
         {
             trace( "in 64-bit mode %04x\n", context.SegCs );
-            ok( ctx.Eip != context.Rip, "cs64: eip %08x / %p\n", ctx.Eip, (void *)context.Rip);
-            ok( ctx.SegCs == cs32, "cs64: wrong cs %04x / %04x\n", ctx.SegCs, cs32 );
-            ok( ctx.SegDs == context.SegDs, "cs64: wrong ds %04x / %04x\n", ctx.SegDs, context.SegDs );
-            ok( ctx.SegEs == context.SegEs, "cs64: wrong es %04x / %04x\n", ctx.SegEs, context.SegEs );
-            ok( ctx.SegFs == context.SegFs, "cs64: wrong fs %04x / %04x\n", ctx.SegFs, context.SegFs );
-            ok( ctx.SegGs == context.SegGs, "cs64: wrong gs %04x / %04x\n", ctx.SegGs, context.SegGs );
-            ok( ctx.SegSs == context.SegSs, "cs64: wrong ss %04x / %04x\n", ctx.SegSs, context.SegSs );
+            ok( ctx.Eip != context.Rip, "cs64: eip %08lx / %p\n", ctx.Eip, (void *)context.Rip);
+            ok( ctx.SegCs == cs32, "cs64: wrong cs %04lx / %04x\n", ctx.SegCs, cs32 );
+            ok( ctx.SegDs == context.SegDs, "cs64: wrong ds %04lx / %04x\n", ctx.SegDs, context.SegDs );
+            ok( ctx.SegEs == context.SegEs, "cs64: wrong es %04lx / %04x\n", ctx.SegEs, context.SegEs );
+            ok( ctx.SegFs == context.SegFs, "cs64: wrong fs %04lx / %04x\n", ctx.SegFs, context.SegFs );
+            ok( ctx.SegGs == context.SegGs, "cs64: wrong gs %04lx / %04x\n", ctx.SegGs, context.SegGs );
+            ok( ctx.SegSs == context.SegSs, "cs64: wrong ss %04lx / %04x\n", ctx.SegSs, context.SegSs );
             if (teb32.DeallocationStack)
                 ok( ctx.Esp >= teb32.DeallocationStack && ctx.Esp <= teb32.Tib.StackBase,
-                    "cs64: esp not inside 32-bit stack %08x / %08x-%08x\n", ctx.Esp,
+                    "cs64: esp not inside 32-bit stack %08lx / %08lx-%08lx\n", ctx.Esp,
                     teb32.DeallocationStack, teb32.Tib.StackBase );
             ok( ((void *)context.Rsp >= teb.DeallocationStack && (void *)context.Rsp <= teb.Tib.StackBase) ||
                 (context.Rsp >= teb32.DeallocationStack && context.Rsp <= teb32.Tib.StackBase),
@@ -4475,18 +4476,18 @@ static void test_wow64_context(void)
                 /* in 64-bit mode, the 32-bit context is stored in the cpu area */
                 if (!ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED],
                                         cpu, cpu_size, &res )) res = 0;
-                ok( res == cpu_size, "wrong len %lx\n", res );
+                ok( res == cpu_size, "wrong len %Ix\n", res );
                 ok(ctx_ptr->ContextFlags == WOW64_CONTEXT_ALL,
-                   "cs64: got context flags %#x\n", ctx_ptr->ContextFlags);
-                ok(ctx_ptr->Eip == ctx.Eip, "cs64: got eip %08x / %08x\n", ctx_ptr->Eip, ctx.Eip);
-                ok(ctx_ptr->Eax == ctx.Eax, "cs64: got eax %08x / %08x\n", ctx_ptr->Eax, ctx.Eax);
-                ok(ctx_ptr->Ebx == ctx.Ebx, "cs64: got ebx %08x / %08x\n", ctx_ptr->Ebx, ctx.Ebx);
-                ok(ctx_ptr->Ecx == ctx.Ecx, "cs64: got ecx %08x / %08x\n", ctx_ptr->Ecx, ctx.Ecx);
-                ok(ctx_ptr->Edx == ctx.Edx, "cs64: got edx %08x / %08x\n", ctx_ptr->Edx, ctx.Edx);
-                ok(ctx_ptr->Ebp == ctx.Ebp, "cs64: got ebp %08x / %08x\n", ctx_ptr->Ebp, ctx.Ebp);
-                ok(ctx_ptr->Esi == ctx.Esi, "cs64: got esi %08x / %08x\n", ctx_ptr->Esi, ctx.Esi);
-                ok(ctx_ptr->Edi == ctx.Edi, "cs64: got edi %08x / %08x\n", ctx_ptr->Edi, ctx.Edi);
-                ok(ctx_ptr->EFlags == ctx.EFlags, "cs64: got eflags %08x / %08x\n", ctx_ptr->EFlags, ctx.EFlags);
+                   "cs64: got context flags %#lx\n", ctx_ptr->ContextFlags);
+                ok(ctx_ptr->Eip == ctx.Eip, "cs64: got eip %08lx / %08lx\n", ctx_ptr->Eip, ctx.Eip);
+                ok(ctx_ptr->Eax == ctx.Eax, "cs64: got eax %08lx / %08lx\n", ctx_ptr->Eax, ctx.Eax);
+                ok(ctx_ptr->Ebx == ctx.Ebx, "cs64: got ebx %08lx / %08lx\n", ctx_ptr->Ebx, ctx.Ebx);
+                ok(ctx_ptr->Ecx == ctx.Ecx, "cs64: got ecx %08lx / %08lx\n", ctx_ptr->Ecx, ctx.Ecx);
+                ok(ctx_ptr->Edx == ctx.Edx, "cs64: got edx %08lx / %08lx\n", ctx_ptr->Edx, ctx.Edx);
+                ok(ctx_ptr->Ebp == ctx.Ebp, "cs64: got ebp %08lx / %08lx\n", ctx_ptr->Ebp, ctx.Ebp);
+                ok(ctx_ptr->Esi == ctx.Esi, "cs64: got esi %08lx / %08lx\n", ctx_ptr->Esi, ctx.Esi);
+                ok(ctx_ptr->Edi == ctx.Edi, "cs64: got edi %08lx / %08lx\n", ctx_ptr->Edi, ctx.Edi);
+                ok(ctx_ptr->EFlags == ctx.EFlags, "cs64: got eflags %08lx / %08lx\n", ctx_ptr->EFlags, ctx.EFlags);
 
                 /* changing one context doesn't change the other one */
                 rcx = context.Rcx;
@@ -4496,17 +4497,17 @@ static void test_wow64_context(void)
                 memset( &ctx, 0x55, sizeof(ctx) );
                 ctx.ContextFlags = WOW64_CONTEXT_ALL;
                 pRtlWow64GetThreadContext( pi.hThread, &ctx );
-                ok( ctx.Ecx == ecx, "cs64: ecx set to %08x\n", ctx.Ecx );
+                ok( ctx.Ecx == ecx, "cs64: ecx set to %08lx\n", ctx.Ecx );
                 ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res );
-                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08x\n", ctx_ptr->Ecx );
+                ok( ctx_ptr->Ecx == ecx, "cs64: ecx set to %08lx\n", ctx_ptr->Ecx );
                 ctx.Ecx = 0x22223333;
                 pRtlWow64SetThreadContext( pi.hThread, &ctx );
                 memset( &ctx, 0x55, sizeof(ctx) );
                 ctx.ContextFlags = WOW64_CONTEXT_ALL;
                 pRtlWow64GetThreadContext( pi.hThread, &ctx );
-                ok( ctx.Ecx == 0x22223333, "cs64: ecx set to %08x\n", ctx.Ecx );
+                ok( ctx.Ecx == 0x22223333, "cs64: ecx set to %08lx\n", ctx.Ecx );
                 ReadProcessMemory( pi.hProcess, teb.TlsSlots[WOW64_TLS_CPURESERVED], cpu, cpu_size, &res );
-                ok( ctx_ptr->Ecx == 0x22223333, "cs64: ecx set to %08x\n", ctx_ptr->Ecx );
+                ok( ctx_ptr->Ecx == 0x22223333, "cs64: ecx set to %08lx\n", ctx_ptr->Ecx );
                 memset( &context, 0x55, sizeof(context) );
                 context.ContextFlags = CONTEXT_ALL;
                 pNtGetContextThread( pi.hThread, &context );
@@ -4556,7 +4557,7 @@ static ULONG64 test_kiuserexceptiondispatcher_saved_r12;
 static DWORD dbg_except_continue_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
         CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher)
 {
-    trace("handler context->Rip %#lx, codemem %p.\n", context->Rip, code_mem);
+    trace("handler context->Rip %#Ix, codemem %p.\n", context->Rip, code_mem);
     got_exception = 1;
     dbg_except_continue_handler_rip = (void *)context->Rip;
     ++context->Rip;
@@ -4573,16 +4574,16 @@ static LONG WINAPI dbg_except_continue_vectored_handler(struct _EXCEPTION_POINTE
     EXCEPTION_RECORD *rec = e->ExceptionRecord;
     CONTEXT *context = e->ContextRecord;
 
-    trace("dbg_except_continue_vectored_handler, code %#x, Rip %#lx.\n", rec->ExceptionCode, context->Rip);
+    trace("dbg_except_continue_vectored_handler, code %#lx, Rip %#Ix.\n", rec->ExceptionCode, context->Rip);
 
     if (rec->ExceptionCode == 0xceadbeef)
     {
-        ok(context->P1Home == (ULONG64)0xdeadbeeffeedcafe, "Got unexpected context->P1Home %#lx.\n", context->P1Home);
+        ok(context->P1Home == (ULONG64)0xdeadbeeffeedcafe, "Got unexpected context->P1Home %#Ix.\n", context->P1Home);
         context->R12 = test_kiuserexceptiondispatcher_saved_r12;
         return EXCEPTION_CONTINUE_EXECUTION;
     }
 
-    ok(rec->ExceptionCode == 0x80000003, "Got unexpected exception code %#x.\n", rec->ExceptionCode);
+    ok(rec->ExceptionCode == 0x80000003, "Got unexpected exception code %#lx.\n", rec->ExceptionCode);
 
     got_exception = 1;
     dbg_except_continue_handler_rip = (void *)context->Rip;
@@ -4599,13 +4600,13 @@ static LONG WINAPI dbg_except_continue_vectored_handler(struct _EXCEPTION_POINTE
 static void WINAPI hook_KiUserExceptionDispatcher(EXCEPTION_RECORD *rec, CONTEXT *context)
 {
     trace("rec %p, context %p.\n", rec, context);
-    trace("context->Rip %#lx, context->Rsp %#lx, ContextFlags %#lx.\n",
+    trace("context->Rip %#Ix, context->Rsp %#Ix, ContextFlags %#lx.\n",
             context->Rip, context->Rsp, context->ContextFlags);
 
     hook_called = TRUE;
     /* Broken on Win2008, probably rec offset in stack is different. */
     ok(rec->ExceptionCode == 0x80000003 || rec->ExceptionCode == 0xceadbeef || broken(!rec->ExceptionCode),
-            "Got unexpected ExceptionCode %#x.\n", rec->ExceptionCode);
+            "Got unexpected ExceptionCode %#lx.\n", rec->ExceptionCode);
 
     hook_KiUserExceptionDispatcher_rip = (void *)context->Rip;
     hook_exception_address = rec->ExceptionAddress;
@@ -4691,7 +4692,7 @@ static void test_kiuserexceptiondispatcher(void)
 
     ret = VirtualProtect(pKiUserExceptionDispatcher, sizeof(saved_KiUserExceptionDispatcher_bytes),
             PAGE_EXECUTE_READWRITE, &old_protect);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
 
     memcpy(saved_KiUserExceptionDispatcher_bytes, pKiUserExceptionDispatcher,
             sizeof(saved_KiUserExceptionDispatcher_bytes));
@@ -4712,7 +4713,7 @@ static void test_kiuserexceptiondispatcher(void)
     ok(got_exception, "Handler was not called.\n");
     ok(hook_called, "Hook was not called.\n");
 
-    ok(test_kiuserexceptiondispatcher_regs.new_rax == 0xdeadbeef, "Got unexpected rax %#lx.\n",
+    ok(test_kiuserexceptiondispatcher_regs.new_rax == 0xdeadbeef, "Got unexpected rax %#Ix.\n",
             test_kiuserexceptiondispatcher_regs.new_rax);
     ok(test_kiuserexceptiondispatcher_regs.old_rsi
             == test_kiuserexceptiondispatcher_regs.new_rsi, "rsi does not match.\n");
@@ -4781,7 +4782,7 @@ static void test_kiuserexceptiondispatcher(void)
     ok(dbg_except_continue_handler_rip == bpt_address, "Got unexpected exception address %p, expected %p.\n",
             dbg_except_continue_handler_rip, bpt_address);
 
-    ok(test_kiuserexceptiondispatcher_regs.new_rax == 0xdeadbeef, "Got unexpected rax %#lx.\n",
+    ok(test_kiuserexceptiondispatcher_regs.new_rax == 0xdeadbeef, "Got unexpected rax %#Ix.\n",
             test_kiuserexceptiondispatcher_regs.new_rax);
     ok(test_kiuserexceptiondispatcher_regs.old_rsi
             == test_kiuserexceptiondispatcher_regs.new_rsi, "rsi does not match.\n");
@@ -4816,14 +4817,14 @@ static void test_kiuserexceptiondispatcher(void)
     }
     else
     {
-        ok(pass == 3, "Got unexpected pass %d.\n", pass);
+        ok(pass == 3, "Got unexpected pass %ld.\n", pass);
     }
     ok(hook_called, "Hook was not called.\n");
     RemoveVectoredExceptionHandler(vectored_handler);
 
     ret = VirtualProtect(pKiUserExceptionDispatcher, sizeof(saved_KiUserExceptionDispatcher_bytes),
             old_protect, &old_protect);
-    ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+    ok(ret, "Got unexpected ret %#x, GetLastError() %lu.\n", ret, GetLastError());
 }
 
 static BOOL got_nested_exception, got_prev_frame_exception;
@@ -4832,16 +4833,16 @@ static void *nested_exception_initial_frame;
 static DWORD nested_exception_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRATION_RECORD *frame,
         CONTEXT *context, EXCEPTION_REGISTRATION_RECORD **dispatcher)
 {
-    trace("nested_exception_handler Rip %p, Rsp %p, code %#x, flags %#x, ExceptionAddress %p.\n",
+    trace("nested_exception_handler Rip %p, Rsp %p, code %#lx, flags %#lx, ExceptionAddress %p.\n",
             (void *)context->Rip, (void *)context->Rsp, rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress);
 
     if (rec->ExceptionCode == 0x80000003
             && !(rec->ExceptionFlags & EH_NESTED_CALL))
     {
-        ok(rec->NumberParameters == 1, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters);
+        ok(rec->NumberParameters == 1, "Got unexpected rec->NumberParameters %lu.\n", rec->NumberParameters);
         ok((void *)context->Rsp == frame, "Got unexpected frame %p.\n", frame);
         ok(*(void **)frame == (char *)code_mem + 5, "Got unexpected *frame %p.\n", *(void **)frame);
-        ok(context->Rip == (ULONG_PTR)((char *)code_mem + 7), "Got unexpected Rip %#lx.\n", context->Rip);
+        ok(context->Rip == (ULONG_PTR)((char *)code_mem + 7), "Got unexpected Rip %#Ix.\n", context->Rip);
 
         nested_exception_initial_frame = frame;
         RaiseException(0xdeadbeef, 0, 0, 0);
@@ -4851,15 +4852,15 @@ static DWORD nested_exception_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGISTRAT
 
     if (rec->ExceptionCode == 0xdeadbeef && rec->ExceptionFlags == EH_NESTED_CALL)
     {
-        ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters);
+        ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %lu.\n", rec->NumberParameters);
         got_nested_exception = TRUE;
         ok(frame == nested_exception_initial_frame, "Got unexpected frame %p.\n", frame);
         return ExceptionContinueSearch;
     }
 
     ok(rec->ExceptionCode == 0xdeadbeef && !rec->ExceptionFlags,
-            "Got unexpected exception code %#x, flags %#x.\n", rec->ExceptionCode, rec->ExceptionFlags);
-    ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %u.\n", rec->NumberParameters);
+            "Got unexpected exception code %#lx, flags %#lx.\n", rec->ExceptionCode, rec->ExceptionFlags);
+    ok(!rec->NumberParameters, "Got unexpected rec->NumberParameters %lu.\n", rec->NumberParameters);
     ok(frame == (void *)((BYTE *)nested_exception_initial_frame + 8),
             "Got unexpected frame %p.\n", frame);
     got_prev_frame_exception = TRUE;
@@ -4918,7 +4919,7 @@ static void test_unwind_from_apc(void)
     {
         test_unwind_apc_called = FALSE;
         status = pNtQueueApcThread(GetCurrentThread(), test_unwind_apc, 0, 0, 0);
-        ok(!status, "Got unexpected status %#x.\n", status);
+        ok(!status, "Got unexpected status %#lx.\n", status);
         SleepEx(0, TRUE);
         ok(0, "Should not get here.\n");
     }
@@ -4927,11 +4928,11 @@ static void test_unwind_from_apc(void)
         ok(test_unwind_apc_called, "Test user APC was not called.\n");
         test_unwind_apc_called = FALSE;
         status = pNtQueueApcThread(GetCurrentThread(), test_unwind_apc, 0, 0, 0);
-        ok(!status, "Got unexpected status %#x.\n", status);
+        ok(!status, "Got unexpected status %#lx.\n", status);
         NtContinue(&test_unwind_apc_context, TRUE );
         ok(0, "Should not get here.\n");
     }
-    ok(pass == 4, "Got unexpected pass %d.\n", pass);
+    ok(pass == 4, "Got unexpected pass %ld.\n", pass);
     ok(test_unwind_apc_called, "Test user APC was not called.\n");
 }
 
@@ -4975,36 +4976,36 @@ static void test_syscall_clobbered_regs(void)
     func = code_mem;
     memset(&regs, 0, sizeof(regs));
     status = func((HANDLE)0xdeadbeef, NULL, &regs, pNtCancelTimer);
-    ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#lx.\n", status);
 
     /* After the syscall instruction rcx contains the address of the instruction next after syscall. */
     ok((BYTE *)regs.rcx > (BYTE *)pNtCancelTimer && (BYTE *)regs.rcx < (BYTE *)pNtCancelTimer + 0x20,
             "Got unexpected rcx %s, pNtCancelTimer %p.\n", wine_dbgstr_longlong(regs.rcx), pNtCancelTimer);
 
     status = func((HANDLE)0xdeadbeef, (BOOLEAN *)0xdeadbeef, &regs, pNtCancelTimer);
-    ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#lx.\n", status);
     ok((BYTE *)regs.rcx > (BYTE *)pNtCancelTimer && (BYTE *)regs.rcx < (BYTE *)pNtCancelTimer + 0x20,
             "Got unexpected rcx %s, pNtCancelTimer %p.\n", wine_dbgstr_longlong(regs.rcx), pNtCancelTimer);
 
     context.ContextFlags = CONTEXT_CONTROL;
     status = func(GetCurrentThread(), &context, &regs, pNtGetContextThread);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
     ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20,
             "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread);
 
     status = func(GetCurrentThread(), &context, &regs, pNtSetContextThread);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
     ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20,
             "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread);
 
     context.ContextFlags = CONTEXT_INTEGER;
     status = func(GetCurrentThread(), &context, &regs, pNtGetContextThread);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
     ok((BYTE *)regs.rcx > (BYTE *)pNtGetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtGetContextThread + 0x20,
             "Got unexpected rcx %s, pNtGetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtGetContextThread);
 
     status = func(GetCurrentThread(), &context, &regs, pNtSetContextThread);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
     ok((BYTE *)regs.rcx > (BYTE *)pNtSetContextThread && (BYTE *)regs.rcx < (BYTE *)pNtSetContextThread + 0x20,
             "Got unexpected rcx %s, pNtSetContextThread %p.\n", wine_dbgstr_longlong(regs.rcx), pNtSetContextThread);
 
@@ -7944,13 +7945,13 @@ static DWORD WINAPI register_check_thread(void *arg)
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
 
     status = pNtGetContextThread(GetCurrentThread(), &ctx);
-    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
-    ok(!ctx.Dr0, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr0);
-    ok(!ctx.Dr1, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr1);
-    ok(!ctx.Dr2, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr2);
-    ok(!ctx.Dr3, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr3);
-    ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6);
-    ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7);
+    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
+    ok(!ctx.Dr0, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr0);
+    ok(!ctx.Dr1, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr1);
+    ok(!ctx.Dr2, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr2);
+    ok(!ctx.Dr3, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr3);
+    ok(!ctx.Dr6, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr6);
+    ok(!ctx.Dr7, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr7);
 
     return 0;
 }
@@ -7983,19 +7984,19 @@ static void test_debug_registers(void)
         ctx.Dr7 = tests[i].dr7;
 
         status = pNtSetContextThread(GetCurrentThread(), &ctx);
-        ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %08x\n", status);
+        ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %08lx\n", status);
 
         memset(&ctx, 0, sizeof(ctx));
         ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
 
         status = pNtGetContextThread(GetCurrentThread(), &ctx);
-        ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08x\n", status);
-        ok(ctx.Dr0 == tests[i].dr0, "test %d: expected %lx, got %lx\n", i, tests[i].dr0, (DWORD_PTR)ctx.Dr0);
-        ok(ctx.Dr1 == tests[i].dr1, "test %d: expected %lx, got %lx\n", i, tests[i].dr1, (DWORD_PTR)ctx.Dr1);
-        ok(ctx.Dr2 == tests[i].dr2, "test %d: expected %lx, got %lx\n", i, tests[i].dr2, (DWORD_PTR)ctx.Dr2);
-        ok(ctx.Dr3 == tests[i].dr3, "test %d: expected %lx, got %lx\n", i, tests[i].dr3, (DWORD_PTR)ctx.Dr3);
-        ok((ctx.Dr6 &  0xf00f) == tests[i].dr6, "test %d: expected %lx, got %lx\n", i, tests[i].dr6, (DWORD_PTR)ctx.Dr6);
-        ok((ctx.Dr7 & ~0xdc00) == tests[i].dr7, "test %d: expected %lx, got %lx\n", i, tests[i].dr7, (DWORD_PTR)ctx.Dr7);
+        ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %08lx\n", status);
+        ok(ctx.Dr0 == tests[i].dr0, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr0, (DWORD_PTR)ctx.Dr0);
+        ok(ctx.Dr1 == tests[i].dr1, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr1, (DWORD_PTR)ctx.Dr1);
+        ok(ctx.Dr2 == tests[i].dr2, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr2, (DWORD_PTR)ctx.Dr2);
+        ok(ctx.Dr3 == tests[i].dr3, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr3, (DWORD_PTR)ctx.Dr3);
+        ok((ctx.Dr6 &  0xf00f) == tests[i].dr6, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr6, (DWORD_PTR)ctx.Dr6);
+        ok((ctx.Dr7 & ~0xdc00) == tests[i].dr7, "test %d: expected %Ix, got %Ix\n", i, tests[i].dr7, (DWORD_PTR)ctx.Dr7);
     }
 
     memset(&ctx, 0, sizeof(ctx));
@@ -8007,20 +8008,20 @@ static void test_debug_registers(void)
     ctx.Dr6 = 0xffffffff;
     ctx.Dr7 = 0x00000400;
     status = pNtSetContextThread(GetCurrentThread(), &ctx);
-    ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %x\n", status);
+    ok(status == STATUS_SUCCESS, "NtSetContextThread failed with %lx\n", status);
 
     thread = CreateThread(NULL, 0, register_check_thread, NULL, CREATE_SUSPENDED, NULL);
-    ok(thread != INVALID_HANDLE_VALUE, "CreateThread failed with %d\n", GetLastError());
+    ok(thread != INVALID_HANDLE_VALUE, "CreateThread failed with %ld\n", GetLastError());
 
     ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
     status = pNtGetContextThread(thread, &ctx);
-    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %x\n", status);
-    ok(!ctx.Dr0, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr0);
-    ok(!ctx.Dr1, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr1);
-    ok(!ctx.Dr2, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr2);
-    ok(!ctx.Dr3, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr3);
-    ok(!ctx.Dr6, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr6);
-    ok(!ctx.Dr7, "expected 0, got %lx\n", (DWORD_PTR)ctx.Dr7);
+    ok(status == STATUS_SUCCESS, "NtGetContextThread failed with %lx\n", status);
+    ok(!ctx.Dr0, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr0);
+    ok(!ctx.Dr1, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr1);
+    ok(!ctx.Dr2, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr2);
+    ok(!ctx.Dr3, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr3);
+    ok(!ctx.Dr6, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr6);
+    ok(!ctx.Dr7, "expected 0, got %Ix\n", (DWORD_PTR)ctx.Dr7);
 
     ResumeThread(thread);
     WaitForSingleObject(thread, 10000);
@@ -8069,11 +8070,11 @@ static void test_debug_registers_wow64(void)
         ok(bret, "GetThreadContext failed\n");
         if (bret)
         {
-            ok(ctx.Dr0 == 0x12340000, "expected 0x12340000, got %lx\n", ctx.Dr0);
-            ok(ctx.Dr1 == 0x12340001, "expected 0x12340001, got %lx\n", ctx.Dr1);
-            ok(ctx.Dr2 == 0x12340002, "expected 0x12340002, got %lx\n", ctx.Dr2);
-            ok(ctx.Dr3 == 0x12340003, "expected 0x12340003, got %lx\n", ctx.Dr3);
-            ok(ctx.Dr7 == 0x155, "expected 0x155, got %lx\n", ctx.Dr7);
+            ok(ctx.Dr0 == 0x12340000, "expected 0x12340000, got %Ix\n", ctx.Dr0);
+            ok(ctx.Dr1 == 0x12340001, "expected 0x12340001, got %Ix\n", ctx.Dr1);
+            ok(ctx.Dr2 == 0x12340002, "expected 0x12340002, got %Ix\n", ctx.Dr2);
+            ok(ctx.Dr3 == 0x12340003, "expected 0x12340003, got %Ix\n", ctx.Dr3);
+            ok(ctx.Dr7 == 0x155, "expected 0x155, got %Ix\n", ctx.Dr7);
         }
 
         ZeroMemory(&wow64_ctx, sizeof(wow64_ctx));
@@ -8117,11 +8118,11 @@ static void test_debug_registers_wow64(void)
     ok(bret, "GetThreadContext failed\n");
     if (bret)
     {
-        ok(ctx.Dr0 == 0x56780000, "expected 0x56780000, got %lx\n", ctx.Dr0);
-        ok(ctx.Dr1 == 0x56780001, "expected 0x56780001, got %lx\n", ctx.Dr1);
-        ok(ctx.Dr2 == 0x56780002, "expected 0x56780002, got %lx\n", ctx.Dr2);
-        ok(ctx.Dr3 == 0x56780003, "expected 0x56780003, got %lx\n", ctx.Dr3);
-        ok(ctx.Dr7 == 0x101, "expected 0x101, got %lx\n", ctx.Dr7);
+        ok(ctx.Dr0 == 0x56780000, "expected 0x56780000, got %Ix\n", ctx.Dr0);
+        ok(ctx.Dr1 == 0x56780001, "expected 0x56780001, got %Ix\n", ctx.Dr1);
+        ok(ctx.Dr2 == 0x56780002, "expected 0x56780002, got %Ix\n", ctx.Dr2);
+        ok(ctx.Dr3 == 0x56780003, "expected 0x56780003, got %Ix\n", ctx.Dr3);
+        ok(ctx.Dr7 == 0x101, "expected 0x101, got %Ix\n", ctx.Dr7);
     }
 
     ResumeThread(pi.hThread);
@@ -8137,18 +8138,18 @@ static DWORD debug_service_exceptions;
 static LONG CALLBACK debug_service_handler(EXCEPTION_POINTERS *ExceptionInfo)
 {
     EXCEPTION_RECORD *rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode is %08lx instead of %08lx\n",
        rec->ExceptionCode, EXCEPTION_BREAKPOINT);
 
 #ifdef __i386__
     ok(ExceptionInfo->ContextRecord->Eip == (DWORD)code_mem + 0x1c,
-       "expected Eip = %x, got %x\n", (DWORD)code_mem + 0x1c, ExceptionInfo->ContextRecord->Eip);
+       "expected Eip = %lx, got %lx\n", (DWORD)code_mem + 0x1c, ExceptionInfo->ContextRecord->Eip);
     ok(rec->NumberParameters == (is_wow64 ? 1 : 3),
-       "ExceptionParameters is %d instead of %d\n", rec->NumberParameters, is_wow64 ? 1 : 3);
+       "ExceptionParameters is %ld instead of %d\n", rec->NumberParameters, is_wow64 ? 1 : 3);
     ok(rec->ExceptionInformation[0] == ExceptionInfo->ContextRecord->Eax,
-       "expected ExceptionInformation[0] = %x, got %lx\n",
+       "expected ExceptionInformation[0] = %lx, got %lx\n",
        ExceptionInfo->ContextRecord->Eax, rec->ExceptionInformation[0]);
     if (!is_wow64)
     {
@@ -8159,11 +8160,11 @@ static LONG CALLBACK debug_service_handler(EXCEPTION_POINTERS *ExceptionInfo)
     }
 #else
     ok(ExceptionInfo->ContextRecord->Rip == (DWORD_PTR)code_mem + 0x2f,
-       "expected Rip = %lx, got %lx\n", (DWORD_PTR)code_mem + 0x2f, ExceptionInfo->ContextRecord->Rip);
+       "expected Rip = %Ix, got %Ix\n", (DWORD_PTR)code_mem + 0x2f, ExceptionInfo->ContextRecord->Rip);
     ok(rec->NumberParameters == 1,
-       "ExceptionParameters is %d instead of 1\n", rec->NumberParameters);
+       "ExceptionParameters is %ld instead of 1\n", rec->NumberParameters);
     ok(rec->ExceptionInformation[0] == ExceptionInfo->ContextRecord->Rax,
-       "expected ExceptionInformation[0] = %lx, got %lx\n",
+       "expected ExceptionInformation[0] = %Ix, got %Ix\n",
        ExceptionInfo->ContextRecord->Rax, rec->ExceptionInformation[0]);
 #endif
 
@@ -8242,28 +8243,28 @@ static void test_debug_service(DWORD numexc)
     debug_service_exceptions = 0;
     ret = func(0);
     ok(debug_service_exceptions == expected_exc,
-       "BREAKPOINT_BREAK generated %u exceptions, expected %u\n",
+       "BREAKPOINT_BREAK generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-       "BREAKPOINT_BREAK returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_BREAK returned %lu, expected %lu\n", ret, expected_ret);
 
     /* BREAKPOINT_PROMPT */
     debug_service_exceptions = 0;
     ret = func(2);
     ok(debug_service_exceptions == expected_exc,
-       "BREAKPOINT_PROMPT generated %u exceptions, expected %u\n",
+       "BREAKPOINT_PROMPT generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-       "BREAKPOINT_PROMPT returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_PROMPT returned %lu, expected %lu\n", ret, expected_ret);
 
     /* invalid debug service */
     debug_service_exceptions = 0;
     ret = func(6);
     ok(debug_service_exceptions == expected_exc,
-       "invalid debug service generated %u exceptions, expected %u\n",
+       "invalid debug service generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-      "invalid debug service returned %u, expected %u\n", ret, expected_ret);
+      "invalid debug service returned %lu, expected %lu\n", ret, expected_ret);
 
     expected_exc = (is_wow64 ? numexc : 0);
     expected_ret = (is_wow64 && numexc);
@@ -8272,37 +8273,37 @@ static void test_debug_service(DWORD numexc)
     debug_service_exceptions = 0;
     ret = func(1);
     ok(debug_service_exceptions == expected_exc,
-       "BREAKPOINT_PRINT generated %u exceptions, expected %u\n",
+       "BREAKPOINT_PRINT generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-       "BREAKPOINT_PRINT returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_PRINT returned %lu, expected %lu\n", ret, expected_ret);
 
     /* BREAKPOINT_LOAD_SYMBOLS */
     debug_service_exceptions = 0;
     ret = func(3);
     ok(debug_service_exceptions == expected_exc,
-       "BREAKPOINT_LOAD_SYMBOLS generated %u exceptions, expected %u\n",
+       "BREAKPOINT_LOAD_SYMBOLS generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-       "BREAKPOINT_LOAD_SYMBOLS returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_LOAD_SYMBOLS returned %lu, expected %lu\n", ret, expected_ret);
 
     /* BREAKPOINT_UNLOAD_SYMBOLS */
     debug_service_exceptions = 0;
     ret = func(4);
     ok(debug_service_exceptions == expected_exc,
-       "BREAKPOINT_UNLOAD_SYMBOLS generated %u exceptions, expected %u\n",
+       "BREAKPOINT_UNLOAD_SYMBOLS generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret,
-       "BREAKPOINT_UNLOAD_SYMBOLS returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_UNLOAD_SYMBOLS returned %lu, expected %lu\n", ret, expected_ret);
 
     /* BREAKPOINT_COMMAND_STRING */
     debug_service_exceptions = 0;
     ret = func(5);
     ok(debug_service_exceptions == expected_exc || broken(debug_service_exceptions == numexc),
-       "BREAKPOINT_COMMAND_STRING generated %u exceptions, expected %u\n",
+       "BREAKPOINT_COMMAND_STRING generated %lu exceptions, expected %lu\n",
        debug_service_exceptions, expected_exc);
     ok(ret == expected_ret || broken(ret == (numexc != 0)),
-       "BREAKPOINT_COMMAND_STRING returned %u, expected %u\n", ret, expected_ret);
+       "BREAKPOINT_COMMAND_STRING returned %lu, expected %lu\n", ret, expected_ret);
 
     pRtlRemoveVectoredExceptionHandler(vectored_handler);
 }
@@ -8313,12 +8314,12 @@ static DWORD outputdebugstring_exceptions;
 static LONG CALLBACK outputdebugstring_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
 {
     PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == DBG_PRINTEXCEPTION_C, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == DBG_PRINTEXCEPTION_C, "ExceptionCode is %08lx instead of %08lx\n",
         rec->ExceptionCode, DBG_PRINTEXCEPTION_C);
-    ok(rec->NumberParameters == 2, "ExceptionParameters is %d instead of 2\n", rec->NumberParameters);
-    ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %d instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
+    ok(rec->NumberParameters == 2, "ExceptionParameters is %ld instead of 2\n", rec->NumberParameters);
+    ok(rec->ExceptionInformation[0] == 12, "ExceptionInformation[0] = %ld instead of 12\n", (DWORD)rec->ExceptionInformation[0]);
     ok(!strcmp((char *)rec->ExceptionInformation[1], "Hello World"),
         "ExceptionInformation[1] = '%s' instead of 'Hello World'\n", (char *)rec->ExceptionInformation[1]);
 
@@ -8343,7 +8344,7 @@ static void test_outputdebugstring(DWORD numexc, BOOL todo)
     OutputDebugStringA("Hello World");
 
     todo_wine_if(todo)
-    ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %d exceptions, expected %d\n",
+    ok(outputdebugstring_exceptions == numexc, "OutputDebugStringA generated %ld exceptions, expected %ld\n",
        outputdebugstring_exceptions, numexc);
 
     pRtlRemoveVectoredExceptionHandler(vectored_handler);
@@ -8354,14 +8355,14 @@ static DWORD ripevent_exceptions;
 static LONG CALLBACK ripevent_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
 {
     PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == DBG_RIPEXCEPTION, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == DBG_RIPEXCEPTION, "ExceptionCode is %08lx instead of %08lx\n",
        rec->ExceptionCode, DBG_RIPEXCEPTION);
-    ok(rec->NumberParameters == 2, "ExceptionParameters is %d instead of 2\n", rec->NumberParameters);
-    ok(rec->ExceptionInformation[0] == 0x11223344, "ExceptionInformation[0] = %08x instead of %08x\n",
+    ok(rec->NumberParameters == 2, "ExceptionParameters is %ld instead of 2\n", rec->NumberParameters);
+    ok(rec->ExceptionInformation[0] == 0x11223344, "ExceptionInformation[0] = %08lx instead of %08x\n",
        (NTSTATUS)rec->ExceptionInformation[0], 0x11223344);
-    ok(rec->ExceptionInformation[1] == 0x55667788, "ExceptionInformation[1] = %08x instead of %08x\n",
+    ok(rec->ExceptionInformation[1] == 0x55667788, "ExceptionInformation[1] = %08lx instead of %08x\n",
        (NTSTATUS)rec->ExceptionInformation[1], 0x55667788);
 
     ripevent_exceptions++;
@@ -8392,7 +8393,7 @@ static void test_ripevent(DWORD numexc)
 
     ripevent_exceptions = 0;
     pRtlRaiseException(&record);
-    ok(ripevent_exceptions == numexc, "RtlRaiseException generated %d exceptions, expected %d\n",
+    ok(ripevent_exceptions == numexc, "RtlRaiseException generated %ld exceptions, expected %ld\n",
        ripevent_exceptions, numexc);
 
     pRtlRemoveVectoredExceptionHandler(vectored_handler);
@@ -8403,26 +8404,26 @@ static DWORD breakpoint_exceptions;
 static LONG CALLBACK breakpoint_handler(EXCEPTION_POINTERS *ExceptionInfo)
 {
     EXCEPTION_RECORD *rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == EXCEPTION_BREAKPOINT, "ExceptionCode is %08lx instead of %08lx\n",
        rec->ExceptionCode, EXCEPTION_BREAKPOINT);
 
 #ifdef __i386__
     ok(ExceptionInfo->ContextRecord->Eip == (DWORD)code_mem + 1,
-       "expected Eip = %x, got %x\n", (DWORD)code_mem + 1, ExceptionInfo->ContextRecord->Eip);
+       "expected Eip = %lx, got %lx\n", (DWORD)code_mem + 1, ExceptionInfo->ContextRecord->Eip);
     ok(rec->NumberParameters == (is_wow64 ? 1 : 3),
-       "ExceptionParameters is %d instead of %d\n", rec->NumberParameters, is_wow64 ? 1 : 3);
+       "ExceptionParameters is %ld instead of %d\n", rec->NumberParameters, is_wow64 ? 1 : 3);
     ok(rec->ExceptionInformation[0] == 0,
        "got ExceptionInformation[0] = %lx\n", rec->ExceptionInformation[0]);
     ExceptionInfo->ContextRecord->Eip = (DWORD)code_mem + 2;
 #elif defined(__x86_64__)
     ok(ExceptionInfo->ContextRecord->Rip == (DWORD_PTR)code_mem + 1,
-       "expected Rip = %lx, got %lx\n", (DWORD_PTR)code_mem + 1, ExceptionInfo->ContextRecord->Rip);
+       "expected Rip = %Ix, got %Ix\n", (DWORD_PTR)code_mem + 1, ExceptionInfo->ContextRecord->Rip);
     ok(rec->NumberParameters == 1,
-       "ExceptionParameters is %d instead of 1\n", rec->NumberParameters);
+       "ExceptionParameters is %ld instead of 1\n", rec->NumberParameters);
     ok(rec->ExceptionInformation[0] == 0,
-       "got ExceptionInformation[0] = %lx\n", rec->ExceptionInformation[0]);
+       "got ExceptionInformation[0] = %Ix\n", rec->ExceptionInformation[0]);
     ExceptionInfo->ContextRecord->Rip = (DWORD_PTR)code_mem + 2;
 #elif defined(__arm__)
     ok(ExceptionInfo->ContextRecord->Pc == (DWORD)code_mem + 1,
@@ -8468,7 +8469,7 @@ static void test_breakpoint(DWORD numexc)
 
     breakpoint_exceptions = 0;
     func();
-    ok(breakpoint_exceptions == numexc, "int $0x3 generated %u exceptions, expected %u\n",
+    ok(breakpoint_exceptions == numexc, "int $0x3 generated %lu exceptions, expected %lu\n",
        breakpoint_exceptions, numexc);
 
     pRtlRemoveVectoredExceptionHandler(vectored_handler);
@@ -8565,11 +8566,11 @@ static DWORD invalid_handle_exceptions;
 static LONG CALLBACK invalid_handle_vectored_handler(EXCEPTION_POINTERS *ExceptionInfo)
 {
     PEXCEPTION_RECORD rec = ExceptionInfo->ExceptionRecord;
-    trace("vect. handler %08x addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
+    trace("vect. handler %08lx addr:%p\n", rec->ExceptionCode, rec->ExceptionAddress);
 
-    ok(rec->ExceptionCode == EXCEPTION_INVALID_HANDLE, "ExceptionCode is %08x instead of %08x\n",
+    ok(rec->ExceptionCode == EXCEPTION_INVALID_HANDLE, "ExceptionCode is %08lx instead of %08lx\n",
        rec->ExceptionCode, EXCEPTION_INVALID_HANDLE);
-    ok(rec->NumberParameters == 0, "ExceptionParameters is %d instead of 0\n", rec->NumberParameters);
+    ok(rec->NumberParameters == 0, "ExceptionParameters is %ld instead of 0\n", rec->NumberParameters);
 
     invalid_handle_exceptions++;
     return (rec->ExceptionCode == EXCEPTION_INVALID_HANDLE) ? EXCEPTION_CONTINUE_EXECUTION : EXCEPTION_CONTINUE_SEARCH;
@@ -8590,12 +8591,12 @@ static void test_closehandle(DWORD numexc, HANDLE handle)
 
     invalid_handle_exceptions = 0;
     CloseHandle(handle);
-    ok(invalid_handle_exceptions == numexc, "CloseHandle generated %d exceptions, expected %d\n",
+    ok(invalid_handle_exceptions == numexc, "CloseHandle generated %ld exceptions, expected %ld\n",
        invalid_handle_exceptions, numexc);
 
     invalid_handle_exceptions = 0;
     pNtClose(handle);
-    ok(invalid_handle_exceptions == numexc, "NtClose generated %d exceptions, expected %d\n",
+    ok(invalid_handle_exceptions == numexc, "NtClose generated %ld exceptions, expected %ld\n",
        invalid_handle_exceptions, numexc);
 
     pRtlRemoveVectoredExceptionHandler(vectored_handler);
@@ -8671,26 +8672,26 @@ static void test_user_apc(void)
 
         test_apc_called = FALSE;
         status = pNtQueueApcThread(GetCurrentThread(), test_apc, 0, 0, 0);
-        ok(!status, "Got unexpected status %#x.\n", status);
+        ok(!status, "Got unexpected status %#lx.\n", status);
         SleepEx(0, TRUE);
         ok(test_apc_called, "Test user APC was not called.\n");
         test_apc_called = FALSE;
         status = pNtQueueApcThread(GetCurrentThread(), test_apc, 0, 0, 0);
-        ok(!status, "Got unexpected status %#x.\n", status);
+        ok(!status, "Got unexpected status %#lx.\n", status);
         status = NtContinue(&c[0], TRUE );
 
         /* Broken before Win7, in that case NtContinue returns here instead of restoring context after calling APC. */
-        ok(broken(TRUE), "Should not get here, status %#x.\n", status);
+        ok(broken(TRUE), "Should not get here, status %#lx.\n", status);
         return;
     }
-    ok(pass == 3, "Got unexpected pass %d.\n", pass);
+    ok(pass == 3, "Got unexpected pass %ld.\n", pass);
     ok(test_apc_called, "Test user APC was not called.\n");
 }
 
 static void test_user_callback(void)
 {
     NTSTATUS status = pNtCallbackReturn( NULL, 0, STATUS_SUCCESS );
-    ok( status == STATUS_NO_CALLBACK_ACTIVE, "failed %x\n", status );
+    ok( status == STATUS_NO_CALLBACK_ACTIVE, "failed %lx\n", status );
 }
 
 static DWORD WINAPI suspend_thread_test( void *arg )
@@ -8718,8 +8719,8 @@ static void test_suspend_count(HANDLE hthread, ULONG expected_count, int line)
         return;
     }
 
-    ok_(__FILE__, line)(!status, "Failed to get suspend count, status %#x.\n", status);
-    ok_(__FILE__, line)(count == expected_count, "Unexpected suspend count %u.\n", count);
+    ok_(__FILE__, line)(!status, "Failed to get suspend count, status %#lx.\n", status);
+    ok_(__FILE__, line)(count == expected_count, "Unexpected suspend count %lu.\n", count);
 }
 
 static void test_suspend_thread(void)
@@ -8731,10 +8732,10 @@ static void test_suspend_thread(void)
     DWORD ret;
 
     status = NtSuspendThread(0, NULL);
-    ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#x.\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#lx.\n", status);
 
     status = NtResumeThread(0, NULL);
-    ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#x.\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "Unexpected return value %#lx.\n", status);
 
     event = CreateEventW(NULL, FALSE, FALSE, NULL);
 
@@ -8742,61 +8743,61 @@ static void test_suspend_thread(void)
     ok(thread != NULL, "Failed to create a thread.\n");
 
     ret = WaitForSingleObject(thread, 0);
-    ok(ret == WAIT_TIMEOUT, "Unexpected status %d.\n", ret);
+    ok(ret == WAIT_TIMEOUT, "Unexpected status %ld.\n", ret);
 
     status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count), NULL);
     if (!status)
     {
         status = pNtQueryInformationThread(thread, ThreadSuspendCount, NULL, sizeof(count), NULL);
-        ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#x.\n", status);
+        ok(status == STATUS_ACCESS_VIOLATION, "Unexpected status %#lx.\n", status);
 
         status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count) / 2, NULL);
-        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#x.\n", status);
+        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
 
         len = 123;
         status = pNtQueryInformationThread(thread, ThreadSuspendCount, &count, sizeof(count) / 2, &len);
-        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#x.\n", status);
-        ok(len == 123, "Unexpected info length %u.\n", len);
+        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
+        ok(len == 123, "Unexpected info length %lu.\n", len);
 
         len = 123;
         status = pNtQueryInformationThread(thread, ThreadSuspendCount, NULL, 0, &len);
-        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#x.\n", status);
-        ok(len == 123, "Unexpected info length %u.\n", len);
+        ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
+        ok(len == 123, "Unexpected info length %lu.\n", len);
 
         count = 10;
         status = pNtQueryInformationThread(0, ThreadSuspendCount, &count, sizeof(count), NULL);
-        ok(status, "Unexpected status %#x.\n", status);
-        ok(count == 10, "Unexpected suspend count %u.\n", count);
+        ok(status, "Unexpected status %#lx.\n", status);
+        ok(count == 10, "Unexpected suspend count %lu.\n", count);
     }
 
     status = NtResumeThread(thread, NULL);
-    ok(!status, "Unexpected status %#x.\n", status);
+    ok(!status, "Unexpected status %#lx.\n", status);
 
     status = NtResumeThread(thread, &count);
-    ok(!status, "Unexpected status %#x.\n", status);
-    ok(count == 0, "Unexpected suspended count %u.\n", count);
+    ok(!status, "Unexpected status %#lx.\n", status);
+    ok(count == 0, "Unexpected suspended count %lu.\n", count);
 
     TEST_SUSPEND_COUNT(thread, 0);
 
     status = NtSuspendThread(thread, NULL);
-    ok(!status, "Failed to suspend a thread, status %#x.\n", status);
+    ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
 
     TEST_SUSPEND_COUNT(thread, 1);
 
     status = NtSuspendThread(thread, &count);
-    ok(!status, "Failed to suspend a thread, status %#x.\n", status);
-    ok(count == 1, "Unexpected suspended count %u.\n", count);
+    ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
+    ok(count == 1, "Unexpected suspended count %lu.\n", count);
 
     TEST_SUSPEND_COUNT(thread, 2);
 
     status = NtResumeThread(thread, &count);
-    ok(!status, "Failed to resume a thread, status %#x.\n", status);
-    ok(count == 2, "Unexpected suspended count %u.\n", count);
+    ok(!status, "Failed to resume a thread, status %#lx.\n", status);
+    ok(count == 2, "Unexpected suspended count %lu.\n", count);
 
     TEST_SUSPEND_COUNT(thread, 1);
 
     status = NtResumeThread(thread, NULL);
-    ok(!status, "Failed to resume a thread, status %#x.\n", status);
+    ok(!status, "Failed to resume a thread, status %#lx.\n", status);
 
     TEST_SUSPEND_COUNT(thread, 0);
 
@@ -8832,7 +8833,7 @@ static void suspend_process_proc(void)
     /* Suspend up to limit. */
     while (!(status = NtSuspendThread(thread, NULL)))
         ;
-    ok(status == STATUS_SUSPEND_COUNT_EXCEEDED, "Unexpected status %#x.\n", status);
+    ok(status == STATUS_SUSPEND_COUNT_EXCEEDED, "Unexpected status %#lx.\n", status);
 
     for (;;)
     {
@@ -8842,11 +8843,11 @@ static void suspend_process_proc(void)
     }
 
     status = NtSuspendThread(thread, &count);
-    ok(!status, "Failed to suspend a thread, status %#x.\n", status);
-    ok(count == 125, "Unexpected suspend count %u.\n", count);
+    ok(!status, "Failed to suspend a thread, status %#lx.\n", status);
+    ok(count == 125, "Unexpected suspend count %lu.\n", count);
 
     status = NtResumeThread(thread, NULL);
-    ok(!status, "Failed to resume a thread, status %#x.\n", status);
+    ok(!status, "Failed to resume a thread, status %#lx.\n", status);
 
     CloseHandle(event);
     CloseHandle(event2);
@@ -8879,50 +8880,50 @@ static void test_suspend_process(void)
     /* New process signals this event. */
     ResetEvent(event2);
     ret = WaitForSingleObject(event2, INFINITE);
-    ok(ret == WAIT_OBJECT_0, "Wait failed, %#x.\n", ret);
+    ok(ret == WAIT_OBJECT_0, "Wait failed, %#lx.\n", ret);
 
     /* Suspend main thread */
     status = NtSuspendThread(info.hThread, &ret);
-    ok(!status && !ret, "Failed to suspend main thread, status %#x.\n", status);
+    ok(!status && !ret, "Failed to suspend main thread, status %#lx.\n", status);
 
     /* Process wasn't suspended yet. */
     status = pNtResumeProcess(info.hProcess);
-    ok(!status, "Failed to resume a process, status %#x.\n", status);
+    ok(!status, "Failed to resume a process, status %#lx.\n", status);
 
     status = pNtSuspendProcess(0);
-    ok(status == STATUS_INVALID_HANDLE, "Unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "Unexpected status %#lx.\n", status);
 
     status = pNtResumeProcess(info.hProcess);
-    ok(!status, "Failed to resume a process, status %#x.\n", status);
+    ok(!status, "Failed to resume a process, status %#lx.\n", status);
 
     ResetEvent(event2);
     ret = WaitForSingleObject(event2, 200);
     ok(ret == WAIT_OBJECT_0, "Wait failed.\n");
 
     status = pNtSuspendProcess(info.hProcess);
-    ok(!status, "Failed to suspend a process, status %#x.\n", status);
+    ok(!status, "Failed to suspend a process, status %#lx.\n", status);
 
     status = NtSuspendThread(info.hThread, &ret);
-    ok(!status && ret == 1, "Failed to suspend main thread, status %#x.\n", status);
+    ok(!status && ret == 1, "Failed to suspend main thread, status %#lx.\n", status);
     status = NtResumeThread(info.hThread, &ret);
-    ok(!status && ret == 2, "Failed to resume main thread, status %#x.\n", status);
+    ok(!status && ret == 2, "Failed to resume main thread, status %#lx.\n", status);
 
     ResetEvent(event2);
     ret = WaitForSingleObject(event2, 200);
     ok(ret == WAIT_TIMEOUT, "Wait failed.\n");
 
     status = pNtSuspendProcess(info.hProcess);
-    ok(!status, "Failed to suspend a process, status %#x.\n", status);
+    ok(!status, "Failed to suspend a process, status %#lx.\n", status);
 
     status = pNtResumeProcess(info.hProcess);
-    ok(!status, "Failed to resume a process, status %#x.\n", status);
+    ok(!status, "Failed to resume a process, status %#lx.\n", status);
 
     ResetEvent(event2);
     ret = WaitForSingleObject(event2, 200);
     ok(ret == WAIT_TIMEOUT, "Wait failed.\n");
 
     status = pNtResumeProcess(info.hProcess);
-    ok(!status, "Failed to resume a process, status %#x.\n", status);
+    ok(!status, "Failed to resume a process, status %#lx.\n", status);
 
     ResetEvent(event2);
     ret = WaitForSingleObject(event2, 1000);
@@ -8954,7 +8955,7 @@ static void test_unload_trace(void)
     {
         pRtlGetUnloadEventTraceEx(&element_size, &element_count, (void **)&unload_trace_ex);
         ok(*element_size >= sizeof(*ptr), "Unexpected element size.\n");
-        ok(*element_count == RTL_UNLOAD_EVENT_TRACE_NUMBER, "Unexpected trace element count %u.\n", *element_count);
+        ok(*element_count == RTL_UNLOAD_EVENT_TRACE_NUMBER, "Unexpected trace element count %lu.\n", *element_count);
         ok(unload_trace_ex != NULL, "Unexpected pointer %p.\n", unload_trace_ex);
         size = *element_size;
     }
@@ -9014,7 +9015,7 @@ static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGI
     XSTATE *xs;
 
     ok((context->ContextFlags & (CONTEXT_FULL | CONTEXT_XSTATE)) == (CONTEXT_FULL | CONTEXT_XSTATE),
-            "Got unexpected ContextFlags %#x.\n", context->ContextFlags);
+            "Got unexpected ContextFlags %#lx.\n", context->ContextFlags);
 
     if ((context->ContextFlags & (CONTEXT_FULL | CONTEXT_XSTATE)) != (CONTEXT_FULL | CONTEXT_XSTATE))
         goto done;
@@ -9024,20 +9025,20 @@ static DWORD test_extended_context_handler(EXCEPTION_RECORD *rec, EXCEPTION_REGI
         /* Unwind contexts do not inherit xstate information. */
         DISPATCHER_CONTEXT *dispatch = (DISPATCHER_CONTEXT *)dispatcher;
 
-        ok(!(dispatch->ContextRecord->ContextFlags & 0x40), "Got unexpected ContextRecord->ContextFlags %#x.\n",
+        ok(!(dispatch->ContextRecord->ContextFlags & 0x40), "Got unexpected ContextRecord->ContextFlags %#lx.\n",
                 dispatch->ContextRecord->ContextFlags);
     }
 #endif
 
-    ok(xctx->Legacy.Offset == -(int)(sizeof(CONTEXT)), "Got unexpected Legacy.Offset %d.\n", xctx->Legacy.Offset);
-    ok(xctx->Legacy.Length == sizeof(CONTEXT), "Got unexpected Legacy.Length %d.\n", xctx->Legacy.Length);
-    ok(xctx->All.Offset == -(int)sizeof(CONTEXT), "Got unexpected All.Offset %d.\n", xctx->All.Offset);
+    ok(xctx->Legacy.Offset == -(int)(sizeof(CONTEXT)), "Got unexpected Legacy.Offset %ld.\n", xctx->Legacy.Offset);
+    ok(xctx->Legacy.Length == sizeof(CONTEXT), "Got unexpected Legacy.Length %ld.\n", xctx->Legacy.Length);
+    ok(xctx->All.Offset == -(int)sizeof(CONTEXT), "Got unexpected All.Offset %ld.\n", xctx->All.Offset);
     ok(xctx->All.Length == sizeof(CONTEXT) + xctx->XState.Offset + xctx->XState.Length,
-            "Got unexpected All.Offset %d.\n", xctx->All.Offset);
+            "Got unexpected All.Offset %ld.\n", xctx->All.Offset);
     expected_min_offset = sizeof(void *) == 8 ? sizeof(CONTEXT_EX) + sizeof(EXCEPTION_RECORD) : sizeof(CONTEXT_EX);
     ok(xctx->XState.Offset >= expected_min_offset,
-            "Got unexpected XState.Offset %d.\n", xctx->XState.Offset);
-    ok(xctx->XState.Length >= sizeof(XSTATE), "Got unexpected XState.Length %d.\n", xctx->XState.Length);
+            "Got unexpected XState.Offset %ld.\n", xctx->XState.Offset);
+    ok(xctx->XState.Length >= sizeof(XSTATE), "Got unexpected XState.Length %ld.\n", xctx->XState.Length);
 
     xs = (XSTATE *)((char *)xctx + xctx->XState.Offset);
     context_ymm_data = (unsigned int *)&xs->YmmContext;
@@ -9233,7 +9234,7 @@ static void wait_for_thread_next_suspend(HANDLE thread)
     DWORD result;
 
     result = ResumeThread(thread);
-    ok(result == 1, "Got unexpexted suspend count %u.\n", result);
+    ok(result == 1, "Got unexpexted suspend count %lu.\n", result);
 
     /* NtQueryInformationThread(ThreadSuspendCount, ...) is not supported on older Windows. */
     while (!(result = SuspendThread(thread)))
@@ -9241,9 +9242,9 @@ static void wait_for_thread_next_suspend(HANDLE thread)
         ResumeThread(thread);
         Sleep(1);
     }
-    ok(result == 1, "Got unexpexted suspend count %u.\n", result);
+    ok(result == 1, "Got unexpexted suspend count %lu.\n", result);
     result = ResumeThread(thread);
-    ok(result == 2, "Got unexpexted suspend count %u.\n", result);
+    ok(result == 2, "Got unexpexted suspend count %lu.\n", result);
 }
 
 #define CONTEXT_NATIVE (CONTEXT_XSTATE & CONTEXT_CONTROL)
@@ -9350,7 +9351,7 @@ static void test_extended_context(void)
     /* Test context manipulation functions. */
     length = 0xdeadbeef;
     ret = pRtlGetExtendedContextLength(0, &length);
-    ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#x, length %#x.\n",
+    ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#lx, length %#lx.\n",
             ret, length);
 
     for (test = 0; test < ARRAY_SIZE(context_arch); ++test)
@@ -9362,7 +9363,7 @@ static void test_extended_context(void)
 
         length = 0xdeadbeef;
         ret = pRtlGetExtendedContextLength(context_arch[test].flag, &length);
-        ok(!ret && length == expected_length, "Got unexpected result ret %#x, length %#x.\n",
+        ok(!ret && length == expected_length, "Got unexpected result ret %#lx, length %#lx.\n",
                 ret, length);
 
         for (i = 0; i < 32; ++i)
@@ -9379,20 +9380,20 @@ static void test_extended_context(void)
                 ok((!ret && length == expected_length)
                         || broken((context_arch[test].broken_flags & (1 << i))
                         && ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef),
-                        "Got unexpected result ret %#x, length %#x, flags 0x%08x.\n",
+                        "Got unexpected result ret %#lx, length %#lx, flags 0x%08lx.\n",
                         ret, length, flags);
             }
             else
             {
                 ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef,
-                        "Got unexpected result ret %#x, length %#x, flags 0x%08x.\n", ret, length, flags);
+                        "Got unexpected result ret %#lx, length %#lx, flags 0x%08lx.\n", ret, length, flags);
             }
 
             SetLastError(0xdeadbeef);
             bret = pInitializeContext(NULL, flags, NULL, &length2);
             ok(!bret && length2 == length && GetLastError()
                     == (!ret ? ERROR_INSUFFICIENT_BUFFER : ERROR_INVALID_PARAMETER),
-                    "Got unexpected bret %#x, length2 %#x, GetLastError() %u, flags %#x.\n",
+                    "Got unexpected bret %#x, length2 %#lx, GetLastError() %lu, flags %#lx.\n",
                     bret, length2, GetLastError(), flags);
 
             if (GetLastError() == ERROR_INVALID_PARAMETER)
@@ -9403,7 +9404,7 @@ static void test_extended_context(void)
             length2 = expected_length - 1;
             bret = pInitializeContext(context_buffer, flags, &context, &length2);
             ok(!bret && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
             ok(context == (void *)0xdeadbeef, "Got unexpected context %p.\n", context);
 
             SetLastError(0xdeadbeef);
@@ -9411,30 +9412,30 @@ static void test_extended_context(void)
             length2 = expected_length;
             bret = pInitializeContext(context_buffer, flags, &context, &length2);
             ok(bret && GetLastError() == 0xdeadbeef,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
-            ok(length2 == expected_length, "Got unexpexted length %#x.\n", length);
-            ok((BYTE *)context == context_buffer, "Got unexpected context %p, flags %#x.\n", context, flags);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
+            ok(length2 == expected_length, "Got unexpexted length %#lx.\n", length);
+            ok((BYTE *)context == context_buffer, "Got unexpected context %p, flags %#lx.\n", context, flags);
 
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-            ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+            ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
             context_ex = (CONTEXT_EX *)(context_buffer + context_arch[test].context_length);
             ok(context_ex->Legacy.Offset == -(int)context_arch[test].context_length,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->Legacy.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->Legacy.Offset, flags);
             ok(context_ex->Legacy.Length == ((flags & 0x20) ? context_arch[test].context_length
                     : context_arch[test].legacy_length),
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->Legacy.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->Legacy.Length, flags);
             ok(context_ex->All.Offset == -(int)context_arch[test].context_length,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->All.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->All.Offset, flags);
 
             /* No extra 8 bytes in x64 CONTEXT_EX here. */
             ok(context_ex->All.Length == context_arch[test].context_length + context_arch[1].context_ex_length,
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->All.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->All.Length, flags);
 
             ok(context_ex->XState.Offset == 25,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->XState.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->XState.Offset, flags);
             ok(!context_ex->XState.Length,
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->XState.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->XState.Length, flags);
 
             if (0)
             {
@@ -9442,11 +9443,11 @@ static void test_extended_context(void)
                 pRtlLocateLegacyContext(NULL, NULL);
             }
             p = pRtlLocateLegacyContext(context_ex, NULL);
-            ok(p == context, "Got unexpected p %p, flags %#x.\n", p, flags);
+            ok(p == context, "Got unexpected p %p, flags %#lx.\n", p, flags);
             length2 = 0xdeadbeef;
             p = pRtlLocateLegacyContext(context_ex, &length2);
             ok(p == context && length2 == context_ex->Legacy.Length,
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             length2 = expected_length;
 
             if (0)
@@ -9464,34 +9465,34 @@ static void test_extended_context(void)
             SetLastError(0xdeadbeef);
             if (flags & CONTEXT_NATIVE)
                 ok(bret && mask == ((flags & flags_fpx) == flags_fpx ? 0x3 : 0),
-                        "Got unexpected bret %#x, mask %s, flags %#x.\n", bret, wine_dbgstr_longlong(mask), flags);
+                        "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags);
             else
                 ok(!bret && mask == 0xdeadbeef && GetLastError() == 0xdeadbeef,
-                        "Got unexpected bret %#x, mask %s, GetLastError() %#x, flags %#x.\n",
+                        "Got unexpected bret %#x, mask %s, GetLastError() %#lx, flags %#lx.\n",
                         bret, wine_dbgstr_longlong(mask), GetLastError(), flags);
 
             bret = pSetXStateFeaturesMask(context, 0);
-            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#x.\n", bret, flags);
+            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#lx.\n", bret, flags);
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-            ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+            ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
             bret = pSetXStateFeaturesMask(context, 1);
-            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#x.\n", bret, flags);
+            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#lx.\n", bret, flags);
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
             ok(context_flags == (bret ? flags_fpx : flags),
-                    "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+                    "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
             bret = pSetXStateFeaturesMask(context, 2);
-            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#x.\n", bret, flags);
+            ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x, flags %#lx.\n", bret, flags);
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
             ok(context_flags == (bret ? flags_fpx : flags),
-                    "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+                    "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
             bret = pSetXStateFeaturesMask(context, 4);
             ok(!bret, "Got unexpected bret %#x.\n", bret);
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
             ok(context_flags == (flags & CONTEXT_NATIVE ? flags_fpx : flags),
-                    "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+                    "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
             *(DWORD *)(context_buffer + context_arch[test].flags_offset) = flags;
 
             for (j = 0; j < context_arch[test].flags_offset; ++j)
@@ -9523,49 +9524,49 @@ static void test_extended_context(void)
 
             memset(context_buffer2, 0xcc, sizeof(context_buffer2));
             ret2 = pRtlInitializeExtendedContext(context_buffer2, flags, &context_ex);
-            ok(!ret2, "Got unexpected ret2 %#x, flags %#x.\n", ret2, flags);
+            ok(!ret2, "Got unexpected ret2 %#lx, flags %#lx.\n", ret2, flags);
             ok(!memcmp(context_buffer2, context_buffer, sizeof(context_buffer2)),
-                    "Context data do not match, flags %#x.\n", flags);
+                    "Context data do not match, flags %#lx.\n", flags);
 
             memset(context_buffer2, 0xcc, sizeof(context_buffer2));
             ret2 = pRtlInitializeExtendedContext(context_buffer2 + 2, flags, &context_ex);
-            ok(!ret2, "Got unexpected ret2 %#x, flags %#x.\n", ret2, flags);
+            ok(!ret2, "Got unexpected ret2 %#lx, flags %#lx.\n", ret2, flags);
 
             /* Buffer gets aligned to 16 bytes on x64, while returned context length suggests it should be 8. */
             align = test ? 4 : 16;
             ok(!memcmp(context_buffer2 + align, context_buffer,
                     sizeof(context_buffer2) - align),
-                    "Context data do not match, flags %#x.\n", flags);
+                    "Context data do not match, flags %#lx.\n", flags);
 
             SetLastError(0xdeadbeef);
             memset(context_buffer2, 0xcc, sizeof(context_buffer2));
             bret = pInitializeContext(context_buffer2 + 2, flags, &context, &length2);
             ok(bret && GetLastError() == 0xdeadbeef,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
-            ok(length2 == expected_length, "Got unexpexted length %#x.\n", length);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
+            ok(length2 == expected_length, "Got unexpexted length %#lx.\n", length);
             ok(!memcmp(context_buffer2 + align, context_buffer,
                     sizeof(context_buffer2) - align),
-                    "Context data do not match, flags %#x.\n", flags);
+                    "Context data do not match, flags %#lx.\n", flags);
 
             length2 = 0xdeadbeef;
             p = pLocateXStateFeature(context, 0, &length2);
             if (flags & CONTEXT_NATIVE)
                 ok(p == (BYTE *)context + context_arch[test].xsavearea_offset
                         && length2 == offsetof(XSAVE_FORMAT, XmmRegisters),
-                        "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                        "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             else
-                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             length2 = 0xdeadbeef;
             p = pLocateXStateFeature(context, 1, &length2);
             if (flags & CONTEXT_NATIVE)
                 ok(p == (BYTE *)context + context_arch[test].xsavearea_offset + offsetof(XSAVE_FORMAT, XmmRegisters)
                         && length2 == sizeof(M128A) * context_arch[test].vector_reg_count,
-                         "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                         "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             else
-                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             length2 = 0xdeadbeef;
             p = pLocateXStateFeature(context, 2, &length2);
-            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
             if (!pRtlInitializeExtendedContext2 || !pInitializeContext2)
             {
@@ -9579,28 +9580,28 @@ static void test_extended_context(void)
             length2 = expected_length;
             memset(context_buffer2, 0xcc, sizeof(context_buffer2));
             ret2 = pRtlInitializeExtendedContext2(context_buffer2 + 2, flags, &context_ex, ~(ULONG64)0);
-            ok(!ret2, "Got unexpected ret2 %#x, flags %#x.\n", ret2, flags);
+            ok(!ret2, "Got unexpected ret2 %#lx, flags %#lx.\n", ret2, flags);
             ok(!memcmp(context_buffer2 + align, context_buffer,
                     sizeof(context_buffer2) - align),
-                    "Context data do not match, flags %#x.\n", flags);
+                    "Context data do not match, flags %#lx.\n", flags);
 
             memset(context_buffer2, 0xcc, sizeof(context_buffer2));
             bret = pInitializeContext2(context_buffer2 + 2, flags, &context, &length2, 0);
             ok(bret && GetLastError() == 0xdeadbeef,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
-            ok(length2 == expected_length, "Got unexpexted length %#x.\n", length);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
+            ok(length2 == expected_length, "Got unexpexted length %#lx.\n", length);
             ok(!memcmp(context_buffer2 + align, context_buffer,
                     sizeof(context_buffer2) - align),
-                    "Context data do not match, flags %#x.\n", flags);
+                    "Context data do not match, flags %#lx.\n", flags);
 
             length2 = 0xdeadbeef;
             p = pLocateXStateFeature(context, 0, &length2);
             if (flags & CONTEXT_NATIVE)
                 ok(p == (BYTE *)context + context_arch[test].xsavearea_offset
                         && length2 == offsetof(XSAVE_FORMAT, XmmRegisters),
-                        "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                        "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             else
-                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
         }
 
         flags = context_arch[test].flag | 0x40;
@@ -9612,19 +9613,19 @@ static void test_extended_context(void)
         if (!enabled_features)
         {
             ok(ret == STATUS_NOT_SUPPORTED && length == 0xdeadbeef,
-                    "Got unexpected result ret %#x, length %#x.\n", ret, length);
+                    "Got unexpected result ret %#lx, length %#lx.\n", ret, length);
 
             context_ex = (void *)0xdeadbeef;
             ret2 = pRtlInitializeExtendedContext(context_buffer, flags, &context_ex);
-            ok(ret2 == STATUS_NOT_SUPPORTED, "Got unexpected result ret %#x, test %u.\n", ret2, test);
+            ok(ret2 == STATUS_NOT_SUPPORTED, "Got unexpected result ret %#lx, test %u.\n", ret2, test);
 
             SetLastError(0xdeadbeef);
             length2 = sizeof(context_buffer);
             bret = pInitializeContext(context_buffer, flags, &context, &length2);
             ok(bret && GetLastError() == 0xdeadbeef,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-            ok(context_flags == (flags & ~0x40), "Got unexpected ContextFlags %#x, flags %#x.\n",
+            ok(context_flags == (flags & ~0x40), "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                     context_flags, flags);
 
             if (pInitializeContext2)
@@ -9633,16 +9634,16 @@ static void test_extended_context(void)
                 length2 = sizeof(context_buffer);
                 bret = pInitializeContext2(context_buffer, flags, &context, &length2, ~(ULONG64)0);
                 ok(bret && GetLastError() == 0xdeadbeef,
-                        "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
+                        "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
                 context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-                ok(context_flags == (flags & ~0x40), "Got unexpected ContextFlags %#x, flags %#x.\n",
+                ok(context_flags == (flags & ~0x40), "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                         context_flags, flags);
             }
             continue;
         }
 
         ok(!ret && length >= expected_length_xstate,
-                "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
 
         if (!pRtlGetExtendedContextLength2)
         {
@@ -9653,36 +9654,36 @@ static void test_extended_context(void)
             length = 0xdeadbeef;
             ret = pRtlGetExtendedContextLength2(flags, &length, 7);
             ok(!ret && length == expected_length_xstate,
-                    "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                    "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
 
             length = 0xdeadbeef;
             ret = pRtlGetExtendedContextLength2(flags, &length, ~0);
             ok(!ret && length >= expected_length_xstate,
-                    "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                    "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
 
             length = 0xdeadbeef;
             ret = pRtlGetExtendedContextLength2(flags, &length, 0);
             ok((!ret && length == expected_length_xstate - sizeof(YMMCONTEXT))
                     || broken(!ret && length == expected_length_xstate) /* win10pro */,
-                    "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                    "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
 
             length = 0xdeadbeef;
             ret = pRtlGetExtendedContextLength2(flags, &length, 3);
             ok((!ret && length == expected_length_xstate - sizeof(YMMCONTEXT))
                     || broken(!ret && length == expected_length_xstate) /* win10pro */,
-                    "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                    "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
 
             length = 0xdeadbeef;
             ret = pRtlGetExtendedContextLength2(flags, &length, 4);
             ok(!ret && length == expected_length_xstate,
-                    "Got unexpected result ret %#x, length %#x, test %u.\n", ret, length, test);
+                    "Got unexpected result ret %#lx, length %#lx, test %u.\n", ret, length, test);
         }
 
         pRtlGetExtendedContextLength(flags, &length);
         SetLastError(0xdeadbeef);
         bret = pInitializeContext(NULL, flags, NULL, &length2);
         ok(!bret && length2 == length && GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-                "Got unexpected bret %#x, length2 %#x, GetLastError() %u, flags %#x.\n",
+                "Got unexpected bret %#x, length2 %#lx, GetLastError() %lu, flags %#lx.\n",
                 bret, length2, GetLastError(), flags);
 
         SetLastError(0xdeadbeef);
@@ -9690,7 +9691,7 @@ static void test_extended_context(void)
         length2 = length - 1;
         bret = pInitializeContext(context_buffer, flags, &context, &length2);
         ok(!bret && GetLastError() == ERROR_INSUFFICIENT_BUFFER && length2 == length && context == (void *)0xdeadbeef,
-                "Got unexpected bret %#x, GetLastError() %u, length2 %#x, flags %#x.\n",
+                "Got unexpected bret %#x, GetLastError() %lu, length2 %#lx, flags %#lx.\n",
                 bret, GetLastError(), length2, flags);
 
         SetLastError(0xdeadbeef);
@@ -9698,45 +9699,45 @@ static void test_extended_context(void)
         length2 = length + 1;
         bret = pInitializeContext(context_buffer, flags, &context, &length2);
         ok(bret && GetLastError() == 0xdeadbeef,
-                "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
-        ok(length2 == length, "Got unexpexted length %#x.\n", length);
+                "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
+        ok(length2 == length, "Got unexpexted length %#lx.\n", length);
         ok((BYTE *)context == context_buffer, "Got unexpected context %p.\n", context);
 
         context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-        ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+        ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
         context_ex = (CONTEXT_EX *)(context_buffer + context_arch[test].context_length);
         ok(context_ex->Legacy.Offset == -(int)context_arch[test].context_length,
-                "Got unexpected Offset %d, flags %#x.\n", context_ex->Legacy.Offset, flags);
+                "Got unexpected Offset %ld, flags %#lx.\n", context_ex->Legacy.Offset, flags);
         ok(context_ex->Legacy.Length == ((flags & 0x20) ? context_arch[test].context_length
                 : context_arch[test].legacy_length),
-                "Got unexpected Length %#x, flags %#x.\n", context_ex->Legacy.Length, flags);
+                "Got unexpected Length %#lx, flags %#lx.\n", context_ex->Legacy.Length, flags);
 
         expected_offset = (((ULONG_PTR)context + context_arch[test].context_length
                 + context_arch[test].context_ex_length + 63) & ~(ULONG64)63) - (ULONG_PTR)context
                 - context_arch[test].context_length;
         ok(context_ex->XState.Offset == expected_offset,
-                "Got unexpected Offset %d, flags %#x.\n", context_ex->XState.Offset, flags);
+                "Got unexpected Offset %ld, flags %#lx.\n", context_ex->XState.Offset, flags);
         ok(context_ex->XState.Length >= sizeof(XSTATE),
-                "Got unexpected Length %#x, flags %#x.\n", context_ex->XState.Length, flags);
+                "Got unexpected Length %#lx, flags %#lx.\n", context_ex->XState.Length, flags);
 
         ok(context_ex->All.Offset == -(int)context_arch[test].context_length,
-                "Got unexpected Offset %d, flags %#x.\n", context_ex->All.Offset, flags);
+                "Got unexpected Offset %ld, flags %#lx.\n", context_ex->All.Offset, flags);
         /* No extra 8 bytes in x64 CONTEXT_EX here. */
         ok(context_ex->All.Length == context_arch[test].context_length
                 + context_ex->XState.Offset + context_ex->XState.Length,
-                "Got unexpected Length %#x, flags %#x.\n", context_ex->All.Length, flags);
+                "Got unexpected Length %#lx, flags %#lx.\n", context_ex->All.Length, flags);
 
         xs = (XSTATE *)((BYTE *)context_ex + context_ex->XState.Offset);
         length2 = 0xdeadbeef;
         for (i = 0; i < 2; ++i)
         {
             p = pRtlLocateExtendedFeature(context_ex, i, &length2);
-            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x.\n", p, length2);
+            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx.\n", p, length2);
         }
 
         p = pRtlLocateExtendedFeature(context_ex, XSTATE_AVX, &length2);
-        ok(length2 == sizeof(YMMCONTEXT), "Got unexpected length %#x.\n", length2);
+        ok(length2 == sizeof(YMMCONTEXT), "Got unexpected length %#lx.\n", length2);
         ok(p == &xs->YmmContext, "Got unexpected p %p.\n", p);
         p = pRtlLocateExtendedFeature(context_ex, XSTATE_AVX, NULL);
         ok(p == &xs->YmmContext, "Got unexpected p %p.\n", p);
@@ -9746,35 +9747,35 @@ static void test_extended_context(void)
         if (flags & CONTEXT_NATIVE)
             ok(p == (BYTE *)context + context_arch[test].xsavearea_offset
                     && length2 == offsetof(XSAVE_FORMAT, XmmRegisters),
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
         else
-            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
         length2 = 0xdeadbeef;
         p = pLocateXStateFeature(context, 1, &length2);
         if (flags & CONTEXT_NATIVE)
             ok(p == (BYTE *)context + context_arch[test].xsavearea_offset + offsetof(XSAVE_FORMAT, XmmRegisters)
                     && length2 == sizeof(M128A) * context_arch[test].vector_reg_count,
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
         else
-            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
         length2 = 0xdeadbeef;
         p = pLocateXStateFeature(context, 2, &length2);
         if (flags & CONTEXT_NATIVE)
             ok(p == &xs->YmmContext && length2 == sizeof(YMMCONTEXT),
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
         else
-            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+            ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
         mask = 0xdeadbeef;
         bret = pGetXStateFeaturesMask(context, &mask);
         if (flags & CONTEXT_NATIVE)
             ok(bret && !mask,
-                    "Got unexpected bret %#x, mask %s, flags %#x.\n", bret, wine_dbgstr_longlong(mask), flags);
+                    "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags);
         else
             ok(!bret && mask == 0xdeadbeef,
-                    "Got unexpected bret %#x, mask %s, flags %#x.\n", bret, wine_dbgstr_longlong(mask), flags);
+                    "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags);
 
         expected_compaction = compaction_enabled ? ((ULONG64)1 << 63) | enabled_features : 0;
         ok(!xs->Mask, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
@@ -9792,7 +9793,7 @@ static void test_extended_context(void)
         ok(mask == (xs->Mask & ~(ULONG64)3), "Got unexpected mask %s.\n", wine_dbgstr_longlong(mask));
         ok(xs->CompactionMask == 0xdeadbeef, "Got unexpected CompactionMask %s.\n", wine_dbgstr_longlong(xs->CompactionMask));
         context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-        ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context->ContextFlags, flags);
+        ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context->ContextFlags, flags);
 
         xs->Mask = 0xdeadbeef;
         xs->CompactionMask = 0;
@@ -9803,7 +9804,7 @@ static void test_extended_context(void)
         ok(!xs->CompactionMask, "Got unexpected CompactionMask %s.\n",
                 wine_dbgstr_longlong(xs->CompactionMask));
         context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-        ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context->ContextFlags, flags);
+        ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context->ContextFlags, flags);
 
         xs->Mask = 0xdeadbeef;
         xs->CompactionMask = 0xdeadbeef;
@@ -9811,7 +9812,7 @@ static void test_extended_context(void)
         ok(bret == !!(flags & CONTEXT_NATIVE), "Got unexpected bret %#x.\n", bret);
         context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
         ok(context_flags == (bret ? flags_fpx : flags),
-                "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+                "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
         ok(xs->Mask == bret ? 4 : 0xdeadbeef, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
         mask = pRtlGetExtendedFeaturesMask(context_ex);
         ok(mask == (xs->Mask & ~(ULONG64)3), "Got unexpected mask %s.\n", wine_dbgstr_longlong(mask));
@@ -9822,10 +9823,10 @@ static void test_extended_context(void)
         bret = pGetXStateFeaturesMask(context, &mask);
         if (flags & CONTEXT_NATIVE)
             ok(bret && mask == enabled_features,
-                    "Got unexpected bret %#x, mask %s, flags %#x.\n", bret, wine_dbgstr_longlong(mask), flags);
+                    "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags);
         else
             ok(!bret && mask == 0xdeadbeef,
-                    "Got unexpected bret %#x, mask %s, flags %#x.\n", bret, wine_dbgstr_longlong(mask), flags);
+                    "Got unexpected bret %#x, mask %s, flags %#lx.\n", bret, wine_dbgstr_longlong(mask), flags);
 
         if (pRtlGetExtendedContextLength2)
         {
@@ -9836,8 +9837,8 @@ static void test_extended_context(void)
             length2 = length;
             bret = pInitializeContext2(context_buffer, flags, &context, &length2, 0);
             ok(bret && GetLastError() == 0xdeadbeef,
-                    "Got unexpected bret %#x, GetLastError() %u, flags %#x.\n", bret, GetLastError(), flags);
-            ok(length2 == length, "Got unexpexted length %#x.\n", length);
+                    "Got unexpected bret %#x, GetLastError() %lu, flags %#lx.\n", bret, GetLastError(), flags);
+            ok(length2 == length, "Got unexpexted length %#lx.\n", length);
             ok((BYTE *)context == context_buffer, "Got unexpected context %p.\n", context);
 
             length2 = 0xdeadbeef;
@@ -9845,46 +9846,46 @@ static void test_extended_context(void)
             if (flags & CONTEXT_NATIVE)
                 ok(p == (BYTE *)context + context_arch[test].xsavearea_offset
                     && length2 == offsetof(XSAVE_FORMAT, XmmRegisters),
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
             else
-                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                ok(!p && length2 == 0xdeadbeef, "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
             length2 = 0xdeadbeef;
             p = pRtlLocateExtendedFeature(context_ex, 2, &length2);
             ok((!p && length2 == sizeof(YMMCONTEXT))
                     || broken(p && length2 == sizeof(YMMCONTEXT)) /* win10pro */,
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
             length2 = 0xdeadbeef;
             p = pLocateXStateFeature(context, 2, &length2);
             ok(!p && length2 == (flags & CONTEXT_NATIVE) ? sizeof(YMMCONTEXT) : 0xdeadbeef,
-                    "Got unexpected p %p, length %#x, flags %#x.\n", p, length2, flags);
+                    "Got unexpected p %p, length %#lx, flags %#lx.\n", p, length2, flags);
 
             context_flags = *(DWORD *)(context_buffer + context_arch[test].flags_offset);
-            ok(context_flags == flags, "Got unexpected ContextFlags %#x, flags %#x.\n", context_flags, flags);
+            ok(context_flags == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n", context_flags, flags);
 
             context_ex = (CONTEXT_EX *)(context_buffer + context_arch[test].context_length);
             ok(context_ex->Legacy.Offset == -(int)context_arch[test].context_length,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->Legacy.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->Legacy.Offset, flags);
             ok(context_ex->Legacy.Length == ((flags & 0x20) ? context_arch[test].context_length
                     : context_arch[test].legacy_length),
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->Legacy.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->Legacy.Length, flags);
 
             expected_offset = (((ULONG_PTR)context + context_arch[test].context_length
                     + context_arch[test].context_ex_length + 63) & ~(ULONG64)63) - (ULONG_PTR)context
                     - context_arch[test].context_length;
             ok(context_ex->XState.Offset == expected_offset,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->XState.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->XState.Offset, flags);
             ok(context_ex->XState.Length == sizeof(XSTATE) - sizeof(YMMCONTEXT)
                     || broken(context_ex->XState.Length == sizeof(XSTATE)) /* win10pro */,
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->XState.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->XState.Length, flags);
 
             ok(context_ex->All.Offset == -(int)context_arch[test].context_length,
-                    "Got unexpected Offset %d, flags %#x.\n", context_ex->All.Offset, flags);
+                    "Got unexpected Offset %ld, flags %#lx.\n", context_ex->All.Offset, flags);
             /* No extra 8 bytes in x64 CONTEXT_EX here. */
             ok(context_ex->All.Length == context_arch[test].context_length
                     + context_ex->XState.Offset + context_ex->XState.Length,
-                    "Got unexpected Length %#x, flags %#x.\n", context_ex->All.Length, flags);
+                    "Got unexpected Length %#lx, flags %#lx.\n", context_ex->All.Length, flags);
 
             expected_compaction = compaction_enabled ? (ULONG64)1 << 63 : 0;
             xs = (XSTATE *)((BYTE *)context_ex + context_ex->XState.Offset);
@@ -9901,7 +9902,7 @@ static void test_extended_context(void)
 
     length = 0xdeadbeef;
     ret = pRtlGetExtendedContextLength(context_arch[0].flag | context_arch[1].flag, &length);
-    ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#x, length %#x.\n",
+    ok(ret == STATUS_INVALID_PARAMETER && length == 0xdeadbeef, "Got unexpected result ret %#lx, length %#lx.\n",
             ret, length);
 
     if (0)
@@ -9935,7 +9936,7 @@ static void test_extended_context(void)
 
     memcpy(data, test_extended_context_data, sizeof(data));
     func();
-    ok(context->ContextFlags == (CONTEXT_FULL | CONTEXT_SEGMENTS), "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == (CONTEXT_FULL | CONTEXT_SEGMENTS), "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
     for (i = 0; i < 8; ++i)
         ok(data[i] == test_extended_context_data[i], "Got unexpected data %#x, i %u.\n", data[i], i);
@@ -9953,7 +9954,7 @@ static void test_extended_context(void)
     expected_flags |= CONTEXT_EXTENDED_REGISTERS;
 #endif
     pSetXStateFeaturesMask(context, ~(ULONG64)0);
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
     *(void **)(call_func_code_set_ymm0 + call_func_offsets.func_addr) = GetThreadContext;
     *(void **)(call_func_code_set_ymm0 + call_func_offsets.func_param1) = (void *)GetCurrentThread();
@@ -9966,9 +9967,9 @@ static void test_extended_context(void)
     context_ex->XState.Length = sizeof(XSTATE);
 
     bret = func();
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
     expected_compaction = compaction_enabled ? (ULONG64)1 << 63 : 0;
 
@@ -9982,7 +9983,7 @@ static void test_extended_context(void)
 
     for (i = 0; i < 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == (xs->Mask == 4 ? test_extended_context_data[i + 4] : 0xcccccccc),
-                "Got unexpected data %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     expected_compaction = compaction_enabled ? ((ULONG64)1 << 63) | 4 : 0;
 
@@ -9991,8 +9992,8 @@ static void test_extended_context(void)
     context_ex->XState.Length = sizeof(XSTATE) + 64;
     bret = func();
     ok(!bret && GetLastError() == ERROR_INVALID_PARAMETER,
-            "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+            "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
     ok(xs->Mask == (compaction_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask);
     ok(xs->CompactionMask == 4, "Got unexpected CompactionMask %s.\n",
@@ -10000,31 +10001,31 @@ static void test_extended_context(void)
     for (i = 0; i < 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == 0xcccccccc
                 || broken(((ULONG *)&xs->YmmContext)[i] == test_extended_context_data[i + 4]) /* win10pro */,
-                "Got unexpected data %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     xs->CompactionMask = 4;
     xs->Mask = compaction_enabled ? 0 : 4;
     context_ex->XState.Length = offsetof(XSTATE, YmmContext);
     bret = func();
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
     ok(!bret && GetLastError() == ERROR_MORE_DATA,
-            "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+            "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     ok(xs->Mask == 4, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
     ok(xs->CompactionMask == expected_compaction, "Got unexpected CompactionMask %s.\n",
             wine_dbgstr_longlong(xs->CompactionMask));
     for (i = 0; i < 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == 0xcccccccc
                 || broken(((ULONG *)&xs->YmmContext)[i] == test_extended_context_data[i + 4]) /* win10pro */,
-                "Got unexpected data %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     context_ex->XState.Length = sizeof(XSTATE);
     xs->CompactionMask = 4;
     xs->Mask = compaction_enabled ? 0 : 4;
     bret = func();
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
 
     ok(xs->Mask == 4, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
@@ -10036,7 +10037,7 @@ static void test_extended_context(void)
 
     for (i = 0; i < 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == test_extended_context_data[i + 4],
-                "Got unexpected data %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     /* Test GetThreadContext (current thread, ymm state cleared). */
     length = sizeof(context_buffer);
@@ -10053,13 +10054,13 @@ static void test_extended_context(void)
     memcpy(code_mem, call_func_code_reset_ymm_state, sizeof(call_func_code_reset_ymm_state));
 
     bret = func();
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
     expected_flags = CONTEXT_FULL | CONTEXT_XSTATE | CONTEXT_FLOATING_POINT;
 #ifdef __i386__
     expected_flags |= CONTEXT_EXTENDED_REGISTERS;
 #endif
-    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#x.\n",
+    ok(context->ContextFlags == expected_flags, "Got unexpected ContextFlags %#lx.\n",
             context->ContextFlags);
 
     expected_compaction = compaction_enabled ? ((ULONG64)1 << 63) | 4 : 0;
@@ -10075,7 +10076,7 @@ static void test_extended_context(void)
     for (i = 0; i < 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == ((xs->Mask & 4) ? 0 : 0xcccccccc)
                 || broken(((ULONG *)&xs->YmmContext)[i] == test_extended_context_data[i + 4]),
-                "Got unexpected data %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected data %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     /* Test fault exception context. */
     memset(data, 0xff, sizeof(data));
@@ -10111,69 +10112,69 @@ static void test_extended_context(void)
     pSetXStateFeaturesMask(context, 4);
 
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     todo_wine_if (!xsaveopt_enabled)
         ok(xs->Mask == (xsaveopt_enabled ? 0 : 4), "Got unexpected Mask %#I64x.\n", xs->Mask);
     ok(xs->CompactionMask == expected_compaction, "Got unexpected CompactionMask %s.\n",
             wine_dbgstr_longlong(xs->CompactionMask));
     for (i = 0; i < 16 * 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == ((xs->Mask & 4) ? 0 : 0xcccccccc),
-                "Got unexpected value %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     pSetXStateFeaturesMask(context, 4);
     memset(&xs->YmmContext, 0, sizeof(xs->YmmContext));
     bret = SetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
     memset(&xs->YmmContext, 0xcc, sizeof(xs->YmmContext));
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     ok(!xs->Mask || broken(xs->Mask == 4), "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
     ok(xs->CompactionMask == expected_compaction, "Got unexpected CompactionMask %s.\n",
             wine_dbgstr_longlong(xs->CompactionMask));
     for (i = 0; i < 16 * 4; ++i)
         ok(((ULONG *)&xs->YmmContext)[i] == 0xcccccccc || broken(xs->Mask == 4 && !((ULONG *)&xs->YmmContext)[i]),
-                "Got unexpected value %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
 
     pSetXStateFeaturesMask(context, 4);
     memset(&xs->YmmContext, 0x28, sizeof(xs->YmmContext));
     bret = SetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     memset(&xs->YmmContext, 0xcc, sizeof(xs->YmmContext));
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     ok(xs->Mask == 4, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
     ok(xs->CompactionMask == expected_compaction, "Got unexpected CompactionMask %s.\n",
             wine_dbgstr_longlong(xs->CompactionMask));
     for (i = 0; i < 16 * 4; ++i)
-        ok(((ULONG *)&xs->YmmContext)[i] == 0x28282828, "Got unexpected value %#x, i %u.\n",
+        ok(((ULONG *)&xs->YmmContext)[i] == 0x28282828, "Got unexpected value %#lx, i %u.\n",
                 ((ULONG *)&xs->YmmContext)[i], i);
 
     wait_for_thread_next_suspend(thread);
 
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     pSetXStateFeaturesMask(context, 4);
     memset(&xs->YmmContext, 0x48, sizeof(xs->YmmContext));
     bret = SetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
     wait_for_thread_next_suspend(thread);
 
     memset(&xs->YmmContext, 0xcc, sizeof(xs->YmmContext));
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     ok(xs->Mask == 4, "Got unexpected Mask %s.\n", wine_dbgstr_longlong(xs->Mask));
 
     for (i = 0; i < 4; ++i)
-        ok(((ULONG *)&xs->YmmContext)[i] == 0x68686868, "Got unexpected value %#x, i %u.\n",
+        ok(((ULONG *)&xs->YmmContext)[i] == 0x68686868, "Got unexpected value %#lx, i %u.\n",
                 ((ULONG *)&xs->YmmContext)[i], i);
 
     wait_for_thread_next_suspend(thread);
 
     memset(&xs->YmmContext, 0xcc, sizeof(xs->YmmContext));
     bret = GetThreadContext(thread, context);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
     todo_wine_if (!xsaveopt_enabled && sizeof(void *) != 4)
         ok(xs->Mask == (xsaveopt_enabled ? 0 : 4) || (sizeof(void *) == 4 && xs->Mask == 4),
                 "Got unexpected Mask %#I64x.\n", xs->Mask);
@@ -10181,20 +10182,20 @@ static void test_extended_context(void)
     {
         for (i = 0; i < 8 * sizeof(void *); ++i)
             ok(((ULONG *)&xs->YmmContext)[i] == 0,
-                    "Got unexpected value %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                    "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
         for (; i < 16 * 4; ++i)
             ok(((ULONG *)&xs->YmmContext)[i] == 0x48484848,
-                    "Got unexpected value %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                    "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
     }
     else
     {
         for (i = 0; i < 16 * 4; ++i)
             ok(((ULONG *)&xs->YmmContext)[i] == 0xcccccccc,
-                    "Got unexpected value %#x, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
+                    "Got unexpected value %#lx, i %u.\n", ((ULONG *)&xs->YmmContext)[i], i);
     }
 
     bret = ResumeThread(thread);
-    ok(bret, "Got unexpected bret %#x, GetLastError() %u.\n", bret, GetLastError());
+    ok(bret, "Got unexpected bret %#x, GetLastError() %lu.\n", bret, GetLastError());
 
     WaitForSingleObject(thread, INFINITE);
     CloseHandle(thread);
@@ -10231,7 +10232,7 @@ static void check_changes_in_range_(const char *file, unsigned int line, const B
             if (flag & flags && p[i] == 0xcc)
             {
                 if (!once++)
-                    ok(broken(1), "Matched broken result at %#x, flags %#x.\n", i, flags);
+                    ok(broken(1), "Matched broken result at %#x, flags %#lx.\n", i, flags);
                 continue;
             }
             flag = 0;
@@ -10239,12 +10240,12 @@ static void check_changes_in_range_(const char *file, unsigned int line, const B
 
         if (flag & flags && p[i] != 0xcc)
         {
-            ok_(file, line)(0, "Got unexpected byte %#x at %#x, flags %#x.\n", p[i], i, flags);
+            ok_(file, line)(0, "Got unexpected byte %#x at %#x, flags %#lx.\n", p[i], i, flags);
             return;
         }
         else if (!(flag & flags) && p[i] != 0xdd)
         {
-            ok_(file, line)(0, "Got unexpected byte %#x at %#x, flags %#x.\n", p[i], i, flags);
+            ok_(file, line)(0, "Got unexpected byte %#x at %#x, flags %#lx.\n", p[i], i, flags);
             return;
         }
     }
@@ -10330,15 +10331,15 @@ static void test_copy_context(void)
         status = pRtlInitializeExtendedContext(src_context_buffer, flags, &src_ex);
         if (enabled_features || !(flags & 0x40))
         {
-            ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+            ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         }
         else
         {
-            ok(status == STATUS_NOT_SUPPORTED, "Got unexpected status %#x, flags %#x.\n", status, flags);
+            ok(status == STATUS_NOT_SUPPORTED, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
             continue;
         }
         status = pRtlInitializeExtendedContext(dst_context_buffer, flags, &dst_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
 
         src = pRtlLocateLegacyContext(src_ex, NULL);
         dst = pRtlLocateLegacyContext(dst_ex, NULL);
@@ -10352,26 +10353,26 @@ static void test_copy_context(void)
         src_xs->CompactionMask = ~(ULONG64)0;
 
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
 
         context_length = (BYTE *)dst_ex - (BYTE *)dst + dst_ex->All.Length;
         check_changes_in_range((BYTE *)dst, flags & CONTEXT_AMD64 ? &ranges_amd64[0] : &ranges_x86[0],
                 flags, context_length);
 
-        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#x, flags %#x.\n",
+        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                 *(DWORD *)((BYTE *)dst + flags_offset), flags);
 
         memset(dst_context_buffer, 0xdd, sizeof(dst_context_buffer));
         status = pRtlInitializeExtendedContext(dst_context_buffer, flags, &dst_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         *(DWORD *)((BYTE *)src + flags_offset) = 0;
         *(DWORD *)((BYTE *)dst + flags_offset) = 0;
         SetLastError(0xdeadbeef);
         status = pRtlCopyContext(dst, flags | 0x40, src);
         ok(status == (enabled_features ? STATUS_INVALID_PARAMETER : STATUS_NOT_SUPPORTED)
            || broken(status == STATUS_INVALID_PARAMETER),
-           "Got unexpected status %#x, flags %#x.\n", status, flags);
-        ok(*(DWORD *)((BYTE *)dst + flags_offset) == 0, "Got unexpected ContextFlags %#x, flags %#x.\n",
+           "Got unexpected status %#lx, flags %#lx.\n", status, flags);
+        ok(*(DWORD *)((BYTE *)dst + flags_offset) == 0, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                 *(DWORD *)((BYTE *)dst + flags_offset), flags);
         check_changes_in_range((BYTE *)dst, flags & CONTEXT_AMD64 ? &ranges_amd64[0] : &ranges_x86[0],
                 0, context_length);
@@ -10382,13 +10383,13 @@ static void test_copy_context(void)
         if (flags & 0x40)
             ok((status == STATUS_BUFFER_OVERFLOW)
                || broken(!(flags & CONTEXT_NATIVE) && status == STATUS_INVALID_PARAMETER),
-               "Got unexpected status %#x, flags %#x.\n", status, flags);
+               "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         else
             ok(!status || broken(!(flags & CONTEXT_NATIVE) && status == STATUS_INVALID_PARAMETER),
-               "Got unexpected status %#x, flags %#x.\n", status, flags);
+               "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         if (!status)
         {
-            ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#x, flags %#x.\n",
+            ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                     *(DWORD *)((BYTE *)dst + flags_offset), flags);
             check_changes_in_range((BYTE *)dst, flags & CONTEXT_AMD64 ? &ranges_amd64[0] : &ranges_x86[0],
                     flags, context_length);
@@ -10396,7 +10397,7 @@ static void test_copy_context(void)
         else
         {
             ok(*(DWORD *)((BYTE *)dst + flags_offset) == (flags & 0x110000),
-                    "Got unexpected ContextFlags %#x, flags %#x.\n",
+                    "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                     *(DWORD *)((BYTE *)dst + flags_offset), flags);
             check_changes_in_range((BYTE *)dst, flags & CONTEXT_AMD64 ? &ranges_amd64[0] : &ranges_x86[0],
                     0, context_length);
@@ -10414,11 +10415,11 @@ static void test_copy_context(void)
         memset(src_context_buffer, 0xcc, sizeof(src_context_buffer));
         length = sizeof(src_context_buffer);
         bret = pInitializeContext(src_context_buffer, flags, &src, &length);
-        ok(bret, "Got unexpected bret %#x, flags %#x.\n", bret, flags);
+        ok(bret, "Got unexpected bret %#x, flags %#lx.\n", bret, flags);
 
         length = sizeof(dst_context_buffer);
         bret = pInitializeContext(dst_context_buffer, flags, &dst, &length);
-        ok(bret, "Got unexpected bret %#x, flags %#x.\n", bret, flags);
+        ok(bret, "Got unexpected bret %#x, flags %#lx.\n", bret, flags);
 
         dst_ex = (CONTEXT_EX *)((BYTE *)dst + context_length);
         src_ex = (CONTEXT_EX *)((BYTE *)src + context_length);
@@ -10442,12 +10443,12 @@ static void test_copy_context(void)
         dst_ex->XState.Length = 0;
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
         ok(status == (enabled_features ? STATUS_BUFFER_OVERFLOW : STATUS_NOT_SUPPORTED),
-                "Got unexpected status %#x, flags %#x.\n", status, flags);
+                "Got unexpected status %#lx, flags %#lx.\n", status, flags);
 
         if (!enabled_features)
             continue;
 
-        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#x, flags %#x.\n",
+        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                 *(DWORD *)((BYTE *)dst + flags_offset), flags);
 
         src_xs->Mask = ~(ULONG64)0;
@@ -10457,8 +10458,8 @@ static void test_copy_context(void)
         dst_xs->Mask = 0xdddddddddddddddd;
         dst_ex->XState.Length = 0;
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(status == STATUS_BUFFER_OVERFLOW, "Got unexpected status %#x, flags %#x.\n", status, flags);
-        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#x, flags %#x.\n",
+        ok(status == STATUS_BUFFER_OVERFLOW, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
+        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                 *(DWORD *)((BYTE *)dst + flags_offset), flags);
 
         ok(dst_xs->Mask == 0xdddddddddddddddd, "Got unexpected Mask %s.\n",
@@ -10473,8 +10474,8 @@ static void test_copy_context(void)
         dst_xs->Mask = 0xdddddddddddddddd;
         dst_ex->XState.Length = offsetof(XSTATE, YmmContext);
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
-        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#x, flags %#x.\n",
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
+        ok(*(DWORD *)((BYTE *)dst + flags_offset) == flags, "Got unexpected ContextFlags %#lx, flags %#lx.\n",
                 *(DWORD *)((BYTE *)dst + flags_offset), flags);
         ok(dst_xs->Mask == 0, "Got unexpected Mask %s.\n",
                 wine_dbgstr_longlong(dst_xs->Mask));
@@ -10487,7 +10488,7 @@ static void test_copy_context(void)
         dst_xs->Mask = 0xdddddddddddddddd;
         dst_ex->XState.Length = sizeof(XSTATE);
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         ok(dst_xs->Mask == 0, "Got unexpected Mask %s.\n",
                 wine_dbgstr_longlong(dst_xs->Mask));
         ok(dst_xs->CompactionMask == expected_compaction,
@@ -10499,7 +10500,7 @@ static void test_copy_context(void)
         dst_xs->CompactionMask = 0xdddddddddddddddd;
         dst_xs->Mask = 0xdddddddddddddddd;
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         ok(dst_xs->Mask == 4, "Got unexpected Mask %s.\n",
                 wine_dbgstr_longlong(dst_xs->Mask));
         ok(dst_xs->CompactionMask == expected_compaction,
@@ -10511,7 +10512,7 @@ static void test_copy_context(void)
         dst_xs->CompactionMask = 0xdddddddddddddddd;
         dst_xs->Mask = 0xdddddddddddddddd;
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         ok(dst_xs->Mask == 0, "Got unexpected Mask %s.\n",
                 wine_dbgstr_longlong(dst_xs->Mask));
         ok(dst_xs->CompactionMask == expected_compaction,
@@ -10526,7 +10527,7 @@ static void test_copy_context(void)
         dst_xs->CompactionMask = 0xdddddddddddddddd;
         dst_xs->Mask = 0xdddddddddddddddd;
         status = pRtlCopyExtendedContext(dst_ex, flags, src_ex);
-        ok(!status, "Got unexpected status %#x, flags %#x.\n", status, flags);
+        ok(!status, "Got unexpected status %#lx, flags %#lx.\n", status, flags);
         ok(dst_xs->Mask == 4, "Got unexpected Mask %s.\n",
                 wine_dbgstr_longlong(dst_xs->Mask));
         ok(dst_xs->CompactionMask == expected_compaction,
@@ -10539,11 +10540,11 @@ static void test_copy_context(void)
         dst_xs->Mask = 0xdddddddddddddddd;
         status = pRtlCopyContext(dst, flags, src);
         ok(!status || broken(!(flags & CONTEXT_NATIVE) && status == STATUS_INVALID_PARAMETER),
-           "Got unexpected status %#x, flags %#x.\n", status, flags);
-        ok(dst_xs->Mask == 0xdddddddddddddddd || broken(dst_xs->Mask == 4), "Got unexpected Mask %s, flags %#x.\n",
+           "Got unexpected status %#lx, flags %#lx.\n", status, flags);
+        ok(dst_xs->Mask == 0xdddddddddddddddd || broken(dst_xs->Mask == 4), "Got unexpected Mask %s, flags %#lx.\n",
                 wine_dbgstr_longlong(dst_xs->Mask), flags);
         ok(dst_xs->CompactionMask == 0xdddddddddddddddd || broken(dst_xs->CompactionMask == expected_compaction),
-                "Got unexpected CompactionMask %s, flags %#x.\n", wine_dbgstr_longlong(dst_xs->CompactionMask), flags);
+                "Got unexpected CompactionMask %s, flags %#lx.\n", wine_dbgstr_longlong(dst_xs->CompactionMask), flags);
         check_changes_in_range((BYTE *)&dst_xs->YmmContext, single_range,
                 dst_xs->Mask == 4, sizeof(dst_xs->YmmContext));
     }




More information about the wine-devel mailing list