Operating System Version
The Version API Helper functions are used to determine the version of the operating system that is currently running. For more information, see Getting the System Version.
The following table summarizes the most recent operating system version numbers.
Operating system | Version number |
---|---|
Windows 10 | 10.0* |
Windows Server 2019 | 10.0* |
Windows Server 2016 | 10.0* |
Windows 8.1 | 6.3* |
Windows Server 2012 R2 | 6.3* |
Windows 8 | 6.2 |
Windows Server 2012 | 6.2 |
Windows 7 | 6.1 |
Windows Server 2008 R2 | 6.1 |
Windows Server 2008 | 6.0 |
Windows Vista | 6.0 |
Windows Server 2003 R2 | 5.2 |
Windows Server 2003 | 5.2 |
Windows XP 64-Bit Edition | 5.2 |
Windows XP | 5.1 |
Windows 2000 | 5.0 |
* For applications that have been manifested for Windows 8.1 or Windows 10. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2). To manifest your applications for Windows 8.1 or Windows 10, refer to Targeting your application for Windows.
Identifying the current operating system is usually not the best way to determine whether a particular operating system feature is present. This is because the operating system may have had new features added in a redistributable DLL. Rather than using the Version API Helper functions to determine the operating system platform or version number, test for the presence of the feature itself.
To determine the best way to test for a feature, refer to the documentation for the feature of interest. The following list discusses some common techniques for feature detection:
- You can test for the presence of the functions associated with a feature. To test for the presence of a function in a system DLL, call the LoadLibrary function to load the DLL. Then call the GetProcAddress function to determine whether the function of interest is present in the DLL. Use the pointer returned by GetProcAddress to call the function. Note that even if the function is present, it may be a stub that just returns an error code such as ERROR_CALL_NOT_IMPLEMENTED.
- You can determine the presence of some features by using the GetSystemMetrics function. For example, you can detect multiple display monitors by calling GetSystemMetrics(SM_CMONITORS).
- There are several versions of the redistributable DLLs that implement shell and common control features. For information about determining which versions are present on the system your application is running on, see the topic Shell and Common Controls Versions.
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.
Note that a 32-bit application can detect whether it is running under WOW64 by calling the IsWow64Process function. It can obtain additional processor information by calling the GetNativeSystemInfo function.
OSVERSIONINFOEXA structure (winnt.h)
Contains operating system version information. The information includes major and minor version numbers, a build number, a platform identifier, and information about product suites and the latest Service Pack installed on the system. This structure is used with the GetVersionEx and VerifyVersionInfo functions.
Syntax
Members
The size of this data structure, in bytes. Set this member to sizeof(OSVERSIONINFOEX) .
The major version number of the operating system. For more information, see Remarks.
The minor version number of the operating system. For more information, see Remarks.
The build number of the operating system.
The operating system platform. This member can be VER_PLATFORM_WIN32_NT (2).
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.
The major version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the major version number is 3. If no Service Pack has been installed, the value is zero.
The minor version number of the latest Service Pack installed on the system. For example, for Service Pack 3, the minor version number is 0.
A bit mask that identifies the product suites available on the system. This member can be a combination of the following values.
Value | Meaning |
---|---|
VER_SUITE_BACKOFFICE 0x00000004 | Microsoft BackOffice components are installed. |
VER_SUITE_BLADE 0x00000400 | Windows ServerВ 2003, Web Edition is installed. |
VER_SUITE_COMPUTE_SERVER 0x00004000 | Windows ServerВ 2003, Compute Cluster Edition is installed. |
VER_SUITE_DATACENTER 0x00000080 | Windows ServerВ 2008 Datacenter, Windows ServerВ 2003, Datacenter Edition, or WindowsВ 2000 Datacenter Server is installed. |
VER_SUITE_ENTERPRISE 0x00000002 | Windows ServerВ 2008 Enterprise, Windows ServerВ 2003, Enterprise Edition, or WindowsВ 2000 Advanced Server is installed. Refer to the Remarks section for more information about this bit flag. |
VER_SUITE_EMBEDDEDNT 0x00000040 | WindowsВ XP Embedded is installed. |
VER_SUITE_PERSONAL 0x00000200 | WindowsВ Vista Home Premium, WindowsВ Vista Home Basic, or WindowsВ XP Home Edition is installed. |
VER_SUITE_SINGLEUSERTS 0x00000100 | Remote Desktop is supported, but only one interactive session is supported. This value is set unless the system is running in application server mode. |
VER_SUITE_SMALLBUSINESS 0x00000001 | Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows. Refer to the Remarks section for more information about this bit flag. |
VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020 | Microsoft Small Business Server is installed with the restrictive client license in force. Refer to the Remarks section for more information about this bit flag. |
VER_SUITE_STORAGE_SERVER 0x00002000 | Windows Storage ServerВ 2003В R2 or Windows Storage ServerВ 2003is installed. |
VER_SUITE_TERMINAL 0x00000010 | Terminal Services is installed. This value is always set. If VER_SUITE_TERMINAL is set but VER_SUITE_SINGLEUSERTS is not set, the system is running in application server mode. |
VER_SUITE_WH_SERVER 0x00008000 | Windows Home Server is installed. |
VER_SUITE_MULTIUSERTS 0x00020000 | AppServer mode is enabled. |
Any additional information about the system. This member can be one of the following values.
Value | Meaning |
---|---|
VER_NT_DOMAIN_CONTROLLER 0x0000002 | The system is a domain controller and the operating system is Windows ServerВ 2012 , Windows ServerВ 2008В R2, Windows ServerВ 2008, Windows ServerВ 2003, or WindowsВ 2000 Server. |
VER_NT_SERVER 0x0000003 | The operating system is Windows ServerВ 2012, Windows ServerВ 2008В R2, Windows ServerВ 2008, Windows ServerВ 2003, or WindowsВ 2000 Server. Note that a server that is also a domain controller is reported as VER_NT_DOMAIN_CONTROLLER, not VER_NT_SERVER. |
VER_NT_WORKSTATION 0x0000001 | The operating system is WindowsВ 8, WindowsВ 7, WindowsВ Vista, WindowsВ XP Professional, WindowsВ XP Home Edition, or WindowsВ 2000 Professional. |
Reserved for future use.
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.
The following table summarizes the values returned by supported versions of Windows. Use the information in the column labeled «Other» to distinguish between operating systems with identical version numbers.
Operating system | Version number | dwMajorVersion | dwMinorVersion | Other |
---|---|---|---|---|
WindowsВ 10 | 10.0* | 10 | 0 | OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows ServerВ 2016 | 10.0* | 10 | 0 | OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
WindowsВ 8.1 | 6.3* | 6 | 3 | OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows ServerВ 2012В R2 | 6.3* | 6 | 3 | OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
WindowsВ 8 | 6.2 | 6 | 2 | OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows ServerВ 2012 | 6.2 | 6 | 2 | OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
WindowsВ 7 | 6.1 | 6 | 1 | OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows ServerВ 2008В R2 | 6.1 | 6 | 1 | OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
Windows ServerВ 2008 | 6.0 | 6 | 0 | OSVERSIONINFOEX.wProductType != VER_NT_WORKSTATION |
WindowsВ Vista | 6.0 | 6 | 0 | OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION |
Windows ServerВ 2003В R2 | 5.2 | 5 | 2 | GetSystemMetrics(SM_SERVERR2) != 0 |
Windows Home Server | 5.2 | 5 | 2 | OSVERSIONINFOEX.wSuiteMask & VER_SUITE_WH_SERVER |
Windows ServerВ 2003 | 5.2 | 5 | 2 | GetSystemMetrics(SM_SERVERR2) == 0 |
WindowsВ XP Professional x64 Edition | 5.2 | 5 | 2 | (OSVERSIONINFOEX.wProductType == VER_NT_WORKSTATION) && (SYSTEM_INFO.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) |
WindowsВ XP | 5.1 | 5 | 1 | Not applicable |
WindowsВ 2000 | 5.0 | 5 | 0 | Not applicable |
* For applications that have been manifested for WindowsВ 8.1 or WindowsВ 10. Applications not manifested for WindowsВ 8.1 or WindowsВ 10 will return the WindowsВ 8 OS version value (6.2). To manifest your applications for WindowsВ 8.1 or WindowsВ 10, refer to Targeting your application for Windows. |
В
You should not rely upon only the VER_SUITE_SMALLBUSINESS flag to determine whether Small Business Server has been installed on the system, as both this flag and the VER_SUITE_SMALLBUSINESS_RESTRICTED flag are set when this product suite is installed. If you upgrade this installation to Windows Server, Standard Edition, the VER_SUITE_SMALLBUSINESS_RESTRICTED flag will be cleared—however, the VER_SUITE_SMALLBUSINESS flag will remain set. In this case, this indicates that Small Business Server was once installed on this system. If this installation is further upgraded to Windows Server, Enterprise Edition, the VER_SUITE_SMALLBUSINESS flag will remain set.
If compatibility mode is in effect, the OSVERSIONINFOEX structure contains information about the operating system that is selected for application compatibility.
To determine whether a Win32-based application is running on WOW64, call the IsWow64Process function. To determine whether the system is running a 64-bit version of Windows, call the GetNativeSystemInfo function.
The GetSystemMetrics function provides the following additional information about the current operating system.
Product | Setting |
---|---|
Windows ServerВ 2003В R2 | SM_SERVERR2 |
Windows XP Media Center Edition | SM_MEDIACENTER |
WindowsВ XP Starter Edition | SM_STARTER |
WindowsВ XP Tablet PC Edition | SM_TABLETPC |
В
Examples
The winnt.h header defines OSVERSIONINFOEX as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
VERSIONINFO resource
Defines a version-information resource. The resource contains such information about the file as its version number, its intended operating system, and its original filename. The resource is intended to be used with the Version Information functions.
There are two ways to format a VERSIONINFO statement:
Parameters
Version-information resource identifier. This value must be 1.
Version information, such as the file version and the intended operating system. This parameter consists of the following statements.
Statement | Description |
---|---|
FILEVERSION version | Binary version number for the file. The version consists of two 32-bit integers, defined by four 16-bit integers. For example, «FILEVERSION 3,10,0,61» is translated into two doublewords: 0x0003000a and 0x0000003d, in that order. Therefore, if version is defined by the DWORD values dw1 and dw2, they need to appear in the FILEVERSION statement as follows: HIWORD(dw1) , LOWORD(dw1) , HIWORD(dw2) , LOWORD(dw2) . |
PRODUCTVERSION version | Binary version number for the product with which the file is distributed. The version parameter is two 32-bit integers, defined by four 16-bit integers. For more information about version, see the FILEVERSION description. |
FILEFLAGSMASK fileflagsmask | Indicates which bits in the FILEFLAGS statement are valid. For 16-bit Windows, this value is 0x3f. |
FILEFLAGS fileflags | Attributes of the file. |
FILEOS fileos | Operating system for which this file was designed. The fileos parameter can be one of the operating system values given in the Remarks section. |
FILETYPE filetype | General type of file. The filetype parameter can be one of the file type values listed in the Remarks section. |
FILESUBTYPE subtype | Function of the file. The subtype parameter is zero unless the filetype parameter in the FILETYPE statement is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file subtype values, see the Remarks section. |
Specifies one or more version-information blocks. A block can contain string information or variable information. For more information, see StringFileInfo Block or VarFileInfo Block.
Remarks
To use the constants specified with the VERSIONINFO statement, you must include the Winver.h or Windows.h header file in the resource-definition file.
The following list describes the parameters used in the VERSIONINFO statement:
A combination of the following values.
Value | Description |
---|---|
VS_FF_DEBUG | File contains debugging information or is compiled with debugging features enabled. |
VS_FF_PATCHED | File has been modified and is not identical to the original shipping file of the same version number. |
VS_FF_PRERELEASE | File is a development version, not a commercially released product. |
VS_FF_PRIVATEBUILD | File was not built using standard release procedures. If this value is given, the StringFileInfo block must contain a PrivateBuild string. |
VS_FF_SPECIALBUILD | File was built by the original company using standard release procedures but is a variation of the standard file of the same version number. If this value is given, the StringFileInfo block block must contain a SpecialBuild string. |
VS_FFI_FILEFLAGSMASK | A combination of all the preceding values. |
One of the following values.
Value | Description |
---|---|
VOS_UNKNOWN | The operating system for which the file was designed is unknown. |
VOS_DOS | File was designed for MS-DOS. |
VOS_NT | File was designed for 32-bit Windows. |
VOS__WINDOWS16 | File was designed for 16-bit Windows. |
VOS__WINDOWS32 | File was designed for 32-bit Windows. |
VOS_DOS_WINDOWS16 | File was designed for 16-bit Windows running with MS-DOS. |
VOS_DOS_WINDOWS32 | File was designed for 32-bit Windows running with MS-DOS. |
VOS_NT_WINDOWS32 | File was designed for 32-bit Windows. |
The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved.
One of the following values.
Value | Description |
---|---|
VFT_UNKNOWN | File type is unknown. |
VFT_APP | File contains an application. |
VFT_DLL | File contains a dynamic-link library (DLL). |
VFT_DRV | File contains a device driver. If filetype is VFT_DRV, subtype contains a more specific description of the driver. |
VFT_FONT | File contains a font. If filetype is VFT_FONT, subtype contains a more specific description of the font. |
VFT_VXD | File contains a virtual device. |
VFT_STATIC_LIB | File contains a static-link library. |
All other values are reserved for use by Microsoft.
Additional information about the file type.
If filetype specifies VFT_DRV, this parameter can be one of the following values.
Value | Description |
---|---|
VFT2_UNKNOWN | Driver type is unknown. |
VFT2_DRV_COMM | File contains a communications driver. |
VFT2_DRV_PRINTER | File contains a printer driver. |
VFT2_DRV_KEYBOARD | File contains a keyboard driver. |
VFT2_DRV_LANGUAGE | File contains a language driver. |
VFT2_DRV_DISPLAY | File contains a display driver. |
VFT2_DRV_MOUSE | File contains a mouse driver. |
VFT2_DRV_NETWORK | File contains a network driver. |
VFT2_DRV_SYSTEM | File contains a system driver. |
VFT2_DRV_INSTALLABLE | File contains an installable driver. |
VFT2_DRV_SOUND | File contains a sound driver. |
VFT2_DRV_VERSIONED_PRINTER | File contains a versioned printer driver. |
If filetype specifies VFT_FONT, this parameter can be one of the following values.
Value | Description |
---|---|
VFT2_UNKNOWN | Font type is unknown. |
VFT2_FONT_RASTER | File contains a raster font. |
VFT2_FONT_VECTOR | File contains a vector font. |
VFT2_FONT_TRUETYPE | File contains a TrueType font. |
If filetype specifies VFT_VXD, this parameter must be the virtual-device identifier included in the virtual-device control block.
All subtype values not listed here are reserved for use by Microsoft.
One of the following language codes.
Code | Language | Code | Language |
---|---|---|---|
0x0401 | Arabic | 0x0415 | Polish |
0x0402 | Bulgarian | 0x0416 | Portuguese (Brazil) |
0x0403 | Catalan | 0x0417 | Rhaeto-Romanic |
0x0404 | Traditional Chinese | 0x0418 | Romanian |
0x0405 | Czech | 0x0419 | Russian |
0x0406 | Danish | 0x041A | Croato-Serbian (Latin) |
0x0407 | German | 0x041B | Slovak |
0x0408 | Greek | 0x041C | Albanian |
0x0409 | U.S. English | 0x041D | Swedish |
0x040A | Castilian Spanish | 0x041E | Thai |
0x040B | Finnish | 0x041F | Turkish |
0x040C | French | 0x0420 | Urdu |
0x040D | Hebrew | 0x0421 | Bahasa |
0x040E | Hungarian | 0x0804 | Simplified Chinese |
0x040F | Icelandic | 0x0807 | Swiss German |
0x0410 | Italian | 0x0809 | U.K. English |
0x0411 | Japanese | 0x080A | Spanish (Mexico) |
0x0412 | Korean | 0x080C | Belgian French |
0x0413 | Dutch | 0x0C0C | Canadian French |
0x0414 | Norwegian ? Bokmal | 0x100C | Swiss French |
0x0810 | Swiss Italian | 0x0816 | Portuguese (Portugal) |
0x0813 | Belgian Dutch | 0x081A | Serbo-Croatian (Cyrillic) |
0x0814 | Norwegian ? Nynorsk |
One of the following character-set identifiers.
Decimal | Hexadecimal | Character Set |
---|---|---|
0 | 0000 | 7-bit ASCII |
932 | 03A4 | Japan (Shift ? JIS X-0208) |
949 | 03B5 | Korea (Shift ? KSC 5601) |
950 | 03B6 | Taiwan (Big5) |
1200 | 04B0 | Unicode |
1250 | 04E2 | Latin-2 (Eastern European) |
1251 | 04E3 | Cyrillic |
1252 | 04E4 | Multilingual |
1253 | 04E5 | Greek |
1254 | 04E6 | Turkish |
1255 | 04E7 | Hebrew |
1256 | 04E8 | Arabic |
One of the following predefined names.
Name | Description |
---|---|
Comments | Additional information that should be displayed for diagnostic purposes. |
CompanyName | Company that produced the file?for example, «Microsoft Corporation» or «Standard Microsystems Corporation, Inc.» This string is required. |
FileDescription | File description to be presented to users. This string may be displayed in a list box when the user is choosing files to install?for example, «Keyboard Driver for AT-Style Keyboards». This string is required. |
FileVersion | Version number of the file?for example, «3.10» or «5.00.RC2». This string is required. |
InternalName | Internal name of the file, if one exists?for example, a module name if the file is a dynamic-link library. If the file has no internal name, this string should be the original filename, without extension. This string is required. |
LegalCopyright | Copyright notices that apply to the file. This should include the full text of all notices, legal symbols, copyright dates, and so on. This string is optional. |
LegalTrademarks | Trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional. |
OriginalFilename | Original name of the file, not including a path. This information enables an application to determine whether a file has been renamed by a user. The format of the name depends on the file system for which the file was created. This string is required. |
PrivateBuild | Information about a private version of the file?for example, «Built by TESTER1 on \TESTBED». This string should be present only if VS_FF_PRIVATEBUILD is specified in the fileflags parameter of the root block. |
ProductName | Name of the product with which the file is distributed. This string is required. |
ProductVersion | Version of the product with which the file is distributed?for example, «3.10» or «5.00.RC2». This string is required. |
SpecialBuild | Text that indicates how this version of the file differs from the standard version?for example, «Private build for TESTER1 solving mouse problems on M250 and M250E computers». This string should be present only if VS_FF_SPECIALBUILD is specified in the fileflags parameter of the root block. |
Certain attributes are also supported for backward compatibility. For more information, see Common Resource Attributes.
Examples
The following example defines a VERSIONINFO resource: