你需要 OpenProcess()->ReadprocessMemory() 和或 QueryVirtualEx()
您可以使用 lkd 或 livekd 来实现结果
livekd.exe
kd> !process 0 0
................
PROCESS 89d1d328 SessionId: 0 Cid: 0238 Peb: 7ffde000 ParentCid: 075c
DirBase: 14980320 ObjectTable: e14106f0 HandleCount: 23.
Image: Tutorial-i386.exe
........................
kd> .process /p /r 89d1d328
Implicit process is now 89d1d328
Loading User Symbols
.................
kd> ? poi(poi(poi(poi(poi(645390)+c)+14)+0)+18)
Evaluate expression: 1666 = 00000682]
![[1]](https://i.stack.imgur.com/b825y.png)
这是一个使用dbgeng functionswindbg sdk
错误检查的示例代码为简洁起见删除dbg打印
假定模块地址空间是not randomised / rebased (因此使用645390原样)
否则您可能需要从Ce中找到模块基础,VA from address (645390 -modbase)
在您的代码中计算R找到modbase和将计算的RVA读指针
if modbase在你的代码是400000和rva被1390使用401390的,而不是645390
#include <stdio.h>
#include <engextcpp.hpp>
int __cdecl main( void ){
IDebugClient* g_Client = NULL;
IDebugControl* g_Control = NULL;
IDebugSymbols* g_Symbols = NULL;
IDebugDataSpaces* g_Data = NULL;
ULONG Pid = NULL;
ULONG bytesread = NULL;
ULONG ptr = NULL;
DebugCreate( __uuidof(IDebugClient), (void**)&g_Client );
g_Client->QueryInterface( __uuidof(IDebugControl), (void**)&g_Control );
g_Client->QueryInterface( __uuidof(IDebugSymbols), (void**)&g_Symbols );
g_Client->QueryInterface( __uuidof(IDebugDataSpaces), (void**)&g_Data );
g_Client->GetRunningProcessSystemIdByExecutableName(
0,"Tutorial-i386.exe",DEBUG_GET_PROC_ONLY_MATCH,&Pid);
g_Client->AttachProcess(0,Pid,DEBUG_ATTACH_NONINVASIVE);
g_Control->WaitForEvent( 0, INFINITE );
g_Data->ReadVirtualUncached(0x645390,&ptr,sizeof(ptr),&bytesread);
g_Data->ReadVirtualUncached((ptr+0xc),&ptr,sizeof(ptr),&bytesread);
g_Data->ReadVirtualUncached((ptr+0x14),&ptr,sizeof(ptr),&bytesread);
g_Data->ReadVirtualUncached((ptr+0x0),&ptr,sizeof(ptr),&bytesread);
g_Data->ReadVirtualUncached((ptr+0x18),&ptr,sizeof(ptr),&bytesread);
printf("%-15s%d\n","5th lvl ptr =", ptr);
g_Client->DetachProcesses();
return 0;
}
