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 


offset from base pointer is variable

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

Joined: 19 Oct 2015
Posts: 7

PostPosted: Mon Oct 19, 2015 1:36 pm    Post subject: offset from base pointer is variable Reply with quote

So I found a base pointer (green address 005D75C0) which is 4th level pointer. So, to make it point to where I want, I must add 4 offsets: 8, d0, 1c8c and 2. The first two, 8 and d0, never changes. However, 1c8c changes whenever the game is restarted. It is an array index (eax*ebx*4+A4). Does this mean it is not ppossible to find a constant path to the information I want?
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Mon Oct 19, 2015 2:24 pm    Post subject: Reply with quote

The game knows the path to your object, so it is always possible to find a path to it. It may however be a damn friggin' pain...

Currently CE has no support for variable offsets, so the best you could do if you don't want to make some assembly coding is make a lua script that would find the array index, compute the 3rd offset, and add a proper pointer to the cheat table. But of course you'd have to figure out where the index comes from.

An usually simpler method is to find out what access your variable, pick a function that doesn't access any other, and modify it so that it overwrites your variable or logs its address at a known location.

Modding the game is also an option to consider (especially in rpgmaker/renpy games).

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
wizzar
How do I cheat?
Reputation: 0

Joined: 19 Oct 2015
Posts: 7

PostPosted: Mon Oct 19, 2015 2:39 pm    Post subject: Reply with quote

Wouldn't the function be on a random address? Also, how can I make sure a function does not access anything other than my variable?
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Mon Oct 19, 2015 3:24 pm    Post subject: Reply with quote

wizzar wrote:
Wouldn't the function be on a random address?
For old games that use a static base (win xp era and older): no, unless it is located in a dll.
For newer games that use ASLR (vista era and later): yes, but the game.exe+1234 format will still reliably locate them.
For flash/.net (ex: unity) games or basically anything that uses JIT compiling: yes but you can locate your function with an signature scan (aka aobscan).

Since aobscans also make your hack somewhat patch-resistant it is recommended to use this anyway.

wizzar wrote:
Also, how can I make sure a function does not access anything other than my variable?
Right click in the find out what *** window->check if found opcodes... Once this is enabled, the number between parenthesis in the count column indicates the number of different addresses accessed.
_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
wizzar
How do I cheat?
Reputation: 0

Joined: 19 Oct 2015
Posts: 7

PostPosted: Tue Oct 20, 2015 12:27 am    Post subject: Reply with quote

I found a function that deals with the variable, I restarted several times and the function address didn't change (Game.004F5CE4).

Inside the function, the 11th instruction stores the offset in EAX.

This function is executed when player enters the game.

Can't I track that?
Back to top
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 43

Joined: 12 Mar 2012
Posts: 1285

PostPosted: Tue Oct 20, 2015 3:50 am    Post subject: Reply with quote

Given what you found, the least bad solution I see is to make an assembler script that would slightly modify the function at Game.004F5CE4 to store the offset at a known location and a lua script (embedded inside a separate assembler script) that would read this offset, and update the offset of your pointer in the table.

Cheat engine does not understand [[[game.exe+1234]+4]+[game.exe+5678]].

_________________
DO NOT PM me if you want help on making/fixing/using a hack.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Tue Oct 20, 2015 5:07 am    Post subject: Reply with quote

You can always use lua to fill in the offset part (or update it with a timer)
_________________
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
wizzar
How do I cheat?
Reputation: 0

Joined: 19 Oct 2015
Posts: 7

PostPosted: Tue Oct 20, 2015 5:15 pm    Post subject: Reply with quote

The perfect solution would be to write a piece of code that would store the values of edx and edc at address 0x004F0186 in variables in my program.

I'm still learning asm, I don't know a "clean" way to do that, and I can't modify the *.exe, so I came up with another solution.

I wrote a debugger in C and attached it to the process thread and set a breakpoint at 0x004F0186. From there I read edx and edc to my program, then I detach the debugger (DebugActiveProcess/DebugActiveProcessStop).

