Commit d4c91cc6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntoskrnl.exe: Add a stub PnP manager driver.

parent f79da399
......@@ -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;
}
......
......@@ -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',
......
......@@ -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 );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment