Alexandre Julliard : ntdll: Avoid referencing winecrt0 exception handlers from the Unix library.

Alexandre Julliard julliard at winehq.org
Mon Aug 24 15:58:50 CDT 2020


Module: wine
Branch: master
Commit: 97847eeee8aaaad9b141e14d4468838960ea3093
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=97847eeee8aaaad9b141e14d4468838960ea3093

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 24 13:30:19 2020 +0200

ntdll: Avoid referencing winecrt0 exception handlers from the Unix library.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/virtual.c | 10 ++++++----
 include/wine/exception.h  | 17 ++++-------------
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index fa46ec0966..e3f2820de5 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -92,6 +92,8 @@ struct file_view
     unsigned int  protect;       /* protection for all pages at allocation time and SEC_* flags */
 };
 
+#define __EXCEPT_SYSCALL __EXCEPT_HANDLER(0)
+
 /* per-page protection flags */
 #define VPROT_READ       0x01
 #define VPROT_WRITE      0x02
@@ -3142,7 +3144,7 @@ BOOL virtual_check_buffer_for_read( const void *ptr, SIZE_T size )
         dummy = p[0];
         dummy = p[count - 1];
     }
-    __EXCEPT_PAGE_FAULT
+    __EXCEPT_SYSCALL
     {
         return FALSE;
     }
@@ -3175,7 +3177,7 @@ BOOL virtual_check_buffer_for_write( void *ptr, SIZE_T size )
         p[0] |= 0;
         p[count - 1] |= 0;
     }
-    __EXCEPT_PAGE_FAULT
+    __EXCEPT_SYSCALL
     {
         return FALSE;
     }
@@ -3197,7 +3199,7 @@ BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max )
         volatile const char *p = str;
         while (p != str + max) if (!*p++) break;
     }
-    __EXCEPT_PAGE_FAULT
+    __EXCEPT_SYSCALL
     {
         return TRUE;
     }
@@ -3219,7 +3221,7 @@ BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max )
         volatile const WCHAR *p = str;
         while (p != str + max) if (!*p++) break;
     }
-    __EXCEPT_PAGE_FAULT
+    __EXCEPT_SYSCALL
     {
         return TRUE;
     }
diff --git a/include/wine/exception.h b/include/wine/exception.h
index a6ada7af21..a2b0bb08dc 100644
--- a/include/wine/exception.h
+++ b/include/wine/exception.h
@@ -163,27 +163,18 @@ extern DWORD __cdecl __wine_finally_ctx_handler( EXCEPTION_RECORD *record,
                  const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
                  do {
 
-/* convenience handler for page fault exceptions */
-#define __EXCEPT_PAGE_FAULT \
+#define __EXCEPT_HANDLER(handler) \
              } while(0); \
              __wine_pop_frame( &__f.frame ); \
              break; \
          } else { \
-             __f.frame.Handler = __wine_exception_handler_page_fault; \
+             __f.frame.Handler = (handler); \
              if (__wine_setjmpex( &__f.jmp, &__f.frame )) { \
                  const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
                  do {
 
-/* convenience handler for all exceptions */
-#define __EXCEPT_ALL \
-             } while(0); \
-             __wine_pop_frame( &__f.frame ); \
-             break; \
-         } else { \
-             __f.frame.Handler = __wine_exception_handler_all; \
-             if (__wine_setjmpex( &__f.jmp, &__f.frame )) { \
-                 const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
-                 do {
+#define __EXCEPT_PAGE_FAULT __EXCEPT_HANDLER(__wine_exception_handler_page_fault)
+#define __EXCEPT_ALL        __EXCEPT_HANDLER(__wine_exception_handler_all)
 
 #define __ENDTRY \
                  } while (0); \




More information about the wine-cvs mailing list