Author: tkreuzer
Date: Mon Dec 22 14:32:47 2008
New Revision: 38278
URL:
http://svn.reactos.org/svn/reactos?rev=38278&view=rev
Log:
Don't use wine's headers and wintrnl.h for exception handling in crt. Instead
include ndk and add the few definitions we need to cppexcept.h
Modified:
trunk/reactos/lib/sdk/crt/except/cpp.c
trunk/reactos/lib/sdk/crt/except/cppexcept.c
trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
trunk/reactos/lib/sdk/crt/precomp.h
trunk/reactos/lib/sdk/crt/wine/undname.c
Modified: trunk/reactos/lib/sdk/crt/except/cpp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cpp.c?r…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/cpp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/cpp.c [iso-8859-1] Mon Dec 22 14:32:47 2008
@@ -19,28 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "wine/exception.h"
-#include "winnt.h"
-#include "excpt.h"
-#include "wine/debug.h"
-#include <malloc.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include <precomp.h>
#include <internal/wine/msvcrt.h>
#include <internal/wine/cppexcept.h>
-#include <internal/mtdll.h>
-
-WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
typedef exception bad_cast;
typedef exception bad_typeid;
@@ -75,7 +57,6 @@
const type_info *type_descriptor;
const rtti_object_hierarchy *type_hierarchy;
} rtti_object_locator;
-
#ifdef __i386__ /* thiscall functions are i386-specific */
Modified: trunk/reactos/lib/sdk/crt/except/cppexcept.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cppexce…
==============================================================================
--- trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] Mon Dec 22 14:32:47 2008
@@ -23,20 +23,11 @@
*
www.thecodeproject.com.
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
+#define __WINE_DEBUG_CHANNEL__
+#include <precomp.h>
#include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
#include <internal/wine/msvcrt.h>
-#include "wine/exception.h"
-#include "excpt.h"
-#include "wine/debug.h"
-
#include <internal/wine/cppexcept.h>
#ifdef __i386__ /* CxxFrameHandler is not supported on non-i386 */
@@ -328,7 +319,7 @@
/* setup an exception block for nested exceptions */
- nested_frame.frame.Handler =
(PEXCEPTION_HANDLER)catch_function_nested_handler;
+ nested_frame.frame.Handler =
(PEXCEPTION_ROUTINE)catch_function_nested_handler;
nested_frame.prev_rec = thread_data->exc_record;
nested_frame.cxx_frame = frame;
nested_frame.descr = descr;
Modified: trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/include/intern…
==============================================================================
--- trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h [iso-8859-1] Mon Dec 22
14:32:47 2008
@@ -20,6 +20,57 @@
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
+
+#include <pseh/pseh2.h>
+
+/* Macros to define assembler functions somewhat portably */
+
+#define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32;
.endef"
+#define __ASM_NAME(name) "_" name
+
+#ifdef __GNUC__
+# define __ASM_GLOBAL_FUNC(name,code) \
+ __asm__( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ __ASM_FUNC(#name) "\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code );
+#else /* __GNUC__ */
+# define __ASM_GLOBAL_FUNC(name,code) \
+ void __asm_dummy_##name(void) { \
+ asm( ".align 4\n\t" \
+ ".globl " __ASM_NAME(#name) "\n\t" \
+ __ASM_FUNC(#name) "\n" \
+ __ASM_NAME(#name) ":\n\t" \
+ code ); \
+ }
+#endif /* __GNUC__ */
+
+#define EH_NONCONTINUABLE 0x01
+#define EH_UNWINDING 0x02
+#define EH_EXIT_UNWIND 0x04
+#define EH_STACK_INVALID 0x08
+#define EH_NESTED_CALL 0x10
+
+static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame(
EXCEPTION_REGISTRATION_RECORD *frame )
+{
+ frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
+ __writefsdword(0, (unsigned long)frame);
+ return frame->Next;
+}
+
+static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame(
EXCEPTION_REGISTRATION_RECORD *frame )
+{
+ __writefsdword(0, (unsigned long)frame->Next);
+ return frame->Next;
+}
+
+#define __TRY _SEH2_TRY
+#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
+#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() ==
STATUS_ACCESS_VIOLATION)
+#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
+#define __ENDTRY _SEH2_END
+#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
#define CXX_FRAME_MAGIC 0x19930520
#define CXX_EXCEPTION 0xe06d7363
Modified: trunk/reactos/lib/sdk/crt/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/precomp.h?rev=…
==============================================================================
--- trunk/reactos/lib/sdk/crt/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/precomp.h [iso-8859-1] Mon Dec 22 14:32:47 2008
@@ -39,7 +39,9 @@
/* kernelmode libcnt should not include Wine-debugging crap */
#ifndef _LIBCNT_
#include "wine/debug.h"
+#ifndef __WINE_DEBUG_CHANNEL__
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
+#endif
#else
#include <debug.h>
#define TRACE DPRINT
Modified: trunk/reactos/lib/sdk/crt/wine/undname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/undname.c…
==============================================================================
--- trunk/reactos/lib/sdk/crt/wine/undname.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/wine/undname.c [iso-8859-1] Mon Dec 22 14:32:47 2008
@@ -19,27 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "wine/config.h"
-#include "wine/port.h"
-
+#define __WINE_DEBUG_CHANNEL__
+#include <precomp.h>
#include <assert.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "winternl.h"
-#include "wine/exception.h"
-#include "winnt.h"
-#include "excpt.h"
-#include "wine/debug.h"
-#include <malloc.h>
-#include <stdlib.h>
#include <internal/wine/msvcrt.h>
#include <internal/wine/cppexcept.h>
-#include <internal/mtdll.h>
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);