WdfIoQueueFindRequest question

When using WdfIoQueueFindRequest to search a manual queue, is it
possible to get the request context from each WDFREQUEST returned? The
doc says you can only use the returned handle in a subsequent calls to
WdfIoQueueFindRequest or WdfIoQueueRetrieveFoundRequest, or as an
argument to WdfObjectDereference, but it would be oh-so-convenient if I
could get at the contexts…

Cheers,

– mkj


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________

Yes, you can use the context on the request as long as you have a valid
reference.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 10:13 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoQueueFindRequest question

When using WdfIoQueueFindRequest to search a manual queue, is it
possible to get the request context from each WDFREQUEST returned? The
doc says you can only use the returned handle in a subsequent calls to
WdfIoQueueFindRequest or WdfIoQueueRetrieveFoundRequest, or as an
argument to WdfObjectDereference, but it would be oh-so-convenient if I
could get at the contexts…

Cheers,

– mkj


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I guess that’s my question; is the WDFREQUEST returned by
WdfIoQueueFindRequest a valid reference? The documentation implies it’s
not a first-class citizen; can I still get the context from it?

Cheers,

–mkj

Doron Holan wrote:

Yes, you can use the context on the request as long as you have a valid
reference.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 10:13 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoQueueFindRequest question

When using WdfIoQueueFindRequest to search a manual queue, is it
possible to get the request context from each WDFREQUEST returned? The
doc says you can only use the returned handle in a subsequent calls to
WdfIoQueueFindRequest or WdfIoQueueRetrieveFoundRequest, or as an
argument to WdfObjectDereference, but it would be oh-so-convenient if I
could get at the contexts…

Cheers,

– mkj


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________

Conceptually, the underlying issue here is cancellation. The request you get back is still owned by the framework, and is still in the queue, so it can be cancelled.

The framework adds a reference to it in the find routines, so it can’t disappear entirely, but you can’t use it as a WDFREQUEST for DDI other than those documented.

So it is OK to retrieve “your” context (or contexts, if you’ve added others) from it, because it has a reference. Trying to get at the underlying IRP, though (as one example), can get you in trouble.

Good question, though- we should consider adding something to that effect to the documentation. The confusion is understandable.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 11:37 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] WdfIoQueueFindRequest question

I guess that’s my question; is the WDFREQUEST returned by
WdfIoQueueFindRequest a valid reference? The documentation implies it’s
not a first-class citizen; can I still get the context from it?

Cheers,

–mkj

Doron Holan wrote:

Yes, you can use the context on the request as long as you have a valid
reference.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 10:13 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoQueueFindRequest question

When using WdfIoQueueFindRequest to search a manual queue, is it
possible to get the request context from each WDFREQUEST returned? The
doc says you can only use the returned handle in a subsequent calls to
WdfIoQueueFindRequest or WdfIoQueueRetrieveFoundRequest, or as an
argument to WdfObjectDereference, but it would be oh-so-convenient if I
could get at the contexts…

Cheers,

– mkj


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________

The object has a valid reference, but it is not necessarily in a valid
state in terms of the underlying PIRP in it. So, you can use Wdf object
DDI calls, but you cannot use Wdf request DDI calls until you retrieve
it successfully.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 11:37 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] WdfIoQueueFindRequest question

I guess that’s my question; is the WDFREQUEST returned by
WdfIoQueueFindRequest a valid reference? The documentation implies it’s

not a first-class citizen; can I still get the context from it?

Cheers,

–mkj

Doron Holan wrote:

Yes, you can use the context on the request as long as you have a
valid
reference.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Michael Jones
Sent: Friday, July 20, 2007 10:13 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] WdfIoQueueFindRequest question

When using WdfIoQueueFindRequest to search a manual queue, is it
possible to get the request context from each WDFREQUEST returned?
The
doc says you can only use the returned handle in a subsequent calls to

WdfIoQueueFindRequest or WdfIoQueueRetrieveFoundRequest, or as an
argument to WdfObjectDereference, but it would be oh-so-convenient if
I
could get at the contexts…

Cheers,

– mkj


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer