sl@17: using System; sl@17: using System.Runtime.InteropServices; sl@23: using Microsoft.Win32.SafeHandles; sl@23: using System.Text; sl@17: sl@17: namespace Win32 sl@17: { sl@17: sl@17: static partial class Function sl@17: { sl@17: [DllImport("hid.dll", CharSet = CharSet.Unicode)] sl@17: 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: sl@23: [DllImport("hid.dll", CharSet = CharSet.Auto, SetLastError = true)] sl@23: public static extern Boolean HidD_GetManufacturerString(/*SafeFileHandle*/ IntPtr HidDeviceObject, StringBuilder Buffer, Int32 BufferLength); sl@23: sl@17: } sl@17: sl@17: sl@17: static partial class Macro sl@17: { sl@17: sl@17: sl@17: } sl@17: sl@17: sl@17: static partial class Const sl@17: { sl@17: sl@17: sl@17: } sl@17: sl@17: sl@17: public enum HIDP_REPORT_TYPE : ushort sl@17: { sl@17: HidP_Input = 0, sl@17: HidP_Output, sl@17: HidP_Feature sl@17: } sl@17: sl@17: sl@17: public enum HidStatus : uint sl@17: { sl@17: HIDP_STATUS_SUCCESS = 0x110000, sl@17: HIDP_STATUS_NULL = 0x80110001, sl@17: HIDP_STATUS_INVALID_PREPARSED_DATA = 0xc0110001, sl@17: HIDP_STATUS_INVALID_REPORT_TYPE = 0xc0110002, sl@17: HIDP_STATUS_INVALID_REPORT_LENGTH = 0xc0110003, sl@17: HIDP_STATUS_USAGE_NOT_FOUND = 0xc0110004, sl@17: HIDP_STATUS_VALUE_OUT_OF_RANGE = 0xc0110005, sl@17: HIDP_STATUS_BAD_LOG_PHY_VALUES = 0xc0110006, sl@17: HIDP_STATUS_BUFFER_TOO_SMALL = 0xc0110007, sl@17: HIDP_STATUS_INTERNAL_ERROR = 0xc0110008, sl@17: HIDP_STATUS_I8042_TRANS_UNKNOWN = 0xc0110009, sl@17: HIDP_STATUS_INCOMPATIBLE_REPORT_ID = 0xc011000a, sl@17: HIDP_STATUS_NOT_VALUE_ARRAY = 0xc011000b, sl@17: HIDP_STATUS_IS_VALUE_ARRAY = 0xc011000c, sl@17: HIDP_STATUS_DATA_INDEX_NOT_FOUND = 0xc011000d, sl@17: HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE = 0xc011000e, sl@17: HIDP_STATUS_BUTTON_NOT_PRESSED = 0xc011000f, sl@17: HIDP_STATUS_REPORT_DOES_NOT_EXIST = 0xc0110010, sl@17: HIDP_STATUS_NOT_IMPLEMENTED = 0xc0110020, sl@17: HIDP_STATUS_I8242_TRANS_UNKNOWN = 0xc0110009 sl@17: } sl@17: sl@17: sl@17: [StructLayout(LayoutKind.Sequential)] sl@17: public struct USAGE_AND_PAGE sl@17: { sl@17: public ushort Usage; sl@17: public ushort UsagePage; sl@17: }; sl@17: sl@17: sl@17: }