pinvoke-input.txt
author StephaneLenclud
Sun, 15 Feb 2015 00:04:28 +0100
changeset 54 7647691aa209
permissions -rw-r--r--
Comments and white space clean up.
StephaneLenclud@50
     1
//
StephaneLenclud@50
     2
// SL: We use this file to generate P/Invoke using P/Invoke Interop Assistant.
StephaneLenclud@50
     3
//
StephaneLenclud@50
     4
StephaneLenclud@50
     5
StephaneLenclud@50
     6
typedef USHORT USAGE, *PUSAGE;
StephaneLenclud@50
     7
typedef LONG NTSTATUS;
StephaneLenclud@50
     8
StephaneLenclud@50
     9
#define HIDP_LINK_COLLECTION_ROOT ((USHORT) -1)
StephaneLenclud@50
    10
#define HIDP_LINK_COLLECTION_UNSPECIFIED ((USHORT) 0)
StephaneLenclud@50
    11
StephaneLenclud@50
    12
StephaneLenclud@50
    13
typedef enum _HIDP_REPORT_TYPE
StephaneLenclud@50
    14
{
StephaneLenclud@50
    15
    HidP_Input,
StephaneLenclud@50
    16
    HidP_Output,
StephaneLenclud@50
    17
    HidP_Feature
StephaneLenclud@50
    18
} HIDP_REPORT_TYPE;
StephaneLenclud@50
    19
StephaneLenclud@50
    20
typedef struct _USAGE_AND_PAGE
StephaneLenclud@50
    21
{
StephaneLenclud@50
    22
    USAGE Usage;
StephaneLenclud@50
    23
    USAGE UsagePage;
StephaneLenclud@50
    24
} USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
StephaneLenclud@50
    25
StephaneLenclud@50
    26
#define HidP_IsSameUsageAndPage(u1, u2) ((* (PULONG) &u1) == (* (PULONG) &u2))
StephaneLenclud@50
    27
StephaneLenclud@50
    28
typedef struct _HIDP_BUTTON_CAPS
StephaneLenclud@50
    29
{
StephaneLenclud@50
    30
    USAGE    UsagePage;
StephaneLenclud@50
    31
    UCHAR    ReportID;
StephaneLenclud@50
    32
    BOOLEAN  IsAlias;
StephaneLenclud@50
    33
StephaneLenclud@50
    34
    USHORT   BitField;
StephaneLenclud@50
    35
    USHORT   LinkCollection;   // A unique internal index pointer
StephaneLenclud@50
    36
StephaneLenclud@50
    37
    USAGE    LinkUsage;
StephaneLenclud@50
    38
    USAGE    LinkUsagePage;
StephaneLenclud@50
    39
StephaneLenclud@50
    40
    BOOLEAN  IsRange;
StephaneLenclud@50
    41
    BOOLEAN  IsStringRange;
StephaneLenclud@50
    42
    BOOLEAN  IsDesignatorRange;
StephaneLenclud@50
    43
    BOOLEAN  IsAbsolute;
StephaneLenclud@50
    44
StephaneLenclud@50
    45
    ULONG    Reserved[10];
StephaneLenclud@50
    46
    union {
StephaneLenclud@50
    47
        struct {
StephaneLenclud@50
    48
            USAGE    UsageMin,         UsageMax;
StephaneLenclud@50
    49
            USHORT   StringMin,        StringMax;
StephaneLenclud@50
    50
            USHORT   DesignatorMin,    DesignatorMax;
StephaneLenclud@50
    51
            USHORT   DataIndexMin,     DataIndexMax;
StephaneLenclud@50
    52
        } Range;
StephaneLenclud@50
    53
        struct  {
StephaneLenclud@50
    54
            USAGE    Usage,            Reserved1;
StephaneLenclud@50
    55
            USHORT   StringIndex,      Reserved2;
StephaneLenclud@50
    56
            USHORT   DesignatorIndex,  Reserved3;
StephaneLenclud@50
    57
            USHORT   DataIndex,        Reserved4;
StephaneLenclud@50
    58
        } NotRange;
StephaneLenclud@50
    59
    };
StephaneLenclud@50
    60
StephaneLenclud@50
    61
} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
StephaneLenclud@50
    62
StephaneLenclud@50
    63
StephaneLenclud@50
    64
typedef struct _HIDP_VALUE_CAPS
StephaneLenclud@50
    65
{
StephaneLenclud@50
    66
    USAGE    UsagePage;
StephaneLenclud@50
    67
    UCHAR    ReportID;
StephaneLenclud@50
    68
    BOOLEAN  IsAlias;
StephaneLenclud@50
    69
StephaneLenclud@50
    70
    USHORT   BitField;
StephaneLenclud@50
    71
    USHORT   LinkCollection;   // A unique internal index pointer
StephaneLenclud@50
    72
StephaneLenclud@50
    73
    USAGE    LinkUsage;
StephaneLenclud@50
    74
    USAGE    LinkUsagePage;
StephaneLenclud@50
    75
StephaneLenclud@50
    76
    BOOLEAN  IsRange;
StephaneLenclud@50
    77
    BOOLEAN  IsStringRange;
StephaneLenclud@50
    78
    BOOLEAN  IsDesignatorRange;
StephaneLenclud@50
    79
    BOOLEAN  IsAbsolute;
StephaneLenclud@50
    80
StephaneLenclud@50
    81
    BOOLEAN  HasNull;        // Does this channel have a null report   union
StephaneLenclud@50
    82
    UCHAR    Reserved;
StephaneLenclud@50
    83
    USHORT   BitSize;        // How many bits are devoted to this value?
StephaneLenclud@50
    84
StephaneLenclud@50
    85
    USHORT   ReportCount;    // See Note below.  Usually set to 1.
StephaneLenclud@50
    86
    USHORT   Reserved2[5];
StephaneLenclud@50
    87
StephaneLenclud@50
    88
    ULONG    UnitsExp;
StephaneLenclud@50
    89
    ULONG    Units;
StephaneLenclud@50
    90
StephaneLenclud@50
    91
    LONG     LogicalMin,       LogicalMax;
StephaneLenclud@50
    92
    LONG     PhysicalMin,      PhysicalMax;
StephaneLenclud@50
    93
StephaneLenclud@50
    94
    union {
StephaneLenclud@50
    95
        struct {
StephaneLenclud@50
    96
            USAGE    UsageMin,         UsageMax;
StephaneLenclud@50
    97
            USHORT   StringMin,        StringMax;
StephaneLenclud@50
    98
            USHORT   DesignatorMin,    DesignatorMax;
StephaneLenclud@50
    99
            USHORT   DataIndexMin,     DataIndexMax;
StephaneLenclud@50
   100
        } Range;
StephaneLenclud@50
   101
StephaneLenclud@50
   102
        struct {
StephaneLenclud@50
   103
            USAGE    Usage,            Reserved1;
StephaneLenclud@50
   104
            USHORT   StringIndex,      Reserved2;
StephaneLenclud@50
   105
            USHORT   DesignatorIndex,  Reserved3;
StephaneLenclud@50
   106
            USHORT   DataIndex,        Reserved4;
StephaneLenclud@50
   107
        } NotRange;
StephaneLenclud@50
   108
    };
StephaneLenclud@50
   109
} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
StephaneLenclud@50
   110
StephaneLenclud@50
   111
//
StephaneLenclud@50
   112
// Notes:
StephaneLenclud@50
   113
//
StephaneLenclud@50
   114
// ReportCount:  When a report descriptor declares an Input, Output, or
StephaneLenclud@50
   115
// Feature main item with fewer usage declarations than the report count, then
StephaneLenclud@50
   116
// the last usage applies to all remaining unspecified count in that main item.
StephaneLenclud@50
   117
// (As an example you might have data that required many fields to describe,
StephaneLenclud@50
   118
// possibly buffered bytes.)  In this case, only one value cap structure is
StephaneLenclud@50
   119
// allocated for these associtated fields, all with the same usage, and Report
StephaneLenclud@50
   120
// Count reflects the number of fields involved.  Normally ReportCount is 1.
StephaneLenclud@50
   121
// To access all of the fields in such a value structure would require using
StephaneLenclud@50
   122
// HidP_GetUsageValueArray and HidP_SetUsageValueArray.   HidP_GetUsageValue/
StephaneLenclud@50
   123
// HidP_SetScaledUsageValue will also work, however, these functions will only
StephaneLenclud@50
   124
// work with the first field of the structure.
StephaneLenclud@50
   125
//
StephaneLenclud@50
   126
StephaneLenclud@50
   127
//
StephaneLenclud@50
   128
// The link collection tree consists of an array of LINK_COLLECTION_NODES
StephaneLenclud@50
   129
// where the index into this array is the same as the collection number.
StephaneLenclud@50
   130
//
StephaneLenclud@50
   131
// Given a collection A which contains a subcollection B, A is defined to be
StephaneLenclud@50
   132
// the parent B, and B is defined to be the child.
StephaneLenclud@50
   133
//
StephaneLenclud@50
   134
// Given collections A, B, and C where B and C are children of A, and B was
StephaneLenclud@50
   135
// encountered before C in the report descriptor, B is defined as a sibling of
StephaneLenclud@50
   136
// C.  (This implies, of course, that if B is a sibling of C, then C is NOT a
StephaneLenclud@50
   137
// sibling of B).
StephaneLenclud@50
   138
//
StephaneLenclud@50
   139
// B is defined as the NextSibling of C if and only if there exists NO
StephaneLenclud@50
   140
// child collection of A, call it D, such that B is a sibling of D and D
StephaneLenclud@50
   141
// is a sibling of C.
StephaneLenclud@50
   142
//
StephaneLenclud@50
   143
// E is defined to be the FirstChild of A if and only if for all children of A,
StephaneLenclud@50
   144
// F, that are not equivalent to E, F is a sibling of E.
StephaneLenclud@50
   145
// (This implies, of course, that the does not exist a child of A, call it G,
StephaneLenclud@50
   146
// where E is a sibling of G).  In other words the first sibling is the last
StephaneLenclud@50
   147
// link collection found in the list.
StephaneLenclud@50
   148
//
StephaneLenclud@50
   149
// In other words, if a collection B is defined within the definition of another
StephaneLenclud@50
   150
// collection A, B becomes a child of A.  All collections with the same parent
StephaneLenclud@50
   151
// are considered siblings.  The FirstChild of the parent collection, A, will be
StephaneLenclud@50
   152
// last collection defined that has A as a parent.  The order of sibling pointers
StephaneLenclud@50
   153
// is similarly determined.  When a collection B is defined, it becomes the
StephaneLenclud@50
   154
// FirstChild of it's parent collection.  The previously defined FirstChild of the
StephaneLenclud@50
   155
// parent collection becomes the NextSibling of the new collection.  As new
StephaneLenclud@50
   156
// collections with the same parent are discovered, the chain of sibling is built.
StephaneLenclud@50
   157
//
StephaneLenclud@50
   158
// With that in mind, the following describes conclusively a data structure
StephaneLenclud@50
   159
// that provides direct traversal up, down, and accross the link collection
StephaneLenclud@50
   160
// tree.
StephaneLenclud@50
   161
//
StephaneLenclud@50
   162
//
StephaneLenclud@50
   163
typedef struct _HIDP_LINK_COLLECTION_NODE
StephaneLenclud@50
   164
{
StephaneLenclud@50
   165
    USAGE    LinkUsage;
StephaneLenclud@50
   166
    USAGE    LinkUsagePage;
StephaneLenclud@50
   167
    USHORT   Parent;
StephaneLenclud@50
   168
    USHORT   NumberOfChildren;
StephaneLenclud@50
   169
    USHORT   NextSibling;
StephaneLenclud@50
   170
    USHORT   FirstChild;
StephaneLenclud@50
   171
    ULONG    CollectionType: 8;  // As defined in 6.2.2.6 of HID spec
StephaneLenclud@50
   172
    ULONG    IsAlias : 1; // This link node is an allias of the next link node.
StephaneLenclud@50
   173
    ULONG    Reserved: 23;
StephaneLenclud@50
   174
    PVOID    UserContext; // The user can hang his coat here.
StephaneLenclud@50
   175
} HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
StephaneLenclud@50
   176
StephaneLenclud@50
   177
//
StephaneLenclud@50
   178
// When a link collection is described by a delimiter, alias link collection
StephaneLenclud@50
   179
// nodes are created.  (One for each usage within the delimiter).
StephaneLenclud@50
   180
// The parser assigns each capability description listed above only one
StephaneLenclud@50
   181
// link collection.
StephaneLenclud@50
   182
//
StephaneLenclud@50
   183
// If a control is defined within a collection defined by
StephaneLenclud@50
   184
// delimited usages, then that control is said to be within multiple link
StephaneLenclud@50
   185
// collections, one for each usage within the open and close delimiter tokens.
StephaneLenclud@50
   186
// Such multiple link collecions are said to be aliases.  The first N-1 such
StephaneLenclud@50
   187
// collections, listed in the link collection node array, have their IsAlias
StephaneLenclud@50
   188
// bit set.  The last such link collection is the link collection index used
StephaneLenclud@50
   189
// in the capabilities described above.
StephaneLenclud@50
   190
// Clients wishing to set a control in an aliased collection, should walk the
StephaneLenclud@50
   191
// collection array once for each time they see the IsAlias flag set, and use
StephaneLenclud@50
   192
// the last link collection as the index for the below accessor functions.
StephaneLenclud@50
   193
//
StephaneLenclud@50
   194
// NB: if IsAlias is set, then NextSibling should be one more than the current
StephaneLenclud@50
   195
// link collection node index.
StephaneLenclud@50
   196
//
StephaneLenclud@50
   197
StephaneLenclud@50
   198
typedef PUCHAR  PHIDP_REPORT_DESCRIPTOR;
StephaneLenclud@50
   199
typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
StephaneLenclud@50
   200
StephaneLenclud@50
   201
typedef struct _HIDP_CAPS
StephaneLenclud@50
   202
{
StephaneLenclud@50
   203
    USAGE    Usage;
StephaneLenclud@50
   204
    USAGE    UsagePage;
StephaneLenclud@50
   205
    USHORT   InputReportByteLength;
StephaneLenclud@50
   206
    USHORT   OutputReportByteLength;
StephaneLenclud@50
   207
    USHORT   FeatureReportByteLength;
StephaneLenclud@50
   208
    USHORT   Reserved[17];
StephaneLenclud@50
   209
StephaneLenclud@50
   210
    USHORT   NumberLinkCollectionNodes;
StephaneLenclud@50
   211
StephaneLenclud@50
   212
    USHORT   NumberInputButtonCaps;
StephaneLenclud@50
   213
    USHORT   NumberInputValueCaps;
StephaneLenclud@50
   214
    USHORT   NumberInputDataIndices;
StephaneLenclud@50
   215
StephaneLenclud@50
   216
    USHORT   NumberOutputButtonCaps;
StephaneLenclud@50
   217
    USHORT   NumberOutputValueCaps;
StephaneLenclud@50
   218
    USHORT   NumberOutputDataIndices;
StephaneLenclud@50
   219
StephaneLenclud@50
   220
    USHORT   NumberFeatureButtonCaps;
StephaneLenclud@50
   221
    USHORT   NumberFeatureValueCaps;
StephaneLenclud@50
   222
    USHORT   NumberFeatureDataIndices;
StephaneLenclud@50
   223
} HIDP_CAPS, *PHIDP_CAPS;
StephaneLenclud@50
   224
StephaneLenclud@50
   225
typedef struct _HIDP_DATA
StephaneLenclud@50
   226
{
StephaneLenclud@50
   227
    USHORT  DataIndex;
StephaneLenclud@50
   228
    USHORT  Reserved;
StephaneLenclud@50
   229
    union {
StephaneLenclud@50
   230
        ULONG   RawValue; // for values
StephaneLenclud@50
   231
        BOOLEAN On; // for buttons MUST BE TRUE for buttons.
StephaneLenclud@50
   232
    };
StephaneLenclud@50
   233
} HIDP_DATA, *PHIDP_DATA;
StephaneLenclud@50
   234
//
StephaneLenclud@50
   235
// The HIDP_DATA structure is used with HidP_GetData and HidP_SetData
StephaneLenclud@50
   236
// functions.
StephaneLenclud@50
   237
//
StephaneLenclud@50
   238
// The parser contiguously assigns every control (button or value) in a hid
StephaneLenclud@50
   239
// device a unique data index from zero to NumberXXXDataIndices -1 , inclusive.
StephaneLenclud@50
   240
// This value is found in the HIDP_BUTTON_CAPS and HIDP_VALUE_CAPS structures.
StephaneLenclud@50
   241
//
StephaneLenclud@50
   242
// Most clients will find the Get/Set Buttons / Value accessor functions
StephaneLenclud@50
   243
// sufficient to their needs, as they will allow the clients to access the
StephaneLenclud@50
   244
// data known to them while ignoring the other controls.
StephaneLenclud@50
   245
//
StephaneLenclud@50
   246
// More complex clients, which actually read the Button / Value Caps, and which
StephaneLenclud@50
   247
// do a value add service to these routines (EG Direct Input), will need to
StephaneLenclud@50
   248
// access all the data in the device without interest in the individual usage
StephaneLenclud@50
   249
// or link collection location.  These are the clients that will find
StephaneLenclud@50
   250
// HidP_Data useful.
StephaneLenclud@50
   251
//
StephaneLenclud@50
   252
StephaneLenclud@50
   253
typedef struct _HIDP_UNKNOWN_TOKEN
StephaneLenclud@50
   254
{
StephaneLenclud@50
   255
    UCHAR  Token;
StephaneLenclud@50
   256
    UCHAR  Reserved[3];
StephaneLenclud@50
   257
    ULONG  BitField;
StephaneLenclud@50
   258
} HIDP_UNKNOWN_TOKEN, *PHIDP_UNKNOWN_TOKEN;
StephaneLenclud@50
   259
StephaneLenclud@50
   260
typedef struct _HIDP_EXTENDED_ATTRIBUTES
StephaneLenclud@50
   261
{
StephaneLenclud@50
   262
    UCHAR   NumGlobalUnknowns;
StephaneLenclud@50
   263
    UCHAR   Reserved [3];
StephaneLenclud@50
   264
    PHIDP_UNKNOWN_TOKEN  GlobalUnknowns;
StephaneLenclud@50
   265
    // ... Additional attributes
StephaneLenclud@50
   266
    ULONG   Data [1]; // variableLength  DO NOT ACCESS THIS FIELD
StephaneLenclud@50
   267
} HIDP_EXTENDED_ATTRIBUTES, *PHIDP_EXTENDED_ATTRIBUTES;
StephaneLenclud@50
   268
StephaneLenclud@50
   269
NTSTATUS __stdcall
StephaneLenclud@50
   270
HidP_GetCaps (
StephaneLenclud@50
   271
         PHIDP_PREPARSED_DATA      PreparsedData,
StephaneLenclud@50
   272
        PHIDP_CAPS                Capabilities
StephaneLenclud@50
   273
   );
StephaneLenclud@50
   274
/*++
StephaneLenclud@50
   275
Routine Description:
StephaneLenclud@50
   276
   Returns a list of capabilities of a given hid device as described by its
StephaneLenclud@50
   277
   preparsed data.
StephaneLenclud@50
   278
StephaneLenclud@50
   279
Arguments:
StephaneLenclud@50
   280
   PreparsedData    The preparsed data returned from HIDCLASS.
StephaneLenclud@50
   281
   Capabilities     a HIDP_CAPS structure
StephaneLenclud@50
   282
StephaneLenclud@50
   283
Return Value:
StephaneLenclud@50
   284
   HIDP_STATUS_SUCCESS
StephaneLenclud@50
   285
   HIDP_STATUS_INVALID_PREPARSED_DATA
StephaneLenclud@50
   286
--*/
StephaneLenclud@50
   287
StephaneLenclud@50
   288
NTSTATUS __stdcall
StephaneLenclud@50
   289
HidP_GetLinkCollectionNodes (
StephaneLenclud@50
   290
        PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
StephaneLenclud@50
   291
      PULONG                     LinkCollectionNodesLength,
StephaneLenclud@50
   292
         PHIDP_PREPARSED_DATA       PreparsedData
StephaneLenclud@50
   293
   );
StephaneLenclud@50
   294
/*++
StephaneLenclud@50
   295
Routine Description:
StephaneLenclud@50
   296
   Return a list of PHIDP_LINK_COLLECTION_NODEs used to describe the link
StephaneLenclud@50
   297
   collection tree of this hid device.  See the above description of
StephaneLenclud@50
   298
   struct _HIDP_LINK_COLLECTION_NODE.
StephaneLenclud@50
   299
StephaneLenclud@50
   300
Arguments:
StephaneLenclud@50
   301
   LinkCollectionNodes - a caller allocated array into which
StephaneLenclud@50
   302
                 HidP_GetLinkCollectionNodes will store the information
StephaneLenclud@50
   303
StephaneLenclud@50
   304
   LinKCollectionNodesLength - the caller sets this value to the length of the
StephaneLenclud@50
   305
                 the array in terms of number of elements.
StephaneLenclud@50
   306
                 HidP_GetLinkCollectionNodes sets this value to the actual
StephaneLenclud@50
   307
                 number of elements set. The total number of nodes required to
StephaneLenclud@50
   308
                 describe this HID device can be found in the
StephaneLenclud@50
   309
                 NumberLinkCollectionNodes field in the HIDP_CAPS structure.
StephaneLenclud@50
   310
StephaneLenclud@50
   311
--*/
StephaneLenclud@50
   312
StephaneLenclud@50
   313
NTSTATUS __stdcall
StephaneLenclud@50
   314
HidP_GetSpecificButtonCaps (
StephaneLenclud@50
   315
          HIDP_REPORT_TYPE     ReportType,
StephaneLenclud@50
   316
          USAGE                UsagePage,      // Optional (0 => ignore)
StephaneLenclud@50
   317
          USHORT               LinkCollection, // Optional (0 => ignore)
StephaneLenclud@50
   318
          USAGE                Usage,          // Optional (0 => ignore)
StephaneLenclud@50
   319
   PHIDP_BUTTON_CAPS    ButtonCaps,
StephaneLenclud@50
   320
     PUSHORT              ButtonCapsLength,
StephaneLenclud@50
   321
          PHIDP_PREPARSED_DATA PreparsedData
StephaneLenclud@50
   322
   );
StephaneLenclud@50
   323
/*++
StephaneLenclud@50
   324
Description:
StephaneLenclud@50
   325
   HidP_GetButtonCaps returns all the buttons (binary values) that are a part
StephaneLenclud@50
   326
   of the given report type for the Hid device represented by the given
StephaneLenclud@50
   327
   preparsed data.
StephaneLenclud@50
   328
StephaneLenclud@50
   329
Parameters:
StephaneLenclud@50
   330
   ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   331
StephaneLenclud@50
   332
   UsagePage   A usage page value used to limit the button caps returned to
StephaneLenclud@50
   333
                those on a given usage page.  If set to 0, this parameter is
StephaneLenclud@50
   334
                ignored.  Can be used with LinkCollection and Usage parameters
StephaneLenclud@50
   335
                to further limit the number of button caps structures returned.
StephaneLenclud@50
   336
StephaneLenclud@50
   337
   LinkCollection HIDP_LINK_COLLECTION node array index used to limit the
StephaneLenclud@50
   338
                  button caps returned to those buttons in a given link
StephaneLenclud@50
   339
                  collection.  If set to 0, this parameter is
StephaneLenclud@50
   340
                  ignored.  Can be used with UsagePage and Usage parameters
StephaneLenclud@50
   341
                  to further limit the number of button caps structures
StephaneLenclud@50
   342
                  returned.
StephaneLenclud@50
   343
StephaneLenclud@50
   344
   Usage      A usage value used to limit the button caps returned to those
StephaneLenclud@50
   345
               with the specified usage value.  If set to 0, this parameter
StephaneLenclud@50
   346
               is ignored.  Can be used with LinkCollection and UsagePage
StephaneLenclud@50
   347
               parameters to further limit the number of button caps
StephaneLenclud@50
   348
               structures returned.
StephaneLenclud@50
   349
StephaneLenclud@50
   350
   ButtonCaps A _HIDP_BUTTON_CAPS array containing information about all the
StephaneLenclud@50
   351
               binary values in the given report.  This buffer is provided by
StephaneLenclud@50
   352
               the caller.
StephaneLenclud@50
   353
StephaneLenclud@50
   354
   ButtonLength   As input, this parameter specifies the length of the
StephaneLenclud@50
   355
                  ButtonCaps parameter (array) in number of array elements.
StephaneLenclud@50
   356
                  As output, this value is set to indicate how many of those
StephaneLenclud@50
   357
                  array elements were filled in by the function.  The maximum number of
StephaneLenclud@50
   358
                  button caps that can be returned is found in the HIDP_CAPS
StephaneLenclud@50
   359
                  structure.  If HIDP_STATUS_BUFFER_TOO_SMALL is returned,
StephaneLenclud@50
   360
                  this value contains the number of array elements needed to
StephaneLenclud@50
   361
                  successfully complete the request.
StephaneLenclud@50
   362
StephaneLenclud@50
   363
   PreparsedData  The preparsed data returned from HIDCLASS.
StephaneLenclud@50
   364
StephaneLenclud@50
   365
StephaneLenclud@50
   366
Return Value
StephaneLenclud@50
   367
HidP_GetSpecificButtonCaps returns the following error codes:
StephaneLenclud@50
   368
  HIDP_STATUS_SUCCESS.
StephaneLenclud@50
   369
  HIDP_STATUS_INVALID_REPORT_TYPE
StephaneLenclud@50
   370
  HIDP_STATUS_INVALID_PREPARSED_DATA
StephaneLenclud@50
   371
  HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in)
StephaneLenclud@50
   372
  HIDP_STATUS_USAGE_NOT_FOUND
StephaneLenclud@50
   373
--*/
StephaneLenclud@50
   374
NTSTATUS __stdcall
StephaneLenclud@50
   375
HidP_GetButtonCaps (
StephaneLenclud@50
   376
          HIDP_REPORT_TYPE     ReportType,
StephaneLenclud@50
   377
   PHIDP_BUTTON_CAPS ButtonCaps,
StephaneLenclud@50
   378
       PUSHORT              ButtonCapsLength,
StephaneLenclud@50
   379
          PHIDP_PREPARSED_DATA PreparsedData
StephaneLenclud@50
   380
);
StephaneLenclud@50
   381
StephaneLenclud@50
   382
NTSTATUS __stdcall
StephaneLenclud@50
   383
HidP_GetSpecificValueCaps (
StephaneLenclud@50
   384
          HIDP_REPORT_TYPE     ReportType,
StephaneLenclud@50
   385
          USAGE                UsagePage,      // Optional (0 => ignore)
StephaneLenclud@50
   386
          USHORT               LinkCollection, // Optional (0 => ignore)
StephaneLenclud@50
   387
          USAGE                Usage,          // Optional (0 => ignore)
StephaneLenclud@50
   388
          PHIDP_VALUE_CAPS     ValueCaps,
StephaneLenclud@50
   389
       PUSHORT              ValueCapsLength,
StephaneLenclud@50
   390
          PHIDP_PREPARSED_DATA PreparsedData
StephaneLenclud@50
   391
   );
StephaneLenclud@50
   392
/*++
StephaneLenclud@50
   393
Description:
StephaneLenclud@50
   394
   HidP_GetValueCaps returns all the values (non-binary) that are a part
StephaneLenclud@50
   395
   of the given report type for the Hid device represented by the given
StephaneLenclud@50
   396
   preparsed data.
StephaneLenclud@50
   397
StephaneLenclud@50
   398
Parameters:
StephaneLenclud@50
   399
   ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   400
StephaneLenclud@50
   401
   UsagePage   A usage page value used to limit the value caps returned to
StephaneLenclud@50
   402
                those on a given usage page.  If set to 0, this parameter is
StephaneLenclud@50
   403
                ignored.  Can be used with LinkCollection and Usage parameters
StephaneLenclud@50
   404
                to further limit the number of value caps structures returned.
StephaneLenclud@50
   405
StephaneLenclud@50
   406
   LinkCollection HIDP_LINK_COLLECTION node array index used to limit the
StephaneLenclud@50
   407
                  value caps returned to those buttons in a given link
StephaneLenclud@50
   408
                  collection.  If set to 0, this parameter is
StephaneLenclud@50
   409
                  ignored.  Can be used with UsagePage and Usage parameters
StephaneLenclud@50
   410
                  to further limit the number of value caps structures
StephaneLenclud@50
   411
                  returned.
StephaneLenclud@50
   412
StephaneLenclud@50
   413
   Usage      A usage value used to limit the value caps returned to those
StephaneLenclud@50
   414
               with the specified usage value.  If set to 0, this parameter
StephaneLenclud@50
   415
               is ignored.  Can be used with LinkCollection and UsagePage
StephaneLenclud@50
   416
               parameters to further limit the number of value caps
StephaneLenclud@50
   417
               structures returned.
StephaneLenclud@50
   418
StephaneLenclud@50
   419
   ValueCaps  A _HIDP_VALUE_CAPS array containing information about all the
StephaneLenclud@50
   420
               non-binary values in the given report.  This buffer is provided
StephaneLenclud@50
   421
               by the caller.
StephaneLenclud@50
   422
StephaneLenclud@50
   423
   ValueLength   As input, this parameter specifies the length of the ValueCaps
StephaneLenclud@50
   424
                  parameter (array) in number of array elements.  As output,
StephaneLenclud@50
   425
                  this value is set to indicate how many of those array elements
StephaneLenclud@50
   426
                  were filled in by the function.  The maximum number of
StephaneLenclud@50
   427
                  value caps that can be returned is found in the HIDP_CAPS
StephaneLenclud@50
   428
                  structure.  If HIDP_STATUS_BUFFER_TOO_SMALL is returned,
StephaneLenclud@50
   429
                  this value contains the number of array elements needed to
StephaneLenclud@50
   430
                  successfully complete the request.
StephaneLenclud@50
   431
StephaneLenclud@50
   432
   PreparsedData  The preparsed data returned from HIDCLASS.
StephaneLenclud@50
   433
StephaneLenclud@50
   434
StephaneLenclud@50
   435
Return Value
StephaneLenclud@50
   436
HidP_GetValueCaps returns the following error codes:
StephaneLenclud@50
   437
  HIDP_STATUS_SUCCESS.
StephaneLenclud@50
   438
  HIDP_STATUS_INVALID_REPORT_TYPE
StephaneLenclud@50
   439
  HIDP_STATUS_INVALID_PREPARSED_DATA
StephaneLenclud@50
   440
  HIDP_STATUS_BUFFER_TOO_SMALL (all given entries however have been filled in)
StephaneLenclud@50
   441
  HIDP_STATUS_USAGE_NOT_FOUND
StephaneLenclud@50
   442
StephaneLenclud@50
   443
--*/
StephaneLenclud@50
   444
StephaneLenclud@50
   445
NTSTATUS __stdcall
StephaneLenclud@50
   446
HidP_GetValueCaps (
StephaneLenclud@50
   447
          HIDP_REPORT_TYPE     ReportType,
StephaneLenclud@50
   448
   PHIDP_VALUE_CAPS ValueCaps,
StephaneLenclud@50
   449
       PUSHORT              ValueCapsLength,
StephaneLenclud@50
   450
          PHIDP_PREPARSED_DATA PreparsedData
StephaneLenclud@50
   451
);
StephaneLenclud@50
   452
StephaneLenclud@50
   453
NTSTATUS __stdcall
StephaneLenclud@50
   454
HidP_GetExtendedAttributes (
StephaneLenclud@50
   455
          HIDP_REPORT_TYPE            ReportType,
StephaneLenclud@50
   456
          USHORT                      DataIndex,
StephaneLenclud@50
   457
          PHIDP_PREPARSED_DATA        PreparsedData,
StephaneLenclud@50
   458
    PHIDP_EXTENDED_ATTRIBUTES Attributes,
StephaneLenclud@50
   459
       PULONG                      LengthAttributes
StephaneLenclud@50
   460
    );
StephaneLenclud@50
   461
/*++
StephaneLenclud@50
   462
Description:
StephaneLenclud@50
   463
    Given a data index from the value or button capabilities of a given control
StephaneLenclud@50
   464
    return any extended attributes for the control if any exist.
StephaneLenclud@50
   465
StephaneLenclud@50
   466
Parameters:
StephaneLenclud@50
   467
    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   468
StephaneLenclud@50
   469
    DataIndex   The data index for the given control, found in the capabilities
StephaneLenclud@50
   470
                structure for that control
StephaneLenclud@50
   471
StephaneLenclud@50
   472
    PreparsedData   The preparsed data returned from HIDCLASS.
StephaneLenclud@50
   473
StephaneLenclud@50
   474
    Attributes  Pointer to a buffer into which the extended attribute data will
StephaneLenclud@50
   475
                be copied.
StephaneLenclud@50
   476
StephaneLenclud@50
   477
    LengthAttributes    Length of the given buffer in bytes.
StephaneLenclud@50
   478
StephaneLenclud@50
   479
Return Value
StephaneLenclud@50
   480
    HIDP_STATUS_SUCCESS
StephaneLenclud@50
   481
    HIDP_STATUS_DATA_INDEX_NOT_FOUND
StephaneLenclud@50
   482
--*/
StephaneLenclud@50
   483
StephaneLenclud@50
   484
NTSTATUS __stdcall
StephaneLenclud@50
   485
HidP_InitializeReportForID (
StephaneLenclud@50
   486
    HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
   487
    UCHAR ReportID,
StephaneLenclud@50
   488
    PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
   489
   PCHAR Report,
StephaneLenclud@50
   490
    ULONG ReportLength
StephaneLenclud@50
   491
   );
StephaneLenclud@50
   492
/*++
StephaneLenclud@50
   493
StephaneLenclud@50
   494
Routine Description:
StephaneLenclud@50
   495
StephaneLenclud@50
   496
    Initialize a report based on the given report ID.
StephaneLenclud@50
   497
StephaneLenclud@50
   498
Parameters:
StephaneLenclud@50
   499
StephaneLenclud@50
   500
    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   501
StephaneLenclud@50
   502
    PreparasedData  Preparsed data structure returned by HIDCLASS
StephaneLenclud@50
   503
StephaneLenclud@50
   504
    Report      Buffer which to set the data into.
StephaneLenclud@50
   505
StephaneLenclud@50
   506
    ReportLength Length of Report...Report should be at least as long as the
StephaneLenclud@50
   507
                value indicated in the HIDP_CAPS structure for the device and
StephaneLenclud@50
   508
                the corresponding ReportType
StephaneLenclud@50
   509
StephaneLenclud@50
   510
Return Value
StephaneLenclud@50
   511
StephaneLenclud@50
   512
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   513
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   514
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
StephaneLenclud@50
   515
                                        to the length specified in HIDP_CAPS
StephaneLenclud@50
   516
                                        structure for the given ReportType
StephaneLenclud@50
   517
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   518
                                        for the given ReportType
StephaneLenclud@50
   519
StephaneLenclud@50
   520
--*/
StephaneLenclud@50
   521
