news 2026/2/11 10:50:36

ACPI!ACPIDetectPdoDevices函数下半部分搜集关联信息

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ACPI!ACPIDetectPdoDevices函数下半部分搜集关联信息

ACPI!ACPIDetectPdoDevices函数下半部分搜集关联信息

0: kd> dv newRelationSize
newRelationSize = 5

PCI0
ACAD
CP00
CP01
ACPI\FixedButton


//
// Determine the size of the new relations. Use index as a
// scratch buffer
//
index = sizeof(DEVICE_RELATIONS) +
( sizeof(PDEVICE_OBJECT) * (newRelationSize - 1) );

//
// Allocate the new device relation buffer. Use nonpaged pool since we
// are at dispatch
//
newRelations = ExAllocatePoolWithTag(
NonPagedPool,
index,
ACPI_DEVICE_POOLTAG
);
if (newRelations == NULL) {

//
// Return failure
//
return STATUS_INSUFFICIENT_RESOURCES;

}

//
// Initialize DeviceRelations data structure
//
RtlZeroMemory( newRelations, index );


#define DEV_TYPE_NEVER_PRESENT 0x0000000000000001
#define DEV_TYPE_NOT_PRESENT 0x0000000000000002
#define DEV_TYPE_REMOVED 0x0000000000000004
#define DEV_TYPE_NOT_FOUND 0x0000000000000008
#define DEV_TYPE_FDO 0x0000000000000010
#define DEV_TYPE_PDO 0x0000000000000020
#define DEV_TYPE_FILTER 0x0000000000000040
#define DEV_TYPE_SURPRISE_REMOVED 0x0000000000000080
#define DEV_TYPE_NOT_ENUMERATED 0x0000000000000100

