[cmake-developers] [PATCH] [CMake 0015674]: Windows: Correctly determine Windows version

Gilles Khouzam Gilles.Khouzam at microsoft.com
Thu Sep 10 19:24:37 EDT 2015


This patch fixes the issue where on Windows 8 and above, by default the system version returned is always Windows 8.

More info on this can be found on http://blogs.msdn.com/b/cjacks/archive/2009/03/27/manifesting-for-compatibility-on-windows-7.aspx

In order for GetVersionEx to work properly, a manifest must be embedded in the exe telling it to ignore the new behavior and give the proper version.

This patch adds support to specify manifests and teaches CMake how to embed them using Visual Studio.
This patch adds a simple version manifest Source\cmake.version.manifest to the CMake executables.
This removes the use of RtlGetVersion and properly uses GetVersionEx which will now return the proper operating system version for all operating systems until Windows 10.
This patch also fixes a potential buffer overrun and improper call of GetVersionEx in SystemTools.cxx where GetVersionExW is called with a OSVERSIONINFOEXA struct causing a failure since the size is improper for the API. Fixing this, GetVersionEx should never fail anymore.
Update the OSVersionAndName for new versions of Windows released after Windows 7.

This change will require a double compile of CMake (I'm not sure if this is what the dashboards are doing) to have the functionality enabled, since the first step will build a new CMake that will know how to embed a manifest. The second compile with the version of CMake that knows how to embed a manifest, will then embed the manifest in CMake enabling this feature.

Thanks

~Gilles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150910/a5ada4e0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Issue15674.patch
Type: application/octet-stream
Size: 15614 bytes
Desc: Issue15674.patch
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150910/a5ada4e0/attachment-0001.obj>


More information about the cmake-developers mailing list