Attachment "seh_dllmain_patch.txt" to
ticket [858493ffff]
added by
davygrvy
2003-12-12 03:11:16.
Index: tclWin32Dll.c
===================================================================
RCS file: /cvsroot/tcl/tcl/win/tclWin32Dll.c,v
retrieving revision 1.24.2.1
diff -c -r1.24.2.1 tclWin32Dll.c
*** tclWin32Dll.c 14 Apr 2003 15:45:59 -0000 1.24.2.1
--- tclWin32Dll.c 11 Dec 2003 19:26:22 -0000
***************
*** 244,257 ****
case DLL_PROCESS_DETACH:
if (hInst == hInstance) {
! Tcl_Finalize();
}
break;
}
return TRUE;
}
!
#endif /* !STATIC_BUILD */
#endif /* __WIN32__ */
--- 244,307 ----
case DLL_PROCESS_DETACH:
if (hInst == hInstance) {
!
! #ifdef HAVE_NO_SEH
! __asm__ __volatile__ (
! "pushl %ebp" "\n\t"
! "pushl $__except_dllmain_handler" "\n\t"
! "pushl %fs:0" "\n\t"
! "movl %esp, %fs:0");
! #else
! __try {
! #endif /* HAVE_NO_SEH */
!
! Tcl_Finalize();
!
! #ifdef HAVE_NO_SEH
! __asm__ __volatile__ (
! "movl %%fs:0, %%esp" "\n\t"
! "jmp dllmain_pop" "\n"
! "dllmain_reentry:" "\n\t"
! "movl %%fs:0, %%eax" "\n\t"
! "movl 0x8(%%eax), %%esp" "\n\t"
! "movl 0x8(%%esp), %%ebp" "\n"
! "dllmain_pop:" "\n\t"
! "movl (%%esp), %%eax" "\n\t"
! "movl %%eax, %%fs:0" "\n\t"
! "add $12, %%esp" "\n\t"
! :
! :
! : "%eax");
! #else
! } __except (EXCEPTION_EXECUTE_HANDLER) {
! /* empty handler. */
! }
!
! #endif /* HAVE_NO_SEH */
!
}
break;
}
return TRUE;
}
! #ifdef HAVE_NO_SEH
! static
! __attribute__ ((cdecl))
! EXCEPTION_DISPOSITION
! _except_dllmain_handler(
! EXCEPTION_RECORD *ExceptionRecord,
! void *EstablisherFrame,
! CONTEXT *ContextRecord,
! void *DispatcherContext)
! {
! __asm__ __volatile__ (
! "jmp dllmain_reentry");
! /* Nuke compiler warning about unused static function */
! _except_dllmain_handler(NULL, NULL, NULL, NULL);
! return 0; /* Function does not return */
! }
! #endif /* HAVE_NO_SEH */
#endif /* !STATIC_BUILD */
#endif /* __WIN32__ */
***************
*** 310,316 ****
*/
if (platformId == VER_PLATFORM_WIN32s) {
! panic("Win32s is not a supported platform");
}
tclWinProcs = &asciiProcs;
--- 360,366 ----
*/
if (platformId == VER_PLATFORM_WIN32s) {
! Tcl_Panic("Win32s is not a supported platform");
}
tclWinProcs = &asciiProcs;
***************
*** 458,468 ****
"=r"(RESTORED_HANDLER) );
if (INITIAL_ESP != RESTORED_ESP)
! panic("ESP restored incorrectly");
if (INITIAL_EBP != RESTORED_EBP)
! panic("EBP restored incorrectly");
if (INITIAL_HANDLER != RESTORED_HANDLER)
! panic("HANDLER restored incorrectly");
# endif /* TCL_MEM_DEBUG */
#else
} __except (EXCEPTION_EXECUTE_HANDLER) {}
--- 508,518 ----
"=r"(RESTORED_HANDLER) );
if (INITIAL_ESP != RESTORED_ESP)
! Tcl_Panic("ESP restored incorrectly");
if (INITIAL_EBP != RESTORED_EBP)
! Tcl_Panic("EBP restored incorrectly");
if (INITIAL_HANDLER != RESTORED_HANDLER)
! Tcl_Panic("HANDLER restored incorrectly");
# endif /* TCL_MEM_DEBUG */
#else
} __except (EXCEPTION_EXECUTE_HANDLER) {}