winntsimplefilesystem.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 605 行 · 第 1/2 页
H
605 行
/*++
Copyright (c) 2004 - 2005, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
WinNtSimpleFileSystem.h
Abstract:
Produce Simple File System abstractions for a directory on your PC using Win32 APIs.
The configuration of what devices to mount or emulate comes from NT
environment variables. The variables must be visible to the Microsoft*
Developer Studio for them to work.
* Other names and brands may be claimed as the property of others.
--*/
#ifndef _WIN_NT_SIMPLE_FILE_SYSTEM_H_
#define _WIN_NT_SIMPLE_FILE_SYSTEM_H_
#include "EfiWinNt.h"
#include "EfiDriverLib.h"
//
// Driver Consumed Protocols
//
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include EFI_PROTOCOL_DEFINITION (WinNtIo)
//
// Driver Produced Protocols
//
#include EFI_PROTOCOL_DEFINITION (DriverBinding)
#include EFI_PROTOCOL_DEFINITION (ComponentName)
#include EFI_PROTOCOL_DEFINITION (SimpleFileSystem)
#include EFI_PROTOCOL_DEFINITION (FileInfo)
#include EFI_PROTOCOL_DEFINITION (FileSystemInfo)
#include EFI_PROTOCOL_DEFINITION (FileSystemVolumeLabelInfo)
#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'f', 's')
typedef struct {
UINTN Signature;
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFileSystem;
CHAR16 *FilePath;
CHAR16 *VolumeLabel;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
} WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE;
#define WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE, \
SimpleFileSystem, \
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE \
)
#define WIN_NT_EFI_FILE_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('l', 'o', 'f', 's')
typedef struct {
UINTN Signature;
EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
EFI_FILE EfiFile;
HANDLE LHandle;
HANDLE DirHandle;
BOOLEAN IsRootDirectory;
BOOLEAN IsDirectoryPath;
BOOLEAN IsOpenedByRead;
CHAR16 *FilePath;
WCHAR *FileName;
BOOLEAN IsValidFindBuf;
WIN32_FIND_DATA FindBuf;
} WIN_NT_EFI_FILE_PRIVATE;
#define WIN_NT_EFI_FILE_PRIVATE_DATA_FROM_THIS(a) \
CR (a, \
WIN_NT_EFI_FILE_PRIVATE, \
EfiFile, \
WIN_NT_EFI_FILE_PRIVATE_SIGNATURE \
)
//
// Global Protocol Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gWinNtSimpleFileSystemDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName;
//
// Driver Binding protocol member functions
//
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
/*++
Routine Description:
Check to see if the driver supports a given controller.
Arguments:
This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
ControllerHandle - EFI handle of the controller to test.
RemainingDevicePath - Pointer to remaining portion of a device path.
Returns:
EFI_SUCCESS - The device specified by ControllerHandle and RemainingDevicePath is supported by the driver
specified by This.
EFI_ALREADY_STARTED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
the driver specified by This.
EFI_ACCESS_DENIED - The device specified by ControllerHandle and RemainingDevicePath is already being managed by
a different driver or an application that requires exclusive access.
EFI_UNSUPPORTED - The device specified by ControllerHandle and RemainingDevicePath is not supported by the
driver specified by This.
--*/
;
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
/*++
Routine Description:
Starts a device controller or a bus controller.
Arguments:
This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
ControllerHandle - EFI handle of the controller to start.
RemainingDevicePath - Pointer to remaining portion of a device path.
Returns:
EFI_SUCCESS - The device or bus controller has been started.
EFI_DEVICE_ERROR - The device could not be started due to a device failure.
EFI_OUT_OF_RESOURCES - The request could not be completed due to lack of resources.
--*/
;
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
)
/*++
Routine Description:
TODO: Add function description
Arguments:
This - A pointer to an instance of the EFI_DRIVER_BINDING_PROTOCOL.
ControllerHandle - A handle to the device to be stopped.
NumberOfChildren - The number of child device handles in ChildHandleBuffer.
ChildHandleBuffer - An array of child device handles to be freed.
Returns:
EFI_SUCCESS - The device has been stopped.
EFI_DEVICE_ERROR - The device could not be stopped due to a device failure.
--*/
;
//
// Simple File System protocol member functions
//
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemOpenVolume (
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
OUT EFI_FILE **Root
)
/*++
Routine Description:
Open the root directory on a volume.
Arguments:
This - A pointer to the volume to open.
Root - A pointer to storage for the returned opened file handle of the root directory.
Returns:
EFI_SUCCESS - The volume was opened.
EFI_UNSUPPORTED - The volume does not support the requested file system type.
EFI_NO_MEDIA - The device has no media.
EFI_DEVICE_ERROR - The device reported an error.
EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
EFI_ACCESS_DENIED - The service denied access to the file.
EFI_OUT_OF_RESOURCES - The file volume could not be opened due to lack of resources.
EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
--*/
;
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemOpen (
IN EFI_FILE *This,
OUT EFI_FILE **NewHandle,
IN CHAR16 *FileName,
IN UINT64 OpenMode,
IN UINT64 Attributes
)
/*++
Routine Description:
Open a file relative to the source file location.
Arguments:
This - A pointer to the source file location.
NewHandle - Pointer to storage for the new file handle.
FileName - Pointer to the file name to be opened.
OpenMode - File open mode information.
Attributes - File creation attributes.
Returns:
EFI_SUCCESS - The file was opened.
EFI_NOT_FOUND - The file could not be found in the volume.
EFI_NO_MEDIA - The device has no media.
EFI_MEDIA_CHANGED - The device has new media or the media is no longer supported.
EFI_DEVICE_ERROR - The device reported an error.
EFI_VOLUME_CORRUPTED - The file system structures are corrupted.
EFI_WRITE_PROTECTED - The volume or file is write protected.
EFI_ACCESS_DENIED - The service denied access to the file.
EFI_OUT_OF_RESOURCES - Not enough resources were available to open the file.
EFI_VOLUME_FULL - There is not enough space left to create the new file.
--*/
;
EFI_STATUS
EFIAPI
WinNtSimpleFileSystemClose (
IN EFI_FILE *This
)
/*++
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?