STATIC EFI_HANDLE mEfiShellEnvironment2Handle;\r
STATIC FILE_HANDLE_FUNCTION_MAP FileFunctionMap;\r
STATIC UINTN mTotalParameterCount;\r
-\r
+STATIC CHAR16 *mPostReplaceFormat;\r
+STATIC CHAR16 *mPostReplaceFormat2;\r
/**\r
Check if a Unicode character is a hexadecimal character.\r
\r
) {\r
EFI_STATUS Status;\r
\r
+ ASSERT(PcdGet16 (PcdShellLibMaxPrintBufferSize) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
+ mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellLibMaxPrintBufferSize));\r
+ ASSERT (mPostReplaceFormat != NULL);\r
+ mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellLibMaxPrintBufferSize));\r
+ ASSERT (mPostReplaceFormat2 != NULL);\r
+\r
//\r
// Set the parameter count to an invalid number\r
//\r
mEfiShellParametersProtocol = NULL;\r
mEfiShellInterface = NULL;\r
mEfiShellEnvironment2Handle = NULL;\r
+ mPostReplaceFormat = NULL;\r
+ mPostReplaceFormat2 = NULL;\r
\r
//\r
// verify that auto initialize is not set false\r
mEfiShellParametersProtocol = NULL;\r
}\r
mEfiShellEnvironment2Handle = NULL;\r
+\r
+ if (mPostReplaceFormat != NULL) {\r
+ FreePool(mPostReplaceFormat);\r
+ }\r
+ if (mPostReplaceFormat2 != NULL) {\r
+ FreePool(mPostReplaceFormat2);\r
+ }\r
+ mPostReplaceFormat = NULL;\r
+ mPostReplaceFormat2 = NULL;\r
+\r
return (EFI_SUCCESS);\r
}\r
\r
return (mEfiShellParametersProtocol->StdOut->Write(mEfiShellParametersProtocol->StdOut, &Size, (VOID*)String));\r
}\r
if (mEfiShellInterface != NULL) {\r
+ //\r
+ // Divide in half for old shell. Must be string length not size.\r
+ //\r
+ Size /= 2;\r
return ( mEfiShellInterface->StdOut->Write(mEfiShellInterface->StdOut, &Size, (VOID*)String));\r
}\r
ASSERT(FALSE);\r
VA_LIST Marker\r
) \r
{\r
- UINTN BufferSize;\r
- CHAR16 *PostReplaceFormat;\r
- CHAR16 *PostReplaceFormat2;\r
UINTN Return;\r
EFI_STATUS Status;\r
UINTN NormalAttribute;\r
CHAR16 *ResumeLocation;\r
CHAR16 *FormatWalker;\r
\r
- BufferSize = PcdGet16 (PcdShellLibMaxPrintBufferSize);\r
- ASSERT(PcdGet16 (PcdShellLibMaxPrintBufferSize) < PcdGet32 (PcdMaximumUnicodeStringLength));\r
- PostReplaceFormat = AllocateZeroPool (BufferSize);\r
- ASSERT (PostReplaceFormat != NULL);\r
- PostReplaceFormat2 = AllocateZeroPool (BufferSize);\r
- ASSERT (PostReplaceFormat2 != NULL);\r
-\r
//\r
// Back and forth each time fixing up 1 of our flags...\r
//\r
- Status = CopyReplace(Format, PostReplaceFormat, BufferSize, L"%N", L"%%N");\r
+ Status = CopyReplace(Format, mPostReplaceFormat, PcdGet16 (PcdShellLibMaxPrintBufferSize), L"%N", L"%%N");\r
ASSERT_EFI_ERROR(Status);\r
- Status = CopyReplace(PostReplaceFormat, PostReplaceFormat2, BufferSize, L"%E", L"%%E");\r
+ Status = CopyReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellLibMaxPrintBufferSize), L"%E", L"%%E");\r
ASSERT_EFI_ERROR(Status);\r
- Status = CopyReplace(PostReplaceFormat2, PostReplaceFormat, BufferSize, L"%H", L"%%H");\r
+ Status = CopyReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellLibMaxPrintBufferSize), L"%H", L"%%H");\r
ASSERT_EFI_ERROR(Status);\r
- Status = CopyReplace(PostReplaceFormat, PostReplaceFormat2, BufferSize, L"%B", L"%%B");\r
+ Status = CopyReplace(mPostReplaceFormat, mPostReplaceFormat2, PcdGet16 (PcdShellLibMaxPrintBufferSize), L"%B", L"%%B");\r
ASSERT_EFI_ERROR(Status);\r
- Status = CopyReplace(PostReplaceFormat2, PostReplaceFormat, BufferSize, L"%V", L"%%V");\r
+ Status = CopyReplace(mPostReplaceFormat2, mPostReplaceFormat, PcdGet16 (PcdShellLibMaxPrintBufferSize), L"%V", L"%%V");\r
ASSERT_EFI_ERROR(Status);\r
\r
//\r
// Use the last buffer from replacing to print from...\r
//\r
- Return = UnicodeVSPrint (PostReplaceFormat2, BufferSize, PostReplaceFormat, Marker);\r
-\r
- FreePool(PostReplaceFormat);\r
+ Return = UnicodeVSPrint (mPostReplaceFormat2, PcdGet16 (PcdShellLibMaxPrintBufferSize), mPostReplaceFormat, Marker);\r
\r
if (Col != -1 && Row != -1) {\r
Status = gST->ConOut->SetCursorPosition(gST->ConOut, Col, Row);\r
}\r
\r
NormalAttribute = gST->ConOut->Mode->Attribute;\r
- FormatWalker = PostReplaceFormat2;\r
+ FormatWalker = mPostReplaceFormat2;\r
while (*FormatWalker != CHAR_NULL) {\r
//\r
// Find the next attribute change request\r
FormatWalker = ResumeLocation + 2;\r
}\r
\r
- FreePool(PostReplaceFormat2);\r
-\r
return (Return);\r
}\r
\r
EFI_STATUS Status;\r
EFI_FILE_HANDLE Handle;\r
\r
+ ASSERT(DirName != NULL);\r
+\r
Handle = NULL;\r
\r
Status = ShellOpenFileByName(DirName, &Handle, EFI_FILE_MODE_READ, 0);\r
EFI_STATUS Status;\r
EFI_FILE_HANDLE Handle;\r
\r
+ ASSERT(Name != NULL);\r
+\r
Handle = NULL;\r
\r
Status = ShellOpenFileByName(Name, &Handle, EFI_FILE_MODE_READ, 0);\r