[PATCH 20/20] dlls/setupapi/tests: enable compilation with long types

Eric Pouech eric.pouech at gmail.com
Fri Mar 4 02:26:12 CST 2022


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

---
 dlls/setupapi/tests/Makefile.in   |    1 
 dlls/setupapi/tests/devinst.c     | 1140 +++++++++++++++++++------------------
 dlls/setupapi/tests/dialog.c      |   12 
 dlls/setupapi/tests/diskspace.c   |   80 +--
 dlls/setupapi/tests/install.c     |  428 +++++++-------
 dlls/setupapi/tests/misc.c        |  162 +++--
 dlls/setupapi/tests/parser.c      |   76 +-
 dlls/setupapi/tests/query.c       |   36 +
 dlls/setupapi/tests/setupcab.c    |   44 +
 dlls/setupapi/tests/stringtable.c |   48 +-
 10 files changed, 1013 insertions(+), 1014 deletions(-)

diff --git a/dlls/setupapi/tests/Makefile.in b/dlls/setupapi/tests/Makefile.in
index 438a2e09bcc..df7c6687875 100644
--- a/dlls/setupapi/tests/Makefile.in
+++ b/dlls/setupapi/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = setupapi.dll
 IMPORTS   = advapi32 cabinet ole32 setupapi shell32 uuid user32
 
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 91eaba84a3c..bfa564fe746 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -54,9 +54,9 @@ static void create_file(const char *name, const char *data)
     BOOL ret;
 
     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create %s, error %u.\n", name, GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create %s, error %lu.\n", name, GetLastError());
     ret = WriteFile(file, data, strlen(data), &size, NULL);
-    ok(ret && size == strlen(data), "Failed to write %s, error %u.\n", name, GetLastError());
+    ok(ret && size == strlen(data), "Failed to write %s, error %lu.\n", name, GetLastError());
     CloseHandle(file);
 }
 
@@ -68,7 +68,7 @@ static void load_resource(const char *name, const char *filename)
     void *ptr;
 
     file = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", filename, GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %ld\n", filename, GetLastError());
 
     res = FindResourceA(NULL, name, "TESTDLL");
     ok( res != 0, "couldn't find resource\n" );
@@ -89,7 +89,7 @@ static void test_create_device_list_ex(void)
     SetLastError(0xdeadbeef);
     set = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, notnull);
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiCreateDeviceInfoListExW(NULL, NULL, machine, NULL);
@@ -97,19 +97,19 @@ static void test_create_device_list_ex(void)
     ok(GetLastError() == ERROR_INVALID_MACHINENAME
             || GetLastError() == ERROR_MACHINE_UNAVAILABLE
             || GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
-            "Got unexpected error %#x.\n", GetLastError());
+            "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoListExW(NULL, NULL, NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoListExW(NULL, NULL, empty, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 }
 
 static void test_open_class_key(void)
@@ -122,18 +122,18 @@ static void test_open_class_key(void)
     class_key = SetupDiOpenClassRegKeyExA(&guid, KEY_ALL_ACCESS, DIOCR_INSTALLER, NULL, NULL);
     ok(class_key == INVALID_HANDLE_VALUE, "Expected failure.\n");
     todo_wine
-    ok(GetLastError() == ERROR_INVALID_CLASS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_CLASS, "Got unexpected error %#lx.\n", GetLastError());
 
     root_key = SetupDiOpenClassRegKey(NULL, KEY_ALL_ACCESS);
-    ok(root_key != INVALID_HANDLE_VALUE, "Failed to open root key, error %#x.\n", GetLastError());
+    ok(root_key != INVALID_HANDLE_VALUE, "Failed to open root key, error %#lx.\n", GetLastError());
 
     res = RegCreateKeyA(root_key, guidstr, &class_key);
-    ok(!res, "Failed to create class key, error %#x.\n", GetLastError());
+    ok(!res, "Failed to create class key, error %#lx.\n", GetLastError());
     RegCloseKey(class_key);
 
     SetLastError(0xdeadbeef);
     class_key = SetupDiOpenClassRegKeyExA(&guid, KEY_ALL_ACCESS, DIOCR_INSTALLER, NULL, NULL);
-    ok(class_key != INVALID_HANDLE_VALUE, "Failed to open class key, error %#x.\n", GetLastError());
+    ok(class_key != INVALID_HANDLE_VALUE, "Failed to open class key, error %#lx.\n", GetLastError());
     RegCloseKey(class_key);
 
     RegDeleteKeyA(root_key, guidstr);
@@ -182,28 +182,28 @@ static void test_install_class(void)
 
     ret = SetupDiInstallClassA(NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiInstallClassA(NULL, NULL, DI_NOVCP, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiInstallClassA(NULL, tmpfile + 2, DI_NOVCP, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiInstallClassA(NULL, tmpfile + 2, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Got unexpected error %#lx.\n", GetLastError());
 
     /* The next call will succeed. Information is put into the registry but the
      * location(s) is/are depending on the Windows version.
      */
     ret = SetupDiInstallClassA(NULL, tmpfile, 0, NULL);
-    ok(ret, "Failed to install class, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install class, error %#lx.\n", GetLastError());
 
     ret = RegDeleteKeyW(HKEY_LOCAL_MACHINE, classKey);
-    ok(!ret, "Failed to delete class key, error %u.\n", GetLastError());
+    ok(!ret, "Failed to delete class key, error %lu.\n", GetLastError());
     DeleteFileA(tmpfile);
 }
 
@@ -217,18 +217,18 @@ static void check_device_info_(int line, HDEVINFO set, int index, const GUID *cl
     ret = SetupDiEnumDeviceInfo(set, index, &device);
     if (expect_id)
     {
-        ok_(__FILE__, line)(ret, "Got unexpected error %#x.\n", GetLastError());
+        ok_(__FILE__, line)(ret, "Got unexpected error %#lx.\n", GetLastError());
         ok_(__FILE__, line)(IsEqualGUID(&device.ClassGuid, class),
                 "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid));
         ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-        ok_(__FILE__, line)(ret, "Got unexpected error %#x.\n", GetLastError());
+        ok_(__FILE__, line)(ret, "Got unexpected error %#lx.\n", GetLastError());
         ok_(__FILE__, line)(!strcasecmp(id, expect_id), "Got unexpected id %s.\n", id);
     }
     else
     {
         ok_(__FILE__, line)(!ret, "Expected failure.\n");
         ok_(__FILE__, line)(GetLastError() == ERROR_NO_MORE_ITEMS,
-                "Got unexpected error %#x.\n", GetLastError());
+                "Got unexpected error %#lx.\n", GetLastError());
     }
 }
 #define check_device_info(a,b,c,d) check_device_info_(__LINE__,a,b,c,d)
@@ -245,33 +245,33 @@ static void test_device_info(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(NULL, NULL, NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(NULL, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &deadbeef, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &GUID_NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, NULL);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
     check_device_info(set, 1, &guid, NULL);
@@ -279,12 +279,12 @@ static void test_device_info(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0001");
@@ -292,11 +292,11 @@ static void test_device_info(void)
 
     device.cbSize = sizeof(device);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0002", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n",
             wine_dbgstr_guid(&device.ClassGuid));
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0002"), "Got unexpected id %s.\n", id);
 
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
@@ -305,27 +305,27 @@ static void test_device_info(void)
     check_device_info(set, 3, &guid, NULL);
 
     ret = SetupDiEnumDeviceInfo(set, 0, &ret_device);
-    ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate devices, error %#lx.\n", GetLastError());
     ret = SetupDiDeleteDeviceInfo(set, &ret_device);
-    ok(ret, "Failed to delete device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete device, error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\0002");
     check_device_info(set, 2, &guid, NULL);
 
     ret = SetupDiRemoveDevice(set, &device);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0001");
 
     ret = SetupDiEnumDeviceInfo(set, 1, &ret_device);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(IsEqualGUID(&ret_device.ClassGuid, &guid), "Got unexpected class %s.\n",
             wine_dbgstr_guid(&ret_device.ClassGuid));
     ret = SetupDiGetDeviceInstanceIdA(set, &ret_device, id, sizeof(id), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#x.\n", GetLastError());
-    ok(ret_device.DevInst == device.DevInst, "Expected device node %#x, got %#x.\n",
+    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#lx.\n", GetLastError());
+    ok(ret_device.DevInst == device.DevInst, "Expected device node %#lx, got %#lx.\n",
             device.DevInst, ret_device.DevInst);
 
     check_device_info(set, 2, &guid, NULL);
@@ -333,21 +333,21 @@ static void test_device_info(void)
     SetupDiDestroyDeviceInfoList(set);
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\deadbeef", &deadbeef, NULL, NULL, 0, NULL);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\null", &GUID_NULL, NULL, NULL, 0, NULL);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\testguid", &guid, NULL, NULL, 0, NULL);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &deadbeef, "ROOT\\LEGACY_BOGUS\\deadbeef");
     check_device_info(set, 1, &GUID_NULL, "ROOT\\LEGACY_BOGUS\\null");
@@ -360,26 +360,26 @@ static void test_device_info(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, id, &guid, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#lx.\n", GetLastError());
 
     id[MAX_DEVICE_ID_LEN] = 0;
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInfoA(set, id, &guid, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DEVINST_NAME, "Got unexpected error %#lx.\n", GetLastError());
 
     id[MAX_DEVICE_ID_LEN - 1] = 0;
     ret = SetupDiCreateDeviceInfoA(set, id, &guid, NULL, NULL, 0, NULL);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set , &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
     check_device_info(set, 1, NULL, NULL);
     SetupDiDestroyDeviceInfoList(set);
@@ -387,7 +387,7 @@ static void test_device_info(void)
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
     ok(!ret, "Expect failure\n");
-    ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got error %#x\n", GetLastError());
+    ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got error %#lx\n", GetLastError());
     check_device_info(set, 0, NULL, NULL);
     SetupDiDestroyDeviceInfoList(set);
 
@@ -395,7 +395,7 @@ static void test_device_info(void)
     while (SetupDiEnumDeviceInfo(set, i++, &device))
     {
         ret = SetupDiRemoveDevice(set, &device);
-        ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+        ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
     }
     SetupDiDestroyDeviceInfoList(set);
 }
@@ -424,10 +424,10 @@ static void test_device_property(void)
     }
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device_data);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* SetupDiSetDevicePropertyW */
     /* #1 Null device info list */
@@ -435,56 +435,56 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(NULL, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_HANDLE, "Expect last error %#x, got %#x\n", ERROR_INVALID_HANDLE, err);
+    ok(err == ERROR_INVALID_HANDLE, "Expect last error %#x, got %#lx\n", ERROR_INVALID_HANDLE, err);
 
     /* #2 Null device */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, NULL, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_PARAMETER, "Expect last error %#x, got %#x\n", ERROR_INVALID_PARAMETER, err);
+    ok(err == ERROR_INVALID_PARAMETER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_PARAMETER, err);
 
     /* #3 Null property key pointer */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, NULL, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#x\n", ERROR_INVALID_DATA, err);
+    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#lx\n", ERROR_INVALID_DATA, err);
 
     /* #4 Invalid property key type */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, 0xffff, (const BYTE *)valueW, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#x\n", ERROR_INVALID_DATA, err);
+    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#lx\n", ERROR_INVALID_DATA, err);
 
     /* #5 Null buffer pointer */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, NULL, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INVALID_USER_BUFFER, err);
+    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_USER_BUFFER, err);
 
     /* #6 Zero buffer size */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, 0, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#x\n", ERROR_INVALID_DATA, err);
+    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#lx\n", ERROR_INVALID_DATA, err);
 
     /* #7 Flags not zero */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 1);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_FLAGS, "Expect last error %#x, got %#x\n", ERROR_INVALID_FLAGS, err);
+    ok(err == ERROR_INVALID_FLAGS, "Expect last error %#x, got %#lx\n", ERROR_INVALID_FLAGS, err);
 
     /* #8 Normal */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
 
     /* #9 Delete property with buffer not null */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -493,7 +493,7 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_EMPTY, (const BYTE *)valueW, 0, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
 
     /* #10 Delete property with size not zero */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -502,7 +502,7 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_EMPTY, NULL, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INVALID_USER_BUFFER, err);
+    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_USER_BUFFER, err);
 
     /* #11 Delete property */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -511,14 +511,14 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_EMPTY, NULL, 0, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
 
     /* #12 Delete non-existent property */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_EMPTY, NULL, 0, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#x\n", ERROR_NOT_FOUND, err);
+    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#lx\n", ERROR_NOT_FOUND, err);
 
     /* #13 Delete property value with buffer not null */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -527,7 +527,7 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_NULL, (const BYTE *)valueW, 0, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
 
     /* #14 Delete property value with size not zero */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -536,7 +536,7 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_NULL, NULL, sizeof(valueW), 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INVALID_USER_BUFFER, err);
+    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_USER_BUFFER, err);
 
     /* #15 Delete property value */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -545,14 +545,14 @@ static void test_device_property(void)
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_NULL, NULL, 0, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
 
     /* #16 Delete non-existent property value */
     SetLastError(0xdeadbeef);
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_NULL, NULL, 0, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#x\n", ERROR_NOT_FOUND, err);
+    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#lx\n", ERROR_NOT_FOUND, err);
 
 
     /* SetupDiGetDevicePropertyW */
@@ -566,9 +566,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(NULL, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_HANDLE, "Expect last error %#x, got %#x\n", ERROR_INVALID_HANDLE, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_HANDLE, "Expect last error %#x, got %#lx\n", ERROR_INVALID_HANDLE, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #2 Null device */
     SetLastError(0xdeadbeef);
@@ -577,9 +577,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, NULL, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_PARAMETER, "Expect last error %#x, got %#x\n", ERROR_INVALID_PARAMETER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_PARAMETER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_PARAMETER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #3 Null property key */
     SetLastError(0xdeadbeef);
@@ -588,8 +588,8 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, NULL, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#x\n", ERROR_INVALID_DATA, err);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_DATA, "Expect last error %#x, got %#lx\n", ERROR_INVALID_DATA, err);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #4 Null property type */
     SetLastError(0xdeadbeef);
@@ -598,9 +598,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, NULL, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INVALID_USER_BUFFER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_USER_BUFFER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #5 Null buffer */
     SetLastError(0xdeadbeef);
@@ -609,9 +609,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, NULL, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INVALID_USER_BUFFER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_USER_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INVALID_USER_BUFFER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #6 Null buffer with zero size and wrong type */
     SetLastError(0xdeadbeef);
@@ -620,9 +620,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, NULL, 0, &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INSUFFICIENT_BUFFER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == sizeof(valueW), "Got size %d\n", size);
+    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INSUFFICIENT_BUFFER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == sizeof(valueW), "Got size %ld\n", size);
 
     /* #7 Zero buffer size */
     SetLastError(0xdeadbeef);
@@ -631,9 +631,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, 0, &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INSUFFICIENT_BUFFER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == sizeof(valueW), "Got size %d\n", size);
+    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INSUFFICIENT_BUFFER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == sizeof(valueW), "Got size %ld\n", size);
 
     /* #8 Null required size */
     SetLastError(0xdeadbeef);
@@ -641,8 +641,8 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), NULL, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
 
     /* #9 Flags not zero */
     SetLastError(0xdeadbeef);
@@ -651,9 +651,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 1);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INVALID_FLAGS, "Expect last error %#x, got %#x\n", ERROR_INVALID_FLAGS, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_INVALID_FLAGS, "Expect last error %#x, got %#lx\n", ERROR_INVALID_FLAGS, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #10 Non-existent property key */
     SetLastError(0xdeadbeef);
@@ -662,8 +662,8 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_HardwareIds, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#x\n", ERROR_NOT_FOUND, err);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#lx\n", ERROR_NOT_FOUND, err);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #11 Wrong property key type */
     SetLastError(0xdeadbeef);
@@ -673,9 +673,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == sizeof(valueW), "Got size %d\n", size);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == sizeof(valueW), "Got size %ld\n", size);
     ok(!lstrcmpW((WCHAR *)buffer, valueW), "Expect buffer %s, got %s\n", wine_dbgstr_w(valueW), wine_dbgstr_w((WCHAR *)buffer));
 
     /* #12 Get null property value */
@@ -689,8 +689,8 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#x\n", ERROR_NOT_FOUND, err);
-    ok(size == 0, "Expect size %d, got %d\n", 0, size);
+    ok(err == ERROR_NOT_FOUND, "Expect last error %#x, got %#lx\n", ERROR_NOT_FOUND, err);
+    ok(size == 0, "Expect size %d, got %ld\n", 0, size);
 
     /* #13 Insufficient buffer size */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -701,9 +701,9 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(valueW) - 1, &size, 0);
     err = GetLastError();
     ok(!ret, "Expect failure\n");
-    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#x\n", ERROR_INSUFFICIENT_BUFFER, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == sizeof(valueW), "Got size %d\n", size);
+    ok(err == ERROR_INSUFFICIENT_BUFFER, "Expect last error %#x, got %#lx\n", ERROR_INSUFFICIENT_BUFFER, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == sizeof(valueW), "Got size %ld\n", size);
 
     /* #14 Normal */
     ret = pSetupDiSetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, DEVPROP_TYPE_STRING, (const BYTE *)valueW, sizeof(valueW), 0);
@@ -715,13 +715,13 @@ static void test_device_property(void)
     ret = pSetupDiGetDevicePropertyW(set, &device_data, &DEVPKEY_Device_FriendlyName, &type, buffer, sizeof(buffer), &size, 0);
     err = GetLastError();
     ok(ret, "Expect success\n");
-    ok(err == NO_ERROR, "Expect last error %#x, got %#x\n", NO_ERROR, err);
-    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#x\n", DEVPROP_TYPE_STRING, type);
-    ok(size == sizeof(valueW), "Got size %d\n", size);
+    ok(err == NO_ERROR, "Expect last error %#x, got %#lx\n", NO_ERROR, err);
+    ok(type == DEVPROP_TYPE_STRING, "Expect type %#x, got %#lx\n", DEVPROP_TYPE_STRING, type);
+    ok(size == sizeof(valueW), "Got size %ld\n", size);
     ok(!lstrcmpW((WCHAR *)buffer, valueW), "Expect buffer %s, got %s\n", wine_dbgstr_w(valueW), wine_dbgstr_w((WCHAR *)buffer));
 
     ret = SetupDiRemoveDevice(set, &device_data);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
     FreeLibrary(hmod);
@@ -738,54 +738,54 @@ static void test_get_device_instance_id(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(NULL, &device, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(set, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(set, &device, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(set, &device, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     device.cbSize = sizeof(device);
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(set, &device, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstanceIdA(set, &device, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Failed to get device id, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get device id, error %#lx.\n", GetLastError());
     ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0000"), "Got unexpected id %s.\n", id);
 
     ret = SetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "SetupDiCreateDeviceInfoA failed: %08x\n", GetLastError());
+    ok(ret, "SetupDiCreateDeviceInfoA failed: %08lx\n", GetLastError());
 
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Failed to get device id, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get device id, error %#lx.\n", GetLastError());
     ok(!strcmp(id, "ROOT\\LEGACY_BOGUS\\0001"), "Got unexpected id %s.\n", id);
 
     SetupDiDestroyDeviceInfoList(set);
@@ -800,40 +800,40 @@ static void test_open_device_info(void)
     BOOL ret;
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#lx.\n", GetLastError());
 
     /* Open non-existent device */
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\FFFF", NULL, 0, &device);
-    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
     check_device_info(set, 0, NULL, NULL);
 
     /* Open unregistered device */
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1000", NULL, 0, &device);
-    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_SUCH_DEVINST, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1000");
     check_device_info(set, 1, NULL, NULL);
 
     /* Open registered device */
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1000");
     check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 2, NULL, NULL);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == NO_ERROR, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == NO_ERROR, "Got unexpected error %#lx.\n", GetLastError());
     ok(ret, "Failed to open device info\n");
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(!strcasecmp(id, "Root\\LEGACY_BOGUS\\1001"), "Got unexpected id %s.\n", id);
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1000");
     check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\1001");
@@ -842,14 +842,14 @@ static void test_open_device_info(void)
     /* Open registered device in an empty device info set */
     SetupDiDestroyDeviceInfoList(set);
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == NO_ERROR, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == NO_ERROR, "Got unexpected error %#lx.\n", GetLastError());
     ok(ret, "Failed to open device info\n");
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(!strcasecmp(id, "Root\\LEGACY_BOGUS\\1001"), "Got unexpected id %s.\n", id);
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 1, NULL, NULL);
@@ -857,10 +857,10 @@ static void test_open_device_info(void)
     /* Open registered device again */
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == NO_ERROR, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == NO_ERROR, "Got unexpected error %#lx.\n", GetLastError());
     ok(ret, "Failed to open device info\n");
     ret = SetupDiGetDeviceInstanceIdA(set, &device, id, sizeof(id), NULL);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
     ok(!strcasecmp(id, "Root\\LEGACY_BOGUS\\1001"), "Got unexpected id %s.\n", id);
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 1, NULL, NULL);
@@ -868,40 +868,40 @@ static void test_open_device_info(void)
     /* Open registered device in a new device info set with wrong GUID */
     SetupDiDestroyDeviceInfoList(set);
     set = SetupDiCreateDeviceInfoList(&guid2, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_CLASS_MISMATCH, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
     check_device_info(set, 0, NULL, NULL);
 
     /* Open registered device in a new device info set with NULL GUID */
     SetupDiDestroyDeviceInfoList(set);
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == NO_ERROR, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == NO_ERROR, "Got unexpected error %#lx.\n", GetLastError());
     ok(ret, "Failed to open device info\n");
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 1, NULL, NULL);
 
     SetupDiDestroyDeviceInfoList(set);
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
 
     /* NULL set */
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(NULL, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
 
     /* NULL instance id */
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, NULL, NULL, 0, &device);
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
     check_device_info(set, 0, NULL, NULL);
 
@@ -910,19 +910,19 @@ static void test_open_device_info(void)
     device.cbSize = 0;
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, &device);
     device.cbSize = sizeof(device);
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
     ok(!ret, "Expected failure.\n");
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 1, NULL, NULL);
 
     SetupDiDestroyDeviceInfoList(set);
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#lx.\n", GetLastError());
 
     /* NULL device */
     SetLastError(0xdeadbeef);
     ret = SetupDiOpenDeviceInfoA(set, "Root\\LEGACY_BOGUS\\1001", NULL, 0, NULL);
-    ok(GetLastError() == NO_ERROR, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == NO_ERROR, "Got unexpected error %#lx.\n", GetLastError());
     ok(ret, "Failed to open device info\n");
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\1001");
     check_device_info(set, 1, NULL, NULL);
@@ -933,7 +933,7 @@ static void test_open_device_info(void)
     while (SetupDiEnumDeviceInfo(set, i++, &device))
     {
         ret = SetupDiRemoveDevice(set, &device);
-        ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+        ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
     }
     SetupDiDestroyDeviceInfoList(set);
 }
@@ -953,64 +953,64 @@ static void test_register_device_info(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiRegisterDeviceInfo(NULL, NULL, 0, NULL, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiRegisterDeviceInfo(set, NULL, 0, NULL, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     device.cbSize = sizeof(device);
     SetLastError(0xdeadbeef);
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     RegOpenKeyA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Enum\\ROOT\\LEGACY_BOGUS\\0000", &hkey);
     size = sizeof(phantom);
     ls = RegQueryValueExA(hkey, "Phantom", NULL, &type, (BYTE *)&phantom, &size);
-    ok(ls == ERROR_SUCCESS, "Got wrong error code %#x\n", ls);
-    ok(phantom == 1, "Got wrong phantom value %d\n", phantom);
-    ok(type == REG_DWORD, "Got wrong phantom type %#x\n", type);
-    ok(size == sizeof(phantom), "Got wrong phantom size %d\n", size);
+    ok(ls == ERROR_SUCCESS, "Got wrong error code %#lx\n", ls);
+    ok(phantom == 1, "Got wrong phantom value %ld\n", phantom);
+    ok(type == REG_DWORD, "Got wrong phantom type %#lx\n", type);
+    ok(size == sizeof(phantom), "Got wrong phantom size %ld\n", size);
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
     size = sizeof(phantom);
     ls = RegQueryValueExA(hkey, "Phantom", NULL, NULL, (BYTE *)&phantom, &size);
-    ok(ls == ERROR_FILE_NOT_FOUND, "Got wrong error code %#x\n", ls);
+    ok(ls == ERROR_FILE_NOT_FOUND, "Got wrong error code %#lx\n", ls);
     RegCloseKey(hkey);
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
     ret = SetupDiRemoveDevice(set, &device);
-    ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0002", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
     ret = SetupDiDeleteDeviceInfo(set, &device);
-    ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0003", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     check_device_info(set, 0, &guid, "Root\\LEGACY_BOGUS\\0000");
     check_device_info(set, 1, &guid, "Root\\LEGACY_BOGUS\\0002");
@@ -1019,7 +1019,7 @@ static void test_register_device_info(void)
     while (SetupDiEnumDeviceInfo(set, i++, &device))
     {
         ret = SetupDiRemoveDevice(set, &device);
-        ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+        ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
     }
 
     SetupDiDestroyDeviceInfoList(set);
@@ -1051,12 +1051,12 @@ static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device,
     ret = SetupDiEnumDeviceInterfaces(set, device, class, index, &iface);
     if (path)
     {
-        ok_(__FILE__, line)(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
+        ok_(__FILE__, line)(ret, "Failed to enumerate interfaces, error %#lx.\n", GetLastError());
         ok_(__FILE__, line)(IsEqualGUID(&iface.InterfaceClassGuid, class),
                 "Got unexpected class %s.\n", wine_dbgstr_guid(&iface.InterfaceClassGuid));
-        ok_(__FILE__, line)(iface.Flags == flags, "Got unexpected flags %#x.\n", iface.Flags);
+        ok_(__FILE__, line)(iface.Flags == flags, "Got unexpected flags %#lx.\n", iface.Flags);
         ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
-        ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
+        ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#lx.\n", GetLastError());
         ok_(__FILE__, line)(!strcasecmp(detail->DevicePath, path), "Got unexpected path %s.\n", detail->DevicePath);
         check_all_lower_case(line, detail->DevicePath);
     }
@@ -1064,7 +1064,7 @@ static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device,
     {
         ok_(__FILE__, line)(!ret, "Expected failure.\n");
         ok_(__FILE__, line)(GetLastError() == ERROR_NO_MORE_ITEMS,
-                "Got unexpected error %#x.\n", GetLastError());
+                "Got unexpected error %#lx.\n", GetLastError());
     }
 }
 #define check_device_iface(a,b,c,d,e,f) check_device_iface_(__LINE__,a,b,c,d,e,f)
@@ -1083,64 +1083,64 @@ static void test_device_iface(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(NULL, NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(NULL, NULL, &guid, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(set, NULL, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(set, &device, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     device.cbSize = sizeof(device);
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid, 0, 0, NULL);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(set, &device, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, NULL, 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
     check_device_iface(set, &device, &guid, 1, 0, NULL);
 
     /* Creating the same interface a second time succeeds */
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, NULL, 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
     check_device_iface(set, &device, &guid, 1, 0, NULL);
 
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "Oogah", 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}");
     check_device_iface(set, &device, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
     check_device_iface(set, &device, &guid, 2, 0, NULL);
 
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "test", 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ok(IsEqualGUID(&iface.InterfaceClassGuid, &guid), "Got unexpected class %s.\n",
             wine_dbgstr_guid(&iface.InterfaceClassGuid));
-    ok(iface.Flags == 0, "Got unexpected flags %#x.\n", iface.Flags);
+    ok(iface.Flags == 0, "Got unexpected flags %#lx.\n", iface.Flags);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL);
-    ok(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get interface detail, error %#lx.\n", GetLastError());
     ok(!strcasecmp(detail->DevicePath, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test"),
             "Got unexpected path %s.\n", detail->DevicePath);
 
@@ -1150,32 +1150,32 @@ static void test_device_iface(void)
     check_device_iface(set, &device, &guid, 3, 0, NULL);
 
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid2, NULL, 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid2, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");
     check_device_iface(set, &device, &guid2, 1, 0, NULL);
 
     ret = SetupDiEnumDeviceInterfaces(set, &device, &guid2, 0, &iface);
-    ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate interfaces, error %#lx.\n", GetLastError());
     ret = SetupDiRemoveDeviceInterface(set, &iface);
-    ok(ret, "Failed to remove interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid2, 0, SPINT_REMOVED, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A5-3F65-11DB-B704-0011955C2BDB}");
     check_device_iface(set, &device, &guid2, 1, 0, NULL);
 
     ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 0, &iface);
-    ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate interfaces, error %#lx.\n", GetLastError());
     ret = SetupDiDeleteDeviceInterfaceData(set, &iface);
-    ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, &device, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
     check_device_iface(set, &device, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test");
     check_device_iface(set, &device, &guid, 2, 0, NULL);
 
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &device2);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device2, &guid, NULL, 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     check_device_iface(set, NULL, &guid, 0, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\Oogah");
     check_device_iface(set, NULL, &guid, 1, 0, "\\\\?\\ROOT#LEGACY_BOGUS#0000#{6A55B5A4-3F65-11DB-B704-0011955C2BDB}\\test");
@@ -1183,7 +1183,7 @@ static void test_device_iface(void)
     check_device_iface(set, NULL, &guid, 3, 0, NULL);
 
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 }
 
 static void test_device_iface_detail(void)
@@ -1199,37 +1199,37 @@ static void test_device_iface_detail(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(NULL, NULL, NULL, 0, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, NULL, NULL, 0, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, NULL, 0, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, NULL, 100, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, NULL, 0, &size, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     detail = heap_alloc(size);
     expectedsize = FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_W, DevicePath[strlen(path) + 1]);
@@ -1238,30 +1238,30 @@ static void test_device_iface_detail(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     detail->cbSize = size;
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A);
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, size, &size, NULL);
-    ok(ret, "Failed to get interface detail, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get interface detail, error %#lx.\n", GetLastError());
     ok(!strcasecmp(path, detail->DevicePath), "Got unexpected path %s.\n", detail->DevicePath);
 
     ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, NULL, 0, &size, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == expectedsize, "Got unexpected size %d.\n", size);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == expectedsize, "Got unexpected size %ld.\n", size);
 
     memset(&device, 0, sizeof(device));
     device.cbSize = sizeof(device);
     ret = SetupDiGetDeviceInterfaceDetailW(set, &iface, NULL, 0, &size, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
     ok(IsEqualGUID(&device.ClassGuid, &guid), "Got unexpected class %s.\n", wine_dbgstr_guid(&device.ClassGuid));
 
     heap_free(detail);
@@ -1289,62 +1289,62 @@ static void test_device_key(void)
     SetLastError(0xdeadbeef);
     key = SetupDiCreateDevRegKeyW(NULL, NULL, 0, 0, 0, NULL, NULL);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
     ok(res != ERROR_SUCCESS, "Key should not exist.\n");
     RegCloseKey(key);
 
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ok(!RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key), "Key should exist.\n");
     RegCloseKey(key);
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(NULL, NULL, 0, 0, 0, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, NULL, 0, 0, 0, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, &device, 0, 0, 0, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, 0, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_BOTH, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_FLAGS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DEVINFO_NOT_REGISTERED, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DEVINFO_NOT_REGISTERED, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL,
             (BYTE *)driver_path, sizeof(driver_path), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key);
@@ -1354,24 +1354,24 @@ static void test_device_key(void)
     /* Vista+ will fail the following call to SetupDiCreateDevKeyW() if the
      * class key doesn't exist. */
     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key);
-    ok(!res, "Failed to create class key, error %u.\n", res);
+    ok(!res, "Failed to create class key, error %lu.\n", res);
     RegCloseKey(key);
 
     key = SetupDiCreateDevRegKeyW(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
-    ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#x.\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#lx.\n", GetLastError());
     RegCloseKey(key);
 
     ok(!RegOpenKeyA(HKEY_LOCAL_MACHINE, class_key_path, &key), "Key should exist.\n");
     RegCloseKey(key);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Class", &class_key);
-    ok(!res, "Failed to open class key, error %u.\n", res);
+    ok(!res, "Failed to open class key, error %lu.\n", res);
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DRIVER, NULL,
             (BYTE *)driver_path, sizeof(driver_path), NULL);
-    ok(ret, "Failed to get driver property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get driver property, error %#lx.\n", GetLastError());
     res = RegOpenKeyA(class_key, driver_path, &key);
-    ok(!res, "Failed to open driver key, error %u.\n", res);
+    ok(!res, "Failed to open driver key, error %lu.\n", res);
     RegSetValueExA(key, "foo", 0, REG_SZ, (BYTE *)"bar", sizeof("bar"));
     RegCloseKey(key);
 
@@ -1380,68 +1380,68 @@ static void test_device_key(void)
 todo_wine {
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
     ok(GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_ACCESS_DENIED, /* win2k3 */
-            "Got unexpected error %#x.\n", GetLastError());
+            "Got unexpected error %#lx.\n", GetLastError());
 }
 
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ);
-    ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#x.\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Failed to open device key, error %#lx.\n", GetLastError());
     size = sizeof(data);
     res = RegQueryValueExA(key, "foo", NULL, NULL, (BYTE *)data, &size);
-    ok(!res, "Failed to get value, error %u.\n", res);
+    ok(!res, "Failed to get value, error %lu.\n", res);
     ok(!strcmp(data, "bar"), "Got wrong data %s.\n", data);
     RegCloseKey(key);
 
     ret = SetupDiDeleteDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV);
-    ok(ret, "Failed to delete device key, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete device key, error %#lx.\n", GetLastError());
 
     res = RegOpenKeyA(class_key, driver_path, &key);
     ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
 
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, 0);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#lx.\n", GetLastError());
 
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#lx.\n", GetLastError());
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, params_key_path, &key);
     ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
 
     key = SetupDiCreateDevRegKeyA(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL);
-    ok(key != INVALID_HANDLE_VALUE, "Got unexpected error %#x.\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Got unexpected error %#lx.\n", GetLastError());
     RegCloseKey(key);
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, params_key_path, &key);
-    ok(!res, "Failed to open device key, error %u.\n", res);
+    ok(!res, "Failed to open device key, error %lu.\n", res);
     res = RegSetValueExA(key, "foo", 0, REG_SZ, (BYTE *)"bar", sizeof("bar"));
-    ok(!res, "Failed to set value, error %u.\n", res);
+    ok(!res, "Failed to set value, error %lu.\n", res);
     RegCloseKey(key);
 
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
-    ok(key != INVALID_HANDLE_VALUE, "Got unexpected error %#x.\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Got unexpected error %#lx.\n", GetLastError());
     size = sizeof(data);
     res = RegQueryValueExA(key, "foo", NULL, NULL, (BYTE *)data, &size);
-    ok(!res, "Failed to get value, error %u.\n", res);
+    ok(!res, "Failed to get value, error %lu.\n", res);
     ok(!strcmp(data, "bar"), "Got wrong data %s.\n", data);
     RegCloseKey(key);
 
     ret = SetupDiDeleteDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DEV);
-    ok(ret, "Got unexpected error %#x.\n", GetLastError());
+    ok(ret, "Got unexpected error %#lx.\n", GetLastError());
 
     key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
     ok(key == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_KEY_DOES_NOT_EXIST, "Got unexpected error %#lx.\n", GetLastError());
 
     res = RegOpenKeyA(HKEY_LOCAL_MACHINE, params_key_path, &key);
     ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
 
     key = SetupDiCreateDevRegKeyW(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, NULL, NULL);
-    ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#x.\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Failed to create device key, error %#lx.\n", GetLastError());
     RegCloseKey(key);
 
     ret = SetupDiRemoveDevice(set, &device);
-    ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
     SetupDiDestroyDeviceInfoList(set);
 
     res = RegOpenKeyA(class_key, driver_path, &key);
@@ -1449,7 +1449,7 @@ todo_wine {
 
     /* Vista+ deletes the key automatically. */
     res = RegDeleteKeyA(HKEY_LOCAL_MACHINE, class_key_path);
-    ok(!res || res == ERROR_FILE_NOT_FOUND, "Failed to delete class key, error %u.\n", res);
+    ok(!res || res == ERROR_FILE_NOT_FOUND, "Failed to delete class key, error %lu.\n", res);
 
     RegCloseKey(class_key);
 }
@@ -1469,45 +1469,45 @@ static void test_register_device_iface(void)
     LONG res;
 
     set = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key);
     ok(res == ERROR_FILE_NOT_FOUND, "Key should not exist.\n");
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "removed", 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, "deleted", 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
 
     ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 1, &iface);
-    ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate interfaces, error %#lx.\n", GetLastError());
     ret = SetupDiRemoveDeviceInterface(set, &iface);
-    ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete interface, error %#lx.\n", GetLastError());
     ret = SetupDiEnumDeviceInterfaces(set, &device, &guid, 2, &iface);
-    ok(ret, "Failed to enumerate interfaces, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate interfaces, error %#lx.\n", GetLastError());
     ret = SetupDiDeleteDeviceInterfaceData(set, &iface);
-    ok(ret, "Failed to delete interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete interface, error %#lx.\n", GetLastError());
 
     set2 = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE);
