X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Nt32Pkg%2FWinNtGopDxe%2FWinNtGopDriver.c;fp=Nt32Pkg%2FWinNtGopDxe%2FWinNtGopDriver.c;h=ae29da7850b14c823d5bd2c7f653302819722d51;hp=5f1f2c1cf073f10004d23e5889a2ea75fdb2db3c;hb=62cf113f2e3741e498d22df1cf5d347fab654e57;hpb=f3d1e94028e0b1d6cefda99056d12d98e53e63a8 diff --git a/Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c b/Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c index 5f1f2c1cf0..ae29da7850 100644 --- a/Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c +++ b/Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c @@ -21,33 +21,46 @@ Abstract: **/ +#include "WinNtGop.h" -// -// The package level header files this module uses -// -#include -#include -// -// The protocols, PPI and GUID defintions for this module -// -#include -#include -#include -#include -#include -#include -// -// The Library classes this module consumes -// -#include -#include -#include -#include -#include -#include -#include +STATIC +EFI_STATUS +FreeNotifyList ( + IN OUT LIST_ENTRY *ListHead + ) +/*++ -#include "WinNtGop.h" +Routine Description: + +Arguments: + + ListHead - The list head + +Returns: + + EFI_SUCCESS - Free the notify list successfully + EFI_INVALID_PARAMETER - ListHead is invalid. + +--*/ +{ + WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode; + + if (ListHead == NULL) { + return EFI_INVALID_PARAMETER; + } + while (!IsListEmpty (ListHead)) { + NotifyNode = CR ( + ListHead->ForwardLink, + WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY, + NotifyEntry, + WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE + ); + RemoveEntryList (ListHead->ForwardLink); + gBS->FreePool (NotifyNode); + } + + return EFI_SUCCESS; +} EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = { WinNtGopDriverBindingSupported, @@ -188,6 +201,7 @@ WinNtGopDriverBindingStart ( Private = NULL; Private = AllocatePool (sizeof (GOP_PRIVATE_DATA)); if (Private == NULL) { + Status = EFI_OUT_OF_RESOURCES; goto Done; } // @@ -230,6 +244,8 @@ WinNtGopDriverBindingStart ( &Private->GraphicsOutput, &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn, + &gEfiSimpleTextInputExProtocolGuid, + &Private->SimpleTextInEx, NULL ); @@ -251,6 +267,13 @@ Done: FreeUnicodeStringTable (Private->ControllerNameTable); } + if (Private->SimpleTextIn.WaitForKey != NULL) { + gBS->CloseEvent (Private->SimpleTextIn.WaitForKey); + } + if (Private->SimpleTextInEx.WaitForKeyEx != NULL) { + gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx); + } + FreeNotifyList (&Private->NotifyList); FreePool (Private); } } @@ -313,6 +336,8 @@ WinNtGopDriverBindingStop ( &Private->GraphicsOutput, &gEfiSimpleTextInProtocolGuid, &Private->SimpleTextIn, + &gEfiSimpleTextInputExProtocolGuid, + &Private->SimpleTextInEx, NULL ); if (!EFI_ERROR (Status)) { @@ -335,8 +360,13 @@ WinNtGopDriverBindingStop ( // Free our instance data // FreeUnicodeStringTable (Private->ControllerNameTable); + Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey); + ASSERT_EFI_ERROR (Status); + Status = gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx); + ASSERT_EFI_ERROR (Status); + FreeNotifyList (&Private->NotifyList); - FreePool (Private); + gBS->FreePool (Private); }