ReactOS 0.4.16-dev-336-gb667d82
dos.h File Reference
#include "device.h"
#include "int32.h"
Include dependency graph for dos.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DOS_FCB
 
struct  _DOS_SYSVARS
 
struct  _DOS_CLOCK_TRANSFER_RECORD
 
struct  _DOS_INPUT_BUFFER
 
struct  _DOS_FIND_FILE_BLOCK
 
struct  _DOS_SDA
 
struct  _DOS_DATA
 
struct  _BIOS_DATA
 

Macros

#define DOS_VERSION   MAKEWORD(5, 00)
 
#define NTDOS_VERSION   MAKEWORD(5, 50)
 
#define DOS_CONFIG_PATH   L"%SystemRoot%\\system32\\CONFIG.NT"
 
#define DOS_COMMAND_INTERPRETER   L"%SystemRoot%\\system32\\COMMAND.COM /k %SystemRoot%\\system32\\AUTOEXEC.NT"
 
#define BIOS_CODE_SEGMENT   0x70
 
#define BIOS_DATA_SEGMENT   0x70
 
#define DOS_CODE_SEGMENT   0x80
 
#define DOS_DATA_SEGMENT   0xA5
 
#define DOS_DATA_OFFSET(x)   FIELD_OFFSET(DOS_DATA, x)
 
#define SYSTEM_ENV_BLOCK   0x600
 
#define SYSTEM_PSP   0x0008
 
#define INVALID_DOS_HANDLE   0xFFFF
 
#define DOS_INPUT_HANDLE   0
 
#define DOS_OUTPUT_HANDLE   1
 
#define DOS_ERROR_HANDLE   2
 
#define DOS_SFT_SIZE   255
 
#define DOS_DIR_LENGTH   64
 
#define NUM_DRIVES   ('Z' - 'A' + 1)
 
#define DOS_CHAR_ATTRIBUTE   0x07
 
#define RegisterDosInt32(IntNumber, IntHandler)
 

Typedefs

typedef struct _DOS_FCB DOS_FCB
 
typedef struct _DOS_FCBPDOS_FCB
 
typedef struct _DOS_SYSVARS DOS_SYSVARS
 
typedef struct _DOS_SYSVARSPDOS_SYSVARS
 
typedef struct _DOS_CLOCK_TRANSFER_RECORD DOS_CLOCK_TRANSFER_RECORD
 
typedef struct _DOS_CLOCK_TRANSFER_RECORDPDOS_CLOCK_TRANSFER_RECORD
 
typedef struct _DOS_INPUT_BUFFER DOS_INPUT_BUFFER
 
typedef struct _DOS_INPUT_BUFFERPDOS_INPUT_BUFFER
 
typedef struct _DOS_FIND_FILE_BLOCK DOS_FIND_FILE_BLOCK
 
typedef struct _DOS_FIND_FILE_BLOCKPDOS_FIND_FILE_BLOCK
 
typedef struct _DOS_SDA DOS_SDA
 
typedef struct _DOS_SDAPDOS_SDA
 
typedef struct _DOS_DATA DOS_DATA
 
typedef struct _DOS_DATAPDOS_DATA
 
typedef struct _BIOS_DATA BIOS_DATA
 
typedef struct _BIOS_DATAPBIOS_DATA
 

Functions

 C_ASSERT (sizeof(BIOS_DATA)==0x100)
 
VOID ConDrvInitialize (VOID)
 
VOID ConDrvCleanup (VOID)
 
CHAR DosReadCharacter (WORD FileHandle, BOOLEAN Echo)
 
BOOLEAN DosCheckInput (VOID)
 
VOID DosPrintCharacter (WORD FileHandle, CHAR Character)
 
BOOLEAN DosBIOSInitialize (VOID)
 
BOOLEAN DosControlBreak (VOID)
 
VOID DosEchoCharacter (CHAR Character)
 
BOOLEAN DosKRNLInitialize (VOID)
 

Variables

PBIOS_DATA BiosData
 
PDOS_DATA DosData
 
