xref: /reactos/sdk/include/psdk/hidpi.h (revision c2c66aff)
1 /*
2  * hidpi.h
3  *
4  * Public Interface for HID parsing library.
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef __HIDPI_H__
24 #define __HIDPI_H__
25 
26 #include "hidusage.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #if defined(_HIDPI_)
33   #define HIDAPI
34 #else
35   #define HIDAPI DECLSPEC_IMPORT
36 #endif
37 
38 typedef PUCHAR PHIDP_REPORT_DESCRIPTOR;
39 typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
40 
41 typedef struct _HIDP_UNKNOWN_TOKEN {
42   UCHAR  Token;
43   UCHAR  Reserved[3];
44   ULONG  BitField;
45 } HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN;
46 
47 typedef enum _HIDP_KEYBOARD_DIRECTION {
48   HidP_Keyboard_Break,
49   HidP_Keyboard_Make
50 } HIDP_KEYBOARD_DIRECTION;
51 
52 typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
53   _ANONYMOUS_UNION union {
54     _ANONYMOUS_STRUCT struct {
55       ULONG  LeftControl : 1;
56       ULONG  LeftShift : 1;
57       ULONG  LeftAlt : 1;
58       ULONG  LeftGUI : 1;
59       ULONG  RightControl : 1;
60       ULONG  RightShift : 1;
61       ULONG  RightAlt : 1;
62       ULONG  RigthGUI : 1;
63       ULONG  CapsLock : 1;
64       ULONG  ScollLock : 1;
65       ULONG  NumLock : 1;
66       ULONG  Reserved : 21;
67     } DUMMYSTRUCTNAME;
68     ULONG ul;
69   } DUMMYUNIONNAME;
70 } HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
71 
72 typedef BOOLEAN
73 (NTAPI *PHIDP_INSERT_SCANCODES)(
74   _In_opt_ PVOID Context,
75   _In_reads_bytes_(Length) PCHAR NewScanCodes,
76   _In_ ULONG Length);
77 
78 typedef struct _USAGE_AND_PAGE {
79   USAGE  Usage;
80   USAGE  UsagePage;
81 } USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
82 
83 typedef struct _HIDD_ATTRIBUTES {
84   ULONG   Size;
85   USHORT  VendorID;
86   USHORT  ProductID;
87   USHORT  VersionNumber;
88 } HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
89 
90 typedef struct _HIDD_CONFIGURATION {
91   PVOID  cookie;
92   ULONG  size;
93   ULONG  RingBufferSize;
94 } HIDD_CONFIGURATION, *PHIDD_CONFIGURATION;
95 
96 _Must_inspect_result_
97 HIDAPI
98 NTSTATUS
99 NTAPI
100 HidP_TranslateUsageAndPagesToI8042ScanCodes(
101   _In_reads_(UsageListLength) PUSAGE_AND_PAGE ChangedUsageList,
102   _In_ ULONG UsageListLength,
103   _In_ HIDP_KEYBOARD_DIRECTION KeyAction,
104   _Inout_ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
105   _In_ PHIDP_INSERT_SCANCODES InsertCodesProcedure,
106   _In_opt_ PVOID InsertCodesContext);
107 
108 _Must_inspect_result_
109 HIDAPI
110 NTSTATUS
111 NTAPI
112 HidP_TranslateUsagesToI8042ScanCodes(
113   _In_reads_(UsageListLength) PUSAGE ChangedUsageList,
114   _In_ ULONG UsageListLength,
115   _In_ HIDP_KEYBOARD_DIRECTION KeyAction,
116   _Inout_ PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
117   _In_ PHIDP_INSERT_SCANCODES InsertCodesProcedure,
118   _In_opt_ PVOID InsertCodesContext);
119 
120 typedef struct _HIDP_BUTTON_CAPS {
121   USAGE  UsagePage;
122   UCHAR  ReportID;
123   BOOLEAN  IsAlias;
124   USHORT  BitField;
125   USHORT  LinkCollection;
126   USAGE  LinkUsage;
127   USAGE  LinkUsagePage;
128   BOOLEAN  IsRange;
129   BOOLEAN  IsStringRange;
130   BOOLEAN  IsDesignatorRange;
131   BOOLEAN  IsAbsolute;
132   ULONG  Reserved[10];
133   _ANONYMOUS_UNION union {
134     struct {
135       USAGE  UsageMin, UsageMax;
136       USHORT  StringMin, StringMax;
137       USHORT  DesignatorMin, DesignatorMax;
138       USHORT  DataIndexMin, DataIndexMax;
139     } Range;
140     struct  {
141        USAGE  Usage, Reserved1;
142        USHORT  StringIndex, Reserved2;
143        USHORT  DesignatorIndex, Reserved3;
144        USHORT  DataIndex, Reserved4;
145     } NotRange;
146   } DUMMYUNIONNAME;
147 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
148 
149 typedef struct _HIDP_CAPS {
150   USAGE  Usage;
151   USAGE  UsagePage;
152   USHORT  InputReportByteLength;
153   USHORT  OutputReportByteLength;
154   USHORT  FeatureReportByteLength;
155   USHORT  Reserved[17];
156   USHORT  NumberLinkCollectionNodes;
157   USHORT  NumberInputButtonCaps;
158   USHORT  NumberInputValueCaps;
159   USHORT  NumberInputDataIndices;
160   USHORT  NumberOutputButtonCaps;
161   USHORT  NumberOutputValueCaps;
162   USHORT  NumberOutputDataIndices;
163   USHORT  NumberFeatureButtonCaps;
164   USHORT  NumberFeatureValueCaps;
165   USHORT  NumberFeatureDataIndices;
166 } HIDP_CAPS, *PHIDP_CAPS;
167 
168 typedef struct _HIDP_DATA {
169   USHORT  DataIndex;
170   USHORT  Reserved;
171   _ANONYMOUS_UNION union {
172     ULONG  RawValue;
173     BOOLEAN  On;
174   }  DUMMYUNIONNAME;
175 } HIDP_DATA, *PHIDP_DATA;
176 
177 typedef struct _HIDP_EXTENDED_ATTRIBUTES {
178   UCHAR  NumGlobalUnknowns;
179   UCHAR  Reserved[3];
180   PHIDP_UNKNOWN_TOKEN  GlobalUnknowns;
181   ULONG  Data[1];
182 } HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES;
183 
184 #define HIDP_LINK_COLLECTION_ROOT         ((USHORT) -1)
185 #define HIDP_LINK_COLLECTION_UNSPECIFIED  ((USHORT) 0)
186 
187 typedef struct _HIDP_LINK_COLLECTION_NODE {
188   USAGE  LinkUsage;
189   USAGE  LinkUsagePage;
190   USHORT  Parent;
191   USHORT  NumberOfChildren;
192   USHORT  NextSibling;
193   USHORT  FirstChild;
194   ULONG  CollectionType: 8;
195   ULONG  IsAlias: 1;
196   ULONG  Reserved: 23;
197   PVOID  UserContext;
198 } HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
199 
200 typedef struct _HIDP_VALUE_CAPS {
201   USAGE  UsagePage;
202   UCHAR  ReportID;
203   BOOLEAN  IsAlias;
204   USHORT  BitField;
205   USHORT  LinkCollection;
206   USAGE  LinkUsage;
207   USAGE  LinkUsagePage;
208   BOOLEAN  IsRange;
209   BOOLEAN  IsStringRange;
210   BOOLEAN  IsDesignatorRange;
211   BOOLEAN  IsAbsolute;
212   BOOLEAN  HasNull;
213   UCHAR  Reserved;
214   USHORT  BitSize;
215   USHORT  ReportCount;
216   USHORT  Reserved2[5];
217   ULONG  UnitsExp;
218   ULONG  Units;
219   LONG  LogicalMin, LogicalMax;
220   LONG  PhysicalMin, PhysicalMax;
221     _ANONYMOUS_UNION union {
222       struct {
223         USAGE  UsageMin, UsageMax;
224         USHORT  StringMin, StringMax;
225         USHORT  DesignatorMin, DesignatorMax;
226         USHORT  DataIndexMin, DataIndexMax;
227       } Range;
228       struct {
229         USAGE  Usage, Reserved1;
230         USHORT  StringIndex, Reserved2;
231         USHORT  DesignatorIndex, Reserved3;
232         USHORT  DataIndex, Reserved4;
233       } NotRange;
234     } DUMMYUNIONNAME;
235 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
236 
237 typedef enum _HIDP_REPORT_TYPE {
238   HidP_Input,
239   HidP_Output,
240   HidP_Feature
241 } HIDP_REPORT_TYPE;
242 
243 #define FACILITY_HID_ERROR_CODE           0x11
244 
245 #define HIDP_ERROR_CODES(SEV, CODE) \
246   ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
247 
248 #define HIDP_STATUS_SUCCESS                 (HIDP_ERROR_CODES(0x0, 0))
249 #define HIDP_STATUS_NULL                    (HIDP_ERROR_CODES(0x8, 1))
250 #define HIDP_STATUS_INVALID_PREPARSED_DATA  (HIDP_ERROR_CODES(0xC, 1))
251 #define HIDP_STATUS_INVALID_REPORT_TYPE     (HIDP_ERROR_CODES(0xC, 2))
252 #define HIDP_STATUS_INVALID_REPORT_LENGTH   (HIDP_ERROR_CODES(0xC, 3))
253 #define HIDP_STATUS_USAGE_NOT_FOUND         (HIDP_ERROR_CODES(0xC, 4))
254 #define HIDP_STATUS_VALUE_OUT_OF_RANGE      (HIDP_ERROR_CODES(0xC, 5))
255 #define HIDP_STATUS_BAD_LOG_PHY_VALUES      (HIDP_ERROR_CODES(0xC, 6))
256 #define HIDP_STATUS_BUFFER_TOO_SMALL        (HIDP_ERROR_CODES(0xC, 7))
257 #define HIDP_STATUS_INTERNAL_ERROR          (HIDP_ERROR_CODES(0xC, 8))
258 #define HIDP_STATUS_I8042_TRANS_UNKNOWN     (HIDP_ERROR_CODES(0xC, 9))
259 #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID  (HIDP_ERROR_CODES(0xC, 0xA))
260 #define HIDP_STATUS_NOT_VALUE_ARRAY         (HIDP_ERROR_CODES(0xC, 0xB))
261 #define HIDP_STATUS_IS_VALUE_ARRAY          (HIDP_ERROR_CODES(0xC, 0xC))
262 #define HIDP_STATUS_DATA_INDEX_NOT_FOUND    (HIDP_ERROR_CODES(0xC, 0xD))
263 #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xC, 0xE))
264 #define HIDP_STATUS_BUTTON_NOT_PRESSED      (HIDP_ERROR_CODES(0xC, 0xF))
265 #define HIDP_STATUS_REPORT_DOES_NOT_EXIST   (HIDP_ERROR_CODES(0xC, 0x10))
266 #define HIDP_STATUS_NOT_IMPLEMENTED         (HIDP_ERROR_CODES(0xC, 0x20))
267 #define HIDP_STATUS_I8242_TRANS_UNKNOWN     HIDP_STATUS_I8042_TRANS_UNKNOWN
268 
269 
270 #if !defined(_HIDPI_NO_FUNCTION_MACROS_)
271 /*
272  * NTSTATUS
273  * HidP_GetButtonCaps(
274  *   IN HIDP_REPORT_TYPE  ReportType,
275  *   OUT PHIDP_BUTTON_CAPS  ButtonCaps,
276  *   IN OUT PULONG  ButtonCapsLength,
277  *   IN PHIDP_PREPARSED_DATA  PreparsedData);
278  */
279 #define HidP_GetButtonCaps(_Type_, _Caps_, _Len_, _Data_) \
280   HidP_GetSpecificButtonCaps(_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
281 
282 /*
283  * NTSTATUS
284  * HidP_GetButtons(
285  *   IN HIDP_REPORT_TYPE  ReportType,
286  *   IN USAGE  UsagePage,
287  *   IN USHORT  LinkCollection,
288  *   OUT USAGE  *UsageList,
289  *   IN OUT ULONG  *UsageLength,
290  *   IN PHIDP_PREPARSED_DATA  PreparsedData,
291  *   IN PCHAR  Report,
292  *   IN ULONG  ReportLength);
293  */
294 #define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \
295   HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe)
296 
297 #define HidP_GetButtonListLength(RTy, UPa, Ppd) \
298   HidP_GetUsageListLength(Rty, UPa, Ppd)
299 
300 
301 /*
302  * NTSTATUS
303  * HidP_GetButtonsEx(
304  *   IN HIDP_REPORT_TYPE  ReportType,
305  *   IN USHORT  LinkCollection,
306  *   OUT PUSAGE_AND_PAGE  ButtonList,
307  *   IN OUT ULONG  *UsageLength,
308  *   IN PHIDP_PREPARSED_DATA  PreparsedData,
309  *   IN PCHAR  Report,
310  *   IN ULONG  ReportLength);
311  */
312 #define HidP_GetButtonsEx(RT, LC, BL, UL, PD, R, RL)  \
313   HidP_GetUsagesEx(RT, LC, BL, UL, PD, R, RL)
314 
315 #endif /* _HIDPI_NO_FUNCTION_MACROS_ */
316 
317 _Must_inspect_result_
318 _IRQL_requires_max_(PASSIVE_LEVEL)
319 HIDAPI
320 NTSTATUS
321 NTAPI
322 HidP_GetCaps(
323   _In_ PHIDP_PREPARSED_DATA PreparsedData,
324   _Out_ PHIDP_CAPS Capabilities);
325 
326 _Must_inspect_result_
327 _IRQL_requires_max_(DISPATCH_LEVEL)
328 HIDAPI
329 NTSTATUS
330 NTAPI
331 HidP_GetData(
332   _In_ HIDP_REPORT_TYPE ReportType,
333   _Out_writes_to_(*DataLength, *DataLength) PHIDP_DATA DataList,
334   _Inout_ PULONG DataLength,
335   _In_ PHIDP_PREPARSED_DATA PreparsedData,
336   _Out_writes_bytes_(ReportLength) PCHAR Report,
337   _In_ ULONG ReportLength);
338 
339 _Must_inspect_result_
340 _IRQL_requires_max_(DISPATCH_LEVEL)
341 HIDAPI
342 NTSTATUS
343 NTAPI
344 HidP_GetExtendedAttributes(
345   _In_ HIDP_REPORT_TYPE ReportType,
346   _In_ USHORT DataIndex,
347   _In_ PHIDP_PREPARSED_DATA PreparsedData,
348   _Out_writes_to_(*LengthAttributes, *LengthAttributes) PHIDP_EXTENDED_ATTRIBUTES Attributes,
349   _Inout_ OUT PULONG LengthAttributes);
350 
351 _Must_inspect_result_
352 _IRQL_requires_max_(DISPATCH_LEVEL)
353 HIDAPI
354 NTSTATUS
355 NTAPI
356 HidP_GetLinkCollectionNodes(
357   _Out_ PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
358   _Inout_ PULONG LinkCollectionNodesLength,
359   _In_ PHIDP_PREPARSED_DATA PreparsedData);
360 
361 _Must_inspect_result_
362 HIDAPI
363 NTSTATUS
364 NTAPI
365 HidP_GetScaledUsageValue(
366   _In_ HIDP_REPORT_TYPE ReportType,
367   _In_ USAGE UsagePage,
368   _In_ USHORT LinkCollection,
369   _In_ USAGE Usage,
370   _Out_ PLONG UsageValue,
371   _In_ PHIDP_PREPARSED_DATA PreparsedData,
372   _In_reads_bytes_(ReportLength) PCHAR Report,
373   _In_ ULONG ReportLength);
374 
375 _Must_inspect_result_
376 _IRQL_requires_max_(PASSIVE_LEVEL)
377 HIDAPI
378 NTSTATUS
379 NTAPI
380 HidP_GetSpecificButtonCaps(
381   _In_ HIDP_REPORT_TYPE ReportType,
382   _In_ USAGE UsagePage,
383   _In_ USHORT LinkCollection,
384   _In_ USAGE Usage,
385   _Out_ PHIDP_BUTTON_CAPS ButtonCaps,
386   _Inout_ PUSHORT ButtonCapsLength,
387   _In_ PHIDP_PREPARSED_DATA PreparsedData);
388 
389 _Must_inspect_result_
390 _IRQL_requires_max_(DISPATCH_LEVEL)
391 HIDAPI
392 NTSTATUS
393 NTAPI
394 HidP_GetSpecificValueCaps(
395   _In_ HIDP_REPORT_TYPE ReportType,
396   _In_ USAGE UsagePage,
397   _In_ USHORT LinkCollection,
398   _In_ USAGE Usage,
399   _Out_ PHIDP_VALUE_CAPS ValueCaps,
400   _Inout_ PUSHORT ValueCapsLength,
401   _In_ PHIDP_PREPARSED_DATA PreparsedData);
402 
403 _Must_inspect_result_
404 HIDAPI
405 NTSTATUS
406 NTAPI
407 HidP_GetUsages(
408   _In_ HIDP_REPORT_TYPE ReportType,
409   _In_ USAGE UsagePage,
410   _In_ USHORT LinkCollection,
411   _Out_writes_to_(*UsageLength, *UsageLength) USAGE *UsageList,
412   _Inout_ ULONG *UsageLength,
413   _In_ PHIDP_PREPARSED_DATA PreparsedData,
414   _Out_writes_bytes_(ReportLength) PCHAR Report,
415   _In_ ULONG ReportLength);
416 
417 _Must_inspect_result_
418 _IRQL_requires_max_(DISPATCH_LEVEL)
419 HIDAPI
420 NTSTATUS
421 NTAPI
422 HidP_GetUsagesEx(
423   _In_ HIDP_REPORT_TYPE ReportType,
424   _In_ USHORT LinkCollection,
425   _Inout_updates_to_(*UsageLength, *UsageLength) PUSAGE_AND_PAGE ButtonList,
426   _Inout_ ULONG *UsageLength,
427   _In_ PHIDP_PREPARSED_DATA PreparsedData,
428   _In_reads_bytes_(ReportLength) PCHAR Report,
429   _In_ ULONG ReportLength);
430 
431 _Must_inspect_result_
432 HIDAPI
433 NTSTATUS
434 NTAPI
435 HidP_GetUsageValue(
436   _In_ HIDP_REPORT_TYPE ReportType,
437   _In_ USAGE UsagePage,
438   _In_ USHORT LinkCollection,
439   _In_ USAGE Usage,
440   _Out_ PULONG UsageValue,
441   _In_ PHIDP_PREPARSED_DATA PreparsedData,
442   _In_reads_bytes_(ReportLength) PCHAR Report,
443   _In_ ULONG ReportLength);
444 
445 _Must_inspect_result_
446 HIDAPI
447 NTSTATUS
448 NTAPI
449 HidP_GetUsageValueArray(
450   _In_ HIDP_REPORT_TYPE ReportType,
451   _In_ USAGE UsagePage,
452   _In_ USHORT LinkCollection,
453   _In_ USAGE Usage,
454   _Inout_updates_bytes_(UsageValueByteLength) PCHAR UsageValue,
455   _In_ USHORT UsageValueByteLength,
456   _In_ PHIDP_PREPARSED_DATA PreparsedData,
457   _In_reads_bytes_(ReportLength) PCHAR Report,
458   _In_ ULONG ReportLength);
459 
460 #if !defined(_HIDPI_NO_FUNCTION_MACROS_)
461 
462 /*
463  * NTSTATUS
464  * HidP_GetValueCaps(
465  *   IN HIDP_REPORT_TYPE  ReportType,
466  *   OUT PHIDP_VALUE_CAPS  ValueCaps,
467  *   IN OUT PULONG  ValueCapsLength,
468  *   IN PHIDP_PREPARSED_DATA  PreparsedData);
469  */
470 #define HidP_GetValueCaps(_Type_, _Caps_, _Len_, _Data_) \
471   HidP_GetSpecificValueCaps (_Type_, 0, 0, 0, _Caps_, _Len_, _Data_)
472 
473 #endif /* _HIDPI_NO_FUNCTION_MACROS_ */
474 
475 _Must_inspect_result_
476 _IRQL_requires_max_(DISPATCH_LEVEL)
477 HIDAPI
478 NTSTATUS
479 NTAPI
480 HidP_InitializeReportForID(
481   _In_ HIDP_REPORT_TYPE ReportType,
482   _In_ UCHAR ReportID,
483   _In_ PHIDP_PREPARSED_DATA PreparsedData,
484   _Out_writes_bytes_(ReportLength) PCHAR Report,
485   _In_ ULONG ReportLength);
486 
487 #if !defined(_HIDPI_NO_FUNCTION_MACROS_)
488 
489 /*
490  * BOOLEAN
491  * HidP_IsSameUsageAndPage(
492  *   USAGE_AND_PAGE  u1,
493  *   USAGE_AND_PAGE  u2);
494  */
495 #define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2))
496 
497 #endif /* _HIDPI_NO_FUNCTION_MACROS_ */
498 
499 _IRQL_requires_max_(DISPATCH_LEVEL)
500 HIDAPI
501 ULONG
502 NTAPI
503 HidP_MaxDataListLength(
504   _In_ HIDP_REPORT_TYPE ReportType,
505   _In_ PHIDP_PREPARSED_DATA PreparsedData);
506 
507 _IRQL_requires_max_(PASSIVE_LEVEL)
508 HIDAPI
509 ULONG
510 NTAPI
511 HidP_MaxUsageListLength(
512   _In_ HIDP_REPORT_TYPE ReportType,
513   _In_ USAGE UsagePage,
514   _In_ PHIDP_PREPARSED_DATA PreparsedData);
515 
516 #if !defined(_HIDPI_NO_FUNCTION_MACROS_)
517 
518 /*
519  * NTSTATUS
520  * HidP_SetButtons(
521  *   IN HIDP_REPORT_TYPE  ReportType,
522  *   IN USAGE  UsagePage,
523  *   IN USHORT  LinkCollection,
524  *   IN PUSAGE  UsageList,
525  *   IN OUT PULONG  UsageLength,
526  *   IN PHIDP_PREPARSED_DATA  PreparsedData,
527  *   IN OUT PCHAR  Report,
528  *   IN ULONG  ReportLength);
529  */
530 #define HidP_SetButtons(RT, UP, LC, UL1, UL2, PD, R, RL) \
531   HidP_SetUsages(RT, UP, LC, UL1, UL2, PD, R, RL)
532 
533 #endif /* _HIDPI_NO_FUNCTION_MACROS_ */
534 
535 _Must_inspect_result_
536 HIDAPI
537 NTSTATUS
538 NTAPI
539 HidP_SetData(
540   _In_ HIDP_REPORT_TYPE ReportType,
541   _Inout_updates_to_(*DataLength, *DataLength) PHIDP_DATA DataList,
542   _Inout_ PULONG DataLength,
543   _In_ PHIDP_PREPARSED_DATA  PreparsedData,
544   _In_reads_bytes_(ReportLength) PCHAR Report,
545   _In_ ULONG ReportLength);
546 
547 _Must_inspect_result_
548 HIDAPI
549 NTSTATUS
550 NTAPI
551 HidP_SetScaledUsageValue(
552   _In_ HIDP_REPORT_TYPE ReportType,
553   _In_ USAGE UsagePage,
554   _In_ USHORT LinkCollection,
555   _In_ USAGE Usage,
556   _In_ LONG UsageValue,
557   _In_ PHIDP_PREPARSED_DATA PreparsedData,
558   _Inout_updates_bytes_(ReportLength) PCHAR Report,
559   _In_ ULONG ReportLength);
560 
561 _Must_inspect_result_
562 HIDAPI
563 NTSTATUS
564 NTAPI
565 HidP_SetUsages(
566   _In_ HIDP_REPORT_TYPE ReportType,
567   _In_ USAGE UsagePage,
568   _In_ USHORT LinkCollection, /* Optional */
569   _Inout_updates_to_(*UsageLength, *UsageLength) PUSAGE UsageList,
570   _Inout_ PULONG UsageLength,
571   _In_ PHIDP_PREPARSED_DATA PreparsedData,
572   _In_reads_bytes_(ReportLength) PCHAR Report,
573   _In_ ULONG ReportLength);
574 
575 _Must_inspect_result_
576 HIDAPI
577 NTSTATUS
578 NTAPI
579 HidP_SetUsageValue(
580   _In_ HIDP_REPORT_TYPE ReportType,
581   _In_ USAGE UsagePage,
582   _In_ USHORT LinkCollection,
583   _In_ USAGE Usage,
584   _In_ ULONG UsageValue,
585   _In_ PHIDP_PREPARSED_DATA PreparsedData,
586   _Inout_updates_bytes_(ReportLength) PCHAR Report,
587   _In_ ULONG ReportLength);
588 
589 _Must_inspect_result_
590 HIDAPI
591 NTSTATUS
592 NTAPI
593 HidP_SetUsageValueArray(
594   _In_ HIDP_REPORT_TYPE ReportType,
595   _In_ USAGE UsagePage,
596   _In_ USHORT LinkCollection,
597   _In_ USAGE Usage,
598   _In_reads_bytes_(UsageValueByteLength) PCHAR UsageValue,
599   _In_ USHORT UsageValueByteLength,
600   _In_ PHIDP_PREPARSED_DATA PreparsedData,
601   _Inout_updates_bytes_(ReportLength) PCHAR Report,
602   _In_ ULONG ReportLength);
603 
604 #if !defined(_HIDPI_NO_FUNCTION_MACROS_)
605 
606 /*
607  * NTSTATUS
608  * HidP_UnsetButtons(
609  *   IN HIDP_REPORT_TYPE  ReportType,
610  *   IN USAGE  UsagePage,
611  *   IN USHORT  LinkCollection,
612  *   IN PUSAGE  UsageList,
613  *   IN OUT PULONG  UsageLength,
614  *   IN PHIDP_PREPARSED_DATA  PreparsedData,
615  *   IN OUT PCHAR  Report,
616  *   IN ULONG  ReportLength);
617  */
618 #define HidP_UnsetButtons(RT, UP, LC, UL1, UL2, PD, R, RL) \
619   HidP_UnsetUsages(RT, UP, LC, UL1, UL2, PD, R, RL)
620 
621 #endif /* _HIDPI_NO_FUNCTION_MACROS_ */
622 
623 _Must_inspect_result_
624 HIDAPI
625 NTSTATUS
626 NTAPI
627 HidP_UnsetUsages(
628   _In_ HIDP_REPORT_TYPE ReportType,
629   _In_ USAGE UsagePage,
630   _In_opt_ USHORT LinkCollection,
631   _Inout_updates_to_(*UsageLength, *UsageLength) PUSAGE UsageList,
632   _Inout_ PULONG UsageLength,
633   _In_ PHIDP_PREPARSED_DATA PreparsedData,
634   _In_reads_bytes_(ReportLength) PCHAR Report,
635   _In_ ULONG ReportLength);
636 
637 _Must_inspect_result_
638 _IRQL_requires_max_(PASSIVE_LEVEL)
639 HIDAPI
640 NTSTATUS
641 NTAPI
642 HidP_UsageAndPageListDifference(
643   _In_reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList,
644   _In_reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList,
645   _Out_writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList,
646   _Out_writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList,
647   _In_ ULONG UsageListLength);
648 
649 _Must_inspect_result_
650 _IRQL_requires_max_(PASSIVE_LEVEL)
651 HIDAPI
652 NTSTATUS
653 NTAPI
654 HidP_UsageListDifference(
655   _In_reads_(UsageListLength) PUSAGE PreviousUsageList,
656   _In_reads_(UsageListLength) PUSAGE CurrentUsageList,
657   _Out_writes_(UsageListLength) PUSAGE BreakUsageList,
658   _Out_writes_(UsageListLength) PUSAGE MakeUsageList,
659   _In_ ULONG UsageListLength);
660 
661 #ifdef __cplusplus
662 }
663 #endif
664 
665 #endif /* __HIDPI_H__ */
666