ntoskrnl.exe: Add a stub PnP manager driver.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-06-22 10:12:31 -05:00 committed by Alexandre Julliard
parent f79da3991a
commit d4c91cc6f9
3 changed files with 44 additions and 0 deletions

View File

@ -850,6 +850,8 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
PsInitialSystemProcess = IoGetCurrentProcess();
request_thread = GetCurrentThreadId();
pnp_manager_start();
handles[0] = stop_event;
handles[1] = manager;
@ -917,6 +919,9 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
}
done:
/* Native PnP drivers expect that all of their devices will be removed when
* their unload routine is called, so we must stop the PnP manager first. */
pnp_manager_stop();
wine_rb_destroy( &wine_drivers, unload_driver, NULL );
return status;
}

View File

@ -76,6 +76,9 @@ extern POBJECT_TYPE SeTokenObjectType;
void ObReferenceObject( void *obj ) DECLSPEC_HIDDEN;
void pnp_manager_start(void) DECLSPEC_HIDDEN;
void pnp_manager_stop(void) DECLSPEC_HIDDEN;
static const WCHAR servicesW[] = {'\\','R','e','g','i','s','t','r','y',
'\\','M','a','c','h','i','n','e',
'\\','S','y','s','t','e','m',

View File

@ -3,6 +3,7 @@
*
* Copyright 2016 Sebastian Lackner
* Copyright 2016 Aric Stewart for CodeWeavers
* Copyright 2019 Zebediah Figura
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -751,3 +752,38 @@ POWER_STATE WINAPI PoSetPowerState( DEVICE_OBJECT *device, POWER_STATE_TYPE type
FIXME("device %p, type %u, state %u, stub!\n", device, type, state.DeviceState);
return state;
}
static DRIVER_OBJECT *pnp_manager;
static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
{
IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp );
TRACE("device %p, irp %p, minor function %#x.\n", device, irp, stack->MinorFunction);
IoCompleteRequest( irp, IO_NO_INCREMENT );
return irp->IoStatus.u.Status;
}
static NTSTATUS WINAPI pnp_manager_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *keypath )
{
pnp_manager = driver;
driver->MajorFunction[IRP_MJ_PNP] = pnp_manager_device_pnp;
return STATUS_SUCCESS;
}
void pnp_manager_start(void)
{
static const WCHAR driver_nameW[] = {'\\','D','r','i','v','e','r','\\','P','n','p','M','a','n','a','g','e','r',0};
UNICODE_STRING driver_nameU;
NTSTATUS status;
RtlInitUnicodeString( &driver_nameU, driver_nameW );
if ((status = IoCreateDriver( &driver_nameU, pnp_manager_driver_entry )))
ERR("Failed to create PnP manager driver, status %#x.\n", status);
}
void pnp_manager_stop(void)
{
IoDeleteDriver( pnp_manager );
}