source: trunk/eas.c

Last change on this file was 1341, checked in by Steven Levine, 17 years ago

Ticket 26: add thread 1 exception handler support to applets

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
RevLine 
[22]1
[52]2/***********************************************************************
[22]3
[52]4 $Id: eas.c 1341 2008-12-14 22:18:26Z stevenhl $
5
6 EA viewer applet
7
8 Copyright (c) 1993-98 M. Kimes
[1341]9 Copyright (c) 2002, 2008 Steven H.Levine
[52]10
[620]11 16 Oct 02 SHL Reformat
12 08 Feb 03 SHL Free list with free() since we don't
13 allocate list contents
14 08 Apr 07 SHL Minor reformat
[1010]15 10 May 08 SHL Correct compare typo
[1341]16 14 Dec 08 SHL Add exception handler support
[52]17
18***********************************************************************/
19
[2]20#include <string.h>
[754]21
22#define INCL_DOS
23#define INCL_WIN
[1341]24#define INCL_DOSEXCEPTIONS // XCTP_...
25#define INCL_DOSERRORS // NO_ERROR
[754]26
[1176]27#include "dll\fm3dll.h"
[1341]28#include "dll\mainwnd.h" // FM3ModHandle
[907]29#include "dll\fm3dlg.h"
[1341]30#include "dll\makelist.h" // AddToList
[1176]31#include "dll\eas.h" // DisplayEAsProc
32#include "dll\init.h" // InitFM3DLL
33#include "dll\valid.h" // IsFile
[1341]34#include "dll\wrappers.h" // xfree
35#include "dll\getnames.h" // insert_filename
36#include "dll\errutil.h" // Error reporting
37#include "dll\excputil.h" // Exception handlers
[2]38
[1011]39static PSZ pszSrcFile = __FILE__;
40
[52]41int main (int argc,char *argv[])
42{
[754]43 HAB hab;
44 HMQ hmq;
45 CHAR fullname[CCHMAXPATH];
46 CHAR **list = NULL;
[1341]47 UINT x;
48 UINT numfiles = 0;
49 UINT numalloc = 0;
50 APIRET regRet;
51 EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
[2]52
53 DosError(FERR_DISABLEHARDERR);
[1341]54
55 regRec.ExceptionHandler = HandleException;
56 regRet = DosSetExceptionHandler(&regRec);
57 if (regRet != NO_ERROR) {
58 DbgMsg(pszSrcFile, __LINE__,
59 "DosSetExceptionHandler failed with error %u", regRet);
60 }
61
[754]62 for(x = 1; x < argc; x++) {
[620]63 if (!strchr("/;,`\'",*argv[x]) && IsFile(argv[x]) != -1) {
[754]64 if (DosQueryPathInfo(argv[x],
65 FIL_QUERYFULLNAME,fullname,
[620]66 sizeof(fullname)))
[754]67 strcpy(fullname, argv[x]);
[2]68 AddToList(fullname,&list,&numfiles,&numalloc);
69 }
70 }
[1341]71
[2]72 hab = WinInitialize(0);
[620]73 if (hab) {
[2]74 hmq = WinCreateMsgQueue(hab,384);
[620]75 if (hmq) {
76 if (InitFM3DLL(hab,argc,argv)) {
77 if (!list) {
[754]78 strcpy(fullname, "*");
[1011]79 list = xmalloc(sizeof(CHAR *) * 2, pszSrcFile, __LINE__);
[754]80 if (list &&
81 insert_filename(HWND_DESKTOP,fullname,TRUE,FALSE) &&
[1010]82 *fullname && *fullname != '*') {
[1011]83 list[0] = fullname;
84 list[1] = NULL;
[754]85 }
[620]86 }
[754]87 if (list) {
88 WinDlgBox(HWND_DESKTOP,
89 HWND_DESKTOP,
90 DisplayEAsProc,
91 FM3ModHandle,
92 EA_FRAME,
93 (PVOID)list);
94 }
[2]95 }
96 WinDestroyMsgQueue(hmq);
97 }
98 WinTerminate(hab);
99 }
[1039]100 xfree(list, pszSrcFile, __LINE__);
[2]101 return 0;
102}
103
Note: See TracBrowser for help on using the repository browser.