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 (
250 IN GOP_PRIVATE_DATA
*Private
253 EFI_KEY_DATA KeyData
;
255 while (GopPrivateDeleteQ (Private
, &Private
->QueueForNotify
, &KeyData
) == EFI_SUCCESS
) {
256 GopPrivateInvokeRegisteredFunction (Private
, &KeyData
);
261 TODO: Add function description
263 @param Private TODO: add argument description
264 @param Key TODO: add argument description
266 @retval EFI_NOT_READY TODO: Add description for return value
267 @retval EFI_SUCCESS TODO: Add description for return value
272 IN GOP_PRIVATE_DATA
*Private
,
276 EFI_KEY_DATA KeyData
;
280 KeyData
.KeyState
.KeyShiftState
= EFI_SHIFT_STATE_VALID
;
281 KeyData
.KeyState
.KeyToggleState
= EFI_TOGGLE_STATE_VALID
;
284 // Record Key shift state and toggle state
286 if (Private
->LeftCtrl
) {
287 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_CONTROL_PRESSED
;
289 if (Private
->RightCtrl
) {
290 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_CONTROL_PRESSED
;
292 if (Private
->LeftAlt
) {
293 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_ALT_PRESSED
;
295 if (Private
->RightAlt
) {
296 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_ALT_PRESSED
;
298 if (Private
->LeftShift
) {
299 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_SHIFT_PRESSED
;
301 if (Private
->RightShift
) {
302 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_SHIFT_PRESSED
;
304 if (Private
->LeftLogo
) {
305 KeyData
.KeyState
.KeyShiftState
|= EFI_LEFT_LOGO_PRESSED
;
307 if (Private
->RightLogo
) {
308 KeyData
.KeyState
.KeyShiftState
|= EFI_RIGHT_LOGO_PRESSED
;
311 KeyData
.KeyState
.KeyShiftState
|= EFI_MENU_KEY_PRESSED
;
313 if (Private
->SysReq
) {
314 KeyData
.KeyState
.KeyShiftState
|= EFI_SYS_REQ_PRESSED
;
316 if (Private
->CapsLock
) {
317 KeyData
.KeyState
.KeyToggleState
|= EFI_CAPS_LOCK_ACTIVE
;
319 if (Private
->NumLock
) {
320 KeyData
.KeyState
.KeyToggleState
|= EFI_NUM_LOCK_ACTIVE
;
322 if (Private
->ScrollLock
) {
323 KeyData
.KeyState
.KeyToggleState
|= EFI_SCROLL_LOCK_ACTIVE
;
327 // Convert Ctrl+[1-26] to Ctrl+[A-Z]
329 if ((Private
->LeftCtrl
|| Private
->RightCtrl
) &&
330 (KeyData
.Key
.UnicodeChar
>= 1) && (KeyData
.Key
.UnicodeChar
<= 26)
332 if ((Private
->LeftShift
|| Private
->RightShift
) == Private
->CapsLock
) {
333 KeyData
.Key
.UnicodeChar
= KeyData
.Key
.UnicodeChar
+ L
'a' - 1;
335 KeyData
.Key
.UnicodeChar
= KeyData
.Key
.UnicodeChar
+ L
'A' - 1;
340 // Unmask the Shift bit for printable char
342 if (((KeyData
.Key
.UnicodeChar
>= L
'a') && (KeyData
.Key
.UnicodeChar
<= L
'z')) ||
343 ((KeyData
.Key
.UnicodeChar
>= L
'A') && (KeyData
.Key
.UnicodeChar
<= L
'Z'))
345 KeyData
.KeyState
.KeyShiftState
&= ~(EFI_LEFT_SHIFT_PRESSED
| EFI_RIGHT_SHIFT_PRESSED
);
348 GopPrivateAddQ (Private
, &Private
->QueueForNotify
, &KeyData
);
351 // Convert Ctrl+[A-Z] to Ctrl+[1-26]
353 if (Private
->LeftCtrl
|| Private
->RightCtrl
) {
354 if ((KeyData
.Key
.UnicodeChar
>= L
'a') && (KeyData
.Key
.UnicodeChar
<= L
'z')) {
355 KeyData
.Key
.UnicodeChar
= KeyData
.Key
.UnicodeChar
- L
'a' + 1;
356 } else if ((KeyData
.Key
.UnicodeChar
>= L
'A') && (KeyData
.Key
.UnicodeChar
<= L
'Z')) {
357 KeyData
.Key
.UnicodeChar
= KeyData
.Key
.UnicodeChar
- L
'A' + 1;
360 GopPrivateAddQ (Private
, &Private
->QueueForRead
, &KeyData
);
366 GopPrivateUpdateStatusLight (
367 IN GOP_PRIVATE_DATA
*Private
373 This function updates the status light of NumLock, ScrollLock and CapsLock.
377 Private - The private structure of WinNt console In/Out.
381 EFI_SUCCESS - The status light is updated successfully.
386 // BUGBUG:Only SendInput/keybd_event function can toggle
387 // NumLock, CapsLock and ScrollLock keys.
388 // Neither of these functions is included in EFI_WIN_NT_THUNK_PROTOCOL.
389 // Thus, return immediately without operation.
397 GopPrivateResetWorker (
398 IN GOP_PRIVATE_DATA
*Private
404 This function is a worker function for SimpleTextIn/SimpleTextInEx.Reset().
408 Private - WinNT GOP private structure
412 EFI_SUCCESS - Reset successfully
416 EFI_KEY_DATA KeyData
;
420 // Enter critical section
422 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
425 // A reset is draining the Queue
427 while (GopPrivateDeleteQ (Private
, &Private
->QueueForRead
, &KeyData
) == EFI_SUCCESS
)
429 while (GopPrivateDeleteQ (Private
, &Private
->QueueForNotify
, &KeyData
) == EFI_SUCCESS
)
432 Private
->LeftShift
= FALSE
;
433 Private
->RightShift
= FALSE
;
434 Private
->LeftAlt
= FALSE
;
435 Private
->RightAlt
= FALSE
;
436 Private
->LeftCtrl
= FALSE
;
437 Private
->RightCtrl
= FALSE
;
438 Private
->LeftLogo
= FALSE
;
439 Private
->RightLogo
= FALSE
;
440 Private
->Menu
= FALSE
;
441 Private
->SysReq
= FALSE
;
443 Private
->CapsLock
= FALSE
;
444 Private
->NumLock
= FALSE
;
445 Private
->ScrollLock
= FALSE
;
447 Private
->KeyState
.KeyShiftState
= EFI_SHIFT_STATE_VALID
;
448 Private
->KeyState
.KeyToggleState
= EFI_TOGGLE_STATE_VALID
;
451 // Leave critical section and return
453 gBS
->RestoreTPL (OldTpl
);
459 GopPrivateReadKeyStrokeWorker (
460 IN GOP_PRIVATE_DATA
*Private
,
461 OUT EFI_KEY_DATA
*KeyData
466 Reads the next keystroke from the input device. The WaitForKey Event can
467 be used to test for existance of a keystroke via WaitForEvent () call.
470 Private - The private structure of WinNt Gop device.
471 KeyData - A pointer to a buffer that is filled in with the keystroke
472 state data for the key that was pressed.
475 EFI_SUCCESS - The keystroke information was returned.
476 EFI_NOT_READY - There was no keystroke data availiable.
477 EFI_DEVICE_ERROR - The keystroke information was not returned due to
479 EFI_INVALID_PARAMETER - KeyData is NULL.
486 if (KeyData
== NULL
) {
487 return EFI_INVALID_PARAMETER
;
491 // Enter critical section
493 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
496 // Call hot key callback before telling caller there is a key available
498 WinNtGopSimpleTextInTimerHandler (NULL
, Private
);
500 Status
= GopPrivateCheckQ (&Private
->QueueForRead
);
501 if (!EFI_ERROR (Status
)) {
503 // If a Key press exists try and read it.
505 Status
= GopPrivateDeleteQ (Private
, &Private
->QueueForRead
, KeyData
);
506 if (!EFI_ERROR (Status
)) {
508 // Leave critical section and return
510 gBS
->RestoreTPL (OldTpl
);
516 // Leave critical section and return
518 gBS
->RestoreTPL (OldTpl
);
526 // Simple Text In implementation.
531 TODO: Add function description
533 @param This TODO: add argument description
534 @param ExtendedVerification TODO: add argument description
536 @retval EFI_SUCCESS TODO: Add description for return value
541 WinNtGopSimpleTextInReset (
542 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
543 IN BOOLEAN ExtendedVerification
546 GOP_PRIVATE_DATA
*Private
;
548 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
550 return GopPrivateResetWorker (Private
);
555 TODO: Add function description
557 @param This TODO: add argument description
558 @param Key TODO: add argument description
560 @return TODO: add return values
565 WinNtGopSimpleTextInReadKeyStroke (
566 IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL
*This
,
567 OUT EFI_INPUT_KEY
*Key
570 GOP_PRIVATE_DATA
*Private
;
572 EFI_KEY_DATA KeyData
;
574 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This
);
576 Status
= GopPrivateReadKeyStrokeWorker (Private
, &KeyData
);
577 if (EFI_ERROR (Status
)) {
581 CopyMem (Key
, &KeyData
.Key
, sizeof (EFI_INPUT_KEY
));
588 TODO: Add function description
590 @param Event TODO: add argument description
591 @param Context TODO: add argument description
593 @return TODO: add return values
598 WinNtGopSimpleTextInWaitForKey (
603 GOP_PRIVATE_DATA
*Private
;
607 Private
= (GOP_PRIVATE_DATA
*) Context
;
610 // Enter critical section
612 OldTpl
= gBS
->RaiseTPL (TPL_NOTIFY
);
615 // Call hot key callback before telling caller there is a key available
617 WinNtGopSimpleTextInTimerHandler (NULL
, Private
);
619 Status
= GopPrivateCheckQ (&Private
->QueueForRead
);
620 if (!EFI_ERROR (Status
)) {
622 // If a there is a key in the queue signal our event.
624 gBS
->SignalEvent (Event
);
627 // We need to sleep or NT will schedule this thread with such high
628 // priority that WinProc thread will never run and we will not see
629 // keyboard input. This Sleep makes the syste run 10x faster, so don't
632 Private
->WinNtThunk
->Sleep (1);
636 // Leave critical section and return
638 gBS
->RestoreTPL (OldTpl
);
642 // Simple Text Input Ex protocol functions
647 WinNtGopSimpleTextInExResetEx (
648 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
649 IN BOOLEAN ExtendedVerification
654 Reset the input device and optionaly run diagnostics
657 This - Protocol instance pointer.
658 ExtendedVerification - Driver may perform diagnostics on reset.
661 EFI_SUCCESS - The device was reset.
665 GOP_PRIVATE_DATA
*Private
;
667 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
669 return GopPrivateResetWorker (Private
);
674 WinNtGopSimpleTextInExReadKeyStrokeEx (
675 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
676 OUT EFI_KEY_DATA
*KeyData
681 Reads the next keystroke from the input device. The WaitForKey Event can
682 be used to test for existance of a keystroke via WaitForEvent () call.
685 This - Protocol instance pointer.
686 KeyData - A pointer to a buffer that is filled in with the keystroke
687 state data for the key that was pressed.
690 EFI_SUCCESS - The keystroke information was returned.
691 EFI_NOT_READY - There was no keystroke data availiable.
692 EFI_DEVICE_ERROR - The keystroke information was not returned due to
694 EFI_INVALID_PARAMETER - KeyData is NULL.
698 GOP_PRIVATE_DATA
*Private
;
700 if (KeyData
== NULL
) {
701 return EFI_INVALID_PARAMETER
;
704 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
706 return GopPrivateReadKeyStrokeWorker (Private
, KeyData
);
712 WinNtGopSimpleTextInExSetState (
713 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
714 IN EFI_KEY_TOGGLE_STATE
*KeyToggleState
719 Set certain state for the input device.
722 This - Protocol instance pointer.
723 KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the
724 state for the input device.
727 EFI_SUCCESS - The device state was set successfully.
728 EFI_DEVICE_ERROR - The device is not functioning correctly and could
729 not have the setting adjusted.
730 EFI_UNSUPPORTED - The device does not have the ability to set its state.
731 EFI_INVALID_PARAMETER - KeyToggleState is NULL.
736 GOP_PRIVATE_DATA
*Private
;
738 if (KeyToggleState
== NULL
) {
739 return EFI_INVALID_PARAMETER
;
742 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
744 if (((Private
->KeyState
.KeyToggleState
& EFI_TOGGLE_STATE_VALID
) != EFI_TOGGLE_STATE_VALID
) ||
745 ((*KeyToggleState
& EFI_TOGGLE_STATE_VALID
) != EFI_TOGGLE_STATE_VALID
)) {
746 return EFI_UNSUPPORTED
;
749 Private
->ScrollLock
= FALSE
;
750 Private
->NumLock
= FALSE
;
751 Private
->CapsLock
= FALSE
;
753 if ((*KeyToggleState
& EFI_SCROLL_LOCK_ACTIVE
) == EFI_SCROLL_LOCK_ACTIVE
) {
754 Private
->ScrollLock
= TRUE
;
756 if ((*KeyToggleState
& EFI_NUM_LOCK_ACTIVE
) == EFI_NUM_LOCK_ACTIVE
) {
757 Private
->NumLock
= TRUE
;
759 if ((*KeyToggleState
& EFI_CAPS_LOCK_ACTIVE
) == EFI_CAPS_LOCK_ACTIVE
) {
760 Private
->CapsLock
= TRUE
;
763 Status
= GopPrivateUpdateStatusLight (Private
);
764 if (EFI_ERROR (Status
)) {
765 return EFI_DEVICE_ERROR
;
768 Private
->KeyState
.KeyToggleState
= *KeyToggleState
;
775 WinNtGopSimpleTextInExRegisterKeyNotify (
776 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
777 IN EFI_KEY_DATA
*KeyData
,
778 IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction
,
779 OUT EFI_HANDLE
*NotifyHandle
784 Register a notification function for a particular keystroke for the input device.
787 This - Protocol instance pointer.
788 KeyData - A pointer to a buffer that is filled in with the keystroke
789 information data for the key that was pressed.
790 KeyNotificationFunction - Points to the function to be called when the key
791 sequence is typed specified by KeyData.
792 NotifyHandle - Points to the unique handle assigned to the registered notification.
795 EFI_SUCCESS - The notification function was registered successfully.
796 EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures.
797 EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL.
801 GOP_PRIVATE_DATA
*Private
;
802 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*CurrentNotify
;
804 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*NewNotify
;
806 if (KeyData
== NULL
|| KeyNotificationFunction
== NULL
|| NotifyHandle
== NULL
) {
807 return EFI_INVALID_PARAMETER
;
810 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
813 // Return EFI_SUCCESS if the (KeyData, NotificationFunction) is already registered.
815 for (Link
= Private
->NotifyList
.ForwardLink
; Link
!= &Private
->NotifyList
; Link
= Link
->ForwardLink
) {
818 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
,
820 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
822 if (GopPrivateIsKeyRegistered (&CurrentNotify
->KeyData
, KeyData
)) {
823 if (CurrentNotify
->KeyNotificationFn
== KeyNotificationFunction
) {
824 *NotifyHandle
= CurrentNotify
->NotifyHandle
;
831 // Allocate resource to save the notification function
833 NewNotify
= (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*) AllocateZeroPool (sizeof (WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
));
834 if (NewNotify
== NULL
) {
835 return EFI_OUT_OF_RESOURCES
;
838 NewNotify
->Signature
= WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
;
839 NewNotify
->KeyNotificationFn
= KeyNotificationFunction
;
840 NewNotify
->NotifyHandle
= (EFI_HANDLE
) NewNotify
;
841 CopyMem (&NewNotify
->KeyData
, KeyData
, sizeof (EFI_KEY_DATA
));
842 InsertTailList (&Private
->NotifyList
, &NewNotify
->NotifyEntry
);
844 *NotifyHandle
= NewNotify
->NotifyHandle
;
852 WinNtGopSimpleTextInExUnregisterKeyNotify (
853 IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
*This
,
854 IN EFI_HANDLE NotificationHandle
859 Remove a registered notification function from a particular keystroke.
862 This - Protocol instance pointer.
863 NotificationHandle - The handle of the notification function being unregistered.
866 EFI_SUCCESS - The notification function was unregistered successfully.
867 EFI_INVALID_PARAMETER - The NotificationHandle is invalid.
871 GOP_PRIVATE_DATA
*Private
;
873 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*CurrentNotify
;
875 if (NotificationHandle
== NULL
) {
876 return EFI_INVALID_PARAMETER
;
879 if (((WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
*) NotificationHandle
)->Signature
!= WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
) {
880 return EFI_INVALID_PARAMETER
;
883 Private
= GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS (This
);
885 for (Link
= Private
->NotifyList
.ForwardLink
; Link
!= &Private
->NotifyList
; Link
= Link
->ForwardLink
) {
888 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
,
890 WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE
892 if (CurrentNotify
->NotifyHandle
== NotificationHandle
) {
894 // Remove the notification function from NotifyList and free resources
896 RemoveEntryList (&CurrentNotify
->NotifyEntry
);
898 gBS
->FreePool (CurrentNotify
);
904 // Can not find the specified Notification Handle
906 return EFI_INVALID_PARAMETER
;
911 TODO: Add function description
913 @param Private TODO: add argument description
915 @return TODO: add return values
919 WinNtGopInitializeSimpleTextInForWindow (
920 IN GOP_PRIVATE_DATA
*Private
925 GopPrivateCreateQ (Private
, &Private
->QueueForRead
);
926 GopPrivateCreateQ (Private
, &Private
->QueueForNotify
);
929 // Initialize Simple Text In protoocol
931 Private
->SimpleTextIn
.Reset
= WinNtGopSimpleTextInReset
;
932 Private
->SimpleTextIn
.ReadKeyStroke
= WinNtGopSimpleTextInReadKeyStroke
;
934 Status
= gBS
->CreateEvent (
937 WinNtGopSimpleTextInWaitForKey
,
939 &Private
->SimpleTextIn
.WaitForKey
943 Private
->SimpleTextInEx
.Reset
= WinNtGopSimpleTextInExResetEx
;
944 Private
->SimpleTextInEx
.ReadKeyStrokeEx
= WinNtGopSimpleTextInExReadKeyStrokeEx
;
945 Private
->SimpleTextInEx
.SetState
= WinNtGopSimpleTextInExSetState
;
946 Private
->SimpleTextInEx
.RegisterKeyNotify
= WinNtGopSimpleTextInExRegisterKeyNotify
;
947 Private
->SimpleTextInEx
.UnregisterKeyNotify
= WinNtGopSimpleTextInExUnregisterKeyNotify
;
949 Private
->SimpleTextInEx
.Reset (&Private
->SimpleTextInEx
, FALSE
);
951 InitializeListHead (&Private
->NotifyList
);
953 Status
= gBS
->CreateEvent (
956 WinNtGopSimpleTextInWaitForKey
,
958 &Private
->SimpleTextInEx
.WaitForKeyEx
960 ASSERT_EFI_ERROR (Status
);
963 // Create the Timer to trigger hot key notifications
965 Status
= gBS
->CreateEvent (
966 EVT_TIMER
| EVT_NOTIFY_SIGNAL
,
968 WinNtGopSimpleTextInTimerHandler
,
972 ASSERT_EFI_ERROR (Status
);
974 Status
= gBS
->SetTimer (
977 KEYBOARD_TIMER_INTERVAL
979 ASSERT_EFI_ERROR (Status
);
987 TODO: Add function description
989 @param Private TODO: add argument description
991 @retval EFI_SUCCESS TODO: Add description for return value
995 WinNtGopDestroySimpleTextInForWindow (
996 IN GOP_PRIVATE_DATA
*Private
999 gBS
->CloseEvent (Private
->TimerEvent
);
1001 GopPrivateDestroyQ (Private
, &Private
->QueueForRead
);
1002 GopPrivateDestroyQ (Private
, &Private
->QueueForNotify
);