| 1 |  | 
|---|
| 2 | /*********************************************************************** | 
|---|
| 3 |  | 
|---|
| 4 | $Id: killproc.c 1341 2008-12-14 22:18:26Z stevenhl $ | 
|---|
| 5 |  | 
|---|
| 6 | Process killer applet | 
|---|
| 7 |  | 
|---|
| 8 | Copyright (c) 1993-98 M. Kimes | 
|---|
| 9 | Copyright (c) 2008 Steven H.Levine | 
|---|
| 10 |  | 
|---|
| 11 | 05 Jan 08 SHL Sync | 
|---|
| 12 | 14 Dec 08 SHL Add exception handler support | 
|---|
| 13 |  | 
|---|
| 14 | ***********************************************************************/ | 
|---|
| 15 |  | 
|---|
| 16 | #define INCL_DOS | 
|---|
| 17 | #define INCL_WIN | 
|---|
| 18 | #define INCL_DOSEXCEPTIONS              // XCTP_... | 
|---|
| 19 | #define INCL_DOSERRORS                  // NO_ERROR | 
|---|
| 20 |  | 
|---|
| 21 | #include "dll\fm3dll.h" | 
|---|
| 22 | #include "dll\mainwnd.h"                // FM3ModHandle | 
|---|
| 23 | #include "dll\fm3dlg.h" | 
|---|
| 24 | #include "dll\init.h"                   // InitFM3DLL | 
|---|
| 25 | #include "dll\killproc.h"               // KillDlgProc | 
|---|
| 26 | #include "dll\errutil.h"                // Error reporting | 
|---|
| 27 | #include "dll\excputil.h"               // Exception handlers | 
|---|
| 28 |  | 
|---|
| 29 | static PSZ pszSrcFile = __FILE__; | 
|---|
| 30 |  | 
|---|
| 31 | int main(int argc, char *argv[]) | 
|---|
| 32 | { | 
|---|
| 33 | HAB hab; | 
|---|
| 34 | HMQ hmq; | 
|---|
| 35 | APIRET regRet; | 
|---|
| 36 | EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL }; | 
|---|
| 37 |  | 
|---|
| 38 | DosError(FERR_DISABLEHARDERR); | 
|---|
| 39 |  | 
|---|
| 40 | regRec.ExceptionHandler = HandleException; | 
|---|
| 41 | regRet = DosSetExceptionHandler(®Rec); | 
|---|
| 42 | if (regRet != NO_ERROR) { | 
|---|
| 43 | DbgMsg(pszSrcFile, __LINE__, | 
|---|
| 44 | "DosSetExceptionHandler failed with error %u", regRet); | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | hab = WinInitialize(0); | 
|---|
| 48 | if (hab) { | 
|---|
| 49 | hmq = WinCreateMsgQueue(hab, 256); | 
|---|
| 50 | if (hmq) { | 
|---|
| 51 | if (InitFM3DLL(hab, argc, argv)) { | 
|---|
| 52 | WinDlgBox(HWND_DESKTOP, | 
|---|
| 53 | HWND_DESKTOP, KillDlgProc, FM3ModHandle, KILL_FRAME, NULL); | 
|---|
| 54 | } | 
|---|
| 55 | DosSleep(250L); | 
|---|
| 56 | WinDestroyMsgQueue(hmq); | 
|---|
| 57 | } | 
|---|
| 58 | WinTerminate(hab); | 
|---|
| 59 | } | 
|---|
| 60 | return 0; | 
|---|
| 61 | } | 
|---|