EvtIoInCallerContext: what to do if WdfRequestComplete fails?

I am using EvtIoInCallerContext callack in WDF driver. Code fragment:
VOID OsrFxEvtIoInCallerContext (
IN WDFDEVICE Device,
IN WDFREQUEST Request)
{
NTSTATUS status;
status = WdfDeviceEnqueueRequest(Device, Request);
if( ! NT_SUCCESS(status) )
{
// What to do here ?
}
}

This function works as expected, but consider the following situation. Client program starts and opens device handle. I disconnect USB device and connect it again. Then program executes some request to the driver.
In this case WdfDeviceEnqueueRequest returns 0xC0200204 code (STATUS_WDF_BUSY). The problem is that client program hangs waiting for request.
If I try to complete request here:
if( ! NT_SUCCESS(status) )
{
WdfRequestCompleteWithInformation(
Request,
status,
bytesReturned);
}
computer immediately reboots. What else can I do to complete request in this situation?
Thanks.


What are the most popular cars? Find out at Yahoo! Autos

I assume by “reboot” you mean “crashes”.

Do you have a kernel debugger attached to this machine? If not, developing
a robust device driver is going to be a long, slow, difficult process, and
you should seriously consider attaching a debugger.

If you do have a debugger attached, post the output of !analyze -v when the
crash occurs. That is essential in tracking down what you are doing wrong.

– arlie


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alex Farber
Sent: Wednesday, February 22, 2006 10:27 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtIoInCallerContext: what to do if WdfRequestComplete
fails?

I am using EvtIoInCallerContext callack in WDF driver. Code fragment:
VOID OsrFxEvtIoInCallerContext (
IN WDFDEVICE Device,
IN WDFREQUEST Request)
{
NTSTATUS status;
status = WdfDeviceEnqueueRequest(Device, Request);
if( ! NT_SUCCESS(status) )
{
// What to do here ?
}
}

This function works as expected, but consider the following situation.
Client program starts and opens device handle. I disconnect USB device and
connect it again. Then program executes some request to the driver.
In this case WdfDeviceEnqueueRequest returns 0xC0200204 code
(STATUS_WDF_BUSY). The problem is that client program hangs waiting for
request.
If I try to complete request here:
if( ! NT_SUCCESS(status) )
{
WdfRequestCompleteWithInformation(
Request,
status,
bytesReturned);
}
computer immediately reboots. What else can I do to complete request in this
situation?
Thanks.

That is the correct path to take, I can’t do more unless you send a callstack indicating the cuase for the bugcheck.

d

– I can spell, I just can’t type.


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Alex Farber
Sent: Wednesday, February 22, 2006 7:27 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] EvtIoInCallerContext: what to do if WdfRequestComplete fails?

I am using EvtIoInCallerContext callack in WDF driver. Code fragment:
VOID OsrFxEvtIoInCallerContext (
??? IN WDFDEVICE? Device,
??? IN WDFREQUEST? Request)
{
??? NTSTATUS status;
??? status = WdfDeviceEnqueueRequest(Device, Request);
??? if( ! NT_SUCCESS(status) )
??? {
??? // What to do here ?
??? }
}
?
This function works as expected, but consider the following situation. Client program starts and opens device handle. I disconnect USB device and connect it again. Then program executes some request to the driver.
In this case WdfDeviceEnqueueRequest returns 0xC0200204 code (STATUS_WDF_BUSY). The problem is that client program hangs waiting for request.
If I try to complete request here:
??? if( ! NT_SUCCESS(status) )
??? {
??? WdfRequestCompleteWithInformation(
??? Request,
??? status,
??? bytesReturned);
??? }
computer immediately reboots. What else can I do to complete request in this situation?
??? Thanks.


What are the most popular cars? Find out at Yahoo! Autos — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@microsoft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

Arlie and Doron, thank you for pointing in right direction, I found the problem in debugger.
bytesReturned parameter was 2, but it should be 0 for this particular request.
BTW, WDF messages in debug crush dump very useful and informative, and they have suprisingly high level.

Alex Farber wrote:
I am using EvtIoInCallerContext callack in WDF driver. Code fragment:
VOID OsrFxEvtIoInCallerContext (
IN WDFDEVICE Device,
IN WDFREQUEST Request)
{
NTSTATUS status;
status = WdfDeviceEnqueueRequest(Device, Request);
if( ! NT_SUCCESS(status) )
{
// What to do here ?
}
}

This function works as expected, but consider the following situation. Client program starts and opens device handle. I disconnect USB device and connect it again. Then program executes some request to the driver.
In this case WdfDeviceEnqueueRequest returns 0xC0200204 code (STATUS_WDF_BUSY). The problem is that client program hangs waiting for request.
If I try to complete request here:
if( ! NT_SUCCESS(status) )
{
WdfRequestCompleteWithInformation(
Request,
status,
bytesReturned);
}
computer immediately reboots. What else can I do to complete request in this situation?
Thanks.

---------------------------------

What are the most popular cars? Find out at Yahoo! Autos — Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 You are currently subscribed to ntdev as: xxxxx@yahoo.com To unsubscribe send a blank email to xxxxx@lists.osr.com

---------------------------------
Relax. Yahoo! Mail virus scanning helps detect nasty viruses!

It should be 0 for a failure path anyway. If it failed the request, it
shouldn’t report that any bytes were processed, because they weren’t.

Beverly


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alex Farber
Sent: Thursday, February 23, 2006 8:53 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] EvtIoInCallerContext: what to do if
WdfRequestComplete fails?

Arlie and Doron, thank you for pointing in right direction, I found the
problem in debugger.
bytesReturned parameter was 2, but it should be 0 for this particular
request.
BTW, WDF messages in debug crush dump very useful and informative, and
they have suprisingly high level.

Alex Farber wrote:

I am using EvtIoInCallerContext callack in WDF driver. Code
fragment:
VOID OsrFxEvtIoInCallerContext (
IN WDFDEVICE Device,
IN WDFREQUEST Request)
{
NTSTATUS status;
status = WdfDeviceEnqueueRequest(Device, Request);
if( ! NT_SUCCESS(status) )
{
// What to do here ?
}
}

This function works as expected, but consider the following
situation. Client program starts and opens device handle. I disconnect
USB device and connect it again. Then program executes some request to
the driver.
In this case WdfDeviceEnqueueRequest returns 0xC0200204 code
(STATUS_WDF_BUSY). The problem is that client program hangs waiting for
request.
If I try to complete request here:
if( ! NT_SUCCESS(status) )
{
WdfRequestCompleteWithInformation(
Request,
status,
bytesReturned);
}
computer immediately reboots. What else can I do to complete
request in this situation?
Thanks.


What are the most popular cars? Find out at Yahoo! Autos
http:HNlYwNtYWlsdGFncwRzbGsDMmF1dG9z/*http://autos.yahoo.com/newcars/popular/
thisweek.html> — Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: xxxxx@yahoo.com To unsubscribe send a blank email to
xxxxx@lists.osr.com



Relax. Yahoo! Mail virus scanning
http:.yahoo.com/features.php?page=221> helps detect nasty viruses! —
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: bbrown@mc.com To unsubscribe send a blank email to
xxxxx@lists.osr.com</http:></http:>