Jump to content

Recommended Posts

Posted (edited)

I am trying to serialize all the autoit variable by >msgpack, so that I can used it in ZeroRPC (language-agnostic remote procedure call over internet). Int, string, binary are easy, but DllStruct is not. Before variable serialization become build-in function (I hope so), I have to find out my own way.
 
Here is my attempt to guess the setup string. I am not sure did I deal with all the align and struct/endstruct correctly, please let me know if there is any bug. The output may not be the same with the original string, it is not bug.
 
 

Test()

Func Test()
    Local $Struct
    $Struct = DllStructCreate("align 2;byte;ptr[2]")
    ConsoleWrite(DLLStructAnalyze($Struct) & @LF)

    ; Output: byte;align 2;ptr[2]

    $Struct = DllStructCreate("int;struct;struct;uint64;uint;byte[5];endstruct;byte;endstruct;byte")
    ConsoleWrite(DLLStructAnalyze($Struct) & @LF)

    ; Output: int;struct;struct;uint64;uint;byte[5];endstruct;byte;endstruct;byte

    $Struct = DllStructCreate("int;uint64;struct;struct;uint;byte[5];endstruct;byte;endstruct;byte")
    ConsoleWrite(DLLStructAnalyze($Struct) & @LF)

    ; Output: int;uint64;struct;struct;uint;byte[5];endstruct;byte;endstruct;byte
EndFunc

 

  Reveal hidden contents

Edited by Ward

新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

  • 4 weeks later...
Posted (edited)

Hi Ward,

This would be an extremely useful function (to me, at least). However, on my test rig (W7Pro/64) it errors with:

"D:\Autoit\Pool\dllstructAnalyze.au3" (18) : ==> Subscript used on non-accessible variable.:
$Ret &= ($i ? ";" : "") & $Item[0]
$Ret &= ($i ? ";" : "") & $Item^ ERROR

This is when I include the analyzer as a separate file in your test example. If I simply append the analyzer to the test file, AutoIt crashes. Haven't done any detailed diagnostics.

Edited by RTFC
Posted (edited)

Oh, this scrip crash on v3.3.12.0, because I still use v3.3.10.2...

I fixed it. The problem is in the newer Array.au3 UDF.

It did "concatenate" rather than "add" in _ArrayAdd(). (WTF...)

Edited by Ward

新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

Posted

Is this just an oversight?

Func DLLStructAnalyze(ByRef $DLLStruct)
    Local $Dict = __DLLStructAnalyzeHook(True)
    $Dict.Add($DLLStruct)
    Return __DLLStructAnalyzeCallback(0)
    __DLLStructAnalyzeHook(False); In C/++ terms it would mean unreachable code.
EndFunc

Not that I'd know what to do with the code anyway, just seen it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Thanks JohnOne, It seems I pressed some hotkey that swapped these two lines by accident.

新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

  • 7 years later...

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
×
×
  • Create New...