globals.c 2.0 KB

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