Skip to content

Commit

Permalink
using correct manifest, GetVersionEx can recognise versions
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed May 28, 2015
1 parent 4bbfa24 commit e4ca770
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion ext/standard/info.c
Expand Up @@ -307,7 +307,17 @@ char* php_get_windows_name()
GetSystemInfo(&si);
}

if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 6 ) {
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 10) {
if (osvi.dwMajorVersion == 10) {
if( osvi.dwMinorVersion == 0 ) {
if( osvi.wProductType == VER_NT_WORKSTATION ) {
major = "Windows 10";
} else {
major = "Windows Server 2016";
}
}
}
} else if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 6) {
if (osvi.dwMajorVersion == 6) {
if( osvi.dwMinorVersion == 0 ) {
if( osvi.wProductType == VER_NT_WORKSTATION ) {
Expand All @@ -323,6 +333,11 @@ char* php_get_windows_name()
}
} else if ( osvi.dwMinorVersion == 2 ) {
/* could be Windows 8/Windows Server 2012, could be Windows 8.1/Windows Server 2012 R2 */
/* XXX and one more X - the above comment is true if no manifest is used for two cases:
- if the PHP build doesn't use the correct manifest
- if PHP DLL loaded under some binary that doesn't use the correct manifest
So keep the handling here as is for now, even if we know 6.2 is win8 and nothing else, and think about an improvement. */
OSVERSIONINFOEX osvi81;
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
Expand Down Expand Up @@ -353,6 +368,12 @@ char* php_get_windows_name()
major = "Windows Server 2012";
}
}
} else if (osvi.dwMinorVersion == 3) {
if( osvi.wProductType == VER_NT_WORKSTATION ) {
major = "Windows 8.1";
} else {
major = "Windows Server 2012 R2";
}
} else {
major = "Unknown Windows version";
}
Expand Down

0 comments on commit e4ca770

Please sign in to comment.