HI!everybody:
I am sorry to ask you a question that about a PS/2 Keyboard Upper-Level Filter Driver.
I plan to filter some special key-hits in my filter driver,I use the win2000 DDK Samples "" which located in..\NTDDK\src\input\kbfiltr,and I added my filter code in KbFilter_ServiceCallback function in "kbfiltr.c",but I can not filter any key-hit.
So I give you the c code.
Maybe the problem is:the i8042prt.sys read the scan code from port 60H,and then queue a DPC routine,so maybe before my filter code is executed,the DPC has already executed. Am I Right?
I need you help me to find the problem!
Thank you very much!
/////////////////////////////////////////////////////////////////////////////////
//This is my function that will be called in KbFilter_ServiceCallback function
//Filter the key "a"(MakeCode=0x1C; BreakCode=0xF0,0x1c
int Filter(PKEYBOARD_INPUT_DATA InputDataStart,
PKEYBOARD_INPUT_DATA InputDataEnd)
{
//flags,remember whether we find the scan code?
int CodeSign[3];
//the pointer we use it search in the InputDataBuffer
PKEYBOARD_INPUT_DATA i=0x0;
int j=0;
//do we find the scan code?
int FilterProcess=0;
int InputDataSize=sizeof(KEYBOARD_INPUT_DATA);
//Initialize the flags
for(j=0;j<=2;j++)
CodeSign[j]=0;
//search in the InputDataBuffer
for(i=InputDataStart;i<=InputDataEnd;i+=InputDataSize)
{
if (!((i->MakeCode==0x1C) && (i->Flags==KEY_MAKE)))
continue;
else
CodeSign[0]=1;
if (!((i->MakeCode==0xF0) && (i->Flags==KEY_BREAK)))
continue;
else
CodeSign[1]=1;
if (!((i->MakeCode==0x1C) && (i->Flags==KEY_BREAK)))
continue;
else
{
CodeSign[2]=1;
break;
}
}
//set the finally flags
for(j=0;j<=2;j++)
FilterProcess&=CodeSign[j];
//if we find the scan code,filter it
if (FilterProcess)
{
RtlZeroMemory(i-2*InputDataSize,3);
return 0;
}
return 1;
}
/////////////////////////////////////////////////////////////////////////////////
mosan
(e-mail address removed)