ReactOS  0.4.14-dev-342-gdc047f9
process.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GPLv2 - See COPYING in the top level directory
3  * PROJECT: ReactOS Virtual DOS Machine
4  * FILE: subsystems/mvdm/ntvdm/dos/dos32krnl/process.h
5  * PURPOSE: DOS32 Processes
6  * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 #pragma once
10 
11 /* DEFINITIONS ****************************************************************/
12 
13 #define DOS_CMDLINE_LENGTH 127
14 #define DOS_PROGRAM_NAME_TAG 0x0001
15 
16 #define SEGMENT_TO_PSP(seg) ((PDOS_PSP)SEG_OFF_TO_PTR((seg), 0))
17 
18 typedef enum
19 {
21  DOS_LOAD_ONLY = 0x01,
24 
25 #pragma pack(push, 1)
26 
27 typedef struct _DOS_PSP
28 {
29  BYTE Exit[2];
50 } DOS_PSP, *PDOS_PSP;
51 
52 typedef struct _DOS_EXEC_PARAM_BLOCK
53 {
54  union
55  {
56  struct
57  {
58  /* Input variables */
63 
64  /* Output variables */
67  };
68 
69  struct
70  {
73  } Overlay;
74  };
76 
77 typedef struct _DOS_REGISTER_STATE
78 {
79  WORD AX, BX, CX, DX, SI, DI, BP, DS, ES;
80 // WORD IP, CS, Flags; // They are supposed to be already
81  // pushed on stack by the DOS caller.
83 
84 #pragma pack(pop)
85 
86 /* FUNCTIONS ******************************************************************/
87 
88 VOID DosClonePsp(WORD DestSegment, WORD SourceSegment);
89 VOID DosCreatePsp(WORD Segment, WORD ProgramSize);
91 
93 (
94  IN DOS_EXEC_TYPE LoadType,
95  IN LPBYTE ExeBuffer,
96  IN DWORD ExeBufferSize,
97  IN LPCSTR ExePath,
99  IN LPCSTR CommandLine OPTIONAL,
101  IN DWORD ReturnAddress OPTIONAL
102 );
103 
105 (
106  IN DOS_EXEC_TYPE LoadType,
107  IN LPCSTR ExecutablePath,
109  IN LPCSTR CommandLine OPTIONAL,
111  IN DWORD ReturnAddress OPTIONAL
112 );
113 
115 (
116  LPCSTR ProgramName,
118  IN DWORD ReturnAddress OPTIONAL
119 );
120 
121 VOID DosTerminateProcess(WORD Psp, BYTE ReturnCode, WORD KeepResident);
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:45
#define IN
Definition: typedefs.h:38
DWORD LastStack
Definition: process.h:38
struct _DOS_REGISTER_STATE DOS_REGISTER_STATE
DOS_EXEC_TYPE
Definition: process.h:18
char CHAR
Definition: xmlstorage.h:175
#define DOS_CMDLINE_LENGTH
Definition: process.h:13
VOID DosTerminateProcess(WORD Psp, BYTE ReturnCode, WORD KeepResident)
Definition: process.c:873
BYTE HandleTable[20]
Definition: process.h:36
DWORD DosLoadExecutableInternal(IN DOS_EXEC_TYPE LoadType, IN LPBYTE ExeBuffer, IN DWORD ExeBufferSize, IN LPCSTR ExePath, IN PDOS_EXEC_PARAM_BLOCK Parameters, IN LPCSTR CommandLine OPTIONAL, IN LPCSTR Environment OPTIONAL, IN DWORD ReturnAddress OPTIONAL)
Definition: process.c:327
BYTE CommandLineSize
Definition: process.h:48
BYTE Reserved3[9]
Definition: process.h:46
BYTE Reserved0[6]
Definition: process.h:31
unsigned char * LPBYTE
Definition: typedefs.h:52
WORD LastParagraph
Definition: process.h:30
CHAR CommandLine[DOS_CMDLINE_LENGTH]
Definition: process.h:49
DWORD PreviousPsp
Definition: process.h:41
const char * LPCSTR
Definition: xmlstorage.h:183
WORD HandleTableSize
Definition: process.h:39
_Inout_ PVOID Segment
Definition: exfuncs.h:893
DWORD HandleTablePtr
Definition: process.h:40
Definition: dos.h:53
struct _DOS_PSP DOS_PSP
DOS_FCB Fcb
Definition: process.h:47
unsigned short WORD
Definition: ntddk_ex.h:93
struct _DOS_EXEC_PARAM_BLOCK * PDOS_EXEC_PARAM_BLOCK
unsigned long DWORD
Definition: ntddk_ex.h:95
BYTE Exit[2]
Definition: process.h:29
WORD DosCreateProcess(LPCSTR ProgramName, PDOS_EXEC_PARAM_BLOCK Parameters, IN DWORD ReturnAddress OPTIONAL)
DWORD TerminateAddress
Definition: process.h:32
struct _DOS_EXEC_PARAM_BLOCK DOS_EXEC_PARAM_BLOCK
BYTE Reserved2[14]
Definition: process.h:44
_In_ PPCI_DEVICE_PRESENCE_PARAMETERS Parameters
Definition: iotypes.h:872
WORD ParentPsp
Definition: process.h:35
unsigned char BYTE
Definition: mem.h:68
VOID DosCreatePsp(WORD Segment, WORD ProgramSize)
Definition: process.c:270
VOID DosClonePsp(WORD DestSegment, WORD SourceSegment)
Definition: process.c:243
VOID DosSetProcessContext(WORD Segment)
Definition: process.c:321
DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType, IN LPCSTR ExecutablePath, IN PDOS_EXEC_PARAM_BLOCK Parameters, IN LPCSTR CommandLine OPTIONAL, IN LPCSTR Environment OPTIONAL, IN DWORD ReturnAddress OPTIONAL)
Definition: process.c:695
DWORD BreakAddress
Definition: process.h:33
BYTE FarCall[3]
Definition: process.h:45
struct _DOS_REGISTER_STATE * PDOS_REGISTER_STATE
struct _DOS_PSP * PDOS_PSP
WORD DosVersion
Definition: process.h:43
DWORD CriticalAddress
Definition: process.h:34
DWORD Reserved1
Definition: process.h:42
struct _DOS_EXEC_PARAM_BLOCK::@4078::@4082 Overlay
WORD EnvBlock
Definition: process.h:37
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68