Sign in to follow this  
Followers 0
RiCK_420_333

Help with _Memory

44 posts in this topic

#1 ·  Posted (edited)

Here's some code i'm working with, trying to get it to read some text from memory.

It should read any memory, but I am specifically trying to retrieve the Artist and Song name from Virtual DJ.

These are the memory addresses I found the info in: A510F0, A51170, AC7568, AC75E8

I think they need to be in hex format like below:

Const $MemoryAddressLeftDeckArtist = 0x00A510F0

Const $MemoryAddressLeftDeckSong = 0x00A51170

Const $MemoryAddressRightDeckArtist = 0x00AC7568

Const $MemoryAddressRightDeckSong = 0x00AC75E8

Here's my script:

;; ----------------------------------------------------------------------------
;
; Author: 
;   RiCK
; Script Function:
;   Memory Tool
;
; ----------------------------------------------------------------------------
#include <array.au3>
#include <string.au3>
#include <file.au3>
#include <NomadMemory.au3>
#NoTrayIcon

$g_szVersion = "Memory Tool 0.1"
If WinExists($g_szVersion) Then Exit ; It's already running
AutoItWinSetTitle($g_szVersion)
AutoItSetOption( "GUIOnEventMode", 1 )
SetPrivilege("SeDebugPrivilege", 1)

; ^ Ctrl    ! Alt    + Shift    # Win

Global $CloseGUI

$Form1 = GUICreate($g_szVersion, 200, 200, 800, 500, -1, -1)

$LabelPID = GUICtrlCreateLabel ("Running Process Name: ", 5, 5)
$InputPID = GUICtrlCreateInput("", 5, 20, 100)
GUICtrlSetData($InputPID, "VirtualDJ")

$Check = GUICtrlCreateButton("Check",  33, 60, 100)
GUICtrlSetOnEvent($Check, "Check")

$Exit = GUICtrlCreateButton("Exit",  125, 18, 50)
GUICtrlSetOnEvent($Exit, "MyExit")

$Label1 = GUICtrlCreateLabel ("Memory Address (HEX): ", 50, 100)
$Input1 = GUICtrlCreateInput("", 5, 125, 150)
GUICtrlSetData($Input1, "0x00A510F0")

$Label2 = GUICtrlCreateLabel ("Data Type: ", 50, 150)
$Input2 = GUICtrlCreateInput("", 5, 175, 150)
GUICtrlSetData($Input2, "'Char[16]'")


GUISetState(@SW_SHOW)

; Run the GUI until the dialog is closed
While 1
    If $CloseGUI = "CLOSE" Then ExitLoop
    sleep(10)
Wend

Func Check()
    ;Const $MemoryAddressLeftDeckArtist = 0x00A510F0
    ;Const $MemoryAddressLeftDeckSong = 0x00A51170
    ;Const $MemoryAddressRightDeckArtist = 0x00AC7568
    ;Const $MemoryAddressRightDeckSong = 0x00AC75E8
    
    $TheInput = GUICtrlRead($InputPID)
    
    $pid = WinGetProcess($TheInput)
    MsgBox(0, "PID: ", $pid)
    $OpenProcess = _MemoryOpen($pid)

    If @error = 0 Then 
        $error = 'No error.'
    ElseIf @error = 1 Then
        $error = 'Invalid $iv_Pid.'
    ElseIf @error = 2 Then
        $error = 'Failed to open Kernel32.dll.'
    ElseIf @error = 3 Then
        $error = 'Failed to open the specified process.'
    EndIf
    
    If $error <> 'No error.' Then MsgBox(0, "@error: ", $error)
    
    ;MsgBox(0, "Open Process: ", $OpenProcess[0])
    ;MsgBox(0, "Open Process: ", $OpenProcess[1])
    ;MsgBox(0, "Open Process: ", $OpenProcess)
    
    $TheInput1 = GUICtrlRead($Input1)
    $TheInput2 = GUICtrlRead($Input2)
    
    $Read = _MemoryRead($TheInput1, $OpenProcess, $TheInput2)
    _MemoryClose($OpenProcess)
    MsgBox(0, "Contents: ", $Read)
EndFunc


Func MyExit()
    Exit
EndFunc

For some reason, everything I try, _MemoryRead will only Return "0" and not any actual data text. :P

Can anyone see an error I have made, or is this some error in Nomad's _Memory.au3 ?

I have also tried this with the lastest beta and several stable versions, all with the same outcome.

Edited by RiCK_420_333

Share this post


Link to post
Share on other sites



Anyone got any suggestions for me PLEASE!???

Wait and if somebody know surely will post the answer.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

You need to set the privilege to a debug level so you can read from the process memory.


Share this post


Link to post
Share on other sites

You need to set the privilege to a debug level so you can read from the process memory.

Did that w/

SetPrivilege("SeDebugPrivilege", 1)

Also used PermEdit to do it manually, same result :P


Share this post


Link to post
Share on other sites

