[NTVDM]
[reactos.git] / reactos / subsystems / mvdm / ntvdm / dos / dos32krnl / dosfiles.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: dos/dos32krnl/dosfiles.h
5 * PURPOSE: DOS32 Files Support
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 /* DEFINES ********************************************************************/
10
11 #define FILE_INFO_DEVICE (1 << 7)
12
13 #pragma pack(push, 1)
14
15 typedef struct _DOS_FILE_DESCRIPTOR
16 {
17 WORD RefCount;
18 WORD OpenMode;
19 BYTE Attributes;
20 WORD DeviceInfo;
21 DWORD DevicePointer;
22 WORD Time;
23 WORD Date;
24 DWORD Size;
25 DWORD Position;
26 DWORD Reserved;
27 WORD OwnerPsp;
28 HANDLE Win32Handle;
29 BYTE Padding[0x1E - sizeof(HANDLE)];
30 } DOS_FILE_DESCRIPTOR, *PDOS_FILE_DESCRIPTOR;
31
32 C_ASSERT(sizeof(DOS_FILE_DESCRIPTOR) == 0x3B);
33
34 typedef struct _DOS_SFT
35 {
36 DWORD Link;
37 WORD NumDescriptors;
38 DOS_FILE_DESCRIPTOR FileDescriptors[ANYSIZE_ARRAY];
39 } DOS_SFT, *PDOS_SFT;
40
41 /* FUNCTIONS ******************************************************************/
42
43 BYTE DosFindFreeDescriptor(VOID);
44 BYTE DosFindWin32Descriptor(HANDLE Win32Handle);
45 BYTE DosFindDeviceDescriptor(DWORD DevicePointer);
46 PDOS_FILE_DESCRIPTOR DosGetFileDescriptor(BYTE Id);
47 PDOS_FILE_DESCRIPTOR DosGetHandleFileDescriptor(WORD DosHandle);
48
49 WORD DosCreateFileEx
50 (
51 LPWORD Handle,
52 LPWORD CreationStatus,
53 LPCSTR FilePath,
54 BYTE AccessShareModes,
55 WORD CreateActionFlags,
56 WORD Attributes
57 );
58
59 WORD DosCreateFile
60 (
61 LPWORD Handle,
62 LPCSTR FilePath,
63 DWORD CreationDisposition,
64 WORD Attributes
65 );
66
67 WORD DosOpenFile
68 (
69 LPWORD Handle,
70 LPCSTR FilePath,
71 BYTE AccessShareModes
72 );
73
74 WORD DosReadFile
75 (
76 WORD FileHandle,
77 DWORD Buffer,
78 WORD Count,
79 LPWORD BytesRead
80 );
81
82 WORD DosWriteFile
83 (
84 WORD FileHandle,
85 DWORD Buffer,
86 WORD Count,
87 LPWORD BytesWritten
88 );
89
90 WORD DosSeekFile
91 (
92 WORD FileHandle,
93 LONG Offset,
94 BYTE Origin,
95 LPDWORD NewOffset
96 );
97
98 BOOL DosFlushFileBuffers(WORD FileHandle);
99 BOOLEAN DosLockFile(WORD DosHandle, DWORD Offset, DWORD Size);
100 BOOLEAN DosUnlockFile(WORD DosHandle, DWORD Offset, DWORD Size);
101
102 BOOLEAN DosDeviceIoControl
103 (
104 WORD FileHandle,
105 BYTE ControlCode,
106 DWORD Buffer,
107 PWORD Length
108 );
109
110 #pragma pack(pop)