Platform SDK: Windows System Information

OSVERSIONINFO

The OSVERSIONINFO data structure contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and descriptive text about the operating system. This structure is used with the GetVersionEx function.

typedef struct _OSVERSIONINFO{ 
  DWORD dwOSVersionInfoSize; 
  DWORD dwMajorVersion; 
  DWORD dwMinorVersion; 
  DWORD dwBuildNumber; 
  DWORD dwPlatformId; 
  TCHAR szCSDVersion[ 128 ]; 
} OSVERSIONINFO; 

Members

dwOSVersionInfoSize
Specifies the size, in bytes, of this data structure. Set this member to sizeof(OSVERSIONINFO) before calling the GetVersionEx function.
dwMajorVersion
Identifies the major version number of the operating system as follows.
Operating System Value
Windows 95 4
Windows 98 4
Windows Me 4
Windows NT 3.51 3
Windows NT 4.0 4
Windows 2000 5
Windows XP 5
Windows .NET Server 5

dwMinorVersion
Identifies the minor version number of the operating system as follows.
Operating System Value
Windows 95 0
Windows 98 10
Windows Me 90
Windows NT 3.51 51
Windows NT 4.0 0
Windows 2000 0
Windows XP 1
Windows .NET Server 1

dwBuildNumber
Windows NT/2000/XP: Identifies the build number of the operating system.

Windows 95/98/Me: Identifies the build number of the operating system in the low-order word. The high-order word contains the major and minor version numbers.

dwPlatformId
Identifies the operating system platform. This member can be one of the following values.
Value Platform
VER_PLATFORM_WIN32s Win32s on Windows 3.1.
VER_PLATFORM_WIN32_WINDOWS Windows 95, Windows 98, or Windows Me.
VER_PLATFORM_WIN32_NT Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows XP, or Windows .NET Server.

szCSDVersion
Windows NT/2000/XP: Contains a null-terminated string, such as "Service Pack 3", that indicates the latest Service Pack installed on the system. If no Service Pack has been installed, the string is empty.

Windows 95/98/Me: Contains a null-terminated string that indicates additional version information. For example, " C" indicates Windows 95 OSR2 and " A" indicates Windows 98 Second Edition.

Remarks

Relying on version information is not the best way to test for a feature. Instead, refer to the documentation for the feature of interest. For more information on common techniques for feature detection, see Operating System Version.

If you must require a particular operating system, be sure to use it as a minimum supported version, rather than design the test for the one operating system. This way, your detection code will continue to work on future versions of Windows.

Requirements

  Windows NT/2000/XP: Included in Windows NT 3.5 and later.
  Windows 95/98/Me: Included in Windows 95 and later.
  Header: Declared in Winnt.h; include Windows.h.
  Unicode: Declared as Unicode and ANSI structures.

See Also

System Information Overview, System Information Structures, GetVersionEx, OSVERSIONINFOEX

Platform SDK Release: November 2001
What did you think of this topic?
Let us know.
Order a Platform SDK CD Online
(U.S/Canada)   (International)

 

 Contact Us   |  E-Mail this Page   |  MSDN Flash Newsletter
 © 2002 Microsoft Corporation. All rights reserved.   Terms of Use  Privacy Statement   Accessibility