source: trunk/src/kernel32/winexe.cpp@ 120

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

Include os2wrap.h instead of os2.h

File size: 3.4 KB
Line 
1/* $Id: winexe.cpp,v 1.6 1999-06-19 10:54:43 sandervl Exp $ */
2
3/*
4 * Win32 exe class
5 *
6 * Copyright 1998 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 "nameid.h"
25#include "win32type.h"
26#include <winexe.h>
27#include "wprocess.h"
28#include "pefile.h"
29#include "cio.h"
30
31#include "conwin.h" // Windows Header for console only
32#include "console.h"
33#include "handlemanager.h"
34
35
36Win32Exe *WinExe = NULL;
37
38//******************************************************************************
39//******************************************************************************
40Win32Exe::Win32Exe(char *szFileName) : Win32Image(szFileName), fConsoleApp(FALSE),
41 cmdline(NULL), OS2InstanceHandle(-1)
42{
43 fConsoleApp = (oh.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI);
44 WinExe = this;
45
46 dprintf(("Win32Exe ctor: %s", szFileName));
47
48 HMInitialize(); /* store standard handles within HandleManager */
49 dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
50 if(fConsoleApp) {
51 dprintf(("Console application!\n"));
52
53 APIRET rc = iConsoleInit(); /* initialize console subsystem */
54 if (rc != NO_ERROR) /* check for errors */
55 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
56 }
57}
58//******************************************************************************
59//******************************************************************************
60Win32Exe::Win32Exe(HINSTANCE hinstance, int NameTableId, int Win32TableId) :
61 Win32Image(hinstance, NameTableId, Win32TableId),
62 fConsoleApp(FALSE), cmdline(NULL), OS2InstanceHandle(-1)
63{
64 HMInitialize(); /* store standard handles within HandleManager */
65 dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
66
67 if(GET_CONSOLE(Win32TableId) == 1) {//console app
68 dprintf(("Console application!\n"));
69
70 fConsoleApp = TRUE;
71 APIRET rc = iConsoleInit(); /* initialize console subsystem */
72 if (rc != NO_ERROR) /* check for errors */
73 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
74 }
75 WinExe = this;
76}
77//******************************************************************************
78//******************************************************************************
79Win32Exe::~Win32Exe()
80{
81 Win32Dll::deleteAll();
82 WinExe = NULL;
83}
84//******************************************************************************
85//******************************************************************************
86ULONG Win32Exe::start()
87{
88 if(getenv("WIN32_IOPL2")) {
89 io_init1();
90 }
91 dprintf(("Start executable %X\n", WinExe));
92
93 fExeStarted = TRUE;
94 return ((WIN32EXEENTRY)entryPoint)();
95}
96//******************************************************************************
97//******************************************************************************
98
Note: See TracBrowser for help on using the repository browser.