mlang: Added IMLangConvertCharset stub.
[wine.git] / dlls / msvcp100 / msvcp100.c
blob4238a24315399e89c2653fe1cb565485a49fa66b
1 /*
2 * msvcp100 specific functions
4 * Copyright 2011 Austin English
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <stdarg.h>
25 #include "msvcp.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
33 #ifdef __i386__
35 #define DEFINE_VTBL_WRAPPER(off) \
36 __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
37 "popl %eax\n\t" \
38 "popl %ecx\n\t" \
39 "pushl %eax\n\t" \
40 "movl 0(%ecx), %eax\n\t" \
41 "jmp *" #off "(%eax)\n\t")
43 DEFINE_VTBL_WRAPPER(0);
44 DEFINE_VTBL_WRAPPER(4);
45 DEFINE_VTBL_WRAPPER(8);
46 DEFINE_VTBL_WRAPPER(12);
47 DEFINE_VTBL_WRAPPER(16);
48 DEFINE_VTBL_WRAPPER(20);
49 DEFINE_VTBL_WRAPPER(24);
50 DEFINE_VTBL_WRAPPER(28);
51 DEFINE_VTBL_WRAPPER(32);
52 DEFINE_VTBL_WRAPPER(36);
53 DEFINE_VTBL_WRAPPER(40);
54 DEFINE_VTBL_WRAPPER(44);
55 DEFINE_VTBL_WRAPPER(48);
56 DEFINE_VTBL_WRAPPER(52);
57 DEFINE_VTBL_WRAPPER(56);
59 #endif
61 void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
62 void (__cdecl *MSVCRT_operator_delete)(void*);
63 void* (__cdecl *MSVCRT_set_new_handler)(void*);
65 static void init_cxx_funcs(void)
67 HMODULE hmod = GetModuleHandleA("msvcrt.dll");
69 if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
71 MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
72 MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
73 MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z");
75 else
77 MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
78 MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
79 MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z");
83 /* _Container_base0 is used by apps compiled without iterator checking
84 * (i.e. with _ITERATOR_DEBUG_LEVEL=0 ).
85 * It provides empty versions of methods used by visual c++'s stl's
86 * iterator checking.
87 * msvcr100 has to provide them in case apps are compiled with /Od
88 * or the optimizer fails to inline those (empty) calls.
91 /* ?_Orphan_all@_Container_base0@std@@QAEXXZ */
92 /* ?_Orphan_all@_Container_base0@std@@QEAAXXZ */
93 DEFINE_THISCALL_WRAPPER(Container_base0_Orphan_all, 4)
94 void __thiscall Container_base0_Orphan_all(void *this)
98 /* ?_Swap_all@_Container_base0@std@@QAEXAAU12@@Z */
99 /* ?_Swap_all@_Container_base0@std@@QEAAXAEAU12@@Z */
100 DEFINE_THISCALL_WRAPPER(Container_base0_Swap_all, 8)
101 void __thiscall Container_base0_Swap_all(void *this, void *that)
105 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
107 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
109 switch (fdwReason)
111 case DLL_WINE_PREATTACH:
112 return FALSE; /* prefer native version */
113 case DLL_PROCESS_ATTACH:
114 init_cxx_funcs();
115 init_lockit();
116 init_exception(hinstDLL);
117 init_locale(hinstDLL);
118 init_io(hinstDLL);
119 break;
120 case DLL_PROCESS_DETACH:
121 free_io();
122 free_locale();
123 free_lockit();
124 break;
127 return TRUE;
130 /* ?_BADOFF@std@@3JB -> long const std::_BADOFF */
131 /* ?_BADOFF@std@@3_JB -> __int64 const std::_BADOFF */
132 const streamoff std_BADOFF = -1;