kbfiltr mapping keys

This is a simple array processing problem. You get an array in the
service callback function. You visit each element in the array. If it
matches a key you want to remap, you change the element in the array
from the old value to the new remapped value. The design decision you
have to make is how you store this remapping data. I can think of 2
ways to easily do this

  1. define an array that describes the mapping, I gave this structure to
    you in my original response. For each KEYBOARD_INPUT_DATA you receive in
    the callback, you check it against each element in the remapping array.

  2. you encode the remapping data in a switch statement, where each case
    is the old value you want to remap from

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Sunday, May 13, 2007 7:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] kbfiltr mapping keys

Guys, can we please not discuss this any further (Whether I am too young
to program at this level or not. It is everyone’s personal opinion).

So I couldn’t really make of what Doron wrote in his first post. Can
someone please tell me that in “english”… no offense.

Please guys leave the matter og age alone and try to help me, I would be
really grateful to you if I succeeded in mapping keys from driver level.

Thanks a lot


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Mohit, there is an erroneous comment in your code that probably points to an area where understanding is critical.

KEYBOARD_INPUT_DATA extra;

(*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
&extra,
&extra + 1, // just add 1 byte
InputDataConsumed);

In the “C” language, pointer arithmetic is based on the type of data the pointer is pointing at. So it did not “add 1 byte”- it advanced it by the size of KEYBOARD_INPUT_DATA, meaning it pointed at the end of “extra” (more specifically, if “extra” was an array, it would point at the next element of that array). Since this is one of the things you need to do to process arrays, it is important to grasp that concept.

I haven’t read all this, so maybe I’ve misunderstood completely. Is
the requirement to add key remapping to games that don’t have it?
If so, could it not be done with an ordinary win32 app which takes
the keyboard focus, and passes the windows keyup/keydown messages
to the games’s window? I’ve done something a little like that
myself in the past, although not quite the same… the game
might get upset at its window not itself having focus, maybe.
Worth a try though.

Cheers,
Paul.