PDOS_SYSVARS SysVars
 
PDOS_SDA Sda
 
CALLBACK16 DosContext
 

Macro Definition Documentation

◆ BIOS_CODE_SEGMENT

#define BIOS_CODE_SEGMENT   0x70

Definition at line 30 of file dos.h.

◆ BIOS_DATA_SEGMENT

#define BIOS_DATA_SEGMENT   0x70

Definition at line 31 of file dos.h.

◆ DOS_CHAR_ATTRIBUTE

#define DOS_CHAR_ATTRIBUTE   0x07

Definition at line 49 of file dos.h.

◆ DOS_CODE_SEGMENT

#define DOS_CODE_SEGMENT   0x80

Definition at line 32 of file dos.h.

◆ DOS_COMMAND_INTERPRETER

#define DOS_COMMAND_INTERPRETER   L"%SystemRoot%\\system32\\COMMAND.COM /k %SystemRoot%\\system32\\AUTOEXEC.NT"

Definition at line 28 of file dos.h.

◆ DOS_CONFIG_PATH

#define DOS_CONFIG_PATH   L"%SystemRoot%\\system32\\CONFIG.NT"

Definition at line 27 of file dos.h.

◆ DOS_DATA_OFFSET

#define DOS_DATA_OFFSET (   x)    FIELD_OFFSET(DOS_DATA, x)

Definition at line 35 of file dos.h.

◆ DOS_DATA_SEGMENT

#define DOS_DATA_SEGMENT   0xA5

Definition at line 33 of file dos.h.

◆ DOS_DIR_LENGTH

#define DOS_DIR_LENGTH   64

Definition at line 47 of file dos.h.

◆ DOS_ERROR_HANDLE

#define DOS_ERROR_HANDLE   2

Definition at line 44 of file dos.h.

◆ DOS_INPUT_HANDLE

#define DOS_INPUT_HANDLE   0

Definition at line 42 of file dos.h.

◆ DOS_OUTPUT_HANDLE

#define DOS_OUTPUT_HANDLE   1

Definition at line 43 of file dos.h.

◆ DOS_SFT_SIZE

#define DOS_SFT_SIZE   255

Definition at line 46 of file dos.h.

◆ DOS_VERSION

#define DOS_VERSION   MAKEWORD(5, 00)

Definition at line 24 of file dos.h.

◆ INVALID_DOS_HANDLE

#define INVALID_DOS_HANDLE   0xFFFF

Definition at line 41 of file dos.h.

◆ NTDOS_VERSION

#define NTDOS_VERSION   MAKEWORD(5, 50)

Definition at line 25 of file dos.h.

◆ NUM_DRIVES

#define NUM_DRIVES   ('Z' - 'A' + 1)

Definition at line 48 of file dos.h.

◆ RegisterDosInt32

#define RegisterDosInt32 (   IntNumber,
  IntHandler 
)
Value:
do { \
ASSERT((0x20 <= IntNumber) && (IntNumber <= 0x2F)); \
RegisterInt32(DosContext.TrampolineFarPtr + \
(IntNumber - 0x20) * Int16To32StubSize, \
(IntNumber), (IntHandler), NULL); \
} while(0);
#define NULL
Definition: types.h:112
#define Int16To32StubSize
Definition: int32.h:38
ULONG TrampolineFarPtr
Definition: callback.h:28
ULONG TrampolineSize
Definition: callback.h:29
CALLBACK16 DosContext
Definition: dos.c:40

Definition at line 314 of file dos.h.

◆ SYSTEM_ENV_BLOCK

#define SYSTEM_ENV_BLOCK   0x600

Definition at line 37 of file dos.h.

◆ SYSTEM_PSP

#define SYSTEM_PSP   0x0008

Definition at line 39 of file dos.h.

Typedef Documentation

◆ BIOS_DATA

◆ DOS_CLOCK_TRANSFER_RECORD

◆ DOS_DATA

◆ DOS_FCB

◆ DOS_FIND_FILE_BLOCK

◆ DOS_INPUT_BUFFER

