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