Ignore:
Timestamp:
Apr 15, 2011, 9:37:36 PM (14 years ago)
Author:
dmik
Message:

kernel32: To complete the Win32 exception chain unwind support, make sure it is unwound when the thread terminates itself with ExitThread/ExitProcess etc. before removing its exception handlers from stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/thread.cpp

    r21529 r21626  
    5252#define MQP_INSTANCE_PERMQ              0x00000001 // from os2im.h
    5353
     54// borrowed from ntddk.h
     55extern "C"
     56void WINAPI RtlUnwind(
     57        PEXCEPTION_FRAME,
     58        LPVOID,
     59        PEXCEPTION_RECORD,DWORD);
     60
    5461//******************************************************************************
    5562//******************************************************************************
     
    547554
    548555    dprintf(("ExitThread %x (%x)", GetCurrentThread(), exitcode));
     556
     557    // make sure the Win32 exception stack (if there is still any) is unwound
     558    // before we destroy internal structures including the Win32 TIB
     559    RtlUnwind(NULL, 0, 0, 0);
    549560
    550561    teb = GetThreadTEB();
     
    729740    CONTROL87(0x27F, 0xFFF);
    730741    rc = AsmCallThreadHandler(fAlignStack, threadCallback, userdata);
     742
     743    // make sure the Win32 exception stack (if there is still any) is unwound
     744    // before we destroy internal structures including the Win32 TIB
     745    RtlUnwind(NULL, 0, 0, 0);
    731746
    732747    if(fExitProcess) {
Note: See TracChangeset for help on using the changeset viewer.