Changeset 50355 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Feb 6, 2014 5:55:07 PM (11 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r50197 r50355 372 372 * @return S_OK or error. 373 373 */ 374 STDMETHODIMP VirtualBox::CreateAppliance(IAppliance** anAppliance)374 HRESULT VirtualBox::createAppliance(ComPtr<IAppliance> &aAppliance) 375 375 { 376 376 HRESULT rc; … … 381 381 382 382 if (SUCCEEDED(rc)) 383 appliance.queryInterfaceTo(a nAppliance);383 appliance.queryInterfaceTo(aAppliance.asOutParam()); 384 384 385 385 return rc; … … 613 613 614 614 /* Get the system properties. */ 615 SystemProperties *pSysProps = mVirtualBox-> getSystemProperties();615 SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties(); 616 616 { 617 617 ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("iso"); … … 729 729 730 730 /* Get the system properties. */ 731 SystemProperties *pSysProps = mVirtualBox-> getSystemProperties();731 SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties(); 732 732 733 733 /* We need a proper source format description */ -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r50204 r50355 1872 1872 // Lock the media tree early to make sure nobody else tries to make changes 1873 1873 // to the tree. Also lock the IAppliance object for writing. 1874 AutoMultiWriteLock2 multiLock(&mVirtualBox-> getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS);1874 AutoMultiWriteLock2 multiLock(&mVirtualBox->i_getMediaTreeLockHandle(), this->lockHandle() COMMA_LOCKVAL_SRC_POS); 1875 1875 // Additional protect the IAppliance object, cause we leave the lock 1876 1876 // when starting the disk export and we don't won't block other … … 2055 2055 // Scope for the AutoReadLock 2056 2056 { 2057 SystemProperties *pSysProps = mVirtualBox-> getSystemProperties();2057 SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties(); 2058 2058 AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS); 2059 2059 // We are always exporting to VMDK stream optimized for now … … 2092 2092 if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage) 2093 2093 { 2094 rc = mVirtualBox-> findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk);2094 rc = mVirtualBox->i_findHardDiskByLocation(strSrcFilePath, true, &pSourceDisk); 2095 2095 if (FAILED(rc)) throw rc; 2096 2096 } 2097 2097 else//may be CD or DVD 2098 2098 { 2099 rc = mVirtualBox-> findDVDOrFloppyImage(DeviceType_DVD,2100 NULL,2101 strSrcFilePath,2102 true,2103 &pSourceDisk);2099 rc = mVirtualBox->i_findDVDOrFloppyImage(DeviceType_DVD, 2100 NULL, 2101 strSrcFilePath, 2102 true, 2103 &pSourceDisk); 2104 2104 if (FAILED(rc)) throw rc; 2105 2105 } -
trunk/src/VBox/Main/src-server/ApplianceImplIO.cpp
r50204 r50355 1689 1689 * Any existing file will be overwritten. 1690 1690 */ 1691 rc = VirtualBox:: ensureFilePathExists(Utf8Str(pcszFullFilenameOut), true /*fCreate*/);1691 rc = VirtualBox::i_ensureFilePathExists(Utf8Str(pcszFullFilenameOut), true /*fCreate*/); 1692 1692 if (RT_SUCCESS(rc)) 1693 1693 { … … 1758 1758 * Any existing file will be overwritten. 1759 1759 */ 1760 rc = VirtualBox:: ensureFilePathExists(Utf8Str(pcszTargetFilename), true /*fCreate*/);1760 rc = VirtualBox::i_ensureFilePathExists(Utf8Str(pcszTargetFilename), true /*fCreate*/); 1761 1761 if (RT_SUCCESS(rc)) 1762 1762 { -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r50203 r50355 2212 2212 2213 2213 /* Get the system properties. */ 2214 SystemProperties *pSysProps = mVirtualBox-> getSystemProperties();2214 SystemProperties *pSysProps = mVirtualBox->i_getSystemProperties(); 2215 2215 2216 2216 /* … … 2241 2241 if (vrc == VINF_SUCCESS) 2242 2242 { 2243 rc = mVirtualBox-> findHardDiskById(Guid(uuid), true, &pTargetHD);2243 rc = mVirtualBox->i_findHardDiskById(Guid(uuid), true, &pTargetHD); 2244 2244 if (FAILED(rc)) throw rc; 2245 2245 } -
trunk/src/VBox/Main/src-server/ClientWatcher.cpp
r49976 r50355 235 235 236 236 // get reference to the machines list in VirtualBox 237 VirtualBox::MachinesOList &allMachines = that->mVirtualBox-> getMachinesList();237 VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList(); 238 238 239 239 // lock the machines list for reading … … 440 440 { 441 441 // get reference to the machines list in VirtualBox 442 VirtualBox::MachinesOList &allMachines = that->mVirtualBox-> getMachinesList();442 VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList(); 443 443 444 444 // lock the machines list for reading … … 574 574 575 575 // get reference to the machines list in VirtualBox 576 VirtualBox::MachinesOList &allMachines = that->mVirtualBox-> getMachinesList();576 VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList(); 577 577 578 578 // lock the machines list for reading … … 743 743 744 744 // get reference to the machines list in VirtualBox 745 VirtualBox::MachinesOList &allMachines = that->mVirtualBox-> getMachinesList();745 VirtualBox::MachinesOList &allMachines = that->mVirtualBox->i_getMachinesList(); 746 746 747 747 // lock the machines list for reading -
trunk/src/VBox/Main/src-server/DHCPServerImpl.cpp
r49742 r50355 200 200 alock.release(); 201 201 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 202 HRESULT rc = mVirtualBox-> saveSettings();202 HRESULT rc = mVirtualBox->i_saveSettings(); 203 203 204 204 return rc; … … 258 258 alock.release(); 259 259 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 260 return mVirtualBox-> saveSettings();260 return mVirtualBox->i_saveSettings(); 261 261 } 262 262 … … 275 275 276 276 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 277 return mVirtualBox-> saveSettings();277 return mVirtualBox->i_saveSettings(); 278 278 } 279 279 … … 318 318 319 319 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 320 return mVirtualBox-> saveSettings();320 return mVirtualBox->i_saveSettings(); 321 321 } 322 322 … … 331 331 332 332 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 333 return mVirtualBox-> saveSettings();333 return mVirtualBox->i_saveSettings(); 334 334 } 335 335 -
trunk/src/VBox/Main/src-server/HostDnsService.cpp
r50263 r50355 262 262 { 263 263 m->fModified = true; 264 const_cast<VirtualBox *>(m->virtualbox)-> onHostNameResolutionConfigurationChange();264 const_cast<VirtualBox *>(m->virtualbox)->i_onHostNameResolutionConfigurationChange(); 265 265 } 266 266 -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r49951 r50355 295 295 296 296 #ifdef VBOX_WITH_RESOURCE_USAGE_API 297 i_registerMetrics(aParent-> performanceCollector());297 i_registerMetrics(aParent->i_performanceCollector()); 298 298 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 299 299 /* Create the list of network interfaces so their metrics get registered. */ … … 470 470 471 471 #ifdef VBOX_WITH_RESOURCE_USAGE_API 472 PerformanceCollector *aCollector = m->pParent-> performanceCollector();472 PerformanceCollector *aCollector = m->pParent->i_performanceCollector(); 473 473 i_unregisterMetrics(aCollector); 474 474 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 522 522 HRESULT Host::getDVDDrives(std::vector<ComPtr<IMedium> > &aDVDDrives) 523 523 { 524 AutoWriteLock alock(m->pParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);524 AutoWriteLock alock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 525 525 526 526 MediaList *pList; … … 545 545 HRESULT Host::getFloppyDrives(std::vector<ComPtr<IMedium> > &aFloppyDrives) 546 546 { 547 AutoWriteLock alock(m->pParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);547 AutoWriteLock alock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 548 548 549 549 MediaList *pList; … … 1418 1418 alock.release(); 1419 1419 AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS); 1420 return rc = m->pParent-> saveSettings();1420 return rc = m->pParent->i_saveSettings(); 1421 1421 #else 1422 1422 … … 1473 1473 alock.release(); 1474 1474 AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS); 1475 return rc = m->pParent-> saveSettings();1475 return rc = m->pParent->i_saveSettings(); 1476 1476 #else 1477 1477 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 1803 1803 { 1804 1804 HRESULT rc = S_OK; 1805 Assert(m->pParent-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());1805 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 1806 1806 1807 1807 MediaList llNew; … … 1928 1928 MediaList *pllMedia; 1929 1929 1930 AutoWriteLock wlock(m->pParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1930 AutoWriteLock wlock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1931 1931 HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia); 1932 1932 if (SUCCEEDED(rc)) … … 1968 1968 MediaList *pllMedia; 1969 1969 1970 AutoWriteLock wlock(m->pParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1970 AutoWriteLock wlock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1971 1971 HRESULT rc = i_getDrives(mediumType, fRefresh, pllMedia); 1972 1972 if (SUCCEEDED(rc)) … … 2004 2004 ComObjPtr<Medium> &pMedium) 2005 2005 { 2006 AutoWriteLock wlock(m->pParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);2006 AutoWriteLock wlock(m->pParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 2007 2007 2008 2008 Guid uuid(strNameOrId); … … 2023 2023 HRESULT rc = S_OK; 2024 2024 2025 Assert(m->pParent-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());2025 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2026 2026 2027 2027 try … … 2105 2105 HRESULT rc = S_OK; 2106 2106 2107 Assert(m->pParent-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());2107 Assert(m->pParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2108 2108 2109 2109 try … … 2247 2247 alock.release(); 2248 2248 AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS); 2249 return m->pParent-> saveSettings();2249 return m->pParent->i_saveSettings(); 2250 2250 } 2251 2251 … … 2978 2978 HostNetworkInterfaceList::iterator itOld, itNew; 2979 2979 # ifdef VBOX_WITH_RESOURCE_USAGE_API 2980 PerformanceCollector *aCollector = m->pParent-> performanceCollector();2980 PerformanceCollector *aCollector = m->pParent->i_performanceCollector(); 2981 2981 # endif 2982 2982 for (itOld = m->llNetIfs.begin(); itOld != m->llNetIfs.end(); ++itOld) -
trunk/src/VBox/Main/src-server/HostPower.cpp
r50227 r50355 57 57 #ifdef VBOX_WITH_RESOURCE_USAGE_API 58 58 /* Suspend performance sampling to avoid unnecessary callbacks due to jumps in time. */ 59 PerformanceCollector *perfcollector = mVirtualBox-> performanceCollector();59 PerformanceCollector *perfcollector = mVirtualBox->i_performanceCollector(); 60 60 61 61 if (perfcollector) 62 62 perfcollector->suspendSampling(); 63 63 #endif 64 mVirtualBox-> getOpenedMachines(machines, &controls);64 mVirtualBox->i_getOpenedMachines(machines, &controls); 65 65 66 66 /* pause running VMs */ … … 109 109 #ifdef VBOX_WITH_RESOURCE_USAGE_API 110 110 /* Resume the performance sampling. */ 111 PerformanceCollector *perfcollector = mVirtualBox-> performanceCollector();111 PerformanceCollector *perfcollector = mVirtualBox->i_performanceCollector(); 112 112 113 113 if (perfcollector) … … 135 135 } 136 136 137 mVirtualBox-> getOpenedMachines(machines, &controls);137 mVirtualBox->i_getOpenedMachines(machines, &controls); 138 138 size_t saved = 0; 139 139 -
trunk/src/VBox/Main/src-server/HostVideoInputDeviceImpl.cpp
r49132 r50355 182 182 183 183 #ifdef VBOX_WITH_EXTPACK 184 ExtPackManager *pExtPackMgr = pVirtualBox-> getExtPackManager();184 ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager(); 185 185 hr = pExtPackMgr->getLibraryPathForExtPack("VBoxHostWebcam", &strExtPackPuel, &strLibrary); 186 186 #else -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r50297 r50355 440 440 // reject VM UUID duplicates, they can happen if someone 441 441 // tries to register an already known VM config again 442 if (aParent-> findMachine(mData->pMachineConfigFile->uuid,443 true /* fPermitInaccessible */,444 false /* aDoSetError */,445 NULL) != VBOX_E_OBJECT_NOT_FOUND)442 if (aParent->i_findMachine(mData->pMachineConfigFile->uuid, 443 true /* fPermitInaccessible */, 444 false /* aDoSetError */, 445 NULL) != VBOX_E_OBJECT_NOT_FOUND) 446 446 { 447 447 throw setError(E_FAIL, … … 486 486 // uninit media from this machine's media registry, or else 487 487 // reloading the settings will fail 488 mParent-> unregisterMachineMedia(getId());488 mParent->i_unregisterMachineMedia(getId()); 489 489 } 490 490 } … … 522 522 523 523 Utf8Str strConfigFile; 524 aParent-> getDefaultMachineFolder(strConfigFile);524 aParent->i_getDefaultMachineFolder(strConfigFile); 525 525 strConfigFile.append(RTPATH_DELIMITER); 526 526 strConfigFile.append(strName); … … 576 576 // uninit media from this machine's media registry, or else 577 577 // reloading the settings will fail 578 mParent-> unregisterMachineMedia(getId());578 mParent->i_unregisterMachineMedia(getId()); 579 579 } 580 580 } … … 616 616 617 617 /* get the full file name */ 618 int vrc1 = mParent-> calculateFullPath(strConfigFile, mData->m_strConfigFileFull);618 int vrc1 = mParent->i_calculateFullPath(strConfigFile, mData->m_strConfigFileFull); 619 619 if (RT_FAILURE(vrc1)) 620 620 return setError(VBOX_E_FILE_ERROR, … … 712 712 mData->m_strConfigFileFull.c_str(), 713 713 mData->mUuid.toString().c_str(), 714 mParent-> settingsFilePath().c_str());714 mParent->i_settingsFilePath().c_str()); 715 715 716 716 rc = loadMachineDataFromSettings(*mData->pMachineConfigFile, … … 760 760 // uninit media from this machine's media registry, or else 761 761 // reloading the settings will fail 762 mParent-> unregisterMachineMedia(getId());762 mParent->i_unregisterMachineMedia(getId()); 763 763 764 764 /* uninitialize the common part to make sure all data is reset to … … 859 859 860 860 if (uuidMachine.isValid() && !uuidMachine.isZero()) // can be empty if we're called from a failure of Machine::init 861 mParent-> unregisterMachineMedia(uuidMachine);861 mParent->i_unregisterMachineMedia(uuidMachine); 862 862 863 863 // has machine been modified? … … 906 906 * go through the list of all machines. Happens when an inaccessible VM 907 907 * has a sensible medium registry. */ 908 AutoReadLock mllock(mParent-> getMachinesListLockHandle() COMMA_LOCKVAL_SRC_POS);908 AutoReadLock mllock(mParent->i_getMachinesListLockHandle() COMMA_LOCKVAL_SRC_POS); 909 909 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 910 910 … … 920 920 #ifdef DEBUG 921 921 LogFlowThisFunc(("Dumping media backreferences\n")); 922 mParent-> dumpAllBackRefs();922 mParent->i_dumpAllBackRefs(); 923 923 #endif 924 924 … … 939 939 /* make sure interesting parties will notice the accessibility 940 940 * state change */ 941 mParent-> onMachineStateChange(mData->mUuid, mData->mMachineState);942 mParent-> onMachineDataChange(mData->mUuid);941 mParent->i_onMachineStateChange(mData->mUuid, mData->mMachineState); 942 mParent->i_onMachineDataChange(mData->mUuid); 943 943 } 944 944 } … … 1098 1098 AutoCaller autoCaller(this); 1099 1099 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1100 std::vector<com::Utf8Str> tmplist; 1101 SafeArray<IN_BSTR> tmp(ComSafeArrayInArg(aGroups)); 1102 tmplist.resize(tmp.size()); 1103 for (size_t i = 0; i < tmp.size(); ++i) 1104 tmplist[i] = Utf8Str(tmp[i]); 1100 1105 1101 1106 StringsList llGroups; 1102 HRESULT rc = mParent-> convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);1107 HRESULT rc = mParent->i_convertMachineGroups(tmplist, &llGroups); 1103 1108 if (FAILED(rc)) 1104 1109 return rc; … … 2231 2236 if (SUCCEEDED(hrc2) && fIs64Bit) 2232 2237 { 2233 ComObjPtr<Host> ptrHost = mParent-> host();2238 ComObjPtr<Host> ptrHost = mParent->i_host(); 2234 2239 alock.release(); 2235 2240 … … 2709 2714 2710 2715 # ifdef VBOX_WITH_USB 2711 rc = mParent-> host()->i_checkUSBProxyService();2716 rc = mParent->i_host()->i_checkUSBProxyService(); 2712 2717 if (FAILED(rc)) return rc; 2713 2718 # endif … … 2739 2744 2740 2745 # ifdef VBOX_WITH_USB 2741 rc = mParent-> host()->i_checkUSBProxyService();2746 rc = mParent->i_host()->i_checkUSBProxyService(); 2742 2747 if (FAILED(rc)) return rc; 2743 2748 # endif … … 3828 3833 * machines that have open sessions 3829 3834 */ 3830 mParent-> updateClientWatcher();3835 mParent->i_updateClientWatcher(); 3831 3836 3832 3837 if (oldState != SessionState_Locked) 3833 3838 /* fire an event */ 3834 mParent-> onSessionStateChange(getId(), SessionState_Locked);3839 mParent->i_onSessionStateChange(getId(), SessionState_Locked); 3835 3840 } 3836 3841 … … 3931 3936 3932 3937 /* signal the client watcher thread */ 3933 mParent-> updateClientWatcher();3938 mParent->i_updateClientWatcher(); 3934 3939 3935 3940 /* fire an event */ 3936 mParent-> onSessionStateChange(getId(), SessionState_Spawning);3941 mParent->i_onSessionStateChange(getId(), SessionState_Spawning); 3937 3942 } 3938 3943 } … … 3963 3968 /* signal the client watcher thread, as most likely the client has 3964 3969 * been terminated */ 3965 mParent-> updateClientWatcher();3970 mParent->i_updateClientWatcher(); 3966 3971 } 3967 3972 … … 4028 4033 // request the host lock first, since might be calling Host methods for getting host drives; 4029 4034 // next, protect the media tree all the while we're in here, as well as our member variables 4030 AutoMultiWriteLock2 alock(mParent-> host(), this COMMA_LOCKVAL_SRC_POS);4031 AutoWriteLock treeLock(&mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);4035 AutoMultiWriteLock2 alock(mParent->i_host(), this COMMA_LOCKVAL_SRC_POS); 4036 AutoWriteLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4032 4037 4033 4038 HRESULT rc = checkStateDependency(MutableStateDep); … … 4135 4140 // As a result, we can only use these two new types if the medium is NOT in the 4136 4141 // global registry: 4137 const Guid &uuidGlobalRegistry = mParent-> getGlobalRegistryId();4142 const Guid &uuidGlobalRegistry = mParent->i_getGlobalRegistryId(); 4138 4143 if ( medium->i_isInRegistry(uuidGlobalRegistry) 4139 4144 || !mData->pMachineConfigFile->canHaveOwnMediaRegistry() … … 4581 4586 } 4582 4587 4583 mParent-> saveModifiedRegistries();4588 mParent->i_saveModifiedRegistries(); 4584 4589 4585 4590 return rc; … … 4666 4671 alock.release(); 4667 4672 4668 mParent-> saveModifiedRegistries();4673 mParent->i_saveModifiedRegistries(); 4669 4674 4670 4675 return rc; … … 5038 5043 // request the host lock first, since might be calling Host methods for getting host drives; 5039 5044 // next, protect the media tree all the while we're in here, as well as our member variables 5040 AutoMultiWriteLock3 multiLock(mParent-> host()->lockHandle(),5045 AutoMultiWriteLock3 multiLock(mParent->i_host()->lockHandle(), 5041 5046 this->lockHandle(), 5042 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);5047 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5043 5048 5044 5049 ComObjPtr<MediumAttachment> pAttach = findAttachment(mMediaData->mAttachments, … … 5138 5143 multiLock.release(); 5139 5144 5140 mParent-> saveModifiedRegistries();5145 mParent->i_saveModifiedRegistries(); 5141 5146 5142 5147 return rc; … … 5309 5314 { 5310 5315 // ask for permission from all listeners outside the locks; 5311 // onExtraDataCanChange() only briefly requests the VirtualBox5316 // i_onExtraDataCanChange() only briefly requests the VirtualBox 5312 5317 // lock to copy the list of callbacks to invoke 5313 5318 Bstr error; 5314 5319 Bstr bstrValue(aValue); 5315 5320 5316 if (!mParent-> onExtraDataCanChange(mData->mUuid, aKey, bstrValue.raw(), error))5321 if (!mParent->i_onExtraDataCanChange(mData->mUuid, aKey, bstrValue.raw(), error)) 5317 5322 { 5318 5323 const char *sep = error.isEmpty() ? "" : ": "; … … 5351 5356 alock.release(); 5352 5357 AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS); 5353 mParent-> saveSettings();5358 mParent->i_saveSettings(); 5354 5359 } 5355 5360 } … … 5357 5362 // fire notification outside the lock 5358 5363 if (fChanged) 5359 mParent-> onExtraDataChange(mData->mUuid, aKey, aValue);5364 mParent->i_onExtraDataChange(mData->mUuid, aKey, aValue); 5360 5365 5361 5366 return S_OK; … … 5398 5403 // save the global settings; for that we should hold only the VirtualBox lock 5399 5404 AutoWriteLock vlock(mParent COMMA_LOCKVAL_SRC_POS); 5400 rc = mParent-> saveSettings();5405 rc = mParent->i_saveSettings(); 5401 5406 } 5402 5407 … … 5454 5459 uninit(); 5455 5460 5456 mParent-> unregisterMachine(this, id);5461 mParent->i_unregisterMachine(this, id); 5457 5462 // calls VirtualBox::saveSettings() 5458 5463 … … 5551 5556 sfaMedia.detachTo(ComSafeArrayOutArg(aMedia)); 5552 5557 5553 mParent-> unregisterMachine(this, id);5554 // calls VirtualBox::saveSettings() and VirtualBox:: saveModifiedRegistries()5558 mParent->i_unregisterMachine(this, id); 5559 // calls VirtualBox::saveSettings() and VirtualBox::i_saveModifiedRegistries() 5555 5560 5556 5561 return S_OK; … … 5817 5822 alock.release(); 5818 5823 5819 mParent-> saveModifiedRegistries();5824 mParent->i_saveModifiedRegistries(); 5820 5825 } 5821 5826 catch (HRESULT aRC) { rc = aRC; } … … 6159 6164 alock.release(); 6160 6165 6161 mParent-> onGuestPropertyChange(mData->mUuid, aName,6162 aValue ? aValue : Bstr("").raw(),6163 aFlags ? aFlags : Bstr("").raw());6166 mParent->i_onGuestPropertyChange(mData->mUuid, aName, 6167 aValue ? aValue : Bstr("").raw(), 6168 aFlags ? aFlags : Bstr("").raw()); 6164 6169 } 6165 6170 } … … 6659 6664 /* Check that we don't exceed the maximum number of USB controllers for the given type. */ 6660 6665 ULONG maxInstances; 6661 rc = mParent-> getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances);6666 rc = mParent->i_getSystemProperties()->GetMaxInstancesOfUSBControllerType(mHWData->mChipsetType, aType, &maxInstances); 6662 6667 if (FAILED(rc)) 6663 6668 return rc; … … 7484 7489 && mHWData->mAutostart.fAutostartEnabled != !!fEnabled) 7485 7490 { 7486 AutostartDb *autostartDb = mParent-> getAutostartDb();7491 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 7487 7492 int vrc; 7488 7493 … … 7575 7580 && mHWData->mAutostart.enmAutostopType != enmAutostopType) 7576 7581 { 7577 AutostartDb *autostartDb = mParent-> getAutostartDb();7582 AutostartDb *autostartDb = mParent->i_getAutostartDb(); 7578 7583 int vrc; 7579 7584 … … 8217 8222 mData->mSession.mState = SessionState_Unlocked; 8218 8223 alock.release(); 8219 mParent-> addProcessToReap(pid);8224 mParent->i_addProcessToReap(pid); 8220 8225 /* The failure may occur w/o any error info (from RPC), so provide one */ 8221 8226 return setError(VBOX_E_VM_ERROR, … … 8232 8237 8233 8238 alock.release(); 8234 mParent-> addProcessToReap(pid);8239 mParent->i_addProcessToReap(pid); 8235 8240 8236 8241 LogFlowThisFuncLeave(); … … 8391 8396 mData->mSession.mPID = NIL_RTPROCESS; 8392 8397 8393 mParent-> onSessionStateChange(mData->mUuid, SessionState_Unlocked);8398 mParent->i_onSessionStateChange(mData->mUuid, SessionState_Unlocked); 8394 8399 return true; 8395 8400 } … … 8689 8694 8690 8695 /* initialize mOSTypeId */ 8691 mUserData->s.strOsType = mParent-> getUnknownOSType()->i_id();8696 mUserData->s.strOsType = mParent->i_getUnknownOSType()->i_id(); 8692 8697 8693 8698 /* create associated BIOS settings object */ … … 8947 8952 RTTimeNow(&mData->mLastStateChange); 8948 8953 8949 mParent-> onMachineStateChange(mData->mUuid, aMachineState);8954 mParent->i_onMachineStateChange(mData->mUuid, aMachineState); 8950 8955 } 8951 8956 … … 9673 9678 case DeviceType_DVD: 9674 9679 if (dev.strHostDriveSrc.isNotEmpty()) 9675 rc = mParent-> host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium);9680 rc = mParent->i_host()->i_findHostDriveByName(dev.deviceType, dev.strHostDriveSrc, false /* fRefresh */, medium); 9676 9681 else 9677 rc = mParent-> findRemoveableMedium(dev.deviceType,9678 dev.uuid,9679 false /* fRefresh */,9680 false /* aSetError */,9681 medium);9682 rc = mParent->i_findRemoveableMedium(dev.deviceType, 9683 dev.uuid, 9684 false /* fRefresh */, 9685 false /* aSetError */, 9686 medium); 9682 9687 if (rc == VBOX_E_OBJECT_NOT_FOUND) 9683 9688 // This is not an error. The host drive or UUID might have vanished, so just go ahead without this removeable medium attachment … … 9688 9693 { 9689 9694 /* find a hard disk by UUID */ 9690 rc = mParent-> findHardDiskById(dev.uuid, true /* aDoSetError */, &medium);9695 rc = mParent->i_findHardDiskById(dev.uuid, true /* aDoSetError */, &medium); 9691 9696 if (FAILED(rc)) 9692 9697 { … … 10179 10184 mData->m_strConfigFileFull = newConfigFile; 10180 10185 // compute the relative path too 10181 mParent-> copyPathRelativeToConfig(newConfigFile, mData->m_strConfigFile);10186 mParent->i_copyPathRelativeToConfig(newConfigFile, mData->m_strConfigFile); 10182 10187 10183 10188 // store the old and new so that VirtualBox::saveSettings() can update … … 10186 10191 && configDir != newConfigDir) 10187 10192 { 10188 mParent-> rememberMachineNameChangeForMedia(configDir, newConfigDir);10193 mParent->i_rememberMachineNameChangeForMedia(configDir, newConfigDir); 10189 10194 10190 10195 if (pfNeedsGlobalSaveSettings) … … 10382 10387 * inform callbacks. */ 10383 10388 if (isSessionMachine()) 10384 mParent-> onMachineDataChange(mData->mUuid);10389 mParent->i_onMachineDataChange(mData->mUuid); 10385 10390 } 10386 10391 … … 10487 10492 Utf8Str strMachineFolder = getSettingsFileFull(); 10488 10493 strMachineFolder.stripFilename(); 10489 mParent-> saveMediaRegistry(config.mediaRegistry,10490 getId(), // only media with registry ID == machine UUID10491 strMachineFolder);10494 mParent->i_saveMediaRegistry(config.mediaRegistry, 10495 getId(), // only media with registry ID == machine UUID 10496 strMachineFolder); 10492 10497 // this throws HRESULT 10493 10498 } … … 11009 11014 /* Paranoia checks: do not hold machine or media tree locks. */ 11010 11015 AssertReturnVoid(!isWriteLockOnCurrentThread()); 11011 AssertReturnVoid(!mParent-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());11016 AssertReturnVoid(!mParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 11012 11017 11013 11018 ComObjPtr<Medium> pBase; 11014 11019 { 11015 AutoReadLock treeLock(&mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);11020 AutoReadLock treeLock(&mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 11016 11021 pBase = pMedium->i_getBase(); 11017 11022 } … … 11027 11032 uuid = getId(); // machine UUID 11028 11033 else 11029 uuid = mParent-> getGlobalRegistryId(); // VirtualBox global registry UUID11034 uuid = mParent->i_getGlobalRegistryId(); // VirtualBox global registry UUID 11030 11035 11031 11036 if (pMedium->i_addRegistry(uuid, false /* fRecurse */)) 11032 mParent-> markRegistryModified(uuid);11037 mParent->i_markRegistryModified(uuid); 11033 11038 11034 11039 /* For more complex hard disk structures it can happen that the base … … 11037 11042 { 11038 11043 if (pBase->i_addRegistry(uuid, true /* fRecurse */)) 11039 mParent-> markRegistryModified(uuid);11044 mParent->i_markRegistryModified(uuid); 11040 11045 } 11041 11046 } … … 11082 11087 11083 11088 AutoMultiWriteLock2 alock(this->lockHandle(), 11084 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);11089 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 11085 11090 11086 11091 /* must be in a protective state because we release the lock below */ … … 11300 11305 11301 11306 AutoMultiWriteLock2 alock(this->lockHandle(), 11302 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);11307 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 11303 11308 11304 11309 /* We absolutely must have backed up state. */ … … 12878 12883 mUserData->s.strName.c_str(), name.raw())); 12879 12884 aMachine->lockHandle()->unlockWrite(); 12880 mParent-> natNetworkRefInc(name.raw());12885 mParent->i_natNetworkRefInc(name.raw()); 12881 12886 #ifdef RT_LOCK_STRICT 12882 12887 aMachine->lockHandle()->lockWrite(RT_SRC_POS); … … 12978 12983 NOREF(rc); 12979 12984 12980 USBProxyService *service = mParent-> host()->i_usbProxyService();12985 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 12981 12986 if (service) 12982 12987 service->detachAllDevicesFromVM(this, true /* aDone */, true /* aAbnormal */); … … 12987 12992 // with mPeer (as well as data we modify below). mParent lock is needed 12988 12993 // by several calls to it, and USB needs host lock. 12989 AutoMultiWriteLock3 multilock(mParent, mParent-> host(), this COMMA_LOCKVAL_SRC_POS);12994 AutoMultiWriteLock3 multilock(mParent, mParent->i_host(), this COMMA_LOCKVAL_SRC_POS); 12990 12995 12991 12996 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 12995 13000 * holding the lock. 12996 13001 */ 12997 unregisterMetrics(mParent-> performanceCollector(), mPeer);13002 unregisterMetrics(mParent->i_performanceCollector(), mPeer); 12998 13003 /* The guest must be unregistered after its metrics (@bugref{5949}). */ 12999 13004 LogAleksey(("{%p} " LOG_FN_FMT ": mCollectorGuest=%p\n", … … 13001 13006 if (mCollectorGuest) 13002 13007 { 13003 mParent-> performanceCollector()->unregisterGuest(mCollectorGuest);13008 mParent->i_performanceCollector()->unregisterGuest(mCollectorGuest); 13004 13009 // delete mCollectorGuest; => CollectorGuestManager::destroyUnregistered() 13005 13010 mCollectorGuest = NULL; … … 13054 13059 * client watcher thread to update the set of machines that have open 13055 13060 * sessions. */ 13056 mParent-> updateClientWatcher();13061 mParent->i_updateClientWatcher(); 13057 13062 } 13058 13063 … … 13093 13098 LogRel(("VM '%s' stops using NAT network '%ls'\n", 13094 13099 mUserData->s.strName.c_str(), name.raw())); 13095 mParent-> natNetworkRefDec(name.raw());13100 mParent->i_natNetworkRefDec(name.raw()); 13096 13101 multilock.acquire(); 13097 13102 } … … 13154 13159 13155 13160 /* fire an event */ 13156 mParent-> onSessionStateChange(mData->mUuid, SessionState_Unlocked);13161 mParent->i_onSessionStateChange(mData->mUuid, SessionState_Unlocked); 13157 13162 13158 13163 uninitDataAndChildObjects(); … … 13297 13302 * now to offer the performance metrics for a running machine 13298 13303 * object. Doing it earlier wouldn't be safe. */ 13299 registerMetrics(mParent-> performanceCollector(), mPeer,13304 registerMetrics(mParent->i_performanceCollector(), mPeer, 13300 13305 mData->mSession.mPID); 13301 13306 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 13435 13440 /* if captureDeviceForVM() fails, it must have set extended error info */ 13436 13441 clearError(); 13437 MultiResult rc = mParent-> host()->i_checkUSBProxyService();13442 MultiResult rc = mParent->i_host()->i_checkUSBProxyService(); 13438 13443 if (FAILED(rc)) return rc; 13439 13444 13440 USBProxyService *service = mParent-> host()->i_usbProxyService();13445 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 13441 13446 AssertReturn(service, E_FAIL); 13442 13447 return service->captureDeviceForVM(this, Guid(aId).ref()); … … 13458 13463 13459 13464 #ifdef VBOX_WITH_USB 13460 USBProxyService *service = mParent-> host()->i_usbProxyService();13465 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 13461 13466 AssertReturn(service, E_FAIL); 13462 13467 return service->detachDeviceFromVM(this, Guid(aId).ref(), !!aDone); … … 13488 13493 NOREF(rc); 13489 13494 13490 USBProxyService *service = mParent-> host()->i_usbProxyService();13495 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 13491 13496 AssertReturn(service, E_FAIL); 13492 13497 return service->autoCaptureDevicesForVM(this); … … 13518 13523 NOREF(rc); 13519 13524 13520 USBProxyService *service = mParent-> host()->i_usbProxyService();13525 USBProxyService *service = mParent->i_host()->i_usbProxyService(); 13521 13526 AssertReturn(service, E_FAIL); 13522 13527 return service->detachAllDevicesFromVM(this, !!aDone, false /* aAbnormal */); … … 13618 13623 13619 13624 /* signal the client watcher thread, because the client is going away */ 13620 mParent-> updateClientWatcher();13625 mParent->i_updateClientWatcher(); 13621 13626 13622 13627 LogFlowThisFuncLeave(); … … 13886 13891 alock.release(); 13887 13892 13888 mParent-> onGuestPropertyChange(mData->mUuid,13889 aName,13890 aValue,13891 aFlags);13893 mParent->i_onGuestPropertyChange(mData->mUuid, 13894 aName, 13895 aValue, 13896 aFlags); 13892 13897 } 13893 13898 } … … 13908 13913 13909 13914 AutoMultiWriteLock2 alock(this->lockHandle(), 13910 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);13915 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 13911 13916 13912 13917 AssertReturn( mData->mMachineState == MachineState_Starting … … 13936 13941 // request the host lock first, since might be calling Host methods for getting host drives; 13937 13942 // next, protect the media tree all the while we're in here, as well as our member variables 13938 AutoMultiWriteLock3 multiLock(mParent-> host()->lockHandle(),13943 AutoMultiWriteLock3 multiLock(mParent->i_host()->lockHandle(), 13939 13944 this->lockHandle(), 13940 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);13945 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 13941 13946 13942 13947 ComObjPtr<MediumAttachment> pAttach = static_cast<MediumAttachment *>(aAttachment); … … 14150 14155 */ 14151 14156 14152 mParent-> onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort);14157 mParent->i_onNatRedirectChange(getId(), ulSlot, RT_BOOL(aNatRuleRemove), aRuleName, aProto, aHostIp, (uint16_t)aHostPort, aGuestIp, (uint16_t)aGuestPort); 14153 14158 return S_OK; 14154 14159 } … … 14692 14697 14693 14698 AutoMultiWriteLock2 alock(this->lockHandle(), 14694 &mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);14699 &mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 14695 14700 14696 14701 /* bail out if trying to lock things with already set up locking */ -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r49795 r50355 1102 1102 /* Default format? */ 1103 1103 Utf8Str strDefaultFormat; 1104 p->mParent-> getDefaultHardDiskFormat(strDefaultFormat);1104 p->mParent->i_getDefaultHardDiskFormat(strDefaultFormat); 1105 1105 Bstr bstrSrcFormat(strDefaultFormat); 1106 1106 … … 1221 1221 /* register the new harddisk */ 1222 1222 { 1223 AutoWriteLock tlock(p->mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1224 rc = p->mParent-> registerMedium(pTarget, &pTarget,1223 AutoWriteLock tlock(p->mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1224 rc = p->mParent->i_registerMedium(pTarget, &pTarget, 1225 1225 DeviceType_HardDisk); 1226 1226 if (FAILED(rc)) throw rc; … … 1304 1304 trgLock.release(); 1305 1305 srcLock.release(); 1306 p->mParent-> markRegistryModified(uuid);1306 p->mParent->i_markRegistryModified(uuid); 1307 1307 srcLock.acquire(); 1308 1308 trgLock.acquire(); … … 1373 1373 * VirtualBox lock */ 1374 1374 AutoWriteLock vlock(p->mParent COMMA_LOCKVAL_SRC_POS); 1375 rc = p->mParent-> saveSettings();1375 rc = p->mParent->i_saveSettings(); 1376 1376 if (FAILED(rc)) throw rc; 1377 1377 } … … 1379 1379 1380 1380 /* Any additional machines need saving? */ 1381 p->mParent-> saveModifiedRegistries();1381 p->mParent->i_saveModifiedRegistries(); 1382 1382 } 1383 1383 catch (HRESULT rc2) … … 1418 1418 1419 1419 /* Must save the modified registries */ 1420 p->mParent-> saveModifiedRegistries();1420 p->mParent->i_saveModifiedRegistries(); 1421 1421 } 1422 1422 -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r49951 r50355 110 110 VirtualBox * const pVirtualBox; 111 111 112 // pParent and llChildren are protected by VirtualBox:: getMediaTreeLockHandle()112 // pParent and llChildren are protected by VirtualBox::i_getMediaTreeLockHandle() 113 113 ComObjPtr<Medium> pParent; 114 114 MediaList llChildren; // to add a child, just call push_back; to remove a child, call child->deparent() which does a lookup … … 946 946 unconst(m->id).create(); 947 947 948 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);948 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 949 949 ComObjPtr<Medium> pMedium; 950 950 … … 959 959 bool fInUse; 960 960 961 fInUse = m->pVirtualBox->i sMediaUuidInUse(m->id, DeviceType_HardDisk);961 fInUse = m->pVirtualBox->i_isMediaUuidInUse(m->id, DeviceType_HardDisk); 962 962 if (fInUse) 963 963 { … … 969 969 } 970 970 971 rc = m->pVirtualBox-> registerMedium(this, &pMedium, DeviceType_HardDisk);971 rc = m->pVirtualBox->i_registerMedium(this, &pMedium, DeviceType_HardDisk); 972 972 Assert(this == pMedium || FAILED(rc)); 973 973 } … … 1145 1145 { 1146 1146 // differencing medium: add to parent 1147 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1147 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1148 1148 m->pParent = aParent; 1149 1149 aParent->m->llChildren.push_back(this); … … 1208 1208 { 1209 1209 Utf8Str strPlaintext; 1210 int vrc = m->pVirtualBox-> decryptSetting(&strPlaintext, itCph->second);1210 int vrc = m->pVirtualBox->i_decryptSetting(&strPlaintext, itCph->second); 1211 1211 if (RT_SUCCESS(vrc)) 1212 1212 m->mapProperties["InitiatorSecret"] = strPlaintext; … … 1230 1230 { 1231 1231 // Otherwise use the old VirtualBox "make absolute path" logic: 1232 rc = m->pVirtualBox-> calculateFullPath(data.strLocation, strFull);1232 rc = m->pVirtualBox->i_calculateFullPath(data.strLocation, strFull); 1233 1233 if (FAILED(rc)) return rc; 1234 1234 } … … 1264 1264 * COMGETTER(State). */ 1265 1265 1266 AutoWriteLock treeLock(aVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1266 AutoWriteLock treeLock(aVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1267 1267 1268 1268 /* load all children */ … … 1283 1283 if (FAILED(rc)) break; 1284 1284 1285 rc = m->pVirtualBox-> registerMedium(pHD, &pHD, DeviceType_HardDisk);1285 rc = m->pVirtualBox->i_registerMedium(pHD, &pHD, DeviceType_HardDisk); 1286 1286 if (FAILED(rc)) break; 1287 1287 } … … 1576 1576 { 1577 1577 // we access mParent and members 1578 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1578 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1579 1579 AutoWriteLock mlock(this COMMA_LOCKVAL_SRC_POS); 1580 1580 … … 1683 1683 // As a result, we can only use these two new types if the medium is NOT in the 1684 1684 // global registry: 1685 const Guid &uuidGlobalRegistry = m->pVirtualBox-> getGlobalRegistryId();1685 const Guid &uuidGlobalRegistry = m->pVirtualBox->i_getGlobalRegistryId(); 1686 1686 if (i_isInRegistry(uuidGlobalRegistry)) 1687 1687 return setError(VBOX_E_INVALID_OBJECT_STATE, … … 1697 1697 treeLock.release(); 1698 1698 i_markRegistriesModified(); 1699 m->pVirtualBox-> saveModifiedRegistries();1699 m->pVirtualBox->i_saveModifiedRegistries(); 1700 1700 1701 1701 return S_OK; … … 1713 1713 { 1714 1714 /* we access mParent */ 1715 AutoReadLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1715 AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1716 1716 1717 1717 m->pParent.queryInterfaceTo(aParent.asOutParam()); … … 1723 1723 { 1724 1724 /* we access children */ 1725 AutoReadLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1725 AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1726 1726 1727 1727 MediaList children(this->i_getChildren()); … … 1786 1786 mlock.release(); 1787 1787 i_markRegistriesModified(); 1788 m->pVirtualBox-> saveModifiedRegistries();1788 m->pVirtualBox->i_saveModifiedRegistries(); 1789 1789 } 1790 1790 … … 1940 1940 /* Must not hold the media tree lock, as Medium::queryInfo needs this 1941 1941 * lock and thus we would run into a deadlock here. */ 1942 Assert(!m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());1942 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 1943 1943 while (m->queryInfoRunning) 1944 1944 { … … 2057 2057 /* Must not hold the media tree lock, as Medium::queryInfo needs this 2058 2058 * lock and thus we would run into a deadlock here. */ 2059 Assert(!m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());2059 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2060 2060 while (m->queryInfoRunning) 2061 2061 { … … 2154 2154 MultiResult mrc = i_close(aAutoCaller); 2155 2155 2156 pVirtualBox-> saveModifiedRegistries();2156 pVirtualBox->i_saveModifiedRegistries(); 2157 2157 2158 2158 return mrc; … … 2222 2222 mlock.release(); 2223 2223 i_markRegistriesModified(); 2224 m->pVirtualBox-> saveModifiedRegistries();2224 m->pVirtualBox->i_saveModifiedRegistries(); 2225 2225 2226 2226 return S_OK; … … 2299 2299 mlock.release(); 2300 2300 i_markRegistriesModified(); 2301 m->pVirtualBox-> saveModifiedRegistries();2301 m->pVirtualBox->i_saveModifiedRegistries(); 2302 2302 2303 2303 return S_OK; … … 2387 2387 false /* aWait */); 2388 2388 /* Must save the registries in any case, since an entry was removed. */ 2389 m->pVirtualBox-> saveModifiedRegistries();2389 m->pVirtualBox->i_saveModifiedRegistries(); 2390 2390 2391 2391 if (SUCCEEDED(mrc)) … … 2403 2403 2404 2404 // locking: we need the tree lock first because we access parent pointers 2405 AutoMultiWriteLock3 alock(&m->pVirtualBox-> getMediaTreeLockHandle(),2405 AutoMultiWriteLock3 alock(&m->pVirtualBox->i_getMediaTreeLockHandle(), 2406 2406 this->lockHandle(), diff->lockHandle() COMMA_LOCKVAL_SRC_POS); 2407 2407 … … 2545 2545 // and we need to write-lock the media involved 2546 2546 uint32_t cHandles = 3; 2547 LockHandle* pHandles[4] = { &m->pVirtualBox-> getMediaTreeLockHandle(),2547 LockHandle* pHandles[4] = { &m->pVirtualBox->i_getMediaTreeLockHandle(), 2548 2548 this->lockHandle(), 2549 2549 pTarget->lockHandle() }; … … 2824 2824 { 2825 2825 /* canClose() needs the tree lock */ 2826 AutoMultiWriteLock2 multilock(&m->pVirtualBox-> getMediaTreeLockHandle(),2826 AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(), 2827 2827 this->lockHandle() 2828 2828 COMMA_LOCKVAL_SRC_POS); … … 3230 3230 ++it) 3231 3231 { 3232 m->pVirtualBox-> markRegistryModified(*it);3232 m->pVirtualBox->i_markRegistryModified(*it); 3233 3233 } 3234 3234 } … … 3523 3523 3524 3524 /* we access mParent */ 3525 AutoReadLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3525 AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3526 3526 3527 3527 pBase = this; … … 3562 3562 3563 3563 /* we access children */ 3564 AutoReadLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3564 AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3565 3565 3566 3566 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3622 3622 3623 3623 /* we access mParent */ 3624 AutoReadLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3624 AutoReadLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3625 3625 3626 3626 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 3658 3658 /* Encrypt the plain secret. If that does not work (i.e. no or wrong settings key 3659 3659 * specified), just use the encrypted secret (if there is any). */ 3660 int rc = m->pVirtualBox-> encryptSetting(itPln->second, &strCiphertext);3660 int rc = m->pVirtualBox->i_encryptSetting(itPln->second, &strCiphertext); 3661 3661 if (RT_SUCCESS(rc)) 3662 3662 fHaveInitiatorSecretEncrypted = true; … … 3715 3715 MediumLockList &mediumLockList) 3716 3716 { 3717 Assert(!m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());3717 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 3718 3718 Assert(!isWriteLockOnCurrentThread()); 3719 3719 … … 3941 3941 /* use the default format if not */ 3942 3942 Utf8Str tmp; 3943 m->pVirtualBox-> getDefaultHardDiskFormat(tmp);3943 m->pVirtualBox->i_getDefaultHardDiskFormat(tmp); 3944 3944 return tmp; 3945 3945 } … … 3964 3964 { 3965 3965 // we're accessing parent/child and backrefs, so lock the tree first, then ourselves 3966 AutoMultiWriteLock2 multilock(&m->pVirtualBox-> getMediaTreeLockHandle(),3966 AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(), 3967 3967 this->lockHandle() 3968 3968 COMMA_LOCKVAL_SRC_POS); … … 4006 4006 // Needs to be done before saving the registry, as otherwise there 4007 4007 // may be a deadlock with someone else closing this object while we're 4008 // in saveModifiedRegistries(), which needs the media tree lock, which4008 // in i_saveModifiedRegistries(), which needs the media tree lock, which 4009 4009 // the other thread holds until after uninit() below. 4010 4010 /// @todo redesign the locking here, as holding the locks over uninit causes lock order trouble which the lock validator can't detect 4011 4011 autoCaller.release(); 4012 m->pVirtualBox-> saveModifiedRegistries();4012 m->pVirtualBox->i_saveModifiedRegistries(); 4013 4013 multilock.acquire(); 4014 4014 } … … 4065 4065 { 4066 4066 /* we're accessing the media tree, and canClose() needs it too */ 4067 AutoMultiWriteLock2 multilock(&m->pVirtualBox-> getMediaTreeLockHandle(),4067 AutoMultiWriteLock2 multilock(&m->pVirtualBox->i_getMediaTreeLockHandle(), 4068 4068 this->lockHandle() 4069 4069 COMMA_LOCKVAL_SRC_POS); … … 4329 4329 { 4330 4330 // locking: we need the tree lock first because we access parent pointers 4331 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);4331 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4332 4332 4333 4333 /* more sanity checking and figuring out the current merge direction */ … … 4459 4459 { 4460 4460 // locking: we need the tree lock first because we access parent pointers 4461 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);4461 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4462 4462 4463 4463 /* more sanity checking and figuring out the merge direction */ … … 4936 4936 { 4937 4937 Assert(!isWriteLockOnCurrentThread()); 4938 Assert(!m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());4938 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 4939 4939 MediumLockList mediumLockList; 4940 4940 HRESULT rc = i_createMediumLockList(true /* fFailIfInaccessible */, … … 5126 5126 // and we need to write-lock the media involved 5127 5127 uint32_t cHandles = 2; 5128 LockHandle* pHandles[3] = { &m->pVirtualBox-> getMediaTreeLockHandle(),5128 LockHandle* pHandles[3] = { &m->pVirtualBox->i_getMediaTreeLockHandle(), 5129 5129 this->lockHandle() }; 5130 5130 /* Only add parent to the lock if it is not null */ … … 5224 5224 // and we need to write-lock the media involved 5225 5225 uint32_t cHandles = 3; 5226 LockHandle* pHandles[4] = { &m->pVirtualBox-> getMediaTreeLockHandle(),5226 LockHandle* pHandles[4] = { &m->pVirtualBox->i_getMediaTreeLockHandle(), 5227 5227 this->lockHandle(), 5228 5228 aTarget->lockHandle() }; … … 5443 5443 alock.release(); 5444 5444 Assert(!isWriteLockOnCurrentThread()); 5445 Assert(!m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());5446 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);5445 Assert(!m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5446 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 5447 5447 treeLock.release(); 5448 5448 … … 5544 5544 location.c_str(), 5545 5545 mediumId.raw(), 5546 m->pVirtualBox-> settingsFilePath().c_str());5546 m->pVirtualBox->i_settingsFilePath().c_str()); 5547 5547 throw S_OK; 5548 5548 } … … 5610 5610 rc = VBOX_E_OBJECT_NOT_FOUND; 5611 5611 else 5612 rc = m->pVirtualBox-> findHardDiskById(Guid(parentId), false /* aSetError */, &pParent);5612 rc = m->pVirtualBox->i_findHardDiskById(Guid(parentId), false /* aSetError */, &pParent); 5613 5613 if (FAILED(rc)) 5614 5614 { … … 5632 5632 lastAccessError = Utf8StrFmt(tr("Parent medium with UUID {%RTuuid} of the medium '%s' is not found in the media registry ('%s')"), 5633 5633 &parentId, location.c_str(), 5634 m->pVirtualBox-> settingsFilePath().c_str());5634 m->pVirtualBox->i_settingsFilePath().c_str()); 5635 5635 throw S_OK; 5636 5636 } … … 5688 5688 &parentId, location.c_str(), 5689 5689 m->pParent->i_getId().raw(), 5690 m->pVirtualBox-> settingsFilePath().c_str());5690 m->pVirtualBox->i_settingsFilePath().c_str()); 5691 5691 parentLock.release(); 5692 5692 treeLock.release(); … … 5824 5824 HRESULT Medium::i_canClose() 5825 5825 { 5826 Assert(m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());5826 Assert(m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5827 5827 5828 5828 if (i_getChildren().size() != 0) … … 5845 5845 5846 5846 /* we modify mParent and access children */ 5847 Assert(m->pVirtualBox-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());5847 Assert(m->pVirtualBox->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 5848 5848 5849 5849 Medium *pParentBackup = m->pParent; … … 5852 5852 i_deparent(); 5853 5853 5854 HRESULT rc = m->pVirtualBox-> unregisterMedium(this);5854 HRESULT rc = m->pVirtualBox->i_unregisterMedium(this); 5855 5855 if (FAILED(rc)) 5856 5856 { … … 6157 6157 /* get the format object first */ 6158 6158 { 6159 SystemProperties *pSysProps = m->pVirtualBox-> getSystemProperties();6159 SystemProperties *pSysProps = m->pVirtualBox->i_getSystemProperties(); 6160 6160 AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS); 6161 6161 … … 6584 6584 if (capabilities & MediumFormatCapabilities_File) 6585 6585 { 6586 rc = VirtualBox:: ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);6586 rc = VirtualBox::i_ensureFilePathExists(location, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */); 6587 6587 if (FAILED(rc)) 6588 6588 throw rc; … … 6626 6626 * Created state only on success (leaving an orphan file is 6627 6627 * better than breaking media registry consistency) */ 6628 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);6628 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 6629 6629 ComObjPtr<Medium> pMedium; 6630 rc = m->pVirtualBox-> registerMedium(this, &pMedium, DeviceType_HardDisk);6630 rc = m->pVirtualBox->i_registerMedium(this, &pMedium, DeviceType_HardDisk); 6631 6631 Assert(this == pMedium); 6632 6632 } … … 6648 6648 { 6649 6649 // in asynchronous mode, save settings now 6650 m->pVirtualBox-> saveModifiedRegistries();6650 m->pVirtualBox->i_saveModifiedRegistries(); 6651 6651 } 6652 6652 } … … 6760 6760 if (capabilities & MediumFormatCapabilities_File) 6761 6761 { 6762 HRESULT rc = VirtualBox:: ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);6762 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */); 6763 6763 if (FAILED(rc)) 6764 6764 throw rc; … … 6797 6797 if (SUCCEEDED(mrc)) 6798 6798 { 6799 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);6799 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 6800 6800 6801 6801 Assert(pTarget->m->pParent.isNull()); … … 6814 6814 * better than breaking media registry consistency) */ 6815 6815 ComObjPtr<Medium> pMedium; 6816 mrc = m->pVirtualBox-> registerMedium(pTarget, &pMedium, DeviceType_HardDisk);6816 mrc = m->pVirtualBox->i_registerMedium(pTarget, &pMedium, DeviceType_HardDisk); 6817 6817 Assert(pTarget == pMedium); 6818 6818 … … 6853 6853 { 6854 6854 // in asynchronous mode, save settings now 6855 m->pVirtualBox-> saveModifiedRegistries();6855 m->pVirtualBox->i_saveModifiedRegistries(); 6856 6856 } 6857 6857 … … 7027 7027 * VDMerge; reparent the last one and uninitialize deleted media. */ 7028 7028 7029 AutoWriteLock treeLock(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);7029 AutoWriteLock treeLock(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 7030 7030 7031 7031 if (task.mfMergeForward) … … 7033 7033 /* first, unregister the target since it may become a base 7034 7034 * medium which needs re-registration */ 7035 rc2 = m->pVirtualBox-> unregisterMedium(pTarget);7035 rc2 = m->pVirtualBox->i_unregisterMedium(pTarget); 7036 7036 AssertComRC(rc2); 7037 7037 … … 7048 7048 /* then, register again */ 7049 7049 ComObjPtr<Medium> pMedium; 7050 rc2 = m->pVirtualBox-> registerMedium(pTarget, &pMedium,7050 rc2 = m->pVirtualBox->i_registerMedium(pTarget, &pMedium, 7051 7051 DeviceType_HardDisk); 7052 7052 AssertComRC(rc2); … … 7104 7104 } 7105 7105 7106 rc2 = pMedium->m->pVirtualBox-> unregisterMedium(pMedium);7106 rc2 = pMedium->m->pVirtualBox->i_unregisterMedium(pMedium); 7107 7107 AssertComRC(rc2); 7108 7108 … … 7142 7142 // in asynchronous mode, save settings now 7143 7143 eik.restore(); 7144 m->pVirtualBox-> saveModifiedRegistries();7144 m->pVirtualBox->i_saveModifiedRegistries(); 7145 7145 eik.fetch(); 7146 7146 } … … 7259 7259 if (capabilities & MediumFormatCapabilities_File) 7260 7260 { 7261 HRESULT rc = VirtualBox:: ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);7261 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */); 7262 7262 if (FAILED(rc)) 7263 7263 throw rc; … … 7376 7376 { 7377 7377 /* we set mParent & children() */ 7378 AutoWriteLock alock2(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);7378 AutoWriteLock alock2(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 7379 7379 7380 7380 Assert(pTarget->m->pParent.isNull()); … … 7392 7392 eik.restore(); 7393 7393 ComObjPtr<Medium> pMedium; 7394 mrc = pParent->m->pVirtualBox-> registerMedium(pTarget, &pMedium,7394 mrc = pParent->m->pVirtualBox->i_registerMedium(pTarget, &pMedium, 7395 7395 DeviceType_HardDisk); 7396 7396 Assert( FAILED(mrc) … … 7407 7407 eik.restore(); 7408 7408 ComObjPtr<Medium> pMedium; 7409 mrc = m->pVirtualBox-> registerMedium(pTarget, &pMedium,7409 mrc = m->pVirtualBox->i_registerMedium(pTarget, &pMedium, 7410 7410 DeviceType_HardDisk); 7411 7411 Assert( FAILED(mrc) … … 7445 7445 /* collect multiple errors */ 7446 7446 eik.restore(); 7447 m->pVirtualBox-> saveModifiedRegistries();7447 m->pVirtualBox->i_saveModifiedRegistries(); 7448 7448 eik.fetch(); 7449 7449 } … … 7940 7940 if (capabilities & MediumFormatCapabilities_File) 7941 7941 { 7942 rc = VirtualBox:: ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);7942 rc = VirtualBox::i_ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */); 7943 7943 if (FAILED(rc)) 7944 7944 throw rc; … … 8028 8028 { 8029 8029 targetId.create(); 8030 /* VirtualBox:: registerMedium() will need UUID */8030 /* VirtualBox::i_registerMedium() will need UUID */ 8031 8031 unconst(m->id) = targetId; 8032 8032 } … … 8066 8066 if (capabilities & MediumFormatCapabilities_File) 8067 8067 { 8068 HRESULT rc = VirtualBox:: ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */);8068 HRESULT rc = VirtualBox::i_ensureFilePathExists(targetLocation, !(task.mVariant & MediumVariant_NoCreateDir) /* fCreate */); 8069 8069 if (FAILED(rc)) 8070 8070 throw rc; … … 8162 8162 { 8163 8163 /* we set mParent & children() */ 8164 AutoWriteLock alock2(m->pVirtualBox-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);8164 AutoWriteLock alock2(m->pVirtualBox->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 8165 8165 8166 8166 Assert(m->pParent.isNull()); … … 8178 8178 eik.restore(); 8179 8179 ComObjPtr<Medium> pMedium; 8180 mrc = pParent->m->pVirtualBox-> registerMedium(this, &pMedium,8180 mrc = pParent->m->pVirtualBox->i_registerMedium(this, &pMedium, 8181 8181 DeviceType_HardDisk); 8182 8182 Assert(this == pMedium); … … 8192 8192 eik.restore(); 8193 8193 ComObjPtr<Medium> pMedium; 8194 mrc = m->pVirtualBox-> registerMedium(this, &pMedium, DeviceType_HardDisk);8194 mrc = m->pVirtualBox->i_registerMedium(this, &pMedium, DeviceType_HardDisk); 8195 8195 Assert(this == pMedium); 8196 8196 eik.fetch(); … … 8227 8227 /* collect multiple errors */ 8228 8228 eik.restore(); 8229 m->pVirtualBox-> saveModifiedRegistries();8229 m->pVirtualBox->i_saveModifiedRegistries(); 8230 8230 eik.fetch(); 8231 8231 } -
trunk/src/VBox/Main/src-server/NATNetworkImpl.cpp
r49762 r50355 248 248 m->maNATLoopbackOffsetList.end()); 249 249 250 mVirtualBox-> onNATNetworkSetting(Bstr(mName).raw(),251 data.fEnabled ? TRUE : FALSE,252 Bstr(m->IPv4NetworkCidr).raw(),253 Bstr(m->IPv4Gateway).raw(),254 data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE,255 data.fNeedDhcpServer ? TRUE : FALSE);250 mVirtualBox->i_onNATNetworkSetting(Bstr(mName).raw(), 251 data.fEnabled ? TRUE : FALSE, 252 Bstr(m->IPv4NetworkCidr).raw(), 253 Bstr(m->IPv4Gateway).raw(), 254 data.fAdvertiseDefaultIPv6Route ? TRUE : FALSE, 255 data.fNeedDhcpServer ? TRUE : FALSE); 256 256 257 257 /* Notify listerners listening on this network only */ … … 290 290 } 291 291 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 292 HRESULT rc = mVirtualBox-> saveSettings();292 HRESULT rc = mVirtualBox->i_saveSettings(); 293 293 ComAssertComRCRetRC(rc); 294 294 … … 314 314 315 315 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 316 HRESULT rc = mVirtualBox-> saveSettings();316 HRESULT rc = mVirtualBox->i_saveSettings(); 317 317 ComAssertComRCRetRC(rc); 318 318 return S_OK; … … 354 354 355 355 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 356 HRESULT rc = mVirtualBox-> saveSettings();356 HRESULT rc = mVirtualBox->i_saveSettings(); 357 357 ComAssertComRCRetRC(rc); 358 358 return S_OK; … … 380 380 381 381 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 382 HRESULT rc = mVirtualBox-> saveSettings();382 HRESULT rc = mVirtualBox->i_saveSettings(); 383 383 ComAssertComRCRetRC(rc); 384 384 … … 413 413 414 414 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 415 HRESULT rc = mVirtualBox-> saveSettings();415 HRESULT rc = mVirtualBox->i_saveSettings(); 416 416 ComAssertComRCRetRC(rc); 417 417 … … 441 441 442 442 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 443 HRESULT rc = mVirtualBox-> saveSettings();443 HRESULT rc = mVirtualBox->i_saveSettings(); 444 444 ComAssertComRCRetRC(rc); 445 445 … … 470 470 471 471 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 472 HRESULT rc = mVirtualBox-> saveSettings();472 HRESULT rc = mVirtualBox->i_saveSettings(); 473 473 ComAssertComRCRetRC(rc); 474 474 … … 535 535 536 536 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 537 return mVirtualBox-> saveSettings();537 return mVirtualBox->i_saveSettings(); 538 538 } 539 539 … … 552 552 553 553 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 554 return mVirtualBox-> saveSettings();554 return mVirtualBox->i_saveSettings(); 555 555 } 556 556 … … 580 580 581 581 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 582 return mVirtualBox-> saveSettings();582 return mVirtualBox->i_saveSettings(); 583 583 } 584 584 … … 653 653 { 654 654 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 655 HRESULT rc = mVirtualBox-> saveSettings();655 HRESULT rc = mVirtualBox->i_saveSettings(); 656 656 ComAssertComRCRetRC(rc); 657 657 } 658 658 659 mVirtualBox-> onNATNetworkPortForward(Bstr(mName).raw(), TRUE, aIsIpv6,660 Bstr(aPortForwardRuleName).raw(), aProto,661 Bstr(aHostIp).raw(), aHostPort,662 Bstr(aGuestIp).raw(), aGuestPort);659 mVirtualBox->i_onNATNetworkPortForward(Bstr(mName).raw(), TRUE, aIsIpv6, 660 Bstr(aPortForwardRuleName).raw(), aProto, 661 Bstr(aHostIp).raw(), aHostPort, 662 Bstr(aGuestIp).raw(), aGuestPort); 663 663 664 664 /* Notify listerners listening on this network only */ … … 698 698 { 699 699 AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS); 700 HRESULT rc = mVirtualBox-> saveSettings();700 HRESULT rc = mVirtualBox->i_saveSettings(); 701 701 ComAssertComRCRetRC(rc); 702 702 } 703 703 704 mVirtualBox-> onNATNetworkPortForward(Bstr(mName).raw(), FALSE, aIsIpv6,705 Bstr(aPortForwardRuleName).raw(), proto,706 Bstr(strHostIP).raw(), u16HostPort,707 Bstr(strGuestIP).raw(), u16GuestPort);704 mVirtualBox->i_onNATNetworkPortForward(Bstr(mName).raw(), FALSE, aIsIpv6, 705 Bstr(aPortForwardRuleName).raw(), proto, 706 Bstr(strHostIP).raw(), u16HostPort, 707 Bstr(strGuestIP).raw(), u16GuestPort); 708 708 709 709 /* Notify listerners listening on this network only */ … … 799 799 if (RT_SUCCESS(m->NATRunner.start())) 800 800 { 801 mVirtualBox-> onNATNetworkStartStop(Bstr(mName).raw(), TRUE);801 mVirtualBox->i_onNATNetworkStartStop(Bstr(mName).raw(), TRUE); 802 802 return S_OK; 803 803 } … … 818 818 if (RT_SUCCESS(m->NATRunner.stop())) 819 819 { 820 mVirtualBox-> onNATNetworkStartStop(Bstr(mName).raw(), FALSE);820 mVirtualBox->i_onNATNetworkStartStop(Bstr(mName).raw(), FALSE); 821 821 return S_OK; 822 822 } -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r49951 r50355 1402 1402 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1403 1403 LogRel(("VM '%ls' stops using NAT network '%ls'\n", bstrName.raw(), Bstr(networkName).raw())); 1404 int natCount = mParent->getVirtualBox()-> natNetworkRefDec(Bstr(networkName).raw());1404 int natCount = mParent->getVirtualBox()->i_natNetworkRefDec(Bstr(networkName).raw()); 1405 1405 if (natCount == -1) 1406 1406 return E_INVALIDARG; /* no such network */ … … 1425 1425 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1426 1426 LogRel(("VM '%ls' starts using NAT network '%ls'\n", bstrName.raw(), Bstr(aNatNetworkName).raw())); 1427 int natCount = mParent->getVirtualBox()-> natNetworkRefInc(Bstr(aNatNetworkName).raw());1427 int natCount = mParent->getVirtualBox()->i_natNetworkRefInc(Bstr(aNatNetworkName).raw()); 1428 1428 if (natCount == -1) 1429 1429 return E_INVALIDARG; /* not found */ -
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r49960 r50355 1253 1253 // save the global settings 1254 1254 AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS); 1255 rc = mParent-> saveSettings();1255 rc = mParent->i_saveSettings(); 1256 1256 } 1257 1257 1258 1258 /* inform callbacks */ 1259 mParent-> onSnapshotChange(uuidMachine, uuidSnapshot);1259 mParent->i_onSnapshotChange(uuidMachine, uuidSnapshot); 1260 1260 1261 1261 return rc; … … 1463 1463 { 1464 1464 // ensure the directory for the saved state file exists 1465 HRESULT rc = VirtualBox:: ensureFilePathExists(strStateFilePath, true /* fCreate */);1465 HRESULT rc = VirtualBox::i_ensureFilePathExists(strStateFilePath, true /* fCreate */); 1466 1466 if (FAILED(rc)) return rc; 1467 1467 } … … 1625 1625 1626 1626 /* inform callbacks */ 1627 mParent-> onSnapshotTaken(mData->mUuid,1628 mConsoleTaskData.mSnapshot->i_getId());1627 mParent->i_onSnapshotTaken(mData->mUuid, 1628 mConsoleTaskData.mSnapshot->i_getId()); 1629 1629 machineLock.release(); 1630 1630 } … … 1660 1660 /* machineLock has been released already */ 1661 1661 1662 mParent-> saveModifiedRegistries();1662 mParent->i_saveModifiedRegistries(); 1663 1663 1664 1664 return rc; … … 1994 1994 alock.release(); 1995 1995 1996 mParent-> markRegistryModified(mParent->getGlobalRegistryId());1996 mParent->i_markRegistryModified(mParent->i_getGlobalRegistryId()); 1997 1997 1998 1998 // from here on we cannot roll back on failure any more … … 2033 2033 } 2034 2034 2035 mParent-> saveModifiedRegistries();2035 mParent->i_saveModifiedRegistries(); 2036 2036 2037 2037 /* set the result (this will try to fetch current error info on failure) */ … … 2039 2039 2040 2040 if (SUCCEEDED(rc)) 2041 mParent-> onSnapshotDeleted(mData->mUuid, Guid());2041 mParent->i_onSnapshotDeleted(mData->mUuid, Guid()); 2042 2042 2043 2043 LogFlowThisFunc(("Done restoring snapshot (rc=%08X)\n", rc)); … … 2361 2361 // has exited after setting the machine state to MachineState_DeletingSnapshot 2362 2362 2363 AutoWriteLock treeLock(mParent-> getMediaTreeLockHandle()2363 AutoWriteLock treeLock(mParent->i_getMediaTreeLockHandle() 2364 2364 COMMA_LOCKVAL_SRC_POS); 2365 2365 … … 2661 2661 // machine will need saving now 2662 2662 machineLock.release(); 2663 mParent-> markRegistryModified(getId());2663 mParent->i_markRegistryModified(getId()); 2664 2664 } 2665 2665 } … … 2692 2692 /* no real merge needed, just updating state and delete 2693 2693 * diff files if necessary */ 2694 AutoMultiWriteLock2 mLock(&mParent-> getMediaTreeLockHandle(), pMedium->lockHandle() COMMA_LOCKVAL_SRC_POS);2694 AutoMultiWriteLock2 mLock(&mParent->i_getMediaTreeLockHandle(), pMedium->lockHandle() COMMA_LOCKVAL_SRC_POS); 2695 2695 2696 2696 Assert( !it->mfMergeForward … … 2840 2840 2841 2841 // One attachment is merged, must save the settings 2842 mParent-> markRegistryModified(getId());2842 mParent->i_markRegistryModified(getId()); 2843 2843 2844 2844 // prevent calling cancelDeleteSnapshotMedium() for this attachment … … 2860 2860 2861 2861 machineLock.release(); 2862 mParent-> markRegistryModified(getId());2862 mParent->i_markRegistryModified(getId()); 2863 2863 } 2864 2864 } … … 2874 2874 2875 2875 AutoMultiWriteLock2 multiLock(this->lockHandle(), // machine 2876 &mParent-> getMediaTreeLockHandle() // media tree2876 &mParent->i_getMediaTreeLockHandle() // media tree 2877 2877 COMMA_LOCKVAL_SRC_POS); 2878 2878 … … 2902 2902 updateMachineStateOnClient(); 2903 2903 2904 mParent-> saveModifiedRegistries();2904 mParent->i_saveModifiedRegistries(); 2905 2905 } 2906 2906 … … 2909 2909 2910 2910 if (SUCCEEDED(rc)) 2911 mParent-> onSnapshotDeleted(mData->mUuid, snapshotId);2911 mParent->i_onSnapshotDeleted(mData->mUuid, snapshotId); 2912 2912 2913 2913 LogFlowThisFunc(("Done deleting snapshot (rc=%08X)\n", rc)); … … 2965 2965 ComPtr<IToken> &aHDLockToken) 2966 2966 { 2967 Assert(!mParent-> getMediaTreeLockHandle().isWriteLockOnCurrentThread());2967 Assert(!mParent->i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 2968 2968 Assert(!fOnlineMergePossible || VALID_PTR(aVMMALockList)); 2969 2969 … … 3255 3255 if (aMediumLockList == NULL) 3256 3256 { 3257 AutoMultiWriteLock2 mLock(&mParent-> getMediaTreeLockHandle(), aHD->lockHandle() COMMA_LOCKVAL_SRC_POS);3257 AutoMultiWriteLock2 mLock(&mParent->i_getMediaTreeLockHandle(), aHD->lockHandle() COMMA_LOCKVAL_SRC_POS); 3258 3258 3259 3259 Assert(aHD->i_getChildren().size() == 0); … … 3446 3446 // the merge; reparent target if necessary and uninitialize media 3447 3447 3448 AutoWriteLock treeLock(mParent-> getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3448 AutoWriteLock treeLock(mParent->i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3449 3449 3450 3450 // Declare this here to make sure the object does not get uninitialized … … 3457 3457 // first, unregister the target since it may become a base 3458 3458 // hard disk which needs re-registration 3459 rc = mParent-> unregisterMedium(pDeleteRec->mpTarget);3459 rc = mParent->i_unregisterMedium(pDeleteRec->mpTarget); 3460 3460 AssertComRC(rc); 3461 3461 … … 3468 3468 3469 3469 // then, register again 3470 rc = mParent-> registerMedium(pDeleteRec->mpTarget, &pDeleteRec->mpTarget, DeviceType_HardDisk);3470 rc = mParent->i_registerMedium(pDeleteRec->mpTarget, &pDeleteRec->mpTarget, DeviceType_HardDisk); 3471 3471 AssertComRC(rc); 3472 3472 } … … 3540 3540 else 3541 3541 { 3542 rc = mParent-> unregisterMedium(pMedium);3542 rc = mParent->i_unregisterMedium(pMedium); 3543 3543 AssertComRC(rc); 3544 3544 -
trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp
r49644 r50355 91 91 { 92 92 unconst(pVirtualBox) = aMachine->getVirtualBox(); 93 unconst(pSystemProperties) = pVirtualBox-> getSystemProperties();93 unconst(pSystemProperties) = pVirtualBox->i_getSystemProperties(); 94 94 } 95 95 … … 147 147 if (FAILED(rc)) 148 148 return rc; 149 rc = aParent->getVirtualBox()-> getSystemProperties()->GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances);149 rc = aParent->getVirtualBox()->i_getSystemProperties()->GetMaxInstancesOfStorageBus(chipsetType, aStorageBus, &maxInstances); 150 150 if (FAILED(rc)) 151 151 return rc; -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r50291 r50355 292 292 alock.release(); 293 293 294 // VirtualBox:: saveSettings() needs vbox write lock294 // VirtualBox::i_saveSettings() needs vbox write lock 295 295 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 296 HRESULT rc = mParent-> saveSettings();296 HRESULT rc = mParent->i_saveSettings(); 297 297 298 298 return rc; … … 602 602 if (SUCCEEDED(rc)) 603 603 { 604 // VirtualBox:: saveSettings() needs vbox write lock604 // VirtualBox::i_saveSettings() needs vbox write lock 605 605 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 606 rc = mParent-> saveSettings();606 rc = mParent->i_saveSettings(); 607 607 } 608 608 … … 632 632 { 633 633 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 634 rc = mParent-> saveSettings();634 rc = mParent->i_saveSettings(); 635 635 } 636 636 else … … 665 665 if (SUCCEEDED(rc)) 666 666 { 667 // VirtualBox:: saveSettings() needs vbox write lock667 // VirtualBox::i_saveSettings() needs vbox write lock 668 668 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 669 rc = mParent-> saveSettings();669 rc = mParent->i_saveSettings(); 670 670 } 671 671 … … 733 733 if (SUCCEEDED(rc)) 734 734 { 735 // VirtualBox:: saveSettings() needs vbox write lock735 // VirtualBox::i_saveSettings() needs vbox write lock 736 736 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 737 rc = mParent-> saveSettings();737 rc = mParent->i_saveSettings(); 738 738 } 739 739 … … 758 758 if (SUCCEEDED(rc)) 759 759 { 760 // VirtualBox:: saveSettings() needs vbox write lock760 // VirtualBox::i_saveSettings() needs vbox write lock 761 761 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 762 rc = mParent-> saveSettings();762 rc = mParent->i_saveSettings(); 763 763 } 764 764 … … 777 777 else 778 778 #ifdef VBOX_WITH_EXTPACK 779 hrc = mParent-> getExtPackManager()->checkVrdeExtPack(&strExtPack);779 hrc = mParent->i_getExtPackManager()->checkVrdeExtPack(&strExtPack); 780 780 #else 781 781 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str()); … … 785 785 { 786 786 #ifdef VBOX_WITH_EXTPACK 787 hrc = mParent-> getExtPackManager()->getDefaultVrdeExtPack(&strExtPack);787 hrc = mParent->i_getExtPackManager()->getDefaultVrdeExtPack(&strExtPack); 788 788 #endif 789 789 if (strExtPack.isEmpty()) … … 823 823 else 824 824 #ifdef VBOX_WITH_EXTPACK 825 hrc = mParent-> getExtPackManager()->checkVrdeExtPack(&aExtPack);825 hrc = mParent->i_getExtPackManager()->checkVrdeExtPack(&aExtPack); 826 826 #else 827 827 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str()); … … 834 834 if (SUCCEEDED(hrc)) 835 835 { 836 /* VirtualBox:: saveSettings() needs the VirtualBox write lock. */836 /* VirtualBox::i_saveSettings() needs the VirtualBox write lock. */ 837 837 alock.release(); 838 838 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 839 hrc = mParent-> saveSettings();839 hrc = mParent->i_saveSettings(); 840 840 } 841 841 } … … 861 861 alock.release(); 862 862 863 // VirtualBox:: saveSettings() needs vbox write lock863 // VirtualBox::i_saveSettings() needs vbox write lock 864 864 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 865 HRESULT rc = mParent-> saveSettings();865 HRESULT rc = mParent->i_saveSettings(); 866 866 867 867 return rc; … … 894 894 if (SUCCEEDED(rc)) 895 895 { 896 // VirtualBox:: saveSettings() needs vbox write lock896 // VirtualBox::i_saveSettings() needs vbox write lock 897 897 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 898 rc = mParent-> saveSettings();898 rc = mParent->i_saveSettings(); 899 899 } 900 900 … … 933 933 if (SUCCEEDED(rc)) 934 934 { 935 // VirtualBox:: saveSettings() needs vbox write lock935 // VirtualBox::i_saveSettings() needs vbox write lock 936 936 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 937 rc = mParent-> saveSettings();937 rc = mParent->i_saveSettings(); 938 938 } 939 939 … … 958 958 if (SUCCEEDED(rc)) 959 959 { 960 // VirtualBox:: saveSettings() needs vbox write lock960 // VirtualBox::i_saveSettings() needs vbox write lock 961 961 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 962 rc = mParent-> saveSettings();962 rc = mParent->i_saveSettings(); 963 963 } 964 964 … … 1216 1216 { 1217 1217 HRESULT rc = S_OK; 1218 AutostartDb *autostartDb = this->mParent-> getAutostartDb();1218 AutostartDb *autostartDb = this->mParent->i_getAutostartDb(); 1219 1219 1220 1220 if (!aPath.isEmpty()) … … 1259 1259 vrc = RTPathUserHome(strTemp, sizeof(strTemp)); 1260 1260 AssertRC(vrc); 1261 Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, Bstr(VirtualBox:: getVersionNormalized()).raw());1261 Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, Bstr(VirtualBox::i_getVersionNormalized()).raw()); 1262 1262 1263 1263 /* Check the standard image locations */ -
trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
r49960 r50355 51 51 Data(Machine *pMachine) 52 52 : pParent(pMachine), 53 pHost(pMachine->getVirtualBox()-> host())53 pHost(pMachine->getVirtualBox()->i_host()) 54 54 { } 55 55 -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r49960 r50355 218 218 // (getOpenedMachines requests locks which are incompatible with the lock of the machines list) 219 219 SessionMachinesList llOpenedMachines; 220 mHost->i_parent()-> getOpenedMachines(llOpenedMachines);220 mHost->i_parent()->i_getOpenedMachines(llOpenedMachines); 221 221 222 222 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 329 329 // (getOpenedMachines requests locks which are incompatible with the host object lock) 330 330 SessionMachinesList llOpenedMachines; 331 mHost->i_parent()-> getOpenedMachines(llOpenedMachines);331 mHost->i_parent()->i_getOpenedMachines(llOpenedMachines); 332 332 333 333 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 862 862 // (getOpenedMachines requests higher priority locks) 863 863 SessionMachinesList llOpenedMachines; 864 mHost->i_parent()-> getOpenedMachines(llOpenedMachines);864 mHost->i_parent()->i_getOpenedMachines(llOpenedMachines); 865 865 866 866 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); -
trunk/src/VBox/Main/src-server/VRDEServerImpl.cpp
r49662 r50355 537 537 #ifdef VBOX_WITH_EXTPACK 538 538 VirtualBox *pVirtualBox = mParent->getVirtualBox(); 539 ExtPackManager *pExtPackMgr = pVirtualBox-> getExtPackManager();539 ExtPackManager *pExtPackMgr = pVirtualBox->i_getExtPackManager(); 540 540 vrc = pExtPackMgr->getVrdeLibraryPathForExtPack(&strExtPack, &strVrdeLibrary); 541 541 #else … … 806 806 { 807 807 #ifdef VBOX_WITH_EXTPACK 808 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()-> getExtPackManager();808 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->i_getExtPackManager(); 809 809 hrc = pExtPackMgr->checkVrdeExtPack(&strExtPack); 810 810 #else … … 851 851 { 852 852 #ifdef VBOX_WITH_EXTPACK 853 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()-> getExtPackManager();853 ExtPackManager *pExtPackMgr = mParent->getVirtualBox()->i_getExtPackManager(); 854 854 hrc = pExtPackMgr->checkVrdeExtPack(&aExtPack); 855 855 #else -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r49951 r50355 69 69 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 70 70 #include "EventImpl.h" 71 // #include "VBoxEvents.h"72 71 #ifdef VBOX_WITH_EXTPACK 73 72 # include "ExtPackManagerImpl.h" … … 99 98 100 99 // static 101 Bstr VirtualBox::sVersion;100 com::Utf8Str VirtualBox::sVersion; 102 101 103 102 // static 104 Bstr VirtualBox::sVersionNormalized;103 com::Utf8Str VirtualBox::sVersionNormalized; 105 104 106 105 // static … … 108 107 109 108 // static 110 Bstr VirtualBox::sPackageType;109 com::Utf8Str VirtualBox::sPackageType; 111 110 112 111 // static 113 Bstr VirtualBox::sAPIVersion;112 com::Utf8Str VirtualBox::sAPIVersion; 114 113 115 114 // static 116 std::map< Bstr, int> VirtualBox::sNatNetworkNameToRefCount;115 std::map<com::Utf8Str, int> VirtualBox::sNatNetworkNameToRefCount; 117 116 118 117 // static leaked (todo: find better place to free it.) … … 306 305 ///////////////////////////////////////////////////////////////////////////// 307 306 308 VirtualBox::VirtualBox() 309 {} 310 311 VirtualBox::~VirtualBox() 312 {} 307 DEFINE_EMPTY_CTOR_DTOR(VirtualBox) 313 308 314 309 HRESULT VirtualBox::FinalConstruct() … … 374 369 spMtxNatNetworkNameToRefCountLock = new RWLockHandle(LOCKCLASS_VIRTUALBOXOBJECT); 375 370 376 LogFlowThisFunc(("Version: %ls, Package: %ls, API Version: %ls\n", sVersion.raw(), sPackageType.raw(), sAPIVersion.raw()));371 LogFlowThisFunc(("Version: %ls, Package: %ls, API Version: %ls\n", Bstr(sVersion).raw(), Bstr(sPackageType).raw(), Bstr(sAPIVersion).raw())); 377 372 378 373 /* Get the VirtualBox home directory. */ … … 471 466 #ifdef DEBUG 472 467 LogFlowThisFunc(("Dumping media backreferences\n")); 473 dumpAllBackRefs();468 i_dumpAllBackRefs(); 474 469 #endif 475 470 … … 486 481 if (FAILED(rc)) throw rc; 487 482 488 rc = registerDHCPServer(pDhcpServer, false /* aSaveRegistry */);483 rc = i_registerDHCPServer(pDhcpServer, false /* aSaveRegistry */); 489 484 if (FAILED(rc)) throw rc; 490 485 } … … 504 499 } 505 500 506 rc = registerNATNetwork(pNATNetwork, false /* aSaveRegistry */);501 rc = i_registerNATNetwork(pNATNetwork, false /* aSaveRegistry */); 507 502 AssertComRCReturnRC(rc); 508 503 } … … 611 606 &uuid); 612 607 if (SUCCEEDED(rc)) 613 rc = registerMachine(pMachine);608 rc = i_registerMachine(pMachine); 614 609 if (FAILED(rc)) 615 610 return rc; … … 650 645 strMachineFolder.c_str())); 651 646 652 AutoWriteLock treeLock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);647 AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 653 648 654 649 HRESULT rc = S_OK; … … 670 665 if (FAILED(rc)) return rc; 671 666 672 rc = registerMedium(pHardDisk, &pHardDisk, DeviceType_HardDisk);667 rc = i_registerMedium(pHardDisk, &pHardDisk, DeviceType_HardDisk); 673 668 if (FAILED(rc)) return rc; 674 669 } … … 690 685 if (FAILED(rc)) return rc; 691 686 692 rc = registerMedium(pImage, &pImage, DeviceType_DVD);687 rc = i_registerMedium(pImage, &pImage, DeviceType_DVD); 693 688 if (FAILED(rc)) return rc; 694 689 } … … 710 705 if (FAILED(rc)) return rc; 711 706 712 rc = registerMedium(pImage, &pImage, DeviceType_Floppy);707 rc = i_registerMedium(pImage, &pImage, DeviceType_Floppy); 713 708 if (FAILED(rc)) return rc; 714 709 } … … 723 718 Assert(!m->uRegistryNeedsSaving); 724 719 if (m->uRegistryNeedsSaving) 725 saveSettings();720 i_saveSettings(); 726 721 727 722 /* Enclose the state transition Ready->InUninit->NotReady */ … … 831 826 } 832 827 833 // IVirtualBox properties828 // Wrapped IVirtualBox properties 834 829 ///////////////////////////////////////////////////////////////////////////// 835 836 STDMETHODIMP VirtualBox::COMGETTER(Version)(BSTR *aVersion) 837 { 838 CheckComArgNotNull(aVersion); 839 840 AutoCaller autoCaller(this); 841 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 842 843 sVersion.cloneTo(aVersion); 830 HRESULT VirtualBox::getVersion(com::Utf8Str &aVersion) 831 { 832 aVersion = sVersion; 844 833 return S_OK; 845 834 } 846 835 847 STDMETHODIMP VirtualBox::COMGETTER(VersionNormalized)(BSTR *aVersionNormalized) 848 { 849 CheckComArgNotNull(aVersionNormalized); 850 851 AutoCaller autoCaller(this); 852 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 853 854 sVersionNormalized.cloneTo(aVersionNormalized); 836 HRESULT VirtualBox::getVersionNormalized(com::Utf8Str &aVersionNormalized) 837 { 838 aVersionNormalized = sVersionNormalized; 855 839 return S_OK; 856 840 } 857 841 858 STDMETHODIMP VirtualBox::COMGETTER(Revision)(ULONG *aRevision) 859 { 860 CheckComArgNotNull(aRevision); 861 862 AutoCaller autoCaller(this); 863 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 864 842 HRESULT VirtualBox::getRevision(ULONG *aRevision) 843 { 865 844 *aRevision = sRevision; 866 845 return S_OK; 867 846 } 868 847 869 STDMETHODIMP VirtualBox::COMGETTER(PackageType)(BSTR *aPackageType) 870 { 871 CheckComArgNotNull(aPackageType); 872 873 AutoCaller autoCaller(this); 874 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 875 876 sPackageType.cloneTo(aPackageType); 848 HRESULT VirtualBox::getPackageType(com::Utf8Str &aPackageType) 849 { 850 aPackageType = sPackageType; 877 851 return S_OK; 878 852 } 879 853 880 STDMETHODIMP VirtualBox::COMGETTER(APIVersion)(BSTR *aAPIVersion) 881 { 882 CheckComArgNotNull(aAPIVersion); 883 884 AutoCaller autoCaller(this); 885 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 886 887 sAPIVersion.cloneTo(aAPIVersion); 854 HRESULT VirtualBox::getAPIVersion(com::Utf8Str &aAPIVersion) 855 { 856 aAPIVersion = sAPIVersion; 888 857 return S_OK; 889 858 } 890 859 891 STDMETHODIMP VirtualBox::COMGETTER(HomeFolder)(BSTR *aHomeFolder) 892 { 893 CheckComArgNotNull(aHomeFolder); 894 895 AutoCaller autoCaller(this); 896 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 897 860 HRESULT VirtualBox::getHomeFolder(com::Utf8Str &aHomeFolder) 861 { 898 862 /* mHomeDir is const and doesn't need a lock */ 899 m->strHomeDir.cloneTo(aHomeFolder);863 aHomeFolder = m->strHomeDir; 900 864 return S_OK; 901 865 } 902 866 903 STDMETHODIMP VirtualBox::COMGETTER(SettingsFilePath)(BSTR *aSettingsFilePath) 904 { 905 CheckComArgNotNull(aSettingsFilePath); 906 907 AutoCaller autoCaller(this); 908 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 909 867 HRESULT VirtualBox::getSettingsFilePath(com::Utf8Str &aSettingsFilePath) 868 { 910 869 /* mCfgFile.mName is const and doesn't need a lock */ 911 m->strSettingsFilePath.cloneTo(aSettingsFilePath);870 aSettingsFilePath = m->strSettingsFilePath; 912 871 return S_OK; 913 872 } 914 873 915 STDMETHODIMP VirtualBox::COMGETTER(Host)(IHost **aHost) 916 { 917 CheckComArgOutPointerValid(aHost); 918 919 AutoCaller autoCaller(this); 920 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 921 874 HRESULT VirtualBox::getHost(ComPtr<IHost> &aHost) 875 { 922 876 /* mHost is const, no need to lock */ 923 m->pHost.queryInterfaceTo(aHost );877 m->pHost.queryInterfaceTo(aHost.asOutParam()); 924 878 return S_OK; 925 879 } 926 880 927 STDMETHODIMP 928 VirtualBox::COMGETTER(SystemProperties)(ISystemProperties **aSystemProperties) 929 { 930 CheckComArgOutPointerValid(aSystemProperties); 931 932 AutoCaller autoCaller(this); 933 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 934 881 HRESULT VirtualBox::getSystemProperties(ComPtr<ISystemProperties> &aSystemProperties) 882 { 935 883 /* mSystemProperties is const, no need to lock */ 936 m->pSystemProperties.queryInterfaceTo(aSystemProperties );884 m->pSystemProperties.queryInterfaceTo(aSystemProperties.asOutParam()); 937 885 return S_OK; 938 886 } 939 887 940 STDMETHODIMP 941 VirtualBox::COMGETTER(Machines)(ComSafeArrayOut(IMachine *, aMachines)) 942 { 943 CheckComArgOutSafeArrayPointerValid(aMachines); 944 945 AutoCaller autoCaller(this); 946 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 947 888 HRESULT VirtualBox::getMachines(std::vector<ComPtr<IMachine> > &aMachines) 889 { 948 890 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 949 SafeIfaceArray<IMachine> machines(m->allMachines.getList()); 950 machines.detachTo(ComSafeArrayOutArg(aMachines)); 951 891 aMachines.resize(m->allMachines.size()); 892 size_t i = 0; 893 for (MachinesOList::const_iterator it= m->allMachines.begin(); 894 it!= m->allMachines.end(); ++it, ++i) 895 (*it).queryInterfaceTo(aMachines[i].asOutParam()); 952 896 return S_OK; 953 897 } 954 898 955 STDMETHODIMP 956 VirtualBox::COMGETTER(MachineGroups)(ComSafeArrayOut(BSTR, aMachineGroups)) 957 { 958 CheckComArgOutSafeArrayPointerValid(aMachineGroups); 959 960 AutoCaller autoCaller(this); 961 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 962 963 std::list<Bstr> allGroups; 899 HRESULT VirtualBox::getMachineGroups(std::vector<com::Utf8Str> &aMachineGroups) 900 { 901 std::list<com::Utf8Str> allGroups; 964 902 965 903 /* get copy of all machine references, to avoid holding the list lock */ … … 983 921 const StringsList &thisGroups = pMachine->getGroups(); 984 922 for (StringsList::const_iterator it2 = thisGroups.begin(); 985 it2 != thisGroups.end(); 986 ++it2) 923 it2 != thisGroups.end(); ++it2) 987 924 allGroups.push_back(*it2); 988 925 } … … 992 929 allGroups.sort(); 993 930 allGroups.unique(); 994 com::SafeArray<BSTR> machineGroups(allGroups.size());931 aMachineGroups.resize(allGroups.size()); 995 932 size_t i = 0; 996 for (std::list<Bstr>::const_iterator it = allGroups.begin(); 997 it != allGroups.end(); 998 ++it, i++) 999 { 1000 const Bstr &tmp = *it; 1001 tmp.cloneTo(&machineGroups[i]); 1002 } 1003 machineGroups.detachTo(ComSafeArrayOutArg(aMachineGroups)); 1004 933 for (std::list<com::Utf8Str>::const_iterator it = allGroups.begin(); 934 it != allGroups.end(); ++it, ++i) 935 aMachineGroups[i] = (*it); 1005 936 return S_OK; 1006 937 } 1007 938 1008 STDMETHODIMP VirtualBox::COMGETTER(HardDisks)(ComSafeArrayOut(IMedium *, aHardDisks)) 1009 { 1010 CheckComArgOutSafeArrayPointerValid(aHardDisks); 1011 1012 AutoCaller autoCaller(this); 1013 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1014 939 HRESULT VirtualBox::getHardDisks(std::vector<ComPtr<IMedium> > &aHardDisks) 940 { 1015 941 AutoReadLock al(m->allHardDisks.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1016 SafeIfaceArray<IMedium> hardDisks(m->allHardDisks.getList()); 1017 hardDisks.detachTo(ComSafeArrayOutArg(aHardDisks)); 1018 942 aHardDisks.resize(m->allHardDisks.size()); 943 size_t i = 0; 944 for (MediaOList::const_iterator it = m->allHardDisks.begin(); 945 it != m->allHardDisks.end(); ++it, ++i) 946 (*it).queryInterfaceTo(aHardDisks[i].asOutParam()); 1019 947 return S_OK; 1020 948 } 1021 949 1022 STDMETHODIMP VirtualBox::COMGETTER(DVDImages)(ComSafeArrayOut(IMedium *, aDVDImages)) 1023 { 1024 CheckComArgOutSafeArrayPointerValid(aDVDImages); 1025 1026 AutoCaller autoCaller(this); 1027 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1028 950 HRESULT VirtualBox::getDVDImages(std::vector<ComPtr<IMedium> > &aDVDImages) 951 { 1029 952 AutoReadLock al(m->allDVDImages.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1030 SafeIfaceArray<IMedium> images(m->allDVDImages.getList()); 1031 images.detachTo(ComSafeArrayOutArg(aDVDImages)); 1032 953 aDVDImages.resize(m->allDVDImages.size()); 954 size_t i = 0; 955 for (MediaOList::const_iterator it = m->allDVDImages.begin(); 956 it!= m->allDVDImages.end(); ++it, ++i) 957 (*it).queryInterfaceTo(aDVDImages[i].asOutParam()); 1033 958 return S_OK; 1034 959 } 1035 960 1036 STDMETHODIMP VirtualBox::COMGETTER(FloppyImages)(ComSafeArrayOut(IMedium *, aFloppyImages)) 1037 { 1038 CheckComArgOutSafeArrayPointerValid(aFloppyImages); 1039 1040 AutoCaller autoCaller(this); 1041 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1042 961 HRESULT VirtualBox::getFloppyImages(std::vector<ComPtr<IMedium> > &aFloppyImages) 962 { 1043 963 AutoReadLock al(m->allFloppyImages.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1044 SafeIfaceArray<IMedium> images(m->allFloppyImages.getList()); 1045 images.detachTo(ComSafeArrayOutArg(aFloppyImages)); 1046 964 aFloppyImages.resize(m->allFloppyImages.size()); 965 size_t i = 0; 966 for (MediaOList::const_iterator it = m->allFloppyImages.begin(); 967 it != m->allFloppyImages.end(); ++it, ++i) 968 (*it).queryInterfaceTo(aFloppyImages[i].asOutParam()); 1047 969 return S_OK; 1048 970 } 1049 971 1050 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations)(ComSafeArrayOut(IProgress *, aOperations)) 1051 { 1052 CheckComArgOutPointerValid(aOperations); 1053 1054 AutoCaller autoCaller(this); 1055 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1056 972 HRESULT VirtualBox::getProgressOperations(std::vector<ComPtr<IProgress> > &aProgressOperations) 973 { 1057 974 /* protect mProgressOperations */ 1058 975 AutoReadLock safeLock(m->mtxProgressOperations COMMA_LOCKVAL_SRC_POS); 1059 SafeIfaceArray<IProgress> progress(m->mapProgressOperations); 1060 progress.detachTo(ComSafeArrayOutArg(aOperations)); 1061 976 ProgressMap pmap(m->mapProgressOperations); 977 aProgressOperations.resize(pmap.size()); 978 size_t i = 0; 979 for (ProgressMap::iterator it = pmap.begin(); it != pmap.end(); ++it, ++i) 980 it->second.queryInterfaceTo(aProgressOperations[i].asOutParam()); 1062 981 return S_OK; 1063 982 } 1064 983 1065 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes)(ComSafeArrayOut(IGuestOSType *, aGuestOSTypes)) 1066 { 1067 CheckComArgOutSafeArrayPointerValid(aGuestOSTypes); 1068 1069 AutoCaller autoCaller(this); 1070 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1071 984 HRESULT VirtualBox::getGuestOSTypes(std::vector<ComPtr<IGuestOSType> > &aGuestOSTypes) 985 { 1072 986 AutoReadLock al(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1073 SafeIfaceArray<IGuestOSType> ostypes(m->allGuestOSTypes.getList()); 1074 ostypes.detachTo(ComSafeArrayOutArg(aGuestOSTypes)); 1075 987 aGuestOSTypes.resize(m->allGuestOSTypes.size()); 988 size_t i = 0; 989 for (GuestOSTypesOList::const_iterator it = m->allGuestOSTypes.begin(); 990 it != m->allGuestOSTypes.end(); ++it, ++i) 991 (*it).queryInterfaceTo(aGuestOSTypes[i].asOutParam()); 1076 992 return S_OK; 1077 993 } 1078 994 1079 STDMETHODIMP VirtualBox::COMGETTER(SharedFolders)(ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 1080 { 1081 #ifndef RT_OS_WINDOWS 1082 NOREF(aSharedFoldersSize); 1083 #endif /* RT_OS_WINDOWS */ 1084 1085 CheckComArgOutSafeArrayPointerValid(aSharedFolders); 1086 1087 AutoCaller autoCaller(this); 1088 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 995 HRESULT VirtualBox::getSharedFolders(std::vector<ComPtr<ISharedFolder> > &aSharedFolders) 996 { 997 #ifndef RT_OS_WINDOWS 998 NOREF(aSharedFolders); 999 #endif /* RT_OS_WINDOWS */ 1000 NOREF(aSharedFolders); 1089 1001 1090 1002 return setError(E_NOTIMPL, "Not yet implemented"); 1091 1003 } 1092 1004 1093 STDMETHODIMP 1094 VirtualBox::COMGETTER(PerformanceCollector)(IPerformanceCollector **aPerformanceCollector) 1005 HRESULT VirtualBox::getPerformanceCollector(ComPtr<IPerformanceCollector> &aPerformanceCollector) 1095 1006 { 1096 1007 #ifdef VBOX_WITH_RESOURCE_USAGE_API 1097 CheckComArgOutPointerValid(aPerformanceCollector);1098 1099 AutoCaller autoCaller(this);1100 if (FAILED(autoCaller.rc())) return autoCaller.rc();1101 1102 1008 /* mPerformanceCollector is const, no need to lock */ 1103 m->pPerformanceCollector.queryInterfaceTo(aPerformanceCollector );1009 m->pPerformanceCollector.queryInterfaceTo(aPerformanceCollector.asOutParam()); 1104 1010 1105 1011 return S_OK; … … 1110 1016 } 1111 1017 1112 STDMETHODIMP 1113 VirtualBox::COMGETTER(DHCPServers)(ComSafeArrayOut(IDHCPServer *, aDHCPServers)) 1114 { 1115 CheckComArgOutSafeArrayPointerValid(aDHCPServers); 1116 1117 AutoCaller autoCaller(this); 1118 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1119 1018 HRESULT VirtualBox::getDHCPServers(std::vector<ComPtr<IDHCPServer> > &aDHCPServers) 1019 { 1120 1020 AutoReadLock al(m->allDHCPServers.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1121 SafeIfaceArray<IDHCPServer> svrs(m->allDHCPServers.getList()); 1122 svrs.detachTo(ComSafeArrayOutArg(aDHCPServers)); 1123 1021 aDHCPServers.resize(m->allDHCPServers.size()); 1022 size_t i = 0; 1023 for (DHCPServersOList::const_iterator it= m->allDHCPServers.begin(); 1024 it!= m->allDHCPServers.end(); ++it, ++i) 1025 (*it).queryInterfaceTo(aDHCPServers[i].asOutParam()); 1124 1026 return S_OK; 1125 1027 } 1126 1028 1127 1029 1128 STDMETHODIMP 1129 VirtualBox::COMGETTER(NATNetworks)(ComSafeArrayOut(INATNetwork *, aNATNetworks)) 1030 HRESULT VirtualBox::getNATNetworks(std::vector<ComPtr<INATNetwork> > &aNATNetworks) 1130 1031 { 1131 1032 #ifdef VBOX_WITH_NAT_SERVICE 1132 CheckComArgOutSafeArrayPointerValid(aNATNetworks);1133 1134 AutoCaller autoCaller(this);1135 if (FAILED(autoCaller.rc())) return autoCaller.rc();1136 1137 1033 AutoReadLock al(m->allNATNetworks.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1138 SafeIfaceArray<INATNetwork> nets(m->allNATNetworks.getList()); 1139 nets.detachTo(ComSafeArrayOutArg(aNATNetworks)); 1140 1034 aNATNetworks.resize(m->allNATNetworks.size()); 1035 size_t i = 0; 1036 for (NATNetworksOList::const_iterator it= m->allNATNetworks.begin(); 1037 it!= m->allNATNetworks.end(); ++it, ++i) 1038 (*it).queryInterfaceTo(aNATNetworks[i].asOutParam()); 1141 1039 return S_OK; 1142 1040 #else 1143 1041 NOREF(aNATNetworks); 1144 1042 # ifndef RT_OS_WINDOWS 1145 NOREF(aNATNetworks Size);1043 NOREF(aNATNetworks); 1146 1044 # endif 1045 NOREF(aNATNetworks); 1147 1046 return E_NOTIMPL; 1148 1047 #endif 1149 1048 } 1150 1049 1151 1152 STDMETHODIMP 1153 VirtualBox::COMGETTER(EventSource)(IEventSource ** aEventSource) 1154 { 1155 CheckComArgOutPointerValid(aEventSource); 1156 1157 AutoCaller autoCaller(this); 1158 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1159 1050 HRESULT VirtualBox::getEventSource(ComPtr<IEventSource> &aEventSource) 1051 { 1160 1052 /* event source is const, no need to lock */ 1161 m->pEventSource.queryInterfaceTo(aEventSource); 1162 1053 m->pEventSource.queryInterfaceTo(aEventSource.asOutParam()); 1163 1054 return S_OK; 1164 1055 } 1165 1056 1166 STDMETHODIMP 1167 VirtualBox::COMGETTER(ExtensionPackManager)(IExtPackManager **aExtPackManager) 1168 { 1169 CheckComArgOutPointerValid(aExtPackManager); 1170 1171 AutoCaller autoCaller(this); 1172 HRESULT hrc = autoCaller.rc(); 1173 if (SUCCEEDED(hrc)) 1174 { 1057 HRESULT VirtualBox::getExtensionPackManager(ComPtr<IExtPackManager> &aExtensionPackManager) 1058 { 1059 HRESULT hrc = S_OK; 1175 1060 #ifdef VBOX_WITH_EXTPACK 1176 1177 hrc = m->ptrExtPackManager.queryInterfaceTo(aExtPackManager);1061 /* The extension pack manager is const, no need to lock. */ 1062 hrc = m->ptrExtPackManager.queryInterfaceTo(aExtensionPackManager.asOutParam()); 1178 1063 #else 1179 hrc = E_NOTIMPL; 1064 hrc = E_NOTIMPL; 1065 NOREF(aExtensionPackManager); 1180 1066 #endif 1181 }1182 1183 1067 return hrc; 1184 1068 } 1185 1069 1186 STDMETHODIMP VirtualBox::COMGETTER(InternalNetworks)(ComSafeArrayOut(BSTR, aInternalNetworks)) 1187 { 1188 CheckComArgOutSafeArrayPointerValid(aInternalNetworks); 1189 1190 AutoCaller autoCaller(this); 1191 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1192 1193 std::list<Bstr> allInternalNetworks; 1070 HRESULT VirtualBox::getInternalNetworks(std::vector<com::Utf8Str> &aInternalNetworks) 1071 { 1072 std::list<com::Utf8Str> allInternalNetworks; 1194 1073 1195 1074 /* get copy of all machine references, to avoid holding the list lock */ … … 1200 1079 } 1201 1080 for (MachinesOList::MyList::const_iterator it = allMachines.begin(); 1202 it != allMachines.end(); 1203 ++it) 1081 it != allMachines.end(); ++it) 1204 1082 { 1205 1083 const ComObjPtr<Machine> &pMachine = *it; … … 1223 1101 continue; 1224 1102 1225 allInternalNetworks.push_back( strInternalNetwork);1103 allInternalNetworks.push_back(Utf8Str(strInternalNetwork)); 1226 1104 } 1227 1105 } … … 1231 1109 allInternalNetworks.sort(); 1232 1110 allInternalNetworks.unique(); 1233 com::SafeArray<BSTR> internalNetworks(allInternalNetworks.size());1234 1111 size_t i = 0; 1235 for (std::list<Bstr>::const_iterator it = allInternalNetworks.begin(); 1112 aInternalNetworks.resize(allInternalNetworks.size()); 1113 for (std::list<com::Utf8Str>::const_iterator it = allInternalNetworks.begin(); 1236 1114 it != allInternalNetworks.end(); 1237 ++it, i++) 1238 { 1239 const Bstr &tmp = *it; 1240 tmp.cloneTo(&internalNetworks[i]); 1241 } 1242 internalNetworks.detachTo(ComSafeArrayOutArg(aInternalNetworks)); 1243 1115 ++it, ++i) 1116 aInternalNetworks[i] = *it; 1244 1117 return S_OK; 1245 1118 } 1246 1119 1247 STDMETHODIMP VirtualBox::COMGETTER(GenericNetworkDrivers)(ComSafeArrayOut(BSTR, aGenericNetworkDrivers)) 1248 { 1249 CheckComArgOutSafeArrayPointerValid(aGenericNetworkDrivers); 1250 1251 AutoCaller autoCaller(this); 1252 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1253 1254 std::list<Bstr> allGenericNetworkDrivers; 1120 HRESULT VirtualBox::getGenericNetworkDrivers(std::vector<com::Utf8Str> &aGenericNetworkDrivers) 1121 { 1122 std::list<com::Utf8Str> allGenericNetworkDrivers; 1255 1123 1256 1124 /* get copy of all machine references, to avoid holding the list lock */ … … 1284 1152 continue; 1285 1153 1286 allGenericNetworkDrivers.push_back( strGenericNetworkDriver);1154 allGenericNetworkDrivers.push_back(Utf8Str(strGenericNetworkDriver).c_str()); 1287 1155 } 1288 1156 } … … 1292 1160 allGenericNetworkDrivers.sort(); 1293 1161 allGenericNetworkDrivers.unique(); 1294 com::SafeArray<BSTR> genericNetworks(allGenericNetworkDrivers.size());1162 aGenericNetworkDrivers.resize(allGenericNetworkDrivers.size()); 1295 1163 size_t i = 0; 1296 for (std::list<Bstr>::const_iterator it = allGenericNetworkDrivers.begin(); 1297 it != allGenericNetworkDrivers.end(); 1298 ++it, i++) 1299 { 1300 const Bstr &tmp = *it; 1301 tmp.cloneTo(&genericNetworks[i]); 1302 } 1303 genericNetworks.detachTo(ComSafeArrayOutArg(aGenericNetworkDrivers)); 1164 for (std::list<com::Utf8Str>::const_iterator it = allGenericNetworkDrivers.begin(); 1165 it != allGenericNetworkDrivers.end(); ++it, ++i) 1166 aGenericNetworkDrivers[i] = *it; 1304 1167 1305 1168 return S_OK; 1306 1169 } 1307 1170 1308 STDMETHODIMP 1309 VirtualBox::CheckFirmwarePresent(FirmwareType_T aFirmwareType, 1310 IN_BSTR aVersion, 1311 BSTR *aUrl, 1312 BSTR *aFile, 1313 BOOL *aResult) 1314 { 1315 CheckComArgNotNull(aResult); 1316 1317 AutoCaller autoCaller(this); 1318 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1319 1171 HRESULT VirtualBox::checkFirmwarePresent(FirmwareType_T aFirmwareType, 1172 const com::Utf8Str &aVersion, 1173 com::Utf8Str &aUrl, 1174 com::Utf8Str &aFile, 1175 BOOL *aResult) 1176 { 1320 1177 NOREF(aVersion); 1321 1178 … … 1360 1217 RTPATH_DELIMITER, 1361 1218 firmwareDesc[i].fileName); 1362 int rc = calculateFullPath(shortName, fullName);1219 int rc = i_calculateFullPath(shortName, fullName); 1363 1220 AssertRCReturn(rc, rc); 1364 1221 if (RTFileExists(fullName.c_str())) 1365 1222 { 1366 1223 *aResult = TRUE; 1367 if (aFile) 1368 Utf8Str(fullName).cloneTo(aFile); 1224 aFile = fullName; 1369 1225 break; 1370 1226 } … … 1380 1236 { 1381 1237 *aResult = TRUE; 1382 if (aFile) 1383 Utf8Str(fullName).cloneTo(aFile); 1238 aFile = fullName; 1384 1239 break; 1385 1240 } 1386 1241 1387 1242 /** @todo: account for version in the URL */ 1388 if (aUrl != NULL) 1389 { 1390 Utf8Str strUrl(firmwareDesc[i].url); 1391 strUrl.cloneTo(aUrl); 1392 } 1243 aUrl = firmwareDesc[i].url; 1393 1244 *aResult = FALSE; 1394 1245 … … 1399 1250 return S_OK; 1400 1251 } 1401 // IVirtualBox methods1252 // Wrapped IVirtualBox methods 1402 1253 ///////////////////////////////////////////////////////////////////////////// 1403 1254 … … 1405 1256 static void sanitiseMachineFilename(Utf8Str &aName); 1406 1257 1407 STDMETHODIMP VirtualBox:: ComposeMachineFilename(IN_BSTRaName,1408 IN_BSTRaGroup,1409 IN_BSTRaCreateFlags,1410 IN_BSTRaBaseFolder,1411 BSTR *aFilename)1258 STDMETHODIMP VirtualBox::composeMachineFilename(const com::Utf8Str &aName, 1259 const com::Utf8Str &aGroup, 1260 const com::Utf8Str &aCreateFlags, 1261 const com::Utf8Str &aBaseFolder, 1262 com::Utf8Str &aFile) 1412 1263 { 1413 1264 LogFlowThisFuncEnter(); 1414 LogFlowThisFunc(("aName=\"%ls\",aBaseFolder=\"%ls\"\n", aName, aBaseFolder)); 1415 1416 CheckComArgStrNotEmptyOrNull(aName); 1417 CheckComArgOutPointerValid(aFilename); 1418 1419 AutoCaller autoCaller(this); 1420 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1265 1266 Utf8Str strBase = aBaseFolder; 1267 Utf8Str strName = aName; 1268 1269 LogFlowThisFunc(("aName=\"%ls\",aBaseFolder=\"%ls\"\n", strName.c_str(), strBase.c_str())); 1421 1270 1422 1271 Utf8Str strCreateFlags(aCreateFlags); … … 1468 1317 if (strGroup.isEmpty()) 1469 1318 strGroup = "/"; 1470 HRESULT rc = validateMachineGroup(strGroup, true);1319 HRESULT rc = i_validateMachineGroup(strGroup, true); 1471 1320 if (FAILED(rc)) 1472 1321 return rc; … … 1481 1330 * using it. 1482 1331 */ 1483 Utf8Str strBase = aBaseFolder;1484 Utf8Str strName = aName;1485 1332 Utf8Str strDirName(strName); 1486 1333 if (fDirectoryIncludesUUID) … … 1491 1338 if (strBase.isEmpty()) 1492 1339 /* we use the non-full folder value below to keep the path relative */ 1493 getDefaultMachineFolder(strBase);1494 1495 calculateFullPath(strBase, strBase);1340 i_getDefaultMachineFolder(strBase); 1341 1342 i_calculateFullPath(strBase, strBase); 1496 1343 1497 1344 /* eliminate toplevel group to avoid // in the result */ 1498 1345 if (strGroup == "/") 1499 1346 strGroup.setNull(); 1500 Bstr bstrSettingsFile = BstrFmt("%s%s%c%s%c%s.vbox", 1501 strBase.c_str(), 1502 strGroup.c_str(), 1503 RTPATH_DELIMITER, 1504 strDirName.c_str(), 1505 RTPATH_DELIMITER, 1506 strName.c_str()); 1507 1508 bstrSettingsFile.detachTo(aFilename); 1509 1347 aFile = com::Utf8StrFmt("%s%s%c%s%c%s.vbox", 1348 strBase.c_str(), 1349 strGroup.c_str(), 1350 RTPATH_DELIMITER, 1351 strDirName.c_str(), 1352 RTPATH_DELIMITER, 1353 strName.c_str()); 1510 1354 return S_OK; 1511 1355 } … … 1598 1442 1599 1443 /** @note Locks mSystemProperties object for reading. */ 1600 STDMETHODIMP VirtualBox::CreateMachine(IN_BSTRaSettingsFile,1601 IN_BSTRaName,1602 ComSafeArrayIn(IN_BSTR, aGroups),1603 IN_BSTRaOsTypeId,1604 IN_BSTR aCreateFlags,1605 IMachine **aMachine)1444 HRESULT VirtualBox::createMachine(const com::Utf8Str &aSettingsFile, 1445 const com::Utf8Str &aName, 1446 const std::vector<com::Utf8Str> &aGroups, 1447 const com::Utf8Str &aOsTypeId, 1448 const com::Utf8Str &aFlags, 1449 ComPtr<IMachine> &aMachine) 1606 1450 { 1607 1451 LogFlowThisFuncEnter(); 1608 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\", aCreateFlags=\"%ls\"\n", aSettingsFile, aName, aOsTypeId, aCreateFlags)); 1609 1610 CheckComArgStrNotEmptyOrNull(aName); 1452 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\", aCreateFlags=\"%ls\"\n", Bstr(aSettingsFile).raw(), Bstr(aName).raw(), Bstr(aOsTypeId).raw(), Bstr(aFlags).raw())); 1611 1453 /** @todo tighten checks on aId? */ 1612 CheckComArgOutPointerValid(aMachine);1613 1614 AutoCaller autoCaller(this);1615 if (FAILED(autoCaller.rc())) return autoCaller.rc();1616 1454 1617 1455 StringsList llGroups; 1618 HRESULT rc = convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);1456 HRESULT rc = i_convertMachineGroups(aGroups, &llGroups); 1619 1457 if (FAILED(rc)) 1620 1458 return rc; 1621 1459 1622 Utf8Str strCreateFlags(a CreateFlags);1460 Utf8Str strCreateFlags(aFlags); 1623 1461 Guid id; 1624 1462 bool fForceOverwrite = false; … … 1676 1514 strNewCreateFlags += ",directoryIncludesUUID=1"; 1677 1515 1678 rc = ComposeMachineFilename(aName, 1679 Bstr(llGroups.front()).raw(), 1680 Bstr(strNewCreateFlags).raw(), 1681 NULL /* aBaseFolder */, 1682 bstrSettingsFile.asOutParam()); 1516 com::Utf8Str blstr = ""; 1517 com::Utf8Str sf = aSettingsFile; 1518 rc = composeMachineFilename(aName, 1519 llGroups.front(), 1520 strNewCreateFlags, 1521 blstr /* aBaseFolder */, 1522 sf); 1683 1523 if (FAILED(rc)) return rc; 1524 bstrSettingsFile = Bstr(sf).raw(); 1684 1525 } 1685 1526 … … 1690 1531 1691 1532 GuestOSType *osType = NULL; 1692 rc = findGuestOSType(Bstr(aOsTypeId), osType);1533 rc = i_findGuestOSType(Bstr(aOsTypeId), osType); 1693 1534 if (FAILED(rc)) return rc; 1694 1535 … … 1705 1546 { 1706 1547 /* set the return value */ 1707 rc = machine.queryInterfaceTo(aMachine);1548 machine.queryInterfaceTo(aMachine.asOutParam()); 1708 1549 AssertComRC(rc); 1709 1550 … … 1719 1560 } 1720 1561 1721 STDMETHODIMP VirtualBox::OpenMachine(IN_BSTR aSettingsFile, 1722 IMachine **aMachine) 1723 { 1724 CheckComArgStrNotEmptyOrNull(aSettingsFile); 1725 CheckComArgOutPointerValid(aMachine); 1726 1727 AutoCaller autoCaller(this); 1728 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1729 1562 HRESULT VirtualBox::openMachine(const com::Utf8Str &aSettingsFile, 1563 ComPtr<IMachine> &aMachine) 1564 { 1730 1565 HRESULT rc = E_FAIL; 1731 1566 … … 1742 1577 { 1743 1578 /* set the return value */ 1744 rc = machine.queryInterfaceTo(aMachine);1579 machine.queryInterfaceTo(aMachine.asOutParam()); 1745 1580 ComAssertComRC(rc); 1746 1581 } … … 1751 1586 1752 1587 /** @note Locks objects! */ 1753 STDMETHODIMP VirtualBox::RegisterMachine(IMachine *aMachine) 1754 { 1755 CheckComArgNotNull(aMachine); 1756 1757 AutoCaller autoCaller(this); 1758 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1759 1588 HRESULT VirtualBox::registerMachine(const ComPtr<IMachine> &aMachine) 1589 { 1760 1590 HRESULT rc; 1761 1591 … … 1766 1596 /* We can safely cast child to Machine * here because only Machine 1767 1597 * implementations of IMachine can be among our children. */ 1768 Machine *pMachine = static_cast<Machine*>(aMachine); 1598 IMachine *aM = aMachine; 1599 Machine *pMachine = static_cast<Machine*>(aM); 1769 1600 1770 1601 AutoCaller machCaller(pMachine); 1771 1602 ComAssertComRCRetRC(machCaller.rc()); 1772 1603 1773 rc = registerMachine(pMachine);1604 rc = i_registerMachine(pMachine); 1774 1605 /* fire an event */ 1775 1606 if (SUCCEEDED(rc)) 1776 onMachineRegistered(pMachine->getId(), TRUE);1607 i_onMachineRegistered(pMachine->getId(), TRUE); 1777 1608 1778 1609 return rc; … … 1780 1611 1781 1612 /** @note Locks this object for reading, then some machine objects for reading. */ 1782 STDMETHODIMP VirtualBox::FindMachine(IN_BSTR aNameOrId, IMachine **aMachine) 1613 HRESULT VirtualBox::findMachine(const com::Utf8Str &aSettingsFile, 1614 ComPtr<IMachine> &aMachine) 1783 1615 { 1784 1616 LogFlowThisFuncEnter(); 1785 LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aNameOrId, aMachine)); 1786 1787 CheckComArgStrNotEmptyOrNull(aNameOrId); 1788 CheckComArgOutPointerValid(aMachine); 1789 1790 AutoCaller autoCaller(this); 1791 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1617 LogFlowThisFunc(("aSettingsFile=\"%ls\", aMachine={%p}\n", Bstr(aSettingsFile).raw(), &aMachine)); 1792 1618 1793 1619 /* start with not found */ … … 1795 1621 ComObjPtr<Machine> pMachineFound; 1796 1622 1797 Guid id(aNameOrId); 1623 Guid id(Bstr(aSettingsFile).raw()); 1624 Utf8Str strFile(aSettingsFile); 1798 1625 if (id.isValid() && !id.isZero()) 1799 1626 1800 rc = findMachine(id,1801 true /* fPermitInaccessible */,1802 true /* setError */,1803 &pMachineFound);1804 1627 rc = i_findMachine(id, 1628 true /* fPermitInaccessible */, 1629 true /* setError */, 1630 &pMachineFound); 1631 // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error 1805 1632 else 1806 1633 { 1807 Utf8Str strName(aNameOrId); 1808 rc = findMachineByName(aNameOrId, 1809 true /* setError */, 1810 &pMachineFound); 1811 // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error 1634 rc = i_findMachineByName(strFile, 1635 true /* setError */, 1636 &pMachineFound); 1637 // returns VBOX_E_OBJECT_NOT_FOUND if not found and sets error 1812 1638 } 1813 1639 1814 1640 /* this will set (*machine) to NULL if machineObj is null */ 1815 pMachineFound.queryInterfaceTo(aMachine );1816 1817 LogFlowThisFunc(("aName=\"%ls\", aMachine=%p, rc=%08X\n", aNameOrId, *aMachine, rc));1641 pMachineFound.queryInterfaceTo(aMachine.asOutParam()); 1642 1643 LogFlowThisFunc(("aName=\"%ls\", aMachine=%p, rc=%08X\n", Bstr(aSettingsFile).raw(), &aMachine, rc)); 1818 1644 LogFlowThisFuncLeave(); 1819 1645 … … 1821 1647 } 1822 1648 1823 STDMETHODIMP VirtualBox::GetMachinesByGroups(ComSafeArrayIn(IN_BSTR, aGroups), ComSafeArrayOut(IMachine *, aMachines)) 1824 { 1825 CheckComArgSafeArrayNotNull(aGroups); 1826 CheckComArgOutSafeArrayPointerValid(aMachines); 1827 1828 AutoCaller autoCaller(this); 1829 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1830 1649 HRESULT VirtualBox::getMachinesByGroups(const std::vector<com::Utf8Str> &aGroups, 1650 std::vector<ComPtr<IMachine> > &aMachines) 1651 { 1831 1652 StringsList llGroups; 1832 HRESULT rc = convertMachineGroups(ComSafeArrayInArg(aGroups), &llGroups);1653 HRESULT rc = i_convertMachineGroups(aGroups, &llGroups); 1833 1654 if (FAILED(rc)) 1834 1655 return rc; 1656 1835 1657 /* we want to rely on sorted groups during compare, to save time */ 1836 1658 llGroups.sort(); … … 1838 1660 /* get copy of all machine references, to avoid holding the list lock */ 1839 1661 MachinesOList::MyList allMachines; 1840 { 1841 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1842 allMachines = m->allMachines.getList(); 1843 } 1844 1845 com::SafeIfaceArray<IMachine> saMachines; 1662 AutoReadLock al(m->allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1663 allMachines = m->allMachines.getList(); 1664 1665 std::vector<ComObjPtr<IMachine> > saMachines; 1666 saMachines.resize(0); 1846 1667 for (MachinesOList::MyList::const_iterator it = allMachines.begin(); 1847 1668 it != allMachines.end(); … … 1870 1691 if (order == 0) 1871 1692 { 1872 saMachines.push_back( pMachine);1693 saMachines.push_back(static_cast<IMachine *>(pMachine)); 1873 1694 fAppended = true; 1874 1695 break; … … 1885 1706 } 1886 1707 } 1887 1888 saMachines.detachTo(ComSafeArrayOutArg(aMachines)); 1708 aMachines.resize(saMachines.size()); 1709 size_t i = 0; 1710 for(i = 0; i < saMachines.size(); ++i) 1711 saMachines[i].queryInterfaceTo(aMachines[i].asOutParam()); 1889 1712 1890 1713 return S_OK; 1891 1714 } 1892 1715 1893 STDMETHODIMP VirtualBox::GetMachineStates(ComSafeArrayIn(IMachine *, aMachines), ComSafeArrayOut(MachineState_T, aStates)) 1894 { 1895 CheckComArgSafeArrayNotNull(aMachines); 1896 CheckComArgOutSafeArrayPointerValid(aStates); 1897 1898 com::SafeIfaceArray<IMachine> saMachines(ComSafeArrayInArg(aMachines)); 1899 com::SafeArray<MachineState_T> saStates(saMachines.size()); 1716 HRESULT VirtualBox::getMachineStates(const std::vector<ComPtr<IMachine> > &aMachines, 1717 std::vector<MachineState_T> &aStates) 1718 { 1719 com::SafeIfaceArray<IMachine> saMachines(aMachines); 1720 aStates.resize(aMachines.size()); 1900 1721 for (size_t i = 0; i < saMachines.size(); i++) 1901 1722 { … … 1909 1730 AssertComRC(rc); 1910 1731 } 1911 saStates[i] = state; 1912 } 1913 saStates.detachTo(ComSafeArrayOutArg(aStates)); 1914 1732 aStates[i] = state; 1733 } 1915 1734 return S_OK; 1916 1735 } 1917 1736 1918 STDMETHODIMP VirtualBox::CreateHardDisk(IN_BSTR aFormat, 1919 IN_BSTR aLocation, 1920 IMedium **aHardDisk) 1921 { 1922 CheckComArgOutPointerValid(aHardDisk); 1923 1924 AutoCaller autoCaller(this); 1925 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1926 1737 HRESULT VirtualBox::createHardDisk(const com::Utf8Str &aFormat, 1738 const com::Utf8Str &aLocation, 1739 ComPtr<IMedium> &aMedium) 1740 { 1927 1741 /* we don't access non-const data members so no need to lock */ 1928 1929 Utf8Str format(aFormat); 1742 com::Utf8Str format = aFormat; 1930 1743 if (format.isEmpty()) 1931 getDefaultHardDiskFormat(format);1744 i_getDefaultHardDiskFormat(format); 1932 1745 1933 1746 ComObjPtr<Medium> hardDisk; … … 1937 1750 aLocation, 1938 1751 Guid::Empty /* media registry: none yet */); 1939 1940 1752 if (SUCCEEDED(rc)) 1941 hardDisk.queryInterfaceTo(a HardDisk);1753 hardDisk.queryInterfaceTo(aMedium.asOutParam()); 1942 1754 1943 1755 return rc; 1944 1756 } 1945 1757 1946 STDMETHODIMP VirtualBox::OpenMedium(IN_BSTRaLocation,1947 DeviceType_T deviceType,1948 AccessMode_T accessMode,1949 BOOL fForceNewUuid,1950 IMedium **aMedium)1758 HRESULT VirtualBox::openMedium(const com::Utf8Str &aLocation, 1759 DeviceType_T aDeviceType, 1760 AccessMode_T aAccessMode, 1761 BOOL aForceNewUuid, 1762 ComPtr<IMedium> &aMedium) 1951 1763 { 1952 1764 HRESULT rc = S_OK; 1953 CheckComArgStrNotEmptyOrNull(aLocation);1954 CheckComArgOutPointerValid(aMedium);1955 1956 AutoCaller autoCaller(this);1957 if (FAILED(autoCaller.rc())) return autoCaller.rc();1958 1959 1765 Guid id(aLocation); 1766 const Guid cid = id; 1960 1767 ComObjPtr<Medium> pMedium; 1961 1768 … … 1963 1770 // in one critical section, otherwise there are races which can lead to 1964 1771 // multiple Medium objects with the same content 1965 AutoWriteLock treeLock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);1772 AutoWriteLock treeLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 1966 1773 1967 1774 // check if the device type is correct, and see if a medium for the 1968 1775 // given path has already initialized; if so, return that 1969 switch ( deviceType)1776 switch (aDeviceType) 1970 1777 { 1971 1778 case DeviceType_HardDisk: 1972 1779 if (id.isValid() && !id.isZero()) 1973 rc = findHardDiskById(id, false /* setError */, &pMedium);1780 rc = i_findHardDiskById(id, false /* setError */, &pMedium); 1974 1781 else 1975 rc = findHardDiskByLocation(aLocation,1976 false, /* aSetError */1977 &pMedium);1782 rc = i_findHardDiskByLocation(aLocation, 1783 false, /* aSetError */ 1784 &pMedium); 1978 1785 break; 1979 1786 … … 1981 1788 case DeviceType_DVD: 1982 1789 if (id.isValid() && !id.isZero()) 1983 rc = findDVDOrFloppyImage(deviceType, &id, Utf8Str::Empty,1790 rc = i_findDVDOrFloppyImage(aDeviceType, &id, Utf8Str::Empty, 1984 1791 false /* setError */, &pMedium); 1985 1792 else 1986 rc = findDVDOrFloppyImage(deviceType, NULL, aLocation,1793 rc = i_findDVDOrFloppyImage(aDeviceType, NULL, aLocation, 1987 1794 false /* setError */, &pMedium); 1988 1795 1989 1796 // enforce read-only for DVDs even if caller specified ReadWrite 1990 if ( deviceType == DeviceType_DVD)1991 a ccessMode = AccessMode_ReadOnly;1797 if (aDeviceType == DeviceType_DVD) 1798 aAccessMode = AccessMode_ReadOnly; 1992 1799 break; 1993 1800 1994 1801 default: 1995 return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", deviceType);1802 return setError(E_INVALIDARG, "Device type must be HardDisk, DVD or Floppy %d", aDeviceType); 1996 1803 } 1997 1804 … … 2002 1809 rc = pMedium->init(this, 2003 1810 aLocation, 2004 (a ccessMode == AccessMode_ReadWrite) ? Medium::OpenReadWrite : Medium::OpenReadOnly,2005 !! fForceNewUuid,2006 deviceType);1811 (aAccessMode == AccessMode_ReadWrite) ? Medium::OpenReadWrite : Medium::OpenReadOnly, 1812 !!aForceNewUuid, 1813 aDeviceType); 2007 1814 treeLock.acquire(); 2008 1815 2009 1816 if (SUCCEEDED(rc)) 2010 1817 { 2011 rc = registerMedium(pMedium, &pMedium, deviceType);1818 rc = i_registerMedium(pMedium, &pMedium, aDeviceType); 2012 1819 2013 1820 treeLock.release(); … … 2028 1835 2029 1836 if (SUCCEEDED(rc)) 2030 pMedium.queryInterfaceTo(aMedium );1837 pMedium.queryInterfaceTo(aMedium.asOutParam()); 2031 1838 2032 1839 return rc; … … 2035 1842 2036 1843 /** @note Locks this object for reading. */ 2037 STDMETHODIMP VirtualBox::GetGuestOSType(IN_BSTR aId, IGuestOSType **aType) 2038 { 2039 CheckComArgNotNull(aType); 2040 2041 AutoCaller autoCaller(this); 2042 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2043 2044 *aType = NULL; 2045 1844 HRESULT VirtualBox::getGuestOSType(const com::Guid &aId, 1845 ComPtr<IGuestOSType> &aType) 1846 { 1847 aType = NULL; 2046 1848 AutoReadLock alock(m->allGuestOSTypes.getLockHandle() COMMA_LOCKVAL_SRC_POS); 1849 IN_BSTR strId = Bstr(aId.toUtf16()).raw(); 1850 1851 HRESULT rc = S_OK; 2047 1852 for (GuestOSTypesOList::iterator it = m->allGuestOSTypes.begin(); 2048 1853 it != m->allGuestOSTypes.end(); … … 2051 1856 const Bstr &typeId = (*it)->i_id(); 2052 1857 AssertMsg(!typeId.isEmpty(), ("ID must not be NULL")); 2053 if ( typeId.compare(aId, Bstr::CaseInsensitive) == 0)2054 { 2055 (*it).queryInterfaceTo(aType );1858 if (com::Guid(typeId) == aId) 1859 { 1860 (*it).queryInterfaceTo(aType.asOutParam()); 2056 1861 break; 2057 1862 } 2058 1863 } 2059 2060 return (*aType) ? S_OK : 1864 return (aType) ? S_OK : 2061 1865 setError(E_INVALIDARG, 2062 1866 tr("'%ls' is not a valid Guest OS type"), 2063 aId); 2064 } 2065 2066 STDMETHODIMP VirtualBox::CreateSharedFolder(IN_BSTR aName, IN_BSTR aHostPath, 2067 BOOL /* aWritable */, BOOL /* aAutoMount */) 2068 { 2069 CheckComArgStrNotEmptyOrNull(aName); 2070 CheckComArgStrNotEmptyOrNull(aHostPath); 2071 2072 AutoCaller autoCaller(this); 2073 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1867 strId); 1868 return rc; 1869 } 1870 1871 HRESULT VirtualBox::createSharedFolder(const com::Utf8Str &aName, 1872 const com::Utf8Str &aHostPath, 1873 BOOL aWritable, 1874 BOOL aAutomount) 1875 { 1876 NOREF(aName); 1877 NOREF(aHostPath); 1878 NOREF(aWritable); 1879 NOREF(aAutomount); 2074 1880 2075 1881 return setError(E_NOTIMPL, "Not yet implemented"); 2076 1882 } 2077 1883 2078 STDMETHODIMP VirtualBox::RemoveSharedFolder(IN_BSTR aName) 2079 { 2080 CheckComArgStrNotEmptyOrNull(aName); 2081 2082 AutoCaller autoCaller(this); 2083 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2084 1884 HRESULT VirtualBox::removeSharedFolder(const com::Utf8Str &aName) 1885 { 1886 NOREF(aName); 2085 1887 return setError(E_NOTIMPL, "Not yet implemented"); 2086 1888 } … … 2089 1891 * @note Locks this object for reading. 2090 1892 */ 2091 STDMETHODIMP VirtualBox::GetExtraDataKeys(ComSafeArrayOut(BSTR, aKeys))1893 HRESULT VirtualBox::getExtraDataKeys(std::vector<com::Utf8Str> &aKeys) 2092 1894 { 2093 1895 using namespace settings; 2094 1896 2095 CheckComArgOutSafeArrayPointerValid(aKeys);2096 2097 AutoCaller autoCaller(this);2098 if (FAILED(autoCaller.rc())) return autoCaller.rc();2099 2100 1897 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2101 1898 2102 com::SafeArray<BSTR> saKeys(m->pMainConfigFile->mapExtraDataItems.size()); 2103 int i = 0; 2104 for (StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.begin(); 2105 it != m->pMainConfigFile->mapExtraDataItems.end(); 2106 ++it, ++i) 2107 { 2108 const Utf8Str &strName = it->first; // the key 2109 strName.cloneTo(&saKeys[i]); 2110 } 2111 saKeys.detachTo(ComSafeArrayOutArg(aKeys)); 1899 std::vector<com::Utf8Str> saKeys(m->pMainConfigFile->mapExtraDataItems.size()); 1900 aKeys.resize(saKeys.size()); 1901 for (size_t i = 0; i < saKeys.size(); i++) 1902 aKeys[i] = saKeys[i]; 2112 1903 2113 1904 return S_OK; … … 2117 1908 * @note Locks this object for reading. 2118 1909 */ 2119 STDMETHODIMP VirtualBox::GetExtraData(IN_BSTR aKey, 2120 BSTR *aValue) 2121 { 2122 CheckComArgStrNotEmptyOrNull(aKey); 2123 CheckComArgNotNull(aValue); 2124 2125 AutoCaller autoCaller(this); 2126 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2127 2128 /* start with nothing found */ 2129 Utf8Str strKey(aKey); 2130 Bstr bstrResult; 2131 2132 settings::StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(strKey); 1910 HRESULT VirtualBox::getExtraData(const com::Utf8Str &aKey, 1911 com::Utf8Str &aValue) 1912 { 1913 settings::StringsMap::const_iterator it = m->pMainConfigFile->mapExtraDataItems.find(aKey); 2133 1914 if (it != m->pMainConfigFile->mapExtraDataItems.end()) 2134 1915 // found: 2135 bstrResult= it->second; // source is a Utf8Str1916 aValue = it->second; // source is a Utf8Str 2136 1917 2137 1918 /* return the result to caller (may be empty) */ 2138 bstrResult.cloneTo(aValue);2139 1919 2140 1920 return S_OK; … … 2144 1924 * @note Locks this object for writing. 2145 1925 */ 2146 STDMETHODIMP VirtualBox::SetExtraData(IN_BSTR aKey, 2147 IN_BSTR aValue) 2148 { 2149 CheckComArgStrNotEmptyOrNull(aKey); 2150 2151 AutoCaller autoCaller(this); 2152 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1926 HRESULT VirtualBox::setExtraData(const com::Utf8Str &aKey, 1927 const com::Utf8Str &aValue) 1928 { 2153 1929 2154 1930 Utf8Str strKey(aKey); 2155 1931 Utf8Str strValue(aValue); 2156 1932 Utf8Str strOldValue; // empty 1933 HRESULT rc = S_OK; 2157 1934 2158 1935 // locking note: we only hold the read lock briefly to look up the old value, … … 2178 1955 // lock to copy the list of callbacks to invoke 2179 1956 Bstr error; 2180 Bstr bstrValue(aValue); 2181 2182 if (!onExtraDataCanChange(Guid::Empty, aKey, bstrValue.raw(), error)) 1957 1958 if (!i_onExtraDataCanChange(Guid::Empty, Bstr(aKey).raw(), Bstr(aValue).raw(), error)) 2183 1959 { 2184 1960 const char *sep = error.isEmpty() ? "" : ": "; … … 2188 1964 return setError(E_ACCESSDENIED, 2189 1965 tr("Could not set extra data because someone refused the requested change of '%ls' to '%ls'%s%ls"), 2190 aKey,2191 bstrValue.raw(),1966 Bstr(strKey).raw(), 1967 Bstr(strValue).raw(), 2192 1968 sep, 2193 1969 err); … … 2205 1981 2206 1982 /* save settings on success */ 2207 HRESULT rc =saveSettings();1983 rc = i_saveSettings(); 2208 1984 if (FAILED(rc)) return rc; 2209 1985 } … … 2211 1987 // fire notification outside the lock 2212 1988 if (fChanged) 2213 onExtraDataChange(Guid::Empty, aKey, aValue); 2214 1989 i_onExtraDataChange(Guid::Empty, Bstr(aKey).raw(), Bstr(aValue).raw()); 1990 1991 return rc; 1992 } 1993 1994 /** 1995 * 1996 */ 1997 HRESULT VirtualBox::setSettingsSecret(const com::Utf8Str &aPassword) 1998 { 1999 i_storeSettingsKey(aPassword); 2000 i_decryptSettings(); 2215 2001 return S_OK; 2216 2002 } 2217 2003 2218 /** 2219 * 2220 */ 2221 STDMETHODIMP VirtualBox::SetSettingsSecret(IN_BSTR aValue) 2222 { 2223 storeSettingsKey(aValue); 2224 decryptSettings(); 2225 return S_OK; 2226 } 2227 2228 int VirtualBox::decryptMediumSettings(Medium *pMedium) 2004 int VirtualBox::i_decryptMediumSettings(Medium *pMedium) 2229 2005 { 2230 2006 Bstr bstrCipher; … … 2234 2010 { 2235 2011 Utf8Str strPlaintext; 2236 int rc = decryptSetting(&strPlaintext, bstrCipher);2012 int rc = i_decryptSetting(&strPlaintext, bstrCipher); 2237 2013 if (RT_SUCCESS(rc)) 2238 2014 pMedium->i_setPropertyDirect("InitiatorSecret", strPlaintext); … … 2251 2027 * properties need to be null-terminated strings. 2252 2028 */ 2253 int VirtualBox:: decryptSettings()2029 int VirtualBox::i_decryptSettings() 2254 2030 { 2255 2031 bool fFailure = false; … … 2264 2040 continue; 2265 2041 AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS); 2266 int vrc = decryptMediumSettings(pMedium);2042 int vrc = i_decryptMediumSettings(pMedium); 2267 2043 if (RT_FAILURE(vrc)) 2268 2044 fFailure = true; … … 2277 2053 * @param aCiphertext resulting ciphertext (base64-encoded) 2278 2054 */ 2279 int VirtualBox:: encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext)2055 int VirtualBox::i_encryptSetting(const Utf8Str &aPlaintext, Utf8Str *aCiphertext) 2280 2056 { 2281 2057 uint8_t abCiphertext[32]; 2282 2058 char szCipherBase64[128]; 2283 2059 size_t cchCipherBase64; 2284 int rc = encryptSettingBytes((uint8_t*)aPlaintext.c_str(), abCiphertext,2060 int rc = i_encryptSettingBytes((uint8_t*)aPlaintext.c_str(), abCiphertext, 2285 2061 aPlaintext.length()+1, sizeof(abCiphertext)); 2286 2062 if (RT_SUCCESS(rc)) … … 2301 2077 * @param aCiphertext ciphertext (base64-encoded) to decrypt 2302 2078 */ 2303 int VirtualBox:: decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext)2079 int VirtualBox::i_decryptSetting(Utf8Str *aPlaintext, const Utf8Str &aCiphertext) 2304 2080 { 2305 2081 uint8_t abPlaintext[64]; … … 2311 2087 if (RT_SUCCESS(rc)) 2312 2088 { 2313 rc = decryptSettingBytes(abPlaintext, abCiphertext, cbCiphertext);2089 rc = i_decryptSettingBytes(abPlaintext, abCiphertext, cbCiphertext); 2314 2090 if (RT_SUCCESS(rc)) 2315 2091 { … … 2341 2117 * @param aCiphertextSize size of the ciphertext 2342 2118 */ 2343 int VirtualBox:: encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphertext,2119 int VirtualBox::i_encryptSettingBytes(const uint8_t *aPlaintext, uint8_t *aCiphertext, 2344 2120 size_t aPlaintextSize, size_t aCiphertextSize) const 2345 2121 { … … 2391 2167 * @param aCiphertextSize size of the ciphertext == size of the plaintext 2392 2168 */ 2393 int VirtualBox:: decryptSettingBytes(uint8_t *aPlaintext,2394 const uint8_t *aCiphertext, size_t aCiphertextSize) const2169 int VirtualBox::i_decryptSettingBytes(uint8_t *aPlaintext, 2170 const uint8_t *aCiphertext, size_t aCiphertextSize) const 2395 2171 { 2396 2172 unsigned i, j; … … 2424 2200 * @param aKey the key to store 2425 2201 */ 2426 void VirtualBox:: storeSettingsKey(const Utf8Str &aKey)2202 void VirtualBox::i_storeSettingsKey(const Utf8Str &aKey) 2427 2203 { 2428 2204 RTSha512(aKey.c_str(), aKey.length(), m->SettingsCipherKey); … … 2434 2210 2435 2211 #ifdef DEBUG 2436 void VirtualBox:: dumpAllBackRefs()2212 void VirtualBox::i_dumpAllBackRefs() 2437 2213 { 2438 2214 { … … 2473 2249 * @note Doesn't lock any object. 2474 2250 */ 2475 HRESULT VirtualBox:: postEvent(Event *event)2251 HRESULT VirtualBox::i_postEvent(Event *event) 2476 2252 { 2477 2253 AssertReturn(event, E_FAIL); … … 2507 2283 * @note Doesn't lock objects. 2508 2284 */ 2509 HRESULT VirtualBox:: addProgress(IProgress *aProgress)2285 HRESULT VirtualBox::i_addProgress(IProgress *aProgress) 2510 2286 { 2511 2287 CheckComArgNotNull(aProgress); … … 2533 2309 * @note Doesn't lock objects. 2534 2310 */ 2535 HRESULT VirtualBox:: removeProgress(IN_GUID aId)2311 HRESULT VirtualBox::i_removeProgress(IN_GUID aId) 2536 2312 { 2537 2313 AutoCaller autoCaller(this); … … 2609 2385 * @note Doesn't lock anything. 2610 2386 */ 2611 HRESULT VirtualBox:: startSVCHelperClient(bool aPrivileged,2612 SVCHelperClientFunc aFunc,2613 void *aUser, Progress *aProgress)2387 HRESULT VirtualBox::i_startSVCHelperClient(bool aPrivileged, 2388 SVCHelperClientFunc aFunc, 2389 void *aUser, Progress *aProgress) 2614 2390 { 2615 2391 AssertReturn(aFunc, E_POINTER); … … 2795 2571 * @note Doesn't lock anything. 2796 2572 */ 2797 void VirtualBox:: updateClientWatcher()2573 void VirtualBox::i_updateClientWatcher() 2798 2574 { 2799 2575 AutoCaller autoCaller(this); … … 2810 2586 * @note Doesn't lock anything. 2811 2587 */ 2812 void VirtualBox:: addProcessToReap(RTPROCESS pid)2588 void VirtualBox::i_addProcessToReap(RTPROCESS pid) 2813 2589 { 2814 2590 AutoCaller autoCaller(this); … … 2862 2638 * @note Doesn't lock any object. 2863 2639 */ 2864 void VirtualBox:: onMachineStateChange(const Guid &aId, MachineState_T aState)2865 { 2866 postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState));2640 void VirtualBox::i_onMachineStateChange(const Guid &aId, MachineState_T aState) 2641 { 2642 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineStateChanged, aId, aState)); 2867 2643 } 2868 2644 … … 2870 2646 * @note Doesn't lock any object. 2871 2647 */ 2872 void VirtualBox:: onMachineDataChange(const Guid &aId, BOOL aTemporary)2873 { 2874 postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary));2648 void VirtualBox::i_onMachineDataChange(const Guid &aId, BOOL aTemporary) 2649 { 2650 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineDataChanged, aId, aTemporary)); 2875 2651 } 2876 2652 … … 2878 2654 * @note Locks this object for reading. 2879 2655 */ 2880 BOOL VirtualBox:: onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue,2881 Bstr &aError)2656 BOOL VirtualBox::i_onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue, 2657 Bstr &aError) 2882 2658 { 2883 2659 LogFlowThisFunc(("machine={%s} aKey={%ls} aValue={%ls}\n", … … 2939 2715 * @note Doesn't lock any object. 2940 2716 */ 2941 void VirtualBox:: onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue)2942 { 2943 postEvent(new ExtraDataEvent(this, aId, aKey, aValue));2717 void VirtualBox::i_onExtraDataChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue) 2718 { 2719 i_postEvent(new ExtraDataEvent(this, aId, aKey, aValue)); 2944 2720 } 2945 2721 … … 2947 2723 * @note Doesn't lock any object. 2948 2724 */ 2949 void VirtualBox:: onMachineRegistered(const Guid &aId, BOOL aRegistered)2950 { 2951 postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered));2725 void VirtualBox::i_onMachineRegistered(const Guid &aId, BOOL aRegistered) 2726 { 2727 i_postEvent(new MachineEvent(this, VBoxEventType_OnMachineRegistered, aId, aRegistered)); 2952 2728 } 2953 2729 … … 2971 2747 * @note Doesn't lock any object. 2972 2748 */ 2973 void VirtualBox:: onSessionStateChange(const Guid &aId, SessionState_T aState)2974 { 2975 postEvent(new SessionEvent(this, aId, aState));2749 void VirtualBox::i_onSessionStateChange(const Guid &aId, SessionState_T aState) 2750 { 2751 i_postEvent(new SessionEvent(this, aId, aState)); 2976 2752 } 2977 2753 … … 2998 2774 * @note Doesn't lock any object. 2999 2775 */ 3000 void VirtualBox:: onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId)3001 { 3002 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,2776 void VirtualBox::i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId) 2777 { 2778 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3003 2779 VBoxEventType_OnSnapshotTaken)); 3004 2780 } … … 3007 2783 * @note Doesn't lock any object. 3008 2784 */ 3009 void VirtualBox:: onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId)3010 { 3011 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,2785 void VirtualBox::i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId) 2786 { 2787 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3012 2788 VBoxEventType_OnSnapshotDeleted)); 3013 2789 } … … 3016 2792 * @note Doesn't lock any object. 3017 2793 */ 3018 void VirtualBox:: onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId)3019 { 3020 postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,2794 void VirtualBox::i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId) 2795 { 2796 i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId, 3021 2797 VBoxEventType_OnSnapshotChanged)); 3022 2798 } … … 3047 2823 * @note Doesn't lock any object. 3048 2824 */ 3049 void VirtualBox:: onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName,3050 IN_BSTR aValue, IN_BSTR aFlags)3051 { 3052 postEvent(new GuestPropertyEvent(this, aMachineId, aName, aValue, aFlags));2825 void VirtualBox::i_onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, 2826 IN_BSTR aValue, IN_BSTR aFlags) 2827 { 2828 i_postEvent(new GuestPropertyEvent(this, aMachineId, aName, aValue, aFlags)); 3053 2829 } 3054 2830 … … 3056 2832 * @note Doesn't lock any object. 3057 2833 */ 3058 void VirtualBox:: onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName,3059 NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort,3060 IN_BSTR aGuestIp, uint16_t aGuestPort)2834 void VirtualBox::i_onNatRedirectChange(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName, 2835 NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort, 2836 IN_BSTR aGuestIp, uint16_t aGuestPort) 3061 2837 { 3062 2838 fireNATRedirectEvent(m->pEventSource, aMachineId.toUtf16().raw(), ulSlot, fRemove, aName, aProto, aHostIp, … … 3064 2840 } 3065 2841 3066 void VirtualBox:: onNATNetworkChange(IN_BSTR aName)2842 void VirtualBox::i_onNATNetworkChange(IN_BSTR aName) 3067 2843 { 3068 2844 fireNATNetworkChangedEvent(m->pEventSource, aName); 3069 2845 } 3070 2846 3071 void VirtualBox:: onNATNetworkStartStop(IN_BSTR aName, BOOL fStart)2847 void VirtualBox::i_onNATNetworkStartStop(IN_BSTR aName, BOOL fStart) 3072 2848 { 3073 2849 fireNATNetworkStartStopEvent(m->pEventSource, aName, fStart); 3074 2850 } 3075 void VirtualBox::onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled, 3076 IN_BSTR aNetwork, IN_BSTR aGateway, 3077 BOOL aAdvertiseDefaultIpv6RouteEnabled, 3078 BOOL fNeedDhcpServer) 2851 2852 void VirtualBox::i_onNATNetworkSetting(IN_BSTR aNetworkName, BOOL aEnabled, 2853 IN_BSTR aNetwork, IN_BSTR aGateway, 2854 BOOL aAdvertiseDefaultIpv6RouteEnabled, 2855 BOOL fNeedDhcpServer) 3079 2856 { 3080 2857 fireNATNetworkSettingEvent(m->pEventSource, aNetworkName, aEnabled, … … 3083 2860 } 3084 2861 3085 void VirtualBox:: onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6,3086 IN_BSTR aRuleName, NATProtocol_T proto,3087 IN_BSTR aHostIp, LONG aHostPort,3088 IN_BSTR aGuestIp, LONG aGuestPort)2862 void VirtualBox::i_onNATNetworkPortForward(IN_BSTR aNetworkName, BOOL create, BOOL fIpv6, 2863 IN_BSTR aRuleName, NATProtocol_T proto, 2864 IN_BSTR aHostIp, LONG aHostPort, 2865 IN_BSTR aGuestIp, LONG aGuestPort) 3089 2866 { 3090 2867 fireNATNetworkPortForwardEvent(m->pEventSource, aNetworkName, create, … … 3095 2872 3096 2873 3097 void VirtualBox:: onHostNameResolutionConfigurationChange()2874 void VirtualBox::i_onHostNameResolutionConfigurationChange() 3098 2875 { 3099 2876 if (m->pEventSource) … … 3102 2879 3103 2880 3104 int VirtualBox:: natNetworkRefInc(IN_BSTR aNetworkName)2881 int VirtualBox::i_natNetworkRefInc(IN_BSTR aNetworkName) 3105 2882 { 3106 2883 AutoWriteLock safeLock(*spMtxNatNetworkNameToRefCountLock COMMA_LOCKVAL_SRC_POS); … … 3127 2904 3128 2905 3129 int VirtualBox:: natNetworkRefDec(IN_BSTR aNetworkName)2906 int VirtualBox::i_natNetworkRefDec(IN_BSTR aNetworkName) 3130 2907 { 3131 2908 AutoWriteLock safeLock(*spMtxNatNetworkNameToRefCountLock COMMA_LOCKVAL_SRC_POS); … … 3158 2935 * @note Locks this object for reading. 3159 2936 */ 3160 ComObjPtr<GuestOSType> VirtualBox:: getUnknownOSType()2937 ComObjPtr<GuestOSType> VirtualBox::i_getUnknownOSType() 3161 2938 { 3162 2939 ComObjPtr<GuestOSType> type; … … 3186 2963 * @note Locks objects for reading. 3187 2964 */ 3188 void VirtualBox:: getOpenedMachines(SessionMachinesList &aMachines,3189 InternalControlList *aControls /*= NULL*/)2965 void VirtualBox::i_getOpenedMachines(SessionMachinesList &aMachines, 2966 InternalControlList *aControls /*= NULL*/) 3190 2967 { 3191 2968 AutoCaller autoCaller(this); … … 3221 2998 * @note Caller must hold the VirtualBox object lock at least for reading. 3222 2999 */ 3223 VirtualBox::MachinesOList &VirtualBox:: getMachinesList(void)3000 VirtualBox::MachinesOList &VirtualBox::i_getMachinesList(void) 3224 3001 { 3225 3002 return m->allMachines; … … 3237 3014 * @return 3238 3015 */ 3239 HRESULT VirtualBox:: findMachine(const Guid &aId,3240 bool fPermitInaccessible,3241 bool aSetError,3242 ComObjPtr<Machine> *aMachine /* = NULL */)3016 HRESULT VirtualBox::i_findMachine(const Guid &aId, 3017 bool fPermitInaccessible, 3018 bool aSetError, 3019 ComObjPtr<Machine> *aMachine /* = NULL */) 3243 3020 { 3244 3021 HRESULT rc = VBOX_E_OBJECT_NOT_FOUND; … … 3291 3068 * @return 3292 3069 */ 3293 HRESULT VirtualBox::findMachineByName(const Utf8Str &aName, bool aSetError, 3294 ComObjPtr<Machine> *aMachine /* = NULL */) 3070 HRESULT VirtualBox::i_findMachineByName(const Utf8Str &aName, 3071 bool aSetError, 3072 ComObjPtr<Machine> *aMachine /* = NULL */) 3295 3073 { 3296 3074 HRESULT rc = VBOX_E_OBJECT_NOT_FOUND; … … 3330 3108 } 3331 3109 3332 static HRESULT validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary, VirtualBox *pVirtualBox)3110 static HRESULT i_validateMachineGroupHelper(const Utf8Str &aGroup, bool fPrimary, VirtualBox *pVirtualBox) 3333 3111 { 3334 3112 /* empty strings are invalid */ … … 3366 3144 if (fPrimary) 3367 3145 { 3368 HRESULT rc = pVirtualBox-> findMachineByName(tmp,3369 false /* aSetError */);3146 HRESULT rc = pVirtualBox->i_findMachineByName(tmp, 3147 false /* aSetError */); 3370 3148 if (SUCCEEDED(rc)) 3371 3149 return VBOX_E_VM_ERROR; … … 3396 3174 * @return S_OK or E_INVALIDARG 3397 3175 */ 3398 HRESULT VirtualBox:: validateMachineGroup(const Utf8Str &aGroup, bool fPrimary)3399 { 3400 HRESULT rc = validateMachineGroupHelper(aGroup, fPrimary, this);3176 HRESULT VirtualBox::i_validateMachineGroup(const Utf8Str &aGroup, bool fPrimary) 3177 { 3178 HRESULT rc = i_validateMachineGroupHelper(aGroup, fPrimary, this); 3401 3179 if (FAILED(rc)) 3402 3180 { … … 3421 3199 * @return S_OK or E_INVALIDARG 3422 3200 */ 3423 HRESULT VirtualBox:: convertMachineGroups(ComSafeArrayIn(IN_BSTR, aMachineGroups), StringsList *pllMachineGroups)3201 HRESULT VirtualBox::i_convertMachineGroups(const std::vector<com::Utf8Str> aMachineGroups, StringsList *pllMachineGroups) 3424 3202 { 3425 3203 pllMachineGroups->clear(); 3426 if (aMachineGroups) 3427 { 3428 com::SafeArray<IN_BSTR> machineGroups(ComSafeArrayInArg(aMachineGroups)); 3429 for (size_t i = 0; i < machineGroups.size(); i++) 3430 { 3431 Utf8Str group(machineGroups[i]); 3204 if (aMachineGroups.size()) 3205 { 3206 for (size_t i = 0; i < aMachineGroups.size(); i++) 3207 { 3208 Utf8Str group(aMachineGroups[i]); 3432 3209 if (group.length() == 0) 3433 3210 group = "/"; 3434 3211 3435 HRESULT rc = validateMachineGroup(group, i == 0);3212 HRESULT rc = i_validateMachineGroup(group, i == 0); 3436 3213 if (FAILED(rc)) 3437 3214 return rc; … … 3464 3241 * @note Locks the media tree for reading. 3465 3242 */ 3466 HRESULT VirtualBox:: findHardDiskById(const Guid &id,3467 bool aSetError,3468 ComObjPtr<Medium> *aHardDisk /*= NULL*/)3243 HRESULT VirtualBox::i_findHardDiskById(const Guid &id, 3244 bool aSetError, 3245 ComObjPtr<Medium> *aHardDisk /*= NULL*/) 3469 3246 { 3470 3247 AssertReturn(!id.isZero(), E_INVALIDARG); … … 3504 3281 * @note Locks the media tree for reading. 3505 3282 */ 3506 HRESULT VirtualBox:: findHardDiskByLocation(const Utf8Str &strLocation,3507 bool aSetError,3508 ComObjPtr<Medium> *aHardDisk /*= NULL*/)3283 HRESULT VirtualBox::i_findHardDiskByLocation(const Utf8Str &strLocation, 3284 bool aSetError, 3285 ComObjPtr<Medium> *aHardDisk /*= NULL*/) 3509 3286 { 3510 3287 AssertReturn(!strLocation.isEmpty(), E_INVALIDARG); … … 3559 3336 * @note Locks the media tree for reading. 3560 3337 */ 3561 HRESULT VirtualBox:: findDVDOrFloppyImage(DeviceType_T mediumType,3562 const Guid *aId,3563 const Utf8Str &aLocation,3564 bool aSetError,3565 ComObjPtr<Medium> *aImage /* = NULL */)3338 HRESULT VirtualBox::i_findDVDOrFloppyImage(DeviceType_T mediumType, 3339 const Guid *aId, 3340 const Utf8Str &aLocation, 3341 bool aSetError, 3342 ComObjPtr<Medium> *aImage /* = NULL */) 3566 3343 { 3567 3344 AssertReturn(aId || !aLocation.isEmpty(), E_INVALIDARG); … … 3570 3347 if (!aLocation.isEmpty()) 3571 3348 { 3572 int vrc = calculateFullPath(aLocation, location);3349 int vrc = i_calculateFullPath(aLocation, location); 3573 3350 if (RT_FAILURE(vrc)) 3574 3351 return setError(VBOX_E_FILE_ERROR, … … 3669 3446 * @return 3670 3447 */ 3671 HRESULT VirtualBox:: findRemoveableMedium(DeviceType_T mediumType,3672 const Guid &uuid,3673 bool fRefresh,3674 bool aSetError,3675 ComObjPtr<Medium> &pMedium)3448 HRESULT VirtualBox::i_findRemoveableMedium(DeviceType_T mediumType, 3449 const Guid &uuid, 3450 bool fRefresh, 3451 bool aSetError, 3452 ComObjPtr<Medium> &pMedium) 3676 3453 { 3677 3454 if (uuid.isZero()) … … 3696 3473 if (rc == VBOX_E_OBJECT_NOT_FOUND) 3697 3474 // then search for an image with that UUID 3698 rc = findDVDOrFloppyImage(mediumType, &uuid, Utf8Str::Empty, aSetError, &pMedium);3475 rc = i_findDVDOrFloppyImage(mediumType, &uuid, Utf8Str::Empty, aSetError, &pMedium); 3699 3476 3700 3477 return rc; 3701 3478 } 3702 3479 3703 HRESULT VirtualBox:: findGuestOSType(const Bstr &bstrOSType,3704 GuestOSType*& pGuestOSType)3480 HRESULT VirtualBox::i_findGuestOSType(const Bstr &bstrOSType, 3481 GuestOSType*& pGuestOSType) 3705 3482 { 3706 3483 /* Look for a GuestOSType object */ … … 3744 3521 * @return 3745 3522 */ 3746 const Guid& VirtualBox:: getGlobalRegistryId() const3523 const Guid& VirtualBox::i_getGlobalRegistryId() const 3747 3524 { 3748 3525 return m->uuidMediaRegistry; 3749 3526 } 3750 3527 3751 const ComObjPtr<Host>& VirtualBox:: host() const3528 const ComObjPtr<Host>& VirtualBox::i_host() const 3752 3529 { 3753 3530 return m->pHost; 3754 3531 } 3755 3532 3756 SystemProperties* VirtualBox:: getSystemProperties() const3533 SystemProperties* VirtualBox::i_getSystemProperties() const 3757 3534 { 3758 3535 return m->pSystemProperties; … … 3764 3541 * pack manager. 3765 3542 */ 3766 ExtPackManager* VirtualBox:: getExtPackManager() const3543 ExtPackManager* VirtualBox::i_getExtPackManager() const 3767 3544 { 3768 3545 return m->ptrExtPackManager; … … 3773 3550 * Getter that machines can talk to the autostart database. 3774 3551 */ 3775 AutostartDb* VirtualBox:: getAutostartDb() const3552 AutostartDb* VirtualBox::i_getAutostartDb() const 3776 3553 { 3777 3554 return m->pAutostartDb; … … 3779 3556 3780 3557 #ifdef VBOX_WITH_RESOURCE_USAGE_API 3781 const ComObjPtr<PerformanceCollector>& VirtualBox:: performanceCollector() const3558 const ComObjPtr<PerformanceCollector>& VirtualBox::i_performanceCollector() const 3782 3559 { 3783 3560 return m->pPerformanceCollector; … … 3790 3567 * @return 3791 3568 */ 3792 void VirtualBox:: getDefaultMachineFolder(Utf8Str &str) const3569 void VirtualBox::i_getDefaultMachineFolder(Utf8Str &str) const 3793 3570 { 3794 3571 AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS); … … 3801 3578 * @return 3802 3579 */ 3803 void VirtualBox:: getDefaultHardDiskFormat(Utf8Str &str) const3580 void VirtualBox::i_getDefaultHardDiskFormat(Utf8Str &str) const 3804 3581 { 3805 3582 AutoReadLock propsLock(m->pSystemProperties COMMA_LOCKVAL_SRC_POS); … … 3807 3584 } 3808 3585 3809 const Utf8Str& VirtualBox:: homeDir() const3586 const Utf8Str& VirtualBox::i_homeDir() const 3810 3587 { 3811 3588 return m->strHomeDir; … … 3823 3600 * @note Doesn't lock any object. 3824 3601 */ 3825 int VirtualBox:: calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult)3602 int VirtualBox::i_calculateFullPath(const Utf8Str &strPath, Utf8Str &aResult) 3826 3603 { 3827 3604 AutoCaller autoCaller(this); … … 3848 3625 * @param strTarget Buffer to receive target path. 3849 3626 */ 3850 void VirtualBox:: copyPathRelativeToConfig(const Utf8Str &strSource,3851 Utf8Str &strTarget)3627 void VirtualBox::i_copyPathRelativeToConfig(const Utf8Str &strSource, 3628 Utf8Str &strTarget) 3852 3629 { 3853 3630 AutoCaller autoCaller(this); … … 3884 3661 * @note Locks the media tree and media objects for reading. 3885 3662 */ 3886 HRESULT VirtualBox:: checkMediaForConflicts(const Guid &aId,3887 const Utf8Str &aLocation,3888 Utf8Str &aConflict,3889 ComObjPtr<Medium> *ppMedium)3663 HRESULT VirtualBox::i_checkMediaForConflicts(const Guid &aId, 3664 const Utf8Str &aLocation, 3665 Utf8Str &aConflict, 3666 ComObjPtr<Medium> *ppMedium) 3890 3667 { 3891 3668 AssertReturn(!aId.isZero() && !aLocation.isEmpty(), E_FAIL); … … 3895 3672 ppMedium->setNull(); 3896 3673 3897 AutoReadLock alock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3674 AutoReadLock alock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3898 3675 3899 3676 HRESULT rc = S_OK; … … 3903 3680 3904 3681 if (aId.isValid() && !aId.isZero()) 3905 rc = findHardDiskById(aId, false /* aSetError */, &pMediumFound);3682 rc = i_findHardDiskById(aId, false /* aSetError */, &pMediumFound); 3906 3683 if (FAILED(rc) && !aLocation.isEmpty()) 3907 rc = findHardDiskByLocation(aLocation, false /* aSetError */, &pMediumFound);3684 rc = i_findHardDiskByLocation(aLocation, false /* aSetError */, &pMediumFound); 3908 3685 if (SUCCEEDED(rc)) 3909 3686 pcszType = tr("hard disk"); … … 3911 3688 if (!pcszType) 3912 3689 { 3913 rc = findDVDOrFloppyImage(DeviceType_DVD, &aId, aLocation, false /* aSetError */, &pMediumFound);3690 rc = i_findDVDOrFloppyImage(DeviceType_DVD, &aId, aLocation, false /* aSetError */, &pMediumFound); 3914 3691 if (SUCCEEDED(rc)) 3915 3692 pcszType = tr("CD/DVD image"); … … 3918 3695 if (!pcszType) 3919 3696 { 3920 rc = findDVDOrFloppyImage(DeviceType_Floppy, &aId, aLocation, false /* aSetError */, &pMediumFound);3697 rc = i_findDVDOrFloppyImage(DeviceType_Floppy, &aId, aLocation, false /* aSetError */, &pMediumFound); 3921 3698 if (SUCCEEDED(rc)) 3922 3699 pcszType = tr("floppy image"); … … 3955 3732 * conflicts. 3956 3733 */ 3957 bool VirtualBox::i sMediaUuidInUse(const Guid &aId, DeviceType_T deviceType)3734 bool VirtualBox::i_isMediaUuidInUse(const Guid &aId, DeviceType_T deviceType) 3958 3735 { 3959 3736 /* A zero UUID is invalid here, always claim that it is already used. */ 3960 3737 AssertReturn(!aId.isZero(), true); 3961 3738 3962 AutoReadLock alock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3739 AutoReadLock alock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 3963 3740 3964 3741 HRESULT rc = S_OK; … … 3970 3747 { 3971 3748 case DeviceType_HardDisk: 3972 rc = findHardDiskById(aId, false /* aSetError */, &pMediumFound);3749 rc = i_findHardDiskById(aId, false /* aSetError */, &pMediumFound); 3973 3750 break; 3974 3751 case DeviceType_DVD: 3975 rc = findDVDOrFloppyImage(DeviceType_DVD, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);3752 rc = i_findDVDOrFloppyImage(DeviceType_DVD, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound); 3976 3753 break; 3977 3754 case DeviceType_Floppy: 3978 rc = findDVDOrFloppyImage(DeviceType_Floppy, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound);3755 rc = i_findDVDOrFloppyImage(DeviceType_Floppy, &aId, Utf8Str::Empty, false /* aSetError */, &pMediumFound); 3979 3756 break; 3980 3757 default: … … 4002 3779 * VirtualBox::saveSettings() can process them properly. 4003 3780 */ 4004 void VirtualBox:: rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir,4005 const Utf8Str &strNewConfigDir)4006 { 4007 AutoWriteLock mediaLock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3781 void VirtualBox::i_rememberMachineNameChangeForMedia(const Utf8Str &strOldConfigDir, 3782 const Utf8Str &strNewConfigDir) 3783 { 3784 AutoWriteLock mediaLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4008 3785 4009 3786 Data::PendingMachineRename pmr; … … 4037 3814 } 4038 3815 4039 pDesc->pVirtualBox-> saveModifiedRegistries();3816 pDesc->pVirtualBox->i_saveModifiedRegistries(); 4040 3817 4041 3818 pDesc->llMedia.clear(); … … 4075 3852 * @param strMachineFolder The machine folder for relative paths, if machine registry, or an empty string otherwise. 4076 3853 */ 4077 void VirtualBox:: saveMediaRegistry(settings::MediaRegistry &mediaRegistry,4078 const Guid &uuidRegistry,4079 const Utf8Str &strMachineFolder)3854 void VirtualBox::i_saveMediaRegistry(settings::MediaRegistry &mediaRegistry, 3855 const Guid &uuidRegistry, 3856 const Utf8Str &strMachineFolder) 4080 3857 { 4081 3858 // lock all media for the following; use a write lock because we're 4082 3859 // modifying the PendingMachineRenamesList, which is protected by this 4083 AutoWriteLock mediaLock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);3860 AutoWriteLock mediaLock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4084 3861 4085 3862 // if a machine was renamed, then we'll need to refresh media paths … … 4199 3976 * which could cause conflicts. 4200 3977 */ 4201 HRESULT VirtualBox:: saveSettings()3978 HRESULT VirtualBox::i_saveSettings() 4202 3979 { 4203 3980 AutoCaller autoCaller(this); … … 4227 4004 } 4228 4005 4229 saveMediaRegistry(m->pMainConfigFile->mediaRegistry,4230 m->uuidMediaRegistry, // global media registry ID4231 Utf8Str::Empty); // strMachineFolder4006 i_saveMediaRegistry(m->pMainConfigFile->mediaRegistry, 4007 m->uuidMediaRegistry, // global media registry ID 4008 Utf8Str::Empty); // strMachineFolder 4232 4009 4233 4010 m->pMainConfigFile->llDhcpServers.clear(); … … 4302 4079 * @note Locks objects! 4303 4080 */ 4304 HRESULT VirtualBox:: registerMachine(Machine *aMachine)4081 HRESULT VirtualBox::i_registerMachine(Machine *aMachine) 4305 4082 { 4306 4083 ComAssertRet(aMachine, E_INVALIDARG); … … 4315 4092 { 4316 4093 ComObjPtr<Machine> pMachine; 4317 rc = findMachine(aMachine->getId(),4318 true /* fPermitInaccessible */,4319 false /* aDoSetError */,4320 &pMachine);4094 rc = i_findMachine(aMachine->getId(), 4095 true /* fPermitInaccessible */, 4096 false /* aDoSetError */, 4097 &pMachine); 4321 4098 if (SUCCEEDED(rc)) 4322 4099 { … … 4345 4122 4346 4123 if (autoCaller.state() != InInit) 4347 rc = saveSettings();4124 rc = i_saveSettings(); 4348 4125 4349 4126 return rc; … … 4364 4141 * @return 4365 4142 */ 4366 HRESULT VirtualBox:: registerMedium(const ComObjPtr<Medium> &pMedium,4367 ComObjPtr<Medium> *ppMedium,4368 DeviceType_T argType)4143 HRESULT VirtualBox::i_registerMedium(const ComObjPtr<Medium> &pMedium, 4144 ComObjPtr<Medium> *ppMedium, 4145 DeviceType_T argType) 4369 4146 { 4370 4147 AssertReturn(pMedium != NULL, E_INVALIDARG); … … 4398 4175 4399 4176 // caller must hold the media tree write lock 4400 Assert( getMediaTreeLockHandle().isWriteLockOnCurrentThread());4177 Assert(i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 4401 4178 4402 4179 Guid id; … … 4414 4191 Utf8Str strConflict; 4415 4192 ComObjPtr<Medium> pDupMedium; 4416 rc = checkMediaForConflicts(id,4417 strLocationFull,4418 strConflict,4419 &pDupMedium);4193 rc = i_checkMediaForConflicts(id, 4194 strLocationFull, 4195 strConflict, 4196 &pDupMedium); 4420 4197 if (FAILED(rc)) return rc; 4421 4198 … … 4461 4238 * @note Caller must hold the media tree lock for writing; in addition, this locks @a pMedium for reading 4462 4239 */ 4463 HRESULT VirtualBox:: unregisterMedium(Medium *pMedium)4240 HRESULT VirtualBox::i_unregisterMedium(Medium *pMedium) 4464 4241 { 4465 4242 AssertReturn(pMedium != NULL, E_INVALIDARG); … … 4472 4249 4473 4250 // caller must hold the media tree write lock 4474 Assert( getMediaTreeLockHandle().isWriteLockOnCurrentThread());4251 Assert(i_getMediaTreeLockHandle().isWriteLockOnCurrentThread()); 4475 4252 4476 4253 Guid id; … … 4521 4298 * @param pMedium 4522 4299 */ 4523 void VirtualBox:: pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium)4300 void VirtualBox::i_pushMediumToListWithChildren(MediaList &llMedia, Medium *pMedium) 4524 4301 { 4525 4302 // recurse first, then add ourselves; this way children end up on the … … 4532 4309 { 4533 4310 Medium *pChild = *it; 4534 pushMediumToListWithChildren(llMedia, pChild);4311 i_pushMediumToListWithChildren(llMedia, pChild); 4535 4312 } 4536 4313 … … 4549 4326 * @return 4550 4327 */ 4551 HRESULT VirtualBox:: unregisterMachineMedia(const Guid &uuidMachine)4328 HRESULT VirtualBox::i_unregisterMachineMedia(const Guid &uuidMachine) 4552 4329 { 4553 4330 Assert(!uuidMachine.isZero() && uuidMachine.isValid()); … … 4561 4338 4562 4339 { 4563 AutoWriteLock tlock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);4340 AutoWriteLock tlock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4564 4341 4565 4342 for (MediaOList::iterator it = m->allHardDisks.getList().begin(); … … 4574 4351 if (pMedium->i_isInRegistry(uuidMachine)) 4575 4352 // recursively with children first 4576 pushMediumToListWithChildren(llMedia2Close, pMedium);4353 i_pushMediumToListWithChildren(llMedia2Close, pMedium); 4577 4354 } 4578 4355 } … … 4600 4377 * @return 4601 4378 */ 4602 HRESULT VirtualBox:: unregisterMachine(Machine *pMachine,4603 const Guid &id)4379 HRESULT VirtualBox::i_unregisterMachine(Machine *pMachine, 4380 const Guid &id) 4604 4381 { 4605 4382 // remove from the collection of registered machines … … 4607 4384 m->allMachines.removeChild(pMachine); 4608 4385 // save the global registry 4609 HRESULT rc = saveSettings();4386 HRESULT rc = i_saveSettings(); 4610 4387 alock.release(); 4611 4388 … … 4622 4399 */ 4623 4400 { 4624 AutoReadLock tlock( getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS);4401 AutoReadLock tlock(i_getMediaTreeLockHandle() COMMA_LOCKVAL_SRC_POS); 4625 4402 // iterate over the list of *base* images 4626 4403 for (MediaOList::iterator it = m->allHardDisks.getList().begin(); … … 4646 4423 mlock.release(); 4647 4424 tlock.release(); 4648 markRegistryModified(*puuidBetter);4425 i_markRegistryModified(*puuidBetter); 4649 4426 tlock.acquire(); 4650 4427 mlock.release(); … … 4654 4431 } 4655 4432 4656 saveModifiedRegistries();4433 i_saveModifiedRegistries(); 4657 4434 4658 4435 /* fire an event */ 4659 onMachineRegistered(id, FALSE);4436 i_onMachineRegistered(id, FALSE); 4660 4437 4661 4438 return rc; … … 4668 4445 * @param uuid 4669 4446 */ 4670 void VirtualBox:: markRegistryModified(const Guid &uuid)4671 { 4672 if (uuid == getGlobalRegistryId())4447 void VirtualBox::i_markRegistryModified(const Guid &uuid) 4448 { 4449 if (uuid == i_getGlobalRegistryId()) 4673 4450 ASMAtomicIncU64(&m->uRegistryNeedsSaving); 4674 4451 else 4675 4452 { 4676 4453 ComObjPtr<Machine> pMachine; 4677 HRESULT rc = findMachine(uuid,4678 false /* fPermitInaccessible */,4679 false /* aSetError */,4680 &pMachine);4454 HRESULT rc = i_findMachine(uuid, 4455 false /* fPermitInaccessible */, 4456 false /* aSetError */, 4457 &pMachine); 4681 4458 if (SUCCEEDED(rc)) 4682 4459 { … … 4697 4474 * @return 4698 4475 */ 4699 void VirtualBox:: saveModifiedRegistries()4476 void VirtualBox::i_saveModifiedRegistries() 4700 4477 { 4701 4478 HRESULT rc = S_OK; … … 4747 4524 { 4748 4525 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4749 rc = saveSettings();4526 rc = i_saveSettings(); 4750 4527 } 4751 4528 NOREF(rc); /* XXX */ … … 4754 4531 4755 4532 /* static */ 4756 const Bstr &VirtualBox::getVersionNormalized()4533 const com::Utf8Str &VirtualBox::i_getVersionNormalized() 4757 4534 { 4758 4535 return sVersionNormalized; … … 4773 4550 */ 4774 4551 /* static */ 4775 HRESULT VirtualBox:: ensureFilePathExists(const Utf8Str &strFileName, bool fCreate)4552 HRESULT VirtualBox::i_ensureFilePathExists(const Utf8Str &strFileName, bool fCreate) 4776 4553 { 4777 4554 Utf8Str strDir(strFileName); … … 4783 4560 int vrc = RTDirCreateFullPath(strDir.c_str(), 0700); 4784 4561 if (RT_FAILURE(vrc)) 4785 return setErrorStatic(VBOX_E_IPRT_ERROR,4786 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"),4787 strDir.c_str(),4788 vrc));4562 return i_setErrorStatic(VBOX_E_IPRT_ERROR, 4563 Utf8StrFmt(tr("Could not create the directory '%s' (%Rrc)"), 4564 strDir.c_str(), 4565 vrc)); 4789 4566 } 4790 4567 else 4791 return setErrorStatic(VBOX_E_IPRT_ERROR,4792 Utf8StrFmt(tr("Directory '%s' does not exist"),4793 strDir.c_str()));4568 return i_setErrorStatic(VBOX_E_IPRT_ERROR, 4569 Utf8StrFmt(tr("Directory '%s' does not exist"), 4570 strDir.c_str())); 4794 4571 } 4795 4572 … … 4797 4574 } 4798 4575 4799 const Utf8Str& VirtualBox:: settingsFilePath()4576 const Utf8Str& VirtualBox::i_settingsFilePath() 4800 4577 { 4801 4578 return m->strSettingsFilePath; … … 4809 4586 * before the locks of any machine object. See AutoLock.h. 4810 4587 */ 4811 RWLockHandle& VirtualBox:: getMachinesListLockHandle()4588 RWLockHandle& VirtualBox::i_getMachinesListLockHandle() 4812 4589 { 4813 4590 return m->lockMachines; … … 4822 4599 * objects contained in these lists. See AutoLock.h. 4823 4600 */ 4824 RWLockHandle& VirtualBox:: getMediaTreeLockHandle()4601 RWLockHandle& VirtualBox::i_getMediaTreeLockHandle() 4825 4602 { 4826 4603 return m->lockMedia; … … 4928 4705 //} 4929 4706 4930 STDMETHODIMP VirtualBox::CreateDHCPServer(IN_BSTR aName, IDHCPServer ** aServer) 4931 { 4932 CheckComArgStrNotEmptyOrNull(aName); 4933 CheckComArgNotNull(aServer); 4934 4935 AutoCaller autoCaller(this); 4936 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4937 4707 HRESULT VirtualBox::createDHCPServer(const com::Utf8Str &aName, 4708 ComPtr<IDHCPServer> &aServer) 4709 { 4938 4710 ComObjPtr<DHCPServer> dhcpServer; 4939 4711 dhcpServer.createObject(); 4940 HRESULT rc = dhcpServer->init(this, aName);4712 HRESULT rc = dhcpServer->init(this, Bstr(aName).raw()); 4941 4713 if (FAILED(rc)) return rc; 4942 4714 4943 rc = registerDHCPServer(dhcpServer, true);4715 rc = i_registerDHCPServer(dhcpServer, true); 4944 4716 if (FAILED(rc)) return rc; 4945 4717 4946 dhcpServer.queryInterfaceTo(aServer );4718 dhcpServer.queryInterfaceTo(aServer.asOutParam()); 4947 4719 4948 4720 return rc; 4949 4721 } 4950 4722 4951 STDMETHODIMP VirtualBox::FindDHCPServerByNetworkName(IN_BSTR aName, IDHCPServer ** aServer) 4952 { 4953 CheckComArgStrNotEmptyOrNull(aName); 4954 CheckComArgNotNull(aServer); 4955 4956 AutoCaller autoCaller(this); 4957 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4958 4959 HRESULT rc; 4723 HRESULT VirtualBox::findDHCPServerByNetworkName(const com::Utf8Str &aName, 4724 ComPtr<IDHCPServer> &aServer) 4725 { 4726 HRESULT rc = S_OK; 4960 4727 Bstr bstr; 4961 4728 ComPtr<DHCPServer> found; … … 4970 4737 if (FAILED(rc)) return rc; 4971 4738 4972 if (bstr == aName)4739 if (bstr == Bstr(aName).raw()) 4973 4740 { 4974 4741 found = *it; … … 4980 4747 return E_INVALIDARG; 4981 4748 4982 return found.queryInterfaceTo(aServer); 4983 } 4984 4985 STDMETHODIMP VirtualBox::RemoveDHCPServer(IDHCPServer * aServer) 4986 { 4987 CheckComArgNotNull(aServer); 4988 4989 AutoCaller autoCaller(this); 4990 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 4991 4992 HRESULT rc = unregisterDHCPServer(static_cast<DHCPServer *>(aServer), true); 4749 rc = found.queryInterfaceTo(aServer.asOutParam()); 4750 4751 return rc; 4752 } 4753 4754 HRESULT VirtualBox::removeDHCPServer(const ComPtr<IDHCPServer> &aServer) 4755 { 4756 IDHCPServer *aP = aServer; 4757 4758 HRESULT rc = i_unregisterDHCPServer(static_cast<DHCPServer *>(aP), true); 4993 4759 4994 4760 return rc; … … 5010 4776 * @note Locks this object for writing and @a aDHCPServer for reading. 5011 4777 */ 5012 HRESULT VirtualBox:: registerDHCPServer(DHCPServer *aDHCPServer,5013 bool aSaveSettings /*= true*/)4778 HRESULT VirtualBox::i_registerDHCPServer(DHCPServer *aDHCPServer, 4779 bool aSaveSettings /*= true*/) 5014 4780 { 5015 4781 AssertReturn(aDHCPServer != NULL, E_INVALIDARG); … … 5022 4788 5023 4789 Bstr name; 5024 HRESULT rc; 4790 com::Utf8Str uname; 4791 HRESULT rc = S_OK; 5025 4792 rc = aDHCPServer->COMGETTER(NetworkName)(name.asOutParam()); 5026 4793 if (FAILED(rc)) return rc; 4794 uname = Utf8Str(name); 5027 4795 5028 4796 ComPtr<IDHCPServer> existing; 5029 rc = FindDHCPServerByNetworkName(name.raw(), existing.asOutParam());4797 rc = findDHCPServerByNetworkName(uname, existing); 5030 4798 if (SUCCEEDED(rc)) 5031 4799 return E_INVALIDARG; 5032 5033 4800 rc = S_OK; 5034 4801 … … 5038 4805 { 5039 4806 AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS); 5040 rc = saveSettings();4807 rc = i_saveSettings(); 5041 4808 vboxLock.release(); 5042 4809 5043 4810 if (FAILED(rc)) 5044 unregisterDHCPServer(aDHCPServer, false /* aSaveSettings */);4811 i_unregisterDHCPServer(aDHCPServer, false /* aSaveSettings */); 5045 4812 } 5046 4813 … … 5060 4827 * @note Locks this object for writing. 5061 4828 */ 5062 HRESULT VirtualBox:: unregisterDHCPServer(DHCPServer *aDHCPServer,5063 bool aSaveSettings /*= true*/)4829 HRESULT VirtualBox::i_unregisterDHCPServer(DHCPServer *aDHCPServer, 4830 bool aSaveSettings /*= true*/) 5064 4831 { 5065 4832 AssertReturn(aDHCPServer != NULL, E_INVALIDARG); … … 5078 4845 { 5079 4846 AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS); 5080 rc = saveSettings();4847 rc = i_saveSettings(); 5081 4848 vboxLock.release(); 5082 4849 5083 4850 if (FAILED(rc)) 5084 r egisterDHCPServer(aDHCPServer, false /* aSaveSettings */);4851 rc = i_registerDHCPServer(aDHCPServer, false /* aSaveSettings */); 5085 4852 } 5086 4853 … … 5092 4859 * NAT Network 5093 4860 */ 5094 5095 STDMETHODIMP VirtualBox::CreateNATNetwork(IN_BSTR aName, INATNetwork ** aNatNetwork)4861 HRESULT VirtualBox::createNATNetwork(const com::Utf8Str &aNetworkName, 4862 ComPtr<INATNetwork> &aNetwork) 5096 4863 { 5097 4864 #ifdef VBOX_WITH_NAT_SERVICE 5098 CheckComArgStrNotEmptyOrNull(aName);5099 CheckComArgNotNull(aNatNetwork);5100 5101 AutoCaller autoCaller(this);5102 if (FAILED(autoCaller.rc())) return autoCaller.rc();5103 5104 4865 ComObjPtr<NATNetwork> natNetwork; 5105 4866 natNetwork.createObject(); 5106 HRESULT rc = natNetwork->init(this, aName);4867 HRESULT rc = natNetwork->init(this, Bstr(aNetworkName).raw()); 5107 4868 if (FAILED(rc)) return rc; 5108 4869 5109 rc = registerNATNetwork(natNetwork, true);4870 rc = i_registerNATNetwork(natNetwork, true); 5110 4871 if (FAILED(rc)) return rc; 5111 4872 5112 natNetwork.queryInterfaceTo(aNatNetwork); 5113 5114 fireNATNetworkCreationDeletionEvent(m->pEventSource, aName, TRUE); 4873 natNetwork.queryInterfaceTo(aNetwork.asOutParam()); 4874 4875 fireNATNetworkCreationDeletionEvent(m->pEventSource, Bstr(aNetworkName).raw(), TRUE); 4876 5115 4877 return rc; 5116 4878 #else … … 5121 4883 } 5122 4884 5123 STDMETHODIMP VirtualBox::FindNATNetworkByName(IN_BSTR aName, INATNetwork ** aNetwork) 4885 HRESULT VirtualBox::findNATNetworkByName(const com::Utf8Str &aNetworkName, 4886 ComPtr<INATNetwork> &aNetwork) 5124 4887 { 5125 4888 #ifdef VBOX_WITH_NAT_SERVICE 5126 CheckComArgStrNotEmptyOrNull(aName);5127 CheckComArgNotNull(aNetwork);5128 5129 AutoCaller autoCaller(this);5130 if (FAILED(autoCaller.rc())) return autoCaller.rc();5131 4889 5132 4890 HRESULT rc; … … 5143 4901 if (FAILED(rc)) return rc; 5144 4902 5145 if (bstr == aName)4903 if (bstr == Bstr(aNetworkName).raw()) 5146 4904 { 5147 4905 found = *it; … … 5152 4910 if (!found) 5153 4911 return E_INVALIDARG; 5154 5155 return found.queryInterfaceTo(aNetwork);4912 found.queryInterfaceTo(aNetwork.asOutParam()); 4913 return rc; 5156 4914 #else 5157 4915 NOREF(aName); 5158 NOREF(aNetwork );4916 NOREF(aNetworkName); 5159 4917 return E_NOTIMPL; 5160 4918 #endif 5161 4919 } 5162 4920 5163 STDMETHODIMP VirtualBox::RemoveNATNetwork(INATNetwork *aNetwork)4921 HRESULT VirtualBox::removeNATNetwork(const ComPtr<INATNetwork> &aNetwork) 5164 4922 { 5165 4923 #ifdef VBOX_WITH_NAT_SERVICE 5166 CheckComArgNotNull(aNetwork);5167 5168 AutoCaller autoCaller(this);5169 if (FAILED(autoCaller.rc())) return autoCaller.rc();5170 4924 Bstr name; 5171 HRESULT rc; 5172 NATNetwork *network = static_cast<NATNetwork *>(aNetwork); 4925 HRESULT rc = S_OK; 4926 INATNetwork *iNw = aNetwork; 4927 NATNetwork *network = static_cast<NATNetwork *>(iNw); 5173 4928 rc = network->COMGETTER(NetworkName)(name.asOutParam()); 5174 rc = unregisterNATNetwork(network, true);4929 rc = i_unregisterNATNetwork(network, true); 5175 4930 fireNATNetworkCreationDeletionEvent(m->pEventSource, name.raw(), FALSE); 5176 4931 return rc; … … 5190 4945 * @note Locks this object for writing and @a aNATNetwork for reading. 5191 4946 */ 5192 HRESULT VirtualBox:: registerNATNetwork(NATNetwork *aNATNetwork,5193 bool aSaveSettings /*= true*/)4947 HRESULT VirtualBox::i_registerNATNetwork(NATNetwork *aNATNetwork, 4948 bool aSaveSettings /*= true*/) 5194 4949 { 5195 4950 #ifdef VBOX_WITH_NAT_SERVICE … … 5223 4978 { 5224 4979 AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS); 5225 rc = saveSettings();4980 rc = i_saveSettings(); 5226 4981 vboxLock.release(); 5227 4982 5228 4983 if (FAILED(rc)) 5229 unregisterNATNetwork(aNATNetwork, false /* aSaveSettings */);4984 i_unregisterNATNetwork(aNATNetwork, false /* aSaveSettings */); 5230 4985 } 5231 4986 … … 5251 5006 * @note Locks this object for writing. 5252 5007 */ 5253 HRESULT VirtualBox:: unregisterNATNetwork(NATNetwork *aNATNetwork,5254 bool aSaveSettings /*= true*/)5008 HRESULT VirtualBox::i_unregisterNATNetwork(NATNetwork *aNATNetwork, 5009 bool aSaveSettings /*= true*/) 5255 5010 { 5256 5011 #ifdef VBOX_WITH_NAT_SERVICE … … 5274 5029 { 5275 5030 AutoWriteLock vboxLock(this COMMA_LOCKVAL_SRC_POS); 5276 rc = saveSettings();5031 rc = i_saveSettings(); 5277 5032 vboxLock.release(); 5278 5033 5279 5034 if (FAILED(rc)) 5280 registerNATNetwork(aNATNetwork, false /* aSaveSettings */);5035 i_registerNATNetwork(aNATNetwork, false /* aSaveSettings */); 5281 5036 } 5282 5037 -
trunk/src/VBox/Main/src-server/win/NetIf-win.cpp
r50174 r50355 1149 1149 d->vBox = pVirtualBox; 1150 1150 1151 rc = pVirtualBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1152 netIfNetworkInterfaceHelperClient,1153 static_cast<void *>(d.get()),1154 progress);1151 rc = pVirtualBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1152 netIfNetworkInterfaceHelperClient, 1153 static_cast<void *>(d.get()), 1154 progress); 1155 1155 if (SUCCEEDED(rc)) 1156 1156 { … … 1194 1194 d->guid = aId; 1195 1195 1196 rc = pVirtualBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1197 netIfNetworkInterfaceHelperClient,1198 static_cast<void *>(d.get()),1199 progress);1196 rc = pVirtualBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1197 netIfNetworkInterfaceHelperClient, 1198 static_cast<void *>(d.get()), 1199 progress); 1200 1200 1201 1201 if (SUCCEEDED(rc)) … … 1251 1251 d->u.StaticIP.IPNetMask = mask; 1252 1252 1253 rc = vBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1254 netIfNetworkInterfaceHelperClient,1255 static_cast<void *>(d.get()),1256 progress);1253 rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1254 netIfNetworkInterfaceHelperClient, 1255 static_cast<void *>(d.get()), 1256 progress); 1257 1257 1258 1258 if (SUCCEEDED(rc)) … … 1312 1312 d->u.StaticIPV6.IPV6NetMaskLength = aIPV6MaskPrefixLength; 1313 1313 1314 rc = vBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1315 netIfNetworkInterfaceHelperClient,1316 static_cast<void *>(d.get()),1317 progress);1314 rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1315 netIfNetworkInterfaceHelperClient, 1316 static_cast<void *>(d.get()), 1317 progress); 1318 1318 1319 1319 if (SUCCEEDED(rc)) … … 1371 1371 d->iface = pIf; 1372 1372 1373 rc = vBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1374 netIfNetworkInterfaceHelperClient,1375 static_cast<void *>(d.get()),1376 progress);1373 rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1374 netIfNetworkInterfaceHelperClient, 1375 static_cast<void *>(d.get()), 1376 progress); 1377 1377 1378 1378 if (SUCCEEDED(rc)) … … 1430 1430 d->iface = pIf; 1431 1431 1432 rc = vBox-> startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */,1433 netIfNetworkInterfaceHelperClient,1434 static_cast<void *>(d.get()),1435 progress);1432 rc = vBox->i_startSVCHelperClient(IsUACEnabled() == TRUE /* aPrivileged */, 1433 netIfNetworkInterfaceHelperClient, 1434 static_cast<void *>(d.get()), 1435 progress); 1436 1436 1437 1437 if (SUCCEEDED(rc)) -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r49960 r50355 97 97 98 98 /* implement nsISupports parts of our objects with support for nsIClassInfo */ 99 100 NS_DECL_CLASSINFO(VirtualBox)101 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBox, IVirtualBox)102 103 99 NS_DECL_CLASSINFO(Machine) 104 100 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Machine, IMachine) -
trunk/src/VBox/Main/src-server/xpcom/server.h
r44528 r50355 35 35 36 36 #endif /* ____H_LINUX_SERVER */ 37 HRESULT VirtualBox_GetInterfacesHelper() { return S_OK; } 38 nsIClassInfo* VirtualBox_classInfoGlobal; -
trunk/src/VBox/Main/src-server/xpcom/server_module.cpp
r50117 r50355 91 91 * in sync with macros used for VirtualBox in server.cpp for the same purpose. 92 92 */ 93 94 NS_DECL_CLASSINFO(VirtualBox)95 NS_IMPL_CI_INTERFACE_GETTER1(VirtualBox, IVirtualBox)96 93 97 94 static nsresult vboxsvcSpawnDaemon(void)
Note:
See TracChangeset
for help on using the changeset viewer.