method_buffered stopped working :/

Hello.

I don’t know what I’m doing wrong, but my driver is not returning proper data to user app when completes irp (method_buffered) Here is what I’m doing on driver side:

  1. get input and output buffers from SystemBuffer.
  2. doing something with input buffer (drvier is working ok with input).
  3. then i’m setting one field in my output structure
  4. set Irp->IoStatus.Information = sizeof(MY_OUT_STRUCT)
  5. complete request.

IOCTL is defined as METHOD_BUFFERED.

DeviceIoControl on user app side seems to be working fine, but when I’m trying to get value set in driver - app is returning improper data (random)

Can you please help me here?

Thanks.

And what do you set as the status when you complete the IRP?

Gary G. Little

----- Original Message -----
From: xxxxx@gmail.com
To: “Windows System Software Devs Interest List”
Sent: Monday, July 11, 2011 1:39:58 PM
Subject: [ntdev] method_buffered stopped working :confused:

Hello.

I don’t know what I’m doing wrong, but my driver is not returning proper data to user app when completes irp (method_buffered) Here is what I’m doing on driver side:

1. get input and output buffers from SystemBuffer.
2. doing something with input buffer (drvier is working ok with input).
3. then i’m setting one field in my output structure
4. set Irp->IoStatus.Information = sizeof(MY_OUT_STRUCT)
5. complete request.

IOCTL is defined as METHOD_BUFFERED.

DeviceIoControl on user app side seems to be working fine, but when I’m trying to get value set in driver - app is returning improper data (random)

Can you please help me here?

Thanks.


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

Note that the “input buffer” and the “output buffer” are the SAME buffer, so
you must copy the data you want to return to the
IrpAssociatedIrp.SystemBuffer field. You haven’t indicated that you are
doing that.
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Monday, July 11, 2011 2:40 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] method_buffered stopped working :confused:

Hello.

I don’t know what I’m doing wrong, but my driver is not returning proper
data to user app when completes irp (method_buffered) Here is what I’m doing
on driver side:

  1. get input and output buffers from SystemBuffer.
  2. doing something with input buffer (drvier is working ok with input).
  3. then i’m setting one field in my output structure
  4. set Irp->IoStatus.Information = sizeof(MY_OUT_STRUCT)
  5. complete request.

IOCTL is defined as METHOD_BUFFERED.

DeviceIoControl on user app side seems to be working fine, but when I’m
trying to get value set in driver - app is returning improper data (random)

Can you please help me here?

Thanks.


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

Well he did more or less indicate that he got the address of input and
output buffers from system buffer:
“1. get input and output buffers from SystemBuffer.”
Probably the code itself would reveal the answer.

Mark Roddy

On Mon, Jul 11, 2011 at 3:09 PM, Joseph M. Newcomer
wrote:
> Note that the “input buffer” and the “output buffer” are the SAME buffer, so
> you must copy the data you want to return to the
> IrpAssociatedIrp.SystemBuffer field. ?You haven’t indicated that you are
> doing that.
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?joe
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
> Sent: Monday, July 11, 2011 2:40 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] method_buffered stopped working :confused:
>
> Hello.
>
> I don’t know what I’m doing wrong, but my driver is not returning proper
> data to user app when completes irp (method_buffered) Here is what I’m doing
> on driver side:
>
> 1. get input and output buffers from SystemBuffer.
> 2. doing something with input buffer (drvier is working ok with input).
> 3. then i’m setting one field in my output structure
> 4. set Irp->IoStatus.Information = sizeof(MY_OUT_STRUCT)
> 5. complete request.
>
> IOCTL is defined as METHOD_BUFFERED.
>
> DeviceIoControl on user app side seems to be working fine, but when I’m
> trying to get value set in driver - app is returning improper data (random)
>
> Can you please help me here?
>
> Thanks.
>
> —
> 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
>
>
> —
> 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
>

Gary, Joseph

Thanks for your replies.

I was returning status_success, and i know that input and ouput resides in same location.
However your posts enforced on me looking at code again and i missed that in my macro just before return i was setting Irp->IoStatus.Information = 0 :slight_smile:

thanks again for your valuable help.