3

Okay I've followed a couple of tutorials on how to find the base/static pointer of a game's value with cheat engine (hp, strength, experience, gold, etc). To test this I tried it on Microsoft's Spider Solitaire and it worked. I got the base pointer for the amount of moves ("zetten" as you will see in my dutch version of Spider Solitaire), and made it reference to another pointer which referenced to the actual value (assuming that's how it's called). spider solitaire

That's basically what it looks like. So now I've got the base pointer which would be SpiderSolitaire.exe+B5F78 and it uses 2 offsets to get to the actual address of the value. This is the code that I use to edit memory values with in C++:

#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#include <strsafe.h>

using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{

    long address = 0x??????;
    int newvalue = 200000; 
    DWORD newvaluesize = sizeof(newvalue);

    HWND hWnd = FindWindow(0, L"Spider Solitaire");
    HANDLE pHandle; 
    DWORD pid; 

    if(hWnd != 0) { 
        cout << "Found windowx.\n"; 
        GetWindowThreadProcessId(hWnd, &pid);
        pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid); 
    } 
    else {
        cout << "Can't find window\n";
    } 
    if(pHandle !=0) { 
        WriteProcessMemory(pHandle, (LPVOID)address, &newvalue, newvaluesize, 0);   
        cout << "Written to memory successfully\n";
        getchar();
    } 
    else { 
        cout << "Couldn't get handle.\n";
        getchar();
    } 
    CloseHandle(pHandle);
    return 0;
}

So I have all the information I need, except I don't know how to implement base pointers and offsets and whatnot into the C++ program. I tried using

long address = SpiderSolitaire.exe+B5F78+e8+10

but that didn't work (SpiderSoliteire.exe is a string anyway so I didn't expect it to work). I've tried searching for tutorials or something on the internet, but those only show how to directly alter a value in 1 memory address, not how to alter a value by referencing it through 2 pointers. How do I do this? How do I implement this base pointer, and the 2 offsets into my C++ program so that I can edit the memory value?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
ZimZim
  • 3,291
  • 10
  • 49
  • 67

2 Answers2

0

I tried same thing and they said to that i need to write my own OS for that. Some said i need to be in ring-0 area. I say you can use asm (assembler)

 mov [address],register

comand

Gcc, VC++ 10 , Digital Mars has some asm{} block definitions inside.

huseyin tugrul buyukisik
  • 11,469
  • 4
  • 45
  • 97
0

You have to figure out where the process is loaded, which can vary. See this earlier question for details. It does more than you need; you just need the base address part.

Community
  • 1
  • 1
MSalters
  • 173,980
  • 10
  • 155
  • 350