Could someone break this structure down to me in like a DWORD/Word arrangement?

rName RECORD NameIsString:1,NameOffset:31
Name1 dd ?
Id dw ?
OffsetToData dd ?
rDirectory RECORD DataIsDirectory:1,OffsetToDirectory:31
Posted on 2004-06-17 22:57:04 by JimmyClif
Pietrek breaks it down to this:

Name dd ?
OffsetToData dd ?

Is he right? ;)
Posted on 2004-06-17 23:02:04 by JimmyClif
That would work. In a UNION all the listed members begin at the same offset, so they actually point to the same thing but give it different aliases. The only thing you have to watch out for is that the size of the UNION is always the size of the largest member. So

qwrd dq ?
dwrd dd ?

would be 8 bytes even if dwrd was selected. Without this it would be impossible to calculate offsets within the stucture at compile time. Also a UNION is only for one member of the structure at a time, so no matter how many things are in the UNION it only represents alot of aliases for 1 structure member.
Posted on 2004-06-17 23:36:33 by donkey
From winnt.h:

// Each directory contains the 32-bit Name of the entry and an offset,
// relative to the beginning of the resource directory of the data associated
// with this directory entry. If the name of the entry is an actual text
// string instead of an integer Id, then the high order bit of the name field
// is set to one and the low order 31-bits are an offset, relative to the
// beginning of the resource directory of the string, which is of type
// IMAGE_RESOURCE_DIRECTORY_STRING. Otherwise the high bit is clear and the
// low-order 16-bits are the integer Id that identify this resource directory
// entry. If the directory entry is yet another resource directory (i.e. a
// subdirectory), then the high order bit of the offset field will be
// set to indicate this. Otherwise the high bit is clear and the offset
// field points to a resource data entry.

The data is indeed two DWORDs, that can be interpreted in different ways (it is two unions, each of DWORD size).
Posted on 2004-06-17 23:37:39 by death
Oh thanks...appreciated a lot!

Also what does this RECORD stuff mean though? for example

rName RECORD NameIsString:1,NameOffset:31

The masm manual says:

recordname RECORD fieldname:width [[= expression]]
[[, fieldname:width [[= expression]]]]...
Declares a record type consisting of the specified fields. The fieldname names the field, width specifies the number of bits, and expression gives its initial value.

A record named rName with a what and why? And where would I use that if I ever needed it? Or find it?
Posted on 2004-06-18 00:41:03 by JimmyClif
Afternoon, JimmyClif.

rName RECORD NameIsString:1,NameOffset:31
means that NameIsString is one bit in length and
NameOffset is 31 bits in length.
Together, they make up one dword (32 bits).

I suppose this allows the programmer to either use Name1 as a pointer to a string or to check NameIsString to see whether it's a pointer to a string and NameOffset for the address.

Posted on 2004-06-18 06:42:13 by Scronty
Cheers Scronty..
Posted on 2004-06-18 20:31:13 by JimmyClif