Skip to content

Instantly share code, notes, and snippets.

@Warpten
Created September 20, 2012 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Warpten/109270164362837da0be to your computer and use it in GitHub Desktop.
Save Warpten/109270164362837da0be to your computer and use it in GitHub Desktop.
Mainlol
int main()
{
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
HANDLE tool32 = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
BOOL process = Process32First(tool32, &pe32);
bool foundWow = false;
if (process == TRUE)
{
while ((Process32Next(tool32, &pe32)) == TRUE)
{
if (strcmp(pe32.szExeFile, "Wow.exe") == 0)
{
foundWow = true;
break;
}
}
}
CloseHandle(tool32);
if (foundWow)
std::cout << "Found Wow.exe." << std::endl;
else {
std::cout << "Wow.exe is not running." << std::endl;
return 1;
}
// 1. Grab the handle
HANDLE clientHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
if (!clientHandle) {
ErrorExit("OpenProcess()");
return 1;
}
// 2. Get path to executable
TCHAR wowPath[MAX_PATH];
if (!GetModuleFileNameEx(clientHandle, NULL, wowPath, MAX_PATH)) {
// Serious shit going on, invoke GetLastError here.
ErrorExit("GetModuleFileNameEx(clientHandle, NULL, wowPath, MAX_PATH)");
return 1;
}
std::cout << "Wow exe found at: " << wowPath << std::endl;
// 5. Check build
DWORD clientBuild = 0;
CheckClientBuild(clientHandle, 0x00BB8638, sizeof(DWORD), &clientBuild); // Grosse derp ici
printf("Tried reading client build: %u", clientBuild);
CloseHandle(clientHandle);
return 0;
}
void CheckClientBuild(HANDLE clientHandle, DWORD address, int len, void* buffer)
{
void* baseAddress = (void*)clientHandle;
printf("Base address %u", baseAddress);
DWORD rebasedAddress = DWORD(baseAddress) + address;
ReadProcessMemory(clientHandle, (void*)address, buffer, len, NULL);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment