-
-
[原创]SSDT Hook 详细过程
-
发表于:
2013-12-29 14:33
14231
-
一。目标程序***********
//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;
}
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)