Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.

GetLastError will return the win32 translation of the nt error
STATUS_NO_MEMORY which would be ERROR_NOT_ENOUGH_MEMORY.

Are you sure that you are completing the IRP correctly? You are calling
IoCompleteRequest, right?

=====================
Mark Roddy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 4:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

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

I hope you are calling IoCompleteRequest after setting the status in the
Irp. If not, that is probably your problem.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 1:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Fred wrote:

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

No, it gets a “translated” error code. Only a few of the error codes in
ntstatus.h are translated into meaningful Win32 error codes. If you
look in ntstatus.h, these are the ones with the “// winnt” comment after
the error code. For what it’s worth, I don’t see why the NTSTATUS codes
couldn’t be returned directly. They are certainly much more descriptive
than the Win32 error codes.

However, STATUS_NO_MEMORY is one of the codes that HAS that flag, so I
would expect it to return something reasonable. Are you calling
IoCompleteIrp? I don’t see it there. Is the ioctl using overlapped I/O?

STATUS_INSUFFICIENT_RESOURCES is what I have usually seen for this
error, but I think STATUS_NO_MEMORY should work.

winerror is your friend:

winerror -s 0xC0000017L
8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY

winerror -s 0xC000009A
1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
STATUS_INSUFFICIENT_RESOURCES

of course this doesn’t answer the “why is it 0” question - i suspect,
along with others, that you’re not completing the request. I don’t
think you’ll see a status in that case.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, April 12, 2005 2:31 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Error return translation from driver to win32

Fred wrote:

>I’m sending an ioctl to my driver via IoDeviceControl(). If
I fail the
>ioctl with STATUS_NON_MEMORY then I expect that this will result in
>IoDeviceControl() returning 0 as well as GetLastError()
returning ‘no
>memory’ error. But GetLastError() actually returns 0.
>
>I’m setting :
>
>Irp->IoStatus.Information = 0;
>
>Irp->IoStatus.Status = STATUS_NO_MEMORY;
>
>return STATUS_NO_MEMORY;
>
>in my driver.
>
>Shouldn’t the Win32 GetLastError() call get the error returned in
>Irp->IoStatus.Status?
>
>

No, it gets a “translated” error code. Only a few of the
error codes in ntstatus.h are translated into meaningful
Win32 error codes. If you look in ntstatus.h, these are the
ones with the “// winnt” comment after the error code. For
what it’s worth, I don’t see why the NTSTATUS codes couldn’t
be returned directly. They are certainly much more
descriptive than the Win32 error codes.

However, STATUS_NO_MEMORY is one of the codes that HAS that
flag, so I would expect it to return something reasonable.
Are you calling IoCompleteIrp? I don’t see it there. Is the
ioctl using overlapped I/O?

STATUS_INSUFFICIENT_RESOURCES is what I have usually seen for
this error, but I think STATUS_NO_MEMORY should work.


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

You are currently subscribed to ntdev as:
xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Nice. I didn’t know about that. Thanks.

=====================
Mark Roddy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Tuesday, April 12, 2005 5:46 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Error return translation from driver to win32

winerror is your friend:

winerror -s 0xC0000017L
8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY

winerror -s 0xC000009A
1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a STATUS_INSUFFICIENT_RESOURCES

of course this doesn’t answer the “why is it 0” question - i suspect, along
with others, that you’re not completing the request. I don’t think you’ll
see a status in that case.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Tuesday, April 12, 2005 2:31 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Error return translation from driver to win32

Fred wrote:

>I’m sending an ioctl to my driver via IoDeviceControl(). If
I fail the
>ioctl with STATUS_NON_MEMORY then I expect that this will result in
>IoDeviceControl() returning 0 as well as GetLastError()
returning ‘no
>memory’ error. But GetLastError() actually returns 0.
>
>I’m setting :
>
>Irp->IoStatus.Information = 0;
>
>Irp->IoStatus.Status = STATUS_NO_MEMORY;
>
>return STATUS_NO_MEMORY;
>
>in my driver.
>
>Shouldn’t the Win32 GetLastError() call get the error returned in
>Irp->IoStatus.Status?
>
>

No, it gets a “translated” error code. Only a few of the error codes
in ntstatus.h are translated into meaningful
Win32 error codes. If you look in ntstatus.h, these are the ones with
the “// winnt” comment after the error code. For what it’s worth, I
don’t see why the NTSTATUS codes couldn’t be returned directly. They
are certainly much more descriptive than the Win32 error codes.

However, STATUS_NO_MEMORY is one of the codes that HAS that flag, so I
would expect it to return something reasonable.
Are you calling IoCompleteIrp? I don’t see it there. Is the ioctl
using overlapped I/O?

STATUS_INSUFFICIENT_RESOURCES is what I have usually seen for this
error, but I think STATUS_NO_MEMORY should work.


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

You are currently subscribed to ntdev as:
xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

> For what it’s worth, I don’t see why the NTSTATUS codes

couldn’t be returned directly.

Actually, they are – via the OVERLAPPED structure. OVERLAPPED is just
is an IO_STATUS_BLOCK with some additional fields on the end.
OVERLAPPED.Internal is IO_STATUS_BLOCK.Status and
OVERLAPPED.InternalHigh is IO_STATUS_BLOCK.Information. This is
more-or-less documented in the Platform SDK.

That would be cool if winerror existed on my system. All I have is
errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
installs. I can’t find winerror anywhere. The closest thing is some
WinError stuff in PERL. Didn’t behave at all like yours.

Is that a widget you (MS) haven’t exported to the rest of us yet?

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53 PM:

winerror is your friend:

winerror -s 0xC0000017L
8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY

winerror -s 0xC000009A
1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
STATUS_INSUFFICIENT_RESOURCES

of course this doesn’t answer the “why is it 0” question - i suspect,
along with others, that you’re not completing the request. I don’t
think you’ll see a status in that case.

my fault - i thought we shipped this thing in the DDK.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, April 12, 2005 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Error return translation from driver to
win32

That would be cool if winerror existed on my system. All I have
is errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
installs. I can’t find winerror anywhere. The closest thing is some
WinError stuff in PERL. Didn’t behave at all like yours.

Is that a widget you (MS) haven’t exported to the rest of us
yet?

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
PM:

winerror is your friend:
>
> winerror -s 0xC0000017L
> 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
>
> winerror -s 0xC000009A
> 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
> STATUS_INSUFFICIENT_RESOURCES
>
> of course this doesn’t answer the “why is it 0” question - i
suspect,
> along with others, that you’re not completing the request. I
don’t
> think you’ll see a status in that case.
>
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 You are currently subscribed
to ntdev as: xxxxx@windows.microsoft.com To unsubscribe send a blank
email to xxxxx@lists.osr.com

It’s not as convenient as winerror, but there is a KB article with a
translation table. I’m not sure how up to date it is, though, since the
last product the article says it applies to is the Windows 2000 DDK.

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996

Any chance winerror will be released (say, on one of the DDC CDs :wink: )?
Does it translate in both directions?

-Dan

----- Original Message -----

Subject: RE: Error return translation from driver to win32
From: “Peter Wieland”
Date: Tue, 12 Apr 2005 16:54:18 -0700

my fault - i thought we shipped this thing in the DDK.

-p


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
Sent: Tuesday, April 12, 2005 3:12 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Error return translation from driver to win32

That would be cool if winerror existed on my system. All I have
is errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
installs. I can’t find winerror anywhere. The closest thing is some
WinError stuff in PERL. Didn’t behave at all like yours.

Is that a widget you (MS) haven’t exported to the rest of us
yet?

Phil

Philip D. Barila
Seagate Technology LLC
(720) 684-1842

xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
PM:

> winerror is your friend:
>
> winerror -s 0xC0000017L
> 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
>
> winerror -s 0xC000009A
> 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
> STATUS_INSUFFICIENT_RESOURCES
>
> of course this doesn’t answer the “why is it 0” question - i
suspect,
> along with others, that you’re not completing the request. I
don’t
> think you’ll see a status in that case.
>

Yes, I am calling IoCompleteRequest() (sorry I left that out in my
cut-and-paste)

IoCompleteRequest(Irp, IO_NO_INCREMENT);

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

