diff options
author | Anatol Belski <ab@php.net> | 2014-07-08 09:48:59 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-07-08 09:48:59 +0200 |
commit | 4883a60bb3412e5c776153703d7e0ff0a490482b (patch) | |
tree | 84a578937b4b2b88fe36149ef970d48ef212f2ef | |
parent | b26c97b1a24a27f052a8304bfae82efc93f4c0d1 (diff) | |
parent | 60cc43a279479822af55dded38cafabe9b9123af (diff) | |
download | php-git-4883a60bb3412e5c776153703d7e0ff0a490482b.tar.gz |
Merge branch 'pull-request/691'
-rw-r--r-- | ext/standard/info.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c index 0626a7067b..1b1b8f202b 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -335,11 +335,37 @@ char* php_get_windows_name() major = "Windows Server 2008 R2"; } } else if ( osvi.dwMinorVersion == 2 ) { - if( osvi.wProductType == VER_NT_WORKSTATION ) { - major = "Windows 8"; + /* could be Windows 8/Windows Server 2012, could be Windows 8.1/Windows Server 2012 R2 */ + OSVERSIONINFOEX osvi81; + DWORDLONG dwlConditionMask = 0; + int op = VER_GREATER_EQUAL; + + ZeroMemory(&osvi81, sizeof(OSVERSIONINFOEX)); + osvi81.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + osvi81.dwMajorVersion = 6; + osvi81.dwMinorVersion = 3; + osvi81.wServicePackMajor = 0; + + VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op); + VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op); + VER_SET_CONDITION(dwlConditionMask, VER_SERVICEPACKMAJOR, op); + + if (VerifyVersionInfo(&osvi81, + VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, + dwlConditionMask)) { + osvi.dwMinorVersion = 3; /* Windows 8.1/Windows Server 2012 R2 */ + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 8.1"; + } else { + major = "Windows Server 2012 R2"; + } } else { - major = "Windows Server 2012"; - } + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 8"; + } else { + major = "Windows Server 2012"; + } + } } else { major = "Unknown Windows version"; } |