StephaneLenclud@50
   522
NTSTATUS __stdcall
StephaneLenclud@50
   523
HidP_SetData (
StephaneLenclud@50
   524
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
   525
    PHIDP_DATA DataList,
StephaneLenclud@50
   526
     PULONG DataLength,
StephaneLenclud@50
   527
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
   528
    PCHAR Report,
StephaneLenclud@50
   529
     ULONG ReportLength
StephaneLenclud@50
   530
    );
StephaneLenclud@50
   531
/*++
StephaneLenclud@50
   532
StephaneLenclud@50
   533
Routine Description:
StephaneLenclud@50
   534
StephaneLenclud@50
   535
    Please Note: Since usage value arrays deal with multiple fields for
StephaneLenclud@50
   536
                 for one usage value, they cannot be used with HidP_SetData
StephaneLenclud@50
   537
                 and HidP_GetData.  In this case,
StephaneLenclud@50
   538
                 HIDP_STATUS_IS_USAGE_VALUE_ARRAY will be returned.
StephaneLenclud@50
   539
StephaneLenclud@50
   540
Parameters:
StephaneLenclud@50
   541
StephaneLenclud@50
   542
    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   543
StephaneLenclud@50
   544
    DataList    Array of HIDP_DATA structures that contains the data values
StephaneLenclud@50
   545
                that are to be set into the given report
StephaneLenclud@50
   546
StephaneLenclud@50
   547
    DataLength  As input, length in array elements of DataList.  As output,
StephaneLenclud@50
   548
                contains the number of data elements set on successful
StephaneLenclud@50
   549
                completion or an index into the DataList array to identify
StephaneLenclud@50
   550
                the faulting HIDP_DATA value if an error code is returned.
StephaneLenclud@50
   551
StephaneLenclud@50
   552
    PreparasedData  Preparsed data structure returned by HIDCLASS
StephaneLenclud@50
   553
StephaneLenclud@50
   554
    Report      Buffer which to set the data into.
StephaneLenclud@50
   555
StephaneLenclud@50
   556
    ReportLength Length of Report...Report should be at least as long as the
StephaneLenclud@50
   557
                value indicated in the HIDP_CAPS structure for the device and
StephaneLenclud@50
   558
                the corresponding ReportType
StephaneLenclud@50
   559
StephaneLenclud@50
   560
Return Value
StephaneLenclud@50
   561
    HidP_SetData returns the following error codes.  The report packet will
StephaneLenclud@50
   562
        have all the data set up until the HIDP_DATA structure that caused the
StephaneLenclud@50
   563
        error.  DataLength, in the error case, will return this problem index.
StephaneLenclud@50
   564
StephaneLenclud@50
   565
  HIDP_STATUS_SUCCESS                -- upon successful insertion of all data
StephaneLenclud@50
   566
                                        into the report packet.
StephaneLenclud@50
   567
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   568
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   569
  HIDP_STATUS_DATA_INDEX_NOT_FOUND   -- if a HIDP_DATA structure referenced a
StephaneLenclud@50
   570
                                        data index that does not exist for this
StephaneLenclud@50
   571
                                        device's ReportType
StephaneLenclud@50
   572
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
StephaneLenclud@50
   573
                                        to the length specified in HIDP_CAPS
StephaneLenclud@50
   574
                                        structure for the given ReportType
StephaneLenclud@50
   575
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   576
                                        for the given ReportType
StephaneLenclud@50
   577
  HIDP_STATUS_IS_USAGE_VALUE_ARRAY   -- if one of the HIDP_DATA structures
StephaneLenclud@50
   578
                                        references a usage value array.
StephaneLenclud@50
   579
                                        DataLength will contain the index into
StephaneLenclud@50
   580
                                        the array that was invalid
StephaneLenclud@50
   581
  HIDP_STATUS_BUTTON_NOT_PRESSED     -- if a HIDP_DATA structure attempted
StephaneLenclud@50
   582
                                        to unset a button that was not already
StephaneLenclud@50
   583
                                        set in the Report
StephaneLenclud@50
   584
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- a HIDP_DATA structure was found with
StephaneLenclud@50
   585
                                        a valid index value but is contained
StephaneLenclud@50
   586
                                        in a different report than the one
StephaneLenclud@50
   587
                                        currently being processed
StephaneLenclud@50
   588
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough entries in
StephaneLenclud@50
   589
                                        a given Main Array Item to report all
StephaneLenclud@50
   590
                                        buttons that have been requested to be
StephaneLenclud@50
   591
                                        set
StephaneLenclud@50
   592
--*/
StephaneLenclud@50
   593
StephaneLenclud@50
   594
NTSTATUS __stdcall
StephaneLenclud@50
   595
HidP_GetData (
StephaneLenclud@50
   596
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
   597
    PHIDP_DATA DataList,
StephaneLenclud@50
   598
     PULONG DataLength,
StephaneLenclud@50
   599
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
   600
    PCHAR Report,
StephaneLenclud@50
   601
     ULONG ReportLength
StephaneLenclud@50
   602
    );
StephaneLenclud@50
   603
/*++
StephaneLenclud@50
   604
StephaneLenclud@50
   605
Routine Description:
StephaneLenclud@50
   606
StephaneLenclud@50
   607
    Please Note: For obvious reasons HidP_SetData and HidP_GetData will not
StephaneLenclud@50
   608
    access UsageValueArrays.
StephaneLenclud@50
   609
StephaneLenclud@50
   610
Parameters:
StephaneLenclud@50
   611
    ReportType  One of HidP_Input, HidP_Output, or HidP_Feature.
StephaneLenclud@50
   612
StephaneLenclud@50
   613
    DataList    Array of HIDP_DATA structures that will receive the data
StephaneLenclud@50
   614
                values that are set in the given report
StephaneLenclud@50
   615
StephaneLenclud@50
   616
    DataLength  As input, length in array elements of DataList.  As output,
StephaneLenclud@50
   617
                contains the number of data elements that were successfully
StephaneLenclud@50
   618
                set by HidP_GetData.  The maximum size necessary for DataList
StephaneLenclud@50
   619
                can be determined by calling HidP_MaxDataListLength
StephaneLenclud@50
   620
StephaneLenclud@50
   621
    PreparasedData  Preparsed data structure returned by HIDCLASS
StephaneLenclud@50
   622
StephaneLenclud@50
   623
    Report      Buffer which to set the data into.
StephaneLenclud@50
   624
StephaneLenclud@50
   625
    ReportLength Length of Report...Report should be at least as long as the
StephaneLenclud@50
   626
                value indicated in the HIDP_CAPS structure for the device and
StephaneLenclud@50
   627
                the corresponding ReportType
StephaneLenclud@50
   628
StephaneLenclud@50
   629
Return Value
StephaneLenclud@50
   630
    HidP_GetData returns the following error codes.
StephaneLenclud@50
   631
StephaneLenclud@50
   632
  HIDP_STATUS_SUCCESS                -- upon successful retrieval of all data
StephaneLenclud@50
   633
                                        from the report packet.
StephaneLenclud@50
   634
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   635
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   636
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not equal
StephaneLenclud@50
   637
                                        to the length specified in HIDP_CAPS
StephaneLenclud@50
   638
                                        structure for the given ReportType
StephaneLenclud@50
   639
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   640
                                        for the given ReportType
StephaneLenclud@50
   641
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough array entries in
StephaneLenclud@50
   642
                                        DataList to store all the indice values
StephaneLenclud@50
   643
                                        in the given report.  DataLength will
StephaneLenclud@50
   644
                                        contain the number of array entries
StephaneLenclud@50
   645
                                        required to hold all data
StephaneLenclud@50
   646
--*/
StephaneLenclud@50
   647
StephaneLenclud@50
   648
StephaneLenclud@50
   649
ULONG __stdcall
StephaneLenclud@50
   650
HidP_MaxDataListLength (
StephaneLenclud@50
   651
    HIDP_REPORT_TYPE      ReportType,
StephaneLenclud@50
   652
    PHIDP_PREPARSED_DATA  PreparsedData
StephaneLenclud@50
   653
   );
StephaneLenclud@50
   654
/*++
StephaneLenclud@50
   655
Routine Description:
StephaneLenclud@50
   656
StephaneLenclud@50
   657
    This function returns the maximum length of HIDP_DATA elements that
StephaneLenclud@50
   658
    HidP_GetData could return for the given report type.
StephaneLenclud@50
   659
StephaneLenclud@50
   660
Parameters:
StephaneLenclud@50
   661
StephaneLenclud@50
   662
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
   663
StephaneLenclud@50
   664
    PreparsedData    Preparsed data structure returned by HIDCLASS
StephaneLenclud@50
   665
StephaneLenclud@50
   666
Return Value:
StephaneLenclud@50
   667
StephaneLenclud@50
   668
    The length of the data list array required for the HidP_GetData function
StephaneLenclud@50
   669
    call.  If an error occurs (either HIDP_STATUS_INVALID_REPORT_TYPE or
StephaneLenclud@50
   670
    HIDP_STATUS_INVALID_PREPARSED_DATA), this function returns 0.
StephaneLenclud@50
   671
StephaneLenclud@50
   672
--*/
StephaneLenclud@50
   673
StephaneLenclud@50
   674
#define HidP_SetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
StephaneLenclud@50
   675
        HidP_SetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
StephaneLenclud@50
   676
StephaneLenclud@50
   677
StephaneLenclud@50
   678
NTSTATUS __stdcall
StephaneLenclud@50
   679
HidP_SetUsages (
StephaneLenclud@50
   680
    HIDP_REPORT_TYPE    ReportType,
StephaneLenclud@50
   681
    USAGE   UsagePage,
StephaneLenclud@50
   682
    USHORT  LinkCollection,
StephaneLenclud@50
   683
   PUSAGE  UsageList,
StephaneLenclud@50
   684
     PULONG  UsageLength,
StephaneLenclud@50
   685
    PHIDP_PREPARSED_DATA  PreparsedData,
StephaneLenclud@50
   686
   PCHAR   Report,
StephaneLenclud@50
   687
    ULONG   ReportLength 
StephaneLenclud@50
   688
   );
StephaneLenclud@50
   689
/*++
StephaneLenclud@50
   690
StephaneLenclud@50
   691
Routine Description:
StephaneLenclud@50
   692
    This function sets binary values (buttons) in a report.  Given an
StephaneLenclud@50
   693
    initialized packet of correct length, it modifies the report packet so that
StephaneLenclud@50
   694
    each element in the given list of usages has been set in the report packet.
StephaneLenclud@50
   695
    For example, in an output report with 5 LED's, each with a given usage,
StephaneLenclud@50
   696
    an application could turn on any subset of these lights by placing their
StephaneLenclud@50
   697
    usages in any order into the usage array (UsageList).  HidP_SetUsages would,
StephaneLenclud@50
   698
    in turn, set the appropriate bit or add the corresponding byte into the
StephaneLenclud@50
   699
    HID Main Array Item.
StephaneLenclud@50
   700
StephaneLenclud@50
   701
    A properly initialized Report packet is one of the correct byte length,
StephaneLenclud@50
   702
    and all zeros.
StephaneLenclud@50
   703
StephaneLenclud@50
   704
    NOTE: A packet that has already been set with a call to a HidP_Set routine
StephaneLenclud@50
   705
          can also be passed in.  This routine then sets processes the UsageList
StephaneLenclud@50
   706
          in the same fashion but verifies that the ReportID already set in
StephaneLenclud@50
   707
          Report matches the report ID for the given usages.
StephaneLenclud@50
   708
StephaneLenclud@50
   709
Parameters:
StephaneLenclud@50
   710
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
   711
StephaneLenclud@50
   712
    UsagePage   All of the usages in the usage array, which HidP_SetUsages will
StephaneLenclud@50
   713
                set in the report, refer to this same usage page.
StephaneLenclud@50
   714
                If a client wishes to set usages in a report for multiple
StephaneLenclud@50
   715
                usage pages then that client needs to make multiple calls to
StephaneLenclud@50
   716
                HidP_SetUsages for each of the usage pages.
StephaneLenclud@50
   717
StephaneLenclud@50
   718
    UsageList   A usage array containing the usages that HidP_SetUsages will set in
StephaneLenclud@50
   719
                the report packet.
StephaneLenclud@50
   720
StephaneLenclud@50
   721
    UsageLength The length of the given usage array in array elements.
StephaneLenclud@50
   722
                The parser will set this value to the position in the usage
StephaneLenclud@50
   723
                array where it stopped processing.  If successful, UsageLength
StephaneLenclud@50
   724
                will be unchanged.  In any error condition, this parameter
StephaneLenclud@50
   725
                reflects how many of the usages in the usage list have
StephaneLenclud@50
   726
                actually been set by the parser.  This is useful for finding
StephaneLenclud@50
   727
                the usage in the list which caused the error.
StephaneLenclud@50
   728
StephaneLenclud@50
   729
    PreparsedData The preparsed data recevied from HIDCLASS
StephaneLenclud@50
   730
StephaneLenclud@50
   731
    Report      The report packet.
StephaneLenclud@50
   732
StephaneLenclud@50
   733
    ReportLength   Length of the given report packet...Must be equal to the
StephaneLenclud@50
   734
                   value reported in the HIDP_CAPS structure for the device
StephaneLenclud@50
   735
                   and corresponding report type.
StephaneLenclud@50
   736
StephaneLenclud@50
   737
Return Value
StephaneLenclud@50
   738
    HidP_SetUsages returns the following error codes.  On error, the report packet
StephaneLenclud@50
   739
    will be correct up until the usage element that caused the error.
StephaneLenclud@50
   740
StephaneLenclud@50
   741
  HIDP_STATUS_SUCCESS                -- upon successful insertion of all usages
StephaneLenclud@50
   742
                                        into the report packet.
StephaneLenclud@50
   743
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   744
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   745
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
   746
                                        equal to the length specified in
StephaneLenclud@50
   747
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
   748
                                        ReportType
StephaneLenclud@50
   749
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   750
                                        for the given ReportType
StephaneLenclud@50
   751
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
StephaneLenclud@50
   752
                                        different report.  If the report is
StephaneLenclud@50
   753
                                        zero-initialized on entry the first
StephaneLenclud@50
   754
                                        usage in the list will determine which
StephaneLenclud@50
   755
                                        report ID is used.  Otherwise, the
StephaneLenclud@50
   756
                                        parser will verify that usage matches
StephaneLenclud@50
   757
                                        the passed in report's ID
StephaneLenclud@50
   758
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage does not exist for any
StephaneLenclud@50
   759
                                        report (no matter what the report ID)
StephaneLenclud@50
   760
                                        for the given report type.
StephaneLenclud@50
   761
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if there are not enough entries in a
StephaneLenclud@50
   762
                                        given Main Array Item to list all of
StephaneLenclud@50
   763
                                        the given usages.  The caller needs
StephaneLenclud@50
   764
                                        to split his request into more than
StephaneLenclud@50
   765
                                        one call
StephaneLenclud@50
   766
--*/
StephaneLenclud@50
   767
StephaneLenclud@50
   768
#define HidP_UnsetButtons(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle) \
StephaneLenclud@50
   769
        HidP_UnsetUsages(Rty, Up, Lco, ULi, ULe, Ppd, Rep, Rle)
StephaneLenclud@50
   770
StephaneLenclud@50
   771
StephaneLenclud@50
   772
NTSTATUS __stdcall
StephaneLenclud@50
   773
HidP_UnsetUsages (
StephaneLenclud@50
   774
    HIDP_REPORT_TYPE      ReportType,
StephaneLenclud@50
   775
    USAGE   UsagePage,
StephaneLenclud@50
   776
   USHORT  LinkCollection,
StephaneLenclud@50
   777
   PUSAGE  UsageList,
StephaneLenclud@50
   778
     PULONG  UsageLength,
StephaneLenclud@50
   779
    PHIDP_PREPARSED_DATA  PreparsedData,
StephaneLenclud@50
   780
   PCHAR   Report,
StephaneLenclud@50
   781
    ULONG   ReportLength
StephaneLenclud@50
   782
   );
StephaneLenclud@50
   783
