news 2026/4/16 12:33:40

ACPI!ACPIDetectPdoDevices函数中通过ACPI!ACPIBuildPdo函数创建设备和nt!PipEnumerateCompleted中创建设备节点

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ACPI!ACPIDetectPdoDevices函数中通过ACPI!ACPIBuildPdo函数创建设备和nt!PipEnumerateCompleted中创建设备节点

ACPI!ACPIDetectPdoDevices函数中通过ACPI!ACPIBuildPdo函数创建设备和nt!PipEnumerateCompleted中创建设备节点

NTSTATUS
ACPIBuildPdo(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_EXTENSION DeviceExtension,
IN PDEVICE_OBJECT ParentPdoObject,
IN BOOLEAN CreateAsFilter
)

{

//
// First step is to create a device object
//
status =IoCreateDevice(
DriverObject,
0,
NULL,
FILE_DEVICE_ACPI,
FILE_AUTOGENERATED_DEVICE_NAME,
FALSE,
&newDeviceObject
);

0: kd> t
Breakpoint 82 hit
eax=89981b98 ebx=f743b620 ecx=89981a18 edx=00000000 esi=899c0d58 edi=899c0e78
eip=f73faa3a esp=f789a20c ebp=f789a250 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
ACPI!ACPIBuildPdo:
f73faa3a 55 push ebp
0: kd> kc
#
00 ACPI!ACPIBuildPdo
01 ACPI!ACPIDetectPdoDevices
02 ACPI!ACPIRootIrpQueryBusRelations
03 ACPI!ACPIRootIrpQueryDeviceRelations
04 ACPI!ACPIDispatchIrp
05 nt!IofCallDriver
06 nt!IopSynchronousCall
07 nt!IopQueryDeviceRelations
08 nt!PipEnumerateDevice
09 nt!PipProcessDevNodeTree
0a nt!PipDeviceActionWorker
0b nt!PipRequestDeviceAction
0c nt!IopInitializeBootDrivers
0d nt!IoInitSystem
0e nt!Phase1Initialization
0f nt!PspSystemThreadStartup
10 nt!KiThreadStartup
0: kd> dv
DriverObject = 0x89981f38 Driver "\Driver\ACPI"
DeviceExtension = 0x899c0d58
ParentPdoObject = 0x899c1de0 Device for "\Driver\ACPI_HAL"
CreateAsFilter = 0x00 ''
filterDeviceObject = 0xf73faa3a Device for {...}
newDeviceObject = 0x00000008
oldIrql = 0x89 ''
i = 0
0: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x899c0d58)
((ACPI!_DEVICE_EXTENSION *)0x899c0d58) : 0x899c0d58 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0x40200002010108 [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0x0 [Type: IRP_DISPATCH_TABLE *]
[+0x014] WorkContext [Type: WORK_QUEUE_CONTEXT]
[+0x014] Fdo [Type: _FDO_DEVICE_EXTENSION]
[+0x014] Filter [Type: _FILTER_DEVICE_EXTENSION]
[+0x014] Pdo [Type: _PDO_DEVICE_EXTENSION]
[+0x058] WorkQueue [Type: EXTENSION_WORKER]
[+0x058] Button [Type: BUTTON_EXTENSION]
[+0x058] Thermal [Type: THERMAL_EXTENSION]
[+0x058] LinkNode [Type: LINK_NODE_EXTENSION]
[+0x058] Dock [Type: DOCK_EXTENSION]
[+0x058] Processor [Type: _PROCESSOR_DEVICE_EXTENSION]
[+0x088] DeviceState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x08c] PreviousState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x090] PowerInfo [Type: _ACPI_POWER_INFO]
[+0x10c] DeviceID : 0x899c1148 : 0x41 [Type: unsigned char *]
[+0x10c] Address : 0x899c1148 [Type: unsigned long]
[+0x110] InstanceID : 0x0 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 83 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899affac [Type: _NSObj *]
[+0x130] DeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]
0: kd> db 0x899affac
899affac 4c ff 9a 89 ac 40 9b 89-f0 f0 9a 89 24 00 9b 89 L....@......$...
899affbc 50 43 49 30 30 f3 9a 89-4c ff 9a 89 00 00 06 00 PCI00...L.......
899affcc 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
899affdc 58 0d 9c 89 00 00 00 00-48 4f 52 47 34 00 00 00 X.......HORG4...
899affec 00 f0 9a 89 50 00 00 00-30 00 00 00 02 00 00 00 ....P...0.......
899afffc 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
899b000c 00 00 00 00 00 00 00 00-00 00 00 00 48 4e 53 4f ............HNSO
899b001c 44 00 00 00 00 f0 9a 89-64 a0 91 89 68 00 9b 89 D.......d...h...
0: kd> gu
eax=00000000 ebx=f743b620 ecx=00000000 edx=00000000 esi=899c0d58 edi=899c0e78
eip=f7400355 esp=f789a220 ebp=f789a250 iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
ACPI!ACPIDetectPdoDevices+0x177:
f7400355 85c0 test eax,eax


