OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcAppleBootPolicyLib.c File Reference
#include <AppleMacEfi.h>
#include <MicrosoftWindows.h>
#include <Guid/AppleApfsInfo.h>
#include <Guid/AppleBless.h>
#include <Guid/FileInfo.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/AppleBootPolicy.h>
#include <Library/OcAppleBootPolicyLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcFileLib.h>
#include <Library/OcMiscLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/OcDebugLogLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiBootServicesTableLib.h>

Go to the source code of this file.

Data Structures

struct  APFS_VOLUME_INFO
 
struct  APFS_VOLUME_ROOT
 

Functions

EFI_STATUS EFIAPI BootPolicyGetBootFile (IN EFI_HANDLE Device, IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
EFI_STATUS EFIAPI BootPolicyGetBootFileEx (IN EFI_HANDLE Device, IN BOOT_POLICY_ACTION Action, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
EFI_STATUS EFIAPI BootPolicyDevicePathToDirPath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, OUT EFI_HANDLE *Device, OUT EFI_HANDLE *ApfsVolumeHandle)
 
EFI_STATUS EFIAPI BootPolicyGetApfsRecoveryFilePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *PathName, OUT CHAR16 **FullPathName, OUT VOID **Reserved, OUT EFI_FILE_PROTOCOL **Root, OUT EFI_HANDLE *DeviceHandle)
 
EFI_STATUS EFIAPI BootPolicyGetAllApfsRecoveryFilePath (IN EFI_HANDLE Handle OPTIONAL, OUT VOID **Volumes, OUT UINTN *NumberOfEntries)
 
STATIC EFI_STATUS InternalFileExists (IN EFI_FILE_HANDLE Root, IN CONST CHAR16 *FileName)
 
STATIC EFI_STATUS InternalGetApfsSpecialFileInfo (IN EFI_FILE_PROTOCOL *Root, IN OUT APPLE_APFS_VOLUME_INFO **VolumeInfo OPTIONAL, IN OUT APPLE_APFS_CONTAINER_INFO **ContainerInfo OPTIONAL)
 
STATIC EFI_STATUS InternalGetBooterFromBlessedSystemFilePath (IN EFI_FILE_PROTOCOL *Root, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
STATIC EFI_STATUS InternalGetBooterFromBlessedSystemFolderPath (IN EFI_HANDLE Device, IN EFI_FILE_PROTOCOL *Root, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
EFI_STATUS OcGetBooterFromPredefinedPathList (IN EFI_HANDLE Device, IN EFI_FILE_PROTOCOL *Root, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL, IN CHAR16 *Prefix OPTIONAL)
 
STATIC EFI_STATUS InternalGetApfsVolumeInfo (IN EFI_HANDLE Device, OUT EFI_GUID *ContainerGuid, OUT EFI_GUID *VolumeGuid, OUT APPLE_APFS_VOLUME_ROLE *VolumeRole)
 
STATIC EFI_STATUS InternalGetBooterFromApfsVolumePredefinedPathList (IN EFI_HANDLE Device, IN EFI_FILE_PROTOCOL *PrebootRoot, IN CHAR16 *VolumeDirectoryName, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL)
 
STATIC EFI_STATUS InternalGetBooterFromApfsPredefinedPathList (IN EFI_HANDLE Device, IN EFI_FILE_PROTOCOL *PrebootRoot, IN CONST GUID *ContainerUuid, IN CONST CHAR16 *VolumeUuid OPTIONAL, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL, OUT EFI_HANDLE *VolumeHandle OPTIONAL)
 
STATIC EFI_STATUS InternalGetBootPathName (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, IN BOOLEAN DirectoryOnly)
 
STATIC EFI_STATUS InternalGetApfsVolumeHandle (IN EFI_HANDLE DeviceHandle, IN CHAR16 *PathName, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_HANDLE *ApfsVolumeHandle)
 
EFI_STATUS OcBootPolicyGetBootFile (IN EFI_HANDLE Device, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
EFI_STATUS OcBootPolicyGetBootFileEx (IN EFI_HANDLE Device, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
 
EFI_STATUS InternalBootPolicyDevicePathToDirPath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, OUT EFI_HANDLE *Device, IN BOOLEAN DirectoryOnly)
 
EFI_STATUS OcBootPolicyDevicePathToDirPath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **FileSystem)
 
EFI_STATUS OcBootPolicyDevicePathToFilePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName)
 
STATIC EFI_STATUS OcBootPolicyDevicePathToDirPathAndApfsHandle (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT CHAR16 **BootPathName, OUT EFI_HANDLE *Device, OUT EFI_HANDLE *ApfsVolumeHandle)
 
EFI_STATUS OcBootPolicyGetApfsRecoveryFilePath (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *PathName, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT CHAR16 **FullPathName, OUT EFI_FILE_PROTOCOL **Root, OUT EFI_HANDLE *DeviceHandle)
 
EFI_STATUS OcBootPolicyGetAllApfsRecoveryFilePath (IN EFI_HANDLE Handle OPTIONAL, OUT VOID **Volumes, OUT UINTN *NumberOfEntries)
 
APPLE_BOOT_POLICY_PROTOCOLOcAppleBootPolicyInstallProtocol (IN BOOLEAN Reinstall)
 

Variables

GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16 * gAppleBootPolicyPredefinedPaths []
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyNumPredefinedPaths
 
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyCoreNumPredefinedPaths = 2
 
STATIC APPLE_BOOT_POLICY_PROTOCOL mAppleBootPolicyProtocol
 

Detailed Description

Copyright (C) 2019, vit9696. All rights reserved.

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file OcAppleBootPolicyLib.c.

Function Documentation

◆ BootPolicyDevicePathToDirPath()

EFI_STATUS EFIAPI BootPolicyDevicePathToDirPath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT CHAR16 ** BootPathName,
OUT EFI_HANDLE * Device,
OUT EFI_HANDLE * ApfsVolumeHandle )

