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

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

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Virtual Hid Driver - how to design a bidirectional communication between two applications?

geeklostinwoodsgeeklostinwoods Member Posts: 4

I have an application that is written in c# (exe) - which would need to communicate with another windows applications (possibly written in c++ / c#). I could have easily exposed api or any other methods. But then the third party application insists I use Hid.

given that, I have few choices and would like to ask what would be the best design choice here:
implement a KMDF Virtual Hid driver. This driver would be a relay in-between the my application and the other application. My application will send a command to the driver and driver will relay it back to the other application. I would use input report for one way and output reports for other way. but this design looks not very good.

I guess I couldn't get away with just writing a umdf based simple hid mini driver of some sort and use that as a relay.

typical flow would be something like

Application A -> ask the driver what is the state of the device
driver then send this to a raw PDO in VHF
Application B -> will be always reading PDO and if it finds anything there, will send a report to the driver
drive will then send this back to the Application A

my question is : what is your opinion on this relay mechanism and what could i do to improve this design?

Comments

  • geeklostinwoodsgeeklostinwoods Member Posts: 4

    would it be possible to use virtual hid driver to create a communication between two applications, will this approach work. can two applications connect to same device? if so may be i could have seperate type of reports for each application and then use the driver to persist the information and communicate in between both, where the driver sits inbetween two application and collect information from both sides and relay the information

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,760

    Of course it's possible, but it's insane. NEVER do something in the kernel if there is an adequate solution available in user mode, and clearly there are dozens of interprocess communication solutions available in user mode. Sockets, pipes, memory-mapped files, custom window messages, shared objects. You need to find a SENSIBLE solution.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • MBond2MBond2 Member Posts: 233

    Did I miss something here? HID is a standard for mouse and keyboard right? And has nothing to do with inter-process communication?

    and if you are trying to do something like sending fake keystrokes (valid for some kinds of automated testing), look at the SendInput UM API

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,760

    Did I miss something here?

    No, you didn't. What he has proposed is, as I said, insane.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

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!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE