
Originally Posted by
Void
If you've just started C++, let go of .NET for now and start with console applications.
[php]
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HWND hwnd = FindWindow("Calculator",0);
DWORD pid;
GetWindowThreadProcessId(hwnd,&pid);
HANDLE handle = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE,0,pid);
//WriteProcessMemory
}
[/php]
That's a pretty basic template, to write to the processes memory, just use
WriteProcessMemory.
Also, FindWindow uses the caption name, which isn't always good especially if you have really long captions. My suggestion would be to use a combination of
CreateToolhelp32Snapshot,
Process32First and
Process32Next. This combination removes the need to use GetWindowThreadProcessId, the process ID will be in the structure you got from Process32First/Process32Next.
Good luck.
Well it kind of depends, i did just start about a week ago, and i already had the code you gave me, i also read in another article you or someone else said that a nice GUI isn't a requirement for a hack, which is true. And i think i might just leave it for now then.
So with that being said, i hope you don't mind if i ask another C++ question then.
You see, like i said i already had the code, or similar to it then. I am trying to get Unlimited Power in Split/Second, i have the memory code but i don't know if it is properly structured.
Using Cheat engine i found the code was '004BDE26'
But the tutorial explaining to write/freeze the memory in question etc. has a 0x in it, i don't know if that's a different code or just 0x4BDE26
Oh and eh, here is the code i am using, i just tested it and my game crashed :P Though it does work, i might want to look into your other way of finding windows, but for now i just want to see if i can get this to work
Here is my current code:
[php]#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HWND hWnd = FindWindow(0, "Split/Second"); // Split/Second - Calculator
if(hWnd == 0)
{
MessageBox(0, "Error cannot find window.", "Error", MB_OK|MB_ICONERROR);
}
else
{
DWORD proccess_ID;
GetWindowThreadProcessId(hWnd, &proccess_ID);
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proccess_ID);
if(!hProcess)
{
MessageBox(0, "Could not open the process!", "Error!", MB_OK|MB_ICONERROR);
}
else
{
int newdata = 999;
DWORD newdatasize = sizeof(newdata);
// Freeze Process
while(1)
{
// Say Nothing, just do for now.
if(WriteProcessMemory(hProcess, (LPVOID)0x4BDE26, &newdata, newdatasize, NULL))
{
//MessageBox(NULL, "WriteProcessMemory worked.", "Success", MB_OK + MB_ICONINFORMATION);
}
else
{
//MessageBox(NULL, "Error cannot WriteProcessMemory!", "Error", MB_OK + MB_ICONERROR);
}
CloseHandle(hProcess);
}
}
}
return 0;
}[/php]