From 05351f9ccb68619879d80110ea744cd411634cd4 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 31 May 2015 18:13:33 +0200 Subject: [PATCH 1/5] add test --- ext/standard/tests/php_version_win_const.phpt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ext/standard/tests/php_version_win_const.phpt diff --git a/ext/standard/tests/php_version_win_const.phpt b/ext/standard/tests/php_version_win_const.phpt new file mode 100644 index 00000000000..12de79b1aed --- /dev/null +++ b/ext/standard/tests/php_version_win_const.phpt @@ -0,0 +1,18 @@ +--TEST-- +Check that windows version constants are initialized +--SKIPIF-- + +--FILE-- + 0, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR); +?> +==DONE== +--EXPECTF-- +bool(true) +int(%d) +int(%d) +==DONE== From 7e731e4d9dc5b15774d9e046e683d4af04721a40 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 31 May 2015 18:17:58 +0200 Subject: [PATCH 2/5] add default manifest --- win32/build/default.manifest | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 win32/build/default.manifest diff --git a/win32/build/default.manifest b/win32/build/default.manifest new file mode 100644 index 00000000000..77b2a2165a3 --- /dev/null +++ b/win32/build/default.manifest @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + From 50d4ea90b379534ba2c2cbca3565809a043b7714 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 31 May 2015 18:53:51 +0200 Subject: [PATCH 3/5] backport the manifest changes in js --- win32/build/confutils.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/win32/build/confutils.js b/win32/build/confutils.js index 84238762394..9c68a97037d 100644 --- a/win32/build/confutils.js +++ b/win32/build/confutils.js @@ -916,6 +916,16 @@ function CHECK_HEADER_ADD_INCLUDE(header_name, flag_name, path_to_check, use_env return p; } +function generate_version_info_manifest(makefiletarget) +{ + var manifest_name = makefiletarget + ".manifest"; + + MFO.WriteLine("$(BUILD_DIR)\\" + manifest_name + ": win32\\build\\default.manifest"); + MFO.WriteLine("\t@copy $(PHP_SRC_DIR)\\win32\\build\\default.manifest $(BUILD_DIR)\\" + makefiletarget + ".manifest"); + + return manifest_name; +} + /* emits rule to generate version info for a SAPI * or extension. Returns the name of the .res file * that will be generated */ @@ -1067,12 +1077,14 @@ function SAPI(sapiname, file_list, makefiletarget, cflags, obj_dir) /* generate a .res file containing version information */ resname = generate_version_info_resource(makefiletarget, sapiname, configure_module_dirname, true); + manifest_name = generate_version_info_manifest(makefiletarget); + MFO.WriteLine(makefiletarget + ": $(BUILD_DIR)\\" + makefiletarget); MFO.WriteLine("\t@echo SAPI " + sapiname_for_printing + " build complete"); if (MODE_PHPIZE) { - MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname); + MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name); } else { - MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); + MFO.WriteLine("$(BUILD_DIR)\\" + makefiletarget + ": $(DEPS_" + SAPI + ") $(" + SAPI + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name); } if (makefiletarget.match(new RegExp("\\.dll$"))) { @@ -1282,6 +1294,7 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) var resname = generate_version_info_resource(dllname, extname, configure_module_dirname, false); var ld = "@$(CC)"; + var manifest_name = generate_version_info_manifest(dllname); ldflags = ""; if (is_pgo_desired(extname) && (PHP_PGI == "yes" || PHP_PGO != "no")) { @@ -1301,10 +1314,10 @@ function EXTENSION(extname, file_list, shared, cflags, dllname, obj_dir) MFO.WriteLine("$(BUILD_DIR)\\" + libname + ": $(BUILD_DIR)\\" + dllname); MFO.WriteBlankLines(1); if (MODE_PHPIZE) { - MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname); + MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name); MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")"); } else { - MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname); + MFO.WriteLine("$(BUILD_DIR)\\" + dllname + ": $(DEPS_" + EXT + ") $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(BUILD_DIR)\\" + resname + " $(BUILD_DIR)\\" + manifest_name); MFO.WriteLine("\t" + ld + " $(" + EXT + "_GLOBAL_OBJS) $(BUILD_DIR)\\$(PHPLIB) $(LIBS_" + EXT + ") $(LIBS) $(BUILD_DIR)\\" + resname + " /link /out:$(BUILD_DIR)\\" + dllname + ldflags + " $(DLL_LDFLAGS) $(LDFLAGS) $(LDFLAGS_" + EXT + ")"); } MFO.WriteLine("\t-@$(_VC_MANIFEST_EMBED_DLL)"); From 31d59bf91569ba5a7cad6e433c49e44847b559b5 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 31 May 2015 18:59:00 +0200 Subject: [PATCH 4/5] backport the manifest changes for makefile --- win32/build/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/win32/build/Makefile b/win32/build/Makefile index 7a3be93e87c..bf6edf694b0 100644 --- a/win32/build/Makefile +++ b/win32/build/Makefile @@ -89,6 +89,7 @@ $(PHPDLL_RES): win32\build\template.rc win32\build\template.rc $(BUILD_DIR)\$(PHPDLL): generated_files $(PHPDEF) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(PHPDLL_RES) $(MCFILE) + @copy win32\build\default.manifest $(BUILD_DIR)\$(PHPDLL).manifest @$(CC) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(STATIC_EXT_LIBS) $(LIBS) $(PHPDLL_RES) /link /out:$(BUILD_DIR)\$(PHPDLL) $(PHP5_PGD_OPTION) $(PHP_LDFLAGS) $(LDFLAGS) $(STATIC_EXT_LDFLAGS) -@$(_VC_MANIFEST_EMBED_DLL) @@ -115,7 +116,7 @@ clean: clean-sapi @cd $(BUILD_DIR) @for %D in (_x $(BUILD_DIRS_SUB)) do @if exist %D @del /F /Q %D\*.* > NUL @cd "$(PHP_SRC_DIR)" - -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL + -@del /F /Q $(BUILD_DIR)\*.res $(BUILD_DIR)\*.manifest $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.ilk $(BUILD_DIR)\*.pdb $(BUILD_DIR)\*.exp $(PHPDEF) $(BUILD_DIR)\php-$(PHP_VERSION_STRING)-Win32.zip $(BUILD_DIR)\pecl-$(PHP_VERSION_STRING)-Win32.zip > NUL -rd /s /q $(BUILD_DIR)\php-$(PHP_VERSION_STRING) clean-pecl: @@ -196,6 +197,7 @@ build-devel: build-headers build-lib @copy win32\build\Makefile.phpize $(BUILD_DIR_DEV)\script\ /y >nul @copy win32\build\phpize.bat $(BUILD_DIR_DEV)\ /y >nul @copy win32\build\template.rc $(BUILD_DIR_DEV)\build\ /y >nul + @copy win32\build\default.manifest $(BUILD_DIR_DEV)\build\ /y >nul @copy $(BUILD_DIR)\devel\config.phpize.js $(BUILD_DIR_DEV)\script\ /y >nul @copy $(BUILD_DIR)\devel\phpize.js $(BUILD_DIR_DEV)\script\ /y >nul @copy $(BUILD_DIR)\devel\ext_deps.js $(BUILD_DIR_DEV)\script\ /y >nul From 1e9522021ab147d7986fbd93dcd3eafae2b24620 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 31 May 2015 19:01:58 +0200 Subject: [PATCH 5/5] backport the basic code to properly recognize win 8.1 and 10 --- ext/standard/info.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ext/standard/info.c b/ext/standard/info.c index df96199f4f4..82b6bf8b48d 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -320,6 +320,17 @@ char* php_get_windows_name() } if (VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion > 4 ) { + + if (osvi.dwMajorVersion == 10) { + if( osvi.dwMinorVersion == 0 ) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 10"; + } else { + major = "Windows Server 2016"; + } + } + } + if (osvi.dwMajorVersion == 6) { if( osvi.dwMinorVersion == 0 ) { if( osvi.wProductType == VER_NT_WORKSTATION ) { @@ -366,6 +377,12 @@ char* php_get_windows_name() major = "Windows Server 2012"; } } + } else if (osvi.dwMinorVersion == 3) { + if( osvi.wProductType == VER_NT_WORKSTATION ) { + major = "Windows 8.1"; + } else { + major = "Windows Server 2012 R2"; + } } else { major = "Unknown Windows version"; }