| [2] | 1 | 
 | 
|---|
| [862] | 2 | /***********************************************************************
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 |   $Id: undel.c 1189 2008-09-10 21:58:57Z jbs $
 | 
|---|
 | 5 | 
 | 
|---|
 | 6 |   File undelete applet
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 |   Copyright (c) 1993-98 M. Kimes
 | 
|---|
 | 9 |   Copyright (c) 2007 Steven H. Levine
 | 
|---|
 | 10 | 
 | 
|---|
 | 11 |   23 Sep 07 SHL Sync with standards
 | 
|---|
 | 12 |   23 Sep 07 SHL Get rid of statics
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | ***********************************************************************/
 | 
|---|
 | 15 | 
 | 
|---|
| [2] | 16 | #include <string.h>
 | 
|---|
| [862] | 17 | 
 | 
|---|
 | 18 | #define INCL_DOS
 | 
|---|
 | 19 | 
 | 
|---|
| [1189] | 20 | #include "dll\fm3dll.h"
 | 
|---|
| [907] | 21 | #include "dll\fm3dlg.h"
 | 
|---|
| [1189] | 22 | #include "dll\undel.h"                  // UndeleteDlgProc
 | 
|---|
 | 23 | #include "dll\init.h"                   // InitFM3DLL
 | 
|---|
 | 24 | #include "dll\valid.h"                  // MakeValidDir
 | 
|---|
 | 25 | #include "dll\dirs.h"                   // save_dir
 | 
|---|
| [2] | 26 | 
 | 
|---|
| [551] | 27 | int main(int argc, char *argv[])
 | 
|---|
 | 28 | {
 | 
|---|
 | 29 |   HAB hab;
 | 
|---|
 | 30 |   HMQ hmq;
 | 
|---|
| [844] | 31 |   FILESTATUS3 fs;
 | 
|---|
| [862] | 32 |   CHAR fullname[CCHMAXPATH];
 | 
|---|
| [551] | 33 |   CHAR *thisarg = NULL;
 | 
|---|
 | 34 |   INT x;
 | 
|---|
| [2] | 35 | 
 | 
|---|
 | 36 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [551] | 37 |   for (x = 1; x < argc; x++) {
 | 
|---|
 | 38 |     if (!strchr("/;,`\'", *argv[x]) && !thisarg) {
 | 
|---|
| [2] | 39 |       thisarg = argv[x];
 | 
|---|
 | 40 |       break;
 | 
|---|
 | 41 |     }
 | 
|---|
 | 42 |   }
 | 
|---|
| [551] | 43 |   if (!thisarg) {
 | 
|---|
| [2] | 44 |     thisarg = fullname;
 | 
|---|
 | 45 |     save_dir(fullname);
 | 
|---|
 | 46 |   }
 | 
|---|
 | 47 |   DosError(FERR_DISABLEHARDERR);
 | 
|---|
| [844] | 48 |   if (thisarg && !DosQueryPathInfo(thisarg, FIL_STANDARD, &fs, sizeof(fs))) {
 | 
|---|
| [551] | 49 |     if (DosQueryPathInfo(thisarg,
 | 
|---|
 | 50 |                          FIL_QUERYFULLNAME, fullname, sizeof(fullname)))
 | 
|---|
 | 51 |       strcpy(fullname, thisarg);
 | 
|---|
| [2] | 52 |     hab = WinInitialize(0);
 | 
|---|
| [551] | 53 |     if (hab) {
 | 
|---|
 | 54 |       hmq = WinCreateMsgQueue(hab, 256);
 | 
|---|
 | 55 |       if (hmq) {
 | 
|---|
 | 56 |         if (InitFM3DLL(hab, argc, argv)) {
 | 
|---|
 | 57 |           MakeValidDir(fullname);
 | 
|---|
 | 58 |           WinDlgBox(HWND_DESKTOP,
 | 
|---|
 | 59 |                     HWND_DESKTOP,
 | 
|---|
 | 60 |                     UndeleteDlgProc,
 | 
|---|
| [862] | 61 |                     FM3ModHandle,
 | 
|---|
 | 62 |                     UNDEL_FRAME,
 | 
|---|
 | 63 |                     fullname);
 | 
|---|
| [551] | 64 |         }
 | 
|---|
| [844] | 65 |         DosSleep(250);
 | 
|---|
| [551] | 66 |         WinDestroyMsgQueue(hmq);
 | 
|---|
| [2] | 67 |       }
 | 
|---|
 | 68 |       WinTerminate(hab);
 | 
|---|
 | 69 |     }
 | 
|---|
 | 70 |   }
 | 
|---|
 | 71 |   else
 | 
|---|
| [551] | 72 |     DosBeep(250, 100);
 | 
|---|
| [2] | 73 |   return 0;
 | 
|---|
 | 74 | }
 | 
|---|