dinput/tests: Compile with -D__WINESRC__
Michael Stefaniuc
mstefani at redhat.de
Tue Oct 29 17:13:02 CDT 2013
---
dlls/dinput/tests/Makefile.in | 1 -
dlls/dinput/tests/device.c | 26 +++++++++++++-------------
dlls/dinput/tests/joystick.c | 39 +++++++++++++++++----------------------
dlls/dinput/tests/keyboard.c | 32 ++++++++++++++++----------------
dlls/dinput/tests/mouse.c | 28 ++++++++++++++--------------
5 files changed, 60 insertions(+), 66 deletions(-)
diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in
index cb2c1ec..9b04eb1 100644
--- a/dlls/dinput/tests/Makefile.in
+++ b/dlls/dinput/tests/Makefile.in
@@ -1,6 +1,5 @@
TESTDLL = dinput.dll
IMPORTS = dinput ole32 version user32
-EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \
device.c \
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index f03a3b6..7494024 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -55,7 +55,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",
@@ -64,18 +64,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;
@@ -170,14 +170,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);
@@ -208,8 +208,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;
@@ -219,7 +219,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);
@@ -229,8 +229,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)
{
@@ -246,7 +246,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/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index 2fe12ba..231d019 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -33,7 +33,7 @@
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
typedef struct tagUserData {
- LPDIRECTINPUT pDI;
+ IDirectInputA *pDI;
DWORD version;
} UserData;
@@ -76,7 +76,7 @@ static HWND get_hwnd(void)
typedef struct tagJoystickInfo
{
- LPDIRECTINPUTDEVICE pJoystick;
+ IDirectInputDeviceA *pJoystick;
DWORD axis;
DWORD pov;
DWORD button;
@@ -90,9 +90,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;
@@ -165,21 +163,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;
@@ -335,7 +331,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);
@@ -365,7 +361,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");
@@ -388,9 +384,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);
@@ -402,7 +398,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);
@@ -651,14 +647,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/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index fe5fa89..ef5f06a 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -30,10 +30,10 @@
#include "wingdi.h"
#include "dinput.h"
-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;
@@ -112,10 +112,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;
@@ -134,8 +134,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++)
@@ -148,10 +148,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);
@@ -170,10 +170,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);
@@ -196,22 +196,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/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c
index 2cfb8cd..1a5f4bc 100644
--- a/dlls/dinput/tests/mouse.c
+++ b/dlls/dinput/tests/mouse.c
@@ -48,10 +48,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;
@@ -70,8 +70,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++)
@@ -84,10 +84,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;
@@ -128,8 +128,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);
@@ -181,22 +181,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)
{
--
1.8.3.1
More information about the wine-patches
mailing list