OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
UserOcDummy.c File Reference
#include <Library/DebugLib.h>
#include <Library/OcAppleKernelLib.h>
#include <Library/OcBootManagementLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcFileLib.h>
#include <Protocol/LoadedImage.h>

Go to the source code of this file.

Functions

EFI_DEVICE_PATH_PROTOCOL * OcGetNextLoadOptionDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath)
 
EFI_STATUS CachelessContextAddKext (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *InfoPlist, IN UINT32 InfoPlistSize, IN UINT8 *Executable OPTIONAL, IN UINT32 ExecutableSize OPTIONAL, OUT CHAR8 BundleVersion[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] OPTIONAL)
 
EFI_STATUS CachelessContextAddPatch (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN PATCHER_GENERIC_PATCH *Patch)
 
EFI_STATUS CachelessContextAddQuirk (IN OUT CACHELESS_CONTEXT *Context, IN KERNEL_QUIRK_NAME Quirk)
 
EFI_STATUS CachelessContextBlock (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier, IN BOOLEAN Exclude)
 
EFI_STATUS CachelessContextForceKext (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR8 *Identifier)
 
VOID CachelessContextFree (IN OUT CACHELESS_CONTEXT *Context)
 
EFI_STATUS CachelessContextHookBuiltin (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, IN EFI_FILE_PROTOCOL *File, OUT EFI_FILE_PROTOCOL **VirtualFile)
 
EFI_STATUS CachelessContextInit (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, IN EFI_FILE_PROTOCOL *ExtensionsDir, IN UINT32 KernelVersion, IN BOOLEAN Is32Bit)
 
EFI_STATUS CachelessContextOverlayExtensionsDir (IN OUT CACHELESS_CONTEXT *Context, OUT EFI_FILE_PROTOCOL **File)
 
EFI_STATUS CachelessContextPerformInject (IN OUT CACHELESS_CONTEXT *Context, IN CONST CHAR16 *FileName, OUT EFI_FILE_PROTOCOL **File)
 
EFI_STATUS CreateRealFile (IN EFI_FILE_PROTOCOL *OriginalFile OPTIONAL, IN EFI_FILE_OPEN OpenCallback OPTIONAL, IN BOOLEAN CloseOnFailure, OUT EFI_FILE_PROTOCOL **File)
 
EFI_STATUS CreateVirtualFileFileNameCopy (IN CONST CHAR16 *FileName, IN VOID *FileBuffer, IN UINT64 FileSize, IN CONST EFI_TIME *ModificationTime OPTIONAL, OUT EFI_FILE_PROTOCOL **File)
 
EFI_STATUS DisableVirtualFs (IN OUT EFI_BOOT_SERVICES *BootServices)
 
EFI_STATUS EnableVirtualFs (IN OUT EFI_BOOT_SERVICES *BootServices, IN EFI_FILE_OPEN OpenCallback)
 
BOOLEAN OcAppendArgumentsToLoadedImage (IN OUT EFI_LOADED_IMAGE_PROTOCOL *LoadedImage, IN CONST CHAR8 **Arguments, IN UINT32 ArgumentCount, IN BOOLEAN Replace)
 
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)
 
VOID OcDirectorySeachContextInit (IN OUT DIRECTORY_SEARCH_CONTEXT *Context)
 
EFI_STATUS OcFindWritableOcFileSystem (OUT EFI_FILE_PROTOCOL **FileSystem)
 
OC_BOOT_ENTRY_TYPE OcGetBootDevicePathType (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT BOOLEAN *IsFolder OPTIONAL, OUT BOOLEAN *IsGeneric OPTIONAL)
 
EFI_STATUS OcGetFileModificationTime (IN EFI_FILE_PROTOCOL *File, OUT EFI_TIME *Time)
 
EFI_STATUS OcGetNewestFileFromDirectory (IN OUT DIRECTORY_SEARCH_CONTEXT *Context, IN EFI_FILE_PROTOCOL *Directory, IN CHAR16 *FileNameStartsWith OPTIONAL, OUT EFI_FILE_INFO **FileInfo)
 
VOID OcImageLoaderRegisterConfigure (IN OC_IMAGE_LOADER_CONFIGURE Configure OPTIONAL)
 
BOOLEAN OcPlatformIs64BitSupported (IN UINT32 KernelVersion)
 
EFI_STATUS OcSafeFileOpen (IN CONST EFI_FILE_PROTOCOL *Protocol, OUT EFI_FILE_PROTOCOL **NewHandle, IN CONST CHAR16 *FileName, IN CONST UINT64 OpenMode, IN CONST UINT64 Attributes)
 
