当前位置: 首页 > news >正文

nt!PiProcessNewDeviceNode函数中nt!PiCreateDeviceInstanceKey

nt!PiProcessNewDeviceNode函数中nt!PiCreateDeviceInstanceKey

NTSTATUS
PiProcessNewDeviceNode(
IN PDEVICE_NODE DeviceNode
)
{
//
// Build the device instance path and create the instance key.
//
status = PiBuildDeviceNodeInstancePath(DeviceNode, busID, deviceID, instanceID);
if (NT_SUCCESS(status)) {

status = PiCreateDeviceInstanceKey(DeviceNode, &instanceKey, &disposition);
}


0: kd> kc
#
00 nt!PiCreateDeviceInstanceKey
01 nt!PiProcessNewDeviceNode
02 nt!PipProcessDevNodeTree
03 nt!PipDeviceActionWorker
04 nt!PipRequestDeviceAction
05 nt!IopInitializeBootDrivers
06 nt!IoInitSystem
07 nt!Phase1Initialization
08 nt!PspSystemThreadStartup
09 nt!KiThreadStartup
0: kd> dv
DeviceNode = 0x894ffea8
InstanceKey = 0xf789a388
Disposition = 0xf789a35c
keyValueInformation = 0x00000008
status = 0n0
unicodeString = ""
enumHandle = 0x80c9069c

status = IopOpenRegistryKeyEx(
&enumHandle,
NULL,
&CmRegistryMachineSystemCurrentControlSetEnumName,
KEY_ALL_ACCESS
);

0: kd> dv enumHandle
enumHandle = 0x80000244
0: kd> !handle 244

PROCESS 899a2278 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 0a200000 ObjectTable: e1000e38 HandleCount: 33.
Image: System

Kernel handle table at e1000e38 with 33 entries in use

0244: Object: e127f5e0 GrantedAccess: 000f003f Entry: e1004488
Object: e127f5e0 Type: (89996048) Key
ObjectHeader: e127f5c8 (old version)
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \REGISTRY\MACHINE\SYSTEM\CONTROLSET001\ENUM

if (NT_SUCCESS(status)) {

status = IopCreateRegistryKeyEx(
InstanceKey,
enumHandle,
&DeviceNode->InstancePath,
KEY_ALL_ACCESS,
REG_OPTION_NON_VOLATILE,
Disposition
);
if (NT_SUCCESS(status)) {


0: kd> dv InstanceKey
InstanceKey = 0xf789a388
0: kd> dx -r1 ((ntkrnlmp!void * *)0xf789a388)
((ntkrnlmp!void * *)0xf789a388) : 0xf789a388 [Type: void * *]
0x80000214 [Type: void *]
0: kd> !handle 214

PROCESS 899a2278 SessionId: none Cid: 0004 Peb: 00000000 ParentCid: 0000
DirBase: 0a200000 ObjectTable: e1000e38 HandleCount: 34.
Image: System

Kernel handle table at e1000e38 with 34 entries in use

0214: Object: e1271ae0 GrantedAccess: 000f003f Entry: e1004428
Object: e1271ae0 Type: (89996048) Key
ObjectHeader: e1271ac8 (old version)
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \REGISTRY\MACHINE\SYSTEM\CONTROLSET001\ENUM\ACPI\PNP0A03\2&DABA3FF&0

0: kd> dv Disposition
Disposition = 0xf789a35c
0: kd> dx -r1 ((ntkrnlmp!unsigned long *)0xf789a35c)
((ntkrnlmp!unsigned long *)0xf789a35c) : 0xf789a35c : 0x2 [Type: unsigned long *]
0x2 [Type: unsigned long]


通过文本模式设置迁移的键值应被视为“新键”。迁移的键值可通过设备实例键值下是否存在非零的REG_DWORD值“Migrated”来识别。
if (NT_SUCCESS(status)) {
//
// Keys migrated by textmode setup should be treated as "new".
// Migrated keys are identified by the presence of non-zero
// REG_DWORD value "Migrated" under the device instance key.
//
if (*Disposition != REG_CREATED_NEW_KEY) {


D:\srv03rtm\public\sdk\inc/winnt.h:9079:#define REG_CREATED_NEW_KEY (0x00000001L) // New Registry Key created

//
// Key creation/open disposition
//

#define REG_CREATED_NEW_KEY (0x00000001L) // New Registry Key created
#define REG_OPENED_EXISTING_KEY (0x00000002L) // Existing Key opened


if (*Disposition != REG_CREATED_NEW_KEY) {

keyValueInformation = NULL;
IopGetRegistryValue(
*InstanceKey,
REGSTR_VALUE_MIGRATED,
&keyValueInformation);
if (keyValueInformation) {

0: kd> p
eax=c0000034 ebx=f789a35c ecx=00030001 edx=00020000 esi=f789a388 edi=00000000
eip=80c9079f esp=f789a2ac ebp=f789a2cc iopl=0 nv up ei pl nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000206
nt!PiCreateDeviceInstanceKey+0x103:
80c9079f 8b45fc mov eax,dword ptr [ebp-4] ss:0010:f789a2c8=00000000
0: kd> dv keyValueInformation
keyValueInformation = 0x00000000

http://www.jsqmd.com/news/346310/

相关文章:

  • 2026贝赛思高分突破之路 考前冲刺辅导机构 提分机推荐与选择指南 - 品牌2025
  • Web3娱乐的“三角密码”:2026年哈希竞猜破局的三把钥匙
  • 2026英国留学机构选择指南:深度剖析五家代表性机构的核心竞争力 - 资讯焦点
  • 2025挖机改装臂厂家实力榜:从鹰嘴臂到岩石臂,高性价比品牌全解析 - 深度智识库
  • 四大旅行平台出票环节测评:失败情况与确认流程对比 - 资讯焦点
  • 第1章 Java语言概述----常见问题及解决方法
  • leetcode二分——153. 寻找旋转排序数组中的最小值
  • Go 语言实战:构建一个企微外部群“技术贴收藏夹”小程序后端
  • 同程旅行票务服务确定性保障体系分析 - 资讯焦点
  • 第1章 Java语言概述----注释(Comment)
  • 全球首款消费级心智原生机器人上市,CES Asia开启三大具身智能垂直论坛,美国AGIBOT量产上市,全球首只具身智能ETF上线
  • 安全应急装备产业发展研究报告:万亿市场规模+智能化模块化轻量化创新趋势
  • Java 版:利用外部群 API 实现自动“技术开课”倒计时提醒
  • 第1章 Java语言概述----Java程序运行机制及运行过程
  • 添加组件到idf项目中
  • AI搜索流量争夺战:武汉GEO优化公司实力解析与选型干货 - 品牌评测官
  • 绞磨机5吨型号 长云科技 响箭5号PLUS
  • 第1章 Java语言概述----Java语言的环境搭建
  • 2026中国软件技术发展洞察与趋势预测报告:AI领衔738亿融资+量子/低空飞行/星地互联网十大核心趋势
  • 第1章 Java语言概述----开发体验— HelloWorld
  • 8吨机动绞磨
  • 2026年摇摆筛厂家权威推荐:圆形/方形/摇摆筛振动筛设备源头厂家精选 - 品牌推荐官
  • 桂花网蓝牙网关M1500-XT 企业级全场景蓝牙连接解决方案
  • AB实验高级必修课(四):逻辑回归的“马甲”、AUC的概率本质与阈值博弈
  • 解决蛋白质构象异质性的原子级建模挑战!David Baker团队PLACER框架解析 - 指南
  • 参考文献崩了?8个AI论文写作软件测评:专科生毕业论文+开题报告神器推荐
  • 高并发指标中台选型:Aloudata CAN 横向扩展与架构稳定性深度评估
  • JYLN061 LORA无线数传终端:轻松代替有线485,适配恶劣工业环境
  • 评选和信通购物卡回收正规平台标准与前三平台解析 - 淘淘收小程序
  • 2026 论文写作工具红黑榜:AI 软件怎么选?一篇讲透