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