◆ DOS_SDA

◆ DOS_SYSVARS

◆ PBIOS_DATA

◆ PDOS_CLOCK_TRANSFER_RECORD

◆ PDOS_DATA

◆ PDOS_FCB

◆ PDOS_FIND_FILE_BLOCK

◆ PDOS_INPUT_BUFFER

◆ PDOS_SDA

◆ PDOS_SYSVARS

Function Documentation

◆ C_ASSERT()

C_ASSERT ( sizeof(BIOS_DATA = =0x100)

◆ ConDrvCleanup()

VOID ConDrvCleanup ( VOID  )

Definition at line 147 of file condrv.c.

148{
149 if (Con) DosDeleteDevice(Con);
150}
PDOS_DEVICE_NODE Con
Definition: condrv.c:26
VOID DosDeleteDevice(PDOS_DEVICE_NODE DeviceNode)
Definition: device.c:419

◆ ConDrvInitialize()

VOID ConDrvInitialize ( VOID  )

Definition at line 132 of file condrv.c.

133{
138 "CON");
139
145}
PDOS_DEVICE_GENERIC_ROUTINE OpenRoutine
Definition: device.h:101
PDOS_DEVICE_IO_ROUTINE WriteRoutine
Definition: device.h:98
PDOS_DEVICE_IO_ROUTINE ReadRoutine
Definition: device.h:93
PDOS_DEVICE_GENERIC_ROUTINE CloseRoutine
Definition: device.h:102
PDOS_DEVICE_GENERIC_ROUTINE InputStatusRoutine
Definition: device.h:95
WORD NTAPI ConDrvOpen(PDOS_DEVICE_NODE Device)
Definition: condrv.c:118
WORD NTAPI ConDrvClose(PDOS_DEVICE_NODE Device)
Definition: condrv.c:124
WORD NTAPI ConDrvInputStatus(PDOS_DEVICE_NODE Device)
Definition: condrv.c:79
WORD NTAPI ConDrvReadInput(PDOS_DEVICE_NODE Device, DWORD Buffer, PWORD Length)
Definition: condrv.c:31
WORD NTAPI ConDrvWriteOutput(PDOS_DEVICE_NODE Device, DWORD Buffer, PWORD Length)
Definition: condrv.c:96
PDOS_DEVICE_NODE DosCreateDevice(WORD Attributes, PCHAR DeviceName)
Definition: device.c:413
#define DOS_DEVATTR_STDIN
Definition: device.h:21
#define DOS_DEVATTR_CON
Definition: device.h:25
#define DOS_DEVATTR_STDOUT
Definition: device.h:22
#define DOS_DEVATTR_CHARACTER
Definition: device.h:29

Referenced by DosKRNLInitialize().

◆ DosBIOSInitialize()

BOOLEAN DosBIOSInitialize ( VOID  )

setBP(0x091E); // DOS base stack pointer relic value

Definition at line 221 of file bios.c.

