看流星社区

 找回密码
 注册账号
查看: 1892|回复: 0

驱动获取内核未导出函数地址

[复制链接]

该用户从未签到

发表于 2013-5-6 08:41:53 | 显示全部楼层 |阅读模式
ULONG GetFunctionAddress
(
IN ULONG FirstFeature,
IN ULONG SecondFeature,
IN ULONG ThirdFeature,
IN ULONG FourthFeature
)
{
NTSTATUS NtStatus=STATUS_SEVERITY_SUCCESS;
ULONG SystemInformationLength=0;
ULONG Index=0;
ULONG Loop=0;
ULONG ModuleBegin=0;
ULONG ModuleFinish=0;
PULONG SystemInformationBuffer=NULL;
PSYSTEM_MODULE_INFORMATION SystemModulePointer=NULL;
ULONG Value=0;
ZwQuerySystemInformation(SystemModuleInformation,NULL,0,&SystemInformationLength);
SystemInformationBuffer=ExAllocatePool(PagedPool,SystemInformationLength);
if (SystemInformationBuffer==NULL)
{
return NtStatus;
}
NtStatus=ZwQuerySystemInformation
(
SystemModuleInformation,
SystemInformationBuffer,
SystemInformationLength,
NULL
);
if (!NT_SUCCESS(NtStatus))
{
ExFreePool(SystemInformationBuffer);
return NtStatus;
}
if (MmIsAddressValid(SystemInformationBuffer)==False)
{
ExFreePool(SystemInformationBuffer);
return NtStatus;
}
SystemModulePointer=(PSYSTEM_MODULE_INFORMATION)(SystemInformationBuffer+1);
for (Index=0;Index<*(ULONG*)SystemInformationBuffer;Index++)
{
ModuleBegin=(ULONG)SystemModulePointer[Index].Base;
ModuleFinish=(ULONG)SystemModulePointer[Index].Base+SystemModulePointer[Index].Size;
for (Loop=ModuleBeginAddress;Loop<ModuleFinishAddress;Loop++)
{
if
(
*(ULONG*)(Loop+0)==FirstFeature&&
*(ULONG*)(Loop+4)==SecondFeature&&
*(ULONG*)(Loop+8)==ThirdFeature&&
*(ULONG*)(Loop+12)==FourthFeature
)
{
Value=Loop;
}
}
}
ExFreePool(SystemInformationBuffer);
return Value;
}
点击按钮快速添加回复内容: 支持 高兴 激动 给力 加油 苦寻 生气 回帖 路过 感恩
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

小黑屋|手机版|Archiver|看流星社区 |网站地图

GMT+8, 2024-5-14 07:19

Powered by Kanliuxing X3.4

© 2010-2019 kanliuxing.com

快速回复 返回顶部 返回列表