1 /**
2 	A sample UEFI application that prints "Hello, world!" to the console and waits for key input.
3 **/
4 module uefihelloworld;
5 
6 import uefi;
7 
8 /// Dummy symbols
9 extern (C) void* _Dmodule_ref;
10 /// ditto
11 extern (C) void* _tls_index = null;
12 
13 /// Helper function for showing D string on the screen
14 void showBootString(EFI_SYSTEM_TABLE* ST, const(wchar)[] lstr) @nogc nothrow
15 {
16     ST.ConOut.OutputString(ST.ConOut, cast(CHAR16*)(lstr.ptr));
17 }
18 
19 /// UEFI Entry Point
20 extern (C) EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* ST) @nogc nothrow
21 {
22     // Show hello world message
23     showBootString(ST, "Hello, D UEFI world!\r\n\r\n"w);
24 
25     // Prompt for a key press
26     showBootString(ST, "Press key..."w);
27     // Clear the input buffer
28     ST.ConIn.Reset(ST.ConIn, FALSE);
29     // Wait for a key press
30     EFI_INPUT_KEY Key = void;
31     while (ST.ConIn.ReadKeyStroke(ST.ConIn, &Key) == EFI_NOT_READY)
32     {
33     }
34 	return EFI_SUCCESS;
35 }