How to write a keyboard filter driver to simulate keys

Discussion in 'Windows Vista Drivers' started by Vamsi Krishna, Jun 20, 2005.

  1. Hi,

    I am a newbie to Windows Driver Development.
    I want to develop a keyboard filter driver that can simulate keys based on
    IOCTL requests from a my own Windows Service to my driver. Essentially I need
    to fake some of the keys as if they are generated physically using a physical
    keyboard device. I have gone through the Windows DDK and the documentation to
    some extent, but I would appreciate a quick tutorial or links that can help
    me pick up the skills faster in this specific area.

    Thanks in advance.
    Vamsi Krishna, Jun 20, 2005
    1. Advertisements

  2. Follow these two samples from the Server 2003 SP1 DDK:

    1) WINDDK\3790.1830\src\input\kbfiltr - this one is a device upper filter
    for PS/2 keyboard
    2) WINDDK\3790.1830\src\general\toaster\filter\ - this one is generic device
    filter. Take the ioctl-interface code from this sample and incorporate in
    the kbfiltr. Read;EN-US;Q262305 on why you
    need to do this.

    Then search this newsgroup at google for several examples on how to insert
    keys into the keyboard stream.
    Eliyas Yakub [MSFT], Jun 20, 2005
    1. Advertisements

  3. Vamsi Krishna

    Ray Trent Guest

    Step 0: Make sure you completely understand *why* you think you need to
    do this. 95% of the time, it's equally effective to call SendInput from
    user mode. Injecting keystrokes is only rarely a good reason to write a
    kbfiltr. Normally, the reason to do that is to change or remove
    keystrokes from the stream rather than adding them.

    If you happen to be in the 5% case, a kbfiltr driver may be the only way
    to go, but don't do it just because you're worried about some case where
    SendInput might not work unless you've actually tested it yourself.
    Ray Trent, Jun 20, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.