/** @file
EFI_FILE_PROTOCOL wrappers for other items (Like Environment Variables,
StdIn, StdOut, StdErr, etc...).
Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "Shell.h"
#include "FileHandleInternal.h"
/**
File style interface for console (Open).
@param[in] This Ignored.
@param[out] NewHandle Ignored.
@param[in] FileName Ignored.
@param[in] OpenMode Ignored.
@param[in] Attributes Ignored.
@retval EFI_NOT_FOUND
**/
)
{
return (EFI_NOT_FOUND);
}
/**
File style interface for console (Close, Delete, & Flush)
@param[in] This Ignored.
@retval EFI_SUCCESS
**/
)
{
return (EFI_SUCCESS);
}
/**
File style interface for console (GetPosition).
@param[in] This Ignored.
@param[out] Position Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for console (SetPosition).
@param[in] This Ignored.
@param[in] Position Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for console (GetInfo).
@param[in] This Ignored.
@param[in] InformationType Ignored.
@param[in, out] BufferSize Ignored.
@param[out] Buffer Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for console (SetInfo).
@param[in] This Ignored.
@param[in] InformationType Ignored.
@param[in] BufferSize Ignored.
@param[in] Buffer Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for StdOut (Write).
Writes data to the screen.
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@retval EFI_UNSUPPORTED No output console is supported.
@return A return value from gST->ConOut->OutputString.
**/
)
{
return (EFI_UNSUPPORTED);
} else {
}
}
/**
File style interface for StdIn (Write).
@param[in] This Ignored.
@param[in, out] BufferSize Ignored.
@param[in] Buffer Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for console StdErr (Write).
Writes error to the error output.
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@return A return value from gST->StdErr->OutputString.
**/
)
{
}
/**
File style interface for console StdOut (Read).
@param[in] This Ignored.
@param[in, out] BufferSize Ignored.
@param[out] Buffer Ignored.
@retval EFI_UNSUPPORTED
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for console StdErr (Read).
@param[in] This Ignored.
@param[in, out] BufferSize Ignored.
@param[out] Buffer Ignored.
@retval EFI_UNSUPPORTED Always.
**/
)
{
return (EFI_UNSUPPORTED);
}
/**
File style interface for NUL file (Read).
@param[in] This Ignored.
@param[in, out] BufferSize Poiner to 0 upon return.
@param[out] Buffer Ignored.
@retval EFI_SUCCESS Always.
**/
)
{
*BufferSize = 0;
return (EFI_SUCCESS);
}
/**
File style interface for NUL file (Write).
@param[in] This Ignored.
@param[in, out] BufferSize Ignored.
@param[in] Buffer Ignored.
@retval EFI_SUCCESS
**/
)
{
return (EFI_SUCCESS);
}
/**
File style interface for console (Read).
This will return a single line of input from the console.
@param This A pointer to the EFI_FILE_PROTOCOL instance that is the
file handle to read data from. Not used.
@param BufferSize On input, the size of the Buffer. On output, the amount
of data returned in Buffer. In both cases, the size is
measured in bytes.
@param Buffer The buffer into which the data is read.
@retval EFI_SUCCESS The data was read.
@retval EFI_NO_MEDIA The device has no medium.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file.
@retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory
entry. BufferSize has been updated with the size
needed to complete the request.
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
**/
)
{
// UINTN Count;
//
// If buffer is not large enough to hold a CHAR16, return minimum buffer size
//
return (EFI_BUFFER_TOO_SMALL);
}
StringLen = 0;
StringCurPos = 0;
OutputLength = 0;
Update = 0;
Delete = 0;
InScrolling = FALSE;
TabLinePos = NULL;
TabPos = 0;
TabUpdatePos = 0;
//
// Allocate buffers
//
return EFI_OUT_OF_RESOURCES;
}
if (TabOutputStr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Get the screen setting and the current cursor location
//
//
// Limit the line length to the buffer size or the minimun size of the
// screen. (The smaller takes effect)
//
}
do {
//
// Read a key
//
continue;
}
//
// Press PageUp or PageDown to scroll the history screen up or down.
// Press any other key to quit scrolling.
//
}
InScrolling = TRUE;
} else {
if (InScrolling) {
InScrolling = FALSE;
}
}
//
// If we are quitting TAB scrolling...
//
if (FoundFileList != NULL) {
}
}
switch (Key.UnicodeChar) {
case CHAR_CARRIAGE_RETURN:
//
// All done, print a newline at the end of the string
//
break;
case CHAR_BACKSPACE:
if (StringCurPos != 0) {
//
// If not move back beyond string beginning, move all characters behind
// the current position one character forward
//
StringCurPos--;
Delete = 1;
CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
//
// Adjust the current column and row
//
}
break;
case CHAR_TAB:
//
// handle auto complete of file and directory names...
//
if (InTabScrolling) {
}
} else {
TabPos = 0;
TabUpdatePos = 0;
}
}
}
}
}
} else {
}
} else {
}
// TabStr = PathCleanUpDirectories(TabStr);
for ( TempStr = CurrentString
; *TempStr == L' '
; TempStr++); // note the ';'... empty for loop
//
// make sure we have a list before we do anything more...
//
TabLinePos = NULL;
continue;
} else {
//
// enumerate through the list of files
//
){
//
// If "cd" is typed, only directory name will be auto-complete filled
// in either case . and .. will be removed.
//
}
}
} else {
}
}
}
break;
default:
//
// If we are at the buffer's end, drop the key
//
if (StringLen == MaxStr - 1 && (ShellInfoObject.ViewingSettings.InsertMode || StringCurPos == StringLen)) {
break;
}
//
// If in insert mode, make space by moving each other character 1
// space higher in the array
//
CopyMem(CurrentString + StringCurPos + 1, CurrentString + StringCurPos, (StringLen - StringCurPos)*sizeof(CurrentString[0]));
}
StringCurPos += 1;
OutputLength = 1;
}
break;
case 0:
case SCAN_DELETE:
//
// Move characters behind current position one character forward
//
if (StringLen != 0) {
Delete = 1;
CopyMem (CurrentString + StringCurPos, CurrentString + StringCurPos + 1, sizeof (CHAR16) * (StringLen - StringCurPos));
}
break;
case SCAN_UP:
//
// Prepare to print the previous command
//
NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
NewPos = (BUFFER_LIST*)GetPreviousNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
}
break;
case SCAN_DOWN:
//
// Prepare to print the next command
//
NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
NewPos = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &LinePos->Link);
}
break;
case SCAN_LEFT:
//
// Adjust current cursor position
//
if (StringCurPos != 0) {
--StringCurPos;
}
break;
case SCAN_RIGHT:
//
// Adjust current cursor position
//
if (StringCurPos < StringLen) {
++StringCurPos;
}
break;
case SCAN_HOME:
//
// Move current cursor position to the beginning of the command line
//
StringCurPos = 0;
break;
case SCAN_END:
//
// Move current cursor position to the end of the command line
//
Column = TailColumn;
break;
case SCAN_ESC:
//
// Prepare to clear the current command line
//
CurrentString[0] = 0;
Update = 0;
OutputLength = 0;
break;
case SCAN_INSERT:
//
// Toggle the SEnvInsertMode flag
//
break;
case SCAN_F7:
//
// Print command history
//
break;
}
}
if (Done) {
break;
}
//
// If we are in auto-complete mode, we are preparing to print
// the next file or directory name
//
if (InTabScrolling) {
//
// Adjust the column and row to the start of TAB-completion string.
//
//
// if the output string contains blank space, quotation marks L'\"'
// should be added to the output.
//
TabOutputStr[0] = L'\"';
} else {
}
}
}
//
// If we have a new position, we are preparing to print a previous or
// next command.
//
//
// Draw new input string
//
Update = 0;
if (StringLen > OutputLength) {
//
// If old string was longer, blank its tail
//
}
}
//
// If we need to update the output do so now
//
if (Delete != 0) {
}
if (StringCurPos > StringLen) {
}
//
// After using print to reflect newly updates, if we're not using
// BACKSPACE and DELETE, we need to move the cursor position forward,
// so adjust row and column here.
//
//
// Calulate row and column of the tail of current string
//
//
// If the tail of string reaches screen end, screen rolls up, so if
// Row does not equal TailRow, Row should be decremented
//
// (if we are recalling commands using UPPER and DOWN key, and if the
// old command is too long to fit the screen, TailColumn must be 79.
//
Row--;
}
//
// Calculate the cursor position after current operation. If cursor
// reaches line end, update both row and column, otherwise, only
// column will be changed.
//
}
} else {
Column += OutputLength;
}
}
Delete = 0;
}
//
// Set the cursor position for this key
//
} while (!Done);
//
// add the line to the history buffer
//
}
//
// Return the data to the caller
//
//
// if this was used it should be deallocated by now...
// prevent memory leaks...
//
return EFI_SUCCESS;
}
//
//
};
};
};
};
//
// This is identical to EFI_FILE_PROTOCOL except for the additional member
// for the name.
//
typedef struct {
//ANSI compliance helper to get size of the struct.
#define SIZE_OF_EFI_FILE_PROTOCOL_ENVIRONMENT EFI_FIELD_OFFSET (EFI_FILE_PROTOCOL_ENVIRONMENT, Name)
/**
File style interface for Environment Variable (Close).
Frees the memory for this object.
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@retval EFI_SUCCESS
**/
)
{
return (EFI_SUCCESS);
}
/**
File style interface for Environment Variable (Delete).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@retval The return value from FileInterfaceEnvClose().
**/
)
{
return (FileInterfaceEnvClose(This));
}
/**
File style interface for Environment Variable (Read).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[out] Buffer The pointer to the buffer to fill.
@retval EFI_SUCCESS The data was read.
**/
)
{
return (SHELL_GET_ENVIRONMENT_VARIABLE(
Buffer));
}
/**
File style interface for Volatile Environment Variable (Write).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@retval EFI_SUCCESS The data was read.
**/
)
{
NewSize = 0;
Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
if (Status == EFI_BUFFER_TOO_SMALL){
Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
}
//
// We want to overwrite the CHAR_NULL
//
NewSize -= 2;
}
Status = SHELL_SET_ENVIRONMENT_VARIABLE_V(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, StrSize(NewBuffer), NewBuffer);
return (Status);
} else {
return (SHELL_SET_ENVIRONMENT_VARIABLE_V(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, *BufferSize, Buffer));
}
}
/**
File style interface for Non Volatile Environment Variable (Write).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@retval EFI_SUCCESS The data was read.
**/
)
{
NewSize = 0;
Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
if (Status == EFI_BUFFER_TOO_SMALL){
Status = SHELL_GET_ENVIRONMENT_VARIABLE(((EFI_FILE_PROTOCOL_ENVIRONMENT*)This)->Name, &NewSize, NewBuffer);
}
return (SHELL_SET_ENVIRONMENT_VARIABLE_NV(
NewSize + *BufferSize,
NewBuffer));
} else {
return (SHELL_SET_ENVIRONMENT_VARIABLE_NV(
Buffer));
}
}
/**
Creates a EFI_FILE_PROTOCOL (almost) object for using to access
environment variables through file operations.
@param EnvName The name of the Environment Variable to be operated on.
@retval NULL Memory could not be allocated.
@return other a pointer to an EFI_FILE_PROTOCOL structure
**/
)
{
return (NULL);
}
//
// Get some memory
//
if (EnvFileInterface == NULL){
return (NULL);
}
//
// Assign the generic members
//
//
// Assign the different members for Volatile and Non-Volatile variables
//
if (IsVolatileEnv(EnvName)) {
} else {
}
return ((EFI_FILE_PROTOCOL *)EnvFileInterface);
}
/**
Move the cursor position one character backward.
@param[in] LineLength Length of a line. Get it by calling QueryMode
@param[in, out] Column Current column of the cursor position
@param[in, out] Row Current row of the cursor position
**/
)
{
//
// If current column is 0, move to the last column of the previous line,
// otherwise, just decrement column.
//
if (*Column == 0) {
if (*Row > 0) {
(*Row)--;
}
return;
}
(*Column)--;
}
/**
Move the cursor position one character forward.
@param[in] LineLength Length of a line.
@param[in] TotalRow Total row of a screen
@param[in, out] Column Current column of the cursor position
@param[in, out] Row Current row of the cursor position
**/
)
{
//
// Increment Column.
// If this puts column past the end of the line, move to first column
// of the next row.
//
(*Column)++;
if (*Column >= LineLength) {
(*Column) = 0;
(*Row)++;
}
}
}
/**
Prints out each previously typed command in the command list history log.
When each screen is full it will pause for a key before continuing.
@param[in] TotalCols How many columns are on the screen
@param[in] TotalRows How many rows are on the screen
@param[in] StartColumn which column to start at
**/
)
{
Index = 0;
LineNumber = 0;
//
// go through history list...
//
; Node = (BUFFER_LIST*)GetNextNode(&ShellInfoObject.ViewingSettings.CommandHistory.Link, &Node->Link)
){
Index++;
);
LineNumber = 0;
}
LineNumber += LineCount;
}
}
//
// This is identical to EFI_FILE_PROTOCOL except for the additional members
// for the buffer, size, and position.
//
typedef struct {
/**
File style interface for Mem (SetPosition).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[out] Position The position to set.
@retval EFI_SUCCESS The position was successfully changed.
@retval EFI_INVALID_PARAMETER The Position was invalid.
**/
)
{
return (EFI_SUCCESS);
} else {
return (EFI_INVALID_PARAMETER);
}
}
/**
File style interface for Mem (GetPosition).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[out] Position The pointer to the position.
@retval EFI_SUCCESS The position was retrieved.
**/
)
{
return (EFI_SUCCESS);
}
/**
File style interface for Mem (Write).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@retval EFI_OUT_OF_RESOURCES The operation failed due to lack of resources.
@retval EFI_SUCCESS The data was written.
**/
)
{
//
// Unicode
//
if ((UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->Position + (*BufferSize)) > (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize)) {
((EFI_FILE_PROTOCOL_MEM*)This)->Buffer = ReallocatePool((UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize), (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize) + (*BufferSize) + 10, ((EFI_FILE_PROTOCOL_MEM*)This)->Buffer);
}
CopyMem(((UINT8*)((EFI_FILE_PROTOCOL_MEM*)This)->Buffer) + ((EFI_FILE_PROTOCOL_MEM*)This)->Position, Buffer, *BufferSize);
return (EFI_SUCCESS);
} else {
//
// Ascii
//
if (AsciiBuffer == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
if ((UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->Position + AsciiStrSize(AsciiBuffer)) > (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize)) {
((EFI_FILE_PROTOCOL_MEM*)This)->Buffer = ReallocatePool((UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize), (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize) + AsciiStrSize(AsciiBuffer) + 10, ((EFI_FILE_PROTOCOL_MEM*)This)->Buffer);
}
CopyMem(((UINT8*)((EFI_FILE_PROTOCOL_MEM*)This)->Buffer) + ((EFI_FILE_PROTOCOL_MEM*)This)->Position, AsciiBuffer, AsciiStrSize(AsciiBuffer));
return (EFI_SUCCESS);
}
}
/**
File style interface for Mem (Read).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to fill.
@retval EFI_SUCCESS The data was read.
**/
)
{
if (*BufferSize > (UINTN)((((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize) - (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->Position))) {
(*BufferSize) = (UINTN)((((EFI_FILE_PROTOCOL_MEM*)This)->BufferSize) - (UINTN)(((EFI_FILE_PROTOCOL_MEM*)This)->Position));
}
CopyMem(Buffer, ((UINT8*)((EFI_FILE_PROTOCOL_MEM*)This)->Buffer) + ((EFI_FILE_PROTOCOL_MEM*)This)->Position, (*BufferSize));
((EFI_FILE_PROTOCOL_MEM*)This)->Position = ((EFI_FILE_PROTOCOL_MEM*)This)->Position + (*BufferSize);
return (EFI_SUCCESS);
}
/**
File style interface for Mem (Close).
Frees all memory associated with this object.
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@retval EFI_SUCCESS The 'file' was closed.
**/
)
{
return (EFI_SUCCESS);
}
/**
Creates a EFI_FILE_PROTOCOL (almost) object for using to access
a file entirely in memory through file operations.
@param[in] Unicode Boolean value with TRUE for Unicode and FALSE for Ascii.
@retval NULL Memory could not be allocated.
@return other A pointer to an EFI_FILE_PROTOCOL structure.
**/
)
{
//
// Get some memory
//
if (FileInterface == NULL){
return (NULL);
}
//
// Assign the generic members
//
return ((EFI_FILE_PROTOCOL *)FileInterface);
}
typedef struct {
/**
Set a files current position
@param This Protocol instance pointer.
@param Position Byte position from the start of the file.
@retval EFI_SUCCESS Data was written.
@retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.
**/
)
{
return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position);
}
/**
Get a file's current position
@param This Protocol instance pointer.
@param Position Byte position from the start of the file.
@retval EFI_SUCCESS Data was written.
@retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open..
**/
)
{
return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetPosition(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, Position);
}
/**
Get information about a file.
@param This Protocol instance pointer.
@param InformationType Type of information to return in Buffer.
@param BufferSize On input size of buffer, on output amount of data in buffer.
@param Buffer The buffer to return data.
@retval EFI_SUCCESS Data was returned.
@retval EFI_UNSUPPORT InformationType is not supported.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The device is write protected.
@retval EFI_ACCESS_DENIED The file was open for read only.
@retval EFI_BUFFER_TOO_SMALL Buffer was too small; required size returned in BufferSize.
**/
)
{
return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->GetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer);
}
/**
Set information about a file
@param This Protocol instance pointer.
@param InformationType Type of information in Buffer.
@param BufferSize Size of buffer.
@param Buffer The data to write.
@retval EFI_SUCCESS Data was returned.
@retval EFI_UNSUPPORT InformationType is not supported.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The device is write protected.
@retval EFI_ACCESS_DENIED The file was open for read only.
**/
)
{
return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->SetInfo(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, InformationType, BufferSize, Buffer);
}
/**
Flush data back for the file handle.
@param This Protocol instance pointer.
@retval EFI_SUCCESS Data was written.
@retval EFI_UNSUPPORT Writes to Open directory are not supported.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_WRITE_PROTECTED The device is write protected.
@retval EFI_ACCESS_DENIED The file was open for read only.
@retval EFI_VOLUME_FULL The volume is full.
**/
)
{
}
/**
Read data from the file.
@param This Protocol instance pointer.
@param BufferSize On input size of buffer, on output amount of data in buffer.
@param Buffer The buffer in which data is read.
@retval EFI_SUCCESS Data was read.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_BUFFER_TO_SMALL BufferSize is too small. BufferSize contains required size.
**/
)
{
//
// Unicode
//
return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer));
} else {
//
// Ascii
//
Status = (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Read(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiBuffer));
return (Status);
}
}
/**
Opens a new file relative to the source file's location.
@param[in] This The protocol instance pointer.
@param[out] NewHandle Returns File Handle for FileName.
@param[in] FileName Null terminated string. "\", ".", and ".." are supported.
@param[in] OpenMode Open mode for file.
@param[in] Attributes Only used for EFI_FILE_MODE_CREATE.
@retval EFI_SUCCESS The device was opened.
@retval EFI_NOT_FOUND The specified file could not be found on the device.
@retval EFI_NO_MEDIA The device has no media.
@retval EFI_MEDIA_CHANGED The media has changed.
@retval EFI_DEVICE_ERROR The device reported an error.
@retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
@retval EFI_ACCESS_DENIED The service denied access to the file.
@retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
@retval EFI_VOLUME_FULL The volume is full.
**/
)
{
return ((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Open(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, NewHandle, FileName, OpenMode, Attributes);
}
/**
Close and delete the file handle.
@param This Protocol instance pointer.
@retval EFI_SUCCESS The device was opened.
@retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted.
**/
)
{
return (Status);
}
/**
File style interface for File (Close).
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@retval EFI_SUCCESS The file was closed.
**/
)
{
return (Status);
}
/**
File style interface for File (Write).
If the file was opened with ASCII mode the data will be processed through
AsciiSPrint before writing.
@param[in] This The pointer to the EFI_FILE_PROTOCOL object.
@param[in, out] BufferSize Size in bytes of Buffer.
@param[in] Buffer The pointer to the buffer to write.
@retval EFI_SUCCESS The data was written.
**/
)
{
//
// Unicode
//
return (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, BufferSize, Buffer));
} else {
//
// Ascii
//
Status = (((EFI_FILE_PROTOCOL_FILE*)This)->Orig->Write(((EFI_FILE_PROTOCOL_FILE*)This)->Orig, &Size, AsciiBuffer));
return (Status);
}
}
/**
Create a file interface with unicode information.
This will create a new EFI_FILE_PROTOCOL identical to the Templace
except that the new one has Unicode and Ascii knowledge.
@param[in] Template A pointer to the EFI_FILE_PROTOCOL object.
@param[in] Unicode TRUE for UCS-2, FALSE for ASCII.
@return a new EFI_FILE_PROTOCOL object to be used instead of the template.
**/
)
{
return (NULL);
}
return ((EFI_FILE_PROTOCOL *)NewOne);
}