Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Virtual HID (keyboard and mouse) driver

932 views
Skip to first unread message

Aram Hăvărneanu

unread,
Dec 1, 2009, 11:50:01 AM12/1/09
to
Hello,

I wish to develop 2 drivers. One will act as a virtual keyboard and the
other as a virtual mouse.

Can I start from the vhidmini sample? (src\hid\vhidmini -- it's not
available in the lastest WDK, but it's in 6001.18002). From my understanding
this is a miniclass driver that should work with kbdclass and mouclass, the
class drivers for keyboards and mice. Basically all I would need is to
generate IRPs for the class drivers to process, right?

I never worked with HID, from my understanding HID drivers don't get IOCTLs,
that's why, if you need to comunicate with the driver, you need to do it some
other way. The vhidmini sample implements such a way. Also, never working
with HID, I don't really know what/how to generate the IRPs.

One thing I don't understand is how such a driver would work with multiple
sessions.

Thanks in advance for any resources and documentation!

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Dec 4, 2009, 8:34:01 AM12/4/09
to
I decided to start from the vhidmini sample but I can't install it on Windows
7 32 bit.

Y:\ws\kernel\vhidmini>devcon install vhidmini.inf
"{D49F883C-6486-400a-8C22-1A9EF48577E4}\HID_DEVICE"
Device node created. Install is complete when drivers are updated...
Updating drivers for devcon failed.

I checked the logs at:

%windir%\setupapi.log
%windir%\setupact.log
%windir%\setuperr.log
%windir%\inf\setupapi.app.log
%windir%\inf\setupapi.dev.log

and I have found this in %windir%\inf\setupapi.dev.log

>>> [Device Install (UpdateDriverForPlugAndPlayDevices) - “{D49F883C-6486-400a-8C22-1A9EF48577E4}\HID_DEVICE”]
>>> Section start 2009/12/04 15:23:58.556
cmd: devcon install vhidmini.inf
“{D49F883C-6486-400a-8C22-1A9EF48577E4}\HID_DEVICE”
dvi: Set selected driver complete.
dvi: {Build Driver List} 15:23:58.618
dvi: Searching for hardware ID(s):
dvi: “{d49f883c-6486-400a-8c22-1a9ef48577e4}\hid_device”
cpy: Policy is set to make all digital signatures equal.
dvi: Processing a single INF: 'y:\ws\kernel\vhidmini\vhidmini.inf'
inf: Opened INF: 'y:\ws\kernel\vhidmini\vhidmini.inf' ([strings])
dvi: {Build Driver List - exit(0x00000000)} 15:23:58.618
dvi: {DIF_SELECTBESTCOMPATDRV} 15:23:58.618
dvi: No class installer for 'Human Interface Devices'
dvi: No CoInstallers found
dvi: Default installer: Enter 15:23:58.618
dvi: {Select Best Driver}
! dvi: Selecting driver failed(0xe0000228)
dvi: {Select Best Driver - exit(0xe0000228)}
! dvi: Default installer: failed!
! dvi: Error 0xe0000228: There are no compatible drivers for this
device.
dvi: {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 15:23:58.634
<<< Section end 2009/12/04 15:23:58.634
<<< [Exit status: SUCCESS]

What am I missing?

Thanks,

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Dec 4, 2009, 10:26:01 AM12/4/09
to
I have also tried to start it with sc.exe. I have created a service with sc
create TestSrv type= kernel binPath= \path\to\vhidmini.sys and start the
service with sc start TestSrv but it fails with:

[SC] StartService FAILED 1058:

The service cannot be started, either because it is disabled or because
it has n
o enabled devices associated with it.

Aram Hăvărneanu

unread,
Dec 4, 2009, 11:06:01 AM12/4/09
to
Btw, I could install the driver with the aid of the Toaster sample (as it's
documented in the sample Readme), however, for my application I'd like to
load and unload the driver at runtime, as needed, using the the Service
Control Manager APIs.

So why are devcon.exe, sc.exe, and the Service Control Manager APIs failing?

Max

unread,
Dec 4, 2009, 4:28:48 PM12/4/09
to
On Fri, 4 Dec 2009 05:34:01 -0800, Aram H?v?rneanu
<AramHv...@discussions.microsoft.com> wrote:

>I decided to start from the vhidmini sample but I can't install it on Windows
>7 32 bit.
>
>Y:\ws\kernel\vhidmini>devcon install vhidmini.inf
>"{D49F883C-6486-400a-8C22-1A9EF48577E4}\HID_DEVICE"
>Device node created. Install is complete when drivers are updated...
>Updating drivers for devcon failed.

I had the same problem with the installation of vhidmini. Don't type
the devcon.exe ..... command directly into the command promp, but
instead create a batch file with this command inside and run it, in
this case it worked for me.

Aram Hăvărneanu

unread,
Dec 5, 2009, 5:51:01 AM12/5/09
to
"Max" wrote:
>
> I had the same problem with the installation of vhidmini. Don't type
> the devcon.exe ..... command directly into the command promp, but
> instead create a batch file with this command inside and run it, in
> this case it worked for me.
> .
>

Same error.

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Dec 5, 2009, 6:49:01 AM12/5/09
to
"Max" wrote:

>
> I had the same problem with the installation of vhidmini. Don't type
> the devcon.exe ..... command directly into the command promp, but
> instead create a batch file with this command inside and run it, in
> this case it worked for me.

> .
>

Didn't work on Windows 7, but worked on Windows 2003 Server x86. How is
running devcon.exe from a bat file any different to running it directly?

Also, I still can't load the driver with the service control manager api,
and although I can test the driver on NT 5.2 installed via bat file that
calls devcon, I need to be able to load it dynamically in my application.
Also, I need Windows Vista and 7.

Thanks,

--
Aram Hăvărneanu

Aram Hăvărneanu

unread,
Dec 5, 2009, 7:10:01 AM12/5/09
to
"Aram Hăvărneanu" wrote:

>
> How is
> running devcon.exe from a bat file any different to running it directly?
>

I think I may have an answer, I have copied the devcon line from the docs,
and in the docs it uses smart quotes. The bat file was created manually using
normal quotes. So that's why the bat file worked. If I type correct quotes in
the command line it works as well.

However I still have all the other problems (can't load the driver with the
SCM API, doesn't work on Windows 7, etc).

Thanks,

--
Aram Hăvărneanu

Max

unread,
Dec 5, 2009, 8:56:44 AM12/5/09
to
Have you set the administrative privileges to the devcon.exe into
windows 7? About how to load the driver the source code of devcon
program are in the DDK, you can study it for understand how this
software is able to load the driver.

regards

On Sat, 5 Dec 2009 04:10:01 -0800, Aram H?v?rneanu
<AramHv...@discussions.microsoft.com> wrote:

Aram Hăvărneanu

unread,
Dec 5, 2009, 10:30:04 AM12/5/09
to
"Max" wrote:

> Have you set the administrative privileges to the devcon.exe into
> windows 7?

Yes, I am running as admin and I have disabled UAC. I checked the logs, and
with that information I was able to load the driver on Windows 7. On 2003, I
was able to install the driver with the inf file and the sys file in the same
directory, however, if I tried to do the same on Windows 7, it didn't work.
Fortunately, the logs were of great help.

> About how to load the driver the source code of devcon
> program are in the DDK, you can study it for understand how this
> software is able to load the driver.
>

I didn't know the source code for devcon was available. I can't find it in
the current WDK. Probably I'm not looking where I need to. The SCM API is
really simple, the problem with the fact that it doesn't work is that I don't
know what to check. Are there any logs I should look into?

Thanks,

--
Aram Hăvărneanu


Doron Holan [MSFT]

unread,
Dec 7, 2009, 2:38:10 PM12/7/09
to
you can't use the SCM to load a pnp driver.

d

--

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


"Aram Hăvărneanu" <AramHv...@discussions.microsoft.com> wrote in message
news:D1887D42-7FCD-47BC...@microsoft.com...

Maxim S. Shatskih

unread,
Dec 8, 2009, 8:16:58 AM12/8/09
to
> However I still have all the other problems (can't load the driver with the
> SCM API

This is by design.

--
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com
http://www.storagecraft.com

0 new messages