gdi32: Fix copy-paste error (coverity).
[wine/multimedia.git] / dlls / msvcrt / msvcrt.h
blob77d30b2a13a3920468fcab91be9606a3c249f0be
1 /*
2 * Copyright 2001 Jon Griffiths
3 * Copyright 2004 Dimitrie O. Paun
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.
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.
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
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!
36 #ifndef __WINE_MSVCRT_H
37 #define __WINE_MSVCRT_H
39 #include <stdarg.h>
41 #include "windef.h"
42 #include "winbase.h"
44 #define MSVCRT_LONG_MAX 0x7fffffffL
45 #define MSVCRT_ULONG_MAX 0xffffffffUL
46 #define MSVCRT_I64_MAX (((__int64)0x7fffffff << 32) | 0xffffffff)
47 #define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1)
48 #define MSVCRT_UI64_MAX (((unsigned __int64)0xffffffff << 32) | 0xffffffff)
50 #define MSVCRT__MAX_DRIVE 3
51 #define MSVCRT__MAX_DIR 256
52 #define MSVCRT__MAX_FNAME 256
53 #define MSVCRT__MAX_EXT 256
55 typedef unsigned short MSVCRT_wchar_t;
56 typedef unsigned short MSVCRT_wint_t;
57 typedef unsigned short MSVCRT_wctype_t;
58 typedef unsigned short MSVCRT__ino_t;
59 typedef unsigned int MSVCRT__fsize_t;
60 typedef int MSVCRT_long;
61 typedef unsigned int MSVCRT_ulong;
62 #ifdef _WIN64
63 typedef unsigned __int64 MSVCRT_size_t;
64 typedef __int64 MSVCRT_intptr_t;
65 typedef unsigned __int64 MSVCRT_uintptr_t;
66 #else
67 typedef unsigned long MSVCRT_size_t;
68 typedef long MSVCRT_intptr_t;
69 typedef unsigned long MSVCRT_uintptr_t;
70 #endif
71 typedef unsigned int MSVCRT__dev_t;
72 typedef int MSVCRT__off_t;
73 typedef int MSVCRT_clock_t;
74 typedef int MSVCRT___time32_t;
75 typedef __int64 DECLSPEC_ALIGN(8) MSVCRT___time64_t;
76 typedef __int64 DECLSPEC_ALIGN(8) MSVCRT_fpos_t;
77 typedef int MSVCRT_mbstate_t;
79 typedef void (__cdecl *MSVCRT_terminate_handler)(void);
80 typedef void (__cdecl *MSVCRT_terminate_function)(void);
81 typedef void (__cdecl *MSVCRT_unexpected_handler)(void);
82 typedef void (__cdecl *MSVCRT_unexpected_function)(void);
83 typedef void (__cdecl *MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
84 typedef void (__cdecl *MSVCRT__beginthread_start_routine_t)(void *);
85 typedef unsigned int (__stdcall *MSVCRT__beginthreadex_start_routine_t)(void *);
86 typedef int (__cdecl *MSVCRT__onexit_t)(void);
87 typedef void (__cdecl *MSVCRT_invalid_parameter_handler)(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, unsigned, MSVCRT_uintptr_t);
88 typedef void (__cdecl *MSVCRT_purecall_handler)(void);
89 typedef void (__cdecl *MSVCRT_security_error_handler)(int, void *);
91 typedef struct {ULONG x80[3];} MSVCRT__LDOUBLE; /* Intel 80 bit FP format has sizeof() 12 */
93 struct MSVCRT_tm {
94 int tm_sec;
95 int tm_min;
96 int tm_hour;
97 int tm_mday;
98 int tm_mon;
99 int tm_year;
100 int tm_wday;
101 int tm_yday;
102 int tm_isdst;
105 typedef struct MSVCRT_tagLC_ID {
106 unsigned short wLanguage;
107 unsigned short wCountry;
108 unsigned short wCodePage;
109 } MSVCRT_LC_ID, *MSVCRT_LPLC_ID;
111 typedef struct {
112 union {
113 char *str[43];
114 struct {
115 char *short_wday[7];
116 char *wday[7];
117 char *short_mon[12];
118 char *mon[12];
119 char *am;
120 char *pm;
121 char *short_date;
122 char *date;
123 char *time;
124 } names;
125 } str;
126 LCID lcid;
127 int unk[2];
128 MSVCRT_wchar_t *wstr[43];
129 char data[1];
130 } MSVCRT___lc_time_data;
132 typedef struct MSVCRT_threadlocaleinfostruct {
133 int refcount;
134 unsigned int lc_codepage;
135 unsigned int lc_collate_cp;
136 MSVCRT_ulong lc_handle[6];
137 MSVCRT_LC_ID lc_id[6];
138 struct {
139 char *locale;
140 wchar_t *wlocale;
141 int *refcount;
142 int *wrefcount;
143 } lc_category[6];
144 int lc_clike;
145 int mb_cur_max;
146 int *lconv_intl_refcount;
147 int *lconv_num_refcount;
148 int *lconv_mon_refcount;
149 struct MSVCRT_lconv *lconv;
150 int *ctype1_refcount;
151 unsigned short *ctype1;
152 unsigned short *pctype;
153 unsigned char *pclmap;
154 unsigned char *pcumap;
155 MSVCRT___lc_time_data *lc_time_curr;
156 } MSVCRT_threadlocinfo;
158 typedef struct MSVCRT_threadmbcinfostruct {
159 int refcount;
160 int mbcodepage;
161 int ismbcodepage;
162 int mblcid;
163 unsigned short mbulinfo[6];
164 unsigned char mbctype[257];
165 unsigned char mbcasemap[256];
166 } MSVCRT_threadmbcinfo;
168 typedef struct MSVCRT_threadlocaleinfostruct *MSVCRT_pthreadlocinfo;
169 typedef struct MSVCRT_threadmbcinfostruct *MSVCRT_pthreadmbcinfo;
171 typedef struct MSVCRT_localeinfo_struct
173 MSVCRT_pthreadlocinfo locinfo;
174 MSVCRT_pthreadmbcinfo mbcinfo;
175 } MSVCRT__locale_tstruct, *MSVCRT__locale_t;
178 /* TLS data */
179 extern DWORD msvcrt_tls_index DECLSPEC_HIDDEN;
181 /* Keep in sync with msvcr90/tests/msvcr90.c */
182 struct __thread_data {
183 DWORD tid;
184 HANDLE handle;
185 int thread_errno;
186 MSVCRT_ulong thread_doserrno;
187 int unk1;
188 unsigned int random_seed; /* seed for rand() */
189 char *strtok_next; /* next ptr for strtok() */
190 MSVCRT_wchar_t *wcstok_next; /* next ptr for wcstok() */
191 unsigned char *mbstok_next; /* next ptr for mbstok() */
192 char *strerror_buffer; /* buffer for strerror */
193 MSVCRT_wchar_t *wcserror_buffer; /* buffer for wcserror */
194 char *tmpnam_buffer; /* buffer for tmpname() */
195 MSVCRT_wchar_t *wtmpnam_buffer; /* buffer for wtmpname() */
196 void *unk2[2];
197 char *asctime_buffer; /* buffer for asctime */
198 MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */
199 struct MSVCRT_tm *time_buffer; /* buffer for localtime/gmtime */
200 char *efcvt_buffer; /* buffer for ecvt/fcvt */
201 int unk3[2];
202 void *unk4[4];
203 int fpecode;
204 MSVCRT_pthreadmbcinfo mbcinfo;
205 MSVCRT_pthreadlocinfo locinfo;
206 BOOL have_locale;
207 int unk5[1];
208 MSVCRT_terminate_function terminate_handler;
209 MSVCRT_unexpected_function unexpected_handler;
210 MSVCRT__se_translator_function se_translator;
211 void *unk6[3];
212 int unk7;
213 EXCEPTION_RECORD *exc_record;
214 void *unk8[100];
217 typedef struct __thread_data thread_data_t;
219 extern thread_data_t *msvcrt_get_thread_data(void) DECLSPEC_HIDDEN;
221 LCID MSVCRT_locale_to_LCID(const char *) DECLSPEC_HIDDEN;
222 extern MSVCRT__locale_t MSVCRT_locale DECLSPEC_HIDDEN;
223 extern unsigned int MSVCRT___lc_codepage;
224 extern int MSVCRT___lc_collate_cp;
225 extern WORD MSVCRT__ctype [257];
227 void msvcrt_set_errno(int) DECLSPEC_HIDDEN;
229 void __cdecl _purecall(void);
230 void __cdecl _amsg_exit(int errnum);
232 extern char **MSVCRT__environ;
233 extern MSVCRT_wchar_t **MSVCRT__wenviron;
235 extern char ** msvcrt_SnapshotOfEnvironmentA(char **) DECLSPEC_HIDDEN;
236 extern MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **) DECLSPEC_HIDDEN;
238 MSVCRT_wchar_t *msvcrt_wstrdupa(const char *) DECLSPEC_HIDDEN;
240 /* FIXME: This should be declared in new.h but it's not an extern "C" so
241 * it would not be much use anyway. Even for Winelib applications.
243 int __cdecl MSVCRT__set_new_mode(int mode);
245 void* __cdecl MSVCRT_operator_new(MSVCRT_size_t);
246 void __cdecl MSVCRT_operator_delete(void*);
248 typedef void* (__cdecl *malloc_func_t)(MSVCRT_size_t);
249 typedef void (__cdecl *free_func_t)(void*);
251 extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
252 extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
254 /* Setup and teardown multi threaded locks */
255 extern void msvcrt_init_mt_locks(void) DECLSPEC_HIDDEN;
256 extern void msvcrt_free_mt_locks(void) DECLSPEC_HIDDEN;
258 extern void msvcrt_init_exception(void*) DECLSPEC_HIDDEN;
259 extern BOOL msvcrt_init_locale(void) DECLSPEC_HIDDEN;
260 extern void msvcrt_init_math(void) DECLSPEC_HIDDEN;
261 extern void msvcrt_init_io(void) DECLSPEC_HIDDEN;
262 extern void msvcrt_free_io(void) DECLSPEC_HIDDEN;
263 extern void msvcrt_init_console(void) DECLSPEC_HIDDEN;
264 extern void msvcrt_free_console(void) DECLSPEC_HIDDEN;
265 extern void msvcrt_init_args(void) DECLSPEC_HIDDEN;
266 extern void msvcrt_free_args(void) DECLSPEC_HIDDEN;
267 extern void msvcrt_init_signals(void) DECLSPEC_HIDDEN;
268 extern void msvcrt_free_signals(void) DECLSPEC_HIDDEN;
270 extern unsigned msvcrt_create_io_inherit_block(WORD*, BYTE**) DECLSPEC_HIDDEN;
272 extern unsigned int __cdecl _control87(unsigned int, unsigned int);
274 /* run-time error codes */
275 #define _RT_STACK 0
276 #define _RT_NULLPTR 1
277 #define _RT_FLOAT 2
278 #define _RT_INTDIV 3
279 #define _RT_EXECMEM 5
280 #define _RT_EXECFORM 6
281 #define _RT_EXECENV 7
282 #define _RT_SPACEARG 8
283 #define _RT_SPACEENV 9
284 #define _RT_ABORT 10
285 #define _RT_NPTR 12
286 #define _RT_FPTR 13
287 #define _RT_BREAK 14
288 #define _RT_INT 15
289 #define _RT_THREAD 16
290 #define _RT_LOCK 17
291 #define _RT_HEAP 18
292 #define _RT_OPENCON 19
293 #define _RT_QWIN 20
294 #define _RT_NOMAIN 21
295 #define _RT_NONCONT 22
296 #define _RT_INVALDISP 23
297 #define _RT_ONEXIT 24
298 #define _RT_PUREVIRT 25
299 #define _RT_STDIOINIT 26
300 #define _RT_LOWIOINIT 27
301 #define _RT_HEAPINIT 28
302 #define _RT_DOMAIN 120
303 #define _RT_SING 121
304 #define _RT_TLOSS 122
305 #define _RT_CRNL 252
306 #define _RT_BANNER 255
308 struct MSVCRT___timeb32 {
309 MSVCRT___time32_t time;
310 unsigned short millitm;
311 short timezone;
312 short dstflag;
315 struct MSVCRT___timeb64 {
316 MSVCRT___time64_t time;
317 unsigned short millitm;
318 short timezone;
319 short dstflag;
322 struct MSVCRT__iobuf {
323 char* _ptr;
324 int _cnt;
325 char* _base;
326 int _flag;
327 int _file;
328 int _charbuf;
329 int _bufsiz;
330 char* _tmpfname;
333 typedef struct MSVCRT__iobuf MSVCRT_FILE;
335 struct MSVCRT_lconv {
336 char* decimal_point;
337 char* thousands_sep;
338 char* grouping;
339 char* int_curr_symbol;
340 char* currency_symbol;
341 char* mon_decimal_point;
342 char* mon_thousands_sep;
343 char* mon_grouping;
344 char* positive_sign;
345 char* negative_sign;
346 char int_frac_digits;
347 char frac_digits;
348 char p_cs_precedes;
349 char p_sep_by_space;
350 char n_cs_precedes;
351 char n_sep_by_space;
352 char p_sign_posn;
353 char n_sign_posn;
356 struct MSVCRT__exception {
357 int type;
358 char* name;
359 double arg1;
360 double arg2;
361 double retval;
364 struct MSVCRT__complex {
365 double x; /* Real part */
366 double y; /* Imaginary part */
369 typedef struct MSVCRT__div_t {
370 int quot; /* quotient */
371 int rem; /* remainder */
372 } MSVCRT_div_t;
374 typedef struct MSVCRT__ldiv_t {
375 MSVCRT_long quot; /* quotient */
376 MSVCRT_long rem; /* remainder */
377 } MSVCRT_ldiv_t;
379 struct MSVCRT__heapinfo {
380 int* _pentry;
381 MSVCRT_size_t _size;
382 int _useflag;
385 #ifdef __i386__
386 struct MSVCRT___JUMP_BUFFER {
387 unsigned long Ebp;
388 unsigned long Ebx;
389 unsigned long Edi;
390 unsigned long Esi;
391 unsigned long Esp;
392 unsigned long Eip;
393 unsigned long Registration;
394 unsigned long TryLevel;
395 /* Start of new struct members */
396 unsigned long Cookie;
397 unsigned long UnwindFunc;
398 unsigned long UnwindData[6];
400 #elif defined(__x86_64__)
401 struct MSVCRT__SETJMP_FLOAT128
403 unsigned __int64 DECLSPEC_ALIGN(16) Part[2];
405 struct MSVCRT___JUMP_BUFFER
407 unsigned __int64 Frame;
408 unsigned __int64 Rbx;
409 unsigned __int64 Rsp;
410 unsigned __int64 Rbp;
411 unsigned __int64 Rsi;
412 unsigned __int64 Rdi;
413 unsigned __int64 R12;
414 unsigned __int64 R13;
415 unsigned __int64 R14;
416 unsigned __int64 R15;
417 unsigned __int64 Rip;
418 unsigned __int64 Spare;
419 struct MSVCRT__SETJMP_FLOAT128 Xmm6;
420 struct MSVCRT__SETJMP_FLOAT128 Xmm7;
421 struct MSVCRT__SETJMP_FLOAT128 Xmm8;
422 struct MSVCRT__SETJMP_FLOAT128 Xmm9;
423 struct MSVCRT__SETJMP_FLOAT128 Xmm10;
424 struct MSVCRT__SETJMP_FLOAT128 Xmm11;
425 struct MSVCRT__SETJMP_FLOAT128 Xmm12;
426 struct MSVCRT__SETJMP_FLOAT128 Xmm13;
427 struct MSVCRT__SETJMP_FLOAT128 Xmm14;
428 struct MSVCRT__SETJMP_FLOAT128 Xmm15;
430 #endif /* __i386__ */
432 struct MSVCRT__diskfree_t {
433 unsigned int total_clusters;
434 unsigned int avail_clusters;
435 unsigned int sectors_per_cluster;
436 unsigned int bytes_per_sector;
439 struct MSVCRT__finddata32_t {
440 unsigned int attrib;
441 MSVCRT___time32_t time_create;
442 MSVCRT___time32_t time_access;
443 MSVCRT___time32_t time_write;
444 MSVCRT__fsize_t size;
445 char name[260];
448 struct MSVCRT__finddata32i64_t {
449 unsigned int attrib;
450 MSVCRT___time32_t time_create;
451 MSVCRT___time32_t time_access;
452 MSVCRT___time32_t time_write;
453 __int64 DECLSPEC_ALIGN(8) size;
454 char name[260];
457 struct MSVCRT__finddata64i32_t {
458 unsigned int attrib;
459 MSVCRT___time64_t time_create;
460 MSVCRT___time64_t time_access;
461 MSVCRT___time64_t time_write;
462 MSVCRT__fsize_t size;
463 char name[260];
466 struct MSVCRT__finddata64_t {
467 unsigned int attrib;
468 MSVCRT___time64_t time_create;
469 MSVCRT___time64_t time_access;
470 MSVCRT___time64_t time_write;
471 __int64 DECLSPEC_ALIGN(8) size;
472 char name[260];
475 struct MSVCRT__wfinddata32_t {
476 unsigned int attrib;
477 MSVCRT___time32_t time_create;
478 MSVCRT___time32_t time_access;
479 MSVCRT___time32_t time_write;
480 MSVCRT__fsize_t size;
481 MSVCRT_wchar_t name[260];
484 struct MSVCRT__wfinddata32i64_t {
485 unsigned int attrib;
486 MSVCRT___time32_t time_create;
487 MSVCRT___time32_t time_access;
488 MSVCRT___time32_t time_write;
489 __int64 DECLSPEC_ALIGN(8) size;
490 MSVCRT_wchar_t name[260];
493 struct MSVCRT__wfinddata64i32_t {
494 unsigned int attrib;
495 MSVCRT___time64_t time_create;
496 MSVCRT___time64_t time_access;
497 MSVCRT___time64_t time_write;
498 MSVCRT__fsize_t size;
499 MSVCRT_wchar_t name[260];
502 struct MSVCRT__wfinddata64_t {
503 unsigned int attrib;
504 MSVCRT___time64_t time_create;
505 MSVCRT___time64_t time_access;
506 MSVCRT___time64_t time_write;
507 __int64 DECLSPEC_ALIGN(8) size;
508 MSVCRT_wchar_t name[260];
511 struct MSVCRT___utimbuf32
513 MSVCRT___time32_t actime;
514 MSVCRT___time32_t modtime;
517 struct MSVCRT___utimbuf64
519 MSVCRT___time64_t actime;
520 MSVCRT___time64_t modtime;
523 /* for FreeBSD */
524 #undef st_atime
525 #undef st_ctime
526 #undef st_mtime
528 struct MSVCRT__stat32 {
529 MSVCRT__dev_t st_dev;
530 MSVCRT__ino_t st_ino;
531 unsigned short st_mode;
532 short st_nlink;
533 short st_uid;
534 short st_gid;
535 MSVCRT__dev_t st_rdev;
536 MSVCRT__off_t st_size;
537 MSVCRT___time32_t st_atime;
538 MSVCRT___time32_t st_mtime;
539 MSVCRT___time32_t st_ctime;
542 struct MSVCRT__stat32i64 {
543 MSVCRT__dev_t st_dev;
544 MSVCRT__ino_t st_ino;
545 unsigned short st_mode;
546 short st_nlink;
547 short st_uid;
548 short st_gid;
549 MSVCRT__dev_t st_rdev;
550 __int64 DECLSPEC_ALIGN(8) st_size;
551 MSVCRT___time32_t st_atime;
552 MSVCRT___time32_t st_mtime;
553 MSVCRT___time32_t st_ctime;
556 struct MSVCRT__stat64i32 {
557 MSVCRT__dev_t st_dev;
558 MSVCRT__ino_t st_ino;
559 unsigned short st_mode;
560 short st_nlink;
561 short st_uid;
562 short st_gid;
563 MSVCRT__dev_t st_rdev;
564 MSVCRT__off_t st_size;
565 MSVCRT___time64_t st_atime;
566 MSVCRT___time64_t st_mtime;
567 MSVCRT___time64_t st_ctime;
570 struct MSVCRT__stat64 {
571 MSVCRT__dev_t st_dev;
572 MSVCRT__ino_t st_ino;
573 unsigned short st_mode;
574 short st_nlink;
575 short st_uid;
576 short st_gid;
577 MSVCRT__dev_t st_rdev;
578 __int64 DECLSPEC_ALIGN(8) st_size;
579 MSVCRT___time64_t st_atime;
580 MSVCRT___time64_t st_mtime;
581 MSVCRT___time64_t st_ctime;
584 #ifdef _WIN64
585 #define MSVCRT__finddata_t MSVCRT__finddata64i32_t
586 #define MSVCRT__finddatai64_t MSVCRT__finddata64_t
587 #define MSVCRT__wfinddata_t MSVCRT__wfinddata64i32_t
588 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata64_t
589 #define MSVCRT__stat MSVCRT__stat64i32
590 #define MSVCRT__stati64 MSVCRT__stat64
591 #else
592 #define MSVCRT__finddata_t MSVCRT__finddata32_t
593 #define MSVCRT__finddatai64_t MSVCRT__finddata32i64_t
594 #define MSVCRT__wfinddata_t MSVCRT__wfinddata32_t
595 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata32i64_t
596 #define MSVCRT__stat MSVCRT__stat32
597 #define MSVCRT__stati64 MSVCRT__stat32i64
598 #endif
600 #define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
601 #define MSVCRT_EOF (-1)
602 #define MSVCRT_TMP_MAX 0x7fff
603 #define MSVCRT_RAND_MAX 0x7fff
604 #define MSVCRT_BUFSIZ 512
606 #define MSVCRT_STDIN_FILENO 0
607 #define MSVCRT_STDOUT_FILENO 1
608 #define MSVCRT_STDERR_FILENO 2
610 /* more file._flag flags, but these conflict with Unix */
611 #define MSVCRT__IOFBF 0x0000
612 #define MSVCRT__IONBF 0x0004
613 #define MSVCRT__IOLBF 0x0040
615 #define MSVCRT_FILENAME_MAX 260
616 #define MSVCRT_DRIVE_MAX 3
617 #define MSVCRT_FNAME_MAX 256
618 #define MSVCRT_DIR_MAX 256
619 #define MSVCRT_EXT_MAX 256
620 #define MSVCRT_PATH_MAX 260
621 #define MSVCRT_stdin (MSVCRT__iob+MSVCRT_STDIN_FILENO)
622 #define MSVCRT_stdout (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
623 #define MSVCRT_stderr (MSVCRT__iob+MSVCRT_STDERR_FILENO)
625 #define MSVCRT__P_WAIT 0
626 #define MSVCRT__P_NOWAIT 1
627 #define MSVCRT__P_OVERLAY 2
628 #define MSVCRT__P_NOWAITO 3
629 #define MSVCRT__P_DETACH 4
631 #define MSVCRT_EPERM 1
632 #define MSVCRT_ENOENT 2
633 #define MSVCRT_ESRCH 3
634 #define MSVCRT_EINTR 4
635 #define MSVCRT_EIO 5
636 #define MSVCRT_ENXIO 6
637 #define MSVCRT_E2BIG 7
638 #define MSVCRT_ENOEXEC 8
639 #define MSVCRT_EBADF 9
640 #define MSVCRT_ECHILD 10
641 #define MSVCRT_EAGAIN 11
642 #define MSVCRT_ENOMEM 12
643 #define MSVCRT_EACCES 13
644 #define MSVCRT_EFAULT 14
645 #define MSVCRT_EBUSY 16
646 #define MSVCRT_EEXIST 17
647 #define MSVCRT_EXDEV 18
648 #define MSVCRT_ENODEV 19
649 #define MSVCRT_ENOTDIR 20
650 #define MSVCRT_EISDIR 21
651 #define MSVCRT_EINVAL 22
652 #define MSVCRT_ENFILE 23
653 #define MSVCRT_EMFILE 24
654 #define MSVCRT_ENOTTY 25
655 #define MSVCRT_EFBIG 27
656 #define MSVCRT_ENOSPC 28
657 #define MSVCRT_ESPIPE 29
658 #define MSVCRT_EROFS 30
659 #define MSVCRT_EMLINK 31
660 #define MSVCRT_EPIPE 32
661 #define MSVCRT_EDOM 33
662 #define MSVCRT_ERANGE 34
663 #define MSVCRT_EDEADLK 36
664 #define MSVCRT_EDEADLOCK MSVCRT_EDEADLK
665 #define MSVCRT_ENAMETOOLONG 38
666 #define MSVCRT_ENOLCK 39
667 #define MSVCRT_ENOSYS 40
668 #define MSVCRT_ENOTEMPTY 41
669 #define MSVCRT_EILSEQ 42
670 #define MSVCRT_STRUNCATE 80
672 #define MSVCRT_LC_ALL 0
673 #define MSVCRT_LC_COLLATE 1
674 #define MSVCRT_LC_CTYPE 2
675 #define MSVCRT_LC_MONETARY 3
676 #define MSVCRT_LC_NUMERIC 4
677 #define MSVCRT_LC_TIME 5
678 #define MSVCRT_LC_MIN MSVCRT_LC_ALL
679 #define MSVCRT_LC_MAX MSVCRT_LC_TIME
681 #define MSVCRT__HEAPEMPTY -1
682 #define MSVCRT__HEAPOK -2
683 #define MSVCRT__HEAPBADBEGIN -3
684 #define MSVCRT__HEAPBADNODE -4
685 #define MSVCRT__HEAPEND -5
686 #define MSVCRT__HEAPBADPTR -6
688 #define MSVCRT__FREEENTRY 0
689 #define MSVCRT__USEDENTRY 1
691 #define MSVCRT__OUT_TO_DEFAULT 0
692 #define MSVCRT__OUT_TO_STDERR 1
693 #define MSVCRT__OUT_TO_MSGBOX 2
694 #define MSVCRT__REPORT_ERRMODE 3
696 /* ASCII char classification table - binary compatible */
697 #define MSVCRT__UPPER 0x0001 /* C1_UPPER */
698 #define MSVCRT__LOWER 0x0002 /* C1_LOWER */
699 #define MSVCRT__DIGIT 0x0004 /* C1_DIGIT */
700 #define MSVCRT__SPACE 0x0008 /* C1_SPACE */
701 #define MSVCRT__PUNCT 0x0010 /* C1_PUNCT */
702 #define MSVCRT__CONTROL 0x0020 /* C1_CNTRL */
703 #define MSVCRT__BLANK 0x0040 /* C1_BLANK */
704 #define MSVCRT__HEX 0x0080 /* C1_XDIGIT */
705 #define MSVCRT__LEADBYTE 0x8000
706 #define MSVCRT__ALPHA (0x0100|MSVCRT__UPPER|MSVCRT__LOWER) /* (C1_ALPHA|_UPPER|_LOWER) */
708 #define MSVCRT__IOREAD 0x0001
709 #define MSVCRT__IOWRT 0x0002
710 #define MSVCRT__IOMYBUF 0x0008
711 #define MSVCRT__IOEOF 0x0010
712 #define MSVCRT__IOERR 0x0020
713 #define MSVCRT__IOSTRG 0x0040
714 #define MSVCRT__IORW 0x0080
716 #define MSVCRT__S_IEXEC 0x0040
717 #define MSVCRT__S_IWRITE 0x0080
718 #define MSVCRT__S_IREAD 0x0100
719 #define MSVCRT__S_IFIFO 0x1000
720 #define MSVCRT__S_IFCHR 0x2000
721 #define MSVCRT__S_IFDIR 0x4000
722 #define MSVCRT__S_IFREG 0x8000
723 #define MSVCRT__S_IFMT 0xF000
725 #define MSVCRT__LK_UNLCK 0
726 #define MSVCRT__LK_LOCK 1
727 #define MSVCRT__LK_NBLCK 2
728 #define MSVCRT__LK_RLCK 3
729 #define MSVCRT__LK_NBRLCK 4
731 #define MSVCRT__SH_COMPAT 0x00 /* Compatibility */
732 #define MSVCRT__SH_DENYRW 0x10 /* Deny read/write */
733 #define MSVCRT__SH_DENYWR 0x20 /* Deny write */
734 #define MSVCRT__SH_DENYRD 0x30 /* Deny read */
735 #define MSVCRT__SH_DENYNO 0x40 /* Deny nothing */
737 #define MSVCRT__O_RDONLY 0
738 #define MSVCRT__O_WRONLY 1
739 #define MSVCRT__O_RDWR 2
740 #define MSVCRT__O_ACCMODE (MSVCRT__O_RDONLY|MSVCRT__O_WRONLY|MSVCRT__O_RDWR)
741 #define MSVCRT__O_APPEND 0x0008
742 #define MSVCRT__O_RANDOM 0x0010
743 #define MSVCRT__O_SEQUENTIAL 0x0020
744 #define MSVCRT__O_TEMPORARY 0x0040
745 #define MSVCRT__O_NOINHERIT 0x0080
746 #define MSVCRT__O_CREAT 0x0100
747 #define MSVCRT__O_TRUNC 0x0200
748 #define MSVCRT__O_EXCL 0x0400
749 #define MSVCRT__O_SHORT_LIVED 0x1000
750 #define MSVCRT__O_TEXT 0x4000
751 #define MSVCRT__O_BINARY 0x8000
752 #define MSVCRT__O_RAW MSVCRT__O_BINARY
754 /* _statusfp bit flags */
755 #define MSVCRT__SW_INEXACT 0x00000001 /* inexact (precision) */
756 #define MSVCRT__SW_UNDERFLOW 0x00000002 /* underflow */
757 #define MSVCRT__SW_OVERFLOW 0x00000004 /* overflow */
758 #define MSVCRT__SW_ZERODIVIDE 0x00000008 /* zero divide */
759 #define MSVCRT__SW_INVALID 0x00000010 /* invalid */
761 #define MSVCRT__SW_UNEMULATED 0x00000040 /* unemulated instruction */
762 #define MSVCRT__SW_SQRTNEG 0x00000080 /* square root of a neg number */
763 #define MSVCRT__SW_STACKOVERFLOW 0x00000200 /* FP stack overflow */
764 #define MSVCRT__SW_STACKUNDERFLOW 0x00000400 /* FP stack underflow */
766 #define MSVCRT__SW_DENORMAL 0x00080000 /* denormal status bit */
768 /* fpclass constants */
769 #define MSVCRT__FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
770 #define MSVCRT__FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
771 #define MSVCRT__FPCLASS_NINF 0x0004 /* Negative Infinity */
772 #define MSVCRT__FPCLASS_NN 0x0008 /* Negative Normal */
773 #define MSVCRT__FPCLASS_ND 0x0010 /* Negative Denormal */
774 #define MSVCRT__FPCLASS_NZ 0x0020 /* Negative Zero */
775 #define MSVCRT__FPCLASS_PZ 0x0040 /* Positive Zero */
776 #define MSVCRT__FPCLASS_PD 0x0080 /* Positive Denormal */
777 #define MSVCRT__FPCLASS_PN 0x0100 /* Positive Normal */
778 #define MSVCRT__FPCLASS_PINF 0x0200 /* Positive Infinity */
780 #define MSVCRT__MCW_EM 0x0008001f
781 #define MSVCRT__MCW_IC 0x00040000
782 #define MSVCRT__MCW_RC 0x00000300
783 #define MSVCRT__MCW_PC 0x00030000
784 #define MSVCRT__MCW_DN 0x03000000
786 #define MSVCRT__EM_INVALID 0x00000010
787 #define MSVCRT__EM_DENORMAL 0x00080000
788 #define MSVCRT__EM_ZERODIVIDE 0x00000008
789 #define MSVCRT__EM_OVERFLOW 0x00000004
790 #define MSVCRT__EM_UNDERFLOW 0x00000002
791 #define MSVCRT__EM_INEXACT 0x00000001
792 #define MSVCRT__IC_AFFINE 0x00040000
793 #define MSVCRT__IC_PROJECTIVE 0x00000000
794 #define MSVCRT__RC_CHOP 0x00000300
795 #define MSVCRT__RC_UP 0x00000200
796 #define MSVCRT__RC_DOWN 0x00000100
797 #define MSVCRT__RC_NEAR 0x00000000
798 #define MSVCRT__PC_24 0x00020000
799 #define MSVCRT__PC_53 0x00010000
800 #define MSVCRT__PC_64 0x00000000
801 #define MSVCRT__DN_SAVE 0x00000000
802 #define MSVCRT__DN_FLUSH 0x01000000
803 #define MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS 0x02000000
804 #define MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS 0x03000000
805 #define MSVCRT__EM_AMBIGUOUS 0x80000000
807 #define MSVCRT_CLOCKS_PER_SEC 1000
809 /* signals */
810 #define MSVCRT_SIGINT 2
811 #define MSVCRT_SIGILL 4
812 #define MSVCRT_SIGFPE 8
813 #define MSVCRT_SIGSEGV 11
814 #define MSVCRT_SIGTERM 15
815 #define MSVCRT_SIGBREAK 21
816 #define MSVCRT_SIGABRT 22
817 #define MSVCRT_NSIG (MSVCRT_SIGABRT + 1)
819 typedef void (__cdecl *MSVCRT___sighandler_t)(int);
821 #define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
822 #define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
823 #define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
825 #define MSVCRT__FPE_INVALID 0x81
826 #define MSVCRT__FPE_DENORMAL 0x82
827 #define MSVCRT__FPE_ZERODIVIDE 0x83
828 #define MSVCRT__FPE_OVERFLOW 0x84
829 #define MSVCRT__FPE_UNDERFLOW 0x85
830 #define MSVCRT__FPE_INEXACT 0x86
831 #define MSVCRT__FPE_UNEMULATED 0x87
832 #define MSVCRT__FPE_SQRTNEG 0x88
833 #define MSVCRT__FPE_STACKOVERFLOW 0x8a
834 #define MSVCRT__FPE_STACKUNDERFLOW 0x8b
835 #define MSVCRT__FPE_EXPLICITGEN 0x8c
837 #define _MS 0x01
838 #define _MP 0x02
839 #define _M1 0x04
840 #define _M2 0x08
842 #define _SBUP 0x10
843 #define _SBLOW 0x20
845 #define _MBC_SINGLE 0
846 #define _MBC_LEAD 1
847 #define _MBC_TRAIL 2
848 #define _MBC_ILLEGAL -1
850 #define _MB_CP_SBCS 0
851 #define _MB_CP_OEM -2
852 #define _MB_CP_ANSI -3
853 #define _MB_CP_LOCALE -4
855 #define MSVCRT__TRUNCATE ((MSVCRT_size_t)-1)
857 #define _MAX__TIME64_T (((MSVCRT___time64_t)0x00000007 << 32) | 0x93406FFF)
859 /* _set_abort_behavior codes */
860 #define MSVCRT__WRITE_ABORT_MSG 1
861 #define MSVCRT__CALL_REPORTFAULT 2
863 /* _get_output_format return code */
864 #define MSVCRT__TWO_DIGIT_EXPONENT 0x1
866 void __cdecl MSVCRT_free(void*);
867 void* __cdecl MSVCRT_malloc(MSVCRT_size_t);
868 void* __cdecl MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
869 void* __cdecl MSVCRT_realloc(void*,MSVCRT_size_t);
871 int __cdecl MSVCRT_iswalpha(MSVCRT_wint_t);
872 int __cdecl MSVCRT_iswspace(MSVCRT_wint_t);
873 int __cdecl MSVCRT_iswdigit(MSVCRT_wint_t);
874 int __cdecl MSVCRT_isleadbyte(int);
875 int __cdecl MSVCRT__isleadbyte_l(int, MSVCRT__locale_t);
877 void __cdecl MSVCRT__lock_file(MSVCRT_FILE*);
878 void __cdecl MSVCRT__unlock_file(MSVCRT_FILE*);
879 int __cdecl MSVCRT_fgetc(MSVCRT_FILE*);
880 int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*);
881 MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
882 MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
883 void __cdecl MSVCRT__exit(int);
884 void __cdecl MSVCRT_abort(void);
885 MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
886 int* __cdecl MSVCRT__errno(void);
887 char* __cdecl MSVCRT_getenv(const char*);
888 int __cdecl MSVCRT_fclose(MSVCRT_FILE*);
889 void __cdecl MSVCRT_terminate(void);
890 MSVCRT_FILE* __cdecl MSVCRT__iob_func(void);
891 MSVCRT_clock_t __cdecl MSVCRT_clock(void);
892 MSVCRT___time32_t __cdecl MSVCRT__time32(MSVCRT___time32_t*);
893 MSVCRT___time64_t __cdecl MSVCRT__time64(MSVCRT___time64_t*);
894 MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *);
895 MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
896 int __cdecl MSVCRT_vsnprintf(char *str, MSVCRT_size_t len, const char *format, __ms_va_list valist);
897 int __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, MSVCRT_size_t len,
898 const MSVCRT_wchar_t *format, __ms_va_list valist );
899 int __cdecl MSVCRT__snwprintf(MSVCRT_wchar_t*, unsigned int, const MSVCRT_wchar_t*, ...);
900 int __cdecl MSVCRT_sprintf(char*,const char*,...);
901 int __cdecl MSVCRT__snprintf(char*,unsigned int,const char*,...);
902 int __cdecl MSVCRT__scprintf(const char*,...);
903 int __cdecl MSVCRT_raise(int sig);
905 #define MSVCRT__ENABLE_PER_THREAD_LOCALE 1
906 #define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
908 extern MSVCRT__locale_t MSVCRT_locale;
909 MSVCRT_pthreadlocinfo get_locinfo(void) DECLSPEC_HIDDEN;
910 MSVCRT_pthreadmbcinfo get_mbcinfo(void) DECLSPEC_HIDDEN;
911 void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
912 void free_locinfo(MSVCRT_pthreadlocinfo) DECLSPEC_HIDDEN;
913 void free_mbcinfo(MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
914 int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
916 #ifndef __WINE_MSVCRT_TEST
917 int __cdecl MSVCRT__write(int,const void*,unsigned int);
918 int __cdecl _getch(void);
919 int __cdecl _ismbblead(unsigned int);
920 int __cdecl _ismbclegal(unsigned int c);
921 int __cdecl _ismbstrail(const unsigned char* start, const unsigned char* str);
922 MSVCRT_size_t __cdecl MSVCRT_mbstowcs(MSVCRT_wchar_t*,const char*,MSVCRT_size_t);
923 MSVCRT_intptr_t __cdecl MSVCRT__spawnve(int,const char*,const char* const *,const char* const *);
924 MSVCRT_intptr_t __cdecl MSVRT__spawnvpe(int,const char*,const char* const *,const char* const *);
925 MSVCRT_intptr_t __cdecl MSVCRT__wspawnve(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
926 MSVCRT_intptr_t __cdecl MSVCRT__wspawnvpe(int,const MSVCRT_wchar_t*,const MSVCRT_wchar_t* const *,const MSVCRT_wchar_t* const *);
927 void __cdecl MSVCRT__searchenv(const char*,const char*,char*);
928 int __cdecl MSVCRT__getdrive(void);
929 char* __cdecl MSVCRT__strdup(const char*);
930 char* __cdecl MSVCRT__strnset(char*,int,MSVCRT_size_t);
931 char* __cdecl _strset(char*,int);
932 int __cdecl _ungetch(int);
933 int __cdecl _cputs(const char*);
934 int __cdecl _cprintf(const char*,...);
935 int __cdecl _cwprintf(const MSVCRT_wchar_t*,...);
936 char*** __cdecl MSVCRT___p__environ(void);
937 int* __cdecl __p___mb_cur_max(void);
938 unsigned int* __cdecl __p__fmode(void);
939 MSVCRT_wchar_t* __cdecl MSVCRT__wcsdup(const MSVCRT_wchar_t*);
940 MSVCRT_wchar_t*** __cdecl MSVCRT___p__wenviron(void);
941 char* __cdecl MSVCRT__strdate(char* date);
942 char* __cdecl MSVCRT__strtime(char* date);
943 int __cdecl _setmbcp(int);
944 int __cdecl MSVCRT__close(int);
945 int __cdecl MSVCRT__dup(int);
946 int __cdecl MSVCRT__dup2(int, int);
947 int __cdecl MSVCRT__pipe(int *, unsigned int, int);
948 MSVCRT_wchar_t* __cdecl MSVCRT__wgetenv(const MSVCRT_wchar_t*);
949 void __cdecl MSVCRT__wsearchenv(const MSVCRT_wchar_t*, const MSVCRT_wchar_t*, MSVCRT_wchar_t*);
950 MSVCRT_intptr_t __cdecl MSVCRT__spawnvpe(int, const char*, const char* const*, const char* const*);
951 void __cdecl MSVCRT__invalid_parameter(const MSVCRT_wchar_t *expr, const MSVCRT_wchar_t *func,
952 const MSVCRT_wchar_t *file, unsigned int line, MSVCRT_uintptr_t arg);
953 int __cdecl MSVCRT__toupper_l(int,MSVCRT__locale_t);
954 int __cdecl MSVCRT__tolower_l(int,MSVCRT__locale_t);
956 /* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd)
957 * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)
958 * #define MSVCRT_CHECK_PMT(x) ((x) ? TRUE : MSVCRT_INVALID_PMT(#x),FALSE)
959 * Until this is done, just keep the same semantics for CHECK_PMT(), but without generating / sending
960 * any information
961 * NB : MSVCRT_call_invalid_parameter_handler is a wrapper around MSVCRT__invalid_parameter in order
962 * to do the Ansi to Unicode transformation
964 #define MSVCRT_INVALID_PMT(x,err) (*MSVCRT__errno() = (err), MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0))
965 #define MSVCRT_CHECK_PMT_ERR(x,err) ((x) || (MSVCRT_INVALID_PMT( 0, (err) ), FALSE))
966 #define MSVCRT_CHECK_PMT(x) MSVCRT_CHECK_PMT_ERR((x), MSVCRT_EINVAL)
967 #endif
969 #define MSVCRT__ARGMAX 100
970 typedef int (*puts_clbk_a)(void*, int, const char*);
971 typedef int (*puts_clbk_w)(void*, int, const MSVCRT_wchar_t*);
972 typedef union _printf_arg
974 void *get_ptr;
975 int get_int;
976 LONGLONG get_longlong;
977 double get_double;
978 } printf_arg;
979 typedef printf_arg (*args_clbk)(void*, int, int, __ms_va_list*);
980 int pf_printf_a(puts_clbk_a, void*, const char*, MSVCRT__locale_t,
981 BOOL, BOOL, args_clbk, void*, __ms_va_list*) DECLSPEC_HIDDEN;
982 int pf_printf_w(puts_clbk_w, void*, const MSVCRT_wchar_t*, MSVCRT__locale_t,
983 BOOL, BOOL, args_clbk, void*, __ms_va_list*) DECLSPEC_HIDDEN;
984 printf_arg arg_clbk_valist(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN;
986 #define MSVCRT__OVERFLOW 3
987 #define MSVCRT__UNDERFLOW 4
989 typedef struct
991 float f;
992 } MSVCRT__CRT_FLOAT;
994 #endif /* __WINE_MSVCRT_H */