Click to See Complete Forum and Search --> : something about resident program ?
pavilion
November 21st, 2008, 04:31 AM
I'm writing a program that can lock the keyboard. I patch into ISR 9(the keyboard interrupt) and manipulate the head and tai pointers. It work fine , but there're something I don't understand:
-It seems that I cannot use int 21h when patching into an interrupt
-When I run my program from Command Prompt , it works so the CMD window doesn't receive any keystrokes , but anything outside the cmd window respond to my keypress normally (I mean the keyboard is only locked inside the cmd window). Is there anyway to make it affect all of the computer ?
iviggers
November 21st, 2008, 11:34 AM
Hi Pavilion,
What do you mean with "head and tai pointers"?
Without having reversed it, the Int 21h is very likely to rely on interrupts of lower level or BIOS. If so, that's why you can't use int 21h when patching int 09h, int 16h or others. Anyway, you don't need to patch interrupts in order to block the keyboard. The following opcodes accomplish this:
mov ah,3eh
xor bx,bx
int 21h
Thus DOS services remain available.
Your second point is mixing some concepts. DOS interrupts are not supposed to work for Windows or platforms of the Protected Mode. The cmd prompt available in Windows is not even real mode, but virtual. That's why blocking the keyboard in a cmd prompt doesn't affect any other prompt or window. You can't affect the whole computer by using DOS services, unless it's operating system is DOS itself.
Thanks.
Iņaki Viggers
pavilion
November 22nd, 2008, 01:46 AM
Thanks a lot , I mean "head and tail pointers" of the type ahead buffer.
So is there anyway to program in real mode , I begin to feel interesting but don't know how
One more thing, when I learn programming in .NET , I usually take a look at MSDN to find the function/class I need . I wonder if there is any library like that to use in Assembly (to search for an interrupt I need , for example)
iviggers
November 22nd, 2008, 07:08 PM
The best option to program in real mode is by installing MS-DOS in a PC (no Windows). There are several OS projects out there and I'm sure some of them are still about real mode.
The function reference equivalent to MSDN would be a list of interrupts. Check out Ralf Brown's interrupt list (available online).
pavilion
November 26th, 2008, 03:51 AM
after checking , I saw the function 3e of int 21h is to delete file handle ... not related to keyboard , please take a look at this
iviggers
November 27th, 2008, 06:34 PM
It is related to keyboard:
File handle 0 refers to the standard input device, e.g. keyboard.
Service 3Eh of int 21h closes the file.
Therefore service 3Eh with parameter bx=0 closes the file or device handler, which in this case is the keyboard.
Try the opcodes by yourself.
codeguru.com
Copyright WebMediaBrands Inc., All Rights Reserved.