Changeset 24603 in vbox
- Timestamp:
- Nov 12, 2009 6:39:20 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Main/ConsoleImpl2.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r24583 r24603 45 45 # include <iprt/env.h> 46 46 #endif 47 #include <iprt/file.h> 47 48 48 49 #include <VBox/vmapi.h> … … 63 64 #include <VBox/intnet.h> 64 65 66 #include <VBox/com/com.h> 65 67 #include <VBox/com/string.h> 66 68 #include <VBox/com/array.h> … … 130 132 # pragma optimize("g", off) 131 133 #endif 134 135 static int findEfiRom(FirmwareType_T aFirmwareType, Utf8Str& aEfiRomFile) 136 { 137 /** @todo: combine with similar table in VirtualBox::CheckFirmwarePresent */ 138 static const struct { 139 FirmwareType_T type; 140 const char* fileName; 141 } firmwareDesc[] = { 142 { 143 /* compiled-in firmware */ 144 FirmwareType_BIOS, NULL, 145 }, 146 { 147 FirmwareType_EFI, "vboxefi.fv" 148 }, 149 { 150 FirmwareType_EFI64, "vboxefi64.fv" 151 }, 152 { 153 FirmwareType_EFIDUAL, "vboxefidual.fv" 154 } 155 }; 156 157 158 for (size_t i = 0; i < sizeof(firmwareDesc) / sizeof(firmwareDesc[0]); i++) 159 { 160 if (aFirmwareType != firmwareDesc[i].type) 161 continue; 162 163 AssertRCReturn(firmwareDesc[i].fileName != NULL, E_INVALIDARG); 164 165 /* Search in ~/.VirtualBox/Firmware and RTPathAppPrivateArch() */ 166 char pszVBoxPath[RTPATH_MAX]; 167 int rc; 168 169 rc = com::GetVBoxUserHomeDirectory(pszVBoxPath, sizeof(pszVBoxPath)); AssertRCReturn(rc, rc); 170 aEfiRomFile = Utf8StrFmt("%s%cFirmware%c%s", 171 pszVBoxPath, 172 RTPATH_DELIMITER, 173 RTPATH_DELIMITER, 174 firmwareDesc[i].fileName); 175 if (RTFileExists(aEfiRomFile.raw())) 176 return S_OK; 177 178 rc = RTPathExecDir(pszVBoxPath, RTPATH_MAX); AssertRCReturn(rc, rc); 179 aEfiRomFile = Utf8StrFmt("%s%c%s", 180 pszVBoxPath, 181 RTPATH_DELIMITER, 182 firmwareDesc[i].fileName); 183 184 if (RTFileExists(aEfiRomFile.raw())) 185 return S_OK; 186 187 aEfiRomFile = ""; 188 return VERR_FILE_NOT_FOUND; 189 } 190 191 return E_INVALIDARG; 192 } 132 193 133 194 /** … … 695 756 * Firmware. 696 757 */ 758 FirmwareType_T eFwType = FirmwareType_BIOS; 759 hrc = pMachine->COMGETTER(FirmwareType)(&eFwType); H(); 760 697 761 #ifdef VBOX_WITH_EFI 698 Bstr tmpStr1; 699 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/UseEFI"), tmpStr1.asOutParam()); H(); 700 BOOL fEfiEnabled = !tmpStr1.isEmpty(); 701 702 /** 703 * @todo: VBoxInternal2/UseEFI extradata will go away soon, and we'll 704 * just use this code 705 */ 706 if (!fEfiEnabled) 707 { 708 FirmwareType_T eType = FirmwareType_BIOS; 709 hrc = pMachine->COMGETTER(FirmwareType)(&eType); H(); 710 fEfiEnabled = (eType == FirmwareType_EFI); 711 } 762 BOOL fEfiEnabled = (eFwType >= FirmwareType_EFI) && (eFwType <= FirmwareType_EFIDUAL); 712 763 #else 713 764 BOOL fEfiEnabled = false; … … 774 825 else 775 826 { 827 Utf8Str efiRomFile; 828 829 rc = findEfiRom(eFwType, efiRomFile); RC_CHECK(); 776 830 /* 777 831 * EFI. … … 784 838 rc = CFGMR3InsertInteger(pCfg, "RamHoleSize", cbRamHole); RC_CHECK(); 785 839 rc = CFGMR3InsertInteger(pCfg, "NumCPUs", cCpus); RC_CHECK(); 840 rc = CFGMR3InsertString(pCfg, "EfiRom", efiRomFile.raw()); RC_CHECK(); 786 841 } 787 842
Note:
See TracChangeset
for help on using the changeset viewer.

