[PATCH 10/20] dlls/user32/tests/[a-i]*.c: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Tue Mar 8 02:30:51 CST 2022


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

---
 dlls/user32/tests/broadcast.c  |   61 +++--
 dlls/user32/tests/class.c      |   85 ++++---
 dlls/user32/tests/clipboard.c  |  401 +++++++++++++++++----------------
 dlls/user32/tests/combo.c      |   59 +++--
 dlls/user32/tests/cursoricon.c |  301 +++++++++++++------------
 dlls/user32/tests/dce.c        |   25 +-
 dlls/user32/tests/dde.c        |  479 ++++++++++++++++++++--------------------
 dlls/user32/tests/dialog.c     |  109 +++++----
 dlls/user32/tests/edit.c       |  201 ++++++++---------
 dlls/user32/tests/generated.c  |    1 
 dlls/user32/tests/input.c      |  445 +++++++++++++++++++------------------
 11 files changed, 1089 insertions(+), 1078 deletions(-)

diff --git a/dlls/user32/tests/broadcast.c b/dlls/user32/tests/broadcast.c
index f80d455cba3..86f7ec2f26b 100644
--- a/dlls/user32/tests/broadcast.c
+++ b/dlls/user32/tests/broadcast.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for BroadcastSystemMessage
  *
@@ -37,13 +38,13 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
 {
     if (msg == WM_NULL)
     {
-        trace("main_window_procA: Sleeping for %lu ms\n", wparam);
+        trace("main_window_procA: Sleeping for %Iu ms\n", wparam);
         if (wparam)
         {
             if (WaitForSingleObject(hevent, wparam) == WAIT_TIMEOUT)
                 SetEvent(hevent);
         }
-        trace("main_window_procA: Returning WM_NULL with parameter %08lx\n", lparam);
+        trace("main_window_procA: Returning WM_NULL with parameter %08Ix\n", lparam);
         return lparam;
     }
 
@@ -90,52 +91,52 @@ static void test_parameters(PBROADCAST broadcast, const char *functionname)
         win_skip("%s is not implemented\n", functionname);
         return;
     }
-    ok(!ret || broken(ret), "Returned: %d\n", ret);
-    if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
+    ok(!ret || broken(ret), "Returned: %ld\n", ret);
+    if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcast( 0x80000000, &recips, WM_NULL, 0, 0 );
-    ok(!ret || broken(ret), "Returned: %d\n", ret);
-    if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
+    ok(!ret || broken(ret), "Returned: %ld\n", ret);
+    if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
 
 if (0) /* TODO: Check the hang flags */
 {
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0 );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 }
 
     SetLastError( 0xdeadbeef );
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 );
-    ok(ret==1, "Returned: %d\n", ret);
+    ok(ret==1, "Returned: %ld\n", ret);
     ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
     PulseEvent(hevent);
 
     recips = BSM_APPLICATIONS;
     ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
-    ok(ret==1, "Returned: %d\n", ret);
+    ok(ret==1, "Returned: %ld\n", ret);
     ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
     PulseEvent(hevent);
 }
@@ -152,51 +153,51 @@ static void test_parametersEx(PBROADCASTEX broadcastex)
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
-    ok(!ret, "Returned: %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
+    ok(!ret, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
-    ok(!ret, "Returned: %d\n", ret);
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
+    ok(!ret, "Returned: %ld\n", ret);
 
 if (0) /* TODO: Check the hang flags */
 {
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 
     SetLastError(0xcafebabe);
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
-    ok(0, "Last error: %08x\n", GetLastError());
-    ok(0, "Returned: %d\n", ret);
+    ok(0, "Last error: %08lx\n", GetLastError());
+    ok(0, "Returned: %ld\n", ret);
 }
 
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0, NULL );
-    ok(ret==1, "Returned: %d\n", ret);
+    ok(ret==1, "Returned: %ld\n", ret);
     ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
     PulseEvent(hevent);
 
     recips = BSM_APPLICATIONS;
     ret = broadcastex( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL );
-    ok(ret==1, "Returned: %d\n", ret);
+    ok(ret==1, "Returned: %ld\n", ret);
     ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
     PulseEvent(hevent);
 }
diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c
index c13893ae9d3..083aeb80b45 100644
--- a/dlls/user32/tests/class.c
+++ b/dlls/user32/tests/class.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for window classes.
  *
  * Copyright 2002 Mike McCormack
@@ -139,7 +140,7 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
     DestroyWindow(hTestWnd);
 
     ret = GetClassInfoW(hInstance2, className, &info);
-    ok(ret, "GetClassInfoW failed: %u\n", GetLastError());
+    ok(ret, "GetClassInfoW failed: %lu\n", GetLastError());
 
     hTestWnd = CreateWindowW (className, winName,
        WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
@@ -183,9 +184,9 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
     {
         SetLastError(0);
         ok(!SetClassLongW(hTestWnd,i*sizeof(DWORD),i+1),
-            "GetClassLongW(%d) initial value nonzero!\n",i);
+            "GetClassLongW(%ld) initial value nonzero!\n",i);
         ok(!GetLastError(),
-            "SetClassLongW(%d) failed!\n",i);
+            "SetClassLongW(%ld) failed!\n",i);
     }
 
     /* test values of valid classwords that we set */
@@ -339,7 +340,7 @@ static void check_instance_( int line, const char *name, HINSTANCE inst,
     ok_(__FILE__,line)(!UnregisterClassA(name, inst),
                        "UnregisterClassA should fail while exists a class window\n");
     ok_(__FILE__,line)(GetLastError() == ERROR_CLASS_HAS_WINDOWS,
-                       "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %d\n", GetLastError());
+                       "GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %ld\n", GetLastError());
     DestroyWindow(hwnd);
 }
 #define check_instance(name,inst,info_inst,gcl_inst) check_instance_(__LINE__,name,inst,info_inst,gcl_inst)
@@ -371,7 +372,7 @@ static void check_thread_instance( const char *name, HINSTANCE inst, HINSTANCE i
     class_info.gcl_inst = gcl_inst;
 
     hThread = CreateThread(NULL, 0, thread_proc, &class_info, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
 }
@@ -458,7 +459,7 @@ static void test_instances(void)
 
     /* setting global flag doesn't change status of class */
     hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
-    ok( hwnd != 0, "CreateWindow failed error %u\n", GetLastError());
+    ok( hwnd != 0, "CreateWindow failed error %lu\n", GetLastError());
     SetClassLongA( hwnd, GCL_STYLE, CS_GLOBALCLASS );
     cls.lpszMenuName  = "kernel32";
     cls.hInstance = kernel32;
@@ -525,7 +526,7 @@ static void test_instances(void)
     DestroyWindow( hwnd2 );
 
     r = GetClassNameA( hwnd, buffer, 4 );
-    ok( r == 3, "expected 3, got %d\n", r );
+    ok( r == 3, "expected 3, got %ld\n", r );
     ok( !strcmp( buffer, "__t"), "name wrong: %s\n", buffer );
 
     ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
@@ -542,7 +543,7 @@ static void test_instances(void)
     cls.lpszMenuName  = "null";
     cls.hInstance = 0;
     ok( !RegisterClassA( &cls ), "Succeeded registering local class for null instance\n" );
-    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
     ok( UnregisterClassA( name, main_module ), "Unregister failed for main module\n" );
 
     ok( RegisterClassA( &cls ), "Failed to register local class for null instance\n" );
@@ -551,17 +552,17 @@ static void test_instances(void)
     check_instance( name, main_module, main_module, main_module );
     check_thread_instance( name, main_module, main_module, main_module );
     ok( !GetClassInfoA( 0, name, &wc ), "Class found with null instance\n" );
-    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
     ok( UnregisterClassA( name, 0 ), "Unregister failed for null instance\n" );
 
     /* registering for user32 always fails */
     cls.lpszMenuName = "user32";
     cls.hInstance = user32;
     ok( !RegisterClassA( &cls ), "Succeeded registering local class for user32\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
     cls.style |= CS_GLOBALCLASS;
     ok( !RegisterClassA( &cls ), "Succeeded registering global class for user32\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
 
     /* unregister is OK though */
     cls.hInstance = main_module;
@@ -576,12 +577,12 @@ static void test_instances(void)
     cls.lpszMenuName  = "kernel32";
     cls.hInstance = kernel32;
     ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
-    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
     /* even if global flag is cleared */
     hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
     SetClassLongA( hwnd, GCL_STYLE, 0 );
     ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
-    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
 
     check_class( main_module, name, "main_module" );
     check_class( kernel32, name, "main_module" );
@@ -602,7 +603,7 @@ static void test_instances(void)
     DestroyWindow( hwnd );
     ok( UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister failed for main module global\n" );
     ok( !UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister succeeded the second time\n" );
-    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
 
     cls.hInstance = (HINSTANCE)0x12345678;
     ok( RegisterClassA( &cls ), "Failed to register global class for dummy instance\n" );
@@ -620,10 +621,10 @@ static void test_instances(void)
     cls.lpszClassName = "BUTTON";
     cls.hInstance = main_module;
     ok( !RegisterClassA( &cls ), "Succeeded registering global button class for main module\n" );
-    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
     cls.hInstance = kernel32;
     ok( !RegisterClassA( &cls ), "Succeeded registering global button class for kernel32\n" );
-    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
 
     /* local class is OK however */
     cls.style &= ~CS_GLOBALCLASS;
@@ -651,7 +652,7 @@ static void test_instances(void)
     ok( GetClassInfoA( kernel32, "BUTTON", &wc ), "Button class not found with kernel32\n" );
     ok( UnregisterClassA( "BUTTON", (HINSTANCE)0x12345678 ), "Failed to unregister button\n" );
     ok( !UnregisterClassA( "BUTTON", (HINSTANCE)0x87654321 ), "Unregistered button a second time\n" );
-    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
     ok( !GetClassInfoA( 0, "BUTTON", &wc ), "Button still exists\n" );
     /* last error not set reliably */
 
@@ -723,7 +724,7 @@ static void test_builtinproc(void)
                 cls.lpszClassName = (LPCSTR)classW;
                 atom = RegisterClassExW((WNDCLASSEXW *)&cls);
             }
-            ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
+            ok(atom != 0, "Couldn't register class, i=%d, %ld\n", i, GetLastError());
 
             hwnd = CreateWindowA(classA, NULL, 0, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), NULL);
             ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
@@ -992,29 +993,29 @@ static void test_GetClassInfo(void)
 
     SetLastError(0xdeadbeef);
     ret = GetClassInfoA(0, "static", &wc);
-    ok(ret, "GetClassInfoA() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
 
 if (0) { /* crashes under XP */
     SetLastError(0xdeadbeef);
     ret = GetClassInfoA(0, "static", NULL);
-    ok(ret, "GetClassInfoA() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetClassInfoW(0, staticW, NULL);
-    ok(ret, "GetClassInfoW() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoW() error %ld\n", GetLastError());
 }
 
     wcx.cbSize = sizeof(wcx);
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExA(0, "static", &wcx);
-    ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExA(0, "static", NULL);
     ok(!ret, "GetClassInfoExA() should fail\n");
     ok(GetLastError() == ERROR_NOACCESS ||
        broken(GetLastError() == 0xdeadbeef), /* win9x */
-       "expected ERROR_NOACCESS, got %d\n", GetLastError());
+       "expected ERROR_NOACCESS, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExW(0, staticW, NULL);
@@ -1022,14 +1023,14 @@ if (0) { /* crashes under XP */
     ok(GetLastError() == ERROR_NOACCESS ||
        broken(GetLastError() == 0xdeadbeef) /* NT4 */ ||
        broken(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), /* win9x */
-       "expected ERROR_NOACCESS, got %d\n", GetLastError());
+       "expected ERROR_NOACCESS, got %ld\n", GetLastError());
 
     wcx.cbSize = 0;
     wcx.lpfnWndProc = NULL;
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExA(0, "static", &wcx);
-    ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
-    ok(GetLastError() == 0xdeadbeef, "Unexpected error code %d\n", GetLastError());
+    ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Unexpected error code %ld\n", GetLastError());
     ok(wcx.cbSize == 0, "expected 0, got %u\n", wcx.cbSize);
     ok(wcx.lpfnWndProc != NULL, "got null proc\n");
 
@@ -1037,7 +1038,7 @@ if (0) { /* crashes under XP */
     wcx.lpfnWndProc = NULL;
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExA(0, "static", &wcx);
-    ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
     ok(wcx.cbSize == sizeof(wcx) - 1, "expected sizeof(wcx)-1, got %u\n", wcx.cbSize);
     ok(wcx.lpfnWndProc != NULL, "got null proc\n");
 
@@ -1045,7 +1046,7 @@ if (0) { /* crashes under XP */
     wcx.lpfnWndProc = NULL;
     SetLastError(0xdeadbeef);
     ret = GetClassInfoExA(0, "static", &wcx);
-    ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
+    ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
     ok(wcx.cbSize == sizeof(wcx) + 1, "expected sizeof(wcx)+1, got %u\n", wcx.cbSize);
     ok(wcx.lpfnWndProc != NULL, "got null proc\n");
 }
@@ -1117,7 +1118,7 @@ static void create_manifest_file(const char *filename, const char *manifest)
 
     MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
     file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
     WriteFile(file, manifest, strlen(manifest), &size, NULL);
     CloseHandle(file);
 }
@@ -1134,10 +1135,10 @@ static HANDLE create_test_actctx(const char *file)
     actctx.lpSource = path;
 
     handle = CreateActCtxW(&actctx);
-    ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %u\n", GetLastError());
+    ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %lu\n", GetLastError());
 
-    ok(actctx.cbSize == sizeof(actctx), "cbSize=%d\n", actctx.cbSize);
-    ok(actctx.dwFlags == 0, "dwFlags=%d\n", actctx.dwFlags);
+    ok(actctx.cbSize == sizeof(actctx), "cbSize=%ld\n", actctx.cbSize);
+    ok(actctx.dwFlags == 0, "dwFlags=%ld\n", actctx.dwFlags);
     ok(actctx.lpSource == path, "lpSource=%p\n", actctx.lpSource);
     ok(actctx.wProcessorArchitecture == 0, "wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
     ok(actctx.wLangId == 0, "wLangId=%d\n", actctx.wLangId);
@@ -1171,7 +1172,7 @@ static void test_comctl32_class( const char *name )
         create_manifest_file(path, comctl32_manifest);
         context = create_test_actctx(path);
         ret = DeleteFileA(path);
-        ok(ret, "Failed to delete manifest file, error %d.\n", GetLastError());
+        ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
 
         module = GetModuleHandleA( "comctl32" );
         ok( !module, "comctl32 already loaded\n" );
@@ -1308,10 +1309,10 @@ static void test_IME(void)
     ok(GetModuleHandleA("imm32") != 0, "imm32.dll is not loaded\n");
 
     ret = GetClassInfoA(NULL, "IME", &wnd_class);
-    ok(ret, "GetClassInfo failed: %d\n", GetLastError());
+    ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
 
     size = VirtualQuery(wnd_class.lpfnWndProc, &mbi, sizeof(mbi));
-    ok(size == sizeof(mbi), "VirtualQuery returned %ld\n", size);
+    ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
     if (size == sizeof(mbi)) {
         size = GetModuleFileNameA(mbi.AllocationBase, module_name, sizeof(module_name));
         ok(size, "GetModuleFileName failed\n");
@@ -1322,10 +1323,10 @@ static void test_IME(void)
     }
 
     ret = GetClassInfoW(NULL, ime_classW, &wnd_classw);
-    ok(ret, "GetClassInfo failed: %d\n", GetLastError());
+    ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
 
     size = VirtualQuery(wnd_classw.lpfnWndProc, &mbi, sizeof(mbi));
-    ok(size == sizeof(mbi), "VirtualQuery returned %ld\n", size);
+    ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
     size = GetModuleFileNameA(mbi.AllocationBase, module_name, sizeof(module_name));
     ok(size, "GetModuleFileName failed\n");
     for (ptr = module_name+size-1; ptr > module_name; ptr--)
@@ -1360,7 +1361,7 @@ static void test_actctx_classes(void)
     create_manifest_file(path, main_manifest);
     context = create_test_actctx(path);
     ret = DeleteFileA(path);
-    ok(ret, "Failed to delete manifest file, error %d.\n", GetLastError());
+    ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
 
     ret = ActivateActCtx(context, &cookie);
     ok(ret, "Failed to activate context.\n");
@@ -1511,7 +1512,7 @@ static void test_uxtheme(void)
     class.hInstance = GetModuleHandleA(NULL);
     class.lpszClassName = class_name;
     atom = RegisterClassExA(&class);
-    ok(atom, "RegisterClassExA failed, error %u.\n", GetLastError());
+    ok(atom, "RegisterClassExA failed, error %lu.\n", GetLastError());
 
     dll_loaded = !!GetModuleHandleA("comctl32.dll");
     ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
@@ -1522,7 +1523,7 @@ static void test_uxtheme(void)
     /* Creating a window triggers uxtheme load when theming is active */
     hwnd = CreateWindowA(class_name, "Test", WS_POPUP, 0, 0, 1, 1, NULL, NULL,
                          GetModuleHandleA(NULL), NULL);
-    ok(!!hwnd, "Failed to create a test window, error %u.\n", GetLastError());
+    ok(!!hwnd, "Failed to create a test window, error %lu.\n", GetLastError());
 
     dll_loaded = !!GetModuleHandleA("comctl32.dll");
     ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
@@ -1531,9 +1532,9 @@ static void test_uxtheme(void)
     dll_loaded = !!GetModuleHandleA("uxtheme.dll");
 
     uxtheme = LoadLibraryA("uxtheme.dll");
-    ok(!!uxtheme, "Failed to load uxtheme.dll, error %u.\n", GetLastError());
+    ok(!!uxtheme, "Failed to load uxtheme.dll, error %lu.\n", GetLastError());
     pIsThemeActive = (void *)GetProcAddress(uxtheme, "IsThemeActive");
-    ok(!!pIsThemeActive, "Failed to load IsThemeActive, error %u.\n", GetLastError());
+    ok(!!pIsThemeActive, "Failed to load IsThemeActive, error %lu.\n", GetLastError());
     is_theme_active = pIsThemeActive();
     FreeLibrary(uxtheme);
 
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c
index b673fc1add5..8ddebfd1c1e 100644
--- a/dlls/user32/tests/clipboard.c
+++ b/dlls/user32/tests/clipboard.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit test suite for clipboard functions.
  *
@@ -98,7 +99,7 @@ static DWORD WINAPI empty_clipboard_thread(LPVOID arg)
 {
     SetLastError( 0xdeadbeef );
     ok(!EmptyClipboard(), "%u: EmptyClipboard succeeded\n", thread_from_line );
-    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
+    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %lu\n",
         thread_from_line, GetLastError());
     return 0;
 }
@@ -130,22 +131,22 @@ static DWORD WINAPI set_clipboard_data_thread(LPVOID arg)
         SetClipboardData( CF_WAVE, 0 );
         ok( IsClipboardFormatAvailable( CF_WAVE ), "%u: SetClipboardData failed\n", thread_from_line );
         ret = SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 ));
-        ok( ret != 0, "%u: SetClipboardData failed err %u\n", thread_from_line, GetLastError() );
+        ok( ret != 0, "%u: SetClipboardData failed err %lu\n", thread_from_line, GetLastError() );
         SetLastError( 0xdeadbeef );
         ret = GetClipboardData( CF_WAVE );
         ok( !ret, "%u: GetClipboardData succeeded\n", thread_from_line );
-        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
+        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %lu\n",
             thread_from_line, GetLastError());
     }
     else
     {
         SetClipboardData( CF_WAVE, 0 );
-        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
+        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %lu\n",
             thread_from_line, GetLastError());
         ok( !IsClipboardFormatAvailable( CF_WAVE ), "%u: SetClipboardData succeeded\n", thread_from_line );
         ret = SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 ));
         ok( !ret, "%u: SetClipboardData succeeded\n", thread_from_line );
-        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %u\n",
+        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "%u: wrong error %lu\n",
             thread_from_line, GetLastError());
     }
     return 0;
@@ -161,17 +162,17 @@ static void set_clipboard_data_process( int arg )
     {
         ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
         ret = SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 ));
-        ok( ret != 0, "SetClipboardData failed err %u\n", GetLastError() );
+        ok( ret != 0, "SetClipboardData failed err %lu\n", GetLastError() );
     }
     else
     {
         SetClipboardData( CF_WAVE, 0 );
-        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n",
+        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %lu\n",
             GetLastError());
         ok( !IsClipboardFormatAvailable( CF_WAVE ), "SetClipboardData succeeded\n" );
         ret = SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 ));
         ok( !ret, "SetClipboardData succeeded\n" );
-        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n",
+        ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %lu\n",
             GetLastError());
     }
     winetest_pop_context();
@@ -189,7 +190,7 @@ static void grab_clipboard_process( int arg )
     if (arg)
     {
         HANDLE ret = SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 ));
-        ok( ret != 0, "process %u: SetClipboardData failed err %u\n", arg, GetLastError() );
+        ok( ret != 0, "process %u: SetClipboardData failed err %lu\n", arg, GetLastError() );
     }
 }
 
@@ -200,7 +201,7 @@ static void run_thread( LPTHREAD_START_ROUTINE func, void *arg, int line )
 
     thread_from_line = line;
     thread = CreateThread(NULL, 0, func, arg, 0, NULL);
-    ok(thread != NULL, "%u: CreateThread failed with error %d\n", line, GetLastError());
+    ok(thread != NULL, "%u: CreateThread failed with error %ld\n", line, GetLastError());
     for (;;)
     {
         ret = MsgWaitForMultipleObjectsEx( 1, &thread, 1000, QS_ALLINPUT, 0 );
@@ -211,7 +212,7 @@ static void run_thread( LPTHREAD_START_ROUTINE func, void *arg, int line )
         }
         else break;
     }
-    ok(ret == WAIT_OBJECT_0, "%u: expected WAIT_OBJECT_0, got %u\n", line, ret);
+    ok(ret == WAIT_OBJECT_0, "%u: expected WAIT_OBJECT_0, got %lu\n", line, ret);
     CloseHandle(thread);
 }
 
@@ -264,11 +265,11 @@ static LRESULT CALLBACK winproc_wrapper( HWND hwnd, UINT msg, WPARAM wp, LPARAM
         ok( wm_drawclipboard, "didn't receive WM_DRAWCLIPBOARD before WM_DESTROY\n" );
         break;
     case WM_DRAWCLIPBOARD:
-        ok( msg_flags == ISMEX_NOSEND, "WM_DRAWCLIPBOARD wrong flags %x\n", msg_flags );
+        ok( msg_flags == ISMEX_NOSEND, "WM_DRAWCLIPBOARD wrong flags %lx\n", msg_flags );
         wm_drawclipboard++;
         break;
     case WM_RENDERALLFORMATS:
-        ok( msg_flags == ISMEX_NOSEND, "WM_RENDERALLFORMATS wrong flags %x\n", msg_flags );
+        ok( msg_flags == ISMEX_NOSEND, "WM_RENDERALLFORMATS wrong flags %lx\n", msg_flags );
         wm_renderallformats++;
         break;
     }
@@ -286,25 +287,25 @@ static void test_ClipboardOwner(void)
 
     hWnd1 = CreateWindowExA(0, "static", NULL, WS_POPUP,
                                  0, 0, 10, 10, 0, 0, 0, NULL);
-    ok(hWnd1 != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hWnd1 != 0, "CreateWindowExA error %ld\n", GetLastError());
     trace("hWnd1 = %p\n", hWnd1);
 
     hWnd2 = CreateWindowExA(0, "static", NULL, WS_POPUP,
                                  0, 0, 10, 10, 0, 0, 0, NULL);
-    ok(hWnd2 != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hWnd2 != 0, "CreateWindowExA error %ld\n", GetLastError());
     trace("hWnd2 = %p\n", hWnd2);
 
     SetLastError(0xdeadbeef);
     ok(!CloseClipboard(), "CloseClipboard should fail if clipboard wasn't open\n");
     ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
-       "wrong error %u\n", GetLastError());
+       "wrong error %lu\n", GetLastError());
 
     ok(open_clipboard(0), "OpenClipboard failed\n");
     ok(!GetClipboardOwner(), "clipboard should still be not owned\n");
     ok(!OpenClipboard(hWnd1), "OpenClipboard should fail since clipboard already opened\n");
     ok(open_clipboard(0), "OpenClipboard again failed\n");
     ret = CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
 
     ok(open_clipboard(hWnd1), "OpenClipboard failed\n");
     run_thread( open_clipboard_thread, hWnd1, __LINE__ );
@@ -319,12 +320,12 @@ static void test_ClipboardOwner(void)
     SetLastError(0xdeadbeef);
     ret = OpenClipboard(hWnd2);
     ok(!ret && (GetLastError() == 0xdeadbeef || GetLastError() == ERROR_ACCESS_DENIED),
-       "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %d\n", GetLastError());
+       "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should still be not owned\n");
     ret = EmptyClipboard();
-    ok( ret, "EmptyClipboard error %d\n", GetLastError());
+    ok( ret, "EmptyClipboard error %ld\n", GetLastError());
     ok(GetClipboardOwner() == hWnd1, "clipboard should be owned by %p, not by %p\n", hWnd1, GetClipboardOwner());
     run_thread( empty_clipboard_thread, 0, __LINE__ );
     run_thread( set_clipboard_data_thread, hWnd1, __LINE__ );
@@ -335,17 +336,17 @@ static void test_ClipboardOwner(void)
     SetLastError(0xdeadbeef);
     ret = OpenClipboard(hWnd2);
     ok(!ret && (GetLastError() == 0xdeadbeef || GetLastError() == ERROR_ACCESS_DENIED),
-       "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %d\n", GetLastError());
+       "OpenClipboard should fail without setting last error value, or with ERROR_ACCESS_DENIED, got error %ld\n", GetLastError());
 
     ret = CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
     ok(GetClipboardOwner() == hWnd1, "clipboard should still be owned\n");
 
     /* any window will do, even from a different process */
     ret = open_clipboard( GetDesktopWindow() );
-    ok( ret, "OpenClipboard error %d\n", GetLastError());
+    ok( ret, "OpenClipboard error %ld\n", GetLastError());
     ret = EmptyClipboard();
-    ok( ret, "EmptyClipboard error %d\n", GetLastError());
+    ok( ret, "EmptyClipboard error %ld\n", GetLastError());
     ok( GetClipboardOwner() == GetDesktopWindow(), "wrong owner %p/%p\n",
         GetClipboardOwner(), GetDesktopWindow() );
     run_thread( set_clipboard_data_thread, GetDesktopWindow(), __LINE__ );
@@ -353,12 +354,12 @@ static void test_ClipboardOwner(void)
     ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
     run_process( "set_clipboard_data 2" );
     ret = CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
 
     ret = open_clipboard( hWnd1 );
-    ok( ret, "OpenClipboard error %d\n", GetLastError());
+    ok( ret, "OpenClipboard error %ld\n", GetLastError());
     ret = EmptyClipboard();
-    ok( ret, "EmptyClipboard error %d\n", GetLastError());
+    ok( ret, "EmptyClipboard error %ld\n", GetLastError());
     SetClipboardData( CF_WAVE, 0 );
     SetClipboardViewer( hWnd1 );
     ok( GetClipboardOwner() == hWnd1, "wrong owner %p/%p\n", GetClipboardOwner(), hWnd1 );
@@ -368,9 +369,9 @@ static void test_ClipboardOwner(void)
 
     old_proc = (WNDPROC)SetWindowLongPtrA( hWnd1, GWLP_WNDPROC, (LONG_PTR)winproc_wrapper );
     ret = DestroyWindow(hWnd1);
-    ok( ret, "DestroyWindow error %d\n", GetLastError());
+    ok( ret, "DestroyWindow error %ld\n", GetLastError());
     ret = DestroyWindow(hWnd2);
-    ok( ret, "DestroyWindow error %d\n", GetLastError());
+    ok( ret, "DestroyWindow error %ld\n", GetLastError());
     SetLastError(0xdeadbeef);
     ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should not be owned\n");
     ok(!GetClipboardViewer() && GetLastError() == 0xdeadbeef, "viewer still exists\n");
@@ -380,36 +381,36 @@ static void test_ClipboardOwner(void)
     SetLastError( 0xdeadbeef );
     ret = CloseClipboard();
     ok( !ret, "CloseClipboard succeeded\n" );
-    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %lu\n", GetLastError() );
 
     ret = open_clipboard( 0 );
-    ok( ret, "OpenClipboard error %d\n", GetLastError());
+    ok( ret, "OpenClipboard error %ld\n", GetLastError());
     run_thread( set_clipboard_data_thread, 0, __LINE__ );
     ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
     ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
     run_process( "set_clipboard_data 3" );
     ret = CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
 
     run_thread( open_and_empty_clipboard_thread, 0, __LINE__ );
     ok( has_no_open_wnd(), "wrong open window\n" );
     ok( !GetClipboardOwner(), "wrong owner window %p\n", GetClipboardOwner() );
 
     ret = open_clipboard( 0 );
-    ok( ret, "OpenClipboard error %d\n", GetLastError());
+    ok( ret, "OpenClipboard error %ld\n", GetLastError());
     run_thread( set_clipboard_data_thread, 0, __LINE__ );
     ok( IsClipboardFormatAvailable( CF_WAVE ), "CF_WAVE not available\n" );
     ok( GetClipboardData( CF_WAVE ) != 0, "CF_WAVE data not available\n" );
     run_process( "set_clipboard_data 4" );
     ret = EmptyClipboard();
-    ok( ret, "EmptyClipboard error %d\n", GetLastError());
+    ok( ret, "EmptyClipboard error %ld\n", GetLastError());
     ret = CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
 
     SetLastError( 0xdeadbeef );
     ok( !SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_DDESHARE | GMEM_ZEROINIT, 100 )),
         "SetClipboardData succeeded\n" );
-    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %lu\n", GetLastError() );
     ok( !IsClipboardFormatAvailable( CF_WAVE ), "SetClipboardData succeeded\n" );
 
     run_thread( open_and_empty_clipboard_thread, GetDesktopWindow(), __LINE__ );
@@ -450,7 +451,7 @@ static void test_RegisterClipboardFormatA(void)
     ok(len == 0 || lstrcmpA(buf, "my_cool_clipboard_format") != 0,
        "format_id should not be a valid local atom\n");
     ok(len != 0 || GetLastError() == ERROR_INVALID_HANDLE,
-       "err %d\n", GetLastError());
+       "err %ld\n", GetLastError());
 
     lstrcpyA(buf, "foo");
     SetLastError(0xdeadbeef);
@@ -458,12 +459,12 @@ static void test_RegisterClipboardFormatA(void)
     todo_wine ok(len == 0 || lstrcmpA(buf, "my_cool_clipboard_format") != 0,
        "format_id should not be a valid global atom\n");
     ok(len != 0 || GetLastError() == ERROR_INVALID_HANDLE,
-       "err %d\n", GetLastError());
+       "err %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     atom_id = FindAtomA("my_cool_clipboard_format");
     ok(atom_id == 0, "FindAtomA should fail, but it returned %x (format_id=%x)\n", atom_id, format_id);
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %ld\n", GetLastError());
 
     todo_wine
     {
@@ -471,7 +472,7 @@ static void test_RegisterClipboardFormatA(void)
     SetLastError(0xdeadbeef);
     atom_id = GlobalFindAtomA("my_cool_clipboard_format");
     ok(atom_id == 0, "GlobalFindAtomA should fail, but it returned %x (format_id=%x)\n", atom_id, format_id);
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %ld\n", GetLastError());
     }
 
     for (format_id = 0; format_id < 0x10fff; format_id++)
@@ -486,19 +487,19 @@ static void test_RegisterClipboardFormatA(void)
     }
 
     ret = open_clipboard(0);
-    ok( ret, "OpenClipboard error %d\n", GetLastError());
+    ok( ret, "OpenClipboard error %ld\n", GetLastError());
 
     /* try some invalid/unregistered formats */
     SetLastError( 0xdeadbeef );
     handle = SetClipboardData( 0, GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, 1 ));
     ok( !handle, "SetClipboardData succeeded\n" );
-    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError());
+    ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %lu\n", GetLastError());
     handle = SetClipboardData( 0x1234, GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, 1 ));
-    ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
+    ok( handle != 0, "SetClipboardData failed err %ld\n", GetLastError());
     handle = SetClipboardData( 0x123456, GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, 1 ));
-    ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
+    ok( handle != 0, "SetClipboardData failed err %ld\n", GetLastError());
     handle = SetClipboardData( 0xffff8765, GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE, 1 ));
-    ok( handle != 0, "SetClipboardData failed err %d\n", GetLastError());
+    ok( handle != 0, "SetClipboardData failed err %ld\n", GetLastError());
 
     ok( IsClipboardFormatAvailable( 0x1234 ), "format missing\n" );
     ok( IsClipboardFormatAvailable( 0x123456 ), "format missing\n" );
@@ -518,22 +519,22 @@ static void test_RegisterClipboardFormatA(void)
     }
 
     ret = EmptyClipboard();
-    ok( ret, "EmptyClipboard error %d\n", GetLastError());
+    ok( ret, "EmptyClipboard error %ld\n", GetLastError());
     ret =CloseClipboard();
-    ok( ret, "CloseClipboard error %d\n", GetLastError());
+    ok( ret, "CloseClipboard error %ld\n", GetLastError());
 
     if (CountClipboardFormats())
     {
         SetLastError(0xdeadbeef);
         ok(!EnumClipboardFormats(0), "EnumClipboardFormats should fail if clipboard wasn't open\n");
         ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN,
-           "Last error should be set to ERROR_CLIPBOARD_NOT_OPEN, not %d\n", GetLastError());
+           "Last error should be set to ERROR_CLIPBOARD_NOT_OPEN, not %ld\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
     ok(!EmptyClipboard(), "EmptyClipboard should fail if clipboard wasn't open\n");
     ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
-       "Wrong error %u\n", GetLastError());
+       "Wrong error %lu\n", GetLastError());
 
     format_id = RegisterClipboardFormatA("#1234");
     ok(format_id == 1234, "invalid clipboard format id %04x\n", format_id);
@@ -668,33 +669,33 @@ static void test_synthesized(void)
     emf = create_emf();
 
     r = open_clipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     h = SetClipboardData(CF_TEXT, htext);
     ok(h == htext, "got %p\n", h);
     h = SetClipboardData(CF_ENHMETAFILE, emf);
     ok(h == emf, "got %p\n", h);
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     count = CountClipboardFormats();
     ok( count == 6, "count %u\n", count );
     r = IsClipboardFormatAvailable( CF_TEXT );
-    ok( r, "CF_TEXT not available err %d\n", GetLastError());
+    ok( r, "CF_TEXT not available err %ld\n", GetLastError());
     r = IsClipboardFormatAvailable( CF_LOCALE );
-    ok( r, "CF_LOCALE not available err %d\n", GetLastError());
+    ok( r, "CF_LOCALE not available err %ld\n", GetLastError());
     r = IsClipboardFormatAvailable( CF_OEMTEXT );
-    ok( r, "CF_OEMTEXT not available err %d\n", GetLastError());
+    ok( r, "CF_OEMTEXT not available err %ld\n", GetLastError());
     r = IsClipboardFormatAvailable( CF_UNICODETEXT );
-    ok( r, "CF_UNICODETEXT not available err %d\n", GetLastError());
+    ok( r, "CF_UNICODETEXT not available err %ld\n", GetLastError());
     r = IsClipboardFormatAvailable( CF_ENHMETAFILE );
-    ok( r, "CF_ENHMETAFILE not available err %d\n", GetLastError());
+    ok( r, "CF_ENHMETAFILE not available err %ld\n", GetLastError());
     r = IsClipboardFormatAvailable( CF_METAFILEPICT );
-    ok( r, "CF_METAFILEPICT not available err %d\n", GetLastError());
+    ok( r, "CF_METAFILEPICT not available err %ld\n", GetLastError());
 
     r = open_clipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     cf = EnumClipboardFormats(0);
     ok(cf == CF_TEXT, "cf %08x\n", cf);
     data = GetClipboardData(cf);
@@ -727,54 +728,54 @@ static void test_synthesized(void)
     ok(cf == 0, "cf %08x\n", cf);
 
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     SetClipboardData( CF_UNICODETEXT, create_textW() );
     SetClipboardData( CF_TEXT, create_textA() );
     SetClipboardData( CF_OEMTEXT, create_textA() );
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     r = open_clipboard( NULL );
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats(0);
     ok( cf == CF_UNICODETEXT, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats(cf);
     ok( cf == CF_TEXT, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats(cf);
     ok( cf == CF_OEMTEXT, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats(cf);
     ok( cf == CF_LOCALE, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats( cf );
     ok( cf == 0, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     cf = EnumClipboardFormats( 0xdead );
     ok( cf == 0, "cf %08x\n", cf );
-    ok( GetLastError() == ERROR_SUCCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_SUCCESS, "wrong error %lu\n", GetLastError() );
 
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     for (i = 0; i < ARRAY_SIZE(tests); i++)
     {
         winetest_push_context("%d", i);
         r = open_clipboard(NULL);
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
         r = EmptyClipboard();
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
 
         switch (tests[i].format)
         {
@@ -804,7 +805,7 @@ static void test_synthesized(void)
         ok( count == 1, "count %u\n", count );
 
         r = CloseClipboard();
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
 
         count = CountClipboardFormats();
         for (j = 0; tests[i].expected[j]; j++)
@@ -815,7 +816,7 @@ static void test_synthesized(void)
         ok( count == j, "count %u instead of %u\n", count, j );
 
         r = open_clipboard( hwnd );
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
         cf = 0;
         for (j = 0; tests[i].expected[j]; j++)
         {
@@ -832,7 +833,7 @@ static void test_synthesized(void)
             data = GetClipboardData( cf );
             ok(data != NULL ||
                broken( tests[i].format == CF_DIBV5 && cf == CF_DIB ), /* >= Vista */
-               "couldn't get data, cf %04x err %d\n", cf, GetLastError());
+               "couldn't get data, cf %04x err %ld\n", cf, GetLastError());
             seq = GetClipboardSequenceNumber();
             ok(seq == old_seq, "sequence changed (test %d)\n", cf);
             switch (cf)
@@ -841,19 +842,19 @@ static void test_synthesized(void)
             {
                 UINT *ptr = GlobalLock( data );
                 DWORD layout = LOWORD( GetKeyboardLayout(0) );
-                ok( GlobalSize( data ) == sizeof(*ptr), "size %lu\n", GlobalSize( data ));
+                ok( GlobalSize( data ) == sizeof(*ptr), "size %Iu\n", GlobalSize( data ));
                 ok( *ptr == layout ||
                     broken( *ptr == MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT )),
-                    "CF_LOCALE %04x/%04x\n", *ptr, layout );
+                    "CF_LOCALE %04x/%04lx\n", *ptr, layout );
                 GlobalUnlock( data );
                 break;
             }
             case CF_TEXT:
             case CF_OEMTEXT:
-                ok( GlobalSize( data ) == 10, "wrong len %ld\n", GlobalSize( data ));
+                ok( GlobalSize( data ) == 10, "wrong len %Id\n", GlobalSize( data ));
                 break;
             case CF_UNICODETEXT:
-                ok( GlobalSize( data ) == 10 * sizeof(WCHAR), "wrong len %ld\n", GlobalSize( data ));
+                ok( GlobalSize( data ) == 10 * sizeof(WCHAR), "wrong len %Id\n", GlobalSize( data ));
                 break;
             }
             winetest_pop_context();
@@ -867,7 +868,7 @@ static void test_synthesized(void)
         /* now with delayed rendering */
 
         r = EmptyClipboard();
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
 
         rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
         ok( !rendered, "formats %08x have been rendered\n", rendered );
@@ -880,7 +881,7 @@ static void test_synthesized(void)
         ok( count == 1, "count %u\n", count );
 
         r = CloseClipboard();
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
         rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
         ok( !rendered, "formats %08x have been rendered\n", rendered );
 
@@ -895,7 +896,7 @@ static void test_synthesized(void)
         ok( !rendered, "formats %08x have been rendered\n", rendered );
 
         r = open_clipboard(NULL);
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
         cf = 0;
         for (j = 0; tests[i].expected[j]; j++)
         {
@@ -936,18 +937,18 @@ static void test_synthesized(void)
             ok(cf == 0, "cf %04x\n", cf);
         }
         r = CloseClipboard();
-        ok(r, "gle %d\n", GetLastError());
+        ok(r, "gle %ld\n", GetLastError());
         rendered = SendMessageA( hwnd, WM_USER, 0, 0 );
         ok( !rendered, "formats %08x have been rendered\n", rendered );
         winetest_pop_context();
     }
 
     r = open_clipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     DestroyWindow( hwnd );
 
     /* Check what happens to the delayed rendering clipboard formats when the
@@ -957,15 +958,15 @@ static void test_synthesized(void)
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)renderer_winproc );
 
     r = open_clipboard(hwnd);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     SetClipboardData( CF_UNICODETEXT, NULL );
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     r = open_clipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
     count = CountClipboardFormats();
     ok(count == 4, "count %u\n", count );
 
@@ -978,24 +979,24 @@ static void test_synthesized(void)
     ok(cf == CF_LOCALE, "unexpected clipboard format %u\n", cf);
 
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     r = open_clipboard(NULL);
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     data = GetClipboardData( CF_TEXT );
-    ok(GetLastError() == 0xdeadbeef, "bad last error %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "bad last error %ld\n", GetLastError());
     ok(!data, "GetClipboardData() should have returned NULL\n");
 
     r = CloseClipboard();
-    ok(r, "gle %d\n", GetLastError());
+    ok(r, "gle %ld\n", GetLastError());
 }
 
 static DWORD WINAPI clipboard_render_data_thread(void *param)
 {
     HANDLE handle = SetClipboardData( CF_UNICODETEXT, create_textW() );
-    ok( handle != 0, "SetClipboardData failed: %d\n", GetLastError() );
+    ok( handle != 0, "SetClipboardData failed: %ld\n", GetLastError() );
     return 0;
 }
 
@@ -1018,14 +1019,14 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
     switch(msg) {
     case WM_DRAWCLIPBOARD:
         ok( msg_flags == (cross_thread ? ISMEX_NOTIFY : ISMEX_NOSEND),
-            "WM_DRAWCLIPBOARD wrong flags %x\n", msg_flags );
+            "WM_DRAWCLIPBOARD wrong flags %lx\n", msg_flags );
         EnterCriticalSection(&clipboard_cs);
         wm_drawclipboard++;
         LeaveCriticalSection(&clipboard_cs);
         break;
     case WM_CHANGECBCHAIN:
         ok( msg_flags == (cross_thread ? ISMEX_SEND : ISMEX_NOSEND),
-            "WM_CHANGECBCHAIN wrong flags %x\n", msg_flags );
+            "WM_CHANGECBCHAIN wrong flags %lx\n", msg_flags );
         if (next_wnd == (HWND)wp)
             next_wnd = (HWND)lp;
         else if (next_wnd)
@@ -1033,13 +1034,13 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
         break;
     case WM_DESTROYCLIPBOARD:
         ok( msg_flags == (cross_thread ? ISMEX_SEND : ISMEX_NOSEND),
-            "WM_DESTROYCLIPBOARD wrong flags %x\n", msg_flags );
+            "WM_DESTROYCLIPBOARD wrong flags %lx\n", msg_flags );
         wm_destroyclipboard++;
         ok( GetClipboardOwner() == hwnd, "WM_DESTROYCLIPBOARD owner %p\n", GetClipboardOwner() );
         nb_formats = CountClipboardFormats();
         break;
     case WM_RENDERFORMAT:
-        ok( !wm_renderformat, "multiple WM_RENDERFORMAT %04x / %04lx\n", wm_renderformat, wp );
+        ok( !wm_renderformat, "multiple WM_RENDERFORMAT %04x / %04Ix\n", wm_renderformat, wp );
         wm_renderformat = wp;
 
         if (do_render_format)
@@ -1049,13 +1050,13 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
 
             old_seq = GetClipboardSequenceNumber();
             handle = SetClipboardData( CF_TEXT, create_textA() );
-            ok( handle != 0, "SetClipboardData failed: %d\n", GetLastError() );
+            ok( handle != 0, "SetClipboardData failed: %ld\n", GetLastError() );
             seq = GetClipboardSequenceNumber();
             ok( seq == old_seq, "sequence changed\n" );
             old_seq = seq;
 
             handle = CreateThread( NULL, 0, clipboard_render_data_thread, NULL, 0, NULL );
-            ok( handle != NULL, "CreateThread failed: %d\n", GetLastError() );
+            ok( handle != NULL, "CreateThread failed: %ld\n", GetLastError() );
             ok( WaitForSingleObject(handle, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n" );
             CloseHandle( handle );
             seq = GetClipboardSequenceNumber();
@@ -1064,7 +1065,7 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA
 
         break;
     case WM_CLIPBOARDUPDATE:
-        ok( msg_flags == ISMEX_NOSEND, "WM_CLIPBOARDUPDATE wrong flags %x\n", msg_flags );
+        ok( msg_flags == ISMEX_NOSEND, "WM_CLIPBOARDUPDATE wrong flags %lx\n", msg_flags );
         EnterCriticalSection(&clipboard_cs);
         wm_clipboardupdate++;
         SetEvent(update_event);
@@ -1103,11 +1104,11 @@ static void get_clipboard_data_process(void)
     BOOL r;
 
     r = open_clipboard(0);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     data = GetClipboardData( CF_UNICODETEXT );
-    ok( data != NULL, "GetClipboardData failed: %d\n", GetLastError());
+    ok( data != NULL, "GetClipboardData failed: %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
 }
 
 static UINT old_seq;
@@ -1157,38 +1158,38 @@ static DWORD WINAPI clipboard_thread(void *param)
     EnterCriticalSection(&clipboard_cs);
     SetLastError(0xdeadbeef);
     next_wnd = SetClipboardViewer(win);
-    ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "GetLastError = %ld\n", GetLastError());
     LeaveCriticalSection(&clipboard_cs);
 
     SetLastError( 0xdeadbeef );
     ret = SetClipboardViewer( (HWND)0xdead );
     ok( !ret, "SetClipboardViewer succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     r = ChangeClipboardChain( win, (HWND)0xdead );
     ok( !r, "ChangeClipboardChain succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     r = ChangeClipboardChain( (HWND)0xdead, next_wnd );
     ok( !r, "ChangeClipboardChain succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
 
     if (pAddClipboardFormatListener)
     {
         r = pAddClipboardFormatListener(win);
-        ok( r, "AddClipboardFormatListener failed err %d\n", GetLastError());
+        ok( r, "AddClipboardFormatListener failed err %ld\n", GetLastError());
         SetLastError( 0xdeadbeef );
         r = pAddClipboardFormatListener( win );
         ok( !r, "AddClipboardFormatListener succeeded\n" );
-        ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
         SetLastError( 0xdeadbeef );
         r = pAddClipboardFormatListener( (HWND)0xdead );
         ok( !r, "AddClipboardFormatListener succeeded\n" );
-        ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
         r = pAddClipboardFormatListener( GetDesktopWindow() );
-        ok( r, "AddClipboardFormatListener failed err %d\n", GetLastError());
+        ok( r, "AddClipboardFormatListener failed err %ld\n", GetLastError());
         r = pRemoveClipboardFormatListener( GetDesktopWindow() );
-        ok( r, "RemoveClipboardFormatListener failed err %d\n", GetLastError());
+        ok( r, "RemoveClipboardFormatListener failed err %ld\n", GetLastError());
     }
 
     check_messages(win, 0, 1, 0, 0, 0);
@@ -1196,27 +1197,27 @@ static DWORD WINAPI clipboard_thread(void *param)
     SetLastError( 0xdeadbeef );
     r = OpenClipboard( (HWND)0xdead );
     ok( !r, "OpenClipboard succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
 
     r = open_clipboard(win);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
 
     check_messages(win, 0, 0, 0, 0, 0);
 
     r = EmptyClipboard();
-    ok(r, "EmptyClipboard failed: %d\n", GetLastError());
+    ok(r, "EmptyClipboard failed: %ld\n", GetLastError());
 
     check_messages(win, 1, 0, 0, 0, 0);
 
     r = EmptyClipboard();
-    ok(r, "EmptyClipboard failed: %d\n", GetLastError());
+    ok(r, "EmptyClipboard failed: %ld\n", GetLastError());
     /* sequence changes again, even though it was already empty */
     check_messages(win, 1, 0, 0, 1, 0);
     count = SendMessageA( win, WM_USER+5, 0, 0 );
     ok( !count, "wrong format count %u on WM_DESTROYCLIPBOARD\n", count );
 
     handle = SetClipboardData( CF_TEXT, create_textA() );
-    ok(handle != 0, "SetClipboardData failed: %d\n", GetLastError());
+    ok(handle != 0, "SetClipboardData failed: %ld\n", GetLastError());
 
     check_messages(win, 1, 0, 0, 0, 0);
 
@@ -1234,13 +1235,13 @@ static DWORD WINAPI clipboard_thread(void *param)
 
     EnterCriticalSection(&clipboard_cs);
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     LeaveCriticalSection(&clipboard_cs);
 
     check_messages(win, 2, 1, 1, 0, 0);
 
     r = open_clipboard(win);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
 
     check_messages(win, 0, 0, 0, 0, 0);
 
@@ -1265,37 +1266,37 @@ static DWORD WINAPI clipboard_thread(void *param)
     check_messages(win, 1, 0, 0, 0, 0);
 
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     /* no synthesized format, so CloseClipboard doesn't change the sequence */
     check_messages(win, 0, 1, 1, 0, 0);
 
     r = open_clipboard(win);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     /* nothing changed */
     check_messages(win, 0, 0, 0, 0, 0);
 
     formats = CountClipboardFormats();
     r = open_clipboard(0);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     r = EmptyClipboard();
-    ok(r, "EmptyClipboard failed: %d\n", GetLastError());
+    ok(r, "EmptyClipboard failed: %ld\n", GetLastError());
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
 
     check_messages(win, 1, 1, 1, 1, 0);
     count = SendMessageA( win, WM_USER+5, 0, 0 );
     ok( count == formats, "wrong format count %u on WM_DESTROYCLIPBOARD\n", count );
 
     r = open_clipboard(win);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_FIXED, 1 ));
     check_messages(win, 1, 0, 0, 0, 0);
 
     EnterCriticalSection(&clipboard_cs);
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     LeaveCriticalSection(&clipboard_cs);
 
     check_messages(win, 0, 1, 1, 0, 0);
@@ -1312,13 +1313,13 @@ static DWORD WINAPI clipboard_thread(void *param)
     check_messages(win, 1, 1, 1, 0, 0);
 
     r = open_clipboard(0);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_FIXED, 1 ));
     check_messages(win, 1, 0, 0, 0, 0);
 
     EnterCriticalSection(&clipboard_cs);
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     LeaveCriticalSection(&clipboard_cs);
 
     check_messages(win, 0, 1, 1, 0, 0);
@@ -1335,13 +1336,13 @@ static DWORD WINAPI clipboard_thread(void *param)
     check_messages(win, 2, 1, 1, 0, 0);
 
     r = open_clipboard(0);
-    ok(r, "OpenClipboard failed: %d\n", GetLastError());
+    ok(r, "OpenClipboard failed: %ld\n", GetLastError());
     SetClipboardData( CF_WAVE, GlobalAlloc( GMEM_FIXED, 1 ));
     check_messages(win, 1, 0, 0, 0, 0);
 
     EnterCriticalSection(&clipboard_cs);
     r = CloseClipboard();
-    ok(r, "CloseClipboard failed: %d\n", GetLastError());
+    ok(r, "CloseClipboard failed: %ld\n", GetLastError());
     LeaveCriticalSection(&clipboard_cs);
 
     check_messages(win, 0, 1, 1, 0, 0);
@@ -1349,12 +1350,12 @@ static DWORD WINAPI clipboard_thread(void *param)
     if (cross_thread)
     {
         r = open_clipboard( win );
-        ok(r, "OpenClipboard failed: %d\n", GetLastError());
+        ok(r, "OpenClipboard failed: %ld\n", GetLastError());
         r = EmptyClipboard();
-        ok(r, "EmptyClipboard failed: %d\n", GetLastError());
+        ok(r, "EmptyClipboard failed: %ld\n", GetLastError());
         SetClipboardData( CF_TEXT, 0 );
         r = CloseClipboard();
-        ok(r, "CloseClipboard failed: %d\n", GetLastError());
+        ok(r, "CloseClipboard failed: %ld\n", GetLastError());
 
         do_render_format = TRUE;
         old_seq = GetClipboardSequenceNumber();
@@ -1365,20 +1366,20 @@ static DWORD WINAPI clipboard_thread(void *param)
     }
 
     r = PostMessageA(win, WM_USER, 0, 0);
-    ok(r, "PostMessage failed: %d\n", GetLastError());
+    ok(r, "PostMessage failed: %ld\n", GetLastError());
 
     if (pRemoveClipboardFormatListener)
     {
         r = pRemoveClipboardFormatListener(win);
-        ok( r, "RemoveClipboardFormatListener failed err %d\n", GetLastError());
+        ok( r, "RemoveClipboardFormatListener failed err %ld\n", GetLastError());
         SetLastError( 0xdeadbeef );
         r = pRemoveClipboardFormatListener(win);
         ok( !r, "RemoveClipboardFormatListener succeeded\n" );
-        ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
         SetLastError( 0xdeadbeef );
         r = pRemoveClipboardFormatListener( (HWND)0xdead );
         ok( !r, "RemoveClipboardFormatListener succeeded\n" );
-        ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
     }
     return 0;
 }
@@ -1401,10 +1402,10 @@ static void test_messages(void)
     RegisterClassA(&cls);
 
     win = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
-    ok(win != NULL, "CreateWindow failed: %d\n", GetLastError());
+    ok(win != NULL, "CreateWindow failed: %ld\n", GetLastError());
 
     thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid);
-    ok(thread != NULL, "CreateThread failed: %d\n", GetLastError());
+    ok(thread != NULL, "CreateThread failed: %ld\n", GetLastError());
 
     while(GetMessageA(&msg, NULL, 0, 0))
     {
@@ -1421,7 +1422,7 @@ static void test_messages(void)
     /* same tests again but inside a single thread */
 
     win = CreateWindowA( "clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0 );
-    ok( win != NULL, "CreateWindow failed: %d\n", GetLastError() );
+    ok( win != NULL, "CreateWindow failed: %ld\n", GetLastError() );
 
     clipboard_thread( win );
     DestroyWindow( win );
@@ -1479,11 +1480,11 @@ static void test_handles( HWND hwnd )
     hfixed = GlobalAlloc( GMEM_FIXED, 17 );
     hfixed2 = GlobalAlloc( GMEM_FIXED, 17 );
     ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
-    ok( GlobalSize( hfixed ) == 17, "wrong size %lu\n", GlobalSize( hfixed ));
+    ok( GlobalSize( hfixed ) == 17, "wrong size %Iu\n", GlobalSize( hfixed ));
 
     hmoveable = GlobalAlloc( GMEM_MOVEABLE, 23 );
     ok( is_moveable( hmoveable ), "expected moveable mem %p\n", hmoveable );
-    ok( GlobalSize( hmoveable ) == 23, "wrong size %lu\n", GlobalSize( hmoveable ));
+    ok( GlobalSize( hmoveable ) == 23, "wrong size %Iu\n", GlobalSize( hmoveable ));
 
     empty_fixed = GlobalAlloc( GMEM_FIXED, 0 );
     ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
@@ -1493,9 +1494,9 @@ static void test_handles( HWND hwnd )
     ok( is_freed( empty_moveable ), "expected free mem %p\n", empty_moveable );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     h = SetClipboardData( CF_TEXT, htext );
     ok( h == htext, "got %p\n", h );
@@ -1586,7 +1587,7 @@ static void test_handles( HWND hwnd )
 
     SetLastError( 0xdeadbeef );
     data = GetClipboardData( CF_RIFF );
-    ok( GetLastError() == 0xdeadbeef, "unexpected last error %d\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "unexpected last error %ld\n", GetLastError() );
     ok( !data, "wrong data %p\n", data );
 
     h = SetClipboardData( CF_PRIVATEFIRST + 7, htext4 );
@@ -1601,7 +1602,7 @@ static void test_handles( HWND hwnd )
         ok( is_freed( hfixed2 ), "expected freed mem %p\n", hfixed2 );
 
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     /* data handles are still valid */
     ok( is_moveable( htext ), "expected moveable mem %p\n", htext );
@@ -1616,7 +1617,7 @@ static void test_handles( HWND hwnd )
     ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     /* and now they are freed, unless we are the owner */
     if (!is_owner)
@@ -1641,19 +1642,19 @@ static void test_handles( HWND hwnd )
 
         data = GetClipboardData( format_id2 );
         ok( is_fixed( data ), "expected fixed mem %p\n", data );
-        ok( GlobalSize( data ) == 1, "wrong size %lu\n", GlobalSize( data ));
+        ok( GlobalSize( data ) == 1, "wrong size %Iu\n", GlobalSize( data ));
 
         data = GetClipboardData( 0xdeadbeef );
         ok( is_fixed( data ), "expected fixed mem %p\n", data );
-        ok( GlobalSize( data ) == 17, "wrong size %lu\n", GlobalSize( data ));
+        ok( GlobalSize( data ) == 17, "wrong size %Iu\n", GlobalSize( data ));
 
         data = GetClipboardData( 0xdeadbabe );
         ok( is_fixed( data ), "expected fixed mem %p\n", data );
-        ok( GlobalSize( data ) == 23, "wrong size %lu\n", GlobalSize( data ));
+        ok( GlobalSize( data ) == 23, "wrong size %Iu\n", GlobalSize( data ));
 
         data = GetClipboardData( 0xdeadfade );
         ok( is_fixed( data ) || !ptr, "expected fixed mem %p\n", data );
-        if (ptr) ok( GlobalSize( data ) == 37, "wrong size %lu\n", GlobalSize( data ));
+        if (ptr) ok( GlobalSize( data ) == 37, "wrong size %Iu\n", GlobalSize( data ));
     }
     else
     {
@@ -1712,7 +1713,7 @@ static void test_handles( HWND hwnd )
     ok( is_fixed( empty_fixed ), "expected fixed mem %p\n", empty_fixed );
 
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     /* w2003, w2008 don't seem to free the data here */
     ok( is_freed( htext ) || broken( !is_freed( htext )), "expected freed mem %p\n", htext );
@@ -1724,7 +1725,7 @@ static void test_handles( HWND hwnd )
     ok( is_fixed( hfixed ), "expected fixed mem %p\n", hfixed );
 
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 }
 
 static DWORD WINAPI test_handles_thread( void *arg )
@@ -1741,7 +1742,7 @@ static DWORD WINAPI test_handles_thread2( void *arg )
     char *ptr;
 
     r = open_clipboard( 0 );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = GetClipboardData( CF_TEXT );
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
     ptr = GlobalLock( h );
@@ -1781,7 +1782,7 @@ static DWORD WINAPI test_handles_thread2( void *arg )
     h = GetClipboardData( CF_DIBV5 );
     ok( is_fixed( h ), "expected fixed mem %p\n", h );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     return 0;
 }
 
@@ -1796,7 +1797,7 @@ static void test_handles_process( const char *str )
 
     format_id = RegisterClipboardFormatA( "my_cool_clipboard_format" );
     r = open_clipboard( 0 );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = GetClipboardData( CF_TEXT );
     ok( is_fixed( h ), "expected fixed mem %p\n", h );
     ptr = GlobalLock( h );
@@ -1848,21 +1849,21 @@ static void test_handles_process( const char *str )
     ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER),
         "GetEnhMetaFileBits failed on %p\n", h );
     ok( ((ENHMETAHEADER *)buffer)->nRecords == 3,
-        "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords );
+        "wrong records %lu\n", ((ENHMETAHEADER *)buffer)->nRecords );
     trace( "enhmetafile %p\n", h );
     h = GetClipboardData( CF_DSPENHMETAFILE );
     ok( GetObjectType( h ) == OBJ_ENHMETAFILE, "expected enhmetafile %p\n", h );
     ok( GetEnhMetaFileBits( h, sizeof(buffer), buffer ) > sizeof(ENHMETAHEADER),
         "GetEnhMetaFileBits failed on %p\n", h );
     ok( ((ENHMETAHEADER *)buffer)->nRecords == 3,
-        "wrong records %u\n", ((ENHMETAHEADER *)buffer)->nRecords );
+        "wrong records %lu\n", ((ENHMETAHEADER *)buffer)->nRecords );
     trace( "enhmetafile2 %p\n", h );
     h = GetClipboardData( CF_DIB );
     ok( is_fixed( h ), "expected fixed mem %p\n", h );
     h = GetClipboardData( CF_DIBV5 );
     ok( is_fixed( h ), "expected fixed mem %p\n", h );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 }
 
 static void test_handles_process_open( const char *str )
@@ -1885,12 +1886,12 @@ static void test_handles_process_dib( const char *str )
     HANDLE h;
 
     r = open_clipboard( 0 );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = GetClipboardData( CF_BITMAP );
     ok( !GetObjectType( h ), "expected invalid object %p\n", h );
     trace( "dibsection %p\n", h );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 }
 
 static void test_data_handles(void)
@@ -1914,9 +1915,9 @@ static void test_data_handles(void)
     palette = CreatePalette( &logpalette );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = SetClipboardData( CF_TEXT, create_textA() );
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
     h = SetClipboardData( format_id, create_textA() );
@@ -1944,13 +1945,13 @@ static void test_data_handles(void)
     h = SetClipboardData( CF_PRIVATEFIRST + 7, create_textA() );
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     run_thread( test_handles_thread2, 0, __LINE__ );
     run_process( "handles test" );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = GetClipboardData( CF_TEXT );
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
     h = GetClipboardData( format_id );
@@ -1961,7 +1962,7 @@ static void test_data_handles(void)
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
 
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     text = create_textA();
     h = SetClipboardData( CF_TEXT, text );
     ok( is_moveable( h ), "expected moveable mem %p\n", h );
@@ -1977,12 +1978,12 @@ static void test_data_handles(void)
     GlobalUnlock( h );
 
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( is_fixed( h ), "expected free mem %p\n", h );
     ok( is_freed( text ) || broken( is_moveable(text) ), /* w2003, w2008 */
         "expected free mem %p\n", text );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     /* test CF_BITMAP with a DIB section */
     memset( &bmi, 0, sizeof(bmi) );
@@ -1994,24 +1995,24 @@ static void test_data_handles(void)
     bitmap = CreateDIBSection( 0, &bmi, DIB_RGB_COLORS, &bits, 0, 0 );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     h = SetClipboardData( CF_BITMAP, bitmap );
     ok( GetObjectType( h ) == OBJ_BITMAP, "expected bitmap %p\n", h );
     trace( "dibsection %p\n", h );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     run_process( "handles_dib dummy" );
 
     r = open_clipboard( hwnd );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( GetObjectType( bitmap ) == OBJ_BITMAP, "expected bitmap %p\n", bitmap );
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     DestroyWindow( hwnd );
 }
@@ -2029,32 +2030,32 @@ static void test_GetUpdatedClipboardFormats(void)
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( NULL, 0, &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( !count, "wrong count %u\n", count );
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( NULL, 256, &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( !count, "wrong count %u\n", count );
 
     SetLastError( 0xdeadbeef );
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), NULL );
     ok( !r, "succeeded\n" );
-    ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_NOACCESS, "wrong error %lu\n", GetLastError() );
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( !count, "wrong count %u\n", count );
 
     r = open_clipboard( 0 );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     r = EmptyClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( !count, "wrong count %u\n", count );
 
     SetClipboardData( CF_UNICODETEXT, 0 );
@@ -2062,7 +2063,7 @@ static void test_GetUpdatedClipboardFormats(void)
     count = 0xdeadbeef;
     memset( formats, 0xcc, sizeof(formats) );
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( count == 1, "wrong count %u\n", count );
     ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
     ok( formats[1] == 0xcccccccc, "wrong format %u\n", formats[1] );
@@ -2071,7 +2072,7 @@ static void test_GetUpdatedClipboardFormats(void)
     count = 0xdeadbeef;
     memset( formats, 0xcc, sizeof(formats) );
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( count == 2, "wrong count %u\n", count );
     ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
     ok( formats[1] == CF_TEXT, "wrong format %u\n", formats[1] );
@@ -2081,23 +2082,23 @@ static void test_GetUpdatedClipboardFormats(void)
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( formats, 0, &count );
     ok( !r, "succeeded\n" );
-    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %lu\n", GetLastError() );
     ok( count == 2, "wrong count %u\n", count );
 
     SetLastError( 0xdeadbeef );
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( formats, 1, &count );
     ok( !r, "succeeded\n" );
-    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %lu\n", GetLastError() );
     ok( count == 2, "wrong count %u\n", count );
 
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
 
     count = 0xdeadbeef;
     memset( formats, 0xcc, sizeof(formats) );
     r = pGetUpdatedClipboardFormats( formats, ARRAY_SIZE(formats), &count );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     ok( count == 4, "wrong count %u\n", count );
     ok( formats[0] == CF_UNICODETEXT, "wrong format %u\n", formats[0] );
     ok( formats[1] == CF_TEXT, "wrong format %u\n", formats[1] );
@@ -2108,21 +2109,21 @@ static void test_GetUpdatedClipboardFormats(void)
     count = 0xdeadbeef;
     memset( formats, 0xcc, sizeof(formats) );
     r = pGetUpdatedClipboardFormats( formats, 2, &count );
-    ok( !r, "gle %d\n", GetLastError() );
-    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
+    ok( !r, "gle %ld\n", GetLastError() );
+    ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %lu\n", GetLastError() );
     ok( count == 4, "wrong count %u\n", count );
     ok( formats[0] == 0xcccccccc, "wrong format %u\n", formats[0] );
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( NULL, 256, &count );
-    ok( !r, "gle %d\n", GetLastError() );
-    ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
+    ok( !r, "gle %ld\n", GetLastError() );
+    ok( GetLastError() == ERROR_NOACCESS, "wrong error %lu\n", GetLastError() );
     ok( count == 4, "wrong count %u\n", count );
 
     count = 0xdeadbeef;
     r = pGetUpdatedClipboardFormats( NULL, 256, &count );
-    ok( !r, "gle %d\n", GetLastError() );
-    ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
+    ok( !r, "gle %ld\n", GetLastError() );
+    ok( GetLastError() == ERROR_NOACCESS, "wrong error %lu\n", GetLastError() );
     ok( count == 4, "wrong count %u\n", count );
 }
 
@@ -2165,9 +2166,9 @@ static void test_string_data(void)
 #endif
         winetest_push_context("%d", i);
         r = open_clipboard( 0 );
-        ok( r, "gle %d\n", GetLastError() );
+        ok( r, "gle %ld\n", GetLastError() );
         r = EmptyClipboard();
-        ok( r, "gle %d\n", GetLastError() );
+        ok( r, "gle %ld\n", GetLastError() );
         data = GlobalAlloc( GMEM_FIXED, test_data[i].len );
         if (test_data[i].strA[0])
         {
@@ -2188,7 +2189,7 @@ static void test_string_data(void)
                 "wrong data %s\n", wine_dbgstr_wn( data, (test_data[i].len + 1) / sizeof(WCHAR) ));
         }
         r = CloseClipboard();
-        ok( r, "gle %d\n", GetLastError() );
+        ok( r, "gle %ld\n", GetLastError() );
         sprintf( cmd, "string_data %u", i );
         run_process( cmd );
         winetest_pop_context();
@@ -2205,7 +2206,7 @@ static void test_string_data_process( int i )
 
     winetest_push_context("%d", i);
     r = open_clipboard( 0 );
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     if (test_data[i].strA[0])
     {
         data = GetClipboardData( CF_TEXT );
@@ -2250,7 +2251,7 @@ static void test_string_data_process( int i )
         }
     }
     r = CloseClipboard();
-    ok( r, "gle %d\n", GetLastError() );
+    ok( r, "gle %ld\n", GetLastError() );
     winetest_pop_context();
 }
 
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index 82401f75a01..be4a2b4b044 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for combo boxes.
  *
  * Copyright 2007 Mikolaj Zalewski
@@ -78,7 +79,7 @@ static void test_setitemheight(DWORD style)
     HFONT hFont;
     RECT r;
 
-    trace("Style %x\n", style);
+    trace("Style %lx\n", style);
     GetClientRect(hCombo, &r);
     expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8);
     SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
@@ -124,7 +125,7 @@ static void test_setfont(DWORD style)
         return;
     }
 
-    trace("Style %x\n", style);
+    trace("Style %lx\n", style);
 
     hCombo = build_combo(style);
     hFont1 = CreateFontA(10, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
@@ -334,7 +335,7 @@ static void test_WM_LBUTTONDOWN(void)
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     ret = GetComboBoxInfo(hCombo, &cbInfo);
-    ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+    ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
        GetLastError());
     hEdit = cbInfo.hwndItem;
     hList = cbInfo.hwndList;
@@ -346,7 +347,7 @@ static void test_WM_LBUTTONDOWN(void)
     x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
     y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
     result = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
-    ok(result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
+    ok(result, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
        GetLastError());
     ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
        "The dropdown list should have appeared after clicking the button.\n");
