[PATCH] dlls/user32/tests: enable compilation with long types (msg.c)

Eric Pouech eric.pouech at gmail.com
Sat Mar 12 02:37:22 CST 2022


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

---
 dlls/user32/tests/msg.c |  973 ++++++++++++++++++++++++-----------------------
 1 file changed, 487 insertions(+), 486 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f0e0d0fba76..4519da6962d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -19,6 +19,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 
 #include <assert.h>
 #include <limits.h>
@@ -2449,12 +2450,12 @@ static void add_message_(int line, const struct recvd_message *msg)
             };
             const char *code_name = (msg->message <= HCBT_SETFOCUS) ? CBT_code_name[msg->message] : "Unknown";
 
-            sprintf( seq->output, "%s: hook %d (%s) wp %08lx lp %08lx",
+            sprintf( seq->output, "%s: hook %d (%s) wp %08Ix lp %08Ix",
                      msg->descr, msg->message, code_name, msg->wParam, msg->lParam );
         }
         else if (msg->flags & winevent_hook)
         {
-            sprintf( seq->output, "%s: winevent %p %08x %08lx %08lx",
+            sprintf( seq->output, "%s: winevent %p %08x %08Ix %08Ix",
                      msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
         }
         else
@@ -2466,7 +2467,7 @@ static void add_message_(int line, const struct recvd_message *msg)
             {
                 WINDOWPOS *winpos = (WINDOWPOS *)msg->lParam;
 
-                sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08lx lp %08lx after %p x %d y %d cx %d cy %d flags %s",
+                sprintf( seq->output, "%s: %p WM_WINDOWPOS%s wp %08Ix lp %08Ix after %p x %d y %d cx %d cy %d flags %s",
                           msg->descr, msg->hwnd,
                           (msg->message == WM_WINDOWPOSCHANGING) ? "CHANGING" : "CHANGED",
                           msg->wParam, msg->lParam, winpos->hwndInsertAfter,
@@ -2529,7 +2530,7 @@ static void add_message_(int line, const struct recvd_message *msg)
                 MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)msg->lParam;
                 BOOL is_unicode_data = TRUE;
 
-                sprintf( seq->output, "%s: %p WM_MEASUREITEM: CtlType %#x, CtlID %#x, itemID %#x, itemData %#lx",
+                sprintf( seq->output, "%s: %p WM_MEASUREITEM: CtlType %#x, CtlID %#x, itemID %#x, itemData %#Ix",
                          msg->descr, msg->hwnd, mis->CtlType, mis->CtlID,
                          mis->itemID, mis->itemData);
 
@@ -2558,12 +2559,12 @@ static void add_message_(int line, const struct recvd_message *msg)
                 HWND ctrl = GetDlgItem(msg->hwnd, cis->CtlID);
                 BOOL is_unicode_data = TRUE;
 
-                ok(msg->wParam == cis->CtlID, "expected %#x, got %#lx\n", cis->CtlID, msg->wParam);
+                ok(msg->wParam == cis->CtlID, "expected %#x, got %#Ix\n", cis->CtlID, msg->wParam);
                 ok(cis->hwndItem == ctrl, "expected %p, got %p\n", ctrl, cis->hwndItem);
                 ok((int)cis->itemID1 >= 0, "expected >= 0, got %d\n", cis->itemID1);
                 ok((int)cis->itemID2 == -1, "expected -1, got %d\n", cis->itemID2);
 
-                sprintf( seq->output, "%s: %p WM_COMPAREITEM: CtlType %#x, CtlID %#x, itemID1 %#x, itemData1 %#lx, itemID2 %#x, itemData2 %#lx",
+                sprintf( seq->output, "%s: %p WM_COMPAREITEM: CtlType %#x, CtlID %#x, itemID1 %#x, itemData1 %#Ix, itemID2 %#x, itemData2 %#Ix",
                          msg->descr, msg->hwnd, cis->CtlType, cis->CtlID,
                          cis->itemID1, cis->itemData1, cis->itemID2, cis->itemData2);
 
@@ -2585,7 +2586,7 @@ static void add_message_(int line, const struct recvd_message *msg)
 
             default:
                 if (msg->message >= 0xc000) return;  /* ignore registered messages */
-                sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx",
+                sprintf( seq->output, "%s: %p %04x wp %08Ix lp %08Ix",
                          msg->descr, msg->hwnd, msg->message, msg->wParam, msg->lParam );
             }
             if (msg->flags & (sent|posted|parent|defwinproc|beginpaint))
@@ -2730,14 +2731,14 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
                         failcount ++;
                         if (strcmp(winetest_platform, "wine")) dump++;
                         ok_( file, line) (FALSE,
-			    "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+			    "%s: %u: in msg 0x%04x expecting wParam 0x%Ix got 0x%Ix\n",
                             context, count, expected->message, expected->wParam, actual->wParam);
 		    }
 		}
 		else
                 {
                     ok_( file, line)( ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) == 0,
-                                     "%s: %u: in msg 0x%04x expecting wParam 0x%lx got 0x%lx\n",
+                                     "%s: %u: in msg 0x%04x expecting wParam 0x%Ix got 0x%Ix\n",
                                      context, count, expected->message, expected->wParam, actual->wParam);
                     if ((expected->wParam ^ actual->wParam) & ~expected->wp_mask) dump++;
                 }
@@ -2751,14 +2752,14 @@ static void ok_sequence_(const struct message *expected_list, const char *contex
                         failcount ++;
                         if (strcmp(winetest_platform, "wine")) dump++;
                         ok_( file, line) (FALSE,
-			    "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+			    "%s: %u: in msg 0x%04x expecting lParam 0x%Ix got 0x%Ix\n",
                             context, count, expected->message, expected->lParam, actual->lParam);
 		    }
 		}
 		else
                 {
                     ok_( file, line)(((expected->lParam ^ actual->lParam) & ~expected->lp_mask) == 0,
-                                     "%s: %u: in msg 0x%04x expecting lParam 0x%lx got 0x%lx\n",
+                                     "%s: %u: in msg 0x%04x expecting lParam 0x%Ix got 0x%Ix\n",
                                      context, count, expected->message, expected->lParam, actual->lParam);
                     if ((expected->lParam ^ actual->lParam) & ~expected->lp_mask) dump++;
                 }
@@ -2910,7 +2911,7 @@ done:
     flush_sequence();
 }
 
-#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %d\n", (EXPECTED), (GOT))
+#define expect(EXPECTED,GOT) ok((GOT)==(EXPECTED), "Expected %d, got %ld\n", (EXPECTED), (GOT))
 
 /******************************** MDI test **********************************/
 
@@ -4662,7 +4663,7 @@ static void test_mdi_messages(void)
     flush_sequence();
 
     val = GetWindowLongA(mdi_client, 0);
-    ok(val == 0xdeadbeef || broken(val == 0) /* >= Win Vista */, "Expected 0xdeadbeef, got 0x%x\n", val);
+    ok(val == 0xdeadbeef || broken(val == 0) /* >= Win Vista */, "Expected 0xdeadbeef, got 0x%lx\n", val);
     DestroyWindow(mdi_client);
     ok_sequence(WmDestroyMDIclientSeq, "Destroy MDI client window", FALSE);
 
@@ -4804,29 +4805,29 @@ static void test_hv_scroll_1(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
     /* do not be confused by WS_DLGFRAME set */
     if ((style & WS_CAPTION) == WS_CAPTION) style &= ~WS_CAPTION;
 
-    if (clear) ok(style & clear, "style %08x should be set\n", clear);
-    if (set) ok(!(style & set), "style %08x should not be set\n", set);
+    if (clear) ok(style & clear, "style %08lx should be set\n", clear);
+    if (set) ok(!(style & set), "style %08lx should not be set\n", set);
 
     ret = SetScrollRange(hwnd, ctl, min, max, FALSE);
-    ok( ret, "SetScrollRange(%d) error %d\n", ctl, GetLastError());
+    ok( ret, "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
     if ((style & (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME)) || (exstyle & WS_EX_DLGMODALFRAME))
         ok_sequence(WmSetScrollRangeHV_NC_Seq, "SetScrollRange(SB_HORZ/SB_VERT) NC", FALSE);
     else
         ok_sequence(WmSetScrollRangeHVSeq, "SetScrollRange(SB_HORZ/SB_VERT)", FALSE);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    if (set) ok(style & set, "style %08x should be set\n", set);
-    if (clear) ok(!(style & clear), "style %08x should not be set\n", clear);
+    if (set) ok(style & set, "style %08lx should be set\n", set);
+    if (clear) ok(!(style & clear), "style %08lx should not be set\n", clear);
 
     /* a subsequent call should do nothing */
     ret = SetScrollRange(hwnd, ctl, min, max, FALSE);
-    ok( ret, "SetScrollRange(%d) error %d\n", ctl, GetLastError());
+    ok( ret, "SetScrollRange(%d) error %ld\n", ctl, GetLastError());
     ok_sequence(WmEmptySeq, "SetScrollRange(SB_HORZ/SB_VERT) empty sequence", FALSE);
 
     xmin = 0xdeadbeef;
     xmax = 0xdeadbeef;
     ret = GetScrollRange(hwnd, ctl, &xmin, &xmax);
-    ok( ret, "GetScrollRange(%d) error %d\n", ctl, GetLastError());
+    ok( ret, "GetScrollRange(%d) error %ld\n", ctl, GetLastError());
     ok_sequence(WmEmptySeq, "GetScrollRange(SB_HORZ/SB_VERT) empty sequence", FALSE);
     ok(xmin == min, "unexpected min scroll value %d\n", xmin);
     ok(xmax == max, "unexpected max scroll value %d\n", xmax);
@@ -4843,8 +4844,8 @@ static void test_hv_scroll_2(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
     /* do not be confused by WS_DLGFRAME set */
     if ((style & WS_CAPTION) == WS_CAPTION) style &= ~WS_CAPTION;
 
-    if (clear) ok(style & clear, "style %08x should be set\n", clear);
-    if (set) ok(!(style & set), "style %08x should not be set\n", set);
+    if (clear) ok(style & clear, "style %08lx should be set\n", clear);
+    if (set) ok(!(style & set), "style %08lx should not be set\n", set);
 
     si.cbSize = sizeof(si);
     si.fMask = SIF_RANGE;
@@ -4857,8 +4858,8 @@ static void test_hv_scroll_2(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
         ok_sequence(WmSetScrollRangeHVSeq, "SetScrollInfo(SB_HORZ/SB_VERT)", FALSE);
 
     style = GetWindowLongA(hwnd, GWL_STYLE);
-    if (set) ok(style & set, "style %08x should be set\n", set);
-    if (clear) ok(!(style & clear), "style %08x should not be set\n", clear);
+    if (set) ok(style & set, "style %08lx should be set\n", set);
+    if (clear) ok(!(style & clear), "style %08lx should not be set\n", clear);
 
     /* a subsequent call should do nothing */
     SetScrollInfo(hwnd, ctl, &si, TRUE);
@@ -4883,7 +4884,7 @@ static void test_hv_scroll_2(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min
     si.nMin = 0xdeadbeef;
     si.nMax = 0xdeadbeef;
     ret = GetScrollInfo(hwnd, ctl, &si);
-    ok( ret, "GetScrollInfo error %d\n", GetLastError());
+    ok( ret, "GetScrollInfo error %ld\n", GetLastError());
     ok_sequence(WmEmptySeq, "GetScrollRange(SB_HORZ/SB_VERT) empty sequence", FALSE);
     ok(si.nMin == min, "unexpected min scroll value %d\n", si.nMin);
     ok(si.nMax == max, "unexpected max scroll value %d\n", si.nMax);
@@ -4902,14 +4903,14 @@ static void test_scroll_messages(HWND hwnd)
     min = 0xdeadbeef;
     max = 0xdeadbeef;
     ret = GetScrollRange(hwnd, SB_CTL, &min, &max);
-    ok( ret, "GetScrollRange error %d\n", GetLastError());
+    ok( ret, "GetScrollRange error %ld\n", GetLastError());
     if (sequence->message != WmGetScrollRangeSeq[0].message)
         trace("GetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
     /* values of min and max are undefined */
     flush_sequence();
 
     ret = SetScrollRange(hwnd, SB_CTL, 10, 150, FALSE);
-    ok( ret, "SetScrollRange error %d\n", GetLastError());
+    ok( ret, "SetScrollRange error %ld\n", GetLastError());
     if (sequence->message != WmSetScrollRangeSeq[0].message)
         trace("SetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
     flush_sequence();
@@ -4917,7 +4918,7 @@ static void test_scroll_messages(HWND hwnd)
     min = 0xdeadbeef;
     max = 0xdeadbeef;
     ret = GetScrollRange(hwnd, SB_CTL, &min, &max);
-    ok( ret, "GetScrollRange error %d\n", GetLastError());
+    ok( ret, "GetScrollRange error %ld\n", GetLastError());
     if (sequence->message != WmGetScrollRangeSeq[0].message)
         trace("GetScrollRange(SB_CTL) generated unknown message %04x\n", sequence->message);
     /* values of min and max are undefined */
@@ -4950,7 +4951,7 @@ static void test_scroll_messages(HWND hwnd)
     si.nMin = 0xdeadbeef;
     si.nMax = 0xdeadbeef;
     ret = GetScrollInfo(hwnd, SB_CTL, &si);
-    ok( ret, "GetScrollInfo error %d\n", GetLastError());
+    ok( ret, "GetScrollInfo error %ld\n", GetLastError());
     if (sequence->message != WmGetScrollInfoSeq[0].message)
         trace("GetScrollInfo(SB_CTL) generated unknown message %04x\n", sequence->message);
     /* values of min and max are undefined */
@@ -5194,7 +5195,7 @@ static void test_sys_menu(void)
 
     /* test existing window without CS_NOCLOSE style */
     hmenu = GetSystemMenu(hwnd, FALSE);
-    ok(hmenu != 0, "GetSystemMenu error %d\n", GetLastError());
+    ok(hmenu != 0, "GetSystemMenu error %ld\n", GetLastError());
 
     state = GetMenuState(hmenu, SC_CLOSE, MF_BYCOMMAND);
     ok(state != 0xffffffff, "wrong SC_CLOSE state %x\n", state);
@@ -5219,7 +5220,7 @@ static void test_sys_menu(void)
     SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_FRAMECHANGED);
     flush_sequence();
     hmenu = GetSystemMenu(hwnd, FALSE);
-    ok(hmenu != 0, "GetSystemMenu error %d\n", GetLastError());
+    ok(hmenu != 0, "GetSystemMenu error %ld\n", GetLastError());
 
     DestroyWindow(hwnd);
 
@@ -5229,7 +5230,7 @@ static void test_sys_menu(void)
     ok (hwnd != 0, "Failed to create overlapped window\n");
 
     hmenu = GetSystemMenu(hwnd, FALSE);
-    ok(hmenu != 0, "GetSystemMenu error %d\n", GetLastError());
+    ok(hmenu != 0, "GetSystemMenu error %ld\n", GetLastError());
 
     state = GetMenuState(hmenu, SC_CLOSE, MF_BYCOMMAND);
     ok(state == 0xffffffff, "wrong SC_CLOSE state %x\n", state);
@@ -5242,7 +5243,7 @@ static void test_sys_menu(void)
     ok(hwnd != 0, "Failed to create overlapped window\n");
 
     hmenu = GetSystemMenu(hwnd, FALSE);
-    ok(!hmenu, "GetSystemMenu error %d\n", GetLastError());
+    ok(!hmenu, "GetSystemMenu error %ld\n", GetLastError());
 
     DestroyWindow(hwnd);
 }
@@ -5343,36 +5344,36 @@ static void test_MsgWaitForMultipleObjects(HWND hwnd)
     MSG msg;
 
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     PostMessageA(hwnd, WM_USER, 0, 0);
 
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
 
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     PostMessageA(hwnd, WM_USER, 0, 0);
 
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     ok(PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ), "PeekMessage should succeed\n");
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
 
     /* shows QS_POSTMESSAGE flag is cleared in the PeekMessage call */
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     PostMessageA(hwnd, WM_USER, 0, 0);
 
     /* new incoming message causes it to become signaled again */
     ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %lx\n", ret);
 
     ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
@@ -5385,30 +5386,30 @@ static void test_MsgWaitForMultipleObjects(HWND hwnd)
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
 
     ret = MsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_POSTMESSAGE, MWMO_INPUTAVAILABLE );
-    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %lx\n", ret);
 
     ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
 
     /* without MWMO_ALERTABLE the result is never WAIT_IO_COMPLETION */
     ret = QueueUserAPC( apc_test_proc, GetCurrentThread(), 0 );
-    ok(ret, "QueueUserAPC failed %u\n", GetLastError());
+    ok(ret, "QueueUserAPC failed %lu\n", GetLastError());
 
     ret = MsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_POSTMESSAGE, 0 );
-    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+    ok(ret == WAIT_TIMEOUT, "MsgWaitForMultipleObjectsEx returned %lx\n", ret);
 
     /* but even with MWMO_ALERTABLE window events are preferred */
     PostMessageA( hwnd, WM_USER, 0, 0 );
 
     ret = MsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_POSTMESSAGE, MWMO_ALERTABLE );
-    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjectsEx returned %lx\n", ret);
 
     ok(PeekMessageA( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n");
     ok(msg.message == WM_USER, "got %04x instead of WM_USER\n", msg.message);
 
     /* the APC call is still queued */
     ret = MsgWaitForMultipleObjectsEx( 0, NULL, 0, QS_POSTMESSAGE, MWMO_ALERTABLE );
-    ok(ret == WAIT_IO_COMPLETION, "MsgWaitForMultipleObjectsEx returned %x\n", ret);
+    ok(ret == WAIT_IO_COMPLETION, "MsgWaitForMultipleObjectsEx returned %lx\n", ret);
 }
 
 static void test_WM_DEVICECHANGE(HWND hwnd)
@@ -5438,13 +5439,13 @@ static void test_WM_DEVICECHANGE(HWND hwnd)
         ret = PostMessageA(hwnd, WM_DEVICECHANGE, wparams[i], 0);
         if (wparams[i] & 0x8000)
         {
-            ok(ret == FALSE, "PostMessage returned %d\n", ret);
-            ok(GetLastError() == ERROR_MESSAGE_SYNC_ONLY, "PostMessage error %08x\n", GetLastError());
+            ok(ret == FALSE, "PostMessage returned %ld\n", ret);
+            ok(GetLastError() == ERROR_MESSAGE_SYNC_ONLY, "PostMessage error %08lx\n", GetLastError());
         }
         else
         {
             ret = MsgWaitForMultipleObjects(0, NULL, FALSE, 0, QS_POSTMESSAGE);
-            ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %x\n", ret);
+            ok(ret == WAIT_OBJECT_0, "MsgWaitForMultipleObjects returned %lx\n", ret);
             memset(&msg, 0, sizeof(msg));
             ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "PeekMessage should succeed\n");
             ok(msg.message == WM_DEVICECHANGE, "got %04x instead of WM_DEVICECHANGE\n", msg.message);
@@ -5534,7 +5535,7 @@ static void test_messages(void)
 
     /* test ShowWindow(SW_HIDE) on a hidden window -  multi-threaded */
     hthread = CreateThread( NULL, 0, hide_window_thread, hwnd, 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);
     flush_events();
@@ -5546,7 +5547,7 @@ static void test_messages(void)
 
     /* test ShowWindow(SW_SHOW) on a visible window -  multi-threaded */
     hthread = CreateThread( NULL, 0, show_window_thread, hwnd, 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 );
     flush_events();
@@ -5906,7 +5907,7 @@ static void test_messages(void)
     flush_events();
     flush_sequence();
     ret = DrawMenuBar(hwnd);
-    ok(ret, "DrawMenuBar failed: %d\n", GetLastError());
+    ok(ret, "DrawMenuBar failed: %ld\n", GetLastError());
     flush_events();
     ok_sequence(WmDrawMenuBarSeq, "DrawMenuBar", FALSE);
     ok(SetCursorPos(pos.x, pos.y), "SetCursorPos failed\n");
@@ -5919,7 +5920,7 @@ static void test_messages(void)
     flush_events();
     flush_sequence();
     ret = DrawMenuBar(hwnd);
-    ok(ret, "DrawMenuBar failed: %d\n", GetLastError());
+    ok(ret, "DrawMenuBar failed: %ld\n", GetLastError());
     flush_events();
     ok_sequence(WmEmptySeq, "DrawMenuBar for a child window", FALSE);
 
@@ -5934,7 +5935,7 @@ static void test_messages(void)
 
     /* Message sequence for SetMenu */
     ok(!DrawMenuBar(hwnd), "DrawMenuBar should return FALSE for a destroyed window\n");
-    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "last error is %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "last error is %ld\n", GetLastError());
     ok_sequence(WmEmptySeq, "DrawMenuBar for a window without a menu", FALSE);
 
     hmenu = CreateMenu();
@@ -6009,7 +6010,7 @@ static void test_messages(void)
     ok( !PeekMessageW( NULL, 0, 0, 0, PM_REMOVE ), "PeekMessage(NULL) should fail\n" );
     ok( GetLastError() == ERROR_NOACCESS || /* Win2k */
         GetLastError() == 0xdeadbeef, /* NT4 */
-        "last error is %d\n", GetLastError() );
+        "last error is %ld\n", GetLastError() );
     ok( PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ), "PeekMessage should succeed\n" );
     ok( msg.message == WM_USER+1, "got %x instead of WM_USER+1\n", msg.message );
 