222{
223 FILE *Stream;
224 WCHAR Buffer[256];
225
226 /* Set the data segment */
228
229 /* Initialize the global DOS BIOS data area */
231
232 /* Initialize the DOS BIOS stack */
233 // FIXME: Add a block of fixed size for the stack in BIOS/DOS_DATA instead!
234 setSS(0x0F00);
235 setSP(0x0FF0);
237
238 /*
239 * Initialize the INT 13h (BIOS Disk Services) handler chain support.
240 *
241 * The INT 13h handler chain is some functionality that allows DOS
242 * to insert disk filter drivers in between the (hooked) INT 13h handler
243 * and its original handler.
244 * Typically, those are:
245 * - filter for detecting disk changes (for floppy disks),
246 * - filter for tracking formatting calls and correcting DMA boundary errors,
247 * - a possible filter to work around a bug in a particular version of PC-AT's
248 * IBM's ROM BIOS (on systems with model byte FCh and BIOS date "01/10/84" only)
249 * (see http://www.ctyme.com/intr/rb-4453.htm for more details).
250 *
251 * This functionality is known to be used by some legitimate programs,
252 * by Windows 3.x, as well as some illegitimate ones (aka. virii).
253 *
254 * See extra information about this support in dos.h
255 */
256 // FIXME: Should be done by the DOS BIOS
259// RegisterDosInt32(0x13, DosInt13h); // Unused at the moment!
260
261 //
262 // HERE: Do all hardware initialization needed for DOS
263 //
264
265 /*
266 * SysInit part...
267 */
268
269 /* Initialize the DOS kernel (DosInit) */
270 if (!DosKRNLInitialize())
271 {
272 BiosDisplayMessage("Failed to load the DOS kernel! Exiting...\n");
273 return FALSE;
274 }
275
276 /* DOS kernel loading succeeded, we can finish the initialization */
277
278 /* Build the system master (pre-) environment block (inherited by the shell) */
279 if (!DosBuildSysEnvBlock())
280 {
281 DosDisplayMessage("An error occurred when setting up the system environment block.\n");
282 }
283
284 /* TODO: Read CONFIG.NT/SYS */
286 if (Stream != NULL)
287 {
289 {
290 // TODO: Parse the line
291 }
292 fclose(Stream);
293 }
294
295 return TRUE;
296}
Definition: bufpool.h:45
#define BiosDisplayMessage(Format,...)
Definition: dem.h:34
#define DosDisplayMessage(Format,...)
Definition: dem.h:38
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOLEAN DosKRNLInitialize(VOID)
Definition: dos.c:2264
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
static IStream Stream
Definition: htmldoc.c:1115
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define L(x)
Definition: ntvdm.h:50
DWORD PrevInt13
Definition: dos.h:296
DWORD RomBiosInt13
Definition: dos.h:295
PBIOS_DATA BiosData
Definition: bios.c:42
BOOLEAN DosBuildSysEnvBlock(VOID)
Definition: bios.c:165
#define DOS_CONFIG_PATH
Definition: dos.h:27
struct _BIOS_DATA * PBIOS_DATA
#define BIOS_DATA_SEGMENT
Definition: dos.h:31
uint32_t * PULONG
Definition: typedefs.h:59
VOID WINAPI setSP(USHORT)
Definition: registers.c:351
VOID WINAPI setDS(USHORT)
Definition: registers.c:515
VOID WINAPI setSS(USHORT)
Definition: registers.c:501
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)
Definition: wmain.c:22
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DosStart().

◆ DosCheckInput()

BOOLEAN DosCheckInput ( VOID  )

Definition at line 120 of file bios.c.

121{
123
124 if (Descriptor == NULL)
125 {
126 /* Invalid handle */
127 Sda->LastErrorCode = ERROR_INVALID_HANDLE; // ERROR_FILE_NOT_FOUND
128 return FALSE;
129 }
130
131 if (Descriptor->DeviceInfo & FILE_INFO_DEVICE)
132 {
133 WORD Result;
135
136 if (!Node->InputStatusRoutine) return FALSE;
137
138 Result = Node->InputStatusRoutine(Node);
139 return !(Result & DOS_DEVSTAT_BUSY);
140 }
141 else
142 {
143 DWORD FileSizeHigh;
144 DWORD FileSize = GetFileSize(Descriptor->Win32Handle, &FileSizeHigh);
145 LONG LocationHigh = 0;
146 DWORD Location = SetFilePointer(Descriptor->Win32Handle, 0, &LocationHigh, FILE_CURRENT);
147
148 return ((Location != FileSize) || (LocationHigh != FileSizeHigh));
149 }
150}
#define SetFilePointer
Definition: compat.h:743
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
PDOS_SDA Sda
Definition: dos.c:48
PDOS_FILE_DESCRIPTOR DosGetHandleFileDescriptor(WORD DosHandle)
Definition: dosfiles.c:173
#define FILE_INFO_DEVICE
Definition: dosfiles.h:16
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
long LONG
Definition: pedump.c:60
WORD LastErrorCode
Definition: dos.h:160
PDOS_DEVICE_NODE DosGetDriverNode(DWORD Driver)
Definition: device.c:305
#define DOS_DEVSTAT_BUSY
Definition: device.h:50
#define DOS_INPUT_HANDLE
Definition: dos.h:42
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
#define FILE_CURRENT
Definition: winbase.h:114
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by DosInt21h().

