msvcrt: Added _wcsicoll_l implementation.
[wine] / dlls / msvcr90 / msvcr90.c
1 /*
2  * msvcr90 specific functions
3  *
4  * Copyright 2010 Detlef Riekenberg
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #include <stdarg.h>
22
23 #include "stdio.h"
24 #include "windef.h"
25 #include "winbase.h"
26
27 typedef void (__cdecl *MSVCRT__se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
28
29 static void* (__cdecl *MSVCRT_operator_new)(size_t);
30 static void (__cdecl *MSVCRT_operator_delete)(void*);
31 static MSVCRT__se_translator_function (__cdecl *MSVCRT__set_se_translator)(MSVCRT__se_translator_function);
32
33 static 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         MSVCRT__set_se_translator = (void*)GetProcAddress(hmod,
42                 "?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z");
43     }
44     else
45     {
46         MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
47         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
48         MSVCRT__set_se_translator = (void*)GetProcAddress(hmod,
49                 "?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z");
50     }
51 }
52
53 /*********************************************************************
54  *  DllMain (MSVCR90.@)
55  */
56 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
57 {
58     switch (reason)
59     {
60     case DLL_PROCESS_ATTACH:
61         DisableThreadLibraryCalls(hdll);
62         init_cxx_funcs();
63         _set_printf_count_output(0);
64     }
65     return TRUE;
66 }
67
68 /*********************************************************************
69  *  _decode_pointer (MSVCR90.@)
70  *
71  * cdecl version of DecodePointer
72  *
73  */
74 void * CDECL MSVCR90_decode_pointer(void * ptr)
75 {
76     return DecodePointer(ptr);
77 }
78
79 /*********************************************************************
80  *  _encode_pointer (MSVCR90.@)
81  *
82  * cdecl version of EncodePointer
83  *
84  */
85 void * CDECL MSVCR90_encode_pointer(void * ptr)
86 {
87     return EncodePointer(ptr);
88 }
89
90 /*********************************************************************
91  *  ??2@YAPAXI@Z (MSVCR90.@)
92  *
93  * Naver LINE expects that this function is implemented inside msvcr90
94  */
95 void* CDECL MSVCR90_operator_new(size_t size)
96 {
97     return MSVCRT_operator_new(size);
98 }
99
100 /*********************************************************************
101  *  ??3@YAXPAX@Z (MSVCR90.@)
102  *
103  * Naver LINE expects that this function is implemented inside msvcr90
104  */
105 void CDECL MSVCR90_operator_delete(void *ptr)
106 {
107     MSVCRT_operator_delete(ptr);
108 }
109
110 /*********************************************************************
111  *  ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z (MSVCR90.@)
112  *
113  * Naver LINE expects that this function is implemented inside msvcr90
114  */
115 MSVCRT__se_translator_function CDECL MSVCR90__set_se_translator(MSVCRT__se_translator_function func)
116 {
117     return MSVCRT__set_se_translator(func);
118 }