Question to MS: official rules on MN_REMOVE_DEVICE

Is there an official requirement that, in MN_REMOVE_DEVICE path, IoDeleteDevice of your own DO must be called only after IoCallDriver the IRP down?

In other words, must IoDeleteDevice be called in PostRemove or it is OK to do this in PreRemove?

In other words, if the driver calls IoDeleteDevice before passing MN_REMOVE_DEVICE down, is it a bug?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

The docs clearly state you must do it after sending the request down the stack

https://msdn.microsoft.com/en-us/library/windows/hardware/ff561056(v=vs.85).aspx

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, May 14, 2015 11:36 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Question to MS: official rules on MN_REMOVE_DEVICE

Is there an official requirement that, in MN_REMOVE_DEVICE path, IoDeleteDevice of your own DO must be called only after IoCallDriver the IRP down?

In other words, must IoDeleteDevice be called in PostRemove or it is OK to do this in PreRemove?

In other words, if the driver calls IoDeleteDevice before passing MN_REMOVE_DEVICE down, is it a bug?


Maxim S. Shatskih
Microsoft MVP on File System And Storage xxxxx@storagecraft.com http://www.storagecraft.com


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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

I remember in some version of WDK docs the sequence was: IoDetachDevice/IoDeleteDevice first, then forward the IRP down. I could not understand why it was that.