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