@@ -6061,29 +6062,29 @@ static void test_messages(void)
         goto done;
     }
     ok_sequence(WmInitEndSession, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x8000000b", TRUE);
-    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x8000000b, 0) should have returned 1 instead of %ld\n", res);
+    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x8000000b, 0) should have returned 1 instead of %Id\n", res);
     res = SendMessageA(hwnd, 0x3B, 0x0000000b, 0);
     ok_sequence(WmInitEndSession_2, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000b", TRUE);
-    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000b, 0) should have returned 1 instead of %ld\n", res);
+    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000b, 0) should have returned 1 instead of %Id\n", res);
     res = SendMessageA(hwnd, 0x3B, 0x0000000f, 0);
     ok_sequence(WmInitEndSession_2, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x0000000f", TRUE);
-    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000f, 0) should have returned 1 instead of %ld\n", res);
+    ok(res == 1, "SendMessage(hwnd, 0x3B, 0x0000000f, 0) should have returned 1 instead of %Id\n", res);
 
     flush_sequence();
     res = SendMessageA(hwnd, 0x3B, 0x80000008, 0);
     ok_sequence(WmInitEndSession_3, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000008", TRUE);
-    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000008, 0) should have returned 2 instead of %ld\n", res);
+    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000008, 0) should have returned 2 instead of %Id\n", res);
     res = SendMessageA(hwnd, 0x3B, 0x00000008, 0);
     ok_sequence(WmInitEndSession_4, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x00000008", TRUE);
-    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x00000008, 0) should have returned 2 instead of %ld\n", res);
+    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x00000008, 0) should have returned 2 instead of %Id\n", res);
 
     res = SendMessageA(hwnd, 0x3B, 0x80000004, 0);
     ok_sequence(WmInitEndSession_3, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000004", TRUE);
-    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000004, 0) should have returned 2 instead of %ld\n", res);
+    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000004, 0) should have returned 2 instead of %Id\n", res);
 
     res = SendMessageA(hwnd, 0x3B, 0x80000001, 0);
     ok_sequence(WmInitEndSession_5, "Handling of undocumented 0x3B message by DefWindowProc wparam=0x80000001", TRUE);
-    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000001, 0) should have returned 2 instead of %ld\n", res);
+    ok(res == 2, "SendMessage(hwnd, 0x3B, 0x80000001, 0) should have returned 2 instead of %Id\n", res);
 
 done:
     DestroyWindow(hwnd);
@@ -6136,7 +6137,7 @@ static void test_setwindowpos(void)
     flush_sequence();
     res = SetWindowPos(hwnd, HWND_TOPMOST, 50, 50, winX, winY, 0);
     ok_sequence(WmZOrder, "Z-Order", TRUE);
-    ok(res == TRUE, "SetWindowPos expected TRUE, got %ld\n", res);
+    ok(res == TRUE, "SetWindowPos expected TRUE, got %Id\n", res);
 
     GetWindowRect(hwnd, &rc);
     expect(sysX + X, rc.right);
@@ -6145,7 +6146,7 @@ static void test_setwindowpos(void)
     res = SetWindowPos( hwnd, 0, 0, 0, 0, 0,
             SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
     ok_sequence(WmFrameChanged, "FrameChanged", FALSE);
-    ok(res == TRUE, "SetWindowPos expected TRUE, got %ld.\n", res);
+    ok(res == TRUE, "SetWindowPos expected TRUE, got %Id.\n", res);
 
     GetWindowRect(hwnd, &rc);
     expect(sysX + X, rc.right);
@@ -6154,7 +6155,7 @@ static void test_setwindowpos(void)
     res = SetWindowPos( hwnd, 0, 0, 0, 0, 0,
             SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
     ok_sequence(WmFrameChanged_move, "FrameChanged", FALSE);
-    ok(res == TRUE, "SetWindowPos expected TRUE, got %ld.\n", res);
+    ok(res == TRUE, "SetWindowPos expected TRUE, got %Id.\n", res);
 
     GetWindowRect(hwnd, &rc);
     expect(sysX, rc.right);
@@ -6848,7 +6849,7 @@ static void test_button_messages(void)
         char desc[64];
         HDC hdc;
 
-        trace("button style %08x\n", button[i].style);
+        trace("button style %08lx\n", button[i].style);
 
         hwnd = CreateWindowExA(0, "my_button_class", "test", button[i].style | WS_CHILD | BS_NOTIFY,
                                0, 0, 50, 14, parent, (HMENU)ID_BUTTON, 0, NULL);
@@ -6858,12 +6859,12 @@ static void test_button_messages(void)
         style &= ~(WS_CHILD | BS_NOTIFY);
         /* XP turns a BS_USERBUTTON into BS_PUSHBUTTON */
         if (button[i].style == BS_USERBUTTON)
-            ok(style == BS_PUSHBUTTON, "expected style BS_PUSHBUTTON got %x\n", style);
+            ok(style == BS_PUSHBUTTON, "expected style BS_PUSHBUTTON got %lx\n", style);
         else
-            ok(style == button[i].style, "expected style %x got %x\n", button[i].style, style);
+            ok(style == button[i].style, "expected style %lx got %lx\n", button[i].style, style);
 
         dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
-        ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code);
+        ok(dlg_code == button[i].dlg_code, "%u: wrong dlg_code %08lx\n", i, dlg_code);
 
         ShowWindow(hwnd, SW_SHOW);
         UpdateWindow(hwnd);
@@ -6895,10 +6896,10 @@ static void test_button_messages(void)
         style = GetWindowLongA(hwnd, GWL_STYLE);
         style &= ~(WS_VISIBLE | WS_CHILD | BS_NOTIFY);
         /* XP doesn't turn a BS_USERBUTTON into BS_PUSHBUTTON here! */
-        ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
+        ok(style == button[i].style, "expected style %04lx got %04lx\n", button[i].style, style);
 
         state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
-        ok(state == 0, "expected state 0, got %04x\n", state);
+        ok(state == 0, "expected state 0, got %04lx\n", state);
 
         flush_sequence();
 
@@ -6908,11 +6909,11 @@ static void test_button_messages(void)
         ok_sequence(button[i].setstate, "BM_SETSTATE/TRUE on a button", FALSE);
 
         state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
-        ok(state == 0x0004, "expected state 0x0004, got %04x\n", state);
+        ok(state == 0x0004, "expected state 0x0004, got %04lx\n", state);
 
         style = GetWindowLongA(hwnd, GWL_STYLE);
         style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
-        ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
+        ok(style == button[i].style, "expected style %04lx got %04lx\n", button[i].style, style);
 
         flush_sequence();
 
@@ -6922,14 +6923,14 @@ static void test_button_messages(void)
         ok_sequence(button[i].clearstate, "BM_SETSTATE/FALSE on a button", FALSE);
 
         state = SendMessageA(hwnd, BM_GETSTATE, 0, 0);
-        ok(state == 0, "expected state 0, got %04x\n", state);
+        ok(state == 0, "expected state 0, got %04lx\n", state);
 
         style = GetWindowLongA(hwnd, GWL_STYLE);
         style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
-        ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
+        ok(style == button[i].style, "expected style %04lx got %04lx\n", button[i].style, style);
 
         state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
-        ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
+        ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04lx\n", state);
 
         flush_sequence();
 
@@ -6939,11 +6940,11 @@ static void test_button_messages(void)
         ok_sequence(WmSetCheckIgnoredSeq, "BM_SETCHECK on a button", FALSE);
 
         state = SendMessageA(hwnd, BM_GETCHECK, 0, 0);
-        ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04x\n", state);
+        ok(state == BST_UNCHECKED, "expected BST_UNCHECKED, got %04lx\n", state);
 
         style = GetWindowLongA(hwnd, GWL_STYLE);
         style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
-        ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
+        ok(style == button[i].style, "expected style %04lx got %04lx\n", button[i].style, style);
 
         flush_sequence();
 
@@ -6982,17 +6983,17 @@ static void test_button_messages(void)
             button[i].style == BS_GROUPBOX ||
             button[i].style == BS_USERBUTTON ||
             button[i].style == BS_OWNERDRAW)
-            ok(state == BST_UNCHECKED, "expected check 0, got %04x\n", state);
+            ok(state == BST_UNCHECKED, "expected check 0, got %04lx\n", state);
         else
-            ok(state == BST_CHECKED, "expected check 1, got %04x\n", state);
+            ok(state == BST_CHECKED, "expected check 1, got %04lx\n", state);
 
         style = GetWindowLongA(hwnd, GWL_STYLE);
         style &= ~(WS_CHILD | BS_NOTIFY | WS_VISIBLE);
         if (button[i].style == BS_RADIOBUTTON ||
             button[i].style == BS_AUTORADIOBUTTON)
-            ok(style == (button[i].style | WS_TABSTOP), "expected style %04x | WS_TABSTOP got %04x\n", button[i].style, style);
+            ok(style == (button[i].style | WS_TABSTOP), "expected style %04lx | WS_TABSTOP got %04lx\n", button[i].style, style);
         else
-            ok(style == button[i].style, "expected style %04x got %04x\n", button[i].style, style);
+            ok(style == button[i].style, "expected style %04lx got %04lx\n", button[i].style, style);
 
         log_all_parent_messages--;
 
@@ -7376,38 +7377,38 @@ static void test_autoradio_BM_CLICK(void)
     flush_sequence();
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
 
     SendMessageA(radio1, BM_SETCHECK, BST_CHECKED, 0);
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
 
     SendMessageA(radio2, BM_SETCHECK, BST_CHECKED, 0);
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
 
     SendMessageA(radio3, BM_SETCHECK, BST_CHECKED, 0);
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
 
     GetWindowRect(radio2, &rc);
     SetCursorPos(rc.left+1, rc.top+1);
@@ -7424,11 +7425,11 @@ static void test_autoradio_BM_CLICK(void)
     log_all_parent_messages--;
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok(ret == BST_CHECKED, "got %08x\n", ret);
+    ok(ret == BST_CHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok(ret == BST_UNCHECKED, "got %08x\n", ret);
+    ok(ret == BST_UNCHECKED, "got %08lx\n", ret);
 
     DestroyWindow(parent);
 }
@@ -7439,11 +7440,11 @@ static void test_radio_dbg(HWND radio1, int state1, HWND radio2, int state2, HWN
     DWORD ret;
 
     ret = SendMessageA(radio1, BM_GETCHECK, 0, 0);
-    ok_(__FILE__,line)(ret == state1 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
+    ok_(__FILE__,line)(ret == state1 ? BST_CHECKED : BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio2, BM_GETCHECK, 0, 0);
-    ok_(__FILE__,line)(ret == state2 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
+    ok_(__FILE__,line)(ret == state2 ? BST_CHECKED : BST_UNCHECKED, "got %08lx\n", ret);
     ret = SendMessageA(radio3, BM_GETCHECK, 0, 0);
-    ok_(__FILE__,line)(ret == state3 ? BST_CHECKED : BST_UNCHECKED, "got %08x\n", ret);
+    ok_(__FILE__,line)(ret == state3 ? BST_CHECKED : BST_UNCHECKED, "got %08lx\n", ret);
 }
 
 static void set_radio(HWND radio1, int state1, HWND radio2, int state2, HWND radio3, int state3)
@@ -7691,14 +7692,14 @@ static void test_static_messages(void)
 	ok(hwnd != 0, "Failed to create static window\n");
 
 	dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
-	ok(dlg_code == static_ctrl[i].dlg_code, "%u: wrong dlg_code %08x\n", i, dlg_code);
+	ok(dlg_code == static_ctrl[i].dlg_code, "%u: wrong dlg_code %08lx\n", i, dlg_code);
 
 	ShowWindow(hwnd, SW_SHOW);
 	UpdateWindow(hwnd);
 	SetFocus(0);
 	flush_sequence();
 
-	trace("static style %08x\n", static_ctrl[i].style);
+	trace("static style %08lx\n", static_ctrl[i].style);
 	SendMessageA(hwnd, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), TRUE);
 	ok_sequence(static_ctrl[i].setfont, "WM_SETFONT on a static", FALSE);
 
@@ -7962,14 +7963,14 @@ static void test_combobox_messages(void)
     UpdateWindow(combo);
 
     ret = SendMessageA(combo, WM_GETDLGCODE, 0, 0);
-    ok(ret == (DLGC_WANTCHARS | DLGC_WANTARROWS), "wrong dlg_code %08lx\n", ret);
+    ok(ret == (DLGC_WANTCHARS | DLGC_WANTARROWS), "wrong dlg_code %08Ix\n", ret);
 
     ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 1");
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 2");
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
 
     SendMessageA(combo, CB_SETCURSEL, 0, 0);
     SetFocus(combo);
@@ -8000,7 +8001,7 @@ static void test_combobox_messages(void)
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     res = GetComboBoxInfo(combo, &cbInfo);
-    ok(res, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
+    ok(res, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
     edit = cbInfo.hwndItem;
 
     edit_window_proc = (WNDPROC)SetWindowLongPtrA(edit, GWLP_WNDPROC,
@@ -8054,12 +8055,12 @@ static void test_combobox_messages(void)
     ok(combo != 0, "Failed to create combobox window\n");
 
     ret = SendMessageA(combo, CB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
 
     cbInfo.cbSize = sizeof(COMBOBOXINFO);
     SetLastError(0xdeadbeef);
     res = GetComboBoxInfo(combo, &cbInfo);
-    ok(res, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
+    ok(res, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
     lbox = cbInfo.hwndList;
     lbox_window_proc = (WNDPROC)SetWindowLongPtrA(lbox, GWLP_WNDPROC,
             (ULONG_PTR)combobox_lbox_subclass_proc);
@@ -8167,7 +8168,7 @@ void dump_region(HRGN hrgn)
     if (!(size = GetRegionData( hrgn, 0, NULL ))) return;
     if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return;
     GetRegionData( hrgn, size, data );
-    printf("%d rects:", data->rdh.nCount );
+    printf("%ld rects:", data->rdh.nCount );
     for (i = 0, rect = (RECT *)data->Buffer; i < data->rdh.nCount; i++, rect++)
         printf( " %s", wine_dbgstr_rect( rect ));
     printf("\n");
@@ -8497,7 +8498,7 @@ static void test_paint_messages(void)
     SetLastError(0xdeadbeef);
     ok(!InvalidateRgn(0, NULL, FALSE), "InvalidateRgn(0, NULL, FALSE) should fail\n");
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || GetLastError() == 0xdeadbeef,
-       "wrong error code %d\n", GetLastError());
+       "wrong error code %ld\n", GetLastError());
     check_update_rgn( hwnd, 0 );
     flush_events();
     ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
@@ -8506,7 +8507,7 @@ static void test_paint_messages(void)
     ok(!ValidateRgn(0, NULL), "ValidateRgn(0, NULL) should fail\n");
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
        broken( GetLastError() == 0xdeadbeef ) /* win9x */,
-       "wrong error code %d\n", GetLastError());
+       "wrong error code %ld\n", GetLastError());
     check_update_rgn( hwnd, 0 );
     flush_events();
     ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
@@ -8515,7 +8516,7 @@ static void test_paint_messages(void)
     ok(!UpdateWindow(NULL), "UpdateWindow(NULL) should fail\n");
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE ||
        broken( GetLastError() == 0xdeadbeef ) /* win9x */,
-       "wrong error code %d\n", GetLastError());
+       "wrong error code %ld\n", GetLastError());
     check_update_rgn( hwnd, 0 );
     flush_events();
     ok_sequence( WmEmptySeq, "WmEmptySeq", FALSE );
@@ -9054,7 +9055,7 @@ static DWORD CALLBACK create_child_thread( void *param )
         while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     }
     ret = WaitForSingleObject( wnd_event->stop_event, 5000 );
-    ok( !ret, "WaitForSingleObject failed %x\n", ret );
+    ok( !ret, "WaitForSingleObject failed %lx\n", ret );
     return 0;
 }
 
@@ -9082,7 +9083,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);
 }
@@ -9099,10 +9100,10 @@ static HANDLE test_create(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);
@@ -9134,7 +9135,7 @@ static void test_interthread_messages(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");
 
@@ -9143,16 +9144,16 @@ static void test_interthread_messages(void)
     SetLastError(0xdeadbeef);
     ok(!DestroyWindow(wnd_event.hwnd), "DestroyWindow succeeded\n");
     ok(GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == 0xdeadbeef,
-       "wrong error code %d\n", GetLastError());
+       "wrong error code %ld\n", GetLastError());
 
     proc = (WNDPROC)GetWindowLongPtrA(wnd_event.hwnd, GWLP_WNDPROC);
-    ok(proc != NULL, "GetWindowLongPtrA(GWLP_WNDPROC) error %d\n", GetLastError());
+    ok(proc != NULL, "GetWindowLongPtrA(GWLP_WNDPROC) error %ld\n", GetLastError());
 
     expected_len = lstrlenA("window caption text");
     memset(buf, 0, sizeof(buf));
     SetLastError(0xdeadbeef);
     len = CallWindowProcA(proc, wnd_event.hwnd, WM_GETTEXT, sizeof(buf), (LPARAM)buf);
