Fixing stray event issues.
2 using System.Runtime.InteropServices;
3 using Microsoft.Win32.SafeHandles;
9 static partial class Function
11 [DllImport("hid.dll", CharSet = CharSet.Unicode)]
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);
14 [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
15 public static extern Boolean HidD_GetManufacturerString(SafeFileHandle HidDeviceObject, StringBuilder Buffer, Int32 BufferLength);
17 [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
18 public static extern Boolean HidD_GetProductString(SafeFileHandle HidDeviceObject, StringBuilder Buffer, Int32 BufferLength);
20 [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)]
21 public static extern Boolean HidD_GetAttributes(SafeFileHandle HidDeviceObject, ref HIDD_ATTRIBUTES Attributes);
25 static partial class Macro
32 static partial class Const
39 public enum HIDP_REPORT_TYPE : ushort
47 public enum HidStatus : uint
49 HIDP_STATUS_SUCCESS = 0x110000,
50 HIDP_STATUS_NULL = 0x80110001,
51 HIDP_STATUS_INVALID_PREPARSED_DATA = 0xc0110001,
52 HIDP_STATUS_INVALID_REPORT_TYPE = 0xc0110002,
53 HIDP_STATUS_INVALID_REPORT_LENGTH = 0xc0110003,
54 HIDP_STATUS_USAGE_NOT_FOUND = 0xc0110004,
55 HIDP_STATUS_VALUE_OUT_OF_RANGE = 0xc0110005,
56 HIDP_STATUS_BAD_LOG_PHY_VALUES = 0xc0110006,
57 HIDP_STATUS_BUFFER_TOO_SMALL = 0xc0110007,
58 HIDP_STATUS_INTERNAL_ERROR = 0xc0110008,
59 HIDP_STATUS_I8042_TRANS_UNKNOWN = 0xc0110009,
60 HIDP_STATUS_INCOMPATIBLE_REPORT_ID = 0xc011000a,
61 HIDP_STATUS_NOT_VALUE_ARRAY = 0xc011000b,
62 HIDP_STATUS_IS_VALUE_ARRAY = 0xc011000c,
63 HIDP_STATUS_DATA_INDEX_NOT_FOUND = 0xc011000d,
64 HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE = 0xc011000e,
65 HIDP_STATUS_BUTTON_NOT_PRESSED = 0xc011000f,
66 HIDP_STATUS_REPORT_DOES_NOT_EXIST = 0xc0110010,
67 HIDP_STATUS_NOT_IMPLEMENTED = 0xc0110020,
68 HIDP_STATUS_I8242_TRANS_UNKNOWN = 0xc0110009
72 [StructLayout(LayoutKind.Sequential)]
73 public struct USAGE_AND_PAGE
76 public ushort UsagePage;
79 [StructLayout(LayoutKind.Sequential)]
80 public struct HIDD_ATTRIBUTES
83 public ushort VendorID;
84 public ushort ProductID;
85 public ushort VersionNumber;