-\r
- Status = GopPrivateCheckQ (&Private->QueueForRead);\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // If a there is a key in the queue signal our event.\r
- //\r
- gBS->SignalEvent (Event);\r
- } else {\r
- //\r
- // We need to sleep or NT will schedule this thread with such high\r
- // priority that WinProc thread will never run and we will not see\r
- // keyboard input. This Sleep makes the syste run 10x faster, so don't\r
- // remove it.\r
- //\r
- Private->WinNtThunk->Sleep (1);\r
+ \r
+ //\r
+ // WaitforKey doesn't suppor the partial key.\r
+ // Considering if the partial keystroke is enabled, there maybe a partial\r
+ // keystroke in the queue, so here skip the partial keystroke and get the\r
+ // next key from the queue\r
+ //\r
+ while (1) {\r
+ Status = GopPrivateCheckQ (&Private->QueueForRead);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // If a there is a key in the queue and it is not partial keystroke, signal event.\r
+ //\r
+ if (Private->QueueForRead.Q[Private->QueueForRead.Front].Key.ScanCode == SCAN_NULL &&\r
+ Private->QueueForRead.Q[Private->QueueForRead.Front].Key.UnicodeChar == CHAR_NULL) {\r
+ GopPrivateDeleteQ (Private,&Private->QueueForRead,&KeyData);\r
+ continue;\r
+ }\r
+ gBS->SignalEvent (Event);\r
+ } else {\r
+ //\r
+ // We need to sleep or NT will schedule this thread with such high\r
+ // priority that WinProc thread will never run and we will not see\r
+ // keyboard input. This Sleep makes the syste run 10x faster, so don't\r
+ // remove it.\r
+ //\r
+ Private->WinNtThunk->Sleep (1);\r
+ }\r
+ break;\r