Commit | Line | Data |
68dc0745 |
1 | /* WIN32.H |
2 | * |
3fadfdf1 |
3 | * (c) 1995 Microsoft Corporation. All rights reserved. |
0d130a44 |
4 | * Developed by hip communications inc. |
68dc0745 |
5 | * |
6 | * You may distribute under the terms of either the GNU General Public |
7 | * License or the Artistic License, as specified in the README file. |
8 | */ |
0a753a76 |
9 | #ifndef _INC_WIN32_PERL5 |
10 | #define _INC_WIN32_PERL5 |
11 | |
5db10396 |
12 | #ifndef _WIN32_WINNT |
13 | # define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */ |
14 | #endif |
638eceb6 |
15 | |
acfe0abc |
16 | #if defined(PERL_IMPLICIT_SYS) |
e9ee4811 |
17 | # define DYNAMIC_ENV_FETCH |
a6c40364 |
18 | # define HAS_GETENV_LEN |
e9ee4811 |
19 | # define prime_env_iter() |
ab39fa9d |
20 | # define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */ |
c5be433b |
21 | # define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */ |
ab39fa9d |
22 | # ifdef PERL_GLOBAL_STRUCT |
32e30700 |
23 | # error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS |
ab39fa9d |
24 | # endif |
e5a95ffb |
25 | # define win32_get_privlib PerlEnv_lib_path |
ab39fa9d |
26 | # define win32_get_sitelib PerlEnv_sitelib_path |
4ea817c6 |
27 | # define win32_get_vendorlib PerlEnv_vendorlib_path |
9d8a25dc |
28 | #endif |
29 | |
a835ef8a |
30 | #ifdef __GNUC__ |
b7c82df9 |
31 | # ifndef __int64 /* some versions seem to #define it already */ |
32 | # define __int64 long long |
33 | # endif |
db15561c |
34 | # define Win32_Winsock |
1c85e96a |
35 | #ifdef __cplusplus |
36 | /* Mingw32 gcc -xc++ objects to __attribute((unused)) at least */ |
3fadfdf1 |
37 | #undef PERL_UNUSED_DECL |
38 | #define PERL_UNUSED_DECL |
a835ef8a |
39 | #endif |
1c85e96a |
40 | #endif |
41 | |
a835ef8a |
42 | |
3fadfdf1 |
43 | /* Define DllExport akin to perl's EXT, |
22239a37 |
44 | * If we are in the DLL or mimicing the DLL for Win95 work round |
3fadfdf1 |
45 | * then Export the symbol, |
22239a37 |
46 | * otherwise import it. |
47 | */ |
48 | |
5db10396 |
49 | /* now even GCC supports __declspec() */ |
50 | |
22239a37 |
51 | #if defined(PERLDLL) || defined(WIN95FIX) |
852c2e52 |
52 | #define DllExport |
53 | /*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */ |
3fadfdf1 |
54 | #else |
22239a37 |
55 | #define DllExport __declspec(dllimport) |
56 | #endif |
c69f112c |
57 | |
0a753a76 |
58 | #define WIN32_LEAN_AND_MEAN |
59 | #include <windows.h> |
60 | |
fa58a56f |
61 | /* |
62 | * Bug in winbase.h in mingw-w64 4.4.0-1 at least... they |
63 | * do #define GetEnvironmentStringsA GetEnvironmentStrings and fail |
64 | * to declare GetEnvironmentStringsA. |
65 | */ |
66 | #if defined(__MINGW64__) && defined(GetEnvironmentStringsA) && !defined(UNICODE) |
67 | #ifdef __cplusplus |
68 | extern "C" { |
69 | #endif |
70 | #undef GetEnvironmentStringsA |
71 | WINBASEAPI LPCH WINAPI GetEnvironmentStringsA(VOID); |
72 | #define GetEnvironmentStrings GetEnvironmentStringsA |
73 | #ifdef __cplusplus |
74 | } |
75 | #endif |
76 | #endif |
77 | |
68dc0745 |
78 | #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ |
79 | #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ |
68dc0745 |
80 | #endif /*WIN32_LEAN_AND_MEAN */ |
0a753a76 |
81 | |
eda5ff31 |
82 | #ifndef TLS_OUT_OF_INDEXES |
83 | #define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF |
84 | #endif |
85 | |
0a753a76 |
86 | #include <dirent.h> |
87 | #include <io.h> |
88 | #include <process.h> |
89 | #include <stdio.h> |
90 | #include <direct.h> |
390b85e7 |
91 | #include <stdlib.h> |
c623ac67 |
92 | #include <stddef.h> |
7a1f88ac |
93 | #include <fcntl.h> |
390b85e7 |
94 | #ifndef EXT |
95 | #include "EXTERN.h" |
96 | #endif |
97 | |
c69f112c |
98 | struct tms { |
99 | long tms_utime; |
100 | long tms_stime; |
101 | long tms_cutime; |
102 | long tms_cstime; |
103 | }; |
104 | |
b2af26b1 |
105 | #ifndef SYS_NMLN |
106 | #define SYS_NMLN 257 |
107 | #endif |
108 | |
109 | struct utsname { |
110 | char sysname[SYS_NMLN]; |
111 | char nodename[SYS_NMLN]; |
112 | char release[SYS_NMLN]; |
113 | char version[SYS_NMLN]; |
114 | char machine[SYS_NMLN]; |
115 | }; |
116 | |
390b85e7 |
117 | #ifndef START_EXTERN_C |
b3e5c95e |
118 | #undef EXTERN_C |
390b85e7 |
119 | #ifdef __cplusplus |
120 | # define START_EXTERN_C extern "C" { |
121 | # define END_EXTERN_C } |
122 | # define EXTERN_C extern "C" |
123 | #else |
3fadfdf1 |
124 | # define START_EXTERN_C |
125 | # define END_EXTERN_C |
390b85e7 |
126 | # define EXTERN_C |
127 | #endif |
128 | #endif |
129 | |
130 | #define STANDARD_C 1 |
131 | #define DOSISH 1 /* no escaping our roots */ |
132 | #define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */ |
0a753a76 |
133 | |
f3986ebb |
134 | /* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as |
135 | * real filehandles. XXX Should always be defined (the other version is untested) */ |
136 | #define USE_SOCKETS_AS_HANDLES |
137 | |
a7092146 |
138 | /* read() and write() aren't transparent for socket handles */ |
139 | #define PERL_SOCK_SYSREAD_IS_RECV |
140 | #define PERL_SOCK_SYSWRITE_IS_SEND |
141 | |
682fc664 |
142 | #define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ |
a7092146 |
143 | |
9e5f57de |
144 | /* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95. |
145 | It now uses some black magic to work seamlessly with the DLL CRT and |
146 | works with MSVC++ 4.0+ or GCC/Mingw32 |
d67249f4 |
147 | -- BKS 1-24-2000 |
148 | Only use this fix for VC++ 6.x or earlier (and for GCC, which we assume |
149 | uses MSVCRT.DLL). Later versions use MSVCR70.dll, MSVCR71.dll, etc, which |
150 | do not require the fix. */ |
151 | #if (defined(_M_IX86) && _MSC_VER >= 1000 && _MSC_VER <= 1200) || defined(__MINGW32__) |
f3986ebb |
152 | #define USE_FIXED_OSFHANDLE |
153 | #endif |
154 | |
6940069f |
155 | /* Define PERL_WIN32_SOCK_DLOAD to have Perl dynamically load the winsock |
156 | DLL when needed. Don't use if your compiler supports delayloading (ie, VC++ 6.0) |
157 | -- BKS 5-29-2000 */ |
158 | #if !(defined(_M_IX86) && _MSC_VER >= 1200) |
159 | #define PERL_WIN32_SOCK_DLOAD |
160 | #endif |
902173a3 |
161 | #define ENV_IS_CASELESS |
162 | |
479b2847 |
163 | #define PIPESOCK_MODE "b" /* pipes, sockets default to binmode */ |
164 | |
d41de25a |
165 | #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ |
f3986ebb |
166 | #define VER_PLATFORM_WIN32_WINDOWS 1 |
167 | #endif |
168 | |
d41de25a |
169 | #ifndef FILE_SHARE_DELETE /* VC-4.0 headers don't have this */ |
170 | #define FILE_SHARE_DELETE 0x00000004 |
171 | #endif |
172 | |
327c3667 |
173 | /* access() mode bits */ |
174 | #ifndef R_OK |
175 | # define R_OK 4 |
176 | # define W_OK 2 |
177 | # define X_OK 1 |
178 | # define F_OK 0 |
179 | #endif |
180 | |
cc236deb |
181 | /* for waitpid() */ |
182 | #ifndef WNOHANG |
183 | # define WNOHANG 1 |
184 | #endif |
185 | |
c44d3fdb |
186 | #define PERL_GET_CONTEXT_DEFINED |
187 | |
f3986ebb |
188 | /* Compiler-specific stuff. */ |
189 | |
654eccd5 |
190 | #if defined(_MSC_VER) || defined(__MINGW32__) |
191 | /* VC uses non-standard way to determine the size and alignment if bit-fields */ |
192 | /* MinGW will compiler with -mms-bitfields, so should use the same types */ |
193 | # define PERL_BITFIELD8 unsigned char |
194 | # define PERL_BITFIELD16 unsigned short |
195 | # define PERL_BITFIELD32 unsigned int |
196 | #endif |
197 | |
910dfcc8 |
198 | #ifdef __BORLANDC__ /* Borland C++ */ |
3e3baf6d |
199 | |
cb359b41 |
200 | #if (__BORLANDC__ <= 0x520) |
3e3baf6d |
201 | #define _access access |
202 | #define _chdir chdir |
cb359b41 |
203 | #endif |
204 | |
4ce4f76e |
205 | #define _getpid getpid |
26871e0a |
206 | #define wcsicmp _wcsicmp |
3e3baf6d |
207 | #include <sys/types.h> |
208 | |
84902520 |
209 | #ifndef DllMain |
210 | #define DllMain DllEntryPoint |
211 | #endif |
212 | |
dd01f956 |
213 | #pragma warn -8004 /* "'foo' is assigned a value that is never used" */ |
214 | #pragma warn -8008 /* "condition is always true/false" */ |
215 | #pragma warn -8012 /* "comparing signed and unsigned values" */ |
216 | #pragma warn -8027 /* "functions containing %s are not expanded inline" */ |
217 | #pragma warn -8057 /* "parameter 'foo' is never used" */ |
218 | #pragma warn -8060 /* "possibly incorrect assignment" */ |
219 | #pragma warn -8066 /* "unreachable code" */ |
220 | #pragma warn -8071 /* "conversion may lose significant digits" */ |
221 | #pragma warn -8080 /* "'foo' is declared but never used" */ |
3e3baf6d |
222 | |
cd183fd9 |
223 | /* Borland C thinks that a pointer to a member variable is 12 bytes in size. */ |
224 | #define PERL_MEMBER_PTR_SIZE 12 |
225 | |
1307044d |
226 | #define isnan _isnan |
227 | |
910dfcc8 |
228 | #endif |
3e3baf6d |
229 | |
f3986ebb |
230 | #ifdef _MSC_VER /* Microsoft Visual C++ */ |
231 | |
f4257e4d |
232 | #ifndef UNDER_CE |
0a753a76 |
233 | typedef long uid_t; |
234 | typedef long gid_t; |
a6c40364 |
235 | typedef unsigned short mode_t; |
f4257e4d |
236 | #endif |
237 | |
c623ac67 |
238 | #pragma warning(disable: 4102) /* "unreferenced label" */ |
f3986ebb |
239 | |
0f4eea8f |
240 | /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */ |
cd183fd9 |
241 | #define PERL_MEMBER_PTR_SIZE 16 |
0f4eea8f |
242 | |
5fb4d820 |
243 | #define isnan _isnan |
80e18237 |
244 | #define snprintf _snprintf |
245 | #define vsnprintf _vsnprintf |
5fb4d820 |
246 | |
cab190d4 |
247 | #if _MSC_VER < 1300 |
248 | /* VC6 has broken NaN semantics: NaN == NaN returns true instead of false */ |
249 | #define NAN_COMPARE_BROKEN 1 |
250 | #endif |
251 | |
f3986ebb |
252 | #endif /* _MSC_VER */ |
253 | |
910dfcc8 |
254 | #ifdef __MINGW32__ /* Minimal Gnu-Win32 */ |
255 | |
256 | typedef long uid_t; |
257 | typedef long gid_t; |
b1d1613b |
258 | #ifndef _environ |
3730b96e |
259 | #define _environ environ |
b1d1613b |
260 | #endif |
3730b96e |
261 | #define flushall _flushall |
262 | #define fcloseall _fcloseall |
44604af1 |
263 | #ifndef isnan |
6940069f |
264 | #define isnan _isnan /* ...same libraries as MSVC */ |
44604af1 |
265 | #endif |
910dfcc8 |
266 | |
ac4c12e7 |
267 | #ifndef _O_NOINHERIT |
268 | # define _O_NOINHERIT 0x0080 |
269 | # ifndef _NO_OLDNAMES |
270 | # define O_NOINHERIT _O_NOINHERIT |
271 | # endif |
272 | #endif |
273 | |
8659febc |
274 | /* <stdint.h>, pulled in by <io.h> as of mingw-runtime-3.3, typedef's |
275 | * (u)intptr_t but doesn't set the _(U)INTPTR_T_DEFINED defines */ |
276 | #ifdef _STDINT_H |
277 | # ifndef _INTPTR_T_DEFINED |
278 | # define _INTPTR_T_DEFINED |
279 | # endif |
280 | # ifndef _UINTPTR_T_DEFINED |
281 | # define _UINTPTR_T_DEFINED |
282 | # endif |
283 | #endif |
284 | |
910dfcc8 |
285 | #endif /* __MINGW32__ */ |
286 | |
f8fb7c90 |
287 | /* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */ |
288 | #ifndef CP_UTF8 |
289 | # define CP_UTF8 65001 |
290 | #endif |
291 | |
f3986ebb |
292 | /* compatibility stuff for other compilers goes here */ |
0a753a76 |
293 | |
c623ac67 |
294 | #ifndef _INTPTR_T_DEFINED |
295 | typedef int intptr_t; |
296 | # define _INTPTR_T_DEFINED |
297 | #endif |
298 | |
299 | #ifndef _UINTPTR_T_DEFINED |
300 | typedef unsigned int uintptr_t; |
301 | # define _UINTPTR_T_DEFINED |
302 | #endif |
303 | |
390b85e7 |
304 | START_EXTERN_C |
f3986ebb |
305 | |
306 | /* For UNIX compatibility. */ |
307 | |
0a753a76 |
308 | extern uid_t getuid(void); |
309 | extern gid_t getgid(void); |
310 | extern uid_t geteuid(void); |
311 | extern gid_t getegid(void); |
0a753a76 |
312 | extern int setuid(uid_t uid); |
313 | extern int setgid(gid_t gid); |
314 | extern int kill(int pid, int sig); |
542cb85f |
315 | extern int killpg(int pid, int sig); |
c623ac67 |
316 | #ifndef USE_PERL_SBRK |
317 | extern void *sbrk(ptrdiff_t need); |
318 | # define HAS_SBRK_PROTO |
319 | #endif |
e34ffe5a |
320 | extern char * getlogin(void); |
b990f8c8 |
321 | extern int chown(const char *p, uid_t o, gid_t g); |
00b02797 |
322 | extern int mkstemp(const char *path); |
d55594ae |
323 | |
f3986ebb |
324 | #undef Stat |
325 | #define Stat win32_stat |
3e3baf6d |
326 | |
f3986ebb |
327 | #undef init_os_extras |
328 | #define init_os_extras Perl_init_os_extras |
390b85e7 |
329 | |
22239a37 |
330 | DllExport void Perl_win32_init(int *argcp, char ***argvp); |
23f519f0 |
331 | DllExport void Perl_win32_term(void); |
cb359b41 |
332 | DllExport void Perl_init_os_extras(void); |
c5be433b |
333 | DllExport void win32_str_os_error(void *sv, DWORD err); |
334 | DllExport int RunPerl(int argc, char **argv, char **env); |
0551aaa8 |
335 | |
635bbe87 |
336 | typedef struct { |
337 | HANDLE childStdIn; |
338 | HANDLE childStdOut; |
339 | HANDLE childStdErr; |
f83751a7 |
340 | /* |
341 | * the following correspond to the fields of the same name |
342 | * in the STARTUPINFO structure. Embedders can use these to |
343 | * control the spawning process' look. |
344 | * Example - to hide the window of the spawned process: |
345 | * dwFlags = STARTF_USESHOWWINDOW; |
346 | * wShowWindow = SW_HIDE; |
347 | */ |
348 | DWORD dwFlags; |
3fadfdf1 |
349 | DWORD dwX; |
350 | DWORD dwY; |
351 | DWORD dwXSize; |
352 | DWORD dwYSize; |
353 | DWORD dwXCountChars; |
354 | DWORD dwYCountChars; |
f83751a7 |
355 | DWORD dwFillAttribute; |
3fadfdf1 |
356 | WORD wShowWindow; |
635bbe87 |
357 | } child_IO_table; |
358 | |
359 | DllExport void win32_get_child_IO(child_IO_table* ptr); |
b69b0499 |
360 | DllExport HWND win32_create_message_window(void); |
635bbe87 |
361 | |
f3986ebb |
362 | #ifndef USE_SOCKETS_AS_HANDLES |
363 | extern FILE * my_fdopen(int, char *); |
d55594ae |
364 | #endif |
f3986ebb |
365 | extern int my_fclose(FILE *); |
c623ac67 |
366 | extern int my_fstat(int fd, Stat_t *sbufptr); |
e6a0bbf8 |
367 | extern char * win32_get_privlib(const char *pl, STRLEN *const len); |
368 | extern char * win32_get_sitelib(const char *pl, STRLEN *const len); |
369 | extern char * win32_get_vendorlib(const char *pl, STRLEN *const len); |
f3986ebb |
370 | extern int IsWin95(void); |
371 | extern int IsWinNT(void); |
d55594ae |
372 | |
1c0ca838 |
373 | #ifdef PERL_IMPLICIT_SYS |
374 | extern void win32_delete_internal_host(void *h); |
375 | #endif |
376 | |
f3986ebb |
377 | extern char * staticlinkmodules[]; |
390b85e7 |
378 | |
379 | END_EXTERN_C |
d55594ae |
380 | |
68dc0745 |
381 | typedef char * caddr_t; /* In malloc.c (core address). */ |
0a753a76 |
382 | |
68dc0745 |
383 | /* |
68dc0745 |
384 | * handle socket stuff, assuming socket is always available |
385 | */ |
0a753a76 |
386 | #include <sys/socket.h> |
387 | #include <netdb.h> |
388 | |
bbc8f9de |
389 | #ifdef MYMALLOC |
390 | #define EMBEDMYMALLOC /**/ |
391 | /* #define USE_PERL_SBRK /**/ |
392 | /* #define PERL_SBRK_VIA_MALLOC /**/ |
393 | #endif |
394 | |
e68cb057 |
395 | #ifdef PERL_TEXTMODE_SCRIPTS |
c39cd008 |
396 | # define PERL_SCRIPT_MODE "r" |
a868473f |
397 | #else |
c39cd008 |
398 | # define PERL_SCRIPT_MODE "rb" |
a868473f |
399 | #endif |
400 | |
3fadfdf1 |
401 | /* |
402 | * Now Win32 specific per-thread data stuff |
3352bfcb |
403 | */ |
404 | |
aeecf691 |
405 | /* Leave the first couple ids after WM_USER unused because they |
406 | * might be used by an embedding application, and on Windows |
407 | * version before 2000 we might end up eating those messages |
408 | * if they were not meant for us. |
409 | */ |
410 | #define WM_USER_MIN (WM_USER+30) |
411 | #define WM_USER_MESSAGE (WM_USER_MIN) |
412 | #define WM_USER_KILL (WM_USER_MIN+1) |
413 | #define WM_USER_MAX (WM_USER_MIN+1) |
414 | |
3352bfcb |
415 | struct thread_intern { |
416 | /* XXX can probably use one buffer instead of several */ |
417 | char Wstrerror_buffer[512]; |
418 | struct servent Wservent; |
419 | char Wgetlogin_buffer[128]; |
f4257e4d |
420 | # ifdef USE_SOCKETS_AS_HANDLES |
421 | int Winit_socktype; |
422 | # endif |
3352bfcb |
423 | # ifdef HAVE_DES_FCRYPT |
424 | char Wcrypt_buffer[30]; |
425 | # endif |
426 | # ifdef USE_RTL_THREAD_API |
427 | void * retv; /* slot for thread return value */ |
428 | # endif |
02637f4c |
429 | BOOL Wuse_showwindow; |
430 | WORD Wshowwindow; |
3352bfcb |
431 | }; |
432 | |
4b556e6c |
433 | #define HAVE_INTERP_INTERN |
0aaad0ff |
434 | typedef struct { |
435 | long num; |
436 | DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
7766f137 |
437 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
0aaad0ff |
438 | } child_tab; |
439 | |
aeecf691 |
440 | #ifdef USE_ITHREADS |
441 | typedef struct { |
442 | long num; |
443 | DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
444 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
445 | HWND message_hwnds[MAXIMUM_WAIT_OBJECTS]; |
446 | } pseudo_child_tab; |
447 | #endif |
448 | |
3fadfdf1 |
449 | #ifndef Sighandler_t |
450 | typedef Signal_t (*Sighandler_t) (int); |
451 | #define Sighandler_t Sighandler_t |
452 | #endif |
453 | |
4b556e6c |
454 | struct interp_intern { |
0aaad0ff |
455 | char * perlshell_tokens; |
456 | char ** perlshell_vec; |
457 | long perlshell_items; |
458 | struct av * fdpid; |
459 | child_tab * children; |
7766f137 |
460 | #ifdef USE_ITHREADS |
461 | DWORD pseudo_id; |
aeecf691 |
462 | pseudo_child_tab * pseudo_children; |
7766f137 |
463 | #endif |
464 | void * internal_host; |
3352bfcb |
465 | struct thread_intern thr_intern; |
aeecf691 |
466 | HWND message_hwnd; |
8fb3fcfb |
467 | UINT timerid; |
05ec9bb3 |
468 | unsigned poll_count; |
3fadfdf1 |
469 | Sighandler_t sigtable[SIG_SIZE]; |
4b556e6c |
470 | }; |
471 | |
8fb3fcfb |
472 | DllExport int win32_async_check(pTHX); |
473 | |
05ec9bb3 |
474 | #define WIN32_POLL_INTERVAL 32768 |
8fb3fcfb |
475 | #define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending) win32_async_check(aTHX) |
4b556e6c |
476 | |
0aaad0ff |
477 | #define w32_perlshell_tokens (PL_sys_intern.perlshell_tokens) |
478 | #define w32_perlshell_vec (PL_sys_intern.perlshell_vec) |
479 | #define w32_perlshell_items (PL_sys_intern.perlshell_items) |
480 | #define w32_fdpid (PL_sys_intern.fdpid) |
481 | #define w32_children (PL_sys_intern.children) |
482 | #define w32_num_children (w32_children->num) |
483 | #define w32_child_pids (w32_children->pids) |
7766f137 |
484 | #define w32_child_handles (w32_children->handles) |
485 | #define w32_pseudo_id (PL_sys_intern.pseudo_id) |
486 | #define w32_pseudo_children (PL_sys_intern.pseudo_children) |
487 | #define w32_num_pseudo_children (w32_pseudo_children->num) |
488 | #define w32_pseudo_child_pids (w32_pseudo_children->pids) |
489 | #define w32_pseudo_child_handles (w32_pseudo_children->handles) |
aeecf691 |
490 | #define w32_pseudo_child_message_hwnds (w32_pseudo_children->message_hwnds) |
7766f137 |
491 | #define w32_internal_host (PL_sys_intern.internal_host) |
8fb3fcfb |
492 | #define w32_timerid (PL_sys_intern.timerid) |
aeecf691 |
493 | #define w32_message_hwnd (PL_sys_intern.message_hwnd) |
3fadfdf1 |
494 | #define w32_sighandler (PL_sys_intern.sigtable) |
05ec9bb3 |
495 | #define w32_poll_count (PL_sys_intern.poll_count) |
496 | #define w32_do_async (w32_poll_count++ > WIN32_POLL_INTERVAL) |
3db8f154 |
497 | #define w32_strerror_buffer (PL_sys_intern.thr_intern.Wstrerror_buffer) |
498 | #define w32_getlogin_buffer (PL_sys_intern.thr_intern.Wgetlogin_buffer) |
499 | #define w32_crypt_buffer (PL_sys_intern.thr_intern.Wcrypt_buffer) |
500 | #define w32_servent (PL_sys_intern.thr_intern.Wservent) |
f4257e4d |
501 | #define w32_init_socktype (PL_sys_intern.thr_intern.Winit_socktype) |
3db8f154 |
502 | #define w32_use_showwindow (PL_sys_intern.thr_intern.Wuse_showwindow) |
503 | #define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow) |
c53bd28a |
504 | |
7766f137 |
505 | #ifdef USE_ITHREADS |
506 | # define PERL_WAIT_FOR_CHILDREN \ |
507 | STMT_START { \ |
508 | if (w32_pseudo_children && w32_num_pseudo_children) { \ |
509 | long children = w32_num_pseudo_children; \ |
510 | WaitForMultipleObjects(children, \ |
511 | w32_pseudo_child_handles, \ |
512 | TRUE, INFINITE); \ |
513 | while (children) \ |
514 | CloseHandle(w32_pseudo_child_handles[--children]); \ |
515 | } \ |
516 | } STMT_END |
517 | #endif |
518 | |
a10b7b7e |
519 | #if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) |
520 | #ifdef PERL_CORE |
521 | |
522 | /* C doesn't like repeat struct definitions */ |
df500c58 |
523 | #if defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION>=3) |
15689010 |
524 | #undef _CRTIMP |
525 | #endif |
a10b7b7e |
526 | #ifndef _CRTIMP |
527 | #define _CRTIMP __declspec(dllimport) |
528 | #endif |
529 | |
530 | /* |
531 | * Control structure for lowio file handles |
532 | */ |
533 | typedef struct { |
c623ac67 |
534 | intptr_t osfhnd;/* underlying OS file HANDLE */ |
a10b7b7e |
535 | char osfile; /* attributes of file (e.g., open in text mode?) */ |
536 | char pipech; /* one char buffer for handles opened on pipes */ |
537 | int lockinitflag; |
538 | CRITICAL_SECTION lock; |
539 | } ioinfo; |
540 | |
541 | |
542 | /* |
543 | * Array of arrays of control structures for lowio files. |
544 | */ |
545 | EXTERN_C _CRTIMP ioinfo* __pioinfo[]; |
546 | |
547 | /* |
548 | * Definition of IOINFO_L2E, the log base 2 of the number of elements in each |
549 | * array of ioinfo structs. |
550 | */ |
551 | #define IOINFO_L2E 5 |
552 | |
553 | /* |
554 | * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array |
555 | */ |
556 | #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) |
557 | |
558 | /* |
559 | * Access macros for getting at an ioinfo struct and its fields from a |
560 | * file handle |
561 | */ |
562 | #define _pioinfo(i) (__pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1))) |
563 | #define _osfhnd(i) (_pioinfo(i)->osfhnd) |
564 | #define _osfile(i) (_pioinfo(i)->osfile) |
565 | #define _pipech(i) (_pioinfo(i)->pipech) |
566 | |
567 | /* since we are not doing a dup2(), this works fine */ |
c623ac67 |
568 | #define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = (intptr_t)osfh) |
a10b7b7e |
569 | #endif |
570 | #endif |
571 | |
3fadfdf1 |
572 | /* IO.xs and POSIX.xs define PERLIO_NOT_STDIO to 1 */ |
6e22d046 |
573 | #if defined(PERL_EXT_IO) || defined(PERL_EXT_POSIX) |
574 | #undef PERLIO_NOT_STDIO |
575 | #endif |
adb71456 |
576 | #define PERLIO_NOT_STDIO 0 |
577 | |
578 | #include "perlio.h" |
579 | |
4f63d024 |
580 | /* |
581 | * This provides a layer of functions and macros to ensure extensions will |
582 | * get to use the same RTL functions as the core. |
583 | */ |
584 | #include "win32iop.h" |
585 | |
b4748376 |
586 | #define EXEC_ARGV_CAST(x) ((const char *const *) x) |
587 | |
4fb841ef |
588 | #if !defined(ECONNABORTED) && defined(WSAECONNABORTED) |
589 | #define ECONNABORTED WSAECONNABORTED |
590 | #endif |
f2b62286 |
591 | #if !defined(ECONNRESET) && defined(WSAECONNRESET) |
592 | #define ECONNRESET WSAECONNRESET |
593 | #endif |
4fb841ef |
594 | #if !defined(EAFNOSUPPORT) && defined(WSAEAFNOSUPPORT) |
595 | #define EAFNOSUPPORT WSAEAFNOSUPPORT |
596 | #endif |
f2b62286 |
597 | /* Why not needed for ECONNREFUSED? --abe */ |
4fb841ef |
598 | |
f4958739 |
599 | DllExport void *win32_signal_context(void); |
1018e26f |
600 | #define PERL_GET_SIG_CONTEXT win32_signal_context() |
601 | |
45496817 |
602 | #ifdef UNDER_CE |
7bd379e8 |
603 | #define Win_GetModuleHandle XCEGetModuleHandleA |
604 | #define Win_GetProcAddress XCEGetProcAddressA |
605 | #define Win_GetModuleFileName XCEGetModuleFileNameA |
606 | #define Win_CreateSemaphore CreateSemaphoreW |
607 | #else |
608 | #define Win_GetModuleHandle GetModuleHandle |
609 | #define Win_GetProcAddress GetProcAddress |
610 | #define Win_GetModuleFileName GetModuleFileName |
611 | #define Win_CreateSemaphore CreateSemaphore |
612 | #endif |
613 | |
68dc0745 |
614 | #endif /* _INC_WIN32_PERL5 */ |
7a9ec5a3 |
615 | |