IopInitializeDeviceInstanceKey调用IoCreateDevice后调用IopMapDeviceObjectToDeviceInstance添加到nt!PpDeviceReferenceTable
BOOLEAN
IopInitializeDeviceInstanceKey(
IN HANDLE KeyHandle,
IN PUNICODE_STRING KeyName,
IN OUT PVOID Context
)
{
//
// Create madeup PDO and device node to represent the root device.
//
status = IoCreateDevice( IoPnpDriverObject,
sizeof(IOPNP_DEVICE_EXTENSION),
NULL,
FILE_DEVICE_CONTROLLER,
FILE_AUTOGENERATED_DEVICE_NAME,
FALSE,
&deviceObject );
if (NT_SUCCESS(status)) {
deviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE;
deviceObject->DeviceObjectExtension->ExtensionFlags |= DOE_START_PENDING;
status = PipAllocateDeviceNode(deviceObject, &deviceNode);
if (status != STATUS_SYSTEM_HIVE_TOO_LARGE && deviceNode) {
。。。。。。
//
// Add an entry into the table to set up a mapping between the DO
// and the instance path.
//
status = IopMapDeviceObjectToDeviceInstance(deviceNode->PhysicalDeviceObject, &deviceNode->InstancePath);
ASSERT(NT_SUCCESS(status));
参考:
1: kd> kc
#
00 nt!IoCreateDevice
01 nt!IopInitializeDeviceInstanceKey
02 nt!PipApplyFunctionToSubKeys
03 nt!IopInitializeDeviceKey
04 nt!PipApplyFunctionToSubKeys
05 nt!IopGetRootDevices
06 nt!IopPnPDispatch
07 nt!IofCallDriver
08 nt!IopSynchronousCall
09 nt!IopQueryDeviceRelations
0a nt!PipEnumerateDevice
0b nt!PipProcessDevNodeTree
0c nt!PiProcessReenumeration
0d nt!PipDeviceActionWorker
0e nt!PipRequestDeviceAction
0f nt!IopInitializePlugPlayServices
10 nt!IoInitSystem
11 nt!Phase1Initialization
12 nt!PspSystemThreadStartup
13 nt!KiThreadStartup