Help with ReadProcessMemory function
I am trying to get the ReadProcessMemory function to work, but it doesnt seem to return anything useful. In the code below, I initiated output to 0 and the value of output does not change from my ReadProcessMemory function like expected. Am I missing anything? I am thinking that I need to include Kernel32.lib. somehow, but I have no idea really. Can someone point me in the right direction?
Code:
#include "stdafx.h"
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
DWORD bytes, wid;
HWND w3wnd = FindWindow(NULL, L"Warcraft III"); ;
GetWindowThreadProcessId(w3wnd, &wid);
HANDLE w3hnd = OpenProcess(PROCESS_ALL_ACCESS, false, wid);
if (w3wnd==NULL)
{
printf("Warcraft III not found...\n");
system("PAUSE");
return 0;
}
int output=0;
void* pointer=&output;
ReadProcessMemory(w3hnd, 0x00000000, pointer, 1, &bytes);
if (ReadProcessMemory==0)
printf("ReadProcessMemory FAILED!\n");
printf("%i", output);
system("PAUSE");
return 0;
}