public bool InitializeMouseDeviceStackContext() { if (driverHandle == null) { throw new Exception( "Driver handle is null. Is the driver running and have you called Init() function?"); } uint dummy = 0; var DeviceStackInformation = new MOUSE_DEVICE_STACK_INFORMATION(); bool status = InitStackIo.DeviceIoControl( driverHandle, EIOControlCode.IOCTL_INITIALIZE_MOUSE_DEVICE_STACK_CONTEXT, ref DeviceStackInformation, 0, ref DeviceStackInformation, Marshal.SizeOf(DeviceStackInformation), out dummy, IntPtr.Zero ); if (status) { Console.WriteLine("SUCCESS"); } else { Console.WriteLine("Failed"); Console.WriteLine(Connector.GetLastError()); } return(status); }
internal static extern bool DeviceIoControl( SafeFileHandle hDevice, EIOControlCode IoControlCode, ref MOUSE_DEVICE_STACK_INFORMATION InBuffer, int nInBufferSize, ref MOUSE_DEVICE_STACK_INFORMATION OutBuffer, int nOutBufferSize, out uint pBytesReturned, IntPtr Overlapped );