#define DEV_TYPE_PDO 0x0000000000000020
#define DEV_TYPE_NOT_PRESENT 0x0000000000000002
//
// Loop until we get back to the parent
//
while (deviceExtension != NULL) {

//
// The only objects that we care about are those that are marked as
// PDOs and have a phsyical object associated with them
//
if (deviceExtension->Flags & DEV_TYPE_PDO &&
deviceExtension->DeviceObject != NULL &&
!(deviceExtension->Flags & DEV_MASK_NOT_PRESENT) ) {

//
// We don't ObReferenceO here because we are still at
// dispatch level (and for efficiency's sake, we don't
// want to drop down)
//
newRelations->Objects[index] =
deviceExtension->DeviceObject;


0: kd> dt DEVICE_RELATIONS 899875a0
nt!DEVICE_RELATIONS
+0x000 Count : 0
+0x004 Objects : [1] 0x899050e8 _DEVICE_OBJECT
0: kd> dx -id 0,0,899a2278 -r1 (*((ntkrnlmp!_DEVICE_OBJECT * (*)[1])0x899875a4))
(*((ntkrnlmp!_DEVICE_OBJECT * (*)[1])0x899875a4)) [Type: _DEVICE_OBJECT * [1]]
[0] : 0x899050e8 : Device for "\Driver\ACPI" [Type: _DEVICE_OBJECT *]
0: kd> dd 899875a0
899875a0 00000000 899050e8 00000000 00000000
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> r
eax=02010020 ebx=f743b620 ecx=00402000 edx=00402000 esi=899c0d58 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000001


//
// Check to see if we have found all the objects that we care
// about. As in, don't mess the system by walking past the end
// of the device relations
//
if (newRelationSize == index) { //下断点

//
// Done
//
break;

}


0: kd> bp f7400533
0: kd> g
Breakpoint 87 hit
eax=00000000 ebx=f743b620 ecx=2000010a edx=00000000 esi=899ae008 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000001
0: kd> dd 899875a0
899875a0 00000000 899050e8 00000000 00000000
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00000000 ebx=f743b620 ecx=2000010a edx=00000000 esi=899aee58 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000001
0: kd> dd 899875a0
899875a0 00000000 899050e8 00000000 00000000
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00000020 ebx=f743b620 ecx=00406000 edx=00406000 esi=899aec58 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000002
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 00000000
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00000000 ebx=f743b620 ecx=2037010a edx=00000000 esi=899aea40 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000002
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 00000000
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00300020 ebx=f743b620 ecx=8051e010 edx=8051e010 esi=899ab690 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000003
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 8952a6c8
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00000000 ebx=f743b620 ecx=2037010a edx=00000000 esi=8990eaf0 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000003
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 8952a6c8
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00000000 ebx=f743b620 ecx=6030010a edx=00000000 esi=8990e8d8 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000003
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 8952a6c8
899875b0 00000000 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00300020 ebx=f743b620 ecx=8051e010 edx=8051e010 esi=89906008 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000004
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 8952a6c8
899875b0 8952a858 00000000 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268
0: kd> g
Breakpoint 87 hit
eax=00360020 ebx=f743b620 ecx=0058a000 edx=0058a000 esi=89906ea0 edi=899875a0
eip=f7400533 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+0x355:
f7400533 8b45f4 mov eax,dword ptr [ebp-0Ch] ss:0010:f789a244=00000005
0: kd> dd 899875a0
899875a0 00000000 899050e8 89906690 8952a6c8
899875b0 8952a858 8952a9e8 02050004 46706341
899875c0 89987568 8997706c 00000000 00000001
899875d0 00000001 f740d62c 89907c70 899771c4
899875e0 00180005 46706341 80bf6229 80bf6229
899875f0 020b0002 50706341 8957e130 89900280
89987600 8993eb28 8993eb28 5f534750 8993ea28
89987610 02120006 46706341 898a8188 89961268

//
// Update the size of the relations by the number of matches that we
// successfully made
//
newRelations->Count = index;
newRelationSize = index;


0: kd> dd 899875a0
899875a0 00000005 899050e8 89906690 8952a6c8
899875b0 8952a858 8952a9e8 02050004 46706341
0: kd> dt DEVICE_RELATIONS 899875a0
nt!DEVICE_RELATIONS
+0x000 Count : 5
+0x004 Objects : [1] 0x899050e8 _DEVICE_OBJECT


//
// We have to reference all of the objects that we added
//
index = (currentRelations != NULL ? currentRelations->Count : 0);
for (; index < newRelationSize; index++) {

//
// Attempt to reference the object
//
status = ObReferenceObjectByPointer(
newRelations->Objects[index],
0,
NULL,
KernelMode
);

//
// Update the device relation pointer
//
*DeviceRelations = newRelations;

//
// Done
//
return STATUS_SUCCESS;
}


0: kd> dv DeviceRelations
DeviceRelations = 0xf789a2a4
0: kd> dx -r1 ((ACPI!_DEVICE_RELATIONS * *)0xf789a2a4)
((ACPI!_DEVICE_RELATIONS * *)0xf789a2a4) : 0xf789a2a4 [Type: _DEVICE_RELATIONS * *]
0x899875a0 [Type: _DEVICE_RELATIONS *]
0: kd> dx -r1 ((ACPI!_DEVICE_RELATIONS *)0x899875a0)
((ACPI!_DEVICE_RELATIONS *)0x899875a0) : 0x899875a0 [Type: _DEVICE_RELATIONS *]
[+0x000] Count : 0x5 [Type: unsigned long]
[+0x004] Objects [Type: _DEVICE_OBJECT * [1]]

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

三套轨迹规划代码摆在眼前的时候,新手最容易懵圈的问题就是:到底哪个插值方法能让机械臂跳舞不抽风?今天咱们直接扒开代码看门道,手把手教你选姿势

六自由度机械臂三套代码-三次/五次/七次多项式样条插值曲线、五次B样条曲线插值-2 轨迹规划&#xff0c;圆弧轨迹&#xff0c;机器人工具箱&#xff0c;带源码注释。 起始点、中间点、终止点可自行修改。 &#xff08;一共三套代码。 机械臂数据可自行安需修改&#xff0c;适合…

作者头像 李华
网站建设 2026/2/8 2:54:33

XFCN兴飞 PZ254V-11-03P 2.54 排针

附注: 电压额定值:250V交流/直流当前评级:3.0AAC/DC 介电强度耐受电压:500VAC/分钟接触电压:最大20M2。绝缘电压:最小1000兆伏 工作温度:-40C至105C绝缘材料:聚酯。UL94V-0 接触材料:黄铜: 接触镀层:整体镍基Au或Sn镀层

作者头像 李华
网站建设 2026/2/9 20:36:20

玩转IoTDB文件体系:核心工具与数据目录、TsFile全维度查看实战

IoTDB作为专为时序数据设计的高性能数据库&#xff0c;其底层以TsFile为核心的文件体系是保障数据存储、读写性能的关键&#xff0c;而数据目录的合理管理、各类核心文件的精准查看则是日常运维、问题排查、性能调优的基础能力。 本文将从IoTDB文件体系底层逻辑出发&#xff0…

作者头像 李华
网站建设 2026/2/9 18:42:12

Gemma 3 270M:专为超高效AI设计的紧凑模型

介绍 Gemma 3 270M&#xff1a;用于超高效AI的紧凑模型 过去几个月对于Gemma系列开源模型来说是一段激动人心的时期。先是推出了Gemma 3和Gemma 3 QAT&#xff0c;为单个云和桌面加速器提供了最先进的性能。随后&#xff0c;又宣布了Gemma 3n的全面发布&#xff0c;这是一种移…

作者头像 李华
网站建设 2026/2/11 9:34:41

计算机毕业设计|基于springboot + vue家政服务平台系统(源码+数据库+文档)

家政服务平台 目录 基于springboot vue家政服务平台系统 一、前言 二、系统功能演示 三、技术选型 四、其他项目参考 五、代码参考 六、测试参考 七、最新计算机毕设选题推荐 八、源码获取&#xff1a; 基于springboot vue家政服务平台系统 一、前言 博主介绍&…

作者头像 李华
网站建设 2026/2/9 23:22:16

四通道32孔生物源性检测仪

问&#xff1a;这款四通道32孔生物源性检测仪&#xff0c;核心能解决什么检测问题&#xff1f; 答&#xff1a;核心就是帮大家“辨真伪、保靠谱”&#xff0c;精准检测肉类及肉源性样品中的动物源性成分&#xff01;它支持同步检测猪、牛、羊、鸡、鸭、马等多种动物源性成分&a…

作者头像 李华