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