VOID RefreshSecurityForm()

in OemPkg/FrontPage/FrontPageUi.c [76:140]


VOID RefreshSecurityForm ( VOID ) {
    VOID                          *StartOpCodeHandle;
    VOID                          *EndOpCodeHandle;
    EFI_IFR_GUID_LABEL            *StartLabel;
    EFI_IFR_GUID_LABEL            *EndLabel;
    STATIC UINT8                  NullOpCount = 1;

    DEBUG(( DEBUG_VERBOSE, "VERBOSE [SFP] %a - Attempting to force Security form refresh.\n", __FUNCTION__ ));

    //
    // Determine how many NULL opcodes we need.
    // This is so that the number of opcodes will vary from execution to
    // execution and force the page CRC to always change.
    // Can toggle back and forth.
    //
    if (1 != NullOpCount)
    {
        NullOpCount = 1;
    }
    else
    {
        NullOpCount = 2;
    }

    //
    // Init OpCode Handle and Allocate space for creation of UpdateData Buffer
    //
    StartOpCodeHandle = HiiAllocateOpCodeHandle();
    ASSERT(StartOpCodeHandle != NULL);

    EndOpCodeHandle = HiiAllocateOpCodeHandle();
    ASSERT(EndOpCodeHandle != NULL);

    //
    // Create Hii Extend Label OpCode as the start opcode
    //
    StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof(EFI_IFR_GUID_LABEL));
    StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;

    //
    // Create Hii Extend Label OpCode as the end opcode
    //
    EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode(EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof(EFI_IFR_GUID_LABEL));
    EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;

    StartLabel->Number     = LABEL_UPDATE_SECURITY_START;
    EndLabel->Number       = LABEL_UPDATE_SECURITY_END;

    HiiCreateTextOpCode (StartOpCodeHandle,STRING_TOKEN(STR_NULL_STRING),0,0);
    if (NullOpCount > 1)
    {
        HiiCreateTextOpCode (StartOpCodeHandle,STRING_TOKEN(STR_NULL_STRING),0,0);
    }

    HiiUpdateForm(
        mFrontPagePrivate.HiiHandle,
        &gMuFrontPageConfigFormSetGuid,
        FRONT_PAGE_FORM_ID_SECURITY,
        StartOpCodeHandle,
        EndOpCodeHandle
        );

    HiiFreeOpCodeHandle(StartOpCodeHandle);
    HiiFreeOpCodeHandle(EndOpCodeHandle);
}