using TIMERPROC = Functions.TimerProc;
using REGSAM = System.UInt32;
+ using System.Diagnostics;
#endregion
INT SizeHeader
);
+ internal static int GetRawInputData(IntPtr raw, out RawInputHeader header)
+ {
+ int size = RawInputHeader.SizeInBytes;
+ unsafe
+ {
+ fixed (RawInputHeader* pheader = &header)
+ {
+ if (GetRawInputData(raw, GetRawInputDataEnum.HEADER,
+ (IntPtr)pheader, ref size, API.RawInputHeaderSize) != RawInputHeader.SizeInBytes)
+ {
+ Debug.Print("[Error] Failed to retrieve raw input header. Error: {0}",
+ Marshal.GetLastWin32Error());
+ }
+ }
+ }
+ return size;
+ }
+
+ internal static int GetRawInputData(IntPtr raw, out RawInput data)
+ {
+ int size = RawInput.SizeInBytes;
+ unsafe
+ {
+ fixed (RawInput* pdata = &data)
+ {
+ GetRawInputData(raw, GetRawInputDataEnum.INPUT,
+ (IntPtr)pdata, ref size, API.RawInputHeaderSize);
+ }
+ }
+ return size;
+ }
+
+ internal static int GetRawInputData(IntPtr raw, byte[] data)
+ {
+ int size = data.Length;
+ unsafe
+ {
+ fixed (byte* pdata = data)
+ {
+ GetRawInputData(raw, GetRawInputDataEnum.INPUT,
+ (IntPtr)pdata, ref size, API.RawInputHeaderSize);
+ }
+ }
+ return size;
+ }
+
#endregion
#region IntPtr NextRawInputStructure(IntPtr data)
{
public RawInputHeader Header;
public RawInputData Data;
+
+ public static readonly int SizeInBytes =
+ BlittableValueType<RawInput>.Stride;
}
[StructLayout(LayoutKind.Explicit)]
internal RawKeyboard Keyboard;
[FieldOffset(0)]
internal RawHID HID;
+
+ public static readonly int SizeInBytes =
+ BlittableValueType<RawInputData>.Stride;
}
#endregion
/// Value passed in the wParam parameter of the WM_INPUT message.
/// </summary>
internal WPARAM Param;
+
+ public static readonly int SizeInBytes =
+ BlittableValueType<RawInputHeader>.Stride;
}
#endregion