Go Back   TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Keyboard filter to simulate keys

Windows XP Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 21-09-2004
Mel
 
Posts: n/a
Keyboard filter to simulate keys

Hello,

I'm new to driver development, in fact I have never written
a real mode sys file nor a driver. Now I have to accomplish the following
task:
A program generates virtual key events to control a directx game.
Because directx directly reads out the keyboard I can't simply use the
WinAPI keybd_event or a simple SendKeys function. So the best way
seems to be to send the keystrokes from my application (can be delphi, c++
or vb)
to the keyboard filter driver that creates the keystroke.

Therefore I register a new keyboardchain filter KbdFilterInit

Then I'd like to feed keys into the keyboard chain to simulate button press
events. Therefore I create KeyData packets.

To process the keyboard chain I implement proper dispatch
function for reading
NTSTATUS
KbdDispatchRead(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)

So my questions are:
Is there already something similar out there that I can use?
Is it possible to create such a driver file without getting 1000s of
blue screens?
What's the easiest way to do this.
How can I send some bytes from my app to the driver? (My app tells the
driver to generate an 'F1' keystroke...)
Is my theory correct?

I hope to get some help from you.
Thanks for any hints
Mel

NTSTATUS
KbdFilterInit(
IN PDRIVER_OBJECT DriverObject
)
/*++

Routine Description:

Create a device object and attaches it to the
first keyboard device chain

Arguments:

DeviceObject - pointer to a device object.

Return Value:

NT Status code

--*/


{
UNICODE_STRING ntUnicodeString;
NTSTATUS ntStatus;
PDEVICE_OBJECT DeviceObject = NULL;

//
// Only hook onto the first keyboard's chain.
//
RtlInitUnicodeString( &ntUnicodeString, L"\\Device\\KeyboardClass0" );
//
// Create device object for the keyboard.
//
ntStatus = IoCreateDevice( DriverObject,
0,
NULL,
FILE_DEVICE_KEYBOARD,
0,
FALSE,
&DeviceObject );

if( !NT_SUCCESS(ntStatus) ) {
JKBD_DbgPrint(("JKBD: Keyboard hook failed to create device!\n"));
return ntStatus;
}
//
// Keyboard uses buffered I/O so we must as well.
//
DeviceObject->Flags |= DO_BUFFERED_IO;
//
// Attach to the keyboard chain.
//
ntStatus = IoAttachDevice( DeviceObject, &ntUnicodeString,
&pGlobalDevExt->KbdDevice );
if( !NT_SUCCESS(ntStatus) ) {
JKBD_DbgPrint(("JKBD: Connect with keyboard failed!\n"));
IoDeleteDevice( DeviceObject );
return ntStatus;
}
pGlobalDevExt->KbdFilterDevice = DeviceObject;

return STATUS_SUCCESS;
}



//
// Create a keyboard packet
//
KeyData = pGlobalDevExt->RawKbdIrp->AssociatedIrp.SystemBuffer;

RtlZeroMemory(KeyData, 2*sizeof(KEYBOARD_INPUT_DATA));
KeyData[numKeys].Flags = 0; //down
KeyData[numKeys+1].Flags = 1; //up
KeyData[numKeys].MakeCode = 0x1e; // character a
KeyData[numKeys+1].MakeCode = 0x1e; // character a
numKeys += 2;
KeyData += numKeys*sizeof(KEYBOARD_INPUT_DATA);
pGlobalDevExt->RawKbdIrp->IoStatus.Status = STATUS_SUCCESS;
pGlobalDevExt->RawKbdIrp->IoStatus.Information =
numKeys*sizeof(KEYBOARD_INPUT_DATA);
pGlobalDevExt->RawKbdIrpPending = FALSE;
IoCompleteRequest(pGlobalDevExt->RawKbdIrp, IO_KEYBOARD_INCREMENT);




Reply With Quote
  #2  
Old 21-09-2004
Arkady Frenkel
 
Posts: n/a
Re: Keyboard filter to simulate keys

