diff --git a/agent/windows-setup-agent/app.manifest b/agent/windows-setup-agent/app.manifest index ff3d8ae62..b301731d1 100644 --- a/agent/windows-setup-agent/app.manifest +++ b/agent/windows-setup-agent/app.manifest @@ -25,18 +25,12 @@ - - - - - - - - - - - - + + + + + + diff --git a/icinga-app/CMakeLists.txt b/icinga-app/CMakeLists.txt index 01b4efc67..e9a5919db 100644 --- a/icinga-app/CMakeLists.txt +++ b/icinga-app/CMakeLists.txt @@ -2,6 +2,7 @@ if(MSVC) set(WindowsSources icinga.rc) + list(APPEND icinga_app_SOURCES app.manifest) else() set(WindowsSources "") endif() diff --git a/icinga-app/app.manifest b/icinga-app/app.manifest new file mode 100644 index 000000000..1412c8e13 --- /dev/null +++ b/icinga-app/app.manifest @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index df1dae063..f56d5017b 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -1631,21 +1631,39 @@ static bool ReleaseHelper(String *platformName, String *platformVersion) *platformName = "Windows"; if (platformVersion) { - *platformVersion = "Vista"; - if (IsWindowsVistaSP1OrGreater()) - *platformVersion = "Vista SP1"; - if (IsWindowsVistaSP2OrGreater()) - *platformVersion = "Vista SP2"; - if (IsWindows7OrGreater()) - *platformVersion = "7"; - if (IsWindows7SP1OrGreater()) - *platformVersion = "7 SP1"; - if (IsWindows8OrGreater()) - *platformVersion = "8"; - if (IsWindows8Point1OrGreater()) - *platformVersion = "8.1 or greater"; - if (IsWindowsServer()) - *platformVersion += " (Server)"; + // https://stackoverflow.com/questions/53393150/c-how-to-detect-windows-server-2019 + // https://techthoughts.info/windows-version-numbers/ + if (IsWindowsServer()) { + // 2019 Server + + if (IsWindowsVersionOrGreater(10, 0, 1803)) { + *platformVersion = "Server 2019 or greater"; + // 2016 Server + } else if (IsWindowsVersionOrGreater(10, 0, 1607)) { + *platformVersion = "Server 2016"; + // 2012 R2 + } else if (IsWindowsVersionOrGreater(6, 3, 0)) { + *platformVersion = "Server 2012 R2"; + // 2012 + } else if (IsWindowsVersionOrGreater(6, 2, 0)) { + *platformVersion = "Server 2012"; + } else { + *platformVersion = "Server 2008"; + } + + } else { + if (IsWindows10OrGreater()) + *platformVersion = "10 or greater"; + else if (IsWindows8Point1OrGreater()) + *platformVersion = "8.1"; + else if (IsWindows8OrGreater()) + *platformVersion = "8"; + else if (IsWindows7SP1OrGreater()) + *platformVersion = "7 SP1"; + else if (IsWindows7OrGreater()) + *platformVersion = "7"; + else + *platformVersion = "Vista"; + } } return true;