i have not understood your question
but see if what i post makes sense
in winnt.h
ldt_entry is defined thus
typedef struct _LDT_ENTRY {
WORD LimitLow;
WORD BaseLow;
union {
struct {
BYTE BaseMid;
BYTE Flags1; // Declare as bytes to avoid alignment
BYTE Flags2; // Problems.
BYTE BaseHi;
} Bytes;
struct {
DWORD BaseMid : 8;
DWORD Type : 5;
DWORD Dpl : 2;
DWORD Pres : 1;
DWORD LimitHi : 4;
DWORD Sys : 1;
DWORD Reserved_0 : 1;
DWORD Default_Big : 1;
DWORD Granularity : 1;
DWORD BaseHi : 8;
} Bits;
} HighWord;
} LDT_ENTRY, *PLDT_ENTRY;
the unions are unnamed
the dt in windbg will display this
lkd> dt testdll!_LDT_ENTRY
+0x000 LimitLow : Uint2B
+0x002 BaseLow : Uint2B
+0x004 HighWord : __unnamed
to open it up
lkd> dt -b testdll!_LDT_ENTRY
+0x000 LimitLow : Uint2B
+0x002 BaseLow : Uint2B
+0x004 HighWord : __unnamed
+0x000 Bytes : __unnamed
+0x000 BaseMid : UChar
+0x001 Flags1 : UChar
+0x002 Flags2 : UChar
+0x003 BaseHi : UChar
+0x000 Bits : __unnamed
+0x000 BaseMid : Pos 0, 8 Bits
+0x000 Type : Pos 8, 5 Bits
+0x000 Dpl : Pos 13, 2 Bits
+0x000 Pres : Pos 15, 1 Bit
+0x000 LimitHi : Pos 16, 4 Bits
+0x000 Sys : Pos 20, 1 Bit
+0x000 Reserved_0 : Pos 21, 1 Bit
+0x000 Default_Big : Pos 22, 1 Bit
+0x000 Granularity : Pos 23, 1 Bit
+0x000 BaseHi : Pos 24, 8 Bits
the lone unionmember and its expansion (notice there is a dot )
lkd> dt testdll!_LDT_ENTRY Highword
+0x004 HighWord : __unnamed
lkd> dt testdll!_LDT_ENTRY Highword.
+0x004 HighWord :
+0x000 Bytes : __unnamed
+0x000 Bits : __unnamed
expanding what you want
lkd> dt testdll!_LDT_ENTRY Highword.Bytes
+0x004 HighWord :
+0x000 Bytes : __unnamed
lkd> dt testdll!_LDT_ENTRY Highword.Bytes.
+0x004 HighWord :
+0x000 Bytes :
+0x000 BaseMid : UChar
+0x001 Flags1 : UChar
+0x002 Flags2 : UChar
+0x003 BaseHi : UChar
bits union member
lkd> dt testdll!_LDT_ENTRY Highword.bits
+0x004 HighWord :
+0x000 Bits : __unnamed
lkd> dt testdll!_LDT_ENTRY Highword.bits.
+0x004 HighWord :
+0x000 Bits :
+0x000 BaseMid : Pos 0, 8 Bits
+0x000 Type : Pos 8, 5 Bits
+0x000 Dpl : Pos 13, 2 Bits
+0x000 Pres : Pos 15, 1 Bit
+0x000 LimitHi : Pos 16, 4 Bits
+0x000 Sys : Pos 20, 1 Bit
+0x000 Reserved_0 : Pos 21, 1 Bit
+0x000 Default_Big : Pos 22, 1 Bit
+0x000 Granularity : Pos 23, 1 Bit
+0x000 BaseHi : Pos 24, 8 Bits
some wildcarding
lkd> dt testdll!_LDT_ENTRY Highword.bits.B*
+0x004 HighWord :
+0x000 Bits :
+0x000 BaseMid : Pos 0, 8 Bits
+0x000 BaseHi : Pos 24, 8 Bits
post either the debug output or code for a better and comprehensive answer
dont work statements dont really work
GetFieldOffset comments have something about dot sepearated things
// Given a type which can contain members
// this method returns the offset of a
// particular member within the type.
// TypeId should give the container type ID
// and Field gives the dot-separated path
// to the field of interest.
STDMETHOD(GetFieldOffset)(
THIS_
__in ULONG64 Module,
__in ULONG TypeId,
__in PCSTR Field,
__out PULONG Offset
) PURE;
On 12/18/08, xxxxx@yahoo.com wrote:
>
> It returns success, but it always returns an offset of 0.
>
> If I typedef the union outside the structure definition, the same debug
> extension code will return a correct offset.
>
> —
> You are currently subscribed to windbg as: xxxxx@gmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>