IoDeviceControl() returns a BOOL so there’s no direct error value retured in
the call. I don’t support overlapped IO so I don’t received an overlapped
structure. Do I have to support overlapped IO to get the no_memory return
value from IoDeviceControl()???

Thanks!

“Daniel E. Germann” wrote in message
news:xxxxx@ntdev…
> It’s not as convenient as winerror, but there is a KB article with a
> translation table. I’m not sure how up to date it is, though, since the
> last product the article says it applies to is the Windows 2000 DDK.
>
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996
>
> Any chance winerror will be released (say, on one of the DDC CDs :wink: )?
> Does it translate in both directions?
>
> -Dan
>
> ----- Original Message -----
>> Subject: RE: Error return translation from driver to win32
>> From: “Peter Wieland”
>> Date: Tue, 12 Apr 2005 16:54:18 -0700
>>
>> my fault - i thought we shipped this thing in the DDK.
>>
>> -p
>>
>>
>> ________________________________
>>
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D Barila
>> Sent: Tuesday, April 12, 2005 3:12 PM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] Error return translation from driver to win32
>>
>>
>>
>> That would be cool if winerror existed on my system. All I have
>> is errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
>> installs. I can’t find winerror anywhere. The closest thing is some
>> WinError stuff in PERL. Didn’t behave at all like yours.
>>
>> Is that a widget you (MS) haven’t exported to the rest of us
>> yet?
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>> xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
>> PM:
>>
>> > winerror is your friend:
>> >
>> > winerror -s 0xC0000017L
>> > 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
>> >
>> > winerror -s 0xC000009A
>> > 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
>> > STATUS_INSUFFICIENT_RESOURCES
>> >
>> > of course this doesn’t answer the “why is it 0” question - i
>> suspect,
>> > along with others, that you’re not completing the request. I
>> don’t
>> > think you’ll see a status in that case.
>> >
>
>

Oh that is a classic blunder. You cannot touch the IRP after
IoCompleteRequest, and you certainly cannot set the IoStatus fields
afterwards.

=====================
Mark Roddy

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Wednesday, April 13, 2005 11:59 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

Yes, I am calling IoCompleteRequest() (sorry I left that out in my
cut-and-paste)

IoCompleteRequest(Irp, IO_NO_INCREMENT);

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

IoDeviceControl() returns a BOOL so there’s no direct error value retured in
the call. I don’t support overlapped IO so I don’t received an overlapped
structure. Do I have to support overlapped IO to get the no_memory return
value from IoDeviceControl()???

Thanks!

“Daniel E. Germann” wrote in message
news:xxxxx@ntdev…
> It’s not as convenient as winerror, but there is a KB article with a
> translation table. I’m not sure how up to date it is, though, since
> the last product the article says it applies to is the Windows 2000 DDK.
>
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996
>
> Any chance winerror will be released (say, on one of the DDC CDs :wink: )?
> Does it translate in both directions?
>
> -Dan
>
> ----- Original Message -----
>> Subject: RE: Error return translation from driver to win32
>> From: “Peter Wieland”
>> Date: Tue, 12 Apr 2005 16:54:18 -0700
>>
>> my fault - i thought we shipped this thing in the DDK.
>>
>> -p
>>
>>
>> ________________________________
>>
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D
>> Barila
>> Sent: Tuesday, April 12, 2005 3:12 PM
>> To: Windows System Software Devs Interest List
>> Subject: RE: [ntdev] Error return translation from driver to win32
>>
>>
>>
>> That would be cool if winerror existed on my system. All I have is
>> errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
>> installs. I can’t find winerror anywhere. The closest thing is some
>> WinError stuff in PERL. Didn’t behave at all like yours.
>>
>> Is that a widget you (MS) haven’t exported to the rest of us yet?
>>
>> Phil
>>
>> Philip D. Barila
>> Seagate Technology LLC
>> (720) 684-1842
>>
>> xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
>> PM:
>>
>> > winerror is your friend:
>> >
>> > winerror -s 0xC0000017L
>> > 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
>> >
>> > winerror -s 0xC000009A
>> > 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
>> > STATUS_INSUFFICIENT_RESOURCES
>> >
>> > of course this doesn’t answer the “why is it 0” question - i
>> suspect,
>> > along with others, that you’re not completing the request. I
>> don’t
>> > think you’ll see a status in that case.
>> >
>
>


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

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

Yeah, sorry again, my cut-and-paste skill really blow…that was not the
actual order of my code (I was trying to show my actions but mistakenly
posted it out of order)

Here’s my actual code…with unecessary detail removed…

status = STATUS_NO_MEMORY;

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = status;

IoCompleteRequest(Irp, IO_NO_INCREMENT);

return status;

“Roddy, Mark” wrote in message news:xxxxx@ntdev…
> Oh that is a classic blunder. You cannot touch the IRP after
> IoCompleteRequest, and you certainly cannot set the IoStatus fields
> afterwards.
>
>
> =====================
> Mark Roddy
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Fred
> Sent: Wednesday, April 13, 2005 11:59 AM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Error return translation from driver to win32
>
> Yes, I am calling IoCompleteRequest() (sorry I left that out in my
> cut-and-paste)
>
> IoCompleteRequest(Irp, IO_NO_INCREMENT);
>
> Irp->IoStatus.Information = 0;
>
> Irp->IoStatus.Status = STATUS_NO_MEMORY;
>
> return STATUS_NO_MEMORY;
>
>
>
> IoDeviceControl() returns a BOOL so there’s no direct error value retured
> in
> the call. I don’t support overlapped IO so I don’t received an overlapped
> structure. Do I have to support overlapped IO to get the no_memory return
> value from IoDeviceControl()???
>
>
>
> Thanks!
>
>
>
> “Daniel E. Germann” wrote in message
> news:xxxxx@ntdev…
>> It’s not as convenient as winerror, but there is a KB article with a
>> translation table. I’m not sure how up to date it is, though, since
>> the last product the article says it applies to is the Windows 2000 DDK.
>>
>> http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996
>>
>> Any chance winerror will be released (say, on one of the DDC CDs :wink: )?
>> Does it translate in both directions?
>>
>> -Dan
>>
>> ----- Original Message -----
>>> Subject: RE: Error return translation from driver to win32
>>> From: “Peter Wieland”
>>> Date: Tue, 12 Apr 2005 16:54:18 -0700
>>>
>>> my fault - i thought we shipped this thing in the DDK.
>>>
>>> -p
>>>
>>>
>>> ________________________________
>>>
>>> From: xxxxx@lists.osr.com
>>> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D
>>> Barila
>>> Sent: Tuesday, April 12, 2005 3:12 PM
>>> To: Windows System Software Devs Interest List
>>> Subject: RE: [ntdev] Error return translation from driver to win32
>>>
>>>
>>>
>>> That would be cool if winerror existed on my system. All I have is
>>> errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
>>> installs. I can’t find winerror anywhere. The closest thing is some
>>> WinError stuff in PERL. Didn’t behave at all like yours.
>>>
>>> Is that a widget you (MS) haven’t exported to the rest of us yet?
>>>
>>> Phil
>>>
>>> Philip D. Barila
>>> Seagate Technology LLC
>>> (720) 684-1842
>>>
>>> xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
>>> PM:
>>>
>>> > winerror is your friend:
>>> >
>>> > winerror -s 0xC0000017L
>>> > 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
>>> >
>>> > winerror -s 0xC000009A
>>> > 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
>>> > STATUS_INSUFFICIENT_RESOURCES
>>> >
>>> > of course this doesn’t answer the “why is it 0” question - i
>>> suspect,
>>> > along with others, that you’re not completing the request. I
>>> don’t
>>> > think you’ll see a status in that case.
>>> >
>>
>>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@stratus.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>

you are not allowed to touch the request after you’ve completed it. You
need to set the status and information before you complete the IRP.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Wednesday, April 13, 2005 8:59 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

Yes, I am calling IoCompleteRequest() (sorry I left that out in my
cut-and-paste)

IoCompleteRequest(Irp, IO_NO_INCREMENT);

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

IoDeviceControl() returns a BOOL so there’s no direct error
value retured in the call. I don’t support overlapped IO so
I don’t received an overlapped structure. Do I have to
support overlapped IO to get the no_memory return value from
IoDeviceControl()???

Thanks!

