Piotr Caban : msvcp140: Add __uncaught_exceptions implementation.

Alexandre Julliard julliard at winehq.org
Tue Jun 26 04:44:26 CDT 2018


Module: wine
Branch: stable
Commit: 2485d2f1192d7137e9633b37634fa4801c0fb1fa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2485d2f1192d7137e9633b37634fa4801c0fb1fa

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Mar 20 15:37:00 2018 +0100

msvcp140: Add __uncaught_exceptions implementation.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit c07ade82ed1259d60758308b1df5358016cd3f28)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msvcp140/msvcp140.spec | 2 +-
 dlls/msvcp90/exception.c    | 7 +++++++
 dlls/msvcp90/msvcp90.h      | 4 ++++
 dlls/msvcp90/msvcp_main.c   | 5 +++++
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index 4fc8e3c..ddf8ba7 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3513,7 +3513,7 @@
 @ thiscall -arch=i386 ?uflow@?$basic_streambuf at _WU?$char_traits at _W@std@@@std@@MAEGXZ(ptr) basic_streambuf_wchar_uflow
 @ cdecl -arch=win64 ?uflow@?$basic_streambuf at _WU?$char_traits at _W@std@@@std@@MEAAGXZ(ptr) basic_streambuf_wchar_uflow
 @ cdecl ?uncaught_exception at std@@YA_NXZ() MSVCP__uncaught_exception
-@ stub ?uncaught_exceptions at std@@YAHXZ
+@ cdecl ?uncaught_exceptions at std@@YAHXZ() __uncaught_exceptions
 @ cdecl -arch=arm ?underflow@?$basic_streambuf at DU?$char_traits at D@std@@@std@@MAAHXZ(ptr) basic_streambuf_char_underflow
 @ thiscall -arch=i386 ?underflow@?$basic_streambuf at DU?$char_traits at D@std@@@std@@MAEHXZ(ptr) basic_streambuf_char_underflow
 @ cdecl -arch=win64 ?underflow@?$basic_streambuf at DU?$char_traits at D@std@@@std@@MEAAHXZ(ptr) basic_streambuf_char_underflow
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index 7d9ade8..e7ba3d7 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -944,6 +944,13 @@ MSVCP_bool __cdecl MSVCP__uncaught_exception(void)
     return __uncaught_exception();
 }
 
+#if _MSVCP_VER >= 140
+int __cdecl __uncaught_exceptions(void)
+{
+    return *UCRTBASE___processing_throw();
+}
+#endif
+
 #if _MSVCP_VER >= 70 || defined(_MSVCIRT)
 #define EXCEPTION_VTABLE(name,funcs) __ASM_VTABLE(name,funcs)
 #else
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index d751186..16eaa48 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -47,6 +47,10 @@ extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
 extern void (__cdecl *MSVCRT_operator_delete)(void*);
 extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
 
+#if _MSVCP_VER >= 140
+extern int* (__cdecl *UCRTBASE___processing_throw)(void);
+#endif
+
 #if _MSVCP_VER >= 110
 /* keep in sync with msvcrt/lock.c */
 typedef struct cs_queue
diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c
index 22baeef..7aef4cd 100644
--- a/dlls/msvcp90/msvcp_main.c
+++ b/dlls/msvcp90/msvcp_main.c
@@ -60,6 +60,10 @@ void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
 void (__cdecl *MSVCRT_operator_delete)(void*);
 void* (__cdecl *MSVCRT_set_new_handler)(void*);
 
+#if _MSVCP_VER >= 140
+int* (__cdecl *UCRTBASE___processing_throw)(void);
+#endif
+
 #if _MSVCP_VER >= 110
 critical_section* (__thiscall *critical_section_ctor)(critical_section*);
 void (__thiscall *critical_section_dtor)(critical_section*);
@@ -147,6 +151,7 @@ static void init_cxx_funcs(void)
     MSVCRT_operator_new = operator_new;
     MSVCRT_operator_delete = operator_delete;
     MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "_set_new_handler");
+    UCRTBASE___processing_throw = (void*)GetProcAddress(hmod, "__processing_throw");
 
     hcon = LoadLibraryA( CONCRT_NAME(_MSVCP_VER) );
     if (!hcon) FIXME( "%s not loaded\n", CONCRT_NAME(_MSVCP_VER) );




More information about the wine-cvs mailing list