[PATCH 5/5] dinput/tests: Fix printf warnings with long types.

Rémi Bernon rbernon at codeweavers.com
Tue Feb 8 02:55:40 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/Makefile.in      |    1 -
 dlls/dinput/tests/device.c         |  126 ++--
 dlls/dinput/tests/device8.c        |  604 +++++++--------
 dlls/dinput/tests/dinput.c         |  210 +++---
 dlls/dinput/tests/driver_hid.c     |  120 +--
 dlls/dinput/tests/driver_hid.h     |    6 +-
 dlls/dinput/tests/force_feedback.c | 1118 ++++++++++++++--------------
 dlls/dinput/tests/hid.c            |  886 +++++++++++-----------
 dlls/dinput/tests/hotplug.c        |   82 +-
 dlls/dinput/tests/joystick.c       |  268 +++----
 dlls/dinput/tests/joystick8.c      | 1032 ++++++++++++-------------
 dlls/dinput/tests/keyboard.c       |  110 +--
 dlls/dinput/tests/mouse.c          |   80 +-
 13 files changed, 2321 insertions(+), 2322 deletions(-)

diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in
index b34afde882a..5ba0e5be4d7 100644
--- a/dlls/dinput/tests/Makefile.in
+++ b/dlls/dinput/tests/Makefile.in
@@ -1,4 +1,3 @@
-EXTRADEFS = -DWINE_NO_LONG_TYPES
 TESTDLL   = dinput.dll
 IMPORTS   = dinput dinput8 ole32 version user32 advapi32 hid uuid crypt32 newdev setupapi wintrust winmm
 
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index b21a02dfe56..e907c5e8598 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -60,7 +60,7 @@ static const DIDATAFORMAT data_format = {
 static BOOL CALLBACK enum_callback(const DIDEVICEOBJECTINSTANCEA *oi, void *info)
 {
     if (winetest_debug > 1)
-        trace(" Type:%4x Ofs:%3d Flags:%08x Name:%s\n",
+        trace(" Type:%#lx Ofs:%3ld Flags:%#lx Name:%s\n",
               oi->dwType, oi->dwOfs, oi->dwFlags, oi->tszName);
     (*(int*)info)++;
     return DIENUM_CONTINUE;
@@ -69,7 +69,7 @@ static BOOL CALLBACK enum_callback(const DIDEVICEOBJECTINSTANCEA *oi, void *info
 static BOOL CALLBACK enum_type_callback(const DIDEVICEOBJECTINSTANCEA *oi, void *info)
 {
     DWORD expected = *(DWORD*)info;
-    ok (expected & DIDFT_GETTYPE(oi->dwType), "EnumObjects() enumerated wrong type for obj %s, expected: %08x got: %08x\n", oi->tszName, expected, oi->dwType);
+    ok (expected & DIDFT_GETTYPE(oi->dwType), "EnumObjects() enumerated wrong type for obj %s, expected: %#lx got: %#lx\n", oi->tszName, expected, oi->dwType);
     return DIENUM_CONTINUE;
 }
 
@@ -85,24 +85,24 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
     DIDEVICEOBJECTDATA buffer[5];
 
     hr = IDirectInputDevice_EnumObjects(device, NULL, &cnt, DIDFT_ALL);
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_EnumObjects returned %08x, expected %08x\n", hr, DIERR_INVALIDPARAM);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_EnumObjects returned %#lx, expected %#lx\n", hr, DIERR_INVALIDPARAM);
 
     hr = IDirectInputDevice_EnumObjects(device, enum_callback, &cnt, DIDFT_ALL);
-    ok(SUCCEEDED(hr), "EnumObjects() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "EnumObjects() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_SetDataFormat(device, &data_format);
-    ok(SUCCEEDED(hr), "SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "SetDataFormat() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_EnumObjects(device, enum_callback, &cnt1, DIDFT_ALL);
-    ok(SUCCEEDED(hr), "EnumObjects() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "EnumObjects() failed: %#lx\n", hr);
     if (0) /* fails for joystick only */
-    ok(cnt == cnt1, "Enum count changed from %d to %d\n", cnt, cnt1);
+    ok(cnt == cnt1, "Enum count changed from %lu to %u\n", cnt, cnt1);
 
     /* Testing EnumObjects with different types of device objects */
     for (type_index=0; type_index < ARRAY_SIZE(obj_types); type_index++)
     {
         hr = IDirectInputDevice_EnumObjects(device, enum_type_callback, &obj_types[type_index], obj_types[type_index]);
-        ok(SUCCEEDED(hr), "EnumObjects() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "EnumObjects() failed: %#lx\n", hr);
     }
 
     /* Test buffered mode */
@@ -114,59 +114,59 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
     dp.dwData = UINT_MAX;
 
     hr = IDirectInputDevice_GetProperty(device, DIPROP_BUFFERSIZE, &dp.diph);
-    ok(hr == DI_OK, "Failed: %08x\n", hr);
-    ok(dp.dwData == 0, "got %d\n", dp.dwData);
+    ok(hr == DI_OK, "Failed: %#lx\n", hr);
+    ok(dp.dwData == 0, "got %ld\n", dp.dwData);
 
     dp.dwData = UINT_MAX;
     hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
-    ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
+    ok(hr == DI_OK, "SetProperty() failed: %#lx\n", hr);
 
     dp.dwData = 0;
     hr = IDirectInputDevice_GetProperty(device, DIPROP_BUFFERSIZE, &dp.diph);
-    ok(hr == DI_OK, "Failed: %08x\n", hr);
-    ok(dp.dwData == UINT_MAX, "got %d\n", dp.dwData);
+    ok(hr == DI_OK, "Failed: %#lx\n", hr);
+    ok(dp.dwData == UINT_MAX, "got %ld\n", dp.dwData);
 
     dp.dwData = 0;
     hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
-    ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
+    ok(hr == DI_OK, "SetProperty() failed: %#lx\n", hr);
     cnt = 5;
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DI_OK && cnt == 5, "GetDeviceData() failed: %08x cnt: %d\n", hr, cnt);
+    ok(hr == DI_OK && cnt == 5, "GetDeviceData() failed: %#lx cnt: %ld\n", hr, cnt);
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(DIDEVICEOBJECTDATA_DX3), buffer, &cnt, 0);
-    ok(hr == DIERR_NOTBUFFERED, "GetDeviceData() should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTBUFFERED, "GetDeviceData() should have failed: %#lx\n", hr);
     IDirectInputDevice_Acquire(device);
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(DIDEVICEOBJECTDATA_DX3), buffer, &cnt, 0);
-    ok(hr == DIERR_NOTBUFFERED, "GetDeviceData() should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTBUFFERED, "GetDeviceData() should have failed: %#lx\n", hr);
     IDirectInputDevice_Unacquire(device);
 
     dp.dwData = 20;
     hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
-    ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
+    ok(hr == DI_OK, "SetProperty() failed: %#lx\n", hr);
     cnt = 5;
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed: %08x\n", hr);
+    ok(hr == DI_OK, "GetDeviceData() failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(DIDEVICEOBJECTDATA_DX3), buffer, &cnt, 0);
-    ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(device);
-    ok(hr == DI_OK, "Acquire() failed: %08x\n", hr);
+    ok(hr == DI_OK, "Acquire() failed: %#lx\n", hr);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed: %08x\n", hr);
+    ok(hr == DI_OK, "GetDeviceData() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Unacquire(device);
-    ok(hr == DI_OK, "Unacquire() failed: %08x\n", hr);
+    ok(hr == DI_OK, "Unacquire() failed: %#lx\n", hr);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(device, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed: %08x\n", hr);
+    ok(hr == DI_OK, "GetDeviceData() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_GetObjectInfo(device, NULL, 16, DIPH_BYOFFSET);
-    ok(hr == E_POINTER, "IDirectInputDevice_GetObjectInfo returned %08x, expected %08x\n", hr, E_POINTER);
+    ok(hr == E_POINTER, "IDirectInputDevice_GetObjectInfo returned %#lx, expected %#lx\n", hr, E_POINTER);
 
     obj_info.dwSize = 1;
     hr = IDirectInputDevice_GetObjectInfo(device, &obj_info, 16, DIPH_BYOFFSET);
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetObjectInfo returned %08x, expected %08x\n", hr, DIERR_INVALIDPARAM);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetObjectInfo returned %#lx, expected %#lx\n", hr, DIERR_INVALIDPARAM);
     obj_info.dwSize = 0xdeadbeef;
     hr = IDirectInputDevice_GetObjectInfo(device, &obj_info, 16, DIPH_BYOFFSET);
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetObjectInfo returned %08x, expected %08x\n", hr, DIERR_INVALIDPARAM);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetObjectInfo returned %#lx, expected %#lx\n", hr, DIERR_INVALIDPARAM);
 
     /* No need to test devices without axis */
     obj_info.dwSize = sizeof(obj_info);
@@ -178,22 +178,22 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
         dp.diph.dwObj = 16;
         dp.dwData = DIPROPAXISMODE_ABS;
         hr = IDirectInputDevice_SetProperty(device, DIPROP_AXISMODE, &dp.diph);
-        ok(hr == DIERR_UNSUPPORTED, "SetProperty() returned: %08x\n", hr);
+        ok(hr == DIERR_UNSUPPORTED, "SetProperty() returned: %#lx\n", hr);
         dp.diph.dwHow = DIPH_DEVICE;
         hr = IDirectInputDevice_SetProperty(device, DIPROP_AXISMODE, &dp.diph);
-        ok(hr == DIERR_INVALIDPARAM, "SetProperty() returned: %08x\n", hr);
+        ok(hr == DIERR_INVALIDPARAM, "SetProperty() returned: %#lx\n", hr);
         dp.diph.dwObj = 0;
         hr = IDirectInputDevice_SetProperty(device, DIPROP_AXISMODE, &dp.diph);
-        ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
+        ok(hr == DI_OK, "SetProperty() failed: %#lx\n", hr);
 
         /* Cannot change mode while acquired */
         hr = IDirectInputDevice_Acquire(device);
-        ok(hr == DI_OK, "Acquire() failed: %08x\n", hr);
+        ok(hr == DI_OK, "Acquire() failed: %#lx\n", hr);
 
         hr = IDirectInputDevice_SetProperty(device, DIPROP_AXISMODE, &dp.diph);
-        ok(hr == DIERR_ACQUIRED, "SetProperty() returned: %08x\n", hr);
+        ok(hr == DIERR_ACQUIRED, "SetProperty() returned: %#lx\n", hr);
         hr = IDirectInputDevice_Unacquire(device);
-        ok(hr == DI_OK, "Unacquire() failed: %08x\n", hr);
+        ok(hr == DI_OK, "Unacquire() failed: %#lx\n", hr);
     }
 
     /* Reset buffer size */
@@ -203,7 +203,7 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
     dp.diph.dwObj = 0;
     dp.dwData = 0;
     hr = IDirectInputDevice_SetProperty(device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&dp.diph);
-    ok(hr == DI_OK, "SetProperty() failed: %08x\n", hr);
+    ok(hr == DI_OK, "SetProperty() failed: %#lx\n", hr);
 }
 
 struct enum_data
@@ -222,49 +222,49 @@ static BOOL CALLBACK enum_devices(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     IUnknown *iface, *tmp_iface;
 
     hr = IDirectInput_GetDeviceStatus(data->pDI, &lpddi->guidInstance);
-    ok(hr == DI_OK, "IDirectInput_GetDeviceStatus() failed: %08x\n", hr);
+    ok(hr == DI_OK, "IDirectInput_GetDeviceStatus() failed: %#lx\n", hr);
 
     if (hr == DI_OK)
     {
         hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance, &device, NULL);
-        ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
         trace("Testing device %p \"%s\"\n", device, lpddi->tszInstanceName);
 
         hr = IUnknown_QueryInterface(device, &IID_IDirectInputDevice2A, (LPVOID*)&obj);
-        ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2A) failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2A) failed: %#lx\n", hr);
         test_object_info(obj, data->hwnd);
         IUnknown_Release(obj);
         obj = NULL;
 
         hr = IUnknown_QueryInterface(device, &IID_IDirectInputDevice2W, (LPVOID*)&obj);
-        ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2W) failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2W) failed: %#lx\n", hr);
         test_object_info(obj, data->hwnd);
         IUnknown_Release(obj);
 
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDeviceA, (void **)&iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDeviceA) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDeviceA) failed: %#lx\n", hr );
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDevice2A, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2A) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2A) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IDirectInputDevice2A iface differs from IDirectInputDeviceA\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDevice7A, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7A) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7A) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IDirectInputDevice7A iface differs from IDirectInputDeviceA\n" );
         IUnknown_Release( tmp_iface );
         IUnknown_Release( iface );
 
         hr = IUnknown_QueryInterface( device, &IID_IUnknown, (void **)&iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IUnknown) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IUnknown) failed: %#lx\n", hr );
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDeviceW, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDeviceW) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDeviceW) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IDirectInputDeviceW iface differs from IUnknown\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDevice2W, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2W) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice2W) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IDirectInputDevice2W iface differs from IUnknown\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( device, &IID_IDirectInputDevice7W, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7W) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputDevice7W) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IDirectInputDevice7W iface differs from IUnknown\n" );
         IUnknown_Release( tmp_iface );
         IUnknown_Release( iface );
@@ -275,11 +275,11 @@ static BOOL CALLBACK enum_devices(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
         {
             data->tested_product_creation = TRUE;
             hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidProduct, &device, NULL);
-            ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+            ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
 
             ddi2.dwSize = sizeof(ddi2);
             hr = IDirectInputDevice_GetDeviceInfo(device, &ddi2);
-            ok(SUCCEEDED(hr), "IDirectInput_GetDeviceInfo failed: %08x\n", hr);
+            ok(SUCCEEDED(hr), "IDirectInput_GetDeviceInfo failed: %#lx\n", hr);
 
             ok(IsEqualGUID(&lpddi->guidProduct, &ddi2.guidProduct), "Product GUIDs do not match. Expected %s, got %s\n", debugstr_guid(&lpddi->guidProduct), debugstr_guid(&ddi2.guidProduct));
             ok(IsEqualGUID(&ddi2.guidProduct, &ddi2.guidInstance), "Instance GUID should equal product GUID. Expected %s, got %s\n", debugstr_guid(&ddi2.guidProduct), debugstr_guid(&ddi2.guidInstance));
@@ -357,8 +357,8 @@ static BOOL wait_for_device_data_and_discard_(int line, IDirectInputDeviceA *dev
     {
         cnt = 10;
         hr = IDirectInputDevice_GetDeviceData(device, sizeof(DIDEVICEOBJECTDATA_DX3), NULL, &cnt, 0);
-        ok_(__FILE__, line)(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceData() failed: %08x\n", hr);
-        ok_(__FILE__, line)(cnt == 0 || cnt == 1, "Unexpected number of events: %d\n", cnt);
+        ok_(__FILE__, line)(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceData() failed: %#lx\n", hr);
+        ok_(__FILE__, line)(cnt == 0 || cnt == 1, "Unexpected number of events: %lu\n", cnt);
     } while (cnt != 1 && (GetTickCount() - start_time < 500));
 
     return cnt == 1;
@@ -371,7 +371,7 @@ static void acquire_and_wait_(int line, IDirectInputDeviceA *device, DWORD valid
     int tries = 2;
 
     hr = IDirectInputDevice_Acquire(device);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
 
     do
     {
@@ -393,11 +393,11 @@ void overlapped_format_tests(IDirectInputA *pDI, HWND hwnd)
     SetFocus(hwnd);
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &keyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
 
     /* test overlapped slider - default value 0 */
     hr = IDirectInputDevice_SetDataFormat(keyboard, &overlapped_slider_format);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
 
     dp.diph.dwSize = sizeof(DIPROPDWORD);
     dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
@@ -405,7 +405,7 @@ void overlapped_format_tests(IDirectInputA *pDI, HWND hwnd)
     dp.diph.dwObj = 0;
     dp.dwData = 10;
     hr = IDirectInputDevice_SetProperty(keyboard, DIPROP_BUFFERSIZE, &dp.diph);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
 
     acquire_and_wait(keyboard, DIK_F);
 
@@ -416,7 +416,7 @@ void overlapped_format_tests(IDirectInputA *pDI, HWND hwnd)
 
     memset(&state, 0xFF, sizeof(state));
     hr = IDirectInputDevice_GetDeviceState(keyboard, sizeof(state), &state);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
 
     ok(state.keys[0] == 0x00, "key A should be still up\n");
     ok(state.keys[1] == 0x00, "key S should be still up\n");
@@ -430,11 +430,11 @@ void overlapped_format_tests(IDirectInputA *pDI, HWND hwnd)
             "Timed out while waiting for injected events to be picked up by DirectInput.\n");
 
     hr = IDirectInputDevice_Unacquire(keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
 
     /* test overlapped pov - default value - 0xFFFFFFFF */
     hr = IDirectInputDevice_SetDataFormat(keyboard, &overlapped_pov_format);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
 
     acquire_and_wait(keyboard, DIK_F);
 
@@ -445,7 +445,7 @@ void overlapped_format_tests(IDirectInputA *pDI, HWND hwnd)
 
     memset(&state, 0xFF, sizeof(state));
     hr = IDirectInputDevice_GetDeviceState(keyboard, sizeof(state), &state);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
 
     ok(state.keys[0] == 0xFF, "key state should have been overwritten by the overlapped POV\n");
     ok(state.keys[1] == 0xFF, "key state should have been overwritten by the overlapped POV\n");
@@ -475,19 +475,19 @@ static void device_tests(void)
         skip("Tests require a newer dinput version\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInput_Initialize(pDI, hInstance, DIRECTINPUT_VERSION);
-    ok(SUCCEEDED(hr), "Initialize() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "Initialize() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IUnknown_QueryInterface(pDI, &IID_IDirectInput2W, (LPVOID*)&obj);
-    ok(SUCCEEDED(hr), "QueryInterface(IDirectInput7W) failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "QueryInterface(IDirectInput7W) failed: %#lx\n", hr);
 
     hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL,
                          NULL, NULL);
-    ok(hwnd != NULL, "err: %d\n", GetLastError());
+    ok(hwnd != NULL, "err: %ld\n", GetLastError());
     if (hwnd)
     {
         ShowWindow(hwnd, SW_SHOW);
@@ -496,7 +496,7 @@ static void device_tests(void)
         data.hwnd = hwnd;
         data.tested_product_creation = FALSE;
         hr = IDirectInput_EnumDevices(pDI, 0, enum_devices, &data, DIEDFL_ALLDEVICES);
-        ok(SUCCEEDED(hr), "IDirectInput_EnumDevices() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInput_EnumDevices() failed: %#lx\n", hr);
 
         if (!data.tested_product_creation) winetest_skip("Device creation using product GUID not tested\n");
 
@@ -507,7 +507,7 @@ static void device_tests(void)
             IDirectInputDeviceA *device = NULL;
 
             hr = IDirectInput_CreateDevice(pDI, &GUID_Joystick, &device, NULL);
-            ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+            ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
             if (device) IUnknown_Release(device);
         }
 
diff --git a/dlls/dinput/tests/device8.c b/dlls/dinput/tests/device8.c
index 817e843e33c..2586736cb1d 100644
--- a/dlls/dinput/tests/device8.c
+++ b/dlls/dinput/tests/device8.c
@@ -99,40 +99,40 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c
     int i;
 
     event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( event != NULL, "CreateEventW failed, error %u\n", GetLastError() );
+    ok( event != NULL, "CreateEventW failed, error %lu\n", GetLastError() );
 
     IDirectInputDevice_Unacquire( device );
 
     hr = IDirectInputDevice8_SetEventNotification( device, event );
-    ok( hr == DI_OK, "SetEventNotification returned %#x\n", hr );
+    ok( hr == DI_OK, "SetEventNotification returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
 
     if (type == INPUT_KEYBOARD)
     {
         keybd_event( 0, code, KEYEVENTF_SCANCODE, 0 );
         res = WaitForSingleObject( event, 100 );
-        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
 
         keybd_event( 0, code, KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP, 0 );
         res = WaitForSingleObject( event, 100 );
-        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
     }
     if (type == INPUT_MOUSE)
     {
         mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
         res = WaitForSingleObject( event, 100 );
-        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
 
         mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
         res = WaitForSingleObject( event, 100 );
-        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+        ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
     }
 
     hr = IDirectInputDevice8_GetDeviceData( device, sizeof(obj_data), &obj_data, &data_size, 0 );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( data_size == 1, "got data size %u, expected 1\n", data_size );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( data_size == 1, "got data size %lu, expected 1\n", data_size );
     ok( obj_data.uAppData == expected, "got action uAppData %p, expected %p\n",
         (void *)obj_data.uAppData, (void *)expected );
 
@@ -143,45 +143,45 @@ static void test_device_input( IDirectInputDevice8A *device, DWORD type, DWORD c
         {
             keybd_event( VK_SPACE, DIK_SPACE, 0, 0 );
             res = WaitForSingleObject( event, 100 );
-            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
 
             keybd_event( VK_SPACE, DIK_SPACE, KEYEVENTF_KEYUP, 0 );
             res = WaitForSingleObject( event, 100 );
-            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
         }
         if (type == INPUT_MOUSE)
         {
             mouse_event( MOUSEEVENTF_LEFTDOWN, 1, 1, 0, 0 );
             res = WaitForSingleObject( event, 100 );
-            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
 
             mouse_event( MOUSEEVENTF_LEFTUP, 1, 1, 0, 0 );
             res = WaitForSingleObject( event, 100 );
-            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+            ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
         }
     }
 
     data_size = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, sizeof(obj_data), &obj_data, &data_size, 0 );
-    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#x\n", hr );
+    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#lx\n", hr );
     data_size = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, sizeof(obj_data), &obj_data, &data_size, 0 );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( data_size == 1, "got data_size %u, expected 1\n", data_size );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( data_size == 1, "got data_size %lu, expected 1\n", data_size );
 
     /* drain device's queue */
     while (data_size == 1)
     {
         hr = IDirectInputDevice8_GetDeviceData( device, sizeof(obj_data), &obj_data, &data_size, 0 );
-        ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
+        ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
         if (hr != DI_OK) break;
     }
 
     hr = IDirectInputDevice_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_SetEventNotification( device, NULL );
-    ok( hr == DI_OK, "SetEventNotification returned %#x\n", hr );
+    ok( hr == DI_OK, "SetEventNotification returned %#lx\n", hr );
 
     CloseHandle( event );
 }
@@ -199,7 +199,7 @@ static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *
     IDirectInputDevice_GetDeviceInfo(lpdid, &ddi);
 
     hr = IDirectInputDevice8_BuildActionMap(lpdid, lpdiaf, NULL, DIDBAM_HWDEFAULTS);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
 
     actions = lpdiaf->rgoAction;
     instance = DIDFT_GETINSTANCE(actions[action_index].dwObjID);
@@ -207,9 +207,9 @@ static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *
     how = actions[action_index].dwHow;
     assigned_to = actions[action_index].guidInstance;
 
-    ok (how == DIAH_USERCONFIG || how == DIAH_DEFAULT, "Action was not set dwHow=%08x\n", how);
-    ok (instance == expected_inst, "Action not mapped correctly instance=%08x expected=%08x\n", instance, expected_inst);
-    ok (type == expected_type, "Action type not mapped correctly type=%08x expected=%08x\n", type, expected_type);
+    ok (how == DIAH_USERCONFIG || how == DIAH_DEFAULT, "Action was not set dwHow=%#lx\n", how);
+    ok (instance == expected_inst, "Action not mapped correctly instance=%#lx expected=%#lx\n", instance, expected_inst);
+    ok (type == expected_type, "Action type not mapped correctly type=%#lx expected=%#lx\n", type, expected_type);
     ok (IsEqualGUID(&assigned_to, &ddi.guidInstance), "Action and device GUID do not match action=%d\n", action_index);
 }
 
@@ -246,7 +246,7 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
         IDirectInputDevice_AddRef(lpdid);
         data->keyboard = lpdid;
 
-        ok (dwFlags & DIEDBS_MAPPEDPRI1, "Keyboard should be mapped as pri1 dwFlags=%08x\n", dwFlags);
+        ok (dwFlags & DIEDBS_MAPPEDPRI1, "Keyboard should be mapped as pri1 dwFlags=%#lx\n", dwFlags);
     }
 
     if (IsEqualGUID(&lpddi->guidInstance, &GUID_SysMouse))
@@ -254,24 +254,24 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
         IDirectInputDevice_AddRef(lpdid);
         data->mouse = lpdid;
 
-        ok (dwFlags & DIEDBS_MAPPEDPRI1, "Mouse should be mapped as pri1 dwFlags=%08x\n", dwFlags);
+        ok (dwFlags & DIEDBS_MAPPEDPRI1, "Mouse should be mapped as pri1 dwFlags=%#lx\n", dwFlags);
     }
 
     /* Creating second device object to check if it has the same username */
     hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance, &lpdid2, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
 
     /* Building and setting an action map */
     /* It should not use any pre-stored mappings so we use DIDBAM_HWDEFAULTS */
     hr = IDirectInputDevice8_BuildActionMap(lpdid, data->lpdiaf, NULL, DIDBAM_HWDEFAULTS);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
 
     /* Device has no data format and thus can't be acquired */
     hr = IDirectInputDevice8_Acquire(lpdid);
-    ok (hr == DIERR_INVALIDPARAM, "Device was acquired before SetActionMap hr=%08x\n", hr);
+    ok (hr == DIERR_INVALIDPARAM, "Device was acquired before SetActionMap hr=%#lx\n", hr);
 
     hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, data->username, 0);
-    ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr);
 
     /* Some joysticks may have no suitable actions and thus should not be tested */
     if (hr == DI_NOEFFECT) return DIENUM_CONTINUE;
@@ -284,12 +284,12 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
     dps.wsz[0] = '\0';
 
     hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph);
-    ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr);
     ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz));
 
     dps.wsz[0] = '\0';
     hr = IDirectInputDevice_GetProperty(lpdid2, DIPROP_USERNAME, &dps.diph);
-    ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr);
     ok (!lstrcmpW(usernameW, dps.wsz), "Username not set correctly expected=%s, got=%s\n", wine_dbgstr_w(usernameW), wine_dbgstr_w(dps.wsz));
 
     /* Test buffer size */
@@ -299,12 +299,12 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
     dp.diph.dwHow  = DIPH_DEVICE;
 
     hr = IDirectInputDevice_GetProperty(lpdid, DIPROP_BUFFERSIZE, &dp.diph);
-    ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
-    ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%d\n", dp.dwData);
+    ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr);
+    ok (dp.dwData == data->lpdiaf->dwBufferSize, "SetActionMap must set the buffer, buffersize=%lu\n", dp.dwData);
 
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() failed hr=%08x\n", hr);
+    ok(hr == DIERR_NOTACQUIRED, "GetDeviceData() failed hr=%#lx\n", hr);
 
     /* Test axis range */
     memset(&dpr, 0, sizeof(dpr));
@@ -316,21 +316,21 @@ static BOOL CALLBACK enumeration_callback(const DIDEVICEINSTANCEA *lpddi, IDirec
     /* Only test if device supports the range property */
     if (SUCCEEDED(hr))
     {
-        ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%d got=%d\n", data->lpdiaf->lAxisMin, dpr.lMin);
-        ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%d got=%d\n", data->lpdiaf->lAxisMax, dpr.lMax);
+        ok (dpr.lMin == data->lpdiaf->lAxisMin, "SetActionMap must set the min axis range expected=%ld got=%ld\n", data->lpdiaf->lAxisMin, dpr.lMin);
+        ok (dpr.lMax == data->lpdiaf->lAxisMax, "SetActionMap must set the max axis range expected=%ld got=%ld\n", data->lpdiaf->lAxisMax, dpr.lMax);
     }
 
     /* SetActionMap has set the data format so now it should work */
     hr = IDirectInputDevice8_Acquire(lpdid);
-    ok (SUCCEEDED(hr), "Acquire failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "Acquire failed hr=%#lx\n", hr);
 
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(lpdid, sizeof(buffer[0]), buffer, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed hr=%08x\n", hr);
+    ok(hr == DI_OK, "GetDeviceData() failed hr=%#lx\n", hr);
 
     /* SetActionMap should not work on an acquired device */
     hr = IDirectInputDevice8_SetActionMap(lpdid, data->lpdiaf, NULL, 0);
-    ok (hr == DIERR_ACQUIRED, "SetActionMap succeeded with an acquired device hr=%08x\n", hr);
+    ok (hr == DIERR_ACQUIRED, "SetActionMap succeeded with an acquired device hr=%#lx\n", hr);
 
     IDirectInputDevice_Release(lpdid2);
 
@@ -348,7 +348,7 @@ static void test_appdata_property_vs_map(struct enum_data *data)
     dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_SPACE) | DIDFT_PSHBUTTON;
     dp.uData = 10;
     hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, 10);
 
@@ -356,11 +356,11 @@ static void test_appdata_property_vs_map(struct enum_data *data)
     dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_V) | DIDFT_PSHBUTTON;
     dp.uData = 11;
     hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(hr == DIERR_OBJECTNOTFOUND, "IDirectInputDevice8_SetProperty should not find key that's not in the action map hr=%08x\n", hr);
+    ok(hr == DIERR_OBJECTNOTFOUND, "IDirectInputDevice8_SetProperty should not find key that's not in the action map hr=%#lx\n", hr);
 
     /* setting format should reset action map */
     hr = IDirectInputDevice8_SetDataFormat(data->keyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "SetDataFormat failed: %#lx\n", hr);
 
     test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, -1);
 
@@ -368,13 +368,13 @@ static void test_appdata_property_vs_map(struct enum_data *data)
     dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_V) | DIDFT_PSHBUTTON;
     dp.uData = 11;
     hr = IDirectInputDevice8_SetProperty(data->keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_V, 11);
 
     /* back to action map */
     hr = IDirectInputDevice8_SetActionMap(data->keyboard, data->lpdiaf, NULL, 0);
-    ok(SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr);
 
     test_device_input(data->keyboard, INPUT_KEYBOARD, DIK_SPACE, 2);
 }
@@ -397,7 +397,7 @@ static void test_action_mapping(void)
         win_skip("ActionMapping requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInput8_Initialize(pDI,hinst, DIRECTINPUT_VERSION);
@@ -406,7 +406,7 @@ static void test_action_mapping(void)
         win_skip("ActionMapping requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     memset (&af, 0, sizeof(af));
@@ -422,7 +422,7 @@ static void test_action_mapping(void)
     /* This enumeration builds and sets the action map for all devices */
     data.pDI = pDI;
     hr = IDirectInput8_EnumDevicesBySemantics(pDI, 0, &af, enumeration_callback, &data, DIEDBSFL_ATTACHEDONLY);
-    ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr);
 
     if (data.keyboard)
         IDirectInputDevice_Release(data.keyboard);
@@ -433,7 +433,7 @@ static void test_action_mapping(void)
     /* Repeat tests with a non NULL user */
     data.username = "Ninja Brian";
     hr = IDirectInput8_EnumDevicesBySemantics(pDI, NULL, &af, enumeration_callback, &data, DIEDBSFL_ATTACHEDONLY);
-    ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr);
 
     hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput",
             WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
@@ -449,13 +449,13 @@ static void test_action_mapping(void)
 
         /* setting format should reset action map */
         hr = IDirectInputDevice8_SetDataFormat(data.keyboard, &c_dfDIKeyboard);
-        ok (SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+        ok (SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
 
         test_device_input(data.keyboard, INPUT_KEYBOARD, DIK_SPACE, -1);
 
         /* back to action map */
         hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
-        ok (SUCCEEDED(hr), "SetActionMap should succeed hr=%08x\n", hr);
+        ok (SUCCEEDED(hr), "SetActionMap should succeed hr=%#lx\n", hr);
 
         test_device_input(data.keyboard, INPUT_KEYBOARD, DIK_SPACE, 2);
 
@@ -467,10 +467,10 @@ static void test_action_mapping(void)
         af.dwNumActions = DITEST_KEYBOARDSPACE;
 
         hr = IDirectInputDevice8_BuildActionMap(data.keyboard, data.lpdiaf, NULL, DIDBAM_HWDEFAULTS);
-        ok (hr == DI_NOEFFECT, "BuildActionMap should have no effect with no actions hr=%08x\n", hr);
+        ok (hr == DI_NOEFFECT, "BuildActionMap should have no effect with no actions hr=%#lx\n", hr);
 
         hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
-        ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
+        ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%#lx\n", hr);
 
         af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
         af.dwNumActions = ARRAY_SIZE(actionMapping);
@@ -483,11 +483,11 @@ static void test_action_mapping(void)
         dps.wsz[0] = '\0';
 
         hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph);
-        ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
+        ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr);
         ok (dps.wsz[0] != 0, "Expected any username, got=%s\n", wine_dbgstr_w(dps.wsz));
 
         hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, DIDSAM_NOUSER);
-        ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
+        ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr);
 
         dps.diph.dwSize = sizeof(dps);
         dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
@@ -496,7 +496,7 @@ static void test_action_mapping(void)
         dps.wsz[0] = '\0';
 
         hr = IDirectInputDevice_GetProperty(data.keyboard, DIPROP_USERNAME, &dps.diph);
-        ok (SUCCEEDED(hr), "GetProperty failed hr=%08x\n", hr);
+        ok (SUCCEEDED(hr), "GetProperty failed hr=%#lx\n", hr);
         ok (dps.wsz[0] == 0, "Expected empty username, got=%s\n", wine_dbgstr_w(dps.wsz));
 
         IDirectInputDevice_Release(data.keyboard);
@@ -549,7 +549,7 @@ static void test_save_settings(void)
         win_skip("ActionMapping requires dinput8\n");
         return;
     }
-    ok (SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "DirectInput8 Create failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInput8_Initialize(pDI,hinst, DIRECTINPUT_VERSION);
@@ -558,11 +558,11 @@ static void test_save_settings(void)
         win_skip("ActionMapping requires dinput8\n");
         return;
     }
-    ok (SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKey, NULL);
-    ok (SUCCEEDED(hr), "IDirectInput_Create device failed hr: 0x%08x\n", hr);
+    ok (SUCCEEDED(hr), "IDirectInput_Create device failed hr: 0x%#lx\n", hr);
     if (FAILED(hr)) return;
 
     memset (&af, 0, sizeof(af));
@@ -577,15 +577,15 @@ static void test_save_settings(void)
 
     /* Easy case. Ask for default mapping, save, ask for previous map and read it back */
     hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, DIDBAM_HWDEFAULTS);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
     ok (results[0] == af.rgoAction[0].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID);
 
     ok (results[1] == af.rgoAction[1].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID);
 
     hr = IDirectInputDevice8_SetActionMap(pKey, &af, NULL, DIDSAM_FORCESAVE);
-    ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr);
 
     if (hr == DI_SETTINGSNOTSAVED)
     {
@@ -599,14 +599,14 @@ static void test_save_settings(void)
     memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
 
     hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
 
     ok (results[0] == af.rgoAction[0].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
 
     ok (results[1] == af.rgoAction[1].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
 
     /* Test that a different action map with no pre-stored settings, in spite of the flags,
@@ -619,14 +619,14 @@ static void test_save_settings(void)
     memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
 
     hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
 
     ok (results[0] == af.rgoAction[0].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[0], af.rgoAction[0].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[0], af.rgoAction[0].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
 
     ok (results[1] == af.rgoAction[1].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", results[1], af.rgoAction[1].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", results[1], af.rgoAction[1].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
 
     af.guidActionMap = mapping_guid;
@@ -639,7 +639,7 @@ static void test_save_settings(void)
     af.rgoAction[1].guidInstance = GUID_SysKeyboard;
 
     hr = IDirectInputDevice8_SetActionMap(pKey, &af, NULL, DIDSAM_FORCESAVE);
-    ok (SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr);
 
     if (hr == DI_SETTINGSNOTSAVED)
     {
@@ -653,14 +653,14 @@ static void test_save_settings(void)
     memset(&af.rgoAction[1].guidInstance, 0, sizeof(GUID));
 
     hr = IDirectInputDevice8_BuildActionMap(pKey, &af, NULL, 0);
-    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr);
+    ok (SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr);
 
     ok (other_results[0] == af.rgoAction[0].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[0], af.rgoAction[0].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", other_results[0], af.rgoAction[0].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[0].guidInstance), "Action should be mapped to keyboard\n");
 
     ok (other_results[1] == af.rgoAction[1].dwObjID,
-        "Mapped incorrectly expected: 0x%08x got: 0x%08x\n", other_results[1], af.rgoAction[1].dwObjID);
+        "Mapped incorrectly expected: 0x%#lx got: 0x%#lx\n", other_results[1], af.rgoAction[1].dwObjID);
     ok (IsEqualGUID(&GUID_SysKeyboard, &af.rgoAction[1].guidInstance), "Action should be mapped to keyboard\n");
 
     IDirectInputDevice_Release(pKey);
@@ -687,7 +687,7 @@ static void test_mouse_keyboard(void)
         win_skip("test_mouse_keyboard requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8Create failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8Create failed: %#lx\n", hr);
 
     hr = IDirectInput8_Initialize(di, GetModuleHandleA(NULL), DIRECTINPUT_VERSION);
     if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION)
@@ -695,39 +695,39 @@ static void test_mouse_keyboard(void)
         win_skip("test_mouse_keyboard requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "IDirectInput8_Initialize failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_Initialize failed: %#lx\n", hr);
 
     hr = IDirectInput8_CreateDevice(di, &GUID_SysMouse, &di_mouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %#lx\n", hr);
     hr = IDirectInputDevice8_SetDataFormat(di_mouse, &c_dfDIMouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
 
     hr = IDirectInput8_CreateDevice(di, &GUID_SysKeyboard, &di_keyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %#lx\n", hr);
     hr = IDirectInputDevice8_SetDataFormat(di_keyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
 
     raw_devices_count = ARRAY_SIZE(raw_devices);
     GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
 
     hr = IDirectInputDevice8_Acquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     memset(raw_devices, 0, sizeof(raw_devices));
     hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     todo_wine
-    ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
+    ok(hr == 1, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count);
     todo_wine
     ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
     todo_wine
     ok(raw_devices[0].usUsage == 6, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
     todo_wine
-    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags);
     todo_wine
     ok(raw_devices[0].hwndTarget != NULL, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
     hr = IDirectInputDevice8_Unacquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
@@ -748,18 +748,18 @@ static void test_mouse_keyboard(void)
     }
 
     hr = IDirectInputDevice8_Acquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     memset(raw_devices, 0, sizeof(raw_devices));
     hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
-    ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
+    ok(hr == 1, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count);
     ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
     ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
-    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags);
     todo_wine
     ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
     hr = IDirectInputDevice8_Unacquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     ok(raw_devices_count == 0, "Unexpected raw devices registered: %d\n", raw_devices_count);
@@ -785,31 +785,31 @@ static void test_mouse_keyboard(void)
     ok(hr == TRUE, "RegisterRawInputDevices failed\n");
 
     hr = IDirectInputDevice8_Acquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     hr = IDirectInputDevice8_Acquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     memset(raw_devices, 0, sizeof(raw_devices));
     hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
-    ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
+    ok(hr == 3, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count);
     ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
     ok(raw_devices[0].usUsage == 2, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
-    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+    ok(raw_devices[0].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags);
     ok(raw_devices[0].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
     ok(raw_devices[1].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
     ok(raw_devices[1].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
-    ok(raw_devices[1].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
+    ok(raw_devices[1].dwFlags == 0, "Unexpected raw device flags: %#lx\n", raw_devices[1].dwFlags);
     ok(raw_devices[1].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
     ok(raw_devices[2].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[1].usUsagePage);
     ok(raw_devices[2].usUsage == 6, "Unexpected raw device usage: %x\n", raw_devices[1].usUsage);
     todo_wine
-    ok(raw_devices[2].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
+    ok(raw_devices[2].dwFlags == RIDEV_INPUTSINK, "Unexpected raw device flags: %#lx\n", raw_devices[1].dwFlags);
     todo_wine
     ok(raw_devices[2].hwndTarget == di_hwnd, "Unexpected raw device target: %p\n", raw_devices[1].hwndTarget);
     hr = IDirectInputDevice8_Unacquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     hr = IDirectInputDevice8_Unacquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     todo_wine
@@ -819,28 +819,28 @@ static void test_mouse_keyboard(void)
     IDirectInputDevice8_SetCooperativeLevel(di_keyboard, hwnd, DISCL_FOREGROUND|DISCL_EXCLUSIVE);
 
     hr = IDirectInputDevice8_Acquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     hr = IDirectInputDevice8_Acquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     raw_devices_count = ARRAY_SIZE(raw_devices);
     memset(raw_devices, 0, sizeof(raw_devices));
     hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
-    ok(hr == 3, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
-    ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+    ok(hr == 3, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count);
+    ok(raw_devices[0].dwFlags == (RIDEV_CAPTUREMOUSE|RIDEV_NOLEGACY), "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags);
     todo_wine
-    ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %x\n", raw_devices[1].dwFlags);
+    ok(raw_devices[2].dwFlags == (RIDEV_NOHOTKEYS|RIDEV_NOLEGACY), "Unexpected raw device flags: %#lx\n", raw_devices[1].dwFlags);
     hr = IDirectInputDevice8_Unacquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
     hr = IDirectInputDevice8_Unacquire(di_mouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
 
     raw_devices_count = ARRAY_SIZE(raw_devices);
     hr = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
     todo_wine
-    ok(hr == 1, "GetRegisteredRawInputDevices returned %d, raw_devices_count: %d\n", hr, raw_devices_count);
+    ok(hr == 1, "GetRegisteredRawInputDevices returned %ld, raw_devices_count: %d\n", hr, raw_devices_count);
     ok(raw_devices[0].usUsagePage == 1, "Unexpected raw device usage page: %x\n", raw_devices[0].usUsagePage);
     ok(raw_devices[0].usUsage == 5, "Unexpected raw device usage: %x\n", raw_devices[0].usUsage);
-    ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %x\n", raw_devices[0].dwFlags);
+    ok(raw_devices[0].dwFlags == 0, "Unexpected raw device flags: %#lx\n", raw_devices[0].dwFlags);
     ok(raw_devices[0].hwndTarget == hwnd, "Unexpected raw device target: %p\n", raw_devices[0].hwndTarget);
 
     IDirectInputDevice8_Release(di_mouse);
@@ -869,7 +869,7 @@ static void test_keyboard_events(void)
         win_skip("test_keyboard_events requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8Create failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8Create failed: %#lx\n", hr);
 
     hr = IDirectInput8_Initialize(di, GetModuleHandleA(NULL), DIRECTINPUT_VERSION);
     if (hr == DIERR_OLDDIRECTINPUTVERSION || hr == DIERR_BETADIRECTINPUTVERSION)
@@ -878,17 +878,17 @@ static void test_keyboard_events(void)
         IDirectInput8_Release(di);
         return;
     }
-    ok(SUCCEEDED(hr), "IDirectInput8_Initialize failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_Initialize failed: %#lx\n", hr);
 
     hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
     ok(hwnd != NULL, "CreateWindowExA failed\n");
 
     hr = IDirectInput8_CreateDevice(di, &GUID_SysKeyboard, &di_keyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %#lx\n", hr);
     hr = IDirectInputDevice8_SetCooperativeLevel(di_keyboard, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE);
-    ok(SUCCEEDED(hr), "IDirectInput8_SetCooperativeLevel failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_SetCooperativeLevel failed: %#lx\n", hr);
     hr = IDirectInputDevice8_SetDataFormat(di_keyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
     dp.diph.dwSize = sizeof(DIPROPDWORD);
     dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
     dp.diph.dwObj = 0;
@@ -897,7 +897,7 @@ static void test_keyboard_events(void)
     IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_BUFFERSIZE, &(dp.diph));
 
     hr = IDirectInputDevice8_Acquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Acquire failed: %#lx\n", hr);
 
     /* Test injecting keyboard events with both VK and scancode given. */
     keybd_event(VK_SPACE, DIK_SPACE, 0, 0);
@@ -905,11 +905,11 @@ static void test_keyboard_events(void)
     IDirectInputDevice8_Poll(di_keyboard);
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
-    ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    ok(data_size == 1, "Expected 1 element, received %d\n", data_size);
+    ok(SUCCEEDED(hr), "Failed to get data hr=%#lx\n", hr);
+    ok(data_size == 1, "Expected 1 element, received %ld\n", data_size);
 
     hr = IDirectInputDevice8_GetDeviceState(di_keyboard, sizeof(kbdata), kbdata);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_GetDeviceState failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_GetDeviceState failed: %#lx\n", hr);
     ok(kbdata[DIK_SPACE], "Expected DIK_SPACE key state down\n");
 
     keybd_event(VK_SPACE, DIK_SPACE, KEYEVENTF_KEYUP, 0);
@@ -917,8 +917,8 @@ static void test_keyboard_events(void)
     IDirectInputDevice8_Poll(di_keyboard);
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
-    ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    ok(data_size == 1, "Expected 1 element, received %d\n", data_size);
+    ok(SUCCEEDED(hr), "Failed to get data hr=%#lx\n", hr);
+    ok(data_size == 1, "Expected 1 element, received %ld\n", data_size);
 
     /* Test injecting keyboard events with scancode=0.
      * Windows DInput ignores the VK, sets scancode 0 to be pressed, and GetDeviceData returns no elements. */
@@ -927,11 +927,11 @@ static void test_keyboard_events(void)
     IDirectInputDevice8_Poll(di_keyboard);
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
-    ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    ok(data_size == 0, "Expected 0 elements, received %d\n", data_size);
+    ok(SUCCEEDED(hr), "Failed to get data hr=%#lx\n", hr);
+    ok(data_size == 0, "Expected 0 elements, received %ld\n", data_size);
 
     hr = IDirectInputDevice8_GetDeviceState(di_keyboard, sizeof(kbdata), kbdata);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_GetDeviceState failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_GetDeviceState failed: %#lx\n", hr);
     todo_wine
     ok(kbdata[0], "Expected key 0 state down\n");
 
@@ -940,11 +940,11 @@ static void test_keyboard_events(void)
     IDirectInputDevice8_Poll(di_keyboard);
     data_size = ARRAY_SIZE(obj_data);
     hr = IDirectInputDevice8_GetDeviceData(di_keyboard, sizeof(DIDEVICEOBJECTDATA), obj_data, &data_size, 0);
-    ok(SUCCEEDED(hr), "Failed to get data hr=%08x\n", hr);
-    ok(data_size == 0, "Expected 0 elements, received %d\n", data_size);
+    ok(SUCCEEDED(hr), "Failed to get data hr=%#lx\n", hr);
+    ok(data_size == 0, "Expected 0 elements, received %ld\n", data_size);
 
     hr = IDirectInputDevice8_Unacquire(di_keyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_Unacquire failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_Unacquire failed: %#lx\n", hr);
 
     IDirectInputDevice8_Release(di_keyboard);
     IDirectInput8_Release(di);
@@ -970,7 +970,7 @@ static void test_appdata_property(void)
         win_skip("DIPROP_APPDATA requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8 Create failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInput8_Initialize(pDI,hinst, DIRECTINPUT_VERSION);
@@ -979,7 +979,7 @@ static void test_appdata_property(void)
         win_skip("DIPROP_APPDATA requires dinput8\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInput8 Initialize failed: hr=%#lx\n", hr);
     if (FAILED(hr)) return;
 
     hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput",
@@ -987,10 +987,10 @@ static void test_appdata_property(void)
     ok(hwnd != NULL, "failed to create window\n");
 
     hr = IDirectInput8_CreateDevice(pDI, &GUID_SysKeyboard, &di_keyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput8_CreateDevice failed: %#lx\n", hr);
 
     hr = IDirectInputDevice8_SetDataFormat(di_keyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
 
     dw.diph.dwSize = sizeof(DIPROPDWORD);
     dw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
@@ -998,7 +998,7 @@ static void test_appdata_property(void)
     dw.diph.dwHow = DIPH_DEVICE;
     dw.dwData = 32;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_BUFFERSIZE, &(dw.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     /* the default value */
     test_device_input(di_keyboard, INPUT_KEYBOARD, DIK_A, -1);
@@ -1007,7 +1007,7 @@ static void test_appdata_property(void)
     dp.diph.dwObj = 0;
     dp.uData = 1;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty APPDATA for the device should be invalid hr=%08x\n", hr);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_SetProperty APPDATA for the device should be invalid hr=%#lx\n", hr);
 
     dp.diph.dwSize = sizeof(dp);
     dp.diph.dwHeaderSize = sizeof(DIPROPHEADER);
@@ -1015,25 +1015,25 @@ static void test_appdata_property(void)
     dp.diph.dwObj = 2;
     dp.uData = 2;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_SetProperty APPDATA by usage should be unsupported hr=%08x\n", hr);
+    ok(hr == DIERR_UNSUPPORTED, "IDirectInputDevice8_SetProperty APPDATA by usage should be unsupported hr=%#lx\n", hr);
 
     dp.diph.dwHow = DIPH_BYID;
     dp.diph.dwObj = DIDFT_MAKEINSTANCE(DIK_SPACE) | DIDFT_PSHBUTTON;
     dp.uData = 3;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     dp.diph.dwHow = DIPH_BYOFFSET;
     dp.diph.dwObj = DIK_A;
     dp.uData = 4;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     dp.diph.dwHow = DIPH_BYOFFSET;
     dp.diph.dwObj = DIK_B;
     dp.uData = 5;
     hr = IDirectInputDevice8_SetProperty(di_keyboard, DIPROP_APPDATA, &(dp.diph));
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetProperty failed hr=%#lx\n", hr);
 
     test_device_input(di_keyboard, INPUT_KEYBOARD, DIK_SPACE, 3);
     test_device_input(di_keyboard, INPUT_KEYBOARD, DIK_A, 4);
@@ -1042,7 +1042,7 @@ static void test_appdata_property(void)
 
     /* setting data format resets APPDATA */
     hr = IDirectInputDevice8_SetDataFormat(di_keyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice8_SetDataFormat failed: %#lx\n", hr);
 
     test_device_input(di_keyboard, INPUT_KEYBOARD, VK_SPACE, -1);
     test_device_input(di_keyboard, INPUT_KEYBOARD, DIK_A, -1);
@@ -1101,21 +1101,21 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
 
     winetest_push_context( "obj[%d]", params->index );
 
-    check_member( *obj, *exp, "%u", dwSize );
+    check_member( *obj, *exp, "%lu", dwSize );
     check_member_guid( *obj, *exp, guidType );
     todo_wine_if( todo->offset )
-    check_member( *obj, *exp, "%#x", dwOfs );
+    check_member( *obj, *exp, "%#lx", dwOfs );
     todo_wine_if( todo->type )
-    check_member( *obj, *exp, "%#x", dwType );
-    check_member( *obj, *exp, "%#x", dwFlags );
+    check_member( *obj, *exp, "%#lx", dwType );
+    check_member( *obj, *exp, "%#lx", dwFlags );
     if (!localized) todo_wine_if( todo->name ) check_member_wstr( *obj, *exp, tszName );
-    check_member( *obj, *exp, "%u", dwFFMaxForce );
-    check_member( *obj, *exp, "%u", dwFFForceResolution );
+    check_member( *obj, *exp, "%lu", dwFFMaxForce );
+    check_member( *obj, *exp, "%lu", dwFFForceResolution );
     check_member( *obj, *exp, "%u", wCollectionNumber );
     check_member( *obj, *exp, "%u", wDesignatorIndex );
     check_member( *obj, *exp, "%#04x", wUsagePage );
     check_member( *obj, *exp, "%#04x", wUsage );
-    check_member( *obj, *exp, "%#04x", dwDimension );
+    check_member( *obj, *exp, "%#lx", dwDimension );
     check_member( *obj, *exp, "%#04x", wExponent );
     check_member( *obj, *exp, "%u", wReportId );
 
@@ -1271,32 +1271,32 @@ static void test_mouse_info(void)
     localized = LOWORD( GetKeyboardLayout( 0 ) ) != 0x0409;
 
     hr = DirectInput8Create( instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void **)&di, NULL );
-    ok( hr == DI_OK, "DirectInput8Create returned %#x\n", hr );
+    ok( hr == DI_OK, "DirectInput8Create returned %#lx\n", hr );
     hr = IDirectInput8_CreateDevice( di, &GUID_SysMouse, &device, NULL );
-    ok( hr == DI_OK, "CreateDevice returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &GUID_SysMouseEm );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
     guid = GUID_SysMouseEm;
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
     ok( IsEqualGUID( &guid, &GUID_SysMouseEm ), "got %s expected %s\n", debugstr_guid( &guid ),
         debugstr_guid( &GUID_SysMouseEm ) );
 
     hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &GUID_SysMouse );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
 
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
-    check_member( devinst, expect_devinst, "%d", dwSize );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
+    check_member( devinst, expect_devinst, "%lu", dwSize );
     check_member_guid( devinst, expect_devinst, guidInstance );
     check_member_guid( devinst, expect_devinst, guidProduct );
     todo_wine
-    check_member( devinst, expect_devinst, "%#x", dwDevType );
+    check_member( devinst, expect_devinst, "%#lx", dwDevType );
     if (!localized) check_member_wstr( devinst, expect_devinst, tszInstanceName );
     if (!localized) todo_wine check_member_wstr( devinst, expect_devinst, tszProductName );
     check_member_guid( devinst, expect_devinst, guidFFDriver );
@@ -1305,201 +1305,201 @@ static void test_mouse_info(void)
 
     caps.dwSize = sizeof(DIDEVCAPS);
     hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-    ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
-    check_member( caps, expect_caps, "%d", dwSize );
-    check_member( caps, expect_caps, "%#x", dwFlags );
+    ok( hr == DI_OK, "GetCapabilities returned %#lx\n", hr );
+    check_member( caps, expect_caps, "%lu", dwSize );
+    check_member( caps, expect_caps, "%#lx", dwFlags );
     todo_wine
-    check_member( caps, expect_caps, "%#x", dwDevType );
-    check_member( caps, expect_caps, "%d", dwAxes );
-    ok( caps.dwButtons == 3 || caps.dwButtons == 5, "got dwButtons %d, expected 3 or 5\n", caps.dwButtons );
-    check_member( caps, expect_caps, "%d", dwPOVs );
-    check_member( caps, expect_caps, "%d", dwFFSamplePeriod );
-    check_member( caps, expect_caps, "%d", dwFFMinTimeResolution );
+    check_member( caps, expect_caps, "%#lx", dwDevType );
+    check_member( caps, expect_caps, "%lu", dwAxes );
+    ok( caps.dwButtons == 3 || caps.dwButtons == 5, "got dwButtons %ld, expected 3 or 5\n", caps.dwButtons );
+    check_member( caps, expect_caps, "%lu", dwPOVs );
+    check_member( caps, expect_caps, "%lu", dwFFSamplePeriod );
+    check_member( caps, expect_caps, "%lu", dwFFMinTimeResolution );
     todo_wine
-    check_member( caps, expect_caps, "%d", dwFirmwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFirmwareRevision );
     todo_wine
-    check_member( caps, expect_caps, "%d", dwHardwareRevision );
-    check_member( caps, expect_caps, "%d", dwFFDriverVersion );
+    check_member( caps, expect_caps, "%lu", dwHardwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFFDriverVersion );
 
     prop_dword.diph.dwHow = DIPH_BYOFFSET;
     prop_dword.diph.dwObj = DIMOFS_X;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_range.diph.dwHow = DIPH_BYOFFSET;
     prop_range.diph.dwObj = DIMOFS_X;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
+    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got %#x expected %#x\n", prop_dword.dwData, 0 );
+    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got %#lx expected %#x\n", prop_dword.dwData, 0 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#x\n", hr );
-    ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#lx\n", hr );
+    ok( prop_dword.dwData == 10000, "got %lu expected %u\n", prop_dword.dwData, 10000 );
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIMouse2 );
-    ok( hr == DI_OK, "SetDataFormat returned %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
+    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_TYPENAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph );
-    ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#x\n", hr );
+    ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#lx\n", hr );
     ok( !wcscmp( prop_string.wsz, L"" ), "got user %s\n", debugstr_w(prop_string.wsz) );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYOFFSET;
     prop_dword.diph.dwObj = DIMOFS_X;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
-    ok( prop_dword.dwData == 1, "got %d expected 1\n", prop_dword.dwData );
+    ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
+    ok( prop_dword.dwData == 1, "got %ld expected 1\n", prop_dword.dwData );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_range.lMin = 0xdeadbeef;
     prop_range.lMax = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#x\n", hr );
-    ok( prop_range.lMin == DIPROPRANGE_NOMIN, "got %d expected %d\n", prop_range.lMin, DIPROPRANGE_NOMIN );
-    ok( prop_range.lMax == DIPROPRANGE_NOMAX, "got %d expected %d\n", prop_range.lMax, DIPROPRANGE_NOMAX );
+    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
+    ok( prop_range.lMin == DIPROPRANGE_NOMIN, "got %ld expected %ld\n", prop_range.lMin, DIPROPRANGE_NOMIN );
+    ok( prop_range.lMax == DIPROPRANGE_NOMAX, "got %ld expected %ld\n", prop_range.lMax, DIPROPRANGE_NOMAX );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
 
     prop_string.diph.dwHow = DIPH_BYOFFSET;
     prop_string.diph.dwObj = DIMOFS_X;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_KEYNAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_KEYNAME returned %#lx\n", hr );
 
     prop_range.diph.dwHow = DIPH_DEVICE;
     prop_range.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
 
     res = 0;
     hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
-    ok( res == 3 + caps.dwButtons, "got %u expected %u\n", res, 3 + caps.dwButtons );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
+    ok( res == 3 + caps.dwButtons, "got %lu expected %lu\n", res, 3 + caps.dwButtons );
     check_objects_params.expect_count = 3 + caps.dwButtons;
     hr = IDirectInputDevice8_EnumObjects( device, check_objects, &check_objects_params, DIDFT_ALL );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
     ok( check_objects_params.index >= check_objects_params.expect_count, "missing %u objects\n",
         check_objects_params.expect_count - check_objects_params.index );
 
     objinst.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
     res = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
-    ok( hr == DIERR_UNSUPPORTED, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetObjectInfo returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, DIMOFS_Y, DIPH_BYOFFSET );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
-    check_member( objinst, expect_objects[1], "%u", dwSize );
+    check_member( objinst, expect_objects[1], "%lu", dwSize );
     check_member_guid( objinst, expect_objects[1], guidType );
-    check_member( objinst, expect_objects[1], "%#x", dwOfs );
-    check_member( objinst, expect_objects[1], "%#x", dwType );
-    check_member( objinst, expect_objects[1], "%#x", dwFlags );
+    check_member( objinst, expect_objects[1], "%#lx", dwOfs );
+    check_member( objinst, expect_objects[1], "%#lx", dwType );
+    check_member( objinst, expect_objects[1], "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_objects[1], tszName );
-    check_member( objinst, expect_objects[1], "%u", dwFFMaxForce );
-    check_member( objinst, expect_objects[1], "%u", dwFFForceResolution );
+    check_member( objinst, expect_objects[1], "%lu", dwFFMaxForce );
+    check_member( objinst, expect_objects[1], "%lu", dwFFForceResolution );
     check_member( objinst, expect_objects[1], "%u", wCollectionNumber );
     check_member( objinst, expect_objects[1], "%u", wDesignatorIndex );
     check_member( objinst, expect_objects[1], "%#04x", wUsagePage );
     check_member( objinst, expect_objects[1], "%#04x", wUsage );
-    check_member( objinst, expect_objects[1], "%#04x", dwDimension );
+    check_member( objinst, expect_objects[1], "%#lx", dwDimension );
     check_member( objinst, expect_objects[1], "%#04x", wExponent );
     check_member( objinst, expect_objects[1], "%u", wReportId );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 7, DIPH_BYOFFSET );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_TGLBUTTON | DIDFT_MAKEINSTANCE( 3 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 3 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
-    check_member( objinst, expect_objects[3], "%u", dwSize );
+    check_member( objinst, expect_objects[3], "%lu", dwSize );
     check_member_guid( objinst, expect_objects[3], guidType );
-    check_member( objinst, expect_objects[3], "%#x", dwOfs );
-    check_member( objinst, expect_objects[3], "%#x", dwType );
-    check_member( objinst, expect_objects[3], "%#x", dwFlags );
+    check_member( objinst, expect_objects[3], "%#lx", dwOfs );
+    check_member( objinst, expect_objects[3], "%#lx", dwType );
+    check_member( objinst, expect_objects[3], "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_objects[3], tszName );
-    check_member( objinst, expect_objects[3], "%u", dwFFMaxForce );
-    check_member( objinst, expect_objects[3], "%u", dwFFForceResolution );
+    check_member( objinst, expect_objects[3], "%lu", dwFFMaxForce );
+    check_member( objinst, expect_objects[3], "%lu", dwFFForceResolution );
     check_member( objinst, expect_objects[3], "%u", wCollectionNumber );
     check_member( objinst, expect_objects[3], "%u", wDesignatorIndex );
     check_member( objinst, expect_objects[3], "%#04x", wUsagePage );
     check_member( objinst, expect_objects[3], "%#04x", wUsage );
-    check_member( objinst, expect_objects[3], "%#04x", dwDimension );
+    check_member( objinst, expect_objects[3], "%#lx", dwDimension );
     check_member( objinst, expect_objects[3], "%#04x", wExponent );
     check_member( objinst, expect_objects[3], "%u", wReportId );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     ref = IDirectInput8_Release( di );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 }
 
 static void test_keyboard_info(void)
@@ -1616,31 +1616,31 @@ static void test_keyboard_info(void)
     localized = TRUE; /* Skip name tests, Wine sometimes succeeds depending on the host key names */
 
     hr = DirectInput8Create( instance, DIRECTINPUT_VERSION, &IID_IDirectInput8W, (void **)&di, NULL );
-    ok( hr == DI_OK, "DirectInput8Create returned %#x\n", hr );
+    ok( hr == DI_OK, "DirectInput8Create returned %#lx\n", hr );
     hr = IDirectInput8_CreateDevice( di, &GUID_SysKeyboard, &device, NULL );
-    ok( hr == DI_OK, "CreateDevice returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &GUID_SysKeyboardEm );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
     guid = GUID_SysKeyboardEm;
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
     ok( IsEqualGUID( &guid, &GUID_SysKeyboardEm ), "got %s expected %s\n", debugstr_guid( &guid ),
         debugstr_guid( &GUID_SysKeyboardEm ) );
 
     hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &GUID_SysKeyboard );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
 
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
-    check_member( devinst, expect_devinst, "%d", dwSize );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
+    check_member( devinst, expect_devinst, "%lu", dwSize );
     check_member_guid( devinst, expect_devinst, guidInstance );
     check_member_guid( devinst, expect_devinst, guidProduct );
-    check_member( devinst, expect_devinst, "%#x", dwDevType );
+    check_member( devinst, expect_devinst, "%#lx", dwDevType );
     if (!localized) check_member_wstr( devinst, expect_devinst, tszInstanceName );
     if (!localized) todo_wine check_member_wstr( devinst, expect_devinst, tszProductName );
     check_member_guid( devinst, expect_devinst, guidFFDriver );
@@ -1649,191 +1649,191 @@ static void test_keyboard_info(void)
 
     caps.dwSize = sizeof(DIDEVCAPS);
     hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-    ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
-    check_member( caps, expect_caps, "%d", dwSize );
-    check_member( caps, expect_caps, "%#x", dwFlags );
-    check_member( caps, expect_caps, "%#x", dwDevType );
-    check_member( caps, expect_caps, "%d", dwAxes );
+    ok( hr == DI_OK, "GetCapabilities returned %#lx\n", hr );
+    check_member( caps, expect_caps, "%lu", dwSize );
+    check_member( caps, expect_caps, "%#lx", dwFlags );
+    check_member( caps, expect_caps, "%#lx", dwDevType );
+    check_member( caps, expect_caps, "%lu", dwAxes );
     todo_wine
-    check_member( caps, expect_caps, "%d", dwButtons );
-    check_member( caps, expect_caps, "%d", dwPOVs );
-    check_member( caps, expect_caps, "%d", dwFFSamplePeriod );
-    check_member( caps, expect_caps, "%d", dwFFMinTimeResolution );
+    check_member( caps, expect_caps, "%lu", dwButtons );
+    check_member( caps, expect_caps, "%lu", dwPOVs );
+    check_member( caps, expect_caps, "%lu", dwFFSamplePeriod );
+    check_member( caps, expect_caps, "%lu", dwFFMinTimeResolution );
     todo_wine
-    check_member( caps, expect_caps, "%d", dwFirmwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFirmwareRevision );
     todo_wine
-    check_member( caps, expect_caps, "%d", dwHardwareRevision );
-    check_member( caps, expect_caps, "%d", dwFFDriverVersion );
+    check_member( caps, expect_caps, "%lu", dwHardwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFFDriverVersion );
 
     prop_dword.diph.dwHow = DIPH_BYOFFSET;
     prop_dword.diph.dwObj = 1;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_range.diph.dwHow = DIPH_BYOFFSET;
     prop_range.diph.dwObj = 1;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
+    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got %#x expected %#x\n", prop_dword.dwData, 0 );
+    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got %#lx expected %#x\n", prop_dword.dwData, 0 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#x\n", hr );
-    ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#lx\n", hr );
+    ok( prop_dword.dwData == 10000, "got %lu expected %u\n", prop_dword.dwData, 10000 );
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIKeyboard );
-    ok( hr == DI_OK, "SetDataFormat returned %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
+    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_INSTANCENAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PRODUCTNAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_TYPENAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_TYPENAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph );
-    ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#x\n", hr );
+    ok( hr == S_FALSE, "GetProperty DIPROP_USERNAME returned %#lx\n", hr );
     ok( !wcscmp( prop_string.wsz, L"" ), "got user %s\n", debugstr_w(prop_string.wsz) );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_KEYBOARD_LCTRL, HID_USAGE_PAGE_KEYBOARD );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYOFFSET;
     prop_dword.diph.dwObj = 1;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_range.diph.dwHow = DIPH_BYOFFSET;
     prop_range.diph.dwObj = 1;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
 
     prop_range.diph.dwHow = DIPH_DEVICE;
     prop_range.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
 
     res = 0;
     hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
-    if (!localized) todo_wine ok( res == 127, "got %u expected %u\n", res, 127 );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
+    if (!localized) todo_wine ok( res == 127, "got %lu expected %u\n", res, 127 );
     hr = IDirectInputDevice8_EnumObjects( device, check_objects, &check_objects_params, DIDFT_ALL );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
     ok( check_objects_params.index >= check_objects_params.expect_count, "missing %u objects\n",
         check_objects_params.expect_count - check_objects_params.index );
 
     objinst.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
     res = MAKELONG( HID_USAGE_KEYBOARD_LCTRL, HID_USAGE_PAGE_KEYBOARD );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
-    ok( hr == DIERR_UNSUPPORTED, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetObjectInfo returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 2, DIPH_BYOFFSET );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
-    check_member( objinst, expect_objects[1], "%u", dwSize );
+    check_member( objinst, expect_objects[1], "%lu", dwSize );
     check_member_guid( objinst, expect_objects[1], guidType );
-    check_member( objinst, expect_objects[1], "%#x", dwOfs );
-    check_member( objinst, expect_objects[1], "%#x", dwType );
-    check_member( objinst, expect_objects[1], "%#x", dwFlags );
+    check_member( objinst, expect_objects[1], "%#lx", dwOfs );
+    check_member( objinst, expect_objects[1], "%#lx", dwType );
+    check_member( objinst, expect_objects[1], "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_objects[1], tszName );
-    check_member( objinst, expect_objects[1], "%u", dwFFMaxForce );
-    check_member( objinst, expect_objects[1], "%u", dwFFForceResolution );
+    check_member( objinst, expect_objects[1], "%lu", dwFFMaxForce );
+    check_member( objinst, expect_objects[1], "%lu", dwFFForceResolution );
     check_member( objinst, expect_objects[1], "%u", wCollectionNumber );
     check_member( objinst, expect_objects[1], "%u", wDesignatorIndex );
     check_member( objinst, expect_objects[1], "%#04x", wUsagePage );
     check_member( objinst, expect_objects[1], "%#04x", wUsage );
-    check_member( objinst, expect_objects[1], "%#04x", dwDimension );
+    check_member( objinst, expect_objects[1], "%#lx", dwDimension );
     check_member( objinst, expect_objects[1], "%#04x", wExponent );
     check_member( objinst, expect_objects[1], "%u", wReportId );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 423, DIPH_BYOFFSET );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_TGLBUTTON | DIDFT_MAKEINSTANCE( 3 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 3 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
-    check_member( objinst, expect_objects[2], "%u", dwSize );
+    check_member( objinst, expect_objects[2], "%lu", dwSize );
     check_member_guid( objinst, expect_objects[2], guidType );
-    check_member( objinst, expect_objects[2], "%#x", dwOfs );
-    check_member( objinst, expect_objects[2], "%#x", dwType );
-    check_member( objinst, expect_objects[2], "%#x", dwFlags );
+    check_member( objinst, expect_objects[2], "%#lx", dwOfs );
+    check_member( objinst, expect_objects[2], "%#lx", dwType );
+    check_member( objinst, expect_objects[2], "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_objects[2], tszName );
-    check_member( objinst, expect_objects[2], "%u", dwFFMaxForce );
-    check_member( objinst, expect_objects[2], "%u", dwFFForceResolution );
+    check_member( objinst, expect_objects[2], "%lu", dwFFMaxForce );
+    check_member( objinst, expect_objects[2], "%lu", dwFFForceResolution );
     check_member( objinst, expect_objects[2], "%u", wCollectionNumber );
     check_member( objinst, expect_objects[2], "%u", wDesignatorIndex );
     check_member( objinst, expect_objects[2], "%#04x", wUsagePage );
     check_member( objinst, expect_objects[2], "%#04x", wUsage );
-    check_member( objinst, expect_objects[2], "%#04x", dwDimension );
+    check_member( objinst, expect_objects[2], "%#lx", dwDimension );
     check_member( objinst, expect_objects[2], "%#04x", wExponent );
     check_member( objinst, expect_objects[2], "%u", wReportId );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     ref = IDirectInput8_Release( di );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 }
 
 START_TEST(device8)
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c
index ae5e43945eb..29d17ce378e 100644
--- a/dlls/dinput/tests/dinput.c
+++ b/dlls/dinput/tests/dinput.c
@@ -66,7 +66,7 @@ static HRESULT direct_input_create( DWORD version, IDirectInputA **out )
     HRESULT hr;
     if (version < 0x800) hr = DirectInputCreateA( hInstance, version, out, NULL );
     else hr = DirectInput8Create( hInstance, version, &IID_IDirectInput8A, (void **)out, NULL );
-    if (FAILED(hr)) win_skip( "Failed to instantiate a IDirectInput instance, hr %#x\n", hr );
+    if (FAILED(hr)) win_skip( "Failed to instantiate a IDirectInput instance, hr %#lx\n", hr );
     return hr;
 }
 
@@ -159,7 +159,7 @@ static void test_CoCreateInstance( DWORD version )
                                 &IID_IDirectInput8A, (void **)&dinput );
     if (FAILED(hr))
     {
-        win_skip( "Failed to instantiate a IDirectInput instance, hr %#x\n", hr );
+        win_skip( "Failed to instantiate a IDirectInput instance, hr %#lx\n", hr );
         return;
     }
 
@@ -167,7 +167,7 @@ static void test_CoCreateInstance( DWORD version )
                                                 &IID_IDirectInputA, (void **)&unknown );
     else hr = CoCreateInstance( &CLSID_DirectInput8, &outer, CLSCTX_INPROC_SERVER,
                                 &IID_IDirectInput8A, (void **)&unknown );
-    ok( hr == CLASS_E_NOAGGREGATION, "CoCreateInstance returned %#x\n", hr );
+    ok( hr == CLASS_E_NOAGGREGATION, "CoCreateInstance returned %#lx\n", hr );
     if (SUCCEEDED( hr )) IUnknown_Release( unknown );
 
     for (i = 0; i < ARRAY_SIZE(create_device_tests); i++)
@@ -176,7 +176,7 @@ static void test_CoCreateInstance( DWORD version )
         if (create_device_tests[i].pdev) device = (void *)0xdeadbeef;
         hr = IDirectInput_CreateDevice( dinput, create_device_tests[i].rguid,
                                         create_device_tests[i].pdev ? &device : NULL, NULL );
-        ok( hr == create_device_tests[i].expected_hr, "CreateDevice returned %#x\n", hr );
+        ok( hr == create_device_tests[i].expected_hr, "CreateDevice returned %#lx\n", hr );
         if (create_device_tests[i].pdev) ok( device == NULL, "got device %p\n", device );
         winetest_pop_context();
     }
@@ -186,33 +186,33 @@ static void test_CoCreateInstance( DWORD version )
         winetest_push_context( "%u", i );
         hr = IDirectInput_EnumDevices( dinput, enum_devices_tests[i].dwDevType,
                                        enum_devices_tests[i].lpCallback, NULL, enum_devices_tests[i].dwFlags );
-        ok( hr == enum_devices_tests[i].expected_hr, "EnumDevice returned %#x\n", hr );
+        ok( hr == enum_devices_tests[i].expected_hr, "EnumDevice returned %#lx\n", hr );
         winetest_pop_context();
     }
 
     hr = IDirectInput_GetDeviceStatus( dinput, NULL );
-    ok( hr == E_POINTER, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetDeviceStatus returned %#lx\n", hr );
 
     hr = IDirectInput_GetDeviceStatus( dinput, &GUID_Unknown );
-    ok( hr == DIERR_NOTINITIALIZED, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "GetDeviceStatus returned %#lx\n", hr );
 
     hr = IDirectInput_GetDeviceStatus( dinput, &GUID_SysMouse );
-    ok( hr == DIERR_NOTINITIALIZED, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "GetDeviceStatus returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, NULL, 0 );
-    ok( hr == DIERR_NOTINITIALIZED, "RunControlPanel returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "RunControlPanel returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, NULL, ~0u );
-    ok( hr == DIERR_INVALIDPARAM, "RunControlPanel returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "RunControlPanel returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, (HWND)0xdeadbeef, 0 );
-    ok( hr == E_HANDLE, "RunControlPanel returned %#x\n", hr );
+    ok( hr == E_HANDLE, "RunControlPanel returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, (HWND)0xdeadbeef, ~0u );
-    ok( hr == E_HANDLE, "RunControlPanel returned %#x\n", hr );
+    ok( hr == E_HANDLE, "RunControlPanel returned %#lx\n", hr );
 
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 }
 
 static void test_DirectInputCreate( DWORD version )
@@ -249,7 +249,7 @@ static void test_DirectInputCreate( DWORD version )
 
     unknown = (void *)0xdeadbeef;
     hr = DirectInputCreateW( hInstance, version, (IDirectInputW **)&unknown, &outer );
-    ok( hr == DI_OK, "DirectInputCreateW returned %#x\n", hr );
+    ok( hr == DI_OK, "DirectInputCreateW returned %#lx\n", hr );
     ok( unknown == NULL, "got IUnknown %p\n", unknown );
 
     for (i = 0; i < ARRAY_SIZE(create_tests); i++)
@@ -258,7 +258,7 @@ static void test_DirectInputCreate( DWORD version )
         unknown = (void *)0xdeadbeef;
         hr = DirectInputCreateW( create_tests[i].instance, create_tests[i].version, (IDirectInputW **)create_tests[i].out, NULL );
         todo_wine_if(i == 3 && version == 0x300)
-        ok( hr == create_tests[i].expected_hr, "DirectInputCreateEx returned %#x\n", hr );
+        ok( hr == create_tests[i].expected_hr, "DirectInputCreateEx returned %#lx\n", hr );
         if (SUCCEEDED(hr)) IUnknown_Release( unknown );
         else ok( unknown == create_tests[i].expect_out, "got IUnknown %p\n", unknown );
         winetest_pop_context();
@@ -321,7 +321,7 @@ static void test_DirectInputCreateEx( DWORD version )
 
     unknown = (void *)0xdeadbeef;
     hr = pDirectInputCreateEx( hInstance, version, &IID_IDirectInputW, (void **)&unknown, &outer );
-    ok( hr == DI_OK, "DirectInputCreateW returned %#x\n", hr );
+    ok( hr == DI_OK, "DirectInputCreateW returned %#lx\n", hr );
     ok( unknown == NULL, "got IUnknown %p\n", unknown );
 
     for (i = 0; i < ARRAY_SIZE(create_tests); i++)
@@ -331,7 +331,7 @@ static void test_DirectInputCreateEx( DWORD version )
         hr = pDirectInputCreateEx( create_tests[i].instance, create_tests[i].version, create_tests[i].iid,
                                    (void **)create_tests[i].out, NULL );
         todo_wine_if( version == 0x300 && i == 7 )
-        ok( hr == create_tests[i].expected_hr, "DirectInputCreateEx returned %#x\n", hr );
+        ok( hr == create_tests[i].expected_hr, "DirectInputCreateEx returned %#lx\n", hr );
         if (SUCCEEDED(hr)) IUnknown_Release( unknown );
         else ok( unknown == create_tests[i].expect_out, "got IUnknown %p\n", unknown );
         winetest_pop_context();
@@ -342,7 +342,7 @@ static void test_DirectInputCreateEx( DWORD version )
         winetest_push_context( "%u", i );
         unknown = (void *)0xdeadbeef;
         hr = pDirectInputCreateEx( hInstance, version, dinput8_interfaces[i], (void **)&unknown, NULL );
-        ok( hr == DIERR_NOINTERFACE, "DirectInputCreateEx returned %#x\n", hr );
+        ok( hr == DIERR_NOINTERFACE, "DirectInputCreateEx returned %#lx\n", hr );
         ok( unknown == (void *)0xdeadbeef, "got IUnknown %p\n", unknown );
         winetest_pop_context();
     }
@@ -352,8 +352,8 @@ static void test_DirectInputCreateEx( DWORD version )
         winetest_push_context( "%u", i );
         unknown = NULL;
         hr = pDirectInputCreateEx( hInstance, version, dinput7_interfaces[i], (void **)&unknown, NULL );
-        if (version < 0x800) ok( hr == DI_OK, "DirectInputCreateEx returned %#x\n", hr );
-        else ok( hr == DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateEx returned %#x\n", hr );
+        if (version < 0x800) ok( hr == DI_OK, "DirectInputCreateEx returned %#lx\n", hr );
+        else ok( hr == DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateEx returned %#lx\n", hr );
         if (version < 0x800) ok( unknown != NULL, "got IUnknown NULL\n" );
         else ok( unknown == NULL, "got IUnknown %p\n", unknown );
         if (unknown) IUnknown_Release( unknown );
@@ -411,7 +411,7 @@ static void test_DirectInput8Create( DWORD version )
 
     unknown = (void *)0xdeadbeef;
     hr = DirectInput8Create( hInstance, version, &IID_IDirectInput8W, (void **)&unknown, &outer );
-    ok( hr == DI_OK, "DirectInputCreateW returned %#x\n", hr );
+    ok( hr == DI_OK, "DirectInputCreateW returned %#lx\n", hr );
     ok( unknown == NULL, "got IUnknown %p\n", unknown );
 
     for (i = 0; i < ARRAY_SIZE(create_tests); i++)
@@ -420,7 +420,7 @@ static void test_DirectInput8Create( DWORD version )
         unknown = (void *)0xdeadbeef;
         hr = DirectInput8Create( create_tests[i].instance, create_tests[i].version, create_tests[i].iid,
                                  (void **)create_tests[i].out, NULL );
-        ok( hr == create_tests[i].expected_hr, "DirectInput8Create returned %#x\n", hr );
+        ok( hr == create_tests[i].expected_hr, "DirectInput8Create returned %#lx\n", hr );
         if (SUCCEEDED(hr)) IUnknown_Release( unknown );
         else ok( unknown == create_tests[i].expect_out, "got IUnknown %p\n", unknown );
         winetest_pop_context();
@@ -431,7 +431,7 @@ static void test_DirectInput8Create( DWORD version )
         winetest_push_context( "%u", i );
         unknown = (void *)0xdeadbeef;
         hr = DirectInput8Create( hInstance, version, dinput7_interfaces[i], (void **)&unknown, NULL );
-        ok( hr == DIERR_NOINTERFACE, "DirectInput8Create returned %#x\n", hr );
+        ok( hr == DIERR_NOINTERFACE, "DirectInput8Create returned %#lx\n", hr );
         ok( unknown == NULL, "got IUnknown %p\n", unknown );
         winetest_pop_context();
     }
@@ -441,9 +441,9 @@ static void test_DirectInput8Create( DWORD version )
         winetest_push_context( "%u", i );
         unknown = NULL;
         hr = DirectInput8Create( hInstance, version, dinput8_interfaces[i], (void **)&unknown, NULL );
-        if (i == 2) ok( hr == DIERR_NOINTERFACE, "DirectInput8Create returned %#x\n", hr );
-        else if (version == 0x800) ok( hr == DI_OK, "DirectInput8Create returned %#x\n", hr );
-        else ok( hr == DIERR_BETADIRECTINPUTVERSION, "DirectInput8Create returned %#x\n", hr );
+        if (i == 2) ok( hr == DIERR_NOINTERFACE, "DirectInput8Create returned %#lx\n", hr );
+        else if (version == 0x800) ok( hr == DI_OK, "DirectInput8Create returned %#lx\n", hr );
+        else ok( hr == DIERR_BETADIRECTINPUTVERSION, "DirectInput8Create returned %#lx\n", hr );
         if (i == 2) ok( unknown == NULL, "got IUnknown %p\n", unknown );
         else if (version == 0x800) ok( unknown != NULL, "got NULL IUnknown\n" );
         else ok( unknown == NULL, "got IUnknown %p\n", unknown );
@@ -463,21 +463,21 @@ static void test_QueryInterface( DWORD version )
     if (FAILED(hr = direct_input_create( version, &dinput ))) return;
 
     hr = IDirectInput_QueryInterface( dinput, NULL, NULL );
-    ok( hr == E_POINTER, "QueryInterface returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "QueryInterface returned %#lx\n", hr );
 
     iface = (void *)0xdeadbeef;
     hr = IDirectInput_QueryInterface( dinput, NULL, (void **)&iface );
-    ok( hr == E_POINTER, "QueryInterface returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "QueryInterface returned %#lx\n", hr );
     ok( iface == (void *)0xdeadbeef, "Output interface pointer is %p\n", iface );
 
     hr = IDirectInput_QueryInterface( dinput, &IID_IUnknown, NULL );
-    ok( hr == E_POINTER, "QueryInterface returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "QueryInterface returned %#lx\n", hr );
 
     hr = IDirectInput_QueryInterface( dinput, &IID_IUnknown, (void **)&iface );
-    ok( hr == S_OK, "QueryInterface returned 0x%08x\n", hr );
+    ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
     ok( iface != NULL, "got iface NULL\n" );
     ref = IUnknown_Release( iface );
-    ok( ref == 1, "Release returned %u\n", ref );
+    ok( ref == 1, "Release returned %lu\n", ref );
 
     for (i = 0; i < ARRAY_SIZE(dinput7_interfaces); i++)
     {
@@ -486,15 +486,15 @@ static void test_QueryInterface( DWORD version )
         hr = IDirectInput_QueryInterface( dinput, dinput7_interfaces[i], (void **)&iface );
         if (version >= 0x800)
         {
-            ok( hr == E_NOINTERFACE, "QueryInterface returned 0x%08x\n", hr );
+            ok( hr == E_NOINTERFACE, "QueryInterface returned %#lx\n", hr );
             ok( iface == NULL, "got iface %p\n", iface );
         }
         else
         {
-            ok( hr == S_OK, "QueryInterface returned 0x%08x\n", hr );
+            ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
             ok( iface != NULL, "got iface NULL\n" );
             ref = IUnknown_Release( iface );
-            ok( ref == 1, "Release returned %u\n", ref );
+            ok( ref == 1, "Release returned %lu\n", ref );
         }
         winetest_pop_context();
     }
@@ -507,16 +507,16 @@ static void test_QueryInterface( DWORD version )
         if (version < 0x800)
         {
             todo_wine_if(i == 2)
-            ok( hr == E_NOINTERFACE, "QueryInterface returned 0x%08x\n", hr );
+            ok( hr == E_NOINTERFACE, "QueryInterface returned %#lx\n", hr );
             todo_wine_if(i == 2)
             ok( iface == NULL, "got iface %p\n", iface );
         }
         else
         {
-            ok( hr == S_OK, "QueryInterface returned 0x%08x\n", hr );
+            ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
             ok( iface != NULL, "got iface NULL\n" );
             ref = IUnknown_Release( iface );
-            ok( ref == 1, "Release returned %u\n", ref );
+            ok( ref == 1, "Release returned %lu\n", ref );
         }
         winetest_pop_context();
     }
@@ -524,29 +524,29 @@ static void test_QueryInterface( DWORD version )
     if (version < 0x800)
     {
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInputA, (void **)&iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputA) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputA) failed: %#lx\n", hr );
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInput2A, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput2A) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput2A) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IID_IDirectInput2A iface differs from IID_IDirectInputA\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInput7A, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput7A) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput7A) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IID_IDirectInput7A iface differs from IID_IDirectInputA\n" );
         IUnknown_Release( tmp_iface );
         IUnknown_Release( iface );
 
         hr = IUnknown_QueryInterface( dinput, &IID_IUnknown, (void **)&iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IUnknown) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IUnknown) failed: %#lx\n", hr );
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInputW, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputW) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInputW) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IID_IDirectInputW iface differs from IID_IUnknown\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInput2W, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput2W) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput2W) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IID_IDirectInput2W iface differs from IID_IUnknown\n" );
         IUnknown_Release( tmp_iface );
         hr = IUnknown_QueryInterface( dinput, &IID_IDirectInput7W, (void **)&tmp_iface );
-        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput7W) failed: %08x\n", hr );
+        ok( SUCCEEDED(hr), "IUnknown_QueryInterface(IID_IDirectInput7W) failed: %#lx\n", hr );
         ok( tmp_iface == iface, "IID_IDirectInput7W iface differs from IID_IUnknown\n" );
         IUnknown_Release( tmp_iface );
         IUnknown_Release( iface );
@@ -554,7 +554,7 @@ static void test_QueryInterface( DWORD version )
 
     ref = IDirectInput_Release( dinput );
     todo_wine_if( version < 0x800 )
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 static void test_CreateDevice( DWORD version )
@@ -567,31 +567,31 @@ static void test_CreateDevice( DWORD version )
     if (FAILED(hr = direct_input_create( version, &dinput ))) return;
 
     hr = IDirectInput_CreateDevice( dinput, NULL, NULL, NULL );
-    ok( hr == E_POINTER, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
 
     device = (void *)0xdeadbeef;
     hr = IDirectInput_CreateDevice( dinput, NULL, &device, NULL );
-    ok( hr == E_POINTER, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
     ok( device == NULL, "Output interface pointer is %p\n", device );
 
     hr = IDirectInput_CreateDevice( dinput, &GUID_Unknown, NULL, NULL );
-    ok( hr == E_POINTER, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
 
     device = (void *)0xdeadbeef;
     hr = IDirectInput_CreateDevice( dinput, &GUID_Unknown, &device, NULL );
-    ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned %#lx\n", hr );
     ok( device == NULL, "Output interface pointer is %p\n", device );
 
     hr = IDirectInput_CreateDevice( dinput, &GUID_SysMouse, NULL, NULL );
-    ok( hr == E_POINTER, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
 
     hr = IDirectInput_CreateDevice( dinput, &GUID_SysMouse, &device, NULL );
-    ok( hr == DI_OK, "CreateDevice returned 0x%08x\n", hr );
+    ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
     ref = IDirectInputDevice_Release( device );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 struct enum_devices_test
@@ -613,7 +613,7 @@ static BOOL CALLBACK enum_devices_callback(const DIDEVICEINSTANCEA *instance, vo
         trace( "---- Device Information ----\n"
                "Product Name  : %s\n"
                "Instance Name : %s\n"
-               "devType       : 0x%08x\n"
+               "devType       : 0x%#lx\n"
                "GUID Product  : %s\n"
                "GUID Instance : %s\n"
                "HID Page      : 0x%04x\n"
@@ -677,52 +677,52 @@ static void test_EnumDevices( DWORD version )
     if (FAILED(hr = direct_input_create( version, &dinput ))) return;
 
     hr = IDirectInput_EnumDevices( dinput, 0, NULL, NULL, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     hr = IDirectInput_EnumDevices( dinput, 0, NULL, NULL, ~0u );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     /* Test crashes on Wine. */
     if (0)
     {
         hr = IDirectInput_EnumDevices( dinput, 0, enum_devices_callback, NULL, ~0u );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
     }
 
     hr = IDirectInput_EnumDevices( dinput, 0xdeadbeef, NULL, NULL, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     hr = IDirectInput_EnumDevices( dinput, 0xdeadbeef, NULL, NULL, ~0u );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     hr = IDirectInput_EnumDevices( dinput, 0xdeadbeef, enum_devices_callback, NULL, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     hr = IDirectInput_EnumDevices( dinput, 0xdeadbeef, enum_devices_callback, NULL, ~0u );
-    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned %#lx\n", hr );
 
     enum_test.device_count = 0;
     enum_test.return_value = DIENUM_CONTINUE;
     hr = IDirectInput_EnumDevices( dinput, 0, enum_devices_callback, &enum_test, 0 );
-    ok( hr == DI_OK, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DI_OK, "EnumDevices returned %#lx\n", hr );
     ok(enum_test.device_count != 0, "Device count is %u\n", enum_test.device_count);
 
     /* Enumeration only stops with an explicit DIENUM_STOP. */
     enum_test_return.device_count = 0;
     enum_test_return.return_value = 42;
     hr = IDirectInput_EnumDevices( dinput, 0, enum_devices_callback, &enum_test_return, 0 );
-    ok( hr == DI_OK, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DI_OK, "EnumDevices returned %#lx\n", hr );
     ok(enum_test_return.device_count == enum_test.device_count,
        "Device count is %u vs. %u\n", enum_test_return.device_count, enum_test.device_count);
 
     enum_test.device_count = 0;
     enum_test.return_value = DIENUM_STOP;
     hr = IDirectInput_EnumDevices( dinput, 0, enum_devices_callback, &enum_test, 0 );
-    ok( hr == DI_OK, "EnumDevices returned 0x%08x\n", hr );
+    ok( hr == DI_OK, "EnumDevices returned %#lx\n", hr );
     ok(enum_test.device_count == 1, "Device count is %u\n", enum_test.device_count);
 
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 static void test_GetDeviceStatus( DWORD version )
@@ -734,17 +734,17 @@ static void test_GetDeviceStatus( DWORD version )
     if (FAILED(hr = direct_input_create( version, &dinput ))) return;
 
     hr = IDirectInput_GetDeviceStatus( dinput, NULL );
-    ok( hr == E_POINTER, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetDeviceStatus returned %#lx\n", hr );
 
     hr = IDirectInput_GetDeviceStatus( dinput, &GUID_Unknown );
     todo_wine
-    ok( hr == DIERR_DEVICENOTREG, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "GetDeviceStatus returned %#lx\n", hr );
 
     hr = IDirectInput_GetDeviceStatus( dinput, &GUID_SysMouse );
-    ok( hr == DI_OK, "GetDeviceStatus returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceStatus returned %#lx\n", hr );
 
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 static void test_Initialize( DWORD version )
@@ -756,28 +756,28 @@ static void test_Initialize( DWORD version )
     if (FAILED(hr = direct_input_create( version, &dinput ))) return;
 
     hr = IDirectInput_Initialize( dinput, NULL, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInput_Initialize( dinput, NULL, version );
-    if (version == 0x300) todo_wine ok( hr == S_OK, "Initialize returned %#x\n", hr );
-    else ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr );
+    if (version == 0x300) todo_wine ok( hr == S_OK, "Initialize returned %#lx\n", hr );
+    else ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInput_Initialize( dinput, hInstance, 0 );
-    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInput_Initialize( dinput, hInstance, version - 1 );
-    ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInput_Initialize( dinput, hInstance, version + 1 );
-    if (version >= 0x700) ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
-    else ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+    if (version >= 0x700) ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
+    else ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
 
     /* Parameters are still validated after successful initialization. */
     hr = IDirectInput_Initialize( dinput, hInstance, 0 );
-    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#lx\n", hr );
 
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 static void test_RunControlPanel( DWORD version )
@@ -791,23 +791,23 @@ static void test_RunControlPanel( DWORD version )
     if (winetest_interactive)
     {
         hr = IDirectInput_RunControlPanel( dinput, NULL, 0 );
-        ok( hr == S_OK, "RunControlPanel returned %#x\n", hr );
+        ok( hr == S_OK, "RunControlPanel returned %#lx\n", hr );
 
         hr = IDirectInput_RunControlPanel( dinput, GetDesktopWindow(), 0 );
-        ok( hr == S_OK, "RunControlPanel returned %#x\n", hr );
+        ok( hr == S_OK, "RunControlPanel returned %#lx\n", hr );
     }
 
     hr = IDirectInput_RunControlPanel( dinput, NULL, ~0u );
-    ok( hr == DIERR_INVALIDPARAM, "RunControlPanel returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "RunControlPanel returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, (HWND)0xdeadbeef, 0 );
-    ok( hr == E_HANDLE, "RunControlPanel returned %#x\n", hr );
+    ok( hr == E_HANDLE, "RunControlPanel returned %#lx\n", hr );
 
     hr = IDirectInput_RunControlPanel( dinput, (HWND)0xdeadbeef, ~0u );
-    ok( hr == E_HANDLE, "RunControlPanel returned %#x\n", hr );
+    ok( hr == E_HANDLE, "RunControlPanel returned %#lx\n", hr );
 
     ref = IDirectInput_Release( dinput );
-    ok( ref == 0, "Release returned %u\n", ref );
+    ok( ref == 0, "Release returned %lu\n", ref );
 }
 
 static void test_DirectInputJoyConfig8(void)
@@ -822,14 +822,14 @@ static void test_DirectInputJoyConfig8(void)
     hr = DirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &pDI, NULL);
     if (FAILED(hr))
     {
-        win_skip("Failed to instantiate a IDirectInputA instance: 0x%08x\n", hr);
+        win_skip("Failed to instantiate a IDirectInputA instance: 0x%#lx\n", hr);
         return;
     }
 
     hr = IDirectInput_QueryInterface(pDI, &IID_IDirectInputJoyConfig8, (void **)&pDIJC);
     if (FAILED(hr))
     {
-        win_skip("Failed to instantiate a IDirectInputJoyConfig8 instance: 0x%08x\n", hr);
+        win_skip("Failed to instantiate a IDirectInputJoyConfig8 instance: 0x%#lx\n", hr);
         return;
     }
 
@@ -843,12 +843,12 @@ static void test_DirectInputJoyConfig8(void)
         hr = IDirectInputJoyConfig8_GetConfig(pDIJC, i, &info, DIJC_GUIDINSTANCE);
 
         ok (hr == DI_OK || hr == DIERR_NOMOREITEMS,
-           "IDirectInputJoyConfig8_GetConfig returned 0x%08x\n", hr);
+           "IDirectInputJoyConfig8_GetConfig returned %#lx\n", hr);
 
         if (SUCCEEDED(hr))
         {
             hr = IDirectInput_CreateDevice(pDI, &info.guidInstance, &pDID, NULL);
-            ok( SUCCEEDED(hr), "CreateDevice failed with guid from GetConfig hr = 0x%08x\n", hr );
+            ok( SUCCEEDED(hr), "CreateDevice failed with guid from GetConfig hr = 0x%#lx\n", hr );
             IDirectInputDevice_Release(pDID);
         }
     }
@@ -896,7 +896,7 @@ static BOOL CALLBACK enum_semantics_callback( const DIDEVICEINSTANCEA *lpddi, ID
         data->first_remaining = dwRemaining;
     }
     ok( dwRemaining == data->first_remaining - data->device_count,
-        "enum semantics remaining devices is wrong, expected %d, had %d\n",
+        "enum semantics remaining devices is wrong, expected %ld, had %ld\n",
         data->first_remaining - data->device_count, dwRemaining );
     data->device_count++;
 
@@ -916,10 +916,10 @@ static BOOL CALLBACK set_action_map_callback( const DIDEVICEINSTANCEA *lpddi, ID
     /* Building and setting an action map */
     /* It should not use any pre-stored mappings so we use DIDBAM_INITIALIZE */
     hr = IDirectInputDevice8_BuildActionMap( lpdid, data->action_format, NULL, DIDBAM_INITIALIZE );
-    ok( SUCCEEDED(hr), "BuildActionMap failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "BuildActionMap failed hr=%#lx\n", hr );
 
     hr = IDirectInputDevice8_SetActionMap( lpdid, data->action_format, data->username, 0 );
-    ok( SUCCEEDED(hr), "SetActionMap failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "SetActionMap failed hr=%#lx\n", hr );
 
     return DIENUM_CONTINUE;
 }
@@ -936,7 +936,7 @@ static void test_EnumDevicesBySemantics(void)
     hr = DirectInput8Create( hInstance, 0x800, &IID_IDirectInput8A, (void **)&dinput, NULL );
     if (FAILED(hr))
     {
-        win_skip( "Failed to instantiate a IDirectInputA instance: 0x%08x\n", hr );
+        win_skip( "Failed to instantiate a IDirectInputA instance: 0x%#lx\n", hr );
         return;
     }
 
@@ -956,7 +956,7 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, enum_semantics_callback,
                                                &data, DIEDBSFL_ATTACHEDONLY );
-    ok( data.device_count > 0, "EnumDevicesBySemantics did not call the callback hr=%08x\n", hr );
+    ok( data.device_count > 0, "EnumDevicesBySemantics did not call the callback hr=%#lx\n", hr );
     ok( data.keyboard, "EnumDevicesBySemantics should enumerate the keyboard\n" );
     ok( data.mouse, "EnumDevicesBySemantics should enumerate the mouse\n" );
 
@@ -966,7 +966,7 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, enum_semantics_callback,
                                                &data, DIEDBSFL_FORCEFEEDBACK );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( !data.keyboard, "Keyboard should not be enumerated when asking for forcefeedback\n" );
     ok( !data.mouse, "Mouse should not be enumerated when asking for forcefeedback\n" );
 
@@ -975,7 +975,7 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, enum_semantics_callback,
                                                &data, DIEDBSFL_AVAILABLEDEVICES );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count > 0,
         "There should be devices available before action mapping available=%d\n", data.device_count );
 
@@ -987,19 +987,19 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, "Sh4d0w M4g3", &action_format,
                                                enum_semantics_callback, &data, DIEDBSFL_THISUSER );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == 0, "No devices should be assigned for this user assigned=%d\n", data.device_count );
 
     /* This enumeration builds and sets the action map for all devices with a NULL username */
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, set_action_map_callback,
                                                &data, DIEDBSFL_ATTACHEDONLY );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr );
 
     /* After a successful action mapping we should have no devices available */
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, enum_semantics_callback,
                                                &data, DIEDBSFL_AVAILABLEDEVICES );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == 0, "No device should be available after action mapping available=%d\n",
         data.device_count );
 
@@ -1007,20 +1007,20 @@ static void test_EnumDevicesBySemantics(void)
     data.username = "Sh4d0w M4g3";
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, set_action_map_callback,
                                                &data, DIEDBSFL_ATTACHEDONLY );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%#lx\n", hr );
 
     /* Testing with the default user, DIEDBSFL_THISUSER has no effect */
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format,
                                                enum_semantics_callback, &data, DIEDBSFL_THISUSER );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == device_total, "THISUSER has no effect with NULL username owned=%d, expected=%d\n",
         data.device_count, device_total );
 
     /* Using an empty user string is the same as passing NULL, DIEDBSFL_THISUSER has no effect */
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, "", &action_format, enum_semantics_callback, &data, DIEDBSFL_THISUSER );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == device_total, "THISUSER has no effect with \"\" as username owned=%d, expected=%d\n",
         data.device_count, device_total );
 
@@ -1028,14 +1028,14 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, "Ninja Brian", &action_format,
                                                enum_semantics_callback, &data, DIEDBSFL_THISUSER );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == 0, "This user should own no devices owned=%d\n", data.device_count );
 
     /* Sh4d0w M4g3 has ownership of all devices */
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, "Sh4d0w M4g3", &action_format,
                                                enum_semantics_callback, &data, DIEDBSFL_THISUSER );
-    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr );
+    ok( SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%#lx\n", hr );
     ok( data.device_count == device_total, "This user should own %d devices owned=%d\n",
         device_total, data.device_count );
 
@@ -1044,7 +1044,7 @@ static void test_EnumDevicesBySemantics(void)
     data.device_count = 0;
     hr = IDirectInput8_EnumDevicesBySemantics( dinput, NULL, &action_format, enum_semantics_callback, NULL, 0 );
     todo_wine
-    ok( FAILED(hr), "EnumDevicesBySemantics succeeded with invalid GUID hr=%08x\n", hr );
+    ok( FAILED(hr), "EnumDevicesBySemantics succeeded with invalid GUID hr=%#lx\n", hr );
 
     IDirectInput8_Release( dinput );
 }
@@ -1065,7 +1065,7 @@ START_TEST(dinput)
 
     for (i = 0; i < ARRAY_SIZE(dinput_versions); i++)
     {
-        winetest_push_context( "%#x", dinput_versions[i] );
+        winetest_push_context( "%#lx", dinput_versions[i] );
         test_DirectInputCreate( dinput_versions[i] );
         test_DirectInputCreateEx( dinput_versions[i] );
         test_DirectInput8Create( dinput_versions[i] );
diff --git a/dlls/dinput/tests/driver_hid.c b/dlls/dinput/tests/driver_hid.c
index b8651331fda..55519d32215 100644
--- a/dlls/dinput/tests/driver_hid.c
+++ b/dlls/dinput/tests/driver_hid.c
@@ -117,16 +117,16 @@ static void expect_queue_reset( struct expect_queue *queue, void *buffer, unsign
     tmp = missing;
     while (tmp != missing_end)
     {
-        winetest_push_context( "%s expect[%d]", context, tmp - missing );
+        winetest_push_context( "%s expect[%Id]", context, tmp - missing );
         if (tmp->broken)
         {
             todo_wine_if( tmp->todo )
-            win_skip( "broken (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
+            win_skip( "broken (code %#lx id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
         }
         else
         {
             todo_wine_if( tmp->todo )
-            ok( tmp->wine_only, "missing (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
+            ok( tmp->wine_only, "missing (code %#lx id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
         }
         winetest_pop_context();
         tmp++;
@@ -236,24 +236,24 @@ static void expect_queue_next( struct expect_queue *queue, ULONG code, HID_XFER_
 
     ok( tmp != &queue->spurious, "%s got spurious packet\n", context );
 
-    winetest_push_context( "%s expect[%d]", context, tmp - queue->buffer );
+    winetest_push_context( "%s expect[%Id]", context, tmp - queue->buffer );
     todo_wine_if( tmp->todo )
-    ok( !tmp->wine_only, "found code %#x id %u len %u\n", tmp->code, tmp->report_id, tmp->report_len );
+    ok( !tmp->wine_only, "found code %#lx id %u len %u\n", tmp->code, tmp->report_id, tmp->report_len );
     winetest_pop_context();
 
     tmp = missing;
     while (tmp != missing_end)
     {
-        winetest_push_context( "%s expect[%d]", context, tmp - missing );
+        winetest_push_context( "%s expect[%Id]", context, tmp - missing );
         if (tmp->broken)
         {
             todo_wine_if( tmp->todo )
-            win_skip( "broken (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
+            win_skip( "broken (code %#lx id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
         }
         else
         {
             todo_wine_if( tmp->todo )
-            ok( tmp->wine_only, "missing (code %#x id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
+            ok( tmp->wine_only, "missing (code %#lx id %u len %u)\n", tmp->code, tmp->report_id, tmp->report_len );
         }
         winetest_pop_context();
         tmp++;
@@ -502,7 +502,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     KIRQL irql;
     LONG index;
 
-    if (winetest_debug > 1) trace( "ioctl %#x\n", code );
+    if (winetest_debug > 1) trace( "ioctl %#lx\n", code );
 
     ok( got_start_device, "expected IRP_MN_START_DEVICE before any ioctls\n" );
 
@@ -519,7 +519,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
         return STATUS_DELETE_PENDING;
     }
 
-    winetest_push_context( "id %d%s", report_id, polled ? " poll" : "" );
+    winetest_push_context( "id %ld%s", report_id, polled ? " poll" : "" );
 
     switch (code)
     {
@@ -527,8 +527,8 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     {
         HID_DESCRIPTOR *desc = irp->UserBuffer;
 
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == sizeof(*desc), "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == sizeof(*desc), "got output size %lu\n", out_size );
 
         if (out_size == sizeof(*desc))
         {
@@ -548,8 +548,8 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     }
 
     case IOCTL_HID_GET_REPORT_DESCRIPTOR:
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == report_descriptor_len, "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == report_descriptor_len, "got output size %lu\n", out_size );
 
         if (out_size == report_descriptor_len)
         {
@@ -560,8 +560,8 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
         break;
 
     case IOCTL_HID_GET_DEVICE_ATTRIBUTES:
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == sizeof(attributes), "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == sizeof(attributes), "got output size %lu\n", out_size );
 
         if (out_size == sizeof(attributes))
         {
@@ -574,8 +574,8 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     case IOCTL_HID_READ_REPORT:
     {
         ULONG expected_size = caps.InputReportByteLength - (report_id ? 0 : 1);
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == expected_size, "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == expected_size, "got output size %lu\n", out_size );
         ret = input_queue_read( &input_queue, irp );
         break;
     }
@@ -585,15 +585,15 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
         HID_XFER_PACKET *packet = irp->UserBuffer;
         ULONG expected_size = caps.OutputReportByteLength - (report_id ? 0 : 1);
 
-        ok( in_size == sizeof(*packet), "got input size %u\n", in_size );
-        ok( !out_size, "got output size %u\n", out_size );
-        ok( packet->reportBufferLen >= expected_size, "got report size %u\n", packet->reportBufferLen );
+        ok( in_size == sizeof(*packet), "got input size %lu\n", in_size );
+        ok( !out_size, "got output size %lu\n", out_size );
+        ok( packet->reportBufferLen >= expected_size, "got report size %lu\n", packet->reportBufferLen );
 
         expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) );
-        winetest_push_context( "%s expect[%d]", context, index );
-        ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code );
+        winetest_push_context( "%s expect[%ld]", context, index );
+        ok( code == expect.code, "got %#lx, expected %#lx\n", code, expect.code );
         ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId );
-        ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen == expect.report_len, "got len %lu\n", packet->reportBufferLen );
         check_buffer( packet, &expect );
         winetest_pop_context();
 
@@ -606,17 +606,17 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     {
         HID_XFER_PACKET *packet = irp->UserBuffer;
         ULONG expected_size = caps.InputReportByteLength - (report_id ? 0 : 1);
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == sizeof(*packet), "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == sizeof(*packet), "got output size %lu\n", out_size );
 
-        ok( packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen );
         ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
 
         expect_queue_next( &expect_queue, code, packet, &index, &expect, FALSE, context, sizeof(context) );
-        winetest_push_context( "%s expect[%d]", context, index );
-        ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code );
+        winetest_push_context( "%s expect[%ld]", context, index );
+        ok( code == expect.code, "got %#lx, expected %#lx\n", code, expect.code );
         ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId );
-        ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen == expect.report_len, "got len %lu\n", packet->reportBufferLen );
         winetest_pop_context();
 
         irp->IoStatus.Information = expect.ret_length ? expect.ret_length : expect.report_len;
@@ -629,17 +629,17 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     {
         HID_XFER_PACKET *packet = irp->UserBuffer;
         ULONG expected_size = caps.OutputReportByteLength - (report_id ? 0 : 1);
-        ok( in_size == sizeof(*packet), "got input size %u\n", in_size );
-        ok( !out_size, "got output size %u\n", out_size );
+        ok( in_size == sizeof(*packet), "got input size %lu\n", in_size );
+        ok( !out_size, "got output size %lu\n", out_size );
 
-        ok( packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen );
         ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
 
         expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) );
-        winetest_push_context( "%s expect[%d]", context, index );
-        ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code );
+        winetest_push_context( "%s expect[%ld]", context, index );
+        ok( code == expect.code, "got %#lx, expected %#lx\n", code, expect.code );
         ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId );
-        ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen == expect.report_len, "got len %lu\n", packet->reportBufferLen );
         check_buffer( packet, &expect );
         winetest_pop_context();
 
@@ -652,17 +652,17 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     {
         HID_XFER_PACKET *packet = irp->UserBuffer;
         ULONG expected_size = caps.FeatureReportByteLength - (report_id ? 0 : 1);
-        ok( !in_size, "got input size %u\n", in_size );
-        ok( out_size == sizeof(*packet), "got output size %u\n", out_size );
+        ok( !in_size, "got input size %lu\n", in_size );
+        ok( out_size == sizeof(*packet), "got output size %lu\n", out_size );
 
-        ok( packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen );
         ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
 
         expect_queue_next( &expect_queue, code, packet, &index, &expect, FALSE, context, sizeof(context) );
-        winetest_push_context( "%s expect[%d]", context, index );
-        ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code );
+        winetest_push_context( "%s expect[%ld]", context, index );
+        ok( code == expect.code, "got %#lx, expected %#lx\n", code, expect.code );
         ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId );
-        ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen == expect.report_len, "got len %lu\n", packet->reportBufferLen );
         winetest_pop_context();
 
         irp->IoStatus.Information = expect.ret_length ? expect.ret_length : expect.report_len;
@@ -675,17 +675,17 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     {
         HID_XFER_PACKET *packet = irp->UserBuffer;
         ULONG expected_size = caps.FeatureReportByteLength - (report_id ? 0 : 1);
-        ok( in_size == sizeof(*packet), "got input size %u\n", in_size );
-        ok( !out_size, "got output size %u\n", out_size );
+        ok( in_size == sizeof(*packet), "got input size %lu\n", in_size );
+        ok( !out_size, "got output size %lu\n", out_size );
 
-        ok( packet->reportBufferLen >= expected_size, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen >= expected_size, "got len %lu\n", packet->reportBufferLen );
         ok( !!packet->reportBuffer, "got buffer %p\n", packet->reportBuffer );
 
         expect_queue_next( &expect_queue, code, packet, &index, &expect, TRUE, context, sizeof(context) );
-        winetest_push_context( "%s expect[%d]", context, index );
-        ok( code == expect.code, "got %#x, expected %#x\n", code, expect.code );
+        winetest_push_context( "%s expect[%ld]", context, index );
+        ok( code == expect.code, "got %#lx, expected %#lx\n", code, expect.code );
         ok( packet->reportId == expect.report_id, "got id %u\n", packet->reportId );
-        ok( packet->reportBufferLen == expect.report_len, "got len %u\n", packet->reportBufferLen );
+        ok( packet->reportBufferLen == expect.report_len, "got len %lu\n", packet->reportBufferLen );
         check_buffer( packet, &expect );
         winetest_pop_context();
 
@@ -703,7 +703,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
     }
 
     default:
-        ok( 0, "unexpected ioctl %#x\n", code );
+        ok( 0, "unexpected ioctl %#lx\n", code );
         ret = STATUS_NOT_IMPLEMENTED;
     }
 
@@ -765,7 +765,7 @@ static NTSTATUS WINAPI driver_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *
     ok( ext->NextDeviceObject->AttachedDevice == fdo, "wrong attached device\n" );
 
     ret = IoRegisterDeviceInterface( ext->PhysicalDeviceObject, &control_class, NULL, &control_symlink );
-    ok( !ret, "got %#x\n", ret );
+    ok( !ret, "got %#lx\n", ret );
 
     fdo->Flags &= ~DO_DEVICE_INITIALIZING;
     return STATUS_SUCCESS;
@@ -815,7 +815,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
 
     InitializeObjectAttributes( &attr, registry, 0, NULL, NULL );
     ret = ZwOpenKey( &hkey, KEY_ALL_ACCESS, &attr );
-    ok( !ret, "ZwOpenKey returned %#x\n", ret );
+    ok( !ret, "ZwOpenKey returned %#lx\n", ret );
 
     buffer = ExAllocatePool( PagedPool, info_size + EXPECT_QUEUE_BUFFER_SIZE );
     ok( buffer != NULL, "ExAllocatePool failed\n" );
@@ -824,53 +824,53 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
     RtlInitUnicodeString( &name_str, L"ReportID" );
     size = info_size + sizeof(report_id);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( &report_id, buffer + info_size, size - info_size );
 
     RtlInitUnicodeString( &name_str, L"PolledMode" );
     size = info_size + sizeof(polled);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( &polled, buffer + info_size, size - info_size );
     params.DevicesArePolled = polled;
 
     RtlInitUnicodeString( &name_str, L"Descriptor" );
     size = info_size + sizeof(report_descriptor_buf);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( report_descriptor_buf, buffer + info_size, size - info_size );
     report_descriptor_len = size - info_size;
 
     RtlInitUnicodeString( &name_str, L"Attributes" );
     size = info_size + sizeof(attributes);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( &attributes, buffer + info_size, size - info_size );
 
     RtlInitUnicodeString( &name_str, L"Caps" );
     size = info_size + sizeof(caps);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( &caps, buffer + info_size, size - info_size );
 
     expect_queue_init( &expect_queue );
     RtlInitUnicodeString( &name_str, L"Expect" );
     size = info_size + EXPECT_QUEUE_BUFFER_SIZE;
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     expect_queue_reset( &expect_queue, buffer + info_size, size - info_size );
 
     input_queue_init( &input_queue );
     RtlInitUnicodeString( &name_str, L"Input" );
     size = info_size + EXPECT_QUEUE_BUFFER_SIZE;
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     input_queue_reset( &input_queue, buffer + info_size, size - info_size );
 
     RtlInitUnicodeString( &name_str, L"Context" );
     size = info_size + sizeof(expect_queue.context);
     ret = ZwQueryValueKey( hkey, &name_str, KeyValuePartialInformation, buffer, size, &size );
-    ok( !ret, "ZwQueryValueKey returned %#x\n", ret );
+    ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
     memcpy( expect_queue.context, buffer + info_size, size - info_size );
 
     driver->DriverExtension->AddDevice = driver_add_device;
@@ -885,7 +885,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
     ExFreePool( buffer );
 
     ret = HidRegisterMinidriver( &params );
-    ok( !ret, "got %#x\n", ret );
+    ok( !ret, "got %#lx\n", ret );
 
     hidclass_driver_ioctl = driver->MajorFunction[IRP_MJ_DEVICE_CONTROL];
     driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = driver_ioctl;
diff --git a/dlls/dinput/tests/driver_hid.h b/dlls/dinput/tests/driver_hid.h
index 963f7619b1f..089d12b70fc 100644
--- a/dlls/dinput/tests/driver_hid.h
+++ b/dlls/dinput/tests/driver_hid.h
@@ -61,8 +61,8 @@ struct winetest_shared_data
     int running_under_wine;
     int winetest_report_success;
     int winetest_debug;
-    int failures;
-    int todo_failures;
+    LONG failures;
+    LONG todo_failures;
 };
 
 #ifndef __WINE_WINE_TEST_H
@@ -238,7 +238,7 @@ static inline void winetest_cleanup_( const char *file )
 
     if (winetest_debug)
     {
-        kprintf( "%04x:%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
+        kprintf( "%04lx:%s: %ld tests executed (%ld marked as todo, %ld %s), %ld skipped.\n",
                  (DWORD)(DWORD_PTR)PsGetCurrentProcessId(), test_name,
                  successes + failures + todo_successes + todo_failures, todo_successes, failures + todo_failures,
                  (failures + todo_failures != 1) ? "failures" : "failure", skipped );
diff --git a/dlls/dinput/tests/force_feedback.c b/dlls/dinput/tests/force_feedback.c
index bc5161a9b63..e1b4f2e9e66 100644
--- a/dlls/dinput/tests/force_feedback.c
+++ b/dlls/dinput/tests/force_feedback.c
@@ -72,23 +72,23 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
     ok( params->index < params->expect_count, "unexpected extra object\n" );
     if (params->index >= params->expect_count) exp = &unexpected_obj;
 
-    check_member( *obj, *exp, "%u", dwSize );
+    check_member( *obj, *exp, "%lu", dwSize );
     todo_wine_if( todo->guid )
     check_member_guid( *obj, *exp, guidType );
     todo_wine_if( params->version < 0x700 && (obj->dwType & DIDFT_BUTTON) )
-    check_member( *obj, *exp, "%#x", dwOfs );
+    check_member( *obj, *exp, "%#lx", dwOfs );
     todo_wine_if( todo->type )
-    check_member( *obj, *exp, "%#x", dwType );
-    check_member( *obj, *exp, "%#x", dwFlags );
+    check_member( *obj, *exp, "%#lx", dwType );
+    check_member( *obj, *exp, "%#lx", dwFlags );
     if (!localized) todo_wine_if( todo->name ) check_member_wstr( *obj, *exp, tszName );
-    check_member( *obj, *exp, "%u", dwFFMaxForce );
-    check_member( *obj, *exp, "%u", dwFFForceResolution );
+    check_member( *obj, *exp, "%lu", dwFFMaxForce );
+    check_member( *obj, *exp, "%lu", dwFFForceResolution );
     check_member( *obj, *exp, "%u", wCollectionNumber );
     check_member( *obj, *exp, "%u", wDesignatorIndex );
     check_member( *obj, *exp, "%#04x", wUsagePage );
     todo_wine_if( todo->usage )
     check_member( *obj, *exp, "%#04x", wUsage );
-    check_member( *obj, *exp, "%#04x", dwDimension );
+    check_member( *obj, *exp, "%#lx", dwDimension );
     check_member( *obj, *exp, "%#04x", wExponent );
     check_member( *obj, *exp, "%u", wReportId );
 
@@ -116,11 +116,11 @@ static BOOL CALLBACK check_effects( const DIEFFECTINFOW *effect, void *args )
     ok( params->index < params->expect_count, "unexpected extra object\n" );
     if (params->index >= params->expect_count) exp = &unexpected_effect;
 
-    check_member( *effect, *exp, "%u", dwSize );
+    check_member( *effect, *exp, "%lu", dwSize );
     check_member_guid( *effect, *exp, guid );
-    check_member( *effect, *exp, "%#x", dwEffType );
-    check_member( *effect, *exp, "%#x", dwStaticParams );
-    check_member( *effect, *exp, "%#x", dwDynamicParams );
+    check_member( *effect, *exp, "%#lx", dwEffType );
+    check_member( *effect, *exp, "%#lx", dwStaticParams );
+    check_member( *effect, *exp, "%#lx", dwDynamicParams );
     check_member_wstr( *effect, *exp, tszName );
 
     winetest_pop_context();
@@ -158,7 +158,7 @@ static BOOL CALLBACK check_created_effect_objects( IDirectInputEffect *effect, v
 
     IDirectInputEffect_AddRef( effect );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 1, "got ref %u, expected 1\n", ref );
+    ok( ref == 1, "got ref %lu, expected 1\n", ref );
     return DIENUM_CONTINUE;
 }
 
@@ -179,111 +179,111 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst )
     if (version >= 0x800)
     {
         hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL );
-        ok( hr == DI_OK, "DirectInput8Create returned %#x\n", hr );
+        ok( hr == DI_OK, "DirectInput8Create returned %#lx\n", hr );
 
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, NULL, NULL, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, enum_device_count, &count, 0xdeadbeef );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput8_EnumDevices( di8, 0xdeadbeef, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 3, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 3, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_DEVICE, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_POINTER, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_KEYBOARD, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_GAMECTRL, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_FORCEFEEDBACK );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %u, expected 0\n", count );
-        else ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %lu, expected 0\n", count );
+        else ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff) + 1, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        if ((devinst->dwDevType & 0xff) != DI8DEVTYPE_SUPPLEMENTAL) ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        else ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        if ((devinst->dwDevType & 0xff) != DI8DEVTYPE_SUPPLEMENTAL) ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        else ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
     }
     else
     {
         hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL );
-        ok( hr == DI_OK, "DirectInputCreateEx returned %#x\n", hr );
+        ok( hr == DI_OK, "DirectInputCreateEx returned %#lx\n", hr );
 
         hr = IDirectInput_EnumDevices( di, 0, NULL, NULL, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, 0xdeadbeef );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0xdeadbeef, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 3, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 3, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_DEVICE, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_MOUSE, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_KEYBOARD, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_JOYSTICK, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_FORCEFEEDBACK );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %u, expected 0\n", count );
-        else ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %lu, expected 0\n", count );
+        else ok( count == 1, "got count %lu, expected 1\n", count );
 
         hr = IDirectInput_EnumDevices( di, 0x14, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
     }
 }
 
@@ -502,89 +502,89 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     GUID guid;
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL );
-    ok( hr == E_POINTER, "CreateEffect returned %#x\n", hr );
+    ok( hr == E_POINTER, "CreateEffect returned %#lx\n", hr );
     hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL );
-    ok( hr == E_POINTER, "CreateEffect returned %#x\n", hr );
+    ok( hr == E_POINTER, "CreateEffect returned %#lx\n", hr );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL );
-    ok( hr == DIERR_DEVICENOTREG, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "CreateEffect returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     if (hr != DI_OK) return;
 
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef );
-    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#lx\n", hr );
     check_params.expect_effect = effect;
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_created_effect_objects, &check_params, 0 );
-    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#x\n", hr );
-    ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count );
+    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#lx\n", hr );
+    ok( check_params.count == 1, "got count %lu, expected 1\n", check_params.count );
 
     hr = IDirectInputEffect_Initialize( effect, NULL, version, &GUID_Sine );
-    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#lx\n", hr );
     hr = IDirectInputEffect_Initialize( effect, instance, 0x800 - (version - 0x700), &GUID_Sine );
     if (version == 0x800)
     {
         todo_wine
-        ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+        ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
     }
     else
     {
         todo_wine
-        ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+        ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
     }
     hr = IDirectInputEffect_Initialize( effect, instance, 0, &GUID_Sine );
     todo_wine
-    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_NOTINITIALIZED, "Initialize returned %#lx\n", hr );
     hr = IDirectInputEffect_Initialize( effect, instance, version, NULL );
-    ok( hr == E_POINTER, "Initialize returned %#x\n", hr );
+    ok( hr == E_POINTER, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_NULL );
-    ok( hr == DIERR_DEVICENOTREG, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "Initialize returned %#lx\n", hr );
     hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_Sine );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
     hr = IDirectInputEffect_Initialize( effect, instance, version, &GUID_Square );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInputEffect_GetEffectGuid( effect, NULL );
-    ok( hr == E_POINTER, "GetEffectGuid returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetEffectGuid returned %#lx\n", hr );
     hr = IDirectInputEffect_GetEffectGuid( effect, &guid );
-    ok( hr == DI_OK, "GetEffectGuid returned %#x\n", hr );
+    ok( hr == DI_OK, "GetEffectGuid returned %#lx\n", hr );
     ok( IsEqualGUID( &guid, &GUID_Square ), "got guid %s, expected %s\n", debugstr_guid( &guid ),
         debugstr_guid( &GUID_Square ) );
 
     hr = IDirectInputEffect_GetParameters( effect, NULL, 0 );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, NULL, DIEP_DURATION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     desc.dwSize = sizeof(DIEFFECT_DX5) + 2;
     hr = IDirectInputEffect_GetParameters( effect, &desc, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     desc.dwSize = sizeof(DIEFFECT_DX5);
     hr = IDirectInputEffect_GetParameters( effect, &desc, 0 );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_STARTDELAY );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     desc.dwSize = sizeof(DIEFFECT_DX6);
     hr = IDirectInputEffect_GetParameters( effect, &desc, 0 );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DURATION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     desc.dwDuration = 0xdeadbeef;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DURATION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", dwDuration );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", dwDuration );
     memset( &desc, 0xcd, sizeof(desc) );
     desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5);
     desc.dwFlags = 0;
@@ -592,25 +592,25 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     flags = DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL |
             (version >= 0x700 ? DIEP_STARTDELAY : 0);
     hr = IDirectInputEffect_GetParameters( effect, &desc, flags );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", dwSamplePeriod );
-    check_member( desc, expect_desc_init, "%u", dwGain );
-    if (version >= 0x700) check_member( desc, expect_desc_init, "%u", dwStartDelay );
-    else ok( desc.dwStartDelay == 0xdeadbeef, "got dwStartDelay %#x\n", desc.dwStartDelay );
-    check_member( desc, expect_desc_init, "%u", dwTriggerRepeatInterval );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", dwSamplePeriod );
+    check_member( desc, expect_desc_init, "%lu", dwGain );
+    if (version >= 0x700) check_member( desc, expect_desc_init, "%lu", dwStartDelay );
+    else ok( desc.dwStartDelay == 0xdeadbeef, "got dwStartDelay %#lx\n", desc.dwStartDelay );
+    check_member( desc, expect_desc_init, "%lu", dwTriggerRepeatInterval );
 
     memset( &desc, 0xcd, sizeof(desc) );
     desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5);
     desc.dwFlags = 0;
     desc.lpEnvelope = NULL;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ENVELOPE );
-    ok( hr == E_POINTER, "GetParameters returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetParameters returned %#lx\n", hr );
     desc.lpEnvelope = &envelope;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ENVELOPE );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     envelope.dwSize = sizeof(DIENVELOPE);
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ENVELOPE );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
 
     desc.dwFlags = 0;
     desc.cAxes = 0;
@@ -620,183 +620,183 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     desc.cbTypeSpecificParams = 0;
     desc.lpvTypeSpecificParams = NULL;
     hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TRIGGERBUTTON );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     desc.dwFlags = DIEFF_OBJECTOFFSETS;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TRIGGERBUTTON );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%#x", dwTriggerButton );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%#lx", dwTriggerButton );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", cAxes );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
     desc.dwFlags = DIEFF_OBJECTIDS;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TRIGGERBUTTON );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%#x", dwTriggerButton );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%#lx", dwTriggerButton );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", cAxes );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
     desc.dwFlags |= DIEFF_CARTESIAN;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
     desc.dwFlags |= DIEFF_POLAR;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
     desc.dwFlags |= DIEFF_SPHERICAL;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", cAxes );
-    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
+    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
 
     desc.dwFlags |= DIEFF_SPHERICAL;
     desc.cAxes = 2;
     desc.rgdwAxes = axes;
     desc.rglDirection = directions;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES | DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", cAxes );
-    check_member( desc, expect_desc_init, "%u", rgdwAxes[0] );
-    check_member( desc, expect_desc_init, "%u", rgdwAxes[1] );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
+    check_member( desc, expect_desc_init, "%lu", rgdwAxes[0] );
+    check_member( desc, expect_desc_init, "%lu", rgdwAxes[1] );
     check_member( desc, expect_desc_init, "%p", rglDirection );
-    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
+    ok( desc.dwFlags == DIEFF_OBJECTIDS, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_OBJECTIDS );
 
     desc.dwFlags |= DIEFF_SPHERICAL;
     desc.lpEnvelope = &envelope;
     desc.cbTypeSpecificParams = sizeof(periodic);
     desc.lpvTypeSpecificParams = &periodic;
     hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc_init, "%u", dwDuration );
-    check_member( desc, expect_desc_init, "%u", dwSamplePeriod );
-    check_member( desc, expect_desc_init, "%u", dwGain );
-    check_member( desc, expect_desc_init, "%#x", dwTriggerButton );
-    check_member( desc, expect_desc_init, "%u", dwTriggerRepeatInterval );
-    check_member( desc, expect_desc_init, "%u", cAxes );
-    check_member( desc, expect_desc_init, "%u", rgdwAxes[0] );
-    check_member( desc, expect_desc_init, "%u", rgdwAxes[1] );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc_init, "%lu", dwDuration );
+    check_member( desc, expect_desc_init, "%lu", dwSamplePeriod );
+    check_member( desc, expect_desc_init, "%lu", dwGain );
+    check_member( desc, expect_desc_init, "%#lx", dwTriggerButton );
+    check_member( desc, expect_desc_init, "%lu", dwTriggerRepeatInterval );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
+    check_member( desc, expect_desc_init, "%lu", rgdwAxes[0] );
+    check_member( desc, expect_desc_init, "%lu", rgdwAxes[1] );
     check_member( desc, expect_desc_init, "%p", rglDirection );
     check_member( desc, expect_desc_init, "%p", lpEnvelope );
-    check_member( desc, expect_desc_init, "%u", cbTypeSpecificParams );
-    if (version >= 0x700) check_member( desc, expect_desc_init, "%u", dwStartDelay );
-    else ok( desc.dwStartDelay == 0xcdcdcdcd, "got dwStartDelay %#x\n", desc.dwStartDelay );
+    check_member( desc, expect_desc_init, "%lu", cbTypeSpecificParams );
+    if (version >= 0x700) check_member( desc, expect_desc_init, "%lu", dwStartDelay );
+    else ok( desc.dwStartDelay == 0xcdcdcdcd, "got dwStartDelay %#lx\n", desc.dwStartDelay );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Download returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Download returned %#lx\n", hr );
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     hr = IDirectInputEffect_SetParameters( effect, NULL, DIEP_NODOWNLOAD );
-    ok( hr == E_POINTER, "SetParameters returned %#x\n", hr );
+    ok( hr == E_POINTER, "SetParameters returned %#lx\n", hr );
     memset( &desc, 0, sizeof(desc) );
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     desc.dwSize = version >= 0x700 ? sizeof(DIEFFECT_DX6) : sizeof(DIEFFECT_DX5);
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DURATION | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     desc.dwTriggerButton = -1;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DURATION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", dwDuration );
-    check_member( desc, expect_desc_init, "%u", dwSamplePeriod );
-    check_member( desc, expect_desc_init, "%u", dwGain );
-    check_member( desc, expect_desc_init, "%#x", dwTriggerButton );
-    check_member( desc, expect_desc_init, "%u", dwTriggerRepeatInterval );
-    check_member( desc, expect_desc_init, "%u", cAxes );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", dwDuration );
+    check_member( desc, expect_desc_init, "%lu", dwSamplePeriod );
+    check_member( desc, expect_desc_init, "%lu", dwGain );
+    check_member( desc, expect_desc_init, "%#lx", dwTriggerButton );
+    check_member( desc, expect_desc_init, "%lu", dwTriggerRepeatInterval );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
     check_member( desc, expect_desc_init, "%p", rglDirection );
     check_member( desc, expect_desc_init, "%p", lpEnvelope );
-    check_member( desc, expect_desc_init, "%u", cbTypeSpecificParams );
-    check_member( desc, expect_desc_init, "%u", dwStartDelay );
+    check_member( desc, expect_desc_init, "%lu", cbTypeSpecificParams );
+    check_member( desc, expect_desc_init, "%lu", dwStartDelay );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     flags = DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL | DIEP_NODOWNLOAD;
     if (version >= 0x700) flags |= DIEP_STARTDELAY;
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, flags );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.dwDuration = 0;
     flags = DIEP_DURATION | DIEP_GAIN | DIEP_SAMPLEPERIOD | DIEP_TRIGGERREPEATINTERVAL;
     if (version >= 0x700) flags |= DIEP_STARTDELAY;
     hr = IDirectInputEffect_GetParameters( effect, &desc, flags );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", dwDuration );
-    check_member( desc, expect_desc, "%u", dwSamplePeriod );
-    check_member( desc, expect_desc, "%u", dwGain );
-    check_member( desc, expect_desc_init, "%#x", dwTriggerButton );
-    check_member( desc, expect_desc, "%u", dwTriggerRepeatInterval );
-    check_member( desc, expect_desc_init, "%u", cAxes );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", dwDuration );
+    check_member( desc, expect_desc, "%lu", dwSamplePeriod );
+    check_member( desc, expect_desc, "%lu", dwGain );
+    check_member( desc, expect_desc_init, "%#lx", dwTriggerButton );
+    check_member( desc, expect_desc, "%lu", dwTriggerRepeatInterval );
+    check_member( desc, expect_desc_init, "%lu", cAxes );
     check_member( desc, expect_desc_init, "%p", rglDirection );
     check_member( desc, expect_desc_init, "%p", lpEnvelope );
-    check_member( desc, expect_desc_init, "%u", cbTypeSpecificParams );
-    if (version >= 0x700) check_member( desc, expect_desc, "%u", dwStartDelay );
-    else ok( desc.dwStartDelay == 0, "got dwStartDelay %#x\n", desc.dwStartDelay );
+    check_member( desc, expect_desc_init, "%lu", cbTypeSpecificParams );
+    if (version >= 0x700) check_member( desc, expect_desc, "%lu", dwStartDelay );
+    else ok( desc.dwStartDelay == 0, "got dwStartDelay %#lx\n", desc.dwStartDelay );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     desc.lpEnvelope = NULL;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_ENVELOPE | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.lpEnvelope = &envelope;
     envelope.dwSize = 0;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_ENVELOPE | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
 
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_ENVELOPE | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     desc.lpEnvelope = &envelope;
     envelope.dwSize = sizeof(DIENVELOPE);
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_ENVELOPE );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( envelope, expect_envelope, "%u", dwAttackLevel );
-    check_member( envelope, expect_envelope, "%u", dwAttackTime );
-    check_member( envelope, expect_envelope, "%u", dwFadeLevel );
-    check_member( envelope, expect_envelope, "%u", dwFadeTime );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( envelope, expect_envelope, "%lu", dwAttackLevel );
+    check_member( envelope, expect_envelope, "%lu", dwAttackTime );
+    check_member( envelope, expect_envelope, "%lu", dwFadeLevel );
+    check_member( envelope, expect_envelope, "%lu", dwFadeTime );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     desc.dwFlags = 0;
     desc.cAxes = 0;
@@ -807,11 +807,11 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     desc.lpvTypeSpecificParams = NULL;
     flags = version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5;
     hr = IDirectInputEffect_SetParameters( effect, &desc, flags | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TRIGGERBUTTON | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_AXES | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
 
     desc.dwFlags = DIEFF_OBJECTOFFSETS;
     desc.cAxes = 1;
@@ -819,190 +819,190 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     desc.rgdwAxes[0] = DIJOFS_X;
     desc.dwTriggerButton = DIJOFS_BUTTON( 1 );
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_AXES | DIEP_TRIGGERBUTTON | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_AXES | DIEP_TRIGGERBUTTON | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_ALREADYINITIALIZED, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_ALREADYINITIALIZED, "SetParameters returned %#lx\n", hr );
 
     desc.cAxes = 0;
     desc.dwFlags = DIEFF_OBJECTIDS;
     desc.rgdwAxes = axes;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES | DIEP_TRIGGERBUTTON );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES | DIEP_TRIGGERBUTTON );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%#x", dwTriggerButton );
-    check_member( desc, expect_desc, "%u", cAxes );
-    check_member( desc, expect_desc, "%u", rgdwAxes[0] );
-    check_member( desc, expect_desc, "%u", rgdwAxes[1] );
-    check_member( desc, expect_desc, "%u", rgdwAxes[2] );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%#lx", dwTriggerButton );
+    check_member( desc, expect_desc, "%lu", cAxes );
+    check_member( desc, expect_desc, "%lu", rgdwAxes[0] );
+    check_member( desc, expect_desc, "%lu", rgdwAxes[1] );
+    check_member( desc, expect_desc, "%lu", rgdwAxes[2] );
 
     desc.dwFlags = DIEFF_OBJECTOFFSETS;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_AXES | DIEP_TRIGGERBUTTON );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    ok( desc.dwTriggerButton == 0x30, "got %#x expected %#x\n", desc.dwTriggerButton, 0x30 );
-    ok( desc.rgdwAxes[0] == 8, "got %#x expected %#x\n", desc.rgdwAxes[0], 8 );
-    ok( desc.rgdwAxes[1] == 0, "got %#x expected %#x\n", desc.rgdwAxes[1], 0 );
-    ok( desc.rgdwAxes[2] == 4, "got %#x expected %#x\n", desc.rgdwAxes[2], 4 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwTriggerButton == 0x30, "got %#lx expected %#x\n", desc.dwTriggerButton, 0x30 );
+    ok( desc.rgdwAxes[0] == 8, "got %#lx expected %#x\n", desc.rgdwAxes[0], 8 );
+    ok( desc.rgdwAxes[1] == 0, "got %#lx expected %#x\n", desc.rgdwAxes[1], 0 );
+    ok( desc.rgdwAxes[2] == 4, "got %#lx expected %#x\n", desc.rgdwAxes[2], 4 );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     desc.dwFlags = DIEFF_CARTESIAN;
     desc.cAxes = 0;
     desc.rglDirection = directions;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     desc.cAxes = 3;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.dwFlags = DIEFF_POLAR;
     desc.cAxes = 3;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
 
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     desc.dwFlags = DIEFF_SPHERICAL;
     desc.cAxes = 1;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_SPHERICAL, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_SPHERICAL );
-    check_member( desc, expect_desc, "%u", cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_SPHERICAL, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_SPHERICAL );
+    check_member( desc, expect_desc, "%lu", cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", cAxes );
-    ok( desc.rglDirection[0] == 3000, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 3000 );
-    ok( desc.rglDirection[1] == 30000, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], 30000 );
-    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %d expected %d\n", desc.rglDirection[2], 0 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", cAxes );
+    ok( desc.rglDirection[0] == 3000, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 3000 );
+    ok( desc.rglDirection[1] == 30000, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], 30000 );
+    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %ld expected %d\n", desc.rglDirection[2], 0 );
     desc.dwFlags = DIEFF_CARTESIAN;
     desc.cAxes = 2;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_CARTESIAN, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_CARTESIAN );
-    check_member( desc, expect_desc, "%u", cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_CARTESIAN, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_CARTESIAN );
+    check_member( desc, expect_desc, "%lu", cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", cAxes );
-    ok( desc.rglDirection[0] == 4330, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 4330 );
-    ok( desc.rglDirection[1] == 2500, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], 2500 );
-    ok( desc.rglDirection[2] == -8660, "got rglDirection[2] %d expected %d\n", desc.rglDirection[2], -8660 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", cAxes );
+    ok( desc.rglDirection[0] == 4330, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 4330 );
+    ok( desc.rglDirection[1] == 2500, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], 2500 );
+    ok( desc.rglDirection[2] == -8660, "got rglDirection[2] %ld expected %d\n", desc.rglDirection[2], -8660 );
     desc.dwFlags = DIEFF_POLAR;
     desc.cAxes = 3;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DIERR_INCOMPLETEEFFECT, "Download returned %#lx\n", hr );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     desc.cbTypeSpecificParams = 0;
     desc.lpvTypeSpecificParams = &periodic;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS | DIEP_NODOWNLOAD );
-    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
     desc.cbTypeSpecificParams = sizeof(DIPERIODIC);
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_TYPESPECIFICPARAMS | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( periodic, expect_periodic, "%u", dwMagnitude );
-    check_member( periodic, expect_periodic, "%d", lOffset );
-    check_member( periodic, expect_periodic, "%u", dwPhase );
-    check_member( periodic, expect_periodic, "%u", dwPeriod );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( periodic, expect_periodic, "%lu", dwMagnitude );
+    check_member( periodic, expect_periodic, "%ld", lOffset );
+    check_member( periodic, expect_periodic, "%lu", dwPhase );
+    check_member( periodic, expect_periodic, "%lu", dwPeriod );
 
     hr = IDirectInputEffect_Start( effect, 1, DIES_NODOWNLOAD );
-    ok( hr == DIERR_NOTDOWNLOADED, "Start returned %#x\n", hr );
+    ok( hr == DIERR_NOTDOWNLOADED, "Start returned %#lx\n", hr );
     hr = IDirectInputEffect_Stop( effect );
-    ok( hr == DIERR_NOTDOWNLOADED, "Stop returned %#x\n", hr );
+    ok( hr == DIERR_NOTDOWNLOADED, "Stop returned %#lx\n", hr );
 
     set_hid_expect( file, expect_download, 3 * sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DI_OK, "Download returned %#x\n", hr );
+    ok( hr == DI_OK, "Download returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DI_NOEFFECT, "Download returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Download returned %#lx\n", hr );
 
     hr = IDirectInputEffect_Start( effect, 1, 0xdeadbeef );
-    ok( hr == DIERR_INVALIDPARAM, "Start returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Start returned %#lx\n", hr );
 
     set_hid_expect( file, &expect_start_solo, sizeof(expect_start_solo) );
     hr = IDirectInputEffect_Start( effect, 1, DIES_SOLO );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
     hr = IDirectInputEffect_Stop( effect );
-    ok( hr == DI_OK, "Stop returned %#x\n", hr );
+    ok( hr == DI_OK, "Stop returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_start, sizeof(expect_start) );
     hr = IDirectInputEffect_Start( effect, 1, 0 );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_start_4, sizeof(expect_start_4) );
     hr = IDirectInputEffect_Start( effect, 4, 0 );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_start_0, sizeof(expect_start_4) );
     hr = IDirectInputEffect_Start( effect, 0, 0 );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_unload, sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_OK, "Unload returned %#x\n", hr );
+    ok( hr == DI_OK, "Unload returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_download, 4 * sizeof(struct hid_expect) );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, DIEP_START );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_unload, sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_OK, "Unload returned %#x\n", hr );
+    ok( hr == DI_OK, "Unload returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_download, 3 * sizeof(struct hid_expect) );
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DI_OK, "Download returned %#x\n", hr );
+    ok( hr == DI_OK, "Download returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_unload, 2 * sizeof(struct hid_expect) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputEffect_Start( effect, 1, DIES_NODOWNLOAD );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Start returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Start returned %#lx\n", hr );
     hr = IDirectInputEffect_Stop( effect );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Stop returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Stop returned %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_NOEFFECT, "Unload returned %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unload returned %#lx\n", hr );
 
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
 
     desc.dwFlags = DIEFF_POLAR | DIEFF_OBJECTIDS;
     desc.cAxes = 2;
@@ -1012,50 +1012,50 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     desc.rglDirection[1] = 0;
     desc.rglDirection[2] = 0;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_AXES | DIEP_DIRECTION | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.rglDirection[0] = 0;
 
     desc.dwFlags = DIEFF_SPHERICAL;
     desc.cAxes = 1;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_SPHERICAL, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_SPHERICAL );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_SPHERICAL, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_SPHERICAL );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
-    ok( desc.rglDirection[0] == 30000, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 30000 );
-    ok( desc.rglDirection[1] == 0, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], 0 );
-    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %d expected %d\n", desc.rglDirection[2], 0 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
+    ok( desc.rglDirection[0] == 30000, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 30000 );
+    ok( desc.rglDirection[1] == 0, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], 0 );
+    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %ld expected %d\n", desc.rglDirection[2], 0 );
 
     desc.dwFlags = DIEFF_CARTESIAN;
     desc.cAxes = 1;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_CARTESIAN, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_CARTESIAN );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_CARTESIAN, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_CARTESIAN );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
-    ok( desc.rglDirection[0] == 5000, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 5000 );
-    ok( desc.rglDirection[1] == -8660, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], -8660 );
-    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %d expected %d\n", desc.rglDirection[2], 0 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
+    ok( desc.rglDirection[0] == 5000, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 5000 );
+    ok( desc.rglDirection[1] == -8660, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], -8660 );
+    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %ld expected %d\n", desc.rglDirection[2], 0 );
 
     desc.dwFlags = DIEFF_POLAR;
     desc.cAxes = 1;
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
-    ok( desc.dwFlags == DIEFF_POLAR, "got flags %#x, expected %#x\n", desc.dwFlags, DIEFF_POLAR );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
+    ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
+    ok( desc.dwFlags == DIEFF_POLAR, "got flags %#lx, expected %#x\n", desc.dwFlags, DIEFF_POLAR );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    ok( desc.cAxes == 2, "got cAxes %u expected 2\n", desc.cAxes );
-    ok( desc.rglDirection[0] == 3000, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 3000 );
-    ok( desc.rglDirection[1] == 0, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], 0 );
-    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %d expected %d\n", desc.rglDirection[2], 0 );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    ok( desc.cAxes == 2, "got cAxes %lu expected 2\n", desc.cAxes );
+    ok( desc.rglDirection[0] == 3000, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 3000 );
+    ok( desc.rglDirection[1] == 0, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], 0 );
+    ok( desc.rglDirection[2] == 0, "got rglDirection[2] %ld expected %d\n", desc.rglDirection[2], 0 );
 
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     for (i = 1; i < 4; i++)
     {
@@ -1110,9 +1110,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
                            0x01, i >= 2 ? 0x3f : 0, i >= 3 ? 0x00 : 0},
         };
 
-        winetest_push_context( "%u axes", i );
+        winetest_push_context( "%lu axes", i );
         hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-        ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
 
         desc.dwFlags = DIEFF_OBJECTIDS;
         desc.cAxes = i;
@@ -1123,7 +1123,7 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
         desc.rglDirection[1] = 0;
         desc.rglDirection[2] = 0;
         hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_AXES | DIEP_NODOWNLOAD );
-        ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+        ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
         desc.dwFlags = DIEFF_CARTESIAN;
         desc.cAxes = i == 3 ? 2 : 3;
@@ -1131,44 +1131,44 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
         desc.rglDirection[1] = 2000;
         desc.rglDirection[2] = 3000;
         hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-        ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "SetParameters returned %#lx\n", hr );
         desc.cAxes = i;
         hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_DIRECTION | DIEP_NODOWNLOAD );
-        ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+        ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
         desc.dwFlags = DIEFF_SPHERICAL;
         desc.cAxes = i;
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+        ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
         desc.cAxes = 3;
         memset( desc.rglDirection, 0xcd, 3 * sizeof(LONG) );
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-        ok( desc.cAxes == i, "got cAxes %u expected 2\n", desc.cAxes );
+        ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+        ok( desc.cAxes == i, "got cAxes %lu expected 2\n", desc.cAxes );
         if (i == 1)
         {
-            ok( desc.rglDirection[0] == 0, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 0 );
-            ok( desc.rglDirection[1] == 0xcdcdcdcd, "got rglDirection[1] %d expected %d\n",
+            ok( desc.rglDirection[0] == 0, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 0 );
+            ok( desc.rglDirection[1] == 0xcdcdcdcd, "got rglDirection[1] %ld expected %d\n",
                 desc.rglDirection[1], 0xcdcdcdcd );
-            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %d expected %d\n",
+            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %ld expected %d\n",
                 desc.rglDirection[2], 0xcdcdcdcd );
         }
         else
         {
-            ok( desc.rglDirection[0] == 6343, "got rglDirection[0] %d expected %d\n",
+            ok( desc.rglDirection[0] == 6343, "got rglDirection[0] %ld expected %d\n",
                 desc.rglDirection[0], 6343 );
             if (i == 2)
             {
-                ok( desc.rglDirection[1] == 0, "got rglDirection[1] %d expected %d\n",
+                ok( desc.rglDirection[1] == 0, "got rglDirection[1] %ld expected %d\n",
                     desc.rglDirection[1], 0 );
-                ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %d expected %d\n",
+                ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %ld expected %d\n",
                     desc.rglDirection[2], 0xcdcdcdcd );
             }
             else
             {
-                ok( desc.rglDirection[1] == 5330, "got rglDirection[1] %d expected %d\n",
+                ok( desc.rglDirection[1] == 5330, "got rglDirection[1] %ld expected %d\n",
                     desc.rglDirection[1], 5330 );
-                ok( desc.rglDirection[2] == 0, "got rglDirection[2] %d expected %d\n",
+                ok( desc.rglDirection[2] == 0, "got rglDirection[2] %ld expected %d\n",
                     desc.rglDirection[2], 0 );
             }
         }
@@ -1176,48 +1176,48 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
         desc.dwFlags = DIEFF_CARTESIAN;
         desc.cAxes = i;
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
+        ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
         desc.cAxes = 3;
         memset( desc.rglDirection, 0xcd, 3 * sizeof(LONG) );
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-        ok( desc.cAxes == i, "got cAxes %u expected 2\n", desc.cAxes );
-        ok( desc.rglDirection[0] == 1000, "got rglDirection[0] %d expected %d\n", desc.rglDirection[0], 1000 );
+        ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+        ok( desc.cAxes == i, "got cAxes %lu expected 2\n", desc.cAxes );
+        ok( desc.rglDirection[0] == 1000, "got rglDirection[0] %ld expected %d\n", desc.rglDirection[0], 1000 );
         if (i == 1)
-            ok( desc.rglDirection[1] == 0xcdcdcdcd, "got rglDirection[1] %d expected %d\n",
+            ok( desc.rglDirection[1] == 0xcdcdcdcd, "got rglDirection[1] %ld expected %d\n",
                 desc.rglDirection[1], 0xcdcdcdcd );
         else
-            ok( desc.rglDirection[1] == 2000, "got rglDirection[1] %d expected %d\n",
+            ok( desc.rglDirection[1] == 2000, "got rglDirection[1] %ld expected %d\n",
                 desc.rglDirection[1], 2000 );
         if (i <= 2)
-            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %d expected %d\n",
+            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %ld expected %d\n",
                 desc.rglDirection[2], 0xcdcdcdcd );
         else
-            ok( desc.rglDirection[2] == 3000, "got rglDirection[2] %d expected %d\n",
+            ok( desc.rglDirection[2] == 3000, "got rglDirection[2] %ld expected %d\n",
                 desc.rglDirection[2], 3000 );
 
         desc.dwFlags = DIEFF_POLAR;
         desc.cAxes = 1;
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        if (i != 2) ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
-        else ok( hr == DIERR_MOREDATA, "GetParameters returned %#x\n", hr );
+        if (i != 2) ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
+        else ok( hr == DIERR_MOREDATA, "GetParameters returned %#lx\n", hr );
         desc.cAxes = 3;
         memset( desc.rglDirection, 0xcd, 3 * sizeof(LONG) );
         hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_DIRECTION );
-        if (i != 2) ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#x\n", hr );
+        if (i != 2) ok( hr == DIERR_INVALIDPARAM, "GetParameters returned %#lx\n", hr );
         else
         {
-            ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-            ok( desc.cAxes == i, "got cAxes %u expected 2\n", desc.cAxes );
-            ok( desc.rglDirection[0] == 15343, "got rglDirection[0] %d expected %d\n",
+            ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+            ok( desc.cAxes == i, "got cAxes %lu expected 2\n", desc.cAxes );
+            ok( desc.rglDirection[0] == 15343, "got rglDirection[0] %ld expected %d\n",
                 desc.rglDirection[0], 15343 );
-            ok( desc.rglDirection[1] == 0, "got rglDirection[1] %d expected %d\n", desc.rglDirection[1], 0 );
-            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %d expected %d\n",
+            ok( desc.rglDirection[1] == 0, "got rglDirection[1] %ld expected %d\n", desc.rglDirection[1], 0 );
+            ok( desc.rglDirection[2] == 0xcdcdcdcd, "got rglDirection[2] %ld expected %d\n",
                 desc.rglDirection[2], 0xcdcdcdcd );
         }
 
         ref = IDirectInputEffect_Release( effect );
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
 
         desc = expect_desc;
         desc.dwFlags = DIEFF_SPHERICAL | DIEFF_OBJECTIDS;
@@ -1231,9 +1231,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
         expect_directions[2] = expect_spherical;
         set_hid_expect( file, expect_directions, sizeof(expect_directions) );
         hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &desc, &effect, NULL );
-        ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
         ref = IDirectInputEffect_Release( effect );
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
         set_hid_expect( file, NULL, 0 );
 
         desc = expect_desc;
@@ -1248,9 +1248,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
         expect_directions[2] = expect_cartesian;
         set_hid_expect( file, expect_directions, sizeof(expect_directions) );
         hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &desc, &effect, NULL );
-        ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
         ref = IDirectInputEffect_Release( effect );
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
         set_hid_expect( file, NULL, 0 );
 
         if (i == 2)
@@ -1267,9 +1267,9 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
             expect_directions[2] = expect_polar;
             set_hid_expect( file, expect_directions, sizeof(expect_directions) );
             hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &desc, &effect, NULL );
-            ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+            ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
             ref = IDirectInputEffect_Release( effect );
-            ok( ref == 0, "Release returned %d\n", ref );
+            ok( ref == 0, "Release returned %ld\n", ref );
             set_hid_expect( file, NULL, 0 );
         }
 
@@ -1277,58 +1277,58 @@ static void test_periodic_effect( IDirectInputDevice8W *device, HANDLE file, DWO
     }
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
 
     set_hid_expect( file, expect_download_2, sizeof(expect_download_2) );
     flags = version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5;
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, flags );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     desc = expect_desc;
     desc.dwDuration = INFINITE;
     desc.dwTriggerButton = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 0 ) | DIDFT_FFEFFECTTRIGGER,
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD | DIEP_DURATION | DIEP_TRIGGERBUTTON );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, expect_update, sizeof(expect_update) );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, 0 );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */
     desc = expect_desc;
     desc.dwDuration = INFINITE;
     desc.dwTriggerButton = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 0 ) | DIDFT_FFEFFECTTRIGGER,
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD | DIEP_DURATION | DIEP_TRIGGERBUTTON );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, expect_update, sizeof(expect_update) );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, 0 );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */
 
     desc = expect_desc;
     desc.lpEnvelope = &envelope;
     desc.lpEnvelope->dwAttackTime = 1000;
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_NODOWNLOAD | DIEP_ENVELOPE );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     set_hid_expect( file, expect_set_envelope, sizeof(expect_set_envelope) );
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, 0 );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* these updates are sent asynchronously */
 
     set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, &expect_desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 }
 
@@ -1502,70 +1502,70 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DW
 
     set_hid_expect( file, expect_create, sizeof(expect_create) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &expect_desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     check_params.expect_effect = effect;
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_created_effect_objects, &check_params, 0 );
-    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#x\n", hr );
-    ok( check_params.count == 1, "got count %u, expected 1\n", check_params.count );
+    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#lx\n", hr );
+    ok( check_params.count == 1, "got count %lu, expected 1\n", check_params.count );
 
     hr = IDirectInputEffect_GetEffectGuid( effect, &guid );
-    ok( hr == DI_OK, "GetEffectGuid returned %#x\n", hr );
+    ok( hr == DI_OK, "GetEffectGuid returned %#lx\n", hr );
     ok( IsEqualGUID( &guid, &GUID_Spring ), "got guid %s, expected %s\n", debugstr_guid( &guid ),
         debugstr_guid( &GUID_Spring ) );
 
     hr = IDirectInputEffect_GetParameters( effect, &desc, version >= 0x700 ? DIEP_ALLPARAMS : DIEP_ALLPARAMS_DX5 );
-    ok( hr == DI_OK, "GetParameters returned %#x\n", hr );
-    check_member( desc, expect_desc, "%u", dwDuration );
-    check_member( desc, expect_desc, "%u", dwSamplePeriod );
-    check_member( desc, expect_desc, "%u", dwGain );
-    check_member( desc, expect_desc, "%#x", dwTriggerButton );
-    check_member( desc, expect_desc, "%u", dwTriggerRepeatInterval );
-    check_member( desc, expect_desc, "%u", cAxes );
-    check_member( desc, expect_desc, "%#x", rgdwAxes[0] );
-    check_member( desc, expect_desc, "%#x", rgdwAxes[1] );
-    check_member( desc, expect_desc, "%d", rglDirection[0] );
-    check_member( desc, expect_desc, "%d", rglDirection[1] );
-    check_member( desc, expect_desc, "%u", cbTypeSpecificParams );
-    if (version >= 0x700) check_member( desc, expect_desc, "%u", dwStartDelay );
-    else ok( desc.dwStartDelay == 0, "got dwStartDelay %#x\n", desc.dwStartDelay );
-    check_member( envelope, expect_envelope, "%u", dwAttackLevel );
-    check_member( envelope, expect_envelope, "%u", dwAttackTime );
-    check_member( envelope, expect_envelope, "%u", dwFadeLevel );
-    check_member( envelope, expect_envelope, "%u", dwFadeTime );
-    check_member( condition[0], expect_condition[0], "%d", lOffset );
-    check_member( condition[0], expect_condition[0], "%d", lPositiveCoefficient );
-    check_member( condition[0], expect_condition[0], "%d", lNegativeCoefficient );
-    check_member( condition[0], expect_condition[0], "%u", dwPositiveSaturation );
-    check_member( condition[0], expect_condition[0], "%u", dwNegativeSaturation );
-    check_member( condition[0], expect_condition[0], "%d", lDeadBand );
-    check_member( condition[1], expect_condition[1], "%d", lOffset );
-    check_member( condition[1], expect_condition[1], "%d", lPositiveCoefficient );
-    check_member( condition[1], expect_condition[1], "%d", lNegativeCoefficient );
-    check_member( condition[1], expect_condition[1], "%u", dwPositiveSaturation );
-    check_member( condition[1], expect_condition[1], "%u", dwNegativeSaturation );
-    check_member( condition[1], expect_condition[1], "%d", lDeadBand );
+    ok( hr == DI_OK, "GetParameters returned %#lx\n", hr );
+    check_member( desc, expect_desc, "%lu", dwDuration );
+    check_member( desc, expect_desc, "%lu", dwSamplePeriod );
+    check_member( desc, expect_desc, "%lu", dwGain );
+    check_member( desc, expect_desc, "%#lx", dwTriggerButton );
+    check_member( desc, expect_desc, "%lu", dwTriggerRepeatInterval );
+    check_member( desc, expect_desc, "%lu", cAxes );
+    check_member( desc, expect_desc, "%#lx", rgdwAxes[0] );
+    check_member( desc, expect_desc, "%#lx", rgdwAxes[1] );
+    check_member( desc, expect_desc, "%ld", rglDirection[0] );
+    check_member( desc, expect_desc, "%ld", rglDirection[1] );
+    check_member( desc, expect_desc, "%lu", cbTypeSpecificParams );
+    if (version >= 0x700) check_member( desc, expect_desc, "%lu", dwStartDelay );
+    else ok( desc.dwStartDelay == 0, "got dwStartDelay %#lx\n", desc.dwStartDelay );
+    check_member( envelope, expect_envelope, "%lu", dwAttackLevel );
+    check_member( envelope, expect_envelope, "%lu", dwAttackTime );
+    check_member( envelope, expect_envelope, "%lu", dwFadeLevel );
+    check_member( envelope, expect_envelope, "%lu", dwFadeTime );
+    check_member( condition[0], expect_condition[0], "%ld", lOffset );
+    check_member( condition[0], expect_condition[0], "%ld", lPositiveCoefficient );
+    check_member( condition[0], expect_condition[0], "%ld", lNegativeCoefficient );
+    check_member( condition[0], expect_condition[0], "%lu", dwPositiveSaturation );
+    check_member( condition[0], expect_condition[0], "%lu", dwNegativeSaturation );
+    check_member( condition[0], expect_condition[0], "%ld", lDeadBand );
+    check_member( condition[1], expect_condition[1], "%ld", lOffset );
+    check_member( condition[1], expect_condition[1], "%ld", lPositiveCoefficient );
+    check_member( condition[1], expect_condition[1], "%ld", lNegativeCoefficient );
+    check_member( condition[1], expect_condition[1], "%lu", dwPositiveSaturation );
+    check_member( condition[1], expect_condition[1], "%lu", dwNegativeSaturation );
+    check_member( condition[1], expect_condition[1], "%ld", lDeadBand );
 
     set_hid_expect( file, &expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     desc = expect_desc;
     desc.cAxes = 1;
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "CreateEffect returned %#lx\n", hr );
     desc.cbTypeSpecificParams = 1 * sizeof(DICONDITION);
     desc.lpvTypeSpecificParams = (void *)&expect_condition[1];
     set_hid_expect( file, expect_create_1, sizeof(expect_create_1) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     desc = expect_desc;
@@ -1578,12 +1578,12 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DW
     desc.lpvTypeSpecificParams = (void *)&expect_condition[1];
     set_hid_expect( file, expect_create_2, sizeof(expect_create_2) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     desc = expect_desc;
@@ -1598,35 +1598,35 @@ static void test_condition_effect( IDirectInputDevice8W *device, HANDLE file, DW
     desc.lpvTypeSpecificParams = (void *)&expect_condition[1];
     set_hid_expect( file, expect_create_3, sizeof(expect_create_3) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, NULL, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     desc = expect_desc;
     desc.cAxes = 0;
     desc.cbTypeSpecificParams = 1 * sizeof(DICONDITION);
     desc.lpvTypeSpecificParams = (void *)&expect_condition[0];
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.cbTypeSpecificParams = 0 * sizeof(DICONDITION);
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS );
-    ok( hr == DIERR_MOREDATA, "SetParameters returned %#x\n", hr );
-    ok( desc.cbTypeSpecificParams == 1 * sizeof(DICONDITION), "got %u\n", desc.cbTypeSpecificParams );
+    ok( hr == DIERR_MOREDATA, "SetParameters returned %#lx\n", hr );
+    ok( desc.cbTypeSpecificParams == 1 * sizeof(DICONDITION), "got %lu\n", desc.cbTypeSpecificParams );
     desc.cbTypeSpecificParams = 0 * sizeof(DICONDITION);
     hr = IDirectInputEffect_SetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
     desc.cbTypeSpecificParams = 0 * sizeof(DICONDITION);
     hr = IDirectInputEffect_GetParameters( effect, &desc, DIEP_TYPESPECIFICPARAMS );
-    ok( hr == DI_OK, "SetParameters returned %#x\n", hr );
-    ok( desc.cbTypeSpecificParams == 0 * sizeof(DICONDITION), "got %u\n", desc.cbTypeSpecificParams );
+    ok( hr == DI_OK, "SetParameters returned %#lx\n", hr );
+    ok( desc.cbTypeSpecificParams == 0 * sizeof(DICONDITION), "got %lu\n", desc.cbTypeSpecificParams );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 }
 
 static BOOL test_force_feedback_joystick( DWORD version )
@@ -2786,7 +2786,7 @@ static BOOL test_force_feedback_joystick( DWORD version )
     HRESULT hr;
     HWND hwnd;
 
-    winetest_push_context( "%#x", version );
+    winetest_push_context( "%#lx", version );
 
     GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
     GetTempPathW( ARRAY_SIZE(tempdir), tempdir );
@@ -2799,12 +2799,12 @@ static BOOL test_force_feedback_joystick( DWORD version )
     check_dinput_devices( version, &devinst );
 
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
-    check_member( devinst, expect_devinst, "%d", dwSize );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
+    check_member( devinst, expect_devinst, "%lu", dwSize );
     todo_wine
     check_member_guid( devinst, expect_devinst, guidInstance );
     check_member_guid( devinst, expect_devinst, guidProduct );
-    check_member( devinst, expect_devinst, "%#x", dwDevType );
+    check_member( devinst, expect_devinst, "%#lx", dwDevType );
     todo_wine
     check_member_wstr( devinst, expect_devinst, tszInstanceName );
     todo_wine
@@ -2815,100 +2815,100 @@ static BOOL test_force_feedback_joystick( DWORD version )
 
     caps.dwSize = sizeof(DIDEVCAPS);
     hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-    ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
-    check_member( caps, expect_caps, "%d", dwSize );
-    check_member( caps, expect_caps, "%#x", dwFlags );
-    check_member( caps, expect_caps, "%#x", dwDevType );
-    check_member( caps, expect_caps, "%d", dwAxes );
-    check_member( caps, expect_caps, "%d", dwButtons );
-    check_member( caps, expect_caps, "%d", dwPOVs );
-    check_member( caps, expect_caps, "%d", dwFFSamplePeriod );
-    check_member( caps, expect_caps, "%d", dwFFMinTimeResolution );
-    check_member( caps, expect_caps, "%d", dwFirmwareRevision );
-    check_member( caps, expect_caps, "%d", dwHardwareRevision );
-    check_member( caps, expect_caps, "%d", dwFFDriverVersion );
+    ok( hr == DI_OK, "GetCapabilities returned %#lx\n", hr );
+    check_member( caps, expect_caps, "%lu", dwSize );
+    check_member( caps, expect_caps, "%#lx", dwFlags );
+    check_member( caps, expect_caps, "%#lx", dwDevType );
+    check_member( caps, expect_caps, "%lu", dwAxes );
+    check_member( caps, expect_caps, "%lu", dwButtons );
+    check_member( caps, expect_caps, "%lu", dwPOVs );
+    check_member( caps, expect_caps, "%lu", dwFFSamplePeriod );
+    check_member( caps, expect_caps, "%lu", dwFFMinTimeResolution );
+    check_member( caps, expect_caps, "%lu", dwFirmwareRevision );
+    check_member( caps, expect_caps, "%lu", dwHardwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFFDriverVersion );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#x\n", hr );
-    ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#lx\n", hr );
+    ok( prop_dword.dwData == 10000, "got %lu expected %u\n", prop_dword.dwData, 10000 );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_EnumObjects( device, check_objects, &check_objects_params, DIDFT_ALL );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
     ok( check_objects_params.index >= check_objects_params.expect_count, "missing %u objects\n",
         check_objects_params.expect_count - check_objects_params.index );
 
     res = 0;
     hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, 0xfe );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
     res = 0;
     hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, DIEFT_PERIODIC );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
-    ok( res == 2, "got %u expected %u\n", res, 2 );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
+    ok( res == 2, "got %lu expected %u\n", res, 2 );
     hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
     ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n",
         check_effects_params.expect_count - check_effects_params.index );
 
     effectinfo.dwSize = sizeof(DIEFFECTINFOW);
     hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine );
-    ok( hr == DI_OK, "GetEffectInfo returned %#x\n", hr );
+    ok( hr == DI_OK, "GetEffectInfo returned %#lx\n", hr );
     check_member_guid( effectinfo, expect_effects[1], guid );
-    check_member( effectinfo, expect_effects[1], "%#x", dwEffType );
-    check_member( effectinfo, expect_effects[1], "%#x", dwStaticParams );
-    check_member( effectinfo, expect_effects[1], "%#x", dwDynamicParams );
+    check_member( effectinfo, expect_effects[1], "%#lx", dwEffType );
+    check_member( effectinfo, expect_effects[1], "%#lx", dwStaticParams );
+    check_member( effectinfo, expect_effects[1], "%#lx", dwDynamicParams );
     check_member_wstr( effectinfo, expect_effects[1], tszName );
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
 
     file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                         FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     hwnd = CreateWindowW( L"static", L"dinput", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200,
                           NULL, NULL, NULL, NULL );
 
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = DIPROPAUTOCENTER_ON;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_READONLY, "SetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_READONLY, "SetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#lx\n", hr );
 
     escape.dwSize = sizeof(DIEFFESCAPE);
     escape.dwCommand = 0;
@@ -2918,79 +2918,79 @@ static BOOL test_force_feedback_joystick( DWORD version )
     escape.cbOutBuffer = 10;
     hr = IDirectInputDevice8_Escape( device, &escape );
     todo_wine
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Escape returned: %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "Escape returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     set_hid_expect( file, &expect_set_device_gain_2, sizeof(expect_set_device_gain_2) );
     prop_dword.dwData = 2000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     set_hid_expect( file, &expect_set_device_gain_1, sizeof(expect_set_device_gain_1) );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     hr = IDirectInputDevice8_Escape( device, &escape );
     todo_wine
-    ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
     todo_wine
-    ok( hr == 0x80040301, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == 0x80040301, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
     todo_wine
-    ok( hr == 0x80040301, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == 0x80040301, "GetForceFeedbackState returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, 0xdeadbeef );
-    ok( hr == DIERR_INVALIDPARAM, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SendForceFeedbackCommand returned %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     wait_hid_expect( file, 100 ); /* device gain reports are written asynchronously */
 
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_STOPALL );
-    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_PAUSE );
-    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_CONTINUE );
-    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSON );
-    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSOFF );
-    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == HIDP_STATUS_USAGE_NOT_FOUND, "SendForceFeedbackCommand returned %#lx\n", hr );
 
     objdata.dwOfs = 0x1e;
     objdata.dwData = 0x80;
     res = 1;
     hr = IDirectInputDevice8_SendDeviceData( device, sizeof(DIDEVICEOBJECTDATA), &objdata, &res, 0 );
-    if (version < 0x800) ok( hr == DI_OK, "SendDeviceData returned %#x\n", hr );
-    else todo_wine ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr );
+    if (version < 0x800) ok( hr == DI_OK, "SendDeviceData returned %#lx\n", hr );
+    else todo_wine ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#lx\n", hr );
 
     test_periodic_effect( device, file, version );
     test_condition_effect( device, file, version );
 
     set_hid_expect( file, expect_reset, sizeof(expect_reset) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     DestroyWindow( hwnd );
     CloseHandle( file );
@@ -3909,370 +3909,370 @@ static void test_device_managed_effect(void)
     if (FAILED(hr = dinput_test_create_device( DIRECTINPUT_VERSION, &devinst, &device ))) goto done;
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
     file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                         FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     hwnd = CreateWindowW( L"static", L"dinput", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200,
                           NULL, NULL, NULL, NULL );
 
     event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( event != NULL, "CreateEventW failed, last error %u\n", GetLastError() );
+    ok( event != NULL, "CreateEventW failed, last error %lu\n", GetLastError() );
     hr = IDirectInputDevice8_SetEventNotification( device, event );
-    ok( hr == DI_OK, "SetEventNotification returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetEventNotification returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetForceFeedbackState returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "SendForceFeedbackCommand returned %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#lx\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED | DIGFFS_EMPTY;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#lx\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 
     send_hid_input( file, device_state_input, sizeof(struct hid_expect) );
     res = WaitForSingleObject( event, 100 );
-    ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#x\n", res );
+    ok( res == WAIT_TIMEOUT, "WaitForSingleObject returned %#lx\n", res );
     send_hid_input( file, device_state_input, sizeof(device_state_input) );
     res = WaitForSingleObject( event, 100 );
-    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_PAUSED | DIGFFS_EMPTY | DIGFFS_ACTUATORSON | DIGFFS_POWERON |
             DIGFFS_SAFETYSWITCHON | DIGFFS_USERFFSWITCHON;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, NULL, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
 
     hr = IDirectInputEffect_GetEffectStatus( effect, NULL );
-    ok( hr == E_POINTER, "GetEffectStatus returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetEffectStatus returned %#lx\n", hr );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
 
     flags = DIEP_ALLPARAMS;
     hr = IDirectInputEffect_SetParameters( effect, &expect_desc, flags | DIEP_NODOWNLOAD );
-    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#x\n", hr );
+    ok( hr == DI_DOWNLOADSKIPPED, "SetParameters returned %#lx\n", hr );
 
     set_hid_expect( file, expect_reset, sizeof(struct hid_expect) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetEffectStatus returned %#x\n", hr );
+    ok( hr == DIERR_NOTEXCLUSIVEACQUIRED, "GetEffectStatus returned %#lx\n", hr );
 
     set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     wait_hid_expect( file, 100 );
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED | DIGFFS_EMPTY;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_create, sizeof(expect_create) );
     hr = IDirectInputEffect_Download( effect );
-    ok( hr == DI_OK, "Download returned %#x\n", hr );
+    ok( hr == DI_OK, "Download returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#x\n", prop_dword.dwData );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got DIPROP_FFLOAD %#lx\n", prop_dword.dwData );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_start, sizeof(expect_start) );
     hr = IDirectInputEffect_Start( effect, 1, DIES_NODOWNLOAD );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_create_2, sizeof(expect_create_2) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &expect_desc, &effect2, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     set_hid_expect( file, &expect_start_2, sizeof(expect_start_2) );
     hr = IDirectInputEffect_Start( effect2, 1, DIES_SOLO );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect2, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, &expect_stop_2, sizeof(expect_stop_2) );
     hr = IDirectInputEffect_Stop( effect2 );
-    ok( hr == DI_OK, "Stop returned %#x\n", hr );
+    ok( hr == DI_OK, "Stop returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect2, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_destroy_2, sizeof(expect_destroy_2) );
     ref = IDirectInputEffect_Release( effect2 );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     /* sending commands has no direct effect on status */
     set_hid_expect( file, expect_stop_all, sizeof(expect_stop_all) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_STOPALL );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_device_pause, sizeof(expect_device_pause) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_PAUSE );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_device_continue, sizeof(expect_device_continue) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_CONTINUE );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_disable_actuators, sizeof(expect_disable_actuators) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSOFF );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_enable_actuators, sizeof(expect_enable_actuators) );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_SETACTUATORSON );
-    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DI_OK, "SendForceFeedbackCommand returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
     hr = IDirectInputEffect_Stop( effect );
-    ok( hr == DI_OK, "Stop returned %#x\n", hr );
+    ok( hr == DI_OK, "Stop returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_STOPPED;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     send_hid_input( file, device_state_input_0, sizeof(device_state_input_0) );
     res = WaitForSingleObject( event, 100 );
-    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_PAUSED | DIGFFS_ACTUATORSON | DIGFFS_POWERON | DIGFFS_SAFETYSWITCHON | DIGFFS_USERFFSWITCHON;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     send_hid_input( file, device_state_input_1, sizeof(device_state_input_1) );
     res = WaitForSingleObject( event, 100 );
-    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_ACTUATORSOFF | DIGFFS_POWEROFF | DIGFFS_SAFETYSWITCHOFF | DIGFFS_USERFFSWITCHOFF;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     send_hid_input( file, device_state_input_2, sizeof(device_state_input_2) );
     res = WaitForSingleObject( event, 100 );
-    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+    ok( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_PAUSED | DIGFFS_ACTUATORSON | DIGFFS_POWEROFF | DIGFFS_SAFETYSWITCHOFF | DIGFFS_USERFFSWITCHOFF;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, &expect_stop, sizeof(expect_stop) );
     hr = IDirectInputEffect_Stop( effect );
-    ok( hr == DI_OK, "Stop returned %#x\n", hr );
+    ok( hr == DI_OK, "Stop returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_PAUSED | DIGFFS_ACTUATORSON | DIGFFS_POWEROFF | DIGFFS_SAFETYSWITCHOFF | DIGFFS_USERFFSWITCHOFF;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_destroy, sizeof(expect_destroy) );
     hr = IDirectInputEffect_Unload( effect );
-    ok( hr == DI_OK, "Unload returned %#x\n", hr );
+    ok( hr == DI_OK, "Unload returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DIERR_NOTDOWNLOADED, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, expect_pool, sizeof(struct hid_expect) );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DI_OK, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetForceFeedbackState returned %#lx\n", hr );
     flags = DIGFFS_EMPTY | DIGFFS_PAUSED | DIGFFS_ACTUATORSON | DIGFFS_POWEROFF |
             DIGFFS_SAFETYSWITCHOFF | DIGFFS_USERFFSWITCHOFF;
-    ok( res == flags, "got state %#x\n", res );
+    ok( res == flags, "got state %#lx\n", res );
     set_hid_expect( file, NULL, 0 );
 
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     /* start delay has no direct effect on effect status */
     desc = expect_desc;
     desc.dwStartDelay = 32767000;
     set_hid_expect( file, expect_create_delay, sizeof(expect_create_delay) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, &expect_start, sizeof(expect_start) );
     hr = IDirectInputEffect_Start( effect, 1, 0 );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     /* duration has no direct effect on effect status */
@@ -4281,33 +4281,33 @@ static void test_device_managed_effect(void)
     desc.dwStartDelay = 0;
     set_hid_expect( file, expect_create_duration, sizeof(expect_create_duration) );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Spring, &desc, &effect, NULL );
-    ok( hr == DI_OK, "CreateEffect returned %#x\n", hr );
+    ok( hr == DI_OK, "CreateEffect returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == 0, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == 0, "got status %#lx\n", res );
     set_hid_expect( file, &expect_start, sizeof(expect_start) );
     hr = IDirectInputEffect_Start( effect, 1, 0 );
-    ok( hr == DI_OK, "Start returned %#x\n", hr );
+    ok( hr == DI_OK, "Start returned %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
     Sleep( 100 );
     res = 0xdeadbeef;
     hr = IDirectInputEffect_GetEffectStatus( effect, &res );
-    ok( hr == DI_OK, "GetEffectStatus returned %#x\n", hr );
-    ok( res == DIEGES_PLAYING, "got status %#x\n", res );
+    ok( hr == DI_OK, "GetEffectStatus returned %#lx\n", hr );
+    ok( res == DIEGES_PLAYING, "got status %#lx\n", res );
     set_hid_expect( file, expect_destroy, sizeof(expect_destroy) );
     ref = IDirectInputEffect_Release( effect );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
     set_hid_expect( file, NULL, 0 );
 
     set_hid_expect( file, expect_reset, sizeof(struct hid_expect) );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     set_hid_expect( file, NULL, 0 );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     DestroyWindow( hwnd );
     CloseHandle( event );
diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c
index 7e4ab3dc1f3..71e9f66834c 100644
--- a/dlls/dinput/tests/hid.c
+++ b/dlls/dinput/tests/hid.c
@@ -105,35 +105,35 @@ static const CERT_CONTEXT *testsign_sign( const WCHAR *filename )
     if (!ret && GetLastError() == NTE_EXISTS)
     {
         ret = CryptAcquireContextW( &provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET );
-        ok( ret, "Failed to delete container, error %#x\n", GetLastError() );
+        ok( ret, "Failed to delete container, error %#lx\n", GetLastError() );
         ret = CryptAcquireContextW( &provider, container_name, NULL, PROV_RSA_FULL, CRYPT_NEWKEYSET );
     }
-    ok( ret, "Failed to create container, error %#x\n", GetLastError() );
+    ok( ret, "Failed to create container, error %#lx\n", GetLastError() );
 
     ret = CryptGenKey( provider, AT_SIGNATURE, CRYPT_EXPORTABLE, &key );
-    ok( ret, "Failed to create key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to create key, error %#lx\n", GetLastError() );
     ret = CryptDestroyKey( key );
-    ok( ret, "Failed to destroy key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to destroy key, error %#lx\n", GetLastError() );
     ret = CryptGetUserKey( provider, AT_SIGNATURE, &key );
-    ok( ret, "Failed to get user key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to get user key, error %#lx\n", GetLastError() );
     ret = CryptDestroyKey( key );
-    ok( ret, "Failed to destroy key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to destroy key, error %#lx\n", GetLastError() );
 
     size = sizeof(encoded_name);
     ret = CertStrToNameW( X509_ASN_ENCODING, L"CN=winetest_cert", CERT_X500_NAME_STR, NULL,
                           encoded_name, &size, NULL );
-    ok( ret, "Failed to convert name, error %#x\n", GetLastError() );
+    ok( ret, "Failed to convert name, error %#lx\n", GetLastError() );
     key_info.CertIssuer.cbData = size;
     key_info.CertIssuer.pbData = encoded_name;
 
     size = sizeof(public_key_info_buffer);
     ret = CryptExportPublicKeyInfo( provider, AT_SIGNATURE, X509_ASN_ENCODING, public_key_info, &size );
-    ok( ret, "Failed to export public key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to export public key, error %#lx\n", GetLastError() );
     cert_info.SubjectPublicKeyInfo = *public_key_info;
 
     size = sizeof(hash_buffer);
     ret = CryptHashPublicKeyInfo( provider, CALG_MD5, 0, X509_ASN_ENCODING, public_key_info, hash_buffer, &size );
-    ok( ret, "Failed to hash public key, error %#x\n", GetLastError() );
+    ok( ret, "Failed to hash public key, error %#lx\n", GetLastError() );
 
     key_info.KeyId.cbData = size;
     key_info.KeyId.pbData = hash_buffer;
@@ -144,7 +144,7 @@ static const CERT_CONTEXT *testsign_sign( const WCHAR *filename )
 
     size = sizeof(encoded_key_id);
     ret = CryptEncodeObject( X509_ASN_ENCODING, X509_AUTHORITY_KEY_ID, &key_info, encoded_key_id, &size );
-    ok( ret, "Failed to convert name, error %#x\n", GetLastError() );
+    ok( ret, "Failed to convert name, error %#lx\n", GetLastError() );
 
     extension.pszObjId = (char *)szOID_AUTHORITY_KEY_IDENTIFIER;
     extension.fCritical = TRUE;
@@ -165,14 +165,14 @@ static const CERT_CONTEXT *testsign_sign( const WCHAR *filename )
     size = sizeof(cert_buffer);
     ret = CryptSignAndEncodeCertificate( provider, AT_SIGNATURE, X509_ASN_ENCODING, X509_CERT_TO_BE_SIGNED,
                                          &cert_info, &algid, NULL, cert_buffer, &size );
-    ok( ret, "Failed to create certificate, error %#x\n", GetLastError() );
+    ok( ret, "Failed to create certificate, error %#lx\n", GetLastError() );
 
     cert = CertCreateCertificateContext( X509_ASN_ENCODING, cert_buffer, size );
-    ok( !!cert, "Failed to create context, error %#x\n", GetLastError() );
+    ok( !!cert, "Failed to create context, error %#lx\n", GetLastError() );
 
     size = sizeof(provider_nameA);
     ret = CryptGetProvParam( provider, PP_NAME, provider_nameA, &size, 0 );
-    ok( ret, "Failed to get prov param, error %#x\n", GetLastError() );
+    ok( ret, "Failed to get prov param, error %#lx\n", GetLastError() );
     MultiByteToWideChar( CP_ACP, 0, (char *)provider_nameA, -1, provider_nameW, ARRAY_SIZE(provider_nameW) );
 
     provider_info.pwszContainerName = (WCHAR *)container_name;
@@ -180,41 +180,41 @@ static const CERT_CONTEXT *testsign_sign( const WCHAR *filename )
     provider_info.dwProvType = PROV_RSA_FULL;
     provider_info.dwKeySpec = AT_SIGNATURE;
     ret = CertSetCertificateContextProperty( cert, CERT_KEY_PROV_INFO_PROP_ID, 0, &provider_info );
-    ok( ret, "Failed to set provider info, error %#x\n", GetLastError() );
+    ok( ret, "Failed to set provider info, error %#lx\n", GetLastError() );
 
     ret = CryptReleaseContext( provider, 0 );
-    ok( ret, "failed to release context, error %u\n", GetLastError() );
+    ok( ret, "failed to release context, error %lu\n", GetLastError() );
 
     root_store = CertOpenStore( CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, L"root" );
     if (!root_store && GetLastError() == ERROR_ACCESS_DENIED)
     {
         win_skip( "Failed to open root store.\n" );
         ret = CertFreeCertificateContext( cert );
-        ok( ret, "Failed to free certificate, error %u\n", GetLastError() );
+        ok( ret, "Failed to free certificate, error %lu\n", GetLastError() );
         return NULL;
     }
-    ok( !!root_store, "Failed to open store, error %u\n", GetLastError() );
+    ok( !!root_store, "Failed to open store, error %lu\n", GetLastError() );
     ret = CertAddCertificateContextToStore( root_store, cert, CERT_STORE_ADD_ALWAYS, NULL );
     if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
     {
         win_skip( "Failed to add self-signed certificate to store.\n" );
         ret = CertFreeCertificateContext( cert );
-        ok( ret, "Failed to free certificate, error %u\n", GetLastError() );
+        ok( ret, "Failed to free certificate, error %lu\n", GetLastError() );
         ret = CertCloseStore( root_store, CERT_CLOSE_STORE_CHECK_FLAG );
-        ok( ret, "Failed to close store, error %u\n", GetLastError() );
+        ok( ret, "Failed to close store, error %lu\n", GetLastError() );
         return NULL;
     }
-    ok( ret, "Failed to add certificate, error %u\n", GetLastError() );
+    ok( ret, "Failed to add certificate, error %lu\n", GetLastError() );
     ret = CertCloseStore( root_store, CERT_CLOSE_STORE_CHECK_FLAG );
-    ok( ret, "Failed to close store, error %u\n", GetLastError() );
+    ok( ret, "Failed to close store, error %lu\n", GetLastError() );
 
     pub_store = CertOpenStore( CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0,
                                CERT_SYSTEM_STORE_LOCAL_MACHINE, L"trustedpublisher" );
-    ok( !!pub_store, "Failed to open store, error %u\n", GetLastError() );
+    ok( !!pub_store, "Failed to open store, error %lu\n", GetLastError() );
     ret = CertAddCertificateContextToStore( pub_store, cert, CERT_STORE_ADD_ALWAYS, NULL );
-    ok( ret, "Failed to add certificate, error %u\n", GetLastError() );
+    ok( ret, "Failed to add certificate, error %lu\n", GetLastError() );
     ret = CertCloseStore( pub_store, CERT_CLOSE_STORE_CHECK_FLAG );
-    ok( ret, "Failed to close store, error %u\n", GetLastError() );
+    ok( ret, "Failed to close store, error %lu\n", GetLastError() );
 
     subject.dwSubjectChoice = 1;
     subject.pdwIndex = &index;
@@ -231,7 +231,7 @@ static const CERT_CONTEXT *testsign_sign( const WCHAR *filename )
     authcode.pwszInfo = L"";
     hr = pSignerSign( &subject, &signer, &signature, NULL, NULL, NULL, NULL );
     todo_wine
-    ok( hr == S_OK || broken( hr == NTE_BAD_ALGID ) /* < 7 */, "Failed to sign, hr %#x\n", hr );
+    ok( hr == S_OK || broken( hr == NTE_BAD_ALGID ) /* < 7 */, "Failed to sign, hr %#lx\n", hr );
 
     return cert;
 }
@@ -244,29 +244,29 @@ static void testsign_cleanup( const CERT_CONTEXT *cert )
     BOOL ret;
 
     root_store = CertOpenStore( CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, L"root" );
-    ok( !!root_store, "Failed to open store, error %u\n", GetLastError() );
+    ok( !!root_store, "Failed to open store, error %lu\n", GetLastError() );
     store_cert = CertFindCertificateInStore( root_store, X509_ASN_ENCODING, 0, CERT_FIND_EXISTING, cert, NULL );
-    ok( !!store_cert, "Failed to find root certificate, error %u\n", GetLastError() );
+    ok( !!store_cert, "Failed to find root certificate, error %lu\n", GetLastError() );
     ret = CertDeleteCertificateFromStore( store_cert );
-    ok( ret, "Failed to remove certificate, error %u\n", GetLastError() );
+    ok( ret, "Failed to remove certificate, error %lu\n", GetLastError() );
     ret = CertCloseStore( root_store, CERT_CLOSE_STORE_CHECK_FLAG );
-    ok( ret, "Failed to close store, error %u\n", GetLastError() );
+    ok( ret, "Failed to close store, error %lu\n", GetLastError() );
 
     pub_store = CertOpenStore( CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0,
                                CERT_SYSTEM_STORE_LOCAL_MACHINE, L"trustedpublisher" );
-    ok( !!pub_store, "Failed to open store, error %u\n", GetLastError() );
+    ok( !!pub_store, "Failed to open store, error %lu\n", GetLastError() );
     store_cert = CertFindCertificateInStore( pub_store, X509_ASN_ENCODING, 0, CERT_FIND_EXISTING, cert, NULL );
-    ok( !!store_cert, "Failed to find publisher certificate, error %u\n", GetLastError() );
+    ok( !!store_cert, "Failed to find publisher certificate, error %lu\n", GetLastError() );
     ret = CertDeleteCertificateFromStore( store_cert );
-    ok( ret, "Failed to remove certificate, error %u\n", GetLastError() );
+    ok( ret, "Failed to remove certificate, error %lu\n", GetLastError() );
     ret = CertCloseStore( pub_store, CERT_CLOSE_STORE_CHECK_FLAG );
-    ok( ret, "Failed to close store, error %u\n", GetLastError() );
+    ok( ret, "Failed to close store, error %lu\n", GetLastError() );
 
     ret = CertFreeCertificateContext( cert );
-    ok( ret, "Failed to free certificate, error %u\n", GetLastError() );
+    ok( ret, "Failed to free certificate, error %lu\n", GetLastError() );
 
     ret = CryptAcquireContextW( &provider, container_name, NULL, PROV_RSA_FULL, CRYPT_DELETEKEYSET );
-    ok( ret, "Failed to delete container, error %#x\n", GetLastError() );
+    ok( ret, "Failed to delete container, error %#lx\n", GetLastError() );
 }
 
 static void load_resource( const WCHAR *name, WCHAR *filename )
@@ -281,7 +281,7 @@ static void load_resource( const WCHAR *name, WCHAR *filename )
     GetTempFileNameW( path, name, 0, filename );
 
     file = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 );
-    ok( file != INVALID_HANDLE_VALUE, "failed to create %s, error %u\n", debugstr_w(filename), GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "failed to create %s, error %lu\n", debugstr_w(filename), GetLastError() );
 
     res = FindResourceW( NULL, name, L"TESTDLL" );
     ok( res != 0, "couldn't find resource\n" );
@@ -357,7 +357,7 @@ static void add_file_to_catalog( HANDLE catalog, const WCHAR *file )
 
     ret = CryptSIPRetrieveSubjectGuidForCatalogFile( file, NULL, &subject_guid );
     todo_wine
-    ok( ret, "Failed to get subject guid, error %u\n", GetLastError() );
+    ok( ret, "Failed to get subject guid, error %lu\n", GetLastError() );
 
     size = 0;
     subject_info.pgSubjectType = &subject_guid;
@@ -367,12 +367,12 @@ static void add_file_to_catalog( HANDLE catalog, const WCHAR *file )
                            SPC_EXC_PE_PAGE_HASHES_FLAG | 0x10000;
     ret = CryptSIPCreateIndirectData( &subject_info, &size, NULL );
     todo_wine
-    ok( ret, "Failed to get indirect data size, error %u\n", GetLastError() );
+    ok( ret, "Failed to get indirect data size, error %lu\n", GetLastError() );
 
     indirect_data = malloc( size );
     ret = CryptSIPCreateIndirectData( &subject_info, &size, indirect_data );
     todo_wine
-    ok( ret, "Failed to get indirect data, error %u\n", GetLastError() );
+    ok( ret, "Failed to get indirect data, error %lu\n", GetLastError() );
     if (ret)
     {
         memset( hash_buffer, 0, sizeof(hash_buffer) );
@@ -381,19 +381,19 @@ static void add_file_to_catalog( HANDLE catalog, const WCHAR *file )
 
         member = CryptCATPutMemberInfo( catalog, (WCHAR *)file, hash_buffer, &subject_guid,
                                         0, size, (BYTE *)indirect_data );
-        ok( !!member, "Failed to write member, error %u\n", GetLastError() );
+        ok( !!member, "Failed to write member, error %lu\n", GetLastError() );
 
         if (wcsrchr( file, '\\' )) filepart = wcsrchr( file, '\\' ) + 1;
 
         ret = !!CryptCATPutAttrInfo( catalog, member, (WCHAR *)L"File",
                                      CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
                                      (wcslen( filepart ) + 1) * 2, (BYTE *)filepart );
-        ok( ret, "Failed to write attr, error %u\n", GetLastError() );
+        ok( ret, "Failed to write attr, error %lu\n", GetLastError() );
 
         ret = !!CryptCATPutAttrInfo( catalog, member, (WCHAR *)L"OSAttr",
                                      CRYPTCAT_ATTR_NAMEASCII | CRYPTCAT_ATTR_DATAASCII | CRYPTCAT_ATTR_AUTHENTICATED,
                                      sizeof(L"2:6.0"), (BYTE *)L"2:6.0" );
-        ok( ret, "Failed to write attr, error %u\n", GetLastError() );
+        ok( ret, "Failed to write attr, error %lu\n", GetLastError() );
     }
 }
 
@@ -407,9 +407,9 @@ static void unload_driver( SC_HANDLE service )
         BOOL ret;
         Sleep( 100 );
         ret = QueryServiceStatus( service, &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 %lu\n", status.dwCurrentState );
 
     DeleteService( service );
     CloseServiceHandle( service );
@@ -427,35 +427,35 @@ void pnp_driver_stop(void)
     BOOL ret;
 
     set = SetupDiCreateDeviceInfoList( NULL, NULL );
-    ok( set != INVALID_HANDLE_VALUE, "failed to create device list, error %u\n", GetLastError() );
+    ok( set != INVALID_HANDLE_VALUE, "failed to create device list, error %lu\n", GetLastError() );
 
     ret = SetupDiOpenDeviceInfoW( set, L"root\\winetest\\0", NULL, 0, &device );
     if (!ret && GetLastError() == ERROR_NO_SUCH_DEVINST)
     {
         ret = SetupDiDestroyDeviceInfoList( set );
-        ok( ret, "failed to destroy set, error %u\n", GetLastError() );
+        ok( ret, "failed to destroy set, error %lu\n", GetLastError() );
         return;
     }
-    ok( ret, "failed to open device, error %u\n", GetLastError() );
+    ok( ret, "failed to open device, error %lu\n", GetLastError() );
 
     ret = SetupDiCallClassInstaller( DIF_REMOVE, set, &device );
-    ok( ret, "failed to remove device, error %u\n", GetLastError() );
+    ok( ret, "failed to remove device, error %lu\n", GetLastError() );
 
     file = CreateFileW( L"\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0,
                         NULL, OPEN_EXISTING, 0, NULL );
     ok( file == INVALID_HANDLE_VALUE, "expected failure\n" );
-    ok( GetLastError() == ERROR_FILE_NOT_FOUND, "got error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_FILE_NOT_FOUND, "got error %lu\n", GetLastError() );
 
     ret = SetupDiDestroyDeviceInfoList( set );
-    ok( ret, "failed to destroy set, error %u\n", GetLastError() );
+    ok( ret, "failed to destroy set, error %lu\n", GetLastError() );
 
     /* Windows stops the service but does not delete it. */
     manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT );
-    ok( !!manager, "failed to open service manager, error %u\n", GetLastError() );
+    ok( !!manager, "failed to open service manager, error %lu\n", GetLastError() );
 
     service = OpenServiceW( manager, L"winetest", SERVICE_STOP | DELETE );
     if (service) unload_driver( service );
-    else ok( GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, "got error %u\n", GetLastError() );
+    else ok( GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST, "got error %lu\n", GetLastError() );
 
     CloseServiceHandle( manager );
 
@@ -463,7 +463,7 @@ void pnp_driver_stop(void)
     do
     {
         ReadFile( okfile, buffer, sizeof(buffer), &size, NULL );
-        printf( "%.*s", size, buffer );
+        printf( "%.*s", (int)size, buffer );
     } while (size == sizeof(buffer));
     SetFilePointer( okfile, 0, NULL, FILE_BEGIN );
     SetEndOfFile( okfile );
@@ -473,19 +473,19 @@ void pnp_driver_stop(void)
 
     GetFullPathNameW( L"winetest.inf", ARRAY_SIZE(path), path, NULL );
     ret = SetupCopyOEMInfW( path, NULL, 0, 0, dest, ARRAY_SIZE(dest), NULL, &filepart );
-    ok( ret, "Failed to copy INF, error %u\n", GetLastError() );
+    ok( ret, "Failed to copy INF, error %lu\n", GetLastError() );
     ret = SetupUninstallOEMInfW( filepart, 0, NULL );
-    ok( ret, "Failed to uninstall INF, error %u\n", GetLastError() );
+    ok( ret, "Failed to uninstall INF, error %lu\n", GetLastError() );
 
     ret = DeleteFileW( L"winetest.cat" );
-    ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+    ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
     ret = DeleteFileW( L"winetest.inf" );
-    ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+    ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
     ret = DeleteFileW( L"winetest.sys" );
-    ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+    ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
     /* Windows 10 apparently deletes the image in SetupUninstallOEMInf(). */
     ret = DeleteFileW( L"C:/windows/system32/drivers/winetest.sys" );
-    ok( ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %u\n", GetLastError() );
+    ok( ret || GetLastError() == ERROR_FILE_NOT_FOUND, "Failed to delete file, error %lu\n", GetLastError() );
 }
 
 BOOL pnp_driver_start( const WCHAR *resource )
@@ -506,7 +506,7 @@ BOOL pnp_driver_start( const WCHAR *resource )
 
     load_resource( resource, filename );
     ret = MoveFileExW( filename, L"winetest.sys", MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING );
-    ok( ret, "failed to move file, error %u\n", GetLastError() );
+    ok( ret, "failed to move file, error %lu\n", GetLastError() );
 
     f = fopen( "winetest.inf", "w" );
     ok( !!f, "failed to open winetest.inf: %s\n", strerror( errno ) );
@@ -516,26 +516,26 @@ BOOL pnp_driver_start( const WCHAR *resource )
     /* Create the catalog file. */
 
     catalog = CryptCATOpen( (WCHAR *)L"winetest.cat", CRYPTCAT_OPEN_CREATENEW, 0, CRYPTCAT_VERSION_1, 0 );
-    ok( catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %u\n", GetLastError() );
+    ok( catalog != INVALID_HANDLE_VALUE, "Failed to create catalog, error %lu\n", GetLastError() );
 
     add_file_to_catalog( catalog, L"winetest.sys" );
     add_file_to_catalog( catalog, L"winetest.inf" );
 
     ret = CryptCATPersistStore( catalog );
     todo_wine
-    ok( ret, "Failed to write catalog, error %u\n", GetLastError() );
+    ok( ret, "Failed to write catalog, error %lu\n", GetLastError() );
 
     ret = CryptCATClose( catalog );
-    ok( ret, "Failed to close catalog, error %u\n", GetLastError() );
+    ok( ret, "Failed to close catalog, error %lu\n", GetLastError() );
 
     if (!(cert = testsign_sign( L"winetest.cat" )))
     {
         ret = DeleteFileW( L"winetest.cat" );
-        ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+        ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
         ret = DeleteFileW( L"winetest.inf" );
-        ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+        ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
         ret = DeleteFileW( L"winetest.sys" );
-        ok( ret, "Failed to delete file, error %u\n", GetLastError() );
+        ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
         winetest_mute_threshold = old_mute_threshold;
         return FALSE;
     }
@@ -543,35 +543,35 @@ BOOL pnp_driver_start( const WCHAR *resource )
     /* Install the driver. */
 
     set = SetupDiCreateDeviceInfoList( NULL, NULL );
-    ok( set != INVALID_HANDLE_VALUE, "failed to create device list, error %u\n", GetLastError() );
+    ok( set != INVALID_HANDLE_VALUE, "failed to create device list, error %lu\n", GetLastError() );
 
     ret = SetupDiCreateDeviceInfoW( set, L"root\\winetest\\0", &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 = SetupDiSetDeviceRegistryPropertyW( set, &device, SPDRP_HARDWAREID, (const BYTE *)hardware_id,
                                              sizeof(hardware_id) );
-    ok( ret, "failed to create set hardware ID, error %u\n", GetLastError() );
+    ok( ret, "failed to create set hardware ID, error %lu\n", GetLastError() );
 
     ret = SetupDiCallClassInstaller( DIF_REGISTERDEVICE, set, &device );
-    ok( ret, "failed to register device, error %u\n", GetLastError() );
+    ok( ret, "failed to register device, error %lu\n", GetLastError() );
 
     ret = SetupDiDestroyDeviceInfoList( set );
-    ok( ret, "failed to destroy set, error %u\n", GetLastError() );
+    ok( ret, "failed to destroy set, error %lu\n", GetLastError() );
 
     GetFullPathNameW( L"winetest.inf", ARRAY_SIZE(path), path, NULL );
 
     ret = UpdateDriverForPlugAndPlayDevicesW( NULL, hardware_id, path, INSTALLFLAG_FORCE, &need_reboot );
-    ok( ret, "failed to install device, error %u\n", GetLastError() );
+    ok( ret, "failed to install device, error %lu\n", GetLastError() );
     ok( !need_reboot, "expected no reboot necessary\n" );
 
     testsign_cleanup( cert );
 
     /* Check that the service is created and started. */
     manager = OpenSCManagerW( NULL, NULL, SC_MANAGER_CONNECT );
-    ok( !!manager, "failed to open service manager, error %u\n", GetLastError() );
+    ok( !!manager, "failed to open service manager, error %lu\n", GetLastError() );
 
     service = OpenServiceW( manager, L"winetest", SERVICE_START );
-    ok( !!service, "failed to open service, error %u\n", GetLastError() );
+    ok( !!service, "failed to open service, error %lu\n", GetLastError() );
 
     ret = StartServiceW( service, 0, NULL );
     ok( !ret, "service didn't start automatically\n" );
@@ -579,7 +579,7 @@ BOOL pnp_driver_start( const WCHAR *resource )
     {
         /* If Secure Boot is enabled or the machine is 64-bit, it will reject an unsigned driver. */
         ok( GetLastError() == ERROR_DRIVER_BLOCKED || GetLastError() == ERROR_INVALID_IMAGE_HASH,
-            "unexpected error %u\n", GetLastError() );
+            "unexpected error %lu\n", GetLastError() );
         win_skip( "Failed to start service; probably your machine doesn't accept unsigned drivers.\n" );
     }
 
@@ -687,12 +687,12 @@ static inline void check_hidp_value_caps_( int line, HIDP_VALUE_CAPS *caps, cons
     check_member_( __FILE__, line, *caps, *exp, "%d", HasNull );
     check_member_( __FILE__, line, *caps, *exp, "%d", BitSize );
     check_member_( __FILE__, line, *caps, *exp, "%d", ReportCount );
-    check_member_( __FILE__, line, *caps, *exp, "%d", UnitsExp );
-    check_member_( __FILE__, line, *caps, *exp, "%d", Units );
-    check_member_( __FILE__, line, *caps, *exp, "%d", LogicalMin );
-    check_member_( __FILE__, line, *caps, *exp, "%d", LogicalMax );
-    check_member_( __FILE__, line, *caps, *exp, "%d", PhysicalMin );
-    check_member_( __FILE__, line, *caps, *exp, "%d", PhysicalMax );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", UnitsExp );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", Units );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", LogicalMin );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", LogicalMax );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", PhysicalMin );
+    check_member_( __FILE__, line, *caps, *exp, "%ld", PhysicalMax );
 
     if (!caps->IsRange && !exp->IsRange)
     {
@@ -736,9 +736,9 @@ BOOL sync_ioctl_( const char *file, int line, HANDLE device, DWORD code, void *i
     if (!ret && GetLastError() == ERROR_IO_PENDING)
     {
         res = WaitForSingleObject( ovl.hEvent, timeout );
-        ok_(file, line)( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#x\n", res );
+        ok_(file, line)( res == WAIT_OBJECT_0, "WaitForSingleObject returned %#lx\n", res );
         ret = GetOverlappedResult( device, &ovl, &out_len, FALSE );
-        ok_(file, line)( ret, "GetOverlappedResult returned %u\n", GetLastError() );
+        ok_(file, line)( ret, "GetOverlappedResult returned %lu\n", GetLastError() );
     }
     CloseHandle( ovl.hEvent );
 
@@ -763,15 +763,15 @@ void set_hid_expect_( const char *file, int line, HANDLE device, struct hid_expe
 
     fill_context( line, context, ARRAY_SIZE(context) );
     ret = sync_ioctl_( file, line, device, IOCTL_WINETEST_HID_SET_CONTEXT, context, ARRAY_SIZE(context), NULL, 0, INFINITE );
-    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %u\n", GetLastError() );
+    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %lu\n", GetLastError() );
     ret = sync_ioctl_( file, line, device, IOCTL_WINETEST_HID_SET_EXPECT, expect, expect_size, NULL, 0, INFINITE );
-    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_EXPECT failed, last error %u\n", GetLastError() );
+    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_EXPECT failed, last error %lu\n", GetLastError() );
 }
 
 void wait_hid_expect_( const char *file, int line, HANDLE device, DWORD timeout )
 {
     BOOL ret = sync_ioctl_( file, line, device, IOCTL_WINETEST_HID_WAIT_EXPECT, NULL, 0, NULL, 0, timeout );
-    ok_(file, line)( ret, "IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error %u\n", GetLastError() );
+    ok_(file, line)( ret, "IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error %lu\n", GetLastError() );
 
     set_hid_expect_( file, line, device, NULL, 0 );
 }
@@ -783,9 +783,9 @@ void send_hid_input_( const char *file, int line, HANDLE device, struct hid_expe
 
     fill_context( line, context, ARRAY_SIZE(context) );
     ret = sync_ioctl_( file, line, device, IOCTL_WINETEST_HID_SET_CONTEXT, context, ARRAY_SIZE(context), NULL, 0, INFINITE );
-    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %u\n", GetLastError() );
+    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %lu\n", GetLastError() );
     ret = sync_ioctl_( file, line, device, IOCTL_WINETEST_HID_SEND_INPUT, expect, expect_size, NULL, 0, INFINITE );
-    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SEND_INPUT failed, last error %u\n", GetLastError() );
+    ok_(file, line)( ret, "IOCTL_WINETEST_HID_SEND_INPUT failed, last error %lu\n", GetLastError() );
 }
 
 static void test_hidp_get_input( HANDLE file, int report_id, ULONG report_len, PHIDP_PREPARSED_DATA preparsed )
@@ -817,18 +817,18 @@ static void test_hidp_get_input( HANDLE file, int report_id, ULONG report_len, P
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Input, report_id, preparsed, report, report_len );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetInputReport( file, report, 0 );
     ok( !ret, "HidD_GetInputReport succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetInputReport returned error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetInputReport returned error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetInputReport( file, report, report_len - 1 );
     ok( !ret, "HidD_GetInputReport succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-        "HidD_GetInputReport returned error %u\n", GetLastError() );
+        "HidD_GetInputReport returned error %lu\n", GetLastError() );
 
     if (!report_id)
     {
@@ -855,13 +855,13 @@ static void test_hidp_get_input( HANDLE file, int report_id, ULONG report_len, P
     ret = HidD_GetInputReport( file, buffer, report_len );
     if (report_id || broken( !ret ) /* w7u */)
     {
-        ok( !ret, "HidD_GetInputReport succeeded, last error %u\n", GetLastError() );
+        ok( !ret, "HidD_GetInputReport succeeded, last error %lu\n", GetLastError() );
         ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-            "HidD_GetInputReport returned error %u\n", GetLastError() );
+            "HidD_GetInputReport returned error %lu\n", GetLastError() );
     }
     else
     {
-        ok( ret, "HidD_GetInputReport failed, last error %u\n", GetLastError() );
+        ok( ret, "HidD_GetInputReport failed, last error %lu\n", GetLastError() );
         ok( buffer[0] == 0x5a, "got buffer[0] %x, expected 0x5a\n", (BYTE)buffer[0] );
     }
 
@@ -869,14 +869,14 @@ static void test_hidp_get_input( HANDLE file, int report_id, ULONG report_len, P
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetInputReport( file, report, report_len );
-    ok( ret, "HidD_GetInputReport failed, last error %u\n", GetLastError() );
+    ok( ret, "HidD_GetInputReport failed, last error %lu\n", GetLastError() );
     ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id );
 
     SetLastError( 0xdeadbeef );
     length = report_len * 2;
     ret = sync_ioctl( file, IOCTL_HID_GET_INPUT_REPORT, NULL, 0, report, &length, INFINITE );
-    ok( ret, "IOCTL_HID_GET_INPUT_REPORT failed, last error %u\n", GetLastError() );
-    ok( length == 3, "got length %u, expected 3\n", length );
+    ok( ret, "IOCTL_HID_GET_INPUT_REPORT failed, last error %lu\n", GetLastError() );
+    ok( length == 3, "got length %lu, expected 3\n", length );
     ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id );
 
     set_hid_expect( file, NULL, 0 );
@@ -911,18 +911,18 @@ static void test_hidp_get_feature( HANDLE file, int report_id, ULONG report_len,
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Feature, report_id, preparsed, report, report_len );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetFeature( file, report, 0 );
     ok( !ret, "HidD_GetFeature succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetFeature returned error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_GetFeature returned error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetFeature( file, report, report_len - 1 );
     ok( !ret, "HidD_GetFeature succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-        "HidD_GetFeature returned error %u\n", GetLastError() );
+        "HidD_GetFeature returned error %lu\n", GetLastError() );
 
     if (!report_id)
     {
@@ -949,13 +949,13 @@ static void test_hidp_get_feature( HANDLE file, int report_id, ULONG report_len,
     ret = HidD_GetFeature( file, buffer, report_len );
     if (report_id || broken( !ret ))
     {
-        ok( !ret, "HidD_GetFeature succeeded, last error %u\n", GetLastError() );
+        ok( !ret, "HidD_GetFeature succeeded, last error %lu\n", GetLastError() );
         ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-            "HidD_GetFeature returned error %u\n", GetLastError() );
+            "HidD_GetFeature returned error %lu\n", GetLastError() );
     }
     else
     {
-        ok( ret, "HidD_GetFeature failed, last error %u\n", GetLastError() );
+        ok( ret, "HidD_GetFeature failed, last error %lu\n", GetLastError() );
         ok( buffer[0] == 0x5a, "got buffer[0] %x, expected 0x5a\n", (BYTE)buffer[0] );
     }
 
@@ -963,14 +963,14 @@ static void test_hidp_get_feature( HANDLE file, int report_id, ULONG report_len,
 
     SetLastError( 0xdeadbeef );
     ret = HidD_GetFeature( file, report, report_len );
-    ok( ret, "HidD_GetFeature failed, last error %u\n", GetLastError() );
+    ok( ret, "HidD_GetFeature failed, last error %lu\n", GetLastError() );
     ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id );
 
     length = report_len * 2;
     SetLastError( 0xdeadbeef );
     ret = sync_ioctl( file, IOCTL_HID_GET_FEATURE, NULL, 0, report, &length, INFINITE );
-    ok( ret, "IOCTL_HID_GET_FEATURE failed, last error %u\n", GetLastError() );
-    ok( length == 3, "got length %u, expected 3\n", length );
+    ok( ret, "IOCTL_HID_GET_FEATURE failed, last error %lu\n", GetLastError() );
+    ok( length == 3, "got length %lu, expected 3\n", length );
     ok( report[0] == report_id, "got report[0] %02x, expected %02x\n", report[0], report_id );
 
     set_hid_expect( file, NULL, 0 );
@@ -1009,18 +1009,18 @@ static void test_hidp_set_feature( HANDLE file, int report_id, ULONG report_len,
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Feature, report_id, preparsed, report, report_len );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetFeature( file, report, 0 );
     ok( !ret, "HidD_SetFeature succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_SetFeature returned error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_SetFeature returned error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetFeature( file, report, report_len - 1 );
     ok( !ret, "HidD_SetFeature succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-        "HidD_SetFeature returned error %u\n", GetLastError() );
+        "HidD_SetFeature returned error %lu\n", GetLastError() );
 
     if (!report_id)
     {
@@ -1047,32 +1047,32 @@ static void test_hidp_set_feature( HANDLE file, int report_id, ULONG report_len,
     ret = HidD_SetFeature( file, buffer, report_len );
     if (report_id || broken( !ret ))
     {
-        ok( !ret, "HidD_SetFeature succeeded, last error %u\n", GetLastError() );
+        ok( !ret, "HidD_SetFeature succeeded, last error %lu\n", GetLastError() );
         ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-            "HidD_SetFeature returned error %u\n", GetLastError() );
+            "HidD_SetFeature returned error %lu\n", GetLastError() );
     }
     else
     {
-        ok( ret, "HidD_SetFeature failed, last error %u\n", GetLastError() );
+        ok( ret, "HidD_SetFeature failed, last error %lu\n", GetLastError() );
     }
 
     set_hid_expect( file, expect, sizeof(expect) );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetFeature( file, report, report_len );
-    ok( ret, "HidD_SetFeature failed, last error %u\n", GetLastError() );
+    ok( ret, "HidD_SetFeature failed, last error %lu\n", GetLastError() );
 
     length = report_len * 2;
     SetLastError( 0xdeadbeef );
     ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, NULL, 0, report, &length, INFINITE );
     ok( !ret, "IOCTL_HID_SET_FEATURE succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "IOCTL_HID_SET_FEATURE returned error %u\n",
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "IOCTL_HID_SET_FEATURE returned error %lu\n",
         GetLastError() );
     length = 0;
     SetLastError( 0xdeadbeef );
     ret = sync_ioctl( file, IOCTL_HID_SET_FEATURE, report, report_len * 2, NULL, &length, INFINITE );
-    ok( ret, "IOCTL_HID_SET_FEATURE failed, last error %u\n", GetLastError() );
-    ok( length == 3, "got length %u, expected 3\n", length );
+    ok( ret, "IOCTL_HID_SET_FEATURE failed, last error %lu\n", GetLastError() );
+    ok( length == 3, "got length %lu, expected 3\n", length );
 
     set_hid_expect( file, NULL, 0 );
 }
@@ -1106,21 +1106,21 @@ static void test_hidp_set_output( HANDLE file, int report_id, ULONG report_len,
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Output, report_id, preparsed, report, report_len );
-    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#lx\n", status );
     memset( report, 0, report_len );
     report[0] = report_id;
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetOutputReport( file, report, 0 );
     ok( !ret, "HidD_SetOutputReport succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_SetOutputReport returned error %u\n",
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "HidD_SetOutputReport returned error %lu\n",
         GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetOutputReport( file, report, report_len - 1 );
     ok( !ret, "HidD_SetOutputReport succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-        "HidD_SetOutputReport returned error %u\n", GetLastError() );
+        "HidD_SetOutputReport returned error %lu\n", GetLastError() );
 
     if (!report_id)
     {
@@ -1142,32 +1142,32 @@ static void test_hidp_set_output( HANDLE file, int report_id, ULONG report_len,
     ret = HidD_SetOutputReport( file, buffer, report_len );
     if (report_id || broken( !ret ))
     {
-        ok( !ret, "HidD_SetOutputReport succeeded, last error %u\n", GetLastError() );
+        ok( !ret, "HidD_SetOutputReport succeeded, last error %lu\n", GetLastError() );
         ok( GetLastError() == ERROR_INVALID_PARAMETER || broken( GetLastError() == ERROR_CRC ),
-            "HidD_SetOutputReport returned error %u\n", GetLastError() );
+            "HidD_SetOutputReport returned error %lu\n", GetLastError() );
     }
     else
     {
-        ok( ret, "HidD_SetOutputReport failed, last error %u\n", GetLastError() );
+        ok( ret, "HidD_SetOutputReport failed, last error %lu\n", GetLastError() );
     }
 
     set_hid_expect( file, expect, sizeof(expect) );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetOutputReport( file, report, report_len );
-    ok( ret, "HidD_SetOutputReport failed, last error %u\n", GetLastError() );
+    ok( ret, "HidD_SetOutputReport failed, last error %lu\n", GetLastError() );
 
     length = report_len * 2;
     SetLastError( 0xdeadbeef );
     ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, NULL, 0, report, &length, INFINITE );
     ok( !ret, "IOCTL_HID_SET_OUTPUT_REPORT succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_USER_BUFFER,
-        "IOCTL_HID_SET_OUTPUT_REPORT returned error %u\n", GetLastError() );
+        "IOCTL_HID_SET_OUTPUT_REPORT returned error %lu\n", GetLastError() );
     length = 0;
     SetLastError( 0xdeadbeef );
     ret = sync_ioctl( file, IOCTL_HID_SET_OUTPUT_REPORT, report, report_len * 2, NULL, &length, INFINITE );
-    ok( ret, "IOCTL_HID_SET_OUTPUT_REPORT failed, last error %u\n", GetLastError() );
-    ok( length == 3, "got length %u, expected 3\n", length );
+    ok( ret, "IOCTL_HID_SET_OUTPUT_REPORT failed, last error %lu\n", GetLastError() );
+    ok( length == 3, "got length %lu, expected 3\n", length );
 
     set_hid_expect( file, NULL, 0 );
 }
@@ -1191,14 +1191,14 @@ static void test_write_file( HANDLE file, int report_id, ULONG report_len )
     SetLastError( 0xdeadbeef );
     ret = WriteFile( file, report, 0, &length, NULL );
     ok( !ret, "WriteFile succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "WriteFile returned error %u\n", GetLastError() );
-    ok( length == 0, "WriteFile returned %x\n", length );
+    ok( GetLastError() == ERROR_INVALID_USER_BUFFER, "WriteFile returned error %lu\n", GetLastError() );
+    ok( length == 0, "WriteFile returned %#lx\n", length );
     SetLastError( 0xdeadbeef );
     ret = WriteFile( file, report, report_len - 1, &length, NULL );
     ok( !ret, "WriteFile succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INVALID_USER_BUFFER,
-        "WriteFile returned error %u\n", GetLastError() );
-    ok( length == 0, "WriteFile returned %x\n", length );
+        "WriteFile returned error %lu\n", GetLastError() );
+    ok( length == 0, "WriteFile returned %#lx\n", length );
 
     set_hid_expect( file, &expect, sizeof(expect) );
 
@@ -1209,8 +1209,8 @@ static void test_write_file( HANDLE file, int report_id, ULONG report_len )
     if (report_id || broken( !ret ) /* w7u */)
     {
         ok( !ret, "WriteFile succeeded\n" );
-        ok( GetLastError() == ERROR_INVALID_PARAMETER, "WriteFile returned error %u\n", GetLastError() );
-        ok( length == 0, "WriteFile wrote %u\n", length );
+        ok( GetLastError() == ERROR_INVALID_PARAMETER, "WriteFile returned error %lu\n", GetLastError() );
+        ok( length == 0, "WriteFile wrote %lu\n", length );
         SetLastError( 0xdeadbeef );
         report[0] = report_id;
         ret = WriteFile( file, report, report_len, &length, NULL );
@@ -1218,13 +1218,13 @@ static void test_write_file( HANDLE file, int report_id, ULONG report_len )
 
     if (report_id)
     {
-        ok( ret, "WriteFile failed, last error %u\n", GetLastError() );
-        ok( length == 2, "WriteFile wrote %u\n", length );
+        ok( ret, "WriteFile failed, last error %lu\n", GetLastError() );
+        ok( length == 2, "WriteFile wrote %lu\n", length );
     }
     else
     {
-        ok( ret, "WriteFile failed, last error %u\n", GetLastError() );
-        ok( length == 3, "WriteFile wrote %u\n", length );
+        ok( ret, "WriteFile failed, last error %lu\n", GetLastError() );
+        ok( length == 3, "WriteFile wrote %lu\n", length );
     }
 
     set_hid_expect( file, NULL, 0 );
@@ -1408,27 +1408,27 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     BOOL ret;
 
     ret = HidD_GetPreparsedData( file, &preparsed_data );
-    ok( ret, "HidD_GetPreparsedData failed with error %u\n", GetLastError() );
+    ok( ret, "HidD_GetPreparsedData failed with error %lu\n", GetLastError() );
 
     memset( buffer, 0, sizeof(buffer) );
     status = HidP_GetCaps( (PHIDP_PREPARSED_DATA)buffer, &caps );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetCaps returned %#lx\n", status );
     status = HidP_GetCaps( preparsed_data, &caps );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetCaps returned %#lx\n", status );
     check_hidp_caps( &caps, expect_caps );
 
     collection_count = 0;
     status = HidP_GetLinkCollectionNodes( collections, &collection_count, preparsed_data );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetLinkCollectionNodes returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetLinkCollectionNodes returned %#lx\n", status );
     ok( collection_count == caps.NumberLinkCollectionNodes,
-        "got %d collection nodes, expected %d\n", collection_count, caps.NumberLinkCollectionNodes );
+        "got %ld collection nodes, expected %d\n", collection_count, caps.NumberLinkCollectionNodes );
     collection_count = ARRAY_SIZE(collections);
     status = HidP_GetLinkCollectionNodes( collections, &collection_count, (PHIDP_PREPARSED_DATA)buffer );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetLinkCollectionNodes returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetLinkCollectionNodes returned %#lx\n", status );
     status = HidP_GetLinkCollectionNodes( collections, &collection_count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetLinkCollectionNodes returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetLinkCollectionNodes returned %#lx\n", status );
     ok( collection_count == caps.NumberLinkCollectionNodes,
-        "got %d collection nodes, expected %d\n", collection_count, caps.NumberLinkCollectionNodes );
+        "got %ld collection nodes, expected %d\n", collection_count, caps.NumberLinkCollectionNodes );
 
     for (i = 0; i < ARRAY_SIZE(expect_collections); ++i)
     {
@@ -1439,20 +1439,20 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     count = ARRAY_SIZE(button_caps);
     status = HidP_GetButtonCaps( HidP_Output, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetButtonCaps returned %#lx\n", status );
     status = HidP_GetButtonCaps( HidP_Feature + 1, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetButtonCaps returned %#lx\n", status );
     count = 0;
     status = HidP_GetButtonCaps( HidP_Input, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetButtonCaps returned %#lx\n", status );
     ok( count == caps.NumberInputButtonCaps, "HidP_GetButtonCaps returned count %d, expected %d\n",
         count, caps.NumberInputButtonCaps );
     count = ARRAY_SIZE(button_caps);
     status = HidP_GetButtonCaps( HidP_Input, button_caps, &count, (PHIDP_PREPARSED_DATA)buffer );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetButtonCaps returned %#lx\n", status );
     memset( button_caps, 0, sizeof(button_caps) );
     status = HidP_GetButtonCaps( HidP_Input, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetButtonCaps returned %#lx\n", status );
     ok( count == caps.NumberInputButtonCaps, "HidP_GetButtonCaps returned count %d, expected %d\n",
         count, caps.NumberInputButtonCaps );
 
@@ -1465,58 +1465,58 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     count = ARRAY_SIZE(button_caps) - 1;
     status = HidP_GetSpecificButtonCaps( HidP_Output, 0, 0, 0, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     status = HidP_GetSpecificButtonCaps( HidP_Feature + 1, 0, 0, 0, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     count = 0;
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0, 0, 0, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == caps.NumberInputButtonCaps, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n",
         count, caps.NumberInputButtonCaps );
     count = ARRAY_SIZE(button_caps) - 1;
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0, 0, 0, button_caps, &count, (PHIDP_PREPARSED_DATA)buffer );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
 
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0, 0, 0, button_caps + 1, &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == caps.NumberInputButtonCaps, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n",
         count, caps.NumberInputButtonCaps );
     check_hidp_button_caps( &button_caps[1], &button_caps[0] );
 
     status = HidP_GetSpecificButtonCaps( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, 5, button_caps + 1,
                                          &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == 1, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n", count, 1 );
     check_hidp_button_caps( &button_caps[1], &button_caps[0] );
 
     count = 0xbeef;
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0xfffe, 0, 0, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n", count, 0 );
     count = 0xbeef;
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0, 0xfffe, 0, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n", count, 0 );
     count = 0xbeef;
     status = HidP_GetSpecificButtonCaps( HidP_Input, 0, 0, 0xfffe, button_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificButtonCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificButtonCaps returned count %d, expected %d\n", count, 0 );
 
     count = ARRAY_SIZE(value_caps);
     status = HidP_GetValueCaps( HidP_Output, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetValueCaps returned %#lx\n", status );
     status = HidP_GetValueCaps( HidP_Feature + 1, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetValueCaps returned %#lx\n", status );
     count = 0;
     status = HidP_GetValueCaps( HidP_Input, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetValueCaps returned %#lx\n", status );
     ok( count == caps.NumberInputValueCaps, "HidP_GetValueCaps returned count %d, expected %d\n",
         count, caps.NumberInputValueCaps );
     count = ARRAY_SIZE(value_caps);
     status = HidP_GetValueCaps( HidP_Input, value_caps, &count, (PHIDP_PREPARSED_DATA)buffer );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetValueCaps returned %#lx\n", status );
     status = HidP_GetValueCaps( HidP_Input, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetValueCaps returned %#lx\n", status );
     ok( count == caps.NumberInputValueCaps, "HidP_GetValueCaps returned count %d, expected %d\n",
         count, caps.NumberInputValueCaps );
 
@@ -1529,20 +1529,20 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     count = ARRAY_SIZE(value_caps) - 4;
     status = HidP_GetSpecificValueCaps( HidP_Output, 0, 0, 0, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     status = HidP_GetSpecificValueCaps( HidP_Feature + 1, 0, 0, 0, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     count = 0;
     status = HidP_GetSpecificValueCaps( HidP_Input, 0, 0, 0, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == caps.NumberInputValueCaps, "HidP_GetSpecificValueCaps returned count %d, expected %d\n",
         count, caps.NumberInputValueCaps );
     count = ARRAY_SIZE(value_caps) - 4;
     status = HidP_GetSpecificValueCaps( HidP_Input, 0, 0, 0, value_caps + 4, &count, (PHIDP_PREPARSED_DATA)buffer );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetSpecificValueCaps returned %#lx\n", status );
 
     status = HidP_GetSpecificValueCaps( HidP_Input, 0, 0, 0, value_caps + 4, &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == caps.NumberInputValueCaps, "HidP_GetSpecificValueCaps returned count %d, expected %d\n",
         count, caps.NumberInputValueCaps );
     check_hidp_value_caps( &value_caps[4], &value_caps[0] );
@@ -1553,38 +1553,38 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     count = 1;
     status = HidP_GetSpecificValueCaps( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_HATSWITCH,
                                         value_caps + 4, &count, preparsed_data );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == 1, "HidP_GetSpecificValueCaps returned count %d, expected %d\n", count, 1 );
     check_hidp_value_caps( &value_caps[4], &value_caps[3] );
 
     count = 0xdead;
     status = HidP_GetSpecificValueCaps( HidP_Input, 0xfffe, 0, 0, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificValueCaps returned count %d, expected %d\n", count, 0 );
     count = 0xdead;
     status = HidP_GetSpecificValueCaps( HidP_Input, 0, 0xfffe, 0, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificValueCaps returned count %d, expected %d\n", count, 0 );
     count = 0xdead;
     status = HidP_GetSpecificValueCaps( HidP_Input, 0, 0, 0xfffe, value_caps, &count, preparsed_data );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#lx\n", status );
     ok( count == 0, "HidP_GetSpecificValueCaps returned count %d, expected %d\n", count, 0 );
 
     status = HidP_InitializeReportForID( HidP_Input, 0, (PHIDP_PREPARSED_DATA)buffer, report, sizeof(report) );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_InitializeReportForID returned %#lx\n", status );
     status = HidP_InitializeReportForID( HidP_Feature + 1, 0, preparsed_data, report, sizeof(report) );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_InitializeReportForID returned %#lx\n", status );
     status = HidP_InitializeReportForID( HidP_Input, 0, preparsed_data, report, sizeof(report) );
-    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#lx\n", status );
     status = HidP_InitializeReportForID( HidP_Input, 0, preparsed_data, report, caps.InputReportByteLength + 1 );
-    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#lx\n", status );
     status = HidP_InitializeReportForID( HidP_Input, 1 - report_id, preparsed_data, report,
                                          caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#lx\n", status );
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Input, report_id, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
 
     memset( buffer, 0xcd, sizeof(buffer) );
     memset( buffer, 0, caps.InputReportByteLength );
@@ -1593,167 +1593,167 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     status = HidP_SetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, buffer,
                                       sizeof(buffer), preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_NOT_VALUE_ARRAY, "HidP_SetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_NOT_VALUE_ARRAY, "HidP_SetUsageValueArray returned %#lx\n", status );
     memset( buffer, 0xcd, sizeof(buffer) );
     status = HidP_SetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_HATSWITCH,
                                       buffer, 0, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsageValueArray returned %#lx\n", status );
     status = HidP_SetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_HATSWITCH,
                                       buffer, 8, preparsed_data, report, caps.InputReportByteLength );
     todo_wine
-    ok( status == HIDP_STATUS_NOT_IMPLEMENTED, "HidP_SetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_NOT_IMPLEMENTED, "HidP_SetUsageValueArray returned %#lx\n", status );
 
     status = HidP_GetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, buffer,
                                       sizeof(buffer), preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_NOT_VALUE_ARRAY, "HidP_GetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_NOT_VALUE_ARRAY, "HidP_GetUsageValueArray returned %#lx\n", status );
     memset( buffer, 0xcd, sizeof(buffer) );
     status = HidP_GetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_HATSWITCH,
                                       buffer, 0, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsageValueArray returned %#lx\n", status );
     status = HidP_GetUsageValueArray( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_HATSWITCH,
                                       buffer, 8, preparsed_data, report, caps.InputReportByteLength );
     todo_wine
-    ok( status == HIDP_STATUS_NOT_IMPLEMENTED, "HidP_GetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_NOT_IMPLEMENTED, "HidP_GetUsageValueArray returned %#lx\n", status );
 
     value = -128;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, &value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0x80, "got value %x, expected %#x\n", value, 0x80 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0x80, "got value %#lx, expected %#x\n", value, 0x80 );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == -128, "got value %x, expected %#x\n", value, -128 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == -128, "got value %#lx, expected %#x\n", value, -128 );
 
     value = 127;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 127, "got value %x, expected %#x\n", value, 127 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 127, "got value %#lx, expected %#x\n", value, 127 );
 
     value = 0;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_X,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0, "got value %x, expected %#x\n", value, 0 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0, "got value %#lx, expected %#x\n", value, 0 );
 
     value = 0x7fffffff;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_VALUE_OUT_OF_RANGE, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0, "got value %x, expected %#x\n", value, 0 );
+    ok( status == HIDP_STATUS_VALUE_OUT_OF_RANGE, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0, "got value %#lx, expected %#x\n", value, 0 );
     value = 0xdeadbeef;
     status = HidP_GetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, &value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0x7fffffff, "got value %x, expected %#x\n", value, 0x7fffffff );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0x7fffffff, "got value %#lx, expected %#x\n", value, 0x7fffffff );
 
     value = 0x3fffffff;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0x7fffffff, "got value %x, expected %#x\n", value, 0x7fffffff );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0x7fffffff, "got value %#lx, expected %#x\n", value, 0x7fffffff );
 
     value = 0;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0x80000000, "got value %x, expected %#x\n", value, 0x80000000 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0x80000000, "got value %#lx, expected %#x\n", value, 0x80000000 );
 
     value = 0;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RX,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0, "got value %x, expected %#x\n", value, 0 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0, "got value %#lx, expected %#x\n", value, 0 );
 
     value = 0xfeedcafe;
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY, value,
                                  preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY,
                                        (LONG *)&value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BAD_LOG_PHY_VALUES, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0, "got value %x, expected %#x\n", value, 0 );
+    ok( status == HIDP_STATUS_BAD_LOG_PHY_VALUES, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0, "got value %#lx, expected %#x\n", value, 0 );
     status = HidP_SetScaledUsageValue( HidP_Input, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_RY,
                                        0, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BAD_LOG_PHY_VALUES, "HidP_GetScaledUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_BAD_LOG_PHY_VALUES, "HidP_GetScaledUsageValue returned %#lx\n", status );
 
     value = HidP_MaxUsageListLength( HidP_Feature + 1, 0, preparsed_data );
-    ok( value == 0, "HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %d, expected %d\n", value, 0 );
+    ok( value == 0, "HidP_MaxUsageListLength(HidP_Feature + 1, 0) returned %ld, expected %d\n", value, 0 );
     value = HidP_MaxUsageListLength( HidP_Input, 0, preparsed_data );
-    ok( value == 50, "HidP_MaxUsageListLength(HidP_Input, 0) returned %d, expected %d\n", value, 50 );
+    ok( value == 50, "HidP_MaxUsageListLength(HidP_Input, 0) returned %ld, expected %d\n", value, 50 );
     value = HidP_MaxUsageListLength( HidP_Input, HID_USAGE_PAGE_BUTTON, preparsed_data );
-    ok( value == 32, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned %d, expected %d\n",
+    ok( value == 32, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_BUTTON) returned %ld, expected %d\n",
         value, 32 );
     value = HidP_MaxUsageListLength( HidP_Input, HID_USAGE_PAGE_LED, preparsed_data );
-    ok( value == 8, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED) returned %d, expected %d\n",
+    ok( value == 8, "HidP_MaxUsageListLength(HidP_Input, HID_USAGE_PAGE_LED) returned %ld, expected %d\n",
         value, 8 );
     value = HidP_MaxUsageListLength( HidP_Feature, HID_USAGE_PAGE_BUTTON, preparsed_data );
-    ok( value == 8, "HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_BUTTON) returned %d, expected %d\n",
+    ok( value == 8, "HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_BUTTON) returned %ld, expected %d\n",
         value, 8 );
     value = HidP_MaxUsageListLength( HidP_Feature, HID_USAGE_PAGE_LED, preparsed_data );
-    ok( value == 0, "HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_LED) returned %d, expected %d\n",
+    ok( value == 0, "HidP_MaxUsageListLength(HidP_Feature, HID_USAGE_PAGE_LED) returned %ld, expected %d\n",
         value, 0 );
 
     usages[0] = 0xff;
     value = 1;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsages returned %#lx\n", status );
     usages[1] = 2;
     usages[2] = 0xff;
     value = 3;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsages returned %#lx\n", status );
     usages[0] = 4;
     usages[1] = 6;
     value = 2;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#lx\n", status );
     usages[0] = 4;
     usages[1] = 6;
     value = 2;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_LED, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#lx\n", status );
 
     value = ARRAY_SIZE(usages);
     status = HidP_GetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#x\n", status );
-    ok( value == 0, "got usage count %d, expected %d\n", value, 2 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#lx\n", status );
+    ok( value == 0, "got usage count %ld, expected %d\n", value, 2 );
 
     usages[0] = 0x9;
     usages[1] = 0xb;
@@ -1764,32 +1764,32 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     memcpy( buffer, report, caps.InputReportByteLength );
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsages returned %#lx\n", status );
     buffer[13] = 2;
     buffer[14] = 4;
     ok( !memcmp( buffer, report, caps.InputReportByteLength ), "unexpected report data\n" );
 
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_LED, 0, 6, 1, preparsed_data, report,
                                  caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#lx\n", status );
 
     value = 0xdeadbeef;
     status = HidP_GetUsageValue( HidP_Input, HID_USAGE_PAGE_LED, 0, 6, &value, preparsed_data,
                                  report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#x\n", status );
-    ok( value == 0xdeadbeef, "got value %x, expected %#x\n", value, 0xdeadbeef );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#lx\n", status );
+    ok( value == 0xdeadbeef, "got value %#lx, expected %#x\n", value, 0xdeadbeef );
 
     value = 1;
     status = HidP_GetUsages( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsages returned %#x\n", status );
-    ok( value == 2, "got usage count %d, expected %d\n", value, 2 );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsages returned %#lx\n", status );
+    ok( value == 2, "got usage count %ld, expected %d\n", value, 2 );
     value = ARRAY_SIZE(usages);
     memset( usages, 0xcd, sizeof(usages) );
     status = HidP_GetUsages( HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#x\n", status );
-    ok( value == 2, "got usage count %d, expected %d\n", value, 2 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#lx\n", status );
+    ok( value == 2, "got usage count %ld, expected %d\n", value, 2 );
     ok( usages[0] == 4, "got usages[0] %x, expected %x\n", usages[0], 4 );
     ok( usages[1] == 6, "got usages[1] %x, expected %x\n", usages[1], 6 );
 
@@ -1797,8 +1797,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     memset( usages, 0xcd, sizeof(usages) );
     status = HidP_GetUsages( HidP_Input, HID_USAGE_PAGE_LED, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#x\n", status );
-    ok( value == 2, "got usage count %d, expected %d\n", value, 2 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#lx\n", status );
+    ok( value == 2, "got usage count %ld, expected %d\n", value, 2 );
     ok( usages[0] == 6, "got usages[0] %x, expected %x\n", usages[0], 6 );
     ok( usages[1] == 4, "got usages[1] %x, expected %x\n", usages[1], 4 );
 
@@ -1806,8 +1806,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     memset( usage_and_pages, 0xcd, sizeof(usage_and_pages) );
     status = HidP_GetUsagesEx( HidP_Input, 0, usage_and_pages, &value, preparsed_data, report,
                                caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsagesEx returned %#x\n", status );
-    ok( value == 6, "got usage count %d, expected %d\n", value, 4 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsagesEx returned %#lx\n", status );
+    ok( value == 6, "got usage count %ld, expected %d\n", value, 4 );
     ok( usage_and_pages[0].UsagePage == HID_USAGE_PAGE_BUTTON, "got usage_and_pages[0] UsagePage %x, expected %x\n",
         usage_and_pages[0].UsagePage, HID_USAGE_PAGE_BUTTON );
     ok( usage_and_pages[1].UsagePage == HID_USAGE_PAGE_BUTTON, "got usage_and_pages[1] UsagePage %x, expected %x\n",
@@ -1834,26 +1834,26 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         usage_and_pages[5].Usage, 4 );
 
     value = HidP_MaxDataListLength( HidP_Feature + 1, preparsed_data );
-    ok( value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %d, expected %d\n", value, 0 );
+    ok( value == 0, "HidP_MaxDataListLength(HidP_Feature + 1) returned %ld, expected %d\n", value, 0 );
     value = HidP_MaxDataListLength( HidP_Input, preparsed_data );
-    ok( value == 58, "HidP_MaxDataListLength(HidP_Input) returned %d, expected %d\n", value, 58 );
+    ok( value == 58, "HidP_MaxDataListLength(HidP_Input) returned %ld, expected %d\n", value, 58 );
     value = HidP_MaxDataListLength( HidP_Output, preparsed_data );
-    ok( value == 0, "HidP_MaxDataListLength(HidP_Output) returned %d, expected %d\n", value, 0 );
+    ok( value == 0, "HidP_MaxDataListLength(HidP_Output) returned %ld, expected %d\n", value, 0 );
     value = HidP_MaxDataListLength( HidP_Feature, preparsed_data );
-    ok( value == 14, "HidP_MaxDataListLength(HidP_Feature) returned %d, expected %d\n", value, 14 );
+    ok( value == 14, "HidP_MaxDataListLength(HidP_Feature) returned %ld, expected %d\n", value, 14 );
 
     value = 1;
     status = HidP_GetData( HidP_Input, data, &value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetData returned %#x\n", status );
-    ok( value == 11, "got data count %d, expected %d\n", value, 11 );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetData returned %#lx\n", status );
+    ok( value == 11, "got data count %ld, expected %d\n", value, 11 );
     memset( data, 0, sizeof(data) );
     status = HidP_GetData( HidP_Input, data, &value, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetData returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetData returned %#lx\n", status );
     for (i = 0; i < ARRAY_SIZE(expect_data); ++i)
     {
         winetest_push_context( "data[%d]", i );
         check_member( data[i], expect_data[i], "%d", DataIndex );
-        check_member( data[i], expect_data[i], "%d", RawValue );
+        check_member( data[i], expect_data[i], "%ld", RawValue );
         winetest_pop_context();
     }
 
@@ -1861,43 +1861,43 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     memset( report, 0, caps.InputReportByteLength );
     status = HidP_InitializeReportForID( HidP_Input, report_id, preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
     value = 2;
     usages[0] = 0x8e;
     usages[1] = 0x8f;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#lx\n", status );
     ok( report[caps.InputReportByteLength - 2] == 3, "unexpected usage index %d, expected 3\n",
         report[caps.InputReportByteLength - 2] );
     ok( report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n",
         report[caps.InputReportByteLength - 1] );
     status = HidP_UnsetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value,
                                preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_UnsetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_UnsetUsages returned %#lx\n", status );
     ok( report[caps.InputReportByteLength - 2] == 0, "unexpected usage index %d, expected 0\n",
         report[caps.InputReportByteLength - 2] );
     ok( report[caps.InputReportByteLength - 1] == 0, "unexpected usage index %d, expected 0\n",
         report[caps.InputReportByteLength - 1] );
     status = HidP_UnsetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value,
                                preparsed_data, report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_BUTTON_NOT_PRESSED, "HidP_UnsetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUTTON_NOT_PRESSED, "HidP_UnsetUsages returned %#lx\n", status );
     value = 1;
     usages[0] = 0x8c;
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#lx\n", status );
     ok( report[caps.InputReportByteLength - 2] == 1, "unexpected usage index %d, expected 1\n",
         report[caps.InputReportByteLength - 2] );
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Feature, 3, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_REPORT_DOES_NOT_EXIST, "HidP_InitializeReportForID returned %#lx\n", status );
 
     memset( report, 0xcd, sizeof(report) );
     status = HidP_InitializeReportForID( HidP_Feature, report_id, preparsed_data, report,
                                          caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#lx\n", status );
 
     memset( buffer, 0xcd, sizeof(buffer) );
     memset( buffer, 0, caps.FeatureReportByteLength );
@@ -1916,35 +1916,35 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, (PHIDP_PREPARSED_DATA)buffer,
                                  report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_SetUsageValue returned %#lx\n", status );
     status = HidP_SetUsageValue( HidP_Feature + 1, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
                                  caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_SetUsageValue returned %#lx\n", status );
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
                                  caps.FeatureReportByteLength + 1 );
-    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_SetUsageValue returned %#lx\n", status );
     report[0] = 1 - report_id;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
                                  caps.FeatureReportByteLength );
     ok( status == (report_id ? HIDP_STATUS_SUCCESS : HIDP_STATUS_INCOMPATIBLE_REPORT_ID),
-        "HidP_SetUsageValue returned %#x\n", status );
+        "HidP_SetUsageValue returned %#lx\n", status );
     report[0] = 2;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
                                  caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_SetUsageValue returned %#lx\n", status );
     report[0] = report_id;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, 0xdead, 3, HID_USAGE_HAPTICS_WAVEFORM_RUMBLE,
                                  preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_SetUsageValue returned %#lx\n", status );
 
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
                                  HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
                                  caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
 
     memset( buffer, 0xcd, sizeof(buffer) );
     memset( buffer, 0, caps.FeatureReportByteLength );
@@ -1955,123 +1955,123 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  (PHIDP_PREPARSED_DATA)buffer, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_GetUsageValue returned %#lx\n", status );
     status = HidP_GetUsageValue( HidP_Feature + 1, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_GetUsageValue returned %#lx\n", status );
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength + 1 );
-    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_GetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_GetUsageValue returned %#lx\n", status );
     report[0] = 1 - report_id;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength );
     ok( status == (report_id ? HIDP_STATUS_SUCCESS : HIDP_STATUS_INCOMPATIBLE_REPORT_ID),
-        "HidP_GetUsageValue returned %#x\n", status );
+        "HidP_GetUsageValue returned %#lx\n", status );
     report[0] = 2;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_GetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_GetUsageValue returned %#lx\n", status );
     report[0] = report_id;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, 0xdead, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetUsageValue returned %#lx\n", status );
 
     value = 0xdeadbeef;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
                                  preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, "got value %x, expected %#x\n", value,
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, "got value %#lx, expected %#x\n", value,
         HID_USAGE_HAPTICS_WAVEFORM_RUMBLE );
 
     memset( buffer, 0xff, sizeof(buffer) );
     status = HidP_SetUsageValueArray( HidP_Feature, HID_USAGE_PAGE_HAPTICS, 0,
                                       HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME, buffer, 0,
                                       preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsageValueArray returned %#lx\n", status );
     status = HidP_SetUsageValueArray( HidP_Feature, HID_USAGE_PAGE_HAPTICS, 0,
                                       HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME, buffer, 64,
                                       preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValueArray returned %#lx\n", status );
     ok( !memcmp( report + 9, buffer, 8 ), "unexpected report data\n" );
 
     memset( buffer, 0, sizeof(buffer) );
     status = HidP_GetUsageValueArray( HidP_Feature, HID_USAGE_PAGE_HAPTICS, 0,
                                       HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME, buffer, 0,
                                       preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_GetUsageValueArray returned %#lx\n", status );
     status = HidP_GetUsageValueArray( HidP_Feature, HID_USAGE_PAGE_HAPTICS, 0,
                                       HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME, buffer, 64,
                                       preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValueArray returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValueArray returned %#lx\n", status );
     memset( buffer + 16, 0xff, 8 );
     ok( !memcmp( buffer, buffer + 16, 16 ), "unexpected report value\n" );
 
     value = 0x7fffffff;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_VALUE_OUT_OF_RANGE, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0, "got value %x, expected %#x\n", value, 0 );
+    ok( status == HIDP_STATUS_VALUE_OUT_OF_RANGE, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0, "got value %#lx, expected %#x\n", value, 0 );
     value = 0xdeadbeef;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  &value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0x7fffffff, "got value %x, expected %#x\n", value, 0x7fffffff );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0x7fffffff, "got value %#lx, expected %#x\n", value, 0x7fffffff );
 
     value = 0x7fff;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0x0003ffff, "got value %x, expected %#x\n", value, 0x0003ffff );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0x0003ffff, "got value %#lx, expected %#x\n", value, 0x0003ffff );
 
     value = 0;
     status = HidP_SetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetUsageValue returned %#lx\n", status );
     value = 0xdeadbeef;
     status = HidP_GetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        (LONG *)&value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#x\n", status );
-    ok( value == 0xfff90000, "got value %x, expected %#x\n", value, 0xfff90000 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetScaledUsageValue returned %#lx\n", status );
+    ok( value == 0xfff90000, "got value %#lx, expected %#x\n", value, 0xfff90000 );
     status = HidP_SetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        0x1000, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#lx\n", status );
     value = 0;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  &value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0xfffff518, "got value %x, expected %#x\n", value, 0xfffff518 );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0xfffff518, "got value %#lx, expected %#x\n", value, 0xfffff518 );
     status = HidP_SetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        0, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#lx\n", status );
     value = 0;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  &value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0xfffff45e, "got value %x, expected %#x\n", value, 0xfffff45e );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0xfffff45e, "got value %#lx, expected %#x\n", value, 0xfffff45e );
     status = HidP_SetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        0xdead, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#lx\n", status );
     value = 0;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  &value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0xfffffe7d, "got value %x, expected %#x\n", value, 0xfffffe7d );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0xfffffe7d, "got value %#lx, expected %#x\n", value, 0xfffffe7d );
     status = HidP_SetScaledUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                        0xbeef, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#x\n", status );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_SetScaledUsageValue returned %#lx\n", status );
     value = 0;
     status = HidP_GetUsageValue( HidP_Feature, HID_USAGE_PAGE_GENERIC, 0, HID_USAGE_GENERIC_Z,
                                  &value, preparsed_data, report, caps.FeatureReportByteLength );
-    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#x\n", status );
-    ok( value == 0xfffffd0b, "got value %x, expected %#x\n", value, 0xfffffd0b );
+    ok( status == HIDP_STATUS_SUCCESS, "HidP_GetUsageValue returned %#lx\n", status );
+    ok( value == 0xfffffd0b, "got value %#lx, expected %#x\n", value, 0xfffffd0b );
 
     test_hidp_get_input( file, report_id, caps.InputReportByteLength, preparsed_data );
     test_hidp_get_feature( file, report_id, caps.FeatureReportByteLength, preparsed_data );
@@ -2082,14 +2082,14 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     memset( report, 0xcd, sizeof(report) );
     SetLastError( 0xdeadbeef );
     ret = ReadFile( file, report, 0, &value, NULL );
-    ok( !ret && GetLastError() == ERROR_INVALID_USER_BUFFER, "ReadFile failed, last error %u\n",
+    ok( !ret && GetLastError() == ERROR_INVALID_USER_BUFFER, "ReadFile failed, last error %lu\n",
         GetLastError() );
-    ok( value == 0, "ReadFile returned %x\n", value );
+    ok( value == 0, "ReadFile returned %lx\n", value );
     SetLastError( 0xdeadbeef );
     ret = ReadFile( file, report, caps.InputReportByteLength - 1, &value, NULL );
-    ok( !ret && GetLastError() == ERROR_INVALID_USER_BUFFER, "ReadFile failed, last error %u\n",
+    ok( !ret && GetLastError() == ERROR_INVALID_USER_BUFFER, "ReadFile failed, last error %lu\n",
         GetLastError() );
-    ok( value == 0, "ReadFile returned %x\n", value );
+    ok( value == 0, "ReadFile returned %lx\n", value );
 
     if (polled)
     {
@@ -2126,8 +2126,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         memset( report, 0xcd, sizeof(report) );
         SetLastError( 0xdeadbeef );
         ret = ReadFile( file, report, caps.InputReportByteLength, &value, NULL );
-        ok( ret, "ReadFile failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "ReadFile returned %x\n", value );
+        ok( ret, "ReadFile failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "ReadFile returned %lx\n", value );
         ok( report[0] == report_id, "unexpected report data\n" );
 
         overlapped.hEvent = CreateEventW( NULL, FALSE, FALSE, NULL );
@@ -2137,10 +2137,10 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         SetLastError( 0xdeadbeef );
         while (ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped ))
             ResetEvent( overlapped.hEvent );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
         ret = GetOverlappedResult( async_file, &overlapped, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n",
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n",
             value, (report_id ? 3 : 4) );
         ResetEvent( overlapped.hEvent );
 
@@ -2150,22 +2150,22 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         SetLastError( 0xdeadbeef );
         ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         ret = ReadFile( async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2 );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         /* wait for second report to be ready */
         ret = GetOverlappedResult( async_file, &overlapped2, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n",
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n",
             value, (report_id ? 3 : 4) );
         /* first report should be ready and the same */
         ret = GetOverlappedResult( async_file, &overlapped, &value, FALSE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n",
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n",
             value, (report_id ? 3 : 4) );
         ok( memcmp( report, buffer + caps.InputReportByteLength, caps.InputReportByteLength ),
             "expected different report\n" );
@@ -2174,29 +2174,29 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         value = 10;
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &value, sizeof(ULONG), NULL, NULL, INFINITE );
-        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
+        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
 
         Sleep( 600 );
 
         SetLastError( 0xdeadbeef );
         ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         ret = ReadFile( async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2 );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         /* wait for second report to be ready */
         ret = GetOverlappedResult( async_file, &overlapped2, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n",
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n",
             value, (report_id ? 3 : 4) );
         /* first report should be ready and the same */
         ret = GetOverlappedResult( async_file, &overlapped, &value, FALSE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %u, expected %u\n",
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == (report_id ? 3 : 4), "GetOverlappedResult returned length %lu, expected %u\n",
             value, (report_id ? 3 : 4) );
         ok( !memcmp( report, buffer, caps.InputReportByteLength ), "expected identical reports\n" );
 
@@ -2208,12 +2208,12 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         memset( report, 0, sizeof(report) );
         ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         ret = GetOverlappedResult( async_file, &overlapped, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
         ok( value == report_id ? 2 : caps.InputReportByteLength - 1,
-            "got length %u, expected %u\n", value, report_id ? 2 : caps.InputReportByteLength - 1 );
+            "got length %lu, expected %u\n", value, report_id ? 2 : caps.InputReportByteLength - 1 );
 
         CloseHandle( overlapped.hEvent );
         CloseHandle( overlapped2.hEvent );
@@ -2255,21 +2255,21 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         memset( report, 0, sizeof(report) );
         ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
         Sleep( 50 );
         ret = GetOverlappedResult( async_file, &overlapped, &value, FALSE );
         ok( !ret, "GetOverlappedResult succeeded\n" );
-        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %lu\n", GetLastError() );
 
         SetLastError( 0xdeadbeef );
         memset( buffer, 0, sizeof(buffer) );
         ret = ReadFile( async_file, buffer, caps.InputReportByteLength, NULL, &overlapped2 );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
         Sleep( 50 );
         ret = GetOverlappedResult( async_file, &overlapped2, &value, FALSE );
         ok( !ret, "GetOverlappedResult succeeded\n" );
-        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %lu\n", GetLastError() );
 
         memset( report + caps.InputReportByteLength, 0xa5, 5 );
         if (report_id) report[caps.InputReportByteLength] = report_id;
@@ -2278,13 +2278,13 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
 
         /* first read should be completed */
         ret = GetOverlappedResult( async_file, &overlapped, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == caps.InputReportByteLength, "got length %u, expected %u\n", value, caps.InputReportByteLength );
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == caps.InputReportByteLength, "got length %lu, expected %u\n", value, caps.InputReportByteLength );
         /* second read should still be pending */
         Sleep( 50 );
         ret = GetOverlappedResult( async_file, &overlapped2, &value, FALSE );
         ok( !ret, "GetOverlappedResult succeeded\n" );
-        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_INCOMPLETE, "GetOverlappedResult returned error %lu\n", GetLastError() );
 
         memset( buffer + caps.InputReportByteLength, 0x3b, 5 );
         if (report_id) buffer[caps.InputReportByteLength] = report_id;
@@ -2294,8 +2294,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         send_hid_input( file, expect, sizeof(expect) );
 
         ret = GetOverlappedResult( async_file, &overlapped2, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == caps.InputReportByteLength, "got length %u, expected %u\n", value, caps.InputReportByteLength );
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == caps.InputReportByteLength, "got length %lu, expected %u\n", value, caps.InputReportByteLength );
 
         off = report_id ? 0 : 1;
         ok( memcmp( report, buffer, caps.InputReportByteLength ), "expected different report\n" );
@@ -2308,13 +2308,13 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
         memset( report, 0, sizeof(report) );
         ret = ReadFile( async_file, report, caps.InputReportByteLength, NULL, &overlapped );
         ok( !ret, "ReadFile succeeded\n" );
-        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %u\n", GetLastError() );
+        ok( GetLastError() == ERROR_IO_PENDING, "ReadFile returned error %lu\n", GetLastError() );
 
         send_hid_input( file, expect_small, sizeof(expect_small) );
 
         ret = GetOverlappedResult( async_file, &overlapped, &value, TRUE );
-        ok( ret, "GetOverlappedResult failed, last error %u\n", GetLastError() );
-        ok( value == caps.InputReportByteLength, "got length %u, expected %u\n", value, caps.InputReportByteLength );
+        ok( ret, "GetOverlappedResult failed, last error %lu\n", GetLastError() );
+        ok( value == caps.InputReportByteLength, "got length %lu, expected %u\n", value, caps.InputReportByteLength );
 
         CloseHandle( overlapped.hEvent );
         CloseHandle( overlapped2.hEvent );
@@ -2339,22 +2339,22 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp
     unsigned int i;
     HDEVINFO set;
 
-    winetest_push_context( "id %d%s", report_id, polled ? " poll" : "" );
+    winetest_push_context( "id %ld%s", report_id, polled ? " poll" : "" );
 
     set = SetupDiGetClassDevsW( &GUID_DEVINTERFACE_HID, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT );
-    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() );
 
     for (i = 0; SetupDiEnumDeviceInfo( set, i, &device ); ++i)
     {
         ret = SetupDiEnumDeviceInterfaces( set, &device, &GUID_DEVINTERFACE_HID, 0, &iface );
-        ok( ret, "failed to get interface, error %#x\n", GetLastError() );
+        ok( ret, "failed to get interface, error %#lx\n", GetLastError() );
         ok( IsEqualGUID( &iface.InterfaceClassGuid, &GUID_DEVINTERFACE_HID ), "wrong class %s\n",
             debugstr_guid( &iface.InterfaceClassGuid ) );
-        ok( iface.Flags == SPINT_ACTIVE, "got flags %#x\n", iface.Flags );
+        ok( iface.Flags == SPINT_ACTIVE, "got flags %#lx\n", iface.Flags );
 
         iface_detail->cbSize = sizeof(*iface_detail);
         ret = SetupDiGetDeviceInterfaceDetailW( set, &iface, iface_detail, sizeof(buffer), NULL, NULL );
-        ok( ret, "failed to get interface path, error %#x\n", GetLastError() );
+        ok( ret, "failed to get interface path, error %#lx\n", GetLastError() );
 
         if (wcsstr( iface_detail->DevicePath, L"\\\\?\\hid#winetest#1" ))
         {
@@ -2370,112 +2370,112 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp
 
     file = CreateFileW( iface_detail->DevicePath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     count = 0xdeadbeef;
     SetLastError( 0xdeadbeef );
     ret = HidD_GetNumInputBuffers( file, &count );
-    ok( ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError() );
-    ok( count == 32, "HidD_GetNumInputBuffers returned %u\n", count );
+    ok( ret, "HidD_GetNumInputBuffers failed last error %lu\n", GetLastError() );
+    ok( count == 32, "HidD_GetNumInputBuffers returned %lu\n", count );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetNumInputBuffers( file, 1 );
     ok( !ret, "HidD_SetNumInputBuffers succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %u\n",
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %lu\n",
         GetLastError() );
     SetLastError( 0xdeadbeef );
     ret = HidD_SetNumInputBuffers( file, 513 );
     ok( !ret, "HidD_SetNumInputBuffers succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %u\n",
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "HidD_SetNumInputBuffers returned error %lu\n",
         GetLastError() );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetNumInputBuffers( file, 16 );
-    ok( ret, "HidD_SetNumInputBuffers failed last error %u\n", GetLastError() );
+    ok( ret, "HidD_SetNumInputBuffers failed last error %lu\n", GetLastError() );
 
     count = 0xdeadbeef;
     SetLastError( 0xdeadbeef );
     ret = HidD_GetNumInputBuffers( file, &count );
-    ok( ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError() );
-    ok( count == 16, "HidD_GetNumInputBuffers returned %u\n", count );
+    ok( ret, "HidD_GetNumInputBuffers failed last error %lu\n", GetLastError() );
+    ok( count == 16, "HidD_GetNumInputBuffers returned %lu\n", count );
 
     async_file = CreateFileW( iface_detail->DevicePath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                               FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                               FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
-    ok( async_file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( async_file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     count = 0xdeadbeef;
     SetLastError( 0xdeadbeef );
     ret = HidD_GetNumInputBuffers( async_file, &count );
-    ok( ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError() );
-    ok( count == 32, "HidD_GetNumInputBuffers returned %u\n", count );
+    ok( ret, "HidD_GetNumInputBuffers failed last error %lu\n", GetLastError() );
+    ok( count == 32, "HidD_GetNumInputBuffers returned %lu\n", count );
 
     SetLastError( 0xdeadbeef );
     ret = HidD_SetNumInputBuffers( async_file, 2 );
-    ok( ret, "HidD_SetNumInputBuffers failed last error %u\n", GetLastError() );
+    ok( ret, "HidD_SetNumInputBuffers failed last error %lu\n", GetLastError() );
 
     count = 0xdeadbeef;
     SetLastError( 0xdeadbeef );
     ret = HidD_GetNumInputBuffers( async_file, &count );
-    ok( ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError() );
-    ok( count == 2, "HidD_GetNumInputBuffers returned %u\n", count );
+    ok( ret, "HidD_GetNumInputBuffers failed last error %lu\n", GetLastError() );
+    ok( count == 2, "HidD_GetNumInputBuffers returned %lu\n", count );
     count = 0xdeadbeef;
     SetLastError( 0xdeadbeef );
     ret = HidD_GetNumInputBuffers( file, &count );
-    ok( ret, "HidD_GetNumInputBuffers failed last error %u\n", GetLastError() );
-    ok( count == 16, "HidD_GetNumInputBuffers returned %u\n", count );
+    ok( ret, "HidD_GetNumInputBuffers failed last error %lu\n", GetLastError() );
+    ok( count == 16, "HidD_GetNumInputBuffers returned %lu\n", count );
 
     if (polled)
     {
         out_len = sizeof(ULONG);
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len );
+        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == sizeof(ULONG), "got out_len %lu, expected sizeof(ULONG)\n", out_len );
         todo_wine
-        ok( poll_freq == 5, "got poll_freq %u, expected 5\n", poll_freq );
+        ok( poll_freq == 5, "got poll_freq %lu, expected 5\n", poll_freq );
 
         out_len = 0;
         poll_freq = 500;
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
+        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == 0, "got out_len %lu, expected 0\n", out_len );
 
         out_len = 0;
         poll_freq = 10001;
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
+        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == 0, "got out_len %lu, expected 0\n", out_len );
 
         out_len = 0;
         poll_freq = 0;
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
+        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == 0, "got out_len %lu, expected 0\n", out_len );
 
         out_len = sizeof(ULONG);
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len );
-        ok( poll_freq == 10000, "got poll_freq %u, expected 10000\n", poll_freq );
+        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == sizeof(ULONG), "got out_len %lu, expected sizeof(ULONG)\n", out_len );
+        ok( poll_freq == 10000, "got poll_freq %lu, expected 10000\n", poll_freq );
 
         out_len = 0;
         poll_freq = 500;
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( file, IOCTL_HID_SET_POLL_FREQUENCY_MSEC, &poll_freq, sizeof(ULONG), NULL, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == 0, "got out_len %u, expected 0\n", out_len );
+        ok( ret, "IOCTL_HID_SET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == 0, "got out_len %lu, expected 0\n", out_len );
 
         out_len = sizeof(ULONG);
         SetLastError( 0xdeadbeef );
         ret = sync_ioctl( async_file, IOCTL_HID_GET_POLL_FREQUENCY_MSEC, NULL, 0, &poll_freq, &out_len, INFINITE );
-        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %u\n", GetLastError() );
-        ok( out_len == sizeof(ULONG), "got out_len %u, expected sizeof(ULONG)\n", out_len );
-        ok( poll_freq == 500, "got poll_freq %u, expected 500\n", poll_freq );
+        ok( ret, "IOCTL_HID_GET_POLL_FREQUENCY_MSEC failed last error %lu\n", GetLastError() );
+        ok( out_len == sizeof(ULONG), "got out_len %lu, expected sizeof(ULONG)\n", out_len );
+        ok( poll_freq == 500, "got poll_freq %lu, expected 500\n", poll_freq );
     }
 
     test_hidp( file, async_file, report_id, polled, expect_caps );
@@ -2487,7 +2487,7 @@ static void test_hid_device( DWORD report_id, DWORD polled, const HIDP_CAPS *exp
     InitializeObjectAttributes( &attr, &string, OBJ_CASE_INSENSITIVE, NULL, NULL );
     status = NtOpenFile( &file, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT );
     todo_wine
-    ok( status == STATUS_UNSUCCESSFUL, "got %#x\n", status );
+    ok( status == STATUS_UNSUCCESSFUL, "got %#lx\n", status );
 
     winetest_pop_context();
 }
@@ -2782,32 +2782,32 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
 
     status = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services\\winetest",
                               0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL );
-    ok( !status, "RegCreateKeyExW returned %#x\n", status );
+    ok( !status, "RegCreateKeyExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"ReportID", 0, REG_DWORD, (void *)&report_id, sizeof(report_id) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)report_desc, sizeof(report_desc) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Caps", 0, REG_BINARY, (void *)&caps, sizeof(caps) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Expect", 0, REG_BINARY, NULL, 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Input", 0, REG_BINARY, (void *)&expect_in, polled ? sizeof(expect_in) : 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     fill_context( __LINE__, context, ARRAY_SIZE(context) );
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     if (pnp_driver_start( L"driver_hid.dll" )) test_hid_device( report_id, polled, &caps );
 
@@ -3142,48 +3142,48 @@ static void test_hidp_kdr(void)
 
     status = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services\\winetest",
                               0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL );
-    ok( !status, "RegCreateKeyExW returned %#x\n", status );
+    ok( !status, "RegCreateKeyExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"ReportID", 0, REG_DWORD, (void *)&report_id, sizeof(report_id) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)report_desc, sizeof(report_desc) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Caps", 0, REG_BINARY, (void *)&expect_hidp_caps, sizeof(expect_hidp_caps) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Expect", 0, REG_BINARY, NULL, 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     status = RegSetValueExW( hkey, L"Input", 0, REG_BINARY, NULL, 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     fill_context( __LINE__, context, ARRAY_SIZE(context) );
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     if (!pnp_driver_start( L"driver_hid.dll" )) goto done;
 
     set = SetupDiGetClassDevsW( &GUID_DEVINTERFACE_HID, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT );
-    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() );
     for (i = 0; SetupDiEnumDeviceInfo( set, i, &device ); ++i)
     {
         ret = SetupDiEnumDeviceInterfaces( set, &device, &GUID_DEVINTERFACE_HID, 0, &iface );
-        ok( ret, "failed to get interface, error %#x\n", GetLastError() );
+        ok( ret, "failed to get interface, error %#lx\n", GetLastError() );
         ok( IsEqualGUID( &iface.InterfaceClassGuid, &GUID_DEVINTERFACE_HID ), "wrong class %s\n",
             debugstr_guid( &iface.InterfaceClassGuid ) );
-        ok( iface.Flags == SPINT_ACTIVE, "got flags %#x\n", iface.Flags );
+        ok( iface.Flags == SPINT_ACTIVE, "got flags %#lx\n", iface.Flags );
 
         iface_detail->cbSize = sizeof(*iface_detail);
         ret = SetupDiGetDeviceInterfaceDetailW( set, &iface, iface_detail, sizeof(buffer), NULL, NULL );
-        ok( ret, "failed to get interface path, error %#x\n", GetLastError() );
+        ok( ret, "failed to get interface path, error %#lx\n", GetLastError() );
 
         if (wcsstr( iface_detail->DevicePath, L"\\\\?\\hid#winetest#1" )) break;
     }
@@ -3191,10 +3191,10 @@ static void test_hidp_kdr(void)
 
     file = CreateFileW( iface_detail->DevicePath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     ret = HidD_GetPreparsedData( file, &preparsed_data );
-    ok( ret, "HidD_GetPreparsedData failed with error %u\n", GetLastError() );
+    ok( ret, "HidD_GetPreparsedData failed with error %lu\n", GetLastError() );
 
     kdr = (struct hidp_kdr *)preparsed_data;
     ok( !strncmp( kdr->magic, expect_kdr.magic, 8 ), "got %s expected %s\n",
@@ -3225,7 +3225,7 @@ static void test_hidp_kdr(void)
 
         for (i = 0; i < min( ARRAY_SIZE(expect_caps), kdr->caps_size / sizeof(struct hidp_kdr_caps) ); ++i)
         {
-            winetest_push_context( "caps[%d]", i );
+            winetest_push_context( "caps[%ld]", i );
             check_member( kdr->caps[i], expect_caps[i], "%04x", usage_page );
             check_member( kdr->caps[i], expect_caps[i], "%d", report_id );
             check_member( kdr->caps[i], expect_caps[i], "%d", start_bit );
@@ -3233,20 +3233,20 @@ static void test_hidp_kdr(void)
             check_member( kdr->caps[i], expect_caps[i], "%d", report_count );
             check_member( kdr->caps[i], expect_caps[i], "%d", start_byte );
             check_member( kdr->caps[i], expect_caps[i], "%d", total_bits );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", bit_field );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", bit_field );
             check_member( kdr->caps[i], expect_caps[i], "%d", end_byte );
             check_member( kdr->caps[i], expect_caps[i], "%d", link_collection );
             check_member( kdr->caps[i], expect_caps[i], "%04x", link_usage_page );
             check_member( kdr->caps[i], expect_caps[i], "%04x", link_usage );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", flags );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[0] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[1] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[2] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[3] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[4] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[5] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[6] );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", padding[7] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", flags );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[0] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[1] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[2] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[3] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[4] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[5] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[6] );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", padding[7] );
             check_member( kdr->caps[i], expect_caps[i], "%04x", usage_min );
             check_member( kdr->caps[i], expect_caps[i], "%04x", usage_max );
             check_member( kdr->caps[i], expect_caps[i], "%d", string_min );
@@ -3257,26 +3257,26 @@ static void test_hidp_kdr(void)
             check_member( kdr->caps[i], expect_caps[i], "%#x", data_index_max );
             check_member( kdr->caps[i], expect_caps[i], "%d", null_value );
             check_member( kdr->caps[i], expect_caps[i], "%d", unknown );
-            check_member( kdr->caps[i], expect_caps[i], "%d", logical_min );
-            check_member( kdr->caps[i], expect_caps[i], "%d", logical_max );
-            check_member( kdr->caps[i], expect_caps[i], "%d", physical_min );
-            check_member( kdr->caps[i], expect_caps[i], "%d", physical_max );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", units );
-            check_member( kdr->caps[i], expect_caps[i], "%#x", units_exp );
+            check_member( kdr->caps[i], expect_caps[i], "%ld", logical_min );
+            check_member( kdr->caps[i], expect_caps[i], "%ld", logical_max );
+            check_member( kdr->caps[i], expect_caps[i], "%ld", physical_min );
+            check_member( kdr->caps[i], expect_caps[i], "%ld", physical_max );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", units );
+            check_member( kdr->caps[i], expect_caps[i], "%#lx", units_exp );
             winetest_pop_context();
         }
 
         for (i = 0; i < ARRAY_SIZE(expect_nodes); ++i)
         {
             struct hidp_kdr_node *nodes = (struct hidp_kdr_node *)((char *)kdr->caps + kdr->caps_size);
-            winetest_push_context( "nodes[%d]", i );
+            winetest_push_context( "nodes[%ld]", i );
             check_member( nodes[i], expect_nodes[i], "%04x", usage );
             check_member( nodes[i], expect_nodes[i], "%04x", usage_page );
             check_member( nodes[i], expect_nodes[i], "%d", parent );
             check_member( nodes[i], expect_nodes[i], "%d", number_of_children );
             check_member( nodes[i], expect_nodes[i], "%d", next_sibling );
             check_member( nodes[i], expect_nodes[i], "%d", first_child );
-            check_member( nodes[i], expect_nodes[i], "%#x", collection_type );
+            check_member( nodes[i], expect_nodes[i], "%#lx", collection_type );
             winetest_pop_context();
         }
     }
@@ -3341,24 +3341,24 @@ BOOL dinput_driver_start_( const char *file, int line, const BYTE *desc_buf, ULO
 
     status = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services\\winetest",
                               0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL );
-    ok_(file, line)( !status, "RegCreateKeyExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegCreateKeyExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"ReportID", 0, REG_DWORD, (void *)&report_id, sizeof(report_id) );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled) );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)desc_buf, desc_len );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes) );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Caps", 0, REG_BINARY, (void *)caps, sizeof(*caps) );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Expect", 0, REG_BINARY, (void *)expect, expect_size );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Input", 0, REG_BINARY, NULL, 0 );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
     fill_context( line, context, ARRAY_SIZE(context) );
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
-    ok_(file, line)( !status, "RegSetValueExW returned %#x\n", status );
+    ok_(file, line)( !status, "RegSetValueExW returned %#lx\n", status );
 
     return pnp_driver_start( L"driver_hid.dll" );
 }
@@ -3385,7 +3385,7 @@ BOOL dinput_test_init_( const char *file, int line )
         win_skip( "Failed to create test data mapping.\n" );
         return FALSE;
     }
-    ok( !!test_data_mapping, "got error %u\n", GetLastError() );
+    ok( !!test_data_mapping, "got error %lu\n", GetLastError() );
     test_data = MapViewOfFile( test_data_mapping, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 1024 );
     test_data->running_under_wine = !strcmp( winetest_platform, "wine" );
     test_data->winetest_report_success = winetest_report_success;
@@ -3393,7 +3393,7 @@ BOOL dinput_test_init_( const char *file, int line )
 
     okfile = CreateFileW( L"C:\\windows\\winetest_dinput_okfile", GENERIC_READ | GENERIC_WRITE,
                           FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL );
-    ok( okfile != INVALID_HANDLE_VALUE, "failed to create file, error %u\n", GetLastError() );
+    ok( okfile != INVALID_HANDLE_VALUE, "failed to create file, error %lu\n", GetLastError() );
 
     subtest( "driver_hid" );
     return TRUE;
@@ -3426,53 +3426,53 @@ HRESULT dinput_test_create_device( DWORD version, DIDEVICEINSTANCEW *devinst, ID
         hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL );
         if (FAILED(hr))
         {
-            win_skip( "DirectInput8Create returned %#x\n", hr );
+            win_skip( "DirectInput8Create returned %#lx\n", hr );
             return hr;
         }
 
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, find_test_device, devinst, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         if (!IsEqualGUID( &devinst->guidProduct, &expect_guid_product ))
         {
             win_skip( "device not found, skipping tests\n" );
             ref = IDirectInput8_Release( di8 );
-            ok( ref == 0, "Release returned %d\n", ref );
+            ok( ref == 0, "Release returned %ld\n", ref );
             return DIERR_DEVICENOTREG;
         }
 
         hr = IDirectInput8_CreateDevice( di8, &expect_guid_product, device, NULL );
-        ok( hr == DI_OK, "CreateDevice returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
         ref = IDirectInput8_Release( di8 );
         todo_wine
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
     }
     else
     {
         hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL );
         if (FAILED(hr))
         {
-            win_skip( "DirectInputCreateEx returned %#x\n", hr );
+            win_skip( "DirectInputCreateEx returned %#lx\n", hr );
             return hr;
         }
 
         hr = IDirectInput_EnumDevices( di, 0, find_test_device, devinst, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         if (!IsEqualGUID( &devinst->guidProduct, &expect_guid_product ))
         {
             win_skip( "device not found, skipping tests\n" );
 
             ref = IDirectInput_Release( di );
-            ok( ref == 0, "Release returned %d\n", ref );
+            ok( ref == 0, "Release returned %ld\n", ref );
             return DIERR_DEVICENOTREG;
         }
 
         hr = IDirectInput_CreateDevice( di, &expect_guid_product, (IDirectInputDeviceW **)device, NULL );
-        ok( hr == DI_OK, "CreateDevice returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
         ref = IDirectInput_Release( di );
         todo_wine
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
     }
 
     return DI_OK;
@@ -3536,24 +3536,24 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event )
 
     status = RegCreateKeyExW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services\\winetest",
                               0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL );
-    ok( !status, "RegCreateKeyExW returned %#x\n", status );
+    ok( !status, "RegCreateKeyExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"ReportID", 0, REG_DWORD, (void *)&report_id, sizeof(report_id) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"PolledMode", 0, REG_DWORD, (void *)&polled, sizeof(polled) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Descriptor", 0, REG_BINARY, (void *)gamepad_desc, sizeof(gamepad_desc) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Attributes", 0, REG_BINARY, (void *)&attributes, sizeof(attributes) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Caps", 0, REG_BINARY, (void *)&caps, sizeof(caps) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Expect", 0, REG_BINARY, (void *)NULL, 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     status = RegSetValueExW( hkey, L"Input", 0, REG_BINARY, NULL, 0 );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
     fill_context( __LINE__, context, ARRAY_SIZE(context) );
     status = RegSetValueExW( hkey, L"Context", 0, REG_BINARY, (void *)context, sizeof(context) );
-    ok( !status, "RegSetValueExW returned %#x\n", status );
+    ok( !status, "RegSetValueExW returned %#lx\n", status );
 
     pnp_driver_start( L"driver_hid.dll" );
     WaitForSingleObject( stop_event, INFINITE );
diff --git a/dlls/dinput/tests/hotplug.c b/dlls/dinput/tests/hotplug.c
index 10aaeebcfd3..39f80774012 100644
--- a/dlls/dinput/tests/hotplug.c
+++ b/dlls/dinput/tests/hotplug.c
@@ -86,7 +86,7 @@ static BOOL test_input_lost( DWORD version )
     DIJOYSTATE2 state;
     HRESULT hr;
 
-    winetest_push_context( "%#x", version );
+    winetest_push_context( "%#lx", version );
 
     GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
     GetTempPathW( ARRAY_SIZE(tempdir), tempdir );
@@ -97,53 +97,53 @@ static BOOL test_input_lost( DWORD version )
     if (FAILED(hr = dinput_test_create_device( version, &devinst, &device ))) goto done;
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, 0, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND );
-    ok( hr == DI_OK, "SetCooperativeLevel returned %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &buffer_size.diph );
-    ok( hr == DI_OK, "SetProperty returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
-    ok( hr == DI_OK, "GetDeviceState returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceState returned %#lx\n", hr );
     size = version < 0x0800 ? sizeof(DIDEVICEOBJECTDATA_DX3) : sizeof(DIDEVICEOBJECTDATA);
     count = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( count == 0, "got %u expected %u\n", count, 0 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( count == 0, "got %lu expected 0\n", count );
 
     pnp_driver_stop();
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
-    ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr );
+    ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
-    ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#x\n", hr );
+    ok( hr == DIERR_INPUTLOST, "GetDeviceState returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK );
-    ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_INPUTLOST, "GetDeviceData returned %#lx\n", hr );
     hr = IDirectInputDevice8_Poll( device );
-    ok( hr == DIERR_INPUTLOST, "Poll returned: %#x\n", hr );
+    ok( hr == DIERR_INPUTLOST, "Poll returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr );
+    ok( hr == DIERR_UNPLUGGED, "Acquire returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
-    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr );
+    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &count, DIGDD_PEEK );
-    ok( hr == DIERR_NOTACQUIRED, "GetDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_NOTACQUIRED, "GetDeviceData returned %#lx\n", hr );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_NOEFFECT, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unacquire returned: %#lx\n", hr );
 
     dinput_driver_start( report_desc, sizeof(report_desc), &hid_caps, NULL, 0 );
 
     hr = IDirectInputDevice8_Acquire( device );
     todo_wine
-    ok( hr == DIERR_UNPLUGGED, "Acquire returned %#x\n", hr );
+    ok( hr == DIERR_UNPLUGGED, "Acquire returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
     todo_wine
-    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#x\n", hr );
+    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned %#lx\n", hr );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
 done:
     pnp_driver_stop();
@@ -192,7 +192,7 @@ static LRESULT CALLBACK devnotify_wndproc( HWND hwnd, UINT msg, WPARAM wparam, L
         }
 
         ok( hwnd == device_change_hwnd, "got hwnd %p\n", hwnd );
-        ok( header->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE, "got dbch_devicetype %u\n",
+        ok( header->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE, "got dbch_devicetype %lu\n",
             header->dbch_devicetype );
 
         winetest_push_context( "%u", device_change_count );
@@ -200,7 +200,7 @@ static LRESULT CALLBACK devnotify_wndproc( HWND hwnd, UINT msg, WPARAM wparam, L
         ok( IsEqualGUID( &iface->dbcc_classguid, &expect_guid ), "got dbch_classguid %s\n",
             debugstr_guid( &iface->dbcc_classguid ) );
         ok( iface->dbcc_size >= offsetof( DEV_BROADCAST_DEVICEINTERFACE_W, dbcc_name[wcslen( iface->dbcc_name ) + 1] ),
-            "got dbcc_size %u\n", iface->dbcc_size );
+            "got dbcc_size %lu\n", iface->dbcc_size );
         ok( !wcsncmp( iface->dbcc_name, expect_prefix, wcslen( expect_prefix ) ),
             "got dbcc_name %s\n", debugstr_w(iface->dbcc_name) );
 
@@ -211,9 +211,9 @@ static LRESULT CALLBACK devnotify_wndproc( HWND hwnd, UINT msg, WPARAM wparam, L
         ok( all_lower( upper_end, name_end ), "got dbcc_name %s\n", debugstr_w(iface->dbcc_name) );
 
         if (device_change_count++ >= device_change_expect / 2)
-            ok( wparam == DBT_DEVICEREMOVECOMPLETE, "got wparam %#x\n", (DWORD)wparam );
+            ok( wparam == DBT_DEVICEREMOVECOMPLETE, "got wparam %#Ix\n", wparam );
         else
-            ok( wparam == DBT_DEVICEARRIVAL, "got wparam %#x\n", (DWORD)wparam );
+            ok( wparam == DBT_DEVICEARRIVAL, "got wparam %#Ix\n", wparam );
 
         winetest_pop_context();
     }
@@ -245,22 +245,22 @@ static void test_RegisterDeviceNotification(void)
     RegisterClassExW( &class );
 
     hwnd = CreateWindowW( class.lpszClassName, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL );
-    ok( !!hwnd, "CreateWindowW failed, error %u\n", GetLastError() );
+    ok( !!hwnd, "CreateWindowW failed, error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     devnotify = RegisterDeviceNotificationA( NULL, NULL, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     devnotify = RegisterDeviceNotificationA( (HWND)0xdeadbeef, NULL, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     devnotify = RegisterDeviceNotificationA( hwnd, NULL, 2 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
-    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %u\n", GetLastError() );
+    ok( GetLastError() == ERROR_INVALID_PARAMETER, "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     memset( header, 0, sizeof(DEV_BROADCAST_OEM) );
@@ -269,7 +269,7 @@ static void test_RegisterDeviceNotification(void)
     devnotify = RegisterDeviceNotificationA( hwnd, header, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_SERVICE_SPECIFIC_ERROR,
-        "got error %u\n", GetLastError() );
+        "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     memset( header, 0, sizeof(DEV_BROADCAST_DEVNODE) );
@@ -278,7 +278,7 @@ static void test_RegisterDeviceNotification(void)
     devnotify = RegisterDeviceNotificationA( hwnd, header, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_SERVICE_SPECIFIC_ERROR,
-        "got error %u\n", GetLastError() );
+        "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     memset( header, 0, sizeof(DEV_BROADCAST_VOLUME) );
@@ -287,7 +287,7 @@ static void test_RegisterDeviceNotification(void)
     devnotify = RegisterDeviceNotificationA( hwnd, header, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_SERVICE_SPECIFIC_ERROR,
-        "got error %u\n", GetLastError() );
+        "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     memset( header, 0, sizeof(DEV_BROADCAST_PORT_A) );
@@ -296,7 +296,7 @@ static void test_RegisterDeviceNotification(void)
     devnotify = RegisterDeviceNotificationA( hwnd, header, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_SERVICE_SPECIFIC_ERROR,
-        "got error %u\n", GetLastError() );
+        "got error %lu\n", GetLastError() );
 
     SetLastError( 0xdeadbeef );
     memset( header, 0, sizeof(DEV_BROADCAST_NET) );
@@ -305,10 +305,10 @@ static void test_RegisterDeviceNotification(void)
     devnotify = RegisterDeviceNotificationA( hwnd, header, 0 );
     ok( !devnotify, "RegisterDeviceNotificationA succeeded\n" );
     ok( GetLastError() == ERROR_INVALID_DATA || GetLastError() == ERROR_SERVICE_SPECIFIC_ERROR,
-        "got error %u\n", GetLastError() );
+        "got error %lu\n", GetLastError() );
 
     devnotify = RegisterDeviceNotificationA( hwnd, &iface_filter_a, DEVICE_NOTIFY_WINDOW_HANDLE );
-    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %u\n", GetLastError() );
+    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %lu\n", GetLastError() );
     while (PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
 
     device_change_count = 0;
@@ -316,9 +316,9 @@ static void test_RegisterDeviceNotification(void)
     device_change_hwnd = hwnd;
     device_change_all = FALSE;
     stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( !!stop_event, "CreateEventW failed, error %u\n", GetLastError() );
+    ok( !!stop_event, "CreateEventW failed, error %lu\n", GetLastError() );
     thread = CreateThread( NULL, 0, dinput_test_device_thread, stop_event, 0, NULL );
-    ok( !!thread, "CreateThread failed, error %u\n", GetLastError() );
+    ok( !!thread, "CreateThread failed, error %lu\n", GetLastError() );
 
     while (device_change_count < device_change_expect)
     {
@@ -341,7 +341,7 @@ static void test_RegisterDeviceNotification(void)
     strcpy( ((DEV_BROADCAST_DEVICEINTERFACE_A *)buffer)->dbcc_name, "device name" );
     ((DEV_BROADCAST_DEVICEINTERFACE_A *)buffer)->dbcc_size += strlen( "device name" ) + 1;
     devnotify = RegisterDeviceNotificationA( hwnd, buffer, DEVICE_NOTIFY_WINDOW_HANDLE );
-    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %u\n", GetLastError() );
+    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %lu\n", GetLastError() );
     while (PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
 
     device_change_count = 0;
@@ -349,9 +349,9 @@ static void test_RegisterDeviceNotification(void)
     device_change_hwnd = hwnd;
     device_change_all = FALSE;
     stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( !!stop_event, "CreateEventW failed, error %u\n", GetLastError() );
+    ok( !!stop_event, "CreateEventW failed, error %lu\n", GetLastError() );
     thread = CreateThread( NULL, 0, dinput_test_device_thread, stop_event, 0, NULL );
-    ok( !!thread, "CreateThread failed, error %u\n", GetLastError() );
+    ok( !!thread, "CreateThread failed, error %lu\n", GetLastError() );
 
     while (device_change_count < device_change_expect)
     {
@@ -371,7 +371,7 @@ static void test_RegisterDeviceNotification(void)
     UnregisterDeviceNotification( devnotify );
 
     devnotify = RegisterDeviceNotificationA( hwnd, &iface_filter_a, DEVICE_NOTIFY_ALL_INTERFACE_CLASSES );
-    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %u\n", GetLastError() );
+    ok( !!devnotify, "RegisterDeviceNotificationA failed, error %lu\n", GetLastError() );
     while (PeekMessageW( &msg, hwnd, 0, 0, PM_REMOVE )) DispatchMessageW( &msg );
 
     device_change_count = 0;
@@ -379,9 +379,9 @@ static void test_RegisterDeviceNotification(void)
     device_change_hwnd = hwnd;
     device_change_all = TRUE;
     stop_event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( !!stop_event, "CreateEventW failed, error %u\n", GetLastError() );
+    ok( !!stop_event, "CreateEventW failed, error %lu\n", GetLastError() );
     thread = CreateThread( NULL, 0, dinput_test_device_thread, stop_event, 0, NULL );
-    ok( !!thread, "CreateThread failed, error %u\n", GetLastError() );
+    ok( !!thread, "CreateThread failed, error %lu\n", GetLastError() );
 
     while (device_change_count < device_change_expect)
     {
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index 8a3e5e3022c..2e60b19162e 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -115,33 +115,33 @@ static BOOL CALLBACK EnumAxes(const DIDEVICEOBJECTINSTANCEA *pdidoi, void *pCont
         dipdw.diph.dwObj        = pdidoi->dwType;
 
         hr = IDirectInputDevice_GetProperty(info->pJoystick, DIPROP_RANGE, &diprg.diph);
-        ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
         ok(info->lMin == diprg.lMin && info->lMax == diprg.lMax, "Min/Max range invalid: "
-           "expected %d..%d got %d..%d\n", info->lMin, info->lMax, diprg.lMin, diprg.lMax);
+           "expected %ld..%ld got %ld..%ld\n", info->lMin, info->lMax, diprg.lMin, diprg.lMax);
 
         diprg.lMin = -2000;
         diprg.lMax = +2000;
 
         hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_RANGE, NULL);
         ok(hr==E_INVALIDARG,"IDirectInputDevice_SetProperty() should have returned "
-           "E_INVALIDARG, returned: %08x\n", hr);
+           "E_INVALIDARG, returned: %#lx\n", hr);
 
         hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_RANGE, &diprg.diph);
-        ok(hr==DI_OK,"IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+        ok(hr==DI_OK,"IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
 
         /* dead zone */
         hr = IDirectInputDevice_GetProperty(info->pJoystick, DIPROP_DEADZONE, &dipdw.diph);
-        ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-        ok(info->dZone == dipdw.dwData, "deadzone invalid: expected %d got %d\n",
+        ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+        ok(info->dZone == dipdw.dwData, "deadzone invalid: expected %lu got %lu\n",
            info->dZone, dipdw.dwData);
 
         dipdw.dwData = 123;
 
         hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_DEADZONE, &dipdw.diph);
-        ok(hr==DI_OK,"IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+        ok(hr==DI_OK,"IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
 
         /* ensure DIDOI_ASPECTPOSITION is set for axes objects  */
-        ok(pdidoi->dwFlags & DIDOI_ASPECTPOSITION, "Missing DIDOI_ASPECTPOSITION, flags are 0x%x\n",
+        ok(pdidoi->dwFlags & DIDOI_ASPECTPOSITION, "Missing DIDOI_ASPECTPOSITION, flags are %#lx\n",
            pdidoi->dwFlags);
 
         info->axis++;
@@ -211,7 +211,7 @@ static BOOL CALLBACK EnumEffects(const DIEFFECTINFOA *lpef, void *ref)
         return DIENUM_CONTINUE;
     }
     trace("controller supports '%s' effect\n", id->name);
-    ok(type == id->dieft, "Invalid effect type, expected 0x%x, got 0x%x\n",
+    ok(type == id->dieft, "Invalid effect type, expected %#x, got %#lx\n",
        id->dieft, lpef->dwEffType);
 
     /* Can't use custom for test as we don't know the data format */
@@ -275,11 +275,11 @@ static BOOL CALLBACK EnumAllFeedback(const DIDEVICEINSTANCEA *lpddi, void *pvRef
     trace("---- Device Information ----\n"
           "Product Name  : %s\n"
           "Instance Name : %s\n"
-          "devType       : 0x%08x\n"
+          "devType       : 0x%#lx\n"
           "GUID Product  : %s\n"
           "GUID Instance : %s\n"
-          "HID Page      : 0x%04x\n"
-          "HID Usage     : 0x%04x\n",
+          "HID Page      : %#04x\n"
+          "HID Usage     : %#04x\n",
           lpddi->tszProductName,
           lpddi->tszInstanceName,
           lpddi->dwDevType,
@@ -321,34 +321,34 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     DIPROPDWORD dip_gain_set, dip_gain_get;
     struct effect_enum effect_data;
 
-    ok(data->version >= 0x0300, "Joysticks not supported in version 0x%04x\n", data->version);
+    ok(data->version >= 0x0300, "Joysticks not supported in version %#lx\n", data->version);
  
     hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance, NULL, NULL);
     ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
-       "E_POINTER, returned: %08x\n", hr);
+       "E_POINTER, returned: %#lx\n", hr);
 
     hr = IDirectInput_CreateDevice(data->pDI, NULL, &pJoystick, NULL);
     ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
-       "E_POINTER, returned: %08x\n", hr);
+       "E_POINTER, returned: %#lx\n", hr);
 
     hr = IDirectInput_CreateDevice(data->pDI, NULL, NULL, NULL);
     ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
-       "E_POINTER, returned: %08x\n", hr);
+       "E_POINTER, returned: %#lx\n", hr);
 
     hr = IDirectInput_CreateDevice(data->pDI, &lpddi->guidInstance,
                                    &pJoystick, NULL);
-    ok(hr==DI_OK,"IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (hr!=DI_OK)
         goto DONE;
 
     trace("---- Controller Information ----\n"
           "Product Name  : %s\n"
           "Instance Name : %s\n"
-          "devType       : 0x%08x\n"
+          "devType       : 0x%#lx\n"
           "GUID Product  : %s\n"
           "GUID Instance : %s\n"
-          "HID Page      : 0x%04x\n"
-          "HID Usage     : 0x%04x\n",
+          "HID Page      : %#04x\n"
+          "HID Usage     : %#04x\n",
           lpddi->tszProductName,
           lpddi->tszInstanceName,
           lpddi->dwDevType,
@@ -360,7 +360,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     /* Check if this is a HID device */
     if (lpddi->dwDevType & DIDEVTYPE_HID)
         ok(lpddi->wUsagePage == 0x01 && (lpddi->wUsage == 0x04 || lpddi->wUsage == 0x05),
-           "Expected a game controller HID UsagePage and Usage, got page 0x%x usage 0x%x\n",
+           "Expected a game controller HID UsagePage and Usage, got page %#x usage %#x\n",
            lpddi->wUsagePage, lpddi->wUsage);
 
     /* Test for joystick ID property */
@@ -380,7 +380,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     dps.diph.dwHow = DIPH_DEVICE;
 
     hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_INSTANCENAME, &dps.diph);
-    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_INSTANCENAME failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_INSTANCENAME failed: %#lx\n", hr);
 
     /* Test if instance name is the same as present in DIDEVICEINSTANCE */
     MultiByteToWideChar(CP_ACP, 0, lpddi->tszInstanceName, -1, nameBuffer, MAX_PATH);
@@ -388,7 +388,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
                  wine_dbgstr_w(nameBuffer), wine_dbgstr_w(dps.wsz));
 
     hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_PRODUCTNAME, &dps.diph);
-    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_PRODUCTNAME failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_PRODUCTNAME failed: %#lx\n", hr);
 
     /* Test if product name is the same as present in DIDEVICEINSTANCE */
     MultiByteToWideChar(CP_ACP, 0, lpddi->tszProductName, -1, nameBuffer, MAX_PATH);
@@ -402,7 +402,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     dpg.diph.dwHow = DIPH_DEVICE;
 
     hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_GUIDANDPATH, &dpg.diph);
-    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_GUIDANDPATH failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_GUIDANDPATH failed: %#lx\n", hr);
 
     {
         int vid, pid;
@@ -418,57 +418,57 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
 
     hr = IDirectInputDevice_SetDataFormat(pJoystick, NULL);
     ok(hr==E_POINTER,"IDirectInputDevice_SetDataFormat() should have returned "
-       "E_POINTER, returned: %08x\n", hr);
+       "E_POINTER, returned: %#lx\n", hr);
 
     ZeroMemory(&format, sizeof(format));
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &format);
     ok(hr==DIERR_INVALIDPARAM,"IDirectInputDevice_SetDataFormat() should have "
-       "returned DIERR_INVALIDPARAM, returned: %08x\n", hr);
+       "returned DIERR_INVALIDPARAM, returned: %#lx\n", hr);
 
     /* try the default formats */
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2);
-    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
 
     /* try an alternate format */
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystickTest);
-    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2);
-    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
     if (hr != DI_OK)
         goto RELEASE;
 
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, NULL, i);
-        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %#lx\n", i, hr);
     }
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, hWnd, i);
-        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %#lx\n", i, hr);
     }
 
     hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, hWnd,
                                                 DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
-    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %#lx\n", hr);
 
     /* get capabilities */
     hr = IDirectInputDevice_GetCapabilities(pJoystick, NULL);
     ok(hr==E_POINTER,"IDirectInputDevice_GetCapabilities() "
-       "should have returned E_POINTER, returned: %08x\n", hr);
+       "should have returned E_POINTER, returned: %#lx\n", hr);
 
     ZeroMemory(&caps, sizeof(caps));
     hr = IDirectInputDevice_GetCapabilities(pJoystick, &caps);
     ok(hr==DIERR_INVALIDPARAM,"IDirectInputDevice_GetCapabilities() "
-       "should have returned DIERR_INVALIDPARAM, returned: %08x\n", hr);
+       "should have returned DIERR_INVALIDPARAM, returned: %#lx\n", hr);
 
     caps.dwSize = sizeof(caps);
     hr = IDirectInputDevice_GetCapabilities(pJoystick, &caps);
-    ok(hr==DI_OK,"IDirectInputDevice_GetCapabilities() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_GetCapabilities() failed: %#lx\n", hr);
 
     ZeroMemory(&info, sizeof(info));
     info.pJoystick = pJoystick;
@@ -478,56 +478,56 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     info.lMax = 0xffff;
     /* enumerate objects */
     hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, &info, DIDFT_ALL);
-    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %#lx\n", hr);
 
-    ok(caps.dwAxes == info.axis, "Number of enumerated axes (%d) doesn't match capabilities (%d)\n", info.axis, caps.dwAxes);
-    ok(caps.dwButtons == info.button, "Number of enumerated buttons (%d) doesn't match capabilities (%d)\n", info.button, caps.dwButtons);
-    ok(caps.dwPOVs == info.pov, "Number of enumerated POVs (%d) doesn't match capabilities (%d)\n", info.pov, caps.dwPOVs);
+    ok(caps.dwAxes == info.axis, "Number of enumerated axes (%ld) doesn't match capabilities (%ld)\n", info.axis, caps.dwAxes);
+    ok(caps.dwButtons == info.button, "Number of enumerated buttons (%ld) doesn't match capabilities (%ld)\n", info.button, caps.dwButtons);
+    ok(caps.dwPOVs == info.pov, "Number of enumerated POVs (%ld) doesn't match capabilities (%ld)\n", info.pov, caps.dwPOVs);
 
     /* Set format and check limits again */
     hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2);
-    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
     info.lMin = -2000;
     info.lMax = +2000;
     info.dZone= 123;
     hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, &info, DIDFT_ALL);
-    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_GetDeviceInfo(pJoystick, 0);
     ok(hr==E_POINTER, "IDirectInputDevice_GetDeviceInfo() "
-       "should have returned E_POINTER, returned: %08x\n", hr);
+       "should have returned E_POINTER, returned: %#lx\n", hr);
 
     ZeroMemory(&inst, sizeof(inst));
     ZeroMemory(&inst3, sizeof(inst3));
 
     hr = IDirectInputDevice_GetDeviceInfo(pJoystick, &inst);
     ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceInfo() "
-       "should have returned DIERR_INVALIDPARAM, returned: %08x\n", hr);
+       "should have returned DIERR_INVALIDPARAM, returned: %#lx\n", hr);
 
     inst.dwSize = sizeof(inst);
     hr = IDirectInputDevice_GetDeviceInfo(pJoystick, &inst);
-    ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %#lx\n", hr);
 
     inst3.dwSize = sizeof(inst3);
     hr = IDirectInputDevice_GetDeviceInfo(pJoystick, (DIDEVICEINSTANCEA*)&inst3);
-    ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_Unacquire(pJoystick);
-    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %#lx\n", hr);
 
     hr = IDirectInputDevice_Acquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
     if (hr != DI_OK)
         goto RELEASE;
 
     hr = IDirectInputDevice_Acquire(pJoystick);
-    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have returned S_FALSE, got: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have returned S_FALSE, got: %#lx\n", hr);
 
     if (info.pov < 4)
     {
         hr = IDirectInputDevice_GetDeviceState(pJoystick, sizeof(DIJOYSTATE2), &js);
-        ok(hr == DI_OK, "IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
-        ok(js.rgdwPOV[3] == -1, "Default for unassigned POV should be -1 not: %d\n", js.rgdwPOV[3]);
+        ok(hr == DI_OK, "IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
+        ok(js.rgdwPOV[3] == -1, "Default for unassigned POV should be -1 not: %ld\n", js.rgdwPOV[3]);
     }
 
     trace("Testing force feedback\n");
@@ -553,17 +553,17 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     ok(real_hWnd!=0,"CreateWindowExA failed: %p\n", real_hWnd);
     ShowWindow(real_hWnd, SW_SHOW);
     hr = IDirectInputDevice_Unacquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, real_hWnd,
                                                 DISCL_EXCLUSIVE | DISCL_FOREGROUND);
-    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
 
     cnt1 = get_refcount((IUnknown*)pJoystick);
 
     hr = IDirectInputDevice2_EnumEffects((IDirectInputDevice2A*)pJoystick, EnumEffects, &effect_data, DIEFT_ALL);
-    ok(hr==DI_OK,"IDirectInputDevice2_EnumEffects() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice2_EnumEffects() failed: %#lx\n", hr);
 
     /* If the controller does not support ANY effect use the constant effect to make
      * CreateEffect fail but with the unsupported reason instead of invalid parameters. */
@@ -586,9 +586,9 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     {
         trace("force feedback supported with %d effects, using '%s' for test\n",
               effect_data.effect_count, effect_data.effect_name);
-        ok(hr == DI_OK, "IDirectInputDevice_CreateEffect() failed: %08x\n", hr);
+        ok(hr == DI_OK, "IDirectInputDevice_CreateEffect() failed: %#lx\n", hr);
         cnt2 = get_refcount((IUnknown*)pJoystick);
-        ok(cnt1 == cnt2, "Ref count is wrong %d != %d\n", cnt1, cnt2);
+        ok(cnt1 == cnt2, "Ref count is wrong %ld != %ld\n", cnt1, cnt2);
 
         if (effect)
         {
@@ -600,39 +600,39 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
 
             hr = IDirectInputEffect_Initialize(effect, hInstance, data->version,
                                                &effect_data.guid);
-            ok(hr==DI_OK,"IDirectInputEffect_Initialize failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Initialize failed: %#lx\n", hr);
 
             /* Test SetParameters with NULL pointers */
             tmp = effect_data.eff.rgdwAxes;
             effect_data.eff.rgdwAxes = NULL;
             hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_AXES);
-            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr);
+            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %#lx\n", hr);
             effect_data.eff.rgdwAxes = tmp;
 
             tmp = effect_data.eff.rglDirection;
             effect_data.eff.rglDirection = NULL;
             hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_DIRECTION);
-            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr);
+            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %#lx\n", hr);
             effect_data.eff.rglDirection = tmp;
 
             tmp = effect_data.eff.lpvTypeSpecificParams;
             effect_data.eff.lpvTypeSpecificParams = NULL;
             hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_TYPESPECIFICPARAMS);
-            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %08x\n", hr);
+            ok(hr==DIERR_INVALIDPARAM,"IDirectInputEffect_SetParameters should fail with INVALIDPARAM, got: %#lx\n", hr);
             effect_data.eff.lpvTypeSpecificParams = tmp;
 
             hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_AXES | DIEP_DIRECTION |
                                                   DIEP_TYPESPECIFICPARAMS);
-            ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %#lx\n", hr);
             if (hr==DI_OK) {
                 /* Test that upload, unacquire, acquire still permits updating
                  * uploaded effect. */
                 hr = IDirectInputDevice_Unacquire(pJoystick);
-                ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+                ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
                 hr = IDirectInputDevice_Acquire(pJoystick);
-                ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+                ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
                 hr = IDirectInputEffect_SetParameters(effect, &effect_data.eff, DIEP_GAIN);
-                ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
+                ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %#lx\n", hr);
             }
 
             /* Check effect status.
@@ -650,39 +650,39 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
              *   about incomplete effect)
              */
             hr = IDirectInputEffect_GetEffectStatus(effect, NULL);
-            ok(hr==E_POINTER,"IDirectInputEffect_GetEffectStatus() must fail with E_POINTER, got: %08x\n", hr);
+            ok(hr==E_POINTER,"IDirectInputEffect_GetEffectStatus() must fail with E_POINTER, got: %#lx\n", hr);
             effect_status = 0xdeadbeef;
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
             /* SetParameters with a zeroed-out DIEFFECT and flags=0 should do nothing. */
             memset(&effect_empty, 0, sizeof(effect_empty));
             effect_empty.dwSize = sizeof(effect_empty);
             hr = IDirectInputEffect_SetParameters(effect, &effect_empty, 0);
-            ok(hr==DI_NOEFFECT,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
+            ok(hr==DI_NOEFFECT,"IDirectInputEffect_SetParameters failed: %#lx\n", hr);
             /* Start effect with SetParameters and a zeroed-out DIEFFECT. */
             hr = IDirectInputEffect_SetParameters(effect, &effect_empty, DIEP_START);
-            ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_SetParameters failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             todo_wine ok(effect_status!=0,"IDirectInputEffect_GetEffectStatus() reported effect as stopped\n");
             hr = IDirectInputDevice_Unacquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
             hr = IDirectInputDevice_Acquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
             hr = IDirectInputEffect_Download(effect);
-            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
             hr = IDirectInputEffect_Start(effect, 1, 0);
-            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             Sleep(250); /* feel the magic */
             todo_wine ok(effect_status!=0,"IDirectInputEffect_GetEffectStatus() reported effect as stopped\n");
             hr = IDirectInputEffect_GetEffectGuid(effect, &guid);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %#lx\n", hr);
             ok(IsEqualGUID(&effect_data.guid, &guid), "Wrong guid returned\n");
 
             /* Check autocenter status
@@ -705,42 +705,42 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
             diprop_word.diph.dwObj = 0;
             diprop_word.diph.dwHow = DIPH_DEVICE;
             hr = IDirectInputDevice_Unacquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
             hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %#lx\n", hr);
             ok(diprop_word.dwData==DIPROPAUTOCENTER_ON,"IDirectInputDevice2_GetProperty() reported autocenter as disabled\n");
             diprop_word.dwData = DIPROPAUTOCENTER_OFF;
             hr = IDirectInputDevice2_SetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %#lx\n", hr);
             ok(diprop_word.dwData==DIPROPAUTOCENTER_OFF,"IDirectInputDevice2_GetProperty() reported autocenter as enabled\n");
             if (winetest_interactive) {
                 trace("Acquiring in 2s, autocenter will be disabled.\n");
                 Sleep(2000);
             }
             hr = IDirectInputDevice_Acquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
             if (winetest_interactive)
                 trace("Acquired.\n");
             hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %#lx\n", hr);
             ok(diprop_word.dwData==DIPROPAUTOCENTER_OFF,"IDirectInputDevice2_GetProperty() reported autocenter as enabled\n");
             if (winetest_interactive) {
                 trace("Releasing in 2s, autocenter will be re-enabled.\n");
                 Sleep(2000);
             }
             hr = IDirectInputDevice_Unacquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
             if (winetest_interactive)
                 trace("Released\n");
             hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %#lx\n", hr);
             ok(diprop_word.dwData==DIPROPAUTOCENTER_OFF,"IDirectInputDevice2_GetProperty() reported autocenter as enabled\n");
             hr = IDirectInputDevice_Acquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
             hr = IDirectInputDevice2_GetProperty(pJoystick, DIPROP_AUTOCENTER, &diprop_word.diph);
-            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice2_GetProperty() failed: %#lx\n", hr);
 
             /* Device gain (DIPROP_FFGAIN).
              * From MSDN:
@@ -761,90 +761,90 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
 
             /* Test device is acquisition (non)impact. */
             hr = IDirectInputDevice_Unacquire(pJoystick);
-            ok(hr == DI_OK, "IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %08x\n", hr);
+            ok(hr == DI_OK, "IDirectInputDevice_Unacquire() should have returned S_FALSE, got: %#lx\n", hr);
             dip_gain_set.dwData = 1;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %lu\n", dip_gain_get.dwData);
             hr = IDirectInputDevice_Acquire(pJoystick);
-            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
             dip_gain_set.dwData = 2;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %lu\n", dip_gain_get.dwData);
             /* Test range and internal clamping. */
             dip_gain_set.dwData = -1;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            todo_wine ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SetProperty() should have returned %08x: %08x\n", DIERR_INVALIDPARAM, hr);
+            todo_wine ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SetProperty() should have returned %#lx: %#lx\n", DIERR_INVALIDPARAM, hr);
             dip_gain_set.dwData = 0;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %lu\n", dip_gain_get.dwData);
             dip_gain_set.dwData = 10000;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %lu\n", dip_gain_get.dwData);
             /* WARNING: This call succeeds, on the contrary of what is stated on MSDN. */
             dip_gain_set.dwData = 10001;
             hr = IDirectInputDevice_SetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_set.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %#lx\n", hr);
             hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_FFGAIN, &dip_gain_get.diph);
-            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %08x\n", hr);
-            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData);
+            ok(hr==DI_OK, "IDirectInputDevice_GetProperty() failed: %#lx\n", hr);
+            ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %lu\n", dip_gain_get.dwData);
 
             /* Test SendForceFeedbackCommand
              * DISFFC_STOPALL - Should stop effects only
              * DISFFC_RESET - Should stop effects and unload them (NOT release them)
              * Tests for game Odallus (bug 41623) */
             hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, 0);
-            ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr);
+            ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %#lx\n", hr);
             hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, 0xFF);
-            ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr);
+            ok(hr==DIERR_INVALIDPARAM, "IDirectInputDevice_SendForceFeedbackCommand() failed: %#lx\n", hr);
 
             hr = IDirectInputEffect_Download(effect);
-            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %#lx\n", hr);
 
             /* Send STOPALL and prove that the effect can still be started */
             hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, DISFFC_STOPALL);
-            ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
             hr = IDirectInputEffect_Start(effect, 1, 0);
-            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectGuid(effect, &guid);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %#lx\n", hr);
             ok(IsEqualGUID(&effect_data.guid, &guid), "Wrong guid returned\n");
 
             /* Send RESET and prove that we can still manipulate the effect, thus not released */
             hr = IDirectInputDevice2_SendForceFeedbackCommand((IDirectInputDevice2A*)pJoystick, DISFFC_RESET);
-            ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %08x\n", hr);
+            ok(hr==DI_OK, "IDirectInputDevice_SendForceFeedbackCommand() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DIERR_NOTDOWNLOADED,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DIERR_NOTDOWNLOADED,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             hr = IDirectInputEffect_Download(effect);
-            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Download() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectStatus(effect, &effect_status);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectStatus() failed: %#lx\n", hr);
             ok(effect_status==0,"IDirectInputEffect_GetEffectStatus() reported effect as started\n");
             hr = IDirectInputEffect_Start(effect, 1, 0);
-            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_Start() failed: %#lx\n", hr);
             hr = IDirectInputEffect_GetEffectGuid(effect, &guid);
-            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %08x\n", hr);
+            ok(hr==DI_OK,"IDirectInputEffect_GetEffectGuid() failed: %#lx\n", hr);
             ok(IsEqualGUID(&effect_data.guid, &guid), "Wrong guid returned\n");
 
             ref = IUnknown_Release(effect);
-            ok(ref == 0, "IDirectInputDevice_Release() reference count = %d\n", ref);
+            ok(ref == 0, "IDirectInputDevice_Release() reference count = %ld\n", ref);
         }
         cnt1 = get_refcount((IUnknown*)pJoystick);
-        ok(cnt1 == cnt2, "Ref count is wrong %d != %d\n", cnt1, cnt2);
+        ok(cnt1 == cnt2, "Ref count is wrong %ld != %ld\n", cnt1, cnt2);
     }
     /* No force feedback support, CreateEffect is supposed to fail. Fairy Bloom Freesia
      * calls CreateEffect without checking the DIDC_FORCEFEEDBACK. It expects the correct
@@ -852,20 +852,20 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     else
     {
         trace("No force feedback support\n");
-        ok(hr==DIERR_UNSUPPORTED, "IDirectInputDevice_CreateEffect() must fail with DIERR_UNSUPPORTED, got: %08x\n", hr);
+        ok(hr==DIERR_UNSUPPORTED, "IDirectInputDevice_CreateEffect() must fail with DIERR_UNSUPPORTED, got: %#lx\n", hr);
         ok(effect == NULL, "effect must be NULL, got %p\n", effect);
     }
 
     /* Before destroying the window, release joystick to revert to
      * non-exclusive, background cooperative level. */
     hr = IDirectInputDevice_Unacquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, hWnd,
                                                 DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
-    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %#lx\n", hr);
     DestroyWindow (real_hWnd);
     hr = IDirectInputDevice_Acquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %#lx\n", hr);
 
     if (winetest_interactive) {
         trace("You have 30 seconds to test all axes, sliders, POVs and buttons\n");
@@ -877,7 +877,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     oldstate[0]='\0';
     for (i = 0; i < count; i++) {
         hr = IDirectInputDevice_GetDeviceState(pJoystick, sizeof(DIJOYSTATE2), &js);
-        ok(hr==DI_OK,"IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
+        ok(hr==DI_OK,"IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
         if (hr != DI_OK)
             break;
         sprintf(curstate, "X%5d Y%5d Z%5d Rx%5d Ry%5d Rz%5d "
@@ -900,11 +900,11 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
     trace("\n");
 
     hr = IDirectInputDevice_Unacquire(pJoystick);
-    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
 
 RELEASE:
     ref = IDirectInputDevice_Release(pJoystick);
-    ok(ref==0,"IDirectInputDevice_Release() reference count = %d\n", ref);
+    ok(ref==0,"IDirectInputDevice_Release() reference count = %ld\n", ref);
 
 DONE:
     return DIENUM_CONTINUE;
@@ -917,18 +917,18 @@ static void joystick_tests(DWORD version)
     ULONG ref;
     HINSTANCE hInstance = GetModuleHandleW(NULL);
 
-    trace("-- Testing Direct Input Version 0x%04x --\n", version);
+    trace("-- Testing Direct Input Version %#lx --\n", version);
     hr = DirectInputCreateA(hInstance, version, &pDI, NULL);
-    ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %08x\n", hr);
+    ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %#lx\n", hr);
     if (hr==DI_OK && pDI!=0) {
         UserData data;
         data.pDI = pDI;
         data.version = version;
         hr = IDirectInput_EnumDevices(pDI, DIDEVTYPE_JOYSTICK, EnumJoysticks,
                                       &data, DIEDFL_ALLDEVICES);
-        ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %08x\n", hr);
+        ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %#lx\n", hr);
         ref = IDirectInput_Release(pDI);
-        ok(ref==0,"IDirectInput_Release() reference count = %d\n", ref);
+        ok(ref==0,"IDirectInput_Release() reference count = %ld\n", ref);
     } else if (hr==DIERR_OLDDIRECTINPUTVERSION)
         trace("  Version Not Supported\n");
 }
@@ -941,12 +941,12 @@ static void test_enum_feedback(void)
     HINSTANCE hInstance = GetModuleHandleW(NULL);
 
     hr = DirectInputCreateA(hInstance, 0x0700, &pDI, NULL);
-    ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %08x\n", hr);
+    ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %#lx\n", hr);
     if (hr==DI_OK && pDI!=0) {
         hr = IDirectInput_EnumDevices(pDI, 0, EnumAllFeedback, NULL, DIEDFL_ATTACHEDONLY | DIEDFL_FORCEFEEDBACK);
-        ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %08x\n", hr);
+        ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %#lx\n", hr);
         ref = IDirectInput_Release(pDI);
-        ok(ref==0,"IDirectInput_Release() reference count = %d\n", ref);
+        ok(ref==0,"IDirectInput_Release() reference count = %ld\n", ref);
     } else if (hr==DIERR_OLDDIRECTINPUTVERSION)
         trace("  Version Not Supported\n");
 }
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c
index 208edf3bc0c..0bfdd113633 100644
--- a/dlls/dinput/tests/joystick8.c
+++ b/dlls/dinput/tests/joystick8.c
@@ -77,25 +77,25 @@ static BOOL CALLBACK check_objects( const DIDEVICEOBJECTINSTANCEW *obj, void *ar
     ok( params->index < params->expect_count, "unexpected extra object\n" );
     if (params->index >= params->expect_count) exp = &unexpected_obj;
 
-    check_member( *obj, *exp, "%u", dwSize );
+    check_member( *obj, *exp, "%lu", dwSize );
     todo_wine_if( todo->guid )
     check_member_guid( *obj, *exp, guidType );
     todo_wine_if( todo->ofs )
-    check_member( *obj, *exp, "%#x", dwOfs );
+    check_member( *obj, *exp, "%#lx", dwOfs );
     todo_wine_if( todo->type )
-    check_member( *obj, *exp, "%#x", dwType );
+    check_member( *obj, *exp, "%#lx", dwType );
     todo_wine_if( todo->flags )
-    check_member( *obj, *exp, "%#x", dwFlags );
+    check_member( *obj, *exp, "%#lx", dwFlags );
     if (!localized) todo_wine_if( todo->name )check_member_wstr( *obj, *exp, tszName );
-    check_member( *obj, *exp, "%u", dwFFMaxForce );
-    check_member( *obj, *exp, "%u", dwFFForceResolution );
+    check_member( *obj, *exp, "%lu", dwFFMaxForce );
+    check_member( *obj, *exp, "%lu", dwFFForceResolution );
     check_member( *obj, *exp, "%u", wCollectionNumber );
     check_member( *obj, *exp, "%u", wDesignatorIndex );
     todo_wine_if( todo->usage_page )
     check_member( *obj, *exp, "%#04x", wUsagePage );
     todo_wine_if( todo->usage )
     check_member( *obj, *exp, "%#04x", wUsage );
-    check_member( *obj, *exp, "%#04x", dwDimension );
+    check_member( *obj, *exp, "%#lx", dwDimension );
     check_member( *obj, *exp, "%#04x", wExponent );
     check_member( *obj, *exp, "%u", wReportId );
 
@@ -130,11 +130,11 @@ static BOOL CALLBACK check_effects( const DIEFFECTINFOW *effect, void *args )
     ok( params->index < params->expect_count, "unexpected extra object\n" );
     if (params->index >= params->expect_count) exp = &unexpected_effect;
 
-    check_member( *effect, *exp, "%u", dwSize );
+    check_member( *effect, *exp, "%lu", dwSize );
     check_member_guid( *effect, *exp, guid );
-    check_member( *effect, *exp, "%#x", dwEffType );
-    check_member( *effect, *exp, "%#x", dwStaticParams );
-    check_member( *effect, *exp, "%#x", dwDynamicParams );
+    check_member( *effect, *exp, "%#lx", dwEffType );
+    check_member( *effect, *exp, "%#lx", dwStaticParams );
+    check_member( *effect, *exp, "%#lx", dwDynamicParams );
     check_member_wstr( *effect, *exp, tszName );
 
     winetest_pop_context();
@@ -183,129 +183,129 @@ static void check_dinput_devices( DWORD version, DIDEVICEINSTANCEW *devinst )
     if (version >= 0x800)
     {
         hr = DirectInput8Create( instance, version, &IID_IDirectInput8W, (void **)&di8, NULL );
-        ok( hr == DI_OK, "DirectInput8Create returned %#x\n", hr );
+        ok( hr == DI_OK, "DirectInput8Create returned %#lx\n", hr );
 
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, NULL, NULL, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, enum_device_count, &count, 0xdeadbeef );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput8_EnumDevices( di8, 0xdeadbeef, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_ALL, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 3, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 3, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_DEVICE, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_POINTER, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_KEYBOARD, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, DI8DEVCLASS_GAMECTRL, enum_device_count, &count,
                                         DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS | DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_FORCEFEEDBACK );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %u, expected 0\n", count );
-        else ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %lu, expected 0\n", count );
+        else ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput8_EnumDevices( di8, (devinst->dwDevType & 0xff) + 1, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        if ((devinst->dwDevType & 0xff) != DI8DEVTYPE_SUPPLEMENTAL) ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        else ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        if ((devinst->dwDevType & 0xff) != DI8DEVTYPE_SUPPLEMENTAL) ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        else ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
 
         hr = IDirectInput8_CreateDevice( di8, &devinst->guidInstance, NULL, NULL );
-        ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr );
+        ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
         hr = IDirectInput8_CreateDevice( di8, NULL, &device, NULL );
-        ok( hr == E_POINTER, "CreateDevice returned %#x\n", hr );
+        ok( hr == E_POINTER, "CreateDevice returned %#lx\n", hr );
         hr = IDirectInput8_CreateDevice( di8, &GUID_NULL, &device, NULL );
-        ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned %#x\n", hr );
+        ok( hr == DIERR_DEVICENOTREG, "CreateDevice returned %#lx\n", hr );
 
         hr = IDirectInput8_CreateDevice( di8, &devinst->guidInstance, &device, NULL );
-        ok( hr == DI_OK, "CreateDevice returned %#x\n", hr );
+        ok( hr == DI_OK, "CreateDevice returned %#lx\n", hr );
 
         prop_dword.dwData = 0xdeadbeef;
         hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
-        ok( hr == DI_OK, "GetProperty DIPROP_VIDPID returned %#x\n", hr );
-        ok( prop_dword.dwData == EXPECT_VIDPID, "got %#x expected %#x\n", prop_dword.dwData, EXPECT_VIDPID );
+        ok( hr == DI_OK, "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
+        ok( prop_dword.dwData == EXPECT_VIDPID, "got %#lx expected %#lx\n", prop_dword.dwData, EXPECT_VIDPID );
 
         ref = IDirectInputDevice8_Release( device );
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
     }
     else
     {
         hr = DirectInputCreateEx( instance, version, &IID_IDirectInput2W, (void **)&di, NULL );
-        ok( hr == DI_OK, "DirectInputCreateEx returned %#x\n", hr );
+        ok( hr == DI_OK, "DirectInputCreateEx returned %#lx\n", hr );
 
         hr = IDirectInput_EnumDevices( di, 0, NULL, NULL, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, 0xdeadbeef );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0xdeadbeef, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, DIEDFL_INCLUDEHIDDEN );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, 0, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 3, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 3, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_DEVICE, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 0, "got count %u, expected 0\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 0, "got count %lu, expected 0\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_MOUSE, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_KEYBOARD, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
         todo_wine
-        ok( count == 3, "got count %u, expected 3\n", count );
+        ok( count == 3, "got count %lu, expected 3\n", count );
         count = 0;
         hr = IDirectInput_EnumDevices( di, DIDEVTYPE_JOYSTICK, enum_device_count, &count,
                                        DIEDFL_INCLUDEALIASES | DIEDFL_INCLUDEPHANTOMS );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        ok( count == 1, "got count %lu, expected 1\n", count );
 
         count = 0;
         hr = IDirectInput_EnumDevices( di, (devinst->dwDevType & 0xff), enum_device_count, &count, DIEDFL_FORCEFEEDBACK );
-        ok( hr == DI_OK, "EnumDevices returned: %#x\n", hr );
-        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %u, expected 0\n", count );
-        else ok( count == 1, "got count %u, expected 1\n", count );
+        ok( hr == DI_OK, "EnumDevices returned: %#lx\n", hr );
+        if (IsEqualGUID( &devinst->guidFFDriver, &GUID_NULL )) ok( count == 0, "got count %lu, expected 0\n", count );
+        else ok( count == 1, "got count %lu, expected 1\n", count );
 
         hr = IDirectInput_EnumDevices( di, 0x14, enum_device_count, &count, DIEDFL_ALLDEVICES );
-        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#x\n", hr );
+        ok( hr == DIERR_INVALIDPARAM, "EnumDevices returned: %#lx\n", hr );
     }
 }
 
@@ -758,7 +758,7 @@ static void test_simple_joystick( DWORD version )
     GUID guid;
     HWND hwnd;
 
-    winetest_push_context( "%#x", version );
+    winetest_push_context( "%#lx", version );
 
     GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
     GetTempPathW( ARRAY_SIZE(tempdir), tempdir );
@@ -774,49 +774,49 @@ static void test_simple_joystick( DWORD version )
     if (version == 0x800)
     {
         todo_wine
-        ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+        ok( hr == DIERR_BETADIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
     }
     else
     {
         todo_wine
-        ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#x\n", hr );
+        ok( hr == DIERR_OLDDIRECTINPUTVERSION, "Initialize returned %#lx\n", hr );
     }
     hr = IDirectInputDevice8_Initialize( device, instance, version, NULL );
     todo_wine
-    ok( hr == E_POINTER, "Initialize returned %#x\n", hr );
+    ok( hr == E_POINTER, "Initialize returned %#lx\n", hr );
     hr = IDirectInputDevice8_Initialize( device, NULL, version, &GUID_NULL );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Initialize returned %#lx\n", hr );
     hr = IDirectInputDevice8_Initialize( device, instance, version, &GUID_NULL );
     todo_wine
-    ok( hr == REGDB_E_CLASSNOTREG, "Initialize returned %#x\n", hr );
+    ok( hr == REGDB_E_CLASSNOTREG, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Initialize( device, instance, version, &devinst.guidInstance );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
     guid = devinst.guidInstance;
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
     ok( IsEqualGUID( &guid, &devinst.guidInstance ), "got %s expected %s\n", debugstr_guid( &guid ),
         debugstr_guid( &devinst.guidInstance ) );
     hr = IDirectInputDevice8_Initialize( device, instance, version, &devinst.guidProduct );
-    ok( hr == DI_OK, "Initialize returned %#x\n", hr );
+    ok( hr == DI_OK, "Initialize returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetDeviceInfo( device, NULL );
-    ok( hr == E_POINTER, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetDeviceInfo returned %#lx\n", hr );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW) + 1;
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DIERR_INVALIDPARAM, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetDeviceInfo returned %#lx\n", hr );
 
     devinst.dwSize = sizeof(DIDEVICEINSTANCE_DX3W);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
     todo_wine
     check_member_guid( devinst, expect_devinst, guidInstance );
     check_member_guid( devinst, expect_devinst, guidProduct );
     todo_wine_if( version < 0x0800 )
-    check_member( devinst, expect_devinst, "%#x", dwDevType );
+    check_member( devinst, expect_devinst, "%#lx", dwDevType );
     todo_wine
     check_member_wstr( devinst, expect_devinst, tszInstanceName );
     todo_wine
@@ -825,13 +825,13 @@ static void test_simple_joystick( DWORD version )
     memset( &devinst, 0, sizeof(devinst) );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
     hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-    ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
-    check_member( devinst, expect_devinst, "%d", dwSize );
+    ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
+    check_member( devinst, expect_devinst, "%lu", dwSize );
     todo_wine
     check_member_guid( devinst, expect_devinst, guidInstance );
     check_member_guid( devinst, expect_devinst, guidProduct );
     todo_wine_if( version < 0x0800 )
-    check_member( devinst, expect_devinst, "%#x", dwDevType );
+    check_member( devinst, expect_devinst, "%#lx", dwDevType );
     todo_wine
     check_member_wstr( devinst, expect_devinst, tszInstanceName );
     todo_wine
@@ -841,51 +841,51 @@ static void test_simple_joystick( DWORD version )
     check_member( devinst, expect_devinst, "%04x", wUsage );
 
     hr = IDirectInputDevice8_GetCapabilities( device, NULL );
-    ok( hr == E_POINTER, "GetCapabilities returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetCapabilities returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-    ok( hr == DIERR_INVALIDPARAM, "GetCapabilities returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetCapabilities returned %#lx\n", hr );
     caps.dwSize = sizeof(DIDEVCAPS);
     hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-    ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
-    check_member( caps, expect_caps, "%d", dwSize );
-    check_member( caps, expect_caps, "%#x", dwFlags );
+    ok( hr == DI_OK, "GetCapabilities returned %#lx\n", hr );
+    check_member( caps, expect_caps, "%lu", dwSize );
+    check_member( caps, expect_caps, "%#lx", dwFlags );
     todo_wine_if( version < 0x0800 )
-    check_member( caps, expect_caps, "%#x", dwDevType );
-    check_member( caps, expect_caps, "%d", dwAxes );
-    check_member( caps, expect_caps, "%d", dwButtons );
-    check_member( caps, expect_caps, "%d", dwPOVs );
-    check_member( caps, expect_caps, "%d", dwFFSamplePeriod );
-    check_member( caps, expect_caps, "%d", dwFFMinTimeResolution );
-    check_member( caps, expect_caps, "%d", dwFirmwareRevision );
-    check_member( caps, expect_caps, "%d", dwHardwareRevision );
-    check_member( caps, expect_caps, "%d", dwFFDriverVersion );
+    check_member( caps, expect_caps, "%#lx", dwDevType );
+    check_member( caps, expect_caps, "%lu", dwAxes );
+    check_member( caps, expect_caps, "%lu", dwButtons );
+    check_member( caps, expect_caps, "%lu", dwPOVs );
+    check_member( caps, expect_caps, "%lu", dwFFSamplePeriod );
+    check_member( caps, expect_caps, "%lu", dwFFMinTimeResolution );
+    check_member( caps, expect_caps, "%lu", dwFirmwareRevision );
+    check_member( caps, expect_caps, "%lu", dwHardwareRevision );
+    check_member( caps, expect_caps, "%lu", dwFFDriverVersion );
 
     hr = IDirectInputDevice8_GetProperty( device, NULL, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, &GUID_NULL, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM),
-        "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+        "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
     prop_dword.diph.dwHeaderSize = sizeof(DIPROPHEADER) - 1;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty returned %#lx\n", hr );
     prop_dword.diph.dwHeaderSize = sizeof(DIPROPHEADER);
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_VIDPID returned %#x\n", hr );
+        "GetProperty DIPROP_VIDPID returned %#lx\n", hr );
     if (hr == DI_OK)
     {
-        ok( prop_dword.dwData == EXPECT_VIDPID, "got %#x expected %#x\n",
+        ok( prop_dword.dwData == EXPECT_VIDPID, "got %#lx expected %#lx\n",
             prop_dword.dwData, EXPECT_VIDPID );
     }
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
     ok( IsEqualGUID( &prop_guid_path.guidClass, &GUID_DEVCLASS_HIDCLASS ), "got guid %s\n",
         debugstr_guid( &prop_guid_path.guidClass ) );
     todo_wine
@@ -900,19 +900,19 @@ static void test_simple_joystick( DWORD version )
     }
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_INSTANCENAME returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_INSTANCENAME returned %#lx\n", hr );
     todo_wine
     ok( !wcscmp( prop_string.wsz, expect_devinst.tszInstanceName ), "got instance %s\n",
         debugstr_w(prop_string.wsz) );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_PRODUCTNAME returned %#lx\n", hr );
     todo_wine
     ok( !wcscmp( prop_string.wsz, expect_devinst.tszProductName ), "got product %s\n",
         debugstr_w(prop_string.wsz) );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_TYPENAME, &prop_string.diph );
     todo_wine_if( version >= 0x0800 )
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_TYPENAME returned %#x\n", hr );
+        "GetProperty DIPROP_TYPENAME returned %#lx\n", hr );
     if (hr == DI_OK)
     {
         todo_wine
@@ -920,7 +920,7 @@ static void test_simple_joystick( DWORD version )
     }
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_USERNAME, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_NOEFFECT),
-        "GetProperty DIPROP_USERNAME returned %#x\n", hr );
+        "GetProperty DIPROP_USERNAME returned %#lx\n", hr );
     if (hr == DI_NOEFFECT)
     {
         todo_wine
@@ -929,74 +929,74 @@ static void test_simple_joystick( DWORD version )
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_JOYSTICKID returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_JOYSTICKID returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == 0, "got %#x expected %#x\n", prop_dword.dwData, 0 );
+    ok( prop_dword.dwData == 0, "got %#lx expected 0\n", prop_dword.dwData );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
+    ok( prop_dword.dwData == DIPROPAXISMODE_ABS, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_ABS );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got %#x expected %#x\n", prop_dword.dwData, 0 );
+    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got %#lx expected %#x\n", prop_dword.dwData, 0 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#x\n", hr );
-    ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_FFGAIN returned %#lx\n", hr );
+    ok( prop_dword.dwData == 10000, "got %lu expected %u\n", prop_dword.dwData, 10000 );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetProperty DIPROP_CALIBRATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM),
-        "GetProperty DIPROP_KEYNAME returned %#x\n", hr );
+        "GetProperty DIPROP_KEYNAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
-    ok( prop_dword.dwData == 0, "got %u expected %u\n", prop_dword.dwData, 0 );
+    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0, "got %lu expected %u\n", prop_dword.dwData, 0 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#x\n", hr );
-    ok( prop_dword.dwData == 1, "got %u expected %u\n", prop_dword.dwData, 1 );
+    ok( hr == DI_OK, "GetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
+    ok( prop_dword.dwData == 1, "got %lu expected %u\n", prop_dword.dwData, 1 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
-    ok( prop_dword.dwData == 10000, "got %u expected %u\n", prop_dword.dwData, 10000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
+    ok( prop_dword.dwData == 10000, "got %lu expected %u\n", prop_dword.dwData, 10000 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
-    ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_COOKED, "got %u expected %u\n",
+    ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
+    ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_COOKED, "got %lu expected %u\n",
         prop_dword.dwData, DIPROPCALIBRATIONMODE_COOKED );
 
     prop_string.diph.dwHow = DIPH_BYUSAGE;
     prop_string.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_KEYNAME returned %#x\n", hr );
+        "GetProperty DIPROP_KEYNAME returned %#lx\n", hr );
     if (hr == DI_OK)
     {
         ok( !wcscmp( prop_string.wsz, expect_objects[4].tszName ), "got DIPROP_KEYNAME %s\n",
@@ -1005,11 +1005,11 @@ static void test_simple_joystick( DWORD version )
     prop_string.diph.dwObj = MAKELONG( 0x1, HID_USAGE_PAGE_BUTTON );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_KEYNAME, &prop_string.diph );
     todo_wine
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_KEYNAME returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_KEYNAME returned %#lx\n", hr );
     prop_string.diph.dwHow = DIPH_BYUSAGE;
     prop_string.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_KEYNAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_KEYNAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_KEYNAME returned %#lx\n", hr );
 
     prop_range.diph.dwHow = DIPH_BYUSAGE;
     prop_range.diph.dwObj = MAKELONG( 0, 0 );
@@ -1018,35 +1018,35 @@ static void test_simple_joystick( DWORD version )
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
     todo_wine_if( version < 0x0800 )
     ok( hr == (version < 0x0800 ? DI_OK : DIERR_NOTFOUND),
-        "GetProperty DIPROP_RANGE returned %#x\n", hr );
+        "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.diph.dwObj = MAKELONG( 0, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.diph.dwObj = MAKELONG( HID_USAGE_PAGE_GENERIC, HID_USAGE_GENERIC_X );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_range.lMin = 0xdeadbeef;
     prop_range.lMax = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#x\n", hr );
-    ok( prop_range.lMin == 0, "got %d expected %d\n", prop_range.lMin, 0 );
-    ok( prop_range.lMax == 65535, "got %d expected %d\n", prop_range.lMax, 65535 );
+    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
+    ok( prop_range.lMin == 0, "got %ld expected %d\n", prop_range.lMin, 0 );
+    ok( prop_range.lMax == 65535, "got %ld expected %d\n", prop_range.lMax, 65535 );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+        "GetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     if (hr == DI_OK)
     {
-        ok( prop_range.lMin == -25, "got %d expected %d\n", prop_range.lMin, -25 );
-        ok( prop_range.lMax == 56, "got %d expected %d\n", prop_range.lMax, 56 );
+        ok( prop_range.lMin == -25, "got %ld expected %d\n", prop_range.lMin, -25 );
+        ok( prop_range.lMax == 56, "got %ld expected %d\n", prop_range.lMax, 56 );
     }
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+        "GetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
     if (hr == DI_OK)
     {
-        ok( prop_range.lMin == -25, "got %d expected %d\n", prop_range.lMin, -25 );
-        ok( prop_range.lMax == 56, "got %d expected %d\n", prop_range.lMax, 56 );
+        ok( prop_range.lMin == -25, "got %ld expected %d\n", prop_range.lMin, -25 );
+        ok( prop_range.lMax == 56, "got %ld expected %d\n", prop_range.lMax, 56 );
     }
 
     prop_pointer.diph.dwHow = DIPH_BYUSAGE;
@@ -1054,225 +1054,225 @@ static void test_simple_joystick( DWORD version )
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
     todo_wine_if( version >= 0x0800 )
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_NOTINITIALIZED),
-        "GetProperty DIPROP_APPDATA returned %#x\n", hr );
+        "GetProperty DIPROP_APPDATA returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_EnumObjects( device, NULL, NULL, DIDFT_ALL );
-    ok( hr == DIERR_INVALIDPARAM, "EnumObjects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumObjects returned %#lx\n", hr );
     hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, 0x20 );
-    ok( hr == DIERR_INVALIDPARAM, "EnumObjects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumObjects returned %#lx\n", hr );
     res = 0;
     hr = IDirectInputDevice8_EnumObjects( device, check_object_count, &res, DIDFT_AXIS | DIDFT_PSHBUTTON );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
     todo_wine_if( version < 0x0700 )
-    ok( res == (version < 0x0700 ? 6 : 8), "got %u objects\n", res );
+    ok( res == (version < 0x0700 ? 6 : 8), "got %lu objects\n", res );
     hr = IDirectInputDevice8_EnumObjects( device, check_objects, &check_objects_params, DIDFT_ALL );
-    ok( hr == DI_OK, "EnumObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumObjects returned %#lx\n", hr );
     ok( check_objects_params.index >= check_objects_params.expect_count, "missing %u objects\n",
         check_objects_params.expect_count - check_objects_params.index );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, NULL, 0, DIPH_DEVICE );
-    ok( hr == E_POINTER, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == E_POINTER, "GetObjectInfo returned: %#lx\n", hr );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0, DIPH_DEVICE );
-    ok( hr == DIERR_INVALIDPARAM, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetObjectInfo returned: %#lx\n", hr );
     objinst.dwSize = sizeof(DIDEVICEOBJECTINSTANCEW);
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0, DIPH_DEVICE );
-    ok( hr == DIERR_INVALIDPARAM, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetObjectInfo returned: %#lx\n", hr );
 
     res = MAKELONG( HID_USAGE_GENERIC_Z, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
     todo_wine_if( version < 0x0800 )
-    ok( hr == (version < 0x0800 ? DI_OK : DIERR_NOTFOUND), "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == (version < 0x0800 ? DI_OK : DIERR_NOTFOUND), "GetObjectInfo returned: %#lx\n", hr );
     res = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYUSAGE );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
     if (version < 0x0700) expect_obj = expect_objects_5[0];
     else expect_obj = expect_objects[4];
-    check_member( objinst, expect_obj, "%u", dwSize );
+    check_member( objinst, expect_obj, "%lu", dwSize );
     check_member_guid( objinst, expect_obj, guidType );
     todo_wine_if( version < 0x0700 )
-    check_member( objinst, expect_obj, "%#x", dwOfs );
-    check_member( objinst, expect_obj, "%#x", dwType );
-    check_member( objinst, expect_obj, "%#x", dwFlags );
+    check_member( objinst, expect_obj, "%#lx", dwOfs );
+    check_member( objinst, expect_obj, "%#lx", dwType );
+    check_member( objinst, expect_obj, "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_obj, tszName );
-    check_member( objinst, expect_obj, "%u", dwFFMaxForce );
-    check_member( objinst, expect_obj, "%u", dwFFForceResolution );
+    check_member( objinst, expect_obj, "%lu", dwFFMaxForce );
+    check_member( objinst, expect_obj, "%lu", dwFFForceResolution );
     check_member( objinst, expect_obj, "%u", wCollectionNumber );
     check_member( objinst, expect_obj, "%u", wDesignatorIndex );
     check_member( objinst, expect_obj, "%#04x", wUsagePage );
     check_member( objinst, expect_obj, "%#04x", wUsage );
-    check_member( objinst, expect_obj, "%#04x", dwDimension );
+    check_member( objinst, expect_obj, "%#lx", dwDimension );
     check_member( objinst, expect_obj, "%#04x", wExponent );
     check_member( objinst, expect_obj, "%u", wReportId );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0x14, DIPH_BYOFFSET );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, 0, DIPH_BYOFFSET );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 3 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DIERR_NOTFOUND, "GetObjectInfo returned: %#lx\n", hr );
     res = DIDFT_PSHBUTTON | DIDFT_MAKEINSTANCE( 1 );
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, res, DIPH_BYID );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
     if (version < 0x0700) expect_obj = expect_objects_5[6];
     else expect_obj = expect_objects[8];
-    check_member( objinst, expect_obj, "%u", dwSize );
+    check_member( objinst, expect_obj, "%lu", dwSize );
     check_member_guid( objinst, expect_obj, guidType );
     todo_wine_if( version < 0x0700 )
-    check_member( objinst, expect_obj, "%#x", dwOfs );
-    check_member( objinst, expect_obj, "%#x", dwType );
-    check_member( objinst, expect_obj, "%#x", dwFlags );
+    check_member( objinst, expect_obj, "%#lx", dwOfs );
+    check_member( objinst, expect_obj, "%#lx", dwType );
+    check_member( objinst, expect_obj, "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_obj, tszName );
-    check_member( objinst, expect_obj, "%u", dwFFMaxForce );
-    check_member( objinst, expect_obj, "%u", dwFFForceResolution );
+    check_member( objinst, expect_obj, "%lu", dwFFMaxForce );
+    check_member( objinst, expect_obj, "%lu", dwFFForceResolution );
     check_member( objinst, expect_obj, "%u", wCollectionNumber );
     check_member( objinst, expect_obj, "%u", wDesignatorIndex );
     check_member( objinst, expect_obj, "%#04x", wUsagePage );
     check_member( objinst, expect_obj, "%#04x", wUsage );
-    check_member( objinst, expect_obj, "%#04x", dwDimension );
+    check_member( objinst, expect_obj, "%#lx", dwDimension );
     check_member( objinst, expect_obj, "%#04x", wExponent );
     check_member( objinst, expect_obj, "%u", wReportId );
 
     hr = IDirectInputDevice8_EnumEffects( device, NULL, NULL, DIEFT_ALL );
-    ok( hr == DIERR_INVALIDPARAM, "EnumEffects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumEffects returned %#lx\n", hr );
     res = 0;
     hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, 0xfe );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
     res = 0;
     hr = IDirectInputDevice8_EnumEffects( device, check_effect_count, &res, DIEFT_PERIODIC );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
     hr = IDirectInputDevice8_EnumEffects( device, check_effects, &check_effects_params, DIEFT_ALL );
-    ok( hr == DI_OK, "EnumEffects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumEffects returned %#lx\n", hr );
     ok( check_effects_params.index >= check_effects_params.expect_count, "missing %u effects\n",
         check_effects_params.expect_count - check_effects_params.index );
 
     hr = IDirectInputDevice8_GetEffectInfo( device, NULL, &GUID_Sine );
-    ok( hr == E_POINTER, "GetEffectInfo returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetEffectInfo returned %#lx\n", hr );
     effectinfo.dwSize = sizeof(DIEFFECTINFOW) + 1;
     hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine );
-    ok( hr == DIERR_INVALIDPARAM, "GetEffectInfo returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetEffectInfo returned %#lx\n", hr );
     effectinfo.dwSize = sizeof(DIEFFECTINFOW);
     hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_NULL );
-    ok( hr == DIERR_DEVICENOTREG, "GetEffectInfo returned %#x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "GetEffectInfo returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetEffectInfo( device, &effectinfo, &GUID_Sine );
-    ok( hr == DIERR_DEVICENOTREG, "GetEffectInfo returned %#x\n", hr );
+    ok( hr == DIERR_DEVICENOTREG, "GetEffectInfo returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_SetDataFormat( device, NULL );
-    ok( hr == E_POINTER, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == E_POINTER, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     dataformat.dwSize = sizeof(DIDATAFORMAT);
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     dataformat.dwObjSize = sizeof(DIOBJECTDATAFORMAT);
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetObjectInfo( device, &objinst, DIJOFS_Y, DIPH_BYOFFSET );
-    ok( hr == DI_OK, "GetObjectInfo returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetObjectInfo returned: %#lx\n", hr );
 
     if (version < 0x0700) expect_obj = expect_objects_5[1];
     else expect_obj = expect_objects[3];
     if (version < 0x0800) expect_obj.dwOfs = DIJOFS_Y;
-    check_member( objinst, expect_obj, "%u", dwSize );
+    check_member( objinst, expect_obj, "%lu", dwSize );
     check_member_guid( objinst, expect_obj, guidType );
     todo_wine_if( version < 0x0800 )
-    check_member( objinst, expect_obj, "%#x", dwOfs );
-    check_member( objinst, expect_obj, "%#x", dwType );
-    check_member( objinst, expect_obj, "%#x", dwFlags );
+    check_member( objinst, expect_obj, "%#lx", dwOfs );
+    check_member( objinst, expect_obj, "%#lx", dwType );
+    check_member( objinst, expect_obj, "%#lx", dwFlags );
     if (!localized) check_member_wstr( objinst, expect_obj, tszName );
-    check_member( objinst, expect_obj, "%u", dwFFMaxForce );
-    check_member( objinst, expect_obj, "%u", dwFFForceResolution );
+    check_member( objinst, expect_obj, "%lu", dwFFMaxForce );
+    check_member( objinst, expect_obj, "%lu", dwFFForceResolution );
     check_member( objinst, expect_obj, "%u", wCollectionNumber );
     check_member( objinst, expect_obj, "%u", wDesignatorIndex );
     check_member( objinst, expect_obj, "%#04x", wUsagePage );
     check_member( objinst, expect_obj, "%#04x", wUsage );
-    check_member( objinst, expect_obj, "%#04x", dwDimension );
+    check_member( objinst, expect_obj, "%#lx", dwDimension );
     check_member( objinst, expect_obj, "%#04x", wExponent );
     check_member( objinst, expect_obj, "%u", wReportId );
 
     hr = IDirectInputDevice8_SetEventNotification( device, (HANDLE)0xdeadbeef );
     todo_wine
-    ok( hr == E_HANDLE, "SetEventNotification returned: %#x\n", hr );
+    ok( hr == E_HANDLE, "SetEventNotification returned: %#lx\n", hr );
     event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( event != NULL, "CreateEventW failed, last error %u\n", GetLastError() );
+    ok( event != NULL, "CreateEventW failed, last error %lu\n", GetLastError() );
     hr = IDirectInputDevice8_SetEventNotification( device, event );
-    ok( hr == DI_OK, "SetEventNotification returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetEventNotification returned: %#lx\n", hr );
 
     file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                         FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND );
-    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE );
-    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
-    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
-    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned: %#lx\n", hr );
 
     hwnd = CreateWindowW( L"static", L"dinput", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200,
                           NULL, NULL, NULL, NULL );
     SetForegroundWindow( hwnd );
 
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND | DISCL_EXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_NOEFFECT, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_NOEFFECT, "Unacquire returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND | DISCL_EXCLUSIVE );
-    ok( hr == DIERR_ACQUIRED, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DIERR_ACQUIRED, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     DestroyWindow( hwnd );
 
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned: %#x\n", hr );
+    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Poll( device );
-    ok( hr == DIERR_NOTACQUIRED, "Poll returned: %#x\n", hr );
+    ok( hr == DIERR_NOTACQUIRED, "Poll returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_Poll( device );
     todo_wine_if( version < 0x0700 )
-    ok( hr == (version < 0x0700 ? DI_OK : DI_NOEFFECT), "Poll returned: %#x\n", hr );
+    ok( hr == (version < 0x0700 ? DI_OK : DI_NOEFFECT), "Poll returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2) + 1, &state );
-    ok( hr == DIERR_INVALIDPARAM, "GetDeviceState returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "GetDeviceState returned: %#lx\n", hr );
 
     for (i = 0; i < ARRAY_SIZE(injected_input); ++i)
     {
-        winetest_push_context( "state[%d]", i );
+        winetest_push_context( "state[%ld]", i );
         hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-        ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-        check_member( state, expect_state[i], "%d", lX );
-        check_member( state, expect_state[i], "%d", lY );
-        check_member( state, expect_state[i], "%d", lZ );
-        check_member( state, expect_state[i], "%d", lRx );
-        check_member( state, expect_state[i], "%#x", rgdwPOV[0] );
-        check_member( state, expect_state[i], "%#x", rgdwPOV[1] );
+        ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+        check_member( state, expect_state[i], "%ld", lX );
+        check_member( state, expect_state[i], "%ld", lY );
+        check_member( state, expect_state[i], "%ld", lZ );
+        check_member( state, expect_state[i], "%ld", lRx );
+        check_member( state, expect_state[i], "%#lx", rgdwPOV[0] );
+        check_member( state, expect_state[i], "%#lx", rgdwPOV[1] );
         check_member( state, expect_state[i], "%#x", rgbButtons[0] );
         check_member( state, expect_state[i], "%#x", rgbButtons[1] );
         check_member( state, expect_state[i], "%#x", rgbButtons[2] );
@@ -1287,14 +1287,14 @@ static void test_simple_joystick( DWORD version )
     }
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    winetest_push_context( "state[%d]", i );
-    check_member( state, expect_state[i], "%d", lX );
-    check_member( state, expect_state[i], "%d", lY );
-    check_member( state, expect_state[i], "%d", lZ );
-    check_member( state, expect_state[i], "%d", lRx );
-    check_member( state, expect_state[i], "%#x", rgdwPOV[0] );
-    check_member( state, expect_state[i], "%#x", rgdwPOV[1] );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    winetest_push_context( "state[%ld]", i );
+    check_member( state, expect_state[i], "%ld", lX );
+    check_member( state, expect_state[i], "%ld", lY );
+    check_member( state, expect_state[i], "%ld", lZ );
+    check_member( state, expect_state[i], "%ld", lRx );
+    check_member( state, expect_state[i], "%#lx", rgdwPOV[0] );
+    check_member( state, expect_state[i], "%#lx", rgdwPOV[1] );
     check_member( state, expect_state[i], "%#x", rgbButtons[0] );
     check_member( state, expect_state[i], "%#x", rgbButtons[1] );
     check_member( state, expect_state[i], "%#x", rgbButtons[2] );
@@ -1304,29 +1304,29 @@ static void test_simple_joystick( DWORD version )
     size = version < 0x0800 ? sizeof(DIDEVICEOBJECTDATA_DX3) : sizeof(DIDEVICEOBJECTDATA);
     hr = IDirectInputDevice8_GetDeviceData( device, size - 1, objdata, &res, DIGDD_PEEK );
     todo_wine_if( version >= 0x0800 )
-    ok( hr == (version < 0x0800 ? DI_OK : DIERR_INVALIDPARAM), "GetDeviceData returned %#x\n", hr );
+    ok( hr == (version < 0x0800 ? DI_OK : DIERR_INVALIDPARAM), "GetDeviceData returned %#lx\n", hr );
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, DIGDD_PEEK );
-    ok( hr == DIERR_NOTBUFFERED, "GetDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_NOTBUFFERED, "GetDeviceData returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = 1;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, DIGDD_PEEK );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
 
     send_hid_input( file, &injected_input[0], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
@@ -1336,23 +1336,23 @@ static void test_simple_joystick( DWORD version )
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, DIGDD_PEEK );
     todo_wine_if( version < 0x0800 )
-    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, 0 );
     todo_wine_if( version >= 0x0800 )
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( res == 0, "got %u expected %u\n", res, 0 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 0, "got %lu expected %u\n", res, 0 );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 10;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     send_hid_input( file, &injected_input[1], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
@@ -1361,21 +1361,21 @@ static void test_simple_joystick( DWORD version )
 
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, DIGDD_PEEK );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( res == 1, "got %u expected %u\n", res, 1 );
-    check_member( objdata[0], expect_objdata[0], "%#x", dwOfs );
-    check_member( objdata[0], expect_objdata[0], "%#x", dwData );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 1, "got %lu expected %u\n", res, 1 );
+    check_member( objdata[0], expect_objdata[0], "%#lx", dwOfs );
+    check_member( objdata[0], expect_objdata[0], "%#lx", dwData );
     if (version >= 0x0800) ok( objdata[0].uAppData == -1, "got %p\n", (void *)objdata[0].uAppData );
     res = 4;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, 0 );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( res == 4, "got %u expected %u\n", res, 4 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 4, "got %lu expected %u\n", res, 4 );
     for (i = 0; i < 4; ++i)
     {
         DIDEVICEOBJECTDATA *ptr = (DIDEVICEOBJECTDATA *)((char *)objdata + size * i);
-        winetest_push_context( "objdata[%d]", i );
-        check_member( *ptr, expect_objdata[1 + i], "%#x", dwOfs );
-        check_member( *ptr, expect_objdata[1 + i], "%#x", dwData );
+        winetest_push_context( "objdata[%ld]", i );
+        check_member( *ptr, expect_objdata[1 + i], "%#lx", dwOfs );
+        check_member( *ptr, expect_objdata[1 + i], "%#lx", dwData );
         if (version >= 0x0800) ok( ptr->uAppData == -1, "got %p\n", (void *)ptr->uAppData );
         winetest_pop_context();
     }
@@ -1392,25 +1392,25 @@ static void test_simple_joystick( DWORD version )
     res = 1;
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, 0 );
     todo_wine_if( version < 0x0800 )
-    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#x\n", hr );
-    ok( res == 1, "got %u expected %u\n", res, 1 );
+    ok( hr == DI_BUFFEROVERFLOW, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 1, "got %lu expected %u\n", res, 1 );
     todo_wine
-    check_member( objdata[0], expect_objdata[5], "%#x", dwOfs );
+    check_member( objdata[0], expect_objdata[5], "%#lx", dwOfs );
     todo_wine
-    check_member( objdata[0], expect_objdata[5], "%#x", dwData );
+    check_member( objdata[0], expect_objdata[5], "%#lx", dwData );
     if (version >= 0x0800) ok( objdata[0].uAppData == -1, "got %p\n", (void *)objdata[0].uAppData );
     res = ARRAY_SIZE(objdata);
     hr = IDirectInputDevice8_GetDeviceData( device, size, objdata, &res, 0 );
-    ok( hr == DI_OK, "GetDeviceData returned %#x\n", hr );
-    ok( res == 8, "got %u expected %u\n", res, 8 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( res == 8, "got %lu expected %u\n", res, 8 );
     for (i = 0; i < 8; ++i)
     {
         DIDEVICEOBJECTDATA *ptr = (DIDEVICEOBJECTDATA *)((char *)objdata + size * i);
-        winetest_push_context( "objdata[%d]", i );
+        winetest_push_context( "objdata[%ld]", i );
         todo_wine
-        check_member( *ptr, expect_objdata[6 + i], "%#x", dwOfs );
+        check_member( *ptr, expect_objdata[6 + i], "%#lx", dwOfs );
         todo_wine_if( i == 1 || i == 2 || i == 6 )
-        check_member( *ptr, expect_objdata[6 + i], "%#x", dwData );
+        check_member( *ptr, expect_objdata[6 + i], "%#lx", dwData );
         if (version >= 0x0800) ok( ptr->uAppData == -1, "got %p\n", (void *)ptr->uAppData );
         winetest_pop_context();
     }
@@ -1421,19 +1421,19 @@ static void test_simple_joystick( DWORD version )
     ResetEvent( event );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    check_member( state, expect_state[3], "%d", lX );
-    check_member( state, expect_state[3], "%d", lY );
-    check_member( state, expect_state[3], "%d", lZ );
-    check_member( state, expect_state[3], "%d", lRx );
-    check_member( state, expect_state[3], "%d", rgdwPOV[0] );
-    check_member( state, expect_state[3], "%d", rgdwPOV[1] );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    check_member( state, expect_state[3], "%ld", lX );
+    check_member( state, expect_state[3], "%ld", lY );
+    check_member( state, expect_state[3], "%ld", lZ );
+    check_member( state, expect_state[3], "%ld", lRx );
+    check_member( state, expect_state[3], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state[3], "%ld", rgdwPOV[1] );
     check_member( state, expect_state[3], "%#x", rgbButtons[0] );
     check_member( state, expect_state[3], "%#x", rgbButtons[1] );
     check_member( state, expect_state[3], "%#x", rgbButtons[2] );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     dataformat.dwSize = sizeof(DIDATAFORMAT);
     dataformat.dwObjSize = sizeof(DIOBJECTDATAFORMAT);
@@ -1442,7 +1442,7 @@ static void test_simple_joystick( DWORD version )
     dataformat.dwNumObjs = 0;
     dataformat.rgodf = objdataformat;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     dataformat.dwNumObjs = 1;
     dataformat.dwDataSize = 8;
@@ -1452,20 +1452,20 @@ static void test_simple_joystick( DWORD version )
     objdataformat[0].dwFlags = 0;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[0].dwOfs = 4;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     dataformat.dwDataSize = 10;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     dataformat.dwDataSize = 8;
     objdataformat[0].dwOfs = 2;
     objdataformat[0].dwType = DIDFT_OPTIONAL | 0xff | DIDFT_ANYINSTANCE;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
 
     dataformat.dwNumObjs = 2;
     dataformat.dwDataSize = 5;
@@ -1479,10 +1479,10 @@ static void test_simple_joystick( DWORD version )
     objdataformat[1].dwFlags = 0;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     dataformat.dwDataSize = 8;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     dataformat.dwNumObjs = 4;
     dataformat.dwDataSize = 12;
@@ -1503,36 +1503,36 @@ static void test_simple_joystick( DWORD version )
     objdataformat[3].dwType = 0xff | DIDFT_ANYINSTANCE;
     objdataformat[3].dwFlags = 0;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].dwType = DIDFT_AXIS | DIDFT_MAKEINSTANCE( 12 );
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].dwType = DIDFT_AXIS | DIDFT_MAKEINSTANCE( 0xff );
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
     ok( hr == (version < 0x0700 ? DI_OK : DIERR_INVALIDPARAM),
-        "SetDataFormat returned: %#x\n", hr );
+        "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].dwType = DIDFT_AXIS | DIDFT_MAKEINSTANCE( 1 );
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].pguid = &GUID_RzAxis;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].pguid = &GUID_Unknown;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].pguid = &GUID_YAxis;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     objdataformat[1].pguid = NULL;
     objdataformat[1].dwType = DIDFT_OPTIONAL | DIDFT_AXIS | DIDFT_MAKEINSTANCE( 0 );
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
 
     dataformat.dwNumObjs = 0;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     send_hid_input( file, &injected_input[4], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
@@ -1541,15 +1541,15 @@ static void test_simple_joystick( DWORD version )
     ResetEvent( event );
 
     hr = IDirectInputDevice8_GetDeviceState( device, dataformat.dwDataSize, buffer );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     dataformat.dwNumObjs = 4;
     hr = IDirectInputDevice8_SetDataFormat( device, &dataformat );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     send_hid_input( file, &injected_input[4], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
@@ -1562,17 +1562,17 @@ static void test_simple_joystick( DWORD version )
     ResetEvent( event );
 
     hr = IDirectInputDevice8_GetDeviceState( device, dataformat.dwDataSize, buffer );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    ok( ((ULONG *)buffer)[0] == 0x512b, "got %#x, expected %#x\n", ((ULONG *)buffer)[0], 0x512b );
-    ok( ((ULONG *)buffer)[1] == 0, "got %#x, expected %#x\n", ((ULONG *)buffer)[1], 0 );
-    ok( ((ULONG *)buffer)[2] == 0x7fff, "got %#x, expected %#x\n", ((ULONG *)buffer)[2], 0x7fff );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    ok( ((ULONG *)buffer)[0] == 0x512b, "got %#lx, expected %#x\n", ((ULONG *)buffer)[0], 0x512b );
+    ok( ((ULONG *)buffer)[1] == 0, "got %#lx, expected %#x\n", ((ULONG *)buffer)[1], 0 );
+    ok( ((ULONG *)buffer)[2] == 0x7fff, "got %#lx, expected %#x\n", ((ULONG *)buffer)[2], 0x7fff );
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     send_hid_input( file, &injected_input[4], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
@@ -1584,13 +1584,13 @@ static void test_simple_joystick( DWORD version )
     ResetEvent( event );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    check_member( state, expect_state[3], "%d", lX );
-    check_member( state, expect_state[3], "%d", lY );
-    check_member( state, expect_state[3], "%d", lZ );
-    check_member( state, expect_state[3], "%d", lRx );
-    check_member( state, expect_state[3], "%d", rgdwPOV[0] );
-    check_member( state, expect_state[3], "%d", rgdwPOV[1] );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    check_member( state, expect_state[3], "%ld", lX );
+    check_member( state, expect_state[3], "%ld", lY );
+    check_member( state, expect_state[3], "%ld", lZ );
+    check_member( state, expect_state[3], "%ld", lRx );
+    check_member( state, expect_state[3], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state[3], "%ld", rgdwPOV[1] );
     check_member( state, expect_state[3], "%#x", rgbButtons[0] );
     check_member( state, expect_state[3], "%#x", rgbButtons[1] );
     check_member( state, expect_state[3], "%#x", rgbButtons[2] );
@@ -1600,203 +1600,203 @@ static void test_simple_joystick( DWORD version )
     prop_range.lMin = 1000;
     prop_range.lMax = 51000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.diph.dwHow = DIPH_BYUSAGE;
     prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_range.lMin = -4000;
     prop_range.lMax = -14000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.lMin = -14000;
     prop_range.lMax = -4000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_RANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED),
-        "SetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+        "SetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED),
-        "SetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+        "SetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_LOGICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_LOGICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_LOGICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_PHYSICALRANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_PHYSICALRANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_PHYSICALRANGE returned %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     prop_range.diph.dwHow = DIPH_DEVICE;
     prop_range.diph.dwObj = 0;
     prop_range.lMin = 0xdeadbeef;
     prop_range.lMax = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
     prop_range.diph.dwHow = DIPH_BYUSAGE;
     prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_range.lMin = 0xdeadbeef;
     prop_range.lMax = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#x\n", hr );
-    ok( prop_range.lMin == -14000, "got %d expected %d\n", prop_range.lMin, -14000 );
-    ok( prop_range.lMax == -4000, "got %d expected %d\n", prop_range.lMax, -4000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
+    ok( prop_range.lMin == -14000, "got %ld expected %d\n", prop_range.lMin, -14000 );
+    ok( prop_range.lMax == -4000, "got %ld expected %d\n", prop_range.lMax, -4000 );
     prop_range.diph.dwHow = DIPH_BYUSAGE;
     prop_range.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_Y, HID_USAGE_PAGE_GENERIC );
     prop_range.lMin = 0xdeadbeef;
     prop_range.lMax = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_RANGE, &prop_range.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#x\n", hr );
-    ok( prop_range.lMin == 1000, "got %d expected %d\n", prop_range.lMin, 1000 );
-    ok( prop_range.lMax == 51000, "got %d expected %d\n", prop_range.lMax, 51000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_RANGE returned %#lx\n", hr );
+    ok( prop_range.lMin == 1000, "got %ld expected %d\n", prop_range.lMin, 1000 );
+    ok( prop_range.lMax == 51000, "got %ld expected %d\n", prop_range.lMax, 51000 );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    check_member( state, expect_state_abs[1], "%d", lX );
-    check_member( state, expect_state_abs[1], "%d", lY );
-    check_member( state, expect_state_abs[1], "%d", lZ );
-    check_member( state, expect_state_abs[1], "%d", lRx );
-    check_member( state, expect_state_abs[1], "%d", rgdwPOV[0] );
-    check_member( state, expect_state_abs[1], "%d", rgdwPOV[1] );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    check_member( state, expect_state_abs[1], "%ld", lX );
+    check_member( state, expect_state_abs[1], "%ld", lY );
+    check_member( state, expect_state_abs[1], "%ld", lZ );
+    check_member( state, expect_state_abs[1], "%ld", lRx );
+    check_member( state, expect_state_abs[1], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state_abs[1], "%ld", rgdwPOV[1] );
     check_member( state, expect_state_abs[1], "%#x", rgbButtons[0] );
     check_member( state, expect_state_abs[1], "%#x", rgbButtons[1] );
     check_member( state, expect_state_abs[1], "%#x", rgbButtons[2] );
 
     hr = IDirectInputDevice8_SetProperty( device, NULL, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, &GUID_NULL, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, NULL );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_INVALIDPARAM),
-        "SetProperty DIPROP_VIDPID returned %#x\n", hr );
+        "SetProperty DIPROP_VIDPID returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_VIDPID, &prop_dword.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY),
-        "SetProperty DIPROP_VIDPID returned %#x\n", hr );
+        "SetProperty DIPROP_VIDPID returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DIERR_READONLY, "SetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DIERR_READONLY, "SetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
 
     prop_string.diph.dwHow = DIPH_DEVICE;
     prop_string.diph.dwObj = 0;
     wcscpy( prop_string.wsz, L"instance name" );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_INSTANCENAME, &prop_string.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_INSTANCENAME returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_INSTANCENAME returned %#lx\n", hr );
 
     wcscpy( prop_string.wsz, L"product name" );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph );
     todo_wine
-    ok( hr == DI_OK, "SetProperty DIPROP_PRODUCTNAME returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_PRODUCTNAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_PRODUCTNAME, &prop_string.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_PRODUCTNAME returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_PRODUCTNAME returned %#lx\n", hr );
     todo_wine
     ok( !wcscmp( prop_string.wsz, expect_devinst.tszProductName ), "got product %s\n",
         debugstr_w(prop_string.wsz) );
 
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_TYPENAME, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY),
-        "SetProperty DIPROP_TYPENAME returned %#x\n", hr );
+        "SetProperty DIPROP_TYPENAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_USERNAME, &prop_string.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_READONLY),
-        "SetProperty DIPROP_USERNAME returned %#x\n", hr );
+        "SetProperty DIPROP_USERNAME returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFLOAD, &prop_dword.diph );
-    ok( hr == DIERR_READONLY, "SetProperty DIPROP_FFLOAD returned %#x\n", hr );
+    ok( hr == DIERR_READONLY, "SetProperty DIPROP_FFLOAD returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_GRANULARITY, &prop_dword.diph );
-    ok( hr == DIERR_READONLY, "SetProperty DIPROP_GRANULARITY returned %#x\n", hr );
+    ok( hr == DIERR_READONLY, "SetProperty DIPROP_GRANULARITY returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
     todo_wine
-    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_JOYSTICKID returned %#x\n", hr );
+    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_JOYSTICKID returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
-    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
+    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_ACQUIRED, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     prop_pointer.diph.dwHow = DIPH_BYUSAGE;
     prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
     todo_wine_if( version >= 0x0800 )
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DIERR_ACQUIRED),
-        "SetProperty DIPROP_APPDATA returned %#x\n", hr );
+        "SetProperty DIPROP_APPDATA returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 10001;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     prop_dword.dwData = 6000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_SATURATION returned %#lx\n", hr );
     prop_dword.dwData = DIPROPCALIBRATIONMODE_COOKED;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = 2000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_DEADZONE returned %#x\n", hr );
-    ok( prop_dword.dwData == 2000, "got %u expected %u\n", prop_dword.dwData, 2000 );
+    ok( hr == DI_OK, "SetProperty DIPROP_DEADZONE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 2000, "got %lu expected %u\n", prop_dword.dwData, 2000 );
     prop_dword.dwData = 7000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_SATURATION returned %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
-    ok( prop_dword.dwData == 2000, "got %u expected %u\n", prop_dword.dwData, 2000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 2000, "got %lu expected %u\n", prop_dword.dwData, 2000 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
-    ok( prop_dword.dwData == 7000, "got %u expected %u\n", prop_dword.dwData, 7000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
+    ok( prop_dword.dwData == 7000, "got %lu expected %u\n", prop_dword.dwData, 7000 );
 
     prop_dword.diph.dwHow = DIPH_BYUSAGE;
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_Y, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#x\n", hr );
-    ok( prop_dword.dwData == 1000, "got %u expected %u\n", prop_dword.dwData, 1000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_DEADZONE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 1000, "got %lu expected %u\n", prop_dword.dwData, 1000 );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#x\n", hr );
-    ok( prop_dword.dwData == 6000, "got %u expected %u\n", prop_dword.dwData, 6000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_SATURATION returned %#lx\n", hr );
+    ok( prop_dword.dwData == 6000, "got %lu expected %u\n", prop_dword.dwData, 6000 );
 
     for (i = 0; i < ARRAY_SIZE(injected_input); ++i)
     {
-        winetest_push_context( "state[%d]", i );
+        winetest_push_context( "state[%ld]", i );
         hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-        ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
+        ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
         if (broken( state.lX == -10750 )) win_skip( "Ignoring 32-bit rounding\n" );
         else
         {
-            check_member( state, expect_state_abs[i], "%d", lX );
-            check_member( state, expect_state_abs[i], "%d", lY );
+            check_member( state, expect_state_abs[i], "%ld", lX );
+            check_member( state, expect_state_abs[i], "%ld", lY );
         }
-        check_member( state, expect_state_abs[i], "%d", lZ );
-        check_member( state, expect_state_abs[i], "%d", lRx );
-        check_member( state, expect_state_abs[i], "%d", rgdwPOV[0] );
-        check_member( state, expect_state_abs[i], "%d", rgdwPOV[1] );
+        check_member( state, expect_state_abs[i], "%ld", lZ );
+        check_member( state, expect_state_abs[i], "%ld", lRx );
+        check_member( state, expect_state_abs[i], "%ld", rgdwPOV[0] );
+        check_member( state, expect_state_abs[i], "%ld", rgdwPOV[1] );
         check_member( state, expect_state_abs[i], "%#x", rgbButtons[0] );
         check_member( state, expect_state_abs[i], "%#x", rgbButtons[1] );
         check_member( state, expect_state_abs[i], "%#x", rgbButtons[2] );
@@ -1811,14 +1811,14 @@ static void test_simple_joystick( DWORD version )
     }
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    winetest_push_context( "state[%d]", i );
-    check_member( state, expect_state_abs[i], "%d", lX );
-    check_member( state, expect_state_abs[i], "%d", lY );
-    check_member( state, expect_state_abs[i], "%d", lZ );
-    check_member( state, expect_state_abs[i], "%d", lRx );
-    check_member( state, expect_state_abs[i], "%d", rgdwPOV[0] );
-    check_member( state, expect_state_abs[i], "%d", rgdwPOV[1] );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    winetest_push_context( "state[%ld]", i );
+    check_member( state, expect_state_abs[i], "%ld", lX );
+    check_member( state, expect_state_abs[i], "%ld", lY );
+    check_member( state, expect_state_abs[i], "%ld", lZ );
+    check_member( state, expect_state_abs[i], "%ld", lRx );
+    check_member( state, expect_state_abs[i], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state_abs[i], "%ld", rgdwPOV[1] );
     check_member( state, expect_state_abs[i], "%#x", rgbButtons[0] );
     check_member( state, expect_state_abs[i], "%#x", rgbButtons[1] );
     check_member( state, expect_state_abs[i], "%#x", rgbButtons[2] );
@@ -1828,120 +1828,120 @@ static void test_simple_joystick( DWORD version )
     prop_dword.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_dword.dwData = DIPROPCALIBRATIONMODE_RAW;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
-    ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_RAW, "got %u expected %u\n", prop_dword.dwData,
+    ok( hr == DI_OK, "GetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
+    ok( prop_dword.dwData == DIPROPCALIBRATIONMODE_RAW, "got %lu expected %u\n", prop_dword.dwData,
         DIPROPCALIBRATIONMODE_RAW );
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    winetest_push_context( "state[%d]", i );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    winetest_push_context( "state[%ld]", i );
     todo_wine_if( version >= 0x0700 )
-    ok( state.lX == (version < 0x0700 ? -9000 : 15), "got lX %d\n", state.lX );
-    check_member( state, expect_state_abs[0], "%d", lY );
-    check_member( state, expect_state_abs[0], "%d", lZ );
-    check_member( state, expect_state_abs[0], "%d", lRx );
-    check_member( state, expect_state_abs[0], "%d", rgdwPOV[0] );
-    check_member( state, expect_state_abs[0], "%d", rgdwPOV[1] );
+    ok( state.lX == (version < 0x0700 ? -9000 : 15), "got lX %ld\n", state.lX );
+    check_member( state, expect_state_abs[0], "%ld", lY );
+    check_member( state, expect_state_abs[0], "%ld", lZ );
+    check_member( state, expect_state_abs[0], "%ld", lRx );
+    check_member( state, expect_state_abs[0], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state_abs[0], "%ld", rgdwPOV[1] );
     winetest_pop_context();
 
     prop_dword.dwData = DIPROPCALIBRATIONMODE_COOKED;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATIONMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_CALIBRATIONMODE returned %#lx\n", hr );
 
     send_hid_input( file, &injected_input[ARRAY_SIZE(injected_input) - 1], sizeof(*injected_input) );
     res = WaitForSingleObject( event, 100 );
     ok( res == WAIT_OBJECT_0, "WaitForSingleObject failed\n" );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_JOYSTICKID, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_JOYSTICKID returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_JOYSTICKID returned %#lx\n", hr );
     prop_dword.dwData = 0x1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     prop_dword.dwData = DIPROPAUTOCENTER_ON;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AUTOCENTER, &prop_dword.diph );
-    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_AUTOCENTER returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SetProperty DIPROP_AUTOCENTER returned %#lx\n", hr );
     prop_pointer.diph.dwHow = DIPH_BYUSAGE;
     prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     prop_pointer.uData = 0xfeedcafe;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "SetProperty DIPROP_APPDATA returned %#x\n", hr );
+        "SetProperty DIPROP_APPDATA returned %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     prop_dword.dwData = DIPROPAXISMODE_REL;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_AXISMODE returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_AXISMODE, &prop_dword.diph );
     todo_wine
-    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_AXISMODE returned %#lx\n", hr );
     todo_wine
-    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %u expected %u\n", prop_dword.dwData, DIPROPAXISMODE_REL );
+    ok( prop_dword.dwData == DIPROPAXISMODE_REL, "got %lu expected %u\n", prop_dword.dwData, DIPROPAXISMODE_REL );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_BUFFERSIZE, &prop_dword.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#x\n", hr );
-    ok( prop_dword.dwData == 0x1000, "got %#x expected %#x\n", prop_dword.dwData, 0x1000 );
+    ok( hr == DI_OK, "GetProperty DIPROP_BUFFERSIZE returned %#lx\n", hr );
+    ok( prop_dword.dwData == 0x1000, "got %#lx expected %#x\n", prop_dword.dwData, 0x1000 );
 
     prop_pointer.diph.dwHow = DIPH_BYUSAGE;
     prop_pointer.diph.dwObj = MAKELONG( HID_USAGE_GENERIC_X, HID_USAGE_PAGE_GENERIC );
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_APPDATA, &prop_pointer.diph );
     todo_wine_if( version >= 0x0800 )
     ok( hr == (version < 0x0800 ? DIERR_UNSUPPORTED : DI_OK),
-        "GetProperty DIPROP_APPDATA returned %#x\n", hr );
+        "GetProperty DIPROP_APPDATA returned %#lx\n", hr );
     if (hr == DI_OK) ok( prop_pointer.uData == 0xfeedcafe, "got %p\n", (void *)prop_pointer.uData );
 
     prop_dword.diph.dwHow = DIPH_DEVICE;
     prop_dword.diph.dwObj = 0;
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
     prop_dword.dwData = 1000;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_FFGAIN, &prop_dword.diph );
-    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#x\n", hr );
+    ok( hr == DI_OK, "SetProperty DIPROP_FFGAIN returned %#lx\n", hr );
 
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_CALIBRATION, &prop_dword.diph );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_CALIBRATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_CALIBRATION returned %#lx\n", hr );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_DEADZONE, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_DEADZONE returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_DEADZONE returned %#lx\n", hr );
     prop_dword.dwData = 0xdeadbeef;
     hr = IDirectInputDevice8_SetProperty( device, DIPROP_SATURATION, &prop_dword.diph );
-    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_SATURATION returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SetProperty DIPROP_SATURATION returned %#lx\n", hr );
 
     for (i = 0; i < ARRAY_SIZE(injected_input); ++i)
     {
-        winetest_push_context( "state[%d]", i );
+        winetest_push_context( "state[%ld]", i );
         hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-        ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
+        ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
         todo_wine
-        check_member( state, expect_state_rel[i], "%d", lX );
+        check_member( state, expect_state_rel[i], "%ld", lX );
         todo_wine
-        check_member( state, expect_state_rel[i], "%d", lY );
+        check_member( state, expect_state_rel[i], "%ld", lY );
         todo_wine
-        check_member( state, expect_state_rel[i], "%d", lZ );
-        check_member( state, expect_state_rel[i], "%d", lRx );
-        check_member( state, expect_state_rel[i], "%d", rgdwPOV[0] );
-        check_member( state, expect_state_rel[i], "%d", rgdwPOV[1] );
+        check_member( state, expect_state_rel[i], "%ld", lZ );
+        check_member( state, expect_state_rel[i], "%ld", lRx );
+        check_member( state, expect_state_rel[i], "%ld", rgdwPOV[0] );
+        check_member( state, expect_state_rel[i], "%ld", rgdwPOV[1] );
         check_member( state, expect_state_rel[i], "%#x", rgbButtons[0] );
         check_member( state, expect_state_rel[i], "%#x", rgbButtons[1] );
         check_member( state, expect_state_rel[i], "%#x", rgbButtons[2] );
@@ -1956,80 +1956,80 @@ static void test_simple_joystick( DWORD version )
     }
 
     hr = IDirectInputDevice8_GetDeviceState( device, sizeof(DIJOYSTATE2), &state );
-    ok( hr == DI_OK, "GetDeviceState returned: %#x\n", hr );
-    winetest_push_context( "state[%d]", i );
+    ok( hr == DI_OK, "GetDeviceState returned: %#lx\n", hr );
+    winetest_push_context( "state[%ld]", i );
     todo_wine
-    check_member( state, expect_state_rel[i], "%d", lX );
+    check_member( state, expect_state_rel[i], "%ld", lX );
     todo_wine
-    check_member( state, expect_state_rel[i], "%d", lY );
+    check_member( state, expect_state_rel[i], "%ld", lY );
     todo_wine
-    check_member( state, expect_state_rel[i], "%d", lZ );
-    check_member( state, expect_state_rel[i], "%d", lRx );
-    check_member( state, expect_state_rel[i], "%d", rgdwPOV[0] );
-    check_member( state, expect_state_rel[i], "%d", rgdwPOV[1] );
+    check_member( state, expect_state_rel[i], "%ld", lZ );
+    check_member( state, expect_state_rel[i], "%ld", lRx );
+    check_member( state, expect_state_rel[i], "%ld", rgdwPOV[0] );
+    check_member( state, expect_state_rel[i], "%ld", rgdwPOV[1] );
     check_member( state, expect_state_rel[i], "%#x", rgbButtons[0] );
     check_member( state, expect_state_rel[i], "%#x", rgbButtons[1] );
     check_member( state, expect_state_rel[i], "%#x", rgbButtons[2] );
     winetest_pop_context();
 
     hr = IDirectInputDevice8_GetForceFeedbackState( device, NULL );
-    ok( hr == E_POINTER, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == E_POINTER, "GetForceFeedbackState returned %#lx\n", hr );
     res = 0xdeadbeef;
     hr = IDirectInputDevice8_GetForceFeedbackState( device, &res );
-    ok( hr == DIERR_UNSUPPORTED, "GetForceFeedbackState returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "GetForceFeedbackState returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, 0xdeadbeef );
-    ok( hr == DIERR_INVALIDPARAM, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SendForceFeedbackCommand returned %#lx\n", hr );
     hr = IDirectInputDevice8_SendForceFeedbackCommand( device, DISFFC_RESET );
-    ok( hr == DIERR_UNSUPPORTED, "SendForceFeedbackCommand returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "SendForceFeedbackCommand returned %#lx\n", hr );
 
     objdata[0].dwOfs = 0xd;
     objdata[0].dwData = 0x80;
     res = 1;
     hr = IDirectInputDevice8_SendDeviceData( device, size, objdata, &res, 0xdeadbeef );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#lx\n", hr );
     res = 1;
     hr = IDirectInputDevice8_SendDeviceData( device, size, objdata, &res, 1 /*DISDD_CONTINUE*/ );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#lx\n", hr );
     res = 1;
     hr = IDirectInputDevice8_SendDeviceData( device, size, objdata, &res, 0 );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "SendDeviceData returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, NULL, NULL );
-    ok( hr == E_POINTER, "CreateEffect returned %#x\n", hr );
+    ok( hr == E_POINTER, "CreateEffect returned %#lx\n", hr );
     hr = IDirectInputDevice8_CreateEffect( device, NULL, NULL, &effect, NULL );
-    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#lx\n", hr );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_NULL, NULL, &effect, NULL );
-    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#lx\n", hr );
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Unacquire( device );
-    ok( hr == DI_OK, "Unacquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Unacquire returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_CreateEffect( device, &GUID_Sine, NULL, &effect, NULL );
-    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "CreateEffect returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, NULL, effect, 0 );
-    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#lx\n", hr );
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, effect, 0xdeadbeef );
-    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "EnumCreatedEffectObjects returned %#lx\n", hr );
     hr = IDirectInputDevice8_EnumCreatedEffectObjects( device, check_no_created_effect_objects, (void *)0xdeadbeef, 0 );
-    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#x\n", hr );
+    ok( hr == DI_OK, "EnumCreatedEffectObjects returned %#lx\n", hr );
 
     hr = IDirectInputDevice8_Escape( device, NULL );
     todo_wine
-    ok( hr == E_POINTER, "Escape returned: %#x\n", hr );
+    ok( hr == E_POINTER, "Escape returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Escape( device, &escape );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "Escape returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Escape returned: %#lx\n", hr );
     escape.dwSize = sizeof(DIEFFESCAPE) + 1;
     hr = IDirectInputDevice8_Escape( device, &escape );
     todo_wine
-    ok( hr == DIERR_INVALIDPARAM, "Escape returned: %#x\n", hr );
+    ok( hr == DIERR_INVALIDPARAM, "Escape returned: %#lx\n", hr );
     escape.dwSize = sizeof(DIEFFESCAPE);
     escape.dwCommand = 0;
     escape.lpvInBuffer = buffer;
@@ -2038,10 +2038,10 @@ static void test_simple_joystick( DWORD version )
     escape.cbOutBuffer = 10;
     hr = IDirectInputDevice8_Escape( device, &escape );
     todo_wine
-    ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#x\n", hr );
+    ok( hr == DIERR_UNSUPPORTED, "Escape returned: %#lx\n", hr );
 
     ref = IDirectInputDevice8_Release( device );
-    ok( ref == 0, "Release returned %d\n", ref );
+    ok( ref == 0, "Release returned %ld\n", ref );
 
     CloseHandle( event );
     CloseHandle( file );
@@ -2527,11 +2527,11 @@ static BOOL test_device_types( DWORD version )
     ULONG i, ref;
     HRESULT hr;
 
-    winetest_push_context( "%#x", version );
+    winetest_push_context( "%#lx", version );
 
     for (i = 0; i < ARRAY_SIZE(device_desc) && success; ++i)
     {
-        winetest_push_context( "desc[%d]", i );
+        winetest_push_context( "desc[%ld]", i );
         GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
         GetTempPathW( ARRAY_SIZE(tempdir), tempdir );
         SetCurrentDirectoryW( tempdir );
@@ -2551,32 +2551,32 @@ static BOOL test_device_types( DWORD version )
         }
 
         hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
-        ok( hr == DI_OK, "GetDeviceInfo returned %#x\n", hr );
-        check_member( devinst, expect_devinst[i], "%d", dwSize );
+        ok( hr == DI_OK, "GetDeviceInfo returned %#lx\n", hr );
+        check_member( devinst, expect_devinst[i], "%lu", dwSize );
         check_member_guid( devinst, expect_devinst[i], guidProduct );
         todo_wine_if( version <= 0x700 && i == 3 )
-        check_member( devinst, expect_devinst[i], "%#x", dwDevType );
+        check_member( devinst, expect_devinst[i], "%#lx", dwDevType );
         check_member_guid( devinst, expect_devinst[i], guidFFDriver );
         check_member( devinst, expect_devinst[i], "%04x", wUsagePage );
         check_member( devinst, expect_devinst[i], "%04x", wUsage );
 
         hr = IDirectInputDevice8_GetCapabilities( device, &caps );
-        ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr );
-        check_member( caps, expect_caps[i], "%d", dwSize );
-        check_member( caps, expect_caps[i], "%#x", dwFlags );
+        ok( hr == DI_OK, "GetCapabilities returned %#lx\n", hr );
+        check_member( caps, expect_caps[i], "%lu", dwSize );
+        check_member( caps, expect_caps[i], "%#lx", dwFlags );
         todo_wine_if( version <= 0x700 && i == 3 )
-        check_member( caps, expect_caps[i], "%#x", dwDevType );
-        check_member( caps, expect_caps[i], "%d", dwAxes );
-        check_member( caps, expect_caps[i], "%d", dwButtons );
-        check_member( caps, expect_caps[i], "%d", dwPOVs );
-        check_member( caps, expect_caps[i], "%d", dwFFSamplePeriod );
-        check_member( caps, expect_caps[i], "%d", dwFFMinTimeResolution );
-        check_member( caps, expect_caps[i], "%d", dwFirmwareRevision );
-        check_member( caps, expect_caps[i], "%d", dwHardwareRevision );
-        check_member( caps, expect_caps[i], "%d", dwFFDriverVersion );
+        check_member( caps, expect_caps[i], "%#lx", dwDevType );
+        check_member( caps, expect_caps[i], "%lu", dwAxes );
+        check_member( caps, expect_caps[i], "%lu", dwButtons );
+        check_member( caps, expect_caps[i], "%lu", dwPOVs );
+        check_member( caps, expect_caps[i], "%lu", dwFFSamplePeriod );
+        check_member( caps, expect_caps[i], "%lu", dwFFMinTimeResolution );
+        check_member( caps, expect_caps[i], "%lu", dwFirmwareRevision );
+        check_member( caps, expect_caps[i], "%lu", dwHardwareRevision );
+        check_member( caps, expect_caps[i], "%lu", dwFFDriverVersion );
 
         ref = IDirectInputDevice8_Release( device );
-        ok( ref == 0, "Release returned %d\n", ref );
+        ok( ref == 0, "Release returned %ld\n", ref );
 
     done:
         pnp_driver_stop();
@@ -2840,19 +2840,19 @@ static BOOL test_winmm_joystick(void)
     infoex.dwFlags = JOY_RETURNALL;
     ret = joyGetPosEx( 0, &infoex );
     ok( ret == 0, "joyGetPosEx returned %u\n", ret );
-    check_member( infoex, expect_infoex[0], "%#x", dwSize );
-    check_member( infoex, expect_infoex[0], "%#x", dwFlags );
-    check_member( infoex, expect_infoex[0], "%#x", dwXpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwYpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwZpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwRpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwUpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwVpos );
-    check_member( infoex, expect_infoex[0], "%#x", dwButtons );
-    check_member( infoex, expect_infoex[0], "%#x", dwButtonNumber );
-    check_member( infoex, expect_infoex[0], "%#x", dwPOV );
-    check_member( infoex, expect_infoex[0], "%#x", dwReserved1 );
-    check_member( infoex, expect_infoex[0], "%#x", dwReserved2 );
+    check_member( infoex, expect_infoex[0], "%#lx", dwSize );
+    check_member( infoex, expect_infoex[0], "%#lx", dwFlags );
+    check_member( infoex, expect_infoex[0], "%#lx", dwXpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwYpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwZpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwRpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwUpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwVpos );
+    check_member( infoex, expect_infoex[0], "%#lx", dwButtons );
+    check_member( infoex, expect_infoex[0], "%#lx", dwButtonNumber );
+    check_member( infoex, expect_infoex[0], "%#lx", dwPOV );
+    check_member( infoex, expect_infoex[0], "%#lx", dwReserved1 );
+    check_member( infoex, expect_infoex[0], "%#lx", dwReserved2 );
 
     infoex.dwSize = sizeof(JOYINFOEX) - 4;
     ret = joyGetPosEx( 0, &infoex );
@@ -2873,23 +2873,23 @@ static BOOL test_winmm_joystick(void)
     if (FAILED(hr = dinput_test_create_device( DIRECTINPUT_VERSION, &devinst, &device ))) goto done;
 
     event = CreateEventW( NULL, FALSE, FALSE, NULL );
-    ok( event != NULL, "CreateEventW failed, last error %u\n", GetLastError() );
+    ok( event != NULL, "CreateEventW failed, last error %lu\n", GetLastError() );
     hr = IDirectInputDevice8_SetEventNotification( device, event );
-    ok( hr == DI_OK, "SetEventNotification returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetEventNotification returned: %#lx\n", hr );
 
     hr = IDirectInputDevice8_GetProperty( device, DIPROP_GUIDANDPATH, &prop_guid_path.diph );
-    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#x\n", hr );
+    ok( hr == DI_OK, "GetProperty DIPROP_GUIDANDPATH returned %#lx\n", hr );
     file = CreateFileW( prop_guid_path.wszPath, FILE_READ_ACCESS | FILE_WRITE_ACCESS,
                         FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
                         FILE_FLAG_OVERLAPPED | FILE_FLAG_NO_BUFFERING, NULL );
-    ok( file != INVALID_HANDLE_VALUE, "got error %u\n", GetLastError() );
+    ok( file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError() );
 
     hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIJoystick2 );
-    ok( hr == DI_OK, "SetDataFormat returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetDataFormat returned: %#lx\n", hr );
     hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE );
-    ok( hr == DI_OK, "SetCooperativeLevel returned: %#x\n", hr );
+    ok( hr == DI_OK, "SetCooperativeLevel returned: %#lx\n", hr );
     hr = IDirectInputDevice8_Acquire( device );
-    ok( hr == DI_OK, "Acquire returned: %#x\n", hr );
+    ok( hr == DI_OK, "Acquire returned: %#lx\n", hr );
 
     send_hid_input( file, &injected_input[0], sizeof(struct hid_expect) );
     ret = WaitForSingleObject( event, 100 );
@@ -2901,17 +2901,17 @@ static BOOL test_winmm_joystick(void)
     infoex.dwFlags = JOY_RETURNALL;
     ret = joyGetPosEx( 0, &infoex );
     ok( ret == 0, "joyGetPosEx returned %u\n", ret );
-    check_member( infoex, expect_infoex[1], "%#x", dwSize );
-    check_member( infoex, expect_infoex[1], "%#x", dwFlags );
-    check_member( infoex, expect_infoex[1], "%#x", dwXpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwYpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwZpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwRpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwUpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwVpos );
-    check_member( infoex, expect_infoex[1], "%#x", dwButtons );
-    check_member( infoex, expect_infoex[1], "%#x", dwButtonNumber );
-    check_member( infoex, expect_infoex[1], "%#x", dwPOV );
+    check_member( infoex, expect_infoex[1], "%#lx", dwSize );
+    check_member( infoex, expect_infoex[1], "%#lx", dwFlags );
+    check_member( infoex, expect_infoex[1], "%#lx", dwXpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwYpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwZpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwRpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwUpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwVpos );
+    check_member( infoex, expect_infoex[1], "%#lx", dwButtons );
+    check_member( infoex, expect_infoex[1], "%#lx", dwButtonNumber );
+    check_member( infoex, expect_infoex[1], "%#lx", dwPOV );
 
     send_hid_input( file, &injected_input[1], sizeof(struct hid_expect) );
     ret = WaitForSingleObject( event, 100 );
@@ -2923,17 +2923,17 @@ static BOOL test_winmm_joystick(void)
     infoex.dwFlags = JOY_RETURNALL;
     ret = joyGetPosEx( 0, &infoex );
     ok( ret == 0, "joyGetPosEx returned %u\n", ret );
-    check_member( infoex, expect_infoex[2], "%#x", dwSize );
-    check_member( infoex, expect_infoex[2], "%#x", dwFlags );
-    check_member( infoex, expect_infoex[2], "%#x", dwXpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwYpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwZpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwRpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwUpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwVpos );
-    check_member( infoex, expect_infoex[2], "%#x", dwButtons );
-    check_member( infoex, expect_infoex[2], "%#x", dwButtonNumber );
-    check_member( infoex, expect_infoex[2], "%#x", dwPOV );
+    check_member( infoex, expect_infoex[2], "%#lx", dwSize );
+    check_member( infoex, expect_infoex[2], "%#lx", dwFlags );
+    check_member( infoex, expect_infoex[2], "%#lx", dwXpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwYpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwZpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwRpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwUpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwVpos );
+    check_member( infoex, expect_infoex[2], "%#lx", dwButtons );
+    check_member( infoex, expect_infoex[2], "%#lx", dwButtonNumber );
+    check_member( infoex, expect_infoex[2], "%#lx", dwPOV );
 
     ret = IDirectInputDevice8_Release( device );
     ok( ret == 0, "Release returned %d\n", ret );
diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index 1cd31e03187..de71eed07ef 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -49,7 +49,7 @@ static HKL activate_keyboard_layout(LANGID langid, HKL *hkl_orig)
     HKL hkl, hkl_current;
     char hkl_name[64];
 
-    sprintf(hkl_name, "%08x", langid);
+    sprintf(hkl_name, "%#lx", langid);
     trace("Loading keyboard layout %s\n", hkl_name);
     hkl = LoadKeyboardLayoutA(hkl_name, 0);
     if (!hkl)
@@ -70,7 +70,7 @@ static HKL activate_keyboard_layout(LANGID langid, HKL *hkl_orig)
          * setxkbmap fr && LANG=fr_FR.UTF-8 make test
          * setxkbmap de && LANG=de_DE.UTF-8 make test
          */
-        skip("current %08x != langid %08x\n", LOWORD(hkl_current), langid);
+        skip("current %#x != langid %#x\n", LOWORD(hkl_current), langid);
         return 0;
     }
 
@@ -106,42 +106,42 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
     df.rgodf = dodf;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInputDevice_SetDataFormat(pKeyboard, &c_dfDIKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
     hr = IDirectInputDevice_SetCooperativeLevel(pKeyboard, NULL, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetCooperativeLevel() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetCooperativeLevel() failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, 10, kbd_state);
-    ok(hr == DIERR_NOTACQUIRED, "IDirectInputDevice_GetDeviceState(10,) should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTACQUIRED, "IDirectInputDevice_GetDeviceState(10,) should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
-    ok(hr == DIERR_NOTACQUIRED, "IDirectInputDevice_GetDeviceState() should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTACQUIRED, "IDirectInputDevice_GetDeviceState() should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_Unacquire(pKeyboard);
-    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have failed: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pKeyboard);
-    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, 10, kbd_state);
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(10,) should have failed: %08x\n", hr);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(10,) should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Unacquire(pKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Uncquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Uncquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_SetDataFormat( pKeyboard , &df );
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %#lx\n", hr);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state);
-    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %08x\n", hr);
+    ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %#lx\n", hr);
 
     memset(custom_state, 0x56, sizeof(custom_state));
     IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
     for (i = 0; i < ARRAY_SIZE(custom_state); i++)
-        ok(custom_state[i] == 0, "Should be zeroed, got 0x%08x\n", custom_state[i]);
+        ok(custom_state[i] == 0, "Should be zeroed, got 0x%#lx\n", custom_state[i]);
 
     /* simulate some keyboard input */
     SetFocus(hwnd);
@@ -149,20 +149,20 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
 
     keybd_event('Q', 0, 0, 0);
     hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %#lx\n", hr);
     if (!custom_state[0])
         win_skip("Keyboard event not processed, skipping test\n");
     else
     {
         /* unacquiring should reset the device state */
         hr = IDirectInputDevice_Unacquire(pKeyboard);
-        ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
         hr = IDirectInputDevice_Acquire(pKeyboard);
-        ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
         hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
-        ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState failed: %08x\n", hr);
+        ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState failed: %#lx\n", hr);
         for (i = 0; i < ARRAY_SIZE(custom_state); i++)
-            ok(custom_state[i] == 0, "Should be zeroed, got 0x%08x\n", custom_state[i]);
+            ok(custom_state[i] == 0, "Should be zeroed, got 0x%#lx\n", custom_state[i]);
     }
     keybd_event('Q', 0, KEYEVENTF_KEYUP, 0);
 
@@ -172,7 +172,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
        "Unexpected raw devices registered: %d\n", prev_raw_devices_count);
 
     hr = IDirectInputDevice_Acquire(pKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
 
     raw_devices_count = 0;
     GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
@@ -180,7 +180,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
        "Unexpected raw devices registered: %d\n", raw_devices_count);
 
     hr = IDirectInputDevice_Unacquire(pKeyboard);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Unacquire() failed: %#lx\n", hr);
 
     IUnknown_Release(pKeyboard);
 
@@ -220,33 +220,33 @@ static void test_set_coop(IDirectInputA *pDI, HWND hwnd)
     HWND child;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pKeyboard, NULL, i);
-        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %#lx\n", i, hr);
     }
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pKeyboard, (HWND)0x400000, i);
-        ok(hr == SetCoop_invalid_window[i], "SetCooperativeLevel(invalid, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_invalid_window[i], "SetCooperativeLevel(invalid, %d): %#lx\n", i, hr);
     }
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pKeyboard, hwnd, i);
-        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %#lx\n", i, hr);
     }
 
     child = CreateWindowA("static", "Title", WS_CHILD | WS_VISIBLE, 10, 10, 50, 50, hwnd, NULL,
                           NULL, NULL);
-    ok(child != NULL, "err: %d\n", GetLastError());
+    ok(child != NULL, "err: %lu\n", GetLastError());
 
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pKeyboard, child, i);
-        ok(hr == SetCoop_child_window[i], "SetCooperativeLevel(child, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_child_window[i], "SetCooperativeLevel(child, %d): %#lx\n", i, hr);
     }
 
     DestroyWindow(child);
@@ -261,7 +261,7 @@ static void test_get_prop(IDirectInputA *pDI, HWND hwnd)
     DIPROPDWORD vidpid;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     memset(&diprg, 0, sizeof(diprg));
@@ -271,7 +271,7 @@ static void test_get_prop(IDirectInputA *pDI, HWND hwnd)
     diprg.diph.dwObj        = 0;
 
     hr = IDirectInputDevice_GetProperty(pKeyboard, DIPROP_RANGE, &diprg.diph);
-    ok(hr == DIERR_UNSUPPORTED, "IDirectInputDevice_GetProperty() did not return DIPROP_RANGE but: %08x\n", hr);
+    ok(hr == DIERR_UNSUPPORTED, "IDirectInputDevice_GetProperty() did not return DIPROP_RANGE but: %#lx\n", hr);
 
     memset(&vidpid, 0, sizeof(vidpid));
     vidpid.diph.dwSize       = sizeof(DIPROPDWORD);
@@ -280,7 +280,7 @@ static void test_get_prop(IDirectInputA *pDI, HWND hwnd)
     vidpid.diph.dwObj        = 0;
 
     hr = IDirectInputDevice_GetProperty(pKeyboard, DIPROP_VIDPID, &vidpid.diph);
-    ok(hr == DIERR_UNSUPPORTED, "got %08x\n", hr);
+    ok(hr == DIERR_UNSUPPORTED, "got %#lx\n", hr);
 
     IUnknown_Release(pKeyboard);
 }
@@ -293,30 +293,30 @@ static void test_capabilities(IDirectInputA *pDI, HWND hwnd)
     int kbd_type, kbd_subtype, dev_subtype;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     caps.dwSize = sizeof(caps);
     hr = IDirectInputDevice_GetCapabilities(pKeyboard, &caps);
 
-    ok (SUCCEEDED(hr), "GetCapabilities failed: 0x%08x\n", hr);
-    ok (caps.dwFlags & DIDC_ATTACHED, "GetCapabilities dwFlags: 0x%08x\n", caps.dwFlags);
+    ok (SUCCEEDED(hr), "GetCapabilities failed: 0x%#lx\n", hr);
+    ok (caps.dwFlags & DIDC_ATTACHED, "GetCapabilities dwFlags: 0x%#lx\n", caps.dwFlags);
     ok (GET_DIDEVICE_TYPE(caps.dwDevType) == DIDEVTYPE_KEYBOARD,
-        "GetCapabilities invalid device type for dwDevType: 0x%08x\n", caps.dwDevType);
+        "GetCapabilities invalid device type for dwDevType: 0x%#lx\n", caps.dwDevType);
     kbd_type = GetKeyboardType(0);
     kbd_subtype = GetKeyboardType(1);
     dev_subtype = GET_DIDEVICE_SUBTYPE(caps.dwDevType);
     if (kbd_type == 4 || (kbd_type == 7 && kbd_subtype == 0))
         ok (dev_subtype == DIDEVTYPEKEYBOARD_PCENH,
-            "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
+            "GetCapabilities invalid device subtype for dwDevType: 0x%#lx (%04x:%04x)\n",
             caps.dwDevType, kbd_type, kbd_subtype);
     else if (kbd_type == 7 && kbd_subtype == 2)
         ok (dev_subtype == DIDEVTYPEKEYBOARD_JAPAN106,
-            "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
+            "GetCapabilities invalid device subtype for dwDevType: 0x%#lx (%04x:%04x)\n",
             caps.dwDevType, kbd_type, kbd_subtype);
     else
         ok (dev_subtype != DIDEVTYPEKEYBOARD_UNKNOWN,
-            "GetCapabilities invalid device subtype for dwDevType: 0x%08x (%04x:%04x)\n",
+            "GetCapabilities invalid device subtype for dwDevType: 0x%#lx (%04x:%04x)\n",
             caps.dwDevType, kbd_type, kbd_subtype);
 
     IUnknown_Release(pKeyboard);
@@ -383,14 +383,14 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
     if (!map) return;
 
     hr = IDirectInput_CreateDevice(dI, &GUID_SysKeyboard, &device, NULL);
-    ok(hr == S_OK, "CreateDevice() failed: %08x\n", hr);
+    ok(hr == S_OK, "CreateDevice() failed: %#lx\n", hr);
     hr = IDirectInputDevice_SetDataFormat(device, &c_dfDIKeyboard);
-    ok(hr == S_OK, "SetDataFormat() failed: %08x\n", hr);
+    ok(hr == S_OK, "SetDataFormat() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(device);
-    ok(hr == S_OK, "Acquire() failed: %08x\n", hr);
+    ok(hr == S_OK, "Acquire() failed: %#lx\n", hr);
     caps.dwSize = sizeof( caps );
     hr = IDirectInputDevice_GetCapabilities(device, &caps);
-    ok(hr == S_OK, "GetDeviceInstance() failed: %08x\n", hr);
+    ok(hr == S_OK, "GetDeviceInstance() failed: %#lx\n", hr);
     if (expected[i].type != GET_DIDEVICE_SUBTYPE(caps.dwDevType)) {
         skip("Keyboard type(%u) doesn't match for lang %04x\n",
              GET_DIDEVICE_SUBTYPE(caps.dwDevType), langid);
@@ -447,14 +447,14 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
         DispatchMessageA(&msg);
 
         n = MapVirtualKeyExA(msg.wParam, MAPVK_VK_TO_CHAR, hkl);
-        trace("keydown wParam: %#08lx (%c) lParam: %#08lx, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n",
+        trace("keydown wParam: %#Ix (%c) lParam: %#Ix, MapVirtualKey(MAPVK_VK_TO_CHAR) = %c\n",
               msg.wParam, isprint(LOWORD(msg.wParam)) ? LOWORD(msg.wParam) : '?',
               msg.lParam, isprint(n) ? n : '?');
 
         pump_messages();
 
         hr = IDirectInputDevice_GetDeviceState(device, sizeof(kbd_state), kbd_state);
-        ok(hr == S_OK, "GetDeviceState() failed: %08x\n", hr);
+        ok(hr == S_OK, "GetDeviceState() failed: %#lx\n", hr);
 
         /* this never happens on real hardware but tesbot VMs seem to have timing issues */
         if (i == 0 && kbd_state[map[0].dik] != 0x80)
@@ -488,23 +488,23 @@ static void test_GetDeviceInfo(IDirectInputA *pDI)
     DIDEVICEINSTANCE_DX3A inst3A;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKey, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     instA.dwSize = sizeof(instA);
     hr = IDirectInputDevice_GetDeviceInfo(pKey, &instA);
-    ok(SUCCEEDED(hr), "got %08x\n", hr);
+    ok(SUCCEEDED(hr), "got %#lx\n", hr);
 
     inst3A.dwSize = sizeof(inst3A);
     hr = IDirectInputDevice_GetDeviceInfo(pKey, (DIDEVICEINSTANCEA *)&inst3A);
-    ok(SUCCEEDED(hr), "got %08x\n", hr);
+    ok(SUCCEEDED(hr), "got %#lx\n", hr);
 
-    ok(instA.dwSize != inst3A.dwSize, "got %d, %d \n", instA.dwSize, inst3A.dwSize);
+    ok(instA.dwSize != inst3A.dwSize, "got %ld, %ld \n", instA.dwSize, inst3A.dwSize);
     ok(IsEqualGUID(&instA.guidInstance, &inst3A.guidInstance), "got %s, %s\n",
             wine_dbgstr_guid(&instA.guidInstance), wine_dbgstr_guid(&inst3A.guidInstance) );
     ok(IsEqualGUID(&instA.guidProduct, &inst3A.guidProduct), "got %s, %s\n",
             wine_dbgstr_guid(&instA.guidProduct), wine_dbgstr_guid(&inst3A.guidProduct) );
-    ok(instA.dwDevType == inst3A.dwDevType, "got %d, %d\n", instA.dwDevType, inst3A.dwDevType);
+    ok(instA.dwDevType == inst3A.dwDevType, "got %ld, %ld\n", instA.dwDevType, inst3A.dwDevType);
 
     IUnknown_Release(pKey);
 }
@@ -523,12 +523,12 @@ static void keyboard_tests(DWORD version)
         skip("Tests require a newer dinput version\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200,
                          NULL, NULL, NULL, NULL);
-    ok(hwnd != NULL, "err: %d\n", GetLastError());
+    ok(hwnd != NULL, "err: %lu\n", GetLastError());
     SetForegroundWindow( hwnd );
 
     if (hwnd)
@@ -549,7 +549,7 @@ static void keyboard_tests(DWORD version)
 
     DestroyWindow(hwnd);
     if (pDI) ref = IUnknown_Release(pDI);
-    ok(!ref, "IDirectInput_Release() reference count = %d\n", ref);
+    ok(!ref, "IDirectInput_Release() reference count = %ld\n", ref);
 }
 
 START_TEST(keyboard)
diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c
index 69051bb2a34..dc11f4d8ae9 100644
--- a/dlls/dinput/tests/mouse.c
+++ b/dlls/dinput/tests/mouse.c
@@ -71,28 +71,28 @@ static void test_set_coop(IDirectInputA *pDI, HWND hwnd)
     HWND child;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pMouse, NULL, i);
-        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %#lx\n", i, hr);
     }
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pMouse, hwnd, i);
-        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %#lx\n", i, hr);
     }
 
     child = CreateWindowA("static", "Title", WS_CHILD | WS_VISIBLE, 10, 10, 50, 50, hwnd, NULL,
                           NULL, NULL);
-    ok(child != NULL, "err: %d\n", GetLastError());
+    ok(child != NULL, "err: %lu\n", GetLastError());
 
     for (i=0; i<16; i++)
     {
         hr = IDirectInputDevice_SetCooperativeLevel(pMouse, child, i);
-        ok(hr == SetCoop_child_window[i], "SetCooperativeLevel(child, %d): %08x\n", i, hr);
+        ok(hr == SetCoop_child_window[i], "SetCooperativeLevel(child, %d): %#lx\n", i, hr);
     }
 
     DestroyWindow(child);
@@ -117,11 +117,11 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
     }
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInputDevice_SetCooperativeLevel(pMouse, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
-    ok(hr == S_OK, "SetCooperativeLevel: %08x\n", hr);
+    ok(hr == S_OK, "SetCooperativeLevel: %#lx\n", hr);
 
     memset(&di_op, 0, sizeof(di_op));
     di_op.dwData = 5;
@@ -129,58 +129,58 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
     di_op.diph.dwSize = sizeof(DIPROPDWORD);
     di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
     hr = IDirectInputDevice_SetProperty(pMouse, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&di_op);
-    ok(hr == S_OK, "SetProperty() failed: %08x\n", hr);
+    ok(hr == S_OK, "SetProperty() failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_SetDataFormat(pMouse, &c_dfDIMouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have failed: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %08x\n", hr);
+    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %#lx\n", hr);
 
     /* Foreground coop level requires window to have focus */
     /* Create a temporary window, this should make dinput
      * lose mouse input */
     hwnd2 = CreateWindowA("static", "Temporary", WS_VISIBLE, 10, 210, 200, 200, NULL, NULL, NULL,
                           NULL);
-    ok(hwnd2 != NULL, "CreateWindowA failed with %u\n", GetLastError());
+    ok(hwnd2 != NULL, "CreateWindowA failed with %lu\n", GetLastError());
     flush_events();
 
     hr = IDirectInputDevice_GetDeviceState(pMouse, sizeof(m_state), &m_state);
-    ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %08x\n", hr);
+    ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == DIERR_OTHERAPPHASPRIO, "Acquire() should have failed: %08x\n", hr);
+    ok(hr == DIERR_OTHERAPPHASPRIO, "Acquire() should have failed: %#lx\n", hr);
 
     SetActiveWindow( hwnd );
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Acquire() failed: %08x\n", hr);
+    ok(hr == S_OK, "Acquire() failed: %#lx\n", hr);
 
     mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
+    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
 
     mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
     hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_OK, "Failed: %08x\n", hr);
+    ok(hr == S_OK, "Failed: %#lx\n", hr);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
+    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
 
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Failed: %08x\n", hr);
+    ok(hr == S_OK, "Failed: %#lx\n", hr);
     mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
     hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_OK, "Failed: %08x\n", hr);
+    ok(hr == S_OK, "Failed: %#lx\n", hr);
 
     hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Failed: %08x\n", hr);
+    ok(hr == S_OK, "Failed: %#lx\n", hr);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
+    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
 
     /* Check for buffer overflow */
     for (i = 0; i < 6; i++)
@@ -188,10 +188,10 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
 
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
+    ok(hr == DI_OK, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
     cnt = 1;
     hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == DI_OK && cnt == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt);
+    ok(hr == DI_OK && cnt == 1, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
 
     /* Check for granularity property using BYOFFSET */
     memset(&di_op, 0, sizeof(di_op));
@@ -201,7 +201,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
     di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
     hr = IDirectInputDevice_GetProperty(pMouse, DIPROP_GRANULARITY, &di_op.diph);
     /* Granularity of Y axis should be 1! */
-    ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %08x, dwData: %i but should be 1.\n", hr, di_op.dwData);
+    ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %#lx, dwData: %lu but should be 1.\n", hr, di_op.dwData);
 
     /* Check for granularity property using BYID */
     memset(&di_op, 0, sizeof(di_op));
@@ -212,7 +212,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
     di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
     hr = IDirectInputDevice_GetProperty(pMouse, DIPROP_GRANULARITY, &di_op.diph);
     /* Granularity of Y axis should be 1! */
-    ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %08x, dwData: %i but should be 1.\n", hr, di_op.dwData);
+    ok(hr == S_OK && di_op.dwData == 1, "GetProperty(): %#lx, dwData: %lu but should be 1.\n", hr, di_op.dwData);
 
     memset(&di_op, 0, sizeof(di_op));
     di_op.diph.dwSize       = sizeof(DIPROPDWORD);
@@ -220,7 +220,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd)
     di_op.diph.dwHow        = DIPH_DEVICE;
     di_op.diph.dwObj        = 0;
     hr = IDirectInputDevice_GetProperty(pMouse, DIPROP_VIDPID, &di_op.diph);
-    ok(hr == DIERR_UNSUPPORTED, "got %08x\n", hr);
+    ok(hr == DIERR_UNSUPPORTED, "got %#lx\n", hr);
 
     IUnknown_Release(pMouse);
 
@@ -235,23 +235,23 @@ static void test_GetDeviceInfo(IDirectInputA *pDI)
     DIDEVICEINSTANCE_DX3A inst3A;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     instA.dwSize = sizeof(instA);
     hr = IDirectInputDevice_GetDeviceInfo(pMouse, &instA);
-    ok(SUCCEEDED(hr), "got %08x\n", hr);
+    ok(SUCCEEDED(hr), "got %#lx\n", hr);
 
     inst3A.dwSize = sizeof(inst3A);
     hr = IDirectInputDevice_GetDeviceInfo(pMouse, (DIDEVICEINSTANCEA *)&inst3A);
-    ok(SUCCEEDED(hr), "got %08x\n", hr);
+    ok(SUCCEEDED(hr), "got %#lx\n", hr);
 
-    ok(instA.dwSize != inst3A.dwSize, "got %d, %d \n", instA.dwSize, inst3A.dwSize);
+    ok(instA.dwSize != inst3A.dwSize, "got %lu, %lu \n", instA.dwSize, inst3A.dwSize);
     ok(IsEqualGUID(&instA.guidInstance, &inst3A.guidInstance), "got %s, %s\n",
             wine_dbgstr_guid(&instA.guidInstance), wine_dbgstr_guid(&inst3A.guidInstance) );
     ok(IsEqualGUID(&instA.guidProduct, &inst3A.guidProduct), "got %s, %s\n",
             wine_dbgstr_guid(&instA.guidProduct), wine_dbgstr_guid(&inst3A.guidProduct) );
-    ok(instA.dwDevType == inst3A.dwDevType, "got %d, %d\n", instA.dwDevType, inst3A.dwDevType);
+    ok(instA.dwDevType == inst3A.dwDevType, "got %lu, %lu\n", instA.dwDevType, inst3A.dwDevType);
 
     IUnknown_Release(pMouse);
 }
@@ -262,11 +262,11 @@ static BOOL CALLBACK EnumAxes(const DIDEVICEOBJECTINSTANCEA *pdidoi, void *pCont
         IsEqualIID(&pdidoi->guidType, &GUID_YAxis) ||
         IsEqualIID(&pdidoi->guidType, &GUID_ZAxis))
     {
-        ok(pdidoi->dwFlags & DIDOI_ASPECTPOSITION, "Missing DIDOI_ASPECTPOSITION, flags are 0x%x\n",
+        ok(pdidoi->dwFlags & DIDOI_ASPECTPOSITION, "Missing DIDOI_ASPECTPOSITION, flags are %#lx\n",
             pdidoi->dwFlags);
     }
     else
-        ok(pdidoi->dwFlags == 0, "Flags are 0x%x\n", pdidoi->dwFlags);
+        ok(pdidoi->dwFlags == 0, "Flags are %#lx\n", pdidoi->dwFlags);
 
     return DIENUM_CONTINUE;
 }
@@ -277,11 +277,11 @@ static void test_mouse_EnumObjects(IDirectInputA *pDI)
     IDirectInputDeviceA *pMouse = NULL;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hr = IDirectInputDevice_EnumObjects(pMouse, EnumAxes, NULL, DIDFT_ALL);
-    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
+    ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %#lx\n", hr);
 
     IUnknown_Release(pMouse);
 }
@@ -300,12 +300,12 @@ static void mouse_tests(void)
         skip("Tests require a newer dinput version\n");
         return;
     }
-    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr);
+    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %#lx\n", hr);
     if (FAILED(hr)) return;
 
     hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL,
                          NULL, NULL);
-    ok(hwnd != NULL, "err: %d\n", GetLastError());
+    ok(hwnd != NULL, "err: %lu\n", GetLastError());
     if (hwnd)
     {
         ShowWindow(hwnd, SW_SHOW);
@@ -318,7 +318,7 @@ static void mouse_tests(void)
         DestroyWindow(hwnd);
     }
     if (pDI) ref = IUnknown_Release(pDI);
-    ok(!ref, "IDirectInput_Release() reference count = %d\n", ref);
+    ok(!ref, "IDirectInput_Release() reference count = %lu\n", ref);
 }
 
 START_TEST(mouse)
-- 
2.34.1




More information about the wine-devel mailing list