]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.h
BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / WinNtSimpleFileSystem.h
1 /**@file
2
3 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 WinNtSimpleFileSystem.h
15
16 Abstract:
17
18 Produce Simple File System abstractions for a directory on your PC using Win32 APIs.
19 The configuration of what devices to mount or emulate comes from NT
20 environment variables. The variables must be visible to the Microsoft*
21 Developer Studio for them to work.
22
23 * Other names and brands may be claimed as the property of others.
24
25 **/
26
27 #ifndef _WIN_NT_SIMPLE_FILE_SYSTEM_H_
28 #define _WIN_NT_SIMPLE_FILE_SYSTEM_H_
29
30
31 #define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 'f', 's')
32
33 typedef struct {
34 UINTN Signature;
35 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
36 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
37 CHAR16 *FilePath;
38 CHAR16 *VolumeLabel;
39 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
40 } WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE;
41
42 #define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
43 CR (a, \
44 WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE, \
45 SimpleFileSystem, \
46 WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
47 )
48
49 #define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE SIGNATURE_32 ('l', 'o', 'f', 's')
50
51 //
52 // Bit definitions for EFI_TIME.Daylight
53 //
54 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
55 #define EFI_TIME_IN_DAYLIGHT 0x02
56
57 typedef struct {
58 UINTN Signature;
59 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
60 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
61 EFI_FILE_PROTOCOL EfiFile;
62 HANDLE LHandle;
63 HANDLE DirHandle;
64 BOOLEAN IsRootDirectory;
65 BOOLEAN IsDirectoryPath;
66 BOOLEAN IsOpenedByRead;
67 CHAR16 *FilePath;
68 WCHAR *FileName;
69 BOOLEAN IsValidFindBuf;
70 WIN32_FIND_DATA FindBuf;
71 } WIN_NT_EFI_FILE_PRIVATE;
72
73 #define WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
74 CR (a, \
75 WIN_NT_EFI_FILE_PRIVATE, \
76 EfiFile, \
77 WIN_NT_EFI_FILE_PRIVATE_SIGNATURE \
78 )
79
80 //
81 // Global Protocol Variables
82 //
83 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding;
84 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName;
85 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtSimpleFileSystemComponentName2;
86
87 //
88 // Driver Binding protocol member functions
89 //
90 EFI_STATUS
91 EFIAPI
92 WinNtSimpleFileSystemDriverBindingSupported (
93 IN EFI_DRIVER_BINDING_PROTOCOL *This,
94 IN EFI_HANDLE ControllerHandle,
95 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
96 )
97 /*++
98
99 Routine Description:
100
101 Check to see if the driver supports a given controller.
102
103 Arguments:
104
105 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
106
107 ControllerHandle - EFI handle of the controller to test.
108
109 RemainingDevicePath - Pointer to remaining portion of a device path.
110
111 Returns:
112
113 EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
114 specified by This.
115
116 EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
117 the driver specified by This.
118
119 EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
120 a different driver or an application that requires exclusive access.
121
122 EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
123 driver specified by This.
124
125 --*/
126 ;
127
128 EFI_STATUS
129 EFIAPI
130 WinNtSimpleFileSystemDriverBindingStart (
131 IN EFI_DRIVER_BINDING_PROTOCOL *This,
132 IN EFI_HANDLE ControllerHandle,
133 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
134 )
135 /*++
136
137 Routine Description:
138
139 Starts a device controller or a bus controller.
140
141 Arguments:
142
143 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
144
145 ControllerHandle - EFI handle of the controller to start.
146
147 RemainingDevicePath - Pointer to remaining portion of a device path.
148
149 Returns:
150
151 EFI_SUCCESS - The device or bus controller has been started.
152
153 EFI_DEVICE_ERROR - The device could not be started due to a device failure.
154
155 EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
156
157 --*/
158 ;
159
160 EFI_STATUS
161 EFIAPI
162 WinNtSimpleFileSystemDriverBindingStop (
163 IN EFI_DRIVER_BINDING_PROTOCOL *This,
164 IN EFI_HANDLE ControllerHandle,
165 IN UINTN NumberOfChildren,
166 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
167 )
168 /*++
169
170 Routine Description:
171
172 TODO: Add function description
173
174 Arguments:
175
176 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
177
178 ControllerHandle - A handle to the device to be stopped.
179
180 NumberOfChildren - The number of child device handles in ChildHandleBuffer.
181
182 ChildHandleBuffer - An array of child device handles to be freed.
183
184 Returns:
185
186 EFI_SUCCESS - The device has been stopped.
187
188 EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
189
190 --*/
191 ;
192
193 //
194 // Simple File System protocol member functions
195 //
196 EFI_STATUS
197 EFIAPI
198 WinNtSimpleFileSystemOpenVolume (
199 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
200 OUT EFI_FILE_PROTOCOL **Root
201 )
202 /*++
203
204 Routine Description:
205
206 Open the root directory on a volume.
207
208 Arguments:
209
210 This - A pointer to the volume to open.
211
212 Root - A pointer to storage for the returned opened file handle of the root directory.
213
214 Returns:
215
216 EFI_SUCCESS - The volume was opened.
217
218 EFI_UNSUPPORTED - The volume does not support the requested file system type.
219
220 EFI_NO_MEDIA - The device has no media.
221
222 EFI_DEVICE_ERROR - The device reported an error.
223
224 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
225
226 EFI_ACCESS_DENIED - The service denied access to the file.
227
228 EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
229
230 EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
231
232 --*/
233 ;
234
235 EFI_STATUS
236 EFIAPI
237 WinNtSimpleFileSystemOpen (
238 IN EFI_FILE_PROTOCOL *This,
239 OUT EFI_FILE_PROTOCOL **NewHandle,
240 IN CHAR16 *FileName,
241 IN UINT64 OpenMode,
242 IN UINT64 Attributes
243 )
244 /*++
245
246 Routine Description:
247
248 Open a file relative to the source file location.
249
250 Arguments:
251
252 This - A pointer to the source file location.
253
254 NewHandle - Pointer to storage for the new file handle.
255
256 FileName - Pointer to the file name to be opened.
257
258 OpenMode - File open mode information.
259
260 Attributes - File creation attributes.
261
262 Returns:
263
264 EFI_SUCCESS - The file was opened.
265
266 EFI_NOT_FOUND - The file could not be found in the volume.
267
268 EFI_NO_MEDIA - The device has no media.
269
270 EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
271
272 EFI_DEVICE_ERROR - The device reported an error.
273
274 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
275
276 EFI_WRITE_PROTECTED - The volume or file is write protected.
277
278 EFI_ACCESS_DENIED - The service denied access to the file.
279
280 EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
281
282 EFI_VOLUME_FULL - There is not enough space left to create the new file.
283
284 --*/
285 ;
286
287 EFI_STATUS
288 EFIAPI
289 WinNtSimpleFileSystemClose (
290 IN EFI_FILE_PROTOCOL *This
291 )
292 /*++
293
294 Routine Description:
295
296 Close the specified file handle.
297
298 Arguments:
299
300 This - Pointer to a returned opened file handle.
301
302 Returns:
303
304 EFI_SUCCESS - The file handle has been closed.
305
306 --*/
307 ;
308
309 EFI_STATUS
310 EFIAPI
311 WinNtSimpleFileSystemDelete (
312 IN EFI_FILE_PROTOCOL *This
313 )
314 /*++
315
316 Routine Description:
317
318 Close and delete a file.
319
320 Arguments:
321
322 This - Pointer to a returned opened file handle.
323
324 Returns:
325
326 EFI_SUCCESS - The file handle was closed and deleted.
327
328 EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
329
330 --*/
331 ;
332
333 EFI_STATUS
334 EFIAPI
335 WinNtSimpleFileSystemRead (
336 IN EFI_FILE_PROTOCOL *This,
337 IN OUT UINTN *BufferSize,
338 OUT VOID *Buffer
339 )
340 /*++
341
342 Routine Description:
343
344 Read data from a file.
345
346 Arguments:
347
348 This - Pointer to a returned open file handle.
349
350 BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
351
352 Buffer - Pointer to the first byte of the read Buffer.
353
354 Returns:
355
356 EFI_SUCCESS - The data was read.
357
358 EFI_NO_MEDIA - The device has no media.
359
360 EFI_DEVICE_ERROR - The device reported an error.
361
362 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
363
364 EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
365 *BufferSize has been updated with the size needed to complete the request.
366
367 --*/
368 ;
369
370 EFI_STATUS
371 EFIAPI
372 WinNtSimpleFileSystemWrite (
373 IN EFI_FILE_PROTOCOL *This,
374 IN OUT UINTN *BufferSize,
375 IN VOID *Buffer
376 )
377 /*++
378
379 Routine Description:
380
381 Write data to a file.
382
383 Arguments:
384
385 This - Pointer to an opened file handle.
386
387 BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
388 of data written to the file.
389
390 Buffer - Pointer to the first by of data in the buffer to write to the file.
391
392 Returns:
393
394 EFI_SUCCESS - The data was written to the file.
395
396 EFI_UNSUPPORTED - Writes to an open directory are not supported.
397
398 EFI_NO_MEDIA - The device has no media.
399
400 EFI_DEVICE_ERROR - The device reported an error.
401
402 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
403
404 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
405
406 EFI_ACCESS_DENIED - The file was opened read-only.
407
408 EFI_VOLUME_FULL - The volume is full.
409
410 --*/
411 ;
412
413 EFI_STATUS
414 EFIAPI
415 WinNtSimpleFileSystemSetPosition (
416 IN EFI_FILE_PROTOCOL *This,
417 IN UINT64 Position
418 )
419 /*++
420
421 Routine Description:
422
423 Set a file's current position.
424
425 Arguments:
426
427 This - Pointer to an opened file handle.
428
429 Position - The byte position from the start of the file to set.
430
431 Returns:
432
433 EFI_SUCCESS - The file position has been changed.
434
435 EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
436
437 --*/
438 ;
439
440 EFI_STATUS
441 EFIAPI
442 WinNtSimpleFileSystemGetPosition (
443 IN EFI_FILE_PROTOCOL *This,
444 OUT UINT64 *Position
445 )
446 /*++
447
448 Routine Description:
449
450 Get a file's current position.
451
452 Arguments:
453
454 This - Pointer to an opened file handle.
455
456 Position - Pointer to storage for the current position.
457
458 Returns:
459
460 EFI_SUCCESS - The file position has been reported.
461
462 EFI_UNSUPPORTED - Not valid for directories.
463
464 --*/
465 ;
466
467 EFI_STATUS
468 EFIAPI
469 WinNtSimpleFileSystemGetInfo (
470 IN EFI_FILE_PROTOCOL *This,
471 IN EFI_GUID *InformationType,
472 IN OUT UINTN *BufferSize,
473 OUT VOID *Buffer
474 )
475 /*++
476
477 Routine Description:
478
479 Return information about a file or volume.
480
481 Arguments:
482
483 This - Pointer to an opened file handle.
484
485 InformationType - GUID describing the type of information to be returned.
486
487 BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
488 information buffer.
489
490 Buffer - Pointer to the first byte of the information buffer.
491
492 Returns:
493
494 EFI_SUCCESS - The requested information has been written into the buffer.
495
496 EFI_UNSUPPORTED - The InformationType is not known.
497
498 EFI_NO_MEDIA - The device has no media.
499
500 EFI_DEVICE_ERROR - The device reported an error.
501
502 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
503
504 EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
505 been updated with the size needed to complete the requested operation.
506
507 --*/
508 ;
509
510 EFI_STATUS
511 EFIAPI
512 WinNtSimpleFileSystemSetInfo (
513 IN EFI_FILE_PROTOCOL *This,
514 IN EFI_GUID *InformationType,
515 IN UINTN BufferSize,
516 IN VOID *Buffer
517 )
518 /*++
519
520 Routine Description:
521
522 Set information about a file or volume.
523
524 Arguments:
525
526 This - Pointer to an opened file handle.
527
528 InformationType - GUID identifying the type of information to set.
529
530 BufferSize - Number of bytes of data in the information buffer.
531
532 Buffer - Pointer to the first byte of data in the information buffer.
533
534 Returns:
535
536 EFI_SUCCESS - The file or volume information has been updated.
537
538 EFI_UNSUPPORTED - The information identifier is not recognised.
539
540 EFI_NO_MEDIA - The device has no media.
541
542 EFI_DEVICE_ERROR - The device reported an error.
543
544 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
545
546 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
547
548 EFI_ACCESS_DENIED - The file was opened read-only.
549
550 EFI_VOLUME_FULL - The volume is full.
551
552 EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
553
554 --*/
555 ;
556
557 EFI_STATUS
558 EFIAPI
559 WinNtSimpleFileSystemFlush (
560 IN EFI_FILE_PROTOCOL *This
561 )
562 /*++
563
564 Routine Description:
565
566 Flush all modified data to the media.
567
568 Arguments:
569
570 This - Pointer to an opened file handle.
571
572 Returns:
573
574 EFI_SUCCESS - The data has been flushed.
575
576 EFI_NO_MEDIA - The device has no media.
577
578 EFI_DEVICE_ERROR - The device reported an error.
579
580 EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
581
582 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
583
584 EFI_ACCESS_DENIED - The file was opened read-only.
585
586 EFI_VOLUME_FULL - The volume is full.
587
588 --*/
589 ;
590
591 #endif /* _WIN_NT_SIMPLE_FILE_SYSTEM_H_ */
592
593 /* eof - WinNtSimpleFileSystem.h */