Definition at line 1191 of file OcAppleBootPolicyLib.c.

◆ BootPolicyGetAllApfsRecoveryFilePath()

EFI_STATUS EFIAPI BootPolicyGetAllApfsRecoveryFilePath ( IN EFI_HANDLE Handle OPTIONAL,
OUT VOID ** Volumes,
OUT UINTN * NumberOfEntries )

Definition at line 1698 of file OcAppleBootPolicyLib.c.

◆ BootPolicyGetApfsRecoveryFilePath()

EFI_STATUS EFIAPI BootPolicyGetApfsRecoveryFilePath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
IN CONST CHAR16 * PathName,
OUT CHAR16 ** FullPathName,
OUT VOID ** Reserved,
OUT EFI_FILE_PROTOCOL ** Root,
OUT EFI_HANDLE * DeviceHandle )

Definition at line 1438 of file OcAppleBootPolicyLib.c.

◆ BootPolicyGetBootFile()

EFI_STATUS EFIAPI BootPolicyGetBootFile ( IN EFI_HANDLE Device,
IN OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Definition at line 932 of file OcAppleBootPolicyLib.c.

◆ BootPolicyGetBootFileEx()

EFI_STATUS EFIAPI BootPolicyGetBootFileEx ( IN EFI_HANDLE Device,
IN BOOT_POLICY_ACTION Action,
OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Definition at line 1040 of file OcAppleBootPolicyLib.c.

◆ InternalBootPolicyDevicePathToDirPath()

EFI_STATUS InternalBootPolicyDevicePathToDirPath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT CHAR16 ** BootPathName,
OUT EFI_HANDLE * Device,
IN BOOLEAN DirectoryOnly )

Definition at line 1059 of file OcAppleBootPolicyLib.c.

◆ InternalFileExists()

STATIC EFI_STATUS InternalFileExists ( IN EFI_FILE_HANDLE Root,
IN CONST CHAR16 * FileName )

Checks whether the given file exists or not.

Parameters
[in]RootThe volume's opened root.
[in]FileNameThe path of the file to check.
Returns
Returned is whether the specified file exists or not.

Definition at line 151 of file OcAppleBootPolicyLib.c.

◆ InternalGetApfsSpecialFileInfo()

STATIC EFI_STATUS InternalGetApfsSpecialFileInfo ( IN EFI_FILE_PROTOCOL * Root,
IN OUT APPLE_APFS_VOLUME_INFO **VolumeInfo OPTIONAL,
IN OUT APPLE_APFS_CONTAINER_INFO **ContainerInfo OPTIONAL )

Definition at line 177 of file OcAppleBootPolicyLib.c.

◆ InternalGetApfsVolumeHandle()

STATIC EFI_STATUS InternalGetApfsVolumeHandle ( IN EFI_HANDLE DeviceHandle,
IN CHAR16 * PathName,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT EFI_HANDLE * ApfsVolumeHandle )

Definition at line 811 of file OcAppleBootPolicyLib.c.

◆ InternalGetApfsVolumeInfo()

STATIC EFI_STATUS InternalGetApfsVolumeInfo ( IN EFI_HANDLE Device,
OUT EFI_GUID * ContainerGuid,
OUT EFI_GUID * VolumeGuid,
OUT APPLE_APFS_VOLUME_ROLE * VolumeRole )

Definition at line 439 of file OcAppleBootPolicyLib.c.

◆ InternalGetBooterFromApfsPredefinedPathList()

STATIC EFI_STATUS InternalGetBooterFromApfsPredefinedPathList ( IN EFI_HANDLE Device,
IN EFI_FILE_PROTOCOL * PrebootRoot,
IN CONST GUID * ContainerUuid,
IN CONST CHAR16 *VolumeUuid OPTIONAL,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL,
OUT EFI_HANDLE *VolumeHandle OPTIONAL )

APFS boot happens from Preboot volume, which normally contains blessed file or folder. In case blessed path location fails, we iterate every volume within the container, and try to locate a predefined booter path on Preboot volume (e.g. Preboot://{VolumeUuid}/System/Library/CoreServices/boot.efi).

Definition at line 572 of file OcAppleBootPolicyLib.c.

◆ InternalGetBooterFromApfsVolumePredefinedPathList()

STATIC EFI_STATUS InternalGetBooterFromApfsVolumePredefinedPathList ( IN EFI_HANDLE Device,
IN EFI_FILE_PROTOCOL * PrebootRoot,
IN CHAR16 * VolumeDirectoryName,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL )

Definition at line 497 of file OcAppleBootPolicyLib.c.

◆ InternalGetBooterFromBlessedSystemFilePath()

STATIC EFI_STATUS InternalGetBooterFromBlessedSystemFilePath ( IN EFI_FILE_PROTOCOL * Root,
OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Definition at line 241 of file OcAppleBootPolicyLib.c.

◆ InternalGetBooterFromBlessedSystemFolderPath()

STATIC EFI_STATUS InternalGetBooterFromBlessedSystemFolderPath ( IN EFI_HANDLE Device,
IN EFI_FILE_PROTOCOL * Root,
OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Definition at line 278 of file OcAppleBootPolicyLib.c.

◆ InternalGetBootPathName()

STATIC EFI_STATUS InternalGetBootPathName ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT CHAR16 ** BootPathName,
IN BOOLEAN DirectoryOnly )

Definition at line 751 of file OcAppleBootPolicyLib.c.

◆ OcAppleBootPolicyInstallProtocol()

APPLE_BOOT_POLICY_PROTOCOL * OcAppleBootPolicyInstallProtocol ( IN BOOLEAN Reinstall)

Install and initialise Apple Boot policy protocol.

Parameters
[in]ReinstallOverwrite installed protocol.
Return values
installedor located protocol or NULL.

Definition at line 1716 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyDevicePathToDirPath()

EFI_STATUS OcBootPolicyDevicePathToDirPath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT CHAR16 ** BootPathName,
OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL ** FileSystem )

Retrieves folder and file system associated with DevicePath.

Parameters
[in]DevicePathThe device path to describe.
[out]BootPathNameA pointer into which the folder portion of DevicePath is returned. When EFI_SUCCESS is returned, caller is responsible for freeing this pool memory.
[out]FileSystemA pointer into which the simple file system for the folder is returned.
Return values
EFI_SUCCESSThe operation has been completed successfully.
otherDevicePath is not a valid file path.

Definition at line 1088 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyDevicePathToDirPathAndApfsHandle()

STATIC EFI_STATUS OcBootPolicyDevicePathToDirPathAndApfsHandle ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT CHAR16 ** BootPathName,
OUT EFI_HANDLE * Device,
OUT EFI_HANDLE * ApfsVolumeHandle )

Definition at line 1147 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyDevicePathToFilePath()

EFI_STATUS OcBootPolicyDevicePathToFilePath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
OUT CHAR16 ** BootPathName )

