Sign in to follow this  
Followers 0
strate

Finding Memory Address

15 posts in this topic

I have a script that depends on reading a memory address for my caret location. Currently I can find the address using Cheat Engine. One day I may no longer work here and my coworkers will be using the script, so I need to be able to do it without cheat engine.

The need is even greater because if I run the script at my desk I get a different address then if I run it at a coworkers. How can I do this?


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



Now you really made me curious. What kind of work related task would require the memory address of the caret?

@w0uter has a reasonable UDF I think. Do a advanced search for mem* and tick of "Search titles only". Should give you some interesting stuff to read...:)

Share this post


Link to post
Share on other sites

More information is needed to help you. First of all, it sounds like you're having problems with Dynamic Memory Allocation; there are many, many tutorials on the internet of how to 'defeat' DMA. Secondly, no one can help you if you don't explain in more detail what you're talking about. What program are you reading memory from? Do you find the address each time you run the program or does it sometimes stay the same?

The easiest thing would probably be to post your script and the program you're reading memory from. I'm not sure anyone would download an executable but if it's a commercial program or a script you wrote then you might get some bites.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I use it for a telnet program. In the status bar it shows the location of my caret. The caret of course can not be read through WinGetCaretPos ( ) and the status bar methods will not respond with anything beyond the first section (msctls_statusbar321). So reading the memory location of the section in the status bar is the only way.

The telnet is from Netmanage. I do use @w0uter's UDF.

The memory address I found is the first pointer. It (the address) will remain the same for each instance of Telnet. So the address of the first Telnet will always be"0x745F00" then the second one (Telnet process) will always be "0x7458C8".

If I run my test script on a different computer the addresses are different.

#include 'Memory Functions.au3'

;~ $i_Address = 0x7459B0
;~ $i_Address = 0x745F00
$i_Address = InputBox("$i_Address", "Enter your memory address.")
$i_pid = ProcessExists('Telnet.exe')
$v_Open = _MemOpen($i_pid)
While 1
    $MemRead_results = _MemRead( $v_Open, $i_Address)
    If $MemRead_results = '' Then
        MsgBox(4096,'Error','No good.')
        _MemClose($v_Open)
        Exit
    Else
        ToolTip($MemRead_results)
        Sleep(10)
    EndIf
WEnd
_MemClose($v_Open)
Exit
Edited by strate

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

Am I at least right that if I have more then one instance of the program open they should have different address?

And....

If I run it on my pc and a different pc should the memory address be the same? Do I need to dig deeper into the DMA crap? If so does anybody have a link to a good tutorial for it?


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I would find out the code address that changes the status bar thing. Than attach a debugger to it and set a breakpoint to that code address and get the value right after it changes. That would be the closest to Cheat Engine you could get, but it ain't possible in AutoIt, you'd have to use a lower-level language.

If you want tho, I have a few references on how to write that in C/C++.

EDIT: Enter MSDN and read about debugging primitives. Also, google for Iczelion debug api tutorials, they're very good.

EDIT²: I was wrong about it not being possible in AutoIt. It is if you use DllStructs and DllCalls.

Edited by CoePSX

[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

I would find out the code address that changes the status bar thing. Than attach a debugger to it and set a breakpoint to that code address and get the value right after it changes. That would be the closest to Cheat Engine you could get,

I've already done this and have a aquired the address. The question is will the address change from pc to pc (for each process ID); or do I have to keep digging in the dynamic memory?

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

No, the code address never changes in virtual memory, so don't worry. Dynamic memory does tho.


[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

Looks like I have to keep digging then, 'cause its changing pc to pc.

Thanks


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

Sorry I'm late on this,

Can't you use the GuiStatusBare.au3 UDF's to get what you want? It's part of the latest distro.

Sample with Explorer. You need to change the title to something appropriate (or use the title of your telnet terminal).

#include <GuiStatusBar.au3>
Opt("WinTitleMatchMode", 1)     ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
;$handle = ControlGetHandle("Document - WordPad", "", "msctls_statusbar321") ;40961
$wintitle = "C:\back"
$handle = ControlGetHandle($wintitle, "", "msctls_statusbar321") ;40961
IF $handle = 0 then dbg("Error: $handle:=" & $handle)
dbg("Get Text?" & _GuiCtrlStatusBarGetText ($handle , 0))
dbg("Get Text?" & _GuiCtrlStatusBarGetText ($handle , 1))
dbg("Get Text?" & _GuiCtrlStatusBarGetText ($handle , 2))
Exit

Func dbg($msg, $error = @error, $extended = @extended, $erl = @ScriptLineNumber)
   ;Note: If we use StringFormat to output $erl we can't use Jump to line in Scite by doubel clicking in the Output pan.
   ConsoleWrite("(" & $erl & ") : = (" & $error & ")(" & $extended & ") " & $msg & @LF)
   ;StringFormat("%.5u",  $erl)
   Return $error
EndFunc   ;==>dbg

Share this post


Link to post
Share on other sites

Thank you, I'll give it a try when I get into work.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

This doesn't work either, thanks though. :)


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

Try changing the window title ("C:\back") to the right one on your case.


[quote name='Valik' post='301213' date='Jan 31 2007, 10:36 PM']You seem to have a habit of putting things in the wrong place. I feel sorry for any female you attempt to have sex with.[/quote][font="Lucida Sans Unicode"][/font]

Share this post


Link to post
Share on other sites

I did that of course.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

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