Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
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/
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! | ||
Internals & Software Drivers | 7 February 2022 | Live, Online |
Kernel Debugging | 21 March 2022 | Live, Online |
Developing Minifilters | 23 May 2022 | Live, Online |
Writing WDF Drivers | 12 September 2022 | Live, Online |
Comments
d
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of [email protected]
Sent: Friday, February 9, 2018 8:16 AM
To: Windows System Software Devs Interest List <[email protected]>
Subject: [ntdev] Sending IOCTL Request ioTarget
I want to make an WdfIoTargetSendIoctlSynchronously call. All is clear but the only thing left is how to get the "ioTarget" inside of EvtDeviceAdd in the filter driver.
I know that the most of you know that but for me it is not clear how to get the IoTarget. There are so many functions.
---
NTDEV is sponsored by OSR
Visit the list online at: <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/showlists.cfm?list=ntdev&data=04|01|[email protected]|a45cface517a484e2a9208d56fd86b8a|ee3303d7fb734b0c8589bcd847f1c277|1|0|636537897663511681|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-1&sdata=kI1tMvjijlpGGUI+Rg/WMbGJ8Th0n3uYxtpp+uMTJuc=&reserved=0>
MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at <https://na01.safelinks.protection.outlook.com/?url=http://www.osr.com/seminars&data=04|01|[email protected]|a45cface517a484e2a9208d56fd86b8a|ee3303d7fb734b0c8589bcd847f1c277|1|0|636537897663511681|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-1&sdata=dgIr5MnxmxFklTSz3Z3H6sCRyjwNlCDR5BYbye2bI8o=&reserved=0>
To unsubscribe, visit the List Server section of OSR Online at <https://na01.safelinks.protection.outlook.com/?url=http://www.osronline.com/page.cfm?name=ListServer&data=04|01|[email protected]|a45cface517a484e2a9208d56fd86b8a|ee3303d7fb734b0c8589bcd847f1c277|1|0|636537897663511681|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ==|-1&sdata=C42GP7CifMHjyL8AlrnwL5KMC2IvBKugYm4IJK8llQI=&reserved=0>
Thank you.
I want the KEYBOARD_EXTENDED_ATTRIBUTES from the actual keyboard.
</quote>
That's nice, but it doesn't answer the question: To which device in the system do you want to send your IOCTL? If its the Device Object directly below you, you want your Local I/O Target, which you retrieve (as Doron said) with WdfDeviceGetIoTarget.
If you want to send your IOCTL to a DIFFERENT device in the system, you can open an I/O Target to that device by name or using a given WDM Device Object pointer.
Peter
OSR
@OSRDrivers
Peter Viscarola
OSR
@OSRDrivers
Thank you.
> I want to make an WdfIoTargetSendIoctlSynchronously call. All is clear but the only thing left is how to get the "ioTarget" inside of EvtDeviceAdd in the filter driver.
> I know that the most of you know that but for me it is not clear how to get the IoTarget. There are so many functions.
The KMDF designers have done an excellent job of naming their methods,
so many times it is quite possible to guess what you need. KMDF is a
tree of objects, where each node has stored a copy of the its
parents/owners/associates. So, in a case like this, you need to ask
yourself, "what information do I need, and what resources do I have?"Â
You need a WDFIOTARGET. You have a WDFDEVICE. When you need to ask an
X for a Y, the KMDF rule is that the routine is called XGetY. So, look
for WdfDeviceGetIoTarget, and there it is.
Sometimes you have to go through several steps. For example, to get a
WDFDEVICE from a WDFREQUEST, you have to go through the WDFQUEUE
(WdfRequestGetIoQueue, WdfIoQueueGetDevice).
--
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
For example: If I call now WdfDeviceGetIoTarget with the device handle I get that this device does not support this IOCTL and therefore I thought.
Ok, I remembered that there is a connection and in this connection I have done:
devExt->UpperConnectData = *connectData;
and here I looked at
PDEVICE_OBJECT ClassDeviceObject;
If I look in PDEVICE_OBJECT I see
struct _DRIVER_OBJECT *DriverObject;
struct _DEVICE_OBJECT *NextDevice;
struct _DEVICE_OBJECT *AttachedDevice;
Which one should I use now?
Questions after questions! :-(
> Yes, I see there is a systematic but I know that I must know more.
> For example: If I call now WdfDeviceGetIoTarget with the device handle I get that this device does not support this IOCTL and therefore I thought.
> Ok, I remembered that there is a connection and in this connection I have done:
> devExt->UpperConnectData = *connectData;
> and here I looked at
> PDEVICE_OBJECT ClassDeviceObject;
> If I look in PDEVICE_OBJECT I see
> struct _DRIVER_OBJECT *DriverObject;
> struct _DEVICE_OBJECT *NextDevice;
> struct _DEVICE_OBJECT *AttachedDevice;
> Which one should I use now?
None of them. Those are all going the wrong direction -- upward. The
hardware is below you, at WdfDeviceGetIoTarget(hDevice).
Are you trying to send IOCTL_KEYBOARD_QUERY_EXTENDED_ATTRIBUTES? What
operating system are you using for testing? That ioctl was not added
until Windows 10.
--
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
Yes, I want this IOCTL_KEYBOARD_QUERY_EXTENDED_ATTRIBUTES. I work with the latest win10.
status = WdfIoTargetSendIoctlSynchronously(
WdfDeviceGetIoTarget(device),
WDF_NO_HANDLE, // Request WDF_NO_HANDLE
IoctlControlCode,
pInputDesc,
pOutputDesc,
NULL, // PWDF_REQUEST_SEND_OPTIONS
NULL);
Any ideas?
Now I tried WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME. Is this the way to go?
Bent from my phone
________________________________
From: [email protected] on behalf of [email protected]
Sent: Saturday, February 10, 2018 6:42:16 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Sending IOCTL Request ioTarget
The filter driver is above kbdclass as Upperfilter. This is the reason that I get 0xc0000010. If I set it below kbdclass the function works.
Now I tried WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME. Is this the way to go?
---
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
My filter driver modifies the keyboard data. Can this also be done if the filter driver is below kbdclass? I tested it without modification and it do not work below kdbdclass.
Is it right that a filter driver which is above can not set keyboard indicators? If I can't set the indicators it is not so easy to change the input data because I must know for example the state of the capslock.