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
21 * - Symbols are prefixed with MSVCRT_ if they conflict
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.
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
44 #define MSVCRT_LONG_MAX 0x7fffffff
45 #define MSVCRT_LONG_MIN (-MSVCRT_LONG_MAX-1)
46 #define MSVCRT_ULONG_MAX 0xffffffff
47 #define MSVCRT_I64_MAX (((__int64)0x7fffffff << 32) | 0xffffffff)
48 #define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1)
49 #define MSVCRT_UI64_MAX (((unsigned __int64)0xffffffff << 32) | 0xffffffff)
50 #define MSVCRT_MB_LEN_MAX 2
52 #define MSVCRT_SIZE_MAX MSVCRT_UI64_MAX
54 #define MSVCRT_SIZE_MAX MSVCRT_ULONG_MAX
57 #define MSVCRT__MAX_DRIVE 3
58 #define MSVCRT__MAX_DIR 256
59 #define MSVCRT__MAX_FNAME 256
60 #define MSVCRT__MAX_EXT 256
62 typedef unsigned char MSVCRT_bool
;
63 typedef unsigned short MSVCRT_wchar_t
;
64 typedef unsigned short MSVCRT_wint_t
;
65 typedef unsigned short MSVCRT_wctype_t
;
66 typedef unsigned short MSVCRT__ino_t
;
67 typedef unsigned int MSVCRT__fsize_t
;
68 typedef int MSVCRT_long
;
69 typedef unsigned int MSVCRT_ulong
;
71 typedef unsigned __int64 MSVCRT_size_t
;
72 typedef __int64 MSVCRT_intptr_t
;
73 typedef unsigned __int64 MSVCRT_uintptr_t
;
75 typedef unsigned long MSVCRT_size_t
;
76 typedef long MSVCRT_intptr_t
;
77 typedef unsigned long MSVCRT_uintptr_t
;
79 typedef unsigned int MSVCRT__dev_t
;
80 typedef int MSVCRT__off_t
;
81 typedef int MSVCRT_clock_t
;
82 typedef int MSVCRT___time32_t
;
83 typedef __int64
DECLSPEC_ALIGN(8) MSVCRT___time64_t
;
84 typedef __int64
DECLSPEC_ALIGN(8) MSVCRT_fpos_t
;
85 typedef int MSVCRT_mbstate_t
;
87 typedef void (__cdecl
*MSVCRT_terminate_handler
)(void);
88 typedef void (__cdecl
*MSVCRT_terminate_function
)(void);
89 typedef void (__cdecl
*MSVCRT_unexpected_handler
)(void);
90 typedef void (__cdecl
*MSVCRT_unexpected_function
)(void);
91 typedef void (__cdecl
*MSVCRT__se_translator_function
)(unsigned int code
, struct _EXCEPTION_POINTERS
*info
);
92 typedef void (__cdecl
*MSVCRT__beginthread_start_routine_t
)(void *);
93 typedef unsigned int (__stdcall
*MSVCRT__beginthreadex_start_routine_t
)(void *);
94 typedef int (__cdecl
*MSVCRT__onexit_t
)(void);
95 typedef void (__cdecl
*MSVCRT_invalid_parameter_handler
)(const MSVCRT_wchar_t
*, const MSVCRT_wchar_t
*, const MSVCRT_wchar_t
*, unsigned, MSVCRT_uintptr_t
);
96 typedef void (__cdecl
*MSVCRT_purecall_handler
)(void);
97 typedef void (__cdecl
*MSVCRT_security_error_handler
)(int, void *);
99 typedef struct {ULONG x80
[3];} MSVCRT__LDOUBLE
; /* Intel 80 bit FP format has sizeof() 12 */
113 typedef struct MSVCRT_tagLC_ID
{
114 unsigned short wLanguage
;
115 unsigned short wCountry
;
116 unsigned short wCodePage
;
117 } MSVCRT_LC_ID
, *MSVCRT_LPLC_ID
;
136 MSVCRT_wchar_t
*wstr
[43];
138 } MSVCRT___lc_time_data
;
140 typedef struct MSVCRT_threadlocaleinfostruct
{
142 unsigned int lc_codepage
;
143 unsigned int lc_collate_cp
;
144 MSVCRT_ulong lc_handle
[6];
145 MSVCRT_LC_ID lc_id
[6];
154 int *lconv_intl_refcount
;
155 int *lconv_num_refcount
;
156 int *lconv_mon_refcount
;
157 struct MSVCRT_lconv
*lconv
;
158 int *ctype1_refcount
;
159 unsigned short *ctype1
;
160 unsigned short *pctype
;
161 unsigned char *pclmap
;
162 unsigned char *pcumap
;
163 MSVCRT___lc_time_data
*lc_time_curr
;
164 } MSVCRT_threadlocinfo
;
166 typedef struct MSVCRT_threadmbcinfostruct
{
171 unsigned short mbulinfo
[6];
172 unsigned char mbctype
[257];
173 unsigned char mbcasemap
[256];
174 } MSVCRT_threadmbcinfo
;
176 typedef struct MSVCRT_threadlocaleinfostruct
*MSVCRT_pthreadlocinfo
;
177 typedef struct MSVCRT_threadmbcinfostruct
*MSVCRT_pthreadmbcinfo
;
179 typedef struct MSVCRT_localeinfo_struct
181 MSVCRT_pthreadlocinfo locinfo
;
182 MSVCRT_pthreadmbcinfo mbcinfo
;
183 } MSVCRT__locale_tstruct
, *MSVCRT__locale_t
;
187 extern DWORD msvcrt_tls_index DECLSPEC_HIDDEN
;
189 /* Keep in sync with msvcr90/tests/msvcr90.c */
190 struct __thread_data
{
194 MSVCRT_ulong thread_doserrno
;
196 unsigned int random_seed
; /* seed for rand() */
197 char *strtok_next
; /* next ptr for strtok() */
198 MSVCRT_wchar_t
*wcstok_next
; /* next ptr for wcstok() */
199 unsigned char *mbstok_next
; /* next ptr for mbstok() */
200 char *strerror_buffer
; /* buffer for strerror */
201 MSVCRT_wchar_t
*wcserror_buffer
; /* buffer for wcserror */
202 char *tmpnam_buffer
; /* buffer for tmpname() */
203 MSVCRT_wchar_t
*wtmpnam_buffer
; /* buffer for wtmpname() */
205 char *asctime_buffer
; /* buffer for asctime */
206 MSVCRT_wchar_t
*wasctime_buffer
; /* buffer for wasctime */
207 struct MSVCRT_tm
*time_buffer
; /* buffer for localtime/gmtime */
208 char *efcvt_buffer
; /* buffer for ecvt/fcvt */
211 EXCEPTION_POINTERS
*xcptinfo
;
213 MSVCRT_pthreadmbcinfo mbcinfo
;
214 MSVCRT_pthreadlocinfo locinfo
;
217 MSVCRT_terminate_function terminate_handler
;
218 MSVCRT_unexpected_function unexpected_handler
;
219 MSVCRT__se_translator_function se_translator
;
222 EXCEPTION_RECORD
*exc_record
;
226 typedef struct __thread_data thread_data_t
;
228 extern thread_data_t
*msvcrt_get_thread_data(void) DECLSPEC_HIDDEN
;
230 LCID
MSVCRT_locale_to_LCID(const char*, unsigned short*) DECLSPEC_HIDDEN
;
231 extern MSVCRT__locale_t MSVCRT_locale DECLSPEC_HIDDEN
;
232 extern unsigned int MSVCRT___lc_codepage
;
233 extern int MSVCRT___lc_collate_cp
;
234 extern WORD MSVCRT__ctype
[257];
236 void msvcrt_set_errno(int) DECLSPEC_HIDDEN
;
238 void __cdecl
_purecall(void);
239 void __cdecl
_amsg_exit(int errnum
);
241 extern char **MSVCRT__environ
;
242 extern MSVCRT_wchar_t
**MSVCRT__wenviron
;
244 extern char ** msvcrt_SnapshotOfEnvironmentA(char **) DECLSPEC_HIDDEN
;
245 extern MSVCRT_wchar_t
** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t
**) DECLSPEC_HIDDEN
;
247 MSVCRT_wchar_t
*msvcrt_wstrdupa(const char *) DECLSPEC_HIDDEN
;
249 extern unsigned int MSVCRT__commode
;
251 /* FIXME: This should be declared in new.h but it's not an extern "C" so
252 * it would not be much use anyway. Even for Winelib applications.
254 int __cdecl
MSVCRT__set_new_mode(int mode
);
256 void* __cdecl
MSVCRT_operator_new(MSVCRT_size_t
);
257 void __cdecl
MSVCRT_operator_delete(void*);
259 typedef void* (__cdecl
*malloc_func_t
)(MSVCRT_size_t
);
260 typedef void (__cdecl
*free_func_t
)(void*);
262 /* Setup and teardown multi threaded locks */
263 extern void msvcrt_init_mt_locks(void) DECLSPEC_HIDDEN
;
264 extern void msvcrt_free_locks(void) DECLSPEC_HIDDEN
;
266 extern void msvcrt_init_exception(void*) DECLSPEC_HIDDEN
;
267 extern BOOL
msvcrt_init_locale(void) DECLSPEC_HIDDEN
;
268 extern void msvcrt_init_math(void) DECLSPEC_HIDDEN
;
269 extern void msvcrt_init_io(void) DECLSPEC_HIDDEN
;
270 extern void msvcrt_free_io(void) DECLSPEC_HIDDEN
;
271 extern void msvcrt_init_console(void) DECLSPEC_HIDDEN
;
272 extern void msvcrt_free_console(void) DECLSPEC_HIDDEN
;
273 extern void msvcrt_init_args(void) DECLSPEC_HIDDEN
;
274 extern void msvcrt_free_args(void) DECLSPEC_HIDDEN
;
275 extern void msvcrt_init_signals(void) DECLSPEC_HIDDEN
;
276 extern void msvcrt_free_signals(void) DECLSPEC_HIDDEN
;
277 extern void msvcrt_free_popen_data(void) DECLSPEC_HIDDEN
;
278 extern BOOL
msvcrt_init_heap(void) DECLSPEC_HIDDEN
;
279 extern void msvcrt_destroy_heap(void) DECLSPEC_HIDDEN
;
281 extern unsigned msvcrt_create_io_inherit_block(WORD
*, BYTE
**) DECLSPEC_HIDDEN
;
283 extern unsigned int __cdecl
_control87(unsigned int, unsigned int);
285 /* run-time error codes */
287 #define _RT_NULLPTR 1
290 #define _RT_EXECMEM 5
291 #define _RT_EXECFORM 6
292 #define _RT_EXECENV 7
293 #define _RT_SPACEARG 8
294 #define _RT_SPACEENV 9
300 #define _RT_THREAD 16
303 #define _RT_OPENCON 19
305 #define _RT_NOMAIN 21
306 #define _RT_NONCONT 22
307 #define _RT_INVALDISP 23
308 #define _RT_ONEXIT 24
309 #define _RT_PUREVIRT 25
310 #define _RT_STDIOINIT 26
311 #define _RT_LOWIOINIT 27
312 #define _RT_HEAPINIT 28
313 #define _RT_DOMAIN 120
315 #define _RT_TLOSS 122
317 #define _RT_BANNER 255
319 struct MSVCRT___timeb32
{
320 MSVCRT___time32_t time
;
321 unsigned short millitm
;
326 struct MSVCRT___timeb64
{
327 MSVCRT___time64_t time
;
328 unsigned short millitm
;
333 struct MSVCRT__iobuf
{
344 typedef struct MSVCRT__iobuf MSVCRT_FILE
;
346 struct MSVCRT_lconv
{
350 char* int_curr_symbol
;
351 char* currency_symbol
;
352 char* mon_decimal_point
;
353 char* mon_thousands_sep
;
357 char int_frac_digits
;
367 struct MSVCRT__exception
{
375 struct MSVCRT__complex
{
376 double x
; /* Real part */
377 double y
; /* Imaginary part */
380 typedef struct MSVCRT__div_t
{
381 int quot
; /* quotient */
382 int rem
; /* remainder */
385 typedef struct MSVCRT__ldiv_t
{
386 MSVCRT_long quot
; /* quotient */
387 MSVCRT_long rem
; /* remainder */
390 struct MSVCRT__heapinfo
{
397 struct MSVCRT___JUMP_BUFFER
{
404 unsigned long Registration
;
405 unsigned long TryLevel
;
406 /* Start of new struct members */
407 unsigned long Cookie
;
408 unsigned long UnwindFunc
;
409 unsigned long UnwindData
[6];
411 #elif defined(__x86_64__)
412 struct MSVCRT__SETJMP_FLOAT128
414 unsigned __int64
DECLSPEC_ALIGN(16) Part
[2];
416 struct MSVCRT___JUMP_BUFFER
418 unsigned __int64 Frame
;
419 unsigned __int64 Rbx
;
420 unsigned __int64 Rsp
;
421 unsigned __int64 Rbp
;
422 unsigned __int64 Rsi
;
423 unsigned __int64 Rdi
;
424 unsigned __int64 R12
;
425 unsigned __int64 R13
;
426 unsigned __int64 R14
;
427 unsigned __int64 R15
;
428 unsigned __int64 Rip
;
429 unsigned __int64 Spare
;
430 struct MSVCRT__SETJMP_FLOAT128 Xmm6
;
431 struct MSVCRT__SETJMP_FLOAT128 Xmm7
;
432 struct MSVCRT__SETJMP_FLOAT128 Xmm8
;
433 struct MSVCRT__SETJMP_FLOAT128 Xmm9
;
434 struct MSVCRT__SETJMP_FLOAT128 Xmm10
;
435 struct MSVCRT__SETJMP_FLOAT128 Xmm11
;
436 struct MSVCRT__SETJMP_FLOAT128 Xmm12
;
437 struct MSVCRT__SETJMP_FLOAT128 Xmm13
;
438 struct MSVCRT__SETJMP_FLOAT128 Xmm14
;
439 struct MSVCRT__SETJMP_FLOAT128 Xmm15
;
441 #elif defined(__arm__)
442 struct MSVCRT___JUMP_BUFFER
456 unsigned long long D
[8];
458 #endif /* __i386__ */
460 struct MSVCRT__diskfree_t
{
461 unsigned int total_clusters
;
462 unsigned int avail_clusters
;
463 unsigned int sectors_per_cluster
;
464 unsigned int bytes_per_sector
;
467 struct MSVCRT__finddata32_t
{
469 MSVCRT___time32_t time_create
;
470 MSVCRT___time32_t time_access
;
471 MSVCRT___time32_t time_write
;
472 MSVCRT__fsize_t size
;
476 struct MSVCRT__finddata32i64_t
{
478 MSVCRT___time32_t time_create
;
479 MSVCRT___time32_t time_access
;
480 MSVCRT___time32_t time_write
;
481 __int64
DECLSPEC_ALIGN(8) size
;
485 struct MSVCRT__finddata64i32_t
{
487 MSVCRT___time64_t time_create
;
488 MSVCRT___time64_t time_access
;
489 MSVCRT___time64_t time_write
;
490 MSVCRT__fsize_t size
;
494 struct MSVCRT__finddata64_t
{
496 MSVCRT___time64_t time_create
;
497 MSVCRT___time64_t time_access
;
498 MSVCRT___time64_t time_write
;
499 __int64
DECLSPEC_ALIGN(8) size
;
503 struct MSVCRT__wfinddata32_t
{
505 MSVCRT___time32_t time_create
;
506 MSVCRT___time32_t time_access
;
507 MSVCRT___time32_t time_write
;
508 MSVCRT__fsize_t size
;
509 MSVCRT_wchar_t name
[260];
512 struct MSVCRT__wfinddata32i64_t
{
514 MSVCRT___time32_t time_create
;
515 MSVCRT___time32_t time_access
;
516 MSVCRT___time32_t time_write
;
517 __int64
DECLSPEC_ALIGN(8) size
;
518 MSVCRT_wchar_t name
[260];
521 struct MSVCRT__wfinddata64i32_t
{
523 MSVCRT___time64_t time_create
;
524 MSVCRT___time64_t time_access
;
525 MSVCRT___time64_t time_write
;
526 MSVCRT__fsize_t size
;
527 MSVCRT_wchar_t name
[260];
530 struct MSVCRT__wfinddata64_t
{
532 MSVCRT___time64_t time_create
;
533 MSVCRT___time64_t time_access
;
534 MSVCRT___time64_t time_write
;
535 __int64
DECLSPEC_ALIGN(8) size
;
536 MSVCRT_wchar_t name
[260];
539 struct MSVCRT___utimbuf32
541 MSVCRT___time32_t actime
;
542 MSVCRT___time32_t modtime
;
545 struct MSVCRT___utimbuf64
547 MSVCRT___time64_t actime
;
548 MSVCRT___time64_t modtime
;
556 struct MSVCRT__stat32
{
557 MSVCRT__dev_t st_dev
;
558 MSVCRT__ino_t st_ino
;
559 unsigned short st_mode
;
563 MSVCRT__dev_t st_rdev
;
564 MSVCRT__off_t st_size
;
565 MSVCRT___time32_t st_atime
;
566 MSVCRT___time32_t st_mtime
;
567 MSVCRT___time32_t st_ctime
;
570 struct MSVCRT__stat32i64
{
571 MSVCRT__dev_t st_dev
;
572 MSVCRT__ino_t st_ino
;
573 unsigned short st_mode
;
577 MSVCRT__dev_t st_rdev
;
578 __int64
DECLSPEC_ALIGN(8) st_size
;
579 MSVCRT___time32_t st_atime
;
580 MSVCRT___time32_t st_mtime
;
581 MSVCRT___time32_t st_ctime
;
584 struct MSVCRT__stat64i32
{
585 MSVCRT__dev_t st_dev
;
586 MSVCRT__ino_t st_ino
;
587 unsigned short st_mode
;
591 MSVCRT__dev_t st_rdev
;
592 MSVCRT__off_t st_size
;
593 MSVCRT___time64_t st_atime
;
594 MSVCRT___time64_t st_mtime
;
595 MSVCRT___time64_t st_ctime
;
598 struct MSVCRT__stat64
{
599 MSVCRT__dev_t st_dev
;
600 MSVCRT__ino_t st_ino
;
601 unsigned short st_mode
;
605 MSVCRT__dev_t st_rdev
;
606 __int64
DECLSPEC_ALIGN(8) st_size
;
607 MSVCRT___time64_t st_atime
;
608 MSVCRT___time64_t st_mtime
;
609 MSVCRT___time64_t st_ctime
;
613 #define MSVCRT__finddata_t MSVCRT__finddata64i32_t
614 #define MSVCRT__finddatai64_t MSVCRT__finddata64_t
615 #define MSVCRT__wfinddata_t MSVCRT__wfinddata64i32_t
616 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata64_t
617 #define MSVCRT__stat MSVCRT__stat64i32
618 #define MSVCRT__stati64 MSVCRT__stat64
620 #define MSVCRT__finddata_t MSVCRT__finddata32_t
621 #define MSVCRT__finddatai64_t MSVCRT__finddata32i64_t
622 #define MSVCRT__wfinddata_t MSVCRT__wfinddata32_t
623 #define MSVCRT__wfinddatai64_t MSVCRT__wfinddata32i64_t
624 #define MSVCRT__stat MSVCRT__stat32
625 #define MSVCRT__stati64 MSVCRT__stat32i64
628 #define MSVCRT_WEOF (MSVCRT_wint_t)(0xFFFF)
629 #define MSVCRT_EOF (-1)
630 #define MSVCRT_TMP_MAX 0x7fff
631 #define MSVCRT_RAND_MAX 0x7fff
632 #define MSVCRT_BUFSIZ 512
634 #define MSVCRT_STDIN_FILENO 0
635 #define MSVCRT_STDOUT_FILENO 1
636 #define MSVCRT_STDERR_FILENO 2
638 /* more file._flag flags, but these conflict with Unix */
639 #define MSVCRT__IOFBF 0x0000
640 #define MSVCRT__IONBF 0x0004
641 #define MSVCRT__IOLBF 0x0040
643 #define MSVCRT_FILENAME_MAX 260
644 #define MSVCRT_DRIVE_MAX 3
645 #define MSVCRT_FNAME_MAX 256
646 #define MSVCRT_DIR_MAX 256
647 #define MSVCRT_EXT_MAX 256
648 #define MSVCRT_PATH_MAX 260
649 #define MSVCRT_stdin (MSVCRT__iob+MSVCRT_STDIN_FILENO)
650 #define MSVCRT_stdout (MSVCRT__iob+MSVCRT_STDOUT_FILENO)
651 #define MSVCRT_stderr (MSVCRT__iob+MSVCRT_STDERR_FILENO)
653 #define MSVCRT__P_WAIT 0
654 #define MSVCRT__P_NOWAIT 1
655 #define MSVCRT__P_OVERLAY 2
656 #define MSVCRT__P_NOWAITO 3
657 #define MSVCRT__P_DETACH 4
659 #define MSVCRT_EPERM 1
660 #define MSVCRT_ENOENT 2
661 #define MSVCRT_ESRCH 3
662 #define MSVCRT_EINTR 4
664 #define MSVCRT_ENXIO 6
665 #define MSVCRT_E2BIG 7
666 #define MSVCRT_ENOEXEC 8
667 #define MSVCRT_EBADF 9
668 #define MSVCRT_ECHILD 10
669 #define MSVCRT_EAGAIN 11
670 #define MSVCRT_ENOMEM 12
671 #define MSVCRT_EACCES 13
672 #define MSVCRT_EFAULT 14
673 #define MSVCRT_EBUSY 16
674 #define MSVCRT_EEXIST 17
675 #define MSVCRT_EXDEV 18
676 #define MSVCRT_ENODEV 19
677 #define MSVCRT_ENOTDIR 20
678 #define MSVCRT_EISDIR 21
679 #define MSVCRT_EINVAL 22
680 #define MSVCRT_ENFILE 23
681 #define MSVCRT_EMFILE 24
682 #define MSVCRT_ENOTTY 25
683 #define MSVCRT_EFBIG 27
684 #define MSVCRT_ENOSPC 28
685 #define MSVCRT_ESPIPE 29
686 #define MSVCRT_EROFS 30
687 #define MSVCRT_EMLINK 31
688 #define MSVCRT_EPIPE 32
689 #define MSVCRT_EDOM 33
690 #define MSVCRT_ERANGE 34
691 #define MSVCRT_EDEADLK 36
692 #define MSVCRT_EDEADLOCK MSVCRT_EDEADLK
693 #define MSVCRT_ENAMETOOLONG 38
694 #define MSVCRT_ENOLCK 39
695 #define MSVCRT_ENOSYS 40
696 #define MSVCRT_ENOTEMPTY 41
697 #define MSVCRT_EILSEQ 42
698 #define MSVCRT_STRUNCATE 80
700 #define MSVCRT_LC_ALL 0
701 #define MSVCRT_LC_COLLATE 1
702 #define MSVCRT_LC_CTYPE 2
703 #define MSVCRT_LC_MONETARY 3
704 #define MSVCRT_LC_NUMERIC 4
705 #define MSVCRT_LC_TIME 5
706 #define MSVCRT_LC_MIN MSVCRT_LC_ALL
707 #define MSVCRT_LC_MAX MSVCRT_LC_TIME
709 #define MSVCRT__HEAPEMPTY -1
710 #define MSVCRT__HEAPOK -2
711 #define MSVCRT__HEAPBADBEGIN -3
712 #define MSVCRT__HEAPBADNODE -4
713 #define MSVCRT__HEAPEND -5
714 #define MSVCRT__HEAPBADPTR -6
716 #define MSVCRT__FREEENTRY 0
717 #define MSVCRT__USEDENTRY 1
719 #define MSVCRT__OUT_TO_DEFAULT 0
720 #define MSVCRT__OUT_TO_STDERR 1
721 #define MSVCRT__OUT_TO_MSGBOX 2
722 #define MSVCRT__REPORT_ERRMODE 3
724 /* ASCII char classification table - binary compatible */
725 #define MSVCRT__UPPER 0x0001 /* C1_UPPER */
726 #define MSVCRT__LOWER 0x0002 /* C1_LOWER */
727 #define MSVCRT__DIGIT 0x0004 /* C1_DIGIT */
728 #define MSVCRT__SPACE 0x0008 /* C1_SPACE */
729 #define MSVCRT__PUNCT 0x0010 /* C1_PUNCT */
730 #define MSVCRT__CONTROL 0x0020 /* C1_CNTRL */
731 #define MSVCRT__BLANK 0x0040 /* C1_BLANK */
732 #define MSVCRT__HEX 0x0080 /* C1_XDIGIT */
733 #define MSVCRT__LEADBYTE 0x8000
734 #define MSVCRT__ALPHA (0x0100|MSVCRT__UPPER|MSVCRT__LOWER) /* (C1_ALPHA|_UPPER|_LOWER) */
736 #define MSVCRT__IOREAD 0x0001
737 #define MSVCRT__IOWRT 0x0002
738 #define MSVCRT__IOMYBUF 0x0008
739 #define MSVCRT__IOEOF 0x0010
740 #define MSVCRT__IOERR 0x0020
741 #define MSVCRT__IOSTRG 0x0040
742 #define MSVCRT__IORW 0x0080
743 #define MSVCRT__USERBUF 0x0100
744 #define MSVCRT__IOCOMMIT 0x4000
746 #define MSVCRT__S_IEXEC 0x0040
747 #define MSVCRT__S_IWRITE 0x0080
748 #define MSVCRT__S_IREAD 0x0100
749 #define MSVCRT__S_IFIFO 0x1000
750 #define MSVCRT__S_IFCHR 0x2000
751 #define MSVCRT__S_IFDIR 0x4000
752 #define MSVCRT__S_IFREG 0x8000
753 #define MSVCRT__S_IFMT 0xF000
755 #define MSVCRT__LK_UNLCK 0
756 #define MSVCRT__LK_LOCK 1
757 #define MSVCRT__LK_NBLCK 2
758 #define MSVCRT__LK_RLCK 3
759 #define MSVCRT__LK_NBRLCK 4
761 #define MSVCRT__SH_COMPAT 0x00 /* Compatibility */
762 #define MSVCRT__SH_DENYRW 0x10 /* Deny read/write */
763 #define MSVCRT__SH_DENYWR 0x20 /* Deny write */
764 #define MSVCRT__SH_DENYRD 0x30 /* Deny read */
765 #define MSVCRT__SH_DENYNO 0x40 /* Deny nothing */
767 #define MSVCRT__O_RDONLY 0
768 #define MSVCRT__O_WRONLY 1
769 #define MSVCRT__O_RDWR 2
770 #define MSVCRT__O_ACCMODE (MSVCRT__O_RDONLY|MSVCRT__O_WRONLY|MSVCRT__O_RDWR)
771 #define MSVCRT__O_APPEND 0x0008
772 #define MSVCRT__O_RANDOM 0x0010
773 #define MSVCRT__O_SEQUENTIAL 0x0020
774 #define MSVCRT__O_TEMPORARY 0x0040
775 #define MSVCRT__O_NOINHERIT 0x0080
776 #define MSVCRT__O_CREAT 0x0100
777 #define MSVCRT__O_TRUNC 0x0200
778 #define MSVCRT__O_EXCL 0x0400
779 #define MSVCRT__O_SHORT_LIVED 0x1000
780 #define MSVCRT__O_TEXT 0x4000
781 #define MSVCRT__O_BINARY 0x8000
782 #define MSVCRT__O_RAW MSVCRT__O_BINARY
783 #define MSVCRT__O_WTEXT 0x10000
784 #define MSVCRT__O_U16TEXT 0x20000
785 #define MSVCRT__O_U8TEXT 0x40000
787 /* _statusfp bit flags */
788 #define MSVCRT__SW_INEXACT 0x00000001 /* inexact (precision) */
789 #define MSVCRT__SW_UNDERFLOW 0x00000002 /* underflow */
790 #define MSVCRT__SW_OVERFLOW 0x00000004 /* overflow */
791 #define MSVCRT__SW_ZERODIVIDE 0x00000008 /* zero divide */
792 #define MSVCRT__SW_INVALID 0x00000010 /* invalid */
794 #define MSVCRT__SW_UNEMULATED 0x00000040 /* unemulated instruction */
795 #define MSVCRT__SW_SQRTNEG 0x00000080 /* square root of a neg number */
796 #define MSVCRT__SW_STACKOVERFLOW 0x00000200 /* FP stack overflow */
797 #define MSVCRT__SW_STACKUNDERFLOW 0x00000400 /* FP stack underflow */
799 #define MSVCRT__SW_DENORMAL 0x00080000 /* denormal status bit */
801 /* fpclass constants */
802 #define MSVCRT__FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */
803 #define MSVCRT__FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */
804 #define MSVCRT__FPCLASS_NINF 0x0004 /* Negative Infinity */
805 #define MSVCRT__FPCLASS_NN 0x0008 /* Negative Normal */
806 #define MSVCRT__FPCLASS_ND 0x0010 /* Negative Denormal */
807 #define MSVCRT__FPCLASS_NZ 0x0020 /* Negative Zero */
808 #define MSVCRT__FPCLASS_PZ 0x0040 /* Positive Zero */
809 #define MSVCRT__FPCLASS_PD 0x0080 /* Positive Denormal */
810 #define MSVCRT__FPCLASS_PN 0x0100 /* Positive Normal */
811 #define MSVCRT__FPCLASS_PINF 0x0200 /* Positive Infinity */
813 #define MSVCRT__MCW_EM 0x0008001f
814 #define MSVCRT__MCW_IC 0x00040000
815 #define MSVCRT__MCW_RC 0x00000300
816 #define MSVCRT__MCW_PC 0x00030000
817 #define MSVCRT__MCW_DN 0x03000000
819 #define MSVCRT__EM_INVALID 0x00000010
820 #define MSVCRT__EM_DENORMAL 0x00080000
821 #define MSVCRT__EM_ZERODIVIDE 0x00000008
822 #define MSVCRT__EM_OVERFLOW 0x00000004
823 #define MSVCRT__EM_UNDERFLOW 0x00000002
824 #define MSVCRT__EM_INEXACT 0x00000001
825 #define MSVCRT__IC_AFFINE 0x00040000
826 #define MSVCRT__IC_PROJECTIVE 0x00000000
827 #define MSVCRT__RC_CHOP 0x00000300
828 #define MSVCRT__RC_UP 0x00000200
829 #define MSVCRT__RC_DOWN 0x00000100
830 #define MSVCRT__RC_NEAR 0x00000000
831 #define MSVCRT__PC_24 0x00020000
832 #define MSVCRT__PC_53 0x00010000
833 #define MSVCRT__PC_64 0x00000000
834 #define MSVCRT__DN_SAVE 0x00000000
835 #define MSVCRT__DN_FLUSH 0x01000000
836 #define MSVCRT__DN_FLUSH_OPERANDS_SAVE_RESULTS 0x02000000
837 #define MSVCRT__DN_SAVE_OPERANDS_FLUSH_RESULTS 0x03000000
838 #define MSVCRT__EM_AMBIGUOUS 0x80000000
840 #define MSVCRT_CLOCKS_PER_SEC 1000
843 #define MSVCRT_SIGINT 2
844 #define MSVCRT_SIGILL 4
845 #define MSVCRT_SIGFPE 8
846 #define MSVCRT_SIGSEGV 11
847 #define MSVCRT_SIGTERM 15
848 #define MSVCRT_SIGBREAK 21
849 #define MSVCRT_SIGABRT 22
850 #define MSVCRT_NSIG (MSVCRT_SIGABRT + 1)
852 typedef void (__cdecl
*MSVCRT___sighandler_t
)(int);
854 #define MSVCRT_SIG_DFL ((MSVCRT___sighandler_t)0)
855 #define MSVCRT_SIG_IGN ((MSVCRT___sighandler_t)1)
856 #define MSVCRT_SIG_ERR ((MSVCRT___sighandler_t)-1)
858 #define MSVCRT__FPE_INVALID 0x81
859 #define MSVCRT__FPE_DENORMAL 0x82
860 #define MSVCRT__FPE_ZERODIVIDE 0x83
861 #define MSVCRT__FPE_OVERFLOW 0x84
862 #define MSVCRT__FPE_UNDERFLOW 0x85
863 #define MSVCRT__FPE_INEXACT 0x86
864 #define MSVCRT__FPE_UNEMULATED 0x87
865 #define MSVCRT__FPE_SQRTNEG 0x88
866 #define MSVCRT__FPE_STACKOVERFLOW 0x8a
867 #define MSVCRT__FPE_STACKUNDERFLOW 0x8b
868 #define MSVCRT__FPE_EXPLICITGEN 0x8c
878 #define _MBC_SINGLE 0
881 #define _MBC_ILLEGAL -1
883 #define _MB_CP_SBCS 0
884 #define _MB_CP_OEM -2
885 #define _MB_CP_ANSI -3
886 #define _MB_CP_LOCALE -4
888 #define MSVCRT__TRUNCATE ((MSVCRT_size_t)-1)
890 #define _MAX__TIME64_T (((MSVCRT___time64_t)0x00000007 << 32) | 0x93406FFF)
892 /* _set_abort_behavior codes */
893 #define MSVCRT__WRITE_ABORT_MSG 1
894 #define MSVCRT__CALL_REPORTFAULT 2
896 /* _get_output_format return code */
897 #define MSVCRT__TWO_DIGIT_EXPONENT 0x1
899 #define MSVCRT__NLSCMPERROR ((unsigned int)0x7fffffff)
901 void __cdecl
MSVCRT_free(void*);
902 void* __cdecl
MSVCRT_malloc(MSVCRT_size_t
);
903 void* __cdecl
MSVCRT_calloc(MSVCRT_size_t
,MSVCRT_size_t
);
904 void* __cdecl
MSVCRT_realloc(void*,MSVCRT_size_t
);
906 int __cdecl
MSVCRT_iswalpha(MSVCRT_wint_t
);
907 int __cdecl
MSVCRT_iswspace(MSVCRT_wint_t
);
908 int __cdecl
MSVCRT_iswdigit(MSVCRT_wint_t
);
909 int __cdecl
MSVCRT_isleadbyte(int);
910 int __cdecl
MSVCRT__isleadbyte_l(int, MSVCRT__locale_t
);
912 void __cdecl
MSVCRT__lock_file(MSVCRT_FILE
*);
913 void __cdecl
MSVCRT__unlock_file(MSVCRT_FILE
*);
914 int __cdecl
MSVCRT_fgetc(MSVCRT_FILE
*);
915 int __cdecl
MSVCRT_ungetc(int,MSVCRT_FILE
*);
916 MSVCRT_wint_t __cdecl
MSVCRT_fgetwc(MSVCRT_FILE
*);
917 MSVCRT_wint_t __cdecl
MSVCRT_ungetwc(MSVCRT_wint_t
,MSVCRT_FILE
*);
918 __int64 __cdecl
MSVCRT__ftelli64(MSVCRT_FILE
* file
);
919 void __cdecl
MSVCRT__exit(int);
920 void __cdecl
MSVCRT_abort(void);
921 MSVCRT_ulong
* __cdecl
MSVCRT___doserrno(void);
922 int* __cdecl
MSVCRT__errno(void);
923 char* __cdecl
MSVCRT_getenv(const char*);
924 int __cdecl
MSVCRT_fclose(MSVCRT_FILE
*);
925 void __cdecl
MSVCRT_terminate(void);
926 MSVCRT_FILE
* __cdecl
MSVCRT__iob_func(void);
927 MSVCRT_clock_t __cdecl
MSVCRT_clock(void);
928 MSVCRT___time32_t __cdecl
MSVCRT__time32(MSVCRT___time32_t
*);
929 MSVCRT___time64_t __cdecl
MSVCRT__time64(MSVCRT___time64_t
*);
930 MSVCRT_FILE
* __cdecl
MSVCRT__fdopen(int, const char *);
931 MSVCRT_FILE
* __cdecl
MSVCRT__wfdopen(int, const MSVCRT_wchar_t
*);
932 int __cdecl
MSVCRT_vsnprintf(char *str
, MSVCRT_size_t len
, const char *format
, __ms_va_list valist
);
933 int __cdecl
MSVCRT_vsnwprintf(MSVCRT_wchar_t
*str
, MSVCRT_size_t len
,
934 const MSVCRT_wchar_t
*format
, __ms_va_list valist
);
935 int __cdecl
MSVCRT__snwprintf(MSVCRT_wchar_t
*, unsigned int, const MSVCRT_wchar_t
*, ...);
936 int __cdecl
MSVCRT_sprintf(char*,const char*,...);
937 int __cdecl
MSVCRT__snprintf(char*,unsigned int,const char*,...);
938 int __cdecl
MSVCRT__scprintf(const char*,...);
939 int __cdecl
MSVCRT_raise(int sig
);
940 int __cdecl
MSVCRT__set_printf_count_output(int);
942 #define MSVCRT__ENABLE_PER_THREAD_LOCALE 1
943 #define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
945 extern MSVCRT__locale_t MSVCRT_locale
;
946 MSVCRT_pthreadlocinfo
get_locinfo(void) DECLSPEC_HIDDEN
;
947 MSVCRT_pthreadmbcinfo
get_mbcinfo(void) DECLSPEC_HIDDEN
;
948 void __cdecl
MSVCRT__free_locale(MSVCRT__locale_t
);
949 void free_locinfo(MSVCRT_pthreadlocinfo
) DECLSPEC_HIDDEN
;
950 void free_mbcinfo(MSVCRT_pthreadmbcinfo
) DECLSPEC_HIDDEN
;
951 int _setmbcp_l(int, LCID
, MSVCRT_pthreadmbcinfo
) DECLSPEC_HIDDEN
;
953 #ifndef __WINE_MSVCRT_TEST
954 int __cdecl
MSVCRT__write(int,const void*,unsigned int);
955 int __cdecl
_getch(void);
956 int __cdecl
_ismbblead(unsigned int);
957 int __cdecl
_ismbclegal(unsigned int c
);
958 int __cdecl
_ismbstrail(const unsigned char* start
, const unsigned char* str
);
959 int __cdecl
MSVCRT_mbtowc(MSVCRT_wchar_t
*,const char*,MSVCRT_size_t
);
960 MSVCRT_size_t __cdecl
MSVCRT_mbstowcs(MSVCRT_wchar_t
*,const char*,MSVCRT_size_t
);
961 MSVCRT_size_t __cdecl
MSVCRT_wcstombs(char*,const MSVCRT_wchar_t
*,MSVCRT_size_t
);
962 MSVCRT_intptr_t __cdecl
MSVCRT__spawnve(int,const char*,const char* const *,const char* const *);
963 MSVCRT_intptr_t __cdecl
MSVRT__spawnvpe(int,const char*,const char* const *,const char* const *);
964 MSVCRT_intptr_t __cdecl
MSVCRT__wspawnve(int,const MSVCRT_wchar_t
*,const MSVCRT_wchar_t
* const *,const MSVCRT_wchar_t
* const *);
965 MSVCRT_intptr_t __cdecl
MSVCRT__wspawnvpe(int,const MSVCRT_wchar_t
*,const MSVCRT_wchar_t
* const *,const MSVCRT_wchar_t
* const *);
966 void __cdecl
MSVCRT__searchenv(const char*,const char*,char*);
967 int __cdecl
MSVCRT__getdrive(void);
968 char* __cdecl
MSVCRT__strdup(const char*);
969 char* __cdecl
MSVCRT__strnset(char*,int,MSVCRT_size_t
);
970 char* __cdecl
_strset(char*,int);
971 int __cdecl
_ungetch(int);
972 int __cdecl
_cputs(const char*);
973 int __cdecl
_cprintf(const char*,...);
974 int __cdecl
_cwprintf(const MSVCRT_wchar_t
*,...);
975 char*** __cdecl
MSVCRT___p__environ(void);
976 int* __cdecl
__p___mb_cur_max(void);
977 unsigned int* __cdecl
__p__fmode(void);
978 MSVCRT_wchar_t
* __cdecl
MSVCRT__wcsdup(const MSVCRT_wchar_t
*);
979 MSVCRT_wchar_t
*** __cdecl
MSVCRT___p__wenviron(void);
980 INT __cdecl
MSVCRT_wctomb(char*,MSVCRT_wchar_t
);
981 char* __cdecl
MSVCRT__strdate(char* date
);
982 char* __cdecl
MSVCRT__strtime(char* date
);
983 int __cdecl
_setmbcp(int);
984 int __cdecl
MSVCRT__close(int);
985 int __cdecl
MSVCRT__dup(int);
986 int __cdecl
MSVCRT__dup2(int, int);
987 int __cdecl
MSVCRT__pipe(int *, unsigned int, int);
988 MSVCRT_wchar_t
* __cdecl
MSVCRT__wgetenv(const MSVCRT_wchar_t
*);
989 void __cdecl
MSVCRT__wsearchenv(const MSVCRT_wchar_t
*, const MSVCRT_wchar_t
*, MSVCRT_wchar_t
*);
990 MSVCRT_intptr_t __cdecl
MSVCRT__spawnvpe(int, const char*, const char* const*, const char* const*);
991 void __cdecl
MSVCRT__invalid_parameter(const MSVCRT_wchar_t
*expr
, const MSVCRT_wchar_t
*func
,
992 const MSVCRT_wchar_t
*file
, unsigned int line
, MSVCRT_uintptr_t arg
);
993 int __cdecl
MSVCRT__toupper_l(int,MSVCRT__locale_t
);
994 int __cdecl
MSVCRT__tolower_l(int,MSVCRT__locale_t
);
995 int __cdecl
MSVCRT__strnicoll_l(const char*, const char*, MSVCRT_size_t
, MSVCRT__locale_t
);
996 int __cdecl
MSVCRT__strncoll_l(const char*, const char*, MSVCRT_size_t
, MSVCRT__locale_t
);
997 unsigned int __cdecl
MSVCRT__get_output_format(void);
998 char* __cdecl
MSVCRT_strtok_s(char*, const char*, char**);
1000 /* Maybe one day we'll enable the invalid parameter handlers with the full set of information (msvcrXXd)
1001 * #define MSVCRT_INVALID_PMT(x) MSVCRT_call_invalid_parameter_handler(x, __FUNCTION__, __FILE__, __LINE__, 0)
1002 * #define MSVCRT_CHECK_PMT(x) ((x) ? TRUE : MSVCRT_INVALID_PMT(#x),FALSE)
1003 * Until this is done, just keep the same semantics for CHECK_PMT(), but without generating / sending
1005 * NB : MSVCRT_call_invalid_parameter_handler is a wrapper around MSVCRT__invalid_parameter in order
1006 * to do the Ansi to Unicode transformation
1008 #define MSVCRT_INVALID_PMT(x,err) (*MSVCRT__errno() = (err), MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0))
1009 #define MSVCRT_CHECK_PMT_ERR(x,err) ((x) || (MSVCRT_INVALID_PMT( 0, (err) ), FALSE))
1010 #define MSVCRT_CHECK_PMT(x) MSVCRT_CHECK_PMT_ERR((x), MSVCRT_EINVAL)
1013 #define MSVCRT__ARGMAX 100
1014 typedef int (*puts_clbk_a
)(void*, int, const char*);
1015 typedef int (*puts_clbk_w
)(void*, int, const MSVCRT_wchar_t
*);
1016 typedef union _printf_arg
1020 LONGLONG get_longlong
;
1023 typedef printf_arg (*args_clbk
)(void*, int, int, __ms_va_list
*);
1024 int pf_printf_a(puts_clbk_a
, void*, const char*, MSVCRT__locale_t
,
1025 BOOL
, BOOL
, args_clbk
, void*, __ms_va_list
*) DECLSPEC_HIDDEN
;
1026 int pf_printf_w(puts_clbk_w
, void*, const MSVCRT_wchar_t
*, MSVCRT__locale_t
,
1027 BOOL
, BOOL
, args_clbk
, void*, __ms_va_list
*) DECLSPEC_HIDDEN
;
1028 printf_arg
arg_clbk_valist(void*, int, int, __ms_va_list
*) DECLSPEC_HIDDEN
;
1030 #define MSVCRT_FLT_MIN 1.175494351e-38F
1031 #define MSVCRT_DBL_MIN 2.2250738585072014e-308
1032 #define MSVCRT__OVERFLOW 3
1033 #define MSVCRT__UNDERFLOW 4
1038 } MSVCRT__CRT_FLOAT
;
1043 } MSVCRT__CRT_DOUBLE
;
1045 extern char* __cdecl
__unDName(char *,const char*,int,malloc_func_t
,free_func_t
,unsigned short int);
1047 /* __unDName/__unDNameEx flags */
1048 #define UNDNAME_COMPLETE (0x0000)
1049 #define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) /* Don't show __ in calling convention */
1050 #define UNDNAME_NO_MS_KEYWORDS (0x0002) /* Don't show calling convention at all */
1051 #define UNDNAME_NO_FUNCTION_RETURNS (0x0004) /* Don't show function/method return value */
1052 #define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
1053 #define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
1054 #define UNDNAME_NO_MS_THISTYPE (0x0020)
1055 #define UNDNAME_NO_CV_THISTYPE (0x0040)
1056 #define UNDNAME_NO_THISTYPE (0x0060)
1057 #define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) /* Don't show access specifier (public/protected/private) */
1058 #define UNDNAME_NO_THROW_SIGNATURES (0x0100)
1059 #define UNDNAME_NO_MEMBER_TYPE (0x0200) /* Don't show static/virtual specifier */
1060 #define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
1061 #define UNDNAME_32_BIT_DECODE (0x0800)
1062 #define UNDNAME_NAME_ONLY (0x1000) /* Only report the variable/method name */
1063 #define UNDNAME_NO_ARGUMENTS (0x2000) /* Don't show method arguments */
1064 #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
1065 #define UNDNAME_NO_COMPLEX_TYPE (0x8000)
1067 #endif /* __WINE_MSVCRT_H */