• Amused
  • Angry
  • Annoyed
  • Awesome
  • Bemused
  • Cocky
  • Cool
  • Crazy
  • Crying
  • Down
  • Drunk
  • Embarrased
  • Enraged
  • Friendly
  • Geeky
  • Godly
  • Happy
  • Hateful
  • Hungry
  • Innocent
  • Meh
  • Piratey
  • Poorly
  • Sad
  • Secret
  • Shy
  • Sneaky
  • Tired
  • Wtf
  • At Work
  • CodenzHub
  • Coding
  • Deejaying
  • Donating
  • Drinking
  • Eating
  • Editing
  • Hacking
  • Hate Mailing
  • Jamin'
  • Lagging
  • Live Streaming
  • Lurking
  • No Status
  • Pawning
  • PC Gaming
  • PS Gaming
  • Raging
  • Reversing
  • Sleeping
  • Steam Gaming
  • Trolling
  • TwitchStreamer
  • Vodka!
  • Watching TV/Movie
  • Xbox Gaming
  • Youtuber
  • Zombies
  • Results 1 to 5 of 5
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Galhali's Avatar
      Join Date
      Dec 2012
      Posts
      17
      Thanks (-->)
      4
      Thanks (<--)
      4

      Question Need a help in my first memory hack

      John Kittz
      Hello it is my first memmory hack so sry for all stupid questions or something like that. I have one problem probably i writes bad pointer or something, becouse when i put all offsets in cheat engine all is fine. I read about memory hack at this forum but my english is not so awesome so i can miss something.

      Here is code:

      Code:
      #include <iostream>
      #include <Windows.h>
      #include <string>
      #include <ctime>
      #include <TlHelp32.h>
      #include <tchar.h>
      
      using namespace std;
      
      DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName);
      void WriteToMemory(HANDLE hProcHandle,DWORD BaseAddress);
      
      string GameName = "Civilization V";
      LPCSTR LGameWindow = "Sid Meier's Civilization V (DX11)";
      string GameStatus;
      
      bool IsGameAvail;
      
      
      
      //DWORD BaseAddress = {0x06F835C8};
      DWORD GoldOffsets[] = {0x8, 0xF374};
      
      int main()
      {
          HWND hGameWindow = NULL;
          DWORD dwProcID = NULL;
          HANDLE hProcHandle = NULL;
      
                  hGameWindow = FindWindow(NULL, LGameWindow);
                  if(hGameWindow)
                  {
                      GetWindowThreadProcessId( hGameWindow, &dwProcID);
                      if(dwProcID !=0)
                      {
                          hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE,  dwProcID);
                          if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                          {
                              GameStatus = "Failed to open process for valid handle";
                          }
                          else
                          {
                                   system("cls");
                                  cout<<"-----------------------------------------------"<<endl;
                                  cout<<"            Civilization V memory hack" <<endl;
                                  cout<<"-----------------------------------------------"<<endl<<endl;
                                  cout<<"             We are ready to hack !!           "<<endl;
                                  IsGameAvail = 1;
      
      
      
                          }
                      }
                      else
                      {
                          GameStatus = "Failed to Get process ID";
                      }
                  }
                  else
                  {
                   GameStatus = "Civilization V NOT FOUND";
                  }
          if(IsGameAvail)
          {
              DWORD baseAddress = dwGetModuleBaseAddress(dwProcID, "CvGameCoreDLLFinal Release.dll");
              DWORD staticOffset = 0x2335C8;
      
              DWORD BaseAddress = baseAddress + staticOffset;
      
              WriteToMemory(hProcHandle,BaseAddress);
          }
      
          CloseHandle(hProcHandle);
          CloseHandle(hGameWindow);
      
          return ERROR_SUCCESS;
      }
      
      DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
      {
      
       DWORD pointer = BaseAddress;
       DWORD pTemp = 0;
      
       DWORD pointerAddr;
       for(int c=0; c< PointerLevel; c++)
       {
           if(c==0)
           {
               ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
           }
           pointerAddr = pTemp + Offsets[c];
           ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
       }
       return pointerAddr;
      }
      
      void WriteToMemory(HANDLE hProcHandle,DWORD BaseAddress)
      {
          DWORD AddresToWrite;
      
              int moregold = 99900;
              DWORD AddressToWrite = FindDmaAddy(2, hProcHandle, GoldOffsets, BaseAddress);
              WriteProcessMemory(hProcHandle,(void*)AddressToWrite, &moregold, sizeof(moregold), NULL );
      }
      
      
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName)
      {
         DWORD_PTR dwModuleBaseAddress = 0;
         HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE , dwProcessIdentifier);
         if (hSnapshot != INVALID_HANDLE_VALUE)
         {
            MODULEENTRY32 ModuleEntry32;
            ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
            if (Module32First(hSnapshot, &ModuleEntry32))
            {
               do
               {
                  if (_tcscmp(ModuleEntry32.szModule, szModuleName) == 0)
                  {
                     dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
                     break;
                  }
               }
               while (Module32Next(hSnapshot, &ModuleEntry32));
            }
            CloseHandle(hSnapshot);
         }
         return dwModuleBaseAddress;
      }

      and here i have screen from Cheat Engine v. 6.2:
      Click image for larger version. 

Name:	Cheat_Engine.png 
Views:	18 
Size:	46.0 KB 
ID:	1567

      Offsets:
      8
      F374

      And final value from Cheat Engine :

      "CvGameCoreDLLFinal Release.dll"+2335C8

    2. #2
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      velreine's Avatar
      Join Date
      Aug 2012
      Location
      Denmark
      Posts
      37
      Thanks (-->)
      1
      Thanks (<--)
      0
      When Cheat Engine puts [ & ] brackets around an address it's because that it's the value of that address that holds the next address. In your example:

      FE351900 + 8 = FE351908
      [1EEC0024+F374] = FE351900

      So basicly:

      Your first "static address" is 1EEC0024, then you add your first offset "F374" to that. Which then gives you the address: 1EECF398 which actually holds the address FE351900. Then you just have to add your last offset which was 8.

      But an easy fix would be to reverse the order of offsets in your call to FindDmaAddy

      Change this line of code:
      DWORD GoldOffsets[] = {0x8, 0xF374};
      To this:
      DWORD GoldOffsets[] = {0xF374, 0x8};

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Galhali's Avatar
      Join Date
      Dec 2012
      Posts
      17
      Thanks (-->)
      4
      Thanks (<--)
      4
      Hello. I have done what u suggest but it doasn't help. I have made some check for this and i see the AddressToWrite have bad value but all time dont know where is mistake. maybe something is wrong with function what change modular base adress. I have 64 bit systemand maybe this function have some problems tu return right value.
      Last edited by Galhali; 01-17-2013 at 11:51 AM.

    4. #4
      Coder
      Learning to hack games!
       
      Feeling Normal
       
      Chuck E's Avatar
      Join Date
      Jan 2013
      Location
      United Kingdom
      Posts
      119
      Thanks (-->)
      30
      Thanks (<--)
      20
      Okay, I'm a noob at this moment, but looking at your code you have set the BaseAddress to be the start of the program itself. That is not right

      BaseAddress should be the static address (06F835C8). I assume that 06F835C8 is the final address in your trace through the pointers and is green in colour (green in CE)?

      That's why it works in CE, but not in your program.

      I don't think it matters which order you have the Offsets in, as they are added to the static address in order to locate the current address of the value you wish to hack. (anyone, feel free to correct me )

      Also, be sure that the address does not change every time you start a new game. That one got me the first time I tried this, lol
      Last edited by Chuck E; 01-17-2013 at 12:26 PM.

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Galhali's Avatar
      Join Date
      Dec 2012
      Posts
      17
      Thanks (-->)
      4
      Thanks (<--)
      4
      Cheats'n'Trainers
      Hello. Thx all for help i have change a bit my code for less functions and i have found one nice working code at multi pointers with modular last one. About question of order i have checked it and is no matter in what way we write offsets in both cases is work fine.

      here is my final code maybe someone will find in this one some answers:

      Code:
      #include <iostream>
      #include <Windows.h>
      #include <string>
      #include <ctime>
      #include <TlHelp32.h>
      #include <tchar.h>
      
      using namespace std;
      
      
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName);
      
      
      string GameName = "Civilization V";
      LPCSTR LGameWindow = "Sid Meier's Civilization V (DX11)";
      string GameStatus;
      
      bool IsGameAvail;
      
      
      DWORD GoldOffsets[] = {0x8, 0xF374};
      
      int main()
      {
          int moregold = 99999900;
          HWND hGameWindow = NULL;
          DWORD dwProcID = NULL;
          HANDLE hProcHandle = NULL;
      
          hGameWindow = FindWindow(NULL, LGameWindow);
          if(hGameWindow)
          {
              GetWindowThreadProcessId( hGameWindow, &dwProcID);
              if(dwProcID !=0)
              {
                  hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE,  dwProcID);
                  if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                  {
                      GameStatus = "Failed to open process for valid handle";
                  }
                  else
                  {
                      system("cls");
      
                      cout<<"-----------------------------------------------"<<endl;
                      cout<<"            Civilization V memory hack         "<<endl;
                      cout<<"-----------------------------------------------"<<endl;
                      cout<<"             We are ready to hack !!           "<<endl;
                      cout<<"-----------------------------------------------"<<endl;
                      IsGameAvail = 1;
      
                  }
              }
              else
              {
                  GameStatus = "Failed to Get process ID";
              }
          }
          else
          {
              GameStatus = "Civilization V NOT FOUND";
          }
          if(IsGameAvail)
          {
              DWORD baseAddress = dwGetModuleBaseAddress( dwProcID, _T("CvGameCoreDLLFinal Release.dll") );
              DWORD staticOffset = { 0x2335C8 };
              DWORD GoldOffset[] = { 0xF374, 0x8 };
      
              DWORD pointer = baseAddress;
              DWORD pTemp =0;
              DWORD pointerAddr;
      
              for( int c = 0; c < 2; c++ )
              {
                  if( c == 0 )
                  {
                      if( !ReadProcessMemory( hProcHandle, (LPCVOID)(pointer+staticOffset), &pTemp, sizeof(DWORD), NULL ) )
                          cout << "FAILED READ 1" << endl;
                  }
                  pointerAddr = pTemp + GoldOffset[c];
                  if( !ReadProcessMemory( hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(DWORD), NULL ) )
                      cout << "FAILED READ 2" << endl;
              }
      
              if ( !WriteProcessMemory(hProcHandle, (BYTE*)pointerAddr, &moregold, sizeof(moregold), NULL) )
                  cout << "FAILED WRITE" << endl;
              else
                  cout << "WORKS" << endl;
          }
      
          CloseHandle(hProcHandle);
          CloseHandle(hGameWindow);
      
          return ERROR_SUCCESS;
      }
      
      
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName)
      {
          DWORD_PTR dwModuleBaseAddress = 0;
          HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE , dwProcessIdentifier);
          if (hSnapshot != INVALID_HANDLE_VALUE)
          {
              MODULEENTRY32 ModuleEntry32;
              ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
              if (Module32First(hSnapshot, &ModuleEntry32))
              {
                  do
                  {
                      if (_tcscmp(ModuleEntry32.szModule, szModuleName) == 0)
                      {
                          dwModuleBaseAddress = (DWORD_PTR)ModuleEntry32.modBaseAddr;
                          break;
                      }
                  }
                  while (Module32Next(hSnapshot, &ModuleEntry32));
              }
              CloseHandle(hSnapshot);
          }
          return dwModuleBaseAddress;
      }
      Last edited by Galhali; 01-17-2013 at 02:23 PM.

    Similar Game Hacker Threads

    1. [Help] Dumping a whole region of memory somewhere to trick a memory check
      By windows.h in forum Hacking Help
      Replies: 6
      Last Post: 02-18-2016, 09:28 AM
    2. [Help] Coding a simple memory hack
      By KneeGrow in forum Hacking Help
      Replies: 5
      Last Post: 09-06-2015, 06:39 PM
    3. [Help] How to make Memory hack works online?
      By Jolyana in forum Hacking Help
      Replies: 6
      Last Post: 10-16-2014, 06:21 PM
    4. Replies: 7
      Last Post: 07-27-2014, 04:49 AM
    5. memory hack help
      By r0man in forum Hacking Help
      Replies: 3
      Last Post: 09-28-2013, 03:08 AM

    Tags for this Thread