The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => WINDOWS.INC Project => Topic started by: sleepyhead on February 10, 2005, 12:55:30 AM

Title: LARGE_INTEGER
Post by: sleepyhead on February 10, 2005, 12:55:30 AM
...is declared a STRUCT, but should be a UNION

current declaration:

LARGE_INTEGER STRUCT
        QuadPart QWORD ?
LARGE_INTEGER ENDS




correct declaration:

LARGE_INTEGER UNION
   STRUCT
        LowPart DWORD ?
        HighPart DWORD ?
   ENDS
   STRUCT u
        LowPart DWORD ?
        HighPart DWORD ?   
   ENDS
   QuadPart QWORD ?
LARGE_INTEGER ENDS
   
Title: Re: LARGE_INTEGER
Post by: Webring on July 01, 2005, 04:04:07 PM
local bigone:LARGE_INTEGER
mov    edx,dword ptr [bigone.QuadPart+4] ;HighPart
mov    eax,dword ptr [bigone.QuadPart] ;LowPart

:U
Title: Re: LARGE_INTEGER
Post by: ToutEnMasm on July 06, 2005, 04:56:52 PM
Hello,

It's in winnt.h like that,it may be a STRUCT or a union , the question is
What is the meaning of MIDL_PASS   ?
it's also define in Wtypes.h

Is there any that can answer why it's defined twice and what choose to made ?

                                       ToutEnMasm
in   Wtypes.h
#if 0
typedef struct _LARGE_INTEGER
    {
    LONGLONG QuadPart;
    }    LARGE_INTEGER;

in  winnt.h

#if defined(MIDL_PASS)
typedef struct _LARGE_INTEGER {
#else // MIDL_PASS
typedef union _LARGE_INTEGER {
    struct {
        DWORD LowPart;
        LONG HighPart;
    };
    struct {
        DWORD LowPart;
        LONG HighPart;
    } u;
#endif //MIDL_PASS
    LONGLONG QuadPart;
} LARGE_INTEGER;

For masm
in wtypes.inc
LARGE_INTEGER STRUCT
     QuadPart QWORD ?
LARGE_INTEGER ENDS

in winnt.inc,the u struct must be out because a nested structure cannot be named

IF DEFINED (MIDL_PASS)
LARGE_INTEGER   STRUCT ; MIDL_PASS
ELSE
LARGE_INTEGER   UNION
   STRUCT
   LowPart DWORD ?
   HighPart DWORD ?
   ENDS
ENDIF
    ;MIDL_PASS
   QuadPart QWORD ?
LARGE_INTEGER      ENDS