◆ DosControlBreak()

BOOLEAN DosControlBreak ( VOID  )

Definition at line 181 of file dos.c.

182{
183 setCF(0);
184
185 /* Print an extra newline */
188
189 /* Call interrupt 0x23 */
190 Int32Call(&DosContext, 0x23);
191
192 if (getCF())
193 {
195 return TRUE;
196 }
197
198 return FALSE;
199}
CALLBACK16 DosContext
Definition: dos.c:40
VOID Int32Call(IN PCALLBACK16 Context, IN BYTE IntNumber)
Definition: int32.c:151
WORD CurrentPsp
Definition: dos.h:165
VOID DosPrintCharacter(WORD FileHandle, CHAR Character)
Definition: bios.c:152
#define DOS_OUTPUT_HANDLE
Definition: dos.h:43
VOID DosTerminateProcess(WORD Psp, BYTE ReturnCode, WORD KeepResident)
Definition: process.c:936
ULONG WINAPI getCF(VOID)
Definition: registers.c:566
VOID WINAPI setCF(ULONG)
Definition: registers.c:573

Referenced by DosInt21h(), and DosReadLineBuffered().

◆ DosEchoCharacter()

VOID DosEchoCharacter ( CHAR  Character)

Definition at line 48 of file bios.c.

49{
50 switch (Character)
51 {
52 case '\0':
53 {
54 /* Nothing */
55 break;
56 }
57
58 case '\b':
59 {
60 /* Erase the character */
64 break;
65 }
66
67 default:
68 {
69 /*
70 * Check if this is a special character
71 * NOTE: \r and \n are handled by the underlying driver!
72 */
73 if (Character < 0x20 && Character != '\r' && Character != '\n')
74 {
76 Character += 'A' - 1;
77 }
78
79 /* Echo the character */
81 }
82 }
83}

Referenced by DosReadCharacter(), DosReadFile(), and DosReadLineBuffered().

◆ DosKRNLInitialize()

BOOLEAN DosKRNLInitialize ( VOID  )

Definition at line 2264 of file dos.c.