-    ok(len == expected_len, "CallWindowProcA(WM_GETTEXT) error %d, len %d, expected len %d\n", GetLastError(), len, expected_len);
+    ok(len == expected_len, "CallWindowProcA(WM_GETTEXT) error %ld, len %d, expected len %d\n", GetLastError(), len, expected_len);
     ok(!lstrcmpA(buf, "window caption text"), "window text mismatch\n");
 
     msg.hwnd = wnd_event.hwnd;
@@ -9163,7 +9164,7 @@ static void test_interthread_messages(void)
     SetLastError(0xdeadbeef);
     len = DispatchMessageA(&msg);
     ok((!len && GetLastError() == ERROR_MESSAGE_SYNC_ONLY) || broken(len), /* nt4 */
-       "DispatchMessageA(WM_GETTEXT) succeeded on another thread window: ret %d, error %d\n", len, GetLastError());
+       "DispatchMessageA(WM_GETTEXT) succeeded on another thread window: ret %d, error %ld\n", len, GetLastError());
 
     /* the following test causes an exception in user.exe under win9x */
     msg.hwnd = wnd_event.hwnd;
@@ -9173,10 +9174,10 @@ static void test_interthread_messages(void)
     SetLastError(0xdeadbeef);
     len = DispatchMessageA(&msg);
     ok(!len && GetLastError() == 0xdeadbeef,
-       "DispatchMessageA(WM_TIMER) failed on another thread window: ret %d, error %d\n", len, GetLastError());
+       "DispatchMessageA(WM_TIMER) failed on another thread window: ret %d, error %ld\n", len, GetLastError());
 
     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);
@@ -9226,22 +9227,22 @@ static void test_interthread_messages(void)
 
     handle = (void*)0xdeadbeef;
     ret = GetCurrentActCtx(&handle);
-    ok(ret, "GetCurrentActCtx failed: %u\n", GetLastError());
+    ok(ret, "GetCurrentActCtx failed: %lu\n", GetLastError());
     ok(handle == 0, "active context %p\n", handle);
 
     wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL);
     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);
 
     /* context is activated after thread creation, so it doesn't inherit it by default */
     ret = ActivateActCtx(context, &cookie);
-    ok(ret, "activation failed: %u\n", GetLastError());
+    ok(ret, "activation failed: %lu\n", GetLastError());
 
     handle = 0;
     ret = GetCurrentActCtx(&handle);
-    ok(ret, "GetCurrentActCtx failed: %u\n", GetLastError());
+    ok(ret, "GetCurrentActCtx failed: %lu\n", GetLastError());
     ok(handle != 0, "active context %p\n", handle);
     ReleaseActCtx(handle);
 
@@ -9256,13 +9257,13 @@ static void test_interthread_messages(void)
     CloseHandle(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);
 
     ret = DeactivateActCtx(0, cookie);
-    ok(ret, "DeactivateActCtx failed: %u\n", GetLastError());
+    ok(ret, "DeactivateActCtx failed: %lu\n", GetLastError());
     ReleaseActCtx(context);
 }
 
@@ -9696,7 +9697,7 @@ static void test_accelerators(void)
     ok_sequence(WmCtrlAltVkN, "Ctrl+Alt+VK_N press/release 1", FALSE);
 
     ret = DestroyAcceleratorTable(hAccel);
-    ok( ret, "DestroyAcceleratorTable error %d\n", GetLastError());
+    ok( ret, "DestroyAcceleratorTable error %ld\n", GetLastError());
 
     hAccel = LoadAcceleratorsA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(2));
     assert(hAccel != 0);
@@ -9771,7 +9772,7 @@ static void test_accelerators(void)
     ok_sequence(WmCtrlAltShiftVkN, "Ctrl+Alt+Shift+VK_N press/release", FALSE);
 
     ret = DestroyAcceleratorTable(hAccel);
-    ok( ret, "DestroyAcceleratorTable error %d\n", GetLastError());
+    ok( ret, "DestroyAcceleratorTable error %ld\n", GetLastError());
     hAccel = 0;
 
     trace("testing Alt press/release\n");
@@ -9864,7 +9865,7 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
 	{
 	    LONG style = GetWindowLongA(hwnd, GWL_STYLE);
 	    ok((BOOL)wParam == !(style & WS_DISABLED),
-		"wrong WS_DISABLED state: %ld != %d\n", wParam, !(style & WS_DISABLED));
+		"wrong WS_DISABLED state: %Id != %d\n", wParam, !(style & WS_DISABLED));
 	    break;
 	}
 
@@ -9921,15 +9922,15 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
 
 	    handle = (void*)0xdeadbeef;
 	    ret = GetCurrentActCtx(&handle);
-	    ok(ret, "failed to get current context, %u\n", GetLastError());
+	    ok(ret, "failed to get current context, %lu\n", GetLastError());
 	    ok(handle == 0, "got active context %p\n", handle);
 
 	    memset(&basicinfo, 0xff, sizeof(basicinfo));
 	    ret = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, handle, 0, ActivationContextBasicInformation,
 	        &basicinfo, sizeof(basicinfo), NULL);
-	    ok(ret, "got %d, error %d\n", ret, GetLastError());
+	    ok(ret, "got %d, error %ld\n", ret, GetLastError());
 	    ok(basicinfo.hActCtx == NULL, "got %p\n", basicinfo.hActCtx);
-	    ok(basicinfo.dwFlags == 0, "got %x\n", basicinfo.dwFlags);
+	    ok(basicinfo.dwFlags == 0, "got %lx\n", basicinfo.dwFlags);
 
 	    if (event) SetEvent(event);
 	    return 1;
@@ -9961,17 +9962,17 @@ static LRESULT MsgCheckProc (BOOL unicode, HWND hwnd, UINT message,
 	MINMAXINFO *minmax = (MINMAXINFO *)lParam;
 
 	GetClientRect(parent, &rc);
-	trace("parent %p client size = (%d x %d)\n", parent, rc.right, rc.bottom);
-        trace("Reserved=%d,%d MaxSize=%d,%d MaxPos=%d,%d MinTrack=%d,%d MaxTrack=%d,%d\n",
+	trace("parent %p client size = (%ld x %ld)\n", parent, rc.right, rc.bottom);
+        trace("Reserved=%ld,%ld MaxSize=%ld,%ld MaxPos=%ld,%ld MinTrack=%ld,%ld MaxTrack=%ld,%ld\n",
               minmax->ptReserved.x, minmax->ptReserved.y,
               minmax->ptMaxSize.x, minmax->ptMaxSize.y,
               minmax->ptMaxPosition.x, minmax->ptMaxPosition.y,
               minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y,
               minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y);
 
-	ok(minmax->ptMaxSize.x == rc.right, "default width of maximized child %d != %d\n",
+	ok(minmax->ptMaxSize.x == rc.right, "default width of maximized child %ld != %ld\n",
 	   minmax->ptMaxSize.x, rc.right);
-	ok(minmax->ptMaxSize.y == rc.bottom, "default height of maximized child %d != %d\n",
+	ok(minmax->ptMaxSize.y == rc.bottom, "default height of maximized child %ld != %ld\n",
 	   minmax->ptMaxSize.y, rc.bottom);
     }
 
@@ -10139,9 +10140,9 @@ static LRESULT WINAPI TestDlgProcA(HWND hwnd, UINT message, WPARAM wParam, LPARA
         DefDlgProcA(hwnd, DM_SETDEFID, 1, 0);
         ret = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
         if (after_end_dialog)
-            ok( ret == 0, "DM_GETDEFID should return 0 after EndDialog, got %lx\n", ret );
+            ok( ret == 0, "DM_GETDEFID should return 0 after EndDialog, got %Ix\n", ret );
         else
-            ok(HIWORD(ret) == DC_HASDEFID, "DM_GETDEFID should return DC_HASDEFID, got %lx\n", ret);
+            ok(HIWORD(ret) == DC_HASDEFID, "DM_GETDEFID should return DC_HASDEFID, got %Ix\n", ret);
     }
 
     msg.hwnd = hwnd;
@@ -10261,15 +10262,15 @@ static LRESULT WINAPI HotkeyMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam
     if (message == WM_APP)
     {
         queue_status = GetQueueStatus(QS_HOTKEY);
-        ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %x\n", queue_status);
+        ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %lx\n", queue_status);
         queue_status = GetQueueStatus(QS_POSTMESSAGE);
-        ok((queue_status & (QS_POSTMESSAGE << 16)) == QS_POSTMESSAGE << 16, "expected QS_POSTMESSAGE << 16 set, got %x\n", queue_status);
+        ok((queue_status & (QS_POSTMESSAGE << 16)) == QS_POSTMESSAGE << 16, "expected QS_POSTMESSAGE << 16 set, got %lx\n", queue_status);
         PostMessageA(hwnd, WM_APP+1, 0, 0);
     }
     else if (message == WM_APP+1)
     {
         queue_status = GetQueueStatus(QS_HOTKEY);
-        ok((queue_status & (QS_HOTKEY << 16)) == 0, "expected QS_HOTKEY << 16 cleared, got %x\n", queue_status);
+        ok((queue_status & (QS_HOTKEY << 16)) == 0, "expected QS_HOTKEY << 16 cleared, got %lx\n", queue_status);
     }
 
     return ret;
@@ -10558,35 +10559,35 @@ static void test_message_conversion(void)
     SetLastError(0);
     lRes = PostMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "PostMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "PostMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = PostMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "PostMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "PostMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = PostThreadMessageA(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "PosThreadtMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "PosThreadtMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = PostThreadMessageW(GetCurrentThreadId(), CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "PosThreadtMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "PosThreadtMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = SendNotifyMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "SendNotifyMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "SendNotifyMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = SendNotifyMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "SendNotifyMessage on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "SendNotifyMessage on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = SendMessageCallbackA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "SendMessageCallback on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "SendMessageCallback on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
     SetLastError(0);
     lRes = SendMessageCallbackW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)wszUnicode, NULL, 0);
     ok(lRes == 0 && (GetLastError() == ERROR_MESSAGE_SYNC_ONLY || GetLastError() == ERROR_INVALID_PARAMETER),
-        "SendMessageCallback on sync only message returned %ld, last error %d\n", lRes, GetLastError());
+        "SendMessageCallback on sync only message returned %Id, last error %ld\n", lRes, GetLastError());
 
     /* Check WM_GETTEXTLENGTH A->W behaviour, whether WM_GETTEXT is also sent or not */
 
@@ -10598,14 +10599,14 @@ static void test_message_conversion(void)
     lRes = SendMessageA (hwnd, WM_GETTEXTLENGTH, 0, 0);
     ok_sequence(WmGetTextLengthAfromW, "ANSI WM_GETTEXTLENGTH to Unicode window", FALSE);
     ok( lRes == WideCharToMultiByte( CP_ACP, 0, wszUnicode, lstrlenW(wszUnicode), NULL, 0, NULL, NULL ),
-        "got bad length %ld\n", lRes );
+        "got bad length %Id\n", lRes );
 
     flush_sequence();
     lRes = CallWindowProcA( (WNDPROC)GetWindowLongPtrA( hwnd, GWLP_WNDPROC ),
                             hwnd, WM_GETTEXTLENGTH, 0, 0);
     ok_sequence(WmGetTextLengthAfromW, "ANSI WM_GETTEXTLENGTH to Unicode window", FALSE);
     ok( lRes == WideCharToMultiByte( CP_ACP, 0, wszUnicode, lstrlenW(wszUnicode), NULL, 0, NULL, NULL ),
-        "got bad length %ld\n", lRes );
+        "got bad length %Id\n", lRes );
 
     wndproc = (WNDPROC)SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)get_text_len_proc );
     newproc = (WNDPROC)GetWindowLongPtrA( hwnd, GWLP_WNDPROC );
@@ -10613,17 +10614,17 @@ static void test_message_conversion(void)
     ok( lRes == WideCharToMultiByte( CP_ACP, 0, dummy_window_text, lstrlenW(dummy_window_text),
                                      NULL, 0, NULL, NULL ) ||
         broken(lRes == lstrlenW(dummy_window_text) + 37),
-        "got bad length %ld\n", lRes );
+        "got bad length %Id\n", lRes );
 
     SetWindowLongPtrW( hwnd, GWLP_WNDPROC, (LONG_PTR)wndproc );  /* restore old wnd proc */
     lRes = CallWindowProcA( newproc, hwnd, WM_GETTEXTLENGTH, 0, 0 );
     ok( lRes == WideCharToMultiByte( CP_ACP, 0, dummy_window_text, lstrlenW(dummy_window_text),
                                      NULL, 0, NULL, NULL ) ||
         broken(lRes == lstrlenW(dummy_window_text) + 37),
-        "got bad length %ld\n", lRes );
+        "got bad length %Id\n", lRes );
 
     ret = DestroyWindow(hwnd);
-    ok( ret, "DestroyWindow() error %d\n", GetLastError());
+    ok( ret, "DestroyWindow() error %ld\n", GetLastError());
 }
 
 struct timer_info
@@ -10755,7 +10756,7 @@ static void test_timers_no_wnd(void)
     id = SetTimer(NULL, 0, 100, callback_count);
     ok(id != 0, "did not get id from SetTimer.\n");
     id2 = SetTimer(NULL, id, 200, callback_count);
-    ok(id2 == id, "did not get same id from SetTimer when replacing (%li expected %li).\n", id2, id);
+    ok(id2 == id, "did not get same id from SetTimer when replacing (%Ii expected %Ii).\n", id2, id);
     Sleep(150);
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok(count == 0, "did not get zero count as expected (%i).\n", count);
@@ -10790,7 +10791,7 @@ static void test_timers_no_wnd(void)
     {
         count = 0;
         id = pSetCoalescableTimer(NULL, 0, 0, callback_count, 0);
-        ok(id != 0, "SetCoalescableTimer failed with %u.\n", GetLastError());
+        ok(id != 0, "SetCoalescableTimer failed with %lu.\n", GetLastError());
         start = GetTickCount();
         while (GetTickCount()-start < 100 && GetMessageA(&msg, NULL, 0, 0))
             DispatchMessageA(&msg);
@@ -10809,7 +10810,7 @@ static void test_timers_no_wnd(void)
     }
     ok(i != ARRAY_SIZE(ids), "all timers were created successfully\n");
     ok(GetLastError()==ERROR_NO_MORE_USER_HANDLES || broken(GetLastError()==0xdeadbeef),
-            "GetLastError() = %d\n", GetLastError());
+            "GetLastError() = %ld\n", GetLastError());
     while (i > 0) KillTimer(NULL, ids[--i]);
 }
 
@@ -11141,7 +11142,7 @@ static void test_winevents(void)
     hwnd2 = hevent;
 
     hthread = CreateThread(NULL, 0, cbt_global_hook_thread_proc, &hwnd2, 0, &tid);
-    ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hthread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hevent, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
 
@@ -11156,7 +11157,7 @@ static void test_winevents(void)
     ok_sequence(WmGlobalHookSeq_2, "global hook 2", FALSE);
 
     ret = UnhookWindowsHookEx(hCBT_global_hook);
-    ok( ret, "UnhookWindowsHookEx error %d\n", GetLastError());
+    ok( ret, "UnhookWindowsHookEx error %ld\n", GetLastError());
 
     PostThreadMessageA(tid, WM_QUIT, 0, 0);
     ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
@@ -11181,7 +11182,7 @@ static void test_winevents(void)
     pNotifyWinEvent(events[0].message, 0, events[0].wParam, events[0].lParam);
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || /* Win2k */
        GetLastError() == 0xdeadbeef, /* Win9x */
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
     ok_sequence(WmEmptySeq, "empty notify winevents", FALSE);
     }
 
@@ -11197,14 +11198,14 @@ static void test_winevents(void)
 	GetModuleHandleA(0), win_event_global_hook_proc,
 	GetCurrentProcessId(), 0,
 	WINEVENT_INCONTEXT);
-    ok(hhook != 0, "SetWinEventHook error %d\n", GetLastError());
+    ok(hhook != 0, "SetWinEventHook error %ld\n", GetLastError());
 
     hevent = CreateEventA(NULL, 0, 0, NULL);
     assert(hevent);
     hwnd2 = hevent;
 
     hthread = CreateThread(NULL, 0, win_event_global_thread_proc, &hwnd2, 0, &tid);
-    ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hthread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hevent, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
 
@@ -11220,7 +11221,7 @@ static void test_winevents(void)
     ok_sequence(WmWinEventCaretSeq, "caret winevent", FALSE);
 
     ret = pUnhookWinEvent(hhook);
-    ok( ret, "UnhookWinEvent error %d\n", GetLastError());
+    ok( ret, "UnhookWinEvent error %ld\n", GetLastError());
 
     PostThreadMessageA(tid, WM_QUIT, 0, 0);
     ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
@@ -11233,7 +11234,7 @@ static void test_winevents(void)
     hhook = pSetWinEventHook(EVENT_MIN, EVENT_MAX, 0,
         win_event_global_hook_proc, GetCurrentProcessId(), 0,
 	WINEVENT_OUTOFCONTEXT);
-    ok(hhook != 0, "SetWinEventHook error %d\n", GetLastError());
+    ok(hhook != 0, "SetWinEventHook error %ld\n", GetLastError());
 
     hevent = CreateEventA(NULL, 0, 0, NULL);
     assert(hevent);
@@ -11242,7 +11243,7 @@ static void test_winevents(void)
     flush_sequence();
 
     hthread = CreateThread(NULL, 0, win_event_global_thread_proc, &hwnd2, 0, &tid);
-    ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hthread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     ok(WaitForSingleObject(hevent, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
 
@@ -11264,7 +11265,7 @@ static void test_winevents(void)
     ok_sequence(WmWinEventCaretSeq_2, "caret winevent for out of context proc", FALSE);
 
     ret = pUnhookWinEvent(hhook);
-    ok( ret, "UnhookWinEvent error %d\n", GetLastError());
+    ok( ret, "UnhookWinEvent error %ld\n", GetLastError());
 
     PostThreadMessageA(tid, WM_QUIT, 0, 0);
     ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
@@ -11287,7 +11288,7 @@ static void test_winevents(void)
     hwnd2 = hevent;
 
     hthread = CreateThread(NULL, 0, mouse_ll_global_thread_proc, &hwnd2, 0, &tid);
-    ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hthread != NULL, "CreateThread failed, error %ld\n", GetLastError());
 
     while (WaitForSingleObject(hevent, 100) == WAIT_TIMEOUT)
         while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
@@ -11302,7 +11303,7 @@ static void test_winevents(void)
     ok_sequence(WmMouseLLHookSeq, "MOUSE_LL hook same thread", FALSE);
 
     ret = UnhookWindowsHookEx(hCBT_global_hook);
-    ok( ret, "UnhookWindowsHookEx error %d\n", GetLastError());
+    ok( ret, "UnhookWindowsHookEx error %ld\n", GetLastError());
 
     PostThreadMessageA(tid, WM_QUIT, 0, 0);
     ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
@@ -11331,7 +11332,7 @@ static void test_set_hook(void)
     SetLastError(0xdeadbeef);
     hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, 0);
     ok(!hhook, "global hook requires hModule != 0\n");
