Hi Everyone,
I hope that someone can lay this question to rest once and for all.
The MSDN Library April 2004 documentation for IoDetachDevice
clearly states that TargetDevice is a
“Pointer to the lower driver’s device object. The caller previously
called IoAttachDevice or IoAttachDeviceToDeviceStack
successfully to get this pointer.”
- This statement implies that the PDEVICE_OBJECT returned by
the function IoAttachDeviceToDeviceStack is the pointer to be
passed into IoDetachDevice.
- Other driver writers tell me that the PDEVICE_OBJECT returned
by IoGetDeviceObjectPointer(“//Fat”) , which is then used as the
TargetDevice parameter to IoAttachDeviceToDeviceStack, is also
what I should use for the TargetDevice when I call IoDetachDevice.
I would really appreciate a final answer to this question.
Sorry to bother everyone with this, but of course we are dealing with a
BSOD and need to put this to rest once and for all.
Thanks in advance.
Duane
No.
IoAttachDeviceToDeviceStack accepts any pointer in the stack, often a PDO, and return the “really topmost” pointer.
IoDetachDevice must use this “really topmost” pointer.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Duane Souder
To: Windows System Software Devs Interest List
Sent: Thursday, September 02, 2004 5:44 PM
Subject: [ntdev] IoDetachDevice - MSDN Documentation
Hi Everyone,
I hope that someone can lay this question to rest once and for all.
The MSDN Library April 2004 documentation for IoDetachDevice
clearly states that TargetDevice is a
“Pointer to the lower driver’s device object. The caller previously
called IoAttachDevice or IoAttachDeviceToDeviceStack
successfully to get this pointer.”
- This statement implies that the PDEVICE_OBJECT returned by
the function IoAttachDeviceToDeviceStack is the pointer to be
passed into IoDetachDevice.
- Other driver writers tell me that the PDEVICE_OBJECT returned
by IoGetDeviceObjectPointer(“//Fat”) , which is then used as the
TargetDevice parameter to IoAttachDeviceToDeviceStack, is also
what I should use for the TargetDevice when I call IoDetachDevice.
I would really appreciate a final answer to this question.
Sorry to bother everyone with this, but of course we are dealing with a
BSOD and need to put this to rest once and for all.
Thanks in advance.
Duane
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
#2 often equals #1.
The case where it doesn’t is in AddDevice, where your driver is handed a
pointer to the device object at the bottom of the stack.
IoAttachDeviceToDeviceStack returns the previous top of stack, which may
or may not be the PDO.
in the case of opening a device by name and attaching to it, they may
happen to be equal, but that’s no reason not to code it correctly
anyway.
Use the pointer returned from IoAttachDevice[ToDeviceStack], not the one
you passed in.
-p
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Duane Souder
Sent: Thursday, September 02, 2004 6:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IoDetachDevice - MSDN Documentation
Hi Everyone,
I hope that someone can lay this question to rest once and for
all.
The MSDN Library April 2004 documentation for IoDetachDevice
clearly states that TargetDevice is a
“Pointer to the lower driver’s device object. The caller
previously
called IoAttachDevice or
IoAttachDeviceToDeviceStack
successfully to get this pointer.”
- This statement implies that the PDEVICE_OBJECT returned by
the function IoAttachDeviceToDeviceStack is the pointer to
be
passed into IoDetachDevice.
- Other driver writers tell me that the PDEVICE_OBJECT
returned
by IoGetDeviceObjectPointer(“//Fat”) , which is then used
as the
TargetDevice parameter to IoAttachDeviceToDeviceStack,
is also
what I should use for the TargetDevice when I call
IoDetachDevice.
I would really appreciate a final answer to this question.
Sorry to bother everyone with this, but of course we are dealing
with a
BSOD and need to put this to rest once and for all.
Thanks in advance.
Duane
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