- Timestamp:
- Jan 24, 2023 3:32:43 PM (21 months ago)
- Location:
- trunk
- Files:
-
- 43 edited
-
include/VBox/com/MultiResult.h (modified) (1 diff)
-
src/VBox/Main/include/ApplianceImplPrivate.h (modified) (9 diffs)
-
src/VBox/Main/include/MachineImpl.h (modified) (1 diff)
-
src/VBox/Main/src-server/ApplianceImpl.cpp (modified) (21 diffs)
-
src/VBox/Main/src-server/ApplianceImplExport.cpp (modified) (39 diffs)
-
src/VBox/Main/src-server/ApplianceImplImport.cpp (modified) (73 diffs)
-
src/VBox/Main/src-server/AudioAdapterImpl.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/AudioSettingsImpl.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/BandwidthControlImpl.cpp (modified) (4 diffs)
-
src/VBox/Main/src-server/CertificateImpl.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/ClientToken.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/ClientWatcher.cpp (modified) (7 diffs)
-
src/VBox/Main/src-server/CloudNetworkImpl.cpp (modified) (5 diffs)
-
src/VBox/Main/src-server/DHCPConfigImpl.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/HostDnsService.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/HostDnsServiceResolvConf.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/HostImpl.cpp (modified) (54 diffs)
-
src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp (modified) (9 diffs)
-
src/VBox/Main/src-server/HostOnlyNetworkImpl.cpp (modified) (6 diffs)
-
src/VBox/Main/src-server/HostPower.cpp (modified) (6 diffs)
-
src/VBox/Main/src-server/HostUSBDeviceImpl.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp (modified) (3 diffs)
-
src/VBox/Main/src-server/MachineImpl.cpp (modified) (372 diffs)
-
src/VBox/Main/src-server/MachineImplCloneVM.cpp (modified) (60 diffs)
-
src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp (modified) (1 diff)
-
src/VBox/Main/src-server/darwin/NetIf-darwin.cpp (modified) (9 diffs)
-
src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp (modified) (6 diffs)
-
src/VBox/Main/src-server/darwin/iokit.cpp (modified) (7 diffs)
-
src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp (modified) (12 diffs)
-
src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp (modified) (8 diffs)
-
src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/freebsd/USBProxyBackendFreeBSD.cpp (modified) (5 diffs)
-
src/VBox/Main/src-server/generic/AutostartDb-generic.cpp (modified) (10 diffs)
-
src/VBox/Main/src-server/generic/NetIf-generic.cpp (modified) (6 diffs)
-
src/VBox/Main/src-server/generic/USBProxyBackendUsbIp.cpp (modified) (34 diffs)
-
src/VBox/Main/src-server/linux/HostDnsServiceLinux.cpp (modified) (5 diffs)
-
src/VBox/Main/src-server/linux/HostHardwareLinux.cpp (modified) (25 diffs)
-
src/VBox/Main/src-server/linux/HostPowerLinux.cpp (modified) (2 diffs)
-
src/VBox/Main/src-server/linux/NetIf-linux.cpp (modified) (4 diffs)
-
src/VBox/Main/src-server/linux/PerformanceLinux.cpp (modified) (17 diffs)
-
src/VBox/Main/src-server/linux/USBGetDevices.cpp (modified) (41 diffs)
-
src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/MultiResult.h
r98103 r98288 188 188 * @copydoc FWResult::FWResult() 189 189 */ 190 MultiResult (HRESULT aRC = E_FAIL) : FWResult (aRC) { incCounter(); }191 192 MultiResult (const MultiResult &aThat) : FWResult (aThat)190 MultiResult(HRESULT aRC = E_FAIL) : FWResult (aRC) { incCounter(); } 191 192 MultiResult(const MultiResult &aThat) : FWResult (aThat) 193 193 { 194 194 /* We need this copy constructor only for GCC that wants to have -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r98103 r98288 306 306 LocationInfo aLocInfo, 307 307 ComObjPtr<Progress> &aProgress) 308 : ThreadTask("TaskOVF") ,309 pAppliance(aThat),310 taskType(aType),311 locInfo(aLocInfo),312 pProgress(aProgress),313 enFormat(ovf::OVFVersion_unknown),314 rc(S_OK)308 : ThreadTask("TaskOVF") 309 , pAppliance(aThat) 310 , taskType(aType) 311 , locInfo(aLocInfo) 312 , pProgress(aProgress) 313 , enFormat(ovf::OVFVersion_unknown) 314 , hrc(S_OK) 315 315 { 316 316 switch (taskType) … … 332 332 ovf::OVFVersion_T enFormat; 333 333 334 HRESULT rc;334 HRESULT hrc; 335 335 336 336 void handler() … … 352 352 LocationInfo aLocInfo, 353 353 ComObjPtr<Progress> &aProgress) 354 : ThreadTask("TaskOPC") ,355 pAppliance(aThat),356 taskType(aType),357 locInfo(aLocInfo),358 pProgress(aProgress),359 rc(S_OK)354 : ThreadTask("TaskOPC") 355 , pAppliance(aThat) 356 , taskType(aType) 357 , locInfo(aLocInfo) 358 , pProgress(aProgress) 359 , hrc(S_OK) 360 360 { 361 361 m_strTaskName = "OPCExpt"; … … 373 373 ComObjPtr<Progress> pProgress; 374 374 375 HRESULT rc;375 HRESULT hrc; 376 376 377 377 void handler() … … 393 393 394 394 TaskCloud(Appliance *aThat, 395 TaskType aType,396 LocationInfo aLocInfo,397 ComObjPtr<Progress> &aProgress)398 : ThreadTask("TaskCloud") ,399 pAppliance(aThat),400 taskType(aType),401 locInfo(aLocInfo),402 pProgress(aProgress),403 rc(S_OK)395 TaskType aType, 396 LocationInfo aLocInfo, 397 ComObjPtr<Progress> &aProgress) 398 : ThreadTask("TaskCloud") 399 , pAppliance(aThat) 400 , taskType(aType) 401 , locInfo(aLocInfo) 402 , pProgress(aProgress) 403 , hrc(S_OK) 404 404 { 405 405 switch (taskType) … … 423 423 ComObjPtr<Progress> pProgress; 424 424 425 HRESULT rc;425 HRESULT hrc; 426 426 427 427 void handler() … … 486 486 // and will be cleaned up on errors 487 487 std::list<MyHardDiskAttachment> llHardDiskAttachments; // disks that were attached 488 std::map<Utf8Str , Utf8Str>mapNewUUIDsToOriginalUUIDs;488 std::map<Utf8Str, Utf8Str> mapNewUUIDsToOriginalUUIDs; 489 489 490 490 ImportStack(const LocationInfo &aLocInfo, … … 533 533 534 534 HRESULT restoreOriginalUUIDOfAttachedDevice(settings::MachineConfigFile *config); 535 HRESULT saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device, 536 const Utf8Str &newlyUuid); 535 HRESULT saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device, const Utf8Str &newlyUuid); 537 536 RTVFSIOSTREAM claimOvaLookAHead(void); 538 539 537 }; 540 538 … … 547 545 struct VirtualSystemDescription::Data 548 546 { 549 std::vector<VirtualSystemDescriptionEntry> 550 maDescriptions; // item descriptions 551 552 ComPtr<Machine> pMachine; // VirtualBox machine this description was exported from (export only) 553 554 settings::MachineConfigFile 555 *pConfig; // machine config created from <vbox:Machine> element if found (import only) 547 /** item descriptions */ 548 std::vector<VirtualSystemDescriptionEntry> maDescriptions; 549 550 /** VirtualBox machine this description was exported from (export only) */ 551 ComPtr<Machine> pMachine; 552 553 /** machine config created from <vbox:Machine> element if found (import only) */ 554 settings::MachineConfigFile *pConfig; 556 555 }; 557 556 -
trunk/src/VBox/Main/include/MachineImpl.h
r98103 r98288 604 604 HRESULT i_getDirectControl(ComPtr<IInternalSessionControl> *directControl) 605 605 { 606 HRESULT rc;607 606 *directControl = mData->mSession.mDirectControl; 608 607 608 HRESULT hrc; 609 609 if (!*directControl) 610 rc = E_ACCESSDENIED;610 hrc = E_ACCESSDENIED; 611 611 else 612 rc = S_OK;613 614 return rc;612 hrc = S_OK; 613 614 return hrc; 615 615 } 616 616 -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r98103 r98288 546 546 HRESULT Appliance::init(VirtualBox *aVirtualBox) 547 547 { 548 HRESULT rc = S_OK;549 548 /* Enclose the state transition NotReady->InInit->Ready */ 550 549 AutoInitSpan autoInitSpan(this); … … 559 558 AssertReturn(m->m_pSecretKeyStore, E_FAIL); 560 559 561 rc = i_initBackendNames();560 HRESULT hrc = i_initBackendNames(); 562 561 563 562 /* Confirm a successful initialization */ 564 563 autoInitSpan.setSucceeded(); 565 564 566 return rc;565 return hrc; 567 566 } 568 567 … … 703 702 704 703 ComObjPtr<VFSExplorer> explorer; 705 HRESULT rc = S_OK;704 HRESULT hrc; 706 705 try 707 706 { … … 712 711 /* Create the explorer object */ 713 712 explorer.createObject(); 714 rc = explorer->init(li.storageType, li.strPath, li.strHostname, li.strUsername, li.strPassword, mVirtualBox);713 hrc = explorer->init(li.storageType, li.strPath, li.strHostname, li.strUsername, li.strPassword, mVirtualBox); 715 714 } 716 715 catch (HRESULT aRC) 717 716 { 718 rc = aRC;719 } 720 721 if (SUCCEEDED( rc))717 hrc = aRC; 718 } 719 720 if (SUCCEEDED(hrc)) 722 721 /* Return explorer to the caller */ 723 722 explorer.queryInterfaceTo(aExplorer.asOutParam()); 724 723 725 return rc;724 return hrc; 726 725 } 727 726 … … 738 737 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 739 738 740 HRESULT rc = S_OK;739 HRESULT hrc = S_OK; 741 740 uint32_t lQuantity = aRequested; 742 741 uint32_t i=0; … … 749 748 { 750 749 ComObjPtr<VirtualSystemDescription> opVSD; 751 rc = opVSD.createObject();752 if (SUCCEEDED( rc))750 hrc = opVSD.createObject(); 751 if (SUCCEEDED(hrc)) 753 752 { 754 rc = opVSD->init();755 if (SUCCEEDED( rc))753 hrc = opVSD->init(); 754 if (SUCCEEDED(hrc)) 756 755 m->virtualSystemDescriptions.push_back(opVSD); 757 756 else … … 777 776 break; 778 777 } 779 rc = aRC;780 } 781 782 return rc;778 hrc = aRC; 779 } 780 781 return hrc; 783 782 } 784 783 … … 837 836 { 838 837 SecretKey *pKey = NULL; 839 int rc = m->m_pSecretKeyStore->retainSecretKey(aIdentifiers[i], &pKey);840 if ( rc != VERR_NOT_FOUND)838 int vrc = m->m_pSecretKeyStore->retainSecretKey(aIdentifiers[i], &pKey); 839 if (vrc != VERR_NOT_FOUND) 841 840 { 842 841 AssertPtr(pKey); … … 852 851 const uint8_t *pbKey = (const uint8_t *)aPasswords[i].c_str(); 853 852 854 int rc = m->m_pSecretKeyStore->addSecretKey(aIdentifiers[i], pbKey, cbKey);855 if (RT_SUCCESS( rc))853 int vrc = m->m_pSecretKeyStore->addSecretKey(aIdentifiers[i], pbKey, cbKey); 854 if (RT_SUCCESS(vrc)) 856 855 m->m_cPwProvided++; 857 else if ( rc == VERR_NO_MEMORY)856 else if (vrc == VERR_NO_MEMORY) 858 857 hrc = setError(E_OUTOFMEMORY, tr("Failed to allocate enough secure memory for the key")); 859 858 else 860 hrc = setError (E_FAIL, tr("Unknown error happened while adding a password (%Rrc)"),rc);859 hrc = setErrorBoth(E_FAIL, vrc, tr("Unknown error happened while adding a password (%Rrc)"), vrc); 861 860 } 862 861 … … 947 946 HRESULT Appliance::i_findMediumFormatFromDiskImage(const ovf::DiskImage &di, ComObjPtr<MediumFormat>& mf) 948 947 { 949 HRESULT rc = S_OK;948 HRESULT hrc = S_OK; 950 949 951 950 /* Get the system properties. */ … … 977 976 { 978 977 mf.setNull(); 979 rc = setError(E_FAIL, 980 tr("Internal inconsistency looking up medium format for the disk image '%s'"), 981 di.strHref.c_str()); 982 return rc; 978 hrc = setError(E_FAIL, tr("Internal inconsistency looking up medium format for the disk image '%s'"), 979 di.strHref.c_str()); 980 return hrc; 983 981 } 984 982 } … … 998 996 999 997 if (mf.isNull()) 1000 rc = setError(E_FAIL, tr("Internal inconsistency looking up medium format for the disk image '%s'"), 1001 di.strHref.c_str()); 1002 1003 return rc; 998 hrc = setError(E_FAIL, tr("Internal inconsistency looking up medium format for the disk image '%s'"), di.strHref.c_str()); 999 1000 return hrc; 1004 1001 } 1005 1002 … … 1037 1034 return hVfsIosPt; 1038 1035 1039 setErrorVrc(vrc, tr("RTManifestEntryAddPassthruIoStream failed with rc=%Rrc"), vrc);1036 setErrorVrc(vrc, tr("RTManifestEntryAddPassthruIoStream failed with vrc=%Rrc"), vrc); 1040 1037 return NIL_RTVFSIOSTREAM; 1041 1038 } … … 1093 1090 { 1094 1091 /* Complete the path (could be relative to machine folder). */ 1095 int rc = RTPathAbsExCxx(strAbsName, aMachineFolder, aName);1096 AssertRCReturn( rc, Global::vboxStatusCodeToCOM(rc)); /** @todo stupid caller ignores this */1092 int vrc = RTPathAbsExCxx(strAbsName, aMachineFolder, aName); 1093 AssertRCReturn(vrc, Global::vboxStatusCodeToCOM(vrc)); /** @todo stupid caller ignores this */ 1097 1094 1098 1095 /* Check that the file does not exist and that there is no media somehow matching the name. */ … … 1127 1124 SetUpProgressMode mode) 1128 1125 { 1129 HRESULT rc;1126 HRESULT hrc; 1130 1127 1131 1128 /* Create the progress object */ 1132 1129 try 1133 1130 { 1134 rc = pProgress.createObject();1135 if (FAILED( rc))1136 return rc;1131 hrc = pProgress.createObject(); 1132 if (FAILED(hrc)) 1133 return hrc; 1137 1134 } 1138 1135 catch (std::bad_alloc &) … … 1335 1332 pAppliance->m->resetReadData(); 1336 1333 if (pTask->locInfo.storageType == VFSType_File) 1337 pTask-> rc = pAppliance->i_readFS(pTask);1334 pTask->hrc = pAppliance->i_readFS(pTask); 1338 1335 else 1339 pTask-> rc = E_NOTIMPL;1336 pTask->hrc = E_NOTIMPL; 1340 1337 break; 1341 1338 … … 1343 1340 /** @todo allow overriding these? */ 1344 1341 if (!pAppliance->m->fSignatureValid && pAppliance->m->pbSignedDigest) 1345 pTask-> rc = pAppliance->setError(E_FAIL, tr("The manifest signature for '%s' is not valid"),1346 pTask->locInfo.strPath.c_str());1342 pTask->hrc = pAppliance->setError(E_FAIL, tr("The manifest signature for '%s' is not valid"), 1343 pTask->locInfo.strPath.c_str()); 1347 1344 else if (!pAppliance->m->fCertificateValid && pAppliance->m->pbSignedDigest) 1348 1345 { 1349 1346 if (pAppliance->m->strCertError.isNotEmpty()) 1350 pTask-> rc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is not valid: %s"),1351 pTask->locInfo.strPath.c_str(), pAppliance->m->strCertError.c_str());1347 pTask->hrc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is not valid: %s"), 1348 pTask->locInfo.strPath.c_str(), pAppliance->m->strCertError.c_str()); 1352 1349 else 1353 pTask-> rc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is not valid"),1354 pTask->locInfo.strPath.c_str());1350 pTask->hrc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is not valid"), 1351 pTask->locInfo.strPath.c_str()); 1355 1352 } 1356 1353 // fusion does not consider this a show stopper (we've filed a warning during read). 1357 1354 //else if (pAppliance->m->fCertificateMissingPath && pAppliance->m->pbSignedDigest) 1358 // pTask-> rc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is does not have a valid CA path"),1359 // pTask->locInfo.strPath.c_str());1355 // pTask->hrc = pAppliance->setError(E_FAIL, tr("The certificate used to signed '%s' is does not have a valid CA path"), 1356 // pTask->locInfo.strPath.c_str()); 1360 1357 else 1361 1358 { 1362 1359 if (pTask->locInfo.storageType == VFSType_File) 1363 pTask-> rc = pAppliance->i_importFS(pTask);1360 pTask->hrc = pAppliance->i_importFS(pTask); 1364 1361 else 1365 pTask-> rc = E_NOTIMPL;1362 pTask->hrc = E_NOTIMPL; 1366 1363 } 1367 1364 break; … … 1369 1366 case TaskOVF::Write: 1370 1367 if (pTask->locInfo.storageType == VFSType_File) 1371 pTask-> rc = pAppliance->i_writeFS(pTask);1368 pTask->hrc = pAppliance->i_writeFS(pTask); 1372 1369 else 1373 pTask-> rc = E_NOTIMPL;1370 pTask->hrc = E_NOTIMPL; 1374 1371 break; 1375 1372 1376 1373 default: 1377 1374 AssertFailed(); 1378 pTask-> rc = E_FAIL;1375 pTask->hrc = E_FAIL; 1379 1376 break; 1380 1377 } 1381 1378 1382 1379 if (!pTask->pProgress.isNull()) 1383 pTask->pProgress->i_notifyComplete(pTask-> rc);1380 pTask->pProgress->i_notifyComplete(pTask->hrc); 1384 1381 1385 1382 LogFlowFuncLeave(); … … 1418 1415 { 1419 1416 case TaskOPC::Export: 1420 pTask-> rc = pAppliance->i_writeFSOPC(pTask);1417 pTask->hrc = pAppliance->i_writeFSOPC(pTask); 1421 1418 break; 1422 1419 1423 1420 default: 1424 1421 AssertFailed(); 1425 pTask-> rc = E_FAIL;1422 pTask->hrc = E_FAIL; 1426 1423 break; 1427 1424 } 1428 1425 1429 1426 if (!pTask->pProgress.isNull()) 1430 pTask->pProgress->i_notifyComplete(pTask-> rc);1427 pTask->pProgress->i_notifyComplete(pTask->hrc); 1431 1428 1432 1429 LogFlowFuncLeave(); … … 1467 1464 case TaskCloud::Export: 1468 1465 pAppliance->i_setApplianceState(ApplianceExporting); 1469 pTask-> rc = pAppliance->i_exportCloudImpl(pTask);1466 pTask->hrc = pAppliance->i_exportCloudImpl(pTask); 1470 1467 break; 1471 1468 case TaskCloud::Import: 1472 1469 pAppliance->i_setApplianceState(ApplianceImporting); 1473 pTask-> rc = pAppliance->i_importCloudImpl(pTask);1470 pTask->hrc = pAppliance->i_importCloudImpl(pTask); 1474 1471 break; 1475 1472 case TaskCloud::ReadData: 1476 1473 pAppliance->i_setApplianceState(ApplianceImporting); 1477 pTask-> rc = pAppliance->i_gettingCloudData(pTask);1474 pTask->hrc = pAppliance->i_gettingCloudData(pTask); 1478 1475 break; 1479 1476 default: 1480 1477 AssertFailed(); 1481 pTask-> rc = E_FAIL;1478 pTask->hrc = E_FAIL; 1482 1479 break; 1483 1480 } … … 1486 1483 1487 1484 if (!pTask->pProgress.isNull()) 1488 pTask->pProgress->i_notifyComplete(pTask-> rc);1485 pTask->pProgress->i_notifyComplete(pTask->hrc); 1489 1486 1490 1487 LogFlowFuncLeave(); -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r98262 r98288 73 73 ComPtr<IVirtualSystemDescription> &aDescription) 74 74 { 75 HRESULT rc = S_OK;75 HRESULT hrc = S_OK; 76 76 77 77 if (!aAppliance) … … 94 94 95 95 // create a new virtual system to store in the appliance 96 rc = pNewDesc.createObject();97 if (FAILED( rc)) throwrc;98 rc = pNewDesc->init();99 if (FAILED( rc)) throwrc;96 hrc = pNewDesc.createObject(); 97 if (FAILED(hrc)) throw hrc; 98 hrc = pNewDesc->init(); 99 if (FAILED(hrc)) throw hrc; 100 100 101 101 // store the machine object so we can dump the XML in Appliance::Write() … … 106 106 BOOL fUSBEnabled = FALSE; 107 107 com::SafeIfaceArray<IUSBController> usbControllers; 108 rc = COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbControllers));109 if (SUCCEEDED( rc))108 hrc = COMGETTER(USBControllers)(ComSafeArrayAsOutParam(usbControllers)); 109 if (SUCCEEDED(hrc)) 110 110 { 111 111 for (unsigned i = 0; i < usbControllers.size(); ++i) … … 113 113 USBControllerType_T enmType; 114 114 115 rc = usbControllers[i]->COMGETTER(Type)(&enmType);116 if (FAILED( rc)) throwrc;115 hrc = usbControllers[i]->COMGETTER(Type)(&enmType); 116 if (FAILED(hrc)) throw hrc; 117 117 118 118 if (enmType == USBControllerType_OHCI) … … 126 126 127 127 ComPtr<IAudioAdapter> pAudioAdapter; 128 rc = mAudioSettings->COMGETTER(Adapter)(pAudioAdapter.asOutParam());129 if (FAILED( rc)) throwrc;128 hrc = mAudioSettings->COMGETTER(Adapter)(pAudioAdapter.asOutParam()); 129 if (FAILED(hrc)) throw hrc; 130 130 BOOL fAudioEnabled; 131 rc = pAudioAdapter->COMGETTER(Enabled)(&fAudioEnabled);132 if (FAILED( rc)) throwrc;131 hrc = pAudioAdapter->COMGETTER(Enabled)(&fAudioEnabled); 132 if (FAILED(hrc)) throw hrc; 133 133 AudioControllerType_T audioController; 134 rc = pAudioAdapter->COMGETTER(AudioController)(&audioController);135 if (FAILED( rc)) throwrc;134 hrc = pAudioAdapter->COMGETTER(AudioController)(&audioController); 135 if (FAILED(hrc)) throw hrc; 136 136 137 137 // get name … … 154 154 // Long mode enabled? 155 155 BOOL fLongMode; 156 rc = GetCPUProperty(CPUPropertyType_LongMode, &fLongMode);157 if (FAILED( rc)) throwrc;156 hrc = GetCPUProperty(CPUPropertyType_LongMode, &fLongMode); 157 if (FAILED(hrc)) throw hrc; 158 158 159 159 // snapshotFolder? … … 203 203 /* Fetch all available storage controllers */ 204 204 com::SafeIfaceArray<IStorageController> nwControllers; 205 rc = COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(nwControllers));206 if (FAILED( rc)) throwrc;205 hrc = COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(nwControllers)); 206 if (FAILED(hrc)) throw hrc; 207 207 208 208 ComPtr<IStorageController> pIDEController; … … 214 214 { 215 215 StorageBus_T eType; 216 rc = nwControllers[j]->COMGETTER(Bus)(&eType);217 if (FAILED( rc)) throwrc;216 hrc = nwControllers[j]->COMGETTER(Bus)(&eType); 217 if (FAILED(hrc)) throw hrc; 218 218 if ( eType == StorageBus_IDE 219 219 && pIDEController.isNull()) … … 237 237 { 238 238 StorageControllerType_T ctlr; 239 rc = pIDEController->COMGETTER(ControllerType)(&ctlr);240 if (FAILED( rc)) throwrc;239 hrc = pIDEController->COMGETTER(ControllerType)(&ctlr); 240 if (FAILED(hrc)) throw hrc; 241 241 242 242 Utf8Str strVBox; … … 279 279 { 280 280 StorageControllerType_T ctlr; 281 rc = pSCSIController->COMGETTER(ControllerType)(&ctlr);282 if (SUCCEEDED( rc))281 hrc = pSCSIController->COMGETTER(ControllerType)(&ctlr); 282 if (SUCCEEDED(hrc)) 283 283 { 284 284 Utf8Str strVBox = "LsiLogic"; // the default in VBox … … 296 296 } 297 297 else 298 throw rc;298 throw hrc; 299 299 } 300 300 … … 314 314 { 315 315 StorageControllerType_T ctlr; 316 rc = pVirtioSCSIController->COMGETTER(ControllerType)(&ctlr);317 if (SUCCEEDED( rc))316 hrc = pVirtioSCSIController->COMGETTER(ControllerType)(&ctlr); 317 if (SUCCEEDED(hrc)) 318 318 { 319 319 Utf8Str strVBox = "VirtioSCSI"; // the default in VBox … … 330 330 } 331 331 else 332 throw rc;332 throw hrc; 333 333 } 334 334 … … 349 349 Bstr controllerName; 350 350 351 rc = pHDA->COMGETTER(Controller)(controllerName.asOutParam());352 if (FAILED( rc)) throwrc;353 354 rc = GetStorageControllerByName(controllerName.raw(), ctl.asOutParam());355 if (FAILED( rc)) throwrc;351 hrc = pHDA->COMGETTER(Controller)(controllerName.asOutParam()); 352 if (FAILED(hrc)) throw hrc; 353 354 hrc = GetStorageControllerByName(controllerName.raw(), ctl.asOutParam()); 355 if (FAILED(hrc)) throw hrc; 356 356 357 357 StorageBus_T storageBus; … … 360 360 LONG lDevice; 361 361 362 rc = ctl->COMGETTER(Bus)(&storageBus);363 if (FAILED( rc)) throwrc;364 365 rc = pHDA->COMGETTER(Type)(&deviceType);366 if (FAILED( rc)) throwrc;367 368 rc = pHDA->COMGETTER(Port)(&lChannel);369 if (FAILED( rc)) throwrc;370 371 rc = pHDA->COMGETTER(Device)(&lDevice);372 if (FAILED( rc)) throwrc;373 374 rc = pHDA->COMGETTER(Medium)(pMedium.asOutParam());375 if (FAILED( rc)) throwrc;362 hrc = ctl->COMGETTER(Bus)(&storageBus); 363 if (FAILED(hrc)) throw hrc; 364 365 hrc = pHDA->COMGETTER(Type)(&deviceType); 366 if (FAILED(hrc)) throw hrc; 367 368 hrc = pHDA->COMGETTER(Port)(&lChannel); 369 if (FAILED(hrc)) throw hrc; 370 371 hrc = pHDA->COMGETTER(Device)(&lDevice); 372 if (FAILED(hrc)) throw hrc; 373 374 hrc = pHDA->COMGETTER(Medium)(pMedium.asOutParam()); 375 if (FAILED(hrc)) throw hrc; 376 376 if (pMedium.isNull()) 377 377 { … … 402 402 Bstr bstrLocation; 403 403 404 rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());405 if (FAILED( rc)) throwrc;404 hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam()); 405 if (FAILED(hrc)) throw hrc; 406 406 strLocation = bstrLocation; 407 407 … … 412 412 // on export, the progress will be based on that (and not the diff image) 413 413 ComPtr<IMedium> pBaseMedium; 414 rc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam());414 hrc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam()); 415 415 // returns pMedium if there are no diff images 416 if (FAILED( rc)) throwrc;416 if (FAILED(hrc)) throw hrc; 417 417 418 418 strTargetImageName = Utf8StrFmt("%s-disk%.3d.vmdk", strBasename.c_str(), ++pAppliance->m->cDisks); … … 423 423 // force reading state, or else size will be returned as 0 424 424 MediumState_T ms; 425 rc = pBaseMedium->RefreshState(&ms);426 if (FAILED( rc)) throwrc;427 428 rc = pBaseMedium->COMGETTER(Size)(&llSize);429 if (FAILED( rc)) throwrc;425 hrc = pBaseMedium->RefreshState(&ms); 426 if (FAILED(hrc)) throw hrc; 427 428 hrc = pBaseMedium->COMGETTER(Size)(&llSize); 429 if (FAILED(hrc)) throw hrc; 430 430 431 431 /* If the medium is encrypted add the key identifier to the list. */ … … 479 479 //1. no host drive CD/DVD image 480 480 BOOL fHostDrive = false; 481 rc = pMedium->COMGETTER(HostDrive)(&fHostDrive);482 if (FAILED( rc)) throwrc;481 hrc = pMedium->COMGETTER(HostDrive)(&fHostDrive); 482 if (FAILED(hrc)) throw hrc; 483 483 484 484 if(fHostDrive) … … 487 487 //2. the image must be accessible and readable 488 488 MediumState_T ms; 489 rc = pMedium->RefreshState(&ms);490 if (FAILED( rc)) throwrc;489 hrc = pMedium->RefreshState(&ms); 490 if (FAILED(hrc)) throw hrc; 491 491 492 492 if (ms != MediumState_Created) … … 495 495 //3. only ISO image is exported 496 496 Bstr bstrLocation; 497 rc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam());498 if (FAILED( rc)) throwrc;497 hrc = pMedium->COMGETTER(Location)(bstrLocation.asOutParam()); 498 if (FAILED(hrc)) throw hrc; 499 499 500 500 strLocation = bstrLocation; … … 512 512 tr("Cannot attach image '%s' -- file name too long"), strTargetImageName.c_str()); 513 513 514 rc = pMedium->COMGETTER(Size)(&llSize);515 if (FAILED( rc)) throwrc;514 hrc = pMedium->COMGETTER(Size)(&llSize); 515 if (FAILED(hrc)) throw hrc; 516 516 } 517 517 // and how this translates to the virtual system … … 624 624 { 625 625 ComPtr<INetworkAdapter> pNetworkAdapter; 626 hrc = GetNetworkAdapter((ULONG)a, pNetworkAdapter.asOutParam()); 627 if (FAILED(hrc)) throw hrc; 628 629 /* Enable the network card & set the adapter type */ 626 630 BOOL fEnabled; 627 NetworkAdapterType_T adapterType; 628 NetworkAttachmentType_T attachmentType; 629 630 rc = GetNetworkAdapter((ULONG)a, pNetworkAdapter.asOutParam()); 631 if (FAILED(rc)) throw rc; 632 /* Enable the network card & set the adapter type */ 633 rc = pNetworkAdapter->COMGETTER(Enabled)(&fEnabled); 634 if (FAILED(rc)) throw rc; 631 hrc = pNetworkAdapter->COMGETTER(Enabled)(&fEnabled); 632 if (FAILED(hrc)) throw hrc; 635 633 636 634 if (fEnabled) 637 635 { 638 rc = pNetworkAdapter->COMGETTER(AdapterType)(&adapterType); 639 if (FAILED(rc)) throw rc; 640 641 rc = pNetworkAdapter->COMGETTER(AttachmentType)(&attachmentType); 642 if (FAILED(rc)) throw rc; 636 NetworkAdapterType_T adapterType; 637 hrc = pNetworkAdapter->COMGETTER(AdapterType)(&adapterType); 638 if (FAILED(hrc)) throw hrc; 639 640 NetworkAttachmentType_T attachmentType; 641 hrc = pNetworkAdapter->COMGETTER(AttachmentType)(&attachmentType); 642 if (FAILED(hrc)) throw hrc; 643 643 644 644 Utf8Str strAttachmentType = convertNetworkAttachmentTypeToString(attachmentType); … … 675 675 catch(HRESULT arc) 676 676 { 677 rc = arc;678 } 679 680 return rc;677 hrc = arc; 678 } 679 680 return hrc; 681 681 } 682 682 … … 711 711 } 712 712 713 HRESULT rc = S_OK;713 HRESULT hrc = S_OK; 714 714 // AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest) 715 715 // && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG); … … 720 720 if (m->locInfo.storageType == VFSType_Cloud) 721 721 { 722 rc = S_OK;722 hrc = S_OK; 723 723 ComObjPtr<Progress> progress; 724 724 try 725 725 { 726 rc = i_writeCloudImpl(m->locInfo, progress);726 hrc = i_writeCloudImpl(m->locInfo, progress); 727 727 } 728 728 catch (HRESULT aRC) 729 729 { 730 rc = aRC;731 } 732 733 if (SUCCEEDED( rc))730 hrc = aRC; 731 } 732 733 if (SUCCEEDED(hrc)) 734 734 /* Return progress to the caller */ 735 735 progress.queryInterfaceTo(aProgress.asOutParam()); … … 799 799 800 800 ComObjPtr<Progress> progress; 801 rc = S_OK;801 hrc = S_OK; 802 802 try 803 803 { … … 808 808 { 809 809 case ovf::OVFVersion_unknown: 810 rc = i_writeOPCImpl(ovfF, m->locInfo, progress);810 hrc = i_writeOPCImpl(ovfF, m->locInfo, progress); 811 811 break; 812 812 default: 813 rc = i_writeImpl(ovfF, m->locInfo, progress);813 hrc = i_writeImpl(ovfF, m->locInfo, progress); 814 814 break; 815 815 } … … 818 818 catch (HRESULT aRC) 819 819 { 820 rc = aRC;821 } 822 823 if (SUCCEEDED( rc))820 hrc = aRC; 821 } 822 823 if (SUCCEEDED(hrc)) 824 824 /* Return progress to the caller */ 825 825 progress.queryInterfaceTo(aProgress.asOutParam()); 826 826 } 827 827 828 return rc;828 return hrc; 829 829 } 830 830 … … 1184 1184 Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw())); 1185 1185 1186 HRESULT rc;1186 HRESULT hrc; 1187 1187 1188 1188 if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage) 1189 1189 { 1190 rc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(),1191 DeviceType_HardDisk,1192 AccessMode_ReadWrite,1193 FALSE /* fForceNewUuid */,1194 pSourceDisk.asOutParam());1195 if (FAILED( rc))1196 throw rc;1190 hrc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(), 1191 DeviceType_HardDisk, 1192 AccessMode_ReadWrite, 1193 FALSE /* fForceNewUuid */, 1194 pSourceDisk.asOutParam()); 1195 if (FAILED(hrc)) 1196 throw hrc; 1197 1197 } 1198 1198 else if (pDiskEntry->type == VirtualSystemDescriptionType_CDROM)//may be, this is CD/DVD 1199 1199 { 1200 rc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(),1201 DeviceType_DVD,1202 AccessMode_ReadOnly,1203 FALSE,1204 pSourceDisk.asOutParam());1205 if (FAILED( rc))1206 throw rc;1200 hrc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(), 1201 DeviceType_DVD, 1202 AccessMode_ReadOnly, 1203 FALSE, 1204 pSourceDisk.asOutParam()); 1205 if (FAILED(hrc)) 1206 throw hrc; 1207 1207 } 1208 1208 1209 1209 Bstr uuidSource; 1210 rc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam());1211 if (FAILED( rc)) throwrc;1210 hrc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam()); 1211 if (FAILED(hrc)) throw hrc; 1212 1212 Guid guidSource(uuidSource); 1213 1213 … … 1227 1227 1228 1228 LONG64 cbCapacity = 0; // size reported to guest 1229 rc = pSourceDisk->COMGETTER(LogicalSize)(&cbCapacity);1230 if (FAILED( rc)) throwrc;1229 hrc = pSourceDisk->COMGETTER(LogicalSize)(&cbCapacity); 1230 if (FAILED(hrc)) throw hrc; 1231 1231 /// @todo r=poetzsch: wrong it is reported in bytes ... 1232 1232 // capacity is reported in megabytes, so... … … 2230 2230 if (FAILED(autoCaller.hrc())) return autoCaller.hrc(); 2231 2231 2232 HRESULT rc = S_OK;2232 HRESULT hrc = S_OK; 2233 2233 2234 2234 // Lock the media tree early to make sure nobody else tries to make changes … … 2241 2241 2242 2242 if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)) 2243 rc = i_writeFSOVF(pTask, multiLock);2243 hrc = i_writeFSOVF(pTask, multiLock); 2244 2244 else 2245 rc = i_writeFSOVA(pTask, multiLock);2245 hrc = i_writeFSOVA(pTask, multiLock); 2246 2246 2247 2247 // reset the state so others can call methods again 2248 2248 m->state = ApplianceIdle; 2249 2249 2250 LogFlowFunc((" rc=%Rhrc\n",rc));2250 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 2251 2251 LogFlowFuncLeave(); 2252 return rc;2252 return hrc; 2253 2253 } 2254 2254 … … 2609 2609 LogFlowFuncEnter(); 2610 2610 2611 HRESULT rc = S_OK;2611 HRESULT hrc = S_OK; 2612 2612 int vrc; 2613 2613 try … … 2637 2637 2638 2638 /* Write the ovf file to "disk". */ 2639 rc = i_writeBufferToFile(hVfsFssDst, strOvfFile.c_str(), pvBuf, cbSize);2640 if (FAILED( rc))2641 throw rc;2639 hrc = i_writeBufferToFile(hVfsFssDst, strOvfFile.c_str(), pvBuf, cbSize); 2640 if (FAILED(hrc)) 2641 throw hrc; 2642 2642 } 2643 2643 … … 2692 2692 if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage) 2693 2693 { 2694 rc = mVirtualBox->i_findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk);2695 if (FAILED( rc)) throwrc;2694 hrc = mVirtualBox->i_findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk); 2695 if (FAILED(hrc)) throw hrc; 2696 2696 } 2697 2697 else//may be CD or DVD 2698 2698 { 2699 rc = mVirtualBox->i_findDVDOrFloppyImage(DeviceType_DVD,2700 NULL,2701 strSrcFilePath,2702 true,2703 &pSourceDisk);2704 if (FAILED( rc)) throwrc;2699 hrc = mVirtualBox->i_findDVDOrFloppyImage(DeviceType_DVD, 2700 NULL, 2701 strSrcFilePath, 2702 true, 2703 &pSourceDisk); 2704 if (FAILED(hrc)) throw hrc; 2705 2705 } 2706 2706 2707 2707 Bstr uuidSource; 2708 rc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam());2709 if (FAILED( rc)) throwrc;2708 hrc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam()); 2709 if (FAILED(hrc)) throw hrc; 2710 2710 Guid guidSource(uuidSource); 2711 2711 … … 2743 2743 throw setError(E_FAIL, "i_manifestSetupDigestCalculationForGivenIoStream(%s)", strTargetFilePath.c_str()); 2744 2744 2745 rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(),2746 format,2747 MediumVariant_VmdkStreamOptimized,2748 m->m_pSecretKeyStore,2749 hVfsIosDst,2750 pTask->pProgress);2745 hrc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(), 2746 format, 2747 MediumVariant_VmdkStreamOptimized, 2748 m->m_pSecretKeyStore, 2749 hVfsIosDst, 2750 pTask->pProgress); 2751 2751 RTVfsIoStrmRelease(hVfsIosDst); 2752 2752 } … … 2757 2757 */ 2758 2758 Assert(pDiskEntry->type == VirtualSystemDescriptionType_CDROM); 2759 rc = pSourceDisk->i_addRawToFss(strTargetFilePath.c_str(), m->m_pSecretKeyStore, hVfsFssDst,2759 hrc = pSourceDisk->i_addRawToFss(strTargetFilePath.c_str(), m->m_pSecretKeyStore, hVfsFssDst, 2760 2760 pTask->pProgress, false /*fSparse*/); 2761 2761 } 2762 if (FAILED( rc)) throwrc;2762 if (FAILED(hrc)) throw hrc; 2763 2763 } 2764 2764 catch (HRESULT rc3) … … 2798 2798 vrc = RTVfsFsStrmAdd(hVfsFssDst, strMfFileName.c_str(), hVfsObjManifest, 0 /*fFlags*/); 2799 2799 if (RT_SUCCESS(vrc)) 2800 rc = S_OK;2800 hrc = S_OK; 2801 2801 else 2802 rc = setErrorVrc(vrc, tr("RTVfsFsStrmAdd failed for the manifest (%Rrc)"), vrc);2802 hrc = setErrorVrc(vrc, tr("RTVfsFsStrmAdd failed for the manifest (%Rrc)"), vrc); 2803 2803 } 2804 2804 else 2805 rc = setErrorVrc(vrc, tr("RTManifestWriteStandard failed (%Rrc)"), vrc);2805 hrc = setErrorVrc(vrc, tr("RTManifestWriteStandard failed (%Rrc)"), vrc); 2806 2806 } 2807 2807 else 2808 rc = setErrorVrc(vrc, tr("RTManifestWriteStandard failed (%Rrc)"), vrc);2808 hrc = setErrorVrc(vrc, tr("RTManifestWriteStandard failed (%Rrc)"), vrc); 2809 2809 RTVfsIoStrmRelease(hVfsIosManifest); 2810 if (FAILED( rc))2811 throw rc;2810 if (FAILED(hrc)) 2811 throw hrc; 2812 2812 } 2813 2813 } 2814 2814 catch (RTCError &x) // includes all XML exceptions 2815 2815 { 2816 rc = setError(VBOX_E_FILE_ERROR, 2817 x.what()); 2816 hrc = setError(VBOX_E_FILE_ERROR, x.what()); 2818 2817 } 2819 2818 catch (HRESULT aRC) 2820 2819 { 2821 rc = aRC;2822 } 2823 2824 LogFlowFunc((" rc=%Rhrc\n",rc));2820 hrc = aRC; 2821 } 2822 2823 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 2825 2824 LogFlowFuncLeave(); 2826 2825 2827 return rc;2826 return hrc; 2828 2827 } 2829 2828 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r98262 r98288 104 104 try 105 105 { 106 i_parseURI(aFile, m->locInfo); /* may t rhowrc. */106 i_parseURI(aFile, m->locInfo); /* may throw hrc. */ 107 107 } 108 108 catch (HRESULT aRC) … … 144 144 return E_ACCESSDENIED; 145 145 146 HRESULT rc = S_OK;146 HRESULT hrc = S_OK; 147 147 148 148 /* Clear any previous virtual system descriptions */ … … 171 171 172 172 ComObjPtr<VirtualSystemDescription> pNewDesc; 173 rc = pNewDesc.createObject();174 if (FAILED( rc)) throwrc;175 rc = pNewDesc->init();176 if (FAILED( rc)) throwrc;173 hrc = pNewDesc.createObject(); 174 if (FAILED(hrc)) throw hrc; 175 hrc = pNewDesc->init(); 176 if (FAILED(hrc)) throw hrc; 177 177 178 178 // if the virtual system in OVF had a <vbox:Machine> element, have the … … 233 233 /* Based on the VM name, create a target machine path. */ 234 234 Bstr bstrSettingsFilename; 235 rc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(),236 Bstr(strPrimaryGroup).raw(),237 NULL /* aCreateFlags */,238 NULL /* aBaseFolder */,239 bstrSettingsFilename.asOutParam());240 if (FAILED( rc)) throwrc;235 hrc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(), 236 Bstr(strPrimaryGroup).raw(), 237 NULL /* aCreateFlags */, 238 NULL /* aBaseFolder */, 239 bstrSettingsFilename.asOutParam()); 240 if (FAILED(hrc)) throw hrc; 241 241 Utf8Str strMachineFolder(bstrSettingsFilename); 242 242 strMachineFolder.stripFilename(); … … 364 364 if (!pGuestOSType.isNull()) 365 365 { 366 rc = pGuestOSType->COMGETTER(RecommendedRAM)(&memSizeVBox2);367 if (FAILED( rc)) throwrc;366 hrc = pGuestOSType->COMGETTER(RecommendedRAM)(&memSizeVBox2); 367 if (FAILED(hrc)) throw hrc; 368 368 } 369 369 else … … 456 456 if (!pGuestOSType.isNull()) 457 457 { 458 rc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox);459 if (FAILED( rc)) throwrc;458 hrc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox); 459 if (FAILED(hrc)) throw hrc; 460 460 } 461 461 else … … 724 724 725 725 ComObjPtr<MediumFormat> mediumFormat; 726 rc = i_findMediumFormatFromDiskImage(di, mediumFormat);727 if (FAILED( rc))728 throw rc;726 hrc = i_findMediumFormatFromDiskImage(di, mediumFormat); 727 if (FAILED(hrc)) 728 throw hrc; 729 729 730 730 Bstr bstrFormatName; 731 rc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam());732 if (FAILED( rc))733 throw rc;731 hrc = mediumFormat->COMGETTER(Name)(bstrFormatName.asOutParam()); 732 if (FAILED(hrc)) 733 throw hrc; 734 734 Utf8Str vdf = Utf8Str(bstrFormatName); 735 735 … … 799 799 /* On error we clear the list & return */ 800 800 m->virtualSystemDescriptions.clear(); 801 rc = aRC;801 hrc = aRC; 802 802 } 803 803 … … 806 806 m->state = ApplianceIdle; 807 807 808 return rc;808 return hrc; 809 809 } 810 810 … … 1309 1309 } 1310 1310 1311 LogFlowFunc((" rc=%Rhrc\n", hrc));1311 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 1312 1312 LogFlowFuncLeave(); 1313 1313 … … 2270 2270 } 2271 2271 2272 LogFlowFunc((" rc=%Rhrc\n", hrc));2272 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 2273 2273 LogFlowFuncLeave(); 2274 2274 return hrc; … … 2296 2296 AutoWriteLock appLock(this COMMA_LOCKVAL_SRC_POS); 2297 2297 2298 HRESULT rc;2298 HRESULT hrc; 2299 2299 if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)) 2300 rc = i_readFSOVF(pTask);2300 hrc = i_readFSOVF(pTask); 2301 2301 else 2302 rc = i_readFSOVA(pTask);2303 2304 LogFlowFunc((" rc=%Rhrc\n",rc));2302 hrc = i_readFSOVA(pTask); 2303 2304 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 2305 2305 LogFlowFuncLeave(); 2306 2306 2307 return rc;2307 return hrc; 2308 2308 } 2309 2309 … … 2580 2580 hrc = E_FAIL; 2581 2581 } 2582 LogFlowFunc(("OVFReader(%s) -> rc=%Rhrc\n", pTask->locInfo.strPath.c_str(), hrc));2582 LogFlowFunc(("OVFReader(%s) -> hrc=%Rhrc\n", pTask->locInfo.strPath.c_str(), hrc)); 2583 2583 2584 2584 RTVfsIoStrmReadAllFree(pvBufferedOvf, cbBufferedOvf); … … 3530 3530 ComObjPtr<Progress> &progress) 3531 3531 { 3532 HRESULT rc;3532 HRESULT hrc; 3533 3533 3534 3534 /* Initialize our worker task */ … … 3536 3536 if (locInfo.storageType != VFSType_Cloud) 3537 3537 { 3538 rc = i_setUpProgress(progress, Utf8StrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()),3539 locInfo.storageType == VFSType_File ? ImportFile : ImportS3);3540 if (FAILED( rc))3541 return setError( rc, tr("Failed to create task for importing appliance into VirtualBox"));3538 hrc = i_setUpProgress(progress, Utf8StrFmt(tr("Importing appliance '%s'"), locInfo.strPath.c_str()), 3539 locInfo.storageType == VFSType_File ? ImportFile : ImportS3); 3540 if (FAILED(hrc)) 3541 return setError(hrc, tr("Failed to create task for importing appliance into VirtualBox")); 3542 3542 try 3543 3543 { … … 3592 3592 try 3593 3593 { 3594 rc = progress.createObject();3595 if (SUCCEEDED( rc))3596 rc = progress->init(mVirtualBox, static_cast<IAppliance *>(this),3597 Utf8Str(tr("Importing VM from Cloud...")),3598 TRUE /* aCancelable */,3599 10, // ULONG cOperations,3600 1000, // ULONG ulTotalOperationsWeight,3601 Utf8Str(tr("Start import VM from the Cloud...")), // aFirstOperationDescription3602 25); // ULONG ulFirstOperationWeight3603 if (SUCCEEDED( rc))3594 hrc = progress.createObject(); 3595 if (SUCCEEDED(hrc)) 3596 hrc = progress->init(mVirtualBox, static_cast<IAppliance *>(this), 3597 Utf8Str(tr("Importing VM from Cloud...")), 3598 TRUE /* aCancelable */, 3599 10, // ULONG cOperations, 3600 1000, // ULONG ulTotalOperationsWeight, 3601 Utf8Str(tr("Start import VM from the Cloud...")), // aFirstOperationDescription 3602 25); // ULONG ulFirstOperationWeight 3603 if (SUCCEEDED(hrc)) 3604 3604 pTask = new TaskCloud(this, TaskCloud::Import, locInfo, progress); 3605 3605 else … … 3610 3610 return E_OUTOFMEMORY; 3611 3611 } 3612 if (FAILED( rc))3613 return setError( rc, tr("Failed to create task for importing appliance into VirtualBox"));3612 if (FAILED(hrc)) 3613 return setError(hrc, tr("Failed to create task for importing appliance into VirtualBox")); 3614 3614 } 3615 3615 else … … 3621 3621 * Start the task thread. 3622 3622 */ 3623 rc = pTask->createThread();3623 hrc = pTask->createThread(); 3624 3624 pTask = NULL; 3625 if (SUCCEEDED( rc))3626 return rc;3627 return setError( rc, tr("Failed to start thread for importing appliance into VirtualBox"));3625 if (SUCCEEDED(hrc)) 3626 return hrc; 3627 return setError(hrc, tr("Failed to start thread for importing appliance into VirtualBox")); 3628 3628 } 3629 3629 … … 3663 3663 m->state = ApplianceImporting; 3664 3664 3665 HRESULT rc = S_OK;3665 HRESULT hrc = S_OK; 3666 3666 3667 3667 /* Clear the list of imported machines, if any */ … … 3669 3669 3670 3670 if (pTask->locInfo.strPath.endsWith(".ovf", Utf8Str::CaseInsensitive)) 3671 rc = i_importFSOVF(pTask, writeLock);3671 hrc = i_importFSOVF(pTask, writeLock); 3672 3672 else 3673 rc = i_importFSOVA(pTask, writeLock);3674 if (FAILED( rc))3673 hrc = i_importFSOVA(pTask, writeLock); 3674 if (FAILED(hrc)) 3675 3675 { 3676 3676 /* With _whatever_ error we've had, do a complete roll-back of … … 3701 3701 m->state = ApplianceIdle; 3702 3702 3703 LogFlowFunc((" rc=%Rhrc\n",rc));3703 LogFlowFunc(("hrc=%Rhrc\n", hrc)); 3704 3704 LogFlowFuncLeave(); 3705 return rc;3705 return hrc; 3706 3706 } 3707 3707 … … 4029 4029 ImportStack &stack) 4030 4030 { 4031 HRESULT rc;4031 HRESULT hrc; 4032 4032 4033 4033 Utf8Str strAbsDstPath; … … 4063 4063 if (vrc == VINF_SUCCESS) 4064 4064 { 4065 rc = mVirtualBox->i_findHardDiskById(Guid(uuid), true, &pTargetMedium);4066 if (FAILED( rc)) throwrc;4065 hrc = mVirtualBox->i_findHardDiskById(Guid(uuid), true, &pTargetMedium); 4066 if (FAILED(hrc)) throw hrc; 4067 4067 } 4068 4068 else … … 4099 4099 throw setError(E_FAIL, tr("Unsupported medium format for disk image '%s'"), di.strHref.c_str()); 4100 4100 4101 rc = trgFormat->COMGETTER(Name)(bstrFormatName.asOutParam());4102 if (FAILED( rc)) throwrc;4101 hrc = trgFormat->COMGETTER(Name)(bstrFormatName.asOutParam()); 4102 if (FAILED(hrc)) throw hrc; 4103 4103 4104 4104 strTrgFormat = Utf8Str(bstrFormatName); … … 4118 4118 lCabs = 0; 4119 4119 com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap; 4120 rc = trgFormat->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap));4121 4122 if (FAILED( rc))4123 throw rc;4120 hrc = trgFormat->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap)); 4121 4122 if (FAILED(hrc)) 4123 throw hrc; 4124 4124 4125 4125 for (ULONG j = 0; j < mediumFormatCap.size(); j++) … … 4150 4150 4151 4151 ComPtr<IMedium> pTmp; 4152 rc = mVirtualBox->OpenMedium(Bstr(strAbsDstPath).raw(),4153 DeviceType_DVD,4154 AccessMode_ReadWrite,4155 false,4156 pTmp.asOutParam());4157 if (FAILED( rc))4158 throw rc;4152 hrc = mVirtualBox->OpenMedium(Bstr(strAbsDstPath).raw(), 4153 DeviceType_DVD, 4154 AccessMode_ReadWrite, 4155 false, 4156 pTmp.asOutParam()); 4157 if (FAILED(hrc)) 4158 throw hrc; 4159 4159 4160 4160 IMedium *iM = pTmp; … … 4177 4177 pTargetMedium.createObject(); 4178 4178 4179 rc = pTargetMedium->init(mVirtualBox,4180 strTrgFormat,4181 strAbsDstPath,4182 Guid::Empty /* media registry: none yet */,4183 DeviceType_HardDisk);4184 if (FAILED( rc)) throwrc;4179 hrc = pTargetMedium->init(mVirtualBox, 4180 strTrgFormat, 4181 strAbsDstPath, 4182 Guid::Empty /* media registry: none yet */, 4183 DeviceType_HardDisk); 4184 if (FAILED(hrc)) throw hrc; 4185 4185 4186 4186 ComPtr<IProgress> pProgressImport; … … 4192 4192 4193 4193 /* Kick off the creation of a dynamic growing disk image with the given capacity. */ 4194 rc = pTargetMedium->CreateBaseStorage(di.iCapacity / _1M,4195 ComSafeArrayAsInParam(mediumVariant),4196 pProgressImport.asOutParam());4197 if (FAILED( rc)) throwrc;4194 hrc = pTargetMedium->CreateBaseStorage(di.iCapacity / _1M, 4195 ComSafeArrayAsInParam(mediumVariant), 4196 pProgressImport.asOutParam()); 4197 if (FAILED(hrc)) throw hrc; 4198 4198 4199 4199 /* Advance to the next operation. */ … … 4208 4208 /* Which format to use? */ 4209 4209 ComObjPtr<MediumFormat> srcFormat; 4210 rc = i_findMediumFormatFromDiskImage(di, srcFormat);4211 if (FAILED( rc))4210 hrc = i_findMediumFormatFromDiskImage(di, srcFormat); 4211 if (FAILED(hrc)) 4212 4212 throw setError(VBOX_E_NOT_SUPPORTED, 4213 4213 tr("Could not find a valid medium format for the source disk '%s' " … … 4254 4254 ComObjPtr<Medium> nullParent; 4255 4255 ComObjPtr<Progress> pProgressImportTmp; 4256 rc = pProgressImportTmp.createObject(); 4257 if (FAILED(rc)) throw rc; 4258 rc = pProgressImportTmp->init(mVirtualBox, 4259 static_cast<IAppliance*>(this), 4260 Utf8StrFmt(tr("Importing medium '%s'"), 4261 strAbsDstPath.c_str()), 4262 TRUE); 4263 if (FAILED(rc)) throw rc; 4256 hrc = pProgressImportTmp.createObject(); 4257 if (FAILED(hrc)) throw hrc; 4258 hrc = pProgressImportTmp->init(mVirtualBox, 4259 static_cast<IAppliance*>(this), 4260 Utf8StrFmt(tr("Importing medium '%s'"), strAbsDstPath.c_str()), 4261 TRUE); 4262 if (FAILED(hrc)) throw hrc; 4264 4263 pProgressImportTmp.queryInterfaceTo(pProgressImport.asOutParam()); 4265 4264 /* pProgressImportTmp is in parameter for Medium::i_importFile, 4266 4265 * which is somewhat unusual and might be changed later. */ 4267 rc = pTargetMedium->i_importFile(strSrcFilePath.c_str(),4268 srcFormat,4269 MediumVariant_Standard,4270 hVfsIosReadAhead,4271 nullParent,4272 pProgressImportTmp,4273 true /* aNotify */);4266 hrc = pTargetMedium->i_importFile(strSrcFilePath.c_str(), 4267 srcFormat, 4268 MediumVariant_Standard, 4269 hVfsIosReadAhead, 4270 nullParent, 4271 pProgressImportTmp, 4272 true /* aNotify */); 4274 4273 RTVfsIoStrmRelease(hVfsIosReadAhead); 4275 4274 hVfsIosSrc = NIL_RTVFSIOSTREAM; 4276 if (FAILED( rc))4277 throw rc;4275 if (FAILED(hrc)) 4276 throw hrc; 4278 4277 4279 4278 /* Advance to the next operation. */ … … 4401 4400 { 4402 4401 LogFlowFuncEnter(); 4403 HRESULT rc;4402 HRESULT hrc; 4404 4403 4405 4404 // Get the instance of IGuestOSType which matches our string guest OS type so we 4406 4405 // can use recommended defaults for the new machine where OVF doesn't provide any 4407 4406 ComPtr<IGuestOSType> osType; 4408 rc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox).raw(), osType.asOutParam());4409 if (FAILED( rc)) throwrc;4407 hrc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox).raw(), osType.asOutParam()); 4408 if (FAILED(hrc)) throw hrc; 4410 4409 4411 4410 /* Create the machine */ … … 4414 4413 Bstr(stack.strPrimaryGroup).detachTo(groups.appendedRaw()); 4415 4414 ComPtr<IMachine> pNewMachine; 4416 rc = mVirtualBox->CreateMachine(Bstr(stack.strSettingsFilename).raw(),4417 Bstr(stack.strNameVBox).raw(),4418 ComSafeArrayAsInParam(groups),4419 Bstr(stack.strOsTypeVBox).raw(),4420 NULL, /* aCreateFlags */4421 NULL, /* aCipher */4422 NULL, /* aPasswordId */4423 NULL, /* aPassword */4424 pNewMachine.asOutParam());4425 if (FAILED( rc)) throwrc;4415 hrc = mVirtualBox->CreateMachine(Bstr(stack.strSettingsFilename).raw(), 4416 Bstr(stack.strNameVBox).raw(), 4417 ComSafeArrayAsInParam(groups), 4418 Bstr(stack.strOsTypeVBox).raw(), 4419 NULL, /* aCreateFlags */ 4420 NULL, /* aCipher */ 4421 NULL, /* aPasswordId */ 4422 NULL, /* aPassword */ 4423 pNewMachine.asOutParam()); 4424 if (FAILED(hrc)) throw hrc; 4426 4425 pNewMachineRet = pNewMachine; 4427 4426 … … 4429 4428 if (!stack.strDescription.isEmpty()) 4430 4429 { 4431 rc = pNewMachine->COMSETTER(Description)(Bstr(stack.strDescription).raw());4432 if (FAILED( rc)) throwrc;4430 hrc = pNewMachine->COMSETTER(Description)(Bstr(stack.strDescription).raw()); 4431 if (FAILED(hrc)) throw hrc; 4433 4432 } 4434 4433 4435 4434 // CPU count 4436 rc = pNewMachine->COMSETTER(CPUCount)(stack.cCPUs);4437 if (FAILED( rc)) throwrc;4435 hrc = pNewMachine->COMSETTER(CPUCount)(stack.cCPUs); 4436 if (FAILED(hrc)) throw hrc; 4438 4437 4439 4438 if (stack.fForceHWVirt) 4440 4439 { 4441 rc = pNewMachine->SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE);4442 if (FAILED( rc)) throwrc;4440 hrc = pNewMachine->SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE); 4441 if (FAILED(hrc)) throw hrc; 4443 4442 } 4444 4443 4445 4444 // RAM 4446 rc = pNewMachine->COMSETTER(MemorySize)(stack.ulMemorySizeMB);4447 if (FAILED( rc)) throwrc;4445 hrc = pNewMachine->COMSETTER(MemorySize)(stack.ulMemorySizeMB); 4446 if (FAILED(hrc)) throw hrc; 4448 4447 4449 4448 /* VRAM */ 4450 4449 /* Get the recommended VRAM for this guest OS type */ 4451 4450 ULONG vramVBox; 4452 rc = osType->COMGETTER(RecommendedVRAM)(&vramVBox);4453 if (FAILED( rc)) throwrc;4451 hrc = osType->COMGETTER(RecommendedVRAM)(&vramVBox); 4452 if (FAILED(hrc)) throw hrc; 4454 4453 4455 4454 /* Set the VRAM */ 4456 4455 ComPtr<IGraphicsAdapter> pGraphicsAdapter; 4457 rc = pNewMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam());4458 if (FAILED( rc)) throwrc;4459 rc = pGraphicsAdapter->COMSETTER(VRAMSize)(vramVBox);4460 if (FAILED( rc)) throwrc;4456 hrc = pNewMachine->COMGETTER(GraphicsAdapter)(pGraphicsAdapter.asOutParam()); 4457 if (FAILED(hrc)) throw hrc; 4458 hrc = pGraphicsAdapter->COMSETTER(VRAMSize)(vramVBox); 4459 if (FAILED(hrc)) throw hrc; 4461 4460 4462 4461 // I/O APIC: Generic OVF has no setting for this. Enable it if we … … 4467 4466 { 4468 4467 Bstr bstrFamilyId; 4469 rc = osType->COMGETTER(FamilyId)(bstrFamilyId.asOutParam());4470 if (FAILED( rc)) throwrc;4468 hrc = osType->COMGETTER(FamilyId)(bstrFamilyId.asOutParam()); 4469 if (FAILED(hrc)) throw hrc; 4471 4470 if (bstrFamilyId == "Windows") 4472 4471 stack.fForceIOAPIC = true; … … 4476 4475 { 4477 4476 ComPtr<IBIOSSettings> pBIOSSettings; 4478 rc = pNewMachine->COMGETTER(BIOSSettings)(pBIOSSettings.asOutParam());4479 if (FAILED( rc)) throwrc;4480 4481 rc = pBIOSSettings->COMSETTER(IOAPICEnabled)(TRUE);4482 if (FAILED( rc)) throwrc;4477 hrc = pNewMachine->COMGETTER(BIOSSettings)(pBIOSSettings.asOutParam()); 4478 if (FAILED(hrc)) throw hrc; 4479 4480 hrc = pBIOSSettings->COMSETTER(IOAPICEnabled)(TRUE); 4481 if (FAILED(hrc)) throw hrc; 4483 4482 } 4484 4483 … … 4495 4494 firmwareType = FirmwareType_EFI; 4496 4495 } 4497 rc = pNewMachine->COMSETTER(FirmwareType)(firmwareType);4498 if (FAILED( rc)) throwrc;4496 hrc = pNewMachine->COMSETTER(FirmwareType)(firmwareType); 4497 if (FAILED(hrc)) throw hrc; 4499 4498 } 4500 4499 … … 4503 4502 { 4504 4503 ComPtr<IAudioSettings> audioSettings; 4505 rc = pNewMachine->COMGETTER(AudioSettings)(audioSettings.asOutParam());4506 if (FAILED( rc)) throwrc;4504 hrc = pNewMachine->COMGETTER(AudioSettings)(audioSettings.asOutParam()); 4505 if (FAILED(hrc)) throw hrc; 4507 4506 uint32_t audio = RTStrToUInt32(stack.strAudioAdapter.c_str()); // should be 0 for AC97 4508 4507 ComPtr<IAudioAdapter> audioAdapter; 4509 rc = audioSettings->COMGETTER(Adapter)(audioAdapter.asOutParam());4510 if (FAILED( rc)) throwrc;4511 rc = audioAdapter->COMSETTER(Enabled)(true);4512 if (FAILED( rc)) throwrc;4513 rc = audioAdapter->COMSETTER(AudioController)(static_cast<AudioControllerType_T>(audio));4514 if (FAILED( rc)) throwrc;4508 hrc = audioSettings->COMGETTER(Adapter)(audioAdapter.asOutParam()); 4509 if (FAILED(hrc)) throw hrc; 4510 hrc = audioAdapter->COMSETTER(Enabled)(true); 4511 if (FAILED(hrc)) throw hrc; 4512 hrc = audioAdapter->COMSETTER(AudioController)(static_cast<AudioControllerType_T>(audio)); 4513 if (FAILED(hrc)) throw hrc; 4515 4514 } 4516 4515 … … 4520 4519 { 4521 4520 ComPtr<IUSBController> usbController; 4522 rc = pNewMachine->AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI, usbController.asOutParam());4523 if (FAILED( rc)) throwrc;4521 hrc = pNewMachine->AddUSBController(Bstr("OHCI").raw(), USBControllerType_OHCI, usbController.asOutParam()); 4522 if (FAILED(hrc)) throw hrc; 4524 4523 } 4525 4524 #endif /* VBOX_WITH_USB */ … … 4533 4532 /* No network adapters, so we have to disable our default one */ 4534 4533 ComPtr<INetworkAdapter> nwVBox; 4535 rc = pNewMachine->GetNetworkAdapter(0, nwVBox.asOutParam());4536 if (FAILED( rc)) throwrc;4537 rc = nwVBox->COMSETTER(Enabled)(false);4538 if (FAILED( rc)) throwrc;4534 hrc = pNewMachine->GetNetworkAdapter(0, nwVBox.asOutParam()); 4535 if (FAILED(hrc)) throw hrc; 4536 hrc = nwVBox->COMSETTER(Enabled)(false); 4537 if (FAILED(hrc)) throw hrc; 4539 4538 } 4540 4539 else if (vsdeNW.size() > maxNetworkAdapters) … … 4556 4555 uint32_t tt1 = RTStrToUInt32(nwTypeVBox.c_str()); 4557 4556 ComPtr<INetworkAdapter> pNetworkAdapter; 4558 rc = pNewMachine->GetNetworkAdapter((ULONG)a, pNetworkAdapter.asOutParam());4559 if (FAILED( rc)) throwrc;4557 hrc = pNewMachine->GetNetworkAdapter((ULONG)a, pNetworkAdapter.asOutParam()); 4558 if (FAILED(hrc)) throw hrc; 4560 4559 /* Enable the network card & set the adapter type */ 4561 rc = pNetworkAdapter->COMSETTER(Enabled)(true);4562 if (FAILED( rc)) throwrc;4563 rc = pNetworkAdapter->COMSETTER(AdapterType)(static_cast<NetworkAdapterType_T>(tt1));4564 if (FAILED( rc)) throwrc;4560 hrc = pNetworkAdapter->COMSETTER(Enabled)(true); 4561 if (FAILED(hrc)) throw hrc; 4562 hrc = pNetworkAdapter->COMSETTER(AdapterType)(static_cast<NetworkAdapterType_T>(tt1)); 4563 if (FAILED(hrc)) throw hrc; 4565 4564 4566 4565 // default is NAT; change to "bridged" if extra conf says so … … 4568 4567 { 4569 4568 /* Attach to the right interface */ 4570 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged);4571 if (FAILED( rc)) throwrc;4569 hrc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Bridged); 4570 if (FAILED(hrc)) throw hrc; 4572 4571 ComPtr<IHost> host; 4573 rc = mVirtualBox->COMGETTER(Host)(host.asOutParam());4574 if (FAILED( rc)) throwrc;4572 hrc = mVirtualBox->COMGETTER(Host)(host.asOutParam()); 4573 if (FAILED(hrc)) throw hrc; 4575 4574 com::SafeIfaceArray<IHostNetworkInterface> nwInterfaces; 4576 rc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces));4577 if (FAILED( rc)) throwrc;4575 hrc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces)); 4576 if (FAILED(hrc)) throw hrc; 4578 4577 // We search for the first host network interface which 4579 4578 // is usable for bridged networking … … 4583 4582 { 4584 4583 HostNetworkInterfaceType_T itype; 4585 rc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype);4586 if (FAILED( rc)) throwrc;4584 hrc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype); 4585 if (FAILED(hrc)) throw hrc; 4587 4586 if (itype == HostNetworkInterfaceType_Bridged) 4588 4587 { 4589 4588 Bstr name; 4590 rc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam());4591 if (FAILED( rc)) throwrc;4589 hrc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam()); 4590 if (FAILED(hrc)) throw hrc; 4592 4591 /* Set the interface name to attach to */ 4593 rc = pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw());4594 if (FAILED( rc)) throwrc;4592 hrc = pNetworkAdapter->COMSETTER(BridgedInterface)(name.raw()); 4593 if (FAILED(hrc)) throw hrc; 4595 4594 break; 4596 4595 } … … 4601 4600 { 4602 4601 /* Attach to the right interface */ 4603 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly);4604 if (FAILED( rc)) throwrc;4602 hrc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_HostOnly); 4603 if (FAILED(hrc)) throw hrc; 4605 4604 ComPtr<IHost> host; 4606 rc = mVirtualBox->COMGETTER(Host)(host.asOutParam());4607 if (FAILED( rc)) throwrc;4605 hrc = mVirtualBox->COMGETTER(Host)(host.asOutParam()); 4606 if (FAILED(hrc)) throw hrc; 4608 4607 com::SafeIfaceArray<IHostNetworkInterface> nwInterfaces; 4609 rc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces));4610 if (FAILED( rc)) throwrc;4608 hrc = host->COMGETTER(NetworkInterfaces)(ComSafeArrayAsOutParam(nwInterfaces)); 4609 if (FAILED(hrc)) throw hrc; 4611 4610 // We search for the first host network interface which 4612 4611 // is usable for host only networking … … 4616 4615 { 4617 4616 HostNetworkInterfaceType_T itype; 4618 rc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype);4619 if (FAILED( rc)) throwrc;4617 hrc = nwInterfaces[j]->COMGETTER(InterfaceType)(&itype); 4618 if (FAILED(hrc)) throw hrc; 4620 4619 if (itype == HostNetworkInterfaceType_HostOnly) 4621 4620 { 4622 4621 Bstr name; 4623 rc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam());4624 if (FAILED( rc)) throwrc;4622 hrc = nwInterfaces[j]->COMGETTER(Name)(name.asOutParam()); 4623 if (FAILED(hrc)) throw hrc; 4625 4624 /* Set the interface name to attach to */ 4626 rc = pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw());4627 if (FAILED( rc)) throwrc;4625 hrc = pNetworkAdapter->COMSETTER(HostOnlyInterface)(name.raw()); 4626 if (FAILED(hrc)) throw hrc; 4628 4627 break; 4629 4628 } … … 4634 4633 { 4635 4634 /* Attach to the right interface */ 4636 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Internal);4637 if (FAILED( rc)) throwrc;4635 hrc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Internal); 4636 if (FAILED(hrc)) throw hrc; 4638 4637 } 4639 4638 /* Next test for Generic interfaces */ … … 4641 4640 { 4642 4641 /* Attach to the right interface */ 4643 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Generic);4644 if (FAILED( rc)) throwrc;4642 hrc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_Generic); 4643 if (FAILED(hrc)) throw hrc; 4645 4644 } 4646 4645 … … 4649 4648 { 4650 4649 /* Attach to the right interface */ 4651 rc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork);4652 if (FAILED( rc)) throwrc;4650 hrc = pNetworkAdapter->COMSETTER(AttachmentType)(NetworkAttachmentType_NATNetwork); 4651 if (FAILED(hrc)) throw hrc; 4653 4652 com::SafeIfaceArray<INATNetwork> nwNATNetworks; 4654 rc = mVirtualBox->COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nwNATNetworks));4655 if (FAILED( rc)) throwrc;4653 hrc = mVirtualBox->COMGETTER(NATNetworks)(ComSafeArrayAsOutParam(nwNATNetworks)); 4654 if (FAILED(hrc)) throw hrc; 4656 4655 // Pick the first NAT network (if there is any) 4657 4656 if (nwNATNetworks.size()) 4658 4657 { 4659 4658 Bstr name; 4660 rc = nwNATNetworks[0]->COMGETTER(NetworkName)(name.asOutParam());4661 if (FAILED( rc)) throwrc;4659 hrc = nwNATNetworks[0]->COMGETTER(NetworkName)(name.asOutParam()); 4660 if (FAILED(hrc)) throw hrc; 4662 4661 /* Set the NAT network name to attach to */ 4663 rc = pNetworkAdapter->COMSETTER(NATNetwork)(name.raw());4664 if (FAILED( rc)) throwrc;4662 hrc = pNetworkAdapter->COMSETTER(NATNetwork)(name.raw()); 4663 if (FAILED(hrc)) throw hrc; 4665 4664 break; 4666 4665 } … … 4685 4684 // one or two IDE controllers present in OVF: add one VirtualBox controller 4686 4685 ComPtr<IStorageController> pController; 4687 rc = pNewMachine->AddStorageController(Bstr("IDE").raw(), StorageBus_IDE, pController.asOutParam());4688 if (FAILED( rc)) throwrc;4686 hrc = pNewMachine->AddStorageController(Bstr("IDE").raw(), StorageBus_IDE, pController.asOutParam()); 4687 if (FAILED(hrc)) throw hrc; 4689 4688 4690 4689 const char *pcszIDEType = vsdeHDCIDE.front()->strVBoxCurrent.c_str(); 4691 4690 if (!strcmp(pcszIDEType, "PIIX3")) 4692 rc = pController->COMSETTER(ControllerType)(StorageControllerType_PIIX3);4691 hrc = pController->COMSETTER(ControllerType)(StorageControllerType_PIIX3); 4693 4692 else if (!strcmp(pcszIDEType, "PIIX4")) 4694 rc = pController->COMSETTER(ControllerType)(StorageControllerType_PIIX4);4693 hrc = pController->COMSETTER(ControllerType)(StorageControllerType_PIIX4); 4695 4694 else if (!strcmp(pcszIDEType, "ICH6")) 4696 rc = pController->COMSETTER(ControllerType)(StorageControllerType_ICH6);4695 hrc = pController->COMSETTER(ControllerType)(StorageControllerType_ICH6); 4697 4696 else 4698 4697 throw setError(VBOX_E_FILE_ERROR, 4699 4698 tr("Invalid IDE controller type \"%s\""), 4700 4699 pcszIDEType); 4701 if (FAILED( rc)) throwrc;4700 if (FAILED(hrc)) throw hrc; 4702 4701 } 4703 4702 … … 4714 4713 if (hdcVBox == "AHCI") 4715 4714 { 4716 rc = pNewMachine->AddStorageController(Bstr("SATA").raw(), 4717 StorageBus_SATA, 4718 pController.asOutParam()); 4719 if (FAILED(rc)) throw rc; 4715 hrc = pNewMachine->AddStorageController(Bstr("SATA").raw(), StorageBus_SATA, pController.asOutParam()); 4716 if (FAILED(hrc)) throw hrc; 4720 4717 } 4721 4718 else 4722 throw setError(VBOX_E_FILE_ERROR, 4723 tr("Invalid SATA controller type \"%s\""), 4724 hdcVBox.c_str()); 4719 throw setError(VBOX_E_FILE_ERROR, tr("Invalid SATA controller type \"%s\""), hdcVBox.c_str()); 4725 4720 } 4726 4721 … … 4750 4745 controllerType = StorageControllerType_BusLogic; 4751 4746 else 4752 throw setError(VBOX_E_FILE_ERROR, 4753 tr("Invalid SCSI controller type \"%s\""), 4754 hdcVBox.c_str()); 4755 4756 rc = pNewMachine->AddStorageController(Bstr(strName).raw(), busType, pController.asOutParam()); 4757 if (FAILED(rc)) throw rc; 4758 rc = pController->COMSETTER(ControllerType)(controllerType); 4759 if (FAILED(rc)) throw rc; 4747 throw setError(VBOX_E_FILE_ERROR, tr("Invalid SCSI controller type \"%s\""), hdcVBox.c_str()); 4748 4749 hrc = pNewMachine->AddStorageController(Bstr(strName).raw(), busType, pController.asOutParam()); 4750 if (FAILED(hrc)) throw hrc; 4751 hrc = pController->COMSETTER(ControllerType)(controllerType); 4752 if (FAILED(hrc)) throw hrc; 4760 4753 } 4761 4754 … … 4769 4762 { 4770 4763 ComPtr<IStorageController> pController; 4771 rc = pNewMachine->AddStorageController(Bstr(L"SAS").raw(), 4772 StorageBus_SAS, 4773 pController.asOutParam()); 4774 if (FAILED(rc)) throw rc; 4775 rc = pController->COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas); 4776 if (FAILED(rc)) throw rc; 4764 hrc = pNewMachine->AddStorageController(Bstr(L"SAS").raw(), StorageBus_SAS, pController.asOutParam()); 4765 if (FAILED(hrc)) throw hrc; 4766 hrc = pController->COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas); 4767 if (FAILED(hrc)) throw hrc; 4777 4768 } 4778 4769 … … 4791 4782 if (hdcVBox == "VirtioSCSI") 4792 4783 { 4793 rc = pNewMachine->AddStorageController(Bstr(strName).raw(), 4794 StorageBus_VirtioSCSI, 4795 pController.asOutParam()); 4796 if (FAILED(rc)) throw rc; 4797 4798 rc = pController->COMSETTER(ControllerType)(StorageControllerType_VirtioSCSI); 4799 if (FAILED(rc)) throw rc; 4784 hrc = pNewMachine->AddStorageController(Bstr(strName).raw(), StorageBus_VirtioSCSI, pController.asOutParam()); 4785 if (FAILED(hrc)) throw hrc; 4786 4787 hrc = pController->COMSETTER(ControllerType)(StorageControllerType_VirtioSCSI); 4788 if (FAILED(hrc)) throw hrc; 4800 4789 } 4801 4790 else 4802 throw setError(VBOX_E_FILE_ERROR, 4803 tr("Invalid VirtioSCSI controller type \"%s\""), 4804 hdcVBox.c_str()); 4791 throw setError(VBOX_E_FILE_ERROR, tr("Invalid VirtioSCSI controller type \"%s\""), hdcVBox.c_str()); 4805 4792 } 4806 4793 4807 4794 /* Now its time to register the machine before we add any storage devices */ 4808 rc = mVirtualBox->RegisterMachine(pNewMachine);4809 if (FAILED( rc)) throwrc;4795 hrc = mVirtualBox->RegisterMachine(pNewMachine); 4796 if (FAILED(hrc)) throw hrc; 4810 4797 4811 4798 // store new machine for roll-back in case of errors 4812 4799 Bstr bstrNewMachineId; 4813 rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam());4814 if (FAILED( rc)) throwrc;4800 hrc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam()); 4801 if (FAILED(hrc)) throw hrc; 4815 4802 Guid uuidNewMachine(bstrNewMachineId); 4816 4803 m->llGuidsMachinesCreated.push_back(uuidNewMachine); … … 4832 4819 { 4833 4820 // to attach things we need to open a session for the new machine 4834 rc = pNewMachine->LockMachine(stack.pSession, LockType_Write);4835 if (FAILED( rc)) throwrc;4821 hrc = pNewMachine->LockMachine(stack.pSession, LockType_Write); 4822 if (FAILED(hrc)) throw hrc; 4836 4823 stack.fSessionOpen = true; 4837 4824 4838 4825 ComPtr<IMachine> sMachine; 4839 rc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam());4840 if (FAILED( rc)) throwrc;4826 hrc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam()); 4827 if (FAILED(hrc)) throw hrc; 4841 4828 4842 4829 // floppy first … … 4844 4831 { 4845 4832 ComPtr<IStorageController> pController; 4846 rc = sMachine->AddStorageController(Bstr("Floppy").raw(), 4847 StorageBus_Floppy, 4848 pController.asOutParam()); 4849 if (FAILED(rc)) throw rc; 4833 hrc = sMachine->AddStorageController(Bstr("Floppy").raw(), StorageBus_Floppy, pController.asOutParam()); 4834 if (FAILED(hrc)) throw hrc; 4850 4835 4851 4836 Bstr bstrName; 4852 rc = pController->COMGETTER(Name)(bstrName.asOutParam());4853 if (FAILED( rc)) throwrc;4837 hrc = pController->COMGETTER(Name)(bstrName.asOutParam()); 4838 if (FAILED(hrc)) throw hrc; 4854 4839 4855 4840 // this is for rollback later … … 4862 4847 Log(("Attaching floppy\n")); 4863 4848 4864 rc = sMachine->AttachDevice(Bstr(mhda.controllerName).raw(),4865 mhda.lControllerPort,4866 mhda.lDevice,4867 DeviceType_Floppy,4868 NULL);4869 if (FAILED( rc)) throwrc;4849 hrc = sMachine->AttachDevice(Bstr(mhda.controllerName).raw(), 4850 mhda.lControllerPort, 4851 mhda.lDevice, 4852 DeviceType_Floppy, 4853 NULL); 4854 if (FAILED(hrc)) throw hrc; 4870 4855 4871 4856 stack.llHardDiskAttachments.push_back(mhda); 4872 4857 } 4873 4858 4874 rc = sMachine->SaveSettings();4875 if (FAILED( rc)) throwrc;4859 hrc = sMachine->SaveSettings(); 4860 if (FAILED(hrc)) throw hrc; 4876 4861 4877 4862 // only now that we're done with all storage devices, close the session 4878 rc = stack.pSession->UnlockMachine();4879 if (FAILED( rc)) throwrc;4863 hrc = stack.pSession->UnlockMachine(); 4864 if (FAILED(hrc)) throw hrc; 4880 4865 stack.fSessionOpen = false; 4881 4866 } … … 4918 4903 4919 4904 // to attach things we need to open a session for the new machine 4920 rc = pNewMachine->LockMachine(stack.pSession, LockType_Write);4921 if (FAILED( rc)) throwrc;4905 hrc = pNewMachine->LockMachine(stack.pSession, LockType_Write); 4906 if (FAILED(hrc)) throw hrc; 4922 4907 stack.fSessionOpen = true; 4923 4908 … … 4988 4973 } 4989 4974 l_skipped: 4990 rc = i_preCheckImageAvailability(stack);4991 if (SUCCEEDED( rc))4975 hrc = i_preCheckImageAvailability(stack); 4976 if (SUCCEEDED(hrc)) 4992 4977 { 4993 4978 /* current opened file isn't the same as passed one */ … … 5078 5063 5079 5064 Guid id(ovfVdisk.strDiskId); 5080 rc = mVirtualBox->i_findHardDiskById(id, false, &pTargetMedium);5081 if (FAILED( rc))5082 throw rc;5065 hrc = mVirtualBox->i_findHardDiskById(id, false, &pTargetMedium); 5066 if (FAILED(hrc)) 5067 throw hrc; 5083 5068 } 5084 5069 else … … 5092 5077 // now use the new uuid to attach the medium to our new machine 5093 5078 ComPtr<IMachine> sMachine; 5094 rc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam());5095 if (FAILED( rc))5096 throw rc;5079 hrc = stack.pSession->COMGETTER(Machine)(sMachine.asOutParam()); 5080 if (FAILED(hrc)) 5081 throw hrc; 5097 5082 5098 5083 // this is for rollback later … … 5165 5150 5166 5151 ULONG ulMaxPorts; 5167 rc = i_verifyStorageControllerPortValid(hdStorageControllerType, 5168 uNewControllerPortValue, 5169 &ulMaxPorts); 5170 if (FAILED(rc)) 5152 hrc = i_verifyStorageControllerPortValid(hdStorageControllerType, uNewControllerPortValue, &ulMaxPorts); 5153 if (FAILED(hrc)) 5171 5154 { 5172 if ( rc == E_INVALIDARG)5155 if (hrc == E_INVALIDARG) 5173 5156 { 5174 5157 const char *pcszSCType = Global::stringifyStorageControllerType(hdStorageControllerType); … … 5178 5161 } 5179 5162 else 5180 throw rc;5163 throw hrc; 5181 5164 } 5182 5165 … … 5197 5180 5198 5181 DeviceType_T devType = DeviceType_Null; 5199 rc = pTargetMedium->COMGETTER(DeviceType)(&devType);5200 if (FAILED( rc))5201 throw rc;5202 5203 rc = sMachine->AttachDevice(Bstr(mhda.controllerName).raw(),// name5204 mhda.lControllerPort, // long controllerPort5205 mhda.lDevice, // long device5206 devType, // DeviceType_T type5207 pTargetMedium);5208 if (FAILED( rc))5209 throw rc;5182 hrc = pTargetMedium->COMGETTER(DeviceType)(&devType); 5183 if (FAILED(hrc)) 5184 throw hrc; 5185 5186 hrc = sMachine->AttachDevice(Bstr(mhda.controllerName).raw(),// name 5187 mhda.lControllerPort, // long controllerPort 5188 mhda.lDevice, // long device 5189 devType, // DeviceType_T type 5190 pTargetMedium); 5191 if (FAILED(hrc)) 5192 throw hrc; 5210 5193 5211 5194 stack.llHardDiskAttachments.push_back(mhda); 5212 5195 5213 rc = sMachine->SaveSettings();5214 if (FAILED( rc))5215 throw rc;5196 hrc = sMachine->SaveSettings(); 5197 if (FAILED(hrc)) 5198 throw hrc; 5216 5199 5217 5200 ++cImportedDisks; … … 5229 5212 5230 5213 // only now that we're done with all disks, close the session 5231 rc = stack.pSession->UnlockMachine();5232 if (FAILED( rc))5233 throw rc;5214 hrc = stack.pSession->UnlockMachine(); 5215 if (FAILED(hrc)) 5216 throw hrc; 5234 5217 stack.fSessionOpen = false; 5235 5218 } … … 5285 5268 Assert(vsdescThis->m->pConfig); 5286 5269 5287 HRESULT rc = S_OK;5270 HRESULT hrc = S_OK; 5288 5271 5289 5272 settings::MachineConfigFile &config = *vsdescThis->m->pConfig; … … 5547 5530 } 5548 5531 l_skipped: 5549 rc = i_preCheckImageAvailability(stack);5550 if (SUCCEEDED( rc))5532 hrc = i_preCheckImageAvailability(stack); 5533 if (SUCCEEDED(hrc)) 5551 5534 { 5552 5535 /* current opened file isn't the same as passed one */ … … 5755 5738 { 5756 5739 ULONG ulMaxPorts; 5757 rc = i_verifyStorageControllerPortValid(SC.controllerType, 5758 uNewControllerPortValue, 5759 &ulMaxPorts); 5760 if (FAILED(rc)) 5740 hrc = i_verifyStorageControllerPortValid(SC.controllerType, uNewControllerPortValue, &ulMaxPorts); 5741 if (FAILED(hrc)) 5761 5742 { 5762 if ( rc == E_INVALIDARG)5743 if (hrc == E_INVALIDARG) 5763 5744 throw setError(E_INVALIDARG, 5764 5745 tr("Illegal channel: '%u'. For %s controllers the valid values are " 5765 5746 "0 to %lu (inclusive).\n"), uNewControllerPortValue, pcszSCType, ulMaxPorts-1); 5766 5747 else 5767 throw rc;5748 throw hrc; 5768 5749 } 5769 5750 … … 5898 5879 // the imported disk that was just created 5899 5880 Bstr hdId; 5900 rc = pTargetMedium->COMGETTER(Id)(hdId.asOutParam());5901 if (FAILED( rc)) throwrc;5881 hrc = pTargetMedium->COMGETTER(Id)(hdId.asOutParam()); 5882 if (FAILED(hrc)) throw hrc; 5902 5883 5903 5884 /* … … 5906 5887 */ 5907 5888 { 5908 rc = stack.saveOriginalUUIDOfAttachedDevice(d, Utf8Str(hdId));5889 hrc = stack.saveOriginalUUIDOfAttachedDevice(d, Utf8Str(hdId)); 5909 5890 d.uuid = hdId; 5910 5891 } … … 5941 5922 5942 5923 ComObjPtr<Machine> pNewMachine; 5943 rc = pNewMachine.createObject();5944 if (FAILED( rc)) throwrc;5924 hrc = pNewMachine.createObject(); 5925 if (FAILED(hrc)) throw hrc; 5945 5926 5946 5927 // this magic constructor fills the new machine object with the MachineConfig 5947 5928 // instance that we created from the vbox:Machine 5948 rc = pNewMachine->init(mVirtualBox,5949 stack.strNameVBox,// name from OVF preparations; can be suffixed to avoid duplicates5950 stack.strSettingsFilename,5951 config); // the whole machine config5952 if (FAILED( rc)) throwrc;5929 hrc = pNewMachine->init(mVirtualBox, 5930 stack.strNameVBox,// name from OVF preparations; can be suffixed to avoid duplicates 5931 stack.strSettingsFilename, 5932 config); // the whole machine config 5933 if (FAILED(hrc)) throw hrc; 5953 5934 5954 5935 pReturnNewMachine = ComPtr<IMachine>(pNewMachine); 5955 5936 5956 5937 // and register it 5957 rc = mVirtualBox->RegisterMachine(pNewMachine);5958 if (FAILED( rc)) throwrc;5938 hrc = mVirtualBox->RegisterMachine(pNewMachine); 5939 if (FAILED(hrc)) throw hrc; 5959 5940 5960 5941 // store new machine for roll-back in case of errors 5961 5942 Bstr bstrNewMachineId; 5962 rc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam());5963 if (FAILED( rc)) throwrc;5943 hrc = pNewMachine->COMGETTER(Id)(bstrNewMachineId.asOutParam()); 5944 if (FAILED(hrc)) throw hrc; 5964 5945 m->llGuidsMachinesCreated.push_back(Guid(bstrNewMachineId)); 5965 5946 … … 5976 5957 5977 5958 // create a session for the machine + disks we manipulate below 5978 HRESULT rc = stack.pSession.createInprocObject(CLSID_Session);5979 ComAssertComRCThrowRC( rc);5959 HRESULT hrc = stack.pSession.createInprocObject(CLSID_Session); 5960 ComAssertComRCThrowRC(hrc); 5980 5961 5981 5962 list<ovf::VirtualSystem>::const_iterator it; … … 6036 6017 strBaseFolder = vsdeBaseFolder.front()->strVBoxCurrent; 6037 6018 Bstr bstrSettingsFilename; 6038 rc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(),6039 Bstr(stack.strPrimaryGroup).raw(),6040 NULL /* aCreateFlags */,6041 Bstr(strBaseFolder).raw(),6042 bstrSettingsFilename.asOutParam());6043 if (FAILED( rc)) throwrc;6019 hrc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(), 6020 Bstr(stack.strPrimaryGroup).raw(), 6021 NULL /* aCreateFlags */, 6022 Bstr(strBaseFolder).raw(), 6023 bstrSettingsFilename.asOutParam()); 6024 if (FAILED(hrc)) throw hrc; 6044 6025 stack.strSettingsFilename = bstrSettingsFilename; 6045 6026 } … … 6121 6102 const Utf8Str &newlyUuid) 6122 6103 { 6123 HRESULT rc = S_OK;6104 HRESULT hrc = S_OK; 6124 6105 6125 6106 /* save for restoring */ 6126 6107 mapNewUUIDsToOriginalUUIDs.insert(std::make_pair(newlyUuid, device.uuid.toString())); 6127 6108 6128 return rc;6109 return hrc; 6129 6110 } 6130 6111 6131 6112 HRESULT Appliance::ImportStack::restoreOriginalUUIDOfAttachedDevice(settings::MachineConfigFile *config) 6132 6113 { 6133 HRESULT rc = S_OK;6134 6135 6114 settings::StorageControllersList &llControllers = config->hardwareMachine.storage.llStorageControllers; 6136 6115 settings::StorageControllersList::iterator itscl; … … 6155 6134 } 6156 6135 6157 return rc;6136 return S_OK; 6158 6137 } 6159 6138 -
trunk/src/VBox/Main/src-server/AudioAdapterImpl.cpp
r98262 r98288 332 332 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 333 333 334 HRESULT rc = S_OK;334 HRESULT hrc = S_OK; 335 335 336 336 if (m->bd->driverType != aAudioDriver) … … 348 348 { 349 349 AssertMsgFailed(("Wrong audio driver type %d\n", aAudioDriver)); 350 rc = E_FAIL;351 } 352 } 353 354 return rc;350 hrc = E_FAIL; 351 } 352 } 353 354 return hrc; 355 355 } 356 356 -
trunk/src/VBox/Main/src-server/AudioSettingsImpl.cpp
r98262 r98288 372 372 373 373 AudioControllerType_T audioController; 374 HRESULT rc = aGuestOsType->COMGETTER(RecommendedAudioController)(&audioController);375 if (FAILED( rc)) returnrc;376 377 rc = m->pAdapter->COMSETTER(AudioController)(audioController);378 if (FAILED( rc)) returnrc;374 HRESULT hrc = aGuestOsType->COMGETTER(RecommendedAudioController)(&audioController); 375 if (FAILED(hrc)) return hrc; 376 377 hrc = m->pAdapter->COMSETTER(AudioController)(audioController); 378 if (FAILED(hrc)) return hrc; 379 379 380 380 AudioCodecType_T audioCodec; 381 rc = aGuestOsType->COMGETTER(RecommendedAudioCodec)(&audioCodec);382 if (FAILED( rc)) returnrc;383 384 rc = m->pAdapter->COMSETTER(AudioCodec)(audioCodec);385 if (FAILED( rc)) returnrc;386 387 rc = m->pAdapter->COMSETTER(Enabled)(true);388 if (FAILED( rc)) returnrc;389 390 rc = m->pAdapter->COMSETTER(EnabledOut)(true);391 if (FAILED( rc)) returnrc;381 hrc = aGuestOsType->COMGETTER(RecommendedAudioCodec)(&audioCodec); 382 if (FAILED(hrc)) return hrc; 383 384 hrc = m->pAdapter->COMSETTER(AudioCodec)(audioCodec); 385 if (FAILED(hrc)) return hrc; 386 387 hrc = m->pAdapter->COMSETTER(Enabled)(true); 388 if (FAILED(hrc)) return hrc; 389 390 hrc = m->pAdapter->COMSETTER(EnabledOut)(true); 391 if (FAILED(hrc)) return hrc; 392 392 393 393 /* Note: We do NOT enable audio input by default due to security reasons! -
trunk/src/VBox/Main/src-server/BandwidthControlImpl.cpp
r98262 r98288 489 489 490 490 ComObjPtr<BandwidthGroup> group; 491 HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */);492 if (FAILED( rc)) returnrc;491 HRESULT hrc = i_getBandwidthGroupByName(aName, group, true /* aSetError */); 492 if (FAILED(hrc)) return hrc; 493 493 494 494 if (group->i_getReferences() != 0) … … 525 525 526 526 ComObjPtr<BandwidthGroup> group; 527 HRESULT rc = i_getBandwidthGroupByName(aName, group, true /* aSetError */); 528 529 if (SUCCEEDED(rc)) 527 HRESULT hrc = i_getBandwidthGroupByName(aName, group, true /* aSetError */); 528 if (SUCCEEDED(hrc)) 530 529 group.queryInterfaceTo(aBandwidthGroup.asOutParam()); 531 530 532 return rc;531 return hrc; 533 532 } 534 533 … … 548 547 HRESULT BandwidthControl::i_loadSettings(const settings::IOSettings &data) 549 548 { 550 HRESULT rc = S_OK;549 HRESULT hrc = S_OK; 551 550 552 551 AutoCaller autoCaller(this); … … 558 557 { 559 558 const settings::BandwidthGroup &gr = *it; 560 rc = createBandwidthGroup(gr.strName, gr.enmType, (LONG64)gr.cMaxBytesPerSec);561 if (FAILED( rc)) break;562 } 563 564 return rc;559 hrc = createBandwidthGroup(gr.strName, gr.enmType, (LONG64)gr.cMaxBytesPerSec); 560 if (FAILED(hrc)) break; 561 } 562 563 return hrc; 565 564 } 566 565 -
trunk/src/VBox/Main/src-server/CertificateImpl.cpp
r98103 r98288 111 111 HRESULT Certificate::initCertificate(PCRTCRX509CERTIFICATE a_pCert, bool a_fTrusted, bool a_fExpired) 112 112 { 113 HRESULT rc = S_OK;113 HRESULT hrc = S_OK; 114 114 LogFlowThisFuncEnter(); 115 115 … … 128 128 } 129 129 else 130 rc = Global::vboxStatusCodeToCOM(vrc);131 132 LogFlowThisFunc(("returns rc=%Rhrc\n",rc));133 return rc;130 hrc = Global::vboxStatusCodeToCOM(vrc); 131 132 LogFlowThisFunc(("returns hrc=%Rhrc\n", hrc)); 133 return hrc; 134 134 } 135 135 -
trunk/src/VBox/Main/src-server/ClientToken.cpp
r98103 r98288 260 260 #elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER) 261 261 ComObjPtr<MachineToken> pToken; 262 HRESULT rc = pToken.createObject();263 if (SUCCEEDED( rc))264 { 265 rc = pToken->init(pSessionMachine);266 if (SUCCEEDED( rc))262 HRESULT hrc = pToken.createObject(); 263 if (SUCCEEDED(hrc)) 264 { 265 hrc = pToken->init(pSessionMachine); 266 if (SUCCEEDED(hrc)) 267 267 { 268 268 mClientToken = pToken; 269 269 if (mClientToken) 270 270 { 271 rc = mClientToken->AddRef();272 if (FAILED( rc))271 hrc = mClientToken->AddRef(); 272 if (FAILED(hrc)) 273 273 mClientToken = NULL; 274 274 } … … 279 279 /* mClientTokenId isn't really used */ 280 280 mClientTokenId = pMachine->mData->m_strConfigFileFull; 281 AssertMsg(mClientToken, 282 ("Cannot create token '%s', rc=%Rhrc", 283 mClientTokenId.c_str(), rc)); 281 AssertMsg(mClientToken, ("Cannot create token '%s', hrc=%Rhrc", mClientTokenId.c_str(), hrc)); 284 282 #else 285 283 # error "Port me!" -
trunk/src/VBox/Main/src-server/ClientWatcher.cpp
r98103 r98288 873 873 } 874 874 875 int rc = RTSemEventWait(that->mUpdateReq, cMillies);875 int vrc = RTSemEventWait(that->mUpdateReq, cMillies); 876 876 877 877 /* … … 883 883 break; 884 884 885 if (RT_SUCCESS( rc) || update || updateSpawned)886 { 887 /* RT_SUCCESS( rc) means an update event is signaled */885 if (RT_SUCCESS(vrc) || update || updateSpawned) 886 { 887 /* RT_SUCCESS(vrc) means an update event is signaled */ 888 888 889 889 // get reference to the machines list in VirtualBox … … 893 893 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 894 894 895 if (RT_SUCCESS( rc) || update)895 if (RT_SUCCESS(vrc) || update) 896 896 { 897 897 /* obtain a new set of opened machines */ … … 911 911 } 912 912 913 if (RT_SUCCESS( rc) || updateSpawned)913 if (RT_SUCCESS(vrc) || updateSpawned) 914 914 { 915 915 /* obtain a new set of spawned machines */ … … 982 982 } 983 983 984 int rc = RTSemEventWait(that->mUpdateReq, cMillies);984 int vrc = RTSemEventWait(that->mUpdateReq, cMillies); 985 985 986 986 /* … … 998 998 * from the pid to the corresponding machine object. Both cases do 999 999 * more or less the same thing anyway. */ 1000 if (RT_SUCCESS( rc) || updateSpawned)1001 { 1002 /* RT_SUCCESS( rc) means an update event is signaled */1000 if (RT_SUCCESS(vrc) || updateSpawned) 1001 { 1002 /* RT_SUCCESS(vrc) means an update event is signaled */ 1003 1003 1004 1004 // get reference to the machines list in VirtualBox … … 1008 1008 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1009 1009 1010 if (RT_SUCCESS( rc) || updateSpawned)1010 if (RT_SUCCESS(vrc) || updateSpawned) 1011 1011 { 1012 1012 /* obtain a new set of spawned machines */ -
trunk/src/VBox/Main/src-server/CloudNetworkImpl.cpp
r98262 r98288 168 168 169 169 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 170 HRESULT rc = m->pVirtualBox->i_saveSettings();171 ComAssertComRCRetRC( rc);170 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 171 ComAssertComRCRetRC(hrc); 172 172 return S_OK; 173 173 } … … 190 190 191 191 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 192 HRESULT rc = m->pVirtualBox->i_saveSettings();193 ComAssertComRCRetRC( rc);192 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 193 ComAssertComRCRetRC(hrc); 194 194 return S_OK; 195 195 } … … 212 212 213 213 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 214 HRESULT rc = m->pVirtualBox->i_saveSettings();215 ComAssertComRCRetRC( rc);214 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 215 ComAssertComRCRetRC(hrc); 216 216 return S_OK; 217 217 } … … 234 234 235 235 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 236 HRESULT rc = m->pVirtualBox->i_saveSettings();237 ComAssertComRCRetRC( rc);236 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 237 ComAssertComRCRetRC(hrc); 238 238 return S_OK; 239 239 } … … 256 256 257 257 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 258 HRESULT rc = m->pVirtualBox->i_saveSettings();259 ComAssertComRCRetRC( rc);260 return S_OK; 261 } 262 258 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 259 ComAssertComRCRetRC(hrc); 260 return S_OK; 261 } 262 -
trunk/src/VBox/Main/src-server/DHCPConfigImpl.cpp
r98103 r98288 392 392 */ 393 393 DhcpOption *pParsed = NULL; 394 int rc= VINF_SUCCESS;394 int vrc = VINF_SUCCESS; 395 395 try 396 396 { 397 pParsed = DhcpOption::parse((uint8_t)aOption, aEncoding, aValue.c_str(), & rc);397 pParsed = DhcpOption::parse((uint8_t)aOption, aEncoding, aValue.c_str(), &vrc); 398 398 } 399 399 catch (std::bad_alloc &) … … 423 423 } 424 424 425 if ( rc == VERR_WRONG_TYPE)425 if (vrc == VERR_WRONG_TYPE) 426 426 return m_pHack->setError(E_INVALIDARG, tr("Unsupported encoding %d (option %d, value %s)"), 427 427 (int)aEncoding, (int)aOption, aValue.c_str()); 428 if ( rc == VERR_NOT_SUPPORTED)428 if (vrc == VERR_NOT_SUPPORTED) 429 429 return m_pHack->setError(E_INVALIDARG, tr("Unsupported option %d (encoding %d, value %s)"), 430 430 (int)aOption, (int)aEncoding, aValue.c_str()); 431 return m_pHack->setError(E_INVALIDARG, tr("Malformed option %d value '%s' (encoding %d, rc=%Rrc)"),432 (int)aOption, aValue.c_str(), (int)aEncoding, rc);431 return m_pHack->setError(E_INVALIDARG, tr("Malformed option %d value '%s' (encoding %d, vrc=%Rrc)"), 432 (int)aOption, aValue.c_str(), (int)aEncoding, vrc); 433 433 } 434 434 -
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r98103 r98288 198 198 LogRel2(("HostDnsMonitor: starting thread ...\n")); 199 199 200 int rc = RTSemEventCreate(&m->hMonitorThreadEvent);201 AssertRCReturn( rc, E_FAIL);202 203 rc = RTThreadCreate(&m->hMonitorThread,204 HostDnsServiceBase::threadMonitorProc,205 this, 128 * _1K, RTTHREADTYPE_IO,206 RTTHREADFLAGS_WAITABLE, "dns-monitor");207 AssertRCReturn( rc, E_FAIL);200 int vrc = RTSemEventCreate(&m->hMonitorThreadEvent); 201 AssertRCReturn(vrc, E_FAIL); 202 203 vrc = RTThreadCreate(&m->hMonitorThread, 204 HostDnsServiceBase::threadMonitorProc, 205 this, 128 * _1K, RTTHREADTYPE_IO, 206 RTTHREADFLAGS_WAITABLE, "dns-monitor"); 207 AssertRCReturn(vrc, E_FAIL); 208 208 209 209 RTSemEventWait(m->hMonitorThreadEvent, RT_INDEFINITE_WAIT); … … 227 227 monitorThreadShutdown(uTimeoutMs); 228 228 229 int rc = RTThreadWait(m->hMonitorThread, uTimeoutMs, NULL);230 if (RT_FAILURE( rc))231 LogRel(("HostDnsMonitor: waiting for thread failed with rc=%Rrc\n",rc));229 int vrc = RTThreadWait(m->hMonitorThread, uTimeoutMs, NULL); 230 if (RT_FAILURE(vrc)) 231 LogRel(("HostDnsMonitor: waiting for thread failed with vrc=%Rrc\n", vrc)); 232 232 233 233 if (m->hMonitorThreadEvent != NIL_RTSEMEVENT) -
trunk/src/VBox/Main/src-server/HostDnsServiceResolvConf.cpp
r98103 r98288 106 106 107 107 st.rcps_flags = RCPSF_NO_STR2IPCONV; 108 int rc = rcp_parse(&st, m->resolvConfFilename.c_str());109 if ( rc == -1)108 int vrc = rcp_parse(&st, m->resolvConfFilename.c_str()); 109 if (vrc == -1) 110 110 return S_OK; 111 111 -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r98262 r98288 387 387 { 388 388 const char *pszIgn; 389 int rc = SUPR3QueryVTxSupported(&pszIgn);390 if (RT_SUCCESS( rc))389 int vrc = SUPR3QueryVTxSupported(&pszIgn); 390 if (RT_SUCCESS(vrc)) 391 391 m->fVTSupported = true; 392 392 } … … 590 590 591 591 MediaList *pList; 592 HRESULT rc = i_getDrives(DeviceType_DVD, true /* fRefresh */, pList, treeLock);593 if (FAILED( rc))594 return rc;592 HRESULT vrc = i_getDrives(DeviceType_DVD, true /* fRefresh */, pList, treeLock); 593 if (FAILED(vrc)) 594 return vrc; 595 595 596 596 aDVDDrives.resize(pList->size()); … … 613 613 614 614 MediaList *pList; 615 HRESULT rc = i_getDrives(DeviceType_Floppy, true /* fRefresh */, pList, treeLock);616 if (FAILED( rc))617 return rc;615 HRESULT vrc = i_getDrives(DeviceType_Floppy, true /* fRefresh */, pList, treeLock); 616 if (FAILED(vrc)) 617 return vrc; 618 618 619 619 aFloppyDrives.resize(pList->size()); … … 635 635 GUID IfGuid; 636 636 HRESULT hr; 637 int rc = VERR_GENERAL_FAILURE;637 int vrc = VERR_GENERAL_FAILURE; 638 638 639 639 hr = pncc->GetDisplayName(&lpszName); … … 655 655 // iface->setVirtualBox(m->pParent); 656 656 pPist->push_back(iface); 657 rc = VINF_SUCCESS;657 vrc = VINF_SUCCESS; 658 658 } 659 659 else … … 665 665 } 666 666 667 return rc;667 return vrc; 668 668 } 669 669 #endif /* defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT) */ … … 830 830 #if defined(RT_OS_WINDOWS) || defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/ 831 831 # ifdef VBOX_WITH_HOSTNETIF_API 832 HRESULT rc = i_updateNetIfList();833 if (FAILED( rc))834 { 835 Log(("Failed to update host network interface list with rc=%Rhrc\n",rc));836 return rc;832 HRESULT vrc = i_updateNetIfList(); 833 if (FAILED(vrc)) 834 { 835 Log(("Failed to update host network interface list with vrc=%Rhrc\n", vrc)); 836 return vrc; 837 837 } 838 838 #if defined(RT_OS_WINDOWS) 839 rc = i_updatePersistentConfigForHostOnlyAdapters();840 if (FAILED( rc))841 { 842 LogRel(("Failed to update persistent config for host-only adapters with rc=%Rhrc\n",rc));843 return rc;839 vrc = i_updatePersistentConfigForHostOnlyAdapters(); 840 if (FAILED(vrc)) 841 { 842 LogRel(("Failed to update persistent config for host-only adapters with vrc=%Rhrc\n", vrc)); 843 return vrc; 844 844 } 845 845 #endif /* defined(RT_OS_WINDOWS) */ … … 1032 1032 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1033 1033 1034 MultiResult rc = i_checkUSBProxyService();1035 if (FAILED( rc) || SUCCEEDED_WARNING(rc))1036 return rc;1034 MultiResult vrc = i_checkUSBProxyService(); 1035 if (FAILED(vrc) || SUCCEEDED_WARNING(vrc)) 1036 return vrc; 1037 1037 1038 1038 return m->pUSBProxyService->getDeviceCollection(aUSBDevices); … … 1081 1081 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1082 1082 1083 MultiResult rc = i_checkUSBProxyService();1084 if (FAILED( rc))1085 return rc;1083 MultiResult vrc = i_checkUSBProxyService(); 1084 if (FAILED(vrc)) 1085 return vrc; 1086 1086 1087 1087 aUSBDeviceFilters.resize(m->llUSBDeviceFilters.size()); … … 1090 1090 (*it).queryInterfaceTo(aUSBDeviceFilters[i].asOutParam()); 1091 1091 1092 return rc;1092 return vrc; 1093 1093 #else 1094 1094 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 1209 1209 { 1210 1210 /* Perhaps the driver is available now... */ 1211 int rc = SUPR3InitEx(SUPR3INIT_F_LIMITED, NULL);1212 if (RT_SUCCESS( rc))1211 int vrc = SUPR3InitEx(SUPR3INIT_F_LIMITED, NULL); 1212 if (RT_SUCCESS(vrc)) 1213 1213 { 1214 1214 uint32_t fVTCaps; 1215 rc = SUPR3QueryVTCaps(&fVTCaps);1216 AssertMsg(RT_SUCCESS( rc) || rc == VERR_SUP_DRIVERLESS, ("SUPR3QueryVTCaps failed rc=%Rrc\n",rc));1215 vrc = SUPR3QueryVTCaps(&fVTCaps); 1216 AssertMsg(RT_SUCCESS(vrc) || vrc == VERR_SUP_DRIVERLESS, ("SUPR3QueryVTCaps failed vrc=%Rrc\n", vrc)); 1217 1217 1218 1218 SUPR3Term(false); 1219 1219 1220 1220 AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS); 1221 if (RT_FAILURE( rc))1221 if (RT_FAILURE(vrc)) 1222 1222 { 1223 1223 fVTCaps = 0; 1224 if ( rc != VERR_SUP_DRIVERLESS)1225 LogRel(("SUPR0QueryVTCaps -> %Rrc\n", rc));1224 if (vrc != VERR_SUP_DRIVERLESS) 1225 LogRel(("SUPR0QueryVTCaps -> %Rrc\n", vrc)); 1226 1226 # if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) /* Preserve detected VT-x/AMD-V support for show. */ 1227 1227 else … … 1376 1376 1377 1377 uint64_t cb; 1378 int rc = RTSystemQueryTotalRam(&cb);1379 if (RT_FAILURE( rc))1378 int vrc = RTSystemQueryTotalRam(&cb); 1379 if (RT_FAILURE(vrc)) 1380 1380 return E_FAIL; 1381 1381 *aSize = (ULONG)(cb / _1M); … … 1394 1394 1395 1395 uint64_t cb; 1396 int rc = RTSystemQueryAvailableRam(&cb);1397 if (RT_FAILURE( rc))1396 int vrc = RTSystemQueryAvailableRam(&cb); 1397 if (RT_FAILURE(vrc)) 1398 1398 return E_FAIL; 1399 1399 *aAvailable = (ULONG)(cb / _1M); … … 1572 1572 1573 1573 Bstr name; 1574 HRESULT rc;1574 HRESULT hrc; 1575 1575 1576 1576 /* first check whether an interface with the given name already exists */ 1577 1577 { 1578 1578 ComPtr<IHostNetworkInterface> iface; 1579 rc = findHostNetworkInterfaceById(aId, iface);1580 if (FAILED( rc))1579 hrc = findHostNetworkInterfaceById(aId, iface); 1580 if (FAILED(hrc)) 1581 1581 return setError(VBOX_E_OBJECT_NOT_FOUND, 1582 1582 tr("Host network interface with UUID {%RTuuid} does not exist"), 1583 1583 Guid(aId).raw()); 1584 rc = iface->COMGETTER(Name)(name.asOutParam());1585 ComAssertComRCRet( rc,rc);1586 } 1587 1588 int r= NetIfRemoveHostOnlyNetworkInterface(m->pParent, aId, aProgress.asOutParam());1589 if (RT_SUCCESS( r))1584 hrc = iface->COMGETTER(Name)(name.asOutParam()); 1585 ComAssertComRCRet(hrc, hrc); 1586 } 1587 1588 int vrc = NetIfRemoveHostOnlyNetworkInterface(m->pParent, aId, aProgress.asOutParam()); 1589 if (RT_SUCCESS(vrc)) 1590 1590 { 1591 1591 /* Drop configuration parameters for removed interface */ 1592 1592 #ifdef RT_OS_WINDOWS 1593 rc = i_removePersistentConfig(Utf8StrFmt("%RTuuid", &aId));1594 if (FAILED( rc))1595 LogRel(("i_removePersistentConfig(%RTuuid) failed with 0x%x\n", &aId, rc));1593 hrc = i_removePersistentConfig(Utf8StrFmt("%RTuuid", &aId)); 1594 if (FAILED(hrc)) 1595 LogRel(("i_removePersistentConfig(%RTuuid) failed with 0x%x\n", &aId, hrc)); 1596 1596 #else /* !RT_OS_WINDOWS */ 1597 rc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", name.raw()).raw(), NULL);1598 rc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", name.raw()).raw(), NULL);1599 rc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", name.raw()).raw(), NULL);1600 rc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask", name.raw()).raw(), NULL);1597 hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPAddress", name.raw()).raw(), NULL); 1598 hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPNetMask", name.raw()).raw(), NULL); 1599 hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPV6Address", name.raw()).raw(), NULL); 1600 hrc = m->pParent->SetExtraData(BstrFmt("HostOnly/%ls/IPV6NetMask", name.raw()).raw(), NULL); 1601 1601 #endif /* !RT_OS_WINDOWS */ 1602 1602 … … 1604 1604 } 1605 1605 1606 return r== VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;1606 return vrc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL; 1607 1607 #else 1608 1608 RT_NOREF(aId, aProgress); … … 1620 1620 ComObjPtr<HostUSBDeviceFilter> filter; 1621 1621 filter.createObject(); 1622 HRESULT rc = filter->init(this, Bstr(aName).raw());1623 ComAssertComRCRet( rc,rc);1624 rc = filter.queryInterfaceTo(aFilter.asOutParam());1625 AssertComRCReturn( rc,rc);1622 HRESULT hrc = filter->init(this, Bstr(aName).raw()); 1623 ComAssertComRCRet(hrc, hrc); 1624 hrc = filter.queryInterfaceTo(aFilter.asOutParam()); 1625 AssertComRCReturn(hrc, hrc); 1626 1626 return S_OK; 1627 1627 #else … … 1642 1642 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1643 1643 1644 MultiResult rc= i_checkUSBProxyService();1645 if (FAILED( rc))1646 return rc;1644 MultiResult hrcMult = i_checkUSBProxyService(); 1645 if (FAILED(hrcMult)) 1646 return hrcMult; 1647 1647 1648 1648 ComObjPtr<HostUSBDeviceFilter> pFilter; … … 1683 1683 alock.release(); 1684 1684 AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS); 1685 return rc= m->pParent->i_saveSettings();1685 return hrcMult = m->pParent->i_saveSettings(); 1686 1686 #else 1687 1687 … … 1701 1701 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1702 1702 1703 MultiResult rc= i_checkUSBProxyService();1704 if (FAILED( rc))1705 return rc;1703 MultiResult hrcMult = i_checkUSBProxyService(); 1704 if (FAILED(hrcMult)) 1705 return hrcMult; 1706 1706 1707 1707 if (!m->llUSBDeviceFilters.size()) … … 1737 1737 alock.release(); 1738 1738 AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS); 1739 return rc= m->pParent->i_saveSettings();1739 return hrcMult = m->pParent->i_saveSettings(); 1740 1740 #else 1741 1741 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 1751 1751 { 1752 1752 ComObjPtr<Medium> medium; 1753 HRESULT rc = i_findHostDriveByNameOrId(DeviceType_DVD, aName, medium);1754 if (SUCCEEDED( rc))1755 rc = medium.queryInterfaceTo(aDrive.asOutParam());1753 HRESULT hrc = i_findHostDriveByNameOrId(DeviceType_DVD, aName, medium); 1754 if (SUCCEEDED(hrc)) 1755 hrc = medium.queryInterfaceTo(aDrive.asOutParam()); 1756 1756 else 1757 rc = setError(rc, tr("The host DVD drive named '%s' could not be found"), aName.c_str());1758 return rc;1757 hrc = setError(hrc, tr("The host DVD drive named '%s' could not be found"), aName.c_str()); 1758 return hrc; 1759 1759 } 1760 1760 … … 1765 1765 ComObjPtr<Medium>medium; 1766 1766 1767 HRESULT rc = i_findHostDriveByNameOrId(DeviceType_Floppy, aName, medium);1768 if (SUCCEEDED( rc))1767 HRESULT hrc = i_findHostDriveByNameOrId(DeviceType_Floppy, aName, medium); 1768 if (SUCCEEDED(hrc)) 1769 1769 return medium.queryInterfaceTo(aDrive.asOutParam()); 1770 else 1771 return setError(rc, tr("The host floppy drive named '%s' could not be found"), aName.c_str()); 1770 return setError(hrc, tr("The host floppy drive named '%s' could not be found"), aName.c_str()); 1772 1771 } 1773 1772 … … 1782 1781 return E_INVALIDARG; 1783 1782 1784 HRESULT rc = i_updateNetIfList();1785 if (FAILED( rc))1786 { 1787 Log(("Failed to update host network interface list with rc=%Rhrc\n",rc));1788 return rc;1783 HRESULT hrc = i_updateNetIfList(); 1784 if (FAILED(hrc)) 1785 { 1786 Log(("Failed to update host network interface list with hrc=%Rhrc\n", hrc)); 1787 return hrc; 1789 1788 } 1790 1789 #if defined(RT_OS_WINDOWS) 1791 rc = i_updatePersistentConfigForHostOnlyAdapters();1792 if (FAILED( rc))1793 { 1794 LogRel(("Failed to update persistent config for host-only adapters with rc=%Rhrc\n",rc));1795 return rc;1790 hrc = i_updatePersistentConfigForHostOnlyAdapters(); 1791 if (FAILED(hrc)) 1792 { 1793 LogRel(("Failed to update persistent config for host-only adapters with hrc=%Rhrc\n", hrc)); 1794 return hrc; 1796 1795 } 1797 1796 #endif /* defined(RT_OS_WINDOWS) */ … … 1826 1825 return E_INVALIDARG; 1827 1826 1828 HRESULT rc = i_updateNetIfList();1829 if (FAILED( rc))1830 { 1831 Log(("Failed to update host network interface list with rc=%Rhrc\n",rc));1832 return rc;1827 HRESULT hrc = i_updateNetIfList(); 1828 if (FAILED(hrc)) 1829 { 1830 Log(("Failed to update host network interface list with hrc=%Rhrc\n", hrc)); 1831 return hrc; 1833 1832 } 1834 1833 #if defined(RT_OS_WINDOWS) 1835 rc = i_updatePersistentConfigForHostOnlyAdapters();1836 if (FAILED( rc))1837 { 1838 LogRel(("Failed to update persistent config for host-only adapters with rc=%Rhrc\n",rc));1839 return rc;1834 hrc = i_updatePersistentConfigForHostOnlyAdapters(); 1835 if (FAILED(hrc)) 1836 { 1837 LogRel(("Failed to update persistent config for host-only adapters with hrc=%Rhrc\n", hrc)); 1838 return hrc; 1840 1839 } 1841 1840 #endif /* defined(RT_OS_WINDOWS) */ … … 1864 1863 { 1865 1864 #ifdef VBOX_WITH_HOSTNETIF_API 1866 HRESULT rc = i_updateNetIfList();1867 if (FAILED( rc))1868 { 1869 Log(("Failed to update host network interface list with rc=%Rhrc\n",rc));1870 return rc;1865 HRESULT hrc = i_updateNetIfList(); 1866 if (FAILED(hrc)) 1867 { 1868 Log(("Failed to update host network interface list with hrc=%Rhrc\n", hrc)); 1869 return hrc; 1871 1870 } 1872 1871 #if defined(RT_OS_WINDOWS) 1873 rc = i_updatePersistentConfigForHostOnlyAdapters();1874 if (FAILED( rc))1875 { 1876 LogRel(("Failed to update persistent config for host-only adapters with rc=%Rhrc\n",rc));1877 return rc;1872 hrc = i_updatePersistentConfigForHostOnlyAdapters(); 1873 if (FAILED(hrc)) 1874 { 1875 LogRel(("Failed to update persistent config for host-only adapters with hrc=%Rhrc\n", hrc)); 1876 return hrc; 1878 1877 } 1879 1878 #endif /* defined(RT_OS_WINDOWS) */ … … 1913 1912 aDevice = NULL; 1914 1913 SafeIfaceArray<IHostUSBDevice> devsvec; 1915 HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));1916 if (FAILED( rc))1917 return rc;1914 HRESULT hrc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec)); 1915 if (FAILED(hrc)) 1916 return hrc; 1918 1917 1919 1918 for (size_t i = 0; i < devsvec.size(); ++i) 1920 1919 { 1921 1920 Bstr address; 1922 rc = devsvec[i]->COMGETTER(Address)(address.asOutParam());1923 if (FAILED( rc))1924 return rc;1921 hrc = devsvec[i]->COMGETTER(Address)(address.asOutParam()); 1922 if (FAILED(hrc)) 1923 return hrc; 1925 1924 if (address == aName) 1926 1925 { … … 1948 1947 1949 1948 SafeIfaceArray<IHostUSBDevice> devsvec; 1950 HRESULT rc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec));1951 if (FAILED( rc))1952 return rc;1949 HRESULT hrc = COMGETTER(USBDevices)(ComSafeArrayAsOutParam(devsvec)); 1950 if (FAILED(hrc)) 1951 return hrc; 1953 1952 1954 1953 for (size_t i = 0; i < devsvec.size(); ++i) 1955 1954 { 1956 1955 Bstr id; 1957 rc = devsvec[i]->COMGETTER(Id)(id.asOutParam());1958 if (FAILED( rc))1959 return rc;1956 hrc = devsvec[i]->COMGETTER(Id)(id.asOutParam()); 1957 if (FAILED(hrc)) 1958 return hrc; 1960 1959 if (Guid(id) == aId) 1961 1960 { … … 1991 1990 HostVideoInputDeviceList list; 1992 1991 1993 HRESULT rc = HostVideoInputDevice::queryHostDevices(m->pParent, &list);1994 if (FAILED( rc))1995 return rc;1992 HRESULT hrc = HostVideoInputDevice::queryHostDevices(m->pParent, &list); 1993 if (FAILED(hrc)) 1994 return hrc; 1996 1995 1997 1996 aVideoInputDevices.resize(list.size()); … … 2077 2076 HRESULT Host::i_loadSettings(const settings::Host &data) 2078 2077 { 2079 HRESULT rc = S_OK;2078 HRESULT hrc = S_OK; 2080 2079 #ifdef VBOX_WITH_USB 2081 2080 AutoCaller autoCaller(this); … … 2092 2091 ComObjPtr<HostUSBDeviceFilter> pFilter; 2093 2092 pFilter.createObject(); 2094 rc = pFilter->init(this, f);2095 if (FAILED( rc))2093 hrc = pFilter->init(this, f); 2094 if (FAILED(hrc)) 2096 2095 break; 2097 2096 … … 2107 2106 } 2108 2107 2109 rc = m->pUSBProxyService->i_loadSettings(data.llUSBDeviceSources);2108 hrc = m->pUSBProxyService->i_loadSettings(data.llUSBDeviceSources); 2110 2109 #else 2111 2110 RT_NOREF(data); … … 2113 2112 2114 2113 #ifdef VBOX_WITH_UPDATE_AGENT 2115 rc = m->pUpdateHost->i_loadSettings(data.updateHost);2116 ComAssertComRCRet( rc,rc);2114 hrc = m->pUpdateHost->i_loadSettings(data.updateHost); 2115 ComAssertComRCRet(hrc, hrc); 2117 2116 /** @todo Add handling for ExtPack and Guest Additions updates here later. See @bugref{7983}. */ 2118 2117 #endif 2119 2118 2120 return rc;2119 return hrc; 2121 2120 } 2122 2121 … … 2129 2128 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2130 2129 2131 HRESULT rc;2130 HRESULT hrc; 2132 2131 2133 2132 #ifdef VBOX_WITH_USB … … 2145 2144 } 2146 2145 2147 rc = m->pUSBProxyService->i_saveSettings(data.llUSBDeviceSources);2148 ComAssertComRCRet( rc,rc);2146 hrc = m->pUSBProxyService->i_saveSettings(data.llUSBDeviceSources); 2147 ComAssertComRCRet(hrc, hrc); 2149 2148 #else 2150 2149 RT_NOREF(data); … … 2152 2151 2153 2152 #ifdef VBOX_WITH_UPDATE_AGENT 2154 rc = m->pUpdateHost->i_saveSettings(data.updateHost);2155 ComAssertComRCRet( rc,rc);2153 hrc = m->pUpdateHost->i_saveSettings(data.updateHost); 2154 ComAssertComRCRet(hrc, hrc); 2156 2155 /** @todo Add handling for ExtPack and Guest Additions updates here later. See @bugref{7983}. */ 2157 2156 #endif … … 2183 2182 AutoWriteLock &treeLock) 2184 2183 { 2185 HRESULT rc = S_OK;2184 HRESULT hrc = S_OK; 2186 2185 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2187 2186 … … 2195 2194 if (!m->fDVDDrivesListBuilt || fRefresh) 2196 2195 { 2197 rc = i_buildDVDDrivesList(llNew);2198 if (FAILED( rc))2199 return rc;2196 hrc = i_buildDVDDrivesList(llNew); 2197 if (FAILED(hrc)) 2198 return hrc; 2200 2199 pfListBuilt = &m->fDVDDrivesListBuilt; 2201 2200 } … … 2206 2205 if (!m->fFloppyDrivesListBuilt || fRefresh) 2207 2206 { 2208 rc = i_buildFloppyDrivesList(llNew);2209 if (FAILED( rc))2210 return rc;2207 hrc = i_buildFloppyDrivesList(llNew); 2208 if (FAILED(hrc)) 2209 return hrc; 2211 2210 pfListBuilt = &m->fFloppyDrivesListBuilt; 2212 2211 } … … 2299 2298 treeLock.acquire(); 2300 2299 2301 return rc;2300 return hrc; 2302 2301 } 2303 2302 … … 2321 2320 2322 2321 AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 2323 HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock);2324 if (SUCCEEDED( rc))2322 HRESULT hrc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock); 2323 if (SUCCEEDED(hrc)) 2325 2324 { 2326 2325 for (MediaList::iterator it = pllMedia->begin(); … … 2361 2360 2362 2361 AutoWriteLock treeLock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 2363 HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock);2364 if (SUCCEEDED( rc))2362 HRESULT hrc = i_getDrives(mediumType, fRefresh, pllMedia, treeLock); 2363 if (SUCCEEDED(hrc)) 2365 2364 { 2366 2365 for (MediaList::iterator it = pllMedia->begin(); … … 2413 2412 HRESULT Host::i_buildDVDDrivesList(MediaList &list) 2414 2413 { 2415 HRESULT rc = S_OK;2414 HRESULT hrc = S_OK; 2416 2415 2417 2416 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); … … 2451 2450 if (RT_SUCCESS(m->hostDrives.updateDVDs())) 2452 2451 for (DriveInfoList::const_iterator it = m->hostDrives.DVDBegin(); 2453 SUCCEEDED( rc) && it != m->hostDrives.DVDEnd(); ++it)2452 SUCCEEDED(hrc) && it != m->hostDrives.DVDEnd(); ++it) 2454 2453 { 2455 2454 ComObjPtr<Medium> hostDVDDriveObj; 2456 2455 Utf8Str location(it->mDevice); 2457 2456 Utf8Str description(it->mDescription); 2458 if (SUCCEEDED( rc))2459 rc = hostDVDDriveObj.createObject();2460 if (SUCCEEDED( rc))2461 rc = hostDVDDriveObj->init(m->pParent, DeviceType_DVD, location, description);2462 if (SUCCEEDED( rc))2457 if (SUCCEEDED(hrc)) 2458 hrc = hostDVDDriveObj.createObject(); 2459 if (SUCCEEDED(hrc)) 2460 hrc = hostDVDDriveObj->init(m->pParent, DeviceType_DVD, location, description); 2461 if (SUCCEEDED(hrc)) 2463 2462 list.push_back(hostDVDDriveObj); 2464 2463 } … … 2481 2480 #endif 2482 2481 } 2483 catch (std::bad_alloc &)2484 { 2485 rc = E_OUTOFMEMORY;2486 } 2487 return rc;2482 catch (std::bad_alloc &) 2483 { 2484 hrc = E_OUTOFMEMORY; 2485 } 2486 return hrc; 2488 2487 } 2489 2488 … … 2495 2494 HRESULT Host::i_buildFloppyDrivesList(MediaList &list) 2496 2495 { 2497 HRESULT rc = S_OK;2496 HRESULT hrc = S_OK; 2498 2497 2499 2498 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); … … 2524 2523 if (RT_SUCCESS(m->hostDrives.updateFloppies())) 2525 2524 for (DriveInfoList::const_iterator it = m->hostDrives.FloppyBegin(); 2526 SUCCEEDED( rc) && it != m->hostDrives.FloppyEnd(); ++it)2525 SUCCEEDED(hrc) && it != m->hostDrives.FloppyEnd(); ++it) 2527 2526 { 2528 2527 ComObjPtr<Medium> hostFloppyDriveObj; 2529 2528 Utf8Str location(it->mDevice); 2530 2529 Utf8Str description(it->mDescription); 2531 if (SUCCEEDED( rc))2532 rc = hostFloppyDriveObj.createObject();2533 if (SUCCEEDED( rc))2534 rc = hostFloppyDriveObj->init(m->pParent, DeviceType_Floppy, location, description);2535 if (SUCCEEDED( rc))2530 if (SUCCEEDED(hrc)) 2531 hrc = hostFloppyDriveObj.createObject(); 2532 if (SUCCEEDED(hrc)) 2533 hrc = hostFloppyDriveObj->init(m->pParent, DeviceType_Floppy, location, description); 2534 if (SUCCEEDED(hrc)) 2536 2535 list.push_back(hostFloppyDriveObj); 2537 2536 } … … 2543 2542 catch(std::bad_alloc &) 2544 2543 { 2545 rc = E_OUTOFMEMORY;2546 } 2547 2548 return rc;2544 hrc = E_OUTOFMEMORY; 2545 } 2546 2547 return hrc; 2549 2548 } 2550 2549 … … 2910 2909 2911 2910 const char *pszDevPath = pszDisk ? pszDisk : pszPartition0 ? pszPartition0 : pszSlice0; 2912 int rc = RTStrCopy(pDrive->szRawDiskPath, sizeof(pDrive->szRawDiskPath), pszDevPath);2913 AssertRC( rc);2911 int hrc = RTStrCopy(pDrive->szRawDiskPath, sizeof(pDrive->szRawDiskPath), pszDevPath); 2912 AssertRC(hrc); 2914 2913 2915 2914 if (*ppDrives) … … 3647 3646 * to cause update starvation. */ 3648 3647 HostNetworkInterfaceList list; 3649 int rc = NetIfList(list);3650 if ( rc)3651 { 3652 Log(("Failed to get host network interface list with rc=%Rrc\n",rc));3648 int vrc = NetIfList(list); 3649 if (RT_FAILURE(vrc)) 3650 { 3651 Log(("Failed to get host network interface list with vrc=%Rrc\n", vrc)); 3653 3652 return E_FAIL; 3654 3653 } … … 3767 3766 /* For now we are concerned with the root file system only. */ 3768 3767 pm::DiskList disksUsage, disksLoad; 3769 int rc = hal->getDiskListByFs("/", disksUsage, disksLoad);3770 if (RT_FAILURE( rc))3768 int hrc = hal->getDiskListByFs("/", disksUsage, disksLoad); 3769 if (RT_FAILURE(hrc)) 3771 3770 return; 3772 3771 pm::DiskList::iterator it; … … 3972 3971 uint32_t offError; 3973 3972 RTVFSDIR hVfsDir; 3974 int rc = RTVfsChainOpenDir("\\\\:iprtnt:\\GLOBAL??", 0 /*fFlags*/, &hVfsDir, &offError, RTErrInfoInitStatic(&ErrInfo));3975 if (RT_FAILURE( rc))3976 return setError(E_FAIL, tr("Failed to open NT\\GLOBAL?? (error %Rrc)"), rc);3973 int vrc = RTVfsChainOpenDir("\\\\:iprtnt:\\GLOBAL??", 0 /*fFlags*/, &hVfsDir, &offError, RTErrInfoInitStatic(&ErrInfo)); 3974 if (RT_FAILURE(vrc)) 3975 return setError(E_FAIL, tr("Failed to open NT\\GLOBAL?? (error %Rrc)"), vrc); 3977 3976 3978 3977 /* … … 3992 3991 { 3993 3992 size_t cbDirEntry = cbDirEntryAlloced; 3994 rc = RTVfsDirReadEx(hVfsDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING);3995 if (RT_FAILURE( rc))3996 { 3997 if ( rc == VERR_BUFFER_OVERFLOW)3993 vrc = RTVfsDirReadEx(hVfsDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING); 3994 if (RT_FAILURE(vrc)) 3995 { 3996 if (vrc == VERR_BUFFER_OVERFLOW) 3998 3997 { 3999 3998 RTMemTmpFree(pDirEntry); … … 4004 4003 hrc = setError(E_OUTOFMEMORY, tr("Out of memory! (direntry buffer)")); 4005 4004 } 4006 else if ( rc != VERR_NO_MORE_FILES)4007 hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsDirReadEx failed: %Rrc"), rc);4005 else if (vrc != VERR_NO_MORE_FILES) 4006 hrc = setError(VBOX_E_IPRT_ERROR, tr("RTVfsDirReadEx failed: %Rrc"), vrc); 4008 4007 break; 4009 4008 } … … 4014 4013 4015 4014 RTFILE hRawFile = NIL_RTFILE; 4016 intvrc = RTFileOpen(&hRawFile, szPhysicalDrive, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);4015 vrc = RTFileOpen(&hRawFile, szPhysicalDrive, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 4017 4016 if (RT_FAILURE(vrc)) 4018 4017 { -
trunk/src/VBox/Main/src-server/HostNetworkInterfaceImpl.cpp
r98262 r98288 257 257 { 258 258 NETIFINFO info; 259 int rc = NetIfGetConfig(this, &info);260 if (RT_SUCCESS( rc))259 int vrc = NetIfGetConfig(this, &info); 260 if (RT_SUCCESS(vrc)) 261 261 { 262 262 int iPrefixIPv6; … … 280 280 return S_OK; 281 281 } 282 return rc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;282 return vrc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL; 283 283 } 284 284 … … 562 562 if (m.IPAddress) 563 563 { 564 int rc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, 0, 0);565 if (RT_SUCCESS( rc))564 int vrc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, 0, 0); 565 if (RT_SUCCESS(vrc)) 566 566 { 567 567 m.realIPAddress = 0; … … 596 596 if (m.realIPAddress == ip && m.realNetworkMask == mask) 597 597 return S_OK; 598 int rc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, ip, mask);599 if (RT_SUCCESS( rc))598 int vrc = NetIfEnableStaticIpConfig(mVirtualBox, this, m.IPAddress, ip, mask); 599 if (RT_SUCCESS(vrc)) 600 600 { 601 601 m.realIPAddress = ip; … … 617 617 else 618 618 { 619 LogRel(("Failed to EnableStaticIpConfig with rc=%Rrc\n",rc));619 LogRel(("Failed to EnableStaticIpConfig with vrc=%Rrc\n", vrc)); 620 620 /* Global::vboxStatusCodeToCOM assert things we can guarantee */ 621 switch ( rc)621 switch (vrc) 622 622 { 623 623 case VERR_NOT_IMPLEMENTED: … … 652 652 653 653 HRESULT hrc; 654 int rc; 655 656 RTNETADDRIPV6 AddrOld, AddrNew; 654 655 RTNETADDRIPV6 AddrNew; 657 656 char *pszZoneIgnored; 658 bool fAddrChanged; 659 660 rc = RTNetStrToIPv6Addr(aIPV6Address.c_str(), &AddrNew, &pszZoneIgnored); 661 if (RT_FAILURE(rc)) 662 { 663 return mVirtualBox->setErrorBoth(E_INVALIDARG, rc, tr("Invalid IPv6 address")); 664 } 665 666 rc = RTNetStrToIPv6Addr(com::Utf8Str(m.realIPV6Address).c_str(), &AddrOld, &pszZoneIgnored); 667 if (RT_SUCCESS(rc)) 668 { 669 fAddrChanged = (AddrNew.s.Lo != AddrOld.s.Lo || AddrNew.s.Hi != AddrOld.s.Hi); 670 } 671 else 672 { 673 fAddrChanged = true; 674 } 657 int vrc = RTNetStrToIPv6Addr(aIPV6Address.c_str(), &AddrNew, &pszZoneIgnored); 658 if (RT_FAILURE(vrc)) 659 return mVirtualBox->setErrorBoth(E_INVALIDARG, vrc, tr("Invalid IPv6 address")); 660 661 RTNETADDRIPV6 AddrOld; 662 vrc = RTNetStrToIPv6Addr(com::Utf8Str(m.realIPV6Address).c_str(), &AddrOld, &pszZoneIgnored); 663 bool fAddrChanged = RT_SUCCESS(vrc) ? AddrNew.s.Lo != AddrOld.s.Lo || AddrNew.s.Hi != AddrOld.s.Hi : true; 675 664 676 665 if ( fAddrChanged … … 679 668 if (aIPV6NetworkMaskPrefixLength == 0) 680 669 aIPV6NetworkMaskPrefixLength = 64; 681 rc = NetIfEnableStaticIpConfigV6(mVirtualBox, this, m.IPV6Address.c_str(),682 aIPV6Address.c_str(),683 aIPV6NetworkMaskPrefixLength);684 if (RT_FAILURE( rc))670 vrc = NetIfEnableStaticIpConfigV6(mVirtualBox, this, m.IPV6Address.c_str(), 671 aIPV6Address.c_str(), 672 aIPV6NetworkMaskPrefixLength); 673 if (RT_FAILURE(vrc)) 685 674 { 686 LogRel(("Failed to EnableStaticIpConfigV6 with rc=%Rrc\n",rc));675 LogRel(("Failed to EnableStaticIpConfigV6 with vrc=%Rrc\n", vrc)); 687 676 /* Global::vboxStatusCodeToCOM assert things we can guarantee */ 688 switch ( rc)677 switch (vrc) 689 678 { 690 679 case VERR_NOT_IMPLEMENTED: … … 728 717 return E_NOTIMPL; 729 718 #else 730 int rc = NetIfEnableDynamicIpConfig(mVirtualBox, this);731 if (RT_FAILURE( rc))732 { 733 LogRel(("Failed to EnableDynamicIpConfig with rc=%Rrc\n",rc));734 return rc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;719 int vrc = NetIfEnableDynamicIpConfig(mVirtualBox, this); 720 if (RT_FAILURE(vrc)) 721 { 722 LogRel(("Failed to EnableDynamicIpConfig with vrc=%Rrc\n", vrc)); 723 return vrc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL; 735 724 } 736 725 return S_OK; … … 743 732 return E_NOTIMPL; 744 733 #else 745 int rc = NetIfDhcpRediscover(mVirtualBox, this);746 if (RT_FAILURE( rc))747 { 748 LogRel(("Failed to DhcpRediscover with rc=%Rrc\n",rc));749 return rc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL;734 int vrc = NetIfDhcpRediscover(mVirtualBox, this); 735 if (RT_FAILURE(vrc)) 736 { 737 LogRel(("Failed to DhcpRediscover with vrc=%Rrc\n", vrc)); 738 return vrc == VERR_NOT_IMPLEMENTED ? E_NOTIMPL : E_FAIL; 750 739 } 751 740 return S_OK; -
trunk/src/VBox/Main/src-server/HostOnlyNetworkImpl.cpp
r98262 r98288 159 159 160 160 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 161 HRESULT rc = m->pVirtualBox->i_saveSettings();162 ComAssertComRCRetRC( rc);161 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 162 ComAssertComRCRetRC(hrc); 163 163 return S_OK; 164 164 } … … 186 186 187 187 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 188 HRESULT rc = m->pVirtualBox->i_saveSettings();189 ComAssertComRCRetRC( rc);188 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 189 ComAssertComRCRetRC(hrc); 190 190 return S_OK; 191 191 } … … 208 208 209 209 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 210 HRESULT rc = m->pVirtualBox->i_saveSettings();211 ComAssertComRCRetRC( rc);210 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 211 ComAssertComRCRetRC(hrc); 212 212 return S_OK; 213 213 } … … 237 237 238 238 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 239 HRESULT rc = m->pVirtualBox->i_saveSettings();240 ComAssertComRCRetRC( rc);239 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 240 ComAssertComRCRetRC(hrc); 241 241 return S_OK; 242 242 } … … 259 259 260 260 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 261 HRESULT rc = m->pVirtualBox->i_saveSettings();262 ComAssertComRCRetRC( rc);261 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 262 ComAssertComRCRetRC(hrc); 263 263 return S_OK; 264 264 } … … 281 281 282 282 AutoWriteLock vboxLock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS); 283 HRESULT rc = m->pVirtualBox->i_saveSettings();284 ComAssertComRCRetRC( rc);285 return S_OK; 286 } 287 283 HRESULT hrc = m->pVirtualBox->i_saveSettings(); 284 ComAssertComRCRetRC(hrc); 285 return S_OK; 286 } 287 -
trunk/src/VBox/Main/src-server/HostPower.cpp
r98103 r98288 57 57 VirtualBox::InternalControlList controls; 58 58 59 HRESULT rc = S_OK;59 HRESULT hrc = S_OK; 60 60 61 61 switch (aReason) … … 83 83 /* PauseWithReason() will simply return a failure if 84 84 * the VM is in an inappropriate state */ 85 rc = pControl->PauseWithReason(Reason_HostSuspend);86 if (FAILED( rc))85 hrc = pControl->PauseWithReason(Reason_HostSuspend); 86 if (FAILED(hrc)) 87 87 continue; 88 88 … … 108 108 * been somehow closed by this time already so that the 109 109 * console reference we have is dead) */ 110 rc = mSessionControls[i]->ResumeWithReason(Reason_HostResume);111 if (FAILED( rc))110 hrc = mSessionControls[i]->ResumeWithReason(Reason_HostResume); 111 if (FAILED(hrc)) 112 112 continue; 113 113 … … 134 134 135 135 Bstr value; 136 rc = mVirtualBox->GetExtraData(Bstr("VBoxInternal2/SavestateOnBatteryLow").raw(), 137 value.asOutParam()); 136 hrc = mVirtualBox->GetExtraData(Bstr("VBoxInternal2/SavestateOnBatteryLow").raw(), value.asOutParam()); 138 137 int fGlobal = 0; 139 if (SUCCEEDED( rc) && !value.isEmpty())138 if (SUCCEEDED(hrc) && !value.isEmpty()) 140 139 { 141 140 if (value != "0") … … 154 153 { 155 154 ComPtr<SessionMachine> pMachine = *it; 156 rc = pMachine->GetExtraData(Bstr("VBoxInternal2/SavestateOnBatteryLow").raw(), 157 value.asOutParam()); 155 hrc = pMachine->GetExtraData(Bstr("VBoxInternal2/SavestateOnBatteryLow").raw(), value.asOutParam()); 158 156 int fPerVM = 0; 159 if (SUCCEEDED( rc) && !value.isEmpty())157 if (SUCCEEDED(hrc) && !value.isEmpty()) 160 158 { 161 159 /* per-VM overrides global */ … … 173 171 /* SessionMachine::i_saveStateWithReason() will return 174 172 * a failure if the VM is in an inappropriate state */ 175 rc = pMachine->i_saveStateWithReason(Reason_HostBatteryLow, progress);176 if (FAILED( rc))173 hrc = pMachine->i_saveStateWithReason(Reason_HostBatteryLow, progress); 174 if (FAILED(hrc)) 177 175 { 178 LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine->i_getName().c_str(), rc));176 LogRel(("SaveState '%s' failed with %Rhrc\n", pMachine->i_getName().c_str(), hrc)); 179 177 continue; 180 178 } 181 179 182 180 /* Wait until the operation has been completed. */ 183 rc = progress->WaitForCompletion(-1);184 if (SUCCEEDED( rc))181 hrc = progress->WaitForCompletion(-1); 182 if (SUCCEEDED(hrc)) 185 183 { 186 184 LONG iRc; 187 185 progress->COMGETTER(ResultCode)(&iRc); 188 rc = (HRESULT)iRc;186 hrc = (HRESULT)iRc; 189 187 } 190 188 191 AssertMsg(SUCCEEDED( rc), ("SaveState WaitForCompletion failed with %Rhrc (%#08X)\n", rc,rc));192 193 if (SUCCEEDED( rc))189 AssertMsg(SUCCEEDED(hrc), ("SaveState WaitForCompletion failed with %Rhrc (%#08X)\n", hrc, hrc)); 190 191 if (SUCCEEDED(hrc)) 194 192 { 195 193 LogRel(("SaveState '%s' succeeded\n", pMachine->i_getName().c_str())); -
trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp
r98262 r98288 755 755 756 756 alock.release(); 757 int rc = mUSBProxyBackend->releaseDevice(this);758 if (RT_FAILURE( rc))757 int vrc = mUSBProxyBackend->releaseDevice(this); 758 if (RT_FAILURE(vrc)) 759 759 { 760 760 alock.acquire(); … … 808 808 809 809 alock.release(); 810 int rc = mUSBProxyBackend->captureDevice(this);811 if (RT_FAILURE( rc))810 int vrc = mUSBProxyBackend->captureDevice(this); 811 if (RT_FAILURE(vrc)) 812 812 { 813 813 alock.acquire(); -
trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
r98103 r98288 157 157 #endif 158 158 { 159 int rc;159 int vrc; 160 160 if (RTPathHavePath(pszPath)) 161 161 { 162 162 RTLDRMOD hmod = NIL_RTLDRMOD; 163 163 RTERRINFOSTATIC ErrInfo; 164 rc = SUPR3HardenedLdrLoadPlugIn(pszPath, &hmod, RTErrInfoInitStatic(&ErrInfo));165 if (RT_SUCCESS( rc))164 vrc = SUPR3HardenedLdrLoadPlugIn(pszPath, &hmod, RTErrInfoInitStatic(&ErrInfo)); 165 if (RT_SUCCESS(vrc)) 166 166 { 167 167 static const char s_szSymbol[] = "VBoxHostWebcamList"; 168 rc = RTLdrGetSymbol(hmod, s_szSymbol, (void **)ppfn);169 if (RT_SUCCESS( rc))168 vrc = RTLdrGetSymbol(hmod, s_szSymbol, (void **)ppfn); 169 if (RT_SUCCESS(vrc)) 170 170 *phmod = hmod; 171 171 else 172 172 { 173 if ( rc != VERR_SYMBOL_NOT_FOUND)174 LogRel(("Resolving symbol '%s': %Rrc\n", s_szSymbol, rc));173 if (vrc != VERR_SYMBOL_NOT_FOUND) 174 LogRel(("Resolving symbol '%s': %Rrc\n", s_szSymbol, vrc)); 175 175 RTLdrClose(hmod); 176 176 hmod = NIL_RTLDRMOD; … … 179 179 else 180 180 { 181 LogRel(("Loading the library '%s': %Rrc\n", pszPath, rc));181 LogRel(("Loading the library '%s': %Rrc\n", pszPath, vrc)); 182 182 if (RTErrInfoIsSet(&ErrInfo.Core)) 183 183 LogRel((" %s\n", ErrInfo.Core.pszMsg)); … … 187 187 { 188 188 LogRel(("Loading the library '%s': No path! Refusing to try loading it!\n", pszPath)); 189 rc = VERR_INVALID_PARAMETER;190 } 191 return rc;189 vrc = VERR_INVALID_PARAMETER; 190 } 191 return vrc; 192 192 } 193 193 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r98262 r98288 385 385 AssertReturn(autoInitSpan.isOk(), E_FAIL); 386 386 387 HRESULT rc = initImpl(aParent, strConfigFile);388 if (FAILED( rc)) returnrc;387 HRESULT hrc = initImpl(aParent, strConfigFile); 388 if (FAILED(hrc)) return hrc; 389 389 390 390 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION … … 398 398 /* Resolve the cryptographic interface. */ 399 399 PCVBOXCRYPTOIF pCryptoIf = NULL; 400 HRESULThrc = aParent->i_retainCryptoIf(&pCryptoIf);400 hrc = aParent->i_retainCryptoIf(&pCryptoIf); 401 401 if (SUCCEEDED(hrc)) 402 402 { … … 450 450 #endif 451 451 452 rc = i_tryCreateMachineConfigFile(fForceOverwrite);453 if (FAILED( rc)) returnrc;454 455 if (SUCCEEDED( rc))452 hrc = i_tryCreateMachineConfigFile(fForceOverwrite); 453 if (FAILED(hrc)) return hrc; 454 455 if (SUCCEEDED(hrc)) 456 456 { 457 457 // create an empty machine config 458 458 mData->pMachineConfigFile = new settings::MachineConfigFile(NULL); 459 459 460 rc = initDataAndChildObjects();461 } 462 463 if (SUCCEEDED( rc))460 hrc = initDataAndChildObjects(); 461 } 462 463 if (SUCCEEDED(hrc)) 464 464 { 465 465 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION … … 485 485 486 486 // initialize the default snapshots folder 487 rc = COMSETTER(SnapshotFolder)(NULL);488 AssertComRC( rc);487 hrc = COMSETTER(SnapshotFolder)(NULL); 488 AssertComRC(hrc); 489 489 490 490 if (aOsType) … … 500 500 mHWData->mX2APIC = aOsType->i_recommendedX2APIC(); 501 501 502 rc = aOsType->COMGETTER(RecommendedFirmware)(&mHWData->mFirmwareType);503 AssertComRC( rc);502 hrc = aOsType->COMGETTER(RecommendedFirmware)(&mHWData->mFirmwareType); 503 AssertComRC(hrc); 504 504 } 505 505 else if (!strOsType.isEmpty()) … … 540 540 541 541 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION 542 rc = mNvramStore->i_updateEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore);542 hrc = mNvramStore->i_updateEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore); 543 543 #endif 544 if (SUCCEEDED( rc))544 if (SUCCEEDED(hrc)) 545 545 { 546 546 /* At this point the changing of the current state modification … … 554 554 555 555 /* Confirm a successful initialization when it's the case */ 556 if (SUCCEEDED( rc))556 if (SUCCEEDED(hrc)) 557 557 { 558 558 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION … … 571 571 } 572 572 573 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool, rc=%08X\n",573 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool, hrc=%08X\n", 574 574 !!mUserData ? mUserData->s.strName.c_str() : "NULL", 575 575 mData->mRegistered, 576 576 mData->mAccessible, 577 rc));577 hrc)); 578 578 579 579 LogFlowThisFuncLeave(); 580 580 581 return rc;581 return hrc; 582 582 } 583 583 … … 626 626 AssertReturn(autoInitSpan.isOk(), E_FAIL); 627 627 628 HRESULT rc = initImpl(aParent, strConfigFile);629 if (FAILED( rc)) returnrc;628 HRESULT hrc = initImpl(aParent, strConfigFile); 629 if (FAILED(hrc)) return hrc; 630 630 631 631 if (aId) … … 635 635 mData->mRegistered = TRUE; 636 636 // now load the settings from XML: 637 rc = i_registeredInit();637 hrc = i_registeredInit(); 638 638 // this calls initDataAndChildObjects() and loadSettings() 639 639 } … … 641 641 { 642 642 // opening an unregistered VM (VirtualBox::OpenMachine()): 643 rc = initDataAndChildObjects(); 644 645 if (SUCCEEDED(rc)) 643 hrc = initDataAndChildObjects(); 644 if (SUCCEEDED(hrc)) 646 645 { 647 646 // set to true now to cause uninit() to call uninitDataAndChildObjects() on failure … … 701 700 #endif 702 701 703 rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, 704 NULL /* puuidRegistry */); 705 if (FAILED(rc)) throw rc; 702 hrc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, NULL /* puuidRegistry */); 703 if (FAILED(hrc)) throw hrc; 706 704 707 705 /* At this point the changing of the current state modification … … 715 713 { 716 714 /* we assume that error info is set by the thrower */ 717 rc = err;715 hrc = err; 718 716 } 719 717 catch (...) 720 718 { 721 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);719 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 722 720 } 723 721 } … … 725 723 726 724 /* Confirm a successful initialization when it's the case */ 727 if (SUCCEEDED( rc))725 if (SUCCEEDED(hrc)) 728 726 { 729 727 if (mData->mAccessible) … … 747 745 #endif 748 746 749 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool " 750 "rc=%08X\n", 751 !!mUserData ? mUserData->s.strName.c_str() : "NULL", 752 mData->mRegistered, mData->mAccessible, rc)); 747 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool hrc=%08X\n", 748 !!mUserData ? mUserData->s.strName.c_str() : "NULL", mData->mRegistered, mData->mAccessible, hrc)); 753 749 754 750 LogFlowThisFuncLeave(); 755 751 756 return rc;752 return hrc; 757 753 } 758 754 … … 780 776 AssertReturn(autoInitSpan.isOk(), E_FAIL); 781 777 782 HRESULT rc = initImpl(aParent, strSettingsFilename); 783 if (FAILED(rc)) return rc; 784 785 rc = i_tryCreateMachineConfigFile(false /* fForceOverwrite */); 786 if (FAILED(rc)) return rc; 787 788 rc = initDataAndChildObjects(); 789 790 if (SUCCEEDED(rc)) 778 HRESULT hrc = initImpl(aParent, strSettingsFilename); 779 if (FAILED(hrc)) return hrc; 780 781 hrc = i_tryCreateMachineConfigFile(false /* fForceOverwrite */); 782 if (FAILED(hrc)) return hrc; 783 784 hrc = initDataAndChildObjects(); 785 if (SUCCEEDED(hrc)) 791 786 { 792 787 // set to true now to cause uninit() to call uninitDataAndChildObjects() on failure … … 799 794 unconst(mData->mUuid).create(); 800 795 801 rc = i_loadMachineDataFromSettings(config, 802 &mData->mUuid); // puuidRegistry: initialize media with this registry ID 796 hrc = i_loadMachineDataFromSettings(config, &mData->mUuid); // puuidRegistry: initialize media with this registry ID 803 797 804 798 // override VM name as well, it may be different 805 799 mUserData->s.strName = strName; 806 800 807 if (SUCCEEDED( rc))801 if (SUCCEEDED(hrc)) 808 802 { 809 803 /* At this point the changing of the current state modification … … 817 811 818 812 /* Confirm a successful initialization when it's the case */ 819 if (SUCCEEDED( rc))813 if (SUCCEEDED(hrc)) 820 814 { 821 815 if (mData->mAccessible) … … 836 830 } 837 831 838 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool " 839 "rc=%08X\n", 840 !!mUserData ? mUserData->s.strName.c_str() : "NULL", 841 mData->mRegistered, mData->mAccessible, rc)); 832 LogFlowThisFunc(("mName='%s', mRegistered=%RTbool, mAccessible=%RTbool hrc=%08X\n", 833 !!mUserData ? mUserData->s.strName.c_str() : "NULL", mData->mRegistered, mData->mAccessible, hrc)); 842 834 843 835 LogFlowThisFuncLeave(); 844 836 845 return rc;837 return hrc; 846 838 } 847 839 … … 860 852 AssertReturn(!strConfigFile.isEmpty(), E_INVALIDARG); 861 853 862 HRESULT rc = S_OK;854 HRESULT hrc = S_OK; 863 855 864 856 /* share the parent weakly */ … … 889 881 LogFlowThisFuncLeave(); 890 882 891 return rc;883 return hrc; 892 884 } 893 885 … … 900 892 HRESULT Machine::i_tryCreateMachineConfigFile(bool fForceOverwrite) 901 893 { 902 HRESULT rc = S_OK;894 HRESULT hrc = S_OK; 903 895 904 896 // when we create a new machine, we must be able to create the settings file … … 912 904 RTFileClose(f); 913 905 if (!fForceOverwrite) 914 rc = setError(VBOX_E_FILE_ERROR, 915 tr("Machine settings file '%s' already exists"), 916 mData->m_strConfigFileFull.c_str()); 906 hrc = setError(VBOX_E_FILE_ERROR, tr("Machine settings file '%s' already exists"), mData->m_strConfigFileFull.c_str()); 917 907 else 918 908 { … … 925 915 && vrc != VERR_PATH_NOT_FOUND 926 916 ) 927 rc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, 928 tr("Invalid machine settings file name '%s' (%Rrc)"), 929 mData->m_strConfigFileFull.c_str(), 930 vrc); 931 return rc; 917 hrc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, tr("Invalid machine settings file name '%s' (%Rrc)"), 918 mData->m_strConfigFileFull.c_str(), vrc); 919 return hrc; 932 920 } 933 921 … … 951 939 AssertReturn(!mData->mAccessible, E_FAIL); 952 940 953 HRESULT rc = initDataAndChildObjects(); 954 955 if (SUCCEEDED(rc)) 941 HRESULT hrc = initDataAndChildObjects(); 942 if (SUCCEEDED(hrc)) 956 943 { 957 944 /* Temporarily reset the registered flag in order to let setters … … 969 956 { 970 957 /* Get at the crpytographic interface. */ 971 rc = mParent->i_retainCryptoIf(&pCryptoIf);972 if (SUCCEEDED( rc))958 hrc = mParent->i_retainCryptoIf(&pCryptoIf); 959 if (SUCCEEDED(hrc)) 973 960 { 974 961 int vrc = mData->mpKeyStore->retainSecretKey(mData->mstrKeyId, &pKey); … … 976 963 pszPassword = (const char *)pKey->getKeyBuffer(); 977 964 else 978 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to retain key for key ID '%s' with %Rrc"),979 mData->mstrKeyId.c_str(), vrc);965 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Failed to retain key for key ID '%s' with %Rrc"), 966 mData->mstrKeyId.c_str(), vrc); 980 967 } 981 968 } … … 984 971 #endif 985 972 986 if (SUCCEEDED( rc))973 if (SUCCEEDED(hrc)) 987 974 { 988 975 try … … 1007 994 1008 995 if (mData->pMachineConfigFile->enmParseState == settings::MachineConfigFile::ParseState_PasswordError) 1009 rc = setError(VBOX_E_PASSWORD_INCORRECT,1010 tr("Config decryption of the machine {%RTuuid} failed. Incorrect or unknown password"),1011 mData->pMachineConfigFile->uuid.raw());996 hrc = setError(VBOX_E_PASSWORD_INCORRECT, 997 tr("Config decryption of the machine {%RTuuid} failed. Incorrect or unknown password"), 998 mData->pMachineConfigFile->uuid.raw()); 1012 999 else 1013 1000 #endif 1014 rc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, 1015 NULL /* const Guid *puuidRegistry */); 1016 if (FAILED(rc)) throw rc; 1001 hrc = i_loadMachineDataFromSettings(*mData->pMachineConfigFile, NULL /* const Guid *puuidRegistry */); 1002 if (FAILED(hrc)) throw hrc; 1017 1003 } 1018 1004 catch (HRESULT err) 1019 1005 { 1020 1006 /* we assume that error info is set by the thrower */ 1021 rc = err;1007 hrc = err; 1022 1008 } 1023 1009 catch (...) 1024 1010 { 1025 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);1011 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 1026 1012 } 1027 1013 … … 1038 1024 } 1039 1025 1040 if (SUCCEEDED( rc))1026 if (SUCCEEDED(hrc)) 1041 1027 { 1042 1028 /* Set mAccessible to TRUE only if we successfully locked and loaded … … 1070 1056 uninitDataAndChildObjects(); 1071 1057 1072 rc = S_OK;1073 } 1074 1075 return rc;1058 hrc = S_OK; 1059 } 1060 1061 return hrc; 1076 1062 } 1077 1063 … … 1206 1192 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1207 1193 1208 HRESULT rc = S_OK;1194 HRESULT hrc = S_OK; 1209 1195 1210 1196 if (!mData->mAccessible) … … 1228 1214 } 1229 1215 1230 rc = i_registeredInit();1231 1232 if (SUCCEEDED( rc) && mData->mAccessible)1216 hrc = i_registeredInit(); 1217 1218 if (SUCCEEDED(hrc) && mData->mAccessible) 1233 1219 { 1234 1220 autoReinitSpan.setSucceeded(); … … 1241 1227 } 1242 1228 1243 if (SUCCEEDED( rc))1229 if (SUCCEEDED(hrc)) 1244 1230 *aAccessible = mData->mAccessible; 1245 1231 1246 1232 LogFlowThisFuncLeave(); 1247 1233 1248 return rc;1234 return hrc; 1249 1235 } 1250 1236 … … 1260 1246 } 1261 1247 1262 HRESULT rc = S_OK;1248 HRESULT hrc = S_OK; 1263 1249 1264 1250 ComObjPtr<VirtualBoxErrorInfo> errorInfo; 1265 rc = errorInfo.createObject();1266 if (SUCCEEDED( rc))1251 hrc = errorInfo.createObject(); 1252 if (SUCCEEDED(hrc)) 1267 1253 { 1268 1254 errorInfo->init(mData->mAccessError.getResultCode(), … … 1273 1259 } 1274 1260 1275 return rc;1261 return hrc; 1276 1262 } 1277 1263 … … 1296 1282 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1297 1283 1298 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);1299 if (FAILED( rc)) returnrc;1284 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 1285 if (FAILED(hrc)) return hrc; 1300 1286 1301 1287 i_setModified(IsModified_MachineData); … … 1322 1308 // significantly, but play safe by not messing around while complex 1323 1309 // activities are going on 1324 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);1325 if (FAILED( rc)) returnrc;1310 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 1311 if (FAILED(hrc)) return hrc; 1326 1312 1327 1313 i_setModified(IsModified_MachineData); … … 1358 1344 { 1359 1345 StringsList llGroups; 1360 HRESULT rc = mParent->i_convertMachineGroups(aGroups, &llGroups);1361 if (FAILED( rc))1362 return rc;1346 HRESULT hrc = mParent->i_convertMachineGroups(aGroups, &llGroups); 1347 if (FAILED(hrc)) 1348 return hrc; 1363 1349 1364 1350 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1365 1351 1366 rc = i_checkStateDependency(MutableOrSavedStateDep);1367 if (FAILED( rc)) returnrc;1352 hrc = i_checkStateDependency(MutableOrSavedStateDep); 1353 if (FAILED(hrc)) return hrc; 1368 1354 1369 1355 i_setModified(IsModified_MachineData); … … 1396 1382 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1397 1383 1398 HRESULT rc = i_checkStateDependency(MutableStateDep);1399 if (FAILED( rc)) returnrc;1384 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1385 if (FAILED(hrc)) return hrc; 1400 1386 1401 1387 i_setModified(IsModified_MachineData); … … 1419 1405 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1420 1406 1421 HRESULT rc = i_checkStateDependency(MutableStateDep);1422 if (FAILED( rc)) returnrc;1407 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1408 if (FAILED(hrc)) return hrc; 1423 1409 1424 1410 i_setModified(IsModified_MachineData); … … 1446 1432 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1447 1433 1448 HRESULT rc = i_checkStateDependency(MutableStateDep);1449 if (FAILED( rc)) returnrc;1434 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1435 if (FAILED(hrc)) return hrc; 1450 1436 1451 1437 i_setModified(IsModified_MachineData); … … 1469 1455 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1470 1456 1471 HRESULT rc = i_checkStateDependency(MutableStateDep);1472 if (FAILED( rc)) returnrc;1457 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1458 if (FAILED(hrc)) return hrc; 1473 1459 1474 1460 i_setModified(IsModified_MachineData); … … 1492 1478 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1493 1479 1494 HRESULT rc = i_checkStateDependency(MutableStateDep);1495 if (FAILED( rc)) returnrc;1480 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1481 if (FAILED(hrc)) return hrc; 1496 1482 1497 1483 if (aChipsetType != mHWData->mChipsetType) … … 1533 1519 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1534 1520 1535 HRESULT rc = i_checkStateDependency(MutableStateDep);1536 if (FAILED( rc)) returnrc;1521 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1522 if (FAILED(hrc)) return hrc; 1537 1523 1538 1524 if (aIommuType != mHWData->mIommuType) … … 1566 1552 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1567 1553 1568 HRESULT rc = i_checkStateDependency(MutableStateDep);1569 if (FAILED( rc)) returnrc;1554 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1555 if (FAILED(hrc)) return hrc; 1570 1556 1571 1557 /** @todo Parse/validate options? */ … … 1593 1579 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1594 1580 1595 HRESULT rc = i_checkStateDependency(MutableStateDep);1596 if (FAILED( rc)) returnrc;1581 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1582 if (FAILED(hrc)) return hrc; 1597 1583 1598 1584 if (aParavirtProvider != mHWData->mParavirtProvider) … … 1715 1701 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1716 1702 1717 HRESULT rc = i_checkStateDependency(MutableStateDep);1718 if (FAILED( rc)) returnrc;1703 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1704 if (FAILED(hrc)) return hrc; 1719 1705 1720 1706 i_setModified(IsModified_MachineData); … … 1744 1730 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1745 1731 1746 HRESULT rc = i_checkStateDependency(MutableStateDep);1747 if (FAILED( rc)) returnrc;1732 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1733 if (FAILED(hrc)) return hrc; 1748 1734 1749 1735 i_setModified(IsModified_MachineData); … … 1778 1764 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1779 1765 1780 HRESULT rc = i_checkStateDependency(MutableStateDep);1781 if (FAILED( rc)) returnrc;1766 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1767 if (FAILED(hrc)) return hrc; 1782 1768 1783 1769 i_setModified(IsModified_MachineData); … … 1822 1808 } 1823 1809 1824 HRESULT rc = i_checkStateDependency(MutableStateDep);1825 if (FAILED( rc)) returnrc;1810 HRESULT hrc = i_checkStateDependency(MutableStateDep); 1811 if (FAILED(hrc)) return hrc; 1826 1812 1827 1813 i_setModified(IsModified_MachineData); … … 1843 1829 HRESULT Machine::setCPUExecutionCap(ULONG aCPUExecutionCap) 1844 1830 { 1845 HRESULT rc = S_OK;1846 1847 1831 /* check throttle limits */ 1848 1832 if ( aCPUExecutionCap < 1 … … 1855 1839 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1856 1840 1857 rc = i_checkStateDependency(MutableOrRunningStateDep);1858 if (FAILED( rc)) returnrc;1841 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 1842 if (FAILED(hrc)) return hrc; 1859 1843 1860 1844 alock.release(); 1861 rc = i_onCPUExecutionCapChange(aCPUExecutionCap);1845 hrc = i_onCPUExecutionCapChange(aCPUExecutionCap); 1862 1846 alock.acquire(); 1863 if (FAILED( rc)) returnrc;1847 if (FAILED(hrc)) return hrc; 1864 1848 1865 1849 i_setModified(IsModified_MachineData); … … 1885 1869 HRESULT Machine::setCPUHotPlugEnabled(BOOL aCPUHotPlugEnabled) 1886 1870 { 1887 HRESULT rc = S_OK;1871 HRESULT hrc = S_OK; 1888 1872 1889 1873 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1890 1874 1891 rc = i_checkStateDependency(MutableStateDep);1892 if (FAILED( rc)) returnrc;1875 hrc = i_checkStateDependency(MutableStateDep); 1876 if (FAILED(hrc)) return hrc; 1893 1877 1894 1878 if (mHWData->mCPUHotPlugEnabled != aCPUHotPlugEnabled) … … 1933 1917 mHWData->mCPUHotPlugEnabled = aCPUHotPlugEnabled; 1934 1918 1935 return rc;1919 return hrc; 1936 1920 } 1937 1921 … … 2002 1986 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2003 1987 2004 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);2005 if (FAILED( rc)) returnrc;1988 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 1989 if (FAILED(hrc)) return hrc; 2006 1990 2007 1991 i_setModified(IsModified_MachineData); … … 2027 2011 HRESULT Machine::setHPETEnabled(BOOL aHPETEnabled) 2028 2012 { 2029 HRESULT rc = S_OK;2030 2031 2013 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2032 2014 2033 rc = i_checkStateDependency(MutableStateDep);2034 if (FAILED( rc)) returnrc;2015 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2016 if (FAILED(hrc)) return hrc; 2035 2017 2036 2018 i_setModified(IsModified_MachineData); … … 2039 2021 mHWData->mHPETEnabled = aHPETEnabled; 2040 2022 2041 return rc;2023 return hrc; 2042 2024 } 2043 2025 … … 2070 2052 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2071 2053 2072 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);2073 if (FAILED( rc)) returnrc;2054 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 2055 if (FAILED(hrc)) return hrc; 2074 2056 2075 2057 i_setModified(IsModified_MachineData); … … 2097 2079 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2098 2080 2099 HRESULT rc = i_checkStateDependency(MutableStateDep);2100 if (FAILED( rc)) returnrc;2081 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2082 if (FAILED(hrc)) return hrc; 2101 2083 2102 2084 /** @todo must support changes for running vms and keep this in sync with IGuest. */ … … 2253 2235 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2254 2236 2255 HRESULT rc = i_checkStateDependency(MutableStateDep);2256 if (FAILED( rc)) returnrc;2237 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2238 if (FAILED(hrc)) return hrc; 2257 2239 2258 2240 switch (aProperty) … … 2418 2400 2419 2401 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2420 HRESULT rc = i_checkStateDependency(MutableStateDep);2421 if (FAILED( rc)) returnrc;2402 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2403 if (FAILED(hrc)) return hrc; 2422 2404 2423 2405 /* … … 2459 2441 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2460 2442 2461 HRESULT rc = i_checkStateDependency(MutableStateDep);2462 if (FAILED( rc)) returnrc;2443 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2444 if (FAILED(hrc)) return hrc; 2463 2445 2464 2446 /* … … 2498 2480 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2499 2481 2500 HRESULT rc = i_checkStateDependency(MutableStateDep);2501 if (FAILED( rc)) returnrc;2482 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2483 if (FAILED(hrc)) return hrc; 2502 2484 2503 2485 if (mHWData->mCpuIdLeafList.size() > 0) … … 2559 2541 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2560 2542 2561 HRESULT rc = i_checkStateDependency(MutableStateDep);2562 if (FAILED( rc)) returnrc;2543 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2544 if (FAILED(hrc)) return hrc; 2563 2545 2564 2546 switch (aProperty) … … 2640 2622 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2641 2623 2642 HRESULT rc = i_checkStateDependency(MutableStateDep);2643 if (FAILED( rc)) returnrc;2624 HRESULT hrc = i_checkStateDependency(MutableStateDep); 2625 if (FAILED(hrc)) return hrc; 2644 2626 2645 2627 if (!mData->mCurrentSnapshot.isNull()) … … 2704 2686 #ifdef VBOX_WITH_VUSB 2705 2687 clearError(); 2706 MultiResult rc(S_OK);2688 MultiResult hrcMult(S_OK); 2707 2689 2708 2690 # ifdef VBOX_WITH_USB 2709 rc= mParent->i_host()->i_checkUSBProxyService();2710 if (FAILED( rc)) return rc;2691 hrcMult = mParent->i_host()->i_checkUSBProxyService(); 2692 if (FAILED(hrcMult)) return hrcMult; 2711 2693 # endif 2712 2694 … … 2735 2717 #ifdef VBOX_WITH_VUSB 2736 2718 clearError(); 2737 MultiResult rc(S_OK);2719 MultiResult hrcMult(S_OK); 2738 2720 2739 2721 # ifdef VBOX_WITH_USB 2740 rc= mParent->i_host()->i_checkUSBProxyService();2741 if (FAILED( rc)) return rc;2722 hrcMult = mParent->i_host()->i_checkUSBProxyService(); 2723 if (FAILED(hrcMult)) return hrcMult; 2742 2724 # endif 2743 2725 … … 2745 2727 2746 2728 aUSBDeviceFilters = mUSBDeviceFilters; 2747 return rc;2729 return hrcMult; 2748 2730 #else 2749 2731 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 2774 2756 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2775 2757 2776 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);2777 if (FAILED( rc)) returnrc;2758 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 2759 if (FAILED(hrc)) return hrc; 2778 2760 2779 2761 if (!mData->pMachineConfigFile->fileExists()) … … 2911 2893 HRESULT Machine::setClipboardMode(ClipboardMode_T aClipboardMode) 2912 2894 { 2913 HRESULT rc = S_OK;2895 HRESULT hrc = S_OK; 2914 2896 2915 2897 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2916 2898 2917 rc = i_checkStateDependency(MutableOrRunningStateDep);2918 if (FAILED( rc)) returnrc;2899 hrc = i_checkStateDependency(MutableOrRunningStateDep); 2900 if (FAILED(hrc)) return hrc; 2919 2901 2920 2902 alock.release(); 2921 rc = i_onClipboardModeChange(aClipboardMode);2903 hrc = i_onClipboardModeChange(aClipboardMode); 2922 2904 alock.acquire(); 2923 if (FAILED( rc)) returnrc;2905 if (FAILED(hrc)) return hrc; 2924 2906 2925 2907 i_setModified(IsModified_MachineData); … … 2945 2927 HRESULT Machine::setClipboardFileTransfersEnabled(BOOL aEnabled) 2946 2928 { 2947 HRESULT rc = S_OK;2948 2949 2929 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2950 2930 2951 rc = i_checkStateDependency(MutableOrRunningStateDep);2952 if (FAILED( rc)) returnrc;2931 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 2932 if (FAILED(hrc)) return hrc; 2953 2933 2954 2934 alock.release(); 2955 rc = i_onClipboardFileTransferModeChange(aEnabled);2935 hrc = i_onClipboardFileTransferModeChange(aEnabled); 2956 2936 alock.acquire(); 2957 if (FAILED( rc)) returnrc;2937 if (FAILED(hrc)) return hrc; 2958 2938 2959 2939 i_setModified(IsModified_MachineData); … … 2979 2959 HRESULT Machine::setDnDMode(DnDMode_T aDnDMode) 2980 2960 { 2981 HRESULT rc = S_OK;2982 2983 2961 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2984 2962 2985 rc = i_checkStateDependency(MutableOrRunningStateDep);2986 if (FAILED( rc)) returnrc;2963 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 2964 if (FAILED(hrc)) return hrc; 2987 2965 2988 2966 alock.release(); 2989 rc = i_onDnDModeChange(aDnDMode);2967 hrc = i_onDnDModeChange(aDnDMode); 2990 2968 2991 2969 alock.acquire(); 2992 if (FAILED( rc)) returnrc;2970 if (FAILED(hrc)) return hrc; 2993 2971 2994 2972 i_setModified(IsModified_MachineData); … … 3069 3047 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3070 3048 3071 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);3072 if (FAILED( rc)) returnrc;3049 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 3050 if (FAILED(hrc)) return hrc; 3073 3051 3074 3052 i_setModified(IsModified_MachineData); … … 3092 3070 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3093 3071 3094 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);3095 if (FAILED( rc)) returnrc;3072 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 3073 if (FAILED(hrc)) return hrc; 3096 3074 3097 3075 i_setModified(IsModified_MachineData); … … 3187 3165 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3188 3166 3189 HRESULT rc = i_checkStateDependency(MutableStateDep);3190 if (FAILED( rc)) returnrc;3167 HRESULT hrc = i_checkStateDependency(MutableStateDep); 3168 if (FAILED(hrc)) return hrc; 3191 3169 3192 3170 i_setModified(IsModified_MachineData); … … 3210 3188 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3211 3189 3212 HRESULT rc = i_checkStateDependency(MutableStateDep);3213 if (FAILED( rc)) returnrc;3190 HRESULT hrc = i_checkStateDependency(MutableStateDep); 3191 if (FAILED(hrc)) return hrc; 3214 3192 3215 3193 i_setModified(IsModified_MachineData); … … 3288 3266 /* check the session state */ 3289 3267 SessionState_T state; 3290 HRESULT rc = aSession->COMGETTER(State)(&state);3291 if (FAILED( rc)) returnrc;3268 HRESULT hrc = aSession->COMGETTER(State)(&state); 3269 if (FAILED(hrc)) return hrc; 3292 3270 3293 3271 if (state != SessionState_Unlocked) … … 3357 3335 { 3358 3336 LogFlowThisFunc(("Calling GetRemoteConsole()...\n")); 3359 rc = pSessionW->COMGETTER(RemoteConsole)(pConsoleW.asOutParam());3360 LogFlowThisFunc(("GetRemoteConsole() returned %08X\n", rc));3361 if (FAILED( rc))3337 hrc = pSessionW->COMGETTER(RemoteConsole)(pConsoleW.asOutParam()); 3338 LogFlowThisFunc(("GetRemoteConsole() returned %08X\n", hrc)); 3339 if (FAILED(hrc)) 3362 3340 // the failure may occur w/o any error info (from RPC), so provide one 3363 return setError(VBOX_E_VM_ERROR, 3364 tr("Failed to get a console object from the direct session (%Rhrc)"), rc); 3341 return setError(VBOX_E_VM_ERROR, tr("Failed to get a console object from the direct session (%Rhrc)"), hrc); 3365 3342 ComAssertRet(!pConsoleW.isNull(), E_FAIL); 3366 3343 } … … 3368 3345 // share the session machine and W's console with the caller's session 3369 3346 LogFlowThisFunc(("Calling AssignRemoteMachine()...\n")); 3370 rc = pSessionControl->AssignRemoteMachine(pSessionMachine, pConsoleW);3371 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", rc));3372 3373 if (FAILED( rc))3347 hrc = pSessionControl->AssignRemoteMachine(pSessionMachine, pConsoleW); 3348 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", hrc)); 3349 3350 if (FAILED(hrc)) 3374 3351 // the failure may occur w/o any error info (from RPC), so provide one 3375 return setError(VBOX_E_VM_ERROR, 3376 tr("Failed to assign the machine to the session (%Rhrc)"), rc); 3352 return setError(VBOX_E_VM_ERROR, tr("Failed to assign the machine to the session (%Rhrc)"), hrc); 3377 3353 alock.acquire(); 3378 3354 … … 3458 3434 ComObjPtr<SessionMachine> sessionMachine; 3459 3435 sessionMachine.createObject(); 3460 rc = sessionMachine->init(this);3461 AssertComRC( rc);3436 hrc = sessionMachine->init(this); 3437 AssertComRC(hrc); 3462 3438 3463 3439 /* NOTE: doing return from this function after this point but … … 3467 3443 * is possible due to the wrong lock order. */ 3468 3444 3469 if (SUCCEEDED( rc))3445 if (SUCCEEDED(hrc)) 3470 3446 { 3471 3447 /* … … 3504 3480 LogFlowThisFunc(("Calling AssignMachine()...\n")); 3505 3481 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER 3506 rc = pSessionControl->AssignMachine(sessionMachine, aLockType, Bstr(strTokenId).raw());3482 hrc = pSessionControl->AssignMachine(sessionMachine, aLockType, Bstr(strTokenId).raw()); 3507 3483 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 3508 rc = pSessionControl->AssignMachine(sessionMachine, aLockType, pToken);3484 hrc = pSessionControl->AssignMachine(sessionMachine, aLockType, pToken); 3509 3485 /* Now the token is owned by the client process. */ 3510 3486 pToken.setNull(); 3511 3487 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 3512 LogFlowThisFunc(("AssignMachine() returned %08X\n", rc));3488 LogFlowThisFunc(("AssignMachine() returned %08X\n", hrc)); 3513 3489 3514 3490 /* The failure may occur w/o any error info (from RPC), so provide one */ 3515 if (FAILED(rc)) 3516 setError(VBOX_E_VM_ERROR, 3517 tr("Failed to assign the machine to the session (%Rhrc)"), rc); 3491 if (FAILED(hrc)) 3492 setError(VBOX_E_VM_ERROR, tr("Failed to assign the machine to the session (%Rhrc)"), hrc); 3518 3493 3519 3494 // get session name, either to remember or to compare against … … 3526 3501 } 3527 3502 3528 if ( SUCCEEDED( rc)3503 if ( SUCCEEDED(hrc) 3529 3504 && fLaunchingVMProcess 3530 3505 ) … … 3534 3509 /* get the console from the direct session */ 3535 3510 ComPtr<IConsole> console; 3536 rc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam());3537 ComAssertComRC( rc);3538 3539 if (SUCCEEDED( rc) && !console)3511 hrc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam()); 3512 ComAssertComRC(hrc); 3513 3514 if (SUCCEEDED(hrc) && !console) 3540 3515 { 3541 3516 ComAssert(!!console); 3542 rc = E_FAIL;3517 hrc = E_FAIL; 3543 3518 } 3544 3519 3545 3520 /* assign machine & console to the remote session */ 3546 if (SUCCEEDED( rc))3521 if (SUCCEEDED(hrc)) 3547 3522 { 3548 3523 /* … … 3551 3526 */ 3552 3527 LogFlowThisFunc(("Calling AssignRemoteMachine()...\n")); 3553 rc = mData->mSession.mRemoteControls.front()->AssignRemoteMachine(sessionMachine, console);3554 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", rc));3528 hrc = mData->mSession.mRemoteControls.front()->AssignRemoteMachine(sessionMachine, console); 3529 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", hrc)); 3555 3530 3556 3531 /* The failure may occur w/o any error info (from RPC), so provide one */ 3557 if (FAILED( rc))3532 if (FAILED(hrc)) 3558 3533 setError(VBOX_E_VM_ERROR, 3559 tr("Failed to assign the machine to the remote session (%Rhrc)"), rc);3534 tr("Failed to assign the machine to the remote session (%Rhrc)"), hrc); 3560 3535 } 3561 3536 3562 if (FAILED( rc))3537 if (FAILED(hrc)) 3563 3538 pSessionControl->Uninitialize(); 3564 3539 } … … 3574 3549 if (fLaunchingVMProcess) 3575 3550 { 3576 Assert(mData->mSession.mName == strSessionName || FAILED( rc));3551 Assert(mData->mSession.mName == strSessionName || FAILED(hrc)); 3577 3552 /* Note that the progress object is finalized later */ 3578 3553 /** @todo Consider checking mData->mSession.mProgress for cancellation … … 3582 3557 * SessionMachine::uninit() to reap the child process later. */ 3583 3558 3584 if (FAILED( rc))3559 if (FAILED(hrc)) 3585 3560 { 3586 3561 /* Close the remote session, remove the remote control from the list … … 3602 3577 { 3603 3578 /* memorize PID of the directly opened session */ 3604 if (SUCCEEDED( rc))3579 if (SUCCEEDED(hrc)) 3605 3580 mData->mSession.mPID = pid; 3606 3581 } 3607 3582 3608 if (SUCCEEDED( rc))3583 if (SUCCEEDED(hrc)) 3609 3584 { 3610 3585 mData->mSession.mLockType = aLockType; … … 3628 3603 /* get the console from the direct session */ 3629 3604 ComPtr<IConsole> console; 3630 rc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam());3631 ComAssertComRC( rc);3605 hrc = pSessionControl->COMGETTER(RemoteConsole)(console.asOutParam()); 3606 ComAssertComRC(hrc); 3632 3607 /* send passswords to console */ 3633 3608 for (SecretKeyStore::SecretKeyMap::iterator it = mData->mpKeyStore->begin(); … … 3652 3627 3653 3628 /* uninitialize the created session machine on failure */ 3654 if (FAILED( rc))3629 if (FAILED(hrc)) 3655 3630 sessionMachine->uninit(); 3656 3631 } 3657 3632 3658 if (SUCCEEDED( rc))3633 if (SUCCEEDED(hrc)) 3659 3634 { 3660 3635 /* … … 3669 3644 } 3670 3645 3671 return rc;3646 return hrc; 3672 3647 } 3673 3648 … … 3688 3663 CheckComArgNotNull(aSession); 3689 3664 3690 HRESULT rc = S_OK;3665 HRESULT hrc = S_OK; 3691 3666 if (strFrontend.isEmpty()) 3692 3667 { 3693 3668 Bstr bstrFrontend; 3694 rc = COMGETTER(DefaultFrontend)(bstrFrontend.asOutParam());3695 if (FAILED( rc))3696 return rc;3669 hrc = COMGETTER(DefaultFrontend)(bstrFrontend.asOutParam()); 3670 if (FAILED(hrc)) 3671 return hrc; 3697 3672 strFrontend = bstrFrontend; 3698 3673 if (strFrontend.isEmpty()) 3699 3674 { 3700 3675 ComPtr<ISystemProperties> systemProperties; 3701 rc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam());3702 if (FAILED( rc))3703 return rc;3704 rc = systemProperties->COMGETTER(DefaultFrontend)(bstrFrontend.asOutParam());3705 if (FAILED( rc))3706 return rc;3676 hrc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 3677 if (FAILED(hrc)) 3678 return hrc; 3679 hrc = systemProperties->COMGETTER(DefaultFrontend)(bstrFrontend.asOutParam()); 3680 if (FAILED(hrc)) 3681 return hrc; 3707 3682 strFrontend = bstrFrontend; 3708 3683 } … … 3719 3694 /* check the session state */ 3720 3695 SessionState_T state; 3721 rc = aSession->COMGETTER(State)(&state);3722 if (FAILED( rc))3723 return rc;3696 hrc = aSession->COMGETTER(State)(&state); 3697 if (FAILED(hrc)) 3698 return hrc; 3724 3699 3725 3700 if (state != SessionState_Unlocked) … … 3735 3710 /* get the teleporter enable state for the progress object init. */ 3736 3711 BOOL fTeleporterEnabled; 3737 rc = COMGETTER(TeleporterEnabled)(&fTeleporterEnabled);3738 if (FAILED( rc))3739 return rc;3712 hrc = COMGETTER(TeleporterEnabled)(&fTeleporterEnabled); 3713 if (FAILED(hrc)) 3714 return hrc; 3740 3715 3741 3716 /* create a progress object */ 3742 3717 ComObjPtr<ProgressProxy> progress; 3743 3718 progress.createObject(); 3744 rc = progress->init(mParent, 3745 static_cast<IMachine*>(this), 3746 Bstr(tr("Starting VM")).raw(), 3747 TRUE /* aCancelable */, 3748 fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */, 3749 BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"), 3750 mUserData->s.strName.c_str(), strFrontend.c_str()).raw(), 3751 2 /* uFirstOperationWeight */, 3752 fTeleporterEnabled ? 3 : 1 /* cOtherProgressObjectOperations */); 3753 3754 if (SUCCEEDED(rc)) 3755 { 3756 rc = i_launchVMProcess(control, strFrontend, aEnvironmentChanges, progress); 3757 if (SUCCEEDED(rc)) 3719 hrc = progress->init(mParent, 3720 static_cast<IMachine*>(this), 3721 Bstr(tr("Starting VM")).raw(), 3722 TRUE /* aCancelable */, 3723 fTeleporterEnabled ? 20 : 10 /* uTotalOperationsWeight */, 3724 BstrFmt(tr("Creating process for virtual machine \"%s\" (%s)"), 3725 mUserData->s.strName.c_str(), strFrontend.c_str()).raw(), 3726 2 /* uFirstOperationWeight */, 3727 fTeleporterEnabled ? 3 : 1 /* cOtherProgressObjectOperations */); 3728 if (SUCCEEDED(hrc)) 3729 { 3730 hrc = i_launchVMProcess(control, strFrontend, aEnvironmentChanges, progress); 3731 if (SUCCEEDED(hrc)) 3758 3732 { 3759 3733 aProgress = progress; … … 3795 3769 } 3796 3770 3797 return rc;3771 return hrc; 3798 3772 } 3799 3773 … … 3811 3785 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3812 3786 3813 HRESULT rc = i_checkStateDependency(MutableStateDep);3814 if (FAILED( rc)) returnrc;3787 HRESULT hrc = i_checkStateDependency(MutableStateDep); 3788 if (FAILED(hrc)) return hrc; 3815 3789 3816 3790 i_setModified(IsModified_MachineData); … … 3850 3824 AutoWriteLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3851 3825 3852 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);3853 if (FAILED( rc)) returnrc;3826 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 3827 if (FAILED(hrc)) return hrc; 3854 3828 3855 3829 /// @todo NEWMEDIA implicit machine registration … … 3862 3836 /* Check for an existing controller. */ 3863 3837 ComObjPtr<StorageController> ctl; 3864 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);3865 if (FAILED( rc)) returnrc;3838 hrc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 3839 if (FAILED(hrc)) return hrc; 3866 3840 3867 3841 StorageControllerType_T ctrlType; 3868 rc = ctl->COMGETTER(ControllerType)(&ctrlType); 3869 if (FAILED(rc)) 3870 return setError(E_FAIL, 3871 tr("Could not get type of controller '%s'"), 3872 aName.c_str()); 3842 hrc = ctl->COMGETTER(ControllerType)(&ctrlType); 3843 if (FAILED(hrc)) 3844 return setError(E_FAIL, tr("Could not get type of controller '%s'"), aName.c_str()); 3873 3845 3874 3846 bool fSilent = false; … … 3891 3863 3892 3864 // check that the port and device are not out of range 3893 rc = ctl->i_checkPortAndDeviceValid(aControllerPort, aDevice);3894 if (FAILED( rc)) returnrc;3865 hrc = ctl->i_checkPortAndDeviceValid(aControllerPort, aDevice); 3866 if (FAILED(hrc)) return hrc; 3895 3867 3896 3868 /* check if the device slot is already busy */ … … 4003 3975 MediumLockList *pMediumLockList(new MediumLockList()); 4004 3976 4005 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,4006 medium /* pToLockWrite */,4007 false /* fMediumLockWriteAll */,4008 NULL,4009 *pMediumLockList);3977 hrc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 3978 medium /* pToLockWrite */, 3979 false /* fMediumLockWriteAll */, 3980 NULL, 3981 *pMediumLockList); 4010 3982 alock.acquire(); 4011 if (FAILED( rc))3983 if (FAILED(hrc)) 4012 3984 delete pMediumLockList; 4013 3985 else … … 4016 3988 mData->mSession.mLockedMedia.Unlock(); 4017 3989 alock.release(); 4018 rc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList);3990 hrc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList); 4019 3991 mData->mSession.mLockedMedia.Lock(); 4020 3992 alock.acquire(); … … 4022 3994 alock.release(); 4023 3995 4024 if (SUCCEEDED( rc))3996 if (SUCCEEDED(hrc)) 4025 3997 { 4026 rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);3998 hrc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4027 3999 /* Remove lock list in case of error. */ 4028 if (FAILED( rc))4000 if (FAILED(hrc)) 4029 4001 { 4030 4002 mData->mSession.mLockedMedia.Unlock(); … … 4105 4077 MediumLockList *pMediumLockList(new MediumLockList()); 4106 4078 4107 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,4108 medium /* pToLockWrite */,4109 false /* fMediumLockWriteAll */,4110 NULL,4111 *pMediumLockList);4079 hrc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4080 medium /* pToLockWrite */, 4081 false /* fMediumLockWriteAll */, 4082 NULL, 4083 *pMediumLockList); 4112 4084 alock.acquire(); 4113 if (FAILED( rc))4085 if (FAILED(hrc)) 4114 4086 delete pMediumLockList; 4115 4087 else … … 4118 4090 mData->mSession.mLockedMedia.Unlock(); 4119 4091 alock.release(); 4120 rc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList);4092 hrc = mData->mSession.mLockedMedia.Insert(pAttachTemp, pMediumLockList); 4121 4093 mData->mSession.mLockedMedia.Lock(); 4122 4094 alock.acquire(); … … 4124 4096 alock.release(); 4125 4097 4126 if (SUCCEEDED( rc))4098 if (SUCCEEDED(hrc)) 4127 4099 { 4128 rc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent);4100 hrc = i_onStorageDeviceChange(pAttachTemp, FALSE /* aRemove */, fSilent); 4129 4101 /* Remove lock list in case of error. */ 4130 if (FAILED( rc))4102 if (FAILED(hrc)) 4131 4103 { 4132 4104 mData->mSession.mLockedMedia.Unlock(); … … 4265 4237 medium->i_getFirstRegistryMachineId(uuidRegistryParent); 4266 4238 } 4267 rc = diff->init(mParent,4268 medium->i_getPreferredDiffFormat(),4269 strFullSnapshotFolder.append(RTPATH_SLASH_STR),4270 uuidRegistryParent,4271 DeviceType_HardDisk);4272 if (FAILED( rc)) returnrc;4239 hrc = diff->init(mParent, 4240 medium->i_getPreferredDiffFormat(), 4241 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 4242 uuidRegistryParent, 4243 DeviceType_HardDisk); 4244 if (FAILED(hrc)) return hrc; 4273 4245 4274 4246 /* Apply the normal locking logic to the entire chain. */ … … 4276 4248 mediumLock.release(); 4277 4249 treeLock.release(); 4278 rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */,4279 diff /* pToLockWrite */,4280 false /* fMediumLockWriteAll */,4281 medium,4282 *pMediumLockList);4250 hrc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, 4251 diff /* pToLockWrite */, 4252 false /* fMediumLockWriteAll */, 4253 medium, 4254 *pMediumLockList); 4283 4255 treeLock.acquire(); 4284 4256 mediumLock.acquire(); 4285 if (SUCCEEDED( rc))4257 if (SUCCEEDED(hrc)) 4286 4258 { 4287 4259 mediumLock.release(); 4288 4260 treeLock.release(); 4289 rc = pMediumLockList->Lock();4261 hrc = pMediumLockList->Lock(); 4290 4262 treeLock.acquire(); 4291 4263 mediumLock.acquire(); 4292 if (FAILED( rc))4293 setError( rc,4264 if (FAILED(hrc)) 4265 setError(hrc, 4294 4266 tr("Could not lock medium when creating diff '%s'"), 4295 4267 diff->i_getLocationFull().c_str()); … … 4305 4277 alock.release(); 4306 4278 4307 rc = medium->i_createDiffStorage(diff,4308 medium->i_getPreferredDiffVariant(),4309 pMediumLockList,4310 NULL /* aProgress */,4311 true /* aWait */,4312 false /* aNotify */);4279 hrc = medium->i_createDiffStorage(diff, 4280 medium->i_getPreferredDiffVariant(), 4281 pMediumLockList, 4282 NULL /* aProgress */, 4283 true /* aWait */, 4284 false /* aNotify */); 4313 4285 4314 4286 alock.acquire(); … … 4323 4295 delete pMediumLockList; 4324 4296 4325 if (FAILED( rc)) returnrc;4297 if (FAILED(hrc)) return hrc; 4326 4298 4327 4299 /* use the created diff for the actual attachment */ … … 4335 4307 ComObjPtr<MediumAttachment> attachment; 4336 4308 attachment.createObject(); 4337 rc = attachment->init(this,4338 medium,4339 aName,4340 aControllerPort,4341 aDevice,4342 aType,4343 fIndirect,4344 false /* fPassthrough */,4345 false /* fTempEject */,4346 false /* fNonRotational */,4347 false /* fDiscard */,4348 fHotplug || ctrlType == StorageControllerType_USB /* fHotPluggable */,4349 Utf8Str::Empty);4350 if (FAILED( rc)) returnrc;4309 hrc = attachment->init(this, 4310 medium, 4311 aName, 4312 aControllerPort, 4313 aDevice, 4314 aType, 4315 fIndirect, 4316 false /* fPassthrough */, 4317 false /* fTempEject */, 4318 false /* fNonRotational */, 4319 false /* fDiscard */, 4320 fHotplug || ctrlType == StorageControllerType_USB /* fHotPluggable */, 4321 Utf8Str::Empty); 4322 if (FAILED(hrc)) return hrc; 4351 4323 4352 4324 if (associate && !medium.isNull()) 4353 4325 { 4354 4326 // as the last step, associate the medium to the VM 4355 rc = medium->i_addBackReference(mData->mUuid);4327 hrc = medium->i_addBackReference(mData->mUuid); 4356 4328 // here we can fail because of Deleting, or being in process of creating a Diff 4357 if (FAILED( rc)) returnrc;4329 if (FAILED(hrc)) return hrc; 4358 4330 4359 4331 mediumLock.release(); … … 4381 4353 MediumLockList *pMediumLockList(new MediumLockList()); 4382 4354 4383 rc = medium->i_createMediumLockList(true /* fFailIfInaccessible */,4384 medium /* pToLockWrite */,4385 false /* fMediumLockWriteAll */,4386 NULL,4387 *pMediumLockList);4355 hrc = medium->i_createMediumLockList(true /* fFailIfInaccessible */, 4356 medium /* pToLockWrite */, 4357 false /* fMediumLockWriteAll */, 4358 NULL, 4359 *pMediumLockList); 4388 4360 alock.acquire(); 4389 if (FAILED( rc))4361 if (FAILED(hrc)) 4390 4362 delete pMediumLockList; 4391 4363 else … … 4394 4366 mData->mSession.mLockedMedia.Unlock(); 4395 4367 alock.release(); 4396 rc = mData->mSession.mLockedMedia.Insert(attachment, pMediumLockList);4368 hrc = mData->mSession.mLockedMedia.Insert(attachment, pMediumLockList); 4397 4369 mData->mSession.mLockedMedia.Lock(); 4398 4370 alock.acquire(); … … 4401 4373 } 4402 4374 4403 if (SUCCEEDED( rc))4404 { 4405 rc = i_onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);4375 if (SUCCEEDED(hrc)) 4376 { 4377 hrc = i_onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent); 4406 4378 /* Remove lock list in case of error. */ 4407 if (FAILED( rc))4379 if (FAILED(hrc)) 4408 4380 { 4409 4381 mData->mSession.mLockedMedia.Unlock(); … … 4419 4391 mParent->i_saveModifiedRegistries(); 4420 4392 4421 if (SUCCEEDED( rc))4393 if (SUCCEEDED(hrc)) 4422 4394 { 4423 4395 if (fIndirect && medium != aM) … … 4426 4398 } 4427 4399 4428 return rc;4400 return hrc; 4429 4401 } 4430 4402 … … 4432 4404 LONG aDevice) 4433 4405 { 4434 LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n", 4435 aName.c_str(), aControllerPort, aDevice)); 4406 LogFlowThisFunc(("aControllerName=\"%s\" aControllerPort=%d aDevice=%d\n", aName.c_str(), aControllerPort, aDevice)); 4436 4407 4437 4408 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4438 4409 4439 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);4440 if (FAILED( rc)) returnrc;4410 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 4411 if (FAILED(hrc)) return hrc; 4441 4412 4442 4413 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); … … 4444 4415 /* Check for an existing controller. */ 4445 4416 ComObjPtr<StorageController> ctl; 4446 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);4447 if (FAILED( rc)) returnrc;4417 hrc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4418 if (FAILED(hrc)) return hrc; 4448 4419 4449 4420 StorageControllerType_T ctrlType; 4450 rc = ctl->COMGETTER(ControllerType)(&ctrlType); 4451 if (FAILED(rc)) 4452 return setError(E_FAIL, 4453 tr("Could not get type of controller '%s'"), 4454 aName.c_str()); 4421 hrc = ctl->COMGETTER(ControllerType)(&ctrlType); 4422 if (FAILED(hrc)) 4423 return setError(E_FAIL, tr("Could not get type of controller '%s'"), aName.c_str()); 4455 4424 4456 4425 bool fSilent = false; … … 4494 4463 { 4495 4464 alock.release(); 4496 rc = i_onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);4465 hrc = i_onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent); 4497 4466 alock.acquire(); 4498 4467 } 4499 if (FAILED( rc)) returnrc;4468 if (FAILED(hrc)) return hrc; 4500 4469 4501 4470 /* If we are here everything went well and we can delete the implicit now. */ 4502 rc = i_detachDevice(pAttach, alock, NULL /* pSnapshot */);4471 hrc = i_detachDevice(pAttach, alock, NULL /* pSnapshot */); 4503 4472 4504 4473 alock.release(); … … 4509 4478 mParent->i_saveModifiedRegistries(); 4510 4479 4511 if (SUCCEEDED( rc))4480 if (SUCCEEDED(hrc)) 4512 4481 mParent->i_onStorageDeviceChanged(pAttach, TRUE, fSilent); 4513 4482 4514 return rc;4483 return hrc; 4515 4484 } 4516 4485 … … 4523 4492 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4524 4493 4525 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);4526 if (FAILED( rc)) returnrc;4494 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 4495 if (FAILED(hrc)) return hrc; 4527 4496 4528 4497 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); … … 4530 4499 /* Check for an existing controller. */ 4531 4500 ComObjPtr<StorageController> ctl; 4532 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);4533 if (FAILED( rc)) returnrc;4501 hrc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4502 if (FAILED(hrc)) return hrc; 4534 4503 4535 4504 StorageControllerType_T ctrlType; 4536 rc = ctl->COMGETTER(ControllerType)(&ctrlType);4537 if (FAILED( rc))4505 hrc = ctl->COMGETTER(ControllerType)(&ctrlType); 4506 if (FAILED(hrc)) 4538 4507 return setError(E_FAIL, 4539 4508 tr("Could not get type of controller '%s'"), … … 4585 4554 attLock.release(); 4586 4555 alock.release(); 4587 rc = i_onStorageDeviceChange(pAttach, FALSE /* aRemove */, FALSE /* aSilent */);4588 if (SUCCEEDED( rc) && fValueChanged)4556 hrc = i_onStorageDeviceChange(pAttach, FALSE /* aRemove */, FALSE /* aSilent */); 4557 if (SUCCEEDED(hrc) && fValueChanged) 4589 4558 mParent->i_onStorageDeviceChanged(pAttach, FALSE, FALSE); 4590 4559 4591 return rc;4560 return hrc; 4592 4561 } 4593 4562 … … 4601 4570 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4602 4571 4603 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);4604 if (FAILED( rc)) returnrc;4572 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 4573 if (FAILED(hrc)) return hrc; 4605 4574 4606 4575 MediumAttachment *pAttach = i_findAttachment(*mMediumAttachments.data(), … … 4637 4606 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4638 4607 4639 HRESULT rc = i_checkStateDependency(MutableStateDep);4640 if (FAILED( rc)) returnrc;4608 HRESULT hrc = i_checkStateDependency(MutableStateDep); 4609 if (FAILED(hrc)) return hrc; 4641 4610 4642 4611 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); … … 4680 4649 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4681 4650 4682 HRESULT rc = i_checkStateDependency(MutableStateDep);4683 if (FAILED( rc)) returnrc;4651 HRESULT hrc = i_checkStateDependency(MutableStateDep); 4652 if (FAILED(hrc)) return hrc; 4684 4653 4685 4654 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); … … 4722 4691 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4723 4692 4724 HRESULT rc = i_checkStateDependency(MutableStateDep);4725 if (FAILED( rc)) returnrc;4693 HRESULT hrc = i_checkStateDependency(MutableStateDep); 4694 if (FAILED(hrc)) return hrc; 4726 4695 4727 4696 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); … … 4743 4712 /* Check for an existing controller. */ 4744 4713 ComObjPtr<StorageController> ctl; 4745 rc = i_getStorageControllerByName(aName, ctl, true /* aSetError */);4746 if (FAILED( rc)) returnrc;4714 hrc = i_getStorageControllerByName(aName, ctl, true /* aSetError */); 4715 if (FAILED(hrc)) return hrc; 4747 4716 4748 4717 StorageControllerType_T ctrlType; 4749 rc = ctl->COMGETTER(ControllerType)(&ctrlType);4750 if (FAILED( rc))4718 hrc = ctl->COMGETTER(ControllerType)(&ctrlType); 4719 if (FAILED(hrc)) 4751 4720 return setError(E_FAIL, 4752 4721 tr("Could not get type of controller '%s'"), … … 4793 4762 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4794 4763 4795 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);4796 if (FAILED( rc)) returnrc;4764 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 4765 if (FAILED(hrc)) return hrc; 4797 4766 4798 4767 if (Global::IsOnlineOrTransient(mData->mMachineState)) … … 4826 4795 /* Get the bandwidth group object and release it - this must not fail. */ 4827 4796 ComObjPtr<BandwidthGroup> pBandwidthGroupOld; 4828 rc = i_getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false);4829 Assert(SUCCEEDED( rc));4797 hrc = i_getBandwidthGroup(strBandwidthGroupOld, pBandwidthGroupOld, false); 4798 Assert(SUCCEEDED(hrc)); 4830 4799 4831 4800 pBandwidthGroupOld->i_release(); … … 4959 4928 mediumLock.release(); 4960 4929 multiLock.release(); 4961 HRESULTrc = i_onMediumChange(pAttach, aForce);4930 hrc = i_onMediumChange(pAttach, aForce); 4962 4931 multiLock.acquire(); 4963 4932 mediumLock.acquire(); 4964 4933 4965 4934 /* On error roll back this change only. */ 4966 if (FAILED( rc))4935 if (FAILED(hrc)) 4967 4936 { 4968 4937 if (!pMedium.isNull()) … … 4974 4943 /* If the attachment is gone in the meantime, bail out. */ 4975 4944 if (pAttach.isNull()) 4976 return rc;4945 return hrc; 4977 4946 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 4978 4947 if (!oldmedium.isNull()) … … 4989 4958 mParent->i_saveModifiedRegistries(); 4990 4959 4991 return rc;4960 return hrc; 4992 4961 } 4993 4962 HRESULT Machine::getMedium(const com::Utf8Str &aName, … … 5198 5167 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 5199 5168 5200 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);5201 if (FAILED( rc)) returnrc;5169 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 5170 if (FAILED(hrc)) return hrc; 5202 5171 5203 5172 /* the settings file path may never be null */ … … 5206 5175 /* save all VM data excluding snapshots */ 5207 5176 bool fNeedsGlobalSaveSettings = false; 5208 rc = i_saveSettings(&fNeedsGlobalSaveSettings, mlock);5177 hrc = i_saveSettings(&fNeedsGlobalSaveSettings, mlock); 5209 5178 mlock.release(); 5210 5179 5211 if (SUCCEEDED( rc) && fNeedsGlobalSaveSettings)5180 if (SUCCEEDED(hrc) && fNeedsGlobalSaveSettings) 5212 5181 { 5213 5182 // save the global settings; for that we should hold only the VirtualBox lock 5214 5183 AutoWriteLock vlock(mParent COMMA_LOCKVAL_SRC_POS); 5215 rc = mParent->i_saveSettings();5216 } 5217 5218 return rc;5184 hrc = mParent->i_saveSettings(); 5185 } 5186 5187 return hrc; 5219 5188 } 5220 5189 … … 5272 5241 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5273 5242 5274 HRESULT rc = i_checkStateDependency(MutableOrSavedOrRunningStateDep);5275 if (FAILED( rc)) returnrc;5243 HRESULT hrc = i_checkStateDependency(MutableOrSavedOrRunningStateDep); 5244 if (FAILED(hrc)) return hrc; 5276 5245 5277 5246 /* … … 5318 5287 } 5319 5288 5320 HRESULT rc = S_OK;5289 HRESULT hrc = S_OK; 5321 5290 mData->llFilesToDelete.clear(); 5322 5291 … … 5369 5338 } 5370 5339 5371 if (FAILED( rc))5340 if (FAILED(hrc)) 5372 5341 { 5373 5342 i_rollbackMedia(); 5374 return rc;5343 return hrc; 5375 5344 } 5376 5345 … … 5458 5427 /* we might have been uninitialized because the session was accidentally 5459 5428 * closed by the client, so don't assert */ 5460 HRESULT rc = setError(E_FAIL, 5461 tr("The session has been accidentally closed")); 5462 task.m_pProgress->i_notifyComplete(rc); 5429 HRESULT hrc = setError(E_FAIL, tr("The session has been accidentally closed")); 5430 task.m_pProgress->i_notifyComplete(hrc); 5463 5431 LogFlowThisFuncLeave(); 5464 5432 return; … … 5467 5435 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5468 5436 5469 HRESULT rc = S_OK; 5470 5437 HRESULT hrc; 5471 5438 try 5472 5439 { 5473 5440 ULONG uLogHistoryCount = 3; 5474 5441 ComPtr<ISystemProperties> systemProperties; 5475 rc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam());5476 if (FAILED( rc)) throwrc;5442 hrc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 5443 if (FAILED(hrc)) throw hrc; 5477 5444 5478 5445 if (!systemProperties.isNull()) 5479 5446 { 5480 rc = systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount);5481 if (FAILED( rc)) throwrc;5447 hrc = systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount); 5448 if (FAILED(hrc)) throw hrc; 5482 5449 } 5483 5450 … … 5493 5460 Utf8Str strLocation = pMedium->i_getLocationFull(); 5494 5461 LogFunc(("Deleting file %s\n", strLocation.c_str())); 5495 rc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), strLocation.c_str()).raw(), 1);5496 if (FAILED( rc)) throwrc;5462 hrc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), strLocation.c_str()).raw(), 1); 5463 if (FAILED(hrc)) throw hrc; 5497 5464 } 5498 5465 if (pMedium->i_isMediumFormatFile()) 5499 5466 { 5500 5467 ComPtr<IProgress> pProgress2; 5501 rc = pMedium->DeleteStorage(pProgress2.asOutParam());5502 if (FAILED( rc)) throwrc;5503 rc = task.m_pProgress->WaitForOtherProgressCompletion(pProgress2, 0 /* indefinite wait */);5504 if (FAILED( rc)) throwrc;5468 hrc = pMedium->DeleteStorage(pProgress2.asOutParam()); 5469 if (FAILED(hrc)) throw hrc; 5470 hrc = task.m_pProgress->WaitForOtherProgressCompletion(pProgress2, 0 /* indefinite wait */); 5471 if (FAILED(hrc)) throw hrc; 5505 5472 } 5506 5473 … … 5528 5495 const Utf8Str &strFile = *it; 5529 5496 LogFunc(("Deleting file %s\n", strFile.c_str())); 5530 rc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()).raw(), 1);5531 if (FAILED( rc)) throwrc;5497 hrc = task.m_pProgress->SetNextOperation(BstrFmt(tr("Deleting '%s'"), it->c_str()).raw(), 1); 5498 if (FAILED(hrc)) throw hrc; 5532 5499 i_deleteFile(strFile); 5533 5500 } 5534 5501 5535 rc = task.m_pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")).raw(), 1);5536 if (FAILED( rc)) throwrc;5502 hrc = task.m_pProgress->SetNextOperation(Bstr(tr("Cleaning up machine directory")).raw(), 1); 5503 if (FAILED(hrc)) throw hrc; 5537 5504 5538 5505 /* delete the settings only when the file actually exists */ … … 5602 5569 mParent->i_saveModifiedRegistries(); 5603 5570 } 5604 catch (HRESULT aRC) { rc = aRC; } 5605 5606 task.m_pProgress->i_notifyComplete(rc); 5571 catch (HRESULT hrcXcpt) 5572 { 5573 hrc = hrcXcpt; 5574 } 5575 5576 task.m_pProgress->i_notifyComplete(hrc); 5607 5577 5608 5578 LogFlowThisFuncLeave(); … … 5613 5583 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5614 5584 5615 HRESULT rc = i_checkStateDependency(MutableStateDep);5616 if (FAILED( rc)) returnrc;5585 HRESULT hrc = i_checkStateDependency(MutableStateDep); 5586 if (FAILED(hrc)) return hrc; 5617 5587 5618 5588 if (mData->mRegistered) … … 5639 5609 return setError(E_INVALIDARG, tr("The given medium pointer with index %d is invalid"), i); 5640 5610 SafeArray<BSTR> ids; 5641 rc = pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids));5642 if (FAILED( rc)) returnrc;5611 hrc = pMedium->COMGETTER(MachineIds)(ComSafeArrayAsOutParam(ids)); 5612 if (FAILED(hrc)) return hrc; 5643 5613 /* At this point the medium should not have any back references 5644 5614 * anymore. If it has it is attached to another VM and *must* not … … 5650 5620 ComObjPtr<Progress> pProgress; 5651 5621 pProgress.createObject(); 5652 rc = pProgress->init(i_getVirtualBox(),5653 static_cast<IMachine*>(this) /* aInitiator */,5654 tr("Deleting files"),5655 true /* fCancellable */,5656 (ULONG)(1 + llMediums.size() + llFilesToDelete.size() + 1), // cOperations5657 tr("Collecting file inventory"));5658 if (FAILED( rc))5659 return rc;5622 hrc = pProgress->init(i_getVirtualBox(), 5623 static_cast<IMachine*>(this) /* aInitiator */, 5624 tr("Deleting files"), 5625 true /* fCancellable */, 5626 (ULONG)(1 + llMediums.size() + llFilesToDelete.size() + 1), // cOperations 5627 tr("Collecting file inventory")); 5628 if (FAILED(hrc)) 5629 return hrc; 5660 5630 5661 5631 /* create and start the task on a separate thread (note that it will not 5662 5632 * start working until we release alock) */ 5663 5633 DeleteConfigTask *pTask = new DeleteConfigTask(this, pProgress, "DeleteVM", llMediums, llFilesToDelete); 5664 rc = pTask->createThread();5634 hrc = pTask->createThread(); 5665 5635 pTask = NULL; 5666 if (FAILED( rc))5667 return rc;5636 if (FAILED(hrc)) 5637 return hrc; 5668 5638 5669 5639 pProgress.queryInterfaceTo(aProgress.asOutParam()); … … 5679 5649 5680 5650 ComObjPtr<Snapshot> pSnapshot; 5681 HRESULT rc;5651 HRESULT hrc; 5682 5652 5683 5653 if (aNameOrId.isEmpty()) 5684 5654 // null case (caller wants root snapshot): i_findSnapshotById() handles this 5685 rc = i_findSnapshotById(Guid(), pSnapshot, true /* aSetError */);5655 hrc = i_findSnapshotById(Guid(), pSnapshot, true /* aSetError */); 5686 5656 else 5687 5657 { 5688 5658 Guid uuid(aNameOrId); 5689 5659 if (uuid.isValid()) 5690 rc = i_findSnapshotById(uuid, pSnapshot, true /* aSetError */);5660 hrc = i_findSnapshotById(uuid, pSnapshot, true /* aSetError */); 5691 5661 else 5692 rc = i_findSnapshotByName(aNameOrId, pSnapshot, true /* aSetError */);5662 hrc = i_findSnapshotByName(aNameOrId, pSnapshot, true /* aSetError */); 5693 5663 } 5694 5664 pSnapshot.queryInterfaceTo(aSnapshot.asOutParam()); 5695 5665 5696 return rc;5666 return hrc; 5697 5667 } 5698 5668 … … 5702 5672 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5703 5673 5704 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);5705 if (FAILED( rc)) returnrc;5674 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 5675 if (FAILED(hrc)) return hrc; 5706 5676 5707 5677 ComObjPtr<SharedFolder> sharedFolder; 5708 rc = i_findSharedFolder(aName, sharedFolder, false /* aSetError */);5709 if (SUCCEEDED( rc))5678 hrc = i_findSharedFolder(aName, sharedFolder, false /* aSetError */); 5679 if (SUCCEEDED(hrc)) 5710 5680 return setError(VBOX_E_OBJECT_IN_USE, 5711 5681 tr("Shared folder named '%s' already exists"), … … 5713 5683 5714 5684 sharedFolder.createObject(); 5715 rc = sharedFolder->init(i_getMachine(),5716 aName,5717 aHostPath,5718 !!aWritable,5719 !!aAutomount,5720 aAutoMountPoint,5721 true /* fFailOnError */);5722 if (FAILED( rc)) returnrc;5685 hrc = sharedFolder->init(i_getMachine(), 5686 aName, 5687 aHostPath, 5688 !!aWritable, 5689 !!aAutomount, 5690 aAutoMountPoint, 5691 true /* fFailOnError */); 5692 if (FAILED(hrc)) return hrc; 5723 5693 5724 5694 i_setModified(IsModified_SharedFolders); … … 5737 5707 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5738 5708 5739 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);5740 if (FAILED( rc)) returnrc;5709 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 5710 if (FAILED(hrc)) return hrc; 5741 5711 5742 5712 ComObjPtr<SharedFolder> sharedFolder; 5743 rc = i_findSharedFolder(aName, sharedFolder, true /* aSetError */);5744 if (FAILED( rc)) returnrc;5713 hrc = i_findSharedFolder(aName, sharedFolder, true /* aSetError */); 5714 if (FAILED(hrc)) return hrc; 5745 5715 5746 5716 i_setModified(IsModified_SharedFolders); … … 5839 5809 com::Utf8Str &aFlags) const 5840 5810 { 5841 HRESULT rc = S_OK;5811 HRESULT hrc = S_OK; 5842 5812 Bstr bstrValue; 5843 5813 Bstr bstrFlags; … … 5852 5822 /* ignore calls made after #OnSessionEnd() is called */ 5853 5823 if (!directControl) 5854 rc = E_ACCESSDENIED;5824 hrc = E_ACCESSDENIED; 5855 5825 else 5856 rc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr::Empty.raw(), Bstr::Empty.raw(),5857 0 /* accessMode */,5858 bstrValue.asOutParam(), aTimestamp, bstrFlags.asOutParam());5826 hrc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr::Empty.raw(), Bstr::Empty.raw(), 5827 0 /* accessMode */, 5828 bstrValue.asOutParam(), aTimestamp, bstrFlags.asOutParam()); 5859 5829 5860 5830 aValue = bstrValue; 5861 5831 aFlags = bstrFlags; 5862 5832 5863 return rc;5833 return hrc; 5864 5834 } 5865 5835 #endif // VBOX_WITH_GUEST_PROPS … … 5874 5844 #else // VBOX_WITH_GUEST_PROPS 5875 5845 5876 HRESULT rc = i_getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags);5877 5878 if ( rc == E_ACCESSDENIED)5846 HRESULT hrc = i_getGuestPropertyFromVM(aName, aValue, aTimestamp, aFlags); 5847 5848 if (hrc == E_ACCESSDENIED) 5879 5849 /* The VM is not running or the service is not (yet) accessible */ 5880 rc = i_getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags);5881 return rc;5850 hrc = i_getGuestPropertyFromService(aName, aValue, aTimestamp, aFlags); 5851 return hrc; 5882 5852 #endif // VBOX_WITH_GUEST_PROPS 5883 5853 } … … 5887 5857 LONG64 dummyTimestamp; 5888 5858 com::Utf8Str dummyFlags; 5889 HRESULT rc = getGuestProperty(aProperty, aValue, &dummyTimestamp, dummyFlags); 5890 return rc; 5859 return getGuestProperty(aProperty, aValue, &dummyTimestamp, dummyFlags); 5891 5860 5892 5861 } … … 5895 5864 com::Utf8Str dummyFlags; 5896 5865 com::Utf8Str dummyValue; 5897 HRESULT rc = getGuestProperty(aProperty, dummyValue, aValue, dummyFlags); 5898 return rc; 5866 return getGuestProperty(aProperty, dummyValue, aValue, dummyFlags); 5899 5867 } 5900 5868 … … 5907 5875 { 5908 5876 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5909 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);5910 if (FAILED( rc)) returnrc;5877 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 5878 if (FAILED(hrc)) return hrc; 5911 5879 5912 5880 try … … 5939 5907 if (it->second.mFlags & (GUEST_PROP_F_RDONLYHOST)) 5940 5908 { 5941 rc = setError(E_ACCESSDENIED, tr("The property '%s' cannot be changed by the host"), aName.c_str());5909 hrc = setError(E_ACCESSDENIED, tr("The property '%s' cannot be changed by the host"), aName.c_str()); 5942 5910 } 5943 5911 else … … 5963 5931 } 5964 5932 5965 if (SUCCEEDED( rc))5933 if (SUCCEEDED(hrc)) 5966 5934 { 5967 5935 alock.release(); … … 5972 5940 catch (std::bad_alloc &) 5973 5941 { 5974 rc = E_OUTOFMEMORY;5975 } 5976 5977 return rc;5942 hrc = E_OUTOFMEMORY; 5943 } 5944 5945 return hrc; 5978 5946 } 5979 5947 … … 5987 5955 const com::Utf8Str &aFlags, bool fDelete) 5988 5956 { 5989 HRESULT rc;5957 HRESULT hrc; 5990 5958 5991 5959 try … … 6002 5970 LONG64 dummy64; 6003 5971 if (!directControl) 6004 rc = E_ACCESSDENIED;5972 hrc = E_ACCESSDENIED; 6005 5973 else 6006 5974 /** @todo Fix when adding DeleteGuestProperty(), see defect. */ 6007 rc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw(),6008 fDelete ? 2 : 1 /* accessMode */,6009 dummy1.asOutParam(), &dummy64, dummy2.asOutParam());5975 hrc = directControl->AccessGuestProperty(Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw(), 5976 fDelete ? 2 : 1 /* accessMode */, 5977 dummy1.asOutParam(), &dummy64, dummy2.asOutParam()); 6010 5978 } 6011 5979 catch (std::bad_alloc &) 6012 5980 { 6013 rc = E_OUTOFMEMORY;6014 } 6015 6016 return rc;5981 hrc = E_OUTOFMEMORY; 5982 } 5983 5984 return hrc; 6017 5985 } 6018 5986 #endif // VBOX_WITH_GUEST_PROPS … … 6031 5999 AssertRCReturn(vrc, setErrorBoth(E_INVALIDARG, vrc)); 6032 6000 6033 HRESULT rc = i_setGuestPropertyToVM(aProperty, aValue, aFlags, /* fDelete = */ false);6034 if ( rc == E_ACCESSDENIED)6001 HRESULT hrc = i_setGuestPropertyToVM(aProperty, aValue, aFlags, /* fDelete = */ false); 6002 if (hrc == E_ACCESSDENIED) 6035 6003 /* The VM is not running or the service is not (yet) accessible */ 6036 rc = i_setGuestPropertyToService(aProperty, aValue, aFlags, /* fDelete = */ false);6037 return rc;6004 hrc = i_setGuestPropertyToService(aProperty, aValue, aFlags, /* fDelete = */ false); 6005 return hrc; 6038 6006 #endif // VBOX_WITH_GUEST_PROPS 6039 6007 } … … 6049 6017 ReturnComNotImplemented(); 6050 6018 #else // VBOX_WITH_GUEST_PROPS 6051 HRESULT rc = i_setGuestPropertyToVM(aName, "", "", /* fDelete = */ true);6052 if ( rc == E_ACCESSDENIED)6019 HRESULT hrc = i_setGuestPropertyToVM(aName, "", "", /* fDelete = */ true); 6020 if (hrc == E_ACCESSDENIED) 6053 6021 /* The VM is not running or the service is not (yet) accessible */ 6054 rc = i_setGuestPropertyToService(aName, "", "", /* fDelete = */ true);6055 return rc;6022 hrc = i_setGuestPropertyToService(aName, "", "", /* fDelete = */ true); 6023 return hrc; 6056 6024 #endif // VBOX_WITH_GUEST_PROPS 6057 6025 } … … 6137 6105 std::vector<com::Utf8Str> &aFlags) 6138 6106 { 6139 HRESULT rc;6107 HRESULT hrc; 6140 6108 ComPtr<IInternalSessionControl> directControl; 6141 6109 { … … 6151 6119 6152 6120 if (!directControl) 6153 rc = E_ACCESSDENIED;6121 hrc = E_ACCESSDENIED; 6154 6122 else 6155 rc = directControl->EnumerateGuestProperties(Bstr(aPatterns).raw(),6156 ComSafeArrayAsOutParam(bNames),6157 ComSafeArrayAsOutParam(bValues),6158 ComSafeArrayAsOutParam(bTimestamps),6159 ComSafeArrayAsOutParam(bFlags));6123 hrc = directControl->EnumerateGuestProperties(Bstr(aPatterns).raw(), 6124 ComSafeArrayAsOutParam(bNames), 6125 ComSafeArrayAsOutParam(bValues), 6126 ComSafeArrayAsOutParam(bTimestamps), 6127 ComSafeArrayAsOutParam(bFlags)); 6160 6128 size_t i; 6161 6129 aNames.resize(bNames.size()); … … 6172 6140 aFlags[i] = Utf8Str(bFlags[i]); 6173 6141 6174 return rc;6142 return hrc; 6175 6143 } 6176 6144 #endif // VBOX_WITH_GUEST_PROPS … … 6185 6153 #else // VBOX_WITH_GUEST_PROPS 6186 6154 6187 HRESULT rc = i_enumerateGuestPropertiesOnVM(aPatterns, aNames, aValues, aTimestamps, aFlags);6188 6189 if ( rc == E_ACCESSDENIED)6155 HRESULT hrc = i_enumerateGuestPropertiesOnVM(aPatterns, aNames, aValues, aTimestamps, aFlags); 6156 6157 if (hrc == E_ACCESSDENIED) 6190 6158 /* The VM is not running or the service is not (yet) accessible */ 6191 rc = i_enumerateGuestPropertiesInService(aPatterns, aNames, aValues, aTimestamps, aFlags);6192 return rc;6159 hrc = i_enumerateGuestPropertiesInService(aPatterns, aNames, aValues, aTimestamps, aFlags); 6160 return hrc; 6193 6161 #endif // VBOX_WITH_GUEST_PROPS 6194 6162 } … … 6199 6167 MediumAttachmentList atts; 6200 6168 6201 HRESULT rc = i_getMediumAttachmentsOfController(aName, atts);6202 if (FAILED( rc)) returnrc;6169 HRESULT hrc = i_getMediumAttachmentsOfController(aName, atts); 6170 if (FAILED(hrc)) return hrc; 6203 6171 6204 6172 aMediumAttachments.resize(atts.size()); … … 6252 6220 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6253 6221 6254 HRESULT rc = i_checkStateDependency(MutableStateDep);6255 if (FAILED( rc)) returnrc;6222 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6223 if (FAILED(hrc)) return hrc; 6256 6224 6257 6225 /* try to find one with the name first. */ 6258 6226 ComObjPtr<StorageController> ctrl; 6259 6227 6260 rc = i_getStorageControllerByName(aName, ctrl, false /* aSetError */);6261 if (SUCCEEDED( rc))6228 hrc = i_getStorageControllerByName(aName, ctrl, false /* aSetError */); 6229 if (SUCCEEDED(hrc)) 6262 6230 return setError(VBOX_E_OBJECT_IN_USE, 6263 6231 tr("Storage controller named '%s' already exists"), … … 6287 6255 } 6288 6256 6289 rc = ctrl->init(this, aName, aConnectionType, ulInstance, fBootable);6290 if (FAILED( rc)) returnrc;6257 hrc = ctrl->init(this, aName, aConnectionType, ulInstance, fBootable); 6258 if (FAILED(hrc)) return hrc; 6291 6259 6292 6260 i_setModified(IsModified_Storage); … … 6310 6278 ComObjPtr<StorageController> ctrl; 6311 6279 6312 HRESULT rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);6313 if (SUCCEEDED( rc))6280 HRESULT hrc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6281 if (SUCCEEDED(hrc)) 6314 6282 ctrl.queryInterfaceTo(aStorageController.asOutParam()); 6315 6283 6316 return rc;6284 return hrc; 6317 6285 } 6318 6286 … … 6345 6313 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6346 6314 6347 HRESULT rc = i_checkStateDependency(MutableStateDep);6348 if (FAILED( rc)) returnrc;6315 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6316 if (FAILED(hrc)) return hrc; 6349 6317 6350 6318 ComObjPtr<StorageController> ctrl; 6351 6319 6352 rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);6353 if (SUCCEEDED( rc))6320 hrc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6321 if (SUCCEEDED(hrc)) 6354 6322 { 6355 6323 /* Ensure that only one controller of each type is marked as bootable. */ … … 6374 6342 } 6375 6343 6376 if (SUCCEEDED( rc))6344 if (SUCCEEDED(hrc)) 6377 6345 { 6378 6346 ctrl->i_setBootable(aBootable); … … 6381 6349 } 6382 6350 6383 if (SUCCEEDED( rc))6351 if (SUCCEEDED(hrc)) 6384 6352 { 6385 6353 /* inform the direct session if any */ … … 6388 6356 } 6389 6357 6390 return rc;6358 return hrc; 6391 6359 } 6392 6360 … … 6395 6363 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6396 6364 6397 HRESULT rc = i_checkStateDependency(MutableStateDep);6398 if (FAILED( rc)) returnrc;6365 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6366 if (FAILED(hrc)) return hrc; 6399 6367 6400 6368 ComObjPtr<StorageController> ctrl; 6401 rc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */);6402 if (FAILED( rc)) returnrc;6369 hrc = i_getStorageControllerByName(aName, ctrl, true /* aSetError */); 6370 if (FAILED(hrc)) return hrc; 6403 6371 6404 6372 MediumAttachmentList llDetachedAttachments; … … 6424 6392 { 6425 6393 llDetachedAttachments.push_back(pAttachTemp); 6426 rc = i_detachDevice(pAttachTemp, alock, NULL);6427 if (FAILED( rc)) returnrc;6394 hrc = i_detachDevice(pAttachTemp, alock, NULL); 6395 if (FAILED(hrc)) return hrc; 6428 6396 } 6429 6397 } … … 6465 6433 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6466 6434 6467 HRESULT rc = i_checkStateDependency(MutableStateDep);6468 if (FAILED( rc)) returnrc;6435 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6436 if (FAILED(hrc)) return hrc; 6469 6437 6470 6438 /* try to find one with the same type first. */ 6471 6439 ComObjPtr<USBController> ctrl; 6472 6440 6473 rc = i_getUSBControllerByName(aName, ctrl, false /* aSetError */);6474 if (SUCCEEDED( rc))6441 hrc = i_getUSBControllerByName(aName, ctrl, false /* aSetError */); 6442 if (SUCCEEDED(hrc)) 6475 6443 return setError(VBOX_E_OBJECT_IN_USE, 6476 6444 tr("USB controller named '%s' already exists"), … … 6479 6447 /* Check that we don't exceed the maximum number of USB controllers for the given type. */ 6480 6448 ULONG maxInstances; 6481 rc = mParent->i_getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances);6482 if (FAILED( rc))6483 return rc;6449 hrc = mParent->i_getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances); 6450 if (FAILED(hrc)) 6451 return hrc; 6484 6452 6485 6453 ULONG cInstances = i_getUSBControllerCountByType(aType); … … 6490 6458 ctrl.createObject(); 6491 6459 6492 rc = ctrl->init(this, aName, aType);6493 if (FAILED( rc)) returnrc;6460 hrc = ctrl->init(this, aName, aType); 6461 if (FAILED(hrc)) return hrc; 6494 6462 6495 6463 i_setModified(IsModified_USB); … … 6512 6480 ComObjPtr<USBController> ctrl; 6513 6481 6514 HRESULT rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */);6515 if (SUCCEEDED( rc))6482 HRESULT hrc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */); 6483 if (SUCCEEDED(hrc)) 6516 6484 ctrl.queryInterfaceTo(aController.asOutParam()); 6517 6485 6518 return rc;6486 return hrc; 6519 6487 } 6520 6488 … … 6542 6510 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6543 6511 6544 HRESULT rc = i_checkStateDependency(MutableStateDep);6545 if (FAILED( rc)) returnrc;6512 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6513 if (FAILED(hrc)) return hrc; 6546 6514 6547 6515 ComObjPtr<USBController> ctrl; 6548 rc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */);6549 if (FAILED( rc)) returnrc;6516 hrc = i_getUSBControllerByName(aName, ctrl, true /* aSetError */); 6517 if (FAILED(hrc)) return hrc; 6550 6518 6551 6519 i_setModified(IsModified_USB); … … 6791 6759 HRESULT Machine::hotPlugCPU(ULONG aCpu) 6792 6760 { 6793 HRESULT rc = S_OK;6794 6761 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6795 6762 … … 6803 6770 return setError(VBOX_E_OBJECT_IN_USE, tr("CPU %lu is already attached"), aCpu); 6804 6771 6805 rc = i_checkStateDependency(MutableOrRunningStateDep);6806 if (FAILED( rc)) returnrc;6772 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 6773 if (FAILED(hrc)) return hrc; 6807 6774 6808 6775 alock.release(); 6809 rc = i_onCPUChange(aCpu, false);6776 hrc = i_onCPUChange(aCpu, false); 6810 6777 alock.acquire(); 6811 if (FAILED( rc)) returnrc;6778 if (FAILED(hrc)) return hrc; 6812 6779 6813 6780 i_setModified(IsModified_MachineData); … … 6824 6791 HRESULT Machine::hotUnplugCPU(ULONG aCpu) 6825 6792 { 6826 HRESULT rc = S_OK;6827 6828 6793 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6829 6794 … … 6843 6808 return setError(E_INVALIDARG, tr("It is not possible to detach CPU 0")); 6844 6809 6845 rc = i_checkStateDependency(MutableOrRunningStateDep);6846 if (FAILED( rc)) returnrc;6810 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 6811 if (FAILED(hrc)) return hrc; 6847 6812 6848 6813 alock.release(); 6849 rc = i_onCPUChange(aCpu, true);6814 hrc = i_onCPUChange(aCpu, true); 6850 6815 alock.acquire(); 6851 if (FAILED( rc)) returnrc;6816 if (FAILED(hrc)) return hrc; 6852 6817 6853 6818 i_setModified(IsModified_MachineData); … … 6902 6867 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 6903 6868 6904 HRESULT rc = S_OK;6869 HRESULT hrc = S_OK; 6905 6870 Utf8Str log = i_getLogFilename(aIdx); 6906 6871 … … 6923 6888 { 6924 6889 PCVBOXCRYPTOIF pCryptoIf = NULL; 6925 rc = i_getVirtualBox()->i_retainCryptoIf(&pCryptoIf);6926 if (SUCCEEDED( rc))6890 hrc = i_getVirtualBox()->i_retainCryptoIf(&pCryptoIf); 6891 if (SUCCEEDED(hrc)) 6927 6892 { 6928 6893 alock.acquire(); … … 6966 6931 aData.resize(cbData); 6967 6932 else 6968 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6969 tr("Could not read log file '%s' (%Rrc)"), 6970 log.c_str(), vrc); 6933 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not read log file '%s' (%Rrc)"), log.c_str(), vrc); 6971 6934 6972 6935 RTVfsIoStrmRelease(hVfsIosLog); 6973 6936 } 6974 6937 else 6975 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, 6976 tr("Could not open log file '%s' (%Rrc)"), 6977 log.c_str(), vrc); 6978 6979 if (FAILED(rc)) 6938 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not open log file '%s' (%Rrc)"), log.c_str(), vrc); 6939 6940 if (FAILED(hrc)) 6980 6941 aData.resize(0); 6981 6942 6982 return rc;6943 return hrc; 6983 6944 } 6984 6945 … … 6994 6955 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 6995 6956 6996 HRESULT rc = i_checkStateDependency(MutableStateDep);6997 if (FAILED( rc)) returnrc;6957 HRESULT hrc = i_checkStateDependency(MutableStateDep); 6958 if (FAILED(hrc)) return hrc; 6998 6959 6999 6960 ChipsetType_T aChipset = ChipsetType_PIIX3; … … 7044 7005 ComObjPtr<PCIDeviceAttachment> pAttach; 7045 7006 bool fRemoved = false; 7046 HRESULT rc;7007 HRESULT hrc; 7047 7008 7048 7009 // lock scope … … 7050 7011 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 7051 7012 7052 rc = i_checkStateDependency(MutableStateDep);7053 if (FAILED( rc)) returnrc;7013 hrc = i_checkStateDependency(MutableStateDep); 7014 if (FAILED(hrc)) return hrc; 7054 7015 7055 7016 for (HWData::PCIDeviceAssignmentList::const_iterator … … 7078 7039 Assert(!pAttach.isNull()); 7079 7040 ComPtr<IEventSource> es; 7080 rc = mParent->COMGETTER(EventSource)(es.asOutParam());7081 Assert(SUCCEEDED( rc));7041 hrc = mParent->COMGETTER(EventSource)(es.asOutParam()); 7042 Assert(SUCCEEDED(hrc)); 7082 7043 Bstr mid; 7083 rc = this->COMGETTER(Id)(mid.asOutParam());7084 Assert(SUCCEEDED( rc));7044 hrc = this->COMGETTER(Id)(mid.asOutParam()); 7045 Assert(SUCCEEDED(hrc)); 7085 7046 ::FireHostPCIDevicePlugEvent(es, mid.raw(), false /* unplugged */, true /* success */, pAttach, NULL); 7086 7047 } … … 7431 7392 MachineCloneVM *pWorker = new MachineCloneVM(this, static_cast<Machine*>(pTarget), aMode, optList); 7432 7393 7433 HRESULT rc = pWorker->start(pProgress);7394 HRESULT hrc = pWorker->start(pProgress); 7434 7395 7435 7396 pP = static_cast<Progress *>(*pProgress); 7436 7397 pP.queryInterfaceTo(aProgress.asOutParam()); 7437 7398 7438 return rc;7399 return hrc; 7439 7400 7440 7401 } … … 7491 7452 7492 7453 // This check should always fail. 7493 HRESULT rc = i_checkStateDependency(MutableStateDep);7494 if (FAILED( rc)) returnrc;7454 HRESULT hrc = i_checkStateDependency(MutableStateDep); 7455 if (FAILED(hrc)) return hrc; 7495 7456 7496 7457 AssertFailedReturn(E_NOTIMPL); … … 7503 7464 7504 7465 // This check should always fail. 7505 HRESULT rc = i_checkStateDependency(MutableStateDep);7506 if (FAILED( rc)) returnrc;7466 HRESULT hrc = i_checkStateDependency(MutableStateDep); 7467 if (FAILED(hrc)) return hrc; 7507 7468 7508 7469 AssertFailedReturn(E_NOTIMPL); … … 7515 7476 7516 7477 // This check should always fail. 7517 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);7518 if (FAILED( rc)) returnrc;7478 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 7479 if (FAILED(hrc)) return hrc; 7519 7480 7520 7481 AssertFailedReturn(E_NOTIMPL); … … 7882 7843 { 7883 7844 Utf8Str strHardeningLogFile = i_getHardeningLogFilename(); 7884 int vrc2 ;7885 /* ignore rc */ i_deleteFile(strHardeningLogFile, false /* fIgnoreFailures */, tr("hardening log file"), &vrc2);7845 int vrc2 = VERR_IPE_UNINITIALIZED_STATUS; 7846 i_deleteFile(strHardeningLogFile, false /* fIgnoreFailures */, tr("hardening log file"), &vrc2); /* ignoring return code */ 7886 7847 if (vrc2 == VERR_PATH_NOT_FOUND || vrc2 == VERR_FILE_NOT_FOUND) 7887 7848 { … … 8050 8011 /* connect to VBoxSDS */ 8051 8012 ComPtr<IVirtualBoxSDS> pVBoxSDS; 8052 HRESULT rc = pVBoxSDS.createLocalObject(CLSID_VirtualBoxSDS);8053 if (FAILED( rc))8054 return setError( rc, tr("Failed to start the machine '%s'. A connection to VBoxSDS cannot be established"),8013 HRESULT hrc = pVBoxSDS.createLocalObject(CLSID_VirtualBoxSDS); 8014 if (FAILED(hrc)) 8015 return setError(hrc, tr("Failed to start the machine '%s'. A connection to VBoxSDS cannot be established"), 8055 8016 strMachineName.c_str()); 8056 8017 … … 8059 8020 elevates the impersonation level up to RPC_C_IMP_LEVEL_IMPERSONATE allowing the VBoxSDS 8060 8021 service to access the files. */ 8061 rc = CoSetProxyBlanket(pVBoxSDS,8062 RPC_C_AUTHN_DEFAULT,8063 RPC_C_AUTHZ_DEFAULT,8064 COLE_DEFAULT_PRINCIPAL,8065 RPC_C_AUTHN_LEVEL_DEFAULT,8066 RPC_C_IMP_LEVEL_IMPERSONATE,8067 NULL,8068 EOAC_DEFAULT);8069 if (FAILED( rc))8070 return setError( rc, tr("Failed to start the machine '%s'. CoSetProxyBlanket failed"), strMachineName.c_str());8022 hrc = CoSetProxyBlanket(pVBoxSDS, 8023 RPC_C_AUTHN_DEFAULT, 8024 RPC_C_AUTHZ_DEFAULT, 8025 COLE_DEFAULT_PRINCIPAL, 8026 RPC_C_AUTHN_LEVEL_DEFAULT, 8027 RPC_C_IMP_LEVEL_IMPERSONATE, 8028 NULL, 8029 EOAC_DEFAULT); 8030 if (FAILED(hrc)) 8031 return setError(hrc, tr("Failed to start the machine '%s'. CoSetProxyBlanket failed"), strMachineName.c_str()); 8071 8032 8072 8033 size_t const cEnvVars = aEnvironmentChanges.size(); … … 8076 8037 8077 8038 ULONG uPid = 0; 8078 rc = pVBoxSDS->LaunchVMProcess(Bstr(idStr).raw(), Bstr(strMachineName).raw(), Bstr(strFrontend).raw(),8079 ComSafeArrayAsInParam(aBstrEnvironmentChanges), Bstr(strSupHardeningLogArg).raw(),8080 idCallerSession, &uPid);8081 if (FAILED( rc))8082 return setError( rc, tr("Failed to start the machine '%s'. Process creation failed"), strMachineName.c_str());8039 hrc = pVBoxSDS->LaunchVMProcess(Bstr(idStr).raw(), Bstr(strMachineName).raw(), Bstr(strFrontend).raw(), 8040 ComSafeArrayAsInParam(aBstrEnvironmentChanges), Bstr(strSupHardeningLogArg).raw(), 8041 idCallerSession, &uPid); 8042 if (FAILED(hrc)) 8043 return setError(hrc, tr("Failed to start the machine '%s'. Process creation failed"), strMachineName.c_str()); 8083 8044 pid = (RTPROCESS)uPid; 8084 8045 } … … 8110 8071 LogFlowThisFunc(("Calling AssignMachine (NULL)...\n")); 8111 8072 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER 8112 HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, Bstr::Empty.raw());8073 HRESULT hrc = aControl->AssignMachine(NULL, LockType_Write, Bstr::Empty.raw()); 8113 8074 #else /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 8114 HRESULT rc = aControl->AssignMachine(NULL, LockType_Write, NULL);8075 HRESULT hrc = aControl->AssignMachine(NULL, LockType_Write, NULL); 8115 8076 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 8116 LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc));8117 8118 if (FAILED( rc))8077 LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", hrc)); 8078 8079 if (FAILED(hrc)) 8119 8080 { 8120 8081 /* restore the session state */ … … 8124 8085 /* The failure may occur w/o any error info (from RPC), so provide one */ 8125 8086 return setError(VBOX_E_VM_ERROR, 8126 tr("Failed to assign the machine to the session (%Rhrc)"), rc);8087 tr("Failed to assign the machine to the session (%Rhrc)"), hrc); 8127 8088 } 8128 8089 … … 8253 8214 } 8254 8215 8255 HRESULT rc = S_OK;8256 8257 8216 /* PID not yet initialized, skip check. */ 8258 8217 if (mData->mSession.mPID == NIL_RTPROCESS) 8259 8218 return false; 8260 8219 8220 HRESULT hrc = S_OK; 8261 8221 RTPROCSTATUS status; 8262 8222 int vrc = RTProcWait(mData->mSession.mPID, RTPROCWAIT_FLAGS_NOBLOCK, &status); 8263 8264 8223 if (vrc != VERR_PROCESS_RUNNING) 8265 8224 { … … 8278 8237 8279 8238 if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_NORMAL) 8280 rc = setError(E_FAIL,8281 tr("The virtual machine '%s' has terminated unexpectedly during startup with exit code %d (%#x)%s"),8282 i_getName().c_str(), status.iStatus, status.iStatus, strExtraInfo.c_str());8239 hrc = setError(E_FAIL, 8240 tr("The virtual machine '%s' has terminated unexpectedly during startup with exit code %d (%#x)%s"), 8241 i_getName().c_str(), status.iStatus, status.iStatus, strExtraInfo.c_str()); 8283 8242 else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_SIGNAL) 8284 rc = setError(E_FAIL,8285 tr("The virtual machine '%s' has terminated unexpectedly during startup because of signal %d%s"),8286 i_getName().c_str(), status.iStatus, strExtraInfo.c_str());8243 hrc = setError(E_FAIL, 8244 tr("The virtual machine '%s' has terminated unexpectedly during startup because of signal %d%s"), 8245 i_getName().c_str(), status.iStatus, strExtraInfo.c_str()); 8287 8246 else if (RT_SUCCESS(vrc) && status.enmReason == RTPROCEXITREASON_ABEND) 8288 rc = setError(E_FAIL,8289 tr("The virtual machine '%s' has terminated abnormally (iStatus=%#x)%s"),8290 i_getName().c_str(), status.iStatus, strExtraInfo.c_str());8247 hrc = setError(E_FAIL, 8248 tr("The virtual machine '%s' has terminated abnormally (iStatus=%#x)%s"), 8249 i_getName().c_str(), status.iStatus, strExtraInfo.c_str()); 8291 8250 else 8292 rc = setErrorBoth(E_FAIL, vrc,8293 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"),8294 i_getName().c_str(), vrc, strExtraInfo.c_str());8295 } 8296 8297 if (FAILED( rc))8251 hrc = setErrorBoth(E_FAIL, vrc, 8252 tr("The virtual machine '%s' has terminated unexpectedly during startup (%Rrc)%s"), 8253 i_getName().c_str(), vrc, strExtraInfo.c_str()); 8254 } 8255 8256 if (FAILED(hrc)) 8298 8257 { 8299 8258 /* Close the remote session, remove the remote control from the list … … 8314 8273 if (!mData->mSession.mProgress.isNull()) 8315 8274 { 8316 mData->mSession.mProgress->notifyComplete( rc);8275 mData->mSession.mProgress->notifyComplete(hrc); 8317 8276 mData->mSession.mProgress.setNull(); 8318 8277 } … … 8360 8319 mData->mUuid.toString().c_str()); 8361 8320 8362 HRESULT rc = S_OK;8321 HRESULT hrc = S_OK; 8363 8322 8364 8323 // Ensure the settings are saved. If we are going to be registered and … … 8368 8327 ) 8369 8328 { 8370 rc = i_saveSettings(NULL, alock);8329 hrc = i_saveSettings(NULL, alock); 8371 8330 // no need to check whether VirtualBox.xml needs saving too since 8372 8331 // we can't have a machine XML file rename pending 8373 if (FAILED( rc)) returnrc;8332 if (FAILED(hrc)) return hrc; 8374 8333 } 8375 8334 8376 8335 /* more config checking goes here */ 8377 8336 8378 if (SUCCEEDED( rc))8337 if (SUCCEEDED(hrc)) 8379 8338 { 8380 8339 /* we may have had implicit modifications we want to fix on success */ … … 8389 8348 } 8390 8349 8391 return rc;8350 return hrc; 8392 8351 } 8393 8352 … … 8420 8379 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 8421 8380 8422 HRESULT rc = i_checkStateDependency(aDepType);8423 if (FAILED( rc)) returnrc;8381 HRESULT hrc = i_checkStateDependency(aDepType); 8382 if (FAILED(hrc)) return hrc; 8424 8383 8425 8384 { … … 8837 8796 if (pMedium.isNull()) 8838 8797 continue; 8839 HRESULT rc = pMedium->i_removeBackReference(mData->mUuid, i_getSnapshotId());8840 AssertComRC( rc);8798 HRESULT hrc = pMedium->i_removeBackReference(mData->mUuid, i_getSnapshotId()); 8799 AssertComRC(hrc); 8841 8800 } 8842 8801 } … … 8981 8940 bool aSetError /* = false */) 8982 8941 { 8983 HRESULT rc = VBOX_E_OBJECT_NOT_FOUND;8942 HRESULT hrc = VBOX_E_OBJECT_NOT_FOUND; 8984 8943 for (HWData::SharedFolderList::const_iterator 8985 8944 it = mHWData->mSharedFolders.begin(); … … 8992 8951 { 8993 8952 aSharedFolder = pSF; 8994 rc = S_OK;8953 hrc = S_OK; 8995 8954 break; 8996 8955 } 8997 8956 } 8998 8957 8999 if (aSetError && FAILED( rc))9000 setError( rc, tr("Could not find a shared folder named '%s'"), aName.c_str());9001 9002 return rc;8958 if (aSetError && FAILED(hrc)) 8959 setError(hrc, tr("Could not find a shared folder named '%s'"), aName.c_str()); 8960 8961 return hrc; 9003 8962 } 9004 8963 … … 9063 9022 9064 9023 // snapshot folder needs special processing so set it again 9065 HRESULT rc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder).raw());9066 if (FAILED( rc)) returnrc;9024 HRESULT hrc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder).raw()); 9025 if (FAILED(hrc)) return hrc; 9067 9026 9068 9027 /* Copy the extra data items (config may or may not be the same as … … 9090 9049 Utf8Str strMachineFolder = i_getSettingsFileFull(); 9091 9050 strMachineFolder.stripFilename(); 9092 rc = mParent->initMedia(i_getId(), // media registry ID == machine UUID9093 config.mediaRegistry,9094 strMachineFolder);9095 if (FAILED( rc)) returnrc;9051 hrc = mParent->initMedia(i_getId(), // media registry ID == machine UUID 9052 config.mediaRegistry, 9053 strMachineFolder); 9054 if (FAILED(hrc)) return hrc; 9096 9055 } 9097 9056 … … 9104 9063 const settings::Snapshot &snap = config.llFirstSnapshot.front(); 9105 9064 9106 rc = i_loadSnapshot(snap, 9107 config.uuidCurrentSnapshot); 9108 if (FAILED(rc)) return rc; 9065 hrc = i_loadSnapshot(snap, config.uuidCurrentSnapshot); 9066 if (FAILED(hrc)) return hrc; 9109 9067 } 9110 9068 9111 9069 // hardware data 9112 rc = i_loadHardware(puuidRegistry, NULL, config.hardwareMachine, &config.debugging, &config.autostart,9113 config.recordingSettings);9114 if (FAILED( rc)) returnrc;9070 hrc = i_loadHardware(puuidRegistry, NULL, config.hardwareMachine, &config.debugging, &config.autostart, 9071 config.recordingSettings); 9072 if (FAILED(hrc)) return hrc; 9115 9073 9116 9074 /* … … 9158 9116 AssertReturn(!i_isSessionMachine(), E_FAIL); 9159 9117 9160 HRESULT rc = S_OK;9118 HRESULT hrc = S_OK; 9161 9119 9162 9120 std::list<const settings::Snapshot *> llSettingsTodo; … … 9189 9147 ComObjPtr<SnapshotMachine> pSnapshotMachine; 9190 9148 pSnapshotMachine.createObject(); 9191 rc = pSnapshotMachine->initFromSettings(this,9192 current->hardware,9193 ¤t->debugging,9194 ¤t->autostart,9195 current->recordingSettings,9196 current->uuid.ref(),9197 strStateFile);9198 if (FAILED( rc)) break;9149 hrc = pSnapshotMachine->initFromSettings(this, 9150 current->hardware, 9151 ¤t->debugging, 9152 ¤t->autostart, 9153 current->recordingSettings, 9154 current->uuid.ref(), 9155 strStateFile); 9156 if (FAILED(hrc)) break; 9199 9157 9200 9158 /* create a snapshot object */ … … 9202 9160 pSnapshot.createObject(); 9203 9161 /* initialize the snapshot */ 9204 rc = pSnapshot->init(mParent, // VirtualBox object9205 current->uuid,9206 current->strName,9207 current->strDescription,9208 current->timestamp,9209 pSnapshotMachine,9210 pParent);9211 if (FAILED( rc)) break;9162 hrc = pSnapshot->init(mParent, // VirtualBox object 9163 current->uuid, 9164 current->strName, 9165 current->strDescription, 9166 current->timestamp, 9167 pSnapshotMachine, 9168 pParent); 9169 if (FAILED(hrc)) break; 9212 9170 9213 9171 /* memorize the first snapshot if necessary */ … … 9234 9192 } 9235 9193 9236 return rc;9194 return hrc; 9237 9195 } 9238 9196 … … 9256 9214 AssertReturn(!i_isSessionMachine(), E_FAIL); 9257 9215 9258 HRESULT rc = S_OK;9216 HRESULT hrc = S_OK; 9259 9217 9260 9218 try … … 9347 9305 9348 9306 /* GraphicsAdapter */ 9349 rc = mGraphicsAdapter->i_loadSettings(data.graphicsAdapter);9350 if (FAILED( rc)) returnrc;9307 hrc = mGraphicsAdapter->i_loadSettings(data.graphicsAdapter); 9308 if (FAILED(hrc)) return hrc; 9351 9309 9352 9310 /* VRDEServer */ 9353 rc = mVRDEServer->i_loadSettings(data.vrdeSettings);9354 if (FAILED( rc)) returnrc;9311 hrc = mVRDEServer->i_loadSettings(data.vrdeSettings); 9312 if (FAILED(hrc)) return hrc; 9355 9313 9356 9314 /* BIOS */ 9357 rc = mBIOSSettings->i_loadSettings(data.biosSettings);9358 if (FAILED( rc)) returnrc;9315 hrc = mBIOSSettings->i_loadSettings(data.biosSettings); 9316 if (FAILED(hrc)) return hrc; 9359 9317 9360 9318 /* Recording */ 9361 rc = mRecordingSettings->i_loadSettings(recording);9362 if (FAILED( rc)) returnrc;9319 hrc = mRecordingSettings->i_loadSettings(recording); 9320 if (FAILED(hrc)) return hrc; 9363 9321 9364 9322 /* Trusted Platform Module */ 9365 rc = mTrustedPlatformModule->i_loadSettings(data.tpmSettings);9366 if (FAILED( rc)) returnrc;9367 9368 rc = mNvramStore->i_loadSettings(data.nvramSettings);9369 if (FAILED( rc)) returnrc;9323 hrc = mTrustedPlatformModule->i_loadSettings(data.tpmSettings); 9324 if (FAILED(hrc)) return hrc; 9325 9326 hrc = mNvramStore->i_loadSettings(data.nvramSettings); 9327 if (FAILED(hrc)) return hrc; 9370 9328 9371 9329 // Bandwidth control (must come before network adapters) 9372 rc = mBandwidthControl->i_loadSettings(data.ioSettings);9373 if (FAILED( rc)) returnrc;9330 hrc = mBandwidthControl->i_loadSettings(data.ioSettings); 9331 if (FAILED(hrc)) return hrc; 9374 9332 9375 9333 /* USB controllers */ … … 9388 9346 9389 9347 /* USB device filters */ 9390 rc = mUSBDeviceFilters->i_loadSettings(data.usbSettings);9391 if (FAILED( rc)) returnrc;9348 hrc = mUSBDeviceFilters->i_loadSettings(data.usbSettings); 9349 if (FAILED(hrc)) return hrc; 9392 9350 9393 9351 // network adapters (establish array size first and apply defaults, to … … 9418 9376 /* slot uniqueness is guaranteed by XML Schema */ 9419 9377 AssertBreak(nic.ulSlot < mNetworkAdapters.size()); 9420 rc = mNetworkAdapters[nic.ulSlot]->i_loadSettings(mBandwidthControl, nic);9421 if (FAILED( rc)) returnrc;9378 hrc = mNetworkAdapters[nic.ulSlot]->i_loadSettings(mBandwidthControl, nic); 9379 if (FAILED(hrc)) return hrc; 9422 9380 } 9423 9381 … … 9434 9392 9435 9393 AssertBreak(s.ulSlot < RT_ELEMENTS(mSerialPorts)); 9436 rc = mSerialPorts[s.ulSlot]->i_loadSettings(s);9437 if (FAILED( rc)) returnrc;9394 hrc = mSerialPorts[s.ulSlot]->i_loadSettings(s); 9395 if (FAILED(hrc)) return hrc; 9438 9396 } 9439 9397 … … 9450 9408 9451 9409 AssertBreak(p.ulSlot < RT_ELEMENTS(mParallelPorts)); 9452 rc = mParallelPorts[p.ulSlot]->i_loadSettings(p);9453 if (FAILED( rc)) returnrc;9410 hrc = mParallelPorts[p.ulSlot]->i_loadSettings(p); 9411 if (FAILED(hrc)) return hrc; 9454 9412 } 9455 9413 9456 9414 /* Audio settings */ 9457 rc = mAudioSettings->i_loadSettings(data.audioAdapter);9458 if (FAILED( rc)) returnrc;9415 hrc = mAudioSettings->i_loadSettings(data.audioAdapter); 9416 if (FAILED(hrc)) return hrc; 9459 9417 9460 9418 /* storage controllers */ 9461 rc = i_loadStorageControllers(data.storage, 9462 puuidRegistry, 9463 puuidSnapshot); 9464 if (FAILED(rc)) return rc; 9419 hrc = i_loadStorageControllers(data.storage, puuidRegistry, puuidSnapshot); 9420 if (FAILED(hrc)) return hrc; 9465 9421 9466 9422 /* Shared folders */ … … 9474 9430 ComObjPtr<SharedFolder> sharedFolder; 9475 9431 /* Check for double entries. Not allowed! */ 9476 rc = i_findSharedFolder(sf.strName, sharedFolder, false /* aSetError */);9477 if (SUCCEEDED( rc))9432 hrc = i_findSharedFolder(sf.strName, sharedFolder, false /* aSetError */); 9433 if (SUCCEEDED(hrc)) 9478 9434 return setError(VBOX_E_OBJECT_IN_USE, 9479 9435 tr("Shared folder named '%s' already exists"), … … 9483 9439 * reported when the machine starts. */ 9484 9440 sharedFolder.createObject(); 9485 rc = sharedFolder->init(i_getMachine(),9486 sf.strName,9487 sf.strHostPath,9488 RT_BOOL(sf.fWritable),9489 RT_BOOL(sf.fAutoMount),9490 sf.strAutoMountPoint,9491 false /* fFailOnError */);9492 if (FAILED( rc)) returnrc;9441 hrc = sharedFolder->init(i_getMachine(), 9442 sf.strName, 9443 sf.strHostPath, 9444 RT_BOOL(sf.fWritable), 9445 RT_BOOL(sf.fAutoMount), 9446 sf.strAutoMountPoint, 9447 false /* fFailOnError */); 9448 if (FAILED(hrc)) return hrc; 9493 9449 mHWData->mSharedFolders.push_back(sharedFolder); 9494 9450 } … … 9563 9519 #endif /* VBOX_WITH_GUEST_PROPS defined */ 9564 9520 9565 rc = i_loadDebugging(pDbg);9566 if (FAILED( rc))9567 return rc;9521 hrc = i_loadDebugging(pDbg); 9522 if (FAILED(hrc)) 9523 return hrc; 9568 9524 9569 9525 mHWData->mAutostart = *pAutostart; … … 9577 9533 } 9578 9534 9579 AssertComRC( rc);9580 return rc;9535 AssertComRC(hrc); 9536 return hrc; 9581 9537 } 9582 9538 … … 9592 9548 /* no more processing currently required, this will probably change. */ 9593 9549 9594 HRESULT rc = mGuestDebugControl->i_loadSettings(*pDbg);9595 if (FAILED( rc)) returnrc;9550 HRESULT hrc = mGuestDebugControl->i_loadSettings(*pDbg); 9551 if (FAILED(hrc)) return hrc; 9596 9552 9597 9553 return S_OK; … … 9613 9569 AssertReturn(!i_isSessionMachine(), E_FAIL); 9614 9570 9615 HRESULT rc = S_OK;9571 HRESULT hrc = S_OK; 9616 9572 9617 9573 for (settings::StorageControllersList::const_iterator … … 9624 9580 ComObjPtr<StorageController> pCtl; 9625 9581 /* Try to find one with the name first. */ 9626 rc = i_getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */);9627 if (SUCCEEDED( rc))9582 hrc = i_getStorageControllerByName(ctlData.strName, pCtl, false /* aSetError */); 9583 if (SUCCEEDED(hrc)) 9628 9584 return setError(VBOX_E_OBJECT_IN_USE, 9629 9585 tr("Storage controller named '%s' already exists"), … … 9631 9587 9632 9588 pCtl.createObject(); 9633 rc = pCtl->init(this, 9634 ctlData.strName, 9635 ctlData.storageBus, 9636 ctlData.ulInstance, 9637 ctlData.fBootable); 9638 if (FAILED(rc)) return rc; 9589 hrc = pCtl->init(this, ctlData.strName, ctlData.storageBus, ctlData.ulInstance, ctlData.fBootable); 9590 if (FAILED(hrc)) return hrc; 9639 9591 9640 9592 mStorageControllers->push_back(pCtl); 9641 9593 9642 rc = pCtl->COMSETTER(ControllerType)(ctlData.controllerType);9643 if (FAILED( rc)) returnrc;9644 9645 rc = pCtl->COMSETTER(PortCount)(ctlData.ulPortCount);9646 if (FAILED( rc)) returnrc;9647 9648 rc = pCtl->COMSETTER(UseHostIOCache)(ctlData.fUseHostIOCache);9649 if (FAILED( rc)) returnrc;9594 hrc = pCtl->COMSETTER(ControllerType)(ctlData.controllerType); 9595 if (FAILED(hrc)) return hrc; 9596 9597 hrc = pCtl->COMSETTER(PortCount)(ctlData.ulPortCount); 9598 if (FAILED(hrc)) return hrc; 9599 9600 hrc = pCtl->COMSETTER(UseHostIOCache)(ctlData.fUseHostIOCache); 9601 if (FAILED(hrc)) return hrc; 9650 9602 9651 9603 /* Load the attached devices now. */ 9652 rc = i_loadStorageDevices(pCtl, 9653 ctlData, 9654 puuidRegistry, 9655 puuidSnapshot); 9656 if (FAILED(rc)) return rc; 9604 hrc = i_loadStorageDevices(pCtl, ctlData, puuidRegistry, puuidSnapshot); 9605 if (FAILED(hrc)) return hrc; 9657 9606 } 9658 9607 … … 9675 9624 const Guid *puuidSnapshot) 9676 9625 { 9677 HRESULT rc = S_OK;9626 HRESULT hrc = S_OK; 9678 9627 9679 9628 /* paranoia: detect duplicate attachments */ … … 9720 9669 case DeviceType_DVD: 9721 9670 if (dev.strHostDriveSrc.isNotEmpty()) 9722 rc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc,9671 hrc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, 9723 9672 false /* fRefresh */, medium); 9724 9673 else 9725 rc = mParent->i_findRemoveableMedium(dev.deviceType,9726 dev.uuid,9727 false /* fRefresh */,9728 false /* aSetError */,9729 medium);9730 if ( rc == VBOX_E_OBJECT_NOT_FOUND)9674 hrc = mParent->i_findRemoveableMedium(dev.deviceType, 9675 dev.uuid, 9676 false /* fRefresh */, 9677 false /* aSetError */, 9678 medium); 9679 if (hrc == VBOX_E_OBJECT_NOT_FOUND) 9731 9680 // This is not an error. The host drive or UUID might have vanished, so just go 9732 9681 // ahead without this removeable medium attachment 9733 rc = S_OK;9682 hrc = S_OK; 9734 9683 break; 9735 9684 … … 9737 9686 { 9738 9687 /* find a hard disk by UUID */ 9739 rc = mParent->i_findHardDiskById(dev.uuid, true /* aDoSetError */, &medium);9740 if (FAILED( rc))9688 hrc = mParent->i_findHardDiskById(dev.uuid, true /* aDoSetError */, &medium); 9689 if (FAILED(hrc)) 9741 9690 { 9742 9691 if (i_isSnapshotMachine()) … … 9750 9699 info.getText().raw()); 9751 9700 } 9752 else 9753 return rc; 9701 return hrc; 9754 9702 } 9755 9703 … … 9827 9775 } 9828 9776 9829 if (FAILED( rc))9777 if (FAILED(hrc)) 9830 9778 break; 9831 9779 … … 9835 9783 if (!dev.strBwGroup.isEmpty()) 9836 9784 { 9837 rc = mBandwidthControl->i_getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */);9838 if (FAILED( rc))9785 hrc = mBandwidthControl->i_getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */); 9786 if (FAILED(hrc)) 9839 9787 return setError(E_FAIL, 9840 9788 tr("Device '%s' with unknown bandwidth group '%s' is attached to the virtual machine '%s' ('%s')"), … … 9849 9797 ComObjPtr<MediumAttachment> pAttachment; 9850 9798 pAttachment.createObject(); 9851 rc = pAttachment->init(this,9852 medium,9853 controllerName,9854 dev.lPort,9855 dev.lDevice,9856 dev.deviceType,9857 false,9858 dev.fPassThrough,9859 dev.fTempEject,9860 dev.fNonRotational,9861 dev.fDiscard,9862 dev.fHotPluggable,9863 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->i_getName());9864 if (FAILED( rc)) break;9799 hrc = pAttachment->init(this, 9800 medium, 9801 controllerName, 9802 dev.lPort, 9803 dev.lDevice, 9804 dev.deviceType, 9805 false, 9806 dev.fPassThrough, 9807 dev.fTempEject, 9808 dev.fNonRotational, 9809 dev.fDiscard, 9810 dev.fHotPluggable, 9811 pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->i_getName()); 9812 if (FAILED(hrc)) break; 9865 9813 9866 9814 /* associate the medium with this machine and snapshot */ … … 9872 9820 9873 9821 if (i_isSnapshotMachine()) 9874 rc = medium->i_addBackReference(mData->mUuid, *puuidSnapshot);9822 hrc = medium->i_addBackReference(mData->mUuid, *puuidSnapshot); 9875 9823 else 9876 rc = medium->i_addBackReference(mData->mUuid);9824 hrc = medium->i_addBackReference(mData->mUuid); 9877 9825 /* If the medium->addBackReference fails it sets an appropriate 9878 9826 * error message, so no need to do any guesswork here. */ … … 9883 9831 } 9884 9832 9885 if (FAILED( rc))9833 if (FAILED(hrc)) 9886 9834 break; 9887 9835 … … 9893 9841 } 9894 9842 9895 return rc;9843 return hrc; 9896 9844 } 9897 9845 … … 10100 10048 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 10101 10049 10102 HRESULT rc = S_OK;10050 HRESULT hrc = S_OK; 10103 10051 10104 10052 bool fSettingsFileIsNew = !mData->pMachineConfigFile->fileExists(); … … 10174 10122 if (RT_FAILURE(vrc)) 10175 10123 { 10176 rc = setErrorBoth(E_FAIL, vrc,10177 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"),10178 configDir.c_str(),10179 newConfigDir.c_str(),10180 vrc);10124 hrc = setErrorBoth(E_FAIL, vrc, 10125 tr("Could not rename the directory '%s' to '%s' to save the settings file (%Rrc)"), 10126 configDir.c_str(), 10127 newConfigDir.c_str(), 10128 vrc); 10181 10129 break; 10182 10130 } … … 10212 10160 if (RT_FAILURE(vrc)) 10213 10161 { 10214 rc = setErrorBoth(E_FAIL, vrc,10215 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"),10216 configFile.c_str(),10217 newConfigFile.c_str(),10218 vrc);10162 hrc = setErrorBoth(E_FAIL, vrc, 10163 tr("Could not rename the settings file '%s' to '%s' (%Rrc)"), 10164 configFile.c_str(), 10165 newConfigFile.c_str(), 10166 vrc); 10219 10167 break; 10220 10168 } … … 10278 10226 while (0); 10279 10227 10280 if (FAILED( rc))10228 if (FAILED(hrc)) 10281 10229 { 10282 10230 /* silently try to rename everything back */ … … 10292 10240 } 10293 10241 10294 if (FAILED( rc)) returnrc;10242 if (FAILED(hrc)) return hrc; 10295 10243 } 10296 10244 … … 10330 10278 *pfSettingsFileIsNew = fSettingsFileIsNew; 10331 10279 10332 return rc;10280 return hrc; 10333 10281 } 10334 10282 … … 10378 10326 tr("The machine is not accessible, so cannot save settings")); 10379 10327 10380 HRESULT rc = S_OK;10328 HRESULT hrc = S_OK; 10381 10329 PCVBOXCRYPTOIF pCryptoIf = NULL; 10382 10330 const char *pszPassword = NULL; … … 10388 10336 /* VM is going to be encrypted. */ 10389 10337 alock.release(); /** @todo Revise the locking. */ 10390 rc = mParent->i_retainCryptoIf(&pCryptoIf);10338 hrc = mParent->i_retainCryptoIf(&pCryptoIf); 10391 10339 alock.acquire(); 10392 if (FAILED( rc)) returnrc; /* Error is set. */10340 if (FAILED(hrc)) return hrc; /* Error is set. */ 10393 10341 10394 10342 int vrc = mData->mpKeyStore->retainSecretKey(mData->mstrKeyId, &pKey); … … 10413 10361 * settings directory and file if the machine name was changed and about 10414 10362 * creating a new settings file if this is a new machine. */ 10415 rc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings, 10416 &fSettingsFileIsNew); 10417 if (FAILED(rc)) 10363 hrc = i_prepareSaveSettings(pfNeedsGlobalSaveSettings, &fSettingsFileIsNew); 10364 if (FAILED(hrc)) 10418 10365 { 10419 10366 #ifdef VBOX_WITH_FULL_VM_ENCRYPTION … … 10427 10374 mData->mpKeyStore->releaseSecretKey(mData->mstrKeyId); 10428 10375 #endif 10429 return rc;10376 return hrc; 10430 10377 } 10431 10378 … … 10497 10444 { 10498 10445 // we assume that error info is set by the thrower 10499 rc = err;10446 hrc = err; 10500 10447 10501 10448 // delete any newly created settings file … … 10509 10456 catch (...) 10510 10457 { 10511 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);10458 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 10512 10459 } 10513 10460 … … 10534 10481 } 10535 10482 10536 LogFlowThisFunc((" rc=%08X\n",rc));10483 LogFlowThisFunc(("hrc=%08X\n", hrc)); 10537 10484 LogFlowThisFuncLeave(); 10538 return rc;10485 return hrc; 10539 10486 } 10540 10487 … … 10644 10591 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 10645 10592 10646 HRESULT rc = S_OK;10593 HRESULT hrc = S_OK; 10647 10594 10648 10595 try … … 10657 10604 // get reference to the snapshot on the list and work on that 10658 10605 // element straight in the list to avoid excessive copying later 10659 rc = mData->mFirstSnapshot->i_saveSnapshot(config.llFirstSnapshot.back());10660 if (FAILED( rc)) throwrc;10606 hrc = mData->mFirstSnapshot->i_saveSnapshot(config.llFirstSnapshot.back()); 10607 if (FAILED(hrc)) throw hrc; 10661 10608 } 10662 10609 … … 10668 10615 { 10669 10616 /* we assume that error info is set by the thrower */ 10670 rc = err;10617 hrc = err; 10671 10618 } 10672 10619 catch (...) 10673 10620 { 10674 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);10675 } 10676 10677 return rc;10621 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 10622 } 10623 10624 return hrc; 10678 10625 } 10679 10626 … … 10692 10639 settings::Autostart *pAutostart, settings::RecordingSettings &recording) 10693 10640 { 10694 HRESULT rc = S_OK;10641 HRESULT hrc = S_OK; 10695 10642 10696 10643 try … … 10787 10734 10788 10735 /* VRDEServer settings (optional) */ 10789 rc = mVRDEServer->i_saveSettings(data.vrdeSettings);10790 if (FAILED( rc)) throwrc;10736 hrc = mVRDEServer->i_saveSettings(data.vrdeSettings); 10737 if (FAILED(hrc)) throw hrc; 10791 10738 10792 10739 /* BIOS settings (required) */ 10793 rc = mBIOSSettings->i_saveSettings(data.biosSettings);10794 if (FAILED( rc)) throwrc;10740 hrc = mBIOSSettings->i_saveSettings(data.biosSettings); 10741 if (FAILED(hrc)) throw hrc; 10795 10742 10796 10743 /* Recording settings. */ 10797 rc = mRecordingSettings->i_saveSettings(recording);10798 if (FAILED( rc)) throwrc;10744 hrc = mRecordingSettings->i_saveSettings(recording); 10745 if (FAILED(hrc)) throw hrc; 10799 10746 10800 10747 /* Trusted Platform Module settings (required) */ 10801 rc = mTrustedPlatformModule->i_saveSettings(data.tpmSettings);10802 if (FAILED( rc)) throwrc;10748 hrc = mTrustedPlatformModule->i_saveSettings(data.tpmSettings); 10749 if (FAILED(hrc)) throw hrc; 10803 10750 10804 10751 /* NVRAM settings (required) */ 10805 rc = mNvramStore->i_saveSettings(data.nvramSettings);10806 if (FAILED( rc)) throwrc;10752 hrc = mNvramStore->i_saveSettings(data.nvramSettings); 10753 if (FAILED(hrc)) throw hrc; 10807 10754 10808 10755 /* GraphicsAdapter settings (required) */ 10809 rc = mGraphicsAdapter->i_saveSettings(data.graphicsAdapter);10810 if (FAILED( rc)) throwrc;10756 hrc = mGraphicsAdapter->i_saveSettings(data.graphicsAdapter); 10757 if (FAILED(hrc)) throw hrc; 10811 10758 10812 10759 /* USB Controller (required) */ … … 10827 10774 10828 10775 /* USB device filters (required) */ 10829 rc = mUSBDeviceFilters->i_saveSettings(data.usbSettings);10830 if (FAILED( rc)) throwrc;10776 hrc = mUSBDeviceFilters->i_saveSettings(data.usbSettings); 10777 if (FAILED(hrc)) throw hrc; 10831 10778 10832 10779 /* Network adapters (required) */ … … 10846 10793 continue; 10847 10794 10848 rc = mNetworkAdapters[slot]->i_saveSettings(nic);10849 if (FAILED( rc)) throwrc;10795 hrc = mNetworkAdapters[slot]->i_saveSettings(nic); 10796 if (FAILED(hrc)) throw hrc; 10850 10797 10851 10798 data.llNetworkAdapters.push_back(nic); … … 10862 10809 settings::SerialPort s; 10863 10810 s.ulSlot = slot; 10864 rc = mSerialPorts[slot]->i_saveSettings(s);10865 if (FAILED( rc)) returnrc;10811 hrc = mSerialPorts[slot]->i_saveSettings(s); 10812 if (FAILED(hrc)) return hrc; 10866 10813 10867 10814 data.llSerialPorts.push_back(s); … … 10877 10824 settings::ParallelPort p; 10878 10825 p.ulSlot = slot; 10879 rc = mParallelPorts[slot]->i_saveSettings(p);10880 if (FAILED( rc)) returnrc;10826 hrc = mParallelPorts[slot]->i_saveSettings(p); 10827 if (FAILED(hrc)) return hrc; 10881 10828 10882 10829 data.llParallelPorts.push_back(p); … … 10884 10831 10885 10832 /* Audio settings */ 10886 rc = mAudioSettings->i_saveSettings(data.audioAdapter);10887 if (FAILED( rc)) returnrc;10888 10889 rc = i_saveStorageControllers(data.storage);10890 if (FAILED( rc)) returnrc;10833 hrc = mAudioSettings->i_saveSettings(data.audioAdapter); 10834 if (FAILED(hrc)) return hrc; 10835 10836 hrc = i_saveStorageControllers(data.storage); 10837 if (FAILED(hrc)) return hrc; 10891 10838 10892 10839 /* Shared folders */ … … 10925 10872 10926 10873 /* BandwidthControl (required) */ 10927 rc = mBandwidthControl->i_saveSettings(data.ioSettings);10928 if (FAILED( rc)) throwrc;10874 hrc = mBandwidthControl->i_saveSettings(data.ioSettings); 10875 if (FAILED(hrc)) throw hrc; 10929 10876 10930 10877 /* Host PCI devices */ … … 10938 10885 settings::HostPCIDeviceAttachment hpda; 10939 10886 10940 rc = pda->i_saveSettings(hpda);10941 if (FAILED( rc)) throwrc;10887 hrc = pda->i_saveSettings(hpda); 10888 if (FAILED(hrc)) throw hrc; 10942 10889 10943 10890 data.pciAttachments.push_back(hpda); … … 10978 10925 #endif /* VBOX_WITH_GUEST_PROPS defined */ 10979 10926 10980 rc = mGuestDebugControl->i_saveSettings(mHWData->mDebugging);10981 if (FAILED( rc)) throwrc;10927 hrc = mGuestDebugControl->i_saveSettings(mHWData->mDebugging); 10928 if (FAILED(hrc)) throw hrc; 10982 10929 10983 10930 *pDbg = mHWData->mDebugging; /// @todo r=aeichner: Move this to guest debug control. */ … … 10991 10938 } 10992 10939 10993 AssertComRC( rc);10994 return rc;10940 AssertComRC(hrc); 10941 return hrc; 10995 10942 } 10996 10943 … … 11009 10956 ++it) 11010 10957 { 11011 HRESULT rc;11012 10958 ComObjPtr<StorageController> pCtl = *it; 11013 10959 … … 11021 10967 /* Save the port count. */ 11022 10968 ULONG portCount; 11023 rc = pCtl->COMGETTER(PortCount)(&portCount);11024 ComAssertComRCRet( rc,rc);10969 HRESULT hrc = pCtl->COMGETTER(PortCount)(&portCount); 10970 ComAssertComRCRet(hrc, hrc); 11025 10971 ctl.ulPortCount = portCount; 11026 10972 11027 10973 /* Save fUseHostIOCache */ 11028 10974 BOOL fUseHostIOCache; 11029 rc = pCtl->COMGETTER(UseHostIOCache)(&fUseHostIOCache);11030 ComAssertComRCRet( rc,rc);10975 hrc = pCtl->COMGETTER(UseHostIOCache)(&fUseHostIOCache); 10976 ComAssertComRCRet(hrc, hrc); 11031 10977 ctl.fUseHostIOCache = !!fUseHostIOCache; 11032 10978 11033 10979 /* save the devices now. */ 11034 rc = i_saveStorageDevices(pCtl, ctl);11035 ComAssertComRCRet( rc,rc);10980 hrc = i_saveStorageDevices(pCtl, ctl); 10981 ComAssertComRCRet(hrc, hrc); 11036 10982 11037 10983 data.llStorageControllers.push_back(ctl); … … 11049 10995 MediumAttachmentList atts; 11050 10996 11051 HRESULT rc = i_getMediumAttachmentsOfController(aStorageController->i_getName(), atts);11052 if (FAILED( rc)) returnrc;10997 HRESULT hrc = i_getMediumAttachmentsOfController(aStorageController->i_getName(), atts); 10998 if (FAILED(hrc)) return hrc; 11053 10999 11054 11000 data.llAttachedDevices.clear(); … … 11107 11053 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 11108 11054 11109 HRESULT rc = S_OK;11055 HRESULT hrc = S_OK; 11110 11056 11111 11057 Assert(mData->pMachineConfigFile); … … 11141 11087 catch (...) 11142 11088 { 11143 rc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS);11144 } 11145 11146 return rc;11089 hrc = VirtualBoxBase::handleUnexpectedExceptions(this, RT_SRC_POS); 11090 } 11091 11092 return hrc; 11147 11093 } 11148 11094 … … 11215 11161 * VERR_FILE_NOT_FOUND and VERR_PATH_NOT_FOUND always will be ignored. 11216 11162 * @param strWhat File hint which will be used when setting an error. Optional. 11217 * @param prc Where to return IPRT's error code on failure. Optional and can be NULL. 11163 * @param prc Where to return IPRT's status code on failure. 11164 * Optional and can be NULL. 11218 11165 */ 11219 11166 HRESULT Machine::i_deleteFile(const Utf8Str &strFile, bool fIgnoreFailures /* = false */, … … 11240 11187 Utf8StrFmt strError("Error deleting %s '%s' (%Rrc)", 11241 11188 strWhat.isEmpty() ? tr("file") : strWhat.c_str(), strFile.c_str(), vrc); 11242 hrc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, strError.c_str(), 11243 strFile.c_str(), vrc); 11244 } 11245 11246 if (prc) 11247 *prc = vrc; 11248 } 11249 11189 hrc = setErrorBoth(VBOX_E_FILE_ERROR, vrc, strError.c_str(), strFile.c_str(), vrc); 11190 } 11191 } 11192 11193 if (prc) 11194 *prc = vrc; 11250 11195 return hrc; 11251 11196 } … … 11304 11249 , E_FAIL); 11305 11250 11306 HRESULT rc = S_OK;11251 HRESULT hrc = S_OK; 11307 11252 11308 11253 // use appropriate locked media map (online or offline) … … 11333 11278 MediumLockList *pMediumLockList(new MediumLockList()); 11334 11279 alock.release(); 11335 rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */,11336 NULL /* pToLockWrite */,11337 false /* fMediumLockWriteAll */,11338 NULL,11339 *pMediumLockList);11280 hrc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */, 11281 NULL /* pToLockWrite */, 11282 false /* fMediumLockWriteAll */, 11283 NULL, 11284 *pMediumLockList); 11340 11285 alock.acquire(); 11341 if (FAILED( rc))11286 if (FAILED(hrc)) 11342 11287 { 11343 11288 delete pMediumLockList; 11344 throw rc;11289 throw hrc; 11345 11290 } 11346 rc = lockedMediaMap->Insert(pAtt, pMediumLockList); 11347 if (FAILED(rc)) 11348 { 11349 throw setError(rc, 11350 tr("Collecting locking information for all attached media failed")); 11351 } 11291 hrc = lockedMediaMap->Insert(pAtt, pMediumLockList); 11292 if (FAILED(hrc)) 11293 throw setError(hrc, tr("Collecting locking information for all attached media failed")); 11352 11294 } 11353 11295 } … … 11355 11297 /* Now lock all media. If this fails, nothing is locked. */ 11356 11298 alock.release(); 11357 rc = lockedMediaMap->Lock();11299 hrc = lockedMediaMap->Lock(); 11358 11300 alock.acquire(); 11359 if (FAILED(rc)) 11360 { 11361 throw setError(rc, 11362 tr("Locking of attached media failed")); 11363 } 11301 if (FAILED(hrc)) 11302 throw setError(hrc, tr("Locking of attached media failed")); 11364 11303 } 11365 11304 … … 11423 11362 bool fInRegistry = pMedium->i_getFirstRegistryMachineId(uuidRegistryParent); 11424 11363 Assert(fInRegistry); NOREF(fInRegistry); 11425 rc = diff->init(mParent,11426 pMedium->i_getPreferredDiffFormat(),11427 strFullSnapshotFolder.append(RTPATH_SLASH_STR),11428 uuidRegistryParent,11429 DeviceType_HardDisk);11430 if (FAILED( rc)) throwrc;11364 hrc = diff->init(mParent, 11365 pMedium->i_getPreferredDiffFormat(), 11366 strFullSnapshotFolder.append(RTPATH_SLASH_STR), 11367 uuidRegistryParent, 11368 DeviceType_HardDisk); 11369 if (FAILED(hrc)) throw hrc; 11431 11370 11432 11371 /** @todo r=bird: How is the locking and diff image cleaned up if we fail before … … 11437 11376 /* update the appropriate lock list */ 11438 11377 MediumLockList *pMediumLockList; 11439 rc = lockedMediaMap->Get(pAtt, pMediumLockList);11440 AssertComRCThrowRC( rc);11378 hrc = lockedMediaMap->Get(pAtt, pMediumLockList); 11379 AssertComRCThrowRC(hrc); 11441 11380 if (aOnline) 11442 11381 { … … 11444 11383 /* The currently attached medium will be read-only, change 11445 11384 * the lock type to read. */ 11446 rc = pMediumLockList->Update(pMedium, false);11385 hrc = pMediumLockList->Update(pMedium, false); 11447 11386 alock.acquire(); 11448 AssertComRCThrowRC( rc);11387 AssertComRCThrowRC(hrc); 11449 11388 } 11450 11389 11451 11390 /* release the locks before the potentially lengthy operation */ 11452 11391 alock.release(); 11453 rc = pMedium->i_createDiffStorage(diff,11454 pMedium->i_getPreferredDiffVariant(),11455 pMediumLockList,11456 NULL /* aProgress */,11457 true /* aWait */,11458 false /* aNotify */);11392 hrc = pMedium->i_createDiffStorage(diff, 11393 pMedium->i_getPreferredDiffVariant(), 11394 pMediumLockList, 11395 NULL /* aProgress */, 11396 true /* aWait */, 11397 false /* aNotify */); 11459 11398 alock.acquire(); 11460 if (FAILED( rc)) throwrc;11399 if (FAILED(hrc)) throw hrc; 11461 11400 11462 11401 /* actual lock list update is done in Machine::i_commitMedia */ 11463 11402 11464 rc = diff->i_addBackReference(mData->mUuid);11465 AssertComRCThrowRC( rc);11403 hrc = diff->i_addBackReference(mData->mUuid); 11404 AssertComRCThrowRC(hrc); 11466 11405 11467 11406 /* add a new attachment */ 11468 11407 ComObjPtr<MediumAttachment> attachment; 11469 11408 attachment.createObject(); 11470 rc = attachment->init(this,11471 diff,11472 pAtt->i_getControllerName(),11473 pAtt->i_getPort(),11474 pAtt->i_getDevice(),11475 DeviceType_HardDisk,11476 true /* aImplicit */,11477 false /* aPassthrough */,11478 false /* aTempEject */,11479 pAtt->i_getNonRotational(),11480 pAtt->i_getDiscard(),11481 pAtt->i_getHotPluggable(),11482 pAtt->i_getBandwidthGroup());11483 if (FAILED( rc)) throwrc;11484 11485 rc = lockedMediaMap->ReplaceKey(pAtt, attachment);11486 AssertComRCThrowRC( rc);11409 hrc = attachment->init(this, 11410 diff, 11411 pAtt->i_getControllerName(), 11412 pAtt->i_getPort(), 11413 pAtt->i_getDevice(), 11414 DeviceType_HardDisk, 11415 true /* aImplicit */, 11416 false /* aPassthrough */, 11417 false /* aTempEject */, 11418 pAtt->i_getNonRotational(), 11419 pAtt->i_getDiscard(), 11420 pAtt->i_getHotPluggable(), 11421 pAtt->i_getBandwidthGroup()); 11422 if (FAILED(hrc)) throw hrc; 11423 11424 hrc = lockedMediaMap->ReplaceKey(pAtt, attachment); 11425 AssertComRCThrowRC(hrc); 11487 11426 mMediumAttachments->push_back(attachment); 11488 11427 } 11489 11428 } 11490 catch (HRESULT aRC) { rc = aRC; } 11429 catch (HRESULT hrcXcpt) 11430 { 11431 hrc = hrcXcpt; 11432 } 11491 11433 11492 11434 /* unlock all hard disks we locked when there is no VM */ … … 11499 11441 } 11500 11442 11501 return rc;11443 return hrc; 11502 11444 } 11503 11445 … … 11550 11492 return S_OK; 11551 11493 11552 HRESULT rc = S_OK;11494 HRESULT hrc = S_OK; 11553 11495 MachineState_T oldState = mData->mMachineState; 11554 11496 … … 11592 11534 MediumLockList *pMediumLockList(new MediumLockList()); 11593 11535 alock.release(); 11594 rc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */,11595 NULL /* pToLockWrite */,11596 false /* fMediumLockWriteAll */,11597 NULL,11598 *pMediumLockList);11536 hrc = pMedium->i_createMediumLockList(true /* fFailIfInaccessible */, 11537 NULL /* pToLockWrite */, 11538 false /* fMediumLockWriteAll */, 11539 NULL, 11540 *pMediumLockList); 11599 11541 alock.acquire(); 11600 11542 11601 if (FAILED( rc))11543 if (FAILED(hrc)) 11602 11544 { 11603 11545 delete pMediumLockList; 11604 throw rc;11546 throw hrc; 11605 11547 } 11606 11548 11607 rc = lockedMediaMap->Insert(pAtt, pMediumLockList);11608 if (FAILED( rc))11609 throw rc;11549 hrc = lockedMediaMap->Insert(pAtt, pMediumLockList); 11550 if (FAILED(hrc)) 11551 throw hrc; 11610 11552 } 11611 11553 } 11612 11554 11613 if (FAILED( rc))11614 throw rc;11555 if (FAILED(hrc)) 11556 throw hrc; 11615 11557 } // end of offline 11616 11558 … … 11636 11578 /* Deassociate and mark for deletion */ 11637 11579 LogFlowThisFunc(("Detaching '%s', pending deletion\n", pAtt->i_getLogName())); 11638 rc = pMedium->i_removeBackReference(mData->mUuid);11639 if (FAILED( rc))11640 throw rc;11580 hrc = pMedium->i_removeBackReference(mData->mUuid); 11581 if (FAILED(hrc)) 11582 throw hrc; 11641 11583 implicitAtts.push_back(pAtt); 11642 11584 continue; … … 11648 11590 /* no: de-associate */ 11649 11591 LogFlowThisFunc(("Detaching '%s', no deletion\n", pAtt->i_getLogName())); 11650 rc = pMedium->i_removeBackReference(mData->mUuid);11651 if (FAILED( rc))11652 throw rc;11592 hrc = pMedium->i_removeBackReference(mData->mUuid); 11593 if (FAILED(hrc)) 11594 throw hrc; 11653 11595 continue; 11654 11596 } … … 11692 11634 Assert(pMedium); 11693 11635 11694 rc = pMedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/, false /*aNotify*/);11636 hrc = pMedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/, false /*aNotify*/); 11695 11637 // continue on delete failure, just collect error messages 11696 AssertMsg(SUCCEEDED( rc), ("rc=%Rhrc it=%s hd=%s\n",rc, pAtt->i_getLogName(),11697 pMedium->i_getLocationFull().c_str() ));11698 mrc = rc;11638 AssertMsg(SUCCEEDED(hrc), ("hrc=%Rhrc it=%s hd=%s\n", hrc, pAtt->i_getLogName(), 11639 pMedium->i_getLocationFull().c_str() )); 11640 mrc = hrc; 11699 11641 } 11700 11642 // Clear the list of deleted implicit attachments now, while not … … 11714 11656 { 11715 11657 alock.release(); 11716 rc = mData->mSession.mMachine->i_lockMedia();11658 hrc = mData->mSession.mMachine->i_lockMedia(); 11717 11659 alock.acquire(); 11718 if (FAILED( rc))11719 throw rc;11660 if (FAILED(hrc)) 11661 throw hrc; 11720 11662 } 11721 11663 } 11722 11664 } 11723 11665 } 11724 catch (HRESULT aRC) {rc = aRC;} 11666 catch (HRESULT hrcXcpt) 11667 { 11668 hrc = hrcXcpt; 11669 } 11725 11670 11726 11671 if (mData->mMachineState == MachineState_SettingUp) … … 11736 11681 } 11737 11682 11738 return rc;11683 return hrc; 11739 11684 } 11740 11685 … … 11859 11804 writeLock.release(); 11860 11805 11861 HRESULT rc = oldmedium->i_deleteStorage(NULL /*aProgress*/, 11862 true /*aWait*/, 11863 false /*aNotify*/); 11806 HRESULT hrc = oldmedium->i_deleteStorage(NULL /*aProgress*/, true /*aWait*/, false /*aNotify*/); 11864 11807 11865 11808 writeLock.acquire(); … … 11867 11810 i_setMachineState(oldState); 11868 11811 11869 if (FAILED( rc)) returnrc;11812 if (FAILED(hrc)) return hrc; 11870 11813 } 11871 11814 … … 11925 11868 Assert(isWriteLockOnCurrentThread()); 11926 11869 11927 HRESULT rc;11870 HRESULT hrc; 11928 11871 11929 11872 // make a temporary list because i_detachDevice invalidates iterators into … … 11993 11936 11994 11937 // real machine: then we need to use the proper method 11995 rc = i_detachDevice(pAttach, writeLock, pSnapshot);11996 11997 if (FAILED( rc))11998 return rc;11938 hrc = i_detachDevice(pAttach, writeLock, pSnapshot); 11939 11940 if (FAILED(hrc)) 11941 return hrc; 11999 11942 } 12000 11943 … … 12025 11968 LogFlowThisFunc(("Entering, aOnline=%d\n", aOnline)); 12026 11969 12027 HRESULT rc = S_OK;11970 HRESULT hrc = S_OK; 12028 11971 12029 11972 /* no attach/detach operations -- nothing to do */ … … 12065 12008 /* update the appropriate lock list */ 12066 12009 MediumLockList *pMediumLockList; 12067 rc = mData->mSession.mLockedMedia.Get(pAttach, pMediumLockList);12068 AssertComRC( rc);12010 hrc = mData->mSession.mLockedMedia.Get(pAttach, pMediumLockList); 12011 AssertComRC(hrc); 12069 12012 if (pMediumLockList) 12070 12013 { … … 12073 12016 { 12074 12017 Assert(mData->mSession.mLockedMedia.IsLocked()); 12075 rc = mData->mSession.mLockedMedia.Unlock();12076 AssertComRC( rc);12018 hrc = mData->mSession.mLockedMedia.Unlock(); 12019 AssertComRC(hrc); 12077 12020 fMediaNeedsLocking = true; 12078 12021 } 12079 rc = pMediumLockList->Update(pMedium->i_getParent(), false);12080 AssertComRC( rc);12081 rc = pMediumLockList->Append(pMedium, true);12082 AssertComRC( rc);12022 hrc = pMediumLockList->Update(pMedium->i_getParent(), false); 12023 AssertComRC(hrc); 12024 hrc = pMediumLockList->Append(pMedium, true); 12025 AssertComRC(hrc); 12083 12026 } 12084 12027 } … … 12125 12068 12126 12069 /* now de-associate from the current machine state */ 12127 rc = pMedium->i_removeBackReference(mData->mUuid);12128 AssertComRC( rc);12070 hrc = pMedium->i_removeBackReference(mData->mUuid); 12071 AssertComRC(hrc); 12129 12072 12130 12073 if (aOnline) … … 12132 12075 /* unlock since medium is not used anymore */ 12133 12076 MediumLockList *pMediumLockList; 12134 rc = mData->mSession.mLockedMedia.Get(pAttach, pMediumLockList);12135 if (RT_UNLIKELY( rc == VBOX_E_INVALID_OBJECT_STATE))12077 hrc = mData->mSession.mLockedMedia.Get(pAttach, pMediumLockList); 12078 if (RT_UNLIKELY(hrc == VBOX_E_INVALID_OBJECT_STATE)) 12136 12079 { 12137 12080 /* this happens for online snapshots, there the attachment … … 12142 12085 else 12143 12086 { 12144 AssertComRC( rc);12087 AssertComRC(hrc); 12145 12088 if (pMediumLockList) 12146 12089 { 12147 rc = mData->mSession.mLockedMedia.Remove(pAttach);12148 AssertComRC( rc);12090 hrc = mData->mSession.mLockedMedia.Remove(pAttach); 12091 AssertComRC(hrc); 12149 12092 } 12150 12093 } … … 12157 12100 { 12158 12101 Assert(aOnline); 12159 rc = mData->mSession.mLockedMedia.Lock();12160 AssertComRC( rc);12102 hrc = mData->mSession.mLockedMedia.Lock(); 12103 AssertComRC(hrc); 12161 12104 } 12162 12105 … … 12206 12149 LogFlowThisFunc(("Entering rollbackMedia\n")); 12207 12150 12208 HRESULT rc = S_OK;12151 HRESULT hrc = S_OK; 12209 12152 12210 12153 /* no attach/detach operations -- nothing to do */ … … 12225 12168 if (pMedium) 12226 12169 { 12227 rc = pMedium->i_removeBackReference(mData->mUuid);12228 AssertComRC( rc);12170 hrc = pMedium->i_removeBackReference(mData->mUuid); 12171 AssertComRC(hrc); 12229 12172 } 12230 12173 } … … 12239 12182 if (pMedium) 12240 12183 { 12241 rc = pMedium->i_addBackReference(mData->mUuid);12242 AssertComRC( rc);12184 hrc = pMedium->i_addBackReference(mData->mUuid); 12185 AssertComRC(hrc); 12243 12186 } 12244 12187 } … … 12766 12709 ComObjPtr<SharedFolder> folder; 12767 12710 folder.createObject(); 12768 HRESULT rc = folder->initCopy(i_getMachine(), *it);12769 AssertComRC( rc);12711 HRESULT hrc = folder->initCopy(i_getMachine(), *it); 12712 AssertComRC(hrc); 12770 12713 *it = folder; 12771 12714 } … … 12837 12780 { 12838 12781 ComPtr<ISystemProperties> systemProperties; 12839 HRESULT rc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam());12840 if (FAILED( rc))12782 HRESULT hrc = mParent->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 12783 if (FAILED(hrc)) 12841 12784 return false; 12842 12785 … … 13089 13032 AssertReturn(autoInitSpan.isOk(), E_FAIL); 13090 13033 13091 HRESULT rc = S_OK;13034 HRESULT hrc = S_OK; 13092 13035 13093 13036 RT_ZERO(mAuthLibCtx); … … 13101 13044 delete mClientToken; 13102 13045 mClientToken = NULL; 13103 rc = E_FAIL;13046 hrc = E_FAIL; 13104 13047 } 13105 13048 } 13106 13049 catch (std::bad_alloc &) 13107 13050 { 13108 rc = E_OUTOFMEMORY;13109 } 13110 if (FAILED( rc))13111 return rc;13051 hrc = E_OUTOFMEMORY; 13052 } 13053 if (FAILED(hrc)) 13054 return hrc; 13112 13055 13113 13056 /* memorize the peer Machine */ … … 13210 13153 13211 13154 LogFlowThisFuncLeave(); 13212 return rc;13155 return hrc; 13213 13156 } 13214 13157 … … 13287 13230 * This is identical to SessionMachine::DetachAllUSBDevices except 13288 13231 * for the aAbnormal argument. */ 13289 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */);13290 AssertComRC( rc);13291 NOREF( rc);13232 HRESULT hrc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */); 13233 AssertComRC(hrc); 13234 NOREF(hrc); 13292 13235 13293 13236 USBProxyService *service = mParent->i_host()->i_usbProxyService(); … … 13371 13314 multilock.release(); 13372 13315 LogFlowThisFunc((" Calling remoteControl->Uninitialize()...\n")); 13373 HRESULT rc = pControl->Uninitialize();13374 LogFlowThisFunc((" remoteControl->Uninitialize() returned %08X\n", rc));13375 if (FAILED( rc))13316 HRESULT hrc = pControl->Uninitialize(); 13317 LogFlowThisFunc((" remoteControl->Uninitialize() returned %08X\n", hrc)); 13318 if (FAILED(hrc)) 13376 13319 Log1WarningThisFunc(("Forgot to close the remote session?\n")); 13377 13320 multilock.acquire(); … … 13607 13550 /* we might have been uninitialized because the session was accidentally 13608 13551 * closed by the client, so don't assert */ 13609 HRESULT rc = setError(E_FAIL, 13610 tr("The session has been accidentally closed")); 13611 task.m_pProgress->i_notifyComplete(rc); 13552 HRESULT hrc = setError(E_FAIL, tr("The session has been accidentally closed")); 13553 task.m_pProgress->i_notifyComplete(hrc); 13612 13554 LogFlowThisFuncLeave(); 13613 13555 return; … … 13616 13558 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 13617 13559 13618 HRESULT rc = S_OK;13560 HRESULT hrc = S_OK; 13619 13561 13620 13562 try … … 13628 13570 alock.release(); 13629 13571 BOOL fSuspendedBySave; 13630 rc = directControl->SaveStateWithReason(task.m_enmReason, task.m_pProgress, NULL, Bstr(task.m_strStateFilePath).raw(), task.m_machineStateBackup != MachineState_Paused, &fSuspendedBySave);13572 hrc = directControl->SaveStateWithReason(task.m_enmReason, task.m_pProgress, NULL, Bstr(task.m_strStateFilePath).raw(), task.m_machineStateBackup != MachineState_Paused, &fSuspendedBySave); 13631 13573 Assert(!fSuspendedBySave); 13632 13574 alock.acquire(); 13633 13575 13634 AssertStmt( (SUCCEEDED( rc) && mData->mMachineState == MachineState_Saved)13635 || (FAILED( rc) && mData->mMachineState == MachineState_Saving),13576 AssertStmt( (SUCCEEDED(hrc) && mData->mMachineState == MachineState_Saved) 13577 || (FAILED(hrc) && mData->mMachineState == MachineState_Saving), 13636 13578 throw E_FAIL); 13637 13579 13638 if (SUCCEEDED( rc))13580 if (SUCCEEDED(hrc)) 13639 13581 { 13640 13582 mSSData->strStateFilePath = task.m_strStateFilePath; 13641 13583 13642 13584 /* save all VM settings */ 13643 rc = i_saveSettings(NULL, alock);13585 hrc = i_saveSettings(NULL, alock); 13644 13586 // no need to check whether VirtualBox.xml needs saving also since 13645 13587 // we can't have a name change pending at this point … … 13657 13599 } 13658 13600 } 13659 catch (HRESULT aRC) { rc = aRC; } 13660 13661 task.m_pProgress->i_notifyComplete(rc); 13601 catch (HRESULT hrcXcpt) 13602 { 13603 hrc = hrcXcpt; 13604 } 13605 13606 task.m_pProgress->i_notifyComplete(hrc); 13662 13607 13663 13608 LogFlowThisFuncLeave(); … … 13676 13621 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 13677 13622 13678 HRESULT rc = i_checkStateDependency(MutableOrRunningStateDep);13679 if (FAILED( rc)) returnrc;13623 HRESULT hrc = i_checkStateDependency(MutableOrRunningStateDep); 13624 if (FAILED(hrc)) return hrc; 13680 13625 13681 13626 if ( mData->mMachineState != MachineState_Running … … 13688 13633 ComObjPtr<Progress> pProgress; 13689 13634 pProgress.createObject(); 13690 rc = pProgress->init(i_getVirtualBox(),13691 static_cast<IMachine *>(this) /* aInitiator */,13692 tr("Saving the execution state of the virtual machine"),13693 FALSE /* aCancelable */);13694 if (FAILED( rc))13695 return rc;13635 hrc = pProgress->init(i_getVirtualBox(), 13636 static_cast<IMachine *>(this) /* aInitiator */, 13637 tr("Saving the execution state of the virtual machine"), 13638 FALSE /* aCancelable */); 13639 if (FAILED(hrc)) 13640 return hrc; 13696 13641 13697 13642 Utf8Str strStateFilePath; … … 13701 13646 * start working until we release alock) */ 13702 13647 SaveStateTask *pTask = new SaveStateTask(this, pProgress, "SaveState", aReason, strStateFilePath); 13703 rc = pTask->createThread();13704 if (FAILED( rc))13705 return rc;13648 hrc = pTask->createThread(); 13649 if (FAILED(hrc)) 13650 return hrc; 13706 13651 13707 13652 /* set the state to Saving (expected by Session::SaveStateWithReason()) */ … … 13721 13666 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 13722 13667 13723 HRESULT rc = i_checkStateDependency(MutableStateDep);13724 if (FAILED( rc)) returnrc;13668 HRESULT hrc = i_checkStateDependency(MutableStateDep); 13669 if (FAILED(hrc)) return hrc; 13725 13670 13726 13671 if ( mData->mMachineState != MachineState_PoweredOff … … 13755 13700 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 13756 13701 13757 HRESULT rc = i_checkStateDependency(MutableOrSavedStateDep);13758 if (FAILED( rc)) returnrc;13702 HRESULT hrc = i_checkStateDependency(MutableOrSavedStateDep); 13703 if (FAILED(hrc)) return hrc; 13759 13704 13760 13705 if ( mData->mMachineState != MachineState_Saved … … 13770 13715 * and properly handled. 13771 13716 */ 13772 rc = i_setMachineState(MachineState_PoweredOff);13773 return rc;13717 hrc = i_setMachineState(MachineState_PoweredOff); 13718 return hrc; 13774 13719 } 13775 13720 … … 13986 13931 /* if captureDeviceForVM() fails, it must have set extended error info */ 13987 13932 clearError(); 13988 MultiResult rc = mParent->i_host()->i_checkUSBProxyService();13989 if (FAILED( rc) || SUCCEEDED_WARNING(rc))13990 return rc;13933 MultiResult hrc = mParent->i_host()->i_checkUSBProxyService(); 13934 if (FAILED(hrc) || SUCCEEDED_WARNING(hrc)) 13935 return hrc; 13991 13936 13992 13937 USBProxyService *service = mParent->i_host()->i_usbProxyService(); … … 14031 13976 14032 13977 #ifdef VBOX_WITH_USB 14033 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(true /* aInsertFilters */);14034 AssertComRC( rc);14035 NOREF( rc);13978 HRESULT hrc = mUSBDeviceFilters->i_notifyProxy(true /* aInsertFilters */); 13979 AssertComRC(hrc); 13980 NOREF(hrc); 14036 13981 14037 13982 USBProxyService *service = mParent->i_host()->i_usbProxyService(); … … 14058 14003 14059 14004 #ifdef VBOX_WITH_USB 14060 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */);14061 AssertComRC( rc);14062 NOREF( rc);14005 HRESULT hrc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */); 14006 AssertComRC(hrc); 14007 NOREF(hrc); 14063 14008 14064 14009 USBProxyService *service = mParent->i_host()->i_usbProxyService(); … … 15239 15184 AssertReturn(mData->mSession.mLockedMedia.IsEmpty(), E_FAIL); 15240 15185 15241 MultiResult mrc(S_OK);15186 MultiResult hrcMult(S_OK); 15242 15187 15243 15188 /* Collect locking information for all medium objects attached to the VM. */ … … 15264 15209 15265 15210 alock.release(); 15266 mrc= pMedium->i_createMediumLockList(fIsVitalImage /* fFailIfInaccessible */,15267 !fIsReadOnlyLock ? pMedium : NULL /* pToLockWrite */,15268 false /* fMediumLockWriteAll */,15269 NULL,15270 *pMediumLockList);15211 hrcMult = pMedium->i_createMediumLockList(fIsVitalImage /* fFailIfInaccessible */, 15212 !fIsReadOnlyLock ? pMedium : NULL /* pToLockWrite */, 15213 false /* fMediumLockWriteAll */, 15214 NULL, 15215 *pMediumLockList); 15271 15216 alock.acquire(); 15272 if (FAILED( mrc))15217 if (FAILED(hrcMult)) 15273 15218 { 15274 15219 delete pMediumLockList; … … 15278 15223 } 15279 15224 15280 HRESULT rc = mData->mSession.mLockedMedia.Insert(pAtt, pMediumLockList);15281 if (FAILED( rc))15225 HRESULT hrc = mData->mSession.mLockedMedia.Insert(pAtt, pMediumLockList); 15226 if (FAILED(hrc)) 15282 15227 { 15283 15228 mData->mSession.mLockedMedia.Clear(); 15284 mrc = setError(rc, 15285 tr("Collecting locking information for all attached media failed")); 15229 hrcMult = setError(hrc, tr("Collecting locking information for all attached media failed")); 15286 15230 break; 15287 15231 } 15288 15232 } 15289 15233 15290 if (SUCCEEDED( mrc))15234 if (SUCCEEDED(hrcMult)) 15291 15235 { 15292 15236 /* Now lock all media. If this fails, nothing is locked. */ 15293 15237 alock.release(); 15294 HRESULT rc = mData->mSession.mLockedMedia.Lock();15238 HRESULT hrc = mData->mSession.mLockedMedia.Lock(); 15295 15239 alock.acquire(); 15296 if (FAILED(rc)) 15297 { 15298 mrc = setError(rc, 15299 tr("Locking of attached media failed. A possible reason is that one of the media is attached to a running VM")); 15300 } 15301 } 15302 15303 return mrc; 15240 if (FAILED(hrc)) 15241 hrcMult = setError(hrc, 15242 tr("Locking of attached media failed. A possible reason is that one of the media is attached to a running VM")); 15243 } 15244 15245 return hrcMult; 15304 15246 } 15305 15247 … … 15318 15260 ErrorInfoKeeper eik; 15319 15261 15320 HRESULT rc = mData->mSession.mLockedMedia.Clear();15321 AssertComRC( rc);15322 return rc;15262 HRESULT hrc = mData->mSession.mLockedMedia.Clear(); 15263 AssertComRC(hrc); 15264 return hrc; 15323 15265 } 15324 15266 … … 15348 15290 E_FAIL); 15349 15291 15350 HRESULT rc = S_OK;15292 HRESULT hrc = S_OK; 15351 15293 15352 15294 int stsFlags = 0; … … 15556 15498 #endif /* VBOX_WITH_GUEST_PROPS */ 15557 15499 15558 rc = i_saveStateSettings(stsFlags);15500 hrc = i_saveStateSettings(stsFlags); 15559 15501 15560 15502 if ( ( oldMachineState != MachineState_PoweredOff … … 15572 15514 } 15573 15515 15574 LogFlowThisFunc((" rc=%Rhrc [%s]\n",rc, ::stringifyMachineState(mData->mMachineState) ));15516 LogFlowThisFunc(("hrc=%Rhrc [%s]\n", hrc, ::stringifyMachineState(mData->mMachineState) )); 15575 15517 LogFlowThisFuncLeave(); 15576 return rc;15518 return hrc; 15577 15519 } 15578 15520 … … 15620 15562 va_list args; 15621 15563 va_start(args, pcszMsg); 15622 HRESULT rc = setErrorInternalV(aResultCode,15623 getStaticClassIID(),15624 getStaticComponentName(),15625 pcszMsg, args,15626 false /* aWarning */,15627 true /* aLogIt */);15564 HRESULT hrc = setErrorInternalV(aResultCode, 15565 getStaticClassIID(), 15566 getStaticComponentName(), 15567 pcszMsg, args, 15568 false /* aWarning */, 15569 true /* aLogIt */); 15628 15570 va_end(args); 15629 return rc;15571 return hrc; 15630 15572 } 15631 15573 … … 15848 15790 AssertComRCReturn(autoCaller.hrc(),autoCaller.hrc()); 15849 15791 15850 HRESULT rc = S_OK;15851 15852 15792 /* get usb device filters from host, before any writes occurred to avoid deadlock */ 15853 15793 ComPtr<IUSBDeviceFilters> usbDeviceFilters; 15854 rc = getUSBDeviceFilters(usbDeviceFilters);15855 if (FAILED( rc)) returnrc;15794 HRESULT hrc = getUSBDeviceFilters(usbDeviceFilters); 15795 if (FAILED(hrc)) return hrc; 15856 15796 15857 15797 NOREF(aFlags); … … 15860 15800 15861 15801 /* Get the guest os type as a string from the VB. */ 15862 rc = getOSTypeId(osTypeId);15863 if (FAILED( rc)) returnrc;15802 hrc = getOSTypeId(osTypeId); 15803 if (FAILED(hrc)) return hrc; 15864 15804 15865 15805 /* Get the os type obj that coresponds, can be used to get 15866 15806 * the defaults for this guest OS. */ 15867 rc = mParent->i_findGuestOSType(Bstr(osTypeId), osType);15868 if (FAILED( rc)) returnrc;15807 hrc = mParent->i_findGuestOSType(Bstr(osTypeId), osType); 15808 if (FAILED(hrc)) return hrc; 15869 15809 15870 15810 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 15888 15828 mHWData->mHWVirtExEnabled = true; 15889 15829 15890 rc = osType->COMGETTER(RecommendedRAM)(&mHWData->mMemorySize);15891 if (FAILED( rc)) returnrc;15892 15893 rc = osType->COMGETTER(RecommendedCPUCount)(&mHWData->mCPUCount);15894 if (FAILED( rc)) returnrc;15830 hrc = osType->COMGETTER(RecommendedRAM)(&mHWData->mMemorySize); 15831 if (FAILED(hrc)) return hrc; 15832 15833 hrc = osType->COMGETTER(RecommendedCPUCount)(&mHWData->mCPUCount); 15834 if (FAILED(hrc)) return hrc; 15895 15835 15896 15836 /* Graphics stuff. */ 15897 15837 GraphicsControllerType_T graphicsController; 15898 rc = osType->COMGETTER(RecommendedGraphicsController)(&graphicsController);15899 if (FAILED( rc)) returnrc;15900 15901 rc = mGraphicsAdapter->COMSETTER(GraphicsControllerType)(graphicsController);15902 if (FAILED( rc)) returnrc;15838 hrc = osType->COMGETTER(RecommendedGraphicsController)(&graphicsController); 15839 if (FAILED(hrc)) return hrc; 15840 15841 hrc = mGraphicsAdapter->COMSETTER(GraphicsControllerType)(graphicsController); 15842 if (FAILED(hrc)) return hrc; 15903 15843 15904 15844 ULONG vramSize; 15905 rc = osType->COMGETTER(RecommendedVRAM)(&vramSize);15906 if (FAILED( rc)) returnrc;15907 15908 rc = mGraphicsAdapter->COMSETTER(VRAMSize)(vramSize);15909 if (FAILED( rc)) returnrc;15845 hrc = osType->COMGETTER(RecommendedVRAM)(&vramSize); 15846 if (FAILED(hrc)) return hrc; 15847 15848 hrc = mGraphicsAdapter->COMSETTER(VRAMSize)(vramSize); 15849 if (FAILED(hrc)) return hrc; 15910 15850 15911 15851 BOOL fAccelerate2DVideoEnabled; 15912 rc = osType->COMGETTER(Recommended2DVideoAcceleration)(&fAccelerate2DVideoEnabled);15913 if (FAILED( rc)) returnrc;15914 15915 rc = mGraphicsAdapter->COMSETTER(Accelerate2DVideoEnabled)(fAccelerate2DVideoEnabled);15916 if (FAILED( rc)) returnrc;15852 hrc = osType->COMGETTER(Recommended2DVideoAcceleration)(&fAccelerate2DVideoEnabled); 15853 if (FAILED(hrc)) return hrc; 15854 15855 hrc = mGraphicsAdapter->COMSETTER(Accelerate2DVideoEnabled)(fAccelerate2DVideoEnabled); 15856 if (FAILED(hrc)) return hrc; 15917 15857 15918 15858 BOOL fAccelerate3DEnabled; 15919 rc = osType->COMGETTER(Recommended3DAcceleration)(&fAccelerate3DEnabled);15920 if (FAILED( rc)) returnrc;15921 15922 rc = mGraphicsAdapter->COMSETTER(Accelerate3DEnabled)(fAccelerate3DEnabled);15923 if (FAILED( rc)) returnrc;15924 15925 rc = osType->COMGETTER(RecommendedFirmware)(&mHWData->mFirmwareType);15926 if (FAILED( rc)) returnrc;15927 15928 rc = osType->COMGETTER(RecommendedPAE)(&mHWData->mPAEEnabled);15929 if (FAILED( rc)) returnrc;15930 15931 rc = osType->COMGETTER(RecommendedHPET)(&mHWData->mHPETEnabled);15932 if (FAILED( rc)) returnrc;15859 hrc = osType->COMGETTER(Recommended3DAcceleration)(&fAccelerate3DEnabled); 15860 if (FAILED(hrc)) return hrc; 15861 15862 hrc = mGraphicsAdapter->COMSETTER(Accelerate3DEnabled)(fAccelerate3DEnabled); 15863 if (FAILED(hrc)) return hrc; 15864 15865 hrc = osType->COMGETTER(RecommendedFirmware)(&mHWData->mFirmwareType); 15866 if (FAILED(hrc)) return hrc; 15867 15868 hrc = osType->COMGETTER(RecommendedPAE)(&mHWData->mPAEEnabled); 15869 if (FAILED(hrc)) return hrc; 15870 15871 hrc = osType->COMGETTER(RecommendedHPET)(&mHWData->mHPETEnabled); 15872 if (FAILED(hrc)) return hrc; 15933 15873 15934 15874 BOOL mRTCUseUTC; 15935 rc = osType->COMGETTER(RecommendedRTCUseUTC)(&mRTCUseUTC);15936 if (FAILED( rc)) returnrc;15875 hrc = osType->COMGETTER(RecommendedRTCUseUTC)(&mRTCUseUTC); 15876 if (FAILED(hrc)) return hrc; 15937 15877 15938 15878 setRTCUseUTC(mRTCUseUTC); 15939 if (FAILED( rc)) returnrc;15879 if (FAILED(hrc)) return hrc; 15940 15880 15941 15881 /* the setter does more than just the assignment, so use it */ 15942 15882 ChipsetType_T enmChipsetType; 15943 rc = osType->COMGETTER(RecommendedChipset)(&enmChipsetType);15944 if (FAILED( rc)) returnrc;15945 15946 rc = COMSETTER(ChipsetType)(enmChipsetType);15947 if (FAILED( rc)) returnrc;15948 15949 rc = osType->COMGETTER(RecommendedTFReset)(&mHWData->mTripleFaultReset);15950 if (FAILED( rc)) returnrc;15883 hrc = osType->COMGETTER(RecommendedChipset)(&enmChipsetType); 15884 if (FAILED(hrc)) return hrc; 15885 15886 hrc = COMSETTER(ChipsetType)(enmChipsetType); 15887 if (FAILED(hrc)) return hrc; 15888 15889 hrc = osType->COMGETTER(RecommendedTFReset)(&mHWData->mTripleFaultReset); 15890 if (FAILED(hrc)) return hrc; 15951 15891 15952 15892 /* Apply IOMMU defaults. */ 15953 15893 IommuType_T enmIommuType; 15954 rc = osType->COMGETTER(RecommendedIommuType)(&enmIommuType);15955 if (FAILED( rc)) returnrc;15956 15957 rc = COMSETTER(IommuType)(enmIommuType);15958 if (FAILED( rc)) returnrc;15894 hrc = osType->COMGETTER(RecommendedIommuType)(&enmIommuType); 15895 if (FAILED(hrc)) return hrc; 15896 15897 hrc = COMSETTER(IommuType)(enmIommuType); 15898 if (FAILED(hrc)) return hrc; 15959 15899 15960 15900 /* Apply network adapters defaults */ … … 15974 15914 15975 15915 /* This one covers secure boot. */ 15976 rc = mNvramStore->i_applyDefaults(osType);15977 if (FAILED( rc)) returnrc;15916 hrc = mNvramStore->i_applyDefaults(osType); 15917 if (FAILED(hrc)) return hrc; 15978 15918 15979 15919 /* Audio stuff. */ 15980 rc = mAudioSettings->i_applyDefaults(osType);15981 if (FAILED( rc)) returnrc;15920 hrc = mAudioSettings->i_applyDefaults(osType); 15921 if (FAILED(hrc)) return hrc; 15982 15922 15983 15923 /* Storage Controllers */ … … 15996 15936 15997 15937 /* Floppy recommended? add one. */ 15998 rc = osType->COMGETTER(RecommendedFloppy(&recommendedFloppy));15999 if (FAILED( rc)) returnrc;15938 hrc = osType->COMGETTER(RecommendedFloppy(&recommendedFloppy)); 15939 if (FAILED(hrc)) return hrc; 16000 15940 if (recommendedFloppy) 16001 15941 { 16002 rc = addStorageController(strFloppyName, 16003 StorageBus_Floppy, 16004 floppyController); 16005 if (FAILED(rc)) return rc; 15942 hrc = addStorageController(strFloppyName, StorageBus_Floppy, floppyController); 15943 if (FAILED(hrc)) return hrc; 16006 15944 } 16007 15945 16008 15946 /* Setup one DVD storage controller. */ 16009 rc = osType->COMGETTER(RecommendedDVDStorageController)(&dvdStorageControllerType);16010 if (FAILED( rc)) returnrc;16011 16012 rc = osType->COMGETTER(RecommendedDVDStorageBus)(&dvdStorageBusType);16013 if (FAILED( rc)) returnrc;15947 hrc = osType->COMGETTER(RecommendedDVDStorageController)(&dvdStorageControllerType); 15948 if (FAILED(hrc)) return hrc; 15949 15950 hrc = osType->COMGETTER(RecommendedDVDStorageBus)(&dvdStorageBusType); 15951 if (FAILED(hrc)) return hrc; 16014 15952 16015 15953 strDVDName = i_controllerNameFromBusType(dvdStorageBusType); 16016 15954 16017 rc = addStorageController(strDVDName, 16018 dvdStorageBusType, 16019 dvdController); 16020 if (FAILED(rc)) return rc; 16021 16022 rc = dvdController->COMSETTER(ControllerType)(dvdStorageControllerType); 16023 if (FAILED(rc)) return rc; 15955 hrc = addStorageController(strDVDName, dvdStorageBusType, dvdController); 15956 if (FAILED(hrc)) return hrc; 15957 15958 hrc = dvdController->COMSETTER(ControllerType)(dvdStorageControllerType); 15959 if (FAILED(hrc)) return hrc; 16024 15960 16025 15961 /* Setup one HDD storage controller. */ 16026 rc = osType->COMGETTER(RecommendedHDStorageController)(&hdStorageControllerType);16027 if (FAILED( rc)) returnrc;16028 16029 rc = osType->COMGETTER(RecommendedHDStorageBus)(&hdStorageBusType);16030 if (FAILED( rc)) returnrc;15962 hrc = osType->COMGETTER(RecommendedHDStorageController)(&hdStorageControllerType); 15963 if (FAILED(hrc)) return hrc; 15964 15965 hrc = osType->COMGETTER(RecommendedHDStorageBus)(&hdStorageBusType); 15966 if (FAILED(hrc)) return hrc; 16031 15967 16032 15968 strHDName = i_controllerNameFromBusType(hdStorageBusType); … … 16034 15970 if (hdStorageBusType != dvdStorageBusType && hdStorageControllerType != dvdStorageControllerType) 16035 15971 { 16036 rc = addStorageController(strHDName, 16037 hdStorageBusType, 16038 hdController); 16039 if (FAILED(rc)) return rc; 16040 16041 rc = hdController->COMSETTER(ControllerType)(hdStorageControllerType); 16042 if (FAILED(rc)) return rc; 15972 hrc = addStorageController(strHDName, hdStorageBusType, hdController); 15973 if (FAILED(hrc)) return hrc; 15974 15975 hrc = hdController->COMSETTER(ControllerType)(hdStorageControllerType); 15976 if (FAILED(hrc)) return hrc; 16043 15977 } 16044 15978 else … … 16073 16007 16074 16008 getUSBProxyAvailable(&usbProxyAvailable); 16075 if (FAILED( rc)) returnrc;16076 16077 rc = osType->COMGETTER(RecommendedUSB3)(&recommendedUSB3);16078 if (FAILED( rc)) returnrc;16079 rc = osType->COMGETTER(RecommendedUSB)(&recommendedUSB);16080 if (FAILED( rc)) returnrc;16009 if (FAILED(hrc)) return hrc; 16010 16011 hrc = osType->COMGETTER(RecommendedUSB3)(&recommendedUSB3); 16012 if (FAILED(hrc)) return hrc; 16013 hrc = osType->COMGETTER(RecommendedUSB)(&recommendedUSB); 16014 if (FAILED(hrc)) return hrc; 16081 16015 16082 16016 if (!usbDeviceFilters.isNull() && recommendedUSB3 && usbProxyAvailable) 16083 16017 { 16084 rc = addUSBController("XHCI", USBControllerType_XHCI, usbController);16085 if (FAILED( rc)) returnrc;16018 hrc = addUSBController("XHCI", USBControllerType_XHCI, usbController); 16019 if (FAILED(hrc)) return hrc; 16086 16020 16087 16021 /* xHci includes OHCI */ … … 16091 16025 && !usbDeviceFilters.isNull() && recommendedUSB && usbProxyAvailable) 16092 16026 { 16093 rc = addUSBController("OHCI", USBControllerType_OHCI, usbController);16094 if (FAILED( rc)) returnrc;16027 hrc = addUSBController("OHCI", USBControllerType_OHCI, usbController); 16028 if (FAILED(hrc)) return hrc; 16095 16029 ohciEnabled = true; 16096 16030 16097 rc = addUSBController("EHCI", USBControllerType_EHCI, usbController);16098 if (FAILED( rc)) returnrc;16031 hrc = addUSBController("EHCI", USBControllerType_EHCI, usbController); 16032 if (FAILED(hrc)) return hrc; 16099 16033 } 16100 16034 16101 16035 /* Set recommended human interface device types: */ 16102 16036 BOOL recommendedUSBHID; 16103 rc = osType->COMGETTER(RecommendedUSBHID)(&recommendedUSBHID);16104 if (FAILED( rc)) returnrc;16037 hrc = osType->COMGETTER(RecommendedUSBHID)(&recommendedUSBHID); 16038 if (FAILED(hrc)) return hrc; 16105 16039 16106 16040 if (recommendedUSBHID) … … 16110 16044 if (!ohciEnabled && !usbDeviceFilters.isNull()) 16111 16045 { 16112 rc = addUSBController("OHCI", USBControllerType_OHCI, usbController);16113 if (FAILED( rc)) returnrc;16046 hrc = addUSBController("OHCI", USBControllerType_OHCI, usbController); 16047 if (FAILED(hrc)) return hrc; 16114 16048 } 16115 16049 } 16116 16050 16117 16051 BOOL recommendedUSBTablet; 16118 rc = osType->COMGETTER(RecommendedUSBTablet)(&recommendedUSBTablet);16119 if (FAILED( rc)) returnrc;16052 hrc = osType->COMGETTER(RecommendedUSBTablet)(&recommendedUSBTablet); 16053 if (FAILED(hrc)) return hrc; 16120 16054 16121 16055 if (recommendedUSBTablet) … … 16124 16058 if (!ohciEnabled && !usbDeviceFilters.isNull()) 16125 16059 { 16126 rc = addUSBController("OHCI", USBControllerType_OHCI, usbController);16127 if (FAILED( rc)) returnrc;16060 hrc = addUSBController("OHCI", USBControllerType_OHCI, usbController); 16061 if (FAILED(hrc)) return hrc; 16128 16062 } 16129 16063 } … … 16132 16066 if (osTypeId == "VBoxBS_64") 16133 16067 { 16134 rc = setExtraData("VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled", "1");16135 if (FAILED( rc))16136 return rc;16068 hrc = setExtraData("VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled", "1"); 16069 if (FAILED(hrc)) 16070 return hrc; 16137 16071 } 16138 16072 … … 16221 16155 RTDIR hDir; 16222 16156 size_t cbDirEntry = sizeof(RTDIRENTRYEX); 16223 int rc = RTDirOpenFiltered(&hDir, pszFilePattern, RTDIRFILTER_WINNT, 0 /*fFlags*/);16224 if (RT_SUCCESS( rc))16157 int vrc = RTDirOpenFiltered(&hDir, pszFilePattern, RTDIRFILTER_WINNT, 0 /*fFlags*/); 16158 if (RT_SUCCESS(vrc)) 16225 16159 { 16226 16160 pDirEntry = (PRTDIRENTRYEX)RTMemAllocZ(sizeof(RTDIRENTRYEX)); 16227 16161 if (pDirEntry) 16228 16162 { 16229 while ( ( rc = RTDirReadEx(hDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK))16163 while ( (vrc = RTDirReadEx(hDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK)) 16230 16164 != VERR_NO_MORE_FILES) 16231 16165 { 16232 16166 char *pszFilePath = NULL; 16233 16167 16234 if ( rc == VERR_BUFFER_OVERFLOW)16168 if (vrc == VERR_BUFFER_OVERFLOW) 16235 16169 { 16236 16170 /* allocate new buffer. */ … … 16239 16173 if (!pDirEntry) 16240 16174 { 16241 rc = VERR_NO_MEMORY;16175 vrc = VERR_NO_MEMORY; 16242 16176 break; 16243 16177 } 16244 16178 /* Retry. */ 16245 rc = RTDirReadEx(hDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK);16246 if (RT_FAILURE( rc))16179 vrc = RTDirReadEx(hDir, pDirEntry, &cbDirEntry, RTFSOBJATTRADD_NOTHING, RTPATH_F_ON_LINK); 16180 if (RT_FAILURE(vrc)) 16247 16181 break; 16248 16182 } 16249 else if (RT_FAILURE( rc))16183 else if (RT_FAILURE(vrc)) 16250 16184 break; 16251 16185 … … 16259 16193 if (!pszSubDirPath) 16260 16194 { 16261 rc = VERR_NO_STR_MEMORY;16195 vrc = VERR_NO_STR_MEMORY; 16262 16196 break; 16263 16197 } 16264 rc = i_findFiles(lstFiles, pszSubDirPath, strPattern);16198 vrc = i_findFiles(lstFiles, pszSubDirPath, strPattern); 16265 16199 RTMemFree(pszSubDirPath); 16266 if (RT_FAILURE( rc))16200 if (RT_FAILURE(vrc)) 16267 16201 break; 16268 16202 continue; … … 16280 16214 if (!pszFilePath) 16281 16215 { 16282 rc = VERR_NO_STR_MEMORY;16216 vrc = VERR_NO_STR_MEMORY; 16283 16217 break; 16284 16218 } … … 16291 16225 } 16292 16226 else 16293 rc = VERR_NO_MEMORY;16227 vrc = VERR_NO_MEMORY; 16294 16228 16295 16229 RTDirClose(hDir); … … 16302 16236 } 16303 16237 16304 if ( rc == VERR_NO_MORE_FILES16305 || rc == VERR_FILE_NOT_FOUND16306 || rc == VERR_PATH_NOT_FOUND)16307 rc = VINF_SUCCESS;16238 if ( vrc == VERR_NO_MORE_FILES 16239 || vrc == VERR_FILE_NOT_FOUND 16240 || vrc == VERR_PATH_NOT_FOUND) 16241 vrc = VINF_SUCCESS; 16308 16242 RTStrFree(pszFilePattern); 16309 return rc;16243 return vrc; 16310 16244 } 16311 16245 … … 16424 16358 16425 16359 /* Reencryption required */ 16426 HRESULT rc = S_OK;16360 HRESULT hrc = S_OK; 16427 16361 int vrc = VINF_SUCCESS; 16428 16362 16429 16363 std::list<com::Utf8Str> lstFiles; 16430 if (SUCCEEDED( rc))16364 if (SUCCEEDED(hrc)) 16431 16365 { 16432 16366 vrc = i_findFiles(lstFiles, strDirectory, strFilePattern); 16433 16367 if (RT_FAILURE(vrc)) 16434 rc = setErrorBoth(E_FAIL, vrc, tr("Getting file list for '%s' files failed, (%Rrc)"), 16435 strFilePattern.c_str(), vrc); 16368 hrc = setErrorBoth(E_FAIL, vrc, tr("Getting file list for '%s' files failed, (%Rrc)"), strFilePattern.c_str(), vrc); 16436 16369 } 16437 16370 com::Utf8Str strNewKeyStore; 16438 if (SUCCEEDED( rc))16371 if (SUCCEEDED(hrc)) 16439 16372 { 16440 16373 if (!fDecrypt) … … 16479 16412 fOpenForWrite, &hVfsIosNew); 16480 16413 if (RT_FAILURE(vrc)) 16481 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening file '%s' failed, (%Rrc)"),16414 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening file '%s' failed, (%Rrc)"), 16482 16415 (*it + ".tmp").c_str(), vrc); 16483 16416 } 16484 16417 else 16485 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening file '%s' failed, (%Rrc)"), 16486 (*it).c_str(), vrc); 16418 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Opening file '%s' failed, (%Rrc)"), (*it).c_str(), vrc); 16487 16419 16488 16420 if (RT_SUCCESS(vrc)) … … 16490 16422 vrc = RTVfsUtilPumpIoStreams(hVfsIosOld, hVfsIosNew, BUF_DATA_SIZE); 16491 16423 if (RT_FAILURE(vrc)) 16492 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Changing encryption of the file '%s' failed with %Rrc"),16493 (*it).c_str(), vrc);16424 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Changing encryption of the file '%s' failed with %Rrc"), 16425 (*it).c_str(), vrc); 16494 16426 } 16495 16427 … … 16501 16433 } 16502 16434 16503 if (SUCCEEDED( rc))16435 if (SUCCEEDED(hrc)) 16504 16436 { 16505 16437 for (std::list<com::Utf8Str>::iterator it = lstFiles.begin(); … … 16510 16442 if (RT_FAILURE(vrc)) 16511 16443 { 16512 rc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Renaming the file '%s' failed, (%Rrc)"), 16513 (*it + ".tmp").c_str(), vrc); 16444 hrc = setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Renaming the file '%s' failed, (%Rrc)"), (*it + ".tmp").c_str(), vrc); 16514 16445 break; 16515 16446 } … … 16517 16448 } 16518 16449 16519 if (SUCCEEDED( rc))16450 if (SUCCEEDED(hrc)) 16520 16451 { 16521 16452 strKeyStore = strNewKeyStore; … … 16523 16454 } 16524 16455 16525 return rc;16456 return hrc; 16526 16457 } 16527 16458 … … 16545 16476 /* we might have been uninitialized because the session was accidentally 16546 16477 * closed by the client, so don't assert */ 16547 HRESULT rc = setError(E_FAIL, 16548 tr("The session has been accidentally closed")); 16549 task.m_pProgress->i_notifyComplete(rc); 16478 HRESULT hrc = setError(E_FAIL, tr("The session has been accidentally closed")); 16479 task.m_pProgress->i_notifyComplete(hrc); 16550 16480 LogFlowThisFuncLeave(); 16551 16481 return; … … 16554 16484 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 16555 16485 16556 HRESULT rc = S_OK;16486 HRESULT hrc = S_OK; 16557 16487 com::Utf8Str strOldKeyId = mData->mstrKeyId; 16558 16488 com::Utf8Str strOldKeyStore = mData->mstrKeyStore; 16559 16489 try 16560 16490 { 16561 rc = this->i_getVirtualBox()->i_retainCryptoIf(&task.m_pCryptoIf);16562 if (FAILED( rc))16563 throw rc;16491 hrc = this->i_getVirtualBox()->i_retainCryptoIf(&task.m_pCryptoIf); 16492 if (FAILED(hrc)) 16493 throw hrc; 16564 16494 16565 16495 if (task.mstrCurrentPassword.isEmpty()) … … 16574 16504 throw setError(VBOX_E_INVALID_OBJECT_STATE, 16575 16505 tr("The VM is not configured for encryption")); 16576 rc = checkEncryptionPassword(task.mstrCurrentPassword);16577 if ( rc == VBOX_E_PASSWORD_INCORRECT)16506 hrc = checkEncryptionPassword(task.mstrCurrentPassword); 16507 if (hrc == VBOX_E_PASSWORD_INCORRECT) 16578 16508 throw setError(VBOX_E_PASSWORD_INCORRECT, 16579 16509 tr("The password to decrypt the VM is incorrect")); … … 16667 16597 { 16668 16598 ComPtr<IProgress> pProgress1; 16669 HRESULThrc = (*it)->ChangeEncryption(bstrCurrentPassword.raw(), bstrCipher.raw(),16670 bstrNewPassword.raw(), bstrNewPasswordId.raw(),16671 pProgress1.asOutParam());16599 hrc = (*it)->ChangeEncryption(bstrCurrentPassword.raw(), bstrCipher.raw(), 16600 bstrNewPassword.raw(), bstrNewPasswordId.raw(), 16601 pProgress1.asOutParam()); 16672 16602 if (FAILED(hrc)) throw hrc; 16673 16603 hrc = task.m_pProgress->WaitForOtherProgressCompletion(pProgress1, 0 /* indefinite wait */); … … 16682 16612 16683 16613 /* .sav files (main and snapshots) */ 16684 rc = i_changeEncryptionForComponent(task, strFullSnapshotFolder, "*.sav",16685 mSSData->strStateKeyStore, mSSData->strStateKeyId, CipherModeGcm);16686 if (FAILED( rc))16614 hrc = i_changeEncryptionForComponent(task, strFullSnapshotFolder, "*.sav", 16615 mSSData->strStateKeyStore, mSSData->strStateKeyId, CipherModeGcm); 16616 if (FAILED(hrc)) 16687 16617 /* the helper function already sets error object */ 16688 throw rc;16618 throw hrc; 16689 16619 16690 16620 task.m_pProgress->SetNextOperation(Bstr(tr("Change encryption of the NVRAM files")).raw(), 1); … … 16693 16623 com::Utf8Str strNVRAMKeyId; 16694 16624 com::Utf8Str strNVRAMKeyStore; 16695 rc = mNvramStore->i_getEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore);16696 if (FAILED( rc))16697 throw setError( rc, tr("Getting NVRAM encryption settings failed (%Rhrc)"),rc);16625 hrc = mNvramStore->i_getEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore); 16626 if (FAILED(hrc)) 16627 throw setError(hrc, tr("Getting NVRAM encryption settings failed (%Rhrc)"), hrc); 16698 16628 16699 16629 Utf8Str strMachineFolder; 16700 16630 i_calculateFullPath(".", strMachineFolder); 16701 16631 16702 rc = i_changeEncryptionForComponent(task, strMachineFolder, "*.nvram", 16703 strNVRAMKeyStore, strNVRAMKeyId, CipherModeGcm); 16704 if (FAILED(rc)) 16632 hrc = i_changeEncryptionForComponent(task, strMachineFolder, "*.nvram", strNVRAMKeyStore, strNVRAMKeyId, CipherModeGcm); 16633 if (FAILED(hrc)) 16705 16634 /* the helper function already sets error object */ 16706 throw rc;16707 16708 rc = mNvramStore->i_updateEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore);16709 if (FAILED( rc))16710 throw setError( rc, tr("Setting NVRAM encryption settings failed (%Rhrc)"),rc);16635 throw hrc; 16636 16637 hrc = mNvramStore->i_updateEncryptionSettings(strNVRAMKeyId, strNVRAMKeyStore); 16638 if (FAILED(hrc)) 16639 throw setError(hrc, tr("Setting NVRAM encryption settings failed (%Rhrc)"), hrc); 16711 16640 16712 16641 task.m_pProgress->SetNextOperation(Bstr(tr("Change encryption of log files")).raw(), 1); … … 16715 16644 com::Utf8Str strLogFolder; 16716 16645 i_getLogFolder(strLogFolder); 16717 rc = i_changeEncryptionForComponent(task, strLogFolder, "VBox.log*",16718 mData->mstrLogKeyStore, mData->mstrLogKeyId, CipherModeCtr);16719 if (FAILED( rc))16646 hrc = i_changeEncryptionForComponent(task, strLogFolder, "VBox.log*", 16647 mData->mstrLogKeyStore, mData->mstrLogKeyId, CipherModeCtr); 16648 if (FAILED(hrc)) 16720 16649 /* the helper function already sets error object */ 16721 throw rc;16650 throw hrc; 16722 16651 16723 16652 task.m_pProgress->SetNextOperation(Bstr(tr("Change encryption of the config file")).raw(), 1); … … 16725 16654 i_saveSettings(NULL, alock, fSave); 16726 16655 } 16727 catch (HRESULT aRC)16728 { 16729 rc = aRC;16656 catch (HRESULT hrcXcpt) 16657 { 16658 hrc = hrcXcpt; 16730 16659 mData->mstrKeyId = strOldKeyId; 16731 16660 mData->mstrKeyStore = strOldKeyStore; 16732 16661 } 16733 16662 16734 task.m_pProgress->i_notifyComplete( rc);16663 task.m_pProgress->i_notifyComplete(hrc); 16735 16664 16736 16665 LogFlowThisFuncLeave(); … … 16758 16687 return setError(E_ACCESSDENIED, tr("Machine is inaccessible")); 16759 16688 16760 HRESULT rc = addEncryptionPassword(mData->mstrKeyId, aCurrentPassword);16761 if (FAILED( rc))16762 return rc;16689 HRESULT hrc = addEncryptionPassword(mData->mstrKeyId, aCurrentPassword); 16690 if (FAILED(hrc)) 16691 return hrc; 16763 16692 } 16764 16693 … … 16849 16778 ComObjPtr<Progress> pProgress; 16850 16779 pProgress.createObject(); 16851 HRESULT rc = pProgress->init(i_getVirtualBox(),16852 static_cast<IMachine*>(this) /* aInitiator */,16853 tr("Change encryption"),16854 TRUE /* fCancellable */,16855 (ULONG)(4 + + llMedia.size()), // cOperations16856 tr("Change encryption of the mediuma"));16857 if (FAILED( rc))16858 return rc;16780 HRESULT hrc = pProgress->init(i_getVirtualBox(), 16781 static_cast<IMachine*>(this) /* aInitiator */, 16782 tr("Change encryption"), 16783 TRUE /* fCancellable */, 16784 (ULONG)(4 + + llMedia.size()), // cOperations 16785 tr("Change encryption of the mediuma")); 16786 if (FAILED(hrc)) 16787 return hrc; 16859 16788 16860 16789 /* create and start the task on a separate thread (note that it will not … … 16863 16792 aCurrentPassword, aCipher, aNewPassword, 16864 16793 aNewPasswordId, aForce, llMedia); 16865 rc = pTask->createThread();16794 hrc = pTask->createThread(); 16866 16795 pTask = NULL; 16867 if (FAILED( rc))16868 return rc;16796 if (FAILED(hrc)) 16797 return hrc; 16869 16798 16870 16799 pProgress.queryInterfaceTo(aProgress.asOutParam()); … … 16981 16910 /* get the console from the direct session */ 16982 16911 ComPtr<IConsole> console; 16983 HRESULT rc = mData->mSession.mDirectControl->COMGETTER(RemoteConsole)(console.asOutParam());16984 ComAssertComRC( rc);16912 HRESULT hrc = mData->mSession.mDirectControl->COMGETTER(RemoteConsole)(console.asOutParam()); 16913 ComAssertComRC(hrc); 16985 16914 /* send passsword to console */ 16986 16915 console->AddEncryptionPassword(Bstr(aId).raw(), … … 17053 16982 /* get the console from the direct session */ 17054 16983 ComPtr<IConsole> console; 17055 HRESULT rc = mData->mSession.mDirectControl->COMGETTER(RemoteConsole)(console.asOutParam());17056 ComAssertComRC( rc);16984 HRESULT hrc = mData->mSession.mDirectControl->COMGETTER(RemoteConsole)(console.asOutParam()); 16985 ComAssertComRC(hrc); 17057 16986 /* send passsword to console */ 17058 16987 console->RemoveEncryptionPassword(Bstr(aId).raw()); … … 17114 17043 17115 17044 uninit(); 17116 HRESULT rc = initFromSettings(pParent, strConfigFile, &id, com::Utf8Str());17045 HRESULT hrc = initFromSettings(pParent, strConfigFile, &id, com::Utf8Str()); 17117 17046 17118 17047 alock.acquire(); 17119 17048 mParent->i_onMachineStateChanged(mData->mUuid, mData->mMachineState); 17120 return rc;17049 return hrc; 17121 17050 } 17122 17051 #endif -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r98262 r98288 104 104 AssertReturn(pTask, VERR_INVALID_POINTER); 105 105 106 HRESULT rc = pTask->q_ptr->run();107 108 pTask->pProgress->i_notifyComplete( rc);106 HRESULT hrc = pTask->q_ptr->run(); 107 108 pTask->pProgress->i_notifyComplete(hrc); 109 109 110 110 pTask->q_ptr->destroy(); … … 162 162 RTCList< ComObjPtr<Machine> > &machineList) const 163 163 { 164 HRESULT rc = S_OK;165 164 Bstr name; 166 rc = pSnapshot->COMGETTER(Name)(name.asOutParam());167 if (FAILED( rc)) returnrc;165 HRESULT hrc = pSnapshot->COMGETTER(Name)(name.asOutParam()); 166 if (FAILED(hrc)) return hrc; 168 167 169 168 ComPtr<IMachine> pMachine; 170 rc = pSnapshot->COMGETTER(Machine)(pMachine.asOutParam());171 if (FAILED( rc)) returnrc;169 hrc = pSnapshot->COMGETTER(Machine)(pMachine.asOutParam()); 170 if (FAILED(hrc)) return hrc; 172 171 machineList.append((Machine*)(IMachine*)pMachine); 173 172 174 173 SafeIfaceArray<ISnapshot> sfaChilds; 175 rc = pSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(sfaChilds));176 if (FAILED( rc)) returnrc;174 hrc = pSnapshot->COMGETTER(Children)(ComSafeArrayAsOutParam(sfaChilds)); 175 if (FAILED(hrc)) return hrc; 177 176 for (size_t i = 0; i < sfaChilds.size(); ++i) 178 177 { 179 rc = createMachineList(sfaChilds[i], machineList);180 if (FAILED( rc)) returnrc;181 } 182 183 return rc;178 hrc = createMachineList(sfaChilds[i], machineList); 179 if (FAILED(hrc)) return hrc; 180 } 181 182 return hrc; 184 183 } 185 184 … … 222 221 { 223 222 Bstr bstrSrcSaveStatePath; 224 HRESULT rc = machine->COMGETTER(StateFilePath)(bstrSrcSaveStatePath.asOutParam());225 if (FAILED( rc)) returnrc;223 HRESULT hrc = machine->COMGETTER(StateFilePath)(bstrSrcSaveStatePath.asOutParam()); 224 if (FAILED(hrc)) return hrc; 226 225 if (!bstrSrcSaveStatePath.isEmpty()) 227 226 { … … 255 254 Bstr bstrSrcNVRAMPath; 256 255 ComPtr<INvramStore> pNvramStore; 257 HRESULT rc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());258 if (FAILED( rc)) returnrc;259 rc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());260 if (FAILED( rc)) returnrc;256 HRESULT hrc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam()); 257 if (FAILED(hrc)) return hrc; 258 hrc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam()); 259 if (FAILED(hrc)) return hrc; 261 260 if (!bstrSrcNVRAMPath.isEmpty()) 262 261 { … … 291 290 { 292 291 ComPtr<IMedium> pBaseMedium; 293 HRESULT rc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam());294 if (FAILED( rc)) returnrc;292 HRESULT hrc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam()); 293 if (FAILED(hrc)) return hrc; 295 294 Bstr bstrBaseName; 296 rc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam());297 if (FAILED( rc)) returnrc;295 hrc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam()); 296 if (FAILED(hrc)) return hrc; 298 297 strBaseName = bstrBaseName; 299 return rc;298 return hrc; 300 299 } 301 300 … … 308 307 * take than care to merge any (possibly) existing parents into the new 309 308 * image. */ 310 HRESULT rc = S_OK;309 HRESULT hrc = S_OK; 311 310 for (size_t i = 0; i < machineList.size(); ++i) 312 311 { … … 317 316 /* Add all attachments of the different machines to a worker list. */ 318 317 SafeIfaceArray<IMediumAttachment> sfaAttachments; 319 rc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));320 if (FAILED( rc)) returnrc;318 hrc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments)); 319 if (FAILED(hrc)) return hrc; 321 320 for (size_t a = 0; a < sfaAttachments.size(); ++a) 322 321 { 323 322 const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[a]; 324 323 DeviceType_T type; 325 rc = pAtt->COMGETTER(Type)(&type);326 if (FAILED( rc)) returnrc;324 hrc = pAtt->COMGETTER(Type)(&type); 325 if (FAILED(hrc)) return hrc; 327 326 328 327 /* Only harddisks and floppies are of interest. */ … … 333 332 /* Valid medium attached? */ 334 333 ComPtr<IMedium> pSrcMedium; 335 rc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam());336 if (FAILED( rc)) returnrc;334 hrc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam()); 335 if (FAILED(hrc)) return hrc; 337 336 338 337 if (pSrcMedium.isNull()) … … 348 347 /* Refresh the state so that the file size get read. */ 349 348 MediumState_T e; 350 rc = pSrcMedium->RefreshState(&e);351 if (FAILED( rc)) returnrc;349 hrc = pSrcMedium->RefreshState(&e); 350 if (FAILED(hrc)) return hrc; 352 351 LONG64 lSize; 353 rc = pSrcMedium->COMGETTER(Size)(&lSize);354 if (FAILED( rc)) returnrc;352 hrc = pSrcMedium->COMGETTER(Size)(&lSize); 353 if (FAILED(hrc)) return hrc; 355 354 356 355 MEDIUMTASK mt; … … 358 357 359 358 /* Save the base name. */ 360 rc = queryBaseName(pSrcMedium, mt.strBaseName);361 if (FAILED( rc)) returnrc;359 hrc = queryBaseName(pSrcMedium, mt.strBaseName); 360 if (FAILED(hrc)) return hrc; 362 361 363 362 /* Save the current medium, for later cloning. */ … … 375 374 } 376 375 /* Add the save state file of this machine if there is one. */ 377 rc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);378 if (FAILED( rc)) returnrc;376 hrc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 377 if (FAILED(hrc)) return hrc; 379 378 /* Add the NVRAM file of this machine if there is one. */ 380 rc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);381 if (FAILED( rc)) returnrc;382 } 383 384 return rc;379 hrc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 380 if (FAILED(hrc)) return hrc; 381 } 382 383 return hrc; 385 384 } 386 385 … … 419 418 420 419 Assert(!fAttachLinked); 421 HRESULT rc = S_OK;420 HRESULT hrc = S_OK; 422 421 std::map<ComPtr<IMedium>, uint32_t> mediaHist; /* Our usage histogram for the medias */ 423 422 for (size_t i = 0; i < machineList.size(); ++i) … … 430 429 * machines to a worker list. */ 431 430 SafeIfaceArray<IMediumAttachment> sfaAttachments; 432 rc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));433 if (FAILED( rc)) returnrc;431 hrc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments)); 432 if (FAILED(hrc)) return hrc; 434 433 for (size_t a = 0; a < sfaAttachments.size(); ++a) 435 434 { 436 435 const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[a]; 437 436 DeviceType_T type; 438 rc = pAtt->COMGETTER(Type)(&type);439 if (FAILED( rc)) returnrc;437 hrc = pAtt->COMGETTER(Type)(&type); 438 if (FAILED(hrc)) return hrc; 440 439 441 440 /* Only harddisks and floppies are of interest. */ … … 446 445 /* Valid medium attached? */ 447 446 ComPtr<IMedium> pSrcMedium; 448 rc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam());449 if (FAILED( rc)) returnrc;447 hrc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam()); 448 if (FAILED(hrc)) return hrc; 450 449 451 450 if (pSrcMedium.isNull()) … … 464 463 /* Refresh the state so that the file size get read. */ 465 464 MediumState_T e; 466 rc = pSrcMedium->RefreshState(&e);467 if (FAILED( rc)) returnrc;465 hrc = pSrcMedium->RefreshState(&e); 466 if (FAILED(hrc)) return hrc; 468 467 LONG64 lSize; 469 rc = pSrcMedium->COMGETTER(Size)(&lSize);470 if (FAILED( rc)) returnrc;468 hrc = pSrcMedium->COMGETTER(Size)(&lSize); 469 if (FAILED(hrc)) return hrc; 471 470 472 471 MEDIUMTASK mt; … … 477 476 478 477 /* Query next parent. */ 479 rc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam());480 if (FAILED( rc)) returnrc;478 hrc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam()); 479 if (FAILED(hrc)) return hrc; 481 480 } 482 481 … … 484 483 } 485 484 /* Add the save state file of this machine if there is one. */ 486 rc = addSaveState(machine, false /*fAttachCurrent*/, uCount, uTotalWeight);487 if (FAILED( rc)) returnrc;485 hrc = addSaveState(machine, false /*fAttachCurrent*/, uCount, uTotalWeight); 486 if (FAILED(hrc)) return hrc; 488 487 /* Add the NVRAM file of this machine if there is one. */ 489 rc = addNVRAM(machine, false /*fAttachCurrent*/, uCount, uTotalWeight);490 if (FAILED( rc)) returnrc;488 hrc = addNVRAM(machine, false /*fAttachCurrent*/, uCount, uTotalWeight); 489 if (FAILED(hrc)) return hrc; 491 490 /* If this is the newly created current state, make sure that the 492 491 * saved state and NVRAM is also attached to it. */ 493 492 if (fCreateDiffs) 494 493 { 495 rc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);496 if (FAILED( rc)) returnrc;497 rc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);498 if (FAILED( rc)) returnrc;494 hrc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 495 if (FAILED(hrc)) return hrc; 496 hrc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 497 if (FAILED(hrc)) return hrc; 499 498 } 500 499 } … … 515 514 { 516 515 Bstr bstrSrcName; 517 rc = (*it).first->COMGETTER(Name)(bstrSrcName.asOutParam());518 if (FAILED( rc)) returnrc;516 hrc = (*it).first->COMGETTER(Name)(bstrSrcName.asOutParam()); 517 if (FAILED(hrc)) return hrc; 519 518 RTPrintf("%ls: %d\n", bstrSrcName.raw(), (*it).second); 520 519 } … … 536 535 #ifdef DEBUG_poetzsch 537 536 Bstr bstrSrcName; 538 rc = mt.pMedium->COMGETTER(Name)(bstrSrcName.asOutParam());539 if (FAILED( rc)) returnrc;537 hrc = mt.pMedium->COMGETTER(Name)(bstrSrcName.asOutParam()); 538 if (FAILED(hrc)) return hrc; 540 539 RTPrintf("%ls: %d (%d)\n", bstrSrcName.raw(), hist, used); 541 540 #endif … … 552 551 * if the base is a differencing image in the source VM (with the UUID 553 552 * as name). */ 554 rc = queryBaseName(newChain.last().pMedium, newChain.last().strBaseName);555 if (FAILED( rc)) returnrc;553 hrc = queryBaseName(newChain.last().pMedium, newChain.last().strBaseName); 554 if (FAILED(hrc)) return hrc; 556 555 /* Update the old medium chain with the updated one. */ 557 556 mtc.chain = newChain; … … 560 559 } 561 560 562 return rc;561 return hrc; 563 562 } 564 563 … … 570 569 * list. */ 571 570 Assert(!fAttachLinked); 572 HRESULT rc = S_OK;571 HRESULT hrc = S_OK; 573 572 for (size_t i = 0; i < machineList.size(); ++i) 574 573 { … … 580 579 * machines to a worker list. */ 581 580 SafeIfaceArray<IMediumAttachment> sfaAttachments; 582 rc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments));583 if (FAILED( rc)) returnrc;581 hrc = machine->COMGETTER(MediumAttachments)(ComSafeArrayAsOutParam(sfaAttachments)); 582 if (FAILED(hrc)) return hrc; 584 583 for (size_t a = 0; a < sfaAttachments.size(); ++a) 585 584 { 586 585 const ComPtr<IMediumAttachment> &pAtt = sfaAttachments[a]; 587 586 DeviceType_T type; 588 rc = pAtt->COMGETTER(Type)(&type);589 if (FAILED( rc)) returnrc;587 hrc = pAtt->COMGETTER(Type)(&type); 588 if (FAILED(hrc)) return hrc; 590 589 591 590 /* Only harddisks and floppies are of interest. */ … … 596 595 /* Valid medium attached? */ 597 596 ComPtr<IMedium> pSrcMedium; 598 rc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam());599 if (FAILED( rc)) returnrc;597 hrc = pAtt->COMGETTER(Medium)(pSrcMedium.asOutParam()); 598 if (FAILED(hrc)) return hrc; 600 599 601 600 if (pSrcMedium.isNull()) … … 614 613 /* Refresh the state so that the file size get read. */ 615 614 MediumState_T e; 616 rc = pSrcMedium->RefreshState(&e);617 if (FAILED( rc)) returnrc;615 hrc = pSrcMedium->RefreshState(&e); 616 if (FAILED(hrc)) return hrc; 618 617 LONG64 lSize; 619 rc = pSrcMedium->COMGETTER(Size)(&lSize);620 if (FAILED( rc)) returnrc;618 hrc = pSrcMedium->COMGETTER(Size)(&lSize); 619 if (FAILED(hrc)) return hrc; 621 620 622 621 /* Save the current medium, for later cloning. */ … … 628 627 629 628 /* Query next parent. */ 630 rc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam());631 if (FAILED( rc)) returnrc;629 hrc = pSrcMedium->COMGETTER(Parent)(pSrcMedium.asOutParam()); 630 if (FAILED(hrc)) return hrc; 632 631 } 633 632 /* Update the progress info. */ … … 637 636 } 638 637 /* Add the save state file of this machine if there is one. */ 639 rc = addSaveState(machine, false /*fAttachCurrent*/, uCount, uTotalWeight);640 if (FAILED( rc)) returnrc;638 hrc = addSaveState(machine, false /*fAttachCurrent*/, uCount, uTotalWeight); 639 if (FAILED(hrc)) return hrc; 641 640 /* Add the NVRAM file of this machine if there is one. */ 642 rc = addNVRAM(machine, false /*fAttachCurrent*/, uCount, uTotalWeight);643 if (FAILED( rc)) returnrc;641 hrc = addNVRAM(machine, false /*fAttachCurrent*/, uCount, uTotalWeight); 642 if (FAILED(hrc)) return hrc; 644 643 /* If this is the newly created current state, make sure that the 645 644 * saved state is also attached to it. */ 646 645 if (fCreateDiffs) 647 646 { 648 rc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);649 if (FAILED( rc)) returnrc;650 rc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight);651 if (FAILED( rc)) returnrc;647 hrc = addSaveState(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 648 if (FAILED(hrc)) return hrc; 649 hrc = addNVRAM(machine, true /*fAttachCurrent*/, uCount, uTotalWeight); 650 if (FAILED(hrc)) return hrc; 652 651 } 653 652 } … … 663 662 } 664 663 665 return rc;664 return hrc; 666 665 } 667 666 … … 775 774 ComObjPtr<Medium> *ppDiff) const 776 775 { 777 HRESULT rc = S_OK;776 HRESULT hrc = S_OK; 778 777 try 779 778 { … … 782 781 AutoReadLock alock(pParent COMMA_LOCKVAL_SRC_POS); 783 782 Bstr bstrSrcId; 784 rc = pParent->COMGETTER(Id)(bstrSrcId.asOutParam());785 if (FAILED( rc)) throwrc;783 hrc = pParent->COMGETTER(Id)(bstrSrcId.asOutParam()); 784 if (FAILED(hrc)) throw hrc; 786 785 } 787 786 ComObjPtr<Medium> diff; 788 787 diff.createObject(); 789 rc = diff->init(p->i_getVirtualBox(),790 pParent->i_getPreferredDiffFormat(),791 Utf8StrFmt("%s%c", strSnapshotFolder.c_str(), RTPATH_DELIMITER),792 Guid::Empty /* empty media registry */,793 DeviceType_HardDisk);794 if (FAILED( rc)) throwrc;788 hrc = diff->init(p->i_getVirtualBox(), 789 pParent->i_getPreferredDiffFormat(), 790 Utf8StrFmt("%s%c", strSnapshotFolder.c_str(), RTPATH_DELIMITER), 791 Guid::Empty /* empty media registry */, 792 DeviceType_HardDisk); 793 if (FAILED(hrc)) throw hrc; 795 794 796 795 MediumLockList *pMediumLockList(new MediumLockList()); 797 rc = diff->i_createMediumLockList(true /* fFailIfInaccessible */,798 diff /* pToLockWrite */,799 false /* fMediumLockWriteAll */,800 pParent,801 *pMediumLockList);802 if (FAILED( rc)) throwrc;803 rc = pMediumLockList->Lock();804 if (FAILED( rc)) throwrc;796 hrc = diff->i_createMediumLockList(true /* fFailIfInaccessible */, 797 diff /* pToLockWrite */, 798 false /* fMediumLockWriteAll */, 799 pParent, 800 *pMediumLockList); 801 if (FAILED(hrc)) throw hrc; 802 hrc = pMediumLockList->Lock(); 803 if (FAILED(hrc)) throw hrc; 805 804 806 805 /* this already registers the new diff image */ 807 rc = pParent->i_createDiffStorage(diff,808 pParent->i_getPreferredDiffVariant(),809 pMediumLockList,810 NULL /* aProgress */,811 true /* aWait */,812 false /* aNotify */);806 hrc = pParent->i_createDiffStorage(diff, 807 pParent->i_getPreferredDiffVariant(), 808 pMediumLockList, 809 NULL /* aProgress */, 810 true /* aWait */, 811 false /* aNotify */); 813 812 delete pMediumLockList; 814 if (FAILED( rc)) throwrc;813 if (FAILED(hrc)) throw hrc; 815 814 /* Remember created medium. */ 816 815 newMedia.append(diff); 817 816 *ppDiff = diff; 818 817 } 819 catch (HRESULT rc 2)820 { 821 rc = rc2;818 catch (HRESULT rcXcpt) 819 { 820 hrc = rcXcpt; 822 821 } 823 822 catch (...) 824 823 { 825 rc = VirtualBoxBase::handleUnexpectedExceptions(pMachine, RT_SRC_POS);826 } 827 828 return rc;824 hrc = VirtualBoxBase::handleUnexpectedExceptions(pMachine, RT_SRC_POS); 825 } 826 827 return hrc; 829 828 } 830 829 … … 835 834 836 835 BOOL fCanceled = false; 837 HRESULT rc = pProgress->COMGETTER(Canceled)(&fCanceled);838 if (FAILED( rc)) return VERR_GENERAL_FAILURE;836 HRESULT hrc = pProgress->COMGETTER(Canceled)(&fCanceled); 837 if (FAILED(hrc)) return VERR_GENERAL_FAILURE; 839 838 /* If canceled by the user tell it to the copy operation. */ 840 839 if (fCanceled) return VERR_CANCELLED; 841 840 /* Set the new process. */ 842 rc = pProgress->SetCurrentOperationProgress(uPercentage);843 if (FAILED( rc)) return VERR_GENERAL_FAILURE;841 hrc = pProgress->SetCurrentOperationProgress(uPercentage); 842 if (FAILED(hrc)) return VERR_GENERAL_FAILURE; 844 843 845 844 return VINF_SUCCESS; … … 877 876 ComObjPtr<Machine> &p = d->p; 878 877 879 HRESULT rc;878 HRESULT hrc; 880 879 try 881 880 { … … 893 892 { 894 893 Bstr bstrSrcMachineId; 895 rc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam());896 if (FAILED( rc)) throwrc;894 hrc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam()); 895 if (FAILED(hrc)) throw hrc; 897 896 ComPtr<IMachine> newSrcMachine; 898 rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam());899 if (FAILED( rc)) throwrc;897 hrc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), newSrcMachine.asOutParam()); 898 if (FAILED(hrc)) throw hrc; 900 899 d->pSrcMachine = (Machine*)(IMachine*)newSrcMachine; 901 900 } … … 908 907 /* find machine object for current snapshot of current state */ 909 908 Bstr bstrSrcMachineId; 910 rc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam());911 if (FAILED( rc)) throwrc;909 hrc = d->pSrcMachine->COMGETTER(Id)(bstrSrcMachineId.asOutParam()); 910 if (FAILED(hrc)) throw hrc; 912 911 ComPtr<IMachine> pCurr; 913 rc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam());914 if (FAILED( rc)) throwrc;912 hrc = d->pSrcMachine->i_getVirtualBox()->FindMachine(bstrSrcMachineId.raw(), pCurr.asOutParam()); 913 if (FAILED(hrc)) throw hrc; 915 914 if (pCurr.isNull()) 916 915 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); 917 916 pCurrState = (Machine *)(IMachine *)pCurr; 918 917 ComPtr<ISnapshot> pSnapshot; 919 rc = pCurrState->COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam());920 if (FAILED( rc)) throwrc;918 hrc = pCurrState->COMGETTER(CurrentSnapshot)(pSnapshot.asOutParam()); 919 if (FAILED(hrc)) throw hrc; 921 920 if (pSnapshot.isNull()) 922 921 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); 923 922 ComPtr<IMachine> pCurrSnapMachine; 924 rc = pSnapshot->COMGETTER(Machine)(pCurrSnapMachine.asOutParam());925 if (FAILED( rc)) throwrc;923 hrc = pSnapshot->COMGETTER(Machine)(pCurrSnapMachine.asOutParam()); 924 if (FAILED(hrc)) throw hrc; 926 925 if (pCurrSnapMachine.isNull()) 927 926 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); … … 932 931 { 933 932 ComPtr<IMachine> pSnapMachine; 934 rc = pSnapshot->COMGETTER(Machine)(pSnapMachine.asOutParam());935 if (FAILED( rc)) throwrc;933 hrc = pSnapshot->COMGETTER(Machine)(pSnapMachine.asOutParam()); 934 if (FAILED(hrc)) throw hrc; 936 935 if (pSnapMachine.isNull()) 937 936 throw p->setError(VBOX_E_OBJECT_NOT_FOUND); … … 941 940 break; 942 941 } 943 rc = pSnapshot->COMGETTER(Parent)(pSnapshot.asOutParam());944 if (FAILED( rc)) throwrc;942 hrc = pSnapshot->COMGETTER(Parent)(pSnapshot.asOutParam()); 943 if (FAILED(hrc)) throw hrc; 945 944 } 946 945 } … … 972 971 { 973 972 ULONG cSnapshots = 0; 974 rc = d->pSrcMachine->COMGETTER(SnapshotCount)(&cSnapshots);975 if (FAILED( rc)) throwrc;973 hrc = d->pSrcMachine->COMGETTER(SnapshotCount)(&cSnapshots); 974 if (FAILED(hrc)) throw hrc; 976 975 if (cSnapshots > 0) 977 976 { … … 980 979 id = d->snapshotId.toString(); 981 980 ComPtr<ISnapshot> pSnapshot; 982 rc = d->pSrcMachine->FindSnapshot(Bstr(id).raw(), pSnapshot.asOutParam());983 if (FAILED( rc)) throwrc;984 rc = d->createMachineList(pSnapshot, machineList);985 if (FAILED( rc)) throwrc;981 hrc = d->pSrcMachine->FindSnapshot(Bstr(id).raw(), pSnapshot.asOutParam()); 982 if (FAILED(hrc)) throw hrc; 983 hrc = d->createMachineList(pSnapshot, machineList); 984 if (FAILED(hrc)) throw hrc; 986 985 if (d->mode == CloneMode_MachineAndChildStates) 987 986 { … … 994 993 else 995 994 { 996 rc = pSnapshot->COMGETTER(Machine)(d->pOldMachineState.asOutParam());997 if (FAILED( rc)) throwrc;995 hrc = pSnapshot->COMGETTER(Machine)(d->pOldMachineState.asOutParam()); 996 if (FAILED(hrc)) throw hrc; 998 997 } 999 998 } … … 1043 1042 1044 1043 /* Now create the progress project, so the user knows whats going on. */ 1045 rc = d->pProgress.createObject();1046 if (FAILED( rc)) throwrc;1047 rc = d->pProgress->init(p->i_getVirtualBox(),1048 static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */,1049 Bstr(tr("Cloning Machine")).raw(),1050 true /* fCancellable */,1051 uCount,1052 uTotalWeight,1053 Bstr(tr("Initialize Cloning")).raw(),1054 1);1055 if (FAILED( rc)) throwrc;1044 hrc = d->pProgress.createObject(); 1045 if (FAILED(hrc)) throw hrc; 1046 hrc = d->pProgress->init(p->i_getVirtualBox(), 1047 static_cast<IMachine*>(d->pSrcMachine) /* aInitiator */, 1048 Bstr(tr("Cloning Machine")).raw(), 1049 true /* fCancellable */, 1050 uCount, 1051 uTotalWeight, 1052 Bstr(tr("Initialize Cloning")).raw(), 1053 1); 1054 if (FAILED(hrc)) throw hrc; 1056 1055 1057 1056 int vrc = d->startWorker(); … … 1060 1059 p->setErrorBoth(VBOX_E_IPRT_ERROR, vrc, tr("Could not create machine clone thread (%Rrc)"), vrc); 1061 1060 } 1062 catch (HRESULT rc2)1063 { 1064 rc = rc2;1065 } 1066 1067 if (SUCCEEDED( rc))1061 catch (HRESULT hrcXcpt) 1062 { 1063 hrc = hrcXcpt; 1064 } 1065 1066 if (SUCCEEDED(hrc)) 1068 1067 d->pProgress.queryInterfaceTo(pProgress); 1069 1068 1070 return rc;1069 return hrc; 1071 1070 } 1072 1071 … … 1082 1081 AutoWriteLock trgLock(d->pTrgMachine COMMA_LOCKVAL_SRC_POS); 1083 1082 1084 HRESULT rc = S_OK;1083 HRESULT hrc = S_OK; 1085 1084 1086 1085 /* … … 1174 1173 1175 1174 Bstr bstrSrcSnapshotFolder; 1176 rc = d->pSrcMachine->COMGETTER(SnapshotFolder)(bstrSrcSnapshotFolder.asOutParam());1177 if (FAILED( rc)) throwrc;1175 hrc = d->pSrcMachine->COMGETTER(SnapshotFolder)(bstrSrcSnapshotFolder.asOutParam()); 1176 if (FAILED(hrc)) throw hrc; 1178 1177 /* The absolute name of the snapshot folder. */ 1179 strTrgSnapshotFolder = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER,1180 trgMCF.machineUserData.strSnapshotFolder.c_str());1178 strTrgSnapshotFolder.printf("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, 1179 trgMCF.machineUserData.strSnapshotFolder.c_str()); 1181 1180 1182 1181 /* Should we rename the disk names. */ … … 1203 1202 1204 1203 Bstr bstrSrcName; 1205 rc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam()); 1206 if (FAILED(rc)) throw rc; 1207 1208 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), 1209 mt.uWeight); 1210 if (FAILED(rc)) throw rc; 1204 hrc = pMedium->COMGETTER(Name)(bstrSrcName.asOutParam()); 1205 if (FAILED(hrc)) throw hrc; 1206 1207 hrc = d->pProgress->SetNextOperation(BstrFmt(tr("Cloning Disk '%ls' ..."), bstrSrcName.raw()).raw(), mt.uWeight); 1208 if (FAILED(hrc)) throw hrc; 1211 1209 1212 1210 Bstr bstrSrcId; 1213 rc = pMedium->COMGETTER(Id)(bstrSrcId.asOutParam());1214 if (FAILED( rc)) throwrc;1211 hrc = pMedium->COMGETTER(Id)(bstrSrcId.asOutParam()); 1212 if (FAILED(hrc)) throw hrc; 1215 1213 1216 1214 if (mtc.fAttachLinked) … … 1227 1225 trgLock.release(); 1228 1226 srcLock.release(); 1229 rc = d->createDifferencingMedium(p, pLMedium, strTrgSnapshotFolder,1227 hrc = d->createDifferencingMedium(p, pLMedium, strTrgSnapshotFolder, 1230 1228 newMedia, &pDiff); 1231 1229 srcLock.acquire(); 1232 1230 trgLock.acquire(); 1233 if (FAILED( rc)) throwrc;1231 if (FAILED(hrc)) throw hrc; 1234 1232 map.insert(TStrMediumPair(Utf8Str(bstrSrcId), pDiff)); 1235 1233 /* diff image has to be used... */ … … 1256 1254 { 1257 1255 ComPtr<IMediumFormat> pSrcFormat; 1258 rc = pMedium->COMGETTER(MediumFormat)(pSrcFormat.asOutParam());1256 hrc = pMedium->COMGETTER(MediumFormat)(pSrcFormat.asOutParam()); 1259 1257 ULONG uSrcCaps = 0; 1260 1258 com::SafeArray <MediumFormatCapabilities_T> mediumFormatCap; 1261 rc = pSrcFormat->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap));1262 1263 if (FAILED( rc)) throwrc;1259 hrc = pSrcFormat->COMGETTER(Capabilities)(ComSafeArrayAsOutParam(mediumFormatCap)); 1260 1261 if (FAILED(hrc)) throw hrc; 1264 1262 else 1265 1263 { … … 1285 1283 /* Yes, just use the source format. Otherwise the defaults 1286 1284 * will be used. */ 1287 rc = pMedium->COMGETTER(Format)(bstrSrcFormat.asOutParam());1288 if (FAILED( rc)) throwrc;1289 1290 rc = pMedium->COMGETTER(Variant)(ComSafeArrayAsOutParam(mediumVariant));1291 if (FAILED( rc)) throwrc;1285 hrc = pMedium->COMGETTER(Format)(bstrSrcFormat.asOutParam()); 1286 if (FAILED(hrc)) throw hrc; 1287 1288 hrc = pMedium->COMGETTER(Variant)(ComSafeArrayAsOutParam(mediumVariant)); 1289 if (FAILED(hrc)) throw hrc; 1292 1290 else 1293 1291 { … … 1336 1334 Bstr bstrSrcPath; 1337 1335 Utf8Str strFile = Utf8StrFmt("%s%c%s", strTrgMachineFolder.c_str(), RTPATH_DELIMITER, strNewName.c_str()); 1338 rc = pMedium->COMGETTER(Location)(bstrSrcPath.asOutParam());1339 if (FAILED( rc)) throwrc;1336 hrc = pMedium->COMGETTER(Location)(bstrSrcPath.asOutParam()); 1337 if (FAILED(hrc)) throw hrc; 1340 1338 if ( !bstrSrcPath.isEmpty() 1341 1339 && RTPathStartsWith(Utf8Str(bstrSrcPath).c_str(), Utf8Str(bstrSrcSnapshotFolder).c_str()) … … 1345 1343 /* Start creating the clone. */ 1346 1344 ComObjPtr<Medium> pTarget; 1347 rc = pTarget.createObject(); 1348 if (FAILED(rc)) throw rc; 1349 1350 rc = pTarget->init(p->mParent, 1351 Utf8Str(bstrSrcFormat), 1352 strFile, 1353 Guid::Empty /* empty media registry */, 1354 mtc.devType); 1355 if (FAILED(rc)) throw rc; 1345 hrc = pTarget.createObject(); 1346 if (FAILED(hrc)) throw hrc; 1347 1348 hrc = pTarget->init(p->mParent, Utf8Str(bstrSrcFormat), strFile, 1349 Guid::Empty /* empty media registry */, mtc.devType); 1350 if (FAILED(hrc)) throw hrc; 1356 1351 1357 1352 /* Update the new uuid. */ … … 1363 1358 ComObjPtr<Medium> pLMedium = static_cast<Medium*>((IMedium*)pMedium); 1364 1359 srcLock.release(); 1365 rc = pLMedium->i_cloneToEx(pTarget,1366 (MediumVariant_T)srcVar,1367 pNewParent,1368 progress2.asOutParam(),1369 uSrcParentIdx,1370 uTrgParentIdx,1371 false /* aNotify */);1360 hrc = pLMedium->i_cloneToEx(pTarget, 1361 (MediumVariant_T)srcVar, 1362 pNewParent, 1363 progress2.asOutParam(), 1364 uSrcParentIdx, 1365 uTrgParentIdx, 1366 false /* aNotify */); 1372 1367 srcLock.acquire(); 1373 if (FAILED( rc)) throwrc;1368 if (FAILED(hrc)) throw hrc; 1374 1369 1375 1370 /* Wait until the async process has finished. */ 1376 1371 srcLock.release(); 1377 rc = d->pProgress->WaitForOtherProgressCompletion(progress2, 0 /* indefinite wait */);1372 hrc = d->pProgress->WaitForOtherProgressCompletion(progress2, 0 /* indefinite wait */); 1378 1373 srcLock.acquire(); 1379 if (FAILED( rc)) throwrc;1374 if (FAILED(hrc)) throw hrc; 1380 1375 1381 1376 /* Remember created medium. */ … … 1384 1379 * new medium. */ 1385 1380 MediumType_T type; 1386 rc = pMedium->COMGETTER(Type)(&type);1387 if (FAILED( rc)) throwrc;1381 hrc = pMedium->COMGETTER(Type)(&type); 1382 if (FAILED(hrc)) throw hrc; 1388 1383 trgLock.release(); 1389 1384 srcLock.release(); 1390 rc = pTarget->COMSETTER(Type)(type);1385 hrc = pTarget->COMSETTER(Type)(type); 1391 1386 srcLock.acquire(); 1392 1387 trgLock.acquire(); 1393 if (FAILED( rc)) throwrc;1388 if (FAILED(hrc)) throw hrc; 1394 1389 map.insert(TStrMediumPair(Utf8Str(bstrSrcId), pTarget)); 1395 1390 /* register the new medium */ 1396 1391 { 1397 1392 AutoWriteLock tlock(p->mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1398 rc = p->mParent->i_registerMedium(pTarget, &pTarget, 1399 tlock); 1400 if (FAILED(rc)) throw rc; 1393 hrc = p->mParent->i_registerMedium(pTarget, &pTarget, tlock); 1394 if (FAILED(hrc)) throw hrc; 1401 1395 } 1402 1396 /* This medium becomes the parent of the next medium in the … … 1414 1408 1415 1409 Bstr bstrSrcId; 1416 rc = mtc.chain.first().pMedium->COMGETTER(Id)(bstrSrcId.asOutParam());1417 if (FAILED( rc)) throwrc;1410 hrc = mtc.chain.first().pMedium->COMGETTER(Id)(bstrSrcId.asOutParam()); 1411 if (FAILED(hrc)) throw hrc; 1418 1412 Bstr bstrTrgId; 1419 rc = pNewParent->COMGETTER(Id)(bstrTrgId.asOutParam());1420 if (FAILED( rc)) throwrc;1413 hrc = pNewParent->COMGETTER(Id)(bstrTrgId.asOutParam()); 1414 if (FAILED(hrc)) throw hrc; 1421 1415 /* update snapshot configuration */ 1422 1416 d->updateSnapshotStorageLists(trgMCF.llFirstSnapshot, bstrSrcId, bstrTrgId); … … 1435 1429 trgLock.release(); 1436 1430 srcLock.release(); 1437 rc = d->createDifferencingMedium(p, pNewParent, strTrgSnapshotFolder, 1438 newMedia, &pDiff); 1431 hrc = d->createDifferencingMedium(p, pNewParent, strTrgSnapshotFolder, newMedia, &pDiff); 1439 1432 srcLock.acquire(); 1440 1433 trgLock.acquire(); 1441 if (FAILED( rc)) throwrc;1434 if (FAILED(hrc)) throw hrc; 1442 1435 /* diff image has to be used... */ 1443 1436 pNewParent = pDiff; … … 1452 1445 } 1453 1446 1454 rc = pNewParent->COMGETTER(Id)(bstrTrgId.asOutParam());1455 if (FAILED( rc)) throwrc;1447 hrc = pNewParent->COMGETTER(Id)(bstrTrgId.asOutParam()); 1448 if (FAILED(hrc)) throw hrc; 1456 1449 } 1457 1450 /* update 'Current State' configuration */ … … 1511 1504 1512 1505 /* Move to next sub-operation. */ 1513 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy save state file '%s' ..."),1514 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight);1515 if (FAILED( rc)) throwrc;1506 hrc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy save state file '%s' ..."), 1507 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight); 1508 if (FAILED(hrc)) throw hrc; 1516 1509 /* Copy the file only if it was not copied already. */ 1517 1510 if (!newFiles.contains(strTrgSaveState.c_str())) … … 1546 1539 1547 1540 /* Move to next sub-operation. */ 1548 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy NVRAM file '%s' ..."),1549 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight);1550 if (FAILED( rc)) throwrc;1541 hrc = d->pProgress->SetNextOperation(BstrFmt(tr("Copy NVRAM file '%s' ..."), 1542 RTPathFilename(fct.strFile.c_str())).raw(), fct.uWeight); 1543 if (FAILED(hrc)) throw hrc; 1551 1544 /* Copy the file only if it was not copied already. */ 1552 1545 if (!newFiles.contains(strTrgNVRAM.c_str())) 1553 1546 { 1554 rc = p->i_getVirtualBox()->i_ensureFilePathExists(strTrgNVRAM.c_str(), true);1555 if (FAILED( rc)) throwrc;1547 hrc = p->i_getVirtualBox()->i_ensureFilePathExists(strTrgNVRAM.c_str(), true); 1548 if (FAILED(hrc)) throw hrc; 1556 1549 int vrc = RTFileCopyEx(fct.strFile.c_str(), strTrgNVRAM.c_str(), 0, 1557 1550 MachineCloneVMPrivate::copyFileProgress, &d->pProgress); … … 1571 1564 1572 1565 { 1573 rc = d->pProgress->SetNextOperation(BstrFmt(tr("Create Machine Clone '%s' ..."),1574 trgMCF.machineUserData.strName.c_str()).raw(), 1);1575 if (FAILED( rc)) throwrc;1566 hrc = d->pProgress->SetNextOperation(BstrFmt(tr("Create Machine Clone '%s' ..."), 1567 trgMCF.machineUserData.strName.c_str()).raw(), 1); 1568 if (FAILED(hrc)) throw hrc; 1576 1569 /* After modifying the new machine config, we can copy the stuff 1577 1570 * over to the new machine. The machine have to be mutable for 1578 1571 * this. */ 1579 rc = d->pTrgMachine->i_checkStateDependency(p->MutableStateDep);1580 if (FAILED( rc)) throwrc;1581 rc = d->pTrgMachine->i_loadMachineDataFromSettings(trgMCF, &d->pTrgMachine->mData->mUuid);1582 if (FAILED( rc)) throwrc;1572 hrc = d->pTrgMachine->i_checkStateDependency(p->MutableStateDep); 1573 if (FAILED(hrc)) throw hrc; 1574 hrc = d->pTrgMachine->i_loadMachineDataFromSettings(trgMCF, &d->pTrgMachine->mData->mUuid); 1575 if (FAILED(hrc)) throw hrc; 1583 1576 1584 1577 /* Fix up the "current state modified" flag to what it should be, … … 1610 1603 /* save all VM data */ 1611 1604 bool fNeedsGlobalSaveSettings = false; 1612 rc = d->pTrgMachine->i_saveSettings(&fNeedsGlobalSaveSettings, trgLock, Machine::SaveS_Force);1613 if (FAILED( rc)) throwrc;1605 hrc = d->pTrgMachine->i_saveSettings(&fNeedsGlobalSaveSettings, trgLock, Machine::SaveS_Force); 1606 if (FAILED(hrc)) throw hrc; 1614 1607 /* Release all locks */ 1615 1608 trgLock.release(); … … 1620 1613 * VirtualBox lock */ 1621 1614 AutoWriteLock vlock(p->mParent COMMA_LOCKVAL_SRC_POS); 1622 rc = p->mParent->i_saveSettings();1623 if (FAILED( rc)) throwrc;1615 hrc = p->mParent->i_saveSettings(); 1616 if (FAILED(hrc)) throw hrc; 1624 1617 } 1625 1618 } … … 1628 1621 p->mParent->i_saveModifiedRegistries(); 1629 1622 } 1630 catch (HRESULT rc2)1623 catch (HRESULT hrcXctp) 1631 1624 { 1632 1625 /* Error handling code only works correctly without locks held. */ 1633 1626 trgLock.release(); 1634 1627 srcLock.release(); 1635 rc = rc2;1628 hrc = hrcXctp; 1636 1629 } 1637 1630 catch (...) 1638 1631 { 1639 rc = VirtualBoxBase::handleUnexpectedExceptions(p, RT_SRC_POS);1640 } 1641 1642 MultiResult mrc( rc);1632 hrc = VirtualBoxBase::handleUnexpectedExceptions(p, RT_SRC_POS); 1633 } 1634 1635 MultiResult mrc(hrc); 1643 1636 /* Cleanup on failure (CANCEL also) */ 1644 if (FAILED( rc))1637 if (FAILED(hrc)) 1645 1638 { 1646 1639 int vrc = VINF_SUCCESS; -
trunk/src/VBox/Main/src-server/darwin/HostDnsServiceDarwin.cpp
r98103 r98288 90 90 return E_OUTOFMEMORY; 91 91 92 int rc = RTSemEventCreate(&m->m_evtStop);93 AssertRCReturn( rc, E_FAIL);92 int vrc = RTSemEventCreate(&m->m_evtStop); 93 AssertRCReturn(vrc, E_FAIL); 94 94 95 95 CFRunLoopSourceContext sctx; … … 158 158 159 159 /* Trigger initial update. */ 160 int rc = updateInfo();161 AssertRC( rc); /* Not fatal in release builds. */ /** @todo r=bird: The function always returns VINF_SUCCESS. */160 int vrc = updateInfo(); 161 AssertRC(vrc); /* Not fatal in release builds. */ /** @todo r=bird: The function always returns VINF_SUCCESS. */ 162 162 163 163 while (!ASMAtomicReadBool(&m->m_fStop)) -
trunk/src/VBox/Main/src-server/darwin/HostPowerDarwin.cpp
r98103 r98288 47 47 { 48 48 /* Create the new worker thread. */ 49 int rc = RTThreadCreate(&mThread, HostPowerServiceDarwin::powerChangeNotificationThread, this, 65536, 50 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "MainPower"); 51 52 if (RT_FAILURE(rc)) 53 LogFlow(("RTThreadCreate failed with %Rrc\n", rc)); 49 int vrc = RTThreadCreate(&mThread, HostPowerServiceDarwin::powerChangeNotificationThread, this, 65536, 50 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "MainPower"); 51 AssertLogRelRC(vrc); 54 52 } 55 53 -
trunk/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
r98103 r98288 74 74 } 75 75 struct ifaddrs *IfAddrs, *pAddr; 76 int rc = getifaddrs(&IfAddrs);77 if ( rc)76 int iRc = getifaddrs(&IfAddrs); 77 if (iRc) 78 78 { 79 79 close(sock); 80 Log(("NetIfList: getifaddrs() -> %d\n", rc));80 Log(("NetIfList: getifaddrs() -> %d\n", iRc)); 81 81 return VERR_INTERNAL_ERROR; 82 82 } … … 253 253 Log(("getDefaultIfaceIndex: Got message %u while expecting %u.\n", 254 254 pRtMsg->rtm_type, RTM_GET)); 255 // rc = VERR_INTERNAL_ERROR;255 //vrc = VERR_INTERNAL_ERROR; 256 256 continue; 257 257 } … … 286 286 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 287 287 { 288 int rc = VINF_SUCCESS;288 int vrc = VINF_SUCCESS; 289 289 size_t cbNeeded; 290 290 char *pBuf, *pNext; … … 293 293 294 294 /* Get the index of the interface associated with default route. */ 295 rc = getDefaultIfaceIndex(&u16DefaultIface);296 if (RT_FAILURE( rc))297 return rc;295 vrc = getDefaultIfaceIndex(&u16DefaultIface); 296 if (RT_FAILURE(vrc)) 297 return vrc; 298 298 299 299 aiMib[0] = CTL_NET; … … 338 338 Log(("NetIfList: Got message %u while expecting %u.\n", 339 339 pIfMsg->ifm_type, RTM_IFINFO)); 340 rc = VERR_INTERNAL_ERROR;340 vrc = VERR_INTERNAL_ERROR; 341 341 break; 342 342 } … … 355 355 if (!pNew) 356 356 { 357 rc = VERR_NO_MEMORY;357 vrc = VERR_NO_MEMORY; 358 358 break; 359 359 } … … 439 439 close(sock); 440 440 RTMemFree(pBuf); 441 return rc;441 return vrc; 442 442 } 443 443 444 444 int NetIfGetConfigByName(PNETIFINFO pInfo) 445 445 { 446 int rc = VINF_SUCCESS;446 int vrc = VINF_SUCCESS; 447 447 size_t cbNeeded; 448 448 char *pBuf, *pNext; … … 487 487 Log(("NetIfList: Got message %u while expecting %u.\n", 488 488 pIfMsg->ifm_type, RTM_IFINFO)); 489 rc = VERR_INTERNAL_ERROR;489 vrc = VERR_INTERNAL_ERROR; 490 490 break; 491 491 } … … 539 539 close(sock); 540 540 RTMemFree(pBuf); 541 return rc;541 return vrc; 542 542 } 543 543 -
trunk/src/VBox/Main/src-server/darwin/PerformanceDarwin.cpp
r98103 r98288 88 88 { 89 89 uint64_t cb; 90 int rc = RTSystemQueryTotalRam(&cb);91 if (RT_FAILURE( rc))90 int vrc = RTSystemQueryTotalRam(&cb); 91 if (RT_FAILURE(vrc)) 92 92 totalRAM = 0; 93 93 else … … 128 128 AssertReturn(totalRAM, VERR_INTERNAL_ERROR); 129 129 uint64_t cb; 130 int rc = RTSystemQueryAvailableRam(&cb);131 if (RT_SUCCESS( rc))130 int vrc = RTSystemQueryAvailableRam(&cb); 131 if (RT_SUCCESS(vrc)) 132 132 { 133 133 *total = totalRAM; … … 136 136 *used = *total - *available; 137 137 } 138 return rc;138 return vrc; 139 139 } 140 140 … … 161 161 struct proc_taskinfo tinfo; 162 162 163 int rc = getProcessInfo(process, &tinfo);164 if (RT_SUCCESS( rc))163 int vrc = getProcessInfo(process, &tinfo); 164 if (RT_SUCCESS(vrc)) 165 165 { 166 166 /* … … 172 172 *total = mach_absolute_time(); 173 173 } 174 return rc;174 return vrc; 175 175 } 176 176 … … 179 179 struct proc_taskinfo tinfo; 180 180 181 int rc = getProcessInfo(process, &tinfo);182 if (RT_SUCCESS( rc))181 int vrc = getProcessInfo(process, &tinfo); 182 if (RT_SUCCESS(vrc)) 183 183 { 184 184 uint64_t cKbResident = tinfo.pti_resident_size / 1024; 185 185 *used = cKbResident < ~(ULONG)0 ? (ULONG)cKbResident : ~(ULONG)0; 186 186 } 187 return rc;187 return vrc; 188 188 } 189 189 -
trunk/src/VBox/Main/src-server/darwin/iokit.cpp
r98287 r98288 836 836 */ 837 837 io_iterator_t USBDevices = IO_OBJECT_NULL; 838 IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &USBDevices);839 AssertMsgReturn( rc == kIOReturnSuccess, ("rc=%d\n",rc), KERN_FAILURE);838 IOReturn irc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &USBDevices); 839 AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), KERN_FAILURE); 840 840 RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ 841 841 … … 1087 1087 */ 1088 1088 io_iterator_t USBDevices = IO_OBJECT_NULL; 1089 IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &USBDevices);1090 AssertMsgReturn( rc == kIOReturnSuccess, ("rc=%d\n",rc), NULL);1089 IOReturn irc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &USBDevices); 1090 AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), NULL); 1091 1091 RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ 1092 1092 … … 1188 1188 SInt32 Score = 0; 1189 1189 IOCFPlugInInterface **ppPlugInInterface = NULL; 1190 rc = IOCreatePlugInInterfaceForService(USBDevice, kIOUSBDeviceUserClientTypeID,1191 kIOCFPlugInInterfaceID, &ppPlugInInterface, &Score);1192 if ( rc == kIOReturnSuccess)1190 irc = IOCreatePlugInInterfaceForService(USBDevice, kIOUSBDeviceUserClientTypeID, 1191 kIOCFPlugInInterfaceID, &ppPlugInInterface, &Score); 1192 if (irc == kIOReturnSuccess) 1193 1193 { 1194 1194 IOUSBDeviceInterface245 **ppUSBDevI = NULL; … … 1196 1196 CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID245), 1197 1197 (LPVOID *)&ppUSBDevI); 1198 rc = IODestroyPlugInInterface(ppPlugInInterface); Assert(rc == kIOReturnSuccess);1198 irc = IODestroyPlugInInterface(ppPlugInInterface); Assert(irc == kIOReturnSuccess); 1199 1199 ppPlugInInterface = NULL; 1200 1200 if (hrc == S_OK) … … 1316 1316 */ 1317 1317 io_iterator_t DVDServices = IO_OBJECT_NULL; 1318 IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &DVDServices);1319 AssertMsgReturn( rc == kIOReturnSuccess, ("rc=%d\n",rc), NULL);1318 IOReturn irc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &DVDServices); 1319 AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), NULL); 1320 1320 RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ 1321 1321 … … 1447 1447 */ 1448 1448 io_iterator_t MediaServices = IO_OBJECT_NULL; 1449 IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &MediaServices);1450 AssertMsgReturn( rc == kIOReturnSuccess, ("rc=%d\n",rc), NULL);1449 IOReturn irc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &MediaServices); 1450 AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), NULL); 1451 1451 RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ 1452 1452 … … 1612 1612 */ 1613 1613 io_iterator_t EtherIfServices = IO_OBJECT_NULL; 1614 IOReturn rc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &EtherIfServices);1615 AssertMsgReturn( rc == kIOReturnSuccess, ("rc=%d\n",rc), NULL);1614 IOReturn irc = IOServiceGetMatchingServices(g_MasterPort, RefMatchingDict, &EtherIfServices); 1615 AssertMsgReturn(irc == kIOReturnSuccess, ("irc=%d\n", irc), NULL); 1616 1616 RefMatchingDict = NULL; /* the reference is consumed by IOServiceGetMatchingServices. */ 1617 1617 -
trunk/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp
r98103 r98288 126 126 { 127 127 LogFlowThisFunc(("entered\n")); 128 int rc;128 int vrc; 129 129 try 130 130 { … … 133 133 * environment variable. */ 134 134 bool fSuccess = false; /* Have we succeeded in finding anything yet? */ 135 rc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess);136 if (RT_SUCCESS( rc) && !fSuccess)137 rc = getDriveInfoFromCAM(&mDVDList, DVD, &fSuccess);135 vrc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess); 136 if (RT_SUCCESS(vrc) && !fSuccess) 137 vrc = getDriveInfoFromCAM(&mDVDList, DVD, &fSuccess); 138 138 } 139 139 catch (std::bad_alloc &) 140 140 { 141 rc = VERR_NO_MEMORY;142 } 143 LogFlowThisFunc((" rc=%Rrc\n",rc));144 return rc;141 vrc = VERR_NO_MEMORY; 142 } 143 LogFlowThisFunc(("vrc=%Rrc\n", vrc)); 144 return vrc; 145 145 } 146 146 … … 148 148 { 149 149 LogFlowThisFunc(("entered\n")); 150 int rc;150 int vrc; 151 151 try 152 152 { … … 154 154 mFloppyList.clear(); 155 155 bool fSuccess = false; /* ignored */ 156 rc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess);156 vrc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess); 157 157 } 158 158 catch (std::bad_alloc &) 159 159 { 160 rc = VERR_NO_MEMORY;161 } 162 LogFlowThisFunc((" rc=%Rrc\n",rc));163 return rc;160 vrc = VERR_NO_MEMORY; 161 } 162 LogFlowThisFunc(("vrc=%Rrc\n", vrc)); 163 return vrc; 164 164 } 165 165 … … 167 167 { 168 168 LogFlowThisFunc(("entered\n")); 169 int rc;169 int vrc; 170 170 try 171 171 { 172 172 mFixedDriveList.clear(); 173 173 bool fSuccess = false; /* ignored */ 174 rc = getDriveInfoFromCAM(&mFixedDriveList, Fixed, &fSuccess);174 vrc = getDriveInfoFromCAM(&mFixedDriveList, Fixed, &fSuccess); 175 175 } 176 176 catch (std::bad_alloc &) 177 177 { 178 rc = VERR_NO_MEMORY;179 } 180 LogFlowThisFunc((" rc=%Rrc\n",rc));181 return rc;178 vrc = VERR_NO_MEMORY; 179 } 180 LogFlowThisFunc(("vrc=%Rrc\n", vrc)); 181 return vrc; 182 182 } 183 183 … … 324 324 { 325 325 RTFILE hFileXpt = NIL_RTFILE; 326 int rc = RTFileOpen(&hFileXpt, "/dev/xpt0", RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);327 if (RT_SUCCESS( rc))326 int vrc = RTFileOpen(&hFileXpt, "/dev/xpt0", RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 327 if (RT_SUCCESS(vrc)) 328 328 { 329 329 union ccb DeviceCCB; … … 377 377 do 378 378 { 379 rc = RTFileIoCtl(hFileXpt, CAMIOCOMMAND, &DeviceCCB, sizeof(union ccb), NULL);380 if (RT_FAILURE( rc))379 vrc = RTFileIoCtl(hFileXpt, CAMIOCOMMAND, &DeviceCCB, sizeof(union ccb), NULL); 380 if (RT_FAILURE(vrc)) 381 381 { 382 Log(("Error while querying available CD/DVD devices rc=%Rrc\n",rc));382 Log(("Error while querying available CD/DVD devices vrc=%Rrc\n", vrc)); 383 383 break; 384 384 } … … 431 431 do 432 432 { 433 rc = RTFileIoCtl(hFileXpt, CAMIOCOMMAND, &PeriphCCB, sizeof(union ccb), NULL);434 if (RT_FAILURE( rc))433 vrc = RTFileIoCtl(hFileXpt, CAMIOCOMMAND, &PeriphCCB, sizeof(union ccb), NULL); 434 if (RT_FAILURE(vrc)) 435 435 { 436 Log(("Error while querying available periph devices rc=%Rrc\n",rc));436 Log(("Error while querying available periph devices vrc=%Rrc\n", vrc)); 437 437 break; 438 438 } … … 479 479 { 480 480 pList->clear(); 481 rc = VERR_NO_MEMORY;481 vrc = VERR_NO_MEMORY; 482 482 break; 483 483 } … … 489 489 } while ( DeviceCCB.ccb_h.status == CAM_REQ_CMP 490 490 && DeviceCCB.cdm.status == CAM_DEV_MATCH_MORE 491 && RT_SUCCESS( rc));491 && RT_SUCCESS(vrc)); 492 492 493 493 RTMemFree(paMatches); 494 494 } 495 495 else 496 rc = VERR_NO_MEMORY;496 vrc = VERR_NO_MEMORY; 497 497 498 498 RTFileClose(hFileXpt); 499 499 } 500 500 501 return rc;501 return vrc; 502 502 } 503 503 … … 524 524 AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER); 525 525 LogFlowFunc(("pcszVar=%s, pList=%p, isDVD=%d, pfSuccess=%p\n", pcszVar, pList, isDVD, pfSuccess)); 526 int rc = VINF_SUCCESS;526 int vrc = VINF_SUCCESS; 527 527 bool success = false; 528 528 char *pszFreeMe = RTEnvDupEx(RTENV_DEFAULT, pcszVar); … … 552 552 catch (std::bad_alloc &) 553 553 { 554 rc = VERR_NO_MEMORY;554 vrc = VERR_NO_MEMORY; 555 555 } 556 556 RTStrFree(pszFreeMe); 557 LogFlowFunc((" rc=%Rrc, success=%d\n",rc, success));558 return rc;559 } 560 557 LogFlowFunc(("vrc=%Rrc, success=%d\n", vrc, success)); 558 return vrc; 559 } 560 -
trunk/src/VBox/Main/src-server/freebsd/NetIf-freebsd.cpp
r98103 r98288 124 124 Log(("getDefaultIfaceIndex: Got message %u while expecting %u.\n", 125 125 pRtMsg->rtm_type, RTM_GET)); 126 // rc = VERR_INTERNAL_ERROR;126 //vrc = VERR_INTERNAL_ERROR; 127 127 continue; 128 128 } … … 212 212 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 213 213 { 214 int rc = VINF_SUCCESS;214 int vrc = VINF_SUCCESS; 215 215 size_t cbNeeded; 216 216 char *pBuf, *pNext; … … 220 220 221 221 /* Get the index of the interface associated with default route. */ 222 rc = getDefaultIfaceIndex(&u16DefaultIface, PF_INET);223 if (RT_FAILURE( rc))222 vrc = getDefaultIfaceIndex(&u16DefaultIface, PF_INET); 223 if (RT_FAILURE(vrc)) 224 224 { 225 225 fDefaultIfaceExistent = false; 226 rc = VINF_SUCCESS;226 vrc = VINF_SUCCESS; 227 227 } 228 228 … … 265 265 Log(("NetIfList: Got message %u while expecting %u.\n", 266 266 pIfMsg->ifm_type, RTM_IFINFO)); 267 rc = VERR_INTERNAL_ERROR;267 vrc = VERR_INTERNAL_ERROR; 268 268 break; 269 269 } … … 274 274 if (!pNew) 275 275 { 276 rc = VERR_NO_MEMORY;276 vrc = VERR_NO_MEMORY; 277 277 break; 278 278 } … … 342 342 close(sock); 343 343 free(pBuf); 344 return rc; 345 346 344 return vrc; 347 345 } 348 346 349 347 int NetIfGetConfigByName(PNETIFINFO pInfo) 350 348 { 351 int rc = VINF_SUCCESS;349 int vrc = VINF_SUCCESS; 352 350 size_t cbNeeded; 353 351 char *pBuf, *pNext; … … 392 390 Log(("NetIfList: Got message %u while expecting %u.\n", 393 391 pIfMsg->ifm_type, RTM_IFINFO)); 394 rc = VERR_INTERNAL_ERROR;392 vrc = VERR_INTERNAL_ERROR; 395 393 break; 396 394 } … … 443 441 close(sock); 444 442 free(pBuf); 445 return rc;443 return vrc; 446 444 } 447 445 -
trunk/src/VBox/Main/src-server/freebsd/PerformanceFreeBSD.cpp
r98103 r98288 69 69 int CollectorFreeBSD::getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available) 70 70 { 71 int rc = VINF_SUCCESS;71 int vrc = VINF_SUCCESS; 72 72 u_long cbMemPhys = 0; 73 73 u_int cPagesMemFree = 0; … … 105 105 } 106 106 else 107 rc = VERR_NOT_SUPPORTED;107 vrc = VERR_NOT_SUPPORTED; 108 108 109 return rc;109 return vrc; 110 110 } 111 111 -
trunk/src/VBox/Main/src-server/freebsd/USBProxyBackendFreeBSD.cpp
r98103 r98288 88 88 * Create semaphore. 89 89 */ 90 int rc = RTSemEventCreate(&mNotifyEventSem);91 if (RT_FAILURE( rc))92 return rc;90 int vrc = RTSemEventCreate(&mNotifyEventSem); 91 if (RT_FAILURE(vrc)) 92 return vrc; 93 93 94 94 /* … … 222 222 int iBus = 0; 223 223 int iAddr = 1; 224 int rc = VINF_SUCCESS;224 int vrc = VINF_SUCCESS; 225 225 char *pszDevicePath = NULL; 226 226 uint32_t PlugTime = 0; … … 228 228 for (;;) 229 229 { 230 rc = RTStrAPrintf(&pszDevicePath, "/dev/%s%d.%d", USB_GENERIC_NAME, iBus, iAddr);231 if (RT_FAILURE( rc))230 vrc = RTStrAPrintf(&pszDevicePath, "/dev/%s%d.%d", USB_GENERIC_NAME, iBus, iAddr); 231 if (RT_FAILURE(vrc)) 232 232 break; 233 233 … … 260 260 RT_ZERO(UsbDevInfo); 261 261 262 rc = ioctl(FileUsb, USB_GET_DEVICEINFO, &UsbDevInfo);263 if ( rc < 0)262 vrc = ioctl(FileUsb, USB_GET_DEVICEINFO, &UsbDevInfo); 263 if (vrc < 0) 264 264 { 265 LogFlowFunc((": Error querying device info rc=%Rrc\n", RTErrConvertFromErrno(errno)));265 LogFlowFunc((": Error querying device info vrc=%Rrc\n", RTErrConvertFromErrno(errno))); 266 266 close(FileUsb); 267 267 RTStrFree(pszDevicePath); … … 331 331 pDevice->u64SerialHash = USBLibHashSerial(UsbDevInfo.udi_serial); 332 332 } 333 rc = ioctl(FileUsb, USB_GET_PLUGTIME, &PlugTime);334 if ( rc == 0)333 vrc = ioctl(FileUsb, USB_GET_PLUGTIME, &PlugTime); 334 if (vrc == 0) 335 335 pDevice->u64SerialHash += PlugTime; 336 336 -
trunk/src/VBox/Main/src-server/generic/AutostartDb-generic.cpp
r98103 r98288 47 47 int AutostartDb::autostartModifyDb(bool fAutostart, bool fAddVM) 48 48 { 49 int rc = VINF_SUCCESS;49 int vrc = VINF_SUCCESS; 50 50 char *pszUser = NULL; 51 51 … … 54 54 return VERR_PATH_NOT_FOUND; 55 55 56 rc = RTProcQueryUsernameA(RTProcSelf(), &pszUser);57 if (RT_SUCCESS( rc))56 vrc = RTProcQueryUsernameA(RTProcSelf(), &pszUser); 57 if (RT_SUCCESS(vrc)) 58 58 { 59 59 char *pszFile; … … 68 68 fOpen |= RTFILE_O_OPEN; 69 69 70 rc = RTStrAPrintf(&pszFile, "%s/%s.%s", 71 m_pszAutostartDbPath, pszUser, fAutostart ? "start" : "stop"); 72 if (RT_SUCCESS(rc)) 70 vrc = RTStrAPrintf(&pszFile, "%s/%s.%s", m_pszAutostartDbPath, pszUser, fAutostart ? "start" : "stop"); 71 if (RT_SUCCESS(vrc)) 73 72 { 74 rc = RTFileOpen(&hAutostartFile, pszFile, fOpen);75 if (RT_SUCCESS( rc))73 vrc = RTFileOpen(&hAutostartFile, pszFile, fOpen); 74 if (RT_SUCCESS(vrc)) 76 75 { 77 76 uint64_t cbFile; … … 82 81 * should be really really small. Anything else is bogus. 83 82 */ 84 rc = RTFileQuerySize(hAutostartFile, &cbFile);85 if ( RT_SUCCESS( rc)83 vrc = RTFileQuerySize(hAutostartFile, &cbFile); 84 if ( RT_SUCCESS(vrc) 86 85 && cbFile <= 16) 87 86 { … … 94 93 if (cbFile) 95 94 { 96 rc = RTFileRead(hAutostartFile, abBuf, (size_t)cbFile, NULL);97 if (RT_SUCCESS( rc))95 vrc = RTFileRead(hAutostartFile, abBuf, (size_t)cbFile, NULL); 96 if (RT_SUCCESS(vrc)) 98 97 { 99 rc = RTStrToUInt32Ex(abBuf, NULL, 10 /* uBase */, &cAutostartVms);100 if ( rc == VWRN_TRAILING_CHARS101 || rc == VWRN_TRAILING_SPACES)102 rc = VINF_SUCCESS;98 vrc = RTStrToUInt32Ex(abBuf, NULL, 10 /* uBase */, &cAutostartVms); 99 if ( vrc == VWRN_TRAILING_CHARS 100 || vrc == VWRN_TRAILING_SPACES) 101 vrc = VINF_SUCCESS; 103 102 } 104 103 } 105 104 106 if (RT_SUCCESS( rc))105 if (RT_SUCCESS(vrc)) 107 106 { 108 107 size_t cbBuf; … … 117 116 { 118 117 cbBuf = RTStrPrintf(abBuf, sizeof(abBuf), "%u", cAutostartVms); 119 rc = RTFileSetSize(hAutostartFile, cbBuf);120 if (RT_SUCCESS( rc))121 rc = RTFileWriteAt(hAutostartFile, 0, abBuf, cbBuf, NULL);118 vrc = RTFileSetSize(hAutostartFile, cbBuf); 119 if (RT_SUCCESS(vrc)) 120 vrc = RTFileWriteAt(hAutostartFile, 0, abBuf, cbBuf, NULL); 122 121 } 123 122 else … … 130 129 } 131 130 } 132 else if (RT_SUCCESS( rc))133 rc = VERR_FILE_TOO_BIG;131 else if (RT_SUCCESS(vrc)) 132 vrc = VERR_FILE_TOO_BIG; 134 133 135 134 if (hAutostartFile != NIL_RTFILE) … … 142 141 } 143 142 144 return rc;143 return vrc; 145 144 } 146 145 … … 150 149 { 151 150 #ifdef RT_OS_LINUX 152 int rc = RTCritSectInit(&this->CritSect);153 NOREF( rc);151 int vrc = RTCritSectInit(&this->CritSect); 152 NOREF(vrc); 154 153 m_pszAutostartDbPath = NULL; 155 154 #endif … … 192 191 int AutostartDb::addAutostartVM(const char *pszVMId) 193 192 { 194 int rc = VERR_NOT_SUPPORTED;195 196 #if defined(RT_OS_LINUX) 197 NOREF(pszVMId); /* Not needed */ 198 199 RTCritSectEnter(&this->CritSect); 200 rc = autostartModifyDb(true /* fAutostart */, true /* fAddVM */);193 int vrc = VERR_NOT_SUPPORTED; 194 195 #if defined(RT_OS_LINUX) 196 NOREF(pszVMId); /* Not needed */ 197 198 RTCritSectEnter(&this->CritSect); 199 vrc = autostartModifyDb(true /* fAutostart */, true /* fAddVM */); 201 200 RTCritSectLeave(&this->CritSect); 202 201 #elif defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) 203 202 NOREF(pszVMId); /* Not needed */ 204 rc = VINF_SUCCESS;205 #else 206 NOREF(pszVMId); 207 rc = VERR_NOT_SUPPORTED;208 #endif 209 210 return rc;203 vrc = VINF_SUCCESS; 204 #else 205 NOREF(pszVMId); 206 vrc = VERR_NOT_SUPPORTED; 207 #endif 208 209 return vrc; 211 210 } 212 211 213 212 int AutostartDb::removeAutostartVM(const char *pszVMId) 214 213 { 215 int rc = VINF_SUCCESS;216 217 #if defined(RT_OS_LINUX) 218 NOREF(pszVMId); /* Not needed */ 219 RTCritSectEnter(&this->CritSect); 220 rc = autostartModifyDb(true /* fAutostart */, false /* fAddVM */);214 int vrc = VINF_SUCCESS; 215 216 #if defined(RT_OS_LINUX) 217 NOREF(pszVMId); /* Not needed */ 218 RTCritSectEnter(&this->CritSect); 219 vrc = autostartModifyDb(true /* fAutostart */, false /* fAddVM */); 221 220 RTCritSectLeave(&this->CritSect); 222 221 #elif defined(RT_OS_DARWIN) || defined(RT_OS_SOLARIS) || defined(RT_OS_WINDOWS) 223 222 NOREF(pszVMId); /* Not needed */ 224 rc = VINF_SUCCESS;225 #else 226 NOREF(pszVMId); 227 rc = VERR_NOT_SUPPORTED;228 #endif 229 230 return rc;223 vrc = VINF_SUCCESS; 224 #else 225 NOREF(pszVMId); 226 vrc = VERR_NOT_SUPPORTED; 227 #endif 228 229 return vrc; 231 230 } 232 231 233 232 int AutostartDb::addAutostopVM(const char *pszVMId) 234 233 { 235 int rc = VINF_SUCCESS;236 237 #if defined(RT_OS_LINUX) 238 NOREF(pszVMId); /* Not needed */ 239 RTCritSectEnter(&this->CritSect); 240 rc = autostartModifyDb(false /* fAutostart */, true /* fAddVM */);234 int vrc = VINF_SUCCESS; 235 236 #if defined(RT_OS_LINUX) 237 NOREF(pszVMId); /* Not needed */ 238 RTCritSectEnter(&this->CritSect); 239 vrc = autostartModifyDb(false /* fAutostart */, true /* fAddVM */); 241 240 RTCritSectLeave(&this->CritSect); 242 241 #elif defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) 243 242 NOREF(pszVMId); /* Not needed */ 244 rc = VINF_SUCCESS;245 #else 246 NOREF(pszVMId); 247 rc = VERR_NOT_SUPPORTED;248 #endif 249 250 return rc;243 vrc = VINF_SUCCESS; 244 #else 245 NOREF(pszVMId); 246 vrc = VERR_NOT_SUPPORTED; 247 #endif 248 249 return vrc; 251 250 } 252 251 253 252 int AutostartDb::removeAutostopVM(const char *pszVMId) 254 253 { 255 int rc = VINF_SUCCESS;256 257 #if defined(RT_OS_LINUX) 258 NOREF(pszVMId); /* Not needed */ 259 RTCritSectEnter(&this->CritSect); 260 rc = autostartModifyDb(false /* fAutostart */, false /* fAddVM */);254 int vrc = VINF_SUCCESS; 255 256 #if defined(RT_OS_LINUX) 257 NOREF(pszVMId); /* Not needed */ 258 RTCritSectEnter(&this->CritSect); 259 vrc = autostartModifyDb(false /* fAutostart */, false /* fAddVM */); 261 260 RTCritSectLeave(&this->CritSect); 262 261 #elif defined(RT_OS_DARWIN) || defined (RT_OS_WINDOWS) 263 262 NOREF(pszVMId); /* Not needed */ 264 rc = VINF_SUCCESS;265 #else 266 NOREF(pszVMId); 267 rc = VERR_NOT_SUPPORTED;268 #endif 269 270 return rc;271 } 272 263 vrc = VINF_SUCCESS; 264 #else 265 NOREF(pszVMId); 266 vrc = VERR_NOT_SUPPORTED; 267 #endif 268 269 return vrc; 270 } 271 -
trunk/src/VBox/Main/src-server/generic/NetIf-generic.cpp
r98103 r98288 63 63 64 64 char szAdpCtl[RTPATH_MAX]; 65 int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME));66 if (RT_FAILURE( rc))67 { 68 LogRel(("NetIfAdpCtl: failed to get program path, rc=%Rrc.\n",rc));69 return rc;65 int vrc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME)); 66 if (RT_FAILURE(vrc)) 67 { 68 LogRel(("NetIfAdpCtl: failed to get program path, vrc=%Rrc.\n", vrc)); 69 return vrc; 70 70 } 71 71 strcat(szAdpCtl, "/" VBOXNETADPCTL_NAME); … … 79 79 80 80 RTPROCESS pid; 81 rc = RTProcCreate(szAdpCtl, args, RTENV_DEFAULT, 0, &pid);82 if (RT_SUCCESS( rc))81 vrc = RTProcCreate(szAdpCtl, args, RTENV_DEFAULT, 0, &pid); 82 if (RT_SUCCESS(vrc)) 83 83 { 84 84 RTPROCSTATUS Status; 85 rc = RTProcWait(pid, 0, &Status);86 if (RT_SUCCESS( rc))85 vrc = RTProcWait(pid, 0, &Status); 86 if (RT_SUCCESS(vrc)) 87 87 { 88 88 if ( Status.iStatus == 0 … … 91 91 LogRel(("NetIfAdpCtl: failed to create process for %s: iStats=%d enmReason=%d\n", 92 92 szAdpCtl, Status.iStatus, Status.enmReason)); 93 rc = -Status.iStatus;93 vrc = -Status.iStatus; 94 94 } 95 95 } 96 96 else 97 LogRel(("NetIfAdpCtl: failed to create process for %s: %Rrc\n", szAdpCtl, rc));98 return rc;97 LogRel(("NetIfAdpCtl: failed to create process for %s: %Rrc\n", szAdpCtl, vrc)); 98 return vrc; 99 99 } 100 100 … … 110 110 { 111 111 char szAdpCtl[RTPATH_MAX]; 112 int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " ") - strlen(pcszCmd));113 if (RT_FAILURE( rc))114 { 115 LogRel(("NetIfAdpCtlOut: Failed to get program path, rc=%Rrc\n",rc));112 int vrc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " ") - strlen(pcszCmd)); 113 if (RT_FAILURE(vrc)) 114 { 115 LogRel(("NetIfAdpCtlOut: Failed to get program path, vrc=%Rrc\n", vrc)); 116 116 return VERR_INVALID_PARAMETER; 117 117 } … … 138 138 { 139 139 LogRel(("NetIfAdpCtlOut: %s", pszBuffer)); 140 rc = VERR_INTERNAL_ERROR;140 vrc = VERR_INTERNAL_ERROR; 141 141 } 142 142 } … … 144 144 { 145 145 LogRel(("NetIfAdpCtlOut: No output from " VBOXNETADPCTL_NAME)); 146 rc = VERR_INTERNAL_ERROR;146 vrc = VERR_INTERNAL_ERROR; 147 147 } 148 148 pclose(fp); 149 149 } 150 return rc;150 return vrc; 151 151 } 152 152 -
trunk/src/VBox/Main/src-server/generic/USBProxyBackendUsbIp.cpp
r98103 r98288 297 297 const com::Utf8Str &strAddress, bool fLoadingSettings) 298 298 { 299 int rc = VINF_SUCCESS;299 int vrc = VINF_SUCCESS; 300 300 301 301 USBProxyBackend::init(pUsbProxyService, strId, strAddress, fLoadingSettings); … … 322 322 323 323 /* Setup wakeup pipe and poll set first. */ 324 rc = RTSemFastMutexCreate(&m->hMtxDevices);325 if (RT_SUCCESS( rc))326 { 327 rc = RTPipeCreate(&m->hWakeupPipeR, &m->hWakeupPipeW, 0);328 if (RT_SUCCESS( rc))329 { 330 rc = RTPollSetCreate(&m->hPollSet);331 if (RT_SUCCESS( rc))324 vrc = RTSemFastMutexCreate(&m->hMtxDevices); 325 if (RT_SUCCESS(vrc)) 326 { 327 vrc = RTPipeCreate(&m->hWakeupPipeR, &m->hWakeupPipeW, 0); 328 if (RT_SUCCESS(vrc)) 329 { 330 vrc = RTPollSetCreate(&m->hPollSet); 331 if (RT_SUCCESS(vrc)) 332 332 { 333 rc = RTPollSetAddPipe(m->hPollSet, m->hWakeupPipeR, 334 RTPOLL_EVT_READ, USBIP_POLL_ID_PIPE); 335 if (RT_SUCCESS(rc)) 333 vrc = RTPollSetAddPipe(m->hPollSet, m->hWakeupPipeR, RTPOLL_EVT_READ, USBIP_POLL_ID_PIPE); 334 if (RT_SUCCESS(vrc)) 336 335 { 337 336 /* … … 344 343 * reachable. 345 344 */ 346 rc = reconnect();347 if (RT_SUCCESS( rc) || fLoadingSettings)348 rc = start(); /* Start service thread. */345 vrc = reconnect(); 346 if (RT_SUCCESS(vrc) || fLoadingSettings) 347 vrc = start(); /* Start service thread. */ 349 348 } 350 349 351 if (RT_FAILURE( rc))350 if (RT_FAILURE(vrc)) 352 351 { 353 352 RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_PIPE); … … 358 357 } 359 358 360 if (RT_FAILURE( rc))359 if (RT_FAILURE(vrc)) 361 360 { 362 361 int rc2 = RTPipeClose(m->hWakeupPipeR); … … 367 366 } 368 367 } 369 if (RT_FAILURE( rc))368 if (RT_FAILURE(vrc)) 370 369 { 371 370 RTSemFastMutexDestroy(m->hMtxDevices); … … 374 373 } 375 374 376 return rc;375 return vrc; 377 376 } 378 377 … … 397 396 disconnect(); 398 397 399 int rc = RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_PIPE);400 AssertRC( rc);401 rc = RTPollSetDestroy(m->hPollSet);402 AssertRC( rc);403 rc = RTPipeClose(m->hWakeupPipeR);404 AssertRC( rc);405 rc = RTPipeClose(m->hWakeupPipeW);406 AssertRC( rc);398 int vrc = RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_PIPE); 399 AssertRC(vrc); 400 vrc = RTPollSetDestroy(m->hPollSet); 401 AssertRC(vrc); 402 vrc = RTPipeClose(m->hWakeupPipeR); 403 AssertRC(vrc); 404 vrc = RTPipeClose(m->hWakeupPipeW); 405 AssertRC(vrc); 407 406 408 407 m->hPollSet = NIL_RTPOLLSET; … … 468 467 int USBProxyBackendUsbIp::wait(RTMSINTERVAL aMillies) 469 468 { 470 int rc = VINF_SUCCESS;469 int vrc = VINF_SUCCESS; 471 470 bool fDeviceListChangedOrWokenUp = false; 472 471 … … 483 482 && m->enmRecvState == kUsbIpRecvState_None) 484 483 { 485 rc = startListExportedDevicesReq();486 if (RT_FAILURE( rc))484 vrc = startListExportedDevicesReq(); 485 if (RT_FAILURE(vrc)) 487 486 disconnect(); 488 487 } … … 496 495 while ( !fDeviceListChangedOrWokenUp 497 496 && (aMillies == RT_INDEFINITE_WAIT || aMillies > 0) 498 && RT_SUCCESS( rc))497 && RT_SUCCESS(vrc)) 499 498 { 500 499 RTMSINTERVAL msWait = aMillies; … … 507 506 msWait = RT_MIN(3000, aMillies); 508 507 509 rc = RTPoll(m->hPollSet, msWait, &fEventsRecv, &uIdReady);510 if (RT_SUCCESS( rc))508 vrc = RTPoll(m->hPollSet, msWait, &fEventsRecv, &uIdReady); 509 if (RT_SUCCESS(vrc)) 511 510 { 512 511 if (uIdReady == USBIP_POLL_ID_PIPE) … … 516 515 size_t cbRead = 0; 517 516 518 rc = RTPipeRead(m->hWakeupPipeR, &bRead, 1, &cbRead);519 Assert(RT_SUCCESS( rc) && cbRead == 1);517 vrc = RTPipeRead(m->hWakeupPipeR, &bRead, 1, &cbRead); 518 Assert(RT_SUCCESS(vrc) && cbRead == 1); 520 519 fDeviceListChangedOrWokenUp = true; 521 520 } … … 523 522 { 524 523 if (fEventsRecv & RTPOLL_EVT_READ) 525 rc = receiveData();526 if ( RT_SUCCESS( rc)524 vrc = receiveData(); 525 if ( RT_SUCCESS(vrc) 527 526 && (fEventsRecv & RTPOLL_EVT_ERROR)) 528 rc = VERR_NET_SHUTDOWN;527 vrc = VERR_NET_SHUTDOWN; 529 528 530 529 /* … … 549 548 550 549 /* Current USB/IP server closes the connection after each request, don't abort but try again. */ 551 if ( rc == VERR_NET_SHUTDOWN || rc == VERR_BROKEN_PIPE ||rc == VERR_NET_CONNECTION_RESET_BY_PEER)550 if (vrc == VERR_NET_SHUTDOWN || vrc == VERR_BROKEN_PIPE || vrc == VERR_NET_CONNECTION_RESET_BY_PEER) 552 551 { 553 552 Log(("USB/IP: Lost connection to host \"%s\", trying to reconnect...\n", m->pszHost)); 554 553 disconnect(); 555 rc = VINF_SUCCESS;554 vrc = VINF_SUCCESS; 556 555 } 557 556 } … … 559 558 { 560 559 AssertMsgFailed(("Invalid poll ID returned\n")); 561 rc = VERR_INVALID_STATE;560 vrc = VERR_INVALID_STATE; 562 561 } 563 562 aMillies -= (RTMSINTERVAL)(RTTimeMilliTS() - msPollStart); 564 563 } 565 else if ( rc == VERR_TIMEOUT)564 else if (vrc == VERR_TIMEOUT) 566 565 { 567 566 aMillies -= msWait; … … 571 570 if (m->hSocket == NIL_RTSOCKET) 572 571 { 573 rc = reconnect();574 if (RT_SUCCESS( rc))575 rc = startListExportedDevicesReq();576 else if ( rc == VERR_NET_SHUTDOWN577 || rc == VERR_BROKEN_PIPE578 || rc == VERR_NET_CONNECTION_RESET_BY_PEER579 || rc == VERR_NET_CONNECTION_REFUSED)572 vrc = reconnect(); 573 if (RT_SUCCESS(vrc)) 574 vrc = startListExportedDevicesReq(); 575 else if ( vrc == VERR_NET_SHUTDOWN 576 || vrc == VERR_BROKEN_PIPE 577 || vrc == VERR_NET_CONNECTION_RESET_BY_PEER 578 || vrc == VERR_NET_CONNECTION_REFUSED) 580 579 { 581 580 if (hasDevListChanged(m->pHead)) 582 581 fDeviceListChangedOrWokenUp = true; 583 rc = VINF_SUCCESS;582 vrc = VINF_SUCCESS; 584 583 } 585 584 } … … 588 587 } 589 588 590 LogFlowFunc(("return rc=%Rrc\n",rc));591 return rc;589 LogFlowFunc(("return vrc=%Rrc\n", vrc)); 590 return vrc; 592 591 } 593 592 … … 599 598 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 600 599 601 int rc = RTPipeWriteBlocking(m->hWakeupPipeW, "", 1, NULL);602 if (RT_SUCCESS( rc))600 int vrc = RTPipeWriteBlocking(m->hWakeupPipeW, "", 1, NULL); 601 if (RT_SUCCESS(vrc)) 603 602 RTPipeFlush(m->hWakeupPipeW); 604 LogFlowFunc(("returning %Rrc\n", rc));605 return rc;603 LogFlowFunc(("returning %Rrc\n", vrc)); 604 return vrc; 606 605 } 607 606 … … 705 704 if (m->hSocket != NIL_RTSOCKET) 706 705 { 707 int rc = RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_SOCKET);708 NOREF( rc);709 Assert(RT_SUCCESS( rc) ||rc == VERR_POLL_HANDLE_ID_NOT_FOUND);706 int vrc = RTPollSetRemove(m->hPollSet, USBIP_POLL_ID_SOCKET); 707 NOREF(vrc); 708 Assert(RT_SUCCESS(vrc) || vrc == VERR_POLL_HANDLE_ID_NOT_FOUND); 710 709 711 710 RTTcpClientCloseEx(m->hSocket, false /*fGracefulShutdown*/); … … 730 729 731 730 /* Connect to the USB/IP host. */ 732 int rc = RTTcpClientConnect(m->pszHost, m->uPort, &m->hSocket); 733 if (RT_SUCCESS(rc)) 734 { 735 rc = RTTcpSetSendCoalescing(m->hSocket, false); 736 if (RT_FAILURE(rc)) 737 LogRelMax(5, ("USB/IP: Disabling send coalescing failed (rc=%Rrc), continuing nevertheless but expect increased latency\n", rc)); 738 739 rc = RTPollSetAddSocket(m->hPollSet, m->hSocket, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, 740 USBIP_POLL_ID_SOCKET); 741 if (RT_FAILURE(rc)) 731 int vrc = RTTcpClientConnect(m->pszHost, m->uPort, &m->hSocket); 732 if (RT_SUCCESS(vrc)) 733 { 734 vrc = RTTcpSetSendCoalescing(m->hSocket, false); 735 if (RT_FAILURE(vrc)) 736 LogRelMax(5, ("USB/IP: Disabling send coalescing failed (vrc=%Rrc), continuing nevertheless but expect increased latency\n", vrc)); 737 738 vrc = RTPollSetAddSocket(m->hPollSet, m->hSocket, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR, USBIP_POLL_ID_SOCKET); 739 if (RT_FAILURE(vrc)) 742 740 { 743 741 RTTcpClientCloseEx(m->hSocket, false /*fGracefulShutdown*/); … … 763 761 } 764 762 765 LogFlowFunc(("returns rc=%Rrc\n",rc));766 return rc;763 LogFlowFunc(("returns vrc=%Rrc\n", vrc)); 764 return vrc; 767 765 } 768 766 … … 774 772 int USBProxyBackendUsbIp::startListExportedDevicesReq() 775 773 { 776 int rc = VINF_SUCCESS;774 int vrc = VINF_SUCCESS; 777 775 778 776 LogFlowFunc(("\n")); … … 784 782 Assert(m->enmRecvState == kUsbIpRecvState_None); 785 783 if (m->enmRecvState != kUsbIpRecvState_None) 786 rc = reconnect();787 788 if (RT_SUCCESS( rc))784 vrc = reconnect(); 785 786 if (RT_SUCCESS(vrc)) 789 787 { 790 788 /* Send of the request. */ … … 794 792 ReqDevList.i32Status = RT_H2N_S32(0); 795 793 796 rc = RTTcpWrite(m->hSocket, &ReqDevList, sizeof(ReqDevList));797 if (RT_SUCCESS( rc))794 vrc = RTTcpWrite(m->hSocket, &ReqDevList, sizeof(ReqDevList)); 795 if (RT_SUCCESS(vrc)) 798 796 advanceState(kUsbIpRecvState_Hdr); 799 797 } 800 798 801 LogFlowFunc(("returns rc=%Rrc\n",rc));802 return rc;799 LogFlowFunc(("returns vrc=%Rrc\n", vrc)); 800 return vrc; 803 801 } 804 802 … … 852 850 int USBProxyBackendUsbIp::receiveData() 853 851 { 854 int rc = VINF_SUCCESS;852 int vrc = VINF_SUCCESS; 855 853 size_t cbRecvd = 0; 856 854 … … 859 857 do 860 858 { 861 rc = RTTcpReadNB(m->hSocket, m->pbRecvBuf, m->cbResidualRecv, &cbRecvd); 862 863 LogFlowFunc(("RTTcpReadNB(%#p, %#p, %zu, %zu) -> %Rrc\n", 864 m->hSocket, m->pbRecvBuf, m->cbResidualRecv, cbRecvd, rc)); 865 866 if ( rc == VINF_SUCCESS 859 vrc = RTTcpReadNB(m->hSocket, m->pbRecvBuf, m->cbResidualRecv, &cbRecvd); 860 861 LogFlowFunc(("RTTcpReadNB(%#p, %#p, %zu, %zu) -> %Rrc\n", m->hSocket, m->pbRecvBuf, m->cbResidualRecv, cbRecvd, vrc)); 862 863 if ( vrc == VINF_SUCCESS 867 864 && cbRecvd > 0) 868 865 { … … 872 869 if (!m->cbResidualRecv) 873 870 { 874 rc = processData();875 if ( RT_SUCCESS( rc)871 vrc = processData(); 872 if ( RT_SUCCESS(vrc) 876 873 && m->enmRecvState == kUsbIpRecvState_None) 877 874 break; 878 875 } 879 876 } 880 else if ( rc == VINF_TRY_AGAIN)877 else if (vrc == VINF_TRY_AGAIN) 881 878 Assert(!cbRecvd); 882 879 883 } while ( rc == VINF_SUCCESS && cbRecvd > 0);884 885 if ( rc == VINF_TRY_AGAIN)886 rc = VINF_SUCCESS;887 888 LogFlowFunc(("returns rc=%Rrc\n",rc));889 return rc;880 } while (vrc == VINF_SUCCESS && cbRecvd > 0); 881 882 if (vrc == VINF_TRY_AGAIN) 883 vrc = VINF_SUCCESS; 884 885 LogFlowFunc(("returns vrc=%Rrc\n", vrc)); 886 return vrc; 890 887 } 891 888 … … 897 894 int USBProxyBackendUsbIp::processData() 898 895 { 899 int rc = VINF_SUCCESS;896 int vrc = VINF_SUCCESS; 900 897 901 898 switch (m->enmRecvState) … … 924 921 advanceState(kUsbIpRecvState_None); 925 922 disconnect(); 926 rc = VERR_NET_SHUTDOWN;923 vrc = VERR_NET_SHUTDOWN; 927 924 } 928 925 break; … … 932 929 /* Create a new device and add it to the list. */ 933 930 usbProxyBackendUsbIpExportedDeviceN2H(&m->Scratch.ExportedDevice); 934 rc = addDeviceToList(&m->Scratch.ExportedDevice);935 if (RT_SUCCESS( rc))931 vrc = addDeviceToList(&m->Scratch.ExportedDevice); 932 if (RT_SUCCESS(vrc)) 936 933 { 937 934 m->cInterfacesLeft = m->Scratch.ExportedDevice.bNumInterfaces; … … 974 971 } 975 972 976 return rc;973 return vrc; 977 974 } 978 975 … … 986 983 int USBProxyBackendUsbIp::addDeviceToList(PUsbIpExportedDevice pDev) 987 984 { 988 int rc = VINF_SUCCESS;985 int vrc = VINF_SUCCESS; 989 986 PUSBDEVICE pNew = (PUSBDEVICE)RTMemAllocZ(sizeof(USBDEVICE)); 990 987 if (!pNew) … … 1055 1052 } 1056 1053 else 1057 rc = VERR_NO_STR_MEMORY;1058 1059 if (RT_FAILURE( rc))1054 vrc = VERR_NO_STR_MEMORY; 1055 1056 if (RT_FAILURE(vrc)) 1060 1057 { 1061 1058 if (pNew->pszManufacturer) … … 1070 1067 } 1071 1068 1072 return rc;1069 return vrc; 1073 1070 } 1074 1071 -
trunk/src/VBox/Main/src-server/linux/HostDnsServiceLinux.cpp
r98103 r98288 185 185 */ 186 186 int aiStopPair[2]; 187 int rc = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, aiStopPair);187 int iRc = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, aiStopPair); 188 188 int iErr = errno; 189 AssertLogRelMsgReturn( rc == 0, ("socketpair: failed (%d: %s)\n", iErr, strerror(iErr)), RTErrConvertFromErrno(iErr));189 AssertLogRelMsgReturn(iRc == 0, ("socketpair: failed (%d: %s)\n", iErr, strerror(iErr)), RTErrConvertFromErrno(iErr)); 190 190 191 191 m_fdShutdown = aiStopPair[0]; … … 241 241 * Wait for something to happen. 242 242 */ 243 rc = poll(aFdPolls, RT_ELEMENTS(aFdPolls), -1 /*infinite timeout*/);244 if ( rc == -1)243 iRc = poll(aFdPolls, RT_ELEMENTS(aFdPolls), -1 /*infinite timeout*/); 244 if (iRc == -1) 245 245 { 246 246 if (errno != EINTR) 247 247 { 248 LogRelMax(32, ("HostDnsServiceLinux::monitorThreadProc: poll failed %d: errno=%d\n", rc, errno));248 LogRelMax(32, ("HostDnsServiceLinux::monitorThreadProc: poll failed %d: errno=%d\n", iRc, errno)); 249 249 RTThreadSleep(1); 250 250 } 251 251 continue; 252 252 } 253 Log5Func(("poll returns %d: [0]=%#x [1]=%#x\n", rc, aFdPolls[1].revents, aFdPolls[0].revents));253 Log5Func(("poll returns %d: [0]=%#x [1]=%#x\n", iRc, aFdPolls[1].revents, aFdPolls[0].revents)); 254 254 255 255 AssertMsgBreakStmt( (aFdPolls[0].revents & (POLLERR | POLLNVAL)) == 0 /* (ok for fd=-1 too, revents=0 then) */ … … 322 322 if (iWdFileNew != -1) 323 323 { 324 rc = inotify_rm_watch(iNotifyFd, iWdFileNew);325 AssertMsg( rc >= 0, ("%d/%d\n", rc, errno));324 iRc = inotify_rm_watch(iNotifyFd, iWdFileNew); 325 AssertMsg(iRc >= 0, ("%d/%d\n", iRc, errno)); 326 326 iWdFileNew = -1; 327 327 } … … 350 350 if (iWdFileNew >= 0) 351 351 { 352 rc = inotify_rm_watch(iNotifyFd, iWdFileNew);353 Log5Func(("dir: moved / created / deleted: dropped file watch (%d - rc=%d/err=%d)\n",354 iWdFileNew, rc, errno));352 iRc = inotify_rm_watch(iNotifyFd, iWdFileNew); 353 Log5Func(("dir: moved / created / deleted: dropped file watch (%d - iRc=%d/err=%d)\n", 354 iWdFileNew, iRc, errno)); 355 355 iWdFileNew = -1; 356 356 } 357 357 if (iWdSymDirNew >= 0) 358 358 { 359 rc = inotify_rm_watch(iNotifyFd, iWdSymDirNew);360 Log5Func(("dir: moved / created / deleted: dropped symlinked dir watch (%d - %s/%s - rc=%d/err=%d)\n",361 iWdSymDirNew, szRealResolvConf, &szRealResolvConf[offRealResolvConfName], rc, errno));359 iRc = inotify_rm_watch(iNotifyFd, iWdSymDirNew); 360 Log5Func(("dir: moved / created / deleted: dropped symlinked dir watch (%d - %s/%s - iRc=%d/err=%d)\n", 361 iWdSymDirNew, szRealResolvConf, &szRealResolvConf[offRealResolvConfName], iRc, errno)); 362 362 iWdSymDirNew = -1; 363 363 offRealResolvConfName = 0; … … 397 397 if (iWdFileNew >= 0) 398 398 { 399 rc = inotify_rm_watch(iNotifyFd, iWdFileNew);400 Log5Func(("symdir: moved / created / deleted: drop file watch (%d - rc=%d/err=%d)\n",401 iWdFileNew, rc, errno));399 iRc = inotify_rm_watch(iNotifyFd, iWdFileNew); 400 Log5Func(("symdir: moved / created / deleted: drop file watch (%d - iRc=%d/err=%d)\n", 401 iWdFileNew, iRc, errno)); 402 402 iWdFileNew = -1; 403 403 } -
trunk/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp
r98103 r98288 148 148 AssertReturn(Number <= 7, false); 149 149 RTFILE File; 150 int rc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);151 if (RT_SUCCESS( rc))150 int vrc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK); 151 if (RT_SUCCESS(vrc)) 152 152 { 153 153 int rcIoCtl; 154 rc = RTFileIoCtl(File, FDGETDRVTYP, pszName, 0, &rcIoCtl);154 vrc = RTFileIoCtl(File, FDGETDRVTYP, pszName, 0, &rcIoCtl); 155 155 RTFileClose(File); 156 if (RT_SUCCESS( rc) && rcIoCtl >= 0)156 if (RT_SUCCESS(vrc) && rcIoCtl >= 0) 157 157 return true; 158 158 } … … 310 310 311 311 RTFILE hFile = NIL_RTFILE; 312 int rc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);313 if (RT_SUCCESS( rc))312 int vrc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK); 313 if (RT_SUCCESS(vrc)) 314 314 { 315 315 int rcIoCtl = 0; … … 323 323 CdromCommandReq.data_direction = CGC_DATA_READ; 324 324 CdromCommandReq.timeout = 5000; /* ms */ 325 rc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl);326 if (RT_SUCCESS( rc) && rcIoCtl < 0)327 rc = RTErrConvertFromErrno(-CdromCommandReq.stat);325 vrc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl); 326 if (RT_SUCCESS(vrc) && rcIoCtl < 0) 327 vrc = RTErrConvertFromErrno(-CdromCommandReq.stat); 328 328 RTFileClose(hFile); 329 329 330 if (RT_SUCCESS( rc))330 if (RT_SUCCESS(vrc)) 331 331 { 332 332 if (pbType) … … 347 347 } 348 348 } 349 LogRelFlowFunc(("returning %Rrc\n", rc));350 return rc;349 LogRelFlowFunc(("returning %Rrc\n", vrc)); 350 return vrc; 351 351 } 352 352 … … 432 432 AssertPtrReturn(pcszNode, false); 433 433 RTFILE File; 434 int rc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);435 if (RT_SUCCESS( rc))434 int vrc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK); 435 if (RT_SUCCESS(vrc)) 436 436 { 437 437 int rcIoCtl; 438 rc = RTFileIoCtl(File, NVME_IOCTL_ID, NULL, 0, &rcIoCtl);438 vrc = RTFileIoCtl(File, NVME_IOCTL_ID, NULL, 0, &rcIoCtl); 439 439 RTFileClose(File); 440 if (RT_SUCCESS( rc) && rcIoCtl >= 0)440 if (RT_SUCCESS(vrc) && rcIoCtl >= 0) 441 441 return true; 442 442 } … … 520 520 { 521 521 LogFlowThisFunc(("entered\n")); 522 int rc;522 int vrc; 523 523 try 524 524 { … … 527 527 * environment variable. */ 528 528 bool fSuccess = false; /* Have we succeeded in finding anything yet? */ 529 rc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess);529 vrc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess); 530 530 setNoProbe(false); 531 if (RT_SUCCESS( rc) && (!fSuccess || testing()))532 rc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);533 if (RT_SUCCESS( rc) && testing())531 if (RT_SUCCESS(vrc) && (!fSuccess || testing())) 532 vrc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess); 533 if (RT_SUCCESS(vrc) && testing()) 534 534 { 535 535 setNoProbe(true); 536 rc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);536 vrc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess); 537 537 } 538 538 } 539 539 catch (std::bad_alloc &e) 540 540 { 541 rc = VERR_NO_MEMORY;542 } 543 LogFlowThisFunc((" rc=%Rrc\n",rc));544 return rc;541 vrc = VERR_NO_MEMORY; 542 } 543 LogFlowThisFunc(("vrc=%Rrc\n", vrc)); 544 return vrc; 545 545 } 546 546 … … 548 548 { 549 549 LogFlowThisFunc(("entered\n")); 550 int rc;550 int vrc; 551 551 try 552 552 { 553 553 mFloppyList.clear(); 554 554 bool fSuccess = false; /* Have we succeeded in finding anything yet? */ 555 rc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess);555 vrc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess); 556 556 setNoProbe(false); 557 if (RT_SUCCESS( rc) && (!fSuccess || testing()))558 rc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);559 if (RT_SUCCESS( rc) && testing())557 if (RT_SUCCESS(vrc) && (!fSuccess || testing())) 558 vrc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess); 559 if (RT_SUCCESS(vrc) && testing()) 560 560 { 561 561 setNoProbe(true); 562 rc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);562 vrc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess); 563 563 } 564 564 } 565 565 catch (std::bad_alloc &) 566 566 { 567 rc = VERR_NO_MEMORY;568 } 569 LogFlowThisFunc((" rc=%Rrc\n",rc));570 return rc;567 vrc = VERR_NO_MEMORY; 568 } 569 LogFlowThisFunc(("vrc=%Rrc\n", vrc)); 570 return vrc; 571 571 } 572 572 … … 617 617 AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER); 618 618 LogFlowFunc(("pcszVar=%s, pList=%p, isDVD=%d, pfSuccess=%p\n", pcszVar, pList, isDVD, pfSuccess)); 619 int rc = VINF_SUCCESS;619 int vrc = VINF_SUCCESS; 620 620 bool success = false; 621 621 char *pszFreeMe = RTEnvDupEx(RTENV_DEFAULT, pcszVar); … … 645 645 catch (std::bad_alloc &) 646 646 { 647 rc = VERR_NO_MEMORY;647 vrc = VERR_NO_MEMORY; 648 648 } 649 649 RTStrFree(pszFreeMe); 650 LogFlowFunc((" rc=%Rrc, success=%d\n",rc, success));651 return rc;650 LogFlowFunc(("vrc=%Rrc, success=%d\n", vrc, success)); 651 return vrc; 652 652 } 653 653 … … 696 696 { 697 697 dev_t dev = 0; 698 int rc = RTLinuxSysFsReadDevNumFile(&dev, "block/%s/dev", mpcszName);699 if (RT_FAILURE( rc) || dev == 0)698 int vrc = RTLinuxSysFsReadDevNumFile(&dev, "block/%s/dev", mpcszName); 699 if (RT_FAILURE(vrc) || dev == 0) 700 700 { 701 701 misConsistent = false; 702 702 return false; 703 703 } 704 rc = RTLinuxCheckDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode, sizeof(mszNode), "%s", mpcszName);705 return RT_SUCCESS( rc);704 vrc = RTLinuxCheckDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode, sizeof(mszNode), "%s", mpcszName); 705 return RT_SUCCESS(vrc); 706 706 } 707 707 … … 714 714 { 715 715 int64_t type = 0; 716 int rc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);717 if (RT_SUCCESS( rc) && type != TYPE_ROM)716 int vrc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName); 717 if (RT_SUCCESS(vrc) && type != TYPE_ROM) 718 718 return; 719 719 if (type == TYPE_ROM) 720 720 { 721 721 char szVendor[128]; 722 rc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), NULL, "block/%s/device/vendor", mpcszName);723 if (RT_SUCCESS( rc))722 vrc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), NULL, "block/%s/device/vendor", mpcszName); 723 if (RT_SUCCESS(vrc)) 724 724 { 725 725 char szModel[128]; 726 rc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), NULL, "block/%s/device/model", mpcszName);727 if (RT_SUCCESS( rc))726 vrc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), NULL, "block/%s/device/model", mpcszName); 727 if (RT_SUCCESS(vrc)) 728 728 { 729 729 misValid = true; … … 747 747 char szVendor[128] = ""; 748 748 char szModel[128] = ""; 749 int rc = cdromDoInquiry(mszNode, &bType, szVendor, sizeof(szVendor), szModel, sizeof(szModel));750 if (RT_SUCCESS( rc) && bType == TYPE_ROM)749 int vrc = cdromDoInquiry(mszNode, &bType, szVendor, sizeof(szVendor), szModel, sizeof(szModel)); 750 if (RT_SUCCESS(vrc) && bType == TYPE_ROM) 751 751 { 752 752 misValid = true; … … 772 772 if (!noProbe()) 773 773 fHaveName = floppyGetName(mszNode, mpcszName[2] - '0', szName); 774 int rc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", 775 mpcszName, "device/driver"); 776 if (RT_SUCCESS(rc)) 774 int vrc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", mpcszName, "device/driver"); 775 if (RT_SUCCESS(vrc)) 777 776 { 778 777 if (RTStrCmp(szDriver, "floppy")) … … 795 794 */ 796 795 int64_t type = 0; 797 int rc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);798 if (!RT_SUCCESS( rc) || type != TYPE_DISK)796 int vrc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName); 797 if (!RT_SUCCESS(vrc) || type != TYPE_DISK) 799 798 { 800 799 if (noProbe() || !probeNVME(mszNode)) 801 800 { 802 801 char szDriver[16]; 803 rc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", 804 mpcszName, "device/device/driver"); 805 if (RT_FAILURE(rc) || RTStrCmp(szDriver, "nvme")) 806 return; 802 vrc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", mpcszName, "device/device/driver"); 803 if (RT_FAILURE(vrc) || RTStrCmp(szDriver, "nvme")) 804 return; 807 805 } 808 806 } … … 810 808 char szModel[128]; 811 809 size_t cbRead = 0; 812 rc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), &cbRead, "block/%s/device/vendor", mpcszName);810 vrc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), &cbRead, "block/%s/device/vendor", mpcszName); 813 811 szVendor[cbRead] = '\0'; 814 812 /* Assume the model is always present. Vendor is not present for NVME disks */ 815 813 cbRead = 0; 816 rc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), &cbRead, "block/%s/device/model", mpcszName);814 vrc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), &cbRead, "block/%s/device/model", mpcszName); 817 815 szModel[cbRead] = '\0'; 818 if (RT_SUCCESS( rc))816 if (RT_SUCCESS(vrc)) 819 817 { 820 818 misValid = true; … … 870 868 unsigned cFound = 0; 871 869 RTDIR hDir = NIL_RTDIR; 872 int rc = RTDirOpen(&hDir, "/sys/block");870 int vrc = RTDirOpen(&hDir, "/sys/block"); 873 871 /* This might mean that sysfs semantics have changed */ 874 AssertReturn( rc != VERR_FILE_NOT_FOUND, VINF_SUCCESS);875 if (RT_SUCCESS( rc))872 AssertReturn(vrc != VERR_FILE_NOT_FOUND, VINF_SUCCESS); 873 if (RT_SUCCESS(vrc)) 876 874 { 877 875 for (;;) 878 876 { 879 877 RTDIRENTRY entry; 880 rc = RTDirRead(hDir, &entry, NULL);881 Assert( rc != VERR_BUFFER_OVERFLOW); /* Should never happen... */882 if (RT_FAILURE( rc)) /* Including overflow and no more files */878 vrc = RTDirRead(hDir, &entry, NULL); 879 Assert(vrc != VERR_BUFFER_OVERFLOW); /* Should never happen... */ 880 if (RT_FAILURE(vrc)) /* Including overflow and no more files */ 883 881 break; 884 882 if (entry.szName[0] == '.') … … 895 893 catch (std::bad_alloc &e) 896 894 { 897 rc = VERR_NO_MEMORY;895 vrc = VERR_NO_MEMORY; 898 896 break; 899 897 } … … 902 900 RTDirClose(hDir); 903 901 } 904 if ( rc == VERR_NO_MORE_FILES)905 rc = VINF_SUCCESS;906 else if (RT_FAILURE( rc))902 if (vrc == VERR_NO_MORE_FILES) 903 vrc = VINF_SUCCESS; 904 else if (RT_FAILURE(vrc)) 907 905 /* Clean up again */ 908 906 while (cFound-- > 0) … … 910 908 if (pfSuccess) 911 909 *pfSuccess = fSuccess; 912 LogFlow ((" rc=%Rrc, fSuccess=%u\n",rc, (unsigned)fSuccess));913 return rc;910 LogFlow (("vrc=%Rrc, fSuccess=%u\n", vrc, (unsigned)fSuccess)); 911 return vrc; 914 912 } 915 913 … … 1181 1179 # endif 1182 1180 1183 int rc = iwInit(&mWatches);1184 if (RT_SUCCESS( rc))1185 { 1186 rc = iwAddWatch(&mWatches, mpcszDevicesRoot);1187 if (RT_SUCCESS( rc))1188 rc = pipeCreateSimple(&mhWakeupPipeR, &mhWakeupPipeW);1189 } 1190 mStatus = rc;1191 if (RT_FAILURE( rc))1181 int vrc = iwInit(&mWatches); 1182 if (RT_SUCCESS(vrc)) 1183 { 1184 vrc = iwAddWatch(&mWatches, mpcszDevicesRoot); 1185 if (RT_SUCCESS(vrc)) 1186 vrc = pipeCreateSimple(&mhWakeupPipeR, &mhWakeupPipeW); 1187 } 1188 mStatus = vrc; 1189 if (RT_FAILURE(vrc)) 1192 1190 term(); 1193 1191 } … … 1247 1245 int hotplugInotifyImpl::Wait(RTMSINTERVAL aMillies) 1248 1246 { 1249 int rc;1250 1251 1247 AssertRCReturn(mStatus, VERR_WRONG_ORDER); 1252 1248 bool fEntered = ASMAtomicCmpXchgU32(&mfWaiting, 1, 0); … … 1255 1251 VECTOR_PTR(char *) vecpchDevs; 1256 1252 VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1257 rc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false);1258 if (RT_SUCCESS( rc))1253 int vrc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false); 1254 if (RT_SUCCESS(vrc)) 1259 1255 { 1260 1256 char **ppszEntry; 1261 1257 VEC_FOR_EACH(&vecpchDevs, char *, ppszEntry) 1262 if (RT_FAILURE( rc = iwAddWatch(&mWatches, *ppszEntry)))1258 if (RT_FAILURE(vrc = iwAddWatch(&mWatches, *ppszEntry))) 1263 1259 break; 1264 1260 1265 if (RT_SUCCESS( rc))1261 if (RT_SUCCESS(vrc)) 1266 1262 { 1267 1263 struct pollfd pollFD[MAX_POLLID]; … … 1275 1271 { 1276 1272 Assert(errno > 0); 1277 rc = RTErrConvertFromErrno(errno);1273 vrc = RTErrConvertFromErrno(errno); 1278 1274 } 1279 1275 else if (pollFD[RPIPE_ID].revents) 1280 1276 { 1281 rc = drainWakeupPipe();1282 if (RT_SUCCESS( rc))1283 rc = VERR_INTERRUPTED;1277 vrc = drainWakeupPipe(); 1278 if (RT_SUCCESS(vrc)) 1279 vrc = VERR_INTERRUPTED; 1284 1280 } 1285 1281 else if ((pollFD[INOTIFY_ID].revents)) 1286 1282 { 1287 1283 if (cPolled == 1) 1288 rc = drainInotify();1284 vrc = drainInotify(); 1289 1285 else 1290 AssertFailedStmt( rc = VERR_INTERNAL_ERROR);1286 AssertFailedStmt(vrc = VERR_INTERNAL_ERROR); 1291 1287 } 1292 1288 else 1293 1289 { 1294 1290 if (errno == 0 && cPolled == 0) 1295 rc = VERR_TIMEOUT;1291 vrc = VERR_TIMEOUT; 1296 1292 else 1297 AssertFailedStmt( rc = VERR_INTERNAL_ERROR);1293 AssertFailedStmt(vrc = VERR_INTERNAL_ERROR); 1298 1294 } 1299 1295 } … … 1302 1298 mfWaiting = 0; 1303 1299 VEC_CLEANUP_PTR(&vecpchDevs); 1304 return rc;1300 return vrc; 1305 1301 } 1306 1302 -
trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp
r98103 r98288 59 59 { 60 60 DBusError error; 61 int rc;62 61 63 rc = RTDBusLoadLib();64 if (RT_FAILURE( rc))62 int vrc = RTDBusLoadLib(); 63 if (RT_FAILURE(vrc)) 65 64 { 66 65 LogRel(("HostPowerServiceLinux: DBus library not found. Service not available.\n")); … … 92 91 93 92 /* Create the new worker thread. */ 94 rc = RTThreadCreate(&mThread, HostPowerServiceLinux::powerChangeNotificationThread, this, 0 /* cbStack */,95 RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "MainPower");96 if (RT_FAILURE( rc))93 vrc = RTThreadCreate(&mThread, HostPowerServiceLinux::powerChangeNotificationThread, this, 0 /* cbStack */, 94 RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "MainPower"); 95 if (RT_FAILURE(vrc)) 97 96 { 98 LogRel(("HostPowerServiceLinux: RTThreadCreate failed with %Rrc\n", rc));97 LogRel(("HostPowerServiceLinux: RTThreadCreate failed with %Rrc\n", vrc)); 99 98 dbus_connection_unref(mpConnection); 100 99 } -
trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp
r98103 r98288 126 126 { 127 127 /* Failed to get speed via sysfs, go to plan B. */ 128 int rc = NetIfAdpCtlOut(pszName, "speed", szBuf, sizeof(szBuf));129 if (RT_SUCCESS( rc))128 int vrc = NetIfAdpCtlOut(pszName, "speed", szBuf, sizeof(szBuf)); 129 if (RT_SUCCESS(vrc)) 130 130 uSpeed = RTStrToUInt32(szBuf); 131 131 } … … 230 230 { 231 231 char szDefaultIface[256]; 232 int rc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface));233 if (RT_FAILURE( rc))232 int vrc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface)); 233 if (RT_FAILURE(vrc)) 234 234 { 235 235 Log(("NetIfList: Failed to find default interface.\n")); … … 253 253 NETIFINFO Info; 254 254 RT_ZERO(Info); 255 rc = getInterfaceInfo(sock, pszName, &Info);256 if (RT_FAILURE( rc))255 vrc = getInterfaceInfo(sock, pszName, &Info); 256 if (RT_FAILURE(vrc)) 257 257 break; 258 258 if (Info.enmMediumType == NETIF_T_ETHERNET) … … 282 282 } 283 283 else 284 rc = VERR_INTERNAL_ERROR;285 286 return rc;284 vrc = VERR_INTERNAL_ERROR; 285 286 return vrc; 287 287 } 288 288 289 289 int NetIfGetConfigByName(PNETIFINFO pInfo) 290 290 { 291 int rc = VINF_SUCCESS;292 291 int sock = socket(AF_INET, SOCK_DGRAM, 0); 293 292 if (sock < 0) 294 293 return VERR_NOT_IMPLEMENTED; 295 rc = getInterfaceInfo(sock, pInfo->szShortName, pInfo);294 int vrc = getInterfaceInfo(sock, pInfo->szShortName, pInfo); 296 295 close(sock); 297 return rc;296 return vrc; 298 297 } 299 298 -
trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp
r98103 r98288 114 114 115 115 uint64_t cb; 116 int rc = RTSystemQueryTotalRam(&cb);117 if (RT_FAILURE( rc))116 int vrc = RTSystemQueryTotalRam(&cb); 117 if (RT_FAILURE(vrc)) 118 118 mTotalRAM = 0; 119 119 else … … 130 130 { 131 131 VMProcessStats vmStats; 132 int rc = getRawProcessStats(*it, &vmStats.cpuUser, &vmStats.cpuKernel, &vmStats.pagesUsed);132 int vrc = getRawProcessStats(*it, &vmStats.cpuUser, &vmStats.cpuKernel, &vmStats.pagesUsed); 133 133 /* On failure, do NOT stop. Just skip the entry. Having the stats for 134 134 * one (probably broken) process frozen/zero is a minor issue compared 135 135 * to not updating many process stats and the host cpu stats. */ 136 if (RT_SUCCESS( rc))136 if (RT_SUCCESS(vrc)) 137 137 mProcessStats[*it] = vmStats; 138 138 } … … 146 146 int CollectorLinux::_getRawHostCpuLoad() 147 147 { 148 int rc = VINF_SUCCESS;148 int vrc = VINF_SUCCESS; 149 149 long long unsigned uUser, uNice, uKernel, uIdle, uIowait, uIrq, uSoftirq; 150 150 FILE *f = fopen("/proc/stat", "r"); … … 184 184 } 185 185 else 186 rc = VERR_FILE_IO_ERROR;186 vrc = VERR_FILE_IO_ERROR; 187 187 } 188 188 else 189 rc = VERR_FILE_IO_ERROR;189 vrc = VERR_FILE_IO_ERROR; 190 190 fclose(f); 191 191 } 192 192 else 193 rc = VERR_ACCESS_DENIED;194 195 return rc;193 vrc = VERR_ACCESS_DENIED; 194 195 return vrc; 196 196 } 197 197 … … 223 223 AssertReturn(mTotalRAM, VERR_INTERNAL_ERROR); 224 224 uint64_t cb; 225 int rc = RTSystemQueryAvailableRam(&cb);226 if (RT_SUCCESS( rc))225 int vrc = RTSystemQueryAvailableRam(&cb); 226 if (RT_SUCCESS(vrc)) 227 227 { 228 228 *total = mTotalRAM; … … 230 230 *used = *total - *available; 231 231 } 232 return rc;232 return vrc; 233 233 } 234 234 … … 257 257 Assert(pszPath); 258 258 259 int rc = VINF_SUCCESS;259 int vrc = VINF_SUCCESS; 260 260 if (!RTLinuxSysFsExists(pszPath)) 261 rc = VERR_FILE_NOT_FOUND;261 vrc = VERR_FILE_NOT_FOUND; 262 262 else 263 263 { 264 264 int64_t cSize = 0; 265 rc = RTLinuxSysFsReadIntFile(0, &cSize, pszPath);266 if (RT_SUCCESS( rc))265 vrc = RTLinuxSysFsReadIntFile(0, &cSize, pszPath); 266 if (RT_SUCCESS(vrc)) 267 267 *size = cSize * 512; 268 268 } 269 269 RTStrFree(pszPath); 270 return rc;270 return vrc; 271 271 } 272 272 … … 286 286 int CollectorLinux::getRawProcessStats(RTPROCESS process, uint64_t *cpuUser, uint64_t *cpuKernel, ULONG *memPagesUsed) 287 287 { 288 int rc = VINF_SUCCESS;288 int vrc = VINF_SUCCESS; 289 289 char *pszName; 290 290 pid_t pid2; … … 316 316 } 317 317 else 318 rc = VERR_FILE_IO_ERROR;318 vrc = VERR_FILE_IO_ERROR; 319 319 fclose(f); 320 320 } 321 321 else 322 rc = VERR_ACCESS_DENIED;323 324 return rc;322 vrc = VERR_ACCESS_DENIED; 323 324 return vrc; 325 325 } 326 326 … … 334 334 335 335 int64_t cSize = 0; 336 int rc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);337 if (RT_FAILURE( rc))338 return rc;336 int vrc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName); 337 if (RT_FAILURE(vrc)) 338 return vrc; 339 339 340 340 *rx = cSize; … … 344 344 return VERR_FILE_NOT_FOUND; 345 345 346 rc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);347 if (RT_FAILURE( rc))348 return rc;346 vrc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName); 347 if (RT_FAILURE(vrc)) 348 return vrc; 349 349 350 350 *tx = cSize; … … 355 355 { 356 356 #if 0 357 int rc = VINF_SUCCESS;357 int vrc = VINF_SUCCESS; 358 358 char szIfName[/*IFNAMSIZ*/ 16 + 36]; 359 359 long long unsigned int u64Busy, tmp; … … 370 370 } 371 371 else 372 rc = VERR_FILE_IO_ERROR;372 vrc = VERR_FILE_IO_ERROR; 373 373 fclose(f); 374 374 } 375 375 else 376 rc = VERR_ACCESS_DENIED;376 vrc = VERR_ACCESS_DENIED; 377 377 #else 378 int rc = VERR_MISSING;378 int vrc = VERR_MISSING; 379 379 FILE *f = fopen("/proc/diskstats", "r"); 380 380 if (f) … … 406 406 *disk_ms = u64Busy; 407 407 *total_ms = (uint64_t)(mSingleUser + mSingleKernel + mSingleIdle) * 1000 / mHZ; 408 rc = VINF_SUCCESS;408 vrc = VINF_SUCCESS; 409 409 } 410 410 else 411 rc = VERR_FILE_IO_ERROR;411 vrc = VERR_FILE_IO_ERROR; 412 412 break; 413 413 } … … 417 417 #endif 418 418 419 return rc;419 return vrc; 420 420 } 421 421 … … 525 525 { 526 526 char szVolInfo[RTPATH_MAX]; 527 int rc = RTPathAppPrivateArch(szVolInfo, 528 sizeof(szVolInfo) - sizeof("/" VBOXVOLINFO_NAME " ") - strlen(pcszVolume)); 529 if (RT_FAILURE(rc)) 530 { 531 LogRel(("VolInfo: Failed to get program path, rc=%Rrc\n", rc)); 527 int vrc = RTPathAppPrivateArch(szVolInfo, sizeof(szVolInfo) - sizeof("/" VBOXVOLINFO_NAME " ") - strlen(pcszVolume)); 528 if (RT_FAILURE(vrc)) 529 { 530 LogRel(("VolInfo: Failed to get program path, vrc=%Rrc\n", vrc)); 532 531 return; 533 532 } … … 568 567 char szFsName[1024]; 569 568 /* Try to resolve symbolic link if necessary. Yes, we access the file system here! */ 570 int rc = RTPathReal(mntent->mnt_fsname, szFsName, sizeof(szFsName));571 if (RT_FAILURE( rc))569 int vrc = RTPathReal(mntent->mnt_fsname, szFsName, sizeof(szFsName)); 570 if (RT_FAILURE(vrc)) 572 571 continue; /* something got wrong, just ignore this path */ 573 572 /* check against the actual mtab entry, NOT the real path as /dev/mapper/xyz is -
trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp
r98103 r98288 293 293 } 294 294 295 int rc = usbfsReadSkipSuffix(&pszNext);296 if (RT_FAILURE( rc))297 return rc;295 int vrc = usbfsReadSkipSuffix(&pszNext); 296 if (RT_FAILURE(vrc)) 297 return vrc; 298 298 299 299 *ppszNext = pszNext; … … 379 379 * Validate and skip stuff following the number. 380 380 */ 381 int rc = usbfsReadSkipSuffix(&pszNext);382 if (RT_FAILURE( rc))383 return rc;381 int vrc = usbfsReadSkipSuffix(&pszNext); 382 if (RT_FAILURE(vrc)) 383 return vrc; 384 384 *ppszNext = pszNext; 385 385 … … 471 471 /** Just a worker for USBProxyServiceLinux::getDevices that avoids some code duplication. */ 472 472 static int usbfsAddDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, const char *pszUsbfsRoot, 473 bool fUnsupportedDevicesToo, int rc)473 bool fUnsupportedDevicesToo, int vrc) 474 474 { 475 475 /* usbDeterminState requires the address. */ … … 495 495 { 496 496 deviceFree(pDevNew); 497 rc = VERR_NO_MEMORY;497 vrc = VERR_NO_MEMORY; 498 498 } 499 499 } 500 500 else 501 501 { 502 rc = VERR_NO_MEMORY;502 vrc = VERR_NO_MEMORY; 503 503 deviceFreeMembers(pDev); 504 504 } 505 505 506 return rc;506 return vrc; 507 507 } 508 508 … … 535 535 PUSBDEVICE pFirst = NULL; 536 536 FILE *pFile = NULL; 537 int rc; 538 rc = usbfsOpenDevicesFile(pszUsbfsRoot, &pFile); 539 if (RT_SUCCESS(rc)) 537 int vrc = usbfsOpenDevicesFile(pszUsbfsRoot, &pFile); 538 if (RT_SUCCESS(vrc)) 540 539 { 541 540 PUSBDEVICE *ppNext = NULL; … … 547 546 548 547 /* Set close on exit and hope no one is racing us. */ 549 rc = fcntl(fileno(pFile), F_SETFD, FD_CLOEXEC) >= 0550 ? VINF_SUCCESS551 : RTErrConvertFromErrno(errno);552 while ( RT_SUCCESS(rc)553 && fgets(szLine, sizeof(szLine), pFile))548 vrc = fcntl(fileno(pFile), F_SETFD, FD_CLOEXEC) >= 0 549 ? VINF_SUCCESS 550 : RTErrConvertFromErrno(errno); 551 while ( RT_SUCCESS(vrc) 552 && fgets(szLine, sizeof(szLine), pFile)) 554 553 { 555 554 char *psz; … … 596 595 AssertMsg(cHits >= 3 || cHits == 0, ("cHits=%d\n", cHits)); 597 596 if (cHits >= 3) 598 rc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo,rc);597 vrc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, vrc); 599 598 else 600 599 deviceFreeMembers(&Dev); … … 606 605 607 606 /* parse the line. */ 608 while (*psz && RT_SUCCESS( rc))607 while (*psz && RT_SUCCESS(vrc)) 609 608 { 610 609 if (PREFIX("Bus=")) 611 rc = usbfsRead8(pszValue, 10, &Dev.bBus, &psz);610 vrc = usbfsRead8(pszValue, 10, &Dev.bBus, &psz); 612 611 else if (PREFIX("Port=")) 613 rc = usbfsRead8(pszValue, 10, &Dev.bPort, &psz);612 vrc = usbfsRead8(pszValue, 10, &Dev.bPort, &psz); 614 613 else if (PREFIX("Spd=")) 615 rc = usbfsReadSpeed(pszValue, &Dev.enmSpeed, &psz);614 vrc = usbfsReadSpeed(pszValue, &Dev.enmSpeed, &psz); 616 615 else if (PREFIX("Dev#=")) 617 rc = usbfsRead8(pszValue, 10, &Dev.bDevNum, &psz);616 vrc = usbfsRead8(pszValue, 10, &Dev.bDevNum, &psz); 618 617 else 619 618 psz = usbfsReadSkip(psz); … … 644 643 */ 645 644 case 'D': 646 while (*psz && RT_SUCCESS( rc))645 while (*psz && RT_SUCCESS(vrc)) 647 646 { 648 647 if (PREFIX("Ver=")) 649 rc = usbfsReadBCD(pszValue, 16, &Dev.bcdUSB, &psz);648 vrc = usbfsReadBCD(pszValue, 16, &Dev.bcdUSB, &psz); 650 649 else if (PREFIX("Cls=")) 651 650 { 652 rc = usbfsRead8(pszValue, 16, &Dev.bDeviceClass, &psz);653 if (RT_SUCCESS( rc) && Dev.bDeviceClass == 9 /* HUB */)651 vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceClass, &psz); 652 if (RT_SUCCESS(vrc) && Dev.bDeviceClass == 9 /* HUB */) 654 653 Dev.enmState = USBDEVICESTATE_UNSUPPORTED; 655 654 } 656 655 else if (PREFIX("Sub=")) 657 rc = usbfsRead8(pszValue, 16, &Dev.bDeviceSubClass, &psz);656 vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceSubClass, &psz); 658 657 else if (PREFIX("Prot=")) 659 rc = usbfsRead8(pszValue, 16, &Dev.bDeviceProtocol, &psz);658 vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceProtocol, &psz); 660 659 //else if (PREFIX("MxPS=")) 661 // rc = usbRead16(pszValue, 10, &Dev.wMaxPacketSize, &psz);660 // vrc = usbRead16(pszValue, 10, &Dev.wMaxPacketSize, &psz); 662 661 else if (PREFIX("#Cfgs=")) 663 rc = usbfsRead8(pszValue, 10, &Dev.bNumConfigurations, &psz);662 vrc = usbfsRead8(pszValue, 10, &Dev.bNumConfigurations, &psz); 664 663 else 665 664 psz = usbfsReadSkip(psz); … … 677 676 */ 678 677 case 'P': 679 while (*psz && RT_SUCCESS( rc))678 while (*psz && RT_SUCCESS(vrc)) 680 679 { 681 680 if (PREFIX("Vendor=")) 682 rc = usbfsRead16(pszValue, 16, &Dev.idVendor, &psz);681 vrc = usbfsRead16(pszValue, 16, &Dev.idVendor, &psz); 683 682 else if (PREFIX("ProdID=")) 684 rc = usbfsRead16(pszValue, 16, &Dev.idProduct, &psz);683 vrc = usbfsRead16(pszValue, 16, &Dev.idProduct, &psz); 685 684 else if (PREFIX("Rev=")) 686 rc = usbfsReadBCD(pszValue, 16, &Dev.bcdDevice, &psz);685 vrc = usbfsReadBCD(pszValue, 16, &Dev.bcdDevice, &psz); 687 686 else 688 687 psz = usbfsReadSkip(psz); … … 697 696 case 'S': 698 697 if (PREFIX("Manufacturer=")) 699 rc = usbfsReadStr(pszValue, &Dev.pszManufacturer);698 vrc = usbfsReadStr(pszValue, &Dev.pszManufacturer); 700 699 else if (PREFIX("Product=")) 701 rc = usbfsReadStr(pszValue, &Dev.pszProduct);700 vrc = usbfsReadStr(pszValue, &Dev.pszProduct); 702 701 else if (PREFIX("SerialNumber=")) 703 702 { 704 rc = usbfsReadStr(pszValue, &Dev.pszSerialNumber);705 if (RT_SUCCESS( rc))703 vrc = usbfsReadStr(pszValue, &Dev.pszSerialNumber); 704 if (RT_SUCCESS(vrc)) 706 705 Dev.u64SerialHash = USBLibHashSerial(pszValue); 707 706 } … … 735 734 { 736 735 /* Check for thing we don't support. */ 737 while (*psz && RT_SUCCESS( rc))736 while (*psz && RT_SUCCESS(vrc)) 738 737 { 739 738 if (PREFIX("Driver=")) 740 739 { 741 740 const char *pszDriver = NULL; 742 rc = usbfsReadStr(pszValue, &pszDriver);741 vrc = usbfsReadStr(pszValue, &pszDriver); 743 742 if ( !pszDriver 744 743 || !*pszDriver … … 756 755 { 757 756 uint8_t bInterfaceClass; 758 rc = usbfsRead8(pszValue, 16, &bInterfaceClass, &psz);759 if (RT_SUCCESS( rc) && bInterfaceClass == 9 /* HUB */)757 vrc = usbfsRead8(pszValue, 16, &bInterfaceClass, &psz); 758 if (RT_SUCCESS(vrc) && bInterfaceClass == 9 /* HUB */) 760 759 Dev.enmState = USBDEVICESTATE_UNSUPPORTED; 761 760 } … … 789 788 AssertMsg(cHits >= 3 || cHits == 0, ("cHits=%d\n", cHits)); 790 789 if (cHits >= 3) 791 rc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo,rc);790 vrc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, vrc); 792 791 793 792 /* 794 793 * Success? 795 794 */ 796 if (RT_FAILURE( rc))795 if (RT_FAILURE(vrc)) 797 796 { 798 797 while (pFirst) … … 804 803 } 805 804 } 806 if (RT_FAILURE( rc))807 LogFlow(("USBProxyServiceLinux::getDevices: rc=%Rrc\n",rc));805 if (RT_FAILURE(vrc)) 806 LogFlow(("USBProxyServiceLinux::getDevices: vrc=%Rrc\n", vrc)); 808 807 return pFirst; 809 808 } … … 892 891 893 892 int64_t device; 894 int rc = RTLinuxSysFsReadIntFile(10, &device, "%s/devnum", pszNode);895 if (RT_FAILURE( rc))893 int vrc = RTLinuxSysFsReadIntFile(10, &device, "%s/devnum", pszNode); 894 if (RT_FAILURE(vrc)) 896 895 return VINF_SUCCESS; 897 896 … … 901 900 902 901 char szDevPath[RTPATH_MAX]; 903 rc = RTLinuxCheckDevicePath(devnum, RTFS_TYPE_DEV_CHAR, 904 szDevPath, sizeof(szDevPath), 905 "%s/%.3d/%.3d", 906 pszDevicesRoot, bus, device); 907 if (RT_FAILURE(rc)) 902 vrc = RTLinuxCheckDevicePath(devnum, RTFS_TYPE_DEV_CHAR, szDevPath, sizeof(szDevPath), 903 "%s/%.3d/%.3d", pszDevicesRoot, bus, device); 904 if (RT_FAILURE(vrc)) 908 905 return VINF_SUCCESS; 909 906 … … 911 908 if (usbsysfsInitDevInfo(&info, szDevPath, pszNode)) 912 909 { 913 rc = VEC_PUSH_BACK_OBJ(pvecDevInfo, USBDeviceInfo, &info);914 if (RT_SUCCESS( rc))910 vrc = VEC_PUSH_BACK_OBJ(pvecDevInfo, USBDeviceInfo, &info); 911 if (RT_SUCCESS(vrc)) 915 912 return VINF_SUCCESS; 916 913 } … … 991 988 if (pszDup) 992 989 { 993 int rc = VEC_PUSH_BACK_PTR(&pInfo->mvecpszInterfaces, char *, pszDup);994 if (RT_SUCCESS( rc))990 int vrc = VEC_PUSH_BACK_PTR(&pInfo->mvecpszInterfaces, char *, pszDup); 991 if (RT_SUCCESS(vrc)) 995 992 return VINF_SUCCESS; 996 993 RTStrFree(pszDup); … … 1010 1007 { 1011 1008 struct dirent entry, *pResult; 1012 int err , rc;1009 int err; 1013 1010 1014 1011 #if RT_GNUC_PREREQ(4, 6) … … 1033 1030 if (!pszPathCopy) 1034 1031 return VERR_NO_MEMORY; 1035 if (RT_FAILURE(rc = VEC_PUSH_BACK_PTR(pvecpchDevs, char *, pszPathCopy))) 1036 return rc; 1032 int vrc = VEC_PUSH_BACK_PTR(pvecpchDevs, char *, pszPathCopy); 1033 if (RT_FAILURE(vrc)) 1034 return vrc; 1037 1035 } 1038 1036 return RTErrConvertFromErrno(err); … … 1058 1056 if (!pDir) 1059 1057 return RTErrConvertFromErrno(errno); 1060 int rc = usbsysfsReadFilePathsFromDir(pszPath, pDir, pvecpchDevs);1061 if (closedir(pDir) < 0 && RT_SUCCESS( rc))1062 rc = RTErrConvertFromErrno(errno);1063 return rc;1058 int vrc = usbsysfsReadFilePathsFromDir(pszPath, pDir, pvecpchDevs); 1059 if (closedir(pDir) < 0 && RT_SUCCESS(vrc)) 1060 vrc = RTErrConvertFromErrno(errno); 1061 return vrc; 1064 1062 } 1065 1063 … … 1081 1079 LogFlowFunc (("pvecDevInfo=%p\n", pvecDevInfo)); 1082 1080 1083 int rc = usbsysfsReadFilePaths("/sys/bus/usb/devices", pvecpchDevs);1084 if (RT_FAILURE( rc))1085 return rc;1081 int vrc = usbsysfsReadFilePaths("/sys/bus/usb/devices", pvecpchDevs); 1082 if (RT_FAILURE(vrc)) 1083 return vrc; 1086 1084 1087 1085 char **ppszEntry; 1088 1086 VEC_FOR_EACH(pvecpchDevs, char *, ppszEntry) 1089 1087 { 1090 rc = usbsysfsAddIfDevice(pszDevicesRoot, *ppszEntry, pvecDevInfo);1091 if (RT_FAILURE( rc))1092 return rc;1088 vrc = usbsysfsAddIfDevice(pszDevicesRoot, *ppszEntry, pvecDevInfo); 1089 if (RT_FAILURE(vrc)) 1090 return vrc; 1093 1091 } 1094 1092 … … 1097 1095 VEC_FOR_EACH(pvecpchDevs, char *, ppszEntry) 1098 1096 { 1099 rc = usbsysfsAddIfInterfaceOf(*ppszEntry, pInfo);1100 if (RT_FAILURE( rc))1101 return rc;1097 vrc = usbsysfsAddIfInterfaceOf(*ppszEntry, pInfo); 1098 if (RT_FAILURE(vrc)) 1099 return vrc; 1102 1100 } 1103 1101 return VINF_SUCCESS; … … 1112 1110 LogFlowFunc(("entered\n")); 1113 1111 VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1114 int rc = usbsysfsEnumerateHostDevicesWorker(pszDevicesRoot, pvecDevInfo, &vecpchDevs);1112 int vrc = usbsysfsEnumerateHostDevicesWorker(pszDevicesRoot, pvecDevInfo, &vecpchDevs); 1115 1113 VEC_CLEANUP_PTR(&vecpchDevs); 1116 LogFlowFunc((" rc=%Rrc\n",rc));1117 return rc;1114 LogFlowFunc(("vrc=%Rrc\n", vrc)); 1115 return vrc; 1118 1116 } 1119 1117 … … 1185 1183 ? pchDot + 1 1186 1184 : pchDash + 1; 1187 int rc = RTStrToUInt8Full(pszLastPort, 10, pu8Port);1188 if ( rc != VINF_SUCCESS)1189 { 1190 Log(("usbGetPortFromSysfsPath(%s): failed [3], rc=%Rrc\n", pszPath,rc));1185 int vrc = RTStrToUInt8Full(pszLastPort, 10, pu8Port); 1186 if (vrc != VINF_SUCCESS) 1187 { 1188 Log(("usbGetPortFromSysfsPath(%s): failed [3], vrc=%Rrc\n", pszPath, vrc)); 1191 1189 return VERR_INVALID_PARAMETER; 1192 1190 } … … 1219 1217 1220 1218 pszBuf = RTStrStripL(pszBuf); 1221 int rc = RTStrToInt32Ex(pszBuf, &pszNext, 16, &i32);1222 if ( RT_FAILURE( rc)1223 || rc == VWRN_NUMBER_TOO_BIG1219 int vrc = RTStrToInt32Ex(pszBuf, &pszNext, 16, &i32); 1220 if ( RT_FAILURE(vrc) 1221 || vrc == VWRN_NUMBER_TOO_BIG 1224 1222 || i32 < 0) 1225 1223 return VERR_NUMBER_TOO_BIG; … … 1229 1227 return VERR_NUMBER_TOO_BIG; 1230 1228 int32_t i32Lo; 1231 rc = RTStrToInt32Ex(pszNext+1, &pszNext, 16, &i32Lo);1232 if ( RT_FAILURE( rc)1233 || rc == VWRN_NUMBER_TOO_BIG1229 vrc = RTStrToInt32Ex(pszNext+1, &pszNext, 16, &i32Lo); 1230 if ( RT_FAILURE(vrc) 1231 || vrc == VWRN_NUMBER_TOO_BIG 1234 1232 || i32Lo > 255 1235 1233 || i32Lo < 0) … … 1252 1250 * @returns uint8_t value of the given property. 1253 1251 * @param uBase The base of the number in the sysfs property. 1254 * @param bDef The default to set on error.1252 * @param fDef The default to set on error. 1255 1253 * @param pszFormat The format string for the property. 1256 1254 * @param ... Arguments for the format string. 1257 1255 */ 1258 static uint8_t usbsysfsReadDevicePropertyU8Def(unsigned uBase, uint8_t bDef, const char *pszFormat, ...)1256 static uint8_t usbsysfsReadDevicePropertyU8Def(unsigned uBase, uint8_t fDef, const char *pszFormat, ...) 1259 1257 { 1260 1258 int64_t i64Tmp = 0; … … 1262 1260 va_list va; 1263 1261 va_start(va, pszFormat); 1264 int rc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);1262 int vrc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va); 1265 1263 va_end(va); 1266 if (RT_SUCCESS( rc))1264 if (RT_SUCCESS(vrc)) 1267 1265 return (uint8_t)i64Tmp; 1268 else 1269 return bDef; 1266 return fDef; 1270 1267 } 1271 1268 … … 1287 1284 va_list va; 1288 1285 va_start(va, pszFormat); 1289 int rc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);1286 int vrc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va); 1290 1287 va_end(va); 1291 if (RT_SUCCESS( rc))1288 if (RT_SUCCESS(vrc)) 1292 1289 return (uint16_t)i64Tmp; 1293 else 1294 return u16Def; 1290 return u16Def; 1295 1291 } 1296 1292 … … 1298 1294 static void usbsysfsFillInDevice(USBDEVICE *pDev, USBDeviceInfo *pInfo) 1299 1295 { 1300 int rc;1296 int vrc; 1301 1297 const char *pszSysfsPath = pInfo->mSysfsPath; 1302 1298 … … 1319 1315 1320 1316 /* For simplicity, we just do strcmps on the next one. */ 1321 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/speed", pszSysfsPath);1322 if (RT_FAILURE( rc) || cchRead == sizeof(szBuf))1317 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/speed", pszSysfsPath); 1318 if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf)) 1323 1319 pDev->enmState = USBDEVICESTATE_UNSUPPORTED; 1324 1320 else … … 1329 1325 : USBDEVICESPEED_UNKNOWN; 1330 1326 1331 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/version", pszSysfsPath);1332 if (RT_FAILURE( rc) || cchRead == sizeof(szBuf))1327 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/version", pszSysfsPath); 1328 if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf)) 1333 1329 pDev->enmState = USBDEVICESTATE_UNSUPPORTED; 1334 1330 else 1335 1331 { 1336 rc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdUSB);1337 if (RT_FAILURE( rc))1332 vrc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdUSB); 1333 if (RT_FAILURE(vrc)) 1338 1334 { 1339 1335 pDev->enmState = USBDEVICESTATE_UNSUPPORTED; … … 1342 1338 } 1343 1339 1344 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/bcdDevice", pszSysfsPath);1345 if (RT_FAILURE( rc) || cchRead == sizeof(szBuf))1340 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/bcdDevice", pszSysfsPath); 1341 if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf)) 1346 1342 pDev->bcdDevice = UINT16_MAX; 1347 1343 else 1348 1344 { 1349 rc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdDevice);1350 if (RT_FAILURE( rc))1345 vrc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdDevice); 1346 if (RT_FAILURE(vrc)) 1351 1347 pDev->bcdDevice = UINT16_MAX; 1352 1348 } 1353 1349 1354 1350 /* Now do things that need string duplication */ 1355 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/product", pszSysfsPath);1356 if (RT_SUCCESS( rc) && cchRead < sizeof(szBuf))1351 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/product", pszSysfsPath); 1352 if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf)) 1357 1353 { 1358 1354 USBLibPurgeEncoding(szBuf); … … 1360 1356 } 1361 1357 1362 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/serial", pszSysfsPath);1363 if (RT_SUCCESS( rc) && cchRead < sizeof(szBuf))1358 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/serial", pszSysfsPath); 1359 if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf)) 1364 1360 { 1365 1361 USBLibPurgeEncoding(szBuf); … … 1368 1364 } 1369 1365 1370 rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/manufacturer", pszSysfsPath);1371 if (RT_SUCCESS( rc) && cchRead < sizeof(szBuf))1366 vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/manufacturer", pszSysfsPath); 1367 if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf)) 1372 1368 { 1373 1369 USBLibPurgeEncoding(szBuf); … … 1383 1379 VEC_FOR_EACH(&pInfo->mvecpszInterfaces, char *, ppszIf) 1384 1380 { 1385 rc = RTLinuxSysFsGetLinkDest(szBuf, sizeof(szBuf), NULL, "%s/driver", *ppszIf);1386 if (RT_SUCCESS( rc) && pDev->enmState != USBDEVICESTATE_UNSUPPORTED)1381 vrc = RTLinuxSysFsGetLinkDest(szBuf, sizeof(szBuf), NULL, "%s/driver", *ppszIf); 1382 if (RT_SUCCESS(vrc) && pDev->enmState != USBDEVICESTATE_UNSUPPORTED) 1387 1383 pDev->enmState = (strcmp(szBuf, "hub") == 0) 1388 1384 ? USBDEVICESTATE_UNSUPPORTED … … 1416 1412 VECTOR_OBJ(USBDeviceInfo) vecDevInfo; 1417 1413 USBDeviceInfo *pInfo; 1418 int rc;1419 1414 1420 1415 VEC_INIT_OBJ(&vecDevInfo, USBDeviceInfo, usbsysfsCleanupDevInfo); 1421 rc = usbsysfsEnumerateHostDevices(pszDevicesRoot, &vecDevInfo);1422 if (RT_FAILURE( rc))1416 int vrc = usbsysfsEnumerateHostDevices(pszDevicesRoot, &vecDevInfo); 1417 if (RT_FAILURE(vrc)) 1423 1418 return NULL; 1424 1419 VEC_FOR_EACH(&vecDevInfo, USBDeviceInfo, pInfo) … … 1426 1421 USBDEVICE *pDev = (USBDEVICE *)RTMemAllocZ(sizeof(USBDEVICE)); 1427 1422 if (!pDev) 1428 rc = VERR_NO_MEMORY;1429 if (RT_SUCCESS( rc))1423 vrc = VERR_NO_MEMORY; 1424 if (RT_SUCCESS(vrc)) 1430 1425 usbsysfsFillInDevice(pDev, pInfo); 1431 if ( RT_SUCCESS( rc)1426 if ( RT_SUCCESS(vrc) 1432 1427 && ( pDev->enmState != USBDEVICESTATE_UNSUPPORTED 1433 1428 || fUnsupportedDevicesToo) … … 1445 1440 else 1446 1441 deviceFree(pDev); 1447 if (RT_FAILURE( rc))1442 if (RT_FAILURE(vrc)) 1448 1443 break; 1449 1444 } 1450 if (RT_FAILURE( rc))1445 if (RT_FAILURE(vrc)) 1451 1446 deviceListFree(&pFirst); 1452 1447 -
trunk/src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp
r98103 r98288 99 99 100 100 const char *pcszDevicesRoot; 101 int rc = USBProxyLinuxChooseMethod(&mUsingUsbfsDevices, &pcszDevicesRoot);102 if (RT_SUCCESS( rc))101 int vrc = USBProxyLinuxChooseMethod(&mUsingUsbfsDevices, &pcszDevicesRoot); 102 if (RT_SUCCESS(vrc)) 103 103 { 104 104 mDevicesRoot = pcszDevicesRoot; 105 rc = mUsingUsbfsDevices ? initUsbfs() : initSysfs();105 vrc = mUsingUsbfsDevices ? initUsbfs() : initSysfs(); 106 106 /* For the day when we have VBoxSVC release logging... */ 107 LogRel((RT_SUCCESS( rc) ? "Successfully initialised host USB using %s\n"108 : "Failed to initialise host USB using %s\n",107 LogRel((RT_SUCCESS(vrc) ? "Successfully initialised host USB using %s\n" 108 : "Failed to initialise host USB using %s\n", 109 109 mUsingUsbfsDevices ? "USBFS" : "sysfs")); 110 110 } 111 111 112 return rc;112 return vrc; 113 113 } 114 114 … … 146 146 * Open the devices file. 147 147 */ 148 int rc;148 int vrc; 149 149 char *pszDevices = RTPathJoinA(mDevicesRoot.c_str(), "devices"); 150 150 if (pszDevices) 151 151 { 152 rc = RTFileOpen(&mhFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);153 if (RT_SUCCESS( rc))152 vrc = RTFileOpen(&mhFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 153 if (RT_SUCCESS(vrc)) 154 154 { 155 rc = RTPipeCreate(&mhWakeupPipeR, &mhWakeupPipeW, 0 /*fFlags*/);156 if (RT_SUCCESS( rc))155 vrc = RTPipeCreate(&mhWakeupPipeR, &mhWakeupPipeW, 0 /*fFlags*/); 156 if (RT_SUCCESS(vrc)) 157 157 { 158 158 /* 159 159 * Start the poller thread. 160 160 */ 161 rc = start();162 if (RT_SUCCESS( rc))161 vrc = start(); 162 if (RT_SUCCESS(vrc)) 163 163 { 164 164 RTStrFree(pszDevices); … … 172 172 } 173 173 else 174 Log(("USBProxyBackendLinux::USBProxyBackendLinux: RTFilePipe failed with rc=%Rrc\n",rc));174 Log(("USBProxyBackendLinux::USBProxyBackendLinux: RTFilePipe failed with vrc=%Rrc\n", vrc)); 175 175 RTFileClose(mhFile); 176 176 } … … 180 180 else 181 181 { 182 rc = VERR_NO_MEMORY;182 vrc = VERR_NO_MEMORY; 183 183 Log(("USBProxyBackendLinux::USBProxyBackendLinux: out of memory!\n")); 184 184 } 185 185 186 LogFlowThisFunc(("returns failure!!! ( rc=%Rrc)\n",rc));187 return rc;186 LogFlowThisFunc(("returns failure!!! (vrc=%Rrc)\n", vrc)); 187 return vrc; 188 188 } 189 189 … … 207 207 return VERR_NO_MEMORY; 208 208 } 209 int rc = mpWaiter->getStatus();210 if (RT_SUCCESS( rc) || rc == VERR_TIMEOUT ||rc == VERR_TRY_AGAIN)211 rc = start();212 else if ( rc == VERR_NOT_SUPPORTED)209 int vrc = mpWaiter->getStatus(); 210 if (RT_SUCCESS(vrc) || vrc == VERR_TIMEOUT || vrc == VERR_TRY_AGAIN) 211 vrc = start(); 212 else if (vrc == VERR_NOT_SUPPORTED) 213 213 /* This can legitimately happen if hal or DBus are not running, but of 214 214 * course we can't start in this case. */ 215 rc = VINF_SUCCESS;216 return rc;215 vrc = VINF_SUCCESS; 216 return vrc; 217 217 218 218 #else /* !VBOX_USB_WITH_SYSFS */ … … 307 307 int USBProxyBackendLinux::wait(RTMSINTERVAL aMillies) 308 308 { 309 int rc;309 int vrc; 310 310 if (mUsingUsbfsDevices) 311 rc = waitUsbfs(aMillies);311 vrc = waitUsbfs(aMillies); 312 312 else 313 rc = waitSysfs(aMillies);314 return rc;313 vrc = waitSysfs(aMillies); 314 return vrc; 315 315 } 316 316 … … 338 338 PollFds[1].events = POLLIN | POLLERR | POLLHUP; 339 339 340 int rc = poll(&PollFds[0], 2, aMillies);341 if ( rc == 0)340 int iRc = poll(&PollFds[0], 2, aMillies); 341 if (iRc == 0) 342 342 return VERR_TIMEOUT; 343 if ( rc > 0)343 if (iRc > 0) 344 344 { 345 345 /* drain the pipe */ … … 347 347 { 348 348 char szBuf[WAKE_UP_STRING_LEN]; 349 rc= RTPipeReadBlocking(mhWakeupPipeR, szBuf, sizeof(szBuf), NULL);350 AssertRC( rc);349 int vrc2 = RTPipeReadBlocking(mhWakeupPipeR, szBuf, sizeof(szBuf), NULL); 350 AssertRC(vrc2); 351 351 } 352 352 return VINF_SUCCESS; … … 359 359 { 360 360 #ifdef VBOX_USB_WITH_SYSFS 361 int rc = mpWaiter->Wait(aMillies);362 if ( rc == VERR_TRY_AGAIN)361 int vrc = mpWaiter->Wait(aMillies); 362 if (vrc == VERR_TRY_AGAIN) 363 363 { 364 364 RTThreadYield(); 365 rc = VINF_SUCCESS;366 } 367 return rc;365 vrc = VINF_SUCCESS; 366 } 367 return vrc; 368 368 #else /* !VBOX_USB_WITH_SYSFS */ 369 369 return USBProxyService::wait(aMillies); … … 386 386 } 387 387 #endif /* VBOX_USB_WITH_SYSFS */ 388 int rc = RTPipeWriteBlocking(mhWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL);389 if (RT_SUCCESS( rc))388 int vrc = RTPipeWriteBlocking(mhWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL); 389 if (RT_SUCCESS(vrc)) 390 390 RTPipeFlush(mhWakeupPipeW); 391 LogFlowFunc(("returning %Rrc\n", rc));392 return rc;391 LogFlowFunc(("returning %Rrc\n", vrc)); 392 return vrc; 393 393 } 394 394
Note:
See TracChangeset
for help on using the changeset viewer.