“Daniel E. Germann” wrote in message
> news:xxxxx@ntdev…
> > It’s not as convenient as winerror, but there is a KB
> article with a
> > translation table. I’m not sure how up to date it is,
> though, since
> > the last product the article says it applies to is the
> Windows 2000 DDK.
> >
> > http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q113996
> >
> > Any chance winerror will be released (say, on one of the
> DDC CDs :wink: )?
> > Does it translate in both directions?
> >
> > -Dan
> >
> > ----- Original Message -----
> >> Subject: RE: Error return translation from driver to win32
> >> From: “Peter Wieland”
> >> Date: Tue, 12 Apr 2005 16:54:18 -0700
> >>
> >> my fault - i thought we shipped this thing in the DDK.
> >>
> >> -p
> >>
> >>
> >> ________________________________
> >>
> >> From: xxxxx@lists.osr.com
> >> [mailto:xxxxx@lists.osr.com] On Behalf Of Philip D
> >> Barila
> >> Sent: Tuesday, April 12, 2005 3:12 PM
> >> To: Windows System Software Devs Interest List
> >> Subject: RE: [ntdev] Error return translation from driver to win32
> >>
> >>
> >>
> >> That would be cool if winerror existed on my system. All
> I have is
> >> errlook, and I have the 3790 DDK, the XP SP2 SDK, and VS 2003 full
> >> installs. I can’t find winerror anywhere. The closest
> thing is some
> >> WinError stuff in PERL. Didn’t behave at all like yours.
> >>
> >> Is that a widget you (MS) haven’t exported to the rest of us yet?
> >>
> >> Phil
> >>
> >> Philip D. Barila
> >> Seagate Technology LLC
> >> (720) 684-1842
> >>
> >> xxxxx@lists.osr.com wrote on 04/12/2005 03:45:53
> >> PM:
> >>
> >> > winerror is your friend:
> >> >
> >> > winerror -s 0xC0000017L
> >> > 8 ERROR_NOT_ENOUGH_MEMORY <–> c0000017 STATUS_NO_MEMORY
> >> >
> >> > winerror -s 0xC000009A
> >> > 1450 ERROR_NO_SYSTEM_RESOURCES <–> c000009a
> >> > STATUS_INSUFFICIENT_RESOURCES
> >> >
> >> > of course this doesn’t answer the “why is it 0” question - i
> >> suspect,
> >> > along with others, that you’re not completing the request. I
> >> don’t
> >> > think you’ll see a status in that case.
> >> >
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@windows.microsoft.com To unsubscribe send a blank
> email to xxxxx@lists.osr.com
>

> I don’t support overlapped IO so I don’t received an overlapped

structure. Do I have to support overlapped IO to get the no_memory
return value from IoDeviceControl()???

You can pass an OVERLAPPED structure to DeviceIoControl even if you’re
not doing overlapped I/O. Just make sure you zero out the structure
before you pass it (I suspect the only part that matters is that hEvent
is NULL, but zeroing the whole thing is easy).

One more thing…

You really don’t need to do any of this. If your driver returns
STATUS_INSUFFICIENT_RESOURCES you’ll get an ERROR_NOT_ENOUGH_MEMORY
Win32 error code. STATUS_NO_MEMORY isn’t what it seems; read the actual
text in ntstatus.h: “Not enough virtual memory or paging file quota is
available to complete the specified operation.” This IS NOT a general
purpose “out of memory” error code.

This bug is really anoying me. I’m sure this will turn out to be something really silly. So, now, I created a simple IOCTL that simply fails all requests with STATUS_NO_MEMORY but my user-mode app still receives 0x00 for GetLastError().

Any Ideas? Here’s the actual code I’m using…

Here’s my driver code:
NTSTATUS MyCrappyDriverDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp)

{

PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;

PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);

NTSTATUS status;

IO_STATUS_BLOCK ioStatus;

DebugPrint((2, “MyCrappyDriverDeviceControl: DeviceObject %X Irp %X\n”, DeviceObject, Irp));

switch (currentIrpStack->Parameters.DeviceIoControl.IoControlCode)

{

case IOCTL_MYCRAPPYIOCTL:

{

status = STATUS_NO_MEMORY;

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = status;

IoCompleteRequest(Irp, IO_NO_INCREMENT);

return status;

}

… handle other stuff here (removed for readability) …

}

