news 2026/5/1 4:49:23

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/18 8:03:26

球鞋购物|基于java+ vue球鞋购物系统(源码+数据库+文档)

球鞋购物 目录 基于springboot vue球鞋购物系统 一、前言 二、系统功能演示 三、技术选型 四、其他项目参考 五、代码参考 六、测试参考 七、最新计算机毕设选题推荐 八、源码获取: 基于springboot vue球鞋购物系统 一、前言 博主介绍:✌️大…

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

利用西门子Teamcenter API及ITK实现许可证管理的自动化集成

利用西门子公司Teamcenter API及ITK实现许可证管理的自动化集成 我一直在和企业的IT部门打交道,常常听到他们抱怨许可证管理的繁琐过程。特别是像我们这样的制造业企业,在使用大量软件工具时,许可证的审批、分配、使用情况监控、过期提醒等问…

作者头像 李华
网站建设 2026/4/25 15:32:33

JAVA 多态

第一章 多态 1.1 多态的形式 多态是继封装、继承之后,面向对象的第三大特性。 多态是出现在继承或者实现关系中的。 多态体现的格式: 父类类型 变量名 new 子类/实现类构造器; 变量名.方法名(); 多态的前提:有继承关系,子类…

作者头像 李华
网站建设 2026/4/16 2:04:33

导师严选!人气爆表的一键生成论文工具 —— 千笔·专业论文写作工具

你是否曾为论文选题发愁?是否在深夜面对空白文档无从下笔?是否反复修改却仍对表达不满意?MBA学生在论文写作中常常面临选题困难、框架混乱、文献查找繁琐、查重率高、格式错误等问题,这些都让学术之路充满挑战。而如今&#xff0c…

作者头像 李华
网站建设 2026/4/20 23:44:37

『n8n』初识界面

点赞 关注 收藏 学会了 整理了一个n8n小专栏,有兴趣的工友可以关注一下 👉 《n8n修炼手册》 n8n 的功能实在太多了,如果一个一个功能、节点、设置去学,那每个一年半载都学不完。 我的学习经验是直接上手,从最简单的…

作者头像 李华