Ejemplo n.º 1
0
 public static extern int GetRawInputData(
     IntPtr hRawInput,
     RawInputCommand command,
     [Out] IntPtr pData,
     ref uint size,
     int sizeHeader
     );
Ejemplo n.º 2
0
 public static extern int GetRawInputData(
     IntPtr hRawInput,
     RawInputCommand command,
     out RawInput pData,
     ref int pcbSize,
     int cbSizeHeader
     );
    static internal int GetRawInputData(System.IntPtr hRawInput, RawInputCommand uiCommand, System.IntPtr pData, ref int pcbSize, int cbSizeHeader)
    {
        int result = -1;

        try
        {
            result = UnSafeNativeMethods.GetRawInputData(hRawInput, uiCommand, pData, ref pcbSize, cbSizeHeader);
        }
        catch (System.Exception ex)
        {
            OnWin32Error(ex);
            result = -1;
        }
        return(result);
    }
Ejemplo n.º 4
0
        public static RawInput GetRawInputData(IntPtr rawInputHandle, RawInputCommand uiCommand)
        {
            uint bufferSize  = 0;
            uint wroteLength = GetRawInputData(rawInputHandle, uiCommand, IntPtr.Zero, ref bufferSize, (uint)Marshal.SizeOf <RawInputHeader>());

            if (bufferSize <= 0 || wroteLength < 0)
            {
                throw new NativeException("GetRawInputData", Marshal.GetLastWin32Error());
            }

            //byte[] buffer = new byte[bufferSize];

            IntPtr pData = Marshal.AllocHGlobal((int)bufferSize);

            try
            {
                wroteLength = GetRawInputData(rawInputHandle, uiCommand, pData, ref bufferSize, (uint)Marshal.SizeOf <RawInputHeader>());

                if (wroteLength != bufferSize)
                {
                    throw new NativeException("GetRawInputData", Marshal.GetLastWin32Error());
                }

                RawInput result = new RawInput();
                result.Header = Marshal.PtrToStructure <RawInputHeader>(pData);
                result.Data   = Marshal.PtrToStructure <RawInputData>(pData + Marshal.SizeOf <RawInputHeader>());

                if (result.Header.Type == RawInputType.HID)
                {
                    result.HidReports = new byte[result.Data.HID.Count][];

                    // Read the HID reports
                    for (int i = 0; i < result.Data.HID.Count; i++)
                    {
                        IntPtr currentData = pData + Marshal.SizeOf <RawInputHeader>() + Marshal.SizeOf <RawInputHid>() + (i * result.Data.HID.Size);
                        result.HidReports[i] = new byte[result.Data.HID.Size];

                        Marshal.Copy(currentData, result.HidReports[i], 0, result.Data.HID.Size);
                    }
                }

                return(result);
            }
            finally
            {
                Marshal.FreeHGlobal(pData);
            }
        }
Ejemplo n.º 5
0
 internal static extern uint GetRawInputData(
   IntPtr hRawInput,
   RawInputCommand uiCommand,
   IntPtr pData,
   ref uint pcbSize,
   uint cbSizeHeader);
Ejemplo n.º 6
0
 public static extern int GetRawInputData(
     IntPtr hRawInput,
     RawInputCommand uiCommand,
     out RAWINPUT pData,
     ref int pcbSize,
     int cbSizeHeader);
Ejemplo n.º 7
0
 internal static extern uint GetRawInputData(
     IntPtr hRawInput,
     RawInputCommand uiCommand,
     IntPtr pData,
     ref uint pcbSize,
     uint cbSizeHeader);
Ejemplo n.º 8
0
 static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, out RAWINPUT pData, ref int pcbSize, int cbSizeHeader);
Ejemplo n.º 9
0
 public static extern int GetRawInputDeviceInfo(IntPtr hDevice, RawInputCommand uiCommand, IntPtr pData, ref int pcbSize);
Ejemplo n.º 10
0
 public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, byte[] pData, ref int pcbSize, int cbSizeHeader);
Ejemplo n.º 11
0
 private static extern unsafe int GetRawInputDeviceInfo(IntPtr hDevice, RawInputCommand uiCommand, void *pData, ref int pcbSize);
Ejemplo n.º 12
0
 private static extern unsafe int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, void *pData, ref int pcbSize, int cbSizeHeader);
 public static extern int GetRawInputData(System.IntPtr hRawInput, RawInputCommand uiCommand, System.IntPtr pData, ref int pcbSize, int cbSizeHeader);
Ejemplo n.º 14
0
 public static extern int GetRawInputData(IntPtr handleRawInput, RawInputCommand command, out RawInput rawInput, ref int size, int sizeHeader);
Ejemplo n.º 15
0
 public static extern uint GetRawInputData([In] IntPtr hRawInput, [In] RawInputCommand uiCommand, out RawInput pData, ref uint pcbSize, [In] uint cbSizeHeader);