How I can declare and fill a nested struture?
Thanks
Saigam
To declare
S_ONE STRUCT
var1 DWORD ?
var2 DWORD ?
S_ONE ENDS
S_TWO STRUCT
s_one1 S_ONE <>
s_one2 S_ONE <>
othervar DWORD ?
S_TWO ENDS
For data filling:
s_two S_TWO <<0,0>,<0,0>,0>
(Fills all members in the structure s_two 0)
For code filling:
mov s_two.s_one2.var1,0
or
mov s_two.s_one1.var2,0
or
mov s_two.othervar,0
(Fills used varibles to zero)
For more info, read the windows.inc file that comes with masm32, it declares a lot of structures, so you will be able to pick up things from there.
Ok, here a harder question; How do I declare an structre with a nested array of structres.
S1 Struct
DD1 DWORD ?
DD2 DWORD ?
DD3 DWORD ?
S1 EndS
S2 Struct
R4t Real4 ?
DDt S1 2 dup ( {?} )
S2 Ends
.data?
SamStrct S2 { ?, {?}, {?} }
This works but I don't want to have to use the {?} for every nested structre in the .data? declaration as I need alot more than 2 nested structres.
Any Ideas
This message was edited by Zadkiel, on 4/29/2001 7:24:44 AMThanks, George!!! :)
ZadKiel, This works:
.data?
SamStrct S2 <>
Right?
Yes Saigam your right, thanks, but actually I asked the wrong question, sorry.
Useing the same two structres I want to declare an array of the second one. Something like
SamStrct S2 10 dup ({ ?, {?}, {?} })
Again the code I have up there works but as I said I don't want to have to use {?} for every nested structre as it awkard to chang quickly and I'm using quite large structres
Anyone any ideas.
This message was edited by Zadkiel, on 4/29/2001 6:05:05 PMI would stick this down to an assembler bug. I have never come across it before, strange.
My best advice would be to arrange all the structures so they dont have the DUP operator (To create nested duplicate stuctures) and only use DUP in the final data declartion.
Another method would be to write a special purpose macro to write the extra {?} in specialy
Zadkiel, maybe this can help you:
.data?
SamStrct label S2
repeat 10
local bagage
bagage S2 <>
endm
Look if this solve your problem... :)
Saigam
This message was edited by Saigam, on 5/1/2001 4:07:53 PM