C++ How to detect Windows Server 2019?











up vote
6
down vote

favorite












Microsoft released Windows Server 2019 on October 2, 2018. From Windows 2000 and up until this Windows version, you could call a WinAPI function GetVersionEx with a struct OSVERSIONINFOEX and depending on the variables of dwMajorVersion, dwMinorVersion and wProductType determine Windows version, for example, Windows 8.1, Windows 10, Windows Server 2012 R2. The code everyone used was something like this:



OSVERSIONINFOEX osvi;
SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx(&osvi)) {
if (osvi.dwMajorVersion == 10 &&
osvi.dwMinorVersion == 0 &&
osvi.wProductType != VER_NT_WORKSTATION) {
Console->Log("We are running on Windows Server 2016");
}
}


Judging from Wikipedia the Windows Server 2019 has the same version number of NT 10.0 as Server 2016. So the above code does not work anymore.



Also, Microsoft Docs contains the following note: GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions.



Unfortunately, the Version Helper functions does not have a function to detect Server 2019. Also, the strange thing is that Docs page about Targeting stops at the Windows 10, and does not talk about Server editions, while these Targeting manifests is mandatory for detecting OS above Windows 8.1 or Server 2012.



Update 1.
As @IInspectable and @RbMm commented about usage of RtlGetVersion function. So I ran the following code (taken from this answer):



typedef LONG NTSTATUS, *PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)

typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);

RTL_OSVERSIONINFOW GetRealOSVersion() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
if (hMod) {
RtlGetVersionPtr fxPtr = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
if (fxPtr != nullptr) {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof(rovi);
if ( STATUS_SUCCESS == fxPtr(&rovi) ) {
return rovi;
}
}
}
RTL_OSVERSIONINFOW rovi = { 0 };
return rovi;
}


And here are the results for Windows 10:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17134

  • dwPlatformId = 2


Windows Server 2019:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17763

  • dwPlatformId = 2


Update2. As requested, posting full info from OSVERSIONINFOEX struct that was obtained via GetVersionEx call with a manifest file containing all the Targets till Windows 10 (see the Targeting link above):



// Windows 10
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17134
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 256 // 0x100
osvi.wProductType = 1
osvi.wReserved = 0

// Windows Server 2016
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 14393
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400
osvi.wProductType = 3
osvi.wReserved = 0

// Windows Server 2019
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17763
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400 // 0x190
osvi.wProductType = 3
osvi.wReserved = 0


Update 3. Calling RtlGetVersion with a struct RTL_OSVERSIONINFOEXW we get exactly the same result as in Update 2.










share|improve this question
























  • Windows Server 2019 version info
    – VTT
    Nov 20 at 12:54








  • 1




    What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
    – IInspectable
    Nov 20 at 12:57






  • 1




    It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
    – Matteo Italia
    Nov 20 at 14:00






  • 1




    @MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
    – Maris B.
    Nov 20 at 14:13






  • 3




    You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
    – IInspectable
    Nov 20 at 17:06















up vote
6
down vote

favorite












Microsoft released Windows Server 2019 on October 2, 2018. From Windows 2000 and up until this Windows version, you could call a WinAPI function GetVersionEx with a struct OSVERSIONINFOEX and depending on the variables of dwMajorVersion, dwMinorVersion and wProductType determine Windows version, for example, Windows 8.1, Windows 10, Windows Server 2012 R2. The code everyone used was something like this:



OSVERSIONINFOEX osvi;
SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx(&osvi)) {
if (osvi.dwMajorVersion == 10 &&
osvi.dwMinorVersion == 0 &&
osvi.wProductType != VER_NT_WORKSTATION) {
Console->Log("We are running on Windows Server 2016");
}
}


Judging from Wikipedia the Windows Server 2019 has the same version number of NT 10.0 as Server 2016. So the above code does not work anymore.



Also, Microsoft Docs contains the following note: GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions.



Unfortunately, the Version Helper functions does not have a function to detect Server 2019. Also, the strange thing is that Docs page about Targeting stops at the Windows 10, and does not talk about Server editions, while these Targeting manifests is mandatory for detecting OS above Windows 8.1 or Server 2012.



Update 1.
As @IInspectable and @RbMm commented about usage of RtlGetVersion function. So I ran the following code (taken from this answer):



typedef LONG NTSTATUS, *PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)

typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);

