repaired boot-args

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-04-11 20:55:47 +03:00
parent 3433041756
commit 3796920a60
3 changed files with 14 additions and 11 deletions

View File

@ -163,17 +163,19 @@ const XImage& ScanVolumeDefaultIcon(REFIT_VOLUME *Volume, IN UINT8 OSType, IN EF
XString AddLoadOption(IN CONST XString& LoadOptions, IN CONST XString& LoadOption) XString AddLoadOption(IN CONST XString& LoadOptions, IN CONST XString& LoadOption)
{ {
// LoadOptions assumed out
// If either option strings are null nothing to do // If either option strings are null nothing to do
if (LoadOptions.isEmpty()) if (LoadOption.isEmpty()) //nothing to add
{ {
// return LoadOption as nothing to add // return LoadOption as nothing to add
return LoadOption; return LoadOptions;
} }
// If there is no option or it is already present duplicate original // If there is no option or it is already present duplicate original
else { else {
if ( LoadOptions.ExistIn(LoadOption) ) return LoadOptions; if ( LoadOptions.ExistIn(LoadOption) ) return LoadOptions; //good
// Otherwise add option // Otherwise add option
return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption // return SPrintf("%s %s", LoadOptions.c_str(), LoadOption.c_str()); //LoadOptions + LoadOption
return LoadOptions + LoadOption; //why not?
} }
} }

View File

@ -1593,7 +1593,6 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
continue; continue;
} }
if (Volume->Hidden) { if (Volume->Hidden) {
DBG("skipped because volume is hidden\n"); DBG("skipped because volume is hidden\n");
continue; continue;

View File

@ -191,9 +191,9 @@ static EFI_STATUS StartEFILoadedImage(IN EFI_HANDLE ChildImageHandle,
IN CONST CHAR16 *ImageTitle, IN CONST CHAR16 *ImageTitle,
OUT UINTN *ErrorInStep) OUT UINTN *ErrorInStep)
{ {
EFI_STATUS Status, ReturnStatus; EFI_STATUS Status, ReturnStatus;
EFI_LOADED_IMAGE *ChildLoadedImage; EFI_LOADED_IMAGE_PROTOCOL *ChildLoadedImage;
CHAR16 ErrorInfo[256]; CHAR16 ErrorInfo[256];
// CHAR16 *FullLoadOptions = NULL; // CHAR16 *FullLoadOptions = NULL;
// DBG("Starting %ls\n", ImageTitle); // DBG("Starting %ls\n", ImageTitle);
@ -221,13 +221,15 @@ static EFI_STATUS StartEFILoadedImage(IN EFI_HANDLE ChildImageHandle,
// when passing options to Apple's boot.efi... // when passing options to Apple's boot.efi...
loadOptionsW = SWPrintf("%ls %s ", LoadOptionsPrefix, LoadOptions.c_str()); loadOptionsW = SWPrintf("%ls %s ", LoadOptionsPrefix, LoadOptions.c_str());
}else{ }else{
loadOptionsW = SWPrintf("%s", LoadOptions.c_str()); // Jief : should we add a space ? Wasn't the case before big refactoring loadOptionsW = SWPrintf("%s ", LoadOptions.c_str()); // Jief : should we add a space ? Wasn't the case before big refactoring. Yes, a space required.
} }
// NOTE: We also include the terminating null in the length for safety. // NOTE: We also include the terminating null in the length for safety.
ChildLoadedImage->LoadOptions = (void*)loadOptionsW.wc_str(); ChildLoadedImage->LoadOptions = (void*)EfiStrDuplicate(loadOptionsW.wc_str()); //will it be deleted after the procedure exit?
ChildLoadedImage->LoadOptionsSize = (UINT32)loadOptionsW.sizeInBytes() + sizeof(wchar_t); ChildLoadedImage->LoadOptionsSize = (UINT32)loadOptionsW.sizeInBytes() + sizeof(wchar_t);
//((UINT32)StrLen(LoadOptions) + 1) * sizeof(CHAR16); //((UINT32)StrLen(LoadOptions) + 1) * sizeof(CHAR16);
// DBG("Using load options '%ls'\n", LoadOptions); DBG("start image '%ls'\n", ImageTitle);
DBG("Using load options '%ls'\n", (CHAR16*)ChildLoadedImage->LoadOptions);
} }
//DBG("Image loaded at: %p\n", ChildLoadedImage->ImageBase); //DBG("Image loaded at: %p\n", ChildLoadedImage->ImageBase);
//PauseForKey(L"continue"); //PauseForKey(L"continue");