Jump to content

Quick check of code


Recommended Posts

For my code, I want it to find a memory address in an active process, then display the value of the memory address. I am using a pointer to locate the right memory address in the process. It uses functions from NomadMemory found here. I also borrowed a bit of script from this thread.

If my pointer and offset addresses are correct, then it should show me the value in decimal format correct?

The debug came back with no errors.

#include <NomadMemory.au3>

Global $Pointer = 0x00000000;Pointer address goes here
Global $Offset = 0x00000000;Offset address goes here
Global $pid = ProcessExists("process.exe");pid of target process
Global $Handle = _MemoryOpen($pid);Process handle

If $pid = 0 Then
    $Active = 0
    MsgBox(0, "Error", "Could not find process ID")
    $Active = 1

Func _FindNewAddress(ByRef $P, ByRef $OSet);Find memory address function
    $New_Address = _MemoryRead($P, $Handle) + $OSet
    _MemoryClose($Handle);Close process handle
    Return $New_Address

Func _Amount();Action Function
    $Address = _FindNewAddress($Pointer, $Offset);Process address
    $Amount = _MemoryRead($Address, $Handle, 'ushort')
    MsgBox(0, "Amount:", $Amount)
    _MemoryClose($Handle);Close process handle

While $Active = 1

_MemoryClose($Handle);Close process handle

I also want to make it focus on the process window, I think I must use a function like "_WinAPI_FindWindow"?

If someone can quick check over my code, and help me focus in on the process window, it will be a big help.

Thanks for your time.

Link to comment
Share on other sites

I haven't tested your code or anything, but I believe the problem is that you're doing _MemoryClose($Handle) in your _FindNewAddress function, and you're never "re-opening" it again(could be wrong, as I don't have the NomadMemory udf..).

Link to comment
Share on other sites

Thank you for the reply.

I did a bunch more editing, and I got it to work perfectly!

It sucessfully finds the memory value, and does the action I choose

I also added in a lot more safety features to end the script if someing goes way wrong


Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...