代码拉取完成,页面将自动刷新
同步操作将从 谭玉刚/ToyBoot 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "Log.h"
EFI_FILE_PROTOCOL *LogFile;
EFI_STATUS LogError(EFI_STATUS Code)
{
EFI_STATUS Status = EFI_SUCCESS;
switch (Code)
{
case EFI_INVALID_PARAMETER:
Status = LogTip("ERROR:EFI_INVALID_PARAMETER.\n");
break;
case EFI_NOT_FOUND:
Status = LogTip("ERROR:EFI_NOT_FOUND.\n");
break;
case EFI_OUT_OF_RESOURCES:
Status = LogTip("ERROR:EFI_OUT_OF_RESOURCES.\n");
break;
default:
Status = LogTip("ERROR:Something must be wrong.\n");
break;
}
return Status;
}
EFI_STATUS LogInitial(EFI_HANDLE ImageHandle)
{
EFI_STATUS Status = EFI_SUCCESS;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem = NULL;
UINTN HandleCount = 0;
EFI_HANDLE *Buffer = NULL;
Status = gBS->LocateHandleBuffer(
ByProtocol,
&gEfiSimpleFileSystemProtocolGuid,
NULL,
&HandleCount,
&Buffer
);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to LocateHanleBuffer of SimpleFileSystemProtocol.\n");
return Status;
}
Print(L"SUCCESS:Get %d handles that supported SimpleFileSystemProtocol.\n", HandleCount);
#endif
Status = gBS->OpenProtocol(
Buffer[0],
&gEfiSimpleFileSystemProtocolGuid,
(VOID **)&FileSystem,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to open first handle that supported SimpleFileSystemProtocol.\n");
return Status;
}
Print(L"SUCCESS:SimpleFileSystemProtocol is opened with first handle.\n");
#endif
EFI_FILE_PROTOCOL *File = NULL;
Status = FileSystem->OpenVolume(
FileSystem,
&File
);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to open volume.\n");
return Status;
}
Print(L"SUCCESS:Volume is opened.\n");
#endif
File->Open(
File,
&LogFile,
L"\\Log.txt",
EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE,
EFI_FILE_ARCHIVE
);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to open file");
return Status;
}
Print(L"SUCCESS:File is opened.\n");
#endif
return Status;
}
EFI_STATUS LogTip(CHAR8 *Message)
{
EFI_STATUS Status = EFI_SUCCESS;
UINTN MsgLen = AsciiStrLen(Message);
Status = LogFile->Write(LogFile, &MsgLen, Message);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to write LogFile.\n");
return Status;
}
#endif
return Status;
}
EFI_STATUS Close()
{
EFI_STATUS Status = EFI_SUCCESS;
Status = LogFile->Close(LogFile);
#ifdef DEBUG
if(EFI_ERROR(Status))
{
Print(L"ERROR:Failed to Close LogFile.\n");
return Status;
}
Print(L"SUCCESS:LogFile is closed.\n");
#endif
return Status;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。