Utils: add support for newer Windows versions detection

This commit is contained in:
Gregory Lemercier 2018-10-09 19:17:56 +02:00
parent c23b6f8f56
commit 93a88d7323
1 changed files with 24 additions and 1 deletions

View File

@ -307,10 +307,19 @@ namespace tools
StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft ")); StringCchCopy(pszOS, BUFSIZE, TEXT("Microsoft "));
// Test for the specific product. // Test for the specific product.
if ( osvi.dwMajorVersion == 10 )
{
if ( osvi.dwMinorVersion == 0 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, BUFSIZE, TEXT("Windows 10 "));
else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2016 " ));
}
}
if ( osvi.dwMajorVersion == 6 ) if ( osvi.dwMajorVersion == 6 )
{ {
if( osvi.dwMinorVersion == 0 ) if ( osvi.dwMinorVersion == 0 )
{ {
if( osvi.wProductType == VER_NT_WORKSTATION ) if( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista ")); StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista "));
@ -324,6 +333,20 @@ namespace tools
else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 " )); else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 " ));
} }
if ( osvi.dwMinorVersion == 2 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, BUFSIZE, TEXT("Windows 8 "));
else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2012 " ));
}
if ( osvi.dwMinorVersion == 3 )
{
if( osvi.wProductType == VER_NT_WORKSTATION )
StringCchCat(pszOS, BUFSIZE, TEXT("Windows 8.1 "));
else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2012 R2 " ));
}
pGPI = (PGPI) GetProcAddress( pGPI = (PGPI) GetProcAddress(
GetModuleHandle(TEXT("kernel32.dll")), GetModuleHandle(TEXT("kernel32.dll")),
"GetProductInfo"); "GetProductInfo");