Adjust the start position of the opcode string before saving it to avoid show menu info error.

Signed-off-by: ydong10
Reviewed-by: lgao4









git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11892 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
ydong10 2011-06-27 09:07:23 +00:00
parent fd99d1a91d
commit 4ffaadccd3
1 changed files with 65 additions and 64 deletions

View File

@ -1910,70 +1910,6 @@ UiDisplayMenu (
Temp = 0;
Row = OriginalRow;
//
// If Question has refresh guid, register the op-code.
//
if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
if (gMenuEventGuidRefreshHead == NULL) {
MenuUpdateEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
gMenuEventGuidRefreshHead = MenuUpdateEntry;
} else {
MenuUpdateEntry = gMenuEventGuidRefreshHead;
while (MenuUpdateEntry->Next != NULL) {
MenuUpdateEntry = MenuUpdateEntry->Next;
}
MenuUpdateEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
MenuUpdateEntry = MenuUpdateEntry->Next;
}
ASSERT (MenuUpdateEntry != NULL);
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RefreshQuestionNotify, MenuUpdateEntry, &Statement->RefreshGuid, &MenuUpdateEntry->Event);
ASSERT (!EFI_ERROR (Status));
MenuUpdateEntry->MenuOption = MenuOption;
MenuUpdateEntry->Selection = Selection;
MenuUpdateEntry->CurrentColumn = MenuOption->OptCol;
MenuUpdateEntry->CurrentRow = MenuOption->Row;
if (MenuOption->GrayOut) {
MenuUpdateEntry->CurrentAttribute = FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
} else {
MenuUpdateEntry->CurrentAttribute = PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
}
}
//
// If Question request refresh, register the op-code
//
if (Statement->RefreshInterval != 0) {
//
// Menu will be refreshed at minimal interval of all Questions
// which have refresh request
//
if (MinRefreshInterval == 0 || Statement->RefreshInterval < MinRefreshInterval) {
MinRefreshInterval = Statement->RefreshInterval;
}
if (gMenuRefreshHead == NULL) {
MenuRefreshEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
gMenuRefreshHead = MenuRefreshEntry;
} else {
MenuRefreshEntry = gMenuRefreshHead;
while (MenuRefreshEntry->Next != NULL) {
MenuRefreshEntry = MenuRefreshEntry->Next;
}
MenuRefreshEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
MenuRefreshEntry = MenuRefreshEntry->Next;
}
ASSERT (MenuRefreshEntry != NULL);
MenuRefreshEntry->MenuOption = MenuOption;
MenuRefreshEntry->Selection = Selection;
MenuRefreshEntry->CurrentColumn = MenuOption->OptCol;
MenuRefreshEntry->CurrentRow = MenuOption->Row;
if (MenuOption->GrayOut) {
MenuRefreshEntry->CurrentAttribute = FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
} else {
MenuRefreshEntry->CurrentAttribute = PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
}
}
Status = ProcessOptions (Selection, MenuOption, FALSE, &OptionString);
if (EFI_ERROR (Status)) {
//
@ -2039,6 +1975,71 @@ UiDisplayMenu (
FreePool (OptionString);
}
//
// If Question has refresh guid, register the op-code.
//
if (!CompareGuid (&Statement->RefreshGuid, &gZeroGuid)) {
if (gMenuEventGuidRefreshHead == NULL) {
MenuUpdateEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
gMenuEventGuidRefreshHead = MenuUpdateEntry;
} else {
MenuUpdateEntry = gMenuEventGuidRefreshHead;
while (MenuUpdateEntry->Next != NULL) {
MenuUpdateEntry = MenuUpdateEntry->Next;
}
MenuUpdateEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
MenuUpdateEntry = MenuUpdateEntry->Next;
}
ASSERT (MenuUpdateEntry != NULL);
Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_NOTIFY, RefreshQuestionNotify, MenuUpdateEntry, &Statement->RefreshGuid, &MenuUpdateEntry->Event);
ASSERT (!EFI_ERROR (Status));
MenuUpdateEntry->MenuOption = MenuOption;
MenuUpdateEntry->Selection = Selection;
MenuUpdateEntry->CurrentColumn = MenuOption->OptCol;
MenuUpdateEntry->CurrentRow = MenuOption->Row;
if (MenuOption->GrayOut) {
MenuUpdateEntry->CurrentAttribute = FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
} else {
MenuUpdateEntry->CurrentAttribute = PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
}
}
//
// If Question request refresh, register the op-code
//
if (Statement->RefreshInterval != 0) {
//
// Menu will be refreshed at minimal interval of all Questions
// which have refresh request
//
if (MinRefreshInterval == 0 || Statement->RefreshInterval < MinRefreshInterval) {
MinRefreshInterval = Statement->RefreshInterval;
}
if (gMenuRefreshHead == NULL) {
MenuRefreshEntry = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
gMenuRefreshHead = MenuRefreshEntry;
} else {
MenuRefreshEntry = gMenuRefreshHead;
while (MenuRefreshEntry->Next != NULL) {
MenuRefreshEntry = MenuRefreshEntry->Next;
}
MenuRefreshEntry->Next = AllocateZeroPool (sizeof (MENU_REFRESH_ENTRY));
MenuRefreshEntry = MenuRefreshEntry->Next;
}
ASSERT (MenuRefreshEntry != NULL);
MenuRefreshEntry->MenuOption = MenuOption;
MenuRefreshEntry->Selection = Selection;
MenuRefreshEntry->CurrentColumn = MenuOption->OptCol;
MenuRefreshEntry->CurrentRow = MenuOption->Row;
if (MenuOption->GrayOut) {
MenuRefreshEntry->CurrentAttribute = FIELD_TEXT_GRAYED | FIELD_BACKGROUND;
} else {
MenuRefreshEntry->CurrentAttribute = PcdGet8 (PcdBrowserFieldTextColor) | FIELD_BACKGROUND;
}
}
//
// If this is a text op with secondary text information
//