msvcp90: Add exception throwing function.
[wine] / dlls / msvcp90 / msvcp90.h
1 /*
2  * Copyright 2010 Piotr Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "stdlib.h"
20 #include "windef.h"
21
22 typedef unsigned char MSVCP_BOOL;
23
24 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
25         const wchar_t*, unsigned int, uintptr_t);
26
27 extern void* (__cdecl *MSVCRT_operator_new)(size_t);
28 extern void (__cdecl *MSVCRT_operator_delete)(void*);
29
30 /* Copied from dlls/msvcrt/cpp.c */
31 #ifdef __i386__  /* thiscall functions are i386-specific */
32
33 #define THISCALL(func) __thiscall_ ## func
34 #define DEFINE_THISCALL_WRAPPER(func,args) \
35     extern void THISCALL(func)(void); \
36     __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
37                       "popl %eax\n\t" \
38                       "pushl %ecx\n\t" \
39                       "pushl %eax\n\t" \
40                       "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
41 #else /* __i386__ */
42
43 #define THISCALL(func) func
44 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
45
46 #endif /* __i386__ */
47
48 /* exception object */
49 typedef void (*vtable_ptr)(void);
50 typedef struct __exception
51 {
52     const vtable_ptr *vtable;
53     char             *name;    /* Name of this exception, always a new copy for each object */
54     int               do_free; /* Whether to free 'name' in our dtor */
55 } exception;
56
57 /* Internal: throws selected exception */
58 typedef enum __exception_type {
59     EXCEPTION
60 } exception_type;
61 void throw_exception(exception_type, const char *);
62 void set_exception_vtable(void);