Jump to content

Structres for DLLs


Ejoc
 Share

Recommended Posts

I would like to see commands as...

DLLStructCreate()

DLLStructGetItem()

DLLStructSetItem()

or something similar...

Lar.

<{POST_SNAPBACK}>

I like those, I was going to do C_Struct, but DLLStruct* makes me warm and fuzzy. :)
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I like those, I was going to do C_Struct, but DLLStruct* makes me warm and fuzzy. :)

<{POST_SNAPBACK}>

Good work! I too would sure like to see this integrated with AutoIT.

One question and sorry if I have not understood your implementation completely but how do you handle references to other structs within a struct?

Edited by SumTingWong
Link to comment
Share on other sites

Good work! I too would sure like to see this integrated with AutoIT.

One question and sorry if I have not understood your implementation completely but how do you handle references to other structs within a struct?

<{POST_SNAPBACK}>

Never said but it kinda depands on weather its:

typedef struct {
    int i;
    int n;
}STRUCT1;

typedef struct {
    int i;
    STRUCT1 subStruct;
}STRUCT2;

I would then do:
$struct1_str = "int;int"
$struct2_str = "int;byte(" & _DLLMemStructSize($struct1_str) & )"

$struct = _DllMemCreate($struct2_str)
$subStruct = _DllMemElementOffset($struct2_str,1)
$STRUCT2_subStruct_n = _DllMemGet($subStruct,$struct1_str,1)

or

typedef struct {
    int i;
    int n;
}STRUCT1;

typedef struct {
    int i;
    STRUCT1 *subStruct;
}STRUCT2;

I would then do:
$struct1_str = "int;int"
$struct2_str = "int;ptr"

$subStruct = _DllMemCreate($struct1_str)
$struct = _DllMemCreate($struct2_str)
_DllMemSet($struct,$struct2_str,1,$subStruct)

$STRUCT2_subStruct_n = _DllMemGet($subStruct,$struct1_str,1)

*code is not tested

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

  • 5 years later...

I have 4 littles error.

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3(72,30) : ERROR: Opt() called with illegal argument 1: "OnExitFunc"

Opt("OnExitFunc","_DllMemEnd")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3(115,29) : ERROR: syntax error

ReDim $_Ejocs_DllMem_Stack

~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3(85,29) : ERROR: _DllMemSetDataType(): undefined function.

_DllMemSetDataType("char",1)

~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3(112,41) : ERROR: _DllMemFree(): undefined function.

_DllMemFree($_Ejocs_DllMem_Stack[$i])

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3 - 4 error(s), 0 warning(s)

For

C:\Users\Ptifou78\Downloads\DllMem\DllMem.au3(72,30) : ERROR: Opt() called with illegal argument 1: "OnExitFunc"

Opt("OnExitFunc","_DllMemEnd")

Change

Opt("OnExitFunc","_DllMemEnd") to OnAutoItExitRegister("_DllMemEnd")

And for next error i haven't found a solution :/.

Ps: Sorry for my bad english i'm french ;)

Edited by Ptifou78
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...