3 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 This file produces the Simple Text In for an Gop window.
20 This stuff is linked at the hip to the Window, since the window
21 processing is done in a thread kicked off in WinNtGopImplementation.c
23 Since the window information is processed in an other thread we need
24 a keyboard Queue to pass data about. The Simple Text In code just
25 takes data off the Queue. The WinProc message loop takes keyboard input
26 and places it in the Queue.
36 TODO: Add function description
38 @param Private TODO: add argument description
40 @retval EFI_SUCCESS TODO: Add description for return value
45 IN GOP_PRIVATE_DATA
*Private
,
46 IN GOP_QUEUE_FIXED
*Queue
49 Private
->WinNtThunk
->InitializeCriticalSection (&Queue
->Cs
);
57 TODO: Add function description
59 @param Private TODO: add argument description
61 @retval EFI_SUCCESS TODO: Add description for return value
66 IN GOP_PRIVATE_DATA
*Private
,
67 IN GOP_QUEUE_FIXED
*Queue
72 Private
->WinNtThunk
->DeleteCriticalSection (&Queue
->Cs
);
78 TODO: Add function description
80 @param Private TODO: add argument description
81 @param Key TODO: add argument description
83 @retval EFI_NOT_READY TODO: Add description for return value
84 @retval EFI_SUCCESS TODO: Add description for return value
89 IN GOP_PRIVATE_DATA
*Private
,
90 IN GOP_QUEUE_FIXED
*Queue
,
91 IN EFI_KEY_DATA
*KeyData
94 Private
->WinNtThunk
->EnterCriticalSection (&Queue
->Cs
);
96 if ((Queue
->Rear
+ 1) % MAX_Q
== Queue
->Front
) {
97 Private
->WinNtThunk
->LeaveCriticalSection (&Queue
->Cs
);
101 CopyMem (&Queue
->Q
[Queue
->Rear
], KeyData
, sizeof (EFI_KEY_DATA
));
102 Queue
->Rear
= (Queue
->Rear
+ 1) % MAX_Q
;
104 Private
->WinNtThunk
->LeaveCriticalSection (&Queue
->Cs
);
110 TODO: Add function description
112 @param Private TODO: add argument description
113 @param Key TODO: add argument description
115 @retval EFI_NOT_READY TODO: Add description for return value
116 @retval EFI_SUCCESS TODO: Add description for return value
121 IN GOP_PRIVATE_DATA
*Private
,
122 IN GOP_QUEUE_FIXED
*Queue
,
123 OUT EFI_KEY_DATA
*Key
126 Private
->WinNtThunk
->EnterCriticalSection (&Queue
->Cs
);
128 if (Queue
->Front
== Queue
->Rear
) {
129 Private
->WinNtThunk
->LeaveCriticalSection (&Queue
->Cs
);
130 return EFI_NOT_READY
;
133 CopyMem (Key
, &Queue
->Q
[Queue
->Front
], sizeof (EFI_KEY_DATA
));
134 Queue
->Front
= (Queue
->Front
+ 1) % MAX_Q
;
136 Private
->WinNtThunk
->LeaveCriticalSection (&Queue
->Cs
);
142 TODO: Add function description
144 @param Private TODO: add argument description
146 @retval EFI_NOT_READY TODO: Add description for return value
147 @retval EFI_SUCCESS TODO: Add description for return value
152 IN GOP_QUEUE_FIXED
*Queue
155 if (Queue
->Front
== Queue
->Rear
) {
156 return EFI_NOT_READY
;
163 GopPrivateIsKeyRegistered (
164 IN EFI_KEY_DATA
*RegsiteredData
,
165 IN EFI_KEY_DATA
*InputData
173 RegsiteredData - A pointer to a buffer that is filled in with the keystroke
174 state data for the key that was registered.
175 InputData - A pointer to a buffer that is filled in with the keystroke
176 state data for the key that was pressed.
179 TRUE - Key be pressed matches a registered key.
180 FLASE - Match failed.
184 ASSERT (RegsiteredData
!= NULL
&& InputData
!= NULL
);
186 if ((RegsiteredData
->Key
.ScanCode
!= InputData
->Key
.ScanCode
) ||
187 (RegsiteredData
->Key
.UnicodeChar
!= InputData
->Key
.UnicodeChar
)) {
192 // Assume KeyShiftState/KeyToggleState = 0 in Registered key data means these state could be ignored.
194 if (RegsiteredData
->KeyState
.KeyShiftState
!= 0 &&
195 RegsiteredData
->KeyState
.KeyShiftState
!= InputData
->KeyState
.KeyShiftState
) {
198 if (RegsiteredData
->KeyState
.KeyToggleState
!= 0 &&
199 RegsiteredData
->KeyState
.KeyToggleState
!= InputData
->KeyState
.KeyToggleState
) {
209 GopPrivateInvokeRegisteredFunction (
210 IN GOP_PRIVATE_DATA
*Private
,
211 IN EFI_KEY_DATA
*KeyData
217 This function updates the status light of NumLock, ScrollLock and CapsLock.
221 Private - The private structure of WinNt Gop device.
222 KeyData - A pointer to a buffer that is filled in with the keystroke
223 state data for the key that was pressed.
227 EFI_SUCCESS - The status light is updated successfully.
232 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*CurrentNotify
;
234 for (Link
= Private
->NotifyList
.ForwardLink
; Link
!= &Private
->NotifyList
; Link
= Link
->ForwardLink
) {
237 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
,
239 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
241 if (GopPrivateIsKeyRegistered (&CurrentNotify
->KeyData
, KeyData
)) {
242 CurrentNotify
->KeyNotificationFn (KeyData
);
248 WinNtGopSimpleTextInTimerHandler (
253 GOP_PRIVATE_DATA
*Private
;
254 EFI_KEY_DATA KeyData
;
256 Private
= (GOP_PRIVATE_DATA
*)Context
;
257 while (GopPrivateDeleteQ (Private
, &Private
->QueueForNotify
, &KeyData
) == EFI_SUCCESS
) {
258 GopPrivateInvokeRegisteredFunction (Private
, &KeyData
);
263 TODO: Add function description
265 @param Private TODO: add argument description
266 @param Key TODO: add argument description
268 @retval EFI_NOT_READY TODO: Add description for return value
269 @retval EFI_SUCCESS TODO: Add description for return value
274 IN GOP_PRIVATE_DATA
*Private
,
278 EFI_KEY_DATA KeyData
;
282 KeyData
.KeyState
.KeyShiftState
= EFI_SHIFT_STATE_VALID
;
283 KeyData
.KeyState
.KeyToggleState
= EFI_TOGGLE_STATE_VALID
;
286 // Record Key shift state and toggle state
288 if (Private
->LeftCtrl
) {
289 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_CONTROL_PRESSED
;
291 if (Private
->RightCtrl
) {
292 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_CONTROL_PRESSED
;
294 if (Private
->LeftAlt
) {
295 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_ALT_PRESSED
;
297 if (Private
->RightAlt
) {
298 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_ALT_PRESSED
;
300 if (Private
->LeftShift
) {
301 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_SHIFT_PRESSED
;
303 if (Private
->RightShift
) {
304 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_SHIFT_PRESSED
;
306 if (Private
->LeftLogo
) {
307 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_LOGO_PRESSED
;
309 if (Private
->RightLogo
) {
310 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_LOGO_PRESSED
;
313 KeyData
.KeyState
.KeyShiftState
|= EFI_MENU_KEY_PRESSED
;
315 if (Private
->SysReq
) {
316 KeyData
.KeyState
.KeyShiftState
|= EFI_SYS_REQ_PRESSED
;
318 if (Private
->CapsLock
) {
319 KeyData
.KeyState
.KeyToggleState
|= EFI_CAPS_LOCK_ACTIVE
;
321 if (Private
->NumLock
) {
322 KeyData
.KeyState
.KeyToggleState
|= EFI_NUM_LOCK_ACTIVE
;
324 if (Private
->ScrollLock
) {
325 KeyData
.KeyState
.KeyToggleState
|= EFI_SCROLL_LOCK_ACTIVE
;
329 // Convert Ctrl+[1-26] to Ctrl+[A-Z]
331 if ((Private
->LeftCtrl
|| Private
->RightCtrl
) &&
332 (KeyData
.Key
.UnicodeChar
>= 1) && (KeyData
.Key
.UnicodeChar
<= 26)
334 if ((Private
->LeftShift
|| Private
->RightShift
) == Private
->CapsLock
) {
335 KeyData
.Key
.UnicodeChar
= (CHAR16
)(KeyData
.Key
.UnicodeChar
+ L
'a' - 1);
337 KeyData
.Key
.UnicodeChar
= (CHAR16
)(KeyData
.Key
.UnicodeChar
+ L
'A' - 1);
342 // Unmask the Shift bit for printable char
344 if (((KeyData
.Key
.UnicodeChar
>= L
'a') && (KeyData
.Key
.UnicodeChar
<= L
'z')) ||
345 ((KeyData
.Key
.UnicodeChar
>= L
'A') && (KeyData
.Key
.UnicodeChar
<= L
'Z'))
347 KeyData
.KeyState
.KeyShiftState
&= ~(EFI_LEFT_SHIFT_PRESSED
| EFI_RIGHT_SHIFT_PRESSED
);
350 GopPrivateAddQ (Private
, &Private
->QueueForNotify
, &KeyData
);
353 // Convert Ctrl+[A-Z] to Ctrl+[1-26]
355 if (Private
->LeftCtrl
|| Private
->RightCtrl
) {
356 if ((KeyData
.Key
.UnicodeChar
>= L
'a') && (KeyData
.Key
.UnicodeChar
<= L
'z')) {
357 KeyData
.Key
.UnicodeChar
= (CHAR16
)(KeyData
.Key
.UnicodeChar
- L
'a' + 1);
358 } else if ((KeyData
.Key
.UnicodeChar
>= L
'A') && (KeyData
.Key
.UnicodeChar
<= L
'Z')) {
359 KeyData
.Key
.UnicodeChar
= (CHAR16
)(KeyData
.Key
.UnicodeChar
- L
'A' + 1);
362 GopPrivateAddQ (Private
, &Private
->QueueForRead
, &KeyData
);
368 GopPrivateUpdateStatusLight (
369 IN GOP_PRIVATE_DATA
*Private
375 This function updates the status light of NumLock, ScrollLock and CapsLock.
379 Private - The private structure of WinNt console In/Out.
383 EFI_SUCCESS - The status light is updated successfully.
388 // BUGBUG:Only SendInput/keybd_event function can toggle
389 // NumLock, CapsLock and ScrollLock keys.
390 // Neither of these functions is included in EFI_WIN_NT_THUNK_PROTOCOL.
391 // Thus, return immediately without operation.
399 GopPrivateResetWorker (
400 IN GOP_PRIVATE_DATA
*Private
406 This function is a worker function for SimpleTextIn/SimpleTextInEx.Reset().
410 Private - WinNT GOP private structure
414 EFI_SUCCESS - Reset successfully
418 EFI_KEY_DATA KeyData
;
422 // Enter critical section
424 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
427 // A reset is draining the Queue
429 while (GopPrivateDeleteQ (Private
, &Private
->QueueForRead
, &KeyData
) == EFI_SUCCESS
)
431 while (GopPrivateDeleteQ (Private
, &Private
->QueueForNotify
, &KeyData
) == EFI_SUCCESS
)
434 Private
->LeftShift
= FALSE
;
435 Private
->RightShift
= FALSE
;
436 Private
->LeftAlt
= FALSE
;
437 Private
->RightAlt
= FALSE
;
438 Private
->LeftCtrl
= FALSE
;
439 Private
->RightCtrl
= FALSE
;
440 Private
->LeftLogo
= FALSE
;
441 Private
->RightLogo
= FALSE
;
442 Private
->Menu
= FALSE
;
443 Private
->SysReq
= FALSE
;
445 Private
->CapsLock
= FALSE
;
446 Private
->NumLock
= FALSE
;
447 Private
->ScrollLock
= FALSE
;
449 Private
->KeyState
.KeyShiftState
= EFI_SHIFT_STATE_VALID
;
450 Private
->KeyState
.KeyToggleState
= EFI_TOGGLE_STATE_VALID
;
453 // Leave critical section and return
455 gBS
->RestoreTPL (OldTpl
);
461 GopPrivateReadKeyStrokeWorker (
462 IN GOP_PRIVATE_DATA
*Private
,
463 OUT EFI_KEY_DATA
*KeyData
468 Reads the next keystroke from the input device. The WaitForKey Event can
469 be used to test for existance of a keystroke via WaitForEvent () call.
472 Private - The private structure of WinNt Gop device.
473 KeyData - A pointer to a buffer that is filled in with the keystroke
474 state data for the key that was pressed.
477 EFI_SUCCESS - The keystroke information was returned.
478 EFI_NOT_READY - There was no keystroke data availiable.
479 EFI_DEVICE_ERROR - The keystroke information was not returned due to
481 EFI_INVALID_PARAMETER - KeyData is NULL.
488 if (KeyData
== NULL
) {
489 return EFI_INVALID_PARAMETER
;
493 // Enter critical section
495 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
498 // Call hot key callback before telling caller there is a key available
500 WinNtGopSimpleTextInTimerHandler (NULL
, Private
);
502 Status
= GopPrivateCheckQ (&Private
->QueueForRead
);
503 if (!EFI_ERROR (Status
)) {
505 // If a Key press exists try and read it.
507 Status
= GopPrivateDeleteQ (Private
, &Private
->QueueForRead
, KeyData
);
508 if (!EFI_ERROR (Status
)) {
510 // Leave critical section and return
512 gBS
->RestoreTPL (OldTpl
);
518 // Leave critical section and return
520 gBS
->RestoreTPL (OldTpl
);
528 // Simple Text In implementation.
533 TODO: Add function description
535 @param This TODO: add argument description
536 @param ExtendedVerification TODO: add argument description
538 @retval EFI_SUCCESS TODO: Add description for return value
543 WinNtGopSimpleTextInReset (
544 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
545 IN BOOLEAN ExtendedVerification
548 GOP_PRIVATE_DATA
*Private
;
550 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
552 return GopPrivateResetWorker (Private
);
557 TODO: Add function description
559 @param This TODO: add argument description
560 @param Key TODO: add argument description
562 @return TODO: add return values
567 WinNtGopSimpleTextInReadKeyStroke (
568 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
569 OUT EFI_INPUT_KEY
*Key
572 GOP_PRIVATE_DATA
*Private
;
574 EFI_KEY_DATA KeyData
;
576 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
578 Status
= GopPrivateReadKeyStrokeWorker (Private
, &KeyData
);
579 if (EFI_ERROR (Status
)) {
583 CopyMem (Key
, &KeyData
.Key
, sizeof (EFI_INPUT_KEY
));
590 TODO: Add function description
592 @param Event TODO: add argument description
593 @param Context TODO: add argument description
595 @return TODO: add return values
600 WinNtGopSimpleTextInWaitForKey (
605 GOP_PRIVATE_DATA
*Private
;
609 Private
= (GOP_PRIVATE_DATA
*) Context
;
612 // Enter critical section
614 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
617 // Call hot key callback before telling caller there is a key available
619 WinNtGopSimpleTextInTimerHandler (NULL
, Private
);
621 Status
= GopPrivateCheckQ (&Private
->QueueForRead
);
622 if (!EFI_ERROR (Status
)) {
624 // If a there is a key in the queue signal our event.
626 gBS
->SignalEvent (Event
);
629 // We need to sleep or NT will schedule this thread with such high
630 // priority that WinProc thread will never run and we will not see
631 // keyboard input. This Sleep makes the syste run 10x faster, so don't
634 Private
->WinNtThunk
->Sleep (1);
638 // Leave critical section and return
640 gBS
->RestoreTPL (OldTpl
);
644 // Simple Text Input Ex protocol functions
649 WinNtGopSimpleTextInExResetEx (
650 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
651 IN BOOLEAN ExtendedVerification
656 Reset the input device and optionaly run diagnostics
659 This - Protocol instance pointer.
660 ExtendedVerification - Driver may perform diagnostics on reset.
663 EFI_SUCCESS - The device was reset.
667 GOP_PRIVATE_DATA
*Private
;
669 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
671 return GopPrivateResetWorker (Private
);
676 WinNtGopSimpleTextInExReadKeyStrokeEx (
677 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
678 OUT EFI_KEY_DATA
*KeyData
683 Reads the next keystroke from the input device. The WaitForKey Event can
684 be used to test for existance of a keystroke via WaitForEvent () call.
687 This - Protocol instance pointer.
688 KeyData - A pointer to a buffer that is filled in with the keystroke
689 state data for the key that was pressed.
692 EFI_SUCCESS - The keystroke information was returned.
693 EFI_NOT_READY - There was no keystroke data availiable.
694 EFI_DEVICE_ERROR - The keystroke information was not returned due to
696 EFI_INVALID_PARAMETER - KeyData is NULL.
700 GOP_PRIVATE_DATA
*Private
;
702 if (KeyData
== NULL
) {
703 return EFI_INVALID_PARAMETER
;
706 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
708 return GopPrivateReadKeyStrokeWorker (Private
, KeyData
);
714 WinNtGopSimpleTextInExSetState (
715 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
716 IN EFI_KEY_TOGGLE_STATE
*KeyToggleState
721 Set certain state for the input device.
724 This - Protocol instance pointer.
725 KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
726 state for the input device.
729 EFI_SUCCESS - The device state was set successfully.
730 EFI_DEVICE_ERROR - The device is not functioning correctly and could
731 not have the setting adjusted.
732 EFI_UNSUPPORTED - The device does not have the ability to set its state.
733 EFI_INVALID_PARAMETER - KeyToggleState is NULL.
738 GOP_PRIVATE_DATA
*Private
;
740 if (KeyToggleState
== NULL
) {
741 return EFI_INVALID_PARAMETER
;
744 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
746 if (((Private
->KeyState
.KeyToggleState
& EFI_TOGGLE_STATE_VALID
) != EFI_TOGGLE_STATE_VALID
) ||
747 ((*KeyToggleState
& EFI_TOGGLE_STATE_VALID
) != EFI_TOGGLE_STATE_VALID
)) {
748 return EFI_UNSUPPORTED
;
751 Private
->ScrollLock
= FALSE
;
752 Private
->NumLock
= FALSE
;
753 Private
->CapsLock
= FALSE
;
755 if ((*KeyToggleState
& EFI_SCROLL_LOCK_ACTIVE
) == EFI_SCROLL_LOCK_ACTIVE
) {
756 Private
->ScrollLock
= TRUE
;
758 if ((*KeyToggleState
& EFI_NUM_LOCK_ACTIVE
) == EFI_NUM_LOCK_ACTIVE
) {
759 Private
->NumLock
= TRUE
;
761 if ((*KeyToggleState
& EFI_CAPS_LOCK_ACTIVE
) == EFI_CAPS_LOCK_ACTIVE
) {
762 Private
->CapsLock
= TRUE
;
765 Status
= GopPrivateUpdateStatusLight (Private
);
766 if (EFI_ERROR (Status
)) {
767 return EFI_DEVICE_ERROR
;
770 Private
->KeyState
.KeyToggleState
= *KeyToggleState
;
777 WinNtGopSimpleTextInExRegisterKeyNotify (
778 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
779 IN EFI_KEY_DATA
*KeyData
,
780 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
781 OUT EFI_HANDLE
*NotifyHandle
786 Register a notification function for a particular keystroke for the input device.
789 This - Protocol instance pointer.
790 KeyData - A pointer to a buffer that is filled in with the keystroke
791 information data for the key that was pressed.
792 KeyNotificationFunction - Points to the function to be called when the key
793 sequence is typed specified by KeyData.
794 NotifyHandle - Points to the unique handle assigned to the registered notification.
797 EFI_SUCCESS - The notification function was registered successfully.
798 EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
799 EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
803 GOP_PRIVATE_DATA
*Private
;
804 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*CurrentNotify
;
806 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*NewNotify
;
808 if (KeyData
== NULL
|| KeyNotificationFunction
== NULL
|| NotifyHandle
== NULL
) {
809 return EFI_INVALID_PARAMETER
;
812 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
815 // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.
817 for (Link
= Private
->NotifyList
.ForwardLink
; Link
!= &Private
->NotifyList
; Link
= Link
->ForwardLink
) {
820 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
,
822 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
824 if (GopPrivateIsKeyRegistered (&CurrentNotify
->KeyData
, KeyData
)) {
825 if (CurrentNotify
->KeyNotificationFn
== KeyNotificationFunction
) {
826 *NotifyHandle
= CurrentNotify
->NotifyHandle
;
833 // Allocate resource to save the notification function
835 NewNotify
= (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*) AllocateZeroPool (sizeof (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
));
836 if (NewNotify
== NULL
) {
837 return EFI_OUT_OF_RESOURCES
;
840 NewNotify
->Signature
= WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
;
841 NewNotify
->KeyNotificationFn
= KeyNotificationFunction
;
842 NewNotify
->NotifyHandle
= (EFI_HANDLE
) NewNotify
;
843 CopyMem (&NewNotify
->KeyData
, KeyData
, sizeof (EFI_KEY_DATA
));
844 InsertTailList (&Private
->NotifyList
, &NewNotify
->NotifyEntry
);
846 *NotifyHandle
= NewNotify
->NotifyHandle
;
854 WinNtGopSimpleTextInExUnregisterKeyNotify (
855 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
856 IN EFI_HANDLE NotificationHandle
861 Remove a registered notification function from a particular keystroke.
864 This - Protocol instance pointer.
865 NotificationHandle - The handle of the notification function being unregistered.
868 EFI_SUCCESS - The notification function was unregistered successfully.
869 EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
873 GOP_PRIVATE_DATA
*Private
;
875 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*CurrentNotify
;
877 if (NotificationHandle
== NULL
) {
878 return EFI_INVALID_PARAMETER
;
881 if (((WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*) NotificationHandle
)->Signature
!= WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
) {
882 return EFI_INVALID_PARAMETER
;
885 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
887 for (Link
= Private
->NotifyList
.ForwardLink
; Link
!= &Private
->NotifyList
; Link
= Link
->ForwardLink
) {
890 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
,
892 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
894 if (CurrentNotify
->NotifyHandle
== NotificationHandle
) {
896 // Remove the notification function from NotifyList and free resources
898 RemoveEntryList (&CurrentNotify
->NotifyEntry
);
900 gBS
->FreePool (CurrentNotify
);
906 // Can not find the specified Notification Handle
908 return EFI_INVALID_PARAMETER
;
913 TODO: Add function description
915 @param Private TODO: add argument description
917 @return TODO: add return values
921 WinNtGopInitializeSimpleTextInForWindow (
922 IN GOP_PRIVATE_DATA
*Private
927 GopPrivateCreateQ (Private
, &Private
->QueueForRead
);
928 GopPrivateCreateQ (Private
, &Private
->QueueForNotify
);
931 // Initialize Simple Text In protoocol
933 Private
->SimpleTextIn
.Reset
= WinNtGopSimpleTextInReset
;
934 Private
->SimpleTextIn
.ReadKeyStroke
= WinNtGopSimpleTextInReadKeyStroke
;
936 Status
= gBS
->CreateEvent (
939 WinNtGopSimpleTextInWaitForKey
,
941 &Private
->SimpleTextIn
.WaitForKey
945 Private
->SimpleTextInEx
.Reset
= WinNtGopSimpleTextInExResetEx
;
946 Private
->SimpleTextInEx
.ReadKeyStrokeEx
= WinNtGopSimpleTextInExReadKeyStrokeEx
;
947 Private
->SimpleTextInEx
.SetState
= WinNtGopSimpleTextInExSetState
;
948 Private
->SimpleTextInEx
.RegisterKeyNotify
= WinNtGopSimpleTextInExRegisterKeyNotify
;
949 Private
->SimpleTextInEx
.UnregisterKeyNotify
= WinNtGopSimpleTextInExUnregisterKeyNotify
;
951 Private
->SimpleTextInEx
.Reset (&Private
->SimpleTextInEx
, FALSE
);
953 InitializeListHead (&Private
->NotifyList
);
955 Status
= gBS
->CreateEvent (
958 WinNtGopSimpleTextInWaitForKey
,
960 &Private
->SimpleTextInEx
.WaitForKeyEx
962 ASSERT_EFI_ERROR (Status
);
965 // Create the Timer to trigger hot key notifications
967 Status
= gBS
->CreateEvent (
968 EVT_TIMER
| EVT_NOTIFY_SIGNAL
,
970 WinNtGopSimpleTextInTimerHandler
,
974 ASSERT_EFI_ERROR (Status
);
976 Status
= gBS
->SetTimer (
979 KEYBOARD_TIMER_INTERVAL
981 ASSERT_EFI_ERROR (Status
);
989 TODO: Add function description
991 @param Private TODO: add argument description
993 @retval EFI_SUCCESS TODO: Add description for return value
997 WinNtGopDestroySimpleTextInForWindow (
998 IN GOP_PRIVATE_DATA
*Private
1001 gBS
->CloseEvent (Private
->TimerEvent
);
1003 GopPrivateDestroyQ (Private
, &Private
->QueueForRead
);
1004 GopPrivateDestroyQ (Private
, &Private
->QueueForNotify
);