mineswefi.git

main.c

espurr
/* mineswefi - uefi minesweeper
 * Copyright (C) 2025 ArcNyxx <olive@arcnyxx.net>
 * see LICENCE file for licensing information */

#include "efi.h"

static efi_image_t *info;
static efi_file_system_t *fs;
static efi_file_t *root;

#define NULL (void *)0

int
main(efi_handle_t *loader, efi_table_t *table)
{
	table->stdout->clear(table->stdout);
	table->stdout->print(table->stdout, L"Hello World!\r\n");

	efi_guid_t guid = EFI_IMAGE_GUID;
	table->boot->open_proto(loader, &guid, &info, loader, NULL,
			EFI_OPEN_PROTO_HANDLE);
	efi_guid_t guid2 = EFI_FILE_SYSTEM_GUID;
	table->boot->open_proto(info->device, &guid2, &fs, loader, NULL,
			EFI_OPEN_PROTO_HANDLE);
	fs->open(fs, &root);

	efi_file_t *file;
	root->open(root, &file, L"\\scores.txt", 0x8000000000000003, 0);
	uint64_t len = 28;
	root->write(file, &len, L"Hello World!\r\n");
	root->close(file);

	for (;;);
	return 0;
}