VOID * OcStorageReadFileUnicode (IN OC_STORAGE_CONTEXT *Context, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL)
 
VOID * OcReadFileFromDirectory (IN CONST EFI_FILE_PROTOCOL *RootDirectory, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL, IN UINT32 MaxFileSize OPTIONAL)
 
EFI_MEMORY_DESCRIPTOR * OcGetCurrentMemoryMap (OUT UINTN *MemoryMapSize, OUT UINTN *DescriptorSize, OUT UINTN *MapKey OPTIONAL, OUT UINT32 *DescriptorVersion OPTIONAL, OUT UINTN *OriginalMemoryMapSize OPTIONAL, IN BOOLEAN IncludeSplitSpace)
 
VOID * OcGetFileInfo (IN EFI_FILE_PROTOCOL *File, IN EFI_GUID *InformationType, IN UINTN MinFileInfoSize, OUT UINTN *RealFileInfoSize OPTIONAL)
 
CHAR16 * OcGetVolumeLabel (IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem)
 
VOID * OcReadFile (IN CONST EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL, IN CONST UINT32 MaxFileSize OPTIONAL)
 

Detailed Description

Copyright (c) 2020, PMheart. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Definition in file UserOcDummy.c.

Function Documentation

◆ CachelessContextAddKext()

EFI_STATUS CachelessContextAddKext ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR8 * InfoPlist,
IN UINT32 InfoPlistSize,
IN UINT8 *Executable OPTIONAL,
IN UINT32 ExecutableSize OPTIONAL,
OUT CHAR8 BundleVersion OPTIONAL[MAX_INFO_BUNDLE_VERSION_KEY_SIZE] )

Add kext to cacheless context to be injected later on.

Parameters
[in,out]ContextCacheless context.
[in]InfoPlistKext Info.plist.
[in]InfoPlistSizeKext Info.plist size.
[in]ExecutableKext executable, optional.
[in]ExecutableSizeKext executable size, optional.
[out]BundleVersionKext bundle version, optionally set on request.
Returns
EFI_SUCCESS on success.

Definition at line 26 of file UserOcDummy.c.

◆ CachelessContextAddPatch()

EFI_STATUS CachelessContextAddPatch ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR8 * Identifier,
IN PATCHER_GENERIC_PATCH * Patch )

Add patch to cacheless context to be applied later on.

Parameters
[in,out]ContextCacheless context.
[in]IdentifierKext bundle identifier.
[in]PatchPatch to apply.
Returns
EFI_SUCCESS on success.

Definition at line 41 of file UserOcDummy.c.

◆ CachelessContextAddQuirk()

EFI_STATUS CachelessContextAddQuirk ( IN OUT CACHELESS_CONTEXT * Context,
IN KERNEL_QUIRK_NAME Quirk )

Add kernel quirk to cacheless context to be applied later on.

Parameters
[in,out]ContextCacheless context.
[in]QuirkQuirk to apply.
Returns
EFI_SUCCESS on success.

Definition at line 53 of file UserOcDummy.c.

◆ CachelessContextBlock()

EFI_STATUS CachelessContextBlock ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR8 * Identifier,
IN BOOLEAN Exclude )

Add block request to cacheless context to be applied later on.

Parameters
[in,out]ContextCacheless context.
[in]IdentifierKext bundle identifier.
[in]ExcludeTRUE to exclude kext from cacheless context.
Returns
EFI_SUCCESS on success.

Definition at line 64 of file UserOcDummy.c.

◆ CachelessContextForceKext()

EFI_STATUS CachelessContextForceKext ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR8 * Identifier )

Force built-in kext to load.

Parameters
[in,out]ContextCacheless context.
[in]IdentifierKext bundle identifier.
Returns
EFI_SUCCESS on success.

Definition at line 76 of file UserOcDummy.c.

◆ CachelessContextFree()

VOID CachelessContextFree ( IN OUT CACHELESS_CONTEXT * Context)

Frees cacheless context.

Parameters
[in,out]ContextCacheless context.
Returns
EFI_SUCCESS on success.

Definition at line 87 of file UserOcDummy.c.

◆ CachelessContextHookBuiltin()

EFI_STATUS CachelessContextHookBuiltin ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR16 * FileName,
IN EFI_FILE_PROTOCOL * File,
OUT EFI_FILE_PROTOCOL ** VirtualFile )

Apply patches to built-in kexts.