-    ok(set2 != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set2 != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     check_device_iface(set2, NULL, &guid, 0, 0, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set2, NULL, &guid, 1, 0, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\deleted");
     check_device_iface(set2, NULL, &guid, 2, 0, NULL);
 
     ret = SetupDiEnumDeviceInfo(set2, 0, &device2);
-    ok(ret, "Failed to enumerate devices, error %#x.\n", GetLastError());
+    ok(ret, "Failed to enumerate devices, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set2, &device2, &guid, "second", 0, NULL);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     ret = SetupDiRemoveDevice(set, &device);
-    ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
 
     check_device_iface(set, NULL, &guid, 0, SPINT_REMOVED, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &guid, 1, SPINT_REMOVED, "\\\\?\\root#legacy_bogus#0000#{6a55b5a4-3f65-11db-b704-0011955c2bdb}\\removed");
@@ -1524,13 +1524,13 @@ static void test_register_device_iface(void)
     /* make sure all interface keys are deleted when a device is removed */
 
     set = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     set2 = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE);
-    ok(set2 != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set2 != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_iface(set2, NULL, &guid, 0, 0, NULL);
     SetupDiDestroyDeviceInfoList(set2);
 
@@ -1549,26 +1549,26 @@ static void test_registry_property_a(void)
     HKEY key;
 
     set = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyA(NULL, NULL, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyA(set, NULL, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
     todo_wine
-    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, 0);
     todo_wine
@@ -1577,23 +1577,23 @@ static void test_registry_property_a(void)
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, (BYTE *)"Bogus", sizeof("Bogus"));
-    ok(ret, "Failed to set property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set property, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(NULL, NULL, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, NULL, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
     todo_wine
-    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, NULL, sizeof("Bogus"), NULL);
     ok(!ret, "Expected failure, got %d\n", ret);
@@ -1602,34 +1602,34 @@ static void test_registry_property_a(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == sizeof("Bogus"), "Got unexpected size %d.\n", size);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == sizeof("Bogus"), "Got unexpected size %ld.\n", size);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!strcmp(buf, "Bogus"), "Got unexpected property %s.\n", buf);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, &type, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!strcmp(buf, "Bogus"), "Got unexpected property %s.\n", buf);
-    ok(type == REG_SZ, "Got unexpected type %d.\n", type);
+    ok(type == REG_SZ, "Got unexpected type %ld.\n", type);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, 0);
-    ok(ret, "Failed to set property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set property, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_FRIENDLYNAME, NULL, (BYTE *)buf, sizeof(buf), &size);
 todo_wine {
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID, NULL, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
 
@@ -1638,56 +1638,56 @@ todo_wine {
 
     /* Test existing registry properties right after device creation */
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     /* Create device from a not registered class without device name */
     ret = SetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* No SPDRP_DEVICEDESC property */
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DEVICEDESC, NULL, (BYTE *)buf, sizeof(buf), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     /* No SPDRP_CLASS property */
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASS, NULL, (BYTE *)buf, sizeof(buf), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     /* Have SPDRP_CLASSGUID property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASSGUID, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpiA(buf, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}"), "Got unexpected value %s.\n", buf);
 
     ret = SetupDiDeleteDeviceInfo(set, &device);
-    ok(ret, "Failed to delete device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete device, error %#lx.\n", GetLastError());
 
     /* Create device from a not registered class with a device name */
     ret = SetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, "device_name", NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* Have SPDRP_DEVICEDESC property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_DEVICEDESC, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpA(buf, "device_name"), "Got unexpected value %s.\n", buf);
 
     SetupDiDestroyDeviceInfoList(set);
 
     /* Create device from a registered class */
     set = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_DISPLAY, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "display", &GUID_DEVCLASS_DISPLAY, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* Have SPDRP_CLASS property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CLASS, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpA(buf, "Display"), "Got unexpected value %s.\n", buf);
 
     SetupDiDestroyDeviceInfoList(set);
@@ -1709,26 +1709,26 @@ static void test_registry_property_w(void)
      'L','E','G','A','C','Y','_','B','O','G','U','S',0};
 
     set = SetupDiGetClassDevsA(&guid, NULL, 0, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to get device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "LEGACY_BOGUS", &guid, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyW(NULL, NULL, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyW(set, NULL, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyW(set, &device, -1, NULL, 0);
     ok(!ret, "Expected failure.\n");
     todo_wine
-    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, 0);
     todo_wine
@@ -1737,23 +1737,23 @@ static void test_registry_property_w(void)
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, (BYTE *)friendly_name, sizeof(friendly_name));
-    ok(ret, "Failed to set property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set property, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(NULL, NULL, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, NULL, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, -1, NULL, NULL, 0, NULL);
     ok(!ret, "Expected failure.\n");
     todo_wine
-    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_REG_PROPERTY, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, NULL, sizeof(buf), NULL);
     ok(!ret, "Expected failure.\n");
@@ -1762,34 +1762,34 @@ static void test_registry_property_w(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == sizeof(friendly_name), "Got unexpected size %d.\n", size);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == sizeof(friendly_name), "Got unexpected size %ld.\n", size);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpW(buf, friendly_name), "Got unexpected property %s.\n", wine_dbgstr_w(buf));
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, &type, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpW(buf, friendly_name), "Got unexpected property %s.\n", wine_dbgstr_w(buf));
-    ok(type == REG_SZ, "Got unexpected type %d.\n", type);
+    ok(type == REG_SZ, "Got unexpected type %ld.\n", type);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, 0);
-    ok(ret, "Failed to set property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set property, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_FRIENDLYNAME, NULL, (BYTE *)buf, sizeof(buf), &size);
 todo_wine {
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_HARDWAREID, NULL, NULL, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
 
@@ -1798,56 +1798,56 @@ todo_wine {
 
     /* Test existing registry properties right after device creation */
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     /* Create device from a not registered class without device name */
     ret = SetupDiCreateDeviceInfoW(set, L"LEGACY_BOGUS", &guid, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* No SPDRP_DEVICEDESC property */
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_DEVICEDESC, NULL, (BYTE *)buf, sizeof(buf), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     /* No SPDRP_CLASS property */
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_CLASS, NULL, (BYTE *)buf, sizeof(buf), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 
     /* Have SPDRP_CLASSGUID property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_CLASSGUID, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpiW(buf, L"{6a55b5a4-3f65-11db-b704-0011955c2bdb}"), "Got unexpected value %s.\n", wine_dbgstr_w(buf));
 
     ret = SetupDiDeleteDeviceInfo(set, &device);
-    ok(ret, "Failed to delete device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to delete device, error %#lx.\n", GetLastError());
 
     /* Create device from a not registered class with a device name */
     ret = SetupDiCreateDeviceInfoW(set, L"LEGACY_BOGUS", &guid, L"device_name", NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* Have SPDRP_DEVICEDESC property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_DEVICEDESC, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpW(buf, L"device_name"), "Got unexpected value %s.\n", wine_dbgstr_w(buf));
 
     SetupDiDestroyDeviceInfoList(set);
 
     /* Create device from a registered class */
     set = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_DISPLAY, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoW(set, L"display", &GUID_DEVCLASS_DISPLAY, NULL, NULL, DICD_GENERATE_ID, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     /* Have SPDRP_CLASS property */
     memset(buf, 0, sizeof(buf));
     ret = SetupDiGetDeviceRegistryPropertyW(set, &device, SPDRP_CLASS, NULL, (BYTE *)buf, sizeof(buf), NULL);
-    ok(ret, "Failed to get property, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get property, error %#lx.\n", GetLastError());
     ok(!lstrcmpW(buf, L"Display"), "Got unexpected value %s.\n", wine_dbgstr_w(buf));
 
     SetupDiDestroyDeviceInfoList(set);
@@ -1876,37 +1876,37 @@ static void test_get_inf_class(void)
     retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
     ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
     ok(ERROR_FILE_NOT_FOUND == GetLastError(),
-        "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+        "expected error ERROR_FILE_NOT_FOUND, got %lu\n", GetLastError());
 
     /* missing file wins against other invalid parameter */
     SetLastError(0xdeadbeef);
     retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count);
     ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
     ok(ERROR_FILE_NOT_FOUND == GetLastError(),
-        "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+        "expected error ERROR_FILE_NOT_FOUND, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count);
     ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
     ok(ERROR_FILE_NOT_FOUND == GetLastError(),
-        "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+        "expected error ERROR_FILE_NOT_FOUND, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
     ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
     ok(ERROR_FILE_NOT_FOUND == GetLastError(),
-        "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+        "expected error ERROR_FILE_NOT_FOUND, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, NULL);
     ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
     ok(ERROR_FILE_NOT_FOUND == GetLastError(),
-        "expected error ERROR_FILE_NOT_FOUND, got %u\n", GetLastError());
+        "expected error ERROR_FILE_NOT_FOUND, got %lu\n", GetLastError());
 
     /* test file content */
     h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                     FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#x.\n", GetLastError());
+    ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#lx.\n", GetLastError());
     CloseHandle(h);
 
     retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
@@ -1917,7 +1917,7 @@ static void test_get_inf_class(void)
         trace("testing signature %s\n", signatures[i]);
         h = CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
                         FILE_ATTRIBUTE_NORMAL, NULL);
-        ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#x.\n", GetLastError());
+        ok(h != INVALID_HANDLE_VALUE, "Failed to create file, error %#lx.\n", GetLastError());
         WriteFile(h, content, sizeof(content), &count, NULL);
         CloseHandle(h);
 
@@ -1933,46 +1933,46 @@ static void test_get_inf_class(void)
 
         count = 0xdeadbeef;
         retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
-        ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
-        ok(count == 5, "expected count==5, got %u\n", count);
+        ok(retval, "expected SetupDiGetINFClassA to succeed! error %lu\n", GetLastError());
+        ok(count == 5, "expected count==5, got %lu\n", count);
 
         count = 0xdeadbeef;
         retval = SetupDiGetINFClassA(filename, &guid, cn, 5, &count);
-        ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
-        ok(count == 5, "expected count==5, got %u\n", count);
+        ok(retval, "expected SetupDiGetINFClassA to succeed! error %lu\n", GetLastError());
+        ok(count == 5, "expected count==5, got %lu\n", count);
 
         count = 0xdeadbeef;
         SetLastError(0xdeadbeef);
         retval = SetupDiGetINFClassA(filename, &guid, cn, 4, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(ERROR_INSUFFICIENT_BUFFER == GetLastError(),
-            "expected error ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError());
-        ok(count == 5, "expected count==5, got %u\n", count);
+            "expected error ERROR_INSUFFICIENT_BUFFER, got %lu\n", GetLastError());
+        ok(count == 5, "expected count==5, got %lu\n", count);
 
         /* invalid parameter */
         SetLastError(0xdeadbeef);
         retval = SetupDiGetINFClassA(NULL, &guid, cn, MAX_PATH, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(ERROR_INVALID_PARAMETER == GetLastError(),
-            "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+            "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
         SetLastError(0xdeadbeef);
         retval = SetupDiGetINFClassA(filename, NULL, cn, MAX_PATH, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(ERROR_INVALID_PARAMETER == GetLastError(),
-            "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+            "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
         SetLastError(0xdeadbeef);
         retval = SetupDiGetINFClassA(filename, &guid, NULL, MAX_PATH, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(ERROR_INVALID_PARAMETER == GetLastError(),
-            "expected error ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+            "expected error ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
         SetLastError(0xdeadbeef);
         retval = SetupDiGetINFClassA(filename, &guid, cn, 0, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER || GetLastError() == ERROR_INVALID_PARAMETER /* 2k3+ */,
-                "Got unexpected error %#x.\n", GetLastError());
+                "Got unexpected error %#lx.\n", GetLastError());
 
         DeleteFileA(filename);
 
@@ -1983,7 +1983,7 @@ static void test_get_inf_class(void)
         retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
         ok(!retval, "expected SetupDiGetINFClassA to fail!\n");
         ok(GetLastError() == RPC_S_INVALID_STRING_UUID || GetLastError() == ERROR_INVALID_PARAMETER /* 7+ */,
-                "Got unexpected error %#x.\n", GetLastError());
+                "Got unexpected error %#lx.\n", GetLastError());
 
         /* network adapter guid */
         WritePrivateProfileStringA("Version", "ClassGUID",
@@ -1992,9 +1992,9 @@ static void test_get_inf_class(void)
         /* this test succeeds only if the guid is known to the system */
         count = 0xdeadbeef;
         retval = SetupDiGetINFClassA(filename, &guid, cn, MAX_PATH, &count);
-        ok(retval, "expected SetupDiGetINFClassA to succeed! error %u\n", GetLastError());
+        ok(retval, "expected SetupDiGetINFClassA to succeed! error %lu\n", GetLastError());
         todo_wine
-        ok(count == 4, "expected count==4, got %u(%s)\n", count, cn);
+        ok(count == 4, "expected count==4, got %lu(%s)\n", count, cn);
 
         DeleteFileA(filename);
     }
@@ -2008,13 +2008,13 @@ static void test_devnode(void)
     DWORD ret;
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#lx\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL,
         NULL, 0, &device);
-    ok(ret, "SetupDiCreateDeviceInfo failed: %#x\n", GetLastError());
+    ok(ret, "SetupDiCreateDeviceInfo failed: %#lx\n", GetLastError());
 
     ret = CM_Get_Device_IDA(device.DevInst, buffer, sizeof(buffer), 0);
-    ok(!ret, "got %#x\n", ret);
+    ok(!ret, "got %#lx\n", ret);
     ok(!strcmp(buffer, "ROOT\\LEGACY_BOGUS\\0000"), "got %s\n", buffer);
 
     SetupDiDestroyDeviceInfoList(set);
@@ -2033,38 +2033,38 @@ static void test_device_interface_key(void)
     LONG sz, ret;
 
     set = SetupDiGetClassDevsA(NULL, NULL, 0, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed: %#lx\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0001", &guid, NULL, NULL, 0, &devinfo);
-    ok(ret, "SetupDiCreateDeviceInfo failed: %#x\n", GetLastError());
+    ok(ret, "SetupDiCreateDeviceInfo failed: %#lx\n", GetLastError());
 
     ret = SetupDiCreateDeviceInterfaceA(set, &devinfo, &guid, NULL, 0, &iface);
-    ok(ret, "SetupDiCreateDeviceInterface failed: %#x\n", GetLastError());
+    ok(ret, "SetupDiCreateDeviceInterface failed: %#lx\n", GetLastError());
 
     ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, keypath, &parent);
-    ok(!ret, "failed to open device parent key: %u\n", ret);
+    ok(!ret, "failed to open device parent key: %lu\n", ret);
 
     ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
     ok(ret == ERROR_FILE_NOT_FOUND, "key shouldn't exist\n");
 
     dikey = SetupDiCreateDeviceInterfaceRegKeyA(set, &iface, 0, KEY_ALL_ACCESS, NULL, NULL);
-    ok(dikey != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError());
+    ok(dikey != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError());
 
     ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
-    ok(!ret, "key should exist: %u\n", ret);
+    ok(!ret, "key should exist: %lu\n", ret);
 
     ret = RegSetValueA(key, NULL, REG_SZ, "test", 5);
-    ok(!ret, "RegSetValue failed: %u\n", ret);
+    ok(!ret, "RegSetValue failed: %lu\n", ret);
     sz = sizeof(buffer);
     ret = RegQueryValueA(dikey, NULL, buffer, &sz);
-    ok(!ret, "RegQueryValue failed: %u\n", ret);
+    ok(!ret, "RegQueryValue failed: %lu\n", ret);
     ok(!strcmp(buffer, "test"), "got wrong data %s\n", buffer);
 
     RegCloseKey(dikey);
     RegCloseKey(key);
 
     ret = SetupDiDeleteDeviceInterfaceRegKey(set, &iface, 0);
-    ok(ret, "got error %u\n", GetLastError());
+    ok(ret, "got error %lu\n", GetLastError());
 
     ret = RegOpenKeyA(parent, "#\\Device Parameters", &key);
     ok(ret == ERROR_FILE_NOT_FOUND, "key shouldn't exist\n");
@@ -2087,15 +2087,15 @@ static void test_open_device_interface_key(void)
     BOOL ret;
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx\n", GetLastError());
 
     device.cbSize = sizeof(device);
     ret = SetupDiCreateDeviceInfoA(set, "ROOT\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     iface.cbSize = sizeof(iface);
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &guid, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
 
     /* Test open before creation */
     key = SetupDiOpenDeviceInterfaceRegKey(set, &iface, 0, KEY_ALL_ACCESS);
@@ -2103,34 +2103,34 @@ static void test_open_device_interface_key(void)
 
     /* Test opened key is from SetupDiCreateDeviceInterfaceRegKey */
     key = SetupDiCreateDeviceInterfaceRegKeyW(set, &iface, 0, KEY_ALL_ACCESS, NULL, NULL);
-    ok(key != INVALID_HANDLE_VALUE, "Failed to create interface registry key, error %#x\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Failed to create interface registry key, error %#lx\n", GetLastError());
 
     lr = RegSetValueA(key, NULL, REG_SZ, "test", 5);
-    ok(!lr, "RegSetValue failed, error %#x\n", lr);
+    ok(!lr, "RegSetValue failed, error %#lx\n", lr);
 
     RegCloseKey(key);
 
     key = SetupDiOpenDeviceInterfaceRegKey(set, &iface, 0, KEY_ALL_ACCESS);
-    ok(key != INVALID_HANDLE_VALUE, "Failed to open interface registry key, error %#x\n", GetLastError());
+    ok(key != INVALID_HANDLE_VALUE, "Failed to open interface registry key, error %#lx\n", GetLastError());
 
     size = sizeof(buffer);
     lr = RegQueryValueA(key, NULL, buffer, &size);
-    ok(!lr, "RegQueryValue failed, error %#x\n", lr);
+    ok(!lr, "RegQueryValue failed, error %#lx\n", lr);
     ok(!strcmp(buffer, "test"), "got wrong data %s\n", buffer);
 
     RegCloseKey(key);
 
     /* Test open after removal */
     ret = SetupDiRemoveDeviceInterface(set, &iface);
-    ok(ret, "Failed to remove device interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device interface, error %#lx.\n", GetLastError());
 
     key = SetupDiOpenDeviceInterfaceRegKey(set, &iface, 0, KEY_ALL_ACCESS);
     ok(key == INVALID_HANDLE_VALUE, "Expect open interface registry key failure\n");
 
     ret = SetupDiRemoveDevice(set, &device);
-    ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to remove device, error %#lx.\n", GetLastError());
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 }
 
 static void test_device_install_params(void)
@@ -2141,64 +2141,64 @@ static void test_device_install_params(void)
     BOOL ret;
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     params.cbSize = sizeof(params) - 1;
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     params.cbSize = sizeof(params) + 1;
     SetLastError(0xdeadbeef);
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     params.cbSize = sizeof(params) - 1;
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceInstallParamsA(set, &device, &params);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     params.cbSize = sizeof(params) + 1;
     SetLastError(0xdeadbeef);
     ret = SetupDiSetDeviceInstallParamsA(set, &device, &params);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
 
     memset(&params, 0xcc, sizeof(params));
     params.cbSize = sizeof(params);
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to get device install params, error %#x.\n", GetLastError());
-    ok(!params.Flags, "Got flags %#x.\n", params.Flags);
-    ok(!params.FlagsEx, "Got extended flags %#x.\n", params.FlagsEx);
+    ok(ret, "Failed to get device install params, error %#lx.\n", GetLastError());
+    ok(!params.Flags, "Got flags %#lx.\n", params.Flags);
+    ok(!params.FlagsEx, "Got extended flags %#lx.\n", params.FlagsEx);
     ok(!params.hwndParent, "Got parent %p.\n", params.hwndParent);
     ok(!params.InstallMsgHandler, "Got callback %p.\n", params.InstallMsgHandler);
     ok(!params.InstallMsgHandlerContext, "Got callback context %p.\n", params.InstallMsgHandlerContext);
     ok(!params.FileQueue, "Got queue %p.\n", params.FileQueue);
-    ok(!params.ClassInstallReserved, "Got class installer data %#lx.\n", params.ClassInstallReserved);
+    ok(!params.ClassInstallReserved, "Got class installer data %#Ix.\n", params.ClassInstallReserved);
     ok(!params.DriverPath[0], "Got driver path %s.\n", params.DriverPath);
 
     params.Flags = DI_INF_IS_SORTED;
     params.FlagsEx = DI_FLAGSEX_ALLOWEXCLUDEDDRVS;
     strcpy(params.DriverPath, "C:\\windows");
     ret = SetupDiSetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to set device install params, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set device install params, error %#lx.\n", GetLastError());
 
     memset(&params, 0xcc, sizeof(params));
     params.cbSize = sizeof(params);
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to get device install params, error %#x.\n", GetLastError());
-    ok(params.Flags == DI_INF_IS_SORTED, "Got flags %#x.\n", params.Flags);
-    ok(params.FlagsEx == DI_FLAGSEX_ALLOWEXCLUDEDDRVS, "Got extended flags %#x.\n", params.FlagsEx);
+    ok(ret, "Failed to get device install params, error %#lx.\n", GetLastError());
+    ok(params.Flags == DI_INF_IS_SORTED, "Got flags %#lx.\n", params.Flags);
+    ok(params.FlagsEx == DI_FLAGSEX_ALLOWEXCLUDEDDRVS, "Got extended flags %#lx.\n", params.FlagsEx);
     ok(!params.hwndParent, "Got parent %p.\n", params.hwndParent);
     ok(!params.InstallMsgHandler, "Got callback %p.\n", params.InstallMsgHandler);
     ok(!params.InstallMsgHandlerContext, "Got callback context %p.\n", params.InstallMsgHandlerContext);
     ok(!params.FileQueue, "Got queue %p.\n", params.FileQueue);
-    ok(!params.ClassInstallReserved, "Got class installer data %#lx.\n", params.ClassInstallReserved);
+    ok(!params.ClassInstallReserved, "Got class installer data %#Ix.\n", params.ClassInstallReserved);
     ok(!strcasecmp(params.DriverPath, "C:\\windows"), "Got driver path %s.\n", params.DriverPath);
 
     SetupDiDestroyDeviceInfoList(set);
@@ -2257,63 +2257,63 @@ static void test_get_actual_section(void)
     create_file(inf_path, inf_data);
 
     hinf = SetupOpenInfFileA(inf_path, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
 
     ret = SetupDiGetActualSectionToInstallA(hinf, "section1", section, ARRAY_SIZE(section), NULL, NULL);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcmp(section, "section1"), "Got unexpected section %s.\n", section);
 
     size = 0xdeadbeef;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section1", NULL, 5, &size, NULL);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
-    ok(size == 9, "Got size %u.\n", size);
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
+    ok(size == 9, "Got size %lu.\n", size);
 
     SetLastError(0xdeadbeef);
     size = 0xdeadbeef;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section1", section, 5, &size, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == 9, "Got size %u.\n", size);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == 9, "Got size %lu.\n", size);
 
     SetLastError(0xdeadbeef);
     ret = SetupDiGetActualSectionToInstallA(hinf, "section1", section, ARRAY_SIZE(section), &size, NULL);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section1"), "Got unexpected section %s.\n", section);
-    ok(size == 9, "Got size %u.\n", size);
+    ok(size == 9, "Got size %lu.\n", size);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section2", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section2.NT"), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section3", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section3.NT" MYEXT), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section4", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section4.NT" MYEXT), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section5", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section5.NT"), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section6", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section6.NT" MYEXT), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
     extptr = section;
     ret = SetupDiGetActualSectionToInstallA(hinf, "section9", section, ARRAY_SIZE(section), NULL, &extptr);
-    ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
     ok(!strcasecmp(section, "section9.NT" MYEXT), "Got unexpected section %s.\n", section);
     ok(extptr == section + 8, "Got extension %s.\n", extptr);
 
@@ -2322,38 +2322,38 @@ static void test_get_actual_section(void)
         /* For some reason, these calls hang on Windows 10 1809+. */
         extptr = section;
         ret = SetupDiGetActualSectionToInstallA(hinf, "section1", section, ARRAY_SIZE(section), NULL, &extptr);
-        ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+        ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
         ok(!strcasecmp(section, "section1"), "Got unexpected section %s.\n", section);
         ok(!extptr || !*extptr /* Windows 10 1809 */, "Got extension %s.\n", extptr);
 
         extptr = section;
         ret = SetupDiGetActualSectionToInstallA(hinf, "section7", section, ARRAY_SIZE(section), NULL, &extptr);
-        ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+        ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
         ok(!strcasecmp(section, "section7"), "Got unexpected section %s.\n", section);
         ok(!extptr || !*extptr /* Windows 10 1809 */, "Got extension %s.\n", extptr);
 
         extptr = section;
         ret = SetupDiGetActualSectionToInstallA(hinf, "section8", section, ARRAY_SIZE(section), NULL, &extptr);
-        ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+        ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
         ok(!strcasecmp(section, "section8"), "Got unexpected section %s.\n", section);
         ok(!extptr || !*extptr /* Windows 10 1809 */, "Got extension %s.\n", extptr);
 
         extptr = section;
         ret = SetupDiGetActualSectionToInstallA(hinf, "nonexistent", section, ARRAY_SIZE(section), NULL, &extptr);
-        ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+        ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
         ok(!strcasecmp(section, "nonexistent"), "Got unexpected section %s.\n", section);
         ok(!extptr || !*extptr /* Windows 10 1809 */, "Got extension %s.\n", extptr);
 
         extptr = section;
         ret = SetupDiGetActualSectionToInstallA(hinf, "section10", section, ARRAY_SIZE(section), NULL, &extptr);
-        ok(ret, "Failed to get section, error %#x.\n", GetLastError());
+        ok(ret, "Failed to get section, error %#lx.\n", GetLastError());
         ok(!strcasecmp(section, "section10"), "Got unexpected section %s.\n", section);
         ok(!extptr, "Got extension %s.\n", extptr);
     }
 
     SetupCloseInfFile(hinf);
     ret = DeleteFileA(inf_path);
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path, GetLastError());
 }
 
 static void test_driver_list(void)
@@ -2433,44 +2433,44 @@ static void test_driver_list(void)
     CloseHandle(file);
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\BOGUS\\0000", &GUID_NULL, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID,
             (const BYTE *)hardware_id, sizeof(hardware_id));
-    ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set hardware ID, error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_COMPATIBLEIDS,
             (const BYTE *)compat_id, sizeof(compat_id));
-    ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set hardware ID, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to get device install params, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get device install params, error %#lx.\n", GetLastError());
     strcpy(params.DriverPath, inf_path);
     params.Flags = DI_ENUMSINGLEINF;
     ret = SetupDiSetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to set device install params, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set device install params, error %#lx.\n", GetLastError());
 
     ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER);
-    ok(ret, "Failed to build driver list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to build driver list, error %#lx.\n", GetLastError());
 
     idx = 0;
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc0"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
@@ -2479,96 +2479,96 @@ static void test_driver_list(void)
 
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, NULL, 0, &size);
     ok(ret || GetLastError() == ERROR_INVALID_USER_BUFFER /* Win10 1809 */,
-            "Failed to get driver details, error %#x.\n", GetLastError());
-    ok(size == expect_size, "Got size %u.\n", size);
+            "Failed to get driver details, error %#lx.\n", GetLastError());
+    ok(size == expect_size, "Got size %lu.\n", size);
 
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, NULL, sizeof(SP_DRVINFO_DETAIL_DATA_A) - 1, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == expect_size, "Got size %u.\n", size);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == expect_size, "Got size %lu.\n", size);
 
     size = 0xdeadbeef;
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, 0, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == 0xdeadbeef, "Got size %u.\n", size);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == 0xdeadbeef, "Got size %lu.\n", size);
 
     size = 0xdeadbeef;
     detail->CompatIDsLength = 0xdeadbeef;
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, sizeof(SP_DRVINFO_DETAIL_DATA_A) - 1, &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == 0xdeadbeef, "Got size %u.\n", size);
-    ok(detail->CompatIDsLength == 0xdeadbeef, "Got wrong compat IDs length %u.\n", detail->CompatIDsLength);
+    ok(GetLastError() == ERROR_INVALID_USER_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == 0xdeadbeef, "Got size %lu.\n", size);
+    ok(detail->CompatIDsLength == 0xdeadbeef, "Got wrong compat IDs length %lu.\n", detail->CompatIDsLength);
 
     memset(detail_buffer, 0xcc, sizeof(detail_buffer));
     detail->cbSize = sizeof(*detail);
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, sizeof(SP_DRVINFO_DETAIL_DATA_A), NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
     ok(detail->InfDate.dwHighDateTime == filetime.dwHighDateTime
             && detail->InfDate.dwLowDateTime == filetime.dwLowDateTime,
-            "Expected %#x%08x, got %#x%08x.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
+            "Expected %#lx%08lx, got %#lx%08lx.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
             detail->InfDate.dwHighDateTime, detail->InfDate.dwLowDateTime);
     ok(!strcmp(detail->SectionName, "install1"), "Got section name %s.\n", debugstr_a(detail->SectionName));
     ok(!stricmp(detail->InfFileName, short_path), "Got INF file name %s.\n", debugstr_a(detail->InfFileName));
     ok(!strcmp(detail->DrvDescription, "desc1"), "Got description %s.\n", debugstr_a(detail->DrvDescription));
     ok(!detail->CompatIDsOffset || detail->CompatIDsOffset == sizeof("bogus_hardware_id") /* Win10 1809 */,
-            "Got wrong compat IDs offset %u.\n", detail->CompatIDsOffset);
-    ok(!detail->CompatIDsLength, "Got wrong compat IDs length %u.\n", detail->CompatIDsLength);
+            "Got wrong compat IDs offset %lu.\n", detail->CompatIDsOffset);
+    ok(!detail->CompatIDsLength, "Got wrong compat IDs length %lu.\n", detail->CompatIDsLength);
     ok(!detail->HardwareID[0], "Got wrong ID list.\n");
 
     size = 0xdeadbeef;
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, sizeof(SP_DRVINFO_DETAIL_DATA_A), &size);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#x.\n", GetLastError());
-    ok(size == expect_size, "Got size %u.\n", size);
+    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Got unexpected error %#lx.\n", GetLastError());
+    ok(size == expect_size, "Got size %lu.\n", size);
 
     size = 0xdeadbeef;
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, sizeof(detail_buffer), &size);
-    ok(ret, "Failed to get driver details, error %#x.\n", GetLastError());
-    ok(size == expect_size, "Got size %u.\n", size);
+    ok(ret, "Failed to get driver details, error %#lx.\n", GetLastError());
+    ok(size == expect_size, "Got size %lu.\n", size);
     ok(detail->InfDate.dwHighDateTime == filetime.dwHighDateTime
             && detail->InfDate.dwLowDateTime == filetime.dwLowDateTime,
-            "Expected %#x%08x, got %#x%08x.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
+            "Expected %#lx%08lx, got %#lx%08lx.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
             detail->InfDate.dwHighDateTime, detail->InfDate.dwLowDateTime);
     ok(!strcmp(detail->SectionName, "install1"), "Got section name %s.\n", debugstr_a(detail->SectionName));
     ok(!stricmp(detail->InfFileName, short_path), "Got INF file name %s.\n", debugstr_a(detail->InfFileName));
     ok(!strcmp(detail->DrvDescription, "desc1"), "Got description %s.\n", debugstr_a(detail->DrvDescription));
-    ok(!detail->CompatIDsOffset, "Got wrong compat IDs offset %u.\n", detail->CompatIDsOffset);
-    ok(!detail->CompatIDsLength, "Got wrong compat IDs length %u.\n", detail->CompatIDsLength);
+    ok(!detail->CompatIDsOffset, "Got wrong compat IDs offset %lu.\n", detail->CompatIDsOffset);
+    ok(!detail->CompatIDsLength, "Got wrong compat IDs length %lu.\n", detail->CompatIDsLength);
     ok(!memcmp(detail->HardwareID, "bogus_hardware_id\0", sizeof("bogus_hardware_id\0")), "Got wrong ID list.\n");
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc4"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
     ret = SetupDiGetDriverInfoDetailA(set, &device, &driver, detail, sizeof(detail_buffer), NULL);
-    ok(ret, "Failed to get driver details, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get driver details, error %#lx.\n", GetLastError());
     ok(detail->InfDate.dwHighDateTime == filetime.dwHighDateTime
             && detail->InfDate.dwLowDateTime == filetime.dwLowDateTime,
-            "Expected %#x%08x, got %#x%08x.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
+            "Expected %#lx%08lx, got %#lx%08lx.\n", filetime.dwHighDateTime, filetime.dwLowDateTime,
             detail->InfDate.dwHighDateTime, detail->InfDate.dwLowDateTime);
     ok(!detail->SectionName[0], "Got section name %s.\n", debugstr_a(detail->SectionName));
     ok(!stricmp(detail->InfFileName, short_path), "Got INF file name %s.\n", debugstr_a(detail->InfFileName));
     ok(!strcmp(detail->DrvDescription, "desc4"), "Got description %s.\n", debugstr_a(detail->DrvDescription));
-    ok(detail->CompatIDsOffset == sizeof("wrong_hardware_id"), "Got wrong compat IDs offset %u.\n", detail->CompatIDsOffset);
-    ok(detail->CompatIDsLength == sizeof("bogus_compat_id\0"), "Got wrong compat IDs length %u.\n", detail->CompatIDsLength);
+    ok(detail->CompatIDsOffset == sizeof("wrong_hardware_id"), "Got wrong compat IDs offset %lu.\n", detail->CompatIDsOffset);
+    ok(detail->CompatIDsLength == sizeof("bogus_compat_id\0"), "Got wrong compat IDs length %lu.\n", detail->CompatIDsLength);
     ok(!memcmp(detail->HardwareID, "wrong_hardware_id\0bogus_compat_id\0",
             sizeof("wrong_hardware_id\0bogus_compat_id\0")), "Got wrong ID list.\n");
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc5"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg2_wow" : "mfg2"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
@@ -2576,65 +2576,65 @@ static void test_driver_list(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, idx++, &driver);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiGetSelectedDriverA(set, &device, &driver);
     ok(ret /* Win10 1809 */ || GetLastError() == ERROR_NO_DRIVER_SELECTED,
-            "Got unexpected error %#x.\n", GetLastError());
+            "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiSelectBestCompatDrv(set, &device);
-    ok(ret, "Failed to select driver, error %#x.\n", GetLastError());
+    ok(ret, "Failed to select driver, error %#lx.\n", GetLastError());
 
     ret = SetupDiGetSelectedDriverA(set, &device, &driver);
-    ok(ret, "Failed to get selected driver, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to get selected driver, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, wow64 ? "mfg1_wow" : "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
 
     SetupDiDestroyDeviceInfoList(set);
     ret = DeleteFileA(inf_path);
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path, GetLastError());
 
     /* Test building from a path. */
 
     GetTempPathA(sizeof(inf_dir), inf_dir);
     strcat(inf_dir, "setupapi_test");
     ret = CreateDirectoryA(inf_dir, NULL);
-    ok(ret, "Failed to create directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create directory, error %lu.\n", GetLastError());
     sprintf(inf_path, "%s/test1.inf", inf_dir);
     create_file(inf_path, inf_data_file1);
     sprintf(inf_path2, "%s/test2.inf", inf_dir);
     create_file(inf_path2, inf_data_file2);
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\BOGUS\\0000", &GUID_NULL, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID,
             (const BYTE *)hardware_id, sizeof(hardware_id));
-    ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set hardware ID, error %#lx.\n", GetLastError());
 
     ret = SetupDiGetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to get device install params, error %#x.\n", GetLastError());
+    ok(ret, "Failed to get device install params, error %#lx.\n", GetLastError());
     strcpy(params.DriverPath, inf_dir);
     ret = SetupDiSetDeviceInstallParamsA(set, &device, &params);
-    ok(ret, "Failed to set device install params, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set device install params, error %#lx.\n", GetLastError());
 
     ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER);
-    ok(ret, "Failed to build driver list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to build driver list, error %#lx.\n", GetLastError());
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 1, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
@@ -2642,15 +2642,15 @@ static void test_driver_list(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 2, &driver);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
     ret = DeleteFileA(inf_path);
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path, GetLastError());
     ret = DeleteFileA(inf_path2);
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path2, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path2, GetLastError());
     ret = RemoveDirectoryA(inf_dir);
-    ok(ret, "Failed to delete %s, error %u.\n", inf_dir, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_dir, GetLastError());
 
     /* Test the default path. */
 
@@ -2658,27 +2658,27 @@ static void test_driver_list(void)
     create_file("C:/windows/inf/wine_test2.inf", inf_data_file2);
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\BOGUS\\0000", &GUID_NULL, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiSetDeviceRegistryPropertyA(set, &device, SPDRP_HARDWAREID,
             (const BYTE *)hardware_id, sizeof(hardware_id));
-    ok(ret, "Failed to set hardware ID, error %#x.\n", GetLastError());
+    ok(ret, "Failed to set hardware ID, error %#lx.\n", GetLastError());
 
     ret = SetupDiBuildDriverInfoList(set, &device, SPDIT_COMPATDRIVER);
-    ok(ret, "Failed to build driver list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to build driver list, error %#lx.\n", GetLastError());
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 0, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc1"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
 
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 1, &driver);
-    ok(ret, "Failed to enumerate drivers, error %#x.\n", GetLastError());
-    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#x.\n", driver.DriverType);
+    ok(ret, "Failed to enumerate drivers, error %#lx.\n", GetLastError());
+    ok(driver.DriverType == SPDIT_COMPATDRIVER, "Got wrong type %#lx.\n", driver.DriverType);
     ok(!strcmp(driver.Description, "desc2"), "Got wrong description '%s'.\n", driver.Description);
     ok(!strcmp(driver.MfgName, "mfg1"), "Got wrong manufacturer '%s'.\n", driver.MfgName);
     ok(!strcmp(driver.ProviderName, ""), "Got wrong provider '%s'.\n", driver.ProviderName);
@@ -2686,13 +2686,13 @@ static void test_driver_list(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiEnumDriverInfoA(set, &device, SPDIT_COMPATDRIVER, 2, &driver);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected error %#lx.\n", GetLastError());
 
     SetupDiDestroyDeviceInfoList(set);
     ret = DeleteFileA("C:/windows/inf/wine_test1.inf");
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path, GetLastError());
     ret = DeleteFileA("C:/windows/inf/wine_test2.inf");
-    ok(ret, "Failed to delete %s, error %u.\n", inf_path2, GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", inf_path2, GetLastError());
     /* Windows "precompiles" INF files in this dir; try to avoid leaving them behind. */
     DeleteFileA("C:/windows/inf/wine_test1.pnf");
     DeleteFileA("C:/windows/inf/wine_test2.pnf");
@@ -2720,26 +2720,26 @@ static void test_class_installer(void)
 
     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Class"
             "\\{6a55b5a4-3f65-11db-b704-0011955c2bdb}", &class_key);
-    ok(!res, "Failed to create class key, error %u.\n", res);
+    ok(!res, "Failed to create class key, error %lu.\n", res);
 
     strcpy(regdata, "winetest_coinst.dll,class_success");
     res = RegSetValueExA(class_key, "Installer32", 0, REG_SZ, (BYTE *)regdata, strlen(regdata)+1);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message);
     *coinst_callback_count = 0;
 
     ret = SetupDiCallClassInstaller(0xdeadbeef, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == 0xdeadbeef, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2747,7 +2747,7 @@ static void test_class_installer(void)
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
@@ -2755,7 +2755,7 @@ static void test_class_installer(void)
     *coinst_callback_count = 0;
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
@@ -2765,7 +2765,7 @@ static void test_class_installer(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2775,75 +2775,75 @@ static void test_class_installer(void)
 
     strcpy(regdata, "winetest_coinst.dll,class_error");
     res = RegSetValueExA(class_key, "Installer32", 0, REG_SZ, (BYTE *)regdata, strlen(regdata)+1);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     /* Test returning ERROR_DI_DO_DEFAULT. */
 
     strcpy(regdata, "winetest_coinst.dll,class_default");
     res = RegSetValueExA(class_key, "Installer32", 0, REG_SZ, (BYTE *)regdata, strlen(regdata)+1);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(device_is_registered(set, &device), "Expected device to be registered.\n");
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     /* The default entry point is ClassInstall(). */
 
     strcpy(regdata, "winetest_coinst.dll");
     res = RegSetValueExA(class_key, "Installer32", 0, REG_SZ, (BYTE *)regdata, strlen(regdata)+1);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2852,14 +2852,14 @@ static void test_class_installer(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message);
     *coinst_callback_count = 0;
 
     res = RegDeleteKeyA(class_key, "");
-    ok(!res, "Failed to delete class key, error %u.\n", res);
+    ok(!res, "Failed to delete class key, error %lu.\n", res);
     RegCloseKey(class_key);
 }
 
@@ -2873,23 +2873,23 @@ static void test_class_coinstaller(void)
     LONG res;
 
     res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\CoDeviceInstallers", &coinst_key);
-    ok(!res, "Failed to open CoDeviceInstallers key, error %u.\n", res);
+    ok(!res, "Failed to open CoDeviceInstallers key, error %lu.\n", res);
     strcpy(regdata, "winetest_coinst.dll,co_success");
     regdata[strlen(regdata) + 1] = 0;
     res = RegSetValueExA(coinst_key, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}", 0,
             REG_MULTI_SZ, (BYTE *)regdata, strlen(regdata) + 2);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     /* We must recreate the device list, or Windows will not recognize that the
      * class co-installer exists. */
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2897,7 +2897,7 @@ static void test_class_coinstaller(void)
 
     ret = SetupDiCallClassInstaller(0xdeadbeef, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == 0xdeadbeef, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2905,7 +2905,7 @@ static void test_class_coinstaller(void)
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(device_is_registered(set, &device), "Expected device to be registered.\n");
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
@@ -2913,7 +2913,7 @@ static void test_class_coinstaller(void)
     *coinst_callback_count = 0;
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
@@ -2923,7 +2923,7 @@ static void test_class_coinstaller(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     todo_wine ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     todo_wine ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2935,27 +2935,27 @@ static void test_class_coinstaller(void)
     regdata[strlen(regdata) + 1] = 0;
     res = RegSetValueExA(coinst_key, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}", 0,
             REG_MULTI_SZ, (BYTE *)regdata, strlen(regdata) + 2);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == 0xdeadc0de, "Got unexpected error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     /* The default entry point is CoDeviceInstall(). */
 
@@ -2963,16 +2963,16 @@ static void test_class_coinstaller(void)
     regdata[strlen(regdata) + 1] = 0;
     res = RegSetValueExA(coinst_key, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}", 0,
             REG_MULTI_SZ, (BYTE *)regdata, strlen(regdata) + 2);
-    ok(!res, "Failed to set registry value, error %u.\n", res);
+    ok(!res, "Failed to set registry value, error %lu.\n", res);
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message);
@@ -2981,14 +2981,14 @@ static void test_class_coinstaller(void)
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count);
     ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message);
     *coinst_callback_count = 0;
 
     res = RegDeleteValueA(coinst_key, "{6a55b5a4-3f65-11db-b704-0011955c2bdb}");
-    ok(!res, "Failed to delete value, error %u.\n", res);
+    ok(!res, "Failed to delete value, error %lu.\n", res);
     RegCloseKey(coinst_key);
 }
 
@@ -3006,33 +3006,33 @@ static void test_call_class_installer(void)
     }
 
     set = SetupDiCreateDeviceInfoList(&guid, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
 
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
     ret = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(device_is_registered(set, &device), "Expected device to be registered.\n");
 
     /* This is probably not failure per se, but rather an indication that no
      * class installer was called and no default handler exists. */
     ret = SetupDiCallClassInstaller(DIF_ALLOW_INSTALL, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(0xdeadbeef, set, &device);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_DI_DO_DEFAULT, "Got unexpected error %#lx.\n", GetLastError());
 
     ret = SetupDiCallClassInstaller(DIF_REMOVE, set, &device);
-    ok(ret, "Failed to call class installer, error %#x.\n", GetLastError());
+    ok(ret, "Failed to call class installer, error %#lx.\n", GetLastError());
     ok(!device_is_registered(set, &device), "Expected device not to be registered.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupDiDestroyDeviceInfoList(set);
     ok(ret, "Failed to destroy device list.\n");
-    ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError());
+    ok(!GetLastError(), "Got unexpected error %#lx.\n", GetLastError());
 
     load_resource("coinst.dll", "C:\\windows\\system32\\winetest_coinst.dll");
 
@@ -3046,7 +3046,7 @@ static void test_call_class_installer(void)
     FreeLibrary(coinst);
 
     ret = DeleteFileA("C:\\windows\\system32\\winetest_coinst.dll");
-    ok(ret, "Failed to delete file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete file, error %lu.\n", GetLastError());
 }
 
 static void check_all_devices_enumerated_(int line, HDEVINFO set, BOOL expect_dev3)
@@ -3091,7 +3091,7 @@ static void check_device_list_(int line, HDEVINFO set, const GUID *expect)
 {
     SP_DEVINFO_LIST_DETAIL_DATA_A detail = {sizeof(detail)};
     BOOL ret = SetupDiGetDeviceInfoListDetailA(set, &detail);
-    ok_(__FILE__, line)(ret, "Failed to get list detail, error %#x.\n", GetLastError());
+    ok_(__FILE__, line)(ret, "Failed to get list detail, error %#lx.\n", GetLastError());
     ok_(__FILE__, line)(IsEqualGUID(&detail.ClassGuid, expect), "Expected class %s, got %s\n",
             wine_dbgstr_guid(expect), wine_dbgstr_guid(&detail.ClassGuid));
 }
@@ -3105,78 +3105,78 @@ static void test_get_class_devs(void)
     BOOL ret;
 
     set = SetupDiCreateDeviceInfoList(NULL, NULL);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\foo", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &iface_guid, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &iface_guid2, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\qux", &guid, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiCreateDeviceInterfaceA(set, &device, &iface_guid, NULL, 0, &iface);
-    ok(ret, "Failed to create interface, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create interface, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
 
     ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\bar", &guid2, NULL, NULL, 0, &device);
-    ok(ret, "Failed to create device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to create device, error %#lx.\n", GetLastError());
     ret = SetupDiRegisterDeviceInfo(set, &device, 0, NULL, NULL, NULL);
-    ok(ret, "Failed to register device, error %#x.\n", GetLastError());
+    ok(ret, "Failed to register device, error %#lx.\n", GetLastError());
 
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, 0);
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &guid);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
     check_device_info(set, 2, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, "ROOT", NULL, 0);
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, "ROOT", NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
@@ -3184,20 +3184,20 @@ static void test_get_class_devs(void)
     check_device_info(set, 3, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, 0);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &guid);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
     check_device_info(set, 2, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
@@ -3205,17 +3205,17 @@ static void test_get_class_devs(void)
     check_device_info(set, 3, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     /* test DIGCF_DEVICE_INTERFACE */
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, DIGCF_DEVICEINTERFACE);
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, FALSE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadbeef-3f65-11db-b704-0011955c2bdb}");
@@ -3224,19 +3224,19 @@ static void test_get_class_devs(void)
     check_device_iface(set, NULL, &iface_guid2, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadf00d-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid2, 1, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&iface_guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
@@ -3246,10 +3246,10 @@ static void test_get_class_devs(void)
     check_device_iface(set, NULL, &iface_guid, 2, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&iface_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, FALSE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadbeef-3f65-11db-b704-0011955c2bdb}");
@@ -3258,29 +3258,29 @@ static void test_get_class_devs(void)
     check_device_iface(set, NULL, &iface_guid2, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadf00d-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid2, 1, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, "ROOT", NULL, DIGCF_DEVICEINTERFACE);
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, "ROOT", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
 todo_wine {
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
 todo_wine {
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, NULL, NULL);
@@ -3289,33 +3289,33 @@ todo_wine {
     check_device_iface(set, NULL, &iface_guid2, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadf00d-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid2, 1, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS\\bar", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_DEVICEINTERFACE);
 todo_wine {
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     SetLastError(0xdeadbeef);
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
 todo_wine {
     ok(set == INVALID_HANDLE_VALUE, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_DATA, "Got unexpected error %#lx.\n", GetLastError());
 }
 
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, NULL, NULL);
@@ -3323,10 +3323,10 @@ todo_wine {
     check_device_iface(set, NULL, &iface_guid, 1, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
-    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#lx.\n", GetLastError());
     check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, NULL, NULL);
@@ -3335,7 +3335,7 @@ todo_wine {
     check_device_iface(set, NULL, &iface_guid2, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadf00d-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid2, 1, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
-    ok(ret, "Failed to destroy device list, error %#x.\n", GetLastError());
+    ok(ret, "Failed to destroy device list, error %#lx.\n", GetLastError());
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
     SetupDiEnumDeviceInfo(set, 0, &device);
diff --git a/dlls/setupapi/tests/dialog.c b/dlls/setupapi/tests/dialog.c
index b6191afa41d..33623b952e0 100644
--- a/dlls/setupapi/tests/dialog.c
+++ b/dlls/setupapi/tests/dialog.c
@@ -42,13 +42,13 @@ static void test_SetupPromptForDiskA(void)
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, "kernel32.dll", NULL, IDF_CHECKFIRST, buffer, sizeof(buffer) - 1, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
-    ok(length == strlen(path) + 1, "Expect length %u, got %u\n", lstrlenA(path) + 1, length);
+    ok(length == strlen(path) + 1, "Expect length %u, got %lu\n", lstrlenA(path) + 1, length);
     ok(!strcmp(path, buffer), "Expected path %s, got %s\n", debugstr_a(path), debugstr_a(buffer));
 
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, "kernel32.dll", NULL, IDF_CHECKFIRST, NULL, 0, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
-    ok(length == strlen(path) + 1, "Expect length %u, got %u\n", lstrlenA(path) + 1, length);
+    ok(length == strlen(path) + 1, "Expect length %u, got %lu\n", lstrlenA(path) + 1, length);
 
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, "kernel32.dll", NULL, IDF_CHECKFIRST, buffer, 1, &length);
@@ -61,7 +61,7 @@ static void test_SetupPromptForDiskA(void)
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskA(0, "Test", "Testdisk", path, "kernel32.dll", NULL, IDF_CHECKFIRST, buffer, strlen(path) + 1, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
-    ok(length == strlen(path) + 1, "Expect length %u, got %u\n", lstrlenA(path) + 1, length);
+    ok(length == strlen(path) + 1, "Expect length %u, got %lu\n", lstrlenA(path) + 1, length);
     ok(!strcmp(path, buffer), "Expected path %s, got %s\n", debugstr_a(path), debugstr_a(buffer));
 }
 
@@ -77,13 +77,13 @@ static void test_SetupPromptForDiskW(void)
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskW(0, L"Test", L"Testdisk", path, L"kernel32.dll", NULL, IDF_CHECKFIRST, buffer, ARRAY_SIZE(buffer) - 1, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
-    ok(length == lstrlenW(path) + 1, "Expect length %u, got %u\n", lstrlenW(path) + 1, length);
+    ok(length == lstrlenW(path) + 1, "Expect length %u, got %lu\n", lstrlenW(path) + 1, length);
     ok(!lstrcmpW(path, buffer), "Expected path %s, got %s\n", debugstr_w(path), debugstr_w(buffer));
 
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskW(0, L"Test", L"Testdisk", path, L"kernel32.dll", NULL, IDF_CHECKFIRST, NULL, 0, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %d\n", ret);
-    ok(length == lstrlenW(path) + 1, "Expect length %u, got %u\n", lstrlenW(path) + 1, length);
+    ok(length == lstrlenW(path) + 1, "Expect length %u, got %lu\n", lstrlenW(path) + 1, length);
 
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskW(0, L"Test", L"Testdisk", path, L"kernel32.dll", NULL, IDF_CHECKFIRST, buffer, 1, &length);
@@ -96,7 +96,7 @@ static void test_SetupPromptForDiskW(void)
     memset(buffer, 0, sizeof(buffer));
     ret = SetupPromptForDiskW(0, L"Test", L"Testdisk", path, L"kernel32.dll", NULL, IDF_CHECKFIRST, buffer, lstrlenW(path) + 1, &length);
     ok(ret == DPROMPT_SUCCESS, "Expected DPROMPT_SUCCESS, got %u\n", ret);
-    ok(length == lstrlenW(path) + 1, "Expect length %u, got %u\n", lstrlenW(path) + 1, length);
+    ok(length == lstrlenW(path) + 1, "Expect length %u, got %lu\n", lstrlenW(path) + 1, length);
     ok(!lstrcmpW(path, buffer), "Expected path %s, got %s\n", debugstr_w(path), debugstr_w(buffer));
 }
 
diff --git a/dlls/setupapi/tests/diskspace.c b/dlls/setupapi/tests/diskspace.c
index dab6705eee3..577b1f84a2a 100644
--- a/dlls/setupapi/tests/diskspace.c
+++ b/dlls/setupapi/tests/diskspace.c
@@ -52,7 +52,7 @@ static void test_SetupCreateDiskSpaceListA(void)
        "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
     if (!ret)
         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());
     else
         ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
@@ -63,7 +63,7 @@ static void test_SetupCreateDiskSpaceListA(void)
        "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -72,7 +72,7 @@ static void test_SetupCreateDiskSpaceListA(void)
        "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -81,7 +81,7 @@ static void test_SetupCreateDiskSpaceListA(void)
        "Expected SetupCreateDiskSpaceListA to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win9x/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 }
 
@@ -113,7 +113,7 @@ static void test_SetupCreateDiskSpaceListW(void)
        "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
     if (!ret)
         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());
     else
         ok(SetupDestroyDiskSpaceList(ret), "Expected SetupDestroyDiskSpaceList to succeed\n");
@@ -124,7 +124,7 @@ static void test_SetupCreateDiskSpaceListW(void)
        "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -133,7 +133,7 @@ static void test_SetupCreateDiskSpaceListW(void)
        "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -142,7 +142,7 @@ static void test_SetupCreateDiskSpaceListW(void)
        "Expected SetupCreateDiskSpaceListW to return NULL, got %p\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        broken(GetLastError() == 0xdeadbeef), /* NT4/Win2k */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 }
 
@@ -154,25 +154,25 @@ static void test_SetupDuplicateDiskSpaceListA(void)
     duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(NULL, (void *)0xdeadbeef, 0, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0xdeadbeef, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-      "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+      "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(NULL, NULL, 0, ~0U);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
     ok(handle != NULL,
@@ -188,25 +188,25 @@ static void test_SetupDuplicateDiskSpaceListA(void)
     duplicate = SetupDuplicateDiskSpaceListA(handle, (void *)0xdeadbeef, 0, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0xdeadbeef, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, SPDSL_IGNORE_DISK);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, ~0U);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     duplicate = SetupDuplicateDiskSpaceListA(handle, NULL, 0, 0);
     ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
@@ -230,25 +230,25 @@ static void test_SetupDuplicateDiskSpaceListW(void)
     }
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(NULL, (void *)0xdeadbeef, 0, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0xdeadbeef, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(NULL, NULL, 0, ~0U);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     handle = SetupCreateDiskSpaceListW(NULL, 0, 0);
     ok(handle != NULL,
@@ -264,25 +264,25 @@ static void test_SetupDuplicateDiskSpaceListW(void)
     duplicate = SetupDuplicateDiskSpaceListW(handle, (void *)0xdeadbeef, 0, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0xdeadbeef, 0);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, SPDSL_IGNORE_DISK);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, ~0U);
     ok(!duplicate, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n", GetLastError());
 
     duplicate = SetupDuplicateDiskSpaceListW(handle, NULL, 0, 0);
     ok(duplicate != NULL, "Expected SetupDuplicateDiskSpaceList to return NULL, got %p\n", duplicate);
@@ -303,7 +303,7 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ret = SetupQuerySpaceRequiredOnDriveA(NULL, NULL, NULL, NULL, 0);
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     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);
@@ -312,14 +312,14 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\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 = SetupQuerySpaceRequiredOnDriveA(NULL, "", NULL, NULL, 0);
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -328,7 +328,7 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
@@ -340,7 +340,7 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -350,14 +350,14 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_INVALID_DRIVE, /* Win9x */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupQuerySpaceRequiredOnDriveA(handle, "", NULL, NULL, 0);
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DRIVE,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -366,7 +366,7 @@ static void test_SetupQuerySpaceRequiredOnDriveA(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveA to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_DRIVE,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     ok(SetupDestroyDiskSpaceList(handle),
@@ -390,7 +390,7 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     }
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -399,14 +399,14 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupQuerySpaceRequiredOnDriveW(NULL, emptyW, NULL, NULL, 0);
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -415,7 +415,7 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_HANDLE,
-       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_HANDLE, got %lu\n",
        GetLastError());
 
     handle = SetupCreateDiskSpaceListA(NULL, 0, 0);
@@ -427,7 +427,7 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -437,14 +437,14 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_INVALID_DRIVE, /* NT4/Win2k/XP/Win2k3 */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupQuerySpaceRequiredOnDriveW(handle, emptyW, NULL, NULL, 0);
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DRIVE,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -453,7 +453,7 @@ static void test_SetupQuerySpaceRequiredOnDriveW(void)
     ok(!ret, "Expected SetupQuerySpaceRequiredOnDriveW to return FALSE, got %d\n", ret);
     ok(space == 0xdeadbeef, "Expected output space parameter to be untouched\n");
     ok(GetLastError() == ERROR_INVALID_DRIVE,
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     ok(SetupDestroyDiskSpaceList(handle),
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 6c41c72453e..f53740a8824 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -62,7 +62,7 @@ static void load_resource(const char *name, const char *filename)
     void *ptr;
 
     file = CreateFileA(filename, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
-    ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", filename, GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %ld\n", filename, GetLastError());
 
     res = FindResourceA(NULL, name, "TESTDLL");
     ok( res != 0, "couldn't find resource\n" );
@@ -78,9 +78,9 @@ static void create_inf_file(LPCSTR filename, const char *data)
     BOOL ret;
     HANDLE handle = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
                            CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-    ok(handle != INVALID_HANDLE_VALUE, "Failed to create %s, error %u.\n", filename, GetLastError());
+    ok(handle != INVALID_HANDLE_VALUE, "Failed to create %s, error %lu.\n", filename, GetLastError());
     ret = WriteFile(handle, data, strlen(data), &res, NULL);
-    ok(ret, "Failed to write file, error %u.\n", GetLastError());
+    ok(ret, "Failed to write file, error %lu.\n", GetLastError());
     CloseHandle(handle);
 }
 
@@ -292,7 +292,7 @@ static void create_cab_file(const CHAR *name, const CHAR *files)
         res = add_file(hfci, ptr, tcompTYPE_MSZIP);
         ok(res, "Failed to add file: %s\n", ptr);
         res = DeleteFileA(ptr);
-        ok(res, "Failed to delete file %s, error %u\n", ptr, GetLastError());
+        ok(res, "Failed to delete file %s, error %lu\n", ptr, GetLastError());
         ptr += lstrlenA(ptr) + 1;
     }
 
@@ -339,7 +339,7 @@ static void ok_registry(BOOL expectsuccess)
     ret = RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
     ok((expectsuccess && ret == ERROR_SUCCESS) ||
        (!expectsuccess && ret == ERROR_FILE_NOT_FOUND),
-       "Expected registry key Software\\Wine\\setupapitest to %s, RegDeleteKey returned %d\n",
+       "Expected registry key Software\\Wine\\setupapitest to %s, RegDeleteKey returned %ld\n",
        expectsuccess ? "exist" : "not exist",
        ret);
 }
@@ -356,7 +356,7 @@ static void test_cmdline(void)
     run_cmdline("DefaultInstall", 128, path);
     ok_registry(TRUE);
     ret = DeleteFileA(inffile);
-    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
+    ok(ret, "Expected source inf to exist, last error was %ld\n", GetLastError());
 
     /* Test handling of spaces in path, unquoted and quoted */
     create_inf_file(infwithspaces, cmdline_inf);
@@ -370,7 +370,7 @@ static void test_cmdline(void)
     ok_registry(FALSE);
 
     ret = DeleteFileA(infwithspaces);
-    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
+    ok(ret, "Expected source inf to exist, last error was %ld\n", GetLastError());
 }
 
 static const char *cmdline_inf_reg = "[Version]\n"
@@ -409,7 +409,7 @@ static void test_registry(void)
         RegDeleteKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest");
     }
     ret = DeleteFileA(inffile);
-    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
+    ok(ret, "Expected source inf to exist, last error was %ld\n", GetLastError());
 }
 
 static void test_install_from(void)
@@ -435,7 +435,7 @@ static void test_install_from(void)
     ret = SetupInstallFromInfSectionA(NULL, infhandle, "DefaultInstall", SPINST_REGISTRY, key,
         "A:\\", 0, NULL, NULL, NULL, NULL);
     ok(ret, "Unexpected failure\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     /* Check if the registry key is recursively deleted */
     res = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest", &key);
@@ -470,7 +470,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
-        "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_SECTION_NOT_FOUND, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -482,7 +482,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
-        "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_SECTION_NOT_FOUND, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -494,7 +494,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
-        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
+        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -506,7 +506,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
-        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
+        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -518,7 +518,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
-        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
+        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -530,7 +530,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
-        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
+        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -542,7 +542,7 @@ static void test_install_svc_from(void)
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(!ret, "Expected failure\n");
     ok(GetLastError() == ERROR_BAD_SERVICE_INSTALLSECT,
-        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08x\n", GetLastError());
+        "Expected ERROR_BAD_SERVICE_INSTALLSECT, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -561,7 +561,7 @@ static void test_install_svc_from(void)
     }
     ok(ret, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -573,7 +573,7 @@ static void test_install_svc_from(void)
 
     SetLastError(0xdeadbeef);
     ret = DeleteService(svc_handle);
-    ok(ret, "Service could not be deleted : %d\n", GetLastError());
+    ok(ret, "Service could not be deleted : %ld\n", GetLastError());
 
     CloseServiceHandle(svc_handle);
     CloseServiceHandle(scm_handle);
@@ -588,7 +588,7 @@ static void test_install_svc_from(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallServicesFromInfSectionA(infhandle, "XSP.InstallPerVer", 0);
     ok(ret, "Expected success\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -602,7 +602,7 @@ static void test_install_svc_from(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallServicesFromInfSectionA(infhandle, "Winetest.Services", 0);
     ok(ret, "Expected success\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
     SetupCloseInfFile(infhandle);
     DeleteFileA(inffile);
 
@@ -664,11 +664,11 @@ static void test_service_install(const char *executable, const char *argument)
     lstrcatA(driver, "\\system32\\drivers\\winetest.sys");
 
     ret = CopyFileA(executable, "winetest.sys", TRUE);
-    ok(ret, "CopyFileA failed, error %u\n", GetLastError());
+    ok(ret, "CopyFileA failed, error %lu\n", GetLastError());
 
     for (i = 0; i < ARRAY_SIZE(tests); ++i)
     {
-        winetest_push_context("%u", i);
+        winetest_push_context("%lu", i);
 
         sprintf(buffer, inf, tests[i].add_service_flags, argument, tests[i].service_type, tests[i].start_type);
         create_inf_file(inffile, buffer);
@@ -687,20 +687,20 @@ static void test_service_install(const char *executable, const char *argument)
 
         ret = StartServiceA(svc_handle, 0, NULL);
         if (!tests[i].expect_start_error)
-            ok(ret, "StartServiceA failed, error %u\n", GetLastError());
+            ok(ret, "StartServiceA failed, error %lu\n", GetLastError());
         else
         {
             ok(!ret, "StartServiceA succeeded\n");
-            ok(GetLastError() == tests[i].expect_start_error, "got error %u\n", GetLastError());
+            ok(GetLastError() == tests[i].expect_start_error, "got error %lu\n", GetLastError());
         }
 
         ret = QueryServiceStatus(svc_handle, &status);
-        ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+        ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
         while (status.dwCurrentState == SERVICE_START_PENDING)
         {
             Sleep(100);
             ret = QueryServiceStatus(svc_handle, &status);
-            ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+            ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
         }
 
         ret = ControlService(svc_handle, SERVICE_CONTROL_STOP, &status);
@@ -708,13 +708,13 @@ static void test_service_install(const char *executable, const char *argument)
         {
             Sleep(100);
             ret = QueryServiceStatus(svc_handle, &status);
-            ok(ret, "QueryServiceStatus failed: %u\n", GetLastError());
+            ok(ret, "QueryServiceStatus failed: %lu\n", GetLastError());
         }
-        ok(status.dwCurrentState == SERVICE_STOPPED, "expected SERVICE_STOPPED, got %d\n", status.dwCurrentState);
+        ok(status.dwCurrentState == SERVICE_STOPPED, "expected SERVICE_STOPPED, got %ld\n", status.dwCurrentState);
 
         SetLastError(0xdeadbeef);
         ret = DeleteService(svc_handle);
-        ok(ret, "Service could not be deleted : %d\n", GetLastError());
+        ok(ret, "Service could not be deleted : %ld\n", GetLastError());
 
         CloseServiceHandle(svc_handle);
         CloseServiceHandle(scm_handle);
@@ -807,17 +807,17 @@ static void test_inffilelistA(void)
      */
     if (!GetTempFileNameA(CURR_DIR, "inftest", 1, dir))
     {
-        win_skip("GetTempFileNameA failed with error %d\n", GetLastError());
+        win_skip("GetTempFileNameA failed with error %ld\n", GetLastError());
         return;
     }
     if (!CreateDirectoryA(dir, NULL ))
     {
-        win_skip("CreateDirectoryA(%s) failed with error %d\n", dir, GetLastError());
+        win_skip("CreateDirectoryA(%s) failed with error %ld\n", dir, GetLastError());
         return;
     }
     if (!SetCurrentDirectoryA(dir))
     {
-        win_skip("SetCurrentDirectoryA failed with error %d\n", GetLastError());
+        win_skip("SetCurrentDirectoryA failed with error %ld\n", GetLastError());
         RemoveDirectoryA(dir);
         return;
     }
@@ -831,7 +831,7 @@ static void test_inffilelistA(void)
     ret = SetupGetInfFileListA(dir, INF_STYLE_OLDNT | INF_STYLE_WIN4, buffer,
                                MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListA to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenA(p) && (outsize > (p - buffer)); p+=lstrlenA(p) + 1)
         ok(!lstrcmpA(p,inffile2) || !lstrcmpA(p,inffile),
@@ -872,7 +872,7 @@ static void test_inffilelist(void)
     expected = 0;
     SetLastError(0xdeadbeef);
     ret = SetupGetInfFileListW(NULL, INF_STYLE_WIN4, NULL, 0, &expected);
-    ok(ret, "expected SetupGetInfFileListW to succeed! Error: %d\n", GetLastError());
+    ok(ret, "expected SetupGetInfFileListW to succeed! Error: %ld\n", GetLastError());
     ok(expected > 0, "expected required buffersize to be at least 1\n");
 
     /* check if an empty string doesn't behaves like NULL */
@@ -886,17 +886,17 @@ static void test_inffilelist(void)
      */
     if (!GetTempFileNameA(CURR_DIR, "inftest", 1, dirA))
     {
-        win_skip("GetTempFileNameA failed with error %d\n", GetLastError());
+        win_skip("GetTempFileNameA failed with error %ld\n", GetLastError());
         return;
     }
     if (!CreateDirectoryA(dirA, NULL ))
     {
-        win_skip("CreateDirectoryA(%s) failed with error %d\n", dirA, GetLastError());
+        win_skip("CreateDirectoryA(%s) failed with error %ld\n", dirA, GetLastError());
         return;
     }
     if (!SetCurrentDirectoryA(dirA))
     {
-        win_skip("SetCurrentDirectoryA failed with error %d\n", GetLastError());
+        win_skip("SetCurrentDirectoryA failed with error %ld\n", GetLastError());
         RemoveDirectoryA(dirA);
         return;
     }
@@ -910,9 +910,9 @@ static void test_inffilelist(void)
     SetLastError(0xdeadbeef);
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, NULL, 0, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(outsize == 1, "expected required buffersize to be 1, got %d\n", outsize);
+    ok(outsize == 1, "expected required buffersize to be 1, got %ld\n", outsize);
     ok(ERROR_PATH_NOT_FOUND == GetLastError(),
-       "expected error ERROR_PATH_NOT_FOUND, got %d\n", GetLastError());
+       "expected error ERROR_PATH_NOT_FOUND, got %ld\n", GetLastError());
     
     create_inf_file(inffile, inf);
     create_inf_file(inffile2, inf);
@@ -927,7 +927,7 @@ static void test_inffilelist(void)
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, NULL, 0, &outsize);
     ok(!ret, "expected SetupGetInfFileListW to fail!\n");
     ok(ERROR_DIRECTORY == GetLastError(),
-       "expected error ERROR_DIRECTORY, got %d\n", GetLastError());
+       "expected error ERROR_DIRECTORY, got %ld\n", GetLastError());
 
     /* make the filename look like directory
      */
@@ -937,7 +937,7 @@ static void test_inffilelist(void)
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, NULL, 0, &outsize);
     ok(!ret, "expected SetupGetInfFileListW to fail!\n");
     ok(ERROR_DIRECTORY == GetLastError(),
-       "expected error ERROR_DIRECTORY, got %d\n", GetLastError());
+       "expected error ERROR_DIRECTORY, got %ld\n", GetLastError());
 
     /* now check the buffer contents of a valid call
      */
@@ -945,7 +945,7 @@ static void test_inffilelist(void)
     expected = 3 + strlen(inffile) + strlen(inffile2);
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, buffer, MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenW(p) && (outsize > (p - buffer)); p+=lstrlenW(p) + 1)
         ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW),
@@ -956,7 +956,7 @@ static void test_inffilelist(void)
     create_inf_file(inffile2, inf2);
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, buffer, MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenW(p) && (outsize > (p - buffer)); p+=lstrlenW(p) + 1)
         ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW),
