Is it possible in FASM to make a subj?
I mean a structure which contains a member with size depending on the value of the other member.
Posted on 2002-10-16 12:44:16 by longer
Hi longer,

do you mean something like:


struc SUBJ{
.first dd ?
.second dd ?
.third dd ?

}
virtual at 0
subj SUBJ
firstSUBJ = subj.first + 10
end virtual
Posted on 2002-10-18 12:10:05 by slop
Hi, sloppy!
Sorry, I can't understand what does the virtual piece of code do. :( Can you explain?
Here's what I exactly want:


struc RECT
{ .left dd ?
.top dd ?
.right dd ?
.bottom dd ? }

struc RGNDATAHEADER
{ .dwSize dd ?
.iType dd ?
.nCount dd ?
.nRgnSize dd ?
.rcBound RECT }

struc RGNDATA
{ .rdh RGNDATAHEADER
.Buffer ??? }


The problem is that RGNDATA.Buffer seems to contain nCount RECTs.
So the question is: Can I declare RGNDATA structure in FASM?
Posted on 2002-10-19 05:43:13 by longer
Try something like the following;
struc   RECT

{ .left dd ?
.top dd ?
.right dd ?
.bottom dd ?
.size = $ }

struc RGNDATAHEADER
{ .dwSize dd ?
.iType dd ?
.nCount dd ?
.nRgnSize dd ?
.rcBound RECT
.size = $ }

struc RGNDATA
{ .rdh RGNDATAHEADER
.Buffer = $ }

virtual at 0
RECT RECT
end virtual

virtual at 0
RGNDATAHEADER RGNDATAHEADER
end virtual

virtual at 0
RGNDATA RGNDATA
end virtual

Then to access lets say the 6th RECT in the RGNDATA struc use
;eax points to a RGNDATA struc

lea eax,[eax+RGNDATA.Buffer+RECT.size*5]
;eax points to the 6th RECT

See this thread for more info.
Posted on 2002-10-19 06:40:47 by Eóin
Thanks for your replies,
it seems I've got the idea. :alright:
Posted on 2002-10-19 12:26:02 by longer