[PATCH 11/20] dlls/user32/tests/[j-u]*.c: enable compilation with long types

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


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

---
 dlls/user32/tests/listbox.c   |  211 ++++-----
 dlls/user32/tests/menu.c      |  333 +++++++-------
 dlls/user32/tests/monitor.c   |  435 +++++++++---------
 dlls/user32/tests/msg.c       |  973 +++++++++++++++++++++--------------------
 dlls/user32/tests/resource.c  |   21 -
 dlls/user32/tests/scroll.c    |   93 ++--
 dlls/user32/tests/static.c    |   17 -
 dlls/user32/tests/sysparams.c |  593 +++++++++++++------------
 dlls/user32/tests/text.c      |   73 ++-
 dlls/user32/tests/uitools.c   |    5 
 10 files changed, 1382 insertions(+), 1372 deletions(-)

diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index cb2551002d6..5a09282f6a6 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for list boxes.
  *
  * Copyright 2003 Ferenc Wagner
@@ -128,7 +129,7 @@ keypress (HWND handle, WPARAM keycode, BYTE scancode, BOOL extended)
 }
 
 #define listbox_field_ok(t, s, f, got) \
-  ok (t.s.f==got.f, "style %#x, step " #s ", field " #f \
+  ok (t.s.f==got.f, "style %#lx, step " #s ", field " #f \
       ": expected %d, got %d\n", style, t.s.f, got.f)
 
 #define listbox_todo_field_ok(t, s, f, got) \
@@ -223,7 +224,7 @@ static void check_item_height(void)
     ok (SendMessageA(hLB, WM_SETFONT, (WPARAM)font, 0) == 0, "Can't set font\n");
 
     itemHeight = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
-    ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %d\n", itemHeight, tm.tmHeight);
+    ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
 
     DestroyWindow (hLB);
 
@@ -249,7 +250,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
         DWORD style = GetWindowLongA(GetWindow(hwnd, GW_CHILD), GWL_STYLE);
         MEASUREITEMSTRUCT *mi = (void*)lparam;
 
-        ok(wparam == mi->CtlID, "got wParam=%08lx, expected %08x\n", wparam, mi->CtlID);
+        ok(wparam == mi->CtlID, "got wParam=%08Ix, expected %08x\n", wparam, mi->CtlID);
         ok(mi->CtlType == ODT_LISTBOX, "mi->CtlType = %u\n", mi->CtlType);
         ok(mi->CtlID == 1, "mi->CtlID = %u\n", mi->CtlID);
         ok(mi->itemHeight, "mi->itemHeight = 0\n");
@@ -265,7 +266,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
         else
         {
             ok((void*)mi->itemData == strings[mi->itemID],
-                    "mi->itemData = %08lx, expected %p\n", mi->itemData, strings[mi->itemID]);
+                    "mi->itemData = %08Ix, expected %p\n", mi->itemData, strings[mi->itemID]);
         }
         break;
     }
@@ -274,9 +275,9 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
         RECT rc_item, rc_client, rc_clip;
         DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam;
 
-        trace("%p WM_DRAWITEM %08lx %08lx\n", hwnd, wparam, lparam);
+        trace("%p WM_DRAWITEM %08Ix %08Ix\n", hwnd, wparam, lparam);
 
-        ok(wparam == dis->CtlID, "got wParam=%08lx instead of %08x\n",
+        ok(wparam == dis->CtlID, "got wParam=%08Ix instead of %08x\n",
 			wparam, dis->CtlID);
         ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType);
 
@@ -386,14 +387,14 @@ static void test_ownerdraw(void)
         SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
         trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
         ok(!IsRectEmpty(&rc), "empty item rect\n");
-        ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
+        ok(rc.top < 0, "rc.top is not negative (%ld)\n", rc.top);
 
         DestroyWindow(hLB);
 
         /* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
         hLB = CreateWindowA("listbox", "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE | styles[i],
             0, 0, 100, 100, NULL, NULL, NULL, 0);
-        ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
+        ok(hLB != NULL, "last error 0x%08lx\n", GetLastError());
 
         ok(GetWindowLongA(hLB, GWL_STYLE) & LBS_OWNERDRAWVARIABLE, "Unexpected window style.\n");
 
@@ -785,70 +786,70 @@ static void test_changing_selection_styles(void)
             for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
             {
                 ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"x");
-                ok(ret == k, "%u: Unexpected return value %d, expected %d.\n", j, ret, k);
+                ok(ret == k, "%u: Unexpected return value %ld, expected %d.\n", j, ret, k);
             }
             ret = SendMessageA(listbox, LB_GETCOUNT, 0, 0);
-            ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %d.\n", j, ret);
+            ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %ld.\n", j, ret);
 
             /* Select items with different methods */
             ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
-            ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
             ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(0, 0));
-            ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
             ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(2, 2));
-            ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
 
             /* Verify that the proper items are selected */
             for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
             {
                 ret = SendMessageA(listbox, LB_GETSEL, k, 0);
-                ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+                ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
                     j, ret, selexpect[k]);
             }
 
             /* Now change the selection style */
             style = GetWindowLongA(listbox, GWL_STYLE);
             ok((style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == selstyles[j],
-                "%u: unexpected window styles %#x.\n", j, style);
+                "%u: unexpected window styles %#lx.\n", j, style);
             if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
                 style &= ~selstyles[j];
             else
                 style |= LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
             SetWindowLongA(listbox, GWL_STYLE, style);
             style = GetWindowLongA(listbox, GWL_STYLE);
-            ok(!(style & selstyles[j]), "%u: unexpected window styles %#x.\n", j, style);
+            ok(!(style & selstyles[j]), "%u: unexpected window styles %#lx.\n", j, style);
 
             /* Verify that the same items are selected */
             ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
-            ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
+            ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
                 j, getselcount_expect, ret);
 
             for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
             {
                 ret = SendMessageA(listbox, LB_GETSEL, k, 0);
-                ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+                ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
                     j, ret, selexpect[k]);
             }
 
             /* Lastly see if we can still change the selection as before with old style */
             if (setcursel_expect != LB_ERR) setcursel_expect = 0;
             ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
-            ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
             ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 1));
-            ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
             ret = SendMessageA(listbox, LB_SELITEMRANGE, FALSE, MAKELPARAM(2, 2));
-            ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
+            ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
 
             /* And verify the selections */
             selexpect = (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) ? selexpect_multi2 : selexpect_single2;
             ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
-            ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
+            ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
                 j, getselcount_expect, ret);
 
             for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
             {
                 ret = SendMessageA(listbox, LB_GETSEL, k, 0);
-                ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
+                ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
                     j, ret, selexpect[k]);
             }
 
@@ -872,13 +873,13 @@ static void test_itemfrompoint(void)
 
     /* For an empty listbox win2k returns 0x1ffff, win98 returns 0x10000, nt4 returns 0xffffffff */
     r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
-    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
 
     r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 700, 30 ));
-    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
 
     r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 30, 300 ));
-    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
+    ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
 
     id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
     ok( id == 0, "item id wrong\n");
@@ -886,17 +887,17 @@ static void test_itemfrompoint(void)
     ok( id == 1, "item id wrong\n");
 
     r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
-    ok( r == 0x1, "ret %x\n", r );
+    ok( r == 0x1, "ret %lx\n", r );
 
     r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 601 ));
     ok( r == 0x10001 || broken(r == 1), /* nt4 */
-        "ret %x\n", r );
+        "ret %lx\n", r );
 
     /* Resize control so that below assertions about sizes are valid */
     r = SendMessageA( hList, LB_GETITEMRECT, 0, (LPARAM)&rc);
-    ok( r == 1, "ret %x\n", r);
+    ok( r == 1, "ret %lx\n", r);
     r = MoveWindow(hList, 1, 1, 600, (rc.bottom - rc.top + 1) * 9 / 2, TRUE);
-    ok( r != 0, "ret %x\n", r);
+    ok( r != 0, "ret %lx\n", r);
 
     id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi2");
     ok( id == 2, "item id wrong\n");
@@ -916,31 +917,31 @@ static void test_itemfrompoint(void)
 
     SendMessageA( hList, LB_SETTOPINDEX, 1, 0);
     r = SendMessageA( hList, LB_GETTOPINDEX, 0, 0);
-    ok( r == 1, "top %d\n", r);
+    ok( r == 1, "top %ld\n", r);
 
     r = SendMessageA( hList, LB_GETITEMRECT, 5, (LPARAM)&rc);
-    ok( r == 1, "ret %x\n", r);
+    ok( r == 1, "ret %lx\n", r);
     r = SendMessageA( hList, LB_GETITEMRECT, 6, (LPARAM)&rc);
-    ok( r == 0, "ret %x\n", r);
+    ok( r == 0, "ret %lx\n", r);
 
     r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(/* x */ 10, /* y */ 10) );
-    ok( r == 1, "ret %x\n", r);
+    ok( r == 1, "ret %lx\n", r);
 
     r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(1000, 10) );
     ok( r == 0x10001 || broken(r == 1), /* nt4 */
-        "ret %x\n", r );
+        "ret %lx\n", r );
 
     r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, -10) );
     ok( r == 0x10001 || broken(r == 1), /* nt4 */
-        "ret %x\n", r );
+        "ret %lx\n", r );
 
     r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 100) );
     ok( r == 0x10005 || broken(r == 5), /* nt4 */
-        "item %x\n", r );
+        "item %lx\n", r );
 
     r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 200) );
     ok( r == 0x10005 || broken(r == 5), /* nt4 */
-        "item %x\n", r );
+        "item %lx\n", r );
 
     DestroyWindow( hList );
 }
@@ -993,7 +994,7 @@ static void test_listbox_LB_DIR(void)
     ok(ret, "Failed to create test directory.\n");
 
     file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
-    ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
     CloseHandle( file );
 
     /* NOTE: for this test to succeed, there must be no subdirectories
@@ -1017,7 +1018,7 @@ static void test_listbox_LB_DIR(void)
         strcpy(pathBuffer, wildcard);
         res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
     }
-    ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08x\n", GetLastError());
+    ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox */
     itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1044,7 +1045,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, "w*.c");
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
-    ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08x\n", GetLastError());
+    ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08lx\n", GetLastError());
 
     /* Path specification does NOT converted to uppercase */
     ok (!strcmp(pathBuffer, "w*.c"),
@@ -1072,7 +1073,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox.
      * All files plus "[..]"
@@ -1101,7 +1102,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, "w*.c");
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
-    ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08x\n", GetLastError());
+    ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. Since the parent directory does not
      * fit w*.c, there should be exactly the same number of items as without DDL_DIRECTORY
@@ -1130,7 +1131,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
-    ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *)  failed - 0x%08x\n", GetLastError());
+    ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *)  failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be at least one element before, since the string "[-c-]" should
@@ -1177,7 +1178,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *)  failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *)  failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be at least one element before, since the string "[-c-]" should
@@ -1205,7 +1206,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, "w*.c");
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c)  failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c)  failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be at least one element before, since the string "[-c-]" should
@@ -1240,7 +1241,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be exactly the number of plain files, plus the number of mapped drives.
@@ -1280,7 +1281,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, "w*.c");
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be exactly the number of plain files, plus the number of mapped drives.
@@ -1314,7 +1315,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
-    ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n", GetLastError());
+    ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %lu\n", GetLastError());
 
     itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
     ok (itemCount == itemCount_allDirs,
@@ -1356,7 +1357,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, wildcard);
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
-    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
+    ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
 
     /* There should be no plain files on the listbox */
     itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1391,7 +1392,7 @@ static void test_listbox_LB_DIR(void)
     strcpy(pathBuffer, "w*.c");
     SendMessageA(hList, LB_RESETCONTENT, 0, 0);
     res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
-    ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
+    ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
 
     /* There should be no plain files on the listbox, and no [..], since it does not fit w*.c */
     itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
@@ -1497,7 +1498,7 @@ static void test_listbox_dlgdir(void)
     HANDLE file;
 
     file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
-    ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
     CloseHandle( file );
 
     /* NOTE: for this test to succeed, there must be no subdirectories
@@ -1524,7 +1525,7 @@ static void test_listbox_dlgdir(void)
      */
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL, 0);
-    ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08x\n", res, GetLastError());
+    ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08lx\n", res, GetLastError());
 
     /* Path specification gets converted to uppercase */
     ok (!strcmp(pathBuffer, "W*.C"),
@@ -1562,7 +1563,7 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DIRECTORY);
-    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08x\n", GetLastError());
+    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be exactly more elements than before, since the directories should
@@ -1609,7 +1610,7 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DRIVES);
-    ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+    ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be at least one element before, since the string "[-c-]" should
@@ -1651,7 +1652,7 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DIRECTORY|DDL_DRIVES);
-    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
 
     /* There should be some content in the listbox. In particular, there should
      * be exactly the number of plain files, plus the number of mapped drives,
@@ -1698,7 +1699,7 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DIRECTORY|DDL_EXCLUSIVE);
-    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
+    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
 
     /* There should be exactly one element: "[..]" */
     itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
@@ -1727,7 +1728,7 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "w*.c");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE);
-    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
+    ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
 
     /* There should be no plain files on the listbox */
     itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
@@ -1762,14 +1763,14 @@ static void test_listbox_dlgdir(void)
     strcpy(pathBuffer, "*");
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
         DDL_DIRECTORY|DDL_DRIVES);
-    ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
+    ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
 
     SendMessageA(g_listBox, LB_SETCURSEL, -1, 0); /* Unselect any current selection */
     memset(pathBuffer, 0, MAX_PATH);
     SetLastError(0xdeadbeef);
     res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
     ok (GetLastError() == 0xdeadbeef,
-        "DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08x\n",
+        "DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08lx\n",
         GetLastError());
     ok (res == 0, "DlgDirSelectEx() with no selection returned %d, expected 0\n", res);
     /* WinXP-SP2 leaves pathBuffer untouched, but Win98 fills it with garbage. */
@@ -1791,7 +1792,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1803,7 +1804,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1820,7 +1821,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1854,7 +1855,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1866,7 +1867,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1883,7 +1884,7 @@ static void test_listbox_dlgdir(void)
             SetLastError(0xdeadbeef);
             res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
             ok (GetLastError() == 0xdeadbeef,
-               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
+               "DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
                 i, GetLastError());
             ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
 
@@ -1915,7 +1916,7 @@ static void test_listbox_dlgdir(void)
     res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
     ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
     ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
-       "GetLastError should return 0x589, got 0x%X\n",GetLastError());
+       "GetLastError should return 0x589, got 0x%lX\n",GetLastError());
 
     DestroyWindow(hWnd);
 }
@@ -1940,9 +1941,9 @@ static void test_set_count( void )
     ok( IsRectEmpty( &r ), "got non-empty rect\n");
 
     ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
-    ok( ret == 0, "got %d\n", ret );
+    ok( ret == 0, "got %ld\n", ret );
     ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
-    ok( ret == 100, "got %d\n", ret );
+    ok( ret == 100, "got %ld\n", ret );
 
     GetUpdateRect( listbox, &r, TRUE );
     ok( !IsRectEmpty( &r ), "got empty rect\n");
@@ -1952,15 +1953,15 @@ static void test_set_count( void )
     ok( IsRectEmpty( &r ), "got non-empty rect\n");
 
     ret = SendMessageA( listbox, LB_SETCOUNT, 99, 0 );
-    ok( ret == 0, "got %d\n", ret );
+    ok( ret == 0, "got %ld\n", ret );
 
     GetUpdateRect( listbox, &r, TRUE );
     ok( !IsRectEmpty( &r ), "got empty rect\n");
 
     ret = SendMessageA( listbox, LB_SETCOUNT, -5, 0 );
-    ok( ret == 0, "got %d\n", ret );
+    ok( ret == 0, "got %ld\n", ret );
     ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
-    ok( ret == -5, "got %d\n", ret );
+    ok( ret == -5, "got %ld\n", ret );
 
     DestroyWindow( listbox );
 
@@ -1970,8 +1971,8 @@ static void test_set_count( void )
 
         SetLastError( 0xdeadbeef );
         ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
-        ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
-        ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %d.\n", GetLastError() );
+        ok( ret == LB_ERR, "expected %d, got %ld\n", LB_ERR, ret );
+        ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %ld.\n", GetLastError() );
 
         DestroyWindow( listbox );
     }
@@ -2014,7 +2015,7 @@ static void test_GetListBoxInfo(void)
 
     lb_getlistboxinfo = 0;
     ret = pGetListBoxInfo(listbox);
-    ok(ret > 0, "got %d\n", ret);
+    ok(ret > 0, "got %ld\n", ret);
     todo_wine
     ok(lb_getlistboxinfo == 0, "got %d\n", lb_getlistboxinfo);
 
@@ -2040,45 +2041,45 @@ static void test_init_storage( void )
                                 0, 0, 100, 100, parent, (HMENU)1, NULL, 0);
 
         items_size = SendMessageA(listbox, LB_INITSTORAGE, 100, 0);
-        ok(items_size >= 100, "expected at least 100, got %d\n", items_size);
+        ok(items_size >= 100, "expected at least 100, got %ld\n", items_size);
 
         ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
-        ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+        ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
 
         /* it doesn't grow since the space was already reserved */
         ret = SendMessageA(listbox, LB_INITSTORAGE, items_size, 0);
-        ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+        ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
 
         /* it doesn't shrink the reserved space */
         ret = SendMessageA(listbox, LB_INITSTORAGE, 42, 0);
-        ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+        ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
 
         /* now populate almost all of it so it's not reserved anymore */
         if (styles[i] & LBS_NODATA)
         {
             ret = SendMessageA(listbox, LB_SETCOUNT, items_size - 1, 0);
-            ok(ret == 0, "unexpected return value %d\n", ret);
+            ok(ret == 0, "unexpected return value %ld\n", ret);
         }
         else
         {
             for (j = 0; j < items_size - 1; j++)
             {
                 ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
-                ok(ret == j, "expected %d, got %d\n", j, ret);
+                ok(ret == j, "expected %d, got %ld\n", j, ret);
             }
         }
 
         /* we still have one more reserved slot, so it doesn't grow yet */
         ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
-        ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+        ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
 
         /* fill the slot and check again, it should grow this time */
         ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
-        ok(ret == items_size - 1, "expected %d, got %d\n", items_size - 1, ret);
+        ok(ret == items_size - 1, "expected %ld, got %ld\n", items_size - 1, ret);
         ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
-        ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
+        ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
         ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
-        ok(ret > items_size, "expected it to grow past %d, got %d\n", items_size, ret);
+        ok(ret > items_size, "expected it to grow past %ld, got %ld\n", items_size, ret);
 
         DestroyWindow(listbox);
     }
@@ -2120,7 +2121,7 @@ static void test_extents(void)
     listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+    ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2135,7 +2136,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2150,7 +2151,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2167,7 +2168,7 @@ static void test_extents(void)
     listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+    ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2182,7 +2183,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2197,7 +2198,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2211,7 +2212,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 0, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2228,7 +2229,7 @@ static void test_extents(void)
     listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL | LBS_DISABLENOSCROLL, parent);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
+    ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2243,7 +2244,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 64, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2258,7 +2259,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 184, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2272,7 +2273,7 @@ static void test_extents(void)
     SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
 
     res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
-    ok(res == 0, "Got wrong horizontal extent: %u\n", res);
+    ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
 
     sinfo.cbSize = sizeof(sinfo);
     sinfo.fMask = SIF_RANGE;
@@ -2297,14 +2298,14 @@ static void test_WM_MEASUREITEM(void)
     listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE, parent);
 
     data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
-    ok(data == (LRESULT)strings[0], "data = %08lx, expected %p\n", data, strings[0]);
+    ok(data == (LRESULT)strings[0], "data = %08Ix, expected %p\n", data, strings[0]);
     DestroyWindow(parent);
 
     parent = create_parent();
     listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, parent);
 
     data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
-    ok(!data, "data = %08lx\n", data);
+    ok(!data, "data = %08Ix\n", data);
     DestroyWindow(parent);
 }
 
@@ -2375,27 +2376,27 @@ static void test_LBS_NODATA(void)
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_FINDSTRING, 1, 0);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 0);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 0);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42);
     ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
 
     DestroyWindow(listbox);
 
@@ -2412,7 +2413,7 @@ static void test_LBS_NODATA(void)
         ok(listbox != NULL, "Failed to create a listbox.\n");
 
         style = GetWindowLongA(listbox, GWL_STYLE);
-        ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#x.\n", i, style);
+        ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#lx.\n", i, style);
         ret = SendMessageA(listbox, LB_SETCOUNT, 100, 0);
         ok(ret == LB_ERR, "%u: unexpected return value %d.\n", i, ret);
         DestroyWindow(listbox);
diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index cc0a9e6d9fa..4724b292e72 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for menus
  *
