xref: /reactos/sdk/lib/crt/include/internal/wine/msvcrt.h (revision 9393fc32)
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 #include <signal.h>
41 #include "windef.h"
42 #include "winbase.h"
43 
44 extern unsigned int __lc_codepage;
45 extern int __lc_collate_cp;
46 extern int __mb_cur_max;
47 extern const unsigned short _ctype [257];
48 
49 void __cdecl _purecall(void);
50 __declspec(noreturn) void __cdecl _amsg_exit(int errnum);
51 
52 extern char **_environ;
53 extern wchar_t **_wenviron;
54 extern char ** SnapshotOfEnvironmentA(char **);
55 extern wchar_t ** SnapshotOfEnvironmentW(wchar_t **);
56 
57 /* Application type flags */
58 #define _UNKNOWN_APP    0
59 #define _CONSOLE_APP    1
60 #define _GUI_APP        2
61 
62 /* I/O Streamming flags missing from stdio.h */
63 #define _IOYOURBUF      0x0100
64 #define _IOAPPEND       0x0200
65 #define _IOSETVBUF      0x0400
66 #define _IOFEOF         0x0800
67 #define _IOFLRTN        0x1000
68 #define _IOCTRLZ        0x2000
69 #define _IOCOMMIT       0x4000
70 #define _IOFREE         0x10000
71 
72 //wchar_t *wstrdupa(const char *);
73 //
74 ///* FIXME: This should be declared in new.h but it's not an extern "C" so
75 // * it would not be much use anyway. Even for Winelib applications.
76 // */
77 //int __cdecl _set_new_mode(int mode);
78 //
79 void* __cdecl MSVCRT_operator_new(size_t);
80 void __cdecl MSVCRT_operator_delete(void*);
81 typedef void* (__cdecl *malloc_func_t)(size_t);
82 typedef void  (__cdecl *free_func_t)(void*);
83 
84 /* Setup and teardown multi threaded locks */
85 extern void msvcrt_init_mt_locks(void);
86 extern void msvcrt_free_mt_locks(void);
87 
88 extern BOOL msvcrt_init_locale(void);
89 extern void msvcrt_init_math(void);
90 extern void msvcrt_init_io(void);
91 extern void msvcrt_free_io(void);
92 extern void msvcrt_init_console(void);
93 extern void msvcrt_free_console(void);
94 extern void msvcrt_init_args(void);
95 extern void msvcrt_free_args(void);
96 extern void msvcrt_init_signals(void);
97 extern void msvcrt_free_signals(void);
98 extern void msvcrt_free_popen_data(void);
99 
100 extern unsigned create_io_inherit_block(WORD*, BYTE**);
101 
102 /* _set_abort_behavior codes */
103 #define MSVCRT__WRITE_ABORT_MSG    1
104 #define MSVCRT__CALL_REPORTFAULT   2
105 
106 #define MSVCRT_LC_ALL      LC_ALL
107 #define MSVCRT_LC_COLLATE  LC_COLLATE
108 #define MSVCRT_LC_CTYPE    LC_CTYPE
109 #define MSVCRT_LC_MONETARY LC_MONETARY
110 #define MSVCRT_LC_NUMERIC  LC_NUMERIC
111 #define MSVCRT_LC_TIME     LC_TIME
112 #define MSVCRT_LC_MIN      LC_MIN
113 #define MSVCRT_LC_MAX      LC_MAX
114 
115 #define MSVCRT__OUT_TO_DEFAULT 0
116 #define MSVCRT__OUT_TO_STDERR  1
117 #define MSVCRT__OUT_TO_MSGBOX  2
118 #define MSVCRT__REPORT_ERRMODE 3
119 
120 extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
121 
122 /* __unDName/__unDNameEx flags */
123 #define UNDNAME_COMPLETE                 (0x0000)
124 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001) /* Don't show __ in calling convention */
125 #define UNDNAME_NO_MS_KEYWORDS           (0x0002) /* Don't show calling convention at all */
126 #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004) /* Don't show function/method return value */
127 #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
128 #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
129 #define UNDNAME_NO_MS_THISTYPE           (0x0020)
130 #define UNDNAME_NO_CV_THISTYPE           (0x0040)
131 #define UNDNAME_NO_THISTYPE              (0x0060)
132 #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080) /* Don't show access specifier (public/protected/private) */
133 #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
134 #define UNDNAME_NO_MEMBER_TYPE           (0x0200) /* Don't show static/virtual specifier */
135 #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
136 #define UNDNAME_32_BIT_DECODE            (0x0800)
137 #define UNDNAME_NAME_ONLY                (0x1000) /* Only report the variable/method name */
138 #define UNDNAME_NO_ARGUMENTS             (0x2000) /* Don't show method arguments */
139 #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
140 #define UNDNAME_NO_COMPLEX_TYPE          (0x8000)
141 
142 typedef void (*float_handler)(int, int);
143 void _default_handler(int signal);
144 typedef struct _sig_element
145 {
146    int signal;
147    char *signame;
148    __p_sig_fn_t handler;
149 }sig_element;
150 
151 #define MSVCRT_malloc malloc
152 #define MSVCRT_free free
153 char* _setlocale(int,const char*);
154 NTSYSAPI VOID NTAPI RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message);
155 
156 /* ioinfo structure size is different in msvcrXX.dll's */
157 typedef struct {
158     HANDLE              handle;
159     unsigned char       wxflag;
160     char                lookahead[3];
161     int                 exflag;
162     CRITICAL_SECTION    crit;
163 } ioinfo;
164 
165 #endif /* __WINE_MSVCRT_H */
166