Member functions of EFI_SHELL_PARAMETERS_PROTOCOL and functions for creation,\r
manipulation, and initialization of EFI_SHELL_PARAMETERS_PROTOCOL.\r
\r
+ Copyright (C) 2014, Red Hat, Inc.\r
Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\r
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
return (EFI_SUCCESS);\r
}\r
\r
+/**\r
+ Write the unicode file tag to the specified file.\r
+\r
+ It is the caller's responsibility to ensure that\r
+ ShellInfoObject.NewEfiShellProtocol has been initialized before calling this\r
+ function.\r
+\r
+ @param[in] FileHandle The file to write the unicode file tag to.\r
+\r
+ @return Status code from ShellInfoObject.NewEfiShellProtocol->WriteFile.\r
+**/\r
+STATIC\r
+EFI_STATUS\r
+WriteFileTag (\r
+ IN SHELL_FILE_HANDLE FileHandle\r
+ )\r
+{\r
+ CHAR16 FileTag;\r
+ UINTN Size;\r
+ EFI_STATUS Status;\r
+\r
+ FileTag = gUnicodeFileTag;\r
+ Size = sizeof FileTag;\r
+ Status = ShellInfoObject.NewEfiShellProtocol->WriteFile (FileHandle, &Size,\r
+ &FileTag);\r
+ ASSERT (EFI_ERROR (Status) || Size == sizeof FileTag);\r
+ return Status;\r
+}\r
+\r
+\r
/**\r
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol\r
structure by parsing NewCommandLine. The current values are returned to the\r
BOOLEAN OutAppend;\r
BOOLEAN ErrAppend;\r
UINTN Size;\r
- CHAR16 TagBuffer[2];\r
SPLIT_LIST *Split;\r
CHAR16 *FirstLocation;\r
\r
}\r
Status = ShellOpenFileByName(StdErrFileName, &TempHandle, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE,0);\r
if (!ErrAppend && ErrUnicode && !EFI_ERROR(Status)) {\r
- //\r
- // Write out the gUnicodeFileTag\r
- //\r
- Size = sizeof(CHAR16);\r
- TagBuffer[0] = gUnicodeFileTag;\r
- TagBuffer[1] = CHAR_NULL;\r
- ShellInfoObject.NewEfiShellProtocol->WriteFile(TempHandle, &Size, TagBuffer);\r
+ Status = WriteFileTag (TempHandle);\r
}\r
if (!ErrUnicode && !EFI_ERROR(Status)) {\r
TempHandle = CreateFileInterfaceFile(TempHandle, FALSE);\r
if (StrStr(StdOutFileName, L"NUL")==StdOutFileName) {\r
//no-op\r
} else if (!OutAppend && OutUnicode && !EFI_ERROR(Status)) {\r
- //\r
- // Write out the gUnicodeFileTag\r
- //\r
- Size = sizeof(CHAR16);\r
- TagBuffer[0] = gUnicodeFileTag;\r
- TagBuffer[1] = CHAR_NULL;\r
- ShellInfoObject.NewEfiShellProtocol->WriteFile(TempHandle, &Size, TagBuffer);\r
+ Status = WriteFileTag (TempHandle);\r
} else if (OutAppend) {\r
//\r
// Move to end of file\r