Get the UUID of the AppleRaid or CoreStorage volume from the boot helper partition
| 6425 | |
| 6426 | //Get the UUID of the AppleRaid or CoreStorage volume from the boot helper partition |
| 6427 | EFI_STATUS |
| 6428 | GetRootUUID (IN REFIT_VOLUME *Volume) |
| 6429 | { |
| 6430 | EFI_STATUS Status; |
| 6431 | CHAR8 *PlistBuffer; |
| 6432 | UINTN PlistLen; |
| 6433 | TagDict* Dict; |
| 6434 | const TagStruct* Prop; |
| 6435 | |
| 6436 | CONST CHAR16* SystemPlistR; |
| 6437 | CONST CHAR16* SystemPlistP; |
| 6438 | CONST CHAR16* SystemPlistS; |
| 6439 | |
| 6440 | BOOLEAN HasRock; |
| 6441 | BOOLEAN HasPaper; |
| 6442 | BOOLEAN HasScissors; |
| 6443 | |
| 6444 | Status = EFI_NOT_FOUND; |
| 6445 | if (Volume == NULL) { |
| 6446 | return EFI_NOT_FOUND; |
| 6447 | } |
| 6448 | |
| 6449 | SystemPlistR = L"\\com.apple.boot.R\\Library\\Preferences\\SystemConfiguration\\com.apple.Boot.plist"; |
| 6450 | if (FileExists (Volume->RootDir, SystemPlistR)) { |
| 6451 | HasRock = FileExists (Volume->RootDir, SystemPlistR); |
| 6452 | } else { |
| 6453 | SystemPlistR = L"\\com.apple.boot.R\\com.apple.Boot.plist"; |
| 6454 | HasRock = FileExists (Volume->RootDir, SystemPlistR); |
| 6455 | } |
| 6456 | |
| 6457 | SystemPlistP = L"\\com.apple.boot.P\\Library\\Preferences\\SystemConfiguration\\com.apple.Boot.plist"; |
| 6458 | if (FileExists (Volume->RootDir, SystemPlistP)) { |
| 6459 | HasPaper = FileExists (Volume->RootDir, SystemPlistP); |
| 6460 | } else { |
| 6461 | SystemPlistP = L"\\com.apple.boot.P\\com.apple.Boot.plist"; |
| 6462 | HasPaper = FileExists (Volume->RootDir, SystemPlistP); |
| 6463 | } |
| 6464 | |
| 6465 | SystemPlistS = L"\\com.apple.boot.S\\Library\\Preferences\\SystemConfiguration\\com.apple.Boot.plist"; |
| 6466 | if (FileExists (Volume->RootDir, SystemPlistS)) { |
| 6467 | HasScissors = FileExists (Volume->RootDir, SystemPlistS); |
| 6468 | } else { |
| 6469 | SystemPlistS = L"\\com.apple.boot.S\\com.apple.Boot.plist"; |
| 6470 | HasScissors = FileExists (Volume->RootDir, SystemPlistS); |
| 6471 | } |
| 6472 | |
| 6473 | PlistBuffer = NULL; |
| 6474 | // Playing Rock, Paper, Scissors to chose which settings to load. |
| 6475 | if (HasRock && HasPaper && HasScissors) { |
| 6476 | // Rock wins when all three are around |
| 6477 | Status = egLoadFile(Volume->RootDir, SystemPlistR, (UINT8 **)&PlistBuffer, &PlistLen); |
| 6478 | } else if (HasRock && HasPaper) { |
| 6479 | // Paper beats rock |
| 6480 | Status = egLoadFile(Volume->RootDir, SystemPlistP, (UINT8 **)&PlistBuffer, &PlistLen); |
| 6481 | } else if (HasRock && HasScissors) { |
| 6482 | // Rock beats scissors |
| 6483 | Status = egLoadFile(Volume->RootDir, SystemPlistR, (UINT8 **)&PlistBuffer, &PlistLen); |
| 6484 | } else if (HasPaper && HasScissors) { |
no test coverage detected