Results 1 to 9 of 9
  1. #1
    xXsc00pedXx's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0

    Why is this code not working ? memory hacking

    hey guys im trying to get into game hacking i have experience with c++, made a few crypters and so :P anyways i can't figure out why this ain't working, im using the static address with the offsets correct :S

    Code:
    #include "stdafx.h"
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    DWORD ReadMemAddr(HANDLE win, DWORD baseaddress, DWORD offsets[]);
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	int option;
    
    	printf("Press 1 for ammo hack:");
    	cin >> option;
    
    	DWORD procID;
    
    	//Ammo variables
    	DWORD base = 0x4DF73C;
    	DWORD AmmoOffsets[] = {0x368, 0x14, 0x0};
    	BYTE AmmoAmount[] = {0x09, 0x09, 0x00, 0x00};
    
    	HWND hwnd = FindWindow(0, L"AssaultCube");
    	if(hwnd == 0) {
    		MessageBox(0, L"Could not load game!", L"Error:", MB_OK|MB_ICONERROR);
    		exit(EXIT_FAILURE);
    	}else {
    		printf("Hacks Loaded Interface Succesfully!\n");
    		
    		GetWindowThreadProcessId(hwnd, &procID);
    		HANDLE window = OpenProcess(PROCESS_ALL_ACCESS, false, procID);
    
    		if(!window) {
    			MessageBox(0, L"Could not access game process!", L"Error:", MB_OK|MB_ICONERROR);
    		}else {
    			DWORD DMA = ReadMemAddr(window, base, AmmoOffsets);
    			WriteProcessMemory(window, (BYTE*) DMA, &AmmoAmount, sizeof(AmmoAmount), NULL);
    			MessageBox(0, L"Ammo hacked!", L"Success:", MB_OK);
    		}
    	}
    	return 0;
    }
    
    DWORD ReadMemAddr(HANDLE win, DWORD baseaddress, DWORD offsets[]) {
    	
    	int pointerLvl = sizeof(offsets);
    	DWORD tempAddr;
    	DWORD result;
    	
    	for(int i = 0; i < pointerLvl; i++) {
    		ReadProcessMemory(win, (LPCVOID) baseaddress, &tempAddr, sizeof(tempAddr), NULL);
    		result = tempAddr + offsets[i];
    
    		ReadProcessMemory(win, (LPCVOID) result, &tempAddr, sizeof(tempAddr), NULL);
    	}
    
    	return result;
    }

  2. #2
    mavi2k's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    10
    Reputation
    10
    Thanks
    0
    Code:
    DWORD ReadMemAddr(HANDLE win, DWORD baseaddress, DWORD offsets[]) {
    	
    int pointerLvl = sizeof(offsets);
    Think about what you are doing there.

    Size of a pointer is 32bit (atleast in this case), sizeof will always return 4 there.

  3. #3
    xXsc00pedXx's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    yea i fixed that and it is still not working :S im now passing the lvl as a parameter now :P the reason wo why it is not working is because it can't find the correct address for some reason :S its really close but that does not help :P

    ---------- Post added at 11:02 AM ---------- Previous post was at 10:53 AM ----------

    nvm got it working, a mod can close this thread now

  4. #4
    awtstalamaker's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    130
    Reputation
    10
    Thanks
    54
    My Mood
    Blah
    Share The Solution
    FUCK THOSE VOUCH 2 VOUCH, THEY ARE ALL FAKE AND GAY

    Code:
    Its like asking a friend to like your pic in exchange for liking his pic back. which is very FAKE |  Or 2 dudes sucking each other, Which is GAY

  5. #5
    xXsc00pedXx's Avatar
    Join Date
    Jul 2011
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    umm i really don't know the solution :L i pretty much rewrote huge parts of the program and got it working first try, i think it had something to do with the code calculating the wrong memory address(non static one)

  6. #6
    Plutonsvea's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Location
    Australia
    Posts
    1,889
    Reputation
    303
    Thanks
    990
    My Mood
    Fine
    Quote Originally Posted by xXsc00pedXx View Post
    umm i really don't know the solution :L i pretty much rewrote huge parts of the program and got it working first try, i think it had something to do with the code calculating the wrong memory address(non static one)
    He meant upload it
    Did I help you? You know what to do.

     





  7. #7
    Lemon >.<'s Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    Derp town.
    Posts
    58
    Reputation
    10
    Thanks
    28
    My Mood
    Aggressive

    ZOMGGGGGGGGGGGGGGGGGGGGGGGGG

    @Codenever
    ZOMGGGGGGGGGGGGGGGG

  8. #8
    raywill's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Why is there second ReadPRocessMemory in loop?

  9. #9
          ( ° ͜ʖ͡°)╭∩╮
    Former Staff
    MarkHC's Avatar
    Join Date
    Nov 2011
    Gender
    male
    Location
    127.0.0.1
    Posts
    2,750
    Reputation
    66
    Thanks
    14,529
    My Mood
    Angelic
    He got it to work, can you guys stop spamming shit?


    CoD Minion from 09/19/2012 to 01/10/2013

Similar Threads

  1. Why won't this simple piece of code not work??
    By Laslod in forum C# Programming
    Replies: 0
    Last Post: 02-13-2013, 08:42 AM
  2. Prestige not Working(Memory Hacking) & Ollydbg
    By Bluthera in forum Visual Basic Programming
    Replies: 7
    Last Post: 02-28-2010, 08:33 AM
  3. Combat arms not working with hacks!!!??
    By _-KaKaSHi_- in forum Combat Arms Help
    Replies: 8
    Last Post: 08-29-2009, 02:46 AM
  4. Warrock crashes when using this code in my D3D hack...
    By k2hacker in forum C++/C Programming
    Replies: 0
    Last Post: 07-21-2008, 05:04 PM
  5. [ Help ] VB6 Coding not working
    By ilovepie21 in forum Visual Basic Programming
    Replies: 17
    Last Post: 03-28-2008, 10:22 PM