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

Last change on this file since 99 was 99, checked in by phaller, 26 years ago

Add: added cvs variable $Id$ to source files.

File size: 3.2 KB
Line 
1/* $Id: winexe.cpp,v 1.3 1999-06-10 19:09:04 phaller Exp $ */
2
3/*
4 *
5 * Project Odin Software License can be found in LICENSE.TXT
6 *
7 */
8/*
9 * Win32 exe class
10 *
11 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
12 *
13 */
14#define INCL_DOSFILEMGR /* File Manager values */
15#define INCL_DOSERRORS /* DOS Error values */
16#define INCL_DOSPROCESS /* DOS Process values */
17#define INCL_DOSMISC /* DOS Miscellanous values */
18#define INCL_WIN
19#include <os2.h>
20#include <stdio.h>
21#include <string.h>
22#include <stdlib.h>
23#include <iostream.h>
24#include <fstream.h>
25#include "misc.h"
26#include "nameid.h"
27#include "win32type.h"
28#include <winexe.h>
29#include "wprocess.h"
30#include "pefile.h"
31#include "cio.h"
32#include "console2.h"
33
34Win32Exe *WinExe = NULL;
35
36//******************************************************************************
37//******************************************************************************
38Win32Exe::Win32Exe(char *szFileName) : Win32Image(szFileName), fConsoleApp(FALSE),
39 cmdline(NULL), OS2InstanceHandle(-1)
40{
41 fConsoleApp = (oh.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI);
42 WinExe = this;
43
44 dprintf(("Win32Exe ctor: %s", szFileName));
45
46 HMInitialize(); /* store standard handles within HandleManager */
47 dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
48 if(fConsoleApp) {
49 dprintf(("Console application!\n"));
50
51 APIRET rc = ConsoleInit(); /* initialize console subsystem */
52 if (rc != NO_ERROR) /* check for errors */
53 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
54 }
55}
56//******************************************************************************
57//******************************************************************************
58Win32Exe::Win32Exe(HINSTANCE hinstance, int NameTableId, int Win32TableId) :
59 Win32Image(hinstance, NameTableId, Win32TableId),
60 fConsoleApp(FALSE), cmdline(NULL), OS2InstanceHandle(-1)
61{
62 HMInitialize(); /* store standard handles within HandleManager */
63 dprintf(("KERNEL32/WINEXE: HandleManager Initialized.\n"));
64
65 if(GET_CONSOLE(Win32TableId) == 1) {//console app
66 dprintf(("Console application!\n"));
67
68 fConsoleApp = TRUE;
69 APIRET rc = ConsoleInit(); /* initialize console subsystem */
70 if (rc != NO_ERROR) /* check for errors */
71 dprintf(("KERNEL32:Win32Image:Init ConsoleInit failed with %u.\n", rc));
72 }
73 WinExe = this;
74}
75//******************************************************************************
76//******************************************************************************
77Win32Exe::~Win32Exe()
78{
79 Win32Dll::deleteAll();
80 WinExe = NULL;
81}
82//******************************************************************************
83//******************************************************************************
84ULONG Win32Exe::start()
85{
86 if(getenv("WIN32_IOPL2")) {
87 io_init1();
88 }
89 dprintf(("Start executable %X\n", WinExe));
90
91 fExeStarted = TRUE;
92 return ((WIN32EXEENTRY)entryPoint)();
93}
94//******************************************************************************
95//******************************************************************************
96
Note: See TracBrowser for help on using the repository browser.