msvcp90: Added basic_string<char>::npos.
[wine] / dlls / msvcp90 / msvcp90_main.c
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 "config.h"
20
21 #include <stdarg.h>
22
23 #include "msvcp90.h"
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wine/debug.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
30
31 void* (__cdecl *MSVCRT_operator_new)(size_t);
32 void (__cdecl *MSVCRT_operator_delete)(void*);
33 void init_cxx_funcs(void)
34 {
35     HMODULE hmod = GetModuleHandleA("msvcrt.dll");
36
37     if (sizeof(void *) > sizeof(int))  /* 64-bit has different names */
38     {
39         MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
40         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
41     }
42     else
43     {
44         MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
45         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
46     }
47 }
48
49 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
50 {
51     TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
52
53     switch (fdwReason)
54     {
55         case DLL_WINE_PREATTACH:
56             return FALSE;    /* prefer native version */
57         case DLL_PROCESS_ATTACH:
58             init_cxx_funcs();
59             set_exception_vtable();
60             break;
61         case DLL_PROCESS_DETACH:
62             break;
63     }
64
65     return TRUE;
66 }