News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

LARGE_INTEGER

Started by sleepyhead, February 10, 2005, 12:55:30 AM

Previous topic - Next topic

sleepyhead

...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
   

Webring

local bigone:LARGE_INTEGER
mov    edx,dword ptr [bigone.QuadPart+4] ;HighPart
mov    eax,dword ptr [bigone.QuadPart] ;LowPart

:U

ToutEnMasm

#2
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