Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[HELP]C++ Writting memory address

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
ginocapo
How do I cheat?
Reputation: 0

Joined: 01 Mar 2012
Posts: 6

PostPosted: Thu Mar 01, 2012 3:22 pm    Post subject: [HELP]C++ Writting memory address Reply with quote

Hello. Im making a game trainer, but i get lost in a part. I wanna "Write" a memory address which is "Text" type, and i dunno how to do this, i tried 500 ways, but neither work.

Im using Dev C++, and here is my code:

DWORD MyChar = char("im Cheater !!");
WriteProcessMemory(hOpen, Addr, &MyChar, 1, 0);

I even tried :
char MyChar[70] = "im Cheater!!";

hOpen is an already open process, war3.exe.


if you can help me on Write an "Text" memory value, i would be gratefull.
Thanks.
Back to top
View user's profile Send private message
sherwood
Newbie cheater
Reputation: 0

Joined: 06 Feb 2012
Posts: 11

PostPosted: Thu Mar 01, 2012 3:33 pm    Post subject: Reply with quote

MSVC code

Code:

#include <windows.h>
#include <tlhelp32.h>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>

bool Address1(const char * ProcessName, LPVOID MemoryAddress, const char * NewValue, int size);

int main()
{
     printf("Welcome to....\n\n");
     if(Address1("GAMENAME.exe", (void*) 0x02507CA8, "txt", 3));
          printf("Patched without errors.\n");
     else
          printf("Something went wrong!\n");
     system("pause");
     return 0;
}

bool Address1(const char * ProcessName, LPVOID MemoryAddress, const char * NewValue, int size)
{
     HANDLE hProcessSnap;
     HANDLE hProcess = NULL;
     PROCESSENTRY32 pe32;     
     hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
     pe32.dwSize = sizeof( PROCESSENTRY32 );
     Process32First(hProcessSnap, &pe32);
     do
     {         
          if(!strcmp(pe32.szExeFile, ProcessName))
          {
               hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, pe32.th32ProcessID);
               break;
          }
     }
     while(Process32Next(hProcessSnap, &pe32));
     CloseHandle( hProcessSnap );
     if(hProcess != NULL)
     {
          WriteProcessMemory(hProcess, MemoryAddress, NewValue, size, NULL);         
          CloseHandle(hProcess);     
          return true;
     }     
     return false;
}
Back to top
View user's profile Send private message
ginocapo
How do I cheat?
Reputation: 0

Joined: 01 Mar 2012
Posts: 6

PostPosted: Fri Mar 02, 2012 3:33 pm    Post subject: ty Reply with quote

THX!! thanks so much, your code works fine !!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites