// 初始化一个字符串,就是Kdbclass驱动的名字。
RtlInitUnicodeString(&uniNtNameString, KBD_DRIVER_NAME);
// 请参照前面打开设备对象的例子。只是这里打开的是驱动对象。
status = ObReferenceObjectByName (
&uniNtNameString,
OBJ_CASE_INSENSITIVE,
NULL,
0,
IoDriverObjectType,
KernelMode,
NULL,
&KbdDriverObject
);
// 如果失败了就直接返回
if(!NT_SUCCESS(status))
{
KdPrint(("MyAttach: Couldn't get the MyTest Device Object\n"));
return( status );
}
else
{
// 这个打开需要解应用。早点解除了免得之后忘记。
ObDereferenceObject(DriverObject);
}
// 这是设备链中的第一个设备
pTargetDeviceObject = KbdDriverObject->DeviceObject;
// 现在开始遍历这个设备链
while (pTargetDeviceObject)
{
// 生成一个过滤设备,这是前面读者学习过的。这里的IN宏和OUT宏都是
// 空宏,只有标志性意义,表明这个参数是一个输入或者输出参数。
status = IoCreateDevice(
IN DriverObject,
IN sizeof(C2P_DEV_EXT),
IN NULL,
IN pTargetDeviceObject->DeviceType,
IN pTargetDeviceObject->Characteristics,
IN FALSE,
OUT &pFilterDeviceObject
);
// 如果失败了就直接退出。
if (!NT_SUCCESS(status))
{
KdPrint(("MyAttach: Couldn't create the MyFilter Filter Device Object\n"));
return (status);
}
kd> !strct
No export strct found
kd> .chain
Extension DLL search Path:
C:\Program Files\Debugging Tools for Windows (x86)\WINXP;C:\Program Files\Debugging Tools for Windows (x86)\winext;C:\Program Files\Debugging Tools for Windows (x86)\winext\arcade;C:\Program Files\Debugging Tools for Windows (x86)\pri;C:\Program Files\Debugging Tools for Windows (x86);C:\Program Files\Debugging Tools for Windows (x86)\winext\arcade;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\SinoVoice\jTTS 5.0 Desktop\Bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\.;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\WinNT\.;;C:\Program Files\Lua\5.1;C:\Program Files\Lua\5.1\clibs;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\.;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\WinNT\.
Extension DLL chain:
dbghelp: image 6.12.0002.633, API 6.1.6, built Tue Feb 02 04:08:26 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\dbghelp.dll]
ext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:31 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\winext\ext.dll]
exts: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:24 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\WINXP\exts.dll]
kext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:22 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\winext\kext.dll]
kdexts: image 6.1.7650.0, API 1.0.0, built Tue Feb 02 04:08:19 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\WINXP\kdexts.dll]
kd> .load w2kfre\kdex2x86.dll
kd> !object \driver\i8042prt
Object: 82119330 Type: (821a55b8) Driver
ObjectHeader: 82119318 (old version)
HandleCount: 0 PointerCount: 5
Directory Object: e1022970 Name: i8042prt
kd> .chain
Extension DLL search Path:
C:\Program Files\Debugging Tools for Windows (x86)\WINXP;C:\Program Files\Debugging Tools for Windows (x86)\winext;C:\Program Files\Debugging Tools for Windows (x86)\winext\arcade;C:\Program Files\Debugging Tools for Windows (x86)\pri;C:\Program Files\Debugging Tools for Windows (x86);C:\Program Files\Debugging Tools for Windows (x86)\winext\arcade;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\SinoVoice\jTTS 5.0 Desktop\Bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\.;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\WinNT\.;;C:\Program Files\Lua\5.1;C:\Program Files\Lua\5.1\clibs;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\.;C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Bin\WinNT\.
Extension DLL chain:
w2kfre\kdex2x86.dll: image 3.00.2093.18, API 5.0.5, built Wed Mar 28 16:57:06 2001
[path: C:\Program Files\Debugging Tools for Windows (x86)\w2kfre\kdex2x86.dll]
dbghelp: image 6.12.0002.633, API 6.1.6, built Tue Feb 02 04:08:26 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\dbghelp.dll]
ext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:31 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\winext\ext.dll]
exts: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:24 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\WINXP\exts.dll]
kext: image 6.12.0002.633, API 1.0.0, built Tue Feb 02 04:08:22 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\winext\kext.dll]
kdexts: image 6.1.7650.0, API 1.0.0, built Tue Feb 02 04:08:19 2010
[path: C:\Program Files\Debugging Tools for Windows (x86)\WINXP\kdexts.dll]
kd> !strct _DRIVER_OBJECT 82119330
struct _DRIVER_OBJECT (sizeof=168)
+00 int16 Type = 0004
+02 int16 Size = 00a8
+04 struct _DEVICE_OBJECT *DeviceObject = 82137398
+08 uint32 Flags = 00000012
+0c void *DriverStart = F877A000
+10 uint32 DriverSize = 0000ba00
+14 void *DriverSection = 82119DF0
+18 struct _DRIVER_EXTENSION *DriverExtension = 821193D8
+1c struct _UNICODE_STRING DriverName
+1c uint16 Length = 0020
+1e uint16 MaximumLength = 0020
+20 uint16 *Buffer = E1648208
+24 struct _UNICODE_STRING *HardwareDatabase = 8066FFD8
+28 struct _FAST_IO_DISPATCH *FastIoDispatch = 00000000
+2c function *DriverInit = F8783385
+30 function *DriverStartIo = F877A974
+34 function *DriverUnload = F8780F24
+38 function *MajorFunction[28] = F877DB1A
804F4418
F8780E86
804F4418
804F4418
804F4418
804F4418
804F4418
804F4418
F877C1F8
804F4418
804F4418
804F4418
804F4418
F8780EB9
F877A89A
804F4418
804F4418
804F4418
804F4418
804F4418
804F4418
F8781857
F877DACD
804F4418
804F4418
804F4418
F877DA00
Members
Length
The length in bytes of the string stored in Buffer.
MaximumLength
The length in bytes of Buffer.
Buffer
Pointer to a buffer used to contain a string of wide characters.
楼主 文档是字节大小,不是字符~~~ 菜鸟滤过~~~