Win32Hid.cs
author StephaneLenclud
Sun, 15 Mar 2015 12:44:58 +0100
changeset 73 5262f4b7c4ad
parent 72 471b1d45c46a
child 76 831ebeeecfdf
permissions -rw-r--r--
Adding support for usage value and thus joystick/gamepad.
Adding generic support for direction pad.
sl@17
     1
using System;
sl@17
     2
using System.Runtime.InteropServices;
sl@23
     3
using Microsoft.Win32.SafeHandles;
sl@23
     4
using System.Text;
sl@17
     5
sl@17
     6
namespace Win32
sl@17
     7
{
sl@17
     8
sl@17
     9
    static partial class Function
sl@17
    10
    {
sl@17
    11
        [DllImport("hid.dll", CharSet = CharSet.Unicode)]
sl@17
    12
        public static extern HidStatus HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, ushort LinkCollection, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] USAGE_AND_PAGE[] ButtonList, ref uint UsageLength, IntPtr PreparsedData, [MarshalAs(UnmanagedType.LPArray)] byte[] Report, uint ReportLength);
sl@23
    13
sl@23
    14
        [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
sl@24
    15
        public static extern Boolean HidD_GetManufacturerString(SafeFileHandle HidDeviceObject, StringBuilder Buffer, Int32 BufferLength);
sl@24
    16
sl@24
    17
        [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
sl@24
    18
        public static extern Boolean HidD_GetProductString(SafeFileHandle HidDeviceObject, StringBuilder Buffer, Int32 BufferLength);
sl@23
    19
sl@25
    20
        [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
sl@25
    21
        public static extern Boolean HidD_GetAttributes(SafeFileHandle HidDeviceObject, ref HIDD_ATTRIBUTES Attributes);
StephaneLenclud@50
    22
StephaneLenclud@51
    23
        /// Return Type: NTSTATUS->LONG->int
StephaneLenclud@51
    24
        ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
StephaneLenclud@51
    25
        ///Capabilities: PHIDP_CAPS->_HIDP_CAPS*
StephaneLenclud@51
    26
        [DllImportAttribute("hid.dll", EntryPoint = "HidP_GetCaps", CallingConvention = CallingConvention.StdCall)]
StephaneLenclud@56
    27
        public static extern HidStatus HidP_GetCaps(System.IntPtr PreparsedData, ref HIDP_CAPS Capabilities);
StephaneLenclud@50
    28
StephaneLenclud@51
    29
        /// Return Type: NTSTATUS->LONG->int
StephaneLenclud@51
    30
        ///ReportType: HIDP_REPORT_TYPE->_HIDP_REPORT_TYPE
StephaneLenclud@51
    31
        ///ButtonCaps: PHIDP_BUTTON_CAPS->_HIDP_BUTTON_CAPS*
StephaneLenclud@51
    32
        ///ButtonCapsLength: PUSHORT->USHORT*
StephaneLenclud@51
    33
        ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
StephaneLenclud@56
    34
        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetButtonCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
StephaneLenclud@56
    35
        public static extern HidStatus HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] HIDP_BUTTON_CAPS[] ButtonCaps, ref ushort ButtonCapsLength, System.IntPtr PreparsedData);
StephaneLenclud@50
    36
StephaneLenclud@51
    37
        /// Return Type: NTSTATUS->LONG->int
StephaneLenclud@51
    38
        ///ReportType: HIDP_REPORT_TYPE->_HIDP_REPORT_TYPE
StephaneLenclud@51
    39
        ///ValueCaps: PHIDP_VALUE_CAPS->_HIDP_VALUE_CAPS*
StephaneLenclud@51
    40
        ///ValueCapsLength: PUSHORT->USHORT*
StephaneLenclud@51
    41
        ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
StephaneLenclud@56
    42
        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetValueCaps", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
StephaneLenclud@58
    43
        public static extern HidStatus HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] HIDP_VALUE_CAPS[] ValueCaps, ref ushort ValueCapsLength, System.IntPtr PreparsedData);
StephaneLenclud@50
    44
StephaneLenclud@68
    45
        /// Return Type: NTSTATUS->LONG->int
StephaneLenclud@68
    46
        ///ReportType: HIDP_REPORT_TYPE->_HIDP_REPORT_TYPE