-    ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD, "unexpected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD, "unexpected error %ld\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
@@ -11339,13 +11340,13 @@ static void test_set_hook(void)
     ok(!hhook, "SetWinEventHook with invalid proc should fail\n");
     ok(GetLastError() == ERROR_INVALID_FILTER_PROC || /* Win2k */
        GetLastError() == 0xdeadbeef, /* Win9x */
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ok(!UnhookWindowsHookEx((HHOOK)0xdeadbeef), "UnhookWindowsHookEx succeeded\n");
     ok(GetLastError() == ERROR_INVALID_HOOK_HANDLE || /* Win2k */
        GetLastError() == 0xdeadbeef, /* Win9x */
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     if (!pSetWinEventHook || !pUnhookWinEvent) return;
 
@@ -11356,7 +11357,7 @@ static void test_set_hook(void)
     ok(!hwinevent_hook, "WINEVENT_INCONTEXT requires hModule != 0\n");
     ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD || /* Win2k */
        GetLastError() == 0xdeadbeef, /* Win9x */
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* even thread local incontext hooks require hmodule */
     SetLastError(0xdeadbeef);
@@ -11365,7 +11366,7 @@ static void test_set_hook(void)
     ok(!hwinevent_hook, "WINEVENT_INCONTEXT requires hModule != 0\n");
     ok(GetLastError() == ERROR_HOOK_NEEDS_HMOD || /* Win2k */
        GetLastError() == 0xdeadbeef, /* Win9x */
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     if (0)
     {
@@ -11374,28 +11375,28 @@ static void test_set_hook(void)
     hwinevent_hook = pSetWinEventHook(1, 0, 0, win_event_proc,
         GetCurrentProcessId(), 0, WINEVENT_OUTOFCONTEXT);
     ok(!hwinevent_hook, "SetWinEventHook with invalid event range should fail\n");
-    ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     hwinevent_hook = pSetWinEventHook(-1, 1, 0, win_event_proc,
         GetCurrentProcessId(), 0, WINEVENT_OUTOFCONTEXT);
     ok(!hwinevent_hook, "SetWinEventHook with invalid event range should fail\n");
-    ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HOOK_FILTER, "unexpected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     hwinevent_hook = pSetWinEventHook(EVENT_MIN, EVENT_MAX, 0, win_event_proc,
         0, 0xdeadbeef, WINEVENT_OUTOFCONTEXT);
     ok(!hwinevent_hook, "SetWinEventHook with invalid tid should fail\n");
-    ok(GetLastError() == ERROR_INVALID_THREAD_ID, "unexpected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_THREAD_ID, "unexpected error %ld\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
     hwinevent_hook = pSetWinEventHook(0, 0, 0, win_event_proc,
         GetCurrentProcessId(), 0, WINEVENT_OUTOFCONTEXT);
-    ok(hwinevent_hook != 0, "SetWinEventHook error %d\n", GetLastError());
-    ok(GetLastError() == 0xdeadbeef, "unexpected error %d\n", GetLastError());
+    ok(hwinevent_hook != 0, "SetWinEventHook error %ld\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "unexpected error %ld\n", GetLastError());
     ret = pUnhookWinEvent(hwinevent_hook);
-    ok( ret, "UnhookWinEvent error %d\n", GetLastError());
+    ok( ret, "UnhookWinEvent error %ld\n", GetLastError());
 
 todo_wine {
     /* This call succeeds under win2k SP4, but fails under Wine.
@@ -11403,17 +11404,17 @@ todo_wine {
     SetLastError(0xdeadbeef);
     hwinevent_hook = pSetWinEventHook(EVENT_MIN, EVENT_MAX, 0, win_event_proc,
         0xdeadbeef, 0, WINEVENT_OUTOFCONTEXT);
-    ok(hwinevent_hook != 0, "SetWinEventHook error %d\n", GetLastError());
-    ok(GetLastError() == 0xdeadbeef, "unexpected error %d\n", GetLastError());
+    ok(hwinevent_hook != 0, "SetWinEventHook error %ld\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "unexpected error %ld\n", GetLastError());
     ret = pUnhookWinEvent(hwinevent_hook);
-    ok( ret, "UnhookWinEvent error %d\n", GetLastError());
+    ok( ret, "UnhookWinEvent error %ld\n", GetLastError());
 }
 
     SetLastError(0xdeadbeef);
     ok(!pUnhookWinEvent((HWINEVENTHOOK)0xdeadbeef), "UnhookWinEvent succeeded\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE || /* Win2k */
 	GetLastError() == 0xdeadbeef, /* Win9x */
-	"unexpected error %d\n", GetLastError());
+	"unexpected error %ld\n", GetLastError());
 }
 
 static HWND hook_hwnd;
@@ -11662,7 +11663,7 @@ static void test_DestroyWindow(void)
 
     test_DestroyWindow_flag = TRUE;
     ret = DestroyWindow(parent);
-    ok( ret, "DestroyWindow() error %d\n", GetLastError());
+    ok( ret, "DestroyWindow() error %ld\n", GetLastError());
     test_DestroyWindow_flag = FALSE;
     ok_sequence(destroy_window_with_children, "destroy window with children", FALSE);
 
@@ -11788,7 +11789,7 @@ static DWORD CALLBACK send_msg_thread( LPVOID arg )
     info->ret = SendMessageTimeoutA( info->hwnd, WM_USER, 0, 0, 0, info->timeout, NULL );
     if (!info->ret) ok( GetLastError() == ERROR_TIMEOUT ||
                         broken(GetLastError() == 0),  /* win9x */
-                        "unexpected error %d\n", GetLastError());
+                        "unexpected error %ld\n", GetLastError());
     return 0;
 }
 
@@ -12083,7 +12084,7 @@ static void test_edit_messages(void)
     ok(hwnd != 0, "Failed to create edit window\n");
 
     dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
-    ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS), "wrong dlg_code %08x\n", dlg_code);
+    ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS), "wrong dlg_code %08lx\n", dlg_code);
 
     flush_sequence();
     SetFocus(hwnd);
@@ -12126,7 +12127,7 @@ static void test_edit_messages(void)
 
     dlg_code = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0);
     ok(dlg_code == (DLGC_WANTCHARS|DLGC_HASSETSEL|DLGC_WANTARROWS|DLGC_WANTALLKEYS),
-       "wrong dlg_code %08x\n", dlg_code);
+       "wrong dlg_code %08lx\n", dlg_code);
 
     ShowWindow(hwnd, SW_SHOW);
     UpdateWindow(hwnd);
@@ -12217,12 +12218,12 @@ static DWORD CALLBACK send_msg_thread_2(void *param)
         case WAIT_OBJECT_0 + EV_SENDMSG:
             trace("thread: sending message\n");
             ret = SendNotifyMessageA(info->hwnd, WM_USER, 0, 0);
-            ok(ret, "SendNotifyMessageA failed error %u\n", GetLastError());
+            ok(ret, "SendNotifyMessageA failed error %lu\n", GetLastError());
             SetEvent(info->hevent[EV_ACK]);
             break;
 
         default:
-            trace("unexpected return: %04x\n", ret);
+            trace("unexpected return: %04lx\n", ret);
             assert(0);
             break;
         }
@@ -12270,7 +12271,7 @@ static void test_PeekMessage(void)
         while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) /* nothing */ ;
         qstatus = GetQueueStatus(qs_all_input);
     }
-    ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == 0, "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
@@ -12279,15 +12280,15 @@ static void test_PeekMessage(void)
     /* pass invalid QS_xxxx flags */
     SetLastError(0xdeadbeef);
     qstatus = GetQueueStatus(0xffffffff);
-    ok(qstatus == 0 || broken(qstatus)  /* win9x */, "GetQueueStatus should fail: %08x\n", qstatus);
+    ok(qstatus == 0 || broken(qstatus)  /* win9x */, "GetQueueStatus should fail: %08lx\n", qstatus);
     if (!qstatus)
     {
-        ok(GetLastError() == ERROR_INVALID_FLAGS, "wrong error %d\n", GetLastError());
+        ok(GetLastError() == ERROR_INVALID_FLAGS, "wrong error %ld\n", GetLastError());
         qstatus = GetQueueStatus(qs_all_input);
     }
     qstatus &= ~MAKELONG( 0x4000, 0x4000 );  /* sometimes set on Win95 */
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
@@ -12297,7 +12298,7 @@ static void test_PeekMessage(void)
     ok_sequence(WmUser, "WmUser", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == 0, "wrong qstatus %08lx\n", qstatus);
 
     keybd_event('N', 0, 0, 0);
     keybd_event('N', 0, KEYEVENTF_KEYUP, 0);
@@ -12310,19 +12311,19 @@ static void test_PeekMessage(void)
     ok(qstatus == MAKELONG(QS_KEY, QS_KEY) ||
        /* keybd_event seems to trigger a sent message on NT4 */
        qstatus == MAKELONG(QS_KEY|QS_SENDMESSAGE, QS_KEY|QS_SENDMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY) ||
        qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY|QS_SENDMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     InvalidateRect(info.hwnd, NULL, FALSE);
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_PAINT, QS_PAINT|QS_POSTMESSAGE|QS_KEY) ||
        qstatus == MAKELONG(QS_PAINT, QS_PAINT|QS_POSTMESSAGE|QS_KEY|QS_SENDMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
@@ -12330,7 +12331,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_PAINT|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | (qs_input << 16));
@@ -12351,7 +12352,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_PAINT|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
@@ -12359,7 +12360,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_PAINT|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_POSTMESSAGE );
@@ -12370,18 +12371,18 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_PAINT|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_POSTMESSAGE);
     ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-       "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+       "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
        ret, msg.message, msg.wParam);
     ok_sequence(WmEmptySeq, "WmEmptySeq", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_PAINT|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_POSTMESSAGE);
@@ -12392,7 +12393,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_PAINT|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_PAINT);
@@ -12403,7 +12404,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_PAINT);
@@ -12414,7 +12415,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
@@ -12422,24 +12423,24 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, WM_CHAR, WM_CHAR, PM_REMOVE);
     ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-       "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+       "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
        ret, msg.message, msg.wParam);
     ok_sequence(WmUser, "WmUser", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, WM_CHAR, WM_CHAR, PM_REMOVE);
@@ -12450,13 +12451,13 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
@@ -12464,7 +12465,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | (QS_KEY << 16));
@@ -12475,7 +12476,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     if (qs_all_input & QS_RAWINPUT) /* use QS_RAWINPUT only if supported */
@@ -12483,13 +12484,13 @@ static void test_PeekMessage(void)
     else /* workaround for a missing QS_RAWINPUT support */
         ret = PeekMessageA(&msg, 0, WM_KEYDOWN, WM_KEYDOWN, PM_REMOVE);
     ok(ret && msg.message == WM_KEYDOWN && msg.wParam == 'N',
-       "got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N'\n",
+       "got %d and %04x wParam %08Ix instead of TRUE and WM_KEYDOWN wParam 'N'\n",
        ret, msg.message, msg.wParam);
     ok_sequence(WmKeyDownSkippedSeq, "WmKeyDownSkippedSeq", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     if (qs_all_input & QS_RAWINPUT) /* use QS_RAWINPUT only if supported */
@@ -12497,13 +12498,13 @@ static void test_PeekMessage(void)
     else /* workaround for a missing QS_RAWINPUT support */
         ret = PeekMessageA(&msg, 0, WM_KEYUP, WM_KEYUP, PM_REMOVE);
     ok(ret && msg.message == WM_KEYUP && msg.wParam == 'N',
-       "got %d and %04x wParam %08lx instead of TRUE and WM_KEYUP wParam 'N'\n",
+       "got %d and %04x wParam %08Ix instead of TRUE and WM_KEYUP wParam 'N'\n",
        ret, msg.message, msg.wParam);
     ok_sequence(WmKeyUpSkippedSeq, "WmKeyUpSkippedSeq", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE);
@@ -12514,18 +12515,18 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
     ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-       "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+       "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
        ret, msg.message, msg.wParam);
     ok_sequence(WmEmptySeq, "WmEmptySeq", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == 0,
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
@@ -12536,7 +12537,7 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == 0,
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     /* test whether presence of the quit flag in the queue affects
      * the queue state
@@ -12545,13 +12546,13 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_USER, 0, 0);
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
@@ -12561,20 +12562,20 @@ static void test_PeekMessage(void)
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     msg.message = 0;
     ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
     ok(ret && msg.message == WM_QUIT,
        "got %d and %04x instead of TRUE and WM_QUIT\n", ret, msg.message);
-    ok(msg.wParam == 0x1234abcd, "got wParam %08lx instead of 0x1234abcd\n", msg.wParam);
-    ok(msg.lParam == 0, "got lParam %08lx instead of 0\n", msg.lParam);
+    ok(msg.wParam == 0x1234abcd, "got wParam %08Ix instead of 0x1234abcd\n", msg.wParam);
+    ok(msg.lParam == 0, "got lParam %08Ix instead of 0\n", msg.lParam);
     ok_sequence(WmEmptySeq, "WmEmptySeq", FALSE);
 
     qstatus = GetQueueStatus(qs_all_input);
 todo_wine {
     ok(qstatus == MAKELONG(0, QS_POSTMESSAGE),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 }
 
     msg.message = 0;
@@ -12586,102 +12587,102 @@ todo_wine {
 
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == 0,
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     /* some GetMessage tests */
 
     keybd_event('N', 0, 0, 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     if (qstatus)
     {
         ret = GetMessageA( &msg, 0, 0, 0 );
         ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
            ret, msg.message, msg.wParam);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == MAKELONG(0, QS_KEY), "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == MAKELONG(0, QS_KEY), "wrong qstatus %08lx\n", qstatus);
     }
 
     if (qstatus)
     {
         ret = GetMessageA( &msg, 0, 0, 0 );
         ok(ret && msg.message == WM_KEYDOWN && msg.wParam == 'N',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_KEYDOWN wParam 'N'\n",
            ret, msg.message, msg.wParam);
         ok_sequence(WmKeyDownSkippedSeq, "WmKeyDownSkippedSeq", FALSE);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == 0, "wrong qstatus %08lx\n", qstatus);
     }
 
     keybd_event('N', 0, 0, 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     if (qstatus & (QS_KEY << 16))
     {
         ret = GetMessageA( &msg, 0, WM_KEYDOWN, WM_KEYUP );
         ok(ret && msg.message == WM_KEYDOWN && msg.wParam == 'N',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_KEYDOWN wParam 'N'\n",
            ret, msg.message, msg.wParam);
         ok_sequence(WmKeyDownWasDownSkippedSeq, "WmKeyDownWasDownSkippedSeq", FALSE);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == MAKELONG(0, QS_POSTMESSAGE), "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == MAKELONG(0, QS_POSTMESSAGE), "wrong qstatus %08lx\n", qstatus);
     }
 
     if (qstatus)
     {
         ret = GetMessageA( &msg, 0, WM_CHAR, WM_CHAR );
         ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
            ret, msg.message, msg.wParam);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == 0, "wrong qstatus %08lx\n", qstatus);
     }
 
     keybd_event('N', 0, KEYEVENTF_KEYUP, 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_KEY, QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
     qstatus = GetQueueStatus(qs_all_input);
-    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08x\n", qstatus);
+    ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY), "wrong qstatus %08lx\n", qstatus);
 
     trace("signalling to send message\n");
     SetEvent(info.hevent[EV_SENDMSG]);
     WaitForSingleObject(info.hevent[EV_ACK], INFINITE);
     qstatus = GetQueueStatus(qs_all_input);
     ok(qstatus == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE|QS_KEY),
-       "wrong qstatus %08x\n", qstatus);
+       "wrong qstatus %08lx\n", qstatus);
 
     if (qstatus & (QS_KEY << 16))
     {
         ret = GetMessageA( &msg, 0, WM_KEYDOWN, WM_KEYUP );
         ok(ret && msg.message == WM_KEYUP && msg.wParam == 'N',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_KEYDOWN wParam 'N'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_KEYDOWN wParam 'N'\n",
            ret, msg.message, msg.wParam);
         ok_sequence(WmUserKeyUpSkippedSeq, "WmUserKeyUpSkippedSeq", FALSE);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == MAKELONG(0, QS_POSTMESSAGE), "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == MAKELONG(0, QS_POSTMESSAGE), "wrong qstatus %08lx\n", qstatus);
     }
 
     if (qstatus)
     {
         ret = GetMessageA( &msg, 0, WM_CHAR, WM_CHAR );
         ok(ret && msg.message == WM_CHAR && msg.wParam == 'z',
-           "got %d and %04x wParam %08lx instead of TRUE and WM_CHAR wParam 'z'\n",
+           "got %d and %04x wParam %08Ix instead of TRUE and WM_CHAR wParam 'z'\n",
            ret, msg.message, msg.wParam);
         qstatus = GetQueueStatus(qs_all_input);
-        ok(qstatus == 0, "wrong qstatus %08x\n", qstatus);
+        ok(qstatus == 0, "wrong qstatus %08lx\n", qstatus);
     }
 
     PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