0: kd> dx -r1 ((ACPI!_DEVICE_EXTENSION *)0x899c0d58)
((ACPI!_DEVICE_EXTENSION *)0x899c0d58) : 0x899c0d58 [Type: _DEVICE_EXTENSION *]
[+0x000] Flags : 0x40200002010020 [Type: unsigned __int64]
[+0x000] UFlags [Type: __unnamed]
[+0x008] Signature : 0x5f534750 [Type: unsigned long]
[+0x00c] DebugFlags : 0x0 [Type: unsigned long]
[+0x010] DispatchTable : 0xf743830c [Type: IRP_DISPATCH_TABLE *]
[+0x014] WorkContext [Type: WORK_QUEUE_CONTEXT]
[+0x014] Fdo [Type: _FDO_DEVICE_EXTENSION]
[+0x014] Filter [Type: _FILTER_DEVICE_EXTENSION]
[+0x014] Pdo [Type: _PDO_DEVICE_EXTENSION]
[+0x058] WorkQueue [Type: EXTENSION_WORKER]
[+0x058] Button [Type: BUTTON_EXTENSION]
[+0x058] Thermal [Type: THERMAL_EXTENSION]
[+0x058] LinkNode [Type: LINK_NODE_EXTENSION]
[+0x058] Dock [Type: DOCK_EXTENSION]
[+0x058] Processor [Type: _PROCESSOR_DEVICE_EXTENSION]
[+0x088] DeviceState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x08c] PreviousState : Stopped (0) [Type: _ACPI_DEVICE_STATE]
[+0x090] PowerInfo [Type: _ACPI_POWER_INFO]
[+0x10c] DeviceID : 0x899c1148 : 0x41 [Type: unsigned char *]
[+0x10c] Address : 0x899c1148 [Type: unsigned long]
[+0x110] InstanceID : 0x0 [Type: unsigned char *]
[+0x114] ResourceList : 0x0 [Type: _CM_RESOURCE_LIST *]
[+0x118] PnpResourceList : 0x0 [Type: _ObjData *]
[+0x11c] OutstandingIrpCount : 1 [Type: long]
[+0x120] ReferenceCount : 84 [Type: long]
[+0x124] HibernatePathCount : 0 [Type: long]
[+0x128] RemoveEvent : 0x0 [Type: _KEVENT *]
[+0x12c] AcpiObject : 0x899affac [Type: _NSObj *]
[+0x130] DeviceObject : 0x899050e8 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
[+0x134] TargetDeviceObject : 0x0 [Type: _DEVICE_OBJECT *]
[+0x138] PhysicalDeviceObject : 0x899050e8 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
[+0x13c] ParentExtension : 0x89981a18 [Type: _DEVICE_EXTENSION *]
[+0x140] ChildDeviceList [Type: _LIST_ENTRY]
[+0x148] SiblingDeviceList [Type: _LIST_ENTRY]
[+0x150] EjectDeviceHead [Type: _LIST_ENTRY]
[+0x158] EjectDeviceList [Type: _LIST_ENTRY]

参考:什么时候建立设备对象的设备节点
0: kd> kc
#
00 nt!PipEnumerateCompleted
01 nt!PipProcessDevNodeTree
02 nt!PiProcessReenumeration
03 nt!PipDeviceActionWorker
04 nt!PipRequestDeviceAction
05 nt!PipAddDevicesToBootDriverWorker
06 nt!PipApplyFunctionToServiceInstances
07 nt!PipAddDevicesToBootDriver
08 nt!IopInitializeBootDrivers
09 nt!IoInitSystem
0a nt!Phase1Initialization
0b nt!PspSystemThreadStartup
0c nt!KiThreadStartup

allocationStatus =PipAllocateDeviceNode(
childDeviceObject,
&childDeviceNode);

if (childDeviceNode) {

//
// We've found or created a devnode for the PDO that the
// bus driver just enumerated.
//
childDeviceNode->Flags |= DNF_ENUMERATED;

//
// Mark the device object a bus enumerated device
//
childDeviceObject->Flags |= DO_BUS_ENUMERATED_DEVICE;

//
// Put this new device node at the head of the parent's list
// of children.
//
PpDevNodeInsertIntoTree(DeviceNode, childDeviceNode);
参考结束:

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/4/15 20:03:41

智科毕设创新的课题集合

0 选题推荐 - 网络与信息安全篇 毕业设计是大家学习生涯的最重要的里程碑,它不仅是对四年所学知识的综合运用,更是展示个人技术能力和创新思维的重要过程。选择一个合适的毕业设计题目至关重要,它应该既能体现你的专业能力,又能满…

作者头像 李华
网站建设 2026/4/3 3:18:12

应对西门子官方合规审查的UG/NX专项准备

第一段:问题本质是什么? 作为一名在制造业摸爬滚打多年的技术工程师,我最近被西门子的官方合规审查打了个措手不及。说实话,这个词听起来挺吓人的,是像UG/NX这样的高端CAD软件,它本身已经是我们日常工作中最…

作者头像 李华
网站建设 2026/4/16 10:39:32

一遍搞定全流程!全网爆红的AI论文平台 —— 千笔写作工具

你是否曾为论文选题而发愁?是否在深夜里对着空白文档无从下笔?是否反复修改却仍不满意?论文写作的每一步都充满挑战,尤其是对于自考学生来说,时间紧张、资料繁杂、格式要求严格,让许多人苦不堪言。但如今&a…

作者头像 李华
网站建设 2026/4/16 10:40:38

<span class=“js_title_inner“>2026 奇点智能技术大会上海站官宣!解码AI Agent、世界模型与氛围编程等新范式</span>

“未来将没有前端、没有后端、没有全栈,只有 AI Agent 工程师。”身处一线开发的你,或许已经感受到了这股变化。在 AI 写代码、做决策、重构组织的当下,我们越来越清醒的意识到:这不仅是职位的更名,更是工业革命级的范…

作者头像 李华
网站建设 2026/4/16 10:45:35

文登潮汐表查询2026-02-04

位置:文登,日期:2026-02-04,农历:乙巳[蛇]年十二(腊)月十七,星期:星期三,潮汐类型:大潮活汛最高水位:380.00cm,最低水位:20.00cm&…

作者头像 李华