第二种读取SSDT表的

#include "passp.h" //包含头文件“pass.h”

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriver,PUNICODE_STRING str)
{

ULONG SSDT_NtOpenProcess_Addr; //声明 无符号长整型 局部变量。
// 存放:SSDT_NtOpenProcess_Addr 系统描述符号表 中 函数 NtOpenProcess 的当前地址。
__asm
{ int 3
push ebx //分配EBX,压入堆栈 等待使用
push eax //分配EAX,压入堆栈 等待使用
mov ebx,KeServiceDescriptorTable //系统描述符号表 的地址
mov ebx,[ebx] //取 系统描述符号表 的地址 里的数据,也就是 服务表基址给EBX。
mov eax,0x7a // 122 NtOpenProcess =转成十六进制 等于 7a
iuml eax,eax,4 // eax*4=7a*4=1e8
add ebx,eax // eax=1e8与服务表基址EBX 相加 结果放EBX寄存器里
mov ebx,[ebx] // 取ebx里面的内容给EBX
mov SSDT_NtOpenProcess_Addr,ebx //EBX给SSDT_NtOpenProcess_Addr
pop eax //EAX使用完毕,弹出堆栈
pop ebx //EBX使用完毕,弹出堆栈
}
DbgPrint("读取SSDT_NtOpenProcess_Addr=%0x \n",SSDT_NtOpenProcess_Addr);
//%0x 输出16进制。
//输出 系统描述符号表 中 函数 NtOpenProcess 的当前地址



//驱动 ->驱动卸载=卸载驱动
pDriver->DriverUnload=UnloadDriver;
//调试输出
DbgPrint("Loading mogui Driver...\n\r");

return 1;
}

void UnloadDriver(PDRIVER_OBJECT pDriver)
{
//调试输出
DbgPrint("unLoading mogui Driver...\n\r");

}

posted @ 2013-02-08 21:29  Rain's Bolg  阅读(869)  评论(0编辑  收藏  举报