msi: Store action data for deferred rollback actions too.
[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 THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
35 #define __thiscall __stdcall
36 #define DEFINE_THISCALL_WRAPPER(func,args) \
37     extern void THISCALL(func)(void); \
38     __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
39                       "popl %eax\n\t" \
40                       "pushl %ecx\n\t" \
41                       "pushl %eax\n\t" \
42                       "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
43 #else /* __i386__ */
44
45 #define THISCALL(func) func
46 #define THISCALL_NAME(func) __ASM_NAME(#func)
47 #define __thiscall __cdecl
48 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
49
50 #endif /* __i386__ */
51
52 /* exception object */
53 typedef void (*vtable_ptr)(void);
54 typedef struct __exception
55 {
56     const vtable_ptr *vtable;
57     char             *name;    /* Name of this exception, always a new copy for each object */
58     int               do_free; /* Whether to free 'name' in our dtor */
59 } exception;
60
61 /* Internal: throws selected exception */
62 typedef enum __exception_type {
63     EXCEPTION,
64     EXCEPTION_BAD_ALLOC,
65     EXCEPTION_LOGIC_ERROR,
66     EXCEPTION_LENGTH_ERROR,
67     EXCEPTION_OUT_OF_RANGE,
68     EXCEPTION_INVALID_ARGUMENT
69 } exception_type;
70 void throw_exception(exception_type, const char *);
71 void set_exception_vtable(void);
72
73 /* rtti */
74 typedef struct __type_info
75 {
76     const vtable_ptr *vtable;
77     char              *name;        /* Unmangled name, allocated lazily */
78     char               mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
79 } type_info;
80
81 /* offsets for computing the this pointer */
82 typedef struct
83 {
84     int         this_offset;   /* offset of base class this pointer from start of object */
85     int         vbase_descr;   /* offset of virtual base class descriptor */
86     int         vbase_offset;  /* offset of this pointer offset in virtual base class descriptor */
87 } this_ptr_offsets;
88
89 typedef struct _rtti_base_descriptor
90 {
91     const type_info *type_descriptor;
92     int num_base_classes;
93     this_ptr_offsets offsets;    /* offsets for computing the this pointer */
94     unsigned int attributes;
95 } rtti_base_descriptor;
96
97 typedef struct _rtti_base_array
98 {
99     const rtti_base_descriptor *bases[3]; /* First element is the class itself */
100 } rtti_base_array;
101
102 typedef struct _rtti_object_hierarchy
103 {
104     unsigned int signature;
105     unsigned int attributes;
106     int array_len; /* Size of the array pointed to by 'base_classes' */
107     const rtti_base_array *base_classes;
108 } rtti_object_hierarchy;
109
110 typedef struct _rtti_object_locator
111 {
112     unsigned int signature;
113     int base_class_offset;
114     unsigned int flags;
115     const type_info *type_descriptor;
116     const rtti_object_hierarchy *type_hierarchy;
117 } rtti_object_locator;
118
119 /* basic_string<char, char_traits<char>, allocator<char>> */
120 #define BUF_SIZE_CHAR 16
121 typedef struct _basic_string_char
122 {
123     void *allocator;
124     union {
125         char buf[BUF_SIZE_CHAR];
126         char *ptr;
127     } data;
128     size_t size;
129     size_t res;
130 } basic_string_char;
131
132 basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
133 basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
134 void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*);
135 const char* __stdcall MSVCP_basic_string_char_c_str(basic_string_char*);
136
137 #define BUF_SIZE_WCHAR 8
138 typedef struct _basic_string_wchar
139 {
140     void *allocator;
141     union {
142         wchar_t buf[BUF_SIZE_WCHAR];
143         wchar_t *ptr;
144     } data;
145     size_t size;
146     size_t res;
147 } basic_string_wchar;
148
149 char* __stdcall MSVCP_allocator_char_allocate(void*, size_t);
150 void __stdcall MSVCP_allocator_char_deallocate(void*, char*, size_t);
151 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void*, size_t);
152 void __stdcall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, size_t);