@@ -120,9 +121,9 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
             {
                 MEASUREITEMSTRUCT* pmis = (MEASUREITEMSTRUCT*)lparam;
                 if (winetest_debug > 1)
-                    trace("WM_MEASUREITEM received data %lx size %dx%d\n",
+                    trace("WM_MEASUREITEM received data %Ix size %dx%d\n",
                             pmis->itemData, pmis->itemWidth, pmis->itemHeight);
-                ok( !wparam, "wrong wparam %lx\n", wparam );
+                ok( !wparam, "wrong wparam %Ix\n", wparam );
                 ok( pmis->CtlType == ODT_MENU, "wrong type %x\n", pmis->CtlType );
                 MOD_odheight = pmis->itemHeight;
                 pmis->itemWidth = MODsizes[pmis->itemData].cx;
@@ -141,7 +142,7 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
                 if (winetest_debug > 1) {
                     RECT rc;
                     GetMenuItemRect( hwnd, (HMENU)pdis->hwndItem, pdis->itemData ,&rc);
-                    trace("WM_DRAWITEM received hwnd %p hmenu %p itemdata %ld item %d rc %s itemrc:  %s\n",
+                    trace("WM_DRAWITEM received hwnd %p hmenu %p itemdata %Id item %d rc %s itemrc:  %s\n",
                             hwnd, pdis->hwndItem, pdis->itemData, pdis->itemID,
                             wine_dbgstr_rect(&pdis->rcItem), wine_dbgstr_rect(&rc));
                     oldpen=SelectObject( pdis->hDC, GetStockObject(
@@ -150,7 +151,7 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
                             pdis->rcItem.right,pdis->rcItem.bottom );
                     SelectObject( pdis->hDC, oldpen);
                 }
-                ok( !wparam, "wrong wparam %lx\n", wparam );
+                ok( !wparam, "wrong wparam %Ix\n", wparam );
                 ok( pdis->CtlType == ODT_MENU, "wrong type %x\n", pdis->CtlType );
                 /* calculate widths of some menu texts */
                 if( ! MOD_txtsizes[0].size.cx)
@@ -236,7 +237,7 @@ static void test_getmenubarinfo(void)
     hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
             WS_SYSMENU | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
             NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
 
     /* no menu: getmenubarinfo should fail */
     SetLastError(0xdeadbeef);
@@ -247,10 +248,10 @@ static void test_getmenubarinfo(void)
 
     /* create menubar, no items yet */
     hmenu = CreateMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
 
     ret = SetMenu(hwnd, hmenu);
-    ok(ret, "SetMenu failed with error %d\n", GetLastError());
+    ok(ret, "SetMenu failed with error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetMenuBarInfo(NULL, OBJID_CLIENT, 0, &mbi);
@@ -285,7 +286,7 @@ static void test_getmenubarinfo(void)
     ok(err == 0xdeadbeef, "err = %d\n", err);
 
     ret = GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
-    ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetMenuBarInfo failed with error %ld\n", GetLastError());
 
     ok(mbi.rcBar.left == 0 && mbi.rcBar.top == 0 && mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0,
             "rcBar: Expected (0,0)-(0,0), got: %s\n", wine_dbgstr_rect(&mbi.rcBar));
@@ -300,7 +301,7 @@ static void test_getmenubarinfo(void)
     ret = AppendMenuA(hmenu, MF_STRING , 101, "item 2");
     ok(ret, "AppendMenu failed.\n");
     ret = SetMenu(hwnd, hmenu);
-    ok(ret, "SetMenu failed with error %d\n", GetLastError());
+    ok(ret, "SetMenu failed with error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = GetMenuBarInfo(hwnd, OBJID_MENU, 200, &mbi);
@@ -310,7 +311,7 @@ static void test_getmenubarinfo(void)
 
     /* get info for the whole menu */
     ret = GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
-    ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetMenuBarInfo failed with error %ld\n", GetLastError());
 
     /* calculate menu rectangle, from window rectangle and the position of the first item  */
     ret = GetWindowRect(hwnd, &rcw);
@@ -319,7 +320,7 @@ static void test_getmenubarinfo(void)
     ok(ret, "GetMenuItemRect failed.\n");
     todo_wine ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top &&
             mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rcw.right - rci.left + rcw.left,
-            "rcBar: Got %s instead of (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mbi.rcBar),
+            "rcBar: Got %s instead of (%ld,%ld)-(%ld,%ld)\n", wine_dbgstr_rect(&mbi.rcBar),
             rci.left, rci.top, rcw.right - rci.left + rcw.left, rci.bottom);
     ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu);
     ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused);
@@ -327,7 +328,7 @@ static void test_getmenubarinfo(void)
 
     /* get info for item nr.2 */
     ret = GetMenuBarInfo(hwnd, OBJID_MENU, 2, &mbi);
-    ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
+    ok(ret, "GetMenuBarInfo failed with error %ld\n", GetLastError());
     ret = GetMenuItemRect(hwnd, hmenu, 1, &rci);
     ok(ret, "GetMenuItemRect failed.\n");
     ok(EqualRect(&mbi.rcBar, &rci), "rcBar: Got %s instead of %s\n", wine_dbgstr_rect(&mbi.rcBar),
@@ -352,21 +353,21 @@ static void test_GetMenuItemRect(void)
 
     hwnd = CreateWindowW((LPCWSTR)MAKEINTATOM(atomMenuCheckClass), NULL, WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL,
                          NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindow failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindow failed with error %ld\n", GetLastError());
     hmenu = CreateMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     popup_hmenu = CreatePopupMenu();
-    ok(popup_hmenu != NULL, "CreatePopupMenu failed with error %d\n", GetLastError());
+    ok(popup_hmenu != NULL, "CreatePopupMenu failed with error %ld\n", GetLastError());
     ret = AppendMenuA(popup_hmenu, MF_STRING, 0, "Popup");
-    ok(ret, "AppendMenu failed with error %d\n", GetLastError());
+    ok(ret, "AppendMenu failed with error %ld\n", GetLastError());
     ret = AppendMenuA(hmenu, MF_STRING | MF_POPUP, (UINT_PTR)popup_hmenu, "Menu");
-    ok(ret, "AppendMenu failed with error %d\n", GetLastError());
+    ok(ret, "AppendMenu failed with error %ld\n", GetLastError());
     ret = SetMenu(hwnd, hmenu);
-    ok(ret, "SetMenu failed with error %d\n", GetLastError());
+    ok(ret, "SetMenu failed with error %ld\n", GetLastError());
 
     /* Get the menu item rectangle of the displayed sysmenu item */
     ret = GetMenuItemRect(hwnd, hmenu, 0, &item_rect);
-    ok(ret, "GetMenuItemRect failed with error %d\n", GetLastError());
+    ok(ret, "GetMenuItemRect failed with error %ld\n", GetLastError());
     GetWindowRect(hwnd, &window_rect);
     /* Get the screen coordinate of the left top corner of the client rectangle */
     client_top_left.x = 0;
@@ -374,22 +375,22 @@ static void test_GetMenuItemRect(void)
     MapWindowPoints(hwnd, 0, &client_top_left, 1);
     caption_height = GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION);
 
-    ok(item_rect.left == client_top_left.x, "Expect item_rect.left %d == %d\n", item_rect.left, client_top_left.x);
-    ok(item_rect.right <= window_rect.right, "Expect item_rect.right %d <= %d\n", item_rect.right, window_rect.right);
+    ok(item_rect.left == client_top_left.x, "Expect item_rect.left %ld == %ld\n", item_rect.left, client_top_left.x);
+    ok(item_rect.right <= window_rect.right, "Expect item_rect.right %ld <= %ld\n", item_rect.right, window_rect.right);
     /* A gap of 1 pixel is added deliberately in commit 75f9e64, so using equal operator would fail on Wine.
      * Check that top and bottom are correct with 1 pixel margin tolerance */
-    ok(item_rect.top - (window_rect.top + caption_height) <= 1, "Expect item_rect.top %d - %d <= 1\n", item_rect.top,
+    ok(item_rect.top - (window_rect.top + caption_height) <= 1, "Expect item_rect.top %ld - %ld <= 1\n", item_rect.top,
        window_rect.top + caption_height);
-    ok(item_rect.bottom - (client_top_left.y - 1) <= 1, "Expect item_rect.bottom %d - %d <= 1\n", item_rect.bottom,
+    ok(item_rect.bottom - (client_top_left.y - 1) <= 1, "Expect item_rect.bottom %ld - %ld <= 1\n", item_rect.bottom,
        client_top_left.y - 1);
 
     /* Get the item rectangle of the not yet displayed popup menu item. */
     ret = GetMenuItemRect(hwnd, popup_hmenu, 0, &item_rect);
-    ok(ret, "GetMenuItemRect failed with error %d\n", GetLastError());
-    ok(item_rect.left == client_top_left.x, "Expect item_rect.left %d == %d\n", item_rect.left, client_top_left.x);
-    ok(item_rect.right == client_top_left.x, "Expect item_rect.right %d == %d\n", item_rect.right, client_top_left.x);
-    ok(item_rect.top == client_top_left.y, "Expect item_rect.top %d == %d\n", item_rect.top, client_top_left.y);
-    ok(item_rect.bottom == client_top_left.y, "Expect item_rect.bottom %d == %d\n", item_rect.bottom,
+    ok(ret, "GetMenuItemRect failed with error %ld\n", GetLastError());
+    ok(item_rect.left == client_top_left.x, "Expect item_rect.left %ld == %ld\n", item_rect.left, client_top_left.x);
+    ok(item_rect.right == client_top_left.x, "Expect item_rect.right %ld == %ld\n", item_rect.right, client_top_left.x);
+    ok(item_rect.top == client_top_left.y, "Expect item_rect.top %ld == %ld\n", item_rect.top, client_top_left.y);
+    ok(item_rect.bottom == client_top_left.y, "Expect item_rect.bottom %ld == %ld\n", item_rect.bottom,
        client_top_left.y);
 
     DestroyWindow(hwnd);
@@ -410,7 +411,7 @@ static void test_system_menu(void)
     hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
                            WS_SYSMENU | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
                            NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     menu = GetSystemMenu( hwnd, FALSE );
     ok( menu != NULL, "no system menu\n" );
 
@@ -533,7 +534,7 @@ static void test_system_menu(void)
     /* now a normal (non-system) menu */
 
     menu = CreateMenu();
-    ok( menu != NULL, "CreateMenu failed with error %d\n", GetLastError() );
+    ok( menu != NULL, "CreateMenu failed with error %ld\n", GetLastError() );
 
     res = CheckMenuItem( menu, SC_TASKLIST, 0 );
     ok( res == -1, "CheckMenuItem succeeded\n" );
@@ -544,9 +545,9 @@ static void test_system_menu(void)
     ret = RemoveMenu( menu, SC_TASKLIST, 0 );
     ok( !ret, "RemoveMenu succeeded\n" );
     ret = ModifyMenuA( menu, SC_TASKLIST, 0, SC_TASKLIST, "test" );
-    ok( ret, "ModifyMenuA failed err %d\n", GetLastError() );
+    ok( ret, "ModifyMenuA failed err %ld\n", GetLastError() );
     ret = ModifyMenuW( menu, SC_TASKLIST, 0, SC_TASKLIST, testW );
-    ok( ret, "ModifyMenuW failed err %d\n", GetLastError() );
+    ok( ret, "ModifyMenuW failed err %ld\n", GetLastError() );
     ret = ModifyMenuA( menu, SC_TASKLIST-1, 0, SC_TASKLIST, "test" );
     ok( !ret, "ModifyMenu succeeded on SC_TASKLIST-1\n" );
     strcpy( buffer, "test" );
@@ -589,18 +590,18 @@ static void test_menu_locked_by_window(void)
     HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
                                WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
                                NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     hmenu = CreateMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     ret = InsertMenuA(hmenu, 0, MF_STRING, 0, "&Test");
-    ok(ret, "InsertMenu failed with error %d\n", GetLastError());
+    ok(ret, "InsertMenu failed with error %ld\n", GetLastError());
     ret = SetMenu(hwnd, hmenu);
-    ok(ret, "SetMenu failed with error %d\n", GetLastError());
+    ok(ret, "SetMenu failed with error %ld\n", GetLastError());
     ret = DestroyMenu(hmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
 
     ret = DrawMenuBar(hwnd);
-    ok(ret, "DrawMenuBar failed with error %d\n", GetLastError());
+    ok(ret, "DrawMenuBar failed with error %ld\n", GetLastError());
     ret = IsMenu(GetMenu(hwnd));
     ok(!ret || broken(ret) /* nt4 */, "Menu handle should have been destroyed\n");
 
@@ -645,38 +646,38 @@ static void test_subpopup_locked_by_menu(void)
     hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
             WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
             NULL, NULL, NULL, NULL);
-    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) subpopuplocked_wnd_proc);
     hmenu = CreatePopupMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     hsubmenu = CreatePopupMenu();
-    ok(hsubmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hsubmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     ret = InsertMenuA(hmenu, 0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)hsubmenu,
             "PopUpLockTest");
-    ok(ret, "InsertMenu failed with error %d\n", GetLastError());
+    ok(ret, "InsertMenu failed with error %ld\n", GetLastError());
     ret = InsertMenuA(hsubmenu, 0, MF_BYPOSITION | MF_STRING, itemid, "PopUpMenu");
-    ok(ret, "InsertMenu failed with error %d\n", GetLastError());
+    ok(ret, "InsertMenu failed with error %ld\n", GetLastError());
     /* first some tests that all this functions properly */
     mii.fMask = MIIM_SUBMENU;
     ret = GetMenuItemInfoA( hmenu, 0, TRUE, &mii);
-    ok( ret, "GetMenuItemInfo failed error %d\n", GetLastError());
+    ok( ret, "GetMenuItemInfo failed error %ld\n", GetLastError());
     ok( mii.hSubMenu == hsubmenu, "submenu is %p\n", mii.hSubMenu);
     mi.fMask |= MIM_STYLE;
     ret = GetMenuInfo( hsubmenu, &mi);
-    ok( ret , "GetMenuInfo returned 0 with error %d\n", GetLastError());
+    ok( ret , "GetMenuInfo returned 0 with error %ld\n", GetLastError());
     ret = IsMenu( hsubmenu);
     ok( ret , "Menu handle is not valid\n");
 
     ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
-    ok( ret == itemid , "TrackPopupMenu returned %d error is %d\n", ret, GetLastError());
+    ok( ret == itemid , "TrackPopupMenu returned %d error is %ld\n", ret, GetLastError());
 
     /* then destroy the sub-popup */
     ret = DestroyMenu( hsubmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
     /* and repeat the tests */
     mii.fMask = MIIM_SUBMENU;
     ret = GetMenuItemInfoA( hmenu, 0, TRUE, &mii);
-    ok( ret, "GetMenuItemInfo failed error %d\n", GetLastError());
+    ok( ret, "GetMenuItemInfo failed error %ld\n", GetLastError());
     /* GetMenuInfo fails now */
     ok( mii.hSubMenu == hsubmenu, "submenu is %p\n", mii.hSubMenu);
     mi.fMask |= MIM_STYLE;
@@ -689,7 +690,7 @@ static void test_subpopup_locked_by_menu(void)
     /* but TrackPopupMenu still works! */
     ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
     todo_wine {
-        ok( ret == itemid , "TrackPopupMenu returned %d error is %d\n", ret, GetLastError());
+        ok( ret == itemid , "TrackPopupMenu returned %d error is %ld\n", ret, GetLastError());
     }
 
     /* clean up */
@@ -707,11 +708,11 @@ static void test_menu_ownerdraw(void)
     HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
                                WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
                                NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     if( !hwnd) return;
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
     hmenu = CreatePopupMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     if( !hmenu) { DestroyWindow(hwnd);return;}
     k=0;
     for( j=0;j<2;j++) /* create columns */
@@ -731,11 +732,11 @@ static void test_menu_ownerdraw(void)
             "item rectangles are not separated by 4 pixels space\n");
     /* height should be what the MEASUREITEM message has returned */
     ok( MOD_rc[0].bottom - MOD_rc[0].top == MOD_SIZE,
-            "menu item has wrong height: %d should be %d\n",
+            "menu item has wrong height: %ld should be %d\n",
             MOD_rc[0].bottom - MOD_rc[0].top, MOD_SIZE);
     /* no gaps between the rows */
     ok( MOD_rc[0].bottom - MOD_rc[1].top == 0,
-            "There should not be a space between the rows, gap is %d\n",
+            "There should not be a space between the rows, gap is %ld\n",
             MOD_rc[0].bottom - MOD_rc[1].top);
     /* test the correct value of the item height that was sent
      * by the WM_MEASUREITEM message */
@@ -751,15 +752,15 @@ static void test_menu_ownerdraw(void)
     TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
     /* left should be 4 pixels less now */
     ok( leftcol == MOD_rc[0].left + 4, 
-            "columns should be 4 pixels to the left (actual %d).\n",
+            "columns should be 4 pixels to the left (actual %ld).\n",
             leftcol - MOD_rc[0].left);
     /* test width */
     ok( MOD_rc[0].right - MOD_rc[0].left == 2 * MOD_avec + MOD_SIZE,
-            "width of owner drawn menu item is wrong. Got %d expected %d\n",
+            "width of owner drawn menu item is wrong. Got %ld expected %d\n",
             MOD_rc[0].right - MOD_rc[0].left , 2*MOD_avec + MOD_SIZE);
     /* and height */
     ok( MOD_rc[0].bottom - MOD_rc[0].top == MOD_SIZE,
-            "Height is incorrect. Got %d expected %d\n",
+            "Height is incorrect. Got %ld expected %d\n",
             MOD_rc[0].bottom - MOD_rc[0].top, MOD_SIZE);
 
     /* test owner-drawn callback bitmap */
@@ -776,9 +777,9 @@ static void test_menu_ownerdraw(void)
 
     /* test width/height of an ownerdraw menu bar as well */
     ret = DestroyMenu(hmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
     hmenu = CreateMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     if( !hmenu) { DestroyWindow(hwnd);return;}
     MOD_maxid=1;
     for(i=0;i<2;i++) { 
@@ -787,19 +788,19 @@ static void test_menu_ownerdraw(void)
     }
     ret = SetMenu( hwnd, hmenu);
     UpdateWindow( hwnd); /* hack for wine to draw the window + menu */
-    ok(ret, "SetMenu failed with error %d\n", GetLastError());
+    ok(ret, "SetMenu failed with error %ld\n", GetLastError());
     /* test width */
     ok( MOD_rc[0].right - MOD_rc[0].left == 2 * MOD_avec + MOD_SIZE,
-            "width of owner drawn menu item is wrong. Got %d expected %d\n",
+            "width of owner drawn menu item is wrong. Got %ld expected %d\n",
             MOD_rc[0].right - MOD_rc[0].left , 2*MOD_avec + MOD_SIZE);
     /* test height */
     ok( MOD_rc[0].bottom - MOD_rc[0].top == GetSystemMetrics( SM_CYMENU) - 1,
-            "Height of owner drawn menu item is wrong. Got %d expected %d\n",
+            "Height of owner drawn menu item is wrong. Got %ld expected %d\n",
             MOD_rc[0].bottom - MOD_rc[0].top, GetSystemMetrics( SM_CYMENU) - 1);
 
     /* clean up */
     ret = DestroyMenu(hmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
     DestroyWindow(hwnd);
 }
 
@@ -841,12 +842,12 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
         mii.hbmpItem = hbmp;
     }
     submenu = CreateMenu();
-    ok( submenu != 0, "CreateMenu failed with error %d\n", GetLastError());
+    ok( submenu != 0, "CreateMenu failed with error %ld\n", GetLastError());
     if( ispop)
         hmenu = CreatePopupMenu();
     else
         hmenu = CreateMenu();
-    ok( hmenu != 0, "Create{Popup}Menu failed with error %d\n", GetLastError());
+    ok( hmenu != 0, "Create{Popup}Menu failed with error %ld\n", GetLastError());
     if( hassub) {
         mii.fMask |= MIIM_SUBMENU;
         mii.hSubMenu = submenu;
@@ -857,10 +858,10 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
         GetMenuInfo( hmenu, &mi);
         if( mnuopt) mi.dwStyle |= mnuopt == 1 ? MNS_NOCHECK : MNS_CHECKORBMP;
         ret = SetMenuInfo( hmenu, &mi);
-        ok( ret, "SetMenuInfo failed with error %d\n", GetLastError());
+        ok( ret, "SetMenuInfo failed with error %ld\n", GetLastError());
     }
     ret = InsertMenuItemA( hmenu, 0, FALSE, &mii);
-    ok( ret, "InsertMenuItem failed with error %d\n", GetLastError());
+    ok( ret, "InsertMenuItem failed with error %ld\n", GetLastError());
     failed = !ret;
     if( winetest_debug) {
         HDC hdc=GetDC(hwnd);
@@ -876,11 +877,11 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
         TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL);
     else {
         ret = SetMenu( hwnd, hmenu);
-        ok(ret, "SetMenu failed with error %d\n", GetLastError());
+        ok(ret, "SetMenu failed with error %ld\n", GetLastError());
         DrawMenuBar( hwnd);
     }
     ret = GetMenuItemRect( hwnd, hmenu, 0, &rc);
-    ok(ret, "GetMenuItemRect failed with error %d\n", GetLastError());
+    ok(ret, "GetMenuItemRect failed with error %ld\n", GetLastError());
 
     if (0)  /* comment out menu size checks, behavior is different in almost every Windows version */
             /* the tests should however succeed on win2000, XP and Wine (at least up to 1.1.15) */
@@ -902,7 +903,7 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
                 ( hbmp ? (text ? 2:0) + bmpsize.cx  : 0 ) +
                 (text ? 2 * MOD_avec + (text[0] ? size.cx :0): 0) ;
         ok( rc.right - rc.left == expect,
-            "menu width wrong, got %d expected %d\n", rc.right - rc.left, expect);
+            "menu width wrong, got %ld expected %d\n", rc.right - rc.left, expect);
         failed = failed || !(rc.right - rc.left == expect);
         /* check menu height */
         if( ispop)
@@ -917,7 +918,7 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
             expect = ( !(text || hbmp) ? GetSystemMetrics( SM_CYMENUSIZE)/2 :
                        max( GetSystemMetrics( SM_CYMENU) - 1, (hbmp ? bmpsize.cy : 0)));
         ok( rc.bottom - rc.top == expect,
-            "menu height wrong, got %d expected %d (%d)\n",
+            "menu height wrong, got %ld expected %d (%d)\n",
             rc.bottom - rc.top, expect, GetSystemMetrics( SM_CYMENU));
         failed = failed || !(rc.bottom - rc.top == expect);
         if( hbmp == HBMMENU_CALLBACK && MOD_GotDrawItemMsg) {
@@ -932,18 +933,18 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
             else /* mnuopt == 2 */
                 expect = 2;
             ok( expect == MOD_rc[0].left,
-                "bitmap left is %d expected %d\n", MOD_rc[0].left, expect);
+                "bitmap left is %ld expected %d\n", MOD_rc[0].left, expect);
             failed = failed || !(expect == MOD_rc[0].left);
             /* vertical */
             expect = (rc.bottom - rc.top - MOD_rc[0].bottom + MOD_rc[0].top) / 2;
             ok( expect == MOD_rc[0].top,
-                "bitmap top is %d expected %d\n", MOD_rc[0].top, expect);
+                "bitmap top is %ld expected %d\n", MOD_rc[0].top, expect);
             failed = failed || !(expect == MOD_rc[0].top);
         }
     }
     /* if there was a failure, report details */
     if( failed) {
-        trace("*** count %d %s text \"%s\" bitmap %p bmsize %d,%d textsize %d+%d,%d mnuopt %d hastab %d\n",
+        trace("*** count %d %s text \"%s\" bitmap %p bmsize %ld,%ld textsize %ld+%ld,%ld mnuopt %d hastab %d\n",
                 count, (ispop? "POPUP": "MENUBAR"),text ? text: "(nil)", hbmp, bmpsize.cx, bmpsize.cy,
                 size.cx, size.cy, sc_size.cx, mnuopt, hastab);
         trace("    check %d,%d arrow %d avechar %d\n",
@@ -954,9 +955,9 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
     }
     /* clean up */
     ret = DestroyMenu(submenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
     ret = DestroyMenu(hmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
 }
 
 
@@ -980,21 +981,21 @@ static void test_menu_bmp_and_string(void)
     hbm_arrow = LoadBitmapA( 0, (LPCSTR)OBM_MNARROW);
     GetObjectA( hbm_arrow, sizeof(bm), &bm);
     arrowwidth = bm.bmWidth;
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     if( !hwnd) return;
     /* test system menu */
     hsysmenu = GetSystemMenu( hwnd, FALSE);
-    ok( hsysmenu != NULL, "GetSystemMenu failed with error %d\n", GetLastError());
+    ok( hsysmenu != NULL, "GetSystemMenu failed with error %ld\n", GetLastError());
     mi.fMask = MIM_STYLE;
     mi.dwStyle = 0;
     got = GetMenuInfo( hsysmenu, &mi);
-    ok( got, "GetMenuInfo failed gle=%d\n", GetLastError());
-    ok( MNS_CHECKORBMP == mi.dwStyle, "System Menu Style is %08x, without the bit %08x\n",
+    ok( got, "GetMenuInfo failed gle=%ld\n", GetLastError());
+    ok( MNS_CHECKORBMP == mi.dwStyle, "System Menu Style is %08lx, without the bit %08x\n",
         mi.dwStyle, MNS_CHECKORBMP);
     mii.fMask = MIIM_BITMAP;
     mii.hbmpItem = NULL;
     got = GetMenuItemInfoA( hsysmenu, SC_CLOSE, FALSE, &mii);
-    ok( got, "GetMenuItemInfoA failed gle=%d\n", GetLastError());
+    ok( got, "GetMenuItemInfoA failed gle=%ld\n", GetLastError());
     ok( HBMMENU_POPUP_CLOSE == mii.hbmpItem, "Item info did not get the right hbitmap: got %p  expected %p\n",
         mii.hbmpItem, HBMMENU_POPUP_CLOSE);
 
@@ -1010,7 +1011,7 @@ static void test_menu_bmp_and_string(void)
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == SC_RESTORE, "expected SC_RESTORE, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0, "expected 0, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == (LPSTR)bmfill, "expected %p, got %p\n", bmfill, mii.dwTypeData);
     ok(mii.cch != 0, "cch should not be 0\n");
     ok(mii.hbmpItem == HBMMENU_POPUP_RESTORE, "expected HBMMENU_POPUP_RESTORE, got %p\n", mii.hbmpItem);
@@ -1024,7 +1025,7 @@ static void test_menu_bmp_and_string(void)
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == SC_RESTORE, "expected SC_RESTORE, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0, "expected 0, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == (LPSTR)bmfill, "expected %p, got %p\n", bmfill, mii.dwTypeData);
     ok(mii.cch != 0, "cch should not be 0\n");
     ok(mii.hbmpItem == HBMMENU_POPUP_CLOSE, "expected HBMMENU_POPUP_CLOSE, got %p\n", mii.hbmpItem);
@@ -1043,7 +1044,7 @@ static void test_menu_bmp_and_string(void)
         for( szidx=0; szidx < ARRAY_SIZE(bmsizes); szidx++) {
             HBITMAP hbm = CreateBitmap( bmsizes[szidx].cx, bmsizes[szidx].cy,1,1,bmfill);
             HBITMAP bitmaps[] = { HBMMENU_CALLBACK, hbm, HBMMENU_POPUP_CLOSE, NULL  };
-            ok( hbm != 0, "CreateBitmap failed err %d\n", GetLastError());
+            ok( hbm != 0, "CreateBitmap failed err %ld\n", GetLastError());
             for( txtidx = 0; txtidx < ARRAY_SIZE(MOD_txtsizes); txtidx++) {
                 for( hassub = 0; hassub < 2 ; hassub++) { /* add submenu item */
                     for( mnuopt = 0; mnuopt < 3 ; mnuopt++){ /* test MNS_NOCHECK/MNS_CHECKORBMP */
@@ -1227,7 +1228,7 @@ static void insert_menu_item( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT
     if (ansi) ret = InsertMenuItemA( hmenu, 0, TRUE, &info );
     else ret = InsertMenuItemW( hmenu, 0, TRUE, (MENUITEMINFOW*)&info );
     if (!expect) ok_(__FILE__, line)( !ret, "InsertMenuItem should have failed.\n" );
-    else ok_(__FILE__, line)( ret, "InsertMenuItem failed, err %u\n", GetLastError());
+    else ok_(__FILE__, line)( ret, "InsertMenuItem failed, err %lu\n", GetLastError());
 }
 
 static void check_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT type, UINT state,
@@ -1253,7 +1254,7 @@ static void check_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, U
         ok_(__FILE__, line)( !ret, "GetMenuItemInfo should have failed.\n" );
         return;
     }
-    ok_(__FILE__, line)( ret, "GetMenuItemInfo failed, err %u\n", GetLastError());
+    ok_(__FILE__, line)( ret, "GetMenuItemInfo failed, err %lu\n", GetLastError());
     if (mask & MIIM_TYPE)
         ok_(__FILE__, line)( info.fType == type || info.fType == LOWORD(type),
                              "wrong type %x/%x\n", info.fType, type );
@@ -1275,7 +1276,7 @@ static void check_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, U
     }
     if (mask & MIIM_DATA)
         ok_(__FILE__, line)( info.dwItemData == data || info.dwItemData == LOWORD(data),
-                             "wrong item data %lx/%lx\n", info.dwItemData, data );
+                             "wrong item data %Ix/%Ix\n", info.dwItemData, data );
     if (mask & MIIM_BITMAP)
         ok_(__FILE__, line)( info.hbmpItem == item || (ULONG_PTR)info.hbmpItem == LOWORD(item),
                              "wrong bmpitem %p/%p\n", info.hbmpItem, item );
@@ -1297,7 +1298,7 @@ static void check_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, U
         ret = ansi ? GetMenuStringA( hmenu, 0, (char *)buffer, 80, MF_BYPOSITION ) :
             GetMenuStringW( hmenu, 0, buffer, 80, MF_BYPOSITION );
         if (expstring)
-            ok_(__FILE__, line)( ret, "GetMenuString failed, err %u\n", GetLastError());
+            ok_(__FILE__, line)( ret, "GetMenuString failed, err %lu\n", GetLastError());
         else
             ok_(__FILE__, line)( !ret, "GetMenuString should have failed\n" );
     }
@@ -1310,7 +1311,7 @@ static void modify_menu( int line, HMENU hmenu, BOOL ansi, UINT flags, UINT_PTR
     SetLastError( 0xdeadbeef );
     if (ansi) ret = ModifyMenuA( hmenu, 0, flags, id, data );
     else ret = ModifyMenuW( hmenu, 0, flags, id, data );
-    ok_(__FILE__,line)( ret, "ModifyMenuA failed, err %u\n", GetLastError());
+    ok_(__FILE__,line)( ret, "ModifyMenuA failed, err %lu\n", GetLastError());
 }
 
 static void set_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, UINT type, UINT state,
@@ -1340,7 +1341,7 @@ static void set_menu_item_info( int line, HMENU hmenu, BOOL ansi, UINT mask, UIN
     SetLastError( 0xdeadbeef );
     if (ansi) ret = SetMenuItemInfoA( hmenu, 0, TRUE, &info );
     else ret = SetMenuItemInfoW( hmenu, 0, TRUE, (MENUITEMINFOW*)&info );
-    ok_(__FILE__, line)( ret, "SetMenuItemInfo failed, err %u\n", GetLastError());
+    ok_(__FILE__, line)( ret, "SetMenuItemInfo failed, err %lu\n", GetLastError());
 }
 
 #define TMII_INSMI( c1,d1,e1,f1,g1,h1,i1,j1,k1,l1,m1,eret1 )\
@@ -2551,14 +2552,14 @@ static void test_menu_hilitemenuitem( void )
     }
     ok(GetLastError() == 0xdeadbeef || /* 9x */
        GetLastError() == ERROR_INVALID_WINDOW_HANDLE /* NT */,
-      "HiliteMenuItem: expected error ERROR_INVALID_WINDOW_HANDLE, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error ERROR_INVALID_WINDOW_HANDLE, got: %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ok(!HiliteMenuItem(hWnd, NULL, 1, MF_HILITE | MF_BYPOSITION),
       "HiliteMenuItem: call should have failed.\n");
     ok(GetLastError() == 0xdeadbeef || /* 9x */
        GetLastError() == ERROR_INVALID_MENU_HANDLE /* NT */,
-      "HiliteMenuItem: expected error ERROR_INVALID_MENU_HANDLE, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error ERROR_INVALID_MENU_HANDLE, got: %ld\n", GetLastError());
 
     ok(!(GetMenuState(hPopupMenu, 1, MF_BYPOSITION) & MF_HILITE),
       "HiliteMenuItem: Item 2 is hilited\n");
@@ -2569,7 +2570,7 @@ static void test_menu_hilitemenuitem( void )
     ok(HiliteMenuItem(hWnd, hPopupMenu, 1, MF_BYPOSITION),
       "HiliteMenuItem: call should have succeeded.\n");
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     ok(!(GetMenuState(hPopupMenu, 1, MF_BYPOSITION) & MF_HILITE),
       "HiliteMenuItem: Item 2 is hilited\n");
@@ -2581,7 +2582,7 @@ static void test_menu_hilitemenuitem( void )
       "HiliteMenuItem: call should have succeeded.\n");
     }
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     ok(!(GetMenuState(hPopupMenu, 1, MF_BYPOSITION) & MF_HILITE),
       "HiliteMenuItem: Item 2 is hilited\n");
@@ -2592,7 +2593,7 @@ static void test_menu_hilitemenuitem( void )
     ok(HiliteMenuItem(hWnd, hPopupMenu, 1, MF_HILITE | MF_BYPOSITION),
       "HiliteMenuItem: call should not have failed.\n");
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     todo_wine
     {
@@ -2606,7 +2607,7 @@ static void test_menu_hilitemenuitem( void )
     ok(HiliteMenuItem(hWnd, hPopupMenu, 1, MF_UNHILITE | MF_BYPOSITION),
       "HiliteMenuItem: call should not have failed.\n");
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     ok(!(GetMenuState(hPopupMenu, 1, MF_BYPOSITION) & MF_HILITE),
       "HiliteMenuItem: Item 2 is hilited\n");
@@ -2617,7 +2618,7 @@ static void test_menu_hilitemenuitem( void )
     ok(HiliteMenuItem(hWnd, hPopupMenu, 103, MF_HILITE | MF_BYCOMMAND),
       "HiliteMenuItem: call should not have failed.\n");
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     todo_wine
     {
@@ -2631,7 +2632,7 @@ static void test_menu_hilitemenuitem( void )
     ok(HiliteMenuItem(hWnd, hPopupMenu, 103, MF_UNHILITE | MF_BYCOMMAND),
       "HiliteMenuItem: call should not have failed.\n");
     ok(GetLastError() == 0xdeadbeef,
-      "HiliteMenuItem: expected error 0xdeadbeef, got: %d\n", GetLastError());
+      "HiliteMenuItem: expected error 0xdeadbeef, got: %ld\n", GetLastError());
 
     ok(!(GetMenuState(hPopupMenu, 2, MF_BYPOSITION) & MF_HILITE),
       "HiliteMenuItem: Item 3 is hilited\n");
@@ -2797,7 +2798,7 @@ static void test_menu_resource_layout(void)
     BOOL ret;
 
     hmenu = LoadMenuIndirectA(&menu_template);
-    ok(hmenu != 0, "LoadMenuIndirect error %u\n", GetLastError());
+    ok(hmenu != 0, "LoadMenuIndirect error %lu\n", GetLastError());
 
     ret = AppendMenuA(hmenu, MF_STRING, 6, NULL);
     ok(ret, "AppendMenu failed\n");
@@ -2860,7 +2861,7 @@ static HMENU create_menu_from_data(const struct menu_data *item, INT item_count)
     {
         SetLastError(0xdeadbeef);
         ret = AppendMenuA(hmenu, item[i].type, item[i].id, item[i].str);
-        ok(ret, "%d: AppendMenu(%04x, %04x, %p) error %u\n",
+        ok(ret, "%d: AppendMenu(%04x, %04x, %p) error %lu\n",
            i, item[i].type, item[i].id, item[i].str, GetLastError());
     }
     return hmenu;
@@ -2902,7 +2903,7 @@ static HMENU create_menuitem_from_data(const struct menu_data *item, INT item_co
         if(  item[i].type & MF_HELP) mii.fType |= MF_HELP;
         mii.wID = item[i].id;
         ret = InsertMenuItemA( hmenu, -1, TRUE, &mii);
-        ok(ret, "%d: InsertMenuItem(%04x, %04x, %p) error %u\n",
+        ok(ret, "%d: InsertMenuItem(%04x, %04x, %p) error %lu\n",
            i, item[i].type, item[i].id, item[i].str, GetLastError());
     }
     return hmenu;
@@ -3086,7 +3087,7 @@ static void test_menu_getmenuinfo(void)
     ok( !ret, "GetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "GetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "GetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     SetLastError(0xdeadbeef);
     mi.cbSize = 0;
     ret = GetMenuInfo( hmenu, &mi);
@@ -3094,13 +3095,13 @@ static void test_menu_getmenuinfo(void)
     ok( !ret, "GetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "GetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "GetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
     ret = GetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     SetLastError(0xdeadbeef);
     mi.cbSize = 0;
     ret = GetMenuInfo( NULL, &mi);
@@ -3108,7 +3109,7 @@ static void test_menu_getmenuinfo(void)
     ok( !ret, "GetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "GetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "GetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     /* clean up */
     DestroyMenu( hmenu);
     return;
@@ -3130,7 +3131,7 @@ static void test_menu_setmenuinfo(void)
     mii.fMask = MIIM_SUBMENU;
     mii.hSubMenu = hsubmenu;
     ret = InsertMenuItemA( hmenu, 0, FALSE, &mii);
-    ok( ret, "InsertMenuItem failed with error %d\n", GetLastError());
+    ok( ret, "InsertMenuItem failed with error %ld\n", GetLastError());
     /* test some parameter errors */
     SetLastError(0xdeadbeef);
     ret = SetMenuInfo( hmenu, NULL);
@@ -3138,7 +3139,7 @@ static void test_menu_setmenuinfo(void)
     ok( !ret, "SetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "SetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "SetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     SetLastError(0xdeadbeef);
     mi.cbSize = 0;
     ret = SetMenuInfo( hmenu, &mi);
@@ -3146,13 +3147,13 @@ static void test_menu_setmenuinfo(void)
     ok( !ret, "SetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "SetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "SetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
     ret = SetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "SetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %lu\n", gle);
     SetLastError(0xdeadbeef);
     mi.cbSize = 0;
     ret = SetMenuInfo( NULL, &mi);
@@ -3160,7 +3161,7 @@ static void test_menu_setmenuinfo(void)
     ok( !ret, "SetMenuInfo() should have failed\n");
     ok( gle == ERROR_INVALID_PARAMETER ||
         broken(gle == 0xdeadbeef), /* Win98, WinME */
-        "SetMenuInfo() error got %u expected %u\n", gle, ERROR_INVALID_PARAMETER);
+        "SetMenuInfo() error got %lu expected %u\n", gle, ERROR_INVALID_PARAMETER);
     /* functional tests */
     /* menu and submenu should have the CHECKORBMP style bit cleared */
     SetLastError(0xdeadbeef);
@@ -3169,7 +3170,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( !(mi.dwStyle & MNS_CHECKORBMP), "menustyle was not expected to have the MNS_CHECKORBMP flag\n");
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
@@ -3177,7 +3178,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hsubmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( !(mi.dwStyle & MNS_CHECKORBMP), "menustyle was not expected to have the MNS_CHECKORBMP flag\n");
     /* SetMenuInfo() */
     SetLastError(0xdeadbeef);
@@ -3187,7 +3188,7 @@ static void test_menu_setmenuinfo(void)
     ret = SetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "SetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %lu\n", gle);
     /* Now both menus should have the MNS_CHECKORBMP style bit set */
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
@@ -3195,7 +3196,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( mi.dwStyle & MNS_CHECKORBMP, "menustyle was expected to have the MNS_CHECKORBMP flag\n");
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
@@ -3203,7 +3204,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hsubmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( mi.dwStyle & MNS_CHECKORBMP, "menustyle was expected to have the MNS_CHECKORBMP flag\n");
     /* now repeat that without the APPLYTOSUBMENUS flag and another style bit */
     SetLastError(0xdeadbeef);
@@ -3213,7 +3214,7 @@ static void test_menu_setmenuinfo(void)
     ret = SetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "SetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "SetMenuInfo() error got %lu\n", gle);
     /* Now only the top menu should have the MNS_NOCHECK style bit set */
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
@@ -3221,7 +3222,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( mi.dwStyle & MNS_NOCHECK, "menustyle was expected to have the MNS_NOCHECK flag\n");
     SetLastError(0xdeadbeef);
     mi.cbSize = sizeof( MENUINFO);
@@ -3229,7 +3230,7 @@ static void test_menu_setmenuinfo(void)
     ret = GetMenuInfo( hsubmenu, &mi);
     gle= GetLastError();
     ok( ret, "GetMenuInfo() should have succeeded\n");
-    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %u\n", gle);
+    ok( gle == 0xdeadbeef, "GetMenuInfo() error got %lu\n", gle);
     ok( !(mi.dwStyle & MNS_NOCHECK), "menustyle was not expected to have the MNS_NOCHECK flag\n");
 
     /* test background brush */
@@ -3284,13 +3285,13 @@ static void test_menu_trackpopupmenu(void)
     HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
             WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
             NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     if (!hwnd) return;
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc);
     for( Ex = 0; Ex < 2; Ex++)
     {
         hmenu = CreatePopupMenu();
-        ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+        ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
         if (!hmenu)
         {
             DestroyWindow(hwnd);
@@ -3307,7 +3308,7 @@ static void test_menu_trackpopupmenu(void)
         ok( gle == ERROR_INVALID_MENU_HANDLE
             || broken (gle == 0xdeadbeef) /* win95 */
             || broken (gle == NO_ERROR) /* win98/ME */
-            ,"TrackPopupMenu%s error got %u expected %u\n",
+            ,"TrackPopupMenu%s error got %lu expected %u\n",
             Ex ? "Ex" : "", gle, ERROR_INVALID_MENU_HANDLE);
         ok( !(gflag_initmenupopup || gflag_entermenuloop || gflag_initmenu),
                 "got unexpected message(s)%s%s%s\n",
@@ -3323,7 +3324,7 @@ static void test_menu_trackpopupmenu(void)
         ok( gle == ERROR_INVALID_MENU_HANDLE
             || broken (gle == 0xdeadbeef) /* win95 */
             || broken (gle == NO_ERROR) /* win98/ME */
-            ,"TrackPopupMenu%s error got %u expected %u\n",
+            ,"TrackPopupMenu%s error got %lu expected %u\n",
             Ex ? "Ex" : "", gle, ERROR_INVALID_MENU_HANDLE);
         ok( !(gflag_initmenupopup || gflag_entermenuloop || gflag_initmenu),
                 "got unexpected message(s)%s%s%s\n",
@@ -3337,7 +3338,7 @@ static void test_menu_trackpopupmenu(void)
         ret = MyTrackPopupMenu( Ex, hmenu, TPM_RETURNCMD, 100,100, 0, NULL);
         gle = GetLastError();
         ok( !ret, "TrackPopupMenu%s should have failed\n", Ex ? "Ex" : "");
-        ok( gle == ERROR_INVALID_WINDOW_HANDLE, "TrackPopupMenu%s error got %u\n", Ex ? "Ex" : "", gle );
+        ok( gle == ERROR_INVALID_WINDOW_HANDLE, "TrackPopupMenu%s error got %lu\n", Ex ? "Ex" : "", gle );
         ok( !(gflag_initmenupopup || gflag_entermenuloop || gflag_initmenu),
                 "got unexpected message(s)%s%s%s\n",
                 gflag_initmenupopup ? " WM_INITMENUPOPUP ": " ",
@@ -3353,7 +3354,7 @@ static void test_menu_trackpopupmenu(void)
         ok( gle == NO_ERROR
             || gle == ERROR_INVALID_MENU_HANDLE /* NT4, win2k */
             || broken (gle == 0xdeadbeef) /* win95 */
-            ,"TrackPopupMenu%s error got %u expected %u or %u\n",
+            ,"TrackPopupMenu%s error got %lu expected %u or %u\n",
             Ex ? "Ex" : "", gle, NO_ERROR, ERROR_INVALID_MENU_HANDLE);
         ok( gflag_initmenupopup && gflag_entermenuloop && gflag_initmenu,
                 "missed expected message(s)%s%s%s\n",
@@ -3371,7 +3372,7 @@ static void test_menu_trackpopupmenu(void)
         ok( gle == NO_ERROR
             || gle == ERROR_INVALID_MENU_HANDLE /* NT4, win2k and Vista in the TrackPopupMenuEx case */
             || broken (gle == 0xdeadbeef) /* win95 */
-            ,"TrackPopupMenu%s error got %u expected %u or %u\n",
+            ,"TrackPopupMenu%s error got %lu expected %u or %u\n",
             Ex ? "Ex" : "", gle, NO_ERROR, ERROR_INVALID_MENU_HANDLE);
         ok( gflag_initmenupopup && gflag_entermenuloop && gflag_initmenu,
                 "missed expected message(s)%s%s%s\n",
@@ -3399,7 +3400,7 @@ static LRESULT WINAPI menu_track_again_wnd_proc(HWND hwnd, UINT msg, WPARAM wpar
         ret = TrackPopupMenu(g_hmenu, 0, 100, 100, 0, hwnd, NULL);
         ok(ret == FALSE, "got %d\n", ret);
         ok(GetLastError() == ERROR_POPUP_ALREADY_ACTIVE ||
-           broken(GetLastError() == 0xdeadbeef) /* W9x */, "got %d\n", GetLastError());
+           broken(GetLastError() == 0xdeadbeef) /* W9x */, "got %ld\n", GetLastError());
 
         /* exit menu modal loop
          * ( A SendMessage does not work on NT3.51 here ) */
@@ -3417,12 +3418,12 @@ static void test_menu_trackagain(void)
     hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
             WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
             NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError());
+    ok(hwnd != NULL, "CreateWindowEx failed with error %ld\n", GetLastError());
     if (!hwnd) return;
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_track_again_wnd_proc);
 
     g_hmenu = CreatePopupMenu();
-    ok(g_hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(g_hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
 
     ret = AppendMenuA(g_hmenu, MF_STRING , 100, "item 1");
     ok(ret, "AppendMenu failed.\n");
@@ -3475,14 +3476,14 @@ static void test_menu_cancelmode(void)
             WS_VISIBLE | WS_CHILD, 10, 10, 20, 20,
             hwnd, NULL, NULL, NULL);
     ok( hwnd != NULL && hwndchild != NULL,
-            "CreateWindowEx failed with error %d\n", GetLastError());
+            "CreateWindowEx failed with error %ld\n", GetLastError());
     g_hwndtosend = hwnd;
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
     SetWindowLongPtrA( hwndchild, GWLP_WNDPROC, (LONG_PTR)menu_cancelmode_wnd_proc);
     menu = CreatePopupMenu();
-    ok( menu != NULL, "CreatePopupMenu failed with error %d\n", GetLastError());
+    ok( menu != NULL, "CreatePopupMenu failed with error %ld\n", GetLastError());
     ret = AppendMenuA( menu, MF_STRING, 1, "winetest");
-    ok( ret, "Functie failed lasterror is %u\n", GetLastError());
+    ok( ret, "Functie failed lasterror is %lu\n", GetLastError());
     /* seems to be needed only on wine :( */
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
         DispatchMessageA(&msg);
@@ -3509,15 +3510,15 @@ static void test_menu_cancelmode(void)
 
     /* test canceling tracking in a window's menu bar */
     menubar = CreateMenu();
-    ok( menubar != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok( menubar != NULL, "CreateMenu failed with error %ld\n", GetLastError());
     ret = AppendMenuA( menubar, MF_POPUP|MF_STRING, (UINT_PTR)menu, "winetest");
-    ok( ret, "AppendMenuA failed lasterror is %u\n", GetLastError());
+    ok( ret, "AppendMenuA failed lasterror is %lu\n", GetLastError());
     ret = SetMenu( hwnd, menubar );
-    ok( ret, "SetMenu failed lasterror is %u\n", GetLastError());
+    ok( ret, "SetMenu failed lasterror is %lu\n", GetLastError());
     /* initiate tracking */
     g_hwndtosend = hwnd;
     ret = SendMessageA( hwnd, WM_SYSCOMMAND, SC_KEYMENU, 0 );
-    ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %u\n", GetLastError());
+    ok( ret == 0, "Sending WM_SYSCOMMAND/SC_KEYMENU failed lasterror is %lu\n", GetLastError());
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
         DispatchMessageA(&msg);
     ok(g_got_enteridle == 0, "received %d WM_ENTERIDLE messages, none expected\n", g_got_enteridle);
@@ -3548,7 +3549,7 @@ static void test_menu_maxdepth(void)
         if( !ret) break;
     }
     trace("Maximum depth is %d\n", i);
-    ok( GetLastError() == 12345678, "unexpected error %d\n",  GetLastError());
+    ok( GetLastError() == 12345678, "unexpected error %ld\n",  GetLastError());
     ok( i < NR_MENUS ||
            broken( i == NR_MENUS), /* win98, NT */
            "no ( or very large) limit on menu depth!\n");
@@ -3567,12 +3568,12 @@ static void test_menu_circref(void)
     menu2 = CreatePopupMenu();
     ok( menu1 && menu2, "error creating menus.\n");
     ret = AppendMenuA( menu1, MF_POPUP, (UINT_PTR)menu2, "winetest");
-    ok( ret, "AppendMenu failed, error is %d\n", GetLastError());
+    ok( ret, "AppendMenu failed, error is %ld\n", GetLastError());
     ret = AppendMenuA( menu1, MF_STRING | MF_HILITE, 123, "winetest");
-    ok( ret, "AppendMenu failed, error is %d\n", GetLastError());
+    ok( ret, "AppendMenu failed, error is %ld\n", GetLastError());
     /* app chooses an id that happens to clash with its own hmenu */
     ret = AppendMenuA( menu2, MF_STRING, (UINT_PTR)menu2, "winetest");
-    ok( ret, "AppendMenu failed, error is %d\n", GetLastError());
+    ok( ret, "AppendMenu failed, error is %ld\n", GetLastError());
     /* now attempt to change the string of the first item of menu1 */
     ret = ModifyMenuA( menu1, (UINT_PTR)menu2, MF_POPUP, (UINT_PTR)menu2, "menu 2");
     ok( !ret ||
@@ -3580,7 +3581,7 @@ static void test_menu_circref(void)
             "ModifyMenu should have failed.\n");
     if( !ret) { /* will probably stack fault if the ModifyMenu succeeded */
         ret = GetMenuState( menu1, 123, 0);
-        ok( ret == MF_HILITE, "GetMenuState returned %x\n",ret);
+        ok( ret == MF_HILITE, "GetMenuState returned %lx\n",ret);
     }
     DestroyMenu( menu2);
     DestroyMenu( menu1);
@@ -3621,9 +3622,9 @@ static void test_menualign(void)
 
     mi.fMask = MIM_STYLE;
     ret = GetMenuInfo( menu, &mi);
-    ok( ret, "GetMenuInfo failed: %d\n", GetLastError());
+    ok( ret, "GetMenuInfo failed: %ld\n", GetLastError());
     ok( menu != NULL, "GetMenuInfo() failed\n");
-    ok( 0 == mi.dwStyle, "menuinfo style is %x\n", mi.dwStyle);
+    ok( 0 == mi.dwStyle, "menuinfo style is %lx\n", mi.dwStyle);
 
     /* test 1 */
     mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_ID;
@@ -3639,7 +3640,7 @@ static void test_menualign(void)
     ret = InsertMenuItemA( menu, -1, TRUE, &mii);
     ok( ret, "InsertMenuItem() failed\n");
     ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
-    ok( ret != 2, "User indicated that menu text alignment test 1 failed %d\n", ret);
+    ok( ret != 2, "User indicated that menu text alignment test 1 failed %ld\n", ret);
     /* test 2*/
     mii.fMask = MIIM_BITMAP | MIIM_STRING | MIIM_ID;
     mii.wID = 3;
@@ -3661,7 +3662,7 @@ static void test_menualign(void)
     ret = SetMenuItemInfoA( menu, 2, TRUE, &mii);
     ok( ret, "SetMenuItemInfo() failed\n");
     ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
-    ok( ret != 2, "User indicated that menu text alignment test 2 failed %d\n", ret);
+    ok( ret != 2, "User indicated that menu text alignment test 2 failed %ld\n", ret);
     /* test 3 */
     mii.fMask = MIIM_TYPE | MIIM_ID;
     mii.wID = 3;
@@ -3681,7 +3682,7 @@ static void test_menualign(void)
     ret = SetMenuItemInfoA( menu, 2, TRUE, &mii);
     ok( ret, "SetMenuItemInfo() failed\n");
     ret = TrackPopupMenu( menu, TPM_RETURNCMD, 110, 200, 0, hwnd, NULL);
-    ok( ret != 2, "User indicated that menu text alignment test 3 failed %d\n", ret);
+    ok( ret != 2, "User indicated that menu text alignment test 3 failed %ld\n", ret);
     /* cleanup */
     DeleteObject( hbm1);
     DeleteObject( hbm2);
@@ -3731,11 +3732,11 @@ static void test_emptypopup(void)
     HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL,
                                WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200,
                                NULL, NULL, NULL, NULL);
-    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)menu_ownerdraw_wnd_proc);
 
     hmenu = CreatePopupMenu();
-    ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError());
+    ok(hmenu != NULL, "CreateMenu failed with error %ld\n", GetLastError());
 
     gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
     selectitem_wp = 0xdeadbeef;
@@ -3749,8 +3750,8 @@ static void test_emptypopup(void)
     ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
     ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
 
-    ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
-    ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
+    ok(selectitem_wp == 0xdeadbeef, "got %Ix\n", selectitem_wp);
+    ok(selectitem_lp == 0xdeadbeef, "got %Ix\n", selectitem_lp);
 
     gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0;
     selectitem_wp = 0xdeadbeef;
@@ -3764,8 +3765,8 @@ static void test_emptypopup(void)
     ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
     ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu);
 
-    ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp);
-    ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp);
+    ok(selectitem_wp == 0xdeadbeef, "got %Ix\n", selectitem_wp);
+    ok(selectitem_lp == 0xdeadbeef, "got %Ix\n", selectitem_lp);
 
     SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_fill_in_init);
 
@@ -3781,13 +3782,13 @@ static void test_emptypopup(void)
     ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu);
     ok(gflag_enteridle == 1, "got %i\n", gflag_initmenu);
 
