globals.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 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. #include "php.h"
  19. #include "php_win32_globals.h"
  20. #include "syslog.h"
  21. #ifdef ZTS
  22. PHPAPI int php_win32_core_globals_id;
  23. #else
  24. php_win32_core_globals the_php_win32_core_globals;
  25. #endif
  26. void php_win32_core_globals_ctor(void *vg)
  27. {/*{{{*/
  28. php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  29. memset(wg, 0, sizeof(*wg));
  30. wg->mail_socket = INVALID_SOCKET;
  31. wg->log_source = INVALID_HANDLE_VALUE;
  32. }/*}}}*/
  33. void php_win32_core_globals_dtor(void *vg)
  34. {/*{{{*/
  35. php_win32_core_globals *wg = (php_win32_core_globals*)vg;
  36. if (wg->registry_key) {
  37. RegCloseKey(wg->registry_key);
  38. wg->registry_key = NULL;
  39. }
  40. if (wg->registry_event) {
  41. CloseHandle(wg->registry_event);
  42. wg->registry_event = NULL;
  43. }
  44. if (wg->registry_directories) {
  45. zend_hash_destroy(wg->registry_directories);
  46. free(wg->registry_directories);
  47. wg->registry_directories = NULL;
  48. }
  49. if (INVALID_SOCKET != wg->mail_socket) {
  50. closesocket(wg->mail_socket);
  51. wg->mail_socket = INVALID_SOCKET;
  52. }
  53. }/*}}}*/
  54. PHP_RSHUTDOWN_FUNCTION(win32_core_globals)
  55. {/*{{{*/
  56. closelog();
  57. return SUCCESS;
  58. }/*}}}*/
  59. /*
  60. * Local variables:
  61. * tab-width: 4
  62. * c-basic-offset: 4
  63. * End:
  64. * vim600: sw=4 ts=4 fdm=marker
  65. * vim<600: sw=4 ts=4
  66. */