dhcpsapi.h translate of DHCP_OPTION_SCOPE_INFO6

Started by ToutEnMasm, September 19, 2010, 01:36:03 PM

Previous topic - Next topic

ToutEnMasm


If anybody have an idea on how translate this structure in masm,I will be happy to read it

Quote
typedef struct _DHCP_OPTION_SCOPE_INFO6 {
    DHCP_OPTION_SCOPE_TYPE6 ScopeType;
#if defined(MIDL_PASS)
    [switch_is(ScopeType), switch_type(DHCP_OPTION_SCOPE_TYPE6)]
    union _DHCP_OPTION_SCOPE_UNION6 {
        [case(DhcpDefaultOptions6)] ;
        [case(DhcpScopeOptions6)]    DHCP_IPV6_ADDRESS    SubnetScopeInfo;
        [case(DhcpReservedOptions6)] DHCP_RESERVED_SCOPE6 ReservedScopeInfo;
        [case(DhcpGlobalOptions6)];
    } ScopeInfo;
#else
    union _DHCP_OPTION_SCOPE_UNION6 {
        PVOID                 DefaultScopeInfo; // must be NULL
        DHCP_IPV6_ADDRESS     SubnetScopeInfo;
        DHCP_RESERVED_SCOPE6  ReservedScopeInfo;
    } ScopeInfo;
#endif // MIDL_PASS
} DHCP_OPTION_SCOPE_INFO6, *LPDHCP_OPTION_SCOPE_INFO6;


vozzie

Hy

If you leave the MIDL_PASS part out, it looks like this,...

typedef struct _DHCP_OPTION_SCOPE_INFO6 {
    DHCP_OPTION_SCOPE_TYPE6 ScopeType;
    union _DHCP_OPTION_SCOPE_UNION6 {
        PVOID                 DefaultScopeInfo; // must be NULL
        DHCP_IPV6_ADDRESS     SubnetScopeInfo;
        DHCP_RESERVED_SCOPE6  ReservedScopeInfo;
    } ScopeInfo;
} DHCP_OPTION_SCOPE_INFO6, *LPDHCP_OPTION_SCOPE_INFO6;


A union means the members are overlapping,... taking the largest member what is the "DHCP_RESERVED_SCOPE6" it would look like this

DHCP_IPV6_ADDRESS Struct
HighOrderBits QWord 0
LowOrderBits QWord 0
DHCP_IPV6_ADDRESS EndS

DHCP_RESERVED_SCOPE6 Struct
ReservedIpAddress DHCP_IPV6_ADDRESS <0>
ReservedIpSubnetAddress DHCP_IPV6_ADDRESS <0>
DHCP_RESERVED_SCOPE6 EndS

DHCP_OPTION_SCOPE_INFO6 Struct
ScopeType DWord 0
DHCP_OPTION_SCOPE_UNION6 DHCP_RESERVED_SCOPE6 <0>
DHCP_OPTION_SCOPE_INFO6 EndS


That is with my poor assembly knowledge. I don't know if assembly supports union.

Greetings

ToutEnMasm

My translator have translated it like that
Quote
DHCP_OPTION_SCOPE_INFO6   STRUCT
   ScopeType DWORD ?
IF DEFINED(MIDL_PASS)
   union   ScopeInfo
   SubnetScopeInfo DHCP_IPV6_ADDRESS  <>
   ReservedScopeInfo DHCP_RESERVED_SCOPE6 <>
   ENDS
   ELSE
   union   ScopeInfo
   DefaultScopeInfo DWORD ? ; must be NULL
   SubnetScopeInfo DHCP_IPV6_ADDRESS <>
   ReservedScopeInfo DHCP_RESERVED_SCOPE6 <>
   ENDS
ENDIF ; MIDL_PASS
DHCP_OPTION_SCOPE_INFO6      ENDS



THe midl part is wrong (miss case) but ml don't use midl and this don't made compile error.I think I
the good idea is to let it as it is.