-    ok(selectitem_wp == 0xffff0000, "got %lx\n", selectitem_wp);
-    ok(selectitem_lp == 0, "got %lx\n", selectitem_lp);
+    ok(selectitem_wp == 0xffff0000, "got %Ix\n", selectitem_wp);
+    ok(selectitem_lp == 0, "got %Ix\n", selectitem_lp);
 
     DestroyWindow(hwnd);
 
     ret = DestroyMenu(hmenu);
-    ok(ret, "DestroyMenu failed with error %d\n", GetLastError());
+    ok(ret, "DestroyMenu failed with error %ld\n", GetLastError());
 }
 
 static HMENU get_bad_hmenu( UINT_PTR id )
@@ -3946,7 +3947,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -3962,7 +3963,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == (LPSTR)hbmp, "expected %p, got %p\n", hbmp, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(mii.hbmpItem == hbmp, "expected %p, got %p\n", hbmp, mii.hbmpItem);
@@ -3980,7 +3981,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0, "expected 0, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == (LPSTR)hbmp, "expected %p, got %p\n", hbmp, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(mii.hbmpItem == hbmp, "expected %p, got %p\n", hbmp, mii.hbmpItem);
@@ -4013,7 +4014,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4031,7 +4032,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4050,7 +4051,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0, "expected 0, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0, "expected 0, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4085,7 +4086,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == (ULONG_PTR)hbmp, "expected %p, got %#lx\n", hbmp, mii.dwItemData);
+    ok(mii.dwItemData == (ULONG_PTR)hbmp, "expected %p, got %#Ix\n", hbmp, mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4104,7 +4105,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4137,7 +4138,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4161,7 +4162,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4180,7 +4181,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4204,7 +4205,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == MF_ENABLED, "expected MF_ENABLED, got %#x\n", mii.fState);
     ok(mii.wID == 0, "expected 0, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == buf, "expected %p, got %p\n", buf, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(!strcmp(buf, string), "expected %s, got %s\n", string, buf);
@@ -4223,7 +4224,7 @@ if (0) /* FIXME: uncomment once Wine is fixed */ {
     ok(mii.fState == 0x81818181, "expected 0x81818181, got %#x\n", mii.fState);
     ok(mii.wID == 0x81818181, "expected 0x81818181, got %#x\n", mii.wID);
     ok(mii.hSubMenu == 0, "expected 0, got %p\n", mii.hSubMenu);
-    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#lx\n", mii.dwItemData);
+    ok(mii.dwItemData == 0x81818181, "expected 0x81818181, got %#Ix\n", mii.dwItemData);
     ok(mii.dwTypeData == (LPSTR)hbmp, "expected %p, got %p\n", hbmp, mii.dwTypeData);
     ok(mii.cch == 6, "expected 6, got %u\n", mii.cch);
     ok(mii.hbmpItem == hbmp, "expected %p, got %p\n", hbmp, mii.hbmpItem);
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c
index 5e14c536a76..4578742a707 100644
--- a/dlls/user32/tests/monitor.c
+++ b/dlls/user32/tests/monitor.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for monitor APIs
  *
@@ -139,7 +140,7 @@ static void test_enumdisplaydevices_adapter(int index, const DISPLAY_DEVICEA *de
     {
         /* Test creating DC */
         hdc = CreateDCA(device->DeviceName, NULL, NULL, NULL);
-        ok(hdc != NULL, "#%d: failed to CreateDC(\"%s\") err=%d\n", index, device->DeviceName, GetLastError());
+        ok(hdc != NULL, "#%d: failed to CreateDC(\"%s\") err=%ld\n", index, device->DeviceName, GetLastError());
         DeleteDC(hdc);
     }
 
@@ -181,7 +182,7 @@ static void test_enumdisplaydevices_monitor(int monitor_index, const char *adapt
 
     /* StateFlags */
     ok(device->StateFlags <= (DISPLAY_DEVICE_ATTACHED | DISPLAY_DEVICE_ACTIVE),
-       "#%d wrong state %#x\n", monitor_index, device->StateFlags);
+       "#%d wrong state %#lx\n", monitor_index, device->StateFlags);
 
     /* DeviceID */
     CharLowerA(device->DeviceID);
@@ -294,27 +295,27 @@ static void _expect_dm(INT line, const DEVMODEA *expected, const CHAR *device, D
     dm.dmSize = sizeof(dm);
     SetLastError(0xdeadbeef);
     ret = EnumDisplaySettingsA(device, ENUM_CURRENT_SETTINGS, &dm);
-    ok_(__FILE__, line)(ret, "Device %s test %d EnumDisplaySettingsA failed, error %#x\n", device, test, GetLastError());
+    ok_(__FILE__, line)(ret, "Device %s test %ld EnumDisplaySettingsA failed, error %#lx\n", device, test, GetLastError());
 
     ok_(__FILE__, line)((dm.dmFields & expected->dmFields) == expected->dmFields,
-            "Device %s test %d expect dmFields to contain %#x, got %#x\n", device, test, expected->dmFields, dm.dmFields);
+            "Device %s test %ld expect dmFields to contain %#lx, got %#lx\n", device, test, expected->dmFields, dm.dmFields);
     ok_(__FILE__, line)(!(expected->dmFields & DM_BITSPERPEL) || dm.dmBitsPerPel == expected->dmBitsPerPel,
-            "Device %s test %d expect dmBitsPerPel %u, got %u\n", device, test, expected->dmBitsPerPel, dm.dmBitsPerPel);
+            "Device %s test %ld expect dmBitsPerPel %lu, got %lu\n", device, test, expected->dmBitsPerPel, dm.dmBitsPerPel);
     ok_(__FILE__, line)(!(expected->dmFields & DM_PELSWIDTH) || dm.dmPelsWidth == expected->dmPelsWidth,
-            "Device %s test %d expect dmPelsWidth %u, got %u\n", device, test, expected->dmPelsWidth, dm.dmPelsWidth);
+            "Device %s test %ld expect dmPelsWidth %lu, got %lu\n", device, test, expected->dmPelsWidth, dm.dmPelsWidth);
     ok_(__FILE__, line)(!(expected->dmFields & DM_PELSHEIGHT) || dm.dmPelsHeight == expected->dmPelsHeight,
-            "Device %s test %d expect dmPelsHeight %u, got %u\n", device, test, expected->dmPelsHeight, dm.dmPelsHeight);
+            "Device %s test %ld expect dmPelsHeight %lu, got %lu\n", device, test, expected->dmPelsHeight, dm.dmPelsHeight);
     ok_(__FILE__, line)(!(expected->dmFields & DM_POSITION) || dm.dmPosition.x == expected->dmPosition.x,
-            "Device %s test %d expect dmPosition.x %d, got %d\n", device, test, expected->dmPosition.x, dm.dmPosition.x);
+            "Device %s test %ld expect dmPosition.x %ld, got %ld\n", device, test, expected->dmPosition.x, dm.dmPosition.x);
     ok_(__FILE__, line)(!(expected->dmFields & DM_POSITION) || dm.dmPosition.y == expected->dmPosition.y,
-            "Device %s test %d expect dmPosition.y %d, got %d\n", device, test, expected->dmPosition.y, dm.dmPosition.y);
+            "Device %s test %ld expect dmPosition.y %ld, got %ld\n", device, test, expected->dmPosition.y, dm.dmPosition.y);
     ok_(__FILE__, line)(!(expected->dmFields & DM_DISPLAYFREQUENCY) ||
             dm.dmDisplayFrequency == expected->dmDisplayFrequency,
-            "Device %s test %d expect dmDisplayFrequency %u, got %u\n", device, test, expected->dmDisplayFrequency,
+            "Device %s test %ld expect dmDisplayFrequency %lu, got %lu\n", device, test, expected->dmDisplayFrequency,
             dm.dmDisplayFrequency);
     ok_(__FILE__, line)(!(expected->dmFields & DM_DISPLAYORIENTATION) ||
             dm.dmDisplayOrientation == expected->dmDisplayOrientation,
-            "Device %s test %d expect dmDisplayOrientation %d, got %d\n", device, test, expected->dmDisplayOrientation,
+            "Device %s test %ld expect dmDisplayOrientation %ld, got %ld\n", device, test, expected->dmDisplayOrientation,
             dm.dmDisplayOrientation);
 }
 
@@ -340,48 +341,48 @@ static void test_ChangeDisplaySettingsEx(void)
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     res = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(res, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(res, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
 
     res = ChangeDisplaySettingsExA("invalid", &dm, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %ld\n", res);
 
     res = ChangeDisplaySettingsExA("\\\\.\\DISPLAY0", &dm, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %ld\n", res);
 
     res = ChangeDisplaySettingsExA("\\\\.\\DISPLAY1\\Monitor0", &dm, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_BADPARAM, "ChangeDisplaySettingsA returned unexpected %ld\n", res);
 
     /* Test dmDriverExtra */
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     res = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(res, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(res, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
 
     memset(&dmW, 0, sizeof(dmW));
     dmW.dmSize = sizeof(dmW);
     res = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW);
-    ok(res, "EnumDisplaySettingsW failed, error %#x\n", GetLastError());
+    ok(res, "EnumDisplaySettingsW failed, error %#lx\n", GetLastError());
 
     /* ChangeDisplaySettingsA/W reset dmDriverExtra to 0 */
     dm.dmDriverExtra = 1;
     res = ChangeDisplaySettingsA(&dm, CDS_TEST);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsA returned unexpected %ld\n", res);
     ok(dm.dmDriverExtra == 0, "ChangeDisplaySettingsA didn't reset dmDriverExtra to 0\n");
 
     dmW.dmDriverExtra = 1;
     res = ChangeDisplaySettingsW(&dmW, CDS_TEST);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsW returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsW returned unexpected %ld\n", res);
     ok(dmW.dmDriverExtra == 0, "ChangeDisplaySettingsW didn't reset dmDriverExtra to 0\n");
 
     /* ChangeDisplaySettingsExA/W do not modify dmDriverExtra */
     dm.dmDriverExtra = 1;
     res = ChangeDisplaySettingsExA(NULL, &dm, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld\n", res);
     ok(dm.dmDriverExtra == 1, "ChangeDisplaySettingsExA shouldn't change dmDriverExtra\n");
 
     dmW.dmDriverExtra = 1;
     res = ChangeDisplaySettingsExW(NULL, &dmW, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExW returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExW returned unexpected %ld\n", res);
     ok(dmW.dmDriverExtra == 1, "ChangeDisplaySettingsExW shouldn't change dmDriverExtra\n");
 
     /* Test dmSize */
@@ -389,37 +390,37 @@ static void test_ChangeDisplaySettingsEx(void)
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     res = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(res, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(res, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
 
     dm.dmSize = 0;
     res = ChangeDisplaySettingsA(&dm, CDS_TEST);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsA returned unexpected %ld\n", res);
 
     dm.dmSize = 0;
     res = ChangeDisplaySettingsExA(NULL, &dm, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld\n", res);
 
     /* dmSize for ChangeDisplaySettingsW/ExW needs to be at least FIELD_OFFSET(DEVMODEW, dmICMMethod) */
     memset(&dmW, 0, sizeof(dmW));
     dmW.dmSize = sizeof(dmW);
     res = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW);
-    ok(res, "EnumDisplaySettingsW failed, error %#x\n", GetLastError());
+    ok(res, "EnumDisplaySettingsW failed, error %#lx\n", GetLastError());
 
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod) - 1;
     res = ChangeDisplaySettingsW(&dmW, CDS_TEST);
-    ok(res == DISP_CHANGE_BADMODE, "ChangeDisplaySettingsW returned %d, expect DISP_CHANGE_BADMODE\n", res);
+    ok(res == DISP_CHANGE_BADMODE, "ChangeDisplaySettingsW returned %ld, expect DISP_CHANGE_BADMODE\n", res);
 
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod) - 1;
     res = ChangeDisplaySettingsExW(NULL, &dmW, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_BADMODE, "ChangeDisplaySettingsExW returned %d, expect DISP_CHANGE_BADMODE\n", res);
+    ok(res == DISP_CHANGE_BADMODE, "ChangeDisplaySettingsExW returned %ld, expect DISP_CHANGE_BADMODE\n", res);
 
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod);
     res = ChangeDisplaySettingsW(&dmW, CDS_TEST);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsW returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsW returned unexpected %ld\n", res);
 
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmICMMethod);
     res = ChangeDisplaySettingsExW(NULL, &dmW, NULL, CDS_TEST, NULL);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExW returned unexpected %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExW returned unexpected %ld\n", res);
 
     /* Test clip rectangle after resolution changes */
     /* GetClipCursor always returns result in physical pixels but GetSystemMetrics(SM_CX/CYVIRTUALSCREEN) are not.
@@ -441,7 +442,7 @@ static void test_ChangeDisplaySettingsEx(void)
            (res == DISP_CHANGE_SUCCESSFUL || res == DISP_CHANGE_RESTART) :
            (res == DISP_CHANGE_SUCCESSFUL || res == DISP_CHANGE_RESTART ||
             res == DISP_CHANGE_BADMODE || res == DISP_CHANGE_BADPARAM),
-           "Unexpected ChangeDisplaySettingsExA() return code for vid_modes_test[%d]: %d\n", i, res);
+           "Unexpected ChangeDisplaySettingsExA() return code for vid_modes_test[%d]: %ld\n", i, res);
 
         if (res == DISP_CHANGE_SUCCESSFUL)
         {
@@ -485,7 +486,7 @@ static void test_ChangeDisplaySettingsEx(void)
     if (pSetThreadDpiAwarenessContext && context)
         pSetThreadDpiAwarenessContext(context);
     res = ChangeDisplaySettingsExA(NULL, NULL, NULL, CDS_RESET, NULL);
-    ok(res == DISP_CHANGE_SUCCESSFUL, "Failed to reset default resolution: %d\n", res);
+    ok(res == DISP_CHANGE_SUCCESSFUL, "Failed to reset default resolution: %ld\n", res);
 
     /* Save the original mode for all devices so that they can be restored at the end of tests */
     device_count = 0;
@@ -522,7 +523,7 @@ static void test_ChangeDisplaySettingsEx(void)
         memset(&devices[device_count].original_mode, 0, sizeof(devices[device_count].original_mode));
         devices[device_count].original_mode.dmSize = sizeof(devices[device_count].original_mode);
         res = EnumDisplaySettingsA(dd.DeviceName, ENUM_CURRENT_SETTINGS, &devices[device_count].original_mode);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", dd.DeviceName, GetLastError());
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", dd.DeviceName, GetLastError());
         ++device_count;
     }
 
@@ -546,16 +547,16 @@ static void test_ChangeDisplaySettingsEx(void)
         dm.dmFields = DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT;
         dm.dmPosition = devices[0].original_mode.dmPosition;
         res = ChangeDisplaySettingsExA(devices[0].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[0].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
         res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[0].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
 
         /* Check that the adapter is still attached */
         dd.cb = sizeof(dd);
         res = EnumDisplayDevicesA(NULL, devices[0].index, &dd, 0);
-        ok(res, "EnumDisplayDevicesA %s failed, error %#x\n", devices[0].name, GetLastError());
+        ok(res, "EnumDisplayDevicesA %s failed, error %#lx\n", devices[0].name, GetLastError());
         ok(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, "Expect device %s still attached.\n", devices[0].name);
 
         count = GetSystemMetrics(SM_CMONITORS);
@@ -567,11 +568,11 @@ static void test_ChangeDisplaySettingsEx(void)
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_BADPARAM) || /* win10 */
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[0].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
         res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[0].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
     }
 
     /* Test that only specifying DM_POSITION in dmFields is not enough to detach an adapter */
@@ -588,13 +589,13 @@ static void test_ChangeDisplaySettingsEx(void)
         dm.dmFields = DM_POSITION;
         dm.dmPosition = devices[1].original_mode.dmPosition;
         res = ChangeDisplaySettingsExA(devices[1].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[1].name, res);
         res = ChangeDisplaySettingsExA(devices[1].name, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[1].name, res);
 
         dd.cb = sizeof(dd);
         res = EnumDisplayDevicesA(NULL, devices[1].index, &dd, 0);
-        ok(res, "EnumDisplayDevicesA %s failed, error %#x\n", devices[1].name, GetLastError());
+        ok(res, "EnumDisplayDevicesA %s failed, error %#lx\n", devices[1].name, GetLastError());
         ok(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, "Expect device %s still attached.\n", devices[1].name);
 
         count = GetSystemMetrics(SM_CMONITORS);
@@ -618,7 +619,7 @@ static void test_ChangeDisplaySettingsEx(void)
             }
             if (dm.dmBitsPerPel != depths[test])
             {
-                skip("Depth %u is unsupported for %s.\n", depths[test], devices[device].name);
+                skip("Depth %lu is unsupported for %s.\n", depths[test], devices[device].name);
                 continue;
             }
 
@@ -660,7 +661,7 @@ static void test_ChangeDisplaySettingsEx(void)
             res = ChangeDisplaySettingsExA(devices[device].name, &dm3, NULL, CDS_RESET, NULL);
             ok(res == DISP_CHANGE_SUCCESSFUL
                || broken(res == DISP_CHANGE_FAILED), /* Win8 TestBots */
-               "ChangeDisplaySettingsExA %s returned unexpected %d.\n", devices[device].name, res);
+               "ChangeDisplaySettingsExA %s returned unexpected %ld.\n", devices[device].name, res);
             if (res != DISP_CHANGE_SUCCESSFUL)
             {
                 win_skip("Failed to change display mode for %s.\n", devices[device].name);
@@ -673,7 +674,7 @@ static void test_ChangeDisplaySettingsEx(void)
             res = ChangeDisplaySettingsExA(devices[device].name, &dm2, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
             ok(res == DISP_CHANGE_SUCCESSFUL
                || broken(res == DISP_CHANGE_BADFLAGS), /* Win10 32bit */
-               "ChangeDisplaySettingsExA %s returned unexpected %d.\n", devices[device].name, res);
+               "ChangeDisplaySettingsExA %s returned unexpected %ld.\n", devices[device].name, res);
 
             /* Change to a mode with depth set but with zero width and height */
             memset(&dm, 0, sizeof(dm));
@@ -681,29 +682,29 @@ static void test_ChangeDisplaySettingsEx(void)
             dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
             dm.dmBitsPerPel = depths[test];
             res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_RESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                devices[device].name, res);
             flush_events();
 
             dd.cb = sizeof(dd);
             res = EnumDisplayDevicesA(NULL, devices[device].index, &dd, 0);
-            ok(res, "EnumDisplayDevicesA %s failed, error %#x.\n", devices[device].name, GetLastError());
+            ok(res, "EnumDisplayDevicesA %s failed, error %#lx.\n", devices[device].name, GetLastError());
             ok(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, "Expect %s attached.\n",
                devices[device].name);
 
             memset(&dm, 0, sizeof(dm));
             dm.dmSize = sizeof(dm);
             res = EnumDisplaySettingsA(devices[device].name, ENUM_CURRENT_SETTINGS, &dm);
-            ok(res, "Device %s EnumDisplaySettingsA failed, error %#x.\n", devices[device].name, GetLastError());
-            ok(dm.dmBitsPerPel == depths[test], "Device %s expect dmBitsPerPel %u, got %u.\n",
+            ok(res, "Device %s EnumDisplaySettingsA failed, error %#lx.\n", devices[device].name, GetLastError());
+            ok(dm.dmBitsPerPel == depths[test], "Device %s expect dmBitsPerPel %lu, got %lu.\n",
                devices[device].name, depths[test], dm.dmBitsPerPel);
             /* 2008 resets to the resolution in the registry. Newer versions of Windows doesn't
              * change the current resolution */
             ok(dm.dmPelsWidth == dm3.dmPelsWidth || broken(dm.dmPelsWidth == dm2.dmPelsWidth),
-               "Device %s expect dmPelsWidth %u, got %u.\n",
+               "Device %s expect dmPelsWidth %lu, got %lu.\n",
                devices[device].name, dm3.dmPelsWidth, dm.dmPelsWidth);
             ok(dm.dmPelsHeight == dm3.dmPelsHeight || broken(dm.dmPelsHeight == dm2.dmPelsHeight),
-               "Device %s expect dmPelsHeight %u, got %u.\n",
+               "Device %s expect dmPelsHeight %lu, got %lu.\n",
                devices[device].name, dm3.dmPelsHeight, dm.dmPelsHeight);
         }
     }
@@ -718,13 +719,13 @@ static void test_ChangeDisplaySettingsEx(void)
         dm.dmFields = DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT;
         dm.dmPosition = devices[device].original_mode.dmPosition;
         res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
         res = ChangeDisplaySettingsExA(devices[device].name, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
 
         dd.cb = sizeof(dd);
         res = EnumDisplayDevicesA(NULL, devices[device].index, &dd, 0);
-        ok(res, "EnumDisplayDevicesA %s failed, error %#x\n", devices[device].name, GetLastError());
+        ok(res, "EnumDisplayDevicesA %s failed, error %#lx\n", devices[device].name, GetLastError());
         ok(!(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP), "Expect device %s detached.\n", devices[device].name);
 
         count = GetSystemMetrics(SM_CMONITORS);
@@ -782,7 +783,7 @@ static void test_ChangeDisplaySettingsEx(void)
             if (mode == 0 && device)
             {
                 res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-                ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s mode %d returned unexpected %d\n",
+                ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s mode %d returned unexpected %ld\n",
                         devices[device].name, mode, res);
                 res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
             }
@@ -793,7 +794,7 @@ static void test_ChangeDisplaySettingsEx(void)
 
             ok(res == DISP_CHANGE_SUCCESSFUL ||
                     broken(res == DISP_CHANGE_FAILED), /* TestBots using VGA driver can't change to some modes */
-                    "ChangeDisplaySettingsExA %s mode %d returned unexpected %d\n", devices[device].name, mode, res);
+                    "ChangeDisplaySettingsExA %s mode %d returned unexpected %ld\n", devices[device].name, mode, res);
             if (res != DISP_CHANGE_SUCCESSFUL)
             {
                 win_skip("Failed to change %s to mode %d.\n", devices[device].name, mode);
@@ -808,13 +809,13 @@ static void test_ChangeDisplaySettingsEx(void)
         res = ChangeDisplaySettingsExA(devices[device].name, NULL, NULL, 0, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
 
         /* Place the next adapter to the right so that there is no position conflict */
         memset(&dm, 0, sizeof(dm));
         dm.dmSize = sizeof(dm);
         res = EnumDisplaySettingsA(devices[device].name, ENUM_CURRENT_SETTINGS, &dm);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[device].name, GetLastError());
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[device].name, GetLastError());
         position.x = dm.dmPosition.x + dm.dmPelsWidth;
     }
 
@@ -832,14 +833,14 @@ static void test_ChangeDisplaySettingsEx(void)
             memset(&dm, 0, sizeof(dm));
             dm.dmSize = sizeof(dm);
             res = EnumDisplaySettingsA(devices[device - 1].name, ENUM_CURRENT_SETTINGS, &dm);
-            ok(res, "EnumDisplaySettingsA %s failed, error %#x.\n", devices[device - 1].name, GetLastError());
+            ok(res, "EnumDisplaySettingsA %s failed, error %#lx.\n", devices[device - 1].name, GetLastError());
             position.x = dm.dmPosition.x + dm.dmPelsWidth;
         }
 
         memset(&dm, 0, sizeof(dm));
         dm.dmSize = sizeof(dm);
         res = EnumDisplaySettingsA(devices[device].name, ENUM_CURRENT_SETTINGS, &dm);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[device].name, GetLastError());
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[device].name, GetLastError());
         dm3 = dm;
 
         /* Find a mode that's different from the current mode */
@@ -862,11 +863,11 @@ static void test_ChangeDisplaySettingsEx(void)
         res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
         res = ChangeDisplaySettingsExA(devices[device].name, NULL, NULL, 0, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
         if (res != DISP_CHANGE_SUCCESSFUL)
         {
             win_skip("Failed to change mode for %s.\n", devices[device].name);
@@ -884,37 +885,37 @@ static void test_ChangeDisplaySettingsEx(void)
         dm.dmPelsWidth = dm3.dmPelsWidth;
         dm.dmPelsHeight = dm3.dmPelsHeight;
         res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned %d.\n", devices[device].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned %ld.\n", devices[device].name, res);
         res = EnumDisplaySettingsA(devices[device].name, ENUM_REGISTRY_SETTINGS, &dm);
         /* Win10 either returns failure here or retrieves outdated display settings until they're applied */
         if (res)
         {
-            ok((dm.dmFields & registry_fields) == registry_fields, "Got unexpected dmFields %#x.\n", dm.dmFields);
-            ok(dm.dmPosition.x == position.x, "Expected dmPosition.x %d, got %d.\n", position.x, dm.dmPosition.x);
-            ok(dm.dmPosition.y == position.y, "Expected dmPosition.y %d, got %d.\n", position.y, dm.dmPosition.y);
+            ok((dm.dmFields & registry_fields) == registry_fields, "Got unexpected dmFields %#lx.\n", dm.dmFields);
+            ok(dm.dmPosition.x == position.x, "Expected dmPosition.x %ld, got %ld.\n", position.x, dm.dmPosition.x);
+            ok(dm.dmPosition.y == position.y, "Expected dmPosition.y %ld, got %ld.\n", position.y, dm.dmPosition.y);
             ok(dm.dmPelsWidth == dm3.dmPelsWidth || broken(dm.dmPelsWidth == dm2.dmPelsWidth), /* Win10 */
-                    "Expected dmPelsWidth %u, got %u.\n", dm3.dmPelsWidth, dm.dmPelsWidth);
+                    "Expected dmPelsWidth %lu, got %lu.\n", dm3.dmPelsWidth, dm.dmPelsWidth);
             ok(dm.dmPelsHeight == dm3.dmPelsHeight || broken(dm.dmPelsHeight == dm2.dmPelsHeight), /* Win10 */
-                    "Expected dmPelsHeight %u, got %u.\n", dm3.dmPelsHeight, dm.dmPelsHeight);
+                    "Expected dmPelsHeight %lu, got %lu.\n", dm3.dmPelsHeight, dm.dmPelsHeight);
             ok(dm.dmBitsPerPel, "Expected dmBitsPerPel not zero.\n");
             ok(dm.dmDisplayFrequency, "Expected dmDisplayFrequency not zero.\n");
         }
         else
         {
-            win_skip("EnumDisplaySettingsA %s failed, error %#x.\n", devices[device].name, GetLastError());
+            win_skip("EnumDisplaySettingsA %s failed, error %#lx.\n", devices[device].name, GetLastError());
         }
 
         res = ChangeDisplaySettingsExA(devices[device].name, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned %d.\n", devices[device].name, res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned %ld.\n", devices[device].name, res);
         flush_events();
 
         res = EnumDisplaySettingsA(devices[device].name, ENUM_REGISTRY_SETTINGS, &dm);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x.\n", devices[device].name, GetLastError());
-        ok((dm.dmFields & registry_fields) == registry_fields, "Got unexpected dmFields %#x.\n", dm.dmFields);
-        ok(dm.dmPosition.x == position.x, "Expected dmPosition.x %d, got %d.\n", position.x, dm.dmPosition.x);
-        ok(dm.dmPosition.y == position.y, "Expected dmPosition.y %d, got %d.\n", position.y, dm.dmPosition.y);
-        ok(dm.dmPelsWidth == dm3.dmPelsWidth, "Expected dmPelsWidth %u, got %u.\n", dm3.dmPelsWidth, dm.dmPelsWidth);
-        ok(dm.dmPelsHeight == dm3.dmPelsHeight, "Expected dmPelsHeight %u, got %u.\n", dm3.dmPelsHeight,
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx.\n", devices[device].name, GetLastError());
+        ok((dm.dmFields & registry_fields) == registry_fields, "Got unexpected dmFields %#lx.\n", dm.dmFields);
+        ok(dm.dmPosition.x == position.x, "Expected dmPosition.x %ld, got %ld.\n", position.x, dm.dmPosition.x);
+        ok(dm.dmPosition.y == position.y, "Expected dmPosition.y %ld, got %ld.\n", position.y, dm.dmPosition.y);
+        ok(dm.dmPelsWidth == dm3.dmPelsWidth, "Expected dmPelsWidth %lu, got %lu.\n", dm3.dmPelsWidth, dm.dmPelsWidth);
+        ok(dm.dmPelsHeight == dm3.dmPelsHeight, "Expected dmPelsHeight %lu, got %lu.\n", dm3.dmPelsHeight,
                 dm.dmPelsHeight);
         ok(dm.dmBitsPerPel, "Expected dmBitsPerPel not zero.\n");
         ok(dm.dmDisplayFrequency, "Expected dmDisplayFrequency not zero.\n");
@@ -931,16 +932,16 @@ static void test_ChangeDisplaySettingsEx(void)
             memset(&dm, 0, sizeof(dm));
             dm.dmSize = sizeof(dm);
             res = EnumDisplaySettingsA(devices[device].name, ENUM_CURRENT_SETTINGS, &dm);
-            ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[device].name, GetLastError());
+            ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[device].name, GetLastError());
 
             dm.dmPelsWidth = 0;
             dm.dmPelsHeight = 0;
             dm.dmFields = DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT;
             res = ChangeDisplaySettingsExA(devices[device].name, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
         }
         res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d\n", res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld\n", res);
     }
 
     if (device_count >= 2)
@@ -949,7 +950,7 @@ static void test_ChangeDisplaySettingsEx(void)
         memset(&dm, 0, sizeof(dm));
         dm.dmSize = sizeof(dm);
         res = EnumDisplaySettingsA(devices[0].name, ENUM_CURRENT_SETTINGS, &dm);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[0].name, GetLastError());
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[0].name, GetLastError());
 
         if (res)
         {
@@ -957,38 +958,38 @@ static void test_ChangeDisplaySettingsEx(void)
             memset(&dm2, 0, sizeof(dm2));
             dm2.dmSize = sizeof(dm2);
             res = EnumDisplaySettingsA(devices[1].name, ENUM_CURRENT_SETTINGS, &dm2);
-            ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[1].name, GetLastError());
+            ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[1].name, GetLastError());
         }
 
         if (res)
         {
             /* The secondary adapter should be to the right of the primary adapter */
             ok(dm2.dmPosition.x == dm.dmPosition.x + dm.dmPelsWidth,
-               "Expected dm2.dmPosition.x %d, got %d.\n", dm.dmPosition.x + dm.dmPelsWidth,
+               "Expected dm2.dmPosition.x %ld, got %ld.\n", dm.dmPosition.x + dm.dmPelsWidth,
                dm2.dmPosition.x);
-            ok(dm2.dmPosition.y == dm.dmPosition.y, "Expected dm2.dmPosition.y %d, got %d.\n",
+            ok(dm2.dmPosition.y == dm.dmPosition.y, "Expected dm2.dmPosition.y %ld, got %ld.\n",
                dm.dmPosition.y, dm2.dmPosition.y);
 
             /* Test position conflict */
             dm2.dmPosition.x = dm.dmPosition.x - dm2.dmPelsWidth + 1;
             dm2.dmPosition.y = dm.dmPosition.y;
             res = ChangeDisplaySettingsExA(devices[1].name, &dm2, NULL, CDS_RESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[1].name, res);
 
             /* Position is changed and automatically moved */
             memset(&dm2, 0, sizeof(dm2));
             dm2.dmSize = sizeof(dm2);
             res = EnumDisplaySettingsA(devices[1].name, ENUM_CURRENT_SETTINGS, &dm2);
-            ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[1].name, GetLastError());
+            ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[1].name, GetLastError());
             ok(dm2.dmPosition.x == dm.dmPosition.x - dm2.dmPelsWidth,
-               "Expected dmPosition.x %d, got %d.\n", dm.dmPosition.x - dm2.dmPelsWidth,
+               "Expected dmPosition.x %ld, got %ld.\n", dm.dmPosition.x - dm2.dmPelsWidth,
                dm2.dmPosition.x);
 
             /* Test position with extra space. The extra space will be removed */
             dm2.dmPosition.x = dm.dmPosition.x + dm.dmPelsWidth + 1;
             dm2.dmPosition.y = dm.dmPosition.y;
             res = ChangeDisplaySettingsExA(devices[1].name, &dm2, NULL, CDS_RESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[1].name, res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[1].name, res);
 
             dm2.dmPosition.x = dm.dmPosition.x + dm.dmPelsWidth;
             expect_dm(&dm2, devices[1].name, 0);
@@ -1041,11 +1042,11 @@ static void test_ChangeDisplaySettingsEx(void)
                 }
 
                 res = ChangeDisplaySettingsExA(devices[1].name, &dm2, NULL, CDS_RESET, NULL);
-                ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s test %d returned unexpected %d\n",
+                ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s test %d returned unexpected %ld\n",
                         devices[1].name, test, res);
                 if (res != DISP_CHANGE_SUCCESSFUL)
                 {
-                    win_skip("ChangeDisplaySettingsExA %s test %d returned unexpected %d.\n", devices[1].name, test, res);
+                    win_skip("ChangeDisplaySettingsExA %s test %d returned unexpected %ld.\n", devices[1].name, test, res);
                     continue;
                 }
 
@@ -1067,14 +1068,14 @@ static void test_ChangeDisplaySettingsEx(void)
             /* Change the primary adapter to a different mode */
             dm = dm2;
             res = ChangeDisplaySettingsExA(devices[0].name, &dm, NULL, CDS_RESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[0].name, res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[0].name, res);
 
             /* Now the position of the second adapter should be changed */
             memset(&dm2, 0, sizeof(dm2));
             dm2.dmSize = sizeof(dm2);
             res = EnumDisplaySettingsA(devices[1].name, ENUM_CURRENT_SETTINGS, &dm2);
-            ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", devices[1].name, GetLastError());
-            ok(dm2.dmPosition.x == dm.dmPelsWidth, "Expect dmPosition.x %d, got %d\n",
+            ok(res, "EnumDisplaySettingsA %s failed, error %#lx\n", devices[1].name, GetLastError());
+            ok(dm2.dmPosition.x == dm.dmPelsWidth, "Expect dmPosition.x %ld, got %ld\n",
                     dm.dmPelsWidth, dm2.dmPosition.x);
         }
         else
@@ -1089,7 +1090,7 @@ static void test_ChangeDisplaySettingsEx(void)
         memset(&dm, 0, sizeof(dm));
         dm.dmSize = sizeof(dm);
         res = EnumDisplaySettingsA(devices[device].name, ENUM_CURRENT_SETTINGS, &dm);
-        ok(res, "EnumDisplaySettingsA %s failed, error %#x.\n", devices[device].name, GetLastError());
+        ok(res, "EnumDisplaySettingsA %s failed, error %#lx.\n", devices[device].name, GetLastError());
 
         memset(&dm2, 0, sizeof(dm2));
         dm2.dmSize = sizeof(dm2);
@@ -1112,7 +1113,7 @@ static void test_ChangeDisplaySettingsEx(void)
                 win_skip("Failed to change %s to mode %d.\n", devices[device].name, mode);
                 continue;
             }
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s mode %d returned unexpected %d.\n",
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s mode %d returned unexpected %ld.\n",
                     devices[device].name, mode, res);
             flush_events();
             expect_dm(&dm2, devices[device].name, mode);
@@ -1123,24 +1124,24 @@ static void test_ChangeDisplaySettingsEx(void)
             for (i = 0; EnumDisplaySettingsExA(devices[device].name, i, &dm3, 0); ++i)
             {
                 ok(dm3.dmDisplayOrientation == dm2.dmDisplayOrientation,
-                        "Expected %s display mode %d orientation %d, got %d.\n",
+                        "Expected %s display mode %d orientation %ld, got %ld.\n",
                         devices[device].name, i, dm2.dmDisplayOrientation, dm3.dmDisplayOrientation);
             }
             ok(i > 0, "Expected at least one display mode found.\n");
 
             if (device == 0)
             {
-                ok(GetSystemMetrics(SM_CXSCREEN) == dm2.dmPelsWidth, "Expected %d, got %d.\n",
+                ok(GetSystemMetrics(SM_CXSCREEN) == dm2.dmPelsWidth, "Expected %ld, got %d.\n",
                         dm2.dmPelsWidth, GetSystemMetrics(SM_CXSCREEN));
-                ok(GetSystemMetrics(SM_CYSCREEN) == dm2.dmPelsHeight, "Expected %d, got %d.\n",
+                ok(GetSystemMetrics(SM_CYSCREEN) == dm2.dmPelsHeight, "Expected %ld, got %d.\n",
                         dm2.dmPelsHeight, GetSystemMetrics(SM_CYSCREEN));
             }
 
             if (device_count == 1)
             {
-                ok(GetSystemMetrics(SM_CXVIRTUALSCREEN) == dm2.dmPelsWidth, "Expected %d, got %d.\n",
+                ok(GetSystemMetrics(SM_CXVIRTUALSCREEN) == dm2.dmPelsWidth, "Expected %ld, got %d.\n",
                         dm2.dmPelsWidth, GetSystemMetrics(SM_CXVIRTUALSCREEN));
-                ok(GetSystemMetrics(SM_CYVIRTUALSCREEN) == dm2.dmPelsHeight, "Expected %d, got %d.\n",
+                ok(GetSystemMetrics(SM_CYVIRTUALSCREEN) == dm2.dmPelsHeight, "Expected %ld, got %d.\n",
                         dm2.dmPelsHeight, GetSystemMetrics(SM_CYVIRTUALSCREEN));
             }
         }
@@ -1154,12 +1155,12 @@ static void test_ChangeDisplaySettingsEx(void)
                 CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL ||
                 broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-                "ChangeDisplaySettingsExA %s returned unexpected %d\n", devices[device].name, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld\n", devices[device].name, res);
     }
     res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
     ok(res == DISP_CHANGE_SUCCESSFUL ||
             broken(res == DISP_CHANGE_FAILED), /* win8 TestBot */
-            "ChangeDisplaySettingsExA returned unexpected %d\n", res);
+            "ChangeDisplaySettingsExA returned unexpected %ld\n", res);
     for (device = 0; device < device_count; ++device)
         expect_dm(&devices[device].original_mode, devices[device].name, 0);
 
@@ -1350,13 +1351,13 @@ static void test_work_area(void)
     mi.cbSize = sizeof(mi);
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoA(hmon, &mi);
-    ok(ret, "GetMonitorInfo error %u\n", GetLastError());
+    ok(ret, "GetMonitorInfo error %lu\n", GetLastError());
     ok(mi.dwFlags & MONITORINFOF_PRIMARY, "not a primary monitor\n");
     trace("primary monitor %s\n", wine_dbgstr_rect(&mi.rcMonitor));
 
     SetLastError(0xdeadbeef);
     ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0);
-    ok(ret, "SystemParametersInfo error %u\n", GetLastError());
+    ok(ret, "SystemParametersInfo error %lu\n", GetLastError());
     trace("work area %s\n", wine_dbgstr_rect(&rc_work));
     ok(EqualRect(&rc_work, &mi.rcWork), "work area is different\n");
 
@@ -1370,7 +1371,7 @@ static void test_work_area(void)
     wp.length = sizeof(wp);
     ret = GetWindowPlacement(hwnd, &wp);
     ok(ret, "GetWindowPlacement failed\n");
-    trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
+    trace("min: %ld,%ld max %ld,%ld normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
           wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition));
     OffsetRect(&wp.rcNormalPosition, rc_work.left, rc_work.top);
     todo_wine_if (mi.rcMonitor.left != mi.rcWork.left ||
@@ -1384,7 +1385,7 @@ static void test_work_area(void)
     wp.length = sizeof(wp);
     ret = GetWindowPlacement(hwnd, &wp);
     ok(ret, "GetWindowPlacement failed\n");
-    trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
+    trace("min: %ld,%ld max %ld,%ld normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
           wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition));
     ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n");
 
@@ -1397,40 +1398,40 @@ static void test_GetDisplayConfigBufferSizes(void)
     LONG ret;
 
     ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, NULL, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = 100;
     ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, &paths, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     ok(paths == 100, "got %u\n", paths);
 
     modes = 100;
     ret = pGetDisplayConfigBufferSizes(QDC_ALL_PATHS, NULL, &modes);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     ok(modes == 100, "got %u\n", modes);
 
     ret = pGetDisplayConfigBufferSizes(0, NULL, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = 100;
     ret = pGetDisplayConfigBufferSizes(0, &paths, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     ok(paths == 100, "got %u\n", paths);
 
     modes = 100;
     ret = pGetDisplayConfigBufferSizes(0, NULL, &modes);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     ok(modes == 100, "got %u\n", modes);
 
     /* Flag validation on Windows is driver-dependent */
     paths = modes = 100;
     ret = pGetDisplayConfigBufferSizes(0, &paths, &modes);
-    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
     ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths);
 
     paths = modes = 100;
     ret = pGetDisplayConfigBufferSizes(0xFF, &paths, &modes);
-    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
     ok((modes == 0 || modes == 100) && paths == 0, "got %u, %u\n", modes, paths);
 
     /* Test success */
@@ -1439,21 +1440,21 @@ static void test_GetDisplayConfigBufferSizes(void)
     if (!ret)
         ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
     else
-        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+        ok(ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pGetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &paths, &modes);
     if (!ret)
         ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
     else
-        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+        ok(ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pGetDisplayConfigBufferSizes(QDC_DATABASE_CURRENT, &paths, &modes);
     if (!ret)
         ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
     else
-        ok(ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+        ok(ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 }
 
 static BOOL CALLBACK test_EnumDisplayMonitors_normal_cb(HMONITOR monitor, HDC hdc, LPRECT rect,
@@ -1464,7 +1465,7 @@ static BOOL CALLBACK test_EnumDisplayMonitors_normal_cb(HMONITOR monitor, HDC hd
 
     mi.cbSize = sizeof(mi);
     ret = GetMonitorInfoA(monitor, &mi);
-    ok(ret, "GetMonitorInfoA failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoA failed, error %#lx.\n", GetLastError());
     ok(EqualRect(rect, &mi.rcMonitor), "Expected rect %s, got %s.\n",
             wine_dbgstr_rect(&mi.rcMonitor), wine_dbgstr_rect(rect));
 
@@ -1488,7 +1489,7 @@ static BOOL CALLBACK test_EnumDisplayMonitors_invalid_handle_cb(HMONITOR monitor
 
     mi.cbSize = sizeof(mi);
     ret = GetMonitorInfoA(monitor, (MONITORINFO *)&mi);
-    ok(ret, "GetMonitorInfoA failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoA failed, error %#lx.\n", GetLastError());
 
     /* Test that monitor handle is invalid after the monitor is detached */
     if (!(mi.dwFlags & MONITORINFOF_PRIMARY))
@@ -1499,7 +1500,7 @@ static BOOL CALLBACK test_EnumDisplayMonitors_invalid_handle_cb(HMONITOR monitor
         memset(&old_dm, 0, sizeof(old_dm));
         old_dm.dmSize = sizeof(old_dm);
         ret = EnumDisplaySettingsA(mi.szDevice, ENUM_CURRENT_SETTINGS, &old_dm);
-        ok(ret, "EnumDisplaySettingsA %s failed, error %#x.\n", mi.szDevice, GetLastError());
+        ok(ret, "EnumDisplaySettingsA %s failed, error %#lx.\n", mi.szDevice, GetLastError());
 
         /* Detach monitor */
         memset(&dm, 0, sizeof(dm));
@@ -1509,10 +1510,10 @@ static BOOL CALLBACK test_EnumDisplayMonitors_invalid_handle_cb(HMONITOR monitor
         dm.dmPosition.y = mi.rcMonitor.top;
         ret = ChangeDisplaySettingsExA(mi.szDevice, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET,
                 NULL);
-        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 mi.szDevice, ret);
         ret = ChangeDisplaySettingsExA(mi.szDevice, NULL, NULL, 0, NULL);
-        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 mi.szDevice, ret);
 
         /* Check if it's really detached */
@@ -1530,15 +1531,15 @@ static BOOL CALLBACK test_EnumDisplayMonitors_invalid_handle_cb(HMONITOR monitor
         ok(!ret, "GetMonitorInfoA succeeded.\n");
         error = GetLastError();
         ok(error == ERROR_INVALID_MONITOR_HANDLE || error == ERROR_INVALID_HANDLE,
-               "Expected error %#x, got %#x.\n", ERROR_INVALID_MONITOR_HANDLE, error);
+               "Expected error %#x, got %#lx.\n", ERROR_INVALID_MONITOR_HANDLE, error);
 
         /* Restore the original display settings */
         ret = ChangeDisplaySettingsExA(mi.szDevice, &old_dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET,
                 NULL);
-        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 mi.szDevice, ret);
         ret = ChangeDisplaySettingsExA(mi.szDevice, NULL, NULL, 0, NULL);
-        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(ret == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 mi.szDevice, ret);
     }
 
@@ -1565,13 +1566,13 @@ static void test_EnumDisplayMonitors(void)
     BOOL ret;
 
     ret = EnumDisplayMonitors(NULL, NULL, test_EnumDisplayMonitors_normal_cb, 0);
-    ok(ret, "EnumDisplayMonitors failed, error %#x.\n", GetLastError());
+    ok(ret, "EnumDisplayMonitors failed, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = EnumDisplayMonitors(NULL, NULL, test_EnumDisplayMonitors_return_false_cb, 0);
     error = GetLastError();
     ok(!ret, "EnumDisplayMonitors succeeded.\n");
-    ok(error == 0xdeadbeef, "Expected error %#x, got %#x.\n", 0xdeadbeef, error);
+    ok(error == 0xdeadbeef, "Expected error %#x, got %#lx.\n", 0xdeadbeef, error);
 
     count = GetSystemMetrics(SM_CMONITORS);
     SetLastError(0xdeadbeef);
@@ -1581,7 +1582,7 @@ static void test_EnumDisplayMonitors(void)
         todo_wine ok(!ret, "EnumDisplayMonitors succeeded.\n");
     else
         ok(ret, "EnumDisplayMonitors failed.\n");
-    ok(error == 0xdeadbeef, "Expected error %#x, got %#x.\n", 0xdeadbeef, error);
+    ok(error == 0xdeadbeef, "Expected error %#x, got %#lx.\n", 0xdeadbeef, error);
 
     /* Test that monitor enumeration is not affected by window stations and desktops */
     old_winstation = GetProcessWindowStation();
@@ -1590,25 +1591,25 @@ static void test_EnumDisplayMonitors(void)
 
     count = 0;
     ret = EnumDisplayMonitors(NULL, NULL, test_EnumDisplayMonitors_count, (LPARAM)&count);
-    ok(ret, "EnumDisplayMonitors failed, error %#x.\n", GetLastError());
+    ok(ret, "EnumDisplayMonitors failed, error %#lx.\n", GetLastError());
     ok(count == old_count, "Expected %d, got %d.\n", old_count, count);
 
     winstation = CreateWindowStationW(NULL, 0, WINSTA_ALL_ACCESS, NULL);
-    ok(!!winstation && winstation != old_winstation, "CreateWindowStationW failed, error %#x.\n", GetLastError());
+    ok(!!winstation && winstation != old_winstation, "CreateWindowStationW failed, error %#lx.\n", GetLastError());
     ret = SetProcessWindowStation(winstation);
-    ok(ret, "SetProcessWindowStation failed, error %#x.\n", GetLastError());
+    ok(ret, "SetProcessWindowStation failed, error %#lx.\n", GetLastError());
     ok(winstation == GetProcessWindowStation(), "Expected %p, got %p.\n", GetProcessWindowStation(), winstation);
 
     flags.fInherit = FALSE;
     flags.fReserved = FALSE;
     flags.dwFlags = WSF_VISIBLE;
     ret = SetUserObjectInformationW(winstation, UOI_FLAGS, &flags, sizeof(flags));
-    ok(ret, "SetUserObjectInformationW failed, error %#x.\n", GetLastError());
+    ok(ret, "SetUserObjectInformationW failed, error %#lx.\n", GetLastError());
 
     desktop = CreateDesktopW(L"test_desktop", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
-    ok(!!desktop && desktop != old_desktop, "CreateDesktopW failed, error %#x.\n", GetLastError());
+    ok(!!desktop && desktop != old_desktop, "CreateDesktopW failed, error %#lx.\n", GetLastError());
     ret = SetThreadDesktop(desktop);
-    ok(ret, "SetThreadDesktop failed, error %#x.\n", GetLastError());
+    ok(ret, "SetThreadDesktop failed, error %#lx.\n", GetLastError());
     ok(desktop == GetThreadDesktop(GetCurrentThreadId()), "Expected %p, got %p.\n",
             GetThreadDesktop(GetCurrentThreadId()), desktop);
 
@@ -1616,17 +1617,17 @@ static void test_EnumDisplayMonitors(void)
     ok(count == old_count, "Expected %d, got %d.\n", old_count, count);
     count = 0;
     ret = EnumDisplayMonitors(NULL, NULL, test_EnumDisplayMonitors_count, (LPARAM)&count);
-    ok(ret, "EnumDisplayMonitors failed, error %#x.\n", GetLastError());
+    ok(ret, "EnumDisplayMonitors failed, error %#lx.\n", GetLastError());
     ok(count == old_count, "Expected %d, got %d.\n", old_count, count);
 
     ret = SetProcessWindowStation(old_winstation);
-    ok(ret, "SetProcessWindowStation failed, error %#x.\n", GetLastError());
+    ok(ret, "SetProcessWindowStation failed, error %#lx.\n", GetLastError());
     ret = SetThreadDesktop(old_desktop);
-    ok(ret, "SetThreadDesktop failed, error %#x.\n", GetLastError());
+    ok(ret, "SetThreadDesktop failed, error %#lx.\n", GetLastError());
     ret = CloseDesktop(desktop);
-    ok(ret, "CloseDesktop failed, error %#x.\n", GetLastError());
+    ok(ret, "CloseDesktop failed, error %#lx.\n", GetLastError());
     ret = CloseWindowStation(winstation);
-    ok(ret, "CloseWindowStation failed, error %#x.\n", GetLastError());
+    ok(ret, "CloseWindowStation failed, error %#lx.\n", GetLastError());
 }
 
 static void test_QueryDisplayConfig_result(UINT32 flags,
@@ -1647,7 +1648,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
         source_name.header.id = pi[i].sourceInfo.id;
         source_name.viewGdiDeviceName[0] = '\0';
         ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-        ok(!ret, "Expected 0, got %d\n", ret);
+        ok(!ret, "Expected 0, got %ld\n", ret);
         ok(source_name.viewGdiDeviceName[0] != '\0', "Expected GDI device name, got empty string\n");
 
         /* Test with an invalid adapter LUID */
@@ -1657,7 +1658,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
         source_name.header.adapterId.HighPart = 0xFFFF;
         source_name.header.id = pi[i].sourceInfo.id;
         ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-        ok(ret == ERROR_GEN_FAILURE, "Expected GEN_FAILURE, got %d\n", ret);
+        ok(ret == ERROR_GEN_FAILURE, "Expected GEN_FAILURE, got %ld\n", ret);
 
         todo_wine {
         target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
@@ -1666,7 +1667,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
         target_name.header.id = pi[i].targetInfo.id;
         target_name.monitorDevicePath[0] = '\0';
         ret = pDisplayConfigGetDeviceInfo(&target_name.header);
-        ok(!ret, "Expected 0, got %d\n", ret);
+        ok(!ret, "Expected 0, got %ld\n", ret);
         ok(target_name.monitorDevicePath[0] != '\0', "Expected monitor device path, got empty string\n");
         }
 
@@ -1677,7 +1678,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
         preferred_mode.header.id = pi[i].targetInfo.id;
         preferred_mode.width = preferred_mode.height = 0;
         ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
-        ok(!ret, "Expected 0, got %d\n", ret);
+        ok(!ret, "Expected 0, got %ld\n", ret);
         ok(preferred_mode.width > 0 && preferred_mode.height > 0, "Expected non-zero height/width, got %ux%u\n",
                 preferred_mode.width, preferred_mode.height);
         }
@@ -1688,7 +1689,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
         adapter_name.header.adapterId = pi[i].sourceInfo.adapterId;
         adapter_name.adapterDevicePath[0] = '\0';
         ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
-        ok(!ret, "Expected 0, got %d\n", ret);
+        ok(!ret, "Expected 0, got %ld\n", ret);
         ok(adapter_name.adapterDevicePath[0] != '\0', "Expected adapter device path, got empty string\n");
         }
 
@@ -1708,7 +1709,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
                 pi[i].sourceInfo.id, mi[pi[i].sourceInfo.modeInfoIdx].id);
         ok(pi[i].sourceInfo.adapterId.HighPart == mi[pi[i].sourceInfo.modeInfoIdx].adapterId.HighPart &&
            pi[i].sourceInfo.adapterId.LowPart == mi[pi[i].sourceInfo.modeInfoIdx].adapterId.LowPart,
-                "Expected LUID %08x:%08x, got %08x:%08x\n",
+                "Expected LUID %08lx:%08lx, got %08lx:%08lx\n",
                 pi[i].sourceInfo.adapterId.HighPart, pi[i].sourceInfo.adapterId.LowPart,
                 mi[pi[i].sourceInfo.modeInfoIdx].adapterId.HighPart, mi[pi[i].sourceInfo.modeInfoIdx].adapterId.LowPart);
         ok(mi[pi[i].sourceInfo.modeInfoIdx].sourceMode.width > 0 && mi[pi[i].sourceInfo.modeInfoIdx].sourceMode.height > 0,
@@ -1731,7 +1732,7 @@ static void test_QueryDisplayConfig_result(UINT32 flags,
                 pi[i].targetInfo.id, mi[pi[i].targetInfo.modeInfoIdx].id);
         ok(pi[i].targetInfo.adapterId.HighPart == mi[pi[i].targetInfo.modeInfoIdx].adapterId.HighPart &&
            pi[i].targetInfo.adapterId.LowPart == mi[pi[i].targetInfo.modeInfoIdx].adapterId.LowPart,
-                "Expected LUID %08x:%08x, got %08x:%08x\n",
+                "Expected LUID %08lx:%08lx, got %08lx:%08lx\n",
                 pi[i].targetInfo.adapterId.HighPart, pi[i].targetInfo.adapterId.LowPart,
                 mi[pi[i].targetInfo.modeInfoIdx].adapterId.HighPart, mi[pi[i].targetInfo.modeInfoIdx].adapterId.LowPart);
         ok(mi[pi[i].targetInfo.modeInfoIdx].targetMode.targetVideoSignalInfo.activeSize.cx > 0 &&
@@ -1764,28 +1765,28 @@ static void test_QueryDisplayConfig(void)
     LONG ret;
 
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, NULL, NULL, NULL, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, NULL, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, NULL, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, NULL, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 0;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = 0;
     modes = 1;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     ok (paths == 0, "got %u\n", paths);
     ok (modes == 1, "got %u\n", modes);
 
@@ -1793,27 +1794,27 @@ static void test_QueryDisplayConfig(void)
     if (0)
     {
         ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, NULL, mi, NULL);
-        ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+        ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
         ret = pQueryDisplayConfig(QDC_ALL_PATHS, NULL, pi, &modes, mi, NULL);
-        ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+        ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
     }
 
     paths = modes = 1;
     ret = pQueryDisplayConfig(0, &paths, pi, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 1;
     ret = pQueryDisplayConfig(0xFF, &paths, pi, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 1;
     ret = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &paths, pi, &modes, mi, NULL);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     paths = modes = 1;
     ret = pQueryDisplayConfig(QDC_ALL_PATHS, &paths, pi, &modes, mi, &topologyid);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     /* Below this point, test functionality that requires a WDDM driver on Windows */
     paths = modes = 1;
@@ -1826,7 +1827,7 @@ static void test_QueryDisplayConfig(void)
         win_skip("QueryDisplayConfig() functionality is unsupported\n");
         return;
     }
-    ok(ret == ERROR_INSUFFICIENT_BUFFER, "got %d\n", ret);
+    ok(ret == ERROR_INSUFFICIENT_BUFFER, "got %ld\n", ret);
     ok (paths == 1, "got %u\n", paths);
     ok (modes == 1, "got %u\n", modes);
 
@@ -1835,7 +1836,7 @@ static void test_QueryDisplayConfig(void)
     memset(pi, 0xFF, sizeof(pi));
     memset(mi, 0xFF, sizeof(mi));
     ret = pQueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &paths, pi, &modes, mi, NULL);
-    ok(!ret, "got %d\n", ret);
+    ok(!ret, "got %ld\n", ret);
     ok(paths > 0 && modes > 0, "got %u, %u\n", paths, modes);
     if (!ret && paths > 0 && modes > 0)
         test_QueryDisplayConfig_result(QDC_ONLY_ACTIVE_PATHS, paths, pi, modes, mi);
@@ -1846,7 +1847,7 @@ static void test_QueryDisplayConfig(void)
     memset(mi, 0xFF, sizeof(mi));
     topologyid = 0xFF;
     ret = pQueryDisplayConfig(QDC_DATABASE_CURRENT, &paths, pi, &modes, mi, &topologyid);
-    ok(!ret, "got %d\n", ret);
+    ok(!ret, "got %ld\n", ret);
     ok(topologyid != 0xFF, "expected topologyid to be set, got %d\n", topologyid);
     if (!ret && paths > 0 && modes > 0)
         test_QueryDisplayConfig_result(QDC_DATABASE_CURRENT, paths, pi, modes, mi);
@@ -1861,37 +1862,37 @@ static void test_DisplayConfigGetDeviceInfo(void)
     DISPLAYCONFIG_ADAPTER_NAME adapter_name;
 
     ret = pDisplayConfigGetDeviceInfo(NULL);
-    ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE, "got %ld\n", ret);
 
     source_name.header.type = 0xFFFF;
     source_name.header.size = 0;
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE, "got %ld\n", ret);
 
     source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
     source_name.header.size = 0;
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_GEN_FAILURE, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE, "got %ld\n", ret);
 
     source_name.header.type = 0xFFFF;
     source_name.header.size = sizeof(source_name.header);
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
     source_name.header.size = sizeof(source_name.header);
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     source_name.header.type = 0xFFFF;
     source_name.header.size = sizeof(source_name);
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
     source_name.header.size = sizeof(source_name) - 1;
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     source_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
     source_name.header.size = sizeof(source_name);
@@ -1899,12 +1900,12 @@ static void test_DisplayConfigGetDeviceInfo(void)
     source_name.header.adapterId.HighPart = 0xFFFF;
     source_name.header.id = 0;
     ret = pDisplayConfigGetDeviceInfo(&source_name.header);
-    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 
     target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
     target_name.header.size = sizeof(target_name) - 1;
     ret = pDisplayConfigGetDeviceInfo(&target_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     target_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
     target_name.header.size = sizeof(target_name);
@@ -1912,12 +1913,12 @@ static void test_DisplayConfigGetDeviceInfo(void)
     target_name.header.adapterId.HighPart = 0xFFFF;
     target_name.header.id = 0;
     ret = pDisplayConfigGetDeviceInfo(&target_name.header);
-    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 
     preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE;
     preferred_mode.header.size = sizeof(preferred_mode) - 1;
     ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     preferred_mode.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_PREFERRED_MODE;
     preferred_mode.header.size = sizeof(preferred_mode);
@@ -1925,19 +1926,19 @@ static void test_DisplayConfigGetDeviceInfo(void)
     preferred_mode.header.adapterId.HighPart = 0xFFFF;
     preferred_mode.header.id = 0;
     ret = pDisplayConfigGetDeviceInfo(&preferred_mode.header);
-    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 
     adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
     adapter_name.header.size = sizeof(adapter_name) - 1;
     ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
-    ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+    ok(ret == ERROR_INVALID_PARAMETER, "got %ld\n", ret);
 
     adapter_name.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
     adapter_name.header.size = sizeof(adapter_name);
     adapter_name.header.adapterId.LowPart = 0xFFFF;
     adapter_name.header.adapterId.HighPart = 0xFFFF;
     ret = pDisplayConfigGetDeviceInfo(&adapter_name.header);
-    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %d\n", ret);
+    ok(ret == ERROR_GEN_FAILURE || ret == ERROR_INVALID_PARAMETER || ret == ERROR_NOT_SUPPORTED, "got %ld\n", ret);
 }
 
 static void test_display_config(void)
@@ -1986,7 +1987,7 @@ static void test_DisplayConfigSetDeviceInfo(void)
 
     lstrcpyW(open_adapter_gdi_desc.DeviceName, L"\\\\.\\DISPLAY1");
     status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
-    ok(status == STATUS_SUCCESS, "D3DKMTOpenAdapterFromGdiDisplayName failed, status %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "D3DKMTOpenAdapterFromGdiDisplayName failed, status %#lx.\n", status);
 
     get_scale_req.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_DPI_SCALE;
     get_scale_req.header.size = sizeof(get_scale_req);
@@ -1995,7 +1996,7 @@ static void test_DisplayConfigSetDeviceInfo(void)
     ret = pDisplayConfigGetDeviceInfo(&get_scale_req.header);
     if (ret != NO_ERROR)
     {
-        skip("DisplayConfigGetDeviceInfo failed, returned %d.\n", ret);
+        skip("DisplayConfigGetDeviceInfo failed, returned %ld.\n", ret);
         goto failed;
     }
 
@@ -2024,7 +2025,7 @@ static void test_DisplayConfigSetDeviceInfo(void)
     {
         set_scale_req.relativeScaleStep = step;
         ret = pDisplayConfigSetDeviceInfo(&set_scale_req.header);
-        ok(ret == NO_ERROR, "DisplayConfigSetDeviceInfo failed, returned %d.\n", ret);
+        ok(ret == NO_ERROR, "DisplayConfigSetDeviceInfo failed, returned %ld.\n", ret);
 
         dpi = scales[step + recommended_scale_idx] * 96 / 100;
         ok(dpi == get_primary_dpi(), "Expected %d, got %d.\n", get_primary_dpi(), dpi);
@@ -2033,7 +2034,7 @@ static void test_DisplayConfigSetDeviceInfo(void)
     /* Restore to the original scale */
     set_scale_req.relativeScaleStep = get_scale_req.curRelativeScaleStep;
     ret = pDisplayConfigSetDeviceInfo(&set_scale_req.header);
-    ok(ret == NO_ERROR, "DisplayConfigSetDeviceInfo failed, returned %d.\n", ret);
+    ok(ret == NO_ERROR, "DisplayConfigSetDeviceInfo failed, returned %ld.\n", ret);
     ok(old_dpi == get_primary_dpi(), "Expected %d, got %d.\n", get_primary_dpi(), old_dpi);
 
     /* Remove IgnorePerProcessSystemDPIToast registry value */
@@ -2043,7 +2044,7 @@ static void test_DisplayConfigSetDeviceInfo(void)
 failed:
     close_adapter_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     status = pD3DKMTCloseAdapter(&close_adapter_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 }
 
 static BOOL CALLBACK test_handle_proc(HMONITOR full_monitor, HDC hdc, LPRECT rect, LPARAM lparam)
@@ -2059,37 +2060,37 @@ static BOOL CALLBACK test_handle_proc(HMONITOR full_monitor, HDC hdc, LPRECT rec
         monitor = (HMONITOR)((ULONG_PTR)full_monitor | ((ULONG_PTR)~0u << 32));
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
-    ok(ret, "GetMonitorInfoW failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoW failed, error %#lx.\n", GetLastError());
 
     monitor = (HMONITOR)((ULONG_PTR)full_monitor & 0xffffffff);
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
-    ok(ret, "GetMonitorInfoW failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoW failed, error %#lx.\n", GetLastError());
 
     monitor = (HMONITOR)(((ULONG_PTR)full_monitor & 0xffffffff) | ((ULONG_PTR)0x1234 << 32));
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
-    ok(ret, "GetMonitorInfoW failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoW failed, error %#lx.\n", GetLastError());
 
     monitor = (HMONITOR)((ULONG_PTR)full_monitor & 0xffff);
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
     todo_wine ok(!ret, "GetMonitorInfoW succeeded.\n");
-    todo_wine ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#x.\n",
+    todo_wine ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#lx.\n",
             ERROR_INVALID_MONITOR_HANDLE, GetLastError());
 
     monitor = (HMONITOR)(((ULONG_PTR)full_monitor & 0xffff) | ((ULONG_PTR)0x9876 << 16));
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
     ok(!ret, "GetMonitorInfoW succeeded.\n");
-    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#x.\n",
+    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#lx.\n",
             ERROR_INVALID_MONITOR_HANDLE, GetLastError());
 
     monitor = (HMONITOR)(((ULONG_PTR)full_monitor & 0xffff) | ((ULONG_PTR)0x12345678 << 16));
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
     ok(!ret, "GetMonitorInfoW succeeded.\n");
-    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#x.\n",
+    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#lx.\n",
             ERROR_INVALID_MONITOR_HANDLE, GetLastError());
 #else
     if ((ULONG_PTR)full_monitor >> 16)
@@ -2099,18 +2100,18 @@ static BOOL CALLBACK test_handle_proc(HMONITOR full_monitor, HDC hdc, LPRECT rec
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
     todo_wine_if(((ULONG_PTR)full_monitor >> 16) == 0)
-    ok(ret, "GetMonitorInfoW failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoW failed, error %#lx.\n", GetLastError());
 
     monitor = (HMONITOR)((ULONG_PTR)full_monitor & 0xffff);
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
-    ok(ret, "GetMonitorInfoW failed, error %#x.\n", GetLastError());
+    ok(ret, "GetMonitorInfoW failed, error %#lx.\n", GetLastError());
 
     monitor = (HMONITOR)(((ULONG_PTR)full_monitor & 0xffff) | ((ULONG_PTR)0x1234 << 16));
     SetLastError(0xdeadbeef);
     ret = GetMonitorInfoW(monitor, &monitor_info);
     ok(!ret, "GetMonitorInfoW succeeded.\n");
-    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#x.\n",
+    ok(GetLastError() == ERROR_INVALID_MONITOR_HANDLE, "Expected error code %#x, got %#lx.\n",
             ERROR_INVALID_MONITOR_HANDLE, GetLastError());
 #endif
 
@@ -2123,7 +2124,7 @@ static void test_handles(void)
 
     /* Test that monitor handles are user32 handles */
     ret = EnumDisplayMonitors(NULL, NULL, test_handle_proc, 0);
-    ok(ret, "EnumDisplayMonitors failed, error %#x.\n", GetLastError());
+    ok(ret, "EnumDisplayMonitors failed, error %#lx.\n", GetLastError());
 }
 
 #define check_display_dc(a, b, c) _check_display_dc(__LINE__, a, b, c)
@@ -2136,40 +2137,40 @@ static void _check_display_dc(INT line, HDC hdc, const DEVMODEA *dm, BOOL allow_
 
     value = GetDeviceCaps(hdc, HORZRES);
     todo_wine_if(allow_todo && dm->dmPelsWidth != GetSystemMetrics(SM_CXSCREEN))
-    ok_(__FILE__, line)(value == dm->dmPelsWidth, "Expected HORZRES %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmPelsWidth, "Expected HORZRES %ld, got %d.\n",
             dm->dmPelsWidth, value);
 
     value = GetDeviceCaps(hdc, VERTRES);
     todo_wine_if(allow_todo && dm->dmPelsHeight != GetSystemMetrics(SM_CYSCREEN))
-    ok_(__FILE__, line)(value == dm->dmPelsHeight, "Expected VERTRES %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmPelsHeight, "Expected VERTRES %ld, got %d.\n",
             dm->dmPelsHeight, value);
 
     value = GetDeviceCaps(hdc, DESKTOPHORZRES);
     todo_wine_if(dm->dmPelsWidth != GetSystemMetrics(SM_CXVIRTUALSCREEN)
             && value == GetSystemMetrics(SM_CXVIRTUALSCREEN))
-    ok_(__FILE__, line)(value == dm->dmPelsWidth, "Expected DESKTOPHORZRES %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmPelsWidth, "Expected DESKTOPHORZRES %ld, got %d.\n",
             dm->dmPelsWidth, value);
 
     value = GetDeviceCaps(hdc, DESKTOPVERTRES);
     todo_wine_if(dm->dmPelsHeight != GetSystemMetrics(SM_CYVIRTUALSCREEN)
             && value == GetSystemMetrics(SM_CYVIRTUALSCREEN))
-    ok_(__FILE__, line)(value == dm->dmPelsHeight, "Expected DESKTOPVERTRES %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmPelsHeight, "Expected DESKTOPVERTRES %ld, got %d.\n",
             dm->dmPelsHeight, value);
 
     value = GetDeviceCaps(hdc, VREFRESH);
     todo_wine_if(allow_todo)
-    ok_(__FILE__, line)(value == dm->dmDisplayFrequency, "Expected VREFRESH %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmDisplayFrequency, "Expected VREFRESH %ld, got %d.\n",
             dm->dmDisplayFrequency, value);
 
     value = GetDeviceCaps(hdc, BITSPIXEL);
-    ok_(__FILE__, line)(value == dm->dmBitsPerPel, "Expected BITSPIXEL %d, got %d.\n",
+    ok_(__FILE__, line)(value == dm->dmBitsPerPel, "Expected BITSPIXEL %ld, got %d.\n",
             dm->dmBitsPerPel, value);
 
     hbmp = GetCurrentObject(hdc, OBJ_BITMAP);
-    ok_(__FILE__, line)(!!hbmp, "GetCurrentObject failed, error %#x.\n", GetLastError());
+    ok_(__FILE__, line)(!!hbmp, "GetCurrentObject failed, error %#lx.\n", GetLastError());
     ret = GetObjectA(hbmp, sizeof(bitmap), &bitmap);
     /* GetObjectA fails on Win7 and older */
-    ok_(__FILE__, line)(ret || broken(!ret), "GetObjectA failed, error %d.\n", GetLastError());
+    ok_(__FILE__, line)(ret || broken(!ret), "GetObjectA failed, error %ld.\n", GetLastError());
     if (ret)
     {
         ok_(__FILE__, line)(bitmap.bmType == 0, "Expected bmType %d, got %d.\n", 0, bitmap.bmType);
@@ -2217,12 +2218,12 @@ static void test_display_dc(void)
 
     /* Test that CreateCompatibleBitmap() for display DCs creates DDBs */
     hbitmap = CreateCompatibleBitmap(hdc, dm.dmPelsWidth, dm.dmPelsHeight);
-    ok(!!hbitmap, "CreateCompatibleBitmap failed, error %d.\n", GetLastError());
+    ok(!!hbitmap, "CreateCompatibleBitmap failed, error %ld.\n", GetLastError());
     count = GetObjectW(hbitmap, sizeof(dib), &dib);
     ok(count == sizeof(BITMAP), "GetObject failed, count %d.\n", count);
     count = GetObjectW(hbitmap, sizeof(bitmap), &bitmap);
     ok(count == sizeof(BITMAP), "GetObject failed, count %d.\n", count);
-    ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %d, got %d.\n", dm.dmBitsPerPel,
+    ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %ld, got %d.\n", dm.dmBitsPerPel,
        bitmap.bmBitsPixel);
     DeleteObject(hbitmap);
 
@@ -2233,7 +2234,7 @@ static void test_display_dc(void)
 
         mem_dc = CreateCompatibleDC(hdc);
         hbitmap = CreateBitmap(dm.dmPelsWidth, dm.dmPelsHeight, 1, bpps[i], NULL);
-        ok(!!hbitmap, "CreateBitmap failed, error %d.\n", GetLastError());
+        ok(!!hbitmap, "CreateBitmap failed, error %ld.\n", GetLastError());
         old_hbitmap = SelectObject(mem_dc, hbitmap);
         if (bpps[i] != 1 && bpps[i] != 32)
             ok(!old_hbitmap, "Selecting bitmap succeeded.\n");
@@ -2250,11 +2251,11 @@ static void test_display_dc(void)
     /* Test selecting a DDB of the same color depth into a display compatible DC */
     mem_dc = CreateCompatibleDC(hdc);
     bpp = GetDeviceCaps(mem_dc, BITSPIXEL);
-    ok(bpp == dm.dmBitsPerPel, "Expected bpp %d, got %d.\n", dm.dmBitsPerPel, bpp);
+    ok(bpp == dm.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm.dmBitsPerPel, bpp);
     hbitmap = CreateCompatibleBitmap(hdc, dm.dmPelsWidth, dm.dmPelsHeight);
     count = GetObjectW(hbitmap, sizeof(bitmap), &bitmap);
     ok(count == sizeof(BITMAP), "GetObject failed, count %d.\n", count);
-    ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %d, got %d.\n", dm.dmBitsPerPel, bitmap.bmBitsPixel);
+    ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %ld, got %d.\n", dm.dmBitsPerPel, bitmap.bmBitsPixel);
     old_hbitmap = SelectObject(mem_dc, hbitmap);
     ok(!!old_hbitmap, "Failed to select bitmap.\n");
     SelectObject(mem_dc, old_hbitmap);
@@ -2273,13 +2274,13 @@ static void test_display_dc(void)
 
     res = ChangeDisplaySettingsExA(NULL, &dm2, NULL, CDS_RESET, NULL);
     ok(res == DISP_CHANGE_SUCCESSFUL || broken(res == DISP_CHANGE_FAILED), /* Win8 TestBots */
-            "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+            "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
     if (res == DISP_CHANGE_SUCCESSFUL)
     {
         check_display_dc(hdc, &dm2, FALSE);
 
         res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
     }
 
     /* Tests after mode changes to a different color depth */
@@ -2295,7 +2296,7 @@ static void test_display_dc(void)
         res = ChangeDisplaySettingsExA(NULL, &dm2, NULL, CDS_RESET, NULL);
         /* Win8 TestBots */
         ok(res == DISP_CHANGE_SUCCESSFUL || broken(res == DISP_CHANGE_FAILED),
-                "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+                "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
         if (res == DISP_CHANGE_SUCCESSFUL)
         {
             check_display_dc(hdc, &dm2, FALSE);
@@ -2304,18 +2305,18 @@ static void test_display_dc(void)
              * a display DC into a new compatible DC */
             count = GetObjectW(hbitmap, sizeof(bitmap), &bitmap);
             ok(count == sizeof(BITMAP), "GetObject failed, count %d.\n", count);
-            ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %d, got %d.\n", dm.dmBitsPerPel,
+            ok(bitmap.bmBitsPixel == dm.dmBitsPerPel, "Expected %ld, got %d.\n", dm.dmBitsPerPel,
                bitmap.bmBitsPixel);
 
             /* Note that hbitmap is of a different color depth and it can be successfully selected
              * into the new compatible DC */
             mem_dc = CreateCompatibleDC(hdc);
             bpp = GetDeviceCaps(mem_dc, BITSPIXEL);
-            ok(bpp == dm2.dmBitsPerPel, "Expected bpp %d, got %d.\n", dm2.dmBitsPerPel, bpp);
+            ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp);
             old_hbitmap = SelectObject(mem_dc, hbitmap);
             ok(!!old_hbitmap, "Failed to select bitmap.\n");
             bpp = GetDeviceCaps(mem_dc, BITSPIXEL);
-            ok(bpp == dm2.dmBitsPerPel, "Expected bpp %d, got %d.\n", dm2.dmBitsPerPel, bpp);
+            ok(bpp == dm2.dmBitsPerPel, "Expected bpp %ld, got %d.\n", dm2.dmBitsPerPel, bpp);
             SelectObject(mem_dc, old_hbitmap);
             DeleteDC(mem_dc);
             DeleteObject(hbitmap);
@@ -2327,7 +2328,7 @@ static void test_display_dc(void)
 
                 mem_dc = CreateCompatibleDC(hdc);
                 hbitmap = CreateBitmap(dm2.dmPelsWidth, dm2.dmPelsHeight, 1, bpps[i], NULL);
-                ok(!!hbitmap, "CreateBitmap failed, error %d.\n", GetLastError());
+                ok(!!hbitmap, "CreateBitmap failed, error %ld.\n", GetLastError());
                 old_hbitmap = SelectObject(mem_dc, hbitmap);
                 /* On Win7 dual-QXL test bot and XP, only 1-bit DDBs and DDBs with the same color
                  * depth can be selected to the compatible DC. On newer versions of Windows, only
@@ -2352,12 +2353,12 @@ static void test_display_dc(void)
             hbitmap = NULL;
 
             res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
         }
     }
     else
     {
-        win_skip("Failed to find a different color depth other than %u.\n", dm.dmBitsPerPel);
+        win_skip("Failed to find a different color depth other than %lu.\n", dm.dmBitsPerPel);
     }
 
     if (hbitmap)
@@ -2394,7 +2395,7 @@ static void test_display_dc(void)
 
         res = ChangeDisplaySettingsExA(dd.DeviceName, &dm2, NULL, CDS_RESET, NULL);
         ok(res == DISP_CHANGE_SUCCESSFUL || broken(res == DISP_CHANGE_FAILED), /* Win8 TestBots */
-                "ChangeDisplaySettingsExA %s returned unexpected %d.\n", dd.DeviceName, res);
+                "ChangeDisplaySettingsExA %s returned unexpected %ld.\n", dd.DeviceName, res);
         if (res != DISP_CHANGE_SUCCESSFUL)
         {
             win_skip("Failed to change display mode for %s.\n", dd.DeviceName);
@@ -2415,16 +2416,16 @@ static void test_display_dc(void)
         if (dm2.dmBitsPerPel && dm2.dmBitsPerPel != dm.dmBitsPerPel)
         {
             res = ChangeDisplaySettingsExA(dd.DeviceName, &dm2, NULL, CDS_RESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
 
             check_display_dc(hdc, &dm2, FALSE);
 
             res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %d.\n", res);
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA returned unexpected %ld.\n", res);
         }
         else
         {
-            win_skip("Failed to find a different color depth other than %u.\n", dm.dmBitsPerPel);
+            win_skip("Failed to find a different color depth other than %lu.\n", dm.dmBitsPerPel);
         }
 
         /* Tests after monitor detach */
@@ -2444,10 +2445,10 @@ static void test_display_dc(void)
             dm3.dmPelsWidth = 0;
             dm3.dmPelsHeight = 0;
             res = ChangeDisplaySettingsExA(dd.DeviceName, &dm3, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                     dd.DeviceName, res);
             res = ChangeDisplaySettingsExA(dd.DeviceName, NULL, NULL, 0, NULL);
-            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+            ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                     dd.DeviceName, res);
 
             count = GetSystemMetrics(SM_CMONITORS);
@@ -2458,10 +2459,10 @@ static void test_display_dc(void)
         }
 
         res = ChangeDisplaySettingsExA(dd.DeviceName, &dm, NULL, CDS_UPDATEREGISTRY | CDS_NORESET, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 dd.DeviceName, res);
         res = ChangeDisplaySettingsExA(NULL, NULL, NULL, 0, NULL);
-        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %d.\n",
+        ok(res == DISP_CHANGE_SUCCESSFUL, "ChangeDisplaySettingsExA %s returned unexpected %ld.\n",
                 dd.DeviceName, res);
         DeleteDC(hdc);
     }
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index f0e0d0fba76..ee949ec9518 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for window message handling
  *
@@ -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 );
 }
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index 5d4c4e2f968..d116fb7462b 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for resources.
  *
  * Copyright 2004 Ferenc Wagner
@@ -51,10 +52,10 @@ static void test_LoadStringW(void)
         return;
     }
     length2 = LoadStringW(hInst, 2, returnedstringw, ARRAY_SIZE(returnedstringw)); /* get resource string */
-    ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %d\n", length2, GetLastError());
+    ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %ld\n", length2, GetLastError());
     ok(length1 == length2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d\n",
         length1, length2);
-    ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %d\n",
+    ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %ld\n",
         length1, GetLastError());
 
     /* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
@@ -109,22 +110,22 @@ static void test_LoadStringA (void)
     }
 
     ret = LoadStringA(hInst, 1, buf, sizeof(buf) );
-    ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
     ret2 = LoadStringA( hInst, MAKELONG( 1, 0x8000 ), buf, sizeof(buf));
-    ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
     ret2 = LoadStringA( hInst, MAKELONG( 1, 0xffff ), buf, sizeof(buf));
-    ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
 
     ret = LoadStringA(hInst, 65534, buf, sizeof(buf) );
-    ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
     ret2 = LoadStringA( hInst, MAKELONG( 65534, 0x8000 ), buf, sizeof(buf));
-    ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
     ret2 = LoadStringA( hInst, MAKELONG( 65534, 0xffff ), buf, sizeof(buf));
-    ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
+    ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
 
     ret = LoadStringA(hInst, 0, buf, 0);
     ok( ret == -1 || broken(ret == 0),
-        "LoadStringA did not return -1 when called with buflen = 0, got %d, err %d\n",
+        "LoadStringA did not return -1 when called with buflen = 0, got %d, err %ld\n",
         ret, GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -132,7 +133,7 @@ static void test_LoadStringA (void)
     ret = LoadStringA(hInst, 1, buf, 1);
     ok( !ret, "LoadString returned %d\n", ret);
     ok( buf[0] == 0, "buf[0] = %c (%x)\n", buf[0], buf[0]);
-    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
+    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %ld\n", GetLastError());
 }
 
 static void test_accel1(void)
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 40eb13943fc..98f091abda5 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * Unit tests for scrollbar
  *
@@ -120,7 +121,7 @@ static void test_EnableScrollBar(void)
     todo_wine
     ok( GetLastError() == ERROR_INVALID_PARAMETER
         || broken(GetLastError() == 0xdeadbeef), /* winxp */
-        "GetLastError() = %u\n", GetLastError() );
+        "GetLastError() = %lu\n", GetLastError() );
 
     /* disable window, try to re-enable */
     ret = EnableWindow( hScroll, FALSE );
@@ -181,12 +182,12 @@ static void test_SetScrollPos(void)
     SetLastError( 0xdeadbeef );
     ret = SetScrollPos( mainwnd, SB_CTL, 30, TRUE );
     ok( !ret, "The position should not be set.\n" );
-    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = GetScrollPos( mainwnd, SB_CTL );
     ok( !ret, "The position should be equal to zero\n");
-    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
 
     DestroyWindow(hScroll);
     DestroyWindow(mainwnd);
@@ -242,7 +243,7 @@ static void test_GetScrollBarInfo(void)
     GetWindowRect( hScroll, &rect );
     ok( ret, "The GetWindowRect() call should not fail.\n" );
     ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)),
-        "unexpected rgstate(0x%x)\n", sbi.rgstate[0]);
+        "unexpected rgstate(0x%lx)\n", sbi.rgstate[0]);
     ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n",
        wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
 
@@ -301,40 +302,40 @@ static void scrollbar_test_default( DWORD style)
     /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
         ok( min == 0 && max == 0,
-                "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
+                "Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
     else
         ok(( min == 0 && max == 100) ||
                 broken( min == 0 && max == 0), /* Win 9x/ME */
-                "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
+                "Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
     ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
     ok( ret ||
             broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
     /* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
         ok( min == 0 && max == 0,
-                "Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
+                "Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
     else
         ok(( min == 0 && max == 100) ||
                 broken( min == 0 && max == 0), /* Win 9x/ME */
-                "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
+                "Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
     /* test GetScrollInfo, vist for vertical SB */
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should fail if no H or V scroll bar styles are present. Succeed otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
-        ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
+        ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
     else
         ok( ret ||
                 broken( !ret), /* Win 9x/ME */
-                "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+                "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     /* Same for Horizontal SB */
     ret = GetScrollInfo( hwnd, SB_HORZ, &si);
     /* should fail if no H or V scroll bar styles are present. Succeed otherwise */
     if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
-        ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
+        ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
     else
         ok( ret ||
                 broken( !ret), /* Win 9x/ME */
-                "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+                "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     /* now set the Vertical Scroll range to something that could be the default value it
      * already has */;
     ret = SetScrollRange( hwnd, SB_VERT, 0, 100, FALSE);
@@ -344,14 +345,14 @@ static void scrollbar_test_default( DWORD style)
     ok( ret, "GetScrollRange failed.\n");
     /* now the range should be 0,100 in ALL cases */
     ok( min == 0 && max == 100,
-            "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
+            "Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
     /* See what is different now for GetScrollRange */
     ret = GetScrollInfo( hwnd, SB_HORZ, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     /* report the windows style */
     winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     /* WS_VSCROLL added to the window style */
@@ -360,10 +361,10 @@ static void scrollbar_test_default( DWORD style)
         if (bThemeActive || style != WS_HSCROLL)
             todo_wine
             ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_VSCROLL),
-                "unexpected style change %08x/%08x\n", winstyle, style);
+                "unexpected style change %08lx/%08lx\n", winstyle, style);
         else
             ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
-                "unexpected style change %08x/%08x\n", winstyle, style);
+                "unexpected style change %08lx/%08lx\n", winstyle, style);
     }
     /* do the test again with H and V reversed.
      * Start with a clean window */
@@ -380,14 +381,14 @@ static void scrollbar_test_default( DWORD style)
     ok( ret, "GetScrollRange failed.\n");
     /* now the range should be 0,100 in ALL cases */
     ok( min == 0 && max == 100,
-            "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
+            "Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
     /* See what is different now for GetScrollRange */
     ret = GetScrollInfo( hwnd, SB_HORZ, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     /* report the windows style */
     winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     /* WS_HSCROLL added to the window style */
@@ -396,10 +397,10 @@ static void scrollbar_test_default( DWORD style)
         if (bThemeActive || style != WS_VSCROLL)
             todo_wine
             ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_HSCROLL),
-                "unexpected style change %08x/%08x\n", winstyle, style);
+                "unexpected style change %08lx/%08lx\n", winstyle, style);
         else
             ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
-                "unexpected style change %08x/%08x\n", winstyle, style);
+                "unexpected style change %08lx/%08lx\n", winstyle, style);
     }
     /* Slightly change the test to use SetScrollInfo
      * Start with a clean window */
@@ -413,20 +414,20 @@ static void scrollbar_test_default( DWORD style)
     si.nMax = 22;
     si.fMask |= SIF_RANGE;
     ret = SetScrollInfo( hwnd, SB_HORZ, &si, FALSE);
-    ok( ret, "SetScrollInfo failed. Style is %08x\n", style);
+    ok( ret, "SetScrollInfo failed. Style is %08lx\n", style);
     /* and request the Vertical range */
     ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
     ok( ret, "GetScrollRange failed.\n");
     /* now the range should be 0,100 in ALL cases */
     ok( min == 0 && max == 100,
-            "Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
+            "Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
     /* See what is different now for GetScrollRange */
     ret = GetScrollInfo( hwnd, SB_HORZ, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should succeed in ALL cases */
-    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
+    ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
     /* also test if the window scroll bars are enabled */
     ret = EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH);
     ok( !ret, "Vertical window scroll bar was not enabled\n");
@@ -443,13 +444,13 @@ static void scrollbar_test_default( DWORD style)
     assert( hwnd != 0);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should fail */
-    ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
+    ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
     /* add scroll styles */
     winstyle = GetWindowLongA( hwnd, GWL_STYLE );
     SetWindowLongW( hwnd, GWL_STYLE, winstyle | WS_VSCROLL | WS_HSCROLL);
     ret = GetScrollInfo( hwnd, SB_VERT, &si);
     /* should still fail */
-    ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
+    ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
     /* clean up */
     DestroyWindow( hwnd);
 }
@@ -700,7 +701,7 @@ static void test_subclass(void)
     BOOL r;
 
     r = GetClassInfoExA(GetModuleHandleA(NULL), "SCROLLBAR", &class_info);
-    ok(r, "GetClassInfoEx failed: %u\n", GetLastError());
+    ok(r, "GetClassInfoEx failed: %lu\n", GetLastError());
     scrollbar_wndproc = class_info.lpfnWndProc;
 
     memset(&wc, 0, sizeof(wc));
@@ -709,21 +710,21 @@ static void test_subclass(void)
     wc.lpszClassName = "MyTestSubclass";
     wc.lpfnWndProc = subclass_proc;
     r = RegisterClassA(&wc);
-    ok(r, "RegisterClass failed: %u\n", GetLastError());
+    ok(r, "RegisterClass failed: %lu\n", GetLastError());
 
     hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
                             CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
-    ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
+    ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
 
     r = SetScrollRange(hwnd, SB_CTL, 0, 100, TRUE);
-    ok(r, "SetScrollRange failed: %u\n", GetLastError());
+    ok(r, "SetScrollRange failed: %lu\n", GetLastError());
 
     res = SetScrollPos(hwnd, SB_CTL, 2, FALSE);
-    ok(!res, "SetScrollPos returned %lu\n", res);
+    ok(!res, "SetScrollPos returned %Iu\n", res);
 
     memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
     res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
-    ok(res == 2, "SetScrollPos returned %lu\n", res);
+    ok(res == 2, "SetScrollPos returned %Iu\n", res);
     ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
     todo_wine
     ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
@@ -732,19 +733,19 @@ static void test_subclass(void)
     memset(&scroll_info, 0xcc, sizeof(scroll_info));
     scroll_info.cbSize = sizeof(scroll_info);
     res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
-    ok(res == 1, "SBM_GETSCROLLBARINFO returned %lu\n", res);
+    ok(res == 1, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
 
     DestroyWindow(hwnd);
 
     /* if we skip calling wndproc for WM_CREATE, window is not considered a scrollbar */
     hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
                             CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), (void *)1 );
-    ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
+    ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
 
     memset(&scroll_info, 0xcc, sizeof(scroll_info));
     scroll_info.cbSize = sizeof(scroll_info);
     res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
-    ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
+    ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
 
     DestroyWindow(hwnd);
 
@@ -752,20 +753,20 @@ static void test_subclass(void)
     wc.cbWndExtra = class_info.cbWndExtra - 1;
     wc.lpszClassName = "MyTestSubclass2";
     r = RegisterClassA(&wc);
-    ok(r, "RegisterClass failed: %u\n", GetLastError());
+    ok(r, "RegisterClass failed: %lu\n", GetLastError());
 
     hwnd = CreateWindowExA( 0, "MyTestSubclass2", "Scroll", WS_OVERLAPPEDWINDOW,
                             CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
-    ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
+    ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
 
     memset(&scroll_info, 0xcc, sizeof(scroll_info));
     scroll_info.cbSize = sizeof(scroll_info);
     res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
-    ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
+    ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
 
     memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
     res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
-    ok(res == 0, "SetScrollPos returned %lu\n", res);
+    ok(res == 0, "SetScrollPos returned %Iu\n", res);
     ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
     todo_wine
     ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
@@ -789,20 +790,20 @@ static void test_visual(void)
     colors[0] = RGB(0x11, 0x22, 0x33);
     colors[1] = RGB(0xaa, 0xbb, 0xcc);
     ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, colors);
-    ok(ret, "SetSysColors failed, error %u.\n", GetLastError());
+    ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
 
     for (i = 0; i < ARRAY_SIZE(styles); ++i)
     {
-        winetest_push_context("style %#x", styles[i]);
+        winetest_push_context("style %#lx", styles[i]);
 
         hwnd = CreateWindowA("ScrollBar", "", WS_POPUP | WS_VISIBLE | styles[i], 0, 0, 20, 20, 0, 0,
                              0, 0);
-        ok(hwnd != NULL, "CreateWindowA failed, error %u.\n", GetLastError());
+        ok(hwnd != NULL, "CreateWindowA failed, error %lu.\n", GetLastError());
         RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ERASENOW | RDW_FRAME);
 
         hdc = GetDC(hwnd);
         color = GetPixel(hdc, 5, 5);
-        ok(color == colors[1], "Expected color %#x, got %#x.\n", colors[1], color);
+        ok(color == colors[1], "Expected color %#lx, got %#lx.\n", colors[1], color);
 
         ReleaseDC(hwnd, hdc);
         DestroyWindow(hwnd);
@@ -810,7 +811,7 @@ static void test_visual(void)
     }
 
     ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, old_colors);
-    ok(ret, "SetSysColors failed, error %u.\n", GetLastError());
+    ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
 }
 
 START_TEST ( scroll )
diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c
index 0899f4c6187..7a22c8594da 100644
--- a/dlls/user32/tests/static.c
+++ b/dlls/user32/tests/static.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for static controls.
  *
  * Copyright 2007 Google (Mikolaj Zalewski)
@@ -85,19 +86,19 @@ static void test_updates(int style)
 
     exstyle = GetWindowLongW(hStatic, GWL_EXSTYLE);
     if (style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT || style == SS_SUNKEN)
-        ok(exstyle == WS_EX_STATICEDGE, "expected WS_EX_STATICEDGE, got %d\n", exstyle);
+        ok(exstyle == WS_EX_STATICEDGE, "expected WS_EX_STATICEDGE, got %ld\n", exstyle);
     else
-        ok(exstyle == 0, "expected 0, got %d\n", exstyle);
+        ok(exstyle == 0, "expected 0, got %ld\n", exstyle);
 
     GetClientRect(hStatic, &rcClient);
     if (style == SS_ETCHEDVERT)
-        ok(rcClient.right == 0, "expected zero width, got %d\n", rcClient.right);
+        ok(rcClient.right == 0, "expected zero width, got %ld\n", rcClient.right);
     else
-        ok(rcClient.right > 0, "expected non-zero width, got %d\n", rcClient.right);
+        ok(rcClient.right > 0, "expected non-zero width, got %ld\n", rcClient.right);
     if (style == SS_ETCHEDHORZ)
-        ok(rcClient.bottom == 0, "expected zero height, got %d\n", rcClient.bottom);
+        ok(rcClient.bottom == 0, "expected zero height, got %ld\n", rcClient.bottom);
     else
-        ok(rcClient.bottom > 0, "expected non-zero height, got %d\n", rcClient.bottom);
+        ok(rcClient.bottom > 0, "expected non-zero height, got %ld\n", rcClient.bottom);
 
     g_nReceivedColorStatic = 0;
     /* during each update parent WndProc will test the WM_CTLCOLORSTATIC message */
@@ -217,10 +218,10 @@ static void test_STM_SETIMAGE(void)
 
     for (type = SS_LEFT; type < SS_ETCHEDFRAME; type++)
     {
-        winetest_push_context("%u", type);
+        winetest_push_context("%lu", type);
 
         hwnd = build_static(type);
-        ok(hwnd != 0, "failed to create static type %#x\n", type);
+        ok(hwnd != 0, "failed to create static type %#lx\n", type);
 
         /* set icon */
         g_nReceivedColorStatic = 0;
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index f2d9694bd6f..a8487b40878 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for functions SystemParametersInfo and GetSystemMetrics.
  *
  * Copyright 2002 Andriy Palamarchuk
@@ -302,14 +303,14 @@ static BOOL test_error_msg ( int rc, const char *name )
         }
         else
         {
-            trace("%s failed for reason: %d. Indicating test failure and skipping remainder of test\n",name,last_error);
-            ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,last_error);
+            trace("%s failed for reason: %ld. Indicating test failure and skipping remainder of test\n",name,last_error);
+            ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,last_error);
         }
         return FALSE;
     }
     else
     {
-        ok(rc!=0,"SystemParametersInfoA: rc=%d err=%d\n",rc,last_error);
+        ok(rc!=0,"SystemParametersInfoA: rc=%d err=%ld\n",rc,last_error);
         return TRUE;
     }
 }
