Okay so, I've made a few hacks that should hypothetically work. But they wont work for shit, because WriteProcessMemory just will not work. Well I am pretty sure I have to inject it as a dll if I want to use WriteProcessMemory. Now, I have an injector, and I've done some tests with DLL's etc using MessageBox to show messages and shit. Well it sorta works, I can get messagebox's to show up and things like that. But when I try to use WriteProcessMemory, it just... Doesn't work. I try using MessageBox->GetLastError() to show if there was any errors, but it was blank, meaning everything worked fine. Here's the code I tested with:
Code:
#include "Windows.h"
HWND handle;
DWORD pid;
HANDLE hProcess;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD reason,
LPVOID lpReserved
)
{
switch (reason)
{
case DLL_PROCESS_ATTACH:
handle=FindWindow(NULL,(LPCWSTR)"Garry's Mod");
GetWindowThreadProcessId(handle,&pid);
hProcess=OpenProcess(PROCESS_ALL_ACCESS,false,pid);
WriteProcessMemory(hProcess,(LPVOID)0x16CFA0C8,(LPCVOID)2,sizeof(2),NULL);
MessageBox(handle,(LPCWSTR)GetLastError(),NULL,MB_OK);
break;
}
return TRUE;
}
What am I doing wrong? What do I need to change? I remember reading some stuff about CreateThread and CreateRemoteThread, but I have no idea how to use them, anyone care to help? Specifically Hell_Demon just because I know you know what to do, and you never help me.
There is nothing wrong with the address.
~lilneo