@@ -968,7 +968,7 @@ static void test_inffilelist(void)
     expected = 3 + strlen(inffile) + strlen(inffile2);
     ret = SetupGetInfFileListW(dir, INF_STYLE_WIN4, buffer, MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenW(p) && (outsize > (p - buffer)); p+=lstrlenW(p) + 1)
         ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW),
@@ -979,7 +979,7 @@ static void test_inffilelist(void)
     expected = 2 + strlen(invalid_inf);
     ret = SetupGetInfFileListW(dir, INF_STYLE_OLDNT, buffer, MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenW(p) && (outsize > (p - buffer)); p+=lstrlenW(p) + 1)
         ok(!lstrcmpW(p,invalid_infW), "unexpected filename %s\n",wine_dbgstr_w(p));
@@ -990,7 +990,7 @@ static void test_inffilelist(void)
     ret = SetupGetInfFileListW(dir, INF_STYLE_OLDNT | INF_STYLE_WIN4, buffer,
                                MAX_PATH, &outsize);
     ok(ret, "expected SetupGetInfFileListW to succeed!\n");
-    ok(expected == outsize, "expected required buffersize to be %d, got %d\n",
+    ok(expected == outsize, "expected required buffersize to be %ld, got %ld\n",
          expected, outsize);
     for(p = buffer; lstrlenW(p) && (outsize > (p - buffer)); p+=lstrlenW(p) + 1)
         ok(!lstrcmpW(p,inffile2W) || !lstrcmpW(p,inffileW) || !lstrcmpW(p,invalid_infW),
@@ -1036,12 +1036,12 @@ static void check_dirid(int dirid, LPCSTR expected)
             ret = ERROR_FILE_NOT_FOUND;
     }
 
-    ok(ret == ERROR_SUCCESS, "Failed getting value for dirid %i, err=%d\n", dirid, ret);
+    ok(ret == ERROR_SUCCESS, "Failed getting value for dirid %i, err=%ld\n", dirid, ret);
     ok(!strcmp(actual, expected), "Expected path for dirid %i was \"%s\", got \"%s\"\n", dirid, expected, actual);
 
     ok_registry(TRUE);
     ret = DeleteFileA(inffile);
-    ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError());
+    ok(ret, "Expected source inf to exist, last error was %ld\n", GetLastError());
 }
 
 /* Test dirid values */
