cvs: php-src(PHP_5_3) /main main.c win32_internal_function_disabled.h

From: Date: Fri, 16 Jan 2009 00:57:05 +0000
Subject: cvs: php-src(PHP_5_3) /main main.c win32_internal_function_disabled.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-55660@lists.php.net to get a copy of this message
pajoye Fri Jan 16 00:57:05 2009 UTC Added files: (Branch: PHP_5_3) /php-src/main win32_internal_function_disabled.h Modified files: /php-src/main main.c Log: - add EG(windows_version_info), set at init time once per instance contains a OSVERSIONINFOEX struct. It lets us determine easily on which windows version is used (for example) - add the ability to disable a function when the windows function does not support a feature (for example symlink) - symlink, hardlink & co support (1/2) http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.57.2.42&r2=1.640.2.23.2.57.2.43&diff_format=u Index: php-src/main/main.c diff -u php-src/main/main.c:1.640.2.23.2.57.2.42 php-src/main/main.c:1.640.2.23.2.57.2.43 --- php-src/main/main.c:1.640.2.23.2.57.2.42 Fri Jan 9 14:59:30 2009 +++ php-src/main/main.c Fri Jan 16 00:57:05 2009 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.640.2.23.2.57.2.42 2009/01/09 14:59:30 iliaa Exp $ */ +/* $Id: main.c,v 1.640.2.23.2.57.2.43 2009/01/16 00:57:05 pajoye Exp $ */ /* {{{ includes */ @@ -99,6 +99,33 @@ PHPAPI int core_globals_id; #endif +#ifdef PHP_WIN32 +#include "win32_internal_function_disabled.h" + +static php_win32_disable_functions() { + int i; + TSRMLS_FETCH(); + + if (EG(windows_version_info).dwMajorVersion < 5) { + for (i = 0; i < function_name_cnt_5; i++) { + if (zend_hash_del(CG(function_table), function_name_5[i], strlen(function_name_5[i]) + 1)==FAILURE) { + php_printf("Unable to disable function '%s'\n", function_name_5[i]); + return FAILURE; + } + } + } + + if (EG(windows_version_info).dwMajorVersion < 6) { + for (i = 0; i < function_name_cnt_6; i++) { + if (zend_hash_del(CG(function_table), function_name_6[i], strlen(function_name_6[i]) + 1)==FAILURE) { + php_printf("Unable to disable function '%s'\n", function_name_6[i]); + return FAILURE; + } + } + } +} +#endif + #define SAFE_FILENAME(f) ((f)?(f):"-") /* {{{ PHP_INI_MH @@ -1677,6 +1704,9 @@ #ifdef ZTS zend_executor_globals *executor_globals; void ***tsrm_ls; +#ifdef PHP_WIN32 + DWORD dwVersion = GetVersion(); +#endif php_core_globals *core_globals; #endif @@ -1685,16 +1715,12 @@ WSADATA wsaData; #endif #ifdef PHP_WIN32 - { - DWORD dwVersion = GetVersion(); - /* Get build numbers for Windows NT or Win95 */ if (dwVersion < 0x80000000){ php_os="WINNT"; } else { php_os="WIN32"; } - } #if defined(_MSC_VER) && (_MSC_VER >= 1400) old_invalid_parameter_handler = _set_invalid_parameter_handler(dummy_invalid_parameter_handler); @@ -1752,6 +1778,18 @@ #endif gc_globals_ctor(TSRMLS_C); +#ifdef PHP_WIN32 + { + OSVERSIONINFOEX *osvi = &EG(windows_version_info); + + ZeroMemory(osvi, sizeof(OSVERSIONINFOEX)); + osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + if( !GetVersionEx((OSVERSIONINFO *) osvi)) { + php_printf("\nGetVersionEx unusable. %d\n", GetLastError()); + return FAILURE; + } + } +#endif EG(bailout) = NULL; EG(error_reporting) = E_ALL & ~E_NOTICE; @@ -1927,6 +1965,11 @@ module->info_func = PHP_MINFO(php_core); } +#ifdef PHP_WIN32 + /* Disable incompatible functions for the running platform */ + php_win32_disable_functions(); +#endif + #ifdef ZTS zend_post_startup(TSRMLS_C); #endif http://cvs.php.net/viewvc.cgi/php-src/main/win32_internal_function_disabled.h?view=markup&rev=1.1 Index: php-src/main/win32_internal_function_disabled.h +++ php-src/main/win32_internal_function_disabled.h

« previous php.cvs (#55660) next »