@@ -354,7 +355,7 @@ static void test_WM_LBUTTONDOWN(void)
     ok(GetFocus() == hEdit,
        "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
     result = SendMessageA(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
-    ok(result, "WM_LBUTTONUP was not processed. LastError=%d\n",
+    ok(result, "WM_LBUTTONUP was not processed. LastError=%ld\n",
        GetLastError());
     ok(GetFocus() == hEdit,
        "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
@@ -365,13 +366,13 @@ static void test_WM_LBUTTONDOWN(void)
     x = rect.left + (rect.right-rect.left)/2;
     y = item_height/2 + item_height*4;
     result = SendMessageA(hList, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
-    ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
+    ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
        GetLastError());
     ok(GetFocus() == hEdit,
        "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
 
     result = SendMessageA(hList, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
-    ok(!result, "WM_MOUSEMOVE was not processed. LastError=%d\n",
+    ok(!result, "WM_MOUSEMOVE was not processed. LastError=%ld\n",
        GetLastError());
     ok(GetFocus() == hEdit,
        "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
@@ -379,7 +380,7 @@ static void test_WM_LBUTTONDOWN(void)
        "The dropdown list should still be visible.\n");
 
     result = SendMessageA(hList, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
-    ok(!result, "WM_LBUTTONUP was not processed. LastError=%d\n",
+    ok(!result, "WM_LBUTTONUP was not processed. LastError=%ld\n",
        GetLastError());
     ok(GetFocus() == hEdit,
        "Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
@@ -407,29 +408,29 @@ static void test_changesize( DWORD style)
     /* first make it slightly smaller */
     MoveWindow( hCombo, 10, 10, clwidth - 2, clheight - 2, TRUE);
     GetClientRect( hCombo, &rc);
-    ok( rc.right - rc.left == clwidth - 2, "clientrect width is %d vs %d\n",
+    ok( rc.right - rc.left == clwidth - 2, "clientrect width is %ld vs %d\n",
             rc.right - rc.left, clwidth - 2);
-    ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
+    ok( rc.bottom - rc.top == clheight, "clientrect height is %ld vs %d\n",
                 rc.bottom - rc.top, clheight);
     SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
-    ok( rc.right - rc.left == clwidth - 2, "drop-down rect width is %d vs %d\n",
+    ok( rc.right - rc.left == clwidth - 2, "drop-down rect width is %ld vs %d\n",
             rc.right - rc.left, clwidth - 2);
-    ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %d vs %d\n",
+    ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %ld vs %d\n",
             rc.bottom - rc.top, ddheight);
-    ok( rc.right - rc.left == ddwidth -2, "drop-down rect width is %d vs %d\n",
+    ok( rc.right - rc.left == ddwidth -2, "drop-down rect width is %ld vs %d\n",
             rc.right - rc.left, ddwidth - 2);
     /* new cx, cy is slightly bigger than the initial values */
     MoveWindow( hCombo, 10, 10, clwidth + 2, clheight + 2, TRUE);
     GetClientRect( hCombo, &rc);
-    ok( rc.right - rc.left == clwidth + 2, "clientrect width is %d vs %d\n",
+    ok( rc.right - rc.left == clwidth + 2, "clientrect width is %ld vs %d\n",
             rc.right - rc.left, clwidth + 2);
-    ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
+    ok( rc.bottom - rc.top == clheight, "clientrect height is %ld vs %d\n",
             rc.bottom - rc.top, clheight);
     SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
-    ok( rc.right - rc.left == clwidth + 2, "drop-down rect width is %d vs %d\n",
+    ok( rc.right - rc.left == clwidth + 2, "drop-down rect width is %ld vs %d\n",
             rc.right - rc.left, clwidth + 2);
     todo_wine {
-        ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %d vs %d\n",
+        ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %ld vs %d\n",
                 rc.bottom - rc.top, clheight + 2);
     }
 
@@ -481,7 +482,7 @@ static void test_editselection(void)
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     ret = GetComboBoxInfo(hCombo, &cbInfo);
-    ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+    ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
        GetLastError());
     hEdit = cbInfo.hwndItem;
 
@@ -535,7 +536,7 @@ static void test_editselection(void)
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     ret = GetComboBoxInfo(hCombo, &cbInfo);
-    ok(ret, "Failed to get combobox info structure. LastError=%d\n",
+    ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
        GetLastError());
     hEdit = cbInfo.hwndItem;
 
@@ -614,7 +615,7 @@ static void test_editselection_focus(DWORD style)
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     ret = GetComboBoxInfo(hCombo, &cbInfo);
-    ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
+    ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
     hEdit = cbInfo.hwndItem;
 
     hButton = CreateWindowA("Button", "OK", WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON,
@@ -685,8 +686,8 @@ static void test_listbox_styles(DWORD cb_style)
 
     style = GetWindowLongW( info.hwndList, GWL_STYLE );
     exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
-    ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
-    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+    ok(style == expect_style, "%08lx: got %08lx\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
 
     if (cb_style != CBS_SIMPLE)
         expect_exstyle |= WS_EX_TOPMOST;
@@ -694,14 +695,14 @@ static void test_listbox_styles(DWORD cb_style)
     SendMessageW(combo, CB_SHOWDROPDOWN, TRUE, 0 );
     style = GetWindowLongW( info.hwndList, GWL_STYLE );
     exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
-    ok(style == (expect_style | WS_VISIBLE), "%08x: got %08x\n", cb_style, style);
-    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+    ok(style == (expect_style | WS_VISIBLE), "%08lx: got %08lx\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
 
     SendMessageW(combo, CB_SHOWDROPDOWN, FALSE, 0 );
     style = GetWindowLongW( info.hwndList, GWL_STYLE );
     exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
-    ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
-    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+    ok(style == expect_style, "%08lx: got %08lx\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
 
     DestroyWindow(combo);
 }
@@ -759,7 +760,7 @@ static void test_listbox_size(DWORD style)
         cbInfo.cbSize = sizeof(COMBOBOXINFO);
         SetLastError(0xdeadbeef);
         ret = GetComboBoxInfo(hCombo, &cbInfo);
-        ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
+        ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
 
         hList = cbInfo.hwndList;
         for (i = 0; i < info_test->num_items; i++)
@@ -769,7 +770,7 @@ static void test_listbox_size(DWORD style)
         x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
         y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
         ret = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
-        ok(ret, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
+        ok(ret, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
            GetLastError());
         ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
            "The dropdown list should have appeared after clicking the button.\n");
@@ -815,7 +816,7 @@ static void test_WS_VSCROLL(void)
 
     SetLastError(0xdeadbeef);
     ret = GetComboBoxInfo(hCombo, &info);
-    ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
+    ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
     hList = info.hwndList;
 
     for(i = 0; i < 3; i++)
diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c
index 3e8d7c1707f..d6aee461a5d 100644
--- a/dlls/user32/tests/cursoricon.c
+++ b/dlls/user32/tests/cursoricon.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit test suite for cursors and icons.
  *
@@ -321,7 +322,7 @@ static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARA
 
             memset(&info, 0, sizeof(info));
             ret = GetIconInfo(cursor, &info);
-            todo_wine ok(ret, "GetIconInfoEx failed with error %u\n", GetLastError());
+            todo_wine ok(ret, "GetIconInfoEx failed with error %lu\n", GetLastError());
             todo_wine ok(info.hbmColor != NULL, "info.hmbColor was not set\n");
             todo_wine ok(info.hbmMask != NULL, "info.hmbColor was not set\n");
             DeleteObject(info.hbmColor);
@@ -333,7 +334,7 @@ static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARA
             ok(!ret || broken(ret) /* win9x */, "DestroyCursor on the active cursor succeeded.\n");
             ok(error == ERROR_DESTROY_OBJECT_OF_OTHER_THREAD ||
                error == 0xdeadbeef,  /* vista */
-                "Last error: %u\n", error);
+                "Last error: %lu\n", error);
             return TRUE;
         }
         case WM_DESTROY:
@@ -375,12 +376,12 @@ static void do_child(void)
 
     SetLastError(0xdeadbeef);
     ret = RegisterClassA(&class);
-    ok(ret, "Failed to register window class.  Error: %u\n", GetLastError());
+    ok(ret, "Failed to register window class.  Error: %lu\n", GetLastError());
 
     /* Create a window. */
     child = CreateWindowA("cursor_child", "cursor_child", WS_POPUP | WS_VISIBLE,
         0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(child != 0, "CreateWindowA failed.  Error: %u\n", GetLastError());
+    ok(child != 0, "CreateWindowA failed.  Error: %lu\n", GetLastError());
 
     /* Let the parent know our HWND. */
     PostMessageA(parent, PROC_INIT, (WPARAM) child, 0);
@@ -388,7 +389,7 @@ static void do_child(void)
     /* Receive messages. */
     while ((ret = GetMessageA(&msg, 0, 0, 0)))
     {
-        ok(ret != -1, "GetMessage failed.  Error: %u\n", GetLastError());
+        ok(ret != -1, "GetMessage failed.  Error: %lu\n", GetLastError());
         TranslateMessage(&msg);
         DispatchMessageA(&msg);
     }
@@ -417,12 +418,12 @@ static void do_parent(void)
 
     SetLastError(0xdeadbeef);
     ret = RegisterClassA(&class);
-    ok(ret, "Failed to register window class.  Error: %u\n", GetLastError());
+    ok(ret, "Failed to register window class.  Error: %lu\n", GetLastError());
 
     /* Create a window. */
     parent = CreateWindowA("cursor_parent", "cursor_parent", WS_POPUP | WS_VISIBLE,
         0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(parent != 0, "CreateWindowA failed.  Error: %u\n", GetLastError());
+    ok(parent != 0, "CreateWindowA failed.  Error: %lu\n", GetLastError());
 
     /* Start child process. */
     memset(&startup, 0, sizeof(startup));
@@ -430,14 +431,14 @@ static void do_parent(void)
     startup.dwFlags = STARTF_USESHOWWINDOW;
     startup.wShowWindow = SW_SHOWNORMAL;
 
-    sprintf(path_name, "%s cursoricon %lx", test_argv[0], (INT_PTR)parent);
+    sprintf(path_name, "%s cursoricon %Ix", test_argv[0], (INT_PTR)parent);
     ok(CreateProcessA(NULL, path_name, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed.\n");
     child_process = info.hProcess;
 
     /* Wait for child window handle. */
     while ((child == 0) && (ret = GetMessageA(&msg, parent, 0, 0)))
     {
-        ok(ret != -1, "GetMessage failed.  Error: %u\n", GetLastError());
+        ok(ret != -1, "GetMessage failed.  Error: %lu\n", GetLastError());
         TranslateMessage(&msg);
         DispatchMessageA(&msg);
     }
@@ -513,10 +514,10 @@ static void check_copy_image(HBITMAP bitmap, UINT type, UINT flags, INT copyWidt
             .hbmMask = bitmap,
         };
         HICON icon = CreateIconIndirect(&info);
-        ok(!!icon, "Failed to create icon, error %u\n", GetLastError());
+        ok(!!icon, "Failed to create icon, error %lu\n", GetLastError());
         copy = CopyImage(icon, type, copyWidth, copyHeight, flags);
         ret = DestroyIcon(icon);
-        ok(ret, "Failed to destroy icon, error %u\n", GetLastError());
+        ok(ret, "Failed to destroy icon, error %lu\n", GetLastError());
     }
     ok(copy != NULL, "CopyImage() failed\n");
     if (copy != NULL)
@@ -530,7 +531,7 @@ static void check_copy_image(HBITMAP bitmap, UINT type, UINT flags, INT copyWidt
             ICONINFO info;
 
             ret = GetIconInfo((HICON)copy, &info);
-            ok(ret, "Failed to get icon info, error %u\n", GetLastError());
+            ok(ret, "Failed to get icon info, error %lu\n", GetLastError());
             GetObjectA(info.hbmColor, sizeof(copyBitmap), &copyBitmap);
         }
         copy_is_dib = (copyBitmap.bmBits != NULL);
@@ -576,7 +577,7 @@ static void check_copy_image(HBITMAP bitmap, UINT type, UINT flags, INT copyWidt
             ICONINFO info;
 
             ret = GetIconInfo((HICON)copy, &info);
-            ok(ret, "Failed to get icon info, error %u\n", GetLastError());
+            ok(ret, "Failed to get icon info, error %lu\n", GetLastError());
             GetObjectA(info.hbmMask, sizeof(copyBitmap), &copyBitmap);
 
             ok(!copyBitmap.bmBits, "Expected DDB\n");
@@ -765,7 +766,7 @@ static void test_initial_cursor(void)
         ok(cursor == cursor2, "cursor (%p) is not IDC_WAIT (%p).\n", cursor, cursor2);
     }
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
+    ok(error == 0xdeadbeef, "Last error: 0x%08lx\n", error);
 }
 
 static void test_icon_info_(HICON hIcon, UINT exp_cx, UINT exp_cy,
@@ -780,8 +781,8 @@ static void test_icon_info_(HICON hIcon, UINT exp_cx, UINT exp_cy,
     ok_(__FILE__, line)(ret, "GetIconInfo failed\n");
 
     /* CreateIcon under XP causes info.fIcon to be 0 */
-    ok_(__FILE__, line)(info.xHotspot == exp_cx/2, "info.xHotspot = %u\n", info.xHotspot);
-    ok_(__FILE__, line)(info.yHotspot == exp_cy/2, "info.yHotspot = %u\n", info.yHotspot);
+    ok_(__FILE__, line)(info.xHotspot == exp_cx/2, "info.xHotspot = %lu\n", info.xHotspot);
+    ok_(__FILE__, line)(info.yHotspot == exp_cy/2, "info.yHotspot = %lu\n", info.yHotspot);
     ok_(__FILE__, line)(info.hbmMask != 0, "info.hbmMask is NULL\n");
 
     if (mask_bits)
@@ -789,12 +790,12 @@ static void test_icon_info_(HICON hIcon, UINT exp_cx, UINT exp_cy,
         unsigned int exp_stride = (exp_cx + 7) / 8;
         exp_stride = (exp_stride + 1) & ~1;
         ret = GetBitmapBits(info.hbmMask, sizeof(ret_bits), ret_bits);
-        ok_(__FILE__, line)(ret == exp_stride * exp_mask_cy, "GetBitmapBits returned %u\n", ret);
+        ok_(__FILE__, line)(ret == exp_stride * exp_mask_cy, "GetBitmapBits returned %lu\n", ret);
         ok_(__FILE__, line)(!memcmp(ret_bits, mask_bits, ret), "mask bitmap didn't match\n");
     }
 
     ret = GetObjectA(info.hbmMask, sizeof(bmMask), &bmMask);
-    ok_(__FILE__, line)(ret == sizeof(bmMask), "GetObject(info.hbmMask) failed, ret %u\n", ret);
+    ok_(__FILE__, line)(ret == sizeof(bmMask), "GetObject(info.hbmMask) failed, ret %lu\n", ret);
 
     ok_(__FILE__, line)(!!info.hbmColor == has_color, "got hbmColor %p\n", info.hbmColor);
 
@@ -808,7 +809,7 @@ static void test_icon_info_(HICON hIcon, UINT exp_cx, UINT exp_cy,
         ReleaseDC(0, hdc);
 
         ret = GetObjectA(info.hbmColor, sizeof(bmColor), &bmColor);
-        ok_(__FILE__, line)(ret == sizeof(bmColor), "GetObject(info.hbmColor) failed, ret %u\n", ret);
+        ok_(__FILE__, line)(ret == sizeof(bmColor), "GetObject(info.hbmColor) failed, ret %lu\n", ret);
 
         ok_(__FILE__, line)(bmColor.bmBitsPixel == display_bpp /* XP */ ||
            bmColor.bmBitsPixel == exp_bpp /* Win98 */,
@@ -835,24 +836,24 @@ static void test_icon_info_(HICON hIcon, UINT exp_cx, UINT exp_cy,
         infoex.cbSize = sizeof(infoex) - 1;
         ret = pGetIconInfoExA( hIcon, &infoex );
         ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
-        ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %d\n", GetLastError());
+        ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %ld\n", GetLastError());
 
         SetLastError( 0xdeadbeef );
         infoex.cbSize = sizeof(infoex) + 1;
         ret = pGetIconInfoExA( hIcon, &infoex );
         ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
-        ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %d\n", GetLastError());
+        ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %ld\n", GetLastError());
 
         SetLastError( 0xdeadbeef );
         infoex.cbSize = sizeof(infoex);
         ret = pGetIconInfoExA( (HICON)0xdeadbabe, &infoex );
         ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
         ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_CURSOR_HANDLE,
-                            "wrong error %d\n", GetLastError());
+                            "wrong error %ld\n", GetLastError());
 
         infoex.cbSize = sizeof(infoex);
         ret = pGetIconInfoExA( hIcon, &infoex );
-        ok_(__FILE__, line)(ret, "GetIconInfoEx failed err %d\n", GetLastError());
+        ok_(__FILE__, line)(ret, "GetIconInfoEx failed err %ld\n", GetLastError());
         ok_(__FILE__, line)(infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID);
         ok_(__FILE__, line)(infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName);
         ok_(__FILE__, line)(infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName);
@@ -912,7 +913,7 @@ static void test_CreateIcon(void)
     SetLastError(0xdeadbeaf);
     hIcon = CreateIconIndirect(&info);
     ok(!hIcon, "CreateIconIndirect should fail\n");
-    ok(GetLastError() == 0xdeadbeaf, "wrong error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeaf, "wrong error %lu\n", GetLastError());
 
     info.fIcon = TRUE;
     info.xHotspot = 8;
@@ -922,7 +923,7 @@ static void test_CreateIcon(void)
     SetLastError(0xdeadbeaf);
     hIcon = CreateIconIndirect(&info);
     ok(!hIcon, "CreateIconIndirect should fail\n");
-    ok(GetLastError() == 0xdeadbeaf, "wrong error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeaf, "wrong error %lu\n", GetLastError());
 
     info.fIcon = TRUE;
     info.xHotspot = 8;
@@ -1160,7 +1161,7 @@ static void test_LoadImageBitmap(HBITMAP hbm)
     HDC hdc = GetDC(NULL);
 
     ret = GetObjectA(hbm, sizeof(bm), &bm);
-    ok(ret == sizeof(bm), "GetObject returned %d\n", ret);
+    ok(ret == sizeof(bm), "GetObject returned %ld\n", ret);
 
     memset(&bmi, 0, sizeof(bmi));
     bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
@@ -1170,9 +1171,9 @@ static void test_LoadImageBitmap(HBITMAP hbm)
     bmi.bmiHeader.biBitCount= 24;
     bmi.bmiHeader.biCompression= BI_RGB;
     ret = GetDIBits(hdc, hbm, 0, bm.bmHeight, &pixel, &bmi, DIB_RGB_COLORS);
-    ok(ret == bm.bmHeight, "%d lines were converted, not %d\n", ret, bm.bmHeight);
+    ok(ret == bm.bmHeight, "%ld lines were converted, not %d\n", ret, bm.bmHeight);
 
-    ok(color_match(pixel, 0x00ffffff), "Pixel is 0x%08x\n", pixel);
+    ok(color_match(pixel, 0x00ffffff), "Pixel is 0x%08lx\n", pixel);
 
     ReleaseDC(NULL, hdc);
 }
@@ -1192,7 +1193,7 @@ static void test_LoadImageFile(const char * test_desc, const unsigned char * ima
     /* Create the test image. */
     handle = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW,
         FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(handle != INVALID_HANDLE_VALUE, "CreateFileA failed. %u\n", GetLastError());
+    ok(handle != INVALID_HANDLE_VALUE, "CreateFileA failed. %lu\n", GetLastError());
     ret = WriteFile(handle, image_data, image_size, &bytes_written, NULL);
     ok(ret && bytes_written == image_size, "test file created improperly.\n");
     CloseHandle(handle);
@@ -1205,7 +1206,7 @@ static void test_LoadImageFile(const char * test_desc, const unsigned char * ima
     ok(error == 0 ||
         broken(error == 0xdeadbeef) || /* Win9x */
         broken(error == ERROR_BAD_PATHNAME), /* Win98, WinMe */
-        "Last error: %u\n", error);
+        "Last error: %lu\n", error);
     if (handle != NULL) DestroyCursor(handle);
 
     /* Load as icon. For all tested formats, this should fail */
@@ -1216,7 +1217,7 @@ static void test_LoadImageFile(const char * test_desc, const unsigned char * ima
     ok(error == 0 ||
         broken(error == 0xdeadbeef) || /* Win9x */
         broken(error == ERROR_BAD_PATHNAME), /* Win98, WinMe */
-        "Last error: %u\n", error);
+        "Last error: %lu\n", error);
     if (handle != NULL) DestroyIcon(handle);
 
     /* Load as bitmap. Should succeed for correct bmp, fail for everything else */
@@ -1225,7 +1226,7 @@ static void test_LoadImageFile(const char * test_desc, const unsigned char * ima
     error = GetLastError();
     ok(error == 0 ||
         error == 0xdeadbeef, /* Win9x, WinMe */
-        "Last error: %u\n", error);
+        "Last error: %lu\n", error);
 
     if (expect_success) {
         ok(handle != NULL, "IMAGE_BITMAP failed\n");
@@ -1296,7 +1297,7 @@ static void create_ico_file(const char *filename, const test_icon_entries_t *tes
 
     /* Create the icon. */
     file = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed. %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed. %lu\n", GetLastError());
     ret = WriteFile(file, buf, icon_size, &bytes_written, NULL);
     ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n");
     CloseHandle(file);
@@ -1325,15 +1326,15 @@ static void create_bitmap_file(const char *filename, const BITMAPINFO *bmi, cons
     hdr.bfReserved2 = 0;
 
     file = CreateFileA(filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed, result %u.\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed, result %lu.\n", GetLastError());
     ret = WriteFile(file, &hdr, sizeof(hdr), &bytes_written, NULL);
-    ok(ret && bytes_written == sizeof(hdr), "Unexpected WriteFile() result, ret %#x, bytes_written %u.\n",
+    ok(ret && bytes_written == sizeof(hdr), "Unexpected WriteFile() result, ret %#x, bytes_written %lu.\n",
             ret, bytes_written);
     ret = WriteFile(file, bmi, bmi_size, &bytes_written, NULL);
-    ok(ret && bytes_written == bmi_size, "Unexpected WriteFile() result, ret %#x, bytes_written %u.\n",
+    ok(ret && bytes_written == bmi_size, "Unexpected WriteFile() result, ret %#x, bytes_written %lu.\n",
             ret, bytes_written);
     ret = WriteFile(file, bits, bits_size, &bytes_written, NULL);
-    ok(ret && bytes_written == bits_size, "Unexpected WriteFile() result, ret %#x, bytes_written %u.\n",
+    ok(ret && bytes_written == bits_size, "Unexpected WriteFile() result, ret %#x, bytes_written %lu.\n",
             ret, bytes_written);
     CloseHandle(file);
 }
@@ -1354,7 +1355,7 @@ static void test_LoadImage_working_directory_run(char *path)
     create_ico_file(path_icon, &icon_desc, 1);
 
     handle = CreateFileA(path_image, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(handle != INVALID_HANDLE_VALUE, "run %s: CreateFileA failed. %u\n", path, GetLastError());
+    ok(handle != INVALID_HANDLE_VALUE, "run %s: CreateFileA failed. %lu\n", path, GetLastError());
     ret = WriteFile(handle, bmpimage, sizeof(bmpimage), &bytes_written, NULL);
     ok(ret && bytes_written == sizeof(bmpimage), "run %s: Test file created improperly.\n", path);
     CloseHandle(handle);
@@ -1364,20 +1365,20 @@ static void test_LoadImage_working_directory_run(char *path)
     ok(handle != NULL, "run %s: LoadImage() failed.\n", path);
 
     ret = DestroyIcon(handle);
-    ok(ret, "run %s: DestroyIcon failed: %d\n", path, GetLastError());
+    ok(ret, "run %s: DestroyIcon failed: %ld\n", path, GetLastError());
 
     /* Test image */
     handle = LoadImageA(NULL, "test.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
     ok(handle != NULL, "run %s: LoadImageA failed.\n", path);
 
     ret = DeleteObject(handle);
-    ok(ret, "run %s: DeleteObject failed: %d\n", path, GetLastError());
+    ok(ret, "run %s: DeleteObject failed: %ld\n", path, GetLastError());
 
     /* Cleanup */
     ret = DeleteFileA(path_image);
-    ok(ret, "run %s: DeleteFileA failed: %d\n", path, GetLastError());
+    ok(ret, "run %s: DeleteFileA failed: %ld\n", path, GetLastError());
     ret = DeleteFileA(path_icon);
-    ok(ret, "run %s: DeleteFileA failed: %d\n", path, GetLastError());
+    ok(ret, "run %s: DeleteFileA failed: %ld\n", path, GetLastError());
 }
 
 static void test_LoadImage_working_directory(void)
@@ -1419,9 +1420,9 @@ static void test_LoadImage_working_directory(void)
     SetEnvironmentVariableA("PATH", old_PATH);
 
     ret = RemoveDirectoryA(temp_dir_current);
-    ok(ret, "RemoveDirectoryA failed: %d\n", GetLastError());
+    ok(ret, "RemoveDirectoryA failed: %ld\n", GetLastError());
     ret = RemoveDirectoryA(temp_dir_PATH);
-    ok(ret, "RemoveDirectoryA failed: %d\n", GetLastError());
+    ok(ret, "RemoveDirectoryA failed: %ld\n", GetLastError());
 }
 
 static void test_LoadImage(void)
@@ -1453,20 +1454,20 @@ static void test_LoadImage(void)
     ok(error == 0 ||
         broken(error == 0xdeadbeef) || /* Win9x */
         broken(error == ERROR_BAD_PATHNAME), /* Win98, WinMe */
-        "Last error: %u\n", error);
+        "Last error: %lu\n", error);
 
     /* Test the icon information. */
     SetLastError(0xdeadbeef);
     ret = GetIconInfo(handle, &icon_info);
     ok(ret, "GetIconInfo() failed.\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     if (ret)
     {
         ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
-        ok(icon_info.xHotspot == 1, "xHotspot is %u.\n", icon_info.xHotspot);
-        ok(icon_info.yHotspot == 1, "yHotspot is %u.\n", icon_info.yHotspot);
+        ok(icon_info.xHotspot == 1, "xHotspot is %lu.\n", icon_info.xHotspot);
+        ok(icon_info.yHotspot == 1, "yHotspot is %lu.\n", icon_info.yHotspot);
         ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
            "No hbmColor!\n");
         ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
@@ -1477,7 +1478,7 @@ static void test_LoadImage(void)
         ICONINFOEXA infoex;
         infoex.cbSize = sizeof(infoex);
         ret = pGetIconInfoExA( handle, &infoex );
-        ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
+        ok( ret, "GetIconInfoEx failed err %ld\n", GetLastError() );
         ok( infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID );
         ok( infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName );
         ok( infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName );
@@ -1489,7 +1490,7 @@ static void test_LoadImage(void)
     ret = DestroyCursor(handle);
     ok(ret, "DestroyCursor() failed.\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     DeleteFileA("icon.ico");
 
@@ -1502,7 +1503,7 @@ static void test_LoadImage(void)
         ICONINFOEXW infoexW;
         infoexA.cbSize = sizeof(infoexA);
         ret = pGetIconInfoExA( handle, &infoexA );
-        ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
+        ok( ret, "GetIconInfoEx failed err %ld\n", GetLastError() );
         ok( infoexA.wResID == (UINT_PTR)IDI_HAND, "GetIconInfoEx wrong resid %x\n", infoexA.wResID );
         /* the A version is broken on 64-bit, it truncates the string after the first char */
         if (is_win64 && infoexA.szModName[0] && infoexA.szModName[1] == 0)
@@ -1513,7 +1514,7 @@ static void test_LoadImage(void)
         ok( infoexA.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoexA.szResName );
         infoexW.cbSize = sizeof(infoexW);
         ret = pGetIconInfoExW( handle, &infoexW );
-        ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
+        ok( ret, "GetIconInfoEx failed err %ld\n", GetLastError() );
         ok( infoexW.wResID == (UINT_PTR)IDI_HAND, "GetIconInfoEx wrong resid %x\n", infoexW.wResID );
         ok( GetModuleHandleW(infoexW.szModName) == GetModuleHandleA("user32.dll"),
             "GetIconInfoEx wrong module %s\n", wine_dbgstr_w(infoexW.szModName) );
@@ -1603,20 +1604,20 @@ static void test_CreateIconFromResource(void)
     handle = CreateIconFromResource((PBYTE) hotspot, CRSR_RES_SIZE, FALSE, 0x00030000);
     ok(handle != NULL, "Create cursor failed.\n");
     ret = DestroyCursor(handle);
-    ok(ret, "Destroy cursor failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy cursor failed, error %lu.\n", GetLastError());
 
     /* Test the icon information. */
     SetLastError(0xdeadbeef);
     ret = GetIconInfo(handle, &icon_info);
     ok(ret, "GetIconInfo() failed.\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     if (ret)
     {
         ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
-        ok(icon_info.xHotspot == 3, "xHotspot is %u.\n", icon_info.xHotspot);
-        ok(icon_info.yHotspot == 3, "yHotspot is %u.\n", icon_info.yHotspot);
+        ok(icon_info.xHotspot == 3, "xHotspot is %lu.\n", icon_info.xHotspot);
+        ok(icon_info.yHotspot == 3, "yHotspot is %lu.\n", icon_info.yHotspot);
         ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
            "No hbmColor!\n");
         ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
@@ -1627,7 +1628,7 @@ static void test_CreateIconFromResource(void)
         ICONINFOEXA infoex;
         infoex.cbSize = sizeof(infoex);
         ret = pGetIconInfoExA( handle, &infoex );
-        ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
+        ok( ret, "GetIconInfoEx failed err %ld\n", GetLastError() );
         ok( infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID );
         ok( infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName );
         ok( infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName );
@@ -1639,21 +1640,21 @@ static void test_CreateIconFromResource(void)
 				    0x00030000);
     ok(handle != NULL, "Create icon failed.\n");
     ret = DestroyIcon(handle);
-    ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy icon failed, error %lu.\n", GetLastError());
 
     /* Test the icon information. */
     SetLastError(0xdeadbeef);
     ret = GetIconInfo(handle, &icon_info);
     ok(ret, "GetIconInfo() failed.\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     if (ret)
     {
         ok(icon_info.fIcon == TRUE, "fIcon != TRUE.\n");
 	/* Icons always have hotspot in the middle */
-        ok(icon_info.xHotspot == ICON_WIDTH/2, "xHotspot is %u.\n", icon_info.xHotspot);
-        ok(icon_info.yHotspot == ICON_HEIGHT/2, "yHotspot is %u.\n", icon_info.yHotspot);
+        ok(icon_info.xHotspot == ICON_WIDTH/2, "xHotspot is %lu.\n", icon_info.xHotspot);
+        ok(icon_info.yHotspot == ICON_HEIGHT/2, "yHotspot is %lu.\n", icon_info.yHotspot);
         ok(icon_info.hbmColor != NULL, "No hbmColor!\n");
         ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
     }
@@ -1671,7 +1672,7 @@ static void test_CreateIconFromResource(void)
     handle = CreateIconFromResource((PBYTE) &empty_anicursor, sizeof(empty_anicursor), FALSE, 0x00030000);
     ok(handle != NULL, "Create cursor failed.\n");
     ret = DestroyCursor(handle);
-    ok(ret, "Destroy cursor failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy cursor failed, error %lu.\n", GetLastError());
 
     /* Test the animated cursor's information. */
     SetLastError(0xdeadbeef);
@@ -1680,13 +1681,13 @@ static void test_CreateIconFromResource(void)
     ok(ret, "GetIconInfo() failed.\n");
     error = GetLastError();
     todo_wine
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     if (ret)
     {
         ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
-        ok(icon_info.xHotspot == 3, "xHotspot is %u.\n", icon_info.xHotspot);
-        ok(icon_info.yHotspot == 3, "yHotspot is %u.\n", icon_info.yHotspot);
+        ok(icon_info.xHotspot == 3, "xHotspot is %lu.\n", icon_info.xHotspot);
+        ok(icon_info.yHotspot == 3, "yHotspot is %lu.\n", icon_info.yHotspot);
         ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
            "No hbmColor!\n");
         ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
@@ -1695,27 +1696,27 @@ static void test_CreateIconFromResource(void)
     /* Test creating and destroying a non-shared icon. */
     handle = CreateIconFromResourceEx((BYTE *)icon_header, ICON_RES_SIZE, TRUE, 0x00030000,
                                        0, 0, LR_DEFAULTSIZE);
-    ok(handle != NULL, "Create icon failed, error %u.\n", GetLastError());
+    ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError());
     ret = DestroyIcon(handle);
-    ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy icon failed, error %lu.\n", GetLastError());
     ret = GetIconInfo(handle, &icon_info);
     ok(!ret, "Get info succeeded.\n");
-    ok(GetLastError() == ERROR_INVALID_CURSOR_HANDLE, "Got unexpected error %u.\n", error);
+    ok(GetLastError() == ERROR_INVALID_CURSOR_HANDLE, "Got unexpected error %lu.\n", error);
 
     /* Test creating and destroying a shared icon from heap bits. */
     handle = CreateIconFromResourceEx((BYTE *)icon_header, ICON_RES_SIZE, TRUE, 0x00030000,
                                        0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    ok(handle != NULL, "Create icon failed, error %u.\n", GetLastError());
+    ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError());
     ret = DestroyIcon(handle);
-    ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy icon failed, error %lu.\n", GetLastError());
     ret = GetIconInfo(handle, &icon_info);
-    ok(ret, "Get info failed, error %u.\n", GetLastError());
+    ok(ret, "Get info failed, error %lu.\n", GetLastError());
 
     /* Test creating a shared icon from heap bits that has been created before. */
     old_handle = handle;
     handle = CreateIconFromResourceEx((BYTE *)icon_header, ICON_RES_SIZE, TRUE, 0x00030000,
                                        0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    ok(handle != NULL, "Create icon failed, error %u.\n", GetLastError());
+    ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError());
     ok(handle != old_handle, "Expect a different handle.\n");
 
     HeapFree(GetProcessHeap(), 0, hotspot);
@@ -1724,34 +1725,34 @@ static void test_CreateIconFromResource(void)
     user32 = GetModuleHandleA("user32.dll");
     EnumResourceNamesA(user32, (const char *)RT_GROUP_ICON, find_res_proc, (LONG_PTR)&res_name);
     rsrc = FindResourceA(user32, res_name, (const char *)RT_GROUP_ICON);
-    ok(rsrc != NULL, "Find resource failed, error %u.\n", GetLastError());
+    ok(rsrc != NULL, "Find resource failed, error %lu.\n", GetLastError());
     res = LoadResource(user32, rsrc);
-    ok(res != NULL, "Load resource failed, error %u.\n", GetLastError());
+    ok(res != NULL, "Load resource failed, error %lu.\n", GetLastError());
     bits = LockResource(res);
-    ok(bits != NULL, "Lock resource failed, error %u.\n", GetLastError());
+    ok(bits != NULL, "Lock resource failed, error %lu.\n", GetLastError());
 
     res_name = MAKEINTRESOURCEA(LookupIconIdFromDirectory(bits, TRUE));
     rsrc = FindResourceA(user32, res_name, (const char *)RT_ICON);
-    ok(rsrc != NULL, "Find resource failed, error %u.\n", GetLastError());
+    ok(rsrc != NULL, "Find resource failed, error %lu.\n", GetLastError());
     size = SizeofResource(user32, rsrc);
-    ok(size != 0, "Get resource size failed, error %u.\n", GetLastError());
+    ok(size != 0, "Get resource size failed, error %lu.\n", GetLastError());
     res = LoadResource(user32, rsrc);
-    ok(res != NULL, "Load resource failed, error %u.\n", GetLastError());
+    ok(res != NULL, "Load resource failed, error %lu.\n", GetLastError());
     bits = LockResource(res);
-    ok(bits != NULL, "Lock resource failed, error %u.\n", GetLastError());
+    ok(bits != NULL, "Lock resource failed, error %lu.\n", GetLastError());
 
     /* Test creating and destroying a shared icon from resource bits. */
     handle = CreateIconFromResourceEx(bits, size, TRUE, 0x00030000, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    ok(handle != NULL, "Create icon failed, error %u\n", GetLastError());
+    ok(handle != NULL, "Create icon failed, error %lu\n", GetLastError());
     ret = DestroyIcon(handle);
-    ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
+    ok(ret, "Destroy icon failed, error %lu.\n", GetLastError());
     ret = GetIconInfo(handle, &icon_info);
-    ok(ret, "Get info failed, error %u.\n", GetLastError());
+    ok(ret, "Get info failed, error %lu.\n", GetLastError());
 
     /* Test creating a shared icon from resource bits that has been created before. */
     old_handle = handle;
     handle = CreateIconFromResourceEx(bits, size, TRUE, 0x00030000, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
-    ok(handle != NULL, "Create icon failed, error %u.\n", GetLastError());
+    ok(handle != NULL, "Create icon failed, error %lu.\n", GetLastError());
     ok(handle != old_handle, "Expect a different handle.\n");
 }
 
@@ -1790,7 +1791,7 @@ static int check_cursor_data( HDC hdc, HCURSOR hCursor, void *data, int length)
     for (i = 0; ret && i < length / sizeof(COLORREF); i++)
     {
         ret = color_match( ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
-        ok(ret, "%04x: Expected 0x%x, actually 0x%x\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
+        ok(ret, "%04x: Expected 0x%lx, actually 0x%lx\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
     }
 cleanup:
     HeapFree( GetProcessHeap(), 0, image );
@@ -1864,19 +1865,19 @@ static void test_GetCursorFrameInfo(void)
     /* Creating a static cursor. */
     SetLastError(0xdeadbeef);
     h1 = CreateIconFromResource((PBYTE) hotspot, CRSR_RES_SIZE, FALSE, 0x00030000);
-    ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
+    ok(h1 != NULL, "Create cursor failed (error = %ld).\n", GetLastError());
 
     /* Check GetCursorFrameInfo behavior on a static cursor */
     rate = steps = 0xdead;
     h2 = pGetCursorFrameInfo(h1, 0xdead, 0xdead, &rate, &steps);
     ok(h1 == h2, "GetCursorFrameInfo() failed: (%p != %p).\n", h1, h2);
-    ok(rate == 0, "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x0).\n", rate);
-    ok(steps == 1, "GetCursorFrameInfo() unexpected param 5 value (%d != 1).\n", steps);
+    ok(rate == 0, "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0x0).\n", rate);
+    ok(steps == 1, "GetCursorFrameInfo() unexpected param 5 value (%ld != 1).\n", steps);
 
     /* Clean up static cursor. */
     SetLastError(0xdeadbeef);
     ret = DestroyCursor(h1);
-    ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
+    ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
 
     /* Creating a single-frame animated cursor. */
     empty_anicursor.frames[0].data.icon_info.idType = 2; /* type: cursor */
@@ -1885,7 +1886,7 @@ static void test_GetCursorFrameInfo(void)
     memcpy( &empty_anicursor.frames[0].data.bmi_data.data[0], &frame_identifier[0], sizeof(DWORD) );
     SetLastError(0xdeadbeef);
     h1 = CreateIconFromResource((PBYTE) &empty_anicursor, sizeof(empty_anicursor), FALSE, 0x00030000);
-    ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
+    ok(h1 != NULL, "Create cursor failed (error = %ld).\n", GetLastError());
 
     /* Check GetCursorFrameInfo behavior on a single-frame animated cursor */
     rate = steps = 0xdead;
@@ -1893,14 +1894,14 @@ static void test_GetCursorFrameInfo(void)
     ok(h1 == h2, "GetCursorFrameInfo() failed: (%p != %p).\n", h1, h2);
     ret = check_cursor_data( hdc, h2, &frame_identifier[0], sizeof(DWORD) );
     ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame 0.\n");
-    ok(rate == 0x0, "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x0).\n", rate);
+    ok(rate == 0x0, "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0x0).\n", rate);
     ok(steps == empty_anicursor.header.header.num_steps,
-        "GetCursorFrameInfo() unexpected param 5 value (%d != 1).\n", steps);
+        "GetCursorFrameInfo() unexpected param 5 value (%ld != 1).\n", steps);
 
     /* Clean up single-frame animated cursor. */
     SetLastError(0xdeadbeef);
     ret = DestroyCursor(h1);
-    ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
+    ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
 
     /* Creating a multi-frame animated cursor. */
     for (i=0; i<empty_anicursor3.header.header.num_frames; i++)
@@ -1912,14 +1913,14 @@ static void test_GetCursorFrameInfo(void)
     }
     SetLastError(0xdeadbeef);
     h1 = CreateIconFromResource((PBYTE) &empty_anicursor3, sizeof(empty_anicursor3), FALSE, 0x00030000);
-    ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
+    ok(h1 != NULL, "Create cursor failed (error = %ld).\n", GetLastError());
 
     /* Check number of steps in multi-frame animated cursor */
     i=0;
     while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
         i++;
     ok(i == empty_anicursor3.header.header.num_steps,
-        "Unexpected number of steps in cursor (%d != %d)\n",
+        "Unexpected number of steps in cursor (%d != %ld)\n",
         i, empty_anicursor3.header.header.num_steps);
 
     /* Check GetCursorFrameInfo behavior on a multi-frame animated cursor */
@@ -1931,10 +1932,10 @@ static void test_GetCursorFrameInfo(void)
         ret = check_cursor_data( hdc, h2, &frame_identifier[i], sizeof(DWORD) );
         ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame %d.\n", i);
         ok(rate == empty_anicursor3.header.header.display_rate,
-            "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
+            "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0x%lx).\n",
             rate, empty_anicursor3.header.header.display_rate);
         ok(steps == empty_anicursor3.header.header.num_steps,
-            "GetCursorFrameInfo() unexpected param 5 value (%d != %d).\n",
+            "GetCursorFrameInfo() unexpected param 5 value (%ld != %ld).\n",
             steps, empty_anicursor3.header.header.num_steps);
     }
 
@@ -1944,28 +1945,28 @@ static void test_GetCursorFrameInfo(void)
     ok(h2 == 0, "GetCursorFrameInfo() failed for cursor %p: (%p != 0).\n", h1, h2);
     ok(rate == 0xdead || broken(rate == empty_anicursor3.header.header.display_rate) /*win2k*/
        || broken(rate == ~0) /*win2k (sporadic)*/,
-        "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0xdead).\n", rate);
+        "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0xdead).\n", rate);
     ok(steps == 0xdead || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/
        || broken(steps == 0) /*win2k (sporadic)*/,
-        "GetCursorFrameInfo() unexpected param 5 value (0x%x != 0xdead).\n", steps);
+        "GetCursorFrameInfo() unexpected param 5 value (0x%lx != 0xdead).\n", steps);
 
     /* Clean up multi-frame animated cursor. */
     SetLastError(0xdeadbeef);
     ret = DestroyCursor(h1);
-    ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
+    ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
 
     /* Create a multi-frame animated cursor with num_steps == 1 */
     empty_anicursor3.header.header.num_steps = 1;
     SetLastError(0xdeadbeef);
     h1 = CreateIconFromResource((PBYTE) &empty_anicursor3, sizeof(empty_anicursor3), FALSE, 0x00030000);
-    ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
+    ok(h1 != NULL, "Create cursor failed (error = %ld).\n", GetLastError());
 
     /* Check number of steps in multi-frame animated cursor (mismatch between steps and frames) */
     i=0;
     while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
         i++;
     ok(i == empty_anicursor3.header.header.num_steps,
-        "Unexpected number of steps in cursor (%d != %d)\n",
+        "Unexpected number of steps in cursor (%d != %ld)\n",
         i, empty_anicursor3.header.header.num_steps);
 
     /* Check GetCursorFrameInfo behavior on rate 0 for a multi-frame animated cursor (with num_steps == 1) */
@@ -1975,10 +1976,10 @@ static void test_GetCursorFrameInfo(void)
     ret = check_cursor_data( hdc, h2, &frame_identifier[0], sizeof(DWORD) );
     ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame 0.\n");
     ok(rate == empty_anicursor3.header.header.display_rate,
-        "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
+        "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0x%lx).\n",
         rate, empty_anicursor3.header.header.display_rate);
     ok(steps == ~0 || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/,
-        "GetCursorFrameInfo() unexpected param 5 value (%d != ~0).\n", steps);
+        "GetCursorFrameInfo() unexpected param 5 value (%ld != ~0).\n", steps);
 
     /* Check GetCursorFrameInfo behavior on rate 1 for a multi-frame animated cursor (with num_steps == 1) */
     rate = steps = 0xdead;
@@ -1986,15 +1987,15 @@ static void test_GetCursorFrameInfo(void)
     ok(h2 == 0, "GetCursorFrameInfo() failed for cursor %p: (%p != 0).\n", h1, h2);
     ok(rate == 0xdead || broken(rate == empty_anicursor3.header.header.display_rate) /*win2k*/
        || broken(rate == ~0) /*win2k (sporadic)*/,
-        "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0xdead).\n", rate);
+        "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0xdead).\n", rate);
     ok(steps == 0xdead || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/
        || broken(steps == 0) /*win2k (sporadic)*/,
-        "GetCursorFrameInfo() unexpected param 5 value (%d != 0xdead).\n", steps);
+        "GetCursorFrameInfo() unexpected param 5 value (%ld != 0xdead).\n", steps);
 
     /* Clean up multi-frame animated cursor. */
     SetLastError(0xdeadbeef);
     ret = DestroyCursor(h1);
-    ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
+    ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
 
     /* Creating a multi-frame animated cursor with rate data. */
     for (i=0; i<empty_anicursor3_seq.header.header.num_frames; i++)
@@ -2006,14 +2007,14 @@ static void test_GetCursorFrameInfo(void)
     }
     SetLastError(0xdeadbeef);
     h1 = CreateIconFromResource((PBYTE) &empty_anicursor3_seq, sizeof(empty_anicursor3_seq), FALSE, 0x00030000);
-    ok(h1 != NULL, "Create cursor failed (error = %x).\n", GetLastError());
+    ok(h1 != NULL, "Create cursor failed (error = %lx).\n", GetLastError());
 
     /* Check number of steps in multi-frame animated cursor with rate data */
     i=0;
     while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
         i++;
     ok(i == empty_anicursor3_seq.header.header.num_steps,
-        "Unexpected number of steps in cursor (%d != %d)\n",
+        "Unexpected number of steps in cursor (%d != %ld)\n",
         i, empty_anicursor3_seq.header.header.num_steps);
 
     /* Check GetCursorFrameInfo behavior on a multi-frame animated cursor with rate data */
@@ -2027,17 +2028,17 @@ static void test_GetCursorFrameInfo(void)
         ret = check_cursor_data( hdc, h2, &frame_identifier[frame_id], sizeof(DWORD) );
         ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame %d.\n", i);
         ok(rate == empty_anicursor3_seq.rates.rate[i],
-            "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
+            "GetCursorFrameInfo() unexpected param 4 value (0x%lx != 0x%lx).\n",
             rate, empty_anicursor3_seq.rates.rate[i]);
         ok(steps == empty_anicursor3_seq.header.header.num_steps,
-            "GetCursorFrameInfo() unexpected param 5 value (%d != %d).\n",
+            "GetCursorFrameInfo() unexpected param 5 value (%ld != %ld).\n",
             steps, empty_anicursor3_seq.header.header.num_steps);
     }
 
     /* Clean up multi-frame animated cursor with rate data. */
     SetLastError(0xdeadbeef);
     ret = DestroyCursor(h1);
-    ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
+    ok(ret, "DestroyCursor() failed (error = %ld).\n", GetLastError());
 
     HeapFree(GetProcessHeap(), 0, hotspot);
 cleanup:
@@ -2106,8 +2107,8 @@ static void check_alpha_draw(HDC hdc, BOOL drawiconex, BOOL alpha, int bpp, int
     result = GetPixel(hdc, 0, 0);
     ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
         broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
-        "%s. Expected a close match to %06X (modern) or %06X (legacy) with %s. "
-        "Got %06X from line %d\n",
+        "%s. Expected a close match to %06lX (modern) or %06lX (legacy) with %s. "
+        "Got %06lX from line %d\n",
         alpha ? "Alpha blending" : "Not alpha blending", modern_expected, legacy_expected,
         drawiconex ? "DrawIconEx" : "DrawIcon", result, line);
 }
@@ -2127,7 +2128,7 @@ static void check_DrawIcon(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLOR
     ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
         broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
         "Overlaying Mask %d on Color %06X with DrawIcon. "
-        "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
+        "Expected a close match to %06lX (modern), or %06lX (legacy). Got %06lX from line %d\n",
         maskvalue, color, modern_expected, legacy_expected, result, line);
 
     result = GetPixel(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1);
@@ -2135,14 +2136,14 @@ static void check_DrawIcon(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLOR
     ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
         broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
         "Overlaying Mask %d on Color %06X with DrawIcon. "
-        "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
+        "Expected a close match to %06lX (modern), or %06lX (legacy). Got %06lX from line %d\n",
         maskvalue, color, modern_expected, legacy_expected, result, line);
 
     result = GetPixel(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
 
     ok (color_match(result, background),
         "Overlaying Mask %d on Color %06X with DrawIcon. "
-        "Expected unchanged background color %06X. Got %06X from line %d\n",
+        "Expected unchanged background color %06lX. Got %06lX from line %d\n",
         maskvalue, color, background, result, line);
 }
 
@@ -2226,7 +2227,7 @@ static void check_DrawIconEx(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, UIN
     ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
         broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
         "Overlaying Mask %d on Color %06X with DrawIconEx flags %08X. "
-        "Expected a close match to %06X (modern) or %06X (legacy). Got %06X from line %d\n",
+        "Expected a close match to %06lX (modern) or %06lX (legacy). Got %06lX from line %d\n",
         maskvalue, color, flags, modern_expected, legacy_expected, result, line);
 }
 
@@ -2375,7 +2376,7 @@ static void check_DrawState_Color(HDC hdc, BOOL maskvalue, UINT32 color, int bpp
     ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
         broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
         "DrawState drawing Icon with Overlaying Mask %d on Color %06X with flags %08X. "
-        "Expected a close match to %06X (modern) or %06X (legacy). Got %06X from line %d\n",
+        "Expected a close match to %06lX (modern) or %06lX (legacy). Got %06lX from line %d\n",
         maskvalue, color, (DST_ICON | flags), modern_expected, legacy_expected, result, line);
 }
 
@@ -2473,7 +2474,7 @@ static void test_SetCursor(void)
     thread = CreateThread( NULL, 0, set_cursor_thread, 0, 0, &id );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == (DWORD_PTR)cursor, "wrong thread cursor %x/%p\n", result, cursor );
+    ok( result == (DWORD_PTR)cursor, "wrong thread cursor %lx/%p\n", result, cursor );
 
     hdc = GetDC(0);
     display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
@@ -2500,26 +2501,26 @@ static void test_SetCursor(void)
     thread = CreateThread( NULL, 0, set_cursor_thread, 0, 0, &id );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %x/%p\n", result, old_cursor );
+    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %lx/%p\n", result, old_cursor );
 
     SetCursor( 0 );
     ok( GetCursor() == 0, "wrong cursor %p\n", GetCursor() );
     thread = CreateThread( NULL, 0, set_cursor_thread, 0, 0, &id );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %x/%p\n", result, old_cursor );
+    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %lx/%p\n", result, old_cursor );
 
     thread = CreateThread( NULL, 0, set_cursor_thread, cursor, 0, &id );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %x/%p\n", result, old_cursor );
+    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %lx/%p\n", result, old_cursor );
     ok( GetCursor() == 0, "wrong cursor %p/0\n", GetCursor() );
 
     parent_id = GetCurrentThreadId();
     thread = CreateThread( NULL, 0, set_cursor_thread, cursor, 0, &id );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %x/%p\n", result, old_cursor );
+    ok( result == (DWORD_PTR)old_cursor, "wrong thread cursor %lx/%p\n", result, old_cursor );
     ok( GetCursor() == cursor, "wrong cursor %p/0\n", cursor );
 
     if (pGetCursorInfo)
@@ -2537,7 +2538,7 @@ static void test_SetCursor(void)
     error = GetLastError();
     ok( cursor == 0, "wrong cursor %p/0\n", cursor );
     ok( error == ERROR_INVALID_CURSOR_HANDLE || broken( error == 0xdeadbeef ),  /* win9x */
-        "wrong error %u\n", error );
+        "wrong error %lu\n", error );
 
     if (pGetCursorInfo)
     {
@@ -2615,7 +2616,7 @@ static void test_ShowCursor(void)
     SetEvent( event_next );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == -1, "wrong thread count %d\n", result );
+    ok( result == -1, "wrong thread count %ld\n", result );
     count = ShowCursor( FALSE );
     ok( count == -4, "wrong count %d\n", count );
 
@@ -2626,7 +2627,7 @@ static void test_ShowCursor(void)
     SetEvent( event_next );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == 1, "wrong thread count %d\n", result );
+    ok( result == 1, "wrong thread count %ld\n", result );
     count = ShowCursor( TRUE );
     ok( count == -2, "wrong count %d\n", count );
 
@@ -2638,7 +2639,7 @@ static void test_ShowCursor(void)
     SetEvent( event_next );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == -3, "wrong thread count %d\n", result );
+    ok( result == -3, "wrong thread count %ld\n", result );
     count = ShowCursor( FALSE );
     ok( count == -2, "wrong count %d\n", count );
 
@@ -2649,7 +2650,7 @@ static void test_ShowCursor(void)
     SetEvent( event_next );
     WaitForSingleObject( thread, 1000 );
     GetExitCodeThread( thread, &result );
-    ok( result == 1, "wrong thread count %d\n", result );
+    ok( result == 1, "wrong thread count %ld\n", result );
     count = ShowCursor( FALSE );
     ok( count == -2, "wrong count %d\n", count );
 
@@ -2705,7 +2706,7 @@ static void test_DestroyCursor(void)
     ret = DestroyCursor(cursor);
     ok(!ret || broken(ret)  /* succeeds on win9x */, "DestroyCursor on the active cursor succeeded\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: %u\n", error);
+    ok(error == 0xdeadbeef, "Last error: %lu\n", error);
 
     new_cursor = GetCursor();
     if (ret)  /* win9x replaces cursor by another one on destroy */
@@ -2718,7 +2719,7 @@ static void test_DestroyCursor(void)
     ok( !ret || broken(ret), /* nt4 */ "GetIconInfo succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE ||
         broken(GetLastError() == 0xdeadbeef), /* win9x */
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     if (ret)  /* nt4 delays destruction until cursor changes */
     {
@@ -2729,13 +2730,13 @@ static void test_DestroyCursor(void)
         ret = DestroyCursor( cursor );
         ok( !ret, "DestroyCursor succeeded\n" );
         ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
-            "wrong error %u\n", GetLastError() );
+            "wrong error %lu\n", GetLastError() );
 
         SetLastError(0xdeadbeef);
         cursor2 = SetCursor( cursor );
         ok( cursor2 == cursor, "SetCursor returned %p/%p\n", cursor2, cursor);
         ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
-            "wrong error %u\n", GetLastError() );
+            "wrong error %lu\n", GetLastError() );
     }
     else
     {
@@ -2744,7 +2745,7 @@ static void test_DestroyCursor(void)
         ok(!cursor2, "CopyCursor succeeded\n" );
         ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE ||
             broken(GetLastError() == 0xdeadbeef), /* win9x */
-            "wrong error %u\n", GetLastError() );
+            "wrong error %lu\n", GetLastError() );
 
         SetLastError(0xdeadbeef);
         ret = DestroyCursor( cursor );
@@ -2753,13 +2754,13 @@ static void test_DestroyCursor(void)
         else
             ok( !ret, "DestroyCursor succeeded\n" );
         ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
-            "wrong error %u\n", GetLastError() );
+            "wrong error %lu\n", GetLastError() );
 
         SetLastError(0xdeadbeef);
         cursor2 = SetCursor( cursor );
         ok(!cursor2, "SetCursor returned %p/%p\n", cursor2, cursor);
         ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
-            "wrong error %u\n", GetLastError() );
+            "wrong error %lu\n", GetLastError() );
     }
 
     cursor2 = GetCursor();
@@ -2771,7 +2772,7 @@ static void test_DestroyCursor(void)
         ok(cursor2 == new_cursor, "SetCursor returned %p/%p\n", cursor2, cursor);
     else
         ok(!cursor2, "SetCursor returned %p/%p\n", cursor2, cursor);
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
 
     cursor2 = GetCursor();
     ok(!cursor2, "GetCursor returned %p/%p\n", cursor2, cursor);
@@ -2783,7 +2784,7 @@ static void test_DestroyCursor(void)
     else
         ok( !ret, "DestroyCursor succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     DeleteObject(cursorInfo.hbmMask);
     DeleteObject(cursorInfo.hbmColor);
@@ -2795,13 +2796,13 @@ static void test_DestroyCursor(void)
     ret = DestroyCursor(cursor);
     ok(ret || broken(!ret) /* fails on win9x */, "DestroyCursor on the active cursor failed.\n");
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
+    ok(error == 0xdeadbeef, "Last error: 0x%08lx\n", error);
 
     /* Try setting the cursor to a destroyed OEM cursor. */
     SetLastError(0xdeadbeef);
     SetCursor(cursor);
     error = GetLastError();
-    ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
+    ok(error == 0xdeadbeef, "Last error: 0x%08lx\n", error);
 
     /* Check if LoadCursor() returns the same handle with the same icon. */
     cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
@@ -2908,7 +2909,7 @@ static void test_monochrome_icon(void)
 
         handle = CreateFileA("icon.ico", GENERIC_WRITE, 0, NULL, CREATE_NEW,
             FILE_ATTRIBUTE_NORMAL, NULL);
-        ok(handle != INVALID_HANDLE_VALUE, "CreateFileA failed. %u\n", GetLastError());
+        ok(handle != INVALID_HANDLE_VALUE, "CreateFileA failed. %lu\n", GetLastError());
         ret = WriteFile(handle, icon_data, icon_size, &bytes_written, NULL);
         ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n");
         CloseHandle(handle);
@@ -2916,7 +2917,7 @@ static void test_monochrome_icon(void)
         handle = LoadImageA(NULL, "icon.ico", IMAGE_ICON, 0, 0, LR_LOADFROMFILE);
         ok(handle != NULL ||
            broken(use_core_info && handle == NULL), /* Win 8, 10 */
-           "LoadImage() failed with %u.\n", GetLastError());
+           "LoadImage() failed with %lu.\n", GetLastError());
         if (handle == NULL)
         {
             skip("Icon failed to load: %s, %s\n",
@@ -2927,12 +2928,12 @@ static void test_monochrome_icon(void)
         }
 
         ret = GetIconInfo(handle, &icon_info);
-        ok(ret, "GetIconInfo() failed with %u.\n", GetLastError());
+        ok(ret, "GetIconInfo() failed with %lu.\n", GetLastError());
         if (ret)
         {
             ok(icon_info.fIcon == TRUE, "fIcon is %u.\n", icon_info.fIcon);
-            ok(icon_info.xHotspot == 0, "xHotspot is %u.\n", icon_info.xHotspot);
-            ok(icon_info.yHotspot == 0, "yHotspot is %u.\n", icon_info.yHotspot);
+            ok(icon_info.xHotspot == 0, "xHotspot is %lu.\n", icon_info.xHotspot);
+            ok(icon_info.yHotspot == 0, "yHotspot is %lu.\n", icon_info.yHotspot);
             if (monochrome)
                 ok(icon_info.hbmColor == NULL, "Got hbmColor %p!\n", icon_info.hbmColor);
             else
@@ -2941,7 +2942,7 @@ static void test_monochrome_icon(void)
         }
 
         ret = DestroyIcon(handle);
-        ok(ret, "DestroyIcon() failed with %u.\n", GetLastError());
+        ok(ret, "DestroyIcon() failed with %lu.\n", GetLastError());
         DeleteFileA("icon.ico");
     }
 
@@ -2986,7 +2987,7 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
     result_bits = HeapAlloc(GetProcessHeap(), 0, result_bits_size);
     ret = GetDIBits(hdc, bitmap, 0, bmi->bmiHeader.biHeight,
             result_bits, bmi, DIB_RGB_COLORS);
-    ok(ret == bmi->bmiHeader.biHeight, "Unexpected GetDIBits result %d, GetLastError() %u.\n",
+    ok(ret == bmi->bmiHeader.biHeight, "Unexpected GetDIBits result %d, GetLastError() %lu.\n",
             ret, GetLastError());
     for (row = 0; row < bmi->bmiHeader.biHeight; ++row)
         for (column = 0; column < bmi->bmiHeader.biWidth; ++column)
@@ -2999,7 +3000,7 @@ static void compare_bitmap_bits_(unsigned int line, HDC hdc, HBITMAP bitmap, BIT
             todo_wine_if(allow_todo && result != expected)
             ok_(__FILE__, line)(result == expected || broken(expected_broken_bits
                     && result == get_color_from_bits(expected_broken_bits, bmi, row, column)),
-                    "Colors do not match, got 0x%06x, expected 0x%06x, test_index %u, row %u, column %u.\n",
+                    "Colors do not match, got 0x%06lx, expected 0x%06lx, test_index %u, row %u, column %u.\n",
                     result, expected, test_index, row, column);
         }
     HeapFree(GetProcessHeap(), 0, result_bits);
@@ -3130,12 +3131,12 @@ static void test_Image_StretchMode(void)
         bmi_output->bmiHeader.biHeight = tests[test_index].output_height;
 
         bitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, (void **)&bits, NULL, 0);
-        ok(bitmap && bits, "CreateDIBSection() failed, result %u.\n", GetLastError());
+        ok(bitmap && bits, "CreateDIBSection() failed, result %lu.\n", GetLastError());
         memcpy(bits, tests[test_index].test_bits, tests[test_index].test_bits_size);
 
         bitmap_copy = CopyImage(bitmap, IMAGE_BITMAP, tests[test_index].output_width,
                 tests[test_index].output_height, LR_CREATEDIBSECTION);
-        ok(!!bitmap_copy, "CopyImage() failed, result %u.\n", GetLastError());
+        ok(!!bitmap_copy, "CopyImage() failed, result %lu.\n", GetLastError());
 
         compare_bitmap_bits(hdc, bitmap_copy, bmi_output, tests[test_index].result_bits_size,
                 tests[test_index].expected_bits, test_index, tests[test_index].allow_todo,
@@ -3146,7 +3147,7 @@ static void test_Image_StretchMode(void)
         create_bitmap_file(filename, bmi, tests[test_index].test_bits);
         bitmap = LoadImageA(NULL, filename, IMAGE_BITMAP, tests[test_index].output_width,
                 tests[test_index].output_height, LR_CREATEDIBSECTION | LR_LOADFROMFILE);
-        ok(!!bitmap, "LoadImageA() failed, result %u.\n", GetLastError());
+        ok(!!bitmap, "LoadImageA() failed, result %lu.\n", GetLastError());
         DeleteFileA(filename);
         compare_bitmap_bits(hdc, bitmap, bmi_output, tests[test_index].result_bits_size,
                 tests[test_index].expected_bits, test_index, tests[test_index].allow_todo,
diff --git a/dlls/user32/tests/dce.c b/dlls/user32/tests/dce.c
index 861150f9a88..5f0eb928f53 100644
--- a/dlls/user32/tests/dce.c
+++ b/dlls/user32/tests/dce.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for DCE support
  *
@@ -513,10 +514,10 @@ static void test_begin_paint(void)
     EndPaint( hwnd_parentdc, &ps );
     GetClientRect( hwnd_parent, &parent_rect );
 
-    ok( rect.left == parent_rect.left, "rect.left = %d, expected %d\n", rect.left, parent_rect.left );
-    ok( rect.top == parent_rect.top, "rect.top = %d, expected %d\n", rect.top, parent_rect.top );
-    todo_wine ok( rect.right == parent_rect.right, "rect.right = %d, expected %d\n", rect.right, parent_rect.right );
-    todo_wine ok( rect.bottom == parent_rect.bottom, "rect.bottom = %d, expected %d\n", rect.bottom, parent_rect.bottom );
+    ok( rect.left == parent_rect.left, "rect.left = %ld, expected %ld\n", rect.left, parent_rect.left );
+    ok( rect.top == parent_rect.top, "rect.top = %ld, expected %ld\n", rect.top, parent_rect.top );
+    todo_wine ok( rect.right == parent_rect.right, "rect.right = %ld, expected %ld\n", rect.right, parent_rect.right );
+    todo_wine ok( rect.bottom == parent_rect.bottom, "rect.bottom = %ld, expected %ld\n", rect.bottom, parent_rect.bottom );
 
     hdc = GetDC( hwnd_parent );
     todo_wine ok( GetPixel( hdc, 10, 10 ) == cr, "error drawing outside of window client area\n" );
@@ -617,41 +618,41 @@ static void test_dc_layout(void)
     hdc = GetDC( hwnd_cache_rtl );
     layout = GetLayout( hdc );
 
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     SetLayout( hdc, 0 );
     ReleaseDC( hwnd_cache_rtl, hdc );
     hdc = GetDC( hwnd_owndc_rtl );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     ReleaseDC( hwnd_cache_rtl, hdc );
 
     hdc = GetDC( hwnd_cache );
     layout = GetLayout( hdc );
-    ok( layout == 0, "wrong layout %x\n", layout );
+    ok( layout == 0, "wrong layout %lx\n", layout );
     ReleaseDC( hwnd_cache, hdc );
 
     hdc = GetDC( hwnd_owndc_rtl );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     SetLayout( hdc, 0 );
     ReleaseDC( hwnd_owndc_rtl, hdc );
     hdc = GetDC( hwnd_owndc_rtl );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     ReleaseDC( hwnd_owndc_rtl, hdc );
 
     hdc = GetDC( hwnd_classdc_rtl );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     SetLayout( hdc, 0 );
     ReleaseDC( hwnd_classdc_rtl, hdc );
     hdc = GetDC( hwnd_classdc2_rtl );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     ReleaseDC( hwnd_classdc2_rtl, hdc );
     hdc = GetDC( hwnd_classdc );
     layout = GetLayout( hdc );
-    ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
+    ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
     ReleaseDC( hwnd_classdc_rtl, hdc );
 
     DestroyWindow(hwnd_classdc2_rtl);
diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c
index e2e27480645..c41d93a987b 100644
--- a/dlls/user32/tests/dde.c
+++ b/dlls/user32/tests/dde.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for DDE functions
  *
@@ -54,7 +55,7 @@ static HANDLE create_process(const char *arg)
     winetest_get_mainargs(&argv);
     sprintf(cmdline, "\"%s\" %s %s", argv[0], argv[1], arg);
     ret = CreateProcessA(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
-    ok(ret, "CreateProcess failed: %u\n", GetLastError());
+    ok(ret, "CreateProcess failed: %lu\n", GetLastError());
     CloseHandle(pi.hThread);
     return pi.hProcess;
 }
@@ -149,7 +150,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
         ok((msg_index >= 2 && msg_index <= 4) ||
            (msg_index >= 7 && msg_index <= 8),
            "Expected 2, 3, 4, 7 or 8, got %d\n", msg_index);
-        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08lx\n", wparam);
+        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
         ok(LOWORD(lparam) == CF_TEXT, "Expected CF_TEXT, got %d\n", LOWORD(lparam));
 
         GlobalGetAtomNameA(HIWORD(lparam), str, MAX_PATH);
@@ -198,7 +199,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
     case WM_DDE_POKE:
     {
         ok(msg_index == 5 || msg_index == 6, "Expected 5 or 6, got %d\n", msg_index);
-        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08lx\n", wparam);
+        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
 
         UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi);
 
@@ -215,7 +216,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
         if (msg_index == 5)
         {
             size = GlobalSize((HGLOBAL)lo);
-            ok(size == 4, "got %d\n", size);
+            ok(size == 4, "got %ld\n", size);
         }
         else
             ok(!lstrcmpA((LPSTR)poke->Value, "poke data\r\n"),
@@ -232,7 +233,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
     case WM_DDE_EXECUTE:
     {
         ok(msg_index == 7, "Expected 7, got %d\n", msg_index);
-        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08lx\n", wparam);
+        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
 
         ptr = GlobalLock((HGLOBAL)lparam);
         ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected [Command(Var)], got %s\n", ptr);
@@ -249,8 +250,8 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
     case WM_DDE_TERMINATE:
     {
         ok(msg_index == 9, "Expected 9, got %d\n", msg_index);
-        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08lx\n", wparam);
-        ok(lparam == 0, "Expected 0, got %08lx\n", lparam);
+        ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
+        ok(lparam == 0, "Expected 0, got %08Ix\n", lparam);
 
         PostMessageA(client, WM_DDE_TERMINATE, (WPARAM)hwnd, 0);
 
@@ -281,7 +282,7 @@ static void test_msg_server(void)
 
     destroy_dde_window(&hwnd, "dde_server");
     GetExitCodeProcess(client, &res);
-    ok( !res, "client failed with %u error(s)\n", res );
+    ok( !res, "client failed with %lu error(s)\n", res );
     CloseHandle(client);
 }
 
@@ -334,13 +335,13 @@ static void test_ddeml_client(void)
     hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
-    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %08x\n", res);
+    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %08lx\n", res);
     ok( hdata != NULL, "hdata is NULL\n" );
     if (hdata)
     {
         str = (LPSTR)DdeAccessData(hdata, &size);
         ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
-        ok(size == 17, "Expected 17, got %d\n", size);
+        ok(size == 17, "Expected 17, got %ld\n", size);
 
         ret = DdeUnaccessData(hdata);
         ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -351,7 +352,7 @@ static void test_ddeml_client(void)
     DdeGetLastError(client_pid);
     hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
-    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %x\n", res);
+    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %lx\n", res);
     todo_wine
     ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
     ok( hdata != NULL, "hdata is NULL\n" );
@@ -359,7 +360,7 @@ static void test_ddeml_client(void)
     {
         str = (LPSTR)DdeAccessData(hdata, &size);
         ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
-        ok(size == 17, "Expected 17, got %d\n", size);
+        ok(size == 17, "Expected 17, got %ld\n", size);
 
         ret = DdeUnaccessData(hdata);
         ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -371,14 +372,14 @@ static void test_ddeml_client(void)
     hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
-    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %x\n", res);
+    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %lx\n", res);
     if (hdata == NULL)
         ok(FALSE, "hdata is NULL\n");
     else
     {
         str = (LPSTR)DdeAccessData(hdata, &size);
         ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
-        ok(size == 17, "Expected 17, got %d\n", size);
+        ok(size == 17, "Expected 17, got %ld\n", size);
 
         ret = DdeUnaccessData(hdata);
         ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -390,7 +391,7 @@ static void test_ddeml_client(void)
     hdata = DdeClientTransaction(NULL, 0, conversation, 0, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(hdata == NULL, "Expected NULL hdata, got %p\n", hdata);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08x\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     DdeFreeStringHandle(client_pid, item);
@@ -408,7 +409,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, 0, CF_TEXT, XTYP_POKE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     /* XTYP_POKE, no data */
@@ -417,7 +418,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, 0, CF_TEXT, XTYP_POKE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     /* XTYP_POKE, wrong size */
@@ -426,7 +427,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction((LPBYTE)hdata, 0, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
-    ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res);
+    ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
 
     /* XTYP_POKE, correct params */
@@ -435,7 +436,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
-    ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res);
+    ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
 
     DdeFreeDataHandle(hdata);
@@ -452,7 +453,7 @@ static void test_ddeml_client(void)
     ret = DdeGetLastError(client_pid);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
     ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
-    ok(res == DDE_FACK, "Expected DDE_FACK, got %x\n", res);
+    ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
 
     /* XTYP_EXECUTE, no data */
     res = 0xdeadbeef;
@@ -460,7 +461,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
 
     /* XTYP_EXECUTE, no data, -1 size */
@@ -469,7 +470,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, -1, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     DdeFreeStringHandle(client_pid, topic);
@@ -483,10 +484,10 @@ static void test_ddeml_client(void)
     hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
-    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %d\n", res);
+    ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %ld\n", res);
     str = (LPSTR)DdeAccessData(hdata, &size);
     ok(!strcmp(str, "command executed\r\n"), "Expected 'command executed\\r\\n', got %s\n", str);
-    ok(size == 19, "Expected 19, got %d\n", size);
+    ok(size == 19, "Expected 19, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -497,7 +498,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_ADVREQ, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -505,7 +506,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_CONNECT, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -513,7 +514,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_CONNECT_CONFIRM, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -521,7 +522,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_DISCONNECT, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -529,7 +530,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_ERROR, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -537,7 +538,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_MONITOR, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -545,7 +546,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REGISTER, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -553,7 +554,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_UNREGISTER, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -561,7 +562,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_WILDCONNECT, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     res = 0xdeadbeef;
@@ -569,7 +570,7 @@ static void test_ddeml_client(void)
     op = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_XACT_COMPLETE, default_timeout, &res);
     ret = DdeGetLastError(client_pid);
     ok(op == NULL, "Expected NULL, got %p\n", op);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
 
     DdeFreeStringHandle(client_pid, item);
@@ -604,16 +605,16 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv == 0, "Expected 0, got %p\n", hconv);
         ok(hdata == 0, "Expected 0, got %p\n", hdata);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == 0, "Expected 0, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
-        ok(size == 13, "Expected 13, got %d\n", size);
+        ok(size == 13, "Expected 13, got %ld\n", size);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
         ok(!strncmp(str, "TestDDEServer(", 14), "Expected TestDDEServer(, got %s\n", str);
-        ok(size == 17 + 2*sizeof(ULONG_PTR), "Got size %d for %s\n", size, str);
+        ok(size == 17 + 2*sizeof(ULONG_PTR), "Got size %ld for %s\n", size, str);
         ok(str[size - 1] == ')', "Expected ')', got %c\n", str[size - 1]);
 
         return (HDDEDATA)TRUE;
@@ -625,16 +626,16 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv == 0, "Expected 0, got %p\n", hconv);
         ok(hdata == 0, "Expected 0, got %p\n", hdata);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == FALSE, "Expected FALSE, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == FALSE, "Expected FALSE, got %08Ix\n", dwData2);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
-        ok(size == 13, "Expected 13, got %d\n", size);
+        ok(size == 13, "Expected 13, got %ld\n", size);
 
         return (HDDEDATA)TRUE;
     }
@@ -647,16 +648,16 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv != NULL, "Expected non-NULL hconv\n");
         ok(hdata == 0, "Expected 0, got %p\n", hdata);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == FALSE, "Expected FALSE, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == FALSE, "Expected FALSE, got %08Ix\n", dwData2);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
-        ok(size == 13, "Expected 13, got %d\n", size);
+        ok(size == 13, "Expected 13, got %ld\n", size);
 
         return (HDDEDATA)TRUE;
     }
@@ -667,8 +668,8 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
            "Expected 4, 5 or 6, got %d\n", msg_index);
         ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
         ok(hdata == 0, "Expected 0, got %p\n", hdata);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == 0, "Expected 0, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
 
         if (msg_index == 4)
             ok(uFmt == 0xbeef, "Expected 0xbeef, got %08x\n", uFmt);
@@ -677,7 +678,7 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
 
@@ -685,13 +686,13 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         {
             {
                 ok(!lstrcmpA(str, ""), "Expected empty string, got %s\n", str);
-                ok(size == 1, "Expected 1, got %d\n", size);
+                ok(size == 1, "Expected 1, got %ld\n", size);
             }
         }
         else if (msg_index == 6)
         {
             ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
-            ok(size == 7, "Expected 7, got %d\n", size);
+            ok(size == 7, "Expected 7, got %ld\n", size);
         }
 
         if (msg_index == 6)
@@ -709,16 +710,16 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(msg_index == 7 || msg_index == 8, "Expected 7 or 8, got %d\n", msg_index);
         ok(uFmt == CF_TEXT, "Expected CF_TEXT, got %d\n", uFmt);
         ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == 0, "Expected 0, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         ptr = (LPSTR)DdeAccessData(hdata, &size);
         ok(!lstrcmpA(ptr, "poke data\r\n"), "Expected 'poke data\\r\\n', got %s\n", ptr);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
         DdeUnaccessData(hdata);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
@@ -726,13 +727,13 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         {
             {
                 ok(!lstrcmpA(str, ""), "Expected empty string, got %s\n", str);
-                ok(size == 1, "Expected 1, got %d\n", size);
+                ok(size == 1, "Expected 1, got %ld\n", size);
             }
         }
         else
         {
             ok(!lstrcmpA(str, "poke"), "Expected poke, got %s\n", str);
-            ok(size == 4, "Expected 4, got %d\n", size);
+            ok(size == 4, "Expected 4, got %ld\n", size);
         }
 
         return (HDDEDATA)DDE_FACK;
@@ -743,13 +744,13 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(msg_index >= 9 && msg_index <= 11, "Expected 9 or 11, got %d\n", msg_index);
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == 0, "Expected 0, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
         ok(hsz2 == 0, "Expected 0, got %p\n", hsz2);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         if (msg_index == 9 || msg_index == 11)
         {
@@ -758,13 +759,13 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
             if (msg_index == 9)
             {
                 ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected '[Command(Var)]', got %s\n", ptr);
-                ok(size == 15, "Expected 15, got %d\n", size);
+                ok(size == 15, "Expected 15, got %ld\n", size);
                 ret = (HDDEDATA)DDE_FACK;
             }
             else
             {
                 ok(!lstrcmpA(ptr, "[BadCommand(Var)]"), "Expected '[BadCommand(Var)]', got %s\n", ptr);
-                ok(size == 18, "Expected 18, got %d\n", size);
+                ok(size == 18, "Expected 18, got %ld\n", size);
                 ret = DDE_FNOTPROCESSED;
             }
 
@@ -775,14 +776,14 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
             DWORD rsize = 0;
 
             size = DdeGetData(hdata, NULL, 0, 0);
-            ok(size == 17, "DdeGetData should have returned 17 not %d\n", size);
+            ok(size == 17, "DdeGetData should have returned 17 not %ld\n", size);
             ptr = HeapAlloc(GetProcessHeap(), 0, size);
             ok(ptr != NULL,"HeapAlloc should have returned ptr not NULL\n");
             rsize = DdeGetData(hdata, (LPBYTE)ptr, size, 0);
-            ok(rsize == size, "DdeGetData did not return %d bytes but %d\n", size, rsize);
+            ok(rsize == size, "DdeGetData did not return %ld bytes but %ld\n", size, rsize);
 
             ok(!lstrcmpA(ptr, "[Command-2(Var)]"), "Expected '[Command-2(Var)]' got %s\n", ptr);
-            ok(size == 17, "Expected 17, got %d\n", size);
+            ok(size == 17, "Expected 17, got %ld\n", size);
             ret = (HDDEDATA)DDE_FACK;
 
             HeapFree(GetProcessHeap(), 0, ptr);
@@ -796,8 +797,8 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
         ok(msg_index == 12, "Expected 12, got %d\n", msg_index);
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
-        ok(dwData1 == 0, "Expected 0, got %08lx\n", dwData1);
-        ok(dwData2 == 0, "Expected 0, got %08lx\n", dwData2);
+        ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
+        ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
         ok(hsz1 == 0, "Expected 0, got %p\n", hsz2);
         ok(hsz2 == 0, "Expected 0, got %p\n", hsz2);
 
@@ -841,7 +842,7 @@ static void test_ddeml_server(void)
     ret = DdeUninitialize(server_pid);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
     GetExitCodeProcess(client, &exit_code);
-    ok( !res, "client failed with %u error(s)\n", exit_code );
+    ok( !res, "client failed with %lu error(s)\n", exit_code );
     CloseHandle(client);
 }
 
@@ -870,17 +871,17 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
     case WM_DDE_INITIATE:
     {
         ok(msg_index == 1, "Expected 1, got %d\n", msg_index);
-        ok(wparam == (WPARAM)client_hwnd, "Expected client hwnd, got %08lx\n", wparam);
+        ok(wparam == (WPARAM)client_hwnd, "Expected client hwnd, got %08Ix\n", wparam);
 
         size = GlobalGetAtomNameA(LOWORD(lparam), str, MAX_PATH);
         ok(LOWORD(lparam) == server, "Expected server atom, got %08x\n", LOWORD(lparam));
         ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
-        ok(size == 13, "Expected 13, got %d\n", size);
+        ok(size == 13, "Expected 13, got %ld\n", size);
 
         size = GlobalGetAtomNameA(HIWORD(lparam), str, MAX_PATH);
         ok(HIWORD(lparam) == topic, "Expected topic atom, got %08x\n", HIWORD(lparam));
         ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-        ok(size == 12, "Expected 12, got %d\n", size);
+        ok(size == 12, "Expected 12, got %ld\n", size);
 
         break;
     }
@@ -893,21 +894,21 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
         if (msg_index == 2)
         {
             server_hwnd = (HWND)wparam;
-            ok(wparam != 0, "Expected non-NULL wparam, got %08lx\n", wparam);
+            ok(wparam != 0, "Expected non-NULL wparam, got %08Ix\n", wparam);
 
             size = GlobalGetAtomNameA(LOWORD(lparam), str, MAX_PATH);
             ok(LOWORD(lparam) == server, "Expected server atom, got %08x\n", LOWORD(lparam));
             ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
-            ok(size == 13, "Expected 13, got %d\n", size);
+            ok(size == 13, "Expected 13, got %ld\n", size);
 
             size = GlobalGetAtomNameA(HIWORD(lparam), str, MAX_PATH);
             ok(HIWORD(lparam) == topic, "Expected topic atom, got %08x\n", HIWORD(lparam));
             ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
-            ok(size == 12, "Expected 12, got %d\n", size);
+            ok(size == 12, "Expected 12, got %ld\n", size);
         }
         else if (msg_index >= 9 && msg_index <= 11)
         {
-            ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08lx\n", wparam);
+            ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
 
             UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
 
@@ -916,7 +917,7 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
             ok(ack->reserved == 0, "Expected 0, got %d\n", ack->reserved);
             ok(ack->fBusy == FALSE, "Expected FALSE, got %d\n", ack->fBusy);
 
-            ok(hi == (UINT_PTR)execute_hglobal, "Expected execute hglobal, got %08lx\n", hi);
+            ok(hi == (UINT_PTR)execute_hglobal, "Expected execute hglobal, got %08Ix\n", hi);
             ptr = GlobalLock((HGLOBAL)hi);
 
             if (msg_index == 9)
@@ -938,7 +939,7 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
         }
         else
         {
-            ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08lx\n", wparam);
+            ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
 
             UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
 
@@ -958,22 +959,22 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
             size = GlobalGetAtomNameA(hi, str, MAX_PATH);
             if (msg_index == 3)
             {
-                ok(hi == item, "Expected item atom, got %08lx\n", hi);
+                ok(hi == item, "Expected item atom, got %08Ix\n", hi);
                 ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
-                ok(size == 7, "Expected 7, got %d\n", size);
+                ok(size == 7, "Expected 7, got %ld\n", size);
             }
             else if (msg_index == 4 || msg_index == 7)
             {
-                ok(hi == 0, "Expected 0, got %08lx\n", hi);
-                ok(size == 0, "Expected empty string, got %d\n", size);
+                ok(hi == 0, "Expected 0, got %08Ix\n", hi);
+                ok(size == 0, "Expected empty string, got %ld\n", size);
             }
             else
             {
-                ok(hi == item, "Expected item atom, got %08lx\n", hi);
+                ok(hi == item, "Expected item atom, got %08Ix\n", hi);
                 if (msg_index == 6) todo_wine
                 {
                     ok(!lstrcmpA(str, "poke"), "Expected poke, got %s\n", str);
-                    ok(size == 4, "Expected 4, got %d\n", size);
+                    ok(size == 4, "Expected 4, got %ld\n", size);
                 }
             }
         }
@@ -984,7 +985,7 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
     case WM_DDE_DATA:
     {
         ok(msg_index == 5, "Expected 5, got %d\n", msg_index);
-        ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08lx\n", wparam);
+        ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
 
         UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi);
 
@@ -1004,7 +1005,7 @@ static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam,
         size = GlobalGetAtomNameA(hi, str, MAX_PATH);
         ok(hi == item, "Expected item atom, got %08x\n", HIWORD(lparam));
         ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
-        ok(size == 7, "Expected 7, got %d\n", size);
+        ok(size == 7, "Expected 7, got %ld\n", size);
 
         GlobalFree((HGLOBAL)lo);
         GlobalDeleteAtom(hi);
@@ -1183,13 +1184,13 @@ static LRESULT WINAPI hook_dde_client_wndprocA(HWND hwnd, UINT msg, WPARAM wpara
 {
     UINT_PTR lo, hi;
 
-    if (winetest_debug > 1) trace("hook_dde_client_wndprocA: %p %04x %08lx %08lx\n", hwnd, msg, wparam, lparam);
+    if (winetest_debug > 1) trace("hook_dde_client_wndprocA: %p %04x %08Ix %08Ix\n", hwnd, msg, wparam, lparam);
 
     switch (msg)
     {
     case WM_DDE_ACK:
         UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
-        if (winetest_debug > 1) trace("WM_DDE_ACK: status %04lx hglobal %p\n", lo, (HGLOBAL)hi);
+        if (winetest_debug > 1) trace("WM_DDE_ACK: status %04Ix hglobal %p\n", lo, (HGLOBAL)hi);
         break;
 
     default:
@@ -1202,13 +1203,13 @@ static LRESULT WINAPI hook_dde_client_wndprocW(HWND hwnd, UINT msg, WPARAM wpara
 {
     UINT_PTR lo, hi;
 
-    if (winetest_debug > 1) trace("hook_dde_client_wndprocW: %p %04x %08lx %08lx\n", hwnd, msg, wparam, lparam);
+    if (winetest_debug > 1) trace("hook_dde_client_wndprocW: %p %04x %08Ix %08Ix\n", hwnd, msg, wparam, lparam);
 
     switch (msg)
     {
     case WM_DDE_ACK:
         UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
-        if (winetest_debug > 1) trace("WM_DDE_ACK: status %04lx hglobal %p\n", lo, (HGLOBAL)hi);
+        if (winetest_debug > 1) trace("WM_DDE_ACK: status %04Ix hglobal %p\n", lo, (HGLOBAL)hi);
         break;
 
     default:
@@ -1228,7 +1229,7 @@ static LRESULT WINAPI dde_server_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LP
     {
         ATOM aService = GlobalAddAtomW(TEST_DDE_SERVICE);
 
-        if (winetest_debug > 1) trace("server A: got WM_DDE_INITIATE from %p (%s) with %08lx\n",
+        if (winetest_debug > 1) trace("server A: got WM_DDE_INITIATE from %p (%s) with %08Ix\n",
               (HWND)wparam, client_unicode ? "Unicode" : "ANSI", lparam);
 
         if (LOWORD(lparam) == aService)
@@ -1257,10 +1258,10 @@ static LRESULT WINAPI dde_server_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LP
         LPCSTR cmd;
         UINT_PTR lo, hi;
 
-        if (winetest_debug > 1) trace("server A: got WM_DDE_EXECUTE from %p with %08lx\n", (HWND)wparam, lparam);
+        if (winetest_debug > 1) trace("server A: got WM_DDE_EXECUTE from %p with %08Ix\n", (HWND)wparam, lparam);
 
         UnpackDDElParam(WM_DDE_EXECUTE, lparam, &lo, &hi);
-        if (winetest_debug > 1) trace("%08lx => lo %04lx hi %04lx\n", lparam, lo, hi);
+        if (winetest_debug > 1) trace("%08Ix => lo %04Ix hi %04Ix\n", lparam, lo, hi);
 
         ack.bAppReturnCode = 0;
         ack.reserved = 0;
@@ -1311,7 +1312,7 @@ static LRESULT WINAPI dde_server_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LP
             }
             GlobalUnlock((HGLOBAL)hi);
         }
-        else ok( 0, "bad command data %lx\n", hi );
+        else ok( 0, "bad command data %Ix\n", hi );
 
         step++;
 
@@ -1327,7 +1328,7 @@ static LRESULT WINAPI dde_server_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LP
         DDEACK ack;
         WORD status;
 
-        if (winetest_debug > 1) trace("server A: got WM_DDE_TERMINATE from %#lx with %08lx\n", wparam, lparam);
+        if (winetest_debug > 1) trace("server A: got WM_DDE_TERMINATE from %#Ix with %08Ix\n", wparam, lparam);
 
         ack.bAppReturnCode = 0;
         ack.reserved = 0;
@@ -1377,7 +1378,7 @@ static LRESULT WINAPI dde_server_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LP
             GlobalDeleteAtom(aService);
 
         if (winetest_debug > 1)
-            trace("server W: got WM_DDE_INITIATE from %p with %08lx (client %s conv %s)\n", (HWND)wparam,
+            trace("server W: got WM_DDE_INITIATE from %p with %08Ix (client %s conv %s)\n", (HWND)wparam,
                     lparam, client_unicode ? "Unicode" : "ANSI", conv_unicode ? "Unicode" : "ANSI" );
 
         return 0;
@@ -1390,10 +1391,10 @@ static LRESULT WINAPI dde_server_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LP
         LPCSTR cmd;
         UINT_PTR lo, hi;
 
-        if (winetest_debug > 1) trace("server W: got WM_DDE_EXECUTE from %#lx with %08lx\n", wparam, lparam);
+        if (winetest_debug > 1) trace("server W: got WM_DDE_EXECUTE from %#Ix with %08Ix\n", wparam, lparam);
 
         UnpackDDElParam(WM_DDE_EXECUTE, lparam, &lo, &hi);
-        if (winetest_debug > 1) trace("%08lx => lo %04lx hi %04lx\n", lparam, lo, hi);
+        if (winetest_debug > 1) trace("%08Ix => lo %04Ix hi %04Ix\n", lparam, lo, hi);
 
         ack.bAppReturnCode = 0;
         ack.reserved = 0;
@@ -1452,7 +1453,7 @@ static LRESULT WINAPI dde_server_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LP
             }
             GlobalUnlock((HGLOBAL)hi);
         }
-        else ok( 0, "bad command data %lx\n", hi );
+        else ok( 0, "bad command data %Ix\n", hi );
 
         step++;
 
@@ -1468,7 +1469,7 @@ static LRESULT WINAPI dde_server_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LP
         DDEACK ack;
         WORD status;
 
-        if (winetest_debug > 1) trace("server W: got WM_DDE_TERMINATE from %#lx with %08lx\n", wparam, lparam);
+        if (winetest_debug > 1) trace("server W: got WM_DDE_TERMINATE from %#Ix with %08Ix\n", wparam, lparam);
 
         ack.bAppReturnCode = 0;
         ack.reserved = 0;
@@ -1541,7 +1542,7 @@ static HDDEDATA CALLBACK client_dde_callback(UINT uType, UINT uFmt, HCONV hconv,
     cmd_name = (type <= 14) ? cmd_type[type] : "unknown";
 
     if (winetest_debug > 1)
-        trace("client_dde_callback: %04x (%s) %d %p %p %p %p %08lx %08lx\n",
+        trace("client_dde_callback: %04x (%s) %d %p %p %p %p %08Ix %08Ix\n",
                 uType, cmd_name, uFmt, hconv, hsz1, hsz2, hdata, dwData1, dwData2);
     return 0;
 }
@@ -1565,7 +1566,7 @@ static void test_dde_aw_transaction( BOOL client_unicode, BOOL server_unicode )
         ret = DdeInitializeW(&dde_inst, client_dde_callback, APPCMD_CLIENTONLY, 0);
     else
         ret = DdeInitializeA(&dde_inst, client_dde_callback, APPCMD_CLIENTONLY, 0);
-    ok(ret == DMLERR_NO_ERROR, "DdeInitializeA failed with error %04x (%x)\n",
+    ok(ret == DMLERR_NO_ERROR, "DdeInitializeA failed with error %04lx (%x)\n",
        ret, DdeGetLastError(dde_inst));
 
     hsz_server = DdeCreateStringHandleW(dde_inst, TEST_DDE_SERVICE, CP_WINUNICODE);
@@ -1578,11 +1579,11 @@ static void test_dde_aw_transaction( BOOL client_unicode, BOOL server_unicode )
         return;
     }
     err = DdeGetLastError(dde_inst);
-    ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+    ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
 
     info.cb = sizeof(info);
     ret = DdeQueryConvInfo(hconv, QID_SYNC, &info);
-    ok(ret, "wrong info size %d, DdeQueryConvInfo error %x\n", ret, DdeGetLastError(dde_inst));
+    ok(ret, "wrong info size %ld, DdeQueryConvInfo error %x\n", ret, DdeGetLastError(dde_inst));
     ok(info.ConvCtxt.iCodePage == (client_unicode ? CP_WINUNICODE : CP_WINANSI),
        "wrong iCodePage %d\n", info.ConvCtxt.iCodePage);
     ok(!info.hConvPartner, "unexpected info.hConvPartner: %p\n", info.hConvPartner);
@@ -1598,30 +1599,30 @@ todo_wine {
     ret = 0xdeadbeef;
     hdata = DdeClientTransaction((LPBYTE)test_cmd, strlen(test_cmd) + 1, hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
     ok(!hdata, "DdeClientTransaction succeeded\n");
-    ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
+    ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
     err = DdeGetLastError(dde_inst);
-    ok(err == DMLERR_NOTPROCESSED, "wrong dde error %x\n", err);
+    ok(err == DMLERR_NOTPROCESSED, "wrong dde error %lx\n", err);
 
     ret = 0xdeadbeef;
     hdata = DdeClientTransaction((LPBYTE)exec_cmdA, lstrlenA(exec_cmdA) + 1, hconv, 0, 0, XTYP_EXECUTE, 1000, &ret);
     err = DdeGetLastError(dde_inst);
     if (conv_unicode && (!client_unicode || !server_unicode))  /* W->A mapping -> garbage */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else if (!conv_unicode && client_unicode && server_unicode)  /* A->W mapping -> wrong cmd */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else  /* no mapping */
     {
-        ok(hdata != 0, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FACK, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+        ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
     }
 
     ret = 0xdeadbeef;
@@ -1630,21 +1631,21 @@ todo_wine {
     err = DdeGetLastError(dde_inst);
     if (conv_unicode && (!client_unicode || !server_unicode))  /* W->A mapping */
     {
-        ok(hdata != 0, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FACK, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+        ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
     }
     else if (!conv_unicode && client_unicode && server_unicode)  /* A->W mapping -> garbage */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else  /* no mapping */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
 
     ret = 0xdeadbeef;
@@ -1652,21 +1653,21 @@ todo_wine {
     err = DdeGetLastError(dde_inst);
     if (conv_unicode && (!client_unicode || !server_unicode))  /* W->A mapping -> wrong cmd */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else if (!conv_unicode && client_unicode && server_unicode)  /* A->W mapping -> garbage */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else  /* no mapping */
     {
-        ok(hdata != 0, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FACK, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+        ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
     }
 
     ret = 0xdeadbeef;
@@ -1674,21 +1675,21 @@ todo_wine {
     err = DdeGetLastError(dde_inst);
     if (conv_unicode && (!client_unicode || !server_unicode))  /* W->A mapping -> garbage */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
     else if (!conv_unicode && client_unicode && server_unicode)  /* A->W mapping */
     {
-        ok(hdata != 0, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FACK, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+        ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
     }
     else  /* no mapping */
     {
-        ok(!hdata, "DdeClientTransaction returned %p, error %x\n", hdata, err);
-        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04x\n", ret);
-        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %x\n", err);
+        ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
+        ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
+        ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
     }
 
     got = DdeDisconnect(hconv);
@@ -1699,7 +1700,7 @@ todo_wine {
     ok(!ret, "DdeQueryConvInfo should fail\n");
     err = DdeGetLastError(dde_inst);
 todo_wine {
-    ok(err == DMLERR_INVALIDPARAMETER, "wrong dde error %x\n", err);
+    ok(err == DMLERR_INVALIDPARAMETER, "wrong dde error %lx\n", err);
 }
 
     got = DdeFreeStringHandle(dde_inst, hsz_server);
@@ -1749,7 +1750,7 @@ static void test_initialisation(void)
     ret = DdeGetLastError(client_pid);
     todo_wine
     ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
-    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08x\n", res);
+    ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", res);
 
     DdeFreeStringHandle(client_pid, server);
     ret = DdeDisconnect(conversation);
@@ -1823,7 +1824,7 @@ static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage)
         atom = GlobalFindAtomA((LPSTR)dde_string);
         ok(atom == 0, "Expected 0, got %d\n", atom);
         ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-           "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+           "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     }
     else
     {
@@ -1834,7 +1835,7 @@ static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage)
         atom = GlobalFindAtomW(dde_string);
         ok(atom == 0, "Expected 0, got %d\n", atom);
         ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-           "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+           "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     }
 
     ok(DdeFreeStringHandle(dde_inst, str_handle), "DdeFreeStringHandle failed\n");
@@ -1913,7 +1914,7 @@ static void test_DdeCreateDataHandle(void)
 
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(size == 260, "Expected 260, got %d\n", size);
+    ok(size == 260, "Expected 260, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -1930,7 +1931,7 @@ static void test_DdeCreateDataHandle(void)
 
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(size == 0, "Expected 0, got %d\n", size);
+    ok(size == 0, "Expected 0, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -1947,7 +1948,7 @@ static void test_DdeCreateDataHandle(void)
 
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(size == 262, "Expected 262, got %d\n", size);
+    ok(size == 262, "Expected 262, got %ld\n", size);
     todo_wine
     {
         ok(ptr && !*ptr, "Expected 0, got %d\n", lstrlenA((LPSTR)ptr));
@@ -1969,7 +1970,7 @@ static void test_DdeCreateDataHandle(void)
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
-    ok(size == 260, "Expected 260, got %d\n", size);
+    ok(size == 260, "Expected 260, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -1987,7 +1988,7 @@ static void test_DdeCreateDataHandle(void)
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
-    ok(size == 260, "Expected 260, got %d\n", size);
+    ok(size == 260, "Expected 260, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2005,7 +2006,7 @@ static void test_DdeCreateDataHandle(void)
     ptr = DdeAccessData(hdata, &size);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
     ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
-    ok(size == 260, "Expected 260, got %d\n", size);
+    ok(size == 260, "Expected 260, got %ld\n", size);
 
     ret = DdeUnaccessData(hdata);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2024,12 +2025,12 @@ static void test_DdeCreateStringHandle(void)
     dde_inst = 0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = DdeInitializeW(&dde_inst, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
-    ok(ret == DMLERR_INVALIDPARAMETER, "DdeInitializeW should fail, but got %04x instead\n", ret);
+    ok(ret == DMLERR_INVALIDPARAMETER, "DdeInitializeW should fail, but got %04lx instead\n", ret);
     ok(DdeGetLastError(dde_inst) == DMLERR_INVALIDPARAMETER, "expected DMLERR_INVALIDPARAMETER\n");
 
     dde_inst = 0;
     ret = DdeInitializeW(&dde_inst, client_ddeml_callback, APPCMD_CLIENTONLY, 0);
-    ok(ret == DMLERR_NO_ERROR, "DdeInitializeW failed with error %04x (%08x)\n",
+    ok(ret == DMLERR_NO_ERROR, "DdeInitializeW failed with error %04lx (%08x)\n",
        ret, DdeGetLastError(dde_inst));
 
     test_DdeCreateStringHandleW(dde_inst, 0);
@@ -2096,25 +2097,25 @@ static void test_PackDDElParam(void)
 
     lparam = PackDDElParam(WM_DDE_INITIATE, 0xcafe, 0xbeef);
     /* value gets sign-extended despite being an LPARAM */
-    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
 
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_INITIATE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_INITIATE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
 
     lparam = PackDDElParam(WM_DDE_TERMINATE, 0xcafe, 0xbeef);
-    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
 
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_TERMINATE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_TERMINATE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2122,8 +2123,8 @@ static void test_PackDDElParam(void)
     lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef);
     ptr = GlobalLock((HGLOBAL)lparam);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
-    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
+    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
 
     ret = GlobalUnlock((HGLOBAL)lparam);
     ok(ret == 1, "Expected 1, got %d\n", ret);
@@ -2131,20 +2132,20 @@ static void test_PackDDElParam(void)
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_ADVISE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_ADVISE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
 
     lparam = PackDDElParam(WM_DDE_UNADVISE, 0xcafe, 0xbeef);
-    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
 
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_UNADVISE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_UNADVISE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2152,8 +2153,8 @@ static void test_PackDDElParam(void)
     lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef);
     ptr = GlobalLock((HGLOBAL)lparam);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
-    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
+    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
 
     ret = GlobalUnlock((HGLOBAL)lparam);
     ok(ret == 1, "Expected 1, got %d\n", ret);
@@ -2161,8 +2162,8 @@ static void test_PackDDElParam(void)
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_ACK, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2170,8 +2171,8 @@ static void test_PackDDElParam(void)
     lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef);
     ptr = GlobalLock((HGLOBAL)lparam);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
-    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
+    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
 
     ret = GlobalUnlock((HGLOBAL)lparam);
     ok(ret == 1, "Expected 1, got %d\n", ret);
@@ -2179,20 +2180,20 @@ static void test_PackDDElParam(void)
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_DATA, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
 
     lparam = PackDDElParam(WM_DDE_REQUEST, 0xcafe, 0xbeef);
-    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08lx\n", lparam);
+    ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
 
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_REQUEST, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_REQUEST, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2200,8 +2201,8 @@ static void test_PackDDElParam(void)
     lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef);
     ptr = GlobalLock((HGLOBAL)lparam);
     ok(ptr != NULL, "Expected non-NULL ptr\n");
-    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08lx\n", ptr[0]);
-    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08lx\n", ptr[1]);
+    ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
+    ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
 
     ret = GlobalUnlock((HGLOBAL)lparam);
     ok(ret == 1, "Expected 1, got %d\n", ret);
@@ -2209,20 +2210,20 @@ static void test_PackDDElParam(void)
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafe, "Expected 0xcafe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_POKE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
 
     lparam = PackDDElParam(WM_DDE_EXECUTE, 0xcafe, 0xbeef);
-    ok(lparam == 0xbeef, "Expected 0xbeef, got %08lx\n", lparam);
+    ok(lparam == 0xbeef, "Expected 0xbeef, got %08Ix\n", lparam);
 
     lo = hi = 0;
     ret = UnpackDDElParam(WM_DDE_EXECUTE, lparam, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0, "Expected 0, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0, "Expected 0, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     ret = FreeDDElParam(WM_DDE_EXECUTE, lparam);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
@@ -2239,38 +2240,38 @@ static void test_UnpackDDElParam(void)
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_INITIATE, 0, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0, "Expected 0, got %08lx\n", lo);
-    ok(hi == 0, "Expected 0, got %08lx\n", hi);
+    ok(lo == 0, "Expected 0, got %08Ix\n", lo);
+    ok(hi == 0, "Expected 0, got %08Ix\n", hi);
 
     /* NULL lo */
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, NULL, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xdead, "Expected 0xdead, got %08lx\n", lo);
-    ok(hi == 0xcafe, "Expected 0xcafe, got %08lx\n", hi);
+    ok(lo == 0xdead, "Expected 0xdead, got %08Ix\n", lo);
+    ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
 
     /* NULL hi */
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, &lo, NULL);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xbabe, "Expected 0xbabe, got %08lx\n", lo);
-    ok(hi == 0xbeef, "Expected 0xbeef, got %08lx\n", hi);
+    ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
+    ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xbabe, "Expected 0xbabe, got %08lx\n", lo);
-    ok(hi == 0xcafe, "Expected 0xcafe, got %08lx\n", hi);
+    ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
+    ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_TERMINATE, 0xcafebabe, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xbabe, "Expected 0xbabe, got %08lx\n", lo);
-    ok(hi == 0xcafe, "Expected 0xcafe, got %08lx\n", hi);
+    ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
+    ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
@@ -2278,10 +2279,10 @@ static void test_UnpackDDElParam(void)
     ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
     ok(lo == 0 ||
        broken(lo == 0xdead), /* win2k */
-       "Expected 0, got %08lx\n", lo);
+       "Expected 0, got %08Ix\n", lo);
     ok(hi == 0 ||
        broken(hi == 0xbeef), /* win2k */
-       "Expected 0, got %08lx\n", hi);
+       "Expected 0, got %08Ix\n", hi);
 
     hglobal = GlobalAlloc(GMEM_DDESHARE, 2 * sizeof(*ptr));
     ptr = GlobalLock(hglobal);
@@ -2293,50 +2294,50 @@ static void test_UnpackDDElParam(void)
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_ADVISE, (LPARAM)hglobal, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", lo);
-    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", hi);
+    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
+    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_UNADVISE, 0xcafebabe, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xbabe, "Expected 0xbabe, got %08lx\n", lo);
-    ok(hi == 0xcafe, "Expected 0xcafe, got %08lx\n", hi);
+    ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
+    ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_ACK, (LPARAM)hglobal, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", lo);
-    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", hi);
+    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
+    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_DATA, (LPARAM)hglobal, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", lo);
-    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", hi);
+    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
+    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_REQUEST, 0xcafebabe, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xbabe, "Expected 0xbabe, got %08lx\n", lo);
-    ok(hi == 0xcafe, "Expected 0xcafe, got %08lx\n", hi);
+    ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
+    ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_POKE, (LPARAM)hglobal, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", lo);
-    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", hi);
+    ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
+    ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
 
     lo = 0xdead;
     hi = 0xbeef;
     ret = UnpackDDElParam(WM_DDE_EXECUTE, 0xcafebabe, &lo, &hi);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
-    ok(lo == 0, "Expected 0, got %08lx\n", lo);
-    ok(hi == 0xcafebabe, "Expected 0xcafebabe, got %08lx\n", hi);
+    ok(lo == 0, "Expected 0, got %08Ix\n", lo);
+    ok(hi == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", hi);
 
     GlobalFree(hglobal);
 }
@@ -2381,18 +2382,18 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
         ok(uFmt == 0, "Expected 0, got %d, msg_index=%d\n", uFmt, msg_index);
         ok(hconv == 0, "Expected 0, got %p, msg_index=%d\n", hconv, msg_index);
         ok(hdata == 0, "Expected 0, got %p, msg_index=%d\n", hdata, msg_index);
-        ok(dwData1 != 0, "Expected not 0, got %08lx, msg_index=%d\n", dwData1, msg_index);
-        ok(dwData2 == FALSE, "Expected FALSE, got %08lx, msg_index=%d\n", dwData2, msg_index);
+        ok(dwData1 != 0, "Expected not 0, got %08Ix, msg_index=%d\n", dwData1, msg_index);
+        ok(dwData2 == FALSE, "Expected FALSE, got %08Ix, msg_index=%d\n", dwData2, msg_index);
 
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, test_topic), "Expected %s, got %s, msg_index=%d\n",
                              test_topic, str, msg_index);
-        ok(size == 12, "Expected 12, got %d, msg_index=%d\n", size, msg_index);
+        ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index);
 
         size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, test_service), "Expected %s, got %s, msg_index=%d\n",
                              test_service, str, msg_index);
-        ok(size == 14, "Expected 14, got %d, msg_index=%d\n", size, msg_index);
+        ok(size == 14, "Expected 14, got %ld, msg_index=%d\n", size, msg_index);
 
         return (HDDEDATA) TRUE;
     }
@@ -2414,18 +2415,18 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
         ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
         ok(hconv == conversation, "Expected conversation handle, got %p, msg_index=%d\n",
                              hconv, msg_index);
-        ok(dwData1 == 0, "Expected 0, got %08lx, msg_index=%d\n", dwData1, msg_index);
-        ok(dwData2 == 0, "Expected 0, got %08lx, msg_index=%d\n", dwData2, msg_index);
+        ok(dwData1 == 0, "Expected 0, got %08Ix, msg_index=%d\n", dwData1, msg_index);
+        ok(dwData2 == 0, "Expected 0, got %08Ix, msg_index=%d\n", dwData2, msg_index);
         ok(hsz2 == 0, "Expected 0, got %p, msg_index=%d\n", hsz2, msg_index);
         size = DdeQueryStringA(server_pid, hsz1, str, MAX_PATH, CP_WINANSI);
         ok(!lstrcmpA(str, test_topic), "Expected %s, got %s, msg_index=%d\n",
                              test_topic, str, msg_index);
-        ok(size == 12, "Expected 12, got %d, msg_index=%d\n", size, msg_index);
+        ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index);
 
         size = DdeGetData(hdata, NULL, 0, 0);
         ok((buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size)) != NULL, "should not be null\n");
         rsize = DdeGetData(hdata, buffer, size, 0);
-        ok(rsize == size, "Incorrect size returned, expected %d got %d, msg_index=%d\n",
+        ok(rsize == size, "Incorrect size returned, expected %ld got %ld, msg_index=%d\n",
            size, rsize, msg_index);
         if (winetest_debug > 1) trace("msg %u strA \"%s\" strW %s\n", msg_index, buffer, wine_dbgstr_w((WCHAR*)buffer));
 
@@ -2442,7 +2443,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
         case 0:  /* ANSI string */
             if (unicode_server)
             {
-                ok(size == size_a_to_w, "Wrong size %d/%d, msg_index=%d\n", size, size_a_to_w, msg_index);
+                ok(size == size_a_to_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_a_to_w, msg_index);
                 ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w),
                    "Expected %s, msg_index=%d\n", wine_dbgstr_w(test_cmd_a_to_w), msg_index);
             }
@@ -2452,7 +2453,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
             }
             else
             {
-                ok(size == size_a, "Wrong size %d/%d, msg_index=%d\n", size, size_a, msg_index);
+                ok(size == size_a, "Wrong size %ld/%ld, msg_index=%d\n", size, size_a, msg_index);
                 ok(!lstrcmpA((CHAR*)buffer, test_cmd_a_to_a), "Expected %s, got %s, msg_index=%d\n",
                    test_cmd_a_to_a, buffer, msg_index);
             }
@@ -2461,13 +2462,13 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
         case 1:  /* Unicode string with only 8-bit chars */
             if (unicode_server)
             {
-                ok(size == size_w, "Wrong size %d/%d, msg_index=%d\n", size, size_w, msg_index);
+                ok(size == size_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w, msg_index);
                 ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
                    "Expected %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), msg_index);
             }
             else
             {
-                ok(size == size_w_to_a, "Wrong size %d/%d, msg_index=%d\n",
+                ok(size == size_w_to_a, "Wrong size %ld/%ld, msg_index=%d\n",
                    size, size_w_to_a, msg_index);
                 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
                    test_cmd_w_to_a, buffer, msg_index);
@@ -2486,19 +2487,19 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
                 DWORD xp_size = MultiByteToWideChar( CP_ACP, 0, (char *)cmd_w, -1, NULL, 0 ) * sizeof(WCHAR);
                 ok(size == xp_size || broken(size == nt_size) ||
                    broken(str_index == 4 && IsDBCSLeadByte(cmd_w[0])) /* East Asian */,
-                   "Wrong size %d/%d, msg_index=%d\n", size, size_a_to_w, msg_index);
+                   "Wrong size %ld/%ld, msg_index=%d\n", size, size_a_to_w, msg_index);
                 ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w),
                    "Expected %s, msg_index=%d\n", wine_dbgstr_w(test_cmd_a_to_w), msg_index);
             }
             else if (unicode_client)
             {
-                ok(size == size_w_to_a, "Wrong size %d/%d, msg_index=%d\n", size, size_w_to_a, msg_index);
+                ok(size == size_w_to_a, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w_to_a, msg_index);
                 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
                    test_cmd_w_to_a, buffer, msg_index);
             }
             else
             {
-                ok(size == size_w, "Wrong size %d/%d, msg_index=%d\n", size, size_w, msg_index);
+                ok(size == size_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w, msg_index);
                 ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
                    "Expected %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), msg_index);
             }
@@ -2506,7 +2507,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
         case 5: /* Chinese with latin characters begin */
             if (unicode_server && unicode_client)
             {
-                todo_wine ok(size == size_w, "Wrong size %d expected %d, msg_index=%d\n", size, size_w, msg_index);
+                todo_wine ok(size == size_w, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w, msg_index);
                 MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
                                     ARRAY_SIZE(test_cmd_a_to_w));
                 todo_wine ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
@@ -2514,7 +2515,7 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
             }
             else if (unicode_server)
             {
-                todo_wine ok(size == size_w, "Wrong size %d expected %d, msg_index=%d\n", size, size_w, msg_index);
+                todo_wine ok(size == size_w, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w, msg_index);
                 MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
                                     ARRAY_SIZE(test_cmd_a_to_w));
                 if (!is_cjk())
@@ -2526,13 +2527,13 @@ static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV
             }
             else if (unicode_client)
             {
-                ok(size == size_w_to_a, "Wrong size %d expected %d, msg_index=%d\n", size, size_w_to_a, msg_index);
+                ok(size == size_w_to_a, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w_to_a, msg_index);
                 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
                    test_cmd_w_to_a, buffer, msg_index);
             }
             else
             {
-                todo_wine ok(size == size_w_to_a || size == (size_w_to_a - 1), "Wrong size %d expected %d or %d, msg_index=%d\n",
+                todo_wine ok(size == size_w_to_a || size == (size_w_to_a - 1), "Wrong size %ld expected %ld or %ld, msg_index=%d\n",
                              size, size_w_to_a, size_w_to_a - 1, msg_index);
                 todo_wine ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
                              test_cmd_w_to_a, buffer, msg_index);
@@ -2588,7 +2589,7 @@ static void test_end_to_end_client(BOOL type_a)
         ret = DdeInitializeA(&client_pid, client_end_to_end_callback, APPCMD_CLIENTONLY, 0);
     else
         ret = DdeInitializeW(&client_pid, client_end_to_end_callback, APPCMD_CLIENTONLY, 0);
-    ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %x\n", ret);
+    ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %lx\n", ret);
 
     if (type_a)
     {
@@ -2609,16 +2610,16 @@ static void test_end_to_end_client(BOOL type_a)
         return;
     }
     ret = DdeGetLastError(client_pid);
-    ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %x\n", ret);
+    ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %lx\n", ret);
     DdeFreeStringHandle(client_pid, server);
 
     /* Test both A and W data being passed to DdeClientTransaction */
     hdata = DdeClientTransaction((LPBYTE)test_cmd_a_to_a, sizeof(test_cmd_a_to_a),
             hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
     ok(hdata != NULL, "DdeClientTransaction failed\n");
-    ok(ret == DDE_FACK, "wrong status code %x\n", ret);
+    ok(ret == DDE_FACK, "wrong status code %lx\n", ret);
     err = DdeGetLastError(client_pid);
-    ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+    ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
 
     for (i = 0; i < ARRAY_SIZE(test_cmd_w_to_w); i++)
     {
@@ -2626,17 +2627,17 @@ static void test_end_to_end_client(BOOL type_a)
                                      (lstrlenW(test_cmd_w_to_w[i]) + 1) * sizeof(WCHAR),
                                      hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
         ok(hdata != NULL, "DdeClientTransaction failed\n");
-        ok(ret == DDE_FACK, "wrong status code %x\n", ret);
+        ok(ret == DDE_FACK, "wrong status code %lx\n", ret);
         err = DdeGetLastError(client_pid);
-        ok(err == DMLERR_NO_ERROR, "wrong dde error %x\n", err);
+        ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
     }
 
     DdeFreeStringHandle(client_pid, topic);
     ret = DdeDisconnect(hconv);
-    ok(ret == TRUE, "Expected TRUE, got %x\n", ret);
+    ok(ret == TRUE, "Expected TRUE, got %lx\n", ret);
 
     ret = DdeUninitialize(client_pid);
-    ok(ret == TRUE, "Expected TRUE, got %x\n", ret);
+    ok(ret == TRUE, "Expected TRUE, got %lx\n", ret);
 
 }
 
@@ -2659,7 +2660,7 @@ static void test_end_to_end_server(void)
         res = DdeInitializeW(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0);
     else
         res = DdeInitializeA(&server_pid, server_end_to_end_callback, APPCLASS_STANDARD, 0);
-    ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
+    ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %ld\n", res);
 
     server = DdeCreateStringHandleA(server_pid, test_service, CP_WINANSI);
     ok(server != NULL, "Expected non-NULL string handle\n");
@@ -2677,7 +2678,7 @@ static void test_end_to_end_server(void)
     ret = DdeUninitialize(server_pid);
     ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
     GetExitCodeProcess(client, &res);
-    ok( !res, "client failed with %u error(s)\n", res );
+    ok( !res, "client failed with %lu error(s)\n", res );
     CloseHandle(client);
 }
 
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index f2bc30ff921..5c500608710 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for the dialog functions.
  *
  * Copyright 2004 Bill Medland
