OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcBootManagementLib.h File Reference
#include <PiDxe.h>
#include <Guid/AppleVariable.h>
#include <IndustryStandard/AppleBootArgs.h>
#include <IndustryStandard/AppleHid.h>
#include <Library/OcAppleBootPolicyLib.h>
#include <Library/OcAppleDiskImageLib.h>
#include <Library/OcAppleKeyMapLib.h>
#include <Library/OcFlexArrayLib.h>
#include <Library/OcStringLib.h>
#include <Library/OcStorageLib.h>
#include <Library/OcTypingLib.h>
#include <Protocol/AppleKeyMapAggregator.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/AppleBeepGen.h>
#include <Protocol/OcAudio.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/AppleUserInterface.h>

Go to the source code of this file.

Data Structures

struct  OC_BOOT_ENTRY_
 
struct  OC_PARSED_VAR_ASCII_
 
struct  OC_PARSED_VAR_UNICODE_
 
union  OC_PARSED_VAR_
 
struct  OC_BOOT_FILESYSTEM_
 
struct  OC_BOOT_CONTEXT_
 
struct  OC_PICKER_ENTRY
 
struct  OC_PICKER_KEY_INFO
 
struct  OC_KB_DEBUG_CALLBACKS
 
struct  OC_PRIVILEGE_CONTEXT
 
struct  OC_PICKER_CONTEXT_
 
struct  OC_HOTKEY_CONTEXT_
 
struct  OC_BOOT_ARGUMENTS_
 

Macros

#define OC_TRACE_PARSE_VARS   DEBUG_VERBOSE
 
#define OC_MAX_INSTANCE_IDENTIFIER_SIZE   64
 
#define OC_MAX_CONTENT_VISIBILITY_SIZE   512
 
#define OC_MENU_BOOT_MENU   L"OpenCore Boot Menu"
 
#define OC_MENU_UEFI_SHELL_ENTRY   L"UEFI Shell"
 
#define OC_MENU_PASSWORD_REQUEST   L"Password: "
 
#define OC_MENU_PASSWORD_PROCESSING   L"Verifying password..."
 
#define OC_MENU_PASSWORD_RETRY_LIMIT   L"Password retry limit exceeded."
 
#define OC_MENU_CHOOSE_OS   L"Choose the Operating System: "
 
#define OC_MENU_SHOW_AUXILIARY   L"Show Auxiliary"
 
#define OC_MENU_RELOADING   L"Reloading"
 
#define OC_MENU_TIMEOUT   L"Timeout"
 
#define OC_MENU_OK   L"OK"
 
#define OC_MENU_EXTERNAL   L" (external)"
 
#define OC_MENU_DISK_IMAGE   L" (dmg)"
 
#define OC_MENU_SHUTDOWN   L"Shutting Down"
 
#define OC_MENU_RESTART   L"Restarting"
 
#define OC_FLAVOUR_AUTO   "Auto"
 
#define OC_FLAVOUR_RESET_NVRAM   "ResetNVRAM:NVRAMTool"
 
#define OC_FLAVOUR_TOGGLE_SIP   "ToggleSIP:NVRAMTool"
 
#define OC_FLAVOUR_TOGGLE_SIP_ENABLED   "ToggleSIP_Enabled:ToggleSIP:NVRAMTool"
 
#define OC_FLAVOUR_TOGGLE_SIP_DISABLED   "ToggleSIP_Disabled:ToggleSIP:NVRAMTool"
 
#define OC_FLAVOUR_FIRMWARE_SETTINGS   "FirmwareSettings"
 
#define OC_FLAVOUR_HTTP_BOOT4   "HttpBoot4:HttpBoot:NetworkBoot"
 
#define OC_FLAVOUR_HTTP_BOOT6   "HttpBoot6:HttpBoot:NetworkBoot"
 
#define OC_FLAVOUR_PXE_BOOT4   "PxeBoot4:PxeBoot:NetworkBoot"
 
#define OC_FLAVOUR_PXE_BOOT6   "PxeBoot6:PxeBoot:NetworkBoot"
 
#define OC_FLAVOUR_APPLE_OS   "Apple"
 
#define OC_FLAVOUR_APPLE_RECOVERY   "AppleRecv:Apple"
 
#define OC_FLAVOUR_APPLE_FW   "AppleRecv:Apple"
 
#define OC_FLAVOUR_APPLE_TIME_MACHINE   "AppleTM:Apple"
 
#define OC_FLAVOUR_WINDOWS   "Windows"
 
#define OC_FLAVOUR_ID_RESET_NVRAM   "ResetNVRAM"
 
#define OC_FLAVOUR_ID_UEFI_SHELL   "UEFIShell"
 
#define OC_FLAVOUR_ID_TOGGLE_SIP_ENABLED   "ToggleSIP_Enabled"
 
#define OC_FLAVOUR_ID_TOGGLE_SIP_DISABLED   "ToggleSIP_Disabled"
 
#define OC_FLAVOUR_ID_FIRMWARE_SETTINGS   "FirmwareSettings"
 
#define OC_FLAVOUR_ID_NETWORK_BOOT   "NetworkBoot"
 
#define OPEN_CORE_IMAGE_PATH   L"Resources\\Image\\"
 
#define OPEN_CORE_LABEL_PATH   L"Resources\\Label\\"
 
#define OPEN_CORE_AUDIO_PATH   L"Resources\\Audio\\"
 
#define OPEN_CORE_FONT_PATH   L"Resources\\Font\\"
 
#define OC_ATTR_USE_VOLUME_ICON   BIT0
 
#define OC_ATTR_USE_DISK_LABEL_FILE   BIT1
 
#define OC_ATTR_USE_GENERIC_LABEL_IMAGE   BIT2
 
#define OC_ATTR_HIDE_THEMED_ICONS   BIT3
 
#define OC_ATTR_USE_POINTER_CONTROL   BIT4
 
#define OC_ATTR_SHOW_DEBUG_DISPLAY   BIT5
 
#define OC_ATTR_USE_MINIMAL_UI   BIT6
 
#define OC_ATTR_USE_FLAVOUR_ICON   BIT7
 
#define OC_ATTR_USE_REVERSED_UI   BIT8
 
#define OC_ATTR_REDUCE_MOTION   BIT9
 
#define OC_ATTR_ALL_BITS
 
#define OC_VOICE_OVER_IDLE_TIMEOUT_MS   700
 Experimental, less is problematic.
 
#define OC_VOICE_OVER_SIGNAL_NORMAL_MS   200
 From boot.efi, constant.
 
#define OC_VOICE_OVER_SILENCE_NORMAL_MS   150
 From boot.efi, constant.
 
#define OC_VOICE_OVER_SIGNALS_NORMAL   1
 Username prompt or any input for boot.efi.
 
#define OC_VOICE_OVER_SIGNALS_PASSWORD   2
 Password prompt for boot.efi.
 
#define OC_VOICE_OVER_SIGNALS_PASSWORD_OK   3
 Password correct for boot.efi.
 
#define OC_VOICE_OVER_SIGNAL_ERROR_MS   1000
 
#define OC_VOICE_OVER_SILENCE_ERROR_MS   150
 
#define OC_VOICE_OVER_SIGNALS_ERROR   1
 Password verification error or boot failure.
 
#define OC_VOICE_OVER_SIGNALS_HWERROR   3
 Hardware error.
 
#define OC_BOOT_UNKNOWN   BIT0
 
#define OC_BOOT_APPLE_OS   BIT1
 
#define OC_BOOT_APPLE_RECOVERY   BIT2
 
#define OC_BOOT_APPLE_TIME_MACHINE   BIT3
 
#define OC_BOOT_APPLE_FW_UPDATE   BIT4
 
#define OC_BOOT_APPLE_ANY   (OC_BOOT_APPLE_OS | OC_BOOT_APPLE_RECOVERY | OC_BOOT_APPLE_TIME_MACHINE | OC_BOOT_APPLE_FW_UPDATE)
 
#define OC_BOOT_WINDOWS   BIT5
 
#define OC_BOOT_EXTERNAL_OS   BIT6
 
#define OC_BOOT_EXTERNAL_TOOL   BIT7
 
#define OC_BOOT_SYSTEM   BIT8
 
#define OC_BOOT_UNMANAGED   BIT9
 
#define OC_KERN_CAPABILITY_K32_U32   BIT0
 Supports K32 and U32 (10.4~10.6)
 
#define OC_KERN_CAPABILITY_K32_U64   BIT1
 Supports K32 and U64 (10.4~10.7)
 
#define OC_KERN_CAPABILITY_K64_U64   BIT2
 Supports K64 and U64 (10.6+)
 
#define OC_KERN_CAPABILITY_K32_K64_U64   (OC_KERN_CAPABILITY_K32_U64 | OC_KERN_CAPABILITY_K64_U64)
 
#define OC_KERN_CAPABILITY_K32_U32_U64   (OC_KERN_CAPABILITY_K32_U32 | OC_KERN_CAPABILITY_K32_U64)
 
#define OC_KERN_CAPABILITY_ALL   (OC_KERN_CAPABILITY_K32_U32 | OC_KERN_CAPABILITY_K32_K64_U64)
 
#define OC_SCAN_FILE_SYSTEM_LOCK   BIT0
 
#define OC_SCAN_DEVICE_LOCK   BIT1
 
#define OC_SCAN_ALLOW_FS_APFS   BIT8
 
#define OC_SCAN_ALLOW_FS_HFS   BIT9
 
#define OC_SCAN_ALLOW_FS_ESP   BIT10
 
#define OC_SCAN_ALLOW_FS_NTFS   BIT11
 
#define OC_SCAN_ALLOW_FS_LINUX_ROOT   BIT12
 
#define OC_SCAN_ALLOW_FS_LINUX_DATA   BIT13
 
#define OC_SCAN_ALLOW_FS_XBOOTLDR   BIT14
 
#define OC_SCAN_ALLOW_DEVICE_SATA   BIT16
 
#define OC_SCAN_ALLOW_DEVICE_SASEX   BIT17
 
#define OC_SCAN_ALLOW_DEVICE_SCSI   BIT18
 
#define OC_SCAN_ALLOW_DEVICE_NVME   BIT19
 
#define OC_SCAN_ALLOW_DEVICE_ATAPI   BIT20
 
#define OC_SCAN_ALLOW_DEVICE_USB   BIT21
 
#define OC_SCAN_ALLOW_DEVICE_FIREWIRE   BIT22
 
#define OC_SCAN_ALLOW_DEVICE_SDCARD   BIT23
 
#define OC_SCAN_ALLOW_DEVICE_PCI   BIT24
 
#define OC_SCAN_DEVICE_BITS
 
#define OC_SCAN_FILE_SYSTEM_BITS
 
#define OC_SCAN_DEFAULT_POLICY
 
#define HIBERNATE_MODE_NONE   0U
 
#define HIBERNATE_MODE_RTC   1U
 
#define HIBERNATE_MODE_NVRAM   2U
 
#define OC_INPUT_STR   "123456789ABCDEFGHIJKLMNOPQRSTUVXWZ"
 
#define OC_INPUT_MAX   L_STR_LEN (OC_INPUT_STR)
 
#define OC_INPUT_ABORTED   -1
 Esc or 0.
 
#define OC_INPUT_NO_ACTION   -2
 Some other key.
 
#define OC_INPUT_TIMEOUT   -3
 Timeout.
 
#define OC_INPUT_CONTINUE   -4
 Continue (press enter)
 
#define OC_INPUT_UP   -5
 Move up.
 
#define OC_INPUT_DOWN   -6
 Move down.
 
#define OC_INPUT_LEFT   -7
 Move left.
 
#define OC_INPUT_RIGHT   -8
 Move right.
 
#define OC_INPUT_TOP   -9
 Move to top.
 
#define OC_INPUT_BOTTOM   -10
 Move to bottom.
 
#define OC_INPUT_MORE   -11
 Show more entries (press space)
 
#define OC_INPUT_VOICE_OVER   -12
 Toggle VoiceOver (press CMD+F5)
 
#define OC_INPUT_INTERNAL   -13
 Accepted internal hotkey (e.g. Apple)
 
#define OC_INPUT_TYPING_CLEAR_ALL   -14
 Clear current input while typing (press esc)
 
#define OC_INPUT_TYPING_BACKSPACE   -15
 Clear last typed character while typing (press backspace)
 
#define OC_INPUT_TYPING_LEFT   -16
 Move left while typing (UI does not have to support)
 
#define OC_INPUT_TYPING_RIGHT   -17
 Move right while typing (UI does not have to support)
 
#define OC_INPUT_TYPING_CONFIRM   -18
 Confirm input while typing (press enter)
 
#define OC_INPUT_SWITCH_FOCUS   -19
 Switch UI focus (tab and shift+tab)
 
