tags:

views:

88

answers:

1

Im trying to get the engine version of a game from a global pointer, but I am fairly new to this. Here is a very small example I found...

http://ampaste.net/mb42243

And this is the disassembly for what I am trying to get, the pointer (gpszVersionString) is the highlighted line (line 5)

http://ampaste.net/m2a8f8887

So what I need to find out is basically using the example approach I found to get it, would I need to basically sig out the first part of the function and find the offset to that line?

Like...

Memory signature - /x56/x8B/x35/x74/xD5/x29/x10/x68/x00/xA8/x38/x10 Then an offset to reach that line? (not sure how to find the offset)

+5  A: 

You can't directly do this. Process address space is completely unique to your process -- 0xDEADBEEF can point to "Dog" in one process, while 0xDEADBEEF can point to "Cat" in another. You would have to make operating system calls that allow you to access another process' address space, and even then you'd have to guess. Many times that location will be different each run of the application -- you can't generally predict what the runtime layout of a process will be in all cases.

Assuming you're on Windows you'll need to (EDIT: You don't need A and B in all cases but you usually need them) A. be an administrator, B. take the SeDebugPrivilege for your process, C, open a handle to the process, and then D. use ReadProcessMemory/WriteProcessMemory to do what you want.

Hope that helps :)

EDIT 2: It looks like you're looking at an address taken from a disassembler. If that's the case, then you can't use that value of the address -- the image can be re-based at runtime and the value there would be completely different. Particularly on recent versions of Windows which support Address Space Layout Randomization.

Billy ONeal
+1, good complete answer when dealing with cross-process memory.
Xorlev