/*++
StephaneLenclud@50
   784
StephaneLenclud@50
   785
Routine Description:
StephaneLenclud@50
   786
    This function unsets (turns off) binary values (buttons) in the report.  Given
StephaneLenclud@50
   787
    an initialized packet of correct length, it modifies the report packet so
StephaneLenclud@50
   788
    that each element in the given list of usages has been unset in the
StephaneLenclud@50
   789
    report packet.
StephaneLenclud@50
   790
StephaneLenclud@50
   791
    This function is the "undo" operation for SetUsages.  If the given usage
StephaneLenclud@50
   792
    is not already set in the Report, it will return an error code of
StephaneLenclud@50
   793
    HIDP_STATUS_BUTTON_NOT_PRESSED.  If the button is pressed, HidP_UnsetUsages
StephaneLenclud@50
   794
    will unset the appropriate bit or remove the corresponding index value from
StephaneLenclud@50
   795
    the HID Main Array Item.
StephaneLenclud@50
   796
StephaneLenclud@50
   797
    A properly initialized Report packet is one of the correct byte length,
StephaneLenclud@50
   798
    and all zeros..
StephaneLenclud@50
   799
StephaneLenclud@50
   800
    NOTE: A packet that has already been set with a call to a HidP_Set routine
StephaneLenclud@50
   801
          can also be passed in.  This routine then processes the UsageList
StephaneLenclud@50
   802
          in the same fashion but verifies that the ReportID already set in
StephaneLenclud@50
   803
          Report matches the report ID for the given usages.
StephaneLenclud@50
   804
StephaneLenclud@50
   805
Parameters:
StephaneLenclud@50
   806
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
   807
StephaneLenclud@50
   808
    UsagePage   All of the usages in the usage array, which HidP_UnsetUsages will
StephaneLenclud@50
   809
                unset in the report, refer to this same usage page.
StephaneLenclud@50
   810
                If a client wishes to unset usages in a report for multiple
StephaneLenclud@50
   811
                usage pages then that client needs to make multiple calls to
StephaneLenclud@50
   812
                HidP_UnsetUsages for each of the usage pages.
StephaneLenclud@50
   813
StephaneLenclud@50
   814
    UsageList   A usage array containing the usages that HidP_UnsetUsages will
StephaneLenclud@50
   815
                unset in the report packet.
StephaneLenclud@50
   816
StephaneLenclud@50
   817
    UsageLength The length of the given usage array in array elements.
StephaneLenclud@50
   818
                The parser will set this value to the position in the usage
StephaneLenclud@50
   819
                array where it stopped processing.  If successful, UsageLength
StephaneLenclud@50
   820
                will be unchanged.  In any error condition, this parameter
StephaneLenclud@50
   821
                reflects how many of the usages in the usage list have
StephaneLenclud@50
   822
                actually been unset by the parser.  This is useful for finding
StephaneLenclud@50
   823
                the usage in the list which caused the error.
StephaneLenclud@50
   824
StephaneLenclud@50
   825
    PreparsedData The preparsed data recevied from HIDCLASS
StephaneLenclud@50
   826
StephaneLenclud@50
   827
    Report      The report packet.
StephaneLenclud@50
   828
StephaneLenclud@50
   829
    ReportLength   Length of the given report packet...Must be equal to the
StephaneLenclud@50
   830
                   value reported in the HIDP_CAPS structure for the device
StephaneLenclud@50
   831
                   and corresponding report type.
StephaneLenclud@50
   832
StephaneLenclud@50
   833
Return Value
StephaneLenclud@50
   834
    HidP_UnsetUsages returns the following error codes.  On error, the report
StephaneLenclud@50
   835
    packet will be correct up until the usage element that caused the error.
StephaneLenclud@50
   836
StephaneLenclud@50
   837
  HIDP_STATUS_SUCCESS                -- upon successful "unsetting" of all usages
StephaneLenclud@50
   838
                                        in the report packet.
StephaneLenclud@50
   839
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   840
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   841
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
   842
                                        equal to the length specified in
StephaneLenclud@50
   843
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
   844
                                        ReportType
StephaneLenclud@50
   845
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   846
                                        for the given ReportType
StephaneLenclud@50
   847
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
StephaneLenclud@50
   848
                                        different report.  If the report is
StephaneLenclud@50
   849
                                        zero-initialized on entry the first
StephaneLenclud@50
   850
                                        usage in the list will determine which
StephaneLenclud@50
   851
                                        report ID is used.  Otherwise, the
StephaneLenclud@50
   852
                                        parser will verify that usage matches
StephaneLenclud@50
   853
                                        the passed in report's ID
StephaneLenclud@50
   854
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage does not exist for any
StephaneLenclud@50
   855
                                        report (no matter what the report ID)
StephaneLenclud@50
   856
                                        for the given report type.
StephaneLenclud@50
   857
  HIDP_STATUS_BUTTON_NOT_PRESSED     -- if a usage corresponds to a button that
StephaneLenclud@50
   858
                                        is not already set in the given report
StephaneLenclud@50
   859
--*/
StephaneLenclud@50
   860
StephaneLenclud@50
   861
#define HidP_GetButtons(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe) \
StephaneLenclud@50
   862
        HidP_GetUsages(Rty, UPa, LCo, ULi, ULe, Ppd, Rep, RLe)
StephaneLenclud@50
   863
StephaneLenclud@50
   864
StephaneLenclud@50
   865
NTSTATUS __stdcall
StephaneLenclud@50
   866
HidP_GetUsages (
StephaneLenclud@50
   867
    HIDP_REPORT_TYPE    ReportType,
StephaneLenclud@50
   868
    USAGE   UsagePage,
StephaneLenclud@50
   869
    USHORT  LinkCollection,
StephaneLenclud@50
   870
   PUSAGE UsageList,
StephaneLenclud@50
   871
       PULONG UsageLength,
StephaneLenclud@50
   872
    PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
   873
   PCHAR Report,
StephaneLenclud@50
   874
    ULONG   ReportLength
StephaneLenclud@50
   875
   );
StephaneLenclud@50
   876
/*++
StephaneLenclud@50
   877
StephaneLenclud@50
   878
Routine Description:
StephaneLenclud@50
   879
    This function returns the binary values (buttons) that are set in a HID
StephaneLenclud@50
   880
    report.  Given a report packet of correct length, it searches the report
StephaneLenclud@50
   881
    packet for each usage for the given usage page and returns them in the
StephaneLenclud@50
   882
    usage list.
StephaneLenclud@50
   883
StephaneLenclud@50
   884
Parameters:
StephaneLenclud@50
   885
    ReportType One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
   886
StephaneLenclud@50
   887
    UsagePage  All of the usages in the usage list, which HidP_GetUsages will
StephaneLenclud@50
   888
               retrieve in the report, refer to this same usage page.
StephaneLenclud@50
   889
               If the client wishes to get usages in a packet for multiple
StephaneLenclud@50
   890
               usage pages then that client needs to make multiple calls
StephaneLenclud@50
   891
               to HidP_GetUsages.
StephaneLenclud@50
   892
StephaneLenclud@50
   893
    LinkCollection  An optional value which can limit which usages are returned
StephaneLenclud@50
   894
                    in the UsageList to those usages that exist in a specific
StephaneLenclud@50
   895
                    LinkCollection.  A non-zero value indicates the index into
StephaneLenclud@50
   896
                    the HIDP_LINK_COLLECITON_NODE list returned by
StephaneLenclud@50
   897
                    HidP_GetLinkCollectionNodes of the link collection the
StephaneLenclud@50
   898
                    usage should belong to.  A value of 0 indicates this
StephaneLenclud@50
   899
                    should value be ignored.
StephaneLenclud@50
   900
StephaneLenclud@50
   901
    UsageList  The usage array that will contain all the usages found in
StephaneLenclud@50
   902
               the report packet.
StephaneLenclud@50
   903
StephaneLenclud@50
   904
    UsageLength The length of the given usage array in array elements.
StephaneLenclud@50
   905
                On input, this value describes the length of the usage list.
StephaneLenclud@50
   906
                On output, HidP_GetUsages sets this value to the number of
StephaneLenclud@50
   907
                usages that was found.  Use HidP_MaxUsageListLength to
StephaneLenclud@50
   908
                determine the maximum length needed to return all the usages
StephaneLenclud@50
   909
                that a given report packet may contain.
StephaneLenclud@50
   910
StephaneLenclud@50
   911
    PreparsedData Preparsed data structure returned by HIDCLASS
StephaneLenclud@50
   912
StephaneLenclud@50
   913
    Report       The report packet.
StephaneLenclud@50
   914
StephaneLenclud@50
   915
    ReportLength  Length (in bytes) of the given report packet
StephaneLenclud@50
   916
StephaneLenclud@50
   917
StephaneLenclud@50
   918
Return Value
StephaneLenclud@50
   919
    HidP_GetUsages returns the following error codes:
StephaneLenclud@50
   920
StephaneLenclud@50
   921
  HIDP_STATUS_SUCCESS                -- upon successfully retrieving all the
StephaneLenclud@50
   922
                                        usages from the report packet
StephaneLenclud@50
   923
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
   924
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
   925
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
   926
                                        equal to the length specified in
StephaneLenclud@50
   927
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
   928
                                        ReportType
StephaneLenclud@50
   929
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
   930
                                        for the given ReportType
StephaneLenclud@50
   931
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the UsageList is not big enough to
StephaneLenclud@50
   932
                                        hold all the usages found in the report
StephaneLenclud@50
   933
                                        packet.  If this is returned, the buffer
StephaneLenclud@50
   934
                                        will contain UsageLength number of
StephaneLenclud@50
   935
                                        usages.  Use HidP_MaxUsageListLength to
StephaneLenclud@50
   936
                                        find the maximum length needed
StephaneLenclud@50
   937
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages
StephaneLenclud@50
   938
                                        that match the UsagePage and
StephaneLenclud@50
   939
                                        LinkCollection specified could be found
StephaneLenclud@50
   940
                                        in a report with a different report ID
StephaneLenclud@50
   941
  HIDP_STATUS_USAGE_NOT_FOUND        -- if there are no usages in a reports for
StephaneLenclud@50
   942
                                        the device and ReportType that match the
StephaneLenclud@50
   943
                                        UsagePage and LinkCollection that were
StephaneLenclud@50
   944
                                        specified
StephaneLenclud@50
   945
--*/
StephaneLenclud@50
   946
StephaneLenclud@50
   947
#define HidP_GetButtonsEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)  \
StephaneLenclud@50
   948
         HidP_GetUsagesEx(Rty, LCo, BLi, ULe, Ppd, Rep, RLe)
StephaneLenclud@50
   949
StephaneLenclud@50
   950
NTSTATUS __stdcall
StephaneLenclud@50
   951
HidP_GetUsagesEx (
StephaneLenclud@50
   952
        HIDP_REPORT_TYPE    ReportType,
StephaneLenclud@50
   953
        USHORT  LinkCollection, // Optional
StephaneLenclud@50
   954
    PUSAGE_AND_PAGE  ButtonList,
StephaneLenclud@50
   955
       ULONG * UsageLength,
StephaneLenclud@50
   956
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
   957
    reads_bytes_(ReportLength)   PCHAR   Report,
StephaneLenclud@50
   958
     ULONG  ReportLength
StephaneLenclud@50
   959
   );
StephaneLenclud@50
   960
StephaneLenclud@50
   961
/*++
StephaneLenclud@50
   962
StephaneLenclud@50
   963
Routine Description:
StephaneLenclud@50
   964
    This function returns the binary values (buttons) in a HID report.
StephaneLenclud@50
   965
    Given a report packet of correct length, it searches the report packet
StephaneLenclud@50
   966
    for all buttons and returns the UsagePage and Usage for each of the buttons
StephaneLenclud@50
   967
    it finds.
StephaneLenclud@50
   968
StephaneLenclud@50
   969
Parameters:
StephaneLenclud@50
   970
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
   971
StephaneLenclud@50
   972
    LinkCollection  An optional value which can limit which usages are returned
StephaneLenclud@50
   973
                    in the ButtonList to those usages that exist in a specific
StephaneLenclud@50
   974
                    LinkCollection.  A non-zero value indicates the index into
StephaneLenclud@50
   975
                    the HIDP_LINK_COLLECITON_NODE list returned by
StephaneLenclud@50
   976
                    HidP_GetLinkCollectionNodes of the link collection the
StephaneLenclud@50
   977
                    usage should belong to.  A value of 0 indicates this
StephaneLenclud@50
   978
                    should value be ignored.
StephaneLenclud@50
   979
StephaneLenclud@50
   980
    ButtonList  An array of USAGE_AND_PAGE structures describing all the
StephaneLenclud@50
   981
                buttons currently ``down'' in the device.
StephaneLenclud@50
   982
StephaneLenclud@50
   983
    UsageLength The length of the given array in terms of elements.
StephaneLenclud@50
   984
                On input, this value describes the length of the list.  On
StephaneLenclud@50
   985
                output, HidP_GetUsagesEx sets this value to the number of
StephaneLenclud@50
   986
                usages that were found.  Use HidP_MaxUsageListLength to
StephaneLenclud@50
   987
                determine the maximum length needed to return all the usages
StephaneLenclud@50
   988
                that a given report packet may contain.
StephaneLenclud@50
   989
StephaneLenclud@50
   990
    PreparsedData Preparsed data returned by HIDCLASS
StephaneLenclud@50
   991
StephaneLenclud@50
   992
    Report       The report packet.
StephaneLenclud@50
   993
StephaneLenclud@50
   994
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
   995
StephaneLenclud@50
   996
StephaneLenclud@50
   997
Return Value
StephaneLenclud@50
   998
    HidP_GetUsagesEx returns the following error codes:
StephaneLenclud@50
   999
StephaneLenclud@50
  1000
  HIDP_STATUS_SUCCESS                -- upon successfully retrieving all the
StephaneLenclud@50
  1001
                                        usages from the report packet
StephaneLenclud@50
  1002
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1003
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1004
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1005
                                        equal to the length specified in
StephaneLenclud@50
  1006
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1007
                                        ReportType
StephaneLenclud@50
  1008
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
  1009
                                        for the given ReportType
StephaneLenclud@50
  1010
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if ButtonList is not big enough to
StephaneLenclud@50
  1011
                                        hold all the usages found in the report
StephaneLenclud@50
  1012
                                        packet.  If this is returned, the buffer
StephaneLenclud@50
  1013
                                        will contain UsageLength number of
StephaneLenclud@50
  1014
                                        usages.  Use HidP_MaxUsageListLength to
StephaneLenclud@50
  1015
                                        find the maximum length needed
StephaneLenclud@50
  1016
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages
StephaneLenclud@50
  1017
                                        that match the specified LinkCollection
StephaneLenclud@50
  1018
                                        exist in report with a different report
StephaneLenclud@50
  1019
                                        ID.
StephaneLenclud@50
  1020
  HIDP_STATUS_USAGE_NOT_FOUND        -- if there are no usages in any reports that
StephaneLenclud@50
  1021
                                        match the LinkCollection parameter
StephaneLenclud@50
  1022
--*/
StephaneLenclud@50
  1023
        
StephaneLenclud@50
  1024
_IRQL_requires_max_(PASSIVE_LEVEL) 
StephaneLenclud@50
  1025
ULONG __stdcall
StephaneLenclud@50
  1026
HidP_MaxUsageListLength (
StephaneLenclud@50
  1027
    HIDP_REPORT_TYPE      ReportType,
StephaneLenclud@50
  1028
    USAGE                 UsagePage, // Optional
StephaneLenclud@50
  1029
    PHIDP_PREPARSED_DATA  PreparsedData
StephaneLenclud@50
  1030
   );
StephaneLenclud@50
  1031
/*++
StephaneLenclud@50
  1032
Routine Description:
StephaneLenclud@50
  1033
    This function returns the maximum number of usages that a call to
StephaneLenclud@50
  1034
    HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report.
StephaneLenclud@50
  1035
    If calling for number of usages returned by HidP_GetUsagesEx, use 0 as
StephaneLenclud@50
  1036
    the UsagePage value.
StephaneLenclud@50
  1037
StephaneLenclud@50
  1038
Parameters:
StephaneLenclud@50
  1039
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
  1040
StephaneLenclud@50
  1041
    UsagePage   Specifies the optional UsagePage to query for.  If 0, will
StephaneLenclud@50
  1042
                return all the maximum number of usage values that could be
StephaneLenclud@50
  1043
                returned for a given ReportType.   If non-zero, will return
StephaneLenclud@50
  1044
                the maximum number of usages that would be returned for the
StephaneLenclud@50
  1045
                ReportType with the given UsagePage.
StephaneLenclud@50
  1046
StephaneLenclud@50
  1047
    PreparsedData Preparsed data returned from HIDCLASS
StephaneLenclud@50
  1048
StephaneLenclud@50
  1049
Return Value:
StephaneLenclud@50
  1050
    The length of the usage list array required for the HidP_GetUsages or
StephaneLenclud@50
  1051
    HidP_GetUsagesEx function call.  If an error occurs (such as
StephaneLenclud@50
  1052
    HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this
StephaneLenclud@50
  1053
    returns 0.
StephaneLenclud@50
  1054
--*/
StephaneLenclud@50
  1055
StephaneLenclud@50
  1056
StephaneLenclud@50
  1057
NTSTATUS __stdcall
StephaneLenclud@50
  1058
HidP_SetUsageValue (
StephaneLenclud@50
  1059
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1060
     USAGE UsagePage,
StephaneLenclud@50
  1061
     USHORT LinkCollection,
StephaneLenclud@50
  1062
     USAGE Usage,
StephaneLenclud@50
  1063
     ULONG UsageValue,
StephaneLenclud@50
  1064
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1065
    updates_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1066
     ULONG ReportLength
StephaneLenclud@50
  1067
    );
StephaneLenclud@50
  1068
