Virtual HID Driver

Hello,

I am new to Windows drivers and am writing a virtual HID driver similar to the one’s available in the WDK 8.1 samples.

My issue is that when installed, the driver is always connected. How do I disconnect/connect the virtual device from a user-mode app?

What do you mean always connected? What do you mean by disconnect from the user mode app? You should also be using the win10 samples as they are more up to date

Get Outlook for Androidhttps:

From: xxxxx@gmail.com
Sent: Tuesday, September 13, 3:43 PM
Subject: [ntdev] Virtual HID Driver
To: Windows System Software Devs Interest List

Hello, I am new to Windows drivers and am writing a virtual HID driver similar to the one’s available in the WDK 8.1 samples. My issue is that when installed, the driver is always connected. How do I disconnect/connect the virtual device from a user-mode app? — 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</https:>

I wanted to use the latest but unfortunately downloaded the latest WDK, and the example doesn’t build (a known issue I believe).

Essentially, vhidmini (from the 8.1 examples) builds, but the driver is always in Device Manager and in the driver’s Properties, is connected & is present. This is specifically a problem because I am creating an external stylus driver, and if it is present, the on screen keyboard appears on login. Disabling the driver fixes the issue.

In my app, I write data to the driver to control the stylus, but I’d also like to be able to detach and attach the driver so that the on screen keyboard does not appear.

I should also mention in VS2015 with vhidmini2 (the WDK 10 examples), I can’t see the StampInf property page on the left. How would I enable that?

There is no disconnect/connect semantic in HID. As a root enumerated device, you are always enumerated and present. The way you “Disconnect” is that the stack is torn down (due to removal of hardware or driver disable or driver uninstall). You can have two drivers

  1. a root enumerated bus driver (toaster is a starting point) that creates the HID PDO on demand based on whatever state you want
  2. your hid mini driver loads on this PDO instead of the root enumerated device

You then control the enumeration state of the HID stack and can report the device as present or missing in the bus driver.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, September 13, 2016 7:15 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual HID Driver

I wanted to use the latest but unfortunately downloaded the latest WDK, and the example doesn’t build (a known issue I believe).

Essentially, vhidmini (from the 8.1 examples) builds, but the driver is always in Device Manager and in the driver’s Properties, is connected & is present. This is specifically a problem because I am creating an external stylus driver, and if it is present, the on screen keyboard appears on login. Disabling the driver fixes the issue.

In my app, I write data to the driver to control the stylus, but I’d also like to be able to detach and attach the driver so that the on screen keyboard does not appear.


NTDEV is sponsored by OSR

Visit the list online at: http:

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

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

Yeah, disabling the driver requires admin, so it isn’t the best route. Is there a way to simulate removal of hardware for a virtual driver?

I can make an attempt at the bus driver, but I am new to this. How sophisticated is that solution?

Is there a simpler way to prevent the on screen keyboard from appearing on login? I think this is Windows doing this (I don’t want to disable the Tablet PC Service since some computers utilize that).

I know I can simulate an integrated pen (0x02) instead of an external one, which solves the problem but that only works for the primary display. I’d like to be able to choose an arbitrary display (without user interaction). Is there a way to do that?

Installing requires admin as well. You can’t simulate removal of hardware (disable) for a root enumerated device, all you can do is uninstall it.

The toaster bus sample (the static bus version) is pretty much exactly what you want modulo the IDs it uses for PDO. Everything else is completely reusable. The enum.exe part of the sample shows you how to tell the bus what to enumerate or report missing

I have no idea about the on screen keyboard or pen questions

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, September 13, 2016 9:13 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Virtual HID Driver

Yeah, disabling the driver requires admin, so it isn’t the best route. Is there a way to simulate removal of hardware for a virtual driver?

I can make an attempt at the bus driver, but I am new to this. How sophisticated is that solution?

Is there a simpler way to prevent the on screen keyboard from appearing on login? I think this is Windows doing this (I don’t want to disable the Tablet PC Service since some computers utilize that).

I know I can simulate an integrated pen (0x02) instead of an external one, which solves the problem but that only works for the primary display. I’d like to be able to choose an arbitrary display (without user interaction). Is there a way to do that?


NTDEV is sponsored by OSR

Visit the list online at: http:

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

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

I can actually disable a root device, but simulating plugging in/unplugging would ideally not require admin.

I tested out toaster and it seems great, but I think enum requires admin to plug/unplug. Is that correct? I can’t run it successfully from a regular command prompt.

This is under your control as it depends on what security you put on the bus
driver’s device object. See:

Controlling Device Access in KMDF Drivers
https://msdn.microsoft.com/en-us/windows/hardware/drivers/wdf/controlling-device-access-in-kmdf-drivers

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

I can actually disable a root device, but simulating plugging in/unplugging
would ideally not require admin.

I tested out toaster and it seems great, but I think enum requires admin to
plug/unplug. Is that correct? I can’t run it successfully from a regular
command prompt.

What fails when you run enum? The bus driver specified the security (sddl) for the device the app is opening. Disable requires admin and can fail if an app with an open handle doesn’t process the removal notification. The bus driver reporting the child missing always works

Get Outlook for Androidhttps:

From: xxxxx@gmail.com
Sent: Wednesday, September 14, 7:20 AM
Subject: RE:[ntdev] Virtual HID Driver
To: Windows System Software Devs Interest List

I can actually disable a root device, but simulating plugging in/unplugging would ideally not require admin. I tested out toaster and it seems great, but I think enum requires admin to plug/unplug. Is that correct? I can’t run it successfully from a regular command prompt. — 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</https:>