Win32/PInvoke/pinvoke-input.txt
changeset 80 e2acfa51664f
parent 50 e6c103ebb155
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/Win32/PInvoke/pinvoke-input.txt	Sun Mar 15 20:30:00 2015 +0100
     1.3 @@ -0,0 +1,2226 @@
     1.4 +//
     1.5 +// SL: We use this file to generate P/Invoke using P/Invoke Interop Assistant.
     1.6 +//
     1.7 +
     1.8 +
     1.9 +typedef USHORT USAGE, *PUSAGE;
    1.10 +typedef LONG NTSTATUS;
    1.11 +
    1.12 +#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1)
    1.13 +#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0)
    1.14 +
    1.15 +
    1.16 +typedef enum _HIDP_REPORT_TYPE
    1.17 +{
    1.18 +    HidP_Input,
    1.19 +    HidP_Output,
    1.20 +    HidP_Feature
    1.21 +} HIDP_REPORT_TYPE;
    1.22 +
    1.23 +typedef struct _USAGE_AND_PAGE
    1.24 +{
    1.25 +    USAGE Usage;
    1.26 +    USAGE UsagePage;
    1.27 +} USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
    1.28 +
    1.29 +#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2))
    1.30 +
    1.31 +typedef struct _HIDP_BUTTON_CAPS
    1.32 +{
    1.33 +    USAGE    UsagePage;
    1.34 +    UCHAR    ReportID;
    1.35 +    BOOLEAN  IsAlias;
    1.36 +
    1.37 +    USHORT   BitField;
    1.38 +    USHORT   LinkCollection;   // A unique internal index pointer
    1.39 +
    1.40 +    USAGE    LinkUsage;
    1.41 +    USAGE    LinkUsagePage;
    1.42 +
    1.43 +    BOOLEAN  IsRange;
    1.44 +    BOOLEAN  IsStringRange;
    1.45 +    BOOLEAN  IsDesignatorRange;
    1.46 +    BOOLEAN  IsAbsolute;
    1.47 +
    1.48 +    ULONG    Reserved[10];
    1.49 +    union {
    1.50 +        struct {
    1.51 +            USAGE    UsageMin,         UsageMax;
    1.52 +            USHORT   StringMin,        StringMax;
    1.53 +            USHORT   DesignatorMin,    DesignatorMax;
    1.54 +            USHORT   DataIndexMin,     DataIndexMax;
    1.55 +        } Range;
    1.56 +        struct  {
    1.57 +            USAGE    Usage,            Reserved1;
    1.58 +            USHORT   StringIndex,      Reserved2;
    1.59 +            USHORT   DesignatorIndex,  Reserved3;
    1.60 +            USHORT   DataIndex,        Reserved4;
    1.61 +        } NotRange;
    1.62 +    };
    1.63 +
    1.64 +} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
    1.65 +
    1.66 +
    1.67 +typedef struct _HIDP_VALUE_CAPS
    1.68 +{
    1.69 +    USAGE    UsagePage;
    1.70 +    UCHAR    ReportID;
    1.71 +    BOOLEAN  IsAlias;
    1.72 +
    1.73 +    USHORT   BitField;
    1.74 +    USHORT   LinkCollection;   // A unique internal index pointer
    1.75 +
    1.76 +    USAGE    LinkUsage;
    1.77 +    USAGE    LinkUsagePage;
    1.78 +
    1.79 +    BOOLEAN  IsRange;
    1.80 +    BOOLEAN  IsStringRange;
    1.81 +    BOOLEAN  IsDesignatorRange;
    1.82 +    BOOLEAN  IsAbsolute;
    1.83 +
    1.84 +    BOOLEAN  HasNull;        // Does this channel have a null report   union
    1.85 +    UCHAR    Reserved;
    1.86 +    USHORT   BitSize;        // How many bits are devoted to this value?
    1.87 +
    1.88 +    USHORT   ReportCount;    // See Note below.  Usually set to 1.
    1.89 +    USHORT   Reserved2[5];
    1.90 +
    1.91 +    ULONG    UnitsExp;
    1.92 +    ULONG    Units;
    1.93 +
    1.94 +    LONG     LogicalMin,       LogicalMax;
    1.95 +    LONG     PhysicalMin,      PhysicalMax;
    1.96 +
    1.97 +    union {
    1.98 +        struct {
    1.99 +            USAGE    UsageMin,         UsageMax;
   1.100 +            USHORT   StringMin,        StringMax;
   1.101 +            USHORT   DesignatorMin,    DesignatorMax;
   1.102 +            USHORT   DataIndexMin,     DataIndexMax;
   1.103 +        } Range;
   1.104 +
   1.105 +        struct {
   1.106 +            USAGE    Usage,            Reserved1;
   1.107 +            USHORT   StringIndex,      Reserved2;
   1.108 +            USHORT   DesignatorIndex,  Reserved3;
   1.109 +            USHORT   DataIndex,        Reserved4;
   1.110 +        } NotRange;
   1.111 +    };
   1.112 +} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
   1.113 +
   1.114 +//
   1.115 +// Notes:
   1.116 +//
   1.117 +// ReportCount:  When a report descriptor declares an Input, Output, or
   1.118 +// Feature main item with fewer usage declarations than the report count, then
   1.119 +// the last usage applies to all remaining unspecified count in that main item.
   1.120 +// (As an example you might have data that required many fields to describe,
   1.121 +// possibly buffered bytes.)  In this case, only one value cap structure is
   1.122 +// allocated for these associtated fields, all with the same usage, and Report
   1.123 +// Count reflects the number of fields involved.  Normally ReportCount is 1.
   1.124 +// To access all of the fields in such a value structure would require using
   1.125 +// HidP_GetUsageValueArray and HidP_SetUsageValueArray.   HidP_GetUsageValue/
   1.126 +// HidP_SetScaledUsageValue will also work, however, these functions will only
   1.127 +// work with the first field of the structure.
   1.128 +//
   1.129 +
   1.130 +//
   1.131 +// The link collection tree consists of an array of LINK_COLLECTION_NODES
   1.132 +// where the index into this array is the same as the collection number.
   1.133 +//
   1.134 +// Given a collection A which contains a subcollection B, A is defined to be
   1.135 +// the parent B, and B is defined to be the child.
   1.136 +//
   1.137 +// Given collections A, B, and C where B and C are children of A, and B was
   1.138 +// encountered before C in the report descriptor, B is defined as a sibling of
   1.139 +// C.  (This implies, of course, that if B is a sibling of C, then C is NOT a
   1.140 +// sibling of B).
   1.141 +//
   1.142 +// B is defined as the NextSibling of C if and only if there exists NO
   1.143 +// child collection of A, call it D, such that B is a sibling of D and D
   1.144 +// is a sibling of C.
   1.145 +//
   1.146 +// E is defined to be the FirstChild of A if and only if for all children of A,
   1.147 +// F, that are not equivalent to E, F is a sibling of E.
   1.148 +// (This implies, of course, that the does not exist a child of A, call it G,
   1.149 +// where E is a sibling of G).  In other words the first sibling is the last
   1.150 +// link collection found in the list.
   1.151 +//
   1.152 +// In other words, if a collection B is defined within the definition of another
   1.153 +// collection A, B becomes a child of A.  All collections with the same parent
   1.154 +// are considered siblings.  The FirstChild of the parent collection, A, will be
   1.155 +// last collection defined that has A as a parent.  The order of sibling pointers
   1.156 +// is similarly determined.  When a collection B is defined, it becomes the
   1.157 +// FirstChild of it's parent collection.  The previously defined FirstChild of the
   1.158 +// parent collection becomes the NextSibling of the new collection.  As new
   1.159 +// collections with the same parent are discovered, the chain of sibling is built.
   1.160 +//
   1.161 +// With that in mind, the following describes conclusively a data structure
   1.162 +// that provides direct traversal up, down, and accross the link collection
   1.163 +// tree.
   1.164 +//
   1.165 +//
   1.166 +typedef struct _HIDP_LINK_COLLECTION_NODE
   1.167 +{
   1.168 +    USAGE    LinkUsage;
   1.169 +    USAGE    LinkUsagePage;
   1.170 +    USHORT   Parent;
   1.171 +    USHORT   NumberOfChildren;
   1.172 +    USHORT   NextSibling;
   1.173 +    USHORT   FirstChild;
   1.174 +    ULONG    CollectionType: 8;  // As defined in 6.2.2.6 of HID spec
   1.175 +    ULONG    IsAlias : 1; // This link node is an allias of the next link node.
   1.176 +    ULONG    Reserved: 23;
   1.177 +    PVOID    UserContext; // The user can hang his coat here.
   1.178 +} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
   1.179 +
   1.180 +//
   1.181 +// When a link collection is described by a delimiter, alias link collection
   1.182 +// nodes are created.  (One for each usage within the delimiter).
   1.183 +// The parser assigns each capability description listed above only one
   1.184 +// link collection.
   1.185 +//
   1.186 +// If a control is defined within a collection defined by
   1.187 +// delimited usages, then that control is said to be within multiple link
   1.188 +// collections, one for each usage within the open and close delimiter tokens.
   1.189 +// Such multiple link collecions are said to be aliases.  The first N-1 such
   1.190 +// collections, listed in the link collection node array, have their IsAlias
   1.191 +// bit set.  The last such link collection is the link collection index used
   1.192 +// in the capabilities described above.
   1.193 +// Clients wishing to set a control in an aliased collection, should walk the
   1.194 +// collection array once for each time they see the IsAlias flag set, and use
   1.195 +// the last link collection as the index for the below accessor functions.
   1.196 +//
   1.197 +// NB: if IsAlias is set, then NextSibling should be one more than the current
   1.198 +// link collection node index.
   1.199 +//
   1.200 +
   1.201 +typedef PUCHAR  PHIDP_REPORT_DESCRIPTOR;
   1.202 +typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
   1.203 +
   1.204 +typedef struct _HIDP_CAPS
   1.205 +{
   1.206 +    USAGE    Usage;
   1.207 +    USAGE    UsagePage;
   1.208 +    USHORT   InputReportByteLength;
   1.209 +    USHORT   OutputReportByteLength;
   1.210 +    USHORT   FeatureReportByteLength;
   1.211 +    USHORT   Reserved[17];
   1.212 +
   1.213 +    USHORT   NumberLinkCollectionNodes;
   1.214 +
   1.215 +    USHORT   NumberInputButtonCaps;
   1.216 +    USHORT   NumberInputValueCaps;
   1.217 +    USHORT   NumberInputDataIndices;
   1.218 +
   1.219 +    USHORT   NumberOutputButtonCaps;
   1.220 +    USHORT   NumberOutputValueCaps;
   1.221 +    USHORT   NumberOutputDataIndices;
   1.222 +
   1.223 +    USHORT   NumberFeatureButtonCaps;
   1.224 +    USHORT   NumberFeatureValueCaps;
   1.225 +    USHORT   NumberFeatureDataIndices;
   1.226 +} HIDP_CAPS, *PHIDP_CAPS;
   1.227 +
   1.228 +typedef struct _HIDP_DATA
   1.229 +{
   1.230 +    USHORT  DataIndex;
   1.231 +    USHORT  Reserved;
   1.232 +    union {
   1.233 +        ULONG   RawValue; // for values
   1.234 +        BOOLEAN On; // for buttons MUST BE TRUE for buttons.
   1.235 +    };
   1.236 +} HIDP_DATA, *PHIDP_DATA;
   1.237 +//
   1.238 +// The HIDP_DATA structure is used with HidP_GetData and HidP_SetData
   1.239 +// functions.
   1.240 +//
   1.241 +// The parser contiguously assigns every control (button or value) in a hid
   1.242 +// device a unique data index from zero to NumberXXXDataIndices -1 , inclusive.
   1.243 +// This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures.
   1.244 +//
   1.245 +// Most clients will find the Get/Set Buttons / Value accessor functions
   1.246 +// sufficient to their needs, as they will allow the clients to access the
   1.247 +// data known to them while ignoring the other controls.
   1.248 +//
   1.249 +// More complex clients, which actually read the Button / Value Caps, and which
   1.250 +// do a value add service to these routines (EG Direct Input), will need to
   1.251 +// access all the data in the device without interest in the individual usage
   1.252 +// or link collection location.  These are the clients that will find
   1.253 +// HidP_Data useful.
   1.254 +//
   1.255 +
   1.256 +typedef struct _HIDP_UNKNOWN_TOKEN
   1.257 +{
   1.258 +    UCHAR  Token;
   1.259 +    UCHAR  Reserved[3];
   1.260 +    ULONG  BitField;
   1.261 +} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN;
   1.262 +
   1.263 +typedef struct _HIDP_EXTENDED_ATTRIBUTES
   1.264 +{
   1.265 +    UCHAR   NumGlobalUnknowns;
   1.266 +    UCHAR   Reserved [3];
   1.267 +    PHIDP_UNKNOWN_TOKEN  GlobalUnknowns;
   1.268 +    // ... Additional attributes
   1.269 +    ULONG   Data [1]; // variableLength  DO NOT ACCESS THIS FIELD
   1.270 +} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES;
   1.271 +
   1.272 +NTSTATUS __stdcall
   1.273 +HidP_GetCaps (
   1.274 +         PHIDP_PREPARSED_DATA      PreparsedData,
   1.275 +        PHIDP_CAPS                Capabilities
   1.276 +   );
   1.277 +/*++
   1.278 +Routine Description:
   1.279 +   Returns a list of capabilities of a given hid device as described by its
   1.280 +   preparsed data.
   1.281 +
   1.282 +Arguments:
   1.283 +   PreparsedData    The preparsed data returned from HIDCLASS.
   1.284 +   Capabilities     a HIDP_CAPS structure
   1.285 +
   1.286 +Return Value:
   1.287 +   HIDP_STATUS_SUCCESS
   1.288 +   HIDP_STATUS_INVALID_PREPARSED_DATA
   1.289 +--*/
   1.290 +
   1.291 +NTSTATUS __stdcall
   1.292 +HidP_GetLinkCollectionNodes (
   1.293 +        PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
   1.294 +      PULONG                     LinkCollectionNodesLength,
   1.295 +         PHIDP_PREPARSED_DATA       PreparsedData
   1.296 +   );
   1.297 +/*++
   1.298 +Routine Description:
   1.299 +   Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link
   1.300 +   collection tree of this hid device.  See the above description of
   1.301 +   struct _HIDP_LINK_COLLECTION_NODE.
   1.302 +
   1.303 +Arguments:
   1.304 +   LinkCollectionNodes - a caller allocated array into which
   1.305 +                 HidP_GetLinkCollectionNodes will store the information
   1.306 +
   1.307 +   LinKCollectionNodesLength - the caller sets this value to the length of the
   1.308 +                 the array in terms of number of elements.
   1.309 +                 HidP_GetLinkCollectionNodes sets this value to the actual
   1.310 +                 number of elements set. The total number of nodes required to
   1.311 +                 describe this HID device can be found in the
   1.312 +                 NumberLinkCollectionNodes field in the HIDP_CAPS structure.
   1.313 +
   1.314 +--*/
   1.315 +
   1.316 +NTSTATUS __stdcall
   1.317 +HidP_GetSpecificButtonCaps (
   1.318 +          HIDP_REPORT_TYPE     ReportType,
   1.319 +          USAGE                UsagePage,      // Optional (0 => ignore)
   1.320 +          USHORT               LinkCollection, // Optional (0 => ignore)
   1.321 +          USAGE                Usage,          // Optional (0 => ignore)
   1.322 +   PHIDP_BUTTON_CAPS    ButtonCaps,
   1.323 +     PUSHORT              ButtonCapsLength,
   1.324 +          PHIDP_PREPARSED_DATA PreparsedData
   1.325 +   );
   1.326 +/*++
   1.327 +Description:
   1.328 +   HidP_GetButtonCaps returns all the buttons (binary values) that are a part
   1.329 +   of the given report type for the Hid device represented by the given
   1.330 +   preparsed data.
   1.331 +
   1.332 +Parameters:
   1.333 +   ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.334 +
   1.335 +   UsagePage   A usage page value used to limit the button caps returned to
   1.336 +                those on a given usage page.  If set to 0, this parameter is
   1.337 +                ignored.  Can be used with LinkCollection and Usage parameters
   1.338 +                to further limit the number of button caps structures returned.
   1.339 +
   1.340 +   LinkCollection HIDP_LINK_COLLECTION node array index used to limit the
   1.341 +                  button caps returned to those buttons in a given link
   1.342 +                  collection.  If set to 0, this parameter is
   1.343 +                  ignored.  Can be used with UsagePage and Usage parameters
   1.344 +                  to further limit the number of button caps structures
   1.345 +                  returned.
   1.346 +
   1.347 +   Usage      A usage value used to limit the button caps returned to those
   1.348 +               with the specified usage value.  If set to 0, this parameter
   1.349 +               is ignored.  Can be used with LinkCollection and UsagePage
   1.350 +               parameters to further limit the number of button caps
   1.351 +               structures returned.
   1.352 +
   1.353 +   ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the
   1.354 +               binary values in the given report.  This buffer is provided by
   1.355 +               the caller.
   1.356 +
   1.357 +   ButtonLength   As input, this parameter specifies the length of the
   1.358 +                  ButtonCaps parameter (array) in number of array elements.
   1.359 +                  As output, this value is set to indicate how many of those
   1.360 +                  array elements were filled in by the function.  The maximum number of
   1.361 +                  button caps that can be returned is found in the HIDP_CAPS
   1.362 +                  structure.  If HIDP_STATUS_BUFFER_TOO_SMALL is returned,
   1.363 +                  this value contains the number of array elements needed to
   1.364 +                  successfully complete the request.
   1.365 +
   1.366 +   PreparsedData  The preparsed data returned from HIDCLASS.
   1.367 +
   1.368 +
   1.369 +Return Value
   1.370 +HidP_GetSpecificButtonCaps returns the following error codes:
   1.371 +  HIDP_STATUS_SUCCESS.
   1.372 +  HIDP_STATUS_INVALID_REPORT_TYPE
   1.373 +  HIDP_STATUS_INVALID_PREPARSED_DATA
   1.374 +  HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in)
   1.375 +  HIDP_STATUS_USAGE_NOT_FOUND
   1.376 +--*/
   1.377 +NTSTATUS __stdcall
   1.378 +HidP_GetButtonCaps (
   1.379 +          HIDP_REPORT_TYPE     ReportType,
   1.380 +   PHIDP_BUTTON_CAPS ButtonCaps,
   1.381 +       PUSHORT              ButtonCapsLength,
   1.382 +          PHIDP_PREPARSED_DATA PreparsedData
   1.383 +);
   1.384 +
   1.385 +NTSTATUS __stdcall
   1.386 +HidP_GetSpecificValueCaps (
   1.387 +          HIDP_REPORT_TYPE     ReportType,
   1.388 +          USAGE                UsagePage,      // Optional (0 => ignore)
   1.389 +          USHORT               LinkCollection, // Optional (0 => ignore)
   1.390 +          USAGE                Usage,          // Optional (0 => ignore)
   1.391 +          PHIDP_VALUE_CAPS     ValueCaps,
   1.392 +       PUSHORT              ValueCapsLength,
   1.393 +          PHIDP_PREPARSED_DATA PreparsedData
   1.394 +   );
   1.395 +/*++
   1.396 +Description:
   1.397 +   HidP_GetValueCaps returns all the values (non-binary) that are a part
   1.398 +   of the given report type for the Hid device represented by the given
   1.399 +   preparsed data.
   1.400 +
   1.401 +Parameters:
   1.402 +   ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.403 +
   1.404 +   UsagePage   A usage page value used to limit the value caps returned to
   1.405 +                those on a given usage page.  If set to 0, this parameter is
   1.406 +                ignored.  Can be used with LinkCollection and Usage parameters
   1.407 +                to further limit the number of value caps structures returned.
   1.408 +
   1.409 +   LinkCollection HIDP_LINK_COLLECTION node array index used to limit the
   1.410 +                  value caps returned to those buttons in a given link
   1.411 +                  collection.  If set to 0, this parameter is
   1.412 +                  ignored.  Can be used with UsagePage and Usage parameters
   1.413 +                  to further limit the number of value caps structures
   1.414 +                  returned.
   1.415 +
   1.416 +   Usage      A usage value used to limit the value caps returned to those
   1.417 +               with the specified usage value.  If set to 0, this parameter
   1.418 +               is ignored.  Can be used with LinkCollection and UsagePage
   1.419 +               parameters to further limit the number of value caps
   1.420 +               structures returned.
   1.421 +
   1.422 +   ValueCaps  A _HIDP_VALUE_CAPS array containing information about all the
   1.423 +               non-binary values in the given report.  This buffer is provided
   1.424 +               by the caller.
   1.425 +
   1.426 +   ValueLength   As input, this parameter specifies the length of the ValueCaps
   1.427 +                  parameter (array) in number of array elements.  As output,
   1.428 +                  this value is set to indicate how many of those array elements
   1.429 +                  were filled in by the function.  The maximum number of
   1.430 +                  value caps that can be returned is found in the HIDP_CAPS
   1.431 +                  structure.  If HIDP_STATUS_BUFFER_TOO_SMALL is returned,
   1.432 +                  this value contains the number of array elements needed to
   1.433 +                  successfully complete the request.
   1.434 +
   1.435 +   PreparsedData  The preparsed data returned from HIDCLASS.
   1.436 +
   1.437 +
   1.438 +Return Value
   1.439 +HidP_GetValueCaps returns the following error codes:
   1.440 +  HIDP_STATUS_SUCCESS.
   1.441 +  HIDP_STATUS_INVALID_REPORT_TYPE
   1.442 +  HIDP_STATUS_INVALID_PREPARSED_DATA
   1.443 +  HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in)
   1.444 +  HIDP_STATUS_USAGE_NOT_FOUND
   1.445 +
   1.446 +--*/
   1.447 +
   1.448 +NTSTATUS __stdcall
   1.449 +HidP_GetValueCaps (
   1.450 +          HIDP_REPORT_TYPE     ReportType,
   1.451 +   PHIDP_VALUE_CAPS ValueCaps,
   1.452 +       PUSHORT              ValueCapsLength,
   1.453 +          PHIDP_PREPARSED_DATA PreparsedData
   1.454 +);
   1.455 +
   1.456 +NTSTATUS __stdcall
   1.457 +HidP_GetExtendedAttributes (
   1.458 +          HIDP_REPORT_TYPE            ReportType,
   1.459 +          USHORT                      DataIndex,
   1.460 +          PHIDP_PREPARSED_DATA        PreparsedData,
   1.461 +    PHIDP_EXTENDED_ATTRIBUTES Attributes,
   1.462 +       PULONG                      LengthAttributes
   1.463 +    );
   1.464 +/*++
   1.465 +Description:
   1.466 +    Given a data index from the value or button capabilities of a given control
   1.467 +    return any extended attributes for the control if any exist.
   1.468 +
   1.469 +Parameters:
   1.470 +    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.471 +
   1.472 +    DataIndex   The data index for the given control, found in the capabilities
   1.473 +                structure for that control
   1.474 +
   1.475 +    PreparsedData   The preparsed data returned from HIDCLASS.
   1.476 +
   1.477 +    Attributes  Pointer to a buffer into which the extended attribute data will
   1.478 +                be copied.
   1.479 +
   1.480 +    LengthAttributes    Length of the given buffer in bytes.
   1.481 +
   1.482 +Return Value
   1.483 +    HIDP_STATUS_SUCCESS
   1.484 +    HIDP_STATUS_DATA_INDEX_NOT_FOUND
   1.485 +--*/
   1.486 +
   1.487 +NTSTATUS __stdcall
   1.488 +HidP_InitializeReportForID (
   1.489 +    HIDP_REPORT_TYPE ReportType,
   1.490 +    UCHAR ReportID,
   1.491 +    PHIDP_PREPARSED_DATA PreparsedData,
   1.492 +   PCHAR Report,
   1.493 +    ULONG ReportLength
   1.494 +   );
   1.495 +/*++
   1.496 +
   1.497 +Routine Description:
   1.498 +
   1.499 +    Initialize a report based on the given report ID.
   1.500 +
   1.501 +Parameters:
   1.502 +
   1.503 +    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.504 +
   1.505 +    PreparasedData  Preparsed data structure returned by HIDCLASS
   1.506 +
   1.507 +    Report      Buffer which to set the data into.
   1.508 +
   1.509 +    ReportLength Length of Report...Report should be at least as long as the
   1.510 +                value indicated in the HIDP_CAPS structure for the device and
   1.511 +                the corresponding ReportType
   1.512 +
   1.513 +Return Value
   1.514 +
   1.515 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.516 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.517 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
   1.518 +                                        to the length specified in HIDP_CAPS
   1.519 +                                        structure for the given ReportType
   1.520 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.521 +                                        for the given ReportType
   1.522 +
   1.523 +--*/
   1.524 +
   1.525 +NTSTATUS __stdcall
   1.526 +HidP_SetData (
   1.527 +     HIDP_REPORT_TYPE ReportType,
   1.528 +    PHIDP_DATA DataList,
   1.529 +     PULONG DataLength,
   1.530 +     PHIDP_PREPARSED_DATA PreparsedData,
   1.531 +    PCHAR Report,
   1.532 +     ULONG ReportLength
   1.533 +    );
   1.534 +/*++
   1.535 +
   1.536 +Routine Description:
   1.537 +
   1.538 +    Please Note: Since usage value arrays deal with multiple fields for
   1.539 +                 for one usage value, they cannot be used with HidP_SetData
   1.540 +                 and HidP_GetData.  In this case,
   1.541 +                 HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned.
   1.542 +
   1.543 +Parameters:
   1.544 +
   1.545 +    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.546 +
   1.547 +    DataList    Array of HIDP_DATA structures that contains the data values
   1.548 +                that are to be set into the given report
   1.549 +
   1.550 +    DataLength  As input, length in array elements of DataList.  As output,
   1.551 +                contains the number of data elements set on successful
   1.552 +                completion or an index into the DataList array to identify
   1.553 +                the faulting HIDP_DATA value if an error code is returned.
   1.554 +
   1.555 +    PreparasedData  Preparsed data structure returned by HIDCLASS
   1.556 +
   1.557 +    Report      Buffer which to set the data into.
   1.558 +
   1.559 +    ReportLength Length of Report...Report should be at least as long as the
   1.560 +                value indicated in the HIDP_CAPS structure for the device and
   1.561 +                the corresponding ReportType
   1.562 +
   1.563 +Return Value
   1.564 +    HidP_SetData returns the following error codes.  The report packet will
   1.565 +        have all the data set up until the HIDP_DATA structure that caused the
   1.566 +        error.  DataLength, in the error case, will return this problem index.
   1.567 +
   1.568 +  HIDP_STATUS_SUCCESS                -- upon successful insertion of all data
   1.569 +                                        into the report packet.
   1.570 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.571 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.572 +  HIDP_STATUS_DATA_INDEX_NOT_FOUND   -- if a HIDP_DATA structure referenced a
   1.573 +                                        data index that does not exist for this
   1.574 +                                        device's ReportType
   1.575 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
   1.576 +                                        to the length specified in HIDP_CAPS
   1.577 +                                        structure for the given ReportType
   1.578 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.579 +                                        for the given ReportType
   1.580 +  HIDP_STATUS_IS_USAGE_VALUE_ARRAY   -- if one of the HIDP_DATA structures
   1.581 +                                        references a usage value array.
   1.582 +                                        DataLength will contain the index into
   1.583 +                                        the array that was invalid
   1.584 +  HIDP_STATUS_BUTTON_NOT_PRESSED     -- if a HIDP_DATA structure attempted
   1.585 +                                        to unset a button that was not already
   1.586 +                                        set in the Report
   1.587 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with
   1.588 +                                        a valid index value but is contained
   1.589 +                                        in a different report than the one
   1.590 +                                        currently being processed
   1.591 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough entries in
   1.592 +                                        a given Main Array Item to report all
   1.593 +                                        buttons that have been requested to be
   1.594 +                                        set
   1.595 +--*/
   1.596 +
   1.597 +NTSTATUS __stdcall
   1.598 +HidP_GetData (
   1.599 +     HIDP_REPORT_TYPE ReportType,
   1.600 +    PHIDP_DATA DataList,
   1.601 +     PULONG DataLength,
   1.602 +     PHIDP_PREPARSED_DATA PreparsedData,
   1.603 +    PCHAR Report,
   1.604 +     ULONG ReportLength
   1.605 +    );
   1.606 +/*++
   1.607 +
   1.608 +Routine Description:
   1.609 +
   1.610 +    Please Note: For obvious reasons HidP_SetData and HidP_GetData will not
   1.611 +    access UsageValueArrays.
   1.612 +
   1.613 +Parameters:
   1.614 +    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
   1.615 +
   1.616 +    DataList    Array of HIDP_DATA structures that will receive the data
   1.617 +                values that are set in the given report
   1.618 +
   1.619 +    DataLength  As input, length in array elements of DataList.  As output,
   1.620 +                contains the number of data elements that were successfully
   1.621 +                set by HidP_GetData.  The maximum size necessary for DataList
   1.622 +                can be determined by calling HidP_MaxDataListLength
   1.623 +
   1.624 +    PreparasedData  Preparsed data structure returned by HIDCLASS
   1.625 +
   1.626 +    Report      Buffer which to set the data into.
   1.627 +
   1.628 +    ReportLength Length of Report...Report should be at least as long as the
   1.629 +                value indicated in the HIDP_CAPS structure for the device and
   1.630 +                the corresponding ReportType
   1.631 +
   1.632 +Return Value
   1.633 +    HidP_GetData returns the following error codes.
   1.634 +
   1.635 +  HIDP_STATUS_SUCCESS                -- upon successful retrieval of all data
   1.636 +                                        from the report packet.
   1.637 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.638 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.639 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
   1.640 +                                        to the length specified in HIDP_CAPS
   1.641 +                                        structure for the given ReportType
   1.642 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.643 +                                        for the given ReportType
   1.644 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough array entries in
   1.645 +                                        DataList to store all the indice values
   1.646 +                                        in the given report.  DataLength will
   1.647 +                                        contain the number of array entries
   1.648 +                                        required to hold all data
   1.649 +--*/
   1.650 +
   1.651 +
   1.652 +ULONG __stdcall
   1.653 +HidP_MaxDataListLength (
   1.654 +    HIDP_REPORT_TYPE      ReportType,
   1.655 +    PHIDP_PREPARSED_DATA  PreparsedData
   1.656 +   );
   1.657 +/*++
   1.658 +Routine Description:
   1.659 +
   1.660 +    This function returns the maximum length of HIDP_DATA elements that
   1.661 +    HidP_GetData could return for the given report type.
   1.662 +
   1.663 +Parameters:
   1.664 +
   1.665 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
   1.666 +
   1.667 +    PreparsedData    Preparsed data structure returned by HIDCLASS
   1.668 +
   1.669 +Return Value:
   1.670 +
   1.671 +    The length of the data list array required for the HidP_GetData function
   1.672 +    call.  If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or
   1.673 +    HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0.
   1.674 +
   1.675 +--*/
   1.676 +
   1.677 +#define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
   1.678 +        HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
   1.679 +
   1.680 +
   1.681 +NTSTATUS __stdcall
   1.682 +HidP_SetUsages (
   1.683 +    HIDP_REPORT_TYPE    ReportType,
   1.684 +    USAGE   UsagePage,
   1.685 +    USHORT  LinkCollection,
   1.686 +   PUSAGE  UsageList,
   1.687 +     PULONG  UsageLength,
   1.688 +    PHIDP_PREPARSED_DATA  PreparsedData,
   1.689 +   PCHAR   Report,
   1.690 +    ULONG   ReportLength 
   1.691 +   );
   1.692 +/*++
   1.693 +
   1.694 +Routine Description:
   1.695 +    This function sets binary values (buttons) in a report.  Given an
   1.696 +    initialized packet of correct length, it modifies the report packet so that
   1.697 +    each element in the given list of usages has been set in the report packet.
   1.698 +    For example, in an output report with 5 LED's, each with a given usage,
   1.699 +    an application could turn on any subset of these lights by placing their
   1.700 +    usages in any order into the usage array (UsageList).  HidP_SetUsages would,
   1.701 +    in turn, set the appropriate bit or add the corresponding byte into the
   1.702 +    HID Main Array Item.
   1.703 +
   1.704 +    A properly initialized Report packet is one of the correct byte length,
   1.705 +    and all zeros.
   1.706 +
   1.707 +    NOTE: A packet that has already been set with a call to a HidP_Set routine
   1.708 +          can also be passed in.  This routine then sets processes the UsageList
   1.709 +          in the same fashion but verifies that the ReportID already set in
   1.710 +          Report matches the report ID for the given usages.
   1.711 +
   1.712 +Parameters:
   1.713 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
   1.714 +
   1.715 +    UsagePage   All of the usages in the usage array, which HidP_SetUsages will
   1.716 +                set in the report, refer to this same usage page.
   1.717 +                If a client wishes to set usages in a report for multiple
   1.718 +                usage pages then that client needs to make multiple calls to
   1.719 +                HidP_SetUsages for each of the usage pages.
   1.720 +
   1.721 +    UsageList   A usage array containing the usages that HidP_SetUsages will set in
   1.722 +                the report packet.
   1.723 +
   1.724 +    UsageLength The length of the given usage array in array elements.
   1.725 +                The parser will set this value to the position in the usage
   1.726 +                array where it stopped processing.  If successful, UsageLength
   1.727 +                will be unchanged.  In any error condition, this parameter
   1.728 +                reflects how many of the usages in the usage list have
   1.729 +                actually been set by the parser.  This is useful for finding
   1.730 +                the usage in the list which caused the error.
   1.731 +
   1.732 +    PreparsedData The preparsed data recevied from HIDCLASS
   1.733 +
   1.734 +    Report      The report packet.
   1.735 +
   1.736 +    ReportLength   Length of the given report packet...Must be equal to the
   1.737 +                   value reported in the HIDP_CAPS structure for the device
   1.738 +                   and corresponding report type.
   1.739 +
   1.740 +Return Value
   1.741 +    HidP_SetUsages returns the following error codes.  On error, the report packet
   1.742 +    will be correct up until the usage element that caused the error.
   1.743 +
   1.744 +  HIDP_STATUS_SUCCESS                -- upon successful insertion of all usages
   1.745 +                                        into the report packet.
   1.746 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.747 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.748 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
   1.749 +                                        equal to the length specified in
   1.750 +                                        the HIDP_CAPS structure for the given
   1.751 +                                        ReportType
   1.752 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.753 +                                        for the given ReportType
   1.754 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
   1.755 +                                        different report.  If the report is
   1.756 +                                        zero-initialized on entry the first
   1.757 +                                        usage in the list will determine which
   1.758 +                                        report ID is used.  Otherwise, the
   1.759 +                                        parser will verify that usage matches
   1.760 +                                        the passed in report's ID
   1.761 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage does not exist for any
   1.762 +                                        report (no matter what the report ID)
   1.763 +                                        for the given report type.
   1.764 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough entries in a
   1.765 +                                        given Main Array Item to list all of
   1.766 +                                        the given usages.  The caller needs
   1.767 +                                        to split his request into more than
   1.768 +                                        one call
   1.769 +--*/
   1.770 +
   1.771 +#define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
   1.772 +        HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
   1.773 +
   1.774 +
   1.775 +NTSTATUS __stdcall
   1.776 +HidP_UnsetUsages (
   1.777 +    HIDP_REPORT_TYPE      ReportType,
   1.778 +    USAGE   UsagePage,
   1.779 +   USHORT  LinkCollection,
   1.780 +   PUSAGE  UsageList,
   1.781 +     PULONG  UsageLength,
   1.782 +    PHIDP_PREPARSED_DATA  PreparsedData,
   1.783 +   PCHAR   Report,
   1.784 +    ULONG   ReportLength
   1.785 +   );
   1.786 +/*++
   1.787 +
   1.788 +Routine Description:
   1.789 +    This function unsets (turns off) binary values (buttons) in the report.  Given
   1.790 +    an initialized packet of correct length, it modifies the report packet so
   1.791 +    that each element in the given list of usages has been unset in the
   1.792 +    report packet.
   1.793 +
   1.794 +    This function is the "undo" operation for SetUsages.  If the given usage
   1.795 +    is not already set in the Report, it will return an error code of
   1.796 +    HIDP_STATUS_BUTTON_NOT_PRESSED.  If the button is pressed, HidP_UnsetUsages
   1.797 +    will unset the appropriate bit or remove the corresponding index value from
   1.798 +    the HID Main Array Item.
   1.799 +
   1.800 +    A properly initialized Report packet is one of the correct byte length,
   1.801 +    and all zeros..
   1.802 +
   1.803 +    NOTE: A packet that has already been set with a call to a HidP_Set routine
   1.804 +          can also be passed in.  This routine then processes the UsageList
   1.805 +          in the same fashion but verifies that the ReportID already set in
   1.806 +          Report matches the report ID for the given usages.
   1.807 +
   1.808 +Parameters:
   1.809 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
   1.810 +
   1.811 +    UsagePage   All of the usages in the usage array, which HidP_UnsetUsages will
   1.812 +                unset in the report, refer to this same usage page.
   1.813 +                If a client wishes to unset usages in a report for multiple
   1.814 +                usage pages then that client needs to make multiple calls to
   1.815 +                HidP_UnsetUsages for each of the usage pages.
   1.816 +
   1.817 +    UsageList   A usage array containing the usages that HidP_UnsetUsages will
   1.818 +                unset in the report packet.
   1.819 +
   1.820 +    UsageLength The length of the given usage array in array elements.
   1.821 +                The parser will set this value to the position in the usage
   1.822 +                array where it stopped processing.  If successful, UsageLength
   1.823 +                will be unchanged.  In any error condition, this parameter
   1.824 +                reflects how many of the usages in the usage list have
   1.825 +                actually been unset by the parser.  This is useful for finding
   1.826 +                the usage in the list which caused the error.
   1.827 +
   1.828 +    PreparsedData The preparsed data recevied from HIDCLASS
   1.829 +
   1.830 +    Report      The report packet.
   1.831 +
   1.832 +    ReportLength   Length of the given report packet...Must be equal to the
   1.833 +                   value reported in the HIDP_CAPS structure for the device
   1.834 +                   and corresponding report type.
   1.835 +
   1.836 +Return Value
   1.837 +    HidP_UnsetUsages returns the following error codes.  On error, the report
   1.838 +    packet will be correct up until the usage element that caused the error.
   1.839 +
   1.840 +  HIDP_STATUS_SUCCESS                -- upon successful "unsetting" of all usages
   1.841 +                                        in the report packet.
   1.842 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.843 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.844 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
   1.845 +                                        equal to the length specified in
   1.846 +                                        the HIDP_CAPS structure for the given
   1.847 +                                        ReportType
   1.848 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.849 +                                        for the given ReportType
   1.850 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
   1.851 +                                        different report.  If the report is
   1.852 +                                        zero-initialized on entry the first
   1.853 +                                        usage in the list will determine which
   1.854 +                                        report ID is used.  Otherwise, the
   1.855 +                                        parser will verify that usage matches
   1.856 +                                        the passed in report's ID
   1.857 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage does not exist for any
   1.858 +                                        report (no matter what the report ID)
   1.859 +                                        for the given report type.
   1.860 +  HIDP_STATUS_BUTTON_NOT_PRESSED     -- if a usage corresponds to a button that
   1.861 +                                        is not already set in the given report
   1.862 +--*/
   1.863 +
   1.864 +#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \
   1.865 +        HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe)
   1.866 +
   1.867 +
   1.868 +NTSTATUS __stdcall
   1.869 +HidP_GetUsages (
   1.870 +    HIDP_REPORT_TYPE    ReportType,
   1.871 +    USAGE   UsagePage,
   1.872 +    USHORT  LinkCollection,
   1.873 +   PUSAGE UsageList,
   1.874 +       PULONG UsageLength,
   1.875 +    PHIDP_PREPARSED_DATA PreparsedData,
   1.876 +   PCHAR Report,
   1.877 +    ULONG   ReportLength
   1.878 +   );
   1.879 +/*++
   1.880 +
   1.881 +Routine Description:
   1.882 +    This function returns the binary values (buttons) that are set in a HID
   1.883 +    report.  Given a report packet of correct length, it searches the report
   1.884 +    packet for each usage for the given usage page and returns them in the
   1.885 +    usage list.
   1.886 +
   1.887 +Parameters:
   1.888 +    ReportType One of HidP_Input, HidP_Output or HidP_Feature.
   1.889 +
   1.890 +    UsagePage  All of the usages in the usage list, which HidP_GetUsages will
   1.891 +               retrieve in the report, refer to this same usage page.
   1.892 +               If the client wishes to get usages in a packet for multiple
   1.893 +               usage pages then that client needs to make multiple calls
   1.894 +               to HidP_GetUsages.
   1.895 +
   1.896 +    LinkCollection  An optional value which can limit which usages are returned
   1.897 +                    in the UsageList to those usages that exist in a specific
   1.898 +                    LinkCollection.  A non-zero value indicates the index into
   1.899 +                    the HIDP_LINK_COLLECITON_NODE list returned by
   1.900 +                    HidP_GetLinkCollectionNodes of the link collection the
   1.901 +                    usage should belong to.  A value of 0 indicates this
   1.902 +                    should value be ignored.
   1.903 +
   1.904 +    UsageList  The usage array that will contain all the usages found in
   1.905 +               the report packet.
   1.906 +
   1.907 +    UsageLength The length of the given usage array in array elements.
   1.908 +                On input, this value describes the length of the usage list.
   1.909 +                On output, HidP_GetUsages sets this value to the number of
   1.910 +                usages that was found.  Use HidP_MaxUsageListLength to
   1.911 +                determine the maximum length needed to return all the usages
   1.912 +                that a given report packet may contain.
   1.913 +
   1.914 +    PreparsedData Preparsed data structure returned by HIDCLASS
   1.915 +
   1.916 +    Report       The report packet.
   1.917 +
   1.918 +    ReportLength  Length (in bytes) of the given report packet
   1.919 +
   1.920 +
   1.921 +Return Value
   1.922 +    HidP_GetUsages returns the following error codes:
   1.923 +
   1.924 +  HIDP_STATUS_SUCCESS                -- upon successfully retrieving all the
   1.925 +                                        usages from the report packet
   1.926 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
   1.927 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
   1.928 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
   1.929 +                                        equal to the length specified in
   1.930 +                                        the HIDP_CAPS structure for the given
   1.931 +                                        ReportType
   1.932 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
   1.933 +                                        for the given ReportType
   1.934 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the UsageList is not big enough to
   1.935 +                                        hold all the usages found in the report
   1.936 +                                        packet.  If this is returned, the buffer
   1.937 +                                        will contain UsageLength number of
   1.938 +                                        usages.  Use HidP_MaxUsageListLength to
   1.939 +                                        find the maximum length needed
   1.940 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages
   1.941 +                                        that match the UsagePage and
   1.942 +                                        LinkCollection specified could be found
   1.943 +                                        in a report with a different report ID
   1.944 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if there are no usages in a reports for
   1.945 +                                        the device and ReportType that match the
   1.946 +                                        UsagePage and LinkCollection that were
   1.947 +                                        specified
   1.948 +--*/
   1.949 +
   1.950 +#define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)  \
   1.951 +         HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)
   1.952 +
   1.953 +NTSTATUS __stdcall
   1.954 +HidP_GetUsagesEx (
   1.955 +        HIDP_REPORT_TYPE    ReportType,
   1.956 +        USHORT  LinkCollection, // Optional
   1.957 +    PUSAGE_AND_PAGE  ButtonList,
   1.958 +       ULONG * UsageLength,
   1.959 +     PHIDP_PREPARSED_DATA PreparsedData,
   1.960 +    reads_bytes_(ReportLength)   PCHAR   Report,
   1.961 +     ULONG  ReportLength
   1.962 +   );
   1.963 +
   1.964 +/*++
   1.965 +
   1.966 +Routine Description:
   1.967 +    This function returns the binary values (buttons) in a HID report.
   1.968 +    Given a report packet of correct length, it searches the report packet
   1.969 +    for all buttons and returns the UsagePage and Usage for each of the buttons
   1.970 +    it finds.
   1.971 +
   1.972 +Parameters:
   1.973 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
   1.974 +
   1.975 +    LinkCollection  An optional value which can limit which usages are returned
   1.976 +                    in the ButtonList to those usages that exist in a specific
   1.977 +                    LinkCollection.  A non-zero value indicates the index into
   1.978 +                    the HIDP_LINK_COLLECITON_NODE list returned by
   1.979 +                    HidP_GetLinkCollectionNodes of the link collection the
   1.980 +                    usage should belong to.  A value of 0 indicates this
   1.981 +                    should value be ignored.
   1.982 +
   1.983 +    ButtonList  An array of USAGE_AND_PAGE structures describing all the
   1.984 +                buttons currently ``down'' in the device.
   1.985 +
   1.986 +    UsageLength The length of the given array in terms of elements.
   1.987 +                On input, this value describes the length of the list.  On
   1.988 +                output, HidP_GetUsagesEx sets this value to the number of
   1.989 +                usages that were found.  Use HidP_MaxUsageListLength to
   1.990 +                determine the maximum length needed to return all the usages
   1.991 +                that a given report packet may contain.
   1.992 +
   1.993 +    PreparsedData Preparsed data returned by HIDCLASS
   1.994 +
   1.995 +    Report       The report packet.
   1.996 +
   1.997 +    ReportLength Length (in bytes) of the given report packet.
   1.998 +
   1.999 +
  1.1000 +Return Value
  1.1001 +    HidP_GetUsagesEx returns the following error codes:
  1.1002 +
  1.1003 +  HIDP_STATUS_SUCCESS                -- upon successfully retrieving all the
  1.1004 +                                        usages from the report packet
  1.1005 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1006 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1007 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1008 +                                        equal to the length specified in
  1.1009 +                                        the HIDP_CAPS structure for the given
  1.1010 +                                        ReportType
  1.1011 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
  1.1012 +                                        for the given ReportType
  1.1013 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if ButtonList is not big enough to
  1.1014 +                                        hold all the usages found in the report
  1.1015 +                                        packet.  If this is returned, the buffer
  1.1016 +                                        will contain UsageLength number of
  1.1017 +                                        usages.  Use HidP_MaxUsageListLength to
  1.1018 +                                        find the maximum length needed
  1.1019 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages
  1.1020 +                                        that match the specified LinkCollection
  1.1021 +                                        exist in report with a different report
  1.1022 +                                        ID.
  1.1023 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if there are no usages in any reports that
  1.1024 +                                        match the LinkCollection parameter
  1.1025 +--*/
  1.1026 +        
  1.1027 +_IRQL_requires_max_(PASSIVE_LEVEL) 
  1.1028 +ULONG __stdcall
  1.1029 +HidP_MaxUsageListLength (
  1.1030 +    HIDP_REPORT_TYPE      ReportType,
  1.1031 +    USAGE                 UsagePage, // Optional
  1.1032 +    PHIDP_PREPARSED_DATA  PreparsedData
  1.1033 +   );
  1.1034 +/*++
  1.1035 +Routine Description:
  1.1036 +    This function returns the maximum number of usages that a call to
  1.1037 +    HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report.
  1.1038 +    If calling for number of usages returned by HidP_GetUsagesEx, use 0 as
  1.1039 +    the UsagePage value.
  1.1040 +
  1.1041 +Parameters:
  1.1042 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
  1.1043 +
  1.1044 +    UsagePage   Specifies the optional UsagePage to query for.  If 0, will
  1.1045 +                return all the maximum number of usage values that could be
  1.1046 +                returned for a given ReportType.   If non-zero, will return
  1.1047 +                the maximum number of usages that would be returned for the
  1.1048 +                ReportType with the given UsagePage.
  1.1049 +
  1.1050 +    PreparsedData Preparsed data returned from HIDCLASS
  1.1051 +
  1.1052 +Return Value:
  1.1053 +    The length of the usage list array required for the HidP_GetUsages or
  1.1054 +    HidP_GetUsagesEx function call.  If an error occurs (such as
  1.1055 +    HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this
  1.1056 +    returns 0.
  1.1057 +--*/
  1.1058 +
  1.1059 +
  1.1060 +NTSTATUS __stdcall
  1.1061 +HidP_SetUsageValue (
  1.1062 +     HIDP_REPORT_TYPE ReportType,
  1.1063 +     USAGE UsagePage,
  1.1064 +     USHORT LinkCollection,
  1.1065 +     USAGE Usage,
  1.1066 +     ULONG UsageValue,
  1.1067 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1068 +    updates_bytes_(ReportLength) PCHAR Report,
  1.1069 +     ULONG ReportLength
  1.1070 +    );
  1.1071 +/*++
  1.1072 +Description:
  1.1073 +    HidP_SetUsageValue inserts a value into the HID Report Packet in the field
  1.1074 +    corresponding to the given usage page and usage.  HidP_SetUsageValue
  1.1075 +    casts this value to the appropriate bit length.  If a report packet
  1.1076 +    contains two different fields with the same Usage and UsagePage,
  1.1077 +    they can be distinguished with the optional LinkCollection field value.
  1.1078 +    Using this function sets the raw value into the report packet with
  1.1079 +    no checking done as to whether it actually falls within the logical
  1.1080 +    minimum/logical maximum range.  Use HidP_SetScaledUsageValue for this...
  1.1081 +
  1.1082 +    NOTE: Although the UsageValue parameter is a ULONG, any casting that is
  1.1083 +          done will preserve or sign-extend the value.  The value being set
  1.1084 +          should be considered a LONG value and will be treated as such by
  1.1085 +          this function.
  1.1086 +
  1.1087 +Parameters:
  1.1088 +
  1.1089 +    ReportType  One of HidP_Output or HidP_Feature.
  1.1090 +
  1.1091 +    UsagePage   The usage page to which the given usage refers.
  1.1092 +
  1.1093 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1094 +                                between two fields that may have the same
  1.1095 +                                UsagePage and Usage but exist in different
  1.1096 +                                collections.  If the link collection value
  1.1097 +                                is zero, this function will set the first field
  1.1098 +                                it finds that matches the usage page and
  1.1099 +                                usage.
  1.1100 +
  1.1101 +    Usage       The usage whose value HidP_SetUsageValue will set.
  1.1102 +
  1.1103 +    UsageValue  The raw value to set in the report buffer.  This value must be within
  1.1104 +                the logical range or if a NULL value this value should be the
  1.1105 +                most negative value that can be represented by the number of bits
  1.1106 +                for this field.
  1.1107 +
  1.1108 +    PreparsedData The preparsed data returned for HIDCLASS
  1.1109 +
  1.1110 +    Report      The report packet.
  1.1111 +
  1.1112 +    ReportLength Length (in bytes) of the given report packet.
  1.1113 +
  1.1114 +
  1.1115 +Return Value:
  1.1116 +    HidP_SetUsageValue returns the following error codes:
  1.1117 +
  1.1118 +  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
  1.1119 +                                        in the report packet
  1.1120 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1121 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1122 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1123 +                                        equal to the length specified in
  1.1124 +                                        the HIDP_CAPS structure for the given
  1.1125 +                                        ReportType
  1.1126 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
  1.1127 +                                        for the given ReportType
  1.1128 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1129 +                                        link collection exist but exists in
  1.1130 +                                        a report with a different report ID
  1.1131 +                                        than the report being passed in.  To
  1.1132 +                                        set this value, call HidP_SetUsageValue
  1.1133 +                                        again with a zero-initizialed report
  1.1134 +                                        packet
  1.1135 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1136 +                                        collection combination does not exist
  1.1137 +                                        in any reports for this ReportType
  1.1138 +--*/
  1.1139 +
  1.1140 +NTSTATUS __stdcall
  1.1141 +HidP_SetScaledUsageValue (
  1.1142 +     HIDP_REPORT_TYPE ReportType,
  1.1143 +     USAGE UsagePage,
  1.1144 +     USHORT LinkCollection,
  1.1145 +     USAGE Usage,
  1.1146 +     LONG UsageValue,
  1.1147 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1148 +    updates_bytes_(ReportLength) PCHAR Report,
  1.1149 +     ULONG ReportLength
  1.1150 +    );
  1.1151 +
  1.1152 +/*++
  1.1153 +Description:
  1.1154 +    HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet
  1.1155 +    in the field corresponding to the given usage page and usage.  If a report
  1.1156 +    packet contains two different fields with the same Usage and UsagePage,
  1.1157 +    they can be distinguished with the optional LinkCollection field value.
  1.1158 +
  1.1159 +    If the specified field has a defined physical range, this function converts
  1.1160 +    the physical value specified to the corresponding logical value for the
  1.1161 +    report.  If a physical value does not exist, the function will verify that
  1.1162 +    the value specified falls within the logical range and set according.
  1.1163 +
  1.1164 +    If the range checking fails but the field has NULL values, the function will
  1.1165 +    set the field to the defined NULL value (most negative number possible) and
  1.1166 +    return HIDP_STATUS_NULL.  In other words, use this function to set NULL
  1.1167 +    values for a given field by passing in a value that falls outside the
  1.1168 +    physical range if it is defined or the logical range otherwise.
  1.1169 +
  1.1170 +    If the field does not support NULL values, an out of range error will be
  1.1171 +    returned instead.
  1.1172 +
  1.1173 +Parameters:
  1.1174 +
  1.1175 +    ReportType  One of HidP_Output or HidP_Feature.
  1.1176 +
  1.1177 +    UsagePage   The usage page to which the given usage refers.
  1.1178 +
  1.1179 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1180 +                                between two fields that may have the same
  1.1181 +                                UsagePage and Usage but exist in different
  1.1182 +                                collections.  If the link collection value
  1.1183 +                                is zero, this function will set the first field
  1.1184 +                                it finds that matches the usage page and
  1.1185 +                                usage.
  1.1186 +
  1.1187 +    Usage       The usage whose value HidP_SetScaledUsageValue will set.
  1.1188 +
  1.1189 +    UsageValue  The value to set in the report buffer.  See the routine
  1.1190 +                description above for the different interpretations of this
  1.1191 +                value
  1.1192 +
  1.1193 +    PreparsedData The preparsed data returned from HIDCLASS
  1.1194 +
  1.1195 +    Report      The report packet.
  1.1196 +
  1.1197 +    ReportLength Length (in bytes) of the given report packet.
  1.1198 +
  1.1199 +
  1.1200 +Return Value:
  1.1201 +   HidP_SetScaledUsageValue returns the following error codes:
  1.1202 +
  1.1203 +  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
  1.1204 +                                        in the report packet
  1.1205 +  HIDP_STATUS_NULL                   -- upon successfully setting the value
  1.1206 +                                        in the report packet as a NULL value
  1.1207 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1208 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1209 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1210 +                                        equal to the length specified in
  1.1211 +                                        the HIDP_CAPS structure for the given
  1.1212 +                                        ReportType
  1.1213 +  HIDP_STATUS_VALUEOF_RANGE     -- if the value specified failed to fall
  1.1214 +                                        within the physical range if it exists
  1.1215 +                                        or within the logical range otherwise
  1.1216 +                                        and the field specified by the usage
  1.1217 +                                        does not allow NULL values
  1.1218 +  HIDP_STATUS_BAD_LOG_PHY_VALUES     -- if the field has a physical range but
  1.1219 +                                        either the logical range is invalid
  1.1220 +                                        (max <= min) or the physical range is
  1.1221 +                                        invalid
  1.1222 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1223 +                                        link collection exist but exists in
  1.1224 +                                        a report with a different report ID
  1.1225 +                                        than the report being passed in.  To
  1.1226 +                                        set this value, call
  1.1227 +                                        HidP_SetScaledUsageValue again with
  1.1228 +                                        a zero-initialized report packet
  1.1229 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1230 +                                        collection combination does not exist
  1.1231 +                                        in any reports for this ReportType
  1.1232 +--*/
  1.1233 +
  1.1234 +NTSTATUS __stdcall
  1.1235 +HidP_SetUsageValueArray (
  1.1236 +     HIDP_REPORT_TYPE ReportType,
  1.1237 +     USAGE UsagePage,
  1.1238 +     USHORT LinkCollection,
  1.1239 +     USAGE Usage,
  1.1240 +    reads_bytes_(UsageValueByteLength) PCHAR UsageValue,
  1.1241 +     USHORT UsageValueByteLength,
  1.1242 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1243 +    updates_bytes_(ReportLength) PCHAR Report,
  1.1244 +     ULONG ReportLength
  1.1245 +    );
  1.1246 +
  1.1247 +/*++
  1.1248 +Routine Descripton:
  1.1249 +    A usage value array occurs when the last usage in the list of usages
  1.1250 +    describing a main item must be repeated because there are less usages defined
  1.1251 +    than there are report counts declared for the given main item.  In this case
  1.1252 +    a single value cap is allocated for that usage and the report count of that
  1.1253 +    value cap is set to reflect the number of fields to which that usage refers.
  1.1254 +
  1.1255 +    HidP_SetUsageValueArray sets the raw bits for that usage which spans
  1.1256 +    more than one field in a report.
  1.1257 +
  1.1258 +    NOTE: This function currently does not support value arrays where the
  1.1259 +          ReportSize for each of the fields in the array is not a multiple
  1.1260 +          of 8 bits.
  1.1261 +
  1.1262 +          The UsageValue buffer should have the values set as they would appear
  1.1263 +          in the report buffer.  If this function supported non 8-bit multiples
  1.1264 +          for the ReportSize then caller should format the input buffer so that
  1.1265 +          each new value begins at the bit immediately following the last bit
  1.1266 +          of the previous value
  1.1267 +
  1.1268 +Parameters:
  1.1269 +
  1.1270 +    ReportType  One of HidP_Output or HidP_Feature.
  1.1271 +
  1.1272 +    UsagePage   The usage page to which the given usage refers.
  1.1273 +
  1.1274 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1275 +                                between two fields that may have the same
  1.1276 +                                UsagePage and Usage but exist in different
  1.1277 +                                collections.  If the link collection value
  1.1278 +                                is zero, this function will set the first field
  1.1279 +                                it finds that matches the usage page and
  1.1280 +                                usage.
  1.1281 +
  1.1282 +    Usage       The usage whose value array HidP_SetUsageValueArray will set.
  1.1283 +
  1.1284 +    UsageValue  The buffer with the values to set into the value array.
  1.1285 +                The number of BITS required is found by multiplying the
  1.1286 +                BitSize and ReportCount fields of the Value Cap for this
  1.1287 +                control.  The least significant bit of this control found in the
  1.1288 +                given report will be placed in the least significan bit location
  1.1289 +                of the array given (little-endian format), regardless of whether
  1.1290 +                or not the field is byte alligned or if the BitSize is a multiple
  1.1291 +                of sizeof (CHAR).
  1.1292 +
  1.1293 +                See the above note for current implementation limitations.
  1.1294 +
  1.1295 +    UsageValueByteLength  Length of the UsageValue buffer (in bytes)
  1.1296 +
  1.1297 +    PreparsedData The preparsed data returned from HIDCLASS
  1.1298 +
  1.1299 +    Report      The report packet.
  1.1300 +
  1.1301 +    ReportLength Length (in bytes) of the given report packet.
  1.1302 +
  1.1303 +
  1.1304 +Return Value:
  1.1305 +  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
  1.1306 +                                        array in the report packet
  1.1307 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1308 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1309 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1310 +                                        equal to the length specified in
  1.1311 +                                        the HIDP_CAPS structure for the given
  1.1312 +                                        ReportType
  1.1313 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
  1.1314 +                                        for the given ReportType
  1.1315 +  HIDP_STATUS_NOT_VALUE_ARRAY        -- if the control specified is not a
  1.1316 +                                        value array -- a value array will have
  1.1317 +                                        a ReportCount field in the
  1.1318 +                                        HIDP_VALUE_CAPS structure that is > 1
  1.1319 +                                        Use HidP_SetUsageValue instead
  1.1320 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the size of the passed in buffer with
  1.1321 +                                        the values to set is too small (ie. has
  1.1322 +                                        fewer values than the number of fields in
  1.1323 +                                        the array
  1.1324 +  HIDP_STATUS_NOT_IMPLEMENTED        -- if the usage value array has field sizes
  1.1325 +                                        that are not multiples of 8 bits, this
  1.1326 +                                        error code is returned since the function
  1.1327 +                                        currently does not handle setting into
  1.1328 +                                        such arrays.
  1.1329 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1330 +                                        link collection exist but exists in
  1.1331 +                                        a report with a different report ID
  1.1332 +                                        than the report being passed in.  To
  1.1333 +                                        set this value, call
  1.1334 +                                        HidP_SetUsageValueArray again with
  1.1335 +                                        a zero-initialized report packet
  1.1336 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1337 +                                        collection combination does not exist
  1.1338 +                                        in any reports for this ReportType
  1.1339 +--*/
  1.1340 +
  1.1341 +
  1.1342 +NTSTATUS __stdcall
  1.1343 +HidP_GetUsageValue (
  1.1344 +     HIDP_REPORT_TYPE ReportType,
  1.1345 +     USAGE UsagePage,
  1.1346 +     USHORT LinkCollection,
  1.1347 +     USAGE Usage,
  1.1348 +     PULONG UsageValue,
  1.1349 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1350 +    reads_bytes_(ReportLength) PCHAR Report,
  1.1351 +     ULONG ReportLength
  1.1352 +    );
  1.1353 +
  1.1354 +/*
  1.1355 +Description
  1.1356 +    HidP_GetUsageValue retrieves the value from the HID Report for the usage
  1.1357 +    specified by the combination of usage page, usage and link collection.
  1.1358 +    If a report packet contains two different fields with the same
  1.1359 +    Usage and UsagePage, they can be distinguished with the optional
  1.1360 +    LinkCollection field value.
  1.1361 +
  1.1362 +Parameters:
  1.1363 +
  1.1364 +    ReportType  One of HidP_Input or HidP_Feature.
  1.1365 +
  1.1366 +    UsagePage   The usage page to which the given usage refers.
  1.1367 +
  1.1368 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1369 +                                between two fields that may have the same
  1.1370 +                                UsagePage and Usage but exist in different
  1.1371 +                                collections.  If the link collection value
  1.1372 +                                is zero, this function will set the first field
  1.1373 +                                it finds that matches the usage page and
  1.1374 +                                usage.
  1.1375 +
  1.1376 +    Usage       The usage whose value HidP_GetUsageValue will retrieve
  1.1377 +
  1.1378 +    UsageValue  The raw value that is set for the specified field in the report
  1.1379 +                buffer. This value will either fall within the logical range
  1.1380 +                or if NULL values are allowed, a number outside the range to
  1.1381 +                indicate a NULL
  1.1382 +
  1.1383 +    PreparsedData The preparsed data returned for HIDCLASS
  1.1384 +
  1.1385 +    Report      The report packet.
  1.1386 +
  1.1387 +    ReportLength Length (in bytes) of the given report packet.
  1.1388 +
  1.1389 +
  1.1390 +Return Value:
  1.1391 +    HidP_GetUsageValue returns the following error codes:
  1.1392 +
  1.1393 +  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
  1.1394 +                                        from the report packet
  1.1395 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1396 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1397 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1398 +                                        equal to the length specified in
  1.1399 +                                        the HIDP_CAPS structure for the given
  1.1400 +                                        ReportType
  1.1401 +  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
  1.1402 +                                        for the given ReportType
  1.1403 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1404 +                                        link collection exist but exists in
  1.1405 +                                        a report with a different report ID
  1.1406 +                                        than the report being passed in.  To
  1.1407 +                                        set this value, call HidP_GetUsageValue
  1.1408 +                                        again with a different report packet
  1.1409 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1410 +                                        collection combination does not exist
  1.1411 +                                        in any reports for this ReportType
  1.1412 +--*/
  1.1413 +
  1.1414 +
  1.1415 +NTSTATUS __stdcall
  1.1416 +HidP_GetScaledUsageValue (
  1.1417 +     HIDP_REPORT_TYPE ReportType,
  1.1418 +     USAGE UsagePage,
  1.1419 +     USHORT LinkCollection,
  1.1420 +     USAGE Usage,
  1.1421 +     PLONG UsageValue,
  1.1422 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1423 +    reads_bytes_(ReportLength) PCHAR Report,
  1.1424 +     ULONG ReportLength
  1.1425 +    );
  1.1426 +
  1.1427 +/*++
  1.1428 +Description
  1.1429 +    HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet
  1.1430 +    in the field corresponding to the given usage page and usage.  If a report
  1.1431 +    packet contains two different fields with the same Usage and UsagePage,
  1.1432 +    they can be distinguished with the optional LinkCollection field value.
  1.1433 +
  1.1434 +    If the specified field has a defined physical range, this function converts
  1.1435 +    the logical value that exists in the report packet to the corresponding
  1.1436 +    physical value.  If a physical range does not exist, the function will
  1.1437 +    return the logical value.  This function will check to verify that the
  1.1438 +    logical value in the report falls within the declared logical range.
  1.1439 +
  1.1440 +    When doing the conversion between logical and physical values, this
  1.1441 +    function assumes a linear extrapolation between the physical max/min and
  1.1442 +    the logical max/min. (Where logical is the values reported by the device
  1.1443 +    and physical is the value returned by this function).  If the data field
  1.1444 +    size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend
  1.1445 +    the value to 32 bits.
  1.1446 +
  1.1447 +    If the range checking fails but the field has NULL values, the function
  1.1448 +    will set UsageValue to 0 and return HIDP_STATUS_NULL.  Otherwise, it
  1.1449 +    returns a HIDP_STATUSOF_RANGE error.
  1.1450 +
  1.1451 +Parameters:
  1.1452 +
  1.1453 +    ReportType  One of HidP_Output or HidP_Feature.
  1.1454 +
  1.1455 +    UsagePage   The usage page to which the given usage refers.
  1.1456 +
  1.1457 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1458 +                                between two fields that may have the same
  1.1459 +                                UsagePage and Usage but exist in different
  1.1460 +                                collections.  If the link collection value
  1.1461 +                                is zero, this function will retrieve the first
  1.1462 +                                field it finds that matches the usage page
  1.1463 +                                and usage.
  1.1464 +
  1.1465 +    Usage       The usage whose value HidP_GetScaledUsageValue will retrieve
  1.1466 +
  1.1467 +    UsageValue  The value retrieved from the report buffer.  See the routine
  1.1468 +                description above for the different interpretations of this
  1.1469 +                value
  1.1470 +
  1.1471 +    PreparsedData The preparsed data returned from HIDCLASS
  1.1472 +
  1.1473 +    Report      The report packet.
  1.1474 +
  1.1475 +    ReportLength Length (in bytes) of the given report packet.
  1.1476 +
  1.1477 +
  1.1478 +Return Value:
  1.1479 +   HidP_GetScaledUsageValue returns the following error codes:
  1.1480 +
  1.1481 +  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
  1.1482 +                                        from the report packet
  1.1483 +  HIDP_STATUS_NULL                   -- if the report packet had a NULL value
  1.1484 +                                        set
  1.1485 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1486 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1487 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1488 +                                        equal to the length specified in
  1.1489 +                                        the HIDP_CAPS structure for the given
  1.1490 +                                        ReportType
  1.1491 +  HIDP_STATUS_VALUEOF_RANGE     -- if the value retrieved from the packet
  1.1492 +                                        falls outside the logical range and
  1.1493 +                                        the field does not support NULL values
  1.1494 +  HIDP_STATUS_BAD_LOG_PHY_VALUES     -- if the field has a physical range but
  1.1495 +                                        either the logical range is invalid
  1.1496 +                                        (max <= min) or the physical range is
  1.1497 +                                        invalid
  1.1498 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1499 +                                        link collection exist but exists in
  1.1500 +                                        a report with a different report ID
  1.1501 +                                        than the report being passed in.  To
  1.1502 +                                        set this value, call
  1.1503 +                                        HidP_GetScaledUsageValue with a
  1.1504 +                                        different report packet
  1.1505 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1506 +                                        collection combination does not exist
  1.1507 +                                        in any reports for this ReportType
  1.1508 +--*/
  1.1509 +
  1.1510 +NTSTATUS __stdcall
  1.1511 +HidP_GetUsageValueArray (
  1.1512 +     HIDP_REPORT_TYPE ReportType,
  1.1513 +     USAGE UsagePage,
  1.1514 +     USHORT LinkCollection,
  1.1515 +     USAGE Usage,
  1.1516 +    updates_bytes_(UsageValueByteLength) PCHAR UsageValue,
  1.1517 +     USHORT UsageValueByteLength,
  1.1518 +     PHIDP_PREPARSED_DATA PreparsedData,
  1.1519 +    reads_bytes_(ReportLength) PCHAR Report,
  1.1520 +     ULONG ReportLength
  1.1521 +    );
  1.1522 +
  1.1523 +/*++
  1.1524 +Routine Descripton:
  1.1525 +    A usage value array occurs when the last usage in the list of usages
  1.1526 +    describing a main item must be repeated because there are less usages defined
  1.1527 +    than there are report counts declared for the given main item.  In this case
  1.1528 +    a single value cap is allocated for that usage and the report count of that
  1.1529 +    value cap is set to reflect the number of fields to which that usage refers.
  1.1530 +
  1.1531 +    HidP_GetUsageValueArray returns the raw bits for that usage which spans
  1.1532 +    more than one field in a report.
  1.1533 +
  1.1534 +    NOTE: This function currently does not support value arrays where the
  1.1535 +          ReportSize for each of the fields in the array is not a multiple
  1.1536 +          of 8 bits.
  1.1537 +
  1.1538 +          The UsageValue buffer will have the raw values as they are set
  1.1539 +          in the report packet.
  1.1540 +
  1.1541 +Parameters:
  1.1542 +
  1.1543 +    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
  1.1544 +
  1.1545 +    UsagePage   The usage page to which the given usage refers.
  1.1546 +
  1.1547 +    LinkCollection  (Optional)  This value can be used to differentiate
  1.1548 +                                between two fields that may have the same
  1.1549 +                                UsagePage and Usage but exist in different
  1.1550 +                                collections.  If the link collection value
  1.1551 +                                is zero, this function will set the first field
  1.1552 +                                it finds that matches the usage page and
  1.1553 +                                usage.
  1.1554 +
  1.1555 +   Usage       The usage whose value HidP_GetUsageValueArray will retreive.
  1.1556 +
  1.1557 +   UsageValue  A pointer to an array of characters where the value will be
  1.1558 +               placed.  The number of BITS required is found by multiplying the
  1.1559 +               BitSize and ReportCount fields of the Value Cap for this
  1.1560 +               control.  The least significant bit of this control found in the
  1.1561 +               given report will be placed in the least significant bit location
  1.1562 +               of the buffer (little-endian format), regardless of whether
  1.1563 +               or not the field is byte aligned or if the BitSize is a multiple
  1.1564 +               of sizeof (CHAR).
  1.1565 +
  1.1566 +               See note above about current implementation limitations
  1.1567 +
  1.1568 +   UsageValueByteLength
  1.1569 +               the length of the given UsageValue buffer.
  1.1570 +
  1.1571 +   PreparsedData The preparsed data returned by the HIDCLASS
  1.1572 +
  1.1573 +   Report      The report packet.
  1.1574 +
  1.1575 +   ReportLength   Length of the given report packet.
  1.1576 +
  1.1577 +Return Value:
  1.1578 +
  1.1579 +  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
  1.1580 +                                        from the report packet
  1.1581 +  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
  1.1582 +  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
  1.1583 +  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
  1.1584 +                                        equal to the length specified in
  1.1585 +                                        the HIDP_CAPS structure for the given
  1.1586 +                                        ReportType
  1.1587 +  HIDP_STATUS_NOT_VALUE_ARRAY        -- if the control specified is not a
  1.1588 +                                        value array -- a value array will have
  1.1589 +                                        a ReportCount field in the
  1.1590 +                                        HIDP_VALUE_CAPS structure that is > 1
  1.1591 +                                        Use HidP_GetUsageValue instead
  1.1592 +  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the size of the passed in buffer in
  1.1593 +                                        which to return the array is too small
  1.1594 +                                        (ie. has fewer values than the number of
  1.1595 +                                        fields in the array
  1.1596 +  HIDP_STATUS_NOT_IMPLEMENTED        -- if the usage value array has field sizes
  1.1597 +                                        that are not multiples of 8 bits, this
  1.1598 +                                        error code is returned since the function
  1.1599 +                                        currently does not handle getting values
  1.1600 +                                        from such arrays.
  1.1601 +  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
  1.1602 +                                        link collection exist but exists in
  1.1603 +                                        a report with a different report ID
  1.1604 +                                        than the report being passed in.  To
  1.1605 +                                        set this value, call
  1.1606 +                                        HidP_GetUsageValueArray with a
  1.1607 +                                        different report packet
  1.1608 +  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
  1.1609 +                                        collection combination does not exist
  1.1610 +                                        in any reports for this ReportType
  1.1611 +--*/
  1.1612 +
  1.1613 +
  1.1614 +_IRQL_requires_max_(PASSIVE_LEVEL)
  1.1615 +NTSTATUS __stdcall
  1.1616 +HidP_UsageListDifference (
  1.1617 +   reads_(UsageListLength) PUSAGE  PreviousUsageList,
  1.1618 +   reads_(UsageListLength) PUSAGE  CurrentUsageList,
  1.1619 +   writes_(UsageListLength) PUSAGE  BreakUsageList,
  1.1620 +   writes_(UsageListLength) PUSAGE  MakeUsageList,
  1.1621 +    ULONG    UsageListLength
  1.1622 +    );
  1.1623 +/*++
  1.1624 +Routine Description:
  1.1625 +    This function will return the difference between a two lists of usages
  1.1626 +    (as might be returned from HidP_GetUsages),  In other words, it will return
  1.1627 +    return a list of usages that are in the current list but not the previous
  1.1628 +    list as well as a list of usages that are in the previous list but not
  1.1629 +    the current list.
  1.1630 +
  1.1631 +Parameters:
  1.1632 +
  1.1633 +    PreviousUsageList   The list of usages before.
  1.1634 +    CurrentUsageList    The list of usages now.
  1.1635 +    BreakUsageList      Previous - Current.
  1.1636 +    MakeUsageList       Current - Previous.
  1.1637 +    UsageListLength     Represents the length of the usage lists in array
  1.1638 +                        elements.  If comparing two lists with a differing
  1.1639 +                        number of array elements, this value should be
  1.1640 +                        the size of the larger of the two lists.  Any
  1.1641 +                        zero found with a list indicates an early termination
  1.1642 +                        of the list and any usages found after the first zero
  1.1643 +                        will be ignored.
  1.1644 +--*/
  1.1645 +
  1.1646 +
  1.1647 +_IRQL_requires_max_(PASSIVE_LEVEL)
  1.1648 +NTSTATUS __stdcall
  1.1649 +HidP_UsageAndPageListDifference (
  1.1650 +   reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList,
  1.1651 +   reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList,
  1.1652 +   writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList,
  1.1653 +   writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList,
  1.1654 +    ULONG           UsageListLength
  1.1655 +   );
  1.1656 +
  1.1657 +//
  1.1658 +// Produce Make or Break Codes
  1.1659 +//
  1.1660 +typedef enum _HIDP_KEYBOARD_DIRECTION {
  1.1661 +    HidP_Keyboard_Break,
  1.1662 +    HidP_Keyboard_Make
  1.1663 +} HIDP_KEYBOARD_DIRECTION;
  1.1664 +
  1.1665 +//
  1.1666 +// A bitmap of the current shift state of the keyboard when using the
  1.1667 +// below keyboard usages to i8042 translation function.
  1.1668 +//
  1.1669 +typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
  1.1670 +   union {
  1.1671 +      struct {
  1.1672 +         ULONG LeftControl: 1;
  1.1673 +         ULONG LeftShift: 1;
  1.1674 +         ULONG LeftAlt: 1;
  1.1675 +         ULONG LeftGUI: 1;
  1.1676 +         ULONG RightControl: 1;
  1.1677 +         ULONG RightShift: 1;
  1.1678 +         ULONG RightAlt: 1;
  1.1679 +         ULONG RigthGUI: 1;
  1.1680 +         ULONG CapsLock: 1;
  1.1681 +         ULONG ScollLock: 1;
  1.1682 +         ULONG NumLock: 1;
  1.1683 +         ULONG Reserved: 21;
  1.1684 +      };
  1.1685 +      ULONG ul;
  1.1686 +   };
  1.1687 +
  1.1688 +} HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE;
  1.1689 +
  1.1690 +//
  1.1691 +// A call back function to give the i8042 scan codes to the caller of
  1.1692 +// the below translation function.
  1.1693 +//
  1.1694 +typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) (
  1.1695 +                   PVOID Context,  // Some caller supplied context.
  1.1696 +                  reads_bytes_(Length) PCHAR NewScanCodes, // A list of i8042 scan codes.
  1.1697 +                   ULONG Length // the length of the scan codes.
  1.1698 +                  );
  1.1699 +
  1.1700 +
  1.1701 +NTSTATUS __stdcall
  1.1702 +HidP_TranslateUsageAndPagesToI8042ScanCodes (
  1.1703 +    reads_(UsageListLength)     PUSAGE_AND_PAGE ChangedUsageList,
  1.1704 +         ULONG                         UsageListLength,
  1.1705 +         HIDP_KEYBOARD_DIRECTION       KeyAction,
  1.1706 +      PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
  1.1707 +         PHIDP_INSERT_SCANCODES        InsertCodesProcedure,
  1.1708 +     PVOID                         InsertCodesContext
  1.1709 +    );
  1.1710 +/*++
  1.1711 +Routine Description:
  1.1712 +Parameters:
  1.1713 +--*/
  1.1714 +
  1.1715 +NTSTATUS __stdcall
  1.1716 +HidP_TranslateUsagesToI8042ScanCodes (
  1.1717 +    reads_(UsageListLength)     PUSAGE ChangedUsageList,
  1.1718 +         ULONG                         UsageListLength,
  1.1719 +         HIDP_KEYBOARD_DIRECTION       KeyAction,
  1.1720 +      PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
  1.1721 +         PHIDP_INSERT_SCANCODES        InsertCodesProcedure,
  1.1722 +     PVOID                         InsertCodesContext
  1.1723 +    );
  1.1724 +/*++
  1.1725 +Routine Description:
  1.1726 +Parameters:
  1.1727 +--*/
  1.1728 +
  1.1729 +
  1.1730 +
  1.1731 +//
  1.1732 +// Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE
  1.1733 +//
  1.1734 +
  1.1735 +// FACILITY_HID_ERROR_CODE defined in ntstatus.h
  1.1736 +#ifndef FACILITY_HID_ERROR_CODE
  1.1737 +#define FACILITY_HID_ERROR_CODE 0x11
  1.1738 +#endif
  1.1739 +
  1.1740 +#define HIDP_ERROR_CODES(SEV, CODE) \
  1.1741 +        ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
  1.1742 +
  1.1743 +#define HIDP_STATUS_SUCCESS                  (HIDP_ERROR_CODES(0x0,0))
  1.1744 +#define HIDP_STATUS_NULL                     (HIDP_ERROR_CODES(0x8,1))
  1.1745 +#define HIDP_STATUS_INVALID_PREPARSED_DATA   (HIDP_ERROR_CODES(0xC,1))
  1.1746 +#define HIDP_STATUS_INVALID_REPORT_TYPE      (HIDP_ERROR_CODES(0xC,2))
  1.1747 +#define HIDP_STATUS_INVALID_REPORT_LENGTH    (HIDP_ERROR_CODES(0xC,3))
  1.1748 +#define HIDP_STATUS_USAGE_NOT_FOUND          (HIDP_ERROR_CODES(0xC,4))
  1.1749 +#define HIDP_STATUS_VALUEOF_RANGE       (HIDP_ERROR_CODES(0xC,5))
  1.1750 +#define HIDP_STATUS_BAD_LOG_PHY_VALUES       (HIDP_ERROR_CODES(0xC,6))
  1.1751 +#define HIDP_STATUS_BUFFER_TOO_SMALL         (HIDP_ERROR_CODES(0xC,7))
  1.1752 +#define HIDP_STATUS_INTERNAL_ERROR           (HIDP_ERROR_CODES(0xC,8))
  1.1753 +#define HIDP_STATUS_I8042_TRANS_UNKNOWN      (HIDP_ERROR_CODES(0xC,9))
  1.1754 +#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID   (HIDP_ERROR_CODES(0xC,0xA))
  1.1755 +#define HIDP_STATUS_NOT_VALUE_ARRAY          (HIDP_ERROR_CODES(0xC,0xB))
  1.1756 +#define HIDP_STATUS_IS_VALUE_ARRAY           (HIDP_ERROR_CODES(0xC,0xC))
  1.1757 +#define HIDP_STATUS_DATA_INDEX_NOT_FOUND     (HIDP_ERROR_CODES(0xC,0xD))
  1.1758 +#define HIDP_STATUS_DATA_INDEXOF_RANGE  (HIDP_ERROR_CODES(0xC,0xE))
  1.1759 +#define HIDP_STATUS_BUTTON_NOT_PRESSED       (HIDP_ERROR_CODES(0xC,0xF))
  1.1760 +#define HIDP_STATUS_REPORT_DOES_NOT_EXIST    (HIDP_ERROR_CODES(0xC,0x10))
  1.1761 +#define HIDP_STATUS_NOT_IMPLEMENTED          (HIDP_ERROR_CODES(0xC,0x20))
  1.1762 +
  1.1763 +//
  1.1764 +// We blundered this status code.
  1.1765 +//
  1.1766 +#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN
  1.1767 +
  1.1768 +/*++
  1.1769 +
  1.1770 +Copyright (c) Microsoft Corporation. All rights reserved.
  1.1771 +
  1.1772 +Module Name:
  1.1773 +
  1.1774 +    HIDSDI.H
  1.1775 +
  1.1776 +Abstract:
  1.1777 +
  1.1778 +    This module contains the PUBLIC definitions for the
  1.1779 +    code that implements the HID dll.
  1.1780 +
  1.1781 +Environment:
  1.1782 +
  1.1783 +    Kernel & user mode
  1.1784 +
  1.1785 +--*/
  1.1786 +
  1.1787 +
  1.1788 +
  1.1789 +
  1.1790 +typedef struct _HIDD_CONFIGURATION {
  1.1791 +    PVOID    cookie;
  1.1792 +    ULONG    size;
  1.1793 +    ULONG    RingBufferSize;
  1.1794 +} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION;
  1.1795 +
  1.1796 +typedef struct _HIDD_ATTRIBUTES {
  1.1797 +    ULONG   Size; // = sizeof (struct _HIDD_ATTRIBUTES)
  1.1798 +
  1.1799 +    //
  1.1800 +    // Vendor ids of this hid device
  1.1801 +    //
  1.1802 +    USHORT  VendorID;
  1.1803 +    USHORT  ProductID;
  1.1804 +    USHORT  VersionNumber;
  1.1805 +
  1.1806 +    //
  1.1807 +    // Additional fields will be added to the end of this structure.
  1.1808 +    //
  1.1809 +} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
  1.1810 +
  1.1811 +
  1.1812 +BOOLEAN __stdcall
  1.1813 +HidD_GetAttributes (
  1.1814 +      HANDLE              HidDeviceObject,
  1.1815 +     PHIDD_ATTRIBUTES    Attributes
  1.1816 +    );
  1.1817 +/*++
  1.1818 +Routine Description:
  1.1819 +    Fill in the given HIDD_ATTRIBUTES structure with the attributes of the
  1.1820 +    given hid device.
  1.1821 +
  1.1822 +--*/
  1.1823 +
  1.1824 +
  1.1825 +void __stdcall
  1.1826 +HidD_GetHidGuid (
  1.1827 +     LPGUID   HidGuid
  1.1828 +   );
  1.1829 +
  1.1830 +
  1.1831 +BOOLEAN __stdcall
  1.1832 +HidD_GetPreparsedData (
  1.1833 +      HANDLE                  HidDeviceObject,
  1.1834 +    PHIDP_PREPARSED_DATA  * PreparsedData
  1.1835 +   );
  1.1836 +/*++
  1.1837 +Routine Description:
  1.1838 +    Given a handle to a valid Hid Class Device Object, retrieve the preparsed
  1.1839 +    data for the device.  This routine will allocate the appropriately 
  1.1840 +    sized buffer to hold this preparsed data.  It is up to client to call
  1.1841 +    HidP_FreePreparsedData to free the memory allocated to this structure when
  1.1842 +    it is no longer needed.
  1.1843 +
  1.1844 +Arguments:
  1.1845 +   HidDeviceObject A handle to a Hid Device that the client obtains using 
  1.1846 +                   a call to CreateFile on a valid Hid device string name.
  1.1847 +                   The string name can be obtained using standard PnP calls.
  1.1848 +
  1.1849 +   PreparsedData   An opaque data structure used by other functions in this 
  1.1850 +                   library to retrieve information about a given device.
  1.1851 +
  1.1852 +Return Value:
  1.1853 +   TRUE if successful.
  1.1854 +   FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1855 +--*/
  1.1856 +BOOLEAN __stdcall
  1.1857 +HidD_FreePreparsedData (
  1.1858 +    __drv_freesMem(Mem) PHIDP_PREPARSED_DATA PreparsedData
  1.1859 +   );
  1.1860 +
  1.1861 +BOOLEAN __stdcall
  1.1862 +HidD_FlushQueue (
  1.1863 +       HANDLE                HidDeviceObject
  1.1864 +   );
  1.1865 +/*++
  1.1866 +Routine Description:
  1.1867 +    Flush the input queue for the given HID device.
  1.1868 +
  1.1869 +Arguments:
  1.1870 +   HidDeviceObject A handle to a Hid Device that the client obtains using 
  1.1871 +                   a call to CreateFile on a valid Hid device string name.
  1.1872 +                   The string name can be obtained using standard PnP calls.
  1.1873 +
  1.1874 +Return Value:
  1.1875 +   TRUE if successful
  1.1876 +   FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1877 +--*/
  1.1878 +
  1.1879 +BOOLEAN __stdcall
  1.1880 +HidD_GetConfiguration (
  1.1881 +      HANDLE               HidDeviceObject,
  1.1882 +   PHIDD_CONFIGURATION Configuration,
  1.1883 +      ULONG                ConfigurationLength
  1.1884 +   );
  1.1885 +/*++
  1.1886 +Routine Description:
  1.1887 +    Get the configuration information for this Hid device
  1.1888 +
  1.1889 +Arguments:
  1.1890 +   HidDeviceObject      A handle to a Hid Device Object.
  1.1891 +
  1.1892 +   Configuration        A configuration structure.  HidD_GetConfiguration MUST
  1.1893 +                        be called before the configuration can be modified and
  1.1894 +                        set using HidD_SetConfiguration
  1.1895 +
  1.1896 +   ConfigurationLength  That is ``sizeof (HIDD_CONFIGURATION)''. Using this
  1.1897 +                        parameter, we can later increase the length of the 
  1.1898 +                        configuration array and not break older apps.
  1.1899 +
  1.1900 +Return Value:
  1.1901 +   TRUE if successful
  1.1902 +   FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1903 +--*/
  1.1904 +
  1.1905 +BOOLEAN __stdcall
  1.1906 +HidD_SetConfiguration (
  1.1907 +      HANDLE               HidDeviceObject,
  1.1908 +   reads_bytes_(ConfigurationLength) PHIDD_CONFIGURATION Configuration,
  1.1909 +      ULONG                ConfigurationLength
  1.1910 +   );
  1.1911 +/*++
  1.1912 +Routine Description:
  1.1913 +   Set the configuration information for this Hid device...
  1.1914 +   
  1.1915 +   NOTE: HidD_GetConfiguration must be called to retrieve the current 
  1.1916 +         configuration information before this information can be modified 
  1.1917 +         and set.
  1.1918 +
  1.1919 +Arguments:
  1.1920 +    HidDeviceObject      A handle to a Hid Device Object.
  1.1921 + 
  1.1922 +    Configuration        A configuration structure.  HidD_GetConfiguration MUST
  1.1923 +                         be called before the configuration can be modified and
  1.1924 +                         set using HidD_SetConfiguration
  1.1925 + 
  1.1926 +    ConfigurationLength  That is ``sizeof (HIDD_CONFIGURATION)''. Using this
  1.1927 +                         parameter, we can later increase the length of the 
  1.1928 +                         configuration array and not break older apps.
  1.1929 +
  1.1930 +Return Value:
  1.1931 +    TRUE if successful
  1.1932 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1933 +--*/
  1.1934 +
  1.1935 +BOOLEAN __stdcall
  1.1936 +HidD_GetFeature (
  1.1937 +       HANDLE   HidDeviceObject,
  1.1938 +   PVOID ReportBuffer,
  1.1939 +       ULONG    ReportBufferLength
  1.1940 +   );
  1.1941 +/*++
  1.1942 +Routine Description:
  1.1943 +    Retrieve a feature report from a HID device.
  1.1944 +
  1.1945 +Arguments:
  1.1946 +    HidDeviceObject      A handle to a Hid Device Object.
  1.1947 + 
  1.1948 +    ReportBuffer         The buffer that the feature report should be placed 
  1.1949 +                         into.  The first byte of the buffer should be set to
  1.1950 +                         the report ID of the desired report
  1.1951 + 
  1.1952 +    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
  1.1953 +                         should be greater than or equal to the 
  1.1954 +                         FeatureReportByteLength field as specified in the 
  1.1955 +                         HIDP_CAPS structure for the device
  1.1956 +Return Value:
  1.1957 +    TRUE if successful
  1.1958 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1959 +--*/
  1.1960 +
  1.1961 +BOOLEAN __stdcall
  1.1962 +HidD_SetFeature (
  1.1963 +       HANDLE   HidDeviceObject,
  1.1964 +   reads_bytes_(ReportBufferLength) PVOID ReportBuffer,
  1.1965 +       ULONG    ReportBufferLength
  1.1966 +   );
  1.1967 +/*++
  1.1968 +Routine Description:
  1.1969 +    Send a feature report to a HID device.
  1.1970 +
  1.1971 +Arguments:
  1.1972 +    HidDeviceObject      A handle to a Hid Device Object.
  1.1973 + 
  1.1974 +    ReportBuffer         The buffer of the feature report to send to the device
  1.1975 + 
  1.1976 +    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
  1.1977 +                         should be greater than or equal to the 
  1.1978 +                         FeatureReportByteLength field as specified in the 
  1.1979 +                         HIDP_CAPS structure for the device
  1.1980 +Return Value:
  1.1981 +    TRUE if successful
  1.1982 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.1983 +--*/
  1.1984 +
  1.1985 +
  1.1986 +
  1.1987 +BOOLEAN __stdcall
  1.1988 +HidD_GetInputReport (
  1.1989 +       HANDLE   HidDeviceObject,
  1.1990 +   PVOID ReportBuffer,
  1.1991 +       ULONG    ReportBufferLength
  1.1992 +   );
  1.1993 +/*++
  1.1994 +Routine Description:
  1.1995 +    Retrieve an input report from a HID device.
  1.1996 +
  1.1997 +Arguments:
  1.1998 +    HidDeviceObject      A handle to a Hid Device Object.
  1.1999 + 
  1.2000 +    ReportBuffer         The buffer that the input report should be placed 
  1.2001 +                         into.  The first byte of the buffer should be set to
  1.2002 +                         the report ID of the desired report
  1.2003 + 
  1.2004 +    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
  1.2005 +                         should be greater than or equal to the 
  1.2006 +                         InputReportByteLength field as specified in the 
  1.2007 +                         HIDP_CAPS structure for the device
  1.2008 +Return Value:
  1.2009 +    TRUE if successful
  1.2010 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2011 +--*/
  1.2012 +
  1.2013 +BOOLEAN __stdcall
  1.2014 +HidD_SetOutputReport (
  1.2015 +       HANDLE   HidDeviceObject,
  1.2016 +   reads_bytes_(ReportBufferLength) PVOID ReportBuffer,
  1.2017 +       ULONG    ReportBufferLength
  1.2018 +   );
  1.2019 +/*++
  1.2020 +Routine Description:
  1.2021 +    Send an output report to a HID device.
  1.2022 +
  1.2023 +Arguments:
  1.2024 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2025 + 
  1.2026 +    ReportBuffer         The buffer of the output report to send to the device
  1.2027 + 
  1.2028 +    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
  1.2029 +                         should be greater than or equal to the 
  1.2030 +                         OutputReportByteLength field as specified in the 
  1.2031 +                         HIDP_CAPS structure for the device
  1.2032 +Return Value:
  1.2033 +    TRUE if successful
  1.2034 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2035 +--*/
  1.2036 +
  1.2037 +#endif
  1.2038 +
  1.2039 +BOOLEAN __stdcall
  1.2040 +HidD_GetNumInputBuffers (
  1.2041 +      HANDLE  HidDeviceObject,
  1.2042 +     PULONG  NumberBuffers
  1.2043 +    );
  1.2044 +/*++
  1.2045 +Routine Description:
  1.2046 +    This function returns the number of input buffers used by the specified
  1.2047 +    file handle to the Hid device.  Each file object has a number of buffers
  1.2048 +    associated with it to queue reports read from the device but which have
  1.2049 +    not yet been read by the user-mode app with a handle to that device.
  1.2050 +
  1.2051 +Arguments:
  1.2052 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2053 + 
  1.2054 +    NumberBuffers        Number of buffers currently being used for this file
  1.2055 +                         handle to the Hid device
  1.2056 +
  1.2057 +Return Value:
  1.2058 +    TRUE if successful
  1.2059 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2060 +--*/
  1.2061 +
  1.2062 +BOOLEAN __stdcall
  1.2063 +HidD_SetNumInputBuffers (
  1.2064 +     HANDLE HidDeviceObject,
  1.2065 +     ULONG  NumberBuffers
  1.2066 +    );
  1.2067 +/*++
  1.2068 +
  1.2069 +Routine Description:
  1.2070 +    This function sets the number of input buffers used by the specified
  1.2071 +    file handle to the Hid device.  Each file object has a number of buffers
  1.2072 +    associated with it to queue reports read from the device but which have
  1.2073 +    not yet been read by the user-mode app with a handle to that device.
  1.2074 +
  1.2075 +Arguments:
  1.2076 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2077 + 
  1.2078 +    NumberBuffers        New number of buffers to use for this file handle to
  1.2079 +                         the Hid device
  1.2080 +
  1.2081 +Return Value:
  1.2082 +    TRUE if successful
  1.2083 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2084 +--*/
  1.2085 +
  1.2086 +BOOLEAN __stdcall
  1.2087 +HidD_GetPhysicalDescriptor (
  1.2088 +       HANDLE   HidDeviceObject,
  1.2089 +   PVOID Buffer,
  1.2090 +       ULONG    BufferLength
  1.2091 +   );
  1.2092 +/*++
  1.2093 +Routine Description:
  1.2094 +    This function retrieves the raw physical descriptor for the specified
  1.2095 +    Hid device.  
  1.2096 +
  1.2097 +Arguments:
  1.2098 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2099 + 
  1.2100 +    Buffer               Buffer which on return will contain the physical
  1.2101 +                         descriptor if one exists for the specified device
  1.2102 +                         handle
  1.2103 +
  1.2104 +    BufferLength         Length of buffer (in bytes)
  1.2105 +
  1.2106 +
  1.2107 +Return Value:
  1.2108 +    TRUE if successful
  1.2109 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2110 +--*/
  1.2111 +
  1.2112 +BOOLEAN __stdcall
  1.2113 +HidD_GetManufacturerString (
  1.2114 +       HANDLE   HidDeviceObject,
  1.2115 +   PVOID Buffer,
  1.2116 +       ULONG    BufferLength
  1.2117 +   );
  1.2118 +/*++
  1.2119 +Routine Description:
  1.2120 +    This function retrieves the manufacturer string from the specified 
  1.2121 +    Hid device.  
  1.2122 +
  1.2123 +Arguments:
  1.2124 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2125 + 
  1.2126 +    Buffer               Buffer which on return will contain the manufacturer
  1.2127 +                         string returned from the device.  This string is a 
  1.2128 +                         wide-character string
  1.2129 +
  1.2130 +    BufferLength         Length of Buffer (in bytes)
  1.2131 +
  1.2132 +
  1.2133 +Return Value:
  1.2134 +    TRUE if successful
  1.2135 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2136 +--*/
  1.2137 +
  1.2138 +BOOLEAN __stdcall
  1.2139 +HidD_GetProductString (
  1.2140 +       HANDLE   HidDeviceObject,
  1.2141 +   PVOID Buffer,
  1.2142 +       ULONG    BufferLength
  1.2143 +   );
  1.2144 +/*++
  1.2145 +Routine Description:
  1.2146 +    This function retrieves the product string from the specified 
  1.2147 +    Hid device.  
  1.2148 +
  1.2149 +Arguments:
  1.2150 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2151 + 
  1.2152 +    Buffer               Buffer which on return will contain the product
  1.2153 +                         string returned from the device.  This string is a 
  1.2154 +                         wide-character string
  1.2155 +
  1.2156 +    BufferLength         Length of Buffer (in bytes)
  1.2157 +
  1.2158 +
  1.2159 +Return Value:
  1.2160 +    TRUE if successful
  1.2161 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2162 +--*/
  1.2163 +
  1.2164 +BOOLEAN __stdcall
  1.2165 +HidD_GetIndexedString (
  1.2166 +       HANDLE   HidDeviceObject,
  1.2167 +       ULONG    StringIndex,
  1.2168 +   PVOID Buffer,
  1.2169 +       ULONG    BufferLength
  1.2170 +   );
  1.2171 +/*++
  1.2172 +Routine Description:
  1.2173 +    This function retrieves a string from the specified Hid device that is
  1.2174 +    specified with a certain string index.
  1.2175 +
  1.2176 +Arguments:
  1.2177 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2178 + 
  1.2179 +    StringIndex          Index of the string to retrieve
  1.2180 +
  1.2181 +    Buffer               Buffer which on return will contain the product
  1.2182 +                         string returned from the device.  This string is a 
  1.2183 +                         wide-character string
  1.2184 +
  1.2185 +    BufferLength         Length of Buffer (in bytes)
  1.2186 +
  1.2187 +Return Value:
  1.2188 +    TRUE if successful
  1.2189 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2190 +--*/
  1.2191 +
  1.2192 +BOOLEAN __stdcall
  1.2193 +HidD_GetSerialNumberString (
  1.2194 +       HANDLE   HidDeviceObject,
  1.2195 +   PVOID Buffer,
  1.2196 +       ULONG    BufferLength
  1.2197 +   );
  1.2198 +/*++
  1.2199 +Routine Description:
  1.2200 +    This function retrieves the serial number string from the specified 
  1.2201 +    Hid device.  
  1.2202 +
  1.2203 +Arguments:
  1.2204 +    HidDeviceObject      A handle to a Hid Device Object.
  1.2205 + 
  1.2206 +    Buffer               Buffer which on return will contain the serial number
  1.2207 +                         string returned from the device.  This string is a 
  1.2208 +                         wide-character string
  1.2209 +
  1.2210 +    BufferLength         Length of Buffer (in bytes)
  1.2211 +
  1.2212 +Return Value:
  1.2213 +    TRUE if successful
  1.2214 +    FALSE otherwise  -- Use GetLastError() to get extended error information
  1.2215 +--*/
  1.2216 +
  1.2217 +
  1.2218 +
  1.2219 +BOOLEAN __stdcall
  1.2220 +HidD_GetMsGenreDescriptor (
  1.2221 +       HANDLE   HidDeviceObject,
  1.2222 +   PVOID Buffer,
  1.2223 +       ULONG    BufferLength
  1.2224 +   );
  1.2225 +
  1.2226 +
  1.2227 +
  1.2228 +
  1.2229 +