Changeset 37145 in vbox for trunk/src/VBox
- Timestamp:
- May 19, 2011 2:02:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/Library/VBoxGenericBdsLib/BdsBoot.c
r33540 r37145 973 973 } 974 974 975 static BOOLEAN bdsCheckFileName(EFI_IMAGE_OPTIONAL_HEADER_UNION *pHdrData, EFI_HANDLE FileSystemHandle, CHAR16 *pu16FileName, CHAR16 **ppNewFileName) 976 { 977 EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; 978 BOOLEAN fNeedDelete = TRUE; 979 CHAR16 *NewFileName; 980 EFI_STATUS Status; 981 Hdr.Union = pHdrData; 982 EFI_IMAGE_DOS_HEADER DosHeader; 983 Status = BdsLibGetImageHeader ( 984 FileSystemHandle, 985 pu16FileName, 986 &DosHeader, 987 Hdr, 988 &NewFileName 989 ); 990 if (!EFI_ERROR (Status) 991 #ifndef VBOX 992 && EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Hdr.Pe32->FileHeader.Machine) && 993 Hdr.Pe32->OptionalHeader.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 994 #endif 995 ) { 996 fNeedDelete = FALSE; 997 } 998 if (ppNewFileName) 999 *ppNewFileName = NewFileName; 1000 return fNeedDelete; 1001 } 975 1002 976 1003 /** … … 1050 1077 UINTN NumberFileSystemHandles; 1051 1078 BOOLEAN NeedDelete; 1052 EFI_IMAGE_DOS_HEADER DosHeader;1053 1079 EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData; 1054 EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; 1055 CHAR16 *NewFileName; 1080 //EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; 1056 1081 1057 1082 FloppyNumber = 0; … … 1189 1214 // machinename is ia32, ia64, x64, ... 1190 1215 // 1191 Hdr.Union = &HdrData;1216 //Hdr.Union = &HdrData; 1192 1217 NeedDelete = TRUE; 1193 Status = BdsLibGetImageHeader ( 1194 FileSystemHandles[Index], 1195 EFI_REMOVABLE_MEDIA_FILE_NAME, 1196 &DosHeader, 1197 Hdr, 1198 &NewFileName 1199 ); 1200 if (!EFI_ERROR (Status) 1201 #ifndef VBOX 1202 && EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Hdr.Pe32->FileHeader.Machine) && 1203 Hdr.Pe32->OptionalHeader.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 1204 #endif 1205 ) { 1206 NeedDelete = FALSE; 1207 } 1208 Status = BdsLibGetImageHeader ( 1209 FileSystemHandles[Index], 1210 L"\\System\\Library\\CoreServices\\boot.efi", 1211 &DosHeader, 1212 Hdr, 1213 &NewFileName 1214 ); 1215 /* Here should be Mac Specific checks */ 1216 if (!EFI_ERROR (Status)) { 1217 NeedDelete = FALSE; 1218 } 1219 1218 NeedDelete = bdsCheckFileName(&HdrData, FileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME, NULL); 1219 if (NeedDelete) 1220 NeedDelete = bdsCheckFileName(&HdrData, FileSystemHandles[Index], L"\\System\\Library\\CoreServices\\boot.efi", NULL); 1221 if (NeedDelete) 1222 NeedDelete = bdsCheckFileName(&HdrData, FileSystemHandles[Index], L"\\Mac OS X Install Data\\boot.efi", NULL); 1220 1223 if (NeedDelete) { 1221 1224 // … … 1455 1458 UINTN NumberSimpleFileSystemHandles; 1456 1459 UINTN Index; 1457 EFI_IMAGE_DOS_HEADER DosHeader;1460 //EFI_IMAGE_DOS_HEADER DosHeader; 1458 1461 EFI_IMAGE_OPTIONAL_HEADER_UNION HdrData; 1459 EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr;1462 //EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr; 1460 1463 1461 1464 UpdatedDevicePath = DevicePath; … … 1557 1560 // machinename is ia32, ia64, x64, ... 1558 1561 // 1559 Hdr.Union = &HdrData; 1560 Status = BdsLibGetImageHeader ( 1561 SimpleFileSystemHandles[Index], 1562 EFI_REMOVABLE_MEDIA_FILE_NAME, 1563 &DosHeader, 1564 Hdr, 1565 NewFileName 1566 ); 1567 if (!EFI_ERROR (Status) 1568 #ifndef VBOX 1569 && EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Hdr.Pe32->FileHeader.Machine) && 1570 Hdr.Pe32->OptionalHeader.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 1571 #endif 1572 ) { 1573 ReturnHandle = SimpleFileSystemHandles[Index]; 1574 break; 1575 } 1576 Status = BdsLibGetImageHeader ( 1577 SimpleFileSystemHandles[Index], 1578 L"\\System\\Library\\CoreServices\\boot.efi", 1579 &DosHeader, 1580 Hdr, 1581 NewFileName 1582 ); 1583 /* Here should be Mac Specific checks */ 1584 if (!EFI_ERROR (Status) 1585 #ifndef VBOX 1586 && EFI_IMAGE_MACHINE_TYPE_SUPPORTED (Hdr.Pe32->FileHeader.Machine) && 1587 Hdr.Pe32->OptionalHeader.Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 1588 #endif 1589 ) { 1590 DEBUG((DEBUG_INFO, "%a:%d clear the timer \n", __FILE__, __LINE__)); 1591 ReturnHandle = SimpleFileSystemHandles[Index]; 1592 break; 1562 BOOLEAN fNotFound = bdsCheckFileName(&HdrData, SimpleFileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME, NewFileName); 1563 if (fNotFound) 1564 fNotFound = bdsCheckFileName(&HdrData, SimpleFileSystemHandles[Index], L"\\System\\Library\\CoreServices\\boot.efi", NewFileName); 1565 if (fNotFound) 1566 fNotFound = bdsCheckFileName(&HdrData, SimpleFileSystemHandles[Index], L"\\Mac OS X Install Data\\boot.efi", NewFileName); 1567 if (!fNotFound) 1568 { 1569 ReturnHandle = SimpleFileSystemHandles[Index]; 1570 break; 1593 1571 } 1594 1572 }
Note:
See TracChangeset
for help on using the changeset viewer.