]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/EmuGopDxe/GopInput.c
EmulatorPkg: stop abusing EFI_HANDLE for keystroke notify registration
[mirror_edk2.git] / EmulatorPkg / EmuGopDxe / GopInput.c
index 1d40b1d7d682e308168b92481c1ef35c3a3529e5..2a23564a21730e56e19e28ec98f755f6880f685f 100644 (file)
@@ -1,14 +1,8 @@
 /*++ @file\r
 \r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2010 0 2011,Apple Inc. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 \r
 **/\r
@@ -442,11 +436,20 @@ EmuGopSimpleTextInExSetState (
   EFI_STATUS        Status;\r
   EFI_TPL           OldTpl;\r
 \r
+  if (KeyToggleState == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This);\r
   if (Private->EmuGraphicsWindow == NULL) {\r
     return EFI_NOT_READY;\r
   }\r
 \r
+  if (((Private->KeyState.KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID) ||\r
+      ((*KeyToggleState & EFI_TOGGLE_STATE_VALID) != EFI_TOGGLE_STATE_VALID)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Enter critical section\r
   //\r
@@ -514,7 +517,7 @@ EmuGopSimpleTextInExRegisterKeyNotify (
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
   IN EFI_KEY_DATA                       *KeyData,\r
   IN EFI_KEY_NOTIFY_FUNCTION            KeyNotificationFunction,\r
-  OUT EFI_HANDLE                        *NotifyHandle\r
+  OUT VOID                              **NotifyHandle\r
   )\r
 {\r
   EFI_STATUS                          Status;\r
@@ -597,7 +600,7 @@ EFI_STATUS
 EFIAPI\r
 EmuGopSimpleTextInExUnregisterKeyNotify (\r
   IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL  *This,\r
-  IN EFI_HANDLE                         NotificationHandle\r
+  IN VOID                               *NotificationHandle\r
   )\r
 /*++\r
 \r