@@ -12778,7 +12779,7 @@ static void test_PeekMessage2(void)
     }
     else
     {
-	trace("1st move event: %04x %x %d %d\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
+	trace("1st move event: %04x %lx %ld %ld\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
 	message = msg.message;
 	time1 = msg.time;
 	x1 = msg.pt.x;
@@ -12798,13 +12799,13 @@ static void test_PeekMessage2(void)
     ret = PeekMessageA(&msg, hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOREMOVE);
     ok(ret, "no message available\n");
     if (ret) {
-	trace("2nd move event: %04x %x %d %d\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
+	trace("2nd move event: %04x %lx %ld %ld\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
 	message = msg.message;
 	time2 = msg.time;
 	x2 = msg.pt.x;
 	y2 = msg.pt.y;
         ok(message == WM_MOUSEMOVE, "message not WM_MOUSEMOVE, %04x instead\n", message);
-	ok(time2 > time1, "message time not advanced: %x %x\n", time1, time2);
+	ok(time2 > time1, "message time not advanced: %lx %lx\n", time1, time2);
 	ok(x2 != x1 && y2 != y1, "coords not changed: (%d %d) (%d %d)\n", x1, y1, x2, y2);
     }
 
@@ -12816,13 +12817,13 @@ static void test_PeekMessage2(void)
     ret = PeekMessageA(&msg, hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_NOREMOVE);
     ok(ret, "no message available\n");
     if (ret) {
-	trace("3rd move event: %04x %x %d %d\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
+	trace("3rd move event: %04x %lx %ld %ld\n", msg.message, msg.time, msg.pt.x, msg.pt.y);
 	message = msg.message;
 	time3 = msg.time;
 	x3 = msg.pt.x;
 	y3 = msg.pt.y;
         ok(message == WM_MOUSEMOVE, "message not WM_MOUSEMOVE, %04x instead\n", message);
-	ok(time3 > time2, "message time not advanced: %x %x\n", time2, time3);
+	ok(time3 > time2, "message time not advanced: %lx %lx\n", time2, time3);
 	ok(x3 != x2 && y3 != y2, "coords not changed: (%d %d) (%d %d)\n", x2, y2, x3, y3);
     }
 
@@ -13018,22 +13019,22 @@ static void test_quit_message(void)
     ok(!ret, "got %x message\n", msg.message);
 
     ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
-    ok(ret, "PeekMessage failed with error %d\n", GetLastError());
+    ok(ret, "PeekMessage failed with error %ld\n", GetLastError());
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
-    ok(msg.wParam == 0xbeef, "wParam was 0x%lx instead of 0xbeef\n", msg.wParam);
+    ok(msg.wParam == 0xbeef, "wParam was 0x%Ix instead of 0xbeef\n", msg.wParam);
 
     ret = PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
-    ok(ret, "PostMessage failed with error %d\n", GetLastError());
+    ok(ret, "PostMessage failed with error %ld\n", GetLastError());
 
     ret = GetMessageA(&msg, NULL, 0, 0);
-    ok(ret > 0, "GetMessage failed with error %d\n", GetLastError());
+    ok(ret > 0, "GetMessage failed with error %ld\n", GetLastError());
     ok(msg.message == WM_USER, "Received message 0x%04x instead of WM_USER\n", msg.message);
 
     /* note: WM_QUIT message received after WM_USER message */
     ret = GetMessageA(&msg, NULL, 0, 0);
-    ok(!ret, "GetMessage return %d with error %d instead of FALSE\n", ret, GetLastError());
+    ok(!ret, "GetMessage return %d with error %ld instead of FALSE\n", ret, GetLastError());
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
-    ok(msg.wParam == 0xbeef, "wParam was 0x%lx instead of 0xbeef\n", msg.wParam);
+    ok(msg.wParam == 0xbeef, "wParam was 0x%Ix instead of 0xbeef\n", msg.wParam);
 
     ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE);
     ok( !ret || msg.message != WM_QUIT, "Received WM_QUIT again\n" );
@@ -13042,21 +13043,21 @@ static void test_quit_message(void)
     PostThreadMessageA(GetCurrentThreadId(), WM_QUIT, 0xdead, 0);
 
     ret = PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE);
-    ok(ret, "PeekMessage failed with error %d\n", GetLastError());
+    ok(ret, "PeekMessage failed with error %ld\n", GetLastError());
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
-    ok(msg.wParam == 0xdead, "wParam was 0x%lx instead of 0xdead\n", msg.wParam);
+    ok(msg.wParam == 0xdead, "wParam was 0x%Ix instead of 0xdead\n", msg.wParam);
 
     ret = PostThreadMessageA(GetCurrentThreadId(), WM_USER, 0, 0);
-    ok(ret, "PostMessage failed with error %d\n", GetLastError());
+    ok(ret, "PostMessage failed with error %ld\n", GetLastError());
 
     /* note: we receive the WM_QUIT message first this time */
     ret = GetMessageA(&msg, NULL, 0, 0);
-    ok(!ret, "GetMessage return %d with error %d instead of FALSE\n", ret, GetLastError());
+    ok(!ret, "GetMessage return %d with error %ld instead of FALSE\n", ret, GetLastError());
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
-    ok(msg.wParam == 0xdead, "wParam was 0x%lx instead of 0xdead\n", msg.wParam);
+    ok(msg.wParam == 0xdead, "wParam was 0x%Ix instead of 0xdead\n", msg.wParam);
 
     ret = GetMessageA(&msg, NULL, 0, 0);
-    ok(ret > 0, "GetMessage failed with error %d\n", GetLastError());
+    ok(ret > 0, "GetMessage failed with error %ld\n", GetLastError());
     ok(msg.message == WM_USER, "Received message 0x%04x instead of WM_USER\n", msg.message);
 
     flush_events();
@@ -13068,8 +13069,8 @@ static void test_quit_message(void)
     ret = PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE);
     ok(ret, "PeekMessage failed\n");
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
-    ok(msg.wParam == 0x1234, "wParam was 0x%lx instead of 0x1234\n", msg.wParam);
-    ok(msg.lParam == 0, "lParam was 0x%lx instead of 0\n", msg.lParam);
+    ok(msg.wParam == 0x1234, "wParam was 0x%Ix instead of 0x1234\n", msg.wParam);
+    ok(msg.lParam == 0, "lParam was 0x%Ix instead of 0\n", msg.lParam);
 
     /* Check what happens to a WM_QUIT message posted to a window that gets
      * destroyed.
@@ -13113,33 +13114,33 @@ static void test_notify_message(void)
     flush_sequence();
 
     ret = SendNotifyMessageA(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "SendNotifyMessageA failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "SendNotifyMessageA failed with error %lu\n", GetLastError());
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = SendNotifyMessageW(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "SendNotifyMessageW failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "SendNotifyMessageW failed with error %lu\n", GetLastError());
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = SendMessageCallbackA(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef, NULL, 0);
-    ok(ret == TRUE, "SendMessageCallbackA failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "SendMessageCallbackA failed with error %lu\n", GetLastError());
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = SendMessageCallbackW(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef, NULL, 0);
-    ok(ret == TRUE, "SendMessageCallbackW failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "SendMessageCallbackW failed with error %lu\n", GetLastError());
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = PostMessageA(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "PostMessageA failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "PostMessageA failed with error %lu\n", GetLastError());
     flush_events();
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = PostMessageW(hwnd, WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "PostMessageW failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "PostMessageW failed with error %lu\n", GetLastError());
     flush_events();
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = PostThreadMessageA(GetCurrentThreadId(), WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "PostThreadMessageA failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "PostThreadMessageA failed with error %lu\n", GetLastError());
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
         msg.hwnd = hwnd;
@@ -13148,7 +13149,7 @@ static void test_notify_message(void)
     ok_sequence(WmNotifySeq, "WmNotifySeq", FALSE);
 
     ret = PostThreadMessageW(GetCurrentThreadId(), WM_NOTIFY, 0x1234, 0xdeadbeef);
-    ok(ret == TRUE, "PostThreadMessageW failed with error %u\n", GetLastError());
+    ok(ret == TRUE, "PostThreadMessageW failed with error %lu\n", GetLastError());
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
     {
         msg.hwnd = hwnd;
@@ -13228,7 +13229,7 @@ static void test_TrackMouseEvent(void)
     tme.dwHoverTime = track_hover_time; \
     SetLastError(0xdeadbeef); \
     ret = pTrackMouseEvent(&tme); \
-    ok(ret, "TrackMouseEvent(TME_HOVER) error %d\n", GetLastError())
+    ok(ret, "TrackMouseEvent(TME_HOVER) error %ld\n", GetLastError())
 
 #define track_query(expected_track_flags, expected_track_hwnd, expected_hover_time) \
     tme.cbSize = sizeof(tme); \
@@ -13237,14 +13238,14 @@ static void test_TrackMouseEvent(void)
     tme.dwHoverTime = 0xdeadbeef; \
     SetLastError(0xdeadbeef); \
     ret = pTrackMouseEvent(&tme); \
-    ok(ret, "TrackMouseEvent(TME_QUERY) error %d\n", GetLastError());\
-    ok(tme.cbSize == sizeof(tme), "wrong tme.cbSize %u\n", tme.cbSize); \
+    ok(ret, "TrackMouseEvent(TME_QUERY) error %ld\n", GetLastError());\
+    ok(tme.cbSize == sizeof(tme), "wrong tme.cbSize %lu\n", tme.cbSize); \
     ok(tme.dwFlags == (expected_track_flags), \
-       "wrong tme.dwFlags %08x, expected %08x\n", tme.dwFlags, (expected_track_flags)); \
+       "wrong tme.dwFlags %08lx, expected %08x\n", tme.dwFlags, (expected_track_flags)); \
     ok(tme.hwndTrack == (expected_track_hwnd), \
        "wrong tme.hwndTrack %p, expected %p\n", tme.hwndTrack, (expected_track_hwnd)); \
     ok(tme.dwHoverTime == (expected_hover_time), \
-       "wrong tme.dwHoverTime %u, expected %u\n", tme.dwHoverTime, (expected_hover_time))
+       "wrong tme.dwHoverTime %lu, expected %u\n", tme.dwHoverTime, (expected_hover_time))
 
 #define track_hover_cancel(track_hwnd) \
     tme.cbSize = sizeof(tme); \
@@ -13253,25 +13254,25 @@ static void test_TrackMouseEvent(void)
     tme.dwHoverTime = 0xdeadbeef; \
     SetLastError(0xdeadbeef); \
     ret = pTrackMouseEvent(&tme); \
-    ok(ret, "TrackMouseEvent(TME_HOVER | TME_CANCEL) error %d\n", GetLastError())
+    ok(ret, "TrackMouseEvent(TME_HOVER | TME_CANCEL) error %ld\n", GetLastError())
 
     default_hover_time = 0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = SystemParametersInfoA(SPI_GETMOUSEHOVERTIME, 0, &default_hover_time, 0);
     ok(ret || broken(GetLastError() == 0xdeadbeef),  /* win9x */
-       "SystemParametersInfo(SPI_GETMOUSEHOVERTIME) error %u\n", GetLastError());
+       "SystemParametersInfo(SPI_GETMOUSEHOVERTIME) error %lu\n", GetLastError());
     if (!ret) default_hover_time = 400;
     trace("SPI_GETMOUSEHOVERTIME returned %u ms\n", default_hover_time);
 
     SetLastError(0xdeadbeef);
     ret = SystemParametersInfoA(SPI_GETMOUSEHOVERWIDTH, 0, &hover_width, 0);
     ok(ret || broken(GetLastError() == 0xdeadbeef),  /* win9x */
-       "SystemParametersInfo(SPI_GETMOUSEHOVERWIDTH) error %u\n", GetLastError());
+       "SystemParametersInfo(SPI_GETMOUSEHOVERWIDTH) error %lu\n", GetLastError());
     if (!ret) hover_width = 4;
     SetLastError(0xdeadbeef);
     ret = SystemParametersInfoA(SPI_GETMOUSEHOVERHEIGHT, 0, &hover_height, 0);
     ok(ret || broken(GetLastError() == 0xdeadbeef),  /* win9x */
-       "SystemParametersInfo(SPI_GETMOUSEHOVERHEIGHT) error %u\n", GetLastError());
+       "SystemParametersInfo(SPI_GETMOUSEHOVERHEIGHT) error %lu\n", GetLastError());
     if (!ret) hover_height = 4;
     trace("hover rect is %u x %d\n", hover_width, hover_height);
 
@@ -13299,7 +13300,7 @@ static void test_TrackMouseEvent(void)
     ret = pTrackMouseEvent(&tme);
     ok(!ret, "TrackMouseEvent should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef),
-       "not expected error %u\n", GetLastError());
+       "not expected error %lu\n", GetLastError());
 
     tme.cbSize = sizeof(tme);
     tme.dwFlags = TME_HOVER;
@@ -13309,7 +13310,7 @@ static void test_TrackMouseEvent(void)
     ret = pTrackMouseEvent(&tme);
     ok(!ret, "TrackMouseEvent should fail\n");
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
-       "not expected error %u\n", GetLastError());
+       "not expected error %lu\n", GetLastError());
 
     tme.cbSize = sizeof(tme);
     tme.dwFlags = TME_HOVER | TME_CANCEL;
@@ -13319,7 +13320,7 @@ static void test_TrackMouseEvent(void)
     ret = pTrackMouseEvent(&tme);
     ok(!ret, "TrackMouseEvent should fail\n");
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
-       "not expected error %u\n", GetLastError());
+       "not expected error %lu\n", GetLastError());
 
     GetWindowRect(hwnd, &rc_parent);
     GetWindowRect(hchild, &rc_child);
@@ -13346,17 +13347,17 @@ static void test_TrackMouseEvent(void)
     tme.dwHoverTime = 0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = pTrackMouseEvent(&tme);
-    ok(ret, "TrackMouseEvent(TME_QUERY) error %d\n", GetLastError());
-    ok(tme.cbSize == sizeof(tme), "wrong tme.cbSize %u\n", tme.cbSize);
+    ok(ret, "TrackMouseEvent(TME_QUERY) error %ld\n", GetLastError());
+    ok(tme.cbSize == sizeof(tme), "wrong tme.cbSize %lu\n", tme.cbSize);
     if (!tme.dwFlags)
     {
         skip( "Cursor not inside window, skipping TrackMouseEvent tests\n" );
         DestroyWindow( hwnd );
         return;
     }
-    ok(tme.dwFlags == TME_HOVER, "wrong tme.dwFlags %08x, expected TME_HOVER\n", tme.dwFlags);
+    ok(tme.dwFlags == TME_HOVER, "wrong tme.dwFlags %08lx, expected TME_HOVER\n", tme.dwFlags);
     ok(tme.hwndTrack == hwnd, "wrong tme.hwndTrack %p, expected %p\n", tme.hwndTrack, hwnd);
-    ok(tme.dwHoverTime == default_hover_time, "wrong tme.dwHoverTime %u, expected %u\n",
+    ok(tme.dwHoverTime == default_hover_time, "wrong tme.dwHoverTime %lu, expected %u\n",
        tme.dwHoverTime, default_hover_time);
 
     pump_msg_loop_timeout(default_hover_time, FALSE);
@@ -13952,19 +13953,19 @@ static void test_ShowWindow(void)
     assert(hwnd);
 
     style = GetWindowLongA(hwnd, GWL_STYLE) & ~WS_BASE;
-    ok(style == 0, "expected style 0, got %08x\n", style);
+    ok(style == 0, "expected style 0, got %08lx\n", style);
 
     flush_events();
     flush_sequence();
 
     SetLastError(0xdeadbeef);
     hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
-    ok(hmon != 0, "MonitorFromPoint error %u\n", GetLastError());
+    ok(hmon != 0, "MonitorFromPoint error %lu\n", GetLastError());
 
     mi.cbSize = sizeof(mi);
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoA(hmon, &mi);
-    ok(ret, "GetMonitorInfo error %u\n", GetLastError());
+    ok(ret, "GetMonitorInfo error %lu\n", GetLastError());
     trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor),
           wine_dbgstr_rect(&mi.rcWork));
     work_rc = mi.rcWork;
@@ -13975,13 +13976,13 @@ static void test_ShowWindow(void)
     wp.length = sizeof(wp);
     SetLastError(0xdeadbeaf);
     ret = GetWindowPlacement(hwnd, &wp);
-    ok(ret, "GetWindowPlacement error %u\n", GetLastError());
+    ok(ret, "GetWindowPlacement error %lu\n", GetLastError());
     ok(wp.flags == 0, "expected 0, got %#x\n", wp.flags);
     ok(wp.showCmd == SW_SHOWNORMAL, "expected SW_SHOWNORMAL, got %d\n", wp.showCmd);
     ok(wp.ptMinPosition.x == -1 && wp.ptMinPosition.y == -1,
-       "expected -1,-1 got %d,%d\n", wp.ptMinPosition.x, wp.ptMinPosition.y);
+       "expected -1,-1 got %ld,%ld\n", wp.ptMinPosition.x, wp.ptMinPosition.y);
     ok(wp.ptMaxPosition.x == -1 && wp.ptMaxPosition.y == -1,
-       "expected -1,-1 got %d,%d\n", wp.ptMaxPosition.x, wp.ptMaxPosition.y);
+       "expected -1,-1 got %ld,%ld\n", wp.ptMaxPosition.x, wp.ptMaxPosition.y);
     todo_wine_if (work_rc.left || work_rc.top) /* FIXME: remove once Wine is fixed */
     ok(EqualRect(&win_rc, &wp.rcNormalPosition), "expected %s got %s\n", wine_dbgstr_rect(&win_rc),
        wine_dbgstr_rect(&wp.rcNormalPosition));
@@ -14001,11 +14002,11 @@ static void test_ShowWindow(void)
         idx = (sw[i].cmd == SW_NORMALNA) ? 12 : sw[i].cmd;
 
         style = GetWindowLongA(hwnd, GWL_STYLE);
-        trace("%d: sending %s, current window style %08x\n", i+1, sw_cmd_name[idx], style);
+        trace("%d: sending %s, current window style %08lx\n", i+1, sw_cmd_name[idx], style);
         ret = ShowWindow(hwnd, sw[i].cmd);
-        ok(!ret == !sw[i].ret, "%d: cmd %s: expected ret %lu, got %lu\n", i+1, sw_cmd_name[idx], sw[i].ret, ret);
+        ok(!ret == !sw[i].ret, "%d: cmd %s: expected ret %Iu, got %Iu\n", i+1, sw_cmd_name[idx], sw[i].ret, ret);
         style = GetWindowLongA(hwnd, GWL_STYLE) & ~WS_BASE;
-        ok(style == sw[i].style, "%d: expected style %08x, got %08x\n", i+1, sw[i].style, style);
+        ok(style == sw[i].style, "%d: expected style %08lx, got %08lx\n", i+1, sw[i].style, style);
 
         sprintf(comment, "%d: ShowWindow(%s)", i+1, sw_cmd_name[idx]);
         ok_sequence(sw[i].msg, comment, sw[i].todo_msg);
@@ -14013,7 +14014,7 @@ static void test_ShowWindow(void)
         wp.length = sizeof(wp);
         SetLastError(0xdeadbeaf);
         ret = GetWindowPlacement(hwnd, &wp);
-        ok(ret, "GetWindowPlacement error %u\n", GetLastError());
+        ok(ret, "GetWindowPlacement error %lu\n", GetLastError());
         ok(wp.flags == sw[i].wp_flags, "expected %#x, got %#x\n", sw[i].wp_flags, wp.flags);
         ok(wp.showCmd == sw[i].wp_cmd, "expected %d, got %d\n", sw[i].wp_cmd, wp.showCmd);
 
@@ -14023,17 +14024,17 @@ static void test_ShowWindow(void)
         {
             ok((wp.ptMinPosition.x + work_rc.left == sw[i].wp_min.x && wp.ptMinPosition.y + work_rc.top == sw[i].wp_min.y) ||
                (wp.ptMinPosition.x + work_rc.left == 3000 && wp.ptMinPosition.y + work_rc.top == 3000),
-               "expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
+               "expected %ld,%ld got %ld,%ld\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
         }
         else
         {
             ok(wp.ptMinPosition.x == sw[i].wp_min.x && wp.ptMinPosition.y == sw[i].wp_min.y,
-               "expected %d,%d got %d,%d\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
+               "expected %ld,%ld got %ld,%ld\n", sw[i].wp_min.x, sw[i].wp_min.y, wp.ptMinPosition.x, wp.ptMinPosition.y);
         }
 
         todo_wine_if(wp.ptMaxPosition.x != sw[i].wp_max.x || wp.ptMaxPosition.y != sw[i].wp_max.y)
         ok(wp.ptMaxPosition.x == sw[i].wp_max.x && wp.ptMaxPosition.y == sw[i].wp_max.y,
-           "expected %d,%d got %d,%d\n", sw[i].wp_max.x, sw[i].wp_max.y, wp.ptMaxPosition.x, wp.ptMaxPosition.y);
+           "expected %ld,%ld got %ld,%ld\n", sw[i].wp_max.x, sw[i].wp_max.y, wp.ptMaxPosition.x, wp.ptMaxPosition.y);
 
 if (0) /* FIXME: Wine behaves completely different here */
         ok(EqualRect(&win_rc, &wp.rcNormalPosition), "expected %s got %s\n",
@@ -14305,7 +14306,7 @@ static void test_dialog_messages(void)
 
 #define set_selection(hctl, start, end) \
     ret = SendMessageA(hctl, EM_SETSEL, start, end); \
-    ok(ret == 1, "EM_SETSEL returned %ld\n", ret);
+    ok(ret == 1, "EM_SETSEL returned %Id\n", ret);
 
 #define check_selection(hctl, start, end) \
     ret = SendMessageA(hctl, EM_GETSEL, 0, 0); \
@@ -14349,7 +14350,7 @@ static void test_dialog_messages(void)
 
     flush_sequence();
     ret = DefDlgProcA(hdlg, WM_SETFOCUS, 0, 0);
-    ok(ret == 0, "WM_SETFOCUS returned %ld\n", ret);
+    ok(ret == 0, "WM_SETFOCUS returned %Id\n", ret);
     ok_sequence(WmDefDlgSetFocus_1, "DefDlgProc(WM_SETFOCUS) 1", FALSE);
 
     hfocus = GetFocus();
@@ -14360,7 +14361,7 @@ static void test_dialog_messages(void)
 
     flush_sequence();
     ret = DefDlgProcA(hdlg, WM_SETFOCUS, 0, 0);
-    ok(ret == 0, "WM_SETFOCUS returned %ld\n", ret);
+    ok(ret == 0, "WM_SETFOCUS returned %Id\n", ret);
     ok_sequence(WmDefDlgSetFocus_2, "DefDlgProc(WM_SETFOCUS) 2", FALSE);
 
     hfocus = GetFocus();
@@ -14942,7 +14943,7 @@ static void test_dbcs_wm_char(void)
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch );
+    ok( msg.wParam == wch, "bad wparam %Ix/%x\n", msg.wParam, wch );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -14954,7 +14955,7 @@ static void test_dbcs_wm_char(void)
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch );
+    ok( msg.wParam == wch, "bad wparam %Ix/%x\n", msg.wParam, wch );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15033,7 +15034,7 @@ static void test_dbcs_wm_char(void)
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == wch, "bad wparam %lx/%x\n", msg.wParam, wch );
+    ok( msg.wParam == wch, "bad wparam %Ix/%x\n", msg.wParam, wch );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
     SendMessageA( hwnd, WM_CHAR, dbch[1], 0 );
@@ -15087,14 +15088,14 @@ static void test_dbcs_wm_char(void)
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.message == WM_SYSCHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == bad_wch, "bad wparam %lx/%x\n", msg.wParam, bad_wch );
+    ok( msg.wParam == bad_wch, "bad wparam %Ix/%x\n", msg.wParam, bad_wch );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
     PostMessageA( hwnd, WM_DEADCHAR, dbch[0], 0 );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.message == WM_DEADCHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == bad_wch, "bad wparam %lx/%x\n", msg.wParam, bad_wch );
+    ok( msg.wParam == bad_wch, "bad wparam %Ix/%x\n", msg.wParam, bad_wch );
     ret = PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15105,12 +15106,12 @@ static void test_dbcs_wm_char(void)
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[0], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[1], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15120,7 +15121,7 @@ static void test_dbcs_wm_char(void)
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[0], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     /* message id is filtered, hwnd is not */
     ret = PeekMessageA( &msg, hwnd, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE );
     ok( !ret, "no message\n" );
@@ -15128,7 +15129,7 @@ static void test_dbcs_wm_char(void)
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[1], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15137,19 +15138,19 @@ static void test_dbcs_wm_char(void)
     ok( GetMessageA( &msg, hwnd, 0, 0 ), "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
-    ok( msg.lParam == 0xbeef, "bad lparam %lx\n", msg.lParam );
+    ok( msg.wParam == dbch[0], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
+    ok( msg.lParam == 0xbeef, "bad lparam %Ix\n", msg.lParam );
     time = msg.time;
     pt = msg.pt;
-    ok( time - GetTickCount() <= 100, "bad time %x\n", msg.time );
+    ok( time - GetTickCount() <= 100, "bad time %lx\n", msg.time );
     ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
-    ok( msg.lParam == 0xbeef, "bad lparam %lx\n", msg.lParam );
-    ok( msg.time == time, "bad time %x/%x\n", msg.time, time );
-    ok( msg.pt.x == pt.x && msg.pt.y == pt.y, "bad point %u,%u/%u,%u\n", msg.pt.x, msg.pt.y, pt.x, pt.y );
+    ok( msg.wParam == dbch[1], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
+    ok( msg.lParam == 0xbeef, "bad lparam %Ix\n", msg.lParam );
+    ok( msg.time == time, "bad time %lx/%lx\n", msg.time, time );
+    ok( msg.pt.x == pt.x && msg.pt.y == pt.y, "bad point %lu,%lu/%lu,%lu\n", msg.pt.x, msg.pt.y, pt.x, pt.y );
     ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15159,22 +15160,22 @@ static void test_dbcs_wm_char(void)
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[0], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[0], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[0], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[1], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, 0, 0, 0, PM_REMOVE );
     ok( ret, "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == dbch[1], "bad wparam %lx/%x\n", msg.wParam, dbch[0] );
+    ok( msg.wParam == dbch[1], "bad wparam %Ix/%x\n", msg.wParam, dbch[0] );
     ret = PeekMessageA( &msg, hwnd, 0, 0, PM_REMOVE );
     ok( !ret, "got message %x\n", msg.message );
 
@@ -15195,7 +15196,7 @@ static void test_unicode_wm_char(void)
     GetLocaleInfoW( LOWORD( hkl_orig ), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR*)&cp, sizeof(cp) / sizeof(WCHAR) );
     if (cp != 1252)
     {
-        skip( "Default codepage %d\n", cp );
+        skip( "Default codepage %ld\n", cp );
         return;
     }
 
@@ -15219,8 +15220,8 @@ static void test_unicode_wm_char(void)
 
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == 0x3b1, "bad wparam %lx\n", msg.wParam );
-    ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+    ok( msg.wParam == 0x3b1, "bad wparam %Ix\n", msg.wParam );
+    ok( msg.lParam == 0, "bad lparam %Ix\n", msg.lParam );
 
     DispatchMessageW( &msg );
 
@@ -15239,8 +15240,8 @@ static void test_unicode_wm_char(void)
     ok( GetMessageA( &msg, hwnd, 0, 0 ), "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == 0x61, "bad wparam %lx\n", msg.wParam );
-    ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+    ok( msg.wParam == 0x61, "bad wparam %Ix\n", msg.wParam );
+    ok( msg.lParam == 0, "bad lparam %Ix\n", msg.lParam );
 
     DispatchMessageA( &msg );
 
@@ -15249,7 +15250,7 @@ static void test_unicode_wm_char(void)
 
     thread_locale = GetThreadLocale();
     ActivateKeyboardLayout( hkl_greek, 0 );
-    ok( GetThreadLocale() == thread_locale, "locale changed from %08x to %08x\n",
+    ok( GetThreadLocale() == thread_locale, "locale changed from %08lx to %08lx\n",
         thread_locale, GetThreadLocale() );
 
     flush_sequence();
@@ -15260,8 +15261,8 @@ static void test_unicode_wm_char(void)
     ok( GetMessageA( &msg, hwnd, 0, 0 ), "no message\n" );
     ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd );
     ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message );
-    ok( msg.wParam == 0xe1, "bad wparam %lx\n", msg.wParam );
-    ok( msg.lParam == 0, "bad lparam %lx\n", msg.lParam );
+    ok( msg.wParam == 0xe1, "bad wparam %Ix\n", msg.wParam );
+    ok( msg.lParam == 0, "bad lparam %Ix\n", msg.lParam );
 
     DispatchMessageA( &msg );
 
@@ -15444,15 +15445,15 @@ static void check_lb_state_dbg(HWND listbox, int count, int cur_sel,
 
     /* calling an orig proc helps to avoid unnecessary message logging */
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCOUNT, 0, 0);
-    ok_(__FILE__, line)(ret == count, "expected count %d, got %ld\n", count, ret);
+    ok_(__FILE__, line)(ret == count, "expected count %d, got %Id\n", count, ret);
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCURSEL, 0, 0);
-    ok_(__FILE__, line)(ret == cur_sel, "expected cur sel %d, got %ld\n", cur_sel, ret);
+    ok_(__FILE__, line)(ret == cur_sel, "expected cur sel %d, got %Id\n", cur_sel, ret);
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCARETINDEX, 0, 0);
     ok_(__FILE__, line)(ret == caret_index ||
                         broken(cur_sel == -1 && caret_index == 0 && ret == -1),  /* nt4 */
-                        "expected caret index %d, got %ld\n", caret_index, ret);
+                        "expected caret index %d, got %Id\n", caret_index, ret);
     ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETTOPINDEX, 0, 0);
-    ok_(__FILE__, line)(ret == top_index, "expected top index %d, got %ld\n", top_index, ret);
+    ok_(__FILE__, line)(ret == top_index, "expected top index %d, got %Id\n", top_index, ret);
 }
 
 static void test_listbox_messages(void)
@@ -15475,11 +15476,11 @@ static void test_listbox_messages(void)
     log_all_parent_messages++;
 
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
 
     ok_sequence(wm_lb_addstring_ownerdraw, "LB_ADDSTRING", FALSE);
     check_lb_state(listbox, 3, LB_ERR, 0, 0);
@@ -15488,56 +15489,56 @@ static void test_listbox_messages(void)
 
     trace("selecting item 0\n");
     ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ok_sequence(wm_lb_setcursel_0, "LB_SETCURSEL 0", FALSE );
     check_lb_state(listbox, 3, 0, 0, 0);
     flush_sequence();
 
     trace("selecting item 1\n");
     ret = SendMessageA(listbox, LB_SETCURSEL, 1, 0);
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ok_sequence(wm_lb_setcursel_1, "LB_SETCURSEL 1", FALSE );
     check_lb_state(listbox, 3, 1, 1, 0);
 
     trace("selecting item 2\n");
     ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
     ok_sequence(wm_lb_setcursel_2, "LB_SETCURSEL 2", FALSE );
     check_lb_state(listbox, 3, 2, 2, 0);
 
     trace("clicking on item 0\n");
     ret = SendMessageA(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(1, 1));
-    ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret);
+    ok(ret == LB_OKAY, "expected LB_OKAY, got %Id\n", ret);
     ret = SendMessageA(listbox, WM_LBUTTONUP, 0, 0);
-    ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret);
+    ok(ret == LB_OKAY, "expected LB_OKAY, got %Id\n", ret);
     ok_sequence(wm_lb_click_0, "WM_LBUTTONDOWN 0", FALSE );
     check_lb_state(listbox, 3, 0, 0, 0);
     flush_sequence();
 
     trace("deleting item 0\n");
     ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
     ok_sequence(wm_lb_deletestring, "LB_DELETESTRING 0", FALSE );
     check_lb_state(listbox, 2, -1, 0, 0);
     flush_sequence();
 
     trace("deleting item 0\n");
     ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ok_sequence(wm_lb_deletestring, "LB_DELETESTRING 0", FALSE );
     check_lb_state(listbox, 1, -1, 0, 0);
     flush_sequence();
 
     trace("deleting item 0\n");
     ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ok_sequence(wm_lb_deletestring_reset, "LB_DELETESTRING 0", FALSE );
     check_lb_state(listbox, 0, -1, 0, 0);
     flush_sequence();
 
     trace("deleting item 0\n");
     ret = SendMessageA(listbox, LB_DELETESTRING, 0, 0);
-    ok(ret == LB_ERR, "expected LB_ERR, got %ld\n", ret);
+    ok(ret == LB_ERR, "expected LB_ERR, got %Id\n", ret);
     check_lb_state(listbox, 0, -1, 0, 0);
     flush_sequence();
 
@@ -15558,11 +15559,11 @@ static void test_listbox_messages(void)
     log_all_parent_messages++;
 
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
 
     ok_sequence(wm_lb_addstring_sort_ownerdraw, "LB_ADDSTRING", FALSE);
     check_lb_state(listbox, 3, LB_ERR, 0, 0);
@@ -15584,11 +15585,11 @@ static void test_listbox_messages(void)
     log_all_parent_messages++;
 
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
-    ok(ret == 2, "expected 2, got %ld\n", ret);
+    ok(ret == 2, "expected 2, got %Id\n", ret);
 
     ok_sequence(wm_lb_addstring, "LB_ADDSTRING", FALSE);
     check_lb_state(listbox, 3, LB_ERR, 0, 0);
@@ -15610,11 +15611,11 @@ static void test_listbox_messages(void)
     log_all_parent_messages++;
 
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0");
-    ok(ret == 0, "expected 0, got %ld\n", ret);
+    ok(ret == 0, "expected 0, got %Id\n", ret);
     ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1");
-    ok(ret == 1, "expected 1, got %ld\n", ret);
+    ok(ret == 1, "expected 1, got %Id\n", ret);
 
     ok_sequence(wm_lb_addstring, "LB_ADDSTRING", FALSE);
     check_lb_state(listbox, 3, LB_ERR, 0, 0);
@@ -15843,7 +15844,7 @@ static void set_menu_style(HMENU hmenu, DWORD style)
     mi.dwStyle = style;
     SetLastError(0xdeadbeef);
     ret = SetMenuInfo(hmenu, &mi);
-    ok(ret, "SetMenuInfo error %u\n", GetLastError());
+    ok(ret, "SetMenuInfo error %lu\n", GetLastError());
 }
 
 static DWORD get_menu_style(HMENU hmenu)
@@ -15856,7 +15857,7 @@ static DWORD get_menu_style(HMENU hmenu)
     mi.dwStyle = 0;
     SetLastError(0xdeadbeef);
     ret = GetMenuInfo(hmenu, &mi);
-    ok(ret, "GetMenuInfo error %u\n", GetLastError());
+    ok(ret, "GetMenuInfo error %lu\n", GetLastError());
 
     return mi.dwStyle;
 }
@@ -15886,11 +15887,11 @@ static void test_menu_messages(void)
     SetLastError(0xdeadbeef);
     hwnd = CreateWindowExA(0, "TestMenuClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                            100, 100, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "LoadMenuA error %u\n", GetLastError());
+    ok(hwnd != 0, "LoadMenuA error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     hmenu = LoadMenuA(GetModuleHandleA(NULL), MAKEINTRESOURCEA(1));
-    ok(hmenu != 0, "LoadMenuA error %u\n", GetLastError());
+    ok(hmenu != 0, "LoadMenuA error %lu\n", GetLastError());
 
     SetMenu(hwnd, hmenu);
     SetForegroundWindow( hwnd );
@@ -15898,17 +15899,17 @@ static void test_menu_messages(void)
 
     set_menu_style(hmenu, MNS_NOTIFYBYPOS);
     style = get_menu_style(hmenu);
-    ok(style == MNS_NOTIFYBYPOS, "expected MNS_NOTIFYBYPOS, got %u\n", style);
+    ok(style == MNS_NOTIFYBYPOS, "expected MNS_NOTIFYBYPOS, got %lu\n", style);
 
     hmenu_popup = GetSubMenu(hmenu, 0);
     ok(hmenu_popup != 0, "GetSubMenu returned 0 for submenu 0\n");
     style = get_menu_style(hmenu_popup);
-    ok(style == 0, "expected 0, got %u\n", style);
+    ok(style == 0, "expected 0, got %lu\n", style);
 
     hmenu_popup = GetSubMenu(hmenu_popup, 0);
     ok(hmenu_popup != 0, "GetSubMenu returned 0 for submenu 0\n");
     style = get_menu_style(hmenu_popup);
-    ok(style == 0, "expected 0, got %u\n", style);
+    ok(style == 0, "expected 0, got %lu\n", style);
 
     if (!us_kbd)
     {
@@ -15978,18 +15979,18 @@ static void test_menu_messages(void)
 
     set_menu_style(hmenu, 0);
     style = get_menu_style(hmenu);
-    ok(style == 0, "expected 0, got %u\n", style);
+    ok(style == 0, "expected 0, got %lu\n", style);
 
     hmenu_popup = GetSubMenu(hmenu, 0);
     ok(hmenu_popup != 0, "GetSubMenu returned 0 for submenu 0\n");
     set_menu_style(hmenu_popup, MNS_NOTIFYBYPOS);
     style = get_menu_style(hmenu_popup);
-    ok(style == MNS_NOTIFYBYPOS, "expected MNS_NOTIFYBYPOS, got %u\n", style);
+    ok(style == MNS_NOTIFYBYPOS, "expected MNS_NOTIFYBYPOS, got %lu\n", style);
 
     hmenu_popup = GetSubMenu(hmenu_popup, 0);
     ok(hmenu_popup != 0, "GetSubMenu returned 0 for submenu 0\n");
     style = get_menu_style(hmenu_popup);
-    ok(style == 0, "expected 0, got %u\n", style);
+    ok(style == 0, "expected 0, got %lu\n", style);
 
     /* Alt+F, Right, Enter */
     trace("testing submenu of a popup menu command\n");
@@ -16023,7 +16024,7 @@ static void test_paintingloop(void)
     hwnd = CreateWindowExA(0x0,"PaintLoopWindowClass",
                                "PaintLoopWindowClass",WS_OVERLAPPEDWINDOW,
                                 100, 100, 100, 100, 0, 0, 0, NULL );
-    ok(hwnd != 0, "PaintLoop window error %u\n", GetLastError());
+    ok(hwnd != 0, "PaintLoop window error %lu\n", GetLastError());
     ShowWindow(hwnd,SW_NORMAL);
     SetFocus(hwnd);
 
@@ -16168,7 +16169,7 @@ static DWORD CALLBACK post_rbuttonup_msg( void *arg )
     DWORD ret;
 
     ret = WaitForSingleObject( data->wndproc_finished, 500 );
-    todo_wine ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", ret );
+    todo_wine ok( ret == WAIT_OBJECT_0, "WaitForSingleObject returned %lx\n", ret );
     if( ret == WAIT_OBJECT_0 ) return 0;
 
     PostMessageA( data->hwnd, WM_RBUTTONUP, 0, 0 );
@@ -16199,13 +16200,13 @@ static void test_defwinproc(void)
 
     /* Zero high word of the lParam */
     res = DefWindowProcA(hwnd, WM_SETTEXT, 0, 0x1234);
-    ok(res == 0, "WM_SETTEXT was expected to fail, %ld\n", res);
+    ok(res == 0, "WM_SETTEXT was expected to fail, %Id\n", res);
 
     GetWindowTextA(hwnd, buffA, ARRAY_SIZE(buffA));
     ok(!strcmp(buffA, "test_defwndproc"), "unexpected window text, %s\n", buffA);
 
     res = DefWindowProcW(hwnd, WM_SETTEXT, 0, 0x1234);
-    ok(res == 0, "WM_SETTEXT was expected to fail, %ld\n", res);
+    ok(res == 0, "WM_SETTEXT was expected to fail, %Id\n", res);
 
     GetWindowTextA(hwnd, buffA, ARRAY_SIZE(buffA));
     ok(!strcmp(buffA, "test_defwndproc"), "unexpected window text, %s\n", buffA);
@@ -16251,7 +16252,7 @@ static void test_defwinproc(void)
     SetCursorPos(x, y);
     flush_events();
     res = DefWindowProcA( hwnd, WM_NCHITTEST, 0, MAKELPARAM(x, y));
-    ok(res == HTCAPTION, "WM_NCHITTEST returned %ld\n", res);
+    ok(res == HTCAPTION, "WM_NCHITTEST returned %Id\n", res);
 
     mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
     mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
@@ -16268,27 +16269,27 @@ static void test_defwinproc(void)
     ok_sequence(NCRBUTTONDOWNSeq, "WM_NCRBUTTONDOWN on caption", FALSE);
 
     res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, 0, MAKELPARAM(x, y));
-    ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
+    ok(!res, "WM_NCXBUTTONUP returned %Id\n", res);
     ok_sequence(WmEmptySeq, "WM_NCXBUTTONUP without button", FALSE);
 
     res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, XBUTTON1), MAKELPARAM(x, y));
