msvcrt/tests: Add _strupr tests.
[wine.git] / dlls / msvcp60 / main.c
blob8a45ab02d6700702605544dbcdf639a2c90c6e64
1 /*
2 * Copyright 2010 Piotr Caban for CodeWeavers
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.
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.
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
19 #include "config.h"
21 #include <stdarg.h>
23 #include "msvcp.h"
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
31 #ifdef __i386__
33 #define DEFINE_VTBL_WRAPPER(off) \
34 __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
35 "popl %eax\n\t" \
36 "popl %ecx\n\t" \
37 "pushl %eax\n\t" \
38 "movl 0(%ecx), %eax\n\t" \
39 "jmp *" #off "(%eax)\n\t")
41 DEFINE_VTBL_WRAPPER(0);
42 DEFINE_VTBL_WRAPPER(4);
43 DEFINE_VTBL_WRAPPER(8);
44 DEFINE_VTBL_WRAPPER(12);
45 DEFINE_VTBL_WRAPPER(16);
46 DEFINE_VTBL_WRAPPER(20);
47 DEFINE_VTBL_WRAPPER(24);
48 DEFINE_VTBL_WRAPPER(28);
49 DEFINE_VTBL_WRAPPER(32);
50 DEFINE_VTBL_WRAPPER(36);
51 DEFINE_VTBL_WRAPPER(40);
52 DEFINE_VTBL_WRAPPER(44);
53 DEFINE_VTBL_WRAPPER(48);
54 DEFINE_VTBL_WRAPPER(52);
55 DEFINE_VTBL_WRAPPER(56);
57 #endif
59 /* ?_Fpz@std@@3_JB */
60 const __int64 std_Fpz = 0;
62 void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
63 void (__cdecl *MSVCRT_operator_delete)(void*);
64 void* (__cdecl *MSVCRT_set_new_handler)(void*);
66 static void init_cxx_funcs(void)
68 HMODULE hmod = GetModuleHandleA("msvcrt.dll");
70 if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
72 MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
73 MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
74 MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z");
76 else
78 MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
79 MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
80 MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z");
84 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
86 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
88 switch (fdwReason)
90 case DLL_WINE_PREATTACH:
91 return FALSE; /* prefer native version */
92 case DLL_PROCESS_ATTACH:
93 init_cxx_funcs();
94 init_lockit();
95 init_exception(hinstDLL);
96 init_locale(hinstDLL);
97 init_io(hinstDLL);
98 break;
99 case DLL_PROCESS_DETACH:
100 if (lpvReserved) break;
101 free_io();
102 free_locale();
103 free_lockit();
104 break;
107 return TRUE;