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