Changeset 98035 in vbox for trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
- Timestamp:
- Jan 10, 2023 6:35:56 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r97367 r98035 141 141 bool fMountOnly; 142 142 Utf8Str strImagePath; 143 bool fAuxiliary; 143 144 144 145 UnattendedInstallationDisk(StorageBus_T a_enmBusType, Utf8Str const &a_rBusName, DeviceType_T a_enmDeviceType, 145 146 AccessMode_T a_enmAccessType, LONG a_iPort, LONG a_iDevice, bool a_fMountOnly, 146 Utf8Str const &a_rImagePath )147 Utf8Str const &a_rImagePath, bool a_fAuxiliary) 147 148 : enmBusType(a_enmBusType), strControllerName(a_rBusName), enmDeviceType(a_enmDeviceType), enmAccessType(a_enmAccessType) 148 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath) 149 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath), fAuxiliary(a_fAuxiliary) 149 150 { 150 151 Assert(strControllerName.length() > 0); 151 152 } 152 153 153 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath) 154 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath, 155 bool a_fAuxiliary) 154 156 : enmBusType(itDvdSlot->enmBus), strControllerName(itDvdSlot->strControllerName), enmDeviceType(DeviceType_DVD) 155 157 , enmAccessType(AccessMode_ReadOnly), iPort(itDvdSlot->iPort), iDevice(itDvdSlot->iDevice) 156 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath) 158 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath), fAuxiliary(a_fAuxiliary) 157 159 { 158 160 Assert(strControllerName.length() > 0); … … 3052 3054 0, 0, 3053 3055 fFoundPort0Dev0 /*fMountOnly*/, 3054 mpInstaller->getAuxiliaryFloppyFilePath() ));3056 mpInstaller->getAuxiliaryFloppyFilePath(), false)); 3055 3057 return S_OK; 3056 3058 } … … 3211 3213 if (mpInstaller->isAuxiliaryIsoNeeded() && mpInstaller->bootFromAuxiliaryIso()) 3212 3214 { 3213 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() ));3215 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath(), true)); 3214 3216 ++itDvdSlot; 3215 3217 } … … 3217 3219 if (mpInstaller->isOriginalIsoNeeded()) 3218 3220 { 3219 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath() ));3221 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath(), false)); 3220 3222 ++itDvdSlot; 3221 3223 } … … 3223 3225 if (mpInstaller->isAuxiliaryIsoNeeded() && !mpInstaller->bootFromAuxiliaryIso()) 3224 3226 { 3225 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() ));3227 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath(), true)); 3226 3228 ++itDvdSlot; 3227 3229 } … … 3230 3232 if (mpInstaller->isAdditionsIsoNeeded()) 3231 3233 { 3232 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath() ));3234 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath(), false)); 3233 3235 ++itDvdSlot; 3234 3236 } … … 3236 3238 if (mpInstaller->isValidationKitIsoNeeded()) 3237 3239 { 3238 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath() ));3240 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath(), false)); 3239 3241 ++itDvdSlot; 3240 3242 } … … 4207 4209 4208 4210 ComPtr<IMedium> ptrMedium; 4209 HRESULT rc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(),4211 HRESULT hrc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(), 4210 4212 pImage->enmDeviceType, 4211 4213 pImage->enmAccessType, 4212 4214 true, 4213 4215 ptrMedium.asOutParam()); 4214 LogRelFlowFunc(("VirtualBox::openMedium -> %Rhrc\n", rc)); 4215 if (SUCCEEDED(rc)) 4216 { 4216 LogRelFlowFunc(("VirtualBox::openMedium -> %Rhrc\n", hrc)); 4217 if (SUCCEEDED(hrc)) 4218 { 4219 if (pImage->fAuxiliary && pImage->strImagePath.endsWith(".viso")) 4220 { 4221 hrc = ptrMedium->SetProperty(Bstr("UnattendedInstall").raw(), Bstr("1").raw()); 4222 LogRelFlowFunc(("Medium::SetProperty -> %Rhrc\n", hrc)); 4223 } 4217 4224 if (pImage->fMountOnly) 4218 4225 { 4219 4226 // mount the opened disk image 4220 rc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort,4221 pImage->iDevice, ptrMedium, TRUE /*fForce*/);4222 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", rc));4227 hrc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4228 pImage->iDevice, ptrMedium, TRUE /*fForce*/); 4229 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", hrc)); 4223 4230 } 4224 4231 else 4225 4232 { 4226 4233 //attach the opened disk image to the controller 4227 rc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort,4228 pImage->iDevice, pImage->enmDeviceType, ptrMedium);4229 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", rc));4234 hrc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4235 pImage->iDevice, pImage->enmDeviceType, ptrMedium); 4236 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", hrc)); 4230 4237 } 4231 4238 } 4232 4239 4233 4240 rLock.acquire(); 4234 return rc;4241 return hrc; 4235 4242 } 4236 4243
Note:
See TracChangeset
for help on using the changeset viewer.