@@ -335,12 +336,12 @@ static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCS
     RegCloseKey( hKey );
     if (rc==ERROR_SUCCESS)
     {
-        ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
+        ok( type == exp_type, "wrong type %lu/%lu\n", type, exp_type );
         switch (exp_type)
         {
         case REG_DWORD:
             ok( *(DWORD *)value == *(DWORD *)exp_value,
-                "Wrong value in registry: %s %s %08x/%08x\n",
+                "Wrong value in registry: %s %s %08lx/%08lx\n",
                 subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
             break;
         case REG_SZ:
@@ -365,12 +366,12 @@ static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCS
         RegCloseKey( hKey );
         if (rc==ERROR_SUCCESS)
         {
-            ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
+            ok( type == exp_type, "wrong type %lu/%lu\n", type, exp_type );
             switch (exp_type)
             {
             case REG_DWORD:
                 ok( *(DWORD *)value == *(DWORD *)exp_value,
-                    "Wrong value in registry: %s %s %08x/%08x\n",
+                    "Wrong value in registry: %s %s %08lx/%08lx\n",
                     subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
                 break;
             case REG_SZ:
@@ -396,12 +397,12 @@ static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCS
         RegCloseKey( hKey );
         if (rc==ERROR_SUCCESS)
         {
-            ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
+            ok( type == exp_type, "wrong type %lu/%lu\n", type, exp_type );
             switch (exp_type)
             {
             case REG_DWORD:
                 ok( *(DWORD *)value == *(DWORD *)exp_value,
-                    "Wrong value in registry: %s %s %08x/%08x\n",
+                    "Wrong value in registry: %s %s %08lx/%08lx\n",
                     subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
                 break;
             case REG_SZ:
@@ -426,12 +427,12 @@ static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName1, LPCS
             RegCloseKey( hKey );
             if (rc==ERROR_SUCCESS)
             {
-                ok( type == exp_type, "wrong type %u/%u\n", type, exp_type );
+                ok( type == exp_type, "wrong type %lu/%lu\n", type, exp_type );
                 switch (exp_type)
                 {
                 case REG_DWORD:
                     ok( *(DWORD *)value == *(DWORD *)exp_value,
-                        "Wrong value in registry: %s %s %08x/%08x\n",
+                        "Wrong value in registry: %s %s %08lx/%08lx\n",
                         subKey1, valName1, *(DWORD *)value, *(DWORD *)exp_value );
                     break;
                 case REG_SZ:
@@ -575,48 +576,48 @@ static void test_SPI_SETBEEP( void )                   /*      2 */
     curr_val = TRUE;
     rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
     if (!test_error_msg(rc,"SPI_SETBEEP")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETBEEP, 0 );
     test_reg_key( SPI_SETBEEP_REGKEY,
                   SPI_SETBEEP_VALNAME,
                   curr_val ? "Yes" : "No" );
     rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" );
     rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 );
     if (rc || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
     {
-        ok(rc, "SystemParametersInfoW: rc=%d err=%d\n", rc, GetLastError());
+        ok(rc, "SystemParametersInfoW: rc=%d err=%ld\n", rc, GetLastError());
         eq( b, curr_val, "SystemParametersInfoW", "%d" );
     }
 
     /* is a message sent for the second change? */
     rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETBEEP, 0 );
 
     curr_val = FALSE;
     rc=SystemParametersInfoW( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
     if (rc == FALSE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
         rc=SystemParametersInfoA( SPI_SETBEEP, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
-    ok(rc, "SystemParametersInfo: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfo: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETBEEP, 0 );
     test_reg_key( SPI_SETBEEP_REGKEY,
                   SPI_SETBEEP_VALNAME,
                   curr_val ? "Yes" : "No" );
     rc=SystemParametersInfoA( SPI_GETBEEP, 0, &b, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( b, curr_val, "SPI_{GET,SET}BEEP", "%d" );
     rc=SystemParametersInfoW( SPI_GETBEEP, 0, &b, 0 );
     if (rc || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
     {
-        ok(rc, "SystemParametersInfoW: rc=%d err=%d\n", rc, GetLastError());
+        ok(rc, "SystemParametersInfoW: rc=%d err=%ld\n", rc, GetLastError());
         eq( b, curr_val, "SystemParametersInfoW", "%d" );
     }
     ok( MessageBeep( MB_OK ), "Return value of MessageBeep when sound is disabled\n" );
 
     rc=SystemParametersInfoA( SPI_SETBEEP, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static const char *setmouse_valuenames[3] = {
@@ -646,7 +647,7 @@ static BOOL run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *pro
         rc=SystemParametersInfoA( SPI_SETMOUSE, 0, curr_val, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
     if (!test_error_msg(rc,"SPI_SETMOUSE")) return FALSE;
 
-    ok(rc, "SystemParametersInfo: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfo: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETMOUSE, 0 );
     for (i = 0; i < 3; i++)
     {
@@ -655,14 +656,14 @@ static BOOL run_spi_setmouse_test( int curr_val[], POINT *req_change, POINT *pro
     }
 
     rc=SystemParametersInfoA( SPI_GETMOUSE, 0, mi, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     ok(mi[0] == curr_val[0], "expected X threshold %d, got %d\n", curr_val[0], mi[0]);
     ok(mi[1] == curr_val[1], "expected Y threshold %d, got %d\n", curr_val[1], mi[1]);
     ok(mi[2] == curr_val[2] || broken(mi[2] == 1) /* Win10 1709+ */,
             "expected acceleration %d, got %d\n", curr_val[2], mi[2]);
 
     rc=SystemParametersInfoW( SPI_GETMOUSE, 0, mi, 0 );
-    ok(rc, "SystemParametersInfoW: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoW: rc=%d err=%ld\n", rc, GetLastError());
     ok(mi[0] == curr_val[0], "expected X threshold %d, got %d\n", curr_val[0], mi[0]);
     ok(mi[1] == curr_val[1], "expected Y threshold %d, got %d\n", curr_val[1], mi[1]);
     ok(mi[2] == curr_val[2] || broken(mi[2] == 1) /* Win10 1709+ */,
@@ -745,7 +746,7 @@ static void test_SPI_SETMOUSE( void )                  /*      4 */
     run_spi_setmouse_test( curr_val, req_change, proj_change8, nchange );
 
     rc=SystemParametersInfoA( SPI_SETMOUSE, 0, old_mi, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static BOOL test_setborder(UINT curr_val, int usesetborder, int dpi)
@@ -757,18 +758,18 @@ static BOOL test_setborder(UINT curr_val, int usesetborder, int dpi)
 
     ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICSA, iPaddedBorderWidth);
     rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     if( usesetborder) {
         rc=SystemParametersInfoA( SPI_SETBORDER, curr_val, 0, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETBORDER")) return FALSE;
-        ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+        ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
         test_change_message( SPI_SETBORDER, 1 );
     } else { /* set non client metrics */
         ncm.iBorderWidth = curr_val;
         rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, 0, &ncm, SPIF_UPDATEINIFILE|
                 SPIF_SENDCHANGE);
         if (!test_error_msg(rc,"SPI_SETNONCLIENTMETRICS")) return FALSE;
-        ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+        ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
         test_change_message( SPI_SETNONCLIENTMETRICS, 1 );
     }
     if( curr_val) { /* skip if 0, some windows versions return 0 others 1 */
@@ -781,11 +782,11 @@ static BOOL test_setborder(UINT curr_val, int usesetborder, int dpi)
     if (curr_val == 0) curr_val = 1;
     /* should be the same as the non client metrics */
     rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( (UINT)ncm.iBorderWidth, curr_val, "NonClientMetric.iBorderWidth", "%d");
     /* and from SPI_GETBORDER */ 
     rc=SystemParametersInfoA( SPI_GETBORDER, 0, &border, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( border, curr_val, "SPI_{GET,SET}BORDER", "%d");
     /* test some SystemMetrics */
     frame = curr_val + GetSystemMetrics( SM_CXDLGFRAME );
@@ -845,7 +846,7 @@ static void test_SPI_SETBORDER( void )                 /*      6 */
     rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, 0, &ncmsave,
             SPIF_UPDATEINIFILE| SPIF_SENDCHANGE);
     test_change_message( SPI_SETNONCLIENTMETRICS, 1 );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETKEYBOARDSPEED( void )          /*     10 */
@@ -869,18 +870,18 @@ static void test_SPI_SETKEYBOARDSPEED( void )          /*     10 */
         rc=SystemParametersInfoA( SPI_SETKEYBOARDSPEED, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETKEYBOARDSPEED")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETKEYBOARDSPEED, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETKEYBOARDSPEED_REGKEY, SPI_SETKEYBOARDSPEED_VALNAME, buf );
 
         rc=SystemParametersInfoA( SPI_GETKEYBOARDSPEED, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}KEYBOARDSPEED", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETKEYBOARDSPEED, old_speed, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 /* test_SPI_ICONHORIZONTALSPACING helper */
@@ -893,7 +894,7 @@ static BOOL dotest_spi_iconhorizontalspacing( INT curr_val)
     rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, curr_val, 0,
                               SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
     if (!test_error_msg(rc,"SPI_ICONHORIZONTALSPACING")) return FALSE;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_ICONHORIZONTALSPACING, 0 );
     curr_val = max( curr_val, min_val );
     /* The registry keys depend on the Windows version and the values too
@@ -906,14 +907,14 @@ static BOOL dotest_spi_iconhorizontalspacing( INT curr_val)
         "wrong value in registry %d, expected %d\n", regval, curr_val);
     /* compare with what SPI_ICONHORIZONTALSPACING returns */
     rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, 0, &spacing, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( spacing, curr_val, "ICONHORIZONTALSPACING", "%d");
     /* and with a system metrics */
     eq( GetSystemMetrics( SM_CXICONSPACING ), curr_val, "SM_CXICONSPACING", "%d" );
     /* and with what SPI_GETICONMETRICS returns */
     im.cbSize = sizeof(ICONMETRICSA);
     rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( im.iHorzSpacing, curr_val, "SPI_GETICONMETRICS", "%d" );
     return TRUE;
 }
@@ -934,7 +935,7 @@ static void test_SPI_ICONHORIZONTALSPACING( void )     /*     13 */
     dotest_spi_iconhorizontalspacing( 10); /* minimum is 32 */
     /* restore */
     rc=SystemParametersInfoA( SPI_ICONHORIZONTALSPACING, old_spacing, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETSCREENSAVETIMEOUT( void )      /*     14 */
@@ -958,20 +959,20 @@ static void test_SPI_SETSCREENSAVETIMEOUT( void )      /*     14 */
         rc=SystemParametersInfoA( SPI_SETSCREENSAVETIMEOUT, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETSCREENSAVETIMEOUT")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETSCREENSAVETIMEOUT, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETSCREENSAVETIMEOUT_REGKEY,
                       SPI_SETSCREENSAVETIMEOUT_VALNAME, buf );
 
         rc = SystemParametersInfoA( SPI_GETSCREENSAVETIMEOUT, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}SCREENSAVETIMEOUT", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETSCREENSAVETIMEOUT, old_timeout, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETSCREENSAVEACTIVE( void )       /*     17 */
@@ -994,20 +995,20 @@ static void test_SPI_SETSCREENSAVEACTIVE( void )       /*     17 */
         rc=SystemParametersInfoA( SPI_SETSCREENSAVEACTIVE, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETSCREENSAVEACTIVE")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETSCREENSAVEACTIVE, 0 );
         test_reg_key( SPI_SETSCREENSAVEACTIVE_REGKEY,
                       SPI_SETSCREENSAVEACTIVE_VALNAME,
                       vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSCREENSAVEACTIVE, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok(v == vals[i] || broken(! v) /* Win 7 */,
            "SPI_{GET,SET}SCREENSAVEACTIVE: got %d instead of %d\n", v, vals[i]);
     }
 
     rc=SystemParametersInfoA( SPI_SETSCREENSAVEACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETGRIDGRANULARITY( void )        /*     19 */
@@ -1036,19 +1037,19 @@ static void test_SPI_SETKEYBOARDDELAY( void )          /*     23 */
         rc=SystemParametersInfoA( SPI_SETKEYBOARDDELAY, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETKEYBOARDDELAY")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETKEYBOARDDELAY, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETKEYBOARDDELAY_REGKEY,
                       SPI_SETKEYBOARDDELAY_VALNAME, buf );
 
         rc=SystemParametersInfoA( SPI_GETKEYBOARDDELAY, 0, &delay, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( delay, vals[i], "SPI_{GET,SET}KEYBOARDDELAY", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETKEYBOARDDELAY, old_delay, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 
@@ -1062,7 +1063,7 @@ static BOOL dotest_spi_iconverticalspacing( INT curr_val)
     rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, curr_val, 0,
                               SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
     if (!test_error_msg(rc,"SPI_ICONVERTICALSPACING")) return FALSE;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_ICONVERTICALSPACING, 0 );
     curr_val = max( curr_val, min_val );
     /* The registry keys depend on the Windows version and the values too
@@ -1075,14 +1076,14 @@ static BOOL dotest_spi_iconverticalspacing( INT curr_val)
         "wrong value in registry %d, expected %d\n", regval, curr_val);
     /* compare with what SPI_ICONVERTICALSPACING returns */
     rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, 0, &spacing, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( spacing, curr_val, "ICONVERTICALSPACING", "%d" );
     /* and with a system metrics */
     eq( GetSystemMetrics( SM_CYICONSPACING ), curr_val, "SM_CYICONSPACING", "%d" );
     /* and with what SPI_GETICONMETRICS returns */
     im.cbSize = sizeof(ICONMETRICSA);
     rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( im.iVertSpacing, curr_val, "SPI_GETICONMETRICS", "%d" );
     return TRUE;
 }
@@ -1105,7 +1106,7 @@ static void test_SPI_ICONVERTICALSPACING( void )       /*     24 */
     /* restore */
     rc=SystemParametersInfoA( SPI_ICONVERTICALSPACING, old_spacing, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETICONTITLEWRAP( void )          /*     26 */
@@ -1130,7 +1131,7 @@ static void test_SPI_SETICONTITLEWRAP( void )          /*     26 */
         rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETICONTITLEWRAP")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETICONTITLEWRAP, 1 );
         regval = metricfromreg( SPI_SETICONTITLEWRAP_REGKEY2,
                 SPI_SETICONTITLEWRAP_VALNAME, dpi);
@@ -1140,17 +1141,17 @@ static void test_SPI_SETICONTITLEWRAP( void )          /*     26 */
         ok( regval == vals[i], "wrong value in registry %d, expected %d\n", regval, vals[i] );
 
         rc=SystemParametersInfoA( SPI_GETICONTITLEWRAP, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}ICONTITLEWRAP", "%d" );
         /* and test with what SPI_GETICONMETRICS returns */
         im.cbSize = sizeof(ICONMETRICSA);
         rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im, FALSE );
-        ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+        ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
         eq( im.iTitleWrap, (BOOL)vals[i], "SPI_GETICONMETRICS", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETICONTITLEWRAP, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMENUDROPALIGNMENT( void )      /*     28 */
@@ -1173,7 +1174,7 @@ static void test_SPI_SETMENUDROPALIGNMENT( void )      /*     28 */
         rc=SystemParametersInfoA( SPI_SETMENUDROPALIGNMENT, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETMENUDROPALIGNMENT")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETMENUDROPALIGNMENT, 0 );
         test_reg_key_ex( SPI_SETMENUDROPALIGNMENT_REGKEY1,
                          SPI_SETMENUDROPALIGNMENT_REGKEY2,
@@ -1181,7 +1182,7 @@ static void test_SPI_SETMENUDROPALIGNMENT( void )      /*     28 */
                          vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETMENUDROPALIGNMENT, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}MENUDROPALIGNMENT", "%d" );
         eq( GetSystemMetrics( SM_MENUDROPALIGNMENT ), (int)vals[i],
             "SM_MENUDROPALIGNMENT", "%d" );
@@ -1189,7 +1190,7 @@ static void test_SPI_SETMENUDROPALIGNMENT( void )      /*     28 */
 
     rc=SystemParametersInfoA( SPI_SETMENUDROPALIGNMENT, old_b, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETDOUBLECLKWIDTH( void )         /*     29 */
@@ -1223,7 +1224,7 @@ static void test_SPI_SETDOUBLECLKWIDTH( void )         /*     29 */
 
     rc=SystemParametersInfoA( SPI_SETDOUBLECLKWIDTH, old_width, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETDOUBLECLKHEIGHT( void )        /*     30 */
@@ -1257,7 +1258,7 @@ static void test_SPI_SETDOUBLECLKHEIGHT( void )        /*     30 */
 
     rc=SystemParametersInfoA( SPI_SETDOUBLECLKHEIGHT, old_height, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETDOUBLECLICKTIME( void )        /*     32 */
@@ -1288,7 +1289,7 @@ static void test_SPI_SETDOUBLECLICKTIME( void )        /*     32 */
     curr_val = 1000;
     rc=SystemParametersInfoA( SPI_SETDOUBLECLICKTIME, curr_val, 0,
                              SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETDOUBLECLICKTIME, 0 );
     sprintf( buf, "%d", curr_val );
     test_reg_key( SPI_SETDOUBLECLICKTIME_REGKEY,
@@ -1313,7 +1314,7 @@ static void test_SPI_SETDOUBLECLICKTIME( void )        /*     32 */
     eq( GetDoubleClickTime(), curr_val, "GetDoubleClickTime", "%d" );
 
     rc=SystemParametersInfoA(SPI_SETDOUBLECLICKTIME, old_time, 0, SPIF_UPDATEINIFILE);
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMOUSEBUTTONSWAP( void )        /*     33 */
@@ -1347,7 +1348,7 @@ static void test_SPI_SETMOUSEBUTTONSWAP( void )        /*     33 */
 
     rc=SystemParametersInfoA( SPI_SETMOUSEBUTTONSWAP, old_b, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETFASTTASKSWITCH( void )         /*     36 */
@@ -1388,19 +1389,19 @@ static void test_SPI_SETDRAGFULLWINDOWS( void )        /*     37 */
         rc=SystemParametersInfoA( SPI_SETDRAGFULLWINDOWS, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETDRAGFULLWINDOWS")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETDRAGFULLWINDOWS, 0 );
         test_reg_key( SPI_SETDRAGFULLWINDOWS_REGKEY,
                       SPI_SETDRAGFULLWINDOWS_VALNAME,
                       vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETDRAGFULLWINDOWS, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}DRAGFULLWINDOWS", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETDRAGFULLWINDOWS, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 #define test_reg_metric( KEY, VAL, val) do { \
@@ -1424,7 +1425,7 @@ static void test_SPI_SETDRAGFULLWINDOWS( void )        /*     37 */
         (LF).lfWidth == lfreg.lfWidth &&\
         (LF).lfWeight == lfreg.lfWeight &&\
         !strcmp( (LF).lfFaceName, lfreg.lfFaceName)\
-        , "wrong value \"%s\" in registry %d, %d\n", VAL, (LF).lfHeight, lfreg.lfHeight);\
+        , "wrong value \"%s\" in registry %ld, %ld\n", VAL, (LF).lfHeight, lfreg.lfHeight);\
 } while(0)
 
 #define TEST_NONCLIENTMETRICS_REG( ncm) do { \
@@ -1534,11 +1535,11 @@ static void test_SPI_SETNONCLIENTMETRICS( void )               /*     44 */
     rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, 0, &Ncmnew, SPIF_UPDATEINIFILE|
             SPIF_SENDCHANGE);
     if (!test_error_msg(rc,"SPI_SETNONCLIENTMETRICS")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETNONCLIENTMETRICS, 1 );
     /* get them back */
     rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmcur, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* test registry entries */
     TEST_NONCLIENTMETRICS_REG( Ncmcur );
     /* test the system metrics with these settings */
@@ -1557,13 +1558,13 @@ static void test_SPI_SETNONCLIENTMETRICS( void )               /*     44 */
 
     rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, 0, &Ncmnew, SPIF_UPDATEINIFILE|
             SPIF_SENDCHANGE);
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message( SPI_SETNONCLIENTMETRICS, 1 );
     /* raw values are in registry */
     TEST_NONCLIENTMETRICS_REG( Ncmnew );
     /* get them back */
     rc=SystemParametersInfoA( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA), &Ncmcur, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* cooked values are returned */
     expect = max( Ncmnew.iMenuHeight, 2 + get_tmheight( &Ncmnew.lfMenuFont, 1));
     ok( Ncmcur.iMenuHeight == expect,
@@ -1589,7 +1590,7 @@ static void test_SPI_SETNONCLIENTMETRICS( void )               /*     44 */
     rc=SystemParametersInfoA( SPI_SETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSA),
         &Ncmorig, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
     test_change_message( SPI_SETNONCLIENTMETRICS, 0 );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     /* test the system metrics with these settings */
     test_GetSystemMetrics();
 }
@@ -1634,10 +1635,10 @@ static void test_SPI_SETMINIMIZEDMETRICS( void )               /*     44 */
     rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
         &lpMm_cur, SPIF_UPDATEINIFILE );
     if (!test_error_msg(rc,"SPI_SETMINIMIZEDMETRICS")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* read them back */
     rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* and compare */
     eq( lpMm_new.iWidth,   lpMm_cur.iWidth,   "iWidth",   "%d" );
     eq( lpMm_new.iHorzGap, lpMm_cur.iHorzGap, "iHorzGap", "%d" );
@@ -1672,10 +1673,10 @@ static void test_SPI_SETMINIMIZEDMETRICS( void )               /*     44 */
     lpMm_cur.iArrange = - 1;
     rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
         &lpMm_cur, SPIF_UPDATEINIFILE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* read back */
     rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* the width and H/V gaps have minimum 0, arrange is and'd with 0xf */
     eq( lpMm_new.iWidth,   0,   "iWidth",   "%d" );
     eq( lpMm_new.iHorzGap, 0, "iHorzGap", "%d" );
@@ -1710,10 +1711,10 @@ static void test_SPI_SETMINIMIZEDMETRICS( void )               /*     44 */
     /* restore */
     rc=SystemParametersInfoA( SPI_SETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS),
         &lpMm_orig, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     /* check that */
     rc=SystemParametersInfoA( SPI_GETMINIMIZEDMETRICS, sizeof(MINIMIZEDMETRICS), &lpMm_new, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     eq( lpMm_new.iWidth,   lpMm_orig.iWidth,   "iWidth",   "%d" );
     eq( lpMm_new.iHorzGap, lpMm_orig.iHorzGap, "iHorzGap", "%d" );
     eq( lpMm_new.iVertGap, lpMm_orig.iVertGap, "iVertGap", "%d" );
@@ -1777,18 +1778,18 @@ static void test_SPI_SETICONMETRICS( void )               /*     46 */
 
     rc=SystemParametersInfoA( SPI_SETICONMETRICS, sizeof(ICONMETRICSA), &im_cur, SPIF_UPDATEINIFILE );
     if (!test_error_msg(rc,"SPI_SETICONMETRICS")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
 
     rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im_new, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     /* test GET <-> SETICONMETRICS */ 
     eq( im_new.iHorzSpacing, im_cur.iHorzSpacing, "iHorzSpacing", "%d" );
     eq( im_new.iVertSpacing, im_cur.iVertSpacing, "iVertSpacing", "%d" );
     eq( im_new.iTitleWrap,   im_cur.iTitleWrap,   "iTitleWrap",   "%d" );
-    eq( im_new.lfFont.lfHeight,         im_cur.lfFont.lfHeight,         "lfHeight",         "%d" );
-    eq( im_new.lfFont.lfWidth,          im_cur.lfFont.lfWidth,          "lfWidth",          "%d" );
-    eq( im_new.lfFont.lfEscapement,     im_cur.lfFont.lfEscapement,     "lfEscapement",     "%d" );
-    eq( im_new.lfFont.lfWeight,         im_cur.lfFont.lfWeight,         "lfWeight",         "%d" );
+    eq( im_new.lfFont.lfHeight,         im_cur.lfFont.lfHeight,         "lfHeight",         "%ld" );
+    eq( im_new.lfFont.lfWidth,          im_cur.lfFont.lfWidth,          "lfWidth",          "%ld" );
+    eq( im_new.lfFont.lfEscapement,     im_cur.lfFont.lfEscapement,     "lfEscapement",     "%ld" );
+    eq( im_new.lfFont.lfWeight,         im_cur.lfFont.lfWeight,         "lfWeight",         "%ld" );
     eq( im_new.lfFont.lfItalic,         im_cur.lfFont.lfItalic,         "lfItalic",         "%d" );
     eq( im_new.lfFont.lfStrikeOut,      im_cur.lfFont.lfStrikeOut,      "lfStrikeOut",      "%d" );
     eq( im_new.lfFont.lfUnderline,      im_cur.lfFont.lfUnderline,      "lfUnderline",      "%d" );
@@ -1829,10 +1830,10 @@ static void test_SPI_SETICONMETRICS( void )               /*     46 */
         wrap, im_cur.iTitleWrap);
     /* restore old values */
     rc=SystemParametersInfoA( SPI_SETICONMETRICS, sizeof(ICONMETRICSA), &im_orig,SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 
     rc=SystemParametersInfoA( SPI_GETICONMETRICS, sizeof(ICONMETRICSA), &im_new, FALSE );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
 
     eq( im_new.iHorzSpacing, im_orig.iHorzSpacing, "iHorzSpacing", "%d" );
     eq( im_new.iVertSpacing, im_orig.iVertSpacing, "iVertSpacing", "%d" );
@@ -1862,33 +1863,33 @@ static void test_SPI_SETWORKAREA( void )               /*     47 */
     rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &curr_val,
                               SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
     if (!test_error_msg(rc,"SPI_SETWORKAREA")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     rc=SystemParametersInfoA( SPI_GETWORKAREA, 0, &area, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     if( !EqualRect( &area, &curr_val)) /* no message if rect has not changed */
         test_change_message( SPI_SETWORKAREA, 0);
-    eq( area.left,   curr_val.left,   "left",   "%d" );
-    eq( area.top,    curr_val.top,    "top",    "%d" );
+    eq( area.left,   curr_val.left,   "left",   "%ld" );
+    eq( area.top,    curr_val.top,    "top",    "%ld" );
     /* size may be rounded */
     ok( area.right >= curr_val.right - 16 && area.right < curr_val.right + 16,
-        "right: got %d instead of %d\n", area.right, curr_val.right );
+        "right: got %ld instead of %ld\n", area.right, curr_val.right );
     ok( area.bottom >= curr_val.bottom - 16 && area.bottom < curr_val.bottom + 16,
-        "bottom: got %d instead of %d\n", area.bottom, curr_val.bottom );
+        "bottom: got %ld instead of %ld\n", area.bottom, curr_val.bottom );
     curr_val = area;
     rc=SystemParametersInfoA( SPI_SETWORKAREA, 0, &old_area,
                               SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     rc=SystemParametersInfoA( SPI_GETWORKAREA, 0, &area, 0 );
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     if( !EqualRect( &area, &curr_val)) /* no message if rect has not changed */
         test_change_message( SPI_SETWORKAREA, 0 );
-    eq( area.left,   old_area.left,   "left",   "%d" );
-    eq( area.top,    old_area.top,    "top",    "%d" );
+    eq( area.left,   old_area.left,   "left",   "%ld" );
+    eq( area.top,    old_area.top,    "top",    "%ld" );
     /* size may be rounded */
     ok( area.right >= old_area.right - 16 && area.right < old_area.right + 16,
-        "right: got %d instead of %d\n", area.right, old_area.right );
+        "right: got %ld instead of %ld\n", area.right, old_area.right );
     ok( area.bottom >= old_area.bottom - 16 && area.bottom < old_area.bottom + 16,
-        "bottom: got %d instead of %d\n", area.bottom, old_area.bottom );
+        "bottom: got %ld instead of %ld\n", area.bottom, old_area.bottom );
 }
 
 static void test_SPI_SETSHOWSOUNDS( void )             /*     57 */
@@ -1911,21 +1912,21 @@ static void test_SPI_SETSHOWSOUNDS( void )             /*     57 */
         rc=SystemParametersInfoA( SPI_SETSHOWSOUNDS, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETSHOWSOUNDS")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETSHOWSOUNDS, 1 );
         test_reg_key( SPI_SETSHOWSOUNDS_REGKEY,
                       SPI_SETSHOWSOUNDS_VALNAME,
                       vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSHOWSOUNDS, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_GETSHOWSOUNDS", "%d" );
         eq( GetSystemMetrics( SM_SHOWSOUNDS ), (int)vals[i],
             "SM_SHOWSOUNDS", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETSHOWSOUNDS, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETKEYBOARDPREF( void )           /*     69 */
@@ -1948,19 +1949,19 @@ static void test_SPI_SETKEYBOARDPREF( void )           /*     69 */
         rc=SystemParametersInfoA( SPI_SETKEYBOARDPREF, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETKEYBOARDPREF")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETKEYBOARDPREF, 1 );
         test_reg_key_ex2( SPI_SETKEYBOARDPREF_REGKEY, SPI_SETKEYBOARDPREF_REGKEY_LEGACY,
                           SPI_SETKEYBOARDPREF_VALNAME, SPI_SETKEYBOARDPREF_VALNAME_LEGACY,
                           vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETKEYBOARDPREF, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, (BOOL)vals[i], "SPI_GETKEYBOARDPREF", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETKEYBOARDPREF, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETSCREENREADER( void )           /*     71 */
@@ -1983,19 +1984,19 @@ static void test_SPI_SETSCREENREADER( void )           /*     71 */
         rc=SystemParametersInfoA( SPI_SETSCREENREADER, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETSCREENREADER")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETSCREENREADER, 1 );
         test_reg_key_ex2_optional( SPI_SETSCREENREADER_REGKEY, SPI_SETSCREENREADER_REGKEY_LEGACY,
                                    SPI_SETSCREENREADER_VALNAME, SPI_SETSCREENREADER_VALNAME_LEGACY,
                                    vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSCREENREADER, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, (BOOL)vals[i], "SPI_GETSCREENREADER", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETSCREENREADER, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETFONTSMOOTHING( void )         /*     75 */
@@ -2022,7 +2023,7 @@ static void test_SPI_SETFONTSMOOTHING( void )         /*     75 */
         rc=SystemParametersInfoA( SPI_SETFONTSMOOTHING, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETFONTSMOOTHING")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETFONTSMOOTHING, 0 );
         test_reg_key( SPI_SETFONTSMOOTHING_REGKEY,
                       SPI_SETFONTSMOOTHING_VALNAME,
@@ -2031,7 +2032,7 @@ static void test_SPI_SETFONTSMOOTHING( void )         /*     75 */
         rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGTYPE, 0, UlongToPtr(vals[i]),
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETFONTSMOOTHINGTYPE")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETFONTSMOOTHINGTYPE, 0 );
         test_reg_key_dword( SPI_SETFONTSMOOTHING_REGKEY,
                             SPI_SETFONTSMOOTHINGTYPE_VALNAME, &vals[i] );
@@ -2039,7 +2040,7 @@ static void test_SPI_SETFONTSMOOTHING( void )         /*     75 */
         rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGCONTRAST, 0, UlongToPtr(vals[i]),
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETFONTSMOOTHINGCONTRAST")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETFONTSMOOTHINGCONTRAST, 0 );
         test_reg_key_dword( SPI_SETFONTSMOOTHING_REGKEY,
                             SPI_SETFONTSMOOTHINGCONTRAST_VALNAME, &vals[i] );
@@ -2047,36 +2048,36 @@ static void test_SPI_SETFONTSMOOTHING( void )         /*     75 */
         rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGORIENTATION, 0, UlongToPtr(vals[i]),
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETFONTSMOOTHINGORIENTATION")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETFONTSMOOTHINGORIENTATION, 0 );
         test_reg_key_dword( SPI_SETFONTSMOOTHING_REGKEY,
                             SPI_SETFONTSMOOTHINGORIENTATION_VALNAME, &vals[i] );
 
         rc=SystemParametersInfoA( SPI_GETFONTSMOOTHING, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i] ? 1 : 0, "SPI_GETFONTSMOOTHING", "%d" );
 
         rc=SystemParametersInfoA( SPI_GETFONTSMOOTHINGTYPE, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok( v == vals[i], "wrong value %x/%x\n", v, vals[i] );
 
         rc=SystemParametersInfoA( SPI_GETFONTSMOOTHINGCONTRAST, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok( v == vals[i], "wrong value %x/%x\n", v, vals[i] );
 
         rc=SystemParametersInfoA( SPI_GETFONTSMOOTHINGORIENTATION, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok( v == vals[i], "wrong value %x/%x\n", v, vals[i] );
     }
 
     rc=SystemParametersInfoA( SPI_SETFONTSMOOTHING, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGTYPE, old_type, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGCONTRAST, old_contrast, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
     rc=SystemParametersInfoA( SPI_SETFONTSMOOTHINGORIENTATION, old_orient, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETLOWPOWERACTIVE( void )         /*     85 */
@@ -2099,7 +2100,7 @@ static void test_SPI_SETLOWPOWERACTIVE( void )         /*     85 */
         rc=SystemParametersInfoA( SPI_SETLOWPOWERACTIVE, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETLOWPOWERACTIVE")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETLOWPOWERACTIVE, 1 );
         test_reg_key_optional( SPI_SETLOWPOWERACTIVE_REGKEY,
                                SPI_SETLOWPOWERACTIVE_VALNAME,
@@ -2108,13 +2109,13 @@ static void test_SPI_SETLOWPOWERACTIVE( void )         /*     85 */
         /* SPI_SETLOWPOWERACTIVE is not persistent in win2k3 and above */
         v = 0xdeadbeef;
         rc=SystemParametersInfoA( SPI_GETLOWPOWERACTIVE, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok(v == vals[i] || v == 0, /* win2k3 */
            "SPI_GETLOWPOWERACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
     }
 
     rc=SystemParametersInfoA( SPI_SETLOWPOWERACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETPOWEROFFACTIVE( void )         /*     86 */
@@ -2137,7 +2138,7 @@ static void test_SPI_SETPOWEROFFACTIVE( void )         /*     86 */
         rc=SystemParametersInfoA( SPI_SETPOWEROFFACTIVE, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETPOWEROFFACTIVE")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETPOWEROFFACTIVE, 1 );
         test_reg_key_optional( SPI_SETPOWEROFFACTIVE_REGKEY,
                                SPI_SETPOWEROFFACTIVE_VALNAME,
@@ -2146,13 +2147,13 @@ static void test_SPI_SETPOWEROFFACTIVE( void )         /*     86 */
         /* SPI_SETPOWEROFFACTIVE is not persistent in win2k3 and above */
         v = 0xdeadbeef;
         rc=SystemParametersInfoA( SPI_GETPOWEROFFACTIVE, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         ok(v == vals[i] || v == 0, /* win2k3 */
            "SPI_GETPOWEROFFACTIVE: got %d instead of 0 or %d\n", v, vals[i]);
     }
 
     rc=SystemParametersInfoA( SPI_SETPOWEROFFACTIVE, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETSNAPTODEFBUTTON( void )         /*     95 */
@@ -2175,19 +2176,19 @@ static void test_SPI_SETSNAPTODEFBUTTON( void )         /*     95 */
         rc=SystemParametersInfoA( SPI_SETSNAPTODEFBUTTON, vals[i], 0,
                                   SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETSNAPTODEFBUTTON")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETSNAPTODEFBUTTON, 0 );
         test_reg_key_optional( SPI_SETSNAPTODEFBUTTON_REGKEY,
                                SPI_SETSNAPTODEFBUTTON_VALNAME,
                                vals[i] ? "1" : "0" );
 
         rc=SystemParametersInfoA( SPI_GETSNAPTODEFBUTTON, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_GETSNAPTODEFBUTTON", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETSNAPTODEFBUTTON, old_b, 0, SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMOUSEHOVERWIDTH( void )      /*     99 */
@@ -2211,20 +2212,20 @@ static void test_SPI_SETMOUSEHOVERWIDTH( void )      /*     99 */
         rc=SystemParametersInfoA( SPI_SETMOUSEHOVERWIDTH, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETMOUSEHOVERWIDTH")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETMOUSEHOVERWIDTH, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETMOUSEHOVERWIDTH_REGKEY,
                       SPI_SETMOUSEHOVERWIDTH_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETMOUSEHOVERWIDTH, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}MOUSEHOVERWIDTH", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETMOUSEHOVERWIDTH, old_width, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMOUSEHOVERHEIGHT( void )      /*     101 */
@@ -2248,20 +2249,20 @@ static void test_SPI_SETMOUSEHOVERHEIGHT( void )      /*     101 */
         rc=SystemParametersInfoA( SPI_SETMOUSEHOVERHEIGHT, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETMOUSEHOVERHEIGHT")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETMOUSEHOVERHEIGHT, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETMOUSEHOVERHEIGHT_REGKEY,
                       SPI_SETMOUSEHOVERHEIGHT_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETMOUSEHOVERHEIGHT, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}MOUSEHOVERHEIGHT", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETMOUSEHOVERHEIGHT, old_height, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMOUSEHOVERTIME( void )      /*     103 */
@@ -2289,20 +2290,20 @@ static void test_SPI_SETMOUSEHOVERTIME( void )      /*     103 */
         rc=SystemParametersInfoA( SPI_SETMOUSEHOVERTIME, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETMOUSEHOVERTIME")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETMOUSEHOVERTIME, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETMOUSEHOVERTIME_REGKEY,
                       SPI_SETMOUSEHOVERTIME_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETMOUSEHOVERTIME, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}MOUSEHOVERTIME", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETMOUSEHOVERTIME, old_time, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETWHEELSCROLLLINES( void )      /*     105 */
@@ -2328,20 +2329,20 @@ static void test_SPI_SETWHEELSCROLLLINES( void )      /*     105 */
         rc=SystemParametersInfoA( SPI_SETWHEELSCROLLLINES, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETWHEELSCROLLLINES")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETWHEELSCROLLLINES, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETMOUSESCROLLLINES_REGKEY,
                       SPI_SETMOUSESCROLLLINES_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETWHEELSCROLLLINES, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}WHEELSCROLLLINES", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETWHEELSCROLLLINES, old_lines, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETMENUSHOWDELAY( void )      /*     107 */
@@ -2367,20 +2368,20 @@ static void test_SPI_SETMENUSHOWDELAY( void )      /*     107 */
         rc=SystemParametersInfoA( SPI_SETMENUSHOWDELAY, vals[i], 0,
                                SPIF_UPDATEINIFILE | SPIF_SENDCHANGE );
         if (!test_error_msg(rc,"SPI_SETMENUSHOWDELAY")) return;
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         test_change_message( SPI_SETMENUSHOWDELAY, 0 );
         sprintf( buf, "%d", vals[i] );
         test_reg_key( SPI_SETMENUSHOWDELAY_REGKEY,
                       SPI_SETMENUSHOWDELAY_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETMENUSHOWDELAY, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}MENUSHOWDELAY", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETMENUSHOWDELAY, old_delay, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETWHEELSCROLLCHARS( void )      /*     108 */
@@ -2412,13 +2413,13 @@ static void test_SPI_SETWHEELSCROLLCHARS( void )      /*     108 */
                       SPI_SETMOUSESCROLLCHARS_VALNAME, buf );
 
         SystemParametersInfoA( SPI_GETWHEELSCROLLCHARS, 0, &v, 0 );
-        ok(rc, "%d: rc=%d err=%d\n", i, rc, GetLastError());
+        ok(rc, "%d: rc=%d err=%ld\n", i, rc, GetLastError());
         eq( v, vals[i], "SPI_{GET,SET}WHEELSCROLLCHARS", "%d" );
     }
 
     rc=SystemParametersInfoA( SPI_SETWHEELSCROLLCHARS, old_chars, 0,
                               SPIF_UPDATEINIFILE );
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 }
 
 static void test_SPI_SETWALLPAPER( void )              /*   115 */
@@ -2436,11 +2437,11 @@ static void test_SPI_SETWALLPAPER( void )              /*   115 */
     strcpy(newval, "");
     rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, newval, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
     if (!test_error_msg(rc,"SPI_SETDESKWALLPAPER")) return;
-    ok(rc, "SystemParametersInfoA: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "SystemParametersInfoA: rc=%d err=%ld\n", rc, GetLastError());
     test_change_message(SPI_SETDESKWALLPAPER, 0);
 
     rc=SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, oldval, SPIF_UPDATEINIFILE);
-    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%d\n", rc, GetLastError());
+    ok(rc, "***warning*** failed to restore the original value: rc=%d err=%ld\n", rc, GetLastError());
 
     test_reg_key(SPI_SETDESKWALLPAPER_REGKEY, SPI_SETDESKWALLPAPER_VALNAME, oldval);
 }
@@ -2492,7 +2493,7 @@ static void test_WM_DISPLAYCHANGE(void)
         displaychange_ok = FALSE;
 
         if(change_ret != DISP_CHANGE_SUCCESSFUL) {
-            skip("Setting depth %d failed(ret = %d)\n", test_bpps[i], change_ret);
+            skip("Setting depth %d failed(ret = %ld)\n", test_bpps[i], change_ret);
             ok(last_bpp == -1, "WM_DISPLAYCHANGE was sent with wParam %d despite mode change failure\n", last_bpp);
             continue;
         }
@@ -2888,7 +2889,7 @@ static void test_GetSystemMetrics( void)
                 ncm.iBorderWidth, ncm.iCaptionWidth, ncm.iCaptionHeight, IconSpacing, IconVerticalSpacing);
         trace( "MenuHeight %d MenuWidth %d ScrollHeight %d ScrollWidth %d SmCaptionHeight %d SmCaptionWidth %d\n",
                 ncm.iMenuHeight, ncm.iMenuWidth, ncm.iScrollHeight, ncm.iScrollWidth, ncm.iSmCaptionHeight, ncm.iSmCaptionWidth);
-        trace( "Captionfontchar width %d  MenuFont %d,%d CaptionWidth from registry: %d screen %d,%d\n",
+        trace( "Captionfontchar width %d  MenuFont %ld,%ld CaptionWidth from registry: %d screen %ld,%ld\n",
                 avcwCaption, tmMenuFont.tmHeight, tmMenuFont.tmExternalLeading, CaptionWidthfromreg, screen.cx, screen.cy);
     }
 
@@ -2898,9 +2899,9 @@ static void test_GetSystemMetrics( void)
 static void compare_font( const LOGFONTW *lf1, const LOGFONTW *lf2, int dpi, int custom_dpi, int line )
 {
     ok_(__FILE__,line)( lf2->lfHeight == (dpi == custom_dpi) ? lf1->lfHeight : MulDiv( lf1->lfHeight, custom_dpi, 2 * dpi ),
-                        "wrong lfHeight %d vs %d\n", lf1->lfHeight, lf2->lfHeight );
+                        "wrong lfHeight %ld vs %ld\n", lf1->lfHeight, lf2->lfHeight );
     ok_(__FILE__,line)( abs( lf1->lfWidth - MulDiv( lf2->lfWidth, dpi, custom_dpi )) <= 1,
-                        "wrong lfWidth %d vs %d\n", lf1->lfWidth, lf2->lfWidth );
+                        "wrong lfWidth %ld vs %ld\n", lf1->lfWidth, lf2->lfWidth );
     ok_(__FILE__,line)( !memcmp( &lf1->lfEscapement, &lf2->lfEscapement,
                                  offsetof( LOGFONTW, lfFaceName ) - offsetof( LOGFONTW, lfEscapement )),
                         "font differs\n" );
@@ -2924,10 +2925,10 @@ static void test_metrics_for_dpi( int custom_dpi )
 
     ncm1.cbSize = sizeof(ncm1);
     ret = SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof(ncm1), &ncm1, FALSE );
-    ok( ret, "SystemParametersInfoW failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoW failed err %lu\n", GetLastError() );
     ncm2.cbSize = sizeof(ncm2);
     ret = pSystemParametersInfoForDpi( SPI_GETNONCLIENTMETRICS, sizeof(ncm2), &ncm2, FALSE, custom_dpi );
-    ok( ret, "SystemParametersInfoForDpi failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoForDpi failed err %lu\n", GetLastError() );
 
     for (i = 0; i < 92; i++)
     {
@@ -3005,10 +3006,10 @@ static void test_metrics_for_dpi( int custom_dpi )
     }
     im1.cbSize = sizeof(im1);
     ret = SystemParametersInfoW( SPI_GETICONMETRICS, sizeof(im1), &im1, FALSE );
-    ok( ret, "SystemParametersInfoW failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoW failed err %lu\n", GetLastError() );
     im2.cbSize = sizeof(im2);
     ret = pSystemParametersInfoForDpi( SPI_GETICONMETRICS, sizeof(im2), &im2, FALSE, custom_dpi );
-    ok( ret, "SystemParametersInfoForDpi failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoForDpi failed err %lu\n", GetLastError() );
     ok( im1.iHorzSpacing == MulDiv( im2.iHorzSpacing, dpi, custom_dpi ), "wrong iHorzSpacing %u vs %u\n",
         im1.iHorzSpacing, im2.iHorzSpacing );
     ok( im1.iVertSpacing == MulDiv( im2.iVertSpacing, dpi, custom_dpi ), "wrong iVertSpacing %u vs %u\n",
@@ -3018,9 +3019,9 @@ static void test_metrics_for_dpi( int custom_dpi )
     compare_font( &im1.lfFont, &im2.lfFont, dpi, custom_dpi, __LINE__ );
 
     ret = SystemParametersInfoW( SPI_GETICONTITLELOGFONT, sizeof(lf1), &lf1, FALSE );
-    ok( ret, "SystemParametersInfoW failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoW failed err %lu\n", GetLastError() );
     ret = pSystemParametersInfoForDpi( SPI_GETICONTITLELOGFONT, sizeof(lf2), &lf2, FALSE, custom_dpi );
-    ok( ret, "SystemParametersInfoForDpi failed err %u\n", GetLastError() );
+    ok( ret, "SystemParametersInfoForDpi failed err %lu\n", GetLastError() );
     compare_font( &lf1, &lf2, dpi, custom_dpi, __LINE__ );
 
     /* on high-dpi iPaddedBorderWidth is used in addition to iBorderWidth */
@@ -3057,7 +3058,7 @@ static void test_metrics_for_dpi( int custom_dpi )
         SetLastError( 0xdeadbeef );
         ret = pSystemParametersInfoForDpi( i, 0, &val, 0, custom_dpi );
         ok( !ret, "%u: SystemParametersInfoForDpi succeeded\n", i );
-            ok( GetLastError() == ERROR_INVALID_PARAMETER, "%u: wrong error %u\n", i, GetLastError() );
+            ok( GetLastError() == ERROR_INVALID_PARAMETER, "%u: wrong error %lu\n", i, GetLastError() );
     }
 }
 
@@ -3089,21 +3090,21 @@ static BOOL CALLBACK test_enum_display_settings(HMONITOR hmonitor, HDC hdc, LPRE
     memset(&mi, 0, sizeof(mi));
     mi.cbSize = sizeof(mi);
     ret = GetMonitorInfoA(hmonitor, (MONITORINFO *)&mi);
-    ok(ret, "GetMonitorInfoA failed, error %#x\n", GetLastError());
+    ok(ret, "GetMonitorInfoA failed, error %#lx\n", GetLastError());
 
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     ret = EnumDisplaySettingsA(mi.szDevice, ENUM_CURRENT_SETTINGS, &dm);
-    ok(ret, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
 
     ok((dm.dmFields & (DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT)) == (DM_POSITION | DM_PELSWIDTH | DM_PELSHEIGHT),
-            "Unexpected dmFields %#x.\n", dm.dmFields);
-    ok(dm.dmPosition.x == mi.rcMonitor.left, "Expect dmPosition.x %d, got %d\n", mi.rcMonitor.left, dm.dmPosition.x);
-    ok(dm.dmPosition.y == mi.rcMonitor.top, "Expect dmPosition.y %d, got %d\n", mi.rcMonitor.top, dm.dmPosition.y);
+            "Unexpected dmFields %#lx.\n", dm.dmFields);
+    ok(dm.dmPosition.x == mi.rcMonitor.left, "Expect dmPosition.x %ld, got %ld\n", mi.rcMonitor.left, dm.dmPosition.x);
+    ok(dm.dmPosition.y == mi.rcMonitor.top, "Expect dmPosition.y %ld, got %ld\n", mi.rcMonitor.top, dm.dmPosition.y);
     width = mi.rcMonitor.right - mi.rcMonitor.left;
-    ok(dm.dmPelsWidth == width, "Expect dmPelsWidth %d, got %d\n", width, dm.dmPelsWidth);
+    ok(dm.dmPelsWidth == width, "Expect dmPelsWidth %d, got %ld\n", width, dm.dmPelsWidth);
     height = mi.rcMonitor.bottom - mi.rcMonitor.top;
-    ok(dm.dmPelsHeight == height, "Expect dmPelsHeight %d, got %d\n", height, dm.dmPelsHeight);
+    ok(dm.dmPelsHeight == height, "Expect dmPelsHeight %d, got %ld\n", height, dm.dmPelsHeight);
 
     return TRUE;
 }
@@ -3128,8 +3129,8 @@ static void test_EnumDisplaySettings(void)
     SetLastError(0xdeadbeef);
     ret = EnumDisplaySettingsA("invalid", ENUM_CURRENT_SETTINGS, &dm);
     ok(!ret, "EnumDisplaySettingsA succeeded\n");
-    ok(GetLastError() == 0xdeadbeef, "Expect error 0xdeadbeef, got %#x\n", GetLastError());
-    ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#x\n", dm.dmFields);
+    ok(GetLastError() == 0xdeadbeef, "Expect error 0xdeadbeef, got %#lx\n", GetLastError());
+    ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#lx\n", dm.dmFields);
 
     /* Monitor device names are invalid */
     memset(&dm, 0, sizeof(dm));
@@ -3137,8 +3138,8 @@ static void test_EnumDisplaySettings(void)
     SetLastError(0xdeadbeef);
     ret = EnumDisplaySettingsA("\\\\.\\DISPLAY1\\Monitor0", ENUM_CURRENT_SETTINGS, &dm);
     ok(!ret, "EnumDisplaySettingsA succeeded\n");
-    ok(GetLastError() == 0xdeadbeef, "Expect error 0xdeadbeef, got %#x\n", GetLastError());
-    ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#x\n", dm.dmFields);
+    ok(GetLastError() == 0xdeadbeef, "Expect error 0xdeadbeef, got %#lx\n", GetLastError());
+    ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#lx\n", dm.dmFields);
 
     /* Test that passing NULL to device name parameter means to use the primary adapter */
     memset(&dm, 0, sizeof(dm));
@@ -3148,45 +3149,45 @@ static void test_EnumDisplaySettings(void)
     ret = get_primary_adapter_name(primary_adapter);
     ok(ret, "get_primary_adapter_name failed\n");
     ret = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(ret, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
     ret = EnumDisplaySettingsA(primary_adapter, ENUM_CURRENT_SETTINGS, &dm2);
-    ok(ret, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
     ok(!memcmp(&dm, &dm2, sizeof(dm)), "Expect NULL device is the primary device.\n");
 
     /* Test dmSize */
     /* EnumDisplaySettingsA/W modify dmSize and don't check for insufficient dmSize */
     memset(&dm, 0, sizeof(dm));
     ret = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(ret, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
-    ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmICMMethod), "Expect dmSize %u, got %u\n",
+    ok(ret, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
+    ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmICMMethod), "Expect dmSize %lu, got %u\n",
             FIELD_OFFSET(DEVMODEA, dmICMMethod), dm.dmSize);
-    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#x, got %#x\n",
+    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#lx, got %#lx\n",
             setting_fields, dm.dmFields);
 
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     ret = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
-    ok(ret, "EnumDisplaySettingsA failed, error %#x\n", GetLastError());
-    ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmICMMethod), "Expect dmSize %u, got %u\n",
+    ok(ret, "EnumDisplaySettingsA failed, error %#lx\n", GetLastError());
+    ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmICMMethod), "Expect dmSize %lu, got %u\n",
             FIELD_OFFSET(DEVMODEA, dmICMMethod), dm.dmSize);
-    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#x, got %#x\n",
+    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#lx, got %#lx\n",
             setting_fields, dm.dmFields);
 
     memset(&dmW, 0, sizeof(dmW));
     ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW);
-    ok(ret, "EnumDisplaySettingsW failed, error %#x\n", GetLastError());
-    ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod), "Expect dmSize %u, got %u\n",
+    ok(ret, "EnumDisplaySettingsW failed, error %#lx\n", GetLastError());
+    ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod), "Expect dmSize %lu, got %u\n",
             FIELD_OFFSET(DEVMODEW, dmICMMethod), dmW.dmSize);
-    ok((dmW.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#x, got %#x\n",
+    ok((dmW.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#lx, got %#lx\n",
             setting_fields, dmW.dmFields);
 
     memset(&dmW, 0, sizeof(dmW));
     dmW.dmSize = sizeof(dmW);
     ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &dmW);
-    ok(ret, "EnumDisplaySettingsW failed, error %#x\n", GetLastError());
-    ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod), "Expect dmSize %u, got %u\n",
+    ok(ret, "EnumDisplaySettingsW failed, error %#lx\n", GetLastError());
+    ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod), "Expect dmSize %lu, got %u\n",
             FIELD_OFFSET(DEVMODEW, dmICMMethod), dmW.dmSize);
-    ok((dmW.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#x, got %#x\n",
+    ok((dmW.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#lx, got %#lx\n",
             setting_fields, dmW.dmFields);
 
     /* EnumDisplaySettingsExA/W need dmSize to be at least FIELD_OFFSET(DEVMODEA/W, dmFields) + 1 to have valid dmFields */
@@ -3205,34 +3206,34 @@ static void test_EnumDisplaySettings(void)
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = FIELD_OFFSET(DEVMODEA, dmFields);
     ret = EnumDisplaySettingsExA(NULL, ENUM_CURRENT_SETTINGS, &dm, 0);
-    ok(ret, "EnumDisplaySettingsExA failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsExA failed, error %#lx\n", GetLastError());
     todo_wine ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmFields), "Expect dmSize unchanged, got %u\n", dm.dmSize);
-    todo_wine ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#x\n", dm.dmFields);
+    todo_wine ok(dm.dmFields == 0, "Expect dmFields unchanged, got %#lx\n", dm.dmFields);
 
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = FIELD_OFFSET(DEVMODEA, dmFields) + 1;
     ret = EnumDisplaySettingsExA(NULL, ENUM_CURRENT_SETTINGS, &dm, 0);
-    ok(ret, "EnumDisplaySettingsExA failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsExA failed, error %#lx\n", GetLastError());
     todo_wine ok(dm.dmSize == FIELD_OFFSET(DEVMODEA, dmFields) + 1, "Expect dmSize unchanged, got %u\n", dm.dmSize);
     todo_wine ok((dm.dmFields & setting_fields) == (DM_POSITION | DM_DISPLAYORIENTATION),
-            "Expect dmFields to contain %#lx, got %#x\n", DM_POSITION | DM_DISPLAYORIENTATION, dm.dmFields);
+            "Expect dmFields to contain %#lx, got %#lx\n", DM_POSITION | DM_DISPLAYORIENTATION, dm.dmFields);
     /* Fields beyond dmSize don't get written */
     todo_wine ok(dm.dmPelsWidth == 0, "Expect dmPelsWidth unwritten\n");
 
     memset(&dmW, 0, sizeof(dmW));
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmFields);
     ret = EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &dmW, 0);
-    ok(ret, "EnumDisplaySettingsExW failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsExW failed, error %#lx\n", GetLastError());
     todo_wine ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmFields), "Expect dmSize unchanged, got %u\n", dmW.dmSize);
-    todo_wine ok(dmW.dmFields == 0, "Expect dmFields unchanged, got %#x\n", dmW.dmFields);
+    todo_wine ok(dmW.dmFields == 0, "Expect dmFields unchanged, got %#lx\n", dmW.dmFields);
 
     memset(&dmW, 0, sizeof(dmW));
     dmW.dmSize = FIELD_OFFSET(DEVMODEW, dmFields) + 1;
     ret = EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &dmW, 0);
-    ok(ret, "EnumDisplaySettingsExW failed, error %#x\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsExW failed, error %#lx\n", GetLastError());
     todo_wine ok(dmW.dmSize == FIELD_OFFSET(DEVMODEW, dmFields) + 1, "Expect dmSize unchanged, got %u\n", dmW.dmSize);
     todo_wine ok((dmW.dmFields & setting_fields) == (DM_POSITION | DM_DISPLAYORIENTATION),
-            "Expect dmFields to contain %#lx, got %#x\n", DM_POSITION | DM_DISPLAYORIENTATION, dmW.dmFields);
+            "Expect dmFields to contain %#lx, got %#lx\n", DM_POSITION | DM_DISPLAYORIENTATION, dmW.dmFields);
     /* Fields beyond dmSize don't get written */
     todo_wine ok(dmW.dmPelsWidth == 0, "Expect dmPelsWidth unwritten\n");
 
@@ -3243,19 +3244,19 @@ static void test_EnumDisplaySettings(void)
     memset(&dm, 0, sizeof(dm));
     dm.dmSize = sizeof(dm);
     ret = EnumDisplaySettingsExA(NULL, ENUM_CURRENT_SETTINGS, &dm, 0);
-    ok(ret, "EnumDisplaySettingsExA failed, error %#x\n", GetLastError());
-    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#x, got %#x\n",
+    ok(ret, "EnumDisplaySettingsExA failed, error %#lx\n", GetLastError());
+    ok((dm.dmFields & setting_fields) == setting_fields, "Expect dmFields to contain %#lx, got %#lx\n",
             setting_fields, dm.dmFields);
-    ok(dm.dmBitsPerPel == val, "Expect dmBitsPerPel %d, got %d\n", val, dm.dmBitsPerPel);
+    ok(dm.dmBitsPerPel == val, "Expect dmBitsPerPel %ld, got %ld\n", val, dm.dmBitsPerPel);
 
     val = GetDeviceCaps(hdc, NUMCOLORS);
     if (dm.dmBitsPerPel <= 8)
     {
-        ok(val == 256, "Screen bpp is %d, NUMCOLORS returned %d\n", dm.dmBitsPerPel, val);
+        ok(val == 256, "Screen bpp is %ld, NUMCOLORS returned %ld\n", dm.dmBitsPerPel, val);
     }
     else
     {
-        ok(val == -1, "Screen bpp is %d, NUMCOLORS returned %d\n", dm.dmBitsPerPel, val);
+        ok(val == -1, "Screen bpp is %ld, NUMCOLORS returned %ld\n", dm.dmBitsPerPel, val);
     }
 
     ReleaseDC(0, hdc);
@@ -3288,24 +3289,24 @@ static void test_EnumDisplaySettings(void)
             if (mode == ENUM_CURRENT_SETTINGS)
             {
                 ok((dm.dmFields & setting_fields) == setting_fields,
-                        "Expect dmFields to contain %#x, got %#x\n", setting_fields, dm.dmFields);
+                        "Expect dmFields to contain %#lx, got %#lx\n", setting_fields, dm.dmFields);
             }
             else
             {
-                ok((dm.dmFields & mode_fields) == mode_fields, "Expect dmFields to contain %#x, got %#x\n",
+                ok((dm.dmFields & mode_fields) == mode_fields, "Expect dmFields to contain %#lx, got %#lx\n",
                         mode_fields, dm.dmFields);
             }
 
-            ok(dm.dmDisplayOrientation == DMDO_DEFAULT, "Expect dmDisplayOrientation DMDO_DEFAULT, got %#x\n",
+            ok(dm.dmDisplayOrientation == DMDO_DEFAULT, "Expect dmDisplayOrientation DMDO_DEFAULT, got %#lx\n",
                     dm.dmDisplayOrientation);
             ok(dm.dmDisplayFlags == 0, "Expect dmDisplayFlags zero\n");
 
             if (mode == ENUM_CURRENT_SETTINGS && !attached)
             {
-                ok(dm.dmBitsPerPel == 0, "Expect dmBitsPerPel zero, got %u\n", dm.dmBitsPerPel);
-                ok(dm.dmPelsWidth == 0, "Expect dmPelsWidth zero, got %u\n", dm.dmPelsWidth);
-                ok(dm.dmPelsHeight == 0, "Expect dmPelsHeight zero, got %u\n", dm.dmPelsHeight);
-                ok(dm.dmDisplayFrequency == 0, "Expect dmDisplayFrequency zero, got %u\n", dm.dmDisplayFrequency);
+                ok(dm.dmBitsPerPel == 0, "Expect dmBitsPerPel zero, got %lu\n", dm.dmBitsPerPel);
+                ok(dm.dmPelsWidth == 0, "Expect dmPelsWidth zero, got %lu\n", dm.dmPelsWidth);
+                ok(dm.dmPelsHeight == 0, "Expect dmPelsHeight zero, got %lu\n", dm.dmPelsHeight);
+                ok(dm.dmDisplayFrequency == 0, "Expect dmDisplayFrequency zero, got %lu\n", dm.dmDisplayFrequency);
             }
             else if (mode != ENUM_REGISTRY_SETTINGS)
             {
@@ -3322,7 +3323,7 @@ static void test_EnumDisplaySettings(void)
         ok(err == ERROR_NO_MORE_FILES ||
                 err == ERROR_MOD_NOT_FOUND /* Win8 */ ||
                 err == 0xdeadbeef, /* XP, 2003 */
-                "Expected ERROR_NO_MORE_FILES, ERROR_MOD_NOT_FOUND or 0xdeadbeef, got %#x\n", err);
+                "Expected ERROR_NO_MORE_FILES, ERROR_MOD_NOT_FOUND or 0xdeadbeef, got %#lx\n", err);
     }
 }
 
@@ -3333,7 +3334,7 @@ static void test_GetSysColorBrush(void)
     SetLastError(0xdeadbeef);
     hbr = GetSysColorBrush(-1);
     ok(hbr == NULL, "Expected NULL brush\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %lx\n", GetLastError());
     /* greater than max index */
     hbr = GetSysColorBrush(COLOR_MENUBAR);
     if (hbr)
@@ -3341,7 +3342,7 @@ static void test_GetSysColorBrush(void)
         SetLastError(0xdeadbeef);
         hbr = GetSysColorBrush(COLOR_MENUBAR + 1);
         ok(hbr == NULL, "Expected NULL brush\n");
-        ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
+        ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %lx\n", GetLastError());
     }
     else
         win_skip("COLOR_MENUBAR unsupported\n");
@@ -3380,7 +3381,7 @@ static void test_dpi_stock_objects( HDC hdc )
             GetObjectW( obj[i], sizeof(lf), &lf );
             GetObjectW( obj2[i], sizeof(lf2), &lf2 );
             ok( lf.lfHeight == MulDiv( lf2.lfHeight, USER_DEFAULT_SCREEN_DPI, real_dpi ),
-                "%u: wrong height %d / %d\n", i, lf.lfHeight, lf2.lfHeight );
+                "%u: wrong height %ld / %ld\n", i, lf.lfHeight, lf2.lfHeight );
             break;
         default:
             ok( obj[i] == obj2[i], "%u: different object\n", i );
@@ -3452,15 +3453,15 @@ static void test_dpi_mapping(void)
         GetWindowRect( GetDesktopWindow(), &rect );
         expect = desktop;
         if (i == DPI_AWARENESS_UNAWARE) scale_rect_dpi( &expect, real_dpi, USER_DEFAULT_SCREEN_DPI );
-        ok( EqualRect( &expect, &rect ), "%lu: wrong desktop rect %s expected %s\n",
+        ok( EqualRect( &expect, &rect ), "%Iu: wrong desktop rect %s expected %s\n",
             i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
         SetRect( &rect, 0, 0, GetSystemMetrics( SM_CXSCREEN ), GetSystemMetrics( SM_CYSCREEN ));
-        ok( EqualRect( &expect, &rect ), "%lu: wrong desktop rect %s expected %s\n",
+        ok( EqualRect( &expect, &rect ), "%Iu: wrong desktop rect %s expected %s\n",
             i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
         if (monitor_count < 2)
         {
             SetRect( &rect, 0, 0, GetSystemMetrics( SM_CXVIRTUALSCREEN ), GetSystemMetrics( SM_CYVIRTUALSCREEN ));
-            ok( EqualRect( &expect, &rect ), "%lu: wrong virt desktop rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu: wrong virt desktop rect %s expected %s\n",
                 i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
         }
         SetRect( &rect, 0, 0, 1, 1 );
@@ -3468,15 +3469,15 @@ static void test_dpi_mapping(void)
         ok( monitor != 0, "failed to get monitor\n" );
         mon_info.cbSize = sizeof(mon_info);
         ok( GetMonitorInfoW( monitor, &mon_info ), "GetMonitorInfoExW failed\n" );
-        ok( EqualRect( &expect, &mon_info.rcMonitor ), "%lu: wrong monitor rect %s expected %s\n",
+        ok( EqualRect( &expect, &mon_info.rcMonitor ), "%Iu: wrong monitor rect %s expected %s\n",
             i, wine_dbgstr_rect(&mon_info.rcMonitor), wine_dbgstr_rect(&expect) );
         hdc = CreateDCA( "display", NULL, NULL, NULL );
         SetRect( &rect, 0, 0, GetDeviceCaps( hdc, HORZRES ), GetDeviceCaps( hdc, VERTRES ));
-        ok( EqualRect( &expect, &rect ), "%lu: wrong caps desktop rect %s expected %s\n",
+        ok( EqualRect( &expect, &rect ), "%Iu: wrong caps desktop rect %s expected %s\n",
             i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
         SetRect( &rect, 0, 0, GetDeviceCaps( hdc, DESKTOPHORZRES ), GetDeviceCaps( hdc, DESKTOPVERTRES ));
         todo_wine_if(monitor_count > 1)
-        ok( EqualRect( &desktop, &rect ), "%lu: wrong caps virt desktop rect %s expected %s\n",
+        ok( EqualRect( &desktop, &rect ), "%Iu: wrong caps virt desktop rect %s expected %s\n",
             i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&desktop) );
         DeleteDC( hdc );
         /* test message window rect */
@@ -3485,7 +3486,7 @@ static void test_dpi_mapping(void)
         GetWindowRect( GetAncestor( hwnd, GA_PARENT ), &rect );
         SetRect( &expect, 0, 0, 100, 100 );
         if (i == DPI_AWARENESS_UNAWARE) scale_rect_dpi( &expect, real_dpi, USER_DEFAULT_SCREEN_DPI );
-        ok( EqualRect( &expect, &rect ), "%lu: wrong message rect %s expected %s\n",
+        ok( EqualRect( &expect, &rect ), "%Iu: wrong message rect %s expected %s\n",
             i, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
         DestroyWindow( hwnd );
     }
@@ -3494,10 +3495,10 @@ static void test_dpi_mapping(void)
         pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
         hwnd = CreateWindowA( "SysParamsTestClass", "test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
                               193, 177, 295, 303, 0, 0, GetModuleHandleA(0), NULL );
-        ok( hwnd != 0, "creating window failed err %u\n", GetLastError());
+        ok( hwnd != 0, "creating window failed err %lu\n", GetLastError());
         child = CreateWindowA( "SysParamsTestClass", "child", WS_CHILD | WS_VISIBLE,
                                50, 60, 70, 80, hwnd, 0, GetModuleHandleA(0), NULL );
-        ok( child != 0, "creating child failed err %u\n", GetLastError());
+        ok( child != 0, "creating child failed err %lu\n", GetLastError());
         GetWindowRect( hwnd, &orig );
         SetRect( &rect, 0, 0, 0, 0 );
         pAdjustWindowRectExForDpi( &rect, WS_OVERLAPPEDWINDOW, FALSE, 0, pGetDpiForWindow( hwnd ));
@@ -3515,47 +3516,47 @@ static void test_dpi_mapping(void)
             GetWindowRect( hwnd, &rect );
             expect = orig;
             scale_rect_dpi_aware( &expect, i, j );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong window rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong window rect %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             /* test client rect */
             GetClientRect( hwnd, &rect );
             expect = client;
             OffsetRect( &expect, -expect.left, -expect.top );
             scale_rect_dpi_aware( &expect, i, j );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong client rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong client rect %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             /* test window placement */
             GetWindowPlacement( hwnd, &wpl );
             point = wpl_orig.ptMinPosition;
             if (point.x != -1 || point.y != -1) scale_point_dpi_aware( &point, i, j );
             ok( wpl.ptMinPosition.x == point.x && wpl.ptMinPosition.y == point.y,
-                "%lu/%lu: wrong placement min pos %d,%d expected %d,%d\n", i, j,
+                "%Iu/%Iu: wrong placement min pos %ld,%ld expected %ld,%ld\n", i, j,
                 wpl.ptMinPosition.x, wpl.ptMinPosition.y, point.x, point.y );
             point = wpl_orig.ptMaxPosition;
             if (point.x != -1 || point.y != -1) scale_point_dpi_aware( &point, i, j );
             ok( wpl.ptMaxPosition.x == point.x && wpl.ptMaxPosition.y == point.y,
-                "%lu/%lu: wrong placement max pos %d,%d expected %d,%d\n", i, j,
+                "%Iu/%Iu: wrong placement max pos %ld,%ld expected %ld,%ld\n", i, j,
                 wpl.ptMaxPosition.x, wpl.ptMaxPosition.y, point.x, point.y );
             expect = wpl_orig.rcNormalPosition;
             scale_rect_dpi_aware( &expect, i, j );
             ok( EqualRect( &wpl.rcNormalPosition, &expect ),
-                "%lu/%lu: wrong placement rect %s expect %s\n", i, j,
+                "%Iu/%Iu: wrong placement rect %s expect %s\n", i, j,
                 wine_dbgstr_rect(&wpl.rcNormalPosition), wine_dbgstr_rect(&expect));
             /* test DC rect */
             hdc = GetDC( hwnd );
             GetClipBox( hdc, &rect );
             SetRect( &expect, 0, 0, client.right - client.left, client.bottom - client.top );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong clip box %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong clip box %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             /* test DC resolution */
             SetRect( &rect, 0, 0, GetDeviceCaps( hdc, HORZRES ), GetDeviceCaps( hdc, VERTRES ));
             expect = desktop;
             if (j == DPI_AWARENESS_UNAWARE) scale_rect_dpi( &expect, real_dpi, USER_DEFAULT_SCREEN_DPI );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong DC resolution %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong DC resolution %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             SetRect( &rect, 0, 0, GetDeviceCaps( hdc, DESKTOPHORZRES ), GetDeviceCaps( hdc, DESKTOPVERTRES ));
             todo_wine_if(monitor_count > 1)
-            ok( EqualRect( &desktop, &rect ), "%lu/%lu: wrong desktop resolution %s expected %s\n",
+            ok( EqualRect( &desktop, &rect ), "%Iu/%Iu: wrong desktop resolution %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&desktop) );
             ReleaseDC( hwnd, hdc );
             /* test DC win rect */
@@ -3563,7 +3564,7 @@ static void test_dpi_mapping(void)
             GetClipBox( hdc, &rect );
             SetRect( &expect, 0, 0, 295, 303 );
             todo_wine
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong clip box win DC %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong clip box win DC %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             ReleaseDC( hwnd, hdc );
             /* test window invalidation */
@@ -3580,11 +3581,11 @@ static void test_dpi_mapping(void)
                 GetUpdateRgn( hwnd, update, FALSE );
                 GetRgnBox( update, &rect );
                 SetRect( &expect, 20, 20, 25, 25 );
-                ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update region %s expected %s\n",
+                ok( EqualRect( &expect, &rect ), "%Iu/%Iu/%Iu: wrong update region %s expected %s\n",
                     i, j, k, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
                 GetUpdateRect( hwnd, &rect, FALSE );
                 scale_rect_dpi_aware( &expect, i, j );
-                ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update rect %s expected %s\n",
+                ok( EqualRect( &expect, &rect ), "%Iu/%Iu/%Iu: wrong update rect %s expected %s\n",
                     i, j, k, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
                 UpdateWindow( hwnd );
             }
@@ -3596,11 +3597,11 @@ static void test_dpi_mapping(void)
                 pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~j );
                 GetRgnBox( update, &rect );
                 SetRect( &expect, 20, 20, 25, 25 );
-                ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update region %s expected %s\n",
+                ok( EqualRect( &expect, &rect ), "%Iu/%Iu/%Iu: wrong update region %s expected %s\n",
                     i, j, k, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
                 GetUpdateRect( hwnd, &rect, FALSE );
                 scale_rect_dpi_aware( &expect, i, j );
-                ok( EqualRect( &expect, &rect ), "%lu/%lu/%lu: wrong update rect %s expected %s\n",
+                ok( EqualRect( &expect, &rect ), "%Iu/%Iu/%Iu: wrong update rect %s expected %s\n",
                     i, j, k, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
                 UpdateWindow( hwnd );
             }
@@ -3615,11 +3616,11 @@ static void test_dpi_mapping(void)
             GetUpdateRgn( hwnd, update, TRUE );
             GetRgnBox( update, &rect );
             if (i == DPI_AWARENESS_UNAWARE) scale_rect_dpi( &expect, real_dpi, USER_DEFAULT_SCREEN_DPI );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong update region %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong update region %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             GetUpdateRect( hwnd, &rect, FALSE );
             scale_rect_dpi_aware( &expect, i, j );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong update rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong update rect %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             UpdateWindow( hwnd );
             DeleteObject( update );
@@ -3628,7 +3629,7 @@ static void test_dpi_mapping(void)
             point.x = LOWORD( units );
             point.y = HIWORD( units );
             scale_point_dpi_aware( &point, i, j );
-            ok( LOWORD(ret) == point.x && HIWORD(ret) == point.y, "%lu/%lu: wrong units %d,%d / %d,%d\n",
+            ok( LOWORD(ret) == point.x && HIWORD(ret) == point.y, "%Iu/%Iu: wrong units %d,%d / %ld,%ld\n",
                 i, j, LOWORD(ret), HIWORD(ret), point.x, point.y );
             /* test window points mapping */
             SetRect( &rect, 0, 0, 100, 100 );
@@ -3639,7 +3640,7 @@ static void test_dpi_mapping(void)
             scale_rect_dpi_aware( &expect, i, j );
             expect.right = expect.left + 100;
             expect.bottom = expect.top + 100;
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong MapWindowPoints rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong MapWindowPoints rect %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             SetRect( &rect, 50, 60, 70, 80 );
             scale_rect_dpi_aware( &rect, i, j );
@@ -3647,7 +3648,7 @@ static void test_dpi_mapping(void)
             OffsetRect( &expect, -rect.left, -rect.top );
             SetRect( &rect, 40, 30, 60, 80 );
             MapWindowPoints( hwnd, child, (POINT *)&rect, 2 );
-            ok( EqualRect( &expect, &rect ), "%lu/%lu: wrong MapWindowPoints child rect %s expected %s\n",
+            ok( EqualRect( &expect, &rect ), "%Iu/%Iu: wrong MapWindowPoints child rect %s expected %s\n",
                 i, j, wine_dbgstr_rect(&rect), wine_dbgstr_rect(&expect) );
             /* test logical<->physical coords mapping */
             win_dpi = pGetDpiForWindow( hwnd );
@@ -3658,42 +3659,42 @@ static void test_dpi_mapping(void)
             point.x = 373;
             point.y = 377;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
             ok( point.x == MulDiv( 373, real_dpi, win_dpi ) &&
                 point.y == MulDiv( 377, real_dpi, win_dpi ),
-                "%lu/%lu: wrong pos %d,%d dpi %u\n", i, j, point.x, point.y, win_dpi );
+                "%Iu/%Iu: wrong pos %ld,%ld dpi %u\n", i, j, point.x, point.y, win_dpi );
             point.x = 405;
             point.y = 423;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
             ok( point.x == MulDiv( 405, win_dpi, real_dpi ) &&
                 point.y == MulDiv( 423, win_dpi, real_dpi ),
-                "%lu/%lu: wrong pos %d,%d dpi %u\n", i, j, point.x, point.y, win_dpi );
+                "%Iu/%Iu: wrong pos %ld,%ld dpi %u\n", i, j, point.x, point.y, win_dpi );
             /* point outside the window fails, but note that Windows (wrongly) checks against the
              * window rect transformed relative to the thread's awareness */
             GetWindowRect( hwnd, &rect );
             point.x = rect.left - 1;
             point.y = rect.top;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x++;
             point.y--;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
             point.y++;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
             point.x = rect.right;
             point.y = rect.bottom + 1;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x++;
             point.y--;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x--;
             ret = pLogicalToPhysicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: LogicalToPhysicalPointForPerMonitorDPI failed\n", i, j );
             /* get physical window rect */
             pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
             GetWindowRect( hwnd, &rect );
@@ -3701,25 +3702,25 @@ static void test_dpi_mapping(void)
             point.x = rect.left - 1;
             point.y = rect.top;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x++;
             point.y--;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
             point.y++;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
             point.x = rect.right;
             point.y = rect.bottom + 1;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x++;
             point.y--;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( !ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
+            ok( !ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI succeeded\n", i, j );
             point.x--;
             ret = pPhysicalToLogicalPointForPerMonitorDPI( hwnd, &point );
-            ok( ret, "%lu/%lu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
+            ok( ret, "%Iu/%Iu: PhysicalToLogicalPointForPerMonitorDPI failed\n", i, j );
         }
         DestroyWindow( hwnd );
     }
@@ -3776,11 +3777,11 @@ static void test_dpi_context(void)
     SetLastError( 0xdeadbeef );
     ret = pSetProcessDpiAwarenessContext( NULL );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pSetProcessDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
     todo_wine
     ok( ret, "got %d\n", ret );
@@ -3789,18 +3790,18 @@ static void test_dpi_context(void)
     SetLastError( 0xdeadbeef );
     ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_SYSTEM_AWARE );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pSetProcessDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError() );
 
     ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_INVALID );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     ret = pSetProcessDpiAwarenessInternal( DPI_AWARENESS_UNAWARE );
     ok( !ret, "got %d\n", ret );
-    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_ACCESS_DENIED, "wrong error %lu\n", GetLastError() );
     ret = pGetProcessDpiAwarenessInternal( 0, &awareness );
     ok( ret, "got %d\n", ret );
     todo_wine
@@ -3824,11 +3825,11 @@ static void test_dpi_context(void)
     SetLastError( 0xdeadbeef );
     context = pSetThreadDpiAwarenessContext( 0 );
     ok( !context, "got %p\n", context );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     context = pSetThreadDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)-6 );
     ok( !context, "got %p\n", context );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     context = pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_UNAWARE );
     todo_wine
     ok( context == (DPI_AWARENESS_CONTEXT)(0x80000011 | flags), "wrong context %p\n", context );
@@ -3893,22 +3894,22 @@ static void test_dpi_context(void)
         {
         case 0x10:
             ok( awareness == DPI_AWARENESS_UNAWARE || awareness == DPI_AWARENESS_INVALID /* Win10 1709+ */,
-                "%lx: wrong value %u\n", i, awareness );
+                "%Ix: wrong value %u\n", i, awareness );
             break;
         case 0x11:
         case 0x12:
-            ok( awareness == (i & ~0x10), "%lx: wrong value %u\n", i, awareness );
+            ok( awareness == (i & ~0x10), "%Ix: wrong value %u\n", i, awareness );
             break;
         case 0x22:
             ok( awareness == DPI_AWARENESS_INVALID || awareness == DPI_AWARENESS_PER_MONITOR_AWARE /* Win10 1709+ */,
-                "%lx: wrong value %u\n", i, awareness );
+                "%Ix: wrong value %u\n", i, awareness );
             break;
         default:
-            ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", i, awareness );
+            ok( awareness == DPI_AWARENESS_INVALID, "%Ix: wrong value %u\n", i, awareness );
             break;
         }
         ret = pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)i );
-        ok( ret == (awareness != DPI_AWARENESS_INVALID), "%lx: expected %d, got %d\n",
+        ok( ret == (awareness != DPI_AWARENESS_INVALID), "%Ix: expected %d, got %d\n",
             i, (awareness != DPI_AWARENESS_INVALID), ret );
 
         awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(i | 0x80000000) );
@@ -3916,22 +3917,22 @@ static void test_dpi_context(void)
         {
         case 0x10:
             ok( awareness == DPI_AWARENESS_UNAWARE || awareness == DPI_AWARENESS_INVALID /* Win10 1709+ */,
-                "%lx: wrong value %u\n", i | 0x80000000, awareness );
+                "%Ix: wrong value %u\n", i | 0x80000000, awareness );
             break;
         case 0x11:
         case 0x12:
-            ok( awareness == (i & ~0x10), "%lx: wrong value %u\n", i | 0x80000000, awareness );
+            ok( awareness == (i & ~0x10), "%Ix: wrong value %u\n", i | 0x80000000, awareness );
             break;
         case 0x22:
             ok( awareness == DPI_AWARENESS_INVALID || awareness == DPI_AWARENESS_PER_MONITOR_AWARE /* Win10 1709+ */,
-                "%lx: wrong value %u\n", i, awareness );
+                "%Ix: wrong value %u\n", i, awareness );
             break;
         default:
-            ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", i | 0x80000000, awareness );
+            ok( awareness == DPI_AWARENESS_INVALID, "%Ix: wrong value %u\n", i | 0x80000000, awareness );
             break;
         }
         ret = pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)(i | 0x80000000) );
-        ok( ret == (awareness != DPI_AWARENESS_INVALID), "%lx: expected %d, got %d\n",
+        ok( ret == (awareness != DPI_AWARENESS_INVALID), "%Ix: expected %d, got %d\n",
             (i | 0x80000000), (awareness != DPI_AWARENESS_INVALID), ret );
 
         awareness = pGetAwarenessFromDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i );
@@ -3940,24 +3941,24 @@ static void test_dpi_context(void)
         case (ULONG_PTR)DPI_AWARENESS_CONTEXT_UNAWARE:
         case (ULONG_PTR)DPI_AWARENESS_CONTEXT_SYSTEM_AWARE:
         case (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE:
-            ok( awareness == i, "%lx: wrong value %u\n", ~i, awareness );
-            ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: not valid\n", ~i );
+            ok( awareness == i, "%Ix: wrong value %u\n", ~i, awareness );
+            ok( pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%Ix: not valid\n", ~i );
             break;
         case (ULONG_PTR)DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2:
             if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
-                ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "%lx: wrong value %u\n", ~i, awareness );
+                ok( awareness == DPI_AWARENESS_PER_MONITOR_AWARE, "%Ix: wrong value %u\n", ~i, awareness );
             else
-                ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
+                ok( awareness == DPI_AWARENESS_INVALID, "%Ix: wrong value %u\n", ~i, awareness );
             break;
         case (ULONG_PTR)DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED:
             if (pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ))
-                ok( awareness == DPI_AWARENESS_UNAWARE, "%lx: wrong value %u\n", ~i, awareness );
+                ok( awareness == DPI_AWARENESS_UNAWARE, "%Ix: wrong value %u\n", ~i, awareness );
             else
-                ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
+                ok( awareness == DPI_AWARENESS_INVALID, "%Ix: wrong value %u\n", ~i, awareness );
             break;
         default:
-            ok( awareness == DPI_AWARENESS_INVALID, "%lx: wrong value %u\n", ~i, awareness );
-            ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%lx: valid\n", ~i );
+            ok( awareness == DPI_AWARENESS_INVALID, "%Ix: wrong value %u\n", ~i, awareness );
+            ok( !pIsValidDpiAwarenessContext( (DPI_AWARENESS_CONTEXT)~i ), "%Ix: valid\n", ~i );
             break;
         }
     }
@@ -3977,7 +3978,7 @@ static LRESULT CALLBACK dpi_winproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
     pos = GetMessagePos();
     pSetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE );
     pos2 = GetMessagePos();
-    ok( pos == pos2, "wrong pos %08x / %08x\n", pos, pos2 );
+    ok( pos == pos2, "wrong pos %08lx / %08lx\n", pos, pos2 );
     pSetThreadDpiAwarenessContext( ctx2 );
     return DefWindowProcA( hwnd, msg, wp, lp );
 }
@@ -4005,29 +4006,29 @@ static void test_dpi_window(void)
         ok( hwnd != 0, "failed to create window\n" );
         context = pGetWindowDpiAwarenessContext( hwnd );
         awareness = pGetAwarenessFromDpiAwarenessContext( context );
-        ok( awareness == i, "%lu: wrong awareness %u\n", i, awareness );
+        ok( awareness == i, "%Iu: wrong awareness %u\n", i, awareness );
         dpi = pGetDpiForWindow( hwnd );
         ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-            "%lu: got %u / %u\n", i, dpi, real_dpi );
+            "%Iu: got %u / %u\n", i, dpi, real_dpi );
         if (pGetDpiForMonitorInternal)
         {
             BOOL res;
             SetLastError( 0xdeadbeef );
             res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 0, &dpi, NULL );
             ok( !res, "succeeded\n" );
-            ok( GetLastError() == ERROR_INVALID_ADDRESS, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_INVALID_ADDRESS, "wrong error %lu\n", GetLastError() );
             SetLastError( 0xdeadbeef );
             res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 3, &dpi, &dpi );
             ok( !res, "succeeded\n" );
-            ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %lu\n", GetLastError() );
             SetLastError( 0xdeadbeef );
             res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 3, &dpi, NULL );
             ok( !res, "succeeded\n" );
-            ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_BAD_ARGUMENTS, "wrong error %lu\n", GetLastError() );
             res = pGetDpiForMonitorInternal( MonitorFromWindow( hwnd, 0 ), 0, &dpi, &dpi );
-            ok( res, "failed err %u\n", GetLastError() );
+            ok( res, "failed err %lu\n", GetLastError() );
             ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-                "%lu: got %u / %u\n", i, dpi, real_dpi );
+                "%Iu: got %u / %u\n", i, dpi, real_dpi );
         }
         msg.hwnd = hwnd;
         for (j = DPI_AWARENESS_UNAWARE; j <= DPI_AWARENESS_PER_MONITOR_AWARE; j++)
@@ -4040,36 +4041,36 @@ static void test_dpi_window(void)
                                    WS_CHILD, 0, 0, 100, 100, hwnd, 0, GetModuleHandleA(0), NULL );
             context = pGetWindowDpiAwarenessContext( child );
             awareness = pGetAwarenessFromDpiAwarenessContext( context );
-            ok( awareness == i, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
+            ok( awareness == i, "%Iu/%Iu: wrong awareness %u\n", i, j, awareness );
             dpi = pGetDpiForWindow( child );
             ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-                "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
+                "%Iu/%Iu: got %u / %u\n", i, j, dpi, real_dpi );
             ret = SetParent( child, NULL );
-            ok( ret != 0, "SetParent failed err %u\n", GetLastError() );
+            ok( ret != 0, "SetParent failed err %lu\n", GetLastError() );
             context = pGetWindowDpiAwarenessContext( child );
             awareness = pGetAwarenessFromDpiAwarenessContext( context );
-            ok( awareness == i, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
+            ok( awareness == i, "%Iu/%Iu: wrong awareness %u\n", i, j, awareness );
             dpi = pGetDpiForWindow( child );
             ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-                "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
+                "%Iu/%Iu: got %u / %u\n", i, j, dpi, real_dpi );
             DestroyWindow( child );
             child = CreateWindowA( "DpiTestClass", "Test",
                                    WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
             context = pGetWindowDpiAwarenessContext( child );
             awareness = pGetAwarenessFromDpiAwarenessContext( context );
-            ok( awareness == j, "%lu/%lu: wrong awareness %u\n", i, j, awareness );
+            ok( awareness == j, "%Iu/%Iu: wrong awareness %u\n", i, j, awareness );
             dpi = pGetDpiForWindow( child );
             ok( dpi == (j == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-                "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
+                "%Iu/%Iu: got %u / %u\n", i, j, dpi, real_dpi );
             ret = SetParent( child, hwnd );
             ok( ret != 0 || GetLastError() == ERROR_INVALID_STATE,
-                "SetParent failed err %u\n", GetLastError() );
+                "SetParent failed err %lu\n", GetLastError() );
             context = pGetWindowDpiAwarenessContext( child );
             awareness = pGetAwarenessFromDpiAwarenessContext( context );
-            ok( awareness == (ret ? i : j), "%lu/%lu: wrong awareness %u\n", i, j, awareness );
+            ok( awareness == (ret ? i : j), "%Iu/%Iu: wrong awareness %u\n", i, j, awareness );
             dpi = pGetDpiForWindow( child );
             ok( dpi == (i == DPI_AWARENESS_UNAWARE ? USER_DEFAULT_SCREEN_DPI : real_dpi),
-                "%lu/%lu: got %u / %u\n", i, j, dpi, real_dpi );
+                "%Iu/%Iu: got %u / %u\n", i, j, dpi, real_dpi );
             DestroyWindow( child );
         }
         DestroyWindow( hwnd );
@@ -4078,12 +4079,12 @@ static void test_dpi_window(void)
     SetLastError( 0xdeadbeef );
     context = pGetWindowDpiAwarenessContext( (HWND)0xdeadbeef );
     ok( !context, "got %p\n", context );
-    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_WINDOW_HANDLE, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     dpi = pGetDpiForWindow( (HWND)0xdeadbeef );
     ok( !dpi, "got %u\n", dpi );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INVALID_WINDOW_HANDLE,
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     context = pGetWindowDpiAwarenessContext( GetDesktopWindow() );
@@ -4117,11 +4118,11 @@ static void test_GetAutoRotationState(void)
     SetLastError(0xdeadbeef);
     ret = pGetAutoRotationState(NULL);
     ok(!ret, "Expected GetAutoRotationState to fail\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     state = 0;
     ret = pGetAutoRotationState(&state);
-    ok(ret, "Expected GetAutoRotationState to succeed, error %d\n", GetLastError());
+    ok(ret, "Expected GetAutoRotationState to succeed, error %ld\n", GetLastError());
 }
 
 START_TEST(sysparams)
diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c
index 359721fcd91..9db3d558adf 100644
--- a/dlls/user32/tests/text.c
+++ b/dlls/user32/tests/text.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /*
  * DrawText tests
  *
@@ -55,9 +56,9 @@ static void test_DrawTextCalcRect(void)
     /* Initialization */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
     hdc = GetDC(hwnd);
-    ok(hdc != 0, "GetDC error %u\n", GetLastError());
+    ok(hdc != 0, "GetDC error %lu\n", GetLastError());
     trace("hdc %p\n", hdc);
     textlen = lstrlenA(text);
 
@@ -74,23 +75,23 @@ static void test_DrawTextCalcRect(void)
     SetMapMode(hdc, MM_HIENGLISH);
     lf.lfHeight = 100 * 9 / 72; /* 9 point */
     hFont = CreateFontIndirectA(&lf);
-    ok(hFont != 0, "CreateFontIndirectA error %u\n",
+    ok(hFont != 0, "CreateFontIndirectA error %lu\n",
        GetLastError());
     hOldFont = SelectObject(hdc, hFont);
 
     textheight = DrawTextA(hdc, text, textlen, &rect, DT_CALCRECT |
        DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
        DT_NOPREFIX);
-    ok( textheight, "DrawTextA error %u\n", GetLastError());
+    ok( textheight, "DrawTextA error %lu\n", GetLastError());
 
-    trace("MM_HIENGLISH rect.bottom %d\n", rect.bottom);
+    trace("MM_HIENGLISH rect.bottom %ld\n", rect.bottom);
     ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with "
        "DT_CALCRECT should return a negative rectangle bottom. "
-       "(bot=%d)\n", rect.bottom);
+       "(bot=%ld)\n", rect.bottom);
 
     SelectObject(hdc, hOldFont);
     ret = DeleteObject(hFont);
-    ok( ret, "DeleteObject error %u\n", GetLastError());
+    ok( ret, "DeleteObject error %lu\n", GetLastError());
 
 
     /* DrawText in MM_TEXT with DT_CALCRECT */
@@ -98,18 +99,18 @@ static void test_DrawTextCalcRect(void)
     lf.lfHeight = -MulDiv(9, GetDeviceCaps(hdc,
        LOGPIXELSY), 72); /* 9 point */
     hFont = CreateFontIndirectA(&lf);
-    ok(hFont != 0, "CreateFontIndirectA error %u\n",
+    ok(hFont != 0, "CreateFontIndirectA error %lu\n",
        GetLastError());
     hOldFont = SelectObject(hdc, hFont);
 
     textheight = DrawTextA(hdc, text, textlen, &rect, DT_CALCRECT |
        DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
        DT_NOPREFIX);
-    ok( textheight, "DrawTextA error %u\n", GetLastError());
+    ok( textheight, "DrawTextA error %lu\n", GetLastError());
 
-    trace("MM_TEXT rect.bottom %d\n", rect.bottom);
+    trace("MM_TEXT rect.bottom %ld\n", rect.bottom);
     ok(rect.bottom > 0, "In MM_TEXT, DrawText with DT_CALCRECT "
-       "should return a positive rectangle bottom. (bot=%d)\n",
+       "should return a positive rectangle bottom. (bot=%ld)\n",
        rect.bottom);
 
     /* empty or null text should in some cases calc an empty rectangle */
@@ -326,12 +327,12 @@ static void test_DrawTextCalcRect(void)
     dtp.iLeftMargin = 8;
     SetRectEmpty(&rect);
     DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
-    ok(rect.right==dtp.iLeftMargin+textlen  ,"Incorrect left margin calculated  rc(%d,%d)\n", rect.left, rect.right);
+    ok(rect.right==dtp.iLeftMargin+textlen  ,"Incorrect left margin calculated  rc(%ld,%ld)\n", rect.left, rect.right);
     dtp.iLeftMargin = 0;
     dtp.iRightMargin = 8;
     SetRectEmpty(&rect);
     DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
-    ok(rect.right==dtp.iRightMargin+textlen  ,"Incorrect right margin calculated rc(%d,%d)\n", rect.left, rect.right);
+    ok(rect.right==dtp.iRightMargin+textlen  ,"Incorrect right margin calculated rc(%ld,%ld)\n", rect.left, rect.right);
 
     /* Wide char versions */
     SetRect( &rect, 10,10, 100, 100);
@@ -524,10 +525,10 @@ static void test_DrawTextCalcRect(void)
     /* More test cases from bug 12226 */
     SetRectEmpty(&rect);
     textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
-    ok(textheight, "DrawTextA error %u\n", GetLastError());
-    ok(0 == rect.left, "expected 0, got %d\n", rect.left);
-    ok(0 == rect.right, "expected 0, got %d\n", rect.right);
-    ok(0 == rect.top, "expected 0, got %d\n", rect.top);
+    ok(textheight, "DrawTextA error %lu\n", GetLastError());
+    ok(0 == rect.left, "expected 0, got %ld\n", rect.left);
+    ok(0 == rect.right, "expected 0, got %ld\n", rect.right);
+    ok(0 == rect.top, "expected 0, got %ld\n", rect.top);
     ok(rect.bottom, "rect.bottom should not be 0\n");
 
     SetRectEmpty(&rect);
@@ -538,10 +539,10 @@ static void test_DrawTextCalcRect(void)
     }
     else
     {
-        ok(textheight, "DrawTextW error %u\n", GetLastError());
-        ok(0 == rect.left, "expected 0, got %d\n", rect.left);
-        ok(0 == rect.right, "expected 0, got %d\n", rect.right);
-        ok(0 == rect.top, "expected 0, got %d\n", rect.top);
+        ok(textheight, "DrawTextW error %lu\n", GetLastError());
+        ok(0 == rect.left, "expected 0, got %ld\n", rect.left);
+        ok(0 == rect.right, "expected 0, got %ld\n", rect.right);
+        ok(0 == rect.top, "expected 0, got %ld\n", rect.top);
         ok(rect.bottom, "rect.bottom should not be 0\n");
     }
 
@@ -595,22 +596,22 @@ static void test_DrawTextCalcRect(void)
     textheight = DrawTextExA(hdc, tabstring, -1, &rect, DT_CALCRECT | DT_TABSTOP | DT_EXPANDTABS, &dtp);
     ok(textheight >= heightcheck, "Got unexpected textheight %d\n", textheight);
     ok(dtp.iTabLength == 8, "invalid dtp.iTabLength = %i\n",dtp.iTabLength);
-    ok(rect.left == rect2.left, "unexpected value %d, got %d\n", rect.left, rect2.left);
+    ok(rect.left == rect2.left, "unexpected value %ld, got %ld\n", rect.left, rect2.left);
     /* XP, 2003 appear to not give the same values. */
-    ok(rect.right == rect2.right || broken(rect.right > rect2.right), "unexpected value %d, got %d\n",rect.right, rect2.right);
-    ok(rect.top == rect2.top, "unexpected value %d, got %d\n", rect.top, rect2.top);
-    ok(rect.bottom == rect2.bottom , "unexpected value %d, got %d\n", rect.bottom, rect2.bottom);
+    ok(rect.right == rect2.right || broken(rect.right > rect2.right), "unexpected value %ld, got %ld\n",rect.right, rect2.right);
+    ok(rect.top == rect2.top, "unexpected value %ld, got %ld\n", rect.top, rect2.top);
+    ok(rect.bottom == rect2.bottom , "unexpected value %ld, got %ld\n", rect.bottom, rect2.bottom);
 
 
     SelectObject(hdc, hOldFont);
     ret = DeleteObject(hFont);
-    ok( ret, "DeleteObject error %u\n", GetLastError());
+    ok( ret, "DeleteObject error %lu\n", GetLastError());
 
     /* Clean up */
     ret = ReleaseDC(hwnd, hdc);
-    ok( ret, "ReleaseDC error %u\n", GetLastError());
+    ok( ret, "ReleaseDC error %lu\n", GetLastError());
     ret = DestroyWindow(hwnd);
-    ok( ret, "DestroyWindow error %u\n", GetLastError());
+    ok( ret, "DestroyWindow error %lu\n", GetLastError());
 }
 
 /* replace tabs by \t */
@@ -631,7 +632,7 @@ static void strfmt( const char *str, char *strout)
     extent = GetTabbedTextExtentA( hdc, string, strlen( string), (tabcount), tabs); \
     strfmt( string, strdisp); \
  /*   trace( "Extent is %08lx\n", extent); */\
-    ok( extent == _exp, "Test case \"%s\". Text extent is 0x%x, expected 0x%x tab %d tabcount %d\n", \
+    ok( extent == _exp, "Test case \"%s\". Text extent is 0x%lx, expected 0x%lx tab %d tabcount %d\n", \
         strdisp, extent, _exp, tabval, tabcount); \
 } \
 
@@ -648,12 +649,12 @@ static void test_TabbedText(void)
     /* Initialization */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
     hdc = GetDC(hwnd);
-    ok(hdc != 0, "GetDC error %u\n", GetLastError());
+    ok(hdc != 0, "GetDC error %lu\n", GetLastError());
 
     ret = GetTextMetricsA( hdc, &tm);
-    ok( ret, "GetTextMetrics error %u\n", GetLastError());
+    ok( ret, "GetTextMetrics error %lu\n", GetLastError());
 
     extent = GetTabbedTextExtentA( hdc, "x", 0, 1, tabs);
     ok( extent == 0, "GetTabbedTextExtentA returned non-zero on nCount == 0\n");
@@ -721,24 +722,24 @@ static void test_DrawState(void)
     SetLastError(0xdeadbeef);
     ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, (LPARAM)text, strlen(text),
                     0, 0, 10, 10, DST_TEXT);
-    ok(ret, "DrawState error %u\n", GetLastError());
+    ok(ret, "DrawState error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, (LPARAM)text, 0,
                     0, 0, 10, 10, DST_TEXT);
-    ok(ret, "DrawState error %u\n", GetLastError());
+    ok(ret, "DrawState error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, 0, strlen(text),
                     0, 0, 10, 10, DST_TEXT);
     ok(!ret || broken(ret) /* win98 */, "DrawState succeeded\n");
-    ok(GetLastError() == 0xdeadbeef, "not expected error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "not expected error %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, 0, 0,
                     0, 0, 10, 10, DST_TEXT);
     ok(!ret || broken(ret) /* win98 */, "DrawState succeeded\n");
-    ok(GetLastError() == 0xdeadbeef, "not expected error %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "not expected error %lu\n", GetLastError());
 
     ReleaseDC(hwnd, hdc);
     DestroyWindow(hwnd);
diff --git a/dlls/user32/tests/uitools.c b/dlls/user32/tests/uitools.c
index 07cf776a952..3b4ab010e44 100644
--- a/dlls/user32/tests/uitools.c
+++ b/dlls/user32/tests/uitools.c
@@ -1,3 +1,4 @@
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
 /* Unit test suite for user interface functions
  *
  * Copyright 2009 Nikolay Sivov
@@ -46,7 +47,7 @@ static void test_FillRect(void)
     oldhbmp = SelectObject(hdcmem, hbmp);
     ok(oldhbmp != NULL, "SelectObject returned NULL\n"); /* a memdc always has a bitmap selected */
     col = GetPixel(hdcmem, 0, 0);
-    ok( col == 0xffffff, "GetPixel returned %08x, expected 0xffffff\n", col);
+    ok( col == 0xffffff, "GetPixel returned %08lx, expected 0xffffff\n", col);
 
     /* select black brush */
     old_brush = SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
@@ -55,7 +56,7 @@ static void test_FillRect(void)
     SelectObject(hdcmem, old_brush);
     /* bitmap filled with last selected brush */
     col = GetPixel(hdcmem, 0, 0);
-    ok(col == 0, "GetPixel returned %08x, expected 0\n", col);
+    ok(col == 0, "GetPixel returned %08lx, expected 0\n", col);
 
     SelectObject(hdcmem, oldhbmp);
     DeleteObject(hbmp);




More information about the wine-devel mailing list