Retrieves file path associated with DevicePath.

Parameters
[in]DevicePathThe device path to describe.
[out]BootPathNameA pointer into which the file path for DevicePath is returned. When EFI_SUCCESS is returned, caller is responsible for freeing this pool memory.
Return values
EFI_SUCCESSThe operation has been completed successfully.
otherDevicePath is not a valid file path.

Definition at line 1127 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyGetAllApfsRecoveryFilePath()

EFI_STATUS OcBootPolicyGetAllApfsRecoveryFilePath ( IN EFI_HANDLE Handle OPTIONAL,
OUT VOID ** Volumes,
OUT UINTN * NumberOfEntries )

Definition at line 1471 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyGetApfsRecoveryFilePath()

EFI_STATUS OcBootPolicyGetApfsRecoveryFilePath ( IN EFI_DEVICE_PATH_PROTOCOL * DevicePath,
IN CONST CHAR16 * PathName,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT CHAR16 ** FullPathName,
OUT EFI_FILE_PROTOCOL ** Root,
OUT EFI_HANDLE * DeviceHandle )

Retrieves path info for the APFS Recovery volume associated with the APFS volume given by DevicePath.

Parameters
[in]DevicePathThe device path to the APFS recovery volume.
[in]PathNameThe file path to open.
[in]PredefinedPathsAn array of file paths to scan for if no file was blessed.
[in]NumPredefinedPathsThe number of paths in PredefinedPaths.
[out]FullPathNameA pointer into which the full file path for DevicePath and PathName is returned.
[out]RootA pointer into which the opened Recovery volume root protocol is returned.
[out]DeviceHandleA pointer into which the device handle of DevicePath is returned.
Return values
EFI_SUCCESSThe operation has been completed successfully.
EFI_NOT_FOUNDThe file path could not be found.
otherAn unexpected error has occured.

