globals.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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. /* $Id$ */
  19. #include "php.h"
  20. #include "php_win32_globals.h"
  21. #include "syslog.h"
  22. #ifdef ZTS
  23. PHPAPI int php_win32_core_globals_id;
  24. #else
  25. php_win32_core_globals the_php_win32_core_globals;
  26. #endif
  27. void php_win32_core_globals_ctor(void *vg TSRMLS_DC)
  28. {
  29. php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  30. memset(wg, 0, sizeof(*wg));
  31. }
  32. void php_win32_core_globals_dtor(void *vg TSRMLS_DC)
  33. {
  34. php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  35. if (wg->registry_key) {
  36. RegCloseKey(wg->registry_key);
  37. wg->registry_key = NULL;
  38. }
  39. if (wg->registry_event) {
  40. CloseHandle(wg->registry_event);
  41. wg->registry_event = NULL;
  42. }
  43. if (wg->registry_directories) {
  44. zend_hash_destroy(wg->registry_directories);
  45. free(wg->registry_directories);
  46. wg->registry_directories = NULL;
  47. }
  48. }
  49. PHP_RSHUTDOWN_FUNCTION(win32_core_globals)
  50. {
  51. php_win32_core_globals *wg =
  52. #ifdef ZTS
  53. ts_resource(php_win32_core_globals_id)
  54. #else
  55. &the_php_win32_core_globals
  56. #endif
  57. ;
  58. closelog();
  59. return SUCCESS;
  60. }