Short answer: Maybe.
Longer answer: it depends.
To understand what it depends on, and when it matters, it helps to understand why SendInput was introduced into the Windows API: for one, it combines the keybd_event and INPUT APIs sequentially into a keyboard or mouse input stream. These events do not alternate with other keyboard or mouse input events inserted either by the user (using the keyboard or mouse), or keybd_event , mouse_event, or other SendInput calls.
In other words: SendInput sets the atomicity of the input sequences entered, regardless of external events outside the control of the calling code.
As a rule, it is important to enter input atomically when the input consists of a sequence of individual events, for example, in a question. The code introduces the mouse button down and then the mouse button in 2 individual SendInput calls. While the intention is to have one mouse click event, the implementation allows other input sources to interpolate the input. When another input source generates a mouse move event between mouse events and mouse events, the intended click turned into a drag and drop operation. Instead of selecting a file in File Explorer, the same code moved the file to the Trash. This is clearly a mistake.
Similarly, keyboard input input, consisting of keyboard shortcuts, usually requires a guarantee of atomicity. Injecting Ctrl + C requires all four input events to be in the same transaction. Otherwise, the (malicious) source could synthesize the Ctrl key up event immediately after pressing the Ctrl key, leaving the code injecting C with the Ctrl close event closed. Perhaps it was not.
In short: This is an error that causes SendInput several times, passing 1 as the first argument if the following conditions are true:
- An input consists of a sequence of individual input events.
- The input should be interpreted as a whole.
Iinspectable
source share