Look at DDK\DDKXP\src\input\kbfiltr example and how
app talk to driver with IOCTL (
http://support.microsoft.com/default...;EN-US;Q262305 )
Arkady

"Mel" <Mel_Olonsky@gmx.net> wrote in message
news:ufHn2H9nEHA.3224@tk2msftngp13.phx.gbl...
> Hello,
>
> I'm new to driver development, in fact I have never written
> a real mode sys file nor a driver. Now I have to accomplish the following
> task:
> A program generates virtual key events to control a directx game.
> Because directx directly reads out the keyboard I can't simply use the
> WinAPI keybd_event or a simple SendKeys function. So the best way
> seems to be to send the keystrokes from my application (can be delphi, c++
> or vb)
> to the keyboard filter driver that creates the keystroke.
>
> Therefore I register a new keyboardchain filter KbdFilterInit
>
> Then I'd like to feed keys into the keyboard chain to simulate button

press
> events. Therefore I create KeyData packets.
>
> To process the keyboard chain I implement proper dispatch
> function for reading
> NTSTATUS
> KbdDispatchRead(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
>
> So my questions are:
> Is there already something similar out there that I can use?
> Is it possible to create such a driver file without getting 1000s of
> blue screens?
> What's the easiest way to do this.
> How can I send some bytes from my app to the driver? (My app tells the
> driver to generate an 'F1' keystroke...)
> Is my theory correct?
>
> I hope to get some help from you.
> Thanks for any hints
> Mel
>
> NTSTATUS
> KbdFilterInit(
> IN PDRIVER_OBJECT DriverObject
> )
> /*++
>
> Routine Description:
>
> Create a device object and attaches it to the
> first keyboard device chain
>
> Arguments:
>
> DeviceObject - pointer to a device object.
>
> Return Value:
>
> NT Status code
>
> --*/
>
>
> {
> UNICODE_STRING ntUnicodeString;
> NTSTATUS ntStatus;
> PDEVICE_OBJECT DeviceObject = NULL;
>
> //
> // Only hook onto the first keyboard's chain.
> //
> RtlInitUnicodeString( &ntUnicodeString, L"\\Device\\KeyboardClass0" );
> //
> // Create device object for the keyboard.
> //
> ntStatus = IoCreateDevice( DriverObject,
> 0,
> NULL,
> FILE_DEVICE_KEYBOARD,
> 0,
> FALSE,
> &DeviceObject );
>
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Keyboard hook failed to create device!\n"));
> return ntStatus;
> }
> //
> // Keyboard uses buffered I/O so we must as well.
> //
> DeviceObject->Flags |= DO_BUFFERED_IO;
> //
> // Attach to the keyboard chain.
> //
> ntStatus = IoAttachDevice( DeviceObject, &ntUnicodeString,
> &pGlobalDevExt->KbdDevice );
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Connect with keyboard failed!\n"));
> IoDeleteDevice( DeviceObject );
> return ntStatus;
> }
> pGlobalDevExt->KbdFilterDevice = DeviceObject;
>
> return STATUS_SUCCESS;
> }
>
>
>
> //
> // Create a keyboard packet
> //
> KeyData = pGlobalDevExt->RawKbdIrp->AssociatedIrp.SystemBuffer;
>
> RtlZeroMemory(KeyData, 2*sizeof(KEYBOARD_INPUT_DATA));
> KeyData[numKeys].Flags = 0; //down
> KeyData[numKeys+1].Flags = 1; //up
> KeyData[numKeys].MakeCode = 0x1e; // character a
> KeyData[numKeys+1].MakeCode = 0x1e; // character a
> numKeys += 2;
> KeyData += numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrp->IoStatus.Status = STATUS_SUCCESS;
> pGlobalDevExt->RawKbdIrp->IoStatus.Information =
> numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrpPending = FALSE;
> IoCompleteRequest(pGlobalDevExt->RawKbdIrp,

IO_KEYBOARD_INCREMENT);
>
>
>



Reply With Quote
  #3  
Old 21-09-2004
Doron Holan [MS]
 
Posts: n/a
Re: Keyboard filter to simulate keys