/*++
StephaneLenclud@50
  1069
Description:
StephaneLenclud@50
  1070
    HidP_SetUsageValue inserts a value into the HID Report Packet in the field
StephaneLenclud@50
  1071
    corresponding to the given usage page and usage.  HidP_SetUsageValue
StephaneLenclud@50
  1072
    casts this value to the appropriate bit length.  If a report packet
StephaneLenclud@50
  1073
    contains two different fields with the same Usage and UsagePage,
StephaneLenclud@50
  1074
    they can be distinguished with the optional LinkCollection field value.
StephaneLenclud@50
  1075
    Using this function sets the raw value into the report packet with
StephaneLenclud@50
  1076
    no checking done as to whether it actually falls within the logical
StephaneLenclud@50
  1077
    minimum/logical maximum range.  Use HidP_SetScaledUsageValue for this...
StephaneLenclud@50
  1078
StephaneLenclud@50
  1079
    NOTE: Although the UsageValue parameter is a ULONG, any casting that is
StephaneLenclud@50
  1080
          done will preserve or sign-extend the value.  The value being set
StephaneLenclud@50
  1081
          should be considered a LONG value and will be treated as such by
StephaneLenclud@50
  1082
          this function.
StephaneLenclud@50
  1083
StephaneLenclud@50
  1084
Parameters:
StephaneLenclud@50
  1085
StephaneLenclud@50
  1086
    ReportType  One of HidP_Output or HidP_Feature.
StephaneLenclud@50
  1087
StephaneLenclud@50
  1088
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1089
StephaneLenclud@50
  1090
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1091
                                between two fields that may have the same
StephaneLenclud@50
  1092
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1093
                                collections.  If the link collection value
StephaneLenclud@50
  1094
                                is zero, this function will set the first field
StephaneLenclud@50
  1095
                                it finds that matches the usage page and
StephaneLenclud@50
  1096
                                usage.
StephaneLenclud@50
  1097
StephaneLenclud@50
  1098
    Usage       The usage whose value HidP_SetUsageValue will set.
StephaneLenclud@50
  1099
StephaneLenclud@50
  1100
    UsageValue  The raw value to set in the report buffer.  This value must be within
StephaneLenclud@50
  1101
                the logical range or if a NULL value this value should be the
StephaneLenclud@50
  1102
                most negative value that can be represented by the number of bits
StephaneLenclud@50
  1103
                for this field.
StephaneLenclud@50
  1104
StephaneLenclud@50
  1105
    PreparsedData The preparsed data returned for HIDCLASS
StephaneLenclud@50
  1106
StephaneLenclud@50
  1107
    Report      The report packet.
StephaneLenclud@50
  1108
StephaneLenclud@50
  1109
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
  1110
StephaneLenclud@50
  1111
StephaneLenclud@50
  1112
Return Value:
StephaneLenclud@50
  1113
    HidP_SetUsageValue returns the following error codes:
StephaneLenclud@50
  1114
StephaneLenclud@50
  1115
  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
StephaneLenclud@50
  1116
                                        in the report packet
StephaneLenclud@50
  1117
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1118
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1119
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1120
                                        equal to the length specified in
StephaneLenclud@50
  1121
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1122
                                        ReportType
StephaneLenclud@50
  1123
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
  1124
                                        for the given ReportType
StephaneLenclud@50
  1125
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1126
                                        link collection exist but exists in
StephaneLenclud@50
  1127
                                        a report with a different report ID
StephaneLenclud@50
  1128
                                        than the report being passed in.  To
StephaneLenclud@50
  1129
                                        set this value, call HidP_SetUsageValue
StephaneLenclud@50
  1130
                                        again with a zero-initizialed report
StephaneLenclud@50
  1131
                                        packet
StephaneLenclud@50
  1132
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1133
                                        collection combination does not exist
StephaneLenclud@50
  1134
                                        in any reports for this ReportType
StephaneLenclud@50
  1135
--*/
StephaneLenclud@50
  1136
StephaneLenclud@50
  1137
NTSTATUS __stdcall
StephaneLenclud@50
  1138
HidP_SetScaledUsageValue (
StephaneLenclud@50
  1139
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1140
     USAGE UsagePage,
StephaneLenclud@50
  1141
     USHORT LinkCollection,
StephaneLenclud@50
  1142
     USAGE Usage,
StephaneLenclud@50
  1143
     LONG UsageValue,
StephaneLenclud@50
  1144
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1145
    updates_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1146
     ULONG ReportLength
StephaneLenclud@50
  1147
    );
StephaneLenclud@50
  1148
StephaneLenclud@50
  1149
/*++
StephaneLenclud@50
  1150
Description:
StephaneLenclud@50
  1151
    HidP_SetScaledUsageValue inserts the UsageValue into the HID report packet
StephaneLenclud@50
  1152
    in the field corresponding to the given usage page and usage.  If a report
StephaneLenclud@50
  1153
    packet contains two different fields with the same Usage and UsagePage,
StephaneLenclud@50
  1154
    they can be distinguished with the optional LinkCollection field value.
StephaneLenclud@50
  1155
StephaneLenclud@50
  1156
    If the specified field has a defined physical range, this function converts
StephaneLenclud@50
  1157
    the physical value specified to the corresponding logical value for the
StephaneLenclud@50
  1158
    report.  If a physical value does not exist, the function will verify that
StephaneLenclud@50
  1159
    the value specified falls within the logical range and set according.
StephaneLenclud@50
  1160
StephaneLenclud@50
  1161
    If the range checking fails but the field has NULL values, the function will
StephaneLenclud@50
  1162
    set the field to the defined NULL value (most negative number possible) and
StephaneLenclud@50
  1163
    return HIDP_STATUS_NULL.  In other words, use this function to set NULL
StephaneLenclud@50
  1164
    values for a given field by passing in a value that falls outside the
StephaneLenclud@50
  1165
    physical range if it is defined or the logical range otherwise.
StephaneLenclud@50
  1166
StephaneLenclud@50
  1167
    If the field does not support NULL values, an out of range error will be
StephaneLenclud@50
  1168
    returned instead.
StephaneLenclud@50
  1169
StephaneLenclud@50
  1170
Parameters:
StephaneLenclud@50
  1171
StephaneLenclud@50
  1172
    ReportType  One of HidP_Output or HidP_Feature.
StephaneLenclud@50
  1173
StephaneLenclud@50
  1174
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1175
StephaneLenclud@50
  1176
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1177
                                between two fields that may have the same
StephaneLenclud@50
  1178
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1179
                                collections.  If the link collection value
StephaneLenclud@50
  1180
                                is zero, this function will set the first field
StephaneLenclud@50
  1181
                                it finds that matches the usage page and
StephaneLenclud@50
  1182
                                usage.
StephaneLenclud@50
  1183
StephaneLenclud@50
  1184
    Usage       The usage whose value HidP_SetScaledUsageValue will set.
StephaneLenclud@50
  1185
StephaneLenclud@50
  1186
    UsageValue  The value to set in the report buffer.  See the routine
StephaneLenclud@50
  1187
                description above for the different interpretations of this
StephaneLenclud@50
  1188
                value
StephaneLenclud@50
  1189
StephaneLenclud@50
  1190
    PreparsedData The preparsed data returned from HIDCLASS
StephaneLenclud@50
  1191
StephaneLenclud@50
  1192
    Report      The report packet.
StephaneLenclud@50
  1193
StephaneLenclud@50
  1194
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
  1195
StephaneLenclud@50
  1196
StephaneLenclud@50
  1197
Return Value:
StephaneLenclud@50
  1198
   HidP_SetScaledUsageValue returns the following error codes:
StephaneLenclud@50
  1199
StephaneLenclud@50
  1200
  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
StephaneLenclud@50
  1201
                                        in the report packet
StephaneLenclud@50
  1202
  HIDP_STATUS_NULL                   -- upon successfully setting the value
StephaneLenclud@50
  1203
                                        in the report packet as a NULL value
StephaneLenclud@50
  1204
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1205
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1206
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1207
                                        equal to the length specified in
StephaneLenclud@50
  1208
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1209
                                        ReportType
StephaneLenclud@50
  1210
  HIDP_STATUS_VALUEOF_RANGE     -- if the value specified failed to fall
StephaneLenclud@50
  1211
                                        within the physical range if it exists
StephaneLenclud@50
  1212
                                        or within the logical range otherwise
StephaneLenclud@50
  1213
                                        and the field specified by the usage
StephaneLenclud@50
  1214
                                        does not allow NULL values
StephaneLenclud@50
  1215
  HIDP_STATUS_BAD_LOG_PHY_VALUES     -- if the field has a physical range but
StephaneLenclud@50
  1216
                                        either the logical range is invalid
StephaneLenclud@50
  1217
                                        (max <= min) or the physical range is
StephaneLenclud@50
  1218
                                        invalid
StephaneLenclud@50
  1219
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1220
                                        link collection exist but exists in
StephaneLenclud@50
  1221
                                        a report with a different report ID
StephaneLenclud@50
  1222
                                        than the report being passed in.  To
StephaneLenclud@50
  1223
                                        set this value, call
StephaneLenclud@50
  1224
                                        HidP_SetScaledUsageValue again with
StephaneLenclud@50
  1225
                                        a zero-initialized report packet
StephaneLenclud@50
  1226
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1227
                                        collection combination does not exist
StephaneLenclud@50
  1228
                                        in any reports for this ReportType
StephaneLenclud@50
  1229
--*/
StephaneLenclud@50
  1230
StephaneLenclud@50
  1231
NTSTATUS __stdcall
StephaneLenclud@50
  1232
HidP_SetUsageValueArray (
StephaneLenclud@50
  1233
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1234
     USAGE UsagePage,
StephaneLenclud@50
  1235
     USHORT LinkCollection,
StephaneLenclud@50
  1236
     USAGE Usage,
StephaneLenclud@50
  1237
    reads_bytes_(UsageValueByteLength) PCHAR UsageValue,
StephaneLenclud@50
  1238
     USHORT UsageValueByteLength,
StephaneLenclud@50
  1239
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1240
    updates_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1241
     ULONG ReportLength
StephaneLenclud@50
  1242
    );
StephaneLenclud@50
  1243
StephaneLenclud@50
  1244
/*++
StephaneLenclud@50
  1245
Routine Descripton:
StephaneLenclud@50
  1246
    A usage value array occurs when the last usage in the list of usages
StephaneLenclud@50
  1247
    describing a main item must be repeated because there are less usages defined
StephaneLenclud@50
  1248
    than there are report counts declared for the given main item.  In this case
StephaneLenclud@50
  1249
    a single value cap is allocated for that usage and the report count of that
StephaneLenclud@50
  1250
    value cap is set to reflect the number of fields to which that usage refers.
StephaneLenclud@50
  1251
StephaneLenclud@50
  1252
    HidP_SetUsageValueArray sets the raw bits for that usage which spans
StephaneLenclud@50
  1253
    more than one field in a report.
StephaneLenclud@50
  1254
StephaneLenclud@50
  1255
    NOTE: This function currently does not support value arrays where the
StephaneLenclud@50
  1256
          ReportSize for each of the fields in the array is not a multiple
StephaneLenclud@50
  1257
          of 8 bits.
StephaneLenclud@50
  1258
StephaneLenclud@50
  1259
          The UsageValue buffer should have the values set as they would appear
StephaneLenclud@50
  1260
          in the report buffer.  If this function supported non 8-bit multiples
StephaneLenclud@50
  1261
          for the ReportSize then caller should format the input buffer so that
StephaneLenclud@50
  1262
          each new value begins at the bit immediately following the last bit
StephaneLenclud@50
  1263
          of the previous value
StephaneLenclud@50
  1264
StephaneLenclud@50
  1265
Parameters:
StephaneLenclud@50
  1266
StephaneLenclud@50
  1267
    ReportType  One of HidP_Output or HidP_Feature.
StephaneLenclud@50
  1268
StephaneLenclud@50
  1269
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1270
StephaneLenclud@50
  1271
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1272
                                between two fields that may have the same
StephaneLenclud@50
  1273
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1274
                                collections.  If the link collection value
StephaneLenclud@50
  1275
                                is zero, this function will set the first field
StephaneLenclud@50
  1276
                                it finds that matches the usage page and
StephaneLenclud@50
  1277
                                usage.
StephaneLenclud@50
  1278
StephaneLenclud@50
  1279
    Usage       The usage whose value array HidP_SetUsageValueArray will set.
StephaneLenclud@50
  1280
StephaneLenclud@50
  1281
    UsageValue  The buffer with the values to set into the value array.
StephaneLenclud@50
  1282
                The number of BITS required is found by multiplying the
StephaneLenclud@50
  1283
                BitSize and ReportCount fields of the Value Cap for this
StephaneLenclud@50
  1284
                control.  The least significant bit of this control found in the
StephaneLenclud@50
  1285
                given report will be placed in the least significan bit location
StephaneLenclud@50
  1286
                of the array given (little-endian format), regardless of whether
StephaneLenclud@50
  1287
                or not the field is byte alligned or if the BitSize is a multiple
StephaneLenclud@50
  1288
                of sizeof (CHAR).
StephaneLenclud@50
  1289
StephaneLenclud@50
  1290
                See the above note for current implementation limitations.
StephaneLenclud@50
  1291
StephaneLenclud@50
  1292
    UsageValueByteLength  Length of the UsageValue buffer (in bytes)
StephaneLenclud@50
  1293
StephaneLenclud@50
  1294
    PreparsedData The preparsed data returned from HIDCLASS
StephaneLenclud@50
  1295
StephaneLenclud@50
  1296
    Report      The report packet.
StephaneLenclud@50
  1297
StephaneLenclud@50
  1298
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
  1299
StephaneLenclud@50
  1300
StephaneLenclud@50
  1301
Return Value:
StephaneLenclud@50
  1302
  HIDP_STATUS_SUCCESS                -- upon successfully setting the value
StephaneLenclud@50
  1303
                                        array in the report packet
StephaneLenclud@50
  1304
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1305
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1306
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1307
                                        equal to the length specified in
StephaneLenclud@50
  1308
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1309
                                        ReportType
StephaneLenclud@50
  1310
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
  1311
                                        for the given ReportType
StephaneLenclud@50
  1312
  HIDP_STATUS_NOT_VALUE_ARRAY        -- if the control specified is not a
StephaneLenclud@50
  1313
                                        value array -- a value array will have
StephaneLenclud@50
  1314
                                        a ReportCount field in the
StephaneLenclud@50
  1315
                                        HIDP_VALUE_CAPS structure that is > 1
StephaneLenclud@50
  1316
                                        Use HidP_SetUsageValue instead
StephaneLenclud@50
  1317
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the size of the passed in buffer with
StephaneLenclud@50
  1318
                                        the values to set is too small (ie. has
StephaneLenclud@50
  1319
                                        fewer values than the number of fields in
StephaneLenclud@50
  1320
                                        the array
StephaneLenclud@50
  1321
  HIDP_STATUS_NOT_IMPLEMENTED        -- if the usage value array has field sizes
StephaneLenclud@50
  1322
                                        that are not multiples of 8 bits, this
StephaneLenclud@50
  1323
                                        error code is returned since the function
StephaneLenclud@50
  1324
                                        currently does not handle setting into
StephaneLenclud@50
  1325
                                        such arrays.
StephaneLenclud@50
  1326
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1327
                                        link collection exist but exists in
StephaneLenclud@50
  1328
                                        a report with a different report ID
StephaneLenclud@50
  1329
                                        than the report being passed in.  To
StephaneLenclud@50
  1330
                                        set this value, call
StephaneLenclud@50
  1331
                                        HidP_SetUsageValueArray again with
StephaneLenclud@50
  1332
                                        a zero-initialized report packet
StephaneLenclud@50
  1333
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1334
                                        collection combination does not exist
StephaneLenclud@50
  1335
                                        in any reports for this ReportType
StephaneLenclud@50
  1336
--*/
StephaneLenclud@50
  1337
StephaneLenclud@50
  1338
StephaneLenclud@50
  1339
NTSTATUS __stdcall
StephaneLenclud@50
  1340
HidP_GetUsageValue (
StephaneLenclud@50
  1341
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1342
     USAGE UsagePage,
StephaneLenclud@50
  1343
     USHORT LinkCollection,
StephaneLenclud@50
  1344
     USAGE Usage,
StephaneLenclud@50
  1345
     PULONG UsageValue,
StephaneLenclud@50
  1346
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1347
    reads_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1348
     ULONG ReportLength
StephaneLenclud@50
  1349
    );
StephaneLenclud@50
  1350
StephaneLenclud@50
  1351
/*
StephaneLenclud@50
  1352
Description
StephaneLenclud@50
  1353
    HidP_GetUsageValue retrieves the value from the HID Report for the usage
StephaneLenclud@50
  1354
    specified by the combination of usage page, usage and link collection.
StephaneLenclud@50
  1355
    If a report packet contains two different fields with the same
StephaneLenclud@50
  1356
    Usage and UsagePage, they can be distinguished with the optional
StephaneLenclud@50
  1357
    LinkCollection field value.
StephaneLenclud@50
  1358
StephaneLenclud@50
  1359
Parameters:
StephaneLenclud@50
  1360
StephaneLenclud@50
  1361
    ReportType  One of HidP_Input or HidP_Feature.
StephaneLenclud@50
  1362
StephaneLenclud@50
  1363
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1364
StephaneLenclud@50
  1365
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1366
                                between two fields that may have the same
StephaneLenclud@50
  1367
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1368
                                collections.  If the link collection value
StephaneLenclud@50
  1369
                                is zero, this function will set the first field
StephaneLenclud@50
  1370
                                it finds that matches the usage page and
StephaneLenclud@50
  1371
                                usage.
StephaneLenclud@50
  1372
StephaneLenclud@50
  1373
    Usage       The usage whose value HidP_GetUsageValue will retrieve
StephaneLenclud@50
  1374
StephaneLenclud@50
  1375
    UsageValue  The raw value that is set for the specified field in the report
StephaneLenclud@50
  1376
                buffer. This value will either fall within the logical range
StephaneLenclud@50
  1377
                or if NULL values are allowed, a number outside the range to
StephaneLenclud@50
  1378
                indicate a NULL
StephaneLenclud@50
  1379
StephaneLenclud@50
  1380
    PreparsedData The preparsed data returned for HIDCLASS
StephaneLenclud@50
  1381
StephaneLenclud@50
  1382
    Report      The report packet.
StephaneLenclud@50
  1383
StephaneLenclud@50
  1384
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
  1385
StephaneLenclud@50
  1386
StephaneLenclud@50
  1387
Return Value:
StephaneLenclud@50
  1388
    HidP_GetUsageValue returns the following error codes:
StephaneLenclud@50
  1389
StephaneLenclud@50
  1390
  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
StephaneLenclud@50
  1391
                                        from the report packet
StephaneLenclud@50
  1392
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1393
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1394
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1395
                                        equal to the length specified in
StephaneLenclud@50
  1396
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1397
                                        ReportType
StephaneLenclud@50
  1398
  HIDP_STATUS_REPORT_DOES_NOT_EXIST  -- if there are no reports on this device
StephaneLenclud@50
  1399
                                        for the given ReportType
StephaneLenclud@50
  1400
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1401
                                        link collection exist but exists in
StephaneLenclud@50
  1402
                                        a report with a different report ID
StephaneLenclud@50
  1403
                                        than the report being passed in.  To
StephaneLenclud@50
  1404
                                        set this value, call HidP_GetUsageValue
StephaneLenclud@50
  1405
                                        again with a different report packet
StephaneLenclud@50
  1406
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1407
                                        collection combination does not exist
StephaneLenclud@50
  1408
                                        in any reports for this ReportType
StephaneLenclud@50
  1409
--*/
StephaneLenclud@50
  1410