#define OC_INPUT_FUNCTIONAL(x)
 Function hotkeys.
 
#define OC_MODIFIERS_NONE   0
 
#define OC_MODIFIERS_SET_DEFAULT   BIT0
 
#define OC_MODIFIERS_REVERSE_SWITCH_FOCUS   BIT1
 
#define OC_PICKER_KEYS_TYPING   BIT0
 
#define OC_PICKER_KEYS_HOTKEYS   BIT1
 
#define OC_PICKER_KEYS_VOICE_OVER   BIT2
 
#define OC_PICKER_KEYS_TAB_CONTROL   BIT3
 
#define OC_PICKER_KEYS_FOR_TYPING    (OC_PICKER_KEYS_TYPING | OC_PICKER_KEYS_VOICE_OVER | OC_PICKER_KEYS_TAB_CONTROL)
 
#define OC_PICKER_KEYS_FOR_PICKER    (OC_PICKER_KEYS_HOTKEYS | OC_PICKER_KEYS_VOICE_OVER | OC_PICKER_KEYS_TAB_CONTROL)
 
#define MAX_LOAD_OPTIONS_SIZE   SIZE_16KB
 

Typedefs

typedef struct OC_PICKER_CONTEXT_ OC_PICKER_CONTEXT
 
typedef struct OC_HOTKEY_CONTEXT_ OC_HOTKEY_CONTEXT
 
typedef UINT32 OC_BOOT_ENTRY_TYPE
 
typedef enum OC_PICKER_MODE_ OC_PICKER_MODE
 
typedef EFI_STATUS(* OC_BOOT_SYSTEM_ACTION) (IN OUT OC_PICKER_CONTEXT *PickerContext)
 
typedef EFI_STATUS(* OC_BOOT_UNMANAGED_ACTION) (IN OUT OC_PICKER_CONTEXT *PickerContext, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
typedef EFI_STATUS(* OC_BOOT_UNMANAGED_GET_FINAL_DP) (IN OUT OC_PICKER_CONTEXT *PickerContext, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
 
typedef struct OC_BOOT_ENTRY_ OC_BOOT_ENTRY
 
typedef EFI_STATUS(EFIAPI * OC_CUSTOM_READ) (IN OC_STORAGE_CONTEXT *Storage, IN OC_BOOT_ENTRY *ChosenEntry, OUT VOID **Data, OUT UINT32 *DataSize, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *StorageHandle, OUT EFI_DEVICE_PATH_PROTOCOL **StoragePath, IN OC_DMG_LOADING_SUPPORT DmgLoading, OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT *DmgPreloadContext, OUT VOID **CustomFreeContext)
 
typedef EFI_STATUS(EFIAPI * OC_CUSTOM_FREE) (IN VOID *CustomFreeContext)
 
typedef struct OC_PARSED_VAR_ASCII_ OC_PARSED_VAR_ASCII
 
typedef struct OC_PARSED_VAR_UNICODE_ OC_PARSED_VAR_UNICODE
 
typedef union OC_PARSED_VAR_ OC_PARSED_VAR
 
typedef struct OC_BOOT_FILESYSTEM_ OC_BOOT_FILESYSTEM
 
typedef struct OC_BOOT_CONTEXT_ OC_BOOT_CONTEXT
 
typedef EFI_STATUS(EFIAPI * OC_IMAGE_START) (IN OC_BOOT_ENTRY *ChosenEntry, IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL, IN BOOLEAN LaunchInText)
 
typedef INTN OC_KEY_CODE
 
typedef UINT16 OC_MODIFIER_MAP
 
typedef UINTN OC_PICKER_KEY_MAP
 
typedef EFI_STATUS(EFIAPI * OC_REQ_PRIVILEGE) (IN OC_PICKER_CONTEXT *Context, IN OC_PRIVILEGE_LEVEL Level)
 
typedef EFI_STATUS(EFIAPI * OC_SHOW_MENU) (IN OC_BOOT_CONTEXT *BootContext, IN OC_BOOT_ENTRY **BootEntries, OUT OC_BOOT_ENTRY **ChosenBootEntry)
 
typedef EFI_STATUS(EFIAPI * OC_GET_ENTRY_LABEL_IMAGE) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN UINT8 Scale, OUT VOID **ImageData, OUT UINT32 *DataLength)
 
typedef EFI_STATUS(EFIAPI * OC_GET_ENTRY_ICON) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, OUT VOID **ImageData, OUT UINT32 *DataLength)
 
typedef VOID(EFIAPI * OC_GET_KEY_INFO) (IN OUT OC_PICKER_CONTEXT *Context, IN OC_PICKER_KEY_MAP KeyFilter, OUT OC_PICKER_KEY_INFO *PickerKeyInfo)
 
typedef UINT64(EFIAPI * OC_GET_KEY_WAIT_END_TIME) (IN UINT64 Timeout)
 
typedef BOOLEAN(EFIAPI * OC_WAIT_FOR_KEY_INFO) (IN OUT OC_PICKER_CONTEXT *Context, IN UINT64 EndTime, IN OC_PICKER_KEY_MAP KeyFilter, IN OUT OC_PICKER_KEY_INFO *PickerKeyInfo)
 
typedef VOID(EFIAPI * OC_FLUSH_TYPING_BUFFER) (IN OUT OC_PICKER_CONTEXT *Context)
 
typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_FILE) (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath, IN CONST CHAR8 *BaseType, IN BOOLEAN Fallback)
 
typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_BEEP) (IN OC_PICKER_CONTEXT *Context, IN UINT32 ToneCount, IN UINT32 ToneLength, IN UINT32 SilenceLength)
 
typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_ENTRY) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)
 
typedef VOID(EFIAPI * OC_TOGGLE_VOICE_OVER) (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath OPTIONAL, IN CONST CHAR8 *BaseType OPTIONAL)
 
typedef VOID(EFIAPI * OC_KB_DEBUG_INSTRUMENT_LOOP_DELAY) (UINT64 LoopDelayStart, UINT64 LoopDelayEnd)
 
typedef VOID(EFIAPI * OC_KB_DEBUG_SHOW) (UINTN NumKeysDown, UINTN NumKeysHeld, APPLE_MODIFIER_MAP Modifiers)
 
typedef BOOLEAN(EFIAPI * OC_VERIFY_PASSWORD) (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext)
 
typedef struct OC_BOOT_ARGUMENTS_ OC_BOOT_ARGUMENTS
 
typedef VOID(* OC_IMAGE_LOADER_PATCH) (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN VOID *SourceBuffer, IN UINTN SourceSize)
 
typedef VOID(* OC_IMAGE_LOADER_CONFIGURE) (IN OUT EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN UINT32 Capabilities)
 

Enumerations

enum  OC_PICKER_MODE_ { OcPickerModeBuiltin , OcPickerModeExternal , OcPickerModeApple }
 
enum  OC_DMG_LOADING_SUPPORT { OcDmgLoadingDisabled , OcDmgLoadingAnyImage , OcDmgLoadingAppleSigned }
 
enum  OC_PRIVILEGE_LEVEL { OcPrivilegeUnauthorized = 0 , OcPrivilegeAuthorized = 1 }
 
enum  OC_PICKER_CMD {
  OcPickerDefault = 0 , OcPickerShowPicker = 1 , OcPickerProtocolHotKey = 2 , OcPickerBootApple = 3 ,
  OcPickerBootAppleRecovery = 4
}
 

Functions

EFI_STATUS EFIAPI OcGetBootEntryLabelImage (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN UINT8 Scale, OUT VOID **ImageData, OUT UINT32 *DataLength)
 
EFI_STATUS EFIAPI OcGetBootEntryIcon (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, OUT VOID **ImageData, OUT UINT32 *DataLength)
 
OC_BOOT_CONTEXTOcScanForBootEntries (IN OC_PICKER_CONTEXT *Context)
 
OC_BOOT_CONTEXTOcScanForDefaultBootEntry (IN OC_PICKER_CONTEXT *Context, IN BOOLEAN UseBootNextOnly)
 
OC_BOOT_ENTRY ** OcEnumerateEntries (IN OC_BOOT_CONTEXT *BootContext)
 
VOID OcFreeBootContext (IN OUT OC_BOOT_CONTEXT *Context)
 
UINT32 OcGetDefaultBootEntry (IN OC_PICKER_CONTEXT *Context, IN OUT OC_BOOT_ENTRY *BootEntries, IN UINTN NumBootEntries)
 
EFI_STATUS OcSetDefaultBootEntry (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)
 
EFI_STATUS EFIAPI OcShowSimplePasswordRequest (IN OC_PICKER_CONTEXT *Context, IN OC_PRIVILEGE_LEVEL Level)
 
BOOLEAN EFIAPI OcVerifyPassword (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext)
 
EFI_STATUS EFIAPI OcShowSimpleBootMenu (IN OC_BOOT_CONTEXT *BootContext, IN OC_BOOT_ENTRY **BootEntries, OUT OC_BOOT_ENTRY **ChosenBootEntry)
 
EFI_STATUS OcLoadBootEntry (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN EFI_HANDLE ParentHandle)
 
EFI_STATUS OcActivateHibernateWake (IN UINT32 HibernateMask)
 
EFI_STATUS OcHandleRecoveryRequest (OUT EFI_DEVICE_PATH_PROTOCOL **Initiator OPTIONAL)
 
VOID * OcReadApplePanicLog (OUT UINT32 *PanicSize)
 
BOOLEAN OcIsAppleHibernateWake (VOID)
 
VOID OcLoadPickerHotKeys (IN OUT OC_PICKER_CONTEXT *Context)
 
EFI_STATUS OcInitHotKeys (IN OUT OC_PICKER_CONTEXT *Context)
 
VOID OcFreeHotKeys (IN OC_PICKER_CONTEXT *Context)
 
EFI_STATUS OcRunBootPicker (IN OC_PICKER_CONTEXT *Context)
 
UINT32 OcGetDevicePolicyType (IN EFI_HANDLE Handle, OUT BOOLEAN *External OPTIONAL)
 
UINT32 OcGetFileSystemPolicyType (IN EFI_HANDLE Handle)
 
OC_BOOT_ENTRY_TYPE OcGetBootDevicePathType (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT BOOLEAN *IsFolder OPTIONAL, OUT BOOLEAN *IsGeneric OPTIONAL)
 
EFI_LOADED_IMAGE_PROTOCOL * OcGetAppleBootLoadedImage (IN EFI_HANDLE ImageHandle)
 
BOOLEAN EFIAPI OcValidLoadOptions (IN UINT32 LoadOptionsSize, IN CONST VOID *LoadOptions)
 
BOOLEAN EFIAPI OcHasLoadOptions (IN UINT32 LoadOptionsSize, IN CONST VOID *LoadOptions)
 
VOID OcParseBootArgs (OUT OC_BOOT_ARGUMENTS *Arguments, IN VOID *BootArgs)
 
BOOLEAN OcCheckArgumentFromEnv (IN EFI_LOADED_IMAGE *LoadedImage OPTIONAL, IN EFI_GET_VARIABLE GetVariable OPTIONAL, IN CONST CHAR8 *Argument, IN CONST UINTN ArgumentLength, IN OUT CHAR8 **Value OPTIONAL)
 
CONST CHAR8 * OcGetArgumentFromCmd (IN CONST CHAR8 *CommandLine, IN CONST CHAR8 *Argument, IN CONST UINTN ArgumentLength, OUT UINTN *ValueLength OPTIONAL)
 
VOID OcRemoveArgumentFromCmd (IN OUT CHAR8 *CommandLine, IN CONST CHAR8 *Argument)
 
BOOLEAN OcAppendArgumentToCmd (IN OUT OC_PICKER_CONTEXT *Context OPTIONAL, IN OUT CHAR8 *CommandLine, IN CONST CHAR8 *Argument, IN CONST UINTN ArgumentLength)
 
BOOLEAN OcAppendArgumentsToLoadedImage (IN OUT EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN CONST CHAR8 **Arguments, IN UINT32 ArgumentCount, IN BOOLEAN Replace)
 
EFI_STATUS OcRunFirmwareApplication (IN EFI_GUID *ApplicationGuid, IN BOOLEAN SetReason)
 
EFI_STATUS EFIAPI OcPreLocateAudioProtocol (IN OC_PICKER_CONTEXT *Context)
 
EFI_STATUS EFIAPI OcPlayAudioFile (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath, IN CONST CHAR8 *BaseType, IN BOOLEAN Fallback)
 
EFI_STATUS EFIAPI OcPlayAudioBeep (IN OC_PICKER_CONTEXT *Context, IN UINT32 ToneCount, IN UINT32 ToneLength, IN UINT32 SilenceLength)
 
EFI_STATUS EFIAPI OcPlayAudioEntry (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)
 
VOID EFIAPI OcToggleVoiceOver (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath OPTIONAL, IN CONST CHAR8 *BaseType OPTIONAL)
 
UINT16 * OcGetBootOrder (IN EFI_GUID *BootVariableGuid, IN BOOLEAN WithBootNext, OUT UINTN *BootOrderCount, OUT BOOLEAN *Deduplicated OPTIONAL, OUT BOOLEAN *HasBootNext OPTIONAL, IN BOOLEAN UseBootNextOnly)
 
EFI_STATUS OcRegisterBootstrapBootOption (IN CONST CHAR16 *OptionName, IN EFI_HANDLE DeviceHandle, IN CONST CHAR16 *FilePath, IN BOOLEAN ShortForm, IN CONST CHAR16 *MatchSuffix, IN UINTN MatchSuffixLen)
 
VOID OcImageLoaderInit (IN CONST BOOLEAN ProtectUefiServices, IN CONST BOOLEAN FixupAppleEfiImages)
 
VOID OcImageLoaderActivate (VOID)
 
VOID OcImageLoaderRegisterPatch (IN OC_IMAGE_LOADER_PATCH Patch OPTIONAL)
 
VOID OcImageLoaderRegisterConfigure (IN OC_IMAGE_LOADER_CONFIGURE Configure OPTIONAL)
 
EFI_STATUS EFIAPI OcImageLoaderLoad (IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
 
EFI_STATUS OcParseLoadOptions (IN CONST EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, OUT OC_FLEX_ARRAY **ParsedVars)
 
EFI_STATUS OcParseVars (IN VOID *StrVars, OUT OC_FLEX_ARRAY **ParsedVars, IN CONST OC_STRING_FORMAT StringFormat, IN CONST BOOLEAN TokensOnly)
 
OC_PARSED_VAROcParsedVarsItemAt (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST UINTN Index)
 
BOOLEAN OcParsedVarsGetStr (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST VOID *Name, OUT VOID **StrValue, IN CONST OC_STRING_FORMAT StringFormat)
 
BOOLEAN OcParsedVarsGetUnicodeStr (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST CHAR16 *Name, OUT CHAR16 **StrValue)
 
BOOLEAN OcParsedVarsGetAsciiStr (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST CHAR8 *Name, OUT CHAR8 **StrValue)
 
BOOLEAN OcHasParsedVar (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST VOID *Name, IN CONST OC_STRING_FORMAT StringFormat)
 
EFI_STATUS OcParsedVarsGetInt (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST VOID *Name, OUT UINTN *Value, IN CONST OC_STRING_FORMAT StringFormat)
 
EFI_STATUS OcParsedVarsGetGuid (IN CONST OC_FLEX_ARRAY *ParsedVars, IN CONST VOID *Name, OUT EFI_GUID *Value, IN CONST OC_STRING_FORMAT StringFormat)
 
VOID OcLocateBootEntryProtocolHandles (IN OUT EFI_HANDLE **EntryProtocolHandles, IN OUT UINTN *EntryProtocolHandleCount)
 
VOID OcFreeBootEntryProtocolHandles (EFI_HANDLE **EntryProtocolHandles)
 
EFI_STATUS OcAddEntriesFromBootEntryProtocol (IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN EFI_HANDLE *EntryProtocolHandles, IN UINTN EntryProtocolHandleCount, IN CONST VOID *DefaultEntryId, OPTIONAL IN BOOLEAN CreateDefault, IN BOOLEAN CreateForHotKey)
 
EFI_STATUS OcUnlockAppleFirmwareUI (VOID)
 
EFI_STATUS OcLaunchAppleBootPicker (VOID)
 
EFI_STATUS EFIAPI OcGetBootEntryFileFromDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *FileName, IN CONST CHAR8 *DebugFileType, IN UINT32 MaxFileSize, IN UINT32 MinFileSize, OUT VOID **FileData, OUT UINT32 *DataLength OPTIONAL, IN BOOLEAN SearchAtLeaf, IN BOOLEAN SearchAtRoot)
 
EFI_STATUS EFIAPI OcGetBootEntryFile (IN OC_BOOT_ENTRY *BootEntry, IN CONST CHAR16 *FileName, IN CONST CHAR8 *DebugFileType, IN UINT32 MaxFileSize, IN UINT32 MinFileSize, OUT VOID **FileData, OUT UINT32 *DataLength OPTIONAL, IN BOOLEAN SearchAtLeaf, IN BOOLEAN SearchAtRoot)
 
EFI_STATUS EFIAPI OcResetToFirmwareSettingsSupported (VOID)
 
EFI_STATUS EFIAPI OcResetSystem (IN CHAR16 *Mode)
 

Detailed Description

Copyright (C) 2019-2022, vit9696, mikebeaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause

Definition in file OcBootManagementLib.h.

Macro Definition Documentation

◆ HIBERNATE_MODE_NONE

#define HIBERNATE_MODE_NONE   0U

Hibernate detection bit mask for hibernate source usage.

Definition at line 1164 of file OcBootManagementLib.h.

◆ HIBERNATE_MODE_NVRAM

#define HIBERNATE_MODE_NVRAM   2U

Definition at line 1166 of file OcBootManagementLib.h.

◆ HIBERNATE_MODE_RTC

#define HIBERNATE_MODE_RTC   1U

Definition at line 1165 of file OcBootManagementLib.h.

◆ MAX_LOAD_OPTIONS_SIZE

#define MAX_LOAD_OPTIONS_SIZE   SIZE_16KB

Definition at line 1582 of file OcBootManagementLib.h.

◆ OC_ATTR_ALL_BITS

#define OC_ATTR_ALL_BITS
Value:

Definition at line 123 of file OcBootManagementLib.h.

◆ OC_ATTR_HIDE_THEMED_ICONS

#define OC_ATTR_HIDE_THEMED_ICONS   BIT3

Definition at line 116 of file OcBootManagementLib.h.

◆ OC_ATTR_REDUCE_MOTION

#define OC_ATTR_REDUCE_MOTION   BIT9

Definition at line 122 of file OcBootManagementLib.h.

◆ OC_ATTR_SHOW_DEBUG_DISPLAY

#define OC_ATTR_SHOW_DEBUG_DISPLAY   BIT5

Definition at line 118 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_DISK_LABEL_FILE

#define OC_ATTR_USE_DISK_LABEL_FILE   BIT1

Definition at line 114 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_FLAVOUR_ICON

#define OC_ATTR_USE_FLAVOUR_ICON   BIT7

Definition at line 120 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_GENERIC_LABEL_IMAGE

#define OC_ATTR_USE_GENERIC_LABEL_IMAGE   BIT2

Definition at line 115 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_MINIMAL_UI

#define OC_ATTR_USE_MINIMAL_UI   BIT6

Definition at line 119 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_POINTER_CONTROL

#define OC_ATTR_USE_POINTER_CONTROL   BIT4

Definition at line 117 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_REVERSED_UI

#define OC_ATTR_USE_REVERSED_UI   BIT8

Definition at line 121 of file OcBootManagementLib.h.

◆ OC_ATTR_USE_VOLUME_ICON

#define OC_ATTR_USE_VOLUME_ICON   BIT0

Attributes supported by the interfaces.

Definition at line 113 of file OcBootManagementLib.h.

◆ OC_BOOT_APPLE_ANY

Definition at line 161 of file OcBootManagementLib.h.

◆ OC_BOOT_APPLE_FW_UPDATE

#define OC_BOOT_APPLE_FW_UPDATE   BIT4

Definition at line 160 of file OcBootManagementLib.h.

◆ OC_BOOT_APPLE_OS

#define OC_BOOT_APPLE_OS   BIT1

Definition at line 157 of file OcBootManagementLib.h.

◆ OC_BOOT_APPLE_RECOVERY

#define OC_BOOT_APPLE_RECOVERY   BIT2

Definition at line 158 of file OcBootManagementLib.h.

◆ OC_BOOT_APPLE_TIME_MACHINE

#define OC_BOOT_APPLE_TIME_MACHINE   BIT3

Definition at line 159 of file OcBootManagementLib.h.

◆ OC_BOOT_EXTERNAL_OS

#define OC_BOOT_EXTERNAL_OS   BIT6

Definition at line 163 of file OcBootManagementLib.h.

◆ OC_BOOT_EXTERNAL_TOOL

#define OC_BOOT_EXTERNAL_TOOL   BIT7

Definition at line 164 of file OcBootManagementLib.h.

◆ OC_BOOT_SYSTEM

#define OC_BOOT_SYSTEM   BIT8

Definition at line 165 of file OcBootManagementLib.h.

◆ OC_BOOT_UNKNOWN

#define OC_BOOT_UNKNOWN   BIT0

Definition at line 156 of file OcBootManagementLib.h.

◆ OC_BOOT_UNMANAGED

#define OC_BOOT_UNMANAGED   BIT9

Definition at line 166 of file OcBootManagementLib.h.

◆ OC_BOOT_WINDOWS

#define OC_BOOT_WINDOWS   BIT5

Definition at line 162 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_APPLE_FW

#define OC_FLAVOUR_APPLE_FW   "AppleRecv:Apple"

Definition at line 88 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_APPLE_OS

#define OC_FLAVOUR_APPLE_OS   "Apple"

Definition at line 86 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_APPLE_RECOVERY

#define OC_FLAVOUR_APPLE_RECOVERY   "AppleRecv:Apple"

Definition at line 87 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_APPLE_TIME_MACHINE

#define OC_FLAVOUR_APPLE_TIME_MACHINE   "AppleTM:Apple"

Definition at line 89 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_AUTO

#define OC_FLAVOUR_AUTO   "Auto"

Predefined flavours.

Definition at line 76 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_FIRMWARE_SETTINGS

#define OC_FLAVOUR_FIRMWARE_SETTINGS   "FirmwareSettings"

Definition at line 81 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_HTTP_BOOT4

#define OC_FLAVOUR_HTTP_BOOT4   "HttpBoot4:HttpBoot:NetworkBoot"

Definition at line 82 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_HTTP_BOOT6

#define OC_FLAVOUR_HTTP_BOOT6   "HttpBoot6:HttpBoot:NetworkBoot"

Definition at line 83 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_FIRMWARE_SETTINGS

#define OC_FLAVOUR_ID_FIRMWARE_SETTINGS   "FirmwareSettings"

Definition at line 99 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_NETWORK_BOOT

#define OC_FLAVOUR_ID_NETWORK_BOOT   "NetworkBoot"

Definition at line 100 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_RESET_NVRAM

#define OC_FLAVOUR_ID_RESET_NVRAM   "ResetNVRAM"

Predefined flavour ids.

Definition at line 95 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_TOGGLE_SIP_DISABLED

#define OC_FLAVOUR_ID_TOGGLE_SIP_DISABLED   "ToggleSIP_Disabled"

Definition at line 98 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_TOGGLE_SIP_ENABLED

#define OC_FLAVOUR_ID_TOGGLE_SIP_ENABLED   "ToggleSIP_Enabled"

Definition at line 97 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_ID_UEFI_SHELL

#define OC_FLAVOUR_ID_UEFI_SHELL   "UEFIShell"

Definition at line 96 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_PXE_BOOT4

#define OC_FLAVOUR_PXE_BOOT4   "PxeBoot4:PxeBoot:NetworkBoot"

Definition at line 84 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_PXE_BOOT6

#define OC_FLAVOUR_PXE_BOOT6   "PxeBoot6:PxeBoot:NetworkBoot"

Definition at line 85 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_RESET_NVRAM

#define OC_FLAVOUR_RESET_NVRAM   "ResetNVRAM:NVRAMTool"

Definition at line 77 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_TOGGLE_SIP

#define OC_FLAVOUR_TOGGLE_SIP   "ToggleSIP:NVRAMTool"

Definition at line 78 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_TOGGLE_SIP_DISABLED

#define OC_FLAVOUR_TOGGLE_SIP_DISABLED   "ToggleSIP_Disabled:ToggleSIP:NVRAMTool"

Definition at line 80 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_TOGGLE_SIP_ENABLED

#define OC_FLAVOUR_TOGGLE_SIP_ENABLED   "ToggleSIP_Enabled:ToggleSIP:NVRAMTool"

Definition at line 79 of file OcBootManagementLib.h.

◆ OC_FLAVOUR_WINDOWS

#define OC_FLAVOUR_WINDOWS   "Windows"

Definition at line 90 of file OcBootManagementLib.h.

◆ OC_INPUT_ABORTED

#define OC_INPUT_ABORTED   -1

Esc or 0.

Definition at line 1425 of file OcBootManagementLib.h.

◆ OC_INPUT_BOTTOM

#define OC_INPUT_BOTTOM   -10

Move to bottom.

Definition at line 1434 of file OcBootManagementLib.h.

◆ OC_INPUT_CONTINUE

#define OC_INPUT_CONTINUE   -4

Continue (press enter)

Definition at line 1428 of file OcBootManagementLib.h.

◆ OC_INPUT_DOWN

#define OC_INPUT_DOWN   -6

Move down.

Definition at line 1430 of file OcBootManagementLib.h.

◆ OC_INPUT_FUNCTIONAL

#define OC_INPUT_FUNCTIONAL ( x)
Value:
(-50 - (x))
UINT16 x
Definition BmfFile.h:83

Function hotkeys.

Definition at line 1444 of file OcBootManagementLib.h.

◆ OC_INPUT_INTERNAL

#define OC_INPUT_INTERNAL   -13

Accepted internal hotkey (e.g. Apple)

Definition at line 1437 of file OcBootManagementLib.h.

◆ OC_INPUT_LEFT

#define OC_INPUT_LEFT   -7

Move left.

Definition at line 1431 of file OcBootManagementLib.h.

◆ OC_INPUT_MAX

#define OC_INPUT_MAX   L_STR_LEN (OC_INPUT_STR)

Definition at line 1424 of file OcBootManagementLib.h.

◆ OC_INPUT_MORE

#define OC_INPUT_MORE   -11

Show more entries (press space)

Definition at line 1435 of file OcBootManagementLib.h.

◆ OC_INPUT_NO_ACTION

#define OC_INPUT_NO_ACTION   -2

Some other key.

Definition at line 1426 of file OcBootManagementLib.h.

◆ OC_INPUT_RIGHT

#define OC_INPUT_RIGHT   -8

Move right.

Definition at line 1432 of file OcBootManagementLib.h.

◆ OC_INPUT_STR

#define OC_INPUT_STR   "123456789ABCDEFGHIJKLMNOPQRSTUVXWZ"

Key index mappings. Non-negative values may also be returned to request a specific zero-indexed boot entry.

Definition at line 1423 of file OcBootManagementLib.h.

◆ OC_INPUT_SWITCH_FOCUS

#define OC_INPUT_SWITCH_FOCUS   -19

Switch UI focus (tab and shift+tab)

Definition at line 1443 of file OcBootManagementLib.h.

◆ OC_INPUT_TIMEOUT

#define OC_INPUT_TIMEOUT   -3

Timeout.

Definition at line 1427 of file OcBootManagementLib.h.

◆ OC_INPUT_TOP

#define OC_INPUT_TOP   -9

Move to top.

Definition at line 1433 of file OcBootManagementLib.h.

◆ OC_INPUT_TYPING_BACKSPACE

#define OC_INPUT_TYPING_BACKSPACE   -15

Clear last typed character while typing (press backspace)

Definition at line 1439 of file OcBootManagementLib.h.

◆ OC_INPUT_TYPING_CLEAR_ALL

#define OC_INPUT_TYPING_CLEAR_ALL   -14

Clear current input while typing (press esc)

Definition at line 1438 of file OcBootManagementLib.h.

◆ OC_INPUT_TYPING_CONFIRM

#define OC_INPUT_TYPING_CONFIRM   -18

Confirm input while typing (press enter)

Definition at line 1442 of file OcBootManagementLib.h.

◆ OC_INPUT_TYPING_LEFT

#define OC_INPUT_TYPING_LEFT   -16

Move left while typing (UI does not have to support)

Definition at line 1440 of file OcBootManagementLib.h.

◆ OC_INPUT_TYPING_RIGHT

#define OC_INPUT_TYPING_RIGHT   -17

Move right while typing (UI does not have to support)

Definition at line 1441 of file OcBootManagementLib.h.

◆ OC_INPUT_UP

#define OC_INPUT_UP   -5

Move up.

Definition at line 1429 of file OcBootManagementLib.h.

◆ OC_INPUT_VOICE_OVER

#define OC_INPUT_VOICE_OVER   -12

Toggle VoiceOver (press CMD+F5)

Definition at line 1436 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_ALL

#define OC_KERN_CAPABILITY_ALL   (OC_KERN_CAPABILITY_K32_U32 | OC_KERN_CAPABILITY_K32_K64_U64)

Definition at line 197 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_K32_K64_U64

#define OC_KERN_CAPABILITY_K32_K64_U64   (OC_KERN_CAPABILITY_K32_U64 | OC_KERN_CAPABILITY_K64_U64)

Definition at line 195 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_K32_U32

#define OC_KERN_CAPABILITY_K32_U32   BIT0

Supports K32 and U32 (10.4~10.6)

macOS Kernel capabilities. Written in pairs of kernel and user capabilities.

On IA32 firmware: 10.4-10.5 - K32_U32 | K32_U64. 10.6 - K32_U32 | K32_U64. 10.7+ - K32_U64.

On X64 firmware: 10.4-10.5 - K32_U32 | K32_U64. 10.6 - K32_U32 | K32_U64 | K64_U64. 10.7+ - K32_U64 | K64_U64.

Definition at line 191 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_K32_U32_U64

#define OC_KERN_CAPABILITY_K32_U32_U64   (OC_KERN_CAPABILITY_K32_U32 | OC_KERN_CAPABILITY_K32_U64)

Definition at line 196 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_K32_U64

#define OC_KERN_CAPABILITY_K32_U64   BIT1

Supports K32 and U64 (10.4~10.7)

Definition at line 192 of file OcBootManagementLib.h.

◆ OC_KERN_CAPABILITY_K64_U64

#define OC_KERN_CAPABILITY_K64_U64   BIT2

Supports K64 and U64 (10.6+)

Definition at line 193 of file OcBootManagementLib.h.

◆ OC_MAX_CONTENT_VISIBILITY_SIZE

#define OC_MAX_CONTENT_VISIBILITY_SIZE   512

Maximum allowed .contentVisibility file size.

Definition at line 43 of file OcBootManagementLib.h.

◆ OC_MAX_INSTANCE_IDENTIFIER_SIZE

#define OC_MAX_INSTANCE_IDENTIFIER_SIZE   64

Maximum safe instance identifier size.

Definition at line 38 of file OcBootManagementLib.h.

◆ OC_MENU_BOOT_MENU

#define OC_MENU_BOOT_MENU   L"OpenCore Boot Menu"

Default strings for use in the interfaces.

Definition at line 58 of file OcBootManagementLib.h.

◆ OC_MENU_CHOOSE_OS

#define OC_MENU_CHOOSE_OS   L"Choose the Operating System: "

Definition at line 63 of file OcBootManagementLib.h.

◆ OC_MENU_DISK_IMAGE

#define OC_MENU_DISK_IMAGE   L" (dmg)"

Definition at line 69 of file OcBootManagementLib.h.

◆ OC_MENU_EXTERNAL

#define OC_MENU_EXTERNAL   L" (external)"

Definition at line 68 of file OcBootManagementLib.h.

◆ OC_MENU_OK

#define OC_MENU_OK   L"OK"

Definition at line 67 of file OcBootManagementLib.h.

◆ OC_MENU_PASSWORD_PROCESSING

#define OC_MENU_PASSWORD_PROCESSING   L"Verifying password..."

Definition at line 61 of file OcBootManagementLib.h.

◆ OC_MENU_PASSWORD_REQUEST

#define OC_MENU_PASSWORD_REQUEST   L"Password: "

Definition at line 60 of file OcBootManagementLib.h.

◆ OC_MENU_PASSWORD_RETRY_LIMIT

#define OC_MENU_PASSWORD_RETRY_LIMIT   L"Password retry limit exceeded."

Definition at line 62 of file OcBootManagementLib.h.

◆ OC_MENU_RELOADING

#define OC_MENU_RELOADING   L"Reloading"

Definition at line 65 of file OcBootManagementLib.h.

◆ OC_MENU_RESTART

#define OC_MENU_RESTART   L"Restarting"

Definition at line 71 of file OcBootManagementLib.h.

◆ OC_MENU_SHOW_AUXILIARY

#define OC_MENU_SHOW_AUXILIARY   L"Show Auxiliary"

Definition at line 64 of file OcBootManagementLib.h.

◆ OC_MENU_SHUTDOWN

#define OC_MENU_SHUTDOWN   L"Shutting Down"

Definition at line 70 of file OcBootManagementLib.h.

◆ OC_MENU_TIMEOUT

#define OC_MENU_TIMEOUT   L"Timeout"

Definition at line 66 of file OcBootManagementLib.h.

◆ OC_MENU_UEFI_SHELL_ENTRY

#define OC_MENU_UEFI_SHELL_ENTRY   L"UEFI Shell"

Definition at line 59 of file OcBootManagementLib.h.

◆ OC_MODIFIERS_NONE

#define OC_MODIFIERS_NONE   0

Modifier mappings.

Definition at line 1449 of file OcBootManagementLib.h.

◆ OC_MODIFIERS_REVERSE_SWITCH_FOCUS

#define OC_MODIFIERS_REVERSE_SWITCH_FOCUS   BIT1

Definition at line 1451 of file OcBootManagementLib.h.

◆ OC_MODIFIERS_SET_DEFAULT

#define OC_MODIFIERS_SET_DEFAULT   BIT0

Definition at line 1450 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_FOR_PICKER

#define OC_PICKER_KEYS_FOR_PICKER    (OC_PICKER_KEYS_HOTKEYS | OC_PICKER_KEYS_VOICE_OVER | OC_PICKER_KEYS_TAB_CONTROL)

Definition at line 1461 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_FOR_TYPING

#define OC_PICKER_KEYS_FOR_TYPING    (OC_PICKER_KEYS_TYPING | OC_PICKER_KEYS_VOICE_OVER | OC_PICKER_KEYS_TAB_CONTROL)

Definition at line 1458 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_HOTKEYS

#define OC_PICKER_KEYS_HOTKEYS   BIT1

Definition at line 1454 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_TAB_CONTROL

#define OC_PICKER_KEYS_TAB_CONTROL   BIT3

Definition at line 1456 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_TYPING

#define OC_PICKER_KEYS_TYPING   BIT0

Definition at line 1453 of file OcBootManagementLib.h.

◆ OC_PICKER_KEYS_VOICE_OVER

#define OC_PICKER_KEYS_VOICE_OVER   BIT2

Definition at line 1455 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_ATAPI

#define OC_SCAN_ALLOW_DEVICE_ATAPI   BIT20

Allow scanning ATAPI devices.

Definition at line 273 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_FIREWIRE

#define OC_SCAN_ALLOW_DEVICE_FIREWIRE   BIT22

Allow scanning FireWire devices.

Definition at line 283 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_NVME

#define OC_SCAN_ALLOW_DEVICE_NVME   BIT19

Allow scanning NVMe devices.

Definition at line 268 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_PCI

#define OC_SCAN_ALLOW_DEVICE_PCI   BIT24

Allow scanning PCI devices (e.g. virtio).

Definition at line 293 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_SASEX

#define OC_SCAN_ALLOW_DEVICE_SASEX   BIT17

Allow scanning SAS and Mac NVMe devices.

Definition at line 258 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_SATA

#define OC_SCAN_ALLOW_DEVICE_SATA   BIT16

Allow scanning SATA devices.

Definition at line 253 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_SCSI

#define OC_SCAN_ALLOW_DEVICE_SCSI   BIT18

Allow scanning SCSI devices.

Definition at line 263 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_SDCARD

#define OC_SCAN_ALLOW_DEVICE_SDCARD   BIT23

Allow scanning SD card devices.

Definition at line 288 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_DEVICE_USB

#define OC_SCAN_ALLOW_DEVICE_USB   BIT21

Allow scanning USB devices.

Definition at line 278 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_APFS

#define OC_SCAN_ALLOW_FS_APFS   BIT8

Allow scanning APFS filesystems.

Definition at line 216 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_ESP

#define OC_SCAN_ALLOW_FS_ESP   BIT10

Allow scanning ESP filesystems.

Definition at line 226 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_HFS

#define OC_SCAN_ALLOW_FS_HFS   BIT9

Allow scanning HFS filesystems.

Definition at line 221 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_LINUX_DATA

#define OC_SCAN_ALLOW_FS_LINUX_DATA   BIT13

Allow scanning Linux Data filesystems. https://systemd.io/DISCOVERABLE_PARTITIONS/

Definition at line 243 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_LINUX_ROOT

#define OC_SCAN_ALLOW_FS_LINUX_ROOT   BIT12

Allow scanning Linux Root filesystems. https://systemd.io/DISCOVERABLE_PARTITIONS/

Definition at line 237 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_NTFS

#define OC_SCAN_ALLOW_FS_NTFS   BIT11

Allow scanning NTFS filesystems.

Definition at line 231 of file OcBootManagementLib.h.

◆ OC_SCAN_ALLOW_FS_XBOOTLDR

#define OC_SCAN_ALLOW_FS_XBOOTLDR   BIT14

Allow scanning XBOOTLDR filesystems.

Definition at line 248 of file OcBootManagementLib.h.

◆ OC_SCAN_DEFAULT_POLICY

#define OC_SCAN_DEFAULT_POLICY
Value:

By default allow booting from APFS from internal drives.

Definition at line 316 of file OcBootManagementLib.h.

◆ OC_SCAN_DEVICE_BITS

#define OC_SCAN_DEVICE_BITS

◆ OC_SCAN_DEVICE_LOCK

#define OC_SCAN_DEVICE_LOCK   BIT1

Perform filtering based on device basis. Ignores all devices by default. Remove this bit to allow any device type.

Definition at line 211 of file OcBootManagementLib.h.

◆ OC_SCAN_FILE_SYSTEM_BITS

#define OC_SCAN_FILE_SYSTEM_BITS
Value:

All file system bits used by OC_SCAN_FILE_SYSTEM_LOCK.

Definition at line 308 of file OcBootManagementLib.h.

◆ OC_SCAN_FILE_SYSTEM_LOCK

#define OC_SCAN_FILE_SYSTEM_LOCK   BIT0

Perform filtering based on file system basis. Ignores all filesystems by default. Remove this bit to allow any file system.

Definition at line 204 of file OcBootManagementLib.h.

◆ OC_TRACE_PARSE_VARS

#define OC_TRACE_PARSE_VARS   DEBUG_VERBOSE

Definition at line 32 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_IDLE_TIMEOUT_MS

#define OC_VOICE_OVER_IDLE_TIMEOUT_MS   700

Experimental, less is problematic.

Default timeout for IDLE timeout during menu picker navigation before VoiceOver toggle.

Definition at line 134 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNAL_ERROR_MS

#define OC_VOICE_OVER_SIGNAL_ERROR_MS   1000

Definition at line 145 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNAL_NORMAL_MS

#define OC_VOICE_OVER_SIGNAL_NORMAL_MS   200

From boot.efi, constant.

Default VoiceOver BeepGen protocol values.

Definition at line 139 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNALS_ERROR

#define OC_VOICE_OVER_SIGNALS_ERROR   1

Password verification error or boot failure.

Definition at line 147 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNALS_HWERROR

#define OC_VOICE_OVER_SIGNALS_HWERROR   3

Hardware error.

Definition at line 148 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNALS_NORMAL

#define OC_VOICE_OVER_SIGNALS_NORMAL   1

Username prompt or any input for boot.efi.

Definition at line 141 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNALS_PASSWORD

#define OC_VOICE_OVER_SIGNALS_PASSWORD   2

Password prompt for boot.efi.

Definition at line 142 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SIGNALS_PASSWORD_OK

#define OC_VOICE_OVER_SIGNALS_PASSWORD_OK   3

Password correct for boot.efi.

Definition at line 143 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SILENCE_ERROR_MS

#define OC_VOICE_OVER_SILENCE_ERROR_MS   150

Definition at line 146 of file OcBootManagementLib.h.

◆ OC_VOICE_OVER_SILENCE_NORMAL_MS

#define OC_VOICE_OVER_SILENCE_NORMAL_MS   150

From boot.efi, constant.

Definition at line 140 of file OcBootManagementLib.h.

◆ OPEN_CORE_AUDIO_PATH

#define OPEN_CORE_AUDIO_PATH   L"Resources\\Audio\\"

Definition at line 107 of file OcBootManagementLib.h.

◆ OPEN_CORE_FONT_PATH

#define OPEN_CORE_FONT_PATH   L"Resources\\Font\\"

Definition at line 108 of file OcBootManagementLib.h.

◆ OPEN_CORE_IMAGE_PATH

#define OPEN_CORE_IMAGE_PATH   L"Resources\\Image\\"

Paths allowed to be accessible by the interfaces.

Definition at line 105 of file OcBootManagementLib.h.

◆ OPEN_CORE_LABEL_PATH

#define OPEN_CORE_LABEL_PATH   L"Resources\\Label\\"

Definition at line 106 of file OcBootManagementLib.h.

Typedef Documentation

◆ OC_BOOT_ARGUMENTS

Unified structure to hold macOS kernel boot arguments to make the code independent of their format version. Several values need changing by other libraries, so values are often pointers to original fields.

◆ OC_BOOT_CONTEXT

Boot context containing boot filesystems.

◆ OC_BOOT_ENTRY

typedef struct OC_BOOT_ENTRY_ OC_BOOT_ENTRY

Forward declaration of OC_BOOT_ENTRY structure.

Definition at line 364 of file OcBootManagementLib.h.

◆ OC_BOOT_ENTRY_TYPE

typedef UINT32 OC_BOOT_ENTRY_TYPE

Operating system boot type. This flags the inferred type, but it is not definitive and should not be relied upon for security.

Definition at line 154 of file OcBootManagementLib.h.

◆ OC_BOOT_FILESYSTEM

Boot filesystem containing boot entries.

Definition at line 538 of file OcBootManagementLib.h.

◆ OC_BOOT_SYSTEM_ACTION

typedef EFI_STATUS(* OC_BOOT_SYSTEM_ACTION) (IN OUT OC_PICKER_CONTEXT *PickerContext)

Action to perform as part of executing a system boot entry.

Definition at line 336 of file OcBootManagementLib.h.

◆ OC_BOOT_UNMANAGED_ACTION

typedef EFI_STATUS(* OC_BOOT_UNMANAGED_ACTION) (IN OUT OC_PICKER_CONTEXT *PickerContext, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)

Action to perform as part of executing an unmanaged boot entry.

Definition at line 345 of file OcBootManagementLib.h.

◆ OC_BOOT_UNMANAGED_GET_FINAL_DP

typedef EFI_STATUS(* OC_BOOT_UNMANAGED_GET_FINAL_DP) (IN OUT OC_PICKER_CONTEXT *PickerContext, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)

Get Device Path for unmanaged boot entry.

Definition at line 355 of file OcBootManagementLib.h.

◆ OC_CUSTOM_FREE

typedef EFI_STATUS(EFIAPI * OC_CUSTOM_FREE) (IN VOID *CustomFreeContext)

Exposed custom entry interface to free any custom items after load.

Definition at line 389 of file OcBootManagementLib.h.

◆ OC_CUSTOM_READ

typedef EFI_STATUS(EFIAPI * OC_CUSTOM_READ) (IN OC_STORAGE_CONTEXT *Storage, IN OC_BOOT_ENTRY *ChosenEntry, OUT VOID **Data, OUT UINT32 *DataSize, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *StorageHandle, OUT EFI_DEVICE_PATH_PROTOCOL **StoragePath, IN OC_DMG_LOADING_SUPPORT DmgLoading, OUT OC_APPLE_DISK_IMAGE_PRELOAD_CONTEXT *DmgPreloadContext, OUT VOID **CustomFreeContext)

Exposed custom entry load interface. Returns allocated file buffer from pool on success.

Definition at line 371 of file OcBootManagementLib.h.

◆ OC_FLUSH_TYPING_BUFFER

typedef VOID(EFIAPI * OC_FLUSH_TYPING_BUFFER) (IN OUT OC_PICKER_CONTEXT *Context)

Flush picker typing buffer.

Definition at line 817 of file OcBootManagementLib.h.

◆ OC_GET_ENTRY_ICON

typedef EFI_STATUS(EFIAPI * OC_GET_ENTRY_ICON) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, OUT VOID **ImageData, OUT UINT32 *DataLength)

Get icon contents (e.g. '.VolumeIcon.icns').

Definition at line 773 of file OcBootManagementLib.h.

◆ OC_GET_ENTRY_LABEL_IMAGE

typedef EFI_STATUS(EFIAPI * OC_GET_ENTRY_LABEL_IMAGE) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN UINT8 Scale, OUT VOID **ImageData, OUT UINT32 *DataLength)

Get label contents (e.g. '.disk_label' or '.disk_label_2x').

Definition at line 760 of file OcBootManagementLib.h.

◆ OC_GET_KEY_INFO

typedef VOID(EFIAPI * OC_GET_KEY_INFO) (IN OUT OC_PICKER_CONTEXT *Context, IN OC_PICKER_KEY_MAP KeyFilter, OUT OC_PICKER_KEY_INFO *PickerKeyInfo)

Get picker pressed key info.

Definition at line 785 of file OcBootManagementLib.h.

◆ OC_GET_KEY_WAIT_END_TIME

typedef UINT64(EFIAPI * OC_GET_KEY_WAIT_END_TIME) (IN UINT64 Timeout)

Request end time in units appropriate for OC_WAIT_FOR_KEY_INFO.

Definition at line 796 of file OcBootManagementLib.h.

◆ OC_HOTKEY_CONTEXT

Picker keyboard handling context.

Definition at line 53 of file OcBootManagementLib.h.

◆ OC_IMAGE_LOADER_CONFIGURE

typedef VOID(* OC_IMAGE_LOADER_CONFIGURE) (IN OUT EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN UINT32 Capabilities)

Image loader callback triggered before StartImage.

Definition at line 1889 of file OcBootManagementLib.h.

◆ OC_IMAGE_LOADER_PATCH

typedef VOID(* OC_IMAGE_LOADER_PATCH) (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN VOID *SourceBuffer, IN UINTN SourceSize)

Image loader callback triggered before LoadImage.

Definition at line 1878 of file OcBootManagementLib.h.

◆ OC_IMAGE_START

typedef EFI_STATUS(EFIAPI * OC_IMAGE_START) (IN OC_BOOT_ENTRY *ChosenEntry, IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL, IN BOOLEAN LaunchInText)

Exposed start interface with chosen boot entry but otherwise equivalent to EFI_BOOT_SERVICES StartImage.

Definition at line 605 of file OcBootManagementLib.h.

◆ OC_KB_DEBUG_INSTRUMENT_LOOP_DELAY

typedef VOID(EFIAPI * OC_KB_DEBUG_INSTRUMENT_LOOP_DELAY) (UINT64 LoopDelayStart, UINT64 LoopDelayEnd)

Instrument kb loop delay.

Parameters
[in]LoopDelayStartDelay start in TSC asm ticks.
[in]LoopDelayEndDelay end in TSC asm ticks.

Definition at line 885 of file OcBootManagementLib.h.

◆ OC_KB_DEBUG_SHOW

typedef VOID(EFIAPI * OC_KB_DEBUG_SHOW) (UINTN NumKeysDown, UINTN NumKeysHeld, APPLE_MODIFIER_MAP Modifiers)

Running display of held keys.

Parameters
[in]NumKeysDownNumber of keys that went down.
[in]NumKeysHeldNumber of keys held.
[in]ModifiersKey modifiers.

Definition at line 899 of file OcBootManagementLib.h.

◆ OC_KEY_CODE

typedef INTN OC_KEY_CODE

OC picker codes.

Definition at line 712 of file OcBootManagementLib.h.

◆ OC_MODIFIER_MAP

typedef UINT16 OC_MODIFIER_MAP

OC picker modifiers.

Definition at line 717 of file OcBootManagementLib.h.

◆ OC_PARSED_VAR

◆ OC_PARSED_VAR_ASCII

Parsed load option or shell variable.

◆ OC_PARSED_VAR_UNICODE

◆ OC_PICKER_CONTEXT

Primary picker context.

Definition at line 48 of file OcBootManagementLib.h.

◆ OC_PICKER_KEY_MAP

typedef UINTN OC_PICKER_KEY_MAP

OC picker modifiers.

Definition at line 722 of file OcBootManagementLib.h.

◆ OC_PICKER_MODE

Picker mode.

◆ OC_PLAY_AUDIO_BEEP

typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_BEEP) (IN OC_PICKER_CONTEXT *Context, IN UINT32 ToneCount, IN UINT32 ToneLength, IN UINT32 SilenceLength)

Generate cycles of beep signals for context with silence afterwards, blocking.

Definition at line 838 of file OcBootManagementLib.h.

◆ OC_PLAY_AUDIO_ENTRY

typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_ENTRY) (IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *Entry)

Play audio entry for context.

Definition at line 850 of file OcBootManagementLib.h.

◆ OC_PLAY_AUDIO_FILE

typedef EFI_STATUS(EFIAPI * OC_PLAY_AUDIO_FILE) (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath, IN CONST CHAR8 *BaseType, IN BOOLEAN Fallback)

Play audio file for context.

Definition at line 826 of file OcBootManagementLib.h.

◆ OC_REQ_PRIVILEGE

typedef EFI_STATUS(EFIAPI * OC_REQ_PRIVILEGE) (IN OC_PICKER_CONTEXT *Context, IN OC_PRIVILEGE_LEVEL Level)

Request a privilege escalation, for example by prompting for a password.

Definition at line 739 of file OcBootManagementLib.h.

◆ OC_SHOW_MENU

typedef EFI_STATUS(EFIAPI * OC_SHOW_MENU) (IN OC_BOOT_CONTEXT *BootContext, IN OC_BOOT_ENTRY **BootEntries, OUT OC_BOOT_ENTRY **ChosenBootEntry)

Display entries onscreen.

Definition at line 749 of file OcBootManagementLib.h.

◆ OC_TOGGLE_VOICE_OVER

typedef VOID(EFIAPI * OC_TOGGLE_VOICE_OVER) (IN OC_PICKER_CONTEXT *Context, IN CONST CHAR8 *BasePath OPTIONAL, IN CONST CHAR8 *BaseType OPTIONAL)

Toggle VoiceOver support.

Definition at line 860 of file OcBootManagementLib.h.

◆ OC_VERIFY_PASSWORD

typedef BOOLEAN(EFIAPI * OC_VERIFY_PASSWORD) (IN CONST UINT8 *Password, IN UINT32 PasswordSize, IN CONST OC_PRIVILEGE_CONTEXT *PrivilegeContext)

Password verification.

Definition at line 922 of file OcBootManagementLib.h.

◆ OC_WAIT_FOR_KEY_INFO

typedef BOOLEAN(EFIAPI * OC_WAIT_FOR_KEY_INFO) (IN OUT OC_PICKER_CONTEXT *Context, IN UINT64 EndTime, IN OC_PICKER_KEY_MAP KeyFilter, IN OUT OC_PICKER_KEY_INFO *PickerKeyInfo)

Wait for picker pressed key info. Use zero EndTime for no timeout.

Definition at line 805 of file OcBootManagementLib.h.

Enumeration Type Documentation

◆ OC_DMG_LOADING_SUPPORT

OcLoadBootEntry DMG loading policy rules.

Enumerator
OcDmgLoadingDisabled 
OcDmgLoadingAnyImage 
OcDmgLoadingAppleSigned 

Definition at line 326 of file OcBootManagementLib.h.

◆ OC_PICKER_CMD

Picker behaviour action.

Enumerator
OcPickerDefault 
OcPickerShowPicker 
OcPickerProtocolHotKey 
OcPickerBootApple 
OcPickerBootAppleRecovery 

Definition at line 870 of file OcBootManagementLib.h.

◆ OC_PICKER_MODE_

Picker mode.

Enumerator
OcPickerModeBuiltin 
OcPickerModeExternal 
OcPickerModeApple 

Definition at line 171 of file OcBootManagementLib.h.

◆ OC_PRIVILEGE_LEVEL

Privilege levels to escalate to

Enumerator
OcPrivilegeUnauthorized 
OcPrivilegeAuthorized 

Definition at line 704 of file OcBootManagementLib.h.

Function Documentation

◆ OcActivateHibernateWake()

EFI_STATUS OcActivateHibernateWake ( IN UINT32 HibernateMask)

Handle hibernation detection for later loading.

Parameters
[in]HibernateMaskHibernate detection mask.
Return values
EFI_SUCCESSHibernation mode was found and activated.

Definition at line 31 of file AppleHibernate.c.

◆ OcAddEntriesFromBootEntryProtocol()

EFI_STATUS OcAddEntriesFromBootEntryProtocol ( IN OUT OC_BOOT_CONTEXT * BootContext,
IN OUT OC_BOOT_FILESYSTEM * FileSystem,
IN EFI_HANDLE * EntryProtocolHandles,
IN UINTN EntryProtocolHandleCount,
IN CONST VOID * DefaultEntryId,
OPTIONAL IN BOOLEAN CreateDefault,
IN BOOLEAN CreateForHotKey )

Request bootable entries from installed boot entry protocol drivers.

Parameters
[in,out]BootContextContext of filesystems.
[in,out]FileSystemFilesystem to scan for entries.
[in]EntryProtocolHandlesBoot entry protocol handles, or NULL if none.
[in]EntryProtocolHandleCountCount of boot entry protocol handles.
[in]DefaultEntryIdId of saved default entry on this file system.
[in]CreateDefaultCreate default entry if TRUE, create all others otherwise.
[in]CreateForHotKeyIf TRUE default entry is being created for protocol hotkey, otherwise for NVRAM boot entry.
Return values
EFI_SUCCESSAt least one entry was created.

Definition at line 239 of file BootEntryProtocol.c.

◆ OcAppendArgumentsToLoadedImage()

BOOLEAN OcAppendArgumentsToLoadedImage ( IN OUT EFI_LOADED_IMAGE_PROTOCOL * LoadedImage,
IN CONST CHAR8 ** Arguments,
IN UINT32 ArgumentCount,
IN BOOLEAN Replace )

Append 1 or more arguments to Loaded Image protocol.

Parameters
[in,out]LoadedImageLoaded Image protocol instance.
[in]ArgumentsArgument array.
[in]ArgumentCountNumber of arguments in the array.
[in]ReplaceWhether to append to existing arguments or replace.
Return values
TRUEon success.

Definition at line 224 of file BootArguments.c.

◆ OcAppendArgumentToCmd()

BOOLEAN OcAppendArgumentToCmd ( IN OUT OC_PICKER_CONTEXT *Context OPTIONAL,
IN OUT CHAR8 * CommandLine,
IN CONST CHAR8 * Argument,
IN CONST UINTN ArgumentLength )

Append argument to command line without deduplication.

Parameters
[in,out]ContextPicker context. NULL, if a privilege escalation is not required.
[in,out]CommandLineArgument command line of BOOT_LINE_LENGTH bytes.
[in]ArgumentArgument, e.g. -v, slide=0, debug=0x100, etc.
[in]ArgumentLengthArgument length, e.g. L_STR_LEN ("-v").
Return values
TRUEon success.

Definition at line 184 of file BootArguments.c.

◆ OcCheckArgumentFromEnv()

BOOLEAN OcCheckArgumentFromEnv ( IN EFI_LOADED_IMAGE *LoadedImage OPTIONAL,
IN EFI_GET_VARIABLE GetVariable OPTIONAL,
IN CONST CHAR8 * Argument,
IN CONST UINTN ArgumentLength,
IN OUT CHAR8 **Value OPTIONAL )

Check if boot argument is currently passed (via image options or NVRAM).

Parameters
[in]LoadedImageUEFI loaded image protocol instance, optional.
[in]GetVariablePreferred UEFI NVRAM reader, optional.
[in]ArgumentArgument, e.g. -v, slide=, debug=, etc.
[in]ArgumentLengthArgument length, e.g. L_STR_LEN ("-v").
[in,out]ValueArgument value allocated from pool.
Return values
TRUEif argument is present.

Definition at line 298 of file BootArguments.c.

◆ OcEnumerateEntries()

OC_BOOT_ENTRY ** OcEnumerateEntries ( IN OC_BOOT_CONTEXT * BootContext)

Perform boot entry enumeration.

Parameters
[in]BootContextBoot context.
Return values
enumeratedboot entry list allocated from pool.

Definition at line 2506 of file BootEntryManagement.c.

◆ OcFreeBootContext()

VOID OcFreeBootContext ( IN OUT OC_BOOT_CONTEXT * Context)

Free boot context.

Parameters
[in,out]ContextBoot context to free.

Definition at line 2000 of file BootEntryManagement.c.

◆ OcFreeBootEntryProtocolHandles()

VOID OcFreeBootEntryProtocolHandles ( EFI_HANDLE ** EntryProtocolHandles)

Free boot entry protocol handles.

Parameters
[in,out]EntryProtocolHandlesBoot entry protocol handles, or NULL if none.

Definition at line 57 of file BootEntryProtocol.c.

◆ OcFreeHotKeys()

VOID OcFreeHotKeys ( IN OC_PICKER_CONTEXT * Context)

Free picker keyboard handling resources.

Parameters
[in]ContextPicker context.

Definition at line 812 of file HotKeySupport.c.

◆ OcGetAppleBootLoadedImage()

EFI_LOADED_IMAGE_PROTOCOL * OcGetAppleBootLoadedImage ( IN EFI_HANDLE ImageHandle)

Get loaded image protocol for Apple bootloader.

Parameters
[in]ImageHandleImage handle.
Return values
loadedimage protocol or NULL for non Apple images.

Definition at line 441 of file PolicyManagement.c.

◆ OcGetArgumentFromCmd()

CONST CHAR8 * OcGetArgumentFromCmd ( IN CONST CHAR8 * CommandLine,
IN CONST CHAR8 * Argument,
IN CONST UINTN ArgumentLength,
OUT UINTN *ValueLength OPTIONAL )

Get argument value from command line.

Parameters
[in]CommandLineArgument command line, e.g. for boot.efi.
[in]ArgumentArgument, e.g. -v, slide=, debug=, etc.
[in]ArgumentLengthArgument length, e.g. L_STR_LEN ("-v").
[out]ValueLengthArgument value length, optional.
Return values
pointerto argument value or NULL.

Definition at line 97 of file BootArguments.c.

◆ OcGetBootDevicePathType()

OC_BOOT_ENTRY_TYPE OcGetBootDevicePathType ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT BOOLEAN *IsFolder OPTIONAL,
OUT BOOLEAN *IsGeneric OPTIONAL )

Check if supplied device path contains known names (e.g. Apple bootloader).

Parameters
[in]DevicePathDevice path.
[out]IsFolderDevice path represents directory, optional.
[out]IsGenericDevice path represents generic booter, optional.
Return values
entrytype for potentially known bootloaders.
OC_BOOT_UNKNOWNfor unknown bootloaders.

Definition at line 330 of file PolicyManagement.c.

◆ OcGetBootEntryFile()

EFI_STATUS EFIAPI OcGetBootEntryFile ( IN OC_BOOT_ENTRY * BootEntry,
IN CONST CHAR16 * FileName,
IN CONST CHAR8 * DebugFileType,
IN UINT32 MaxFileSize,
IN UINT32 MinFileSize,
OUT VOID ** FileData,
OUT UINT32 *DataLength OPTIONAL,
IN BOOLEAN SearchAtLeaf,
IN BOOLEAN SearchAtRoot )

Read boot entry meta-data file. Validates that boot entry is external tool or OS type.

Parameters
[in]BootEntryBoot entry.
[in]FileNameFile name to search for.
[in]DebugFileTypeBrief description of file for use in debug messages.
[in]MaxFileSizeMaximum allowed file size (inclusive).
[in]MinFileSizeMinimum allowed file size (inclusive).
[out]FileDataReturned file data.
[out]DataLengthReturned data length.
[in]SearchAtLeafSearch next to boot file (or in boot folder) first.
[in]SearchAtRootAfter SearchAtLeaf (if specified), search at OC-specific GUID sub-folder location (if present), then at FS root.
Return values
EFI_SUCCESSBoot entry was correct type, file was located, validated against allowed length, and returned.
otherBoot entry was incorrect type, or file could not be located, or had invalid length.

Definition at line 593 of file BootEntryInfo.c.

◆ OcGetBootEntryFileFromDevicePath()

EFI_STATUS EFIAPI OcGetBootEntryFileFromDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
IN CONST CHAR16 * FileName,
IN CONST CHAR8 * DebugFileType,
IN UINT32 MaxFileSize,
IN UINT32 MinFileSize,
OUT VOID ** FileData,
OUT UINT32 *DataLength OPTIONAL,
IN BOOLEAN SearchAtLeaf,
IN BOOLEAN SearchAtRoot )

Read boot entry meta-data file from boot entry device path. May be used before before OC_BOOT_ENTRY struct is created.

Parameters
[in]DevicePathBoot entry device path.
[in]FileNameFile name to search for.
[in]DebugFileTypeBrief description of file for use in debug messages.
[in]MaxFileSizeMaximum allowed file size (inclusive).
[in]MinFileSizeMinimum allowed file size (inclusive).
[out]FileDataReturned file data.
[out]DataLengthReturned data length.
[in]SearchAtLeafSearch next to boot file (or in boot folder) first.
[in]SearchAtRootAfter SearchAtLeaf (if specified), search at OC-specific GUID sub-folder location (if present), then at FS root.
Return values
EFI_SUCCESSFile was located, validated against allowed length, and returned.
otherFile could not be located, or had invalid length.

Definition at line 565 of file BootEntryInfo.c.

◆ OcGetBootEntryIcon()

EFI_STATUS EFIAPI OcGetBootEntryIcon ( IN OC_PICKER_CONTEXT * Context,
IN OC_BOOT_ENTRY * BootEntry,
OUT VOID ** ImageData,
OUT UINT32 * DataLength )

