IoCompleteRequest Question

When we complete requests the IoStatus block needs to be filled in. Generally on a success the correct status is filled in and the information is set to how much data is being sent. My question is on an error does this information need to be set to anything? Should it be set to 0. When the iostatus block is set up is this set to 0? Can I count on this being initialized?

thanks,

xxxxx@gmail.com wrote:

When we complete requests the IoStatus block needs to be filled in. Generally on a success the correct status is filled in and the information is set to how much data is being sent. My question is on an error does this information need to be set to anything? Should it be set to 0.

It is quite possible to return information on an IRP with an error code.
In many cases, if the user specifies a buffer that is too small, you
want to return a partial buffer AND an error code indicating that more
data was available. If I’m completing an IRP, I try to set
IoStatus.Information every time.

When the iostatus block is set up is this set to 0? Can I count on this being initialized?

In my experience, IoStatus.Information starts out 0, and IoStatus.Status
starts out STATUS_NOT_SUPPORTED, but that status might only be for PnP IRPs.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

IoStatus.Status is initially set to STATUS_NOT_SUPPORTED for pnp, power and wmi irps. For other irps, I am pretty sure it is STATUS_SUCCESS, but that can be empirically determined by putting a bp on a read/write/ioctl request in your dispatch routine. IoStatus.Information will always be zero on presentation (at least if you are the top level device, in theory if someone is attached the value could change)

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Thursday, February 21, 2008 1:34 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IoCompleteRequest Question

xxxxx@gmail.com wrote:

When we complete requests the IoStatus block needs to be filled in. Generally on a success the correct status is filled in and the information is set to how much data is being sent. My question is on an error does this information need to be set to anything? Should it be set to 0.

It is quite possible to return information on an IRP with an error code.
In many cases, if the user specifies a buffer that is too small, you
want to return a partial buffer AND an error code indicating that more
data was available. If I’m completing an IRP, I try to set
IoStatus.Information every time.

When the iostatus block is set up is this set to 0? Can I count on this being initialized?

In my experience, IoStatus.Information starts out 0, and IoStatus.Status
starts out STATUS_NOT_SUPPORTED, but that status might only be for PnP IRPs.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


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

There is no architectural rule that I’ve ever seen that says the IoStatus.Status field will be initialized with zero.

Therefore, you must appropriately set both IoStatus.Status and IoStatus.Information for every IRP you complete. If you don’t have anything better to set the Information field to, set it to zero. As Tim said, you CAN use this field to return additional information, even when IoStatus.Status is set to an error code.

Peter
OSR