BugTrap
BugTrap copied to clipboard
Windows version detect issue
CSymEngine::GetOsInfo(COsInfo& rOsInfo) uses deprecated GetVersionEx API. Applications not manifested for Windows 8.1 or Windows 10 will return the Windows 8 OS version value (6.2).
We need to find out better way to get windows version, including real major/minor versions, product type, etc.
For a workaround, I just take kernel32.dll version: https://github.com/GoldRenard/BugTrap/commit/ab264288d75990f6f9407ef371187ee919970eee In this way we don't know the real product type, so we can't detect is it server OS or client.
Yeah, this is an interesting issue ... I don't know if this helps any:
http://stackoverflow.com/questions/9817160/getversionex-under-windows-8
http://stackoverflow.com/questions/27246562/how-to-get-the-os-version-in-win8-1-as-getversion-getversionex-are-deprecated
Perhaps, GetProductInfo to help find if server or client OS.
There are a bunch of new macros from MSDN that are preferable way to get version information in new SDK: https://msdn.microsoft.com/en-us/library/windows/desktop/dn424972(v=vs.85).aspx
Some of this new macros has issues. New macros, immediately new bugs :| To get IsWindows8Point1OrGreater() or IsWindows10OrGreater() working the module needs a manifest included. Btw: I have installed SDK 8.1 but IsWindows10OrGreater() is not included in my VersionHelpers.h.
As mentioned by Ehsan A Samani in an article on CodeProject (http://www.codeproject.com/Articles/678606/Part1-Overcoming-Windows-8-1s-deprecation-of-GetVe#Update) the old but not deprecated function NetWkstaGetInfo() can also be used to get major and minor version. I'm not sure how to distinguish then between workstation and server.
working the module needs a manifest included.
Of course, it is by design and not a bug. Windows 10 compatible applications must include the manifest so the OS can differentiate the compatibility behavior. If an app doesn't have the manifest, it shouldn't know anything about new OS.
SDK 8.1 but IsWindows10OrGreater()
Because you need SDK 10 for this to be available.
I've also made a Win-version (+ServPack+build-number) retriever where I compare the OSVERSIONINFOEXW structures obtained from GetVersionEx(), RtlGetVersion() and NetWkstaGetInfo(). It is here.
@gvanem could you clarify the licence for win_ver.c?
@bchavez I've not thought of it, but a MIT License is fine.
For people who search how to setup a manifest, just add this file in the project who use BugTrap.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
name="YOURAPPNAME"
version="1.0.0.0"
type="win32" />
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 & 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</assembly>