USe .VolumeLabel.txt for bottom right message.

This commit is contained in:
jief 2020-01-15 10:58:18 +03:00
parent 3f3b85da08
commit 718c915f1f
4 changed files with 27 additions and 17 deletions

View File

@ -648,19 +648,11 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
if (FullTitle) {
Entry->me.Title = EfiStrDuplicate(FullTitle);
}
if ( Entry->me.Title == NULL && FileExists(Volume->RootDir, L"\\.VolumeLabel.txt") ) {
EFI_STATUS Status;
EFI_FILE_HANDLE FileHandle;
Status = Volume->RootDir->Open(Volume->RootDir, &FileHandle, L"\\.VolumeLabel.txt", EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR(Status)) {
CHAR8 Buffer[32+1];
UINTN BufferSize = sizeof(Buffer)-sizeof(CHAR8);
SetMem(Buffer, BufferSize+sizeof(CHAR8), 0);
Status = FileHandle->Read(FileHandle, &BufferSize, Buffer);
FileHandle->Close(FileHandle);
if (!EFI_ERROR(Status)) {
Entry->me.Title = PoolPrint(L"Boot %s from %a", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Buffer);
}
if ( Entry->me.Title == NULL && Volume->VolLabel != NULL ) {
if ( Volume->VolLabel[0] == L'#' ) {
Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel+1);
}else{
Entry->me.Title = PoolPrint(L"Boot %s from %s", (LoaderTitle != NULL) ? LoaderTitle : Basename(LoaderPath), Volume->VolLabel);
}
}

View File

@ -963,6 +963,22 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
return EFI_SUCCESS;
}
if ( FileExists(Volume->RootDir, L"\\.VolumeLabel.txt") ) {
EFI_STATUS Status;
EFI_FILE_HANDLE FileHandle;
Status = Volume->RootDir->Open(Volume->RootDir, &FileHandle, L"\\.VolumeLabel.txt", EFI_FILE_MODE_READ, 0);
if (!EFI_ERROR(Status)) {
CHAR8 Buffer[32+1];
UINTN BufferSize = sizeof(Buffer)-sizeof(CHAR8);
SetMem(Buffer, BufferSize+sizeof(CHAR8), 0);
Status = FileHandle->Read(FileHandle, &BufferSize, Buffer);
FileHandle->Close(FileHandle);
if (!EFI_ERROR(Status)) {
Volume->VolLabel = PoolPrint(L"%a", Buffer);
}
}
}
// get volume name
if (!Volume->VolName) {
FileSystemInfoPtr = EfiLibFileSystemInfo(Volume->RootDir);

View File

@ -224,6 +224,7 @@ typedef struct {
EFI_FILE *RootDir;
CHAR16 *DevicePathString;
CHAR16 *VolName;
CHAR16 *VolLabel;
UINT8 DiskKind;
LEGACY_OS *LegacyOS;
BOOLEAN Hidden;

View File

@ -3926,9 +3926,10 @@ VOID DrawTextCorner(UINTN TextC, UINT8 Align)
switch (TextC) {
case TEXT_CORNER_REVISION:
// Display Clover boot volume
if (SelfVolume->VolName[0] != L'#') {
Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolName);
}else{
if (SelfVolume->VolLabel && SelfVolume->VolLabel[0] != L'#') {
Text = PoolPrint(L"%s, booted from %s", gFirmwareRevision, SelfVolume->VolLabel);
}
if ( !Text ) {
Text = PoolPrint(L"%s", gFirmwareRevision, SelfVolume->VolName);
}
break;