ReactOS  0.4.14-dev-317-g96040ec
dosfiles.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GPL - See COPYING in the top level directory
3  * PROJECT: ReactOS Virtual DOS Machine
4  * FILE: subsystems/mvdm/ntvdm/dos/dos32krnl/dosfiles.h
5  * PURPOSE: DOS32 Files Support
6  * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 #pragma once
10 
11 /* DEFINES ********************************************************************/
12 
13 #define FILE_INFO_STDIN (1 << 0)
14 #define FILE_INFO_STDOUT (1 << 1)
15 #define FILE_INFO_BINARY (1 << 5)
16 #define FILE_INFO_DEVICE (1 << 7)
17 
18 #pragma pack(push, 1)
19 
20 #if 0 // Real DOS-5 SFT entry, for reference only
21 typedef struct _DOS_FILE_DESCRIPTOR_DOS5
22 {
23  WORD RefCount; // 0x00
24  WORD OpenMode; // 0x02
25  BYTE Attributes; // 0x04
26  WORD DeviceInfo; // 0x05
27  DWORD DevicePointer; // 0x07
28  WORD StartCluster; // 0x0b
29  WORD Time; // 0x0d
30  WORD Date; // 0x0f
31  DWORD Size; // 0x11
32  DWORD Position; // 0x15
33  BYTE Reserved0[7]; // 0x19
34  CHAR FileName[11]; // 0x20
35  BYTE Reserved1[6]; // 0x2b
36  WORD OwnerPsp; // 0x31
37  BYTE Reserved2[8]; // 0x33
38 } DOS_FILE_DESCRIPTOR_DOS5, *PDOS_FILE_DESCRIPTOR_DOS5;
39 
40 C_ASSERT(sizeof(DOS_FILE_DESCRIPTOR_DOS5) == 0x3B);
41 #endif
42 
43 // Modified DOS SFT entry, compatible for NTVDM only
44 typedef struct _DOS_FILE_DESCRIPTOR
45 {
59  BYTE Padding[0x13 - sizeof(HANDLE)];
61 
62 C_ASSERT(sizeof(DOS_FILE_DESCRIPTOR) == 0x3B);
63 
64 typedef struct _DOS_SFT
65 {
69 } DOS_SFT, *PDOS_SFT;
70 
71 /* FUNCTIONS ******************************************************************/
72 
75 BYTE DosFindDeviceDescriptor(DWORD DevicePointer);
78 
80 (
81  LPWORD Handle,
82  LPWORD CreationStatus,
84  BYTE AccessShareModes,
85  WORD CreateActionFlags,
87 );
88 
90 (
91  LPWORD Handle,
93  DWORD CreationDisposition,
95 );
96 
98 (
99  LPWORD Handle,
101  BYTE AccessShareModes
102 );
103 
105 (
107  DWORD Buffer,
108  WORD Count,
110 );
111 
113 (
115  DWORD Buffer,
116  WORD Count,
118 );
119 
121 (
123  LONG Offset,
124  BYTE Origin,
125  LPDWORD NewOffset
126 );
127 
132 
134 (
137  DWORD Buffer,
138  PWORD Length
139 );
140 
141 #pragma pack(pop)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesWritten
Definition: fltkernel.h:1293
BYTE DosFindFreeDescriptor(VOID)
Definition: dosfiles.c:69
#define ANYSIZE_ARRAY
Definition: typedefs.h:45
WORD DosSeekFile(WORD FileHandle, LONG Offset, BYTE Origin, LPDWORD NewOffset)
Definition: dosfiles.c:1001
static COORD Position
Definition: mouse.c:34
char CHAR
Definition: xmlstorage.h:175
DOS_FILE_DESCRIPTOR FileDescriptors[ANYSIZE_ARRAY]
Definition: dosfiles.h:68
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
BYTE DosReadLineBuffered(WORD FileHandle, DWORD Buffer, BYTE MaxSize)
Definition: dosfiles.c:674
BYTE DosFindWin32Descriptor(HANDLE Win32Handle)
Definition: dosfiles.c:93
WORD DosWriteFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesWritten)
Definition: dosfiles.c:915
PCWSTR FilePath
DWORD Id
BYTE DosFindDeviceDescriptor(DWORD DevicePointer)
Definition: dosfiles.c:123
HANDLE FileHandle
Definition: stats.c:38
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct _DOS_FILE_DESCRIPTOR DOS_FILE_DESCRIPTOR
unsigned char BOOLEAN
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
Definition: bufpool.h:45
const char * LPCSTR
Definition: xmlstorage.h:183
Definition: bcd.h:202
C_ASSERT(sizeof(DOS_FILE_DESCRIPTOR)==0x3B)
WORD * PWORD
Definition: pedump.c:67
BOOLEAN DosLockFile(WORD DosHandle, DWORD Offset, DWORD Size)
Definition: dosfiles.c:1082
_In_ HANDLE Handle
Definition: extypes.h:390
BOOLEAN DosDeviceIoControl(WORD FileHandle, BYTE ControlCode, DWORD Buffer, PWORD Length)
Definition: dosfiles.c:1185
struct _DeviceInfo DeviceInfo
unsigned short WORD
Definition: ntddk_ex.h:93
PVOID HANDLE
Definition: typedefs.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct _DOS_FILE_DESCRIPTOR * PDOS_FILE_DESCRIPTOR
WORD DosReadFile(WORD FileHandle, DWORD Buffer, WORD Count, LPWORD BytesRead)
Definition: dosfiles.c:768
unsigned char BYTE
Definition: mem.h:68
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
WORD DosCreateFileEx(LPWORD Handle, LPWORD CreationStatus, LPCSTR FilePath, BYTE AccessShareModes, WORD CreateActionFlags, WORD Attributes)
Definition: dosfiles.c:181
struct _DOS_SFT * PDOS_SFT
uint16_t * LPWORD
Definition: typedefs.h:54
PDOS_FILE_DESCRIPTOR DosGetFileDescriptor(BYTE Id)
Definition: dosfiles.c:153
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
WORD DosOpenFile(LPWORD Handle, LPCSTR FilePath, BYTE AccessShareModes)
Definition: dosfiles.c:521
WORD NumDescriptors
Definition: dosfiles.h:67
Definition: bcd.h:201
struct _DOS_SFT DOS_SFT
BOOL DosFlushFileBuffers(WORD FileHandle)
Definition: dosfiles.c:1056
WORD DosCreateFile(LPWORD Handle, LPCSTR FilePath, DWORD CreationDisposition, WORD Attributes)
Definition: dosfiles.c:442
uint32_t * LPDWORD
Definition: typedefs.h:57
PDOS_FILE_DESCRIPTOR DosGetHandleFileDescriptor(WORD DosHandle)
Definition: dosfiles.c:173
BYTE Padding[0x13 - sizeof(HANDLE)]
Definition: dosfiles.h:59
static PLARGE_INTEGER Time
Definition: time.c:105
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ FLT_IO_OPERATION_FLAGS _Out_opt_ PULONG BytesRead
Definition: fltkernel.h:1255
DWORD Link
Definition: dosfiles.h:66
BOOLEAN DosUnlockFile(WORD DosHandle, DWORD Offset, DWORD Size)
Definition: dosfiles.c:1105