From: Amine Khaldi Date: Sat, 19 Apr 2014 23:44:04 +0000 (+0000) Subject: [DINPUT_WINETEST] X-Git-Tag: backups/0.3.17@66124~1662 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=d9b7959228a21ac63c485da68972078a2debbd4e [DINPUT_WINETEST] * Sync with Wine 1.7.17. CORE-8080 svn path=/trunk/; revision=62825 --- diff --git a/rostests/winetests/dinput/device.c b/rostests/winetests/dinput/device.c index 76960087b46..20d211d4e66 100644 --- a/rostests/winetests/dinput/device.c +++ b/rostests/winetests/dinput/device.c @@ -59,7 +59,7 @@ static const DIDATAFORMAT data_format = { (LPDIOBJECTDATAFORMAT)obj_data_format }; -static BOOL CALLBACK enum_callback(LPCDIDEVICEOBJECTINSTANCE oi, LPVOID info) +static BOOL CALLBACK enum_callback(const DIDEVICEOBJECTINSTANCEA *oi, void *info) { if (winetest_debug > 1) trace(" Type:%4x Ofs:%3d Flags:%08x Name:%s\n", @@ -68,18 +68,18 @@ static BOOL CALLBACK enum_callback(LPCDIDEVICEOBJECTINSTANCE oi, LPVOID info) return DIENUM_CONTINUE; } -static BOOL CALLBACK enum_type_callback(LPCDIDEVICEOBJECTINSTANCE oi, LPVOID 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); return DIENUM_CONTINUE; } -static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd) +static void test_object_info(IDirectInputDeviceA *device, HWND hwnd) { HRESULT hr; DIPROPDWORD dp; - DIDEVICEOBJECTINSTANCE obj_info; + DIDEVICEOBJECTINSTANCEA obj_info; DWORD obj_types[] = {DIDFT_BUTTON, DIDFT_AXIS, DIDFT_POV}; int type_index; int cnt1 = 0; @@ -174,14 +174,14 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd) struct enum_data { - LPDIRECTINPUT pDI; + IDirectInputA *pDI; HWND hwnd; }; -static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) +static BOOL CALLBACK enum_devices(const DIDEVICEINSTANCEA *lpddi, void *pvRef) { struct enum_data *data = pvRef; - LPDIRECTINPUTDEVICE device, obj = NULL; + IDirectInputDeviceA *device, *obj = NULL; HRESULT hr; hr = IDirectInput_GetDeviceStatus(data->pDI, &lpddi->guidInstance); @@ -212,8 +212,8 @@ static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) static void device_tests(void) { HRESULT hr; - LPDIRECTINPUT pDI = NULL, obj = NULL; - HINSTANCE hInstance = GetModuleHandle(NULL); + IDirectInputA *pDI = NULL, *obj = NULL; + HINSTANCE hInstance = GetModuleHandleW(NULL); HWND hwnd; struct enum_data data; @@ -223,7 +223,7 @@ static void device_tests(void) skip("Tests require a newer dinput version\n"); return; } - ok(SUCCEEDED(hr), "DirectInputCreate() failed: %08x\n", hr); + ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr); if (FAILED(hr)) return; hr = IDirectInput_Initialize(pDI, hInstance, DIRECTINPUT_VERSION); @@ -233,8 +233,8 @@ static void device_tests(void) hr = IUnknown_QueryInterface(pDI, &IID_IDirectInput2W, (LPVOID*)&obj); ok(SUCCEEDED(hr), "QueryInterface(IDirectInput7W) failed: %08x\n", hr); - hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW, - 10, 10, 200, 200, NULL, NULL, NULL, NULL); + hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL, + NULL, NULL); ok(hwnd != NULL, "err: %d\n", GetLastError()); if (hwnd) { @@ -250,7 +250,7 @@ static void device_tests(void) hr = IDirectInput_GetDeviceStatus(pDI, &GUID_Joystick); if (hr == DI_OK) { - LPDIRECTINPUTDEVICE device = NULL; + IDirectInputDeviceA *device = NULL; hr = IDirectInput_CreateDevice(pDI, &GUID_Joystick, &device, NULL); ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr); diff --git a/rostests/winetests/dinput/joystick.c b/rostests/winetests/dinput/joystick.c index b961de0043d..eb60f6484f8 100644 --- a/rostests/winetests/dinput/joystick.c +++ b/rostests/winetests/dinput/joystick.c @@ -38,7 +38,7 @@ #define numObjects(x) (sizeof(x) / sizeof(x[0])) typedef struct tagUserData { - LPDIRECTINPUT pDI; + IDirectInputA *pDI; DWORD version; } UserData; @@ -81,7 +81,7 @@ static HWND get_hwnd(void) typedef struct tagJoystickInfo { - LPDIRECTINPUTDEVICE pJoystick; + IDirectInputDeviceA *pJoystick; DWORD axis; DWORD pov; DWORD button; @@ -95,9 +95,7 @@ static int get_refcount(IUnknown *object) return IUnknown_Release( object ); } -static BOOL CALLBACK EnumAxes( - const DIDEVICEOBJECTINSTANCE* pdidoi, - VOID* pContext) +static BOOL CALLBACK EnumAxes(const DIDEVICEOBJECTINSTANCEA *pdidoi, void *pContext) { HRESULT hr; JoystickInfo * info = pContext; @@ -170,21 +168,19 @@ static const HRESULT SetCoop_real_window[16] = { E_INVALIDARG, S_OK, S_OK, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG}; -static BOOL CALLBACK EnumJoysticks( - LPCDIDEVICEINSTANCE lpddi, - LPVOID pvRef) +static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef) { HRESULT hr; UserData * data = pvRef; - LPDIRECTINPUTDEVICE pJoystick; + IDirectInputDeviceA *pJoystick; DIDATAFORMAT format; DIDEVCAPS caps; DIJOYSTATE2 js; JoystickInfo info; int i, count; ULONG ref; - DIDEVICEINSTANCE inst; - DIDEVICEINSTANCE_DX3 inst3; + DIDEVICEINSTANCEA inst; + DIDEVICEINSTANCE_DX3A inst3; DIPROPDWORD dipw; DIPROPSTRING dps; DIPROPGUIDANDPATH dpg; @@ -340,7 +336,7 @@ static BOOL CALLBACK EnumJoysticks( ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %08x\n", hr); inst3.dwSize = sizeof(inst3); - hr = IDirectInputDevice_GetDeviceInfo(pJoystick, (LPDIDEVICEINSTANCE)&inst3); + hr = IDirectInputDevice_GetDeviceInfo(pJoystick, (DIDEVICEINSTANCEA*)&inst3); ok(hr==DI_OK,"IDirectInputDevice_GetDeviceInfo() failed: %08x\n", hr); hr = IDirectInputDevice_Unacquire(pJoystick); @@ -370,7 +366,7 @@ static BOOL CALLBACK EnumJoysticks( LPDIRECTINPUTEFFECT effect = NULL; LONG cnt1, cnt2; HWND real_hWnd; - HINSTANCE hInstance = GetModuleHandle(NULL); + HINSTANCE hInstance = GetModuleHandleW(NULL); DIPROPDWORD dip_gain_set, dip_gain_get; trace("Testing force-feedback\n"); @@ -393,9 +389,9 @@ static BOOL CALLBACK EnumJoysticks( * IDirectInputDevice_SetCooperativeLevel * - a visible window */ - real_hWnd = CreateWindowEx(0, "EDIT", "Test text", 0, 10, 10, 300, - 300, NULL, NULL, hInstance, NULL); - ok(real_hWnd!=0,"CreateWindowEx failed: %p\n", real_hWnd); + real_hWnd = CreateWindowExA(0, "EDIT", "Test text", 0, 10, 10, 300, 300, NULL, NULL, + hInstance, NULL); + 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); @@ -407,7 +403,7 @@ static BOOL CALLBACK EnumJoysticks( cnt1 = get_refcount((IUnknown*)pJoystick); - hr = IDirectInputDevice2_CreateEffect((LPDIRECTINPUTDEVICE2)pJoystick, &GUID_ConstantForce, + hr = IDirectInputDevice2_CreateEffect((IDirectInputDevice2A*)pJoystick, &GUID_ConstantForce, &eff, &effect, NULL); ok(hr == DI_OK, "IDirectInputDevice_CreateEffect() failed: %08x\n", hr); cnt2 = get_refcount((IUnknown*)pJoystick); @@ -559,7 +555,7 @@ static BOOL CALLBACK EnumJoysticks( ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\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 udated: %i\n", dip_gain_get.dwData); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\n", dip_gain_get.dwData); hr = IDirectInputDevice_Acquire(pJoystick); ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %08x\n", hr); dip_gain_set.dwData = 2; @@ -567,7 +563,7 @@ static BOOL CALLBACK EnumJoysticks( ok(hr==DI_OK, "IDirectInputDevice_SetProperty() failed: %08x\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 udated: %i\n", dip_gain_get.dwData); + ok(dip_gain_get.dwData==dip_gain_set.dwData, "Gain not updated: %i\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); @@ -656,14 +652,13 @@ DONE: static void joystick_tests(DWORD version) { HRESULT hr; - LPDIRECTINPUT pDI; + IDirectInputA *pDI; ULONG ref; - HINSTANCE hInstance = GetModuleHandle(NULL); + HINSTANCE hInstance = GetModuleHandleW(NULL); trace("-- Testing Direct Input Version 0x%04x --\n", version); - hr = DirectInputCreate(hInstance, version, &pDI, NULL); - ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, - "DirectInputCreate() failed: %08x\n", hr); + hr = DirectInputCreateA(hInstance, version, &pDI, NULL); + ok(hr==DI_OK||hr==DIERR_OLDDIRECTINPUTVERSION, "DirectInputCreateA() failed: %08x\n", hr); if (hr==DI_OK && pDI!=0) { UserData data; data.pDI = pDI; diff --git a/rostests/winetests/dinput/keyboard.c b/rostests/winetests/dinput/keyboard.c index 650961e2522..5a9ac5100b0 100644 --- a/rostests/winetests/dinput/keyboard.c +++ b/rostests/winetests/dinput/keyboard.c @@ -34,10 +34,10 @@ //#include "wingdi.h" #include -static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd) +static void acquire_tests(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pKeyboard; + IDirectInputDeviceA *pKeyboard; BYTE kbd_state[256]; LONG custom_state[6]; int i; @@ -116,10 +116,10 @@ static const HRESULT SetCoop_child_window[16] = { E_INVALIDARG, E_HANDLE, E_HANDLE, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG}; -static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) +static void test_set_coop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pKeyboard = NULL; + IDirectInputDeviceA *pKeyboard = NULL; int i; HWND child; @@ -138,8 +138,8 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %08x\n", i, hr); } - child = CreateWindow("static", "Title", WS_CHILD | WS_VISIBLE, - 10, 10, 50, 50, hwnd, NULL, NULL, NULL); + child = CreateWindowA("static", "Title", WS_CHILD | WS_VISIBLE, 10, 10, 50, 50, hwnd, NULL, + NULL, NULL); ok(child != NULL, "err: %d\n", GetLastError()); for (i=0; i<16; i++) @@ -152,10 +152,10 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) if (pKeyboard) IUnknown_Release(pKeyboard); } -static void test_get_prop(LPDIRECTINPUT pDI, HWND hwnd) +static void test_get_prop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pKeyboard = NULL; + IDirectInputDeviceA *pKeyboard = NULL; DIPROPRANGE diprg; hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL); @@ -174,10 +174,10 @@ static void test_get_prop(LPDIRECTINPUT pDI, HWND hwnd) if (pKeyboard) IUnknown_Release(pKeyboard); } -static void test_capabilities(LPDIRECTINPUT pDI, HWND hwnd) +static void test_capabilities(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pKeyboard = NULL; + IDirectInputDeviceA *pKeyboard = NULL; DIDEVCAPS caps; hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL); @@ -200,22 +200,22 @@ static void test_capabilities(LPDIRECTINPUT pDI, HWND hwnd) static void keyboard_tests(DWORD version) { HRESULT hr; - LPDIRECTINPUT pDI = NULL; - HINSTANCE hInstance = GetModuleHandle(NULL); + IDirectInputA *pDI = NULL; + HINSTANCE hInstance = GetModuleHandleW(NULL); HWND hwnd; ULONG ref = 0; - hr = DirectInputCreate(hInstance, version, &pDI, NULL); + hr = DirectInputCreateA(hInstance, version, &pDI, NULL); if (hr == DIERR_OLDDIRECTINPUTVERSION) { skip("Tests require a newer dinput version\n"); return; } - ok(SUCCEEDED(hr), "DirectInputCreate() failed: %08x\n", hr); + ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr); if (FAILED(hr)) return; - hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE, - 10, 10, 200, 200, NULL, NULL, NULL, NULL); + hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10, 10, 200, 200, + NULL, NULL, NULL, NULL); ok(hwnd != NULL, "err: %d\n", GetLastError()); if (hwnd) diff --git a/rostests/winetests/dinput/mouse.c b/rostests/winetests/dinput/mouse.c index bd848566e77..fa47786c059 100644 --- a/rostests/winetests/dinput/mouse.c +++ b/rostests/winetests/dinput/mouse.c @@ -52,10 +52,10 @@ static const HRESULT SetCoop_child_window[16] = { E_INVALIDARG, E_HANDLE, E_HANDLE, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG}; -static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) +static void test_set_coop(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pMouse = NULL; + IDirectInputDeviceA *pMouse = NULL; int i; HWND child; @@ -74,8 +74,8 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %08x\n", i, hr); } - child = CreateWindow("static", "Title", WS_CHILD | WS_VISIBLE, - 10, 10, 50, 50, hwnd, NULL, NULL, NULL); + child = CreateWindowA("static", "Title", WS_CHILD | WS_VISIBLE, 10, 10, 50, 50, hwnd, NULL, + NULL, NULL); ok(child != NULL, "err: %d\n", GetLastError()); for (i=0; i<16; i++) @@ -88,10 +88,10 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd) if (pMouse) IUnknown_Release(pMouse); } -static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd) +static void test_acquire(IDirectInputA *pDI, HWND hwnd) { HRESULT hr; - LPDIRECTINPUTDEVICE pMouse = NULL; + IDirectInputDeviceA *pMouse = NULL; DIMOUSESTATE m_state; HWND hwnd2; DIPROPDWORD di_op; @@ -132,8 +132,8 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd) /* Foreground coop level requires window to have focus */ /* Create a temporary window, this should make dinput * loose mouse input */ - hwnd2 = CreateWindow("static", "Temporary", WS_VISIBLE, - 10, 210, 200, 200, NULL, NULL, NULL, NULL); + hwnd2 = CreateWindowA("static", "Temporary", WS_VISIBLE, 10, 210, 200, 200, NULL, NULL, NULL, + NULL); hr = IDirectInputDevice_GetDeviceState(pMouse, sizeof(m_state), &m_state); ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %08x\n", hr); @@ -185,22 +185,22 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd) static void mouse_tests(void) { HRESULT hr; - LPDIRECTINPUT pDI = NULL; - HINSTANCE hInstance = GetModuleHandle(NULL); + IDirectInputA *pDI = NULL; + HINSTANCE hInstance = GetModuleHandleW(NULL); HWND hwnd; ULONG ref = 0; - hr = DirectInputCreate(hInstance, DIRECTINPUT_VERSION, &pDI, NULL); + hr = DirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &pDI, NULL); if (hr == DIERR_OLDDIRECTINPUTVERSION) { skip("Tests require a newer dinput version\n"); return; } - ok(SUCCEEDED(hr), "DirectInputCreate() failed: %08x\n", hr); + ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %08x\n", hr); if (FAILED(hr)) return; - hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW, - 10, 10, 200, 200, NULL, NULL, NULL, NULL); + hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL, + NULL, NULL); ok(hwnd != NULL, "err: %d\n", GetLastError()); if (hwnd) {