-    ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
+    ok(!res, "WM_NCXBUTTONUP returned %Id\n", res);
     ok_sequence(NCXBUTTONUPSeq1, "WM_NCXBUTTONUP with XBUTTON1", FALSE);
 
     res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, XBUTTON2), MAKELPARAM(x, y));
-    ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
+    ok(!res, "WM_NCXBUTTONUP returned %Id\n", res);
     ok_sequence(NCXBUTTONUPSeq2, "WM_NCXBUTTONUP with XBUTTON2", FALSE);
 
     res = DefWindowProcA(hwnd, WM_NCXBUTTONUP, MAKEWPARAM(0, 3), MAKELPARAM(x, y));
-    ok(!res, "WM_NCXBUTTONUP returned %ld\n", res);
+    ok(!res, "WM_NCXBUTTONUP returned %Id\n", res);
     ok_sequence(WmEmptySeq, "WM_NCXBUTTONUP with invalid button", FALSE);
 
     /* Test WM_MOUSEACTIVATE */
 #define TEST_MOUSEACTIVATE(A,B,C) \
        res = DefWindowProcA(hwnd, WM_MOUSEACTIVATE, (WPARAM)hwnd, (LPARAM)MAKELRESULT(A,0)); \
-       ok(res == B, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res); \
+       ok(res == B, "WM_MOUSEACTIVATE for %s returned %Id\n", #A, res); \
        res = DefWindowProcA(hwnd, WM_MOUSEACTIVATE, (WPARAM)hwnd, (LPARAM)MAKELRESULT(A,WM_LBUTTONDOWN)); \
-       ok(res == C, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res);
+       ok(res == C, "WM_MOUSEACTIVATE for %s returned %Id\n", #A, res);
 
     TEST_MOUSEACTIVATE(HTERROR,       MA_ACTIVATE, MA_ACTIVATE);
     TEST_MOUSEACTIVATE(HTTRANSPARENT, MA_ACTIVATE, MA_ACTIVATE);
@@ -16372,17 +16373,17 @@ static void test_desktop_winproc(void)
     todo_wine ok(!strcmp(buffer, "test_desktop_wndproc"), "Got unexpected window text: %s.\n", buffer);
 
     res = CallWindowProcA(desktop_proc, hwnd, WM_SETTEXT, 0, (LPARAM)"test");
-    ok(res == TRUE, "Failed to set text, %ld.\n", res);
+    ok(res == TRUE, "Failed to set text, %Id.\n", res);
     GetWindowTextA(hwnd, buffer, ARRAY_SIZE(buffer));
     ok(!strcmp(buffer, "test"), "Got unexpected window text: %s.\n", buffer);
 
     SetRect(&default_rect, 0, 0, 100, 100);
     res = DefWindowProcW(hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&default_rect);
-    ok(!res, "Got unexpected result %ld.\n", res);
+    ok(!res, "Got unexpected result %Id.\n", res);
 
     SetRect(&rect, 0, 0, 100, 100);
     res = CallWindowProcA(desktop_proc, hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rect);
-    ok(!res, "Got unexpected result %ld.\n", res);
+    ok(!res, "Got unexpected result %Id.\n", res);
     todo_wine ok(EqualRect(&rect, &default_rect), "rect Got %s, expected %s.\n",
             wine_dbgstr_rect(&rect), wine_dbgstr_rect(&default_rect));
 
@@ -16397,11 +16398,11 @@ static void clear_clipboard_(int line, HWND hWnd)
 {
     BOOL succ;
     succ = OpenClipboard(hWnd);
-    ok_(__FILE__, line)(succ, "OpenClipboard failed, err=%u\n", GetLastError());
+    ok_(__FILE__, line)(succ, "OpenClipboard failed, err=%lu\n", GetLastError());
     succ = EmptyClipboard();
-    ok_(__FILE__, line)(succ, "EmptyClipboard failed, err=%u\n", GetLastError());
+    ok_(__FILE__, line)(succ, "EmptyClipboard failed, err=%lu\n", GetLastError());
     succ = CloseClipboard();
-    ok_(__FILE__, line)(succ, "CloseClipboard failed, err=%u\n", GetLastError());
+    ok_(__FILE__, line)(succ, "CloseClipboard failed, err=%lu\n", GetLastError());
 }
 
 #define expect_HWND(expected, got) expect_HWND_(__LINE__, (expected), (got))
@@ -16604,12 +16605,12 @@ static void test_PostMessage(void)
             if (data[i].hwnd)
                 ok(ret && msg.hwnd == 0 && msg.message == WM_USER+2 &&
                    msg.wParam == 0x5678 && msg.lParam == 0x1234,
-                   "%d: got ret %d hwnd %p msg %04x wParam %08lx lParam %08lx instead of TRUE/0/WM_USER+2/0x5678/0x1234\n",
+                   "%d: got ret %d hwnd %p msg %04x wParam %08Ix lParam %08Ix instead of TRUE/0/WM_USER+2/0x5678/0x1234\n",
                    i, ret, msg.hwnd, msg.message, msg.wParam, msg.lParam);
             else
                 ok(ret && msg.hwnd == hwnd && msg.message == WM_USER+1 &&
                    msg.wParam == 0x1234 && msg.lParam == 0x5678,
-                   "%d: got ret %d hwnd %p msg %04x wParam %08lx lParam %08lx instead of TRUE/%p/WM_USER+1/0x1234/0x5678\n",
+                   "%d: got ret %d hwnd %p msg %04x wParam %08Ix lParam %08Ix instead of TRUE/%p/WM_USER+1/0x1234/0x5678\n",
                    i, ret, msg.hwnd, msg.message, msg.wParam, msg.lParam, msg.hwnd);
         }
     }
@@ -16699,21 +16700,21 @@ static void test_broadcast(void)
 
         /* post, broadcast */
         ret = PostMessageA(HWND_BROADCAST, messages[i], 0, 0);
-        ok(ret, "%d: got %d, error %d\n", i, ret, GetLastError());
+        ok(ret, "%d: got %d, error %ld\n", i, ret, GetLastError());
 
         memset(&msg, 0xab, sizeof(msg));
         ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-        ok(ret == msg_expected, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError());
+        ok(ret == msg_expected, "%d: message %04x, got %d, error %ld\n", i, messages[i], ret, GetLastError());
         if (msg_expected)
             ok(msg.hwnd == hwnd, "%d: got %p\n", i, msg.hwnd);
 
         /* post, topmost */
         ret = PostMessageA(HWND_TOPMOST, messages[i], 0, 0);
-        ok(ret, "%d: got %d, error %d\n", i, ret, GetLastError());
+        ok(ret, "%d: got %d, error %ld\n", i, ret, GetLastError());
 
         memset(&msg, 0xab, sizeof(msg));
         ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE);
-        ok(ret == msg_expected, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError());
+        ok(ret == msg_expected, "%d: message %04x, got %d, error %ld\n", i, messages[i], ret, GetLastError());
         if (msg_expected)
             ok(msg.hwnd == hwnd, "%d: got %p\n", i, msg.hwnd);
     }
@@ -16744,13 +16745,13 @@ static void test_broadcast(void)
         else
         {
             WPARAM wparam_expected = msg_expected ? 0xbaadbeef : 0xdead;
-            ok(g_broadcast_wparam == wparam_expected, "%d: message %04x, got %#lx, error %d\n",
+            ok(g_broadcast_wparam == wparam_expected, "%d: message %04x, got %#Ix, error %ld\n",
                 i, messages[i], g_broadcast_wparam, GetLastError());
             for (j = 0; j < ARRAY_SIZE(bcast_expect); j++)
             {
                 wparam_expected = (msg_expected && bcast_expect[j].receive) ? 0xbaadbeef : 0xdead;
                 ok(g_broadcast_sub_wparam[j] == wparam_expected,
-                    "%d,%d: message %04x, got %#lx, error %d\n", i, j, messages[i],
+                    "%d,%d: message %04x, got %#Ix, error %ld\n", i, j, messages[i],
                     g_broadcast_sub_wparam[j], GetLastError());
             }
         }
@@ -16765,13 +16766,13 @@ static void test_broadcast(void)
         else
         {
             WPARAM wparam_expected = msg_expected ? 0xbaadbeef : 0xdead;
-            ok(g_broadcast_wparam == wparam_expected, "%d: message %04x, got %#lx, error %d\n",
+            ok(g_broadcast_wparam == wparam_expected, "%d: message %04x, got %#Ix, error %ld\n",
                 i, messages[i], g_broadcast_wparam, GetLastError());
             for (j = 0; j < ARRAY_SIZE(bcast_expect); j++)
             {
                 wparam_expected = (msg_expected && bcast_expect[j].receive) ? 0xbaadbeef : 0xdead;
                 ok(g_broadcast_sub_wparam[j] == wparam_expected,
-                    "%d,%d: message %04x, got %#lx, error %d\n", i, j, messages[i],
+                    "%d,%d: message %04x, got %#Ix, error %ld\n", i, j, messages[i],
                     g_broadcast_sub_wparam[j], GetLastError());
             }
         }
@@ -16845,8 +16846,8 @@ static void do_wait_idle_child( int arg )
 
     PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE );  /* create the msg queue */
 
-    ok( start_event != 0, "failed to create start event, error %u\n", GetLastError() );
-    ok( end_event != 0, "failed to create end event, error %u\n", GetLastError() );
+    ok( start_event != 0, "failed to create start event, error %lu\n", GetLastError() );
+    ok( end_event != 0, "failed to create end event, error %lu\n", GetLastError() );
 
     switch (arg)
     {
@@ -17024,8 +17025,8 @@ static void test_WaitForInputIdle( char *argv0 )
 
     start_event = CreateEventA(NULL, 0, 0, "test_WaitForInputIdle_start");
     end_event = CreateEventA(NULL, 0, 0, "test_WaitForInputIdle_end");
-    ok(start_event != 0, "failed to create start event, error %u\n", GetLastError());
-    ok(end_event != 0, "failed to create end event, error %u\n", GetLastError());
+    ok(start_event != 0, "failed to create start event, error %lu\n", GetLastError());
+    ok(end_event != 0, "failed to create end event, error %lu\n", GetLastError());
 
     memset( &startup, 0, sizeof(startup) );
     startup.cb = sizeof(startup);
@@ -17040,7 +17041,7 @@ static void test_WaitForInputIdle( char *argv0 )
         ResetEvent( end_event );
         sprintf( path, "%s msg %u", argv0, i );
         ret = CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &pi );
-        ok( ret, "CreateProcess '%s' failed err %u.\n", path, GetLastError() );
+        ok( ret, "CreateProcess '%s' failed err %lu.\n", path, GetLastError() );
         if (ret)
         {
             ret = WaitForSingleObject( start_event, 5000 );
@@ -17052,11 +17053,11 @@ static void test_WaitForInputIdle( char *argv0 )
                     ok( console_app ||
                         ret == wait_idle_expect[i].exp ||
                         broken(ret == wait_idle_expect[i].broken),
-                        "%u: WaitForInputIdle error %08x expected %08x\n",
+                        "%u: WaitForInputIdle error %08x expected %08lx\n",
                         i, ret, wait_idle_expect[i].exp );
                 else todo_wine_if (wait_idle_expect[i].todo)
                     ok( ret == wait_idle_expect[i].exp || broken(ret == wait_idle_expect[i].broken),
-                        "%u: WaitForInputIdle error %08x expected %08x\n",
+                        "%u: WaitForInputIdle error %08x expected %08lx\n",
                         i, ret, wait_idle_expect[i].exp );
                 SetEvent( end_event );
                 WaitForSingleObject( pi.hProcess, 1000 );  /* give it a chance to exit on its own */
@@ -17432,7 +17433,7 @@ static LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam
             ok(kdbhookstruct->vkCode == VK_LWIN ||
                kdbhookstruct->vkCode == VK_LMENU ||
                kdbhookstruct->vkCode == hotkey_letter,
-               "unexpected keycode %x\n", kdbhookstruct->vkCode);
+               "unexpected keycode %lx\n", kdbhookstruct->vkCode);
        }
     }
 
@@ -17457,7 +17458,7 @@ static void test_hotkey(void)
 
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_NOT_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     test_window = CreateWindowExA(0, "HotkeyWindowClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                            100, 100, 200, 200, 0, 0, 0, NULL);
@@ -17468,7 +17469,7 @@ static void test_hotkey(void)
     ret = UnregisterHotKey(test_window, 0);
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_NOT_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* Search for a Windows Key + letter combination that hasn't been registered */
     for (hotkey_letter = 0x41; hotkey_letter <= 0x51; hotkey_letter ++)
@@ -17483,7 +17484,7 @@ static void test_hotkey(void)
         else
         {
             ok(GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-               "unexpected error %d\n", GetLastError());
+               "unexpected error %ld\n", GetLastError());
         }
     }
 
@@ -17501,21 +17502,21 @@ static void test_hotkey(void)
     ret = RegisterHotKey(test_window, 4, MOD_WIN, hotkey_letter);
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* Same key combination, different window */
     SetLastError(0xdeadbeef);
     ret = RegisterHotKey(NULL, 5, MOD_WIN, hotkey_letter);
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* Register the same hotkey twice */
     SetLastError(0xdeadbeef);
     ret = RegisterHotKey(test_window, 5, MOD_WIN, hotkey_letter);
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* Window on another thread */
     taskbar_window = FindWindowA("Shell_TrayWnd", NULL);
@@ -17529,7 +17530,7 @@ static void test_hotkey(void)
         ret = RegisterHotKey(taskbar_window, 5, 0, hotkey_letter);
         ok(ret == FALSE, "expected FALSE, got %i\n", ret);
         ok(GetLastError() == ERROR_WINDOW_OF_OTHER_THREAD || broken(GetLastError() == 0xdeadbeef),
-           "unexpected error %d\n", GetLastError());
+           "unexpected error %ld\n", GetLastError());
     }
 
     /* Inject the appropriate key sequence */
@@ -17540,20 +17541,20 @@ static void test_hotkey(void)
 
     keybd_event(hotkey_letter, 0, 0, 0);
     queue_status = GetQueueStatus(QS_HOTKEY);
-    ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %x\n", queue_status);
+    ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %lx\n", queue_status);
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
     {
         if (msg.message == WM_HOTKEY)
         {
             ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
-            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
+            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %Ix\n", msg.lParam);
         }
         DispatchMessageA(&msg);
     }
     ok_sequence(WmHotkeyPress, "window hotkey press", FALSE);
 
     queue_status = GetQueueStatus(QS_HOTKEY);
-    ok((queue_status & (QS_HOTKEY << 16)) == 0, "expected QS_HOTKEY << 16 cleared, got %x\n", queue_status);
+    ok((queue_status & (QS_HOTKEY << 16)) == 0, "expected QS_HOTKEY << 16 cleared, got %lx\n", queue_status);
 
     key_state = GetAsyncKeyState(hotkey_letter);
     ok((key_state & 0x8000) == 0x8000, "unexpected key state %x\n", key_state);
@@ -17571,9 +17572,9 @@ static void test_hotkey(void)
     /* normal posted WM_HOTKEY messages set QS_HOTKEY */
     PostMessageA(test_window, WM_HOTKEY, 0, 0);
     queue_status = GetQueueStatus(QS_HOTKEY);
-    ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %x\n", queue_status);
+    ok((queue_status & (QS_HOTKEY << 16)) == QS_HOTKEY << 16, "expected QS_HOTKEY << 16 set, got %lx\n", queue_status);
     queue_status = GetQueueStatus(QS_POSTMESSAGE);
-    ok((queue_status & (QS_POSTMESSAGE << 16)) == QS_POSTMESSAGE << 16, "expected QS_POSTMESSAGE << 16 set, got %x\n", queue_status);
+    ok((queue_status & (QS_POSTMESSAGE << 16)) == QS_POSTMESSAGE << 16, "expected QS_POSTMESSAGE << 16 set, got %lx\n", queue_status);
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
         DispatchMessageA(&msg);
     flush_sequence();
@@ -17590,7 +17591,7 @@ static void test_hotkey(void)
         if (msg.message == WM_HOTKEY)
         {
             ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
-            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
+            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %Ix\n", msg.lParam);
         }
         DispatchMessageA(&msg);
     }
@@ -17598,7 +17599,7 @@ static void test_hotkey(void)
 
     /* Register same hwnd/id with different key combination */
     ret = RegisterHotKey(test_window, 5, 0, hotkey_letter);
-    ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
+    ok(ret == TRUE, "expected TRUE, got %i, err=%ld\n", ret, GetLastError());
 
     /* Previous key combination does not work */
     keybd_event(VK_LWIN, 0, 0, 0);
@@ -17619,7 +17620,7 @@ static void test_hotkey(void)
         if (msg.message == WM_HOTKEY)
         {
             ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
-            ok(msg.lParam == MAKELPARAM(0, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
+            ok(msg.lParam == MAKELPARAM(0, hotkey_letter), "unexpected WM_HOTKEY lparam %Ix\n", msg.lParam);
         }
         DispatchMessageA(&msg);
     }
@@ -17627,18 +17628,18 @@ static void test_hotkey(void)
 
     /* Unregister hotkey properly */
     ret = UnregisterHotKey(test_window, 5);
-    ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
+    ok(ret == TRUE, "expected TRUE, got %i, err=%ld\n", ret, GetLastError());
 
     /* Unregister hotkey again */
     SetLastError(0xdeadbeef);
     ret = UnregisterHotKey(test_window, 5);
     ok(ret == FALSE, "expected FALSE, got %i\n", ret);
     ok(GetLastError() == ERROR_HOTKEY_NOT_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-       "unexpected error %d\n", GetLastError());
+       "unexpected error %ld\n", GetLastError());
 
     /* Register thread hotkey */
     ret = RegisterHotKey(NULL, 5, MOD_WIN, hotkey_letter);
-    ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
+    ok(ret == TRUE, "expected TRUE, got %i, err=%ld\n", ret, GetLastError());
 
     /* Inject the appropriate key sequence */
     keybd_event(VK_LWIN, 0, 0, 0);
@@ -17656,7 +17657,7 @@ static void test_hotkey(void)
         {
             struct recvd_message message;
             ok(msg.hwnd == NULL, "unexpected hwnd %p\n", msg.hwnd);
-            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
+            ok(msg.lParam == MAKELPARAM(MOD_WIN, hotkey_letter), "unexpected WM_HOTKEY lparam %Ix\n", msg.lParam);
             message.message = msg.message;
             message.flags = sent|wparam|lparam;
             message.wParam = msg.wParam;
@@ -17699,7 +17700,7 @@ static void test_hotkey(void)
         else
         {
             ok(GetLastError() == ERROR_HOTKEY_ALREADY_REGISTERED || broken(GetLastError() == 0xdeadbeef),
-               "unexpected error %d\n", GetLastError());
+               "unexpected error %ld\n", GetLastError());
         }
     }
 
@@ -17720,7 +17721,7 @@ static void test_hotkey(void)
         if (msg.message == WM_HOTKEY)
         {
             ok(msg.hwnd == test_window, "unexpected hwnd %p\n", msg.hwnd);
-            ok(msg.lParam == MAKELPARAM(MOD_ALT, hotkey_letter), "unexpected WM_HOTKEY lparam %lx\n", msg.lParam);
+            ok(msg.lParam == MAKELPARAM(MOD_ALT, hotkey_letter), "unexpected WM_HOTKEY lparam %Ix\n", msg.lParam);
         }
         DispatchMessageA(&msg);
     }