Parameters
[in,out]ContextPrelinked context.
[in]FileNameFilename of kext file to be injected.
[in]FileEFI_FILE_PROTOCOL instance of kext file.
[out]VirtualFileNewly created virtualised EFI_FILE_PROTOCOL instance.
Returns
EFI_SUCCESS on success. If no patches are applicable, VirtualFile will be NULL.

Definition at line 95 of file UserOcDummy.c.

◆ CachelessContextInit()

EFI_STATUS CachelessContextInit ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR16 * FileName,
IN EFI_FILE_PROTOCOL * ExtensionsDir,
IN UINT32 KernelVersion,
IN BOOLEAN Is32Bit )

Initializes cacheless context for later modification. Must be freed with CachelessContextFree on success.

Parameters
[in,out]ContextCacheless context.
[in]FileNameExtensions directory filename.
[in]ExtensionsDirExtensions directory EFI_FILE_PROTOCOL.
[in]KernelVersionCurrent kernel version.
[in]Is32BitTRUE if booting in 32-bit kernel mode.
Returns
EFI_SUCCESS on success.

Definition at line 108 of file UserOcDummy.c.

◆ CachelessContextOverlayExtensionsDir()

EFI_STATUS CachelessContextOverlayExtensionsDir ( IN OUT CACHELESS_CONTEXT * Context,
OUT EFI_FILE_PROTOCOL ** File )

Creates virtual directory overlay EFI_FILE_PROTOCOL from cacheless context.

Parameters
[in,out]ContextCacheless context.
[out]FileThe virtual directory instance.
Returns
EFI_SUCCESS on success.

Definition at line 122 of file UserOcDummy.c.

◆ CachelessContextPerformInject()

EFI_STATUS CachelessContextPerformInject ( IN OUT CACHELESS_CONTEXT * Context,
IN CONST CHAR16 * FileName,
OUT EFI_FILE_PROTOCOL ** VirtualFile )

Perform kext injection.

Parameters
[in,out]ContextPrelinked context.
[in]FileNameFilename of kext file to be injected.
[out]VirtualFileNewly created virtualised EFI_FILE_PROTOCOL instance.
Returns
EFI_SUCCESS on success.

Definition at line 133 of file UserOcDummy.c.

◆ CreateRealFile()

EFI_STATUS CreateRealFile ( IN EFI_FILE_PROTOCOL *OriginalFile OPTIONAL,
IN EFI_FILE_OPEN OpenCallback OPTIONAL,
IN BOOLEAN CloseOnFailure,
OUT EFI_FILE_PROTOCOL ** File )

Creates virtual file system instance around any file. CreateRealFile or CreateVirtualFile must be called from any registered OpenCallback.

Parameters
[in]OriginalFilePointer to the original file.
[in]OpenCallbackFile open callback.
[in]CloseOnFailureClose the original file on failure.
[out]FileResulting file protocol.
Returns
EFI_SUCCESS if instance was successfully created.
EFI_SIMPLE_FILE_SYSTEM Open-compatible error return code.

Definition at line 145 of file UserOcDummy.c.

◆ CreateVirtualFileFileNameCopy()

EFI_STATUS CreateVirtualFileFileNameCopy ( IN CONST CHAR16 * FileName,
IN VOID * FileBuffer,
IN UINT64 FileSize,
IN CONST EFI_TIME *ModificationTime OPTIONAL,
OUT EFI_FILE_PROTOCOL ** File )

Creates read-only EFI_FILE_PROTOCOL instance over a buffer allocated from pool. On success FileData ownership is transferred to the resulting EFI_FILE_PROTOCOL, which frees them with FreePool upon closing EFI_FILE_PROTOCOL. All other fields are copied.

Resulting EFI_FILE_PROTOCOL has 2nd revision, but may be downgraded to 1st by updating the corresponding field.

Parameters
[in]FileNamePointer to the file's name.
[in]FileBufferPointer to the file's data.
[in]FileSizeFile size of FileData.
[in]ModificationTimeFile modification date, optional.
[out]FileResulting file protocol.
Returns
EFI_SUCCESS if instance was successfully created.

Definition at line 158 of file UserOcDummy.c.

◆ DisableVirtualFs()

EFI_STATUS DisableVirtualFs ( IN OUT EFI_BOOT_SERVICES * BootServices)

Enables virtual file system access for given BootServices.

Parameters
[in,out]BootServicesHooked EFI_BOOT_SERVICES.
Returns
EFI_SUCCESS on successful unhooking.

Definition at line 172 of file UserOcDummy.c.

◆ EnableVirtualFs()

