 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
babyhamster How do I cheat?
Reputation: 0
Joined: 08 Nov 2010 Posts: 2
|
Posted: Mon Nov 08, 2010 3:09 pm Post subject: [SOLVED] How to access Pointer through a DLL in Delphi? |
|
|
Hi folks,
first thanks for all the good tutorials in this forum, but unfortunalty I'm stuck right now. I'm currently developing an interface for custom hardware extension for a simulator game and so I need direct access to some data inside the game.
The good news first: I found the pointer and can read/write it without any problems, but the pointer is not "quite" static. As you can see in the attachemnt it say: "ConfigModule.dll+F0B8"
My Code in Delphi is the following:
| Code: |
WindowName := FindWindow(nil,WindowTitle);
If WindowName = 0 then MessageDlg('Error', mtwarning,[mbOK],0);
ThreadId := GetWindowThreadProcessId(WindowName,@ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS,False,ProcessId);
BytesRead:=0;
ReadProcessMemory(HandleWindow, ptr($02FFF0B8), @GaugeHandle, 4, BytesRead);
BytesRead:=0;
ReadProcessMemory(HandleWindow, Pointer(GaugeHandle), @ValueHandle, 4, BytesRead);
BytesRead:=0;
ReadProcessMemory(HandleWindow, ptr(ValueHandle), @ALT_Ist, 4, BytesRead);
Edit1.Text:=IntToStr(ALT_Ist);
|
Works perfect, but after a restart the Pointer is shifted but still at "ConfigModule.dll+F0B8".
Now I tried to solve the problem like this:
| Code: |
ConfigHandle := GetModuleHandle('ConfigModule.dll') + $F0B0;
ReadProcessMemory(HandleWindow, ptr(ConfigHandle), @GaugeHandle, 4, BytesRead);
BytesRead:=0;
ReadProcessMemory(HandleWindow, Pointer(GaugeHandle), @ValueHandle, 4, BytesRead);
BytesRead:=0;
ReadProcessMemory(HandleWindow, ptr(ValueHandle), @ALT_Ist, 4, BytesRead);
Edit1.Text:=IntToStr(ALT_Ist);
|
... but ConfigHandle is only "F0B0" (So the GetModuleHandle-Procedure return zero :[ ). I'm shure there's only a tiny bit missing. Can you please help me?
thanks
| Description: |
|
| Filesize: |
14.66 KB |
| Viewed: |
4616 Time(s) |

|
Last edited by babyhamster on Tue Nov 09, 2010 2:39 pm; edited 1 time in total |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25840 Location: The netherlands
|
Posted: Mon Nov 08, 2010 6:03 pm Post subject: |
|
|
make sure that code is ran when ConfigModule.dll has actually been loaded in the current process, so not before (and not in a completly different process)
edit: I see you use OpenProcess and ReadProcessMemory. Is your app in a dll or is your app in it's own process?
If it's in it's own process (as the usage of openprocess shows) then you need to use the CreateToolHelp32Snapshot and module32first/next api (or EnumProcessModules combined with GetModuleBaseName )
_________________
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 |
|
 |
babyhamster How do I cheat?
Reputation: 0
Joined: 08 Nov 2010 Posts: 2
|
Posted: Tue Nov 09, 2010 10:29 am Post subject: |
|
|
Thanks for your help. Indeed I never used EnumProcessModules or GetModuleBaseName, so I will read some more tutorials and try to solve the problem. Now I'm highly motivated ^^
Great forum!
@EDIT:
Got it,
i just wrote special function for this:
| Quote: |
Function FindModuleAdress(ModuleName : String) : Integer;
var
H: THandle;
pe: TModuleEntry32;
B: Boolean;
begin
H:= CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
try
pe.dwSize:= SizeOf(pe);
B:= Module32First(H, pe);
while B do
begin
if StrPas(pe.szModule) = ModuleName then Result := pe.hModule;
B:= Module32Next(H, pe);
end;
finally
CloseHandle(H);
end;
end;
|
Now I can simply get the adress of any loaded Module by adding:
| Quote: |
ConfigHandle := FindModuleAdress('ShimEng.dll');
|
Unfortunalety I don't find any module or dll, but ShimEng is enough for me.
Thanks again. Perhaps an admin can put a "[solved]" inside the title.
|
|
| Back to top |
|
 |
|
|
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
|
|