tsrm_win32.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. | Authors: Daniel Beulshausen <daniel@php4win.de> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef TSRM_WIN32_H
  17. #define TSRM_WIN32_H
  18. #include "TSRM.h"
  19. #include <windows.h>
  20. #include <sys/utime.h>
  21. #include "win32/ipc.h"
  22. struct ipc_perm {
  23. key_t key;
  24. unsigned short uid;
  25. unsigned short gid;
  26. unsigned short cuid;
  27. unsigned short cgid;
  28. unsigned short mode;
  29. unsigned short seq;
  30. };
  31. struct shmid_ds {
  32. struct ipc_perm shm_perm;
  33. size_t shm_segsz;
  34. time_t shm_atime;
  35. time_t shm_dtime;
  36. time_t shm_ctime;
  37. unsigned short shm_cpid;
  38. unsigned short shm_lpid;
  39. short shm_nattch;
  40. };
  41. typedef struct {
  42. FILE *stream;
  43. HANDLE prochnd;
  44. } process_pair;
  45. typedef struct {
  46. void *addr;
  47. HANDLE info;
  48. HANDLE segment;
  49. struct shmid_ds *descriptor;
  50. } shm_pair;
  51. typedef struct {
  52. process_pair *process;
  53. shm_pair *shm;
  54. int process_size;
  55. int shm_size;
  56. char *comspec;
  57. HANDLE impersonation_token;
  58. PSID impersonation_token_sid;
  59. } tsrm_win32_globals;
  60. #ifdef ZTS
  61. # define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
  62. TSRMLS_CACHE_EXTERN()
  63. #else
  64. # define TWG(v) (win32_globals.v)
  65. #endif
  66. #define IPC_PRIVATE 0
  67. #define IPC_CREAT 00001000
  68. #define IPC_EXCL 00002000
  69. #define IPC_NOWAIT 00004000
  70. #define IPC_RMID 0
  71. #define IPC_SET 1
  72. #define IPC_STAT 2
  73. #define IPC_INFO 3
  74. #define SHM_R PAGE_READONLY
  75. #define SHM_W PAGE_READWRITE
  76. #define SHM_RDONLY FILE_MAP_READ
  77. #define SHM_RND FILE_MAP_WRITE
  78. #define SHM_REMAP FILE_MAP_COPY
  79. const char * tsrm_win32_get_path_sid_key(const char *pathname, size_t pathname_len, size_t *key_len);
  80. TSRM_API void tsrm_win32_startup(void);
  81. TSRM_API void tsrm_win32_shutdown(void);
  82. TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, const char *env);
  83. TSRM_API FILE *popen(const char *command, const char *type);
  84. TSRM_API int pclose(FILE *stream);
  85. TSRM_API int tsrm_win32_access(const char *pathname, int mode);
  86. TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
  87. TSRM_API int shmget(key_t key, size_t size, int flags);
  88. TSRM_API void *shmat(int key, const void *shmaddr, int flags);
  89. TSRM_API int shmdt(const void *shmaddr);
  90. TSRM_API int shmctl(int key, int cmd, struct shmid_ds *buf);
  91. #endif