EH msvcrt functions

François Gouget fgouget at codeweavers.com
Wed May 30 21:32:26 CDT 2001


   This patch adds the eh.h msvcrt header and implements the
unexpected/terminate functions.


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * include/msvcrt/eh.h,
   dlls/msvcrt/msvcrt.spec,
   dlls/msvcrt/cpp.c

   Add msvcrt/eh.h
   Implement unexpected, terminate and set_unexpected/terminate


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.14
diff -u -r1.14 msvcrt.spec
--- dlls/msvcrt/msvcrt.spec	2001/05/22 19:18:51	1.14
+++ dlls/msvcrt/msvcrt.spec	2001/05/30 17:20:57
@@ -52,10 +53,10 @@
 @ stdcall ?name at type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_name
 @ stdcall ?raw_name at type_info@@QBEPBDXZ(ptr) MSVCRT_type_info_raw_name
 @ stub ?set_new_handler@@YAP6AXXZP6AXXZ at Z
-@ stub ?set_terminate@@YAP6AXXZP6AXXZ at Z
-@ stub ?set_unexpected@@YAP6AXXZP6AXXZ at Z
-@ stub ?terminate@@YAXXZ #()
-@ stub ?unexpected@@YAXXZ #()
+@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ at Z(ptr) MSVCRT_set_terminate
+@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ at Z(ptr) MSVCRT_set_unexpected
+@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate
+@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected
 @ stdcall ?what at exception@@UBEPBDXZ(ptr) MSVCRT_exception_what
 @ cdecl -noimport _CIacos() _CIacos
 @ cdecl -noimport _CIasin() _CIasin
--- /dev/null	Sun Apr 15 00:27:07 2001
+++ include/msvcrt/eh.h	Wed Apr 18 15:14:38 2001
@@ -0,0 +1,31 @@
+/*
+ * C++ exception handling facility
+ *
+ * Copyright 2000 Francois Gouget.
+ */
+#ifndef __WINE_EH_H
+#define __WINE_EH_H
+
+#if !defined(__cplusplus) && !defined(__WINE__)
+#error "eh.h is meant only for C++ applications"
+#endif
+
+#ifdef USE_MSVCRT_PREFIX
+#define MSVCRT(x)    MSVCRT_##x
+#else
+#define MSVCRT(x)    x
+#endif
+
+
+typedef void (*terminate_handler)();
+typedef void (*terminate_function)();
+typedef void (*unexpected_handler)();
+typedef void (*unexpected_function)();
+
+
+terminate_function MSVCRT(set_terminate)(terminate_function func);
+unexpected_function MSVCRT(set_unexpected)(unexpected_function func);
+void        MSVCRT(terminate)();
+void        MSVCRT(unexpected)();
+
+#endif /* __WINE_EH_H */
Index: dlls/msvcrt/cpp.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/cpp.c,v
retrieving revision 1.5
diff -u -r1.5 cpp.c
--- dlls/msvcrt/cpp.c	2001/04/23 18:20:55	1.5
+++ dlls/msvcrt/cpp.c	2001/05/30 17:20:48
@@ -5,6 +5,7 @@
  */
 
 #include "msvcrt.h"
+#include "msvcrt/eh.h"
 #include "msvcrt/malloc.h"
 
 
@@ -130,6 +131,48 @@
 {
   TRACE("(%p) returning %s\n",_this,_this->name);
   return _this->name;
+}
+
+
+static terminate_function func_terminate=NULL;
+static unexpected_function func_unexpected=NULL;
+
+/******************************************************************
+ *		set_terminate (MSVCRT.@)
+ */
+terminate_function MSVCRT_set_terminate(terminate_function func)
+{
+  terminate_function previous=func_terminate;
+  TRACE("(%p) returning %p\n",func,previous);
+  func_terminate=func;
+  return previous;
+}
+
+/******************************************************************
+ *		set_unexpected (MSVCRT.@)
+ */
+unexpected_function MSVCRT_set_unexpected(unexpected_function func)
+{
+  unexpected_function previous=func_unexpected;
+  TRACE("(%p) returning %p\n",func,previous);
+  func_unexpected=func;
+  return previous;
+}
+
+/******************************************************************
+ *		terminate (MSVCRT.@)
+ */
+void MSVCRT_terminate()
+{
+  (*func_terminate)();
+}
+
+/******************************************************************
+ *		unexpected (MSVCRT.@)
+ */
+void MSVCRT_unexpected()
+{
+  (*func_unexpected)();
 }
 
 


More information about the wine-patches mailing list