EFI_STATUS EnableVirtualFs ( IN OUT EFI_BOOT_SERVICES * BootServices,
IN EFI_FILE_OPEN OpenCallback )

Enables virtual file system access for given BootServices with callback on file open.

Parameters
[in,out]BootServicesHooked EFI_BOOT_SERVICES.
[in]OpenCallbackFile open callback.
Returns
EFI_SUCCESS on successful hooking.

Definition at line 182 of file UserOcDummy.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 193 of file UserOcDummy.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 206 of file UserOcDummy.c.

◆ OcDirectorySeachContextInit()

VOID OcDirectorySeachContextInit ( IN OUT DIRECTORY_SEARCH_CONTEXT * Context)

Initialize DIRECTORY_SEARCH_CONTEXT.

Parameters
[in,out]ContextA pointer to the DIRECTORY_SEARCH_CONTEXT.

Definition at line 220 of file UserOcDummy.c.

◆ OcFindWritableOcFileSystem()

EFI_STATUS OcFindWritableOcFileSystem ( OUT EFI_FILE_PROTOCOL ** FileSystem)

Find writable filesystem from Bootstrap.

Parameters
[out]FileSystemPointer to first found writeable file system.
Return values
EFI_SUCCESSon success.

Definition at line 228 of file UserOcDummy.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 238 of file UserOcDummy.c.

◆ OcGetCurrentMemoryMap()

EFI_MEMORY_DESCRIPTOR * OcGetCurrentMemoryMap ( OUT UINTN * MemoryMapSize,
OUT UINTN * DescriptorSize,
OUT UINTN *MapKey OPTIONAL,
OUT UINT32 *DescriptorVersion OPTIONAL,
OUT UINTN *OriginalMemoryMapSize OPTIONAL,
IN BOOLEAN IncludeSplitSpace )

Get current memory map allocated on pool with reserved entries.

Parameters
[out]MemoryMapSizeResulting memory map size in bytes.
[out]DescriptorSizeResulting memory map descriptor size in bytes.
[out]MapKeyMemory map key, optional.
[out]DescriptorVersionMemory map descriptor version, optional.
[out]OriginalMemoryMapSizeActual pool allocation memory, optional.
[out]IncludeSplitSpaceAllocate memory to permit splitting memory map.
Return values
currentmemory map or NULL.

Definition at line 331 of file UserOcDummy.c.

◆ OcGetFileInfo()

VOID * OcGetFileInfo ( IN EFI_FILE_PROTOCOL * File,
IN EFI_GUID * InformationType,
IN UINTN MinFileInfoSize,
OUT UINTN *RealFileInfoSize OPTIONAL )

Get file information of specified type.

Parameters
[in]FileA pointer to file handle.
[in]InformationTypeA pointer to file info GUID.
[in]MinFileInfoSizeMinimal size of the info provided.
[out]RealFileInfoSizeActual info size read (optional).
Return values
readfile info or NULL.

Definition at line 346 of file UserOcDummy.c.

◆ OcGetFileModificationTime()

EFI_STATUS OcGetFileModificationTime ( IN EFI_FILE_PROTOCOL * File,
OUT EFI_TIME * Time )

Determine file modification time.

Parameters
[in]FileA pointer to the file protocol.
[out]TimeModification time.
Return values
EFI_SUCCESSon success.

Definition at line 250 of file UserOcDummy.c.

◆ OcGetNewestFileFromDirectory()

EFI_STATUS OcGetNewestFileFromDirectory ( IN OUT DIRECTORY_SEARCH_CONTEXT * Context,
IN EFI_FILE_PROTOCOL * Directory,
IN CHAR16 *FileNameStartsWith OPTIONAL,
OUT EFI_FILE_INFO ** FileInfo )

Gets the next newest file from the specified directory.

Parameters
[in,out]ContextContext.
[in]DirectoryThe directory EFI_FILE_PROTOCOL instance.
[in]FileNameStartsWithSkip files starting with this value.
[out]FileInfoEFI_FILE_INFO allocated from pool memory.
Return values
EFI_SUCCESSon success.

Definition at line 261 of file UserOcDummy.c.

◆ OcGetNextLoadOptionDevicePath()

EFI_DEVICE_PATH_PROTOCOL * OcGetNextLoadOptionDevicePath ( IN EFI_DEVICE_PATH_PROTOCOL * FilePath,
IN EFI_DEVICE_PATH_PROTOCOL * FullPath )

Get the next possible full path pointing to the load option. The routine doesn't guarantee the returned full path points to an existing file, and it also doesn't guarantee the existing file is a valid load option.

