Overview
| Artifact ID: | 93213a829bd773ac632a6aa185f2fb0db050c218 |
|---|---|
| Ticket: | 858493ffffffffffffffffffffffffffffffffff |
| Date: | 2003-12-12 03:11:16 |
| User: | davygrvy |
| Artifact Attached: | c7d12a7cce6a356f0f01400f6f102df01368bf3d |
| Filename: | seh_dllmain_patch.txt |
| Description: | proposed patch. |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130Index: 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) {}