STATIC EFI_HANDLE mEfiShellEnvironment2Handle;\r
STATIC FILE_HANDLE_FUNCTION_MAP FileFunctionMap;\r
STATIC UINTN mTotalParameterCount;\r
+STATIC EFI_FILE_HANDLE StdOut;\r
+STATIC EFI_FILE_HANDLE StdErr;\r
\r
/**\r
Check if a Unicode character is a hexadecimal character.\r
return (EFI_SUCCESS);\r
}\r
\r
+/**\r
+ Internal worker function to output a string.\r
+\r
+ This function will output a string to the correct StdOut.\r
+\r
+ @param[in] String The string to print out.\r
+\r
+ @retval EFI_SUCCESS The operation was sucessful.\r
+ @retval !EFI_SUCCESS The operation failed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InternalPrintTo (\r
+ IN CONST CHAR16 *String\r
+ )\r
+{\r
+ UINTN Size;\r
+ Size = StrSize(String) - sizeof(CHAR16);\r
+ if (mEfiShellParametersProtocol != NULL) {\r
+ return (mEfiShellParametersProtocol->StdOut->Write(mEfiShellParametersProtocol->StdOut, &Size, (VOID*)String));\r
+ }\r
+ if (mEfiShellInterface != NULL) {\r
+ return ( mEfiShellInterface->StdOut->Write(mEfiShellInterface->StdOut, &Size, (VOID*)String));\r
+ }\r
+ ASSERT(FALSE);\r
+ return (EFI_UNSUPPORTED);\r
+}\r
+\r
/**\r
Print at a specific location on the screen.\r
\r
CHAR16 *ResumeLocation;\r
CHAR16 *FormatWalker;\r
\r
- BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);\r
+ BufferSize = PcdGet16 (PcdShellLibMaxPrintBufferSize);\r
+ ASSERT(PcdGet16 (PcdShellLibMaxPrintBufferSize) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
PostReplaceFormat = AllocateZeroPool (BufferSize);\r
ASSERT (PostReplaceFormat != NULL);\r
PostReplaceFormat2 = AllocateZeroPool (BufferSize);\r
//\r
// print the current FormatWalker string\r
//\r
- Status = gST->ConOut->OutputString(gST->ConOut, FormatWalker);\r
+ Status = InternalPrintTo(FormatWalker);\r
ASSERT_EFI_ERROR(Status);\r
//\r
// update the attribute\r
gST->ConOut->SetAttribute(gST->ConOut, EFI_TEXT_ATTR(EFI_GREEN, ((NormalAttribute&(BIT4|BIT5|BIT6))>>4)));\r
break;\r
default:\r
- ASSERT(FALSE);\r
+ //\r
+ // Print a simple '%' symbol\r
+ //\r
+ Status = InternalPrintTo(L"%");\r
+ ASSERT_EFI_ERROR(Status);\r
+ ResumeLocation = ResumeLocation - 1;\r
break;\r
}\r
} else {\r
/**\r
Print at a specific location on the screen.\r
\r
- This function will move the cursor to a given screen location and print the specified string\r
+ This function will move the cursor to a given screen location and print the specified string.\r
\r
If -1 is specified for either the Row or Col the current screen location for BOTH \r
will be used.\r
\r
- if either Row or Col is out of range for the current console, then ASSERT\r
- if Format is NULL, then ASSERT\r
+ If either Row or Col is out of range for the current console, then ASSERT.\r
+ If Format is NULL, then ASSERT.\r
\r
In addition to the standard %-based flags as supported by UefiLib Print() this supports \r
the following additional flags:\r
) \r
{\r
VA_LIST Marker;\r
+ EFI_STATUS Status;\r
VA_START (Marker, Format);\r
- return (InternalShellPrintWorker(Col, Row, Format, Marker));\r
+ Status = InternalShellPrintWorker(Col, Row, Format, Marker);\r
+ VA_END(Marker);\r
+ return(Status);\r
}\r
\r
/**\r
Print at a specific location on the screen.\r
\r
- This function will move the cursor to a given screen location, print the specified string, \r
- and return the cursor to the original locaiton. \r
+ This function will move the cursor to a given screen location and print the specified string.\r
\r
If -1 is specified for either the Row or Col the current screen location for BOTH \r
- will be used and the cursor's position will not be moved back to an original location.\r
+ will be used.\r
\r
- if either Row or Col is out of range for the current console, then ASSERT\r
- if Format is NULL, then ASSERT\r
+ If either Row or Col is out of range for the current console, then ASSERT.\r
+ If Format is NULL, then ASSERT.\r
\r
In addition to the standard %-based flags as supported by UefiLib Print() this supports \r
the following additional flags:\r
RetVal = InternalShellPrintWorker(Col, Row, HiiFormatString, Marker);\r
\r
FreePool(HiiFormatString);\r
+ VA_END(Marker);\r
\r
return (RetVal);\r
}\r