[PATCH 1/2] hid: Implement HidD_GetMsGenreDescriptor.
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- dlls/hid/hid.spec | 2 +- dlls/hid/hidd.c | 6 ++++++ include/ddk/hidsdi.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/hid/hid.spec b/dlls/hid/hid.spec index 67c4473129d..59d6317c666 100644 --- a/dlls/hid/hid.spec +++ b/dlls/hid/hid.spec @@ -7,7 +7,7 @@ @ stdcall HidD_GetIndexedString(ptr long ptr long) @ stdcall HidD_GetInputReport(long ptr long) @ stdcall HidD_GetManufacturerString(long ptr long) -@ stub HidD_GetMsGenreDescriptor +@ stdcall HidD_GetMsGenreDescriptor(long ptr long) @ stdcall HidD_GetNumInputBuffers(long ptr) @ stdcall HidD_GetPhysicalDescriptor(long ptr long) @ stdcall HidD_GetPreparsedData(ptr ptr) diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c index e01ab2a35e7..cf694644008 100644 --- a/dlls/hid/hidd.c +++ b/dlls/hid/hidd.c @@ -103,6 +103,12 @@ BOOLEAN WINAPI HidD_GetManufacturerString( HANDLE file, void *buffer, ULONG buff return sync_ioctl( file, IOCTL_HID_GET_MANUFACTURER_STRING, NULL, 0, buffer, buffer_len ); } +BOOLEAN WINAPI HidD_GetMsGenreDescriptor( HANDLE file, void *buffer, ULONG buffer_len ) +{ + TRACE( "file %p, buffer %p, buffer_len %lu.\n", file, buffer, buffer_len ); + return sync_ioctl( file, IOCTL_HID_GET_MS_GENRE_DESCRIPTOR, NULL, 0, buffer, buffer_len ); +} + BOOLEAN WINAPI HidD_GetNumInputBuffers( HANDLE file, ULONG *num_buffer ) { TRACE( "file %p, num_buffer %p.\n", file, num_buffer ); diff --git a/include/ddk/hidsdi.h b/include/ddk/hidsdi.h index 72470079a79..6f19ced3331 100644 --- a/include/ddk/hidsdi.h +++ b/include/ddk/hidsdi.h @@ -40,6 +40,7 @@ void WINAPI HidD_GetHidGuid(LPGUID guid); BOOLEAN WINAPI HidD_GetIndexedString(HANDLE file, ULONG index, void *buffer, ULONG length); BOOLEAN WINAPI HidD_GetInputReport(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength); BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); +BOOLEAN WINAPI HidD_GetMsGenreDescriptor(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); BOOLEAN WINAPI HidD_GetNumInputBuffers(HANDLE HidDeviceObject, ULONG *NumberBuffers); BOOLEAN WINAPI HidD_GetPhysicalDescriptor(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); -- 2.35.1
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- dlls/dinput/tests/driver_bus.c | 5 +++++ dlls/dinput/tests/hid.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/dlls/dinput/tests/driver_bus.c b/dlls/dinput/tests/driver_bus.c index 6d7f86d0691..5a675bb99b0 100644 --- a/dlls/dinput/tests/driver_bus.c +++ b/dlls/dinput/tests/driver_bus.c @@ -1156,6 +1156,11 @@ static NTSTATUS WINAPI pdo_internal_ioctl( DEVICE_OBJECT *device, IRP *irp ) status = STATUS_SUCCESS; break; + case IOCTL_HID_GET_MS_GENRE_DESCRIPTOR: + irp->IoStatus.Information = 0; + status = STATUS_NOT_SUPPORTED; + break; + case IOCTL_GET_PHYSICAL_DESCRIPTOR: irp->IoStatus.Information = 0; status = STATUS_NOT_SUPPORTED; diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index 1059d6c2b57..cbf5de819af 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -1545,6 +1545,11 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle USHORT count; BOOL ret; + SetLastError( 0xdeadbeef ); + ret = HidD_GetMsGenreDescriptor( file, buffer, sizeof(buffer) ); + ok( !ret, "HidD_GetMsGenreDescriptor succeeded\n" ); + ok( GetLastError() == ERROR_NOT_SUPPORTED, "got error %lu\n", GetLastError() ); + SetLastError( 0xdeadbeef ); ret = HidD_GetPhysicalDescriptor( file, buffer, sizeof(buffer) ); ok( !ret, "HidD_GetPhysicalDescriptor succeeded\n" ); -- 2.35.1
On 4/1/22 05:43, Mohamad Al-Jaf wrote:
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf(a)gmail.com> --- dlls/hid/hid.spec | 2 +- dlls/hid/hidd.c | 6 ++++++ include/ddk/hidsdi.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
Hi Mohamad, looks alright but do you know a game which is calling it? -- Rémi Bernon <rbernon(a)codeweavers.com>
On Fri, Apr 1, 2022 at 4:16 AM Rémi Bernon <rbernon(a)codeweavers.com> wrote:
Hi Mohamad, looks alright but do you know a game which is calling it?
Hi Rémi, Thanks for the feedback. I haven't come across a game that calls it but seeing as how it doesn't add any significant upkeep I thought I'd implement it regardless. I'm sure there's at least 1 game out there that calls it but has yet to be discovered or reported. -- Kind regards, Mohamad
On 4/2/22 04:25, Mohamad Al-Jaf wrote:
On Fri, Apr 1, 2022 at 4:16 AM Rémi Bernon <rbernon(a)codeweavers.com> wrote:
Hi Mohamad, looks alright but do you know a game which is calling it?
Hi Rémi,
Thanks for the feedback.
I haven't come across a game that calls it but seeing as how it doesn't add any significant upkeep I thought I'd implement it regardless. I'm sure there's at least 1 game out there that calls it but has yet to be discovered or reported. -- Kind regards, Mohamad
Yeah I would rather wait to see if we find one. To the contrary to the physical descriptors, which are at least (very badly) documented in the HID specification, and for which I have a bit of hope we may be able to implement them if needed, I couldn't find any information about the MS genre descriptors and they seem to be completely Microsoft specific. They both seem optional anyway, so returning a not implemented status should be fine, but I think keeping the crash for now may help finding the game which would need it and maybe check what it wants to do with it. Cheers, -- Rémi Bernon <rbernon(a)codeweavers.com>
On Sun, Apr 3, 2022 at 9:07 AM Rémi Bernon <rbernon(a)codeweavers.com> wrote:
Yeah I would rather wait to see if we find one. To the contrary to the physical descriptors, which are at least (very badly) documented in the HID specification, and for which I have a bit of hope we may be able to implement them if needed, I couldn't find any information about the MS genre descriptors and they seem to be completely Microsoft specific.
They both seem optional anyway, so returning a not implemented status should be fine, but I think keeping the crash for now may help finding the game which would need it and maybe check what it wants to do with it.
Cheers, -- Rémi Bernon <rbernon(a)codeweavers.com>
Yeah, it's for internal system use only according to the Microsoft Docs, but developers sometimes choose to use internal functions regardless. Likewise, the only documentation I could find was the prototype in the Windows SDK. Well, if you think it's better to keep it unimplemented I won't challenge that decision. Your reasoning is sound. I just want to contribute in any way I can. -- Kind regards, Mohamad
participants (2)
-
Mohamad Al-Jaf -
Rémi Bernon