 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Ravskie How do I cheat?
Reputation: 0
Joined: 05 Oct 2010 Posts: 2
|
Posted: Tue Oct 05, 2010 5:00 am Post subject: Can change in CheatEngine but not in C++? |
|
|
Hey,
Code: |
DWORD dw, dw2;
HANDLE hProcessSnap;
HANDLE hProcess = NULL;
VirtualProtectEx(hProcess, (void *)0x1C9B57B3, sizeof(0x1C9B57B3), PAGE_EXECUTE_READWRITE, &dw);
PROCESSENTRY32 pe32;
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hProcessSnap, &pe32);
do
{
if(!strcmp(pe32.szExeFile, "deadrising2.exe"))
{
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
break;
}
}
while(Process32Next(hProcessSnap, &pe32));
CloseHandle( hProcessSnap );
if(hProcess != NULL)
{
WriteProcessMemory(hProcess, (void *)0x1C9B57B3, "DR2MP", sizeof(0x1C9B57B3), NULL);
CloseHandle(hProcess);
return true;
}
|
And I've also tried:
Code: |
DWORD dw, dw2;
VirtualProtect((void *)0x1C9B57B3, sizeof(0x1C9B57B3), PAGE_EXECUTE_READWRITE, &dw);
strcpy((void *)0X1C9B57B3, "DR2MP", sizeof(0x1C9B57B3));
VirtualProtect((void *)0x1C9B57B3, sizeof(0x1C9B57B3), dw, &dw2);
|
Problem is, i can change that address in cheat engine and the button text changes to DR2MP, but when i try it in C++ it just refuses to change?
Any ideas why this wont work?
Please help if you can, thanks!
|
|
Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Tue Oct 05, 2010 5:24 pm Post subject: Re: Can change in CheatEngine but not in C++? |
|
|
Virtually every one of those functions has the possibility of failing, yet you aren't doing any error-checking whatsoever. You're calling virtual protect on an uninitialized process handle, you're probably passing the wrong value for the size parameter of writeprocessmem, and you're possibly failing by asking for process_all_access instead of more granular permissions. There might be more, dunno. I'd scrap what you have and google for some better examples.
Cheers,
adude
Ravskie wrote: | Hey,
Code: |
DWORD dw, dw2;
HANDLE hProcessSnap;
HANDLE hProcess = NULL;
VirtualProtectEx(hProcess, (void *)0x1C9B57B3, sizeof(0x1C9B57B3), PAGE_EXECUTE_READWRITE, &dw);
PROCESSENTRY32 pe32;
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hProcessSnap, &pe32);
do
{
if(!strcmp(pe32.szExeFile, "deadrising2.exe"))
{
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
break;
}
}
while(Process32Next(hProcessSnap, &pe32));
CloseHandle( hProcessSnap );
if(hProcess != NULL)
{
WriteProcessMemory(hProcess, (void *)0x1C9B57B3, "DR2MP", sizeof(0x1C9B57B3), NULL);
CloseHandle(hProcess);
return true;
}
|
And I've also tried:
Code: |
DWORD dw, dw2;
VirtualProtect((void *)0x1C9B57B3, sizeof(0x1C9B57B3), PAGE_EXECUTE_READWRITE, &dw);
strcpy((void *)0X1C9B57B3, "DR2MP", sizeof(0x1C9B57B3));
VirtualProtect((void *)0x1C9B57B3, sizeof(0x1C9B57B3), dw, &dw2);
|
Problem is, i can change that address in cheat engine and the button text changes to DR2MP, but when i try it in C++ it just refuses to change?
Any ideas why this wont work?
Please help if you can, thanks! :P |
|
|
Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Tue Oct 05, 2010 6:18 pm Post subject: |
|
|
What the heck does 'sizeof(0x1C9B57B3)' even resolve to ?
|
|
Back to top |
|
 |
Ravskie How do I cheat?
Reputation: 0
Joined: 05 Oct 2010 Posts: 2
|
Posted: Tue Oct 05, 2010 10:06 pm Post subject: |
|
|
Alright,
I fixed up my code, but yet she still doesnt work
Here's what i have atm:
Code: |
bool CMemory::InstallStringPatch(DWORD address, const char * string, int size)
{
DWORD dw;
HANDLE hProcessSnap;
HANDLE hProcess = NULL;
PROCESSENTRY32 pe32;
hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
Process32First(hProcessSnap, &pe32);
do
{
if(!strcmp(pe32.szExeFile, "deadrising2.exe"))
{
hProcess = OpenProcess(PROCESS_VM_WRITE, FALSE, pe32.th32ProcessID);
break;
}
}
while(Process32Next(hProcessSnap, &pe32));
CloseHandle(hProcessSnap);
if(hProcess != NULL)
{
VirtualProtectEx(hProcess, (void *)address, size, PAGE_READWRITE, &dw);
WriteProcessMemory(hProcess, (void *)address, string, size, NULL);
CloseHandle(hProcess);
MessageBox(0, "WROTE TO THE ADDRESS", "it wrote", NULL);
return true;
}
return true;
}
|
Now when i call it, i do get the message box, but there has got to be something wrong as it does not change the value, but i cannot pinpoint what?
Code: |
m_pCMemory->InstallStringPatch(BUTTON_MENU_START, "DR2MP", 5);
|
Is how i call it.
Anyone know why still?
|
|
Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Tue Oct 05, 2010 11:25 pm Post subject: |
|
|
Dude, check your return values for errors. Writeprocessmem is probably failing because you still don't have the correct permissions.
|
|
Back to top |
|
 |
Ravskie How do I cheat?
Reputation: 0
Joined: 05 Oct 2010 Posts: 2
|
Posted: Wed Oct 06, 2010 1:11 am Post subject: |
|
|
OMG i got it!
|
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|