which OS do you need this to work on? if it is win2k and forward, you can
just use SendInput() from user mode.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Mel" <Mel_Olonsky@gmx.net> wrote in message
news:ufHn2H9nEHA.3224@tk2msftngp13.phx.gbl...
> Hello,
>
> I'm new to driver development, in fact I have never written
> a real mode sys file nor a driver. Now I have to accomplish the following
> task:
> A program generates virtual key events to control a directx game.
> Because directx directly reads out the keyboard I can't simply use the
> WinAPI keybd_event or a simple SendKeys function. So the best way
> seems to be to send the keystrokes from my application (can be delphi, c++
> or vb)
> to the keyboard filter driver that creates the keystroke.
>
> Therefore I register a new keyboardchain filter KbdFilterInit
>
> Then I'd like to feed keys into the keyboard chain to simulate button
> press
> events. Therefore I create KeyData packets.
>
> To process the keyboard chain I implement proper dispatch
> function for reading
> NTSTATUS
> KbdDispatchRead(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
>
> So my questions are:
> Is there already something similar out there that I can use?
> Is it possible to create such a driver file without getting 1000s of
> blue screens?
> What's the easiest way to do this.
> How can I send some bytes from my app to the driver? (My app tells the
> driver to generate an 'F1' keystroke...)
> Is my theory correct?
>
> I hope to get some help from you.
> Thanks for any hints
> Mel
>
> NTSTATUS
> KbdFilterInit(
> IN PDRIVER_OBJECT DriverObject
> )
> /*++
>
> Routine Description:
>
> Create a device object and attaches it to the
> first keyboard device chain
>
> Arguments:
>
> DeviceObject - pointer to a device object.
>
> Return Value:
>
> NT Status code
>
> --*/
>
>
> {
> UNICODE_STRING ntUnicodeString;
> NTSTATUS ntStatus;
> PDEVICE_OBJECT DeviceObject = NULL;
>
> //
> // Only hook onto the first keyboard's chain.
> //
> RtlInitUnicodeString( &ntUnicodeString, L"\\Device\\KeyboardClass0" );
> //
> // Create device object for the keyboard.
> //
> ntStatus = IoCreateDevice( DriverObject,
> 0,
> NULL,
> FILE_DEVICE_KEYBOARD,
> 0,
> FALSE,
> &DeviceObject );
>
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Keyboard hook failed to create device!\n"));
> return ntStatus;
> }
> //
> // Keyboard uses buffered I/O so we must as well.
> //
> DeviceObject->Flags |= DO_BUFFERED_IO;
> //
> // Attach to the keyboard chain.
> //
> ntStatus = IoAttachDevice( DeviceObject, &ntUnicodeString,
> &pGlobalDevExt->KbdDevice );
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Connect with keyboard failed!\n"));
> IoDeleteDevice( DeviceObject );
> return ntStatus;
> }
> pGlobalDevExt->KbdFilterDevice = DeviceObject;
>
> return STATUS_SUCCESS;
> }
>
>
>
> //
> // Create a keyboard packet
> //
> KeyData = pGlobalDevExt->RawKbdIrp->AssociatedIrp.SystemBuffer;
>
> RtlZeroMemory(KeyData, 2*sizeof(KEYBOARD_INPUT_DATA));
> KeyData[numKeys].Flags = 0; //down
> KeyData[numKeys+1].Flags = 1; //up
> KeyData[numKeys].MakeCode = 0x1e; // character a
> KeyData[numKeys+1].MakeCode = 0x1e; // character a
> numKeys += 2;
> KeyData += numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrp->IoStatus.Status = STATUS_SUCCESS;
> pGlobalDevExt->RawKbdIrp->IoStatus.Information =
> numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrpPending = FALSE;
> IoCompleteRequest(pGlobalDevExt->RawKbdIrp, IO_KEYBOARD_INCREMENT);
>
>
>



Reply With Quote
  #4  
Old 22-09-2004
Mel
 
Posts: n/a
Re: Keyboard filter to simulate keys

Thanks for your help.
SendInput sounds really easy, too easy.
Some forums mention that directx really reads
the keyboard events directly from the keyboard
and things like keybd_event or SendInput wont work.

There is a way to hook the Directx Api function SendDeviceData and
inject keystrokes there. But therefgore you have to replace the directx dll
with your own.

I work with win2k and winxp.

Thanks for your tips.
-Mel

