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