How to emulate a keystroke in DOS programmatically (in C / C ++)?

First, I'm talking about DOS, not a Windows command line application.

I want to write a procedure that will send a keystroke for the current process. My goal is to use this procedure in ISR (interrupt handler).

In other words, this is what I want:

  • DOS is loading.
  • I run TSR, which registers my procedure as an ISR for some interruption (and not keyboard interruption, but now suppose that it is).
  • I run another program that becomes the current process.
  • The above interruption occurs.
  • My procedure skips and emulates a keystroke that actually never happened.
  • The currently executing process receives this keystroke, as if the emulated key were pressed.

I found several sources with different examples, but I could not get anything to work for me.

I don’t know if this makes any difference, but what I am currently using to test all of this includes FreeDOS running on a VirtualBox machine and DJGPP to compile and run the code (it uses the GNU compiler, I believe )

Any help would be greatly appreciated.

+3
source share
1 answer

IIRC do you need to use BIOS call INT 16h, FUNC 05H ...? or write directly to 0040: 001E (or it was 001C) ... a Google search includes a couple of threads on a topic ...

http://www.rhinocerus.net/forum/lang-asm-x86/254441-re-how-write-char-keyboard-buffer.html

+1
source

All Articles