I have scenarios where i want to specifically know the OS major/minor version and build number etc.
From windows 8.1 onwards GetVersion
and GetVersionEx
have been deprecated, stating:
[GetVersion/GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions]
None of the version helper APIs help me get the OS version number rather help me verify or get to know if my version is same or above some mentioned version. What can be done?
There is a new function named GetProductInfo that returns version infos.
If you want to test for a specific version you should use even VerifyVersionInfo
It is easy to create a structure to check whether a specific OS version is running. VerifyVersionInfo takes to version structures and you can easily check for VER_GREATER_EQUAL and VER_LESS_EQUAL
Also note that GetVersionEx doesn't lie on a Windows 8.1 system if you define the correct supported OS entry in the compatibility section for your manifest. But it may lie in a future OS version!
See Targeting your application For Windows 8.1 for a list of GUIDs. Also covered here.
GUID list for the application manifest
{e2011457-1546-43c5-a5fe-008deee3d3f0}
{35138b9a-5d96-4fbd-8e2d-a2440225f93a}
{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}
{1f676c76-80e1-4239-95bb-83d0f6d0da78}
{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}