OcBootManagementLib: Fix key polling issue with PollAppleHotKeys=true
@@ -977,6 +977,10 @@ OcWaitForAppleKeyIndex (
return OC_INPUT_INVALID;
}
+ CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ());
+ EndTime = CurrTime + Timeout * 1000000000ULL;
+
+ while (Timeout == 0 || CurrTime == 0 || CurrTime < EndTime) {
NumKeys = ARRAY_SIZE (Keys);
Status = KeyMap->GetKeyStrokes (
KeyMap,
@@ -990,10 +994,6 @@ OcWaitForAppleKeyIndex (
return OC_INPUT_INVALID;
}
- CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ());
- EndTime = CurrTime + Timeout * 1000000000ULL;
-
- while (Timeout == 0 || CurrTime == 0 || CurrTime < EndTime) {
CurrTime = GetTimeInNanoSecond (GetPerformanceCounter ());
HasCommand = (Modifiers & (APPLE_MODIFIER_LEFT_COMMAND | APPLE_MODIFIER_RIGHT_COMMAND)) != 0;
