From 45fc9603e35d6c33c9ef1c9705248668f93393f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?= Date: Tue, 25 Aug 2015 20:42:05 -0400 Subject: [PATCH] Recognize Win 8, 8.1 and 10. https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx Windows 8.1 and 10 require a manifest file or they will be reported as 6.2 which is Windows 8. . Also add the information for Win 8, 8.1 and 10 in the WinMisc.cpp file. --- common/src/Utilities/Windows/WinMisc.cpp | 76 ++++++++++++++++++- pcsx2/windows/PCSX2.manifest | 44 +++++++++++ pcsx2/windows/VCprojects/pcsx2.vcxproj | 3 + .../windows/VCprojects/pcsx2.vcxproj.filters | 5 ++ 4 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 pcsx2/windows/PCSX2.manifest diff --git a/common/src/Utilities/Windows/WinMisc.cpp b/common/src/Utilities/Windows/WinMisc.cpp index d40e767a34..4ade8e46fd 100644 --- a/common/src/Utilities/Windows/WinMisc.cpp +++ b/common/src/Utilities/Windows/WinMisc.cpp @@ -55,6 +55,29 @@ u64 GetPhysicalMemory() typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); +// Win 10 SDK +#ifndef PRODUCT_CORE_N +# define PRODUCT_CORE_N 0x00000062 +#endif +#ifndef PRODUCT_CORE +# define PRODUCT_CORE 0x00000065 +#endif +#ifndef PRODUCT_PROFESSIONAL_WMC +# define PRODUCT_PROFESSIONAL_WMC 0x00000067 +#endif +#ifndef PRODUCT_EDUCATION +# define PRODUCT_EDUCATION 0x00000079 +#endif +#ifndef PRODUCT_EDUCATION_N +# define PRODUCT_EDUCATION_N 0x0000007A +#endif +#ifndef PRODUCT_ENTERPRISE_S +# define PRODUCT_ENTERPRISE_S 0x0000007D +#endif +#ifndef PRODUCT_ENTERPRISE_S_N +# define PRODUCT_ENTERPRISE_S_N 0x0000007E +#endif + // Calculates the Windows OS Version and install information, and returns it as a // human-readable string. :) // (Handy function borrowed from Microsoft's MSDN Online, and reformatted to use wxString.) @@ -92,7 +115,58 @@ wxString GetOSVersionString() // Test for the specific product. - if ( osvi.dwMajorVersion == 6 ) + if ( osvi.dwMajorVersion == 10 ) + { + if( osvi.dwMinorVersion == 0 ) + retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows 10 " : L"Windows Server 2016 "; + + pGPI = (PGPI) GetProcAddress( GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); + + pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); + + switch( dwType ) + { + case PRODUCT_CORE: retval += L"Home"; break; + case PRODUCT_CORE_N: retval += L"Home N"; break; + case PRODUCT_PROFESSIONAL: retval += L"Pro"; break; + case PRODUCT_PROFESSIONAL_N: retval += L"Pro N"; break; + case PRODUCT_ENTERPRISE: retval += L"Enterprise"; break; + case PRODUCT_ENTERPRISE_N: retval += L"Enterprise N"; break; + case PRODUCT_ENTERPRISE_S: retval += L"Enterprise 2015 LTSB"; break; + case PRODUCT_ENTERPRISE_S_N: retval += L"Enterprise 2015 LTSB N"; break; + case PRODUCT_EDUCATION: retval += L"Education"; break; + case PRODUCT_EDUCATION_N: retval += L"Education N"; break; + } + } + + if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion > 1 ) + { + if ( osvi.dwMinorVersion == 2 ) + retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows 8 " : L"Windows Server 2012 "; + + if ( osvi.dwMinorVersion == 3 ) + retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows 8.1 " : L"Windows Server 2012 R2 "; + + pGPI = (PGPI) GetProcAddress( GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); + + pGPI( osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType); + + switch( dwType ) + { + case PRODUCT_PROFESSIONAL: retval += L"Pro"; break; + case PRODUCT_PROFESSIONAL_N: retval += L"Pro N"; break; + case PRODUCT_PROFESSIONAL_WMC: retval += L"Pro with Media Center"; break; + case PRODUCT_ENTERPRISE: retval += L"Enterprise"; break; + case PRODUCT_ENTERPRISE_N: retval += L"Enterprise N"; break; + case PRODUCT_SERVER_FOUNDATION: retval += L"Foundation"; break; + case PRODUCT_STANDARD_SERVER: retval += L"Standard"; break; + case PRODUCT_STANDARD_SERVER_CORE: retval += L"Standard (core)"; break; + case PRODUCT_DATACENTER_SERVER: retval += L"Datacenter"; break; + case PRODUCT_DATACENTER_SERVER_CORE: retval += L"Datacenter (core)"; break; + } + } + + if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion <= 1 ) { if( osvi.dwMinorVersion == 0 ) retval += ( osvi.wProductType == VER_NT_WORKSTATION ) ? L"Windows Vista " : L"Windows Server 2008 "; diff --git a/pcsx2/windows/PCSX2.manifest b/pcsx2/windows/PCSX2.manifest new file mode 100644 index 0000000000..9d9a7c5a5f --- /dev/null +++ b/pcsx2/windows/PCSX2.manifest @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pcsx2/windows/VCprojects/pcsx2.vcxproj b/pcsx2/windows/VCprojects/pcsx2.vcxproj index 08426d6f9d..065f826e7e 100644 --- a/pcsx2/windows/VCprojects/pcsx2.vcxproj +++ b/pcsx2/windows/VCprojects/pcsx2.vcxproj @@ -942,6 +942,9 @@ %(RootDir)%(Directory)\%(Filename).h + + + diff --git a/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters b/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters index 07759ca487..32363794bf 100644 --- a/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters +++ b/pcsx2/windows/VCprojects/pcsx2.vcxproj.filters @@ -1390,4 +1390,9 @@ AppHost\Resources + + + AppHost\Resources + + \ No newline at end of file