Functions | |
CHAR16 * | StrDuplicate (IN CHAR16 *Src) |
BOOLEAN | GrowBuffer (IN OUT EFI_STATUS *Status, IN OUT VOID **Buffer, IN UINTN BufferSize) |
CHAR16 * | AppendFileName (IN CHAR16 *Str1, IN CHAR16 *Str2) |
SECUREBOOT_MENU_ENTRY * | CreateMenuEntry (VOID) |
SECUREBOOT_MENU_ENTRY * | GetMenuEntry (IN SECUREBOOT_MENU_OPTION *MenuOption, IN UINTN MenuNumber) |
VOID | CreateMenuStringToken (IN EFI_HII_HANDLE HiiHandle, IN SECUREBOOT_MENU_OPTION *MenuOption) |
VOID | DestroyMenuEntry (IN OUT SECUREBOOT_MENU_ENTRY *MenuEntry) |
VOID | FreeMenu (IN OUT SECUREBOOT_MENU_OPTION *MenuOption) |
EFI_FILE_INFO * | FileInfo (IN EFI_FILE_HANDLE FHand) |
EFI_FILE_SYSTEM_VOLUME_LABEL * | FileSystemVolumeLabelInfo (IN EFI_FILE_HANDLE FHand) |
EFI_STATUS EFIAPI | OpenFileByDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT EFI_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes) |
EFI_FILE_HANDLE | OpenRoot (IN EFI_HANDLE DeviceHandle) |
EFI_STATUS | FindFileSystem (VOID) |
EFI_STATUS | FindFiles (IN SECUREBOOT_MENU_ENTRY *MenuEntry) |
VOID | RefreshUpdateData (VOID) |
VOID | UpdateFileExplorePage (IN EFI_HII_HANDLE HiiHandle, IN SECUREBOOT_MENU_OPTION *MenuOption, IN FILE_EXPLORER_STATE FeCurrentState) |
BOOLEAN | UpdateFileExplorer (IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData, IN UINT16 KeyValue) |
VOID | CleanUpPage (IN UINT16 LabelId, IN SECUREBOOT_CONFIG_PRIVATE_DATA *PrivateData) |
Variables | |
SECUREBOOT_MENU_OPTION | FsOptionMenu |
SECUREBOOT_MENU_OPTION | DirectoryMenu |
VOID * | mStartOpCodeHandle = NULL |
VOID * | mEndOpCodeHandle = NULL |
EFI_IFR_GUID_LABEL * | mStartLabel = NULL |
EFI_IFR_GUID_LABEL * | mEndLabel = NULL |
Copyright (c) 2012 - 2015, Intel Corporation. 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.
CHAR16* AppendFileName | ( | IN CHAR16 * | Str1, | |
IN CHAR16 * | Str2 | |||
) |
Append file name to existing file name, and allocate a new buffer to hold the appended result.
[in] | Str1 | The existing file name |
[in] | Str2 | The file name to be appended |
References UINTN().
Referenced by FindFiles().
VOID CleanUpPage | ( | IN UINT16 | LabelId, | |
IN SECUREBOOT_CONFIG_PRIVATE_DATA * | PrivateData | |||
) |
Clean up the dynamic opcode at label and form specified by both LabelId.
[in] | LabelId | It is both the Form ID and Label ID for opcode deletion. |
[in] | PrivateData | Module private data. |
References gSecureBootConfigFormSetGuid, mEndOpCodeHandle, mStartLabel, mStartOpCodeHandle, and RefreshUpdateData().
Referenced by SecureBootCallback().
SECUREBOOT_MENU_ENTRY* CreateMenuEntry | ( | VOID | ) |
Create a SECUREBOOT_MENU_ENTRY, and stores it in a buffer allocated from the pool.
References SECUREBOOT_MENU_ENTRY::FileContext, SECUREBOOT_MENU_ENTRY_SIGNATURE, SECUREBOOT_MENU_ENTRY::Signature, and UINTN().
Referenced by FindFiles(), and FindFileSystem().
VOID CreateMenuStringToken | ( | IN EFI_HII_HANDLE | HiiHandle, | |
IN SECUREBOOT_MENU_OPTION * | MenuOption | |||
) |
Create string tokens for a menu from its help strings and display strings.
[in] | HiiHandle | Hii Handle of the package to be updated. |
[in] | MenuOption | The Menu whose string tokens need to be created. |
References SECUREBOOT_MENU_ENTRY::DisplayString, SECUREBOOT_MENU_ENTRY::DisplayStringToken, GetMenuEntry(), SECUREBOOT_MENU_ENTRY::HelpString, SECUREBOOT_MENU_ENTRY::HelpStringToken, and UINTN().
Referenced by UpdateFileExplorer().
VOID DestroyMenuEntry | ( | IN OUT SECUREBOOT_MENU_ENTRY * | MenuEntry | ) |
Free up all resources allocated for a SECUREBOOT_MENU_ENTRY.
[in,out] | MenuEntry | A pointer to SECUREBOOT_MENU_ENTRY. |
References SECUREBOOT_FILE_CONTEXT::DevicePath, SECUREBOOT_FILE_CONTEXT::FHandle, SECUREBOOT_FILE_CONTEXT::FileName, SECUREBOOT_FILE_CONTEXT::Info, and SECUREBOOT_FILE_CONTEXT::IsRoot.
Referenced by FindFileSystem(), FreeMenu(), and UpdateFileExplorer().
EFI_FILE_INFO* FileInfo | ( | IN EFI_FILE_HANDLE | FHand | ) |
This function gets the file information from an open file descriptor, and stores it in a buffer allocated from pool.
[in] | FHand | File Handle. |
References EFI_STATUS(), GrowBuffer(), and UINTN().
Referenced by FindFiles(), and GetFileData().
EFI_FILE_SYSTEM_VOLUME_LABEL* FileSystemVolumeLabelInfo | ( | IN EFI_FILE_HANDLE | FHand | ) |
This function gets the file system information from an open file descriptor, and stores it in a buffer allocated from pool.
[in] | FHand | The file handle. |
NULL | is returned if failed to get Vaolume Label Info. |
References EFI_STATUS(), GrowBuffer(), and UINTN().
Referenced by FindFileSystem().
EFI_STATUS FindFiles | ( | IN SECUREBOOT_MENU_ENTRY * | MenuEntry | ) |
Find files under the current directory. All files and sub-directories in current directory will be stored in DirectoryMenu for future use.
[in] | MenuEntry | The Menu Entry. |
EFI_SUCCESS | Get files from current dir successfully. |
References AppendFileName(), BOOLEAN(), CreateMenuEntry(), SECUREBOOT_FILE_CONTEXT::DevicePath, SECUREBOOT_MENU_ENTRY::DisplayString, EFI_STATUS(), SECUREBOOT_FILE_CONTEXT::FHandle, SECUREBOOT_MENU_ENTRY::FileContext, FileInfo(), SECUREBOOT_FILE_CONTEXT::FileName, SECUREBOOT_FILE_CONTEXT::Handle, SECUREBOOT_MENU_OPTION::Head, SECUREBOOT_MENU_ENTRY::HelpString, SECUREBOOT_FILE_CONTEXT::IsDir, SECUREBOOT_FILE_CONTEXT::IsLoadFile, SECUREBOOT_FILE_CONTEXT::IsRemovableMedia, SECUREBOOT_FILE_CONTEXT::IsRoot, SECUREBOOT_MENU_ENTRY::Link, SECUREBOOT_MENU_OPTION::MenuNumber, SECUREBOOT_MENU_ENTRY::OptionNumber, StrDuplicate(), and UINTN().
Referenced by UpdateFileExplorer().
EFI_STATUS FindFileSystem | ( | VOID | ) |
This function builds the FsOptionMenu list which records all available file system in the system. They include all instances of EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, all instances of EFI_LOAD_FILE_SYSTEM and all type of legacy boot device.
EFI_SUCCESS | Success find the file system | |
EFI_OUT_OF_RESOURCES | Can not create menu entry |
References BOOLEAN(), CreateMenuEntry(), DestroyMenuEntry(), SECUREBOOT_FILE_CONTEXT::DevicePath, DevicePathToStr(), SECUREBOOT_MENU_ENTRY::DisplayString, EFI_STATUS(), SECUREBOOT_FILE_CONTEXT::FHandle, SECUREBOOT_MENU_ENTRY::FileContext, SECUREBOOT_FILE_CONTEXT::FileName, FileSystemVolumeLabelInfo(), SECUREBOOT_FILE_CONTEXT::Handle, SECUREBOOT_MENU_OPTION::Head, SECUREBOOT_MENU_ENTRY::HelpString, SECUREBOOT_FILE_CONTEXT::Info, SECUREBOOT_FILE_CONTEXT::IsDir, SECUREBOOT_FILE_CONTEXT::IsLoadFile, SECUREBOOT_FILE_CONTEXT::IsRemovableMedia, SECUREBOOT_FILE_CONTEXT::IsRoot, SECUREBOOT_MENU_ENTRY::Link, MAX_CHAR, SECUREBOOT_MENU_OPTION::MenuNumber, OpenRoot(), SECUREBOOT_MENU_ENTRY::OptionNumber, StrDuplicate(), TRUE, and UINTN().
Referenced by UpdateFileExplorer().
VOID FreeMenu | ( | IN OUT SECUREBOOT_MENU_OPTION * | MenuOption | ) |
Free resources allocated in Allocate Rountine.
[in,out] | MenuOption | Menu to be freed |
References DestroyMenuEntry(), SECUREBOOT_MENU_ENTRY::Link, and SECUREBOOT_MENU_ENTRY_SIGNATURE.
Referenced by SecureBootCallback(), UninstallSecureBootConfigForm(), and UpdateFileExplorer().
SECUREBOOT_MENU_ENTRY* GetMenuEntry | ( | IN SECUREBOOT_MENU_OPTION * | MenuOption, | |
IN UINTN | MenuNumber | |||
) |
Get Menu Entry from the Menu Entry List by MenuNumber.
If MenuNumber is great or equal to the number of Menu Entry in the list, then ASSERT.
[in] | MenuOption | The Menu Entry List to read the menu entry. |
[in] | MenuNumber | The index of Menu Entry. |
References SECUREBOOT_MENU_ENTRY_SIGNATURE, and UINTN().
Referenced by CreateMenuStringToken(), UpdateFileExplorePage(), and UpdateFileExplorer().
BOOLEAN GrowBuffer | ( | IN OUT EFI_STATUS * | Status, | |
IN OUT VOID ** | Buffer, | |||
IN UINTN | BufferSize | |||
) |
Helper function called as part of the code needed to allocate the proper sized buffer for various EFI interfaces.
[in,out] | Status | Current status |
[in,out] | Buffer | Current allocated buffer, or NULL |
[in] | BufferSize | Current buffer size needed |
TRUE | If the buffer was reallocated and the caller should try the API again. | |
FALSE | The caller should not call this function again. |
References BOOLEAN(), and TRUE.
Referenced by FileInfo(), and FileSystemVolumeLabelInfo().
EFI_STATUS EFIAPI OpenFileByDevicePath | ( | IN OUT EFI_DEVICE_PATH_PROTOCOL ** | FilePath, | |
OUT EFI_FILE_HANDLE * | FileHandle, | |||
IN UINT64 | OpenMode, | |||
IN UINT64 | Attributes | |||
) |
This function will open a file or directory referenced by DevicePath.
This function opens a file with the open mode according to the file path. The Attributes is valid only for EFI_FILE_MODE_CREATE.
[in,out] | FilePath | On input, the device path to the file. On output, the remaining device path. |
[out] | FileHandle | Pointer to the file handle. |
[in] | OpenMode | The mode to open the file with. |
[in] | Attributes | The file's file attributes. |
EFI_SUCCESS | The information was set. | |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. | |
EFI_UNSUPPORTED | Could not open the file path. | |
EFI_NOT_FOUND | The specified file could not be found on the device or the file system could not be found on the device. | |
EFI_NO_MEDIA | The device has no medium. | |
EFI_MEDIA_CHANGED | The device has a different medium in it or the medium is no longer supported. | |
EFI_DEVICE_ERROR | The device reported an error. | |
EFI_VOLUME_CORRUPTED | The file system structures are corrupted. | |
EFI_WRITE_PROTECTED | The file or medium is write protected. | |
EFI_ACCESS_DENIED | The file was opened read only. | |
EFI_OUT_OF_RESOURCES | Not enough resources were available to open the file. | |
EFI_VOLUME_FULL | The volume is full. |
References EFI_STATUS().
Referenced by UpdateFileExplorer().
EFI_FILE_HANDLE OpenRoot | ( | IN EFI_HANDLE | DeviceHandle | ) |
Function opens and returns a file handle to the root directory of a volume.
[in] | DeviceHandle | A handle for a device |
References EFI_STATUS().
Referenced by FindFileSystem().
VOID RefreshUpdateData | ( | VOID | ) |
Refresh the global UpdateData structure.
References mStartLabel, and mStartOpCodeHandle.
Referenced by CleanUpPage(), UpdateFileExplorePage(), and UpdateFileExplorer().
CHAR16* StrDuplicate | ( | IN CHAR16 * | Src | ) |
Duplicate a string.
[in] | Src | The source string. |
References UINTN().
Referenced by FindFiles(), and FindFileSystem().
VOID UpdateFileExplorePage | ( | IN EFI_HII_HANDLE | HiiHandle, | |
IN SECUREBOOT_MENU_OPTION * | MenuOption, | |||
IN FILE_EXPLORER_STATE | FeCurrentState | |||
) |
Update the File Explore page.
[in] | HiiHandle | Hii Handle of the package to be updated. |
[in] | MenuOption | The Menu whose string tokens need to be updated. |
[in] | FeCurrentState | Current file explorer state. |
References SECUREBOOT_MENU_ENTRY::DisplayStringToken, FILE_OPTION_GOTO_OFFSET, FILE_OPTION_OFFSET, SECUREBOOT_MENU_ENTRY::FileContext, FileExplorerStateEnrollKekFile, FileExplorerStateEnrollPkFile, FileExplorerStateEnrollSignatureFileToDb, FileExplorerStateEnrollSignatureFileToDbt, FileExplorerStateEnrollSignatureFileToDbx, FORM_FILE_EXPLORER_ID, FORM_FILE_EXPLORER_ID_DB, FORM_FILE_EXPLORER_ID_DBT, FORM_FILE_EXPLORER_ID_DBX, FORM_FILE_EXPLORER_ID_KEK, FORM_FILE_EXPLORER_ID_PK, FORMID_ENROLL_KEK_FORM, GetMenuEntry(), gSecureBootConfigFormSetGuid, SECUREBOOT_FILE_CONTEXT::IsDir, mEndOpCodeHandle, mStartLabel, mStartOpCodeHandle, RefreshUpdateData(), SECUREBOOT_ADD_PK_FILE_FORM_ID, SECUREBOOT_ENROLL_SIGNATURE_TO_DB, SECUREBOOT_ENROLL_SIGNATURE_TO_DBT, SECUREBOOT_ENROLL_SIGNATURE_TO_DBX, and UINTN().
Referenced by UpdateFileExplorer().
BOOLEAN UpdateFileExplorer | ( | IN SECUREBOOT_CONFIG_PRIVATE_DATA * | PrivateData, | |
IN UINT16 | KeyValue | |||
) |
Update the file explorer page with the refreshed file system.
[in] | PrivateData | Module private data. |
[in] | KeyValue | Key value to identify the type of data to expect. |
TRUE | Inform the caller to create a callback packet to exit file explorer. | |
FALSE | Indicate that there is no need to exit file explorer. |
References BOOLEAN(), CreateMenuStringToken(), DestroyMenuEntry(), SECUREBOOT_FILE_CONTEXT::DevicePath, SECUREBOOT_MENU_ENTRY::DisplayStringToken, EFI_STATUS(), FILE_OPTION_MASK, SECUREBOOT_MENU_ENTRY::FileContext, FileExplorerDisplayDirectory, FileExplorerDisplayFileSystem, FileExplorerDisplayUnknown, FileExplorerStateEnrollKekFile, FileExplorerStateEnrollPkFile, FileExplorerStateEnrollSignatureFileToDb, FileExplorerStateEnrollSignatureFileToDbt, FileExplorerStateEnrollSignatureFileToDbx, SECUREBOOT_FILE_CONTEXT::FileName, FindFiles(), FindFileSystem(), FORMID_ENROLL_KEK_FORM, FreeMenu(), GetMenuEntry(), gSecureBootConfigFormSetGuid, SECUREBOOT_FILE_CONTEXT::IsDir, SECUREBOOT_MENU_ENTRY::Link, mEndOpCodeHandle, mStartLabel, mStartOpCodeHandle, OpenFileByDevicePath(), RefreshUpdateData(), SECUREBOOT_ADD_PK_FILE_FORM_ID, SECUREBOOT_ENROLL_SIGNATURE_TO_DB, SECUREBOOT_ENROLL_SIGNATURE_TO_DBT, SECUREBOOT_ENROLL_SIGNATURE_TO_DBX, TRUE, and UpdateFileExplorePage().
Referenced by SecureBootCallback().
Initial value:
{ SECUREBOOT_MENU_OPTION_SIGNATURE, {NULL}, 0 }
Referenced by InstallSecureBootConfigForm(), SecureBootCallback(), and UninstallSecureBootConfigForm().
Initial value:
{ SECUREBOOT_MENU_OPTION_SIGNATURE, {NULL}, 0 }
Referenced by InstallSecureBootConfigForm(), SecureBootCallback(), and UninstallSecureBootConfigForm().
EFI_IFR_GUID_LABEL* mEndLabel = NULL |
Referenced by InstallSecureBootConfigForm().
VOID* mEndOpCodeHandle = NULL |
EFI_IFR_GUID_LABEL* mStartLabel = NULL |
Referenced by CleanUpPage(), InstallSecureBootConfigForm(), RefreshUpdateData(), UpdateFileExplorePage(), and UpdateFileExplorer().
VOID* mStartOpCodeHandle = NULL |