analyze SelfLoadedImage->LoadOptions to extract Default Volume and Default Loader input and output data are global
| 314 | // input and output data are global |
| 315 | // |
| 316 | VOID |
| 317 | GetBootFromOption(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 |