Jump to content

» «

WriteProcessMemory on windows form c++ (gta sa)

2 replies to this topic
  • KillerChainsaw

    Player Hater

  • Members
  • Joined: 04 Nov 2013


Posted 23 February 2014 - 07:18 PM Edited by KillerChainsaw, 23 February 2014 - 07:18 PM.

I'm wanting to do a test program, and I'm having trouble editing gta sa process, with WriteProcessMemory. 

Please help me, I'm puzzling over it. 
Sorry for my terrible English.
HWND WNDs = FindWindowA(FALSE, "gta_sa");
if(WNDs != 0x0)				   
  GetWindowThreadProcessId(WNDs, &pID);						
  HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);			   
  DWORD pMONEY = 0xB7CE50;		
  int newvalue = 500;
  WriteProcessMemory(hProcess,(LPVOID)pMONEY, &newvalue, (DWORD)sizeof(newvalue), NULL);

  • uNi


  • Marshal
  • Joined: 14 May 2004
  • United-Kingdom
  • Best Official Gang 2014 [Feroci]


Posted 24 February 2014 - 12:07 AM

I haven't tried messing with it, but  in WriteProcessMemory:

- shouldn't it be 0x00B7CE50 instead of 0xB7CE50

- (LPVOID)&yourpointer,sizeof(newvalue) instead of (DWORD)sizeof(newvalue)

  • K^2

    Vidi Vici Veni

  • Sheriff
  • Joined: 14 Apr 2004
  • United-States
  • Best Poster in Technology / Programming 2017
    Best Poster [Technology / Programming] 2016
    Best Poster [Programming] 2015
    Most Knowledgeable [Web Development/Programming] 2013
    Most Knowledgeable [GTA Series] 2011
    Best Debater 2010


Posted 24 February 2014 - 03:07 AM

First of all, make sure the window is actually called "gta_sa". This is name of the window, not executable. My copy runs with the name "GTA: San Andreas", which allows me to grab the process.
Other than that, the code will work, but only on GTA SA v1.0. If you have a later version or Steam version, it will not work, because that is not hte correct memory address.

Note: None of the memory addresses below will work for GTA: San Andreas v2.0 or 3.0(steam). All addresses in v2.0 and above have been changed or moved. Thus inaccessible.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users