"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:OfLi17%23nEHA.1608@TK2MSFTNGP15.phx.gbl...
which OS do you need this to work on? if it is win2k and forward, you can
just use SendInput() from user mode.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Mel" <Mel_Olonsky@gmx.net> wrote in message
news:ufHn2H9nEHA.3224@tk2msftngp13.phx.gbl...
> Hello,
>
> I'm new to driver development, in fact I have never written
> a real mode sys file nor a driver. Now I have to accomplish the following
> task:
> A program generates virtual key events to control a directx game.
> Because directx directly reads out the keyboard I can't simply use the
> WinAPI keybd_event or a simple SendKeys function. So the best way
> seems to be to send the keystrokes from my application (can be delphi, c++
> or vb)
> to the keyboard filter driver that creates the keystroke.
>
> Therefore I register a new keyboardchain filter KbdFilterInit
>
> Then I'd like to feed keys into the keyboard chain to simulate button
> press
> events. Therefore I create KeyData packets.
>
> To process the keyboard chain I implement proper dispatch
> function for reading
> NTSTATUS
> KbdDispatchRead(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
>
> So my questions are:
> Is there already something similar out there that I can use?
> Is it possible to create such a driver file without getting 1000s of
> blue screens?
> What's the easiest way to do this.
> How can I send some bytes from my app to the driver? (My app tells the
> driver to generate an 'F1' keystroke...)
> Is my theory correct?
>
> I hope to get some help from you.
> Thanks for any hints
> Mel
>
> NTSTATUS
> KbdFilterInit(
> IN PDRIVER_OBJECT DriverObject
> )
> /*++
>
> Routine Description:
>
> Create a device object and attaches it to the
> first keyboard device chain
>
> Arguments:
>
> DeviceObject - pointer to a device object.
>
> Return Value:
>
> NT Status code
>
> --*/
>
>
> {
> UNICODE_STRING ntUnicodeString;
> NTSTATUS ntStatus;
> PDEVICE_OBJECT DeviceObject = NULL;
>
> //
> // Only hook onto the first keyboard's chain.
> //
> RtlInitUnicodeString( &ntUnicodeString, L"\\Device\\KeyboardClass0" );
> //
> // Create device object for the keyboard.
> //
> ntStatus = IoCreateDevice( DriverObject,
> 0,
> NULL,
> FILE_DEVICE_KEYBOARD,
> 0,
> FALSE,
> &DeviceObject );
>
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Keyboard hook failed to create device!\n"));
> return ntStatus;
> }
> //
> // Keyboard uses buffered I/O so we must as well.
> //
> DeviceObject->Flags |= DO_BUFFERED_IO;
> //
> // Attach to the keyboard chain.
> //
> ntStatus = IoAttachDevice( DeviceObject, &ntUnicodeString,
> &pGlobalDevExt->KbdDevice );
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Connect with keyboard failed!\n"));
> IoDeleteDevice( DeviceObject );
> return ntStatus;
> }
> pGlobalDevExt->KbdFilterDevice = DeviceObject;
>
> return STATUS_SUCCESS;
> }
>
>
>
> //
> // Create a keyboard packet
> //
> KeyData = pGlobalDevExt->RawKbdIrp->AssociatedIrp.SystemBuffer;
>
> RtlZeroMemory(KeyData, 2*sizeof(KEYBOARD_INPUT_DATA));
> KeyData[numKeys].Flags = 0; //down
> KeyData[numKeys+1].Flags = 1; //up
> KeyData[numKeys].MakeCode = 0x1e; // character a
> KeyData[numKeys+1].MakeCode = 0x1e; // character a
> numKeys += 2;
> KeyData += numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrp->IoStatus.Status = STATUS_SUCCESS;
> pGlobalDevExt->RawKbdIrp->IoStatus.Information =
> numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrpPending = FALSE;
> IoCompleteRequest(pGlobalDevExt->RawKbdIrp, IO_KEYBOARD_INCREMENT);
>
>
>




Reply With Quote
  #5  
Old 22-09-2004
Ray Trent
 
Posts: n/a
Re: Keyboard filter to simulate keys

Well, don't believe everything you read here (including this :-).

SendInput works fine with DirectInput on 2k and XP.

