Jango Posted May 13, 2008 Share Posted May 13, 2008 (edited) 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 May 13, 2008 by Jango Link to comment Share on other sites More sharing options...
Jango Posted May 13, 2008 Author Share Posted May 13, 2008 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 More sharing options...
weaponx Posted May 13, 2008 Share Posted May 13, 2008 Boolean should be the same as Int. Link to comment Share on other sites More sharing options...
Jango Posted May 13, 2008 Author Share Posted May 13, 2008 Boolean should be the same as Int.Thank you weaponx... what about my first question ? Link to comment Share on other sites More sharing options...
zorphnog Posted May 13, 2008 Share Posted May 13, 2008 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 More sharing options...
Jango Posted May 13, 2008 Author Share Posted May 13, 2008 (edited) 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 May 13, 2008 by Jango Link to comment Share on other sites More sharing options...
ProgAndy Posted May 13, 2008 Share Posted May 13, 2008 (edited) 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 May 13, 2008 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 More sharing options...
Siao Posted May 13, 2008 Share Posted May 13, 2008 (edited) 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 May 13, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Jango Posted May 14, 2008 Author Share Posted May 14, 2008 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now