xref: /reactos/subsystems/mvdm/ntvdm/dos/dem.h (revision 81d5e650)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/dos/dem.h
5  * PURPOSE:         DOS 32-bit Emulation Support Library -
6  *                  This library is used by the built-in NTVDM DOS32 and by
7  *                  the NT 16-bit DOS in Windows (via BOPs). It also exposes
8  *                  exported functions that can be used by VDDs.
9  * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
10  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
11  */
12 
13 #ifndef _DEM_H_
14 #define _DEM_H_
15 
16 /* INCLUDES *******************************************************************/
17 
18 #include <crt/dos.h> // For _A_NORMAL etc.
19 #include "dos32krnl/dos.h"
20 
21 /* DEFINES ********************************************************************/
22 
23 /* BOP Identifiers */
24 #define BOP_LOAD_DOS    0x2B    // DOS Loading and Initializing BOP. In parameter (following bytes) we take a NULL-terminated string indicating the name of the DOS kernel file.
25 #define BOP_START_DOS   0x2C    // DOS Starting BOP. In parameter (following bytes) we take a NULL-terminated string indicating the name of the DOS kernel file.
26 #define BOP_DOS         0x50    // DOS System BOP (for NTIO.SYS and NTDOS.SYS)
27 #define BOP_CMD         0x54    // DOS Command Interpreter BOP (for COMMAND.COM)
28 
29 /* VARIABLES ******************************************************************/
30 
31 /* FUNCTIONS ******************************************************************/
32 
33 VOID Dem_BiosCharPrint(CHAR Character);
34 #define BiosDisplayMessage(Format, ...) \
35     PrintMessageAnsi(Dem_BiosCharPrint, (Format), ##__VA_ARGS__)
36 
37 VOID DosCharPrint(CHAR Character);
38 #define DosDisplayMessage(Format, ...)  \
39     PrintMessageAnsi(DosCharPrint, (Format), ##__VA_ARGS__)
40 
41 
42 BOOLEAN DosShutdown(BOOLEAN Immediate);
43 
44 DWORD DosStartProcess32(IN LPCSTR ExecutablePath,
45                         IN LPCSTR CommandLine,
46                         IN LPCSTR Environment OPTIONAL,
47                         IN DWORD ReturnAddress OPTIONAL,
48                         IN BOOLEAN StartComSpec);
49 
50 DWORD
51 WINAPI
52 demClientErrorEx
53 (
54     IN HANDLE FileHandle,
55     IN CHAR   Unknown,
56     IN BOOL   Flag
57 );
58 
59 DWORD
60 WINAPI
61 demFileDelete
62 (
63     IN LPCSTR FileName
64 );
65 
66 /**
67  * @brief   File attributes for demFileFindFirst().
68  **/
69 #define FA_NORMAL       _A_NORMAL // 0x0000
70 #define FA_READONLY     _A_RDONLY // 0x0001 // FILE_ATTRIBUTE_READONLY
71 #define FA_HIDDEN       _A_HIDDEN // 0x0002 // FILE_ATTRIBUTE_HIDDEN
72 #define FA_SYSTEM       _A_SYSTEM // 0x0004 // FILE_ATTRIBUTE_SYSTEM
73 #define FA_VOLID        _A_VOLID  // 0x0008
74 #define FA_LABEL        FA_VOLID
75 #define FA_DIRECTORY    _A_SUBDIR // 0x0010 // FILE_ATTRIBUTE_DIRECTORY
76 #define FA_ARCHIVE      _A_ARCH   // 0x0020 // FILE_ATTRIBUTE_ARCHIVE
77 #define FA_DEVICE       0x0040              // FILE_ATTRIBUTE_DEVICE
78 
79 #define FA_VALID    (FA_ARCHIVE | FA_DIRECTORY | FA_SYSTEM | FA_HIDDEN | FA_READONLY | FA_NORMAL)
80 
81 /** @brief  Convert Win32/NT file attributes to DOS format. */
82 #define NT_TO_DOS_FA(Attrs) \
83     ( ((Attrs) == FILE_ATTRIBUTE_NORMAL) ? FA_NORMAL : (LOBYTE(Attrs) & FA_VALID) )
84 
85 DWORD
86 WINAPI
87 demFileFindFirst(
88     _Out_ PVOID pFindFileData,
89     _In_  PCSTR FileName,
90     _In_  WORD  AttribMask);
91 
92 DWORD
93 WINAPI
94 demFileFindNext(
95     _Inout_ PVOID pFindFileData);
96 
97 UCHAR
98 WINAPI
99 demGetPhysicalDriveType
100 (
101     IN UCHAR DriveNumber
102 );
103 
104 BOOL
105 WINAPI
106 demIsShortPathName
107 (
108     IN LPCSTR Path,
109     IN BOOL Unknown
110 );
111 
112 DWORD
113 WINAPI
114 demSetCurrentDirectoryGetDrive
115 (
116     IN  LPCSTR CurrentDirectory,
117     OUT PUCHAR DriveNumber
118 );
119 
120 #endif // _DEM_H_
121 
122 /* EOF */
123