|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-05-15 20:25 UTC] wenz@php.net
Description: ------------ The phpinfo() output on Windows 8.1 and Windows Server 2012 R2 reports the OS as Windows 8 and Windows Server 2012. This is due to the deprecation of GetVersionEx (which we are using) on these platforms - http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074%28v=vs.85%29.aspx Once we compile the Windows builds with the Visual Studio 2013 compiler and the Windows 8.1 (or higher) SDK, _NT_TARGET_VERSION=$(_NT_TARGET_VERSION_LATEST) seems to help. Alternatively, we could use a manifest file, see https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241%28v=vs.85%29.aspx. This would require a change to the build scripts, though. Until we actually do this, we need a different approach. VerifyVersionInfo (http://msdn.microsoft.com/en-us/library/windows/desktop/ms725491%28v=vs.85%29.aspx) looked like the best solution when I tackled a related but for Windows 8.1 (#67407). However despite Microsoft originally introducing that function to have an alternative to GetVersionEx, it looks like this function is deprecated already, see the note at http://blogs.msdn.com/b/chuckw/archive/2014/10/03/windows-10-technical-preview.aspx. The first technology preview of Windows 10 reported itself as version 6.4, since the second technology preview Windows 10 identifies itself as 10.0, yet VerifyVersionInfo reports 6.2 here. Thus, even the isWindows10OrGreater() function from the Windows 10 SDK (which uses VerifyVersionInf) does not identify Windows 10 correctly if there is no manifest! Incredible ... Microsoft provides a tiny hint at https://msdn.microsoft.com/en-us/library/windows/desktop/ms724429%28v=vs.85%29.aspx though: "To obtain the full version number for the operating system, call the GetFileVersionInfo function on one of the system DLLs, such as Kernel32.dll, then call VerQueryValue to obtain the \\StringFileInfo\\<lang><codepage>\\ProductVersion subblock of the file version information." I have tried to implement this to the best of my knowledge, but for some reason I cannot use the GetFileVersionInfoSize() function from version.dll. I hope someone with more C experience than I have could look at the attached diff. I hope that only a little bit is missing ... I have changed to code so that once the GetFileVersionInfo approach works, it is used for both Windows 8.1 and Windows 10, making the VerifyVersionInfo call obsolete. Note: at some point, we should tackle this at a greater scale. I have also thought about using WMI, but this seems to be overkill. Maybe using a Manifest would be the most feasible option eventually. I am aware that the final version of Windows 10 has not been released yet. However I guess that PHP 7 will be released close to the release of Windows 10, and it would not look good if our shiny new version could not detect the new OS version number, so I would like to get that resolved rather sooner than later. Please let me know if I can be of any assistance with testing etc.! Test script: --------------- <?php phpinfo(INFO_GENERAL); Expected result: ---------------- Output contains "Windows 10" on a Windows 10 machine. Actual result: -------------- Output contains "Windows 8" (and not 10) on a Windows 10 machine. Patchesdetect-windows-10-not-working-yet (last revision 2015-05-15 20:25 UTC by wenz)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Pah, I've managed a simple snippet now to work with manifest. Look: ================= getversionex.c ================= #include <windows.h> #include <stdio.h> void main() { OSVERSIONINFO osvi; BOOL bIsWindowsXPorLater; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); bIsWindowsXPorLater = ( (osvi.dwMajorVersion > 5) || ( (osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1) )); printf("major=%d minor=%d\n", osvi.dwMajorVersion, osvi.dwMinorVersion); } ================= getversionex.c ================= ==================== my.manifest ======================== <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>True/PM</dpiAware> </asmv3:windowsSettings> </asmv3:application> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> </application> </compatibility> </assembly> ==================== my.manifest ======================== Then the following commands: cl getversionex.c mt -manifest my.manifest -outputresource:getversionex.exe;1 And, we already have a mechanism in the makefile to run the latter command. So what i do think now - we should dig into this, probably use the default manifest if an extension/sapi doesn't supply one. I also haven't checked how it behaves when say it's a dll which is loaded in the exe without embedded manifest, should be checked yet. But if it works, we should use GetVersionEx - it's available in all the Windows versions including win10. If it's disappeared somewhen - well, then it needs to be changed. It should be also better from the performance side. If GetVersionEx did disappear somewhen, so maybe also dont use a CRT which doesn't fully support the version helper stuff. What do you think? Thanks.