}\r
\r
/**\r
- Function to read a single line (up to but not including the \n) from a EFI_FILE_HANDLE.\r
+ Function to read a single line (up to but not including the \n) from a file.\r
\r
If the position upon start is 0, then the Ascii Boolean will be set. This should be\r
maintained and not changed for all operations with the same file.\r
\r
- @param[in] Handle FileHandle to read from\r
- @param[in, out] Buffer pointer to buffer to read into\r
- @param[in, out] Size pointer to number of bytes in buffer\r
- @param[in] Truncate if TRUE then allows for truncation of the line to fit.\r
- if FALSE will reset the position to the begining of the\r
- line if the buffer is not large enough.\r
- @param[in, out] Ascii Boolean value for indicating whether the file is Ascii (TRUE) or UCS2 (FALSE);\r
-\r
- @retval EFI_SUCCESS the operation was sucessful. the line is stored in\r
+ @param[in] Handle FileHandle to read from.\r
+ @param[in, out] Buffer The pointer to buffer to read into.\r
+ @param[in, out] Size The pointer to number of bytes in Buffer.\r
+ @param[in] Truncate If the buffer is large enough, this has no effect.\r
+ If the buffer is is too small and Truncate is TRUE,\r
+ the line will be truncated.\r
+ If the buffer is is too small and Truncate is FALSE,\r
+ then no read will occur.\r
+\r
+ @param[in, out] Ascii Boolean value for indicating whether the file is\r
+ Ascii (TRUE) or UCS2 (FALSE).\r
+\r
+ @retval EFI_SUCCESS The operation was successful. The line is stored in\r
Buffer.\r
@retval EFI_INVALID_PARAMETER Handle was NULL.\r
@retval EFI_INVALID_PARAMETER Size was NULL.\r
- @retval EFI_BUFFER_TOO_SMALL Size was not enough space to store the line.\r
- Size was updated to minimum space required.\r
+ @retval EFI_BUFFER_TOO_SMALL Size was not large enough to store the line.\r
+ Size was updated to the minimum space required.\r
@sa FileHandleRead\r
**/\r
EFI_STATUS\r
{\r
EFI_STATUS Status;\r
CHAR16 CharBuffer;\r
+ UINT64 FileSize;\r
UINTN CharSize;\r
UINTN CountSoFar;\r
UINT64 OriginalFilePosition;\r
\r
-\r
if (Handle == NULL\r
||Size == NULL\r
||(Buffer==NULL&&*Size!=0)\r
){\r
return (EFI_INVALID_PARAMETER);\r
- }\r
+ } \r
+ \r
if (Buffer != NULL) {\r
*Buffer = CHAR_NULL;\r
}\r
+ \r
+ Status = FileHandleGetSize (Handle, &FileSize);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ } else if (FileSize == 0) {\r
+ return EFI_SUCCESS;\r
+ } \r
+ \r
FileHandleGetPosition(Handle, &OriginalFilePosition);\r
if (OriginalFilePosition == 0) {\r
CharSize = sizeof(CHAR16);\r