Hello and thanks in advance for any help. I am currently trying to write a bit of code that simulates a keystroke via stuffing a scan code directly into the keyboard controller chip and have it return that scan code as though someone actually pressed that key.
To be honest, I am a complete virgin when it comes to assembly and I have no idea what I'm doing. This is a bit more complicated than anything i can comprehend with my limited knowledge, and I'm requesting some more seasoned hands to help me out. The rest of my program is in C#, and I am currently unaware of any way to produce the same effect with it.
Note: I want to write directly to the keyboards buffer, so that the application in focus will not be able to tell the difference between the code and an actual key press. I do not want to use SendInput() or keybd_event or anything like that in C# because the program I'm trying to manipulate can tell the difference and blocks them.
This is the code I have made up so far.
;Return scan code command
mov al, 0d2h
out 64h, al
; Send the scan code:
mov al, 20h ;"D" down scan code
out 60h, al
;Return scan code command
mov al, 0d2h
out 64h, al
; Send the scan code:
mov al, 0a0h ;"D" up scan code
out 60h, al
I figured out that i need to send a 0D2h byte to the controller command port (64h), telling it that the next information it recieves is a scan code, and then follow up by sending the actual scan code byte to port 60h.
I found a similar code here: http://www.programmersheaven.com/mb/x86_asm/332275/332275/simulate-key-press-from-keyboard/?S=B20000
but still don't understand what I'm doing.
I am using Flat Assembler at the moment, and don't genuinely know whether its a decent assembly compiler or not. When I try to compile it, I get a .BIN file and have no idea whether it worked or not. I would like to create a .exe so that when executed, would simulate a specific key press (IE the Tab button) so that I can just call that executable from my main program when needed.
Any observations or suggestions would be greatly appreciated, but try to be detailed. :icon_cheesygrin: