News:

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

OSVERSIONINFOEXA seems to be incorrect

Started by ecube, February 25, 2008, 10:54:25 AM

Previous topic - Next topic

ecube

in windows.inc it's defined as

OSVERSIONINFOEXA STRUCT
  dwOSVersionInfoSize DWORD ?
  dwMajorVersion  DWORD ?
  dwMinorVersion  DWORD ?
  dwBuildNumber   DWORD ?
  dwPlatformId    DWORD ?
  szCSDVersion    BYTE  128  dup (?)
  wServicePackMajor WORD ?
  wServicePackMinor WORD ?
  wReserved       WORD 2 dup (?)
OSVERSIONINFOEXA ENDS

but according to msdn it's defined as

OSVERSIONINFOEXA STRUCT
  dwOSVersionInfoSize DWORD ?
  dwMajorVersion  DWORD ?
  dwMinorVersion  DWORD ?
  dwBuildNumber   DWORD ?
  dwPlatformId    DWORD ?
  szCSDVersion    BYTE  128  dup (?)
  wServicePackMajor WORD ?
  wServicePackMinor WORD ?
  wSuiteMask           WORD ?
  wProductType       BYTE ?
  wReserved            BYTE ?
OSVERSIONINFOEXA ENDS


I ran into the structure missing an important field needed to detect the difference between vista and server 2008 here's example code


GetWinOS proc oBuF:DWORD
Local osvi:OSVERSIONINFOEX
mov osvi.dwOSVersionInfoSize,SIZEOF OSVERSIONINFO
invoke GetVersionEx, ADDR osvi

.if osvi.dwPlatformId == VER_PLATFORM_WIN32_NT
.if osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0
.if osvi.wProductType==VER_NT_WORKSTATION
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Vista")
.else
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Server 2008")
.endif
.elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows Server 2003")
.elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows XP ")
.elseif osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows 2000 ")
.elseif osvi.dwMajorVersion <= 4
invoke lstrcpy,oBuF,CTEXT("Microsoft Windows NT ")
.endif
.endif
ret
GetWinOS endp

I checked windows.inc 1.4 and it's still not fixed.