wined3d: Add missing GL locking to ffp_blit_set() and ffp_blit_unset().
[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 typedef __int64 MSVCRT_time_t;
54 #else
55 typedef unsigned long MSVCRT_size_t;
56 typedef long MSVCRT_intptr_t;
57 typedef unsigned long MSVCRT_uintptr_t;
58 typedef long MSVCRT_time_t;
59 #endif
60 typedef unsigned int   MSVCRT__dev_t;
61 typedef int  MSVCRT__off_t;
62 typedef long MSVCRT_clock_t;
63 typedef long 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     unsigned long                   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__timeb {
202     MSVCRT_time_t  time;
203     unsigned short millitm;
204     short          timezone;
205     short          dstflag;
206 };
207
208 struct MSVCRT__iobuf {
209   char* _ptr;
210   int   _cnt;
211   char* _base;
212   int   _flag;
213   int   _file;
214   int   _charbuf;
215   int   _bufsiz;
216   char* _tmpfname;
217 };
218
219 typedef struct MSVCRT__iobuf MSVCRT_FILE;
220
221 struct MSVCRT_lconv {
222     char* decimal_point;
223     char* thousands_sep;
224     char* grouping;
225     char* int_curr_symbol;
226     char* currency_symbol;
227     char* mon_decimal_point;
228     char* mon_thousands_sep;
229     char* mon_grouping;
230     char* positive_sign;
231     char* negative_sign;
232     char int_frac_digits;
233     char frac_digits;
234     char p_cs_precedes;
235     char p_sep_by_space;
236     char n_cs_precedes;
237     char n_sep_by_space;
238     char p_sign_posn;
239     char n_sign_posn;
240 };
241
242 struct MSVCRT__exception {
243   int     type;
244   char*   name;
245   double  arg1;
246   double  arg2;
247   double  retval;
248 };
249
250 struct MSVCRT__complex {
251   double x;      /* Real part */
252   double y;      /* Imaginary part */
253 };
254
255 typedef struct MSVCRT__div_t {
256     int quot;  /* quotient */
257     int rem;   /* remainder */
258 } MSVCRT_div_t;
259
260 typedef struct MSVCRT__ldiv_t {
261     long quot;  /* quotient */
262     long rem;   /* remainder */
263 } MSVCRT_ldiv_t;
264
265 struct MSVCRT__heapinfo {
266   int*           _pentry;
267   MSVCRT_size_t  _size;
268   int            _useflag;
269 };
270
271 #ifdef __i386__
272 struct MSVCRT___JUMP_BUFFER {
273     unsigned long Ebp;
274     unsigned long Ebx;
275     unsigned long Edi;
276     unsigned long Esi;
277     unsigned long Esp;
278     unsigned long Eip;
279     unsigned long Registration;
280     unsigned long TryLevel;
281     /* Start of new struct members */
282     unsigned long Cookie;
283     unsigned long UnwindFunc;
284     unsigned long UnwindData[6];
285 };
286 #endif /* __i386__ */
287
288 struct MSVCRT__diskfree_t {
289   unsigned int total_clusters;
290   unsigned int avail_clusters;
291   unsigned int sectors_per_cluster;
292   unsigned int bytes_per_sector;
293 };
294
295 struct MSVCRT__finddata_t {
296   unsigned attrib;
297   MSVCRT_time_t   time_create;
298   MSVCRT_time_t   time_access;
299   MSVCRT_time_t   time_write;
300   MSVCRT__fsize_t size;
301   char            name[260];
302 };
303
304 struct MSVCRT__finddatai64_t {
305   unsigned attrib;
306   MSVCRT_time_t  time_create;
307   MSVCRT_time_t  time_access;
308   MSVCRT_time_t  time_write;
309   __int64        size;
310   char           name[260];
311 };
312
313 struct MSVCRT__wfinddata_t {
314   unsigned attrib;
315   MSVCRT_time_t   time_create;
316   MSVCRT_time_t   time_access;
317   MSVCRT_time_t   time_write;
318   MSVCRT__fsize_t size;
319   MSVCRT_wchar_t  name[260];
320 };
321
322 struct MSVCRT__wfinddatai64_t {
323   unsigned attrib;
324   MSVCRT_time_t   time_create;
325   MSVCRT_time_t   time_access;
326   MSVCRT_time_t   time_write;
327   __int64         size;
328   MSVCRT_wchar_t  name[260];
329 };
330
331 struct MSVCRT__utimbuf
332 {
333     MSVCRT_time_t actime;
334     MSVCRT_time_t modtime;
335 };
336
337 /* for FreeBSD */
338 #undef st_atime
339 #undef st_ctime
340 #undef st_mtime
341
342 struct MSVCRT__stat {
343   MSVCRT__dev_t  st_dev;
344   MSVCRT__ino_t  st_ino;
345   unsigned short st_mode;
346   short          st_nlink;
347   short          st_uid;
348   short          st_gid;
349   MSVCRT__dev_t  st_rdev;
350   MSVCRT__off_t  st_size;
351   MSVCRT_time_t  st_atime;
352   MSVCRT_time_t  st_mtime;
353   MSVCRT_time_t  st_ctime;
354 };
355
356 struct MSVCRT_stat {
357   MSVCRT__dev_t  st_dev;
358   MSVCRT__ino_t  st_ino;
359   unsigned short st_mode;
360   short          st_nlink;
361   short          st_uid;
362   short          st_gid;
363   MSVCRT__dev_t  st_rdev;
364   MSVCRT__off_t  st_size;
365   MSVCRT_time_t  st_atime;
366   MSVCRT_time_t  st_mtime;
367   MSVCRT_time_t  st_ctime;
368 };
369
370 struct MSVCRT__stati64 {
371   MSVCRT__dev_t  st_dev;
372   MSVCRT__ino_t  st_ino;
373   unsigned short st_mode;
374   short          st_nlink;
375   short          st_uid;
376   short          st_gid;
377   MSVCRT__dev_t  st_rdev;
378   __int64 DECLSPEC_ALIGN(8) st_size;
379   MSVCRT_time_t  st_atime;
380   MSVCRT_time_t  st_mtime;
381   MSVCRT_time_t  st_ctime;
382 };
383
384 struct MSVCRT__stat64 {
385   MSVCRT__dev_t     st_dev;
386   MSVCRT__ino_t     st_ino;
387   unsigned short    st_mode;
388   short             st_nlink;
389   short             st_uid;
390   short             st_gid;
391   MSVCRT__dev_t     st_rdev;
392   __int64 DECLSPEC_ALIGN(8) st_size;
393   MSVCRT___time64_t st_atime;
394   MSVCRT___time64_t st_mtime;
395   MSVCRT___time64_t st_ctime;
396 };
397
398 #define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
399 #define MSVCRT_EOF       (-1)
400 #define MSVCRT_TMP_MAX   0x7fff
401 #define MSVCRT_RAND_MAX  0x7fff
402 #define MSVCRT_BUFSIZ    512
403
404 #define MSVCRT_STDIN_FILENO  0
405 #define MSVCRT_STDOUT_FILENO 1
406 #define MSVCRT_STDERR_FILENO 2
407
408 /* more file._flag flags, but these conflict with Unix */
409 #define MSVCRT__IOFBF    0x0000
410 #define MSVCRT__IONBF    0x0004
411 #define MSVCRT__IOLBF    0x0040
412
413 #define MSVCRT_FILENAME_MAX 260
414 #define MSVCRT_DRIVE_MAX    3
415 #define MSVCRT_FNAME_MAX    256
416 #define MSVCRT_DIR_MAX      256
417 #define MSVCRT_EXT_MAX      256
418 #define MSVCRT_PATH_MAX     260
419 #define MSVCRT_stdin       (MSVCRT__iob+MSVCRT_STDIN_FILENO)
420 #define MSVCRT_stdout      (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
421 #define MSVCRT_stderr      (MSVCRT__iob+MSVCRT_STDERR_FILENO)
422
423 #define MSVCRT__P_WAIT    0
424 #define MSVCRT__P_NOWAIT  1
425 #define MSVCRT__P_OVERLAY 2
426 #define MSVCRT__P_NOWAITO 3
427 #define MSVCRT__P_DETACH  4
428
429 #define MSVCRT_EPERM   1
430 #define MSVCRT_ENOENT  2
431 #define MSVCRT_ESRCH   3
432 #define MSVCRT_EINTR   4
433 #define MSVCRT_EIO     5
434 #define MSVCRT_ENXIO   6
435 #define MSVCRT_E2BIG   7
436 #define MSVCRT_ENOEXEC 8
437 #define MSVCRT_EBADF   9
438 #define MSVCRT_ECHILD  10
439 #define MSVCRT_EAGAIN  11
440 #define MSVCRT_ENOMEM  12
441 #define MSVCRT_EACCES  13
442 #define MSVCRT_EFAULT  14
443 #define MSVCRT_EBUSY   16
444 #define MSVCRT_EEXIST  17
445 #define MSVCRT_EXDEV   18
446 #define MSVCRT_ENODEV  19
447 #define MSVCRT_ENOTDIR 20
448 #define MSVCRT_EISDIR  21
449 #define MSVCRT_EINVAL  22
450 #define MSVCRT_ENFILE  23
451 #define MSVCRT_EMFILE  24
452 #define MSVCRT_ENOTTY  25
453 #define MSVCRT_EFBIG   27
454 #define MSVCRT_ENOSPC  28
455 #define MSVCRT_ESPIPE  29
456 #define MSVCRT_EROFS   30
457 #define MSVCRT_EMLINK  31
458 #define MSVCRT_EPIPE   32
459 #define MSVCRT_EDOM    33
460 #define MSVCRT_ERANGE  34
461 #define MSVCRT_EDEADLK 36
462 #define MSVCRT_EDEADLOCK MSVCRT_EDEADLK
463 #define MSVCRT_ENAMETOOLONG 38
464 #define MSVCRT_ENOLCK  39
465 #define MSVCRT_ENOSYS  40
466 #define MSVCRT_ENOTEMPTY 41
467 #define MSVCRT_EILSEQ    42
468
469 #define MSVCRT_LC_ALL          0
470 #define MSVCRT_LC_COLLATE      1
471 #define MSVCRT_LC_CTYPE        2
472 #define MSVCRT_LC_MONETARY     3
473 #define MSVCRT_LC_NUMERIC      4
474 #define MSVCRT_LC_TIME         5
475 #define MSVCRT_LC_MIN          MSVCRT_LC_ALL
476 #define MSVCRT_LC_MAX          MSVCRT_LC_TIME
477
478 #define MSVCRT__HEAPEMPTY      -1
479 #define MSVCRT__HEAPOK         -2
480 #define MSVCRT__HEAPBADBEGIN   -3
481 #define MSVCRT__HEAPBADNODE    -4
482 #define MSVCRT__HEAPEND        -5
483 #define MSVCRT__HEAPBADPTR     -6
484
485 #define MSVCRT__FREEENTRY      0
486 #define MSVCRT__USEDENTRY      1
487
488 #define MSVCRT__OUT_TO_DEFAULT 0
489 #define MSVCRT__REPORT_ERRMODE 3
490
491 /* ASCII char classification table - binary compatible */
492 #define MSVCRT__UPPER    0x0001  /* C1_UPPER */
493 #define MSVCRT__LOWER    0x0002  /* C1_LOWER */
494 #define MSVCRT__DIGIT    0x0004  /* C1_DIGIT */
495 #define MSVCRT__SPACE    0x0008  /* C1_SPACE */
496 #define MSVCRT__PUNCT    0x0010  /* C1_PUNCT */
497 #define MSVCRT__CONTROL  0x0020  /* C1_CNTRL */
498 #define MSVCRT__BLANK    0x0040  /* C1_BLANK */
499 #define MSVCRT__HEX      0x0080  /* C1_XDIGIT */
500 #define MSVCRT__LEADBYTE 0x8000
501 #define MSVCRT__ALPHA   (0x0100|MSVCRT__UPPER|MSVCRT__LOWER)  /* (C1_ALPHA|_UPPER|_LOWER) */
502
503 #define MSVCRT__IOREAD   0x0001
504 #define MSVCRT__IOWRT    0x0002
505 #define MSVCRT__IOMYBUF  0x0008
506 #define MSVCRT__IOEOF    0x0010
507 #define MSVCRT__IOERR    0x0020
508 #define MSVCRT__IOSTRG   0x0040
509 #define MSVCRT__IORW     0x0080
510
511 #define MSVCRT__S_IEXEC  0x0040
512 #define MSVCRT__S_IWRITE 0x0080
513 #define MSVCRT__S_IREAD  0x0100
514 #define MSVCRT__S_IFIFO  0x1000
515 #define MSVCRT__S_IFCHR  0x2000
516 #define MSVCRT__S_IFDIR  0x4000
517 #define MSVCRT__S_IFREG  0x8000
518 #define MSVCRT__S_IFMT   0xF000
519
520 #define MSVCRT__LK_UNLCK  0
521 #define MSVCRT__LK_LOCK   1
522 #define MSVCRT__LK_NBLCK  2
523 #define MSVCRT__LK_RLCK   3
524 #define MSVCRT__LK_NBRLCK 4
525
526 #define MSVCRT__SH_COMPAT       0x00    /* Compatibility */
527 #define MSVCRT__SH_DENYRW       0x10    /* Deny read/write */
528 #define MSVCRT__SH_DENYWR       0x20    /* Deny write */
529 #define MSVCRT__SH_DENYRD       0x30    /* Deny read */
530 #define MSVCRT__SH_DENYNO       0x40    /* Deny nothing */
531
532 #define MSVCRT__O_RDONLY        0
533 #define MSVCRT__O_WRONLY        1
534 #define MSVCRT__O_RDWR          2
535 #define MSVCRT__O_ACCMODE       (MSVCRT__O_RDONLY|MSVCRT__O_WRONLY|MSVCRT__O_RDWR)
536 #define MSVCRT__O_APPEND        0x0008
537 #define MSVCRT__O_RANDOM        0x0010
538 #define MSVCRT__O_SEQUENTIAL    0x0020
539 #define MSVCRT__O_TEMPORARY     0x0040
540 #define MSVCRT__O_NOINHERIT     0x0080
541 #define MSVCRT__O_CREAT         0x0100
542 #define MSVCRT__O_TRUNC         0x0200
543 #define MSVCRT__O_EXCL          0x0400
544 #define MSVCRT__O_SHORT_LIVED   0x1000
545 #define MSVCRT__O_TEXT          0x4000
546 #define MSVCRT__O_BINARY        0x8000
547 #define MSVCRT__O_RAW           MSVCRT__O_BINARY
548
549 /* _statusfp bit flags */
550 #define MSVCRT__SW_INEXACT      0x00000001 /* inexact (precision) */
551 #define MSVCRT__SW_UNDERFLOW    0x00000002 /* underflow */
552 #define MSVCRT__SW_OVERFLOW     0x00000004 /* overflow */
553 #define MSVCRT__SW_ZERODIVIDE   0x00000008 /* zero divide */
554 #define MSVCRT__SW_INVALID      0x00000010 /* invalid */
555
556 #define MSVCRT__SW_UNEMULATED     0x00000040  /* unemulated instruction */
557 #define MSVCRT__SW_SQRTNEG        0x00000080  /* square root of a neg number */
558 #define MSVCRT__SW_STACKOVERFLOW  0x00000200  /* FP stack overflow */
559 #define MSVCRT__SW_STACKUNDERFLOW 0x00000400  /* FP stack underflow */
560
561 #define MSVCRT__SW_DENORMAL     0x00080000 /* denormal status bit */
562
563 /* fpclass constants */
564 #define MSVCRT__FPCLASS_SNAN 0x0001  /* Signaling "Not a Number" */
565 #define MSVCRT__FPCLASS_QNAN 0x0002  /* Quiet "Not a Number" */
566 #define MSVCRT__FPCLASS_NINF 0x0004  /* Negative Infinity */
567 #define MSVCRT__FPCLASS_NN   0x0008  /* Negative Normal */
568 #define MSVCRT__FPCLASS_ND   0x0010  /* Negative Denormal */
569 #define MSVCRT__FPCLASS_NZ   0x0020  /* Negative Zero */
570 #define MSVCRT__FPCLASS_PZ   0x0040  /* Positive Zero */
571 #define MSVCRT__FPCLASS_PD   0x0080  /* Positive Denormal */
572 #define MSVCRT__FPCLASS_PN   0x0100  /* Positive Normal */
573 #define MSVCRT__FPCLASS_PINF 0x0200  /* Positive Infinity */
574
575 #define MSVCRT__EM_INVALID    0x00000010
576 #define MSVCRT__EM_DENORMAL   0x00080000
577 #define MSVCRT__EM_ZERODIVIDE 0x00000008
578 #define MSVCRT__EM_OVERFLOW   0x00000004
579 #define MSVCRT__EM_UNDERFLOW  0x00000002
580 #define MSVCRT__EM_INEXACT    0x00000001
581 #define MSVCRT__IC_AFFINE     0x00040000
582 #define MSVCRT__IC_PROJECTIVE 0x00000000
583 #define MSVCRT__RC_CHOP       0x00000300
584 #define MSVCRT__RC_UP         0x00000200
585 #define MSVCRT__RC_DOWN       0x00000100
586 #define MSVCRT__RC_NEAR       0x00000000
587 #define MSVCRT__PC_24         0x00020000
588 #define MSVCRT__PC_53         0x00010000
589 #define MSVCRT__PC_64         0x00000000
590
591 #define MSVCRT_CLOCKS_PER_SEC 1000
592
593 /* signals */
594 #define MSVCRT_SIGINT   2
595 #define MSVCRT_SIGILL   4
596 #define MSVCRT_SIGFPE   8
597 #define MSVCRT_SIGSEGV  11
598 #define MSVCRT_SIGTERM  15
599 #define MSVCRT_SIGBREAK 21
600 #define MSVCRT_SIGABRT  22
601 #define MSVCRT_NSIG     (MSVCRT_SIGABRT + 1)
602
603 typedef void (__cdecl *MSVCRT___sighandler_t)(int);
604
605 #define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
606 #define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
607 #define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
608
609 #define MSVCRT__FPE_INVALID            0x81
610 #define MSVCRT__FPE_DENORMAL           0x82
611 #define MSVCRT__FPE_ZERODIVIDE         0x83
612 #define MSVCRT__FPE_OVERFLOW           0x84
613 #define MSVCRT__FPE_UNDERFLOW          0x85
614 #define MSVCRT__FPE_INEXACT            0x86
615 #define MSVCRT__FPE_UNEMULATED         0x87
616 #define MSVCRT__FPE_SQRTNEG            0x88
617 #define MSVCRT__FPE_STACKOVERFLOW      0x8a
618 #define MSVCRT__FPE_STACKUNDERFLOW     0x8b
619 #define MSVCRT__FPE_EXPLICITGEN        0x8c
620
621 #define _MS     0x01
622 #define _MP     0x02
623 #define _M1     0x04
624 #define _M2     0x08
625
626 #define _SBUP   0x10
627 #define _SBLOW  0x20
628
629 #define _MBC_SINGLE     0
630 #define _MBC_LEAD       1
631 #define _MBC_TRAIL      2
632 #define _MBC_ILLEGAL    -1
633
634 #define _MB_CP_SBCS     0
635 #define _MB_CP_OEM      -2
636 #define _MB_CP_ANSI     -3
637 #define _MB_CP_LOCALE   -4
638
639 void  __cdecl    MSVCRT_free(void*);
640 void* __cdecl    MSVCRT_malloc(MSVCRT_size_t);
641 void* __cdecl    MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
642 void* __cdecl    MSVCRT_realloc(void*,MSVCRT_size_t);
643
644 int __cdecl      MSVCRT_iswalpha(MSVCRT_wint_t);
645 int __cdecl      MSVCRT_iswspace(MSVCRT_wint_t);
646 int __cdecl      MSVCRT_iswdigit(MSVCRT_wint_t);
647 int __cdecl      MSVCRT_isleadbyte(int);
648
649 int __cdecl      MSVCRT_fgetc(MSVCRT_FILE*);
650 int __cdecl      MSVCRT_ungetc(int,MSVCRT_FILE*);
651 MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
652 MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
653 void __cdecl     MSVCRT__exit(int);
654 void __cdecl     MSVCRT_abort(void);
655 unsigned long* __cdecl MSVCRT___doserrno(void);
656 int* __cdecl     MSVCRT__errno(void);
657 char* __cdecl    MSVCRT_getenv(const char*);
658 char* __cdecl    MSVCRT_setlocale(int,const char*);
659 int __cdecl      MSVCRT_fclose(MSVCRT_FILE*);
660 void __cdecl     MSVCRT_terminate(void);
661 MSVCRT_FILE* __cdecl MSVCRT__iob_func(void);
662 MSVCRT_time_t __cdecl MSVCRT_mktime(struct MSVCRT_tm *t);
663 struct MSVCRT_tm* __cdecl MSVCRT_localtime(const MSVCRT_time_t* secs);
664 struct MSVCRT_tm* __cdecl MSVCRT_gmtime(const MSVCRT_time_t* secs);
665 MSVCRT_clock_t __cdecl MSVCRT_clock(void);
666 double __cdecl   MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2);
667 MSVCRT_time_t  __cdecl MSVCRT_time(MSVCRT_time_t*);
668 MSVCRT_FILE*   __cdecl MSVCRT__fdopen(int, const char *);
669 MSVCRT_FILE*   __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
670 int            __cdecl MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, __ms_va_list valist);
671 int            __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, unsigned int len,
672                                        const MSVCRT_wchar_t *format, __ms_va_list valist );
673 int            __cdecl MSVCRT_raise(int sig);
674
675 #ifndef __WINE_MSVCRT_TEST
676 int            __cdecl MSVCRT__write(int,const void*,unsigned int);
677 int            __cdecl _getch(void);
678 int            __cdecl _ismbblead(unsigned int);
679 int            __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
680 MSVCRT_intptr_t __cdecl _spawnve(int,const char*,const char* const *,const char* const *);
681 MSVCRT_intptr_t __cdecl _spawnvpe(int,const char*,const char* const *,const char* const *);
682 MSVCRT_intptr_t __cdecl _wspawnve(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
683 MSVCRT_intptr_t __cdecl _wspawnvpe(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
684 void __cdecl     _searchenv(const char*,const char*,char*);
685 int __cdecl      _getdrive(void);
686 char* __cdecl    _strdup(const char*);
687 char* __cdecl    _strnset(char*,int,MSVCRT_size_t);
688 char* __cdecl    _strset(char*,int);
689 int __cdecl      _ungetch(int);
690 int __cdecl      _cputs(const char*);
691 int __cdecl      _cprintf(const char*,...);
692 char*** __cdecl  __p__environ(void);
693 int*    __cdecl  __p___mb_cur_max(void);
694 unsigned int*  __cdecl __p__fmode(void);
695 MSVCRT_wchar_t* __cdecl _wcsdup(const MSVCRT_wchar_t*);
696 MSVCRT_wchar_t*** __cdecl __p__wenviron(void);
697 char*   __cdecl _strdate(char* date);
698 char*   __cdecl _strtime(char* date);
699 int     __cdecl _setmbcp(int);
700 void    __cdecl MSVCRT__ftime(struct MSVCRT__timeb *buf);
701 int     __cdecl MSVCRT__close(int);
702 int     __cdecl MSVCRT__dup(int);
703 int     __cdecl MSVCRT__dup2(int, int);
704 int     __cdecl MSVCRT__pipe(int *, unsigned int, int);
705 MSVCRT_wchar_t* __cdecl _wgetenv(const MSVCRT_wchar_t*);
706 void __cdecl    _wsearchenv(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_wchar_t*);
707 #endif
708
709 #endif /* __WINE_MSVCRT_H */