Skip to content

Commit e4ca770

Browse files
committed
using correct manifest, GetVersionEx can recognise versions
1 parent 4bbfa24 commit e4ca770

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ext/standard/info.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,17 @@ char* php_get_windows_name()
307307
GetSystemInfo(&si);
308308
}
309309

310-
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 6 ) {
310+
if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 10) {
311+
if (osvi.dwMajorVersion == 10) {
312+
if( osvi.dwMinorVersion == 0 ) {
313+
if( osvi.wProductType == VER_NT_WORKSTATION ) {
314+
major = "Windows 10";
315+
} else {
316+
major = "Windows Server 2016";
317+
}
318+
}
319+
}
320+
} else if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion >= 6) {
311321
if (osvi.dwMajorVersion == 6) {
312322
if( osvi.dwMinorVersion == 0 ) {
313323
if( osvi.wProductType == VER_NT_WORKSTATION ) {
@@ -323,6 +333,11 @@ char* php_get_windows_name()
323333
}
324334
} else if ( osvi.dwMinorVersion == 2 ) {
325335
/* could be Windows 8/Windows Server 2012, could be Windows 8.1/Windows Server 2012 R2 */
336+
/* XXX and one more X - the above comment is true if no manifest is used for two cases:
337+
- if the PHP build doesn't use the correct manifest
338+
- if PHP DLL loaded under some binary that doesn't use the correct manifest
339+
340+
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. */
326341
OSVERSIONINFOEX osvi81;
327342
DWORDLONG dwlConditionMask = 0;
328343
int op = VER_GREATER_EQUAL;
@@ -353,6 +368,12 @@ char* php_get_windows_name()
353368
major = "Windows Server 2012";
354369
}
355370
}
371+
} else if (osvi.dwMinorVersion == 3) {
372+
if( osvi.wProductType == VER_NT_WORKSTATION ) {
373+
major = "Windows 8.1";
374+
} else {
375+
major = "Windows Server 2012 R2";
376+
}
356377
} else {
357378
major = "Unknown Windows version";
358379
}

0 commit comments

Comments
 (0)