StephaneLenclud@68
    47
        ///UsagePage: USAGE->USHORT->unsigned short
StephaneLenclud@68
    48
        ///LinkCollection: USHORT->unsigned short
StephaneLenclud@68
    49
        ///Usage: USAGE->USHORT->unsigned short
StephaneLenclud@68
    50
        ///UsageValue: PULONG->ULONG*
StephaneLenclud@68
    51
        ///PreparsedData: PHIDP_PREPARSED_DATA->_HIDP_PREPARSED_DATA*
StephaneLenclud@68
    52
        ///Report: PCHAR->CHAR*
StephaneLenclud@68
    53
        ///ReportLength: ULONG->unsigned int
StephaneLenclud@68
    54
        [System.Runtime.InteropServices.DllImportAttribute("hid.dll", EntryPoint = "HidP_GetUsageValue", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
StephaneLenclud@73
    55
        public static extern HidStatus HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, ushort UsagePage, ushort LinkCollection, ushort Usage, ref uint UsageValue, System.IntPtr PreparsedData, [MarshalAs(UnmanagedType.LPArray)] byte[] Report, uint ReportLength);
StephaneLenclud@68
    56
StephaneLenclud@68
    57
StephaneLenclud@68
    58
sl@17
    59
    }
sl@17
    60
sl@17
    61
sl@17
    62
    static partial class Macro
sl@17
    63
    {
sl@17
    64
sl@17
    65
sl@17
    66
    }
sl@17
    67
sl@17
    68
sl@17
    69
    static partial class Const
sl@17
    70
    {
sl@17
    71
sl@17
    72
sl@17
    73
    }
sl@17
    74
sl@17
    75
sl@17
    76
    public enum HIDP_REPORT_TYPE : ushort
sl@17
    77
    {
sl@17
    78
        HidP_Input = 0,
sl@17
    79
        HidP_Output,
sl@17
    80
        HidP_Feature
sl@17
    81
    }
sl@17
    82
sl@17
    83
sl@17
    84
    public enum HidStatus : uint
sl@17
    85
    {
sl@17
    86
        HIDP_STATUS_SUCCESS = 0x110000,
sl@17
    87
        HIDP_STATUS_NULL = 0x80110001,
sl@17
    88
        HIDP_STATUS_INVALID_PREPARSED_DATA = 0xc0110001,
sl@17
    89
        HIDP_STATUS_INVALID_REPORT_TYPE = 0xc0110002,
sl@17
    90
        HIDP_STATUS_INVALID_REPORT_LENGTH = 0xc0110003,
sl@17
    91
        HIDP_STATUS_USAGE_NOT_FOUND = 0xc0110004,
sl@17
    92
        HIDP_STATUS_VALUE_OUT_OF_RANGE = 0xc0110005,
sl@17
    93
        HIDP_STATUS_BAD_LOG_PHY_VALUES = 0xc0110006,
sl@17
    94
        HIDP_STATUS_BUFFER_TOO_SMALL = 0xc0110007,
sl@17
    95
        HIDP_STATUS_INTERNAL_ERROR = 0xc0110008,
sl@17
    96
        HIDP_STATUS_I8042_TRANS_UNKNOWN = 0xc0110009,
sl@17
    97
        HIDP_STATUS_INCOMPATIBLE_REPORT_ID = 0xc011000a,
sl@17
    98
        HIDP_STATUS_NOT_VALUE_ARRAY = 0xc011000b,
sl@17
    99
        HIDP_STATUS_IS_VALUE_ARRAY = 0xc011000c,
sl@17
   100
        HIDP_STATUS_DATA_INDEX_NOT_FOUND = 0xc011000d,
sl@17
   101
        HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE = 0xc011000e,
sl@17
   102
        HIDP_STATUS_BUTTON_NOT_PRESSED = 0xc011000f,
sl@17
   103
        HIDP_STATUS_REPORT_DOES_NOT_EXIST = 0xc0110010,
sl@17
   104
        HIDP_STATUS_NOT_IMPLEMENTED = 0xc0110020,
sl@17
   105
        HIDP_STATUS_I8242_TRANS_UNKNOWN = 0xc0110009
sl@17
   106
    }
sl@17
   107
sl@17
   108
sl@17
   109
    [StructLayout(LayoutKind.Sequential)]
