source: trunk/src/kernel32/console/vio32VioServ.cpp

Last change on this file was 5024, checked in by sandervl, 25 years ago

added preliminary console code

File size: 1.1 KB
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#define INCL_DOS
5#define INCL_PM
6#define INCL_WIN
7#define INCL_VIO
8#define INCL_SUB
9#define INCL_DOSERRORS
10#include <os2.h>
11#include "vio32.h"
12
13extern "C" {
14 //
15 BOOL EXPENTRY InstallHook();
16 //
17 BOOL EXPENTRY DeInstallHook();
18}
19
20
21ULONG _System MyTermHandler( PEXCEPTIONREPORTRECORD p1,
22 PEXCEPTIONREGISTRATIONRECORD p2,
23 PCONTEXTRECORD p3,
24 PVOID pv ){
25 switch( p1->ExceptionNum) {
26 case XCPT_PROCESS_TERMINATE:
27 case XCPT_ASYNC_PROCESS_TERMINATE: {
28printf("termination handler called \n");
29 DeInstallHook();
30 }
31 default:;
32 }
33
34 return XCPT_CONTINUE_SEARCH; /* Exception not resolved... */
35}
36
37
38void main(int argc, char **argv){
39
40 EXCEPTIONREGISTRATIONRECORD RegRec;
41 RegRec.prev_structure = NULL;
42 RegRec.ExceptionHandler = (ERR)MyTermHandler;
43
44
45 DosSetExceptionHandler(&RegRec);
46 InstallHook();
47
48 DosSleep(-1);
49
50 DeInstallHook();
51 DosUnsetExceptionHandler(&RegRec);
52
53}
Note: See TracBrowser for help on using the repository browser.