The Extensible Firmware Interface

by Craig Szydlowski



Example 1:



#include "efi.h"

EFI_STATUS

InitializeHelloApplication (

    IN EFI_HANDLE         ImageHandle,

    IN EFI_SYSTEM_TABLE   *SystemTable

    )

{

    UINTN Index;

    SystemTable->ConOut->OutputString(SystemTable->ConOut,

        L"Hello application started\n");

    SystemTable->ConOut->OutputString(SystemTable->ConOut,

        L"\n\r\n\r\n\rHit any key to exit this image\n\r"); 

    SystemTable->BootServices->WaitForEvent(

        1, &(SystemTable->ConIn->WaitForKey), &Index);

    SystemTable->ConOut->OutputString(SystemTable->ConOut, 

        L"\n\r\n\r");

    return EFI_SUCCESS;

}



Example 2



#include "efi.h"

#include "efilib.h"

 

EFI_STATUS



InitializeHelloLibApplication (

    IN EFI_HANDLE        ImageHandle,

    IN EFI_SYSTEM_TABLE  *SystemTable

    )

{

    InitializeLib (ImageHandle, SystemTable);

    Print(L"\n\n\nHelloLib application started\n\n\n");

    Print(L"\nHit any key to exit this image\n");

    WaitForSingleEvent(ST->ConIn->WaitForKey,0);

    ST->ConOut->OutputString (ST->ConOut, L"\n\r\n\r");

    return EFI_SUCCESS;

}





Example 3:



#include <atk_libc.h>

EFI_STATUS

InitializeHelloLibCApplication (

    IN EFI_HANDLE           ImageHandle,

    IN EFI_SYSTEM_TABLE     *SystemTable

    )

{

       InitializeLib(ImageHandle, SystemTable);

       printf("Hello LibC application started\n\n\n");

       printf("Hit C/R to exit this image\n");

       return( getchar() );

}











1