@@ -1118,21 +1118,21 @@ static void test_install_files_queue(void)
 
     sprintf(path, "%s\\%s", CURR_DIR, inffile);
     hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
 
     ret = CreateDirectoryA("src", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/alpha", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/alpha/beta", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/beta", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = SetupSetDirectoryIdA(hinf, 40000, CURR_DIR);
-    ok(ret, "Failed to set directory ID, error %u.\n", GetLastError());
+    ok(ret, "Failed to set directory ID, error %lu.\n", GetLastError());
 
     ret = CreateDirectoryA("dst", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
 
     create_file("src/one.txt");
     create_file("src/beta/two.txt");
@@ -1144,19 +1144,19 @@ static void test_install_files_queue(void)
     create_file("dst/ten.txt");
 
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
 
     context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
-    ok(!!context, "Failed to create callback context, error %#x.\n", GetLastError());
+    ok(!!context, "Failed to create callback context, error %#lx.\n", GetLastError());
 
     ret = SetupInstallFilesFromInfSectionA(hinf, NULL, queue, "DefaultInstall", "src", 0);
-    ok(ret, "Failed to install files, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install files, error %#lx.\n", GetLastError());
 
     ok(file_exists("src/one.txt"), "Source file should exist.\n");
     ok(!file_exists("dst/one.txt"), "Destination file should not exist.\n");
 
     ret = SetupCommitFileQueueA(NULL, queue, SetupDefaultQueueCallbackA, context);
-    ok(ret, "Failed to commit queue, error %#x.\n", GetLastError());
+    ok(ret, "Failed to commit queue, error %#lx.\n", GetLastError());
 
     ok(file_exists("src/one.txt"), "Source file should exist.\n");
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1173,7 +1173,7 @@ static void test_install_files_queue(void)
 
     SetupTermDefaultQueueCallback(context);
     ret = SetupCloseFileQueue(queue);
-    ok(ret, "Failed to close queue, error %#x.\n", GetLastError());
+    ok(ret, "Failed to close queue, error %#lx.\n", GetLastError());
 
     SetupCloseInfFile(hinf);
     delete_file("src/one.txt");
@@ -1188,7 +1188,7 @@ static void test_install_files_queue(void)
     delete_file("src/");
     delete_file("dst/");
     ret = DeleteFileA(inffile);
-    ok(ret, "Failed to delete INF file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete INF file, error %lu.\n", GetLastError());
 }
 
 static unsigned int got_need_media, got_copy_error, got_start_copy;
@@ -1196,7 +1196,7 @@ static unsigned int testmode;
 
 static UINT WINAPI need_media_cb(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
 {
-    if (winetest_debug > 1) trace("%p, %#x, %#lx, %#lx\n", context, message, param1, param2);
+    if (winetest_debug > 1) trace("%p, %#x, %#Ix, %#Ix\n", context, message, param1, param2);
 
     if (message == SPFILENOTIFY_NEEDMEDIA)
     {
@@ -1213,9 +1213,9 @@ static UINT WINAPI need_media_cb(void *context, UINT message, UINT_PTR param1, U
         path[0] = 0;
 
         if (testmode == 0)
-            ok(media->Flags == SP_COPY_WARNIFSKIP, "Got Flags %#x.\n", media->Flags);
+            ok(media->Flags == SP_COPY_WARNIFSKIP, "Got Flags %#lx.\n", media->Flags);
         else
-            ok(!media->Flags, "Got Flags %#x for test %u.\n", media->Flags, testmode);
+            ok(!media->Flags, "Got Flags %#lx for test %u.\n", media->Flags, testmode);
 
         switch (testmode)
         {
@@ -1331,7 +1331,7 @@ static UINT WINAPI need_media_cb(void *context, UINT message, UINT_PTR param1, U
 
 static UINT WINAPI need_media_newpath_cb(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
 {
-    if (winetest_debug > 1) trace("%p, %#x, %#lx, %#lx\n", context, message, param1, param2);
+    if (winetest_debug > 1) trace("%p, %#x, %#Ix, %#Ix\n", context, message, param1, param2);
 
     if (message == SPFILENOTIFY_NEEDMEDIA)
     {
@@ -1413,12 +1413,12 @@ static void run_queue_(unsigned int line, HSPFILEQ queue, PSP_FILE_CALLBACK_A cb
 {
     void *context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
     BOOL ret;
-    ok_(__FILE__,line)(!!context, "Failed to create callback context, error %#x.\n", GetLastError());
+    ok_(__FILE__,line)(!!context, "Failed to create callback context, error %#lx.\n", GetLastError());
     ret = SetupCommitFileQueueA(NULL, queue, cb, context);
-    ok_(__FILE__,line)(ret, "Failed to commit queue, error %#x.\n", GetLastError());
+    ok_(__FILE__,line)(ret, "Failed to commit queue, error %#lx.\n", GetLastError());
     SetupTermDefaultQueueCallback(context);
     ret = SetupCloseFileQueue(queue);
-    ok_(__FILE__,line)(ret, "Failed to close queue, error %#x.\n", GetLastError());
+    ok_(__FILE__,line)(ret, "Failed to close queue, error %#lx.\n", GetLastError());
 }
 
 static void test_install_file(void)
@@ -1448,16 +1448,16 @@ static void test_install_file(void)
 
     sprintf(path, "%s\\%s", CURR_DIR, inffile);
     hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
 
     ret = CreateDirectoryA("src", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/alpha", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/beta", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("dst", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     create_file("src/one.txt");
     create_file("src/beta/two.txt");
     create_file("src/alpha/three.txt");
@@ -1467,13 +1467,13 @@ static void test_install_file(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "one.txt", "src", "one.txt", 0, NULL, NULL);
     ok(ret, "Expected success.\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#lx.\n", GetLastError());
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "one.txt", "src", "one.txt", SP_COPY_REPLACEONLY, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#lx.\n", GetLastError());
     ok(!file_exists("dst/one.txt"), "Destination file should not exist.\n");
 
     ret = SetupFindFirstLineA(hinf, "section1", "two.txt", &infctx);
@@ -1481,7 +1481,7 @@ static void test_install_file(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "two.txt", "src", "two.txt", 0, NULL, NULL);
     todo_wine ok(ret, "Expected success.\n");
-    todo_wine ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
+    todo_wine ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#lx.\n", GetLastError());
     todo_wine ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
 
     ret = SetupFindFirstLineA(hinf, "section1", "three.txt", &infctx);
@@ -1489,7 +1489,7 @@ static void test_install_file(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "three.txt", "src", "three.txt", 0, NULL, NULL);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Got unexpected error %#lx.\n", GetLastError());
     ok(!file_exists("dst/three.txt"), "Destination file should not exist.\n");
 
     ret = SetupFindFirstLineA(hinf, "section1", "three.txt", &infctx);
@@ -1497,7 +1497,7 @@ static void test_install_file(void)
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "three.txt", "src/alpha", "three.txt", 0, NULL, NULL);
     ok(ret, "Expected success.\n");
-    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#lx.\n", GetLastError());
     ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
 
     SetupCloseInfFile(hinf);
@@ -1547,16 +1547,16 @@ static void test_need_media(void)
 
     sprintf(path, "%s\\%s", CURR_DIR, inffile);
     hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
 
     ret = CreateDirectoryA("src", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/alpha", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("src/beta", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("dst", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     create_file("src/one.txt");
     create_file("src/beta/two.txt");
     create_file("src/alpha/three.txt");
@@ -1565,19 +1565,19 @@ static void test_need_media(void)
     create_cab_file("src/alpha/tessares.cab", "seven.txt\0eight.txt\0");
 
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", "File One", NULL, "dst", NULL, SP_COPY_WARNIFSKIP);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
 
     got_need_media = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", "File One", NULL,
             "dst", NULL, SP_COPY_WARNIFSKIP | SP_COPY_REPLACEONLY);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!file_exists("dst/one.txt"), "Destination file should exist.\n");
@@ -1587,9 +1587,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 1;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
@@ -1599,9 +1599,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 2;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", "desc", "faketag", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
@@ -1611,32 +1611,32 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 3;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section1", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
 
     got_need_media = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupInstallFilesFromInfSectionA(hinf, NULL, queue, "install_section", "src", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
 
     got_need_media = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
 
     ret = SetupQueueDefaultCopyA(queue, hinf, "src", NULL, "one.txt", 0);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got error %#x.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got error %#lx.\n", GetLastError());
 
     ret = SetupQueueDefaultCopyA(queue, hinf, "src", "one.txt", "one.txt", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1644,18 +1644,18 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 4;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section2", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
 
     got_need_media = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueDefaultCopyA(queue, hinf, "src", "two.txt", "two.txt", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
@@ -1663,18 +1663,18 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 5;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section3", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
 
     got_need_media = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueDefaultCopyA(queue, hinf, "src", "three.txt", "three.txt", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
@@ -1684,13 +1684,13 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 6;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src/alpha", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1704,9 +1704,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 8;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section4", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());\
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());\
     run_queue(queue, need_media_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1718,11 +1718,11 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 10;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", "desc1", NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1731,11 +1731,11 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 12;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", "desc1", "faketag", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", "desc1", "faketag2", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -1746,11 +1746,11 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 14;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "four.txt", "desc", "treis.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "alpha", "five.txt", "desc", "treis.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/four.txt"), "Destination file should exist.\n");
@@ -1759,11 +1759,11 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 15;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "alpha", "seven.txt", "desc", "tessares.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "eight.txt", "desc", "tessares.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/seven.txt"), "Destination file should exist.\n");
@@ -1772,9 +1772,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 16;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueDefaultCopyA(queue, hinf, "src/alpha", "six.txt", "six.txt", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/six.txt"), "Destination file should exist.\n");
@@ -1784,9 +1784,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 1;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", NULL, NULL, "dst", NULL, SP_COPY_SOURCE_ABSOLUTE);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
@@ -1794,9 +1794,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 1;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", "beta", "two.txt", NULL, NULL, "dst", NULL, SP_COPY_SOURCEPATH_ABSOLUTE);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/two.txt"), "Destination file should exist.\n");
@@ -1804,9 +1804,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 5;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section3", SP_COPY_SOURCE_ABSOLUTE);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
@@ -1814,9 +1814,9 @@ static void test_need_media(void)
     got_need_media = 0;
     testmode = 5;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopySectionA(queue, "src", hinf, NULL, "section3", SP_COPY_SOURCEPATH_ABSOLUTE);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
@@ -1826,11 +1826,11 @@ static void test_need_media(void)
     testmode = 0;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha", "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1846,11 +1846,11 @@ static void test_need_media(void)
     testmode = 1;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha", "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "beta", "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1859,11 +1859,11 @@ static void test_need_media(void)
 
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha\\", "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "six.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1876,11 +1876,11 @@ static void test_need_media(void)
     testmode = 2;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha", "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1892,11 +1892,11 @@ static void test_need_media(void)
     testmode = 0;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "fake.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(got_copy_error == 1, "Got %u copy errors.\n", got_copy_error);
@@ -1907,13 +1907,13 @@ static void test_need_media(void)
     testmode = 3;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "six.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(got_copy_error == 1, "Got %u copy errors.\n", got_copy_error);
@@ -1926,13 +1926,13 @@ static void test_need_media(void)
     testmode = 4;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "six.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(got_copy_error == 2, "Got %u copy errors.\n", got_copy_error);
@@ -1945,11 +1945,11 @@ static void test_need_media(void)
     testmode = 0;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "four.txt", "desc", "treis.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha", "five.txt", "desc", "treis.cab", "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1961,11 +1961,11 @@ static void test_need_media(void)
     testmode = 5;
     got_need_media = got_copy_error = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "fake", "alpha", "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 2, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1975,7 +1975,7 @@ static void test_need_media(void)
     testmode = 6;
     got_need_media = got_copy_error = got_start_copy = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     copy_params.QueueHandle = queue;
     copy_params.SourceFilename = "one.txt";
     /* Leaving TargetDirectory NULL causes it to be filled with garbage on
@@ -1983,7 +1983,7 @@ static void test_need_media(void)
      * from LayoutInf. */
     copy_params.TargetDirectory = "dst";
     ret = SetupQueueCopyIndirectA(&copy_params);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, need_media_newpath_cb);
     ok(got_need_media == 1, "Got %u callbacks.\n", got_need_media);
     ok(!got_copy_error, "Got %u copy errors.\n", got_copy_error);
@@ -1992,7 +1992,7 @@ static void test_need_media(void)
 
     got_need_media = got_copy_error = got_start_copy = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     copy_params.LayoutInf = hinf;
     copy_params.QueueHandle = queue;
     /* In fact this fails with ERROR_INVALID_PARAMETER on 8+. */
@@ -2019,7 +2019,7 @@ static void test_need_media(void)
     delete_file("src/");
     delete_file("dst/");
     ret = DeleteFileA(inffile);
-    ok(ret, "Failed to delete INF file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete INF file, error %lu.\n", GetLastError());
 }
 
 static void test_close_queue(void)
@@ -2028,11 +2028,11 @@ static void test_close_queue(void)
     BOOL ret;
 
     context = SetupInitDefaultQueueCallback(NULL);
-    ok(!!context, "Failed to create callback context, error %#x.\n", GetLastError());
+    ok(!!context, "Failed to create callback context, error %#lx.\n", GetLastError());
 
     ret = SetupCloseFileQueue(context);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %u.\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %lu.\n", GetLastError());
 
     SetupTermDefaultQueueCallback(context);
 }
@@ -2041,7 +2041,7 @@ static unsigned int start_copy_ret;
 
 static UINT WINAPI start_copy_cb(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
 {
-    if (winetest_debug > 1) trace("%p, %#x, %#lx, %#lx\n", context, message, param1, param2);
+    if (winetest_debug > 1) trace("%p, %#x, %#Ix, %#Ix\n", context, message, param1, param2);
 
     if (message == SPFILENOTIFY_STARTCOPY)
     {
@@ -2066,7 +2066,7 @@ static void test_start_copy(void)
     BOOL ret;
 
     ret = CreateDirectoryA("src", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     create_file("src/one.txt");
     create_file("src/two.txt");
     create_file("src/three.txt");
@@ -2074,15 +2074,15 @@ static void test_start_copy(void)
     start_copy_ret = FILEOP_DOIT;
     got_start_copy = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, start_copy_cb);
     todo_wine ok(got_start_copy == 3, "Got %u callbacks.\n", got_start_copy);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -2092,13 +2092,13 @@ static void test_start_copy(void)
     start_copy_ret = FILEOP_SKIP;
     got_start_copy = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     run_queue(queue, start_copy_cb);
     ok(got_start_copy == 3, "Got %u callbacks.\n", got_start_copy);
     ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
@@ -2108,18 +2108,18 @@ static void test_start_copy(void)
     start_copy_ret = FILEOP_ABORT;
     got_start_copy = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "one.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "two.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "src", NULL, "three.txt", NULL, NULL, "dst", NULL, 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
     SetLastError(0xdeadbeef);
     ret = SetupCommitFileQueueA(NULL, queue, start_copy_cb, context);
     ok(!ret, "Expected failure.\n");
-    ok(GetLastError() == 0xdeadf00d, "Got unexpected error %u.\n", GetLastError());
+    ok(GetLastError() == 0xdeadf00d, "Got unexpected error %lu.\n", GetLastError());
     SetupTermDefaultQueueCallback(context);
     SetupCloseFileQueue(queue);
     ok(got_start_copy == 2, "Got %u callbacks.\n", got_start_copy);
@@ -2155,54 +2155,54 @@ static void test_register_dlls(void)
     create_inf_file("test.inf", inf_data);
     sprintf(path, "%s\\test.inf", CURR_DIR);
     hinf = SetupOpenInfFileA(path, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+    ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#lx.\n", GetLastError());
 
     load_resource("selfreg.dll", "winetest_selfreg.dll");
     ret = SetupSetDirectoryIdA(hinf, 40000, CURR_DIR);
-    ok(ret, "Failed to set directory ID, error %u.\n", GetLastError());
+    ok(ret, "Failed to set directory ID, error %lu.\n", GetLastError());
 
     RegDeleteKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg");
 
     ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGSVR,
             NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
-    ok(ret, "Failed to install, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install, error %#lx.\n", GetLastError());
 
     l = RegOpenKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg", &key);
-    ok(!l, "Got error %u.\n", l);
+    ok(!l, "Got error %lu.\n", l);
     RegCloseKey(key);
 
     ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_UNREGSVR,
             NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
-    ok(ret, "Failed to install, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install, error %#lx.\n", GetLastError());
 
     l = RegOpenKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg", &key);
-    ok(l == ERROR_FILE_NOT_FOUND, "Got error %u.\n", l);
+    ok(l == ERROR_FILE_NOT_FOUND, "Got error %lu.\n", l);
 
     hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
-    ok(hr == S_OK, "Got hr %#x.\n", hr);
+    ok(hr == S_OK, "Got hr %#lx.\n", hr);
 
     ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_REGSVR,
             NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
-    ok(ret, "Failed to install, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install, error %#lx.\n", GetLastError());
 
     l = RegOpenKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg", &key);
-    ok(!l, "Got error %u.\n", l);
+    ok(!l, "Got error %lu.\n", l);
     RegCloseKey(key);
 
     ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_UNREGSVR,
             NULL, "C:\\", 0, SetupDefaultQueueCallbackA, context, NULL, NULL);
-    ok(ret, "Failed to install, error %#x.\n", GetLastError());
+    ok(ret, "Failed to install, error %#lx.\n", GetLastError());
 
     l = RegOpenKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg", &key);
-    ok(l == ERROR_FILE_NOT_FOUND, "Got error %u.\n", l);
+    ok(l == ERROR_FILE_NOT_FOUND, "Got error %lu.\n", l);
 
     CoUninitialize();
 
     SetupCloseInfFile(hinf);
     ret = DeleteFileA("test.inf");
-    ok(ret, "Failed to delete INF file, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete INF file, error %lu.\n", GetLastError());
     ret = DeleteFileA("winetest_selfreg.dll");
-    ok(ret, "Failed to delete test DLL, error %u.\n", GetLastError());
+    ok(ret, "Failed to delete test DLL, error %lu.\n", GetLastError());
 }
 
 static unsigned int start_rename_ret, got_start_rename;
@@ -2233,9 +2233,9 @@ static void test_rename(void)
     BOOL ret;
 
     ret = CreateDirectoryA("a", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
     ret = CreateDirectoryA("b", NULL);
-    ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+    ok(ret, "Failed to create test directory, error %lu.\n", GetLastError());
 
     create_file("a/one.txt");
     create_file("b/three.txt");
@@ -2244,17 +2244,17 @@ static void test_rename(void)
     start_rename_ret = FILEOP_DOIT;
     got_start_rename = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueCopyA(queue, "b", NULL, "one.txt", NULL, NULL, "b", "two.txt", 0);
-    ok(ret, "Failed to queue copy, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue copy, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "a", "one.txt", "b", "one.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "b", "three.txt", NULL, "four.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "b", "six.txt", "b", "seven.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "a", "five.txt", "b", "six.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     run_queue(queue, start_rename_cb);
     ok(got_start_rename == 4, "Got %u callbacks.\n", got_start_rename);
     ok(!delete_file("a/one.txt"), "File should not exist.\n");
@@ -2274,13 +2274,13 @@ static void test_rename(void)
     start_rename_ret = FILEOP_SKIP;
     got_start_rename = 0;
     queue = SetupOpenFileQueue();
-    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+    ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "a", "one.txt", "a", "two.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "a", "three.txt", "a", "four.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     ret = SetupQueueRenameA(queue, "a", "five.txt", "a", "six.txt");
-    ok(ret, "Failed to queue rename, error %#x.\n", GetLastError());
+    ok(ret, "Failed to queue rename, error %#lx.\n", GetLastError());
     run_queue(queue, start_rename_cb);
     ok(got_start_rename == 3, "Got %u callbacks.\n", got_start_rename);
     ok(!delete_file("a/one.txt"), "File should not exist.\n");
@@ -2291,8 +2291,8 @@ static void test_rename(void)
     ok(delete_file("a/six.txt"), "File should exist.\n");
     SetupCloseFileQueue(queue);
 
-    ok(delete_file("a/"), "Failed to delete directory, error %u.\n", GetLastError());
-    ok(delete_file("b/"), "Failed to delete directory, error %u.\n", GetLastError());
+    ok(delete_file("a/"), "Failed to delete directory, error %lu.\n", GetLastError());
+    ok(delete_file("b/"), "Failed to delete directory, error %lu.\n", GetLastError());
 }
 
 static WCHAR service_name[] = L"Wine Test Service";
@@ -2321,7 +2321,7 @@ static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, LPVOID event_
         SetEvent( stop_event );
         return NO_ERROR;
     default:
-        trace( "got service ctrl %x\n", ctrl );
+        trace( "got service ctrl %lx\n", ctrl );
         status.dwCurrentState = SERVICE_RUNNING;
         SetServiceStatus( service_handle, &status );
         return NO_ERROR;
@@ -2389,7 +2389,7 @@ START_TEST(install)
 
     /* Set CBT hook to disallow MessageBox creation in current thread */
     hhook = SetWindowsHookExA(WH_CBT, cbt_hook_proc, 0, GetCurrentThreadId());
-    ok(!!hhook, "Failed to set hook, error %u.\n", GetLastError());
+    ok(!!hhook, "Failed to set hook, error %lu.\n", GetLastError());
 
     test_cmdline();
     test_registry();
diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c
index 10ea7c0cba8..769bcbcb5ca 100644
--- a/dlls/setupapi/tests/misc.c
+++ b/dlls/setupapi/tests/misc.c
@@ -57,9 +57,9 @@ static void create_file(const char *name, const char *data)
     BOOL ret;
 
     file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
-    ok(file != INVALID_HANDLE_VALUE, "Failed to create %s, error %u.\n", name, GetLastError());
+    ok(file != INVALID_HANDLE_VALUE, "Failed to create %s, error %lu.\n", name, GetLastError());
     ret = WriteFile(file, data, strlen(data), &size, NULL);
-    ok(ret && size == strlen(data), "Failed to write %s, error %u.\n", name, GetLastError());
+    ok(ret && size == strlen(data), "Failed to write %s, error %lu.\n", name, GetLastError());
     CloseHandle(file);
 }
 
@@ -103,24 +103,24 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
     }
 
     hinf = SetupOpenInfFileA(dest, NULL, INF_STYLE_WIN4, NULL);
-    ok(hinf != NULL, "SetupOpenInfFileA failed with error %d\n", GetLastError());
+    ok(hinf != NULL, "SetupOpenInfFileA failed with error %ld\n", GetLastError());
 
     res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, NULL, 0, &size);
-    ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError());
+    ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError());
 
     pspii = HeapAlloc(GetProcessHeap(), 0, size);
 
     res = SetupGetInfInformationA(hinf, INFINFO_INF_SPEC_IS_HINF, pspii, size, NULL);
-    ok(res, "SetupGetInfInformation failed with error %d\n", GetLastError());
+    ok(res, "SetupGetInfInformation failed with error %ld\n", GetLastError());
 
     spofi.cbSize = 0;
     res = pSetupQueryInfOriginalFileInformationA(pspii, 0, NULL, &spofi);
     ok(!res && GetLastError() == ERROR_INVALID_USER_BUFFER,
-        "SetupQueryInfOriginalFileInformationA should have failed with ERROR_INVALID_USER_BUFFER instead of %d\n", GetLastError());
+        "SetupQueryInfOriginalFileInformationA should have failed with ERROR_INVALID_USER_BUFFER instead of %ld\n", GetLastError());
 
     spofi.cbSize = sizeof(spofi);
     res = pSetupQueryInfOriginalFileInformationA(pspii, 0, NULL, &spofi);
-    ok(res, "SetupQueryInfOriginalFileInformationA failed with error %d\n", GetLastError());
+    ok(res, "SetupQueryInfOriginalFileInformationA failed with error %ld\n", GetLastError());
     ok(!spofi.OriginalCatalogName[0], "spofi.OriginalCatalogName should have been \"\" instead of \"%s\"\n", spofi.OriginalCatalogName);
     ok(!strcmp(original, spofi.OriginalInfName), "spofi.OriginalInfName of %s didn't match real original name %s\n", spofi.OriginalInfName, original);
 
@@ -151,7 +151,7 @@ static void test_SetupCopyOEMInf(void)
     res = SetupCopyOEMInfA(NULL, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* try empty SourceInfFileName */
     SetLastError(0xdeadbeef);
@@ -159,14 +159,14 @@ static void test_SetupCopyOEMInf(void)
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
        GetLastError() == ERROR_INVALID_PARAMETER, /* Vista, W2K8 */
-       "Unexpected error : %d\n", GetLastError());
+       "Unexpected error : %ld\n", GetLastError());
 
     /* try a relative nonexistent SourceInfFileName */
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA("nonexistent", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-       "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+       "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
 
     /* try an absolute nonexistent SourceInfFileName */
     strcpy(path, CURR_DIR);
@@ -175,7 +175,7 @@ static void test_SetupCopyOEMInf(void)
     res = SetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-       "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+       "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
 
     get_temp_filename(tmpfile);
     create_file(tmpfile, inf_data1);
@@ -195,7 +195,7 @@ static void test_SetupCopyOEMInf(void)
        return;
     }
 
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     ok(file_exists(tmpfile), "Expected tmpfile to exist\n");
 
     /* try SP_COPY_REPLACEONLY, dest does not exist */
@@ -203,7 +203,7 @@ static void test_SetupCopyOEMInf(void)
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, NULL, 0, NULL, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-       "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+       "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     ok(file_exists(tmpfile), "Expected source inf to exist\n");
 
     /* Test a successful call. */
@@ -219,7 +219,7 @@ static void test_SetupCopyOEMInf(void)
         return;
     }
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(file_exists(path), "Expected source inf to exist.\n");
     ok(file_exists(dest), "Expected dest file to exist.\n");
     ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
@@ -229,7 +229,7 @@ static void test_SetupCopyOEMInf(void)
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(file_exists(path), "Expected source inf to exist.\n");
     ok(file_exists(dest), "Expected dest file to exist.\n");
     ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
@@ -238,7 +238,7 @@ static void test_SetupCopyOEMInf(void)
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, dest, sizeof(dest), NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(file_exists(path), "Expected source inf to exist.\n");
     ok(file_exists(dest), "Expected dest file to exist.\n");
     ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
@@ -248,13 +248,13 @@ static void test_SetupCopyOEMInf(void)
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_NOOVERWRITE, dest, sizeof(dest), NULL, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_FILE_EXISTS,
-       "Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
+       "Expected ERROR_FILE_EXISTS, got %ld\n", GetLastError());
     ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
 
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(file_exists(path), "Expected source inf to exist.\n");
     ok(file_exists(orig_dest), "Expected dest file to exist.\n");
 
@@ -264,39 +264,39 @@ static void test_SetupCopyOEMInf(void)
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL);
     ok(res == FALSE, "Expected FALSE, got %d\n", res);
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-       "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
+       "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
     ok(file_exists(path), "Expected source inf to exist\n");
     ok(file_exists(orig_dest), "Expected dest inf to exist\n");
     ok(!strcmp(dest, "aaa"), "Expected dest to be unchanged\n");
-    ok(size == strlen(orig_dest) + 1, "Got %d.\n", size);
+    ok(size == strlen(orig_dest) + 1, "Got %ld.\n", size);
 
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), &size, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
-    ok(size == strlen(dest) + 1, "Got %d.\n", size);
+    ok(size == strlen(dest) + 1, "Got %ld.\n", size);
 
     test_original_file_name(strrchr(path, '\\') + 1, dest);
 
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, &filepart);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
     ok(filepart == strrchr(dest, '\\') + 1, "Got unexpected file part %s.\n", filepart);
 
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_DELETESOURCE, NULL, 0, NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(!file_exists(path), "Expected source inf to not exist\n");
 
     strcpy(pnf, dest);
     *(strrchr(pnf, '.') + 1) = 'p';
 
     res = SetupUninstallOEMInfA(strrchr(dest, '\\') + 1, 0, NULL);
-    ok(res, "Failed to uninstall '%s', error %u.\n", dest, GetLastError());
+    ok(res, "Failed to uninstall '%s', error %lu.\n", dest, GetLastError());
     todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
     DeleteFileA(dest);
     ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
@@ -305,7 +305,7 @@ static void test_SetupCopyOEMInf(void)
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
     strcpy(orig_dest, dest);
 
@@ -313,12 +313,12 @@ static void test_SetupCopyOEMInf(void)
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
     ok(strcmp(dest, orig_dest), "Expected INF files to be copied to different paths.\n");
 
     res = SetupUninstallOEMInfA(strrchr(dest, '\\') + 1, 0, NULL);
-    ok(res, "Failed to uninstall '%s', error %u.\n", dest, GetLastError());
+    ok(res, "Failed to uninstall '%s', error %lu.\n", dest, GetLastError());
     todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
     DeleteFileA(dest);
     strcpy(pnf, dest);
@@ -326,7 +326,7 @@ static void test_SetupCopyOEMInf(void)
     todo_wine ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
 
     res = SetupUninstallOEMInfA(strrchr(orig_dest, '\\') + 1, 0, NULL);
-    ok(res, "Failed to uninstall '%s', error %u.\n", orig_dest, GetLastError());
+    ok(res, "Failed to uninstall '%s', error %lu.\n", orig_dest, GetLastError());
     todo_wine ok(!file_exists(orig_dest), "Expected inf '%s' to not exist\n", dest);
     DeleteFileA(orig_dest);
     strcpy(pnf, dest);
@@ -337,19 +337,19 @@ static void test_SetupCopyOEMInf(void)
     strcat(orig_dest, "\\inf\\");
     strcat(orig_dest, tmpfile);
     res = CopyFileA(tmpfile, orig_dest, TRUE);
-    ok(res, "Failed to copy file, error %u.\n", GetLastError());
+    ok(res, "Failed to copy file, error %lu.\n", GetLastError());
     SetLastError(0xdeadbeef);
     res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
     ok(res == TRUE, "Expected TRUE, got %d\n", res);
-    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
+    ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", GetLastError());
     ok(!strcasecmp(dest, orig_dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
 
     /* Since it wasn't actually installed, SetupUninstallOEMInf would fail here. */
     res = DeleteFileA(dest);
-    ok(res, "Failed to delete '%s', error %u.\n", tmpfile, GetLastError());
+    ok(res, "Failed to delete '%s', error %lu.\n", tmpfile, GetLastError());
 
     res = DeleteFileA(tmpfile);
-    ok(res, "Failed to delete '%s', error %u.\n", tmpfile, GetLastError());
+    ok(res, "Failed to delete '%s', error %lu.\n", tmpfile, GetLastError());
 }
 
 static void create_source_file(LPSTR filename, const BYTE *data, DWORD size)
@@ -466,8 +466,8 @@ static void test_SetupGetFileCompressionInfo(void)
     ret = SetupGetFileCompressionInfoA(source, &name, &source_size, &target_size, &type);
     ok(!ret, "SetupGetFileCompressionInfo failed unexpectedly\n");
     ok(name && !lstrcmpA(name, source), "got %s, expected %s\n", name, source);
-    ok(source_size == sizeof(uncompressed), "got %d\n", source_size);
-    ok(target_size == sizeof(uncompressed), "got %d\n", target_size);
+    ok(source_size == sizeof(uncompressed), "got %ld\n", source_size);
+    ok(target_size == sizeof(uncompressed), "got %ld\n", target_size);
     ok(type == FILE_COMPRESSION_NONE, "got %d, expected FILE_COMPRESSION_NONE\n", type);
 
     MyFree(name);
@@ -492,16 +492,16 @@ static void test_SetupGetFileCompressionInfoEx(void)
 
     ret = pSetupGetFileCompressionInfoExA(source, NULL, 0, &required_len, NULL, NULL, NULL);
     ok(!ret, "SetupGetFileCompressionInfoEx succeeded unexpectedly\n");
-    ok(required_len == lstrlenA(source) + 1, "got %d, expected %d\n", required_len, lstrlenA(source) + 1);
+    ok(required_len == lstrlenA(source) + 1, "got %ld, expected %d\n", required_len, lstrlenA(source) + 1);
 
     create_source_file(source, comp_lzx, sizeof(comp_lzx));
 
     ret = pSetupGetFileCompressionInfoExA(source, name, sizeof(name), &required_len, &source_size, &target_size, &type);
     ok(ret, "SetupGetFileCompressionInfoEx failed unexpectedly: %d\n", ret);
     ok(!lstrcmpA(name, source), "got %s, expected %s\n", name, source);
-    ok(required_len == lstrlenA(source) + 1, "got %d, expected %d\n", required_len, lstrlenA(source) + 1);
-    ok(source_size == sizeof(comp_lzx), "got %d\n", source_size);
-    ok(target_size == sizeof(uncompressed), "got %d\n", target_size);
+    ok(required_len == lstrlenA(source) + 1, "got %ld, expected %d\n", required_len, lstrlenA(source) + 1);
+    ok(source_size == sizeof(comp_lzx), "got %ld\n", source_size);
+    ok(target_size == sizeof(uncompressed), "got %ld\n", target_size);
     ok(type == FILE_COMPRESSION_WINLZA, "got %d, expected FILE_COMPRESSION_WINLZA\n", type);
     DeleteFileA(source);
 
@@ -510,9 +510,9 @@ static void test_SetupGetFileCompressionInfoEx(void)
     ret = pSetupGetFileCompressionInfoExA(source, name, sizeof(name), &required_len, &source_size, &target_size, &type);
     ok(ret, "SetupGetFileCompressionInfoEx failed unexpectedly: %d\n", ret);
     ok(!lstrcmpA(name, source), "got %s, expected %s\n", name, source);
-    ok(required_len == lstrlenA(source) + 1, "got %d, expected %d\n", required_len, lstrlenA(source) + 1);
-    ok(source_size == sizeof(comp_zip), "got %d\n", source_size);
-    ok(target_size == sizeof(comp_zip), "got %d\n", target_size);
+    ok(required_len == lstrlenA(source) + 1, "got %ld, expected %d\n", required_len, lstrlenA(source) + 1);
+    ok(source_size == sizeof(comp_zip), "got %ld\n", source_size);
+    ok(target_size == sizeof(comp_zip), "got %ld\n", target_size);
     ok(type == FILE_COMPRESSION_NONE, "got %d, expected FILE_COMPRESSION_NONE\n", type);
     DeleteFileA(source);
 
@@ -521,9 +521,9 @@ static void test_SetupGetFileCompressionInfoEx(void)
     ret = pSetupGetFileCompressionInfoExA(source, name, sizeof(name), &required_len, &source_size, &target_size, &type);
     ok(ret, "SetupGetFileCompressionInfoEx failed unexpectedly: %d\n", ret);
     ok(!lstrcmpA(name, source), "got %s, expected %s\n", name, source);
-    ok(required_len == lstrlenA(source) + 1, "got %d, expected %d\n", required_len, lstrlenA(source) + 1);
-    ok(source_size == sizeof(comp_cab_lzx), "got %d\n", source_size);
-    ok(target_size == sizeof(uncompressed), "got %d\n", target_size);
+    ok(required_len == lstrlenA(source) + 1, "got %ld, expected %d\n", required_len, lstrlenA(source) + 1);
+    ok(source_size == sizeof(comp_cab_lzx), "got %ld\n", source_size);
+    ok(target_size == sizeof(uncompressed), "got %ld\n", target_size);
     ok(type == FILE_COMPRESSION_MSZIP, "got %d, expected FILE_COMPRESSION_MSZIP\n", type);
     DeleteFileA(source);
 
@@ -532,9 +532,9 @@ static void test_SetupGetFileCompressionInfoEx(void)
     ret = pSetupGetFileCompressionInfoExA(source, name, sizeof(name), &required_len, &source_size, &target_size, &type);
     ok(ret, "SetupGetFileCompressionInfoEx failed unexpectedly: %d\n", ret);
     ok(!lstrcmpA(name, source), "got %s, expected %s\n", name, source);
-    ok(required_len == lstrlenA(source) + 1, "got %d, expected %d\n", required_len, lstrlenA(source) + 1);
-    ok(source_size == sizeof(comp_cab_zip), "got %d\n", source_size);
-    ok(target_size == sizeof(uncompressed), "got %d\n", target_size);
+    ok(required_len == lstrlenA(source) + 1, "got %ld, expected %d\n", required_len, lstrlenA(source) + 1);
+    ok(source_size == sizeof(comp_cab_zip), "got %ld\n", source_size);
+    ok(target_size == sizeof(uncompressed), "got %ld\n", target_size);
     ok(type == FILE_COMPRESSION_MSZIP, "got %d, expected FILE_COMPRESSION_MSZIP\n", type);
     DeleteFileA(source);
 }
