[PATCH 09/20] dlls/ntoskrnl.exe/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Wed Mar 2 02:03:51 CST 2022


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

---
 dlls/ntoskrnl.exe/tests/Makefile.in    |    1 
 dlls/ntoskrnl.exe/tests/driver.c       |  474 ++++++++++++++--------------
 dlls/ntoskrnl.exe/tests/driver_netio.c |  160 +++++----
 dlls/ntoskrnl.exe/tests/driver_pnp.c   |   54 ++-
 dlls/ntoskrnl.exe/tests/ntoskrnl.c     |  542 ++++++++++++++++----------------
 dlls/ntoskrnl.exe/tests/utils.h        |    2 
 6 files changed, 616 insertions(+), 617 deletions(-)

diff --git a/dlls/ntoskrnl.exe/tests/Makefile.in b/dlls/ntoskrnl.exe/tests/Makefile.in
index 052a8618a81..ab1db85adbb 100644
--- a/dlls/ntoskrnl.exe/tests/Makefile.in
+++ b/dlls/ntoskrnl.exe/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = ntoskrnl.exe
 IMPORTS   = advapi32 crypt32 newdev setupapi user32 wintrust ws2_32 hid
 
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index 0364fecab1d..dc4f4ad993d 100644
--- a/dlls/ntoskrnl.exe/tests/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.c
@@ -77,7 +77,7 @@ static void *get_proc_address(const char *name)
 
     RtlInitAnsiString(&name_a, name);
     status = RtlAnsiStringToUnicodeString(&name_u, &name_a, TRUE);
-    ok (!status, "RtlAnsiStringToUnicodeString failed: %#x\n", status);
+    ok (!status, "RtlAnsiStringToUnicodeString failed: %#lx\n", status);
     if (status) return NULL;
 
     ret = MmGetSystemRoutineAddress(&name_u);
@@ -295,12 +295,12 @@ static void test_init_funcs(void)
     KeInitializeTimerEx(&timer, NotificationTimer);
     ok(timer.Header.Type == 8, "got: %u\n", timer.Header.Type);
     ok(timer.Header.Size == 0 || timer.Header.Size == 10, "got: %u\n", timer.Header.Size);
-    ok(timer.Header.SignalState == 0, "got: %u\n", timer.Header.SignalState);
+    ok(timer.Header.SignalState == 0, "got: %lu\n", timer.Header.SignalState);
 
     KeInitializeTimerEx(&timer2, SynchronizationTimer);
     ok(timer2.Header.Type == 9, "got: %u\n", timer2.Header.Type);
     ok(timer2.Header.Size == 0 || timer2.Header.Size == 10, "got: %u\n", timer2.Header.Size);
-    ok(timer2.Header.SignalState == 0, "got: %u\n", timer2.Header.SignalState);
+    ok(timer2.Header.SignalState == 0, "got: %lu\n", timer2.Header.SignalState);
 }
 
 static const WCHAR driver2_path[] =
@@ -334,11 +334,11 @@ static void test_load_driver(void)
     HANDLE file;
 
     ret = PsSetLoadImageNotifyRoutine(test_load_image_notify_routine);
-    ok(ret == STATUS_SUCCESS, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret);
 
     /* Routine gets registered twice on Windows. */
     ret = PsSetLoadImageNotifyRoutine(test_load_image_notify_routine);
-    ok(ret == STATUS_SUCCESS, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret);
 
     RtlInitUnicodeString(&image_path, NULL);
     memset(query_table, 0, sizeof(query_table));
@@ -349,25 +349,25 @@ static void test_load_driver(void)
     query_table[0].DefaultType = REG_EXPAND_SZ << RTL_QUERY_REGISTRY_TYPECHECK_SHIFT;
 
     ret = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, driver2_path, query_table, NULL, NULL);
-    ok(ret == STATUS_SUCCESS, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret);
     ok(!!image_path.Buffer, "image_path.Buffer is NULL.\n");
 
     /* The image path name in the registry may contain NT symlinks (e.g. DOS
      * drives), which are resolved before the callback is called on Windows 10. */
     InitializeObjectAttributes(&attr, &image_path, OBJ_KERNEL_HANDLE, NULL, NULL);
     ret = ZwOpenFile(&file, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT);
-    todo_wine ok(!ret, "Got unexpected status %#x.\n", ret);
+    todo_wine ok(!ret, "Got unexpected status %#lx.\n", ret);
     if (!ret)
     {
         ret = ZwQueryObject(file, ObjectNameInformation, full_name_buffer, sizeof(full_name_buffer), NULL);
-        ok(!ret, "Got unexpected status %#x.\n", ret);
+        ok(!ret, "Got unexpected status %#lx.\n", ret);
         ZwClose(file);
     }
 
     RtlInitUnicodeString(&name, driver2_path);
 
     ret = ZwLoadDriver(&name);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
 
     ok(test_load_image_notify_count == 2, "Got unexpected test_load_image_notify_count %u.\n",
             test_load_image_notify_count);
@@ -382,17 +382,17 @@ static void test_load_driver(void)
     test_load_image_notify_count = 0;
 
     ret = ZwLoadDriver(&name);
-    ok(ret == STATUS_IMAGE_ALREADY_LOADED, "got %#x\n", ret);
+    ok(ret == STATUS_IMAGE_ALREADY_LOADED, "got %#lx\n", ret);
 
     ret = ZwUnloadDriver(&name);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
 
     ret = PsRemoveLoadImageNotifyRoutine(test_load_image_notify_routine);
-    ok(ret == STATUS_SUCCESS, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret);
     ret = PsRemoveLoadImageNotifyRoutine(test_load_image_notify_routine);
-    ok(ret == STATUS_SUCCESS, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_SUCCESS, "Got unexpected status %#lx.\n", ret);
     ret = PsRemoveLoadImageNotifyRoutine(test_load_image_notify_routine);
-    ok(ret == STATUS_PROCEDURE_NOT_FOUND, "Got unexpected status %#x.\n", ret);
+    ok(ret == STATUS_PROCEDURE_NOT_FOUND, "Got unexpected status %#lx.\n", ret);
 
     ok(test_load_image_notify_count == 0, "Got unexpected test_load_image_notify_count %u.\n",
             test_load_image_notify_count);
@@ -438,7 +438,7 @@ static void test_current_thread(BOOL is_system)
     header = (DISPATCHER_HEADER*)current;
     ok(header->Type == 3, "header->Type != 3, = %u\n", header->Type);
     ret = wait_single(current, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     if (is_system)
         ok(current == *pPsInitialSystemProcess, "current != PsInitialSystemProcess\n");
@@ -450,7 +450,7 @@ static void test_current_thread(BOOL is_system)
 
     thread = PsGetCurrentThread();
     ret = wait_single( thread, 0 );
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ok(PsGetThreadId((PETHREAD)KeGetCurrentThread()) == PsGetCurrentThreadId(), "thread IDs don't match\n");
     ok(PsIsSystemThread((PETHREAD)KeGetCurrentThread()) == is_system, "unexpected system thread\n");
@@ -461,16 +461,16 @@ static void test_current_thread(BOOL is_system)
     }
 
     ret = ObOpenObjectByPointer(current, OBJ_KERNEL_HANDLE, NULL, PROCESS_QUERY_INFORMATION, NULL, KernelMode, &process_handle);
-    ok(!ret, "ObOpenObjectByPointer failed: %#x\n", ret);
+    ok(!ret, "ObOpenObjectByPointer failed: %#lx\n", ret);
 
     ret = ZwQueryInformationProcess(process_handle, ProcessBasicInformation, &info, sizeof(info), NULL);
-    ok(!ret, "ZwQueryInformationProcess failed: %#x\n", ret);
+    ok(!ret, "ZwQueryInformationProcess failed: %#lx\n", ret);
 
     id = PsGetProcessInheritedFromUniqueProcessId(current);
     ok(id == (HANDLE)info.InheritedFromUniqueProcessId, "unexpected process id %p\n", id);
 
     ret = ZwClose(process_handle);
-    ok(!ret, "ZwClose failed: %#x\n", ret);
+    ok(!ret, "ZwClose failed: %#lx\n", ret);
 }
 
 static void test_critical_region(BOOL is_dispatcher)
@@ -517,7 +517,7 @@ static HANDLE create_thread(PKSTART_ROUTINE proc, void *arg)
     attr.Length = sizeof(attr);
     attr.Attributes = OBJ_KERNEL_HANDLE;
     ret = PsCreateSystemThread(&thread, THREAD_ALL_ACCESS, &attr, NULL, NULL, proc, arg);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
 
     return thread;
 }
@@ -527,9 +527,9 @@ static void join_thread(HANDLE thread)
     NTSTATUS ret;
 
     ret = ZwWaitForSingleObject(thread, FALSE, NULL);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
     ret = ZwClose(thread);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
 }
 
 static void run_thread(PKSTART_ROUTINE proc, void *arg)
@@ -545,7 +545,7 @@ static void WINAPI mutex_thread(void *arg)
     NTSTATUS ret, expect = (NTSTATUS)(DWORD_PTR)arg;
 
     ret = wait_single(&test_mutex, 0);
-    ok(ret == expect, "expected %#x, got %#x\n", expect, ret);
+    ok(ret == expect, "expected %#lx, got %#lx\n", expect, ret);
 
     if (!ret) KeReleaseMutex(&test_mutex, FALSE);
     PsTerminateSystemThread(STATUS_SUCCESS);
