MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / GetBootFromOption

Function GetBootFromOption

rEFIt_UEFI/Platform/Settings.cpp:316–338  ·  view source on GitHub ↗

analyze SelfLoadedImage->LoadOptions to extract Default Volume and Default Loader input and output data are global

Source from the content-addressed store, hash-verified

314// input and output data are global
315//
316VOID
317GetBootFromOption(VOID)
318{
319 UINT8 *Data = (UINT8*)SelfLoadedImage->LoadOptions;
320 UINTN Len = SelfLoadedImage->LoadOptionsSize;
321 UINTN NameSize, Name2Size;
322
323 Data += 4; //skip signature as we already here
324 NameSize = *(UINT16*)Data;
325
326 Data += 2; // pointer to Volume name
327 gSettings.DefaultVolume.strncpy((__typeof__(gSettings.DefaultVolume.wc_str()))Data, NameSize);
328
329 Data += NameSize;
330 Name2Size = Len - NameSize;
331 if (Name2Size != 0) {
332 gSettings.DefaultLoader.strncpy((__typeof__(gSettings.DefaultVolume.wc_str()))Data, NameSize);
333 }
334
335 DBG("Clover started with option to boot %ls from %ls\n",
336 gSettings.DefaultLoader.notEmpty() ? gSettings.DefaultLoader.wc_str() : L"legacy",
337 gSettings.DefaultVolume.wc_str());
338}
339
340//
341// check if this entry corresponds to Boot# variable and then set BootCurrent

Callers 1

RefitMainFunction · 0.85

Calls 3

strncpyMethod · 0.80
wc_strMethod · 0.45
notEmptyMethod · 0.45

Tested by

no test coverage detected