hid: Implement HidD_GetPreparsedData and HidD_FreePreparsedData.

This commit is contained in:
Aric Stewart 2015-06-30 07:40:13 -05:00 committed by Alexandre Julliard
parent 30480a2369
commit 5b790bde5e
4 changed files with 45 additions and 2 deletions

View File

@ -1,5 +1,5 @@
@ stub HidD_FlushQueue
@ stub HidD_FreePreparsedData
@ stdcall HidD_FreePreparsedData(ptr)
@ stub HidD_GetAttributes
@ stub HidD_GetConfiguration
@ stdcall HidD_GetFeature(long ptr long)
@ -10,7 +10,7 @@
@ stub HidD_GetMsGenreDescriptor
@ stub HidD_GetNumInputBuffers
@ stub HidD_GetPhysicalDescriptor
@ stub HidD_GetPreparsedData
@ stdcall HidD_GetPreparsedData(ptr ptr)
@ stdcall HidD_GetProductString(long ptr long)
@ stub HidD_GetSerialNumberString
@ stub HidD_Hello

View File

@ -32,10 +32,19 @@
#include "winioctl.h"
#include "ddk/wdm.h"
#include "hidusage.h"
#include "ddk/hidclass.h"
#include "ddk/hidpi.h"
WINE_DEFAULT_DEBUG_CHANNEL(hid);
BOOLEAN WINAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData)
{
TRACE("(%p)\n", PreparsedData);
HeapFree(GetProcessHeap(), 0, PreparsedData);
return TRUE;
}
BOOLEAN WINAPI HidD_GetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength)
{
TRACE("(%p %p %u)\n", HidDeviceObject, ReportBuffer, ReportBufferLength);
@ -65,3 +74,26 @@ BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG
TRACE("(%p %p %u)\n", HidDeviceObject, Buffer, BufferLength);
return DeviceIoControl(HidDeviceObject, IOCTL_HID_GET_PRODUCT_STRING, NULL, 0, Buffer, BufferLength, NULL, NULL);
}
BOOLEAN WINAPI HidD_GetPreparsedData(HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData)
{
HID_COLLECTION_INFORMATION info;
PHIDP_PREPARSED_DATA data;
TRACE("(%p %p)\n", HidDeviceObject, PreparsedData);
if (!DeviceIoControl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_INFORMATION, NULL, 0,
&info, sizeof(HID_COLLECTION_INFORMATION), NULL, NULL))
return FALSE;
if (!(data = HeapAlloc(GetProcessHeap(), 0, info.DescriptorSize))) return FALSE;
if (!DeviceIoControl(HidDeviceObject, IOCTL_HID_GET_COLLECTION_DESCRIPTOR, NULL, 0,
data, info.DescriptorSize, NULL, NULL))
{
HeapFree( GetProcessHeap(), 0, data );
return FALSE;
}
*PreparsedData = data;
return TRUE;
}

View File

@ -56,6 +56,15 @@ DEFINE_GUID (GUID_DEVINTERFACE_HID, \
#define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
#define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
typedef struct _HID_COLLECTION_INFORMATION {
ULONG DescriptorSize;
BOOLEAN Polled;
UCHAR Reserved1[1];
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
#ifdef __cplusplus
}
#endif

View File

@ -32,5 +32,7 @@ void WINAPI HidD_GetHidGuid(LPGUID guid);
BOOLEAN WINAPI HidD_GetManufacturerString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength);
BOOLEAN WINAPI HidD_GetProductString(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength);
BOOLEAN WINAPI HidD_SetFeature(HANDLE HidDeviceObject, PVOID ReportBuffer, ULONG ReportBufferLength);
BOOLEAN WINAPI HidD_GetPreparsedData( HANDLE HidDeviceObject, PHIDP_PREPARSED_DATA *PreparsedData);
BOOLEAN WINAPI HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData);
#endif /* __WINE_HIDSDI_H */