And here’s my user-mode code:

if (!DeviceIoControl(hHandle, IOCTL_MYCRAPPYIOCTL, ReadTarget, sizeof(READ_TARGET), ReadTarget, ReadTarget->BufferSize, &bytes, NULL))

{

LastError = GetLastError();

printf(“\nIOCTL_MYCRAPPYIOCTL device request failed: 0x%x\n”, LastError);

}

So, how can GetLastError() possibly return 0x00 and not not STATUS_NO_MEMORY??? User a debugger showed that my driver was called correctly and returned STATUS_NO_MEMORY.

“Doron Holan” wrote in message news:xxxxx@ntdev…
I hope you are calling IoCompleteRequest after setting the status in the
Irp. If not, that is probably your problem.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 1:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Did your usermode application open the handle with FILE_FLAG_OVERLAPPED? If so, you need a valid OVERLAPPTED structure in the call to DeviceIoControl (even if you complete the request synchronously in the driver). Otherwise, the bug is not apparent to me.

d


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Wednesday, April 13, 2005 4:26 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

This bug is really anoying me.? I’m sure this will turn out to be something really silly.? So, now, I created a simple IOCTL that simply fails all requests with STATUS_NO_MEMORY but my user-mode app still receives 0x00 for GetLastError().
?
Any Ideas?? Here’s the actual code I’m using…
?
?
?
Here’s my driver code:
NTSTATUS MyCrappyDriverDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp)
{
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
IO_STATUS_BLOCK ioStatus;
DebugPrint((2, “MyCrappyDriverDeviceControl: DeviceObject %X Irp %X\n”, DeviceObject, Irp));
switch (currentIrpStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_MYCRAPPYIOCTL:
{
status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
… handle other stuff here (removed for readability)?..
}
?
?
?
And here’s my user-mode code:
?
if (!DeviceIoControl(hHandle, IOCTL_MYCRAPPYIOCTL, ReadTarget, sizeof(READ_TARGET), ReadTarget, ReadTarget->BufferSize, &bytes, NULL))
{
LastError = GetLastError();
printf(“\nIOCTL_MYCRAPPYIOCTL device request failed: 0x%x\n”, LastError);
}
?
So, how can GetLastError() possibly return 0x00 and not not STATUS_NO_MEMORY??? User a debugger showed that my driver was called correctly and returned STATUS_NO_MEMORY.
?
?
?
?
?
“Doron Holan” wrote in message news:xxxxx@ntdev…
I hope you are calling IoCompleteRequest after setting the status in the
Irp.? If not, that is probably your problem.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 1:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl().? If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error.? But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Nope. I didn’t specify any special flags or attributes when opening the
handle.

Vol = CreateFile ( DevicePath,

GENERIC_READ, // open for read access only

FILE_SHARE_WRITE | FILE_SHARE_READ, // share read and write

NULL, // no SECURITY_ATTRIBUTES structure

OPEN_EXISTING, // No special create flags

0, // No special attributes

NULL);

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Did your usermode application open the handle with FILE_FLAG_OVERLAPPED? If
so, you need a valid OVERLAPPTED structure in the call to DeviceIoControl
(even if you complete the request synchronously in the driver). Otherwise,
the bug is not apparent to me.

d

________________________________________
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Wednesday, April 13, 2005 4:26 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

This bug is really anoying me. I’m sure this will turn out to be something
really silly. So, now, I created a simple IOCTL that simply fails all
requests with STATUS_NO_MEMORY but my user-mode app still receives 0x00 for
GetLastError().

Any Ideas? Here’s the actual code I’m using…

Here’s my driver code:
NTSTATUS MyCrappyDriverDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp)
{
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
IO_STATUS_BLOCK ioStatus;
DebugPrint((2, “MyCrappyDriverDeviceControl: DeviceObject %X Irp %X\n”,
DeviceObject, Irp));
switch (currentIrpStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_MYCRAPPYIOCTL:
{
status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
… handle other stuff here (removed for readability) …
}

And here’s my user-mode code:

if (!DeviceIoControl(hHandle, IOCTL_MYCRAPPYIOCTL, ReadTarget,
sizeof(READ_TARGET), ReadTarget, ReadTarget->BufferSize, &bytes, NULL))
{
LastError = GetLastError();
printf(“\nIOCTL_MYCRAPPYIOCTL device request failed: 0x%x\n”, LastError);
}

So, how can GetLastError() possibly return 0x00 and not not
STATUS_NO_MEMORY??? User a debugger showed that my driver was called
correctly and returned STATUS_NO_MEMORY.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
I hope you are calling IoCompleteRequest after setting the status in the
Irp. If not, that is probably your problem.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 1:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
ioctl with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

Are you sure that the IOCTL is defined the same in the driver and user
program? Are you sure that you are executing that case statement?

Bill Wandel

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]
On Behalf Of Fred
Sent: Wednesday, April 13, 2005 8:28 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

Nope. I didn’t specify any special flags or attributes when opening the
handle.

Vol = CreateFile ( DevicePath,

GENERIC_READ, // open for read access only

FILE_SHARE_WRITE | FILE_SHARE_READ, // share read and write

NULL, // no SECURITY_ATTRIBUTES structure

OPEN_EXISTING, // No special create flags

0, // No special attributes

NULL);

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Did your usermode application open the handle with FILE_FLAG_OVERLAPPED? If
so, you need a valid OVERLAPPTED structure in the call to DeviceIoControl
(even if you complete the request synchronously in the driver). Otherwise,
the bug is not apparent to me.

d

________________________________________
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Wednesday, April 13, 2005 4:26 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Error return translation from driver to win32

This bug is really anoying me. I’m sure this will turn out to be something
really silly. So, now, I created a simple IOCTL that simply fails all
requests with STATUS_NO_MEMORY but my user-mode app still receives 0x00 for
GetLastError().

Any Ideas? Here’s the actual code I’m using…

Here’s my driver code:
NTSTATUS MyCrappyDriverDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp) {
PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS status;
IO_STATUS_BLOCK ioStatus;
DebugPrint((2, “MyCrappyDriverDeviceControl: DeviceObject %X Irp %X\n”,
DeviceObject, Irp)); switch
(currentIrpStack->Parameters.DeviceIoControl.IoControlCode)
{
case IOCTL_MYCRAPPYIOCTL:
{
status = STATUS_NO_MEMORY;
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = status;
IoCompleteRequest(Irp, IO_NO_INCREMENT); return status; } … handle other
stuff here (removed for readability) …
}

And here’s my user-mode code:

if (!DeviceIoControl(hHandle, IOCTL_MYCRAPPYIOCTL, ReadTarget,
sizeof(READ_TARGET), ReadTarget, ReadTarget->BufferSize, &bytes, NULL)) {
LastError = GetLastError(); printf(“\nIOCTL_MYCRAPPYIOCTL device request
failed: 0x%x\n”, LastError); }

So, how can GetLastError() possibly return 0x00 and not not
STATUS_NO_MEMORY??? User a debugger showed that my driver was called
correctly and returned STATUS_NO_MEMORY.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
I hope you are calling IoCompleteRequest after setting the status in the
Irp. If not, that is probably your problem.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Fred
Sent: Tuesday, April 12, 2005 1:59 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Error return translation from driver to win32

I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the ioctl
with STATUS_NON_MEMORY then I expect that this will result in
IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
memory’ error. But GetLastError() actually returns 0.

I’m setting :

Irp->IoStatus.Information = 0;

Irp->IoStatus.Status = STATUS_NO_MEMORY;

return STATUS_NO_MEMORY;

in my driver.

Shouldn’t the Win32 GetLastError() call get the error returned in
Irp->IoStatus.Status?

Thanks.


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

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

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

You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

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

Yes, both user-mode and kernel mode use the same header file and define the
IOCTL as below. As for the code, I put a breakpoint on the case statement
within my driver and stepped through each line of code. It gets executed as
I’d expect.

#define IOCTL_MYCRAPPYIOCTL(IOCTL_CRAPPY_BASE, 0x0050, METHOD_IN_DIRECT,
FILE_ANY_ACCESS)

I’m stumped!

“Bill Wandel” wrote in message news:xxxxx@ntdev…
> Are you sure that the IOCTL is defined the same in the driver and user
> program? Are you sure that you are executing that case statement?
>
> Bill Wandel
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]
> On Behalf Of Fred
> Sent: Wednesday, April 13, 2005 8:28 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Error return translation from driver to win32
>
> Nope. I didn’t specify any special flags or attributes when opening the
> handle.
>
> Vol = CreateFile ( DevicePath,
>
> GENERIC_READ, // open for read access only
>
> FILE_SHARE_WRITE | FILE_SHARE_READ, // share read and write
>
> NULL, // no SECURITY_ATTRIBUTES structure
>
> OPEN_EXISTING, // No special create flags
>
> 0, // No special attributes
>
> NULL);
>
>
>
>
>
> “Doron Holan” wrote in message
> news:xxxxx@ntdev…
> Did your usermode application open the handle with FILE_FLAG_OVERLAPPED?
> If
> so, you need a valid OVERLAPPTED structure in the call to DeviceIoControl
> (even if you complete the request synchronously in the driver).
> Otherwise,
> the bug is not apparent to me.
>
> d
>
> ________________________________________
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Fred
> Sent: Wednesday, April 13, 2005 4:26 PM
> To: Windows System Software Devs Interest List
> Subject: Re:[ntdev] Error return translation from driver to win32
>
> This bug is really anoying me. I’m sure this will turn out to be something
> really silly. So, now, I created a simple IOCTL that simply fails all
> requests with STATUS_NO_MEMORY but my user-mode app still receives 0x00
> for
> GetLastError().
>
> Any Ideas? Here’s the actual code I’m using…
>
>
>
> Here’s my driver code:
> NTSTATUS MyCrappyDriverDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp)
> {
> PDEVICE_EXTENSION deviceExtension = DeviceObject->DeviceExtension;
> PIO_STACK_LOCATION currentIrpStack = IoGetCurrentIrpStackLocation(Irp);
> NTSTATUS status;
> IO_STATUS_BLOCK ioStatus;
> DebugPrint((2, “MyCrappyDriverDeviceControl: DeviceObject %X Irp %X\n”,
> DeviceObject, Irp)); switch
> (currentIrpStack->Parameters.DeviceIoControl.IoControlCode)
> {
> case IOCTL_MYCRAPPYIOCTL:
> {
> status = STATUS_NO_MEMORY;
> Irp->IoStatus.Information = 0;
> Irp->IoStatus.Status = status;
> IoCompleteRequest(Irp, IO_NO_INCREMENT); return status; } … handle other
> stuff here (removed for readability) …
> }
>
>
>
> And here’s my user-mode code:
>
> if (!DeviceIoControl(hHandle, IOCTL_MYCRAPPYIOCTL, ReadTarget,
> sizeof(READ_TARGET), ReadTarget, ReadTarget->BufferSize, &bytes, NULL)) {
> LastError = GetLastError(); printf(“\nIOCTL_MYCRAPPYIOCTL device request
> failed: 0x%x\n”, LastError); }
>
> So, how can GetLastError() possibly return 0x00 and not not
> STATUS_NO_MEMORY??? User a debugger showed that my driver was called
> correctly and returned STATUS_NO_MEMORY.
>
>
>
>
>
> “Doron Holan” wrote in message
> news:xxxxx@ntdev…
> I hope you are calling IoCompleteRequest after setting the status in the
> Irp. If not, that is probably your problem.
>
> d
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Fred
> Sent: Tuesday, April 12, 2005 1:59 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Error return translation from driver to win32
>
> I’m sending an ioctl to my driver via IoDeviceControl(). If I fail the
> ioctl
> with STATUS_NON_MEMORY then I expect that this will result in
> IoDeviceControl() returning 0 as well as GetLastError() returning ‘no
> memory’ error. But GetLastError() actually returns 0.
>
> I’m setting :
>
> Irp->IoStatus.Information = 0;
>
> Irp->IoStatus.Status = STATUS_NO_MEMORY;
>
> return STATUS_NO_MEMORY;
>
>
>
> in my driver.
>
> Shouldn’t the Win32 GetLastError() call get the error returned in
> Irp->IoStatus.Status?
>
> Thanks.
>
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@bwandel.com To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>
>