Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Pointer reading problem

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Skygen
How do I cheat?
Reputation: 0

Joined: 10 Mar 2013
Posts: 2

PostPosted: Sun Mar 10, 2013 11:24 am    Post subject: Pointer reading problem Reply with quote

Code:
#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <Tlhelp32.h>

using namespace std;


HMODULE GetRemoteModuleHandle(unsigned long pId, char *module)
{
   MODULEENTRY32 modEntry;
   HANDLE tlh = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pId);

   modEntry.dwSize = sizeof(MODULEENTRY32);
    Module32First(tlh, &modEntry);

   do
   {
      if(!stricmp(modEntry.szModule, module))
         return modEntry.hModule;
      modEntry.dwSize = sizeof(MODULEENTRY32);
   }
   while(Module32Next(tlh, &modEntry));

   return NULL;
}

int main()
{
DWORD ProcessId;
DWORD buffer;
HANDLE h1;
BOOL R1;
DWORD ADDY = 0xABCFCC;
DWORD ADDY2[3] = {0x60,0x14,0x80};

   
HWND hWnd = FindWindow(NULL,"Warcraft III");
if (hWnd) cout << "Window Found!" << endl;
else cout << GetLastError();

GetWindowThreadProcessId(hWnd,&ProcessId);

h1 = OpenProcess(PROCESS_VM_READ,false,ProcessId);
if (h1) {cout << "Process Opened!" << endl; }
else { cout << GetLastError; }

DWORD base = (DWORD)GetRemoteModuleHandle(ProcessId,"Game.dll");
cout << base;

for(int i = 0;i<=2;i++){
R1 = ReadProcessMemory(h1,UlongToPtr(base+ADDY), &buffer, sizeof(buffer), NULL);
//ADDY = ADDY + ADDY2[i];
//cout << buffer << endl;

}

if(R1){cout << "Memory written!" << endl; }
else {cout << GetLastError;}

    getch();
    return 0;
}


Where is the problem?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25796
Location: The netherlands

PostPosted: Sun Mar 10, 2013 11:35 am    Post subject: Reply with quote

you don't use buffer nor addy2
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Skygen
How do I cheat?
Reputation: 0

Joined: 10 Mar 2013
Posts: 2

PostPosted: Sun Mar 10, 2013 12:17 pm    Post subject: Reply with quote

Should it be like this?
Code:
R1 = ReadProcessMemory(h1,UlongToPtr(base+ADDY), &buffer, sizeof(buffer), NULL);
for(int i = 0;i<=2;i++){
ADDY = buffer + ADDY2[i];
cout << ADDY << endl;
R1 = ReadProcessMemory(h1,UlongToPtr(base+ADDY), &buffer, sizeof(buffer), NULL);
cout << buffer << endl;
}
Back to top
View user's profile Send private message
larcerkev
Newbie cheater
Reputation: 0

Joined: 17 Aug 2012
Posts: 17

PostPosted: Wed Mar 13, 2013 9:57 am    Post subject: Reply with quote

Here's an example for a larger multi-level pointer reading without a loop:

Code:

DWORD TempAddress[2];
ReadProcessMemory(processHandle, (LPCVOID)(GetModuleBase(DllName, processID) + DllOffset), &TempAddress[0], sizeof(DWORD), NULL);
ReadProcessMemory(processHandle, (LPCVOID)(TempAddress[0] + pointerOffset1), &TempAddress[1], sizeof(DWORD), NULL);
ReadProcessMemory(processHandle, (LPCVOID)(TempAddress[1] + pointerOffset2), &TempAddress[0], sizeof(DWORD), NULL);
ReadProcessMemory(processHandle, (LPCVOID)(TempAddress[0] + pointerOffset3), &TempAddress[1], sizeof(DWORD), NULL);
FinalAddress = (LPCVOID)(TempAddress[1] + pointerOffset4);
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites