Ignore:
Timestamp:
Jul 6, 1999, 11:49:45 AM (26 years ago)
Author:
phaller
Message:

Fix: source beautification of exception.cpp, more debug information

File:
1 edited

Legend:

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

    r120 r276  
    1 /* $Id: exceptions.cpp,v 1.5 1999-06-19 10:54:39 sandervl Exp $ */
     1/* $Id: exceptions.cpp,v 1.6 1999-07-06 09:49:45 phaller Exp $ */
    22
    33/*
     
    4646 */
    4747#define INCL_BASE
    48 #include <os2wrap.h>    //Odin32 OS/2 api wrappers
     48#include <os2wrap.h>                     //Odin32 OS/2 api wrappers
    4949#include <stdio.h>
    5050#include <stdlib.h>
     
    6666LONG WIN32API UnhandledExceptionFilter(PWINEXCEPTION_POINTERS lpexpExceptionInfo);
    6767
    68 //******************************************************************************
    69 //******************************************************************************
     68
     69/*****************************************************************************
     70 * Name      : UINT SetErrorMode
     71 * Purpose   :
     72 * Parameters: UINT fuErrorMode
     73 * Variables :
     74 * Result    :
     75 * Remark    :
     76 * Status    :
     77 *
     78 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     79 *****************************************************************************/
     80
    7081UINT WIN32API SetErrorMode(UINT fuErrorMode)
    7182{
    7283 UINT oldmode = CurrentErrorMode;
    7384
    74   dprintf(("OS2SetErrorMode to %d\n", fuErrorMode));
     85  dprintf(("KERNEL32: SetErrorMode(%08xh)\n",
     86           fuErrorMode));
     87
    7588  CurrentErrorMode = fuErrorMode;
    7689
    7790  return(oldmode);
    7891}
    79 //******************************************************************************
    80 //Unwinds exception handlers (heavily influenced by Wine)
    81 //******************************************************************************
    82 VOID _Pascal OS2RaiseException(DWORD dwExceptionCode, DWORD dwExceptionFlags,
    83                    DWORD cArguments,      DWORD *lpArguments,
    84                    DWORD eip, DWORD esp,  DWORD ebp, DWORD flags,
    85                    DWORD eax, DWORD ebx,  DWORD ecx, DWORD edx,
    86                    DWORD edi, DWORD esi,  DWORD cs,  DWORD ds,
    87                    DWORD es,  DWORD fs,   DWORD gs,  DWORD ss)
     92
     93
     94/*****************************************************************************
     95 * Name      : VOID _Pascal OS2RaiseException
     96 * Purpose   : Unwinds exception handlers (heavily influenced by Wine)
     97 * Parameters: ...
     98 * Variables :
     99 * Result    :
     100 * Remark    :
     101 * Status    :
     102 *
     103 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     104 *****************************************************************************/
     105
     106VOID _Pascal OS2RaiseException(DWORD dwExceptionCode,
     107                               DWORD dwExceptionFlags,
     108                               DWORD cArguments,
     109                               DWORD *lpArguments,
     110                               DWORD eip, DWORD esp,  DWORD ebp, DWORD flags,
     111                               DWORD eax, DWORD ebx,  DWORD ecx, DWORD edx,
     112                               DWORD edi, DWORD esi,  DWORD cs,  DWORD ds,
     113                               DWORD es,  DWORD fs,   DWORD gs,  DWORD ss)
    88114{
    89  PWINEXCEPTION_FRAME   pframe;
    90  WINEXCEPTION_RECORD   record;
    91  WINEXCEPTION_POINTERS ExceptionInfo;
    92  WINCONTEXT            context;
    93  DWORD                 dispatch;
    94  int                   rc;
    95  int                   i;
    96 
    97    dprintf(("RaiseException %d\n", dwExceptionCode));
    98 
    99     /* compose an exception record */
    100     record.ExceptionCode       = dwExceptionCode;
    101     record.ExceptionFlags      = dwExceptionFlags;
    102     record.ExceptionRecord     = NULL;
    103     record.NumberParameters    = cArguments;
    104     record.ExceptionAddress    = (LPVOID)eip;
    105 
    106     memset(&context, 0, sizeof(context));
    107     context.ContextFlags = WINCONTEXT_FULL; //segments, integer, control
    108     context.SegGs  = gs;
    109     context.SegFs  = fs;
    110     context.SegEs  = es;
    111     context.SegDs  = ds;
    112     context.Edi    = edi;
    113     context.Esi    = esi;
    114     context.Ebx    = ebx;
    115     context.Edx    = edx;
    116     context.Ecx    = ecx;
    117     context.Eax    = eax;
    118     context.Ebp    = ebp;
    119     context.Eip    = eip;
    120     context.SegCs  = cs;
    121     context.EFlags = flags;
    122     context.Esp    = esp;
    123     context.SegSs  = ss;
    124 
    125     if(lpArguments) {
    126     for(i=0;i<cArguments;i++)
    127         record.ExceptionInformation[i] = lpArguments[i];
    128     }
    129 
    130     // get chain of exception frames
    131     rc     = ExceptionContinueSearch;
    132     pframe = QueryExceptionChain();
    133     while( (pframe != NULL) && (pframe != ((void *)0xFFFFFFFF)) ) {
    134        dispatch=0;
    135        rc = pframe->Handler(&record, pframe, &context, &dispatch);
    136 
    137        if(rc == ExceptionContinueExecution)
    138             break;
    139 
    140        pframe = pframe->Prev;
    141     }
    142     if(rc == ExceptionContinueSearch && UnhandledExceptionFilter != NULL) {
    143         ExceptionInfo.ExceptionRecord = &record;
    144         ExceptionInfo.ContextRecord   = &context;
    145 
    146         rc = UnhandledExceptionFilter(&ExceptionInfo);
    147     }
    148 
    149     if(rc != ExceptionContinueExecution)
    150     {
    151        DosExit(EXIT_PROCESS, 0);
    152     }
    153     return;
     115  PWINEXCEPTION_FRAME   pframe;
     116  WINEXCEPTION_RECORD   record;
     117  WINEXCEPTION_POINTERS ExceptionInfo;
     118  WINCONTEXT            context;
     119  DWORD                 dispatch;
     120  int                   rc;
     121  int                   i;
     122
     123  dprintf(("KERNEL32: RaiseException(%08xh)\n",
     124           dwExceptionCode));
     125
     126  /* compose an exception record */
     127  record.ExceptionCode       = dwExceptionCode;
     128  record.ExceptionFlags      = dwExceptionFlags;
     129  record.ExceptionRecord     = NULL;
     130  record.NumberParameters    = cArguments;
     131  record.ExceptionAddress    = (LPVOID)eip;
     132
     133  memset(&context, 0, sizeof(context));
     134  context.ContextFlags = WINCONTEXT_FULL; //segments, integer, control
     135  context.SegGs  = gs;
     136  context.SegFs  = fs;
     137  context.SegEs  = es;
     138  context.SegDs  = ds;
     139  context.Edi    = edi;
     140  context.Esi    = esi;
     141  context.Ebx    = ebx;
     142  context.Edx    = edx;
     143  context.Ecx    = ecx;
     144  context.Eax    = eax;
     145  context.Ebp    = ebp;
     146  context.Eip    = eip;
     147  context.SegCs  = cs;
     148  context.EFlags = flags;
     149  context.Esp    = esp;
     150  context.SegSs  = ss;
     151
     152  if(lpArguments)
     153  {
     154    for(i=0;
     155        i<cArguments;
     156        i++)
     157      record.ExceptionInformation[i] = lpArguments[i];
     158  }
     159
     160  // get chain of exception frames
     161  rc     = ExceptionContinueSearch;
     162  pframe = QueryExceptionChain();
     163
     164  // walk the exception chain
     165  while( (pframe != NULL) && (pframe != ((void *)0xFFFFFFFF)) )
     166  {
     167    dispatch=0;
     168    rc = pframe->Handler(&record,
     169                         pframe,
     170                         &context,
     171                         &dispatch);
     172    if(rc == ExceptionContinueExecution)
     173      break;
     174
     175    pframe = pframe->Prev;
     176  }
     177
     178  // and finally, the unhandled exception filter
     179  if(rc == ExceptionContinueSearch && UnhandledExceptionFilter != NULL)
     180  {
     181    ExceptionInfo.ExceptionRecord = &record;
     182    ExceptionInfo.ContextRecord   = &context;
     183
     184    rc = UnhandledExceptionFilter(&ExceptionInfo);
     185  }
     186
     187  // terminate the process
     188  if(rc != ExceptionContinueExecution)
     189  {
     190    dprintf(("KERNEL32: RaiseException terminating process.\n"));
     191    DosExit(EXIT_PROCESS, 0);
     192  }
     193
     194  return;
    154195}
    155 //******************************************************************************
    156 //Unwinds exception handlers (heavily influenced by Wine)
    157 //******************************************************************************
    158 int _Pascal OS2RtlUnwind(PWINEXCEPTION_FRAME  pEndFrame, LPVOID unusedEip,
    159                  PWINEXCEPTION_RECORD pRecord,   DWORD  returnEax,
    160                  DWORD eip, DWORD esp,  DWORD ebp, DWORD flags,
    161                  DWORD eax, DWORD ebx,  DWORD ecx, DWORD edx,
    162                  DWORD edi, DWORD esi,  DWORD cs,  DWORD ds,
    163                  DWORD es,  DWORD fs,   DWORD gs,  DWORD ss)
     196
     197
     198/*****************************************************************************
     199 * Name      : int _Pascal OS2RtlUnwind
     200 * Purpose   : Unwinds exception handlers (heavily influenced by Wine)
     201 * Parameters: ...
     202 * Variables :
     203 * Result    :
     204 * Remark    :
     205 * Status    :
     206 *
     207 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     208 *****************************************************************************/
     209
     210int _Pascal OS2RtlUnwind(PWINEXCEPTION_FRAME  pEndFrame,
     211                         LPVOID unusedEip,
     212                         PWINEXCEPTION_RECORD pRecord,
     213                         DWORD  returnEax,
     214                         DWORD eip, DWORD esp,  DWORD ebp, DWORD flags,
     215                         DWORD eax, DWORD ebx,  DWORD ecx, DWORD edx,
     216                         DWORD edi, DWORD esi,  DWORD cs,  DWORD ds,
     217                         DWORD es,  DWORD fs,   DWORD gs,  DWORD ss)
    164218{
    165  WINEXCEPTION_RECORD record;
    166  WINCONTEXT          context;
    167  DWORD               dispatch;
    168  int                 rc;
    169 
    170   dprintf(("RtlUnwind\n"));
     219  WINEXCEPTION_RECORD record;
     220  WINCONTEXT          context;
     221  DWORD               dispatch;
     222  int                 rc;
     223
     224  dprintf(("KERNEL32: RtlUnwind\n"));
    171225
    172226  memset(&context, 0, sizeof(context));
     
    190244
    191245  /* build an exception record, if we do not have one */
    192   if(!pRecord) {
    193      record.ExceptionCode    = STATUS_INVALID_DISPOSITION;
    194      record.ExceptionFlags   = 0;
    195      record.ExceptionRecord  = NULL;
    196      record.ExceptionAddress = (LPVOID)eip;
    197      record.NumberParameters = 0;
    198      pRecord = &record;
    199   }
    200 
    201   if(pEndFrame)
    202         pRecord->ExceptionFlags |= EH_UNWINDING;
    203   else  pRecord->ExceptionFlags |= EH_UNWINDING | EH_EXIT_UNWIND;
     246  if(!pRecord)
     247  {
     248    record.ExceptionCode    = STATUS_INVALID_DISPOSITION;
     249    record.ExceptionFlags   = 0;
     250    record.ExceptionRecord  = NULL;
     251    record.ExceptionAddress = (LPVOID)eip;
     252    record.NumberParameters = 0;
     253    pRecord = &record;
     254  }
     255
     256  if(pEndFrame) pRecord->ExceptionFlags |= EH_UNWINDING;
     257  else          pRecord->ExceptionFlags |= EH_UNWINDING | EH_EXIT_UNWIND;
    204258
    205259  /* get chain of exception frames */
    206   while((QueryExceptionChain() != NULL) && (QueryExceptionChain() != (void *)0xffffffff) &&
    207     (QueryExceptionChain() != pEndFrame)) {
    208        dispatch=0;
    209        rc = QueryExceptionChain()->Handler(pRecord,
    210                                            QueryExceptionChain(),
    211                                            &context, &dispatch);
    212 
    213        if((rc == ExceptionCollidedUnwind) && (QueryExceptionChain() != (LPVOID)dispatch)) {
    214         SetExceptionChain(dispatch);
    215        }
    216        else
    217        if((QueryExceptionChain() != pEndFrame) && (QueryExceptionChain() != QueryExceptionChain()->Prev))
     260  while((QueryExceptionChain() != NULL) &&
     261        (QueryExceptionChain() != (void *)0xffffffff) &&
     262        (QueryExceptionChain() != pEndFrame))
     263  {
     264    dispatch=0;
     265    rc = QueryExceptionChain()->Handler(pRecord,
     266                                        QueryExceptionChain(),
     267                                        &context,
     268                                        &dispatch);
     269
     270    if((rc == ExceptionCollidedUnwind) &&
     271       (QueryExceptionChain() != (LPVOID)dispatch))
     272    {
     273      SetExceptionChain(dispatch);
     274    }
     275    else
     276      if((QueryExceptionChain() != pEndFrame) &&
     277         (QueryExceptionChain() != QueryExceptionChain()->Prev))
    218278        SetExceptionChain((DWORD)QueryExceptionChain()->Prev);
    219        else break;
    220   }
    221   if(pEndFrame == UNWIND_ALL) {
     279      else
     280        break;
     281  }
     282
     283  if(pEndFrame == UNWIND_ALL)
     284  {
     285    dprintf(("KERNEL32: RtlUnwind terminating thread.\n"));
    222286    DosExit(EXIT_THREAD, 0);
    223287  }
    224288  return(0);
    225289}
    226 //******************************************************************************
    227 //******************************************************************************
     290
     291
     292/*****************************************************************************
     293 * Name      : LONG WIN32API UnhandledExceptionFilter
     294 * Purpose   :
     295 * Parameters: ...
     296 * Variables :
     297 * Result    :
     298 * Remark    :
     299 * Status    :
     300 *
     301 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     302 *****************************************************************************/
     303
    228304LONG WIN32API UnhandledExceptionFilter(PWINEXCEPTION_POINTERS lpexpExceptionInfo)
    229305{
    230  char  message[72];
    231  DWORD rc;
    232 
    233   dprintf(("UnhandledExceptionFilter\n"));
    234 
    235   if(CurrentUnhExceptionFlt && !(CurrentErrorMode & (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX))) {
     306  char  message[72];
     307  DWORD rc;
     308
     309  dprintf(("KERNEL32: UnhandledExceptionFilter\n"));
     310
     311  if(CurrentUnhExceptionFlt && !(CurrentErrorMode & (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX)))
     312  {
    236313    rc = CurrentUnhExceptionFlt(lpexpExceptionInfo);
    237         if(rc != WINEXCEPTION_CONTINUE_SEARCH)
    238         return rc;
    239   }
    240 
    241   sprintf(message, "Unhandled exception 0x%08lx at address 0x%08lx.",
     314    if(rc != WINEXCEPTION_CONTINUE_SEARCH)
     315      return rc;
     316  }
     317
     318  sprintf(message,
     319          "Unhandled exception 0x%08lx at address 0x%08lx.",
    242320          lpexpExceptionInfo->ExceptionRecord->ExceptionCode,
    243321          lpexpExceptionInfo->ExceptionRecord->ExceptionAddress);
    244322
    245   WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, message, "Oh, nooo!", 0, MB_OK | MB_ERROR);
     323  WinMessageBox(HWND_DESKTOP,
     324                HWND_DESKTOP,
     325                message,
     326                "Oh, nooo!",
     327                0,
     328                MB_OK | MB_ERROR);
     329
    246330  return WINEXCEPTION_EXECUTE_HANDLER;
    247331}
    248 //******************************************************************************
    249 //******************************************************************************
     332
     333
     334/*****************************************************************************
     335 * Name      : LPTOP_LEVEL_EXCEPTION_FILTER WIN32API SetUnhandledExceptionFilter
     336 * Purpose   :
     337 * Parameters: ...
     338 * Variables :
     339 * Result    :
     340 * Remark    :
     341 * Status    :
     342 *
     343 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     344 *****************************************************************************/
     345
    250346LPTOP_LEVEL_EXCEPTION_FILTER WIN32API SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
    251347{
    252  LPTOP_LEVEL_EXCEPTION_FILTER old = CurrentUnhExceptionFlt;
    253   dprintf(("SetUnhandledExceptionFilter to %X\n", lpTopLevelExceptionFilter));
     348  LPTOP_LEVEL_EXCEPTION_FILTER old = CurrentUnhExceptionFlt;
     349
     350  dprintf(("KERNEL32: SetUnhandledExceptionFilter to %X\n",
     351           lpTopLevelExceptionFilter));
    254352
    255353  CurrentUnhExceptionFlt = lpTopLevelExceptionFilter;
     
    257355  return(old);
    258356}
     357
     358
     359/*****************************************************************************
     360 * Name      : KillWin32Process
     361 * Purpose   :
     362 * Parameters: ...
     363 * Variables :
     364 * Result    :
     365 * Remark    :
     366 * Status    :
     367 *
     368 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     369 *****************************************************************************/
     370
     371
    259372//******************************************************************************
    260373extern "C" ULONG getEAX();
     
    269382  excptaddr = getEBX();
    270383
    271   dprintf(("KillWin32Process: Do you feel lucky, punk?!\n"));
     384  dprintf(("KERNEL32: KillWin32Process: Do you feel lucky, punk?!\n"));
    272385//  sprintf(excptmsg, "Fatal Exception %X at %X", excptnr, excptaddr);
    273386//  WinMessageBox(HWND_DESKTOP, NULL, excptmsg, "Win32 for OS/2", 0, MB_ERROR | MB_OK);
     
    275388  DosExit(EXIT_PROCESS, 666);
    276389}
     390
     391
    277392//******************************************************************************
    278393APIRET APIENTRY DosQueryModFromEIP (PULONG pulModule,
     
    283398                                    ULONG  ulEIP);
    284399//******************************************************************************
    285 void dprintfException(PEXCEPTIONREPORTRECORD pERepRec,
    286                   PEXCEPTIONREGISTRATIONRECORD pERegRec,
    287                       PCONTEXTRECORD pCtxRec,
    288                       PVOID p)
     400
     401
     402/*****************************************************************************
     403 * Name      : void static dprintfException
     404 * Purpose   : log the exception to win32os2.log
     405 * Parameters: ...
     406 * Variables :
     407 * Result    :
     408 * Remark    :
     409 * Status    :
     410 *
     411 * Author    : Patrick Haller [Tue, 1999/07/01 09:00]
     412 *****************************************************************************/
     413
     414void static dprintfException(PEXCEPTIONREPORTRECORD       pERepRec,
     415                             PEXCEPTIONREGISTRATIONRECORD pERegRec,
     416                             PCONTEXTRECORD               pCtxRec,
     417                             PVOID                        p)
    289418{
    290419  PSZ    pszExceptionName = "<unknown>";        /* points to name/type excpt */
     
    592721
    593722  if (pCtxRec->ContextFlags & CONTEXT_CONTROL)         /* check flags */
    594 dprintf(("   SS:ESP=%04x:%08x EFLAGS=%08x\n"
    595          "   CS:EIP=%04x:%08x EBP   =%08x\n",
     723    dprintf(("   SS:ESP=%04x:%08x EFLAGS=%08x\n"
     724             "   CS:EIP=%04x:%08x EBP   =%08x\n",
    596725             pCtxRec->ctx_SegSs,
    597726             pCtxRec->ctx_RegEsp,
     
    645774
    646775  dprintf(("---[End Of Exception Information]-----\n"));
    647 
     776}
     777
     778
     779/*****************************************************************************
     780 * Name      : ERR _System OS2ExceptionHandler
     781 * Purpose   :
     782 * Parameters: ...
     783 * Variables :
     784 * Result    :
     785 * Remark    :
     786 * Status    :
     787 *
     788 * Author    : Patrick Haller [Tue, 1999/07/01 09:00]
     789 *****************************************************************************/
    648790                                                             /* from PPC DDK */
    649791#ifndef XCPT_CONTINUE_STOP
     
    651793#endif
    652794
    653 //  return (XCPT_CONTINUE_STOP);
    654 //  return (XCPT_CONTINUE_SEARCH);
    655 }
    656 //******************************************************************************
    657 //******************************************************************************
    658 ERR _System OS2ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
    659                         PEXCEPTIONREGISTRATIONRECORD pERegRec,
    660                         PCONTEXTRECORD pCtxRec,
    661                         PVOID p)
     795ERR _System OS2ExceptionHandler(PEXCEPTIONREPORTRECORD       pERepRec,
     796                                PEXCEPTIONREGISTRATIONRECORD pERegRec,
     797                                PCONTEXTRECORD               pCtxRec,
     798                                PVOID                        p)
    662799{
    663 //  pERegRec->prev_structure = 0;
     800  //  pERegRec->prev_structure = 0;
    664801  dprintfException(pERepRec, pERegRec, pCtxRec, p);
    665802
    666803  /* Access violation at a known location */
    667   switch(pERepRec->ExceptionNum) {
    668   case XCPT_FLOAT_DENORMAL_OPERAND:
    669   case XCPT_FLOAT_DIVIDE_BY_ZERO:
    670   case XCPT_FLOAT_INEXACT_RESULT:
    671   case XCPT_FLOAT_INVALID_OPERATION:
    672   case XCPT_FLOAT_OVERFLOW:
    673   case XCPT_FLOAT_STACK_CHECK:
    674   case XCPT_FLOAT_UNDERFLOW:
    675     dprintf(("FPU exception, fix and continue\n"));
    676     pCtxRec->ctx_env[0] |= 0x1F;
    677     pCtxRec->ctx_stack[0].losig = 0;
    678     pCtxRec->ctx_stack[0].hisig = 0;
    679     pCtxRec->ctx_stack[0].signexp = 0;
    680 
    681     return (ERR)(XCPT_CONTINUE_EXECUTION);
    682 
    683   case XCPT_PROCESS_TERMINATE:
    684   case XCPT_ASYNC_PROCESS_TERMINATE:
    685     SetExceptionChain((ULONG)0);
    686     return (XCPT_CONTINUE_SEARCH);
     804  switch(pERepRec->ExceptionNum)
     805  {
     806    case XCPT_FLOAT_DENORMAL_OPERAND:
     807    case XCPT_FLOAT_DIVIDE_BY_ZERO:
     808    case XCPT_FLOAT_INEXACT_RESULT:
     809    case XCPT_FLOAT_INVALID_OPERATION:
     810    case XCPT_FLOAT_OVERFLOW:
     811    case XCPT_FLOAT_STACK_CHECK:
     812    case XCPT_FLOAT_UNDERFLOW:
     813      dprintf(("KERNEL32: OS2ExceptionHandler: FPU exception, fix and continue\n"));
     814               pCtxRec->ctx_env[0] |= 0x1F;
     815               pCtxRec->ctx_stack[0].losig = 0;
     816               pCtxRec->ctx_stack[0].hisig = 0;
     817               pCtxRec->ctx_stack[0].signexp = 0;
     818
     819      return (ERR)(XCPT_CONTINUE_EXECUTION);
     820
     821    case XCPT_PROCESS_TERMINATE:
     822    case XCPT_ASYNC_PROCESS_TERMINATE:
     823      SetExceptionChain((ULONG)0);
     824      return (XCPT_CONTINUE_SEARCH);
    687825
    688826  case XCPT_ACCESS_VIOLATION:
     
    700838  case XCPT_IN_PAGE_ERROR:
    701839  case XCPT_SIGNAL:
    702     dprintf(("Continue and kill\n"));
     840    dprintf(("KERNEL32: OS2ExceptionHandler: Continue and kill\n"));
    703841    pCtxRec->ctx_RegEip = (ULONG)KillWin32Process;
    704842    pCtxRec->ctx_RegEsp = pCtxRec->ctx_RegEsp + 0x10;
     
    712850  return (XCPT_CONTINUE_SEARCH);
    713851}
     852
     853
     854/*****************************************************************************
     855 * Name      : void ReplaceExceptionHandler
     856 * Purpose   :
     857 * Parameters: ...
     858 * Variables :
     859 * Result    :
     860 * Remark    :
     861 * Status    :
     862 *
     863 * Author    : Sander van Leeuwen [Tue, 1999/07/01 09:00]
     864 *****************************************************************************/
     865
    714866//******************************************************************************
    715867//SvL: Replace original startup code exception handler
     
    718870void ReplaceExceptionHandler()
    719871{
    720  static BOOL         fRegistered = FALSE;
    721  PWINEXCEPTION_FRAME orgframe;
    722  APIRET          rc;
    723  ULONGULONG            timerval;
     872  static BOOL         fRegistered = FALSE;
     873  PWINEXCEPTION_FRAME orgframe;
     874  APIRET          rc;
     875  ULONGULONG            timerval;
    724876
    725877  DisableFPUExceptions();
     
    729881
    730882  orgframe = QueryExceptionChain();
    731   if((int)orgframe == 0 || (int)orgframe == -1)
     883  if((int)orgframe == 0 ||
     884     (int)orgframe == -1)
    732885    return;
    733886
    734   dprintf(("ReplaceExceptionHandler\n"));
     887  dprintf(("KERNEL32: ReplaceExceptionHandler\n"));
    735888
    736889  StartupCodeHandler = orgframe->Handler;
     
    738891  orgframe->Prev    = (_WINEXCEPTION_FRAME *)0;
    739892  SetExceptionChain((ULONG)-1);
     893
    740894#if 0
    741   if(fRegistered == FALSE) {
     895  if(fRegistered == FALSE)
     896  {
    742897#endif
    743     dprintf(("New exception frame at %X\n", orgframe));
     898
     899    dprintf(("KERNEL32: ReplaceExceptionHandler: New exception frame at %X\n",
     900             orgframe));
    744901    rc = DosSetExceptionHandler((PEXCEPTIONREGISTRATIONRECORD)orgframe);
    745902    fRegistered = TRUE;
     903
    746904#if 0
    747905  }
    748   else {
    749     while(orgframe && orgframe->Handler != (PEXCEPTION_HANDLER)OS2ExceptionHandler) {
    750         orgframe = orgframe->Prev;
     906  else
     907  {
     908    while(orgframe && orgframe->Handler != (PEXCEPTION_HANDLER)OS2ExceptionHandler)
     909    {
     910      orgframe = orgframe->Prev;
    751911    }
    752     dprintf(("Restore old exception frame %X\n", orgframe));
    753     if(orgframe) {
    754         orgframe->Prev  = (_WINEXCEPTION_FRAME *)0;
    755         SetExceptionChain((ULONG)orgframe);
     912
     913    dprintf(("KERNEL32: ReplaceExceptionHandler: Restore old exception frame %X\n",
     914             orgframe));
     915    if(orgframe)
     916    {
     917      orgframe->Prev  = (_WINEXCEPTION_FRAME *)0;
     918      SetExceptionChain((ULONG)orgframe);
    756919    }
    757920  }
    758921#endif
    759922}
    760 //******************************************************************************
    761 //******************************************************************************
    762 
     923
Note: See TracChangeset for help on using the changeset viewer.