WriteProcessMemory doesn't work?

YesHax

Member
Joined
Mar 17, 2014
Messages
17
Reaction score
3
I want to edit this memory value but it does not work. Is it because its protected or what? SA-MP version used - 0.3.7 - R2
C++:
// HackAnyGamePt2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "proc.h"
#include "string"
#include <stdio.h> 
#include <stdlib.h> 
#include <time.h> 
#include <sstream>
#include <time.h>


//using namespace std;

int main()
{


    for (;;)
    {
    DWORD procId = GetProcId(L"gta_sa.exe");
    uintptr_t moduleBase = GetModuleBaseAddress(procId, L"samp.dll");
    uintptr_t moduleBaseSA = GetModuleBaseAddress(procId, L"gta_sa.exe");
    HANDLE hProcess = 0;
    hProcess = OpenProcess(PROCESS_ALL_ACCESS, NULL, procId);
    uintptr_t versionAddr = moduleBase + 0xD3B93;
    char versiontype;
    char newVersion = 0x34;
        
        ReadProcessMemory(hProcess, (CHAR*)versionAddr, &versiontype, sizeof(versiontype), nullptr);
        WriteProcessMemory(hProcess, (CHAR*)versionAddr, &newVersion, sizeof(newVersion), nullptr);
        std::cout << "version = " << std::dec << versiontype << std::endl;
        Sleep(2500);
        system("CLS");
    }

    getchar();

    return 0;
}
 

bladee

Member
Joined
Nov 7, 2017
Messages
19
Reaction score
5
what is this offset?
0xD3B93

maybe u need use virtualprotectex?
 
Top