@@ -593,7 +593,7 @@ static void test_SetupDecompressOrCopyFile(void)
                                          invalid_parameters[i].target,
                                          invalid_parameters[i].type);
         ok(ret == ERROR_INVALID_PARAMETER,
-           "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %u\n",
+           "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %lu\n",
            i, ret);
 
         /* try an invalid compression type */
@@ -602,7 +602,7 @@ static void test_SetupDecompressOrCopyFile(void)
                                          invalid_parameters[i].target,
                                          invalid_parameters[i].type);
         ok(ret == ERROR_INVALID_PARAMETER,
-           "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %u\n",
+           "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %lu\n",
            i, ret);
     }
 
@@ -615,23 +615,23 @@ static void test_SetupDecompressOrCopyFile(void)
     /* no compression tests */
 
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, uncompressed, sizeof(uncompressed)), "incorrect target file\n");
 
     /* try overwriting existing file */
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     DeleteFileA(target);
 
     type = FILE_COMPRESSION_NONE;
     ret = SetupDecompressOrCopyFileA(source, target, &type);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, uncompressed, sizeof(uncompressed)), "incorrect target file\n");
     DeleteFileA(target);
 
     type = FILE_COMPRESSION_WINLZA;
     ret = SetupDecompressOrCopyFileA(source, target, &type);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, uncompressed, sizeof(uncompressed)), "incorrect target file\n");
     DeleteFileA(target);
 
@@ -640,7 +640,7 @@ static void test_SetupDecompressOrCopyFile(void)
     create_source_file(source, comp_lzx, sizeof(comp_lzx));
 
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     DeleteFileA(target);
 
     /* zip compression tests */
@@ -648,7 +648,7 @@ static void test_SetupDecompressOrCopyFile(void)
     create_source_file(source, comp_zip, sizeof(comp_zip));
 
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, comp_zip, sizeof(comp_zip)), "incorrect target file\n");
     DeleteFileA(target);
 
@@ -660,23 +660,23 @@ static void test_SetupDecompressOrCopyFile(void)
     lstrcpyA(p + 1, "wine");
 
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, uncompressed, sizeof(uncompressed)), "incorrect target file\n");
 
     /* try overwriting existing file */
     ret = SetupDecompressOrCopyFileA(source, target, NULL);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
 
     /* try zip compression */
     type = FILE_COMPRESSION_MSZIP;
     ret = SetupDecompressOrCopyFileA(source, target, &type);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, uncompressed, sizeof(uncompressed)), "incorrect target file\n");
 
     /* try no compression */
     type = FILE_COMPRESSION_NONE;
     ret = SetupDecompressOrCopyFileA(source, target, &type);
-    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %d\n", ret);
+    ok(!ret, "SetupDecompressOrCopyFile failed unexpectedly: %ld\n", ret);
     ok(compare_file_data(target, comp_cab_zip, sizeof(comp_cab_zip)), "incorrect target file\n");
 
     /* Show that SetupDecompressOrCopyFileA simply extracts the first file it
@@ -694,7 +694,7 @@ static void test_SetupDecompressOrCopyFile(void)
         lstrcpyA(p + 1, zip_multi_tests[i].filename);
 
         ret = SetupDecompressOrCopyFileA(source, target, NULL);
-        ok(!ret, "[%d] SetupDecompressOrCopyFile failed unexpectedly: %d\n", i, ret);
+        ok(!ret, "[%d] SetupDecompressOrCopyFile failed unexpectedly: %ld\n", i, ret);
         ok(compare_file_data(target, zip_multi_tests[i].expected_buffer, zip_multi_tests[i].buffer_size),
            "[%d] incorrect target file\n", i);
         DeleteFileA(target);
@@ -710,14 +710,14 @@ static void test_SetupUninstallOEMInf(void)
     SetLastError(0xdeadbeef);
     ret = SetupUninstallOEMInfA(NULL, 0, NULL);
     ok(!ret, "Expected failure\n");
-    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupUninstallOEMInfA("", 0, NULL);
     todo_wine
     {
     ok(!ret, "Expected failure\n");
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
     }
 
     SetLastError(0xdeadbeef);
@@ -725,7 +725,7 @@ static void test_SetupUninstallOEMInf(void)
     todo_wine
     {
     ok(!ret, "Expected failure\n");
-    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
+    ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
     }
 }
 
@@ -751,7 +751,7 @@ static void test_defaultcallback(void)
     ctxt = SetupInitDefaultQueueCallbackEx(owner, progress, WM_USER, 0, NULL);
     ok(ctxt != NULL, "got %p\n", ctxt);
 
-    ok(ctxt->magic == magic || broken(ctxt->magic != magic) /* win2000 */, "got magic 0x%08x\n", ctxt->magic);
+    ok(ctxt->magic == magic || broken(ctxt->magic != magic) /* win2000 */, "got magic 0x%08lx\n", ctxt->magic);
     if (ctxt->magic == magic)
     {
         ok(ctxt->owner == owner, "got %p, expected %p\n", ctxt->owner, owner);
@@ -767,7 +767,7 @@ static void test_defaultcallback(void)
     }
 
     ctxt = SetupInitDefaultQueueCallback(owner);
-    ok(ctxt->magic == magic, "got magic 0x%08x\n", ctxt->magic);
+    ok(ctxt->magic == magic, "got magic 0x%08lx\n", ctxt->magic);
     ok(ctxt->owner == owner, "got %p, expected %p\n", ctxt->owner, owner);
     ok(ctxt->progress == NULL, "got %p, expected %p\n", ctxt->progress, progress);
     ok(ctxt->message == 0, "got %d\n", ctxt->message);
@@ -783,7 +783,7 @@ static void test_SetupLogError(void)
     ret = SetupLogErrorA("Test without opening\r\n", LogSevInformation);
     error = GetLastError();
     ok(!ret, "SetupLogError succeeded\n");
-    ok(error == ERROR_FILE_INVALID, "got wrong error: %d\n", error);
+    ok(error == ERROR_FILE_INVALID, "got wrong error: %ld\n", error);
 
     SetLastError(0xdeadbeef);
     ret = SetupOpenLog(FALSE);
@@ -792,24 +792,24 @@ static void test_SetupLogError(void)
         skip("SetupOpenLog() failed on insufficient permissions\n");
         return;
     }
-    ok(ret, "SetupOpenLog failed, error %d\n", GetLastError());
+    ok(ret, "SetupOpenLog failed, error %ld\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupLogErrorA("Test with wrong log severity\r\n", LogSevMaximum);
     error = GetLastError();
     ok(!ret, "SetupLogError succeeded\n");
-    ok(error == 0xdeadbeef, "got wrong error: %d\n", error);
+    ok(error == 0xdeadbeef, "got wrong error: %ld\n", error);
     ret = SetupLogErrorA("Test without EOL", LogSevInformation);
     ok(ret, "SetupLogError failed\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupLogErrorA(NULL, LogSevInformation);
     ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER /* Win Vista+ */),
-        "SetupLogError failed: %08x\n", GetLastError());
+        "SetupLogError failed: %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupOpenLog(FALSE);
-    ok(ret, "SetupOpenLog failed, error %d\n", GetLastError());
+    ok(ret, "SetupOpenLog failed, error %ld\n", GetLastError());
 
     SetupCloseLog();
 }
@@ -833,14 +833,14 @@ static void _check_device_interface(int line, const char *instance_id, const GUI
     devinfo = SetupDiGetClassDevsA(guid, instance_id, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
     ret = SetupDiEnumDeviceInfo(devinfo, 0, &device_data);
     ok_(__FILE__, line)(ret || broken(!ret) /* <= Win7 */,
-                        "SetupDiEnumDeviceInfo failed, error %u.\n", GetLastError());
+                        "SetupDiEnumDeviceInfo failed, error %lu.\n", GetLastError());
     if (!ret)
     {
         SetupDiDestroyDeviceInfoList(devinfo);
         return;
     }
     ret = SetupDiEnumDeviceInterfaces(devinfo, &device_data, guid, 0, &iface_data);
-    ok_(__FILE__, line)(ret, "SetupDiEnumDeviceInterfaces failed, error %u.\n", GetLastError());
+    ok_(__FILE__, line)(ret, "SetupDiEnumDeviceInterfaces failed, error %lu.\n", GetLastError());
     ok_(__FILE__, line)(IsEqualGUID(&iface_data.InterfaceClassGuid, guid),
                         "Expected guid %s, got %s.\n", wine_dbgstr_guid(guid),
                         wine_dbgstr_guid(&iface_data.InterfaceClassGuid));
@@ -859,14 +859,14 @@ static void test_device_interfaces(void)
 
     /* GPUs */
     devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_DISPLAY, NULL, NULL, DIGCF_PRESENT);
-    ok(devinfo != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsW failed, error %u.\n", GetLastError());
+    ok(devinfo != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsW failed, error %lu.\n", GetLastError());
     while ((ret = SetupDiEnumDeviceInfo(devinfo, device_idx, &device_data)))
     {
         ret = SetupDiGetDeviceInstanceIdA(devinfo, &device_data, instance_id,
                                           ARRAY_SIZE(instance_id), &size);
-        ok(ret, "SetupDiGetDeviceInstanceIdA failed, error %u.\n", GetLastError());
+        ok(ret, "SetupDiGetDeviceInstanceIdA failed, error %lu.\n", GetLastError());
 
-        winetest_push_context("GPU %d", device_idx);
+        winetest_push_context("GPU %ld", device_idx);
 
         check_device_interface(instance_id, &GUID_DEVINTERFACE_DISPLAY_ADAPTER);
         check_device_interface(instance_id, &GUID_DISPLAY_DEVICE_ARRIVAL);
@@ -875,21 +875,21 @@ static void test_device_interfaces(void)
         ++device_idx;
     }
     error = GetLastError();
-    ok(error == ERROR_NO_MORE_ITEMS, "Expected error %u, got %u.\n", ERROR_NO_MORE_ITEMS, error);
+    ok(error == ERROR_NO_MORE_ITEMS, "Expected error %u, got %lu.\n", ERROR_NO_MORE_ITEMS, error);
     ok(device_idx > 0, "Expected at least one GPU.\n");
     SetupDiDestroyDeviceInfoList(devinfo);
 
     /* Monitors */
     device_idx = 0;
     devinfo = SetupDiGetClassDevsW(&GUID_DEVCLASS_MONITOR, L"DISPLAY", NULL, DIGCF_PRESENT);
-    ok(devinfo != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsW failed, error %u.\n", GetLastError());
+    ok(devinfo != INVALID_HANDLE_VALUE, "SetupDiGetClassDevsW failed, error %lu.\n", GetLastError());
     while ((ret = SetupDiEnumDeviceInfo(devinfo, device_idx, &device_data)))
     {
         ret = SetupDiGetDeviceInstanceIdA(devinfo, &device_data, instance_id,
                                           ARRAY_SIZE(instance_id), &size);
-        ok(ret, "SetupDiGetDeviceInstanceIdA failed, error %u.\n", GetLastError());
+        ok(ret, "SetupDiGetDeviceInstanceIdA failed, error %lu.\n", GetLastError());
 
-        winetest_push_context("Monitor %d", device_idx);
+        winetest_push_context("Monitor %ld", device_idx);
 
         check_device_interface(instance_id, &GUID_DEVINTERFACE_MONITOR);
 
@@ -897,7 +897,7 @@ static void test_device_interfaces(void)
         ++device_idx;
     }
     error = GetLastError();
-    ok(error == ERROR_NO_MORE_ITEMS, "Expected error %u, got %u.\n", ERROR_NO_MORE_ITEMS, error);
+    ok(error == ERROR_NO_MORE_ITEMS, "Expected error %u, got %lu.\n", ERROR_NO_MORE_ITEMS, error);
     ok(device_idx > 0 || broken(device_idx == 0) /* w7u_2qxl TestBot */,
        "Expected at least one monitor.\n");
     SetupDiDestroyDeviceInfoList(devinfo);
diff --git a/dlls/setupapi/tests/parser.c b/dlls/setupapi/tests/parser.c
index 17251fc923b..7c58acdc362 100644
--- a/dlls/setupapi/tests/parser.c
+++ b/dlls/setupapi/tests/parser.c
@@ -164,13 +164,13 @@ static void test_invalid_files(void)
         err_line = 0xdeadbeef;
         hinf = test_file_contents( invalid_files[i].data, invalid_files[i].data_size, &err_line );
         err = GetLastError();
-        trace( "hinf=%p err=0x%x line=%d\n", hinf, err, err_line );
+        trace( "hinf=%p err=0x%lx line=%d\n", hinf, err, err_line );
         if (invalid_files[i].error)  /* should fail */
         {
             ok( hinf == INVALID_HANDLE_VALUE, "file %u: Open succeeded\n", i );
             todo_wine_if (invalid_files[i].todo)
             {
-                ok( err == invalid_files[i].error, "file %u: Bad error %u/%u\n",
+                ok( err == invalid_files[i].error, "file %u: Bad error %lu/%lu\n",
                     i, err, invalid_files[i].error );
                 ok( err_line == invalid_files[i].err_line, "file %u: Bad error line %d/%d\n",
                     i, err_line, invalid_files[i].err_line );
@@ -181,7 +181,7 @@ static void test_invalid_files(void)
             todo_wine_if (invalid_files[i].todo)
             {
                 ok( hinf != INVALID_HANDLE_VALUE, "file %u: Open failed\n", i );
-                ok( err == 0, "file %u: Error code set to %u\n", i, err );
+                ok( err == 0, "file %u: Error code set to %lu\n", i, err );
             }
         }
         SetupCloseInfFile( hinf );
@@ -240,23 +240,23 @@ static void test_section_names(void)
     {
         SetLastError( 0xdeadbeef );
         hinf = test_file_contents( section_names[i].data, strlen(section_names[i].data), &err_line );
-        ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %u\n", i, GetLastError() );
+        ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %lu\n", i, GetLastError() );
         if (hinf == INVALID_HANDLE_VALUE) continue;
 
         ret = SetupGetLineCountA( hinf, section_names[i].section );
         err = GetLastError();
-        trace( "hinf=%p ret=%d err=0x%x\n", hinf, ret, err );
+        trace( "hinf=%p ret=%ld err=0x%lx\n", hinf, ret, err );
         if (ret != -1)
         {
             ok( !section_names[i].error, "line %u: section name %s found\n",
                 i, section_names[i].section );
-            ok( !err, "line %u: bad error code %u\n", i, err );
+            ok( !err, "line %u: bad error code %lu\n", i, err );
         }
         else
         {
             ok( section_names[i].error, "line %u: section name %s not found\n",
                 i, section_names[i].section );
-            ok( err == section_names[i].error, "line %u: bad error %u/%u\n",
+            ok( err == section_names[i].error, "line %u: bad error %lu/%lu\n",
                 i, err, section_names[i].error );
         }
         SetupCloseInfFile( hinf );
@@ -299,7 +299,7 @@ static void test_enum_sections(void)
 
         SetLastError( 0xdeadbeef );
         ret = pSetupEnumInfSectionsA( hinf, index, buffer, sizeof(buffer), &len );
-        ok( ret, "SetupEnumInfSectionsA failed err %u\n", GetLastError() );
+        ok( ret, "SetupEnumInfSectionsA failed err %lu\n", GetLastError() );
         ok( len == 3 || len == 8, "wrong len %u\n", len );
         ok( !lstrcmpiA( buffer, "version" ) || !lstrcmpiA( buffer, "s1" ) ||
             !lstrcmpiA( buffer, "s2" ) || !lstrcmpiA( buffer, "s3" ) || !lstrcmpiA( buffer, "strings" ),
@@ -408,12 +408,12 @@ static const char *check_key( INFCONTEXT *context, const char *wanted )
     if (!key)
     {
         ok( !wanted, "missing key %s\n", wanted );
-        ok( err == 0 || err == ERROR_INVALID_PARAMETER, "last error set to %u\n", err );
+        ok( err == 0 || err == ERROR_INVALID_PARAMETER, "last error set to %lu\n", err );
     }
     else
     {
         ok( !strcmp( key, wanted ), "bad key %s/%s\n", key, wanted );
-        ok( err == 0, "last error set to %u\n", err );
+        ok( err == 0, "last error set to %lu\n", err );
     }
     return key;
 }
@@ -439,7 +439,7 @@ static void test_key_names(void)
         data_size += key_names[i].data_size;
         SetLastError( 0xdeadbeef );
         hinf = test_file_contents( buffer, data_size, &err_line );
-        ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %u\n", i, GetLastError() );
+        ok( hinf != INVALID_HANDLE_VALUE, "line %u: open failed err %lu\n", i, GetLastError() );
         if (hinf == INVALID_HANDLE_VALUE) continue;
 
         ret = SetupFindFirstLineA( hinf, "Test", key_names[i].key, &context );
@@ -449,11 +449,11 @@ static void test_key_names(void)
         {
             ret = SetupFindFirstLineA( hinf, "Test", "%foo%", &context );
             ok(!ret, "SetupFindFirstLine() should not match unsubstituted keys\n");
-            ok(GetLastError() == ERROR_LINE_NOT_FOUND, "got wrong error %u\n", GetLastError());
+            ok(GetLastError() == ERROR_LINE_NOT_FOUND, "got wrong error %lu\n", GetLastError());
         }
 
         ret = SetupFindFirstLineA( hinf, "Test", 0, &context );
-        ok(ret, "SetupFindFirstLineA failed: le=%u\n", GetLastError());
+        ok(ret, "SetupFindFirstLineA failed: le=%lu\n", GetLastError());
         if (!ret)
         {
             SetupCloseInfFile( hinf );
@@ -469,7 +469,7 @@ static void test_key_names(void)
             err = GetLastError();
             if (field)
             {
-                ok( err == 0, "line %u: bad error %u\n", i, err );
+                ok( err == 0, "line %u: bad error %lu\n", i, err );
                 if (key_names[i].fields[index])
                 {
                     if (i == 52)
@@ -499,7 +499,7 @@ static void test_key_names(void)
             else
             {
                 ok( err == 0 || err == ERROR_INVALID_PARAMETER,
-                    "line %u: bad error %u\n", i, err );
+                    "line %u: bad error %lu\n", i, err );
                 if (key_names[i].fields[index])
                     ok( 0, "line %u: missing field %s\n", i, key_names[i].fields[index] );
             }
@@ -523,13 +523,13 @@ static void test_close_inf_file(void)
     SetupCloseInfFile(NULL);
     ok(GetLastError() == 0xdeadbeef ||
         GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x, WinMe */
-        "Expected 0xdeadbeef, got %u\n", GetLastError());
+        "Expected 0xdeadbeef, got %lu\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     SetupCloseInfFile(INVALID_HANDLE_VALUE);
     ok(GetLastError() == 0xdeadbeef ||
         GetLastError() == ERROR_INVALID_PARAMETER, /* Win9x, WinMe */
-        "Expected 0xdeadbeef, got %u\n", GetLastError());
+        "Expected 0xdeadbeef, got %lu\n", GetLastError());
 }
 
 static const char *contents = "[Version]\n"
@@ -610,7 +610,7 @@ static void test_pSetupGetField(void)
         fieldW = pSetupGetFieldW( &context, 4 );
         ok( fieldW == NULL, "Expected NULL, got %p\n", fieldW );
         ok( GetLastError() == ERROR_INVALID_PARAMETER,
-            "Expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
+            "Expected ERROR_INVALID_PARAMETER, got %lu\n", GetLastError() );
     }
     else
     {
@@ -623,7 +623,7 @@ static void test_pSetupGetField(void)
         fieldA = pSetupGetFieldA( &context, 4 );
         ok( fieldA == NULL, "Expected NULL, got %p\n", fieldA );
         ok( GetLastError() == ERROR_INVALID_PARAMETER,
-            "Expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError() );
+            "Expected ERROR_INVALID_PARAMETER, got %lu\n", GetLastError() );
     }
 
     SetupCloseInfFile( hinf );
@@ -677,13 +677,13 @@ static void test_SetupGetIntField(void)
             ok( retb, "%u: Expected success\n", i );
             ok( GetLastError() == ERROR_SUCCESS ||
                 GetLastError() == 0xdeadbeef /* win9x, NT4 */,
-                "%u: Expected ERROR_SUCCESS or 0xdeadbeef, got %u\n", i, GetLastError() );
+                "%u: Expected ERROR_SUCCESS or 0xdeadbeef, got %lu\n", i, GetLastError() );
         }
         else
         {
             ok( !retb, "%u: Expected failure\n", i );
             ok( GetLastError() == keys[i].err,
-                "%u: Expected %d, got %u\n", i, keys[i].err, GetLastError() );
+                "%u: Expected %ld, got %lu\n", i, keys[i].err, GetLastError() );
         }
         ok( intfield == keys[i].value, "%u: Expected %d, got %d\n", i, keys[i].value, intfield );
 
@@ -716,91 +716,91 @@ static void test_GLE(void)
     retb = SetupFindFirstLineA( hinf, "ImNotThere", NULL, &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindFirstLineA( hinf, "ImNotThere", "ImNotThere", &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindFirstLineA( hinf, "Sectionname", NULL, &context );
     ok(retb, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindFirstLineA( hinf, "Sectionname", "ImNotThere", &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindFirstLineA( hinf, "Sectionname", "Keyname1", &context );
     ok(retb, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindNextMatchLineA( &context, "ImNotThere", &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupFindNextMatchLineA( &context, "Keyname2", &context );
     ok(retb, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retl = SetupGetLineCountA( hinf, "ImNotThere");
-    ok(retl == -1, "Expected -1, got %d\n", retl);
+    ok(retl == -1, "Expected -1, got %ld\n", retl);
     ok(GetLastError() == ERROR_SECTION_NOT_FOUND,
-        "Expected ERROR_SECTION_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_SECTION_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retl = SetupGetLineCountA( hinf, "Sectionname");
-    ok(retl == 2, "Expected 2, got %d\n", retl);
+    ok(retl == 2, "Expected 2, got %ld\n", retl);
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineTextA( NULL, hinf, "ImNotThere", "ImNotThere", buf, bufsize, &retsize);
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineTextA( NULL, hinf, "Sectionname", "ImNotThere", buf, bufsize, &retsize);
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineTextA( NULL, hinf, "Sectionname", "Keyname1", buf, bufsize, &retsize);
     ok(retb, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineByIndexA( hinf, "ImNotThere", 1, &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineByIndexA( hinf, "Sectionname", 1, &context );
     ok(retb, "Expected success\n");
     ok(GetLastError() == ERROR_SUCCESS,
-        "Expected ERROR_SUCCESS, got %08x\n", GetLastError());
+        "Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
 
     SetLastError(0xdeadbeef);
     retb = SetupGetLineByIndexA( hinf, "Sectionname", 3, &context );
     ok(!retb, "Expected failure\n");
     ok(GetLastError() == ERROR_LINE_NOT_FOUND,
-        "Expected ERROR_LINE_NOT_FOUND, got %08x\n", GetLastError());
+        "Expected ERROR_LINE_NOT_FOUND, got %08lx\n", GetLastError());
 
     SetupCloseInfFile( hinf );
 }
diff --git a/dlls/setupapi/tests/query.c b/dlls/setupapi/tests/query.c
index 6b6d1bd5c29..6258727c076 100644
--- a/dlls/setupapi/tests/query.c
+++ b/dlls/setupapi/tests/query.c
@@ -171,7 +171,7 @@ static void test_SetupGetInfInformation(void)
        broken(GetLastError() == ERROR_PATH_NOT_FOUND) || /* NT4 */
        broken(GetLastError() == ERROR_INVALID_NAME) || /* win2k */
        broken(GetLastError() == ERROR_GENERAL_SYNTAX), /* another win2k / winMe */
-       "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
 
     /* try an invalid inf filename */
@@ -185,7 +185,7 @@ static void test_SetupGetInfInformation(void)
         ret = SetupGetInfInformationA(NULL, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
         ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
         ok(GetLastError() == ERROR_INVALID_PARAMETER,
-           "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+           "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
         ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
     }
 
@@ -197,7 +197,7 @@ static void test_SetupGetInfInformation(void)
     ret = SetupGetInfInformationA(inf_filename, -1, NULL, 0, &size);
     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
 
     /* try a nonexistent inf file */
@@ -206,7 +206,7 @@ static void test_SetupGetInfInformation(void)
     ret = SetupGetInfInformationA("idontexist", INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size);
     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
     ok(GetLastError() == ERROR_FILE_NOT_FOUND,
-       "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
+       "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
     ok(size == 0xdeadbeef, "Expected size to remain unchanged\n");
 
     /* successfully open the inf file */
@@ -220,7 +220,7 @@ static void test_SetupGetInfInformation(void)
     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size, &size);
     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
-       "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+       "Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
 
     /* set ReturnBuffer to NULL and ReturnBufferSize to non-zero value 'size-1' */
     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, size-1, &size);
@@ -241,7 +241,7 @@ static void test_SetupGetInfInformation(void)
     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size - 1, &size);
     ok(ret == FALSE, "Expected SetupGetInfInformation to fail\n");
     ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
-       "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
+       "Expected ERROR_INSUFFICIENT_BUFFER, got %ld\n", GetLastError());
 
     /* successfully get the inf information */
     ret = SetupGetInfInformationA(inf_filename, INFINFO_INF_NAME_IS_ABSOLUTE, info, size, &size);
@@ -267,7 +267,7 @@ static void test_SetupGetInfInformation(void)
         skip("need admin rights\n");
         goto done;
     }
-    ok(ret, "can't create inf file %u\n", GetLastError());
+    ok(ret, "can't create inf file %lu\n", GetLastError());
 
     HeapFree(GetProcessHeap(), 0, info);
     info = alloc_inf_info("test.inf", INFINFO_DEFAULT_SEARCH, &size);
@@ -289,7 +289,7 @@ static void test_SetupGetInfInformation(void)
 
     /* test the INFINFO_DEFAULT_SEARCH search flag */
     ret = SetupGetInfInformationA("test.inf", INFINFO_DEFAULT_SEARCH, info, size, &size);
-    ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %d\n", GetLastError());
+    ok(ret == TRUE, "Expected SetupGetInfInformation to succeed: %ld\n", GetLastError());
     ok(check_info_filename(info, inf_one), "Expected returned filename to be equal\n");
 
     HeapFree(GetProcessHeap(), 0, info);
@@ -330,7 +330,7 @@ static void test_SetupGetSourceFileLocation(void)
     ret = SetupGetSourceFileLocationA(hinf, NULL, "lanconf.exe", &source_id, buffer, sizeof(buffer), &required);
     ok(ret, "SetupGetSourceFileLocation failed\n");
 
-    ok(required == 1, "unexpected required size: %d\n", required);
+    ok(required == 1, "unexpected required size: %ld\n", required);
     ok(source_id == 2, "unexpected source id: %d\n", source_id);
     ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer);
 
@@ -343,7 +343,7 @@ static void test_SetupGetSourceFileLocation(void)
     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_WIN4, NULL);
     error = GetLastError();
     ok(hinf == INVALID_HANDLE_VALUE, "could open inf file\n");
-    ok(error == ERROR_WRONG_INF_STYLE, "got wrong error: %d\n", error);
+    ok(error == ERROR_WRONG_INF_STYLE, "got wrong error: %ld\n", error);
 
     hinf = SetupOpenInfFileA(inf_filename, NULL, INF_STYLE_OLDNT, NULL);
     ok(hinf != INVALID_HANDLE_VALUE, "could not open inf file\n");
@@ -376,7 +376,7 @@ static void test_SetupGetSourceInfo(void)
     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_PATH, buffer, sizeof(buffer), &required);
     ok(ret, "SetupGetSourceInfoA failed\n");
 
-    ok(required == 1, "unexpected required size: %d\n", required);
+    ok(required == 1, "unexpected required size: %ld\n", required);
     ok(!lstrcmpA("", buffer), "unexpected result string: %s\n", buffer);
 
     required = 0;
@@ -385,7 +385,7 @@ static void test_SetupGetSourceInfo(void)
     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_TAGFILE, buffer, sizeof(buffer), &required);
     ok(ret, "SetupGetSourceInfoA failed\n");
 
-    ok(required == 28, "unexpected required size: %d\n", required);
+    ok(required == 28, "unexpected required size: %ld\n", required);
     ok(!lstrcmpA("LANCOM\\LANtools\\lanconf.cab", buffer), "unexpected result string: %s\n", buffer);
 
     required = 0;
@@ -394,7 +394,7 @@ static void test_SetupGetSourceInfo(void)
     ret = SetupGetSourceInfoA(hinf, 2, SRCINFO_DESCRIPTION, buffer, sizeof(buffer), &required);
     ok(ret, "SetupGetSourceInfoA failed\n");
 
-    ok(required == 19, "unexpected required size: %d\n", required);
+    ok(required == 19, "unexpected required size: %ld\n", required);
     ok(!lstrcmpA("LANCOM Software CD", buffer), "unexpected result string: %s\n", buffer);
 
     SetupCloseInfFile(hinf);
@@ -428,7 +428,7 @@ static void test_SetupGetTargetPath(void)
 
     ret = SetupGetTargetPathA(hinf, &ctx, NULL, buffer, sizeof(buffer), &required);
     ok(ret, "SetupGetTargetPathA failed\n");
-    ok(required == 10, "unexpected required size: %d\n", required);
+    ok(required == 10, "unexpected required size: %ld\n", required);
     /* Retrieve the system drive from the windows directory.
      * (%SystemDrive% is not available on Win9x)
      */
@@ -452,7 +452,7 @@ static void test_SetupGetTargetPath(void)
 
     lstrcpyA(destfile, WIN_DIR);
 
-    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
+    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %ld\n", required);
     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
 
     SetupCloseInfFile(hinf);
@@ -470,7 +470,7 @@ static void test_SetupGetTargetPath(void)
 
     GetSystemDirectoryA(destfile, MAX_PATH);
 
-    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
+    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %ld\n", required);
     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
 
     SetupCloseInfFile(hinf);
@@ -488,7 +488,7 @@ static void test_SetupGetTargetPath(void)
 
     lstrcpyA(destfile, WIN_DIR);
 
-    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
+    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %ld\n", required);
     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
 
     SetupCloseInfFile(hinf);
@@ -506,7 +506,7 @@ static void test_SetupGetTargetPath(void)
 
     lstrcpyA(destfile, WIN_DIR);
 
-    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %d\n", required);
+    ok(required == lstrlenA(destfile) + 1, "unexpected required size: %ld\n", required);
     ok(!lstrcmpiA(buffer, destfile), "unexpected path: %s\n", buffer);
 
     SetupCloseInfFile(hinf);
diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c
index 0bfab8142c2..5cc251a6756 100644
--- a/dlls/setupapi/tests/setupcab.c
+++ b/dlls/setupapi/tests/setupcab.c
@@ -69,7 +69,7 @@ static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size)
 static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification,
                                      UINT_PTR Param1, UINT_PTR Param2)
 {
-    ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
+    ok(0, "Received unexpected notification (%p, %u, %Iu, %Iu)\n", Context,
        Notification, Param1, Param2);
     return 0;
 }
@@ -77,7 +77,7 @@ static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification,
 static UINT CALLBACK dummy_callbackW(PVOID Context, UINT Notification,
                                      UINT_PTR Param1, UINT_PTR Param2)
 {
-    ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
+    ok(0, "Received unexpected notification (%p, %u, %Iu, %Iu)\n", Context,
        Notification, Param1, Param2);
     return 0;
 }
@@ -117,7 +117,7 @@ static void test_invalid_parametersA(void)
         ok(!ret, "[%d] Expected SetupIterateCabinetA to return 0, got %d\n", i, ret);
         todo_wine_if (invalid_parameters[i].todo_lasterror)
             ok(GetLastError() == invalid_parameters[i].expected_lasterror,
-               "[%d] Expected GetLastError() to return %u, got %u\n",
+               "[%d] Expected GetLastError() to return %lu, got %lu\n",
                i, invalid_parameters[i].expected_lasterror, GetLastError());
     }
 
@@ -126,7 +126,7 @@ static void test_invalid_parametersA(void)
     ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
-       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
+       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -134,7 +134,7 @@ static void test_invalid_parametersA(void)
     ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
-       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
+       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %lu\n",
        GetLastError());
 
     DeleteFileA(source);
