Signed-off-by: Andrew Eikum aeikum@codeweavers.com --- dlls/user32/rawinput.c | 18 +++++++++++++++ dlls/user32/tests/Makefile.in | 2 +- dlls/user32/tests/input.c | 41 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index 770ec910963..85ff0c5e809 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -33,6 +33,7 @@ #include "ddk/hidsdi.h" #include "wine/debug.h" #include "wine/server.h" +#include "wine/hid.h"
#include "user_private.h"
@@ -467,6 +468,23 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE device, UINT command, void *data, UINT to_copy = &info; break;
+ case RIDI_PREPARSEDDATA: + avail_bytes = *data_size; + if (device == WINE_MOUSE_HANDLE || + device == WINE_KEYBOARD_HANDLE) + { + to_copy_bytes = 0; + *data_size = 0; + to_copy = NULL; + } + else + { + to_copy_bytes = ((WINE_HIDP_PREPARSED_DATA*)hid_device->data)->dwSize; + *data_size = to_copy_bytes; + to_copy = hid_device->data; + } + break; + default: FIXME("command %#x not supported\n", command); return ~0U; diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in index 7149dc824ea..dd101d69f3c 100644 --- a/dlls/user32/tests/Makefile.in +++ b/dlls/user32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = user32.dll -IMPORTS = user32 gdi32 advapi32 +IMPORTS = user32 gdi32 advapi32 hid
C_SRCS = \ broadcast.c \ diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 5723af3fd2b..1e6be311eeb 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -55,6 +55,7 @@ #include "winbase.h" #include "winuser.h" #include "winnls.h" +#include "ddk/hidsdi.h"
#include "wine/test.h"
@@ -1605,6 +1606,7 @@ static void test_GetRawInputDeviceList(void) RAWINPUTDEVICELIST devices[32]; UINT ret, oret, devcount, odevcount, i; DWORD err; + BOOLEAN br;
SetLastError(0xdeadbeef); ret = pGetRawInputDeviceList(NULL, NULL, 0); @@ -1642,6 +1644,7 @@ static void test_GetRawInputDeviceList(void) UINT sz, len; RID_DEVICE_INFO info; HANDLE file; + char *ppd;
/* get required buffer size */ name[0] = '\0'; @@ -1688,6 +1691,44 @@ static void test_GetRawInputDeviceList(void) file = CreateFileW(name, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); todo_wine_if(info.dwType != RIM_TYPEHID) ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u\n", wine_dbgstr_w(name), GetLastError()); + + sz = 0; + ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, NULL, &sz); + ok(ret == 0, "GetRawInputDeviceInfo gave wrong return: %u\n", ret); + ok((info.dwType == RIM_TYPEHID && sz != 0) || + (info.dwType != RIM_TYPEHID && sz == 0), + "Got wrong PPD size for type 0x%x: %u\n", info.dwType, sz); + + ppd = HeapAlloc(GetProcessHeap(), 0, sz); + ret = pGetRawInputDeviceInfoW(devices[i].hDevice, RIDI_PREPARSEDDATA, ppd, &sz); + ok(ret == sz, "GetRawInputDeviceInfo gave wrong return: %u, should be %u\n", ret, sz); + + if (file != INVALID_HANDLE_VALUE && ret == sz) + { + PHIDP_PREPARSED_DATA preparsed; + + if (info.dwType == RIM_TYPEHID) + { + br = HidD_GetPreparsedData(file, &preparsed); + ok(br == TRUE, "HidD_GetPreparsedData failed\n"); + + if (br) + ok(!memcmp(preparsed, ppd, sz), "Expected to get same preparsed data\n"); + } + else + { + /* succeeds on hardware, fails in some VMs */ + br = HidD_GetPreparsedData(file, &preparsed); + todo_wine + ok(br == TRUE || broken(br == FALSE), "HidD_GetPreparsedData failed\n"); + } + + if (br) + HidD_FreePreparsedData(preparsed); + } + + HeapFree(GetProcessHeap(), 0, ppd); + CloseHandle(file); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=58745
Your paranoid android.
=== w1064v1809_zh_CN (32 bit report) ===
user32: input.c:1294: Test failed: Wrong set pos: (99,100) input.c:1314: Test failed: GetCursorPos: (99,100)
=== debian10 (32 bit Chinese:China report) ===
user32: msg.c:8774: Test failed: WaitForSingleObject failed 102 msg.c:8780: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8780: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8780: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000