DNF tried many methods to simulate the keystroke problem, and tried all methods to add messages to the message queue keybd_event. No, the winio driver simulates the signature problem.
Some games are developed using DirectX provided by Microsoft, thus bypassing the message encapsulation mechanism of windows operating system: these game programs using DirectX interface bypass the message mechanism of Windows and use DirectInput when reading keyboard operations. This is because some games require real-time control, such as racing games, which require the fastest response to keyboard input. Because windows messages are in the form of queues, there will be many delays in the delivery of messages. Sometimes 1 second will deliver more than a dozen messages, which can't meet the requirements of the game. DirectInput bypasses windows messages and directly handles keyboard drivers, which of course improves the efficiency a lot. As a result, programs like PostMessage and keybd_event don't respond, because these functions are at a higher level. For such programs, we have to directly read and write keyboard ports to simulate hardware events. To simulate the keyboard in this way, you need to know some knowledge of keyboard programming first. In the DOS era, when the user presses or releases a key, a keyboard interrupt will be generated (if the keyboard interrupt is allowed), so the program will jump to the keyboard interrupt handler in the BIOS for execution. Open windows Device Manager, and you can see that the keyboard controller is controlled by two ports. Where & H60 is a data port, which can read keyboard data, and & ampH64 is a control port for sending out control signals. That is, from &; Port H60 can read the key information of this keyboard. When reading a byte from this port, the lower 7 bits of the byte are the scan code of the key, and the high 1 bit indicates whether the key is pressed or released. When the key is pressed, the highest bit is 0, which is called a pass code, and when the key is released, the highest bit is 1, which is called a broken code. Since key information can be obtained by reading data from this port, writing data to this port can simulate key pressing.