pinvoke-interop-assistant-input.c
author StephaneLenclud
Sun, 15 Feb 2015 18:15:41 +0100
changeset 60 687cace560d2
child 68 bbe61b1021bb
permissions -rw-r--r--
Adding most basic raw device list.
     1 
     2 typedef USHORT USAGE, *PUSAGE;
     3 typedef LONG NTSTATUS;
     4 
     5 typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
     6 
     7 typedef enum _HIDP_REPORT_TYPE
     8 {
     9     HidP_Input,
    10     HidP_Output,
    11     HidP_Feature
    12 } HIDP_REPORT_TYPE;
    13 
    14 typedef struct _HIDP_CAPS
    15 {
    16     USAGE    Usage;
    17     USAGE    UsagePage;
    18     USHORT   InputReportByteLength;
    19     USHORT   OutputReportByteLength;
    20     USHORT   FeatureReportByteLength;
    21     USHORT   Reserved[17];
    22 
    23     USHORT   NumberLinkCollectionNodes;
    24 
    25     USHORT   NumberInputButtonCaps;
    26     USHORT   NumberInputValueCaps;
    27     USHORT   NumberInputDataIndices;
    28 
    29     USHORT   NumberOutputButtonCaps;
    30     USHORT   NumberOutputValueCaps;
    31     USHORT   NumberOutputDataIndices;
    32 
    33     USHORT   NumberFeatureButtonCaps;
    34     USHORT   NumberFeatureValueCaps;
    35     USHORT   NumberFeatureDataIndices;
    36 } HIDP_CAPS, *PHIDP_CAPS;
    37 
    38 
    39 typedef struct _HIDP_BUTTON_CAPS
    40 {
    41     USAGE    UsagePage;
    42     UCHAR    ReportID;
    43     BOOLEAN  IsAlias;
    44 
    45     USHORT   BitField;
    46     USHORT   LinkCollection;   // A unique internal index pointer
    47 
    48     USAGE    LinkUsage;
    49     USAGE    LinkUsagePage;
    50 
    51     BOOLEAN  IsRange;
    52     BOOLEAN  IsStringRange;
    53     BOOLEAN  IsDesignatorRange;
    54     BOOLEAN  IsAbsolute;
    55 
    56     ULONG    Reserved[10];
    57     union {
    58         struct {
    59             USAGE    UsageMin,         UsageMax;
    60             USHORT   StringMin,        StringMax;
    61             USHORT   DesignatorMin,    DesignatorMax;
    62             USHORT   DataIndexMin,     DataIndexMax;
    63         } Range;
    64         struct  {
    65             USAGE    Usage,            Reserved1;
    66             USHORT   StringIndex,      Reserved2;
    67             USHORT   DesignatorIndex,  Reserved3;
    68             USHORT   DataIndex,        Reserved4;
    69         } NotRange;
    70     };
    71 
    72 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
    73 
    74 typedef struct _HIDP_VALUE_CAPS
    75 {
    76     USAGE    UsagePage;
    77     UCHAR    ReportID;
    78     BOOLEAN  IsAlias;
    79 
    80     USHORT   BitField;
    81     USHORT   LinkCollection;   // A unique internal index pointer
    82 
    83     USAGE    LinkUsage;
    84     USAGE    LinkUsagePage;
    85 
    86     BOOLEAN  IsRange;
    87     BOOLEAN  IsStringRange;
    88     BOOLEAN  IsDesignatorRange;
    89     BOOLEAN  IsAbsolute;
    90 
    91     BOOLEAN  HasNull;        // Does this channel have a null report   union
    92     UCHAR    Reserved;
    93     USHORT   BitSize;        // How many bits are devoted to this value?
    94 
    95     USHORT   ReportCount;    // See Note below.  Usually set to 1.
    96     USHORT   Reserved2[5];
    97 
    98     ULONG    UnitsExp;
    99     ULONG    Units;
   100 
   101     LONG     LogicalMin,       LogicalMax;
   102     LONG     PhysicalMin,      PhysicalMax;
   103 
   104     union {
   105         struct {
   106             USAGE    UsageMin,         UsageMax;
   107             USHORT   StringMin,        StringMax;
   108             USHORT   DesignatorMin,    DesignatorMax;
   109             USHORT   DataIndexMin,     DataIndexMax;
   110         } Range;
   111 
   112         struct {
   113             USAGE    Usage,            Reserved1;
   114             USHORT   StringIndex,      Reserved2;
   115             USHORT   DesignatorIndex,  Reserved3;
   116             USHORT   DataIndex,        Reserved4;
   117         } NotRange;
   118     };
   119 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
   120 
   121 NTSTATUS __stdcall
   122 HidP_GetCaps (
   123          PHIDP_PREPARSED_DATA      PreparsedData,
   124         PHIDP_CAPS                Capabilities
   125    );
   126 
   127    NTSTATUS __stdcall
   128 HidP_GetButtonCaps (
   129           HIDP_REPORT_TYPE     ReportType,
   130    PHIDP_BUTTON_CAPS ButtonCaps,
   131        PUSHORT              ButtonCapsLength,
   132           PHIDP_PREPARSED_DATA PreparsedData
   133 );
   134 
   135 NTSTATUS __stdcall
   136 HidP_GetValueCaps (
   137           HIDP_REPORT_TYPE     ReportType,
   138    PHIDP_VALUE_CAPS ValueCaps,
   139        PUSHORT              ValueCapsLength,
   140           PHIDP_PREPARSED_DATA PreparsedData
   141 );