forked from xt-sys/exectos
Implement BlGetConfigBooleanValue() routine
This commit is contained in:
parent
bd02da30ef
commit
12e8704ffb
@ -9,6 +9,39 @@
|
|||||||
#include <xtldr.h>
|
#include <xtldr.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a boolean value of the specified configuration key.
|
||||||
|
*
|
||||||
|
* @param ConfigName
|
||||||
|
* Specifies the configuration key to return its boolean representation.
|
||||||
|
*
|
||||||
|
* @return This routine returns a boolean representation of the configuration value.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
BOOLEAN
|
||||||
|
BlGetConfigBooleanValue(IN CONST PWCHAR ConfigName)
|
||||||
|
{
|
||||||
|
PWCHAR Value;
|
||||||
|
|
||||||
|
/* Get config value */
|
||||||
|
Value = BlGetConfigValue(ConfigName);
|
||||||
|
|
||||||
|
/* Check if option is enabled */
|
||||||
|
if(RtlCompareWideStringInsensitive(Value, L"ENABLED", 0) == 0 ||
|
||||||
|
RtlCompareWideStringInsensitive(Value, L"ON", 0) == 0 ||
|
||||||
|
RtlCompareWideStringInsensitive(Value, L"TRUE", 0) == 0 ||
|
||||||
|
RtlCompareWideStringInsensitive(Value, L"YES", 0) == 0)
|
||||||
|
{
|
||||||
|
/* This option is enabled */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return FALSE by default */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a value of the specified configuration key.
|
* Returns a value of the specified configuration key.
|
||||||
*
|
*
|
||||||
|
@ -123,6 +123,10 @@ XTCDECL
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlFreeMemoryPool(IN PVOID Memory);
|
BlFreeMemoryPool(IN PVOID Memory);
|
||||||
|
|
||||||
|
XTCDECL
|
||||||
|
BOOLEAN
|
||||||
|
BlGetConfigBooleanValue(IN CONST PWCHAR ConfigName);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
PWCHAR
|
PWCHAR
|
||||||
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
||||||
|
@ -112,7 +112,7 @@ BlInitializeBootMenuList(OUT PXTBL_BOOTMENU_ITEM MenuEntries,
|
|||||||
DefaultMenuEntry = BlGetConfigValue(L"DEFAULT");
|
DefaultMenuEntry = BlGetConfigValue(L"DEFAULT");
|
||||||
|
|
||||||
/* Check if configuration allows to use last booted OS */
|
/* Check if configuration allows to use last booted OS */
|
||||||
if(RtlCompareWideStringInsensitive(BlGetConfigValue(L"KEEPLASTBOOT"), L"TRUE", 0) == 0)
|
if(BlGetConfigBooleanValue(L"KEEPLASTBOOT"))
|
||||||
{
|
{
|
||||||
/* Attempt to get last booted Operating System from NVRAM */
|
/* Attempt to get last booted Operating System from NVRAM */
|
||||||
Status = BlGetEfiVariable(&VendorGuid, L"XtLdrLastBootOS", (PVOID*)&LastBooted);
|
Status = BlGetEfiVariable(&VendorGuid, L"XtLdrLastBootOS", (PVOID*)&LastBooted);
|
||||||
@ -312,7 +312,7 @@ BlInvokeBootProtocol(IN PWCHAR ShortName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Check if chosen operating system should be saved */
|
/* Check if chosen operating system should be saved */
|
||||||
if(RtlCompareWideStringInsensitive(BlGetConfigValue(L"KEEPLASTBOOT"), L"TRUE", 0) == 0)
|
if(BlGetConfigBooleanValue(L"KEEPLASTBOOT"))
|
||||||
{
|
{
|
||||||
/* Save chosen operating system in NVRAM */
|
/* Save chosen operating system in NVRAM */
|
||||||
Status = BlSetEfiVariable(&VendorGuid, L"XtLdrLastBootOS", (PVOID)ShortName, RtlWideStringLength(ShortName, 0) * sizeof(WCHAR));
|
Status = BlSetEfiVariable(&VendorGuid, L"XtLdrLastBootOS", (PVOID)ShortName, RtlWideStringLength(ShortName, 0) * sizeof(WCHAR));
|
||||||
|
Loading…
Reference in New Issue
Block a user