Jump to content

Question about DLLStructCreate


Recommended Posts

Hello,

I want to create these structures with DLLStructCreate, the first structure is included in the second. How to do that with DLLStructCreate ?

typedef struct {
BYTE certif[];
long certifLength;
char certifLabel[];
long certifStatus;
} BEID_Certif;

typedef struct {
long usedPolicy;
BEID_Certif certificates[]; // <-- ARRAY of BEID_Certif 1st struct
long certificatesLength;
long signatureCheck;
} BEID_Certif_Check;
Edited by Jango
Link to comment
Share on other sites

Hello,

I want to create these structures with DLLStructCreate, the first structure is included in the second. How to do that with DLLStructCreate ?

typedef struct {
BYTE certif[];
long certifLength;
char certifLabel[];
long certifStatus;
} BEID_Certif;

typedef struct {
long usedPolicy;
BEID_Certif certificates[]; // <-- ARRAY of BEID_Certif 1st struct
long certificatesLength;
long signatureCheck;
} BEID_Certif_Check;
One more question, i also noticed that there is a type BOOL but i cant' find it in the autoit help file, so what can i use instead ?
Link to comment
Share on other sites

I don't believe you can create a dynamic arrays like "BYTE certif[...]" or "char certifLabel[...]". You need to know the sizes of these variables in order to create your structs. It appears that the certif[] size is provided by the certifLength variable, but its impossible to know where that variable is located in memory because it comes after the certif data. Can you provide the documentation for these structs?

Link to comment
Share on other sites

I don't believe you can create a dynamic arrays like "BYTE certif[...]" or "char certifLabel[...]". You need to know the sizes of these variables in order to create your structs. It appears that the certif[] size is provided by the certifLength variable, but its impossible to know where that variable is located in memory because it comes after the certif data. Can you provide the documentation for these structs?

the lenght of the array are fixed, for example BEID_MAX_CERT_LEN is a constant. here it is:

#define BEID_MAX_CERT_LEN                           2048
#define BEID_MAX_CERT_NUMBER                     10
#define BEID_MAX_CERT_LABEL_LEN              256


typedef struct 
{
    BYTE certif[BEID_MAX_CERT_LEN];
    long certifLength;              
    char certifLabel[BEID_MAX_CERT_LABEL_LEN+1];
    long certifStatus;                  
    BYTE rfu[6];
} BEID_Certif;

typedef struct 
{
    long usedPolicy;                    
    BEID_Certif certificates[BEID_MAX_CERT_NUMBER];
    long certificatesLength;            
    long signatureCheck;                   
    BYTE rfu[6];
} BEID_Certif_Check;
Edited by Jango
Link to comment
Share on other sites

Normally, you would do it this way:

$BEID_Certif = "BYTE certif[2048]; long certifLength; char certifLabel[256+1]; long certifStatus; BYTE rfu[6]"
$BEID_Certif_Check = "long usedPolicy; " & $BEID_Certif & "; long certificatesLength; long signatureCheck; BYTE rfu[6]"

But here, It is used as an Array ... Don't know, how a Struct is used as Array in a Struct. Possibly you can't to it in AutoIt

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Const $BEID_MAX_CERT_LEN =  2048
Const $BEID_MAX_CERT_NUMBER = 10
Const $BEID_MAX_CERT_LABEL_LEN = 256

$sBEID_Certif = "byte[" & $BEID_MAX_CERT_LEN & "];long CertifLength;char [" & $BEID_MAX_CERT_LABEL_LEN+1 & "];long CertifStatus;byte rfu[6]"

$sBEID_Certif_Check = "long UsedPolicy;"
For $i = 1 To $BEID_MAX_CERT_NUMBER
    $sBEID_Certif_Check &= $sBEID_Certif & ";"
Next
$sBEID_Certif_Check &= "long CertificatesLength;long SignaturesCheck;byte rfu[6]"

$tBEID_Certif_Check = DllStructCreate($sBEID_Certif_Check)

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Const $BEID_MAX_CERT_LEN =  2048
Const $BEID_MAX_CERT_NUMBER = 10
Const $BEID_MAX_CERT_LABEL_LEN = 256

$sBEID_Certif = "byte[" & $BEID_MAX_CERT_LEN & "];long CertifLength;char [" & $BEID_MAX_CERT_LABEL_LEN+1 & "];long CertifStatus;byte rfu[6]"

$sBEID_Certif_Check = "long UsedPolicy;"
For $i = 1 To $BEID_MAX_CERT_NUMBER
    $sBEID_Certif_Check &= $sBEID_Certif & ";"
Next
$sBEID_Certif_Check &= "long CertificatesLength;long SignaturesCheck;byte rfu[6]"

$tBEID_Certif_Check = DllStructCreate($sBEID_Certif_Check)
well, you are a god Siao ... thank you !
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...