sl@17
   110
    public struct USAGE_AND_PAGE
sl@17
   111
    {
sl@17
   112
        public ushort Usage;
sl@17
   113
        public ushort UsagePage;
sl@17
   114
    };
sl@17
   115
sl@25
   116
    [StructLayout(LayoutKind.Sequential)]
sl@25
   117
    public struct HIDD_ATTRIBUTES
sl@25
   118
    {
sl@25
   119
        public uint Size;
sl@25
   120
        public ushort VendorID;
sl@25
   121
        public ushort ProductID;
sl@25
   122
        public ushort VersionNumber;
sl@25
   123
    }
sl@25
   124
sl@17
   125
StephaneLenclud@51
   126
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
StephaneLenclud@51
   127
    public struct HIDP_CAPS
StephaneLenclud@51
   128
    {
StephaneLenclud@51
   129
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   130
        public ushort Usage;
StephaneLenclud@50
   131
StephaneLenclud@51
   132
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   133
        public ushort UsagePage;
StephaneLenclud@50
   134
StephaneLenclud@51
   135
        /// USHORT->unsigned short
StephaneLenclud@51
   136
        public ushort InputReportByteLength;
StephaneLenclud@50
   137
StephaneLenclud@51
   138
        /// USHORT->unsigned short
StephaneLenclud@51
   139
        public ushort OutputReportByteLength;
StephaneLenclud@50
   140
StephaneLenclud@51
   141
        /// USHORT->unsigned short
StephaneLenclud@51
   142
        public ushort FeatureReportByteLength;
StephaneLenclud@50
   143
StephaneLenclud@51
   144
        /// USHORT[17]
StephaneLenclud@51
   145
        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 17, ArraySubType = System.Runtime.InteropServices.UnmanagedType.U2)]
StephaneLenclud@51
   146
        public ushort[] Reserved;
StephaneLenclud@50
   147
StephaneLenclud@51
   148
        /// USHORT->unsigned short
StephaneLenclud@51
   149
        public ushort NumberLinkCollectionNodes;
StephaneLenclud@50
   150
StephaneLenclud@51
   151
        /// USHORT->unsigned short
StephaneLenclud@51
   152
        public ushort NumberInputButtonCaps;
StephaneLenclud@50
   153
StephaneLenclud@51
   154
        /// USHORT->unsigned short
StephaneLenclud@51
   155
        public ushort NumberInputValueCaps;
StephaneLenclud@50
   156
StephaneLenclud@51
   157
        /// USHORT->unsigned short
StephaneLenclud@51
   158
        public ushort NumberInputDataIndices;
StephaneLenclud@50
   159
StephaneLenclud@51
   160
        /// USHORT->unsigned short
StephaneLenclud@51
   161
        public ushort NumberOutputButtonCaps;
StephaneLenclud@50
   162
StephaneLenclud@51
   163
        /// USHORT->unsigned short
StephaneLenclud@51
   164
        public ushort NumberOutputValueCaps;
StephaneLenclud@50
   165
StephaneLenclud@51
   166
        /// USHORT->unsigned short
StephaneLenclud@51
   167
        public ushort NumberOutputDataIndices;
StephaneLenclud@50
   168
StephaneLenclud@51
   169
        /// USHORT->unsigned short
StephaneLenclud@51
   170
        public ushort NumberFeatureButtonCaps;
StephaneLenclud@50
   171
StephaneLenclud@51
   172
        /// USHORT->unsigned short
StephaneLenclud@51
   173
        public ushort NumberFeatureValueCaps;
StephaneLenclud@50
   174
StephaneLenclud@51
   175
        /// USHORT->unsigned short
StephaneLenclud@51
   176
        public ushort NumberFeatureDataIndices;
StephaneLenclud@51
   177
    }
StephaneLenclud@50
   178
StephaneLenclud@51
   179
    /// <summary>
StephaneLenclud@51
   180
    /// Type created in place of an anonymous struct
StephaneLenclud@51
   181
    /// </summary>
StephaneLenclud@51
   182
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
StephaneLenclud@51
   183
    public struct HIDP_BUTTON_CAPS_RANGE