StephaneLenclud@50
  1411
StephaneLenclud@50
  1412
NTSTATUS __stdcall
StephaneLenclud@50
  1413
HidP_GetScaledUsageValue (
StephaneLenclud@50
  1414
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1415
     USAGE UsagePage,
StephaneLenclud@50
  1416
     USHORT LinkCollection,
StephaneLenclud@50
  1417
     USAGE Usage,
StephaneLenclud@50
  1418
     PLONG UsageValue,
StephaneLenclud@50
  1419
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1420
    reads_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1421
     ULONG ReportLength
StephaneLenclud@50
  1422
    );
StephaneLenclud@50
  1423
StephaneLenclud@50
  1424
/*++
StephaneLenclud@50
  1425
Description
StephaneLenclud@50
  1426
    HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet
StephaneLenclud@50
  1427
    in the field corresponding to the given usage page and usage.  If a report
StephaneLenclud@50
  1428
    packet contains two different fields with the same Usage and UsagePage,
StephaneLenclud@50
  1429
    they can be distinguished with the optional LinkCollection field value.
StephaneLenclud@50
  1430
StephaneLenclud@50
  1431
    If the specified field has a defined physical range, this function converts
StephaneLenclud@50
  1432
    the logical value that exists in the report packet to the corresponding
StephaneLenclud@50
  1433
    physical value.  If a physical range does not exist, the function will
StephaneLenclud@50
  1434
    return the logical value.  This function will check to verify that the
StephaneLenclud@50
  1435
    logical value in the report falls within the declared logical range.
StephaneLenclud@50
  1436
StephaneLenclud@50
  1437
    When doing the conversion between logical and physical values, this
StephaneLenclud@50
  1438
    function assumes a linear extrapolation between the physical max/min and
StephaneLenclud@50
  1439
    the logical max/min. (Where logical is the values reported by the device
StephaneLenclud@50
  1440
    and physical is the value returned by this function).  If the data field
StephaneLenclud@50
  1441
    size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend
StephaneLenclud@50
  1442
    the value to 32 bits.
StephaneLenclud@50
  1443
StephaneLenclud@50
  1444
    If the range checking fails but the field has NULL values, the function
StephaneLenclud@50
  1445
    will set UsageValue to 0 and return HIDP_STATUS_NULL.  Otherwise, it
StephaneLenclud@50
  1446
    returns a HIDP_STATUSOF_RANGE error.
StephaneLenclud@50
  1447
StephaneLenclud@50
  1448
Parameters:
StephaneLenclud@50
  1449
StephaneLenclud@50
  1450
    ReportType  One of HidP_Output or HidP_Feature.
StephaneLenclud@50
  1451
StephaneLenclud@50
  1452
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1453
StephaneLenclud@50
  1454
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1455
                                between two fields that may have the same
StephaneLenclud@50
  1456
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1457
                                collections.  If the link collection value
StephaneLenclud@50
  1458
                                is zero, this function will retrieve the first
StephaneLenclud@50
  1459
                                field it finds that matches the usage page
StephaneLenclud@50
  1460
                                and usage.
StephaneLenclud@50
  1461
StephaneLenclud@50
  1462
    Usage       The usage whose value HidP_GetScaledUsageValue will retrieve
StephaneLenclud@50
  1463
StephaneLenclud@50
  1464
    UsageValue  The value retrieved from the report buffer.  See the routine
StephaneLenclud@50
  1465
                description above for the different interpretations of this
StephaneLenclud@50
  1466
                value
StephaneLenclud@50
  1467
StephaneLenclud@50
  1468
    PreparsedData The preparsed data returned from HIDCLASS
StephaneLenclud@50
  1469
StephaneLenclud@50
  1470
    Report      The report packet.
StephaneLenclud@50
  1471
StephaneLenclud@50
  1472
    ReportLength Length (in bytes) of the given report packet.
StephaneLenclud@50
  1473
StephaneLenclud@50
  1474
StephaneLenclud@50
  1475
Return Value:
StephaneLenclud@50
  1476
   HidP_GetScaledUsageValue returns the following error codes:
StephaneLenclud@50
  1477
StephaneLenclud@50
  1478
  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
StephaneLenclud@50
  1479
                                        from the report packet
StephaneLenclud@50
  1480
  HIDP_STATUS_NULL                   -- if the report packet had a NULL value
StephaneLenclud@50
  1481
                                        set
StephaneLenclud@50
  1482
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1483
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1484
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1485
                                        equal to the length specified in
StephaneLenclud@50
  1486
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1487
                                        ReportType
StephaneLenclud@50
  1488
  HIDP_STATUS_VALUEOF_RANGE     -- if the value retrieved from the packet
StephaneLenclud@50
  1489
                                        falls outside the logical range and
StephaneLenclud@50
  1490
                                        the field does not support NULL values
StephaneLenclud@50
  1491
  HIDP_STATUS_BAD_LOG_PHY_VALUES     -- if the field has a physical range but
StephaneLenclud@50
  1492
                                        either the logical range is invalid
StephaneLenclud@50
  1493
                                        (max <= min) or the physical range is
StephaneLenclud@50
  1494
                                        invalid
StephaneLenclud@50
  1495
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1496
                                        link collection exist but exists in
StephaneLenclud@50
  1497
                                        a report with a different report ID
StephaneLenclud@50
  1498
                                        than the report being passed in.  To
StephaneLenclud@50
  1499
                                        set this value, call
StephaneLenclud@50
  1500
                                        HidP_GetScaledUsageValue with a
StephaneLenclud@50
  1501
                                        different report packet
StephaneLenclud@50
  1502
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1503
                                        collection combination does not exist
StephaneLenclud@50
  1504
                                        in any reports for this ReportType
StephaneLenclud@50
  1505
--*/
StephaneLenclud@50
  1506
StephaneLenclud@50
  1507
NTSTATUS __stdcall
StephaneLenclud@50
  1508
HidP_GetUsageValueArray (
StephaneLenclud@50
  1509
     HIDP_REPORT_TYPE ReportType,
StephaneLenclud@50
  1510
     USAGE UsagePage,
StephaneLenclud@50
  1511
     USHORT LinkCollection,
StephaneLenclud@50
  1512
     USAGE Usage,
StephaneLenclud@50
  1513
    updates_bytes_(UsageValueByteLength) PCHAR UsageValue,
StephaneLenclud@50
  1514
     USHORT UsageValueByteLength,
StephaneLenclud@50
  1515
     PHIDP_PREPARSED_DATA PreparsedData,
StephaneLenclud@50
  1516
    reads_bytes_(ReportLength) PCHAR Report,
StephaneLenclud@50
  1517
     ULONG ReportLength
StephaneLenclud@50
  1518
    );
StephaneLenclud@50
  1519
StephaneLenclud@50
  1520
/*++
StephaneLenclud@50
  1521
Routine Descripton:
StephaneLenclud@50
  1522
    A usage value array occurs when the last usage in the list of usages
StephaneLenclud@50
  1523
    describing a main item must be repeated because there are less usages defined
StephaneLenclud@50
  1524
    than there are report counts declared for the given main item.  In this case
StephaneLenclud@50
  1525
    a single value cap is allocated for that usage and the report count of that
StephaneLenclud@50
  1526
    value cap is set to reflect the number of fields to which that usage refers.
StephaneLenclud@50
  1527
StephaneLenclud@50
  1528
    HidP_GetUsageValueArray returns the raw bits for that usage which spans
StephaneLenclud@50
  1529
    more than one field in a report.
StephaneLenclud@50
  1530
StephaneLenclud@50
  1531
    NOTE: This function currently does not support value arrays where the
StephaneLenclud@50
  1532
          ReportSize for each of the fields in the array is not a multiple
StephaneLenclud@50
  1533
          of 8 bits.
StephaneLenclud@50
  1534
StephaneLenclud@50
  1535
          The UsageValue buffer will have the raw values as they are set
StephaneLenclud@50
  1536
          in the report packet.
StephaneLenclud@50
  1537
StephaneLenclud@50
  1538
Parameters:
StephaneLenclud@50
  1539
StephaneLenclud@50
  1540
    ReportType  One of HidP_Input, HidP_Output or HidP_Feature.
StephaneLenclud@50
  1541
StephaneLenclud@50
  1542
    UsagePage   The usage page to which the given usage refers.
StephaneLenclud@50
  1543
StephaneLenclud@50
  1544
    LinkCollection  (Optional)  This value can be used to differentiate
StephaneLenclud@50
  1545
                                between two fields that may have the same
StephaneLenclud@50
  1546
                                UsagePage and Usage but exist in different
StephaneLenclud@50
  1547
                                collections.  If the link collection value
StephaneLenclud@50
  1548
                                is zero, this function will set the first field
StephaneLenclud@50
  1549
                                it finds that matches the usage page and
StephaneLenclud@50
  1550
                                usage.
StephaneLenclud@50
  1551
StephaneLenclud@50
  1552
   Usage       The usage whose value HidP_GetUsageValueArray will retreive.
StephaneLenclud@50
  1553
StephaneLenclud@50
  1554
   UsageValue  A pointer to an array of characters where the value will be
StephaneLenclud@50
  1555
               placed.  The number of BITS required is found by multiplying the
StephaneLenclud@50
  1556
               BitSize and ReportCount fields of the Value Cap for this
StephaneLenclud@50
  1557
               control.  The least significant bit of this control found in the
StephaneLenclud@50
  1558
               given report will be placed in the least significant bit location
StephaneLenclud@50
  1559
               of the buffer (little-endian format), regardless of whether
StephaneLenclud@50
  1560
               or not the field is byte aligned or if the BitSize is a multiple
StephaneLenclud@50
  1561
               of sizeof (CHAR).
StephaneLenclud@50
  1562
StephaneLenclud@50
  1563
               See note above about current implementation limitations
StephaneLenclud@50
  1564
StephaneLenclud@50
  1565
   UsageValueByteLength
StephaneLenclud@50
  1566
               the length of the given UsageValue buffer.
StephaneLenclud@50
  1567
StephaneLenclud@50
  1568
   PreparsedData The preparsed data returned by the HIDCLASS
StephaneLenclud@50
  1569
StephaneLenclud@50
  1570
   Report      The report packet.
StephaneLenclud@50
  1571
StephaneLenclud@50
  1572
   ReportLength   Length of the given report packet.
StephaneLenclud@50
  1573
StephaneLenclud@50
  1574
Return Value:
StephaneLenclud@50
  1575
StephaneLenclud@50
  1576
  HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
StephaneLenclud@50
  1577
                                        from the report packet
StephaneLenclud@50
  1578
  HIDP_STATUS_INVALID_REPORT_TYPE    -- if ReportType is not valid.
StephaneLenclud@50
  1579
  HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
StephaneLenclud@50
  1580
  HIDP_STATUS_INVALID_REPORT_LENGTH  -- the length of the report packet is not
StephaneLenclud@50
  1581
                                        equal to the length specified in
StephaneLenclud@50
  1582
                                        the HIDP_CAPS structure for the given
StephaneLenclud@50
  1583
                                        ReportType
StephaneLenclud@50
  1584
  HIDP_STATUS_NOT_VALUE_ARRAY        -- if the control specified is not a
StephaneLenclud@50
  1585
                                        value array -- a value array will have
StephaneLenclud@50
  1586
                                        a ReportCount field in the
StephaneLenclud@50
  1587
                                        HIDP_VALUE_CAPS structure that is > 1
StephaneLenclud@50
  1588
                                        Use HidP_GetUsageValue instead
StephaneLenclud@50
  1589
  HIDP_STATUS_BUFFER_TOO_SMALL       -- if the size of the passed in buffer in
StephaneLenclud@50
  1590
                                        which to return the array is too small
StephaneLenclud@50
  1591
                                        (ie. has fewer values than the number of
StephaneLenclud@50
  1592
                                        fields in the array
StephaneLenclud@50
  1593
  HIDP_STATUS_NOT_IMPLEMENTED        -- if the usage value array has field sizes
StephaneLenclud@50
  1594
                                        that are not multiples of 8 bits, this
StephaneLenclud@50
  1595
                                        error code is returned since the function
StephaneLenclud@50
  1596
                                        currently does not handle getting values
StephaneLenclud@50
  1597
                                        from such arrays.
StephaneLenclud@50
  1598
  HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
StephaneLenclud@50
  1599
                                        link collection exist but exists in
StephaneLenclud@50
  1600
                                        a report with a different report ID
StephaneLenclud@50
  1601
                                        than the report being passed in.  To
StephaneLenclud@50
  1602
                                        set this value, call
StephaneLenclud@50
  1603
                                        HidP_GetUsageValueArray with a
StephaneLenclud@50
  1604
                                        different report packet
StephaneLenclud@50
  1605
  HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
StephaneLenclud@50
  1606
                                        collection combination does not exist
StephaneLenclud@50
  1607
                                        in any reports for this ReportType
StephaneLenclud@50
  1608
--*/
StephaneLenclud@50
  1609
StephaneLenclud@50
  1610
StephaneLenclud@50
  1611
_IRQL_requires_max_(PASSIVE_LEVEL)
StephaneLenclud@50
  1612
NTSTATUS __stdcall
StephaneLenclud@50
  1613
HidP_UsageListDifference (
StephaneLenclud@50
  1614
   reads_(UsageListLength) PUSAGE  PreviousUsageList,
StephaneLenclud@50
  1615
   reads_(UsageListLength) PUSAGE  CurrentUsageList,
StephaneLenclud@50
  1616
   writes_(UsageListLength) PUSAGE  BreakUsageList,
StephaneLenclud@50
  1617
   writes_(UsageListLength) PUSAGE  MakeUsageList,
StephaneLenclud@50
  1618
    ULONG    UsageListLength
StephaneLenclud@50
  1619
    );
StephaneLenclud@50
  1620
/*++
StephaneLenclud@50
  1621
Routine Description:
StephaneLenclud@50
  1622
    This function will return the difference between a two lists of usages
StephaneLenclud@50
  1623
    (as might be returned from HidP_GetUsages),  In other words, it will return
StephaneLenclud@50
  1624
    return a list of usages that are in the current list but not the previous
StephaneLenclud@50
  1625
    list as well as a list of usages that are in the previous list but not
StephaneLenclud@50
  1626
    the current list.
StephaneLenclud@50
  1627
StephaneLenclud@50
  1628
Parameters:
StephaneLenclud@50
  1629
StephaneLenclud@50
  1630
    PreviousUsageList   The list of usages before.
StephaneLenclud@50
  1631
    CurrentUsageList    The list of usages now.
StephaneLenclud@50
  1632
    BreakUsageList      Previous - Current.
StephaneLenclud@50
  1633
    MakeUsageList       Current - Previous.
StephaneLenclud@50
  1634
    UsageListLength     Represents the length of the usage lists in array
StephaneLenclud@50
  1635
                        elements.  If comparing two lists with a differing
StephaneLenclud@50
  1636
                        number of array elements, this value should be
StephaneLenclud@50
  1637
                        the size of the larger of the two lists.  Any
StephaneLenclud@50
  1638
                        zero found with a list indicates an early termination
StephaneLenclud@50
  1639
                        of the list and any usages found after the first zero
StephaneLenclud@50
  1640
                        will be ignored.
StephaneLenclud@50
  1641
--*/
StephaneLenclud@50
  1642
StephaneLenclud@50
  1643
StephaneLenclud@50
  1644
_IRQL_requires_max_(PASSIVE_LEVEL)
StephaneLenclud@50
  1645
NTSTATUS __stdcall
StephaneLenclud@50
  1646
HidP_UsageAndPageListDifference (
StephaneLenclud@50
  1647
   reads_(UsageListLength) PUSAGE_AND_PAGE PreviousUsageList,
StephaneLenclud@50
  1648
   reads_(UsageListLength) PUSAGE_AND_PAGE CurrentUsageList,
StephaneLenclud@50
  1649
   writes_(UsageListLength) PUSAGE_AND_PAGE BreakUsageList,
StephaneLenclud@50
  1650
   writes_(UsageListLength) PUSAGE_AND_PAGE MakeUsageList,
StephaneLenclud@50
  1651
    ULONG           UsageListLength
StephaneLenclud@50
  1652
   );