Get '.VolumeIcon.icns' file contents, if exists.

Parameters
[in]BootEntryLocated boot entry.
[out]ImageDataFile contents.
[out]DataLengthFile length.
Return values
EFI_SUCCESSThe file was read successfully.

Definition at line 420 of file BootEntryInfo.c.

◆ OcGetBootEntryLabelImage()

EFI_STATUS EFIAPI OcGetBootEntryLabelImage ( IN OC_PICKER_CONTEXT * Context,
IN OC_BOOT_ENTRY * BootEntry,
IN UINT8 Scale,
OUT VOID ** ImageData,
OUT UINT32 * DataLength )

Get '.disk_label' or '.disk_label_2x' file contents, if exists.

Parameters
[in]BootEntryLocated boot entry.
[in]ScaleUser interface scale.
[out]ImageDataFile contents.
[out]DataLengthFile length.
Return values
EFI_SUCCESSThe file was read successfully.

Definition at line 396 of file BootEntryInfo.c.

◆ OcGetBootOrder()

UINT16 * OcGetBootOrder ( IN EFI_GUID * BootVariableGuid,
IN BOOLEAN WithBootNext,
OUT UINTN * BootOrderCount,
OUT BOOLEAN *Deduplicated OPTIONAL,
OUT BOOLEAN *HasBootNext OPTIONAL,
IN BOOLEAN UseBootNextOnly )

Obtain BootOrder entry list.

Parameters
[in]BootVariableGuidGUID namespace for boot entries.
[in]WithBootNextAdd BootNext as the first option if available.
[out]BootOrderCountNumber of entries in boot order.
[out]DeduplicatedWhether the list was changed during deduplication, optional.
[out]HasBootNextWhether the list starts with BootNext, optional
[in]UseBootNextOnlyReturn list containing BootNext entry only
Return values
bootorder entry list allocated from pool or NULL.

Definition at line 578 of file DefaultEntryChoice.c.

◆ OcGetDefaultBootEntry()

UINT32 OcGetDefaultBootEntry ( IN OC_PICKER_CONTEXT * Context,
IN OUT OC_BOOT_ENTRY * BootEntries,
IN UINTN NumBootEntries )

Obtain default entry from picker context.

Parameters
[in]ContextPicker context.
[in,out]BootEntriesDescribed list of entries, may get updated.
[in]NumBootEntriesPositive number of boot entries.
Return values
bootentry or 0.

◆ OcGetDevicePolicyType()

UINT32 OcGetDevicePolicyType ( IN EFI_HANDLE Handle,
OUT BOOLEAN *External OPTIONAL )

Get device scan policy type.

Parameters
[in]HandleDevice/partition handle.
[out]ExternalCheck whether device is external.
Return values
requiredpolicy or 0 on mismatch.

Definition at line 45 of file PolicyManagement.c.

◆ OcGetFileSystemPolicyType()

UINT32 OcGetFileSystemPolicyType ( IN EFI_HANDLE Handle)

Get file system scan policy type.

Parameters
[in]HandlePartition handle.
Return values
requiredpolicy or 0 on mismatch.

Definition at line 247 of file PolicyManagement.c.

◆ OcHandleRecoveryRequest()

EFI_STATUS OcHandleRecoveryRequest ( OUT EFI_DEVICE_PATH_PROTOCOL **Initiator OPTIONAL)

Handle recovery detection for later loading. Recovery handling is required to choose the right operating system.

Parameters
[out]InitiatorRecovery initiator device path, optional.
Return values
EFI_SUCCESSRecovery boot is required.
EFI_NOT_FOUNDSystem should boot normally.

Definition at line 73 of file AppleRecovery.c.

◆ OcHasLoadOptions()

BOOLEAN EFIAPI OcHasLoadOptions ( IN UINT32 LoadOptionsSize,
IN CONST VOID * LoadOptions )

Are load options present as a Unicode string?

Parameters
[in]LoadOptionsSizeLoad options size.
[in]LoadOptionsLoad options.
Return values
TRUEif valid.

Definition at line 402 of file BootArguments.c.

◆ OcHasParsedVar()

BOOLEAN OcHasParsedVar ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST VOID * Name,
IN CONST OC_STRING_FORMAT StringFormat )

Get presence or absence of parsed shell var or load option.

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]StringFormatAre option names and values Unicode or ASCII?
Return values
TRUEOption exists (with or without a value).
FALSEOption not found.

Definition at line 737 of file BootArguments.c.

◆ OcImageLoaderActivate()

VOID OcImageLoaderActivate ( VOID )

Make DirectImageLoader the default for Apple Secure Boot.

Definition at line 1242 of file ImageLoader.c.

◆ OcImageLoaderInit()

VOID OcImageLoaderInit ( IN CONST BOOLEAN ProtectUefiServices,
IN CONST BOOLEAN FixupAppleEfiImages )

Initialises custom Boot Services overrides to support direct images.

Definition at line 1219 of file ImageLoader.c.

◆ OcImageLoaderLoad()

EFI_STATUS EFIAPI OcImageLoaderLoad ( IN BOOLEAN BootPolicy,
IN EFI_HANDLE ParentImageHandle,
IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
IN VOID *SourceBuffer OPTIONAL,
IN UINTN SourceSize,
OUT EFI_HANDLE * ImageHandle )

Simplified load image routine, which bypasses UEFI and loads the image directly.

Parameters
[in]BootPolicyIgnored.
[in]ParentImageHandleThe caller's image handle.
[in]DevicePathIgnored.
[in]SourceBufferPointer to the memory location containing image to be loaded.
[in]SourceSizeThe size in bytes of SourceBuffer.
[out]ImageHandleThe pointer to the returned image handle created on success.
Return values
EFI_SUCCESSon success.

Definition at line 262 of file ImageLoader.c.

◆ OcImageLoaderRegisterConfigure()

VOID OcImageLoaderRegisterConfigure ( IN OC_IMAGE_LOADER_CONFIGURE Configure OPTIONAL)

Register image start callback.

Parameters
[in]ConfigureCallback function to call on image start.

Definition at line 1258 of file ImageLoader.c.

◆ OcImageLoaderRegisterPatch()

VOID OcImageLoaderRegisterPatch ( IN OC_IMAGE_LOADER_PATCH Patch OPTIONAL)

Register image loading callback.

Parameters
[in]PatchCallback function to call on image load.

Definition at line 1250 of file ImageLoader.c.

◆ OcInitHotKeys()

EFI_STATUS OcInitHotKeys ( IN OUT OC_PICKER_CONTEXT * Context)

Initialise picker keyboard handling. Initialises necessary handlers and updates booter context based on this. Call before looped calls to OcWaitForPickerKeyInfo or OcGetPickerKeyInfo.

Parameters
[in,out]ContextPicker context.
Return values
EFI_SUCCESSThe keyboard handling within the context has been initialised.
EFI_NOT_FOUNDCould not find a required protocol.
otherAn error returned by a sub-operation.

Definition at line 733 of file HotKeySupport.c.

◆ OcIsAppleHibernateWake()

BOOLEAN OcIsAppleHibernateWake ( VOID )

Check if active hibernation is happening.

Return values
TRUEon waking from hibernation.

Definition at line 232 of file AppleHibernate.c.

◆ OcLaunchAppleBootPicker()

EFI_STATUS OcLaunchAppleBootPicker ( VOID )

Launch Apple boot picker firmware application.

Return values
EFI_SUCCESSPicker was successfully executed, implies boot selection was returned in BootNext.
otherPicker could not be launched, or error within picker application.

Definition at line 763 of file OcBootManagementLib.c.

◆ OcLoadBootEntry()

EFI_STATUS OcLoadBootEntry ( IN OC_PICKER_CONTEXT * Context,
IN OC_BOOT_ENTRY * BootEntry,
IN EFI_HANDLE ParentHandle )

Load & start boot entry loader image with given options.

Parameters
[in]ContextPicker context.
[in]BootEntryLocated boot entry.
[in]ParentHandleParent image handle.
Return values
EFI_SUCCESSThe image was found, started, and ended succesfully.

Definition at line 2549 of file BootEntryManagement.c.

◆ OcLoadPickerHotKeys()

VOID OcLoadPickerHotKeys ( IN OUT OC_PICKER_CONTEXT * Context)

Check pressed hotkeys and update booter context based on this.

Parameters
[in,out]ContextPicker context.

Definition at line 109 of file HotKeySupport.c.

◆ OcLocateBootEntryProtocolHandles()

VOID OcLocateBootEntryProtocolHandles ( IN OUT EFI_HANDLE ** EntryProtocolHandles,
IN OUT UINTN * EntryProtocolHandleCount )

Locate boot entry protocol handles.

Parameters
[in,out]EntryProtocolHandlesBoot entry protocol handles, or NULL if none.
[in,out]EntryProtocolHandleCountCount of boot entry protocol handles.

Definition at line 28 of file BootEntryProtocol.c.

◆ OcParseBootArgs()

VOID OcParseBootArgs ( OUT OC_BOOT_ARGUMENTS * Arguments,
IN VOID * BootArgs )

Parse macOS kernel into unified boot arguments structure.

Parameters
[out]ArgumentsUnified boot arguments structure.
[in]BootArgsKernel boot arguments strucutre.

Definition at line 43 of file BootArguments.c.

◆ OcParsedVarsGetAsciiStr()

BOOLEAN OcParsedVarsGetAsciiStr ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST CHAR8 * Name,
OUT CHAR8 ** StrValue )

Get ASCII string value of parsed var or load option. Return value points directly into original raw option memory, so may need to be copied if it is to be retained, and must not be freed directly.

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]StrValueOption value if successful, not modified otherwise; note that NULL is returned if option exists with no value. Caller must not attempt to free this memory.
Return values
TRUEOption exists.
FALSEOption not found.

Definition at line 727 of file BootArguments.c.

◆ OcParsedVarsGetGuid()

EFI_STATUS OcParsedVarsGetGuid ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST VOID * Name,
OUT EFI_GUID * Value,
IN CONST OC_STRING_FORMAT StringFormat )

Get guid value of parsed shell var or load option.

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]ValueOption value if successful, not modified otherwise.
[in]StringFormatAre option names and values Unicode or ASCII?
Return values
EFI_SUCCESSSuccess.
EFI_NOT_FOUNDOption not found, or has no value.
otherError encountered when parsing option as guid.

Definition at line 785 of file BootArguments.c.

◆ OcParsedVarsGetInt()

EFI_STATUS OcParsedVarsGetInt ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST VOID * Name,
OUT UINTN * Value,
IN CONST OC_STRING_FORMAT StringFormat )

Get integer value of parsed shell var or load option (parses hex and decimal representations).

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]ValueOption value if successful, not modified otherwise.
[in]StringFormatAre option names and values Unicode or ASCII?
Return values
EFI_SUCCESSSuccess.
EFI_NOT_FOUNDOption not found, or has no value.
otherError encountered when parsing option as int.

Definition at line 749 of file BootArguments.c.

◆ OcParsedVarsGetStr()

BOOLEAN OcParsedVarsGetStr ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST VOID * Name,
OUT VOID ** StrValue,
IN CONST OC_STRING_FORMAT StringFormat )

Get string value of parsed var or load option. Returned value is in same format as raw options. Return value points directly into original raw option memory, so may need to be copied if it is to be retained, and must not be freed directly.

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]StrValueOption value if successful, not modified otherwise; note that NULL is returned if option exists with no value. Caller must not attempt to free this memory.
[in]StringFormatAre option names and values Unicode or ASCII?
Return values
TRUEOption exists.
FALSEOption not found.

Definition at line 669 of file BootArguments.c.

◆ OcParsedVarsGetUnicodeStr()

BOOLEAN OcParsedVarsGetUnicodeStr ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST CHAR16 * Name,
OUT CHAR16 ** StrValue )

Get string value of parsed var or load option. Return value points directly into original raw option memory, so may need to be copied if it is to be retained, and must not be freed directly.

Parameters
[in]ParsedVarsParsed variables.
[in]NameOption name.
[in]StrValueOption value if successful, not modified otherwise; note that NULL is returned if option exists with no value. Caller must not attempt to free this memory.
Return values
TRUEOption exists.
FALSEOption not found.

Definition at line 717 of file BootArguments.c.

◆ OcParsedVarsItemAt()

OC_PARSED_VAR * OcParsedVarsItemAt ( IN CONST OC_FLEX_ARRAY * ParsedVars,
IN CONST UINTN Index )

Return parsed variable at given index.

Parameters
[in]ParsedVarsParsed variables.
[in]IndexIndex of option to return.
Return values
Parsedoption.

Definition at line 657 of file BootArguments.c.

◆ OcParseLoadOptions()