@@ -183,7 +183,7 @@ static void test_invalid_parametersW(void)
         ok(!ret, "[%d] Expected SetupIterateCabinetW to return 0, got %d\n", i, ret);
         todo_wine_if (invalid_parameters[i].todo_lasterror)
             ok(GetLastError() == invalid_parameters[i].expected_lasterror,
-               "[%d] Expected GetLastError() to return %u, got %u\n",
+               "[%d] Expected GetLastError() to return %lu, got %lu\n",
                i, invalid_parameters[i].expected_lasterror, GetLastError());
     }
 
@@ -192,7 +192,7 @@ static void test_invalid_parametersW(void)
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -200,7 +200,7 @@ static void test_invalid_parametersW(void)
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_PARAMETER ||
        GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
-       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -208,7 +208,7 @@ static void test_invalid_parametersW(void)
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
-       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
+       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
@@ -216,7 +216,7 @@ static void test_invalid_parametersW(void)
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_NOT_ENOUGH_MEMORY ||
        GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
-       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
+       "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %lu\n",
        GetLastError());
 
     DeleteFileW(source);
@@ -250,14 +250,14 @@ static void test_invalid_callbackA(void)
     ret = SetupIterateCabinetA(source, 0, NULL, NULL);
     ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DATA,
-       "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_DATA, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupIterateCabinetA(source, 0, crash_callbackA, NULL);
     ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DATA,
-       "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_DATA, got %lu\n",
        GetLastError());
 
     DeleteFileA(source);
@@ -284,14 +284,14 @@ static void test_invalid_callbackW(void)
     ret = SetupIterateCabinetW(source, 0, NULL, NULL);
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DATA,
-       "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_DATA, got %lu\n",
        GetLastError());
 
     SetLastError(0xdeadbeef);
     ret = SetupIterateCabinetW(source, 0, crash_callbackW, NULL);
     ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
     ok(GetLastError() == ERROR_INVALID_DATA,
-       "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
+       "Expected GetLastError() to return ERROR_INVALID_DATA, got %lu\n",
        GetLastError());
 
     DeleteFileW(source);
@@ -342,8 +342,8 @@ static UINT CALLBACK simple_callbackA(void *context, UINT message, UINT_PTR para
         ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
         ok(!strcmp(info->NameInCabinet, expected_files[index].nameA),
                 "%u: Got file name %s.\n", index, debugstr_a(info->NameInCabinet));
-        ok(info->FileSize == expected_files[index].size, "%u: Got file size %u.\n", index, info->FileSize);
-        ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
+        ok(info->FileSize == expected_files[index].size, "%u: Got file size %lu.\n", index, info->FileSize);
+        ok(!info->Win32Error, "%u: Got error %lu.\n", index, info->Win32Error);
         ok(info->DosDate == 14545, "%u: Got date %u.\n", index, info->DosDate);
         ok(info->DosTime == 18672, "%u: Got time %u.\n", index, info->DosTime);
         ok(info->DosAttribs == FILE_ATTRIBUTE_ARCHIVE, "%u: Got attributes %#x.\n", index, info->DosAttribs);
@@ -410,12 +410,12 @@ static void test_simple_enumerationA(void)
     {
         snprintf(path, ARRAY_SIZE(path), "%s\\%s", temp, expected_files[i].nameA);
         ret = DeleteFileA(path);
-        ok(ret, "Failed to delete %s, error %u.\n", debugstr_a(path), GetLastError());
+        ok(ret, "Failed to delete %s, error %lu.\n", debugstr_a(path), GetLastError());
     }
 
     snprintf(path, ARRAY_SIZE(path), "%s\\testcab.cab", temp);
     ret = DeleteFileA(path);
-    ok(ret, "Failed to delete %s, error %u.\n", debugstr_a(path), GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", debugstr_a(path), GetLastError());
 }
 
 static UINT CALLBACK simple_callbackW(void *context, UINT message, UINT_PTR param1, UINT_PTR param2)
@@ -450,8 +450,8 @@ static UINT CALLBACK simple_callbackW(void *context, UINT message, UINT_PTR para
         ok(index < ARRAY_SIZE(expected_files), "%u: Got unexpected file.\n", index);
         ok(!wcscmp(info->NameInCabinet, expected_files[index].nameW),
                 "%u: Got file name %s.\n", index, debugstr_w(info->NameInCabinet));
-        ok(info->FileSize == expected_files[index].size, "%u: Got file size %u.\n", index, info->FileSize);
-        ok(!info->Win32Error, "%u: Got error %u.\n", index, info->Win32Error);
+        ok(info->FileSize == expected_files[index].size, "%u: Got file size %lu.\n", index, info->FileSize);
+        ok(!info->Win32Error, "%u: Got error %lu.\n", index, info->Win32Error);
         ok(info->DosDate == 14545, "%u: Got date %u.\n", index, info->DosDate);
         ok(info->DosTime == 18672, "%u: Got time %u.\n", index, info->DosTime);
         ok(info->DosAttribs == FILE_ATTRIBUTE_ARCHIVE, "%u: Got attributes %#x.\n", index, info->DosAttribs);
@@ -518,12 +518,12 @@ static void test_simple_enumerationW(void)
     {
         swprintf(path, ARRAY_SIZE(path), L"%s\\%s", temp, expected_files[i].nameW);
         ret = DeleteFileW(path);
-        ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(path), GetLastError());
+        ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(path), GetLastError());
     }
 
     swprintf(path, ARRAY_SIZE(path), L"%s\\testcab.cab", temp);
     ret = DeleteFileW(path);
-    ok(ret, "Failed to delete %s, error %u.\n", debugstr_w(path), GetLastError());
+    ok(ret, "Failed to delete %s, error %lu.\n", debugstr_w(path), GetLastError());
 }
 
 START_TEST(setupcab)
diff --git a/dlls/setupapi/tests/stringtable.c b/dlls/setupapi/tests/stringtable.c
index dfd50895560..85805550b4b 100644
--- a/dlls/setupapi/tests/stringtable.c
+++ b/dlls/setupapi/tests/stringtable.c
@@ -87,15 +87,15 @@ static void test_StringTableAddString(void)
 
     retval=pStringTableAddString(table,String,0);
     ok(retval!=-1,"Failed to add String to String Table\n");    
-    ok(hstring==retval,"string handle %x != String handle %x in String Table\n", hstring, retval);        
+    ok(hstring==retval,"string handle %lx != String handle %lx in String Table\n", hstring, retval);        
     
     hfoo=pStringTableAddString(table,foo,0);
     ok(hfoo!=-1,"Failed to add foo to String Table\n");        
-    ok(hfoo!=hstring,"foo and string share the same ID %x in String Table\n", hfoo);            
+    ok(hfoo!=hstring,"foo and string share the same ID %lx in String Table\n", hfoo);            
     
     /* case sensitive */    
     hString=pStringTableAddString(table,String,ST_CASE_SENSITIVE_COMPARE);
-    ok(hstring!=hString,"String handle and string share same ID %x in Table\n", hstring);        
+    ok(hstring!=hString,"String handle and string share same ID %lx in Table\n", hstring);        
 
     pStringTableDestroy(table);
 }
@@ -115,15 +115,15 @@ static void test_StringTableAddStringEx(void)
 
     retval = pStringTableAddStringEx(table, String, 0, NULL, 0);
     ok(retval != -1, "Failed to add String to String Table\n");
-    ok(hstring == retval, "string handle %x != String handle %x in String Table\n", hstring, retval);
+    ok(hstring == retval, "string handle %lx != String handle %lx in String Table\n", hstring, retval);
 
     hfoo = pStringTableAddStringEx(table, foo, 0, NULL, 0);
     ok(hfoo != -1, "Failed to add foo to String Table\n");
-    ok(hfoo != hstring, "foo and string share the same ID %x in String Table\n", hfoo);
+    ok(hfoo != hstring, "foo and string share the same ID %lx in String Table\n", hfoo);
 
     /* case sensitive */
     hString = pStringTableAddStringEx(table, String, ST_CASE_SENSITIVE_COMPARE, NULL, 0);
-    ok(hstring != hString, "String handle and string share same ID %x in Table\n", hstring);
+    ok(hstring != hString, "String handle and string share same ID %lx in Table\n", hstring);
 
     pStringTableDestroy(table);
 
@@ -133,19 +133,19 @@ static void test_StringTableAddStringEx(void)
 
     extra = 10;
     hstring = pStringTableAddStringEx(table, string, 0, &extra, 4);
-    ok(hstring != -1, "failed to add string, %d\n", hstring);
+    ok(hstring != -1, "failed to add string, %ld\n", hstring);
 
     extra = 0;
     ret = pStringTableGetExtraData(table, hstring, &extra, 4);
-    ok(ret && extra == 10, "got %d, extra %d\n", ret, extra);
+    ok(ret && extra == 10, "got %d, extra %ld\n", ret, extra);
 
     extra = 11;
     hstring = pStringTableAddStringEx(table, string, 0, &extra, 4);
-    ok(hstring != -1, "failed to add string, %d\n", hstring);
+    ok(hstring != -1, "failed to add string, %ld\n", hstring);
 
     extra = 0;
     ret = pStringTableGetExtraData(table, hstring, &extra, 4);
-    ok(ret && extra == 10, "got %d, extra %d\n", ret, extra);
+    ok(ret && extra == 10, "got %d, extra %ld\n", ret, extra);
 
     pStringTableDestroy(table);
 }
@@ -188,7 +188,7 @@ static void test_StringTableLookUpString(void)
     retval=pStringTableLookUpString(table,string,0);
     ok(retval!=-1,"Failed find string in String Table 1\n");
     ok(retval==hstring,
-        "Lookup for string (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for string (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hstring);    
 
     retval=pStringTableLookUpString(table2,string,0);
@@ -203,7 +203,7 @@ static void test_StringTableLookUpString(void)
     retval=pStringTableLookUpString(table,foo,0);
     ok(retval!=-1,"Failed find foo in String Table 1\n");    
     ok(retval==hfoo,
-        "Lookup for foo (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for foo (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hfoo);        
     
     retval=pStringTableLookUpString(table2,foo,0);
@@ -214,7 +214,7 @@ static void test_StringTableLookUpString(void)
     retval2=pStringTableLookUpString(table,String,ST_CASE_SENSITIVE_COMPARE);    
     ok(retval!=retval2,"Lookup of string equals String in Table 1\n");
     ok(retval==hString,
-        "Lookup for String (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for String (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hString);
 
     pStringTableDestroy(table);
@@ -247,7 +247,7 @@ static void test_StringTableLookUpStringEx(void)
     retval = pStringTableLookUpStringEx(table, string, 0, NULL, 0);
     ok(retval != ~0u, "Failed find string in String Table 1\n");
     ok(retval == hstring,
-        "Lookup for string (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for string (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hstring);
 
     retval = pStringTableLookUpStringEx(table2, string, 0, NULL, 0);
@@ -262,7 +262,7 @@ static void test_StringTableLookUpStringEx(void)
     retval=pStringTableLookUpStringEx(table, foo, 0, NULL, 0);
     ok(retval != ~0u, "Failed find foo in String Table 1\n");
     ok(retval == hfoo,
-        "Lookup for foo (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for foo (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hfoo);
 
     retval = pStringTableLookUpStringEx(table2, foo, 0, NULL, 0);
@@ -273,7 +273,7 @@ static void test_StringTableLookUpStringEx(void)
     retval2 = pStringTableLookUpStringEx(table, String, ST_CASE_SENSITIVE_COMPARE, NULL, 0);
     ok(retval != retval2, "Lookup of string equals String in Table 1\n");
     ok(retval == hString,
-        "Lookup for String (%x) does not match previous handle (%x) in String Table 1\n",
+        "Lookup for String (%lx) does not match previous handle (%lx) in String Table 1\n",
         retval, hString);
 
     pStringTableDestroy(table);
@@ -318,10 +318,10 @@ static void test_StringTableStringFromId(void)
 
     /* correct */
     id2 = pStringTableLookUpString(table, string, 0);
-    ok(id2 == id, "got %d and %d\n", id2, id);
+    ok(id2 == id, "got %ld and %ld\n", id2, id);
 
     string2 = pStringTableStringFromId(table, id2);
-    ok(string2 != NULL, "failed to lookup string %d\n", id2);
+    ok(string2 != NULL, "failed to lookup string %ld\n", id2);
     ok(!lstrcmpiW(string, string2), "got %s, expected %s\n", wine_dbgstr_w(string2), wine_dbgstr_w(string));
 
     pStringTableDestroy(table);
@@ -347,14 +347,14 @@ static void test_stringtable_layout(void)
     ptr = (struct stringtable*)table;
     ok(ptr->data != NULL, "got %p\n", ptr->data);
     /* first data offset is right after bucket area */
-    ok(ptr->nextoffset == 509*sizeof(DWORD), "got %d\n", ptr->nextoffset);
-    ok(ptr->allocated != 0, "got %d\n", ptr->allocated);
+    ok(ptr->nextoffset == 509*sizeof(DWORD), "got %ld\n", ptr->nextoffset);
+    ok(ptr->allocated != 0, "got %ld\n", ptr->allocated);
 todo_wine {
-    ok(ptr->unk[0] != 0, "got %lx\n", ptr->unk[0]);
-    ok(ptr->unk[1] != 0, "got %lx\n", ptr->unk[1]);
+    ok(ptr->unk[0] != 0, "got %Ix\n", ptr->unk[0]);
+    ok(ptr->unk[1] != 0, "got %Ix\n", ptr->unk[1]);
 }
-    ok(ptr->max_extra_size == 0, "got %d\n", ptr->max_extra_size);
-    ok(ptr->lcid == GetThreadLocale(), "got %x, thread lcid %x\n", ptr->lcid, GetThreadLocale());
+    ok(ptr->max_extra_size == 0, "got %ld\n", ptr->max_extra_size);
+    ok(ptr->lcid == GetThreadLocale(), "got %lx, thread lcid %lx\n", ptr->lcid, GetThreadLocale());
 
     pStringTableDestroy(table);
 }




More information about the wine-devel mailing list