StephaneLenclud@50
  1653
StephaneLenclud@50
  1654
//
StephaneLenclud@50
  1655
// Produce Make or Break Codes
StephaneLenclud@50
  1656
//
StephaneLenclud@50
  1657
typedef enum _HIDP_KEYBOARD_DIRECTION {
StephaneLenclud@50
  1658
    HidP_Keyboard_Break,
StephaneLenclud@50
  1659
    HidP_Keyboard_Make
StephaneLenclud@50
  1660
} HIDP_KEYBOARD_DIRECTION;
StephaneLenclud@50
  1661
StephaneLenclud@50
  1662
//
StephaneLenclud@50
  1663
// A bitmap of the current shift state of the keyboard when using the
StephaneLenclud@50
  1664
// below keyboard usages to i8042 translation function.
StephaneLenclud@50
  1665
//
StephaneLenclud@50
  1666
typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
StephaneLenclud@50
  1667
   union {
StephaneLenclud@50
  1668
      struct {
StephaneLenclud@50
  1669
         ULONG LeftControl: 1;
StephaneLenclud@50
  1670
         ULONG LeftShift: 1;
StephaneLenclud@50
  1671
         ULONG LeftAlt: 1;
StephaneLenclud@50
  1672
         ULONG LeftGUI: 1;
StephaneLenclud@50
  1673
         ULONG RightControl: 1;
StephaneLenclud@50
  1674
         ULONG RightShift: 1;
StephaneLenclud@50
  1675
         ULONG RightAlt: 1;
StephaneLenclud@50
  1676
         ULONG RigthGUI: 1;
StephaneLenclud@50
  1677
         ULONG CapsLock: 1;
StephaneLenclud@50
  1678
         ULONG ScollLock: 1;
StephaneLenclud@50
  1679
         ULONG NumLock: 1;
StephaneLenclud@50
  1680
         ULONG Reserved: 21;
StephaneLenclud@50
  1681
      };
StephaneLenclud@50
  1682
      ULONG ul;
StephaneLenclud@50
  1683
   };
StephaneLenclud@50
  1684
StephaneLenclud@50
  1685
} HIDP_KEYBOARD_MODIFIER_STATE, * PHIDP_KEYBOARD_MODIFIER_STATE;
StephaneLenclud@50
  1686
StephaneLenclud@50
  1687
//
StephaneLenclud@50
  1688
// A call back function to give the i8042 scan codes to the caller of
StephaneLenclud@50
  1689
// the below translation function.
StephaneLenclud@50
  1690
//
StephaneLenclud@50
  1691
typedef BOOLEAN (* PHIDP_INSERT_SCANCODES) (
StephaneLenclud@50
  1692
                   PVOID Context,  // Some caller supplied context.
StephaneLenclud@50
  1693
                  reads_bytes_(Length) PCHAR NewScanCodes, // A list of i8042 scan codes.
StephaneLenclud@50
  1694
                   ULONG Length // the length of the scan codes.
StephaneLenclud@50
  1695
                  );
StephaneLenclud@50
  1696
StephaneLenclud@50
  1697
StephaneLenclud@50
  1698
NTSTATUS __stdcall
StephaneLenclud@50
  1699
HidP_TranslateUsageAndPagesToI8042ScanCodes (
StephaneLenclud@50
  1700
    reads_(UsageListLength)     PUSAGE_AND_PAGE ChangedUsageList,
StephaneLenclud@50
  1701
         ULONG                         UsageListLength,
StephaneLenclud@50
  1702
         HIDP_KEYBOARD_DIRECTION       KeyAction,
StephaneLenclud@50
  1703
      PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
StephaneLenclud@50
  1704
         PHIDP_INSERT_SCANCODES        InsertCodesProcedure,
StephaneLenclud@50
  1705
     PVOID                         InsertCodesContext
StephaneLenclud@50
  1706
    );
StephaneLenclud@50
  1707
/*++
StephaneLenclud@50
  1708
Routine Description:
StephaneLenclud@50
  1709
Parameters:
StephaneLenclud@50
  1710
--*/
StephaneLenclud@50
  1711
StephaneLenclud@50
  1712
NTSTATUS __stdcall
StephaneLenclud@50
  1713
HidP_TranslateUsagesToI8042ScanCodes (
StephaneLenclud@50
  1714
    reads_(UsageListLength)     PUSAGE ChangedUsageList,
StephaneLenclud@50
  1715
         ULONG                         UsageListLength,
StephaneLenclud@50
  1716
         HIDP_KEYBOARD_DIRECTION       KeyAction,
StephaneLenclud@50
  1717
      PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
StephaneLenclud@50
  1718
         PHIDP_INSERT_SCANCODES        InsertCodesProcedure,
StephaneLenclud@50
  1719
     PVOID                         InsertCodesContext
StephaneLenclud@50
  1720
    );
StephaneLenclud@50
  1721
/*++
StephaneLenclud@50
  1722
Routine Description:
StephaneLenclud@50
  1723
Parameters:
StephaneLenclud@50
  1724
--*/
StephaneLenclud@50
  1725
StephaneLenclud@50
  1726
StephaneLenclud@50
  1727
StephaneLenclud@50
  1728
//
StephaneLenclud@50
  1729
// Define NT Status codes with Facility Code of FACILITY_HID_ERROR_CODE
StephaneLenclud@50
  1730
//
StephaneLenclud@50
  1731
StephaneLenclud@50
  1732
// FACILITY_HID_ERROR_CODE defined in ntstatus.h
StephaneLenclud@50
  1733
#ifndef FACILITY_HID_ERROR_CODE
StephaneLenclud@50
  1734
#define FACILITY_HID_ERROR_CODE 0x11
StephaneLenclud@50
  1735
#endif
StephaneLenclud@50
  1736
StephaneLenclud@50
  1737
#define HIDP_ERROR_CODES(SEV, CODE) \
StephaneLenclud@50
  1738
        ((NTSTATUS) (((SEV) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (CODE)))
StephaneLenclud@50
  1739
StephaneLenclud@50
  1740
#define HIDP_STATUS_SUCCESS                  (HIDP_ERROR_CODES(0x0,0))
StephaneLenclud@50
  1741
#define HIDP_STATUS_NULL                     (HIDP_ERROR_CODES(0x8,1))
StephaneLenclud@50
  1742
#define HIDP_STATUS_INVALID_PREPARSED_DATA   (HIDP_ERROR_CODES(0xC,1))
StephaneLenclud@50
  1743
#define HIDP_STATUS_INVALID_REPORT_TYPE      (HIDP_ERROR_CODES(0xC,2))
StephaneLenclud@50
  1744
#define HIDP_STATUS_INVALID_REPORT_LENGTH    (HIDP_ERROR_CODES(0xC,3))
StephaneLenclud@50
  1745
#define HIDP_STATUS_USAGE_NOT_FOUND          (HIDP_ERROR_CODES(0xC,4))
StephaneLenclud@50
  1746
#define HIDP_STATUS_VALUEOF_RANGE       (HIDP_ERROR_CODES(0xC,5))
StephaneLenclud@50
  1747
#define HIDP_STATUS_BAD_LOG_PHY_VALUES       (HIDP_ERROR_CODES(0xC,6))
StephaneLenclud@50
  1748
#define HIDP_STATUS_BUFFER_TOO_SMALL         (HIDP_ERROR_CODES(0xC,7))
StephaneLenclud@50
  1749
#define HIDP_STATUS_INTERNAL_ERROR           (HIDP_ERROR_CODES(0xC,8))
StephaneLenclud@50
  1750
#define HIDP_STATUS_I8042_TRANS_UNKNOWN      (HIDP_ERROR_CODES(0xC,9))
StephaneLenclud@50
  1751
#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID   (HIDP_ERROR_CODES(0xC,0xA))
StephaneLenclud@50
  1752
#define HIDP_STATUS_NOT_VALUE_ARRAY          (HIDP_ERROR_CODES(0xC,0xB))
StephaneLenclud@50
  1753
#define HIDP_STATUS_IS_VALUE_ARRAY           (HIDP_ERROR_CODES(0xC,0xC))
StephaneLenclud@50
  1754
#define HIDP_STATUS_DATA_INDEX_NOT_FOUND     (HIDP_ERROR_CODES(0xC,0xD))
StephaneLenclud@50
  1755
#define HIDP_STATUS_DATA_INDEXOF_RANGE  (HIDP_ERROR_CODES(0xC,0xE))
StephaneLenclud@50
  1756
#define HIDP_STATUS_BUTTON_NOT_PRESSED       (HIDP_ERROR_CODES(0xC,0xF))
StephaneLenclud@50
  1757
#define HIDP_STATUS_REPORT_DOES_NOT_EXIST    (HIDP_ERROR_CODES(0xC,0x10))
StephaneLenclud@50
  1758
#define HIDP_STATUS_NOT_IMPLEMENTED          (HIDP_ERROR_CODES(0xC,0x20))
StephaneLenclud@50
  1759
StephaneLenclud@50
  1760
//
StephaneLenclud@50
  1761
// We blundered this status code.
StephaneLenclud@50
  1762
//
StephaneLenclud@50
  1763
#define HIDP_STATUS_I8242_TRANS_UNKNOWN HIDP_STATUS_I8042_TRANS_UNKNOWN
StephaneLenclud@50
  1764
StephaneLenclud@50
  1765
/*++
StephaneLenclud@50
  1766
StephaneLenclud@50
  1767
Copyright (c) Microsoft Corporation. All rights reserved.
StephaneLenclud@50
  1768
StephaneLenclud@50
  1769
Module Name:
StephaneLenclud@50
  1770
StephaneLenclud@50
  1771
    HIDSDI.H
StephaneLenclud@50
  1772
StephaneLenclud@50
  1773
Abstract:
StephaneLenclud@50
  1774
StephaneLenclud@50
  1775
    This module contains the PUBLIC definitions for the
StephaneLenclud@50
  1776
    code that implements the HID dll.
StephaneLenclud@50
  1777
StephaneLenclud@50
  1778
Environment:
StephaneLenclud@50
  1779
StephaneLenclud@50
  1780
    Kernel & user mode
StephaneLenclud@50
  1781
StephaneLenclud@50
  1782
--*/
StephaneLenclud@50
  1783
StephaneLenclud@50
  1784
StephaneLenclud@50
  1785
StephaneLenclud@50
  1786
StephaneLenclud@50
  1787
typedef struct _HIDD_CONFIGURATION {
StephaneLenclud@50
  1788
    PVOID    cookie;
StephaneLenclud@50
  1789
    ULONG    size;
StephaneLenclud@50
  1790
    ULONG    RingBufferSize;
StephaneLenclud@50
  1791
} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION;
StephaneLenclud@50
  1792
StephaneLenclud@50
  1793
typedef struct _HIDD_ATTRIBUTES {
StephaneLenclud@50
  1794
    ULONG   Size; // = sizeof (struct _HIDD_ATTRIBUTES)
StephaneLenclud@50
  1795
StephaneLenclud@50
  1796
    //
StephaneLenclud@50
  1797
    // Vendor ids of this hid device
StephaneLenclud@50
  1798
    //
StephaneLenclud@50
  1799
    USHORT  VendorID;
StephaneLenclud@50
  1800
    USHORT  ProductID;
StephaneLenclud@50
  1801
    USHORT  VersionNumber;
StephaneLenclud@50
  1802
StephaneLenclud@50
  1803
    //
StephaneLenclud@50
  1804
    // Additional fields will be added to the end of this structure.
StephaneLenclud@50
  1805
    //
StephaneLenclud@50
  1806
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
StephaneLenclud@50
  1807
StephaneLenclud@50
  1808
StephaneLenclud@50
  1809
BOOLEAN __stdcall
StephaneLenclud@50
  1810
HidD_GetAttributes (
StephaneLenclud@50
  1811
      HANDLE              HidDeviceObject,
StephaneLenclud@50
  1812
     PHIDD_ATTRIBUTES    Attributes
StephaneLenclud@50
  1813
    );
StephaneLenclud@50
  1814
/*++
StephaneLenclud@50
  1815
Routine Description:
StephaneLenclud@50
  1816
    Fill in the given HIDD_ATTRIBUTES structure with the attributes of the
StephaneLenclud@50
  1817
    given hid device.
StephaneLenclud@50
  1818
StephaneLenclud@50
  1819
--*/
StephaneLenclud@50
  1820
StephaneLenclud@50
  1821
StephaneLenclud@50
  1822
void __stdcall
StephaneLenclud@50
  1823
HidD_GetHidGuid (
StephaneLenclud@50
  1824
     LPGUID   HidGuid
StephaneLenclud@50
  1825
   );
StephaneLenclud@50
  1826
StephaneLenclud@50
  1827
StephaneLenclud@50
  1828
BOOLEAN __stdcall
StephaneLenclud@50
  1829
HidD_GetPreparsedData (
StephaneLenclud@50
  1830
      HANDLE                  HidDeviceObject,
StephaneLenclud@50
  1831
    PHIDP_PREPARSED_DATA  * PreparsedData
StephaneLenclud@50
  1832
   );
StephaneLenclud@50
  1833
/*++
StephaneLenclud@50
  1834
Routine Description:
StephaneLenclud@50
  1835
    Given a handle to a valid Hid Class Device Object, retrieve the preparsed
StephaneLenclud@50
  1836
    data for the device.  This routine will allocate the appropriately 
StephaneLenclud@50
  1837
    sized buffer to hold this preparsed data.  It is up to client to call
StephaneLenclud@50
  1838
    HidP_FreePreparsedData to free the memory allocated to this structure when
StephaneLenclud@50
  1839
    it is no longer needed.
StephaneLenclud@50
  1840
StephaneLenclud@50
  1841
Arguments:
StephaneLenclud@50
  1842
   HidDeviceObject A handle to a Hid Device that the client obtains using 
StephaneLenclud@50
  1843
                   a call to CreateFile on a valid Hid device string name.
StephaneLenclud@50
  1844
                   The string name can be obtained using standard PnP calls.
StephaneLenclud@50
  1845
StephaneLenclud@50
  1846
   PreparsedData   An opaque data structure used by other functions in this 
StephaneLenclud@50
  1847
                   library to retrieve information about a given device.
StephaneLenclud@50
  1848
StephaneLenclud@50
  1849
Return Value:
StephaneLenclud@50
  1850
   TRUE if successful.
StephaneLenclud@50
  1851
   FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1852
--*/
StephaneLenclud@50
  1853
BOOLEAN __stdcall
StephaneLenclud@50
  1854
HidD_FreePreparsedData (
StephaneLenclud@50
  1855
    __drv_freesMem(Mem) PHIDP_PREPARSED_DATA PreparsedData
StephaneLenclud@50
  1856
   );
StephaneLenclud@50
  1857
StephaneLenclud@50
  1858
BOOLEAN __stdcall
StephaneLenclud@50
  1859
HidD_FlushQueue (
StephaneLenclud@50
  1860
       HANDLE                HidDeviceObject
StephaneLenclud@50
  1861
   );
StephaneLenclud@50
  1862
/*++
StephaneLenclud@50
  1863
Routine Description:
StephaneLenclud@50
  1864
    Flush the input queue for the given HID device.
StephaneLenclud@50
  1865
StephaneLenclud@50
  1866
Arguments:
StephaneLenclud@50
  1867
   HidDeviceObject A handle to a Hid Device that the client obtains using 
StephaneLenclud@50
  1868
                   a call to CreateFile on a valid Hid device string name.
StephaneLenclud@50
  1869
                   The string name can be obtained using standard PnP calls.
StephaneLenclud@50
  1870
StephaneLenclud@50
  1871
Return Value:
StephaneLenclud@50
  1872
   TRUE if successful
StephaneLenclud@50
  1873
   FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1874
--*/
StephaneLenclud@50
  1875
StephaneLenclud@50
  1876
BOOLEAN __stdcall
StephaneLenclud@50
  1877
HidD_GetConfiguration (
StephaneLenclud@50
  1878
      HANDLE               HidDeviceObject,
StephaneLenclud@50
  1879
   PHIDD_CONFIGURATION Configuration,
StephaneLenclud@50
  1880
      ULONG                ConfigurationLength
StephaneLenclud@50
  1881
   );
StephaneLenclud@50
  1882
/*++
StephaneLenclud@50
  1883
Routine Description:
StephaneLenclud@50
  1884
    Get the configuration information for this Hid device
StephaneLenclud@50
  1885
StephaneLenclud@50
  1886
Arguments:
StephaneLenclud@50
  1887
   HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  1888
StephaneLenclud@50
  1889
   Configuration        A configuration structure.  HidD_GetConfiguration MUST
StephaneLenclud@50
  1890
                        be called before the configuration can be modified and
StephaneLenclud@50
  1891
                        set using HidD_SetConfiguration
StephaneLenclud@50
  1892
StephaneLenclud@50
  1893
   ConfigurationLength  That is ``sizeof (HIDD_CONFIGURATION)''. Using this
StephaneLenclud@50
  1894
                        parameter, we can later increase the length of the 
StephaneLenclud@50
  1895
                        configuration array and not break older apps.
StephaneLenclud@50
  1896
StephaneLenclud@50
  1897
Return Value:
StephaneLenclud@50
  1898
   TRUE if successful
StephaneLenclud@50
  1899
   FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1900
--*/
StephaneLenclud@50
  1901
StephaneLenclud@50
  1902
BOOLEAN __stdcall
StephaneLenclud@50
  1903
HidD_SetConfiguration (
StephaneLenclud@50
  1904
      HANDLE               HidDeviceObject,
StephaneLenclud@50
  1905
   reads_bytes_(ConfigurationLength) PHIDD_CONFIGURATION Configuration,
StephaneLenclud@50
  1906
      ULONG                ConfigurationLength
StephaneLenclud@50
  1907
   );
StephaneLenclud@50
  1908
/*++
StephaneLenclud@50
  1909
Routine Description:
StephaneLenclud@50
  1910
   Set the configuration information for this Hid device...
StephaneLenclud@50
  1911
   
StephaneLenclud@50
  1912
   NOTE: HidD_GetConfiguration must be called to retrieve the current 
StephaneLenclud@50
  1913
         configuration information before this information can be modified 
StephaneLenclud@50
  1914
         and set.
StephaneLenclud@50
  1915
StephaneLenclud@50
  1916
Arguments:
StephaneLenclud@50
  1917
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  1918
 
StephaneLenclud@50
  1919
    Configuration        A configuration structure.  HidD_GetConfiguration MUST
StephaneLenclud@50
  1920
                         be called before the configuration can be modified and
StephaneLenclud@50
  1921
                         set using HidD_SetConfiguration
StephaneLenclud@50
  1922
 
StephaneLenclud@50
  1923
    ConfigurationLength  That is ``sizeof (HIDD_CONFIGURATION)''. Using this
StephaneLenclud@50
  1924
                         parameter, we can later increase the length of the 
StephaneLenclud@50
  1925
                         configuration array and not break older apps.
StephaneLenclud@50
  1926
StephaneLenclud@50
  1927
Return Value:
StephaneLenclud@50
  1928
    TRUE if successful
StephaneLenclud@50
  1929
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1930
--*/
StephaneLenclud@50
  1931
StephaneLenclud@50
  1932
BOOLEAN __stdcall
StephaneLenclud@50
  1933
HidD_GetFeature (
StephaneLenclud@50
  1934
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  1935
   PVOID ReportBuffer,
StephaneLenclud@50
  1936
       ULONG    ReportBufferLength
StephaneLenclud@50
  1937
   );
StephaneLenclud@50
  1938
/*++
StephaneLenclud@50
  1939
Routine Description:
StephaneLenclud@50
  1940
    Retrieve a feature report from a HID device.
StephaneLenclud@50
  1941
StephaneLenclud@50
  1942
Arguments:
StephaneLenclud@50
  1943
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  1944
 
StephaneLenclud@50
  1945
    ReportBuffer         The buffer that the feature report should be placed 
StephaneLenclud@50
  1946
                         into.  The first byte of the buffer should be set to
StephaneLenclud@50
  1947
                         the report ID of the desired report
StephaneLenclud@50
  1948
 
StephaneLenclud@50
  1949
    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
StephaneLenclud@50
  1950
                         should be greater than or equal to the 
StephaneLenclud@50
  1951
                         FeatureReportByteLength field as specified in the 
StephaneLenclud@50
  1952
                         HIDP_CAPS structure for the device
StephaneLenclud@50
  1953
Return Value:
StephaneLenclud@50
  1954
    TRUE if successful
StephaneLenclud@50
  1955
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1956
--*/
StephaneLenclud@50
  1957
StephaneLenclud@50
  1958
BOOLEAN __stdcall
StephaneLenclud@50
  1959
HidD_SetFeature (
StephaneLenclud@50
  1960
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  1961
   reads_bytes_(ReportBufferLength) PVOID ReportBuffer,
StephaneLenclud@50
  1962
       ULONG    ReportBufferLength
StephaneLenclud@50
  1963
   );
StephaneLenclud@50
  1964
/*++
StephaneLenclud@50
  1965
Routine Description:
StephaneLenclud@50
  1966
    Send a feature report to a HID device.
StephaneLenclud@50
  1967
StephaneLenclud@50
  1968
Arguments:
StephaneLenclud@50
  1969
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  1970
 
StephaneLenclud@50
  1971
    ReportBuffer         The buffer of the feature report to send to the device
StephaneLenclud@50
  1972
 
StephaneLenclud@50
  1973
    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
StephaneLenclud@50
  1974
                         should be greater than or equal to the 
StephaneLenclud@50
  1975
                         FeatureReportByteLength field as specified in the 
StephaneLenclud@50
  1976
                         HIDP_CAPS structure for the device
StephaneLenclud@50
  1977
Return Value:
StephaneLenclud@50
  1978
    TRUE if successful
StephaneLenclud@50
  1979
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  1980
--*/
StephaneLenclud@50
  1981
StephaneLenclud@50
  1982
StephaneLenclud@50
  1983
StephaneLenclud@50
  1984
BOOLEAN __stdcall
StephaneLenclud@50
  1985
HidD_GetInputReport (
StephaneLenclud@50
  1986
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  1987
   PVOID ReportBuffer,
StephaneLenclud@50
  1988
       ULONG    ReportBufferLength
StephaneLenclud@50
  1989
   );
StephaneLenclud@50
  1990
/*++
StephaneLenclud@50
  1991
Routine Description:
StephaneLenclud@50
  1992
    Retrieve an input report from a HID device.
StephaneLenclud@50
  1993
StephaneLenclud@50
  1994
Arguments:
StephaneLenclud@50
  1995
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  1996
 
StephaneLenclud@50
  1997
    ReportBuffer         The buffer that the input report should be placed 
StephaneLenclud@50
  1998
                         into.  The first byte of the buffer should be set to
StephaneLenclud@50
  1999
                         the report ID of the desired report
StephaneLenclud@50
  2000
 
StephaneLenclud@50
  2001
    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
StephaneLenclud@50
  2002
                         should be greater than or equal to the 
StephaneLenclud@50
  2003
                         InputReportByteLength field as specified in the 
StephaneLenclud@50
  2004
                         HIDP_CAPS structure for the device
StephaneLenclud@50
  2005
Return Value:
StephaneLenclud@50
  2006
    TRUE if successful
StephaneLenclud@50
  2007
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2008
--*/
StephaneLenclud@50
  2009
StephaneLenclud@50
  2010
BOOLEAN __stdcall
StephaneLenclud@50
  2011
HidD_SetOutputReport (
StephaneLenclud@50
  2012
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2013
   reads_bytes_(ReportBufferLength) PVOID ReportBuffer,
StephaneLenclud@50
  2014
       ULONG    ReportBufferLength
StephaneLenclud@50
  2015
   );
StephaneLenclud@50
  2016
/*++
StephaneLenclud@50
  2017
Routine Description:
StephaneLenclud@50
  2018
    Send an output report to a HID device.
StephaneLenclud@50
  2019
StephaneLenclud@50
  2020
Arguments:
StephaneLenclud@50
  2021
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2022
 
StephaneLenclud@50
  2023
    ReportBuffer         The buffer of the output report to send to the device
StephaneLenclud@50
  2024
 
StephaneLenclud@50
  2025
    ReportBufferLength   The size (in bytes) of ReportBuffer.  This value 
StephaneLenclud@50
  2026
                         should be greater than or equal to the 
StephaneLenclud@50
  2027
                         OutputReportByteLength field as specified in the 
StephaneLenclud@50
  2028
                         HIDP_CAPS structure for the device
StephaneLenclud@50
  2029
Return Value:
StephaneLenclud@50
  2030
    TRUE if successful
StephaneLenclud@50
  2031
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2032
--*/
StephaneLenclud@50
  2033
StephaneLenclud@50
  2034
#endif
StephaneLenclud@50
  2035
StephaneLenclud@50
  2036
BOOLEAN __stdcall
StephaneLenclud@50
  2037
HidD_GetNumInputBuffers (
StephaneLenclud@50
  2038
      HANDLE  HidDeviceObject,
StephaneLenclud@50
  2039
     PULONG  NumberBuffers
StephaneLenclud@50
  2040
    );
StephaneLenclud@50
  2041
/*++
StephaneLenclud@50
  2042
Routine Description:
StephaneLenclud@50
  2043
    This function returns the number of input buffers used by the specified
StephaneLenclud@50
  2044
    file handle to the Hid device.  Each file object has a number of buffers
StephaneLenclud@50
  2045
    associated with it to queue reports read from the device but which have
StephaneLenclud@50
  2046
    not yet been read by the user-mode app with a handle to that device.
StephaneLenclud@50
  2047
StephaneLenclud@50
  2048
Arguments:
StephaneLenclud@50
  2049
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2050
 
StephaneLenclud@50
  2051
    NumberBuffers        Number of buffers currently being used for this file
StephaneLenclud@50
  2052
                         handle to the Hid device
StephaneLenclud@50
  2053
StephaneLenclud@50
  2054
Return Value:
StephaneLenclud@50
  2055
    TRUE if successful
StephaneLenclud@50
  2056
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2057
--*/
StephaneLenclud@50
  2058
StephaneLenclud@50
  2059
BOOLEAN __stdcall
StephaneLenclud@50
  2060
HidD_SetNumInputBuffers (
StephaneLenclud@50
  2061
     HANDLE HidDeviceObject,
StephaneLenclud@50
  2062
     ULONG  NumberBuffers
StephaneLenclud@50
  2063
    );
StephaneLenclud@50
  2064
/*++
StephaneLenclud@50
  2065
StephaneLenclud@50
  2066
Routine Description:
StephaneLenclud@50
  2067
    This function sets the number of input buffers used by the specified
StephaneLenclud@50
  2068
    file handle to the Hid device.  Each file object has a number of buffers
StephaneLenclud@50
  2069
    associated with it to queue reports read from the device but which have
StephaneLenclud@50
  2070
    not yet been read by the user-mode app with a handle to that device.
StephaneLenclud@50
  2071
StephaneLenclud@50
  2072
Arguments:
StephaneLenclud@50
  2073
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2074
 
StephaneLenclud@50
  2075
    NumberBuffers        New number of buffers to use for this file handle to
StephaneLenclud@50
  2076
                         the Hid device
StephaneLenclud@50
  2077
StephaneLenclud@50
  2078
Return Value:
StephaneLenclud@50
  2079
    TRUE if successful
StephaneLenclud@50
  2080
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2081
--*/
StephaneLenclud@50
  2082
StephaneLenclud@50
  2083
BOOLEAN __stdcall
StephaneLenclud@50
  2084
HidD_GetPhysicalDescriptor (
StephaneLenclud@50
  2085
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2086
   PVOID Buffer,
StephaneLenclud@50
  2087
       ULONG    BufferLength
StephaneLenclud@50
  2088
   );
StephaneLenclud@50
  2089
/*++
StephaneLenclud@50
  2090
Routine Description:
StephaneLenclud@50
  2091
    This function retrieves the raw physical descriptor for the specified
StephaneLenclud@50
  2092
    Hid device.  
StephaneLenclud@50
  2093
StephaneLenclud@50
  2094
Arguments:
StephaneLenclud@50
  2095
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2096
 
StephaneLenclud@50
  2097
    Buffer               Buffer which on return will contain the physical
StephaneLenclud@50
  2098
                         descriptor if one exists for the specified device
StephaneLenclud@50
  2099
                         handle
StephaneLenclud@50
  2100
StephaneLenclud@50
  2101
    BufferLength         Length of buffer (in bytes)
StephaneLenclud@50
  2102
StephaneLenclud@50
  2103
StephaneLenclud@50
  2104
Return Value:
StephaneLenclud@50
  2105
    TRUE if successful
StephaneLenclud@50
  2106
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2107
--*/
StephaneLenclud@50
  2108
StephaneLenclud@50
  2109
BOOLEAN __stdcall
StephaneLenclud@50
  2110
HidD_GetManufacturerString (
StephaneLenclud@50
  2111
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2112
   PVOID Buffer,
StephaneLenclud@50
  2113
       ULONG    BufferLength
StephaneLenclud@50
  2114
   );
StephaneLenclud@50
  2115
/*++
StephaneLenclud@50
  2116
Routine Description:
StephaneLenclud@50
  2117
    This function retrieves the manufacturer string from the specified 
StephaneLenclud@50
  2118
    Hid device.  
StephaneLenclud@50
  2119
StephaneLenclud@50
  2120
Arguments:
StephaneLenclud@50
  2121
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2122
 
StephaneLenclud@50
  2123
    Buffer               Buffer which on return will contain the manufacturer
StephaneLenclud@50
  2124
                         string returned from the device.  This string is a 
StephaneLenclud@50
  2125
                         wide-character string
StephaneLenclud@50
  2126
StephaneLenclud@50
  2127
    BufferLength         Length of Buffer (in bytes)
StephaneLenclud@50
  2128
StephaneLenclud@50
  2129
StephaneLenclud@50
  2130
Return Value:
StephaneLenclud@50
  2131
    TRUE if successful
StephaneLenclud@50
  2132
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2133
--*/
StephaneLenclud@50
  2134
StephaneLenclud@50
  2135
BOOLEAN __stdcall
StephaneLenclud@50
  2136
HidD_GetProductString (
StephaneLenclud@50
  2137
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2138
   PVOID Buffer,
StephaneLenclud@50
  2139
       ULONG    BufferLength
StephaneLenclud@50
  2140
   );
StephaneLenclud@50
  2141
/*++
StephaneLenclud@50
  2142
Routine Description:
StephaneLenclud@50
  2143
    This function retrieves the product string from the specified 
StephaneLenclud@50
  2144
    Hid device.  
StephaneLenclud@50
  2145
StephaneLenclud@50
  2146
Arguments:
StephaneLenclud@50
  2147
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2148
 
StephaneLenclud@50
  2149
    Buffer               Buffer which on return will contain the product
StephaneLenclud@50
  2150
                         string returned from the device.  This string is a 
StephaneLenclud@50
  2151
                         wide-character string
StephaneLenclud@50
  2152
StephaneLenclud@50
  2153
    BufferLength         Length of Buffer (in bytes)
StephaneLenclud@50
  2154
StephaneLenclud@50
  2155
StephaneLenclud@50
  2156
Return Value:
StephaneLenclud@50
  2157
    TRUE if successful
StephaneLenclud@50
  2158
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2159
--*/
StephaneLenclud@50
  2160
StephaneLenclud@50
  2161
BOOLEAN __stdcall
StephaneLenclud@50
  2162
HidD_GetIndexedString (
StephaneLenclud@50
  2163
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2164
       ULONG    StringIndex,
StephaneLenclud@50
  2165
   PVOID Buffer,
StephaneLenclud@50
  2166
       ULONG    BufferLength
StephaneLenclud@50
  2167
   );
StephaneLenclud@50
  2168
/*++
StephaneLenclud@50
  2169
Routine Description:
StephaneLenclud@50
  2170
    This function retrieves a string from the specified Hid device that is
StephaneLenclud@50
  2171
    specified with a certain string index.
StephaneLenclud@50
  2172
StephaneLenclud@50
  2173
Arguments:
StephaneLenclud@50
  2174
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2175
 
StephaneLenclud@50
  2176
    StringIndex          Index of the string to retrieve
StephaneLenclud@50
  2177
StephaneLenclud@50
  2178
    Buffer               Buffer which on return will contain the product
StephaneLenclud@50
  2179
                         string returned from the device.  This string is a 
StephaneLenclud@50
  2180
                         wide-character string
StephaneLenclud@50
  2181
StephaneLenclud@50
  2182
    BufferLength         Length of Buffer (in bytes)
StephaneLenclud@50
  2183
StephaneLenclud@50
  2184
Return Value:
StephaneLenclud@50
  2185
    TRUE if successful
StephaneLenclud@50
  2186
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2187
--*/
StephaneLenclud@50
  2188
StephaneLenclud@50
  2189
BOOLEAN __stdcall
StephaneLenclud@50
  2190
HidD_GetSerialNumberString (
StephaneLenclud@50
  2191
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2192
   PVOID Buffer,
StephaneLenclud@50
  2193
       ULONG    BufferLength
StephaneLenclud@50
  2194
   );
StephaneLenclud@50
  2195
/*++
StephaneLenclud@50
  2196
Routine Description:
StephaneLenclud@50
  2197
    This function retrieves the serial number string from the specified 
StephaneLenclud@50
  2198
    Hid device.  
StephaneLenclud@50
  2199
StephaneLenclud@50
  2200
Arguments:
StephaneLenclud@50
  2201
    HidDeviceObject      A handle to a Hid Device Object.
StephaneLenclud@50
  2202
 
StephaneLenclud@50
  2203
    Buffer               Buffer which on return will contain the serial number
StephaneLenclud@50
  2204
                         string returned from the device.  This string is a 
StephaneLenclud@50
  2205
                         wide-character string
StephaneLenclud@50
  2206
StephaneLenclud@50
  2207
    BufferLength         Length of Buffer (in bytes)
StephaneLenclud@50
  2208
StephaneLenclud@50
  2209
Return Value:
StephaneLenclud@50
  2210
    TRUE if successful
StephaneLenclud@50
  2211
    FALSE otherwise  -- Use GetLastError() to get extended error information
StephaneLenclud@50
  2212
--*/
StephaneLenclud@50
  2213
StephaneLenclud@50
  2214
StephaneLenclud@50
  2215
StephaneLenclud@50
  2216
BOOLEAN __stdcall
StephaneLenclud@50
  2217
HidD_GetMsGenreDescriptor (
StephaneLenclud@50
  2218
       HANDLE   HidDeviceObject,
StephaneLenclud@50
  2219
   PVOID Buffer,
StephaneLenclud@50
  2220
       ULONG    BufferLength
StephaneLenclud@50
  2221
   );
StephaneLenclud@50
  2222
StephaneLenclud@50
  2223
StephaneLenclud@50
  2224
StephaneLenclud@50
  2225
StephaneLenclud@50
  2226