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