-
-
[原创]SSDT Hook 详细过程
-
发表于:
2013-12-29 14:33
14240
-
一。目标程序***********
//target.exe
int x=5;
int main()
{
while(1)
{
printf("%p %d",&x,x);
Sleep(20000);
}
}
int main()
{
int pid=0;
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);
HANDLE hProcessSnap =
::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
printf("CreateToolhelp32Snapshot 调用失败.\n");
return -1;
}
BOOL bMore = ::Process32First(hProcessSnap,&pe32);
while (bMore)
{
if(strcmp(pe32.szExeFile,"target.exe")==0)
{
pid=pe32.th32ProcessID;
break;
}
bMore = ::Process32Next(hProcessSnap,&pe32);
}
::CloseHandle(hProcessSnap);
HANDLE hOpen=OpenProcess(PROCESS_VM_READ, 0, pid);
PVOID pbaseaddr=(PVOID)0x40bdc0;
DWORD data=0;
DWORD readlen=0;
printf("%x",hOpen);
ReadProcessMemory(hOpen,pbaseaddr,&data,4,&readlen);
printf("%d",data);
system("pause");
return 0;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!