4 * Copyright (C) 2006 Kevin Koltzau
5 * Copyright (C) 2015 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/debug.h"
28 #define WIN32_NO_STATUS
36 #include "ddk/hidclass.h"
37 #include "ddk/hidpi.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(hid
);
41 BOOLEAN WINAPI
HidD_FreePreparsedData(PHIDP_PREPARSED_DATA PreparsedData
)
43 TRACE("(%p)\n", PreparsedData
);
44 HeapFree(GetProcessHeap(), 0, PreparsedData
);
48 BOOLEAN WINAPI
HidD_GetFeature(HANDLE HidDeviceObject
, PVOID ReportBuffer
, ULONG ReportBufferLength
)
50 TRACE("(%p %p %u)\n", HidDeviceObject
, ReportBuffer
, ReportBufferLength
);
51 return DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_FEATURE
, NULL
, 0, ReportBuffer
, ReportBufferLength
, NULL
, NULL
);
54 void WINAPI
HidD_GetHidGuid(LPGUID guid
)
56 TRACE("(%p)\n", guid
);
57 *guid
= GUID_DEVINTERFACE_HID
;
60 BOOLEAN WINAPI
HidD_GetInputReport(HANDLE HidDeviceObject
, PVOID ReportBuffer
, ULONG ReportBufferLength
)
62 TRACE("(%p %p %u) \n", HidDeviceObject
, ReportBuffer
, ReportBufferLength
);
63 return DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_INPUT_REPORT
, NULL
, 0, ReportBuffer
, ReportBufferLength
, NULL
, NULL
);
66 BOOLEAN WINAPI
HidD_GetManufacturerString(HANDLE HidDeviceObject
, PVOID Buffer
, ULONG BufferLength
)
68 TRACE("(%p %p %u) \n", HidDeviceObject
, Buffer
, BufferLength
);
69 return DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_MANUFACTURER_STRING
, NULL
, 0, Buffer
, BufferLength
, NULL
, NULL
);
72 BOOLEAN WINAPI
HidD_SetFeature(HANDLE HidDeviceObject
, PVOID ReportBuffer
, ULONG ReportBufferLength
)
74 TRACE("(%p %p %u)\n", HidDeviceObject
, ReportBuffer
, ReportBufferLength
);
75 return DeviceIoControl(HidDeviceObject
, IOCTL_HID_SET_FEATURE
, ReportBuffer
, ReportBufferLength
, NULL
, 0, NULL
, NULL
);
78 BOOLEAN WINAPI
HidD_GetProductString(HANDLE HidDeviceObject
, PVOID Buffer
, ULONG BufferLength
)
80 TRACE("(%p %p %u)\n", HidDeviceObject
, Buffer
, BufferLength
);
81 return DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_PRODUCT_STRING
, NULL
, 0, Buffer
, BufferLength
, NULL
, NULL
);
84 BOOLEAN WINAPI
HidD_GetPreparsedData(HANDLE HidDeviceObject
, PHIDP_PREPARSED_DATA
*PreparsedData
)
86 HID_COLLECTION_INFORMATION info
;
87 PHIDP_PREPARSED_DATA data
;
89 TRACE("(%p %p)\n", HidDeviceObject
, PreparsedData
);
91 if (!DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_COLLECTION_INFORMATION
, NULL
, 0,
92 &info
, sizeof(HID_COLLECTION_INFORMATION
), NULL
, NULL
))
95 if (!(data
= HeapAlloc(GetProcessHeap(), 0, info
.DescriptorSize
))) return FALSE
;
97 if (!DeviceIoControl(HidDeviceObject
, IOCTL_HID_GET_COLLECTION_DESCRIPTOR
, NULL
, 0,
98 data
, info
.DescriptorSize
, NULL
, NULL
))
100 HeapFree( GetProcessHeap(), 0, data
);
103 *PreparsedData
= data
;