EFI_STATUS OcParseLoadOptions ( IN CONST EFI_LOADED_IMAGE_PROTOCOL * LoadedImage,
OUT OC_FLEX_ARRAY ** ParsedVars )

Parse loaded image protocol load options, resultant options are in the same format as is returned by OcParsedVars and may be examined using the same utility methods.

Assumes CHAR_NULL terminated Unicode string of space separated options, each of form {name} or {name}={value}. Double quotes can be used round {value} to include spaces, and '\' can be used within quoted or unquoted values to escape any character (including space and '"').

Note: Var names and values are left as pointers to within the original raw LoadOptions string, which may be modified during processing.

Parameters
[in]LoadedImageLoaded image handle.
[out]ParsedVarsParsed load options if successful, NULL otherwise. Caller may free after use with OcFlexArrayFree if required.
Return values
EFI_SUCCESSSuccess.
EFI_NOT_FOUNDMissing or empty load options.
EFI_OUT_OF_RESOURCESOut of memory.
EFI_INVALID_PARAMETERInvalid load options detected.

Definition at line 416 of file BootArguments.c.

◆ OcParseVars()

EFI_STATUS OcParseVars ( IN VOID * StrVars,
OUT OC_FLEX_ARRAY ** ParsedVars,
IN CONST OC_STRING_FORMAT StringFormat,
IN CONST BOOLEAN TokensOnly )

Parse Unix-style var file or string. Parses a couple of useful ASCII GRUB config files (multi-line, name=var, with optional comments) and defines a standard format for Unicode UEFI LoadOptions.

Assumes CHAR_NULL terminated Unicode string of space separated options, each of form {name} or {name}={value}. Double quotes can be used round {value} to include spaces, and backslash can be used within quoted or unquoted values to escape any character (including space and double quote). Comments (if any) run from hash symbol to end of same line.

Note: Var names and values are left as pointers to within the raw string, which may be modified during processing.

Parameters
[in]StrVarsRaw var string.
[out]ParsedVarsParsed variables if successful, NULL otherwise. Caller may free after use with OcFlexArrayFree.
[in]StringFormatAre option names and values Unicode or ASCII?
[in]TokensOnlyIf TRUE parse as a sequence of token values only, rather than as a sequence of name[=[value]] pairs.
Return values
EFI_SUCCESSSuccess.
EFI_NOT_FOUNDMissing or empty load options.
EFI_OUT_OF_RESOURCESOut of memory.
EFI_INVALID_PARAMETERInvalid load options detected.

Definition at line 449 of file BootArguments.c.

◆ OcPlayAudioBeep()

EFI_STATUS EFIAPI OcPlayAudioBeep ( IN OC_PICKER_CONTEXT * Context,
IN UINT32 ToneCount,
IN UINT32 ToneLength,
IN UINT32 SilenceLength )

Generate cycles of beep signals for context with silence afterwards, blocking.

Parameters
[in]ContextPicker context.
[in]ToneCountNumber of signals to produce.
[in]ToneLengthSignal length in milliseconds.
[in]SilenceLengthSilence length in milliseconds.
Return values
EFI_SUCCESSon success or when unnecessary.

Definition at line 155 of file BootAudio.c.

◆ OcPlayAudioEntry()

EFI_STATUS EFIAPI OcPlayAudioEntry ( IN OC_PICKER_CONTEXT * Context,
IN OC_BOOT_ENTRY * Entry )

Play audio entry for context.

Parameters
[in]ContextPicker context.
[in]EntryEntry to play.
Return values
EFI_SUCCESSon success or when unnecessary.

Definition at line 188 of file BootAudio.c.

◆ OcPlayAudioFile()

EFI_STATUS EFIAPI OcPlayAudioFile ( IN OC_PICKER_CONTEXT * Context,
IN CONST CHAR8 * BasePath,
IN CONST CHAR8 * BaseType,
IN BOOLEAN Fallback )

Play audio file for context.

Parameters
[in]ContextPicker context.
[in]BasePathFile base path.
[in]BaseTypeAudio base type.
[in]FallbackTry to fallback to beeps on failure.
Return values
EFI_SUCCESSon success or when unnecessary.

Definition at line 77 of file BootAudio.c.

◆ OcPreLocateAudioProtocol()

EFI_STATUS EFIAPI OcPreLocateAudioProtocol ( IN OC_PICKER_CONTEXT * Context)

Pre-locate audio protocol for picker context, so that boot entry protocol methods can treat this as the definitive audio protocol instance.

Parameters
[in]ContextPicker context.
Return values
EFI_SUCCESSon success or when unnecessary.

Definition at line 53 of file BootAudio.c.

◆ OcReadApplePanicLog()

VOID * OcReadApplePanicLog ( OUT UINT32 * PanicSize)

Read and expand Apple panic log if present.

Parameters
[out]PanicSizeSize of the panic log on success.
Return values
panicbuffer on success.
NULLon failure.

Definition at line 242 of file ApplePanic.c.

◆ OcRegisterBootstrapBootOption()

EFI_STATUS OcRegisterBootstrapBootOption ( IN CONST CHAR16 * OptionName,
IN EFI_HANDLE DeviceHandle,
IN CONST CHAR16 * FilePath,
IN BOOLEAN ShortForm,
IN CONST CHAR16 * MatchSuffix,
IN UINTN MatchSuffixLen )

Register top-most priority boot option. MatchSuffix allows for fuzzy replacement of the option, i.e. when a new option replaces an old one with a matching suffix but a different prefix.

Parameters
[in]OptionNameOption name to create.
[in]DeviceHandleDevice handle of the file system.
[in]FilePathBootloader path.
[in]ShortFormWhether the Device Path should be written in short-form.
[in]MatchSuffixThe file Device Path suffix of a matching option.
[in]MatchSuffixLenThe length, in characters, of MatchSuffix.
Return values
EFI_SUCCESSon success.

Definition at line 1498 of file DefaultEntryChoice.c.

◆ OcRemoveArgumentFromCmd()

VOID OcRemoveArgumentFromCmd ( IN OUT CHAR8 * CommandLine,
IN CONST CHAR8 * Argument )

Remove argument from command line if present.

Parameters
[in,out]CommandLineArgument command line, e.g. for boot.efi.
[in]ArgumentArgument, e.g. -v, slide=, debug=, etc.

Definition at line 136 of file BootArguments.c.

◆ OcResetSystem()

EFI_STATUS EFIAPI OcResetSystem ( IN CHAR16 * Mode)

Reset the system. Fails to reset if firmware mode is requested but not supported. Defaults to cold reset when other reset fails, or unknown reset mode is requested.

Parameters
[in]ModeReset mode. Supported modes are:
  • "firmware" - reboot to UEFI firmware settings, if supported
  • "warmreset" - warm reset
  • "coldreset" - cold reset
  • "shutdown" - shut down
Return values
EFI_SUCCESSSystem was reset.
otherSystem could not be reset.

< Unreachable

Definition at line 55 of file OcResetSystem.c.

◆ OcResetToFirmwareSettingsSupported()

EFI_STATUS EFIAPI OcResetToFirmwareSettingsSupported ( VOID )

Tests whether reset to firmware settings is supported.

Return values
EFI_SUCCESSReset to firmware settings is supported.
otherReset to firmware settings is not supported.

Definition at line 22 of file OcResetSystem.c.

◆ OcRunBootPicker()

EFI_STATUS OcRunBootPicker ( IN OC_PICKER_CONTEXT * Context)

Install missing boot policy, scan, and show simple boot menu.

Parameters
[in]ContextPicker context.
Return values
doesnot return unless a fatal error happened.

Definition at line 258 of file OcBootManagementLib.c.

◆ OcRunFirmwareApplication()

EFI_STATUS OcRunFirmwareApplication ( IN EFI_GUID * ApplicationGuid,
IN BOOLEAN SetReason )

Launch firmware application.

Parameters
[in]ApplicationGuidApplication GUID identifier in the firmware.
[in]SetReasonPass enter reason (specific to Apple BootPicker).
Return values
errorcode, should not return.

Definition at line 558 of file OcBootManagementLib.c.

◆ OcScanForBootEntries()

OC_BOOT_CONTEXT * OcScanForBootEntries ( IN OC_PICKER_CONTEXT * Context)

Scan system for boot entries.

Parameters
[in]ContextPicker context.
Return values
bootcontext allocated from pool.

< Index if Tools or Entries item is pre-created

< ID if boot entry protocol item is pre-created

< PARTUUID for pre-created boot entry protocol item

Definition at line 2102 of file BootEntryManagement.c.

◆ OcScanForDefaultBootEntry()

OC_BOOT_CONTEXT * OcScanForDefaultBootEntry ( IN OC_PICKER_CONTEXT * Context,
IN BOOLEAN UseBootNextOnly )

Scan system for first entry to boot. This is likely to return an incomplete list and can even give NULL, when only tools and system entries are present.

Parameters
[in]ContextPicker context.
[in]UseBootNextOnlyUse only BootNext.
Return values
bootcontext allocated from pool.

Definition at line 2293 of file BootEntryManagement.c.

◆ OcSetDefaultBootEntry()

EFI_STATUS OcSetDefaultBootEntry ( IN OC_PICKER_CONTEXT * Context,
IN OC_BOOT_ENTRY * Entry )

Set default entry to passed entry.

Parameters
[in]ContextPicker context.
[in,out]EntryEntry to make default.
Return values
EFI_SUCCESSon success.

Definition at line 772 of file DefaultEntryChoice.c.

◆ OcShowSimpleBootMenu()

EFI_STATUS EFIAPI OcShowSimpleBootMenu ( IN OC_BOOT_CONTEXT * BootContext,
IN OC_BOOT_ENTRY ** BootEntries,
OUT OC_BOOT_ENTRY ** ChosenBootEntry )

Show simple boot entry selection menu and return chosen entry.

Parameters
[in]BootContextBoot context.
[in]BootEntriesEnumerated entries.
[in]ChosenBootEntryChosen boot entry from BootEntries on success.
Return values
EFI_SUCCESSExecuted successfully and picked up an entry.
EFI_ABORTEDWhen the user chose to by pressing Esc or 0.

Definition at line 332 of file BuiltinPicker.c.

◆ OcShowSimplePasswordRequest()

EFI_STATUS EFIAPI OcShowSimplePasswordRequest ( IN OC_PICKER_CONTEXT * Context,
IN OC_PRIVILEGE_LEVEL Level )

Show simple password prompt and return verification status.

Parameters
[in]ContextPicker context.
[in]LevelThe privilege level to request escalating to.
Return values
EFI_SUCCESSThe privilege level has been escalated successfully.
EFI_ABORTEDThe privilege escalation has been aborted.
otherThe system must be considered compromised.

Definition at line 887 of file BuiltinPicker.c.

◆ OcToggleVoiceOver()

VOID EFIAPI OcToggleVoiceOver ( IN OC_PICKER_CONTEXT * Context,
IN CONST CHAR8 *BasePath OPTIONAL,
IN CONST CHAR8 *BaseType OPTIONAL )

Toggle VoiceOver support.

Parameters
[in]ContextPicker context.
[in]BasePathFile base path of file to play after enabling VoiceOver.
[in]BaseTypeAudio base type of file to play after enabling VoiceOver.

Definition at line 255 of file BootAudio.c.

◆ OcUnlockAppleFirmwareUI()

EFI_STATUS OcUnlockAppleFirmwareUI ( VOID )

Force Apple Firmware UI to always reconnect to current console GOP.

Return values
EFI_SUCCESSFirmware UI ConnectGop method was successfully reset.
otherCompatible firmware UI protocol for reset could not be found.

Definition at line 687 of file OcBootManagementLib.c.

◆ OcValidLoadOptions()

BOOLEAN EFIAPI OcValidLoadOptions ( IN UINT32 LoadOptionsSize,
IN CONST VOID * LoadOptions )

Are load options apparently valid (Unicode string or cleanly non-present)?

Parameters
[in]LoadOptionsSizeLoad options size.
[in]LoadOptionsLoad options.
Return values
TRUEif valid.

Definition at line 384 of file BootArguments.c.

◆ OcVerifyPassword()

BOOLEAN EFIAPI OcVerifyPassword ( IN CONST UINT8 * Password,
IN UINT32 PasswordSize,
IN CONST OC_PRIVILEGE_CONTEXT * PrivilegeContext )

Verify password.

Shared context function to be used by all pickers rather than directly linked call to OcVerifyPasswordSha512, to pick up status of Avx acceleration as enabled within OpenCore.efi and to avoid unnecessary OcCryptoLib lib linking into external picker.

Parameters
[in]PasswordPassword.
[in]PasswordSizePassword size.
[in]PrivilegeContextPrivilege context.
Return values
Trueif password verified successfully.

Definition at line 199 of file OcBootManagementLib.c.