/** @file\r
Provides interface to EFI_FILE_HANDLE functionality.\r
\r
- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. <BR>\r
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved. <BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
@param FileHandle the file handle to close.\r
\r
-@retval EFI_SUCCESS the file handle was closed sucessfully.\r
+@retval EFI_SUCCESS the file handle was closed successfully.\r
**/\r
EFI_STATUS\r
EFIAPI\r
\r
@param FileHandle the file handle to delete\r
\r
- @retval EFI_SUCCESS the file was closed sucessfully\r
+ @retval EFI_SUCCESS the file was closed successfully\r
@retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not\r
deleted\r
@retval INVALID_PARAMETER One of the parameters has an invalid value.\r
has the effect of starting the read process of the directory entries over.\r
\r
@param FileHandle The file handle on which the position is being set\r
- @param Position Byte position from begining of file\r
+ @param Position Byte position from beginning of file\r
\r
- @retval EFI_SUCCESS Operation completed sucessfully.\r
+ @retval EFI_SUCCESS Operation completed successfully.\r
@retval EFI_UNSUPPORTED the seek request for non-zero is not valid on\r
directories.\r
@retval INVALID_PARAMETER One of the parameters has an invalid value.\r
if FileHandle is a directory.\r
\r
@param FileHandle The open file handle on which to get the position.\r
- @param Position Byte position from begining of file.\r
+ @param Position Byte position from beginning of file.\r
\r
- @retval EFI_SUCCESS the operation completed sucessfully.\r
+ @retval EFI_SUCCESS the operation completed successfully.\r
@retval INVALID_PARAMETER One of the parameters has an invalid value.\r
@retval EFI_UNSUPPORTED the request is not valid on directories.\r
**/\r
}\r
\r
//\r
- // reset to the begining of the directory\r
+ // reset to the beginning of the directory\r
//\r
Status = FileHandleSetPosition(DirHandle, 0);\r
if (EFI_ERROR(Status)) {\r
@param[in] FileHandle The file handle from which size is retrieved.\r
@param[out] Size The pointer to size.\r
\r
- @retval EFI_SUCCESS Operation was completed sucessfully.\r
+ @retval EFI_SUCCESS Operation was completed successfully.\r
@retval EFI_DEVICE_ERROR Cannot access the file.\r
@retval EFI_INVALID_PARAMETER FileHandle is NULL.\r
Size is NULL.\r
\r
/**\r
Function to get a full filename given a EFI_FILE_HANDLE somewhere lower on the\r
- directory 'stack'.\r
+ directory 'stack'. If the file is a directory, then append the '\' char at the \r
+ end of name string. If it's not a directory, then the last '\' should not be \r
+ added.\r
\r
if Handle is NULL, return EFI_INVALID_PARAMETER\r
\r
break;\r
} else {\r
//\r
- // We got info... do we have a name? if yes preceed the current path with it...\r
+ // We got info... do we have a name? if yes precede the current path with it...\r
//\r
if (StrLen (FileInfo->FileName) == 0) {\r
if (*FullFileName == NULL) {\r
*FullFileName = StrnCatGrowLeft(FullFileName, &Size, L"\\", 0);\r
}\r
\r
+ if (*FullFileName != NULL && \r
+ (*FullFileName)[StrLen(*FullFileName) - 1] == L'\\' && \r
+ StrLen(*FullFileName) > 1 &&\r
+ FileHandleIsDirectory(Handle) == EFI_NOT_FOUND\r
+ ) {\r
+ (*FullFileName)[StrLen(*FullFileName) - 1] = CHAR_NULL;\r
+ }\r
+\r
if (CurrentHandle != NULL) {\r
CurrentHandle->Close (CurrentHandle);\r
}\r
EFI_STATUS Status;\r
CHAR16 CharBuffer;\r
UINTN Size;\r
+ UINTN Index;\r
UINTN CharSize;\r
UINT64 FileSize;\r
UINT64 OriginalFilePosition;\r
if (AsciiBuffer == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- UnicodeStrToAsciiStr (Buffer, AsciiBuffer);\r
+ UnicodeStrToAsciiStrS (Buffer, AsciiBuffer, Size);\r
+ for (Index = 0; Index < Size; Index++) {\r
+ if ((AsciiBuffer[Index] & BIT7) != 0) {\r
+ FreePool(AsciiBuffer);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
\r
Size = AsciiStrSize(AsciiBuffer) - sizeof(CHAR8);\r
Status = FileHandleWrite(Handle, &Size, AsciiBuffer);\r
@param[in] Format the format argument (see printlib for format specifier)\r
@param[in] ... the variable arguments for the format\r
\r
- @retval EFI_SUCCESS the operation was sucessful\r
+ @retval EFI_SUCCESS the operation was successful\r
@return other a return value from FileHandleWriteLine\r
\r
@sa FileHandleWriteLine\r