0

I'm trying to use VersionHelper API's (https://learn.microsoft.com/en-us/windows/desktop/SysInfo/version-helper-apis) in a CustomAction defined in a dll. My bootstrapper as well as the dll has manifest with supportedOs guid for Windows 10 as well as Windows 8.1

While invoking the installer on windows 2016 server, the version helper function IsWindows10OrGreater() is returning false and IsWindows8Point1OrGreater() is returning true.

This is causing the custom action to detect the OS as windows 2012R2 server. How do I detect Windows 2016 / Windows 10 from within a Custom Action inside a dll.

NB: GetVersionEx() is not an option as I'm trying to migrate from it since MSFT may remove support for the API without notice. (https://learn.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getversionexa)

  • [Maybe check this answer](https://stackoverflow.com/questions/49335885/windows-10-not-detecting-on-installshield/49343826#49343826). Not an exact science it seems. – Stein Åsmul Feb 12 '19 at 03:56
  • @SteinÅsmul Thanks. I also found that msiexec.exe manifest doesn't have compatibility for windows 10. – Thouseef Hameed Feb 12 '19 at 13:55
  • I think [**Advanced Installer**](https://www.advancedinstaller.com/) does something clever here and gets the real OS version for use inside the MSI. Haven't tried it much, might be worth your while. Hard to re-make everything yourself and deal with all the potential bugs and test cases. [Other tools could have similar constructs](https://stackoverflow.com/a/50229840/129130) - I am not sure. Hope Bogdan Mitrache of Advanced Installer can confirm. – Stein Åsmul Feb 12 '19 at 14:27
  • Unfortunately I'll not be able to move to Advanced Installer. This is an enterprise product and is currently using wix. I'm planning to use the WindowsBuild msi property to detect the windows version paired with IsWindowsServer() call to distinguish between server v/s desktop. – Thouseef Hameed Feb 12 '19 at 16:04
  • Sounds good. Did you raid [github.com](https://github.com/search?l=C%2B%2B&q=IsWindowsServer&type=Code) looking for similar constructs? I find it very helpful every now and then. And blogs - I am sure someone has something made and tested (so you get their development AND QA along). – Stein Åsmul Feb 12 '19 at 17:26

0 Answers0