Commit 0ba314eb authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

dinput: Enumerate devices past the first non-matching device.

parent 1ff63bb8
...@@ -370,17 +370,17 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices( ...@@ -370,17 +370,17 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
for (i = 0; i < NB_DINPUT_DEVICES; i++) { for (i = 0; i < NB_DINPUT_DEVICES; i++) {
if (!dinput_devices[i]->enum_deviceA) continue; if (!dinput_devices[i]->enum_deviceA) continue;
for (j = 0, r = -1; r != 0; j++) { for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
devInstance.dwSize = sizeof(devInstance); devInstance.dwSize = sizeof(devInstance);
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
if ((r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j))) { r = dinput_devices[i]->enum_deviceA(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP) if (r == S_OK)
return 0; if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
} return S_OK;
} }
} }
return 0; return S_OK;
} }
/****************************************************************************** /******************************************************************************
* IDirectInputW_EnumDevices * IDirectInputW_EnumDevices
...@@ -392,7 +392,8 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices( ...@@ -392,7 +392,8 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
IDirectInputImpl *This = impl_from_IDirectInput7W( iface ); IDirectInputImpl *This = impl_from_IDirectInput7W( iface );
DIDEVICEINSTANCEW devInstance; DIDEVICEINSTANCEW devInstance;
unsigned int i; unsigned int i;
int j, r; int j;
HRESULT r;
TRACE("(this=%p,0x%04x '%s',%p,%p,%04x)\n", TRACE("(this=%p,0x%04x '%s',%p,%p,%04x)\n",
This, dwDevType, _dump_DIDEVTYPE_value(dwDevType), This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
...@@ -409,17 +410,17 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices( ...@@ -409,17 +410,17 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
for (i = 0; i < NB_DINPUT_DEVICES; i++) { for (i = 0; i < NB_DINPUT_DEVICES; i++) {
if (!dinput_devices[i]->enum_deviceW) continue; if (!dinput_devices[i]->enum_deviceW) continue;
for (j = 0, r = -1; r != 0; j++) { for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
devInstance.dwSize = sizeof(devInstance); devInstance.dwSize = sizeof(devInstance);
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
if ((r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->dwVersion, j))) { r = dinput_devices[i]->enum_deviceW(dwDevType, dwFlags, &devInstance, This->dwVersion, j);
if (lpCallback(&devInstance,pvRef) == DIENUM_STOP) if (r == S_OK)
return 0; if (lpCallback(&devInstance,pvRef) == DIENUM_STOP)
} return S_OK;
} }
} }
return 0; return S_OK;
} }
static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface) static ULONG WINAPI IDirectInputAImpl_AddRef(LPDIRECTINPUT7A iface)
...@@ -908,18 +909,18 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics( ...@@ -908,18 +909,18 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
/* Enumerate all the joysticks */ /* Enumerate all the joysticks */
for (i = 0; i < NB_DINPUT_DEVICES; i++) for (i = 0; i < NB_DINPUT_DEVICES; i++)
{ {
BOOL enumSuccess; HRESULT enumSuccess;
if (!dinput_devices[i]->enum_deviceA) continue; if (!dinput_devices[i]->enum_deviceA) continue;
for (j = 0, enumSuccess = -1; enumSuccess != 0; j++) for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
{ {
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
callbackFlags = diactionformat_priorityA(lpdiActionFormat, lpdiActionFormat->dwGenre); callbackFlags = diactionformat_priorityA(lpdiActionFormat, lpdiActionFormat->dwGenre);
/* Default behavior is to enumerate attached game controllers */ /* Default behavior is to enumerate attached game controllers */
enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j); enumSuccess = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
if (enumSuccess) if (enumSuccess == S_OK)
{ {
IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL); IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL);
...@@ -968,18 +969,18 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics( ...@@ -968,18 +969,18 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
/* Enumerate all the joysticks */ /* Enumerate all the joysticks */
for (i = 0; i < NB_DINPUT_DEVICES; i++) for (i = 0; i < NB_DINPUT_DEVICES; i++)
{ {
BOOL enumSuccess; HRESULT enumSuccess;
if (!dinput_devices[i]->enum_deviceW) continue; if (!dinput_devices[i]->enum_deviceW) continue;
for (j = 0, enumSuccess = -1; enumSuccess != 0; j++) for (j = 0, enumSuccess = S_OK; SUCCEEDED(enumSuccess); j++)
{ {
TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name); TRACE(" - checking device %u ('%s')\n", i, dinput_devices[i]->name);
callbackFlags = diactionformat_priorityW(lpdiActionFormat, lpdiActionFormat->dwGenre); callbackFlags = diactionformat_priorityW(lpdiActionFormat, lpdiActionFormat->dwGenre);
/* Default behavior is to enumerate attached game controllers */ /* Default behavior is to enumerate attached game controllers */
enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j); enumSuccess = dinput_devices[i]->enum_deviceW(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY | dwFlags, &didevi, This->dwVersion, j);
if (enumSuccess) if (enumSuccess == S_OK)
{ {
IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL); IDirectInput_CreateDevice(iface, &didevi.guidInstance, &lpdid, NULL);
...@@ -1147,7 +1148,8 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI ...@@ -1147,7 +1148,8 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI
{ {
IDirectInputImpl *di = impl_from_IDirectInputJoyConfig8(iface); IDirectInputImpl *di = impl_from_IDirectInputJoyConfig8(iface);
UINT found = 0; UINT found = 0;
int i, j, r; int i, j;
HRESULT r;
FIXME("(%p)->(%d, %p, 0x%08x): semi-stub!\n", iface, id, info, flags); FIXME("(%p)->(%d, %p, 0x%08x): semi-stub!\n", iface, id, info, flags);
...@@ -1163,11 +1165,11 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI ...@@ -1163,11 +1165,11 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI
{ {
if (!dinput_devices[i]->enum_deviceA) continue; if (!dinput_devices[i]->enum_deviceA) continue;
for (j = 0, r = -1; r != 0; j++) for (j = 0, r = S_OK; SUCCEEDED(r); j++)
{ {
DIDEVICEINSTANCEA dev; DIDEVICEINSTANCEA dev;
dev.dwSize = sizeof(dev); dev.dwSize = sizeof(dev);
if ((r = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, 0, &dev, di->dwVersion, j))) if ((r = dinput_devices[i]->enum_deviceA(DI8DEVCLASS_GAMECTRL, 0, &dev, di->dwVersion, j)) == S_OK)
{ {
/* Only take into account the chosen id */ /* Only take into account the chosen id */
if (found == id) if (found == id)
......
...@@ -51,8 +51,8 @@ struct IDirectInputImpl ...@@ -51,8 +51,8 @@ struct IDirectInputImpl
/* Function called by all devices that Wine supports */ /* Function called by all devices that Wine supports */
struct dinput_device { struct dinput_device {
const char *name; const char *name;
BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id); HRESULT (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id);
BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id); HRESULT (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id);
HRESULT (*create_device)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode); HRESULT (*create_device)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPVOID *pdev, int unicode);
}; };
......
...@@ -220,15 +220,15 @@ static INT find_joystick_devices(void) ...@@ -220,15 +220,15 @@ static INT find_joystick_devices(void)
return joystick_devices_count; return joystick_devices_count;
} }
static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
{ {
int fd = -1; int fd = -1;
if (id >= find_joystick_devices()) return FALSE; if (id >= find_joystick_devices()) return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK) { if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n"); WARN("force feedback not supported\n");
return FALSE; return S_FALSE;
} }
if ((dwDevType == 0) || if ((dwDevType == 0) ||
...@@ -238,7 +238,7 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -238,7 +238,7 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0) if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0)
{ {
WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id].name, strerror(errno)); WARN("open(%s, O_RDONLY) failed: %s\n", joystick_devices[id].name, strerror(errno));
return FALSE; return S_FALSE;
} }
/* Return joystick */ /* Return joystick */
...@@ -257,21 +257,21 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -257,21 +257,21 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
lpddi->guidFFDriver = GUID_NULL; lpddi->guidFFDriver = GUID_NULL;
close(fd); close(fd);
TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id].device, lpddi->tszProductName); TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id].device, lpddi->tszProductName);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
{ {
int fd = -1; int fd = -1;
if (id >= find_joystick_devices()) return FALSE; if (id >= find_joystick_devices()) return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK) { if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n"); WARN("force feedback not supported\n");
return FALSE; return S_FALSE;
} }
if ((dwDevType == 0) || if ((dwDevType == 0) ||
...@@ -281,7 +281,7 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -281,7 +281,7 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0) if ((fd = open(joystick_devices[id].device, O_RDONLY)) < 0)
{ {
WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices[id].device, strerror(errno)); WARN("open(%s,O_RDONLY) failed: %s\n", joystick_devices[id].device, strerror(errno));
return FALSE; return S_FALSE;
} }
/* Return joystick */ /* Return joystick */
...@@ -299,10 +299,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -299,10 +299,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
lpddi->guidFFDriver = GUID_NULL; lpddi->guidFFDriver = GUID_NULL;
close(fd); close(fd);
TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id].device, joystick_devices[id].name); TRACE("Enumerating the linux Joystick device: %s (%s)\n", joystick_devices[id].device, joystick_devices[id].name);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
......
...@@ -363,54 +363,54 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver ...@@ -363,54 +363,54 @@ static void fill_joystick_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver
MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszProductName, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, joydevs[id].name, -1, lpddi->tszProductName, MAX_PATH);
} }
static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
{ {
find_joydevs(); find_joydevs();
if (id >= have_joydevs) { if (id >= have_joydevs) {
return FALSE; return E_FAIL;
} }
if (!((dwDevType == 0) || if (!((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800)))) (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
return FALSE; return S_FALSE;
#ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION #ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
if (dwFlags & DIEDFL_FORCEFEEDBACK) if (dwFlags & DIEDFL_FORCEFEEDBACK)
return FALSE; return S_FALSE;
#endif #endif
if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) { if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
fill_joystick_dideviceinstanceA(lpddi, version, id); fill_joystick_dideviceinstanceA(lpddi, version, id);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
{ {
find_joydevs(); find_joydevs();
if (id >= have_joydevs) { if (id >= have_joydevs) {
return FALSE; return E_FAIL;
} }
if (!((dwDevType == 0) || if (!((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) || ((dwDevType == DIDEVTYPE_JOYSTICK) && (version > 0x0300 && version < 0x0800)) ||
(((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800)))) (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 0x0800))))
return FALSE; return S_FALSE;
#ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION #ifndef HAVE_STRUCT_FF_EFFECT_DIRECTION
if (dwFlags & DIEDFL_FORCEFEEDBACK) if (dwFlags & DIEDFL_FORCEFEEDBACK)
return FALSE; return S_FALSE;
#endif #endif
if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) { if (!(dwFlags & DIEDFL_FORCEFEEDBACK) || joydevs[id].has_ff) {
fill_joystick_dideviceinstanceW(lpddi, version, id); fill_joystick_dideviceinstanceW(lpddi, version, id);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsigned short index) static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsigned short index)
......
...@@ -651,13 +651,13 @@ static INT find_joystick_devices(void) ...@@ -651,13 +651,13 @@ static INT find_joystick_devices(void)
return joystick_devices_count; return joystick_devices_count;
} }
static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
{ {
if (id >= find_joystick_devices()) return FALSE; if (id >= find_joystick_devices()) return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK) { if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n"); WARN("force feedback not supported\n");
return FALSE; return S_FALSE;
} }
if ((dwDevType == 0) || if ((dwDevType == 0) ||
...@@ -679,22 +679,22 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -679,22 +679,22 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
get_osx_device_name(id, lpddi->tszProductName, MAX_PATH); get_osx_device_name(id, lpddi->tszProductName, MAX_PATH);
lpddi->guidFFDriver = GUID_NULL; lpddi->guidFFDriver = GUID_NULL;
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id) static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
{ {
char name[MAX_PATH]; char name[MAX_PATH];
char friendly[32]; char friendly[32];
if (id >= find_joystick_devices()) return FALSE; if (id >= find_joystick_devices()) return E_FAIL;
if (dwFlags & DIEDFL_FORCEFEEDBACK) { if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n"); WARN("force feedback not supported\n");
return FALSE; return S_FALSE;
} }
if ((dwDevType == 0) || if ((dwDevType == 0) ||
...@@ -716,10 +716,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN ...@@ -716,10 +716,10 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
MultiByteToWideChar(CP_ACP, 0, name, -1, lpddi->tszProductName, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, name, -1, lpddi->tszProductName, MAX_PATH);
lpddi->guidFFDriver = GUID_NULL; lpddi->guidFFDriver = GUID_NULL;
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput, static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
......
...@@ -184,10 +184,10 @@ static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver ...@@ -184,10 +184,10 @@ static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD ver
memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
} }
static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static HRESULT keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
{ {
if (id != 0) if (id != 0)
return FALSE; return E_FAIL;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
...@@ -196,16 +196,16 @@ static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI ...@@ -196,16 +196,16 @@ static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
fill_keyboard_dideviceinstanceA(lpddi, version); fill_keyboard_dideviceinstanceA(lpddi, version);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id) static HRESULT keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
{ {
if (id != 0) if (id != 0)
return FALSE; return E_FAIL;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 0x0800)) ||
...@@ -214,10 +214,10 @@ static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI ...@@ -214,10 +214,10 @@ static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
fill_keyboard_dideviceinstanceW(lpddi, version); fill_keyboard_dideviceinstanceW(lpddi, version);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static SysKeyboardImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput) static SysKeyboardImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
......
...@@ -159,10 +159,10 @@ static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD versio ...@@ -159,10 +159,10 @@ static void fill_mouse_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, DWORD versio
memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi))); memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
} }
static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id) static HRESULT mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, DWORD version, int id)
{ {
if (id != 0) if (id != 0)
return FALSE; return E_FAIL;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
...@@ -171,16 +171,16 @@ static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST ...@@ -171,16 +171,16 @@ static BOOL mousedev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST
fill_mouse_dideviceinstanceA(lpddi, version); fill_mouse_dideviceinstanceA(lpddi, version);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id) static HRESULT mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, DWORD version, int id)
{ {
if (id != 0) if (id != 0)
return FALSE; return E_FAIL;
if ((dwDevType == 0) || if ((dwDevType == 0) ||
((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 0x0800)) ||
...@@ -189,10 +189,10 @@ static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST ...@@ -189,10 +189,10 @@ static BOOL mousedev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINST
fill_mouse_dideviceinstanceW(lpddi, version); fill_mouse_dideviceinstanceW(lpddi, version);
return TRUE; return S_OK;
} }
return FALSE; return S_FALSE;
} }
static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput) static SysMouseImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment