I wrote a simple program, which simulate mouse input by using WinAPI SendInput() function and then test it on the game which use DirectInput to control all input. As result, this program simulate mouse click. But, as I know, DirectInput communicate directly with input devices hardware, and WinAPI use message loop. So, how do DirectInput and WinAPI communicate?
Asked
Active
Viewed 399 times
0
-
1Raymond Chen took the time to illustrate how input flows through the system. The diagram is available at [When something gets added to a queue, it takes time for it to come out the front of the queue](http://blogs.msdn.com/b/oldnewthing/archive/2014/02/13/10499047.aspx). The diagram includes input simulated through `SendInput`. – IInspectable Jun 12 '15 at 10:52
-
Are any issues which allow to detect simulated input using DirectInput? – ANDROPOLISS Jun 12 '15 at 13:58
-
Simulated input goes to the same queue that real hardware input goes to, as illustrated in Raymond's diagram. Windows does not know, or report to you, any difference between them. The only way (that I know of) to detect simulated input is to monitor hardware input (see the [Raw Input](https://msdn.microsoft.com/en-us/library/windows/desktop/ms645536.aspx) API). If you receive input messages that do not correlate with received hardware messages then the input is likely simulated. – Remy Lebeau Jun 12 '15 at 17:39
-
DirectInput doesn't talk directly to the hardware. It doesn't really do anything you can't do through standard Win32 API calls. – Ross Ridge Jun 13 '15 at 01:07