2265{
2266 UCHAR i;
2267 PDOS_SFT Sft;
2268 LPSTR Path;
2270 DWORD dwRet;
2272 CHAR DosDirectory[DOS_DIR_LENGTH];
2273
2274 static const BYTE NullDriverRoutine[] =
2275 {
2276 /* Strategy routine entry */
2277 0x26, // mov [Request.Status], DOS_DEVSTAT_DONE
2278 0xC7,
2279 0x47,
2283
2284 /* Interrupt routine entry */
2285 0xCB, // retf
2286 };
2287
2288 /* Set the data segment */
2290
2291 /* Initialize the global DOS data area */
2293 RtlZeroMemory(DosData, sizeof(*DosData));
2294
2295 /* Initialize the DOS stack */
2297 setSP(DOS_DATA_OFFSET(DosStack) + sizeof(DosData->DosStack) - sizeof(WORD));
2298
2299 /* Initialize the list of lists */
2301 RtlZeroMemory(SysVars, sizeof(*SysVars));
2303 SysVars->CurrentDirs = MAKELONG(DOS_DATA_OFFSET(CurrentDirectories),
2305 /*
2306 * The last drive can be redefined with the LASTDRIVE command.
2307 * At the moment, set the real maximum possible, 'Z'.
2308 */
2309 SysVars->NumLocalDrives = 'Z' - 'A' + 1; // See #define NUM_DRIVES in dos.h
2310
2311 /* The boot drive is initialized to the %SYSTEMDRIVE% value */
2312 // NOTE: Using the NtSystemRoot system variable might be OS-specific...
2313 SysVars->BootDrive = RtlUpcaseUnicodeChar(SharedUserData->NtSystemRoot[0]) - 'A' + 1;
2314
2315 /* Initialize the NUL device driver */
2318 // Offset from within the DOS data segment
2319 SysVars->NullDevice.StrategyRoutine = DOS_DATA_OFFSET(NullDriverRoutine);
2320 // Hardcoded to the RETF inside StrategyRoutine
2323 sizeof(SysVars->NullDevice.DeviceName),
2324 ' ');
2327 NullDriverRoutine,
2328 sizeof(NullDriverRoutine));
2329
2330 /* Default DOS version to report */
2332
2333 /* Initialize the swappable data area */
2334 Sda = &DosData->Sda;
2335 RtlZeroMemory(Sda, sizeof(*Sda));
2336
2337 /* Get the current directory and convert it to a DOS path */
2339 if (dwRet == 0)
2340 {
2341 Success = FALSE;
2342 DPRINT1("GetCurrentDirectoryA failed (Error: %u)\n", GetLastError());
2343 }
2344 else if (dwRet > sizeof(CurrentDirectory))
2345 {
2346 Success = FALSE;
2347 DPRINT1("Current directory too long (%d > MAX_PATH) for GetCurrentDirectoryA\n", dwRet);
2348 }
2349
2350 if (Success)
2351 {
2352 dwRet = GetShortPathNameA(CurrentDirectory, DosDirectory, sizeof(DosDirectory));
2353 if (dwRet == 0)
2354 {
2355 Success = FALSE;
2356 DPRINT1("GetShortPathNameA failed (Error: %u)\n", GetLastError());
2357 }
2358 else if (dwRet > sizeof(DosDirectory))
2359 {
2360 Success = FALSE;
2361 DPRINT1("Short path too long (%d > DOS_DIR_LENGTH) for GetShortPathNameA\n", dwRet);
2362 }
2363 }
2364
2365 if (!Success)
2366 {
2367 /* We failed, use the boot drive instead */
2368 DosDirectory[0] = SysVars->BootDrive + 'A' - 1;
2369 DosDirectory[1] = ':';
2370 DosDirectory[2] = '\\';
2371 DosDirectory[3] = '\0';
2372 }
2373
2374 /* Set the current drive */
2375 Sda->CurrentDrive = RtlUpperChar(DosDirectory[0]) - 'A';
2376
2377 /* Get the directory part of the path and set the current directory */
2378 Path = strchr(DosDirectory, '\\');
2379 if (Path != NULL)
2380 {
2381 Path++; // Skip the backslash
2383 }
2384 else
2385 {
2387 }
2388
2389 /* Set the current PSP to the system PSP */
2391
2392 /* Initialize the SFT */
2394 Sft->Link = MAXDWORD;
2396
2397 for (i = 0; i < Sft->NumDescriptors; i++)
2398 {
2399 /* Clear the file descriptor entry */
2401 }
2402
2403 /* Initialize memory management */
2405
2406 /* Initialize the callback context */
2408
2409 /* Register the DOS 32-bit Interrupts */
2412// RegisterDosInt32(0x22, DosInt22h ); // Termination
2413 RegisterDosInt32(0x23, DosBreakInterrupt); // Ctrl-C / Ctrl-Break
2414// RegisterDosInt32(0x24, DosInt24h ); // Critical Error
2415 RegisterDosInt32(0x25, DosAbsoluteRead ); // Absolute Disk Read
2416 RegisterDosInt32(0x26, DosAbsoluteWrite ); // Absolute Disk Write
2417 RegisterDosInt32(0x27, DosInt27h ); // Terminate and Stay Resident
2418 RegisterDosInt32(0x28, DosIdle ); // DOS Idle Interrupt
2419 RegisterDosInt32(0x29, DosFastConOut ); // DOS 2+ Fast Console Output
2420 RegisterDosInt32(0x2F, DosInt2Fh ); // Multiplex Interrupt
2421
2422 /* Unimplemented DOS interrupts */
2423 RegisterDosInt32(0x2A, DosInt2Ah); // DOS Critical Sections / Network
2424// RegisterDosInt32(0x2E, NULL); // COMMAND.COM "Reload Transient"
2425// COMMAND.COM adds support for INT 2Fh, AX=AE00h and AE01h "Installable Command - Installation Check & Execute"
2426// COMMAND.COM adds support for INT 2Fh, AX=5500h "COMMAND.COM Interface"
2427
2428 /* Reserved DOS interrupts */
2429 RegisterDosInt32(0x2B, NULL);
2430 RegisterDosInt32(0x2C, NULL);
2431 RegisterDosInt32(0x2D, NULL);
2432
2433 /* Initialize country data */
2435
2436 /* Load the CON driver */
2438
2439 /* Load the XMS driver (HIMEM) */
2440 XmsInitialize();
2441
2442 /* Load the EMS driver */
2444 {
2445 DosDisplayMessage("Could not initialize EMS. EMS will not be available.\n"
2446 "Page frame segment or number of EMS pages invalid.\n");
2447 }
2448
2449 /* Finally initialize the UMBs */
2451
2452 return TRUE;
2453}
unsigned char BOOLEAN
PRTL_UNICODE_STRING_BUFFER Path
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define DPRINT1
Definition: precomp.h:8
WCHAR CurrentDirectory[1024]
Definition: chkdsk.c:74
BOOLEAN DosCountryInitialize(VOID)
Definition: country.c:236
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
Definition: path.c:1752
VOID WINAPI DosAbsoluteWrite(LPWORD Stack)
Definition: dos.c:2052
VOID WINAPI DosIdle(LPWORD Stack)
Definition: dos.c:2081
PDOS_SYSVARS SysVars
Definition: dos.c:47
VOID WINAPI DosBreakInterrupt(LPWORD Stack)
Definition: dos.c:2026
VOID WINAPI DosInt27h(LPWORD Stack)
Definition: dos.c:2072
VOID WINAPI DosFastConOut(LPWORD Stack)
Definition: dos.c:2090
VOID WINAPI DosInt20h(LPWORD Stack)
Definition: dos.c:201
VOID WINAPI DosInt2Fh(LPWORD Stack)
Definition: dos.c:2127
VOID WINAPI DosAbsoluteRead(LPWORD Stack)
Definition: dos.c:2032
PDOS_DATA DosData
Definition: dos.c:45
VOID WINAPI DosInt2Ah(LPWORD Stack)
Definition: dos.c:2122
VOID WINAPI DosInt21h(LPWORD Stack)
Definition: dos.c:210
struct _DOS_SFT * PDOS_SFT
BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages)
Definition: emsdrv.c:767
#define EMS_TOTAL_PAGES
Definition: emsdrv.h:24
#define EMS_SEGMENT
Definition: emsdrv.h:16
#define FAR_POINTER(x)
Definition: emulator.h:35
@ Success
Definition: eventcreate.c:712
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID XmsInitialize(VOID)
Definition: himem.c:796
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:176
CHAR NTAPI RtlUpperChar(_In_ CHAR Source)
Definition: nlsboot.c:229
#define MAXDWORD
#define SharedUserData
DOS_SYSVARS SysVars
Definition: dos.h:253
DOS_SDA Sda
Definition: dos.h:256
WORD DosVersion
Definition: dos.h:255
BYTE DosStack[384]
Definition: dos.h:259
CHAR CurrentDirectories[NUM_DRIVES][DOS_DIR_LENGTH]
Definition: dos.h:257
BYTE NullDriverRoutine[7]
Definition: dos.h:254
DWORD Link
Definition: device.h:110
WORD StrategyRoutine
Definition: device.h:112
WORD DeviceAttributes
Definition: device.h:111
WORD InterruptRoutine
Definition: device.h:113
CHAR DeviceName[MAX_DEVICE_NAME]
Definition: device.h:117
BYTE CurrentDrive
Definition: dos.h:168
WORD NumDescriptors
Definition: dosfiles.h:67
DOS_FILE_DESCRIPTOR FileDescriptors[ANYSIZE_ARRAY]
Definition: dosfiles.h:68
DWORD Link
Definition: dosfiles.h:66
DWORD CurrentDirs
Definition: dos.h:85
BYTE NumLocalDrives
Definition: dos.h:88
DWORD FirstSft
Definition: dos.h:81
BYTE BootDrive
Definition: dos.h:96
DOS_DRIVER NullDevice
Definition: dos.h:89
VOID InitializeContext(IN PCALLBACK16 Context, IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:60
VOID ConDrvInitialize(VOID)
Definition: condrv.c:132
#define DOS_DEVATTR_NUL
Definition: device.h:23
#define DOS_DEVSTAT_DONE
Definition: device.h:49
struct _DOS_DATA * PDOS_DATA
#define DOS_CODE_SEGMENT
Definition: dos.h:32
#define SYSTEM_PSP
Definition: dos.h:39
#define DOS_DATA_OFFSET(x)
Definition: dos.h:35
#define DOS_SFT_SIZE
Definition: dos.h:46
#define DOS_DIR_LENGTH
Definition: dos.h:47
#define DOS_VERSION
Definition: dos.h:24
#define DOS_DATA_SEGMENT
Definition: dos.h:33
#define RegisterDosInt32(IntNumber, IntHandler)
Definition: dos.h:314
VOID DosInitializeUmb(VOID)
Definition: memory.c:582
VOID DosInitializeMemory(VOID)
Definition: memory.c:665
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MAKELONG(a, b)
Definition: typedefs.h:249
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
char * LPSTR
Definition: xmlstorage.h:182
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DosBIOSInitialize().

◆ DosPrintCharacter()

VOID DosPrintCharacter ( WORD  FileHandle,
CHAR  Character 
)

Definition at line 152 of file bios.c.

153{
155
156 Sda->ByteBuffer = Character;
157
158 /* Use the file writing function */
161 1,
162 &BytesWritten);
163}
WORD DosWriteFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesWritten)
Definition: dosfiles.c:915
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
BYTE ByteBuffer
Definition: dos.h:202
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
Definition: wdfiotarget.h:960

