source: trunk/undel.c@ 1341

Last change on this file since 1341 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.1 KB
Line 
1
2/***********************************************************************
3
4 $Id: undel.c 1341 2008-12-14 22:18:26Z stevenhl $
5
6 File undelete applet
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2007, 2008 Steven H. Levine
10
11 23 Sep 07 SHL Sync with standards
12 23 Sep 07 SHL Get rid of statics
13 14 Dec 08 SHL Add exception handler support
14
15***********************************************************************/
16
17#include <string.h>
18
19#define INCL_DOS
20#define INCL_DOSEXCEPTIONS // XCTP_...
21#define INCL_DOSERRORS // NO_ERROR
22
23#include "dll\fm3dll.h"
24#include "dll\mainwnd.h" // FM3ModHandle
25#include "dll\fm3dlg.h"
26#include "dll\undel.h" // UndeleteDlgProc
27#include "dll\init.h" // InitFM3DLL
28#include "dll\valid.h" // MakeValidDir
29#include "dll\dirs.h" // save_dir
30#include "dll\errutil.h" // Error reporting
31#include "dll\excputil.h" // Exception handlers
32
33static PSZ pszSrcFile = __FILE__;
34
35int main(int argc, char *argv[])
36{
37 HAB hab;
38 HMQ hmq;
39 FILESTATUS3 fs;
40 CHAR fullname[CCHMAXPATH];
41 PSZ thisarg = NULL;
42 UINT x;
43 APIRET regRet;
44 EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL };
45
46 DosError(FERR_DISABLEHARDERR);
47
48 regRec.ExceptionHandler = HandleException;
49 regRet = DosSetExceptionHandler(&regRec);
50 if (regRet != NO_ERROR) {
51 DbgMsg(pszSrcFile, __LINE__,
52 "DosSetExceptionHandler failed with error %u", regRet);
53 }
54
55 for (x = 1; x < argc; x++) {
56 if (!strchr("/;,`\'", *argv[x]) && !thisarg) {
57 thisarg = argv[x];
58 break;
59 }
60 }
61 if (!thisarg) {
62 thisarg = fullname;
63 save_dir(fullname);
64 }
65 DosError(FERR_DISABLEHARDERR);
66 if (thisarg && !DosQueryPathInfo(thisarg, FIL_STANDARD, &fs, sizeof(fs))) {
67 if (DosQueryPathInfo(thisarg,
68 FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
69 strcpy(fullname, thisarg);
70 hab = WinInitialize(0);
71 if (hab) {
72 hmq = WinCreateMsgQueue(hab, 256);
73 if (hmq) {
74 if (InitFM3DLL(hab, argc, argv)) {
75 MakeValidDir(fullname);
76 WinDlgBox(HWND_DESKTOP,
77 HWND_DESKTOP,
78 UndeleteDlgProc,
79 FM3ModHandle,
80 UNDEL_FRAME,
81 fullname);
82 }
83 DosSleep(250);
84 WinDestroyMsgQueue(hmq);
85 }
86 WinTerminate(hab);
87 }
88 }
89 else
90 DosBeep(250, 100);
91 return 0;
92}
Note: See TracBrowser for help on using the repository browser.