[5/5] dinput: Implemented DIEDBSFL_AVAILABLEDEVICES flag in EnumDeviceSemantics
Lucas Fialho Zawacki
lfzawacki at gmail.com
Fri Jul 8 13:01:41 CDT 2011
---
dlls/dinput/dinput_main.c | 24 ++++++++++++++++++++++++
dlls/dinput8/tests/device.c | 2 +-
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 1f16bb4..7d25757 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -872,6 +872,18 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
{
DWORD callbackFlags = 0;
+ /* If the user asked for available devices skips the ones with usernames */
+ if (dwFlags & DIEDBSFL_AVAILABLEDEVICES)
+ {
+ DIPROPSTRING dps;
+
+ dps.diph.dwSize = sizeof(dps);
+ dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dps.diph.dwHow = DIPH_DEVICE;
+
+ if (!IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph)) continue;
+ }
+
IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
@@ -912,6 +924,18 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
{
DWORD callbackFlags = 0;
+ /* If the user asked for available devices skips the ones with usernames */
+ if (dwFlags & DIEDBSFL_AVAILABLEDEVICES)
+ {
+ DIPROPSTRING dps;
+
+ dps.diph.dwSize = sizeof(dps);
+ dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
+ dps.diph.dwHow = DIPH_DEVICE;
+
+ if (!IDirectInputDevice_GetProperty(lpdid, DIPROP_USERNAME, &dps.diph)) continue;
+ }
+
IDirectInput_CreateDevice(iface, guids[i], &lpdid, NULL);
IDirectInputDevice_GetDeviceInfo(lpdid, &didevi);
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 94b1f2d..bf240e4 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -282,7 +282,7 @@ static void test_action_mapping(void)
count.ndevices = 0;
hr = IDirectInput8_EnumDevicesBySemantics(pDI, 0, &af, counting_callback, &count, DIEDBSFL_AVAILABLEDEVICES);
ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed hr=%08x\n", hr);
- todo_wine ok (count.ndevices == 0, "No device should be available after action mapping available=%d\n", count.ndevices);
+ ok (count.ndevices == 0, "No device should be available after action mapping available=%d\n", count.ndevices);
/* Use the devices we collect for some tests */
if (data.keyboard != NULL)
--
1.7.0.4
More information about the wine-patches
mailing list