Zebediah Figura : ntoskrnl: Do not send power IRPs on device start and removal.

Alexandre Julliard julliard at winehq.org
Mon Apr 12 16:11:25 CDT 2021


Module: wine
Branch: master
Commit: 94037f90a01a489d404ebfe80e5b1ce2263453d2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=94037f90a01a489d404ebfe80e5b1ce2263453d2

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sat Apr 10 21:57:18 2021 -0500

ntoskrnl: Do not send power IRPs on device start and removal.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/pnp.c | 28 ----------------------------
 1 file changed, 28 deletions(-)

diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index f8dc8c31935..0d9d816e3c0 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -141,30 +141,6 @@ static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer )
     return STATUS_SUCCESS;
 }
 
-static void send_power_irp( DEVICE_OBJECT *device, DEVICE_POWER_STATE power )
-{
-    IO_STATUS_BLOCK irp_status;
-    IO_STACK_LOCATION *irpsp;
-    KEVENT event;
-    IRP *irp;
-
-    device = IoGetAttachedDevice( device );
-
-    KeInitializeEvent( &event, NotificationEvent, FALSE );
-    if (!(irp = IoBuildSynchronousFsdRequest( IRP_MJ_POWER, device, NULL, 0, NULL, &event, &irp_status )))
-        return;
-
-    irpsp = IoGetNextIrpStackLocation( irp );
-    irpsp->MinorFunction = IRP_MN_SET_POWER;
-
-    irpsp->Parameters.Power.Type = DevicePowerState;
-    irpsp->Parameters.Power.State.DeviceState = power;
-
-    irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
-    if (IoCallDriver( device, irp ) == STATUS_PENDING)
-        KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
-}
-
 static NTSTATUS get_device_caps( DEVICE_OBJECT *device, DEVICE_CAPABILITIES *caps )
 {
     IO_STACK_LOCATION *irpsp;
@@ -317,10 +293,7 @@ static void start_device( DEVICE_OBJECT *device, HDEVINFO set, SP_DEVINFO_DATA *
 {
     load_function_driver( device, set, sp_device );
     if (device->DriverObject)
-    {
         send_pnp_irp( device, IRP_MN_START_DEVICE );
-        send_power_irp( device, PowerDeviceD0 );
-    }
 }
 
 static void enumerate_new_device( DEVICE_OBJECT *device, HDEVINFO set )
@@ -384,7 +357,6 @@ static void remove_device( DEVICE_OBJECT *device )
             remove_device( wine_device->children->Objects[i] );
     }
 
-    send_power_irp( device, PowerDeviceD3 );
     send_pnp_irp( device, IRP_MN_SURPRISE_REMOVAL );
     send_pnp_irp( device, IRP_MN_REMOVE_DEVICE );
 }




More information about the wine-cvs mailing list