Using DriverContext[] of underlying Irp in WDF

Is it still okay to use these memory locations in my Request? Does WDF take them over for anything?

To see if I could find the answer, I searched for DriverContext in the WDK under the KMDF doc and on msdn.com and I immediately found

http://msdn.microsoft.com/en-us/library/aa490306.aspx

Windows Driver Kit: Kernel-Mode Driver Framework
WDM Interface Restrictions

If your framework-based driver accesses WDM interfaces, you must be aware of the following restrictions:

Framework-based drivers must not use the Tail.Overlay.DriverContext member of the IRP structure, because the framework uses this member.

Typically all uses of DriverContext can be replaced with a context on the WDFREQUEST. The context on the WDFREQUEST is a bit better than DriverContext for irps you send to another device object b/c the values of DriverContext and not guaranteed to be the same when it comes back to your driver in the completion routine

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@earthlink.net
Sent: Wednesday, February 25, 2009 12:28 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Using DriverContext of underlying Irp in WDF

Is it still okay to use these memory locations in my Request? Does WDF take them over for anything?


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

I was thinking that I could only have my own defined context when I created the object, and not for an existing WdfRequest. But now I see that there is WdfObjectAllocateContext(), which should allow me to create the context to travel with the WdfRequest. Much better solution.

Diane

Set up your context as the default context for the WDFREQUEST. Then it
will always be there, according to an old response Doron gave me a few
years ago. If the system can’t allocate the default context, it won’t
deliver the WDFREQUEST. More details available by searching the archive
for this list.

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@earthlink.net
Sent: Wednesday, February 25, 2009 4:17 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Using DriverContext of underlying Irp in WDF

I was thinking that I could only have my own defined context when I
created the object, and not for an existing WdfRequest. But now I see
that there is WdfObjectAllocateContext(), which should allow me to
create the context to travel with the WdfRequest. Much better solution.

Diane


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