xref: /reactos/sdk/lib/crt/include/internal/wine/msvcrt.h (revision 34593d93)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Copyright 2001 Jon Griffiths
3c2c66affSColin Finck  * Copyright 2004 Dimitrie O. Paun
4c2c66affSColin Finck  *
5c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
6c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
7c2c66affSColin Finck  * License as published by the Free Software Foundation; either
8c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
9c2c66affSColin Finck  *
10c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
11c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13c2c66affSColin Finck  * Lesser General Public License for more details.
14c2c66affSColin Finck  *
15c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
16c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
17c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18c2c66affSColin Finck  *
19c2c66affSColin Finck  * NOTES
20c2c66affSColin Finck  *   Naming conventions
21c2c66affSColin Finck  *	- Symbols are prefixed with MSVCRT_ if they conflict
22c2c66affSColin Finck  *        with libc symbols
23c2c66affSColin Finck  *      - Internal symbols are usually prefixed by msvcrt_.
24c2c66affSColin Finck  *      - Exported symbols that are not present in the public
25c2c66affSColin Finck  *        headers are usually kept the same as the original.
26c2c66affSColin Finck  *   Other conventions
27c2c66affSColin Finck  *      - To avoid conflicts with the standard C library,
28c2c66affSColin Finck  *        no msvcrt headers are included in the implementation.
29c2c66affSColin Finck  *      - Instead, symbols are duplicated here, prefixed with
30c2c66affSColin Finck  *        MSVCRT_, as explained above.
31c2c66affSColin Finck  *      - To avoid inconsistencies, a test for each symbol is
32c2c66affSColin Finck  *        added into tests/headers.c. Please always add a
33c2c66affSColin Finck  *        corresponding test when you add a new symbol!
34c2c66affSColin Finck  */
35c2c66affSColin Finck 
36c2c66affSColin Finck #ifndef __WINE_MSVCRT_H
37c2c66affSColin Finck #define __WINE_MSVCRT_H
38c2c66affSColin Finck 
39c2c66affSColin Finck #include <stdarg.h>
40c2c66affSColin Finck #include <signal.h>
41c2c66affSColin Finck #include "windef.h"
42c2c66affSColin Finck #include "winbase.h"
43c2c66affSColin Finck 
44c2c66affSColin Finck extern unsigned int __lc_codepage;
45c2c66affSColin Finck extern int __lc_collate_cp;
46c2c66affSColin Finck extern int __mb_cur_max;
47c2c66affSColin Finck extern const unsigned short _ctype [257];
48c2c66affSColin Finck 
49c2c66affSColin Finck void __cdecl _purecall(void);
50c2c66affSColin Finck __declspec(noreturn) void __cdecl _amsg_exit(int errnum);
51c2c66affSColin Finck 
52c2c66affSColin Finck extern char **_environ;
53c2c66affSColin Finck extern wchar_t **_wenviron;
54c2c66affSColin Finck extern char ** SnapshotOfEnvironmentA(char **);
55c2c66affSColin Finck extern wchar_t ** SnapshotOfEnvironmentW(wchar_t **);
56c2c66affSColin Finck 
57c2c66affSColin Finck /* Application type flags */
58c2c66affSColin Finck #define _UNKNOWN_APP    0
59c2c66affSColin Finck #define _CONSOLE_APP    1
60c2c66affSColin Finck #define _GUI_APP        2
61c2c66affSColin Finck 
62c2c66affSColin Finck /* I/O Streamming flags missing from stdio.h */
63c2c66affSColin Finck #define _IOYOURBUF      0x0100
64c2c66affSColin Finck #define _IOAPPEND       0x0200
65c2c66affSColin Finck #define _IOSETVBUF      0x0400
66c2c66affSColin Finck #define _IOFEOF         0x0800
67c2c66affSColin Finck #define _IOFLRTN        0x1000
68c2c66affSColin Finck #define _IOCTRLZ        0x2000
69c2c66affSColin Finck #define _IOCOMMIT       0x4000
70c2c66affSColin Finck #define _IOFREE         0x10000
71c2c66affSColin Finck 
72c2c66affSColin Finck //wchar_t *wstrdupa(const char *);
73c2c66affSColin Finck //
74c2c66affSColin Finck ///* FIXME: This should be declared in new.h but it's not an extern "C" so
75c2c66affSColin Finck // * it would not be much use anyway. Even for Winelib applications.
76c2c66affSColin Finck // */
77c2c66affSColin Finck //int __cdecl _set_new_mode(int mode);
78c2c66affSColin Finck //
79c2c66affSColin Finck void* __cdecl MSVCRT_operator_new(size_t);
80c2c66affSColin Finck void __cdecl MSVCRT_operator_delete(void*);
81c2c66affSColin Finck typedef void* (__cdecl *malloc_func_t)(size_t);
82c2c66affSColin Finck typedef void  (__cdecl *free_func_t)(void*);
83c2c66affSColin Finck 
84c2c66affSColin Finck /* Setup and teardown multi threaded locks */
85c2c66affSColin Finck extern void msvcrt_init_mt_locks(void);
86c2c66affSColin Finck extern void msvcrt_free_mt_locks(void);
87c2c66affSColin Finck 
88c2c66affSColin Finck extern BOOL msvcrt_init_locale(void);
89c2c66affSColin Finck extern void msvcrt_init_math(void);
90c2c66affSColin Finck extern void msvcrt_init_io(void);
91c2c66affSColin Finck extern void msvcrt_free_io(void);
92c2c66affSColin Finck extern void msvcrt_init_console(void);
93c2c66affSColin Finck extern void msvcrt_free_console(void);
94c2c66affSColin Finck extern void msvcrt_init_args(void);
95c2c66affSColin Finck extern void msvcrt_free_args(void);
96c2c66affSColin Finck extern void msvcrt_init_signals(void);
97c2c66affSColin Finck extern void msvcrt_free_signals(void);
98c2c66affSColin Finck extern void msvcrt_free_popen_data(void);
99c2c66affSColin Finck 
100c2c66affSColin Finck extern unsigned create_io_inherit_block(WORD*, BYTE**);
101c2c66affSColin Finck 
102c2c66affSColin Finck /* _set_abort_behavior codes */
103c2c66affSColin Finck #define MSVCRT__WRITE_ABORT_MSG    1
104c2c66affSColin Finck #define MSVCRT__CALL_REPORTFAULT   2
105c2c66affSColin Finck 
106c2c66affSColin Finck #define MSVCRT_LC_ALL      LC_ALL
107c2c66affSColin Finck #define MSVCRT_LC_COLLATE  LC_COLLATE
108c2c66affSColin Finck #define MSVCRT_LC_CTYPE    LC_CTYPE
109c2c66affSColin Finck #define MSVCRT_LC_MONETARY LC_MONETARY
110c2c66affSColin Finck #define MSVCRT_LC_NUMERIC  LC_NUMERIC
111c2c66affSColin Finck #define MSVCRT_LC_TIME     LC_TIME
112c2c66affSColin Finck #define MSVCRT_LC_MIN      LC_MIN
113c2c66affSColin Finck #define MSVCRT_LC_MAX      LC_MAX
114c2c66affSColin Finck 
115c2c66affSColin Finck #define MSVCRT__OUT_TO_DEFAULT 0
116c2c66affSColin Finck #define MSVCRT__OUT_TO_STDERR  1
117c2c66affSColin Finck #define MSVCRT__OUT_TO_MSGBOX  2
118c2c66affSColin Finck #define MSVCRT__REPORT_ERRMODE 3
119c2c66affSColin Finck 
120c2c66affSColin Finck extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
121c2c66affSColin Finck 
122c2c66affSColin Finck /* __unDName/__unDNameEx flags */
123c2c66affSColin Finck #define UNDNAME_COMPLETE                 (0x0000)
124c2c66affSColin Finck #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001) /* Don't show __ in calling convention */
125c2c66affSColin Finck #define UNDNAME_NO_MS_KEYWORDS           (0x0002) /* Don't show calling convention at all */
126c2c66affSColin Finck #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004) /* Don't show function/method return value */
127c2c66affSColin Finck #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
128c2c66affSColin Finck #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
129c2c66affSColin Finck #define UNDNAME_NO_MS_THISTYPE           (0x0020)
130c2c66affSColin Finck #define UNDNAME_NO_CV_THISTYPE           (0x0040)
131c2c66affSColin Finck #define UNDNAME_NO_THISTYPE              (0x0060)
132c2c66affSColin Finck #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080) /* Don't show access specifier (public/protected/private) */
133c2c66affSColin Finck #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
134c2c66affSColin Finck #define UNDNAME_NO_MEMBER_TYPE           (0x0200) /* Don't show static/virtual specifier */
135c2c66affSColin Finck #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
136c2c66affSColin Finck #define UNDNAME_32_BIT_DECODE            (0x0800)
137c2c66affSColin Finck #define UNDNAME_NAME_ONLY                (0x1000) /* Only report the variable/method name */
138c2c66affSColin Finck #define UNDNAME_NO_ARGUMENTS             (0x2000) /* Don't show method arguments */
139c2c66affSColin Finck #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
140c2c66affSColin Finck #define UNDNAME_NO_COMPLEX_TYPE          (0x8000)
141c2c66affSColin Finck 
142c2c66affSColin Finck typedef void (*float_handler)(int, int);
143c2c66affSColin Finck void _default_handler(int signal);
144c2c66affSColin Finck typedef struct _sig_element
145c2c66affSColin Finck {
146c2c66affSColin Finck    int signal;
147c2c66affSColin Finck    char *signame;
148c2c66affSColin Finck    __p_sig_fn_t handler;
149c2c66affSColin Finck }sig_element;
150c2c66affSColin Finck 
151c2c66affSColin Finck #define MSVCRT_malloc malloc
152c2c66affSColin Finck #define MSVCRT_free free
153c2c66affSColin Finck char* _setlocale(int,const char*);
154c2c66affSColin Finck NTSYSAPI VOID NTAPI RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message);
155c2c66affSColin Finck 
156*c529e727SThomas Faber /* ioinfo structure size is different in msvcrXX.dll's */
157*c529e727SThomas Faber typedef struct {
158*c529e727SThomas Faber     HANDLE              handle;
159*c529e727SThomas Faber     unsigned char       wxflag;
160*c529e727SThomas Faber     char                lookahead[3];
161*c529e727SThomas Faber     int                 exflag;
162*c529e727SThomas Faber     CRITICAL_SECTION    crit;
163*c529e727SThomas Faber } ioinfo;
164*c529e727SThomas Faber 
165c2c66affSColin Finck #endif /* __WINE_MSVCRT_H */
166