msvcr90: Added _get/set_invalid_parameter_handler implementation.
[wine] / dlls / msvcrt / msvcrt.h
1 /*
2  * Copyright 2001 Jon Griffiths
3  * Copyright 2004 Dimitrie O. Paun
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  *
19  * NOTES
20  *   Naming conventions
21  *      - Symbols are prefixed with MSVCRT_ if they conflict
22  *        with libc symbols
23  *      - Internal symbols are usually prefixed by msvcrt_.
24  *      - Exported symbols that are not present in the public
25  *        headers are usually kept the same as the original.
26  *   Other conventions
27  *      - To avoid conflicts with the standard C library,
28  *        no msvcrt headers are included in the implementation.
29  *      - Instead, symbols are duplicated here, prefixed with 
30  *        MSVCRT_, as explained above.
31  *      - To avoid inconsistencies, a test for each symbol is
32  *        added into tests/headers.c. Please always add a
33  *        corresponding test when you add a new symbol!
34  */
35
36 #ifndef __WINE_MSVCRT_H
37 #define __WINE_MSVCRT_H
38
39 #include <stdarg.h>
40
41 #include "windef.h"
42 #include "winbase.h"
43
44 #define MSVCRT_LONG_MAX    0x7fffffffL
45 #define MSVCRT_ULONG_MAX   0xffffffffUL
46
47 typedef unsigned short MSVCRT_wchar_t;
48 typedef unsigned short MSVCRT_wint_t;
49 typedef unsigned short MSVCRT_wctype_t;
50 typedef unsigned short MSVCRT__ino_t;
51 typedef unsigned int   MSVCRT__fsize_t;
52 typedef int            MSVCRT_long;
53 typedef unsigned int   MSVCRT_ulong;
54 #ifdef _WIN64
55 typedef unsigned __int64 MSVCRT_size_t;
56 typedef __int64 MSVCRT_intptr_t;
57 typedef unsigned __int64 MSVCRT_uintptr_t;
58 #else
59 typedef unsigned long MSVCRT_size_t;
60 typedef long MSVCRT_intptr_t;
61 typedef unsigned long MSVCRT_uintptr_t;
62 #endif
63 typedef unsigned int   MSVCRT__dev_t;
64 typedef int MSVCRT__off_t;
65 typedef int MSVCRT_clock_t;
66 typedef int MSVCRT___time32_t;
67 typedef __int64 DECLSPEC_ALIGN(8) MSVCRT___time64_t;
68 typedef __int64 DECLSPEC_ALIGN(8) MSVCRT_fpos_t;
69
70 typedef void (*__cdecl MSVCRT_terminate_handler)(void);
71 typedef void (*__cdecl MSVCRT_terminate_function)(void);
72 typedef void (*__cdecl MSVCRT_unexpected_handler)(void);
73 typedef void (*__cdecl MSVCRT_unexpected_function)(void);
74 typedef void (*__cdecl MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
75 typedef void (*__cdecl MSVCRT__beginthread_start_routine_t)(void *);
76 typedef unsigned int (__stdcall *MSVCRT__beginthreadex_start_routine_t)(void *);
77 typedef int (*__cdecl MSVCRT__onexit_t)(void);
78 typedef void (__cdecl *MSVCRT_invalid_parameter_handler)(const wchar_t*, const wchar_t*, const wchar_t*, unsigned, unsigned*);
79
80 typedef struct {long double x;} MSVCRT__LDOUBLE;
81
82 struct MSVCRT_tm {
83     int tm_sec;
84     int tm_min;
85     int tm_hour;
86     int tm_mday;
87     int tm_mon;
88     int tm_year;
89     int tm_wday;
90     int tm_yday;
91     int tm_isdst;
92 };
93
94
95 /* TLS data */
96 extern DWORD msvcrt_tls_index;
97
98 struct __thread_data {
99     int                             thread_errno;
100     MSVCRT_ulong                    thread_doserrno;
101     unsigned int                    random_seed;        /* seed for rand() */
102     char                           *strtok_next;        /* next ptr for strtok() */
103     unsigned char                  *mbstok_next;        /* next ptr for mbstok() */
104     MSVCRT_wchar_t                 *wcstok_next;        /* next ptr for wcstok() */
105     char                           *efcvt_buffer;       /* buffer for ecvt/fcvt */
106     char                           *asctime_buffer;     /* buffer for asctime */
107     MSVCRT_wchar_t                 *wasctime_buffer;    /* buffer for wasctime */
108     struct MSVCRT_tm                time_buffer;        /* buffer for localtime/gmtime */
109     char                           *strerror_buffer;    /* buffer for strerror */
110     int                             fpecode;
111     MSVCRT_terminate_function       terminate_handler;
112     MSVCRT_unexpected_function      unexpected_handler;
113     MSVCRT__se_translator_function  se_translator;
114     EXCEPTION_RECORD               *exc_record;
115 };
116
117 typedef struct __thread_data thread_data_t;
118
119 extern thread_data_t *msvcrt_get_thread_data(void);
120
121 extern int MSVCRT___lc_codepage;
122 extern int MSVCRT___lc_collate_cp;
123 extern int MSVCRT___mb_cur_max;
124 extern LCID MSVCRT_current_lc_all_lcid;
125 extern WORD MSVCRT__ctype [257];
126 extern WORD MSVCRT_current_ctype[257];
127 extern WORD* MSVCRT__pctype;
128 extern MSVCRT_invalid_parameter_handler MSVCRT_invalid_parameter;
129
130 void   msvcrt_set_errno(int);
131
132 void __cdecl _purecall(void);
133 void __cdecl _amsg_exit(int errnum);
134
135 extern char **MSVCRT__environ;
136 extern MSVCRT_wchar_t **MSVCRT__wenviron;
137
138 extern char ** msvcrt_SnapshotOfEnvironmentA(char **);
139 extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **);
140
141 MSVCRT_wchar_t *msvcrt_wstrdupa(const char *);
142
143 /* FIXME: This should be declared in new.h but it's not an extern "C" so
144  * it would not be much use anyway. Even for Winelib applications.
145  */
146 int __cdecl MSVCRT__set_new_mode(int mode);
147
148 void* __cdecl MSVCRT_operator_new(MSVCRT_size_t);
149 void __cdecl MSVCRT_operator_delete(void*);
150
151 typedef void* (*__cdecl malloc_func_t)(MSVCRT_size_t);
152 typedef void  (*__cdecl free_func_t)(void*);
153
154 extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
155 extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
156
157 /* Setup and teardown multi threaded locks */
158 extern void msvcrt_init_mt_locks(void);
159 extern void msvcrt_free_mt_locks(void);
160
161 extern void msvcrt_init_io(void);
162 extern void msvcrt_free_io(void);
163 extern void msvcrt_init_console(void);
164 extern void msvcrt_free_console(void);
165 extern void msvcrt_init_args(void);
166 extern void msvcrt_free_args(void);
167 extern void msvcrt_init_signals(void);
168 extern void msvcrt_free_signals(void);
169
170 extern unsigned msvcrt_create_io_inherit_block(WORD*, BYTE**);
171
172 /* run-time error codes */
173 #define _RT_STACK       0
174 #define _RT_NULLPTR     1
175 #define _RT_FLOAT       2
176 #define _RT_INTDIV      3
177 #define _RT_EXECMEM     5
178 #define _RT_EXECFORM    6
179 #define _RT_EXECENV     7
180 #define _RT_SPACEARG    8
181 #define _RT_SPACEENV    9
182 #define _RT_ABORT       10
183 #define _RT_NPTR        12
184 #define _RT_FPTR        13
185 #define _RT_BREAK       14
186 #define _RT_INT         15
187 #define _RT_THREAD      16
188 #define _RT_LOCK        17
189 #define _RT_HEAP        18
190 #define _RT_OPENCON     19
191 #define _RT_QWIN        20
192 #define _RT_NOMAIN      21
193 #define _RT_NONCONT     22
194 #define _RT_INVALDISP   23
195 #define _RT_ONEXIT      24
196 #define _RT_PUREVIRT    25
197 #define _RT_STDIOINIT   26
198 #define _RT_LOWIOINIT   27
199 #define _RT_HEAPINIT    28
200 #define _RT_DOMAIN      120
201 #define _RT_SING        121
202 #define _RT_TLOSS       122
203 #define _RT_CRNL        252
204 #define _RT_BANNER      255
205
206 struct MSVCRT___timeb32 {
207     MSVCRT___time32_t  time;
208     unsigned short millitm;
209     short          timezone;
210     short          dstflag;
211 };
212
213 struct MSVCRT___timeb64 {
214     MSVCRT___time64_t time;
215     unsigned short millitm;
216     short          timezone;
217     short          dstflag;
218 };
219
220 struct MSVCRT__iobuf {
221   char* _ptr;
222   int   _cnt;
223   char* _base;
224   int   _flag;
225   int   _file;
226   int   _charbuf;
227   int   _bufsiz;
228   char* _tmpfname;
229 };
230
231 typedef struct MSVCRT__iobuf MSVCRT_FILE;
232
233 struct MSVCRT_lconv {
234     char* decimal_point;
235     char* thousands_sep;
236     char* grouping;
237     char* int_curr_symbol;
238     char* currency_symbol;
239     char* mon_decimal_point;
240     char* mon_thousands_sep;
241     char* mon_grouping;
242     char* positive_sign;
243     char* negative_sign;
244     char int_frac_digits;
245     char frac_digits;
246     char p_cs_precedes;
247     char p_sep_by_space;
248     char n_cs_precedes;
249     char n_sep_by_space;
250     char p_sign_posn;
251     char n_sign_posn;
252 };
253
254 struct MSVCRT__exception {
255   int     type;
256   char*   name;
257   double  arg1;
258   double  arg2;
259   double  retval;
260 };
261
262 struct MSVCRT__complex {
263   double x;      /* Real part */
264   double y;      /* Imaginary part */
265 };
266
267 typedef struct MSVCRT__div_t {
268     int quot;  /* quotient */
269     int rem;   /* remainder */
270 } MSVCRT_div_t;
271
272 typedef struct MSVCRT__ldiv_t {
273     MSVCRT_long quot;  /* quotient */
274     MSVCRT_long rem;   /* remainder */
275 } MSVCRT_ldiv_t;
276
277 struct MSVCRT__heapinfo {
278   int*           _pentry;
279   MSVCRT_size_t  _size;
280   int            _useflag;
281 };
282
283 #ifdef __i386__
284 struct MSVCRT___JUMP_BUFFER {
285     unsigned long Ebp;
286     unsigned long Ebx;
287     unsigned long Edi;
288     unsigned long Esi;
289     unsigned long Esp;
290     unsigned long Eip;
291     unsigned long Registration;
292     unsigned long TryLevel;
293     /* Start of new struct members */
294     unsigned long Cookie;
295     unsigned long UnwindFunc;
296     unsigned long UnwindData[6];
297 };
298 #endif /* __i386__ */
299
300 struct MSVCRT__diskfree_t {
301   unsigned int total_clusters;
302   unsigned int avail_clusters;
303   unsigned int sectors_per_cluster;
304   unsigned int bytes_per_sector;
305 };
306
307 struct MSVCRT__finddata32_t {
308   unsigned int      attrib;
309   MSVCRT___time32_t time_create;
310   MSVCRT___time32_t time_access;
311   MSVCRT___time32_t time_write;
312   MSVCRT__fsize_t   size;
313   char              name[260];
314 };
315
316 struct MSVCRT__finddata32i64_t {
317   unsigned int      attrib;
318   MSVCRT___time32_t time_create;
319   MSVCRT___time32_t time_access;
320   MSVCRT___time32_t time_write;
321   __int64 DECLSPEC_ALIGN(8) size;
322   char              name[260];
323 };
324
325 struct MSVCRT__finddata64i32_t {
326   unsigned int      attrib;
327   MSVCRT___time64_t time_create;
328   MSVCRT___time64_t time_access;
329   MSVCRT___time64_t time_write;
330   MSVCRT__fsize_t   size;
331   char              name[260];
332 };
333
334 struct MSVCRT__finddata64_t {
335   unsigned int      attrib;
336   MSVCRT___time64_t time_create;
337   MSVCRT___time64_t time_access;
338   MSVCRT___time64_t time_write;
339   __int64 DECLSPEC_ALIGN(8) size;
340   char              name[260];
341 };
342
343 struct MSVCRT__wfinddata32_t {
344   unsigned int      attrib;
345   MSVCRT___time32_t time_create;
346   MSVCRT___time32_t time_access;
347   MSVCRT___time32_t time_write;
348   MSVCRT__fsize_t   size;
349   MSVCRT_wchar_t    name[260];
350 };
351
352 struct MSVCRT__wfinddata32i64_t {
353   unsigned int      attrib;
354   MSVCRT___time32_t time_create;
355   MSVCRT___time32_t time_access;
356   MSVCRT___time32_t time_write;
357   __int64 DECLSPEC_ALIGN(8) size;
358   MSVCRT_wchar_t    name[260];
359 };
360
361 struct MSVCRT__wfinddata64i32_t {
362   unsigned int      attrib;
363   MSVCRT___time64_t time_create;
364   MSVCRT___time64_t time_access;
365   MSVCRT___time64_t time_write;
366   MSVCRT__fsize_t   size;
367   MSVCRT_wchar_t    name[260];
368 };
369
370 struct MSVCRT__wfinddata64_t {
371   unsigned int      attrib;
372   MSVCRT___time64_t time_create;
373   MSVCRT___time64_t time_access;
374   MSVCRT___time64_t time_write;
375   __int64 DECLSPEC_ALIGN(8) size;
376   MSVCRT_wchar_t    name[260];
377 };
378
379 struct MSVCRT___utimbuf32
380 {
381     MSVCRT___time32_t actime;
382     MSVCRT___time32_t modtime;
383 };
384
385 struct MSVCRT___utimbuf64
386 {
387     MSVCRT___time64_t actime;
388     MSVCRT___time64_t modtime;
389 };
390
391 /* for FreeBSD */
392 #undef st_atime
393 #undef st_ctime
394 #undef st_mtime
395
396 struct MSVCRT__stat32 {
397   MSVCRT__dev_t     st_dev;
398   MSVCRT__ino_t     st_ino;
399   unsigned short    st_mode;
400   short             st_nlink;
401   short             st_uid;
402   short             st_gid;
403   MSVCRT__dev_t     st_rdev;
404   MSVCRT__off_t     st_size;
405   MSVCRT___time32_t st_atime;
406   MSVCRT___time32_t st_mtime;
407   MSVCRT___time32_t st_ctime;
408 };
409
410 struct MSVCRT__stat32i64 {
411   MSVCRT__dev_t     st_dev;
412   MSVCRT__ino_t     st_ino;
413   unsigned short    st_mode;
414   short             st_nlink;
415   short             st_uid;
416   short             st_gid;
417   MSVCRT__dev_t     st_rdev;
418   __int64 DECLSPEC_ALIGN(8) st_size;
419   MSVCRT___time32_t st_atime;
420   MSVCRT___time32_t st_mtime;
421   MSVCRT___time32_t st_ctime;
422 };
423
424 struct MSVCRT__stat64i32 {
425   MSVCRT__dev_t     st_dev;
426   MSVCRT__ino_t     st_ino;
427   unsigned short    st_mode;
428   short             st_nlink;
429   short             st_uid;
430   short             st_gid;
431   MSVCRT__dev_t     st_rdev;
432   MSVCRT__off_t     st_size;
433   MSVCRT___time64_t st_atime;
434   MSVCRT___time64_t st_mtime;
435   MSVCRT___time64_t st_ctime;
436 };
437
438 struct MSVCRT__stat64 {
439   MSVCRT__dev_t     st_dev;
440   MSVCRT__ino_t     st_ino;
441   unsigned short    st_mode;
442   short             st_nlink;
443   short             st_uid;
444   short             st_gid;
445   MSVCRT__dev_t     st_rdev;
446   __int64 DECLSPEC_ALIGN(8) st_size;
447   MSVCRT___time64_t st_atime;
448   MSVCRT___time64_t st_mtime;
449   MSVCRT___time64_t st_ctime;
450 };
451
452 #ifdef _WIN64
453 #define MSVCRT__finddata_t     MSVCRT__finddata64i32_t
454 #define MSVCRT__finddatai64_t  MSVCRT__finddata64_t
455 #define MSVCRT__wfinddata_t    MSVCRT__wfinddata64i32_t
456 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata64_t
457 #define MSVCRT__stat           MSVCRT__stat64i32
458 #define MSVCRT__stati64        MSVCRT__stat64
459 #else
460 #define MSVCRT__finddata_t     MSVCRT__finddata32_t
461 #define MSVCRT__finddatai64_t  MSVCRT__finddata32i64_t
462 #define MSVCRT__wfinddata_t    MSVCRT__wfinddata32_t
463 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata32i64_t
464 #define MSVCRT__stat           MSVCRT__stat32
465 #define MSVCRT__stati64        MSVCRT__stat32i64
466 #endif
467
468 #define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
469 #define MSVCRT_EOF       (-1)
470 #define MSVCRT_TMP_MAX   0x7fff
471 #define MSVCRT_RAND_MAX  0x7fff
472 #define MSVCRT_BUFSIZ    512
473
474 #define MSVCRT_STDIN_FILENO  0
475 #define MSVCRT_STDOUT_FILENO 1
476 #define MSVCRT_STDERR_FILENO 2
477
478 /* more file._flag flags, but these conflict with Unix */
479 #define MSVCRT__IOFBF    0x0000
480 #define MSVCRT__IONBF    0x0004
481 #define MSVCRT__IOLBF    0x0040
482
483 #define MSVCRT_FILENAME_MAX 260
484 #define MSVCRT_DRIVE_MAX    3
485 #define MSVCRT_FNAME_MAX    256
486 #define MSVCRT_DIR_MAX      256
487 #define MSVCRT_EXT_MAX      256
488 #define MSVCRT_PATH_MAX     260
489 #define MSVCRT_stdin       (MSVCRT__iob+MSVCRT_STDIN_FILENO)
490 #define MSVCRT_stdout      (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
491 #define MSVCRT_stderr      (MSVCRT__iob+MSVCRT_STDERR_FILENO)
492
493 #define MSVCRT__P_WAIT    0
494 #define MSVCRT__P_NOWAIT  1
495 #define MSVCRT__P_OVERLAY 2
496 #define MSVCRT__P_NOWAITO 3
497 #define MSVCRT__P_DETACH  4
498
499 #define MSVCRT_EPERM   1
500 #define MSVCRT_ENOENT  2
501 #define MSVCRT_ESRCH   3
502 #define MSVCRT_EINTR   4
503 #define MSVCRT_EIO     5
504 #define MSVCRT_ENXIO   6
505 #define MSVCRT_E2BIG   7
506 #define MSVCRT_ENOEXEC 8
507 #define MSVCRT_EBADF   9
508 #define MSVCRT_ECHILD  10
509 #define MSVCRT_EAGAIN  11
510 #define MSVCRT_ENOMEM  12
511 #define MSVCRT_EACCES  13
512 #define MSVCRT_EFAULT  14
513 #define MSVCRT_EBUSY   16
514 #define MSVCRT_EEXIST  17
515 #define MSVCRT_EXDEV   18
516 #define MSVCRT_ENODEV  19
517 #define MSVCRT_ENOTDIR 20
518 #define MSVCRT_EISDIR  21
519 #define MSVCRT_EINVAL  22
520 #define MSVCRT_ENFILE  23
521 #define MSVCRT_EMFILE  24
522 #define MSVCRT_ENOTTY  25
523 #define MSVCRT_EFBIG   27
524 #define MSVCRT_ENOSPC  28
525 #define MSVCRT_ESPIPE  29
526 #define MSVCRT_EROFS   30
527 #define MSVCRT_EMLINK  31
528 #define MSVCRT_EPIPE   32
529 #define MSVCRT_EDOM    33
530 #define MSVCRT_ERANGE  34
531 #define MSVCRT_EDEADLK 36
532 #define MSVCRT_EDEADLOCK MSVCRT_EDEADLK
533 #define MSVCRT_ENAMETOOLONG 38
534 #define MSVCRT_ENOLCK  39
535 #define MSVCRT_ENOSYS  40
536 #define MSVCRT_ENOTEMPTY 41
537 #define MSVCRT_EILSEQ    42
538
539 #define MSVCRT_LC_ALL          0
540 #define MSVCRT_LC_COLLATE      1
541 #define MSVCRT_LC_CTYPE        2
542 #define MSVCRT_LC_MONETARY     3
543 #define MSVCRT_LC_NUMERIC      4
544 #define MSVCRT_LC_TIME         5
545 #define MSVCRT_LC_MIN          MSVCRT_LC_ALL
546 #define MSVCRT_LC_MAX          MSVCRT_LC_TIME
547
548 #define MSVCRT__HEAPEMPTY      -1
549 #define MSVCRT__HEAPOK         -2
550 #define MSVCRT__HEAPBADBEGIN   -3
551 #define MSVCRT__HEAPBADNODE    -4
552 #define MSVCRT__HEAPEND        -5
553 #define MSVCRT__HEAPBADPTR     -6
554
555 #define MSVCRT__FREEENTRY      0
556 #define MSVCRT__USEDENTRY      1
557
558 #define MSVCRT__OUT_TO_DEFAULT 0
559 #define MSVCRT__REPORT_ERRMODE 3
560
561 /* ASCII char classification table - binary compatible */
562 #define MSVCRT__UPPER    0x0001  /* C1_UPPER */
563 #define MSVCRT__LOWER    0x0002  /* C1_LOWER */
564 #define MSVCRT__DIGIT    0x0004  /* C1_DIGIT */
565 #define MSVCRT__SPACE    0x0008  /* C1_SPACE */
566 #define MSVCRT__PUNCT    0x0010  /* C1_PUNCT */
567 #define MSVCRT__CONTROL  0x0020  /* C1_CNTRL */
568 #define MSVCRT__BLANK    0x0040  /* C1_BLANK */
569 #define MSVCRT__HEX      0x0080  /* C1_XDIGIT */
570 #define MSVCRT__LEADBYTE 0x8000
571 #define MSVCRT__ALPHA   (0x0100|MSVCRT__UPPER|MSVCRT__LOWER)  /* (C1_ALPHA|_UPPER|_LOWER) */
572
573 #define MSVCRT__IOREAD   0x0001
574 #define MSVCRT__IOWRT    0x0002
575 #define MSVCRT__IOMYBUF  0x0008
576 #define MSVCRT__IOEOF    0x0010
577 #define MSVCRT__IOERR    0x0020
578 #define MSVCRT__IOSTRG   0x0040
579 #define MSVCRT__IORW     0x0080
580
581 #define MSVCRT__S_IEXEC  0x0040
582 #define MSVCRT__S_IWRITE 0x0080
583 #define MSVCRT__S_IREAD  0x0100
584 #define MSVCRT__S_IFIFO  0x1000
585 #define MSVCRT__S_IFCHR  0x2000
586 #define MSVCRT__S_IFDIR  0x4000
587 #define MSVCRT__S_IFREG  0x8000
588 #define MSVCRT__S_IFMT   0xF000
589
590 #define MSVCRT__LK_UNLCK  0
591 #define MSVCRT__LK_LOCK   1
592 #define MSVCRT__LK_NBLCK  2
593 #define MSVCRT__LK_RLCK   3
594 #define MSVCRT__LK_NBRLCK 4
595
596 #define MSVCRT__SH_COMPAT       0x00    /* Compatibility */
597 #define MSVCRT__SH_DENYRW       0x10    /* Deny read/write */
598 #define MSVCRT__SH_DENYWR       0x20    /* Deny write */
599 #define MSVCRT__SH_DENYRD       0x30    /* Deny read */
600 #define MSVCRT__SH_DENYNO       0x40    /* Deny nothing */
601
602 #define MSVCRT__O_RDONLY        0
603 #define MSVCRT__O_WRONLY        1
604 #define MSVCRT__O_RDWR          2
605 #define MSVCRT__O_ACCMODE       (MSVCRT__O_RDONLY|MSVCRT__O_WRONLY|MSVCRT__O_RDWR)
606 #define MSVCRT__O_APPEND        0x0008
607 #define MSVCRT__O_RANDOM        0x0010
608 #define MSVCRT__O_SEQUENTIAL    0x0020
609 #define MSVCRT__O_TEMPORARY     0x0040
610 #define MSVCRT__O_NOINHERIT     0x0080
611 #define MSVCRT__O_CREAT         0x0100
612 #define MSVCRT__O_TRUNC         0x0200
613 #define MSVCRT__O_EXCL          0x0400
614 #define MSVCRT__O_SHORT_LIVED   0x1000
615 #define MSVCRT__O_TEXT          0x4000
616 #define MSVCRT__O_BINARY        0x8000
617 #define MSVCRT__O_RAW           MSVCRT__O_BINARY
618
619 /* _statusfp bit flags */
620 #define MSVCRT__SW_INEXACT      0x00000001 /* inexact (precision) */
621 #define MSVCRT__SW_UNDERFLOW    0x00000002 /* underflow */
622 #define MSVCRT__SW_OVERFLOW     0x00000004 /* overflow */
623 #define MSVCRT__SW_ZERODIVIDE   0x00000008 /* zero divide */
624 #define MSVCRT__SW_INVALID      0x00000010 /* invalid */
625
626 #define MSVCRT__SW_UNEMULATED     0x00000040  /* unemulated instruction */
627 #define MSVCRT__SW_SQRTNEG        0x00000080  /* square root of a neg number */
628 #define MSVCRT__SW_STACKOVERFLOW  0x00000200  /* FP stack overflow */
629 #define MSVCRT__SW_STACKUNDERFLOW 0x00000400  /* FP stack underflow */
630
631 #define MSVCRT__SW_DENORMAL     0x00080000 /* denormal status bit */
632
633 /* fpclass constants */
634 #define MSVCRT__FPCLASS_SNAN 0x0001  /* Signaling "Not a Number" */
635 #define MSVCRT__FPCLASS_QNAN 0x0002  /* Quiet "Not a Number" */
636 #define MSVCRT__FPCLASS_NINF 0x0004  /* Negative Infinity */
637 #define MSVCRT__FPCLASS_NN   0x0008  /* Negative Normal */
638 #define MSVCRT__FPCLASS_ND   0x0010  /* Negative Denormal */
639 #define MSVCRT__FPCLASS_NZ   0x0020  /* Negative Zero */
640 #define MSVCRT__FPCLASS_PZ   0x0040  /* Positive Zero */
641 #define MSVCRT__FPCLASS_PD   0x0080  /* Positive Denormal */
642 #define MSVCRT__FPCLASS_PN   0x0100  /* Positive Normal */
643 #define MSVCRT__FPCLASS_PINF 0x0200  /* Positive Infinity */
644
645 #define MSVCRT__EM_INVALID    0x00000010
646 #define MSVCRT__EM_DENORMAL   0x00080000
647 #define MSVCRT__EM_ZERODIVIDE 0x00000008
648 #define MSVCRT__EM_OVERFLOW   0x00000004
649 #define MSVCRT__EM_UNDERFLOW  0x00000002
650 #define MSVCRT__EM_INEXACT    0x00000001
651 #define MSVCRT__IC_AFFINE     0x00040000
652 #define MSVCRT__IC_PROJECTIVE 0x00000000
653 #define MSVCRT__RC_CHOP       0x00000300
654 #define MSVCRT__RC_UP         0x00000200
655 #define MSVCRT__RC_DOWN       0x00000100
656 #define MSVCRT__RC_NEAR       0x00000000
657 #define MSVCRT__PC_24         0x00020000
658 #define MSVCRT__PC_53         0x00010000
659 #define MSVCRT__PC_64         0x00000000
660
661 #define MSVCRT_CLOCKS_PER_SEC 1000
662
663 /* signals */
664 #define MSVCRT_SIGINT   2
665 #define MSVCRT_SIGILL   4
666 #define MSVCRT_SIGFPE   8
667 #define MSVCRT_SIGSEGV  11
668 #define MSVCRT_SIGTERM  15
669 #define MSVCRT_SIGBREAK 21
670 #define MSVCRT_SIGABRT  22
671 #define MSVCRT_NSIG     (MSVCRT_SIGABRT + 1)
672
673 typedef void (__cdecl *MSVCRT___sighandler_t)(int);
674
675 #define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
676 #define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
677 #define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
678
679 #define MSVCRT__FPE_INVALID            0x81
680 #define MSVCRT__FPE_DENORMAL           0x82
681 #define MSVCRT__FPE_ZERODIVIDE         0x83
682 #define MSVCRT__FPE_OVERFLOW           0x84
683 #define MSVCRT__FPE_UNDERFLOW          0x85
684 #define MSVCRT__FPE_INEXACT            0x86
685 #define MSVCRT__FPE_UNEMULATED         0x87
686 #define MSVCRT__FPE_SQRTNEG            0x88
687 #define MSVCRT__FPE_STACKOVERFLOW      0x8a
688 #define MSVCRT__FPE_STACKUNDERFLOW     0x8b
689 #define MSVCRT__FPE_EXPLICITGEN        0x8c
690
691 #define _MS     0x01
692 #define _MP     0x02
693 #define _M1     0x04
694 #define _M2     0x08
695
696 #define _SBUP   0x10
697 #define _SBLOW  0x20
698
699 #define _MBC_SINGLE     0
700 #define _MBC_LEAD       1
701 #define _MBC_TRAIL      2
702 #define _MBC_ILLEGAL    -1
703
704 #define _MB_CP_SBCS     0
705 #define _MB_CP_OEM      -2
706 #define _MB_CP_ANSI     -3
707 #define _MB_CP_LOCALE   -4
708
709 void  __cdecl    MSVCRT_free(void*);
710 void* __cdecl    MSVCRT_malloc(MSVCRT_size_t);
711 void* __cdecl    MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
712 void* __cdecl    MSVCRT_realloc(void*,MSVCRT_size_t);
713
714 int __cdecl      MSVCRT_iswalpha(MSVCRT_wint_t);
715 int __cdecl      MSVCRT_iswspace(MSVCRT_wint_t);
716 int __cdecl      MSVCRT_iswdigit(MSVCRT_wint_t);
717 int __cdecl      MSVCRT_isleadbyte(int);
718
719 int __cdecl      MSVCRT_fgetc(MSVCRT_FILE*);
720 int __cdecl      MSVCRT_ungetc(int,MSVCRT_FILE*);
721 MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
722 MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
723 void __cdecl     MSVCRT__exit(int);
724 void __cdecl     MSVCRT_abort(void);
725 MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
726 int* __cdecl     MSVCRT__errno(void);
727 char* __cdecl    MSVCRT_getenv(const char*);
728 char* __cdecl    MSVCRT_setlocale(int,const char*);
729 int __cdecl      MSVCRT_fclose(MSVCRT_FILE*);
730 void __cdecl     MSVCRT_terminate(void);
731 MSVCRT_FILE* __cdecl MSVCRT__iob_func(void);
732 MSVCRT_clock_t __cdecl MSVCRT_clock(void);
733 MSVCRT___time32_t __cdecl MSVCRT__time32(MSVCRT___time32_t*);
734 MSVCRT___time64_t __cdecl MSVCRT__time64(MSVCRT___time64_t*);
735 MSVCRT_FILE*   __cdecl MSVCRT__fdopen(int, const char *);
736 MSVCRT_FILE*   __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
737 int            __cdecl MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, __ms_va_list valist);
738 int            __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, unsigned int len,
739                                        const MSVCRT_wchar_t *format, __ms_va_list valist );
740 int            __cdecl MSVCRT_raise(int sig);
741
742 #ifndef __WINE_MSVCRT_TEST
743 int            __cdecl MSVCRT__write(int,const void*,unsigned int);
744 int            __cdecl _getch(void);
745 int            __cdecl _ismbblead(unsigned int);
746 int            __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
747 MSVCRT_intptr_t __cdecl _spawnve(int,const char*,const char* const *,const char* const *);
748 MSVCRT_intptr_t __cdecl _spawnvpe(int,const char*,const char* const *,const char* const *);
749 MSVCRT_intptr_t __cdecl _wspawnve(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
750 MSVCRT_intptr_t __cdecl _wspawnvpe(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
751 void __cdecl     _searchenv(const char*,const char*,char*);
752 int __cdecl      _getdrive(void);
753 char* __cdecl    _strdup(const char*);
754 char* __cdecl    _strnset(char*,int,MSVCRT_size_t);
755 char* __cdecl    _strset(char*,int);
756 int __cdecl      _ungetch(int);
757 int __cdecl      _cputs(const char*);
758 int __cdecl      _cprintf(const char*,...);
759 char*** __cdecl  __p__environ(void);
760 int*    __cdecl  __p___mb_cur_max(void);
761 unsigned int*  __cdecl __p__fmode(void);
762 MSVCRT_wchar_t* __cdecl _wcsdup(const MSVCRT_wchar_t*);
763 MSVCRT_wchar_t*** __cdecl __p__wenviron(void);
764 char*   __cdecl _strdate(char* date);
765 char*   __cdecl _strtime(char* date);
766 int     __cdecl _setmbcp(int);
767 int     __cdecl MSVCRT__close(int);
768 int     __cdecl MSVCRT__dup(int);
769 int     __cdecl MSVCRT__dup2(int, int);
770 int     __cdecl MSVCRT__pipe(int *, unsigned int, int);
771 MSVCRT_wchar_t* __cdecl _wgetenv(const MSVCRT_wchar_t*);
772 void __cdecl    _wsearchenv(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_wchar_t*);
773 #endif
774
775 #endif /* __WINE_MSVCRT_H */