Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Simple Keyboard filtering driver

Adam_OlszakAdam_Olszak Member Posts: 2
Hello,

First of all: I'm new when it goes to driver development. I went through tutorial(s) and I read a lot about drivers and how it should work but since I don't have knowledge I'm experiencing issues from the very begining... But let me explain my "simple task"

- I need to write a keyboard filter - HID keyboard.
- I understand that it needs to be in the Kernel space - KMDF - WDF
- I took a solution in VS 2015 for Kernel drivers and I adopted it based on OSR WDF Filtering driver tutorial
- The driver inf file is based on firefly example from MS (mouse filtering). More/less the same idea. I've narrowed it to a single specific keyboard

====
Current state:
The driver installs on my remote machine without issues. I'm able to deploy it and I see it in the Device Manager. It is shown as a "Upper Filter" in the Device Manager. I was able to get Kernel Debug logs (via DbgPrint) and the driver is created without issues - all statuses were ok. I set my driver as filter, created device, created queue and "subscribed" my own callbacks for read/write enents.

And the last thing (read/write) callbacks are not called at all.

Driver files visible in Device Manager:
IngacoFltr.sys (mine)
kdbclass.sys
kbdhid.sys
SynTP.sys (this is laptop specific)

Upper Filter: IngacoFltr

Device stack:
\Driver\kdbclass
\Driver\SynTP
\Driver\IngacoFltr
\Driver\kbdhid
\Driver\HidUsb

Any comments apprieciated ;).

Comments

  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,373
    What do you want the filter to do? The kbdfiltr sample is a better starting point as it has all of the relevant pieces wired in. For drivers below kbdclass you will not see reads/writes. Instead you hook the keyboard service callback chain and use it to inspect, inject, and/or reject input

    Bent from my phone
    ________________________________
    From: xxxxx@lists.osr.com on behalf of xxxxx@interia.pl
    Sent: Friday, April 21, 2017 5:32:00 AM
    To: Windows System Software Devs Interest List
    Subject: [ntdev] Simple Keyboard filtering driver

    Hello,

    First of all: I'm new when it goes to driver development. I went through tutorial(s) and I read a lot about drivers and how it should work but since I don't have knowledge I'm experiencing issues from the very begining... But let me explain my "simple task"

    - I need to write a keyboard filter - HID keyboard.
    - I understand that it needs to be in the Kernel space - KMDF - WDF
    - I took a solution in VS 2015 for Kernel drivers and I adopted it based on OSR WDF Filtering driver tutorial
    - The driver inf file is based on firefly example from MS (mouse filtering). More/less the same idea. I've narrowed it to a single specific keyboard

    ====
    Current state:
    The driver installs on my remote machine without issues. I'm able to deploy it and I see it in the Device Manager. It is shown as a "Upper Filter" in the Device Manager. I was able to get Kernel Debug logs (via DbgPrint) and the driver is created without issues - all statuses were ok. I set my driver as filter, created device, created queue and "subscribed" my own callbacks for read/write enents.

    And the last thing (read/write) callbacks are not called at all.

    Driver files visible in Device Manager:
    IngacoFltr.sys (mine)
    kdbclass.sys
    kbdhid.sys
    SynTP.sys (this is laptop specific)

    Upper Filter: IngacoFltr

    Device stack:
    \Driver\kdbclass
    \Driver\SynTP
    \Driver\IngacoFltr
    \Driver\kbdhid
    \Driver\HidUsb

    Any comments apprieciated ;).








    ---
    NTDEV is sponsored by OSR

    Visit the list online at:

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
    Details at

    To unsubscribe, visit the List Server section of OSR Online at
  • Adam_OlszakAdam_Olszak Member Posts: 2
    Thank you for your response. Indeed, I should write what is all about more precisely.

    I would like to change some key mappings (it should be configurable by user) - more/less like it is for a normal keyboard. You press "Z" and you receive "Y" for example (that needs to be done only for a specific keyboard - and the mapping should be customizable - a few buttons can result as a single letter as an example).

    The kbdfiltr itself is quite big thing - specially that a lot of the code there seems to be PS/2 keyboard specific (correct me if I'm wrong). But I'm open for any suggestions.
  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,373
    It is a much better sample to start with for what you want to do. The ps2 stuff will be harmless as is or you can remove it (anything with 8042). How are you going to communicate the mappings? You can't open a direct handle to the filter (kbdclass blocks it) which is why kbdfiltr shows you how to create a raw pdo for that communication channel

    d

    -----Original Message-----
    From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@interia.pl
    Sent: Friday, April 21, 2017 7:37 AM
    To: Windows System Software Devs Interest List <xxxxx@lists.osr.com>
    Subject: RE:[ntdev] Simple Keyboard filtering driver

    Thank you for your response. Indeed, I should write what is all about more precisely.

    I would like to change some key mappings (it should be configurable by user) - more/less like it is for a normal keyboard. You press "Z" and you receive "Y" for example (that needs to be done only for a specific keyboard - and the mapping should be customizable - a few buttons can result as a single letter as an example).

    The kbdfiltr itself is quite big thing - specially that a lot of the code there seems to be PS/2 keyboard specific (correct me if I'm wrong). But I'm open for any suggestions.


    ---
    NTDEV is sponsored by OSR

    Visit the list online at: <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/showlists.cfm?list=ntdev&amp;data=02|01|[email protected]|d628cc995c4144bb0a5d08d488c3eeeb|72f988bf86f141af91ab2d7cd011db47|1|0|636283822542476150&amp;sdata=7udiJMNiQtvku99BPUA7j4jbmKfjODWNprkgAWmWHN4=&amp;reserved=0&gt;

    MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
    Details at <https://na01.safelinks.protection.outlook.com/?url=http://www.osr.com/seminars&amp;data=02|01|[email protected]|d628cc995c4144bb0a5d08d488c3eeeb|72f988bf86f141af91ab2d7cd011db47|1|0|636283822542476150&amp;sdata=c/pX0AIZKfhZ5e21U6ZN//pmBNlvRjGew1b9IcieuUQ=&amp;reserved=0&gt;

    To unsubscribe, visit the List Server section of OSR Online at <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/page.cfm?name=ListServer&amp;data=02|01|[email protected]|d628cc995c4144bb0a5d08d488c3eeeb|72f988bf86f141af91ab2d7cd011db47|1|0|636283822542486164&amp;sdata=A+uCOS1u0SoJl1r9cWucGFeBt4vPCKV2CafcecJlPvI=&amp;reserved=0&gt;
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!