Hello Tony,
Can I affect OS level error somehow? It seems that the return value from the
dispatch routine doesn’t affect it.
I might seem to be stupid but I have never heard about thread’s TEB block,
does it have anything with TLS?
P.S.
I have a problem:
- I call DeviceIoControl with my custom IOCTL,
- Generate a standard IRP (FSCTL_GET_RETRIEVAL_POINTERS), pass it to
the underlying driver in my dispatch routine
- GetLastError returns a error code (I see it in my user-mode
application after a call to DeviceIoControl succeeded) even if
the generated IRP succeeded and I return Irp->IoStatus = 0 from the
dispatch routine.
–
Roman
mailto:xxxxx@rbcmail.ru
“Tony Mason” wrote in message news:xxxxx@ntfsd…
GetLastError retrieves its value from the thread’s TEB block.
Presumably, one of the things Win32 does is converts the OS level error
into a Win32 error and then stores it into that field of the TEB.
Thus, you should be able to change the results of this, albeit
indirectly.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roman Kudinov
Sent: Friday, October 15, 2004 8:41 AM
To: ntfsd redirect
Subject: [ntfsd] IRP status
Hello ,
If I complete an intercepted IRP without passing it to the underlying
driver does Irp->IoStatus affect the error code returned by
GetLastError function?
If no, then is there a way to affect the value returned by this
function?
–
Roman
mailto:xxxxx@rbcmail.ru
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
> Can I affect OS level error somehow? It seems that the return value from
the
dispatch routine doesn’t affect it.
This is not true. If you call CreateFile from your user-mode
program, and a FSD or filter returns STATUS_ACCESS_DENIED,
the CreateFile returns INVALID_HANDLE_VALUE and GetLastError
returns ERROR_ACCESS_DENIED.
The same with another calls/statuses. Why do you think
your return value does not have effect ?
Try to write s aimple WIn32 program that performs
a single API call (CReateFIle, ReadFile, GetFileSize,
and another ones) and see how the status affects the
return value of the GetLastError().
L.
Hi Roman,
You may change the OS level error by changing Irp->IoStatus.Status; be
warned that changing this value might change the OS behavior as well, so
you are responsible for determining the results of your actions.
Try !teb within the debugger to see the shape of the TEB itself. Given
that there is a thread environment block per user-mode thread, yes, this
constitutes thread local storage.
As for how GetLastError works, you’ll need to rely upon others for
understanding that - I avoid user mode programming as much as possible,
so my own personal knowledge in that area is very limited.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roman Kudinov
Sent: Monday, October 18, 2004 4:14 AM
To: ntfsd redirect
Subject: Re[2]: [ntfsd] IRP status
Hello Tony,
Can I affect OS level error somehow? It seems that the return value
from the
dispatch routine doesn’t affect it.
I might seem to be stupid but I have never heard about thread’s TEB
block,
does it have anything with TLS?
P.S.
I have a problem:
- I call DeviceIoControl with my custom IOCTL,
- Generate a standard IRP (FSCTL_GET_RETRIEVAL_POINTERS), pass it to
the underlying driver in my dispatch routine
- GetLastError returns a error code (I see it in my user-mode
application after a call to DeviceIoControl succeeded) even if
the generated IRP succeeded and I return Irp->IoStatus = 0 from the
dispatch routine.
–
Roman
mailto:xxxxx@rbcmail.ru
“Tony Mason” wrote in message news:xxxxx@ntfsd…
GetLastError retrieves its value from the thread’s TEB block.
Presumably, one of the things Win32 does is converts the OS level error
into a Win32 error and then stores it into that field of the TEB.
Thus, you should be able to change the results of this, albeit
indirectly.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roman Kudinov
Sent: Friday, October 15, 2004 8:41 AM
To: ntfsd redirect
Subject: [ntfsd] IRP status
Hello ,
If I complete an intercepted IRP without passing it to the underlying
driver does Irp->IoStatus affect the error code returned by
GetLastError function?
If no, then is there a way to affect the value returned by this
function?
–
Roman
mailto:xxxxx@rbcmail.ru
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
> If I complete an intercepted IRP without passing it to the underlying
driver does Irp->IoStatus affect the error code returned by
GetLastError function?
Correct. It is translated to Win32 error in user mode in kernel32.dll
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com