Definition at line 1227 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyGetBootFile()

EFI_STATUS OcBootPolicyGetBootFile ( IN EFI_HANDLE Device,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
IN OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Locates the bootable file of the given volume. Prefered are the values blessed, though if unavailable, hard-coded names are being verified and used if existing.

The blessed paths are to be determined by the HFS Driver via EFI_FILE_PROTOCOL.GetInfo(). The related identifier definitions are to be found in AppleBless.h.

Parameters
[in]DeviceThe device's Handle to perform the search on.
[in]PredefinedPathsAn array of file paths to scan for if no file was blessed.
[in]NumPredefinedPathsThe number of paths in PredefinedPaths.
[out]FilePathA pointer to the device path pointer to set to the file path of the boot file.
Return values
EFI_NOT_FOUNDA bootable file could not be found on the given volume.
EFI_OUT_OF_RESOURCESThe memory necessary to complete the operation could not be allocated.
EFI_SUCCESSThe operation completed successfully and the BootFilePath Buffer has been filled.
otherThe status of an operation used to complete this operation is returned.

Definition at line 876 of file OcAppleBootPolicyLib.c.

◆ OcBootPolicyGetBootFileEx()

EFI_STATUS OcBootPolicyGetBootFileEx ( IN EFI_HANDLE Device,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT EFI_DEVICE_PATH_PROTOCOL ** FilePath )

Please refer to OcBootPolicyGetBootFile. This function extends the functionality by supporting the APFS Preboot scheme.

Parameters
[in]DeviceThe device's Handle to perform the search on.
[in]PredefinedPathsAn array of file paths to scan for if no file was blessed.
[in]NumPredefinedPathsThe number of paths in PredefinedPaths.
[out]FilePathA pointer to the device path pointer to set to the file path of the boot file.
Return values
EFI_NOT_FOUNDA bootable file could not be found on the given volume.
EFI_OUT_OF_RESOURCESThe memory necessary to complete the operation could not be allocated.
EFI_SUCCESSThe operation completed successfully and the BootFilePath Buffer has been filled.
otherThe status of an operation used to complete this operation is returned.

Definition at line 950 of file OcAppleBootPolicyLib.c.

◆ OcGetBooterFromPredefinedPathList()

EFI_STATUS OcGetBooterFromPredefinedPathList ( IN EFI_HANDLE Device,
IN EFI_FILE_PROTOCOL * Root,
IN CONST CHAR16 ** PredefinedPaths,
IN UINTN NumPredefinedPaths,
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL,
IN CHAR16 *Prefix OPTIONAL )

Definition at line 364 of file OcAppleBootPolicyLib.c.

Variable Documentation

◆ gAppleBootPolicyCoreNumPredefinedPaths

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyCoreNumPredefinedPaths = 2

Core Apple Boot Policy predefined booter paths.

Definition at line 83 of file OcAppleBootPolicyLib.c.

◆ gAppleBootPolicyNumPredefinedPaths

GLOBAL_REMOVE_IF_UNREFERENCED CONST UINTN gAppleBootPolicyNumPredefinedPaths
Initial value:
=
#define ARRAY_SIZE(Array)
Definition AppleMacEfi.h:34
GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16 * gAppleBootPolicyPredefinedPaths[]

All Apple Boot Policy predefined booter paths.

Definition at line 80 of file OcAppleBootPolicyLib.c.

◆ gAppleBootPolicyPredefinedPaths

GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR16* gAppleBootPolicyPredefinedPaths[]
Initial value:
= {
EFI_REMOVABLE_MEDIA_FILE_NAME
}
#define APPLE_BOOTER_DEFAULT_FILE_NAME
#define MS_BOOTER_DEFAULT_FILE_NAME

An array of file paths to search for in case no file is blessed. On Apple Macs this list includes:

  1. APPLE_BOOTER_DEFAULT_FILE_NAME – \System\Library\CoreServices\boot.efi
  2. APPLE_REMOVABLE_MEDIA_FILE_NAME – \EFI\APPLE\X64\BOOT.EFI
  3. EFI_REMOVABLE_MEDIA_FILE_NAME – \EFI\BOOT\BOOTX64.EFI
  4. APPLE_BOOTER_ROOT_FILE_NAME – \boot.efi

Since in real world only 1st and 3rd entries are used, we do not include 2nd and 4th until further notice. However, we do include a custom entry for Windows, for the reason OpenCore, unlike Apple EFI, may override BOOTx64.efi, and this is not the case for Apple EFI. So we end up with:

  1. APPLE_BOOTER_DEFAULT_FILE_NAME – \System\Library\CoreServices\boot.efi
  2. MS_BOOTER_DEFAULT_FILE_NAME – \EFI\Microsoft\Boot\bootmgfw.efi
  3. EFI_REMOVABLE_MEDIA_FILE_NAME – \EFI\BOOT\BOOTX64.EFI

This resolves a problem when Windows installer does not replace our BOOTx64.efi file with Windows file and then NVRAM reset or Boot Camp software reboot to macOS results in the removal of the Windows boot entry from NVRAM making Windows disappear from the list of OpenCore entries without BlessOverride.

Linux and related entries are not present here, because they have fine working software for boot management and do not use BOOTx64.efi in the first place.

Definition at line 74 of file OcAppleBootPolicyLib.c.

◆ mAppleBootPolicyProtocol

STATIC APPLE_BOOT_POLICY_PROTOCOL mAppleBootPolicyProtocol
Initial value:
= {
}
#define APPLE_BOOT_POLICY_PROTOCOL_REVISION
EFI_STATUS EFIAPI BootPolicyGetAllApfsRecoveryFilePath(IN EFI_HANDLE Handle OPTIONAL, OUT VOID **Volumes, OUT UINTN *NumberOfEntries)
EFI_STATUS EFIAPI BootPolicyDevicePathToDirPath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, OUT EFI_HANDLE *Device, OUT EFI_HANDLE *ApfsVolumeHandle)
EFI_STATUS EFIAPI BootPolicyGetBootFileEx(IN EFI_HANDLE Device, IN BOOT_POLICY_ACTION Action, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
EFI_STATUS EFIAPI BootPolicyGetBootFile(IN EFI_HANDLE Device, IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
EFI_STATUS EFIAPI BootPolicyGetApfsRecoveryFilePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *PathName, OUT CHAR16 **FullPathName, OUT VOID **Reserved, OUT EFI_FILE_PROTOCOL **Root, OUT EFI_HANDLE *DeviceHandle)

The APPLE_BOOT_POLICY_PROTOCOL instance to get installed.

Definition at line 131 of file OcAppleBootPolicyLib.c.