mercredi 19 mars 2014

[Help] Pointers and Offsets topic




Hello UC,

I tried to retrieve a value from a game through a pointer and an offset but it keeps returning un-readable characters for some reason and I cannot pinpoint the poblem for some reason.

Here's the code I tried..

I think* I found a pointer through cheat engine but here is the log.


Code:


/*****************************************
                            CE Result
******************************************
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>1</ID>
      <Description>"pointerscan result"</Description>
      <Color>80000008</Color>
      <VariableType>4 Bytes</VariableType>
      <Address>"gymmick.exe"+00268B6C</Address>
      <Offsets>
        <Offset>D4</Offset>
      </Offsets>
    </CheatEntry>
  </CheatEntries>
</CheatTable>

******************************************
Pointer -> 0x00268B6C
Offset  -> 0xD4

******************************************/




Code:


#include <iostream>
#include <windows.h>

/*
        Name: ./main.cpp
        Author: 0xc0re
        Date: 19/03/14 13:38
        Description: Reading the value from gymmick.exe -> Current HP value.
*/

using namespace std;

int main(int argc, char** argv) {
       
    char value[128]; // Store the value, returned (int)
    // "gymmick.exe"+00268B6C
    LONG pnt_HP = 0x00268B6C; // 0x5DA520 {Dynamic Address during the search.
    LONG Offset = 0xD4;
    LONG address = (pnt_HP + Offset); // Am i doing it right?

    HWND _top_handle = FindWindow(NULL, "Gimmick - The Boss");
    DWORD proc_id;
    GetWindowThreadProcessId(_top_handle, &proc_id);
   
    HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, proc_id);
    ReadProcessMemory(hProcess, (LPVOID)address, value, 128, 0);
   
    if(value != 0){
        for(int i = 0 ; i < sizeof(value) ; i ++ ){
                if(value[i] != NULL){
                        cout << value[i] ;
                }else{}
        }
    }else{
          cout << "Couldn't find the value" << endl;
        }
    CloseHandle(_top_handle);
}


Here's the output I keep getting.



Cheat Engine -



174 is the correct value ingame.

Thanks in advance.

I would really appreciate your help in figuring this problem out.





Aucun commentaire:

Enregistrer un commentaire