StephaneLenclud@51
   184
    {
StephaneLenclud@50
   185
StephaneLenclud@51
   186
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   187
        public ushort UsageMin;
StephaneLenclud@50
   188
StephaneLenclud@51
   189
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   190
        public ushort UsageMax;
StephaneLenclud@50
   191
StephaneLenclud@51
   192
        /// USHORT->unsigned short
StephaneLenclud@51
   193
        public ushort StringMin;
StephaneLenclud@50
   194
StephaneLenclud@51
   195
        /// USHORT->unsigned short
StephaneLenclud@51
   196
        public ushort StringMax;
StephaneLenclud@50
   197
StephaneLenclud@51
   198
        /// USHORT->unsigned short
StephaneLenclud@51
   199
        public ushort DesignatorMin;
StephaneLenclud@50
   200
StephaneLenclud@51
   201
        /// USHORT->unsigned short
StephaneLenclud@51
   202
        public ushort DesignatorMax;
StephaneLenclud@50
   203
StephaneLenclud@51
   204
        /// USHORT->unsigned short
StephaneLenclud@51
   205
        public ushort DataIndexMin;
StephaneLenclud@50
   206
StephaneLenclud@51
   207
        /// USHORT->unsigned short
StephaneLenclud@51
   208
        public ushort DataIndexMax;
StephaneLenclud@51
   209
    }
StephaneLenclud@50
   210
StephaneLenclud@51
   211
    /// <summary>
StephaneLenclud@51
   212
    /// Type created in place of an anonymous struct
StephaneLenclud@51
   213
    /// </summary>
StephaneLenclud@51
   214
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
StephaneLenclud@51
   215
    public struct HIDP_BUTTON_CAPS_NOT_RANGE
StephaneLenclud@51
   216
    {
StephaneLenclud@50
   217
StephaneLenclud@51
   218
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   219
        public ushort Usage;
StephaneLenclud@50
   220
StephaneLenclud@51
   221
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   222
        public ushort Reserved1;
StephaneLenclud@50
   223
StephaneLenclud@51
   224
        /// USHORT->unsigned short
StephaneLenclud@51
   225
        public ushort StringIndex;
StephaneLenclud@50
   226
StephaneLenclud@51
   227
        /// USHORT->unsigned short
StephaneLenclud@51
   228
        public ushort Reserved2;
StephaneLenclud@50
   229
StephaneLenclud@51
   230
        /// USHORT->unsigned short
StephaneLenclud@51
   231
        public ushort DesignatorIndex;
StephaneLenclud@50
   232
StephaneLenclud@51
   233
        /// USHORT->unsigned short
StephaneLenclud@51
   234
        public ushort Reserved3;
StephaneLenclud@50
   235
StephaneLenclud@51
   236
        /// USHORT->unsigned short
StephaneLenclud@51
   237
        public ushort DataIndex;
StephaneLenclud@50
   238
StephaneLenclud@51
   239
        /// USHORT->unsigned short
StephaneLenclud@51
   240
        public ushort Reserved4;
StephaneLenclud@51
   241
    }
StephaneLenclud@50
   242
StephaneLenclud@57
   243
    /// <summary>
StephaneLenclud@57
   244
    /// 
StephaneLenclud@57
   245
    /// </summary>
StephaneLenclud@57
   246
    [StructLayoutAttribute(LayoutKind.Explicit, Pack = 1)]
StephaneLenclud@51
   247
    public struct HIDP_BUTTON_CAPS
StephaneLenclud@51
   248
    {
StephaneLenclud@51
   249
        /// USAGE->USHORT->unsigned short
StephaneLenclud@57
   250
        [FieldOffset(0)]
StephaneLenclud@51
   251
        public ushort UsagePage;
StephaneLenclud@50
   252
StephaneLenclud@51
   253
        /// UCHAR->unsigned char
StephaneLenclud@57
   254
        [FieldOffset(2)]
StephaneLenclud@51
   255
        public byte ReportID;
StephaneLenclud@50
   256
StephaneLenclud@51
   257
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@57
   258
        [FieldOffset(3)]
StephaneLenclud@59
   259
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@57
   260
        public bool IsAlias;
StephaneLenclud@50
   261
StephaneLenclud@51
   262
        /// USHORT->unsigned short
StephaneLenclud@57
   263
        [FieldOffset(4)]
StephaneLenclud@51
   264
        public ushort BitField;
StephaneLenclud@50
   265
StephaneLenclud@51
   266
        /// USHORT->unsigned short
StephaneLenclud@57
   267
        [FieldOffset(6)]
StephaneLenclud@51
   268
        public ushort LinkCollection;
StephaneLenclud@50
   269
StephaneLenclud@51
   270
        /// USAGE->USHORT->unsigned short
StephaneLenclud@57
   271
        [FieldOffset(8)]
StephaneLenclud@51
   272
        public ushort LinkUsage;
StephaneLenclud@50
   273
StephaneLenclud@51
   274
        /// USAGE->USHORT->unsigned short
StephaneLenclud@57
   275
        [FieldOffset(10)]
StephaneLenclud@51
   276
        public ushort LinkUsagePage;
StephaneLenclud@50
   277
StephaneLenclud@51
   278
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@57
   279
        [FieldOffset(12)]
StephaneLenclud@59
   280
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@57
   281
        public bool IsRange;
StephaneLenclud@50
   282
StephaneLenclud@51
   283
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@57
   284
        [FieldOffset(13)]
StephaneLenclud@59
   285
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@57
   286
        public bool IsStringRange;
StephaneLenclud@50
   287
StephaneLenclud@51
   288
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@57
   289
        [FieldOffset(14)]
StephaneLenclud@59
   290
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@57
   291
        public bool IsDesignatorRange;
StephaneLenclud@50
   292
StephaneLenclud@51
   293
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@57
   294
        [FieldOffset(15)]
StephaneLenclud@59
   295
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@57
   296
        public bool IsAbsolute;
StephaneLenclud@50
   297
StephaneLenclud@51
   298
        /// ULONG[10]
StephaneLenclud@57
   299
        [FieldOffset(16)]
StephaneLenclud@57
   300
        [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4)]
StephaneLenclud@51
   301
        public uint[] Reserved;
StephaneLenclud@50
   302
StephaneLenclud@57
   303
        /// Union Range/NotRange
StephaneLenclud@57
   304
        [FieldOffset(56)]
StephaneLenclud@72
   305
        public HIDP_BUTTON_CAPS_RANGE Range;
StephaneLenclud@57
   306
StephaneLenclud@57
   307
        [FieldOffset(56)]
StephaneLenclud@72
   308
        public HIDP_BUTTON_CAPS_NOT_RANGE NotRange;       
StephaneLenclud@51
   309
    }
StephaneLenclud@50
   310
StephaneLenclud@51
   311
    /// <summary>
StephaneLenclud@51
   312
    /// Type created in place of an anonymous struct
StephaneLenclud@51
   313
    /// </summary>
StephaneLenclud@51
   314
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
StephaneLenclud@51
   315
    public struct HIDP_VALUE_CAPS_RANGE
StephaneLenclud@51
   316
    {
StephaneLenclud@50
   317
StephaneLenclud@51
   318
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   319
        public ushort UsageMin;
StephaneLenclud@50
   320
StephaneLenclud@51
   321
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   322
        public ushort UsageMax;
StephaneLenclud@50
   323
StephaneLenclud@51
   324
        /// USHORT->unsigned short
StephaneLenclud@51
   325
        public ushort StringMin;
StephaneLenclud@50
   326
StephaneLenclud@51
   327
        /// USHORT->unsigned short
StephaneLenclud@51
   328
        public ushort StringMax;
StephaneLenclud@50
   329
StephaneLenclud@51
   330
        /// USHORT->unsigned short
StephaneLenclud@51
   331
        public ushort DesignatorMin;
StephaneLenclud@50
   332
StephaneLenclud@51
   333
        /// USHORT->unsigned short
StephaneLenclud@51
   334
        public ushort DesignatorMax;
StephaneLenclud@50
   335
StephaneLenclud@51
   336
        /// USHORT->unsigned short
StephaneLenclud@51
   337
        public ushort DataIndexMin;
StephaneLenclud@50
   338
StephaneLenclud@51
   339
        /// USHORT->unsigned short
StephaneLenclud@51
   340
        public ushort DataIndexMax;
StephaneLenclud@51
   341
    }
StephaneLenclud@50
   342
StephaneLenclud@51
   343
    /// <summary>
StephaneLenclud@51
   344
    /// Type created in place of an anonymous struct
