[PATCH 1/2] dinput/tests: Keep child PDO remove IRP pending until fully removed.

Rémi Bernon rbernon at codeweavers.com
Wed Mar 23 05:11:53 CDT 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Not 100% it'll solve all the problems, as I can hardly reproduce them
either running patches on the testbot or in a VM, but I think it might
the few timeout cases which I was able to see.

 dlls/dinput/tests/driver_bus.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/tests/driver_bus.c b/dlls/dinput/tests/driver_bus.c
index 9492f036c0f..be38de1999e 100644
--- a/dlls/dinput/tests/driver_bus.c
+++ b/dlls/dinput/tests/driver_bus.c
@@ -421,6 +421,7 @@ struct phys_device
 
     WCHAR instance_id[MAX_PATH];
     WCHAR device_id[MAX_PATH];
+    IRP *pending_remove;
 
     BOOL use_report_id;
     DWORD report_descriptor_len;
@@ -677,8 +678,14 @@ static NTSTATUS pdo_pnp( DEVICE_OBJECT *device, IRP *irp )
             {
                 input_queue_cleanup( &impl->input_queue );
                 expect_queue_cleanup( &impl->expect_queue );
+                irp = impl->pending_remove;
                 IoDeleteDevice( device );
                 if (winetest_debug > 1) trace( "Deleted Bus PDO %p\n", device );
+                if (irp)
+                {
+                    irp->IoStatus.Status = STATUS_SUCCESS;
+                    IoCompleteRequest( irp, IO_NO_INCREMENT );
+                }
             }
             return STATUS_SUCCESS;
         }
@@ -1220,7 +1227,9 @@ static NTSTATUS WINAPI pdo_ioctl( DEVICE_OBJECT *device, IRP *irp )
         impl->base.state = PNP_DEVICE_REMOVED;
         irp_queue_clear( &impl->input_queue.pending );
         KeReleaseSpinLock( &impl->base.lock, irql );
-        status = STATUS_SUCCESS;
+        impl->pending_remove = irp;
+        IoMarkIrpPending( irp );
+        status = STATUS_PENDING;
         break;
     case IOCTL_WINETEST_CREATE_DEVICE:
         ok( 0, "unexpected call\n" );
-- 
2.35.1




More information about the wine-devel mailing list