I Updated my code in the first post, I c\found a couple errors and got the script a lil further along, so now it at least gets the right PID, however the _MemoryRead still give me only a "0".

Still would like someone to review my code and offer suggestions, thanks very much!


Share this post


Link to post
Share on other sites

Aww, still no one has offered me any helpful advice? I know working with memory may be a complex thing, but someone must have some experience with it? If anyone can, please help. Thank you!!


Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Please stop making these "impatient" posts.

If people can and want to help they will...

Threads merged and lets stick to this one now.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Please stop making these "impatient" posts.

If people can and want to help they will...

Threads merged and lets stick to this one now.

Jos

I didnt make impatient post, The first post was from early morning, and I went to sleep since then and woke back up,

how is that being impatient?


Share this post


Link to post
Share on other sites

Between the two most recent posts (not counting the one above this) there was a five minute gap. That seems very impatient to ALL of us. Double and triple posting are frowned upon as well. You simply need to wait for someone with the interest and knowledge to see your thread and help. If you're that worried simply make sure you get email alerts when a new reply is posted.

Share this post


Link to post
Share on other sites

I didnt make impatient post, The first post was from early morning, and I went to sleep since then and woke back up,

how is that being impatient?

How do you call creating a new thread to seek attention for a just bumped thread?

I call that impatient and is not appreciated here.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Between the two most recent posts (not counting the one above this) there was a five minute gap. That seems very impatient to ALL of us. Double and triple posting are frowned upon as well. You simply need to wait for someone with the interest and knowledge to see your thread and help. If you're that worried simply make sure you get email alerts when a new reply is posted.

Yes but it was posted to 2 seperate topics, the only reason they are in the same one now is cuz that mod guy merged them.

Also I explained why, because I didnt know how to get my question back on the list, and still dont know how, so if someone could explain that?


Share this post


Link to post
Share on other sites

How do you call creating a new thread to seek attention for a just bumped thread?

I call that impatient and is not appreciated here.

Well I refreshed and it didn't seem to bump it for me, so I thought it was not on the list. No need to get mean about it, not everyone has as much experience on this forum as you do.


Share this post


Link to post
Share on other sites

Yes but it was posted to 2 seperate topics, the only reason they are in the same one now is cuz that mod guy merged them.

Also I explained why, because I didnt know how to get my question back on the list, and still dont know how, so if someone could explain that?

Keep going like this and you will get some time off from these forums as you are getting to be pretty annoying.

Why do you think THIS MOD GUY merged your posts? Because you are creating multiple threads on the same subject just because you are impatient.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I don't mean to sound rude but if you can't figure out something like being able to see your question which is clearly visible in the forum then perhaps scripting and programming aren't for you. Yes, reading memory is a bit of a tricky thing to do but when asking for help you simply need to be patient. Have you tried going to the author's thread and reading the posts there? Perhaps you could find an answer or some documentation as to why it would return a 0. There is also a good chance that the memory is dynamic so keep that in mind as well.

Share this post


Link to post
Share on other sites

Keep going like this and you will get some time off from these forums as you are getting to be pretty annoying.

Why do you think THIS MOD GUY merged your posts? Because you are creating multiple threads on the same subject just because you are impatient.

OK point taken, I'm sorry you see me annoying, same could be said about you, however I'm just trying to be friendly, and get a lil help with some code. Not trying to cause a fight.


Share this post


Link to post
Share on other sites

Can someone tell me how to delete my Post, cuz it's gone way off topic now, and maybe I should start it over from scratch? Anyone agree or disagree with that? I don't want to get in trouble for making a mistake again.


Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

OK point taken, I'm sorry you see me annoying, same could be said about you, however I'm just trying to be friendly, and get a lil help with some code. Not trying to cause a fight.

So you think I am annoying because you seems to have an issue understand a clear message given.

Whatever .

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I don't mean to sound rude but if you can't figure out something like being able to see your question which is clearly visible in the forum then perhaps scripting and programming aren't for you. Yes, reading memory is a bit of a tricky thing to do but when asking for help you simply need to be patient. Have you tried going to the author's thread and reading the posts there? Perhaps you could find an answer or some documentation as to why it would return a 0. There is also a good chance that the memory is dynamic so keep that in mind as well.

Yes i have read that authors post many times, however he doesn't ever tell you how to use his script, he only says:

"If you don't know how to use it, it's not for you" lol which is not very helpful at all!!!

However I have already written 8 other programs with Autoit, so I'm not a complete imbecile.

I have just never used the _MemoryRead function before.

Also the memory i am trying to read IS NOT dynamic, i have closed the program, and rebooted, and reloaded it, and the memory is still using the same location, so i'm sure its a static location. But thanks for that suggestion.

Edited by RiCK_420_333

Share this post


Link to post
Share on other sites

Then simply go through his code yourself. That is usually the best way to understand something, reverse engineering. Take the code apart mentally and figure out what each bit does then you'll understand its usage.

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