RTL_OSVERSIONINFOW GetRealOSVersion() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
if (hMod) {
RtlGetVersionPtr fxPtr = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
if (fxPtr != nullptr) {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof(rovi);
if ( STATUS_SUCCESS == fxPtr(&rovi) ) {
return rovi;
}
}
}
RTL_OSVERSIONINFOW rovi = { 0 };
return rovi;
}


And here are the results for Windows 10:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17134

  • dwPlatformId = 2


Windows Server 2019:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17763

  • dwPlatformId = 2


Update2. As requested, posting full info from OSVERSIONINFOEX struct that was obtained via GetVersionEx call with a manifest file containing all the Targets till Windows 10 (see the Targeting link above):



// Windows 10
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17134
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 256 // 0x100
osvi.wProductType = 1
osvi.wReserved = 0

// Windows Server 2016
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 14393
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400
osvi.wProductType = 3
osvi.wReserved = 0

// Windows Server 2019
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17763
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400 // 0x190
osvi.wProductType = 3
osvi.wReserved = 0


Update 3. Calling RtlGetVersion with a struct RTL_OSVERSIONINFOEXW we get exactly the same result as in Update 2.










share|improve this question
























  • Windows Server 2019 version info
    – VTT
    Nov 20 at 12:54








  • 1




    What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
    – IInspectable
    Nov 20 at 12:57






  • 1




    It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
    – Matteo Italia
    Nov 20 at 14:00






  • 1




    @MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
    – Maris B.
    Nov 20 at 14:13






  • 3




    You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
    – IInspectable
    Nov 20 at 17:06













up vote
6
down vote

favorite









up vote
6
down vote

favorite











Microsoft released Windows Server 2019 on October 2, 2018. From Windows 2000 and up until this Windows version, you could call a WinAPI function GetVersionEx with a struct OSVERSIONINFOEX and depending on the variables of dwMajorVersion, dwMinorVersion and wProductType determine Windows version, for example, Windows 8.1, Windows 10, Windows Server 2012 R2. The code everyone used was something like this:



OSVERSIONINFOEX osvi;
SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx(&osvi)) {
if (osvi.dwMajorVersion == 10 &&
osvi.dwMinorVersion == 0 &&
osvi.wProductType != VER_NT_WORKSTATION) {
Console->Log("We are running on Windows Server 2016");
}
}


Judging from Wikipedia the Windows Server 2019 has the same version number of NT 10.0 as Server 2016. So the above code does not work anymore.



Also, Microsoft Docs contains the following note: GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions.



Unfortunately, the Version Helper functions does not have a function to detect Server 2019. Also, the strange thing is that Docs page about Targeting stops at the Windows 10, and does not talk about Server editions, while these Targeting manifests is mandatory for detecting OS above Windows 8.1 or Server 2012.



Update 1.
As @IInspectable and @RbMm commented about usage of RtlGetVersion function. So I ran the following code (taken from this answer):



typedef LONG NTSTATUS, *PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)

typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);

RTL_OSVERSIONINFOW GetRealOSVersion() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
if (hMod) {
RtlGetVersionPtr fxPtr = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
if (fxPtr != nullptr) {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof(rovi);
if ( STATUS_SUCCESS == fxPtr(&rovi) ) {
return rovi;
}
}
}
RTL_OSVERSIONINFOW rovi = { 0 };
return rovi;
}


And here are the results for Windows 10:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17134

  • dwPlatformId = 2


Windows Server 2019:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17763

  • dwPlatformId = 2


Update2. As requested, posting full info from OSVERSIONINFOEX struct that was obtained via GetVersionEx call with a manifest file containing all the Targets till Windows 10 (see the Targeting link above):



// Windows 10
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17134
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 256 // 0x100
osvi.wProductType = 1
osvi.wReserved = 0

// Windows Server 2016
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 14393
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400
osvi.wProductType = 3
osvi.wReserved = 0

// Windows Server 2019
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17763
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400 // 0x190
osvi.wProductType = 3
osvi.wReserved = 0


Update 3. Calling RtlGetVersion with a struct RTL_OSVERSIONINFOEXW we get exactly the same result as in Update 2.










share|improve this question















Microsoft released Windows Server 2019 on October 2, 2018. From Windows 2000 and up until this Windows version, you could call a WinAPI function GetVersionEx with a struct OSVERSIONINFOEX and depending on the variables of dwMajorVersion, dwMinorVersion and wProductType determine Windows version, for example, Windows 8.1, Windows 10, Windows Server 2012 R2. The code everyone used was something like this:



