Sign in to follow this  
Followers 0
mechtn

Reading a value from memory

4 posts in this topic

Here is a sample I put together for reading a value from memory once you know it's static offset and other offsets.

#RequireAdmin

SetPrivilege("SetDebugPrivilege", 1)

#include <NomadMemory2.au3>

Global $PID

Global $sModule = "exmodule.dll"

Global $StaticOffset

Global $openmem

$PID = ProcessExists("exproces.exe")

If $PID == 0 Then

MsgBox(4096,"Error","Process not running!",3)

Return

EndIf

$openmem = _MemoryOpen($PID)

If @error Then

Return

EndIf

Local $Offset[1]

$Offset[0] = 0 ; Is ALWAYS 0.

$StaticOffset = Dec("27E8C")

$baseADDR = _MemoryModuleGetBaseAddress($PID, $sModule)

$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)

$r = _MemoryRead($finaladdr,$openmem)

$r = _MemoryRead($r + 0x798,$openmem)

$r = _MemoryRead($r + 0x504,$openmem)

$r = _MemoryRead($r + 0x14,$openmem)

$r = _MemoryRead($r + 0x8,$openmem)

$r = _MemoryRead($r + 0x40,$openmem, "float")

ConsoleWrite("Pointer Value:" & $r & @CRLF)

Share this post


Link to post
Share on other sites



Here is a sample I put together for reading a value from memory once you know it's static offset and other offsets.

#RequireAdmin

SetPrivilege("SetDebugPrivilege", 1)

#include <NomadMemory2.au3>

Global $PID

Global $sModule = "exmodule.dll"

Global $StaticOffset

Global $openmem

$PID = ProcessExists("exproces.exe")

If $PID == 0 Then

MsgBox(4096,"Error","Process not running!",3)

Return

EndIf

$openmem = _MemoryOpen($PID)

If @error Then

Return

EndIf

Local $Offset[1]

$Offset[0] = 0 ; Is ALWAYS 0.

$StaticOffset = Dec("27E8C")

$baseADDR = _MemoryModuleGetBaseAddress($PID, $sModule)

$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)

$r = _MemoryRead($finaladdr,$openmem)

$r = _MemoryRead($r + 0x798,$openmem)

$r = _MemoryRead($r + 0x504,$openmem)

$r = _MemoryRead($r + 0x14,$openmem)

$r = _MemoryRead($r + 0x8,$openmem)

$r = _MemoryRead($r + 0x40,$openmem, "float")

ConsoleWrite("Pointer Value:" & $r & @CRLF)

Sorry pal, but that is a mess.

I don't even know where to begin with what is wrong with it.

Where does this SetPrivilege function come from cause it certainly not in that,

and from what function are you returning from?

Sorry, but you need to go back to the drawing board.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

It's working code from a bigger project that I was just sharing as an example. I'd love to know suggestions to clean it up and make it better. I'll clean some of it up and try to explain it better.

Share this post


Link to post
Share on other sites

Suggestions:

- Read up on forum rules. (as they probably change a bit sins you last post.)

- Learn about forum code tags.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0