Hi,
Currently iam doing a keyboard filter driver
based on kbfiltr example from ddk.
My objectives are to
1. Insert multiple keystrokes from a single key press.
For example, when user press <a> i must send it as <SHIFT><F1>
in the same context of <a>.
2. Drop and remap multiple keystrokes.
For example,when user press <ALT><F2> I must send it as <b>
In my previous post,Mr.Doron suggested me the following for my 1 objective.
>>>>>>>>>>>>>>>>>>>>>>>Doron's post>>>>>>>>>>>>>>>>>>>>
>> if this is with in the context of <a> being reported to your own callback,
>> just declare a KEYBOARD_INPUT_DATA array on the stack, initialize it, then
>> call the upper service callback with the new keystrokes, then finally report
>> <a> using the caller's buffer.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I tried to execute what Doron told,and in the usermode application trace,
iam getting <SHIFT><F1><F1><F1><F1><F1><F1>...... where <F1> goes infinite.
Can anyone plz tell me where iam doing wrong ? below is my code.
Please give me some suggestions or reference for my 2 objective too.
Thanks for the patience shown to read this on.
>>>>>>>>>>>>MY CODE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>
VOID
KbFilter_ServiceCallback(
IN PDEVICE_OBJECT DeviceObject,
IN PKEYBOARD_INPUT_DATA InputDataStart,
IN PKEYBOARD_INPUT_DATA InputDataEnd,
IN OUT PULONG InputDataConsumed
)
{
PDEVICE_EXTENSION devExt;
ULONG i=0,j=0;
KEYBOARD_INPUT_DATA data[1];
devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
i = (ULONG)((PCHAR) InputDataEnd - (PCHAR) InputDataStart);
for(j=0;j<i;j++)
{
if(InputDataStart[j].MakeCode != 0)
{
switch(InputDataStart[j].MakeCode)
{
case 0x1E: // If scancode for <a>
data[0].UnitId = 0;
data[0].MakeCode = 0x2A; // Left Shift
data[0].Reserved = 0;
data[0].ExtraInformation = 0;
if(InputDataStart->Flags == KEY_MAKE)
data[0].Flags = KEY_MAKE;
else if(InputDataStart->Flags == KEY_BREAK)
data[0].Flags = KEY_BREAK;
(*(PSERVICE_CALLBACK_ROUTINE)
devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
data,
data+1,
InputDataConsumed);
InputDataStart[j].MakeCode = 0x3B; // F1
break;
default:
break;
}
}
}
(*(PSERVICE_CALLBACK_ROUTINE) devExt->UpperConnectData.ClassService)(
devExt->UpperConnectData.ClassDeviceObject,
InputDataStart,
InputDataEnd,
InputDataConsumed);
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>