source: trunk/src/kernel32/winexebase.cpp@ 1570

Last change on this file since 1570 was 956, checked in by sandervl, 26 years ago

Rewrite for new win32 image classes

File size: 2.6 KB
Line 
1/* $Id: winexebase.cpp,v 1.1 1999-09-15 23:39:07 sandervl Exp $ */
2
3/*
4 * Win32 exe base class
5 *
6 * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
7 *
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12#define INCL_DOSFILEMGR /* File Manager values */
13#define INCL_DOSERRORS /* DOS Error values */
14#define INCL_DOSPROCESS /* DOS Process values */
15#define INCL_DOSMISC /* DOS Miscellanous values */
16#define INCL_WIN
17#include <os2wrap.h> //Odin32 OS/2 api wrappers
18#include <stdio.h>
19#include <string.h>
20#include <stdlib.h>
21#include <iostream.h>
22#include <fstream.h>
23#include <misc.h>
24#include <win32type.h>
25#include <winexebase.h>
26#include <windllbase.h>
27#include <wprocess.h>
28#include <pefile.h>
29#include "exceptions.h"
30#include "exceptutil.h"
31#include "cio.h"
32
33#include "conwin.h" // Windows Header for console only
34#include "console.h"
35
36BOOL fExeStarted = FALSE;
37Win32ExeBase *WinExe = NULL;
38
39//******************************************************************************
40//******************************************************************************
41Win32ExeBase::Win32ExeBase(HINSTANCE hInstance)
42 : Win32ImageBase(hInstance),
43 fConsoleApp(FALSE),
44 cmdline(NULL)
45{
46 WinExe = this;
47}
48//******************************************************************************
49//******************************************************************************
50Win32ExeBase::~Win32ExeBase()
51{
52 Win32DllBase::deleteAll();
53 WinExe = NULL;
54}
55//******************************************************************************
56//******************************************************************************
57ULONG Win32ExeBase::start()
58{
59 WINEXCEPTION_FRAME exceptFrame;
60 ULONG rc;
61
62 if(getenv("WIN32_IOPL2")) {
63 io_init1();
64 }
65 dprintf(("Start executable %X\n", WinExe));
66
67 fExeStarted = TRUE;
68
69 //Allocate TLS index for this module
70 tlsAlloc();
71 tlsAttachThread(); //setup TLS (main thread)
72
73 //Note: The Win32 exception structure references by FS:[0] is the same
74 // in OS/2
75 OS2SetExceptionHandler((void *)&exceptFrame);
76
77 SetWin32TIB();
78 rc = ((WIN32EXEENTRY)entryPoint)();
79 RestoreOS2TIB();
80
81 OS2UnsetExceptionHandler((void *)&exceptFrame);
82
83 return rc;
84}
85//******************************************************************************
86//******************************************************************************
87BOOL Win32ExeBase::isDll()
88{
89 return FALSE;
90}
91//******************************************************************************
92//******************************************************************************
Note: See TracBrowser for help on using the repository browser.