Changeset 1341 for trunk/av2.c


Ignore:
Timestamp:
Dec 14, 2008, 11:18:26 PM (17 years ago)
Author:
Steven Levine
Message:

Ticket 26: add thread 1 exception handler support to applets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/av2.c

    r1238 r1341  
    1212  23 Sep 07 SHL Get rid of statics
    1313  17 Sep 08 JBS Convert to use of wrapped DosFind... (i.e. xDosFind...)
     14  14 Dec 08 SHL Add exception handler support
    1415
    1516***********************************************************************/
    1617
    17 #include <stdlib.h>
     18#include <stdlib.h>                     // getenv
    1819#include <string.h>
    1920
     
    2122#define INCL_WIN
    2223#define INCL_LONGLONG
     24#define INCL_DOSEXCEPTIONS              // XCTP_...
     25#define INCL_DOSERRORS                  // NO_ERROR
    2326
    2427#include "dll\fm3dll.h"
    25 #include "dll\mainwnd.h"                // Data declaration(s)
    26 #include "dll\init.h"                   // Data declaration(s)
    27 #include "dll\notebook.h"               // Data declaration(s)
     28#include "dll\mainwnd.h"                // hwndBubble
     29#include "dll\notebook.h"               // appname hwndHelp
    2830#include "dll\arccnrs.h"
    2931#include "dll\fm3str.h"
     
    3537#include "dll\dirs.h"                   // switch_to
    3638#include "dll\viewer.h"                 // StartMLEEditor
    37 #include "dll\getnames.h"                       // insert_filename
     39#include "dll\getnames.h"               // insert_filename
    3840#include "dll\copyf.h"                  // unlinkf
    3941#include "dll\init.h"                   // InitFM3DLL
    4042#include "dll\valid.h"                  // IsFile
    4143#include "dll\wrappers.h"               // xDosFind...
     44#include "dll\errutil.h"                // Error reporting
     45#include "dll\excputil.h"               // Exception handlers
     46
     47static PSZ pszSrcFile = __FILE__;
    4248
    4349HMTX av2Sem;
     
    97103  HMQ hmq;
    98104  QMSG qmsg;
    99   HWND hwndFrame = (HWND) 0;
    100   static CHAR fullname[CCHMAXPATH];     // 23 Sep 07 SHL fixme to not be static
    101   CHAR *thisarg = NULL;
    102   INT x;
    103 
    104   *fullname = 0;
     105  HWND hwndFrame = 0;
     106  CHAR fullname[CCHMAXPATH] = { 0 };    // 14 Dec 08 SHL was static
     107  PSZ thisarg = NULL;
     108  UINT x;
     109  APIRET regRet;
     110  EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
     111
    105112  strcpy(appname, "AV/2");
    106113  fAmAV2 = TRUE;
    107114  DosError(FERR_DISABLEHARDERR);
     115
     116  regRec.ExceptionHandler = HandleException;
     117  regRet = DosSetExceptionHandler(&regRec);
     118  if (regRet != NO_ERROR) {
     119    DbgMsg(pszSrcFile, __LINE__,
     120           "DosSetExceptionHandler failed with error %u", regRet);
     121  }
     122
    108123  for (x = 1; x < argc; x++) {
    109124    if (!strchr("/;,`\'", *argv[x]) &&
     
    116131    }
    117132  }
     133
    118134  DosExitList(EXLST_ADD, deinit);
     135
    119136  if (DosOpenMutexSem("\\SEM32\\AV2", &av2Sem))
    120137    DosCreateMutexSem("\\SEM32\\AV2", &av2Sem, DC_SEM_SHARED, FALSE);
     138
    121139  if (thisarg) {
    122140    if (DosQueryPathInfo(thisarg,
     
    149167    }
    150168  }
     169
    151170  hab = WinInitialize(0);
    152171  if (hab) {
Note: See TracChangeset for help on using the changeset viewer.