Ignore:
Timestamp:
Nov 24, 2002, 9:45:05 PM (23 years ago)
Author:
umoeller
Message:

Sources as of 1.0.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/except.c

    r217 r229  
    451451 *@@changed V0.9.16 (2001-11-02) [pr]: make object display signed
    452452 *@@changed V0.9.19 (2002-03-28) [umoeller]: added thread ordinal
    453  *@@changed V0.9.21 (2002-08-28) [umoeller]: added OS revision to dump
     453 *@@changed V1.0.0 (2002-08-28) [umoeller]: added OS revision to dump
    454454 */
    455455
     
    508508    // generic exception info
    509509    DosQuerySysInfo(QSV_VERSION_MAJOR,      // 11
    510                     QSV_VERSION_REVISION,   // 13 V0.9.21 (2002-08-28) [umoeller]
     510                    QSV_VERSION_REVISION,   // 13 V1.0.0 (2002-08-28) [umoeller]
    511511                    &aulBuf, sizeof(aulBuf));
    512512    // Warp 3 is reported as 20.30
     
    527527            aulBuf[0],                      // major
    528528            aulBuf[1],
    529             aulBuf[2],              // revision V0.9.21 (2002-08-28) [umoeller]
     529            aulBuf[2],              // revision V1.0.0 (2002-08-28) [umoeller]
    530530            pcszVersion);
    531531
     
    791791 *
    792792 *      --  pfnExcOpenFileNew gets called to open
    793  *          the trap log file. This must return a FILE*
    794  *          pointer from fopen(). If this is not defined,
    795  *          ?:\TRAP.LOG is used. Use this to specify a
    796  *          different file and have some notes written
    797  *          into it before the actual exception info.
     793 *          the trap log file. This can return a FILE*
     794 *          pointer from fopen() (which will be closed
     795 *          automatically by the handler).
     796 *
     797 *          If this hook is not defined, ?:\TRAP.LOG is
     798 *          used. Use this hook to specify a different file
     799 *          and have some notes written into it before the
     800 *          actual exception info.
     801 *
     802 *          If the hook returns a null FILE* pointer,
     803 *          logging is disabled, and the "loud" handler
     804 *          effectively behaves like the "quiet" handler.
    798805 *
    799806 *      --  pfnExcHookNew gets called while the trap log
     
    801808 *          the following info has been written into
    802809 *          the trap log already:
     810 *
    803811 *          -- exception type/address block
     812 *
    804813 *          -- exception explanation
     814 *
    805815 *          -- process information
    806816 *
     
    890900{
    891901    /* From the VAC++3 docs:
    892      *     "The first thing an exception handler should do is check the
    893      *     exception flags. If EH_EXIT_UNWIND is set, meaning
    894      *     the thread is ending, the handler tells the operating system
    895      *     to pass the exception to the next exception handler. It does the
    896      *     same if the EH_UNWINDING flag is set, the flag that indicates
    897      *     this exception handler is being removed.
    898      *     The EH_NESTED_CALL flag indicates whether the exception
    899      *     occurred within an exception handler. If the handler does
    900      *     not check this flag, recursive exceptions could occur until
    901      *     there is no stack remaining."
    902      * So for all these conditions, we exit immediately.
     902     *      "The first thing an exception handler should do is check the
     903     *      exception flags. If EH_EXIT_UNWIND is set, meaning
     904     *      the thread is ending, the handler tells the operating system
     905     *      to pass the exception to the next exception handler. It does the
     906     *      same if the EH_UNWINDING flag is set, the flag that indicates
     907     *      this exception handler is being removed.
     908     *      The EH_NESTED_CALL flag indicates whether the exception
     909     *      occurred within an exception handler. If the handler does
     910     *      not check this flag, recursive exceptions could occur until
     911     *      there is no stack remaining."
     912     *
     913     *      So for all these conditions, we exit immediately.
    903914     */
    904915
    905916    if (pReportRec->fHandlerFlags & EH_EXIT_UNWIND)
    906        return (XCPT_CONTINUE_SEARCH);
     917       return XCPT_CONTINUE_SEARCH;
    907918    if (pReportRec->fHandlerFlags & EH_UNWINDING)
    908        return (XCPT_CONTINUE_SEARCH);
     919       return XCPT_CONTINUE_SEARCH;
    909920    if (pReportRec->fHandlerFlags & EH_NESTED_CALL)
    910        return (XCPT_CONTINUE_SEARCH);
     921       return XCPT_CONTINUE_SEARCH;
    911922
    912923    switch (pReportRec->ExceptionNum)
     
    920931        {
    921932            // "real" exceptions:
    922             FILE *file;
     933            FILE *file = NULL;
    923934
    924935            // open traplog file;
    925936            if (G_pfnExcOpenFile)
    926937                // hook defined for this: call it
    927                 file = (*G_pfnExcOpenFile)();
     938                file = G_pfnExcOpenFile();
    928939            else
    929940            {
     
    933944                // boot drive
    934945                sprintf(szFileName, "%c:\\trap.log", doshQueryBootDrive());
    935                 file = fopen(szFileName, "a");
    936 
    937                 if (file)
     946
     947                if (file = fopen(szFileName, "a"))
    938948                {
    939949                    DATETIME DT;
     
    948958            }
    949959
    950             // write error log
    951             excExplainException(file,
    952                                 "excHandlerLoud",
    953                                 pReportRec,
    954                                 pContextRec);
    955             fclose(file);
     960            if (file)
     961            {
     962                // write error log
     963                excExplainException(file,
     964                                    "excHandlerLoud",
     965                                    pReportRec,
     966                                    pContextRec);
     967                fclose(file);
     968            }
    956969
    957970            // copy report rec to user buffer
     
    963976            // jump back to failing routine
    964977            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
    965         break; }
     978        }
     979        break;
    966980    }
    967981
    968982    // not handled
    969     return (XCPT_CONTINUE_SEARCH);
     983    return XCPT_CONTINUE_SEARCH;
    970984}
    971985
     
    9971011{
    9981012    if (pReportRec->fHandlerFlags & EH_EXIT_UNWIND)
    999        return (XCPT_CONTINUE_SEARCH);
     1013       return XCPT_CONTINUE_SEARCH;
    10001014    if (pReportRec->fHandlerFlags & EH_UNWINDING)
    1001        return (XCPT_CONTINUE_SEARCH);
     1015       return XCPT_CONTINUE_SEARCH;
    10021016    if (pReportRec->fHandlerFlags & EH_NESTED_CALL)
    1003        return (XCPT_CONTINUE_SEARCH);
     1017       return XCPT_CONTINUE_SEARCH;
    10041018
    10051019    switch (pReportRec->ExceptionNum)
     
    10331047            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
    10341048        break;
    1035 
    1036         default:
    1037              break;
    10381049    }
    10391050
    1040     return (XCPT_CONTINUE_SEARCH);
     1051    return XCPT_CONTINUE_SEARCH;
    10411052}
    10421053
Note: See TracChangeset for help on using the changeset viewer.