StephaneLenclud@51
   345
    /// </summary>
StephaneLenclud@51
   346
    [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
StephaneLenclud@51
   347
    public struct HIDP_VALUE_CAPS_NOT_RANGE
StephaneLenclud@51
   348
    {
StephaneLenclud@50
   349
StephaneLenclud@51
   350
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   351
        public ushort Usage;
StephaneLenclud@50
   352
StephaneLenclud@51
   353
        /// USAGE->USHORT->unsigned short
StephaneLenclud@51
   354
        public ushort Reserved1;
StephaneLenclud@50
   355
StephaneLenclud@51
   356
        /// USHORT->unsigned short
StephaneLenclud@51
   357
        public ushort StringIndex;
StephaneLenclud@50
   358
StephaneLenclud@51
   359
        /// USHORT->unsigned short
StephaneLenclud@51
   360
        public ushort Reserved2;
StephaneLenclud@50
   361
StephaneLenclud@51
   362
        /// USHORT->unsigned short
StephaneLenclud@51
   363
        public ushort DesignatorIndex;
StephaneLenclud@50
   364
StephaneLenclud@51
   365
        /// USHORT->unsigned short
StephaneLenclud@51
   366
        public ushort Reserved3;
StephaneLenclud@50
   367
StephaneLenclud@51
   368
        /// USHORT->unsigned short
StephaneLenclud@51
   369
        public ushort DataIndex;
StephaneLenclud@50
   370
StephaneLenclud@51
   371
        /// USHORT->unsigned short
StephaneLenclud@51
   372
        public ushort Reserved4;
StephaneLenclud@51
   373
    }
StephaneLenclud@50
   374
StephaneLenclud@50
   375
StephaneLenclud@59
   376
    /// <summary>
StephaneLenclud@59
   377
    /// 
StephaneLenclud@59
   378
    /// </summary>
StephaneLenclud@59
   379
    [StructLayoutAttribute(LayoutKind.Explicit, Pack = 1)]
StephaneLenclud@51
   380
    public struct HIDP_VALUE_CAPS
StephaneLenclud@51
   381
    {
StephaneLenclud@50
   382
StephaneLenclud@51
   383
        /// USAGE->USHORT->unsigned short
StephaneLenclud@59
   384
        [FieldOffset(0)]
StephaneLenclud@51
   385
        public ushort UsagePage;
StephaneLenclud@50
   386
StephaneLenclud@51
   387
        /// UCHAR->unsigned char
StephaneLenclud@59
   388
        [FieldOffset(2)]
StephaneLenclud@51
   389
        public byte ReportID;
StephaneLenclud@50
   390
StephaneLenclud@51
   391
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   392
        [FieldOffset(3)]
StephaneLenclud@59
   393
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   394
        public bool IsAlias;
StephaneLenclud@50
   395
StephaneLenclud@51
   396
        /// USHORT->unsigned short
StephaneLenclud@59
   397
        [FieldOffset(4)]
StephaneLenclud@51
   398
        public ushort BitField;
StephaneLenclud@50
   399
StephaneLenclud@51
   400
        /// USHORT->unsigned short
StephaneLenclud@59
   401
        [FieldOffset(6)]
StephaneLenclud@51
   402
        public ushort LinkCollection;
StephaneLenclud@50
   403
StephaneLenclud@51
   404
        /// USAGE->USHORT->unsigned short
StephaneLenclud@59
   405
        [FieldOffset(8)]
StephaneLenclud@51
   406
        public ushort LinkUsage;
StephaneLenclud@50
   407
StephaneLenclud@51
   408
        /// USAGE->USHORT->unsigned short
StephaneLenclud@59
   409
        [FieldOffset(10)]
StephaneLenclud@51
   410
        public ushort LinkUsagePage;
StephaneLenclud@50
   411
StephaneLenclud@51
   412
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   413
        [FieldOffset(12)]
StephaneLenclud@59
   414
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   415
        public bool IsRange;
StephaneLenclud@50
   416
StephaneLenclud@51
   417
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   418
        [FieldOffset(13)]
StephaneLenclud@59
   419
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   420
        public bool IsStringRange;
StephaneLenclud@50
   421
StephaneLenclud@51
   422
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   423
        [FieldOffset(14)]
StephaneLenclud@59
   424
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   425
        public bool IsDesignatorRange;
StephaneLenclud@50
   426
StephaneLenclud@51
   427
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   428
        [FieldOffset(15)]
StephaneLenclud@59
   429
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   430
        public bool IsAbsolute;
StephaneLenclud@50
   431
StephaneLenclud@51
   432
        /// BOOLEAN->BYTE->unsigned char
StephaneLenclud@59
   433
        [FieldOffset(16)]
StephaneLenclud@59
   434
        [MarshalAsAttribute(UnmanagedType.U1)]
StephaneLenclud@59
   435
        public bool HasNull;
StephaneLenclud@50
   436
StephaneLenclud@51
   437
        /// UCHAR->unsigned char
StephaneLenclud@59
   438
        [FieldOffset(17)]
StephaneLenclud@51
   439
        public byte Reserved;
StephaneLenclud@50
   440
StephaneLenclud@51
   441
        /// USHORT->unsigned short
StephaneLenclud@59
   442
        [FieldOffset(18)]
StephaneLenclud@51
   443
        public ushort BitSize;
StephaneLenclud@50
   444
StephaneLenclud@51
   445
        /// USHORT->unsigned short
StephaneLenclud@59
   446
        [FieldOffset(20)]
StephaneLenclud@51
   447
        public ushort ReportCount;
StephaneLenclud@50
   448
StephaneLenclud@51
   449
        /// USHORT[5]
StephaneLenclud@59
   450
        /// We had to use 5 ushorts instead of an array to avoid alignment exception issues.
StephaneLenclud@59
   451
        [FieldOffset(22)]
StephaneLenclud@59
   452
        public ushort Reserved21;
StephaneLenclud@59
   453
        [FieldOffset(24)]
StephaneLenclud@59
   454
        public ushort Reserved22;
StephaneLenclud@59
   455
        [FieldOffset(26)]
StephaneLenclud@59
   456
        public ushort Reserved23;
StephaneLenclud@59
   457
        [FieldOffset(28)]
StephaneLenclud@59
   458
        public ushort Reserved24;
StephaneLenclud@59
   459
        [FieldOffset(30)]
StephaneLenclud@59
   460
        public ushort Reserved25;
StephaneLenclud@50
   461
StephaneLenclud@51
   462
        /// ULONG->unsigned int
StephaneLenclud@59
   463
        [FieldOffset(32)]
StephaneLenclud@51
   464
        public uint UnitsExp;
StephaneLenclud@50
   465
StephaneLenclud@51
   466
        /// ULONG->unsigned int
StephaneLenclud@59
   467
        [FieldOffset(36)]
StephaneLenclud@51
   468
        public uint Units;
StephaneLenclud@50
   469
StephaneLenclud@51
   470
        /// LONG->int
StephaneLenclud@59
   471
        [FieldOffset(40)]
StephaneLenclud@51
   472
        public int LogicalMin;
StephaneLenclud@50
   473
StephaneLenclud@51
   474
        /// LONG->int
StephaneLenclud@59
   475
        [FieldOffset(44)]
StephaneLenclud@51
   476
        public int LogicalMax;
StephaneLenclud@50
   477
StephaneLenclud@51
   478
        /// LONG->int
StephaneLenclud@59
   479
        [FieldOffset(48)]
StephaneLenclud@51
   480
        public int PhysicalMin;
StephaneLenclud@50
   481
StephaneLenclud@51
   482
        /// LONG->int
StephaneLenclud@59
   483
        [FieldOffset(52)]
StephaneLenclud@51
   484
        public int PhysicalMax;
StephaneLenclud@50
   485
StephaneLenclud@59
   486
        /// Union Range/NotRange
StephaneLenclud@59
   487
        [FieldOffset(56)]
StephaneLenclud@59
   488
        public HIDP_VALUE_CAPS_RANGE Range;
StephaneLenclud@59
   489
StephaneLenclud@59
   490
        [FieldOffset(56)]
StephaneLenclud@59
   491
        public HIDP_VALUE_CAPS_NOT_RANGE NotRange;
StephaneLenclud@51
   492
    }
StephaneLenclud@59
   493
    
StephaneLenclud@51
   494
}
StephaneLenclud@50
   495
StephaneLenclud@51
   496