dinput/tests: Fix printf warnings with long types.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2022-02-08 09:55:40 +01:00 committed by Alexandre Julliard
parent 9f472f00d8
commit 19a5881b0b
13 changed files with 2325 additions and 2326 deletions

View File

@ -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

View File

@ -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);
}

File diff suppressed because it is too large Load Diff

View File

@ -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] );

View File

@ -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++;
@ -480,7 +480,7 @@ static void check_buffer_( int line, HID_XFER_PACKET *packet, struct hid_expect
for (i = 0; i < packet->reportBufferLen;)
{
char buffer[256], *buf = buffer;
buf += sprintf( buf, "%08x ", i );
buf += sprintf( buf, "%08lx ", i );
do buf += sprintf( buf, " %02x", packet->reportBuffer[i] );
while (++i % 16 && i < packet->reportBufferLen);
ok( 0, " %s\n", buffer );
@ -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;

View File

@ -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 );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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)
{

View File

@ -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,11 +877,11 @@ 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 "
"S0%5d S1%5d POV0%5d POV1%5d POV2%5d POV3%5d "
sprintf(curstate, "X%5ld Y%5ld Z%5ld Rx%5ld Ry%5ld Rz%5ld "
"S0%5ld S1%5ld POV0%5ld POV1%5ld POV2%5ld POV3%5ld "
"B %d %d %d %d %d %d %d %d %d %d %d %d\n",
js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz,
js.rglSlider[0], js.rglSlider[1],
@ -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");
}

File diff suppressed because it is too large Load Diff

View File

@ -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, "%#x", 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)

View File

@ -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)