2 * msvcr90 specific functions
4 * Copyright 2010 Detlef Riekenberg
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
27 typedef void (__cdecl
*MSVCRT__se_translator_function
)(unsigned int code
, struct _EXCEPTION_POINTERS
*info
);
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
);
33 static void init_cxx_funcs(void)
35 HMODULE hmod
= GetModuleHandleA("msvcrt.dll");
37 if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
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");
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");
53 /*********************************************************************
56 BOOL WINAPI
DllMain(HINSTANCE hdll
, DWORD reason
, LPVOID reserved
)
60 case DLL_PROCESS_ATTACH
:
61 DisableThreadLibraryCalls(hdll
);
63 _set_printf_count_output(0);
68 /*********************************************************************
69 * _decode_pointer (MSVCR90.@)
71 * cdecl version of DecodePointer
74 void * CDECL
MSVCR90_decode_pointer(void * ptr
)
76 return DecodePointer(ptr
);
79 /*********************************************************************
80 * _encode_pointer (MSVCR90.@)
82 * cdecl version of EncodePointer
85 void * CDECL
MSVCR90_encode_pointer(void * ptr
)
87 return EncodePointer(ptr
);
90 /*********************************************************************
91 * ??2@YAPAXI@Z (MSVCR90.@)
93 * Naver LINE expects that this function is implemented inside msvcr90
95 void* CDECL
MSVCR90_operator_new(size_t size
)
97 return MSVCRT_operator_new(size
);
100 /*********************************************************************
101 * ??3@YAXPAX@Z (MSVCR90.@)
103 * Naver LINE expects that this function is implemented inside msvcr90
105 void CDECL
MSVCR90_operator_delete(void *ptr
)
107 MSVCRT_operator_delete(ptr
);
110 /*********************************************************************
111 * ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z (MSVCR90.@)
113 * Naver LINE expects that this function is implemented inside msvcr90
115 MSVCRT__se_translator_function CDECL
MSVCR90__set_se_translator(MSVCRT__se_translator_function func
)
117 return MSVCRT__set_se_translator(func
);