advapi32: Link to msvcrt.dll.
[wine.git] / include / ddk / hidpi.h
blob8c970673ec1b63721f953d86be360f28d6dca85b
1 /*
2 * Copyright (C) 2015 Aric Stewart
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __HIDPI_H__
20 #define __HIDPI_H__
22 typedef enum _HIDP_REPORT_TYPE
24 HidP_Input,
25 HidP_Output,
26 HidP_Feature
27 } HIDP_REPORT_TYPE;
29 typedef struct _HIDP_BUTTON_CAPS
31 USAGE UsagePage;
32 UCHAR ReportID;
33 BOOLEAN IsAlias;
34 USHORT BitField;
35 USHORT LinkCollection;
36 USAGE LinkUsage;
37 USAGE LinkUsagePage;
39 BOOLEAN IsRange;
40 BOOLEAN IsStringRange;
41 BOOLEAN IsDesignatorRange;
42 BOOLEAN IsAbsolute;
43 ULONG Reserved[10];
44 union {
45 struct {
46 USAGE UsageMin;
47 USAGE UsageMax;
48 USHORT StringMin;
49 USHORT StringMax;
50 USHORT DesignatorMin;
51 USHORT DesignatorMax;
52 USHORT DataIndexMin;
53 USHORT DataIndexMax;
54 } Range;
55 struct {
56 USAGE Usage;
57 USAGE Reserved1;
58 USHORT StringIndex;
59 USHORT Reserved2;
60 USHORT DesignatorIndex;
61 USHORT Reserved3;
62 USHORT DataIndex;
63 USHORT Reserved4;
64 } NotRange;
65 } DUMMYUNIONNAME;
66 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
68 typedef struct _HIDP_VALUE_CAPS
70 USAGE UsagePage;
71 UCHAR ReportID;
72 BOOLEAN IsAlias;
73 USHORT BitField;
74 USHORT LinkCollection;
75 USAGE LinkUsage;
76 USAGE LinkUsagePage;
78 BOOLEAN IsRange;
79 BOOLEAN IsStringRange;
80 BOOLEAN IsDesignatorRange;
81 BOOLEAN IsAbsolute;
82 BOOLEAN HasNull;
83 UCHAR Reserved;
84 USHORT BitSize;
85 USHORT ReportCount;
86 USHORT Reserved2[5];
87 ULONG UnitsExp;
88 ULONG Units;
89 LONG LogicalMin;
90 LONG LogicalMax;
91 LONG PhysicalMin;
92 LONG PhysicalMax;
93 union {
94 struct {
95 USAGE UsageMin;
96 USAGE UsageMax;
97 USHORT StringMin;
98 USHORT StringMax;
99 USHORT DesignatorMin;
100 USHORT DesignatorMax;
101 USHORT DataIndexMin;
102 USHORT DataIndexMax;
103 } Range;
104 struct {
105 USAGE Usage;
106 USAGE Reserved1;
107 USHORT StringIndex;
108 USHORT Reserved2;
109 USHORT DesignatorIndex;
110 USHORT Reserved3;
111 USHORT DataIndex;
112 USHORT Reserved4;
113 } NotRange;
114 } DUMMYUNIONNAME;
115 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
117 typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
119 typedef struct _HIDP_CAPS
121 USAGE Usage;
122 USAGE UsagePage;
123 USHORT InputReportByteLength;
124 USHORT OutputReportByteLength;
125 USHORT FeatureReportByteLength;
126 USHORT Reserved[17];
127 USHORT NumberLinkCollectionNodes;
128 USHORT NumberInputButtonCaps;
129 USHORT NumberInputValueCaps;
130 USHORT NumberInputDataIndices;
131 USHORT NumberOutputButtonCaps;
132 USHORT NumberOutputValueCaps;
133 USHORT NumberOutputDataIndices;
134 USHORT NumberFeatureButtonCaps;
135 USHORT NumberFeatureValueCaps;
136 USHORT NumberFeatureDataIndices;
137 } HIDP_CAPS, *PHIDP_CAPS;
139 typedef enum _HIDP_KEYBOARD_DIRECTION {
140 HidP_Keyboard_Break,
141 HidP_Keyboard_Make
142 } HIDP_KEYBOARD_DIRECTION;
144 typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
145 union {
146 struct {
147 ULONG LeftControl: 1;
148 ULONG LeftShift: 1;
149 ULONG LeftAlt: 1;
150 ULONG LeftGUI: 1;
151 ULONG RightControl: 1;
152 ULONG RightShift: 1;
153 ULONG RightAlt: 1;
154 ULONG RigthGUI: 1;
155 ULONG CapsLock: 1;
156 ULONG ScollLock: 1;
157 ULONG NumLock: 1;
158 ULONG Reserved: 21;
159 } DUMMYSTRUCTNAME;
160 ULONG ul;
161 } DUMMYUNIONNAME;
162 } HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
164 typedef struct _USAGE_AND_PAGE {
165 USAGE Usage;
166 USAGE UsagePage;
167 } USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
169 typedef struct _HIDP_DATA {
170 USHORT DataIndex;
171 USHORT Reserved;
172 union {
173 ULONG RawValue;
174 BOOLEAN On;
175 } DUMMYUNIONNAME;
176 } HIDP_DATA, *PHIDP_DATA;
178 typedef struct _HIDP_LINK_COLLECTION_NODE {
179 USAGE LinkUsage;
180 USAGE LinkUsagePage;
181 USHORT Parent;
182 USHORT NumberOfChildren;
183 USHORT NextSibling;
184 USHORT FirstChild;
185 ULONG CollectionType : 8;
186 ULONG IsAlias : 1;
187 ULONG Reserved : 23;
188 PVOID UserContext;
189 } HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
191 typedef BOOLEAN (NTAPI *PHIDP_INSERT_SCANCODES) (VOID *Context, CHAR *NewScanCodes, ULONG Length);
194 NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
195 NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
196 NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
197 NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
198 NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
199 NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
200 NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
201 ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData);
202 NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
203 NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
204 NTSTATUS WINAPI HidP_SetUsageValueArray( HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection,
205 USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength,
206 PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength );
207 NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
208 USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength,
209 PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
210 NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext);
211 NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
212 NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
213 NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollection, USAGE_AND_PAGE *ButtonList, ULONG *UsageLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
214 ULONG WINAPI HidP_MaxDataListLength(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData);
215 NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, ULONG *DataLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
216 NTSTATUS WINAPI HidP_GetLinkCollectionNodes(HIDP_LINK_COLLECTION_NODE *LinkCollectionNode, ULONG *LinkCollectionNodeLength, PHIDP_PREPARSED_DATA PreparsedData);
218 #ifndef FACILITY_HID_ERROR_CODE
219 #define FACILITY_HID_ERROR_CODE 0x11
220 #endif
222 #define HIDP_ERROR_CODES(sev, code) ((NTSTATUS)(((sev) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (code)))
224 #define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0u,0x00))
225 #define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8u,0x01))
226 #define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xcu,0x01))
227 #define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xcu,0x02))
228 #define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xcu,0x03))
229 #define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x04))
230 #define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x05))
231 #define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xcu,0x06))
232 #define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xcu,0x07))
233 #define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xcu,0x08))
234 #define HIDP_STATUS_I8242_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xcu,0x09))
235 #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xcu,0x0a))
236 #define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0b))
237 #define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0c))
238 #define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x0d))
239 #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x0e))
240 #define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xcu,0x0f))
241 #define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xcu,0x10))
242 #define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xcu,0x20))
244 #endif /* __HIDPI_H__ */