@@ -559,7 +559,7 @@ static void WINAPI remove_lock_thread(void *arg)
     NTSTATUS ret;
 
     ret = IoAcquireRemoveLockEx(lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
     KeSetEvent(&remove_lock_ready, 0, FALSE);
 
     IoReleaseRemoveLockAndWaitEx(lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
@@ -597,86 +597,86 @@ static void test_sync(void)
     KeInitializeEvent(&manual_event, NotificationEvent, FALSE);
 
     ret = wait_single(&manual_event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ret = KeReadStateEvent(&manual_event);
-    ok(ret == 0, "got %d\n", ret);
+    ok(ret == 0, "got %ld\n", ret);
 
     KeSetEvent(&manual_event, 0, FALSE);
 
     ret = KeReadStateEvent(&manual_event);
-    ok(ret == 1, "got %d\n", ret);
+    ok(ret == 1, "got %ld\n", ret);
 
     ret = wait_single(&manual_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&manual_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     KeResetEvent(&manual_event);
 
     ret = wait_single(&manual_event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeInitializeEvent(&auto_event, SynchronizationEvent, FALSE);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(&auto_event, 0, FALSE);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeInitializeEvent(&auto_event, SynchronizationEvent, TRUE);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     objs[0] = &manual_event;
     objs[1] = &auto_event;
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(&manual_event, 0, FALSE);
     KeSetEvent(&auto_event, 0, FALSE);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     KeResetEvent(&manual_event);
     KeSetEvent(&auto_event, 0, FALSE);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 1, "got %#x\n", ret);
+    ok(ret == 1, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(&manual_event, 0, FALSE);
     KeSetEvent(&auto_event, 0, FALSE);
 
     ret = wait_multiple(2, objs, WaitAll, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAll, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(&auto_event, 0, FALSE);
     KeResetEvent(&manual_event);
 
     ret = wait_multiple(2, objs, WaitAll, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&auto_event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     objs[0] = &auto_event;
     objs[1] = &manual_event;
@@ -684,39 +684,39 @@ static void test_sync(void)
     KeSetEvent(&auto_event, 0, FALSE);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 1, "got %#x\n", ret);
+    ok(ret == 1, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 1, "got %#x\n", ret);
+    ok(ret == 1, "got %#lx\n", ret);
 
     InitializeObjectAttributes(&attr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     ret = ZwCreateEvent(&handle, SYNCHRONIZE, &attr, NotificationEvent, TRUE);
-    ok(!ret, "ZwCreateEvent failed: %#x\n", ret);
+    ok(!ret, "ZwCreateEvent failed: %#lx\n", ret);
 
     ret = ObReferenceObjectByHandle(handle, SYNCHRONIZE, *pExEventObjectType, KernelMode, (void **)&event, NULL);
-    ok(!ret, "ObReferenceObjectByHandle failed: %#x\n", ret);
+    ok(!ret, "ObReferenceObjectByHandle failed: %#lx\n", ret);
 
 
     ret = wait_single(event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     ret = KeReadStateEvent(event);
-    ok(ret == 1, "got %d\n", ret);
+    ok(ret == 1, "got %ld\n", ret);
     KeResetEvent(event);
     ret = KeReadStateEvent(event);
-    ok(ret == 0, "got %d\n", ret);
+    ok(ret == 0, "got %ld\n", ret);
     ret = wait_single(event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
     ret = wait_single_handle(handle, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(event, 0, FALSE);
     ret = wait_single(event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     ret = wait_single_handle(handle, 0);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
 
     ZwClose(handle);
     ObDereferenceObject(event);
@@ -725,90 +725,90 @@ static void test_sync(void)
     ok(event != NULL, "IoCreateSynchronizationEvent failed\n");
 
     ret = wait_single(event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     KeResetEvent(event);
     ret = wait_single(event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
     ret = wait_single_handle(handle, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ret = ZwSetEvent(handle, NULL);
-    ok(!ret, "NtSetEvent returned %#x\n", ret);
+    ok(!ret, "NtSetEvent returned %#lx\n", ret);
     ret = wait_single(event, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     ret = wait_single_handle(handle, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeSetEvent(event, 0, FALSE);
     ret = wait_single_handle(handle, 0);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
     ret = wait_single(event, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ret = ZwClose(handle);
-    ok(!ret, "ZwClose returned %#x\n", ret);
+    ok(!ret, "ZwClose returned %#lx\n", ret);
 
     /* test semaphores */
     KeInitializeSemaphore(&semaphore, 0, 5);
 
     ret = wait_single(&semaphore, 0);
-    ok(ret == STATUS_TIMEOUT, "got %u\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %lu\n", ret);
 
     ret = KeReleaseSemaphore(&semaphore, 0, 1, FALSE);
-    ok(ret == 0, "got prev %d\n", ret);
+    ok(ret == 0, "got prev %ld\n", ret);
 
     ret = KeReleaseSemaphore(&semaphore, 0, 2, FALSE);
-    ok(ret == 1, "got prev %d\n", ret);
+    ok(ret == 1, "got prev %ld\n", ret);
 
     ret = KeReleaseSemaphore(&semaphore, 0, 1, FALSE);
-    ok(ret == 3, "got prev %d\n", ret);
+    ok(ret == 3, "got prev %ld\n", ret);
 
     for (i = 0; i < 4; i++)
     {
         ret = wait_single(&semaphore, 0);
-        ok(ret == 0, "got %#x\n", ret);
+        ok(ret == 0, "got %#lx\n", ret);
     }
 
     ret = wait_single(&semaphore, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeInitializeSemaphore(&semaphore2, 3, 5);
 
     ret = KeReleaseSemaphore(&semaphore2, 0, 1, FALSE);
-    ok(ret == 3, "got prev %d\n", ret);
+    ok(ret == 3, "got prev %ld\n", ret);
 
     for (i = 0; i < 4; i++)
     {
         ret = wait_single(&semaphore2, 0);
-        ok(ret == 0, "got %#x\n", ret);
+        ok(ret == 0, "got %#lx\n", ret);
     }
 
     objs[0] = &semaphore;
     objs[1] = &semaphore2;
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeReleaseSemaphore(&semaphore, 0, 1, FALSE);
     KeReleaseSemaphore(&semaphore2, 0, 1, FALSE);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == 1, "got %#x\n", ret);
+    ok(ret == 1, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     KeReleaseSemaphore(&semaphore, 0, 1, FALSE);
     KeReleaseSemaphore(&semaphore2, 0, 1, FALSE);
 
     ret = wait_multiple(2, objs, WaitAll, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_multiple(2, objs, WaitAny, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     /* test mutexes */
     KeInitializeMutex(&test_mutex, 0);
@@ -816,24 +816,24 @@ static void test_sync(void)
     for (i = 0; i < 10; i++)
     {
         ret = wait_single(&test_mutex, 0);
-        ok(ret == 0, "got %#x\n", ret);
+        ok(ret == 0, "got %#lx\n", ret);
     }
 
     for (i = 0; i < 10; i++)
     {
         ret = KeReleaseMutex(&test_mutex, FALSE);
-        ok(ret == i - 9, "expected %d, got %d\n", i - 9, ret);
+        ok(ret == i - 9, "expected %d, got %ld\n", i - 9, ret);
     }
 
     run_thread(mutex_thread, (void *)0);
 
     ret = wait_single(&test_mutex, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     run_thread(mutex_thread, (void *)STATUS_TIMEOUT);
 
     ret = KeReleaseMutex(&test_mutex, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     run_thread(mutex_thread, (void *)0);
 
@@ -844,13 +844,13 @@ static void test_sync(void)
     KeSetTimerEx(&timer, timeout, 0, NULL);
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&timer, 0);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     KeCancelTimer(&timer);
     KeInitializeTimerEx(&timer, SynchronizationTimer);
@@ -861,36 +861,36 @@ static void test_sync(void)
     KeSetTimerEx(&timer, timeout, 0, &dpc);
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
     ok(!dpc_context.called, "DPC was called unexpectedly.\n");
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     sleep_1ms();
     ok(dpc_context.called, "DPC was not called.\n");
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     KeCancelTimer(&timer);
     KeSetTimerEx(&timer, timeout, 20, NULL);
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&timer, 0);
     /* aliasing makes it sometimes succeeds, try again in that case */
     if (ret == 0) ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     KeCancelTimer(&timer);
 
@@ -899,31 +899,31 @@ static void test_sync(void)
     KeSetTimerEx(&timer, timeout, 0, &dpc);
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
     ok(!dpc_context.called, "DPC was called.\n");
 
     KeCancelTimer(&timer);
     dpc_context.called = 0;
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
     ok(!dpc_context.called, "DPC was called.\n");
 
     KeSetTimerEx(&timer, timeout, 20, &dpc);
     KeSetTimerEx(&timer, timeout, 0, &dpc);
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
 
     KeCancelTimer(&timer);
     /* Test reinitializing timer. */
@@ -931,19 +931,19 @@ static void test_sync(void)
     KeInitializeTimerEx(&timer, SynchronizationTimer);
     dpc_context.called = 0;
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     sleep_1ms();
     todo_wine ok(dpc_context.called, "DPC was not called.\n");
 
     ret = wait_single(&timer, 0);
-    ok(ret == WAIT_TIMEOUT, "got %#x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "got %#lx\n", ret);
     sleep_1ms();
     todo_wine ok(dpc_context.called, "DPC was not called.\n");
 
     dpc_context.called = 0;
     KeSetTimerEx(&timer, timeout, 0, &dpc);
     ret = wait_single(&timer, -40 * 10000);
-    ok(ret == 0, "got %#x\n", ret);
+    ok(ret == 0, "got %#lx\n", ret);
     sleep_1ms();
     ok(dpc_context.called, "DPC was not called.\n");
 
@@ -953,36 +953,36 @@ static void test_sync(void)
     IoInitializeRemoveLockEx(&remove_lock, wine_tag, 0, 0, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
 
     ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
 
     IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
 
     ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
 
     ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
 
     KeInitializeEvent(&remove_lock_ready, SynchronizationEvent, FALSE);
     thread = create_thread(remove_lock_thread, &remove_lock);
     ret = wait_single(&remove_lock_ready, -1000 * 10000);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
     ret = wait_single_handle(thread, -50 * 10000);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_DELETE_PENDING, "got %#x\n", ret);
+    ok(ret == STATUS_DELETE_PENDING, "got %#lx\n", ret);
 
     IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
     ret = wait_single_handle(thread, 0);
-    ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
+    ok(ret == STATUS_TIMEOUT, "got %#lx\n", ret);
 
     IoReleaseRemoveLockEx(&remove_lock, NULL, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
     ret = wait_single_handle(thread, -10000 * 10000);
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
 
     ret = IoAcquireRemoveLockEx(&remove_lock, NULL, "", 1, sizeof(IO_REMOVE_LOCK_COMMON_BLOCK));
-    ok(ret == STATUS_DELETE_PENDING, "got %#x\n", ret);
+    ok(ret == STATUS_DELETE_PENDING, "got %#lx\n", ret);
 }
 
 static void test_call_driver(DEVICE_OBJECT *device)
@@ -1003,9 +1003,9 @@ static void test_call_driver(DEVICE_OBJECT *device)
     ok(irp->CurrentLocation == 2, "CurrentLocation = %u\n", irp->CurrentLocation);
     ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(),
        "IRP thread is not the current thread\n");
-    ok(!irp->IoStatus.Status, "got status %#x\n", irp->IoStatus.Status);
+    ok(!irp->IoStatus.Status, "got status %#lx\n", irp->IoStatus.Status);
     ok(!irp->IoStatus.Information, "got information %#I64x\n", (UINT64)irp->IoStatus.Information);
-    ok(iosb.Status == 0xdeadbeef, "got status %#x\n", iosb.Status);
+    ok(iosb.Status == 0xdeadbeef, "got status %#lx\n", iosb.Status);
     ok(iosb.Information == 0xdeadbeef, "got information %#I64x\n", (UINT64)iosb.Information);
 
     irpsp = IoGetNextIrpStackLocation(irp);
@@ -1015,16 +1015,16 @@ static void test_call_driver(DEVICE_OBJECT *device)
     ok(!irpsp->CompletionRoutine, "CompletionRoutine = %p\n", irpsp->CompletionRoutine);
 
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
-    ok(!irp->IoStatus.Status, "got status %#x\n", irp->IoStatus.Status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
+    ok(!irp->IoStatus.Status, "got status %#lx\n", irp->IoStatus.Status);
     ok(!irp->IoStatus.Information, "got information %#I64x\n", (UINT64)irp->IoStatus.Information);
-    ok(iosb.Status == 0xdeadbeef, "got status %#x\n", iosb.Status);
+    ok(iosb.Status == 0xdeadbeef, "got status %#lx\n", iosb.Status);
     ok(iosb.Information == 0xdeadbeef, "got information %#I64x\n", (UINT64)iosb.Information);
 
     irp->IoStatus.Status = STATUS_SUCCESS;
     irp->IoStatus.Information = 123;
     IoCompleteRequest(irp, IO_NO_INCREMENT);
-    ok(iosb.Status == STATUS_SUCCESS, "got status %#x\n", iosb.Status);
+    ok(iosb.Status == STATUS_SUCCESS, "got status %#lx\n", iosb.Status);
     ok(iosb.Information == 123, "got information %#I64x\n", (UINT64)iosb.Information);
 
     KeInitializeEvent(&event, NotificationEvent, FALSE);
@@ -1045,20 +1045,20 @@ static void test_call_driver(DEVICE_OBJECT *device)
     ok(!irpsp->CompletionRoutine, "CompletionRoutine = %p\n", irpsp->CompletionRoutine);
 
     status = wait_single(&event, 0);
-    ok(status == STATUS_TIMEOUT, "got %#x\n", status);
+    ok(status == STATUS_TIMEOUT, "got %#lx\n", status);
 
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
 
     status = wait_single(&event, 0);
-    ok(status == STATUS_TIMEOUT, "got %#x\n", status);
+    ok(status == STATUS_TIMEOUT, "got %#lx\n", status);
 
     irp->IoStatus.Status = STATUS_SUCCESS;
     irp->IoStatus.Information = 0;
     IoCompleteRequest(irp, IO_NO_INCREMENT);
 
     status = wait_single(&event, 0);
-    ok(status == STATUS_SUCCESS, "got %#x\n", status);
+    ok(status == STATUS_SUCCESS, "got %#lx\n", status);
 }
 
 static int cancel_cnt;
@@ -1113,7 +1113,7 @@ static void test_cancel_irp(DEVICE_OBJECT *device)
 
     /* cancel IRP with cancel routine */
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
 
     ok(irp->CurrentLocation == 1, "CurrentLocation = %u\n", irp->CurrentLocation);
     irpsp = IoGetCurrentIrpStackLocation(irp);
@@ -1139,7 +1139,7 @@ static void test_cancel_irp(DEVICE_OBJECT *device)
     IoSetCompletionRoutine(irp, cancel_test_completion, &completion_called, TRUE, FALSE, TRUE);
 
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
 
     IoSetCancelRoutine(irp, cancel_irp);
     cancel_cnt = 0;
@@ -1157,7 +1157,7 @@ static void test_cancel_irp(DEVICE_OBJECT *device)
     IoSetCompletionRoutine(irp, cancel_test_completion, &completion_called, TRUE, TRUE, FALSE);
 
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
 
     IoSetCancelRoutine(irp, cancel_irp);
     cancel_cnt = 0;
@@ -1175,7 +1175,7 @@ static void test_cancel_irp(DEVICE_OBJECT *device)
     IoSetCompletionRoutine(irp, cancel_test_completion, &completion_called, TRUE, FALSE, FALSE);
 
     status = IoCallDriver(device, irp);
-    ok(status == STATUS_PENDING, "IoCallDriver returned %#x\n", status);
+    ok(status == STATUS_PENDING, "IoCallDriver returned %#lx\n", status);
 
     IoSetCancelRoutine(irp, cancel_irp);
     cancel_cnt = 0;
@@ -1208,7 +1208,7 @@ static void test_stack_callout(void)
     {
         callout_cnt = 0;
         ret = pKeExpandKernelStackAndCallout(callout, (void*)0xdeadbeef, 4096);
-        ok(ret == STATUS_SUCCESS, "KeExpandKernelStackAndCallout failed: %#x\n", ret);
+        ok(ret == STATUS_SUCCESS, "KeExpandKernelStackAndCallout failed: %#lx\n", ret);
         ok(callout_cnt == 1, "callout_cnt = %u\n", callout_cnt);
     }
     else win_skip("KeExpandKernelStackAndCallout is not available\n");
@@ -1218,7 +1218,7 @@ static void test_stack_callout(void)
     {
         callout_cnt = 0;
         ret = pKeExpandKernelStackAndCalloutEx(callout, (void*)0xdeadbeef, 4096, FALSE, NULL);
-        ok(ret == STATUS_SUCCESS, "KeExpandKernelStackAndCalloutEx failed: %#x\n", ret);
+        ok(ret == STATUS_SUCCESS, "KeExpandKernelStackAndCalloutEx failed: %#lx\n", ret);
         ok(callout_cnt == 1, "callout_cnt = %u\n", callout_cnt);
     }
     else win_skip("KeExpandKernelStackAndCalloutEx is not available\n");
@@ -1233,17 +1233,17 @@ static void test_lookaside_list(void)
     ExInitializeNPagedLookasideList(&list, NULL, NULL, POOL_NX_ALLOCATION, LOOKASIDE_MINIMUM_BLOCK_SIZE, tag, 0);
     ok(list.L.Depth == 4, "Expected 4 got %u\n", list.L.Depth);
     ok(list.L.MaximumDepth == 256, "Expected 256 got %u\n", list.L.MaximumDepth);
-    ok(list.L.TotalAllocates == 0, "Expected 0 got %u\n", list.L.TotalAllocates);
-    ok(list.L.AllocateMisses == 0, "Expected 0 got %u\n", list.L.AllocateMisses);
-    ok(list.L.TotalFrees == 0, "Expected 0 got %u\n", list.L.TotalFrees);
-    ok(list.L.FreeMisses == 0, "Expected 0 got %u\n", list.L.FreeMisses);
+    ok(list.L.TotalAllocates == 0, "Expected 0 got %lu\n", list.L.TotalAllocates);
+    ok(list.L.AllocateMisses == 0, "Expected 0 got %lu\n", list.L.AllocateMisses);
+    ok(list.L.TotalFrees == 0, "Expected 0 got %lu\n", list.L.TotalFrees);
+    ok(list.L.FreeMisses == 0, "Expected 0 got %lu\n", list.L.FreeMisses);
     ok(list.L.Type == (NonPagedPool|POOL_NX_ALLOCATION),
        "Expected NonPagedPool|POOL_NX_ALLOCATION got %u\n", list.L.Type);
-    ok(list.L.Tag == tag, "Expected %x got %x\n", tag, list.L.Tag);
+    ok(list.L.Tag == tag, "Expected %lx got %lx\n", tag, list.L.Tag);
     ok(list.L.Size == LOOKASIDE_MINIMUM_BLOCK_SIZE,
-       "Expected %u got %u\n", LOOKASIDE_MINIMUM_BLOCK_SIZE, list.L.Size);
-    ok(list.L.LastTotalAllocates == 0,"Expected 0 got %u\n", list.L.LastTotalAllocates);
-    ok(list.L.LastAllocateMisses == 0,"Expected 0 got %u\n", list.L.LastAllocateMisses);
+       "Expected %Iu got %lu\n", LOOKASIDE_MINIMUM_BLOCK_SIZE, list.L.Size);
+    ok(list.L.LastTotalAllocates == 0,"Expected 0 got %lu\n", list.L.LastTotalAllocates);
+    ok(list.L.LastAllocateMisses == 0,"Expected 0 got %lu\n", list.L.LastAllocateMisses);
     ExDeleteNPagedLookasideList(&list);
 
     list.L.Depth = 0;
@@ -1256,17 +1256,17 @@ static void test_lookaside_list(void)
     ExInitializePagedLookasideList(&paged_list, NULL, NULL, POOL_NX_ALLOCATION, LOOKASIDE_MINIMUM_BLOCK_SIZE, tag, 0);
     ok(paged_list.L.Depth == 4, "Expected 4 got %u\n", paged_list.L.Depth);
     ok(paged_list.L.MaximumDepth == 256, "Expected 256 got %u\n", paged_list.L.MaximumDepth);
-    ok(paged_list.L.TotalAllocates == 0, "Expected 0 got %u\n", paged_list.L.TotalAllocates);
-    ok(paged_list.L.AllocateMisses == 0, "Expected 0 got %u\n", paged_list.L.AllocateMisses);
-    ok(paged_list.L.TotalFrees == 0, "Expected 0 got %u\n", paged_list.L.TotalFrees);
-    ok(paged_list.L.FreeMisses == 0, "Expected 0 got %u\n", paged_list.L.FreeMisses);
+    ok(paged_list.L.TotalAllocates == 0, "Expected 0 got %lu\n", paged_list.L.TotalAllocates);
+    ok(paged_list.L.AllocateMisses == 0, "Expected 0 got %lu\n", paged_list.L.AllocateMisses);
+    ok(paged_list.L.TotalFrees == 0, "Expected 0 got %lu\n", paged_list.L.TotalFrees);
+    ok(paged_list.L.FreeMisses == 0, "Expected 0 got %lu\n", paged_list.L.FreeMisses);
     ok(paged_list.L.Type == (PagedPool|POOL_NX_ALLOCATION),
        "Expected PagedPool|POOL_NX_ALLOCATION got %u\n", paged_list.L.Type);
-    ok(paged_list.L.Tag == tag, "Expected %x got %x\n", tag, paged_list.L.Tag);
+    ok(paged_list.L.Tag == tag, "Expected %lx got %lx\n", tag, paged_list.L.Tag);
     ok(paged_list.L.Size == LOOKASIDE_MINIMUM_BLOCK_SIZE,
-       "Expected %u got %u\n", LOOKASIDE_MINIMUM_BLOCK_SIZE, paged_list.L.Size);
-    ok(paged_list.L.LastTotalAllocates == 0,"Expected 0 got %u\n", paged_list.L.LastTotalAllocates);
-    ok(paged_list.L.LastAllocateMisses == 0,"Expected 0 got %u\n", paged_list.L.LastAllocateMisses);
+       "Expected %Iu got %lu\n", LOOKASIDE_MINIMUM_BLOCK_SIZE, paged_list.L.Size);
+    ok(paged_list.L.LastTotalAllocates == 0,"Expected 0 got %lu\n", paged_list.L.LastTotalAllocates);
+    ok(paged_list.L.LastAllocateMisses == 0,"Expected 0 got %lu\n", paged_list.L.LastAllocateMisses);
     ExDeletePagedLookasideList(&paged_list);
 
     paged_list.L.Depth = 0;
@@ -1286,7 +1286,7 @@ static void test_version(void)
     ok(!!pNtBuildNumber, "Could not get pointer to NtBuildNumber\n");
 
     PsGetVersion(NULL, NULL, &build, NULL);
-    ok(*pNtBuildNumber == build, "Expected build number %u, got %u\n", build, *pNtBuildNumber);
+    ok(*pNtBuildNumber == build, "Expected build number %lu, got %u\n", build, *pNtBuildNumber);
 }
 
 static void WINAPI thread_proc(void *arg)
@@ -1313,31 +1313,31 @@ static void test_ob_reference(void)
 
     InitializeObjectAttributes(&attr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     status = ZwCreateEvent(&event_handle, SYNCHRONIZE, &attr, NotificationEvent, TRUE);
-    ok(!status, "ZwCreateEvent failed: %#x\n", status);
+    ok(!status, "ZwCreateEvent failed: %#lx\n", status);
 
     RtlInitUnicodeString(&pathU, L"\\??\\C:\\windows\\winetest_ntoskrnl_file.tmp");
     attr.ObjectName = &pathU;
     attr.Attributes = OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE;
     status = ZwCreateFile(&file_handle,  DELETE | FILE_WRITE_DATA | SYNCHRONIZE, &attr, &io, NULL, 0, 0, FILE_CREATE,
                           FILE_DELETE_ON_CLOSE | FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
-    ok(!status, "ZwCreateFile failed: %#x\n", status);
+    ok(!status, "ZwCreateFile failed: %#lx\n", status);
 
     status = ZwDuplicateObject(NtCurrentProcess(), file_handle, NtCurrentProcess(), &file_handle2,
                                0, OBJ_KERNEL_HANDLE, DUPLICATE_SAME_ACCESS);
-    ok(!status, "ZwDuplicateObject failed: %#x\n", status);
+    ok(!status, "ZwDuplicateObject failed: %#lx\n", status);
 
     InitializeObjectAttributes(&attr, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
     status = PsCreateSystemThread(&thread_handle, SYNCHRONIZE, &attr, NULL, NULL, thread_proc, NULL);
-    ok(!status, "PsCreateSystemThread returned: %#x\n", status);
+    ok(!status, "PsCreateSystemThread returned: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(NULL, SYNCHRONIZE, *pExEventObjectType, KernelMode, &obj1, NULL);
-    ok(status == STATUS_INVALID_HANDLE, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "ObReferenceObjectByHandle failed: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj1, NULL);
-    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObReferenceObjectByHandle returned: %#x\n", status);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObReferenceObjectByHandle returned: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, NULL, KernelMode, &obj1, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
 
     if (pObGetObjectType)
     {
@@ -1352,26 +1352,26 @@ static void test_ob_reference(void)
     }
 
     status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj2, NULL);
-    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObReferenceObjectByHandle returned: %#x\n", status);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObReferenceObjectByHandle returned: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, *pExEventObjectType, KernelMode, &obj2, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
     ok(obj1 == obj2, "obj1 != obj2\n");
 
     ObDereferenceObject(obj2);
 
     status = ObReferenceObjectByHandle(event_handle, SYNCHRONIZE, NULL, KernelMode, &obj2, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
     ok(obj1 == obj2, "obj1 != obj2\n");
 
     ObDereferenceObject(obj2);
     ObDereferenceObject(obj1);
 
     status = ObReferenceObjectByHandle(file_handle, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj1, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(file_handle2, SYNCHRONIZE, *pIoFileObjectType, KernelMode, &obj2, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
     ok(obj1 == obj2, "obj1 != obj2\n");
 
     file = obj1;
@@ -1381,47 +1381,47 @@ static void test_ob_reference(void)
     ObDereferenceObject(obj2);
 
     status = ObReferenceObjectByHandle(thread_handle, SYNCHRONIZE, *pPsThreadType, KernelMode, &obj1, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(thread_handle, SYNCHRONIZE, *pPsThreadType, KernelMode, &obj2, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
     ok(obj1 == obj2, "obj1 != obj2\n");
 
     header = obj1;
     ok(header->Type == 6, "Type = %u\n", header->Type);
 
     status = wait_single(header, 0);
-    ok(status == 0 || status == STATUS_TIMEOUT, "got %#x\n", status);
+    ok(status == 0 || status == STATUS_TIMEOUT, "got %#lx\n", status);
 
     ObDereferenceObject(obj2);
 
     status = ObOpenObjectByPointer(obj1, OBJ_KERNEL_HANDLE, NULL, 0, NULL, KernelMode, &handle);
-    ok(status == STATUS_SUCCESS, "ObOpenObjectByPointer failed: %#x\n", status);
+    ok(status == STATUS_SUCCESS, "ObOpenObjectByPointer failed: %#lx\n", status);
 
     status = ZwClose(handle);
-    ok(!status, "ZwClose failed: %#x\n", status);
+    ok(!status, "ZwClose failed: %#lx\n", status);
 
     status = ObReferenceObjectByHandle(thread_handle, SYNCHRONIZE, *pPsThreadType, KernelMode, &obj2, NULL);
-    ok(!status, "ObReferenceObjectByHandle failed: %#x\n", status);
+    ok(!status, "ObReferenceObjectByHandle failed: %#lx\n", status);
     ok(obj1 == obj2, "obj1 != obj2\n");
     ObDereferenceObject(obj2);
 
     status = ObOpenObjectByPointer(obj1, OBJ_KERNEL_HANDLE, NULL, 0, *pIoFileObjectType, KernelMode, &handle);
-    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObOpenObjectByPointer returned: %#x\n", status);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "ObOpenObjectByPointer returned: %#lx\n", status);
 
     ObDereferenceObject(obj1);
 
     status = ZwClose(thread_handle);
-    ok(!status, "ZwClose failed: %#x\n", status);
+    ok(!status, "ZwClose failed: %#lx\n", status);
 
     status = ZwClose(event_handle);
-    ok(!status, "ZwClose failed: %#x\n", status);
+    ok(!status, "ZwClose failed: %#lx\n", status);
 
     status = ZwClose(file_handle);
-    ok(!status, "ZwClose failed: %#x\n", status);
+    ok(!status, "ZwClose failed: %#lx\n", status);
 
     status = ZwClose(file_handle2);
-    ok(!status, "ZwClose failed: %#x\n", status);
+    ok(!status, "ZwClose failed: %#lx\n", status);
 }
 
 static void check_resource_(int line, ERESOURCE *resource, ULONG exclusive_waiters,
@@ -1432,16 +1432,16 @@ static void check_resource_(int line, ERESOURCE *resource, ULONG exclusive_waite
 
     count = ExGetExclusiveWaiterCount(resource);
     ok_(__FILE__, line)(count == exclusive_waiters,
-            "expected %u exclusive waiters, got %u\n", exclusive_waiters, count);
+            "expected %lu exclusive waiters, got %lu\n", exclusive_waiters, count);
     count = ExGetSharedWaiterCount(resource);
     ok_(__FILE__, line)(count == shared_waiters,
-            "expected %u shared waiters, got %u\n", shared_waiters, count);
+            "expected %lu shared waiters, got %lu\n", shared_waiters, count);
     ret = ExIsResourceAcquiredExclusiveLite(resource);
     ok_(__FILE__, line)(ret == exclusive,
             "expected exclusive %u, got %u\n", exclusive, ret);
     count = ExIsResourceAcquiredSharedLite(resource);
     ok_(__FILE__, line)(count == shared_count,
-            "expected shared %u, got %u\n", shared_count, count);
+            "expected shared %lu, got %lu\n", shared_count, count);
 }
 #define check_resource(a,b,c,d,e) check_resource_(__LINE__,a,b,c,d,e)
 
@@ -1497,7 +1497,7 @@ static void test_resource(void)
     memset(&resource, 0xcc, sizeof(resource));
 
     status = ExInitializeResourceLite(&resource);
-    ok(status == STATUS_SUCCESS, "got status %#x\n", status);
+    ok(status == STATUS_SUCCESS, "got status %#lx\n", status);
     check_resource(&resource, 0, 0, FALSE, 0);
 
     KeEnterCriticalRegion();
@@ -1709,7 +1709,7 @@ static void test_resource(void)
     KeLeaveCriticalRegion();
 
     status = ExDeleteResourceLite(&resource);
-    ok(status == STATUS_SUCCESS, "got status %#x\n", status);
+    ok(status == STATUS_SUCCESS, "got status %#lx\n", status);
 }
 
 static void test_lookup_thread(void)
@@ -1718,13 +1718,13 @@ static void test_lookup_thread(void)
     PETHREAD thread = NULL;
 
     status = PsLookupThreadByThreadId(PsGetCurrentThreadId(), &thread);
-    ok(!status, "PsLookupThreadByThreadId failed: %#x\n", status);
+    ok(!status, "PsLookupThreadByThreadId failed: %#lx\n", status);
     ok((PKTHREAD)thread == KeGetCurrentThread(), "thread != KeGetCurrentThread\n");
     if (thread) ObDereferenceObject(thread);
 
     status = PsLookupThreadByThreadId(NULL, &thread);
     ok(status == STATUS_INVALID_CID || broken(status == STATUS_INVALID_PARAMETER) /* winxp */,
-       "PsLookupThreadByThreadId returned %#x\n", status);
+       "PsLookupThreadByThreadId returned %#lx\n", status);
 }
 
 static void test_stack_limits(void)
@@ -1792,7 +1792,7 @@ static void test_completion(void)
             NULL, 0, NULL, 0, FALSE, &event, &io);
     IoSetCompletionRoutine(irp, completion_cb, NULL, TRUE, TRUE, TRUE);
     ret = IoCallDriver(upper_device, irp);
-    ok(ret == STATUS_SUCCESS, "IoCallDriver returned %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "IoCallDriver returned %#lx\n", ret);
     ok(got_completion == 2, "got %u calls to completion routine\n", got_completion);
 
     completion_lower_pending = TRUE;
@@ -1802,7 +1802,7 @@ static void test_completion(void)
             NULL, 0, NULL, 0, FALSE, &event, &io);
     IoSetCompletionRoutine(irp, completion_cb, NULL, TRUE, TRUE, TRUE);
     ret = IoCallDriver(upper_device, irp);
-    ok(ret == STATUS_PENDING, "IoCallDriver returned %#x\n", ret);
+    ok(ret == STATUS_PENDING, "IoCallDriver returned %#lx\n", ret);
     ok(!got_completion, "got %u calls to completion routine\n", got_completion);
 
     ok(irp->CurrentLocation == 1, "Got current location %u.\n", irp->CurrentLocation);
@@ -1819,7 +1819,7 @@ static void test_completion(void)
             NULL, 0, NULL, 0, FALSE, &event, &io);
     IoSetCompletionRoutine(irp, completion_cb, NULL, TRUE, TRUE, TRUE);
     ret = IoCallDriver(upper_device, irp);
-    ok(ret == STATUS_PENDING, "IoCallDriver returned %#x\n", ret);
+    ok(ret == STATUS_PENDING, "IoCallDriver returned %#lx\n", ret);
     ok(!got_completion, "got %u calls to completion routine\n", got_completion);
 
     ok(irp->CurrentLocation == 1, "Got current location %u.\n", irp->CurrentLocation);
@@ -1898,14 +1898,14 @@ static void test_object_name(void)
 
     ret_size = 0;
     ret = ObQueryNameString(lower_device, name, 0, &ret_size);
-    ok(ret == STATUS_INFO_LENGTH_MISMATCH, "got status %#x\n", ret);
-    ok(ret_size == sizeof(*name) + sizeof(device_nameW), "got size %u\n", ret_size);
+    ok(ret == STATUS_INFO_LENGTH_MISMATCH, "got status %#lx\n", ret);
+    ok(ret_size == sizeof(*name) + sizeof(device_nameW), "got size %lu\n", ret_size);
 
     ret_size = 0;
     ret = ObQueryNameString(lower_device, name, sizeof(buffer), &ret_size);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ok(!wcscmp(name->Name.Buffer, device_nameW), "got name %ls\n", name->Name.Buffer);
-    ok(ret_size == sizeof(*name) + sizeof(device_nameW), "got size %u\n", ret_size);
+    ok(ret_size == sizeof(*name) + sizeof(device_nameW), "got size %lu\n", ret_size);
     ok(name->Name.Length == wcslen(device_nameW) * sizeof(WCHAR), "got length %u\n", name->Name.Length);
     ok(name->Name.MaximumLength == sizeof(device_nameW), "got maximum length %u\n", name->Name.MaximumLength);
 
@@ -1914,47 +1914,47 @@ static void test_object_name(void)
 
     ret_size = 0;
     ret = ObQueryNameString(event, name, sizeof(buffer), &ret_size);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ok(!name->Name.Buffer, "got name %ls\n", name->Name.Buffer);
-    ok(ret_size == sizeof(*name), "got size %u\n", ret_size);
+    ok(ret_size == sizeof(*name), "got size %lu\n", ret_size);
     ok(!name->Name.Length, "got length %u\n", name->Name.Length);
     ok(!name->Name.MaximumLength, "got maximum length %u\n", name->Name.MaximumLength);
 
     ret = ZwClose(handle);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
 
     RtlInitUnicodeString(&string, event_nameW);
     InitializeObjectAttributes(&attr, &string, OBJ_KERNEL_HANDLE, NULL, NULL);
     ret = ZwCreateEvent(&handle, 0, &attr, NotificationEvent, TRUE);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ret = ObReferenceObjectByHandle(handle, 0, *pExEventObjectType, KernelMode, (void **)&event, NULL);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
 
     ret_size = 0;
     ret = ObQueryNameString(event, name, sizeof(buffer), &ret_size);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ok(!wcscmp(name->Name.Buffer, event_nameW), "got name %ls\n", name->Name.Buffer);
-    ok(ret_size == sizeof(*name) + sizeof(event_nameW), "got size %u\n", ret_size);
+    ok(ret_size == sizeof(*name) + sizeof(event_nameW), "got size %lu\n", ret_size);
     ok(name->Name.Length == wcslen(event_nameW) * sizeof(WCHAR), "got length %u\n", name->Name.Length);
     ok(name->Name.MaximumLength == sizeof(event_nameW), "got maximum length %u\n", name->Name.MaximumLength);
 
     ObDereferenceObject(event);
     ret = ZwClose(handle);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
 
     ret_size = 0;
     ret = ObQueryNameString(KeGetCurrentThread(), name, sizeof(buffer), &ret_size);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ok(!name->Name.Buffer, "got name %ls\n", name->Name.Buffer);
-    ok(ret_size == sizeof(*name), "got size %u\n", ret_size);
+    ok(ret_size == sizeof(*name), "got size %lu\n", ret_size);
     ok(!name->Name.Length, "got length %u\n", name->Name.Length);
     ok(!name->Name.MaximumLength, "got maximum length %u\n", name->Name.MaximumLength);
 
     ret_size = 0;
     ret = ObQueryNameString(IoGetCurrentProcess(), name, sizeof(buffer), &ret_size);
-    ok(!ret, "got status %#x\n", ret);
+    ok(!ret, "got status %#lx\n", ret);
     ok(!name->Name.Buffer, "got name %ls\n", name->Name.Buffer);
-    ok(ret_size == sizeof(*name), "got size %u\n", ret_size);
+    ok(ret_size == sizeof(*name), "got size %lu\n", ret_size);
     ok(!name->Name.Length, "got length %u\n", name->Name.Length);
     ok(!name->Name.MaximumLength, "got maximum length %u\n", name->Name.MaximumLength);
 }
@@ -2023,45 +2023,45 @@ static void test_affinity(void)
     ok(!!pKeRevertToUserAffinityThreadEx, "KeRevertToUserAffinityThreadEx is not available.\n");
 
     count = pKeQueryActiveProcessorCountEx(1);
-    ok(!count, "Got unexpected count %u.\n", count);
+    ok(!count, "Got unexpected count %lu.\n", count);
 
     cpu_count = pKeQueryActiveProcessorCountEx(0);
-    ok(cpu_count, "Got unexpected cpu_count %u.\n", cpu_count);
+    ok(cpu_count, "Got unexpected cpu_count %lu.\n", cpu_count);
 
     count = pKeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
-    ok(count == cpu_count, "Got unexpected count %u.\n", count);
+    ok(count == cpu_count, "Got unexpected count %lu.\n", count);
 
     mask_all_cpus = ~((~0u) << cpu_count);
 
     mask = pKeQueryActiveProcessors();
-    ok(mask == mask_all_cpus, "Got unexpected mask %#lx.\n", mask);
+    ok(mask == mask_all_cpus, "Got unexpected mask %#Ix.\n", mask);
 
     pKeRevertToUserAffinityThreadEx(0x2);
 
     mask = pKeSetSystemAffinityThreadEx(0);
-    ok(!mask, "Got unexpected mask %#lx.\n", mask);
+    ok(!mask, "Got unexpected mask %#Ix.\n", mask);
 
     pKeRevertToUserAffinityThreadEx(0x2);
 
     mask = pKeSetSystemAffinityThreadEx(0x1);
-    ok(mask == 0x2, "Got unexpected mask %#lx.\n", mask);
+    ok(mask == 0x2, "Got unexpected mask %#Ix.\n", mask);
 
     mask = pKeSetSystemAffinityThreadEx(~(KAFFINITY)0);
-    ok(mask == 0x1, "Got unexpected mask %#lx.\n", mask);
+    ok(mask == 0x1, "Got unexpected mask %#Ix.\n", mask);
 
     pKeRevertToUserAffinityThreadEx(~(KAFFINITY)0);
     mask = pKeSetSystemAffinityThreadEx(0x1);
-    ok(mask == mask_all_cpus, "Got unexpected mask %#lx.\n", mask);
+    ok(mask == mask_all_cpus, "Got unexpected mask %#Ix.\n", mask);
 
     pKeRevertToUserAffinityThreadEx(0);
 
     mask = pKeSetSystemAffinityThreadEx(0x1);
-    ok(!mask, "Got unexpected mask %#lx.\n", mask);
+    ok(!mask, "Got unexpected mask %#Ix.\n", mask);
 
     KeRevertToUserAffinityThread();
 
     mask = pKeSetSystemAffinityThreadEx(0x1);
-    ok(!mask, "Got unexpected mask %#lx.\n", mask);
+    ok(!mask, "Got unexpected mask %#Ix.\n", mask);
 
     KeRevertToUserAffinityThread();
 }
@@ -2149,30 +2149,30 @@ static void test_dpc(void)
     KeSetSystemAffinityThread(0x1);
 
     pKeGenericCallDpc(test_dpc_func, &data);
-    ok(data.call_count == cpu_count, "Got unexpected call_count %u.\n", data.call_count);
-    ok(data.selected_count == 2, "Got unexpected selected_count %u.\n", data.selected_count);
+    ok(data.call_count == cpu_count, "Got unexpected call_count %lu.\n", data.call_count);
+    ok(data.selected_count == 2, "Got unexpected selected_count %lu.\n", data.selected_count);
     ok(data.sync_barrier_start_value.Barrier == cpu_count,
-            "Got unexpected sync_barrier_start_value.Barrier %d.\n",
+            "Got unexpected sync_barrier_start_value.Barrier %ld.\n",
             data.sync_barrier_start_value.Barrier);
     ok(data.sync_barrier_start_value.TotalProcessors == cpu_count,
-            "Got unexpected sync_barrier_start_value.TotalProcessors %d.\n",
+            "Got unexpected sync_barrier_start_value.TotalProcessors %ld.\n",
             data.sync_barrier_start_value.TotalProcessors);
 
     ok(data.sync_barrier_mid_value.Barrier == (0x80000000 | cpu_count),
-            "Got unexpected sync_barrier_mid_value.Barrier %d.\n",
+            "Got unexpected sync_barrier_mid_value.Barrier %ld.\n",
             data.sync_barrier_mid_value.Barrier);
     ok(data.sync_barrier_mid_value.TotalProcessors == cpu_count,
-            "Got unexpected sync_barrier_mid_value.TotalProcessors %d.\n",
+            "Got unexpected sync_barrier_mid_value.TotalProcessors %ld.\n",
             data.sync_barrier_mid_value.TotalProcessors);
 
     ok(data.sync_barrier_end_value.Barrier == cpu_count,
-            "Got unexpected sync_barrier_end_value.Barrier %d.\n",
+            "Got unexpected sync_barrier_end_value.Barrier %ld.\n",
             data.sync_barrier_end_value.Barrier);
     ok(data.sync_barrier_end_value.TotalProcessors == cpu_count,
-            "Got unexpected sync_barrier_end_value.TotalProcessors %d.\n",
+            "Got unexpected sync_barrier_end_value.TotalProcessors %ld.\n",
             data.sync_barrier_end_value.TotalProcessors);
 
-    ok(data.done_barrier_start_value == cpu_count, "Got unexpected done_barrier_start_value %d.\n", data.done_barrier_start_value);
+    ok(data.done_barrier_start_value == cpu_count, "Got unexpected done_barrier_start_value %ld.\n", data.done_barrier_start_value);
 
     KeRevertToUserAffinityThread();
 }
@@ -2192,7 +2192,7 @@ static void test_process_memory(const struct main_test_input *test_input)
     pMmCopyVirtualMemory = get_proc_address("MmCopyVirtualMemory");
 
     status = PsLookupProcessByProcessId((HANDLE)(ULONG_PTR)test_input->process_id, &process);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
 
     if (status)
         return;
@@ -2212,8 +2212,8 @@ static void test_process_memory(const struct main_test_input *test_input)
         size = 0xdeadbeef;
         status = pMmCopyVirtualMemory(process, base + test_input->teststr_offset, PsGetCurrentProcess(),
                 buffer, sizeof(buffer), UserMode, &size);
-        todo_wine ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#x.\n", status);
-        ok(!size, "Got unexpected size %#lx.\n", size);
+        todo_wine ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#lx.\n", status);
+        ok(!size, "Got unexpected size %#Ix.\n", size);
 
         memset(buffer, 0, sizeof(buffer));
         size = 0xdeadbeef;
@@ -2222,8 +2222,8 @@ static void test_process_memory(const struct main_test_input *test_input)
                                  buffer, sizeof(buffer), KernelMode, NULL);
         status = pMmCopyVirtualMemory(process, base + test_input->teststr_offset, PsGetCurrentProcess(),
                 buffer, sizeof(buffer), KernelMode, &size);
-        todo_wine ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-        todo_wine ok(size == sizeof(buffer), "Got unexpected size %lu.\n", size);
+        todo_wine ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+        todo_wine ok(size == sizeof(buffer), "Got unexpected size %Iu.\n", size);
         todo_wine ok(!strcmp(buffer, teststr), "Got unexpected test string.\n");
     }
     else
@@ -2252,42 +2252,42 @@ static void test_permanence(void)
     RtlInitUnicodeString(&str, L"\\BaseNamedObjects\\wine_test_dir");
     InitializeObjectAttributes(&attr, &str, 0, 0, NULL);
     status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwClose( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwOpenDirectoryObject( &handle, 0, &attr );
-    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
+    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#lx\n", status);
 
     attr.Attributes = OBJ_PERMANENT;
     status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwClose( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
 
     attr.Attributes = 0;
     status = ZwOpenDirectoryObject( &handle, 0, &attr );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwMakeTemporaryObject( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwMakeTemporaryObject( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwClose( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwOpenDirectoryObject( &handle, 0, &attr );
-    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
+    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#lx\n", status);
 
     status = ZwCreateDirectoryObject( &handle, GENERIC_ALL, &attr );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     attr.Attributes = OBJ_PERMANENT;
     status = ZwOpenDirectoryObject( &handle2, 0, &attr );
-    ok(status == STATUS_SUCCESS, "got %#x\n", status);
+    ok(status == STATUS_SUCCESS, "got %#lx\n", status);
     status = ZwClose( handle2 );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     status = ZwClose( handle );
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     attr.Attributes = 0;
     status = ZwOpenDirectoryObject( &handle, 0, &attr );
-    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#x\n", status);
+    ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "got %#lx\n", status);
 }
 
 static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *stack)
@@ -2818,7 +2818,7 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry)
 
     RtlInitUnicodeString(&nameW, L"\\Driver\\WineTestDriver");
     status = ObReferenceObjectByName(&nameW, 0, NULL, 0, *pIoDriverObjectType, KernelMode, NULL, &obj);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(obj == driver, "expected %p, got %p\n", driver, obj);
     ObDereferenceObject(obj);
 
@@ -2826,14 +2826,14 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry)
     RtlInitUnicodeString(&linkW, L"\\DosDevices\\WineTestDriver");
 
     status = IoCreateDevice(driver, 0, &nameW, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &lower_device);
-    ok(!status, "failed to create device, status %#x\n", status);
+    ok(!status, "failed to create device, status %#lx\n", status);
     status = IoCreateSymbolicLink(&linkW, &nameW);
-    ok(!status, "failed to create link, status %#x\n", status);
+    ok(!status, "failed to create link, status %#lx\n", status);
     lower_device->Flags &= ~DO_DEVICE_INITIALIZING;
 
     RtlInitUnicodeString(&nameW, L"\\Device\\WineTestUpper");
     status = IoCreateDevice(driver, 0, &nameW, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &upper_device);
-    ok(!status, "failed to create device, status %#x\n", status);
+    ok(!status, "failed to create device, status %#lx\n", status);
 
     IoAttachDeviceToDeviceStack(upper_device, lower_device);
     upper_device->Flags &= ~DO_DEVICE_INITIALIZING;
diff --git a/dlls/ntoskrnl.exe/tests/driver_netio.c b/dlls/ntoskrnl.exe/tests/driver_netio.c
index 4ebacc7cf14..e406f49eacb 100644
--- a/dlls/ntoskrnl.exe/tests/driver_netio.c
+++ b/dlls/ntoskrnl.exe/tests/driver_netio.c
@@ -66,10 +66,10 @@ static void netio_init(void)
 
     client_npi.Dispatch = &client_dispatch;
     status = WskRegister(&client_npi, &registration);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
 
     status = WskCaptureProviderNPI(&registration, WSK_INFINITE_WAIT, &provider_npi);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
 
     ok(provider_npi.Dispatch->Version >= MAKE_WSK_VERSION(1, 0), "Got unexpected version %#x.\n",
             provider_npi.Dispatch->Version);
@@ -99,9 +99,9 @@ static void test_wsk_get_address_info(void)
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = provider_npi.Dispatch->WskGetAddressInfo(provider_npi.Client, &node_name, &service_name,
             NS_ALL, NULL, NULL, &result, NULL, NULL, NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == 0xdeadbeef, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(wsk_irp->IoStatus.Information == 0xdeadbeef, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == 0xdeadbeef, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(wsk_irp->IoStatus.Information == 0xdeadbeef, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     RtlInitUnicodeString(&node_name, L"dead.beef");
@@ -112,13 +112,13 @@ static void test_wsk_get_address_info(void)
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = provider_npi.Dispatch->WskGetAddressInfo(provider_npi.Client, &node_name, &service_name,
             NS_ALL, NULL, NULL,  &result, NULL, NULL, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
     ok(wsk_irp->IoStatus.Status == STATUS_NOT_FOUND
             || broken(wsk_irp->IoStatus.Status == STATUS_NO_MATCH) /* Win7 */,
-            "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(wsk_irp->IoStatus.Information == 0, "Got unexpected Information %#lx.\n",
+            "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(wsk_irp->IoStatus.Information == 0, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     RtlInitUnicodeString(&node_name, L"127.0.0.1");
@@ -128,11 +128,11 @@ static void test_wsk_get_address_info(void)
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = provider_npi.Dispatch->WskGetAddressInfo(provider_npi.Client, &node_name, &service_name,
             NS_ALL, NULL, NULL, &result, NULL, NULL, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(wsk_irp->IoStatus.Information == 0, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(wsk_irp->IoStatus.Information == 0, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     count = 0;
@@ -144,7 +144,7 @@ static void test_wsk_get_address_info(void)
         ok(addr_info->ai_addrlen == sizeof(*addr), "Got unexpected ai_addrlen %I64u.\n", (UINT64)addr_info->ai_addrlen);
         ok(addr->sin_family == AF_INET, "Got unexpected sin_family %u.\n", addr->sin_family);
         ok(ntohs(addr->sin_port) == 12345, "Got unexpected sin_port %u.\n", ntohs(addr->sin_port));
-        ok(ntohl(addr->sin_addr.s_addr) == 0x7f000001, "Got unexpected sin_addr %#x.\n",
+        ok(ntohl(addr->sin_addr.s_addr) == 0x7f000001, "Got unexpected sin_addr %#lx.\n",
                 ntohl(addr->sin_addr.s_addr));
 
         ++count;
@@ -196,13 +196,13 @@ static void test_wsk_listen_socket(void)
 
     status = provider_npi.Dispatch->WskSocket(NULL, AF_INET, SOCK_STREAM, IPPROTO_TCP,
             WSK_FLAG_LISTEN_SOCKET, &context, &client_listen_dispatch, NULL, NULL, NULL, NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
 
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     status = provider_npi.Dispatch->WskSocket(NULL, AF_INET, SOCK_STREAM, IPPROTO_TCP,
             WSK_FLAG_LISTEN_SOCKET, &context, &client_listen_dispatch, NULL, NULL, NULL, wsk_irp);
-    ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#lx.\n", status);
 
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
@@ -210,10 +210,10 @@ static void test_wsk_listen_socket(void)
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = provider_npi.Dispatch->WskSocket(provider_npi.Client, AF_INET, SOCK_STREAM, IPPROTO_TCP,
             WSK_FLAG_LISTEN_SOCKET, &context, &client_listen_dispatch, NULL, NULL, NULL, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
     ok(wsk_irp->IoStatus.Information, "Got zero Information.\n");
 
     tcp_socket = (WSK_SOCKET *)wsk_irp->IoStatus.Information;
@@ -223,10 +223,10 @@ static void test_wsk_listen_socket(void)
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     status = provider_npi.Dispatch->WskSocket(provider_npi.Client, AF_INET, SOCK_DGRAM, IPPROTO_UDP,
             WSK_FLAG_LISTEN_SOCKET, &context, &client_listen_dispatch, NULL, NULL, NULL, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
     ok(wsk_irp->IoStatus.Information, "Got zero Information.\n");
 
     udp_socket = (WSK_SOCKET *)wsk_irp->IoStatus.Information;
@@ -241,20 +241,20 @@ static void test_wsk_listen_socket(void)
     wsk_irp->IoStatus.Status = 0xdeadbeef;
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = udp_dispatch->WskBind(udp_socket, (SOCKADDR *)&addr, 0, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_NOT_IMPLEMENTED, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_NOT_IMPLEMENTED, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     status = udp_dispatch->Basic.WskCloseSocket(udp_socket, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
 
     do
     {
@@ -263,13 +263,13 @@ static void test_wsk_listen_socket(void)
         wsk_irp->IoStatus.Status = 0xdeadbeef;
         wsk_irp->IoStatus.Information = 0xdeadbeef;
         status = tcp_dispatch->WskBind(tcp_socket, (SOCKADDR *)&addr, 0, wsk_irp);
-        ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
         status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-        ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
         ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS
                 || wsk_irp->IoStatus.Status == STATUS_ADDRESS_ALREADY_ASSOCIATED,
-                "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-        ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+                "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+        ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
                 wsk_irp->IoStatus.Information);
     }
     while (wsk_irp->IoStatus.Status == STATUS_ADDRESS_ALREADY_ASSOCIATED);
@@ -282,7 +282,7 @@ static void test_wsk_listen_socket(void)
     memset(&remote_addr, 0, sizeof(remote_addr));
     status = tcp_dispatch->WskAccept(tcp_socket, 0, NULL, NULL,
             (SOCKADDR *)&local_addr, (SOCKADDR *)&remote_addr, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
 
     if (0)
     {
@@ -290,12 +290,12 @@ static void test_wsk_listen_socket(void)
         IoReuseIrp(irp, STATUS_UNSUCCESSFUL);
         IoSetCompletionRoutine(irp, irp_completion_routine, &event, TRUE, TRUE, TRUE);
         status = tcp_dispatch->WskAccept(tcp_socket, 0, NULL, NULL, NULL, NULL, irp);
-        ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     }
 
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, &timeout);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
     ok(wsk_irp->IoStatus.Information, "Got zero Information.\n");
 
     if (status == STATUS_SUCCESS && wsk_irp->IoStatus.Status == STATUS_SUCCESS)
@@ -303,12 +303,12 @@ static void test_wsk_listen_socket(void)
         ok(local_addr.sin_family == AF_INET, "Got unexpected sin_family %u.\n", local_addr.sin_family);
         ok(local_addr.sin_port == htons(SERVER_LISTEN_PORT), "Got unexpected sin_port %u.\n",
                 ntohs(local_addr.sin_port));
-        ok(local_addr.sin_addr.s_addr == htonl(0x7f000001), "Got unexpected sin_addr %#x.\n",
+        ok(local_addr.sin_addr.s_addr == htonl(0x7f000001), "Got unexpected sin_addr %#lx.\n",
                 ntohl(local_addr.sin_addr.s_addr));
 
         ok(remote_addr.sin_family == AF_INET, "Got unexpected sin_family %u.\n", remote_addr.sin_family);
         ok(remote_addr.sin_port, "Got zero sin_port.\n");
-        ok(remote_addr.sin_addr.s_addr == htonl(0x7f000001), "Got unexpected sin_addr %#x.\n",
+        ok(remote_addr.sin_addr.s_addr == htonl(0x7f000001), "Got unexpected sin_addr %#lx.\n",
                 ntohl(remote_addr.sin_addr.s_addr));
 
         accept_socket = (WSK_SOCKET *)wsk_irp->IoStatus.Information;
@@ -317,7 +317,7 @@ static void test_wsk_listen_socket(void)
         IoReuseIrp(irp, STATUS_UNSUCCESSFUL);
         IoSetCompletionRoutine(irp, irp_completion_routine, &event, TRUE, TRUE, TRUE);
         status = accept_dispatch->WskReceive(accept_socket, &wsk_buf2, 0, irp);
-        ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
 
         IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
         IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
@@ -325,29 +325,29 @@ static void test_wsk_listen_socket(void)
         /* Setting Length in WSK_BUF greater than MDL allocation size BSODs Windows.
          * wsk_buf1.Length = TEST_BUFFER_LENGTH * 2; */
         status = accept_dispatch->WskSend(accept_socket, &wsk_buf1, 0, wsk_irp);
-        ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
 
         status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, &timeout);
-        ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-        ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-        ok(wsk_irp->IoStatus.Information == TEST_BUFFER_LENGTH, "Got unexpected status %#x.\n",
+        ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+        ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+        ok(wsk_irp->IoStatus.Information == TEST_BUFFER_LENGTH, "Got unexpected status %#lx.\n",
                 wsk_irp->IoStatus.Status);
 
         status = KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &timeout);
-        ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-        ok(irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", irp->IoStatus.Status);
-        ok(irp->IoStatus.Information == sizeof(test_receive_string), "Got unexpected Information %#lx.\n",
+        ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+        ok(irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", irp->IoStatus.Status);
+        ok(irp->IoStatus.Information == sizeof(test_receive_string), "Got unexpected Information %#Ix.\n",
                 irp->IoStatus.Information);
         ok(!strcmp(buffer2, test_receive_string), "Received unexpected data.\n");
 
         IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
         IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
         status = accept_dispatch->Basic.WskCloseSocket(accept_socket, wsk_irp);
-        ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+        ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
         status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-        ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-        ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-        ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+        ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+        ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+        ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
                 wsk_irp->IoStatus.Information);
     }
 
@@ -355,24 +355,24 @@ static void test_wsk_listen_socket(void)
     IoReuseIrp(irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(irp, irp_completion_routine, &event, TRUE, TRUE, TRUE);
     status = tcp_dispatch->WskAccept(tcp_socket, 0, NULL, NULL, NULL, NULL, irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
 
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     wsk_irp->IoStatus.Status = 0xdeadbeef;
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = tcp_dispatch->Basic.WskCloseSocket(tcp_socket, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     status = KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, &timeout);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(irp->IoStatus.Status == STATUS_CANCELLED, "Got unexpected status %#x.\n", irp->IoStatus.Status);
-    ok(!irp->IoStatus.Information, "Got unexpected Information %#lx.\n", irp->IoStatus.Information);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(irp->IoStatus.Status == STATUS_CANCELLED, "Got unexpected status %#lx.\n", irp->IoStatus.Status);
+    ok(!irp->IoStatus.Information, "Got unexpected Information %#Ix.\n", irp->IoStatus.Information);
     IoFreeIrp(irp);
 
     IoFreeMdl(mdl1);
@@ -398,10 +398,10 @@ static void test_wsk_connect_socket(void)
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = provider_npi.Dispatch->WskSocket(provider_npi.Client, AF_INET, SOCK_STREAM, IPPROTO_TCP,
             WSK_FLAG_CONNECTION_SOCKET, &context, &connect_dispatch, NULL, NULL, NULL, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
     ok(wsk_irp->IoStatus.Information, "Got zero Information.\n");
 
     socket = (WSK_SOCKET *)wsk_irp->IoStatus.Information;
@@ -415,11 +415,11 @@ static void test_wsk_connect_socket(void)
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     status = connect_dispatch->WskConnect(socket, (SOCKADDR *)&addr, 0, wsk_irp);
-    ok(status == STATUS_INVALID_DEVICE_STATE, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_DEVICE_STATE, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, &timeout);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_INVALID_DEVICE_STATE, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_INVALID_DEVICE_STATE, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     memset(&addr, 0, sizeof(addr));
@@ -430,11 +430,11 @@ static void test_wsk_connect_socket(void)
     wsk_irp->IoStatus.Status = 0xdeadbeef;
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = connect_dispatch->WskBind(socket, (SOCKADDR *)&addr, 0, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     addr.sin_port = htons(CLIENT_LISTEN_PORT);
@@ -443,11 +443,11 @@ static void test_wsk_connect_socket(void)
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
     IoSetCompletionRoutine(wsk_irp, irp_completion_routine, &irp_complete_event, TRUE, TRUE, TRUE);
     status = connect_dispatch->WskConnect(socket, (SOCKADDR *)&addr, 0, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, &timeout);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 
     IoReuseIrp(wsk_irp, STATUS_UNSUCCESSFUL);
@@ -455,11 +455,11 @@ static void test_wsk_connect_socket(void)
     wsk_irp->IoStatus.Status = 0xdeadbeef;
     wsk_irp->IoStatus.Information = 0xdeadbeef;
     status = connect_dispatch->Basic.WskCloseSocket(socket, wsk_irp);
-    ok(status == STATUS_PENDING, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_PENDING, "Got unexpected status %#lx.\n", status);
     status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
-    ok(status == STATUS_SUCCESS, "Got unexpected status %#x.\n", status);
-    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#x.\n", wsk_irp->IoStatus.Status);
-    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#lx.\n",
+    ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
+    ok(wsk_irp->IoStatus.Status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", wsk_irp->IoStatus.Status);
+    ok(!wsk_irp->IoStatus.Information, "Got unexpected Information %#Ix.\n",
             wsk_irp->IoStatus.Information);
 }
 
@@ -552,9 +552,9 @@ NTSTATUS WINAPI DriverEntry(DRIVER_OBJECT *driver, PUNICODE_STRING registry)
     RtlInitUnicodeString(&linkW, driver_link);
 
     status = IoCreateDevice(driver, 0, &nameW, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &device_obj);
-    ok(!status, "failed to create device, status %#x\n", status);
+    ok(!status, "failed to create device, status %#lx\n", status);
     status = IoCreateSymbolicLink(&linkW, &nameW);
-    ok(!status, "failed to create link, status %#x\n", status);
+    ok(!status, "failed to create link, status %#lx\n", status);
     device_obj->Flags &= ~DO_DEVICE_INITIALIZING;
 
     return STATUS_SUCCESS;
diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c
index aa078ab0b2f..972cc61c6df 100644
--- a/dlls/ntoskrnl.exe/tests/driver_pnp.c
+++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c
@@ -264,7 +264,7 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
             ok(!stack->Parameters.StartDevice.AllocatedResourcesTranslated, "expected no translated resources\n");
 
             status = IoRegisterDeviceInterface(device_obj, &child_class, NULL, &device->child_symlink);
-            ok(!status, "Failed to register interface, status %#x.\n", status);
+            ok(!status, "Failed to register interface, status %#lx.\n", status);
 
             IoSetDeviceInterfaceState(&device->child_symlink, TRUE);
 
@@ -322,15 +322,15 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
             ok(!caps->NonDynamic, "got NonDynamic %u\n", caps->NonDynamic);
             ok(!caps->WarmEjectSupported, "got WarmEjectSupported %u\n", caps->WarmEjectSupported);
             ok(!caps->NoDisplayInUI, "got NoDisplayInUI %u\n", caps->NoDisplayInUI);
-            ok(caps->Address == 0xffffffff, "got Address %#x\n", caps->Address);
-            ok(caps->UINumber == 0xffffffff, "got UINumber %#x\n", caps->UINumber);
+            ok(caps->Address == 0xffffffff, "got Address %#lx\n", caps->Address);
+            ok(caps->UINumber == 0xffffffff, "got UINumber %#lx\n", caps->UINumber);
             for (i = 0; i < PowerSystemMaximum; ++i)
                 ok(caps->DeviceState[i] == PowerDeviceUnspecified, "got DeviceState[%u] %u\n", i, caps->DeviceState[i]);
             ok(caps->SystemWake == PowerSystemUnspecified, "got SystemWake %u\n", caps->SystemWake);
             ok(caps->DeviceWake == PowerDeviceUnspecified, "got DeviceWake %u\n", caps->DeviceWake);
-            ok(!caps->D1Latency, "got D1Latency %u\n", caps->D1Latency);
-            ok(!caps->D2Latency, "got D2Latency %u\n", caps->D2Latency);
-            ok(!caps->D3Latency, "got D3Latency %u\n", caps->D3Latency);
+            ok(!caps->D1Latency, "got D1Latency %lu\n", caps->D1Latency);
+            ok(!caps->D2Latency, "got D2Latency %lu\n", caps->D2Latency);
+            ok(!caps->D3Latency, "got D3Latency %lu\n", caps->D3Latency);
 
             /* If caps->RawDeviceOK is not set, we won't receive
              * IRP_MN_START_DEVICE unless there's a function driver. */
@@ -430,8 +430,8 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
     stack->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
     stack->Parameters.DeviceCapabilities.Capabilities = ∩︀
     ret = IoCallDriver(top_device, irp);
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok(io.Status == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok(io.Status == STATUS_SUCCESS, "got %#lx\n", ret);
 
     ok(caps.Size == sizeof(caps), "wrong size %u\n", caps.Size);
     ok(caps.Version == 1, "wrong version %u\n", caps.Version);
@@ -453,8 +453,8 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
     ok(!caps.NonDynamic, "got NonDynamic %u\n", caps.NonDynamic);
     ok(!caps.WarmEjectSupported, "got WarmEjectSupported %u\n", caps.WarmEjectSupported);
     ok(!caps.NoDisplayInUI, "got NoDisplayInUI %u\n", caps.NoDisplayInUI);
-    ok(!caps.Address, "got Address %#x\n", caps.Address);
-    ok(!caps.UINumber, "got UINumber %#x\n", caps.UINumber);
+    ok(!caps.Address, "got Address %#lx\n", caps.Address);
+    ok(!caps.UINumber, "got UINumber %#lx\n", caps.UINumber);
     ok(caps.DeviceState[PowerSystemUnspecified] == PowerDeviceUnspecified,
             "got DeviceState[PowerSystemUnspecified] %u\n", caps.DeviceState[PowerSystemUnspecified]);
     todo_wine ok(caps.DeviceState[PowerSystemWorking] == PowerDeviceD0,
@@ -463,9 +463,9 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
         todo_wine ok(caps.DeviceState[i] == PowerDeviceD3, "got DeviceState[%u] %u\n", i, caps.DeviceState[i]);
     ok(caps.SystemWake == PowerSystemUnspecified, "got SystemWake %u\n", caps.SystemWake);
     ok(caps.DeviceWake == PowerDeviceUnspecified, "got DeviceWake %u\n", caps.DeviceWake);
-    ok(!caps.D1Latency, "got D1Latency %u\n", caps.D1Latency);
-    ok(!caps.D2Latency, "got D2Latency %u\n", caps.D2Latency);
-    ok(!caps.D3Latency, "got D3Latency %u\n", caps.D3Latency);
+    ok(!caps.D1Latency, "got D1Latency %lu\n", caps.D1Latency);
+    ok(!caps.D2Latency, "got D2Latency %lu\n", caps.D2Latency);
+    ok(!caps.D3Latency, "got D3Latency %lu\n", caps.D3Latency);
 
     memset(&caps, 0xff, sizeof(caps));
     caps.Size = sizeof(caps);
@@ -479,8 +479,8 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
     stack->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
     stack->Parameters.DeviceCapabilities.Capabilities = ∩︀
     ret = IoCallDriver(top_device, irp);
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok(io.Status == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok(io.Status == STATUS_SUCCESS, "got %#lx\n", ret);
 
     ok(caps.Size == sizeof(caps), "wrong size %u\n", caps.Size);
     ok(caps.Version == 1, "wrong version %u\n", caps.Version);
@@ -502,8 +502,8 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
     ok(caps.NonDynamic, "got NonDynamic %u\n", caps.NonDynamic);
     ok(caps.WarmEjectSupported, "got WarmEjectSupported %u\n", caps.WarmEjectSupported);
     ok(caps.NoDisplayInUI, "got NoDisplayInUI %u\n", caps.NoDisplayInUI);
-    ok(caps.Address == 0xffffffff, "got Address %#x\n", caps.Address);
-    ok(caps.UINumber == 0xffffffff, "got UINumber %#x\n", caps.UINumber);
+    ok(caps.Address == 0xffffffff, "got Address %#lx\n", caps.Address);
+    ok(caps.UINumber == 0xffffffff, "got UINumber %#lx\n", caps.UINumber);
     todo_wine ok(caps.DeviceState[PowerSystemUnspecified] == PowerDeviceUnspecified,
             "got DeviceState[PowerSystemUnspecified] %u\n", caps.DeviceState[PowerSystemUnspecified]);
     todo_wine ok(caps.DeviceState[PowerSystemWorking] == PowerDeviceD0,
@@ -512,9 +512,9 @@ static void test_bus_query_caps(DEVICE_OBJECT *top_device)
         todo_wine ok(caps.DeviceState[i] == PowerDeviceD3, "got DeviceState[%u] %u\n", i, caps.DeviceState[i]);
     ok(caps.SystemWake == 0xffffffff, "got SystemWake %u\n", caps.SystemWake);
     ok(caps.DeviceWake == 0xffffffff, "got DeviceWake %u\n", caps.DeviceWake);
-    ok(caps.D1Latency == 0xffffffff, "got D1Latency %u\n", caps.D1Latency);
-    ok(caps.D2Latency == 0xffffffff, "got D2Latency %u\n", caps.D2Latency);
-    ok(caps.D3Latency == 0xffffffff, "got D3Latency %u\n", caps.D3Latency);
+    ok(caps.D1Latency == 0xffffffff, "got D1Latency %lu\n", caps.D1Latency);
+    ok(caps.D2Latency == 0xffffffff, "got D2Latency %lu\n", caps.D2Latency);
+    ok(caps.D3Latency == 0xffffffff, "got D3Latency %lu\n", caps.D3Latency);
 }
 
 static void test_bus_query_id(DEVICE_OBJECT *top_device)
@@ -533,8 +533,8 @@ static void test_bus_query_id(DEVICE_OBJECT *top_device)
     stack->MinorFunction = IRP_MN_QUERY_ID;
     stack->Parameters.QueryId.IdType = BusQueryDeviceID;
     ret = IoCallDriver(top_device, irp);
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok(io.Status == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok(io.Status == STATUS_SUCCESS, "got %#lx\n", ret);
     ok(!wcscmp((WCHAR *)io.Information, L"ROOT\\WINETEST"), "got id '%ls'\n", (WCHAR *)io.Information);
     ExFreePool((WCHAR *)io.Information);
 
@@ -544,8 +544,8 @@ static void test_bus_query_id(DEVICE_OBJECT *top_device)
     stack->MinorFunction = IRP_MN_QUERY_ID;
     stack->Parameters.QueryId.IdType = BusQueryInstanceID;
     ret = IoCallDriver(top_device, irp);
-    ok(ret == STATUS_SUCCESS, "got %#x\n", ret);
-    ok(io.Status == STATUS_SUCCESS, "got %#x\n", ret);
+    ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
+    ok(io.Status == STATUS_SUCCESS, "got %#lx\n", ret);
     ok(!wcscmp((WCHAR *)io.Information, L"0"), "got id '%ls'\n", (WCHAR *)io.Information);
     ExFreePool((WCHAR *)io.Information);
 }
@@ -598,7 +598,7 @@ static NTSTATUS fdo_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG code)
             swprintf(name, ARRAY_SIZE(name), L"\\Device\\winetest_pnp_%x", id);
             RtlInitUnicodeString(&string, name);
             status = IoCreateDevice(driver_obj, sizeof(*device), &string, FILE_DEVICE_UNKNOWN, 0, FALSE, &device_obj);
-            ok(!status, "Failed to create device, status %#x.\n", status);
+            ok(!status, "Failed to create device, status %#lx.\n", status);
 
             device = device_obj->DeviceExtension;
             memset(device, 0, sizeof(*device));
@@ -647,7 +647,7 @@ static NTSTATUS fdo_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG code)
         }
 
         default:
-            ok(0, "Unexpected ioctl %#x.\n", code);
+            ok(0, "Unexpected ioctl %#lx.\n", code);
             return STATUS_NOT_IMPLEMENTED;
     }
 }
@@ -682,7 +682,7 @@ static NTSTATUS pdo_ioctl(DEVICE_OBJECT *device_obj, IRP *irp, IO_STACK_LOCATION
             return STATUS_SUCCESS;
 
         default:
-            ok(0, "Unexpected ioctl %#x.\n", code);
+            ok(0, "Unexpected ioctl %#lx.\n", code);
             return STATUS_NOT_IMPLEMENTED;
     }
 }
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 13d1af4e7cd..64debcbebbf 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -75,7 +75,7 @@ static void load_resource(const WCHAR *name, WCHAR *filename)
     GetTempFileNameW(path, name, 0, filename);
 
     file = CreateFileW(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "failed to create %s, error %u\n", debugstr_w(filename), GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to create %s, error %lu\n", debugstr_w(filename), GetLastError());
 
     res = FindResourceW(NULL, name, L"TESTDLL");
     ok( res != 0, "couldn't find resource\n" );
@@ -114,31 +114,31 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
     swprintf(container_name, ARRAY_SIZE(container_name), L"wine_testsign%u", rand());
 
     ret = CryptAcquireContextW(&ctx->provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET);
-    ok(ret, "Failed to create container, error %#x\n", GetLastError());
+    ok(ret, "Failed to create container, error %#lx\n", GetLastError());
 
     ret = CryptGenKey(ctx->provider, AT_SIGNATURE, CRYPT_EXPORTABLE, &key);
-    ok(ret, "Failed to create key, error %#x\n", GetLastError());
+    ok(ret, "Failed to create key, error %#lx\n", GetLastError());
     ret = CryptDestroyKey(key);
-    ok(ret, "Failed to destroy key, error %#x\n", GetLastError());
+    ok(ret, "Failed to destroy key, error %#lx\n", GetLastError());
     ret = CryptGetUserKey(ctx->provider, AT_SIGNATURE, &key);
-    ok(ret, "Failed to get user key, error %#x\n", GetLastError());
+    ok(ret, "Failed to get user key, error %#lx\n", GetLastError());
     ret = CryptDestroyKey(key);
-    ok(ret, "Failed to destroy key, error %#x\n", GetLastError());
+    ok(ret, "Failed to destroy key, error %#lx\n", GetLastError());
 
     size = sizeof(encoded_name);
     ret = CertStrToNameA(X509_ASN_ENCODING, "CN=winetest_cert", CERT_X500_NAME_STR, NULL, encoded_name, &size, NULL);
-    ok(ret, "Failed to convert name, error %#x\n", GetLastError());
+    ok(ret, "Failed to convert name, error %#lx\n", GetLastError());
     key_info.CertIssuer.cbData = size;
     key_info.CertIssuer.pbData = encoded_name;
 
     size = sizeof(public_key_info_buffer);
     ret = CryptExportPublicKeyInfo(ctx->provider, AT_SIGNATURE, X509_ASN_ENCODING, public_key_info, &size);
-    ok(ret, "Failed to export public key, error %#x\n", GetLastError());
+    ok(ret, "Failed to export public key, error %#lx\n", GetLastError());
     cert_info.SubjectPublicKeyInfo = *public_key_info;
 
     size = sizeof(hash_buffer);
     ret = CryptHashPublicKeyInfo(ctx->provider, CALG_MD5, 0, X509_ASN_ENCODING, public_key_info, hash_buffer, &size);
-    ok(ret, "Failed to hash public key, error %#x\n", GetLastError());
+    ok(ret, "Failed to hash public key, error %#lx\n", GetLastError());
 
     key_info.KeyId.cbData = size;
     key_info.KeyId.pbData = hash_buffer;
@@ -149,7 +149,7 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
 
     size = sizeof(encoded_key_id);
     ret = CryptEncodeObject(X509_ASN_ENCODING, X509_AUTHORITY_KEY_ID, &key_info, encoded_key_id, &size);
-    ok(ret, "Failed to convert name, error %#x\n", GetLastError());
+    ok(ret, "Failed to convert name, error %#lx\n", GetLastError());
 
     extension.pszObjId = (char *)szOID_AUTHORITY_KEY_IDENTIFIER;
     extension.fCritical = TRUE;
@@ -170,14 +170,14 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
     size = sizeof(cert_buffer);
     ret = CryptSignAndEncodeCertificate(ctx->provider, AT_SIGNATURE, X509_ASN_ENCODING,
             X509_CERT_TO_BE_SIGNED, &cert_info, &algid, NULL, cert_buffer, &size);
-    ok(ret, "Failed to create certificate, error %#x\n", GetLastError());
+    ok(ret, "Failed to create certificate, error %#lx\n", GetLastError());
 
     ctx->cert = CertCreateCertificateContext(X509_ASN_ENCODING, cert_buffer, size);
-    ok(!!ctx->cert, "Failed to create context, error %#x\n", GetLastError());
+    ok(!!ctx->cert, "Failed to create context, error %#lx\n", GetLastError());
 
     size = sizeof(provider_nameA);
     ret = CryptGetProvParam(ctx->provider, PP_NAME, provider_nameA, &size, 0);
-    ok(ret, "Failed to get prov param, error %#x\n", GetLastError());
+    ok(ret, "Failed to get prov param, error %#lx\n", GetLastError());
     MultiByteToWideChar(CP_ACP, 0, (char *)provider_nameA, -1, provider_nameW, ARRAY_SIZE(provider_nameW));
 
     provider_info.pwszContainerName = (WCHAR *)container_name;
@@ -185,7 +185,7 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
     provider_info.dwProvType = PROV_RSA_FULL;
     provider_info.dwKeySpec = AT_SIGNATURE;
     ret = CertSetCertificateContextProperty(ctx->cert, CERT_KEY_PROV_INFO_PROP_ID, 0, &provider_info);
-    ok(ret, "Failed to set provider info, error %#x\n", GetLastError());
+    ok(ret, "Failed to set provider info, error %#lx\n", GetLastError());
 
     ctx->root_store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_A, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, "root");
     if (!ctx->root_store && GetLastError() == ERROR_ACCESS_DENIED)
@@ -193,35 +193,35 @@ static BOOL testsign_create_cert(struct testsign_context *ctx)
         skip("Failed to open root store.\n");
 
         ret = CertFreeCertificateContext(ctx->cert);
-        ok(ret, "Failed to free certificate, error %u\n", GetLastError());
+        ok(ret, "Failed to free certificate, error %lu\n", GetLastError());
         ret = CryptReleaseContext(ctx->provider, 0);
-        ok(ret, "failed to release context, error %u\n", GetLastError());
+        ok(ret, "failed to release context, error %lu\n", GetLastError());
 
         return FALSE;
     }
-    ok(!!ctx->root_store, "Failed to open store, error %u\n", GetLastError());
+    ok(!!ctx->root_store, "Failed to open store, error %lu\n", GetLastError());
     ret = CertAddCertificateContextToStore(ctx->root_store, ctx->cert, CERT_STORE_ADD_ALWAYS, &ctx->root_cert);
     if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
     {
         skip("Failed to add self-signed certificate to store.\n");
 
         ret = CertFreeCertificateContext(ctx->cert);
-        ok(ret, "Failed to free certificate, error %u\n", GetLastError());
+        ok(ret, "Failed to free certificate, error %lu\n", GetLastError());
         ret = CertCloseStore(ctx->root_store, CERT_CLOSE_STORE_CHECK_FLAG);
-        ok(ret, "Failed to close store, error %u\n", GetLastError());
+        ok(ret, "Failed to close store, error %lu\n", GetLastError());
         ret = CryptReleaseContext(ctx->provider, 0);
-        ok(ret, "failed to release context, error %u\n", GetLastError());
+        ok(ret, "failed to release context, error %lu\n", GetLastError());
 
         return FALSE;
     }
-    ok(ret, "Failed to add certificate, error %u\n", GetLastError());
+    ok(ret, "Failed to add certificate, error %lu\n", GetLastError());
 
     ctx->publisher_store = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_A, 0, 0,
             CERT_SYSTEM_STORE_LOCAL_MACHINE, "trustedpublisher");
-    ok(!!ctx->publisher_store, "Failed to open store, error %u\n", GetLastError());
+    ok(!!ctx->publisher_store, "Failed to open store, error %lu\n", GetLastError());
     ret = CertAddCertificateContextToStore(ctx->publisher_store, ctx->cert,
             CERT_STORE_ADD_ALWAYS, &ctx->publisher_cert);
-    ok(ret, "Failed to add certificate, error %u\n", GetLastError());
+    ok(ret, "Failed to add certificate, error %lu\n", GetLastError());
 
     return TRUE;
 }
@@ -231,20 +231,20 @@ static void testsign_cleanup(struct testsign_context *ctx)
     BOOL ret;
 
     ret = CertFreeCertificateContext(ctx->cert);
-    ok(ret, "Failed to free certificate, error %u\n", GetLastError());
+    ok(ret, "Failed to free certificate, error %lu\n", GetLastError());
 
     ret = CertFreeCertificateContext(ctx->root_cert);
-    ok(ret, "Failed to free certificate context, error %u\n", GetLastError());
+    ok(ret, "Failed to free certificate context, error %lu\n", GetLastError());
     ret = CertCloseStore(ctx->root_store, CERT_CLOSE_STORE_CHECK_FLAG);
-    ok(ret, "Failed to close store, error %u\n", GetLastError());
+    ok(ret, "Failed to close store, error %lu\n", GetLastError());
 
     ret = CertFreeCertificateContext(ctx->publisher_cert);
-    ok(ret, "Failed to free certificate context, error %u\n", GetLastError());
+    ok(ret, "Failed to free certificate context, error %lu\n", GetLastError());
     ret = CertCloseStore(ctx->publisher_store, CERT_CLOSE_STORE_CHECK_FLAG);
-    ok(ret, "Failed to close store, error %u\n", GetLastError());
+    ok(ret, "Failed to close store, error %lu\n", GetLastError());
 
     ret = CryptReleaseContext(ctx->provider, 0);
-    ok(ret, "failed to release context, error %u\n", GetLastError());
+    ok(ret, "failed to release context, error %lu\n", GetLastError());
 }
 
 static void testsign_sign(struct testsign_context *ctx, const WCHAR *filename)
@@ -272,7 +272,7 @@ static void testsign_sign(struct testsign_context *ctx, const WCHAR *filename)
     authcode.pwszName = L"";
     authcode.pwszInfo = L"";
     hr = pSignerSign(&subject, &cert_info, &signature, NULL, NULL, NULL, NULL);
-    todo_wine ok(hr == S_OK || broken(hr == NTE_BAD_ALGID) /* < 7 */, "Failed to sign, hr %#x\n", hr);
+    todo_wine ok(hr == S_OK || broken(hr == NTE_BAD_ALGID) /* < 7 */, "Failed to sign, hr %#lx\n", hr);
 }
 
 static void unload_driver(SC_HANDLE service)
@@ -285,10 +285,10 @@ static void unload_driver(SC_HANDLE service)
         BOOL ret;
         Sleep(100);
         ret = QueryServiceStatus(service, &status);
-        ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+        ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
     }
     ok(status.dwCurrentState == SERVICE_STOPPED,
-       "expected SERVICE_STOPPED, got %d\n", status.dwCurrentState);
+       "expected SERVICE_STOPPED, got %ld\n", status.dwCurrentState);
 
     DeleteService(service);
     CloseServiceHandle(service);
@@ -319,7 +319,7 @@ static SC_HANDLE load_driver(struct testsign_context *ctx, WCHAR *filename,
                              SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER,
                              SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
                              filename, NULL, NULL, NULL, NULL, NULL);
-    ok(!!service, "CreateService failed: %u\n", GetLastError());
+    ok(!!service, "CreateService failed: %lu\n", GetLastError());
 
     CloseServiceHandle(manager);
     return service;
@@ -348,21 +348,21 @@ static BOOL start_driver(HANDLE service, BOOL vista_plus)
         CloseServiceHandle(service);
         return FALSE;
     }
-    ok(ret, "StartService failed: %u\n", GetLastError());
+    ok(ret, "StartService failed: %lu\n", GetLastError());
 
     /* wait for the service to start up properly */
     ret = QueryServiceStatus(service, &status);
-    ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+    ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
     while (status.dwCurrentState == SERVICE_START_PENDING)
     {
         Sleep(100);
         ret = QueryServiceStatus(service, &status);
-        ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+        ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
     }
     ok(status.dwCurrentState == SERVICE_RUNNING,
-       "expected SERVICE_RUNNING, got %d\n", status.dwCurrentState);
+       "expected SERVICE_RUNNING, got %ld\n", status.dwCurrentState);
     ok(status.dwServiceType == SERVICE_KERNEL_DRIVER,
-       "expected SERVICE_KERNEL_DRIVER, got %#x\n", status.dwServiceType);
+       "expected SERVICE_KERNEL_DRIVER, got %#lx\n", status.dwServiceType);
 
     return TRUE;
 }
@@ -379,7 +379,7 @@ static void cat_okfile(void)
     do
     {
         ReadFile(okfile, buffer, sizeof(buffer), &size, NULL);
-        printf("%.*s", size, buffer);
+        printf("%.*s", (int)size, buffer);
     } while (size == sizeof(buffer));
 
     SetFilePointer(okfile, 0, NULL, FILE_BEGIN);
@@ -404,8 +404,8 @@ static void main_test(void)
     modified_value = 0;
 
     res = DeviceIoControl(device, IOCTL_WINETEST_MAIN_TEST, test_input, sizeof(*test_input), NULL, 0, &size, NULL);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-    ok(!size, "got size %u\n", size);
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+    ok(!size, "got size %lu\n", size);
 
     heap_free(test_input);
 }
@@ -418,15 +418,15 @@ static void test_basic_ioctl(void)
 
     res = DeviceIoControl(device, IOCTL_WINETEST_BASIC_IOCTL, NULL, 0, buf,
                           sizeof(buf), &written, NULL);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-    ok(written == sizeof(teststr), "got size %d\n", written);
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+    ok(written == sizeof(teststr), "got size %ld\n", written);
     ok(!strcmp(buf, teststr), "got '%s'\n", buf);
 
     memset(buf, 0, sizeof(buf));
     res = DeviceIoControl(device, IOCTL_WINETEST_BASIC_IOCTL, inbuf,
             sizeof(inbuf), buf, 10, &written, NULL);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-    ok(written == 10, "got size %d\n", written);
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+    ok(written == 10, "got size %ld\n", written);
     ok(!strcmp(buf, "Wine is no"), "got '%s'\n", buf);
 }
 
@@ -443,77 +443,77 @@ static void test_overlapped(void)
 
     file = CreateFileA("\\\\.\\WineTestDriver", FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES,
                        0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     /* test cancelling all device requests */
     res = DeviceIoControl(file, IOCTL_WINETEST_RESET_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
 
     res = DeviceIoControl(file, IOCTL_WINETEST_TEST_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %lu\n", GetLastError());
 
     res = DeviceIoControl(file, IOCTL_WINETEST_TEST_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped2);
-    ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %lu\n", GetLastError());
 
     cancel_cnt = 0xdeadbeef;
     res = DeviceIoControl(file, IOCTL_WINETEST_GET_CANCEL_COUNT, NULL, 0, &cancel_cnt, sizeof(cancel_cnt), NULL, &overlapped);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-    ok(cancel_cnt == 0, "cancel_cnt = %u\n", cancel_cnt);
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+    ok(cancel_cnt == 0, "cancel_cnt = %lu\n", cancel_cnt);
 
     CancelIo(file);
 
     cancel_cnt = 0xdeadbeef;
     res = DeviceIoControl(file, IOCTL_WINETEST_GET_CANCEL_COUNT, NULL, 0, &cancel_cnt, sizeof(cancel_cnt), NULL, &overlapped);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-    ok(cancel_cnt == 2, "cancel_cnt = %u\n", cancel_cnt);
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+    ok(cancel_cnt == 2, "cancel_cnt = %lu\n", cancel_cnt);
 
     /* test cancelling selected overlapped event */
     if (pCancelIoEx)
     {
         res = DeviceIoControl(file, IOCTL_WINETEST_RESET_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-        ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+        ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
 
         res = DeviceIoControl(file, IOCTL_WINETEST_TEST_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-        ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %u\n", GetLastError());
+        ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %lu\n", GetLastError());
 
         res = DeviceIoControl(file, IOCTL_WINETEST_TEST_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped2);
-        ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %u\n", GetLastError());
+        ok(!res && GetLastError() == ERROR_IO_PENDING, "DeviceIoControl failed: %lu\n", GetLastError());
 
         pCancelIoEx(file, &overlapped);
 
         cancel_cnt = 0xdeadbeef;
         res = DeviceIoControl(file, IOCTL_WINETEST_GET_CANCEL_COUNT, NULL, 0, &cancel_cnt, sizeof(cancel_cnt), NULL, &overlapped);
-        ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-        ok(cancel_cnt == 1, "cancel_cnt = %u\n", cancel_cnt);
+        ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+        ok(cancel_cnt == 1, "cancel_cnt = %lu\n", cancel_cnt);
 
         pCancelIoEx(file, &overlapped2);
 
         cancel_cnt = 0xdeadbeef;
         res = DeviceIoControl(file, IOCTL_WINETEST_GET_CANCEL_COUNT, NULL, 0, &cancel_cnt, sizeof(cancel_cnt), NULL, &overlapped);
-        ok(res, "DeviceIoControl failed: %u\n", GetLastError());
-        ok(cancel_cnt == 2, "cancel_cnt = %u\n", cancel_cnt);
+        ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
+        ok(cancel_cnt == 2, "cancel_cnt = %lu\n", cancel_cnt);
     }
 
     port = CreateIoCompletionPort(file, NULL, 0xdeadbeef, 0);
-    ok(port != NULL, "CreateIoCompletionPort failed, error %u\n", GetLastError());
+    ok(port != NULL, "CreateIoCompletionPort failed, error %lu\n", GetLastError());
     res = GetQueuedCompletionStatus(port, &size, &key, &o, 0);
-    ok(!res && GetLastError() == WAIT_TIMEOUT, "GetQueuedCompletionStatus returned %x(%u)\n", res, GetLastError());
+    ok(!res && GetLastError() == WAIT_TIMEOUT, "GetQueuedCompletionStatus returned %x(%lu)\n", res, GetLastError());
 
     res = DeviceIoControl(file, IOCTL_WINETEST_RESET_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
     res = GetQueuedCompletionStatus(port, &size, &key, &o, 0);
-    ok(res, "GetQueuedCompletionStatus failed: %u\n", GetLastError());
+    ok(res, "GetQueuedCompletionStatus failed: %lu\n", GetLastError());
     ok(o == &overlapped, "o != overlapped\n");
 
     if (pSetFileCompletionNotificationModes)
     {
         res = pSetFileCompletionNotificationModes(file, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS);
-        ok(res, "SetFileCompletionNotificationModes failed: %u\n", GetLastError());
+        ok(res, "SetFileCompletionNotificationModes failed: %lu\n", GetLastError());
 
         res = DeviceIoControl(file, IOCTL_WINETEST_RESET_CANCEL, NULL, 0, NULL, 0, NULL, &overlapped);
-        ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+        ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
         res = GetQueuedCompletionStatus(port, &size, &key, &o, 0);
-        ok(!res && GetLastError() == WAIT_TIMEOUT, "GetQueuedCompletionStatus returned %x(%u)\n", res, GetLastError());
+        ok(!res && GetLastError() == WAIT_TIMEOUT, "GetQueuedCompletionStatus returned %x(%lu)\n", res, GetLastError());
     }
 
     CloseHandle(port);
@@ -529,24 +529,24 @@ static void test_load_driver(SC_HANDLE service)
     DWORD sz;
 
     res = QueryServiceStatus(service, &status);
-    ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
-    ok(status.dwCurrentState == SERVICE_STOPPED, "got state %#x\n", status.dwCurrentState);
+    ok(res, "QueryServiceStatusEx failed: %lu\n", GetLastError());
+    ok(status.dwCurrentState == SERVICE_STOPPED, "got state %#lx\n", status.dwCurrentState);
 
     load = TRUE;
     res = DeviceIoControl(device, IOCTL_WINETEST_LOAD_DRIVER, &load, sizeof(load), NULL, 0, &sz, NULL);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
 
     res = QueryServiceStatus(service, &status);
-    ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
-    ok(status.dwCurrentState == SERVICE_RUNNING, "got state %#x\n", status.dwCurrentState);
+    ok(res, "QueryServiceStatusEx failed: %lu\n", GetLastError());
+    ok(status.dwCurrentState == SERVICE_RUNNING, "got state %#lx\n", status.dwCurrentState);
 
     load = FALSE;
     res = DeviceIoControl(device, IOCTL_WINETEST_LOAD_DRIVER, &load, sizeof(load), NULL, 0, &sz, NULL);
-    ok(res, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(res, "DeviceIoControl failed: %lu\n", GetLastError());
 
     res = QueryServiceStatus(service, &status);
-    ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
-    ok(status.dwCurrentState == SERVICE_STOPPED, "got state %#x\n", status.dwCurrentState);
+    ok(res, "QueryServiceStatusEx failed: %lu\n", GetLastError());
+    ok(status.dwCurrentState == SERVICE_STOPPED, "got state %#lx\n", status.dwCurrentState);
 }
 
 static void test_file_handles(void)
@@ -556,67 +556,67 @@ static void test_file_handles(void)
     BOOL ret;
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CREATE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 2, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 2, "got %lu\n", count);
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CLOSE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 1, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 1, "got %lu\n", count);
 
     file = CreateFileA("\\\\.\\WineTestDriver", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CREATE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 3, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 3, "got %lu\n", count);
 
     file2 = CreateFileA("\\\\.\\WineTestDriver", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file2 != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(file2 != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CREATE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 4, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 4, "got %lu\n", count);
 
     ret = DuplicateHandle(GetCurrentProcess(), file, GetCurrentProcess(), &dup, 0, FALSE, DUPLICATE_SAME_ACCESS);
-    ok(ret, "failed to duplicate handle: %u\n", GetLastError());
+    ok(ret, "failed to duplicate handle: %lu\n", GetLastError());
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CREATE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 4, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 4, "got %lu\n", count);
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_FSCONTEXT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 1, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 1, "got %lu\n", count);
 
     ret = DeviceIoControl(file, IOCTL_WINETEST_GET_FSCONTEXT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 3, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 3, "got %lu\n", count);
 
     ret = DeviceIoControl(file2, IOCTL_WINETEST_GET_FSCONTEXT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 4, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 4, "got %lu\n", count);
 
     ret = DeviceIoControl(dup, IOCTL_WINETEST_GET_FSCONTEXT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 3, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 3, "got %lu\n", count);
 
     CloseHandle(dup);
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CLOSE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 1, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 1, "got %lu\n", count);
 
     CloseHandle(file2);
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CLOSE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 2, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 2, "got %lu\n", count);
 
     CloseHandle(file);
 
     ret = DeviceIoControl(device, IOCTL_WINETEST_GET_CLOSE_COUNT, NULL, 0, &count, sizeof(count), &ret_size, NULL);
-    ok(ret, "ioctl failed: %u\n", GetLastError());
-    ok(count == 3, "got %u\n", count);
+    ok(ret, "ioctl failed: %lu\n", GetLastError());
+    ok(count == 3, "got %lu\n", count);
 }
 
 static unsigned int got_return_status_apc;
@@ -625,7 +625,7 @@ static void WINAPI return_status_apc(void *apc_user, IO_STATUS_BLOCK *io, ULONG
 {
     ++got_return_status_apc;
     ok(apc_user == (void *)456, "got %p\n", apc_user);
-    ok(!reserved, "got reserved %#x\n", reserved);
+    ok(!reserved, "got reserved %#lx\n", reserved);
 }
 
 static void do_return_status(ULONG ioctl, struct return_status_params *params)
@@ -668,16 +668,16 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
     if (NT_SUCCESS(expect_status))
     {
         todo_wine_if (params->ret_status == STATUS_PENDING && params->iosb_status == STATUS_PENDING)
-            ok(GetLastError() == 0xdeadf00d, "got error %u\n", GetLastError());
+            ok(GetLastError() == 0xdeadf00d, "got error %lu\n", GetLastError());
     }
     else
     {
-        ok(GetLastError() == RtlNtStatusToDosError(expect_status), "got error %u\n", GetLastError());
+        ok(GetLastError() == RtlNtStatusToDosError(expect_status), "got error %lu\n", GetLastError());
     }
     if (NT_ERROR(expect_status))
-        ok(size == 0xdeadf00d, "got size %u\n", size);
+        ok(size == 0xdeadf00d, "got size %lu\n", size);
     else if (!NT_ERROR(params->iosb_status))
-        ok(size == 3, "got size %u\n", size);
+        ok(size == 3, "got size %lu\n", size);
     /* size is garbage if !NT_ERROR(expect_status) && NT_ERROR(iosb_status) */
     ok(!strcmp(buffer, expect_buffer), "got buffer %s\n", buffer);
 
@@ -689,12 +689,12 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
     ok(ret == expect_status, "got %#x\n", ret);
     if (NT_ERROR(params->iosb_status))
     {
-        ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+        ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
         ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
     }
     else
     {
-        ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
         ok(io.Information == 3, "got size %Iu\n", io.Information);
     }
     ok(!strcmp(buffer, expect_buffer), "got buffer %s\n", buffer);
@@ -703,9 +703,9 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
 
     file = CreateFileA("\\\\.\\WineTestDriver", FILE_ALL_ACCESS,
             0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device, error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device, error %lu\n", GetLastError());
     port = CreateIoCompletionPort(file, NULL, 123, 0);
-    ok(port != NULL, "failed to create port, error %u\n", GetLastError());
+    ok(port != NULL, "failed to create port, error %lu\n", GetLastError());
 
     ret = WaitForSingleObject(file, 0);
     ok(!ret, "got %d\n", ret);
@@ -721,14 +721,14 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
             "got %#x\n", ret);
     if (!params->pending && NT_ERROR(params->iosb_status))
     {
-        ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+        ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
         ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(event, 0);
         ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
     }
     else
     {
-        ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
         ok(io.Information == 3, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(event, 0);
         ok(!ret, "got %d\n", ret);
@@ -751,7 +751,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
         ok(!ret, "got %#x\n", ret);
         ok(key == 123, "got key %Iu\n", key);
         ok(value == 456, "got value %Iu\n", value);
-        ok(io.Status == params->iosb_status, "got iosb status %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got iosb status %#lx\n", io.Status);
         ok(io.Information == 3, "got information %Iu\n", io.Information);
     }
 
@@ -768,14 +768,14 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
             "got %#x\n", ret);
     if (!params->pending && NT_ERROR(params->iosb_status))
     {
-        ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+        ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
         ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(event, 0);
         ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
     }
     else
     {
-        ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
         ok(io.Information == 3, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(event, 0);
         ok(!ret, "got %d\n", ret);
@@ -796,14 +796,14 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
             "got %#x\n", ret);
     if (!params->pending && NT_ERROR(params->iosb_status))
     {
-        ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+        ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
         ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(file, 0);
         ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
     }
     else
     {
-        ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
         ok(io.Information == 3, "got size %Iu\n", io.Information);
         ret = WaitForSingleObject(file, 0);
         ok(!ret, "got %d\n", ret);
@@ -815,7 +815,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
     if (pSetFileCompletionNotificationModes)
     {
         ret = pSetFileCompletionNotificationModes(file, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS);
-        ok(ret, "got error %u\n", GetLastError());
+        ok(ret, "got error %lu\n", GetLastError());
 
         SetEvent(event);
         strcpy(buffer, "abcdef");
@@ -828,14 +828,14 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
                 "got %#x\n", ret);
         if (!params->pending && NT_ERROR(params->iosb_status))
         {
-            ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+            ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
             ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
             ret = WaitForSingleObject(event, 0);
             ok(ret == WAIT_TIMEOUT, "got %d\n", ret);
         }
         else
         {
-            ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+            ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
             ok(io.Information == 3, "got size %Iu\n", io.Information);
             ret = WaitForSingleObject(event, 0);
             ok(!ret, "got %d\n", ret);
@@ -866,15 +866,15 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
         {
             ok(key == 123, "got key %Iu\n", key);
             ok(value == 456, "got value %Iu\n", value);
-            ok(io.Status == params->iosb_status, "got iosb status %#x\n", io.Status);
+            ok(io.Status == params->iosb_status, "got iosb status %#lx\n", io.Status);
             ok(io.Information == 3, "got information %Iu\n", io.Information);
         }
     }
 
     ret = CloseHandle(file);
-    ok(ret, "failed to close file, error %u\n", GetLastError());
+    ok(ret, "failed to close file, error %lu\n", GetLastError());
     ret = CloseHandle(port);
-    ok(ret, "failed to close port, error %u\n", GetLastError());
+    ok(ret, "failed to close port, error %lu\n", GetLastError());
 
     /* Test with an APC. */
 
@@ -882,7 +882,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
 
     file = CreateFileA("\\\\.\\WineTestDriver", FILE_ALL_ACCESS,
             0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device, error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device, error %lu\n", GetLastError());
 
     strcpy(buffer, "abcdef");
     io.Status = 0xdeadf00d;
@@ -892,12 +892,12 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
     ok(ret == params->ret_status, "got %#x\n", ret);
     if (!params->pending && NT_ERROR(params->iosb_status))
     {
-        ok(io.Status == 0xdeadf00d, "got %#x\n", io.Status);
+        ok(io.Status == 0xdeadf00d, "got %#lx\n", io.Status);
         ok(io.Information == 0xdeadf00d, "got size %Iu\n", io.Information);
     }
     else
     {
-        ok(io.Status == params->iosb_status, "got %#x\n", io.Status);
+        ok(io.Status == params->iosb_status, "got %#lx\n", io.Status);
         ok(io.Information == 3, "got size %Iu\n", io.Information);
     }
     ok(!strcmp(buffer, expect_buffer), "got buffer %s\n", buffer);
@@ -915,7 +915,7 @@ static void do_return_status(ULONG ioctl, struct return_status_params *params)
     }
 
     ret = CloseHandle(file);
-    ok(ret, "failed to close file, error %u\n", GetLastError());
+    ok(ret, "failed to close file, error %lu\n", GetLastError());
 
     CloseHandle(event);
 }
@@ -956,7 +956,7 @@ static void test_return_status(void)
                     params.ret_status = status_tests[i];
                     params.iosb_status = status_tests[j];
 
-                    winetest_push_context("return 0x%08x, iosb 0x%08x, pending %d, method %u",
+                    winetest_push_context("return 0x%08lx, iosb 0x%08lx, pending %d, method %lu",
                             params.ret_status, params.iosb_status, params.pending, method_tests[k] & 3);
 
                     do_return_status(method_tests[k], &params);
@@ -986,120 +986,120 @@ static void test_object_info(void)
     ULONG size;
 
     status = NtQueryObject(device, ObjectNameInformation, buffer, sizeof(buffer), NULL);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(name_info->Name.Buffer, name_info->Name.Length, L"\\Device\\WineTestDriver"),
             "wrong name %s\n", debugstr_w(name_info->Name.Buffer));
 
     status = NtQueryObject(device, ObjectTypeInformation, buffer, sizeof(buffer), NULL);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(type_info->TypeName.Buffer, type_info->TypeName.Length, L"File"),
             "wrong name %s\n", debugstr_wn(type_info->TypeName.Buffer, type_info->TypeName.Length / sizeof(WCHAR)));
 
     status = NtQueryInformationFile(device, &io, buffer, sizeof(buffer), FileNameInformation);
-    todo_wine ok(status == STATUS_INVALID_DEVICE_REQUEST, "got %#x\n", status);
+    todo_wine ok(status == STATUS_INVALID_DEVICE_REQUEST, "got %#lx\n", status);
 
     status = NtQueryVolumeInformationFile(device, &io, buffer, sizeof(buffer), FileFsVolumeInformation);
-    todo_wine ok(status == STATUS_INVALID_DEVICE_REQUEST, "got %#x\n", status);
+    todo_wine ok(status == STATUS_INVALID_DEVICE_REQUEST, "got %#lx\n", status);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\subfile", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    todo_wine ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    todo_wine ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
     if (file == INVALID_HANDLE_VALUE) return;
 
     memset(buffer, 0xcc, sizeof(buffer));
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(buffer), &size);
-    ok(!status, "got %#x\n", status);
-    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %u\n", size);
+    ok(!status, "got %#lx\n", status);
+    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %lu\n", size);
     ok(compare_unicode_string(name_info->Name.Buffer, name_info->Name.Length, L"\\Device\\WineTestDriver\\subfile"),
             "wrong name %s\n", debugstr_w(name_info->Name.Buffer));
 
     memset(buffer, 0xcc, sizeof(buffer));
     status = NtQueryObject(file, ObjectNameInformation, buffer, size - 2, &size);
-    ok(status == STATUS_BUFFER_OVERFLOW, "got %#x\n", status);
-    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %u\n", size);
+    ok(status == STATUS_BUFFER_OVERFLOW, "got %#lx\n", status);
+    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %lu\n", size);
     ok(compare_unicode_string(name_info->Name.Buffer, name_info->Name.Length, L"\\Device\\WineTestDriver\\subfil"),
             "wrong name %s\n", debugstr_w(name_info->Name.Buffer));
 
     memset(buffer, 0xcc, sizeof(buffer));
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(*name_info), &size);
-    ok(status == STATUS_BUFFER_OVERFLOW, "got %#x\n", status);
-    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %u\n", size);
+    ok(status == STATUS_BUFFER_OVERFLOW, "got %#lx\n", status);
+    ok(size == sizeof(*name_info) + sizeof(L"\\Device\\WineTestDriver\\subfile"), "wrong size %lu\n", size);
 
     status = NtQueryObject(file, ObjectTypeInformation, buffer, sizeof(buffer), NULL);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(type_info->TypeName.Buffer, type_info->TypeName.Length, L"File"),
             "wrong name %s\n", debugstr_wn(type_info->TypeName.Buffer, type_info->TypeName.Length / sizeof(WCHAR)));
 
     status = NtQueryInformationFile(file, &io, buffer, sizeof(buffer), FileNameInformation);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(file_info->FileName, file_info->FileNameLength, L"\\subfile"),
             "wrong name %s\n", debugstr_wn(file_info->FileName, file_info->FileNameLength / sizeof(WCHAR)));
 
     io.Status = 0xdeadf00d;
     io.Information = 0xdeadf00d;
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsVolumeInformation);
-    ok(!status, "got %#x\n", status);
-    ok(!io.Status, "got status %#x\n", io.Status);
+    ok(!status, "got %#lx\n", status);
+    ok(!io.Status, "got status %#lx\n", io.Status);
     size = offsetof(FILE_FS_VOLUME_INFORMATION, VolumeLabel) + volume_info->VolumeLabelLength;
-    ok(io.Information == size, "expected information %Iu, got %Iu\n", size, io.Information);
+    ok(io.Information == size, "expected information %lu, got %Iu\n", size, io.Information);
     ok(volume_info->VolumeSerialNumber == 0xdeadbeef,
-            "wrong serial number 0x%08x\n", volume_info->VolumeSerialNumber);
+            "wrong serial number 0x%08lx\n", volume_info->VolumeSerialNumber);
     ok(compare_unicode_string(volume_info->VolumeLabel, volume_info->VolumeLabelLength, L"WineTestDriver"),
             "wrong name %s\n", debugstr_wn(volume_info->VolumeLabel, volume_info->VolumeLabelLength / sizeof(WCHAR)));
 
     io.Status = 0xdeadf00d;
     io.Information = 0xdeadf00d;
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsAttributeInformation);
-    ok(status == STATUS_NOT_IMPLEMENTED, "got %#x\n", status);
-    ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
+    ok(status == STATUS_NOT_IMPLEMENTED, "got %#lx\n", status);
+    ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status);
     ok(io.Information == 0xdeadf00d, "got information %Iu\n", io.Information);
 
     CloseHandle(file);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\notimpl", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(buffer), NULL);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(name_info->Name.Buffer, name_info->Name.Length, L"\\Device\\WineTestDriver"),
             "wrong name %s\n", debugstr_w(name_info->Name.Buffer));
 
     status = NtQueryInformationFile(file, &io, buffer, sizeof(buffer), FileNameInformation);
-    ok(status == STATUS_NOT_IMPLEMENTED, "got %#x\n", status);
+    ok(status == STATUS_NOT_IMPLEMENTED, "got %#lx\n", status);
 
     CloseHandle(file);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\badparam", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(buffer), NULL);
-    ok(!status, "got %#x\n", status);
+    ok(!status, "got %#lx\n", status);
     ok(compare_unicode_string(name_info->Name.Buffer, name_info->Name.Length, L"\\Device\\WineTestDriver"),
             "wrong name %s\n", debugstr_w(name_info->Name.Buffer));
 
     status = NtQueryInformationFile(file, &io, buffer, sizeof(buffer), FileNameInformation);
-    ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "got %#lx\n", status);
 
     CloseHandle(file);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\genfail", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(buffer), NULL);
-    ok(status == STATUS_UNSUCCESSFUL, "got %#x\n", status);
+    ok(status == STATUS_UNSUCCESSFUL, "got %#lx\n", status);
 
     status = NtQueryInformationFile(file, &io, buffer, sizeof(buffer), FileNameInformation);
-    ok(status == STATUS_UNSUCCESSFUL, "got %#x\n", status);
+    ok(status == STATUS_UNSUCCESSFUL, "got %#lx\n", status);
 
     CloseHandle(file);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\badtype", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     status = NtQueryObject(file, ObjectNameInformation, buffer, sizeof(buffer), NULL);
-    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "got %#x\n", status);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "got %#lx\n", status);
 
     status = NtQueryInformationFile(file, &io, buffer, sizeof(buffer), FileNameInformation);
-    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "got %#x\n", status);
+    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "got %#lx\n", status);
 
     CloseHandle(file);
 }
@@ -1112,36 +1112,36 @@ static void test_blocking_irp(void)
     HANDLE file;
 
     file = CreateFileA("\\\\.\\WineTestDriver\\", FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     memset(&io, 0xcc, sizeof(io));
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsSizeInformation);
-    ok(!status, "got %#x\n", status);
-    ok(!io.Status, "got iosb status %#x\n", io.Status);
+    ok(!status, "got %#lx\n", status);
+    ok(!io.Status, "got iosb status %#lx\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     io.Status = 0xdeadf00d;
     io.Information = 0xdeadf00d;
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsFullSizeInformation);
-    ok(status == STATUS_DEVICE_NOT_READY, "got %#x\n", status);
-    ok(io.Status == 0xdeadf00d, "got iosb status %#x\n", io.Status);
+    ok(status == STATUS_DEVICE_NOT_READY, "got %#lx\n", status);
+    ok(io.Status == 0xdeadf00d, "got iosb status %#lx\n", io.Status);
     ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
 
     CloseHandle(file);
 
     file = CreateFileA("\\\\.\\WineTestDriver\\", FILE_ALL_ACCESS, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     memset(&io, 0xcc, sizeof(io));
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsSizeInformation);
-    ok(!status, "got %#x\n", status);
-    ok(!io.Status, "got iosb status %#x\n", io.Status);
+    ok(!status, "got %#lx\n", status);
+    ok(!io.Status, "got iosb status %#lx\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     memset(&io, 0xcc, sizeof(io));
     status = NtQueryVolumeInformationFile(file, &io, buffer, sizeof(buffer), FileFsFullSizeInformation);
-    ok(status == STATUS_DEVICE_NOT_READY, "got %#x\n", status);
-    ok(io.Status == STATUS_DEVICE_NOT_READY, "got iosb status %#x\n", io.Status);
+    ok(status == STATUS_DEVICE_NOT_READY, "got %#lx\n", status);
+    ok(io.Status == STATUS_DEVICE_NOT_READY, "got iosb status %#lx\n", io.Status);
     ok(!io.Information, "got information %#Ix\n", io.Information);
 
     CloseHandle(file);
@@ -1161,7 +1161,7 @@ static void test_driver3(struct testsign_context *ctx)
     ok(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ||
        GetLastError() == ERROR_INVALID_FUNCTION ||
        GetLastError() == ERROR_PROC_NOT_FOUND /* XP */ ||
-       GetLastError() == ERROR_FILE_NOT_FOUND /* Win7 */, "got %u\n", GetLastError());
+       GetLastError() == ERROR_FILE_NOT_FOUND /* Win7 */, "got %lu\n", GetLastError());
 
     DeleteService(service);
     CloseServiceHandle(service);
@@ -1244,7 +1244,7 @@ static void test_driver_netio(struct testsign_context *ctx)
     }
 
     device = CreateFileA("\\\\.\\winetest_netio", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(device != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(device != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     hthread = CreateThread(NULL, 0, wsk_test_thread, NULL, 0, NULL);
     main_test();
@@ -1254,7 +1254,7 @@ static void test_driver_netio(struct testsign_context *ctx)
 
     unload_driver(service);
     ret = DeleteFileW(filename);
-    ok(ret, "DeleteFile failed: %u\n", GetLastError());
+    ok(ret, "DeleteFile failed: %lu\n", GetLastError());
 
     cat_okfile();
 }
@@ -1324,7 +1324,7 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
     BOOL ret;
 
     ret = CryptSIPRetrieveSubjectGuidForCatalogFile(file, NULL, &subject_guid);
-    todo_wine ok(ret, "Failed to get subject guid, error %u\n", GetLastError());
+    todo_wine ok(ret, "Failed to get subject guid, error %lu\n", GetLastError());
 
     size = 0;
     subject_info.pgSubjectType = &subject_guid;
@@ -1332,11 +1332,11 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
     subject_info.DigestAlgorithm.pszObjId = (char *)szOID_OIWSEC_sha1;
     subject_info.dwFlags = SPC_INC_PE_RESOURCES_FLAG | SPC_INC_PE_IMPORT_ADDR_TABLE_FLAG | SPC_EXC_PE_PAGE_HASHES_FLAG | 0x10000;
     ret = CryptSIPCreateIndirectData(&subject_info, &size, NULL);
-    todo_wine ok(ret, "Failed to get indirect data size, error %u\n", GetLastError());
+    todo_wine ok(ret, "Failed to get indirect data size, error %lu\n", GetLastError());
 
     indirect_data = malloc(size);
     ret = CryptSIPCreateIndirectData(&subject_info, &size, indirect_data);
-    todo_wine ok(ret, "Failed to get indirect data, error %u\n", GetLastError());
+    todo_wine ok(ret, "Failed to get indirect data, error %lu\n", GetLastError());
     if (ret)
     {
         memset(hash_buffer, 0, sizeof(hash_buffer));
@@ -1345,7 +1345,7 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
 
         member = CryptCATPutMemberInfo(catalog, (WCHAR *)file,
                 hash_buffer, &subject_guid, 0, size, (BYTE *)indirect_data);
-        ok(!!member, "Failed to write member, error %u\n", GetLastError());
+        ok(!!member, "Failed to write member, error %lu\n", GetLastError());
 
         if (wcsrchr(file, '\\'))
             filepart = wcsrchr(file, '\\') + 1;
@@ -1353,12 +1353,12 @@ static void add_file_to_catalog(HANDLE catalog, const WCHAR *file)
         ret = !!CryptCATPutAttrInfo(catalog, member, (WCHAR *)L"File",
                 CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
                 (wcslen(filepart) + 1) * 2, (BYTE *)filepart);
-        ok(ret, "Failed to write attr, error %u\n", GetLastError());
+        ok(ret, "Failed to write attr, error %lu\n", GetLastError());
 
         ret = !!CryptCATPutAttrInfo(catalog, member, (WCHAR *)L"OSAttr",
                 CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
                 sizeof(L"2:6.0"), (BYTE *)L"2:6.0");
-        ok(ret, "Failed to write attr, error %u\n", GetLastError());
+        ok(ret, "Failed to write attr, error %lu\n", GetLastError());
     }
 
     free(indirect_data);
@@ -1379,7 +1379,7 @@ static LRESULT WINAPI device_notify_proc(HWND window, UINT message, WPARAM wpara
         case DBT_DEVNODES_CHANGED:
             if (winetest_debug > 1) trace("device nodes changed\n");
 
-            ok(InSendMessageEx(NULL) == ISMEX_NOTIFY, "got message flags %#x\n", InSendMessageEx(NULL));
+            ok(InSendMessageEx(NULL) == ISMEX_NOTIFY, "got message flags %#lx\n", InSendMessageEx(NULL));
             ok(!lparam, "got lparam %#Ix\n", lparam);
             break;
 
@@ -1390,12 +1390,12 @@ static LRESULT WINAPI device_notify_proc(HWND window, UINT message, WPARAM wpara
 
             if (winetest_debug > 1) trace("device arrival %s\n", iface->dbcc_name);
 
-            ok(InSendMessageEx(NULL) == ISMEX_SEND, "got message flags %#x\n", InSendMessageEx(NULL));
+            ok(InSendMessageEx(NULL) == ISMEX_SEND, "got message flags %#lx\n", InSendMessageEx(NULL));
 
             ok(iface->dbcc_devicetype == DBT_DEVTYP_DEVICEINTERFACE,
-                    "got unexpected notification type %#x\n", iface->dbcc_devicetype);
-            ok(iface->dbcc_size >= expect_size, "expected size at least %u, got %u\n", expect_size, iface->dbcc_size);
-            ok(!iface->dbcc_reserved, "got reserved %#x\n", iface->dbcc_reserved);
+                    "got unexpected notification type %#lx\n", iface->dbcc_devicetype);
+            ok(iface->dbcc_size >= expect_size, "expected size at least %lu, got %lu\n", expect_size, iface->dbcc_size);
+            ok(!iface->dbcc_reserved, "got reserved %#lx\n", iface->dbcc_reserved);
             if (IsEqualGUID(&iface->dbcc_classguid, &bus_class))
             {
                 ++got_bus_arrival;
@@ -1418,12 +1418,12 @@ static LRESULT WINAPI device_notify_proc(HWND window, UINT message, WPARAM wpara
 
             if (winetest_debug > 1) trace("device removal %s\n", iface->dbcc_name);
 
-            ok(InSendMessageEx(NULL) == ISMEX_SEND, "got message flags %#x\n", InSendMessageEx(NULL));
+            ok(InSendMessageEx(NULL) == ISMEX_SEND, "got message flags %#lx\n", InSendMessageEx(NULL));
 
             ok(iface->dbcc_devicetype == DBT_DEVTYP_DEVICEINTERFACE,
-                    "got unexpected notification type %#x\n", iface->dbcc_devicetype);
-            ok(iface->dbcc_size >= expect_size, "expected size at least %u, got %u\n", expect_size, iface->dbcc_size);
-            ok(!iface->dbcc_reserved, "got reserved %#x\n", iface->dbcc_reserved);
+                    "got unexpected notification type %#lx\n", iface->dbcc_devicetype);
+            ok(iface->dbcc_size >= expect_size, "expected size at least %lu, got %lu\n", expect_size, iface->dbcc_size);
+            ok(!iface->dbcc_reserved, "got reserved %#lx\n", iface->dbcc_reserved);
             if (IsEqualGUID(&iface->dbcc_classguid, &bus_class))
             {
                 ++got_bus_removal;
@@ -1492,173 +1492,173 @@ static void test_pnp_devices(void)
     window = CreateWindowA("ntoskrnl_test_wc", NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
     ok(!!window, "failed to create window\n");
     notify_handle = RegisterDeviceNotificationA(window, &filter, DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
-    ok(!!notify_handle, "failed to register window, error %u\n", GetLastError());
+    ok(!!notify_handle, "failed to register window, error %lu\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&control_class, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
 
     ret = SetupDiEnumDeviceInfo(set, 0, &device);
-    ok(ret, "failed to get device, error %#x\n", GetLastError());
+    ok(ret, "failed to get device, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&device.ClassGuid, &GUID_DEVCLASS_SYSTEM), "wrong class %s\n", debugstr_guid(&device.ClassGuid));
 
     ret = SetupDiGetDeviceInstanceIdA(set, &device, buffer, sizeof(buffer), NULL);
-    ok(ret, "failed to get device ID, error %#x\n", GetLastError());
+    ok(ret, "failed to get device ID, error %#lx\n", GetLastError());
     ok(!strcasecmp(buffer, "root\\winetest\\0"), "got ID %s\n", debugstr_a(buffer));
 
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &control_class, 0, &iface);
-    ok(ret, "failed to get interface, error %#x\n", GetLastError());
+    ok(ret, "failed to get interface, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&iface.InterfaceClassGuid, &control_class),
             "wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid));
-    ok(iface.Flags == SPINT_ACTIVE, "got flags %#x\n", iface.Flags);
+    ok(iface.Flags == SPINT_ACTIVE, "got flags %#lx\n", iface.Flags);
 
     iface_detail->cbSize = sizeof(*iface_detail);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, iface_detail, sizeof(buffer), NULL, NULL);
-    ok(ret, "failed to get interface path, error %#x\n", GetLastError());
+    ok(ret, "failed to get interface path, error %#lx\n", GetLastError());
     ok(!strcasecmp(iface_detail->DevicePath, "\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}"),
             "wrong path %s\n", debugstr_a(iface_detail->DevicePath));
 
     SetupDiDestroyDeviceInfoList(set);
 
     bus = CreateFileA(iface_detail->DevicePath, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(bus != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(bus != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_MAIN, NULL, 0, NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     /* Test IoRegisterDeviceInterface() and IoSetDeviceInterfaceState(). */
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#lx\n", GetLastError());
     SetupDiDestroyDeviceInfoList(set);
 
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_REGISTER_IFACE, NULL, 0, NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
-    ok(ret, "failed to get interface, error %#x\n", GetLastError());
+    ok(ret, "failed to get interface, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&iface.InterfaceClassGuid, &bus_class),
             "wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid));
-    ok(!iface.Flags, "got flags %#x\n", iface.Flags);
+    ok(!iface.Flags, "got flags %#lx\n", iface.Flags);
     SetupDiDestroyDeviceInfoList(set);
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#lx\n", GetLastError());
     SetupDiDestroyDeviceInfoList(set);
 
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_ENABLE_IFACE, NULL, 0, NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     pump_messages();
     ok(got_bus_arrival == 1, "got %u bus arrival messages\n", got_bus_arrival);
     ok(!got_bus_removal, "got %u bus removal messages\n", got_bus_removal);
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
-    ok(ret, "failed to get interface, error %#x\n", GetLastError());
+    ok(ret, "failed to get interface, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&iface.InterfaceClassGuid, &bus_class),
             "wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid));
-    ok(iface.Flags == SPINT_ACTIVE, "got flags %#x\n", iface.Flags);
+    ok(iface.Flags == SPINT_ACTIVE, "got flags %#lx\n", iface.Flags);
     SetupDiDestroyDeviceInfoList(set);
 
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_DISABLE_IFACE, NULL, 0, NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     pump_messages();
     ok(got_bus_arrival == 1, "got %u bus arrival messages\n", got_bus_arrival);
     ok(got_bus_removal == 1, "got %u bus removal messages\n", got_bus_removal);
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
-    ok(ret, "failed to get interface, error %#x\n", GetLastError());
+    ok(ret, "failed to get interface, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&iface.InterfaceClassGuid, &bus_class),
             "wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid));
-    ok(!iface.Flags, "got flags %#x\n", iface.Flags);
+    ok(!iface.Flags, "got flags %#lx\n", iface.Flags);
     SetupDiDestroyDeviceInfoList(set);
 
     set = SetupDiGetClassDevsA(&bus_class, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, NULL, &bus_class, 0, &iface);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "got error %#lx\n", GetLastError());
     SetupDiDestroyDeviceInfoList(set);
 
     /* Test exposing a child device. */
 
     id = 1;
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_ADD_CHILD, &id, sizeof(id), NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     pump_messages();
     ok(got_child_arrival == 1, "got %u child arrival messages\n", got_child_arrival);
     ok(!got_child_removal, "got %u child removal messages\n", got_child_removal);
 
     set = SetupDiGetClassDevsA(&child_class, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
 
     ret = SetupDiEnumDeviceInfo(set, 0, &device);
-    ok(ret, "failed to get device, error %#x\n", GetLastError());
+    ok(ret, "failed to get device, error %#lx\n", GetLastError());
     ok(IsEqualGUID(&device.ClassGuid, &GUID_NULL), "wrong class %s\n", debugstr_guid(&device.ClassGuid));
 
     ret = SetupDiGetDeviceInstanceIdA(set, &device, buffer, sizeof(buffer), NULL);
-    ok(ret, "failed to get device ID, error %#x\n", GetLastError());
+    ok(ret, "failed to get device ID, error %#lx\n", GetLastError());
     ok(!strcasecmp(buffer, "wine\\test\\1"), "got ID %s\n", debugstr_a(buffer));
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CAPABILITIES,
             &type, (BYTE *)&dword, sizeof(dword), NULL);
-    todo_wine ok(ret, "got error %#x\n", GetLastError());
+    todo_wine ok(ret, "got error %#lx\n", GetLastError());
     if (ret)
     {
         ok(dword == (CM_DEVCAP_EJECTSUPPORTED | CM_DEVCAP_UNIQUEID
-                | CM_DEVCAP_RAWDEVICEOK | CM_DEVCAP_SURPRISEREMOVALOK), "got flags %#x\n", dword);
-        ok(type == REG_DWORD, "got type %u\n", type);
+                | CM_DEVCAP_RAWDEVICEOK | CM_DEVCAP_SURPRISEREMOVALOK), "got flags %#lx\n", dword);
+        ok(type == REG_DWORD, "got type %lu\n", type);
     }
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASSGUID,
             &type, (BYTE *)buffer, sizeof(buffer), NULL);
     todo_wine ok(!ret, "expected failure\n");
     if (ret)
-        ok(GetLastError() == ERROR_INVALID_DATA, "got error %#x\n", GetLastError());
+        ok(GetLastError() == ERROR_INVALID_DATA, "got error %#lx\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DEVTYPE,
             &type, (BYTE *)&dword, sizeof(dword), NULL);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "got error %#lx\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER,
             &type, (BYTE *)buffer, sizeof(buffer), NULL);
     ok(!ret, "expected failure\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "got error %#lx\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID,
             &type, (BYTE *)buffer, sizeof(buffer), &size);
-    ok(ret, "got error %#x\n", GetLastError());
-    ok(type == REG_MULTI_SZ, "got type %u\n", type);
-    ok(size == sizeof(expect_hardware_id), "got size %u\n", size);
+    ok(ret, "got error %#lx\n", GetLastError());
+    ok(type == REG_MULTI_SZ, "got type %lu\n", type);
+    ok(size == sizeof(expect_hardware_id), "got size %lu\n", size);
     ok(!memcmp(buffer, expect_hardware_id, size), "got hardware IDs %s\n", debugstr_an(buffer, size));
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_COMPATIBLEIDS,
             &type, (BYTE *)buffer, sizeof(buffer), &size);
-    ok(ret, "got error %#x\n", GetLastError());
-    ok(type == REG_MULTI_SZ, "got type %u\n", type);
-    ok(size == sizeof(expect_compat_id), "got size %u\n", size);
+    ok(ret, "got error %#lx\n", GetLastError());
+    ok(type == REG_MULTI_SZ, "got type %lu\n", type);
+    ok(size == sizeof(expect_compat_id), "got size %lu\n", size);
     ok(!memcmp(buffer, expect_compat_id, size), "got compatible IDs %s\n", debugstr_an(buffer, size));
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME,
             &type, (BYTE *)buffer, sizeof(buffer), NULL);
-    todo_wine ok(ret, "got error %#x\n", GetLastError());
+    todo_wine ok(ret, "got error %#lx\n", GetLastError());
     if (ret)
     {
-        ok(type == REG_SZ, "got type %u\n", type);
+        ok(type == REG_SZ, "got type %lu\n", type);
         ok(!strcmp(buffer, "\\Device\\winetest_pnp_1"), "got PDO name %s\n", debugstr_a(buffer));
     }
 
@@ -1671,9 +1671,9 @@ static void test_pnp_devices(void)
 
     id = 0xdeadbeef;
     ret = DeviceIoControl(child, IOCTL_WINETEST_CHILD_GET_ID, NULL, 0, &id, sizeof(id), &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
     ok(id == 1, "got id %d\n", id);
-    ok(size == sizeof(id), "got size %u\n", size);
+    ok(size == sizeof(id), "got size %lu\n", size);
 
     CloseHandle(child);
 
@@ -1682,27 +1682,27 @@ static void test_pnp_devices(void)
 
     ret = DeviceIoControl(child, IOCTL_WINETEST_CHILD_MARK_PENDING, NULL, 0, NULL, 0, &size, &ovl);
     ok(!ret, "DeviceIoControl succeeded\n");
-    ok(GetLastError() == ERROR_IO_PENDING, "got error %u\n", GetLastError());
-    ok(size == 0, "got size %u\n", size);
+    ok(GetLastError() == ERROR_IO_PENDING, "got error %lu\n", GetLastError());
+    ok(size == 0, "got size %lu\n", size);
 
     id = 1;
     ret = DeviceIoControl(bus, IOCTL_WINETEST_BUS_REMOVE_CHILD, &id, sizeof(id), NULL, 0, &size, NULL);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     pump_messages();
     ok(got_child_arrival == 1, "got %u child arrival messages\n", got_child_arrival);
     ok(got_child_removal == 1, "got %u child removal messages\n", got_child_removal);
 
     ret = DeviceIoControl(child, IOCTL_WINETEST_CHILD_CHECK_REMOVED, NULL, 0, NULL, 0, &size, NULL);
-    todo_wine ok(ret, "got error %u\n", GetLastError());
+    todo_wine ok(ret, "got error %lu\n", GetLastError());
 
     ret = NtOpenFile(&tmp, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT);
     todo_wine ok(ret == STATUS_NO_SUCH_DEVICE, "got %#x\n", ret);
 
     ret = GetOverlappedResult(child, &ovl, &size, TRUE);
     ok(!ret, "unexpected success.\n");
-    ok(GetLastError() == ERROR_ACCESS_DENIED, "got error %u\n", GetLastError());
-    ok(size == 0, "got size %u\n", size);
+    ok(GetLastError() == ERROR_ACCESS_DENIED, "got error %lu\n", GetLastError());
+    ok(size == 0, "got size %lu\n", size);
 
     CloseHandle(child);
 
@@ -1740,7 +1740,7 @@ static void test_pnp_driver(struct testsign_context *ctx)
 
     load_resource(L"driver_pnp.dll", driver_filename);
     ret = MoveFileExW(driver_filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
-    ok(ret, "failed to move file, error %u\n", GetLastError());
+    ok(ret, "failed to move file, error %lu\n", GetLastError());
 
     f = fopen("winetest.inf", "w");
     ok(!!f, "failed to open winetest.inf: %s\n", strerror(errno));
@@ -1750,47 +1750,47 @@ static void test_pnp_driver(struct testsign_context *ctx)
     /* Create the catalog file. */
 
     catalog = CryptCATOpen((WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0);
-    ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#x\n", GetLastError());
+    ok(catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %#lx\n", GetLastError());
 
     ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"HWID1",
             CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
             sizeof(L"test_hardware_id"), (BYTE *)L"test_hardware_id");
-    todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError());
+    todo_wine ok(ret, "failed to add attribute, error %#lx\n", GetLastError());
 
     ret = !!CryptCATPutCatAttrInfo(catalog, (WCHAR *)L"OS",
             CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
             sizeof(L"VistaX64"), (BYTE *)L"VistaX64");
-    todo_wine ok(ret, "failed to add attribute, error %#x\n", GetLastError());
+    todo_wine ok(ret, "failed to add attribute, error %#lx\n", GetLastError());
 
     add_file_to_catalog(catalog, L"winetest.sys");
     add_file_to_catalog(catalog, L"winetest.inf");
 
     ret = CryptCATPersistStore(catalog);
-    todo_wine ok(ret, "Failed to write catalog, error %u\n", GetLastError());
+    todo_wine ok(ret, "Failed to write catalog, error %lu\n", GetLastError());
 
     ret = CryptCATClose(catalog);
-    ok(ret, "Failed to close catalog, error %u\n", GetLastError());
+    ok(ret, "Failed to close catalog, error %lu\n", GetLastError());
 
     testsign_sign(ctx, L"winetest.cat");
 
     /* Install the driver. */
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to create device list, error %#lx\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "root\\winetest\\0", &GUID_NULL, NULL, NULL, 0, &device);
-    ok(ret, "failed to create device, error %#x\n", GetLastError());
+    ok(ret, "failed to create device, error %#lx\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA( set, &device, SPDRP_HARDWAREID,
             (const BYTE *)hardware_id, sizeof(hardware_id) );
-    ok(ret, "failed to create set hardware ID, error %#x\n", GetLastError());
+    ok(ret, "failed to create set hardware ID, error %#lx\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
-    ok(ret, "failed to register device, error %#x\n", GetLastError());
+    ok(ret, "failed to register device, error %#lx\n", GetLastError());
 
     GetFullPathNameA("winetest.inf", sizeof(path), path, NULL);
     ret = UpdateDriverForPlugAndPlayDevicesA(NULL, hardware_id, path, INSTALLFLAG_FORCE, &need_reboot);
-    ok(ret, "failed to install device, error %#x\n", GetLastError());
+    ok(ret, "failed to install device, error %#lx\n", GetLastError());
     ok(!need_reboot, "expected no reboot necessary\n");
 
     /* Tests. */
@@ -1800,31 +1800,31 @@ static void test_pnp_driver(struct testsign_context *ctx)
     /* Clean up. */
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-    ok(ret, "failed to remove device, error %#x\n", GetLastError());
+    ok(ret, "failed to remove device, error %#lx\n", GetLastError());
 
     file = CreateFileA("\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
     ok(file == INVALID_HANDLE_VALUE, "expected failure\n");
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError());
 
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "failed to destroy set, error %#x\n", GetLastError());
+    ok(ret, "failed to destroy set, error %#lx\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, "wine", NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "failed to get device list, error %#lx\n", GetLastError());
 
     for (i = 0; SetupDiEnumDeviceInfo(set, i, &device); ++i)
     {
         ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-        ok(ret, "failed to remove device, error %#x\n", GetLastError());
+        ok(ret, "failed to remove device, error %#lx\n", GetLastError());
     }
 
     SetupDiDestroyDeviceInfoList(set);
 
     /* Windows stops the service but does not delete it. */
     manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_CONNECT);
-    ok(!!manager, "failed to open service manager, error %u\n", GetLastError());
+    ok(!!manager, "failed to open service manager, error %lu\n", GetLastError());
     service = OpenServiceA(manager, "winetest", SERVICE_STOP | DELETE);
-    ok(!!service, "failed to open service, error %u\n", GetLastError());
+    ok(!!service, "failed to open service, error %lu\n", GetLastError());
     unload_driver(service);
     CloseServiceHandle(manager);
 
@@ -1832,19 +1832,19 @@ static void test_pnp_driver(struct testsign_context *ctx)
 
     GetFullPathNameA("winetest.inf", sizeof(path), path, NULL);
     ret = SetupCopyOEMInfA(path, NULL, 0, 0, dest, sizeof(dest), NULL, &filepart);
-    ok(ret, "Failed to copy INF, error %#x\n", GetLastError());
+    ok(ret, "Failed to copy INF, error %#lx\n", GetLastError());
     ret = SetupUninstallOEMInfA(filepart, 0, NULL);
-    ok(ret, "Failed to uninstall INF, error %u\n", GetLastError());
+    ok(ret, "Failed to uninstall INF, error %lu\n", GetLastError());
 
     ret = DeleteFileA("winetest.cat");
-    ok(ret, "Failed to delete file, error %u\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu\n", GetLastError());
     ret = DeleteFileA("winetest.inf");
-    ok(ret, "Failed to delete file, error %u\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu\n", GetLastError());
     ret = DeleteFileA("winetest.sys");
-    ok(ret, "Failed to delete file, error %u\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu\n", GetLastError());
     /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */
     ret = DeleteFileA("C:/windows/system32/drivers/winetest.sys");
-    ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError());
+    ok(ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %lu\n", GetLastError());
 
     SetCurrentDirectoryA(cwd);
 }
@@ -1877,7 +1877,7 @@ START_TEST(ntoskrnl)
 
     mapping = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
             0, sizeof(*test_data), "Global\\winetest_ntoskrnl_section");
-    ok(!!mapping, "got error %u\n", GetLastError());
+    ok(!!mapping, "got error %lu\n", GetLastError());
     test_data = MapViewOfFile(mapping, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 1024);
     test_data->running_under_wine = !strcmp(winetest_platform, "wine");
     test_data->winetest_report_success = winetest_report_success;
@@ -1885,7 +1885,7 @@ START_TEST(ntoskrnl)
 
     okfile = CreateFileA("C:\\windows\\winetest_ntoskrnl_okfile", GENERIC_READ | GENERIC_WRITE,
             FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
-    ok(okfile != INVALID_HANDLE_VALUE, "failed to create file, error %u\n", GetLastError());
+    ok(okfile != INVALID_HANDLE_VALUE, "failed to create file, error %lu\n", GetLastError());
 
     subtest("driver");
     if (!(service = load_driver(&ctx, filename, L"driver.dll", L"WineTestDriver")))
@@ -1899,7 +1899,7 @@ START_TEST(ntoskrnl)
     service2 = load_driver(&ctx, filename2, L"driver2.dll", L"WineTestDriver2");
 
     device = CreateFileA("\\\\.\\WineTestDriver", 0, 0, NULL, OPEN_EXISTING, 0, NULL);
-    ok(device != INVALID_HANDLE_VALUE, "failed to open device: %u\n", GetLastError());
+    ok(device != INVALID_HANDLE_VALUE, "failed to open device: %lu\n", GetLastError());
 
     test_basic_ioctl();
 
@@ -1916,16 +1916,16 @@ START_TEST(ntoskrnl)
     /* We need a separate ioctl to call IoDetachDevice(); calling it in the
      * driver unload routine causes a live-lock. */
     ret = DeviceIoControl(device, IOCTL_WINETEST_DETACH, NULL, 0, NULL, 0, &written, NULL);
-    ok(ret, "DeviceIoControl failed: %u\n", GetLastError());
+    ok(ret, "DeviceIoControl failed: %lu\n", GetLastError());
 
     CloseHandle(device);
 
     unload_driver(service2);
     unload_driver(service);
     ret = DeleteFileW(filename);
-    ok(ret, "DeleteFile failed: %u\n", GetLastError());
+    ok(ret, "DeleteFile failed: %lu\n", GetLastError());
     ret = DeleteFileW(filename2);
-    ok(ret, "DeleteFile failed: %u\n", GetLastError());
+    ok(ret, "DeleteFile failed: %lu\n", GetLastError());
 
     cat_okfile();
 
diff --git a/dlls/ntoskrnl.exe/tests/utils.h b/dlls/ntoskrnl.exe/tests/utils.h
index fc675e17dd0..aaf96fab616 100644
--- a/dlls/ntoskrnl.exe/tests/utils.h
+++ b/dlls/ntoskrnl.exe/tests/utils.h
@@ -189,7 +189,7 @@ static inline void winetest_cleanup(void)
 
     if (winetest_debug)
     {
-        kprintf("%04x:ntoskrnl: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+        kprintf("%04lx:ntoskrnl: %ld tests executed (%ld marked as todo, %ld %s), %ld skipped.\n",
                 (DWORD)(DWORD_PTR)PsGetCurrentProcessId(), successes + failures + todo_successes + todo_failures,
                 todo_successes, failures + todo_failures,
                 (failures + todo_failures != 1) ? "failures" : "failure", skipped );




More information about the wine-devel mailing list