]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.h
Add WinNtSimpleFileSystemDxe driver into Nt32Pkg.
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / WinNtSimpleFileSystem.h
CommitLineData
068eac81 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
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
25--*/\r
26\r
27#ifndef _WIN_NT_SIMPLE_FILE_SYSTEM_H_\r
28#define _WIN_NT_SIMPLE_FILE_SYSTEM_H_\r
29\r
30\r
31#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'f', 's')\r
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
49#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'f', 's')\r
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
61 EFI_FILE EfiFile;\r
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
83extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding;\r
84extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName;\r
85\r
86//\r
87// Driver Binding protocol member functions\r
88//\r
89EFI_STATUS\r
90EFIAPI\r
91WinNtSimpleFileSystemDriverBindingSupported (\r
92 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
93 IN EFI_HANDLE ControllerHandle,\r
94 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
95 )\r
96/*++\r
97\r
98Routine Description:\r
99\r
100 Check to see if the driver supports a given controller.\r
101\r
102Arguments:\r
103\r
104 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.\r
105\r
106 ControllerHandle - EFI handle of the controller to test.\r
107\r
108 RemainingDevicePath - Pointer to remaining portion of a device path.\r
109\r
110Returns:\r
111\r
112 EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver\r
113 specified by This.\r
114\r
115 EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by\r
116 the driver specified by This.\r
117\r
118 EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by\r
119 a different driver or an application that requires exclusive access.\r
120\r
121 EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the\r
122 driver specified by This.\r
123\r
124--*/\r
125;\r
126\r
127EFI_STATUS\r
128EFIAPI\r
129WinNtSimpleFileSystemDriverBindingStart (\r
130 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
131 IN EFI_HANDLE ControllerHandle,\r
132 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
133 )\r
134/*++\r
135\r
136Routine Description:\r
137\r
138 Starts a device controller or a bus controller.\r
139\r
140Arguments:\r
141\r
142 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.\r
143\r
144 ControllerHandle - EFI handle of the controller to start.\r
145\r
146 RemainingDevicePath - Pointer to remaining portion of a device path.\r
147\r
148Returns:\r
149\r
150 EFI_SUCCESS - The device or bus controller has been started.\r
151\r
152 EFI_DEVICE_ERROR - The device could not be started due to a device failure.\r
153\r
154 EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.\r
155\r
156--*/\r
157;\r
158\r
159EFI_STATUS\r
160EFIAPI\r
161WinNtSimpleFileSystemDriverBindingStop (\r
162 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
163 IN EFI_HANDLE ControllerHandle,\r
164 IN UINTN NumberOfChildren,\r
165 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
166 )\r
167/*++\r
168\r
169Routine Description:\r
170\r
171 TODO: Add function description\r
172\r
173Arguments:\r
174\r
175 This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.\r
176\r
177 ControllerHandle - A handle to the device to be stopped.\r
178\r
179 NumberOfChildren - The number of child device handles in ChildHandleBuffer.\r
180\r
181 ChildHandleBuffer - An array of child device handles to be freed.\r
182\r
183Returns:\r
184\r
185 EFI_SUCCESS - The device has been stopped.\r
186\r
187 EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.\r
188\r
189--*/\r
190;\r
191\r
192//\r
193// Simple File System protocol member functions\r
194//\r
195EFI_STATUS\r
196EFIAPI\r
197WinNtSimpleFileSystemOpenVolume (\r
198 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,\r
199 OUT EFI_FILE **Root\r
200 )\r
201/*++\r
202\r
203Routine Description:\r
204\r
205 Open the root directory on a volume.\r
206\r
207Arguments:\r
208\r
209 This - A pointer to the volume to open.\r
210\r
211 Root - A pointer to storage for the returned opened file handle of the root directory.\r
212\r
213Returns:\r
214\r
215 EFI_SUCCESS - The volume was opened.\r
216\r
217 EFI_UNSUPPORTED - The volume does not support the requested file system type.\r
218\r
219 EFI_NO_MEDIA - The device has no media.\r
220\r
221 EFI_DEVICE_ERROR - The device reported an error.\r
222\r
223 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.\r
224\r
225 EFI_ACCESS_DENIED - The service denied access to the file.\r
226\r
227 EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.\r
228\r
229 EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.\r
230\r
231--*/\r
232;\r
233\r
234EFI_STATUS\r
235EFIAPI\r
236WinNtSimpleFileSystemOpen (\r
237 IN EFI_FILE *This,\r
238 OUT EFI_FILE **NewHandle,\r
239 IN CHAR16 *FileName,\r
240 IN UINT64 OpenMode,\r
241 IN UINT64 Attributes\r
242 )\r
243/*++\r
244\r
245Routine Description:\r
246\r
247 Open a file relative to the source file location.\r
248\r
249Arguments:\r
250\r
251 This - A pointer to the source file location.\r
252\r
253 NewHandle - Pointer to storage for the new file handle.\r
254\r
255 FileName - Pointer to the file name to be opened.\r
256\r
257 OpenMode - File open mode information.\r
258\r
259 Attributes - File creation attributes.\r
260\r
261Returns:\r
262\r
263 EFI_SUCCESS - The file was opened.\r
264\r
265 EFI_NOT_FOUND - The file could not be found in the volume.\r
266\r
267 EFI_NO_MEDIA - The device has no media.\r
268\r
269 EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.\r
270\r
271 EFI_DEVICE_ERROR - The device reported an error.\r
272\r
273 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.\r
274\r
275 EFI_WRITE_PROTECTED - The volume or file is write protected.\r
276\r
277 EFI_ACCESS_DENIED - The service denied access to the file.\r
278\r
279 EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.\r
280\r
281 EFI_VOLUME_FULL - There is not enough space left to create the new file.\r
282\r
283--*/\r
284;\r
285\r
286EFI_STATUS\r
287EFIAPI\r
288WinNtSimpleFileSystemClose (\r
289 IN EFI_FILE *This\r
290 )\r
291/*++\r
292\r
293Routine Description:\r
294\r
295 Close the specified file handle.\r
296\r
297Arguments:\r
298\r
299 This - Pointer to a returned opened file handle.\r
300\r
301Returns:\r
302\r
303 EFI_SUCCESS - The file handle has been closed.\r
304\r
305--*/\r
306;\r
307\r
308EFI_STATUS\r
309EFIAPI\r
310WinNtSimpleFileSystemDelete (\r
311 IN EFI_FILE *This\r
312 )\r
313/*++\r
314\r
315Routine Description:\r
316\r
317 Close and delete a file.\r
318\r
319Arguments:\r
320\r
321 This - Pointer to a returned opened file handle.\r
322\r
323Returns:\r
324\r
325 EFI_SUCCESS - The file handle was closed and deleted.\r
326\r
327 EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.\r
328\r
329--*/\r
330;\r
331\r
332EFI_STATUS\r
333EFIAPI\r
334WinNtSimpleFileSystemRead (\r
335 IN EFI_FILE *This,\r
336 IN OUT UINTN *BufferSize,\r
337 OUT VOID *Buffer\r
338 )\r
339/*++\r
340\r
341Routine Description:\r
342\r
343 Read data from a file.\r
344\r
345Arguments:\r
346\r
347 This - Pointer to a returned open file handle.\r
348\r
349 BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.\r
350\r
351 Buffer - Pointer to the first byte of the read Buffer.\r
352\r
353Returns:\r
354\r
355 EFI_SUCCESS - The data was read.\r
356\r
357 EFI_NO_MEDIA - The device has no media.\r
358\r
359 EFI_DEVICE_ERROR - The device reported an error.\r
360\r
361 EFI_VOLUME_CORRUPTED - The file system structures are corrupted.\r
362\r
363 EFI_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.\r
364 *BufferSize has been updated with the size needed to complete the request.\r
365\r
366--*/\r
367;\r
368\r
369EFI_STATUS\r
370EFIAPI\r
371WinNtSimpleFileSystemWrite (\r
372 IN EFI_FILE *This,\r
373 IN OUT UINTN *BufferSize,\r
374 IN VOID *Buffer\r
375 )\r
376/*++\r
377\r
378Routine Description:\r
379\r
380 Write data to a file.\r
381\r
382Arguments:\r
383\r
384 This - Pointer to an opened file handle.\r
385\r
386 BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes\r
387 of data written to the file.\r
388\r
389 Buffer - Pointer to the first by of data in the buffer to write to the file.\r
390\r
391Returns:\r
392\r
393 EFI_SUCCESS - The data was written to the file.\r
394\r
395 EFI_UNSUPPORTED - Writes to an open directory are not supported.\r
396\r
397 EFI_NO_MEDIA - The device has no media.\r
398\r
399 EFI_DEVICE_ERROR - The device reported an error.\r
400\r
401 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.\r
402\r
403 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.\r
404\r
405 EFI_ACCESS_DENIED - The file was opened read-only.\r
406\r
407 EFI_VOLUME_FULL - The volume is full.\r
408\r
409--*/\r
410;\r
411\r
412EFI_STATUS\r
413EFIAPI\r
414WinNtSimpleFileSystemSetPosition (\r
415 IN EFI_FILE *This,\r
416 IN UINT64 Position\r
417 )\r
418/*++\r
419\r
420Routine Description:\r
421\r
422 Set a file's current position.\r
423\r
424Arguments:\r
425\r
426 This - Pointer to an opened file handle.\r
427\r
428 Position - The byte position from the start of the file to set.\r
429\r
430Returns:\r
431\r
432 EFI_SUCCESS - The file position has been changed.\r
433\r
434 EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.\r
435\r
436--*/\r
437;\r
438\r
439EFI_STATUS\r
440EFIAPI\r
441WinNtSimpleFileSystemGetPosition (\r
442 IN EFI_FILE *This,\r
443 OUT UINT64 *Position\r
444 )\r
445/*++\r
446\r
447Routine Description:\r
448\r
449 Get a file's current position.\r
450\r
451Arguments:\r
452\r
453 This - Pointer to an opened file handle.\r
454\r
455 Position - Pointer to storage for the current position.\r
456\r
457Returns:\r
458\r
459 EFI_SUCCESS - The file position has been reported.\r
460\r
461 EFI_UNSUPPORTED - Not valid for directories.\r
462\r
463--*/\r
464;\r
465\r
466EFI_STATUS\r
467EFIAPI\r
468WinNtSimpleFileSystemGetInfo (\r
469 IN EFI_FILE *This,\r
470 IN EFI_GUID *InformationType,\r
471 IN OUT UINTN *BufferSize,\r
472 OUT VOID *Buffer\r
473 )\r
474/*++\r
475\r
476Routine Description:\r
477\r
478 Return information about a file or volume.\r
479\r
480Arguments:\r
481\r
482 This - Pointer to an opened file handle.\r
483\r
484 InformationType - GUID describing the type of information to be returned.\r
485\r
486 BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the\r
487 information buffer.\r
488\r
489 Buffer - Pointer to the first byte of the information buffer.\r
490\r
491Returns:\r
492\r
493 EFI_SUCCESS - The requested information has been written into the buffer.\r
494\r
495 EFI_UNSUPPORTED - The InformationType is not known.\r
496\r
497 EFI_NO_MEDIA - The device has no media.\r
498\r
499 EFI_DEVICE_ERROR - The device reported an error.\r
500\r
501 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.\r
502\r
503 EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has\r
504 been updated with the size needed to complete the requested operation.\r
505\r
506--*/\r
507;\r
508\r
509EFI_STATUS\r
510EFIAPI\r
511WinNtSimpleFileSystemSetInfo (\r
512 IN EFI_FILE *This,\r
513 IN EFI_GUID *InformationType,\r
514 IN UINTN BufferSize,\r
515 IN VOID *Buffer\r
516 )\r
517/*++\r
518\r
519Routine Description:\r
520\r
521 Set information about a file or volume.\r
522\r
523Arguments:\r
524\r
525 This - Pointer to an opened file handle.\r
526\r
527 InformationType - GUID identifying the type of information to set.\r
528\r
529 BufferSize - Number of bytes of data in the information buffer.\r
530\r
531 Buffer - Pointer to the first byte of data in the information buffer.\r
532\r
533Returns:\r
534\r
535 EFI_SUCCESS - The file or volume information has been updated.\r
536\r
537 EFI_UNSUPPORTED - The information identifier is not recognised.\r
538\r
539 EFI_NO_MEDIA - The device has no media.\r
540\r
541 EFI_DEVICE_ERROR - The device reported an error.\r
542\r
543 EFI_VOLUME_CORRUPTED - The file system structures are corrupt.\r
544\r
545 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.\r
546\r
547 EFI_ACCESS_DENIED - The file was opened read-only.\r
548\r
549 EFI_VOLUME_FULL - The volume is full.\r
550\r
551 EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.\r
552\r
553--*/\r
554;\r
555\r
556EFI_STATUS\r
557EFIAPI\r
558WinNtSimpleFileSystemFlush (\r
559 IN EFI_FILE *This\r
560 )\r
561/*++\r
562\r
563Routine Description:\r
564\r
565 Flush all modified data to the media.\r
566\r
567Arguments:\r
568\r
569 This - Pointer to an opened file handle.\r
570\r
571Returns:\r
572\r
573 EFI_SUCCESS - The data has been flushed.\r
574\r
575 EFI_NO_MEDIA - The device has no media.\r
576\r
577 EFI_DEVICE_ERROR - The device reported an error.\r
578\r
579 EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.\r
580\r
581 EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.\r
582\r
583 EFI_ACCESS_DENIED - The file was opened read-only.\r
584\r
585 EFI_VOLUME_FULL - The volume is full.\r
586\r
587--*/\r
588;\r
589\r
590#endif /* _WIN_NT_SIMPLE_FILE_SYSTEM_H_ */\r
591\r
592/* eof - WinNtSimpleFileSystem.h */\r