cały kod programu wygląda następująco :
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#pragma package(smart_init)
#pragma link "SHDocVw_OCX"
#pragma resource "*.dfm"
#include <tlhelp32.h>
#include <String>
using namespace std;
DWORD GetModuleBase()
{
MODULEENTRY32 moduleEntry = {0};
HANDLE snapShot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId());
DWORD base = 0;
if(!snapShot)
return 0;
moduleEntry.dwSize = sizeof(moduleEntry);
BOOL currentModule = Module32First(snapShot, &moduleEntry);
if(currentModule)
{
static char hold[1000];
memcpy(hold, moduleEntry.szModule, strlen(moduleEntry.szModule) + 1);
if(std::string(hold).find("Game.exe") == std::string(hold).size() - 4)
base = (DWORD)moduleEntry.modBaseAddr;
}
CloseHandle(snapShot);
return base;
}
DWORD AlignAddress(DWORD address)
{
static int base = (int)GetModuleBase();
static int XPBase = 0x400000;
address += (base - XPBase);
return address;
}
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
const DWORD PlayerExperienceAddr = 0x94CEAC; // login
int playerExp;
ReadProcessMemory(processHandle, (LPVOID)AlignAddress(PlayerExperienceAddr), &playerExp, 4, NULL);
}
jest to kod w c++ builder i ta funkcja to czytanie aslr stąd : http://czepekpage.pl/index.php?page=threads&tid=21
z góry dzięki za pomoc.