mirror of https://github.com/acidanthera/audk.git
Add WinNtSimpleFileSystemDxe driver into Nt32Pkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2782 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5413e8e8aa
commit
068eac814d
|
@ -407,3 +407,4 @@
|
|||
$(WORKSPACE)\Nt32Pkg\WinNtBlockIoDxe\WinNtBlockIo.inf
|
||||
$(WORKSPACE)\Nt32Pkg\WinNtBusDriverDxe\WinNtBusDriver.inf
|
||||
$(WORKSPACE)\Nt32Pkg\WinNtConsoleDxe\WinNtConsole.inf
|
||||
$(WORKSPACE)\Nt32Pkg\WinNtSimpleFileSystemDxe\WinNtSimpleFileSystem.inf
|
|
@ -0,0 +1,229 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, 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:
|
||||
|
||||
ComponentName.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
//
|
||||
// The package level header files this module uses
|
||||
//
|
||||
#include <Uefi.h>
|
||||
#include <WinNtDxe.h>
|
||||
//
|
||||
// The protocols, PPI and GUID defintions for this module
|
||||
//
|
||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||
#include <Protocol/WinNtIo.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Guid/FileInfo.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Guid/FileSystemInfo.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
//
|
||||
// The Library classes this module consumes
|
||||
//
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#include "WinNtSimpleFileSystem.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
EFI_COMPONENT_NAME_PROTOCOL gWinNtSimpleFileSystemComponentName = {
|
||||
WinNtSimpleFileSystemComponentNameGetDriverName,
|
||||
WinNtSimpleFileSystemComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
static EFI_UNICODE_STRING_TABLE mWinNtSimpleFileSystemDriverNameTable[] = {
|
||||
{
|
||||
"eng",
|
||||
L"Windows Simple File System Driver"
|
||||
},
|
||||
{
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
Language - A pointer to a three character ISO 639-2 language identifier.
|
||||
This is the language of the driver name that that the caller
|
||||
is requesting, and it must match one of the languages specified
|
||||
in SupportedLanguages. The number of languages supported by a
|
||||
driver is up to the driver writer.
|
||||
DriverName - A pointer to the Unicode string to return. This Unicode string
|
||||
is the name of the driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the Driver specified by This
|
||||
and the language specified by Language was returned
|
||||
in DriverName.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - DriverName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gWinNtSimpleFileSystemComponentName.SupportedLanguages,
|
||||
mWinNtSimpleFileSystemDriverNameTable,
|
||||
DriverName
|
||||
);
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle OPTIONAL,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by an EFI Driver.
|
||||
|
||||
Arguments:
|
||||
This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
ControllerHandle - The handle of a controller that the driver specified by
|
||||
This is managing. This handle specifies the controller
|
||||
whose name is to be returned.
|
||||
ChildHandle - The handle of the child controller to retrieve the name
|
||||
of. This is an optional parameter that may be NULL. It
|
||||
will be NULL for device drivers. It will also be NULL
|
||||
for a bus drivers that wish to retrieve the name of the
|
||||
bus controller. It will not be NULL for a bus driver
|
||||
that wishes to retrieve the name of a child controller.
|
||||
Language - A pointer to a three character ISO 639-2 language
|
||||
identifier. This is the language of the controller name
|
||||
that that the caller is requesting, and it must match one
|
||||
of the languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up to the
|
||||
driver writer.
|
||||
ControllerName - A pointer to the Unicode string to return. This Unicode
|
||||
string is the name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the language specified
|
||||
by Language from the point of view of the driver specified
|
||||
by This.
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - The Unicode string for the user readable name in the
|
||||
language specified by Language for the driver
|
||||
specified by This was returned in DriverName.
|
||||
EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid EFI_HANDLE.
|
||||
EFI_INVALID_PARAMETER - Language is NULL.
|
||||
EFI_INVALID_PARAMETER - ControllerName is NULL.
|
||||
EFI_UNSUPPORTED - The driver specified by This is not currently managing
|
||||
the controller specified by ControllerHandle and
|
||||
ChildHandle.
|
||||
EFI_UNSUPPORTED - The driver specified by This does not support the
|
||||
language specified by Language.
|
||||
|
||||
--*/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
|
||||
WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE *Private;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
//
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure this driver is currently managing ControllerHandle
|
||||
//
|
||||
Status = EfiTestManagedDevice (
|
||||
ControllerHandle,
|
||||
gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,
|
||||
&gEfiWinNtIoProtocolGuid
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
//
|
||||
// Get our context back
|
||||
//
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiSimpleFileSystemProtocolGuid,
|
||||
&SimpleFileSystem,
|
||||
gWinNtSimpleFileSystemDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Private = WIN_NT_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (SimpleFileSystem);
|
||||
|
||||
return LookupUnicodeString (
|
||||
Language,
|
||||
gWinNtSimpleFileSystemComponentName.SupportedLanguages,
|
||||
Private->ControllerNameTable,
|
||||
ControllerName
|
||||
);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,592 @@
|
|||
/*++
|
||||
|
||||
Copyright (c) 2006, 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_
|
||||
|
||||
|
||||
#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')
|
||||
|
||||
//
|
||||
// Bit definitions for EFI_TIME.Daylight
|
||||
//
|
||||
#define EFI_TIME_ADJUST_DAYLIGHT 0x01
|
||||
#define EFI_TIME_IN_DAYLIGHT 0x02
|
||||
|
||||
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
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Close the specified file handle.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to a returned opened file handle.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The file handle has been closed.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemDelete (
|
||||
IN EFI_FILE *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Close and delete a file.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to a returned opened file handle.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The file handle was closed and deleted.
|
||||
|
||||
EFI_WARN_DELETE_FAILURE - The handle was closed but could not be deleted.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemRead (
|
||||
IN EFI_FILE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Read data from a file.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to a returned open file handle.
|
||||
|
||||
BufferSize - On input, the size of the Buffer. On output, the number of bytes stored in the Buffer.
|
||||
|
||||
Buffer - Pointer to the first byte of the read Buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The data was read.
|
||||
|
||||
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_BUFFER_TOO_SMALL - The supplied buffer size was too small to store the current directory entry.
|
||||
*BufferSize has been updated with the size needed to complete the request.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemWrite (
|
||||
IN EFI_FILE *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Write data to a file.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
BufferSize - On input, the number of bytes in the Buffer to write to the file. On output, the number of bytes
|
||||
of data written to the file.
|
||||
|
||||
Buffer - Pointer to the first by of data in the buffer to write to the file.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The data was written to the file.
|
||||
|
||||
EFI_UNSUPPORTED - Writes to an open directory are not supported.
|
||||
|
||||
EFI_NO_MEDIA - The device has no media.
|
||||
|
||||
EFI_DEVICE_ERROR - The device reported an error.
|
||||
|
||||
EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
|
||||
|
||||
EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
|
||||
|
||||
EFI_ACCESS_DENIED - The file was opened read-only.
|
||||
|
||||
EFI_VOLUME_FULL - The volume is full.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemSetPosition (
|
||||
IN EFI_FILE *This,
|
||||
IN UINT64 Position
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Set a file's current position.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
Position - The byte position from the start of the file to set.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The file position has been changed.
|
||||
|
||||
EFI_UNSUPPORTED - The seek request for non-zero is not supported for directories.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemGetPosition (
|
||||
IN EFI_FILE *This,
|
||||
OUT UINT64 *Position
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get a file's current position.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
Position - Pointer to storage for the current position.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The file position has been reported.
|
||||
|
||||
EFI_UNSUPPORTED - Not valid for directories.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemGetInfo (
|
||||
IN EFI_FILE *This,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Return information about a file or volume.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
InformationType - GUID describing the type of information to be returned.
|
||||
|
||||
BufferSize - On input, the size of the information buffer. On output, the number of bytes written to the
|
||||
information buffer.
|
||||
|
||||
Buffer - Pointer to the first byte of the information buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The requested information has been written into the buffer.
|
||||
|
||||
EFI_UNSUPPORTED - The InformationType is not known.
|
||||
|
||||
EFI_NO_MEDIA - The device has no media.
|
||||
|
||||
EFI_DEVICE_ERROR - The device reported an error.
|
||||
|
||||
EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
|
||||
|
||||
EFI_BUFFER_TOO_SMALL - The buffer size was too small to contain the requested information. The buffer size has
|
||||
been updated with the size needed to complete the requested operation.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemSetInfo (
|
||||
IN EFI_FILE *This,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Set information about a file or volume.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
InformationType - GUID identifying the type of information to set.
|
||||
|
||||
BufferSize - Number of bytes of data in the information buffer.
|
||||
|
||||
Buffer - Pointer to the first byte of data in the information buffer.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The file or volume information has been updated.
|
||||
|
||||
EFI_UNSUPPORTED - The information identifier is not recognised.
|
||||
|
||||
EFI_NO_MEDIA - The device has no media.
|
||||
|
||||
EFI_DEVICE_ERROR - The device reported an error.
|
||||
|
||||
EFI_VOLUME_CORRUPTED - The file system structures are corrupt.
|
||||
|
||||
EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
|
||||
|
||||
EFI_ACCESS_DENIED - The file was opened read-only.
|
||||
|
||||
EFI_VOLUME_FULL - The volume is full.
|
||||
|
||||
EFI_BAD_BUFFER_SIZE - The buffer size is smaller than the type indicated by InformationType.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
WinNtSimpleFileSystemFlush (
|
||||
IN EFI_FILE *This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Flush all modified data to the media.
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to an opened file handle.
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - The data has been flushed.
|
||||
|
||||
EFI_NO_MEDIA - The device has no media.
|
||||
|
||||
EFI_DEVICE_ERROR - The device reported an error.
|
||||
|
||||
EFI_VOLUME_CORRUPTED - The file system structures have been corrupted.
|
||||
|
||||
EFI_WRITE_PROTECTED - The file, directory, volume, or device is write protected.
|
||||
|
||||
EFI_ACCESS_DENIED - The file was opened read-only.
|
||||
|
||||
EFI_VOLUME_FULL - The volume is full.
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif /* _WIN_NT_SIMPLE_FILE_SYSTEM_H_ */
|
||||
|
||||
/* eof - WinNtSimpleFileSystem.h */
|
|
@ -0,0 +1,118 @@
|
|||
#/** @file
|
||||
# Simple filesystem driver
|
||||
#
|
||||
# Produce Simple File System abstractions for directories 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.
|
||||
# Copyright (c) 2006 - 2007, 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = WinNtSimpleFileSystem
|
||||
FILE_GUID = 9C25E18B-76BA-43da-A132-DBB0997CEFEF
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
EDK_RELEASE_VERSION = 0x00020000
|
||||
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||
|
||||
ENTRY_POINT = InitializeWinNtSimpleFileSystem
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32
|
||||
#
|
||||
# DRIVER_BINDING = gWinNtSimpleFileSystemDriverBinding
|
||||
# COMPONENT_NAME = gWinNtSimpleFileSystemComponentName
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Sources Section - list of files that are required for the build to succeed.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Sources.common]
|
||||
ComponentName.c
|
||||
WinNtSimpleFileSystem.c
|
||||
WinNtSimpleFileSystem.h
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Includes Section - list of Include locations that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Includes]
|
||||
$(WORKSPACE)/MdePkg/Include/Library
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Package Dependency Section - list of Package files that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Packages]
|
||||
Nt32Pkg/Nt32Pkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class Section - list of Library Classes that are required for
|
||||
# this module.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[LibraryClasses]
|
||||
MemoryAllocationLib
|
||||
UefiBootServicesTableLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
BaseLib
|
||||
DebugLib
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Guid C Name Section - list of Guids that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Guids]
|
||||
gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
|
||||
gEfiFileInfoGuid # SOMETIMES_CONSUMED
|
||||
gEfiFileSystemInfoGuid # SOMETIMES_CONSUMED
|
||||
gEfiWinNtFileSystemGuid # ALWAYS_CONSUMED
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Protocol C Name Section - list of Protocol and Protocol Notify C Names
|
||||
# that this module uses or produces.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[Protocols]
|
||||
gEfiSimpleFileSystemProtocolGuid # PROTOCOL BY_START
|
||||
gEfiWinNtIoProtocolGuid # PROTOCOL TO_START
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<MsaHeader>
|
||||
<ModuleName>WinNtSimpleFileSystem</ModuleName>
|
||||
<ModuleType>UEFI_DRIVER</ModuleType>
|
||||
<GuidValue>9C25E18B-76BA-43da-A132-DBB0997CEFEF</GuidValue>
|
||||
<Version>1.0</Version>
|
||||
<Abstract>Simple filesystem driver</Abstract>
|
||||
<Description>Produce Simple File System abstractions for directories 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.</Description>
|
||||
<Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>
|
||||
<License>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.</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>WinNtSimpleFileSystem</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<LibraryClassDefinitions>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>DebugLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverModelLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>BaseMemoryLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>UefiBootServicesTableLib</Keyword>
|
||||
</LibraryClass>
|
||||
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||
<Keyword>MemoryAllocationLib</Keyword>
|
||||
</LibraryClass>
|
||||
</LibraryClassDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>WinNtSimpleFileSystem.h</Filename>
|
||||
<Filename>WinNtSimpleFileSystem.c</Filename>
|
||||
<Filename>ComponentName.c</Filename>
|
||||
</SourceFiles>
|
||||
<PackageDependencies>
|
||||
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||
<Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>
|
||||
</PackageDependencies>
|
||||
<Protocols>
|
||||
<Protocol Usage="TO_START">
|
||||
<ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
<Protocol Usage="BY_START">
|
||||
<ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>
|
||||
</Protocol>
|
||||
</Protocols>
|
||||
<Guids>
|
||||
<GuidCNames Usage="ALWAYS_CONSUMED">
|
||||
<GuidCName>gEfiWinNtFileSystemGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiFileSystemInfoGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiFileInfoGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
<GuidCNames Usage="SOMETIMES_CONSUMED">
|
||||
<GuidCName>gEfiFileSystemVolumeLabelInfoIdGuid</GuidCName>
|
||||
</GuidCNames>
|
||||
</Guids>
|
||||
<Externs>
|
||||
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||
<Extern>
|
||||
<DriverBinding>gWinNtSimpleFileSystemDriverBinding</DriverBinding>
|
||||
<ComponentName>gWinNtSimpleFileSystemComponentName</ComponentName>
|
||||
</Extern>
|
||||
</Externs>
|
||||
</ModuleSurfaceArea>
|
Loading…
Reference in New Issue