none
keyboard driver to sendkeys RRS feed

  • Question

  • I want to write a keyboard driver to be able to send keys on a key pressed.

    Lets say when I press ctrl+H to send keys "Hello" instead of the ctrl+H

    is it possible?

    Is it easy?

    Is there any sample code that does something similar?

    Saturday, February 16, 2019 7:23 PM

Answers

All replies

  • Why a keyboard driver ?

    Just use a keyboard hook (WH_KEYBOARD_LL)

    Saturday, February 16, 2019 7:27 PM
  • I want to create a presentation so I want to send keys to different applications when I want them.

    I tried with c# sendkeys or keyboard hook but some applications do not accept sending keys on them.

    Monday, February 18, 2019 8:22 AM
  • A hook + SendInput works for any application 

    Monday, February 18, 2019 8:36 AM
  • You should try Castorix31's solution and only consider a driver if Hook + SendInput doesn't work. I've written a virtual keyboard driver and it is a lot of work.

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Thursday, February 21, 2019 6:29 PM
    Moderator
  • I tried SendInput and does not work on every application
    Friday, February 22, 2019 7:22 PM
  • There are some virtual keyboard drivers on GitHub, which you may find helpful

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, February 22, 2019 7:27 PM
    Moderator
  • I tried SendInput and does not work on every application

    Which application ?!

    I tested it even on games (DirectX) ant it has always worked...


    • Edited by Castorix31 Friday, February 22, 2019 7:59 PM
    Friday, February 22, 2019 7:58 PM
  • SendInput is subject to UIPI restrictions, so you cannot send input to a window for an application running at a higher integrity level

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, February 22, 2019 8:51 PM
    Moderator
  • I tried SendInput and does not work on every application

    Which application ?!

    I tested it even on games (DirectX) ant it has always worked...


    I tried it on 4story game and does not work
    Sunday, February 24, 2019 7:44 AM
  • There are some virtual keyboard drivers on GitHub, which you may find helpful

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    https://developer.microsoft.com/en-us/windows/hardware/drivers-code-samples

    links like the above do not help.

    do you have something else in your mind?

    Sunday, February 24, 2019 7:47 AM
  • I tried it on 4story game and does not work

    As Brian said, you must be Admin for some apps (with a Manifest for example)
    Sunday, February 24, 2019 8:54 AM
  • I tried SendInput and does not work on every application

    Which application ?!

    I tested it even on games (DirectX) ant it has always worked...


    I tried it on 4story game and does not work

    4Story uses GameGuard

    (I cannot give links to bypass it... Google is enough)

    Sunday, February 24, 2019 11:19 AM
  • It looks like you need to improve your Google-Fu. Try searching for this: virtual keyboard site:github.com

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Sunday, February 24, 2019 6:56 PM
    Moderator
  • the closer sample found is https://github.com/Microsoft/Windows-driver-samples/tree/master/input/kbfiltr

    and the source code created is https://drive.google.com/open?id=1nvKHY1pUDYVD0xmCovStRiuPPMlMQA8l

    I managed to built it, and deploy it to a Win10 virtual machine.

    Also I run kdbtest.exe and the driver was alive.

    How can I send keystrokes from kbdtest to the driver? Can someone help on this?

    Friday, March 1, 2019 2:19 PM
  • the sample demonstrates a raw PDO. you open the raw PDO and send custom IOCTls to it.  from the raw PDO, you send the commands to the keyboard filter device.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, March 1, 2019 6:07 PM
  • I am not familiar with all these.

    Where should I inject code to the kbftest and where to the kbfilter?

    Saturday, March 2, 2019 1:36 PM