| 189 | } |
| 190 | |
| 191 | VOID ScanLegacy(VOID) |
| 192 | { |
| 193 | UINTN VolumeIndex, VolumeIndex2; |
| 194 | BOOLEAN ShowVolume, HideIfOthersFound; |
| 195 | REFIT_VOLUME *Volume; |
| 196 | |
| 197 | DBG("Scanning legacy ...\n"); |
| 198 | |
| 199 | for (VolumeIndex = 0; VolumeIndex < Volumes.size(); VolumeIndex++) { |
| 200 | Volume = &Volumes[VolumeIndex]; |
| 201 | // DBG("test VI=%d\n", VolumeIndex); |
| 202 | if ((Volume->BootType != BOOTING_BY_PBR) && |
| 203 | (Volume->BootType != BOOTING_BY_MBR) && |
| 204 | (Volume->BootType != BOOTING_BY_CD)) { |
| 205 | // DBG(" not legacy\n"); |
| 206 | continue; |
| 207 | } |
| 208 | |
| 209 | // DBG("%2d: '%ls' (%ls)", VolumeIndex, Volume->VolName, Volume->LegacyOS->IconName); |
| 210 | |
| 211 | #if 0 // REFIT_DEBUG > 0 |
| 212 | DBG(" %d %ls\n %d %d %ls %d %ls\n", |
| 213 | VolumeIndex, FileDevicePathToStr(Volume->DevicePath), |
| 214 | Volume->DiskKind, Volume->MbrPartitionIndex, |
| 215 | Volume->IsAppleLegacy ? L"AL" : L"--", Volume->HasBootCode, |
| 216 | Volume->VolName ? Volume->VolName : L"(no name)"); |
| 217 | #endif |
| 218 | |
| 219 | // skip volume if its kind is configured as disabled |
| 220 | /* if ((Volume->DiskKind == DISK_KIND_OPTICAL && (GlobalConfig.DisableFlags & VOLTYPE_OPTICAL)) || |
| 221 | (Volume->DiskKind == DISK_KIND_EXTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_EXTERNAL)) || |
| 222 | (Volume->DiskKind == DISK_KIND_INTERNAL && (GlobalConfig.DisableFlags & VOLTYPE_INTERNAL)) || |
| 223 | (Volume->DiskKind == DISK_KIND_FIREWIRE && (GlobalConfig.DisableFlags & VOLTYPE_FIREWIRE))) */ |
| 224 | if (((1ull<<Volume->DiskKind) & GlobalConfig.DisableFlags) != 0) |
| 225 | { |
| 226 | // DBG(" hidden\n"); |
| 227 | continue; |
| 228 | } |
| 229 | // DBG("not hidden\n"); |
| 230 | ShowVolume = FALSE; |
| 231 | HideIfOthersFound = FALSE; |
| 232 | if (Volume->IsAppleLegacy) { |
| 233 | ShowVolume = TRUE; |
| 234 | HideIfOthersFound = TRUE; |
| 235 | } else if (Volume->HasBootCode) { |
| 236 | ShowVolume = TRUE; |
| 237 | // DBG("Volume %d will be shown BlockIo=%X WholeIo=%X\n", |
| 238 | // VolumeIndex, Volume->BlockIO, Volume->WholeDiskBlockIO); |
| 239 | if ((Volume->WholeDiskBlockIO == 0) && |
| 240 | Volume->BlockIOOffset == 0 /* && |
| 241 | Volume->OSName == NULL */) |
| 242 | // this is a whole disk (MBR) entry; hide if we have entries for partitions |
| 243 | HideIfOthersFound = TRUE; |
| 244 | // DBG("Hide it!\n"); |
| 245 | } |
| 246 | if (HideIfOthersFound) { |
| 247 | // check for other bootable entries on the same disk |
| 248 | //if PBR exists then Hide MBR |
no test coverage detected