6e31cfe5a3822329e79bba84ce4648bcde54847e
[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 #pragma pack(push, 1)
12
13 typedef struct _DOS_FILE_DESCRIPTOR
14 {
15 WORD RefCount;
16 WORD OpenMode;
17 BYTE Attributes;
18 WORD DeviceInfo;
19 DWORD DevicePointer;
20 WORD Time;
21 WORD Date;
22 DWORD Size;
23 DWORD Position;
24 DWORD Reserved;
25 WORD OwnerPsp;
26 HANDLE Win32Handle;
27 BYTE Padding[0x1E - sizeof(HANDLE)];
28 } DOS_FILE_DESCRIPTOR, *PDOS_FILE_DESCRIPTOR;
29
30 C_ASSERT(sizeof(DOS_FILE_DESCRIPTOR) == 0x3B);
31
32 typedef struct _DOS_SFT
33 {
34 DWORD Link;
35 WORD NumDescriptors;
36 DOS_FILE_DESCRIPTOR FileDescriptors[ANYSIZE_ARRAY];
37 } DOS_SFT, *PDOS_SFT;
38
39 /* FUNCTIONS ******************************************************************/
40
41 BYTE DosFindFreeDescriptor(VOID);
42 BYTE DosFindWin32Descriptor(HANDLE Win32Handle);
43 BYTE DosFindDeviceDescriptor(DWORD DevicePointer);
44 PDOS_FILE_DESCRIPTOR DosGetFileDescriptor(BYTE Id);
45 PDOS_FILE_DESCRIPTOR DosGetHandleFileDescriptor(WORD DosHandle);
46
47 WORD DosCreateFileEx
48 (
49 LPWORD Handle,
50 LPWORD CreationStatus,
51 LPCSTR FilePath,
52 BYTE AccessShareModes,
53 WORD CreateActionFlags,
54 WORD Attributes
55 );
56
57 WORD DosCreateFile
58 (
59 LPWORD Handle,
60 LPCSTR FilePath,
61 DWORD CreationDisposition,
62 WORD Attributes
63 );
64
65 WORD DosOpenFile
66 (
67 LPWORD Handle,
68 LPCSTR FilePath,
69 BYTE AccessShareModes
70 );
71
72 WORD DosReadFile
73 (
74 WORD FileHandle,
75 DWORD Buffer,
76 WORD Count,
77 LPWORD BytesRead
78 );
79
80 WORD DosWriteFile
81 (
82 WORD FileHandle,
83 DWORD Buffer,
84 WORD Count,
85 LPWORD BytesWritten
86 );
87
88 WORD DosSeekFile
89 (
90 WORD FileHandle,
91 LONG Offset,
92 BYTE Origin,
93 LPDWORD NewOffset
94 );
95
96 BOOL DosFlushFileBuffers(WORD FileHandle);
97 BOOLEAN DosLockFile(WORD DosHandle, DWORD Offset, DWORD Size);
98 BOOLEAN DosUnlockFile(WORD DosHandle, DWORD Offset, DWORD Size);
99
100 BOOLEAN DosDeviceIoControl
101 (
102 WORD FileHandle,
103 BYTE ControlCode,
104 DWORD Buffer,
105 PWORD Length
106 );
107
108 #pragma pack(pop)