reactos/base/setup/lib/bldrsup.h
Hermès Bélusca-Maïto 6681fb8af5
[SETUPLIB] Add a new module "bldrsup.c" (WIP) where I place all the NT boot loaders (i.e. ntldr, freeldr, and possibly bootmgr in the future) management functions.
So far we only have:
- a function FindNTOSBootLoader() that detects the existence of a given boot loader;
- a function EnumerateNTOSBootEntries() (and corresponding helpers) that enumerate the different boot entries in the configuration file(s) for a given boot loader, and for each entry, calls a user-provided callback.
Only supported at the moment: ntldr and freeldr.
Doing that allows me to simplify large portions of the NT-OS detection code so that it becomes more bootloader-agnostic, and this will help me for simplifying some parts of usetup/bootsup.c too, later...

svn path=/branches/setup_improvements/; revision=74661
2018-06-03 22:12:43 +02:00

59 lines
1.8 KiB
C

/*
* PROJECT: ReactOS Setup Library
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: NT 5.x family (MS Windows <= 2003, and ReactOS)
* boot loaders management.
* COPYRIGHT: Copyright 2017-2018 Hermes Belusca-Maito
*/
// TODO: Add support for NT 6.x family! (detection + BCD manipulation).
#pragma once
typedef enum _NTOS_BOOT_LOADER_TYPE
{
FreeLdr, // ReactOS' FreeLoader
NtLdr, // Windows <= 2k3 NT "FlexBoot" OS Loader NTLDR
// BootMgr, // Vista+ BCD-oriented BOOTMGR
BldrTypeMax
} NTOS_BOOT_LOADER_TYPE;
/*
* This structure is inspired from the EFI boot entry structures
* BOOT_ENTRY, BOOT_OPTIONS and FILE_PATH that are defined in ndk/iotypes.h .
*/
typedef struct _NTOS_BOOT_ENTRY
{
// ULONG Version; // We might use the ntldr version here?? Or the "BootType" as in freeldr?
// ULONG Length;
// ULONG Id; // Boot entry number (position) in the list
/** PCWSTR FriendlyName; // Human-readable boot entry description **/
PUNICODE_STRING FriendlyName;
PCWSTR BootFilePath; // Path to e.g. osloader.exe, or winload.efi
PCWSTR OsLoadPath; // The OS SystemRoot path
PCWSTR OsOptions;
PCWSTR OsLoadOptions;
} NTOS_BOOT_ENTRY, *PNTOS_BOOT_ENTRY;
typedef NTSTATUS
(NTAPI *PENUM_BOOT_ENTRIES_ROUTINE)(
IN NTOS_BOOT_LOADER_TYPE Type,
IN PNTOS_BOOT_ENTRY BootEntry,
IN PVOID Parameter OPTIONAL);
NTSTATUS
FindNTOSBootLoader( // By handle
IN HANDLE PartitionHandle, // OPTIONAL
IN NTOS_BOOT_LOADER_TYPE Type,
OUT PULONG Version);
NTSTATUS
EnumerateNTOSBootEntries(
IN HANDLE PartitionHandle, // OPTIONAL
IN NTOS_BOOT_LOADER_TYPE Type,
IN PENUM_BOOT_ENTRIES_ROUTINE EnumBootEntriesRoutine,
IN PVOID Parameter OPTIONAL);
/* EOF */