From: Aram Hăvărneanu on
I have studied kbdclass class driver for keyboards and vhidmini hid
minidriver. I understood how both drivers do stuff internally and how control
IRP packets get passed down the driver stack from the class driver to the
minidriver, but I have not understood how read requests are processed.

I didn't understand where exactly in kbdclass does IRP_MJ_READ get passed to
the minidriver. From what I see, this doesn't happen, IRP_MJ_READ is
completed in the class driver. The class driver just removes stuff from it's
queue. If this is the case, how does the minidriver fill the class driver
queue?

What dispatch function I need to implement in my minidriver so I can push
stuff into the class driver queue? I think I need to use some
HID_REPORT_DESCRIPTOR but I can't figure out how to create it or where/how to
use it.

Thanks,

--
Aram Hăvărneanu
From: Aram Hăvărneanu on
I think that kbdclass' KeyboardClassServiceCallback() copies data to the
queue, and I have to implement KbFilter_ServiceCallback(), but I don't
understands when this function gets called. My driver is for a virtual
device, so there's no real device generating interrupts.

Thanks,

--
Aram Hăvărneanu

From: Aram Hăvărneanu on
To offer a bit more background about what am I trying to do,

I want to implement a virtual keyboard. That is, a device driver that injects
arbitrary input data into kbdclass.sys. From my understanding there are
multiple
ways of doing this:

1) PnP or legacy style keyboard port driver (something that sits below
Kbdclass).
2) A hid miniport that enumerates a keyboard.

If I go with 2) I can start from vhidmini sample (not available in latest
WDK,
but works). If I go with 1 I need to write something from scratch and I can
use
KDMF as the keyboard port driver is not a minidriver.

I tried 2 but I think the whole HID business I don't care about is confusing
me.
I need to understand HID collections and HID descriptors and other complex
HID
stuff when all I want is to push some KEYBOARD_INPUT_DATA into KbdClass'
queue
using KeyboardClassServiceCallback().

What do you recommend? How would use approach this?

PS: I wish to make an application that uses this driver as a temporary driver
(no install). The problem is that if I want to use the Service Control
Manager
API then I can only use a legacy style (non PnP) driver. Is that correct? For
"modern" I need to make an .inf file and use what devcon.exe uses. The
problem
with devcon.exe is that installing the driver and then deinstalling it takes
a
significant amount of time. I can live with that, although the SCM APIs would
make things so much easier.

Thanks!

--
Aram Hăvărneanu