X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FApplication%2FShell%2FConsoleWrappers.c;h=a0861e6a1d2390be7ab345a11ead4814ab1015c3;hb=ba0014b9f8ae1a593f03e744f26008214c2b06a8;hp=04a7513a3346fabb272c70c58c74bfe184e7f190;hpb=48cb33ec30c1b38664ed6b541c4ab61d6226d84b;p=mirror_edk2.git diff --git a/ShellPkg/Application/Shell/ConsoleWrappers.c b/ShellPkg/Application/Shell/ConsoleWrappers.c index 04a7513a33..a0861e6a1d 100644 --- a/ShellPkg/Application/Shell/ConsoleWrappers.c +++ b/ShellPkg/Application/Shell/ConsoleWrappers.c @@ -2,7 +2,7 @@ Function definitions for shell simple text in and out on top of file handles. (C) Copyright 2013 Hewlett-Packard Development Company, L.P.
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -105,7 +105,7 @@ FileBasedSimpleTextInReadKeyStroke( CharSize = sizeof(CHAR16); } else { CharSize = sizeof(CHAR8); - } + } // // Decrement the amount of free space by Size or set to zero (for odd length files) // @@ -123,7 +123,7 @@ FileBasedSimpleTextInReadKeyStroke( } /** - Function to create a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a + Function to create a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting input from a file. @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. @@ -133,7 +133,6 @@ FileBasedSimpleTextInReadKeyStroke( @return A pointer to the allocated protocol structure; **/ EFI_SIMPLE_TEXT_INPUT_PROTOCOL* -EFIAPI CreateSimpleTextInOnFile( IN SHELL_FILE_HANDLE FileHandleToUse, IN EFI_HANDLE *HandleLocation @@ -163,7 +162,7 @@ CreateSimpleTextInOnFile( ProtocolToReturn->FileHandle = FileHandleToUse; ProtocolToReturn->SimpleTextIn.Reset = FileBasedSimpleTextInReset; ProtocolToReturn->SimpleTextIn.ReadKeyStroke = FileBasedSimpleTextInReadKeyStroke; - + Status = gBS->CreateEvent ( EVT_NOTIFY_WAIT, TPL_NOTIFY, @@ -178,9 +177,9 @@ CreateSimpleTextInOnFile( } ///@todo possibly also install SimpleTextInputEx on the handle at this point. Status = gBS->InstallProtocolInterface( - &(ProtocolToReturn->TheHandle), - &gEfiSimpleTextInProtocolGuid, - EFI_NATIVE_INTERFACE, + &(ProtocolToReturn->TheHandle), + &gEfiSimpleTextInProtocolGuid, + EFI_NATIVE_INTERFACE, &(ProtocolToReturn->SimpleTextIn)); if (!EFI_ERROR(Status)) { *HandleLocation = ProtocolToReturn->TheHandle; @@ -192,7 +191,7 @@ CreateSimpleTextInOnFile( } /** - Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a + Function to close a EFI_SIMPLE_TEXT_INPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting input from a file. @param[in] SimpleTextIn The pointer to the SimpleTextIn to close. @@ -200,7 +199,6 @@ CreateSimpleTextInOnFile( @retval EFI_SUCCESS The object was closed. **/ EFI_STATUS -EFIAPI CloseSimpleTextInOnFile( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *SimpleTextIn ) @@ -215,8 +213,8 @@ CloseSimpleTextInOnFile( Status = gBS->CloseEvent(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL *)SimpleTextIn)->SimpleTextIn.WaitForKey); Status1 = gBS->UninstallProtocolInterface( - ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle, - &gEfiSimpleTextInProtocolGuid, + ((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->TheHandle, + &gEfiSimpleTextInProtocolGuid, &(((SHELL_EFI_SIMPLE_TEXT_INPUT_PROTOCOL*)SimpleTextIn)->SimpleTextIn)); FreePool(SimpleTextIn); @@ -285,9 +283,9 @@ FileBasedSimpleTextOutQueryMode ( ) { EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *PassThruProtocol; - + PassThruProtocol = ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)This)->OriginalSimpleTextOut; - + // Pass the QueryMode call thru to the original SimpleTextOutProtocol return (PassThruProtocol->QueryMode( PassThruProtocol, @@ -423,7 +421,7 @@ FileBasedSimpleTextOutOutputString ( } /** - Function to create a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a + Function to create a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting output from a file. @param[in] FileHandleToUse The pointer to the SHELL_FILE_HANDLE to use. @@ -434,7 +432,6 @@ FileBasedSimpleTextOutOutputString ( @return A pointer to the allocated protocol structure; **/ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* -EFIAPI CreateSimpleTextOutOnFile( IN SHELL_FILE_HANDLE FileHandleToUse, IN EFI_HANDLE *HandleLocation, @@ -476,21 +473,22 @@ CreateSimpleTextOutOnFile( ProtocolToReturn->SimpleTextOut.Mode->CursorVisible = OriginalProtocol->Mode->CursorVisible; Status = gBS->InstallProtocolInterface( - &(ProtocolToReturn->TheHandle), - &gEfiSimpleTextOutProtocolGuid, - EFI_NATIVE_INTERFACE, + &(ProtocolToReturn->TheHandle), + &gEfiSimpleTextOutProtocolGuid, + EFI_NATIVE_INTERFACE, &(ProtocolToReturn->SimpleTextOut)); if (!EFI_ERROR(Status)) { *HandleLocation = ProtocolToReturn->TheHandle; return ((EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)ProtocolToReturn); } else { - FreePool(ProtocolToReturn); + SHELL_FREE_NON_NULL(ProtocolToReturn->SimpleTextOut.Mode); + SHELL_FREE_NON_NULL(ProtocolToReturn); return (NULL); } } /** - Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a + Function to close a EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL on top of a SHELL_FILE_HANDLE to support redirecting output from a file. @param[in] SimpleTextOut The pointer to the SimpleTextOUT to close. @@ -498,7 +496,6 @@ CreateSimpleTextOutOnFile( @retval EFI_SUCCESS The object was closed. **/ EFI_STATUS -EFIAPI CloseSimpleTextOutOnFile( IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut ) @@ -508,9 +505,10 @@ CloseSimpleTextOutOnFile( return (EFI_INVALID_PARAMETER); } Status = gBS->UninstallProtocolInterface( - ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle, - &gEfiSimpleTextOutProtocolGuid, + ((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->TheHandle, + &gEfiSimpleTextOutProtocolGuid, &(((SHELL_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL*)SimpleTextOut)->SimpleTextOut)); + FreePool(SimpleTextOut->Mode); FreePool(SimpleTextOut); return (Status); }