I was a bit un-fair to say that the only thing available to a KMDF Miniport
driver is I/O targets. I meant that only in the context of processing I/O.
There is a whole lot useful infrastructure in KMDF that works just fine in
Miniport Drivers. What you cannot do is process I/O targeted *at* the
device stack with KMDF. You must use the miniport model approved method.
Moreover, KMDF does not support creating a ‘control device’ in a KMDF
Miniport. You must use the miniport model approved method of doing that (if
one exists). Basically, the port driver (NDIS in this case) and KMDF both
want to take over the driver dispatch table. The port driver must and KMDF
must not in a Miniport.
I was also a bit imprecise and broad-brushed with saying that you cannot
create WDFREQUEST objects in a Miniport driver. Of course you can create
them as requests to be sent to an I/O Target. You cannot create them to
represent IRPs you receive dispatched through the Miniport Driver’s Dispath
Table.
My apologies in advance to the WDF folks.
Finding a way to make KMDF Control Device support work in an NDIS Miniport
is a bit of a pet peeve of mine as it seems like in this one case it ought
to have been possible to let KMDF fill in the ‘auxilary’ dispatch table used
in the call to NdisMRegisterDevice() (but alas, it is not). KMDF I think
makes some other assumptions about how the DeviceObject, DeviceExtension,
etc. relate to the WDFDEVICE and those are not ‘controllable’ for
NdisMRegisterDevice() since it too is make similar assumptions.
This leaves you with the ‘two driver’ approach where the NDIS Miniport and
the KMDF Filter need to split the duties between them.
-dave
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of David R. Cattley
Sent: Monday, November 10, 2008 11:57 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Handling IOCTLs in NDIS miniport drivers
The short answer is no, you cannot create a WDFDEVICE from within a
‘miniport’ driver. More to the point, you cannot create a WDFQUEUE either
or WDFREQUEST or any of the stuff that would make it possible to handle I/O
requests with WDF.
The NDIS/KMDF sample demonstrates the one-and-only capability available to
an NDIS/KMDF driver - I/O targets.
Depending on what you want to do from usermode you have these options:
-
Create an ‘auxilary’ named device object with NdisMRegisterDevice and
handle IRPs directly.
-
Create a KMDF ‘filter’ driver and place it in the stack with your NDIS
Miniport as an UpperFilter. This allows you to get inline with the IO on
the actual device stack by why you would want to, I don’t know. The NDIS
Miniport driver would need to ‘connect’ up with the filter driver. This can
be accomplished with an IRP_MN_QUERYINTERFACE to the ‘top’ of the device
stack.
-
Create a KMDF ‘filter’ driver and place it in the stack with your NDIS
Miniport as a LowerFilter. Create KMDF control device objects or enumerate
child devices per NIC depending on what you are trying to accomplish. You
can send requests from the NDIS miniport to the KMDF filter since the FiDO
will be in the same device stack as the NDIS Miniport (FDO). You could, for
instance, export an interface from the FiDO and retrieve it via an
IRP_MN_QUERYINTERFACE request in the NDIS FDO (or if you are NDIS/KMDF
WdfIoTargetQueryForInterface()).
Without knowing a lot more about the problem you are trying to solve (not
the tools you are trying to use to solve it) and the nature of the interface
you wish to use in common, it is rather difficult to give good advice. The
points above are just ideas and are not necessarily suitable to anything you
might try to accomplish so don’t expect much.
Good Luck,
Dave Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Monday, November 10, 2008 11:38 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Handling IOCTLs in NDIS miniport drivers
Hi all,
I’m working on NDIS miniport driver, and I need it to communicate with user
mode. I choosed to use ioctls, because I want to share ioctls implementation
from another driver I have. However, the another one is kmdf-based driver,
and it uses EvtIoDeviceControl dispatch callback to handle ioctls.
From netvmini sample in wdk I could find the call for NdisMRegisterDevice to
create an interface for usermode. It gets a dispatch table as an agrument,
and the callback for dispatching is WBM’s.
Is it any way to create a WDF interface to usermode from ndis miniport
driver?
From http://www.osronline.com/showThread.cfm?link=108185 (message 6 by Anton
Bassov) I can’t call for WdfDeviceCreate to create a framework device
object. In the other hand, there is an NDIS sample in kmdf source, so I
would assume that there is a way to accomplish my needs.
Additional option that I thought about is to create a WDFREQUEST within WDM
dispatch routine, but it seems a kind of ugly hack
Isn’t there any more
elegant solution?
Any advise is more then welcome !!!
Thanks,
S.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer