• 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
  • Page 1 of 2 12 LastLast
    Results 1 to 10 of 12
    1. #1
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Nemesis3212's Avatar
      Join Date
      Oct 2013
      Posts
      7
      Thanks (-->)
      0
      Thanks (<--)
      0

      Need Help with "WriteProcessMemory"

      John Kittz
      Hey,

      this is my frist time trying to use this function. I wanted to create a little trainer for Assault Cube and used Fleep's guide as refence. Sadly i can't find my error. Everything works great but the WriteProcessMemory part.

      Here's my code:
      Spoiler: sourcecode in here
      #include <iostream>
      #include <Windows.h>
      #include <fstream>
      #include <string>
      #include <TlHelp32.h>
      #include <tchar.h>


      using namespace std;

      HWND hwnd = FindWindow(0, L"AssaultCube");
      DWORD ReadAdress(HANDLE ProcessHandle, int PointerLevel, DWORD StaticOffset, DWORD Offsets[], DWORD BaseAdress);
      DWORD_PTR dwGetModuleBaseAddress(DWORD dwProcessIdentifier, TCHAR *szModuleName);

      DWORD id;
      HANDLE processhandle;

      DWORD EXEBaseAdress;
      bool hackrunning = false;
      bool endprocess = false;

      DWORD HealthStaticOffset = 0x00109B74;
      DWORD HealthOffsets[] = { 0xf8 };
      DWORD HealthValue;
      DWORD FullHealth[] = { 0x64 };

      DWORD RifleAmmoStaticOffset = 0x0010F4F4;
      DWORD RifleAmmoOffsets[] = { 0x150 };
      DWORD RifleAmmoValue;
      DWORD FullRifleAmmo[] = { 0x14 };


      int main(){
      if (!hwnd) cout << "AssaultCube not found!" << endl;
      else{
      GetWindowThreadProcessId(hwnd, &id);
      processhandle = OpenProcess(PROCESS_ALL_ACCESS, false, id);
      DWORD EXEBaseAdress = dwGetModuleBaseAddress(id, _T("ac_client.exe"));
      while (endprocess == false){
      if (GetAsyncKeyState(VK_INSERT)){
      hackrunning = true;
      }
      if (GetAsyncKeyState(VK_END)){
      hackrunning = false;
      }
      if (GetAsyncKeyState(VK_DELETE)){
      endprocess = true;
      }
      if (hackrunning == false){
      system("cls");
      cout << "Hack paused!" << endl;
      cout << "Press INSERT to activate it." << endl;
      }
      else{
      HealthValue = ReadAdress(processhandle, 1, HealthStaticOffset, HealthOffsets, EXEBaseAdress);
      WriteProcessMemory(processhandle, (LPVOID)HealthValue, &FullHealth, sizeof(FullHealth), NULL);
      RifleAmmoValue = ReadAdress(processhandle, 1, RifleAmmoStaticOffset, RifleAmmoOffsets, EXEBaseAdress);
      WriteProcessMemory(processhandle, (LPVOID)RifleAmmoValue, &FullRifleAmmo, sizeof(FullRifleAmmo), NULL);

      system("cls");
      cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
      cout << " AssaultCube found!" << endl;
      cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
      cout << "Press INSERT to start the Hack" << endl;
      cout << "Press END to stop the Hack" << endl;
      cout << "Press DELETE to end the Process" << endl;
      cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
      cout << "Current Health: " << HealthValue << endl;
      cout << "Current RifleAmmo: " << RifleAmmoValue << endl;
      cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
      cout << "Current Status: " << hackrunning << endl;
      cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
      }
      }
      }
      return 0;
      }


      DWORD ReadAdress(HANDLE ProcessHandle, int PointerLevel, DWORD StaticOffset, DWORD Offsets[], DWORD BaseAdress){
      DWORD TempAdress;
      int c = 0;
      int PointerCounter = 1;
      if (PointerLevel == 0){
      TempAdress = BaseAdress + StaticOffset;
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      if (PointerLevel >= 1){
      TempAdress = BaseAdress + StaticOffset;
      while (PointerCounter <= PointerLevel){
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      TempAdress += Offsets[c];
      PointerCounter++;
      c++;
      }
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      return TempAdress;
      }


      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;
      }


      Another question is why Fleep used an array with a size of 4 to write a new value to health and ammo. Is maybe something wrong with the value im trying to write at the process?

      Thanks in advance,

      Nemesis3212.

    2. #2
      Hacker
      Retired
       
      Pawning
       
      Crazywink's Avatar
      Join Date
      Jul 2012
      Location
      US
      Posts
      647
      Thanks (-->)
      111
      Thanks (<--)
      226
      What is the exact error you're getting?

    3. #3
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Nemesis3212's Avatar
      Join Date
      Oct 2013
      Posts
      7
      Thanks (-->)
      0
      Thanks (<--)
      0
      I dont get any error. The program compiles and runes fine, but it doesn't write the values. I can empty my magazine and nothing happens. As far as i understood it the writefunction should reset the ammostatus to a given number. But its just not working :/

    4. #4
      Hacker
      Retired
       
      Pawning
       
      Crazywink's Avatar
      Join Date
      Jul 2012
      Location
      US
      Posts
      647
      Thanks (-->)
      111
      Thanks (<--)
      226
      I haven't had time to look at your source but I noticed your address are different from Fleep's, maybe try his base and offsets and see if that works.

    5. #5
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Nemesis3212's Avatar
      Join Date
      Oct 2013
      Posts
      7
      Thanks (-->)
      0
      Thanks (<--)
      0
      reading works great. I dont have any problem with that. The only problem is writing because it doesn't work at all.

    6. #6
      Newbie
      Studying, Coding, Vacationing,
      Hacking
       
      Coding
       
      NebulaGrey's Avatar
      Join Date
      Jun 2014
      Location
      Kentucky
      Posts
      31
      Thanks (-->)
      1
      Thanks (<--)
      5
      I think you're reading up to your value then writing to that.
      If your Reads are working your writes must also work. Be sure you're reading through your pointers and stopping at the right address.

    7. #7
      Hacker
      Working, University, Coding ..
       
      Drinking
       
      GAFO666's Avatar
      Join Date
      Aug 2012
      Location
      if(PlayerBase << 16) return IdontKnow("yolo");
      Posts
      531
      Thanks (-->)
      33
      Thanks (<--)
      102
      -.-' why ppl ever use rpm and wpm if there are easier ways, so my default answer here ..... :
      Code:
      //Put your old stuff 
      DWORD RifleAmmoStaticOffset = 0x0010F4F4;
      DWORD RifleAmmoOffsets[] = { 0x150 };
      DWORD RifleAmmoValue;
      DWORD FullRifleAmmo[] = { 0x14 };
      
      //to following:
      DWORD RiffleAmmo = yourBase + yourOffset;
      
      while(InfiniteAmmo)
      {
              *((float*)(RiffleAmmo)) = 666;
      }
      
      // reading like
      cout << "Curr Ammo: " << *((float*)(RiffleAmmo)) << endl;
      ,greez

      ps: or continue use wpm and stuff, i hate wpm/rpm xD

      Leave a rep+ if I helped you with my answer
      Dont tell me to google something, first thing I do before asking is searching on my own.

    8. #8
      The Angel Of Verdun
      Always More To Code!
       
      Lurking
       
      Nether's Avatar
      Join Date
      Dec 2013
      Location
      England, SW
      Posts
      299
      Thanks (-->)
      54
      Thanks (<--)
      186
      Quote Originally Posted by GAFO666 View Post
      -.-' why ppl ever use rpm and wpm if there are easier ways, so my default answer here ..... :
      Code:
      //Put your old stuff 
      DWORD RifleAmmoStaticOffset = 0x0010F4F4;
      DWORD RifleAmmoOffsets[] = { 0x150 };
      DWORD RifleAmmoValue;
      DWORD FullRifleAmmo[] = { 0x14 };
      
      //to following:
      DWORD RiffleAmmo = yourBase + yourOffset;
      
      while(InfiniteAmmo)
      {
              *((float*)(RiffleAmmo)) = 666;
      }
      
      // reading like
      cout << "Curr Ammo: " << *((float*)(RiffleAmmo)) << endl;
      ,greez

      ps: or continue use wpm and stuff, i hate wpm/rpm xD
      Well considering they are hacking their game of choice externally they have no choice to use WPM/RPM or an engine function enumerated, this thread was also pretty old and I think the guy fixed it, although if you haven't fixed it yet I would suggest checking your loops and if statements and possibly use my memory class that I posted it is much easier to use, and much easier to help you if you have problems whilst using it.
      No Need For Anything Extravagant, Your Blood As A Present Shall Suffice.

    9. #9
      Newbie
      Learning to hack games!
       
      Feeling Normal
       
      Nemesis3212's Avatar
      Join Date
      Oct 2013
      Posts
      7
      Thanks (-->)
      0
      Thanks (<--)
      0
      I wasnt able to fix my problem yet. As i said, reading works perfectly fine. Assault Cube is the second game i used to read some adresses with the same method and it worked great every time. The only problem is that writing doesn't seem to be successfull at all! I really can't find my mistake. Here is another example that shows my problem maybe a bit better.

      Main Function:


      //Rifle Ammo
      DWORD RifleStaticCast = 0x0010F4F4;
      DWORD RifleOffsets[] = { 0x150 };
      DWORD RifleValue;
      int FullAmmo = 21;

      int main(){
      if (!hwnd) cout << "AssaultCube not found!" << endl;
      else{
      GetWindowThreadProcessId(hwnd, &id);
      processhandle = OpenProcess(PROCESS_ALL_ACCESS, false, id);
      DWORD EXEBaseAdress = dwGetModuleBaseAddress(id, _T("ac_client.exe"));

      while (1 < 2){
      RifleValue = ReadAdress(processhandle, 1, RifleStaticCast, RifleOffsets, EXEBaseAdress);

      if (RifleValue <= 19){
      cout << "Low ammo detected!" << endl;
      RifleValue = ReadAdress(processhandle, 1, RifleStaticCast, RifleOffsets, EXEBaseAdress);

      if (WriteProcessMemory(processhandle, (LPVOID)RifleValue, &FullAmmo, sizeof(FullAmmo), NULL)){
      cout << "Value has got changed!";
      }
      else{
      cout << "Value hasn't been changed!";
      }
      system("cls");
      }
      else{
      cout << "Ammo is full!";
      system("cls");
      }
      }
      }
      system("pause");
      return 0;
      }


      external functions:
      DWORD ReadAdress(HANDLE ProcessHandle, int PointerLevel, DWORD StaticOffset, DWORD Offsets[], DWORD BaseAdress){
      DWORD TempAdress;
      int c = 0;
      int PointerCounter = 1;
      if (PointerLevel == 0){
      TempAdress = BaseAdress + StaticOffset;
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      if (PointerLevel >= 1){
      TempAdress = BaseAdress + StaticOffset;
      while (PointerCounter <= PointerLevel){
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      TempAdress += Offsets[c];
      PointerCounter++;
      c++;
      }
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      return TempAdress;
      }


      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;
      }


      This is adress in Cheat Engine:
      Click image for larger version. 

Name:	w1ZgvVd.png 
Views:	51 
Size:	17.8 KB 
ID:	2623


      As i said, reading works great. The only problem is writing. When i start my code and my magazine is full (20) my cmd window writes: "Ammo is full!". As soon as i start shooting my output flips over to "Low ammo detected! Value hasn't been changed".

      I hope you can help me, because im really unable to find any solution at that point

    10. #10
      The Angel Of Verdun
      Always More To Code!
       
      Lurking
       
      Nether's Avatar
      Join Date
      Dec 2013
      Location
      England, SW
      Posts
      299
      Thanks (-->)
      54
      Thanks (<--)
      186
      Cheats'n'Trainers
      Quote Originally Posted by Nemesis3212 View Post
      I wasnt able to fix my problem yet. As i said, reading works perfectly fine. Assault Cube is the second game i used to read some adresses with the same method and it worked great every time. The only problem is that writing doesn't seem to be successfull at all! I really can't find my mistake. Here is another example that shows my problem maybe a bit better.

      Main Function:


      //Rifle Ammo
      DWORD RifleStaticCast = 0x0010F4F4;
      DWORD RifleOffsets[] = { 0x150 };
      DWORD RifleValue;
      int FullAmmo = 21;

      int main(){
      if (!hwnd) cout << "AssaultCube not found!" << endl;
      else{
      GetWindowThreadProcessId(hwnd, &id);
      processhandle = OpenProcess(PROCESS_ALL_ACCESS, false, id);
      DWORD EXEBaseAdress = dwGetModuleBaseAddress(id, _T("ac_client.exe"));

      while (1 < 2){
      RifleValue = ReadAdress(processhandle, 1, RifleStaticCast, RifleOffsets, EXEBaseAdress);

      if (RifleValue <= 19){
      cout << "Low ammo detected!" << endl;
      RifleValue = ReadAdress(processhandle, 1, RifleStaticCast, RifleOffsets, EXEBaseAdress);

      if (WriteProcessMemory(processhandle, (LPVOID)RifleValue, &FullAmmo, sizeof(FullAmmo), NULL)){
      cout << "Value has got changed!";
      }
      else{
      cout << "Value hasn't been changed!";
      }
      system("cls");
      }
      else{
      cout << "Ammo is full!";
      system("cls");
      }
      }
      }
      system("pause");
      return 0;
      }


      external functions:
      DWORD ReadAdress(HANDLE ProcessHandle, int PointerLevel, DWORD StaticOffset, DWORD Offsets[], DWORD BaseAdress){
      DWORD TempAdress;
      int c = 0;
      int PointerCounter = 1;
      if (PointerLevel == 0){
      TempAdress = BaseAdress + StaticOffset;
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      if (PointerLevel >= 1){
      TempAdress = BaseAdress + StaticOffset;
      while (PointerCounter <= PointerLevel){
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      TempAdress += Offsets[c];
      PointerCounter++;
      c++;
      }
      ReadProcessMemory(ProcessHandle, (LPCVOID)TempAdress, &TempAdress, sizeof(TempAdress), 0);
      }
      return TempAdress;
      }


      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;
      }


      This is adress in Cheat Engine:
      Click image for larger version. 

Name:	w1ZgvVd.png 
Views:	51 
Size:	17.8 KB 
ID:	2623


      As i said, reading works great. The only problem is writing. When i start my code and my magazine is full (20) my cmd window writes: "Ammo is full!". As soon as i start shooting my output flips over to "Low ammo detected! Value hasn't been changed".

      I hope you can help me, because im really unable to find any solution at that point

      You would be better off using my memory class https://guidedhacking.com/showthread...ory-Class-V1-6 and once you have initiated the class etc.

      You can get "ac_client.exe" address like this.

      DWORD Base = mem.module("ac_client.exe")


      Use To Write:

      mem.write<int>(Base+0x10F4F4, "/x150/*", 1337);


      Use To Read Out Value Of Pointer

      int Value = mem.read<int>(Base+0x10F4F4, "/x150/*", true);
      _cwprintf(L"Pointer Value = [ %d ]", Value);



      or


      DWORD Base = mem.module("ac_client.exe")
      Base += 0x10F4F4;


      Use To Write:

      mem.write<int>(Base+0x150, 1337);


      Use To Read Out Value Of Pointer

      int Value = mem.read<int>(Base+0x150);
      _cwprintf(L"Value = [ %d ]", Value);
      No Need For Anything Extravagant, Your Blood As A Present Shall Suffice.

    Page 1 of 2 12 LastLast

    Similar Game Hacker Threads

    1. [Help] C++ DLL AimBot Error ("run-time check failure #3"):/
      By MeLThRoX in forum Assault Cube Hacks
      Replies: 6
      Last Post: 05-10-2016, 01:46 PM
    2. [Help] C# Running "Two" Hacks at the Same Time wont work
      By fx705HUJX0 in forum C#
      Replies: 8
      Last Post: 03-31-2016, 08:27 AM
    3. [Help] Writing Offset in ""common.dll"+13F3CC" by injection
      By Icew0lf in forum Hacking Help
      Replies: 25
      Last Post: 09-16-2014, 09:51 AM
    4. Replies: 2
      Last Post: 08-03-2014, 01:29 PM

    Tags for this Thread