@@ -167,7 +168,7 @@ static BOOL CreateWindows (HINSTANCE hinst)
         {
             if (p->id >=  ARRAY_SIZE(hwnd))
             {
-                trace ("Control %ld is out of range\n", p->id);
+                trace ("Control %Id is out of range\n", p->id);
                 return FALSE;
             }
             else
@@ -175,21 +176,21 @@ static BOOL CreateWindows (HINSTANCE hinst)
         }
         if (p->id <= 0)
         {
-            trace ("Control %ld is out of range\n", p->id);
+            trace ("Control %Id is out of range\n", p->id);
             return FALSE;
         }
         if (hwnd[p->id] != 0)
         {
-            trace ("Control %ld is used more than once\n", p->id);
+            trace ("Control %Id is used more than once\n", p->id);
             return FALSE;
         }
 
         /* Create the control */
-        sprintf (ctrlname, "ctrl%4.4ld", p->id);
+        sprintf (ctrlname, "ctrl%4.4Id", p->id);
         hwnd[p->id] = CreateWindowExA(p->exstyle, p->parent ? "static" : "GetNextDlgItemWindowClass", ctrlname, p->style, 10, 10, 10, 10, hwnd[p->parent], p->parent ? (HMENU) (2000 + p->id) : 0, hinst, 0);
         if (!hwnd[p->id])
         {
-            trace ("Failed to create control %ld\n", p->id);
+            trace ("Failed to create control %Id\n", p->id);
             return FALSE;
         }
 
