views:

319

answers:

2

Hi everyone !

  • We have been given a little project (As part of my OS course) to make a Windows program that modifies keyboard input, so that it transforms any lowercase character entered into an uppercase one (without using caps-lock) ! so when you type on the keyboard you'll see what you're typing transformed into uppercase !
  • I have done this quite easily using Turbo C by calling geninterrupt() and using variables _AH, _AL, i had to read a character using:

    _AH = 0x07;          // Reading a character without echo
    geninterrupt(0x21);  // Dos interrupt 
    
  • Then to transform it into an Upercase letter i have to mask the 5th bit by using:

    _AL = _AL & 0xDF;    // Masking the entered character with 11011111
    
  • and then i will display the character using any output routine.

Now, this solution will only work under old C DOS compilers. But what we intend to do is to make a close or similar solution to this by using any modern C/C++ compiler under Windows XP ! What i have first thought of is modifying the Keyboard ISR so that it masks the fifth bit of any entered character to turn it uppercase ! But i do not know how exactly to do this. Second, I wanted to create a Win32 console program to either do the same solution (but to no avail) or make a windows-compatible solution, still i do not know which functions to use ! Third I thought to make a windows program that modifies the ISR directly to suit my needs ! and i'm still looking for how to do this !

So please, If you could help me out on this, I would greatly appreciate it !

Thank you in advance !

(I'm using Windows XP on intel X86 with mingw-GCC compiler.)

+2  A: 

You can't get access to the Keyboard ISR unless you write a Ring 0 device driver. You are better off investigating the Windows Hook APIs. These accomplish the same thing.

Start here: http://msdn.microsoft.com/en-us/library/ms644990%28v=VS.85%29.aspx

jmucchiello
+1 for Windows Hooks
Shaji
+1  A: 

How soon do you plan to graduate? Hopefully you'll have time, Windows doesn't work this way anymore. You'll need to write a keyboard filter driver using the WDK. It comes with a sample implementation in the src\input\kbfiltr directory. You can't use the tools you're familiar with, the WDK includes a compiler and a kernel debugger. Available at no cost, go here to get started.

Hans Passant
Are you suggesting kernel programming to a beginner that did not even saw win32 APIs? This is not Sparta, this is just madness!In my opinion, he should start just with the SDK and implement the whole thing with hooks; at least, he won't do too much damage trying.@rockr90: I'm not absolutely saying that you're not a good coder, but simply that kernel development is for experienced windows developers. Starting with KD is just doing harm to yourself (and probably also to the PC :) ).
Matteo Italia
I *very* fondly remember being the OP's age and not knowing what was impossible. Too many old men in this tag. Grow down.
Hans Passant
@Matteo: I get your idea, and i understand what you're saying completely, I would like to progress gradually toward things not burst right into it without the necessary knowledge! @Hans: I'm still on my second year, so i think i have time ;)Please if anyone can provide me with some good tutorials on Windows Hooks Api , or any available books, It would be awesome.Thanks.
Rockr90
@Hans: I'm just being realistic. Kernel programming on modern OSes requires quite a background, both of general theory and of specific OS details. For me it's much better to start to feel how the things work in user mode (Win32 APIs, eventually NT native APIs, ...) without doing too much damage, and *then* dive in KD. Ok, there are people like Alex Ionescu who reverse-engineer and rewrite the NT kernel as a teenager, but IMO they are rare exceptions. After all, if everybody was like them there would be no need for CS courses. :)
Matteo Italia