Writing driver to simulate keypresses

Discussion in 'Windows Vista Drivers' started by Arik Yavilevich, Sep 13, 2004.

  1. Hello,

    I need to be able to simulate keypresses on the driver level so that
    DirectInput applications will receive the input too.
    If any of you knows an existing product that does this I would like to
    know. Since I didn't find anything that does this I am planning to
    write a driver myself and I need basic guidance. Here are the

    1 Should I go for a filter (kbfilter) or a whole new device
    2 If I go for a filter. Will it be able to "sit" on PS/2 and USB
    3 Where should I put my driver? Should it be upper, lower? Do I put it
    between the i8042ptr and the keyboard class driver or somewhere else?
    4 I need to send messages from the user mode to the driver to tell it
    what keys to simulate. I read an article that in certain cases I can't
    use DeviceIoControl. Is that true? Will I have to create a separate
    device to funcion as an interface? What is WMI? Can I use WMI to
    communicate with the driver?

    Thanks a lot,
    Arik Yavilevich, Sep 13, 2004
    1. Advertisements

  2. I have no problems to use keybd_event for Win 2000 and XP.
    For Win 98 write a small VxD which pushes the keys into the real
    keyboard buffer.
    I used a Win98 DDK example for that which was easy to extend. The driver
    is loaded dynamically by an application.
    Robert Marquardt, Sep 13, 2004
    1. Advertisements

  3. Maybe the problems with keybd_event come from not filling in all parameters.
    Robert Marquardt, Sep 13, 2004
  4. on win2k and beyond, you can use keybd_event or SendInput. All of the
    technologies/samples except for vhidmini you mention below only work on
    win2k and beyond. based on your previous post, you need to get this working
    on win9x. on win9x, vhidmini is probably the simplest way to go in terms of
    language b/c you can write a WDM .sys driver. if you want to talk directly
    to the win9x keyboard input subsystem, you have to write a vxd.

    Doron Holan [MS], Sep 13, 2004
  5. Thanks Robert, I am trying this too.
    What about using a driver. Can anyone answer my questions above?

    Arik Yavilevich, Sep 13, 2004
  6. Robert, you are the king! Apparently you have to fill in the bScan
    parameter of keybd_event even though the MSDN says "This parameter is
    not used". When I think of it now it seems logical since DI works with
    scan codes. But go figure...
    I don't plan to support Win98 for now so I will probably drop the
    driver idea at all.

    Thanks a lot!
    Arik Yavilevich, Sep 13, 2004
    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.