OSVERSIONINFOEX osvi;
SecureZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx(&osvi)) {
if (osvi.dwMajorVersion == 10 &&
osvi.dwMinorVersion == 0 &&
osvi.wProductType != VER_NT_WORKSTATION) {
Console->Log("We are running on Windows Server 2016");
}
}


Judging from Wikipedia the Windows Server 2019 has the same version number of NT 10.0 as Server 2016. So the above code does not work anymore.



Also, Microsoft Docs contains the following note: GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper functions.



Unfortunately, the Version Helper functions does not have a function to detect Server 2019. Also, the strange thing is that Docs page about Targeting stops at the Windows 10, and does not talk about Server editions, while these Targeting manifests is mandatory for detecting OS above Windows 8.1 or Server 2012.



Update 1.
As @IInspectable and @RbMm commented about usage of RtlGetVersion function. So I ran the following code (taken from this answer):



typedef LONG NTSTATUS, *PNTSTATUS;
#define STATUS_SUCCESS (0x00000000)

typedef NTSTATUS (WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);

RTL_OSVERSIONINFOW GetRealOSVersion() {
HMODULE hMod = ::GetModuleHandleW(L"ntdll.dll");
if (hMod) {
RtlGetVersionPtr fxPtr = (RtlGetVersionPtr)::GetProcAddress(hMod, "RtlGetVersion");
if (fxPtr != nullptr) {
RTL_OSVERSIONINFOW rovi = { 0 };
rovi.dwOSVersionInfoSize = sizeof(rovi);
if ( STATUS_SUCCESS == fxPtr(&rovi) ) {
return rovi;
}
}
}
RTL_OSVERSIONINFOW rovi = { 0 };
return rovi;
}


And here are the results for Windows 10:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17134

  • dwPlatformId = 2


Windows Server 2019:




  • dwMajorVersion = 10

  • dwMinorVersion = 0

  • dwBuildNumber = 17763

  • dwPlatformId = 2


Update2. As requested, posting full info from OSVERSIONINFOEX struct that was obtained via GetVersionEx call with a manifest file containing all the Targets till Windows 10 (see the Targeting link above):



// Windows 10
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17134
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 256 // 0x100
osvi.wProductType = 1
osvi.wReserved = 0

// Windows Server 2016
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 14393
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400
osvi.wProductType = 3
osvi.wReserved = 0

// Windows Server 2019
osvi.dwOSVersionInfoSize = 284
osvi.dwMajorVersion = 10
osvi.dwMinorVersion = 0
osvi.dwBuildNumber = 17763
osvi.dwPlatformId = 2
osvi.szCSDVersion =
osvi.wServicePackMinor = 0
osvi.wServicePackMinor = 0
osvi.wSuiteMask = 400 // 0x190
osvi.wProductType = 3
osvi.wReserved = 0


Update 3. Calling RtlGetVersion with a struct RTL_OSVERSIONINFOEXW we get exactly the same result as in Update 2.







c++ windows winapi






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 10:42

























asked Nov 20 at 12:37









Maris B.

1,54821522




1,54821522












  • Windows Server 2019 version info
    – VTT
    Nov 20 at 12:54








  • 1




    What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
    – IInspectable
    Nov 20 at 12:57






  • 1




    It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
    – Matteo Italia
    Nov 20 at 14:00






  • 1




    @MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
    – Maris B.
    Nov 20 at 14:13






  • 3




    You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
    – IInspectable
    Nov 20 at 17:06


















  • Windows Server 2019 version info
    – VTT
    Nov 20 at 12:54








  • 1




    What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
    – IInspectable
    Nov 20 at 12:57






  • 1




    It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
    – Matteo Italia
    Nov 20 at 14:00






  • 1




    @MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
    – Maris B.
    Nov 20 at 14:13






  • 3




    You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
    – IInspectable
    Nov 20 at 17:06
















Windows Server 2019 version info
– VTT
Nov 20 at 12:54






Windows Server 2019 version info
– VTT
Nov 20 at 12:54






1




1




What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
– IInspectable
Nov 20 at 12:57




What values do you get back when detecting Windows 10 version, passing a OSVERSIONINFOEX structure?
– IInspectable
Nov 20 at 12:57




1




1




It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
– Matteo Italia
Nov 20 at 14:00




It should be noted that in general you don't want to detect a version, but check to see if the actual functionality you need is available - e.g. if you need to use an API that is available only from some OS onwards use GetProcAddress to see if it's provided instead of testing for that Windows version.
– Matteo Italia
Nov 20 at 14:00




