1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2013 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Author: Wez Furlong <wez@php.net> | 16 +----------------------------------------------------------------------+ 17 */ 18 19 /* $Id$ */ 20 21 #include "php.h" 22 #include "php_win32_globals.h" 23 #include "syslog.h" 24 25 #ifdef ZTS 26 PHPAPI int php_win32_core_globals_id; 27 #else 28 php_win32_core_globals the_php_win32_core_globals; 29 #endif 30 php_win32_core_globals_ctor(void * vg TSRMLS_DC)31void php_win32_core_globals_ctor(void *vg TSRMLS_DC) 32 { 33 php_win32_core_globals *wg = (php_win32_core_globals*)vg; 34 memset(wg, 0, sizeof(*wg)); 35 } 36 php_win32_core_globals_dtor(void * vg TSRMLS_DC)37void php_win32_core_globals_dtor(void *vg TSRMLS_DC) 38 { 39 php_win32_core_globals *wg = (php_win32_core_globals*)vg; 40 41 if (wg->registry_key) { 42 RegCloseKey(wg->registry_key); 43 wg->registry_key = NULL; 44 } 45 if (wg->registry_event) { 46 CloseHandle(wg->registry_event); 47 wg->registry_event = NULL; 48 } 49 if (wg->registry_directories) { 50 zend_hash_destroy(wg->registry_directories); 51 free(wg->registry_directories); 52 wg->registry_directories = NULL; 53 } 54 } 55 56 PHP_RSHUTDOWN_FUNCTION(win32_core_globals)57PHP_RSHUTDOWN_FUNCTION(win32_core_globals) 58 { 59 php_win32_core_globals *wg = 60 #ifdef ZTS 61 ts_resource(php_win32_core_globals_id) 62 #else 63 &the_php_win32_core_globals 64 #endif 65 ; 66 67 closelog(); 68 69 return SUCCESS; 70 } 71 72