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

iocreatedeviceinterface and USB

0 views
Skip to first unread message

pachu

unread,
Jun 18, 2002, 9:48:37 AM6/18/02
to
Hello friends,
I have been trying to send custom ioctls to the keyboard
driver stack.
I have read the article no. Q262305 and have implemented it in the
same way.
I liked the concept verymuch.

I have a filter driver sitting on top of kbdclass, so i just
implemented the first part of the article, ie, Just calling
IoRegisterDeviceInterface and enabling the interface in
IRP_MN_START_DEVICE by calling IoSetDeviceInterfaceState with TRUE as
a parameter.
In my app, i enumerate this interface and send ioctls.

I noticed that when i connect a ps/2 keyboard, i am able to send the
ioctl to my filter driver. Right now i am just printing a statement in
the driver when i receive this IOCTL.

But when i connect a usb keyboard, createfile exits with error 20
which i beleive is "The system cannot find the device specified". But
i am able to use my usb keyboard. I dont know why createfile works for
ps/2 but not for USB. Kindly suggest me something. I am not sure if i
left out something or if i am doing something wrong.

thanks and best regards
pachu

pachu

unread,
Jun 19, 2002, 12:44:05 AM6/19/02
to
Hello All,
Sorry, the subject was suppose to be
IoRegisterDeviceInterface.
Alright, along with the doubts i had posted, i have one more now.

After the system boots, as i have mentioned, for a ps/2 keyboard, i am
able to send custom IOCTL to my filter driver (sits on top of
kbdclass). But not for a USB keyboard.
My another doubt is that, will there be a registry entry for the new
interface that i have created ? (both for ps/2 and USB). I could not
find anything in HKLM\System\CurrentControlSet\Enum\..., for both USB
and PS/2. Am i looking in the wrong place, i did search for my custom
GUID, but could not find anything.
Is this why CreateFile fails for my USB device ?


pach...@hotmail.com (pachu) wrote in message news:<c985418f.02061...@posting.google.com>...

Doron Holan [MS]

unread,
Jun 19, 2002, 1:25:20 AM6/19/02
to
are you passing the create irp down the stack before completing it? if so,
hidclass enforces file semantics on its children. So when the raw input
thread opens the keyboard for exclusive open, if your application opens the
keyboard later asking for read privilege, it is a rights conflict and the
create fails. The actual device interface key is somehwere under
currentcontrolset\control

--
d

This posting is provided "AS IS" with no warranties, and confers no rights.
"pachu" <pach...@hotmail.com> wrote in message
news:c985418f.02061...@posting.google.com...

pachu

unread,
Jun 19, 2002, 6:15:05 AM6/19/02
to
Oh so thatz the reason. But does this not happen with ps/2 stack ?
because i am able to send the ioctl to the filter driver.
thanks doron, i shall experiment for a while.
regards
pachu

"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message news:<3d1015a4$1...@news.microsoft.com>...

pachu

unread,
Jun 19, 2002, 8:51:42 AM6/19/02
to
Hello Doron,
I have doubt, as you have mentioned that i need to
complete the create irp before passing it down the stack. But is it
not that the IO manager generates the IRP only after the device is
opened ? This is because i am getting an error "the system cannot find
the device specified".
So if the device is not found, to whom will the iomanager send the
IRP. Am i wrong in this ?
These are the following registry entry for the interface that i have
created. I have put below both ps/2 and usb. I would like to mention
here that i am able to send my Custome IOCTL to the PS/2 stack, but
not to the usb stack.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#ACPI#PNP0303#4&24424dde&0#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}]
"DeviceInstance"="ACPI\\PNP0303\\4&24424dde&0"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#ACPI#PNP0303#4&24424dde&0#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\#]
"SymbolicLink"="\\\\?\\ACPI#PNP0303#4&24424dde&0#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#ACPI#PNP0303#4&24424dde&0#{c

6b9a1e7-363a-40cb-96de-0009c8a0298b}\#\Control]
"Linked"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#ACPI#PNP0303#4&24424dde&0#{c

6b9a1e7-363a-40cb-96de-0009c8a0298b}\Control]
"ReferenceCount"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#HID#Vid_055d&Pid_0002&Mi_00#

8&8f45332&0&0000#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}]
"DeviceInstance"="HID\\Vid_055d&Pid_0002&Mi_00\\8&8f45332&0&0000"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#HID#Vid_055d&Pid_0002&Mi_00#

8&8f45332&0&0000#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\#]
"SymbolicLink"="\\\\?\\HID#Vid_055d&Pid_0002&Mi_00#8&8f45332&0&0000#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#HID#Vid_055d&Pid_0002&Mi_00#

8&8f45332&0&0000#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\#\Control]
"Linked"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\##?#HID#Vid_055d&Pid_0002&Mi_00#8&8f45332&0&0000#{c6b9a1e7-363a-40cb-96de-0009c8a0298b}\Control]
"ReferenceCount"=dword:00000001

thanks and regards
pachu

"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message news:<3d1015a4$1...@news.microsoft.com>...

Doron Holan [MS]

unread,
Jun 19, 2002, 12:03:29 PM6/19/02
to
ps/2 doesn't care about file access semantics at all because it is just an
input driver. on the other hand, HID is more then just an input port
driver, you can open up any of its children from user mode, so it must
enforce these semantics (plus it requires a PFILE_OBJECT for a read to
succeed). You have an impossible problem to solve here actually. You don't
know if the create irp coming down is from the raw input thread or from your
user mode application (i guess if you look at the file access parameters
that might be a clue, but they can change), hence, you don't kow which one
to complete immediately and which one to send down the stack so that kbdhid
and hidclass see it.

pachu

unread,
Jun 20, 2002, 12:28:14 AM6/20/02
to
Hello Doron,
Oh no, i had already posted a question in this thread.
It has appeared in the thread anyhow. hmmmm, When i reply to a
posting, should i have to wait for deja to post it to the group, until
i post another to the same thing? ok never mind about this.

Ok the thing is that, CreateFile is not giving me "accesses denied
Error", but it says "it cannot find the device specified" . As i
mentioned that i had posted a reply in this thread, in which i had
written all the registry entries pertaining to my Custom Interface. I
can see that there is a symbolic link and also the reference count for
this interface is 1. I assume here that IoRegisterDeviceInterface and
IoSetDeviceInterfaceState has succeeded. I saw these entries under
CurrentControlSet\Control\DeviceClasses.

I tried a few things with respect to USB. While using DevView from
walter oney, i was able to see under DosDevices,symbolinks to my
custom interface as well as some default interfaces that are created
when my USB keyboard is connected.
Now i noticed that i am able to open the default interface, with the
same parameters to CreateFile and it Succeeds, but when i try to open
the interface that i have created using IORegisterDeviceInterface, it
does not succeed. It gives me an Error "The System Cannot find the
device specified". "Error no 20" I was wondering, if the device is not
found, to whom would IoManager send the IRP.Is my understanding
correct ?
When it come to USB i understand that by default there would be some
interfaces, now should i have to do something more than
IoRegisterDeviceInterface and IoSetDeviceInterfaceState for USB
devices ?
kindly suggest.

thanks and regards
pachu
"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message news:<3d10ab20$1...@news.microsoft.com>...

pachu

unread,
Jun 20, 2002, 6:44:41 AM6/20/02
to
Hello ,
I was able to send the custom ioctl to the USB interface too.
It was just an extra parameter FILE_SHARE_READ to CreateFile API. But
i am still confused why the error was "system cannot find device
specified" it must have said something like access denied
...or..Anywhy thanks all of you.
rgards
pachu
0 new messages