Commit e35e107e authored by Iván Matellanes's avatar Iván Matellanes Committed by Alexandre Julliard

msvcirt: Share exceptions implementation with msvcp.

parent e89813fe
MODULE = msvcirt.dll
IMPORTS = msvcrt
EXTRADEFS = -D_MSVCIRT
PARENTSRC = ../msvcp90
C_SRCS = \
exception.c \
msvcirt.c
......@@ -20,6 +20,7 @@
#include <stdarg.h>
#include "msvcirt.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
......@@ -38,27 +39,6 @@ typedef struct {
LPVOID VTable;
} class_strstreambuf;
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#else /* __i386__ */
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
/******************************************************************
* ??1ios@@UAE@XZ (MSVCRTI.@)
* class ios & __thiscall ios::-ios<<(void)
......@@ -156,6 +136,22 @@ char * __thiscall MSVCIRT_str_sl_void(class_strstreambuf * _this)
return 0;
}
void (__cdecl *MSVCRT_operator_delete)(void*);
static void init_cxx_funcs(void)
{
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
{
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
}
else
{
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
}
}
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{
switch (reason)
......@@ -163,6 +159,8 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
init_cxx_funcs();
init_exception(inst);
DisableThreadLibraryCalls( inst );
break;
}
......
/*
* Copyright 2015 Iván Matellanes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "stdlib.h"
#include "windef.h"
#include "cxx.h"
extern void (__cdecl *MSVCRT_operator_delete)(void*);
void init_exception(void*);
......@@ -78,10 +78,10 @@
@ stub -arch=win64 ??0istrstream@@QEAA@PEAD@Z
@ stub -arch=win32 ??0istrstream@@QAE@PADH@Z
@ stub -arch=win64 ??0istrstream@@QEAA@PEADH@Z
@ stub -arch=win32 ??0logic_error@@QAE@ABQBD@Z
@ stub -arch=win64 ??0logic_error@@QEAA@AEBQEBD@Z
@ stub -arch=win32 ??0logic_error@@QAE@ABV0@@Z
@ stub -arch=win64 ??0logic_error@@QEAA@AEBV0@@Z
@ thiscall -arch=win32 ??0logic_error@@QAE@ABQBD@Z(ptr ptr) msvcirt.??0logic_error@@QAE@ABQBD@Z
@ cdecl -arch=win64 ??0logic_error@@QEAA@AEBQEBD@Z(ptr ptr) msvcirt.??0logic_error@@QEAA@AEBQEBD@Z
@ thiscall -arch=win32 ??0logic_error@@QAE@ABV0@@Z(ptr ptr) msvcirt.??0logic_error@@QAE@ABV0@@Z
@ cdecl -arch=win64 ??0logic_error@@QEAA@AEBV0@@Z(ptr ptr) msvcirt.??0logic_error@@QEAA@AEBV0@@Z
@ stub -arch=win32 ??0ofstream@@QAE@ABV0@@Z
@ stub -arch=win64 ??0ofstream@@QEAA@AEBV0@@Z
@ stub -arch=win32 ??0ofstream@@QAE@H@Z
......@@ -166,8 +166,8 @@
@ stub -arch=win64 ??1istream_withassign@@UEAA@XZ
@ stub -arch=win32 ??1istrstream@@UAE@XZ
@ stub -arch=win64 ??1istrstream@@UEAA@XZ
@ stub -arch=win32 ??1logic_error@@UAE@XZ
@ stub -arch=win64 ??1logic_error@@UEAA@XZ
@ thiscall -arch=win32 ??1logic_error@@UAE@XZ(ptr) msvcirt.??1logic_error@@UAE@XZ
@ cdecl -arch=win64 ??1logic_error@@UEAA@XZ(ptr) msvcirt.??1logic_error@@UEAA@XZ
@ stub -arch=win32 ??1ofstream@@UAE@XZ
@ stub -arch=win64 ??1ofstream@@UEAA@XZ
@ stub -arch=win32 ??1ostream@@UAE@XZ
......@@ -226,8 +226,8 @@
@ stub -arch=win64 ??4istream_withassign@@QEAAAEAVistream@@PEAVstreambuf@@@Z
@ stub -arch=win32 ??4istrstream@@QAEAAV0@ABV0@@Z
@ stub -arch=win64 ??4istrstream@@QEAAAEAV0@AEBV0@@Z
@ stub -arch=win32 ??4logic_error@@QAEAAV0@ABV0@@Z
@ stub -arch=win64 ??4logic_error@@QEAAAEAV0@AEBV0@@Z
@ thiscall -arch=win32 ??4logic_error@@QAEAAV0@ABV0@@Z(ptr ptr) msvcirt.??4logic_error@@QAEAAV0@ABV0@@Z
@ cdecl -arch=win64 ??4logic_error@@QEAAAEAV0@AEBV0@@Z(ptr ptr) msvcirt.??4logic_error@@QEAAAEAV0@AEBV0@@Z
@ stub -arch=win32 ??4ofstream@@QAEAAV0@ABV0@@Z
@ stub -arch=win64 ??4ofstream@@QEAAAEAV0@AEBV0@@Z
@ stub -arch=win32 ??4ostream@@IAEAAV0@ABV0@@Z
......@@ -346,7 +346,7 @@
# @ extern ??_7istream@@6B@
# @ extern ??_7istream_withassign@@6B@
# @ extern ??_7istrstream@@6B@
# @ extern ??_7logic_error@@6B@
@ extern ??_7logic_error@@6B@ msvcirt.??_7logic_error@@6B@
# @ extern ??_7ofstream@@6B@
# @ extern ??_7ostream@@6B@
# @ extern ??_7ostream_withassign@@6B@
......@@ -409,7 +409,7 @@
@ stub -arch=win32 ??_Eistream@@UAEPAXI@Z
@ stub -arch=win32 ??_Eistream_withassign@@UAEPAXI@Z
@ stub -arch=win32 ??_Eistrstream@@UAEPAXI@Z
@ stub -arch=win32 ??_Elogic_error@@UAEPAXI@Z
@ thiscall -arch=win32 ??_Elogic_error@@UAEPAXI@Z(ptr long) msvcirt.??_Elogic_error@@UAEPAXI@Z
@ stub -arch=win32 ??_Eofstream@@UAEPAXI@Z
@ stub -arch=win32 ??_Eostream@@UAEPAXI@Z
@ stub -arch=win32 ??_Eostream_withassign@@UAEPAXI@Z
......@@ -432,7 +432,7 @@
@ stub -arch=win32 ??_Gistream@@UAEPAXI@Z
@ stub -arch=win32 ??_Gistream_withassign@@UAEPAXI@Z
@ stub -arch=win32 ??_Gistrstream@@UAEPAXI@Z
@ stub -arch=win32 ??_Glogic_error@@UAEPAXI@Z
@ thiscall -arch=win32 ??_Glogic_error@@UAEPAXI@Z(ptr long) msvcirt.??_Glogic_error@@UAEPAXI@Z
@ stub -arch=win32 ??_Gofstream@@UAEPAXI@Z
@ stub -arch=win32 ??_Gostream@@UAEPAXI@Z
@ stub -arch=win32 ??_Gostream_withassign@@UAEPAXI@Z
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment