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