summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Wenz <christian@wenz.org>2014-06-10 10:42:23 +0200
committerChristian Wenz <christian@wenz.org>2014-06-10 10:42:23 +0200
commit60cc43a279479822af55dded38cafabe9b9123af (patch)
treeddb0d2952a5ca3d99d27f99430b2f89e64376806
parentab074b408a3fc2c81803f2616a92f6cbf2652e66 (diff)
downloadphp-git-60cc43a279479822af55dded38cafabe9b9123af.tar.gz
Update info.c
Fixes #67407: Windows 8.1/Server 2012 R2 reported as Windows 8/Server 2012
-rw-r--r--ext/standard/info.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/ext/standard/info.c b/ext/standard/info.c
index 03ced35fb3..12e36b4f15 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";
}