From: "Rémi Bernon" Subject: [PATCH 4/6] ntoskrnl.exe: Send IRP_MN_SURPRISE_REMOVAL before removing children. Message-Id: <20210618120611.703993-4-rbernon@codeweavers.com> Date: Fri, 18 Jun 2021 14:06:09 +0200 In-Reply-To: <20210618120611.703993-1-rbernon@codeweavers.com> References: <20210618120611.703993-1-rbernon@codeweavers.com> So that mini driver gets notified first and has a chance to cancel pending IRPs. Signed-off-by: Rémi Bernon --- 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