@@ -203,7 +204,7 @@ static BOOL CreateWindows (HINSTANCE hinst)
             exstyle = GetWindowLongA(hwnd[p->id], GWL_EXSTYLE);
             if (style != p->style || exstyle != p->exstyle)
             {
-                trace ("Style mismatch at %ld: %8.8x %8.8x cf %8.8x %8.8x\n", p->id, style, exstyle, p->style, p->exstyle);
+                trace ("Style mismatch at %Id: %8.8lx %8.8lx cf %8.8lx %8.8lx\n", p->id, style, exstyle, p->style, p->exstyle);
             }
         }
         p++;
@@ -693,11 +694,11 @@ static void test_WM_NEXTDLGCTL(void)
 
     DefDlgProcA( g_hwndTestDlg, DM_SETDEFID, 200, 0);
     dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
-    ok(LOWORD(dwVal) == 200, "expected 200, got %x\n", dwVal);
+    ok(LOWORD(dwVal) == 200, "expected 200, got %lx\n", dwVal);
 
     DefDlgProcA( g_hwndTestDlg, DM_SETDEFID, 300, 0);
     dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
-    ok(LOWORD(dwVal) == 300, "expected 300, got %x\n", dwVal);
+    ok(LOWORD(dwVal) == 300, "expected 300, got %lx\n", dwVal);
     ok(SendMessageW( child3, WM_GETDLGCODE, 0, 0) != DLGC_DEFPUSHBUTTON,
        "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
 
@@ -1042,13 +1043,13 @@ static void test_focus(void)
 
         SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
         SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
-        ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n", selectionStart, selectionEnd);
+        ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%li, %li) expected [0, 11)\n", selectionStart, selectionEnd);
 
         /* but WM_ACTIVATE does not */
         SendMessageA(hTextbox, EM_SETSEL, 0, 0);
         SendMessageA(hDlg, WM_ACTIVATE, WA_ACTIVE, 0);
         SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
-        ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%i, %i) expected [0, 0)\n", selectionStart, selectionEnd);
+        ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%li, %li) expected [0, 0)\n", selectionStart, selectionEnd);
 
         DestroyWindow(hDlg);
     }
@@ -1112,7 +1113,7 @@ static void test_focus(void)
                 GetFocus(), hDlg, edit);
         SendMessageA(edit, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
         ok(selectionStart == 0 && selectionEnd == 11,
-                "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n",
+                "Text selection after WM_SETFOCUS is [%li, %li) expected [0, 11)\n",
                 selectionStart, selectionEnd);
 
         DestroyWindow(hDlg);
@@ -1175,7 +1176,7 @@ static INT_PTR CALLBACK getdlgitem_test_dialog_proc(HWND hdlg, UINT msg, WPARAM
         ok(val == -1, "Unexpected id.\n");
 
         val = GetWindowLongPtrA(hwnd, GWLP_ID);
-        ok(val == -1, "Unexpected id %ld.\n", val);
+        ok(val == -1, "Unexpected id %Id.\n", val);
 
         hwnd = GetDlgItem(hdlg, -2);
         ok(hwnd != NULL, "Expected dialog item.\n");
@@ -1184,7 +1185,7 @@ static INT_PTR CALLBACK getdlgitem_test_dialog_proc(HWND hdlg, UINT msg, WPARAM
         ok(val == -2, "Unexpected id.\n");
 
         val = GetWindowLongPtrA(hwnd, GWLP_ID);
-        ok(val == -2, "Unexpected id %ld.\n", val);
+        ok(val == -2, "Unexpected id %Id.\n", val);
 
         EndDialog(hdlg, 0xdead);
     }
@@ -1357,9 +1358,9 @@ static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg,
         control = GetDlgItem(hdlg, 7);
         ok(control != 0, "dialog control with id 7 not found\n");
         style = GetWindowLongA(control, GWL_STYLE);
-        ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
+        ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#lx\n", style);
         exstyle = GetWindowLongA(control, GWL_EXSTYLE);
-        ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#x\n", exstyle);
+        ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#lx\n", exstyle);
         buf[0] = 0;
         GetWindowTextA(control, buf, sizeof(buf));
         ok(strcmp(buf, "bump7") == 0,  "expected bump7, got %s\n", buf);
@@ -1367,9 +1368,9 @@ static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg,
         control = GetDlgItem(hdlg, 8);
         ok(control != 0, "dialog control with id 8 not found\n");
         style = GetWindowLongA(control, GWL_STYLE);
-        ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
+        ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#lx\n", style);
         exstyle = GetWindowLongA(control, GWL_EXSTYLE);
-        ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#x\n", exstyle);
+        ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#lx\n", exstyle);
         buf[0] = 0;
         GetWindowTextA(control, buf, sizeof(buf));
         ok(strcmp(buf, "bump8") == 0,  "expected bump8, got %s\n", buf);
@@ -1539,19 +1540,19 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
 
         /* WM_SETTEXT/WM_GETTEXT */
         originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
+        ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#Ix.\n", originalproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = SetWindowLongPtrA(hdlg, DWLP_DLGPROC, (UINT_PTR)test_aw_conversion_dlgprocA);
         ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
 
         dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
         ret = SetWindowTextA(hdlg, testtext);
@@ -1584,10 +1585,10 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM w
         ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
 
         dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
         ret = SetWindowTextA(hdlg, testtext);
@@ -1646,19 +1647,19 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM
         dlg_test_aw_message(hdlg, WM_SETTEXT);
 
         originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", originalproc);
+        ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#Ix.\n", originalproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = SetWindowLongPtrA(hdlg, DWLP_DLGPROC, (UINT_PTR)test_aw_conversion_dlgprocW);
         ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
 
         dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
         ret = SetWindowTextA(hdlg, testtext);
@@ -1691,10 +1692,10 @@ static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM
         ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
 
         dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
-        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
-        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
+        ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
 
         SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
         ret = SetWindowTextA(hdlg, testtext);
@@ -1819,49 +1820,49 @@ static void test_DialogBoxParam(void)
     HWND hwnd_invalid = (HWND)0x4444;
 
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
-    ok(ret == -7, "expected -7, got %ld\n", ret);
+    ok(ret == -7, "expected -7, got %Id\n", ret);
 
     SetLastError(0xdeadbeef);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
-    ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %ld, expected 0\n", ret);
+    ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %Id, expected 0\n", ret);
     ok(ERROR_INVALID_WINDOW_HANDLE == GetLastError() ||
        broken(GetLastError() == 0xdeadbeef),
-       "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
+       "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
 
     /* Test a dialog which destroys itself on WM_INITDIALOG. */
     SetLastError(0xdeadbeef);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG", 0, DestroyDlgWinProc, 0);
-    ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
+    ok(-1 == ret, "DialogBoxParamA returned %Id, expected -1\n", ret);
     ok(ERROR_INVALID_WINDOW_HANDLE == GetLastError() ||
        GetLastError() == ERROR_SUCCESS ||
        broken(GetLastError() == 0xdeadbeef),
-       "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
+       "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
 
     /* Test a dialog which destroys itself on WM_CLOSE. */
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG", 0, DestroyOnCloseDlgWinProc, 0);
-    ok(0 == ret, "DialogBoxParamA returned %ld, expected 0\n", ret);
+    ok(0 == ret, "DialogBoxParamA returned %Id, expected 0\n", ret);
 
     SetLastError(0xdeadbeef);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "RESOURCE_INVALID" , 0, 0, 0);
-    ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
+    ok(-1 == ret, "DialogBoxParamA returned %Id, expected -1\n", ret);
     ok(ERROR_RESOURCE_NAME_NOT_FOUND == GetLastError() ||
        broken(GetLastError() == 0xdeadbeef),
-       "got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
+       "got %ld, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0);
-    ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret);
+    ok(ret == -1, "DialogBoxParamA returned %Id, expected -1\n", ret);
     todo_wine
     ok(GetLastError() == ERROR_CANNOT_FIND_WND_CLASS ||
        broken(GetLastError() == ERROR_SUCCESS) /* < win10 21H1 */,
-       "got %u, expected ERROR_CANNOT_FIND_WND_CLASS\n", GetLastError());
+       "got %lu, expected ERROR_CANNOT_FIND_WND_CLASS\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0);
-    ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret);
+    ok(ret == 0, "DefDlgProcA returned %Id, expected 0\n", ret);
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
        broken(GetLastError() == 0xdeadbeef),
-       "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
+       "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
 
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
     ok(ret == IDOK, "Expected IDOK\n");
@@ -1870,20 +1871,20 @@ static void test_DialogBoxParam(void)
     ok(ret == IDOK, "Expected IDOK\n");
 
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
-    ok(ret == 0, "Unexpected ret value %ld.\n", ret);
+    ok(ret == 0, "Unexpected ret value %Id.\n", ret);
 
     /* WM_SETTEXT handling in case of A/W dialog procedures vs A/W dialog window.  */
     ret = DialogBoxParamW(GetModuleHandleA(NULL), nameW, 0, test_aw_conversion_dlgproc, 0);
-    ok(ret == -123, "Unexpected ret value %ld.\n", ret);
+    ok(ret == -123, "Unexpected ret value %Id.\n", ret);
 
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc2, 0);
-    ok(ret == -123, "Unexpected ret value %ld.\n", ret);
+    ok(ret == -123, "Unexpected ret value %Id.\n", ret);
 
     ret = DialogBoxParamW(GetModuleHandleA(NULL), nameW, 0, test_aw_conversion_dlgproc3, 1);
-    ok(ret == -123, "Unexpected ret value %ld.\n", ret);
+    ok(ret == -123, "Unexpected ret value %Id.\n", ret);
 
     ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc3, 0);
-    ok(ret == -123, "Unexpected ret value %ld.\n", ret);
+    ok(ret == -123, "Unexpected ret value %Id.\n", ret);
 }
 
 static void test_DisabledDialogTest(void)
@@ -2011,12 +2012,12 @@ static void test_SaveRestoreFocus(void)
     ok (hDlg != 0, "Failed to create test dialog.\n");
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);
+    ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %Id\n", 1000, foundId);
 
     SetFocus(GetNextDlgTabItem(hDlg, GetFocus(), FALSE));
     SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
+    ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1001, foundId);
     SetFocus(GetNextDlgTabItem(hDlg, NULL, FALSE));
 
     /* de- then reactivate the dialog */
@@ -2024,38 +2025,38 @@ static void test_SaveRestoreFocus(void)
     SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1000, foundId);
+    ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1000, foundId);
 
     /* select the next tabbable item */
     SetFocus(GetNextDlgTabItem(hDlg, GetFocus(), FALSE));
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
+    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
 
     /* de- then reactivate the dialog */
     SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 0);
     SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
+    ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1001, foundId);
 
     /* set focus to the dialog */
     SetFocus(hDlg);
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %ld\n", 1000, foundId);
+    ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %Id\n", 1000, foundId);
 
     /* select second tabbable item */
     SetFocus(GetNextDlgTabItem(hDlg, GetNextDlgTabItem(hDlg, NULL, FALSE), FALSE));
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
+    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
 
     /* send WM_ACTIVATE message to already active dialog */
     SendMessageA(hDlg, WM_ACTIVATE, MAKEWPARAM(WA_ACTIVE, 0), 0);
 
     foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
-    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
+    ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
 
     /* disable the 2nd box */
     EnableWindow(GetFocus(), FALSE);
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index 777c50be337..eb65191d77d 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for edit control.
  *
  * Copyright 2004 Vitaliy Margolen
@@ -661,7 +662,7 @@ static void set_client_height(HWND Wnd, unsigned Height)
 
     GetClientRect(Wnd, &ClientRect);
     ok(ClientRect.bottom - ClientRect.top == Height,
-        "The client height should be %d, but is %d\n",
+        "The client height should be %d, but is %ld\n",
         Height, ClientRect.bottom - ClientRect.top);
 }
 
@@ -677,52 +678,52 @@ static void test_edit_control_1(void)
     trace("EDIT: Single line\n");
     hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = get_edit_style(hwEdit);
-    ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%x\n", r);
+    ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%lx\n", r);
     for (i=0;i<65535;i++)
     {
 	msMessage.wParam = i;
 	r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
 	ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS),
-            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
+            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
     }
     DestroyWindow (hwEdit);
 
     trace("EDIT: Single line want returns\n");
     hwEdit = create_editcontrol(ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = get_edit_style(hwEdit);
-    ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%x\n", r);
+    ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%lx\n", r);
     for (i=0;i<65535;i++)
     {
 	msMessage.wParam = i;
 	r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
 	ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS),
-            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
+            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
     }
     DestroyWindow (hwEdit);
 
     trace("EDIT: Multiline line\n");
     hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = get_edit_style(hwEdit);
-    ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%x\n", r);
+    ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%lx\n", r);
     for (i=0;i<65535;i++)
     {
 	msMessage.wParam = i;
 	r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
 	ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS),
-            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
+            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
     }
     DestroyWindow (hwEdit);
 
     trace("EDIT: Multi line want returns\n");
     hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = get_edit_style(hwEdit);
-    ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%x\n", r);
+    ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%lx\n", r);
     for (i=0;i<65535;i++)
     {
 	msMessage.wParam = i;
 	r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
 	ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS),
-            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
+            "Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
     }
     DestroyWindow (hwEdit);
 }
@@ -758,11 +759,11 @@ static void test_edit_control_2(void)
     trace("EDIT: SETTEXT atomicity\n");
     /* Send messages to "type" in the word 'foo'. */
     r = SendMessageA(hwndET2, WM_CHAR, 'f', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     /* 'foo' should have been changed to 'bar' by the UPDATE handler. */
     GetWindowTextA(hwndET2, szLocalString, MAXLEN);
     ok(strcmp(szLocalString, "bar")==0,
@@ -770,34 +771,34 @@ static void test_edit_control_2(void)
 
     /* try setting the caret before it's visible */
     r = SetCaretPos(0, 0);
-    todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %d\n", r);
+    todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %ld\n", r);
     phwnd = SetFocus(hwndET2);
     ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n");
     r = SetCaretPos(0, 0);
-    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
+    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
     r = GetCaretPos(&cpos);
-    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
-    ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%d,%d)\n", cpos.x, cpos.y);
+    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
+    ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%ld,%ld)\n", cpos.x, cpos.y);
     r = SetCaretPos(-1, -1);
-    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
+    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
     r = GetCaretPos(&cpos);
-    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
-    ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%d,%d)\n", cpos.x, cpos.y);
+    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
+    ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%ld,%ld)\n", cpos.x, cpos.y);
     r = SetCaretPos(w << 1, h << 1);
-    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
+    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
     r = GetCaretPos(&cpos);
-    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
-    ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w << 1, h << 1, cpos.x, cpos.y);
+    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
+    ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w << 1, h << 1, cpos.x, cpos.y);
     r = SetCaretPos(w, h);
-    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
+    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
     r = GetCaretPos(&cpos);
-    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
-    ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w, h, cpos.x, cpos.y);
+    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
+    ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w, h, cpos.x, cpos.y);
     r = SetCaretPos(w - 1, h - 1);
-    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
+    ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
     r = GetCaretPos(&cpos);
-    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
-    ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w - 1, h - 1, cpos.x, cpos.y);
+    ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
+    ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w - 1, h - 1, cpos.x, cpos.y);
 
     /* OK, done! */
     DestroyWindow (hwndET2);
@@ -1295,7 +1296,7 @@ static void test_edit_control_5(void)
     assert(hWnd);
     /* size of non-child edit control is (much) bigger than requested */
     GetWindowRect( hWnd, &rc);
-    ok( rc.right - rc.left > 20, "size of the window (%d) is smaller than expected\n",
+    ok( rc.right - rc.left > 20, "size of the window (%ld) is smaller than expected\n",
             rc.right - rc.left);
     DestroyWindow(hWnd);
     /* so create a parent, and give it edit controls children to test with */
@@ -1358,21 +1359,21 @@ static void test_edit_control_6(void)
     assert(hWnd);
 
     ret = SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str);
-    ok(ret == TRUE, "Expected %d, got %d\n", TRUE, ret);
+    ok(ret == TRUE, "Expected %d, got %ld\n", TRUE, ret);
     ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
-    ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
+    ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
     ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
     buf[0] = 0;
     ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
-    ok(ret == 0, "Expected 0, got %d\n", ret);
+    ok(ret == 0, "Expected 0, got %ld\n", ret);
     ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
-    ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
+    ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
     ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
     buf[0] = 0;
     ret = SendMessageA(hWnd, WM_NCDESTROY, 0, 0);
-    ok(ret == 0, "Expected 0, got %d\n", ret);
+    ok(ret == 0, "Expected 0, got %ld\n", ret);
     ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
-    ok(ret == 0, "Expected 0, got len %d\n", ret);
+    ok(ret == 0, "Expected 0, got len %ld\n", ret);
     ok(!strcmp(buf, ""), "Expected empty string, got %s\n", buf);
 
     DestroyWindow(hWnd);
@@ -1387,20 +1388,20 @@ static void test_edit_control_limittext(void)
     trace("EDIT: buffer limit for single-line\n");
     hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
-    ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
+    ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
     SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
     r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
-    ok( r == 2147483646, "got limit %u (expected 2147483646)\n", r);
+    ok( r == 2147483646, "got limit %lu (expected 2147483646)\n", r);
     DestroyWindow(hwEdit);
 
     /* Test default limit for multi-line control */
     trace("EDIT: buffer limit for multi-line\n");
     hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
     r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
-    ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
+    ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
     SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
     r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
-    ok( r == 4294967295U, "got limit %u (expected 4294967295)\n", r);
+    ok( r == 4294967295U, "got limit %lu (expected 4294967295)\n", r);
     DestroyWindow(hwEdit);
 }
 
@@ -1425,16 +1426,16 @@ static void test_edit_control_scroll(void)
     assert(hwEdit);
 
     ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
-    ok(!ret, "Returned %x, expected 0.\n", ret);
+    ok(!ret, "Returned %lx, expected 0.\n", ret);
 
     ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
-    ok(!ret, "Returned %x, expected 0.\n", ret);
+    ok(!ret, "Returned %lx, expected 0.\n", ret);
 
     ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEUP, 0);
-    ok(!ret, "Returned %x, expected 0.\n", ret);
+    ok(!ret, "Returned %lx, expected 0.\n", ret);
 
     ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
-    ok(!ret, "Returned %x, expected 0.\n", ret);
+    ok(!ret, "Returned %lx, expected 0.\n", ret);
 
     DestroyWindow (hwEdit);
 
@@ -1450,7 +1451,7 @@ static void test_edit_control_scroll(void)
     assert(hwEdit);
 
     ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
-    ok(!ret, "Returned %x, expected 0.\n", ret);
+    ok(!ret, "Returned %lx, expected 0.\n", ret);
 
     DestroyWindow (hwEdit);
 }
@@ -1757,16 +1758,16 @@ static LRESULT CALLBACK test_class_proc(HWND hwnd, UINT message, WPARAM wParam,
 
             memset(&rect, 0, sizeof(rect));
             SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rect);
-            ok(!rect.right && !rect.bottom, "Invalid size after NCCREATE: %d x %d\n", rect.right, rect.bottom);
+            ok(!rect.right && !rect.bottom, "Invalid size after NCCREATE: %ld x %ld\n", rect.right, rect.bottom);
 
             /* test that messages between WM_NCCREATE and WM_CREATE
                don't crash or cause unexpected behavior */
             r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
-            ok(r == 1, "Returned %ld, expected 1.\n", r);
+            ok(r == 1, "Returned %Id, expected 1.\n", r);
             r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
-            todo_wine ok(r == 1, "Returned %ld, expected 1.\n", r);
+            todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
             r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
-            ok(r == 1, "Returned %ld, expected 1.\n", r);
+            ok(r == 1, "Returned %Id, expected 1.\n", r);
 
             return result;
 
@@ -1774,11 +1775,11 @@ static LRESULT CALLBACK test_class_proc(HWND hwnd, UINT message, WPARAM wParam,
             /* test that messages between WM_NCCREATE and WM_CREATE
                don't crash or cause unexpected behavior */
             r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
-            ok(r == 1, "Returned %ld, expected 1.\n", r);
+            ok(r == 1, "Returned %Id, expected 1.\n", r);
             r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
-            todo_wine ok(r == 1, "Returned %ld, expected 1.\n", r);
+            todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
             r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
-            ok(r == 1, "Returned %ld, expected 1.\n", r);
+            ok(r == 1, "Returned %Id, expected 1.\n", r);
 
             break;
     }
@@ -2174,39 +2175,39 @@ static void test_espassword(void)
 
     hwEdit = create_editcontrol(ES_PASSWORD, 0);
     r = get_edit_style(hwEdit);
-    ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%x\n", r);
+    ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) password);
-    ok(r == TRUE, "Expected: %d, got: %d\n", TRUE, r);
+    ok(r == TRUE, "Expected: %d, got: %ld\n", TRUE, r);
 
     /* select all, cut (ctrl-x) */
     SendMessageA(hwEdit, EM_SETSEL, 0, -1);
     r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-    ok(r == strlen(password), "Expected: %s, got len %d\n", password, r);
+    ok(r == strlen(password), "Expected: %s, got len %ld\n", password, r);
     ok(strcmp(buffer, password) == 0, "expected %s, got %s\n", password, buffer);
 
     r = OpenClipboard(hwEdit);
-    ok(r == TRUE, "expected %d, got %d le=%u\n", TRUE, r, GetLastError());
+    ok(r == TRUE, "expected %d, got %ld le=%lu\n", TRUE, r, GetLastError());
     r = EmptyClipboard();
-    ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
+    ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
     r = CloseClipboard();
