nt!PiProcessNewDeviceNode函数中的PpQueryDeviceDescription和PpQueryDeviceLocationInformation
#define PpQueryDeviceDescription(dn, desc) PpIrpQueryDeviceText((dn)->PhysicalDeviceObject, DeviceTextDescription, PsDefaultSystemLocaleId, desc)
#define PpQueryDeviceLocationInformation(dn, loc) PpIrpQueryDeviceText((dn)->PhysicalDeviceObject, DeviceTextLocationInformation, PsDefaultSystemLocaleId, loc)
NTSTATUS
PpIrpQueryDeviceText(
IN PDEVICE_OBJECT DeviceObject,
IN DEVICE_TEXT_TYPE DeviceTextType,
IN LCID POINTER_ALIGNMENT LocaleId,
OUT PWCHAR *DeviceText
)
{
IO_STACK_LOCATION irpSp;
NTSTATUS status;
PAGED_CODE();
ASSERT(DeviceTextType == DeviceTextDescription || DeviceTextType == DeviceTextLocationInformation);
*DeviceText = NULL;
RtlZeroMemory(&irpSp, sizeof(IO_STACK_LOCATION));
irpSp.MajorFunction = IRP_MJ_PNP;
irpSp.MinorFunction = IRP_MN_QUERY_DEVICE_TEXT;
irpSp.Parameters.QueryDeviceText.DeviceTextType = DeviceTextType;
irpSp.Parameters.QueryDeviceText.LocaleId = LocaleId;
status = IopSynchronousCall(DeviceObject, &irpSp, (PULONG_PTR)DeviceText);
ASSERT(NT_SUCCESS(status) || (*DeviceText == NULL));
if (NT_SUCCESS(status)) {
if(*DeviceText == NULL) {
status = STATUS_NOT_SUPPORTED;
}
} else {
*DeviceText = NULL;
}
return status;
}
NTSTATUS
PiProcessNewDeviceNode(
IN PDEVICE_NODE DeviceNode
)
{
PpQueryDeviceDescription(DeviceNode, &description);
0: kd> kc
#
00 nt!PpIrpQueryDeviceText
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
irpSp.MajorFunction = IRP_MJ_PNP;
irpSp.MinorFunction = IRP_MN_QUERY_DEVICE_TEXT;
0: kd> kc
#
00 ACPI!ACPIDispatchIrp
01 nt!IofCallDriver
02 nt!IopSynchronousCall
03 nt!PpIrpQueryDeviceText
04 nt!PiProcessNewDeviceNode
05 nt!PipProcessDevNodeTree
06 nt!PipDeviceActionWorker
07 nt!PipRequestDeviceAction
08 nt!IopInitializeBootDrivers
09 nt!IoInitSystem
0a nt!Phase1Initialization
0b nt!PspSystemThreadStartup
0c nt!KiThreadStartup
0: kd> dv
DeviceObject = 0x899050e8 Device for "\Driver\ACPI"
Irp = 0x89905220
0: kd> g
Breakpoint 5 hit
eax=00000002 ebx=8990520c ecx=899c0e74 edx=f745b068 esi=f73fe214 edi=00000000
eip=f740410c esp=f789a20c ebp=f789a238 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!ACPIDispatchIrp+0x19c:
f740410c ffd6 call esi {ACPI!ACPIBusIrpUnhandled (f73fe214)}
0: kd> t
eax=00000002 ebx=8990520c ecx=899c0e74 edx=f745b068 esi=f73fe214 edi=00000000
eip=f73fe214 esp=f789a208 ebp=f789a238 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!ACPIBusIrpUnhandled:
f73fe214 55 push ebp
0: kd> kc
#
00 ACPI!ACPIBusIrpUnhandled
01 ACPI!ACPIDispatchIrp
02 nt!IofCallDriver
03 nt!IopSynchronousCall
04 nt!PpIrpQueryDeviceText
05 nt!PiProcessNewDeviceNode
06 nt!PipProcessDevNodeTree
07 nt!PipDeviceActionWorker
08 nt!PipRequestDeviceAction
09 nt!IopInitializeBootDrivers
0a nt!IoInitSystem
0b nt!Phase1Initialization
0c nt!PspSystemThreadStartup
0d nt!KiThreadStartup
0: kd> gu
eax=c00000bb ebx=8990520c ecx=80ae0dfa edx=80b18958 esi=f73fe214 edi=00000000
eip=f740410e esp=f789a214 ebp=f789a238 iopl=0 nv up ei ng nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000282
ACPI!ACPIDispatchIrp+0x19e:
f740410e ff75fc push dword ptr [ebp-4] ss:0010:f789a234=899c0d58
eax=c00000bb
0: kd> gu
eax=c00000bb ebx=899050e8 ecx=899c0e74 edx=80b18958 esi=f789a2c8 edi=899052b4
eip=80c95e00 esp=f789a25c ebp=f789a284 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
nt!IopSynchronousCall+0x1aa:
80c95e00 8bf0 mov esi,eax
0: kd> gu
eax=c00000bb ebx=00000000 ecx=00000000 edx=80b18958 esi=f789a370 edi=f789a2c8
eip=80c976c5 esp=f789a298 ebp=f789a2c8 iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
nt!PpIrpQueryDeviceText+0x8d:
80c976c5 8bd8 mov ebx,eax
0: kd> gu
eax=c00000bb ebx=00000000 ecx=00000000 edx=80b18958 esi=894ffea8 edi=899050e8
eip=80c93967 esp=f789a2e0 ebp=f789a38c iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
nt!PiProcessNewDeviceNode+0xe5:
80c93967 8d45e0 lea eax,[ebp-20h]
0: kd> dv description
description = 0x00000000
PpQueryDeviceLocationInformation(DeviceNode, &location);
irpSp.MajorFunction = IRP_MJ_PNP;
irpSp.MinorFunction = IRP_MN_QUERY_DEVICE_TEXT;
0: kd> t
eax=f789a36c ebx=00000000 ecx=00000000 edx=80b18958 esi=894ffea8 edi=899050e8
eip=80c97638 esp=f789a2cc ebp=f789a38c iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
nt!PpIrpQueryDeviceText:
80c97638 55 push ebp
0: kd> g
Breakpoint 74 hit
eax=0000001b ebx=00000000 ecx=89981f38 edx=89905220 esi=89905220 edi=899050e8
eip=f7403f70 esp=f789a23c ebp=f789a254 iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
ACPI!ACPIDispatchIrp:
f7403f70 55 push ebp
0: kd> g
Breakpoint 5 hit
eax=00000002 ebx=8990520c ecx=899c0e74 edx=f745b068 esi=f73fe214 edi=00000000
eip=f740410c esp=f789a20c ebp=f789a238 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!ACPIDispatchIrp+0x19c:
f740410c ffd6 call esi {ACPI!ACPIBusIrpUnhandled (f73fe214)}
0: kd> gu
eax=c00000bb ebx=00000000 ecx=899c0e74 edx=80b18958 esi=89905220 edi=899050e8
eip=80a2675c esp=f789a248 ebp=f789a254 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
nt!IofCallDriver+0x62:
80a2675c 5f pop edi
0: kd> gu
eax=c00000bb ebx=899050e8 ecx=899c0e74 edx=80b18958 esi=f789a2c8 edi=899052b4
eip=80c95e00 esp=f789a25c ebp=f789a284 iopl=0 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000202
nt!IopSynchronousCall+0x1aa:
80c95e00 8bf0 mov esi,eax
0: kd> gu
eax=c00000bb ebx=00000001 ecx=00000000 edx=80b18958 esi=f789a36c edi=f789a2c8
eip=80c976c5 esp=f789a298 ebp=f789a2c8 iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000286
nt!PpIrpQueryDeviceText+0x8d:
80c976c5 8bd8 mov ebx,eax
0: kd> gu
eax=c00000bb ebx=00000000 ecx=00000000 edx=80b18958 esi=894ffea8 edi=899050e8
eip=80c9397e esp=f789a2e0 ebp=f789a38c iopl=0 nv up ei pl zr na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00000246
nt!PiProcessNewDeviceNode+0xfc:
80c9397e 8d45d4 lea eax,[ebp-2Ch]