@@ -17738,7 +17739,7 @@ static void test_hotkey(void)
 
     /* Unregister thread hotkey */
     ret = UnregisterHotKey(NULL, 5);
-    ok(ret == TRUE, "expected TRUE, got %i, err=%d\n", ret, GetLastError());
+    ok(ret == TRUE, "expected TRUE, got %i, err=%ld\n", ret, GetLastError());
 
     if (hKBD_hook) UnhookWindowsHookEx(hKBD_hook);
     hKBD_hook = NULL;
@@ -17792,9 +17793,9 @@ static void test_SetFocus(void)
     DWORD ret, tid;
 
     wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL);
-    ok(wnd_event.start_event != 0, "CreateEvent error %d\n", GetLastError());
+    ok(wnd_event.start_event != 0, "CreateEvent error %ld\n", GetLastError());
     hthread = CreateThread(NULL, 0, thread_proc, &wnd_event, 0, &tid);
-    ok(hthread != 0, "CreateThread error %d\n", GetLastError());
+    ok(hthread != 0, "CreateThread error %ld\n", GetLastError());
     ret = WaitForSingleObject(wnd_event.start_event, INFINITE);
     ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(wnd_event.start_event);
@@ -17836,7 +17837,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_focus = SetFocus((HWND)0xdeadbeef);
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
-       "expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
+       "expected ERROR_INVALID_WINDOW_HANDLE, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetFocus on an invalid window", FALSE);
     ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
@@ -17846,7 +17847,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_focus = SetFocus(GetDesktopWindow());
     ok(GetLastError() == ERROR_ACCESS_DENIED /* Vista+ */ ||
-       broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
+       broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetFocus on a desktop window", TRUE);
     ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
@@ -17856,7 +17857,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_focus = SetFocus(wnd_event.hwnd);
     ok(GetLastError() == ERROR_ACCESS_DENIED /* Vista+ */ ||
-       broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %d\n", GetLastError());
+       broken(GetLastError() == 0xdeadbeef), "expected ERROR_ACCESS_DENIED, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetFocus on another thread window", TRUE);
     ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
@@ -17866,7 +17867,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_active = SetActiveWindow((HWND)0xdeadbeef);
     ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE || broken(GetLastError() == 0xdeadbeef),
-       "expected ERROR_INVALID_WINDOW_HANDLE, got %d\n", GetLastError());
+       "expected ERROR_INVALID_WINDOW_HANDLE, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetActiveWindow on an invalid window", FALSE);
     ok(old_active == 0, "expected old focus 0, got %p\n", old_active);
@@ -17876,7 +17877,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_active = SetActiveWindow(GetDesktopWindow());
     todo_wine
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetActiveWindow on a desktop window", TRUE);
     ok(old_active == 0, "expected old focus 0, got %p\n", old_focus);
@@ -17886,7 +17887,7 @@ static void test_SetFocus(void)
     SetLastError(0xdeadbeef);
     old_active = SetActiveWindow(wnd_event.hwnd);
     todo_wine
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetActiveWindow on another thread window", TRUE);
     ok(old_active == 0, "expected old focus 0, got %p\n", old_active);
@@ -17895,7 +17896,7 @@ static void test_SetFocus(void)
 
     SetLastError(0xdeadbeef);
     ret = AttachThreadInput(GetCurrentThreadId(), tid, TRUE);
-    ok(ret, "AttachThreadInput error %d\n", GetLastError());
+    ok(ret, "AttachThreadInput error %ld\n", GetLastError());
 
     ok(GetActiveWindow() == parent, "expected active %p, got %p\n", parent, GetActiveWindow());
     ok(GetFocus() == parent, "expected focus %p, got %p\n", parent, GetFocus());
@@ -17926,7 +17927,7 @@ static void test_SetFocus(void)
 
     SetLastError(0xdeadbeef);
     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());
@@ -17951,7 +17952,7 @@ static void test_SetFocus(void)
     todo_wine
     ok(GetLastError() == ERROR_INVALID_PARAMETER /* Vista+ */ ||
        broken(GetLastError() == 0) /* XP */ ||
-       broken(GetLastError() == 0xdeadbeef), "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       broken(GetLastError() == 0xdeadbeef), "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmSetFocus_3, "SetFocus on a child window", TRUE);
     ok(old_focus == 0, "expected old focus 0, got %p\n", old_focus);
@@ -17960,7 +17961,7 @@ static void test_SetFocus(void)
 
     SetLastError(0xdeadbeef);
     old_active = SetActiveWindow(child);
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %ld\n", GetLastError());
     while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(WmEmptySeq, "SetActiveWindow on a child window", FALSE);
     ok(old_active == parent, "expected old active %p, got %p\n", parent, old_active);
@@ -17973,7 +17974,7 @@ static void test_SetFocus(void)
     DestroyWindow(parent);
 
     ret = PostMessageA(wnd_event.hwnd, WM_QUIT, 0, 0);
-    ok(ret, "PostMessage(WM_QUIT) error %d\n", GetLastError());
+    ok(ret, "PostMessage(WM_QUIT) error %ld\n", GetLastError());
     ret = WaitForSingleObject(hthread, INFINITE);
     ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
     CloseHandle(hthread);
@@ -18067,12 +18068,12 @@ static void test_layered_window(void)
     size.cx = size.cy = 250;
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
     ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
     ok_sequence( WmSetLayeredStyle, "WmSetLayeredStyle", FALSE );
 
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
-    ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+    ok( ret, "UpdateLayeredWindow failed err %lu\n", GetLastError() );
     ok_sequence( WmLayeredWinEmptySeq, "UpdateLayeredWindow", FALSE );
     GetWindowRect( hwnd, &rect );
     ok( rect.left == 300 && rect.top == 300 && rect.right == 550 && rect.bottom == 550,
@@ -18084,7 +18085,7 @@ static void test_layered_window(void)
     size.cx = 150;
     pos.y = 200;
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
-    ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+    ok( ret, "UpdateLayeredWindow failed err %lu\n", GetLastError() );
     ok_sequence( WmLayeredWinEmptySeq, "UpdateLayeredWindow", FALSE );
     GetWindowRect( hwnd, &rect );
     ok( rect.left == 300 && rect.top == 200 && rect.right == 450 && rect.bottom == 450,
@@ -18100,7 +18101,7 @@ static void test_layered_window(void)
     size.cx = 200;
     pos.x = 200;
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
-    ok( ret, "UpdateLayeredWindow failed err %u\n", GetLastError() );
+    ok( ret, "UpdateLayeredWindow failed err %lu\n", GetLastError() );
     ok_sequence( WmLayeredWinEmptySeq, "UpdateLayeredWindow", FALSE );
     GetWindowRect( hwnd, &rect );
     ok( rect.left == 200 && rect.top == 200 && rect.right == 400 && rect.bottom == 450,
@@ -18114,12 +18115,12 @@ static void test_layered_window(void)
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
     ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == ERROR_MR_MID_NOT_FOUND) ||
-        broken(GetLastError() == ERROR_GEN_FAILURE) /* win7 */, "wrong error %u\n", GetLastError() );
+        broken(GetLastError() == ERROR_GEN_FAILURE) /* win7 */, "wrong error %lu\n", GetLastError() );
     size.cx = 1;
     size.cy = -1;
     ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE );
     ok( !ret, "UpdateLayeredWindow should fail on non-layered window\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED );
     ok_sequence( WmSetLayeredStyle, "WmSetLayeredStyle", FALSE );
@@ -18189,10 +18190,10 @@ static LRESULT WINAPI cancel_popup_proc(HWND hwnd, UINT message, WPARAM wParam,
     case WM_INITMENU:
     case WM_INITMENUPOPUP:
     case WM_UNINITMENUPOPUP:
-        ok((HMENU)wParam == hpopupmenu, "expected %p, got %lx\n", hpopupmenu, wParam);
+        ok((HMENU)wParam == hpopupmenu, "expected %p, got %Ix\n", hpopupmenu, wParam);
         break;
     case WM_CAPTURECHANGED:
-        todo_wine ok(!lParam || (HWND)lParam == hwnd, "lost capture to %lx\n", lParam);
+        todo_wine ok(!lParam || (HWND)lParam == hwnd, "lost capture to %Ix\n", lParam);
         break;
     }
 
@@ -18221,12 +18222,12 @@ static void test_TrackPopupMenu(void)
     hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
                            0, 0, 1, 1, 0,
                            NULL, NULL, 0);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
 
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
 
     hpopupmenu = CreatePopupMenu();
-    ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hpopupmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
 
     AppendMenuA(hpopupmenu, MF_STRING, 100, "item 1");
     AppendMenuA(hpopupmenu, MF_STRING, 100, "item 2");
@@ -18235,13 +18236,13 @@ static void test_TrackPopupMenu(void)
     flush_sequence();
     ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
     ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE);
-    ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
+    ok(ret == 1, "TrackPopupMenu failed with error %li\n", GetLastError());
 
     /* Test popup closing with an ESC-press */
     flush_events();
     PostMessageW(hwnd, WM_KEYDOWN, VK_ESCAPE, 0);
     ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
-    ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
+    ok(ret == 1, "TrackPopupMenu failed with error %li\n", GetLastError());
     PostQuitMessage(0);
     flush_sequence();
     while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )
@@ -18270,7 +18271,7 @@ static void test_TrackPopupMenu(void)
     SetTimer( hwnd, TIMER_ID, 500, NULL );
     ret = TrackPopupMenu( hpopupmenu, 0, 100,100, 0, hwnd, NULL );
     ok_sequence( WmTrackPopupMenuMinimizeWindow, "TrackPopupMenuMinimizeWindow", TRUE );
-    ok( ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError() );
+    ok( ret == 1, "TrackPopupMenu failed with error %li\n", GetLastError() );
     KillTimer( hwnd, TIMER_ID );
     ShowWindow( hwnd, SW_RESTORE );
 
@@ -18282,7 +18283,7 @@ static void test_TrackPopupMenu(void)
     flush_sequence();
     ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
     ok_sequence(WmTrackPopupMenuCapture, "TrackPopupMenuCapture", TRUE);
-    ok(ret == 1, "TrackPopupMenuCapture failed with error %i\n", GetLastError());
+    ok(ret == 1, "TrackPopupMenuCapture failed with error %li\n", GetLastError());
 
     DestroyMenu(hpopupmenu);
     DestroyWindow(hwnd);
@@ -18296,12 +18297,12 @@ static void test_TrackPopupMenuEmpty(void)
     hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0,
                            0, 0, 1, 1, 0,
                            NULL, NULL, 0);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
 
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc);
 
     hpopupmenu = CreatePopupMenu();
-    ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hpopupmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
 
     flush_events();
     flush_sequence();
@@ -18394,14 +18395,14 @@ static void test_SendMessage_other_thread(int thread_n)
     ok(wnd_event.hwnd != 0, "CreateWindowEx failed\n");
 
     hthread = CreateThread(NULL, 0, thread_n == 1 ? SendMessage_thread_1 : SendMessage_thread_2, &wnd_event, 0, &tid);
-    ok(hthread != NULL, "CreateThread failed, error %d\n", GetLastError());
+    ok(hthread != NULL, "CreateThread failed, error %ld\n", GetLastError());
     CloseHandle(hthread);
 
     flush_events();
     flush_sequence();
 
     ret = GetQueueStatus(QS_SENDMESSAGE);
-    ok(ret == 0, "wrong status %08x\n", ret);
+    ok(ret == 0, "wrong status %08lx\n", ret);
 
     SetEvent(wnd_event.start_event);
 
@@ -18414,7 +18415,7 @@ static void test_SendMessage_other_thread(int thread_n)
     }
 
     ret = GetQueueStatus(QS_SENDMESSAGE|QS_POSTMESSAGE);
-    ok(ret == MAKELONG(QS_POSTMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE), "wrong status %08x\n", ret);
+    ok(ret == MAKELONG(QS_POSTMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE), "wrong status %08lx\n", ret);
 
     trace("main: call GetMessage\n");
     GetMessageA(&msg, 0, 0, 0);
@@ -18424,7 +18425,7 @@ static void test_SendMessage_other_thread(int thread_n)
 
     ret = WaitForSingleObject(wnd_event.stop_event, 100);
     todo_wine_if (thread_n == 2)
-    ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed, ret:%x\n", ret);
+    ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed, ret:%lx\n", ret);
 
     /* intentionally yield */
     MsgWaitForMultipleObjects(0, NULL, FALSE, 100, qs_all_input);
@@ -18434,7 +18435,7 @@ static void test_SendMessage_other_thread(int thread_n)
     ok_sequence(send_message_2, "SendMessage from other thread 2", FALSE);
 
     ret = GetQueueStatus(QS_SENDMESSAGE|QS_POSTMESSAGE);
-    ok(ret == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE), "wrong status %08x\n", ret);
+    ok(ret == MAKELONG(QS_SENDMESSAGE, QS_SENDMESSAGE|QS_POSTMESSAGE), "wrong status %08lx\n", ret);
 
     trace("main: call PeekMessage\n");
     ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "PeekMessage should not fail\n");
@@ -18448,14 +18449,14 @@ static void test_SendMessage_other_thread(int thread_n)
     ret = GetQueueStatus(QS_SENDMESSAGE|QS_POSTMESSAGE);
     /* FIXME: remove once Wine is fixed */
     todo_wine_if (thread_n == 2)
-    ok(ret == 0, "wrong status %08x\n", ret);
+    ok(ret == 0, "wrong status %08lx\n", ret);
 
     trace("main: call PeekMessage\n");
     ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "PeekMessage should fail\n");
     ok_sequence(WmEmptySeq, "SendMessage from other thread 5", thread_n == 2);
 
     ret = GetQueueStatus(QS_SENDMESSAGE|QS_POSTMESSAGE);
-    ok(ret == 0, "wrong status %08x\n", ret);
+    ok(ret == 0, "wrong status %08lx\n", ret);
 
     trace("main: call DestroyWindow\n");
     DestroyWindow(msg.hwnd);
@@ -18475,34 +18476,34 @@ static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp,
     switch (msg)
     {
     case WM_USER:
-        ok( flags == ISMEX_SEND, "wrong flags %x\n", flags );
+        ok( flags == ISMEX_SEND, "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         ret = ReplyMessage( msg );
-        ok( ret, "ReplyMessage failed err %u\n", GetLastError() );
+        ok( ret, "ReplyMessage failed err %lu\n", GetLastError() );
         flags = InSendMessageEx( NULL );
-        ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %x\n", flags );
+        ok( flags == (ISMEX_SEND | ISMEX_REPLIED), "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         break;
     case WM_USER + 1:
-        ok( flags == ISMEX_NOTIFY, "wrong flags %x\n", flags );
+        ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         ret = ReplyMessage( msg );
-        ok( ret, "ReplyMessage failed err %u\n", GetLastError() );
+        ok( ret, "ReplyMessage failed err %lu\n", GetLastError() );
         flags = InSendMessageEx( NULL );
-        ok( flags == ISMEX_NOTIFY, "wrong flags %x\n", flags );
+        ok( flags == ISMEX_NOTIFY, "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         break;
     case WM_USER + 2:
-        ok( flags == ISMEX_CALLBACK, "wrong flags %x\n", flags );
+        ok( flags == ISMEX_CALLBACK, "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         ret = ReplyMessage( msg );
-        ok( ret, "ReplyMessage failed err %u\n", GetLastError() );
+        ok( ret, "ReplyMessage failed err %lu\n", GetLastError() );
         flags = InSendMessageEx( NULL );
-        ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %x\n", flags );
+        ok( flags == (ISMEX_CALLBACK | ISMEX_REPLIED) || flags == ISMEX_SEND, "wrong flags %lx\n", flags );
         ok( InSendMessage(), "InSendMessage returned false\n" );
         break;
     case WM_USER + 3:
-        ok( flags == ISMEX_NOSEND, "wrong flags %x\n", flags );
+        ok( flags == ISMEX_NOSEND, "wrong flags %lx\n", flags );
         ok( !InSendMessage(), "InSendMessage returned true\n" );
         ret = ReplyMessage( msg );
         ok( !ret, "ReplyMessage succeeded\n" );
@@ -18515,7 +18516,7 @@ static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp,
 static void CALLBACK msg_callback( HWND hwnd, UINT msg, ULONG_PTR arg, LRESULT result )
 {
     ok( msg == WM_USER + 2, "wrong msg %x\n", msg );
-    ok( result == WM_USER + 2, "wrong result %lx\n", result );
+    ok( result == WM_USER + 2, "wrong result %Ix\n", result );
 }
 
 static DWORD WINAPI send_message_thread( void *arg )
@@ -18545,10 +18546,10 @@ static void test_InSendMessage(void)
     RegisterClassA(&cls);
 
     win = CreateWindowA( "InSendMessage_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, send_message_thread, 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)) DispatchMessageA( &msg );
 
@@ -18696,12 +18697,12 @@ static void test_invalid_window(void)
     SetLastError(0xdeadbeef);
     ret = GetMessageA(&msg, (HWND)0xdeadbeef, 0, 0);
     ok(ret == -1, "wrong ret %d\n", ret);
-    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = PeekMessageA(&msg, (HWND)0xdeadbeef, 0, 0, PM_REMOVE);
     ok(!ret, "wrong ret %d\n", ret);
-    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError());
 }
 
 static void test_button_style(void)
@@ -18718,17 +18719,17 @@ static void test_button_style(void)
 
         type = GetWindowLongW(button, GWL_STYLE) & BS_TYPEMASK;
         expected_type = (i == BS_USERBUTTON ? BS_PUSHBUTTON : i);
-        ok(type == expected_type, "Expected type %#x, got %#x.\n", expected_type, type);
+        ok(type == expected_type, "Expected type %#lx, got %#lx.\n", expected_type, type);
 
         for (j = BS_PUSHBUTTON; j <= BS_DEFCOMMANDLINK; ++j)
         {
             ret = SendMessageA(button, BM_SETSTYLE, j, FALSE);
-            ok(ret == 0, "Expected %#x, got %#lx.\n", 0, ret);
+            ok(ret == 0, "Expected %#x, got %#Ix.\n", 0, ret);
 
             type = GetWindowLongW(button, GWL_STYLE) & BS_TYPEMASK;
             expected_type = j;
 
-            ok(type == expected_type, "Original type %#x, expected new type %#x, got %#x.\n", i,
+            ok(type == expected_type, "Original type %#lx, expected new type %#lx, got %#lx.\n", i,
                     expected_type, type);
         }
         DestroyWindow(button);
@@ -18869,12 +18870,12 @@ START_TEST(msg)
     if (pUnhookWinEvent && hEvent_hook)
     {
 	ret = pUnhookWinEvent(hEvent_hook);
-	ok( ret, "UnhookWinEvent error %d\n", GetLastError());
+	ok( ret, "UnhookWinEvent error %ld\n", GetLastError());
 	SetLastError(0xdeadbeef);
 	ok(!pUnhookWinEvent(hEvent_hook), "UnhookWinEvent succeeded\n");
 	ok(GetLastError() == ERROR_INVALID_HANDLE || /* Win2k */
 	   GetLastError() == 0xdeadbeef, /* Win9x */
-           "unexpected error %d\n", GetLastError());
+           "unexpected error %ld\n", GetLastError());
     }
     DeleteCriticalSection( &sequence_cs );
 }




More information about the wine-devel mailing list