[PATCH 05/27] dlls/gdi32/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Mon Feb 28 01:25:44 CST 2022


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

---
 dlls/gdi32/tests/Makefile.in |    1 
 dlls/gdi32/tests/bitmap.c    |  836 +++++++++++++++++++--------------------
 dlls/gdi32/tests/brush.c     |   56 +--
 dlls/gdi32/tests/clipping.c  |   40 +-
 dlls/gdi32/tests/dc.c        |   80 ++--
 dlls/gdi32/tests/dib.c       |   90 ++--
 dlls/gdi32/tests/driver.c    |  154 ++++---
 dlls/gdi32/tests/font.c      |  618 ++++++++++++++--------------
 dlls/gdi32/tests/gdiobj.c    |   62 +--
 dlls/gdi32/tests/icm.c       |   52 +-
 dlls/gdi32/tests/mapping.c   |  132 +++---
 dlls/gdi32/tests/metafile.c  |  912 +++++++++++++++++++++---------------------
 dlls/gdi32/tests/palette.c   |    6 
 dlls/gdi32/tests/path.c      |  114 +++--
 dlls/gdi32/tests/pen.c       |  244 ++++++-----
 15 files changed, 1703 insertions(+), 1694 deletions(-)

diff --git a/dlls/gdi32/tests/Makefile.in b/dlls/gdi32/tests/Makefile.in
index c693ca4117f..3eb478ff765 100644
--- a/dlls/gdi32/tests/Makefile.in
+++ b/dlls/gdi32/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = gdi32.dll
 IMPORTS   = setupapi user32 gdi32 advapi32
 
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 3e1ed7f7652..18d1e8f6c28 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -250,7 +250,7 @@ static void test_createdibitmap(void)
     pixel = 0xdeadbeef;
     bm.bmiHeader.biBitCount= 32;
     GetDIBits(hdc, hbm, 0, 1, &pixel, &bm, DIB_RGB_COLORS);
-    ok(pixel == 0x00ffffff, "Reading a 32 bit pixel from a DDB returned %08x\n", pixel);
+    ok(pixel == 0x00ffffff, "Reading a 32 bit pixel from a DDB returned %08lx\n", pixel);
     DeleteObject(hbm);
 
     ReleaseDC(0, hdc);
@@ -325,28 +325,28 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
 
     ok(ds.dsBm.bmBits == bits, "wrong bm.bmBits %p != %p\n", ds.dsBm.bmBits, bits);
     if (ds.dsBm.bmWidthBytes != bm_width_bytes) /* Win2k bug */
-        ok(ds.dsBmih.biSizeImage == ds.dsBm.bmWidthBytes * ds.dsBm.bmHeight, "%u != %u\n",
+        ok(ds.dsBmih.biSizeImage == ds.dsBm.bmWidthBytes * ds.dsBm.bmHeight, "%lu != %u\n",
            ds.dsBmih.biSizeImage, ds.dsBm.bmWidthBytes * ds.dsBm.bmHeight);
-    ok(bmih->biSizeImage == 0, "%u != 0\n", bmih->biSizeImage);
+    ok(bmih->biSizeImage == 0, "%lu != 0\n", bmih->biSizeImage);
     ds.dsBmih.biSizeImage = 0;
 
-    ok(ds.dsBmih.biSize == bmih->biSize, "%u != %u\n", ds.dsBmih.biSize, bmih->biSize);
-    ok(ds.dsBmih.biWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
-    ok(ds.dsBmih.biHeight == abs(bmih->biHeight), "%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
+    ok(ds.dsBmih.biSize == bmih->biSize, "%lu != %lu\n", ds.dsBmih.biSize, bmih->biSize);
+    ok(ds.dsBmih.biWidth == bmih->biWidth, "%ld != %ld\n", ds.dsBmih.biWidth, bmih->biWidth);
+    ok(ds.dsBmih.biHeight == abs(bmih->biHeight), "%ld != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
     ok(ds.dsBmih.biPlanes == bmih->biPlanes, "%u != %u\n", ds.dsBmih.biPlanes, bmih->biPlanes);
     ok(ds.dsBmih.biBitCount == bmih->biBitCount, "%u != %u\n", ds.dsBmih.biBitCount, bmih->biBitCount);
     ok(ds.dsBmih.biCompression == bmih->biCompression ||
        ((bmih->biBitCount == 32) && broken(ds.dsBmih.biCompression == BI_BITFIELDS)), /* nt4 sp1 and 2 */
-       "%u != %u\n", ds.dsBmih.biCompression, bmih->biCompression);
-    ok(ds.dsBmih.biSizeImage == bmih->biSizeImage, "%u != %u\n", ds.dsBmih.biSizeImage, bmih->biSizeImage);
-    ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%d != %d\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
-    ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%d != %d\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
+       "%lu != %lu\n", ds.dsBmih.biCompression, bmih->biCompression);
+    ok(ds.dsBmih.biSizeImage == bmih->biSizeImage, "%lu != %lu\n", ds.dsBmih.biSizeImage, bmih->biSizeImage);
+    ok(ds.dsBmih.biXPelsPerMeter == bmih->biXPelsPerMeter, "%ld != %ld\n", ds.dsBmih.biXPelsPerMeter, bmih->biXPelsPerMeter);
+    ok(ds.dsBmih.biYPelsPerMeter == bmih->biYPelsPerMeter, "%ld != %ld\n", ds.dsBmih.biYPelsPerMeter, bmih->biYPelsPerMeter);
 
     memset(&ds, 0xAA, sizeof(ds));
     ret = GetObjectW(hbm, sizeof(ds) - 4, &ds);
     ok(ret == sizeof(ds.dsBm), "wrong size %d\n", ret);
-    ok(ds.dsBm.bmWidth == bmih->biWidth, "%d != %d\n", ds.dsBmih.biWidth, bmih->biWidth);
-    ok(ds.dsBm.bmHeight == abs(bmih->biHeight), "%d != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
+    ok(ds.dsBm.bmWidth == bmih->biWidth, "%ld != %ld\n", ds.dsBmih.biWidth, bmih->biWidth);
+    ok(ds.dsBm.bmHeight == abs(bmih->biHeight), "%ld != %d\n", ds.dsBmih.biHeight, abs(bmih->biHeight));
     ok(ds.dsBm.bmBits == bits, "%p != %p\n", ds.dsBm.bmBits, bits);
 
     ret = GetObjectW(hbm, 0, &ds);
@@ -360,11 +360,11 @@ static void _test_color( int line, HDC hdc, COLORREF color, COLORREF exp )
 {
     COLORREF c;
     c = SetPixel(hdc, 0, 0, color);
-    ok_(__FILE__, line)(c == exp, "SetPixel failed: got 0x%06x expected 0x%06x\n", c, exp);
+    ok_(__FILE__, line)(c == exp, "SetPixel failed: got 0x%06lx expected 0x%06lx\n", c, exp);
     c = GetPixel(hdc, 0, 0);
-    ok_(__FILE__, line)(c == exp, "GetPixel failed: got 0x%06x expected 0x%06x\n", c, exp);
+    ok_(__FILE__, line)(c == exp, "GetPixel failed: got 0x%06lx expected 0x%06lx\n", c, exp);
     c = GetNearestColor(hdc, color);
-    ok_(__FILE__, line)(c == exp, "GetNearestColor failed: got 0x%06x expected 0x%06x\n", c, exp);
+    ok_(__FILE__, line)(c == exp, "GetNearestColor failed: got 0x%06lx expected 0x%06lx\n", c, exp);
 }
 #define test_color(hdc, color, exp) _test_color( __LINE__, hdc, color, exp )
 
@@ -385,10 +385,10 @@ static void test_dib_bits_access( HBITMAP hdib, void *bits )
         "VirtualQuery failed\n");
     ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
     ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
-    ok(info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect);
-    ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
-    ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
-    ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
+    ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+    ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+    ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
+    ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
 
     memset( pbmi, 0, sizeof(bmibuf) );
     memset( data, 0xcc, sizeof(data) );
@@ -410,20 +410,20 @@ static void test_dib_bits_access( HBITMAP hdib, void *bits )
         "VirtualQuery failed\n");
     ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
     ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
-    ok(info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect);
-    ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
-    ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
-    ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
+    ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+    ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+    ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
+    ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
 
     /* try writing protected bits to a file */
 
     GetTempFileNameA( ".", "dib", 0, filename );
     file = CreateFileA( filename, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
                         CREATE_ALWAYS, 0, 0 );
-    ok( file != INVALID_HANDLE_VALUE, "failed to open %s error %u\n", filename, GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "failed to open %s error %lu\n", filename, GetLastError() );
     ret = WriteFile( file, bits, 8192, &written, NULL );
-    ok( ret, "WriteFile failed error %u\n", GetLastError() );
-    if (ret) ok( written == 8192, "only wrote %u bytes\n", written );
+    ok( ret, "WriteFile failed error %lu\n", GetLastError() );
+    if (ret) ok( written == 8192, "only wrote %lu bytes\n", written );
     CloseHandle( file );
     DeleteFileA( filename );
 }
@@ -473,7 +473,7 @@ static void test_dibsections(void)
     ok(hdib == NULL && bits == NULL, "CreateDIBSection failed for invalid parameter: bmi == 0x0\n");
 
     hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIBSection\n");
     ok(dibsec.dsBm.bmBits == bits, "dibsec.dsBits %p != bits %p\n", dibsec.dsBm.bmBits, bits);
 
@@ -482,11 +482,11 @@ static void test_dibsections(void)
         "VirtualQuery failed\n");
     ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
     ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
-    ok(info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect);
-    ok(info.RegionSize == 0x26000, "0x%lx != 0x26000\n", info.RegionSize);
-    ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
-    ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
-    ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
+    ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+    ok(info.RegionSize == 0x26000, "0x%Ix != 0x26000\n", info.RegionSize);
+    ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+    ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
+    ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
 
     test_dib_bits_access( hdib, bits );
 
@@ -496,7 +496,7 @@ static void test_dibsections(void)
     /* Test a top-down DIB. */
     pbmi->bmiHeader.biHeight = -100;
     hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
     DeleteObject(hdib);
 
@@ -506,7 +506,7 @@ static void test_dibsections(void)
     SetLastError(0xdeadbeef);
     hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(hdib == NULL, "CreateDIBSection should fail when asked to create a compressed DIB section\n");
-    ok(GetLastError() == 0xdeadbeef, "wrong error %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "wrong error %ld\n", GetLastError());
 
     pbmi->bmiHeader.biBitCount = 16;
     pbmi->bmiHeader.biCompression = BI_BITFIELDS;
@@ -515,18 +515,18 @@ static void test_dibsections(void)
     ((PDWORD)pbmi->bmiColors)[2] = 0x001f;
     SetLastError(0xdeadbeef);
     hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
 
     /* test the DIB memory */
     ok(VirtualQuery(bits, &info, sizeof(info)) == sizeof(info),
         "VirtualQuery failed\n");
     ok(info.BaseAddress == bits, "%p != %p\n", info.BaseAddress, bits);
     ok(info.AllocationBase == bits, "%p != %p\n", info.AllocationBase, bits);
-    ok(info.AllocationProtect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.AllocationProtect);
-    ok(info.RegionSize == 0x19000, "0x%lx != 0x19000\n", info.RegionSize);
-    ok(info.State == MEM_COMMIT, "%x != MEM_COMMIT\n", info.State);
-    ok(info.Protect == PAGE_READWRITE, "%x != PAGE_READWRITE\n", info.Protect);
-    ok(info.Type == MEM_PRIVATE, "%x != MEM_PRIVATE\n", info.Type);
+    ok(info.AllocationProtect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.AllocationProtect);
+    ok(info.RegionSize == 0x19000, "0x%Ix != 0x19000\n", info.RegionSize);
+    ok(info.State == MEM_COMMIT, "%lx != MEM_COMMIT\n", info.State);
+    ok(info.Protect == PAGE_READWRITE, "%lx != PAGE_READWRITE\n", info.Protect);
+    ok(info.Type == MEM_PRIVATE, "%lx != MEM_PRIVATE\n", info.Type);
 
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
     DeleteObject(hdib);
@@ -549,7 +549,7 @@ static void test_dibsections(void)
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIBSection\n");
     ok(dibsec.dsBmih.biClrUsed == 2,
-        "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 2);
+        "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 2);
 
     /* Test if the old BITMAPCOREINFO structure is supported */
 
@@ -645,7 +645,7 @@ static void test_dibsections(void)
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
     ok(dibsec.dsBmih.biClrUsed == 16,
-       "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 16);
+       "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 16);
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
     DeleteObject(hdib);
 
@@ -663,7 +663,7 @@ static void test_dibsections(void)
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
     ok(dibsec.dsBmih.biClrUsed == 256,
-        "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
+        "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
 
     oldbm = SelectObject(hdcmem, hdib);
 
@@ -696,7 +696,7 @@ static void test_dibsections(void)
     hdib = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (void**)&bits, NULL, 0);
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
-    ok(dibsec.dsBmih.biClrUsed == 2, "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 2);
+    ok(dibsec.dsBmih.biClrUsed == 2, "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 2);
 
     /* The colour table has already been grabbed from the dc, so we select back the
        old palette */
@@ -746,8 +746,8 @@ static void test_dibsections(void)
 
     BitBlt(hdcmem2, 0, 0, 16,16, hdcmem, 0, 0, SRCCOPY);
 
-    ok(bits32[0] == 0xff00, "lower left pixel is %08x\n", bits32[0]);
-    ok(bits32[17] == 0xff00ff, "bottom but one, left pixel is %08x\n", bits32[17]);
+    ok(bits32[0] == 0xff00, "lower left pixel is %08lx\n", bits32[0]);
+    ok(bits32[17] == 0xff00ff, "bottom but one, left pixel is %08lx\n", bits32[17]);
 
     SelectObject(hdcmem2, oldbm2);
     test_dib_info(hdib2, bits32, &pbmi->bmiHeader);
@@ -785,7 +785,7 @@ static void test_dibsections(void)
     hdib = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (void**)&bits, NULL, 0);
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
-    ok(dibsec.dsBmih.biClrUsed == 256, "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
+    ok(dibsec.dsBmih.biClrUsed == 256, "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
 
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
 
@@ -823,7 +823,7 @@ static void test_dibsections(void)
     hdib = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (void**)&bits, NULL, 0);
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
-    ok(dibsec.dsBmih.biClrUsed == 256, "created DIBSection: wrong biClrUsed field: %u, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
+    ok(dibsec.dsBmih.biClrUsed == 256, "created DIBSection: wrong biClrUsed field: %lu, should be: %u\n", dibsec.dsBmih.biClrUsed, 256);
 
     test_dib_info(hdib, bits, &pbmi->bmiHeader);
 
@@ -856,7 +856,7 @@ static void test_dibsections(void)
     pbmi->bmiHeader.biClrUsed = 173;
     memset( pbmi->bmiColors, 0xcc, 256 * sizeof(RGBQUAD) );
     GetDIBits( hdc, hdib, 0, 1, NULL, pbmi, DIB_RGB_COLORS );
-    ok( pbmi->bmiHeader.biClrUsed == 0, "wrong colors %u\n", pbmi->bmiHeader.biClrUsed );
+    ok( pbmi->bmiHeader.biClrUsed == 0, "wrong colors %lu\n", pbmi->bmiHeader.biClrUsed );
     for (i = 0; i < 256; i++)
     {
         if (i < 142)
@@ -897,7 +897,7 @@ static void test_dibsections(void)
     hdib = CreateDIBSection(hdc, pbmi, DIB_PAL_COLORS, (void**)&bits, NULL, 0);
     ok(hdib != NULL, "CreateDIBSection failed\n");
     ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIB Section\n");
-    ok(dibsec.dsBmih.biClrUsed == 0, "created DIBSection: wrong biClrUsed field: %u\n", dibsec.dsBmih.biClrUsed);
+    ok(dibsec.dsBmih.biClrUsed == 0, "created DIBSection: wrong biClrUsed field: %lu\n", dibsec.dsBmih.biClrUsed);
     oldbm = SelectObject(hdcmem, hdib);
     ret = GetDIBColorTable(hdcmem, 0, 256, rgb);
     ok(ret == 0, "GetDIBColorTable returned %d\n", ret);
@@ -1501,7 +1501,7 @@ static void test_bitmap(void)
     {
         ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY /* XP */ ||
            GetLastError() == ERROR_INVALID_PARAMETER /* Win2k */,
-           "expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
+           "expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
     }
     else
         DeleteObject(hbmp);
@@ -1512,7 +1512,7 @@ static void test_bitmap(void)
     {
         ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY /* XP */ ||
            GetLastError() == ERROR_INVALID_PARAMETER /* Win2k */,
-           "expected ERROR_NOT_ENOUGH_MEMORY, got %u\n", GetLastError());
+           "expected ERROR_NOT_ENOUGH_MEMORY, got %lu\n", GetLastError());
     }
     else
         DeleteObject(hbmp);
@@ -1522,7 +1522,7 @@ static void test_bitmap(void)
     ok(!hbmp, "CreateBitmap should fail\n");
     if (!hbmp)
         ok(GetLastError() == ERROR_INVALID_PARAMETER,
-           "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+           "expected ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
     else
         DeleteObject(hbmp);
 
@@ -1619,13 +1619,13 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
 
     res = SetPixel( hdc, 0, 0, RGB(r,g,b) );
     ok( res == get_nearest( r, g, b ),
-        "wrong result %06x for %02x,%02x,%02x fg %06x bg %06x\n", res, r, g, b, fg, bg );
+        "wrong result %06lx for %02x,%02x,%02x fg %06lx bg %06lx\n", res, r, g, b, fg, bg );
     res = GetPixel( hdc, 0, 0 );
     ok( res == get_nearest( r, g, b ),
-        "wrong result %06x for %02x,%02x,%02x fg %06x bg %06x\n", res, r, g, b, fg, bg );
+        "wrong result %06lx for %02x,%02x,%02x fg %06lx bg %06lx\n", res, r, g, b, fg, bg );
     res = GetNearestColor( hdc, RGB(r,g,b) );
     ok( res == get_nearest( r, g, b ),
-        "wrong result %06x for %02x,%02x,%02x fg %06x bg %06x\n", res, r, g, b, fg, bg );
+        "wrong result %06lx for %02x,%02x,%02x fg %06lx bg %06lx\n", res, r, g, b, fg, bg );
 
     /* solid pen */
     old_pen = SelectObject( hdc, CreatePen( PS_SOLID, 1, RGB(r,g,b) ));
@@ -1633,10 +1633,10 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
     LineTo( hdc, 16, 0 );
     res = GetPixel( hdc, 0, 0 );
     ok( res == (is_black_pen( fg, bg, r, g, b ) ? 0 : 0xffffff),
-        "wrong result %06x for %02x,%02x,%02x fg %06x bg %06x\n", res, r, g, b, fg, bg );
+        "wrong result %06lx for %02x,%02x,%02x fg %06lx bg %06lx\n", res, r, g, b, fg, bg );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == (is_black_pen( fg, bg, r, g, b ) ? 0x00 : 0xffff),
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
     DeleteObject( SelectObject( hdc, old_pen ));
 
     /* mono DDB pattern brush */
@@ -1645,7 +1645,7 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
     PatBlt( hdc, 0, 0, 16, 16, PATCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0x5555 || broken(bits[0] == 0xaada) /* XP SP1 & 2003 SP0 */,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
     DeleteObject( SelectObject( hdc, old_brush ));
 
     /* mono DDB bitmap */
@@ -1654,13 +1654,13 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0x5555,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
     SetTextColor( memdc, RGB(255,255,255) );
     SetBkColor( memdc, RGB(0,0,0) );
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0x5555,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
 
     /* mono DIB section */
     memset( buffer, 0, sizeof(buffer) );
@@ -1682,7 +1682,7 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0x5555,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
 
     colors[0].rgbRed = 0x0;
     colors[0].rgbGreen = 0x0;
@@ -1696,21 +1696,21 @@ static void test_bitmap_colors( HDC hdc, COLORREF fg, COLORREF bg, int r, int g,
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0xaaaa,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
 
     SetTextColor( memdc, RGB(0,20,0) );
     SetBkColor( memdc, RGB(240,240,240) );
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0x5555,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
 
     SetTextColor( memdc, RGB(250,250,250) );
     SetBkColor( memdc, RGB(10,10,10) );
     BitBlt( hdc, 0, 0, 16, 8, memdc, 0, 0, SRCCOPY );
     GetBitmapBits( GetCurrentObject( hdc, OBJ_BITMAP ), sizeof(bits), bits );
     ok( bits[0] == 0xaaaa,
-        "wrong bits %04x for %02x,%02x,%02x fg %06x bg %06x\n", bits[0], r, g, b, fg, bg );
+        "wrong bits %04x for %02x,%02x,%02x fg %06lx bg %06lx\n", bits[0], r, g, b, fg, bg );
     DeleteDC( memdc );
     DeleteObject( bitmap );
 }
@@ -1884,7 +1884,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
 
     /* Check if last pixel was set */
     pixel = ((DWORD *)bits2)[info->bmiHeader.biWidth * info->bmiHeader.biHeight - 1];
-    ok(pixel != 0, "Pixel: 0x%08x\n", pixel);
+    ok(pixel != 0, "Pixel: 0x%08lx\n", pixel);
 
     HeapFree(GetProcessHeap(), 0, bits2);
     DeleteDC(dc);
@@ -2148,18 +2148,18 @@ static void test_GetDIBits(void)
     ok(lines == 0, "GetDIBits copied %d lines with hdc = 0\n", lines);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* winnt */
-       "wrong error %u\n", GetLastError());
-    ok(bi->bmiHeader.biSizeImage == 0, "expected 0, got %u\n", bi->bmiHeader.biSizeImage);
+       "wrong error %lu\n", GetLastError());
+    ok(bi->bmiHeader.biSizeImage == 0, "expected 0, got %lu\n", bi->bmiHeader.biSizeImage);
     ok(bi->bmiHeader.biClrUsed == 37 || broken(bi->bmiHeader.biClrUsed == 0),
-       "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+       "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_1), "expected 16*4, got %u\n", bi->bmiHeader.biSizeImage);
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_1), "expected 16*4, got %lu\n", bi->bmiHeader.biSizeImage);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     /* the color table consists of black and white */
     ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
@@ -2204,10 +2204,10 @@ static void test_GetDIBits(void)
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_24), "expected 16*16*3, got %u\n", bi->bmiHeader.biSizeImage);
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_24), "expected 16*16*3, got %lu\n", bi->bmiHeader.biSizeImage);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     /* the color table doesn't exist for 24-bit images */
     for (i = 0; i < 256; i++)
@@ -2228,7 +2228,7 @@ static void test_GetDIBits(void)
     SetLastError(0xdeadbeef);
     bi->bmiHeader.biHeight = -bm.bmHeight; /* indicate bottom-up data */
     lines = SetDIBits(hdc, hbmp, 0, bm.bmHeight, bmp_bits_24, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "SetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "SetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
 
     memset(&bm, 0xAA, sizeof(bm));
@@ -2262,10 +2262,10 @@ static void test_GetDIBits(void)
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_1), "expected 16*4, got %u\n", bi->bmiHeader.biSizeImage);
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_1), "expected 16*4, got %lu\n", bi->bmiHeader.biSizeImage);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     /* the color table consists of black and white */
     ok(colors[0].rgbRed == 0 && colors[0].rgbGreen == 0 &&
@@ -2310,9 +2310,9 @@ static void test_GetDIBits(void)
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, 20, pal_ents );
 
@@ -2349,9 +2349,9 @@ static void test_GetDIBits(void)
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     GetPaletteEntries( GetStockObject(DEFAULT_PALETTE), 0, 20, pal_ents );
 
@@ -2394,10 +2394,10 @@ static void test_GetDIBits(void)
     memset(buf, 0xAA, sizeof(buf));
     SetLastError(0xdeadbeef);
     lines = GetDIBits(hdc, hbmp, 0, bm.bmHeight, buf, bi, DIB_RGB_COLORS);
-    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %u\n",
+    ok(lines == bm.bmHeight, "GetDIBits copied %d lines of %d, error %lu\n",
        lines, bm.bmHeight, GetLastError());
-    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_24), "expected 16*16*3, got %u\n", bi->bmiHeader.biSizeImage);
-    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %u\n", bi->bmiHeader.biClrUsed);
+    ok(bi->bmiHeader.biSizeImage == sizeof(dib_bits_24), "expected 16*16*3, got %lu\n", bi->bmiHeader.biSizeImage);
+    ok(bi->bmiHeader.biClrUsed == 0, "wrong biClrUsed %lu\n", bi->bmiHeader.biClrUsed);
 
     /* the color table doesn't exist for 24-bit images */
     for (i = 0; i < 256; i++)
@@ -2449,7 +2449,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     {
         ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS ||
             broken( dibinfo->bmiHeader.biCompression == BI_RGB ), /* nt4 sp3 */
-            "compression is %u (%d bpp)\n", dibinfo->bmiHeader.biCompression, dibinfo->bmiHeader.biBitCount );
+            "compression is %lu (%d bpp)\n", dibinfo->bmiHeader.biCompression, dibinfo->bmiHeader.biBitCount );
 
         if (dibinfo->bmiHeader.biCompression == BI_BITFIELDS)
         {
@@ -2471,10 +2471,10 @@ static void test_GetDIBits_BI_BITFIELDS(void)
             memset(dibinfo, 0, sizeof(dibinfo_buf));
             dibinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
             ret = GetDIBits(hdc, hbm, 0, 1, NULL, dibinfo, DIB_RGB_COLORS);
-            ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
+            ok(ret == 1, "GetDIBits failed ret %u err %lu\n",ret,GetLastError());
             dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
             ret = GetDIBits(hdc, hbm, 0, 1, bits, dibinfo, DIB_RGB_COLORS);
-            ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
+            ok(ret == 1, "GetDIBits failed ret %u err %lu\n",ret,GetLastError());
 
             ok( bitmasks[0] != 0, "red mask is not set\n" );
             ok( bitmasks[1] != 0, "green mask is not set\n" );
@@ -2487,7 +2487,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
             dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
             SetLastError(0xdeadbeef);
             ret = GetDIBits(hdc, hbm, 0, 0, bits, dibinfo, DIB_RGB_COLORS);
-            ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
+            ok(ret == 1, "GetDIBits failed ret %u err %lu\n",ret,GetLastError());
 
             ok( !bitmasks[0], "red mask is set\n" );
             ok( !bitmasks[1], "green mask is set\n" );
@@ -2497,7 +2497,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
             memset(bitmasks, 0, 3*sizeof(DWORD));
             dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
             ret = GetDIBits(hdc, hbm, 0, 0, bits, dibinfo, DIB_RGB_COLORS);
-            ok(ret == 1, "GetDIBits failed ret %u err %u\n",ret,GetLastError());
+            ok(ret == 1, "GetDIBits failed ret %u err %lu\n",ret,GetLastError());
 
             ok( bitmasks[0] != 0, "red mask is not set\n" );
             ok( bitmasks[1] != 0, "green mask is not set\n" );
@@ -2536,7 +2536,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
 
     ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS ||
         broken( dibinfo->bmiHeader.biCompression == BI_RGB ), /* nt4 sp3 */
-        "compression is %u\n", dibinfo->bmiHeader.biCompression );
+        "compression is %lu\n", dibinfo->bmiHeader.biCompression );
     ok( !bitmasks[0], "red mask is set\n" );
     ok( !bitmasks[1], "green mask is set\n" );
     ok( !bitmasks[2], "blue mask is set\n" );
@@ -2547,12 +2547,12 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     ok( dibinfo->bmiHeader.biBitCount == 32, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
     ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS ||
         broken( dibinfo->bmiHeader.biCompression == BI_RGB ), /* nt4 sp3 */
-        "compression is %u\n", dibinfo->bmiHeader.biCompression );
+        "compression is %lu\n", dibinfo->bmiHeader.biCompression );
     if (dibinfo->bmiHeader.biCompression == BI_BITFIELDS)
     {
-        ok( bitmasks[0] == 0xff0000, "wrong red mask %08x\n", bitmasks[0] );
-        ok( bitmasks[1] == 0x00ff00, "wrong green mask %08x\n", bitmasks[1] );
-        ok( bitmasks[2] == 0x0000ff, "wrong blue mask %08x\n", bitmasks[2] );
+        ok( bitmasks[0] == 0xff0000, "wrong red mask %08lx\n", bitmasks[0] );
+        ok( bitmasks[1] == 0x00ff00, "wrong green mask %08lx\n", bitmasks[1] );
+        ok( bitmasks[2] == 0x0000ff, "wrong blue mask %08lx\n", bitmasks[2] );
     }
     ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
 
@@ -2583,7 +2583,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
         ok(ret == 1, "GetDIBits failed\n");
 
         ok( dibinfo->bmiHeader.biCompression == BI_BITFIELDS,
-            "compression is %u\n", dibinfo->bmiHeader.biCompression );
+            "compression is %lu\n", dibinfo->bmiHeader.biCompression );
         ok( !bitmasks[0], "red mask is set\n" );
         ok( !bitmasks[1], "green mask is set\n" );
         ok( !bitmasks[2], "blue mask is set\n" );
@@ -2591,9 +2591,9 @@ static void test_GetDIBits_BI_BITFIELDS(void)
         dibinfo->bmiHeader.biSizeImage = 0xdeadbeef;
         ret = GetDIBits(hdc, hbm, 0, 1, bits, dibinfo, DIB_RGB_COLORS);
         ok(ret == 1, "GetDIBits failed\n");
-        ok( bitmasks[0] == 0x0000ff, "wrong red mask %08x\n", bitmasks[0] );
-        ok( bitmasks[1] == 0x00ff00, "wrong green mask %08x\n", bitmasks[1] );
-        ok( bitmasks[2] == 0xff0000, "wrong blue mask %08x\n", bitmasks[2] );
+        ok( bitmasks[0] == 0x0000ff, "wrong red mask %08lx\n", bitmasks[0] );
+        ok( bitmasks[1] == 0x00ff00, "wrong green mask %08lx\n", bitmasks[1] );
+        ok( bitmasks[2] == 0xff0000, "wrong blue mask %08lx\n", bitmasks[2] );
         ok( dibinfo->bmiHeader.biSizeImage != 0xdeadbeef, "size image not set\n" );
 
         DeleteObject(hbm);
@@ -2625,7 +2625,7 @@ static void test_GetDIBits_BI_BITFIELDS(void)
     ok( dibinfo->bmiHeader.biBitCount == 24, "wrong bit count %u\n", dibinfo->bmiHeader.biBitCount );
 
     ok( dibinfo->bmiHeader.biCompression == BI_RGB,
-        "compression is %u\n", dibinfo->bmiHeader.biCompression );
+        "compression is %lu\n", dibinfo->bmiHeader.biCompression );
     ok( !bitmasks[0], "red mask is set\n" );
     ok( !bitmasks[1], "green mask is set\n" );
     ok( !bitmasks[2], "blue mask is set\n" );
@@ -2676,7 +2676,7 @@ static void test_select_object(void)
     SetLastError(0xdeadbeef);
     hbm_old = SelectObject(NULL, hbm);
     ok(!hbm_old, "SelectObject returned %p\n", hbm_old);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n",
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n",
        GetLastError());
 
     DeleteObject(hbm);
@@ -2707,15 +2707,15 @@ static void test_select_object(void)
         if(depths[i] == bpp ||
           (bpp == 16 && depths[i] == 15)        /* 16 and 15 bpp are compatible */
           ) {
-            ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %d\n", bpp, depths[i]);
+            ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %ld\n", bpp, depths[i]);
             SelectObject(hdc, hbm_old);
         } else {
-            ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
+            ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %ld\n", bpp, depths[i]);
         }
 
         memset(&bm, 0xAA, sizeof(bm));
         bytes = GetObjectW(hbm, sizeof(bm), &bm);
-        ok(bytes == sizeof(bm), "GetObject returned %d\n", bytes);
+        ok(bytes == sizeof(bm), "GetObject returned %ld\n", bytes);
         ok(bm.bmType == 0, "wrong bmType %d\n", bm.bmType);
         ok(bm.bmWidth == 10, "wrong bmWidth %d\n", bm.bmWidth);
         ok(bm.bmHeight == 10, "wrong bmHeight %d\n", bm.bmHeight);
@@ -2749,7 +2749,7 @@ static void test_mono_1x1_bmp_dbg(HBITMAP hbmp, int line)
     SetLastError(0xdeadbeef);
     ret = GetObjectW(hbmp, sizeof(bm), &bm);
     if (!ret) /* XP, only for curObj2 */ return;
-    ok_(__FILE__, line)(ret == sizeof(BITMAP), "GetObject returned %d, error %u\n", ret, GetLastError());
+    ok_(__FILE__, line)(ret == sizeof(BITMAP), "GetObject returned %d, error %lu\n", ret, GetLastError());
     ok_(__FILE__, line)(bm.bmType == 0, "wrong bmType, expected 0 got %d\n", bm.bmType);
     ok_(__FILE__, line)(bm.bmWidth == 1, "wrong bmWidth, expected 1 got %d\n", bm.bmWidth);
     ok_(__FILE__, line)(bm.bmHeight == 1, "wrong bmHeight, expected 1 got %d\n", bm.bmHeight);
@@ -2821,7 +2821,7 @@ static void test_CreateBitmap(void)
     bmp.bmBitsPixel = 1;
     bmp.bmBits = NULL;
     bm = CreateBitmapIndirect(&bmp);
-    ok(bm != 0, "CreateBitmapIndirect error %u\n", GetLastError());
+    ok(bm != 0, "CreateBitmapIndirect error %lu\n", GetLastError());
     test_mono_1x1_bmp(bm);
     DeleteObject(bm);
 
@@ -2839,11 +2839,11 @@ static void test_CreateBitmap(void)
         if(i > 32) {
             DWORD error = GetLastError();
             ok(bm == 0, "CreateBitmapIndirect for %d bpp succeeded\n", i);
-            ok(error == ERROR_INVALID_PARAMETER, "Got error %d, expected ERROR_INVALID_PARAMETER\n", error);
+            ok(error == ERROR_INVALID_PARAMETER, "Got error %ld, expected ERROR_INVALID_PARAMETER\n", error);
             DeleteObject(bm);
             continue;
         }
-        ok(bm != 0, "CreateBitmapIndirect error %u\n", GetLastError());
+        ok(bm != 0, "CreateBitmapIndirect error %lu\n", GetLastError());
         GetObjectW(bm, sizeof(bmp), &bmp);
         if(i == 1) {
             expect = 1;
@@ -2886,7 +2886,7 @@ static void test_bitmapinfoheadersize(void)
 
     SetLastError(0xdeadbeef);
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bmi.bmiHeader.biSize++;
@@ -2895,7 +2895,7 @@ static void test_bitmapinfoheadersize(void)
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
     ok(hdib != NULL ||
        broken(!hdib), /* Win98, WinMe */
-       "CreateDIBSection error %d\n", GetLastError());
+       "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
@@ -2904,7 +2904,7 @@ static void test_bitmapinfoheadersize(void)
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
     ok(hdib != NULL ||
        broken(!hdib), /* Win98, WinMe */
-       "CreateDIBSection error %d\n", GetLastError());
+       "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bmi.bmiHeader.biSize++;
@@ -2913,14 +2913,14 @@ static void test_bitmapinfoheadersize(void)
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
     ok(hdib != NULL ||
        broken(!hdib), /* Win98, WinMe */
-       "CreateDIBSection error %d\n", GetLastError());
+       "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bmi.bmiHeader.biSize = sizeof(BITMAPV4HEADER);
 
     SetLastError(0xdeadbeef);
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bmi.bmiHeader.biSize = sizeof(BITMAPV5HEADER);
@@ -2929,7 +2929,7 @@ static void test_bitmapinfoheadersize(void)
     hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0);
     ok(hdib != NULL ||
        broken(!hdib), /* Win95 */
-       "CreateDIBSection error %d\n", GetLastError());
+       "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     memset(&bci, 0, sizeof(BITMAPCOREINFO));
@@ -2947,7 +2947,7 @@ static void test_bitmapinfoheadersize(void)
 
     SetLastError(0xdeadbeef);
     hdib = CreateDIBSection(hdc, (BITMAPINFO *)&bci, 0, NULL, NULL, 0);
-    ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError());
+    ok(hdib != NULL, "CreateDIBSection error %ld\n", GetLastError());
     DeleteObject(hdib);
 
     bci.bmciHeader.bcSize++;
@@ -3010,7 +3010,7 @@ static void check_BitBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32
     *dstBuffer = 0x89ABCDEF;
     BitBlt(hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, dwRop);
     ok(expected == *dstBuffer,
-        "BitBlt with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n",
+        "BitBlt with dwRop %06lX. Expected 0x%08X, got 0x%08X from line %d\n",
         dwRop, expected, *dstBuffer, line);
 }
 
@@ -3087,7 +3087,7 @@ static void check_StretchBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UI
     *dstBuffer = 0x89ABCDEF;
     StretchBlt(hdcDst, 0, 0, 2, 1, hdcSrc, 0, 0, 1, 1, dwRop);
     ok(expected == *dstBuffer,
-        "StretchBlt with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n",
+        "StretchBlt with dwRop %06lX. Expected 0x%08X, got 0x%08X from line %d\n",
         dwRop, expected, *dstBuffer, line);
 }
 
@@ -3451,7 +3451,7 @@ static void check_StretchDIBits_pixel(HDC hdcDst, UINT32 *dstBuffer, UINT32 *src
 
     StretchDIBits(hdcDst, 0, 0, 2, 1, 0, 0, 1, 1, &buffer, &bitmapInfo, DIB_RGB_COLORS, dwRop);
     ok(expected == *dstBuffer,
-        "StretchDIBits with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n",
+        "StretchDIBits with dwRop %06lX. Expected 0x%08X, got 0x%08X from line %d\n",
         dwRop, expected, *dstBuffer, line);
 }
 
@@ -3670,12 +3670,12 @@ static void test_GdiAlphaBlend(void)
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 10, 10, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 10, 10, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
@@ -3689,84 +3689,84 @@ static void test_GdiAlphaBlend(void)
     SetWindowOrgEx(hdcSrc, -10, -10, NULL);
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 10, 10, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 10, 10, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
     SetMapMode(hdcSrc, MM_ANISOTROPIC);
     ScaleWindowExtEx(hdcSrc, 10, 1, 10, 1, NULL);
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 30, 30, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 30, 30, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
 
     SetMapMode(hdcDst, MM_ANISOTROPIC);
     SetViewportExtEx(hdcDst, -1, -1, NULL);
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 50, 50, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, -20, -20, 20, 20, hdcSrc, 0, -1, 50, 50, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, -20, -20, -20, -20, hdcSrc, 0, -1, 50, 50, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, -20, 0, -20, 20, hdcSrc, 0, -1, 50, 50, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, -20, 20, -20, hdcSrc, 0, -1, 50, 50, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetMapMode(hdcDst, MM_TEXT);
 
     SetViewportExtEx(hdcSrc, -1, -1, NULL);
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -20, -20, -30, -30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -20, -20, 30, -30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -20, -20, -30, 30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -20, -20, 30, 30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 20, 20, 30, 30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -60, -60, 30, 30, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetViewportExtEx(hdcSrc, 1, 1, NULL);
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, NULL, 0, 0, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
 
     /* overlapping source and dest not allowed */
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcDst, 19, 19, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 20, 20, 20, 20, hdcDst, 1, 1, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcDst, 20, 10, 20, 20, blend);
@@ -3780,7 +3780,7 @@ static void test_GdiAlphaBlend(void)
     blend.AlphaFormat = AC_SRC_ALPHA;
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
 
     bmi->bmiHeader.biCompression = BI_BITFIELDS;
     ((DWORD *)bmi->bmiColors)[0] = 0xff0000;
@@ -3793,7 +3793,7 @@ static void test_GdiAlphaBlend(void)
 
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
-    ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
+    ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
 
     bmi->bmiHeader.biCompression = BI_BITFIELDS;
     ((DWORD *)bmi->bmiColors)[0] = 0x0000ff;
@@ -3807,7 +3807,7 @@ static void test_GdiAlphaBlend(void)
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     bmi->bmiHeader.biBitCount = 24;
     bmi->bmiHeader.biCompression = BI_RGB;
@@ -3819,7 +3819,7 @@ static void test_GdiAlphaBlend(void)
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     bmi->bmiHeader.biBitCount = 1;
     bmpSrc = CreateDIBSection(hdcDst, bmi, DIB_RGB_COLORS, &bits, NULL, 0);
@@ -3830,7 +3830,7 @@ static void test_GdiAlphaBlend(void)
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     bmpSrc = CreateBitmap( 100, 100, 1, 1, NULL );
     ok(bmpSrc != NULL, "Couldn't create source bitmap\n");
@@ -3840,7 +3840,7 @@ static void test_GdiAlphaBlend(void)
     SetLastError(0xdeadbeef);
     ret = pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, 0, 20, 20, blend);
     ok( !ret, "GdiAlphaBlend succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
 
     DeleteDC(hdcDst);
     DeleteDC(hdcSrc);
@@ -3884,80 +3884,80 @@ static void test_GdiGradientFill(void)
 
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, rect, 1, GRADIENT_FILL_RECT_H );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, rect, 1, 3 );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( (HDC)0xdead, vt, 3, rect, 1, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( NULL, NULL, 0, rect, 1, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     ret = pGdiGradientFill( hdc, NULL, 0, rect, 1, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, NULL, 3, rect, 1, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, NULL, 0, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, NULL, 1, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, rect, 0, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, rect, 3, GRADIENT_FILL_RECT_H );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     rect[2].UpperLeft = rect[2].LowerRight = 1;
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, rect, 3, GRADIENT_FILL_RECT_H );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 1, rect, 1, GRADIENT_FILL_RECT_H );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 1, tri, 0, GRADIENT_FILL_TRIANGLE );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 1, tri, 1, GRADIENT_FILL_TRIANGLE );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 2, GRADIENT_FILL_TRIANGLE );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 3, GRADIENT_FILL_TRIANGLE );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 4, GRADIENT_FILL_TRIANGLE );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     tri[3].Vertex3 = 1;
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 4, GRADIENT_FILL_TRIANGLE );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     tri[3].Vertex3 = 0;
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 4, GRADIENT_FILL_TRIANGLE );
     ok( !ret, "GdiGradientFill succeeded\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     tri[3].Vertex1 = tri[3].Vertex2 = tri[3].Vertex3 = 1;
     SetLastError( 0xdeadbeef );
     ret = pGdiGradientFill( hdc, vt, 3, tri, 4, GRADIENT_FILL_TRIANGLE );
-    ok( ret, "GdiGradientFill failed err %u\n", GetLastError() );
+    ok( ret, "GdiGradientFill failed err %lu\n", GetLastError() );
 
     DeleteDC( hdc );
     DeleteObject( bmp );
@@ -4043,7 +4043,7 @@ static void test_32bit_ddb(void)
     oldDst = SelectObject(hdcDst, bmpDst);
 
     StretchBlt(hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, 1, 1, SRCCOPY);
-    ok(dstBuffer[0] == colorSrc, "Expected color=%x, received color=%x\n", colorSrc, dstBuffer[0]);
+    ok(dstBuffer[0] == colorSrc, "Expected color=%lx, received color=%lx\n", colorSrc, dstBuffer[0]);
 
     if (pGdiAlphaBlend)
     {
@@ -4056,13 +4056,13 @@ static void test_32bit_ddb(void)
         blend.AlphaFormat = 0;
         dstBuffer[0] = 0x80808080;
         ret = pGdiAlphaBlend( hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, 1, 1, blend );
-        ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
-        ok(dstBuffer[0] == 0x60504844, "wrong color %x\n", dstBuffer[0]);
+        ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
+        ok(dstBuffer[0] == 0x60504844, "wrong color %lx\n", dstBuffer[0]);
         blend.AlphaFormat = AC_SRC_ALPHA;
         dstBuffer[0] = 0x80808080;
         ret = pGdiAlphaBlend( hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, 1, 1, blend );
-        ok( ret, "GdiAlphaBlend failed err %u\n", GetLastError() );
-        ok(dstBuffer[0] == 0x90807874, "wrong color %x\n", dstBuffer[0]);
+        ok( ret, "GdiAlphaBlend failed err %lu\n", GetLastError() );
+        ok(dstBuffer[0] == 0x90807874, "wrong color %lx\n", dstBuffer[0]);
     }
 
     data = (DWORD *)biDst->bmiColors;
@@ -4072,7 +4072,7 @@ static void test_32bit_ddb(void)
     SelectObject( hdcSrc, brush );
     PatBlt( hdcSrc, 0, 0, 1, 1, PATCOPY );
     BitBlt( hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, SRCCOPY );
-    ok(dstBuffer[0] == data[0], "Expected color=%x, received color=%x\n", data[0], dstBuffer[0]);
+    ok(dstBuffer[0] == data[0], "Expected color=%lx, received color=%lx\n", data[0], dstBuffer[0]);
     SelectObject( hdcSrc, GetStockObject(BLACK_BRUSH) );
     DeleteObject( brush );
 
@@ -4083,7 +4083,7 @@ static void test_32bit_ddb(void)
     PatBlt( hdcSrc, 0, 0, 1, 1, PATCOPY );
     BitBlt( hdcDst, 0, 0, 1, 1, hdcSrc, 0, 0, SRCCOPY );
     ok(dstBuffer[0] == (data[0] & ~0xff000000),
-       "Expected color=%x, received color=%x\n", data[0] & 0xff000000, dstBuffer[0]);
+       "Expected color=%lx, received color=%lx\n", data[0] & 0xff000000, dstBuffer[0]);
     SelectObject( hdcSrc, GetStockObject(BLACK_BRUSH) );
     DeleteObject( brush );
 
@@ -4241,7 +4241,7 @@ static void test_GetSetDIBits_rtl(void)
 
     ret = GetDIBits( hdc_mem, bitmap, 0, 8, bits_1, &info, DIB_RGB_COLORS );
     ok(ret == 8, "got %d\n", ret);
-    ok(bits_1[56] == 0xff0000, "got %08x\n", bits_1[56]); /* check we have a red pixel */
+    ok(bits_1[56] == 0xff0000, "got %08lx\n", bits_1[56]); /* check we have a red pixel */
 
     SetLayout( hdc_mem, LAYOUT_RTL );
 
@@ -4312,48 +4312,48 @@ static void test_GetDIBits_scanlines(void)
     ret = GetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 8, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 8, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 9, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 1, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = 16;
     info->bmiHeader.biSizeImage = 0;
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    ok( info->bmiHeader.biSizeImage == 128 * 4, "got %d\n", info->bmiHeader.biSizeImage );
-    for (i = 0; i < 56; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    ok( info->bmiHeader.biSizeImage == 128 * 4, "got %ld\n", info->bmiHeader.biSizeImage );
+    for (i = 0; i < 56; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     ok( !memcmp( data + 56, dib_bits, 40 * 4 ), "bits differ\n");
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 2, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 6, "got %d\n", ret );
-    for (i = 0; i < 48; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 48; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     ok( !memcmp( data + 48, dib_bits, 48 * 4 ), "bits differ\n");
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 2, 3, data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 24; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 24; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 24; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = 5;
     ret = GetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 32, 16 * 4 ), "bits differ\n");
-    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     /* b-u -> t-d */
@@ -4367,77 +4367,77 @@ static void test_GetDIBits_scanlines(void)
     ret = GetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 16, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 32 * 4 ), "bits differ\n");
-    for (i = 32; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 32; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 3, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 3, 13, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = -16;
     ret = GetDIBits( hdc, dib, 0, 16, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 128; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 128; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 24, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 96; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 96; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 96; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 96; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 5, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 88; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 88; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 88; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 88; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 9, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 18, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 1, "got %d\n", ret );
-    for (i = 0; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = -5;
     ret = GetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 16, 16 * 4 ), "bits differ\n");
-    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     DeleteObject( dib );
@@ -4464,72 +4464,72 @@ static void test_GetDIBits_scanlines(void)
     ret = GetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 16, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 32 * 4 ), "bits differ\n");
-    for (i = 32; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 32; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 3, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 3, 13, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = -16;
     ret = GetDIBits( hdc, dib, 0, 16, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 128; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 128; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 24, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 96; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 96; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 96; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 96; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 5, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 64 * 4 ), "bits differ\n");
-    for (i = 64; i < 88; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 88; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 64; i < 88; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 88; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 9, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, dib_bits, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = -5;
     ret = GetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
     ok( !memcmp( data, dib_bits + 16, 16 * 4 ), "bits differ\n");
-    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
 
@@ -4545,46 +4545,46 @@ static void test_GetDIBits_scanlines(void)
     ret = GetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 8, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 40; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 8, 56 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 56; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 9, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 1, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 64; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = 16;
     ret = GetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 56; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 56; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     ok( !memcmp( data + 56, inverted_bits, 40 * 4 ), "bits differ\n");
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 2, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 6, "got %d\n", ret );
-    for (i = 0; i < 48; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 48; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
     ok( !memcmp( data + 48, inverted_bits, 48 * 4 ), "bits differ\n");
-    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 96; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     ret = GetDIBits( hdc, dib, 2, 3, data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( data[i] == 0, "%d: got %08x\n", i, data[i] );
-    for (i = 24; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 0; i < 24; i++) ok( data[i] == 0, "%d: got %08lx\n", i, data[i] );
+    for (i = 24; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
     memset( data, 0xaa, sizeof(data) );
 
     info->bmiHeader.biHeight = 5;
     ret = GetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
     ok( !memcmp( data, inverted_bits + 32, 16 * 4 ), "bits differ\n");
-    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] );
+    for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, data[i] );
 
     DeleteObject( dib );
 
@@ -4633,9 +4633,9 @@ static void test_SetDIBits(void)
 
     ret = SetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 8, data, 40 * 4 ), "bits differ\n");
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* top of dst is aligned with startscans down for the top of the src.
@@ -4645,15 +4645,15 @@ static void test_SetDIBits(void)
     ret = SetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
     ok( !memcmp( dib_bits, data + 56,  40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 5;
     ret = SetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 32, data,  16 * 4 ), "bits differ\n");
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* t-d -> b-u */
@@ -4668,16 +4668,16 @@ static void test_SetDIBits(void)
 
     ret = SetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 8, inverted_data + 88, 40 * 4 ), "bits differ\n");
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -16;
     ret = SetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
     ok( !memcmp( dib_bits, inverted_data + 88, 40 * 4 ), "bits differ\n");
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBits( hdc, dib, 4, 12, data, info, DIB_RGB_COLORS );
@@ -4693,9 +4693,9 @@ static void test_SetDIBits(void)
     info->bmiHeader.biHeight = -5;
     ret = SetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 32, inverted_data + 112, 16 * 4 ), "bits differ\n");
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     DeleteObject( dib );
@@ -4716,24 +4716,24 @@ static void test_SetDIBits(void)
 
     ret = SetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 16, data, 40 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -16;
     ret = SetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 24, data,  40 * 4 ), "bits differ\n");
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -5;
     ret = SetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 16, data,  16 * 4 ), "bits differ\n");
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* b-u -> t-d */
@@ -4747,24 +4747,24 @@ static void test_SetDIBits(void)
 
     ret = SetDIBits( hdc, dib, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 16, inverted_data + 88, 40 * 4 ), "bits differ\n");
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 16;
     ret = SetDIBits( hdc, dib, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 24, inverted_data + 32, 40 * 4 ), "bits differ\n");
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 5;
     ret = SetDIBits( hdc, dib, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 16, inverted_data + 112, 16 * 4 ), "bits differ\n");
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* handling of partial color table */
@@ -4788,7 +4788,7 @@ static void test_SetDIBits(void)
         DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 : (info->bmiColors[idx].rgbRed << 16 |
                                                                info->bmiColors[idx].rgbGreen << 8 |
                                                                info->bmiColors[idx].rgbBlue);
-        ok( dib_bits[i] == expect, "%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
+        ok( dib_bits[i] == expect, "%d: got %08lx instead of %08lx\n", i, dib_bits[i], expect );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -4816,7 +4816,7 @@ static void test_SetDIBits(void)
         DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 :
                         (palent[ent].peRed << 16 | palent[ent].peGreen << 8 | palent[ent].peBlue);
         ok( dib_bits[i] == expect || broken(dib_bits[i] == 0),  /* various Windows versions get some values wrong */
-            "%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
+            "%d: got %08lx instead of %08lx\n", i, dib_bits[i], expect );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -4951,7 +4951,7 @@ static void test_SetDIBits_RLE8(void)
 
     ret = SetDIBits( hdc, dib, 1, 0, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* reduce width to 4, left-hand side of dst is touched. */
@@ -4961,7 +4961,7 @@ static void test_SetDIBits_RLE8(void)
     for (i = 0; i < 64; i++)
     {
         DWORD expect = (i & 4) ? 0xaaaaaaaa : bottom_up[i];
-        ok( dib_bits[i] == expect, "%d: got %08x\n", i, dib_bits[i] );
+        ok( dib_bits[i] == expect, "%d: got %08lx\n", i, dib_bits[i] );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -4972,7 +4972,7 @@ static void test_SetDIBits_RLE8(void)
     info->bmiHeader.biHeight = 4;
     ret = SetDIBits( hdc, dib, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 32, bottom_up, 32 * 4 ), "bits differ\n");
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -4981,7 +4981,7 @@ static void test_SetDIBits_RLE8(void)
     ret = SetDIBits( hdc, dib, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
     ok( !memcmp( dib_bits, bottom_up + 8, 56 * 4 ), "bits differ\n");
-    for (i = 0; i < 8; i++) ok( dib_bits[56 + i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[56 + i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[56 + i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[56 + i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* top-down compressed dibs are invalid */
@@ -4989,7 +4989,7 @@ static void test_SetDIBits_RLE8(void)
     SetLastError( 0xdeadbeef );
     ret = SetDIBits( hdc, dib, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got %x\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got %lx\n", GetLastError() );
     DeleteObject( dib );
 
     /* top-down dst */
@@ -5016,13 +5016,13 @@ static void test_SetDIBits_RLE8(void)
     ret = SetDIBits( hdc, dib, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
     ok( !memcmp( dib_bits, top_down + 32, 32 * 4 ), "bits differ\n");
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 9;
     ret = SetDIBits( hdc, dib, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     ok( !memcmp( dib_bits + 8, top_down, 56 * 4 ), "bits differ\n");
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -5067,79 +5067,79 @@ static void test_SetDIBitsToDevice(void)
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == data[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == data[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 8; i < 48; i++) ok( dib_bits[i] == data[i - 8], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 8; i < 48; i++) ok( dib_bits[i] == data[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 3, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == data[i + 16], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 24; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == data[i + 16], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 24; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 16;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 8; i < 64; i++) ok( dib_bits[i] == data[i - 8], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 8; i < 64; i++) ok( dib_bits[i] == data[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 2, 8, 8, 0, 6, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == data[i + 56], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == data[i + 56], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, -4, 8, 8, 0, 3, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 10, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 4, 8, 8, 0, -3, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == data[i], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == data[i], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 2, 8, 5, 0, -2, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 32; i < 48; i++) ok( dib_bits[i] == data[i - 32], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 32; i < 48; i++) ok( dib_bits[i] == data[i - 32], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 5;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 2, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 16; i < 32; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 16; i < 32; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 3, 3, 2, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 3, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 27 || i == 28 || i == 35 || i == 36)
-            ok( dib_bits[i] == data[i - 18], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i - 18], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 16, 16, 0, 0, 0, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 2, 8, 4, 0, -1, 3, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     SetMapMode( hdc, MM_ANISOTROPIC );
@@ -5148,9 +5148,9 @@ static void test_SetDIBitsToDevice(void)
     ok( ret == 3, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 41 || i == 42 || i == 49 || i == 50)
-            ok( dib_bits[i] == data[i - 32], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i - 32], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     SetWindowExtEx( hdc, -1, -1, NULL );
@@ -5158,9 +5158,9 @@ static void test_SetDIBitsToDevice(void)
     ok( ret == 4, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 48 || i == 49 || i == 56 || i == 57)
-            ok( dib_bits[i] == data[i - 37], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i - 37], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
     SetMapMode( hdc, MM_TEXT );
 
@@ -5169,9 +5169,9 @@ static void test_SetDIBitsToDevice(void)
     ok( ret == 3, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46)
-            ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i - 27], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
     SetLayout( hdc, LAYOUT_LTR );
 
@@ -5179,94 +5179,94 @@ static void test_SetDIBitsToDevice(void)
     info->bmiHeader.biHeight = -8;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 64], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 64], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 8; i < 48; i++) ok( dib_bits[i] == inverted_data[i + 80], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 8; i < 48; i++) ok( dib_bits[i] == inverted_data[i + 80], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 4, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == inverted_data[i + 112], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 16; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == inverted_data[i + 112], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 16; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -16;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 8; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 24], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 8; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 24], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 4, 8, 8, 0, 7, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == inverted_data[i + 112], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 16; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == inverted_data[i + 112], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 16; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 32; i < 64; i++) ok( dib_bits[i] == inverted_data[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 32; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 32; i < 64; i++) ok( dib_bits[i] == inverted_data[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, -3, 8, 8, 0, 2, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == inverted_data[i - 8], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == inverted_data[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 3, 8, 8, 0, -2, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 24; i < 40; i++) ok( dib_bits[i] == inverted_data[i + 8], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 24; i < 40; i++) ok( dib_bits[i] == inverted_data[i + 8], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 5, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == inverted_data[i - 8], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == inverted_data[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 2, 8, 4, 0, -1, 3, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 5, -7, 8, 16, -2, -4, 0, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 31 || i == 39 || i == 47 || i == 55 || i == 63)
-            ok( dib_bits[i] == inverted_data[i + 1], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == inverted_data[i + 1], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -5;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 8; i < 24; i++) ok( dib_bits[i] == inverted_data[i + 104], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 24; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 8; i < 24; i++) ok( dib_bits[i] == inverted_data[i + 104], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 24; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 5, 4, 2, 2, 6, 3, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 21 || i == 22 || i == 29 || i == 30)
-            ok( dib_bits[i] == inverted_data[i + 89], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == inverted_data[i + 89], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 16, 16, 0, 0, 0, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -8;
@@ -5279,59 +5279,59 @@ static void test_SetDIBitsToDevice(void)
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == data[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == data[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 16; i < 56; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 16; i < 56; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 3, 8, 3, 0, 2, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 24; i < 48; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 24; i < 48; i++) ok( dib_bits[i] == data[i - 16], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 48; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -16;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
-    for (i = 0; i < 56; i++) ok( dib_bits[i] == data[i + 40], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 56; i++) ok( dib_bits[i] == data[i + 40], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 5, -7, 8, 16, -1, -8, 0, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 12, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 6 || i == 7)
-            ok( dib_bits[i] == data[i + 82], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i + 82], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = -5;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 56; i++) ok( dib_bits[i] == data[i - 40], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 56; i++) ok( dib_bits[i] == data[i - 40], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 7, 2, 8, 8, 1, 0, 0, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 47 || i == 55 || i == 63)
-            ok( dib_bits[i] == data[i - 46], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == data[i - 46], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 16, 16, 0, 0, 0, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* b-u -> t-d */
@@ -5339,57 +5339,57 @@ static void test_SetDIBitsToDevice(void)
     info->bmiHeader.biHeight = 8;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 64], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == inverted_data[i + 64], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 16; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 16; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 16;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 7, "got %d\n", ret );
-    for (i = 0; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 4, 4, 8, 8, 0, -4, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 3, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if ((i >= 36 && i <= 39) || (i >= 44 && i <= 47) || (i >= 52 && i <= 55))
-            ok( dib_bits[i] == inverted_data[i + 68], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == inverted_data[i + 68], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 4, 4, 8, 8, -30, -30, 1, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 5, -5, 8, 16, -2, -4, 4, 12, data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
     for (i = 0; i < 64; i++)
         if (i == 7 || i == 15 || i == 23)
-            ok( dib_bits[i] == inverted_data[i + 97], "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == inverted_data[i + 97], "%d: got %08lx\n", i, dib_bits[i] );
         else
-            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+            ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 5;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 2, data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 56; i++) ok( dib_bits[i] == inverted_data[i + 72], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 56; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 16, 16, 0, 0, 0, 5, data, info, DIB_RGB_COLORS );
     ok( ret == 5, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* handling of partial color table */
@@ -5413,7 +5413,7 @@ static void test_SetDIBitsToDevice(void)
         DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 : (info->bmiColors[idx].rgbRed << 16 |
                                                                info->bmiColors[idx].rgbGreen << 8 |
                                                                info->bmiColors[idx].rgbBlue);
-        ok( dib_bits[i] == expect, "%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
+        ok( dib_bits[i] == expect, "%d: got %08lx instead of %08lx\n", i, dib_bits[i], expect );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -5441,7 +5441,7 @@ static void test_SetDIBitsToDevice(void)
         DWORD expect = idx >= info->bmiHeader.biClrUsed ? 0 :
                         (palent[ent].peRed << 16 | palent[ent].peGreen << 8 | palent[ent].peBlue);
         ok( dib_bits[i] == expect || broken(dib_bits[i] == 0),
-            "%d: got %08x instead of %08x\n", i, dib_bits[i], expect );
+            "%d: got %08lx instead of %08lx\n", i, dib_bits[i], expect );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -5506,23 +5506,23 @@ static void test_SetDIBitsToDevice_RLE8(void)
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* startscan and lines are ignored, unless lines == 0 */
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 1, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 0, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biWidth = 2;
@@ -5535,8 +5535,8 @@ static void test_SetDIBitsToDevice_RLE8(void)
     }
     for (i = 0; i < 64; i += 8)
     {
-        ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
-        ok( dib_bits[i+1] == bottom_up[i+1], "%d: got %08x\n", i+1, dib_bits[i+1] );
+        ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
+        ok( dib_bits[i+1] == bottom_up[i+1], "%d: got %08lx\n", i+1, dib_bits[i+1] );
     }
     memset( dib_bits, 0xaa, 64 * 4 );
 
@@ -5544,68 +5544,68 @@ static void test_SetDIBitsToDevice_RLE8(void)
     info->bmiHeader.biHeight = 2;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 2, "got %d\n", ret );
-    for (i = 0; i < 16; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 16; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 9;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 9, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 8;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 1, 9, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == bottom_up[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 3, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 40; i++) ok( dib_bits[i] == bottom_up[i + 24], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 40; i++) ok( dib_bits[i] == bottom_up[i + 24], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 3, 4, 4, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     for (i = 8; i < 40; i++)
-        if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-        else ok( dib_bits[i] == bottom_up[i - 8], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+        if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+        else ok( dib_bits[i] == bottom_up[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 3, 3, 8, 4, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     for (i = 8; i < 40; i++)
-        if ((i & 7) < 3) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-        else ok( dib_bits[i] == bottom_up[i - 11], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+        if ((i & 7) < 3) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+        else ok( dib_bits[i] == bottom_up[i - 11], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 2, 3, 8, 4, 2, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 8; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     for (i = 8; i < 40; i++)
-        if ((i & 7) < 2) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-        else ok( dib_bits[i] == bottom_up[i - 8], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+        if ((i & 7) < 2) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+        else ok( dib_bits[i] == bottom_up[i - 8], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biWidth = 37;
     info->bmiHeader.biHeight = 37;
     ret = SetDIBitsToDevice( hdc, -2, 1, 10, 5, 2, -1, 12, 24, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 37, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     for (i = 24; i < 64; i++)
-        if (i == 52) ok( dib_bits[i] == 0x00808080, "%d: got %08x\n", i, dib_bits[i] );
-        else if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-        else ok( dib_bits[i] == bottom_up[i - 20], "%d: got %08x\n", i, dib_bits[i] );
+        if (i == 52) ok( dib_bits[i] == 0x00808080, "%d: got %08lx\n", i, dib_bits[i] );
+        else if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+        else ok( dib_bits[i] == bottom_up[i - 20], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     /* top-down compressed dibs are invalid */
@@ -5614,7 +5614,7 @@ static void test_SetDIBitsToDevice_RLE8(void)
     SetLastError( 0xdeadbeef );
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 0, "got %d\n", ret );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got %x\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got %lx\n", GetLastError() );
 
     /* top-down dst */
 
@@ -5634,35 +5634,35 @@ static void test_SetDIBitsToDevice_RLE8(void)
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 9, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 8, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 4;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 4, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biHeight = 9;
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 0, 0, 8, 8, 0, 0, 0, 9, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 64; i++) ok( dib_bits[i] == top_down[i], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     ret = SetDIBitsToDevice( hdc, 2, 3, 8, 6, 2, 2, 0, 8, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 9, "got %d\n", ret );
-    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 24; i < 64; i++) ok( dib_bits[i] == top_down[i - 24], "%d: got %08x\n", i, dib_bits[i] );
+    for (i = 0; i < 24; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 24; i < 64; i++) ok( dib_bits[i] == top_down[i - 24], "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
     info->bmiHeader.biWidth = 37;
@@ -5670,10 +5670,10 @@ static void test_SetDIBitsToDevice_RLE8(void)
     ret = SetDIBitsToDevice( hdc, -2, 1, 10, 5, 2, -1, 12, 24, rle8_data, info, DIB_RGB_COLORS );
     ok( ret == 37, "got %d\n", ret );
     for (i = 0; i < 40; i++)
-        if (i == 12) ok( dib_bits[i] == 0x00808080, "%d: got %08x\n", i, dib_bits[i] );
-        else if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
-        else ok( dib_bits[i] == top_down[i + 28], "%d: got %08x\n", i, dib_bits[i] );
-    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+        if (i == 12) ok( dib_bits[i] == 0x00808080, "%d: got %08lx\n", i, dib_bits[i] );
+        else if (i & 4) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
+        else ok( dib_bits[i] == top_down[i + 28], "%d: got %08lx\n", i, dib_bits[i] );
+    for (i = 40; i < 64; i++) ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08lx\n", i, dib_bits[i] );
     memset( dib_bits, 0xaa, 64 * 4 );
 
 cleanup:
@@ -5741,7 +5741,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
     }
 
     status = pD3DKMTCreateDCFromMemory( NULL );
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
 
     for (i = 0; i < ARRAY_SIZE(test_data); ++i)
     {
@@ -5758,19 +5758,19 @@ static void test_D3DKMTCreateDCFromMemory( void )
         create_desc.hBitmap = (void *)0x020baade;
 
         status = pD3DKMTCreateDCFromMemory( &create_desc );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n",
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n",
            test_data[i].name, status);
 
         create_desc.hDeviceDc = CreateCompatibleDC( NULL );
         create_desc.pMemory = NULL;
         status = pD3DKMTCreateDCFromMemory( &create_desc );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n",
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n",
            test_data[i].name, status);
 
         create_desc.pMemory = data;
         create_desc.Height = 0;
         status = pD3DKMTCreateDCFromMemory( &create_desc );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n",
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n",
            test_data[i].name, status);
         ok(create_desc.hDc == (void *)0x010baade, "%s: Got unexpected dc %p.\n",
            test_data[i].name, create_desc.hDc);
@@ -5780,7 +5780,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
         create_desc.Height = 7;
         create_desc.Pitch = 0;
         status = pD3DKMTCreateDCFromMemory( &create_desc );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n",
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n",
            test_data[i].name, status);
         ok(create_desc.hDc == (void *)0x010baade, "%s: Got unexpected dc %p.\n",
            test_data[i].name, create_desc.hDc);
@@ -5790,7 +5790,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
         create_desc.Width = 9;
         create_desc.Pitch = sizeof(*data);
         status = pD3DKMTCreateDCFromMemory( &create_desc );
-        ok(status == test_data[i].status, "%s: Got unexpected status %#x, expected %#x.\n",
+        ok(status == test_data[i].status, "%s: Got unexpected status %#lx, expected %#lx.\n",
            test_data[i].name, status, test_data[i].status);
         if (status == STATUS_SUCCESS)
         {
@@ -5809,9 +5809,9 @@ static void test_D3DKMTCreateDCFromMemory( void )
         }
 
         type = GetObjectType( create_desc.hDc );
-        ok(type == OBJ_MEMDC, "%s: Got unexpected object type %#x.\n", test_data[i].name, type);
+        ok(type == OBJ_MEMDC, "%s: Got unexpected object type %#lx.\n", test_data[i].name, type);
         type = GetObjectType( create_desc.hBitmap );
-        ok(type == OBJ_BITMAP, "%s: Got unexpected object type %#x.\n", test_data[i].name, type);
+        ok(type == OBJ_BITMAP, "%s: Got unexpected object type %#lx.\n", test_data[i].name, type);
         bitmap = GetCurrentObject( create_desc.hDc, OBJ_BITMAP );
         ok(bitmap == create_desc.hBitmap, "%s: Got unexpected bitmap %p, expected %p.\n",
            test_data[i].name, bitmap, create_desc.hBitmap);
@@ -5834,46 +5834,46 @@ static void test_D3DKMTCreateDCFromMemory( void )
         ok(dib.dsBm.bmBits == create_desc.pMemory, "%s: Got unexpected bits %p, expected %p.\n",
            test_data[i].name, dib.dsBm.bmBits, create_desc.pMemory);
 
-        ok(dib.dsBmih.biSize == sizeof(dib.dsBmih), "%s: Got unexpected size %u.\n",
+        ok(dib.dsBmih.biSize == sizeof(dib.dsBmih), "%s: Got unexpected size %lu.\n",
            test_data[i].name, dib.dsBmih.biSize);
-        ok(dib.dsBmih.biWidth == create_desc.Width, "%s: Got unexpected width %d.\n",
+        ok(dib.dsBmih.biWidth == create_desc.Width, "%s: Got unexpected width %ld.\n",
            test_data[i].name, dib.dsBmih.biHeight);
-        ok(dib.dsBmih.biHeight == create_desc.Height, "%s: Got unexpected height %d.\n",
+        ok(dib.dsBmih.biHeight == create_desc.Height, "%s: Got unexpected height %ld.\n",
            test_data[i].name, dib.dsBmih.biHeight);
         ok(dib.dsBmih.biPlanes == 1, "%s: Got unexpected plane count %u.\n",
            test_data[i].name, dib.dsBmih.biPlanes);
         ok(dib.dsBmih.biBitCount == test_data[i].bit_count, "%s: Got unexpected bit count %u.\n",
            test_data[i].name, dib.dsBmih.biBitCount);
         ok(dib.dsBmih.biCompression == (test_data[i].bit_count == 16 ? BI_BITFIELDS : BI_RGB),
-           "%s: Got unexpected compression %#x.\n",
+           "%s: Got unexpected compression %#lx.\n",
            test_data[i].name, dib.dsBmih.biCompression);
-        ok(!dib.dsBmih.biSizeImage, "%s: Got unexpected image size %u.\n",
+        ok(!dib.dsBmih.biSizeImage, "%s: Got unexpected image size %lu.\n",
            test_data[i].name, dib.dsBmih.biSizeImage);
-        ok(!dib.dsBmih.biXPelsPerMeter, "%s: Got unexpected horizontal resolution %d.\n",
+        ok(!dib.dsBmih.biXPelsPerMeter, "%s: Got unexpected horizontal resolution %ld.\n",
            test_data[i].name, dib.dsBmih.biXPelsPerMeter);
-        ok(!dib.dsBmih.biYPelsPerMeter, "%s: Got unexpected vertical resolution %d.\n",
+        ok(!dib.dsBmih.biYPelsPerMeter, "%s: Got unexpected vertical resolution %ld.\n",
            test_data[i].name, dib.dsBmih.biYPelsPerMeter);
         if (test_data[i].format == D3DDDIFMT_P8)
         {
-            ok(dib.dsBmih.biClrUsed == 256, "%s: Got unexpected used colour count %u.\n",
+            ok(dib.dsBmih.biClrUsed == 256, "%s: Got unexpected used colour count %lu.\n",
                test_data[i].name, dib.dsBmih.biClrUsed);
-            ok(dib.dsBmih.biClrImportant == 256, "%s: Got unexpected important colour count %u.\n",
+            ok(dib.dsBmih.biClrImportant == 256, "%s: Got unexpected important colour count %lu.\n",
                test_data[i].name, dib.dsBmih.biClrImportant);
         }
         else
         {
-            ok(!dib.dsBmih.biClrUsed, "%s: Got unexpected used colour count %u.\n",
+            ok(!dib.dsBmih.biClrUsed, "%s: Got unexpected used colour count %lu.\n",
                test_data[i].name, dib.dsBmih.biClrUsed);
-            ok(!dib.dsBmih.biClrImportant, "%s: Got unexpected important colour count %u.\n",
+            ok(!dib.dsBmih.biClrImportant, "%s: Got unexpected important colour count %lu.\n",
                test_data[i].name, dib.dsBmih.biClrImportant);
         }
 
         ok(dib.dsBitfields[0] == test_data[i].mask_r && dib.dsBitfields[1] == test_data[i].mask_g
            && dib.dsBitfields[2] == test_data[i].mask_b,
-           "%s: Got unexpected colour masks 0x%08x 0x%08x 0x%08x.\n",
+           "%s: Got unexpected colour masks 0x%08lx 0x%08lx 0x%08lx.\n",
            test_data[i].name, dib.dsBitfields[0], dib.dsBitfields[1], dib.dsBitfields[2]);
         ok(!dib.dshSection, "%s: Got unexpected section %p.\n", test_data[i].name, dib.dshSection);
-        ok(!dib.dsOffset, "%s: Got unexpected offset %u.\n", test_data[i].name, dib.dsOffset);
+        ok(!dib.dsOffset, "%s: Got unexpected offset %lu.\n", test_data[i].name, dib.dsOffset);
 
         ret = BitBlt( create_desc.hDc, 0, 0, 4, 10, NULL, 0, 0, BLACKNESS );
         ok(ret, "Failed to blit.\n");
@@ -5893,11 +5893,11 @@ static void test_D3DKMTCreateDCFromMemory( void )
         destroy_desc.hBitmap = create_desc.hBitmap;
 
         status = pD3DKMTDestroyDCFromMemory( NULL );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n", test_data[i].name, status);
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n", test_data[i].name, status);
         status = pD3DKMTDestroyDCFromMemory( &destroy_desc );
-        ok(status == STATUS_SUCCESS, "%s: Got unexpected status %#x.\n", test_data[i].name, status);
+        ok(status == STATUS_SUCCESS, "%s: Got unexpected status %#lx.\n", test_data[i].name, status);
         status = pD3DKMTDestroyDCFromMemory( &destroy_desc );
-        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#x.\n", test_data[i].name, status);
+        ok(status == STATUS_INVALID_PARAMETER, "%s: Got unexpected status %#lx.\n", test_data[i].name, status);
 
         ret = DeleteDC( create_desc.hDeviceDc );
         ok(ret, "Failed to delete dc.\n");
@@ -5917,7 +5917,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
                     expected = 0x00000000;
                 else
                     expected = 0xaaaaaaaa >> (32 - test_data[i].bit_count);
-                ok(colour == expected, "%s: Got unexpected colour 0x%08x at %u, %u, expected 0x%08x.\n",
+                ok(colour == expected, "%s: Got unexpected colour 0x%08lx at %u, %u, expected 0x%08lx.\n",
                    test_data[i].name, colour, x, y, expected);
                 if (colour != expected)
                     fail = TRUE;
@@ -5932,7 +5932,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
                         expected = 0x00000000;
                     else
                         expected = CLR_INVALID;
-                    ok(pixel == expected, "%s: got 0x%08x at %u, %u, expect 0x%08x\n", test_data[i].name,
+                    ok(pixel == expected, "%s: got 0x%08lx at %u, %u, expect 0x%08lx\n", test_data[i].name,
                        pixel, x, y, expected);
                 }
             }
@@ -5943,7 +5943,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
     }
 
     alloc_data = VirtualAlloc( NULL, 4096, MEM_COMMIT, PAGE_READWRITE );
-    ok(!!alloc_data, "Failed to allocate memory, error %u.\n", GetLastError());
+    ok(!!alloc_data, "Failed to allocate memory, error %lu.\n", GetLastError());
 
     create_desc.pMemory = alloc_data;
     create_desc.Format = D3DDDIFMT_A8R8G8B8;
@@ -5954,26 +5954,26 @@ static void test_D3DKMTCreateDCFromMemory( void )
     create_desc.pColorTable = NULL;
 
     status = pD3DKMTCreateDCFromMemory( &create_desc );
-    ok(!status, "Got unexpected status %#x.\n", status);
+    ok(!status, "Got unexpected status %#lx.\n", status);
 
     size = VirtualQuery( alloc_data, &memory_info, sizeof(memory_info) );
     ok(size == sizeof(memory_info), "Got unexpected size %u.\n", size);
-    ok(memory_info.State == MEM_COMMIT, "Got state %#x.\n", memory_info.State);
-    ok(memory_info.Protect == PAGE_READWRITE, "Got protection %#x.\n", memory_info.Protect);
+    ok(memory_info.State == MEM_COMMIT, "Got state %#lx.\n", memory_info.State);
+    ok(memory_info.Protect == PAGE_READWRITE, "Got protection %#lx.\n", memory_info.Protect);
 
     destroy_desc.hDc = create_desc.hDc;
     destroy_desc.hBitmap = create_desc.hBitmap;
 
     status = pD3DKMTDestroyDCFromMemory( &destroy_desc );
-    ok(!status, "Got unexpected status %#x.\n", status);
+    ok(!status, "Got unexpected status %#lx.\n", status);
 
     size = VirtualQuery( alloc_data, &memory_info, sizeof(memory_info) );
     ok(size == sizeof(memory_info), "Got unexpected size %u.\n", size);
-    ok(memory_info.State == MEM_COMMIT, "Got state %#x.\n", memory_info.State);
-    ok(memory_info.Protect == PAGE_READWRITE, "Got protection %#x.\n", memory_info.Protect);
+    ok(memory_info.State == MEM_COMMIT, "Got state %#lx.\n", memory_info.State);
+    ok(memory_info.Protect == PAGE_READWRITE, "Got protection %#lx.\n", memory_info.Protect);
 
     ret = VirtualFree( alloc_data, 0, MEM_RELEASE );
-    ok(ret, "Failed to free memory, error %u.\n", GetLastError());
+    ok(ret, "Failed to free memory, error %lu.\n", GetLastError());
 }
 
 START_TEST(bitmap)
diff --git a/dlls/gdi32/tests/brush.c b/dlls/gdi32/tests/brush.c
index 0841eb2f2e1..b23e73ac65f 100644
--- a/dlls/gdi32/tests/brush.c
+++ b/dlls/gdi32/tests/brush.c
@@ -61,15 +61,15 @@ static void test_solidbrush(void)
             stockBrush = NULL;
         memset(&br, 0, sizeof(br));
         ret = GetObjectW(solidBrush, sizeof(br), &br);
-        ok( ret !=0, "GetObject on solid %s brush failed, error=%d\n", stock[i].name, GetLastError());
+        ok( ret !=0, "GetObject on solid %s brush failed, error=%ld\n", stock[i].name, GetLastError());
         ok(br.lbStyle==BS_SOLID, "%s brush has wrong style, got %d expected %d\n", stock[i].name, br.lbStyle, BS_SOLID);
-        ok(br.lbColor==stock[i].color, "%s brush has wrong color, got 0x%08x expected 0x%08x\n", stock[i].name, br.lbColor, stock[i].color);
+        ok(br.lbColor==stock[i].color, "%s brush has wrong color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
 
         if(stockBrush) {
             /* Sanity check, make sure the colors being compared do in fact have a stock brush */
             ret = GetObjectW(stockBrush, sizeof(br), &br);
-            ok( ret !=0, "GetObject on stock %s brush failed, error=%d\n", stock[i].name, GetLastError());
-            ok(br.lbColor==stock[i].color, "stock %s brush unexpected color, got 0x%08x expected 0x%08x\n", stock[i].name, br.lbColor, stock[i].color);
+            ok( ret !=0, "GetObject on stock %s brush failed, error=%ld\n", stock[i].name, GetLastError());
+            ok(br.lbColor==stock[i].color, "stock %s brush unexpected color, got 0x%08lx expected 0x%08lx\n", stock[i].name, br.lbColor, stock[i].color);
         }
 
         DeleteObject(solidBrush);
@@ -92,26 +92,26 @@ static void test_hatch_brush(void)
         brush = CreateHatchBrush( i, RGB(12,34,56) );
         if (i < HS_API_MAX)
         {
-            ok( brush != 0, "%u: CreateHatchBrush failed err %u\n", i, GetLastError() );
+            ok( brush != 0, "%u: CreateHatchBrush failed err %lu\n", i, GetLastError() );
             size = GetObjectW( brush, sizeof(lb), &lb );
             ok( size == sizeof(lb), "wrong size %u\n", size );
-            ok( lb.lbColor == RGB(12,34,56), "wrong color %08x\n", lb.lbColor );
+            ok( lb.lbColor == RGB(12,34,56), "wrong color %08lx\n", lb.lbColor );
             if (i <= HS_DIAGCROSS)
             {
                 ok( lb.lbStyle == BS_HATCHED, "wrong style %u\n", lb.lbStyle );
-                ok( lb.lbHatch == i, "wrong hatch %lu/%u\n", lb.lbHatch, i );
+                ok( lb.lbHatch == i, "wrong hatch %Iu/%u\n", lb.lbHatch, i );
             }
             else
             {
                 ok( lb.lbStyle == BS_SOLID, "wrong style %u\n", lb.lbStyle );
-                ok( lb.lbHatch == 0, "wrong hatch %lu\n", lb.lbHatch );
+                ok( lb.lbHatch == 0, "wrong hatch %Iu\n", lb.lbHatch );
             }
             DeleteObject( brush );
         }
         else
         {
             ok( !brush, "%u: CreateHatchBrush succeeded\n", i );
-            ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
         }
     }
 }
@@ -141,7 +141,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
     DeleteObject( brush );
 
@@ -154,7 +154,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
     ret = GetObjectW( bitmap, sizeof(dib), &dib );
     ok( ret == sizeof(dib.dsBm), "wrong size %u\n", ret );
@@ -180,7 +180,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
     ret = GetObjectW( bitmap, sizeof(dib), &dib );
     ok( ret == sizeof(dib), "wrong size %u\n", ret );
@@ -193,7 +193,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
         "wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
     DeleteObject( brush );
@@ -207,7 +207,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (BITMAPINFO *)br.lbHatch == info || broken(!br.lbHatch), /* nt4 */
         "wrong handle %p/%p\n", (BITMAPINFO *)br.lbHatch, info );
 
@@ -223,7 +223,7 @@ static void test_pattern_brush(void)
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
     ok( br.lbStyle == BS_DIBPATTERN, "wrong style %u\n", br.lbStyle );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( (HGLOBAL)br.lbHatch != mem, "wrong handle %p/%p\n", (HGLOBAL)br.lbHatch, mem );
     bits = GlobalLock( mem );
     ok( (HGLOBAL)br.lbHatch == bits || broken(!br.lbHatch), /* nt4 */
@@ -287,14 +287,14 @@ static void test_pattern_brush(void)
     SetRect( &rect, 0, 0, 16, 16 );
     brush = CreateSolidBrush( 0xff5511 );
     result = FillRect( hdc, &rect, brush );
-    ok( result, "FillRect failed, error %d.\n", GetLastError() );
+    ok( result, "FillRect failed, error %ld.\n", GetLastError() );
     DeleteObject( brush );
     color = GetPixel( hdc, 10, 10 );
-    ok( color == 0xff5511, "Expected color %#x, got %#x.\n", 0xff5511, color );
+    ok( color == 0xff5511, "Expected color %#x, got %#lx.\n", 0xff5511, color );
 
     /* Create a pattern brush with the first bitmap filled with 0xff5511 */
     brush = CreatePatternBrush( bitmap );
-    ok( brush != NULL, "CreatePatternBrush failed, error %u.\n", GetLastError() );
+    ok( brush != NULL, "CreatePatternBrush failed, error %lu.\n", GetLastError() );
 
     /* Delete the first bitmap used for pattern brush creation */
     SelectObject( hdc, bitmap2 );
@@ -303,7 +303,7 @@ static void test_pattern_brush(void)
     memset( &br, 0, sizeof(br) );
     ret = GetObjectW( brush, sizeof(br), &br );
     ok( ret == sizeof(br), "wrong size %u\n", ret );
-    ok( br.lbColor == 0, "wrong color %u\n", br.lbColor );
+    ok( br.lbColor == 0, "wrong color %lu\n", br.lbColor );
     ok( br.lbStyle == BS_PATTERN, "wrong style %u\n", br.lbStyle );
     ok( (HBITMAP)br.lbHatch == bitmap, "wrong handle %p/%p\n", (HBITMAP)br.lbHatch, bitmap );
 
@@ -315,17 +315,17 @@ static void test_pattern_brush(void)
     /* Fill hdc with 0xabcdef */
     brush2 = CreateSolidBrush( 0xabcdef );
     result = FillRect( hdc, &rect, brush2 );
-    ok( result, "FillRect failed, error %d.\n", GetLastError() );
+    ok( result, "FillRect failed, error %ld.\n", GetLastError() );
     color = GetPixel( hdc, 10, 10 );
-    ok( color == 0xabcdef, "Expected color %#x, got %#x.\n", 0xabcdef, color );
+    ok( color == 0xabcdef, "Expected color %#x, got %#lx.\n", 0xabcdef, color );
     DeleteObject( brush2 );
 
     /* Fill hdc with the brush created with the deleted bitmap */
     /* FillRect() succeeds and hdc is filled with the deleted bitmap content */
     result = FillRect( hdc, &rect, brush );
-    ok( result, "FillRect failed, error %d.\n", GetLastError() );
+    ok( result, "FillRect failed, error %ld.\n", GetLastError() );
     color = GetPixel( hdc, 10, 10 );
-    ok( color == 0xff5511, "Expected color %#x, got %#x.\n", 0xff5511, color );
+    ok( color == 0xff5511, "Expected color %#x, got %#lx.\n", 0xff5511, color );
     DeleteObject( brush );
 
     SelectObject( hdc, old_bitmap );
@@ -385,7 +385,7 @@ static void test_palette_brush(void)
         DWORD expect = (pal->palPalEntry[255 - i].peRed << 16 |
                         pal->palPalEntry[255 - i].peGreen << 8 |
                         pal->palPalEntry[255 - i].peBlue);
-        ok( dib_bits[i] == expect, "wrong bits %x/%x at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 );
+        ok( dib_bits[i] == expect, "wrong bits %lx/%lx at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 );
     }
 
     for (i = 0; i < 256; i++) pal->palPalEntry[i].peRed = i * 3;
@@ -398,7 +398,7 @@ static void test_palette_brush(void)
         DWORD expect = (pal->palPalEntry[255 - i].peRed << 16 |
                         pal->palPalEntry[255 - i].peGreen << 8 |
                         pal->palPalEntry[255 - i].peBlue);
-        ok( dib_bits[i] == expect, "wrong bits %x/%x at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 );
+        ok( dib_bits[i] == expect, "wrong bits %lx/%lx at %u,%u\n", dib_bits[i], expect, i % 16, i / 16 );
     }
     DeleteDC( hdc );
     DeleteObject( dib );
@@ -415,11 +415,11 @@ static void test_brush_org( void )
     SetBrushOrgEx( hdc, 0, 0, &old );
 
     SetBrushOrgEx( hdc, 1, 1, &pt );
-    ok( pt.x == 0 && pt.y == 0, "got %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 0 && pt.y == 0, "got %ld,%ld\n", pt.x, pt.y );
     SetBrushOrgEx( hdc, 0x10000, -1, &pt );
-    ok( pt.x == 1 && pt.y == 1, "got %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 1 && pt.y == 1, "got %ld,%ld\n", pt.x, pt.y );
     SetBrushOrgEx( hdc, old.x, old.y, &pt );
-    ok( pt.x == 0x10000 && pt.y == -1, "got %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 0x10000 && pt.y == -1, "got %ld,%ld\n", pt.x, pt.y );
 
     ReleaseDC( 0, hdc );
 }
diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c
index 37a96de2bb4..ce66f9cad09 100644
--- a/dlls/gdi32/tests/clipping.c
+++ b/dlls/gdi32/tests/clipping.c
@@ -132,19 +132,19 @@ static void verify_region(HRGN hrgn, const RECT *rc)
 
     ret = GetRegionData(hrgn, 0, NULL);
     if (IsRectEmpty(rc))
-        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
+        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %lu\n", ret);
     else
-        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
+        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %lu\n", ret);
 
     if (!ret) return;
 
     ret = GetRegionData(hrgn, sizeof(rgn), &rgn.data);
     if (IsRectEmpty(rc))
-        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
+        ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %lu\n", ret);
     else
-        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
+        ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %lu\n", ret);
 
-    trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
+    trace("size %lu, type %lu, count %lu, rgn size %lu, bound %s\n",
           rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
           wine_dbgstr_rect(&rgn.data.rdh.rcBound));
     if (rgn.data.rdh.nCount != 0)
@@ -154,21 +154,21 @@ static void verify_region(HRGN hrgn, const RECT *rc)
         ok(EqualRect(rect, rc), "rects don't match\n");
     }
 
-    ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
-    ok(rgn.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn.data.rdh.iType);
+    ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %lu\n", rgn.data.rdh.dwSize);
+    ok(rgn.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %lu\n", rgn.data.rdh.iType);
     if (IsRectEmpty(rc))
     {
-        ok(rgn.data.rdh.nCount == 0, "expected 0, got %u\n", rgn.data.rdh.nCount);
+        ok(rgn.data.rdh.nCount == 0, "expected 0, got %lu\n", rgn.data.rdh.nCount);
         ok(rgn.data.rdh.nRgnSize == 0 ||
            broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
-           "expected 0, got %u\n", rgn.data.rdh.nRgnSize);
+           "expected 0, got %lu\n", rgn.data.rdh.nRgnSize);
     }
     else
     {
-        ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
+        ok(rgn.data.rdh.nCount == 1, "expected 1, got %lu\n", rgn.data.rdh.nCount);
         ok(rgn.data.rdh.nRgnSize == sizeof(RECT) ||
            broken(rgn.data.rdh.nRgnSize == 168), /* NT4 */
-           "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
+           "expected sizeof(RECT), got %lu\n", rgn.data.rdh.nRgnSize);
     }
     ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
 }
@@ -190,7 +190,7 @@ static void test_ExtCreateRegion(void)
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, 0, NULL);
     ok(!hrgn, "ExtCreateRegion should fail\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     rgn.data.rdh.dwSize = 0;
     rgn.data.rdh.iType = 0;
@@ -202,14 +202,14 @@ static void test_ExtCreateRegion(void)
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data);
     ok(!hrgn, "ExtCreateRegion should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %lu\n", GetLastError());
 
     rgn.data.rdh.dwSize = sizeof(rgn.data.rdh) - 1;
 
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data);
     ok(!hrgn, "ExtCreateRegion should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %lu\n", GetLastError());
 
     /* although XP doesn't care about the type Win9x does */
     rgn.data.rdh.iType = RDH_RECTANGLES;
@@ -218,7 +218,7 @@ static void test_ExtCreateRegion(void)
     /* sizeof(RGNDATAHEADER) is large enough */
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER), &rgn.data);
-    ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError());
+    ok(hrgn != 0, "ExtCreateRegion error %lu\n", GetLastError());
     verify_region(hrgn, &empty_rect);
     DeleteObject(hrgn);
 
@@ -229,11 +229,11 @@ static void test_ExtCreateRegion(void)
     ok(!hrgn, "ExtCreateRegion should fail\n");
     todo_wine
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
-       broken(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %u\n", GetLastError());
+       broken(GetLastError() == 0xdeadbeef), "0xdeadbeef, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data);
-    ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError());
+    ok(hrgn != 0, "ExtCreateRegion error %lu\n", GetLastError());
     verify_region(hrgn, &empty_rect);
     DeleteObject(hrgn);
 
@@ -243,7 +243,7 @@ static void test_ExtCreateRegion(void)
 
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data);
-    ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError());
+    ok(hrgn != 0, "ExtCreateRegion error %lu\n", GetLastError());
     verify_region(hrgn, &rc);
     DeleteObject(hrgn);
 
@@ -256,7 +256,7 @@ static void test_ExtCreateRegion(void)
 
     SetLastError(0xdeadbeef);
     hrgn = ExtCreateRegion(&xform, sizeof(rgn), &rgn.data);
-    ok(hrgn != 0, "ExtCreateRegion error %u/%x\n", GetLastError(), GetLastError());
+    ok(hrgn != 0, "ExtCreateRegion error %lu/%lx\n", GetLastError(), GetLastError());
     verify_region(hrgn, &rc_xformed);
     DeleteObject(hrgn);
 
@@ -269,7 +269,7 @@ static void test_ExtCreateRegion(void)
     hrgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + 2 * sizeof(RECT) - 1, &rgn.data);
     todo_wine
     ok(!hrgn, "ExtCreateRegion should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %lu\n", GetLastError());
 
 }
 
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 2e005f23f3c..c64ef332060 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -44,30 +44,30 @@ static void test_dc_values(void)
 
     ok( hdc != NULL, "CreateDC failed\n" );
     color = SetBkColor( hdc, 0x12345678 );
-    ok( color == 0xffffff, "initial color %08x\n", color );
+    ok( color == 0xffffff, "initial color %08lx\n", color );
     color = GetBkColor( hdc );
-    ok( color == 0x12345678, "wrong color %08x\n", color );
+    ok( color == 0x12345678, "wrong color %08lx\n", color );
     color = SetBkColor( hdc, 0xffffffff );
-    ok( color == 0x12345678, "wrong color %08x\n", color );
+    ok( color == 0x12345678, "wrong color %08lx\n", color );
     color = GetBkColor( hdc );
-    ok( color == 0xffffffff, "wrong color %08x\n", color );
+    ok( color == 0xffffffff, "wrong color %08lx\n", color );
     color = SetBkColor( hdc, 0 );
-    ok( color == 0xffffffff, "wrong color %08x\n", color );
+    ok( color == 0xffffffff, "wrong color %08lx\n", color );
     color = GetBkColor( hdc );
-    ok( color == 0, "wrong color %08x\n", color );
+    ok( color == 0, "wrong color %08lx\n", color );
 
     color = SetTextColor( hdc, 0xffeeddcc );
-    ok( color == 0, "initial color %08x\n", color );
+    ok( color == 0, "initial color %08lx\n", color );
     color = GetTextColor( hdc );
-    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
+    ok( color == 0xffeeddcc, "wrong color %08lx\n", color );
     color = SetTextColor( hdc, 0xffffffff );
-    ok( color == 0xffeeddcc, "wrong color %08x\n", color );
+    ok( color == 0xffeeddcc, "wrong color %08lx\n", color );
     color = GetTextColor( hdc );
-    ok( color == 0xffffffff, "wrong color %08x\n", color );
+    ok( color == 0xffffffff, "wrong color %08lx\n", color );
     color = SetTextColor( hdc, 0 );
-    ok( color == 0xffffffff, "wrong color %08x\n", color );
+    ok( color == 0xffffffff, "wrong color %08lx\n", color );
     color = GetTextColor( hdc );
-    ok( color == 0, "wrong color %08x\n", color );
+    ok( color == 0, "wrong color %08lx\n", color );
 
     extra = GetTextCharacterExtra( hdc );
     ok( extra == 0, "initial extra %d\n", extra );
@@ -84,7 +84,7 @@ static void test_dc_values(void)
     SetLastError(0xdeadbeef);
     attr = SetBkMode(ULongToHandle(0xdeadbeef), OPAQUE);
     ok(!attr, "attr = %x\n", attr);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     attr = GetBkColor(ULongToHandle(0xdeadbeef));
     ok(attr == CLR_INVALID, "attr = %x\n", attr);
@@ -92,7 +92,7 @@ static void test_dc_values(void)
     SetLastError(0xdeadbeef);
     attr = GetDeviceCaps(ULongToHandle(0xdeadbeef), TECHNOLOGY);
     ok(!attr, "GetDeviceCaps rets %d\n", attr);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     DeleteDC( hdc );
 }
@@ -129,7 +129,7 @@ static void test_savedc_2(void)
        ret, wine_dbgstr_rect(&rc));
     ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
     ok(ret == sizeof(RGNDATAHEADER), "got %u\n", ret);
-    ok(!rgndata->rdh.nCount, "got %u rectangles\n", rgndata->rdh.nCount);
+    ok(!rgndata->rdh.nCount, "got %lu rectangles\n", rgndata->rdh.nCount);
     SetRect(&rc, 0, 0, 100, 100);
     ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
        wine_dbgstr_rect(&rc_clip));
@@ -144,7 +144,7 @@ static void test_savedc_2(void)
     ok(ret == 1, "GetClipRgn returned %d instead of 1\n", ret);
     ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
     ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
-    ok(rgndata->rdh.nCount == 1, "got %u rectangles\n", rgndata->rdh.nCount);
+    ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
     SetRect(&rc, 0, 0, 50, 50);
     ok(EqualRect((RECT *)rgndata->Buffer, &rc), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
 
@@ -243,7 +243,7 @@ static void test_savedc(void)
     SetLastError(0xdeadbeef);
     ret = SaveDC(ULongToHandle(0xdeadbeef));
     ok(!ret, "SaveDC returned %u\n", ret);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 }
 
 static void test_GdiConvertToDevmodeW(void)
@@ -263,7 +263,7 @@ static void test_GdiConvertToDevmodeW(void)
     memset(&dmA, 0, sizeof(dmA));
     dmA.dmSize = sizeof(dmA);
     ret = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dmA);
-    ok(ret, "EnumDisplaySettingsExA error %u\n", GetLastError());
+    ok(ret, "EnumDisplaySettingsExA error %lu\n", GetLastError());
     ok(dmA.dmSize >= FIELD_OFFSET(DEVMODEA, dmICMMethod), "dmSize is too small: %04x\n", dmA.dmSize);
     ok(dmA.dmSize <= sizeof(DEVMODEA), "dmSize is too large: %04x\n", dmA.dmSize);
 
@@ -284,7 +284,7 @@ static void test_GdiConvertToDevmodeW(void)
     ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmICMMethod) + sizeof(dmW->dmICMMethod),
        "wrong size %u\n", dmW->dmSize);
     ok(dmW->dmICMMethod == DMICMMETHOD_NONE,
-       "expected DMICMMETHOD_NONE, got %u\n", dmW->dmICMMethod);
+       "expected DMICMMETHOD_NONE, got %lu\n", dmW->dmICMMethod);
     HeapFree(GetProcessHeap(), 0, dmW);
 
     dmA.dmSize = 1024;
@@ -297,13 +297,13 @@ static void test_GdiConvertToDevmodeW(void)
     dmA.dmSize = 0;
     dmW = pGdiConvertToDevmodeW(&dmA);
     ok(!dmW, "GdiConvertToDevmodeW should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", GetLastError());
 
     /* this is the minimal dmSize that XP accepts */
     dmA.dmSize = FIELD_OFFSET(DEVMODEA, dmFields);
     dmW = pGdiConvertToDevmodeW(&dmA);
     ok(dmW->dmSize == FIELD_OFFSET(DEVMODEW, dmFields),
-       "expected %04x, got %04x\n", FIELD_OFFSET(DEVMODEW, dmFields), dmW->dmSize);
+       "expected %04lx, got %04x\n", FIELD_OFFSET(DEVMODEW, dmFields), dmW->dmSize);
     HeapFree(GetProcessHeap(), 0, dmW);
 }
 
@@ -415,7 +415,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
                 type, descr );
         type = SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
         ok( type == (DCB_RESET | DCB_DISABLE) || broken(type == (DCB_SET | DCB_ENABLE)) /* XP */,
-            "SetBoundsRect returned %x for %s (hdc type %d)\n", type, descr, GetObjectType( hdc ) );
+            "SetBoundsRect returned %x for %s (hdc type %ld)\n", type, descr, GetObjectType( hdc ) );
 
         SetMapMode( hdc, MM_TEXT );
         Rectangle( hdc, 2, 2, 4, 4 );
@@ -523,15 +523,15 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
         ret = GetDeviceGammaRamp( hdc, &ramp );
         if (GetObjectType( hdc ) != OBJ_DC || GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER)
         {
-            ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %d)\n", descr, GetObjectType( hdc ) );
+            ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %ld)\n", descr, GetObjectType( hdc ) );
             ok( GetLastError() == ERROR_INVALID_PARAMETER
                 || broken(GetLastError() == 0xdeadbeef) /* nt4 */
                 || broken(GetLastError() == NO_ERROR), /* Printer DC on Win10 1909+ */
-                "wrong error %u on %s\n", GetLastError(), descr );
+                "wrong error %lu on %s\n", GetLastError(), descr );
         }
         else
         {
-            ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %d), error %u\n",
+            ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %ld), error %lu\n",
                 descr, GetObjectType( hdc ), GetLastError() );
         }
     }
@@ -723,11 +723,11 @@ static void test_DC_bitmap(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 00ffffff\n", col);
+    ok( col == 0xffffff, "GetPixel returned %08lx, expected 00ffffff\n", col);
     col = GetPixel( hdcmem, 1, 1);
-    ok( col == 0x000000, "GetPixel returned %08x, expected 00000000\n", col);
+    ok( col == 0x000000, "GetPixel returned %08lx, expected 00000000\n", col);
     col = GetPixel( hdcmem, 100, 1);
-    ok( col == CLR_INVALID, "GetPixel returned %08x, expected ffffffff\n", col);
+    ok( col == CLR_INVALID, "GetPixel returned %08lx, expected ffffffff\n", col);
     SelectObject( hdcmem, oldhbmp);
     DeleteObject( hbmp);
 
@@ -748,10 +748,10 @@ static void test_DC_bitmap(void)
         ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
         col = GetPixel( hdcmem, 0, 0);
         ok( col == 0xffffff,
-            "GetPixel of a bitmap with 16 bits/pixel returned %08x, expected 00ffffff\n", col);
+            "GetPixel of a bitmap with 16 bits/pixel returned %08lx, expected 00ffffff\n", col);
         col = GetPixel( hdcmem, 1, 1);
         ok( col == 0x000000,
-            "GetPixel of a bitmap with 16 bits/pixel returned returned %08x, expected 00000000\n", col);
+            "GetPixel of a bitmap with 16 bits/pixel returned returned %08lx, expected 00000000\n", col);
     }
     if( oldhbmp) SelectObject( hdcmem, oldhbmp);
     DeleteObject( hbmp);
@@ -764,10 +764,10 @@ static void test_DC_bitmap(void)
         ok( oldhbmp != NULL, "SelectObject returned NULL\n" );
         col = GetPixel( hdcmem, 0, 0);
         ok( col == 0xffffff,
-            "GetPixel of a bitmap with 32 bits/pixel returned %08x, expected 00ffffff\n", col);
+            "GetPixel of a bitmap with 32 bits/pixel returned %08lx, expected 00ffffff\n", col);
         col = GetPixel( hdcmem, 1, 1);
         ok( col == 0x000000,
-            "GetPixel of a bitmap with 32 bits/pixel returned returned %08x, expected 00000000\n", col);
+            "GetPixel of a bitmap with 32 bits/pixel returned returned %08lx, expected 00000000\n", col);
     }
     if( oldhbmp) SelectObject( hdcmem, oldhbmp);
     DeleteObject( hbmp);
@@ -1399,13 +1399,13 @@ static void test_printer_dc(void)
     ok( display_memdc != NULL, "CreateCompatibleDC failed for screen\n" );
 
     ret = GetDeviceCaps( hdc, TECHNOLOGY );
-    ok( ret == DT_RASPRINTER, "wrong type %u\n", ret );
+    ok( ret == DT_RASPRINTER, "wrong type %lu\n", ret );
 
     ret = GetDeviceCaps( memdc, TECHNOLOGY );
-    ok( ret == DT_RASPRINTER, "wrong type %u\n", ret );
+    ok( ret == DT_RASPRINTER, "wrong type %lu\n", ret );
 
     ret = GetDeviceCaps( display_memdc, TECHNOLOGY );
-    ok( ret == DT_RASDISPLAY, "wrong type %u\n", ret );
+    ok( ret == DT_RASDISPLAY, "wrong type %lu\n", ret );
 
     bmp = CreateBitmap( 100, 100, 1, GetDeviceCaps( hdc, BITSPIXEL ), NULL );
     orig = SelectObject( memdc, bmp );
@@ -1427,7 +1427,7 @@ static void test_printer_dc(void)
     ok( BitBlt( display_memdc, 10, 10, 20, 20, memdc, 0, 0, SRCCOPY ), "BitBlt failed\n" );
 
     ret = GetPixel( hdc, 0, 0 );
-    ok( ret == CLR_INVALID, "wrong pixel value %x\n", ret );
+    ok( ret == CLR_INVALID, "wrong pixel value %lx\n", ret );
 
     enhmf_dc = CreateEnhMetaFileA( hdc, NULL, NULL, NULL );
     ok(enhmf_dc != 0, "CreateEnhMetaFileA failed\n");
@@ -1463,12 +1463,12 @@ static void print_something(HDC hdc)
     di.lpszDatatype = NULL;
     di.fwType = 0;
     ret = StartDocA(hdc, &di);
-    ok(ret > 0, "StartDoc failed: %d\n", ret);
+    ok(ret > 0, "StartDoc failed: %ld\n", ret);
 
     strcpy(buf + 2, "\n% ===> before DOWNLOADHEADER <===\n");
     *(WORD *)buf = strlen(buf + 2);
     ret = Escape(hdc, POSTSCRIPT_PASSTHROUGH, 0, buf, NULL);
-    ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %d\n", ret);
+    ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %ld\n", ret);
 
     strcpy(buf, "deadbeef");
     ret = ExtEscape(hdc, DOWNLOADHEADER, 0, NULL, sizeof(buf), buf );
@@ -1478,7 +1478,7 @@ static void print_something(HDC hdc)
     strcpy(buf + 2, "\n% ===> after DOWNLOADHEADER <===\n");
     *(WORD *)buf = strlen(buf + 2);
     ret = Escape(hdc, POSTSCRIPT_PASSTHROUGH, 0, buf, NULL);
-    ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %d\n", ret);
+    ok(ret == *(WORD *)buf, "POSTSCRIPT_PASSTHROUGH failed: %ld\n", ret);
 
     ret = EndDoc(hdc);
     ok(ret == 1, "EndDoc failed\n");
@@ -1695,7 +1695,7 @@ static void test_SetPixel(void)
     COLORREF c;
 
     c = SetPixel((HDC)0xdeadbeef, 0, 0, 0);
-    ok(c == ~0, "SetPixel returned: %x\n", c);
+    ok(c == ~0, "SetPixel returned: %lx\n", c);
 }
 
 
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index bdc3d9ed55b..94823e91364 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -1832,10 +1832,10 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         ret = PatBlt(hdc, 10, y, 100, 10, rop3[i]);
 
         if(rop_uses_src(rop3[i]))
-            ok(ret == FALSE || broken(is_ddb), "got TRUE for %x\n", rop3[i]);
+            ok(ret == FALSE || broken(is_ddb), "got TRUE for %lx\n", rop3[i]);
         else
         {
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 20;
         }
 
@@ -1955,7 +1955,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -1982,7 +1982,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2009,7 +2009,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2036,7 +2036,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2073,7 +2073,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2095,7 +2095,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2120,7 +2120,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2144,7 +2144,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         if(!rop_uses_src(rop3[i]))
         {
             ret = PatBlt(hdc, 10 + i, y, 100, 20, rop3[i]);
-            ok(ret, "got FALSE for %x\n", rop3[i]);
+            ok(ret, "got FALSE for %lx\n", rop3[i]);
             y += 25;
         }
     }
@@ -2201,7 +2201,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
                 hatch_brush = CreateHatchBrush(hatch_style, RGB(0xff, 0, 0));
                 SelectObject(hdc, hatch_brush);
                 ret = PatBlt(hdc, 10 + i + 30 * hatch_style, y, 20, 20, rop3[i]);
-                ok(ret, "got FALSE for %x\n", rop3[i]);
+                ok(ret, "got FALSE for %lx\n", rop3[i]);
                 SelectObject(hdc, orig_brush);
                 DeleteObject(hatch_brush);
             }
@@ -2678,19 +2678,19 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
 
             s = SetPixel( hdc, i * 2, j, DIBINDEX(i) );
             g = GetPixel( hdc, i * 2, 0 ); /* retrieve value set with R2_COPYPEN */
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
 
             s = SetPixel( hdc, i * 2, 20 + j, PALETTEINDEX(i) );
             g = GetPixel( hdc, i * 2, 20 + 0 ); /* retrieve value set with R2_COPYPEN */
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
 
             s = SetPixel( hdc, i * 2, 40 + j, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
             g = GetPixel( hdc, i * 2, 40 + 0 ); /* retrieve value set with R2_COPYPEN */
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
 
             s = SetPixel( hdc, i * 2, 60 + j, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) );
             g = GetPixel( hdc, i * 2, 60 + 0 ); /* retrieve value set with R2_COPYPEN */
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
         }
 
         SetROP2( hdc, R2_COPYPEN );
@@ -2699,11 +2699,11 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
         {
             s = SetPixel( hdc, i * 2, 80 + j, (j << 24) | RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ));
             g = GetPixel( hdc, i * 2, 80 + j );
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
 
             s = SetPixel( hdc, i * 2 + 1, 80 + j, (j << 24) | i );
             g = GetPixel( hdc, i * 2 + 1, 80 + j );
-            ok( s == g, "got %08x and %08x\n", s, g );
+            ok( s == g, "got %08lx and %08lx\n", s, g );
         }
     }
 
@@ -3176,10 +3176,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_RGB, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_RGB, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
@@ -3205,10 +3205,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0xff0000, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x00ff00, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0x0000ff, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0xff0000, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x00ff00, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0x0000ff, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
     SelectPalette( mem_dc, default_palette, FALSE );
@@ -3232,10 +3232,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0x0000ff, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x00ff00, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0xff0000, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0x0000ff, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x00ff00, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0xff0000, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
@@ -3258,10 +3258,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0x3ff00000, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x000ffc00, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0x000003ff, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0x3ff00000, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x000ffc00, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0x000003ff, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
@@ -3284,10 +3284,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(mem_dc, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0x0003f000, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x00000fc0, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0x0000003f, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0x0003f000, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x00000fc0, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0x0000003f, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
@@ -3324,10 +3324,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0x7c00, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x03e0, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0x001f, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0x7c00, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x03e0, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0x001f, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
@@ -3349,10 +3349,10 @@ static void test_simple_graphics(void)
     dib = CreateDIBSection(0, bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
     ok(dib != NULL, "ret NULL\n");
     ok(GetObjectW( dib, sizeof(ds), &ds ), "GetObject failed\n");
-    ok(ds.dsBitfields[0] == 0x0f00, "got %08x\n", ds.dsBitfields[0]);
-    ok(ds.dsBitfields[1] == 0x00f0, "got %08x\n", ds.dsBitfields[1]);
-    ok(ds.dsBitfields[2] == 0x000f, "got %08x\n", ds.dsBitfields[2]);
-    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %x\n", ds.dsBmih.biCompression);
+    ok(ds.dsBitfields[0] == 0x0f00, "got %08lx\n", ds.dsBitfields[0]);
+    ok(ds.dsBitfields[1] == 0x00f0, "got %08lx\n", ds.dsBitfields[1]);
+    ok(ds.dsBitfields[2] == 0x000f, "got %08lx\n", ds.dsBitfields[2]);
+    ok(ds.dsBmih.biCompression == BI_BITFIELDS, "got %lx\n", ds.dsBmih.biCompression);
 
     orig_bm = SelectObject(mem_dc, dib);
 
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c
index 54144c44e1c..3d25eacacd9 100644
--- a/dlls/gdi32/tests/driver.c
+++ b/dlls/gdi32/tests/driver.c
@@ -68,15 +68,15 @@ static void test_D3DKMTOpenAdapterFromGdiDisplayName(void)
 
     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);
 
     /* Invalid parameters */
     status = pD3DKMTOpenAdapterFromGdiDisplayName(NULL);
-    ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#lx.\n", status);
 
     memset(&open_adapter_gdi_desc, 0, sizeof(open_adapter_gdi_desc));
     status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
-    ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#lx.\n", status);
 
     /* Open adapter */
     for (i = 0; EnumDisplayDevicesW(NULL, i, &display_device, 0); ++i)
@@ -84,10 +84,10 @@ static void test_D3DKMTOpenAdapterFromGdiDisplayName(void)
         lstrcpyW(open_adapter_gdi_desc.DeviceName, display_device.DeviceName);
         status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
         if (display_device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)
-            ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+            ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
         else
         {
-            ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#x.\n", status);
+            ok(status == STATUS_UNSUCCESSFUL, "Got unexpected return code %#lx.\n", status);
             continue;
         }
 
@@ -97,7 +97,7 @@ static void test_D3DKMTOpenAdapterFromGdiDisplayName(void)
 
         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);
     }
 }
 
@@ -128,7 +128,7 @@ static void test_D3DKMTOpenAdapterFromHdc(void)
         win_skip("D3DKMTOpenAdapterFromHdc() is not supported.\n");
         return;
     }
-    todo_wine ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    todo_wine ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     /* Open adapter */
     for (i = 0; EnumDisplayDevicesW(NULL, i, &display_device, 0); ++i)
@@ -141,7 +141,7 @@ static void test_D3DKMTOpenAdapterFromHdc(void)
         hdc = CreateDCW(0, display_device.DeviceName, 0, NULL);
         open_adapter_hdc_desc.hDc = hdc;
         status = pD3DKMTOpenAdapterFromHdc(&open_adapter_hdc_desc);
-        todo_wine ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+        todo_wine ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
         todo_wine ok(open_adapter_hdc_desc.hAdapter, "Expect not null.\n");
         DeleteDC(hdc);
 
@@ -149,7 +149,7 @@ static void test_D3DKMTOpenAdapterFromHdc(void)
         {
             close_adapter_desc.hAdapter = open_adapter_hdc_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);
         }
     }
 
@@ -159,12 +159,12 @@ static void test_D3DKMTOpenAdapterFromHdc(void)
     status = pD3DKMTOpenAdapterFromHdc(&open_adapter_hdc_desc);
     ReleaseDC(0, hdc);
     todo_wine ok(status == (adapter_count > 1 ? STATUS_INVALID_PARAMETER : STATUS_SUCCESS),
-                 "Got unexpected return code %#x.\n", status);
+                 "Got unexpected return code %#lx.\n", status);
     if (status == STATUS_SUCCESS)
     {
         close_adapter_desc.hAdapter = open_adapter_hdc_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);
     }
 }
 
@@ -181,11 +181,11 @@ static void test_D3DKMTCloseAdapter(void)
 
     /* Invalid parameters */
     status = pD3DKMTCloseAdapter(NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     memset(&close_adapter_desc, 0, sizeof(close_adapter_desc));
     status = pD3DKMTCloseAdapter(&close_adapter_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 }
 
 static void test_D3DKMTCreateDevice(void)
@@ -204,20 +204,20 @@ static void test_D3DKMTCreateDevice(void)
 
     /* Invalid parameters */
     status = pD3DKMTCreateDevice(NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     memset(&create_device_desc, 0, sizeof(create_device_desc));
     status = pD3DKMTCreateDevice(&create_device_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     lstrcpyW(open_adapter_gdi_desc.DeviceName, display1W);
     status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     /* Create device */
     create_device_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     status = pD3DKMTCreateDevice(&create_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     ok(create_device_desc.hDevice, "Expect not null.\n");
     ok(create_device_desc.pCommandBuffer == NULL, "Expect null.\n");
     ok(create_device_desc.CommandBufferSize == 0, "Got wrong value %#x.\n", create_device_desc.CommandBufferSize);
@@ -228,11 +228,11 @@ static void test_D3DKMTCreateDevice(void)
 
     destroy_device_desc.hDevice = create_device_desc.hDevice;
     status = pD3DKMTDestroyDevice(&destroy_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     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 void test_D3DKMTDestroyDevice(void)
@@ -248,11 +248,11 @@ static void test_D3DKMTDestroyDevice(void)
 
     /* Invalid parameters */
     status = pD3DKMTDestroyDevice(NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     memset(&destroy_device_desc, 0, sizeof(destroy_device_desc));
     status = pD3DKMTDestroyDevice(&destroy_device_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 }
 
 static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
@@ -384,21 +384,21 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
 
     /* Invalid parameters */
     status = pD3DKMTCheckVidPnExclusiveOwnership(NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     memset(&check_owner_desc, 0, sizeof(check_owner_desc));
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     /* Test cases */
     lstrcpyW(open_adapter_gdi_desc.DeviceName, display1W);
     status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     memset(&create_device_desc, 0, sizeof(create_device_desc));
     create_device_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     status = pD3DKMTCreateDevice(&create_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     check_owner_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     check_owner_desc.VidPnSourceId = open_adapter_gdi_desc.VidPnSourceId;
@@ -424,7 +424,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
                (status == STATUS_INVALID_PARAMETER && tests1[i].owner_type == D3DKMT_VIDPNSOURCEOWNER_EMULATED)
                || (status == STATUS_SUCCESS && tests1[i].owner_type == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE
                    && tests1[i - 1].owner_type == D3DKMT_VIDPNSOURCEOWNER_EMULATED),
-           "Got unexpected return code %#x at test %d.\n", status, i);
+           "Got unexpected return code %#lx at test %d.\n", status, i);
 
         status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
         /* If don't sleep, D3DKMTCheckVidPnExclusiveOwnership may get STATUS_GRAPHICS_PRESENT_UNOCCLUDED instead
@@ -443,14 +443,14 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
                || (status == STATUS_GRAPHICS_PRESENT_OCCLUDED                               /* win8 */
                    && tests1[i].owner_type == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE
                    && tests1[i - 1].owner_type == D3DKMT_VIDPNSOURCEOWNER_EMULATED),
-           "Got unexpected return code %#x at test %d.\n", status, i);
+           "Got unexpected return code %#lx at test %d.\n", status, i);
     }
 
     /* Set owner and unset owner using different devices */
     memset(&create_device_desc2, 0, sizeof(create_device_desc2));
     create_device_desc2.hAdapter = open_adapter_gdi_desc.hAdapter;
     status = pD3DKMTCreateDevice(&create_device_desc2);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     /* Set owner with the first device */
     set_owner_desc.hDevice = create_device_desc.hDevice;
@@ -459,9 +459,9 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
     set_owner_desc.pVidPnSourceId = &open_adapter_gdi_desc.VidPnSourceId;
     set_owner_desc.VidPnSourceCount = 1;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
-    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#lx.\n", status);
 
     /* Unset owner with the second device */
     set_owner_desc.hDevice = create_device_desc2.hDevice;
@@ -469,10 +469,10 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
     set_owner_desc.pVidPnSourceId = NULL;
     set_owner_desc.VidPnSourceCount = 0;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
     /* No effect */
-    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#lx.\n", status);
 
     /* Unset owner with the first device */
     set_owner_desc.hDevice = create_device_desc.hDevice;
@@ -480,10 +480,10 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
     set_owner_desc.pVidPnSourceId = NULL;
     set_owner_desc.VidPnSourceCount = 0;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
     /* Proves that the correct device is needed to unset owner */
-    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#x.\n",
+    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#lx.\n",
        status);
 
     /* Set owner with the first device, set owner again with the second device */
@@ -504,7 +504,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
             ok(status == tests2[i].expected_set_status1
                    || (status == STATUS_INVALID_PARAMETER                                    /* win8 */
                        && tests2[i].set_owner_type1 == D3DKMT_VIDPNSOURCEOWNER_EMULATED),
-               "Got unexpected return code %#x at test %d.\n", status, i);
+               "Got unexpected return code %#lx at test %d.\n", status, i);
         }
 
         if (tests2[i].set_owner_type2 != -1)
@@ -520,7 +520,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
                        && tests2[i].set_owner_type2 == D3DKMT_VIDPNSOURCEOWNER_EMULATED)
                    || (status == STATUS_SUCCESS && tests2[i].set_owner_type1 == D3DKMT_VIDPNSOURCEOWNER_EMULATED
                        && tests2[i].set_owner_type2 == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE),
-               "Got unexpected return code %#x at test %d.\n", status, i);
+               "Got unexpected return code %#lx at test %d.\n", status, i);
         }
 
         status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
@@ -538,7 +538,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
                || (status == STATUS_GRAPHICS_PRESENT_OCCLUDED                               /* win8 */
                    && tests2[i].set_owner_type2 == D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE
                    && tests2[i].set_owner_type1 == D3DKMT_VIDPNSOURCEOWNER_EMULATED),
-           "Got unexpected return code %#x at test %d.\n", status, i);
+           "Got unexpected return code %#lx at test %d.\n", status, i);
 
         /* Unset owner with first device */
         if (tests2[i].set_owner_type1 != -1)
@@ -548,7 +548,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
             set_owner_desc.pVidPnSourceId = NULL;
             set_owner_desc.VidPnSourceCount = 0;
             status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-            ok(status == STATUS_SUCCESS, "Got unexpected return code %#x at test %d.\n", status, i);
+            ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx at test %d.\n", status, i);
         }
 
         /* Unset owner with second device */
@@ -559,7 +559,7 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
             set_owner_desc.pVidPnSourceId = NULL;
             set_owner_desc.VidPnSourceCount = 0;
             status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-            ok(status == STATUS_SUCCESS, "Got unexpected return code %#x at test %d.\n", status, i);
+            ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx at test %d.\n", status, i);
         }
     }
 
@@ -570,11 +570,11 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
     set_owner_desc.pVidPnSourceId = &open_adapter_gdi_desc.VidPnSourceId;
     set_owner_desc.VidPnSourceCount = 1;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     destroy_device_desc.hDevice = create_device_desc.hDevice;
     status = pD3DKMTDestroyDevice(&destroy_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     set_owner_desc.hDevice = create_device_desc2.hDevice;
     owner_type = D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE;
@@ -584,15 +584,15 @@ static void test_D3DKMTCheckVidPnExclusiveOwnership(void)
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
     /* So ownership is released when device is destroyed. otherwise the return code should be
      * STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE */
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     destroy_device_desc.hDevice = create_device_desc2.hDevice;
     status = pD3DKMTDestroyDevice(&destroy_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     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 void test_D3DKMTSetVidPnSourceOwner(void)
@@ -608,7 +608,7 @@ static void test_D3DKMTSetVidPnSourceOwner(void)
 
     /* Invalid parameters */
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 }
 
 static void test_D3DKMTCheckOcclusion(void)
@@ -635,31 +635,31 @@ static void test_D3DKMTCheckOcclusion(void)
 
     /* NULL parameter check */
     status = pD3DKMTCheckOcclusion(NULL);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     occlusion_desc.hWnd = NULL;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected return code %#lx.\n", status);
 
     hwnd = CreateWindowA("static", "static1", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 200, 200, 0, 0, 0, 0);
     ok(hwnd != NULL, "Failed to create window.\n");
 
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     /* Minimized state doesn't affect D3DKMTCheckOcclusion */
     ShowWindow(hwnd, SW_MINIMIZE);
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     ShowWindow(hwnd, SW_SHOWNORMAL);
 
     /* Invisible state doesn't affect D3DKMTCheckOcclusion */
     ShowWindow(hwnd, SW_HIDE);
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
     ShowWindow(hwnd, SW_SHOW);
 
     /* hwnd2 covers hwnd */
@@ -668,11 +668,11 @@ static void test_D3DKMTCheckOcclusion(void)
 
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     occlusion_desc.hWnd = hwnd2;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     /* Composition doesn't affect D3DKMTCheckOcclusion */
     if (pDwmEnableComposition)
@@ -683,22 +683,22 @@ static void test_D3DKMTCheckOcclusion(void)
         occlusion_desc.hWnd = hwnd;
         status = pD3DKMTCheckOcclusion(&occlusion_desc);
         /* This result means that D3DKMTCheckOcclusion doesn't check composition status despite MSDN says it will */
-        ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+        ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
         occlusion_desc.hWnd = hwnd2;
         status = pD3DKMTCheckOcclusion(&occlusion_desc);
-        ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+        ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
         ShowWindow(hwnd, SW_MINIMIZE);
         occlusion_desc.hWnd = hwnd;
         status = pD3DKMTCheckOcclusion(&occlusion_desc);
-        ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+        ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
         ShowWindow(hwnd, SW_SHOWNORMAL);
 
         ShowWindow(hwnd, SW_HIDE);
         occlusion_desc.hWnd = hwnd;
         status = pD3DKMTCheckOcclusion(&occlusion_desc);
-        ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+        ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
         ShowWindow(hwnd, SW_SHOW);
 
         hr = pDwmEnableComposition(DWM_EC_ENABLECOMPOSITION);
@@ -709,19 +709,19 @@ static void test_D3DKMTCheckOcclusion(void)
 
     lstrcpyW(open_adapter_gdi_desc.DeviceName, display1W);
     status = pD3DKMTOpenAdapterFromGdiDisplayName(&open_adapter_gdi_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     memset(&create_device_desc, 0, sizeof(create_device_desc));
     create_device_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     status = pD3DKMTCreateDevice(&create_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     check_owner_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     check_owner_desc.VidPnSourceId = open_adapter_gdi_desc.VidPnSourceId;
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
     /* D3DKMTCheckVidPnExclusiveOwnership gets STATUS_GRAPHICS_PRESENT_UNOCCLUDED sometimes and with some delay,
      * it will always return STATUS_SUCCESS. So there are some timing issues here. */
-    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#lx.\n", status);
 
     /* Test D3DKMTCheckOcclusion relationship with video present source owner */
     set_owner_desc.hDevice = create_device_desc.hDevice;
@@ -730,7 +730,7 @@ static void test_D3DKMTCheckOcclusion(void)
     set_owner_desc.pVidPnSourceId = &open_adapter_gdi_desc.VidPnSourceId;
     set_owner_desc.VidPnSourceCount = 1;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     for (i = 0; EnumDisplayDevicesW(NULL, i, &display_device, 0); ++i)
     {
@@ -742,31 +742,31 @@ static void test_D3DKMTCheckOcclusion(void)
 
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == expected_occlusion, "Got unexpected return code %#x.\n", status);
+    ok(status == expected_occlusion, "Got unexpected return code %#lx.\n", status);
 
     /* Note hwnd2 is not actually occluded but D3DKMTCheckOcclusion reports STATUS_GRAPHICS_PRESENT_OCCLUDED as well */
     SetWindowPos(hwnd2, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
     ShowWindow(hwnd2, SW_SHOW);
     occlusion_desc.hWnd = hwnd2;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == expected_occlusion, "Got unexpected return code %#x.\n", status);
+    ok(status == expected_occlusion, "Got unexpected return code %#lx.\n", status);
 
     /* Now hwnd is HWND_TOPMOST. Still reports STATUS_GRAPHICS_PRESENT_OCCLUDED */
     ok(SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE), "Failed to SetWindowPos.\n");
     ok(GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST, "No WS_EX_TOPMOST style.\n");
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == expected_occlusion, "Got unexpected return code %#x.\n", status);
+    ok(status == expected_occlusion, "Got unexpected return code %#lx.\n", status);
 
     DestroyWindow(hwnd2);
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == expected_occlusion, "Got unexpected return code %#x.\n", status);
+    ok(status == expected_occlusion, "Got unexpected return code %#lx.\n", status);
 
     check_owner_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     check_owner_desc.VidPnSourceId = open_adapter_gdi_desc.VidPnSourceId;
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
-    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_GRAPHICS_PRESENT_OCCLUDED, "Got unexpected return code %#lx.\n", status);
 
     /* Unset video present source owner */
     set_owner_desc.hDevice = create_device_desc.hDevice;
@@ -774,24 +774,24 @@ static void test_D3DKMTCheckOcclusion(void)
     set_owner_desc.pVidPnSourceId = NULL;
     set_owner_desc.VidPnSourceCount = 0;
     status = pD3DKMTSetVidPnSourceOwner(&set_owner_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     occlusion_desc.hWnd = hwnd;
     status = pD3DKMTCheckOcclusion(&occlusion_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     check_owner_desc.hAdapter = open_adapter_gdi_desc.hAdapter;
     check_owner_desc.VidPnSourceId = open_adapter_gdi_desc.VidPnSourceId;
     status = pD3DKMTCheckVidPnExclusiveOwnership(&check_owner_desc);
-    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS || status == STATUS_GRAPHICS_PRESENT_UNOCCLUDED, "Got unexpected return code %#lx.\n", status);
 
     destroy_device_desc.hDevice = create_device_desc.hDevice;
     status = pD3DKMTDestroyDevice(&destroy_device_desc);
-    ok(status == STATUS_SUCCESS, "Got unexpected return code %#x.\n", status);
+    ok(status == STATUS_SUCCESS, "Got unexpected return code %#lx.\n", status);
 
     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);
     DestroyWindow(hwnd);
 }
 
@@ -812,7 +812,7 @@ static void test_D3DKMTOpenAdapterFromDeviceName_deviface(const GUID *devinterfa
     BOOL ret;
 
     set = SetupDiGetClassDevsW(devinterface_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
-    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed, error %u.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed, error %lu.\n", GetLastError());
 
     iface_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_W *)iface_detail_buffer;
     iface_data->cbSize = sizeof(*iface_data);
@@ -823,16 +823,16 @@ static void test_D3DKMTOpenAdapterFromDeviceName_deviface(const GUID *devinterfa
     {
         ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, iface_data,
                 sizeof(iface_detail_buffer), NULL, &device_data );
-        ok(ret, "Got unexpected ret %d, GetLastError() %u.\n", ret, GetLastError());
+        ok(ret, "Got unexpected ret %d, GetLastError() %lu.\n", ret, GetLastError());
 
         status = pD3DKMTOpenAdapterFromDeviceName(&device_name);
-        todo_wine_if(todo) ok(status == expected_status, "Got status %#x, expected %#x.\n", status, expected_status);
+        todo_wine_if(todo) ok(status == expected_status, "Got status %#lx, expected %#lx.\n", status, expected_status);
 
         if (!status)
         {
             ret = SetupDiGetDevicePropertyW(set, &device_data, &DEVPROPKEY_GPU_LUID, &type,
                     (BYTE *)&luid, sizeof(luid), NULL, 0);
-            ok(ret || GetLastError() == ERROR_NOT_FOUND, "Got unexpected ret %d, GetLastError() %u.\n",
+            ok(ret || GetLastError() == ERROR_NOT_FOUND, "Got unexpected ret %d, GetLastError() %lu.\n",
                     ret, GetLastError());
 
             if (ret)
@@ -847,7 +847,7 @@ static void test_D3DKMTOpenAdapterFromDeviceName_deviface(const GUID *devinterfa
 
             close_adapter_desc.hAdapter = device_name.hAdapter;
             status = pD3DKMTCloseAdapter(&close_adapter_desc);
-            ok(!status, "Got unexpected status %#x.\n", status);
+            ok(!status, "Got unexpected status %#lx.\n", status);
         }
         ++i;
     }
@@ -871,11 +871,11 @@ static void test_D3DKMTOpenAdapterFromDeviceName(void)
         win_skip("D3DKMTOpenAdapterFromDeviceName() is not supported.\n");
         return;
     }
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
 
     memset(&device_name, 0, sizeof(device_name));
     status = pD3DKMTOpenAdapterFromDeviceName(&device_name);
-    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
+    ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
 
     winetest_push_context("GUID_DEVINTERFACE_DISPLAY_ADAPTER");
     test_D3DKMTOpenAdapterFromDeviceName_deviface(&GUID_DEVINTERFACE_DISPLAY_ADAPTER, STATUS_INVALID_PARAMETER, TRUE);
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index bc626d284ca..79de251dc59 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -174,11 +174,11 @@ static void check_font(const char* test, const LOGFONTA* lf, HFONT hfont)
 
     ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
     ok(ret == sizeof(LOGFONTA), "%s: GetObject returned %d\n", test, ret);
-    ok(lf->lfHeight == getobj_lf.lfHeight, "lfHeight: expect %08x got %08x\n", lf->lfHeight, getobj_lf.lfHeight);
-    ok(lf->lfWidth == getobj_lf.lfWidth, "lfWidth: expect %08x got %08x\n", lf->lfWidth, getobj_lf.lfWidth);
-    ok(lf->lfEscapement == getobj_lf.lfEscapement, "lfEscapement: expect %08x got %08x\n", lf->lfEscapement, getobj_lf.lfEscapement);
-    ok(lf->lfOrientation == getobj_lf.lfOrientation, "lfOrientation: expect %08x got %08x\n", lf->lfOrientation, getobj_lf.lfOrientation);
-    ok(lf->lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08x got %08x\n", lf->lfWeight, getobj_lf.lfWeight);
+    ok(lf->lfHeight == getobj_lf.lfHeight, "lfHeight: expect %08lx got %08lx\n", lf->lfHeight, getobj_lf.lfHeight);
+    ok(lf->lfWidth == getobj_lf.lfWidth, "lfWidth: expect %08lx got %08lx\n", lf->lfWidth, getobj_lf.lfWidth);
+    ok(lf->lfEscapement == getobj_lf.lfEscapement, "lfEscapement: expect %08lx got %08lx\n", lf->lfEscapement, getobj_lf.lfEscapement);
+    ok(lf->lfOrientation == getobj_lf.lfOrientation, "lfOrientation: expect %08lx got %08lx\n", lf->lfOrientation, getobj_lf.lfOrientation);
+    ok(lf->lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08lx got %08lx\n", lf->lfWeight, getobj_lf.lfWeight);
     ok(lf->lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf->lfItalic, getobj_lf.lfItalic);
     ok(lf->lfUnderline == getobj_lf.lfUnderline, "lfUnderline: expect %02x got %02x\n", lf->lfUnderline, getobj_lf.lfUnderline);
     ok(lf->lfStrikeOut == getobj_lf.lfStrikeOut, "lfStrikeOut: expect %02x got %02x\n", lf->lfStrikeOut, getobj_lf.lfStrikeOut);
@@ -240,17 +240,17 @@ static INT CALLBACK font_enum_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm,
 
 static void compare_tm(const TEXTMETRICA *tm, const TEXTMETRICA *otm)
 {
-    ok(tm->tmHeight == otm->tmHeight, "tmHeight %d != %d\n", tm->tmHeight, otm->tmHeight);
-    ok(tm->tmAscent == otm->tmAscent, "tmAscent %d != %d\n", tm->tmAscent, otm->tmAscent);
-    ok(tm->tmDescent == otm->tmDescent, "tmDescent %d != %d\n", tm->tmDescent, otm->tmDescent);
-    ok(tm->tmInternalLeading == otm->tmInternalLeading, "tmInternalLeading %d != %d\n", tm->tmInternalLeading, otm->tmInternalLeading);
-    ok(tm->tmExternalLeading == otm->tmExternalLeading, "tmExternalLeading %d != %d\n", tm->tmExternalLeading, otm->tmExternalLeading);
-    ok(tm->tmAveCharWidth == otm->tmAveCharWidth, "tmAveCharWidth %d != %d\n", tm->tmAveCharWidth, otm->tmAveCharWidth);
-    ok(tm->tmMaxCharWidth == otm->tmMaxCharWidth, "tmMaxCharWidth %d != %d\n", tm->tmMaxCharWidth, otm->tmMaxCharWidth);
-    ok(tm->tmWeight == otm->tmWeight, "tmWeight %d != %d\n", tm->tmWeight, otm->tmWeight);
-    ok(tm->tmOverhang == otm->tmOverhang, "tmOverhang %d != %d\n", tm->tmOverhang, otm->tmOverhang);
-    ok(tm->tmDigitizedAspectX == otm->tmDigitizedAspectX, "tmDigitizedAspectX %d != %d\n", tm->tmDigitizedAspectX, otm->tmDigitizedAspectX);
-    ok(tm->tmDigitizedAspectY == otm->tmDigitizedAspectY, "tmDigitizedAspectY %d != %d\n", tm->tmDigitizedAspectY, otm->tmDigitizedAspectY);
+    ok(tm->tmHeight == otm->tmHeight, "tmHeight %ld != %ld\n", tm->tmHeight, otm->tmHeight);
+    ok(tm->tmAscent == otm->tmAscent, "tmAscent %ld != %ld\n", tm->tmAscent, otm->tmAscent);
+    ok(tm->tmDescent == otm->tmDescent, "tmDescent %ld != %ld\n", tm->tmDescent, otm->tmDescent);
+    ok(tm->tmInternalLeading == otm->tmInternalLeading, "tmInternalLeading %ld != %ld\n", tm->tmInternalLeading, otm->tmInternalLeading);
+    ok(tm->tmExternalLeading == otm->tmExternalLeading, "tmExternalLeading %ld != %ld\n", tm->tmExternalLeading, otm->tmExternalLeading);
+    ok(tm->tmAveCharWidth == otm->tmAveCharWidth, "tmAveCharWidth %ld != %ld\n", tm->tmAveCharWidth, otm->tmAveCharWidth);
+    ok(tm->tmMaxCharWidth == otm->tmMaxCharWidth, "tmMaxCharWidth %ld != %ld\n", tm->tmMaxCharWidth, otm->tmMaxCharWidth);
+    ok(tm->tmWeight == otm->tmWeight, "tmWeight %ld != %ld\n", tm->tmWeight, otm->tmWeight);
+    ok(tm->tmOverhang == otm->tmOverhang, "tmOverhang %ld != %ld\n", tm->tmOverhang, otm->tmOverhang);
+    ok(tm->tmDigitizedAspectX == otm->tmDigitizedAspectX, "tmDigitizedAspectX %ld != %ld\n", tm->tmDigitizedAspectX, otm->tmDigitizedAspectX);
+    ok(tm->tmDigitizedAspectY == otm->tmDigitizedAspectY, "tmDigitizedAspectY %ld != %ld\n", tm->tmDigitizedAspectY, otm->tmDigitizedAspectY);
     ok(tm->tmFirstChar == otm->tmFirstChar, "tmFirstChar %d != %d\n", tm->tmFirstChar, otm->tmFirstChar);
     ok(tm->tmLastChar == otm->tmLastChar, "tmLastChar %d != %d\n", tm->tmLastChar, otm->tmLastChar);
     ok(tm->tmDefaultChar == otm->tmDefaultChar, "tmDefaultChar %d != %d\n", tm->tmDefaultChar, otm->tmDefaultChar);
@@ -308,14 +308,14 @@ static void test_font_metrics(const char *context,
         tm = otm.otmTextMetrics;
 if (0) /* these metrics are scaled too, but with rounding errors */
 {
-        ok(otm.otmAscent == tm.tmAscent, "ascent %d != %d\n", otm.otmAscent, tm.tmAscent);
-        ok(otm.otmDescent == -tm.tmDescent, "descent %d != %d\n", otm.otmDescent, -tm.tmDescent);
+        ok(otm.otmAscent == tm.tmAscent, "ascent %d != %ld\n", otm.otmAscent, tm.tmAscent);
+        ok(otm.otmDescent == -tm.tmDescent, "descent %d != %ld\n", otm.otmDescent, -tm.tmDescent);
 }
-        ok(otm.otmMacAscent == tm.tmAscent, "ascent %d != %d\n", otm.otmMacAscent, tm.tmAscent);
+        ok(otm.otmMacAscent == tm.tmAscent, "ascent %d != %ld\n", otm.otmMacAscent, tm.tmAscent);
         ok(otm.otmDescent < 0, "otm.otmDescent should be < 0\n");
         ok(otm.otmMacDescent < 0, "otm.otmMacDescent should be < 0\n");
         ok(tm.tmDescent > 0, "tm.tmDescent should be > 0\n");
-        ok(otm.otmMacDescent == -tm.tmDescent, "descent %d != %d\n", otm.otmMacDescent, -tm.tmDescent);
+        ok(otm.otmMacDescent == -tm.tmDescent, "descent %d != %ld\n", otm.otmMacDescent, -tm.tmDescent);
         if (otm.otmTextMetrics.tmPitchAndFamily & TMPF_TRUETYPE)
             ok(otm.otmEMSquare == 2048, "expected 2048, got %d\n", otm.otmEMSquare);
     }
@@ -327,27 +327,27 @@ if (0) /* these metrics are scaled too, but with rounding errors */
 
     cx = tm.tmAveCharWidth / tm_orig->tmAveCharWidth;
     cy = tm.tmHeight / tm_orig->tmHeight;
-    ok(cx == scale_x && cy == scale_y, "height %d: expected scale_x %d, scale_y %d, got cx %d, cy %d\n",
+    ok(cx == scale_x && cy == scale_y, "height %ld: expected scale_x %d, scale_y %d, got cx %d, cy %d\n",
        lfHeight, scale_x, scale_y, cx, cy);
-    ok(tm.tmHeight == tm_orig->tmHeight * scale_y, "height %d != %d\n", tm.tmHeight, tm_orig->tmHeight * scale_y);
-    ok(tm.tmAscent == tm_orig->tmAscent * scale_y, "ascent %d != %d\n", tm.tmAscent, tm_orig->tmAscent * scale_y);
-    ok(tm.tmDescent == tm_orig->tmDescent * scale_y, "descent %d != %d\n", tm.tmDescent, tm_orig->tmDescent * scale_y);
-    ok(near_match(tm.tmAveCharWidth, tm_orig->tmAveCharWidth * scale_x), "ave width %d != %d\n", tm.tmAveCharWidth, tm_orig->tmAveCharWidth * scale_x);
-    ok(near_match(tm.tmMaxCharWidth, tm_orig->tmMaxCharWidth * scale_x), "max width %d != %d\n", tm.tmMaxCharWidth, tm_orig->tmMaxCharWidth * scale_x);
+    ok(tm.tmHeight == tm_orig->tmHeight * scale_y, "height %ld != %ld\n", tm.tmHeight, tm_orig->tmHeight * scale_y);
+    ok(tm.tmAscent == tm_orig->tmAscent * scale_y, "ascent %ld != %ld\n", tm.tmAscent, tm_orig->tmAscent * scale_y);
+    ok(tm.tmDescent == tm_orig->tmDescent * scale_y, "descent %ld != %ld\n", tm.tmDescent, tm_orig->tmDescent * scale_y);
+    ok(near_match(tm.tmAveCharWidth, tm_orig->tmAveCharWidth * scale_x), "ave width %ld != %ld\n", tm.tmAveCharWidth, tm_orig->tmAveCharWidth * scale_x);
+    ok(near_match(tm.tmMaxCharWidth, tm_orig->tmMaxCharWidth * scale_x), "max width %ld != %ld\n", tm.tmMaxCharWidth, tm_orig->tmMaxCharWidth * scale_x);
 
-    ok(lf.lfHeight == lfHeight, "lfHeight %d != %d\n", lf.lfHeight, lfHeight);
+    ok(lf.lfHeight == lfHeight, "lfHeight %ld != %ld\n", lf.lfHeight, lfHeight);
     if (lf.lfHeight)
     {
         if (lf.lfWidth)
-            ok(lf.lfWidth == tm.tmAveCharWidth, "lfWidth %d != tm %d\n", lf.lfWidth, tm.tmAveCharWidth);
+            ok(lf.lfWidth == tm.tmAveCharWidth, "lfWidth %ld != tm %ld\n", lf.lfWidth, tm.tmAveCharWidth);
     }
     else
-        ok(lf.lfWidth == lfWidth, "lfWidth %d != %d\n", lf.lfWidth, lfWidth);
+        ok(lf.lfWidth == lfWidth, "lfWidth %ld != %ld\n", lf.lfWidth, lfWidth);
 
     GetTextExtentPoint32A(hdc, test_str, test_str_len, &size);
 
-    ok(near_match(size.cx, size_orig->cx * scale_x), "cx %d != %d\n", size.cx, size_orig->cx * scale_x);
-    ok(size.cy == size_orig->cy * scale_y, "cy %d != %d\n", size.cy, size_orig->cy * scale_y);
+    ok(near_match(size.cx, size_orig->cx * scale_x), "cx %ld != %ld\n", size.cx, size_orig->cx * scale_x);
+    ok(size.cy == size_orig->cy * scale_y, "cy %ld != %ld\n", size.cy, size_orig->cy * scale_y);
 
     GetCharWidthA(hdc, 'A', 'A', &width_of_A);
 
@@ -377,7 +377,7 @@ static void test_bitmap_font(void)
         return;
     }
 
-    trace("found bitmap font %s, height %d\n", bitmap_lf.lfFaceName, bitmap_lf.lfHeight);
+    trace("found bitmap font %s, height %ld\n", bitmap_lf.lfFaceName, bitmap_lf.lfHeight);
 
     height_orig = bitmap_lf.lfHeight;
     lfWidth = bitmap_lf.lfWidth;
@@ -536,14 +536,14 @@ static void test_outline_font(void)
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     ok(gm.gmCellIncX == width_orig, "incX %d != %d\n", gm.gmCellIncX, width_orig);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
     /* with a custom matrix */
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat2);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     ok(gm.gmCellIncX == width_orig/2, "incX %d != %d\n", gm.gmCellIncX, width_orig/2);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
 
@@ -606,7 +606,7 @@ static void test_outline_font(void)
 
     SetLastError(0xdeadbeef);
     ret = SetWorldTransform(hdc, &xform);
-    ok(ret, "SetWorldTransform error %u\n", GetLastError());
+    ok(ret, "SetWorldTransform error %lu\n", GetLastError());
 
     test_font_metrics("xform", hdc, hfont, lf.lfHeight, lf.lfWidth, test_str, sizeof(test_str), &otm.otmTextMetrics, &size_orig, width_orig, 1, 1);
 
@@ -614,26 +614,26 @@ static void test_outline_font(void)
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(gm.gmCellIncX == pt.x, "incX %d != %d\n", gm.gmCellIncX, pt.x);
+    ok(gm.gmCellIncX == pt.x, "incX %d != %ld\n", gm.gmCellIncX, pt.x);
     ok(gm.gmCellIncX == 20 * width_orig, "incX %d != %d\n", gm.gmCellIncX, 20 * width_orig);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
     /* with a custom matrix */
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat2);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(gm.gmCellIncX == pt.x/2, "incX %d != %d\n", gm.gmCellIncX, pt.x/2);
+    ok(gm.gmCellIncX == pt.x/2, "incX %d != %ld\n", gm.gmCellIncX, pt.x/2);
     ok(near_match(gm.gmCellIncX, 10 * width_orig), "incX %d != %d\n", gm.gmCellIncX, 10 * width_orig);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
 
     SetLastError(0xdeadbeef);
     ret = SetMapMode(hdc, MM_LOMETRIC);
-    ok(ret == MM_TEXT, "expected MM_TEXT, got %d, error %u\n", ret, GetLastError());
+    ok(ret == MM_TEXT, "expected MM_TEXT, got %d, error %lu\n", ret, GetLastError());
 
     test_font_metrics("lometric", hdc, hfont, lf.lfHeight, lf.lfWidth, test_str, sizeof(test_str), &otm.otmTextMetrics, &size_orig, width_orig, 1, 1);
 
@@ -641,24 +641,24 @@ static void test_outline_font(void)
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(near_match(gm.gmCellIncX, pt.x), "incX %d != %d\n", gm.gmCellIncX, pt.x);
+    ok(near_match(gm.gmCellIncX, pt.x), "incX %d != %ld\n", gm.gmCellIncX, pt.x);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
     /* with a custom matrix */
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat2);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(near_match(gm.gmCellIncX, (pt.x + 1)/2), "incX %d != %d\n", gm.gmCellIncX, (pt.x + 1)/2);
+    ok(near_match(gm.gmCellIncX, (pt.x + 1)/2), "incX %d != %ld\n", gm.gmCellIncX, (pt.x + 1)/2);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
 
     SetLastError(0xdeadbeef);
     ret = SetMapMode(hdc, MM_TEXT);
-    ok(ret == MM_LOMETRIC, "expected MM_LOMETRIC, got %d, error %u\n", ret, GetLastError());
+    ok(ret == MM_LOMETRIC, "expected MM_LOMETRIC, got %d, error %lu\n", ret, GetLastError());
 
     test_font_metrics("text", hdc, hfont, lf.lfHeight, lf.lfWidth, test_str, sizeof(test_str), &otm.otmTextMetrics, &size_orig, width_orig, 1, 1);
 
@@ -666,20 +666,20 @@ static void test_outline_font(void)
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(gm.gmCellIncX == pt.x, "incX %d != %d\n", gm.gmCellIncX, pt.x);
+    ok(gm.gmCellIncX == pt.x, "incX %d != %ld\n", gm.gmCellIncX, pt.x);
     ok(gm.gmCellIncX == 20 * width_orig, "incX %d != %d\n", gm.gmCellIncX, 20 * width_orig);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
     /* with a custom matrix */
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat2);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %d\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %ld\n", GetLastError());
     pt.x = width_orig; pt.y = 0;
     LPtoDP(hdc, &pt, 1);
-    ok(gm.gmCellIncX == pt.x/2, "incX %d != %d\n", gm.gmCellIncX, pt.x/2);
+    ok(gm.gmCellIncX == pt.x/2, "incX %d != %ld\n", gm.gmCellIncX, pt.x/2);
     ok(gm.gmCellIncX == 10 * width_orig, "incX %d != %d\n", gm.gmCellIncX, 10 * width_orig);
     ok(gm.gmCellIncY == 0, "incY %d != 0\n", gm.gmCellIncY);
 
@@ -930,7 +930,7 @@ static void test_bitmap_font_metrics(void)
                 if (font_res == fd[i].dpi && lf.lfCharSet == expected_cs)
                 {
                     todo_wine_if (ret) /* FIXME: Remove once Wine is fixed */
-                        ok(!ret, "%s height %d charset %d dpi %d should be enumerated\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
+                        ok(!ret, "%s height %ld charset %d dpi %d should be enumerated\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
                 }
             }
             if (ret && !(fd[i].height & FH_SCALE))
@@ -941,7 +941,7 @@ static void test_bitmap_font_metrics(void)
 
             SetLastError(0xdeadbeef);
             ret = GetTextFaceA(hdc, sizeof(face_name), face_name);
-            ok(ret, "GetTextFace error %u\n", GetLastError());
+            ok(ret, "GetTextFace error %lu\n", GetLastError());
 
             if (strcmp(face_name, fd[i].face_name) != 0)
             {
@@ -961,7 +961,7 @@ static void test_bitmap_font_metrics(void)
             ok(ret == ERROR_CAN_NOT_COMPLETE || ret == 0xdeadbeef /* Win10 */, "Unexpected error %d.\n", ret);
 
             bRet = GetTextMetricsA(hdc, &tm);
-            ok(bRet, "GetTextMetrics error %d\n", GetLastError());
+            ok(bRet, "GetTextMetrics error %ld\n", GetLastError());
 
             SetLastError(0xdeadbeef);
             ret = GetTextCharset(hdc);
@@ -983,16 +983,16 @@ static void test_bitmap_font_metrics(void)
                 }
                 if (!skipme)
                 {
-                    ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != %d\n", fd[i].face_name, height, tm.tmWeight, fd[i].weight);
+                    ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %ld != %d\n", fd[i].face_name, height, tm.tmWeight, fd[i].weight);
                     if (fd[i].height & FH_SCALE)
-                        ok(tm.tmHeight == fd[i].scaled_height, "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, height, tm.tmHeight, fd[i].scaled_height);
+                        ok(tm.tmHeight == fd[i].scaled_height, "%s(%d): tm.tmHeight %ld != %d\n", fd[i].face_name, height, tm.tmHeight, fd[i].scaled_height);
                     else
-                        ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
-                    ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %d != %d\n", fd[i].face_name, height, tm.tmAscent, fd[i].ascent);
-                    ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %d != %d\n", fd[i].face_name, height, tm.tmDescent, fd[i].descent);
-                    ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): tm.tmInternalLeading %d != %d\n", fd[i].face_name, height, tm.tmInternalLeading, fd[i].int_leading);
-                    ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %d != %d\n", fd[i].face_name, height, tm.tmExternalLeading, fd[i].ext_leading);
-                    ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): tm.tmAveCharWidth %d != %d\n", fd[i].face_name, height, tm.tmAveCharWidth, fd[i].ave_char_width);
+                        ok(tm.tmHeight == fd[i].height, "%s(%d): tm.tmHeight %ld != %d\n", fd[i].face_name, fd[i].height, tm.tmHeight, fd[i].height);
+                    ok(tm.tmAscent == fd[i].ascent, "%s(%d): tm.tmAscent %ld != %d\n", fd[i].face_name, height, tm.tmAscent, fd[i].ascent);
+                    ok(tm.tmDescent == fd[i].descent, "%s(%d): tm.tmDescent %ld != %d\n", fd[i].face_name, height, tm.tmDescent, fd[i].descent);
+                    ok(tm.tmInternalLeading == fd[i].int_leading, "%s(%d): tm.tmInternalLeading %ld != %d\n", fd[i].face_name, height, tm.tmInternalLeading, fd[i].int_leading);
+                    ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %ld != %d\n", fd[i].face_name, height, tm.tmExternalLeading, fd[i].ext_leading);
+                    ok(tm.tmAveCharWidth == fd[i].ave_char_width, "%s(%d): tm.tmAveCharWidth %ld != %d\n", fd[i].face_name, height, tm.tmAveCharWidth, fd[i].ave_char_width);
                     ok(tm.tmFirstChar == fd[i].first_char, "%s(%d): tm.tmFirstChar = %02x\n", fd[i].face_name, height, tm.tmFirstChar);
                     ok(tm.tmLastChar == fd[i].last_char, "%s(%d): tm.tmLastChar = %02x\n", fd[i].face_name, height, tm.tmLastChar);
                     /* Substitutions like MS Sans Serif,0=MS Sans Serif,204
@@ -1005,7 +1005,7 @@ static void test_bitmap_font_metrics(void)
                     /* Don't run the max char width test on System/ANSI_CHARSET.  We have extra characters in our font
                        that make the max width bigger */
                     if ((strcmp(lf.lfFaceName, "System") || lf.lfCharSet != ANSI_CHARSET) && tm.tmDigitizedAspectX == 96)
-                        ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): tm.tmMaxCharWidth %d != %d\n", fd[i].face_name, height, tm.tmMaxCharWidth, fd[i].max_char_width);
+                        ok(tm.tmMaxCharWidth == fd[i].max_char_width, "%s(%d): tm.tmMaxCharWidth %ld != %d\n", fd[i].face_name, height, tm.tmMaxCharWidth, fd[i].max_char_width);
                 }
                 else
                     skip("Skipping font metrics test for system langid 0x%x\n",
@@ -1040,19 +1040,19 @@ static void test_GdiGetCharDimensions(void)
     avgwidth = ((size.cx / 26) + 1) / 2;
 
     ret = pGdiGetCharDimensions(hdc, &tm, &height);
-    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %d instead of %d\n", avgwidth, ret);
-    ok(height == tm.tmHeight, "GdiGetCharDimensions should have set height to %d instead of %d\n", tm.tmHeight, height);
+    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth, ret);
+    ok(height == tm.tmHeight, "GdiGetCharDimensions should have set height to %ld instead of %ld\n", tm.tmHeight, height);
 
     ret = pGdiGetCharDimensions(hdc, &tm, NULL);
-    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %d instead of %d\n", avgwidth, ret);
+    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth, ret);
 
     ret = pGdiGetCharDimensions(hdc, NULL, NULL);
-    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %d instead of %d\n", avgwidth, ret);
+    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth, ret);
 
     height = 0;
     ret = pGdiGetCharDimensions(hdc, NULL, &height);
-    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %d instead of %d\n", avgwidth, ret);
-    ok(height == size.cy, "GdiGetCharDimensions should have set height to %d instead of %d\n", size.cy, height);
+    ok(ret == avgwidth, "GdiGetCharDimensions should have returned width of %ld instead of %ld\n", avgwidth, ret);
+    ok(height == size.cy, "GdiGetCharDimensions should have set height to %ld instead of %ld\n", size.cy, height);
 
     DeleteDC(hdc);
 }
@@ -1327,7 +1327,7 @@ static void test_GetCharABCWidths(void)
             ok(ret, "GetCharABCWidthsA should have succeeded at width %d\n", i);
 
             ok(abc[0].abcA == gm.gmptGlyphOrigin.x,
-               "abcA(%d) and gmptGlyphOrigin.x(%d) values are different at width %d\n",
+               "abcA(%d) and gmptGlyphOrigin.x(%ld) values are different at width %d\n",
                abc[0].abcA, gm.gmptGlyphOrigin.x, i);
             ok(abc[0].abcB == gm.gmBlackBoxX,
                "abcB(%d) and gmBlackBoxX(%d) values are different at width %d\n",
@@ -1420,27 +1420,27 @@ static void test_text_extents(void)
     GetTextMetricsA(hdc, &tm);
     ret = GetTextExtentPointA(hdc, "o", 1, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cy == tm.tmHeight, "cy %d tmHeight %d\n", sz.cy, tm.tmHeight);
+    ok(sz.cy == tm.tmHeight, "cy %ld tmHeight %ld\n", sz.cy, tm.tmHeight);
 
     memset(&sz, 0xcc, sizeof(sz));
     ret = GetTextExtentPointA(hdc, "o", 0, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %ld, cy %ld\n", sz.cx, sz.cy);
 
     memset(&sz, 0xcc, sizeof(sz));
     ret = GetTextExtentPointA(hdc, "", 0, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %ld, cy %ld\n", sz.cx, sz.cy);
 
     memset(&sz, 0xcc, sizeof(sz));
     ret = GetTextExtentPointW(hdc, wt, 0, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %ld, cy %ld\n", sz.cx, sz.cy);
 
     memset(&sz, 0xcc, sizeof(sz));
     ret = GetTextExtentPointW(hdc, L"", 0, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cx == 0 && sz.cy == 0, "cx %d, cy %d\n", sz.cx, sz.cy);
+    ok(sz.cx == 0 && sz.cy == 0, "cx %ld, cy %ld\n", sz.cx, sz.cy);
 
     len = lstrlenW(wt);
     extents = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof extents[0]);
@@ -1449,7 +1449,7 @@ static void test_text_extents(void)
     GetTextExtentExPointW(hdc, wt, len, 32767, &fit1, extents, &sz1);
     GetTextExtentPointW(hdc, wt, len, &sz2);
     ok(sz1.cy == sz2.cy,
-       "cy from GetTextExtentExPointW (%d) and GetTextExtentPointW (%d) differ\n", sz1.cy, sz2.cy);
+       "cy from GetTextExtentExPointW (%ld) and GetTextExtentPointW (%ld) differ\n", sz1.cy, sz2.cy);
     /* Because of the '\n' in the string GetTextExtentExPoint and
        GetTextExtentPoint return different widths under Win2k, but
        under WinXP they return the same width.  So we don't test that
@@ -1522,12 +1522,12 @@ static void test_text_extents(void)
     SetMapMode( hdc, MM_HIMETRIC );
     ret = GetTextExtentExPointW(hdc, wt, 3, 0, NULL, extents, &sz);
     ok(ret, "got %d\n", ret);
-    ok(sz.cx == extents[2], "got %d vs %d\n", sz.cx, extents[2]);
+    ok(sz.cx == extents[2], "got %ld vs %d\n", sz.cx, extents[2]);
 
     ret = GetTextExtentExPointW(hdc, wt, 3, extents[1], &fit1, extents2, &sz2);
     ok(ret, "got %d\n", ret);
     ok(fit1 == 2, "got %d\n", fit1);
-    ok(sz2.cx == sz.cx, "got %d vs %d\n", sz2.cx, sz.cx);
+    ok(sz2.cx == sz.cx, "got %ld vs %ld\n", sz2.cx, sz.cx);
     for(i = 0; i < 2; i++)
         ok(extents2[i] == extents[i], "%d: %d, %d\n", i, extents2[i], extents[i]);
 
@@ -1608,11 +1608,11 @@ static void test_GetGlyphIndices(void)
     {
         flags |= GGI_MARK_NONEXISTING_GLYPHS;
         charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
-        ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
+        ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %ld\n", charcount);
         ok((glyphs[4] == 0x001f || glyphs[4] == 0xffff /* Vista */), "GetGlyphIndicesW should have returned a nonexistent char not %04x\n", glyphs[4]);
         flags = 0;
         charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
-        ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
+        ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %ld\n", charcount);
         ok(glyphs[4] == textm.tmDefaultChar || glyphs[4] == 0x20 /* CJK Windows */,
            "GetGlyphIndicesW should have returned a %04x not %04x\n", textm.tmDefaultChar, glyphs[4]);
     }
@@ -1633,13 +1633,13 @@ static void test_GetGlyphIndices(void)
 
     glyphs[0] = glyphs[1] = 0;
     charcount = GetGlyphIndicesW(hdc, c, ARRAY_SIZE(c), glyphs, GGI_MARK_NONEXISTING_GLYPHS);
-    ok(charcount == ARRAY_SIZE(c), "got %u\n", charcount);
+    ok(charcount == ARRAY_SIZE(c), "got %lu\n", charcount);
     ok(glyphs[0] == 0x001f || glyphs[0] == 0xffff /* Vista */, "got %#x\n", glyphs[0]);
     ok(glyphs[1] == 0x001f || glyphs[1] == 0xffff /* Vista */, "got %#x\n", glyphs[1]);
 
     glyphs[0] = glyphs[1] = 0;
     charcount = GetGlyphIndicesW(hdc, c, ARRAY_SIZE(c), glyphs, 0);
-    ok(charcount == ARRAY_SIZE(c), "got %u\n", charcount);
+    ok(charcount == ARRAY_SIZE(c), "got %lu\n", charcount);
     ok(glyphs[0] == textm.tmDefaultChar || glyphs[0] == 0x20 /* CJK Windows */, "got %#x\n", glyphs[0]);
     ok(glyphs[1] == textm.tmDefaultChar || glyphs[1] == 0x20 /* CJK Windows */, "got %#x\n", glyphs[1]);
 
@@ -1660,12 +1660,12 @@ static void test_GetGlyphIndices(void)
     ok(GetTextMetricsA(hdc, &textm), "GetTextMetric failed\n");
     flags |= GGI_MARK_NONEXISTING_GLYPHS;
     charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
-    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
+    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %ld\n", charcount);
     ok(glyphs[4] == 0xffff, "GetGlyphIndicesW should have returned 0xffff char not %04x\n", glyphs[4]);
     flags = 0;
     testtext[0] = textm.tmDefaultChar;
     charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
-    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
+    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %ld\n", charcount);
     ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
     ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
     DeleteObject(SelectObject(hdc, hOldFont));
@@ -1676,8 +1676,8 @@ static void test_GetGlyphIndices(void)
     ok(font != NULL, "Failed to map font file.\n");
     num_fonts = 0;
     rsrc = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
-    ok(ret != 0, "Failed to add resource, %d.\n", GetLastError());
-    ok(num_fonts == 1, "Unexpected number of fonts %u.\n", num_fonts);
+    ok(ret != 0, "Failed to add resource, %ld.\n", GetLastError());
+    ok(num_fonts == 1, "Unexpected number of fonts %lu.\n", num_fonts);
 
     memset(&lf, 0, sizeof(lf));
     strcpy(lf.lfFaceName, "wine_nul");
@@ -1688,7 +1688,7 @@ static void test_GetGlyphIndices(void)
     ok(GetTextMetricsA(hdc, &textm), "GetTextMetric failed\n");
     testtext[0] = 'T';
     charcount = GetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
-    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
+    ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %ld\n", charcount);
     ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
     ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
     DeleteObject(SelectObject(hdc, hOldFont));
@@ -1696,10 +1696,10 @@ static void test_GetGlyphIndices(void)
     ReleaseDC(0, hdc);
 
     ret = RemoveFontMemResourceEx(rsrc);
-    ok(ret, "RemoveFontMemResourceEx error %d\n", GetLastError());
+    ok(ret, "RemoveFontMemResourceEx error %ld\n", GetLastError());
     free_font(font);
     ret = DeleteFileA(ttf_name);
-    ok(ret, "Failed to delete font file, %d.\n", GetLastError());
+    ok(ret, "Failed to delete font file, %ld.\n", GetLastError());
 }
 
 static void test_GetKerningPairs(void)
@@ -1809,13 +1809,13 @@ static void test_GetKerningPairs(void)
 
         SetLastError(0xdeadbeef);
         uiRet = GetOutlineTextMetricsW(hdc, sizeof(otm), &otm);
-        ok(uiRet == sizeof(otm), "GetOutlineTextMetricsW error %d\n", GetLastError());
+        ok(uiRet == sizeof(otm), "GetOutlineTextMetricsW error %ld\n", GetLastError());
 
-        ok(match_off_by_1(kd[i].tmHeight, otm.otmTextMetrics.tmHeight, FALSE), "expected %d, got %d\n",
+        ok(match_off_by_1(kd[i].tmHeight, otm.otmTextMetrics.tmHeight, FALSE), "expected %ld, got %ld\n",
            kd[i].tmHeight, otm.otmTextMetrics.tmHeight);
-        ok(match_off_by_1(kd[i].tmAscent, otm.otmTextMetrics.tmAscent, FALSE), "expected %d, got %d\n",
+        ok(match_off_by_1(kd[i].tmAscent, otm.otmTextMetrics.tmAscent, FALSE), "expected %ld, got %ld\n",
            kd[i].tmAscent, otm.otmTextMetrics.tmAscent);
-        ok(kd[i].tmDescent == otm.otmTextMetrics.tmDescent, "expected %d, got %d\n",
+        ok(kd[i].tmDescent == otm.otmTextMetrics.tmDescent, "expected %ld, got %ld\n",
            kd[i].tmDescent, otm.otmTextMetrics.tmDescent);
 
         ok(kd[i].otmEMSquare == otm.otmEMSquare, "expected %u, got %u\n",
@@ -1851,17 +1851,17 @@ static void test_GetKerningPairs(void)
         SetLastError(0xdeadbeef);
         ret = GetKerningPairsW(hdc, 0, kern_pair);
         ok(GetLastError() == ERROR_INVALID_PARAMETER,
-           "got error %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
-        ok(ret == 0, "got %u, expected 0\n", ret);
+           "got error %lu, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+        ok(ret == 0, "got %lu, expected 0\n", ret);
 
         ret = GetKerningPairsW(hdc, 100, NULL);
-        ok(ret == total_kern_pairs, "got %u, expected %u\n", ret, total_kern_pairs);
+        ok(ret == total_kern_pairs, "got %lu, expected %lu\n", ret, total_kern_pairs);
 
         ret = GetKerningPairsW(hdc, total_kern_pairs/2, kern_pair);
-        ok(ret == total_kern_pairs/2, "got %u, expected %u\n", ret, total_kern_pairs/2);
+        ok(ret == total_kern_pairs/2, "got %lu, expected %lu\n", ret, total_kern_pairs/2);
 
         ret = GetKerningPairsW(hdc, total_kern_pairs, kern_pair);
-        ok(ret == total_kern_pairs, "got %u, expected %u\n", ret, total_kern_pairs);
+        ok(ret == total_kern_pairs, "got %lu, expected %lu\n", ret, total_kern_pairs);
 
         matches = 0;
 
@@ -1883,7 +1883,7 @@ static void test_GetKerningPairs(void)
             }
         }
 
-        ok(matches == kd[i].total_kern_pairs, "got matches %u, expected %u\n",
+        ok(matches == kd[i].total_kern_pairs, "got matches %lu, expected %lu\n",
            matches, kd[i].total_kern_pairs);
 
         HeapFree(GetProcessHeap(), 0, kern_pair);
@@ -1928,15 +1928,15 @@ static void test_height( HDC hdc, const struct font_data *fd )
 
         old_hfont = SelectObject(hdc, hfont);
         ret = GetTextMetricsA(hdc, &tm);
-        ok(ret, "GetTextMetrics error %d\n", GetLastError());
+        ok(ret, "GetTextMetrics error %ld\n", GetLastError());
         if(fd[i].dpi == tm.tmDigitizedAspectX)
         {
-            ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmWeight, fd[i].weight);
-            ok(match_off_by_1(tm.tmHeight, fd[i].height, fd[i].exact), "%s(%d): tm.tmHeight %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmHeight, fd[i].height);
-            ok(match_off_by_1(tm.tmAscent, fd[i].ascent, fd[i].exact), "%s(%d): tm.tmAscent %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmAscent, fd[i].ascent);
-            ok(match_off_by_1(tm.tmDescent, fd[i].descent, fd[i].exact), "%s(%d): tm.tmDescent %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmDescent, fd[i].descent);
-            ok(match_off_by_1(tm.tmInternalLeading, fd[i].int_leading, fd[i].exact), "%s(%d): tm.tmInternalLeading %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmInternalLeading, fd[i].int_leading);
-            ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %d != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmExternalLeading, fd[i].ext_leading);
+            ok(tm.tmWeight == fd[i].weight, "%s(%d): tm.tmWeight %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmWeight, fd[i].weight);
+            ok(match_off_by_1(tm.tmHeight, fd[i].height, fd[i].exact), "%s(%d): tm.tmHeight %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmHeight, fd[i].height);
+            ok(match_off_by_1(tm.tmAscent, fd[i].ascent, fd[i].exact), "%s(%d): tm.tmAscent %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmAscent, fd[i].ascent);
+            ok(match_off_by_1(tm.tmDescent, fd[i].descent, fd[i].exact), "%s(%d): tm.tmDescent %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmDescent, fd[i].descent);
+            ok(match_off_by_1(tm.tmInternalLeading, fd[i].int_leading, fd[i].exact), "%s(%d): tm.tmInternalLeading %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmInternalLeading, fd[i].int_leading);
+            ok(tm.tmExternalLeading == fd[i].ext_leading, "%s(%d): tm.tmExternalLeading %ld != %d\n", fd[i].face_name, fd[i].requested_height, tm.tmExternalLeading, fd[i].ext_leading);
         }
 
         SelectObject(hdc, old_hfont);
@@ -2123,7 +2123,7 @@ static void test_height_selection_vdmx( HDC hdc )
         }
         ret = DeleteFileA( ttf_name );
         ok(ret || broken(!ret && GetLastError() == ERROR_ACCESS_DENIED),
-           "DeleteFile error %d\n", GetLastError());
+           "DeleteFile error %ld\n", GetLastError());
     }
 }
 
@@ -2170,7 +2170,7 @@ static UINT get_font_fsselection(LOGFONTA *lf)
     otm = HeapAlloc(GetProcessHeap(), 0, otm_size);
     otm->otmSize = sizeof(*otm);
     ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
-    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError());
     fsSelection = otm->otmfsSelection;
     HeapFree(GetProcessHeap(), 0, otm);
     SelectObject(hdc, hfont_old);
@@ -2247,7 +2247,7 @@ static void test_GetOutlineTextMetrics(void)
     SetLastError(0xdeadbeef);
     otm->otmSize = sizeof(*otm);
     ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
-    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError());
     ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
     ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
     ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
@@ -2256,7 +2256,7 @@ static void test_GetOutlineTextMetrics(void)
     memset(otm, 0xAA, otm_size);
     SetLastError(0xdeadbeef);
     ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
-    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError());
     ok(otm->otmpFamilyName != NULL, "expected not NULL got %p\n", otm->otmpFamilyName);
     ok(otm->otmpFaceName != NULL, "expected not NULL got %p\n", otm->otmpFaceName);
     ok(otm->otmpStyleName != NULL, "expected not NULL got %p\n", otm->otmpStyleName);
@@ -2268,7 +2268,7 @@ static void test_GetOutlineTextMetrics(void)
     SetLastError(0xdeadbeef);
     otm->otmSize = sizeof(*otm) - sizeof(char*);
     ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
-    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError());
     ok(otm->otmpFamilyName == NULL, "expected NULL got %p\n", otm->otmpFamilyName);
     ok(otm->otmpFaceName == NULL, "expected NULL got %p\n", otm->otmpFaceName);
     ok(otm->otmpStyleName == NULL, "expected NULL got %p\n", otm->otmpStyleName);
@@ -2277,7 +2277,7 @@ static void test_GetOutlineTextMetrics(void)
     /* check handling of NULL pointer */
     SetLastError(0xdeadbeef);
     ret = GetOutlineTextMetricsA(hdc, otm_size, NULL);
-    ok(ret == otm_size, "expected %u, got %u, error %d\n", otm_size, ret, GetLastError());
+    ok(ret == otm_size, "expected %lu, got %lu, error %ld\n", otm_size, ret, GetLastError());
 
     HeapFree(GetProcessHeap(), 0, otm);
 
@@ -2410,29 +2410,29 @@ static void test_SetTextJustification(void)
     SetTextJustification(hdc, 0, 0);
     GetTextExtentPoint32A(hdc, " ", 1, &expect);
     GetTextExtentPoint32A(hdc, "   ", 3, &size);
-    ok( size.cx == 3 * expect.cx, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == 3 * expect.cx, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 4, 1);
     GetTextExtentPoint32A(hdc, " ", 1, &size);
-    ok( size.cx == expect.cx + 4, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == expect.cx + 4, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 9, 2);
     GetTextExtentPoint32A(hdc, "  ", 2, &size);
-    ok( size.cx == 2 * expect.cx + 9, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == 2 * expect.cx + 9, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 7, 3);
     GetTextExtentPoint32A(hdc, "   ", 3, &size);
-    ok( size.cx == 3 * expect.cx + 7, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == 3 * expect.cx + 7, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 7, 3);
     SetTextCharacterExtra(hdc, 2 );
     GetTextExtentPoint32A(hdc, "   ", 3, &size);
-    ok( size.cx == 3 * (expect.cx + 2) + 7, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == 3 * (expect.cx + 2) + 7, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 0, 0);
     SetTextCharacterExtra(hdc, 0);
     size.cx = size.cy = 1234;
     GetTextExtentPoint32A(hdc, " ", 0, &size);
-    ok( size.cx == 0 && size.cy == 0, "wrong size %d,%d\n", size.cx, size.cy );
+    ok( size.cx == 0 && size.cy == 0, "wrong size %ld,%ld\n", size.cx, size.cy );
     GetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &expect);
     SetTextJustification(hdc, 5, 1);
     GetTextExtentExPointI(hdc, indices, 2, -1, NULL, NULL, &size);
-    ok( size.cx == expect.cx + 5, "wrong size %d/%d\n", size.cx, expect.cx );
+    ok( size.cx == expect.cx + 5, "wrong size %ld/%ld\n", size.cx, expect.cx );
     SetTextJustification(hdc, 0, 0);
 
     SetMapMode( hdc, MM_ANISOTROPIC );
@@ -2446,7 +2446,7 @@ static void test_SetTextJustification(void)
     {
         SetTextCharacterExtra(hdc, i);
         GetTextExtentPoint32A(hdc, "A", 1, &size);
-        ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
+        ok( size.cx == expect.cx + i, "wrong size %ld/%ld+%d\n", size.cx, expect.cx, i );
     }
     SetTextCharacterExtra(hdc, 0);
     GetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &expect);
@@ -2454,7 +2454,7 @@ static void test_SetTextJustification(void)
     {
         SetTextCharacterExtra(hdc, i);
         GetTextExtentExPointI(hdc, indices, 1, -1, NULL, NULL, &size);
-        ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
+        ok( size.cx == expect.cx + i, "wrong size %ld/%ld+%d\n", size.cx, expect.cx, i );
     }
     SetTextCharacterExtra(hdc, 0);
 
@@ -2468,7 +2468,7 @@ static void test_SetTextJustification(void)
     {
         SetTextCharacterExtra(hdc, i);
         GetTextExtentPoint32A(hdc, "A", 1, &size);
-        ok( size.cx == expect.cx + i, "wrong size %d/%d+%d\n", size.cx, expect.cx, i );
+        ok( size.cx == expect.cx + i, "wrong size %ld/%ld+%d\n", size.cx, expect.cx, i );
     }
 
     DeleteObject(hfont);
@@ -2496,7 +2496,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
     lstrcpyA(lf.lfFaceName, "Arial");
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
     hdc = GetDC(0);
     hfont_old = SelectObject(hdc, hfont);
@@ -2506,7 +2506,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
 
     SetLastError(0xdeadbeef);
     ret = GetTextFaceA(hdc, sizeof(name), name);
-    ok(ret, "GetTextFaceA error %u\n", GetLastError());
+    ok(ret, "GetTextFaceA error %lu\n", GetLastError());
 
     if (charset == SYMBOL_CHARSET)
     {
@@ -2529,7 +2529,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
 
     if (pGdiGetCodePage != NULL && pGdiGetCodePage(hdc) != code_page)
     {
-        skip("Font code page %d, looking for code page %d\n",
+        skip("Font code page %ld, looking for code page %d\n",
              pGdiGetCodePage(hdc), code_page);
         ReleaseDC(0, hdc);
         return FALSE;
@@ -2546,7 +2546,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
 
         SetLastError(0xdeadbeef);
         ret = GetGlyphIndicesW(hdc, unicode_buf, count, idx, 0);
-        ok(ret == count, "GetGlyphIndicesW expected %d got %d, error %u\n",
+        ok(ret == count, "GetGlyphIndicesW expected %d got %ld, error %lu\n",
            count, ret, GetLastError());
     }
     else
@@ -2557,7 +2557,7 @@ static BOOL get_glyph_indices(INT charset, UINT code_page, WORD *idx, UINT count
 
         SetLastError(0xdeadbeef);
         ret = GetGlyphIndicesA(hdc, ansi_buf, count, idx, 0);
-        ok(ret == count, "GetGlyphIndicesA expected %d got %d, error %u\n",
+        ok(ret == count, "GetGlyphIndicesA expected %d got %ld, error %lu\n",
            count, ret, GetLastError());
     }
 
@@ -2683,12 +2683,12 @@ static void test_GdiGetCodePage(void)
         lf.lfCharSet = matching_data[i].lfCharSet;
         lstrcpyA(lf.lfFaceName, matching_data[i].lfFaceName);
         hfont = CreateFontIndirectA(&lf);
-        ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+        ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
         hfont = SelectObject(hdc, hfont);
         codepage = pGdiGetCodePage(hdc);
         ok(codepage == matching_data[i].expected_codepage,
-           "GdiGetCodePage should have returned %d, got %d\n", matching_data[i].expected_codepage, codepage);
+           "GdiGetCodePage should have returned %d, got %ld\n", matching_data[i].expected_codepage, codepage);
 
         hfont = SelectObject(hdc, hfont);
         DeleteObject(hfont);
@@ -2696,11 +2696,11 @@ static void test_GdiGetCodePage(void)
         /* CLIP_DFA_DISABLE turns off the font association */
         lf.lfClipPrecision = CLIP_DFA_DISABLE;
         hfont = CreateFontIndirectA(&lf);
-        ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+        ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
         hfont = SelectObject(hdc, hfont);
         codepage = pGdiGetCodePage(hdc);
-        ok(codepage == 1252, "GdiGetCodePage returned %d\n", codepage);
+        ok(codepage == 1252, "GdiGetCodePage returned %ld\n", codepage);
 
         hfont = SelectObject(hdc, hfont);
         DeleteObject(hfont);
@@ -2772,7 +2772,7 @@ static INT CALLBACK arial_enum_proc(const LOGFONTA *lf, const TEXTMETRICA *tm, D
     struct enum_font_data *efd = (struct enum_font_data *)lParam;
     const NEWTEXTMETRICA *ntm = (const NEWTEXTMETRICA *)tm;
 
-    ok(lf->lfHeight == tm->tmHeight, "lfHeight %d != tmHeight %d\n", lf->lfHeight, tm->tmHeight);
+    ok(lf->lfHeight == tm->tmHeight, "lfHeight %ld != tmHeight %ld\n", lf->lfHeight, tm->tmHeight);
 
     if (type != TRUETYPE_FONTTYPE) return 1;
 
@@ -2794,7 +2794,7 @@ static INT CALLBACK arial_enum_procw(const LOGFONTW *lf, const TEXTMETRICW *tm,
     struct enum_font_dataW *efd = (struct enum_font_dataW *)lParam;
     const NEWTEXTMETRICW *ntm = (const NEWTEXTMETRICW *)tm;
 
-    ok(lf->lfHeight == tm->tmHeight, "lfHeight %d != tmHeight %d\n", lf->lfHeight, tm->tmHeight);
+    ok(lf->lfHeight == tm->tmHeight, "lfHeight %ld != tmHeight %ld\n", lf->lfHeight, tm->tmHeight);
 
     if (type != TRUETYPE_FONTTYPE) return 1;
 
@@ -2895,7 +2895,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
         efdw.total = 0;
         SetLastError(0xdeadbeef);
         ret = EnumFontFamiliesW(hdc, NULL, arial_enum_procw, (LPARAM)&efdw);
-        ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesW error %u\n", GetLastError());
+        ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesW error %lu\n", GetLastError());
         if(ret)
         {
             get_charset_statsW(&efdw, &ansi_charset, &symbol_charset, &russian_charset);
@@ -2908,7 +2908,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
         efdw.total = 0;
         SetLastError(0xdeadbeef);
         ret = EnumFontFamiliesExW(hdc, NULL, arial_enum_procw, (LPARAM)&efdw, 0);
-        ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesExW error %u\n", GetLastError());
+        ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED, "EnumFontFamiliesExW error %lu\n", GetLastError());
         if(ret)
         {
             get_charset_statsW(&efdw, &ansi_charset, &symbol_charset, &russian_charset);
@@ -2922,7 +2922,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
     efd.total = 0;
     SetLastError(0xdeadbeef);
     ret = EnumFontFamiliesA(hdc, font_name, arial_enum_proc, (LPARAM)&efd);
-    ok(ret, "EnumFontFamilies error %u\n", GetLastError());
+    ok(ret, "EnumFontFamilies error %lu\n", GetLastError());
     get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
     if (*font_name)
         ok(efd.total > 0, "no fonts enumerated: %s\n", font_name);
@@ -2943,7 +2943,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
     efd.total = 0;
     SetLastError(0xdeadbeef);
     ret = EnumFontFamiliesExA(hdc, &lf, arial_enum_proc, (LPARAM)&efd, 0);
-    ok(ret, "EnumFontFamiliesEx error %u\n", GetLastError());
+    ok(ret, "EnumFontFamiliesEx error %lu\n", GetLastError());
     get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
     if (font_charset == SYMBOL_CHARSET)
     {
@@ -2971,7 +2971,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
     efd.total = 0;
     SetLastError(0xdeadbeef);
     EnumFontFamiliesExA(hdc, &lf, arial_enum_proc, (LPARAM)&efd, 0);
-    ok(ret, "EnumFontFamiliesEx error %u\n", GetLastError());
+    ok(ret, "EnumFontFamiliesEx error %lu\n", GetLastError());
     get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
     ok(efd.total > 0, "no fonts enumerated: %s DEFAULT_CHARSET\n", font_name);
     for (i = 0; i < efd.total; i++)
@@ -3026,7 +3026,7 @@ static void test_EnumFontFamilies(const char *font_name, INT font_charset)
     efd.total = 0;
     SetLastError(0xdeadbeef);
     EnumFontFamiliesExA(hdc, &lf, arial_enum_proc, (LPARAM)&efd, 0);
-    ok(ret, "EnumFontFamiliesEx error %u\n", GetLastError());
+    ok(ret, "EnumFontFamiliesEx error %lu\n", GetLastError());
     get_charset_stats(&efd, &ansi_charset, &symbol_charset, &russian_charset);
     if (*font_name && font_charset == ANSI_CHARSET)
         ok(efd.total == 0, "no fonts should be enumerated: %s SYMBOL_CHARSET\n", font_name);
@@ -3187,7 +3187,7 @@ static void test_negative_width(HDC hdc, const LOGFONTA *lf)
 
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(lf);
-    ok(hfont != 0, "CreateFontIndirect error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirect error %lu\n", GetLastError());
     check_font("original", lf, hfont);
 
     hfont_prev = SelectObject(hdc, hfont);
@@ -3205,14 +3205,14 @@ static void test_negative_width(HDC hdc, const LOGFONTA *lf)
     memset(&gm1, 0xab, sizeof(gm1));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'x', GGO_METRICS, &gm1, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutline error 0x%x\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutline error 0x%lx\n", GetLastError());
 
     SelectObject(hdc, hfont_prev);
     DeleteObject(hfont);
 
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(&lf2);
-    ok(hfont != 0, "CreateFontIndirect error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirect error %lu\n", GetLastError());
     check_font("negative width", &lf2, hfont);
 
     hfont_prev = SelectObject(hdc, hfont);
@@ -3220,7 +3220,7 @@ static void test_negative_width(HDC hdc, const LOGFONTA *lf)
     memset(&gm2, 0xbb, sizeof(gm2));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'x', GGO_METRICS, &gm2, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutline error 0x%x\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutline error 0x%lx\n", GetLastError());
 
     SelectObject(hdc, hfont_prev);
     DeleteObject(hfont);
@@ -3231,7 +3231,7 @@ static void test_negative_width(HDC hdc, const LOGFONTA *lf)
        gm1.gmptGlyphOrigin.y == gm2.gmptGlyphOrigin.y &&
        gm1.gmCellIncX == gm2.gmCellIncX &&
        gm1.gmCellIncY == gm2.gmCellIncY,
-       "gm1=%d,%d,%d,%d,%d,%d gm2=%d,%d,%d,%d,%d,%d\n",
+       "gm1=%d,%d,%ld,%ld,%d,%d gm2=%d,%d,%ld,%ld,%d,%d\n",
        gm1.gmBlackBoxX, gm1.gmBlackBoxY, gm1.gmptGlyphOrigin.x,
        gm1.gmptGlyphOrigin.y, gm1.gmCellIncX, gm1.gmCellIncY,
        gm2.gmBlackBoxX, gm2.gmBlackBoxY, gm2.gmptGlyphOrigin.x,
@@ -3439,7 +3439,7 @@ static BOOL get_first_last_from_cmap(HDC hdc, DWORD *first, DWORD *last, cmap_ty
 
     header = HeapAlloc(GetProcessHeap(), 0, size);
     ret = GetFontData(hdc, MS_CMAP_TAG, 0, header, size);
-    ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
+    ok(ret == size, "GetFontData should return %lu not %lu\n", size, ret);
     ok(GET_BE_WORD(header->version) == 0, "got cmap version %d\n", GET_BE_WORD(header->version));
 
     cmap = get_cmap(header, 3, 1);
@@ -3700,7 +3700,7 @@ static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_
 
     data = HeapAlloc(GetProcessHeap(), 0, size);
     ret = GetFontData(hdc, MS_NAME_TAG, 0, data, size);
-    ok(ret == size, "GetFontData should return %u not %u\n", size, ret);
+    ok(ret == size, "GetFontData should return %lu not %lu\n", size, ret);
 
     header = (void *)data;
     header->format = GET_BE_WORD(header->format);
@@ -3718,7 +3718,7 @@ static BOOL get_ttf_nametable_entry(HDC hdc, WORD name_id, WCHAR *out_buf, SIZE_
     }
     if (header->storage_offset >= size)
     {
-        skip("storage_offset %u > size %u\n", header->storage_offset, size);
+        skip("storage_offset %u > size %lu\n", header->storage_offset, size);
         goto out;
     }
 
@@ -3777,7 +3777,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
 
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(lf);
-    ok(hfont != 0, "CreateFontIndirect error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirect error %lu\n", GetLastError());
 
     hfont_old = SelectObject(hdc, hfont);
 
@@ -3789,18 +3789,18 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
     }
     if (size > sizeof(tt_os2))
     {
-        trace("got too large OS/2 chunk of size %u\n", size);
+        trace("got too large OS/2 chunk of size %lu\n", size);
         size = sizeof(tt_os2);
     }
 
     memset(&tt_os2, 0, sizeof(tt_os2));
     ret = GetFontData(hdc, MS_OS2_TAG, 0, &tt_os2, size);
-    ok(ret >= TT_OS2_V0_SIZE && ret <= size, "GetFontData should return size from [%u,%u] not %u\n", TT_OS2_V0_SIZE,
+    ok(ret >= TT_OS2_V0_SIZE && ret <= size, "GetFontData should return size from [%lu,%lu] not %lu\n", TT_OS2_V0_SIZE,
         size, ret);
 
     SetLastError(0xdeadbeef);
     ret = GetTextMetricsA(hdc, &tmA);
-    ok(ret, "GetTextMetricsA error %u\n", GetLastError());
+    ok(ret, "GetTextMetricsA error %lu\n", GetLastError());
 
     if(!get_first_last_from_cmap(hdc, &cmap_first, &cmap_last, &cmap_type))
     {
@@ -3823,19 +3823,19 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         /* NEWTEXTMETRIC's scaling method is different from TEXTMETRIC's */
 #define SCALE_NTM(value) (MulDiv(ntm->tmHeight, (value), cell_height))
         size = MulDiv(32, ntm->ntmCellHeight, ntm->ntmSizeEM);
-        ok(ntm->tmHeight == size, "%s: ntm->tmHeight %d != %d (%u/%u)\n",
+        ok(ntm->tmHeight == size, "%s: ntm->tmHeight %ld != %ld (%u/%u)\n",
            font_name, ntm->tmHeight, size, ntm->ntmCellHeight, ntm->ntmSizeEM);
         size = SCALE_NTM(ntm->ntmAvgWidth);
-        ok(ntm->tmAveCharWidth == size, "%s: ntm->tmAveCharWidth %d != %d (%u/%u,%d)\n",
+        ok(ntm->tmAveCharWidth == size, "%s: ntm->tmAveCharWidth %ld != %ld (%u/%u,%ld)\n",
            font_name, ntm->tmAveCharWidth, size, ntm->ntmAvgWidth, cell_height, ntm->tmHeight);
         size = SCALE_NTM(ascent);
-        ok(ntm->tmAscent == size, "%s: ntm->tmAscent %d != %d (%u/%u,%d)\n",
+        ok(ntm->tmAscent == size, "%s: ntm->tmAscent %ld != %ld (%u/%u,%ld)\n",
            font_name, ntm->tmAscent, size, ascent, cell_height, ntm->tmHeight);
         size = ntm->tmHeight - ntm->tmAscent;
-        ok(ntm->tmDescent == size, "%s: ntm->tmDescent %d != %d (%u/%u,%d)\n",
+        ok(ntm->tmDescent == size, "%s: ntm->tmDescent %ld != %ld (%u/%u,%ld)\n",
            font_name, ntm->tmDescent, size, descent, cell_height, ntm->tmHeight);
         size = SCALE_NTM(cell_height - ntm->ntmSizeEM);
-        ok(ntm->tmInternalLeading == size, "%s: ntm->tmInternalLeading %d != %d (%u/%u,%d)\n",
+        ok(ntm->tmInternalLeading == size, "%s: ntm->tmInternalLeading %ld != %ld (%u/%u,%ld)\n",
            font_name, ntm->tmInternalLeading, size, cell_height - ntm->ntmSizeEM, cell_height, ntm->tmHeight);
 #undef SCALE_NTM
 
@@ -3847,7 +3847,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         break_char = GET_BE_WORD(tt_os2.usBreakChar);
 
         if (winetest_debug > 1)
-            trace("font %s charset %u: %x-%x (%x-%x) default %x break %x OS/2 version %u vendor %4.4s\n",
+            trace("font %s charset %u: %x-%x (%lx-%lx) default %x break %x OS/2 version %u vendor %4.4s\n",
                   font_name, lf->lfCharSet, os2_first_char, os2_last_char, cmap_first, cmap_last,
                   default_char, break_char, version, (LPCSTR)&tt_os2.achVendID);
 
@@ -3906,7 +3906,7 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
         SetLastError(0xdeadbeef);
         ret = GetTextMetricsW(hdc, &tmW);
         ok(ret || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
-           "GetTextMetricsW error %u\n", GetLastError());
+           "GetTextMetricsW error %lu\n", GetLastError());
         if (ret)
         {
             /* Wine uses the os2 first char */
@@ -3926,10 +3926,10 @@ static void test_text_metrics(const LOGFONTA *lf, const NEWTEXTMETRICA *ntm)
 
             /* Test the aspect ratio while we have tmW */
             ret = GetDeviceCaps(hdc, LOGPIXELSX);
-            ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectX %u != %u\n",
+            ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectX %lu != %lu\n",
                tmW.tmDigitizedAspectX, ret);
             ret = GetDeviceCaps(hdc, LOGPIXELSY);
-            ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectY %u != %u\n",
+            ok(tmW.tmDigitizedAspectX == ret, "W: tmDigitizedAspectY %lu != %lu\n",
                tmW.tmDigitizedAspectX, ret);
         }
     }
@@ -4261,7 +4261,7 @@ static void test_RealizationInfo(void)
     memset(info, 0xcc, sizeof(info));
     r = pGdiRealizationInfo(hdc, info);
     ok(r != 0, "ret 0\n");
-    ok((info[0] & 0xf) == 1, "info[0] = %x for the system font\n", info[0]);
+    ok((info[0] & 0xf) == 1, "info[0] = %lx for the system font\n", info[0]);
     ok(info[3] == 0xcccccccc, "structure longer than 3 dwords\n");
 
     if (!is_truetype_font_installed("Tahoma"))
@@ -4281,7 +4281,7 @@ static void test_RealizationInfo(void)
     memset(info, 0xcc, sizeof(info));
     r = pGdiRealizationInfo(hdc, info);
     ok(r != 0, "ret 0\n");
-    ok((info[0] & 0xf) == 3, "info[0] = %x for arial\n", info[0]);
+    ok((info[0] & 0xf) == 3, "info[0] = %lx for arial\n", info[0]);
     ok(info[3] == 0xcccccccc, "structure longer than 3 dwords\n");
 
     if (pGetFontRealizationInfo)
@@ -4303,11 +4303,11 @@ static void test_RealizationInfo(void)
         ok(r != 0, "ret 0\n");
         /* We may get the '24' version here if that has been previously
            requested. */
-        ok(fri->size == 16 || fri->size == 24, "got %d\n", info2[0]);
+        ok(fri->size == 16 || fri->size == 24, "got %ld\n", info2[0]);
         ok(fri->flags == ri->flags, "flags mismatch\n");
         ok(fri->cache_num == ri->cache_num, "cache_num mismatch\n");
         ok(fri->instance_id == ri->instance_id, "instance id mismatch\n");
-        ok(info2[6] == 0xcccccccc, "got wrong dword 6, 0x%08x\n", info2[6]);
+        ok(info2[6] == 0xcccccccc, "got wrong dword 6, 0x%08lx\n", info2[6]);
 
         memset(info2, 0xcc, sizeof(info2));
         info2[0] = 28;
@@ -4318,7 +4318,7 @@ static void test_RealizationInfo(void)
         info2[0] = 24;
         r = pGetFontRealizationInfo(hdc, info2);
         ok(r != 0, "ret 0\n");
-        ok(fri->size == 24, "got %d\n", fri->size);
+        ok(fri->size == 24, "got %ld\n", fri->size);
         ok(fri->flags == ri->flags, "flags mismatch\n");
         ok(fri->cache_num == ri->cache_num, "cache_num mismatch\n");
         ok(fri->instance_id == ri->instance_id, "instance id mismatch\n");
@@ -4330,18 +4330,18 @@ static void test_RealizationInfo(void)
         /* invalid font id */
         SetLastError(0xdeadbeef);
         r = pGetFontFileInfo(0xabababab, 0, &file_info, sizeof(file_info), &needed);
-        ok(r == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "ret %d gle %d\n", r, GetLastError());
+        ok(r == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "ret %d gle %ld\n", r, GetLastError());
 
         needed = 0;
         r = pGetFontFileInfo(fri->instance_id, 0, &file_info, sizeof(file_info), &needed);
-        ok(r != 0, "Failed to get font file info, error %d.\n", GetLastError());
+        ok(r != 0, "Failed to get font file info, error %ld.\n", GetLastError());
 
         if (r)
         {
             ok(needed > 0 && needed < sizeof(file_info), "Unexpected required size.\n");
 
             h = CreateFileW(file_info.path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
-            ok(h != INVALID_HANDLE_VALUE, "Unable to open file %d\n", GetLastError());
+            ok(h != INVALID_HANDLE_VALUE, "Unable to open file %ld\n", GetLastError());
 
             GetFileTime(h, NULL, NULL, &time);
             ok(!CompareFileTime(&file_info.time, &time), "time mismatch\n");
@@ -4355,12 +4355,12 @@ static void test_RealizationInfo(void)
             /* shorter buffer */
             SetLastError(0xdeadbeef);
             r = pGetFontFileInfo(fri->instance_id, 0, &file_info, needed - 1, &needed);
-            ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %d\n", r, GetLastError());
+            ok(r == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "ret %d gle %ld\n", r, GetLastError());
         }
 
         /* Get bytes 2 - 16 using GetFontFileData */
         r = pGetFontFileData(fri->instance_id, 0, 2, data, sizeof(data));
-        ok(r != 0, "ret 0 gle %d\n", GetLastError());
+        ok(r != 0, "ret 0 gle %ld\n", GetLastError());
 
         ok(!memcmp(data, file + 2, sizeof(data)), "mismatch\n");
     }
@@ -4488,8 +4488,8 @@ static void test_orientation(void)
     hfont = create_font("orientation", &lf);
     old_hfont = SelectObject(hdc, hfont);
     ok(GetTextExtentExPointA(hdc, test_str, sizeof(test_str), 32767, NULL, NULL, &size), "GetTextExtentExPointA failed\n");
-    ok(near_match(311, size.cx), "cx should be about 311, got %d\n", size.cx);
-    ok(near_match(75, size.cy), "cy should be about 75, got %d\n", size.cy);
+    ok(near_match(311, size.cx), "cx should be about 311, got %ld\n", size.cx);
+    ok(near_match(75, size.cy), "cy should be about 75, got %ld\n", size.cy);
     SelectObject(hdc, old_hfont);
     DeleteObject(hfont);
     DeleteDC(hdc);
@@ -4518,7 +4518,7 @@ static void test_oemcharset(void)
     ok(!lstrcmpA(clf.lfFaceName, lf.lfFaceName), "expected %s face name, got %s\n", lf.lfFaceName, clf.lfFaceName);
     ok(clf.lfPitchAndFamily == lf.lfPitchAndFamily, "expected %x family, got %x\n", lf.lfPitchAndFamily, clf.lfPitchAndFamily);
     ok(clf.lfCharSet == lf.lfCharSet, "expected %d charset, got %d\n", lf.lfCharSet, clf.lfCharSet);
-    ok(clf.lfHeight == lf.lfHeight, "expected %d height, got %d\n", lf.lfHeight, clf.lfHeight);
+    ok(clf.lfHeight == lf.lfHeight, "expected %ld height, got %ld\n", lf.lfHeight, clf.lfHeight);
     DeleteObject(hfont);
     DeleteDC(hdc);
 }
@@ -4611,25 +4611,25 @@ static void test_GetGlyphOutline(void)
     lstrcpyA(lf.lfFaceName, "Tahoma");
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
     old_hfont = SelectObject(hdc, hfont);
 
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
-    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %u\n", GetLastError());
+    ok(ret != GDI_ERROR, "GetGlyphOutlineA error %lu\n", GetLastError());
 
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, NULL);
     ok(ret == GDI_ERROR, "GetGlyphOutlineA should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", GetLastError());
 
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
     ret = GetGlyphOutlineW(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
     if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
-        ok(ret != GDI_ERROR, "GetGlyphOutlineW error %u\n", GetLastError());
+        ok(ret != GDI_ERROR, "GetGlyphOutlineW error %lu\n", GetLastError());
 
     memset(&gm, 0, sizeof(gm));
     SetLastError(0xdeadbeef);
@@ -4637,7 +4637,7 @@ static void test_GetGlyphOutline(void)
     if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
     {
        ok(ret == GDI_ERROR, "GetGlyphOutlineW should fail\n");
-       ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
+       ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", GetLastError());
     }
 
     /* test for needed buffer size request on space char */
@@ -4658,7 +4658,7 @@ static void test_GetGlyphOutline(void)
     if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
     {
        ok(ret == GDI_ERROR, "GetGlyphOutlineW should return GDI_ERROR\n");
-       ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %u\n", GetLastError());
+       ok(GetLastError() == 0xdeadbeef, "expected 0xdeadbeef, got %lu\n", GetLastError());
        ok(gm.gmBlackBoxX == 0, "Expected 0, got %u\n", gm.gmBlackBoxX);
        ok(gm.gmBlackBoxY == 0, "Expected 0, got %u\n", gm.gmBlackBoxY);
     }
@@ -4783,43 +4783,43 @@ static void test_GetGlyphOutline(void)
         }
 
         ret = GetObjectA(hfont, sizeof lf, &lf);
-        ok(ret > 0, "GetObject error %u\n", GetLastError());
+        ok(ret > 0, "GetObject error %lu\n", GetLastError());
 
         ret = GetTextMetricsA(hdc, &tm);
-        ok(ret, "GetTextMetrics error %u\n", GetLastError());
+        ok(ret, "GetTextMetrics error %lu\n", GetLastError());
         ret = GetGlyphOutlineA(hdc, c[i].a, GGO_METRICS, &gm2, 0, NULL, &mat);
-        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %u\n", GetLastError());
+        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %lu\n", GetLastError());
         ok(gm2.gmCellIncX == tm.tmAveCharWidth * 2 || broken(gm2.gmCellIncX == -lf.lfHeight),
-           "expected %d, got %d (%s:%d)\n",
+           "expected %ld, got %d (%s:%d)\n",
            tm.tmAveCharWidth * 2, gm2.gmCellIncX, lf.lfFaceName, lf.lfCharSet);
 
         ret = GetGlyphOutlineA(hdc, c[i].a, GGO_METRICS, &gm2, 0, NULL, &rotate_mat);
-        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %u\n", GetLastError());
+        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %lu\n", GetLastError());
         ok(gm2.gmCellIncY == -lf.lfHeight,
-           "expected %d, got %d (%s:%d)\n",
+           "expected %ld, got %d (%s:%d)\n",
            -lf.lfHeight, gm2.gmCellIncY, lf.lfFaceName, lf.lfCharSet);
 
         lf.lfItalic = TRUE;
         hfont = CreateFontIndirectA(&lf);
-        ok(hfont != NULL, "CreateFontIndirect error %u\n", GetLastError());
+        ok(hfont != NULL, "CreateFontIndirect error %lu\n", GetLastError());
         DeleteObject(SelectObject(hdc, hfont));
         ret = GetTextMetricsA(hdc, &tm);
-        ok(ret, "GetTextMetrics error %u\n", GetLastError());
+        ok(ret, "GetTextMetrics error %lu\n", GetLastError());
         ret = GetGlyphOutlineA(hdc, c[i].a, GGO_METRICS, &gm2, 0, NULL, &mat);
-        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %u\n", GetLastError());
+        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %lu\n", GetLastError());
         ok(gm2.gmCellIncX == tm.tmAveCharWidth * 2 || broken(gm2.gmCellIncX == -lf.lfHeight),
-           "expected %d, got %d (%s:%d)\n",
+           "expected %ld, got %d (%s:%d)\n",
            tm.tmAveCharWidth * 2, gm2.gmCellIncX, lf.lfFaceName, lf.lfCharSet);
 
         lf.lfItalic = FALSE;
         lf.lfEscapement = lf.lfOrientation = 2700;
         hfont = CreateFontIndirectA(&lf);
-        ok(hfont != NULL, "CreateFontIndirect error %u\n", GetLastError());
+        ok(hfont != NULL, "CreateFontIndirect error %lu\n", GetLastError());
         DeleteObject(SelectObject(hdc, hfont));
         ret = GetGlyphOutlineA(hdc, c[i].a, GGO_METRICS, &gm2, 0, NULL, &mat);
-        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %u\n", GetLastError());
+        ok(ret != GDI_ERROR, "GetGlyphOutlineA error %lu\n", GetLastError());
         ok(gm2.gmCellIncY == -lf.lfHeight,
-           "expected %d, got %d (%s:%d)\n",
+           "expected %ld, got %d (%s:%d)\n",
            -lf.lfHeight, gm2.gmCellIncY, lf.lfFaceName, lf.lfCharSet);
 
         hfont = SelectObject(hdc, old_hfont);
@@ -4852,7 +4852,7 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
     ok( hf != NULL, "CreateFontA(%s, %d) failed\n", fontname, font_height);
     of = SelectObject( hdc, hf);
     ret = GetTextMetricsA( hdc, &tm);
-    ok(ret, "GetTextMetricsA error %u\n", GetLastError());
+    ok(ret, "GetTextMetricsA error %lu\n", GetLastError());
     height = tm.tmHeight;
     ave_width = tm.tmAveCharWidth;
     SelectObject( hdc, of);
@@ -4866,7 +4866,7 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
         ok(hf != 0, "CreateFont failed\n");
         of = SelectObject(hdc, hf);
         ret = GetTextMetricsA(hdc, &tm);
-        ok(ret, "GetTextMetrics error %u\n", GetLastError());
+        ok(ret, "GetTextMetrics error %lu\n", GetLastError());
         SelectObject(hdc, of);
         DeleteObject(hf);
 
@@ -4917,18 +4917,18 @@ static void test_GetCharacterPlacement(void)
 
     size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 0, NULL, 0);
     ok(size2, "GetCharacterPlacementA failed!\n");
-    ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
+    ok(size == size2, "GetCharacterPlacementA returned different result: %lu vs %lu\n", size2, size);
 
     size2 = GetCharacterPlacementA(hdc, "Wine Test", 9, 1024, NULL, GCP_REORDER);
     ok(size2, "GetCharacterPlacementA failed!\n");
-    ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
+    ok(size == size2, "GetCharacterPlacementA returned different result: %lu vs %lu\n", size2, size);
 
     pos[0] = -1;
     glyphs[0] = '!';
     result.nGlyphs = 20;
     size = GetCharacterPlacementA(hdc, "Wine Test", 9, 1024, &result, GCP_REORDER);
     ok(size, "GetCharacterPlacementA failed!\n");
-    ok(size == size2, "GetCharacterPlacementA returned different result: %u vs %u\n", size2, size);
+    ok(size == size2, "GetCharacterPlacementA returned different result: %lu vs %lu\n", size2, size);
     ok(result.nGlyphs == 9, "Unexpected number of glyphs %u\n", result.nGlyphs);
     ok(glyphs[0] == 'W', "Unexpected first glyph %s\n", wine_dbgstr_wn(glyphs, 1));
     todo_wine ok(pos[0] == 0, "Unexpected caret position %d\n", pos[0]);
@@ -4959,9 +4959,9 @@ static void test_CreateFontIndirect(void)
         ok(hfont != 0, "CreateFontIndirectA failed\n");
         SetLastError(0xdeadbeef);
         ret = GetObjectA(hfont, sizeof(getobj_lf), &getobj_lf);
-        ok(ret, "GetObject failed: %d\n", GetLastError());
+        ok(ret, "GetObject failed: %ld\n", GetLastError());
         ok(lf.lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf.lfItalic, getobj_lf.lfItalic);
-        ok(lf.lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08x got %08x\n", lf.lfWeight, getobj_lf.lfWeight);
+        ok(lf.lfWeight == getobj_lf.lfWeight, "lfWeight: expect %08lx got %08lx\n", lf.lfWeight, getobj_lf.lfWeight);
         ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName), "font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
         DeleteObject(hfont);
     }
@@ -4981,7 +4981,7 @@ static void test_CreateFontIndirectEx(void)
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectExA(NULL);
     ok(hfont == NULL, "got %p\n", hfont);
-    ok(GetLastError() == 0xdeadbeef, "got error %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "got error %ld\n", GetLastError());
 
     memset(&lfex, 0, sizeof(lfex));
     lstrcpyA(lfex.elfEnumLogfontEx.elfLogFont.lfFaceName, "Arial");
@@ -5011,7 +5011,7 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
     strcpy(lf.lfFaceName, name);
 
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "Failed to create a font, %u.\n", GetLastError());
+    ok(hfont != 0, "Failed to create a font, %lu.\n", GetLastError());
 
     hdc = GetDC(NULL);
 
@@ -5023,35 +5023,35 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
     ret = pGetFontRealizationInfo(hdc, (DWORD *)&info);
     ok(ret != 0, "Unexpected return value %d.\n", ret);
 
-    ok((info.flags & 0xf) == 0x3, "Unexpected flags %#x.\n", info.flags);
-    ok(info.cache_num != 0, "Unexpected cache num %u.\n", info.cache_num);
-    ok(info.instance_id != 0, "Unexpected instance id %u.\n", info.instance_id);
+    ok((info.flags & 0xf) == 0x3, "Unexpected flags %#lx.\n", info.flags);
+    ok(info.cache_num != 0, "Unexpected cache num %lu.\n", info.cache_num);
+    ok(info.instance_id != 0, "Unexpected instance id %lu.\n", info.instance_id);
     ok(info.simulations == 0, "Unexpected simulations %#x.\n", info.simulations);
     ok(info.face_index == 0, "Unexpected face index %u.\n", info.face_index);
 
     ret = pGetFontFileInfo(info.instance_id, 0, NULL, 0, NULL);
-    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %d.\n",
+    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %ld.\n",
         ret, GetLastError());
 
     needed = 0;
     ret = pGetFontFileInfo(info.instance_id, 0, NULL, 0, &needed);
-    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %d.\n",
+    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %ld.\n",
         ret, GetLastError());
 
     ret = pGetFontFileInfo(info.instance_id, 0, &file_info, 0, NULL);
-    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %d.\n",
+    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %ld.\n",
         ret, GetLastError());
 
     ret = pGetFontFileInfo(info.instance_id, 0, &file_info, needed - 1, NULL);
-    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %d.\n",
+    ok(ret == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Unexpected return value %d, error %ld.\n",
         ret, GetLastError());
 
     ret = pGetFontFileInfo(info.instance_id, 0, &file_info, needed, NULL);
-    ok(ret != 0, "Failed to get font file info, ret %d gle %d.\n", ret, GetLastError());
+    ok(ret != 0, "Failed to get font file info, ret %d gle %ld.\n", ret, GetLastError());
 
     memset(&file_info, 0xcc, sizeof(file_info));
     ret = pGetFontFileInfo(info.instance_id, 0, &file_info, sizeof(file_info), NULL);
-    ok(ret != 0, "Failed to get font file info, ret %d gle %d.\n", ret, GetLastError());
+    ok(ret != 0, "Failed to get font file info, ret %d gle %ld.\n", ret, GetLastError());
     if (ret)
     {
         ok(is_memory_resource ? file_info.size.QuadPart == size : file_info.size.QuadPart > 0, "Unexpected file size.\n");
@@ -5064,35 +5064,35 @@ static void test_realization_info(const char *name, DWORD size, BOOL is_memory_r
 
     memset(data, 0xcc, size);
     ret = pGetFontFileData(info.instance_id, 0, 0, data, size);
-    ok(ret != 0, "Failed to get font file data, %d\n", GetLastError());
-    ok(*(DWORD *)data == 0x00000100, "Unexpected sfnt header version %#x.\n", *(DWORD *)data);
+    ok(ret != 0, "Failed to get font file data, %ld\n", GetLastError());
+    ok(*(DWORD *)data == 0x00000100, "Unexpected sfnt header version %#lx.\n", *(DWORD *)data);
     ok(*(WORD *)(data + 4) == 0x0e00, "Unexpected table count %#x.\n", *(WORD *)(data + 4));
 
     /* Larger than font data size. */
     memset(data, 0xcc, size);
     ret = pGetFontFileData(info.instance_id, 0, 0, data, size + 16);
-    ok(ret == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected return value %d, error %d\n",
+    ok(ret == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected return value %d, error %ld\n",
         ret, GetLastError());
-    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
+    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#lx.\n", *(DWORD *)data);
 
     /* With offset. */
     memset(data, 0xcc, size);
     ret = pGetFontFileData(info.instance_id, 0, 16, data, size - 16);
-    ok(ret != 0, "Failed to get font file data, %d\n", GetLastError());
-    ok(*(DWORD *)data == 0x1000000, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
+    ok(ret != 0, "Failed to get font file data, %ld\n", GetLastError());
+    ok(*(DWORD *)data == 0x1000000, "Unexpected buffer contents %#lx.\n", *(DWORD *)data);
 
     memset(data, 0xcc, size);
     ret = pGetFontFileData(info.instance_id, 0, 16, data, size);
-    ok(ret == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected return value %d, error %d\n",
+    ok(ret == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected return value %d, error %ld\n",
         ret, GetLastError());
-    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
+    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#lx.\n", *(DWORD *)data);
 
     /* Zero buffer size. */
     memset(data, 0xcc, size);
     ret = pGetFontFileData(info.instance_id, 0, 16, data, 0);
     todo_wine
-    ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %d\n", ret, GetLastError());
-    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#x.\n", *(DWORD *)data);
+    ok(ret == 0 && GetLastError() == ERROR_NOACCESS, "Unexpected return value %d, error %ld\n", ret, GetLastError());
+    ok(*(DWORD *)data == 0xcccccccc, "Unexpected buffer contents %#lx.\n", *(DWORD *)data);
 
     HeapFree(GetProcessHeap(), 0, data);
 
@@ -5113,28 +5113,28 @@ static void test_AddFontMemResource(void)
     ret = AddFontMemResourceEx(NULL, 0, NULL, NULL);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(NULL, 10, NULL, NULL);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(NULL, 0, NULL, &num_fonts);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(NULL, 10, NULL, &num_fonts);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     /* Now with scalable font */
@@ -5149,8 +5149,8 @@ static void test_AddFontMemResource(void)
 
     num_fonts = 0;
     ret = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
-    ok(ret != 0, "Failed to add resource, %d.\n", GetLastError());
-    ok(num_fonts == 1, "Unexpected number of fonts %u.\n", num_fonts);
+    ok(ret != 0, "Failed to add resource, %ld.\n", GetLastError());
+    ok(num_fonts == 1, "Unexpected number of fonts %lu.\n", num_fonts);
 
     bRet = is_truetype_font_installed("wine_test");
     todo_wine
@@ -5159,12 +5159,12 @@ static void test_AddFontMemResource(void)
     test_realization_info("wine_test", font_size, TRUE);
 
     bRet = RemoveFontMemResourceEx(ret);
-    ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
+    ok(bRet, "RemoveFontMemResourceEx error %ld\n", GetLastError());
 
     free_font(font);
 
     bRet = DeleteFileA(ttf_name);
-    ok(bRet, "Failed to delete font file, %d.\n", GetLastError());
+    ok(bRet, "Failed to delete font file, %ld.\n", GetLastError());
 
     font = load_font("sserife.fon", &font_size);
     if (!font)
@@ -5177,14 +5177,14 @@ static void test_AddFontMemResource(void)
     ret = AddFontMemResourceEx(font, 0, NULL, NULL);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(font, 10, NULL, NULL);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     num_fonts = 0xdeadbeef;
@@ -5192,7 +5192,7 @@ static void test_AddFontMemResource(void)
     ret = AddFontMemResourceEx(font, 0, NULL, &num_fonts);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
     ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
 
@@ -5201,14 +5201,14 @@ static void test_AddFontMemResource(void)
     ret = AddFontMemResourceEx(font, 10, NULL, &num_fonts);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == 0xdeadbeef,
-       "Expected GetLastError() to return 0xdeadbeef, got %u\n",
+       "Expected GetLastError() to return 0xdeadbeef, got %lu\n",
        GetLastError());
     ok(num_fonts == 0xdeadbeef, "number of loaded fonts should be 0xdeadbeef\n");
 
     num_fonts = 0xdeadbeef;
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(font, font_size, NULL, &num_fonts);
-    ok(ret != 0, "AddFontMemResourceEx error %d\n", GetLastError());
+    ok(ret != 0, "AddFontMemResourceEx error %ld\n", GetLastError());
     ok(num_fonts != 0xdeadbeef, "number of loaded fonts should not be 0xdeadbeef\n");
     ok(num_fonts != 0, "number of loaded fonts should not be 0\n");
 
@@ -5216,7 +5216,7 @@ static void test_AddFontMemResource(void)
 
     SetLastError(0xdeadbeef);
     bRet = RemoveFontMemResourceEx(ret);
-    ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
+    ok(bRet, "RemoveFontMemResourceEx error %ld\n", GetLastError());
 
     /* test invalid pointer to number of loaded fonts */
     font = load_font("sserife.fon", &font_size);
@@ -5226,14 +5226,14 @@ static void test_AddFontMemResource(void)
     ret = AddFontMemResourceEx(font, font_size, NULL, (void *)0xdeadbeef);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == 0xdeadbeef,
-       "Expected GetLastError() to return 0xdeadbeef, got %u\n",
+       "Expected GetLastError() to return 0xdeadbeef, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = AddFontMemResourceEx(font, font_size, NULL, NULL);
     ok(!ret, "AddFontMemResourceEx should fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     free_font(font);
@@ -5245,7 +5245,7 @@ static INT CALLBACK enum_fonts_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm,
 
     if (type != TRUETYPE_FONTTYPE) return 1;
 
-    ok(ntm->tmWeight == elf->lfWeight, "expected %d got %d\n", ntm->tmWeight, elf->lfWeight);
+    ok(ntm->tmWeight == elf->lfWeight, "expected %ld got %ld\n", ntm->tmWeight, elf->lfWeight);
 
     lf = (LOGFONTA *)lparam;
     *lf = *elf;
@@ -5263,7 +5263,7 @@ static INT CALLBACK enum_all_fonts_proc(const LOGFONTA *elf, const TEXTMETRICA *
     ret = strcmp(lf->lfFaceName, elf->lfFaceName);
     if(ret == 0)
     {
-        ok(ntm->tmWeight == elf->lfWeight, "expected %d got %d\n", ntm->tmWeight, elf->lfWeight);
+        ok(ntm->tmWeight == elf->lfWeight, "expected %ld got %ld\n", ntm->tmWeight, elf->lfWeight);
         *lf = *elf;
         return 0;
     }
@@ -5304,20 +5304,20 @@ static void test_EnumFonts(void)
     ok(!ret, "font Arial is not enumerated\n");
     ret = strcmp(lf.lfFaceName, "Arial");
     ok(!ret, "expected Arial got %s\n", lf.lfFaceName);
-    ok(lf.lfWeight == FW_NORMAL, "expected FW_NORMAL got %d\n", lf.lfWeight);
+    ok(lf.lfWeight == FW_NORMAL, "expected FW_NORMAL got %ld\n", lf.lfWeight);
 
     strcpy(lf.lfFaceName, "Arial");
     ret = EnumFontFamiliesA(hdc, NULL, enum_all_fonts_proc, (LPARAM)&lf);
     ok(!ret, "font Arial is not enumerated\n");
     ret = strcmp(lf.lfFaceName, "Arial");
     ok(!ret, "expected Arial got %s\n", lf.lfFaceName);
-    ok(lf.lfWeight == FW_NORMAL, "expected FW_NORMAL got %d\n", lf.lfWeight);
+    ok(lf.lfWeight == FW_NORMAL, "expected FW_NORMAL got %ld\n", lf.lfWeight);
 
     ret = EnumFontFamiliesA(hdc, "Arial Bold", enum_fonts_proc, (LPARAM)&lf);
     ok(!ret, "font Arial Bold is not enumerated\n");
     ret = strcmp(lf.lfFaceName, "Arial");
     ok(!ret, "expected Arial got %s\n", lf.lfFaceName);
-    ok(lf.lfWeight == FW_BOLD, "expected FW_BOLD got %d\n", lf.lfWeight);
+    ok(lf.lfWeight == FW_BOLD, "expected FW_BOLD got %ld\n", lf.lfWeight);
 
     strcpy(lf.lfFaceName, "Arial Bold");
     ret = EnumFontFamiliesA(hdc, NULL, enum_all_fonts_proc, (LPARAM)&lf);
@@ -5327,7 +5327,7 @@ static void test_EnumFonts(void)
     ok(!ret, "font Arial Bold Italic is not enumerated\n");
     ret = strcmp(lf.lfFaceName, "Arial");
     ok(!ret, "expected Arial got %s\n", lf.lfFaceName);
-    ok(lf.lfWeight == FW_BOLD, "expected FW_BOLD got %d\n", lf.lfWeight);
+    ok(lf.lfWeight == FW_BOLD, "expected FW_BOLD got %ld\n", lf.lfWeight);
 
     strcpy(lf.lfFaceName, "Arial Bold Italic");
     ret = EnumFontFamiliesA(hdc, NULL, enum_all_fonts_proc, (LPARAM)&lf);
@@ -5348,7 +5348,7 @@ static INT CALLBACK enum_ms_shell_dlg_proc(const LOGFONTA *lf, const TEXTMETRICA
     struct enum_fullname_data *efnd = (struct enum_fullname_data *)lParam;
 
     if (winetest_debug > 2)
-        trace("enumed font \"%s\", charset %d, height %d, weight %d, italic %d\n",
+        trace("enumed font \"%s\", charset %d, height %ld, weight %ld, italic %d\n",
               lf->lfFaceName, lf->lfCharSet, lf->lfHeight, lf->lfWeight, lf->lfItalic);
 
     if (type != TRUETYPE_FONTTYPE) return 1;
@@ -5369,7 +5369,7 @@ static INT CALLBACK enum_ms_shell_dlg2_proc(const LOGFONTA *lf, const TEXTMETRIC
     struct enum_fullname_data *efnd = (struct enum_fullname_data *)lParam;
 
     if (winetest_debug > 2)
-        trace("enumed font \"%s\", charset %d, height %d, weight %d, italic %d\n",
+        trace("enumed font \"%s\", charset %d, height %ld, weight %ld, italic %d\n",
               lf->lfFaceName, lf->lfCharSet, lf->lfHeight, lf->lfWeight, lf->lfItalic);
 
     if (type != TRUETYPE_FONTTYPE) return 1;
@@ -5695,7 +5695,7 @@ static void test_GetGlyphOutline_empty_contour(void)
     lstrcpyA(lf.lfFaceName, "wine_test");
 
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
     hdc = GetDC(NULL);
 
@@ -5703,17 +5703,17 @@ static void test_GetGlyphOutline_empty_contour(void)
     ok(hfont_prev != NULL, "SelectObject failed\n");
 
     ret = GetGlyphOutlineW(hdc, 0xa8, GGO_NATIVE, &gm, 0, NULL, &mat);
-    ok(ret == 228, "GetGlyphOutline returned %d, expected 228\n", ret);
+    ok(ret == 228, "GetGlyphOutline returned %ld, expected 228\n", ret);
 
     header = (TTPOLYGONHEADER*)buf;
     ret = GetGlyphOutlineW(hdc, 0xa8, GGO_NATIVE, &gm, sizeof(buf), buf, &mat);
-    ok(ret == 228, "GetGlyphOutline returned %d, expected 228\n", ret);
-    ok(header->cb == 36, "header->cb = %d, expected 36\n", header->cb);
-    ok(header->dwType == TT_POLYGON_TYPE, "header->dwType = %d, expected TT_POLYGON_TYPE\n", header->dwType);
+    ok(ret == 228, "GetGlyphOutline returned %ld, expected 228\n", ret);
+    ok(header->cb == 36, "header->cb = %ld, expected 36\n", header->cb);
+    ok(header->dwType == TT_POLYGON_TYPE, "header->dwType = %ld, expected TT_POLYGON_TYPE\n", header->dwType);
     header = (TTPOLYGONHEADER*)((char*)header+header->cb);
-    ok(header->cb == 96, "header->cb = %d, expected 96\n", header->cb);
+    ok(header->cb == 96, "header->cb = %ld, expected 96\n", header->cb);
     header = (TTPOLYGONHEADER*)((char*)header+header->cb);
-    ok(header->cb == 96, "header->cb = %d, expected 96\n", header->cb);
+    ok(header->cb == 96, "header->cb = %ld, expected 96\n", header->cb);
 
     SelectObject(hdc, hfont_prev);
     DeleteObject(hfont);
@@ -5736,7 +5736,7 @@ static void test_GetGlyphOutline_metric_clipping(void)
 
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
     hdc = GetDC(NULL);
 
@@ -5745,15 +5745,15 @@ static void test_GetGlyphOutline_metric_clipping(void)
 
     SetLastError(0xdeadbeef);
     ret = GetTextMetricsA(hdc, &tm);
-    ok(ret, "GetTextMetrics error %u\n", GetLastError());
+    ok(ret, "GetTextMetrics error %lu\n", GetLastError());
 
     GetGlyphOutlineA(hdc, 'A', GGO_METRICS, &gm, 0, NULL, &mat);
     ok(gm.gmptGlyphOrigin.y <= tm.tmAscent,
-        "Glyph top(%d) exceeds ascent(%d)\n",
+        "Glyph top(%ld) exceeds ascent(%ld)\n",
         gm.gmptGlyphOrigin.y, tm.tmAscent);
     GetGlyphOutlineA(hdc, 'D', GGO_METRICS, &gm, 0, NULL, &mat);
     ok(gm.gmptGlyphOrigin.y - gm.gmBlackBoxY >= -tm.tmDescent,
-        "Glyph bottom(%d) exceeds descent(%d)\n",
+        "Glyph bottom(%ld) exceeds descent(%ld)\n",
         gm.gmptGlyphOrigin.y - gm.gmBlackBoxY, -tm.tmDescent);
 
     /* Test tmLastChar - wine_test has code points fffb-fffe mapped to glyph 0 */
@@ -5781,7 +5781,7 @@ static void test_GetGlyphOutline_character(void)
     lstrcpyA(lf.lfFaceName, "wine_test");
 
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
     hdc = GetDC(NULL);
 
@@ -5832,7 +5832,7 @@ static void test_fstype_fixup(void)
 
     SetLastError(0xdeadbeef);
     hfont = CreateFontIndirectA(&lf);
-    ok(hfont != 0, "CreateFontIndirectA error %u\n", GetLastError());
+    ok(hfont != 0, "CreateFontIndirectA error %lu\n", GetLastError());
 
     hdc = GetDC(NULL);
 
@@ -5843,7 +5843,7 @@ static void test_fstype_fixup(void)
     otm = HeapAlloc(GetProcessHeap(), 0, otm_size);
     otm->otmSize = sizeof(*otm);
     ret = GetOutlineTextMetricsA(hdc, otm->otmSize, otm);
-    ok(ret == otm->otmSize, "expected %u, got %u, error %d\n", otm->otmSize, ret, GetLastError());
+    ok(ret == otm->otmSize, "expected %u, got %lu, error %ld\n", otm->otmSize, ret, GetLastError());
 
     /* Test font has fsType set to 0x7fff, test that reserved bits are filtered out,
        valid bits are 1, 2, 3, 8, 9. */
@@ -5877,9 +5877,9 @@ static void test_CreateScalableFontResource(void)
     ok(!ret, "font wine_test should not be enumerated\n");
 
     ret = GetTempPathA(MAX_PATH, tmp_path);
-    ok(ret, "GetTempPath() error %d\n", GetLastError());
+    ok(ret, "GetTempPath() error %ld\n", GetLastError());
     ret = GetTempFileNameA(tmp_path, "fot", 0, fot_name);
-    ok(ret, "GetTempFileName() error %d\n", GetLastError());
+    ok(ret, "GetTempFileName() error %ld\n", GetLastError());
 
     ret = GetFileAttributesA(fot_name);
     ok(ret != INVALID_FILE_ATTRIBUTES, "file %s does not exist\n", fot_name);
@@ -5887,31 +5887,31 @@ static void test_CreateScalableFontResource(void)
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, ttf_name, NULL);
     ok(!ret, "CreateScalableFontResource() should fail\n");
-    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, ttf_name, "");
     ok(!ret, "CreateScalableFontResource() should fail\n");
-    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %ld\n", GetLastError());
 
     file_part = strrchr(ttf_name, '\\');
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, file_part, tmp_path);
     ok(!ret, "CreateScalableFontResource() should fail\n");
-    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_EXISTS, "not expected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, "random file name", tmp_path);
     ok(!ret, "CreateScalableFontResource() should fail\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, NULL, ttf_name);
     ok(!ret, "CreateScalableFontResource() should fail\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "not expected error %ld\n", GetLastError());
 
     ret = DeleteFileA(fot_name);
-    ok(ret, "DeleteFile() error %d\n", GetLastError());
+    ok(ret, "DeleteFile() error %ld\n", GetLastError());
 
     ret = RemoveFontResourceExA(fot_name, 0, 0);
     ok(!ret, "RemoveFontResourceEx() should fail\n");
@@ -5919,14 +5919,14 @@ static void test_CreateScalableFontResource(void)
     /* test public font resource */
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(0, fot_name, ttf_name, NULL);
-    ok(ret, "CreateScalableFontResource() error %d\n", GetLastError());
+    ok(ret, "CreateScalableFontResource() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     ok(!ret, "font wine_test should not be enumerated\n");
 
     SetLastError(0xdeadbeef);
     ret = AddFontResourceExA(fot_name, 0, 0);
-    ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
+    ok(ret, "AddFontResourceEx() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     ok(ret, "font wine_test should be enumerated\n");
@@ -5941,7 +5941,7 @@ static void test_CreateScalableFontResource(void)
 
     SetLastError(0xdeadbeef);
     ret = RemoveFontResourceExA(fot_name, 0, 0);
-    ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
+    ok(ret, "RemoveFontResourceEx() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     ok(!ret, "font wine_test should not be enumerated\n");
@@ -5954,13 +5954,13 @@ static void test_CreateScalableFontResource(void)
     {
         SetLastError(0xdeadbeef);
         ret = AddFontResourceExA(fot_name, 0, 0);
-        ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
+        ok(ret, "AddFontResourceEx() error %ld\n", GetLastError());
     }
     for (i = 0; i < 5; i++)
     {
         SetLastError(0xdeadbeef);
         ret = RemoveFontResourceExA(fot_name, 0, 0);
-        ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
+        ok(ret, "RemoveFontResourceEx() error %ld\n", GetLastError());
     }
     ret = RemoveFontResourceExA(fot_name, 0, 0);
     ok(!ret, "RemoveFontResourceEx() should fail\n");
@@ -5970,14 +5970,14 @@ static void test_CreateScalableFontResource(void)
     /* test hidden font resource */
     SetLastError(0xdeadbeef);
     ret = CreateScalableFontResourceA(1, fot_name, ttf_name, NULL);
-    ok(ret, "CreateScalableFontResource() error %d\n", GetLastError());
+    ok(ret, "CreateScalableFontResource() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     ok(!ret, "font wine_test should not be enumerated\n");
 
     SetLastError(0xdeadbeef);
     ret = AddFontResourceExA(fot_name, 0, 0);
-    ok(ret, "AddFontResourceEx() error %d\n", GetLastError());
+    ok(ret, "AddFontResourceEx() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     todo_wine
@@ -5986,7 +5986,7 @@ static void test_CreateScalableFontResource(void)
     /* XP allows removing a private font added with 0 flags */
     SetLastError(0xdeadbeef);
     ret = RemoveFontResourceExA(fot_name, FR_PRIVATE, 0);
-    ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
+    ok(ret, "RemoveFontResourceEx() error %ld\n", GetLastError());
 
     ret = is_truetype_font_installed("wine_test");
     ok(!ret, "font wine_test should not be enumerated\n");
@@ -6088,7 +6088,7 @@ static void check_vertical_metrics(const char *face)
     ok(ret != GDI_ERROR, "GetGlyphOutlineW failed\n");
     ret = GetCharABCWidthsW(hdc, code, code, &vabc);
     ok(ret, "GetCharABCWidthsW failed\n");
-    ok(vabc.abcA == vgm.gmptGlyphOrigin.x, "expected %d, got %d\n",
+    ok(vabc.abcA == vgm.gmptGlyphOrigin.x, "expected %d, got %ld\n",
        vabc.abcA, vgm.gmptGlyphOrigin.x);
     ok(vabc.abcB == vgm.gmBlackBoxX, "expected %d, got %d\n",
        vabc.abcB, vgm.gmBlackBoxX);
@@ -6119,13 +6119,13 @@ static void check_vertical_metrics(const char *face)
         topSideBearing = GET_BE_WORD(topSideBearing);
         ok(match_off_by_1(vgm.gmptGlyphOrigin.x,
                           MulDiv(topSideBearing, height, otm.otmEMSquare), FALSE),
-           "expected %d, got %d\n",
+           "expected %d, got %ld\n",
            MulDiv(topSideBearing, height, otm.otmEMSquare), vgm.gmptGlyphOrigin.x);
     }
     else
     {
         ok(vgm.gmptGlyphOrigin.x == rgm.gmptGlyphOrigin.x + vgm.gmCellIncX + otm.otmDescent,
-           "got %d, expected rgm.origin.x(%d) + vgm.cellIncX(%d) + descent(%d)\n",
+           "got %ld, expected rgm.origin.x(%ld) + vgm.cellIncX(%d) + descent(%d)\n",
            vgm.gmptGlyphOrigin.x, rgm.gmptGlyphOrigin.x, vgm.gmCellIncX, otm.otmDescent);
     }
 
@@ -6185,7 +6185,7 @@ static void test_vertical_font(void)
     }
 
     ret = RemoveFontResourceExA(ttf_name, FR_PRIVATE, 0);
-    ok(ret, "RemoveFontResourceEx() error %d\n", GetLastError());
+    ok(ret, "RemoveFontResourceEx() error %ld\n", GetLastError());
 
     DeleteFileA(ttf_name);
 }
@@ -6372,8 +6372,8 @@ static void test_stock_fonts(void)
                 (!strcmp(td[i][j].face_name, "System") && td[i][j].height > 16)))
             ok(height == td[i][j].height_pixels, "%d(%d): expected height %d, got %d\n", i, j, td[i][j].height_pixels, height);
 
-            ok(td[i][j].weight == lf.lfWeight, "%d(%d): expected lfWeight %d, got %d\n", i, j, td[i][j].weight, lf.lfWeight);
-            ok(td[i][j].height == lf.lfHeight, "%d(%d): expected lfHeight %d, got %d\n", i, j, td[i][j].height, lf.lfHeight);
+            ok(td[i][j].weight == lf.lfWeight, "%d(%d): expected lfWeight %d, got %ld\n", i, j, td[i][j].weight, lf.lfWeight);
+            ok(td[i][j].height == lf.lfHeight, "%d(%d): expected lfHeight %d, got %ld\n", i, j, td[i][j].height, lf.lfHeight);
             if (td[i][j].face_name[0] == '?')
             {
                 /* Wine doesn't have this font, skip this case for now.
@@ -6412,8 +6412,8 @@ static void test_max_height(void)
     hfont_old = SelectObject(hdc, hfont);
     r = GetTextMetricsA(hdc, &tm1);
     ok(r, "GetTextMetrics failed\n");
-    ok(tm1.tmHeight > 0, "expected a positive value, got %d\n", tm1.tmHeight);
-    ok(tm1.tmAveCharWidth > 0, "expected a positive value, got %d\n", tm1.tmHeight);
+    ok(tm1.tmHeight > 0, "expected a positive value, got %ld\n", tm1.tmHeight);
+    ok(tm1.tmAveCharWidth > 0, "expected a positive value, got %ld\n", tm1.tmHeight);
     DeleteObject(SelectObject(hdc, hfont_old));
 
     /* test the largest value */
@@ -6424,9 +6424,9 @@ static void test_max_height(void)
     r = GetTextMetricsA(hdc, &tm);
     ok(r, "GetTextMetrics failed\n");
     ok(tm.tmHeight > tm1.tmHeight,
-       "expected greater than 1 ppem value (%d), got %d\n", tm1.tmHeight, tm.tmHeight);
+       "expected greater than 1 ppem value (%ld), got %ld\n", tm1.tmHeight, tm.tmHeight);
     ok(tm.tmAveCharWidth > tm1.tmAveCharWidth,
-       "expected greater than 1 ppem value (%d), got %d\n", tm1.tmAveCharWidth, tm.tmAveCharWidth);
+       "expected greater than 1 ppem value (%ld), got %ld\n", tm1.tmAveCharWidth, tm.tmAveCharWidth);
     DeleteObject(SelectObject(hdc, hfont_old));
 
     /* test an invalid value */
@@ -6438,9 +6438,9 @@ static void test_max_height(void)
         r = GetTextMetricsA(hdc, &tm);
         ok(r, "GetTextMetrics failed\n");
         ok(tm.tmHeight == tm1.tmHeight,
-           "expected 1 ppem value (%d), got %d\n", tm1.tmHeight, tm.tmHeight);
+           "expected 1 ppem value (%ld), got %ld\n", tm1.tmHeight, tm.tmHeight);
         ok(tm.tmAveCharWidth == tm1.tmAveCharWidth,
-           "expected 1 ppem value (%d), got %d\n", tm1.tmAveCharWidth, tm.tmAveCharWidth);
+           "expected 1 ppem value (%ld), got %ld\n", tm1.tmAveCharWidth, tm.tmAveCharWidth);
         DeleteObject(SelectObject(hdc, hfont_old));
     }
 
@@ -6627,17 +6627,17 @@ static void test_fake_bold_font(void)
 
     /* compare results (outline) */
     ok(data[0].tm.tmHeight == data[1].tm.tmHeight,
-       "expected %d, got %d\n", data[0].tm.tmHeight, data[1].tm.tmHeight);
+       "expected %ld, got %ld\n", data[0].tm.tmHeight, data[1].tm.tmHeight);
     ok(data[0].tm.tmAscent == data[1].tm.tmAscent,
-       "expected %d, got %d\n", data[0].tm.tmAscent, data[1].tm.tmAscent);
+       "expected %ld, got %ld\n", data[0].tm.tmAscent, data[1].tm.tmAscent);
     ok(data[0].tm.tmDescent == data[1].tm.tmDescent,
-       "expected %d, got %d\n", data[0].tm.tmDescent, data[1].tm.tmDescent);
+       "expected %ld, got %ld\n", data[0].tm.tmDescent, data[1].tm.tmDescent);
     ok(data[0].tm.tmAveCharWidth + 1 == data[1].tm.tmAveCharWidth,
-       "expected %d, got %d\n", data[0].tm.tmAveCharWidth + 1, data[1].tm.tmAveCharWidth);
+       "expected %ld, got %ld\n", data[0].tm.tmAveCharWidth + 1, data[1].tm.tmAveCharWidth);
     ok(data[0].tm.tmMaxCharWidth + 1 == data[1].tm.tmMaxCharWidth,
-       "expected %d, got %d\n", data[0].tm.tmMaxCharWidth + 1, data[1].tm.tmMaxCharWidth);
+       "expected %ld, got %ld\n", data[0].tm.tmMaxCharWidth + 1, data[1].tm.tmMaxCharWidth);
     ok(data[0].tm.tmOverhang == data[1].tm.tmOverhang,
-       "expected %d, got %d\n", data[0].tm.tmOverhang, data[1].tm.tmOverhang);
+       "expected %ld, got %ld\n", data[0].tm.tmOverhang, data[1].tm.tmOverhang);
     ok(data[0].w + 1 == data[1].w,
        "expected %d, got %d\n", data[0].w + 1, data[1].w);
 
@@ -6683,19 +6683,19 @@ static void test_fake_bold_font(void)
             continue;
         }
         ok(data[i].tm.tmHeight == data[i+1].tm.tmHeight,
-           "expected %d, got %d\n", data[i].tm.tmHeight, data[i+1].tm.tmHeight);
+           "expected %ld, got %ld\n", data[i].tm.tmHeight, data[i+1].tm.tmHeight);
         ok(data[i].tm.tmAscent == data[i+1].tm.tmAscent,
-           "expected %d, got %d\n", data[i].tm.tmAscent, data[i+1].tm.tmAscent);
+           "expected %ld, got %ld\n", data[i].tm.tmAscent, data[i+1].tm.tmAscent);
         ok(data[i].tm.tmDescent == data[i+1].tm.tmDescent,
-           "expected %d, got %d\n", data[i].tm.tmDescent, data[i+1].tm.tmDescent);
+           "expected %ld, got %ld\n", data[i].tm.tmDescent, data[i+1].tm.tmDescent);
         ok(data[i+1].tm.tmAveCharWidth - data[i].tm.tmAveCharWidth == diff,
-           "expected %d, got %d\n", diff, data[i+1].tm.tmAveCharWidth - data[i].tm.tmAveCharWidth);
+           "expected %d, got %ld\n", diff, data[i+1].tm.tmAveCharWidth - data[i].tm.tmAveCharWidth);
         ok(data[i+1].tm.tmMaxCharWidth - data[i].tm.tmMaxCharWidth == diff,
-           "expected %d, got %d\n", diff, data[i+1].tm.tmMaxCharWidth - data[i].tm.tmMaxCharWidth);
+           "expected %d, got %ld\n", diff, data[i+1].tm.tmMaxCharWidth - data[i].tm.tmMaxCharWidth);
         ok(data[i].tm.tmOverhang == 0,
-           "expected 0, got %d\n", data[i].tm.tmOverhang);
+           "expected 0, got %ld\n", data[i].tm.tmOverhang);
         ok(data[i+1].tm.tmOverhang == 1,
-           "expected 1, got %d\n", data[i+1].tm.tmOverhang);
+           "expected 1, got %ld\n", data[i+1].tm.tmOverhang);
         ok(data[i].w + 1 == data[i+1].w,
            "expected %d, got %d\n", data[i].w + 1, data[i+1].w);
     }
@@ -7325,7 +7325,7 @@ static void test_GetCharWidthInfo(void)
     ok(hfont_prev != NULL, "SelectObject failed\n");
 
     ret = GetFontData(hdc, MS_MAKE_TAG('h','h','e','a'), 0, &hhea, sizeof(hhea));
-    ok(ret == sizeof(hhea), "got %u\n", ret);
+    ok(ret == sizeof(hhea), "got %lu\n", ret);
     minLeftSideBearing = GET_BE_WORD(hhea.minLeftSideBearing);
     minRightSideBearing = GET_BE_WORD(hhea.minRightSideBearing);
 
@@ -7377,8 +7377,8 @@ static void test_GetCharWidthInfo(void)
     pt[0].x = info.lsb; pt[0].y = 0;
     pt[1].x = info.rsb; pt[1].y = 0;
     DPtoLP(hdc, pt, 2);
-    ok(pt[0].x == info2.lsb, "expected %d, got %d\n", pt[0].x, info2.lsb);
-    ok(pt[1].x == info2.rsb, "expected %d, got %d\n", pt[1].x, info2.rsb);
+    ok(pt[0].x == info2.lsb, "expected %ld, got %d\n", pt[0].x, info2.lsb);
+    ok(pt[1].x == info2.rsb, "expected %ld, got %d\n", pt[1].x, info2.rsb);
 
     DeleteObject(SelectObject(hdc, hfont_prev));
     ReleaseDC(NULL, hdc);
@@ -7511,7 +7511,7 @@ static void test_GetCharacterPlacement_kerning(void)
     kp = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*kp));
 
     ret = GetKerningPairsW(hdc, count, kp);
-    ok(ret == count, "got %u, expected %u\n", ret, count);
+    ok(ret == count, "got %lu, expected %lu\n", ret, count);
 
     size = kern_amount = idx = 0;
     for (i = 0; i < count; i++)
@@ -7559,19 +7559,19 @@ static void test_GetCharacterPlacement_kerning(void)
         goto done;
     }
 
-    ok(width + kern_amount == width_kern, "%d + %d != %d\n", width, kern_amount, width_kern);
+    ok(width + kern_amount == width_kern, "%ld + %d != %ld\n", width, kern_amount, width_kern);
 
     kern_amount = idx = 0;
     for (i = 0; i < count; i += 3, idx++)
     {
-        ok(pos[i] + kern_amount == pos_kern[i], "%d: %d + %d != %d\n", i, pos[i], kern_amount, pos_kern[i]);
+        ok(pos[i] + kern_amount == pos_kern[i], "%ld: %d + %d != %d\n", i, pos[i], kern_amount, pos_kern[i]);
         kern_amount += kern[idx];
-        ok(pos[i+1] + kern_amount == pos_kern[i+1], "%d: %d + %d != %d\n", i, pos[i+1], kern_amount, pos_kern[i+1]);
-        ok(pos[i+2] + kern_amount == pos_kern[i+2], "%d: %d + %d != %d\n", i, pos[i+2], kern_amount, pos_kern[i+2]);
+        ok(pos[i+1] + kern_amount == pos_kern[i+1], "%ld: %d + %d != %d\n", i, pos[i+1], kern_amount, pos_kern[i+1]);
+        ok(pos[i+2] + kern_amount == pos_kern[i+2], "%ld: %d + %d != %d\n", i, pos[i+2], kern_amount, pos_kern[i+2]);
 
-        ok(dx[i] + kern[idx] == dx_kern[i], "%d: %d + %d != %d\n", i, dx[i], kern[idx], dx_kern[i]);
-        ok(dx[i+1] == dx_kern[i+1], "%d: %d != %d\n", i, dx[i+1], dx_kern[i+1]);
-        ok(dx[i+2] == dx_kern[i+2], "%d: %d != %d\n", i, dx[i+2], dx_kern[i+2]);
+        ok(dx[i] + kern[idx] == dx_kern[i], "%ld: %d + %d != %d\n", i, dx[i], kern[idx], dx_kern[i]);
+        ok(dx[i+1] == dx_kern[i+1], "%ld: %d != %d\n", i, dx[i+1], dx_kern[i+1]);
+        ok(dx[i+2] == dx_kern[i+2], "%ld: %d != %d\n", i, dx[i+2], dx_kern[i+2]);
     }
 
 done:
@@ -7600,7 +7600,7 @@ static void test_select_object(void)
     SetLastError(0xdeadbeef);
     old_font = SelectObject(NULL, hfont);
     ok(!old_font, "SelectObject returned %p\n", old_font);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n",
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n",
        GetLastError());
 
     DeleteObject(hfont);
diff --git a/dlls/gdi32/tests/gdiobj.c b/dlls/gdi32/tests/gdiobj.c
index e6efce8e552..b9671c0fb9f 100644
--- a/dlls/gdi32/tests/gdiobj.c
+++ b/dlls/gdi32/tests/gdiobj.c
@@ -47,41 +47,41 @@ static void test_gdi_objects(void)
     SetLastError(0);
     hp = SelectObject(NULL, GetStockObject(BLACK_PEN));
     ok(!hp && (GetLastError() == ERROR_INVALID_HANDLE || broken(!GetLastError())),
-       "SelectObject(NULL DC) expected 0, ERROR_INVALID_HANDLE, got %p, %u\n",
+       "SelectObject(NULL DC) expected 0, ERROR_INVALID_HANDLE, got %p, %lu\n",
        hp, GetLastError());
 
     /* With a valid DC and a NULL object, the call returns 0 but does not SetLastError() */
     SetLastError(0);
     hp = SelectObject(hdc, NULL);
     ok(!hp && !GetLastError(),
-       "SelectObject(NULL obj) expected 0, NO_ERROR, got %p, %u\n",
+       "SelectObject(NULL obj) expected 0, NO_ERROR, got %p, %lu\n",
        hp, GetLastError());
 
     /* The DC is unaffected by the NULL SelectObject */
     SetLastError(0);
     hp = SelectObject(hdc, GetStockObject(BLACK_PEN));
     ok(hp && !GetLastError(),
-       "SelectObject(post NULL) expected non-null, NO_ERROR, got %p, %u\n",
+       "SelectObject(post NULL) expected non-null, NO_ERROR, got %p, %lu\n",
        hp, GetLastError());
 
     /* GetCurrentObject does not SetLastError() on a null object */
     SetLastError(0);
     hp = GetCurrentObject(NULL, OBJ_PEN);
     ok(!hp && !GetLastError(),
-       "GetCurrentObject(NULL DC) expected 0, NO_ERROR, got %p, %u\n",
+       "GetCurrentObject(NULL DC) expected 0, NO_ERROR, got %p, %lu\n",
        hp, GetLastError());
 
     /* DeleteObject does not SetLastError() on a null object */
     ret = DeleteObject(NULL);
     ok( !ret && !GetLastError(),
-       "DeleteObject(NULL obj), expected 0, NO_ERROR, got %d, %u\n",
+       "DeleteObject(NULL obj), expected 0, NO_ERROR, got %d, %lu\n",
        ret, GetLastError());
 
     /* GetObject does not SetLastError() on a null object */
     SetLastError(0);
     i = GetObjectA(NULL, sizeof(buff), buff);
     ok (!i && (GetLastError() == 0 || GetLastError() == ERROR_INVALID_PARAMETER),
-        "GetObject(NULL obj), expected 0, NO_ERROR, got %d, %u\n",
+        "GetObject(NULL obj), expected 0, NO_ERROR, got %d, %lu\n",
 	i, GetLastError());
 
     /* GetObject expects ERROR_NOACCESS when passed an invalid buffer */
@@ -89,21 +89,21 @@ static void test_gdi_objects(void)
     SetLastError(0);
     i = GetObjectA(hp, (INT_PTR)buff, (LPVOID)sizeof(buff));
     ok (!i && (GetLastError() == 0 || GetLastError() == ERROR_NOACCESS),
-        "GetObject(invalid buff), expected 0, ERROR_NOACCESS, got %d, %u\n",
+        "GetObject(invalid buff), expected 0, ERROR_NOACCESS, got %d, %lu\n",
     i, GetLastError());
 
     /* GetObjectType does SetLastError() on a null object */
     SetLastError(0);
     i = GetObjectType(NULL);
     ok (!i && GetLastError() == ERROR_INVALID_HANDLE,
-        "GetObjectType(NULL obj), expected 0, ERROR_INVALID_HANDLE, got %d, %u\n",
+        "GetObjectType(NULL obj), expected 0, ERROR_INVALID_HANDLE, got %d, %lu\n",
         i, GetLastError());
 
     /* UnrealizeObject does not SetLastError() on a null object */
     SetLastError(0);
     i = UnrealizeObject(NULL);
     ok (!i && !GetLastError(),
-        "UnrealizeObject(NULL obj), expected 0, NO_ERROR, got %d, %u\n",
+        "UnrealizeObject(NULL obj), expected 0, NO_ERROR, got %d, %lu\n",
         i, GetLastError());
 
     ReleaseDC(NULL, hdc);
@@ -125,7 +125,7 @@ static DWORD WINAPI thread_proc(void *param)
     struct hgdiobj_event *hgdiobj_event = param;
 
     hgdiobj_event->hdc = CreateDCA("display", NULL, NULL, NULL);
-    ok(hgdiobj_event->hdc != NULL, "CreateDC error %u\n", GetLastError());
+    ok(hgdiobj_event->hdc != NULL, "CreateDC error %lu\n", GetLastError());
 
     hgdiobj_event->hgdiobj1 = CreatePen(PS_DASHDOTDOT, 17, RGB(1, 2, 3));
     ok(hgdiobj_event->hgdiobj1 != 0, "Failed to create pen\n");
@@ -135,7 +135,7 @@ static DWORD WINAPI thread_proc(void *param)
 
     SetEvent(hgdiobj_event->ready_event);
     status = WaitForSingleObject(hgdiobj_event->stop_event, INFINITE);
-    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
+    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %lu\n", GetLastError());
 
     ok(!GetObjectA(hgdiobj_event->hgdiobj1, sizeof(lp), &lp), "GetObject should fail\n");
 
@@ -155,43 +155,43 @@ static void test_thread_objects(void)
     BOOL bRet;
 
     hgdiobj_event.stop_event = CreateEventA(NULL, 0, 0, NULL);
-    ok(hgdiobj_event.stop_event != NULL, "CreateEvent error %u\n", GetLastError());
+    ok(hgdiobj_event.stop_event != NULL, "CreateEvent error %lu\n", GetLastError());
     hgdiobj_event.ready_event = CreateEventA(NULL, 0, 0, NULL);
-    ok(hgdiobj_event.ready_event != NULL, "CreateEvent error %u\n", GetLastError());
+    ok(hgdiobj_event.ready_event != NULL, "CreateEvent error %lu\n", GetLastError());
 
     hthread = CreateThread(NULL, 0, thread_proc, &hgdiobj_event, 0, &tid);
-    ok(hthread != NULL, "CreateThread error %u\n", GetLastError());
+    ok(hthread != NULL, "CreateThread error %lu\n", GetLastError());
 
     status = WaitForSingleObject(hgdiobj_event.ready_event, INFINITE);
-    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
+    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %lu\n", GetLastError());
 
     ret = GetObjectA(hgdiobj_event.hgdiobj1, sizeof(lp), &lp);
-    ok(ret == sizeof(lp), "GetObject error %u\n", GetLastError());
+    ok(ret == sizeof(lp), "GetObject error %lu\n", GetLastError());
     ok(lp.lopnStyle == PS_DASHDOTDOT, "wrong pen style %d\n", lp.lopnStyle);
-    ok(lp.lopnWidth.x == 17, "wrong pen width.y %d\n", lp.lopnWidth.x);
-    ok(lp.lopnWidth.y == 0, "wrong pen width.y %d\n", lp.lopnWidth.y);
-    ok(lp.lopnColor == RGB(1, 2, 3), "wrong pen width.y %08x\n", lp.lopnColor);
+    ok(lp.lopnWidth.x == 17, "wrong pen width.y %ld\n", lp.lopnWidth.x);
+    ok(lp.lopnWidth.y == 0, "wrong pen width.y %ld\n", lp.lopnWidth.y);
+    ok(lp.lopnColor == RGB(1, 2, 3), "wrong pen width.y %08lx\n", lp.lopnColor);
 
     ret = GetDeviceCaps(hgdiobj_event.hdc, TECHNOLOGY);
     ok(ret == DT_RASDISPLAY, "GetDeviceCaps(TECHNOLOGY) should return DT_RASDISPLAY not %d\n", ret);
 
     bRet = DeleteObject(hgdiobj_event.hgdiobj1);
-    ok(bRet, "DeleteObject error %u\n", GetLastError());
+    ok(bRet, "DeleteObject error %lu\n", GetLastError());
     bRet = DeleteDC(hgdiobj_event.hdc);
-    ok(bRet, "DeleteDC error %u\n", GetLastError());
+    ok(bRet, "DeleteDC error %lu\n", GetLastError());
 
     type = GetObjectType(hgdiobj_event.hgdiobj2);
-    ok(type == OBJ_REGION, "GetObjectType returned %u\n", type);
+    ok(type == OBJ_REGION, "GetObjectType returned %lu\n", type);
 
     SetEvent(hgdiobj_event.stop_event);
     status = WaitForSingleObject(hthread, INFINITE);
-    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
+    ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %lu\n", GetLastError());
     CloseHandle(hthread);
 
     type = GetObjectType(hgdiobj_event.hgdiobj2);
-    ok(type == OBJ_REGION, "GetObjectType returned %u\n", type);
+    ok(type == OBJ_REGION, "GetObjectType returned %lu\n", type);
     bRet = DeleteObject(hgdiobj_event.hgdiobj2);
-    ok(bRet, "DeleteObject error %u\n", GetLastError());
+    ok(bRet, "DeleteObject error %lu\n", GetLastError());
 
     CloseHandle(hgdiobj_event.stop_event);
     CloseHandle(hgdiobj_event.ready_event);
@@ -216,7 +216,7 @@ static void test_GetCurrentObject(void)
     assert(hdc != 0);
 
     type = GetObjectType(hdc);
-    ok(type == OBJ_MEMDC, "GetObjectType returned %u\n", type);
+    ok(type == OBJ_MEMDC, "GetObjectType returned %lu\n", type);
 
     hpen = CreatePen(PS_SOLID, 10, RGB(10, 20, 30));
     assert(hpen != 0);
@@ -354,9 +354,9 @@ static void test_handles_on_win64(void)
         hrgn_test = (HRGN)(ULONG_PTR)((ULONG_PTR)hrgn | ((ULONGLONG)cases[i].high << 32) | cases[i].low);
         type = GetObjectType( hrgn_test );
         if (cases[i].ret)
-            ok( type == OBJ_REGION, "wrong type %u\n", type );
+            ok( type == OBJ_REGION, "wrong type %lu\n", type );
         else
-            ok( type == 0, "wrong type %u\n", type );
+            ok( type == 0, "wrong type %lu\n", type );
         ret = DeleteObject(hrgn_test);
         ok( cases[i].ret == ret, "DeleteObject should return %s (%p)\n",
             cases[i].ret ? "TRUE" : "FALSE", hrgn_test);
@@ -430,7 +430,7 @@ static void test_shared_handle_table(void)
     handle = HandleToULong( hrgn );
     entry = &gdi_shared->Handles[handle & 0xffff];
     todo_wine
-    ok(entry->Owner.ProcessId == GetCurrentProcessId(), "ProcessId = %x, expected %x\n",
+    ok(entry->Owner.ProcessId == GetCurrentProcessId(), "ProcessId = %x, expected %lx\n",
        entry->Owner.ProcessId, GetCurrentProcessId());
 
     test_shared_handle_entry( hrgn, NTGDI_OBJ_REGION, FALSE );
@@ -442,7 +442,7 @@ static void test_shared_handle_table(void)
     ok(entry->Type == 4, "Type = %x\n", entry->Type);
     ok(entry->Object, "Object = NULL\n");
     todo_wine
-    ok(entry->Owner.ProcessId == GetCurrentProcessId(), "ProcessId = %x, expected %x\n",
+    ok(entry->Owner.ProcessId == GetCurrentProcessId(), "ProcessId = %x, expected %lx\n",
        entry->Owner.ProcessId, GetCurrentProcessId());
     ok(entry->Owner.Count == 0, "Count = %u\n", entry->Owner.Count);
 
@@ -465,7 +465,7 @@ static void test_shared_handle_table(void)
     test_shared_handle_entry( GetStockObject( STOCK_LAST + 1 ), NTGDI_OBJ_BITMAP, TRUE );
 
     dc = CreateDCW(L"display", NULL, NULL, NULL);
-    ok(GetObjectType(dc) == OBJ_DC, "GetObjectType(dc) = %x\n", GetObjectType(dc));
+    ok(GetObjectType(dc) == OBJ_DC, "GetObjectType(dc) = %lx\n", GetObjectType(dc));
     test_shared_handle_entry( dc, NTGDI_OBJ_DC, FALSE );
     DeleteDC(dc);
 
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
index 509d5c0c579..79a5eabb930 100644
--- a/dlls/gdi32/tests/icm.c
+++ b/dlls/gdi32/tests/icm.c
@@ -48,12 +48,12 @@ static void test_GetICMProfileA( HDC dc )
     size = MAX_PATH;
     ret = GetICMProfileA( dc, &size, NULL );
     ok( !ret, "GetICMProfileA succeeded\n" );
-    ok( size > 0, "got %u\n", size );
+    ok( size > 0, "got %lu\n", size );
 
     size = 0;
     ret = GetICMProfileA( dc, &size, NULL );
     ok( !ret, "GetICMProfileA succeeded\n" );
-    ok( size > 0, "got %u\n", size );
+    ok( size > 0, "got %lu\n", size );
 
     size = MAX_PATH;
     ret = GetICMProfileA( NULL, &size, filename );
@@ -67,14 +67,14 @@ static void test_GetICMProfileA( HDC dc )
     ok( !ret, "GetICMProfileA succeeded\n" );
     ok( size, "expected size > 0\n" );
     ok( filename[0] == 0, "Expected filename to be empty\n" );
-    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
+    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %ld, expected ERROR_INSUFFICIENT_BUFFER\n", error );
 
     ret = GetICMProfileA( dc, NULL, filename );
     ok( !ret, "GetICMProfileA succeeded\n" );
 
     size = MAX_PATH;
     ret = GetICMProfileA( dc, &size, filename );
-    ok( ret, "GetICMProfileA failed %d\n", GetLastError() );
+    ok( ret, "GetICMProfileA failed %ld\n", GetLastError() );
 
     trace( "%s\n", filename );
 }
@@ -102,7 +102,7 @@ static void test_GetICMProfileW( HDC dc )
         /* Vista crashes */
         size = MAX_PATH;
         ret = GetICMProfileW( dc, &size, NULL );
-        ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
+        ok( ret, "GetICMProfileW failed %ld\n", GetLastError() );
     }
 
     ret = GetICMProfileW( dc, NULL, filename );
@@ -115,7 +115,7 @@ static void test_GetICMProfileW( HDC dc )
     size = 0;
     ret = GetICMProfileW( dc, &size, NULL );
     ok( !ret, "GetICMProfileW succeeded\n" );
-    ok( size > 0, "got %u\n", size );
+    ok( size > 0, "got %lu\n", size );
 
     size = 0;
     SetLastError(0xdeadbeef);
@@ -123,11 +123,11 @@ static void test_GetICMProfileW( HDC dc )
     error = GetLastError();
     ok( !ret, "GetICMProfileW succeeded\n" );
     ok( size, "expected size > 0\n" );
-    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
+    ok( error == ERROR_INSUFFICIENT_BUFFER, "got %ld, expected ERROR_INSUFFICIENT_BUFFER\n", error );
 
     size = MAX_PATH;
     ret = GetICMProfileW( dc, &size, filename );
-    ok( ret, "GetICMProfileW failed %d\n", GetLastError() );
+    ok( ret, "GetICMProfileW failed %ld\n", GetLastError() );
 }
 
 static void test_SetICMMode( HDC dc )
@@ -145,24 +145,24 @@ static void test_SetICMMode( HDC dc )
 
     SetLastError( 0xdeadbeef );
     ret = SetICMMode( NULL, 0 );
-    ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
+    ok( !ret, "SetICMMode succeeded (%ld)\n", GetLastError() );
 
     ret = SetICMMode( dc, -1 );
-    ok( !ret, "SetICMMode succeeded (%d)\n", GetLastError() );
+    ok( !ret, "SetICMMode succeeded (%ld)\n", GetLastError() );
 
     save = SetICMMode( dc, ICM_QUERY );
-    ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
+    ok( save == ICM_ON || save == ICM_OFF, "SetICMMode failed (%ld)\n", GetLastError() );
 
     if (save == ICM_ON) knob = ICM_OFF; else knob = ICM_ON;
 
     ret = SetICMMode( dc, knob );
-    todo_wine ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
+    todo_wine ok( ret, "SetICMMode failed (%ld)\n", GetLastError() );
 
     ret = SetICMMode( dc, ICM_QUERY );
-    todo_wine ok( ret == knob, "SetICMMode failed (%d)\n", GetLastError() );
+    todo_wine ok( ret == knob, "SetICMMode failed (%ld)\n", GetLastError() );
 
     ret = SetICMMode( dc, save );
-    ok( ret, "SetICMMode failed (%d)\n", GetLastError() );
+    ok( ret, "SetICMMode failed (%ld)\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     dc = CreateDCW( L"DISPLAY", NULL, NULL, NULL );
@@ -171,10 +171,10 @@ static void test_SetICMMode( HDC dc )
         win_skip( "CreateDCW is not implemented\n" );
         return;
     }
-    ok( dc != NULL, "CreateDCW failed (%d)\n", GetLastError() );
+    ok( dc != NULL, "CreateDCW failed (%ld)\n", GetLastError() );
 
     ret = SetICMMode( dc, ICM_QUERY );
-    ok( ret == ICM_OFF, "SetICMMode failed (%d)\n", GetLastError() );
+    ok( ret == ICM_OFF, "SetICMMode failed (%ld)\n", GetLastError() );
 
     DeleteDC( dc );
 }
@@ -235,31 +235,31 @@ static void test_SetICMProfileA( HDC dc )
 
     len = sizeof(profile);
     ret = GetICMProfileA( dc, &len, profile );
-    ok(ret, "GetICMProfileA failed %u\n", GetLastError());
+    ok(ret, "GetICMProfileA failed %lu\n", GetLastError());
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileA( NULL, NULL );
     error = GetLastError();
     ok(!ret, "SetICMProfileA succeeded\n");
     ok(error == ERROR_INVALID_PARAMETER,
-       "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+       "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileA( NULL, profile );
     error = GetLastError();
     ok(!ret, "SetICMProfileA succeeded\n");
     ok(error == ERROR_INVALID_HANDLE,
-       "expected ERROR_INVALID_HANDLE, got %u\n", error);
+       "expected ERROR_INVALID_HANDLE, got %lu\n", error);
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileA( dc, NULL );
     error = GetLastError();
     ok(!ret, "SetICMProfileA succeeded\n");
     ok(error == ERROR_INVALID_PARAMETER,
-       "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+       "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     ret = SetICMProfileA( dc, profile );
-    ok(ret, "SetICMProfileA failed %u\n", GetLastError());
+    ok(ret, "SetICMProfileA failed %lu\n", GetLastError());
 }
 
 static void test_SetICMProfileW( HDC dc )
@@ -278,28 +278,28 @@ static void test_SetICMProfileW( HDC dc )
 
     len = ARRAY_SIZE(profile);
     ret = GetICMProfileW( dc, &len, profile );
-    ok(ret, "GetICMProfileW failed %u\n", GetLastError());
+    ok(ret, "GetICMProfileW failed %lu\n", GetLastError());
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileW( NULL, NULL );
     error = GetLastError();
     ok(!ret, "SetICMProfileW succeeded\n");
-    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileW( NULL, profile );
     error = GetLastError();
     ok(!ret, "SetICMProfileW succeeded\n");
-    ok(error == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %u\n", error);
+    ok(error == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %lu\n", error);
 
     SetLastError( 0xdeadbeef );
     ret = SetICMProfileW( dc, NULL );
     error = GetLastError();
     ok(!ret, "SetICMProfileW succeeded\n");
-    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+    ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", error);
 
     ret = SetICMProfileW( dc, profile );
-    ok(ret, "SetICMProfileW failed %u\n", GetLastError());
+    ok(ret, "SetICMProfileW failed %lu\n", GetLastError());
 }
 
 START_TEST(icm)
diff --git a/dlls/gdi32/tests/mapping.c b/dlls/gdi32/tests/mapping.c
index 90c9d5a6617..78c83907a7e 100644
--- a/dlls/gdi32/tests/mapping.c
+++ b/dlls/gdi32/tests/mapping.c
@@ -39,8 +39,8 @@ static BOOL (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
 { \
     POINT _pt = { 1000, 1000 }; \
     LPtoDP(_hdc, &_pt, 1); \
-    ok(rough_match(_pt.x, _x), "expected x %d, got %d\n", (_x), _pt.x); \
-    ok(rough_match(_pt.y, _y), "expected y %d, got %d\n", (_y), _pt.y); \
+    ok(rough_match(_pt.x, _x), "expected x %d, got %ld\n", (_x), _pt.x); \
+    ok(rough_match(_pt.y, _y), "expected y %d, got %ld\n", (_y), _pt.y); \
 }
 
 #define expect_world_transform(_hdc, _em11, _em22) \
@@ -51,7 +51,7 @@ static BOOL (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
     _ret = GetWorldTransform(_hdc, &_xform); \
     if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) \
     { \
-        ok(_ret, "GetWorldTransform error %u\n", GetLastError()); \
+        ok(_ret, "GetWorldTransform error %lu\n", GetLastError()); \
         ok(_xform.eM11 == (_em11), "expected %f, got %f\n", (_em11), _xform.eM11); \
         ok(_xform.eM12 == 0.0, "expected 0.0, got %f\n", _xform.eM12); \
         ok(_xform.eM21 == 0.0, "expected 0.0, got %f\n", _xform.eM21); \
@@ -67,9 +67,9 @@ static BOOL (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
     SIZE _size; \
     SetLastError(0xdeadbeef); \
     _ret = _func(_hdc, &_size); \
-    ok(_ret, #_func " error %u\n", GetLastError()); \
-    ok(_size.cx == (_cx), "expected cx %d, got %d\n", (_cx), _size.cx); \
-    ok(_size.cy == (_cy), "expected cy %d, got %d\n", (_cy), _size.cy); \
+    ok(_ret, #_func " error %lu\n", GetLastError()); \
+    ok(_size.cx == (_cx), "expected cx %ld, got %ld\n", (_cx), _size.cx); \
+    ok(_size.cy == (_cy), "expected cy %ld, got %ld\n", (_cy), _size.cy); \
 }
 
 #define expect_viewport_ext(_hdc, _cx, _cy) expect_dc_ext(GetViewportExtEx, _hdc, _cx, _cy)
@@ -78,7 +78,8 @@ static BOOL (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
 static void test_world_transform(void)
 {
     HDC hdc;
-    INT ret, size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
+    int ret;
+    LONG size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
     XFORM xform;
     SIZE size;
 
@@ -99,11 +100,11 @@ static void test_world_transform(void)
     res_y = GetDeviceCaps(hdc, VERTRES);
     dpi_x = GetDeviceCaps(hdc, LOGPIXELSX);
     dpi_y = GetDeviceCaps(hdc, LOGPIXELSY);
-    trace("dc size %d x %d, resolution %d x %d dpi %d x %d\n",
+    trace("dc size %ld x %ld, resolution %ld x %ld dpi %ld x %ld\n",
           size_cx, size_cy, res_x, res_y, dpi_x, dpi_y );
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, 1000, 1000);
 
@@ -115,10 +116,10 @@ static void test_world_transform(void)
     ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" );
     ok( rough_match( size.cx, size_cx * 10 ) ||
         rough_match( size.cx, MulDiv( res_x, 254, dpi_x )),  /* Vista uses a more precise method */
-        "expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
+        "expected cx %ld or %d, got %ld\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
     ok( rough_match( size.cy, size_cy * 10 ) ||
         rough_match( size.cy, MulDiv( res_y, 254, dpi_y )),  /* Vista uses a more precise method */
-        "expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
+        "expected cy %ld or %d, got %ld\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, MulDiv(1000 / 10, res_x, size_cx), -MulDiv(1000 / 10, res_y, size_cy));
 
@@ -126,8 +127,8 @@ static void test_world_transform(void)
     ret = SetMapMode(hdc, MM_TEXT);
     ok(ret == MM_LOMETRIC, "expected MM_LOMETRIC, got %d\n", ret);
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, 1000, 1000);
 
@@ -139,8 +140,8 @@ static void test_world_transform(void)
         return;
     }
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, 1000, 1000);
 
@@ -164,10 +165,10 @@ static void test_world_transform(void)
     xform.eDy = 0.0f;
     SetLastError(0xdeadbeef);
     ret = SetWorldTransform(hdc, &xform);
-    ok(ret, "SetWorldTransform error %u\n", GetLastError());
+    ok(ret, "SetWorldTransform error %lu\n", GetLastError());
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, 20000, 20000);
 
@@ -179,10 +180,10 @@ static void test_world_transform(void)
     ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" );
     ok( rough_match( size.cx, size_cx * 10 ) ||
         rough_match( size.cx, MulDiv( res_x, 254, dpi_x )),  /* Vista uses a more precise method */
-        "expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
+        "expected cx %ld or %d, got %ld\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
     ok( rough_match( size.cy, size_cy * 10 ) ||
         rough_match( size.cy, MulDiv( res_y, 254, dpi_y )),  /* Vista uses a more precise method */
-        "expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
+        "expected cy %ld or %d, got %ld\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, MulDiv(20000, res_x, size.cx), -MulDiv(20000, res_y, size.cy));
 
@@ -190,8 +191,8 @@ static void test_world_transform(void)
     ret = SetMapMode(hdc, MM_TEXT);
     ok(ret == MM_LOMETRIC, "expected MM_LOMETRIC, got %d\n", ret);
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, 20000, 20000);
 
@@ -199,17 +200,17 @@ static void test_world_transform(void)
     size.cy = 0xdeadbeef;
     ret = SetViewportExtEx(hdc, -1, -1, &size);
     ok(ret, "SetViewportExtEx(-1, -1) failed\n");
-    ok(size.cx == 1 && size.cy == 1, "expected 1,1 got %d,%d\n", size.cx, size.cy);
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    ok(size.cx == 1 && size.cy == 1, "expected 1,1 got %ld,%ld\n", size.cx, size.cy);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, 20000, 20000);
 
     ret = SetMapMode(hdc, MM_ANISOTROPIC);
     ok(ret == MM_TEXT, "expected MM_TEXT, got %d\n", ret);
 
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, 20000, 20000);
 
@@ -217,9 +218,9 @@ static void test_world_transform(void)
     size.cy = 0xdeadbeef;
     ret = SetViewportExtEx(hdc, -1, -1, &size);
     ok(ret, "SetViewportExtEx(-1, -1) failed\n");
-    ok(size.cx == 1 && size.cy == 1, "expected 1,1 got %d,%d\n", size.cx, size.cy);
-    expect_viewport_ext(hdc, -1, -1);
-    expect_window_ext(hdc, 1, 1);
+    ok(size.cx == 1 && size.cy == 1, "expected 1,1 got %ld,%ld\n", size.cx, size.cy);
+    expect_viewport_ext(hdc, -1l, -1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, -20000, -20000);
 
@@ -228,8 +229,8 @@ static void test_world_transform(void)
     ret = GetGraphicsMode(hdc);
     ok(ret == GM_COMPATIBLE, "expected GM_COMPATIBLE, got %d\n", ret);
 
-    expect_viewport_ext(hdc, -1, -1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, -1l, -1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 20.0, 20.0);
     expect_LPtoDP(hdc, -20000, -20000);
 
@@ -238,7 +239,8 @@ static void test_world_transform(void)
 
 static void test_dc_layout(void)
 {
-    INT ret, size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
+    INT ret;
+    LONG size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
     SIZE size;
     POINT pt;
     HBITMAP bitmap;
@@ -265,8 +267,8 @@ static void test_dc_layout(void)
 
     ret = GetMapMode( hdc );
     ok(ret == MM_TEXT, "expected MM_TEXT, got %d\n", ret);
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, 1000, 1000);
 
@@ -282,16 +284,16 @@ static void test_dc_layout(void)
     ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
     ret = pGetLayout( hdc );
     ok(ret == LAYOUT_RTL, "got %x\n", ret);
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, -1000 + 99, 1000);
     GetViewportOrgEx( hdc, &pt );
-    ok( pt.x == 0 && pt.y == 0, "wrong origin %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 0 && pt.y == 0, "wrong origin %ld,%ld\n", pt.x, pt.y );
     GetWindowOrgEx( hdc, &pt );
-    ok( pt.x == 0 && pt.y == 0, "wrong origin %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 0 && pt.y == 0, "wrong origin %ld,%ld\n", pt.x, pt.y );
     GetDCOrgEx( hdc, &pt );
-    ok( pt.x == 0 && pt.y == 0, "wrong origin %d,%d\n", pt.x, pt.y );
+    ok( pt.x == 0 && pt.y == 0, "wrong origin %ld,%ld\n", pt.x, pt.y );
     if (pGetTransform)
     {
         XFORM xform;
@@ -361,10 +363,10 @@ static void test_dc_layout(void)
     ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" );
     ok( rough_match( size.cx, size_cx * 10 ) ||
         rough_match( size.cx, MulDiv( res_x, 254, dpi_x )),  /* Vista uses a more precise method */
-        "expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
+        "expected cx %ld or %d, got %ld\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
     ok( rough_match( size.cy, size_cy * 10 ) ||
         rough_match( size.cy, MulDiv( res_y, 254, dpi_y )),  /* Vista uses a more precise method */
-        "expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
+        "expected cy %lxd or %d, got %ld\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
     expect_world_transform(hdc, 1.0, 1.0);
     expect_LPtoDP(hdc, -MulDiv(1000 / 10, res_x, size_cx) + 99, -MulDiv(1000 / 10, res_y, size_cy));
 
@@ -435,22 +437,22 @@ static void test_SetWindowExt(HDC hdc, LONG cx, LONG cy, LONG expected_vp_cx, LO
     SetWindowExtEx(hdc, cx, cy, NULL);
     GetWindowExtEx(hdc, &windowExt);
     ok(windowExt.cx == cx && windowExt.cy == cy,
-       "Window extension: Expected %dx%d, got %dx%d\n",
+       "Window extension: Expected %ldx%ld, got %ldx%ld\n",
        cx, cy, windowExt.cx, windowExt.cy);
 
     GetViewportExtEx(hdc, &viewportExt);
     ok(rough_match(viewportExt.cx, expected_vp_cx) && rough_match(viewportExt.cy, expected_vp_cy),
-        "Viewport extents have not been properly adjusted: Expected %dx%d, got %dx%d\n",
+        "Viewport extents have not been properly adjusted: Expected %ldx%ld, got %ldx%ld\n",
         expected_vp_cx, expected_vp_cy, viewportExt.cx, viewportExt.cy);
 
     GetWindowOrgEx(hdc, &windowOrgAfter);
     ok(windowOrg.x == windowOrgAfter.x && windowOrg.y == windowOrgAfter.y,
-        "Window origin changed from (%d,%d) to (%d,%d)\n",
+        "Window origin changed from (%ld,%ld) to (%ld,%ld)\n",
         windowOrg.x, windowOrg.y, windowOrgAfter.x, windowOrgAfter.y);
 
     GetViewportOrgEx(hdc, &viewportOrgAfter);
     ok(viewportOrg.x == viewportOrgAfter.x && viewportOrg.y == viewportOrgAfter.y,
-        "Viewport origin changed from (%d,%d) to (%d,%d)\n",
+        "Viewport origin changed from (%ld,%ld) to (%ld,%ld)\n",
         viewportOrg.x, viewportOrg.y, viewportOrgAfter.x, viewportOrgAfter.y);
 }
 
@@ -466,22 +468,22 @@ static void test_SetViewportExt(HDC hdc, LONG cx, LONG cy, LONG expected_vp_cx,
     SetViewportExtEx(hdc, cx, cy, NULL);
     GetViewportExtEx(hdc, &viewportExt);
     ok(rough_match(viewportExt.cx, expected_vp_cx) && rough_match(viewportExt.cy, expected_vp_cy),
-        "Viewport extents have not been properly adjusted: Expected %dx%d, got %dx%d\n",
+        "Viewport extents have not been properly adjusted: Expected %ldx%ld, got %ldx%ld\n",
         expected_vp_cx, expected_vp_cy, viewportExt.cx, viewportExt.cy);
 
     GetWindowExtEx(hdc, &windowExtAfter);
     ok(windowExt.cx == windowExtAfter.cx && windowExt.cy == windowExtAfter.cy,
-       "Window extension changed from %dx%d to %dx%d\n",
+       "Window extension changed from %ldx%ld to %ldx%ld\n",
        windowExt.cx, windowExt.cy, windowExtAfter.cx, windowExtAfter.cy);
 
     GetWindowOrgEx(hdc, &windowOrgAfter);
     ok(windowOrg.x == windowOrgAfter.x && windowOrg.y == windowOrgAfter.y,
-        "Window origin changed from (%d,%d) to (%d,%d)\n",
+        "Window origin changed from (%ld,%ld) to (%ld,%ld)\n",
         windowOrg.x, windowOrg.y, windowOrgAfter.x, windowOrgAfter.y);
 
     GetViewportOrgEx(hdc, &viewportOrgAfter);
     ok(viewportOrg.x == viewportOrgAfter.x && viewportOrg.y == viewportOrgAfter.y,
-        "Viewport origin changed from (%d,%d) to (%d,%d)\n",
+        "Viewport origin changed from (%ld,%ld) to (%ld,%ld)\n",
         viewportOrg.x, viewportOrg.y, viewportOrgAfter.x, viewportOrgAfter.y);
 }
 
@@ -548,13 +550,13 @@ static void test_setvirtualresolution(void)
     r = pSetVirtualResolution(hdc, 4000, 1000, 400, 200); /* 10 pix/mm x 5 pix/mm */
     ok(r == TRUE, "got %d\n", r);
     expect_LPtoDP(hdc, 1000, 1000);
-    expect_viewport_ext(hdc, 1, 1);
-    expect_window_ext(hdc, 1, 1);
+    expect_viewport_ext(hdc, 1l, 1l);
+    expect_window_ext(hdc, 1l, 1l);
 
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 1000, -500);
-    expect_viewport_ext(hdc, 4000, -1000);
-    expect_window_ext(hdc, 4000, 2000);
+    expect_viewport_ext(hdc, 4000l, -1000l);
+    expect_window_ext(hdc, 4000l, 2000l);
 
     /* Doesn't change the device caps */
     ok(horz_res == GetDeviceCaps(hdc, HORZRES), "horz_res changed\n");
@@ -567,40 +569,40 @@ static void test_setvirtualresolution(void)
     SetMapMode(hdc, MM_TEXT);
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 2000, -500);
-    expect_viewport_ext(hdc, 8000, -1000);
-    expect_window_ext(hdc, 4000, 2000);
+    expect_viewport_ext(hdc, 8000l, -1000l);
+    expect_window_ext(hdc, 4000l, 2000l);
 
     r = pSetVirtualResolution(hdc, 8000, 1000, 200, 200); /* 40 pix/mm x 5 pix/mm */
     ok(r == TRUE, "got %d\n", r);
     SetMapMode(hdc, MM_TEXT);
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 4000, -500);
-    expect_viewport_ext(hdc, 8000, -1000);
-    expect_window_ext(hdc, 2000, 2000);
+    expect_viewport_ext(hdc, 8000l, -1000l);
+    expect_window_ext(hdc, 2000l, 2000l);
 
     r = pSetVirtualResolution(hdc, 8000, 1000, 200, 200); /* 40 pix/mm x 5 pix/mm */
     ok(r == TRUE, "got %d\n", r);
     SetMapMode(hdc, MM_TEXT);
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 4000, -500);
-    expect_viewport_ext(hdc, 8000, -1000);
-    expect_window_ext(hdc, 2000, 2000);
+    expect_viewport_ext(hdc, 8000l, -1000l);
+    expect_window_ext(hdc, 2000l, 2000l);
 
     r = pSetVirtualResolution(hdc, 8000, 2000, 200, 200); /* 40 pix/mm x 10 pix/mm */
     ok(r == TRUE, "got %d\n", r);
     SetMapMode(hdc, MM_TEXT);
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 4000, -1000);
-    expect_viewport_ext(hdc, 8000, -2000);
-    expect_window_ext(hdc, 2000, 2000);
+    expect_viewport_ext(hdc, 8000l, -2000l);
+    expect_window_ext(hdc, 2000l, 2000l);
 
     r = pSetVirtualResolution(hdc, 0, 0, 10, 0); /* Error */
     ok(r == FALSE, "got %d\n", r);
     SetMapMode(hdc, MM_TEXT);
     SetMapMode(hdc, MM_LOMETRIC);
     expect_LPtoDP(hdc, 4000, -1000);
-    expect_viewport_ext(hdc, 8000, -2000);
-    expect_window_ext(hdc, 2000, 2000);
+    expect_viewport_ext(hdc, 8000l, -2000l);
+    expect_window_ext(hdc, 2000l, 2000l);
 
     r = pSetVirtualResolution(hdc, 0, 0, 0, 0); /* Reset to true resolution */
     ok(r == TRUE, "got %d\n", r);
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 2df38674c2f..004ad98d949 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -78,8 +78,8 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     {
     case EMR_HEADER:
         ok(GetTextAlign(hdc) == 0, "text align %08x\n", GetTextAlign(hdc));
-        ok(GetBkColor(hdc) == RGB(0xff, 0xff, 0xff), "bk color %08x\n", GetBkColor(hdc));
-        ok(GetTextColor(hdc) == RGB(0x0, 0x0, 0x0), "text color %08x\n", GetTextColor(hdc));
+        ok(GetBkColor(hdc) == RGB(0xff, 0xff, 0xff), "bk color %08lx\n", GetBkColor(hdc));
+        ok(GetTextColor(hdc) == RGB(0x0, 0x0, 0x0), "text color %08lx\n", GetTextColor(hdc));
         ok(GetROP2(hdc) == R2_COPYPEN, "rop %d\n", GetROP2(hdc));
         ok(GetArcDirection(hdc) == AD_COUNTERCLOCKWISE, "arc dir %d\n", GetArcDirection(hdc));
         ok(GetPolyFillMode(hdc) == ALTERNATE, "poly fill %d\n", GetPolyFillMode(hdc));
@@ -99,7 +99,7 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx);
 
         ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
-        ok( ret == sizeof(device_lf), "GetObjectA error %d\n", GetLastError());
+        ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError());
 
         /* compare up to lfOutPrecision, other values are not interesting,
          * and in fact sometimes arbitrary adapted by Win9x.
@@ -109,7 +109,7 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
 
         for(i = 0; i < emr_ExtTextOutA->emrtext.nChars; i++)
         {
-            ok(orig_dx[i] == dx[i], "pass %d: dx[%d] (%d) didn't match %d\n",
+            ok(orig_dx[i] == dx[i], "pass %d: dx[%ld] (%d) didn't match %d\n",
                                      n_record, i, dx[i], orig_dx[i]);
         }
         n_record++;
@@ -126,7 +126,7 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf);
         ok( ret == sizeof(device_lf) ||
             broken(ret == (sizeof(device_lf) - LF_FACESIZE + strlen(device_lf.lfFaceName) + 1)), /* NT4 */
-            "GetObjectA error %d\n", GetLastError());
+            "GetObjectA error %ld\n", GetLastError());
 
         /* compare up to lfOutPrecision, other values are not interesting,
          * and in fact sometimes arbitrary adapted by Win9x.
@@ -134,16 +134,16 @@ static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         ok(!memcmp(&orig_lf, &device_lf, FIELD_OFFSET(LOGFONTA, lfOutPrecision)), "fonts don't match\n");
         ok(!lstrcmpA(orig_lf.lfFaceName, device_lf.lfFaceName), "font names don't match\n");
 
-        ok(!emr_ExtTextOutW->rclBounds.left, "emr_ExtTextOutW->rclBounds.left = %d\n",
+        ok(!emr_ExtTextOutW->rclBounds.left, "emr_ExtTextOutW->rclBounds.left = %ld\n",
                 emr_ExtTextOutW->rclBounds.left);
-        ok(emr_ExtTextOutW->rclBounds.right != -1, "emr_ExtTextOutW->rclBounds.right = %d\n",
+        ok(emr_ExtTextOutW->rclBounds.right != -1, "emr_ExtTextOutW->rclBounds.right = %ld\n",
                 emr_ExtTextOutW->rclBounds.right);
-        ok(emr_ExtTextOutW->rclBounds.bottom != -1, "emr_ExtTextOutW->rclBounds.bottom = %d\n",
+        ok(emr_ExtTextOutW->rclBounds.bottom != -1, "emr_ExtTextOutW->rclBounds.bottom = %ld\n",
                 emr_ExtTextOutW->rclBounds.bottom);
 
         for(i = 0; i < emr_ExtTextOutW->emrtext.nChars; i++)
         {
-            ok(orig_dx[i] == dx[i], "pass %d: dx[%d] (%d) didn't match %d\n",
+            ok(orig_dx[i] == dx[i], "pass %d: dx[%ld] (%d) didn't match %d\n",
                                      n_record, i, dx[i], orig_dx[i]);
         }
         n_record++;
@@ -174,10 +174,10 @@ static void test_ExtTextOut(void)
     /* Win9x doesn't play EMFs on invisible windows */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
     hdcDisplay = GetDC(hwnd);
-    ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError());
+    ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
 
     SetMapMode(hdcDisplay, MM_TEXT);
 
@@ -190,7 +190,7 @@ static void test_ExtTextOut(void)
     orig_lf.lfQuality = DEFAULT_QUALITY;
     lstrcpyA(orig_lf.lfFaceName, "Arial");
     hFont = CreateFontIndirectA(&orig_lf);
-    ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
 
     hFont = SelectObject(hdcDisplay, hFont);
 
@@ -198,12 +198,12 @@ static void test_ExtTextOut(void)
     for (i = 0; i < len; i++)
     {
         ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]);
-        ok( ret, "GetCharWidthA error %d\n", GetLastError());
+        ok( ret, "GetCharWidthA error %ld\n", GetLastError());
     }
     hFont = SelectObject(hdcDisplay, hFont);
 
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ok(GetDeviceCaps(hdcMetafile, TECHNOLOGY) == DT_RASDISPLAY,
        "GetDeviceCaps(TECHNOLOGY) has to return DT_RASDISPLAY for a display based EMF\n");
@@ -212,37 +212,37 @@ static void test_ExtTextOut(void)
 
     /* 1. pass NULL lpDx */
     ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL);
-    ok( ret, "ExtTextOutA error %d\n", GetLastError());
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     /* 2. pass custom lpDx */
     ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx);
-    ok( ret, "ExtTextOutA error %d\n", GetLastError());
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     /* 3. pass NULL lprc */
     ret = ExtTextOutA(hdcMetafile, 0, 40, 0, NULL, text, lstrlenA(text), NULL);
-    ok( ret, "ExtTextOutA error %d\n", GetLastError());
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     /* 4. test with unmatched BeginPath/EndPath calls */
     ret = BeginPath(hdcMetafile);
-    ok( ret, "BeginPath error %d\n", GetLastError());
+    ok( ret, "BeginPath error %ld\n", GetLastError());
     ret = BeginPath(hdcMetafile);
-    ok( ret, "BeginPath error %d\n", GetLastError());
+    ok( ret, "BeginPath error %ld\n", GetLastError());
     ret = EndPath(hdcMetafile);
-    ok( ret, "BeginPath error %d\n", GetLastError());
+    ok( ret, "BeginPath error %ld\n", GetLastError());
     ret = ExtTextOutA(hdcMetafile, 0, 60, 0, NULL, text, lstrlenA(text), NULL);
-    ok( ret, "ExtTextOutA error %d\n", GetLastError());
+    ok( ret, "ExtTextOutA error %ld\n", GetLastError());
 
     hFont = SelectObject(hdcMetafile, hFont);
     ret = DeleteObject(hFont);
-    ok( ret, "DeleteObject error %d\n", GetLastError());
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     ok(!GetObjectType(hdcMetafile), "CloseEnhMetaFile has to destroy metafile hdc\n");
 
     ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc);
-    ok( ret, "PlayEnhMetaFile error %d\n", GetLastError());
+    ok( ret, "PlayEnhMetaFile error %ld\n", GetLastError());
 
     SetTextAlign(hdcDisplay, TA_UPDATECP | TA_CENTER | TA_BASELINE | TA_RTLREADING );
     SetBkColor(hdcDisplay, RGB(0xff, 0, 0));
@@ -256,12 +256,12 @@ static void test_ExtTextOut(void)
     SetBkMode(hdcDisplay, OPAQUE);
 
     ret = EnumEnhMetaFile(hdcDisplay, hMetafile, eto_emf_enum_proc, dx, &rc);
-    ok( ret, "EnumEnhMetaFile error %d\n", GetLastError());
+    ok( ret, "EnumEnhMetaFile error %ld\n", GetLastError());
 
     ok( GetTextAlign(hdcDisplay) == (TA_UPDATECP | TA_CENTER | TA_BASELINE | TA_RTLREADING),
         "text align %08x\n", GetTextAlign(hdcDisplay));
-    ok( GetBkColor(hdcDisplay) == RGB(0xff, 0, 0), "bk color %08x\n", GetBkColor(hdcDisplay));
-    ok( GetTextColor(hdcDisplay) == RGB(0, 0xff, 0), "text color %08x\n", GetTextColor(hdcDisplay));
+    ok( GetBkColor(hdcDisplay) == RGB(0xff, 0, 0), "bk color %08lx\n", GetBkColor(hdcDisplay));
+    ok( GetTextColor(hdcDisplay) == RGB(0, 0xff, 0), "text color %08lx\n", GetTextColor(hdcDisplay));
     ok( GetROP2(hdcDisplay) == R2_NOT, "rop2 %d\n", GetROP2(hdcDisplay));
     ok( GetArcDirection(hdcDisplay) == AD_CLOCKWISE, "arc dir  %d\n", GetArcDirection(hdcDisplay));
     ok( GetPolyFillMode(hdcDisplay) == WINDING, "poly fill %d\n", GetPolyFillMode(hdcDisplay));
@@ -276,9 +276,9 @@ static void test_ExtTextOut(void)
        "A null hdc does not require a valid rc\n");
 
     ret = DeleteEnhMetaFile(hMetafile);
-    ok( ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
     ret = ReleaseDC(hwnd, hdcDisplay);
-    ok( ret, "ReleaseDC error %d\n", GetLastError());
+    ok( ret, "ReleaseDC error %ld\n", GetLastError());
     DestroyWindow(hwnd);
 }
 
@@ -358,7 +358,7 @@ static void test_ExtTextOutScale(void)
         ok(ret, "GetWindowExtEx failed\n");
 
         if (winetest_debug > 1)
-            trace("gm %d, mm %d, wnd %d,%d, vp %d,%d horz %d,%d vert %d,%d\n",
+            trace("gm %d, mm %d, wnd %ld,%ld, vp %ld,%ld horz %d,%d vert %d,%d\n",
                   test.graphics_mode, test.map_mode,
                   wndext.cx, wndext.cy, vportext.cx, vportext.cy,
                   horzSize, horzRes, vertSize, vertRes);
@@ -423,7 +423,7 @@ static void check_dc_state(HDC hdc, int restore_no,
 
     SetLastError(0xdeadbeef);
     ret = GetWorldTransform(hdc, &xform);
-    ok(ret, "GetWorldTransform error %u\n", GetLastError());
+    ok(ret, "GetWorldTransform error %lu\n", GetLastError());
 
     if (winetest_debug > 1)
         trace("%d: eM11 %f, eM22 %f, eDx %f, eDy %f\n", restore_no, xform.eM11,
@@ -460,7 +460,7 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     static int select_no;
 
     if (winetest_debug > 1)
-        trace("hdc %p, emr->iType %d, emr->nSize %d, param %p\n",
+        trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n",
               hdc, emr->iType, emr->nSize, (void *)param);
 
     SetLastError(0xdeadbeef);
@@ -468,21 +468,21 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
     {
         ret = GetWindowOrgEx(hdc, &pt);
-        ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
-        trace("window org (%d,%d)\n", pt.x, pt.y);
+        ok(ret, "GetWindowOrgEx error %lu\n", GetLastError());
+        trace("window org (%ld,%ld)\n", pt.x, pt.y);
         ret = GetViewportOrgEx(hdc, &pt);
-        ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-        trace("vport org (%d,%d)\n", pt.x, pt.y);
+        ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+        trace("vport org (%ld,%ld)\n", pt.x, pt.y);
         ret = GetWindowExtEx(hdc, &size);
-        ok(ret, "GetWindowExtEx error %u\n", GetLastError());
-        trace("window ext (%d,%d)\n", size.cx, size.cy);
+        ok(ret, "GetWindowExtEx error %lu\n", GetLastError());
+        trace("window ext (%ld,%ld)\n", size.cx, size.cy);
         ret = GetViewportExtEx(hdc, &size);
-        ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-        trace("vport ext (%d,%d)\n", size.cx, size.cy);
+        ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+        trace("vport ext (%ld,%ld)\n", size.cx, size.cy);
     }
     else
     {
-        ok(ret, "GetWorldTransform error %u\n", GetLastError());
+        ok(ret, "GetWorldTransform error %lu\n", GetLastError());
         if (winetest_debug > 1)
             trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
     }
@@ -499,10 +499,10 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
 
         if (winetest_debug > 1)
         {
-            trace("bounds %d,%d-%d,%d, frame %d,%d-%d,%d\n",
+            trace("bounds %ld,%ld-%ld,%ld, frame %ld,%ld-%ld,%ld\n",
                   emf->rclBounds.left, emf->rclBounds.top, emf->rclBounds.right, emf->rclBounds.bottom,
                   emf->rclFrame.left, emf->rclFrame.top, emf->rclFrame.right, emf->rclFrame.bottom);
-            trace("mm %d x %d, device %d x %d\n", emf->szlMillimeters.cx, emf->szlMillimeters.cy,
+            trace("mm %ld x %ld, device %ld x %ld\n", emf->szlMillimeters.cx, emf->szlMillimeters.cy,
                   emf->szlDevice.cx, emf->szlDevice.cy);
         }
 
@@ -519,35 +519,35 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     case EMR_LINETO:
         {
             const EMRLINETO *line = (const EMRLINETO *)emr;
-            if (winetest_debug > 1) trace("EMR_LINETO %d,%d\n", line->ptl.x, line->ptl.x);
+            if (winetest_debug > 1) trace("EMR_LINETO %ld,%ld\n", line->ptl.x, line->ptl.x);
             break;
         }
     case EMR_SETWINDOWORGEX:
         {
             const EMRSETWINDOWORGEX *org = (const EMRSETWINDOWORGEX *)emr;
             if (winetest_debug > 1)
-                trace("EMR_SETWINDOWORGEX: %d,%d\n", org->ptlOrigin.x, org->ptlOrigin.y);
+                trace("EMR_SETWINDOWORGEX: %ld,%ld\n", org->ptlOrigin.x, org->ptlOrigin.y);
             break;
         }
     case EMR_SETWINDOWEXTEX:
         {
             const EMRSETWINDOWEXTEX *ext = (const EMRSETWINDOWEXTEX *)emr;
             if (winetest_debug > 1)
-                trace("EMR_SETWINDOWEXTEX: %d,%d\n", ext->szlExtent.cx, ext->szlExtent.cy);
+                trace("EMR_SETWINDOWEXTEX: %ld,%ld\n", ext->szlExtent.cx, ext->szlExtent.cy);
             break;
         }
     case EMR_SETVIEWPORTORGEX:
         {
             const EMRSETVIEWPORTORGEX *org = (const EMRSETVIEWPORTORGEX *)emr;
             if (winetest_debug > 1)
-                trace("EMR_SETVIEWPORTORGEX: %d,%d\n", org->ptlOrigin.x, org->ptlOrigin.y);
+                trace("EMR_SETVIEWPORTORGEX: %ld,%ld\n", org->ptlOrigin.x, org->ptlOrigin.y);
             break;
         }
     case EMR_SETVIEWPORTEXTEX:
         {
             const EMRSETVIEWPORTEXTEX *ext = (const EMRSETVIEWPORTEXTEX *)emr;
             if (winetest_debug > 1)
-                trace("EMR_SETVIEWPORTEXTEX: %d,%d\n", ext->szlExtent.cx, ext->szlExtent.cy);
+                trace("EMR_SETVIEWPORTEXTEX: %ld,%ld\n", ext->szlExtent.cx, ext->szlExtent.cy);
             break;
         }
     case EMR_SAVEDC:
@@ -558,20 +558,20 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     case EMR_RESTOREDC:
         {
             const EMRRESTOREDC *restoredc = (const EMRRESTOREDC *)emr;
-            if (winetest_debug > 1) trace("EMR_RESTOREDC: %d\n", restoredc->iRelative);
+            if (winetest_debug > 1) trace("EMR_RESTOREDC: %ld\n", restoredc->iRelative);
 
             switch(++restore_no)
             {
             case 1:
-                ok(restoredc->iRelative == -1, "first restore %d\n", restoredc->iRelative);
+                ok(restoredc->iRelative == -1, "first restore %ld\n", restoredc->iRelative);
                 check_dc_state(hdc, restore_no, -2, -2, 8192, 8192, 20, 20, 20479, 20478);
                 break;
             case 2:
-                ok(restoredc->iRelative == -3, "second restore %d\n", restoredc->iRelative);
+                ok(restoredc->iRelative == -3, "second restore %ld\n", restoredc->iRelative);
                 check_dc_state(hdc, restore_no, 0, 0, 16384, 16384, 0, 0, 17873, 17872);
                 break;
             case 3:
-                ok(restoredc->iRelative == -2, "third restore %d\n", restoredc->iRelative);
+                ok(restoredc->iRelative == -2, "third restore %ld\n", restoredc->iRelative);
                 check_dc_state(hdc, restore_no, -4, -4, 32767, 32767, 40, 40, 3276, 3276);
                 break;
             }
@@ -582,7 +582,7 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     case EMR_SELECTOBJECT:
         {
             const EMRSELECTOBJECT *selectobj = (const EMRSELECTOBJECT*)emr;
-            if (winetest_debug > 1) trace("EMR_SELECTOBJECT: %x\n",selectobj->ihObject);
+            if (winetest_debug > 1) trace("EMR_SELECTOBJECT: %lx\n",selectobj->ihObject);
             select_no ++;
             break;
         }
@@ -597,21 +597,21 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
     {
         ret = GetWindowOrgEx(hdc, &pt);
-        ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
-        if (winetest_debug > 1) trace("window org (%d,%d)\n", pt.x, pt.y);
+        ok(ret, "GetWindowOrgEx error %lu\n", GetLastError());
+        if (winetest_debug > 1) trace("window org (%ld,%ld)\n", pt.x, pt.y);
         ret = GetViewportOrgEx(hdc, &pt);
-        ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-        if (winetest_debug > 1) trace("vport org (%d,%d)\n", pt.x, pt.y);
+        ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+        if (winetest_debug > 1) trace("vport org (%ld,%ld)\n", pt.x, pt.y);
         ret = GetWindowExtEx(hdc, &size);
-        ok(ret, "GetWindowExtEx error %u\n", GetLastError());
-        if (winetest_debug > 1) trace("window ext (%d,%d)\n", size.cx, size.cy);
+        ok(ret, "GetWindowExtEx error %lu\n", GetLastError());
+        if (winetest_debug > 1) trace("window ext (%ld,%ld)\n", size.cx, size.cy);
         ret = GetViewportExtEx(hdc, &size);
-        ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-        if (winetest_debug > 1) trace("vport ext (%d,%d)\n", size.cx, size.cy);
+        ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+        if (winetest_debug > 1) trace("vport ext (%ld,%ld)\n", size.cx, size.cy);
     }
     else
     {
-        ok(ret, "GetWorldTransform error %u\n", GetLastError());
+        ok(ret, "GetWorldTransform error %lu\n", GetLastError());
         if (winetest_debug > 1)
             trace("eM11 %f, eM22 %f, eDx %f, eDy %f\n", xform.eM11, xform.eM22, xform.eDx, xform.eDy);
     }
@@ -633,13 +633,13 @@ static void test_SaveDC(void)
     /* Win9x doesn't play EMFs on invisible windows */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
     hdcDisplay = GetDC(hwnd);
-    ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError());
+    ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
 
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     SetMapMode(hdcMetafile, MM_ANISOTROPIC);
 
@@ -655,11 +655,11 @@ static void test_SaveDC(void)
     SetPixelV(hdcMetafile, 50, 50, 0);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %li\n",size.cx);
     ret = SaveDC(hdcMetafile);
     ok(ret == 1, "ret = %d\n", ret);
 
@@ -672,11 +672,11 @@ static void test_SaveDC(void)
     SetPixelV(hdcMetafile, 50, 50, 0);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 10,"Expecting ViewportOrg x of 10, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 10,"Expecting ViewportOrg x of 10, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 200,"Expecting ViewportExt cx of 200, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 200,"Expecting ViewportExt cx of 200, got %li\n",size.cx);
     ret = SaveDC(hdcMetafile);
     ok(ret == 2, "ret = %d\n", ret);
 
@@ -691,11 +691,11 @@ static void test_SaveDC(void)
     SetPixelV(hdcMetafile, 50, 50, 0);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
     ret = SaveDC(hdcMetafile);
     ok(ret == 3, "ret = %d\n", ret);
 
@@ -713,39 +713,39 @@ static void test_SaveDC(void)
     SetPixelV(hdcMetafile, 50, 50, 0);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 30,"Expecting ViewportOrg x of 30, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 30,"Expecting ViewportOrg x of 30, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 400,"Expecting ViewportExt cx of 400, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 400,"Expecting ViewportExt cx of 400, got %li\n",size.cx);
     ret = RestoreDC(hdcMetafile, -1);
     ok(ret, "ret = %d\n", ret);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
     ok( GetPolyFillMode( hdcMetafile ) == ALTERNATE, "PolyFillMode not restored\n" );
     ok( GetBkColor( hdcMetafile ) == 0, "Background color not restored\n" );
     ret = SaveDC(hdcMetafile);
     ok(ret == 3, "ret = %d\n", ret);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 20,"Expecting ViewportOrg x of 20, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 300,"Expecting ViewportExt cx of 300, got %li\n",size.cx);
     ret = RestoreDC(hdcMetafile, 1);
     ok(ret, "ret = %d\n", ret);
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 0,"Expecting ViewportOrg x of 0, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 120,"Expecting ViewportExt cx of 120, got %li\n",size.cx);
 
     SetWindowOrgEx(hdcMetafile, -4, -4, NULL);
     SetViewportOrgEx(hdcMetafile, 40, 40, NULL);
@@ -756,20 +756,20 @@ static void test_SaveDC(void)
     SetPixelV(hdcMetafile, 50, 50, 0);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
     ret = SaveDC(hdcMetafile);
     ok(ret == 1, "ret = %d\n", ret);
 
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
     ret = SaveDC(hdcMetafile);
     ok(ret == 2, "ret = %d\n", ret);
 
@@ -781,12 +781,12 @@ static void test_SaveDC(void)
     orig_lf.lfQuality = DEFAULT_QUALITY;
     lstrcpyA(orig_lf.lfFaceName, "Arial");
     hFont = CreateFontIndirectA(&orig_lf);
-    ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
 
     hFontOld = SelectObject(hdcMetafile, hFont);
 
     hFont2 = CreateFontIndirectA(&orig_lf);
-    ok(hFont2 != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont2 != 0, "CreateFontIndirectA error %ld\n", GetLastError());
     hFontCheck = SelectObject(hdcMetafile, hFont2);
     ok(hFontCheck == hFont, "Font not selected\n");
 
@@ -796,11 +796,11 @@ static void test_SaveDC(void)
     ret = RestoreDC(hdcMetafile, 1);
     ok(ret, "ret = %d\n", ret);
     ret = GetViewportOrgEx(hdcMetafile, &pt);
-    ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
-    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %i\n",pt.x);
+    ok(ret, "GetViewportOrgEx error %lu\n", GetLastError());
+    ok(pt.x == 40,"Expecting ViewportOrg x of 40, got %li\n",pt.x);
     ret = GetViewportExtEx(hdcMetafile, &size);
-    ok(ret, "GetViewportExtEx error %u\n", GetLastError());
-    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %i\n",size.cx);
+    ok(ret, "GetViewportExtEx error %lu\n", GetLastError());
+    ok(size.cx == 50,"Expecting ViewportExt cx of 50, got %li\n",size.cx);
 
     hFontCheck = SelectObject(hdcMetafile, hFontOld);
     ok(hFontOld == hFontCheck && hFontCheck != hFont && hFontCheck != hFont2,
@@ -812,19 +812,19 @@ static void test_SaveDC(void)
     ok(!ret, "ret = %d\n", ret);
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     ret = EnumEnhMetaFile(hdcDisplay, hMetafile, savedc_emf_enum_proc, 0, &rc);
     ok( ret == 1, "EnumEnhMetaFile rets %d\n", ret);
 
     ret = DeleteObject(hFont);
-    ok( ret, "DeleteObject error %d\n", GetLastError());
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
     ret = DeleteObject(hFont2);
-    ok( ret, "DeleteObject error %d\n", GetLastError());
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
     ret = DeleteEnhMetaFile(hMetafile);
-    ok( ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
     ret = ReleaseDC(hwnd, hdcDisplay);
-    ok( ret, "ReleaseDC error %d\n", GetLastError());
+    ok( ret, "ReleaseDC error %ld\n", GetLastError());
     DestroyWindow(hwnd);
 }
 
@@ -838,7 +838,7 @@ static void test_mf_SaveDC(void)
     HFONT hFont,hFont2,hFontOld,hFontCheck;
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA error %ld\n", GetLastError());
 
     ret = SetMapMode(hdcMetafile, MM_ANISOTROPIC);
     ok (ret, "SetMapMode should not fail\n");
@@ -848,16 +848,16 @@ static void test_mf_SaveDC(void)
 
     pt.x = pt.y = 5555;
     SetWindowOrgEx(hdcMetafile, 0, 0, &pt);
-    ok( pt.x == 5555 && pt.y == 5555, "wrong origin %d,%d\n", pt.x, pt.y);
+    ok( pt.x == 5555 && pt.y == 5555, "wrong origin %ld,%ld\n", pt.x, pt.y);
     pt.x = pt.y = 5555;
     SetViewportOrgEx(hdcMetafile, 0, 0, &pt);
-    ok( pt.x == 5555 && pt.y == 5555, "wrong origin %d,%d\n", pt.x, pt.y);
+    ok( pt.x == 5555 && pt.y == 5555, "wrong origin %ld,%ld\n", pt.x, pt.y);
     size.cx = size.cy = 5555;
     SetWindowExtEx(hdcMetafile, 110, 110, &size );
-    ok( size.cx == 5555 && size.cy == 5555, "wrong size %d,%d\n", size.cx, size.cy );
+    ok( size.cx == 5555 && size.cy == 5555, "wrong size %ld,%ld\n", size.cx, size.cy );
     size.cx = size.cy = 5555;
     SetViewportExtEx(hdcMetafile, 120, 120, &size );
-    ok( size.cx == 5555 && size.cy == 5555, "wrong size %d,%d\n", size.cx, size.cy );
+    ok( size.cx == 5555 && size.cy == 5555, "wrong size %ld,%ld\n", size.cx, size.cy );
 
     /* Force Win9x to update DC state */
     SetPixelV(hdcMetafile, 50, 50, 0);
@@ -937,12 +937,12 @@ static void test_mf_SaveDC(void)
     orig_lf.lfQuality = DEFAULT_QUALITY;
     lstrcpyA(orig_lf.lfFaceName, "Arial");
     hFont = CreateFontIndirectA(&orig_lf);
-    ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
 
     hFontOld = SelectObject(hdcMetafile, hFont);
 
     hFont2 = CreateFontIndirectA(&orig_lf);
-    ok(hFont2 != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont2 != 0, "CreateFontIndirectA error %ld\n", GetLastError());
     hFontCheck = SelectObject(hdcMetafile, hFont2);
     ok(hFontCheck == hFont, "Font not selected\n");
 
@@ -964,14 +964,14 @@ static void test_mf_SaveDC(void)
     ok(ret, "ret = %d\n", ret);
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
 
     ret = DeleteMetaFile(hMetafile);
-    ok( ret, "DeleteMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
     ret = DeleteObject(hFont);
-    ok( ret, "DeleteObject error %d\n", GetLastError());
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
     ret = DeleteObject(hFont2);
-    ok( ret, "DeleteObject error %d\n", GetLastError());
+    ok( ret, "DeleteObject error %ld\n", GetLastError());
 }
 
 
@@ -2016,7 +2016,7 @@ static const unsigned char emf_mask_blit_bits[] =
 static INT CALLBACK mf_enum_proc(HDC hdc, HANDLETABLE *ht, METARECORD *mr,
                                  INT nobj, LPARAM param)
 {
-    trace("hdc %p, mr->rdFunction %04x, mr->rdSize %u, param %p\n",
+    trace("hdc %p, mr->rdFunction %04x, mr->rdSize %lu, param %p\n",
            hdc, mr->rdFunction, mr->rdSize, (void *)param);
     return TRUE;
 }
@@ -2101,11 +2101,11 @@ static int compare_mf_disk_bits(LPCSTR name, const BYTE *bits, UINT bsize, const
     assert(mfsize <= MF_BUFSIZE);
 
     ret = ReadFile(hfile, buf, sizeof(buf), &rd_size, NULL);
-    ok( ret && rd_size == mfsize, "ReadFile: error %d\n", GetLastError());
+    ok( ret && rd_size == mfsize, "ReadFile: error %ld\n", GetLastError());
 
     CloseHandle(hfile);
 
-    ok(mfsize == bsize, "%s: mfsize=%d, bsize=%d.\n", desc, mfsize, bsize);
+    ok(mfsize == bsize, "%s: mfsize=%ld, bsize=%d.\n", desc, mfsize, bsize);
 
     if (mfsize != bsize)
         return -1;
@@ -2116,7 +2116,7 @@ static int compare_mf_disk_bits(LPCSTR name, const BYTE *bits, UINT bsize, const
         if (buf[i] != bits[i])
             diff++;
     }
-    ok(diff == 0, "%s: mfsize=%d, bsize=%d, diff=%d\n",
+    ok(diff == 0, "%s: mfsize=%ld, bsize=%d, diff=%d\n",
         desc, mfsize, bsize, diff);
 
     return diff; 
@@ -2158,7 +2158,7 @@ static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
     if (!winetest_debug) return;
 
     mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
-    ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError());
+    ok (mfsize > 0, "%s: GetEnhMetaFileBits error %ld\n", desc, GetLastError());
 
     printf("EMF %s has records:\n", desc);
 
@@ -2167,7 +2167,7 @@ static void dump_emf_records(const HENHMETAFILE mf, const char *desc)
     while(offset < mfsize)
     {
         EMR *emr = (EMR *)(emf + offset);
-        printf("emr->iType %d, emr->nSize %u\n", emr->iType, emr->nSize);
+        printf("emr->iType %ld, emr->nSize %lu\n", emr->iType, emr->nSize);
         /*trace("emr->iType 0x%04lx, emr->nSize 0x%04lx\n", emr->iType, emr->nSize);*/
         offset += emr->nSize;
     }
@@ -2180,7 +2180,7 @@ static void dump_emf_record(const ENHMETARECORD *emr, const char *desc)
 
     if (!winetest_debug) return;
 
-    printf ("%s: EMF record %u has bits:\n{\n", desc, emr->iType);
+    printf ("%s: EMF record %lu has bits:\n{\n", desc, emr->iType);
     buf = (const BYTE *)emr;
     for (i = 0; i < emr->nSize; i++)
     {
@@ -2197,18 +2197,18 @@ static void dump_emf_record(const ENHMETARECORD *emr, const char *desc)
 
 static void dump_EMREXTTEXTOUT(const EMREXTTEXTOUTW *eto)
 {
-    trace("rclBounds %d,%d - %d,%d\n", eto->rclBounds.left, eto->rclBounds.top,
+    trace("rclBounds %ld,%ld - %ld,%ld\n", eto->rclBounds.left, eto->rclBounds.top,
           eto->rclBounds.right, eto->rclBounds.bottom);
-    trace("iGraphicsMode %u\n", eto->iGraphicsMode);
+    trace("iGraphicsMode %lu\n", eto->iGraphicsMode);
     trace("exScale: %f\n", eto->exScale);
     trace("eyScale: %f\n", eto->eyScale);
-    trace("emrtext.ptlReference %d,%d\n", eto->emrtext.ptlReference.x, eto->emrtext.ptlReference.y);
-    trace("emrtext.nChars %u\n", eto->emrtext.nChars);
-    trace("emrtext.offString %#x\n", eto->emrtext.offString);
-    trace("emrtext.fOptions %#x\n", eto->emrtext.fOptions);
-    trace("emrtext.rcl %d,%d - %d,%d\n", eto->emrtext.rcl.left, eto->emrtext.rcl.top,
+    trace("emrtext.ptlReference %ld,%ld\n", eto->emrtext.ptlReference.x, eto->emrtext.ptlReference.y);
+    trace("emrtext.nChars %lu\n", eto->emrtext.nChars);
+    trace("emrtext.offString %#lx\n", eto->emrtext.offString);
+    trace("emrtext.fOptions %#lx\n", eto->emrtext.fOptions);
+    trace("emrtext.rcl %ld,%ld - %ld,%ld\n", eto->emrtext.rcl.left, eto->emrtext.rcl.top,
           eto->emrtext.rcl.right, eto->emrtext.rcl.bottom);
-    trace("emrtext.offDx %#x\n", eto->emrtext.offDx);
+    trace("emrtext.offDx %#lx\n", eto->emrtext.offDx);
 }
 
 static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr2,
@@ -2216,10 +2216,10 @@ static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr
 {
     int diff;
 
-    ok(emr1->iType == emr2->iType, "%s: emr->iType %u != %u\n",
+    ok(emr1->iType == emr2->iType, "%s: emr->iType %lu != %lu\n",
        desc, emr1->iType, emr2->iType);
 
-    ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %u != %u\n",
+    ok(emr1->nSize == emr2->nSize, "%s: emr->nSize %lu != %lu\n",
        desc, emr1->nSize, emr2->nSize);
 
     /* iType and nSize mismatches are fatal */
@@ -2293,7 +2293,7 @@ static BOOL match_emf_record(const ENHMETARECORD *emr1, const ENHMETARECORD *emr
     else
         diff = memcmp(emr1, emr2, emr1->nSize);
 
-    ok(diff == 0, "%s: contents of record %u don't match\n", desc, emr1->iType);
+    ok(diff == 0, "%s: contents of record %lu don't match\n", desc, emr1->iType);
 
     if (diff)
     {
@@ -2319,7 +2319,7 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits,
     const ENHMETAHEADER *emh1, *emh2;
 
     mfsize = GetEnhMetaFileBits(mf, MF_BUFSIZE, buf);
-    ok (mfsize > 0, "%s: GetEnhMetaFileBits error %d\n", desc, GetLastError());
+    ok (mfsize > 0, "%s: GetEnhMetaFileBits error %ld\n", desc, GetLastError());
 
     if (mfsize < MF_BUFSIZE)
     {
@@ -2332,26 +2332,26 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits,
     /* basic things must match */
     emh1 = (const ENHMETAHEADER *)bits;
     emh2 = (const ENHMETAHEADER *)buf;
-    ok(emh1->iType == EMR_HEADER, "expected EMR_HEADER, got %u\n", emh1->iType);
-    ok(emh1->nSize == sizeof(ENHMETAHEADER), "expected sizeof(ENHMETAHEADER), got %u\n", emh1->nSize);
-    ok(emh2->nBytes == mfsize, "expected emh->nBytes %u, got %u\n", mfsize, emh2->nBytes);
-    ok(emh1->dSignature == ENHMETA_SIGNATURE, "expected ENHMETA_SIGNATURE, got %u\n", emh1->dSignature);
+    ok(emh1->iType == EMR_HEADER, "expected EMR_HEADER, got %lu\n", emh1->iType);
+    ok(emh1->nSize == sizeof(ENHMETAHEADER), "expected sizeof(ENHMETAHEADER), got %lu\n", emh1->nSize);
+    ok(emh2->nBytes == mfsize, "expected emh->nBytes %u, got %lu\n", mfsize, emh2->nBytes);
+    ok(emh1->dSignature == ENHMETA_SIGNATURE, "expected ENHMETA_SIGNATURE, got %lu\n", emh1->dSignature);
 
-    ok(emh1->iType == emh2->iType, "expected EMR_HEADER, got %u\n", emh2->iType);
+    ok(emh1->iType == emh2->iType, "expected EMR_HEADER, got %lu\n", emh2->iType);
     ok(emh1->nSize == emh2->nSize,
-       "expected nSize %u, got %u\n", emh1->nSize, emh2->nSize);
-    ok(emh1->rclBounds.left == emh2->rclBounds.left, "%s: expected rclBounds.left = %d, got %d\n",
+       "expected nSize %lu, got %lu\n", emh1->nSize, emh2->nSize);
+    ok(emh1->rclBounds.left == emh2->rclBounds.left, "%s: expected rclBounds.left = %ld, got %ld\n",
             desc, emh1->rclBounds.left, emh2->rclBounds.left);
-    ok(emh1->rclBounds.top == emh2->rclBounds.top, "%s: expected rclBounds.top = %d, got %d\n",
+    ok(emh1->rclBounds.top == emh2->rclBounds.top, "%s: expected rclBounds.top = %ld, got %ld\n",
             desc, emh1->rclBounds.top, emh2->rclBounds.top);
-    ok(emh1->rclBounds.right == emh2->rclBounds.right, "%s: expected rclBounds.right = %d, got %d\n",
+    ok(emh1->rclBounds.right == emh2->rclBounds.right, "%s: expected rclBounds.right = %ld, got %ld\n",
             desc, emh1->rclBounds.right, emh2->rclBounds.right);
-    ok(emh1->rclBounds.bottom == emh2->rclBounds.bottom, "%s: expected rclBounds.bottom = %d, got %d\n",
+    ok(emh1->rclBounds.bottom == emh2->rclBounds.bottom, "%s: expected rclBounds.bottom = %ld, got %ld\n",
             desc, emh1->rclBounds.bottom, emh2->rclBounds.bottom);
-    ok(emh1->dSignature == emh2->dSignature, "expected dSignature %u, got %u\n", emh1->dSignature, emh2->dSignature);
+    ok(emh1->dSignature == emh2->dSignature, "expected dSignature %lu, got %lu\n", emh1->dSignature, emh2->dSignature);
     ok(emh1->nBytes == emh2->nBytes,
-       "expected nBytes %u, got %u\n", emh1->nBytes, emh2->nBytes);
-    ok(emh1->nRecords == emh2->nRecords, "expected nRecords %u, got %u\n", emh1->nRecords, emh2->nRecords);
+       "expected nBytes %lu, got %lu\n", emh1->nBytes, emh2->nBytes);
+    ok(emh1->nRecords == emh2->nRecords, "expected nRecords %lu, got %lu\n", emh1->nRecords, emh2->nRecords);
 
     offset1 = emh1->nSize;
     offset2 = emh2->nSize; /* Needed for Win9x/WinME/NT4 */
@@ -2361,7 +2361,7 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits,
         const ENHMETARECORD *emr2 = (const ENHMETARECORD *)(buf + offset2);
 
         if (winetest_debug > 1)
-            trace("%s: EMF record %u, size %u/record %u, size %u\n",
+            trace("%s: EMF record %lu, size %lu/record %lu, size %lu\n",
                   desc, emr1->iType, emr1->nSize, emr2->iType, emr2->nSize);
 
         if (!match_emf_record(emr1, emr2, desc, ignore_scaling)) return -1;
@@ -3392,17 +3392,17 @@ static void test_emf_BitBlt(void)
 
     /* Test that source DC cannot be an enhanced metafile */
     hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-    ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+    ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
     hdc_emf2 = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-    ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+    ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
     ret = StretchBlt(hdc_emf, 0, 0, 1, 1, hdc_emf2, 0, 0, 1, 1, SRCCOPY);
     ok(!ret, "StretchBlt succeeded\n");
 
     hemf2 = CloseEnhMetaFile(hdc_emf2);
-    ok(!!hemf2, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+    ok(!!hemf2, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
     hemf = CloseEnhMetaFile(hdc_emf);
-    ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+    ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
     DeleteEnhMetaFile(hemf2);
     DeleteEnhMetaFile(hemf);
 
@@ -3421,36 +3421,36 @@ static void test_emf_BitBlt(void)
         memcpy(bmi->bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
 
         hbitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-        ok(!!hbitmap, "CreateDIBSection failed, error %d\n", GetLastError());
+        ok(!!hbitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
         hdc_bitmap = CreateCompatibleDC(hdc);
-        ok(!!hdc_bitmap, "CreateCompatibleDC failed, error %d\n", GetLastError());
+        ok(!!hdc_bitmap, "CreateCompatibleDC failed, error %ld\n", GetLastError());
         old_hbitmap = SelectObject(hdc_bitmap, hbitmap);
 
         SetBkColor(hdc_bitmap, RGB(0xff, 0xff, 0xff));
         ret = SetGraphicsMode(hdc_bitmap, GM_ADVANCED);
-        ok(ret, "SetGraphicsMode failed, error %d\n", GetLastError());
+        ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
         ret = SetWorldTransform(hdc_bitmap, &xform);
-        ok(ret, "SetWorldTransform failed, error %d\n", GetLastError());
+        ok(ret, "SetWorldTransform failed, error %ld\n", GetLastError());
 
         hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
         ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
-        ok(ret, "BitBlt failed, error %d\n", GetLastError());
+        ok(ret, "BitBlt failed, error %ld\n", GetLastError());
         if (tests[test_idx].src_width == bitmap_width && tests[test_idx].src_height == bitmap_height)
         {
             ret = BitBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, SRCCOPY);
-            ok(ret, "BitBlt failed, error %d\n", GetLastError());
+            ok(ret, "BitBlt failed, error %ld\n", GetLastError());
         }
         else
         {
             ret = StretchBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0,
                              tests[test_idx].src_width, tests[test_idx].src_height, SRCCOPY);
-            ok(ret, "StretchBlt failed, error %d\n", GetLastError());
+            ok(ret, "StretchBlt failed, error %ld\n", GetLastError());
         }
 
         hemf = CloseEnhMetaFile(hdc_emf);
-        ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+        ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
 
         ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
                                "test_emf_BitBlt", FALSE);
@@ -3490,21 +3490,21 @@ static void test_emf_DCBrush(void)
     ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
 
     hBrush = SelectObject(hdcMetafile, GetStockObject(DC_BRUSH));
-    ok(hBrush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
 
     hPen = SelectObject(hdcMetafile, GetStockObject(DC_PEN));
-    ok(hPen != 0, "SelectObject error %d.\n", GetLastError());
+    ok(hPen != 0, "SelectObject error %ld.\n", GetLastError());
 
     color = pSetDCBrushColor( hdcMetafile, RGB(0x55,0x55,0x55) );
-    ok( color == 0xffffff, "SetDCBrushColor returned %x\n", color );
+    ok( color == 0xffffff, "SetDCBrushColor returned %lx\n", color );
 
     color = pSetDCPenColor( hdcMetafile, RGB(0x33,0x44,0x55) );
-    ok( color == 0, "SetDCPenColor returned %x\n", color );
+    ok( color == 0, "SetDCPenColor returned %lx\n", color );
 
     Rectangle( hdcMetafile, 10, 10, 20, 20 );
 
     color = pSetDCBrushColor( hdcMetafile, RGB(0x12,0x34,0x56) );
-    ok( color == 0x555555, "SetDCBrushColor returned %x\n", color );
+    ok( color == 0x555555, "SetDCBrushColor returned %lx\n", color );
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
     ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
@@ -3516,11 +3516,11 @@ static void test_emf_DCBrush(void)
         dump_emf_records(hMetafile, "emf_DC_Brush");
     }
     ret = DeleteEnhMetaFile(hMetafile);
-    ok( ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
     ret = DeleteObject(hBrush);
-    ok( ret, "DeleteObject(HBRUSH) error %d\n", GetLastError());
+    ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
     ret = DeleteObject(hPen);
-    ok( ret, "DeleteObject(HPEN) error %d\n", GetLastError());
+    ok( ret, "DeleteObject(HPEN) error %ld\n", GetLastError());
 }
 
 /* Test a blank metafile.  May be used as a template for new tests. */
@@ -3534,7 +3534,7 @@ static void test_mf_Blank(void)
     INT type;
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
 /* Tests on metafile initialization */
     caps = GetDeviceCaps (hdcMetafile, TECHNOLOGY);
@@ -3542,7 +3542,7 @@ static void test_mf_Blank(void)
         "GetDeviceCaps: TECHNOLOGY=%d != DT_METAFILE.\n", caps);
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
     type = GetObjectType(hMetafile);
     ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
     type = GetObjectType(hdcMetafile);
@@ -3557,7 +3557,7 @@ static void test_mf_Blank(void)
     }
 
     ret = DeleteMetaFile(hMetafile);
-    ok( ret, "DeleteMetaFile(%p) error %d\n", hMetafile, GetLastError());
+    ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
 }
 
 static void test_metafile_file(void)
@@ -3576,52 +3576,52 @@ static void test_metafile_file(void)
     GetTempFileNameA(temp_path, "wmf", 0, mf_name);
 
     dc = CreateMetaFileA(mf_name);
-    ok(dc != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(dc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     file = CreateFileA(mf_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
     ok(file == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION,
-       "CreateFile returned: %p %u\n", file, GetLastError());
+       "CreateFile returned: %p %lu\n", file, GetLastError());
 
     file = CreateFileA(mf_name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
 
     size = GetFileSize(file, NULL);
-    ok(!size, "size = %u\n", size);
+    ok(!size, "size = %lu\n", size);
 
     ret = MoveToEx(dc, 1, 1, NULL);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ret = LineTo(dc, 2, 2);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = MoveToEx(dc, 1, 1, &oldpoint);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ret = Ellipse(dc, 0, 0, 2, 2);
-    ok( ret, "Ellipse error %d.\n", GetLastError());
+    ok( ret, "Ellipse error %ld.\n", GetLastError());
 
     ret = GetCurrentPositionEx(dc, &oldpoint);
     ok(!ret, "GetCurrentPositionEx succeeded\n");
 
     size = GetFileSize(file, NULL);
-    ok(!size, "size = %u\n", size);
+    ok(!size, "size = %lu\n", size);
 
     metafile = CloseMetaFile(dc);
     size = GetFileSize(file, NULL);
-    ok(size == sizeof(MF_GRAPHICS_BITS), "size = %u\n", size);
+    ok(size == sizeof(MF_GRAPHICS_BITS), "size = %lu\n", size);
 
     CloseHandle(file);
     file = CreateFileA(mf_name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
     todo_wine
     ok(file == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION,
-       "CreateFile returned: %p %u\n", file, GetLastError());
+       "CreateFile returned: %p %lu\n", file, GetLastError());
     if (file != INVALID_HANDLE_VALUE) CloseHandle(file);
     file = CreateFileA(mf_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
     ret = ReadFile(file, buf, sizeof(buf), &size, NULL);
-    ok(ret, "ReadFile failed: %u\n", GetLastError());
-    ok(size == sizeof(MF_GRAPHICS_BITS), "size = %u\n", size);
+    ok(ret, "ReadFile failed: %lu\n", GetLastError());
+    ok(size == sizeof(MF_GRAPHICS_BITS), "size = %lu\n", size);
     ok(!memcmp(buf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS)), "unexpected file content\n");
     CloseHandle(file);
 
@@ -3632,30 +3632,30 @@ static void test_metafile_file(void)
     }
 
     ret = DeleteMetaFile(metafile);
-    ok(ret, "Could not delete metafile: %u\n", GetLastError());
+    ok(ret, "Could not delete metafile: %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DeleteMetaFile(metafile);
     ok(!ret, "DeleteMetaFile succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     metafile = CloseMetaFile(dc);
-    ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%u)\n",
+    ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%lu)\n",
        metafile, GetLastError());
 
     ret = DeleteFileA(mf_name);
-    ok(ret, "Could not delete file: %u\n", GetLastError());
+    ok(ret, "Could not delete file: %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DeleteMetaFile(ULongToHandle(0xdeadbeef));
     ok(!ret, "DeleteMetaFile succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     size = GetMetaFileBitsEx(ULongToHandle(0xdeadbeef), 0, NULL);
-    ok(!size, "GetMetaFileBitsEx returned %u\n", size);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(!size, "GetMetaFileBitsEx returned %lu\n", size);
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 }
 
 static void test_mf_SetPixel(void)
@@ -3669,25 +3669,25 @@ static void test_mf_SetPixel(void)
     ok(hdc != 0, "CreateEnhMetaFile failed\n");
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     c = SetPixel(hdc, 5, 5, RGB(1,2,3));
-    ok(c == 1, "c = %x\n", c);
+    ok(c == 1, "c = %lx\n", c);
 
     c = SetPixel(hdc, 5, 5, RGB(1,2,3));
-    ok(c == 1, "c = %x\n", c);
+    ok(c == 1, "c = %lx\n", c);
 
     ret = SetPixelV(hdc, 5, 5, RGB(1,2,3));
     ok(ret, "ret = %x\n", ret);
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     ret = Rectangle(hdc, 1, 1, 10, 10);
     ok(ret, "Rectangle failed\n");
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     mf = CloseMetaFile(hdc);
     ok(mf != 0, "CloseEnhMetaFile failed\n");
@@ -3734,19 +3734,19 @@ static void test_enhmetafile_file(void)
     GetTempFileNameA(temp_path, "wmf", 0, mf_name);
 
     dc = CreateEnhMetaFileA(NULL, mf_name, NULL, NULL);
-    ok(dc != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(dc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     file = CreateFileA(mf_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
     ok(file == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION,
-       "CreateFile returned: %p %u\n", file, GetLastError());
+       "CreateFile returned: %p %lu\n", file, GetLastError());
 
     file = CreateFileA(mf_name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
 
     size = GetFileSize(file, NULL);
-    ok(!size, "size = %u\n", size);
+    ok(!size, "size = %lu\n", size);
 
     pts[0].x = pts[0].y = 10;
     pts[1].x = pts[1].y = 20;
@@ -3764,25 +3764,25 @@ static void test_enhmetafile_file(void)
     ok( ret, "PolyBezierTo failed\n" );
 
     size = GetFileSize(file, NULL);
-    ok(!size, "size = %u\n", size);
+    ok(!size, "size = %lu\n", size);
 
     metafile = CloseEnhMetaFile(dc);
     size = GetFileSize(file, NULL);
-    ok(size == sizeof(EMF_BEZIER_BITS), "size = %u\n", size);
+    ok(size == sizeof(EMF_BEZIER_BITS), "size = %lu\n", size);
 
     CloseHandle(file);
     file = CreateFileA(mf_name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
     todo_wine
     ok(file == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION,
-       "CreateFile returned: %p %u\n", file, GetLastError());
+       "CreateFile returned: %p %lu\n", file, GetLastError());
     if (file != INVALID_HANDLE_VALUE) CloseHandle(file);
     file = CreateFileA(mf_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
                        OPEN_EXISTING, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
     ret = ReadFile(file, buf, sizeof(buf), &size, NULL);
-    ok(ret, "ReadFile failed: %u\n", GetLastError());
-    ok(size == sizeof(EMF_BEZIER_BITS), "size = %u\n", size);
+    ok(ret, "ReadFile failed: %lu\n", GetLastError());
+    ok(size == sizeof(EMF_BEZIER_BITS), "size = %lu\n", size);
     CloseHandle(file);
 
     if (compare_emf_bits(metafile, EMF_BEZIER_BITS, sizeof(EMF_BEZIER_BITS), "emf_Bezier", FALSE) != 0)
@@ -3792,30 +3792,30 @@ static void test_enhmetafile_file(void)
     }
 
     ret = DeleteEnhMetaFile(metafile);
-    ok(ret, "Could not delete emf: %u\n", GetLastError());
+    ok(ret, "Could not delete emf: %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DeleteEnhMetaFile(metafile);
     ok(!ret, "DeleteEnhMetaFile succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     metafile = CloseEnhMetaFile(dc);
-    ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%u)\n",
+    ok(!metafile && GetLastError() == ERROR_INVALID_HANDLE, "CloseMetaFile returned %p (%lu)\n",
        metafile, GetLastError());
 
     ret = DeleteFileA(mf_name);
-    ok(ret, "Could not delete file: %u\n", GetLastError());
+    ok(ret, "Could not delete file: %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = DeleteEnhMetaFile(ULongToHandle(0xdeadbeef));
     ok(!ret, "DeleteEnhMetaFile succeeded\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     size = GetEnhMetaFileBits(ULongToHandle(0xdeadbeef), 0, NULL);
-    ok(!size, "GetEnhMetaFileBitsEx returned %u\n", size);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
+    ok(!size, "GetEnhMetaFileBitsEx returned %lu\n", size);
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %lu\n", GetLastError());
 }
 
 static void test_emf_SetPixel(void)
@@ -3829,22 +3829,22 @@ static void test_emf_SetPixel(void)
     ok(hdc != 0, "CreateEnhMetaFile failed\n");
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     c = SetPixel(hdc, 5, 5, RGB(1,2,3));
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     ret = SetPixelV(hdc, 5, 5, RGB(1,2,3));
     ok(!ret, "ret = %x\n", ret);
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     ret = Rectangle(hdc, 1, 1, 10, 10);
     ok(ret, "Rectangle failed\n");
 
     c = GetPixel(hdc, 5, 5);
-    ok(c == CLR_INVALID, "c = %x\n", c);
+    ok(c == CLR_INVALID, "c = %lx\n", c);
 
     emf = CloseEnhMetaFile(hdc);
     ok(emf != 0, "CloseEnhMetaFile failed\n");
@@ -3885,10 +3885,10 @@ static void test_CopyMetaFile(void)
     INT type;
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
     type = GetObjectType(hMetafile);
     ok(type == OBJ_METAFILE, "CloseMetaFile created object with type %d\n", type);
 
@@ -3903,13 +3903,13 @@ static void test_CopyMetaFile(void)
     GetTempFileNameA(temp_path, "wmf", 0, mf_name);
 
     hmf_copy = CopyMetaFileA(hMetafile, mf_name);
-    ok(hmf_copy != 0, "CopyMetaFile error %d\n", GetLastError());
+    ok(hmf_copy != 0, "CopyMetaFile error %ld\n", GetLastError());
 
     type = GetObjectType(hmf_copy);
     ok(type == OBJ_METAFILE, "CopyMetaFile created object with type %d\n", type);
 
     ret = DeleteMetaFile(hMetafile);
-    ok( ret, "DeleteMetaFile(%p) error %d\n", hMetafile, GetLastError());
+    ok( ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
 
     if (compare_mf_disk_bits(mf_name, MF_BLANK_BITS, sizeof(MF_BLANK_BITS), "mf_blank") != 0)
     {
@@ -3918,7 +3918,7 @@ static void test_CopyMetaFile(void)
     }
 
     ret = DeleteMetaFile(hmf_copy);
-    ok( ret, "DeleteMetaFile(%p) error %d\n", hmf_copy, GetLastError());
+    ok( ret, "DeleteMetaFile(%p) error %ld\n", hmf_copy, GetLastError());
 
     DeleteFileA(mf_name);
 }
@@ -3932,7 +3932,7 @@ static void test_SetMetaFileBits(void)
     METAHEADER *mh;
 
     hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), MF_GRAPHICS_BITS);
-    ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError());
+    ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
     type = GetObjectType(hmf);
     ok(type == OBJ_METAFILE, "SetMetaFileBitsEx created object with type %d\n", type);
 
@@ -3943,7 +3943,7 @@ static void test_SetMetaFileBits(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 
     /* NULL data crashes XP SP1 */
     /*hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), NULL);*/
@@ -3952,13 +3952,13 @@ static void test_SetMetaFileBits(void)
     SetLastError(0xdeadbeef);
     hmf = SetMetaFileBitsEx(0, MF_GRAPHICS_BITS);
     ok(!hmf, "SetMetaFileBitsEx should fail\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %ld\n", GetLastError());
 
     /* Now with odd size */
     SetLastError(0xdeadbeef);
     hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS) - 1, MF_GRAPHICS_BITS);
     ok(!hmf, "SetMetaFileBitsEx should fail\n");
-    ok(GetLastError() == 0xdeadbeef /* XP SP1 */, "wrong error %d\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef /* XP SP1 */, "wrong error %ld\n", GetLastError());
 
     /* Now with zeroed out header fields */
     assert(sizeof(buf) >= sizeof(MF_GRAPHICS_BITS));
@@ -3971,7 +3971,7 @@ static void test_SetMetaFileBits(void)
     SetLastError(0xdeadbeef);
     hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
     ok(!hmf, "SetMetaFileBitsEx should fail\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %d\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "wrong error %ld\n", GetLastError());
 
     /* Now with corrupted mtSize field */
     memcpy(buf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS));
@@ -3979,7 +3979,7 @@ static void test_SetMetaFileBits(void)
     /* corruption of mtSize doesn't lead to a failure */
     mh->mtSize *= 2;
     hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
-    ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError());
+    ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
 
     if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
     {
@@ -3988,7 +3988,7 @@ static void test_SetMetaFileBits(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 
 #ifndef _WIN64 /* Generates access violation on XP x64 and Win2003 x64 */
     /* Now with zeroed out mtSize field */
@@ -3997,7 +3997,7 @@ static void test_SetMetaFileBits(void)
     /* zeroing mtSize doesn't lead to a failure */
     mh->mtSize = 0;
     hmf = SetMetaFileBitsEx(sizeof(MF_GRAPHICS_BITS), buf);
-    ok(hmf != 0, "SetMetaFileBitsEx error %d\n", GetLastError());
+    ok(hmf != 0, "SetMetaFileBitsEx error %ld\n", GetLastError());
 
     if (compare_mf_bits(hmf, MF_GRAPHICS_BITS, sizeof(MF_GRAPHICS_BITS), "mf_Graphics") != 0)
     {
@@ -4006,7 +4006,7 @@ static void test_SetMetaFileBits(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 #endif
 }
 
@@ -4025,21 +4025,21 @@ static void test_mf_Graphics(void)
     static const BYTE types[] = { PT_MOVETO, PT_LINETO };
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     ret = MoveToEx(hdcMetafile, 1, 1, NULL);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ret = LineTo(hdcMetafile, 2, 2);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
 
     oldpoint.x = oldpoint.y = 0xdeadbeef;
     ret = MoveToEx(hdcMetafile, 1, 1, &oldpoint);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ok(oldpoint.x == 0xdeadbeef && oldpoint.y == 0xdeadbeef,
        "MoveToEx modified oldpoint\n");
 
     ret = Ellipse(hdcMetafile, 0, 0, 2, 2);
-    ok( ret, "Ellipse error %d.\n", GetLastError());
+    ok( ret, "Ellipse error %ld.\n", GetLastError());
 
     ret = ArcTo(hdcMetafile, 1, 2, 30, 40, 11, 12, 23, 24 );
     ok( !ret, "ArcTo succeeded\n" );
@@ -4048,10 +4048,10 @@ static void test_mf_Graphics(void)
     ret = PolyDraw(hdcMetafile, points, types, ARRAY_SIZE(points));
     ok(!ret, "PolyDraw succeeded\n");
     todo_wine
-    ok(GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError());
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
     type = GetObjectType(hdcMetafile);
     ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
        "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
@@ -4064,7 +4064,7 @@ static void test_mf_Graphics(void)
     }
 
     ret = DeleteMetaFile(hMetafile);
-    ok( ret, "DeleteMetaFile(%p) error %d\n",
+    ok( ret, "DeleteMetaFile(%p) error %ld\n",
         hMetafile, GetLastError());
 }
 
@@ -4088,7 +4088,7 @@ static void test_mf_FloodFill(void)
     };
 
     hdc = CreateMetaFileA(NULL);
-    ok(hdc != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(hdc != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     ret = FloodFill(hdc, 1, 2, RGB(3,4,5));
     ok(ret, "FloodFill failed\n");
@@ -4100,7 +4100,7 @@ static void test_mf_FloodFill(void)
     ok(ret, "FloodFill failed\n");
 
     mf = CloseMetaFile(hdc);
-    ok(mf != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(mf != 0, "CloseMetaFile error %ld\n", GetLastError());
 
     if (compare_mf_bits (mf, floodfill_bits, sizeof(floodfill_bits),
         "mf_FloodFill") != 0)
@@ -4110,7 +4110,7 @@ static void test_mf_FloodFill(void)
     }
 
     ret = DeleteMetaFile(mf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", mf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", mf, GetLastError());
 }
 
 static void test_mf_PatternBrush(void)
@@ -4131,16 +4131,16 @@ static void test_mf_PatternBrush(void)
     orig_lb->lbStyle = BS_PATTERN;
     orig_lb->lbColor = RGB(0, 0, 0);
     orig_lb->lbHatch = (ULONG_PTR)CreateBitmap (8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
-    ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %d.\n", GetLastError());
+    ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
 
     hBrush = CreateBrushIndirect (orig_lb);
-    ok(hBrush != 0, "CreateBrushIndirect error %d\n", GetLastError());
+    ok(hBrush != 0, "CreateBrushIndirect error %ld\n", GetLastError());
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA error %ld\n", GetLastError());
 
     hBrush = SelectObject(hdcMetafile, hBrush);
-    ok(hBrush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
 
     memset(info, 0, sizeof(buffer));
     info->bmiHeader.biSize = sizeof(info->bmiHeader);
@@ -4156,10 +4156,10 @@ static void test_mf_PatternBrush(void)
     ok(dib_brush != NULL, "CreatePatternBrush failed\n");
 
     dib_brush = SelectObject(hdcMetafile, dib_brush);
-    ok(dib_brush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(dib_brush != 0, "SelectObject error %ld.\n", GetLastError());
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
     type = GetObjectType(hdcMetafile);
     ok(type == 0 || broken(type == OBJ_METADC) /* win10 >=1607 */,
        "CloseMetaFile has to destroy metafile hdc (%d)\n", type);
@@ -4172,13 +4172,13 @@ static void test_mf_PatternBrush(void)
     }
 
     ret = DeleteMetaFile(hMetafile);
-    ok( ret, "DeleteMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
     ret = DeleteObject(hBrush);
-    ok( ret, "DeleteObject(HBRUSH) error %d\n", GetLastError());
+    ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
     ret = DeleteObject(dib_brush);
     ok(ret, "DeleteObject failed\n");
     ret = DeleteObject((HBITMAP)orig_lb->lbHatch);
-    ok( ret, "DeleteObject(HBITMAP) error %d\n",
+    ok( ret, "DeleteObject(HBITMAP) error %ld\n",
         GetLastError());
     HeapFree (GetProcessHeap(), 0, orig_lb);
 }
@@ -4200,16 +4200,16 @@ static void test_emf_pattern_brush(void)
     orig_lb->lbStyle = BS_PATTERN;
     orig_lb->lbColor = RGB(0, 0, 0);
     orig_lb->lbHatch = (ULONG_PTR)CreateBitmap(8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
-    ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %d.\n", GetLastError());
+    ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
 
     bitmap_brush = CreateBrushIndirect(orig_lb);
-    ok(bitmap_brush != 0, "CreateBrushIndirect error %d\n", GetLastError());
+    ok(bitmap_brush != 0, "CreateBrushIndirect error %ld\n", GetLastError());
 
     hdc = CreateEnhMetaFileA(NULL, NULL, NULL, NULL);
-    ok(hdc != 0, "CreateMetaFileA error %d\n", GetLastError());
+    ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
 
     bitmap_brush = SelectObject(hdc, bitmap_brush);
-    ok(bitmap_brush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(bitmap_brush != 0, "SelectObject error %ld.\n", GetLastError());
 
     memset(info, 0, sizeof(buffer));
     info->bmiHeader.biSize = sizeof(info->bmiHeader);
@@ -4225,10 +4225,10 @@ static void test_emf_pattern_brush(void)
     ok(dib_brush != NULL, "CreatePatternBrush failed\n");
 
     dib_brush = SelectObject(hdc, dib_brush);
-    ok(dib_brush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(dib_brush != 0, "SelectObject error %ld.\n", GetLastError());
 
     emf = CloseEnhMetaFile(hdc);
-    ok(emf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(emf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(emf, emf_pattern_brush_bits, sizeof(emf_pattern_brush_bits),
                          "emf_pattern_brush", FALSE))
@@ -4238,7 +4238,7 @@ static void test_emf_pattern_brush(void)
     }
 
     ret = DeleteEnhMetaFile(emf);
-    ok(ret, "DeleteMetaFile error %d\n", GetLastError());
+    ok(ret, "DeleteMetaFile error %ld\n", GetLastError());
     ret = DeleteObject(bitmap_brush);
     ok(ret, "DeleteObject failed\n");
     ret = DeleteObject(dib_brush);
@@ -4320,21 +4320,21 @@ static void test_mf_DCBrush(void)
     ok( hdcMetafile != 0, "CreateMetaFileA failed\n" );
 
     hBrush = SelectObject(hdcMetafile, GetStockObject(DC_BRUSH));
-    ok(hBrush != 0, "SelectObject error %d.\n", GetLastError());
+    ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError());
 
     hPen = SelectObject(hdcMetafile, GetStockObject(DC_PEN));
-    ok(hPen != 0, "SelectObject error %d.\n", GetLastError());
+    ok(hPen != 0, "SelectObject error %ld.\n", GetLastError());
 
     color = pSetDCBrushColor( hdcMetafile, RGB(0x55,0x55,0x55) );
-    ok( color == CLR_INVALID, "SetDCBrushColor returned %x\n", color );
+    ok( color == CLR_INVALID, "SetDCBrushColor returned %lx\n", color );
 
     color = pSetDCPenColor( hdcMetafile, RGB(0x33,0x44,0x55) );
-    ok( color == CLR_INVALID, "SetDCPenColor returned %x\n", color );
+    ok( color == CLR_INVALID, "SetDCPenColor returned %lx\n", color );
 
     Rectangle( hdcMetafile, 10, 10, 20, 20 );
 
     color = pSetDCBrushColor( hdcMetafile, RGB(0x12,0x34,0x56) );
-    ok( color == CLR_INVALID, "SetDCBrushColor returned %x\n", color );
+    ok( color == CLR_INVALID, "SetDCBrushColor returned %lx\n", color );
 
     hMetafile = CloseMetaFile(hdcMetafile);
     ok( hMetafile != 0, "CloseMetaFile failed\n" );
@@ -4345,7 +4345,7 @@ static void test_mf_DCBrush(void)
         EnumMetaFile(0, hMetafile, mf_enum_proc, 0);
     }
     ret = DeleteMetaFile(hMetafile);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hMetafile, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
 }
 
 static void test_mf_select(void)
@@ -4431,7 +4431,7 @@ static void test_mf_select(void)
     /* pen is still black after RestoreDC */
     ok(obj == GetStockObject(BLACK_PEN), "unexpected pen: %p\n", obj);
     ret = DeleteObject(pen);
-    ok(ret, "DeleteObject failed: %u\n", GetLastError());
+    ok(ret, "DeleteObject failed: %lu\n", GetLastError());
 
     obj = GetCurrentObject(hdc, OBJ_PEN);
     ok(!obj, "GetCurrentObject succeeded\n");
@@ -4439,7 +4439,7 @@ static void test_mf_select(void)
     SetLastError(0xdeadbeef);
     obj = SelectObject(hdc, GetStockObject(DEFAULT_PALETTE));
     ok(!obj && GetLastError() == ERROR_INVALID_FUNCTION,
-       "SelectObject returned %p (%u).\n", obj, GetLastError());
+       "SelectObject returned %p (%lu).\n", obj, GetLastError());
 
     ret = RestoreDC(hdc, -5);
     ok(ret, "RestoreDC failed\n");
@@ -4454,7 +4454,7 @@ static void test_mf_select(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 
     /* create two metafiles, select the same pen to both of them,
      * unselect it from only one and then delete */
@@ -4472,7 +4472,7 @@ static void test_mf_select(void)
     obj = SelectObject(hdc, GetStockObject(BLACK_PEN));
     ok(obj == pen, "unexpected pen: %p\n", obj);
     ret = DeleteObject(pen);
-    ok(ret, "DeleteObject failed: %u\n", GetLastError());
+    ok(ret, "DeleteObject failed: %lu\n", GetLastError());
 
     hmf = CloseMetaFile(hdc);
     ok(hmf != 0, "CloseMetaFile failed\n");
@@ -4483,7 +4483,7 @@ static void test_mf_select(void)
         EnumMetaFile(0, hmf, mf_enum_proc, 0);
     }
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 
     hmf = CloseMetaFile(hdc2);
     ok(hmf != 0, "CloseMetaFile failed\n");
@@ -4494,7 +4494,7 @@ static void test_mf_select(void)
         EnumMetaFile(0, hmf, mf_enum_proc, 0);
     }
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 }
 
 static void test_emf_select(void)
@@ -4622,14 +4622,14 @@ static void test_emf_select(void)
     /* pen is still black after RestoreDC */
     ok(obj == pen, "unexpected pen: %p\n", obj);
     ret = DeleteObject(pen);
-    ok(ret, "DeleteObject failed: %u\n", GetLastError());
+    ok(ret, "DeleteObject failed: %lu\n", GetLastError());
 
     obj = GetCurrentObject(hdc, OBJ_PEN);
     ok(obj == GetStockObject(BLACK_PEN), "GetCurrentObject returned %p\n", obj);
 
     SetLastError(0xdeadbeef);
     obj = SelectObject(hdc, GetStockObject(DEFAULT_PALETTE));
-    ok(!obj, "SelectObject returned %p (%u).\n", obj, GetLastError());
+    ok(!obj, "SelectObject returned %p (%lu).\n", obj, GetLastError());
 
     ret = RestoreDC(hdc, -5);
     ok(!ret, "RestoreDC succeeded\n");
@@ -4644,7 +4644,7 @@ static void test_emf_select(void)
     }
 
     ret = DeleteEnhMetaFile(hemf);
-    ok(ret, "DeleteEnhMetaFile(%p) error %d\n", hemf, GetLastError());
+    ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
 
     /* create two EMFs, select the same pen to both of them,
      * unselect it from only one and then delete */
@@ -4662,7 +4662,7 @@ static void test_emf_select(void)
     obj = SelectObject(hdc, GetStockObject(BLACK_PEN));
     ok(obj == pen, "unexpected pen: %p\n", obj);
     ret = DeleteObject(pen);
-    ok(ret, "DeleteObject failed: %u\n", GetLastError());
+    ok(ret, "DeleteObject failed: %lu\n", GetLastError());
 
     hemf = CloseEnhMetaFile(hdc);
     ok(hemf != 0, "CloseEnhMetaFile failed\n");
@@ -4673,7 +4673,7 @@ static void test_emf_select(void)
         dump_emf_records(hemf, "emf_delete_not_selected");
     }
     ret = DeleteEnhMetaFile(hemf);
-    ok(ret, "DeleteEnhMetaFile(%p) error %d\n", hemf, GetLastError());
+    ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
 
     hemf = CloseEnhMetaFile(hdc2);
     ok(hemf != 0, "CloseEnhMetaFile failed\n");
@@ -4684,7 +4684,7 @@ static void test_emf_select(void)
         dump_emf_records(hemf, "emf_delete_selected");
     }
     ret = DeleteEnhMetaFile(hemf);
-    ok(ret, "DeleteEnhMetaFile(%p) error %d\n", hemf, GetLastError());
+    ok(ret, "DeleteEnhMetaFile(%p) error %ld\n", hemf, GetLastError());
 }
 
 static const PALETTEENTRY logpalettedata[8] = {
@@ -4764,7 +4764,7 @@ static void test_mf_palette(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 }
 
 static void test_mf_blit(void)
@@ -4852,7 +4852,7 @@ static void test_mf_blit(void)
     bmi.bmiHeader.biPlanes = 1;
     bmi.bmiHeader.biCompression = BI_RGB;
     bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-    ok(!!bitmap, "CreateDIBSection failed, error %d\n", GetLastError());
+    ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
     for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
         ((BYTE *)bits)[i] = i + 10;
 
@@ -4886,7 +4886,7 @@ static void test_mf_blit(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 }
 
 static void test_emf_blit(void)
@@ -4914,7 +4914,7 @@ static void test_emf_blit(void)
     bmi.bmiHeader.biPlanes = 1;
     bmi.bmiHeader.biCompression = BI_RGB;
     bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-    ok(!!bitmap, "CreateDIBSection failed, error %d\n", GetLastError());
+    ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
     for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
         ((BYTE *)bits)[i] = i + 10;
 
@@ -4951,7 +4951,7 @@ static void test_emf_blit(void)
     }
 
     ret = DeleteEnhMetaFile(hmf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hmf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hmf, GetLastError());
 }
 
 static void test_emf_mask_blit(void)
@@ -4978,7 +4978,7 @@ static void test_emf_mask_blit(void)
     bmi.bmiHeader.biPlanes = 1;
     bmi.bmiHeader.biCompression = BI_RGB;
     bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-    ok(!!bitmap, "CreateDIBSection failed, error %d\n", GetLastError());
+    ok(!!bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
     for (i = 0; i < bmi.bmiHeader.biHeight * bmi.bmiHeader.biWidth * 3; i++)
         ((BYTE *)bits)[i] = i + 10;
 
@@ -4988,7 +4988,7 @@ static void test_emf_mask_blit(void)
     bmi.bmiHeader.biPlanes = 1;
     bmi.bmiHeader.biCompression = BI_RGB;
     mask_bitmap = CreateDIBSection(dib_hdc, &bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-    ok(!!mask_bitmap, "CreateDIBSection failed, error %d\n", GetLastError());
+    ok(!!mask_bitmap, "CreateDIBSection failed, error %ld\n", GetLastError());
     memset(bits, ~0, bmi.bmiHeader.biHeight * 4);
 
     SelectObject(dib_hdc, bitmap);
@@ -5017,7 +5017,7 @@ static void test_emf_mask_blit(void)
     }
 
     ret = DeleteEnhMetaFile(emf);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", emf, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", emf, GetLastError());
 }
 
 static const unsigned char EMF_STRETCHDIBITS_1BIT_3X3_NOSIZE[] =
@@ -6412,15 +6412,15 @@ static void test_emf_StretchDIBits(void)
         }
 
         hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
         ret = StretchDIBits(hdc_emf, 0, 0, bitmap_width, bitmap_height, 0, 0,
                             tests[test_idx].src_width, tests[test_idx].src_height,
                             dib_bits, &bmi.i, DIB_RGB_COLORS, SRCCOPY);
-        ok(ret == bitmap_height, "expected StretchDIBits to return %d, got %d (lasterr %u)\n", bitmap_height, ret, GetLastError());
+        ok(ret == bitmap_height, "expected StretchDIBits to return %d, got %d (lasterr %lu)\n", bitmap_height, ret, GetLastError());
 
         hemf = CloseEnhMetaFile(hdc_emf);
-        ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+        ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
 
         ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
                                "test_emf_StretchDIBits", FALSE);
@@ -7794,16 +7794,16 @@ static void test_emf_SetDIBitsToDevice(void)
         }
 
         hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+        ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
         ret = SetDIBitsToDevice(hdc_emf, 0, 0,
                                 tests[test_idx].width, tests[test_idx].height,
                                 0, 0, 0, bitmap_height,
                                 dib_bits, &bmi.i, DIB_RGB_COLORS);
-        ok(ret == tests[test_idx].height, "expected SetDIBitsToDevice to return %d, got %d (lasterr %u)\n", tests[test_idx].height, ret, GetLastError());
+        ok(ret == tests[test_idx].height, "expected SetDIBitsToDevice to return %d, got %d (lasterr %lu)\n", tests[test_idx].height, ret, GetLastError());
 
         hemf = CloseEnhMetaFile(hdc_emf);
-        ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+        ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
 
         ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count,
                                "test_emf_SetDIBitsToDevice", FALSE);
@@ -7829,19 +7829,19 @@ static void test_mf_ExtTextOut_on_path(void)
     static const INT dx[4] = { 3, 5, 8, 12 };
 
     hdcMetafile = CreateMetaFileA(NULL);
-    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateMetaFileA(NULL) error %ld\n", GetLastError());
 
     ret = BeginPath(hdcMetafile);
     ok(!ret, "BeginPath on metafile DC should fail\n");
 
     ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
-    ok(ret, "ExtTextOut error %d\n", GetLastError());
+    ok(ret, "ExtTextOut error %ld\n", GetLastError());
 
     ret = EndPath(hdcMetafile);
     ok(!ret, "EndPath on metafile DC should fail\n");
 
     hMetafile = CloseMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError());
 
     if (compare_mf_bits(hMetafile, MF_TEXTOUT_ON_PATH_BITS, sizeof(MF_TEXTOUT_ON_PATH_BITS),
         "mf_TextOut_on_path") != 0)
@@ -7851,7 +7851,7 @@ static void test_mf_ExtTextOut_on_path(void)
     }
 
     ret = DeleteMetaFile(hMetafile);
-    ok(ret, "DeleteMetaFile(%p) error %d\n", hMetafile, GetLastError());
+    ok(ret, "DeleteMetaFile(%p) error %ld\n", hMetafile, GetLastError());
 }
 
 static const unsigned char EMF_EMPTY_BITS[] =
@@ -7888,41 +7888,41 @@ static void test_emf_ExtTextOut_on_path(void)
     /* Win9x doesn't play EMFs on invisible windows */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
     hdcDisplay = GetDC(hwnd);
-    ok(hdcDisplay != 0, "GetDC error %d\n", GetLastError());
+    ok(hdcDisplay != 0, "GetDC error %ld\n", GetLastError());
 
     /* with default font */
     ret = BeginPath(hdcDisplay);
-    ok(ret, "BeginPath error %d\n", GetLastError());
+    ok(ret, "BeginPath error %ld\n", GetLastError());
 
     ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
-    ok(ret, "ExtTextOut error %d\n", GetLastError());
+    ok(ret, "ExtTextOut error %ld\n", GetLastError());
 
     ret = EndPath(hdcDisplay);
-    ok(ret, "EndPath error %d\n", GetLastError());
+    ok(ret, "EndPath error %ld\n", GetLastError());
 
     ret = GetPath(hdcDisplay, NULL, NULL, 0);
     ok(!ret, "expected 0, got %d\n", ret);
 
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ret = BeginPath(hdcMetafile);
-    ok(ret, "BeginPath error %d\n", GetLastError());
+    ok(ret, "BeginPath error %ld\n", GetLastError());
 
     ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
-    ok(ret, "ExtTextOut error %d\n", GetLastError());
+    ok(ret, "ExtTextOut error %ld\n", GetLastError());
 
     ret = EndPath(hdcMetafile);
-    ok(ret, "EndPath error %d\n", GetLastError());
+    ok(ret, "EndPath error %ld\n", GetLastError());
 
     ret = GetPath(hdcMetafile, NULL, NULL, 0);
     ok(!ret, "expected 0, got %d\n", ret);
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     /* this doesn't succeed yet: EMF has correct size, all EMF records
      * are there, but their contents don't match for different reasons.
@@ -7935,7 +7935,7 @@ static void test_emf_ExtTextOut_on_path(void)
     }
 
     ret = DeleteEnhMetaFile(hMetafile);
-    ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
 
     /* with outline font */
     memset(&lf, 0, sizeof(lf));
@@ -7946,17 +7946,17 @@ static void test_emf_ExtTextOut_on_path(void)
     lf.lfQuality = DEFAULT_QUALITY;
     lstrcpyA(lf.lfFaceName, "Tahoma");
     hFont = CreateFontIndirectA(&lf);
-    ok(hFont != 0, "CreateFontIndirectA error %d\n", GetLastError());
+    ok(hFont != 0, "CreateFontIndirectA error %ld\n", GetLastError());
     hFont = SelectObject(hdcDisplay, hFont);
 
     ret = BeginPath(hdcDisplay);
-    ok(ret, "BeginPath error %d\n", GetLastError());
+    ok(ret, "BeginPath error %ld\n", GetLastError());
 
     ret = ExtTextOutA(hdcDisplay, 11, 22, 0, NULL, "Test", 4, dx);
-    ok(ret, "ExtTextOut error %d\n", GetLastError());
+    ok(ret, "ExtTextOut error %ld\n", GetLastError());
 
     ret = EndPath(hdcDisplay);
-    ok(ret, "EndPath error %d\n", GetLastError());
+    ok(ret, "EndPath error %ld\n", GetLastError());
 
     ret = GetPath(hdcDisplay, NULL, NULL, 0);
     ok(ret != 0, "expected != 0\n");
@@ -7964,18 +7964,18 @@ static void test_emf_ExtTextOut_on_path(void)
     SelectObject(hdcDisplay, hFont);
 
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     hFont = SelectObject(hdcMetafile, hFont);
 
     ret = BeginPath(hdcMetafile);
-    ok(ret, "BeginPath error %d\n", GetLastError());
+    ok(ret, "BeginPath error %ld\n", GetLastError());
 
     ret = ExtTextOutA(hdcMetafile, 11, 22, 0, NULL, "Test", 4, dx);
-    ok(ret, "ExtTextOut error %d\n", GetLastError());
+    ok(ret, "ExtTextOut error %ld\n", GetLastError());
 
     ret = EndPath(hdcMetafile);
-    ok(ret, "EndPath error %d\n", GetLastError());
+    ok(ret, "EndPath error %ld\n", GetLastError());
 
     ret = GetPath(hdcMetafile, NULL, NULL, 0);
     ok(!ret, "expected 0, got %d\n", ret);
@@ -7984,7 +7984,7 @@ static void test_emf_ExtTextOut_on_path(void)
     DeleteObject(hFont);
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(hMetafile, EMF_TEXTOUT_OUTLINE_ON_PATH_BITS, sizeof(EMF_TEXTOUT_OUTLINE_ON_PATH_BITS),
         "emf_TextOut_outline_on_path", FALSE) != 0)
@@ -7994,17 +7994,17 @@ static void test_emf_ExtTextOut_on_path(void)
     }
 
     ret = DeleteEnhMetaFile(hMetafile);
-    ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
 
     /* test ExtTextOut with count == -1 doesn't get written */
     hdcMetafile = CreateEnhMetaFileA(hdcDisplay, NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ret = ExtTextOutA(hdcMetafile, 11, 22, ETO_OPAQUE, &rect, "Test", -1, dx);
-    ok(!ret, "ExtTextOut error %d\n", GetLastError());
+    ok(!ret, "ExtTextOut error %ld\n", GetLastError());
 
     hMetafile = CloseEnhMetaFile(hdcMetafile);
-    ok(hMetafile != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(hMetafile, EMF_EMPTY_BITS, sizeof(EMF_EMPTY_BITS),
         "emf_TextOut_negative_count", FALSE) != 0)
@@ -8014,10 +8014,10 @@ static void test_emf_ExtTextOut_on_path(void)
     }
 
     ret = DeleteEnhMetaFile(hMetafile);
-    ok(ret, "DeleteEnhMetaFile error %d\n", GetLastError());
+    ok(ret, "DeleteEnhMetaFile error %ld\n", GetLastError());
 
     ret = ReleaseDC(hwnd, hdcDisplay);
-    ok(ret, "ReleaseDC error %d\n", GetLastError());
+    ok(ret, "ReleaseDC error %ld\n", GetLastError());
     DestroyWindow(hwnd);
 }
 
@@ -8099,18 +8099,18 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         INT ret;
 
         if (winetest_debug > 1)
-            trace("EMR_EXTSELECTCLIPRGN: cbRgnData %#x, iMode %u\n", clip->cbRgnData, clip->iMode);
+            trace("EMR_EXTSELECTCLIPRGN: cbRgnData %#lx, iMode %lu\n", clip->cbRgnData, clip->iMode);
 
-        ok(clip->iMode == RGN_COPY, "expected RGN_COPY, got %u\n", clip->iMode);
+        ok(clip->iMode == RGN_COPY, "expected RGN_COPY, got %lu\n", clip->iMode);
         ok(clip->cbRgnData >= sizeof(RGNDATAHEADER) + sizeof(RECT),
-           "too small data block: %u bytes\n", clip->cbRgnData);
+           "too small data block: %lu bytes\n", clip->cbRgnData);
         if (clip->cbRgnData < sizeof(RGNDATAHEADER) + sizeof(RECT))
             return 0;
 
         rgn1 = (const union _rgn *)clip->RgnData;
 
         if (winetest_debug > 1)
-            trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
+            trace("size %lu, type %lu, count %lu, rgn size %lu, bound %s\n",
                   rgn1->data.rdh.dwSize, rgn1->data.rdh.iType,
                   rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize,
                   wine_dbgstr_rect(&rgn1->data.rdh.rcBound));
@@ -8121,18 +8121,18 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         if (winetest_debug > 1) trace("rect %s\n", wine_dbgstr_rect(&rect));
         ok(EqualRect(&rect, rc), "rects don't match\n");
 
-        ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn1->data.rdh.dwSize);
-        ok(rgn1->data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn1->data.rdh.iType);
-        ok(rgn1->data.rdh.nCount == 1, "expected 1, got %u\n", rgn1->data.rdh.nCount);
+        ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %lu\n", rgn1->data.rdh.dwSize);
+        ok(rgn1->data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %lu\n", rgn1->data.rdh.iType);
+        ok(rgn1->data.rdh.nCount == 1, "expected 1, got %lu\n", rgn1->data.rdh.nCount);
         ok(rgn1->data.rdh.nRgnSize == sizeof(RECT),
-           "expected sizeof(RECT), got %u\n", rgn1->data.rdh.nRgnSize);
+           "expected sizeof(RECT), got %lu\n", rgn1->data.rdh.nRgnSize);
 
         hrgn = CreateRectRgn(0, 0, 0, 0);
 
         memset(&xform, 0, sizeof(xform));
         SetLastError(0xdeadbeef);
         ret = GetWorldTransform(hdc, &xform);
-        ok(ret, "GetWorldTransform error %u\n", GetLastError());
+        ok(ret, "GetWorldTransform error %lu\n", GetLastError());
 
         if (winetest_debug > 1) trace("xform.eM11 %f, xform.eM22 %f\n", xform.eM11, xform.eM22);
 
@@ -8151,7 +8151,7 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         ok(ret == sizeof(rgn2), "expected sizeof(rgn2), got %u\n", ret);
 
         if (winetest_debug > 1)
-            trace("size %u, type %u, count %u, rgn size %u, bound %s\n", rgn2.data.rdh.dwSize,
+            trace("size %lu, type %lu, count %lu, rgn size %lu, bound %s\n", rgn2.data.rdh.dwSize,
                   rgn2.data.rdh.iType, rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
                   wine_dbgstr_rect(&rgn2.data.rdh.rcBound));
 
@@ -8169,11 +8169,11 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
         if (winetest_debug > 1) trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
         ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
 
-        ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn2.data.rdh.dwSize);
-        ok(rgn2.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn2.data.rdh.iType);
-        ok(rgn2.data.rdh.nCount == 1, "expected 1, got %u\n", rgn2.data.rdh.nCount);
+        ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %lu\n", rgn2.data.rdh.dwSize);
+        ok(rgn2.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %lu\n", rgn2.data.rdh.iType);
+        ok(rgn2.data.rdh.nCount == 1, "expected 1, got %lu\n", rgn2.data.rdh.nCount);
         ok(rgn2.data.rdh.nRgnSize == sizeof(RECT),
-           "expected sizeof(RECT), got %u\n", rgn2.data.rdh.nRgnSize);
+           "expected sizeof(RECT), got %lu\n", rgn2.data.rdh.nRgnSize);
 
         DeleteObject(hrgn);
     }
@@ -8195,7 +8195,7 @@ static void test_emf_clipping(void)
 
     SetLastError(0xdeadbeef);
     hdc = CreateEnhMetaFileA(0, NULL, NULL, NULL);
-    ok(hdc != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdc != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     /* Need to write something to the emf, otherwise Windows won't play it back */
     LineTo(hdc, 1, 1);
@@ -8208,11 +8208,11 @@ static void test_emf_clipping(void)
     Rectangle(hdc, rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
     EndPath(hdc);
     ret = SelectClipPath(hdc, RGN_AND);
-    ok(ret, "SelectClipPath error %d\n", GetLastError());
+    ok(ret, "SelectClipPath error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     hemf = CloseEnhMetaFile(hdc);
-    ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(hemf, EMF_CLIPPING, sizeof(EMF_CLIPPING),
         "emf_clipping", FALSE) != 0)
@@ -8226,12 +8226,12 @@ static void test_emf_clipping(void)
     /* Win9x doesn't play EMFs on invisible windows */
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
     hdc = GetDC(hwnd);
 
     ret = EnumEnhMetaFile(hdc, hemf, clip_emf_enum_proc, &rc_clip, &rc);
-    ok(ret, "EnumEnhMetaFile error %d\n", GetLastError());
+    ok(ret, "EnumEnhMetaFile error %ld\n", GetLastError());
 
     DeleteEnhMetaFile(hemf);
     ReleaseDC(hwnd, hdc);
@@ -8264,7 +8264,7 @@ static void test_emf_clipping(void)
     ok(ret == 1, "expected 1, got %d\n", ret);
     ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
     ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
-    ok(rgndata->rdh.nCount == 1, "got %u rectangles\n", rgndata->rdh.nCount);
+    ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
     ok(EqualRect((RECT *)rgndata->Buffer, &rc), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
     SetRect(&rc_res, -1, -1, -1, -1);
     ret = GetClipBox(hdc, &rc_res);
@@ -8280,7 +8280,7 @@ static void test_emf_clipping(void)
     ok(ret == 1, "expected 1, got %d\n", ret);
     ret = GetRegionData(hrgn, sizeof(buffer), rgndata);
     ok(ret == sizeof(RGNDATAHEADER) + sizeof(RECT), "got %u\n", ret);
-    ok(rgndata->rdh.nCount == 1, "got %u rectangles\n", rgndata->rdh.nCount);
+    ok(rgndata->rdh.nCount == 1, "got %lu rectangles\n", rgndata->rdh.nCount);
     ok(EqualRect((RECT *)rgndata->Buffer, &rc_sclip), "got rect %s\n", wine_dbgstr_rect((RECT *)rgndata->Buffer));
     SetRect(&rc_res, -1, -1, -1, -1);
     ret = GetClipBox(hdc, &rc_res);
@@ -8368,7 +8368,7 @@ static void test_mf_clipping(void)
 
     SetLastError(0xdeadbeef);
     hdc = CreateMetaFileA(NULL);
-    ok(hdc != 0, "CreateMetaFileA error %d\n", GetLastError());
+    ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
 
     hrgn = CreateRectRgn(rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
     ret = SelectClipRgn(hdc, hrgn);
@@ -8381,7 +8381,7 @@ static void test_mf_clipping(void)
 
     SetLastError(0xdeadbeef);
     hmf = CloseMetaFile(hdc);
-    ok(hmf != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hmf != 0, "CloseMetaFile error %ld\n", GetLastError());
 
     if (compare_mf_bits(hmf, MF_CLIP_BITS, sizeof(MF_CLIP_BITS),
         "mf_clipping") != 0)
@@ -8393,12 +8393,12 @@ static void test_mf_clipping(void)
 
     hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                            0, 0, 200, 200, 0, 0, 0, NULL);
-    ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+    ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
     hdc = GetDC(hwnd);
 
     ret = EnumMetaFile(hdc, hmf, clip_mf_enum_proc, (LPARAM)&rc_clip);
-    ok(ret, "EnumMetaFile error %d\n", GetLastError());
+    ok(ret, "EnumMetaFile error %ld\n", GetLastError());
 
     /* Oddly, windows doesn't seem to use META_SELECTCLIPREGION */
     ok(clip_mf_enum_proc_seen_selectclipregion == 0,
@@ -8435,20 +8435,20 @@ static void test_mf_GetPath(void)
 
     SetLastError(0xdeadbeef);
     hdc = CreateMetaFileA(NULL);
-    ok(hdc != 0, "CreateMetaFileA error %d\n", GetLastError());
+    ok(hdc != 0, "CreateMetaFileA error %ld\n", GetLastError());
 
     ret = BeginPath(hdc);
     ok(!ret, "BeginPath on metafile DC should fail\n");
     ret = MoveToEx(hdc, 50, 50, NULL);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ret = LineTo(hdc, 50, 150);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdc, 150, 150);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdc, 150, 50);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdc, 50, 50);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     Rectangle(hdc, 10, 10, 20, 20);
     EndPath(hdc);
 
@@ -8456,7 +8456,7 @@ static void test_mf_GetPath(void)
     ok( size == -1, "GetPath returned %d.\n", size);
 
     hmf = CloseMetaFile(hdc);
-    ok(hmf != 0, "CloseMetaFile error %d\n", GetLastError());
+    ok(hmf != 0, "CloseMetaFile error %ld\n", GetLastError());
 
     if (compare_mf_bits (hmf, MF_PATH_BITS, sizeof(MF_PATH_BITS), "mf_GetPath") != 0)
     {
@@ -8465,7 +8465,7 @@ static void test_mf_GetPath(void)
     }
 
     ret = DeleteMetaFile(hmf);
-    ok( ret, "DeleteMetaFile error %d\n", GetLastError());
+    ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
 }
 
 static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)
@@ -8477,7 +8477,7 @@ static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETAREC
     PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj);
     LPtoDP(hdc, mapping, 2);
     if (winetest_debug > 1)
-        trace("EMF record: iType %d, nSize %d, (%d,%d)-(%d,%d)\n",
+        trace("EMF record: iType %ld, nSize %ld, (%ld,%ld)-(%ld,%ld)\n",
               lpEMFR->iType, lpEMFR->nSize,
               mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y);
 
@@ -8493,7 +8493,7 @@ static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETAREC
         }
         else
         {
-            ok(lpMFP->mm == MM_ANISOTROPIC, "mm=%d\n", lpMFP->mm);
+            ok(lpMFP->mm == MM_ANISOTROPIC, "mm=%ld\n", lpMFP->mm);
             
             x0 = MulDiv(0, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES));
             y0 = MulDiv(0, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES));
@@ -8501,7 +8501,7 @@ static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETAREC
             y1 = MulDiv(10, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES));
         }
         ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1,
-            "(%d,%d)->(%d,%d), expected (%d,%d)->(%d,%d)\n",
+            "(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n",
             mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y,
             x0, y0, x1, y1);
     }
@@ -8518,11 +8518,11 @@ static HENHMETAFILE create_converted_emf(const METAFILEPICT *mfp)
     LPBYTE pBits;
 
     hdcMf = CreateMetaFileA(NULL);
-    ok(hdcMf != NULL, "CreateMetaFile failed with error %d\n", GetLastError());
+    ok(hdcMf != NULL, "CreateMetaFile failed with error %ld\n", GetLastError());
     ret = LineTo(hdcMf, (INT)LINE_X, (INT)LINE_Y);
-    ok(ret, "LineTo failed with error %d\n", GetLastError());
+    ok(ret, "LineTo failed with error %ld\n", GetLastError());
     hmf = CloseMetaFile(hdcMf);
-    ok(hmf != NULL, "CloseMetaFile failed with error %d\n", GetLastError());
+    ok(hmf != NULL, "CloseMetaFile failed with error %ld\n", GetLastError());
 
     if (compare_mf_bits (hmf, MF_LINETO_BITS, sizeof(MF_LINETO_BITS), "mf_LineTo") != 0)
     {
@@ -8531,7 +8531,7 @@ static HENHMETAFILE create_converted_emf(const METAFILEPICT *mfp)
     }
 
     size = GetMetaFileBitsEx(hmf, 0, NULL);
-    ok(size, "GetMetaFileBitsEx failed with error %d\n", GetLastError());
+    ok(size, "GetMetaFileBitsEx failed with error %ld\n", GetLastError());
     pBits = HeapAlloc(GetProcessHeap(), 0, size);
     GetMetaFileBitsEx(hmf, size, pBits);
     DeleteMetaFile(hmf);
@@ -8668,18 +8668,18 @@ static void checkConvertedFrameAndBounds(UINT buffer_size, BYTE * buffer, BOOL m
          case MM_ISOTROPIC:   mm_str = "MM_ISOTROPIC"; break;
          default:             mm_str = "Unexpected";
       }
-      sprintf(buf, "mm=%s, xExt=%d, yExt=%d", mm_str, xExt, yExt);
+      sprintf(buf, "mm=%s, xExt=%ld, yExt=%ld", mm_str, xExt, yExt);
       msg = buf;
     }
 
-    ok(rclBounds.left == rclBoundsExpected->left, "rclBounds.left: Expected %d, got %d (%s)\n", rclBoundsExpected->left, rclBounds.left, msg);
-    ok(rclBounds.top == rclBoundsExpected->top, "rclBounds.top: Expected %d, got %d (%s)\n", rclBoundsExpected->top, rclBounds.top, msg);
-    ok(rclBounds.right == rclBoundsExpected->right, "rclBounds.right: Expected %d, got %d (%s)\n", rclBoundsExpected->right, rclBounds.right, msg);
-    ok(rclBounds.bottom == rclBoundsExpected->bottom, "rclBounds.bottom: Expected %d, got %d (%s)\n", rclBoundsExpected->bottom, rclBounds.bottom, msg);
-    ok(rclFrame.left == rclFrameExpected->left, "rclFrame.left: Expected %d, got %d (%s)\n", rclFrameExpected->left, rclFrame.left, msg);
-    ok(rclFrame.top == rclFrameExpected->top, "rclFrame.top: Expected %d, got %d (%s)\n", rclFrameExpected->top, rclFrame.top, msg);
-    ok(rclFrame.right == rclFrameExpected->right, "rclFrame.right: Expected %d, got %d (%s)\n", rclFrameExpected->right, rclFrame.right, msg);
-    ok(rclFrame.bottom == rclFrameExpected->bottom, "rclFrame.bottom: Expected %d, got %d (%s)\n", rclFrameExpected->bottom, rclFrame.bottom, msg);
+    ok(rclBounds.left == rclBoundsExpected->left, "rclBounds.left: Expected %ld, got %ld (%s)\n", rclBoundsExpected->left, rclBounds.left, msg);
+    ok(rclBounds.top == rclBoundsExpected->top, "rclBounds.top: Expected %ld, got %ld (%s)\n", rclBoundsExpected->top, rclBounds.top, msg);
+    ok(rclBounds.right == rclBoundsExpected->right, "rclBounds.right: Expected %ld, got %ld (%s)\n", rclBoundsExpected->right, rclBounds.right, msg);
+    ok(rclBounds.bottom == rclBoundsExpected->bottom, "rclBounds.bottom: Expected %ld, got %ld (%s)\n", rclBoundsExpected->bottom, rclBounds.bottom, msg);
+    ok(rclFrame.left == rclFrameExpected->left, "rclFrame.left: Expected %ld, got %ld (%s)\n", rclFrameExpected->left, rclFrame.left, msg);
+    ok(rclFrame.top == rclFrameExpected->top, "rclFrame.top: Expected %ld, got %ld (%s)\n", rclFrameExpected->top, rclFrame.top, msg);
+    ok(rclFrame.right == rclFrameExpected->right, "rclFrame.right: Expected %ld, got %ld (%s)\n", rclFrameExpected->right, rclFrame.right, msg);
+    ok(rclFrame.bottom == rclFrameExpected->bottom, "rclFrame.bottom: Expected %ld, got %ld (%s)\n", rclFrameExpected->bottom, rclFrame.bottom, msg);
   }
 }
 
@@ -8757,7 +8757,7 @@ static void test_SetWinMetaFileBits(void)
   todo_wine
   {
   ok(diffx <= 1 && diffy <= 1,
-     "SetWinMetaFileBits (MM_ANISOTROPIC): Reference bounds: The whole device surface must be used (%dx%d), but got (%dx%d)\n",
+     "SetWinMetaFileBits (MM_ANISOTROPIC): Reference bounds: The whole device surface must be used (%dx%d), but got (%ldx%ld)\n",
      GetDeviceCaps(dc, HORZRES) / 2, GetDeviceCaps(dc, VERTRES) / 2, rclBoundsAnisotropic.right, rclBoundsAnisotropic.bottom);
   }
 
@@ -8769,7 +8769,7 @@ static void test_SetWinMetaFileBits(void)
   todo_wine
   {
   ok(diffx <= 1 && diffy <= 1,
-     "SetWinMetaFileBits (MM_ANISOTROPIC): Reference frame: The whole device surface must be used (%dx%d), but got (%dx%d)\n",
+     "SetWinMetaFileBits (MM_ANISOTROPIC): Reference frame: The whole device surface must be used (%dx%d), but got (%ldx%ld)\n",
      GetDeviceCaps(dc, HORZSIZE) / 2, GetDeviceCaps(dc, VERTSIZE) / 2, rclFrameAnisotropic.right / 100, rclFrameAnisotropic.bottom / 100);
   }
   DeleteDC(dc);
@@ -8913,8 +8913,8 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc)
             if(rec_num == mfcomment_chunks - 1)
                 this_chunk_size = emf_size - rec_num * chunk_size;
 
-            ok(rec->rdSize == (this_chunk_size + 44) / 2, "%04x: got %04x expected %04x\n", rec_num, rec->rdSize, (this_chunk_size + 44) / 2);
-            ok(rec->rdFunction == META_ESCAPE, "%04x: got %04x\n", rec_num, rec->rdFunction);
+            ok(rec->rdSize == (this_chunk_size + 44) / 2, "%04lx: got %04lx expected %04lx\n", rec_num, rec->rdSize, (this_chunk_size + 44) / 2);
+            ok(rec->rdFunction == META_ESCAPE, "%04lx: got %04x\n", rec_num, rec->rdFunction);
             if(rec->rdSize < (this_chunk_size + 44) / 2) break;
             ok(rec->rdParm[0] == MFCOMMENT, "got %04x\n", rec->rdParm[0]);
             ok(rec->rdParm[1] == this_chunk_size + 34, "got %04x %x\n", rec->rdParm[1], emf_size + 34);
@@ -8930,10 +8930,10 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc)
             ok(rec->rdParm[10] == 0, "got %04x\n", rec->rdParm[10]);
             ok(rec->rdParm[11] == mfcomment_chunks, "got %04x\n", rec->rdParm[11]); /* num chunks */
             ok(rec->rdParm[12] == 0, "got %04x\n", rec->rdParm[12]);
-            ok(rec->rdParm[13] == this_chunk_size, "got %04x expected %04x\n", rec->rdParm[13], this_chunk_size);
+            ok(rec->rdParm[13] == this_chunk_size, "got %04x expected %04lx\n", rec->rdParm[13], this_chunk_size);
             ok(rec->rdParm[14] == 0, "got %04x\n", rec->rdParm[14]);
-            ok(*(DWORD*)(rec->rdParm + 15) == emf_size - this_chunk_size - rec_num * chunk_size, "got %08x\n", *(DWORD*)(rec->rdParm + 15));  /* DWORD size remaining after current chunk */
-            ok(*(DWORD*)(rec->rdParm + 17) == emf_size, "got %08x emf_size %08x\n", *(DWORD*)(rec->rdParm + 17), emf_size);
+            ok(*(DWORD*)(rec->rdParm + 15) == emf_size - this_chunk_size - rec_num * chunk_size, "got %08lx\n", *(DWORD*)(rec->rdParm + 15));  /* DWORD size remaining after current chunk */
+            ok(*(DWORD*)(rec->rdParm + 17) == emf_size, "got %08lx emf_size %08x\n", *(DWORD*)(rec->rdParm + 17), emf_size);
             ok(!memcmp(rec->rdParm + 19, (char*)enh_header + rec_num * chunk_size, this_chunk_size), "bits mismatch\n");
         }
 
@@ -8977,8 +8977,8 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc)
             default:
                 pt.x = pt.y = 0;
             }
-            ok(near_match((short)rec->rdParm[0], pt.y), "got %d expect %d\n", (short)rec->rdParm[0], pt.y);
-            ok(near_match((short)rec->rdParm[1], pt.x), "got %d expect %d\n", (short)rec->rdParm[1], pt.x);
+            ok(near_match((short)rec->rdParm[0], pt.y), "got %d expect %ld\n", (short)rec->rdParm[0], pt.y);
+            ok(near_match((short)rec->rdParm[1], pt.x), "got %d expect %ld\n", (short)rec->rdParm[1], pt.x);
         }
         if(rec_num == mfcomment_chunks + 2)
         {
@@ -9105,7 +9105,7 @@ static void test_SetEnhMetaFileBits(void)
     hemf = SetEnhMetaFileBits(sizeof(data), data);
     ok(!hemf, "SetEnhMetaFileBits should fail\n");
     ok(GetLastError() == ERROR_INVALID_DATA,
-       "expected ERROR_INVALID_DATA, got %u\n", GetLastError());
+       "expected ERROR_INVALID_DATA, got %lu\n", GetLastError());
 
     emh = (ENHMETAHEADER *)data;
     memset(emh, 0, sizeof(*emh));
@@ -9120,7 +9120,7 @@ static void test_SetEnhMetaFileBits(void)
 
     SetLastError(0xdeadbeef);
     hemf = SetEnhMetaFileBits(emh->nBytes, data);
-    ok(hemf != 0, "SetEnhMetaFileBits error %u\n", GetLastError());
+    ok(hemf != 0, "SetEnhMetaFileBits error %lu\n", GetLastError());
     DeleteEnhMetaFile(hemf);
 
     /* XP refuses to load unaligned EMF */
@@ -9128,7 +9128,7 @@ static void test_SetEnhMetaFileBits(void)
     SetLastError(0xdeadbeef);
     hemf = SetEnhMetaFileBits(emh->nBytes, data);
     ok(!hemf, "SetEnhMetaFileBits should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %lu\n", GetLastError());
     DeleteEnhMetaFile(hemf);
 
     emh->dSignature = 0;
@@ -9136,7 +9136,7 @@ static void test_SetEnhMetaFileBits(void)
     SetLastError(0xdeadbeef);
     hemf = SetEnhMetaFileBits(emh->nBytes, data);
     ok(!hemf, "SetEnhMetaFileBits should fail\n");
-    ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %u\n", GetLastError());
+    ok(GetLastError() == 0xdeadbeef, "Expected deadbeef, got %lu\n", GetLastError());
     DeleteEnhMetaFile(hemf);
 }
 
@@ -9149,7 +9149,7 @@ static void test_emf_polybezier(void)
 
     SetLastError(0xdeadbeef);
     hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     pts[0].x = pts[0].y = 10;
     pts[1].x = pts[1].y = 20;
@@ -9167,7 +9167,7 @@ static void test_emf_polybezier(void)
     ok( ret, "PolyBezierTo failed\n" );
 
     hemf = CloseEnhMetaFile(hdcMetafile);
-    ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if(compare_emf_bits(hemf, EMF_BEZIER_BITS, sizeof(EMF_BEZIER_BITS),
         "emf_Bezier", FALSE) != 0)
@@ -9321,20 +9321,20 @@ static void test_emf_paths(void)
 
     SetLastError(0xdeadbeef);
     hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ret = BeginPath(hdcMetafile);
-    ok(ret, "BeginPath error %d\n", GetLastError());
+    ok(ret, "BeginPath error %ld\n", GetLastError());
     ret = MoveToEx(hdcMetafile, 50, 50, NULL);
-    ok( ret, "MoveToEx error %d.\n", GetLastError());
+    ok( ret, "MoveToEx error %ld.\n", GetLastError());
     ret = LineTo(hdcMetafile, 50, 150);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdcMetafile, 150, 150);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdcMetafile, 150, 50);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     ret = LineTo(hdcMetafile, 50, 50);
-    ok( ret, "LineTo error %d.\n", GetLastError());
+    ok( ret, "LineTo error %ld.\n", GetLastError());
     Rectangle(hdcMetafile, 10, 10, 20, 20);
     Arc(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21);
     ArcTo(hdcMetafile, 23, 23, 37, 27, 37, 27, 23, 23);
@@ -9348,7 +9348,7 @@ static void test_emf_paths(void)
     PolyDraw(hdcMetafile, pts, types, 9);
     AngleArc(hdcMetafile, 37, 36, 23, 90, 180);
     ret = EndPath(hdcMetafile);
-    ok(ret, "EndPath failed: %u\n", GetLastError());
+    ok(ret, "EndPath failed: %lu\n", GetLastError());
 
     size = GetPath(hdcMetafile, NULL, NULL, 0);
     ok( size == 112, "GetPath returned %d.\n", size);
@@ -9358,12 +9358,12 @@ static void test_emf_paths(void)
     ok(!ret, "EndPath succeeded\n");
 
     ret = StrokeAndFillPath( hdcMetafile );
-    ok( ret, "StrokeAndFillPath failed err %d\n", GetLastError() );
+    ok( ret, "StrokeAndFillPath failed err %ld\n", GetLastError() );
     ret = StrokeAndFillPath( hdcMetafile );
     ok( !ret, "StrokeAndFillPath succeeded\n" );
 
     hemf = CloseEnhMetaFile(hdcMetafile);
-    ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_paths", FALSE) != 0)
     {
@@ -9375,29 +9375,29 @@ static void test_emf_paths(void)
 
     SetLastError(0xdeadbeef);
     hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ret = BeginPath(hdcMetafile);
-    ok( ret, "BeginPath failed error %d\n", GetLastError() );
+    ok( ret, "BeginPath failed error %ld\n", GetLastError() );
     ret = CloseFigure(hdcMetafile);
-    ok( ret, "CloseFigure failed error %d\n", GetLastError() );
+    ok( ret, "CloseFigure failed error %ld\n", GetLastError() );
     ret = BeginPath(hdcMetafile);
-    ok( ret, "BeginPath failed error %d\n", GetLastError() );
+    ok( ret, "BeginPath failed error %ld\n", GetLastError() );
     ret = EndPath(hdcMetafile);
-    ok( ret, "EndPath failed error %d\n", GetLastError() );
+    ok( ret, "EndPath failed error %ld\n", GetLastError() );
     ret = EndPath(hdcMetafile);
     ok( !ret, "EndPath succeeded\n" );
     ret = CloseFigure(hdcMetafile);
     ok( !ret, "CloseFigure succeeded\n" );
     ret = BeginPath(hdcMetafile);
-    ok( ret, "BeginPath failed error %d\n", GetLastError() );
+    ok( ret, "BeginPath failed error %ld\n", GetLastError() );
     ret = AbortPath(hdcMetafile);
-    ok( ret, "AbortPath failed error %d\n", GetLastError() );
+    ok( ret, "AbortPath failed error %ld\n", GetLastError() );
     ret = AbortPath(hdcMetafile);
-    ok( ret, "AbortPath failed error %d\n", GetLastError() );
+    ok( ret, "AbortPath failed error %ld\n", GetLastError() );
 
     hemf = CloseEnhMetaFile(hdcMetafile);
-    ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if (compare_emf_bits(hemf, EMF_EMPTY_PATH_BITS, sizeof(EMF_EMPTY_PATH_BITS), "empty path", FALSE) != 0)
     {
@@ -9418,7 +9418,7 @@ static void test_emf_PolyPolyline(void)
 
     SetLastError(0xdeadbeef);
     hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
-    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+    ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
     ret = PolyPolyline(hdcMetafile, NULL, NULL, 0);
     ok( !ret, "PolyPolyline\n" );
@@ -9428,21 +9428,21 @@ static void test_emf_PolyPolyline(void)
     counts[1] = 1;
     ret = PolyPolyline(hdcMetafile, pts, counts, 2);
     ok( !ret, "PolyPolyline\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     counts[0] = 1;
     counts[1] = 1;
     ret = PolyPolyline(hdcMetafile, pts, counts, 2);
     ok( !ret, "PolyPolyline\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     counts[0] = 2;
     counts[1] = 1;
     ret = PolyPolyline(hdcMetafile, pts, counts, 2);
     ok( !ret, "PolyPolyline\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %d\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "gle %ld\n", GetLastError() );
 
     counts[0] = 2;
     counts[1] = 2;
@@ -9450,7 +9450,7 @@ static void test_emf_PolyPolyline(void)
     ok( ret, "PolyPolyline\n" );
 
     hemf = CloseEnhMetaFile(hdcMetafile);
-    ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+    ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
     if(compare_emf_bits(hemf, EMF_POLYPOLYLINE_BITS, sizeof(EMF_POLYPOLYLINE_BITS),
         "emf_PolyPolyline", FALSE) != 0)
@@ -9478,7 +9478,7 @@ static void test_emf_GradientFill(void)
     BOOL ret;
 
     mf = CreateEnhMetaFileA( GetDC( 0 ), NULL, NULL, NULL );
-    ok( mf != 0, "CreateEnhMetaFileA error %d\n", GetLastError() );
+    ok( mf != 0, "CreateEnhMetaFileA error %ld\n", GetLastError() );
 
     /* Don't test the GRADIENT_FILL_RECT_ modes since a Windows bug
      * means it allocates three mesh indices rather than two per
@@ -9493,7 +9493,7 @@ static void test_emf_GradientFill(void)
     ok( ret, "GradientFill\n" );
 
     hemf = CloseEnhMetaFile( mf );
-    ok( hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError() );
+    ok( hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError() );
 
     if (compare_emf_bits( hemf, EMF_GRADIENTFILL_BITS, sizeof(EMF_GRADIENTFILL_BITS),
                           "emf_GradientFill", FALSE ) != 0)
@@ -9725,7 +9725,7 @@ static void test_emf_WorldTransform(void)
     for(i = 0; i < ARRAY_SIZE(test_data); ++i)
     {
         hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
-        ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
+        ok(hdcMetafile != 0, "CreateEnhMetaFileA error %ld\n", GetLastError());
 
         ret = SetGraphicsMode(hdcMetafile, GM_ADVANCED);
         ok(ret == TRUE, "SetGraphicsMode failed\n");
@@ -9753,17 +9753,17 @@ static void test_emf_WorldTransform(void)
         ok(ret == TRUE, "LineTo failed\n");
 
         hemf = CloseEnhMetaFile(hdcMetafile);
-        ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError());
+        ok(hemf != 0, "CloseEnhMetaFile error %ld\n", GetLastError());
 
         hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
                                0, 0, 200, 200, 0, 0, 0, NULL);
-        ok(hwnd != 0, "CreateWindowExA error %d\n", GetLastError());
+        ok(hwnd != 0, "CreateWindowExA error %ld\n", GetLastError());
 
         hdc = GetDC(hwnd);
         ok(hdc != 0, "GetDC failed\n");
 
         ret = EnumEnhMetaFile(hdc, hemf, enum_emf_WorldTransform, &test_data[i], &rect);
-        ok(ret == TRUE, "EnumEnhMetaFile failed: %u\n", GetLastError());
+        ok(ret == TRUE, "EnumEnhMetaFile failed: %lu\n", GetLastError());
 
         ReleaseDC(hwnd, hdc);
         DestroyWindow(hwnd);
@@ -10401,17 +10401,17 @@ static void test_emf_AlphaBlend(void)
 
     /* Test that source DC cannot be an enhanced metafile */
     hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-    ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+    ok(!!hdc_emf, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
     hdc_emf2 = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-    ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+    ok(!!hdc_emf2, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
     ret = GdiAlphaBlend(hdc_emf, 0, 0, 1, 1, hdc_emf2, 0, 0, 1, 1, blend);
     ok(!ret, "GdiAlphaBlend succeeded\n");
 
     hemf2 = CloseEnhMetaFile(hdc_emf2);
-    ok(!!hemf2, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+    ok(!!hemf2, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
     hemf = CloseEnhMetaFile(hdc_emf);
-    ok(!!hemf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+    ok(!!hemf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
     DeleteEnhMetaFile(hemf2);
     DeleteEnhMetaFile(hemf);
 
@@ -10429,39 +10429,39 @@ static void test_emf_AlphaBlend(void)
         memcpy(bmi->bmiColors, tests[test_idx].colors, sizeof(RGBQUAD) * tests[test_idx].color_count);
 
         hbitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, NULL, 0);
-        ok(!!hbitmap, "Test %d: CreateDIBSection failed, error %d\n", test_idx, GetLastError());
+        ok(!!hbitmap, "Test %d: CreateDIBSection failed, error %ld\n", test_idx, GetLastError());
         hdc_bitmap = CreateCompatibleDC(hdc);
-        ok(!!hdc_bitmap, "Test %d: CreateCompatibleDC failed, error %d\n", test_idx, GetLastError());
+        ok(!!hdc_bitmap, "Test %d: CreateCompatibleDC failed, error %ld\n", test_idx, GetLastError());
         old_hbitmap = SelectObject(hdc_bitmap, hbitmap);
 
         SetBkColor(hdc_bitmap, RGB(0xff, 0xff, 0xff));
         ret = SetGraphicsMode(hdc_bitmap, GM_ADVANCED);
-        ok(ret, "Test %d: SetGraphicsMode failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetGraphicsMode failed, error %ld\n", test_idx, GetLastError());
         ret = SetWorldTransform(hdc_bitmap, &xform);
-        ok(ret, "Test %d: SetWorldTransform failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetWorldTransform failed, error %ld\n", test_idx, GetLastError());
         ret = SetMapMode(hdc_bitmap, MM_ANISOTROPIC);
-        ok(ret, "Test %d: SetMapMode failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetMapMode failed, error %ld\n", test_idx, GetLastError());
         ret = SetWindowOrgEx(hdc_bitmap, 0, 0, NULL);
-        ok(ret, "Test %d: SetWindowOrgEx failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetWindowOrgEx failed, error %ld\n", test_idx, GetLastError());
         ret = SetWindowExtEx(hdc_bitmap, 400, 400, NULL);
-        ok(ret, "Test %d: SetWindowExtEx failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetWindowExtEx failed, error %ld\n", test_idx, GetLastError());
         ret = SetViewportOrgEx(hdc_bitmap, 0, 0, NULL);
-        ok(ret, "Test %d: SetViewportOrgEx failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetViewportOrgEx failed, error %ld\n", test_idx, GetLastError());
         ret = SetViewportExtEx(hdc_bitmap, bitmap_width, bitmap_height, NULL);
-        ok(ret, "Test %d: SetViewportExtEx failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: SetViewportExtEx failed, error %ld\n", test_idx, GetLastError());
 
         hdc_emf = CreateEnhMetaFileW(hdc, NULL, NULL, NULL);
-        ok(!!hdc_emf, "Test %d: CreateEnhMetaFileW failed, error %d\n", test_idx, GetLastError());
+        ok(!!hdc_emf, "Test %d: CreateEnhMetaFileW failed, error %ld\n", test_idx, GetLastError());
 
         ret = BitBlt(hdc_emf, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, WHITENESS);
-        ok(ret, "Test %d: BitBlt failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: BitBlt failed, error %ld\n", test_idx, GetLastError());
         ret = BitBlt(hdc_bitmap, 0, 0, bitmap_width, bitmap_height, 0, 0, 0, BLACKNESS);
-        ok(ret, "Test %d: BitBlt failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: BitBlt failed, error %ld\n", test_idx, GetLastError());
         ret = GdiAlphaBlend(hdc_emf, 0, 0, bitmap_width, bitmap_height, hdc_bitmap, 0, 0, 400, 400, blend);
-        ok(ret, "Test %d: GdiAlphaBlend failed, error %d\n", test_idx, GetLastError());
+        ok(ret, "Test %d: GdiAlphaBlend failed, error %ld\n", test_idx, GetLastError());
 
         hemf = CloseEnhMetaFile(hdc_emf);
-        ok(!!hemf, "Test %d: CloseEnhMetaFile failed, %d\n", test_idx, GetLastError());
+        ok(!!hemf, "Test %d: CloseEnhMetaFile failed, %ld\n", test_idx, GetLastError());
 
         sprintf(comment, "test_emf_AlphaBlend() test %d", test_idx);
         ret = compare_emf_bits(hemf, tests[test_idx].bits, tests[test_idx].bits_count, comment, FALSE);
@@ -10492,39 +10492,39 @@ static void test_emf_text_extents(void)
 
     dc = GetDC(0);
     emf_dc = CreateEnhMetaFileW(dc, NULL, NULL, NULL);
-    ok(!!emf_dc, "CreateEnhMetaFileW failed, error %d\n", GetLastError());
+    ok(!!emf_dc, "CreateEnhMetaFileW failed, error %ld\n", GetLastError());
 
     logfont.lfWeight = FW_NORMAL;
     logfont.lfHeight = 20;
     lstrcpyW(logfont.lfFaceName, L"Tahoma");
     font = CreateFontIndirectW(&logfont);
-    ok(!!font, "CreateFontIndirectW failed, error %d\n", GetLastError());
+    ok(!!font, "CreateFontIndirectW failed, error %ld\n", GetLastError());
 
     old_font = SelectObject(dc, font);
     old_font2 = SelectObject(emf_dc, font);
 
     ret = SetGraphicsMode(dc, GM_ADVANCED);
-    ok(ret, "SetGraphicsMode failed, error %d\n", GetLastError());
+    ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
     ret = SetGraphicsMode(emf_dc, GM_ADVANCED);
-    ok(ret, "SetGraphicsMode failed, error %d\n", GetLastError());
+    ok(ret, "SetGraphicsMode failed, error %ld\n", GetLastError());
 
     ret = ModifyWorldTransform(dc, &xform, MWT_RIGHTMULTIPLY);
-    ok(ret, "ModifyWorldTransform failed, error %d\n", GetLastError());
+    ok(ret, "ModifyWorldTransform failed, error %ld\n", GetLastError());
     ret = ModifyWorldTransform(emf_dc, &xform, MWT_RIGHTMULTIPLY);
-    ok(ret, "ModifyWorldTransform failed, error %d\n", GetLastError());
+    ok(ret, "ModifyWorldTransform failed, error %ld\n", GetLastError());
 
     ret = GetTextExtentPoint32W(dc, L"W", 1, &size);
-    ok(ret, "GetTextExtentPoint32W failed, error %d\n", GetLastError());
+    ok(ret, "GetTextExtentPoint32W failed, error %ld\n", GetLastError());
     ret = GetTextExtentPoint32W(emf_dc, L"W", 1, &size2);
-    ok(ret, "GetTextExtentPoint32W failed, error %d\n", GetLastError());
-    ok(size2.cx == size.cx && size2.cy == size.cy, "Expected size %dx%d, got %dx%d\n",
+    ok(ret, "GetTextExtentPoint32W failed, error %ld\n", GetLastError());
+    ok(size2.cx == size.cx && size2.cy == size.cy, "Expected size %ldx%ld, got %ldx%ld\n",
        size.cx, size.cy, size2.cx, size2.cy);
 
     SelectObject(emf_dc, old_font2);
     SelectObject(dc, old_font);
     DeleteObject(font);
     emf = CloseEnhMetaFile(emf_dc);
-    ok(!!emf, "CloseEnhMetaFile failed, error %d\n", GetLastError());
+    ok(!!emf, "CloseEnhMetaFile failed, error %ld\n", GetLastError());
     DeleteEnhMetaFile(emf);
     ReleaseDC(0, dc);
 }
@@ -10581,20 +10581,20 @@ static void test_mf_SetLayout(void)
     HDC mf_dc;
 
     mf_dc = CreateMetaFileW(NULL);
-    ok(!!mf_dc, "CreateMetaFileW failed, error %d\n", GetLastError());
+    ok(!!mf_dc, "CreateMetaFileW failed, error %ld\n", GetLastError());
 
     for (i = 0; i < ARRAY_SIZE(tests); ++i)
     {
         winetest_push_context("Test %d", i);
         layout = SetLayout(mf_dc, tests[i]);
-        ok(layout == LAYOUT_RTL, "Expected %#x, got %#x\n", tests[i], layout);
+        ok(layout == LAYOUT_RTL, "Expected %#lx, got %#lx\n", tests[i], layout);
         layout = GetLayout(mf_dc);
-        ok(layout == GDI_ERROR, "Expected %#x, got %#x\n", GDI_ERROR, layout);
+        ok(layout == GDI_ERROR, "Expected %#x, got %#lx\n", GDI_ERROR, layout);
         winetest_pop_context();
     }
 
     mf = CloseMetaFile(mf_dc);
-    ok(!!mf, "CloseMetaFile failed, error %d\n", GetLastError());
+    ok(!!mf, "CloseMetaFile failed, error %ld\n", GetLastError());
 
     ret = compare_mf_bits(mf, MF_SETLAYOUT_BITS, sizeof(MF_SETLAYOUT_BITS), "mf_SetLayout");
     ok(!ret, "Bits mismatch\n");
diff --git a/dlls/gdi32/tests/palette.c b/dlls/gdi32/tests/palette.c
index 126a53310bd..aac16097fba 100644
--- a/dlls/gdi32/tests/palette.c
+++ b/dlls/gdi32/tests/palette.c
@@ -58,7 +58,7 @@ static void test_DIB_PAL_COLORS(void) {
     memcpy( logpalette->palPalEntry, logpalettedata, sizeof(logpalettedata) );
     hpal = CreatePalette( logpalette ); 
     hpalOld = SelectPalette( memhdc, hpal, FALSE );
-    ok( hpalOld != NULL, "error=%d\n", GetLastError() );
+    ok( hpalOld != NULL, "error=%ld\n", GetLastError() );
 
     /* Create a DIB BMP which references colours in the logical palette */
     memset( bmp, 0x00, sizeof(BITMAPINFO) );
@@ -78,9 +78,9 @@ static void test_DIB_PAL_COLORS(void) {
     *bmpPalPtr++ = 19; /* Pointer to bad logical palette index */
 
     hbmp = CreateDIBSection( memhdc, bmp, DIB_PAL_COLORS, 0, 0, 0 );
-    ok( hbmp != NULL, "error=%d\n", GetLastError() );
+    ok( hbmp != NULL, "error=%ld\n", GetLastError() );
     hbmpOld = SelectObject( memhdc, hbmp );
-    ok( hbmpOld != NULL, "error=%d\n", GetLastError() );
+    ok( hbmpOld != NULL, "error=%ld\n", GetLastError() );
 
     /* Test with a RGB to DIB_PAL_COLORS */
     setColor = RGB( logpalettedata[1].peRed, logpalettedata[1].peGreen, logpalettedata[1].peBlue );
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 3fb479df9fe..3c7c0ac1f87 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -69,13 +69,13 @@ static void test_path_state(void)
     ok( !ret, "WidenPath succeeded\n" );
 
     ret = EndPath( hdc );
-    ok( ret, "EndPath failed error %u\n", GetLastError() );
+    ok( ret, "EndPath failed error %lu\n", GetLastError() );
     ret = WidenPath( hdc );
-    ok( ret, "WidenPath failed error %u\n", GetLastError() );
+    ok( ret, "WidenPath failed error %lu\n", GetLastError() );
 
     SelectObject( hdc, orig );
     ret = WidenPath( hdc );
-    ok( ret, "WidenPath failed error %u\n", GetLastError() );
+    ok( ret, "WidenPath failed error %lu\n", GetLastError() );
 
     BeginPath( hdc );
     LineTo( hdc, 100, 100 );
@@ -84,22 +84,22 @@ static void test_path_state(void)
     SaveDC( hdc );
     SelectObject( hdc, dib );
     ret = EndPath( hdc );
-    ok( ret, "EndPath failed error %u\n", GetLastError() );
+    ok( ret, "EndPath failed error %lu\n", GetLastError() );
     ret = WidenPath( hdc );
-    ok( ret, "WidenPath failed error %u\n", GetLastError() );
+    ok( ret, "WidenPath failed error %lu\n", GetLastError() );
 
     /* path should be open again after RestoreDC */
     RestoreDC( hdc, -1  );
     ret = WidenPath( hdc );
     ok( !ret, "WidenPath succeeded\n" );
     ret = EndPath( hdc );
-    ok( ret, "EndPath failed error %u\n", GetLastError() );
+    ok( ret, "EndPath failed error %lu\n", GetLastError() );
 
     SaveDC( hdc );
     BeginPath( hdc );
     RestoreDC( hdc, -1  );
     ret = WidenPath( hdc );
-    ok( ret, "WidenPath failed error %u\n", GetLastError() );
+    ok( ret, "WidenPath failed error %lu\n", GetLastError() );
 
     /* test all functions with no path at all */
     AbortPath( hdc );
@@ -107,55 +107,55 @@ static void test_path_state(void)
     ret = WidenPath( hdc );
     ok( !ret, "WidenPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = FlattenPath( hdc );
     ok( !ret, "FlattenPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = StrokePath( hdc );
     ok( !ret, "StrokePath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = FillPath( hdc );
     ok( !ret, "FillPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = StrokeAndFillPath( hdc );
     ok( !ret, "StrokeAndFillPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = SelectClipPath( hdc, RGN_OR );
     ok( !ret, "SelectClipPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     rgn = PathToRegion( hdc );
     ok( !rgn, "PathToRegion succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = EndPath( hdc );
     ok( !ret, "SelectClipPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = CloseFigure( hdc );
     ok( !ret, "CloseFigure succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     /* test all functions with an open path */
     AbortPath( hdc );
@@ -164,7 +164,7 @@ static void test_path_state(void)
     ret = WidenPath( hdc );
     ok( !ret, "WidenPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -172,7 +172,7 @@ static void test_path_state(void)
     ret = FlattenPath( hdc );
     ok( !ret, "FlattenPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -180,7 +180,7 @@ static void test_path_state(void)
     ret = StrokePath( hdc );
     ok( !ret, "StrokePath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -188,7 +188,7 @@ static void test_path_state(void)
     ret = FillPath( hdc );
     ok( !ret, "FillPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -196,7 +196,7 @@ static void test_path_state(void)
     ret = StrokeAndFillPath( hdc );
     ok( !ret, "StrokeAndFillPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -205,7 +205,7 @@ static void test_path_state(void)
     ret = SelectClipPath( hdc, RGN_OR );
     ok( !ret, "SelectClipPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -214,7 +214,7 @@ static void test_path_state(void)
     rgn = PathToRegion( hdc );
     ok( !rgn, "PathToRegion succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -267,7 +267,7 @@ static void test_path_state(void)
     SetLastError( 0xdeadbeef );
     ret = SelectClipPath( hdc, RGN_OR );
     ok( !ret, "SelectClipPath succeeded on empty path\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
 
     BeginPath( hdc );
@@ -283,7 +283,7 @@ static void test_path_state(void)
     SetLastError( 0xdeadbeef );
     rgn = PathToRegion( hdc );
     ok( !rgn, "PathToRegion succeeded on empty path\n" );
-    ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
+    ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
     DeleteObject( rgn );
     ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
 
@@ -293,7 +293,7 @@ static void test_path_state(void)
     ret = CloseFigure( hdc );
     ok( !ret, "CloseFigure succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     AbortPath( hdc );
     BeginPath( hdc );
@@ -302,7 +302,7 @@ static void test_path_state(void)
     ret = EndPath( hdc );
     ok( !ret, "EndPath succeeded\n" );
     ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
-        "wrong error %u\n", GetLastError() );
+        "wrong error %lu\n", GetLastError() );
 
     DeleteDC( hdc );
     DeleteObject( dib );
@@ -354,7 +354,7 @@ static void test_widenpath(void)
     BeginPath(hdc);
     ret = WidenPath(hdc);
     ok(ret == FALSE && (GetLastError() == ERROR_CAN_NOT_COMPLETE || GetLastError() == 0xdeadbeef),
-       "WidenPath fails while widening an open path. Return value is %d, should be %d. Error is %u\n", ret, FALSE, GetLastError());
+       "WidenPath fails while widening an open path. Return value is %d, should be %d. Error is %lu\n", ret, FALSE, GetLastError());
 
     AbortPath(hdc);
 
@@ -365,7 +365,7 @@ static void test_widenpath(void)
     Polyline(hdc, pnt, 6);
     EndPath(hdc);
     ret = WidenPath(hdc);
-    ok(ret == TRUE, "WidenPath failed: %d\n", GetLastError());
+    ok(ret == TRUE, "WidenPath failed: %ld\n", GetLastError());
     nSize = GetPath(hdc, NULL, NULL, 0);
     ok(nSize > 6, "WidenPath should compute a widened path with a 1px wide pen. Path length is %d, should be more than 6\n", nSize);
 
@@ -410,7 +410,7 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected,
     /* Get the path */
     assert(hdc != 0);
     size = GetPath(hdc, NULL, NULL, 0);
-    ok(size > 0, "GetPath returned size %d, last error %d\n", size, GetLastError());
+    ok(size > 0, "GetPath returned size %d, last error %ld\n", size, GetLastError());
     if (size <= 0) return;
 
     pnt = HeapAlloc(GetProcessHeap(), 0, size*sizeof(POINT));
@@ -429,14 +429,14 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected,
          * floating point to integer conversion */
         static const int fudge = 2;
 
-        ok( types[idx] == expected[idx].type, "%s: Expected #%d: %s (%d,%d) but got %s (%d,%d)\n",
+        ok( types[idx] == expected[idx].type, "%s: Expected #%d: %s (%d,%d) but got %s (%ld,%ld)\n",
             path_name, idx, type_string[expected[idx].type], expected[idx].x, expected[idx].y,
             type_string[types[idx]], pnt[idx].x, pnt[idx].y);
 
         if (types[idx] == expected[idx].type)
             ok( (pnt[idx].x >= expected[idx].x - fudge && pnt[idx].x <= expected[idx].x + fudge) &&
                 (pnt[idx].y >= expected[idx].y - fudge && pnt[idx].y <= expected[idx].y + fudge),
-                "%s: Expected #%d: %s  position (%d,%d) but got (%d,%d)\n", path_name, idx,
+                "%s: Expected #%d: %s  position (%d,%d) but got (%ld,%ld)\n", path_name, idx,
                 type_string[expected[idx].type], expected[idx].x, expected[idx].y, pnt[idx].x, pnt[idx].y);
     }
 
@@ -444,7 +444,7 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected,
     {
         printf("static const path_test_t %s[] =\n{\n", path_name);
         for (idx = 0; idx < size; idx++)
-            printf("    {%d, %d, %s}, /* %d */\n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx);
+            printf("    {%ld, %ld, %s}, /* %d */\n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx);
         printf("};\n" );
     }
 
@@ -612,7 +612,7 @@ static void test_polydraw(void)
 
     BeginPath(hdc);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == -20 && pos.y == -20, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == -20 && pos.y == -20, "wrong pos %ld,%ld\n", pos.x, pos.y );
 
     /* closefigure with no previous moveto */
     if (!(retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2)) &&
@@ -624,66 +624,66 @@ static void test_polydraw(void)
     }
     expect(TRUE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
     LineTo(hdc, -10, -10);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == -10 && pos.y == -10, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == -10 && pos.y == -10, "wrong pos %ld,%ld\n", pos.x, pos.y );
 
     MoveToEx(hdc, 100, 100, NULL);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
     LineTo(hdc, 95, 95);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 95 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* closefigure with previous moveto */
     retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2);
     expect(TRUE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* bad bezier points */
     retb = PolyDraw(hdc, &(polydraw_pts[2]), &(polydraw_tps[2]), 4);
     expect(FALSE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
     retb = PolyDraw(hdc, &(polydraw_pts[6]), &(polydraw_tps[6]), 4);
     expect(FALSE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* good bezier points */
     retb = PolyDraw(hdc, &(polydraw_pts[8]), &(polydraw_tps[8]), 4);
     expect(TRUE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* does lineto or bezierto take precedence? */
     retb = PolyDraw(hdc, &(polydraw_pts[12]), &(polydraw_tps[12]), 4);
     expect(FALSE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* bad point type, has already moved cursor position */
     retb = PolyDraw(hdc, &(polydraw_pts[15]), &(polydraw_tps[15]), 4);
     expect(FALSE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* bad point type, cursor position is moved, but back to its original spot */
     retb = PolyDraw(hdc, &(polydraw_pts[17]), &(polydraw_tps[17]), 4);
     expect(FALSE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* does lineto or moveto take precedence? */
     retb = PolyDraw(hdc, &(polydraw_pts[20]), &(polydraw_tps[20]), 3);
     expect(TRUE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 65 && pos.y == 65, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 65 && pos.y == 65, "wrong pos %ld,%ld\n", pos.x, pos.y );
     /* consecutive movetos */
     retb = PolyDraw(hdc, &(polydraw_pts[23]), &(polydraw_tps[23]), 4);
     expect(TRUE, retb);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 80 && pos.y == 80, "wrong pos %ld,%ld\n", pos.x, pos.y );
 
     EndPath(hdc);
     ok_path(hdc, "polydraw_path", polydraw_path, ARRAY_SIZE(polydraw_path));
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 80 && pos.y == 80, "wrong pos %ld,%ld\n", pos.x, pos.y );
 done:
     ReleaseDC(0, hdc);
 }
@@ -695,27 +695,27 @@ static void test_closefigure(void) {
 
     MoveToEx( hdc, 100, 100, NULL );
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
 
     BeginPath(hdc);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
     MoveToEx(hdc, 95, 95, NULL);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 95 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
     LineTo(hdc, 95,  0);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 95 && pos.y == 0, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 95 && pos.y == 0, "wrong pos %ld,%ld\n", pos.x, pos.y );
     LineTo(hdc,  0, 95);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
 
     CloseFigure(hdc);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
     EndPath(hdc);
     GetCurrentPositionEx( hdc, &pos );
-    ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
+    ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
     nSize = GetPath(hdc, NULL, NULL, 0);
 
     AbortPath(hdc);
@@ -737,7 +737,7 @@ static void test_closefigure(void) {
 static void WINAPI linedda_callback(INT x, INT y, LPARAM lparam)
 {
     POINT **pt = (POINT**)lparam;
-    ok((*pt)->x == x && (*pt)->y == y, "point mismatch expect(%d,%d) got(%d,%d)\n",
+    ok((*pt)->x == x && (*pt)->y == y, "point mismatch expect(%ld,%ld) got(%d,%d)\n",
        (*pt)->x, (*pt)->y, x, y);
 
     (*pt)++;
@@ -1910,7 +1910,7 @@ static void test_clipped_polygon_fill(void)
     oldbmp = SelectObject( memdc, bmp );
     Polygon( memdc, pts, ARRAY_SIZE(pts) );
     col = GetPixel( memdc, 1, 1 );
-    ok( col == RGB( 0x11, 0x22, 0x33 ), "got %06x\n", col );
+    ok( col == RGB( 0x11, 0x22, 0x33 ), "got %06lx\n", col );
     SelectObject( memdc, oldbrush );
     SelectObject( memdc, oldbmp );
     DeleteObject( brush );
diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c
index d1bfa7ee34f..2100f046e85 100644
--- a/dlls/gdi32/tests/pen.c
+++ b/dlls/gdi32/tests/pen.c
@@ -27,9 +27,17 @@
 
 #include "wine/test.h"
 
-#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
-#define expect2(expected, alt, got) ok(got == expected || got == alt, \
-                                       "Expected %.8x or %.8x, got %.8x\n", expected, alt, got)
+#define expect(expected,got) expect_(__LINE__, expected, got)
+static inline void expect_(unsigned line, DWORD expected, DWORD got)
+{
+    ok_(__FILE__, line)(expected == got, "Expected %.08lx, got %.08lx\n", expected, got);
+}
+#define expect2(expected,alt,got) expect2_(__LINE__, expected, alt, got)
+static inline void expect2_(unsigned line, DWORD expected, DWORD alt, DWORD got)
+{
+    ok_(__FILE__, line)(expected == got || alt == got,
+                        "Expected %.08lx or %.08lx, got %.08lx\n", expected, alt, got);
+}
 
 static void test_logpen(void)
 {
@@ -91,59 +99,59 @@ static void test_logpen(void)
         }
 
         obj_type = GetObjectType(hpen);
-        ok(obj_type == OBJ_PEN, "wrong object type %u\n", obj_type);
+        ok(obj_type == OBJ_PEN, "wrong object type %lu\n", obj_type);
 
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(lp), &lp);
-        ok(size == sizeof(lp), "GetObject returned %d, error %d\n", size, GetLastError());
+        ok(size == sizeof(lp), "GetObject returned %d, error %ld\n", size, GetLastError());
 
         ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-        ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-        ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-        ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+        ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+        ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+        ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
 
         DeleteObject(hpen);
 
         /* CreatePen behaviour */
         SetLastError(0xdeadbeef);
         hpen = CreatePen(pen[i].style, pen[i].width, pen[i].color);
-        ok(hpen != 0, "CreatePen error %d\n", GetLastError());
+        ok(hpen != 0, "CreatePen error %ld\n", GetLastError());
 
         obj_type = GetObjectType(hpen);
-        ok(obj_type == OBJ_PEN, "wrong object type %u\n", obj_type);
+        ok(obj_type == OBJ_PEN, "wrong object type %lu\n", obj_type);
 
         /* check what's the real size of the object */
         size = GetObjectW(hpen, 0, NULL);
-        ok(size == sizeof(lp), "GetObject returned %d, error %d\n", size, GetLastError());
+        ok(size == sizeof(lp), "GetObject returned %d, error %ld\n", size, GetLastError());
 
         /* ask for truncated data */
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(lp.lopnStyle), &lp);
-        ok(!size, "GetObject should fail: size %d, error %d\n", size, GetLastError());
+        ok(!size, "GetObject should fail: size %d, error %ld\n", size, GetLastError());
 
         /* see how larger buffer sizes are handled */
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(lp) * 4, &lp);
-        ok(size == sizeof(lp), "GetObject returned %d, error %d\n", size, GetLastError());
+        ok(size == sizeof(lp), "GetObject returned %d, error %ld\n", size, GetLastError());
 
         /* see how larger buffer sizes are handled */
         memset(&elp, 0xb0, sizeof(elp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(elp) * 2, &elp);
-        ok(size == sizeof(lp), "GetObject returned %d, error %d\n", size, GetLastError());
+        ok(size == sizeof(lp), "GetObject returned %d, error %ld\n", size, GetLastError());
 
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(lp), &lp);
-        ok(size == sizeof(lp), "GetObject returned %d, error %d\n", size, GetLastError());
+        ok(size == sizeof(lp), "GetObject returned %d, error %ld\n", size, GetLastError());
 
         ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-        ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-        ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-        ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+        ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+        ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+        ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
 
         memset(&elp, 0xb0, sizeof(elp));
         SetLastError(0xdeadbeef);
@@ -153,23 +161,23 @@ static void test_logpen(void)
         if (pen[i].style == PS_NULL)
         {
             ok(hpen == GetStockObject(NULL_PEN), "hpen should be a stock NULL_PEN\n");
-            ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]), "GetObject returned %d, error %d\n",
+            ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]), "GetObject returned %d, error %ld\n",
                 size, GetLastError());
-            ok(elp.elpPenStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, elp.elpPenStyle);
-            ok(elp.elpWidth == 0, "expected 0, got %u\n", elp.elpWidth);
-            ok(elp.elpColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, elp.elpColor);
+            ok(elp.elpPenStyle == pen[i].ret_style, "expected %u, got %lu\n", pen[i].ret_style, elp.elpPenStyle);
+            ok(elp.elpWidth == 0, "expected 0, got %lu\n", elp.elpWidth);
+            ok(elp.elpColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, elp.elpColor);
             ok(elp.elpBrushStyle == BS_SOLID, "expected BS_SOLID, got %u\n", elp.elpBrushStyle);
             ok(elp.elpHatch == 0, "expected 0, got %p\n", (void *)elp.elpHatch);
-            ok(elp.elpNumEntries == 0, "expected 0, got %x\n", elp.elpNumEntries);
+            ok(elp.elpNumEntries == 0, "expected 0, got %lx\n", elp.elpNumEntries);
         }
         else
         {
-            ok(size == sizeof(LOGPEN), "GetObject returned %d, error %d\n", size, GetLastError());
+            ok(size == sizeof(LOGPEN), "GetObject returned %d, error %ld\n", size, GetLastError());
             memcpy(&lp, &elp, sizeof(lp));
             ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-            ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-            ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+            ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+            ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
         }
 
         DeleteObject(hpen);
@@ -184,14 +192,14 @@ static void test_logpen(void)
         {
             ok(hpen == 0, "ExtCreatePen should fail\n");
             ok(GetLastError() == ERROR_INVALID_PARAMETER,
-               "wrong last error value %d\n", GetLastError());
+               "wrong last error value %ld\n", GetLastError());
             SetLastError(0xdeadbeef);
             hpen = ExtCreatePen(pen[i].style, pen[i].width, &lb, 0, NULL);
             if (pen[i].style != PS_NULL)
             {
                 ok(hpen == 0, "ExtCreatePen with width != 1 should fail\n");
                 ok(GetLastError() == ERROR_INVALID_PARAMETER,
-                   "wrong last error value %d\n", GetLastError());
+                   "wrong last error value %ld\n", GetLastError());
 
                 SetLastError(0xdeadbeef);
                 hpen = ExtCreatePen(pen[i].style, 1, &lb, 0, NULL);
@@ -201,7 +209,7 @@ static void test_logpen(void)
         {
             ok(hpen == 0, "ExtCreatePen with width != 1 should fail\n");
             ok(GetLastError() == ERROR_INVALID_PARAMETER,
-               "wrong last error value %d\n", GetLastError());
+               "wrong last error value %ld\n", GetLastError());
             SetLastError(0xdeadbeef);
             hpen = ExtCreatePen(pen[i].style, 1, &lb, 2, user_style);
         }
@@ -214,20 +222,20 @@ static void test_logpen(void)
         if (pen[i].style > PS_ALTERNATE)
         {
             ok(hpen == 0, "ExtCreatePen should fail\n");
-            ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong last error value %d\n", GetLastError());
+            ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong last error value %ld\n", GetLastError());
             goto test_geometric_pens;
         }
-        ok(hpen != 0, "ExtCreatePen error %d\n", GetLastError());
+        ok(hpen != 0, "ExtCreatePen error %ld\n", GetLastError());
 
         obj_type = GetObjectType(hpen);
         /* for some reason XP differentiates PS_NULL here */
         if (pen[i].style == PS_NULL)
         {
-            ok(obj_type == OBJ_PEN, "wrong object type %u\n", obj_type);
+            ok(obj_type == OBJ_PEN, "wrong object type %lu\n", obj_type);
             ok(hpen == GetStockObject(NULL_PEN), "hpen should be a stock NULL_PEN\n");
         }
         else
-            ok(obj_type == OBJ_EXTPEN, "wrong object type %u\n", obj_type);
+            ok(obj_type == OBJ_EXTPEN, "wrong object type %lu\n", obj_type);
 
         /* check what's the real size of the object */
         SetLastError(0xdeadbeef);
@@ -236,17 +244,17 @@ static void test_logpen(void)
         {
         case PS_NULL:
             ok(size == sizeof(LOGPEN),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
 
         case PS_USERSTYLE:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry[2] ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
 
         default:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
         }
 
@@ -254,7 +262,7 @@ static void test_logpen(void)
         memset(&elp, 0xb0, sizeof(elp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(elp.elpPenStyle), &elp);
-        ok(!size, "GetObject should fail: size %d, error %d\n", size, GetLastError());
+        ok(!size, "GetObject should fail: size %d, error %ld\n", size, GetLastError());
 
         /* see how larger buffer sizes are handled */
         memset(elp_buffer, 0xb0, sizeof(elp_buffer));
@@ -264,12 +272,12 @@ static void test_logpen(void)
         {
         case PS_NULL:
             ok(size == sizeof(LOGPEN),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             memcpy(&lp, ext_pen, sizeof(lp));
             ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-            ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-            ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+            ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+            ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
 
             /* for PS_NULL it also works this way */
             memset(&elp, 0xb0, sizeof(elp));
@@ -277,31 +285,31 @@ static void test_logpen(void)
             SetLastError(0xdeadbeef);
             size = GetObjectW(hpen, sizeof(elp), &elp);
             ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]),
-                "GetObject returned %d, error %d\n", size, GetLastError());
+                "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == unset_hatch, "expected 0xb0b0b0b0, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 0xb0b0b0b0, "expected 0xb0b0b0b0, got %x\n", ext_pen->elpNumEntries);
+            ok(ext_pen->elpNumEntries == 0xb0b0b0b0, "expected 0xb0b0b0b0, got %lx\n", ext_pen->elpNumEntries);
             break;
 
         case PS_USERSTYLE:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry[2] ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == HS_CROSS, "expected HS_CROSS, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 2, "expected 0, got %x\n", ext_pen->elpNumEntries);
-            ok(ext_style[0] == 0xabc, "expected 0xabc, got %x\n", ext_style[0]);
-            ok(ext_style[1] == 0xdef, "expected 0xdef, got %x\n", ext_style[1]);
+            ok(ext_pen->elpNumEntries == 2, "expected 0, got %lx\n", ext_pen->elpNumEntries);
+            ok(ext_style[0] == 0xabc, "expected 0xabc, got %lx\n", ext_style[0]);
+            ok(ext_style[1] == 0xdef, "expected 0xdef, got %lx\n", ext_style[1]);
             break;
 
         default:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == HS_CROSS, "expected HS_CROSS, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 0, "expected 0, got %x\n", ext_pen->elpNumEntries);
+            ok(ext_pen->elpNumEntries == 0, "expected 0, got %lx\n", ext_pen->elpNumEntries);
             break;
         }
 
-        ok(ext_pen->elpPenStyle == pen[i].style, "expected %x, got %x\n", pen[i].style, ext_pen->elpPenStyle);
-        ok(ext_pen->elpWidth == 1, "expected 1, got %x\n", ext_pen->elpWidth);
-        ok(ext_pen->elpColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, ext_pen->elpColor);
+        ok(ext_pen->elpPenStyle == pen[i].style, "expected %x, got %lx\n", pen[i].style, ext_pen->elpPenStyle);
+        ok(ext_pen->elpWidth == 1, "expected 1, got %lx\n", ext_pen->elpWidth);
+        ok(ext_pen->elpColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, ext_pen->elpColor);
         ok(ext_pen->elpBrushStyle == BS_SOLID, "expected BS_SOLID, got %x\n", ext_pen->elpBrushStyle);
 
         DeleteObject(hpen);
@@ -328,17 +336,17 @@ test_geometric_pens:
         if (pen[i].style > PS_ALTERNATE)
         {
             ok(hpen == 0, "ExtCreatePen should fail\n");
-            ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong last error value %d\n", GetLastError());
+            ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong last error value %ld\n", GetLastError());
             continue;
         }
-        ok(hpen != 0, "ExtCreatePen error %d\n", GetLastError());
+        ok(hpen != 0, "ExtCreatePen error %ld\n", GetLastError());
 
         obj_type = GetObjectType(hpen);
         /* for some reason XP differentiates PS_NULL here */
         if (pen[i].style == PS_NULL)
-            ok(obj_type == OBJ_PEN, "wrong object type %u\n", obj_type);
+            ok(obj_type == OBJ_PEN, "wrong object type %lu\n", obj_type);
         else
-            ok(obj_type == OBJ_EXTPEN, "wrong object type %u\n", obj_type);
+            ok(obj_type == OBJ_EXTPEN, "wrong object type %lu\n", obj_type);
 
         /* check what's the real size of the object */
         size = GetObjectW(hpen, 0, NULL);
@@ -346,17 +354,17 @@ test_geometric_pens:
         {
         case PS_NULL:
             ok(size == sizeof(LOGPEN),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
 
         case PS_USERSTYLE:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry[2] ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
 
         default:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             break;
         }
 
@@ -364,7 +372,7 @@ test_geometric_pens:
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
         size = GetObjectW(hpen, sizeof(lp.lopnStyle), &lp);
-        ok(!size, "GetObject should fail: size %d, error %d\n", size, GetLastError());
+        ok(!size, "GetObject should fail: size %d, error %ld\n", size, GetLastError());
 
         memset(&lp, 0xb0, sizeof(lp));
         SetLastError(0xdeadbeef);
@@ -372,16 +380,16 @@ test_geometric_pens:
         /* for some reason XP differentiates PS_NULL here */
         if (pen[i].style == PS_NULL)
         {
-            ok(size == sizeof(LOGPEN), "GetObject returned %d, error %d\n", size, GetLastError());
+            ok(size == sizeof(LOGPEN), "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-            ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-            ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+            ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+            ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
         }
         else
             /* XP doesn't set last error here */
             ok(!size /*&& GetLastError() == ERROR_INVALID_PARAMETER*/,
-               "GetObject should fail: size %d, error %d\n", size, GetLastError());
+               "GetObject should fail: size %d, error %ld\n", size, GetLastError());
 
         memset(elp_buffer, 0xb0, sizeof(elp_buffer));
         SetLastError(0xdeadbeef);
@@ -391,54 +399,54 @@ test_geometric_pens:
         {
         case PS_NULL:
             ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]),
-                "GetObject returned %d, error %d\n", size, GetLastError());
+                "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == 0, "expected 0, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 0, "expected 0, got %x\n", ext_pen->elpNumEntries);
+            ok(ext_pen->elpNumEntries == 0, "expected 0, got %lx\n", ext_pen->elpNumEntries);
 
             /* for PS_NULL it also works this way */
             SetLastError(0xdeadbeef);
             size = GetObjectW(hpen, sizeof(elp_buffer), &lp);
             ok(size == sizeof(LOGPEN),
-                "GetObject returned %d, error %d\n", size, GetLastError());
+                "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(lp.lopnStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, lp.lopnStyle);
-            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %d\n", pen[i].ret_width, lp.lopnWidth.x);
-            ok(lp.lopnWidth.y == 0, "expected 0, got %d\n", lp.lopnWidth.y);
-            ok(lp.lopnColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, lp.lopnColor);
+            ok(lp.lopnWidth.x == pen[i].ret_width, "expected %u, got %ld\n", pen[i].ret_width, lp.lopnWidth.x);
+            ok(lp.lopnWidth.y == 0, "expected 0, got %ld\n", lp.lopnWidth.y);
+            ok(lp.lopnColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, lp.lopnColor);
             break;
 
         case PS_USERSTYLE:
             ok(!size /*&& GetLastError() == ERROR_INVALID_PARAMETER*/,
-               "GetObject should fail: size %d, error %d\n", size, GetLastError());
+               "GetObject should fail: size %d, error %ld\n", size, GetLastError());
             size = GetObjectW(hpen, sizeof(elp_buffer), elp_buffer);
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry[2] ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == HS_CROSS, "expected HS_CROSS, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 2, "expected 0, got %x\n", ext_pen->elpNumEntries);
-            ok(ext_style[0] == 0xabc, "expected 0xabc, got %x\n", ext_style[0]);
-            ok(ext_style[1] == 0xdef, "expected 0xdef, got %x\n", ext_style[1]);
+            ok(ext_pen->elpNumEntries == 2, "expected 0, got %lx\n", ext_pen->elpNumEntries);
+            ok(ext_style[0] == 0xabc, "expected 0xabc, got %lx\n", ext_style[0]);
+            ok(ext_style[1] == 0xdef, "expected 0xdef, got %lx\n", ext_style[1]);
             break;
 
         default:
             ok(size == offsetof( EXTLOGPEN, elpStyleEntry ),
-               "GetObject returned %d, error %d\n", size, GetLastError());
+               "GetObject returned %d, error %ld\n", size, GetLastError());
             ok(ext_pen->elpHatch == HS_CROSS, "expected HS_CROSS, got %p\n", (void *)ext_pen->elpHatch);
-            ok(ext_pen->elpNumEntries == 0, "expected 0, got %x\n", ext_pen->elpNumEntries);
+            ok(ext_pen->elpNumEntries == 0, "expected 0, got %lx\n", ext_pen->elpNumEntries);
             break;
         }
 
         /* for some reason XP differentiates PS_NULL here */
         if (pen[i].style == PS_NULL)
-            ok(ext_pen->elpPenStyle == pen[i].ret_style, "expected %x, got %x\n", pen[i].ret_style, ext_pen->elpPenStyle);
+            ok(ext_pen->elpPenStyle == pen[i].ret_style, "expected %x, got %lx\n", pen[i].ret_style, ext_pen->elpPenStyle);
         else
         {
-            ok(ext_pen->elpPenStyle == (PS_GEOMETRIC | pen[i].style), "expected %x, got %x\n", PS_GEOMETRIC | pen[i].style, ext_pen->elpPenStyle);
+            ok(ext_pen->elpPenStyle == (PS_GEOMETRIC | pen[i].style), "expected %x, got %lx\n", PS_GEOMETRIC | pen[i].style, ext_pen->elpPenStyle);
         }
 
         if (pen[i].style == PS_NULL)
-            ok(ext_pen->elpWidth == 0, "expected 0, got %x\n", ext_pen->elpWidth);
+            ok(ext_pen->elpWidth == 0, "expected 0, got %lx\n", ext_pen->elpWidth);
         else
-            ok(ext_pen->elpWidth == pen[i].ret_width, "expected %u, got %x\n", pen[i].ret_width, ext_pen->elpWidth);
-        ok(ext_pen->elpColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, ext_pen->elpColor);
+            ok(ext_pen->elpWidth == pen[i].ret_width, "expected %u, got %lx\n", pen[i].ret_width, ext_pen->elpWidth);
+        ok(ext_pen->elpColor == pen[i].ret_color, "expected %08lx, got %08lx\n", pen[i].ret_color, ext_pen->elpColor);
         ok(ext_pen->elpBrushStyle == BS_SOLID, "expected BS_SOLID, got %x\n", ext_pen->elpBrushStyle);
 
         DeleteObject(hpen);
@@ -478,17 +486,17 @@ static void test_ps_alternate(void)
         skip("looks like 9x, skipping PS_ALTERNATE tests\n");
         return;
     }
-    ok(pen != NULL, "gle=%d\n", GetLastError());
+    ok(pen != NULL, "gle=%ld\n", GetLastError());
     hdc = CreateCompatibleDC(NULL);
-    ok(hdc != NULL, "gle=%d\n", GetLastError());
+    ok(hdc != NULL, "gle=%ld\n", GetLastError());
     bmp = CreateBitmap(8, 1, 1, 1, NULL);
-    ok(bmp != NULL, "gle=%d\n", GetLastError());
+    ok(bmp != NULL, "gle=%ld\n", GetLastError());
     hRet = SelectObject(hdc, bmp);
-    ok(hRet != NULL, "gle=%d\n", GetLastError());
+    ok(hRet != NULL, "gle=%ld\n", GetLastError());
     hRet = SelectObject(hdc, pen);
-    ok(hRet != NULL, "gle=%d\n", GetLastError());
+    ok(hRet != NULL, "gle=%ld\n", GetLastError());
     iRet = SetBkMode(hdc, TRANSPARENT);
-    ok(iRet, "gle=%d\n", GetLastError());
+    ok(iRet, "gle=%ld\n", GetLastError());
 
     TEST_LINE(0, 1, "10000000")
     TEST_LINE(0, 2, "10000000")
@@ -600,39 +608,39 @@ static void test_brush_pens(void)
             lb.lbColor = RGB(12,34,56);
             lb.lbHatch = HS_CROSS;
             pen = ExtCreatePen( PS_DOT | PS_GEOMETRIC, 3, &lb, 0, NULL );
-            ok( pen != 0, "ExtCreatePen failed err %u\n", GetLastError() );
+            ok( pen != 0, "ExtCreatePen failed err %lu\n", GetLastError() );
             size = GetObjectW( pen, sizeof(buffer), elp );
-            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %u\n", size );
-            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %x\n", elp->elpPenStyle );
+            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %lu\n", size );
+            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %lx\n", elp->elpPenStyle );
             ok( elp->elpBrushStyle == lb.lbStyle, "wrong brush style %x\n", elp->elpBrushStyle );
-            ok( elp->elpColor == RGB(12,34,56), "wrong color %x\n", elp->elpColor );
-            ok( elp->elpHatch == HS_CROSS, "wrong hatch %lx\n", elp->elpHatch );
-            ok( elp->elpNumEntries == 0, "wrong entries %x\n", elp->elpNumEntries );
+            ok( elp->elpColor == RGB(12,34,56), "wrong color %lx\n", elp->elpColor );
+            ok( elp->elpHatch == HS_CROSS, "wrong hatch %Ix\n", elp->elpHatch );
+            ok( elp->elpNumEntries == 0, "wrong entries %lx\n", elp->elpNumEntries );
             break;
 
         case BS_NULL:
             pen = ExtCreatePen( PS_SOLID | PS_GEOMETRIC, 3, &lb, 0, NULL );
-            ok( pen != 0, "ExtCreatePen failed err %u\n", GetLastError() );
+            ok( pen != 0, "ExtCreatePen failed err %lu\n", GetLastError() );
             size = GetObjectW( pen, sizeof(buffer), elp );
-            ok( size == sizeof(LOGPEN), "wrong size %u\n", size );
+            ok( size == sizeof(LOGPEN), "wrong size %lu\n", size );
             ok( ((LOGPEN *)elp)->lopnStyle == PS_NULL,
                 "wrong pen style %x\n", ((LOGPEN *)elp)->lopnStyle );
             ok( ((LOGPEN *)elp)->lopnColor == 0,
-                "wrong color %x\n", ((LOGPEN *)elp)->lopnColor );
+                "wrong color %lx\n", ((LOGPEN *)elp)->lopnColor );
             break;
 
         case BS_PATTERN:
             lb.lbColor = RGB(12,34,56);
             lb.lbHatch = (ULONG_PTR)bmp;
             pen = ExtCreatePen( PS_DOT | PS_GEOMETRIC, 3, &lb, 0, NULL );
-            ok( pen != 0, "ExtCreatePen failed err %u\n", GetLastError() );
+            ok( pen != 0, "ExtCreatePen failed err %lu\n", GetLastError() );
             size = GetObjectW( pen, sizeof(buffer), elp );
-            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %u\n", size );
-            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %x\n", elp->elpPenStyle );
+            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %lu\n", size );
+            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %lx\n", elp->elpPenStyle );
             ok( elp->elpBrushStyle == BS_PATTERN, "wrong brush style %x\n", elp->elpBrushStyle );
-            ok( elp->elpColor == 0, "wrong color %x\n", elp->elpColor );
-            ok( elp->elpHatch == (ULONG_PTR)bmp, "wrong hatch %lx/%p\n", elp->elpHatch, bmp );
-            ok( elp->elpNumEntries == 0, "wrong entries %x\n", elp->elpNumEntries );
+            ok( elp->elpColor == 0, "wrong color %lx\n", elp->elpColor );
+            ok( elp->elpHatch == (ULONG_PTR)bmp, "wrong hatch %Ix/%p\n", elp->elpHatch, bmp );
+            ok( elp->elpNumEntries == 0, "wrong entries %lx\n", elp->elpNumEntries );
             break;
 
         case BS_DIBPATTERN:
@@ -640,20 +648,20 @@ static void test_brush_pens(void)
             lb.lbColor = DIB_PAL_COLORS;
             lb.lbHatch = lb.lbStyle == BS_DIBPATTERN ? (ULONG_PTR)hmem : (ULONG_PTR)info;
             pen = ExtCreatePen( PS_DOT | PS_GEOMETRIC, 3, &lb, 0, NULL );
-            ok( pen != 0, "ExtCreatePen failed err %u\n", GetLastError() );
+            ok( pen != 0, "ExtCreatePen failed err %lu\n", GetLastError() );
             size = GetObjectW( pen, sizeof(buffer), elp );
-            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %u\n", size );
-            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %x\n", elp->elpPenStyle );
+            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %lu\n", size );
+            ok( elp->elpPenStyle == (PS_DOT | PS_GEOMETRIC), "wrong pen style %lx\n", elp->elpPenStyle );
             ok( elp->elpBrushStyle == BS_DIBPATTERNPT, "wrong brush style %x\n", elp->elpBrushStyle );
-            ok( elp->elpColor == 0, "wrong color %x\n", elp->elpColor );
-            ok( elp->elpHatch == lb.lbHatch, "wrong hatch %lx/%lx\n", elp->elpHatch, lb.lbHatch );
-            ok( elp->elpNumEntries == 0, "wrong entries %x\n", elp->elpNumEntries );
+            ok( elp->elpColor == 0, "wrong color %lx\n", elp->elpColor );
+            ok( elp->elpHatch == lb.lbHatch, "wrong hatch %Ix/%Ix\n", elp->elpHatch, lb.lbHatch );
+            ok( elp->elpNumEntries == 0, "wrong entries %lx\n", elp->elpNumEntries );
             break;
 
         default:
             pen = ExtCreatePen( PS_DOT | PS_GEOMETRIC, 3, &lb, 0, NULL );
             ok( !pen, "ExtCreatePen succeeded\n" );
-            ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
             break;
         }
 
@@ -665,19 +673,19 @@ static void test_brush_pens(void)
         pen = ExtCreatePen( PS_DOT, 1, &lb, 0, NULL );
         if (lb.lbStyle == BS_SOLID)
         {
-            ok( pen != 0, "ExtCreatePen failed err %u\n", GetLastError() );
+            ok( pen != 0, "ExtCreatePen failed err %lu\n", GetLastError() );
             size = GetObjectW( pen, sizeof(buffer), elp );
-            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %u\n", size );
-            ok( elp->elpPenStyle == PS_DOT, "wrong pen style %x\n", elp->elpPenStyle );
+            ok( size == offsetof( EXTLOGPEN, elpStyleEntry ), "wrong size %lu\n", size );
+            ok( elp->elpPenStyle == PS_DOT, "wrong pen style %lx\n", elp->elpPenStyle );
             ok( elp->elpBrushStyle == BS_SOLID, "wrong brush style %x\n", elp->elpBrushStyle );
-            ok( elp->elpColor == RGB(12,34,56), "wrong color %x\n", elp->elpColor );
-            ok( elp->elpHatch == HS_CROSS, "wrong hatch %lx\n", elp->elpHatch );
+            ok( elp->elpColor == RGB(12,34,56), "wrong color %lx\n", elp->elpColor );
+            ok( elp->elpHatch == HS_CROSS, "wrong hatch %Ix\n", elp->elpHatch );
             DeleteObject( pen );
         }
         else
         {
             ok( !pen, "ExtCreatePen succeeded\n" );
-            ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+            ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
         }
     }
 




More information about the wine-devel mailing list