summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-07-08 09:52:35 +0200
committerAnatol Belski <ab@php.net>2014-07-08 09:52:35 +0200
commit03214a2aef23e6f7597cbe8eaa834af46a5fa74c (patch)
tree307489e90907f02473ab0d9f1d69f6a3c5cc2845
parent494034901e6743861d17b1fe60e8d3d0c6477f8c (diff)
downloadphp-git-03214a2aef23e6f7597cbe8eaa834af46a5fa74c.tar.gz
Backported the patch from bug #67407 into 5.4
-rw-r--r--ext/standard/info.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 0f15bbefd6..98b4a8098c 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -328,7 +328,7 @@ char* php_get_windows_name()
}
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) {
- if (osvi.dwMajorVersion == 6) {
+ if (osvi.dwMajorVersion == 6) {
if( osvi.dwMinorVersion == 0 ) {
if( osvi.wProductType == VER_NT_WORKSTATION ) {
major = "Windows Vista";
@@ -342,6 +342,38 @@ char* php_get_windows_name()
} else {
major = "Windows Server 2008 R2";
}
+ } else if ( osvi.dwMinorVersion == 2 ) {
+ /* 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 {
+ if( osvi.wProductType == VER_NT_WORKSTATION ) {
+ major = "Windows 8";
+ } else {
+ major = "Windows Server 2012";
+ }
+ }
} else {
major = "Unknown Windows version";
}