-    ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
+    ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
 
     /* select all, copy (ctrl-c) and paste (ctrl-v) */
     SendMessageA(hwEdit, EM_SETSEL, 0, -1);
     r = SendMessageA(hwEdit, WM_CHAR, 3, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     r = SendMessageA(hwEdit, WM_CHAR, 22, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-    ok(r == 0, "Expected: 0, got: %d\n", r);
+    ok(r == 0, "Expected: 0, got: %ld\n", r);
     ok(strcmp(buffer, "") == 0, "expected empty string, got %s\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2222,48 +2223,48 @@ static void test_undo(void)
 
     hwEdit = create_editcontrol(0, 0);
     r = get_edit_style(hwEdit);
-    ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
+    ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) text);
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     /* select all, */
     cpMin = cpMax = 0xdeadbeef;
     SendMessageA(hwEdit, EM_SETSEL, 0, -1);
     r = SendMessageA(hwEdit, EM_GETSEL, (WPARAM) &cpMin, (LPARAM) &cpMax);
-    ok((strlen(text) << 16) == r, "Unexpected length %d\n", r);
-    ok(0 == cpMin, "Expected: %d, got %d\n", 0, cpMin);
-    ok(9 == cpMax, "Expected: %d, got %d\n", 9, cpMax);
+    ok((strlen(text) << 16) == r, "Unexpected length %ld\n", r);
+    ok(0 == cpMin, "Expected: %d, got %ld\n", 0, cpMin);
+    ok(9 == cpMax, "Expected: %d, got %ld\n", 9, cpMax);
 
     /* cut (ctrl-x) */
     r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-    ok(0 == r, "Expected: %d, got len %d\n", 0, r);
+    ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
     ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
 
     /* undo (ctrl-z) */
     r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-    ok(strlen(text) == r, "Unexpected length %d\n", r);
+    ok(strlen(text) == r, "Unexpected length %ld\n", r);
     ok(0 == strcmp(buffer, text), "expected %s, got %s\n", text, buffer);
 
     /* undo again (ctrl-z) */
     r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
-    ok(r == 0, "Expected: %d, got len %d\n", 0, r);
+    ok(r == 0, "Expected: %d, got len %ld\n", 0, r);
     ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
 
     DestroyWindow (hwEdit);
@@ -2278,19 +2279,19 @@ static void test_enter(void)
     /* multiline */
     hwEdit = create_editcontrol(ES_MULTILINE, 0);
     r = get_edit_style(hwEdit);
-    ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%x\n", r);
+    ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
-    ok(2 == r, "Expected: %d, got len %d\n", 2, r);
+    ok(2 == r, "Expected: %d, got len %ld\n", 2, r);
     ok(0 == strcmp(buffer, "\r\n"), "expected \"\\r\\n\", got \"%s\"\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2298,19 +2299,19 @@ static void test_enter(void)
     /* single line */
     hwEdit = create_editcontrol(0, 0);
     r = get_edit_style(hwEdit);
-    ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
+    ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
-    ok(0 == r, "Expected: %d, got len %d\n", 0, r);
+    ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
     ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2318,19 +2319,19 @@ static void test_enter(void)
     /* single line with ES_WANTRETURN */
     hwEdit = create_editcontrol(ES_WANTRETURN, 0);
     r = get_edit_style(hwEdit);
-    ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%x\n", r);
+    ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%lx\n", r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
-    ok(0 == r, "Expected: %d, got len %d\n", 0, r);
+    ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
     ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2345,19 +2346,19 @@ static void test_tab(void)
     /* multiline */
     hwEdit = create_editcontrol(ES_MULTILINE, 0);
     r = get_edit_style(hwEdit);
-    ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%x\n", r);
+    ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
-    ok(1 == r, "Expected: %d, got len %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got len %ld\n", 1, r);
     ok(0 == strcmp(buffer, "\t"), "expected \"\\t\", got \"%s\"\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2365,19 +2366,19 @@ static void test_tab(void)
     /* single line */
     hwEdit = create_editcontrol(0, 0);
     r = get_edit_style(hwEdit);
-    ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
+    ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
 
     /* set text */
     r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
-    ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
+    ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
 
     r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     /* get text */
     buffer[0] = 0;
     r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
-    ok(0 == r, "Expected: %d, got len %d\n", 0, r);
+    ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
     ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
 
     DestroyWindow (hwEdit);
@@ -2819,11 +2820,11 @@ static void test_fontsize(void)
         ShowWindow (hwEdit, SW_SHOW);
 
     r = SendMessageA(hwEdit, WM_CHAR, 'A', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     r = SendMessageA(hwEdit, WM_CHAR, 'B', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
     r = SendMessageA(hwEdit, WM_CHAR, 'C', 1);
-    ok(1 == r, "Expected: %d, got: %d\n", 1, r);
+    ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
 
     GetWindowTextA(hwEdit, szLocalString, MAXLEN);
     ok(strcmp(szLocalString, "ABC")==0,
@@ -3009,7 +3010,7 @@ static void test_dialogmode(void)
 
     hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
         100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
-    ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
+    ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
 
     r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
     ok(1 == r, "expected 1, got %d\n", r);
@@ -3193,7 +3194,7 @@ static void test_paste(void)
     GlobalUnlock(hmem);
 
     r = OpenClipboard(hEdit);
-    ok(r == TRUE, "expected %d, got %d le=%u\n", TRUE, r, GetLastError());
+    ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
     r = EmptyClipboard();
     ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
     hmem_ret = SetClipboardData(CF_TEXT, hmem);
@@ -3216,7 +3217,7 @@ static void test_paste(void)
     GlobalUnlock(hmem);
 
     r = OpenClipboard(hEdit);
-    ok(r == TRUE, "expected %d, got %d le=%u\n", TRUE, r, GetLastError());
+    ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
     r = EmptyClipboard();
     ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
     hmem_ret = SetClipboardData(CF_TEXT, hmem);
@@ -3309,13 +3310,13 @@ static void test_wordbreak_proc(void)
     ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
 
     ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)test_wordbreak_procA);
-    ok(ret == 1, "Unexpected return value %ld.\n", ret);
+    ok(ret == 1, "Unexpected return value %Id.\n", ret);
 
     proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
     ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc);
 
     ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, 0);
-    ok(ret == 1, "Unexpected return value %ld.\n", ret);
+    ok(ret == 1, "Unexpected return value %Id.\n", ret);
 
     proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
     ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
diff --git a/dlls/user32/tests/generated.c b/dlls/user32/tests/generated.c
index 6b80ad8d6f0..a78e47d9e59 100644
--- a/dlls/user32/tests/generated.c
+++ b/dlls/user32/tests/generated.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* File generated automatically from tools/winapi/tests.dat; do not edit! */
 /* This file can be copied, modified and distributed without restriction. */
 
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 08323c4f40e..1a5bff4388b 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Test Key event to Key message translation
  *
  * Copyright 2003 Rein Klazes
@@ -266,13 +267,13 @@ static BOOL do_test( HWND hwnd, int seqnr, const KEV td[] )
             seqnr + 1, buf);
     while( PeekMessageA(&msg,hwnd,WM_KEYFIRST,WM_KEYLAST,PM_REMOVE) ) {
         if (winetest_debug > 1)
-            trace("message[%d] %-15s wParam %04lx lParam %08lx time %x\n", i,
+            trace("message[%d] %-15s wParam %04Ix lParam %08Ix time %lx\n", i,
                   MSGNAME[msg.message - WM_KEYFIRST], msg.wParam, msg.lParam, msg.time);
         if( i < kmctr ) {
             ok( msg.message == expmsg[i].message &&
                 msg.wParam == expmsg[i].wParam &&
                 msg.lParam == expmsg[i].lParam,
-                "%u/%u: wrong message %x/%08lx/%08lx expected %s/%08lx/%08lx\n",
+                "%u/%u: wrong message %x/%08Ix/%08Ix expected %s/%08Ix/%08Ix\n",
                 seqnr, i, msg.message, msg.wParam, msg.lParam,
                 MSGNAME[(expmsg[i]).message - WM_KEYFIRST], expmsg[i].wParam, expmsg[i].lParam );
         }
@@ -731,13 +732,13 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
         {
             failcount++;
             todo_wine {
-                ok(matched, "%2d (%x/%x): %02x from %02x -> %02x "
+                ok(matched, "%2d (%x/%lx): %02x from %02x -> %02x "
                    "instead of %02x -> %02x\n", id, test->wVk, test->dwFlags,
                    t->wVk, ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
                    ~t->before_state&0x80);
             }
         } else {
-            ok(matched || t->optional, "%2d (%x/%x): %02x from %02x -> %02x "
+            ok(matched || t->optional, "%2d (%x/%lx): %02x from %02x -> %02x "
                "instead of %02x -> %02x\n", id, test->wVk, test->dwFlags,
                t->wVk, ks1[t->wVk]&0x80, ks2[t->wVk]&0x80, t->before_state,
                ~t->before_state&0x80);
@@ -750,11 +751,11 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
         {
             failcount++;
             todo_wine
-                ok(FALSE, "%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
+                ok(FALSE, "%2d (%x/%lx): %02x from %02x -> %02x unexpected\n",
                    id, test->wVk, test->dwFlags, i, ks1[i], ks2[i]);
         }
         else
-            ok(ks2[i] == ks1[i], "%2d (%x/%x): %02x from %02x -> %02x unexpected\n",
+            ok(ks2[i] == ks1[i], "%2d (%x/%lx): %02x from %02x -> %02x unexpected\n",
                id, test->wVk, test->dwFlags, i, ks1[i], ks2[i]);
 
     while (expected->message && actual_cnt < sent_messages_cnt)
@@ -774,12 +775,12 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
                 {
                     failcount++;
                     todo_wine
-                        ok(FALSE, "%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+                        ok(FALSE, "%2d (%x/%lx): in msg 0x%04x expecting wParam 0x%Ix got 0x%Ix\n",
                            id, test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
                 }
                 else
                     ok(expected->wParam == actual->wParam,
-                       "%2d (%x/%x): in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+                       "%2d (%x/%lx): in msg 0x%04x expecting wParam 0x%Ix got 0x%Ix\n",
                        id, test->wVk, test->dwFlags, expected->message, expected->wParam, actual->wParam);
             }
             if (expected->flags & lparam)
@@ -788,16 +789,16 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
                 {
                     failcount++;
                     todo_wine
-                        ok(FALSE, "%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+                        ok(FALSE, "%2d (%x/%lx): in msg 0x%04x expecting lParam 0x%Ix got 0x%Ix\n",
                            id, test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
                 }
                 else
                     ok(expected->lParam == actual->lParam,
-                       "%2d (%x/%x): in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+                       "%2d (%x/%lx): in msg 0x%04x expecting lParam 0x%Ix got 0x%Ix\n",
                        id, test->wVk, test->dwFlags, expected->message, expected->lParam, actual->lParam);
             }
             ok((expected->flags & hook) == (actual->flags & hook),
-               "%2d (%x/%x): the msg 0x%04x should have been sent by a hook\n",
+               "%2d (%x/%lx): the msg 0x%04x should have been sent by a hook\n",
                id, test->wVk, test->dwFlags, expected->message);
 
         }
@@ -819,7 +820,7 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
                  (actual->message == expected->message - 4))
         {
             ok((expected->flags & hook) == (actual->flags & hook),
-               "%2d (%x/%x): the msg 0x%04x should have been sent by a hook\n",
+               "%2d (%x/%lx): the msg 0x%04x should have been sent by a hook\n",
                id, test->wVk, test->dwFlags, expected->message);
         }
         /* For VK_RMENU, at least localized Win2k/XP sends KEYDOWN/UP
@@ -829,7 +830,7 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
                  (actual->message == expected->message - 4))
         {
             ok(expected->wParam == actual->wParam && expected->lParam == actual->lParam,
-               "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
+               "%2d (%x/%lx): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
                id, test->wVk, test->dwFlags, expected->message, actual->message);
         }
         else if (test->_todo_wine)
@@ -837,12 +838,12 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
             failcount++;
             todo_wine
             ok(FALSE,
-               "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
+               "%2d (%x/%lx): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
                id, test->wVk, test->dwFlags, expected->message, actual->message);
         }
         else
             ok(FALSE,
-               "%2d (%x/%x): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
+               "%2d (%x/%lx): the msg 0x%04x was expected, but got msg 0x%04x instead\n",
                id, test->wVk, test->dwFlags, expected->message, actual->message);
 
         actual_cnt++;
@@ -859,17 +860,17 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
         {
             failcount++;
             todo_wine
-                ok(FALSE, "%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
+                ok(FALSE, "%2d (%x/%lx): the msg sequence is not complete: expected %04x - actual %04x\n",
                    id, test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
         }
         else
-            ok(FALSE, "%2d (%x/%x): the msg sequence is not complete: expected %04x - actual %04x\n",
+            ok(FALSE, "%2d (%x/%lx): the msg sequence is not complete: expected %04x - actual %04x\n",
                id, test->wVk, test->dwFlags, expected->message, sent_messages[actual_cnt].message);
     }
 
     if( test->_todo_wine && !failcount) /* succeeded yet marked todo */
         todo_wine
-            ok(TRUE, "%2d (%x/%x): marked \"todo_wine\" but succeeds\n", id, test->wVk, test->dwFlags);
+            ok(TRUE, "%2d (%x/%lx): marked \"todo_wine\" but succeeds\n", id, test->wVk, test->dwFlags);
 
     sent_messages_cnt = 0;
 }
@@ -878,7 +879,7 @@ static void compare_and_check(int id, BYTE *ks1, BYTE *ks2,
 static LRESULT CALLBACK WndProc2(HWND hWnd, UINT Msg, WPARAM wParam,
                                    LPARAM lParam)
 {
-    if (winetest_debug > 1) trace("MSG:  %8x W:%8lx L:%8lx\n", Msg, wParam, lParam);
+    if (winetest_debug > 1) trace("MSG:  %8x W:%8Ix L:%8Ix\n", Msg, wParam, lParam);
 
     if ((Msg >= WM_KEYFIRST && Msg <= WM_KEYLAST) || Msg == WM_SYSCOMMAND)
     {
@@ -912,13 +913,13 @@ static LRESULT CALLBACK hook_proc(int code, WPARAM wparam, LPARAM lparam)
 if(0) /* For some reason not stable on Wine */
 {
         if (wparam == WM_KEYDOWN || wparam == WM_SYSKEYDOWN)
-            ok(!(GetAsyncKeyState(hook_info->vkCode) & 0x8000), "key %x should be up\n", hook_info->vkCode);
+            ok(!(GetAsyncKeyState(hook_info->vkCode) & 0x8000), "key %lx should be up\n", hook_info->vkCode);
         else if (wparam == WM_KEYUP || wparam == WM_SYSKEYUP)
-            ok(GetAsyncKeyState(hook_info->vkCode) & 0x8000, "key %x should be down\n", hook_info->vkCode);
+            ok(GetAsyncKeyState(hook_info->vkCode) & 0x8000, "key %lx should be down\n", hook_info->vkCode);
 }
 
         if (winetest_debug > 1)
-            trace("Hook:   w=%lx vk:%8x sc:%8x fl:%8x %lx\n", wparam,
+            trace("Hook:   w=%Ix vk:%8lx sc:%8lx fl:%8lx %Ix\n", wparam,
                   hook_info->vkCode, hook_info->scanCode, hook_info->flags, hook_info->dwExtraInfo);
     }
     return CallNextHookEx( 0, code, wparam, lparam );
@@ -1023,12 +1024,12 @@ static void test_unicode_keys(HWND hwnd, HHOOK hook)
     }
     if(!key_status.sendinput_broken){
         ok(key_status.last_key_down == VK_PACKET,
-            "Last keydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_down);
+            "Last keydown msg should have been VK_PACKET[0x%04x] (was: 0x%lx)\n", VK_PACKET, key_status.last_key_down);
         ok(key_status.last_char == 0x3c0,
-            "Last char msg wparam should have been 0x3c0 (was: 0x%x)\n", key_status.last_char);
+            "Last char msg wparam should have been 0x3c0 (was: 0x%lx)\n", key_status.last_char);
         if(hook)
             ok(key_status.last_hook_down == 0x3c0,
-                "Last hookdown msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_down);
+                "Last hookdown msg should have been 0x3c0, was: 0x%lx\n", key_status.last_hook_down);
     }
 
     inputs[1].u.ki.wVk = 0;
@@ -1045,10 +1046,10 @@ static void test_unicode_keys(HWND hwnd, HHOOK hook)
     }
     if(!key_status.sendinput_broken){
         ok(key_status.last_key_up == VK_PACKET,
-            "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up);
+            "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%lx)\n", VK_PACKET, key_status.last_key_up);
         if(hook)
             ok(key_status.last_hook_up == 0x3c0,
-                "Last hookup msg should have been 0x3c0, was: 0x%x\n", key_status.last_hook_up);
+                "Last hookup msg should have been 0x3c0, was: 0x%lx\n", key_status.last_hook_up);
     }
 
     /* holding alt, pressing & releasing a unicode character, releasing alt */
@@ -1071,12 +1072,12 @@ static void test_unicode_keys(HWND hwnd, HHOOK hook)
     }
     if(!key_status.sendinput_broken){
         ok(key_status.last_syskey_down == VK_PACKET,
-            "Last syskeydown msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_syskey_down);
+            "Last syskeydown msg should have been VK_PACKET[0x%04x] (was: 0x%lx)\n", VK_PACKET, key_status.last_syskey_down);
         ok(key_status.last_syschar == 0x3041,
-            "Last syschar msg should have been 0x3041 (was: 0x%x)\n", key_status.last_syschar);
+            "Last syschar msg should have been 0x3041 (was: 0x%lx)\n", key_status.last_syschar);
         if(hook)
             ok(key_status.last_hook_syskey_down == 0x3041,
-                "Last hooksysdown msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_syskey_down);
+                "Last hooksysdown msg should have been 0x3041, was: 0x%lx\n", key_status.last_hook_syskey_down);
     }
 
     inputs[1].u.ki.wVk = 0;
@@ -1098,10 +1099,10 @@ static void test_unicode_keys(HWND hwnd, HHOOK hook)
     }
     if(!key_status.sendinput_broken){
         ok(key_status.last_key_up == VK_PACKET,
-            "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%x)\n", VK_PACKET, key_status.last_key_up);
+            "Last keyup msg should have been VK_PACKET[0x%04x] (was: 0x%lx)\n", VK_PACKET, key_status.last_key_up);
         if(hook)
             ok(key_status.last_hook_up == 0x3041,
-                "Last hook up msg should have been 0x3041, was: 0x%x\n", key_status.last_hook_up);
+                "Last hook up msg should have been 0x3041, was: 0x%lx\n", key_status.last_hook_up);
     }
 
     /* Press and release, non-zero key code. */
@@ -1123,11 +1124,11 @@ static void test_unicode_keys(HWND hwnd, HHOOK hook)
 
     if (!key_status.sendinput_broken)
     {
-        ok(key_status.last_key_down == 0x51, "Unexpected key down %#x.\n", key_status.last_key_down);
-        ok(key_status.last_key_up == 0x51, "Unexpected key up %#x.\n", key_status.last_key_up);
+        ok(key_status.last_key_down == 0x51, "Unexpected key down %#lx.\n", key_status.last_key_down);
+        ok(key_status.last_key_up == 0x51, "Unexpected key up %#lx.\n", key_status.last_key_up);
         if (hook)
             todo_wine
-            ok(key_status.last_hook_up == 0x23, "Unexpected hook message %#x.\n", key_status.last_hook_up);
+            ok(key_status.last_hook_up == 0x23, "Unexpected hook message %#lx.\n", key_status.last_hook_up);
     }
 }
 
@@ -1166,11 +1167,11 @@ static LRESULT CALLBACK llkbd_unicode_hook(int nCode, WPARAM wParam, LPARAM lPar
             win_skip("SendInput doesn't support unicode on this platform\n");
         }else{
             if(key_status.expect_alt){
-                ok(info->vkCode == VK_LMENU, "vkCode should have been VK_LMENU[0x%04x], was: 0x%x\n", VK_LMENU, info->vkCode);
+                ok(info->vkCode == VK_LMENU, "vkCode should have been VK_LMENU[0x%04x], was: 0x%lx\n", VK_LMENU, info->vkCode);
                 key_status.expect_alt = FALSE;
             }else
             todo_wine_if(key_status.vk != VK_PACKET)
-                ok(info->vkCode == key_status.vk, "Unexpected vkCode %#x, expected %#x.\n", info->vkCode, key_status.vk);
+                ok(info->vkCode == key_status.vk, "Unexpected vkCode %#lx, expected %#x.\n", info->vkCode, key_status.vk);
         }
         switch(wParam){
         case WM_KEYDOWN:
@@ -1290,7 +1291,7 @@ static LRESULT CALLBACK hook_proc1( int code, WPARAM wparam, LPARAM lparam )
         pt_new = hook->pt;
         /* Should return previous position */
         GetCursorPos(&pt);
-        ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%d,%d)\n", pt.x, pt.y);
+        ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%ld,%ld)\n", pt.x, pt.y);
 
         /* Should set new position until hook chain is finished. */
         pt.x = pt_old.x + STEP;
@@ -1298,9 +1299,9 @@ static LRESULT CALLBACK hook_proc1( int code, WPARAM wparam, LPARAM lparam )
         SetCursorPos(pt.x, pt.y);
         GetCursorPos(&pt1);
         if (clipped)
-            ok(pt1.x == pt_old.x && pt1.y == pt_old.y, "Wrong set pos: (%d,%d)\n", pt1.x, pt1.y);
+            ok(pt1.x == pt_old.x && pt1.y == pt_old.y, "Wrong set pos: (%ld,%ld)\n", pt1.x, pt1.y);
         else
-            ok(pt1.x == pt.x && pt1.y == pt.y, "Wrong set pos: (%d,%d)\n", pt1.x, pt1.y);
+            ok(pt1.x == pt.x && pt1.y == pt.y, "Wrong set pos: (%ld,%ld)\n", pt1.x, pt1.y);
     }
     return CallNextHookEx( 0, code, wparam, lparam );
 }
@@ -1313,14 +1314,14 @@ static LRESULT CALLBACK hook_proc2( int code, WPARAM wparam, LPARAM lparam )
     if (code == HC_ACTION)
     {
         ok(hook->pt.x == pt_new.x && hook->pt.y == pt_new.y,
-           "Wrong hook coords: (%d %d) != (%d,%d)\n", hook->pt.x, hook->pt.y, pt_new.x, pt_new.y);
+           "Wrong hook coords: (%ld %ld) != (%ld,%ld)\n", hook->pt.x, hook->pt.y, pt_new.x, pt_new.y);
 
         /* Should match position set above */
         GetCursorPos(&pt);
         if (clipped)
-            ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%d,%d)\n", pt.x, pt.y);
+            ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%ld,%ld)\n", pt.x, pt.y);
         else
-            ok(pt.x == pt_old.x +STEP && pt.y == pt_old.y +STEP, "GetCursorPos: (%d,%d)\n", pt.x, pt.y);
+            ok(pt.x == pt_old.x +STEP && pt.y == pt_old.y +STEP, "GetCursorPos: (%ld,%ld)\n", pt.x, pt.y);
     }
     return CallNextHookEx( 0, code, wparam, lparam );
 }
@@ -1333,7 +1334,7 @@ static LRESULT CALLBACK hook_proc3( int code, WPARAM wparam, LPARAM lparam )
     {
         /* MSLLHOOKSTRUCT does not seem to be reliable and contains different data on each run. */
         GetCursorPos(&pt);
-        ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%d,%d)\n", pt.x, pt.y);
+        ok(pt.x == pt_old.x && pt.y == pt_old.y, "GetCursorPos: (%ld,%ld)\n", pt.x, pt.y);
     }
     return CallNextHookEx( 0, code, wparam, lparam );
 }
@@ -1360,16 +1361,16 @@ static void test_mouse_ll_hook(void)
     GetCursorPos(&pt_old);
     mouse_event(MOUSEEVENTF_MOVE, -STEP,  0, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE, +STEP,  0, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE,  0, -STEP, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE,  0, +STEP, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == pt_new.x && pt_old.y == pt_new.y, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
 
     SetRect(&rc, 50, 50, 151, 151);
     ClipCursor(&rc);
@@ -1377,13 +1378,13 @@ static void test_mouse_ll_hook(void)
 
     SetCursorPos(40, 40);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 50 && pt_old.y == 50, "Wrong new pos: (%d,%d)\n", pt_new.x, pt_new.y);
+    ok(pt_old.x == 50 && pt_old.y == 50, "Wrong new pos: (%ld,%ld)\n", pt_new.x, pt_new.y);
     SetCursorPos(160, 160);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_new.x, pt_new.y);
+    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%ld,%ld)\n", pt_new.x, pt_new.y);
     mouse_event(MOUSEEVENTF_MOVE, +STEP, +STEP, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_new.x, pt_new.y);
+    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%ld,%ld)\n", pt_new.x, pt_new.y);
 
     clipped = FALSE;
     pt_new.x = pt_new.y = 150;
@@ -1398,17 +1399,17 @@ static void test_mouse_ll_hook(void)
     pt_old.y = pt_new.y - STEP;
     mouse_event(MOUSEEVENTF_LEFTUP, 123, 456, 0, 0);
     GetCursorPos(&pt);
-    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
+    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%ld,%ld)\n", pt.x, pt.y);
     mouse_event(MOUSEEVENTF_RIGHTUP, 456, 123, 0, 0);
     GetCursorPos(&pt);
-    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
+    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%ld,%ld)\n", pt.x, pt.y);
 
     mouse_event(MOUSEEVENTF_LEFTUP | MOUSEEVENTF_ABSOLUTE, 123, 456, 0, 0);
     GetCursorPos(&pt);
-    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
+    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%ld,%ld)\n", pt.x, pt.y);
     mouse_event(MOUSEEVENTF_RIGHTUP | MOUSEEVENTF_ABSOLUTE, 456, 123, 0, 0);
     GetCursorPos(&pt);
-    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%d,%d)\n", pt.x, pt.y);
+    ok(pt.x == pt_new.x && pt.y == pt_new.y, "Position changed: (%ld,%ld)\n", pt.x, pt.y);
 
     UnhookWindowsHookEx(hook2);
     hook1 = SetWindowsHookExA(WH_MOUSE_LL, hook_proc3, GetModuleHandleA(0), 0);
@@ -1419,27 +1420,27 @@ static void test_mouse_ll_hook(void)
 
     SetCursorPos(140, 140);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     SetCursorPos(160, 160);
     GetCursorPos(&pt_old);
     todo_wine
-    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE, -STEP, -STEP, 0, 0);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE, +STEP, +STEP, 0, 0);
     GetCursorPos(&pt_old);
     todo_wine
-    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, 0);
     GetCursorPos(&pt_old);
     ok((pt_old.x == 150 && pt_old.y == 150) ||
        broken(pt_old.x == 149 && pt_old.y == 149) /* w1064v1809 */,
-       "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+       "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     mouse_event(MOUSEEVENTF_MOVE, 0, 0, 0, 0);
     GetCursorPos(&pt_old);
     todo_wine
-    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
 
     clipped = FALSE;
     ClipCursor(NULL);
@@ -1448,7 +1449,7 @@ static void test_mouse_ll_hook(void)
     SetRect(&rc, 150, 150, 150, 150);
     ClipCursor(&rc);
     GetCursorPos(&pt_old);
-    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 150 && pt_old.y == 150, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     ClipCursor(NULL);
 
     SetCursorPos(160, 160);
@@ -1456,7 +1457,7 @@ static void test_mouse_ll_hook(void)
     ClipCursor(&rc);
     GetCursorPos(&pt_old);
     todo_wine
-    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     ClipCursor(NULL);
 
     SetCursorPos(150, 150);
@@ -1464,7 +1465,7 @@ static void test_mouse_ll_hook(void)
     ClipCursor(&rc);
     GetCursorPos(&pt_old);
     todo_wine
-    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%d,%d)\n", pt_old.x, pt_old.y);
+    ok(pt_old.x == 149 && pt_old.y == 149, "Wrong new pos: (%ld,%ld)\n", pt_old.x, pt_old.y);
     ClipCursor(NULL);
 
     UnhookWindowsHookEx(hook1);
@@ -1489,7 +1490,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
 
     /* Get a valid content for the input struct */
     if(!GetCursorPos(&point)) {
-        win_skip("GetCursorPos() failed with error %u\n", GetLastError());
+        win_skip("GetCursorPos() failed with error %lu\n", GetLastError());
         return;
     }
     memset(&in, 0, sizeof(MOUSEMOVEPOINT));
@@ -1509,19 +1510,19 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     }
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT)-1, &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT)+1, &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     /* test second and third parameter
      */
@@ -1529,25 +1530,25 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), NULL, out, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_NOACCESS || GetLastError() == MYERROR,
-       "expected error ERROR_NOACCESS, got %u\n", GetLastError());
+       "expected error ERROR_NOACCESS, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, NULL, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(ERROR_NOACCESS == GetLastError(),
-       "expected error ERROR_NOACCESS, got %u\n", GetLastError());
+       "expected error ERROR_NOACCESS, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), NULL, NULL, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(ERROR_NOACCESS == GetLastError(),
-       "expected error ERROR_NOACCESS, got %u\n", GetLastError());
+       "expected error ERROR_NOACCESS, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     count = 0;
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, NULL, count, GMMP_USE_DISPLAY_POINTS);
     if (retval == -1)
-        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %lu\n", GetLastError());
     else
         ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
 
@@ -1559,13 +1560,13 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, count, GMMP_USE_DISPLAY_POINTS);
     ok(retval == count, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     count = 0;
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, count, GMMP_USE_DISPLAY_POINTS);
     if (retval == -1)
-        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %lu\n", GetLastError());
     else
         ok(retval == count, "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
 
@@ -1573,7 +1574,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     count = BUFLIM;
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, count, GMMP_USE_DISPLAY_POINTS);
     if (retval == -1)
-        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %u\n", GetLastError());
+        ok(GetLastError() == ERROR_POINT_NOT_FOUND, "unexpected error %lu\n", GetLastError());
     else
         ok((0 <= retval) && (retval <= count), "expected GetMouseMovePointsEx to succeed, got %d\n", retval);
 
@@ -1581,7 +1582,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     /* it was not possible to force an error with the fifth parameter on win2k */
 
@@ -1590,25 +1591,25 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT)-1, NULL, out, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT)-1, &in, NULL, BUFLIM, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), NULL, out, BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(MYERROR);
     retval = pGetMouseMovePointsEx(sizeof(MOUSEMOVEPOINT), &in, NULL, BUFLIM+1, GMMP_USE_DISPLAY_POINTS);
     ok(retval == -1, "expected GetMouseMovePointsEx to fail, got %d\n", retval);
     ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == MYERROR,
-       "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     /* more than 64 to be sure we wrap around */
     for (i = 0; i < 67; i++)
@@ -1621,7 +1622,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     SetLastError( MYERROR );
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS );
     ok( retval == 64, "expected to get 64 mouse move points but got %d\n", retval );
-    ok( GetLastError() == MYERROR, "expected error to stay %x, got %x\n", MYERROR, GetLastError() );
+    ok( GetLastError() == MYERROR, "expected error to stay %x, got %lx\n", MYERROR, GetLastError() );
 
     for (i = 0; i < retval; i++)
     {
@@ -1635,7 +1636,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     SetLastError( MYERROR );
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS );
     ok( retval == -1, "expected to get -1 but got %d\n", retval );
-    ok( GetLastError() == ERROR_POINT_NOT_FOUND, "expected error to be set to %x, got %x\n", ERROR_POINT_NOT_FOUND, GetLastError() );
+    ok( GetLastError() == ERROR_POINT_NOT_FOUND, "expected error to be set to %x, got %lx\n", ERROR_POINT_NOT_FOUND, GetLastError() );
 
     /* make sure there's no deduplication */
     in.x = 6;
@@ -1677,7 +1678,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     in.y = point.y;
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS );
     ok( retval == 64, "expected to get 64 mouse move points but got %d\n", retval );
-    ok( out[0].dwExtraInfo == 0xcafecafe, "wrong extra info, got 0x%lx expected 0xcafecafe\n", out[0].dwExtraInfo );
+    ok( out[0].dwExtraInfo == 0xcafecafe, "wrong extra info, got 0x%Ix expected 0xcafecafe\n", out[0].dwExtraInfo );
 
     input.type = INPUT_MOUSE;
     memset( &input, 0, sizeof(input) );
@@ -1693,7 +1694,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     in.y = point.y;
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM, GMMP_USE_DISPLAY_POINTS );
     ok( retval == 64, "expected to get 64 mouse move points but got %d\n", retval );
-    ok( out[0].dwExtraInfo == 0xdeadbeef, "wrong extra info, got 0x%lx expected 0xdeadbeef\n", out[0].dwExtraInfo );
+    ok( out[0].dwExtraInfo == 0xdeadbeef, "wrong extra info, got 0x%Ix expected 0xdeadbeef\n", out[0].dwExtraInfo );
 
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, BUFLIM, GMMP_USE_HIGH_RESOLUTION_POINTS );
     todo_wine ok( retval == 64, "expected to get 64 high resolution mouse move points but got %d\n", retval );
@@ -1704,7 +1705,7 @@ static void test_GetMouseMovePointsEx(const char *argv0)
     startup_info.dwFlags = STARTF_USESHOWWINDOW;
     startup_info.wShowWindow = SW_SHOWNORMAL;
     retval = CreateProcessA(NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup_info, &process_info );
-    ok(retval, "CreateProcess \"%s\" failed err %u.\n", path, GetLastError());
+    ok(retval, "CreateProcess \"%s\" failed err %lu.\n", path, GetLastError());
     winetest_wait_child_process(process_info.hProcess);
     CloseHandle(process_info.hProcess);
     CloseHandle(process_info.hThread);
@@ -1733,9 +1734,9 @@ static void test_GetMouseMovePointsEx_process(void)
     ok( retval == 64, "expected to get 64 mouse move points but got %d\n", retval );
 
     desk0 = OpenInputDesktop( 0, FALSE, DESKTOP_ALL_ACCESS );
-    ok( desk0 != NULL, "OpenInputDesktop has failed with %d\n", GetLastError() );
+    ok( desk0 != NULL, "OpenInputDesktop has failed with %ld\n", GetLastError() );
     desk1 = CreateDesktopA( "getmousemovepointsex_test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
-    ok( desk1 != NULL, "CreateDesktopA failed with %d\n", GetLastError() );
+    ok( desk1 != NULL, "CreateDesktopA failed with %ld\n", GetLastError() );
 
     ok( SetThreadDesktop( desk1 ), "SetThreadDesktop failed!\n" );
     ok( SwitchDesktop( desk1 ), "SwitchDesktop failed\n" );
@@ -1765,9 +1766,9 @@ static void test_GetMouseMovePointsEx_process(void)
 
     /* non-default windowstations are non-interactive */
     winstation0 = GetProcessWindowStation();
-    ok( winstation0 != NULL, "GetProcessWindowStation has failed with %d\n", GetLastError() );
+    ok( winstation0 != NULL, "GetProcessWindowStation has failed with %ld\n", GetLastError() );
     desk0 = OpenInputDesktop( 0, FALSE, DESKTOP_ALL_ACCESS );
-    ok( desk0 != NULL, "OpenInputDesktop has failed with %d\n", GetLastError() );
+    ok( desk0 != NULL, "OpenInputDesktop has failed with %ld\n", GetLastError() );
     winstation1 = CreateWindowStationA( "test_winstation", 0, WINSTA_ALL_ACCESS, NULL );
 
     if (winstation1 == NULL && GetLastError() == ERROR_ACCESS_DENIED)
@@ -1778,17 +1779,17 @@ static void test_GetMouseMovePointsEx_process(void)
         return;
     }
 
-    ok( winstation1 != NULL, "CreateWindowStationA has failed with %d\n", GetLastError() );
+    ok( winstation1 != NULL, "CreateWindowStationA has failed with %ld\n", GetLastError() );
     ok( SetProcessWindowStation( winstation1 ), "SetProcessWindowStation has failed\n" );
 
     desk1 = CreateDesktopA( "getmousemovepointsex_test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
-    ok( desk1 != NULL, "CreateDesktopA failed with %d\n", GetLastError() );
+    ok( desk1 != NULL, "CreateDesktopA failed with %ld\n", GetLastError() );
     ok( SetThreadDesktop( desk1 ), "SetThreadDesktop failed!\n" );
 
     SetLastError( 0xDEADBEEF );
     retval = pGetMouseMovePointsEx( sizeof(MOUSEMOVEPOINT), &in, out, ARRAY_SIZE(out), GMMP_USE_DISPLAY_POINTS );
     todo_wine ok( retval == -1, "expected to get -1 mouse move points but got %d\n", retval );
-    todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "expected ERROR_ACCESS_DENIED got %d\n", GetLastError() );
+    todo_wine ok( GetLastError() == ERROR_ACCESS_DENIED, "expected ERROR_ACCESS_DENIED got %ld\n", GetLastError() );
 
     ok( SetProcessWindowStation( winstation0 ), "SetProcessWindowStation has failed\n" );
     ok( SetThreadDesktop( desk0 ), "SetThreadDesktop failed!\n" );
@@ -1809,13 +1810,13 @@ static void test_GetRawInputDeviceList(void)
     ret = pGetRawInputDeviceList(NULL, NULL, 0);
     err = GetLastError();
     ok(ret == -1, "expected -1, got %d\n", ret);
-    ok(err == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", err);
+    ok(err == ERROR_INVALID_PARAMETER, "expected 87, got %ld\n", err);
 
     SetLastError(0xdeadbeef);
     ret = pGetRawInputDeviceList(NULL, NULL, sizeof(devices[0]));
     err = GetLastError();
     ok(ret == -1, "expected -1, got %d\n", ret);
-    ok(err == ERROR_NOACCESS, "expected 998, got %d\n", err);
+    ok(err == ERROR_NOACCESS, "expected 998, got %ld\n", err);
 
     devcount = 0;
     ret = pGetRawInputDeviceList(NULL, &devcount, sizeof(devices[0]));
@@ -1827,7 +1828,7 @@ static void test_GetRawInputDeviceList(void)
     ret = pGetRawInputDeviceList(devices, &devcount, sizeof(devices[0]));
     err = GetLastError();
     ok(ret == -1, "expected -1, got %d\n", ret);
-    ok(err == ERROR_INSUFFICIENT_BUFFER, "expected 122, got %d\n", err);
+    ok(err == ERROR_INSUFFICIENT_BUFFER, "expected 122, got %ld\n", err);
     ok(devcount > 0, "expected non-zero\n");
 
     /* devcount contains now the correct number of devices */
@@ -1842,33 +1843,33 @@ static void test_GetRawInputDeviceList(void)
         SetLastError( 0xdeadbeef );
         ret = pGetRawInputDeviceInfoW( UlongToHandle( 0xdeadbeef ), RIDI_DEVICEINFO, NULL, NULL );
         ok( ret == ~0U, "GetRawInputDeviceInfoW returned %#x, expected ~0.\n", ret );
-        ok( GetLastError() == ERROR_NOACCESS, "GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.\n", GetLastError() );
+        ok( GetLastError() == ERROR_NOACCESS, "GetRawInputDeviceInfoW last error %#lx, expected 0xdeadbeef.\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         size = 0xdeadbeef;
         ret = pGetRawInputDeviceInfoW( UlongToHandle( 0xdeadbeef ), RIDI_DEVICEINFO, NULL, &size );
         ok( ret == ~0U, "GetRawInputDeviceInfoW returned %#x, expected ~0.\n", ret );
         ok( size == 0xdeadbeef, "GetRawInputDeviceInfoW returned size %#x, expected 0.\n", size );
-        ok( GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputDeviceInfoW last error %#lx, expected 0xdeadbeef.\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         size = 0xdeadbeef;
         ret = pGetRawInputDeviceInfoW( devices[0].hDevice, 0xdeadbeef, NULL, &size );
         ok( ret == ~0U, "GetRawInputDeviceInfoW returned %#x, expected ~0.\n", ret );
         ok( size == 0xdeadbeef, "GetRawInputDeviceInfoW returned size %#x, expected 0.\n", size );
-        ok( GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.\n", GetLastError() );
+        ok( GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputDeviceInfoW last error %#lx, expected 0xdeadbeef.\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         ret = pGetRawInputDeviceInfoW( devices[0].hDevice, RIDI_DEVICEINFO, &info, NULL );
         ok( ret == ~0U, "GetRawInputDeviceInfoW returned %#x, expected ~0.\n", ret );
-        ok( GetLastError() == ERROR_NOACCESS, "GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.\n", GetLastError() );
+        ok( GetLastError() == ERROR_NOACCESS, "GetRawInputDeviceInfoW last error %#lx, expected 0xdeadbeef.\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         size = 0;
         ret = pGetRawInputDeviceInfoW( devices[0].hDevice, RIDI_DEVICEINFO, &info, &size );
         ok( ret == ~0U, "GetRawInputDeviceInfoW returned %#x, expected ~0.\n", ret );
-        ok( size == sizeof(info), "GetRawInputDeviceInfoW returned size %#x, expected %#x.\n", size, sizeof(info) );
-        ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.\n", GetLastError() );
+        ok( size == sizeof(info), "GetRawInputDeviceInfoW returned size %#x, expected %#Ix.\n", size, sizeof(info) );
+        ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputDeviceInfoW last error %#lx, expected 0xdeadbeef.\n", GetLastError() );
     }
 
     for(i = 0; i < devcount; ++i)
@@ -1884,18 +1885,18 @@ static void test_GetRawInputDeviceList(void)
         name[0] = '\0';
         sz = 5;
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_DEVICENAME, name, &sz);
-        ok(ret == -1, "GetRawInputDeviceInfo gave wrong failure: %d\n", err);
+        ok(ret == -1, "GetRawInputDeviceInfo gave wrong failure: %ld\n", err);
         ok(sz > 5 && sz < ARRAY_SIZE(name), "Size should have been set and not too large (got: %u)\n", sz);
 
         /* buffer size for RIDI_DEVICENAME is in CHARs, not BYTEs */
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_DEVICENAME, name, &sz);
-        ok(ret == sz, "GetRawInputDeviceInfo gave wrong return: %d\n", err);
+        ok(ret == sz, "GetRawInputDeviceInfo gave wrong return: %ld\n", err);
         len = lstrlenW(name);
         ok(len + 1 == ret, "GetRawInputDeviceInfo returned wrong length (name: %u, ret: %u)\n", len + 1, ret);
 
         /* test A variant with same size */
         ret = pGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, nameA, &sz);
-        ok(ret == sz, "GetRawInputDeviceInfoA gave wrong return: %d\n", err);
+        ok(ret == sz, "GetRawInputDeviceInfoA gave wrong return: %ld\n", err);
         len = strlen(nameA);
         ok(len + 1 == ret, "GetRawInputDeviceInfoA returned wrong length (name: %u, ret: %u)\n", len + 1, ret);
 
@@ -1904,33 +1905,33 @@ static void test_GetRawInputDeviceList(void)
         info.cbSize = sizeof(info);
         sz = sizeof(info) - 1;
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_DEVICEINFO, &info, &sz);
-        ok(ret == -1, "GetRawInputDeviceInfo gave wrong failure: %d\n", err);
+        ok(ret == -1, "GetRawInputDeviceInfo gave wrong failure: %ld\n", err);
         ok(sz == sizeof(info), "GetRawInputDeviceInfo set wrong size\n");
 
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_DEVICEINFO, &info, &sz);
-        ok(ret == sizeof(info), "GetRawInputDeviceInfo gave wrong return: %d\n", err);
+        ok(ret == sizeof(info), "GetRawInputDeviceInfo gave wrong return: %ld\n", err);
         ok(sz == sizeof(info), "GetRawInputDeviceInfo set wrong size\n");
-        ok(info.dwType == devices[i].dwType, "GetRawInputDeviceInfo set wrong type: 0x%x\n", info.dwType);
+        ok(info.dwType == devices[i].dwType, "GetRawInputDeviceInfo set wrong type: 0x%lx\n", info.dwType);
 
         memset(&info, 0, sizeof(info));
         info.cbSize = sizeof(info);
         ret = pGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &info, &sz);
-        ok(ret == sizeof(info), "GetRawInputDeviceInfo gave wrong return: %d\n", err);
+        ok(ret == sizeof(info), "GetRawInputDeviceInfo gave wrong return: %ld\n", err);
         ok(sz == sizeof(info), "GetRawInputDeviceInfo set wrong size\n");
-        ok(info.dwType == devices[i].dwType, "GetRawInputDeviceInfo set wrong type: 0x%x\n", info.dwType);
+        ok(info.dwType == devices[i].dwType, "GetRawInputDeviceInfo set wrong type: 0x%lx\n", info.dwType);
 
         /* setupapi returns an NT device path, but CreateFile() < Vista can't
          * understand that; so use the \\?\ prefix instead */
         name[1] = '\\';
         file = CreateFileW(name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
-        ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u\n", wine_dbgstr_w(name), GetLastError());
+        ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %lu\n", wine_dbgstr_w(name), GetLastError());
 
         sz = 0;
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, NULL, &sz);
         ok(ret == 0, "GetRawInputDeviceInfo gave wrong return: %u\n", ret);
         ok((info.dwType == RIM_TYPEHID && sz != 0) ||
                 (info.dwType != RIM_TYPEHID && sz == 0),
-                "Got wrong PPD size for type 0x%x: %u\n", info.dwType, sz);
+                "Got wrong PPD size for type 0x%lx: %u\n", info.dwType, sz);
 
         ppd = HeapAlloc(GetProcessHeap(), 0, sz);
         ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, ppd, &sz);
@@ -1985,7 +1986,7 @@ static void test_GetRawInputData(void)
     SetLastError(0xdeadbeef);
     ret = GetRawInputData(NULL, RID_INPUT, NULL, &size, sizeof(RAWINPUTHEADER));
     ok(ret == ~0U, "Expect ret %u, got %u\n", ~0U, ret);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputData returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputData returned %08lx\n", GetLastError());
 }
 
 static void test_RegisterRawInputDevices(void)
@@ -2012,31 +2013,31 @@ static void test_RegisterRawInputDevices(void)
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0);
     ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(res == TRUE, "RegisterRawInputDevices failed\n");
-    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     count = GetRegisteredRawInputDevices(NULL, NULL, 0);
     ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     raw_devices_count = 0;
     count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, 0);
     ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
     ok(raw_devices_count == 0, "Unexpected registered devices count: %u\n", raw_devices_count);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     raw_devices_count = 0;
     count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(count == 0, "GetRegisteredRawInputDevices returned %u\n", count);
     ok(raw_devices_count == 2, "Unexpected registered devices count: %u\n", raw_devices_count);
-    ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     raw_devices_count = 0;
@@ -2047,7 +2048,7 @@ static void test_RegisterRawInputDevices(void)
     {
         ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
         ok(raw_devices_count == 0, "Unexpected registered devices count: %u\n", raw_devices_count);
-        ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+        ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
@@ -2055,7 +2056,7 @@ static void test_RegisterRawInputDevices(void)
     count = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
     ok(raw_devices_count == 2, "Unexpected registered devices count: %u\n", raw_devices_count);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     memset(raw_devices, 0, sizeof(raw_devices));
@@ -2063,7 +2064,7 @@ static void test_RegisterRawInputDevices(void)
     count = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(count == 2, "GetRegisteredRawInputDevices returned %u\n", count);
     ok(raw_devices_count == 2, "Unexpected registered devices count: %u\n", raw_devices_count);
-    ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08lx\n", GetLastError());
     ok(raw_devices[0].usUsagePage == 0x01, "Unexpected usage page: %x\n", raw_devices[0].usUsagePage);
     ok(raw_devices[0].usUsage == 0x04, "Unexpected usage: %x\n", raw_devices[0].usUsage);
     ok(raw_devices[1].usUsagePage == 0x01, "Unexpected usage page: %x\n", raw_devices[1].usUsagePage);
@@ -2078,7 +2079,7 @@ static void test_RegisterRawInputDevices(void)
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     raw_devices[0].hwndTarget = 0;
     raw_devices[1].hwndTarget = 0;
@@ -2086,7 +2087,7 @@ static void test_RegisterRawInputDevices(void)
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(res == TRUE, "RegisterRawInputDevices failed\n");
-    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
 
     /* RIDEV_INPUTSINK requires hwndTarget != NULL */
@@ -2098,7 +2099,7 @@ static void test_RegisterRawInputDevices(void)
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(res == FALSE, "RegisterRawInputDevices failed\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     raw_devices[0].hwndTarget = hwnd;
     raw_devices[1].hwndTarget = hwnd;
@@ -2106,7 +2107,7 @@ static void test_RegisterRawInputDevices(void)
     SetLastError(0xdeadbeef);
     res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(res == TRUE, "RegisterRawInputDevices succeeded\n");
-    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     DestroyWindow(hwnd);
 }
@@ -2196,31 +2197,31 @@ static LRESULT CALLBACK rawinputbuffer_wndproc(HWND hwnd, UINT msg, WPARAM wpara
             SetLastError(0xdeadbeef);
             count = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &ri, &size, 0);
             ok(count == ~0U, "GetRawInputData succeeded\n");
-            ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputData returned %08x\n", GetLastError());
+            ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputData returned %08lx\n", GetLastError());
 
             SetLastError(0xdeadbeef);
             size = 0;
             count = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER));
             ok(count == ~0U, "GetRawInputData succeeded\n");
-            ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputData returned %08x\n", GetLastError());
+            ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputData returned %08lx\n", GetLastError());
 
             SetLastError(0xdeadbeef);
             size = sizeof(ri);
             count = GetRawInputData((HRAWINPUT)lparam, 0, &ri, &size, sizeof(RAWINPUTHEADER));
             ok(count == ~0U, "GetRawInputData succeeded\n");
-            ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputData returned %08x\n", GetLastError());
+            ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputData returned %08lx\n", GetLastError());
 
             SetLastError(0xdeadbeef);
             size = sizeof(ri);
             count = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &ri, &size, sizeof(RAWINPUTHEADER));
             ok(count == sizeof(ri), "GetRawInputData failed\n");
-            ok(ri.data.mouse.lLastX == 6, "Unexpected rawinput data: %d\n", ri.data.mouse.lLastX);
-            ok(GetLastError() == 0xdeadbeef, "GetRawInputData returned %08x\n", GetLastError());
+            ok(ri.data.mouse.lLastX == 6, "Unexpected rawinput data: %ld\n", ri.data.mouse.lLastX);
+            ok(GetLastError() == 0xdeadbeef, "GetRawInputData returned %08lx\n", GetLastError());
         }
         else
         {
             ok(count == ~0U, "GetRawInputData succeeded\n");
-            ok(GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputData returned %08x\n", GetLastError());
+            ok(GetLastError() == ERROR_INVALID_HANDLE, "GetRawInputData returned %08lx\n", GetLastError());
         }
 
         return 0;
@@ -2243,7 +2244,7 @@ static void test_GetRawInputBuffer(void)
 
     SetCursorPos(300, 300);
     GetCursorPos(&pt);
-    ok(pt.x == 300 && pt.y == 300, "Unexpected cursor position pos %dx%d\n", pt.x, pt.y);
+    ok(pt.x == 300 && pt.y == 300, "Unexpected cursor position pos %ldx%ld\n", pt.x, pt.y);
 
     hwnd = CreateWindowA("static", "static", WS_VISIBLE | WS_POPUP,
                          100, 100, 100, 100, 0, NULL, NULL, NULL);
@@ -2259,12 +2260,12 @@ static void test_GetRawInputBuffer(void)
     SetLastError(0xdeadbeef);
     ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(ret, "RegisterRawInputDevices failed\n");
-    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     count = GetRawInputBuffer(NULL, NULL, sizeof(RAWINPUTHEADER));
     ok(count == ~0U, "GetRawInputBuffer succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08lx\n", GetLastError());
 
     size = sizeof(buffer);
     count = GetRawInputBuffer(NULL, &size, sizeof(RAWINPUTHEADER));
@@ -2280,7 +2281,7 @@ static void test_GetRawInputBuffer(void)
     size = sizeof(buffer);
     count = GetRawInputBuffer((RAWINPUT*)buffer, &size, 0);
     ok(count == ~0U, "GetRawInputBuffer succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08lx\n", GetLastError());
 
     size = sizeof(buffer);
     count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER));
@@ -2294,7 +2295,7 @@ static void test_GetRawInputBuffer(void)
     count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER));
     ok(count == ~0U, "GetRawInputBuffer succeeded\n");
     ok(size == rawinput_size, "GetRawInputBuffer returned unexpected size: %u\n", size);
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputBuffer returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputBuffer returned %08lx\n", GetLastError());
 
     size = 0;
     count = GetRawInputBuffer(NULL, &size, sizeof(RAWINPUTHEADER));
@@ -2305,7 +2306,7 @@ static void test_GetRawInputBuffer(void)
     size = sizeof(buffer);
     count = GetRawInputBuffer((RAWINPUT*)buffer, &size, 0);
     ok(count == ~0U, "GetRawInputBuffer succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned %08lx\n", GetLastError());
 
     size = sizeof(buffer);
     memset(buffer, 0, sizeof(buffer));
@@ -2324,7 +2325,7 @@ static void test_GetRawInputBuffer(void)
     memset(buffer, 0, sizeof(buffer));
     count = GetRawInputBuffer((RAWINPUT*)buffer, &size, sizeof(RAWINPUTHEADER));
     ok(count == ~0U, "GetRawInputBuffer succeeded\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputBuffer returned %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetRawInputBuffer returned %08lx\n", GetLastError());
     ok(rawinput_buffer_mouse_x(buffer, 0) == 5, "Unexpected rawinput data: %d\n", rawinput_buffer_mouse_x(buffer, 0));
 
     size = sizeof(buffer);
@@ -2346,7 +2347,7 @@ static void test_GetRawInputBuffer(void)
     SetLastError(0xdeadbeef);
     ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
     ok(ret, "RegisterRawInputDevices failed\n");
-    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08lx\n", GetLastError());
 
     DestroyWindow(hwnd);
 }
@@ -2364,7 +2365,7 @@ static LRESULT CALLBACK rawinput_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
     {
         todo_wine_if(rawinput_test_received_raw)
         ok(!rawinput_test_received_raw, "Unexpected spurious WM_INPUT message.\n");
-        ok(wparam == RIM_INPUT || wparam == RIM_INPUTSINK, "Unexpected wparam: %lu\n", wparam);
+        ok(wparam == RIM_INPUT || wparam == RIM_INPUTSINK, "Unexpected wparam: %Iu\n", wparam);
 
         rawinput_test_received_raw = TRUE;
         if (wparam == RIM_INPUT) rawinput_test_received_rawfg = TRUE;
@@ -2376,7 +2377,7 @@ static LRESULT CALLBACK rawinput_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA
         raw_size = sizeof(raw);
         ret = GetRawInputData((HRAWINPUT)lparam, RID_INPUT, &raw, &raw_size, sizeof(RAWINPUTHEADER));
         ok(ret > 0 && ret != (UINT)-1, "GetRawInputData failed\n");
-        ok(raw.header.dwType == RIM_TYPEMOUSE, "Unexpected rawinput type: %u\n", raw.header.dwType);
+        ok(raw.header.dwType == RIM_TYPEMOUSE, "Unexpected rawinput type: %lu\n", raw.header.dwType);
 
         ok(!(raw.data.mouse.usFlags & MOUSE_MOVE_ABSOLUTE), "Unexpected absolute rawinput motion\n");
         ok(!(raw.data.mouse.usFlags & MOUSE_VIRTUAL_DESKTOP), "Unexpected virtual desktop rawinput motion\n");
@@ -2441,13 +2442,13 @@ static void rawinput_test_process(void)
     int i;
 
     ready = OpenEventA(EVENT_ALL_ACCESS, FALSE, "rawinput_test_process_ready");
-    ok(ready != 0, "OpenEventA failed, error: %u\n", GetLastError());
+    ok(ready != 0, "OpenEventA failed, error: %lu\n", GetLastError());
 
     start = OpenEventA(EVENT_ALL_ACCESS, FALSE, "rawinput_test_process_start");
-    ok(start != 0, "OpenEventA failed, error: %u\n", GetLastError());
+    ok(start != 0, "OpenEventA failed, error: %lu\n", GetLastError());
 
     done = OpenEventA(EVENT_ALL_ACCESS, FALSE, "rawinput_test_process_done");
-    ok(done != 0, "OpenEventA failed, error: %u\n", GetLastError());
+    ok(done != 0, "OpenEventA failed, error: %lu\n", GetLastError());
 
     for (i = 0; i < ARRAY_SIZE(rawinput_tests); ++i)
     {
@@ -2491,7 +2492,7 @@ static void rawinput_test_process(void)
                 SetLastError(0xdeadbeef);
                 ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
                 ok(ret, "%d: RegisterRawInputDevices failed\n", i);
-                ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08x\n", i, GetLastError());
+                ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08lx\n", i, GetLastError());
             }
 
             rawinput_test_received_legacy = FALSE;
@@ -2525,7 +2526,7 @@ static void rawinput_test_process(void)
             SetLastError(0xdeadbeef);
             ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
             ok(ret, "%d: RegisterRawInputDevices failed\n", i);
-            ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08x\n", i, GetLastError());
+            ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08lx\n", i, GetLastError());
         }
 
         if (hwnd) DestroyWindow(hwnd);
@@ -2595,7 +2596,7 @@ static DWORD WINAPI rawinput_test_desk_thread(void *arg)
             SetLastError(0xdeadbeef);
             ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
             ok(ret, "%d: RegisterRawInputDevices failed\n", i);
-            ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08x\n", i, GetLastError());
+            ok(GetLastError() == 0xdeadbeef, "%d: RegisterRawInputDevices returned %08lx\n", i, GetLastError());
             break;
         }
 
@@ -2678,7 +2679,7 @@ static void test_rawinput(const char* argv0)
     int i;
 
     params.desk = CreateDesktopA( "rawinput_test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
-    ok( params.desk != NULL, "CreateDesktopA failed, last error: %u\n", GetLastError() );
+    ok( params.desk != NULL, "CreateDesktopA failed, last error: %lu\n", GetLastError() );
 
     params.ready = CreateEventA(NULL, FALSE, FALSE, NULL);
     ok(params.ready != NULL, "CreateEvent failed\n");
@@ -2708,7 +2709,7 @@ static void test_rawinput(const char* argv0)
 
     sprintf(path, "%s input rawinput_test", argv0);
     ret = CreateProcessA(NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup_info, &process_info );
-    ok(ret, "CreateProcess \"%s\" failed err %u.\n", path, GetLastError());
+    ok(ret, "CreateProcess \"%s\" failed err %lu.\n", path, GetLastError());
 
     SetCursorPos(100, 100);
     empty_message_queue();
@@ -2750,7 +2751,7 @@ static void test_rawinput(const char* argv0)
             if (rawinput_tests[i].register_flags == RIDEV_EXINPUTSINK && skipped)
                 win_skip("RIDEV_EXINPUTSINK not supported\n");
             else
-                ok(!skipped, "%d: RegisterRawInputDevices failed: %u\n", i, GetLastError());
+                ok(!skipped, "%d: RegisterRawInputDevices failed: %lu\n", i, GetLastError());
         }
 
         SetEvent(params.ready);
@@ -2810,7 +2811,7 @@ static void test_rawinput(const char* argv0)
 
             SetLastError(0xdeadbeef);
             ret = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
-            ok(ret, "%d: RegisterRawInputDevices failed: %u\n", i, GetLastError());
+            ok(ret, "%d: RegisterRawInputDevices failed: %lu\n", i, GetLastError());
         }
 
         DestroyWindow(hwnd);
@@ -3093,7 +3094,7 @@ static void test_keyboard_layout_name(void)
     SetLastError(0xdeadbeef);
     ret = GetKeyboardLayoutNameW(NULL);
     ok(!ret, "got %d\n", ret);
-    ok(GetLastError() == ERROR_NOACCESS, "got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_NOACCESS, "got %ld\n", GetLastError());
 
     layout = GetKeyboardLayout(0);
 
@@ -3122,8 +3123,8 @@ static void test_keyboard_layout_name(void)
             layouts_preload[i - 1] = UlongToHandle( wcstoul( klid, NULL, 16 ) );
 
             id = (DWORD_PTR)layouts_preload[i - 1];
-            if (id & 0x80000000) todo_wine_if(HIWORD(id) == 0xe001) ok((id & 0xf0000000) == 0xd0000000, "Unexpected preloaded keyboard layout high bits %#x\n", id);
-            else ok(!(id & 0xf0000000), "Unexpected preloaded keyboard layout high bits %#x\n", id);
+            if (id & 0x80000000) todo_wine_if(HIWORD(id) == 0xe001) ok((id & 0xf0000000) == 0xd0000000, "Unexpected preloaded keyboard layout high bits %#lx\n", id);
+            else ok(!(id & 0xf0000000), "Unexpected preloaded keyboard layout high bits %#lx\n", id);
         }
 
         ok(i <= len, "Unexpected keyboard count %d in preload list\n", i);
@@ -3143,12 +3144,12 @@ static void test_keyboard_layout_name(void)
 
                 /* Substitute should contain the keyboard layout id, not the HKL high word */
                 id = (DWORD_PTR)layouts_preload[i];
-                ok(!(id & 0xf0000000), "Unexpected substitute keyboard layout high bits %#x\n", id);
+                ok(!(id & 0xf0000000), "Unexpected substitute keyboard layout high bits %#lx\n", id);
             }
             else
             {
                 id = (DWORD_PTR)layouts_preload[i];
-                ok(!(id & 0xf0000000), "Unexpected preloaded keyboard layout high bits %#x\n", id);
+                ok(!(id & 0xf0000000), "Unexpected preloaded keyboard layout high bits %#lx\n", id);
             }
         }
 
@@ -3170,14 +3171,14 @@ static void test_keyboard_layout_name(void)
 
         if (id & 0x80000000)
         {
-            todo_wine ok((id >> 28) == 0xf, "hkl high bits %#x, expected 0xf\n", id >> 28);
+            todo_wine ok((id >> 28) == 0xf, "hkl high bits %#lx, expected 0xf\n", id >> 28);
 
             value_size = sizeof(value);
             wcscpy(layout_path, L"System\\CurrentControlSet\\Control\\Keyboard Layouts\\");
             wcscat(layout_path, klid);
             status = RegGetValueW(HKEY_LOCAL_MACHINE, layout_path, L"Layout Id", RRF_RT_REG_SZ, NULL, (void *)&value, &value_size);
-            todo_wine ok(!status, "RegGetValueW returned %x\n", status);
-            ok(value_size == 5 * sizeof(WCHAR), "RegGetValueW returned size %d\n", value_size);
+            todo_wine ok(!status, "RegGetValueW returned %lx\n", status);
+            ok(value_size == 5 * sizeof(WCHAR), "RegGetValueW returned size %ld\n", value_size);
 
             swprintf(tmpklid, KL_NAMELENGTH, L"%04X", (id >> 16) & 0x0fff);
             todo_wine ok(!wcsicmp(value, tmpklid), "RegGetValueW returned %s, expected %s\n", debugstr_w(value), debugstr_w(tmpklid));
@@ -3347,7 +3348,7 @@ static LRESULT CALLBACK mouse_move_wndproc(HWND hwnd, UINT msg, WPARAM wparam, L
         POINT pt = {LOWORD(lparam), HIWORD(lparam)};
         MapWindowPoints(hwnd, NULL, &pt, 1);
 
-        if (pt.x != last_x) ok( pt.x == expect_x, "got unexpected WM_MOUSEMOVE x %d, expected %d\n", pt.x, expect_x );
+        if (pt.x != last_x) ok( pt.x == expect_x, "got unexpected WM_MOUSEMOVE x %ld, expected %ld\n", pt.x, expect_x );
 
         expect_x = pt.x == 200 ? 210 : 200;
         last_x = pt.x;
@@ -3370,12 +3371,12 @@ static void test_Input_mouse(void)
     SetLastError(0xdeadbeef);
     ret = GetCursorPos(NULL);
     ok(!ret, "GetCursorPos succeed\n");
-    ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_NOACCESS, "error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef || GetLastError() == ERROR_NOACCESS, "error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetCursorPos(&pt_org);
     ok(ret, "GetCursorPos failed\n");
-    ok(GetLastError() == 0xdeadbeef, "error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "error %lu\n", GetLastError());
 
     button_win = CreateWindowA("button", "button", WS_VISIBLE | WS_POPUP,
             100, 100, 100, 100, 0, NULL, NULL, NULL);
@@ -3586,7 +3587,7 @@ static void test_Input_mouse(void)
     SetCursorPos(200, 200);
     hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                          100, 100, 200, 200, NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowA failed %u\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowA failed %lu\n", GetLastError());
 
     /* warm up test case by moving cursor and window a bit first */
     SetCursorPos(210, 200);
@@ -3601,13 +3602,13 @@ static void test_Input_mouse(void)
     SetWindowPos(hwnd, NULL, 110, 100, 0, 0, SWP_NOSIZE);
     empty_message_queue();
     GetCursorPos(&pt);
-    ok(pt.x == 210 && pt.y == 200, "GetCursorPos returned %dx%d, expected 210x200\n", pt.x, pt.y);
+    ok(pt.x == 210 && pt.y == 200, "GetCursorPos returned %ldx%ld, expected 210x200\n", pt.x, pt.y);
 
     SetCursorPos(200, 200);
     SetWindowPos(hwnd, NULL, 100, 100, 0, 0, SWP_NOSIZE);
     empty_message_queue();
     GetCursorPos(&pt);
-    ok(pt.x == 200 && pt.y == 200, "GetCursorPos returned %dx%d, expected 200x200\n", pt.x, pt.y);
+    ok(pt.x == 200 && pt.y == 200, "GetCursorPos returned %ldx%ld, expected 200x200\n", pt.x, pt.y);
 
     SetCursorPos(pt_org.x, pt_org.y);
     empty_message_queue();
@@ -3652,13 +3653,13 @@ static DWORD WINAPI thread_proc(void *param)
     if (wnd_event->attach_from)
     {
         ret = AttachThreadInput(wnd_event->attach_from, GetCurrentThreadId(), TRUE);
-        ok(ret, "AttachThreadInput error %d\n", GetLastError());
+        ok(ret, "AttachThreadInput error %ld\n", GetLastError());
     }
 
     if (wnd_event->attach_to)
     {
         ret = AttachThreadInput(GetCurrentThreadId(), wnd_event->attach_to, TRUE);
-        ok(ret, "AttachThreadInput error %d\n", GetLastError());
+        ok(ret, "AttachThreadInput error %ld\n", GetLastError());
     }
 
     wnd_event->hwnd = CreateWindowExA(0, "TestWindowClass", "window caption text", WS_OVERLAPPEDWINDOW,
@@ -3714,7 +3715,7 @@ static void test_attach_input(void)
     }
 
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(wnd_event.start_event);
@@ -3731,7 +3732,7 @@ static void test_attach_input(void)
     SetActiveWindow(ourWnd);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == ourWnd, "expected active %p, got %p\n", ourWnd, GetActiveWindow());
     ok(GetFocus() == ourWnd, "expected focus %p, got %p\n", ourWnd, GetFocus());
@@ -3739,14 +3740,14 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)ourWnd);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
     ok(GetActiveWindow() == ourWnd, "expected active %p, got %p\n", ourWnd, GetActiveWindow());
     ok(GetFocus() == ourWnd, "expected focus %p, got %p\n", ourWnd, GetFocus());
 
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, 0);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == ourWnd, "expected active %p, got %p\n", ourWnd, GetActiveWindow());
     ok(GetFocus() == ourWnd, "expected focus %p, got %p\n", ourWnd, GetFocus());
@@ -3760,14 +3761,14 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)Wnd2);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
     ok(GetActiveWindow() == Wnd2, "expected active %p, got %p\n", Wnd2, GetActiveWindow());
     ok(GetFocus() == Wnd2, "expected focus %p, got %p\n", Wnd2, GetFocus());
 
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, 0);
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
@@ -3779,7 +3780,7 @@ static void test_attach_input(void)
     wnd_event.setWindows = TRUE;
 
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(wnd_event.start_event);
@@ -3788,7 +3789,7 @@ static void test_attach_input(void)
     SetActiveWindow(ourWnd);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == wnd_event.hwnd, "expected active %p, got %p\n", wnd_event.hwnd, GetActiveWindow());
     ok(GetFocus() == wnd_event.hwnd, "expected focus %p, got %p\n", wnd_event.hwnd, GetFocus());
@@ -3796,7 +3797,7 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)wnd_event.hwnd);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == 0, "expected active 0, got %p\n", GetActiveWindow());
     ok(GetFocus() == 0, "expected focus 0, got %p\n", GetFocus());
@@ -3804,7 +3805,7 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)wnd_event.hwnd);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == wnd_event.hwnd, "expected active %p, got %p\n", wnd_event.hwnd, GetActiveWindow());
     ok(GetFocus() == wnd_event.hwnd, "expected focus %p, got %p\n", wnd_event.hwnd, GetFocus());
@@ -3819,7 +3820,7 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, (LPARAM)Wnd2);
 
     ret = AttachThreadInput(GetCurrentThreadId(), tid, FALSE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == Wnd2, "expected active %p, got %p\n", Wnd2, GetActiveWindow());
     ok(GetFocus() == Wnd2, "expected focus %p, got %p\n", Wnd2, GetFocus());
@@ -3827,7 +3828,7 @@ static void test_attach_input(void)
     SendMessageA(wnd_event.hwnd, WM_USER+1, 0, 0);
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
@@ -3839,19 +3840,19 @@ static void test_attach_input(void)
     wnd_event.setWindows = TRUE;
 
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
     ok(!ret, "AttachThreadInput succeeded\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef) /* <= Win XP */,
-       "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AttachThreadInput(tid, GetCurrentThreadId(), TRUE);
     ok(!ret, "AttachThreadInput succeeded\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef) /* <= Win XP */,
-       "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     SetEvent(wnd_event.wait_event);
 
@@ -3859,7 +3860,7 @@ static void test_attach_input(void)
     CloseHandle(wnd_event.start_event);
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
@@ -3874,7 +3875,7 @@ static void test_attach_input(void)
     SetActiveWindow(ourWnd);
 
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(wnd_event.start_event);
@@ -3883,7 +3884,7 @@ static void test_attach_input(void)
     ok(GetFocus() == ourWnd, "expected focus %p, got %p\n", ourWnd, GetFocus());
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
@@ -3898,7 +3899,7 @@ static void test_attach_input(void)
     SetActiveWindow(ourWnd);
 
     hThread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(wnd_event.start_event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(wnd_event.start_event);
@@ -3907,7 +3908,7 @@ static void test_attach_input(void)
     ok(GetFocus() == ourWnd, "expected focus %p, got %p\n", ourWnd, GetFocus());
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessageA(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessageA(WM_QUIT) error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hThread);
@@ -3969,14 +3970,14 @@ static void check_get_keyboard_state_(int i, int j, int c, int x, int todo_c, in
 
     memset(keystate, 0, sizeof(keystate));
     ret = GetKeyboardState(keystate);
-    ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
+    ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
     todo_wine_if(todo_x) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset");
     todo_wine_if(todo_c) ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
 
     /* calling it twice shouldn't change */
     memset(keystate, 0, sizeof(keystate));
     ret = GetKeyboardState(keystate);
-    ok_(__FILE__, line)(ret, "GetKeyboardState failed, %u\n", GetLastError());
+    ok_(__FILE__, line)(ret, "GetKeyboardState failed, %lu\n", GetLastError());
     todo_wine_if(todo_x) ok_(__FILE__, line)(!(keystate['X'] & 0x80) == !x, "%d:%d: expected that X keystate is %s\n", i, j, x ? "set" : "unset");
     todo_wine_if(todo_c) ok_(__FILE__, line)(!(keystate['C'] & 0x80) == !c, "%d:%d: expected that C keystate is %s\n", i, j, c ? "set" : "unset");
 }
@@ -4021,7 +4022,7 @@ static DWORD WINAPI get_key_state_thread(void *arg)
         /* initialization */
         ReleaseSemaphore(semaphores[0], 1, NULL);
         result = WaitForSingleObject(semaphores[1], 1000);
-        ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+        ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %lu\n", i, j, result);
 
         if (test->set_keyboard_state)
         {
@@ -4032,7 +4033,7 @@ static DWORD WINAPI get_key_state_thread(void *arg)
         /* key pressed */
         ReleaseSemaphore(semaphores[0], 1, NULL);
         result = WaitForSingleObject(semaphores[1], 1000);
-        ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+        ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %lu\n", i, j, result);
 
         if (test->set_keyboard_state) expect_x = TRUE;
         else if (!has_queue && j == 0) expect_x = FALSE;
@@ -4048,7 +4049,7 @@ static DWORD WINAPI get_key_state_thread(void *arg)
         /* key released */
         ReleaseSemaphore(semaphores[0], 1, NULL);
         result = WaitForSingleObject(semaphores[1], 1000);
-        ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %u\n", i, result);
+        ok(result == WAIT_OBJECT_0, "%d: WaitForSingleObject returned %lu\n", i, result);
 
         check_get_keyboard_state(i, j, expect_c, expect_x, /* todo */ i == 6, has_queue || i == 6 || j > 0);
         check_get_key_state(i, j, expect_c, FALSE, /* todo */ i == 6, FALSE);
@@ -4078,13 +4079,13 @@ static void test_GetKeyState(void)
 
     memset(keystate, 0, sizeof(keystate));
     params.semaphores[0] = CreateSemaphoreA(NULL, 0, 1, NULL);
-    ok(params.semaphores[0] != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+    ok(params.semaphores[0] != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
     params.semaphores[1] = CreateSemaphoreA(NULL, 0, 1, NULL);
-    ok(params.semaphores[1] != NULL, "CreateSemaphoreA failed %u\n", GetLastError());
+    ok(params.semaphores[1] != NULL, "CreateSemaphoreA failed %lu\n", GetLastError());
 
     hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                          10, 10, 200, 200, NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowA failed %u\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowA failed %lu\n", GetLastError());
     empty_message_queue();
 
     for (i = 0; i < ARRAY_SIZE(get_key_state_tests); ++i)
@@ -4093,13 +4094,13 @@ static void test_GetKeyState(void)
 
         params.index = i;
         thread = CreateThread(NULL, 0, get_key_state_thread, &params, 0, NULL);
-        ok(thread != NULL, "CreateThread failed %u\n", GetLastError());
+        ok(thread != NULL, "CreateThread failed %lu\n", GetLastError());
 
         for (j = 0; j < 4; ++j)
         {
             /* initialization */
             result = WaitForSingleObject(params.semaphores[0], 1000);
-            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %lu\n", i, j, result);
 
             SetForegroundWindow(hwnd);
             SetFocus(hwnd);
@@ -4109,7 +4110,7 @@ static void test_GetKeyState(void)
 
             /* key pressed */
             result = WaitForSingleObject(params.semaphores[0], 1000);
-            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %lu\n", i, j, result);
 
             keybd_event('X', 0, 0, 0);
             if (test->set_keyboard_state_main)
@@ -4137,7 +4138,7 @@ static void test_GetKeyState(void)
 
             /* key released */
             result = WaitForSingleObject(params.semaphores[0], 1000);
-            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %u\n", i, j, result);
+            ok(result == WAIT_OBJECT_0, "%d:%d: WaitForSingleObject returned %lu\n", i, j, result);
 
             keybd_event('X', 0, KEYEVENTF_KEYUP, 0);
             if (test->set_keyboard_state_main)
@@ -4161,7 +4162,7 @@ static void test_GetKeyState(void)
         }
 
         result = WaitForSingleObject(thread, 1000);
-        ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
+        ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
         CloseHandle(thread);
     }
 
@@ -4207,7 +4208,7 @@ static void test_OemKeyScan(void)
                 expect = vkey | scan;
             }
         }
-        ok( ret == expect, "%04x: got %08x expected %08x\n", oem, ret, expect );
+        ok( ret == expect, "%04x: got %08lx expected %08lx\n", oem, ret, expect );
     }
 }
 
@@ -4350,19 +4351,19 @@ static void test_GetPointerType(void)
     ret = pGetPointerType(id, NULL);
     ok(!ret, "GetPointerType should have failed.\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "expected error ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
+       "expected error ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = pGetPointerType(id, &type);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "expected error ERROR_INVALID_PARAMETER, got %u.\n", GetLastError());
-    ok(!ret, "GetPointerType failed, got type %d for %u.\n", type, id );
-    ok(type == -1, " type %d\n", type );
+       "expected error ERROR_INVALID_PARAMETER, got %lu.\n", GetLastError());
+    ok(!ret, "GetPointerType failed, got type %ld for %u.\n", type, id );
+    ok(type == -1, " type %ld\n", type );
 
     id = 1;
     ret = pGetPointerType(id, &type);
-    ok(ret, "GetPointerType failed, got type %d for %u.\n", type, id );
-    ok(type == PT_MOUSE, " type %d\n", type );
+    ok(ret, "GetPointerType failed, got type %ld for %u.\n", type, id );
+    ok(type == PT_MOUSE, " type %ld\n", type );
 }
 
 static void test_UnregisterDeviceNotification(void)
@@ -4389,52 +4390,52 @@ static void test_SendInput(void)
 
     SetLastError( 0xdeadbeef );
     res = SendInput( 0, NULL, 0 );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, NULL, 0 );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, NULL, sizeof(*input) );
     ok( res == 0 && (GetLastError() == ERROR_NOACCESS || GetLastError() == ERROR_INVALID_PARAMETER),
-        "SendInput returned %u, error %#x\n", res, GetLastError() );
+        "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 0, input, sizeof(*input) );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 0, NULL, sizeof(*input) );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
 
     memset( input, 0, sizeof(input) );
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, input, sizeof(*input) );
-    ok( res == 1 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 1 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 16, input, sizeof(*input) );
-    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#lx\n", res, GetLastError() );
 
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, input, 0 );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, input, sizeof(*input) + 1 );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 1, input, sizeof(*input) - 1 );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
 
     for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_KEYBOARD;
     SetLastError( 0xdeadbeef );
     res = SendInput( 16, input, offsetof( INPUT, ki ) + sizeof(KEYBDINPUT) );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     SetLastError( 0xdeadbeef );
     res = SendInput( 16, input, sizeof(*input) );
-    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     empty_message_queue();
 
     for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_HARDWARE;
     SetLastError( 0xdeadbeef );
     res = SendInput( 16, input, offsetof( INPUT, hi ) + sizeof(HARDWAREINPUT) );
-    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "SendInput returned %u, error %#lx\n", res, GetLastError() );
 
     input[0].hi.uMsg = WM_KEYDOWN;
     input[0].hi.wParamL = 0;
@@ -4446,7 +4447,7 @@ static void test_SendInput(void)
     res = SendInput( 16, input, sizeof(*input) );
     ok( (res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ||
         broken(res == 16 && GetLastError() == 0xdeadbeef) /* 32bit */,
-        "SendInput returned %u, error %#x\n", res, GetLastError() );
+        "SendInput returned %u, error %#lx\n", res, GetLastError() );
     while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg);
     ok( !res, "SendInput triggered unexpected message %#x\n", msg.message );
     empty_message_queue();
@@ -4463,7 +4464,7 @@ static void test_SendInput(void)
     res = SendInput( 16, input, sizeof(*input) );
     ok( (res == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) ||
         broken(res == 16 && GetLastError() == 0xdeadbeef),
-        "SendInput returned %u, error %#x\n", res, GetLastError() );
+        "SendInput returned %u, error %#lx\n", res, GetLastError() );
     while ((res = wait_for_message(&msg)) && (msg.message == WM_TIMER || broken(msg.message == WM_KEYDOWN || msg.message == WM_KEYUP)))
         DispatchMessageA(&msg);
     ok( !res, "SendInput triggered unexpected message %#x\n", msg.message );
@@ -4472,7 +4473,7 @@ static void test_SendInput(void)
     for (i = 0; i < ARRAY_SIZE(input); ++i) input[i].type = INPUT_HARDWARE + 1;
     SetLastError( 0xdeadbeef );
     res = SendInput( 16, input, sizeof(*input) );
-    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#x\n", res, GetLastError() );
+    ok( res == 16 && GetLastError() == 0xdeadbeef, "SendInput returned %u, error %#lx\n", res, GetLastError() );
     while ((res = wait_for_message(&msg)) && msg.message == WM_TIMER) DispatchMessageA(&msg);
     ok( !res, "SendInput triggered unexpected message %#x\n", msg.message );
     empty_message_queue();




More information about the wine-devel mailing list