If I could just __asm__ something inline it would be a solution too, but I don't know how to do that, and injection is very easy to be detected.

Thank you guys.
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Oct 20, 2015 9:15 pm    Post subject: Reply with quote

hi,
I've made a script to simulate debug break point and log register (rcx here) using code cave, hopefully would be an alternative solution for the problem of this thread.
It should work as expected.

However, the DEALLOC command in lua-assemble-call seems not work.
If I copy the print output of the lua-assemble-call into a memory record, the memory deallocate properly.

Would DarkByte please check what's the problem?
Thank you~

ADDED:
sorry, somehow there was typo, it is fixed ~_~



00.logAndActivate.CT
 Description:
demo on logging rcx on beginning of readProcessMemory @ cheatengine-x86_64.exe

Download
 Filename:  00.logAndActivate.CT
 Filesize:  6.97 KB
 Downloaded:  757 Time(s)


_________________
- Retarded.
Back to top
View user's profile Send private message
wizzar
How do I cheat?
Reputation: 0

Joined: 19 Oct 2015
Posts: 7

PostPosted: Wed Oct 21, 2015 12:52 am    Post subject: Reply with quote

Cool!

Can this be ran from my C application?
Does it inject new instructions in the exe?

Sorry for my ignorance, I've only started fiddling with asm, cheat engine, olly etc 2 days ago Embarassed
I think I made great progress though Very Happy
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Oct 21, 2015 4:03 am    Post subject: Reply with quote

wizzar wrote:
Cool!

Can this be ran from my C application?
Does it inject new instructions in the exe?

Sorry for my ignorance, I've only started fiddling with asm, cheat engine, olly etc 2 days ago Embarassed
I think I made great progress though Very Happy


hi,
the script is in ce specific ct format which use a combination of a ce specific version of lua language and auto Assemble script (aa script) (, and other facilities).
The aa script is partially like an assembler script,eg masm.
I think it may need a considerable effort to convert these ct functionality to a c application from zero. For example, the "reassemble" functionality may need some disassembler/assembler library/coding.

ce is open source, you may have a look how those functionality work, https://github.com/cheat-engine/cheat-engine


@DarkByte
a quick test show the aforementioned DEALLOC problem may not from ce side. Sorry for asking debugging on a mess ~_~

Code:

local aa1 = autoAssemble([[
 alloc(aatest_1_aa,100,readProcessMemory)
 aatest_1_aa:
 dq aatest_1_aa
 aatest_1_aa+10:
 dq 123456789
 registersymbol(aatest_1_aa)
]])

if not aa1 then print("aa1 failed") end
print(hx(readQword("aatest_1_aa+10") or -1))

local aa2 = autoAssemble([[
 dealloc(aatest_1_aa)
 unregistersymbol(aatest_1_aa)
]])

if not aa2 then print("aa2 failed") end

print(hx(readQword("aatest_1_aa+10") or -1)) -- should not be read

_________________
- Retarded.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Wed Oct 21, 2015 4:31 am    Post subject: Reply with quote

dealloc just won't work with the autoAssemble() command. (dealloc only works when inside a cheat table entry)

If you wish to reuse a block of memory every time, use globalalloc instead

_________________
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
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Wed Oct 21, 2015 4:59 am    Post subject: Reply with quote

Dark Byte wrote:
dealloc just won't work with the autoAssemble() command. (dealloc only works when inside a cheat table entry)

If you wish to reuse a block of memory every time, use globalalloc instead


oh... but the test script just post dealloc properly (aatest_1_aa)?

And for generic use of the script, especially the 64bit rip address thing, it seem the aa script format:
Code:
 alloc(symbol,size,nearbyTargetAddress)

is necsessary. If I'm not wrong, globalalloc allocate memory on lower 2G address.

ADDED:
ahh.... have some test to reassemble a high memory call-command into a lower globalalloc memory. Yes, it may be possible to use globalalloc.
Thanks.

_________________
- Retarded.
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 Gamehacking 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