Of course, it may be possible to create a situation where it doesn't
work, like some app opening a *specific* keyboard instead of the
meta-keyboard GUID_SysKeyboard (I haven't verified this scenario). But
even with a filter, you're going to have that problem, because you can't
send your keys to *all* keyboards with a filter, just to one particular
one (otherwise you'd end up with duplicate key presses, which you
probably don't want).

Mel wrote:
> Thanks for your help.
> SendInput sounds really easy, too easy.
> Some forums mention that directx really reads
> the keyboard events directly from the keyboard
> and things like keybd_event or SendInput wont work.
>
> There is a way to hook the Directx Api function SendDeviceData and
> inject keystrokes there. But therefgore you have to replace the directx dll
> with your own.
>
> I work with win2k and winxp.
>
> Thanks for your tips.
> -Mel
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:OfLi17%23nEHA.1608@TK2MSFTNGP15.phx.gbl...
> which OS do you need this to work on? if it is win2k and forward, you can
> just use SendInput() from user mode.
>
> d
>


--
.../ray\..

Please remove ".spamblock" from my email address if you need to contact
me outside the newsgroup.
Reply With Quote
  #6  
Old 22-09-2004
Doron Holan [MS]
 
Posts: n/a
Re: Keyboard filter to simulate keys

ray's right. SendInput() will work just fine for you. no need for a
driver.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Ray Trent" <rat@synaptics.spamblock.com> wrote in message
news:u1H586CoEHA.2808@TK2MSFTNGP10.phx.gbl...
> Well, don't believe everything you read here (including this :-).
>
> SendInput works fine with DirectInput on 2k and XP.
>
> Of course, it may be possible to create a situation where it doesn't work,
> like some app opening a *specific* keyboard instead of the meta-keyboard
> GUID_SysKeyboard (I haven't verified this scenario). But even with a
> filter, you're going to have that problem, because you can't send your
> keys to *all* keyboards with a filter, just to one particular one
> (otherwise you'd end up with duplicate key presses, which you probably
> don't want).
>
> Mel wrote:
>> Thanks for your help.
>> SendInput sounds really easy, too easy.
>> Some forums mention that directx really reads
>> the keyboard events directly from the keyboard
>> and things like keybd_event or SendInput wont work.
>>
>> There is a way to hook the Directx Api function SendDeviceData and
>> inject keystrokes there. But therefgore you have to replace the directx
>> dll
>> with your own.
>>
>> I work with win2k and winxp.
>>
>> Thanks for your tips.
>> -Mel
>>
>> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
>> news:OfLi17%23nEHA.1608@TK2MSFTNGP15.phx.gbl...
>> which OS do you need this to work on? if it is win2k and forward, you can
>> just use SendInput() from user mode.
>>
>> d
>>

>
> --
> ../ray\..
>
> Please remove ".spamblock" from my email address if you need to contact me
> outside the newsgroup.



Reply With Quote
  #7  
Old 23-09-2004
Mel
 
Posts: n/a
Re: Keyboard filter to simulate keys


Thanks for your opinions. I will implement the SendInput option,
this really saves me a lot of work.
In one or two days I will know if it works with DirectX or not.

Thanks
Mel


"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:OfLi17%23nEHA.1608@TK2MSFTNGP15.phx.gbl...
which OS do you need this to work on? if it is win2k and forward, you can
just use SendInput() from user mode.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Mel" <Mel_Olonsky@gmx.net> wrote in message
news:ufHn2H9nEHA.3224@tk2msftngp13.phx.gbl...
> Hello,
>
> I'm new to driver development, in fact I have never written
> a real mode sys file nor a driver. Now I have to accomplish the following
> task:
> A program generates virtual key events to control a directx game.
> Because directx directly reads out the keyboard I can't simply use the
> WinAPI keybd_event or a simple SendKeys function. So the best way
> seems to be to send the keystrokes from my application (can be delphi, c++
> or vb)
> to the keyboard filter driver that creates the keystroke.
>
> Therefore I register a new keyboardchain filter KbdFilterInit
>
> Then I'd like to feed keys into the keyboard chain to simulate button
> press
> events. Therefore I create KeyData packets.
>
> To process the keyboard chain I implement proper dispatch
> function for reading
> NTSTATUS
> KbdDispatchRead(
> IN PDEVICE_OBJECT DeviceObject,
> IN PIRP Irp
> )
>
> So my questions are:
> Is there already something similar out there that I can use?
> Is it possible to create such a driver file without getting 1000s of
> blue screens?
> What's the easiest way to do this.
> How can I send some bytes from my app to the driver? (My app tells the
> driver to generate an 'F1' keystroke...)
> Is my theory correct?
>
> I hope to get some help from you.
> Thanks for any hints
> Mel
>
> NTSTATUS
> KbdFilterInit(
> IN PDRIVER_OBJECT DriverObject
> )
> /*++
>
> Routine Description:
>
> Create a device object and attaches it to the
> first keyboard device chain
>
> Arguments:
>
> DeviceObject - pointer to a device object.
>
> Return Value:
>
> NT Status code
>
> --*/
>
>
> {
> UNICODE_STRING ntUnicodeString;
> NTSTATUS ntStatus;
> PDEVICE_OBJECT DeviceObject = NULL;
>
> //
> // Only hook onto the first keyboard's chain.
> //
> RtlInitUnicodeString( &ntUnicodeString, L"\\Device\\KeyboardClass0" );
> //
> // Create device object for the keyboard.
> //
> ntStatus = IoCreateDevice( DriverObject,
> 0,
> NULL,
> FILE_DEVICE_KEYBOARD,
> 0,
> FALSE,
> &DeviceObject );
>
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Keyboard hook failed to create device!\n"));
> return ntStatus;
> }
> //
> // Keyboard uses buffered I/O so we must as well.
> //
> DeviceObject->Flags |= DO_BUFFERED_IO;
> //
> // Attach to the keyboard chain.
> //
> ntStatus = IoAttachDevice( DeviceObject, &ntUnicodeString,
> &pGlobalDevExt->KbdDevice );
> if( !NT_SUCCESS(ntStatus) ) {
> JKBD_DbgPrint(("JKBD: Connect with keyboard failed!\n"));
> IoDeleteDevice( DeviceObject );
> return ntStatus;
> }
> pGlobalDevExt->KbdFilterDevice = DeviceObject;
>
> return STATUS_SUCCESS;
> }
>
>
>
> //
> // Create a keyboard packet
> //
> KeyData = pGlobalDevExt->RawKbdIrp->AssociatedIrp.SystemBuffer;
>
> RtlZeroMemory(KeyData, 2*sizeof(KEYBOARD_INPUT_DATA));
> KeyData[numKeys].Flags = 0; //down
> KeyData[numKeys+1].Flags = 1; //up
> KeyData[numKeys].MakeCode = 0x1e; // character a
> KeyData[numKeys+1].MakeCode = 0x1e; // character a
> numKeys += 2;
> KeyData += numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrp->IoStatus.Status = STATUS_SUCCESS;
> pGlobalDevExt->RawKbdIrp->IoStatus.Information =
> numKeys*sizeof(KEYBOARD_INPUT_DATA);
> pGlobalDevExt->RawKbdIrpPending = FALSE;
> IoCompleteRequest(pGlobalDevExt->RawKbdIrp, IO_KEYBOARD_INCREMENT);
>
>
>




Reply With Quote
  #8  
Old 07-12-2007
Member
 
Join Date: Dec 2007
Posts: 1
Keyboard filter

Hi Mel,

Can you please let me know, how did you communicated to kbfiltr from your application.

Regards,
J. Joshua David
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Windows XP > Windows XP Support
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Keyboard filter to simulate keys"
Thread Thread Starter Forum Replies Last Post
How to modify scan code of WDM keyboard filter driver tHeDa! Software Development 1 25-02-2012 12:42 PM
BlackBerry curve 9360 simulator does not simulate the physical keys and track pad properly Stavita Portable Devices 3 23-10-2011 10:59 PM
Quick keys/volume control keys of Dell Wireless keyboard became inoperative Dimensioner Hardware Peripherals 3 07-03-2011 01:17 AM
asus keyboard does not recognised some keys/ keyboard issues McGrawh Hardware Peripherals 3 02-09-2009 02:51 PM
Problem keyboard keys F1 F2 F3 F.. Daryl Hardware Peripherals 2 19-12-2008 06:33 PM


All times are GMT +5.5. The time now is 10:04 AM.