Referenced by DosCharPrint(), DosControlBreak(), DosEchoCharacter(), and DosInt21h().

◆ DosReadCharacter()

CHAR DosReadCharacter ( WORD  FileHandle,
BOOLEAN  Echo 
)

Definition at line 85 of file bios.c.

86{
89 WORD OldDeviceInfo;
90
91 /* Find the standard input descriptor and switch it to binary mode */
93 if (Descriptor)
94 {
95 OldDeviceInfo = Descriptor->DeviceInfo;
96 Descriptor->DeviceInfo |= FILE_INFO_BINARY;
97 }
98
99 Sda->ByteBuffer = '\0';
100 DPRINT("DosReadCharacter\n");
101
102 /* Use the file reading function */
105 1,
106 &BytesRead);
107
108 /* Check if we should echo and the file is actually the CON device */
109 if (Echo && Descriptor && Descriptor->DeviceInfo & FILE_INFO_DEVICE)
110 {
111 /* Echo the character */
113 }
114
115 /* Restore the old mode and return the character */
116 if (Descriptor) Descriptor->DeviceInfo = OldDeviceInfo;
117 return Sda->ByteBuffer;
118}
WORD DosReadFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesRead)
Definition: dosfiles.c:768
#define FILE_INFO_BINARY
Definition: dosfiles.h:15
#define DPRINT
Definition: sndvol32.h:73
VOID DosEchoCharacter(CHAR Character)
Definition: bios.c:48
@ Echo
Definition: telnetd.h:64
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesRead
Definition: wdfiotarget.h:870

Referenced by DosInt21h().

Variable Documentation

◆ BiosData

PBIOS_DATA BiosData
extern

Definition at line 42 of file bios.c.

Referenced by DosBIOSInitialize(), DosInt2Fh(), PciScanBus(), and PPBridge_SaveCurrentSettings().

◆ DosContext

◆ DosData

◆ Sda

◆ SysVars