[HELP] With Code

Posts 1–7 of 7 · Page 1 of 1
[HELP] With Code
if i changing value 018ED5F4 this address in tsearch it work, but with this code dont work. can you help? No problem with compile

Code:
#include <windows.h> 
#include <tlhelp32.h> 
#include <cstdio> 

bool WriteMemValue(const char * ProcessName, LPVOID MemoryAddress, int NewVal, int size);

int main()
{
     printf("C++ Game Trainer\n"); 
     if(WriteMemValue("pes2011demo.EXE", (void*) 0x018ED5F4, 10, 4)) 
     {
          printf("Score changed successfully.\n"); 
      }
     else 
     {
          printf("Failed to edit score.\n"); 
      }
     system("PAUSE"); 
     return 0; 
}

bool WriteMemValue(const char * ProcessName, LPVOID MemoryAddress, int NewVal, int size)
{
         HANDLE hProcessSnap;
         HANDLE hProcess = NULL;
         PROCESSENTRY32 pe32;    
         hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
         pe32.dwSize = sizeof( PROCESSENTRY32 );
       
         do
         {                
                  if(!strcmp(pe32.szExeFile, ProcessName))
                  {
                           hProcess = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, pe32.th32ProcessID);
                           break;
                  }
         }
         while(Process32Next(hProcessSnap, &pe32));
         CloseHandle( hProcessSnap );
         if(hProcess != NULL)
         {
                  WriteProcessMemory(hProcess, MemoryAddress, &NewVal, size, NULL);                  
                  CloseHandle(hProcess);         
                  return true;
         }       
         return false;
}
Does ur program go to the fail message or the good message?
Yup.

This code doesn't work either.

Code:
#include "stdafx.h"
#include <iostream>
int main()
{
     std::cout << "hi"; 
     return 0; 
}
(You need to give us more detail)
dunno if it is a error message or something, but if you are saying that it won't work in game without any error, you probably need to freeze the value in the address which you are not doing...? Dunno if TSearch automatically freezes values..

edit: btw i see C there =o
0 error(s), 0 warning(s)

but This program doesnt set a new value.
"Failed to edit score"
Quote Originally Posted by mayon22 View Post
0 error(s), 0 warning(s)

but This program doesnt set a new value.
"Failed to edit score"
Well considering your WriteMem func has only one check Im going to say that this is the problem:

Code:
if(hProcess != NULL)
why dont you try running your program after the other one starts.
Check the returns.. and be sure that the value didn't change.

Everytime you restart the game the value will be different, unless you find it's pointer.
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us