Ioctl impaired

In my IRP_MJ Using METHOD_BUFFERED I cast my buffer to a struct foo,
change a member of the struct, and complete the IRP as follows:

irp->IoStatus.Status = status;
IoCompleteRequest (irp, IO_NO_INCREMENT);
return status;

The userland call to DeviceIoControl is as follows:

struct foo args, result;

DeviceIoControl (handle, IOCTL_CODE, &args,
sizeof (args), &result, sizeof (result), &unused, 0)

The userland caller of DeviceIoControl does not see the change to the
struct. I’m sure I’ve missed something dumb, but I’ve been chasing this
for a while and it’s NOT popping. And of course, Nagar is at home.
Would somebody kindly clue me in?

I don’t see anything in the docs that suggest I need to do anything
apart from write the data into the buffer and complete the IRP:

http://msdn2.microsoft.com/en-us/library/ms795857.aspx

~Eric

Eric,

Try telling the I/O Manager how much data you are returning:

Irp->IoStatus.Information = sizeof(struct foo);

before you complete the IRP. That way it knows how much data to return.

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

Thank you, I just spotted that via some googling and was going to make
sure it worked before fessing up :wink:

~Eric

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Wednesday, December 19, 2007 5:24 PM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Ioctl impaired

Eric,

Try telling the I/O Manager how much data you are returning:

Irp->IoStatus.Information = sizeof(struct foo);

before you complete the IRP. That way it knows how much data to return.

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com


NTFSD is sponsored by OSR

For our schedule debugging and file system seminars (including our new
fs mini-filter seminar) visit:
http://www.osr.com/seminars

You are currently subscribed to ntfsd as: xxxxx@edsiohio.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

You have not filled Irp->IoStatus.Information

It must be filled to the number of bytes to copy back from .SystemBuffer to
the output buffer.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

“Eric Diven” wrote in message news:xxxxx@ntfsd…
In my IRP_MJ Using METHOD_BUFFERED I cast my buffer to a struct foo,
change a member of the struct, and complete the IRP as follows:

irp->IoStatus.Status = status;
IoCompleteRequest (irp, IO_NO_INCREMENT);
return status;

The userland call to DeviceIoControl is as follows:

struct foo args, result;

DeviceIoControl (handle, IOCTL_CODE, &args,
sizeof (args), &result, sizeof (result), &unused, 0)

The userland caller of DeviceIoControl does not see the change to the
struct. I’m sure I’ve missed something dumb, but I’ve been chasing this
for a while and it’s NOT popping. And of course, Nagar is at home.
Would somebody kindly clue me in?

I don’t see anything in the docs that suggest I need to do anything
apart from write the data into the buffer and complete the IRP:

http://msdn2.microsoft.com/en-us/library/ms795857.aspx

~Eric