Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/pnp.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 713e469ee7e..04e442a8300 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -80,28 +80,20 @@ static NTSTATUS WINAPI internal_complete( DEVICE_OBJECT *device, IRP *irp, void return STATUS_MORE_PROCESSING_REQUIRED; }
-static NTSTATUS send_device_irp( DEVICE_OBJECT *device, IRP *irp, ULONG_PTR *info ) +static void send_device_irp( DEVICE_OBJECT *device, IRP *irp ) { HANDLE event = CreateEventA( NULL, FALSE, FALSE, NULL ); DEVICE_OBJECT *toplevel_device; - NTSTATUS status;
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; IoSetCompletionRoutine( irp, internal_complete, event, TRUE, TRUE, TRUE );
toplevel_device = IoGetAttachedDeviceReference( device ); - status = IoCallDriver( toplevel_device, irp ); - - if (status == STATUS_PENDING) + if (IoCallDriver( toplevel_device, irp ) == STATUS_PENDING) WaitForSingleObject( event, INFINITE ); - - status = irp->IoStatus.u.Status; - if (info) - *info = irp->IoStatus.Information; IoCompleteRequest( irp, IO_NO_INCREMENT ); ObDereferenceObject( toplevel_device ); CloseHandle( event ); - return status; }
static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCHAR **id ) @@ -119,7 +111,9 @@ static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WC irpsp->MinorFunction = IRP_MN_QUERY_ID; irpsp->Parameters.QueryId.IdType = type;
- return send_device_irp( device, irp, (ULONG_PTR *)id ); + send_device_irp( device, irp ); + *id = (WCHAR *)irp_status.Information; + return irp_status.u.Status; }
static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) @@ -139,7 +133,8 @@ static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor ) irpsp->Parameters.StartDevice.AllocatedResources = NULL; irpsp->Parameters.StartDevice.AllocatedResourcesTranslated = NULL;
- return send_device_irp( device, irp, NULL ); + send_device_irp( device, irp ); + return irp_status.u.Status; }
static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer ) @@ -172,7 +167,7 @@ static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer ) return STATUS_SUCCESS; }
-static NTSTATUS send_power_irp( DEVICE_OBJECT *device, DEVICE_POWER_STATE power ) +static void send_power_irp( DEVICE_OBJECT *device, DEVICE_POWER_STATE power ) { IO_STATUS_BLOCK irp_status; IO_STACK_LOCATION *irpsp; @@ -189,7 +184,7 @@ static NTSTATUS send_power_irp( DEVICE_OBJECT *device, DEVICE_POWER_STATE power irpsp->Parameters.Power.Type = DevicePowerState; irpsp->Parameters.Power.State.DeviceState = power;
- return send_device_irp( device, irp, NULL ); + send_device_irp( device, irp ); }
static void load_function_driver( DEVICE_OBJECT *device, HDEVINFO set, SP_DEVINFO_DATA *sp_device ) @@ -393,7 +388,6 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) DEVICE_RELATIONS *relations; IO_STATUS_BLOCK irp_status; IO_STACK_LOCATION *irpsp; - NTSTATUS status; HDEVINFO set; IRP *irp; ULONG i; @@ -413,9 +407,11 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) irpsp = IoGetNextIrpStackLocation( irp ); irpsp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS; irpsp->Parameters.QueryDeviceRelations.Type = BusRelations; - if ((status = send_device_irp( parent, irp, (ULONG_PTR *)&relations ))) + send_device_irp( parent, irp ); + relations = (DEVICE_RELATIONS *)irp_status.Information; + if (irp_status.u.Status) { - ERR("Failed to enumerate child devices, status %#x.\n", status); + ERR("Failed to enumerate child devices, status %#x.\n", irp_status.u.Status); SetupDiDestroyDeviceInfoList( set ); return; }