Parameters
FilePathThe device path pointing to a load option. It could be a short-form device path.
FullPathThe full path returned by the routine in last call. Set to NULL in first call.
Returns
The next possible full path pointing to the load option. Caller is responsible to free the memory.

Definition at line 15 of file UserOcDummy.c.

◆ OcGetVolumeLabel()

CHAR16 * OcGetVolumeLabel ( IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * FileSystem)

Retrieves volume label.

Parameters
[in]FileSystemA pointer to the file system protocol of the volume.
Return values
Apointer to the NULL terminated unicode volume label.

Definition at line 359 of file UserOcDummy.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 274 of file UserOcDummy.c.

◆ OcPlatformIs64BitSupported()

BOOLEAN OcPlatformIs64BitSupported ( IN UINT32 KernelVersion)

Determine platform support for 64-bit kernel mode based on kernel version.

Parameters
[in]KernelVersionKernel version.

Definition at line 282 of file UserOcDummy.c.

◆ OcReadFile()

VOID * OcReadFile ( IN CONST EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * FileSystem,
IN CONST CHAR16 * FilePath,
OUT UINT32 *FileSize OPTIONAL,
IN CONST UINT32 MaxFileSize OPTIONAL )

Read file from file system with implicit double (2 byte) null termination. Null termination does not affect the returned file size. Depending on the implementation 0 byte files may return null.

Parameters
[in]FileSystemA pointer to the file system protocol of the volume.
[in]FilePathThe full path to the file on the device.
[out]FileSizeThe size of the file read (optional).
[in]MaxFileSizeUpper file size bound (optional).
Return values
Apointer to a buffer containing file read or NULL.

Definition at line 369 of file UserOcDummy.c.

◆ OcReadFileFromDirectory()

VOID * OcReadFileFromDirectory ( IN CONST EFI_FILE_PROTOCOL * RootDirectory,
IN CONST CHAR16 * FilePath,
OUT UINT32 *FileSize OPTIONAL,
IN UINT32 MaxFileSize OPTIONAL )

Read file from file protocol with implicit double (2 byte) null termination. Null termination does not affect the returned file size. Depending on the implementation 0 byte files may return null.

Parameters
[in]RootDirectoryA pointer to the file protocol of the directory.
[in]FilePathThe full path to the file on the device.
[out]FileSizeThe size of the file read (optional).
[in]MaxFileSizeUpper file size bound (optional).
Return values
Apointer to a buffer containing file read or NULL.

Definition at line 318 of file UserOcDummy.c.

◆ OcSafeFileOpen()

EFI_STATUS OcSafeFileOpen ( IN CONST EFI_FILE_PROTOCOL * Directory,
OUT EFI_FILE_PROTOCOL ** NewHandle,
IN CONST CHAR16 * FileName,
IN CONST UINT64 OpenMode,
IN CONST UINT64 Attributes )

Opens a new file relative to the source file's location. This function is equivalent to EFI_FILE_OPEN but has additional restrictions to provide board compatibility. Currently the only restriction is no trailing slash in the filename due to issues in FAT drivers.

  • Multiple boards, namely ASUS P8H61-M and P8H61-M LX2 will not open directories with trailing slash. It is irrelevant whether front slash is present for them. For example, it means that L"EFI\\OC\\" or L"\EFI\OC\" will both fail to open, while L"EFI\OC" and L"\EFI\OC" will open fine.
  • Most newer boards on APTIO IV do handle directories with trailing slash, however, their driver will modify passed string by removing the slash by \0.
Parameters
DirectoryFile protocol instance of parent directory.
NewHandlePointer for returned handle.
FileNameNull-terminated file name or relative path.
OpenModeFile open mode.
AttributesAttributes for the newly created file.
Return values
EFI_SUCCESSfor successfully opened file.

Definition at line 292 of file UserOcDummy.c.

◆ OcStorageReadFileUnicode()

VOID * OcStorageReadFileUnicode ( IN OC_STORAGE_CONTEXT * Context,
IN CONST CHAR16 * FilePath,
OUT UINT32 *FileSize OPTIONAL )

Read file from storage with implicit double (2 byte) null termination. Null termination does not affect the returned file size. Depending on the implementation 0 byte files may return null. If storage context was created with valid storage key, then signature checking will be performed

Parameters
[in]ContextStorage context.
[in]FilePathThe full path to the file on the device.
[out]FileSizeThe size of the file read (optional).
Return values
Apointer to a buffer containing file read or NULL.

Definition at line 306 of file UserOcDummy.c.