Jump to content

whats wrong with my DllStructCreate declration


Recommended Posts

Hello,

i am trying to set 5 different buffer in same declaration of DllStructCreate but i got null value

could someone point me whats wrong in the Structure declaration.

Thanks,

$size="144380";byte

$buffer = "int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"]"
For $u = 1 To 5
For $i=0 To $size/4 -1
        
        $data = DllStructSetData($buffer,$u,Random(0,2^31-1,1),$i+1)
    ;MsgBox(0,"filled data",$data )
    Next
Next

MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($buffer) & @CRLF & _
        "Struct pointer: " & DllStructGetPtr($buffer) & @CRLF & _
        "Data:" & @CRLF & _
        DllStructGetData($buffer,1) & @CRLF & _
        DllStructGetData($buffer,2) & @CRLF & _
        DllStructGetData($buffer,3) & @CRLF & _
        DllStructGetData($buffer,4))
Link to comment
Share on other sites

Hello,

i am trying to set 5 different buffer in same declaration of DllStructCreate but i got null value

could someone point me whats wrong in the Structure declaration.

Thanks,

$size="144380";byte

$buffer = "int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"];int ["&$size/4&"]"
For $u = 1 To 5
For $i=0 To $size/4 -1
        
        $data = DllStructSetData($buffer,$u,Random(0,2^31-1,1),$i+1)
;MsgBox(0,"filled data",$data )
    Next
Next

MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($buffer) & @CRLF & _
        "Struct pointer: " & DllStructGetPtr($buffer) & @CRLF & _
        "Data:" & @CRLF & _
        DllStructGetData($buffer,1) & @CRLF & _
        DllStructGetData($buffer,2) & @CRLF & _
        DllStructGetData($buffer,3) & @CRLF & _
        DllStructGetData($buffer,4))
How about if you actually CREATE the DLLStruct? This works:
$size = "144380";byte

$tagbuffer = "int [" & $size / 4 & "];int [" & $size / 4 & "];int [" & $size / 4 & "];" & _
        "int [" & $size / 4 & "];int [" & $size / 4 & "]"
$buffer = DllStructCreate($tagbuffer)
For $u = 1 To 5
    For $i = 1 To $size / 4
        $data = DllStructSetData($buffer, $u, Random(0, 2 ^ 31 - 1, 1), $i)
    Next
Next

MsgBox(0, "DllStruct", "Struct Size: " & DllStructGetSize($buffer) & @CRLF & _
        "Struct pointer: " & DllStructGetPtr($buffer) & @CRLF & _
        "Data:" & @CRLF & _
        DllStructGetData($buffer, 1) & @CRLF & _
        DllStructGetData($buffer, 2) & @CRLF & _
        DllStructGetData($buffer, 3) & @CRLF & _
        DllStructGetData($buffer, 4))

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

How about if you actually CREATE the DLLStruct? This works:

$size = "144380";byte

$tagbuffer = "int [" & $size / 4 & "];int [" & $size / 4 & "];int [" & $size / 4 & "];" & _
        "int [" & $size / 4 & "];int [" & $size / 4 & "]"
$buffer = DllStructCreate($tagbuffer)
For $u = 1 To 5
    For $i = 1 To $size / 4
        $data = DllStructSetData($buffer, $u, Random(0, 2 ^ 31 - 1, 1), $i)
    Next
Next

MsgBox(0, "DllStruct", "Struct Size: " & DllStructGetSize($buffer) & @CRLF & _
        "Struct pointer: " & DllStructGetPtr($buffer) & @CRLF & _
        "Data:" & @CRLF & _
        DllStructGetData($buffer, 1) & @CRLF & _
        DllStructGetData($buffer, 2) & @CRLF & _
        DllStructGetData($buffer, 3) & @CRLF & _
        DllStructGetData($buffer, 4))

:P

oops thanks
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
 Share

  • Recently Browsing   0 members

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