[PATCH 4/6] ntoskrnl.exe: Send IRP_MN_SURPRISE_REMOVAL before removing children.

Rémi Bernon rbernon at codeweavers.com
Fri Jun 18 07:06:09 CDT 2021


So that mini driver gets notified first and has a chance to cancel
pending IRPs.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntoskrnl.exe/pnp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index e425712d738..b249e8401d2 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -356,6 +356,8 @@ static void remove_device( DEVICE_OBJECT *device )
 
     TRACE("Removing device %p.\n", device);
 
+    send_pnp_irp( device, IRP_MN_SURPRISE_REMOVAL );
+
     if (wine_device->children)
     {
         ULONG i;
@@ -363,7 +365,6 @@ static void remove_device( DEVICE_OBJECT *device )
             remove_device( wine_device->children->Objects[i] );
     }
 
-    send_pnp_irp( device, IRP_MN_SURPRISE_REMOVAL );
     send_pnp_irp( device, IRP_MN_REMOVE_DEVICE );
 }
 
-- 
2.31.0




More information about the wine-devel mailing list