Sign in to follow this  
Followers 0
Archon

Taking value from memory adress

6 posts in this topic

Is in AutoIt function or possibility to take value from specific memory adress like pointers (ptr*) in C/Cpp? I know that DllStructCreate can do this but is's slow. I dont want make structures, only get value from adress.

Share this post


Link to post
Share on other sites



Do you think that I didn't search first? I found nothing, mabye bad enquiries, I don't know :/

Share this post


Link to post
Share on other sites

I seam to remember using a UDF called "nomadmemory.au3" you might have some luck searching for it but I can't remember much about this UDF.

Cheers,

-1


What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is in AutoIt function or possibility to take value from specific memory adress like pointers (ptr*) in C/Cpp? I know that DllStructCreate can do this but is's slow. I dont want make structures, only get value from adress.

There must be a structure to divide the memory data , but it possible

to get the value directly from the Ptr .

Check out this example

$str = "int var1;ushort var2;ushort var3;char var4[128]"

$a = DllStructCreate($str)

DllStructSetData($a,"var3",10554)

MsgBox(0,"DllStructSetData","var3 = " & DllStructGetData($a,"var3"))

$Ptr = DllStructGetPtr($a)

;int var1;ushort var2

$IntSize = DllStructGetSize(DllStructCreate("int"))

;int_var1 ==> int Size ==> 4 BYTE

$Size = $IntSize ;4 BYTE

$ushortSize = DllStructGetSize(DllStructCreate("ushort"))

;ushort_var2 ==> ushort Size ==> 2 BYTE

$Size += $ushortSize ;2 BYTE

$OutPtr = $Ptr + $Size ;Move Ptr To First Or Start ushort_var3 BYTE ==> 4 + 2 = 6

$b = DllStructCreate("ushort var3",$OutPtr)

$var3 = DllStructGetData($b,"var3")

MsgBox(0,"Get Data From Ptr","var3 = " & $var3)

$str = "int var1;ushort var2;ushort var3;char var4[128]"
$a = DllStructCreate($str)
DllStructSetData($a,"var3",10554)
MsgBox(0,"DllStructSetData","var3 = " & DllStructGetData($a,"var3"))
$Ptr = DllStructGetPtr($a)

;int var1;ushort var2

$IntSize = DllStructGetSize(DllStructCreate("int"))
;int_var1 ==> int Size ==> 4 BYTE
$Size = $IntSize ;4 BYTE

$ushortSize = DllStructGetSize(DllStructCreate("ushort"))
;ushort_var2 ==> ushort Size ==> 2 BYTE
$Size += $ushortSize ;2 BYTE

$OutPtr = $Ptr + $Size ;Move Ptr To First Or Start ushort_var3 BYTE ==> 4 + 2 = 6

$b = DllStructCreate("ushort var3",$OutPtr)
$var3 = DllStructGetData($b,"var3")
MsgBox(0,"Get Data From Ptr","var3 = " & $var3)
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

wolf9228, It works of course, but is still solution based on structures.

Negative1, I found this UDF and checked it. There were also used structures :( And some Dll's but useless for me in this case, howewer it look interesting.

I am going to start thinking that in AutoIt there is no simple and faster solution to get value from pointer like pass by structure. It's strange because in other way it's possible by Ptr() function :mellow:

Someone have any ideas?

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