1




1




@MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
– Maris B.
Nov 20 at 14:13




@MatteoItalia, where did I write that I need to detect "actual functionality"? There are numerous reasons why one would want to detect OS version, including pre-filled form bug / crash reports. And no, this is not the reason I asked the question.
– Maris B.
Nov 20 at 14:13




3




3




You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
– IInspectable
Nov 20 at 17:06




You only posted results from OSVERSIONINFO. Pass a properly initialized OSVERSIONINFOEX instead. That structure has additional members, that may hold the information you are looking for. Matteo raises a valid point too: If you plan to make runtime decisions of your code based on the OS version it's running on, you would be better off, testing for features instead. If, on the other hand, you need this information for e.g. diagnostic purposes, there's nothing wrong with this.
– IInspectable
Nov 20 at 17:06












1 Answer
1






active

oldest

votes

















up vote
0
down vote













It's the same story for each new Windows version. And again with Windows 2019



You should use VerifyVersionInfoW ... BUT also update your program manifest.



The questions is : What is the manifest for the new Windows version ...



Windows 2016 was linked with Windows 10 with id :






see here : https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests






share|improve this answer





















  • I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
    – Maris B.
    Dec 8 at 10:56










  • Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
    – Herve K.
    Dec 11 at 9:19












  • I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
    – Maris B.
    Dec 11 at 14:23











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393150%2fc-how-to-detect-windows-server-2019%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













It's the same story for each new Windows version. And again with Windows 2019



You should use VerifyVersionInfoW ... BUT also update your program manifest.



The questions is : What is the manifest for the new Windows version ...



Windows 2016 was linked with Windows 10 with id :






see here : https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests






share|improve this answer





















  • I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
    – Maris B.
    Dec 8 at 10:56










  • Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
    – Herve K.
    Dec 11 at 9:19












  • I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
    – Maris B.
    Dec 11 at 14:23















up vote
0
down vote













It's the same story for each new Windows version. And again with Windows 2019



You should use VerifyVersionInfoW ... BUT also update your program manifest.



The questions is : What is the manifest for the new Windows version ...



Windows 2016 was linked with Windows 10 with id :






see here : https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests






share|improve this answer





















  • I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
    – Maris B.
    Dec 8 at 10:56










  • Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
    – Herve K.
    Dec 11 at 9:19












  • I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
    – Maris B.
    Dec 11 at 14:23













up vote
0
down vote










up vote
0
down vote









It's the same story for each new Windows version. And again with Windows 2019



You should use VerifyVersionInfoW ... BUT also update your program manifest.



The questions is : What is the manifest for the new Windows version ...



Windows 2016 was linked with Windows 10 with id :






see here : https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests






share|improve this answer












It's the same story for each new Windows version. And again with Windows 2019



You should use VerifyVersionInfoW ... BUT also update your program manifest.



The questions is : What is the manifest for the new Windows version ...



Windows 2016 was linked with Windows 10 with id :






see here : https://docs.microsoft.com/en-us/windows/desktop/sbscs/application-manifests







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 7 at 9:04









Herve K.

1




1












  • I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
    – Maris B.
    Dec 8 at 10:56










  • Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
    – Herve K.
    Dec 11 at 9:19












  • I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
    – Maris B.
    Dec 11 at 14:23


















  • I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
    – Maris B.
    Dec 8 at 10:56










  • Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
    – Herve K.
    Dec 11 at 9:19












  • I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
    – Maris B.
    Dec 11 at 14:23
















I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
– Maris B.
Dec 8 at 10:56




I do not see, how it is possible to tell if we are running on Windows Server 2019 by using VerifyVersionInfoW. Could you elaborate on that?
– Maris B.
Dec 8 at 10:56












Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
– Herve K.
Dec 11 at 9:19






Hi Maris. see these links : docs.microsoft.com/en-us/windows/desktop/api/versionhelpers/… / stackoverflow.com/questions/32115255/c-how-to-detect-windows-10 . It's solutions used to workaround GetVersionEx which is not pertinent.
– Herve K.
Dec 11 at 9:19














I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
– Maris B.
Dec 11 at 14:23




I still do not see, how can I distinguish Windows Server 2016 and Windows Server 2019, for example...
– Maris B.
Dec 11 at 14:23


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393150%2fc-how-to-detect-windows-server-2019%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

To store a contact into the json file from server.js file using a class in NodeJS

Marschland