f4d30aa97bb7f727084ea230eb155a6d582ade81
[reactos.git] / reactos / lib / sdk / crt / include / internal / wine / 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 #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 extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
85 extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
86
87 /* Setup and teardown multi threaded locks */
88 extern void msvcrt_init_mt_locks(void);
89 extern void msvcrt_free_mt_locks(void);
90
91 extern BOOL msvcrt_init_locale(void);
92 extern void msvcrt_init_math(void);
93 extern void msvcrt_init_io(void);
94 extern void msvcrt_free_io(void);
95 extern void msvcrt_init_console(void);
96 extern void msvcrt_free_console(void);
97 extern void msvcrt_init_args(void);
98 extern void msvcrt_free_args(void);
99 extern void msvcrt_init_signals(void);
100 extern void msvcrt_free_signals(void);
101
102 extern unsigned create_io_inherit_block(WORD*, BYTE**);
103
104 /* _set_abort_behavior codes */
105 #define MSVCRT__WRITE_ABORT_MSG 1
106 #define MSVCRT__CALL_REPORTFAULT 2
107
108 #define MSVCRT_LC_ALL LC_ALL
109 #define MSVCRT_LC_COLLATE LC_COLLATE
110 #define MSVCRT_LC_CTYPE LC_CTYPE
111 #define MSVCRT_LC_MONETARY LC_MONETARY
112 #define MSVCRT_LC_NUMERIC LC_NUMERIC
113 #define MSVCRT_LC_TIME LC_TIME
114 #define MSVCRT_LC_MIN LC_MIN
115 #define MSVCRT_LC_MAX LC_MAX
116
117 #define MSVCRT__OUT_TO_DEFAULT 0
118 #define MSVCRT__OUT_TO_STDERR 1
119 #define MSVCRT__OUT_TO_MSGBOX 2
120 #define MSVCRT__REPORT_ERRMODE 3
121
122 typedef void (*float_handler)(int, int);
123 void _default_handler(int signal);
124 typedef struct _sig_element
125 {
126 int signal;
127 char *signame;
128 __p_sig_fn_t handler;
129 }sig_element;
130
131 #define MSVCRT_malloc malloc
132 #define MSVCRT_free free
133 char* _setlocale(int,const char*);
134 NTSYSAPI VOID NTAPI RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message);
135
136 #endif /* __WINE_MSVCRT_H */