summaryrefslogtreecommitdiff
path: root/fpcsrc/rtl/nativent/ndk/iotypes.inc
blob: 02e0d56adc4716a868c79c0613b4f931e656bc4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
{%MainUnit ndk.pas}
{
    Native Development Kit for Native NT

    This file is part of the Free Pascal run time library.
    This unit contains types used for IO functions.
    Copyright (c) 2010 by Sven Barth

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}

const
  //
  // NtCreateFile OpenType Flags
  //
  FILE_SUPERSEDE                          = $00000000;
  FILE_OPEN                               = $00000001;
  FILE_CREATE                             = $00000002;
  FILE_OPEN_IF                            = $00000003;
  FILE_OVERWRITE                          = $00000004;
  FILE_OVERWRITE_IF                       = $00000005;
  FILE_MAXIMUM_DISPOSITION                = $00000005;

  //
  // NtCreateFile Flags
  //
  FILE_DIRECTORY_FILE                     = $00000001;
  FILE_WRITE_THROUGH                      = $00000002;
  FILE_SEQUENTIAL_ONLY                    = $00000004;
  FILE_NO_INTERMEDIATE_BUFFERING          = $00000008;
  FILE_SYNCHRONOUS_IO_ALERT               = $00000010;
  FILE_SYNCHRONOUS_IO_NONALERT            = $00000020;
  FILE_NON_DIRECTORY_FILE                 = $00000040;
  FILE_CREATE_TREE_CONNECTION             = $00000080;
  FILE_COMPLETE_IF_OPLOCKED               = $00000100;
  FILE_NO_EA_KNOWLEDGE                    = $00000200;
  FILE_OPEN_REMOTE_INSTANCE               = $00000400;
  FILE_RANDOM_ACCESS                      = $00000800;
  FILE_DELETE_ON_CLOSE                    = $00001000;
  FILE_OPEN_BY_FILE_ID                    = $00002000;
  FILE_OPEN_FOR_BACKUP_INTENT             = $00004000;
  FILE_NO_COMPRESSION                     = $00008000;
  FILE_RESERVE_OPFILTER                   = $00100000;
  FILE_OPEN_REPARSE_POINT                 = $00200000;
  FILE_OPEN_NO_RECALL                     = $00400000;
  FILE_OPEN_FOR_FREE_SPACE_QUERY          = $00800000;

