[NTOS:IO] Start loading drivers from the disk only after SystemRoot is initialized

Add another PnPBootDriversInitialized variable to indicate a point where
both disk subsystem and SystemRoot symlink are initialized, and use it
in a PiCallDriverAddDevice call.
This commit is contained in:
Victor Perevertkin 2020-12-22 20:52:20 +03:00
parent c4c0585f96
commit e5254974d2
No known key found for this signature in database
GPG key ID: C750B7222E9C7830
3 changed files with 8 additions and 1 deletions

View file

@ -77,6 +77,7 @@ extern KSPIN_LOCK IopLogListLock;
extern KSPIN_LOCK IopTimerLock;
extern PDEVICE_OBJECT IopErrorLogObject;
extern BOOLEAN PnPBootDriversInitialized;
GENERAL_LOOKASIDE IoLargeIrpLookaside;
GENERAL_LOOKASIDE IoSmallIrpLookaside;
@ -583,6 +584,10 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
return FALSE;
}
// the disk subsystem is initialized here and the SystemRoot is set too
// we can finally load other drivers from the boot volume
PnPBootDriversInitialized = TRUE;
#if !defined(_WINKD_) && defined(KDBG)
/* Read KDB Data */
KdbInit();

View file

@ -35,6 +35,7 @@ extern ERESOURCE IopDriverLoadResource;
extern BOOLEAN PnpSystemInit;
extern PDEVICE_NODE IopRootDeviceNode;
extern BOOLEAN PnPBootDriversLoaded;
extern BOOLEAN PnPBootDriversInitialized;
#define MAX_DEVICE_ID_LEN 200
#define MAX_SEPARATORS_INSTANCEID 0
@ -1560,7 +1561,7 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED))
return STATUS_SUCCESS;
PiCallDriverAddDevice(DeviceNode, PnPBootDriversLoaded);
PiCallDriverAddDevice(DeviceNode, PnPBootDriversInitialized);
return STATUS_SUCCESS;
}

View file

@ -24,6 +24,7 @@ PUNICODE_STRING PiInitGroupOrderTable;
USHORT PiInitGroupOrderTableCount;
INTERFACE_TYPE PnpDefaultInterfaceType;
BOOLEAN PnPBootDriversLoaded = FALSE;
BOOLEAN PnPBootDriversInitialized = FALSE;
ARBITER_INSTANCE IopRootBusNumberArbiter;
ARBITER_INSTANCE IopRootIrqArbiter;