kd> !drvobj \driver\i8042prt
Driver object (822c9b08) is for:
\Driver\i8042prt
Driver Extension List: (id , addr)
Device Object list:
82238020 822c9328
----------------------------------------------------------------
kd> !devobj 82238020
Device object (82238020) is for:
\Driver\i8042prt DriverObject 822c9b08
Current Irp 00000000 RefCount 0 Type 00000027 Flags 00002004
DevExt 822380d8 DevObjExt 82238368
ExtensionFlags (0000000000)
AttachedDevice (Upper) 823f82e0 \Driver\vmmouse
AttachedTo (Lower) 82188e00 \Driver\ACPI
Device queue is not busy.
kd> dt nt!_device_object 82238020
+0x000 Type : 3
+0x002 Size : 0x348
+0x004 ReferenceCount : 0
+0x008 DriverObject : 0x822c9b08 _DRIVER_OBJECT
+0x00c NextDevice : 0x822c9328 _DEVICE_OBJECT
+0x010 AttachedDevice : 0x823f82e0 _DEVICE_OBJECT
+0x014 CurrentIrp : (null)
+0x018 Timer : (null)
+0x01c Flags : 0x2004
+0x020 Characteristics : 0
+0x024 Vpb : (null)
+0x028 DeviceExtension : 0x822380d8
+0x02c DeviceType : 0x27
+0x030 StackSize : 5 ''
+0x034 Queue : __unnamed
+0x05c AlignmentRequirement : 0
+0x060 DeviceQueue : _KDEVICE_QUEUE
+0x074 Dpc : _KDPC
+0x094 ActiveThreadCount : 0
+0x098 SecurityDescriptor : (null)
+0x09c DeviceLock : _KEVENT
+0x0ac SectorSize : 0
+0x0ae Spare1 : 1
+0x0b0 DeviceObjectExtension : 0x82238368 _DEVOBJ_EXTENSION
+0x0b4 Reserved : (null)
kd> !devstack 82238020
!DevObj !DrvObj !DevExt ObjectName
82238e48 \Driver\Mouclass 82238f00 PointerClass0
823f82e0 \Driver\vmmouse 823f8398
> 82238020 \Driver\i8042prt 822380d8
82188e00 \Driver\ACPI 8258b798 0000006e
!DevNode 824f7008 :
DeviceInst is "ACPI\PNP0F13\4&5289e18&0"
ServiceName is "i8042prt"
-----------------------------------------------------------------------
kd> !devobj 822c9328
Device object (822c9328) is for:
\Driver\i8042prt DriverObject 822c9b08
Current Irp 00000000 RefCount 0 Type 00000027 Flags 00002004
DevExt 822c93e0 DevObjExt 822c9670
ExtensionFlags (0000000000)
AttachedDevice (Upper) 823f8030 \Driver\Kbdclass
AttachedTo (Lower) 82188f18 \Driver\ACPI
Device queue is not busy.
kd> dt nt!_device_object 822c9328
+0x000 Type : 3
+0x002 Size : 0x348
+0x004 ReferenceCount : 0
+0x008 DriverObject : 0x822c9b08 _DRIVER_OBJECT
+0x00c NextDevice : (null)
+0x010 AttachedDevice : 0x823f8030 _DEVICE_OBJECT
+0x014 CurrentIrp : (null)
+0x018 Timer : (null)
+0x01c Flags : 0x2004
+0x020 Characteristics : 0
+0x024 Vpb : (null)
+0x028 DeviceExtension : 0x822c93e0
+0x02c DeviceType : 0x27
+0x030 StackSize : 5 ''
+0x034 Queue : __unnamed
+0x05c AlignmentRequirement : 0
+0x060 DeviceQueue : _KDEVICE_QUEUE
+0x074 Dpc : _KDPC
+0x094 ActiveThreadCount : 0
+0x098 SecurityDescriptor : (null)
+0x09c DeviceLock : _KEVENT
+0x0ac SectorSize : 0
+0x0ae Spare1 : 1
+0x0b0 DeviceObjectExtension : 0x822c9670 _DEVOBJ_EXTENSION
+0x0b4 Reserved : (null)
kd> !devstack 822c9328
!DevObj !DrvObj !DevExt ObjectName
823f8030 \Driver\Kbdclass 823f80e8 KeyboardClass0
> 822c9328 \Driver\i8042prt 822c93e0
82188f18 \Driver\ACPI 8258b900 0000006d
!DevNode 822182d0 :
DeviceInst is "ACPI\PNP0303\4&5289e18&0"
ServiceName is "i8042prt"
驱动对象driverobject 的 deviceobject 指向该驱动创建的第一个设备对象deviceobject,而第一个设备对象的NextDevice指向该驱动创建的第二个设备对象,依次类推可以遍历所有该驱动创建的设备对象。
第一个设备对象的AttachedDevice指向该设备栈中它上面的设备对象,DeviceExtension域里的AttachedTo指向该设备栈中它下面的设备对象,依次类推可以遍历所有该设备栈上的设备对象。而设备对象的driverobject又指向创建该设备对象的驱动对象。
整个全部都用线串起来了,佩服。