type
  //
  // File Information Classes for NtQueryInformationFile
  //
  _FILE_INFORMATION_CLASS = (
    FileDirectoryInformation = 1,
    FileFullDirectoryInformation,
    FileBothDirectoryInformation,
    FileBasicInformation,
    FileStandardInformation,
    FileInternalInformation,
    FileEaInformation,
    FileAccessInformation,
    FileNameInformation,
    FileRenameInformation,
    FileLinkInformation,
    FileNamesInformation,
    FileDispositionInformation,
    FilePositionInformation,
    FileFullEaInformation,
    FileModeInformation,
    FileAlignmentInformation,
    FileAllInformation,
    FileAllocationInformation,
    FileEndOfFileInformation,
    FileAlternateNameInformation,
    FileStreamInformation,
    FilePipeInformation,
    FilePipeLocalInformation,
    FilePipeRemoteInformation,
    FileMailslotQueryInformation,
    FileMailslotSetInformation,
    FileCompressionInformation,
    FileObjectIdInformation,
    FileCompletionInformation,
    FileMoveClusterInformation,
    FileQuotaInformation,
    FileReparsePointInformation,
    FileNetworkOpenInformation,
    FileAttributeTagInformation,
    FileTrackingInformation,
    FileIdBothDirectoryInformation,
    FileIdFullDirectoryInformation,
    FileValidDataLengthInformation,
    FileShortNameInformation,
    FileMaximumInformation
  );
  FILE_INFORMATION_CLASS = _FILE_INFORMATION_CLASS;
  PFILE_INFORMATION_CLASS = ^FILE_INFORMATION_CLASS;

  //
  // I/O Status Block
  //
  _IO_STATUS_BLOCK = record
    union1: record
      case Boolean of
        True: (Status: NTSTATUS);
        False: (Pointer: PVOID);
    end;
    Information: ULONG_PTR;
  end;
  IO_STATUS_BLOCK = _IO_STATUS_BLOCK;
  PIO_STATUS_BLOCK = ^IO_STATUS_BLOCK;

  //
  // File Information structures for NtQueryInformationFile
  //
  _FILE_BASIC_INFORMATION = record
    CreationTime: LARGE_INTEGER;
    LastAccessTime: LARGE_INTEGER;
    LastWriteTime: LARGE_INTEGER;
    ChangeTime: LARGE_INTEGER;
    FileAttributes: ULONG;
  end;
  FILE_BASIC_INFORMATION = _FILE_BASIC_INFORMATION;
  PFILE_BASIC_INFORMATION = ^FILE_BASIC_INFORMATION;

  _FILE_STANDARD_INFORMATION = record
      AllocationSize: LARGE_INTEGER;
      EndOfFile: LARGE_INTEGER;
      NumberOfLinks: ULONG;
      DeletePending: NT_BOOLEAN;
      Directory: NT_BOOLEAN;
  end;
  FILE_STANDARD_INFORMATION = _FILE_STANDARD_INFORMATION;
  PFILE_STANDARD_INFORMATION = ^FILE_STANDARD_INFORMATION;

  _FILE_NETWORK_OPEN_INFORMATION = record
    CreationTime: LARGE_INTEGER;
    LastAccessTime: LARGE_INTEGER;
    LastWriteTime: LARGE_INTEGER;
    ChangeTime: LARGE_INTEGER;
    AllocationSize: LARGE_INTEGER;
    EndOfFile: LARGE_INTEGER;
    FileAttributes: ULONG;
  end;
  FILE_NETWORK_OPEN_INFORMATION = _FILE_NETWORK_OPEN_INFORMATION;
  PFILE_NETWORK_OPEN_INFORMATION = ^FILE_NETWORK_OPEN_INFORMATION;

  _FILE_POSITION_INFORMATION = record
    CurrentByteOffset: LARGE_INTEGER;
  end;
  FILE_POSITION_INFORMATION = _FILE_POSITION_INFORMATION;
  PFILE_POSITION_INFORMATION = ^FILE_POSITION_INFORMATION;

  _FILE_DISPOSITION_INFORMATION = record
    DeleteFile: NT_BOOLEAN;
  end;
  FILE_DISPOSITION_INFORMATION = _FILE_DISPOSITION_INFORMATION;
  PFILE_DISPOSITION_INFORMATION = ^FILE_DISPOSITION_INFORMATION;

  _FILE_RENAME_INFORMATION = record
    ReplaceIfExists: NT_BOOLEAN;
    RootDirectory: HANDLE;
    FileNameLength: ULONG;
    FileName: array[0..0] of WCHAR;
  end;
  FILE_RENAME_INFORMATION = _FILE_RENAME_INFORMATION;
  PFILE_RENAME_INFORMATION = ^FILE_RENAME_INFORMATION;

  _FILE_BOTH_DIR_INFORMATION = record
    NextEntryOffset: ULONG;
    FileIndex: ULONG;
    CreationTime: LARGE_INTEGER;
    LastAccessTime: LARGE_INTEGER;
    LastWriteTime: LARGE_INTEGER;
    ChangeTime: LARGE_INTEGER;
    EndOfFile: LARGE_INTEGER;
    AllocationSize: LARGE_INTEGER;
    FileAttributes: ULONG;
    FileNameLength: ULONG;
    EaSize: ULONG;
    ShortNameLength: CCHAR;
    ShortName: array[0..11] of WCHAR;
    FileName: array[0..0] of WCHAR;
  end;
  FILE_BOTH_DIR_INFORMATION = _FILE_BOTH_DIR_INFORMATION;
  PFILE_BOTH_DIR_INFORMATION = ^FILE_BOTH_DIR_INFORMATION;

  _FILE_NAME_INFORMATION = record
    FileNameLength: ULONG;
    FileName: array[0..0] of WCHAR;
  end;
  FILE_NAME_INFORMATION = _FILE_NAME_INFORMATION;
  PFILE_NAME_INFORMATION = ^FILE_NAME_INFORMATION;

  _FILE_ALLOCATION_INFORMATION = record
    AllocationSize: LARGE_INTEGER;
  end;
  FILE_ALLOCATION_INFORMATION = _FILE_ALLOCATION_INFORMATION;
  PFILE_ALLOCATION_INFORMATION = ^FILE_ALLOCATION_INFORMATION;

  _FILE_END_OF_FILE_INFORMATION = record
    EndOfFile: LARGE_INTEGER;
  end;
  FILE_END_OF_FILE_INFORMATION = _FILE_END_OF_FILE_INFORMATION;
  PFILE_END_OF_FILE_INFORMATION = ^FILE_END_OF_FILE_INFORMATION;

  _FILE_DIRECTORY_INFORMATION = record
    NextEntryOffset: ULONG;
    FileIndex: ULONG;
    CreationTime: LARGE_INTEGER;
    LastAccessTime: LARGE_INTEGER;
    LastWriteTime: LARGE_INTEGER;
    ChangeTime: LARGE_INTEGER;
    EndOfFile: LARGE_INTEGER;
    AllocationSize: LARGE_INTEGER;
    FileAttributes: ULONG;
    FileNameLength: ULONG;
    FileName: array[0..0] of WCHAR;
  end;
  FILE_DIRECTORY_INFORMATION = _FILE_DIRECTORY_INFORMATION;
  PFILE_DIRECTORY_INFORMATION = ^FILE_DIRECTORY_INFORMATION;

  //
  // APC Callback for NtCreateFile
  //
  PIO_APC_ROUTINE = procedure(
    ApcContext: PVOID;
    IoStatusBlock: PIO_STATUS_BLOCK;
    Reserved: ULONG); stdcall;