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