[NTVDM]
[reactos.git] / reactos / subsystems / mvdm / ntvdm / dos / dos32krnl / dos.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: dos/dos32krnl/dos.h
5 * PURPOSE: DOS32 Kernel
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _DOS_H_
10 #define _DOS_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "device.h"
15
16 /**/ #include "int32.h" /**/
17
18 /* DEFINES ********************************************************************/
19
20 //
21 // We are DOS 5.00 (reported by INT 21h, AH=30h)
22 // and DOS 5.50 (reported by INT 21h, AX=3306h) for Windows NT Compatibility
23 //
24 #define DOS_VERSION MAKEWORD(5, 00)
25 #define NTDOS_VERSION MAKEWORD(5, 50)
26
27 #define DOS_CONFIG_PATH L"%SystemRoot%\\system32\\CONFIG.NT"
28 #define DOS_COMMAND_INTERPRETER L"%SystemRoot%\\system32\\COMMAND.COM /k %SystemRoot%\\system32\\AUTOEXEC.NT"
29 #define FIRST_MCB_SEGMENT 0x1000
30 #define USER_MEMORY_SIZE (0x9FFE - FIRST_MCB_SEGMENT)
31 #define SYSTEM_PSP 0x08
32 #define SYSTEM_ENV_BLOCK 0x800
33 #define DOS_DATA_SEGMENT 0xA0
34 #define MASTER_SFT_OFFSET 0x100
35
36 #define INVALID_DOS_HANDLE 0xFFFF
37 #define DOS_INPUT_HANDLE 0
38 #define DOS_OUTPUT_HANDLE 1
39 #define DOS_ERROR_HANDLE 2
40
41 #define DOS_SFT_SIZE 255
42 #define UMB_START_SEGMENT 0xC000
43 #define UMB_END_SEGMENT 0xDFFF
44 #define DOS_ALLOC_HIGH 0x40
45 #define DOS_ALLOC_HIGH_LOW 0x80
46 #define DOS_DIR_LENGTH 64
47 #define NUM_DRIVES ('Z' - 'A' + 1)
48 #define DOS_CHAR_ATTRIBUTE 0x07
49
50 /* 16 MB of EMS memory */
51 #define EMS_TOTAL_PAGES 1024
52
53 #pragma pack(push, 1)
54
55 typedef struct _DOS_FCB
56 {
57 BYTE DriveNumber;
58 CHAR FileName[8];
59 CHAR FileExt[3];
60 WORD BlockNumber;
61 WORD RecordSize;
62 DWORD FileSize;
63 WORD LastWriteDate;
64 WORD LastWriteTime;
65 BYTE Reserved[8];
66 BYTE BlockRecord;
67 BYTE RecordNumber[3];
68 } DOS_FCB, *PDOS_FCB;
69
70 typedef struct _DOS_SYSVARS
71 {
72 DWORD OemHandler;
73 WORD Int21hReturn;
74 WORD ShareRetryCount;
75 WORD ShareRetryDelay;
76 DWORD DiskBuffer;
77 WORD UnreadConInput;
78 WORD FirstMcb;
79
80 /* This is where the SYSVARS really start */
81 DWORD FirstDpb;
82 DWORD FirstSft;
83 DWORD ActiveClock;
84 DWORD ActiveCon;
85 BYTE Reserved0[6];
86 DWORD CurrentDirs;
87 BYTE Reserved1[6];
88 BYTE NumBlockDevices;
89 BYTE NumLocalDrives;
90 DOS_DRIVER NullDevice;
91 BYTE NullDriverRoutine[7];
92 } DOS_SYSVARS, *PDOS_SYSVARS;
93
94 typedef struct _DOS_INPUT_BUFFER
95 {
96 BYTE MaxLength;
97 BYTE Length;
98 CHAR Buffer[ANYSIZE_ARRAY];
99 } DOS_INPUT_BUFFER, *PDOS_INPUT_BUFFER;
100
101 typedef struct _DOS_FIND_FILE_BLOCK
102 {
103 CHAR DriveLetter;
104 CHAR Pattern[11];
105 UCHAR AttribMask;
106 DWORD Unused;
107 HANDLE SearchHandle;
108
109 /* The following part of the structure is documented */
110 UCHAR Attributes;
111 WORD FileTime;
112 WORD FileDate;
113 DWORD FileSize;
114 CHAR FileName[13];
115 } DOS_FIND_FILE_BLOCK, *PDOS_FIND_FILE_BLOCK;
116
117 typedef struct _DOS_COUNTRY_CODE_BUFFER
118 {
119 WORD TimeFormat;
120 WORD CurrencySymbol;
121 WORD ThousandSep;
122 WORD DecimalSep;
123 } DOS_COUNTRY_CODE_BUFFER, *PDOS_COUNTRY_CODE_BUFFER;
124
125 #pragma pack(pop)
126
127 /* VARIABLES ******************************************************************/
128
129 extern BOOLEAN DoEcho;
130 extern DWORD DiskTransferArea;
131 extern WORD DosErrorLevel;
132 extern WORD DosLastError;
133 extern PDOS_SYSVARS SysVars;
134
135 /* FUNCTIONS ******************************************************************/
136
137 extern CALLBACK16 DosContext;
138 #define RegisterDosInt32(IntNumber, IntHandler) \
139 do { \
140 DosContext.NextOffset += RegisterInt32(MAKELONG(DosContext.NextOffset, \
141 DosContext.Segment), \
142 (IntNumber), (IntHandler), NULL); \
143 } while(0);
144
145 /*
146 * DOS BIOS Functions
147 * See bios.c
148 */
149 CHAR DosReadCharacter(WORD FileHandle);
150 BOOLEAN DosCheckInput(VOID);
151 VOID DosPrintCharacter(WORD FileHandle, CHAR Character);
152
153 BOOLEAN DosBIOSInitialize(VOID);
154 VOID ConDrvInitialize(VOID);
155 VOID ConDrvCleanup(VOID);
156
157 /*
158 * DOS Kernel Functions
159 * See dos.c
160 */
161
162 BOOLEAN DosKRNLInitialize(VOID);
163
164 #endif // _DOS_H_
165
166 /* EOF */