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