Announcement

Collapse
No announcement yet.

Union IN a structure - ??

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Union IN a structure - ??

    Microsoft has changed the SYSTEM_INFO structure apparantly...

    Code:
    typedef struct _SYSTEM_INFO {
      union {
        DWORD  dwOemId;
        struct {
          WORD wProcessorArchitecture;
          WORD wReserved;
        } ;
      } ;
      DWORD     dwPageSize;
      LPVOID    lpMinimumApplicationAddress;
      LPVOID    lpMaximumApplicationAddress;
      DWORD_PTR dwActiveProcessorMask;
      DWORD     dwNumberOfProcessors;
      DWORD     dwProcessorType;
      DWORD     dwAllocationGranularity;
      WORD      wProcessorLevel;
      WORD      wProcessorRevision;
    } SYSTEM_INFO;
    Members
    dwOemId
    An obsolete member that is retained for compatibility. Applications should use the wProcessorArchitecture branch of the union.
    This is what we have in the v8.x Win32api.inc:

    Code:
    TYPE SYSTEM_INFO
      dwOemID AS DWORD
      dwPageSize AS DWORD
      lpMinimumApplicationAddress AS DWORD
      lpMaximumApplicationAddress AS DWORD
      dwActiveProcessorMask AS DWORD
      dwNumberOfProcessors AS DWORD
      dwProcessorType AS DWORD
      dwAllocationGranularity AS DWORD
      wProcessorLevel AS WORD
      wProcessorRevision AS WORD
    END TYPE
    How do I implement that union in my SYSTEM_INFO?

    Thanks,
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

  • #2
    This way:

    Code:
    ' // Size = 4 bytes
    TYPE SYSTEM_INFO_UNION_STRUCT WORD
       wProcessorArchitecture AS WORD   ' WORD wProcessorArchitecture
       wReserved              AS WORD   ' WORD wReserved
    END TYPE
    
    ' // Size = 4 bytes
    UNION SYSTEM_INFO_UNION DWORD
       dwOemId AS DWORD   ' DWORD dwOemId;          // Obsolete field...do not use
       SYSTEM_INFO_UNION_STRUCT
    END UNION
    
    ' // Size = 36 bytes
    TYPE SYSTEM_INFO DWORD FILL
       SYSTEM_INFO_UNION
       dwPageSize                  AS DWORD   ' DWORD     dwPageSize
       lpMinimumApplicationAddress AS DWORD   ' LPVOID    lpMinimumApplicationAddress
       lpMaximumApplicationAddress AS DWORD   ' LPVOID    lpMaximumApplicationAddress
       dwActiveProcessorMask       AS DWORD   ' DWORD_PTR dwActiveProcessorMask
       dwNumberOfProcessors        AS DWORD   ' DWORD     dwNumberOfProcessors;
       dwProcessorType             AS DWORD   ' DWORD     dwProcessorType
       dwAllocationGranularity     AS DWORD   ' DWORD     dwAllocationGranularity
       wProcessorLevel             AS WORD    ' WORD      wProcessorLevel
       wProcessorRevision          AS WORD    ' WORD      wProcessorRevision
    END TYPE
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      That worked, thank you.

      Don' quite understand it but tha'ts OK, it's Thanksgiving - and tha'ts my excuse LOL

      Happy Thanksgiving
      Scott Turchin
      MCSE, MCP+I
      http://www.tngbbs.com
      ----------------------
      True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

      Comment

      Working...
      X