Changeset 21878 in vbox
- Timestamp:
- Jul 30, 2009 12:42:08 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50525
- Location:
- trunk/src/VBox/Main
- Files:
-
- 110 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r21823 r21878 349 349 { 350 350 /* Enclose the state transition Ready->InUninit->NotReady */ 351 AutoUninitSpan autoUninitSpan 351 AutoUninitSpan autoUninitSpan(this); 352 352 if (autoUninitSpan.uninitDone()) 353 353 return; -
trunk/src/VBox/Main/AudioAdapterImpl.cpp
r20501 r21878 53 53 HRESULT AudioAdapter::init (Machine *aParent) 54 54 { 55 LogFlowThisFunc 55 LogFlowThisFunc(("aParent=%p\n", aParent)); 56 56 57 57 ComAssertRet (aParent, E_INVALIDARG); 58 58 59 59 /* Enclose the state transition NotReady->InInit->Ready */ 60 AutoInitSpan autoInitSpan 61 AssertReturn 60 AutoInitSpan autoInitSpan(this); 61 AssertReturn(autoInitSpan.isOk(), E_FAIL); 62 62 63 63 /* Get the default audio driver out of the system properties */ … … 72 72 if (FAILED(rc)) return rc; 73 73 74 unconst 74 unconst(mParent) = aParent; 75 75 /* mPeer is left null */ 76 76 … … 96 96 HRESULT AudioAdapter::init (Machine *aParent, AudioAdapter *aThat) 97 97 { 98 LogFlowThisFunc 98 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 99 99 100 100 ComAssertRet (aParent && aThat, E_INVALIDARG); 101 101 102 102 /* Enclose the state transition NotReady->InInit->Ready */ 103 AutoInitSpan autoInitSpan 104 AssertReturn 105 106 unconst 107 unconst 103 AutoInitSpan autoInitSpan(this); 104 AssertReturn(autoInitSpan.isOk(), E_FAIL); 105 106 unconst(mParent) = aParent; 107 unconst(mPeer) = aThat; 108 108 109 109 AutoCaller thatCaller (aThat); 110 AssertComRCReturnRC 110 AssertComRCReturnRC(thatCaller.rc()); 111 111 112 112 AutoReadLock thatLock (aThat); … … 128 128 HRESULT AudioAdapter::initCopy (Machine *aParent, AudioAdapter *aThat) 129 129 { 130 LogFlowThisFunc 130 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 131 131 132 132 ComAssertRet (aParent && aThat, E_INVALIDARG); 133 133 134 134 /* Enclose the state transition NotReady->InInit->Ready */ 135 AutoInitSpan autoInitSpan 136 AssertReturn 137 138 unconst 135 AutoInitSpan autoInitSpan(this); 136 AssertReturn(autoInitSpan.isOk(), E_FAIL); 137 138 unconst(mParent) = aParent; 139 139 /* mPeer is left null */ 140 140 141 141 AutoCaller thatCaller (aThat); 142 AssertComRCReturnRC 142 AssertComRCReturnRC(thatCaller.rc()); 143 143 144 144 AutoReadLock thatLock (aThat); … … 157 157 void AudioAdapter::uninit() 158 158 { 159 LogFlowThisFunc 159 LogFlowThisFunc(("\n")); 160 160 161 161 /* Enclose the state transition Ready->InUninit->NotReady */ 162 AutoUninitSpan autoUninitSpan 162 AutoUninitSpan autoUninitSpan(this); 163 163 if (autoUninitSpan.uninitDone()) 164 164 return; … … 166 166 mData.free(); 167 167 168 unconst 169 unconst 168 unconst(mPeer).setNull(); 169 unconst(mParent).setNull(); 170 170 } 171 171 … … 177 177 CheckComArgOutPointerValid(aEnabled); 178 178 179 AutoCaller autoCaller 180 CheckComRCReturnRC 181 182 AutoReadLock alock 179 AutoCaller autoCaller(this); 180 CheckComRCReturnRC(autoCaller.rc()); 181 182 AutoReadLock alock(this); 183 183 184 184 *aEnabled = mData->mEnabled; … … 189 189 STDMETHODIMP AudioAdapter::COMSETTER(Enabled)(BOOL aEnabled) 190 190 { 191 AutoCaller autoCaller 192 CheckComRCReturnRC 191 AutoCaller autoCaller(this); 192 CheckComRCReturnRC(autoCaller.rc()); 193 193 194 194 /* the machine needs to be mutable */ 195 195 Machine::AutoMutableStateDependency adep (mParent); 196 CheckComRCReturnRC 197 198 AutoWriteLock alock 196 CheckComRCReturnRC(adep.rc()); 197 198 AutoWriteLock alock(this); 199 199 200 200 if (mData->mEnabled != aEnabled) … … 211 211 CheckComArgOutPointerValid(aAudioDriver); 212 212 213 AutoCaller autoCaller 214 CheckComRCReturnRC 215 216 AutoReadLock alock 213 AutoCaller autoCaller(this); 214 CheckComRCReturnRC(autoCaller.rc()); 215 216 AutoReadLock alock(this); 217 217 218 218 *aAudioDriver = mData->mAudioDriver; … … 223 223 STDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T aAudioDriver) 224 224 { 225 AutoCaller autoCaller 226 CheckComRCReturnRC 225 AutoCaller autoCaller(this); 226 CheckComRCReturnRC(autoCaller.rc()); 227 227 228 228 /* the machine needs to be mutable */ 229 229 Machine::AutoMutableStateDependency adep (mParent); 230 CheckComRCReturnRC 231 232 AutoWriteLock alock 230 CheckComRCReturnRC(adep.rc()); 231 232 AutoWriteLock alock(this); 233 233 234 234 HRESULT rc = S_OK; … … 290 290 CheckComArgOutPointerValid(aAudioController); 291 291 292 AutoCaller autoCaller 293 CheckComRCReturnRC 294 295 AutoReadLock alock 292 AutoCaller autoCaller(this); 293 CheckComRCReturnRC(autoCaller.rc()); 294 295 AutoReadLock alock(this); 296 296 297 297 *aAudioController = mData->mAudioController; … … 302 302 STDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAudioController) 303 303 { 304 AutoCaller autoCaller 305 CheckComRCReturnRC 304 AutoCaller autoCaller(this); 305 CheckComRCReturnRC(autoCaller.rc()); 306 306 307 307 /* the machine needs to be mutable */ 308 308 Machine::AutoMutableStateDependency adep (mParent); 309 CheckComRCReturnRC 310 311 AutoWriteLock alock 309 CheckComRCReturnRC(adep.rc()); 310 311 AutoWriteLock alock(this); 312 312 313 313 HRESULT rc = S_OK; … … 365 365 using namespace settings; 366 366 367 AssertReturn 368 369 AutoCaller autoCaller 370 AssertComRCReturnRC 371 372 AutoWriteLock alock 367 AssertReturn(!aMachineNode.isNull(), E_FAIL); 368 369 AutoCaller autoCaller(this); 370 AssertComRCReturnRC(autoCaller.rc()); 371 372 AutoWriteLock alock(this); 373 373 374 374 /* Note: we assume that the default values for attributes of optional … … 460 460 using namespace settings; 461 461 462 AssertReturn 463 464 AutoCaller autoCaller 465 AssertComRCReturnRC 466 467 AutoReadLock alock 462 AssertReturn(!aMachineNode.isNull(), E_FAIL); 463 464 AutoCaller autoCaller(this); 465 AssertComRCReturnRC(autoCaller.rc()); 466 467 AutoReadLock alock(this); 468 468 469 469 Key node = aMachineNode.createKey ("AudioAdapter"); … … 569 569 { 570 570 /* sanity */ 571 AutoCaller autoCaller 571 AutoCaller autoCaller(this); 572 572 AssertComRCReturn (autoCaller.rc(), false); 573 573 574 AutoWriteLock alock 574 AutoWriteLock alock(this); 575 575 576 576 bool changed = false; … … 594 594 { 595 595 /* sanity */ 596 AutoCaller autoCaller 596 AutoCaller autoCaller(this); 597 597 AssertComRCReturnVoid (autoCaller.rc()); 598 598 … … 625 625 626 626 /* sanity */ 627 AutoCaller autoCaller 627 AutoCaller autoCaller(this); 628 628 AssertComRCReturnVoid (autoCaller.rc()); 629 629 -
trunk/src/VBox/Main/BIOSSettingsImpl.cpp
r17669 r21878 52 52 { 53 53 LogFlowThisFuncEnter(); 54 LogFlowThisFunc 54 LogFlowThisFunc(("aParent: %p\n", aParent)); 55 55 56 56 ComAssertRet (aParent, E_INVALIDARG); 57 57 58 58 /* Enclose the state transition NotReady->InInit->Ready */ 59 AutoInitSpan autoInitSpan 60 AssertReturn 59 AutoInitSpan autoInitSpan(this); 60 AssertReturn(autoInitSpan.isOk(), E_FAIL); 61 61 62 62 /* share the parent weakly */ 63 unconst 63 unconst(mParent) = aParent; 64 64 65 65 mData.allocate(); … … 82 82 { 83 83 LogFlowThisFuncEnter(); 84 LogFlowThisFunc 84 LogFlowThisFunc(("aParent: %p, that: %p\n", aParent, that)); 85 85 86 86 ComAssertRet (aParent && that, E_INVALIDARG); 87 87 88 88 /* Enclose the state transition NotReady->InInit->Ready */ 89 AutoInitSpan autoInitSpan 90 AssertReturn 89 AutoInitSpan autoInitSpan(this); 90 AssertReturn(autoInitSpan.isOk(), E_FAIL); 91 91 92 92 mParent = aParent; … … 110 110 { 111 111 LogFlowThisFuncEnter(); 112 LogFlowThisFunc 112 LogFlowThisFunc(("aParent: %p, that: %p\n", aParent, that)); 113 113 114 114 ComAssertRet (aParent && that, E_INVALIDARG); 115 115 116 116 /* Enclose the state transition NotReady->InInit->Ready */ 117 AutoInitSpan autoInitSpan 118 AssertReturn 117 AutoInitSpan autoInitSpan(this); 118 AssertReturn(autoInitSpan.isOk(), E_FAIL); 119 119 120 120 mParent = aParent; … … 139 139 140 140 /* Enclose the state transition Ready->InUninit->NotReady */ 141 AutoUninitSpan autoUninitSpan 141 AutoUninitSpan autoUninitSpan(this); 142 142 if (autoUninitSpan.uninitDone()) 143 143 return; … … 159 159 return E_POINTER; 160 160 161 AutoCaller autoCaller 162 CheckComRCReturnRC 163 164 AutoReadLock alock 161 AutoCaller autoCaller(this); 162 CheckComRCReturnRC(autoCaller.rc()); 163 164 AutoReadLock alock(this); 165 165 166 166 *enabled = mData->mLogoFadeIn; … … 171 171 STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeIn)(BOOL enable) 172 172 { 173 AutoCaller autoCaller 174 CheckComRCReturnRC 175 176 /* the machine needs to be mutable */ 177 Machine::AutoMutableStateDependency adep (mParent); 178 CheckComRCReturnRC 179 180 AutoWriteLock alock 173 AutoCaller autoCaller(this); 174 CheckComRCReturnRC(autoCaller.rc()); 175 176 /* the machine needs to be mutable */ 177 Machine::AutoMutableStateDependency adep (mParent); 178 CheckComRCReturnRC(adep.rc()); 179 180 AutoWriteLock alock(this); 181 181 182 182 mData.backup(); … … 191 191 return E_POINTER; 192 192 193 AutoCaller autoCaller 194 CheckComRCReturnRC 195 196 AutoReadLock alock 193 AutoCaller autoCaller(this); 194 CheckComRCReturnRC(autoCaller.rc()); 195 196 AutoReadLock alock(this); 197 197 198 198 *enabled = mData->mLogoFadeOut; … … 203 203 STDMETHODIMP BIOSSettings::COMSETTER(LogoFadeOut)(BOOL enable) 204 204 { 205 AutoCaller autoCaller 206 CheckComRCReturnRC 207 208 /* the machine needs to be mutable */ 209 Machine::AutoMutableStateDependency adep (mParent); 210 CheckComRCReturnRC 211 212 AutoWriteLock alock 205 AutoCaller autoCaller(this); 206 CheckComRCReturnRC(autoCaller.rc()); 207 208 /* the machine needs to be mutable */ 209 Machine::AutoMutableStateDependency adep (mParent); 210 CheckComRCReturnRC(adep.rc()); 211 212 AutoWriteLock alock(this); 213 213 214 214 mData.backup(); … … 223 223 return E_POINTER; 224 224 225 AutoCaller autoCaller 226 CheckComRCReturnRC 227 228 AutoReadLock alock 225 AutoCaller autoCaller(this); 226 CheckComRCReturnRC(autoCaller.rc()); 227 228 AutoReadLock alock(this); 229 229 230 230 *displayTime = mData->mLogoDisplayTime; … … 235 235 STDMETHODIMP BIOSSettings::COMSETTER(LogoDisplayTime)(ULONG displayTime) 236 236 { 237 AutoCaller autoCaller 238 CheckComRCReturnRC 239 240 /* the machine needs to be mutable */ 241 Machine::AutoMutableStateDependency adep (mParent); 242 CheckComRCReturnRC 243 244 AutoWriteLock alock 237 AutoCaller autoCaller(this); 238 CheckComRCReturnRC(autoCaller.rc()); 239 240 /* the machine needs to be mutable */ 241 Machine::AutoMutableStateDependency adep (mParent); 242 CheckComRCReturnRC(adep.rc()); 243 244 AutoWriteLock alock(this); 245 245 246 246 mData.backup(); … … 255 255 return E_POINTER; 256 256 257 AutoCaller autoCaller 258 CheckComRCReturnRC 259 260 AutoReadLock alock 257 AutoCaller autoCaller(this); 258 CheckComRCReturnRC(autoCaller.rc()); 259 260 AutoReadLock alock(this); 261 261 262 262 mData->mLogoImagePath.cloneTo(imagePath); … … 270 270 return E_INVALIDARG; 271 271 272 AutoCaller autoCaller 273 CheckComRCReturnRC 274 275 /* the machine needs to be mutable */ 276 Machine::AutoMutableStateDependency adep (mParent); 277 CheckComRCReturnRC 278 279 AutoWriteLock alock 272 AutoCaller autoCaller(this); 273 CheckComRCReturnRC(autoCaller.rc()); 274 275 /* the machine needs to be mutable */ 276 Machine::AutoMutableStateDependency adep (mParent); 277 CheckComRCReturnRC(adep.rc()); 278 279 AutoWriteLock alock(this); 280 280 281 281 mData.backup(); … … 290 290 return E_POINTER; 291 291 292 AutoCaller autoCaller 293 CheckComRCReturnRC 294 295 AutoReadLock alock 292 AutoCaller autoCaller(this); 293 CheckComRCReturnRC(autoCaller.rc()); 294 295 AutoReadLock alock(this); 296 296 297 297 *bootMenuMode = mData->mBootMenuMode; … … 301 301 STDMETHODIMP BIOSSettings::COMSETTER(BootMenuMode)(BIOSBootMenuMode_T bootMenuMode) 302 302 { 303 AutoCaller autoCaller 304 CheckComRCReturnRC 305 306 /* the machine needs to be mutable */ 307 Machine::AutoMutableStateDependency adep (mParent); 308 CheckComRCReturnRC 309 310 AutoWriteLock alock 303 AutoCaller autoCaller(this); 304 CheckComRCReturnRC(autoCaller.rc()); 305 306 /* the machine needs to be mutable */ 307 Machine::AutoMutableStateDependency adep (mParent); 308 CheckComRCReturnRC(adep.rc()); 309 310 AutoWriteLock alock(this); 311 311 312 312 mData.backup(); … … 321 321 return E_POINTER; 322 322 323 AutoCaller autoCaller 324 CheckComRCReturnRC 325 326 AutoReadLock alock 323 AutoCaller autoCaller(this); 324 CheckComRCReturnRC(autoCaller.rc()); 325 326 AutoReadLock alock(this); 327 327 328 328 *enabled = mData->mACPIEnabled; … … 333 333 STDMETHODIMP BIOSSettings::COMSETTER(ACPIEnabled)(BOOL enable) 334 334 { 335 AutoCaller autoCaller 336 CheckComRCReturnRC 337 338 /* the machine needs to be mutable */ 339 Machine::AutoMutableStateDependency adep (mParent); 340 CheckComRCReturnRC 341 342 AutoWriteLock alock 335 AutoCaller autoCaller(this); 336 CheckComRCReturnRC(autoCaller.rc()); 337 338 /* the machine needs to be mutable */ 339 Machine::AutoMutableStateDependency adep (mParent); 340 CheckComRCReturnRC(adep.rc()); 341 342 AutoWriteLock alock(this); 343 343 344 344 mData.backup(); … … 353 353 return E_POINTER; 354 354 355 AutoCaller autoCaller 356 CheckComRCReturnRC 357 358 AutoReadLock alock 355 AutoCaller autoCaller(this); 356 CheckComRCReturnRC(autoCaller.rc()); 357 358 AutoReadLock alock(this); 359 359 360 360 *enabled = mData->mIOAPICEnabled; … … 365 365 STDMETHODIMP BIOSSettings::COMSETTER(IOAPICEnabled)(BOOL enable) 366 366 { 367 AutoCaller autoCaller 368 CheckComRCReturnRC 369 370 /* the machine needs to be mutable */ 371 Machine::AutoMutableStateDependency adep (mParent); 372 CheckComRCReturnRC 373 374 AutoWriteLock alock 367 AutoCaller autoCaller(this); 368 CheckComRCReturnRC(autoCaller.rc()); 369 370 /* the machine needs to be mutable */ 371 Machine::AutoMutableStateDependency adep (mParent); 372 CheckComRCReturnRC(adep.rc()); 373 374 AutoWriteLock alock(this); 375 375 376 376 mData.backup(); … … 385 385 return E_POINTER; 386 386 387 AutoCaller autoCaller 388 CheckComRCReturnRC 389 390 AutoReadLock alock 387 AutoCaller autoCaller(this); 388 CheckComRCReturnRC(autoCaller.rc()); 389 390 AutoReadLock alock(this); 391 391 392 392 *enabled = mData->mPXEDebugEnabled; … … 397 397 STDMETHODIMP BIOSSettings::COMSETTER(PXEDebugEnabled)(BOOL enable) 398 398 { 399 AutoCaller autoCaller 400 CheckComRCReturnRC 401 402 /* the machine needs to be mutable */ 403 Machine::AutoMutableStateDependency adep (mParent); 404 CheckComRCReturnRC 405 406 AutoWriteLock alock 399 AutoCaller autoCaller(this); 400 CheckComRCReturnRC(autoCaller.rc()); 401 402 /* the machine needs to be mutable */ 403 Machine::AutoMutableStateDependency adep (mParent); 404 CheckComRCReturnRC(adep.rc()); 405 406 AutoWriteLock alock(this); 407 407 408 408 mData.backup(); … … 417 417 return E_POINTER; 418 418 419 AutoCaller autoCaller 420 CheckComRCReturnRC 421 422 AutoReadLock alock 419 AutoCaller autoCaller(this); 420 CheckComRCReturnRC(autoCaller.rc()); 421 422 AutoReadLock alock(this); 423 423 424 424 *offset = mData->mTimeOffset; … … 429 429 STDMETHODIMP BIOSSettings::COMSETTER(TimeOffset)(LONG64 offset) 430 430 { 431 AutoCaller autoCaller 432 CheckComRCReturnRC 433 434 /* the machine needs to be mutable */ 435 Machine::AutoMutableStateDependency adep (mParent); 436 CheckComRCReturnRC 437 438 AutoWriteLock alock 431 AutoCaller autoCaller(this); 432 CheckComRCReturnRC(autoCaller.rc()); 433 434 /* the machine needs to be mutable */ 435 Machine::AutoMutableStateDependency adep (mParent); 436 CheckComRCReturnRC(adep.rc()); 437 438 AutoWriteLock alock(this); 439 439 440 440 mData.backup(); … … 463 463 using namespace settings; 464 464 465 AssertReturn 466 467 AutoCaller autoCaller 468 AssertComRCReturnRC 469 470 AutoWriteLock alock 465 AssertReturn(!aMachineNode.isNull(), E_FAIL); 466 467 AutoCaller autoCaller(this); 468 AssertComRCReturnRC(autoCaller.rc()); 469 470 AutoWriteLock alock(this); 471 471 472 472 /* Note: we assume that the default values for attributes of optional … … 558 558 using namespace settings; 559 559 560 AssertReturn 561 562 AutoCaller autoCaller 563 AssertComRCReturnRC 564 565 AutoReadLock alock 560 AssertReturn(!aMachineNode.isNull(), E_FAIL); 561 562 AutoCaller autoCaller(this); 563 AssertComRCReturnRC(autoCaller.rc()); 564 565 AutoReadLock alock(this); 566 566 567 567 Key biosNode = aMachineNode.createKey ("BIOS"); … … 629 629 { 630 630 /* sanity */ 631 AutoCaller autoCaller 631 AutoCaller autoCaller(this); 632 632 AssertComRCReturnVoid (autoCaller.rc()); 633 633 … … 657 657 658 658 /* sanity */ 659 AutoCaller autoCaller 659 AutoCaller autoCaller(this); 660 660 AssertComRCReturnVoid (autoCaller.rc()); 661 661 … … 677 677 678 678 /* sanity */ 679 AutoCaller autoCaller 679 AutoCaller autoCaller(this); 680 680 AssertComRCReturnVoid (autoCaller.rc()); 681 681 682 AutoWriteLock alock 682 AutoWriteLock alock(this); 683 683 684 684 /* Initialize default BIOS settings here */ -
trunk/src/VBox/Main/ConsoleImpl.cpp
r21877 r21878 125 125 AssertReturnVoid (aConsole); 126 126 mRC = aConsole->addCaller(); 127 if (SUCCEEDED 127 if (SUCCEEDED(mRC)) 128 128 { 129 129 mCallerAdded = true; … … 131 131 { 132 132 mRC = aConsole->addVMCaller(); 133 if (SUCCEEDED 133 if (SUCCEEDED(mRC)) 134 134 mVMCallerAdded = true; 135 135 } … … 146 146 147 147 HRESULT rc() const { return mRC; } 148 bool isOk() const { return SUCCEEDED 148 bool isOk() const { return SUCCEEDED(rc()); } 149 149 150 150 /** Releases the Console caller before destruction. Not normally necessary. */ … … 164 164 } 165 165 166 const ComObjPtr 166 const ComObjPtr<Console> mConsole; 167 167 168 168 private: … … 178 178 : VMTask (aConsole, aUsesVMPtr), mProgress (aProgress) {} 179 179 180 const ComObjPtr 180 const ComObjPtr<Progress> mProgress; 181 181 182 182 Utf8Str mErrorMsg; … … 195 195 bool mStartPaused; 196 196 197 typedef std::list <ComPtr 197 typedef std::list <ComPtr<IHardDisk> > HardDiskList; 198 198 HardDiskList hardDisks; 199 199 200 200 /* array of progress objects for hard disk reset operations */ 201 typedef std::list <ComPtr 201 typedef std::list <ComPtr<IProgress> > ProgressList; 202 202 ProgressList hardDiskProgresses; 203 203 }; … … 213 213 Utf8Str mSavedStateFile; 214 214 MachineState_T mLastMachineState; 215 ComPtr 215 ComPtr<IProgress> mServerProgress; 216 216 }; 217 217 … … 240 240 HRESULT Console::FinalConstruct() 241 241 { 242 LogFlowThisFunc 242 LogFlowThisFunc(("\n")); 243 243 244 244 memset(mapFDLeds, 0, sizeof(mapFDLeds)); … … 255 255 void Console::FinalRelease() 256 256 { 257 LogFlowThisFunc 257 LogFlowThisFunc(("\n")); 258 258 259 259 uninit(); … … 265 265 HRESULT Console::init (IMachine *aMachine, IInternalMachineControl *aControl) 266 266 { 267 AssertReturn 267 AssertReturn(aMachine && aControl, E_INVALIDARG); 268 268 269 269 /* Enclose the state transition NotReady->InInit->Ready */ 270 AutoInitSpan autoInitSpan 271 AssertReturn 270 AutoInitSpan autoInitSpan(this); 271 AssertReturn(autoInitSpan.isOk(), E_FAIL); 272 272 273 273 LogFlowThisFuncEnter(); … … 276 276 HRESULT rc = E_FAIL; 277 277 278 unconst 279 unconst 278 unconst(mMachine) = aMachine; 279 unconst(mControl) = aControl; 280 280 281 281 memset (&mCallbackData, 0, sizeof (mCallbackData)); … … 284 284 285 285 rc = mMachine->COMGETTER(State) (&mMachineState); 286 AssertComRCReturnRC 286 AssertComRCReturnRC(rc); 287 287 288 288 #ifdef VBOX_WITH_VRDP 289 rc = mMachine->COMGETTER(VRDPServer) (unconst 290 AssertComRCReturnRC 289 rc = mMachine->COMGETTER(VRDPServer) (unconst(mVRDPServer).asOutParam()); 290 AssertComRCReturnRC(rc); 291 291 #endif 292 292 293 rc = mMachine->COMGETTER(DVDDrive) (unconst 294 AssertComRCReturnRC 295 296 rc = mMachine->COMGETTER(FloppyDrive) (unconst 297 AssertComRCReturnRC 293 rc = mMachine->COMGETTER(DVDDrive) (unconst(mDVDDrive).asOutParam()); 294 AssertComRCReturnRC(rc); 295 296 rc = mMachine->COMGETTER(FloppyDrive) (unconst(mFloppyDrive).asOutParam()); 297 AssertComRCReturnRC(rc); 298 298 299 299 /* Create associated child COM objects */ 300 300 301 unconst 301 unconst(mGuest).createObject(); 302 302 rc = mGuest->init (this); 303 AssertComRCReturnRC 304 305 unconst 303 AssertComRCReturnRC(rc); 304 305 unconst(mKeyboard).createObject(); 306 306 rc = mKeyboard->init (this); 307 AssertComRCReturnRC 308 309 unconst 307 AssertComRCReturnRC(rc); 308 309 unconst(mMouse).createObject(); 310 310 rc = mMouse->init (this); 311 AssertComRCReturnRC 312 313 unconst 311 AssertComRCReturnRC(rc); 312 313 unconst(mDisplay).createObject(); 314 314 rc = mDisplay->init (this); 315 AssertComRCReturnRC 316 317 unconst 315 AssertComRCReturnRC(rc); 316 317 unconst(mRemoteDisplayInfo).createObject(); 318 318 rc = mRemoteDisplayInfo->init (this); 319 AssertComRCReturnRC 319 AssertComRCReturnRC(rc); 320 320 321 321 /* Grab global and machine shared folder lists */ 322 322 323 323 rc = fetchSharedFolders (true /* aGlobal */); 324 AssertComRCReturnRC 324 AssertComRCReturnRC(rc); 325 325 rc = fetchSharedFolders (false /* aGlobal */); 326 AssertComRCReturnRC 326 AssertComRCReturnRC(rc); 327 327 328 328 /* Create other child objects */ 329 329 330 unconst 331 AssertReturn 330 unconst(mConsoleVRDPServer) = new ConsoleVRDPServer (this); 331 AssertReturn(mConsoleVRDPServer, E_FAIL); 332 332 333 333 mcAudioRefs = 0; … … 335 335 mu32SingleRDPClientId = 0; 336 336 337 unconst 338 AssertReturn 339 340 unconst 341 AssertReturn 337 unconst(mVMMDev) = new VMMDev(this); 338 AssertReturn(mVMMDev, E_FAIL); 339 340 unconst(mAudioSniffer) = new AudioSniffer(this); 341 AssertReturn(mAudioSniffer, E_FAIL); 342 342 343 343 /* Confirm a successful initialization when it's the case */ … … 357 357 358 358 /* Enclose the state transition Ready->InUninit->NotReady */ 359 AutoUninitSpan autoUninitSpan 359 AutoUninitSpan autoUninitSpan(this); 360 360 if (autoUninitSpan.uninitDone()) 361 361 { 362 LogFlowThisFunc 362 LogFlowThisFunc(("Already uninitialized.\n")); 363 363 LogFlowThisFuncLeave(); 364 364 return; 365 365 } 366 366 367 LogFlowThisFunc 367 LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed())); 368 368 369 369 /* … … 389 389 { 390 390 delete mAudioSniffer; 391 unconst 391 unconst(mAudioSniffer) = NULL; 392 392 } 393 393 … … 395 395 { 396 396 delete mVMMDev; 397 unconst 397 unconst(mVMMDev) = NULL; 398 398 } 399 399 … … 408 408 { 409 409 mRemoteDisplayInfo->uninit(); 410 unconst 410 unconst(mRemoteDisplayInfo).setNull();; 411 411 } 412 412 … … 414 414 { 415 415 mDebugger->uninit(); 416 unconst 416 unconst(mDebugger).setNull(); 417 417 } 418 418 … … 420 420 { 421 421 mDisplay->uninit(); 422 unconst 422 unconst(mDisplay).setNull(); 423 423 } 424 424 … … 426 426 { 427 427 mMouse->uninit(); 428 unconst 428 unconst(mMouse).setNull(); 429 429 } 430 430 … … 432 432 { 433 433 mKeyboard->uninit(); 434 unconst 434 unconst(mKeyboard).setNull();; 435 435 } 436 436 … … 438 438 { 439 439 mGuest->uninit(); 440 unconst 440 unconst(mGuest).setNull();; 441 441 } 442 442 … … 444 444 { 445 445 delete mConsoleVRDPServer; 446 unconst 447 } 448 449 unconst 450 unconst 446 unconst(mConsoleVRDPServer) = NULL; 447 } 448 449 unconst(mFloppyDrive).setNull(); 450 unconst(mDVDDrive).setNull(); 451 451 #ifdef VBOX_WITH_VRDP 452 unconst 452 unconst(mVRDPServer).setNull(); 453 453 #endif 454 454 455 unconst 456 unconst 455 unconst(mControl).setNull(); 456 unconst(mMachine).setNull(); 457 457 458 458 /* Release all callbacks. Do this after uninitializing the components, … … 580 580 LogFlowFunc (("%d, %s, %s, %s\n", u32ClientId, pszUser, pszPassword, pszDomain)); 581 581 582 AutoCaller autoCaller 582 AutoCaller autoCaller(this); 583 583 if (!autoCaller.isOk()) 584 584 { … … 774 774 LogFlowFuncEnter(); 775 775 776 AutoCaller autoCaller 776 AutoCaller autoCaller(this); 777 777 AssertComRCReturnVoid (autoCaller.rc()); 778 778 … … 800 800 LogFlowFuncEnter(); 801 801 802 AutoCaller autoCaller 802 AutoCaller autoCaller(this); 803 803 AssertComRCReturnVoid (autoCaller.rc()); 804 804 … … 870 870 LogFlowFuncEnter(); 871 871 872 AutoCaller autoCaller 872 AutoCaller autoCaller(this); 873 873 AssertComRCReturnVoid (autoCaller.rc()); 874 874 … … 901 901 LogFlowFuncEnter(); 902 902 903 AutoCaller autoCaller 903 AutoCaller autoCaller(this); 904 904 AssertComRCReturnVoid (autoCaller.rc()); 905 905 … … 916 916 LogFlowFuncEnter(); 917 917 918 AutoCaller autoCaller 918 AutoCaller autoCaller(this); 919 919 AssertComRCReturnVoid (autoCaller.rc()); 920 920 … … 1002 1002 AssertReturnVoid (that); 1003 1003 1004 AutoCaller autoCaller 1004 AutoCaller autoCaller(that); 1005 1005 AssertComRCReturnVoid (autoCaller.rc()); 1006 1006 1007 AutoReadLock alock 1007 AutoReadLock alock(that); 1008 1008 1009 1009 int vrc = SSMR3PutU32 (pSSM, (uint32_t)that->mSharedFolders.size()); … … 1014 1014 ++ it) 1015 1015 { 1016 ComObjPtr 1016 ComObjPtr<SharedFolder> folder = (*it).second; 1017 1017 // don't lock the folder because methods we access are const 1018 1018 … … 1056 1056 1057 1057 Console *that = static_cast <Console *> (pvUser); 1058 AssertReturn 1058 AssertReturn(that, VERR_INVALID_PARAMETER); 1059 1059 1060 1060 /* Currently, nothing to do when we've been called from VMR3Load. */ … … 1076 1076 Console::loadStateFileExecInternal (PSSMHANDLE pSSM, uint32_t u32Version) 1077 1077 { 1078 AutoCaller autoCaller 1078 AutoCaller autoCaller(this); 1079 1079 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 1080 1080 1081 AutoWriteLock alock 1082 1083 AssertReturn 1081 AutoWriteLock alock(this); 1082 1083 AssertReturn(mSharedFolders.size() == 0, VERR_INTERNAL_ERROR); 1084 1084 1085 1085 uint32_t size = 0; … … 1115 1115 SSMR3GetBool (pSSM, &writable); 1116 1116 1117 ComObjPtr 1117 ComObjPtr<SharedFolder> sharedFolder; 1118 1118 sharedFolder.createObject(); 1119 1119 HRESULT rc = sharedFolder->init (this, name, hostPath, writable); … … 1141 1141 AssertReturn(sizeof(HOSTCALLBACKDATA) == cbParms, VERR_INVALID_PARAMETER); 1142 1142 AssertReturn(HOSTCALLBACKMAGIC == pCBData->u32Magic, VERR_INVALID_PARAMETER); 1143 ComObjPtr 1143 ComObjPtr<Console> pConsole = reinterpret_cast <Console *> (pvExtension); 1144 1144 LogFlowFunc (("pCBData->pcszName=%s, pCBData->pcszValue=%s, pCBData->pcszFlags=%s\n", pCBData->pcszName, pCBData->pcszValue, pCBData->pcszFlags)); 1145 1145 Bstr name(pCBData->pcszName); … … 1237 1237 * And now we create the COM safe arrays and fill them in. 1238 1238 */ 1239 com::SafeArray 1240 com::SafeArray 1241 com::SafeArray 1242 com::SafeArray 1239 com::SafeArray<BSTR> names(cEntries); 1240 com::SafeArray<BSTR> values(cEntries); 1241 com::SafeArray<ULONG64> timestamps(cEntries); 1242 com::SafeArray<BSTR> flags(cEntries); 1243 1243 size_t iBuf = 0; 1244 1244 /* Rely on the service to have formated the data correctly. */ … … 1258 1258 iBuf += cchFlags + 1; 1259 1259 } 1260 names.detachTo(ComSafeArrayOutArg 1261 values.detachTo(ComSafeArrayOutArg 1262 timestamps.detachTo(ComSafeArrayOutArg 1263 flags.detachTo(ComSafeArrayOutArg 1260 names.detachTo(ComSafeArrayOutArg(aNames)); 1261 values.detachTo(ComSafeArrayOutArg(aValues)); 1262 timestamps.detachTo(ComSafeArrayOutArg(aTimestamps)); 1263 flags.detachTo(ComSafeArrayOutArg(aFlags)); 1264 1264 return S_OK; 1265 1265 } … … 1274 1274 CheckComArgOutPointerValid(aMachine); 1275 1275 1276 AutoCaller autoCaller 1277 CheckComRCReturnRC 1276 AutoCaller autoCaller(this); 1277 CheckComRCReturnRC(autoCaller.rc()); 1278 1278 1279 1279 /* mMachine is constant during life time, no need to lock */ 1280 mMachine.queryInterfaceTo 1280 mMachine.queryInterfaceTo(aMachine); 1281 1281 1282 1282 return S_OK; … … 1287 1287 CheckComArgOutPointerValid(aMachineState); 1288 1288 1289 AutoCaller autoCaller 1290 CheckComRCReturnRC 1291 1292 AutoReadLock alock 1289 AutoCaller autoCaller(this); 1290 CheckComRCReturnRC(autoCaller.rc()); 1291 1292 AutoReadLock alock(this); 1293 1293 1294 1294 /* we return our local state (since it's always the same as on the server) */ … … 1302 1302 CheckComArgOutPointerValid(aGuest); 1303 1303 1304 AutoCaller autoCaller 1305 CheckComRCReturnRC 1304 AutoCaller autoCaller(this); 1305 CheckComRCReturnRC(autoCaller.rc()); 1306 1306 1307 1307 /* mGuest is constant during life time, no need to lock */ 1308 mGuest.queryInterfaceTo 1308 mGuest.queryInterfaceTo(aGuest); 1309 1309 1310 1310 return S_OK; … … 1315 1315 CheckComArgOutPointerValid(aKeyboard); 1316 1316 1317 AutoCaller autoCaller 1318 CheckComRCReturnRC 1317 AutoCaller autoCaller(this); 1318 CheckComRCReturnRC(autoCaller.rc()); 1319 1319 1320 1320 /* mKeyboard is constant during life time, no need to lock */ 1321 mKeyboard.queryInterfaceTo 1321 mKeyboard.queryInterfaceTo(aKeyboard); 1322 1322 1323 1323 return S_OK; … … 1328 1328 CheckComArgOutPointerValid(aMouse); 1329 1329 1330 AutoCaller autoCaller 1331 CheckComRCReturnRC 1330 AutoCaller autoCaller(this); 1331 CheckComRCReturnRC(autoCaller.rc()); 1332 1332 1333 1333 /* mMouse is constant during life time, no need to lock */ 1334 mMouse.queryInterfaceTo 1334 mMouse.queryInterfaceTo(aMouse); 1335 1335 1336 1336 return S_OK; … … 1341 1341 CheckComArgOutPointerValid(aDisplay); 1342 1342 1343 AutoCaller autoCaller 1344 CheckComRCReturnRC 1343 AutoCaller autoCaller(this); 1344 CheckComRCReturnRC(autoCaller.rc()); 1345 1345 1346 1346 /* mDisplay is constant during life time, no need to lock */ 1347 mDisplay.queryInterfaceTo 1347 mDisplay.queryInterfaceTo(aDisplay); 1348 1348 1349 1349 return S_OK; … … 1354 1354 CheckComArgOutPointerValid(aDebugger); 1355 1355 1356 AutoCaller autoCaller 1357 CheckComRCReturnRC 1356 AutoCaller autoCaller(this); 1357 CheckComRCReturnRC(autoCaller.rc()); 1358 1358 1359 1359 /* we need a write lock because of the lazy mDebugger initialization*/ 1360 AutoWriteLock alock 1360 AutoWriteLock alock(this); 1361 1361 1362 1362 /* check if we have to create the debugger object */ 1363 1363 if (!mDebugger) 1364 1364 { 1365 unconst 1365 unconst(mDebugger).createObject(); 1366 1366 mDebugger->init (this); 1367 1367 } 1368 1368 1369 mDebugger.queryInterfaceTo 1369 mDebugger.queryInterfaceTo(aDebugger); 1370 1370 1371 1371 return S_OK; 1372 1372 } 1373 1373 1374 STDMETHODIMP Console::COMGETTER(USBDevices) (ComSafeArrayOut 1374 STDMETHODIMP Console::COMGETTER(USBDevices) (ComSafeArrayOut(IUSBDevice *, aUSBDevices)) 1375 1375 { 1376 1376 CheckComArgOutSafeArrayPointerValid(aUSBDevices); 1377 1377 1378 AutoCaller autoCaller 1379 CheckComRCReturnRC 1380 1381 AutoReadLock alock 1382 1383 SafeIfaceArray 1384 collection.detachTo 1378 AutoCaller autoCaller(this); 1379 CheckComRCReturnRC(autoCaller.rc()); 1380 1381 AutoReadLock alock(this); 1382 1383 SafeIfaceArray<IUSBDevice> collection (mUSBDevices); 1384 collection.detachTo(ComSafeArrayOutArg(aUSBDevices)); 1385 1385 1386 1386 return S_OK; 1387 1387 } 1388 1388 1389 STDMETHODIMP Console::COMGETTER(RemoteUSBDevices) (ComSafeArrayOut 1389 STDMETHODIMP Console::COMGETTER(RemoteUSBDevices) (ComSafeArrayOut(IHostUSBDevice *, aRemoteUSBDevices)) 1390 1390 { 1391 1391 CheckComArgOutSafeArrayPointerValid(aRemoteUSBDevices); 1392 1392 1393 AutoCaller autoCaller 1394 CheckComRCReturnRC 1395 1396 AutoReadLock alock 1397 1398 SafeIfaceArray 1399 collection.detachTo 1393 AutoCaller autoCaller(this); 1394 CheckComRCReturnRC(autoCaller.rc()); 1395 1396 AutoReadLock alock(this); 1397 1398 SafeIfaceArray<IHostUSBDevice> collection (mRemoteUSBDevices); 1399 collection.detachTo(ComSafeArrayOutArg(aRemoteUSBDevices)); 1400 1400 1401 1401 return S_OK; … … 1406 1406 CheckComArgOutPointerValid(aRemoteDisplayInfo); 1407 1407 1408 AutoCaller autoCaller 1409 CheckComRCReturnRC 1408 AutoCaller autoCaller(this); 1409 CheckComRCReturnRC(autoCaller.rc()); 1410 1410 1411 1411 /* mDisplay is constant during life time, no need to lock */ 1412 mRemoteDisplayInfo.queryInterfaceTo 1412 mRemoteDisplayInfo.queryInterfaceTo(aRemoteDisplayInfo); 1413 1413 1414 1414 return S_OK; … … 1416 1416 1417 1417 STDMETHODIMP 1418 Console::COMGETTER(SharedFolders) (ComSafeArrayOut 1418 Console::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 1419 1419 { 1420 1420 CheckComArgOutSafeArrayPointerValid(aSharedFolders); 1421 1421 1422 AutoCaller autoCaller 1423 CheckComRCReturnRC 1422 AutoCaller autoCaller(this); 1423 CheckComRCReturnRC(autoCaller.rc()); 1424 1424 1425 1425 /* loadDataFromSavedState() needs a write lock */ 1426 AutoWriteLock alock 1426 AutoWriteLock alock(this); 1427 1427 1428 1428 /* Read console data stored in the saved state file (if not yet done) */ 1429 1429 HRESULT rc = loadDataFromSavedState(); 1430 CheckComRCReturnRC 1431 1432 SafeIfaceArray 1433 sf.detachTo 1430 CheckComRCReturnRC(rc); 1431 1432 SafeIfaceArray<ISharedFolder> sf (mSharedFolders); 1433 sf.detachTo(ComSafeArrayOutArg(aSharedFolders)); 1434 1434 1435 1435 return S_OK; … … 1457 1457 1458 1458 LogFlowThisFuncEnter(); 1459 LogFlowThisFunc 1460 1461 AutoCaller autoCaller 1462 CheckComRCReturnRC 1463 1464 AutoWriteLock alock 1459 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 1460 1461 AutoCaller autoCaller(this); 1462 CheckComRCReturnRC(autoCaller.rc()); 1463 1464 AutoWriteLock alock(this); 1465 1465 1466 1466 if (!Global::IsActive (mMachineState)) … … 1480 1480 } 1481 1481 1482 LogFlowThisFunc 1482 LogFlowThisFunc(("Initiating SHUTDOWN request...\n")); 1483 1483 1484 1484 /* create an IProgress object to track progress of this operation */ 1485 ComObjPtr 1485 ComObjPtr<Progress> progress; 1486 1486 progress.createObject(); 1487 1487 progress->init (static_cast <IConsole *> (this), … … 1492 1492 std::auto_ptr <VMProgressTask> task ( 1493 1493 new VMProgressTask (this, progress, true /* aUsesVMPtr */)); 1494 AssertReturn 1494 AssertReturn(task->isOk(), E_FAIL); 1495 1495 1496 1496 int vrc = RTThreadCreate (NULL, Console::powerDownThread, … … 1508 1508 1509 1509 /* pass the progress to the caller */ 1510 progress.queryInterfaceTo 1510 progress.queryInterfaceTo(aProgress); 1511 1511 1512 1512 LogFlowThisFuncLeave(); … … 1518 1518 { 1519 1519 LogFlowThisFuncEnter(); 1520 LogFlowThisFunc 1521 1522 AutoCaller autoCaller 1523 CheckComRCReturnRC 1524 1525 AutoWriteLock alock 1520 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 1521 1522 AutoCaller autoCaller(this); 1523 CheckComRCReturnRC(autoCaller.rc()); 1524 1525 AutoWriteLock alock(this); 1526 1526 1527 1527 if (mMachineState != MachineState_Running) … … 1531 1531 /* protect mpVM */ 1532 1532 AutoVMCaller autoVMCaller (this); 1533 CheckComRCReturnRC 1533 CheckComRCReturnRC(autoVMCaller.rc()); 1534 1534 1535 1535 /* leave the lock before a VMR3* call (EMT will call us back)! */ … … 1541 1541 setError (VBOX_E_VM_ERROR, tr ("Could not reset the machine (%Rrc)"), vrc); 1542 1542 1543 LogFlowThisFunc 1543 LogFlowThisFunc(("mMachineState=%d, rc=%08X\n", mMachineState, rc)); 1544 1544 LogFlowThisFuncLeave(); 1545 1545 return rc; … … 1550 1550 LogFlowThisFuncEnter(); 1551 1551 1552 AutoCaller autoCaller 1553 CheckComRCReturnRC 1554 1555 AutoWriteLock alock 1552 AutoCaller autoCaller(this); 1553 CheckComRCReturnRC(autoCaller.rc()); 1554 1555 AutoWriteLock alock(this); 1556 1556 1557 1557 if (mMachineState != MachineState_Running) … … 1561 1561 /* protect mpVM */ 1562 1562 AutoVMCaller autoVMCaller (this); 1563 CheckComRCReturnRC 1564 1565 LogFlowThisFunc 1563 CheckComRCReturnRC(autoVMCaller.rc()); 1564 1565 LogFlowThisFunc(("Sending PAUSE request...\n")); 1566 1566 1567 1567 /* leave the lock before a VMR3* call (EMT will call us back)! */ … … 1574 1574 tr ("Could not suspend the machine execution (%Rrc)"), vrc); 1575 1575 1576 LogFlowThisFunc 1576 LogFlowThisFunc(("rc=%08X\n", rc)); 1577 1577 LogFlowThisFuncLeave(); 1578 1578 return rc; … … 1583 1583 LogFlowThisFuncEnter(); 1584 1584 1585 AutoCaller autoCaller 1586 CheckComRCReturnRC 1587 1588 AutoWriteLock alock 1585 AutoCaller autoCaller(this); 1586 CheckComRCReturnRC(autoCaller.rc()); 1587 1588 AutoWriteLock alock(this); 1589 1589 1590 1590 if (mMachineState != MachineState_Paused) … … 1595 1595 /* protect mpVM */ 1596 1596 AutoVMCaller autoVMCaller (this); 1597 CheckComRCReturnRC 1598 1599 LogFlowThisFunc 1597 CheckComRCReturnRC(autoVMCaller.rc()); 1598 1599 LogFlowThisFunc(("Sending RESUME request...\n")); 1600 1600 1601 1601 /* leave the lock before a VMR3* call (EMT will call us back)! */ … … 1612 1612 tr ("Could not resume the machine execution (%Rrc)"), vrc); 1613 1613 1614 LogFlowThisFunc 1614 LogFlowThisFunc(("rc=%08X\n", rc)); 1615 1615 LogFlowThisFuncLeave(); 1616 1616 return rc; … … 1621 1621 LogFlowThisFuncEnter(); 1622 1622 1623 AutoCaller autoCaller 1624 CheckComRCReturnRC 1625 1626 AutoWriteLock alock 1623 AutoCaller autoCaller(this); 1624 CheckComRCReturnRC(autoCaller.rc()); 1625 1626 AutoWriteLock alock(this); 1627 1627 1628 1628 if (mMachineState != MachineState_Running) … … 1632 1632 /* protect mpVM */ 1633 1633 AutoVMCaller autoVMCaller (this); 1634 CheckComRCReturnRC 1634 CheckComRCReturnRC(autoVMCaller.rc()); 1635 1635 1636 1636 PPDMIBASE pBase; … … 1648 1648 tr ("Controlled power off failed (%Rrc)"), vrc); 1649 1649 1650 LogFlowThisFunc 1650 LogFlowThisFunc(("rc=%08X\n", rc)); 1651 1651 LogFlowThisFuncLeave(); 1652 1652 return rc; … … 1661 1661 *aHandled = FALSE; 1662 1662 1663 AutoCaller autoCaller 1664 1665 AutoWriteLock alock 1663 AutoCaller autoCaller(this); 1664 1665 AutoWriteLock alock(this); 1666 1666 1667 1667 if (mMachineState != MachineState_Running) … … 1671 1671 /* protect mpVM */ 1672 1672 AutoVMCaller autoVMCaller (this); 1673 CheckComRCReturnRC 1673 CheckComRCReturnRC(autoVMCaller.rc()); 1674 1674 1675 1675 PPDMIBASE pBase; … … 1691 1691 *aHandled = handled; 1692 1692 1693 LogFlowThisFunc 1693 LogFlowThisFunc(("rc=%08X\n", rc)); 1694 1694 LogFlowThisFuncLeave(); 1695 1695 return rc; … … 1704 1704 *aEntered = FALSE; 1705 1705 1706 AutoCaller autoCaller 1707 1708 AutoWriteLock alock 1706 AutoCaller autoCaller(this); 1707 1708 AutoWriteLock alock(this); 1709 1709 1710 1710 if (mMachineState != MachineState_Running) … … 1715 1715 /* protect mpVM */ 1716 1716 AutoVMCaller autoVMCaller (this); 1717 CheckComRCReturnRC 1717 CheckComRCReturnRC(autoVMCaller.rc()); 1718 1718 1719 1719 PPDMIBASE pBase; 1720 1720 int vrc = PDMR3QueryDeviceLun (mpVM, "acpi", 0, 0, &pBase); 1721 1721 bool entered = false; 1722 if (RT_SUCCESS 1722 if (RT_SUCCESS(vrc)) 1723 1723 { 1724 1724 Assert (pBase); … … 1728 1728 } 1729 1729 1730 *aEntered = RT_SUCCESS 1730 *aEntered = RT_SUCCESS(vrc) ? entered : false; 1731 1731 1732 1732 LogFlowThisFuncLeave(); … … 1738 1738 LogFlowThisFuncEnter(); 1739 1739 1740 AutoCaller autoCaller 1741 CheckComRCReturnRC 1742 1743 AutoWriteLock alock 1740 AutoCaller autoCaller(this); 1741 CheckComRCReturnRC(autoCaller.rc()); 1742 1743 AutoWriteLock alock(this); 1744 1744 1745 1745 if (mMachineState != MachineState_Running) … … 1749 1749 /* protect mpVM */ 1750 1750 AutoVMCaller autoVMCaller (this); 1751 CheckComRCReturnRC 1751 CheckComRCReturnRC(autoVMCaller.rc()); 1752 1752 1753 1753 PPDMIBASE pBase; … … 1765 1765 tr ("Sending sleep button event failed (%Rrc)"), vrc); 1766 1766 1767 LogFlowThisFunc 1767 LogFlowThisFunc(("rc=%08X\n", rc)); 1768 1768 LogFlowThisFuncLeave(); 1769 1769 return rc; … … 1773 1773 { 1774 1774 LogFlowThisFuncEnter(); 1775 LogFlowThisFunc 1775 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 1776 1776 1777 1777 CheckComArgOutPointerValid(aProgress); 1778 1778 1779 AutoCaller autoCaller 1780 CheckComRCReturnRC 1781 1782 AutoWriteLock alock 1779 AutoCaller autoCaller(this); 1780 CheckComRCReturnRC(autoCaller.rc()); 1781 1782 AutoWriteLock alock(this); 1783 1783 1784 1784 if (mMachineState != MachineState_Running && … … 1796 1796 { 1797 1797 HRESULT rc = Pause(); 1798 CheckComRCReturnRC 1798 CheckComRCReturnRC(rc); 1799 1799 } 1800 1800 … … 1802 1802 1803 1803 /* create a progress object to track operation completion */ 1804 ComObjPtr 1804 ComObjPtr<Progress> progress; 1805 1805 progress.createObject(); 1806 1806 progress->init (static_cast <IConsole *> (this), … … 1877 1877 1878 1878 /* return the progress to the caller */ 1879 progress.queryInterfaceTo 1879 progress.queryInterfaceTo(aProgress); 1880 1880 } 1881 1881 while (0); … … 1907 1907 } 1908 1908 1909 LogFlowThisFunc 1909 LogFlowThisFunc(("rc=%08X\n", rc)); 1910 1910 LogFlowThisFuncLeave(); 1911 1911 return rc; … … 1916 1916 CheckComArgNotNull(aSavedStateFile); 1917 1917 1918 AutoCaller autoCaller 1919 CheckComRCReturnRC 1920 1921 AutoWriteLock alock 1918 AutoCaller autoCaller(this); 1919 CheckComRCReturnRC(autoCaller.rc()); 1920 1921 AutoWriteLock alock(this); 1922 1922 1923 1923 if (mMachineState != MachineState_PoweredOff && … … 1933 1933 STDMETHODIMP Console::ForgetSavedState(BOOL aRemove) 1934 1934 { 1935 AutoCaller autoCaller 1936 CheckComRCReturnRC 1937 1938 AutoWriteLock alock 1935 AutoCaller autoCaller(this); 1936 CheckComRCReturnRC(autoCaller.rc()); 1937 1938 AutoWriteLock alock(this); 1939 1939 1940 1940 if (mMachineState != MachineState_Saved) … … 1947 1947 1948 1948 rc = mControl->SetRemoveSavedState(aRemove); 1949 CheckComRCReturnRC 1949 CheckComRCReturnRC(rc); 1950 1950 1951 1951 /* … … 1973 1973 CheckComArgNotNull(aDeviceActivity); 1974 1974 1975 AutoCaller autoCaller 1976 CheckComRCReturnRC 1975 AutoCaller autoCaller(this); 1976 CheckComRCReturnRC(autoCaller.rc()); 1977 1977 1978 1978 /* … … 2056 2056 { 2057 2057 #ifdef VBOX_WITH_USB 2058 AutoCaller autoCaller 2059 CheckComRCReturnRC 2060 2061 AutoWriteLock alock 2058 AutoCaller autoCaller(this); 2059 CheckComRCReturnRC(autoCaller.rc()); 2060 2061 AutoWriteLock alock(this); 2062 2062 2063 2063 if (mMachineState != MachineState_Running && … … 2069 2069 /* protect mpVM */ 2070 2070 AutoVMCaller autoVMCaller (this); 2071 CheckComRCReturnRC 2071 CheckComRCReturnRC(autoVMCaller.rc()); 2072 2072 2073 2073 /* Don't proceed unless we've found the usb controller. */ … … 2084 2084 /* Request the device capture */ 2085 2085 HRESULT rc = mControl->CaptureUSBDevice (aId); 2086 CheckComRCReturnRC 2086 CheckComRCReturnRC(rc); 2087 2087 2088 2088 return rc; … … 2099 2099 CheckComArgOutPointerValid(aDevice); 2100 2100 2101 AutoCaller autoCaller 2102 CheckComRCReturnRC 2103 2104 AutoWriteLock alock 2101 AutoCaller autoCaller(this); 2102 CheckComRCReturnRC(autoCaller.rc()); 2103 2104 AutoWriteLock alock(this); 2105 2105 2106 2106 /* Find it. */ 2107 ComObjPtr 2107 ComObjPtr<OUSBDevice> device; 2108 2108 USBDeviceList::iterator it = mUSBDevices.begin(); 2109 2109 Guid uuid(aId); … … 2135 2135 HRESULT rc = detachUSBDevice (it); 2136 2136 2137 if (SUCCEEDED 2137 if (SUCCEEDED(rc)) 2138 2138 { 2139 2139 /* leave the lock since we don't need it any more (note though that … … 2163 2163 *aDevice = NULL; 2164 2164 2165 SafeIfaceArray 2165 SafeIfaceArray<IUSBDevice> devsvec; 2166 2166 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2167 CheckComRCReturnRC 2167 CheckComRCReturnRC(rc); 2168 2168 2169 2169 for (size_t i = 0; i < devsvec.size(); ++i) … … 2171 2171 Bstr address; 2172 2172 rc = devsvec[i]->COMGETTER(Address) (address.asOutParam()); 2173 CheckComRCReturnRC 2173 CheckComRCReturnRC(rc); 2174 2174 if (address == aAddress) 2175 2175 { … … 2177 2177 found.createObject(); 2178 2178 found->init (devsvec[i]); 2179 return found.queryInterfaceTo 2179 return found.queryInterfaceTo(aDevice); 2180 2180 } 2181 2181 } … … 2198 2198 *aDevice = NULL; 2199 2199 2200 SafeIfaceArray 2200 SafeIfaceArray<IUSBDevice> devsvec; 2201 2201 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2202 CheckComRCReturnRC 2202 CheckComRCReturnRC(rc); 2203 2203 2204 2204 for (size_t i = 0; i < devsvec.size(); ++i) … … 2206 2206 Bstr id; 2207 2207 rc = devsvec[i]->COMGETTER(Id) (id.asOutParam()); 2208 CheckComRCReturnRC 2208 CheckComRCReturnRC(rc); 2209 2209 if (id == aId) 2210 2210 { … … 2212 2212 found.createObject(); 2213 2213 found->init(devsvec[i]); 2214 return found.queryInterfaceTo 2214 return found.queryInterfaceTo(aDevice); 2215 2215 } 2216 2216 } … … 2231 2231 CheckComArgNotNull(aHostPath); 2232 2232 2233 AutoCaller autoCaller 2234 CheckComRCReturnRC 2235 2236 AutoWriteLock alock 2233 AutoCaller autoCaller(this); 2234 CheckComRCReturnRC(autoCaller.rc()); 2235 2236 AutoWriteLock alock(this); 2237 2237 2238 2238 /// @todo see @todo in AttachUSBDevice() about the Paused state … … 2247 2247 mMachineState); 2248 2248 2249 ComObjPtr 2249 ComObjPtr<SharedFolder> sharedFolder; 2250 2250 HRESULT rc = findSharedFolder (aName, sharedFolder, false /* aSetError */); 2251 if (SUCCEEDED 2251 if (SUCCEEDED(rc)) 2252 2252 return setError (VBOX_E_FILE_ERROR, 2253 2253 tr ("Shared folder named '%ls' already exists"), aName); … … 2255 2255 sharedFolder.createObject(); 2256 2256 rc = sharedFolder->init (this, aName, aHostPath, aWritable); 2257 CheckComRCReturnRC 2257 CheckComRCReturnRC(rc); 2258 2258 2259 2259 /* protect mpVM (if not NULL) */ … … 2270 2270 { 2271 2271 rc = removeSharedFolder (aName); 2272 CheckComRCReturnRC 2272 CheckComRCReturnRC(rc); 2273 2273 } 2274 2274 2275 2275 /* second, create the given folder */ 2276 2276 rc = createSharedFolder (aName, SharedFolderData (aHostPath, aWritable)); 2277 CheckComRCReturnRC 2277 CheckComRCReturnRC(rc); 2278 2278 } 2279 2279 … … 2294 2294 CheckComArgNotNull(aName); 2295 2295 2296 AutoCaller autoCaller 2297 CheckComRCReturnRC 2298 2299 AutoWriteLock alock 2296 AutoCaller autoCaller(this); 2297 CheckComRCReturnRC(autoCaller.rc()); 2298 2299 AutoWriteLock alock(this); 2300 2300 2301 2301 /// @todo see @todo in AttachUSBDevice() about the Paused state … … 2310 2310 mMachineState); 2311 2311 2312 ComObjPtr 2312 ComObjPtr<SharedFolder> sharedFolder; 2313 2313 HRESULT rc = findSharedFolder (aName, sharedFolder, true /* aSetError */); 2314 CheckComRCReturnRC 2314 CheckComRCReturnRC(rc); 2315 2315 2316 2316 /* protect mpVM (if not NULL) */ … … 2324 2324 /* first, remove the given folder */ 2325 2325 rc = removeSharedFolder (aName); 2326 CheckComRCReturnRC 2326 CheckComRCReturnRC(rc); 2327 2327 2328 2328 /* first, remove the machine or the global folder if there is any */ … … 2352 2352 { 2353 2353 LogFlowThisFuncEnter(); 2354 LogFlowThisFunc 2354 LogFlowThisFunc(("aName='%ls' mMachineState=%08X\n", aName, mMachineState)); 2355 2355 2356 2356 CheckComArgNotNull(aName); 2357 2357 CheckComArgOutPointerValid(aProgress); 2358 2358 2359 AutoCaller autoCaller 2360 CheckComRCReturnRC 2361 2362 AutoWriteLock alock 2359 AutoCaller autoCaller(this); 2360 CheckComRCReturnRC(autoCaller.rc()); 2361 2362 AutoWriteLock alock(this); 2363 2363 2364 2364 if (Global::IsTransient (mMachineState)) … … 2376 2376 { 2377 2377 HRESULT rc = Pause(); 2378 CheckComRCReturnRC 2378 CheckComRCReturnRC(rc); 2379 2379 } 2380 2380 … … 2387 2387 * (only when creating a snapshot online) 2388 2388 */ 2389 ComObjPtr 2389 ComObjPtr<Progress> saveProgress; 2390 2390 if (takingSnapshotOnline) 2391 2391 { … … 2420 2420 2421 2421 Bstr stateFilePath; 2422 ComPtr 2422 ComPtr<IProgress> serverProgress; 2423 2423 2424 2424 /* … … 2451 2451 * (only when creating a snapshot online) 2452 2452 */ 2453 ComObjPtr 2453 ComObjPtr<CombinedProgress> combinedProgress; 2454 2454 if (takingSnapshotOnline) 2455 2455 { … … 2478 2478 } 2479 2479 2480 if (SUCCEEDED 2480 if (SUCCEEDED(rc)) 2481 2481 { 2482 2482 /* return the correct progress to the caller */ 2483 2483 if (combinedProgress) 2484 combinedProgress.queryInterfaceTo 2484 combinedProgress.queryInterfaceTo(aProgress); 2485 2485 else 2486 serverProgress.queryInterfaceTo 2486 serverProgress.queryInterfaceTo(aProgress); 2487 2487 } 2488 2488 } … … 2516 2516 } 2517 2517 2518 LogFlowThisFunc 2518 LogFlowThisFunc(("rc=%08X\n", rc)); 2519 2519 LogFlowThisFuncLeave(); 2520 2520 return rc; … … 2526 2526 CheckComArgOutPointerValid(aProgress); 2527 2527 2528 AutoCaller autoCaller 2529 CheckComRCReturnRC 2530 2531 AutoWriteLock alock 2528 AutoCaller autoCaller(this); 2529 CheckComRCReturnRC(autoCaller.rc()); 2530 2531 AutoWriteLock alock(this); 2532 2532 2533 2533 if (Global::IsOnlineOrTransient (mMachineState)) … … 2539 2539 MachineState_T machineState = MachineState_Null; 2540 2540 HRESULT rc = mControl->DiscardSnapshot (this, aId, &machineState, aProgress); 2541 CheckComRCReturnRC 2541 CheckComRCReturnRC(rc); 2542 2542 2543 2543 setMachineStateLocally (machineState); … … 2547 2547 STDMETHODIMP Console::DiscardCurrentState (IProgress **aProgress) 2548 2548 { 2549 AutoCaller autoCaller 2550 CheckComRCReturnRC 2551 2552 AutoWriteLock alock 2549 AutoCaller autoCaller(this); 2550 CheckComRCReturnRC(autoCaller.rc()); 2551 2552 AutoWriteLock alock(this); 2553 2553 2554 2554 if (Global::IsOnlineOrTransient (mMachineState)) … … 2560 2560 MachineState_T machineState = MachineState_Null; 2561 2561 HRESULT rc = mControl->DiscardCurrentState (this, &machineState, aProgress); 2562 CheckComRCReturnRC 2562 CheckComRCReturnRC(rc); 2563 2563 2564 2564 setMachineStateLocally (machineState); … … 2568 2568 STDMETHODIMP Console::DiscardCurrentSnapshotAndState (IProgress **aProgress) 2569 2569 { 2570 AutoCaller autoCaller 2571 CheckComRCReturnRC 2572 2573 AutoWriteLock alock 2570 AutoCaller autoCaller(this); 2571 CheckComRCReturnRC(autoCaller.rc()); 2572 2573 AutoWriteLock alock(this); 2574 2574 2575 2575 if (Global::IsOnlineOrTransient (mMachineState)) … … 2582 2582 HRESULT rc = 2583 2583 mControl->DiscardCurrentSnapshotAndState (this, &machineState, aProgress); 2584 CheckComRCReturnRC 2584 CheckComRCReturnRC(rc); 2585 2585 2586 2586 setMachineStateLocally (machineState); … … 2592 2592 CheckComArgNotNull(aCallback); 2593 2593 2594 AutoCaller autoCaller 2595 CheckComRCReturnRC 2594 AutoCaller autoCaller(this); 2595 CheckComRCReturnRC(autoCaller.rc()); 2596 2596 2597 2597 #if 0 /** @todo r=bird,r=pritesh: must check that the interface id match correct or we might screw up with old code! */ … … 2603 2603 #endif 2604 2604 2605 AutoWriteLock alock 2605 AutoWriteLock alock(this); 2606 2606 2607 2607 mCallbacks.push_back (CallbackList::value_type (aCallback)); … … 2641 2641 CheckComArgNotNull(aCallback); 2642 2642 2643 AutoCaller autoCaller 2644 CheckComRCReturnRC 2645 2646 AutoWriteLock alock 2643 AutoCaller autoCaller(this); 2644 CheckComRCReturnRC(autoCaller.rc()); 2645 2646 AutoWriteLock alock(this); 2647 2647 2648 2648 CallbackList::iterator it; … … 2670 2670 LogFlowThisFuncEnter(); 2671 2671 2672 AutoCaller autoCaller 2673 AssertComRCReturnRC 2672 AutoCaller autoCaller(this); 2673 AssertComRCReturnRC(autoCaller.rc()); 2674 2674 2675 2675 /* doDriveChange() needs a write lock */ 2676 AutoWriteLock alock 2676 AutoWriteLock alock(this); 2677 2677 2678 2678 /* Ignore callbacks when there's no VM around */ … … 2682 2682 /* protect mpVM */ 2683 2683 AutoVMCaller autoVMCaller (this); 2684 CheckComRCReturnRC 2684 CheckComRCReturnRC(autoVMCaller.rc()); 2685 2685 2686 2686 /* Get the current DVD state */ … … 2695 2695 && meDVDState == DriveState_NotMounted) 2696 2696 { 2697 LogFlowThisFunc 2697 LogFlowThisFunc(("Returns (NotMounted -> NotMounted)\n")); 2698 2698 return S_OK; 2699 2699 } … … 2706 2706 case DriveState_ImageMounted: 2707 2707 { 2708 ComPtr 2708 ComPtr<IDVDImage> ImagePtr; 2709 2709 rc = mDVDDrive->GetImage (ImagePtr.asOutParam()); 2710 if (SUCCEEDED 2710 if (SUCCEEDED(rc)) 2711 2711 rc = ImagePtr->COMGETTER(Location) (Path.asOutParam()); 2712 2712 break; … … 2715 2715 case DriveState_HostDriveCaptured: 2716 2716 { 2717 ComPtr 2717 ComPtr<IHostDVDDrive> DrivePtr; 2718 2718 BOOL enabled; 2719 2719 rc = mDVDDrive->GetHostDrive (DrivePtr.asOutParam()); 2720 if (SUCCEEDED 2720 if (SUCCEEDED(rc)) 2721 2721 rc = DrivePtr->COMGETTER (Name) (Path.asOutParam()); 2722 if (SUCCEEDED 2722 if (SUCCEEDED(rc)) 2723 2723 rc = mDVDDrive->COMGETTER (Passthrough) (&enabled); 2724 if (SUCCEEDED 2724 if (SUCCEEDED(rc)) 2725 2725 fPassthrough = !!enabled; 2726 2726 break; … … 2737 2737 2738 2738 AssertComRC (rc); 2739 if (SUCCEEDED 2739 if (SUCCEEDED(rc)) 2740 2740 { 2741 2741 rc = doDriveChange ("piix3ide", 0, 2, eState, &meDVDState, … … 2743 2743 2744 2744 /* notify console callbacks on success */ 2745 if (SUCCEEDED 2745 if (SUCCEEDED(rc)) 2746 2746 { 2747 2747 CallbackList::iterator it = mCallbacks.begin(); … … 2751 2751 } 2752 2752 2753 LogFlowThisFunc 2753 LogFlowThisFunc(("Returns %Rhrc (%#x)\n", rc, rc)); 2754 2754 LogFlowThisFuncLeave(); 2755 2755 return rc; … … 2766 2766 LogFlowThisFuncEnter(); 2767 2767 2768 AutoCaller autoCaller 2769 AssertComRCReturnRC 2768 AutoCaller autoCaller(this); 2769 AssertComRCReturnRC(autoCaller.rc()); 2770 2770 2771 2771 /* doDriveChange() needs a write lock */ 2772 AutoWriteLock alock 2772 AutoWriteLock alock(this); 2773 2773 2774 2774 /* Ignore callbacks when there's no VM around */ … … 2778 2778 /* protect mpVM */ 2779 2779 AutoVMCaller autoVMCaller (this); 2780 CheckComRCReturnRC 2780 CheckComRCReturnRC(autoVMCaller.rc()); 2781 2781 2782 2782 /* Get the current floppy state */ … … 2802 2802 && meFloppyState == DriveState_NotMounted) 2803 2803 { 2804 LogFlowThisFunc 2804 LogFlowThisFunc(("Returns (NotMounted -> NotMounted)\n")); 2805 2805 return S_OK; 2806 2806 } … … 2814 2814 ComPtr<IFloppyImage> ImagePtr; 2815 2815 rc = mFloppyDrive->GetImage (ImagePtr.asOutParam()); 2816 if (SUCCEEDED 2816 if (SUCCEEDED(rc)) 2817 2817 rc = ImagePtr->COMGETTER(Location) (Path.asOutParam()); 2818 2818 break; … … 2821 2821 case DriveState_HostDriveCaptured: 2822 2822 { 2823 ComPtr 2823 ComPtr<IHostFloppyDrive> DrivePtr; 2824 2824 rc = mFloppyDrive->GetHostDrive (DrivePtr.asOutParam()); 2825 if (SUCCEEDED 2825 if (SUCCEEDED(rc)) 2826 2826 rc = DrivePtr->COMGETTER (Name) (Path.asOutParam()); 2827 2827 break; … … 2838 2838 2839 2839 AssertComRC (rc); 2840 if (SUCCEEDED 2840 if (SUCCEEDED(rc)) 2841 2841 { 2842 2842 rc = doDriveChange ("i82078", 0, 0, eState, &meFloppyState, … … 2844 2844 2845 2845 /* notify console callbacks on success */ 2846 if (SUCCEEDED 2846 if (SUCCEEDED(rc)) 2847 2847 { 2848 2848 CallbackList::iterator it = mCallbacks.begin(); … … 2852 2852 } 2853 2853 2854 LogFlowThisFunc 2854 LogFlowThisFunc(("Returns %Rhrc (%#x)\n", rc, rc)); 2855 2855 LogFlowThisFuncLeave(); 2856 2856 return rc; … … 2880 2880 DriveState_T *peState, const char *pszPath, bool fPassthrough) 2881 2881 { 2882 LogFlowThisFunc 2882 LogFlowThisFunc(("pszDevice=%p:{%s} uInstance=%u uLun=%u eState=%d " 2883 2883 "peState=%p:{%d} pszPath=%p:{%s} fPassthrough=%d\n", 2884 2884 pszDevice, pszDevice, uInstance, uLun, eState, 2885 2885 peState, *peState, pszPath, pszPath, fPassthrough)); 2886 2886 2887 AutoCaller autoCaller 2888 AssertComRCReturnRC 2887 AutoCaller autoCaller(this); 2888 AssertComRCReturnRC(autoCaller.rc()); 2889 2889 2890 2890 /* We will need to release the write lock before calling EMT */ 2891 AutoWriteLock alock 2891 AutoWriteLock alock(this); 2892 2892 2893 2893 /* protect mpVM */ 2894 2894 AutoVMCaller autoVMCaller (this); 2895 CheckComRCReturnRC 2895 CheckComRCReturnRC(autoVMCaller.rc()); 2896 2896 2897 2897 /* … … 2924 2924 if (VBOX_SUCCESS (vrc)) 2925 2925 { 2926 LogFlowThisFunc 2926 LogFlowThisFunc(("Returns S_OK\n")); 2927 2927 return S_OK; 2928 2928 } … … 2967 2967 peState, *peState, pszPath, pszPath, fPassthrough)); 2968 2968 2969 AssertReturn 2969 AssertReturn(pThis, VERR_INVALID_PARAMETER); 2970 2970 2971 2971 AssertMsg ( (!strcmp (pszDevice, "i82078") && uLun == 0 && uInstance == 0) … … 2973 2973 ("pszDevice=%s uLun=%d uInstance=%d\n", pszDevice, uLun, uInstance)); 2974 2974 2975 AutoCaller autoCaller 2975 AutoCaller autoCaller(pThis); 2976 2976 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 2977 2977 2978 2978 /* protect mpVM */ 2979 2979 AutoVMCaller autoVMCaller (pThis); 2980 CheckComRCReturnRC 2980 CheckComRCReturnRC(autoVMCaller.rc()); 2981 2981 2982 2982 PVM pVM = pThis->mpVM; … … 3027 3027 peState). 3028 3028 */ 3029 AutoWriteLock alock 3029 AutoWriteLock alock(pThis); 3030 3030 3031 3031 do … … 3275 3275 HRESULT Console::onNetworkAdapterChange (INetworkAdapter *aNetworkAdapter) 3276 3276 { 3277 LogFlowThisFunc 3278 3279 AutoCaller autoCaller 3280 AssertComRCReturnRC 3281 3282 AutoWriteLock alock 3277 LogFlowThisFunc(("\n")); 3278 3279 AutoCaller autoCaller(this); 3280 AssertComRCReturnRC(autoCaller.rc()); 3281 3282 AutoWriteLock alock(this); 3283 3283 3284 3284 /* Don't do anything if the VM isn't running */ … … 3288 3288 /* protect mpVM */ 3289 3289 AutoVMCaller autoVMCaller (this); 3290 CheckComRCReturnRC 3290 CheckComRCReturnRC(autoVMCaller.rc()); 3291 3291 3292 3292 #ifdef VBOX_DYNAMIC_NET_ATTACH … … 3318 3318 rc = aNetworkAdapter->COMGETTER(Slot) (&ulInstance); 3319 3319 AssertComRC (rc); 3320 if (SUCCEEDED 3320 if (SUCCEEDED(rc)) 3321 3321 { 3322 3322 /* … … 3406 3406 3407 3407 /* notify console callbacks on success */ 3408 if (SUCCEEDED 3408 if (SUCCEEDED(rc)) 3409 3409 { 3410 3410 CallbackList::iterator it = mCallbacks.begin(); … … 3413 3413 } 3414 3414 3415 LogFlowThisFunc 3415 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 3416 3416 return rc; 3417 3417 } … … 3436 3436 INetworkAdapter *aNetworkAdapter) 3437 3437 { 3438 LogFlowThisFunc 3438 LogFlowThisFunc(("pszDevice=%p:{%s} uInstance=%u uLun=%u aNetworkAdapter=%p\n", 3439 3439 pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter)); 3440 3440 3441 AutoCaller autoCaller 3442 AssertComRCReturnRC 3441 AutoCaller autoCaller(this); 3442 AssertComRCReturnRC(autoCaller.rc()); 3443 3443 3444 3444 /* We will need to release the write lock before calling EMT */ 3445 AutoWriteLock alock 3445 AutoWriteLock alock(this); 3446 3446 3447 3447 /* protect mpVM */ 3448 3448 AutoVMCaller autoVMCaller (this); 3449 CheckComRCReturnRC 3449 CheckComRCReturnRC(autoVMCaller.rc()); 3450 3450 3451 3451 /* … … 3473 3473 if (VBOX_SUCCESS (vrc)) 3474 3474 { 3475 LogFlowThisFunc 3475 LogFlowThisFunc(("Returns S_OK\n")); 3476 3476 return S_OK; 3477 3477 } … … 3505 3505 pThis, pszDevice, pszDevice, uInstance, uLun, aNetworkAdapter)); 3506 3506 3507 AssertReturn 3507 AssertReturn(pThis, VERR_INVALID_PARAMETER); 3508 3508 3509 3509 AssertMsg ( (!strcmp (pszDevice, "pcnet") && uLun == 0 && uInstance < SchemaDefs::NetworkAdapterCount) … … 3512 3512 Log(("pszDevice=%s uLun=%d uInstance=%d\n", pszDevice, uLun, uInstance)); 3513 3513 3514 AutoCaller autoCaller 3514 AutoCaller autoCaller(pThis); 3515 3515 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 3516 3516 3517 3517 /* protect mpVM */ 3518 3518 AutoVMCaller autoVMCaller (pThis); 3519 CheckComRCReturnRC 3519 CheckComRCReturnRC(autoVMCaller.rc()); 3520 3520 3521 3521 PVM pVM = pThis->mpVM; … … 3607 3607 HRESULT Console::onSerialPortChange (ISerialPort *aSerialPort) 3608 3608 { 3609 LogFlowThisFunc 3610 3611 AutoCaller autoCaller 3612 AssertComRCReturnRC 3613 3614 AutoWriteLock alock 3609 LogFlowThisFunc(("\n")); 3610 3611 AutoCaller autoCaller(this); 3612 AssertComRCReturnRC(autoCaller.rc()); 3613 3614 AutoWriteLock alock(this); 3615 3615 3616 3616 /* Don't do anything if the VM isn't running */ … … 3622 3622 /* protect mpVM */ 3623 3623 AutoVMCaller autoVMCaller (this); 3624 CheckComRCReturnRC 3624 CheckComRCReturnRC(autoVMCaller.rc()); 3625 3625 3626 3626 /* nothing to do so far */ 3627 3627 3628 3628 /* notify console callbacks on success */ 3629 if (SUCCEEDED 3629 if (SUCCEEDED(rc)) 3630 3630 { 3631 3631 CallbackList::iterator it = mCallbacks.begin(); … … 3634 3634 } 3635 3635 3636 LogFlowThisFunc 3636 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 3637 3637 return rc; 3638 3638 } … … 3645 3645 HRESULT Console::onParallelPortChange (IParallelPort *aParallelPort) 3646 3646 { 3647 LogFlowThisFunc 3648 3649 AutoCaller autoCaller 3650 AssertComRCReturnRC 3651 3652 AutoWriteLock alock 3647 LogFlowThisFunc(("\n")); 3648 3649 AutoCaller autoCaller(this); 3650 AssertComRCReturnRC(autoCaller.rc()); 3651 3652 AutoWriteLock alock(this); 3653 3653 3654 3654 /* Don't do anything if the VM isn't running */ … … 3660 3660 /* protect mpVM */ 3661 3661 AutoVMCaller autoVMCaller (this); 3662 CheckComRCReturnRC 3662 CheckComRCReturnRC(autoVMCaller.rc()); 3663 3663 3664 3664 /* nothing to do so far */ 3665 3665 3666 3666 /* notify console callbacks on success */ 3667 if (SUCCEEDED 3667 if (SUCCEEDED(rc)) 3668 3668 { 3669 3669 CallbackList::iterator it = mCallbacks.begin(); … … 3672 3672 } 3673 3673 3674 LogFlowThisFunc 3674 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 3675 3675 return rc; 3676 3676 } … … 3683 3683 HRESULT Console::onStorageControllerChange () 3684 3684 { 3685 LogFlowThisFunc 3686 3687 AutoCaller autoCaller 3688 AssertComRCReturnRC 3689 3690 AutoWriteLock alock 3685 LogFlowThisFunc(("\n")); 3686 3687 AutoCaller autoCaller(this); 3688 AssertComRCReturnRC(autoCaller.rc()); 3689 3690 AutoWriteLock alock(this); 3691 3691 3692 3692 /* Don't do anything if the VM isn't running */ … … 3698 3698 /* protect mpVM */ 3699 3699 AutoVMCaller autoVMCaller (this); 3700 CheckComRCReturnRC 3700 CheckComRCReturnRC(autoVMCaller.rc()); 3701 3701 3702 3702 /* nothing to do so far */ 3703 3703 3704 3704 /* notify console callbacks on success */ 3705 if (SUCCEEDED 3705 if (SUCCEEDED(rc)) 3706 3706 { 3707 3707 CallbackList::iterator it = mCallbacks.begin(); … … 3710 3710 } 3711 3711 3712 LogFlowThisFunc 3712 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 3713 3713 return rc; 3714 3714 } … … 3721 3721 HRESULT Console::onVRDPServerChange() 3722 3722 { 3723 AutoCaller autoCaller 3724 AssertComRCReturnRC 3725 3726 AutoWriteLock alock 3723 AutoCaller autoCaller(this); 3724 AssertComRCReturnRC(autoCaller.rc()); 3725 3726 AutoWriteLock alock(this); 3727 3727 3728 3728 HRESULT rc = S_OK; … … 3763 3763 3764 3764 /* notify console callbacks on success */ 3765 if (SUCCEEDED 3765 if (SUCCEEDED(rc)) 3766 3766 { 3767 3767 CallbackList::iterator it = mCallbacks.begin(); … … 3780 3780 HRESULT Console::onUSBControllerChange() 3781 3781 { 3782 LogFlowThisFunc 3783 3784 AutoCaller autoCaller 3785 AssertComRCReturnRC 3786 3787 AutoWriteLock alock 3782 LogFlowThisFunc(("\n")); 3783 3784 AutoCaller autoCaller(this); 3785 AssertComRCReturnRC(autoCaller.rc()); 3786 3787 AutoWriteLock alock(this); 3788 3788 3789 3789 /* Ignore if no VM is running yet. */ … … 3802 3802 // /* protect mpVM */ 3803 3803 // AutoVMCaller autoVMCaller (this); 3804 // CheckComRCReturnRC 3804 // CheckComRCReturnRC(autoVMCaller.rc()); 3805 3805 3806 3806 /* notify console callbacks on success */ 3807 if (SUCCEEDED 3807 if (SUCCEEDED(rc)) 3808 3808 { 3809 3809 CallbackList::iterator it = mCallbacks.begin(); … … 3822 3822 HRESULT Console::onSharedFolderChange (BOOL aGlobal) 3823 3823 { 3824 LogFlowThisFunc 3825 3826 AutoCaller autoCaller 3827 AssertComRCReturnRC 3828 3829 AutoWriteLock alock 3824 LogFlowThisFunc(("aGlobal=%RTbool\n", aGlobal)); 3825 3826 AutoCaller autoCaller(this); 3827 AssertComRCReturnRC(autoCaller.rc()); 3828 3829 AutoWriteLock alock(this); 3830 3830 3831 3831 HRESULT rc = fetchSharedFolders (aGlobal); 3832 3832 3833 3833 /* notify console callbacks on success */ 3834 if (SUCCEEDED 3834 if (SUCCEEDED(rc)) 3835 3835 { 3836 3836 CallbackList::iterator it = mCallbacks.begin(); … … 3861 3861 { 3862 3862 #ifdef VBOX_WITH_USB 3863 LogFlowThisFunc 3864 3865 AutoCaller autoCaller 3863 LogFlowThisFunc(("aDevice=%p aError=%p\n", aDevice, aError)); 3864 3865 AutoCaller autoCaller(this); 3866 3866 ComAssertComRCRetRC (autoCaller.rc()); 3867 3867 3868 AutoWriteLock alock 3868 AutoWriteLock alock(this); 3869 3869 3870 3870 /* protect mpVM (we don't need error info, since it's a callback) */ … … 3875 3875 * (e.g. it may be Saving or Stopping or just PoweredOff) -- 3876 3876 * autoVMCaller.rc() will return a failure in this case. */ 3877 LogFlowThisFunc 3877 LogFlowThisFunc(("Attach request ignored (mMachineState=%d).\n", 3878 3878 mMachineState)); 3879 3879 return autoVMCaller.rc(); … … 3890 3890 if (!PDMR3USBHasHub (mpVM)) 3891 3891 { 3892 LogFlowThisFunc 3892 LogFlowThisFunc(("Attach request ignored (no USB controller).\n")); 3893 3893 return E_FAIL; 3894 3894 } … … 3900 3900 com::ErrorInfoKeeper eik; 3901 3901 /* the error must be a VirtualBoxErrorInfo instance */ 3902 ComPtr 3902 ComPtr<IVirtualBoxErrorInfo> error = eik.takeError(); 3903 3903 Assert (!error.isNull()); 3904 3904 if (!error.isNull()) … … 3927 3927 #ifdef VBOX_WITH_USB 3928 3928 Guid Uuid (aId); 3929 LogFlowThisFunc 3930 3931 AutoCaller autoCaller 3932 AssertComRCReturnRC 3933 3934 AutoWriteLock alock 3929 LogFlowThisFunc(("aId={%RTuuid} aError=%p\n", Uuid.raw(), aError)); 3930 3931 AutoCaller autoCaller(this); 3932 AssertComRCReturnRC(autoCaller.rc()); 3933 3934 AutoWriteLock alock(this); 3935 3935 3936 3936 /* Find the device. */ 3937 ComObjPtr 3937 ComObjPtr<OUSBDevice> device; 3938 3938 USBDeviceList::iterator it = mUSBDevices.begin(); 3939 3939 while (it != mUSBDevices.end()) 3940 3940 { 3941 LogFlowThisFunc 3941 LogFlowThisFunc(("it={%RTuuid}\n", (*it)->id().raw())); 3942 3942 if ((*it)->id() == Uuid) 3943 3943 { … … 3951 3951 if (device.isNull()) 3952 3952 { 3953 LogFlowThisFunc 3953 LogFlowThisFunc(("USB device not found.\n")); 3954 3954 3955 3955 /* The VM may be no more operational when this message arrives … … 3961 3961 if (FAILED (autoVMCaller.rc())) 3962 3962 { 3963 LogFlowThisFunc 3963 LogFlowThisFunc(("Detach request ignored (mMachineState=%d).\n", 3964 3964 mMachineState)); 3965 3965 return autoVMCaller.rc(); … … 3984 3984 com::ErrorInfoKeeper eik; 3985 3985 /* the error must be a VirtualBoxErrorInfo instance */ 3986 ComPtr 3986 ComPtr<IVirtualBoxErrorInfo> error = eik.takeError(); 3987 3987 Assert (!error.isNull()); 3988 3988 if (!error.isNull()) … … 4018 4018 return E_POINTER; 4019 4019 4020 AutoCaller autoCaller 4021 AssertComRCReturnRC 4020 AutoCaller autoCaller(this); 4021 AssertComRCReturnRC(autoCaller.rc()); 4022 4022 4023 4023 /* protect mpVM (if not NULL) */ 4024 4024 AutoVMCallerWeak autoVMCaller (this); 4025 CheckComRCReturnRC 4025 CheckComRCReturnRC(autoVMCaller.rc()); 4026 4026 4027 4027 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 4049 4049 AssertLogRel (vrc != VERR_BUFFER_OVERFLOW); 4050 4050 AssertLogRel (RT_FAILURE(vrc) || VBOX_HGCM_SVC_PARM_64BIT == parm[2].type); 4051 if (RT_SUCCESS 4051 if (RT_SUCCESS(vrc) || (VERR_NOT_FOUND == vrc)) 4052 4052 { 4053 4053 rc = S_OK; … … 4092 4092 return E_INVALIDARG; 4093 4093 4094 AutoCaller autoCaller 4095 AssertComRCReturnRC 4094 AutoCaller autoCaller(this); 4095 AssertComRCReturnRC(autoCaller.rc()); 4096 4096 4097 4097 /* protect mpVM (if not NULL) */ 4098 4098 AutoVMCallerWeak autoVMCaller (this); 4099 CheckComRCReturnRC 4099 CheckComRCReturnRC(autoVMCaller.rc()); 4100 4100 4101 4101 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 4138 4138 vrc = mVMMDev->hgcmHostCall ("VBoxGuestPropSvc", DEL_PROP_HOST, 4139 4139 1, &parm[0]); 4140 if (RT_SUCCESS 4140 if (RT_SUCCESS(vrc)) 4141 4141 rc = S_OK; 4142 4142 else … … 4162 4162 if (!VALID_PTR (aPatterns) && (aPatterns != NULL)) 4163 4163 return E_POINTER; 4164 if (ComSafeArrayOutIsNull 4164 if (ComSafeArrayOutIsNull(aNames)) 4165 4165 return E_POINTER; 4166 if (ComSafeArrayOutIsNull 4166 if (ComSafeArrayOutIsNull(aValues)) 4167 4167 return E_POINTER; 4168 if (ComSafeArrayOutIsNull 4168 if (ComSafeArrayOutIsNull(aTimestamps)) 4169 4169 return E_POINTER; 4170 if (ComSafeArrayOutIsNull 4170 if (ComSafeArrayOutIsNull(aFlags)) 4171 4171 return E_POINTER; 4172 4172 4173 AutoCaller autoCaller 4174 AssertComRCReturnRC 4173 AutoCaller autoCaller(this); 4174 AssertComRCReturnRC(autoCaller.rc()); 4175 4175 4176 4176 /* protect mpVM (if not NULL) */ 4177 4177 AutoVMCallerWeak autoVMCaller (this); 4178 CheckComRCReturnRC 4178 CheckComRCReturnRC(autoVMCaller.rc()); 4179 4179 4180 4180 /* Note: validity of mVMMDev which is bound to uninit() is guaranteed by … … 4198 4198 HRESULT Console::updateMachineState (MachineState_T aMachineState) 4199 4199 { 4200 AutoCaller autoCaller 4201 AssertComRCReturnRC 4202 4203 AutoWriteLock alock 4204 4205 AssertReturn 4200 AutoCaller autoCaller(this); 4201 AssertComRCReturnRC(autoCaller.rc()); 4202 4203 AutoWriteLock alock(this); 4204 4205 AssertReturn(mMachineState == MachineState_Saving || 4206 4206 mMachineState == MachineState_Discarding, 4207 4207 E_FAIL); … … 4220 4220 #if 0 4221 4221 LogFlowThisFuncEnter(); 4222 LogFlowThisFunc 4222 LogFlowThisFunc(("fVisible=%d, fAlpha=%d, xHot = %d, yHot = %d, width=%d, " 4223 4223 "height=%d, shape=%p\n", 4224 4224 fVisible, fAlpha, xHot, yHot, width, height, pShape)); 4225 4225 #endif 4226 4226 4227 AutoCaller autoCaller 4227 AutoCaller autoCaller(this); 4228 4228 AssertComRCReturnVoid (autoCaller.rc()); 4229 4229 4230 4230 /* We need a write lock because we alter the cached callback data */ 4231 AutoWriteLock alock 4231 AutoWriteLock alock(this); 4232 4232 4233 4233 /* Save the callback arguments */ … … 4289 4289 void Console::onMouseCapabilityChange (BOOL supportsAbsolute, BOOL needsHostCursor) 4290 4290 { 4291 LogFlowThisFunc 4291 LogFlowThisFunc(("supportsAbsolute=%d needsHostCursor=%d\n", 4292 4292 supportsAbsolute, needsHostCursor)); 4293 4293 4294 AutoCaller autoCaller 4294 AutoCaller autoCaller(this); 4295 4295 AssertComRCReturnVoid (autoCaller.rc()); 4296 4296 4297 4297 /* We need a write lock because we alter the cached callback data */ 4298 AutoWriteLock alock 4298 AutoWriteLock alock(this); 4299 4299 4300 4300 /* save the callback arguments */ … … 4316 4316 void Console::onStateChange (MachineState_T machineState) 4317 4317 { 4318 AutoCaller autoCaller 4318 AutoCaller autoCaller(this); 4319 4319 AssertComRCReturnVoid (autoCaller.rc()); 4320 4320 4321 AutoReadLock alock 4321 AutoReadLock alock(this); 4322 4322 4323 4323 CallbackList::iterator it = mCallbacks.begin(); … … 4331 4331 void Console::onAdditionsStateChange() 4332 4332 { 4333 AutoCaller autoCaller 4333 AutoCaller autoCaller(this); 4334 4334 AssertComRCReturnVoid (autoCaller.rc()); 4335 4335 4336 AutoReadLock alock 4336 AutoReadLock alock(this); 4337 4337 4338 4338 CallbackList::iterator it = mCallbacks.begin(); … … 4346 4346 void Console::onAdditionsOutdated() 4347 4347 { 4348 AutoCaller autoCaller 4348 AutoCaller autoCaller(this); 4349 4349 AssertComRCReturnVoid (autoCaller.rc()); 4350 4350 4351 AutoReadLock alock 4351 AutoReadLock alock(this); 4352 4352 4353 4353 /** @todo Use the On-Screen Display feature to report the fact. … … 4363 4363 void Console::onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock) 4364 4364 { 4365 AutoCaller autoCaller 4365 AutoCaller autoCaller(this); 4366 4366 AssertComRCReturnVoid (autoCaller.rc()); 4367 4367 4368 4368 /* We need a write lock because we alter the cached callback data */ 4369 AutoWriteLock alock 4369 AutoWriteLock alock(this); 4370 4370 4371 4371 /* save the callback arguments */ … … 4386 4386 IVirtualBoxErrorInfo *aError) 4387 4387 { 4388 AutoCaller autoCaller 4388 AutoCaller autoCaller(this); 4389 4389 AssertComRCReturnVoid (autoCaller.rc()); 4390 4390 4391 AutoReadLock alock 4391 AutoReadLock alock(this); 4392 4392 4393 4393 CallbackList::iterator it = mCallbacks.begin(); … … 4401 4401 void Console::onRuntimeError (BOOL aFatal, IN_BSTR aErrorID, IN_BSTR aMessage) 4402 4402 { 4403 AutoCaller autoCaller 4403 AutoCaller autoCaller(this); 4404 4404 AssertComRCReturnVoid (autoCaller.rc()); 4405 4405 4406 AutoReadLock alock 4406 AutoReadLock alock(this); 4407 4407 4408 4408 CallbackList::iterator it = mCallbacks.begin(); … … 4416 4416 HRESULT Console::onShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId) 4417 4417 { 4418 AssertReturn 4419 AssertReturn 4418 AssertReturn(aCanShow, E_POINTER); 4419 AssertReturn(aWinId, E_POINTER); 4420 4420 4421 4421 *aCanShow = FALSE; 4422 4422 *aWinId = 0; 4423 4423 4424 AutoCaller autoCaller 4425 AssertComRCReturnRC 4426 4427 AutoReadLock alock 4424 AutoCaller autoCaller(this); 4425 AssertComRCReturnRC(autoCaller.rc()); 4426 4427 AutoReadLock alock(this); 4428 4428 4429 4429 HRESULT rc = S_OK; … … 4491 4491 { 4492 4492 AutoCaller autoCaller (this); 4493 AssertComRCReturnRC 4494 4495 AutoWriteLock alock 4493 AssertComRCReturnRC(autoCaller.rc()); 4494 4495 AutoWriteLock alock(this); 4496 4496 4497 4497 if (mVMDestroying) … … 4527 4527 AssertComRCReturnVoid (autoCaller.rc()); 4528 4528 4529 AutoWriteLock alock 4529 AutoWriteLock alock(this); 4530 4530 4531 4531 AssertReturnVoid (mpVM != NULL); … … 4547 4547 * Note that the logic must be in sync with Machine::DeleteSettings(). 4548 4548 */ 4549 HRESULT Console::consoleInitReleaseLog (const ComPtr 4549 HRESULT Console::consoleInitReleaseLog (const ComPtr<IMachine> aMachine) 4550 4550 { 4551 4551 HRESULT hrc = S_OK; … … 4553 4553 Bstr logFolder; 4554 4554 hrc = aMachine->COMGETTER(LogFolder) (logFolder.asOutParam()); 4555 CheckComRCReturnRC 4555 CheckComRCReturnRC(hrc); 4556 4556 4557 4557 Utf8Str logDir = logFolder; … … 4574 4574 ComPtr<IVirtualBox> virtualBox; 4575 4575 aMachine->COMGETTER(Parent)(virtualBox.asOutParam()); 4576 ComPtr 4576 ComPtr<ISystemProperties> systemProperties; 4577 4577 virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); 4578 4578 ULONG uLogHistoryCount = 3; 4579 4579 systemProperties->COMGETTER(LogHistoryCount)(&uLogHistoryCount); 4580 ComPtr 4580 ComPtr<IHost> host; 4581 4581 virtualBox->COMGETTER(Host)(host.asOutParam()); 4582 4582 ULONG uHostRamMb = 0, uHostRamAvailMb = 0; … … 4685 4685 4686 4686 LogFlowThisFuncEnter(); 4687 LogFlowThisFunc 4688 4689 AutoCaller autoCaller 4690 CheckComRCReturnRC 4691 4692 AutoWriteLock alock 4687 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 4688 4689 AutoCaller autoCaller(this); 4690 CheckComRCReturnRC(autoCaller.rc()); 4691 4692 AutoWriteLock alock(this); 4693 4693 4694 4694 if (Global::IsOnlineOrTransient (mMachineState)) … … 4747 4747 /* Read console data stored in the saved state file (if not yet done) */ 4748 4748 rc = loadDataFromSavedState(); 4749 CheckComRCReturnRC 4749 CheckComRCReturnRC(rc); 4750 4750 4751 4751 /* Check all types of shared folders and compose a single list */ … … 4776 4776 { 4777 4777 rc = mMachine->COMGETTER(StateFilePath) (savedStateFile.asOutParam()); 4778 CheckComRCReturnRC 4778 CheckComRCReturnRC(rc); 4779 4779 ComAssertRet (!!savedStateFile, E_FAIL); 4780 4780 int vrc = SSMR3ValidateFile (Utf8Str (savedStateFile), false /* fChecksumIt */); … … 4787 4787 4788 4788 /* create a progress object to track progress of this operation */ 4789 ComObjPtr 4789 ComObjPtr<Progress> powerupProgress; 4790 4790 powerupProgress.createObject(); 4791 4791 Bstr progressDesc; … … 4796 4796 rc = powerupProgress->init (static_cast <IConsole *> (this), 4797 4797 progressDesc, FALSE /* aCancelable */); 4798 CheckComRCReturnRC 4798 CheckComRCReturnRC(rc); 4799 4799 4800 4800 /* setup task object and thread to carry out the operation … … 4813 4813 /* Reset differencing hard disks for which autoReset is true */ 4814 4814 { 4815 com::SafeIfaceArray 4815 com::SafeIfaceArray<IHardDiskAttachment> atts; 4816 4816 rc = mMachine-> 4817 4817 COMGETTER(HardDiskAttachments) (ComSafeArrayAsOutParam (atts)); 4818 CheckComRCReturnRC 4818 CheckComRCReturnRC(rc); 4819 4819 4820 4820 for (size_t i = 0; i < atts.size(); ++ i) 4821 4821 { 4822 ComPtr 4822 ComPtr<IHardDisk> hardDisk; 4823 4823 rc = atts [i]->COMGETTER(HardDisk) (hardDisk.asOutParam()); 4824 CheckComRCReturnRC 4824 CheckComRCReturnRC(rc); 4825 4825 4826 4826 /* save for later use on the powerup thread */ … … 4830 4830 BOOL autoReset = FALSE; 4831 4831 rc = hardDisk->COMGETTER(AutoReset)(&autoReset); 4832 CheckComRCReturnRC 4832 CheckComRCReturnRC(rc); 4833 4833 4834 4834 if (autoReset) 4835 4835 { 4836 ComPtr 4836 ComPtr<IProgress> resetProgress; 4837 4837 rc = hardDisk->Reset (resetProgress.asOutParam()); 4838 CheckComRCReturnRC 4838 CheckComRCReturnRC(rc); 4839 4839 4840 4840 /* save for later use on the powerup thread */ … … 4845 4845 4846 4846 rc = consoleInitReleaseLog (mMachine); 4847 CheckComRCReturnRC 4847 CheckComRCReturnRC(rc); 4848 4848 4849 4849 /* pass the progress object to the caller if requested */ … … 4854 4854 /* there are no other operations to track, return the powerup 4855 4855 * progress only */ 4856 powerupProgress.queryInterfaceTo 4856 powerupProgress.queryInterfaceTo(aProgress); 4857 4857 } 4858 4858 else 4859 4859 { 4860 4860 /* create a combined progress object */ 4861 ComObjPtr 4861 ComObjPtr<CombinedProgress> progress; 4862 4862 progress.createObject(); 4863 4863 VMPowerUpTask::ProgressList progresses (task->hardDiskProgresses); 4864 progresses.push_back (ComPtr 4864 progresses.push_back (ComPtr<IProgress> (powerupProgress)); 4865 4865 rc = progress->init (static_cast <IConsole *> (this), 4866 4866 progressDesc, progresses.begin(), 4867 4867 progresses.end()); 4868 AssertComRCReturnRC 4869 progress.queryInterfaceTo 4868 AssertComRCReturnRC(rc); 4869 progress.queryInterfaceTo(aProgress); 4870 4870 } 4871 4871 } … … 4889 4889 setMachineState (MachineState_Starting); 4890 4890 4891 LogFlowThisFunc 4891 LogFlowThisFunc(("mMachineState=%d\n", mMachineState)); 4892 4892 LogFlowThisFuncLeave(); 4893 4893 return S_OK; … … 4926 4926 LogFlowThisFuncEnter(); 4927 4927 4928 AutoCaller autoCaller 4929 AssertComRCReturnRC 4930 4931 AutoWriteLock alock 4928 AutoCaller autoCaller(this); 4929 AssertComRCReturnRC(autoCaller.rc()); 4930 4931 AutoWriteLock alock(this); 4932 4932 4933 4933 /* Total # of steps for the progress object. Must correspond to the … … 4987 4987 if (mConsoleVRDPServer) 4988 4988 { 4989 LogFlowThisFunc 4989 LogFlowThisFunc(("Stopping VRDP server...\n")); 4990 4990 4991 4991 /* Leave the lock since EMT will call us back as addVMCaller() … … 5007 5007 5008 5008 /* Save all guest property store entries to the machine XML file */ 5009 com::SafeArray 5010 com::SafeArray 5011 com::SafeArray 5012 com::SafeArray 5009 com::SafeArray<BSTR> namesOut; 5010 com::SafeArray<BSTR> valuesOut; 5011 com::SafeArray<ULONG64> timestampsOut; 5012 com::SafeArray<BSTR> flagsOut; 5013 5013 Bstr pattern(""); 5014 5014 if (pattern.isNull()) … … 5041 5041 } 5042 5042 } 5043 com::SafeArray 5044 com::SafeArray 5045 com::SafeArray 5046 com::SafeArray 5043 com::SafeArray<BSTR> namesIn (names); 5044 com::SafeArray<BSTR> valuesIn (values); 5045 com::SafeArray<ULONG64> timestampsIn (timestamps); 5046 com::SafeArray<BSTR> flagsIn (flags); 5047 5047 if ( namesIn.isNull() 5048 5048 || valuesIn.isNull() … … 5075 5075 if (mVMMDev) 5076 5076 { 5077 LogFlowThisFunc 5077 LogFlowThisFunc(("Shutdown HGCM...\n")); 5078 5078 5079 5079 /* Leave the lock since EMT will call us back as addVMCaller() */ … … 5106 5106 RTSemEventCreate (&mVMZeroCallersSem); 5107 5107 5108 LogFlowThisFunc 5108 LogFlowThisFunc(("Waiting for mpVM callers (%d) to drop to zero...\n", 5109 5109 mVMCallers)); 5110 5110 … … 5125 5125 if (!mVMPoweredOff) 5126 5126 { 5127 LogFlowThisFunc 5127 LogFlowThisFunc(("Powering off the VM...\n")); 5128 5128 5129 5129 /* Leave the lock since EMT will call us back on VMR3PowerOff() */ … … 5149 5149 aProgress->setCurrentOperationProgress(99 * (++ step) / StepCount ); 5150 5150 5151 LogFlowThisFunc 5151 LogFlowThisFunc(("Ready for VM destruction.\n")); 5152 5152 5153 5153 /* If we are called from Console::uninit(), then try to destroy the VM even … … 5180 5180 mpVM = NULL; 5181 5181 5182 LogFlowThisFunc 5182 LogFlowThisFunc(("Destroying the VM...\n")); 5183 5183 5184 5184 alock.leave(); … … 5195 5195 if (VBOX_SUCCESS (vrc)) 5196 5196 { 5197 LogFlowThisFunc 5197 LogFlowThisFunc(("Machine has been destroyed (mMachineState=%d)\n", 5198 5198 mMachineState)); 5199 5199 /* Note: the Console-level machine state change happens on the … … 5234 5234 mVMDestroying = false; 5235 5235 5236 if (SUCCEEDED 5236 if (SUCCEEDED(rc)) 5237 5237 { 5238 5238 /* uninit dynamically allocated members of mCallbackData */ … … 5259 5259 bool aUpdateServer /* = true */) 5260 5260 { 5261 AutoCaller autoCaller 5262 AssertComRCReturnRC 5263 5264 AutoWriteLock alock 5261 AutoCaller autoCaller(this); 5262 AssertComRCReturnRC(autoCaller.rc()); 5263 5264 AutoWriteLock alock(this); 5265 5265 5266 5266 HRESULT rc = S_OK; … … 5268 5268 if (mMachineState != aMachineState) 5269 5269 { 5270 LogFlowThisFunc 5270 LogFlowThisFunc(("machineState=%d\n", aMachineState)); 5271 5271 mMachineState = aMachineState; 5272 5272 … … 5278 5278 // ability to synchronously react to state changes (is it really 5279 5279 // necessary??) 5280 LogFlowThisFunc 5280 LogFlowThisFunc(("Doing onStateChange()...\n")); 5281 5281 onStateChange (aMachineState); 5282 LogFlowThisFunc 5282 LogFlowThisFunc(("Done onStateChange()\n")); 5283 5283 5284 5284 if (aUpdateServer) … … 5297 5297 * this method). 5298 5298 */ 5299 LogFlowThisFunc 5299 LogFlowThisFunc(("Doing mControl->UpdateState()...\n")); 5300 5300 rc = mControl->UpdateState (aMachineState); 5301 LogFlowThisFunc 5301 LogFlowThisFunc(("mControl->UpdateState()=%08X\n", rc)); 5302 5302 } 5303 5303 } … … 5320 5320 */ 5321 5321 HRESULT Console::findSharedFolder (CBSTR aName, 5322 ComObjPtr 5322 ComObjPtr<SharedFolder> &aSharedFolder, 5323 5323 bool aSetError /* = false */) 5324 5324 { 5325 5325 /* sanity check */ 5326 AssertReturn 5326 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 5327 5327 5328 5328 SharedFolderMap::const_iterator it = mSharedFolders.find (aName); … … 5350 5350 { 5351 5351 /* sanity check */ 5352 AssertReturn 5352 AssertReturn(AutoCaller (this).state() == InInit || 5353 5353 isWriteLockOnCurrentThread(), E_FAIL); 5354 5354 … … 5372 5372 mMachineSharedFolders.clear(); 5373 5373 5374 SafeIfaceArray 5374 SafeIfaceArray<ISharedFolder> folders; 5375 5375 rc = mMachine->COMGETTER(SharedFolders) (ComSafeArrayAsOutParam(folders)); 5376 AssertComRCReturnRC 5376 AssertComRCReturnRC(rc); 5377 5377 5378 5378 for (size_t i = 0; i < folders.size(); ++i) 5379 5379 { 5380 ComPtr 5380 ComPtr<ISharedFolder> folder = folders[i]; 5381 5381 5382 5382 Bstr name; … … 5423 5423 } 5424 5424 5425 AssertComRCReturnRC 5425 AssertComRCReturnRC(rc); 5426 5426 5427 5427 /* process outdated (removed) folders */ … … 5467 5467 { 5468 5468 /* sanity check */ 5469 AssertReturn 5469 AssertReturn(isWriteLockOnCurrentThread(), false); 5470 5470 5471 5471 /* first, search machine folders */ … … 5497 5497 5498 5498 /* sanity checks */ 5499 AssertReturn 5500 AssertReturn 5499 AssertReturn(mpVM, E_FAIL); 5500 AssertReturn(mVMMDev->isShFlActive(), E_FAIL); 5501 5501 5502 5502 VBOXHGCMSVCPARM parms[SHFL_CPARMS_ADD_MAPPING]; … … 5568 5568 5569 5569 /* sanity checks */ 5570 AssertReturn 5571 AssertReturn 5570 AssertReturn(mpVM, E_FAIL); 5571 AssertReturn(mVMMDev->isShFlActive(), E_FAIL); 5572 5572 5573 5573 VBOXHGCMSVCPARM parms; … … 5629 5629 AssertReturnVoid (that); 5630 5630 5631 AutoCaller autoCaller 5631 AutoCaller autoCaller(that); 5632 5632 5633 5633 /* Note that we must let this method proceed even if Console::uninit() has … … 5645 5645 case VMSTATE_OFF: 5646 5646 { 5647 AutoWriteLock alock 5647 AutoWriteLock alock(that); 5648 5648 5649 5649 if (that->mVMStateChangeCallbackDisabled) … … 5711 5711 case VMSTATE_TERMINATED: 5712 5712 { 5713 AutoWriteLock alock 5713 AutoWriteLock alock(that); 5714 5714 5715 5715 if (that->mVMStateChangeCallbackDisabled) … … 5762 5762 if (aOldState == VMSTATE_RUNNING) 5763 5763 { 5764 AutoWriteLock alock 5764 AutoWriteLock alock(that); 5765 5765 5766 5766 if (that->mVMStateChangeCallbackDisabled) … … 5780 5780 aOldState == VMSTATE_SUSPENDED) 5781 5781 { 5782 AutoWriteLock alock 5782 AutoWriteLock alock(that); 5783 5783 5784 5784 if (that->mVMStateChangeCallbackDisabled) … … 5802 5802 case VMSTATE_GURU_MEDITATION: 5803 5803 { 5804 AutoWriteLock alock 5804 AutoWriteLock alock(that); 5805 5805 5806 5806 if (that->mVMStateChangeCallbackDisabled) … … 5834 5834 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs) 5835 5835 { 5836 AssertReturn 5837 AssertReturn 5836 AssertReturn(aHostDevice, E_FAIL); 5837 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 5838 5838 5839 5839 /* still want a lock object because we need to leave it */ 5840 AutoWriteLock alock 5840 AutoWriteLock alock(this); 5841 5841 5842 5842 HRESULT hrc; … … 5863 5863 /* protect mpVM */ 5864 5864 AutoVMCaller autoVMCaller (this); 5865 CheckComRCReturnRC 5866 5867 LogFlowThisFunc 5865 CheckComRCReturnRC(autoVMCaller.rc()); 5866 5867 LogFlowThisFunc(("Proxying USB device '%s' {%RTuuid}...\n", 5868 5868 Address.raw(), uuid.ptr())); 5869 5869 … … 5886 5886 if (VBOX_FAILURE (vrc)) 5887 5887 { 5888 LogWarningThisFunc 5888 LogWarningThisFunc(("Failed to create proxy device for '%s' {%RTuuid} (%Rrc)\n", 5889 5889 Address.raw(), uuid.ptr(), vrc)); 5890 5890 … … 5925 5925 LogFlowFunc (("that={%p}\n", that)); 5926 5926 5927 AssertReturn 5927 AssertReturn(that && aUuid, VERR_INVALID_PARAMETER); 5928 5928 5929 5929 void *pvRemoteBackend = NULL; … … 5948 5948 { 5949 5949 /* Create a OUSBDevice and add it to the device list */ 5950 ComObjPtr 5950 ComObjPtr<OUSBDevice> device; 5951 5951 device.createObject(); 5952 5952 HRESULT hrc = device->init (aHostDevice); 5953 5953 AssertComRC (hrc); 5954 5954 5955 AutoWriteLock alock 5955 AutoWriteLock alock(that); 5956 5956 that->mUSBDevices.push_back (device); 5957 5957 LogFlowFunc (("Attached device {%RTuuid}\n", device->id().raw())); … … 5978 5978 HRESULT Console::detachUSBDevice (USBDeviceList::iterator &aIt) 5979 5979 { 5980 AssertReturn 5980 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 5981 5981 5982 5982 /* still want a lock object because we need to leave it */ 5983 AutoWriteLock alock 5983 AutoWriteLock alock(this); 5984 5984 5985 5985 /* protect mpVM */ 5986 5986 AutoVMCaller autoVMCaller (this); 5987 CheckComRCReturnRC 5987 CheckComRCReturnRC(autoVMCaller.rc()); 5988 5988 5989 5989 /* if the device is attached, then there must at least one USB hub. */ 5990 AssertReturn 5991 5992 LogFlowThisFunc 5990 AssertReturn(PDMR3USBHasHub (mpVM), E_FAIL); 5991 5992 LogFlowThisFunc(("Detaching USB proxy device {%RTuuid}...\n", 5993 5993 (*aIt)->id().raw())); 5994 5994 … … 6026 6026 LogFlowFunc (("that={%p}\n", that)); 6027 6027 6028 AssertReturn 6029 ComObjPtr 6028 AssertReturn(that && aUuid, VERR_INVALID_PARAMETER); 6029 ComObjPtr<OUSBDevice> device = **aIt; 6030 6030 6031 6031 /* … … 6048 6048 if (VBOX_SUCCESS (vrc)) 6049 6049 { 6050 AutoWriteLock alock 6050 AutoWriteLock alock(that); 6051 6051 6052 6052 /* Remove the device from the collection */ … … 6090 6090 LogFlowThisFunc(("\n")); 6091 6091 /* sanity check */ 6092 AssertReturn 6092 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 6093 6093 6094 6094 # ifdef VBOX_STRICT … … 6218 6218 /* sanity check */ 6219 6219 LogFlowThisFunc(("\n")); 6220 AssertReturn 6220 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 6221 6221 6222 6222 HRESULT rc = S_OK; … … 6275 6275 HRESULT Console::powerDownHostInterfaces() 6276 6276 { 6277 LogFlowThisFunc 6277 LogFlowThisFunc(("\n")); 6278 6278 6279 6279 /* sanity check */ 6280 AssertReturn 6280 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 6281 6281 6282 6282 /* … … 6321 6321 { 6322 6322 VMProgressTask *task = static_cast <VMProgressTask *> (pvUser); 6323 AssertReturn 6323 AssertReturn(task, VERR_INVALID_PARAMETER); 6324 6324 6325 6325 /* update the progress object */ … … 6411 6411 HRESULT Console::captureUSBDevices (PVM pVM) 6412 6412 { 6413 LogFlowThisFunc 6413 LogFlowThisFunc(("\n")); 6414 6414 6415 6415 /* sanity check */ … … 6425 6425 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 6426 6426 * produce an inter-process dead-lock otherwise. */ 6427 AutoWriteLock alock 6427 AutoWriteLock alock(this); 6428 6428 alock.leave(); 6429 6429 … … 6449 6449 void Console::detachAllUSBDevices (bool aDone) 6450 6450 { 6451 LogFlowThisFunc 6451 LogFlowThisFunc(("aDone=%RTbool\n", aDone)); 6452 6452 6453 6453 /* sanity check */ … … 6459 6459 * us back from under its lock (e.g. onUSBDeviceAttach()) which would 6460 6460 * produce an inter-process dead-lock otherwise. */ 6461 AutoWriteLock alock 6461 AutoWriteLock alock(this); 6462 6462 alock.leave(); 6463 6463 … … 6471 6471 { 6472 6472 LogFlowThisFuncEnter(); 6473 LogFlowThisFunc 6474 6475 AutoCaller autoCaller 6473 LogFlowThisFunc(("u32ClientId = %d, pDevList=%p, cbDevList = %d\n", u32ClientId, pDevList, cbDevList)); 6474 6475 AutoCaller autoCaller(this); 6476 6476 if (!autoCaller.isOk()) 6477 6477 { … … 6479 6479 AssertMsgFailed (("Temporary assertion to prove that it happens, " 6480 6480 "please report to dmik\n")); 6481 LogFlowThisFunc 6481 LogFlowThisFunc(("Console is already uninitialized\n")); 6482 6482 LogFlowThisFuncLeave(); 6483 6483 return; 6484 6484 } 6485 6485 6486 AutoWriteLock alock 6486 AutoWriteLock alock(this); 6487 6487 6488 6488 /* … … 6507 6507 while (cbDevList >= 2 && e->oNext) 6508 6508 { 6509 LogFlowThisFunc 6509 LogFlowThisFunc(("vendor %04X, product %04X, name = %s\n", 6510 6510 e->idVendor, e->idProduct, 6511 6511 e->oProduct? (char *)e + e->oProduct: "")); … … 6535 6535 6536 6536 /* Create the device object and add the new device to list. */ 6537 ComObjPtr 6537 ComObjPtr<RemoteUSBDevice> device; 6538 6538 device.createObject(); 6539 6539 device->init (u32ClientId, e); … … 6549 6549 AssertComRC (hrc); 6550 6550 6551 LogFlowThisFunc 6551 LogFlowThisFunc(("USB filters return %d %#x\n", fMatched, fMaskedIfs)); 6552 6552 6553 6553 if (fMatched) … … 6559 6559 if (hrc == S_OK) 6560 6560 { 6561 LogFlowThisFunc 6561 LogFlowThisFunc(("Device attached\n")); 6562 6562 device->captured (true); 6563 6563 } … … 6567 6567 if (cbDevList < e->oNext) 6568 6568 { 6569 LogWarningThisFunc 6569 LogWarningThisFunc(("cbDevList %d > oNext %d\n", 6570 6570 cbDevList, e->oNext)); 6571 6571 break; … … 6582 6582 for (;;) 6583 6583 { 6584 ComObjPtr 6584 ComObjPtr<RemoteUSBDevice> device; 6585 6585 6586 6586 RemoteUSBDeviceList::iterator it = mRemoteUSBDevices.begin(); … … 6645 6645 6646 6646 std::auto_ptr <VMPowerUpTask> task (static_cast <VMPowerUpTask *> (pvUser)); 6647 AssertReturn 6648 6649 AssertReturn 6650 AssertReturn 6647 AssertReturn(task.get(), VERR_INVALID_PARAMETER); 6648 6649 AssertReturn(!task->mConsole.isNull(), VERR_INVALID_PARAMETER); 6650 AssertReturn(!task->mProgress.isNull(), VERR_INVALID_PARAMETER); 6651 6651 6652 6652 #if defined(RT_OS_WINDOWS) … … 6669 6669 "BU", "IL", "DI", "D", VBOX_VERSION_STRING, VBoxSVNRev (), "BU", "IL", "DI", "D"); 6670 6670 6671 ComObjPtr 6671 ComObjPtr<Console> console = task->mConsole; 6672 6672 6673 6673 /* Note: no need to use addCaller() because VMPowerUpTask does that */ … … 6675 6675 /* The lock is also used as a signal from the task initiator (which 6676 6676 * releases it only after RTThreadCreate()) that we can start the job */ 6677 AutoWriteLock alock 6677 AutoWriteLock alock(console); 6678 6678 6679 6679 /* sanity */ … … 6742 6742 #endif /* VBOX_WITH_VRDP */ 6743 6743 6744 ComPtr 6744 ComPtr<IMachine> pMachine = console->machine(); 6745 6745 ULONG cCpus = 1; 6746 6746 pMachine->COMGETTER(CPUCount)(&cCpus); … … 6908 6908 } 6909 6909 6910 if (SUCCEEDED 6910 if (SUCCEEDED(rc) && VBOX_FAILURE (vrc)) 6911 6911 { 6912 6912 /* If VMR3Create() or one of the other calls in this function fail, … … 6964 6964 alock.leave(); 6965 6965 6966 if (SUCCEEDED 6966 if (SUCCEEDED(rc)) 6967 6967 { 6968 6968 /* Notify the progress object of the success */ … … 7153 7153 /* Pass all custom parameters. */ 7154 7154 bool fHostIP = true; 7155 SafeArray 7156 SafeArray 7155 SafeArray<BSTR> names; 7156 SafeArray<BSTR> values; 7157 7157 hrc = hardDisk->GetProperties (NULL, 7158 7158 ComSafeArrayAsOutParam (names), … … 7194 7194 7195 7195 /* Pass all custom parameters. */ 7196 SafeArray 7197 SafeArray 7196 SafeArray<BSTR> names; 7197 SafeArray<BSTR> values; 7198 7198 hrc = hardDisk->GetProperties (NULL, 7199 7199 ComSafeArrayAsOutParam (names), … … 7259 7259 7260 7260 std::auto_ptr <VMSaveTask> task (static_cast <VMSaveTask *> (pvUser)); 7261 AssertReturn 7261 AssertReturn(task.get(), VERR_INVALID_PARAMETER); 7262 7262 7263 7263 Assert(task->mSavedStateFile.length()); 7264 7264 Assert(!task->mProgress.isNull()); 7265 7265 7266 const ComObjPtr 7266 const ComObjPtr<Console> &that = task->mConsole; 7267 7267 7268 7268 /* … … 7280 7280 7281 7281 rc = task->mServerProgress->WaitForCompletion (-1); 7282 if (SUCCEEDED 7282 if (SUCCEEDED(rc)) 7283 7283 { 7284 7284 LONG iRc = S_OK; 7285 7285 rc = task->mServerProgress->COMGETTER(ResultCode) (&iRc); 7286 if (SUCCEEDED 7286 if (SUCCEEDED(rc)) 7287 7287 rc = iRc; 7288 7288 } 7289 7289 } 7290 7290 7291 if (SUCCEEDED 7291 if (SUCCEEDED(rc)) 7292 7292 { 7293 7293 LogFlowFunc (("Saving the state to '%s'...\n", task->mSavedStateFile.raw())); … … 7308 7308 AutoWriteLock thatLock (that); 7309 7309 7310 if (SUCCEEDED 7310 if (SUCCEEDED(rc)) 7311 7311 { 7312 7312 if (task->mIsSnapshot) … … 7315 7315 LogFlowFunc (("Reattaching new differencing hard disks...\n")); 7316 7316 7317 com::SafeIfaceArray 7317 com::SafeIfaceArray<IHardDiskAttachment> atts; 7318 7318 rc = that->mMachine-> 7319 7319 COMGETTER(HardDiskAttachments) (ComSafeArrayAsOutParam (atts)); … … 7374 7374 * before calling mControl->BeginTakingSnapshot(). 7375 7375 */ 7376 that->mControl->EndTakingSnapshot (SUCCEEDED 7376 that->mControl->EndTakingSnapshot (SUCCEEDED(rc)); 7377 7377 } 7378 7378 else … … 7384 7384 * before calling mControl->BeginSavingState(). 7385 7385 */ 7386 that->mControl->EndSavingState (SUCCEEDED 7386 that->mControl->EndSavingState (SUCCEEDED(rc)); 7387 7387 } 7388 7388 … … 7414 7414 7415 7415 /* notify the progress object about operation completion */ 7416 if (SUCCEEDED 7416 if (SUCCEEDED(rc)) 7417 7417 task->mProgress->notifyComplete (S_OK); 7418 7418 else … … 7446 7446 7447 7447 std::auto_ptr <VMProgressTask> task (static_cast <VMProgressTask *> (pvUser)); 7448 AssertReturn 7449 7450 AssertReturn 7451 7452 const ComObjPtr 7448 AssertReturn(task.get(), VERR_INVALID_PARAMETER); 7449 7450 AssertReturn(task->isOk(), VERR_GENERAL_FAILURE); 7451 7452 const ComObjPtr<Console> &that = task->mConsole; 7453 7453 7454 7454 /* Note: no need to use addCaller() to protect Console because VMTask does -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r21817 r21878 152 152 #endif 153 153 154 AssertReturn 155 ComObjPtr 156 157 AutoCaller autoCaller 154 AssertReturn(pvConsole, VERR_GENERAL_FAILURE); 155 ComObjPtr<Console> pConsole = static_cast <Console *> (pvConsole); 156 157 AutoCaller autoCaller(pConsole); 158 158 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 159 159 160 160 /* lock the console because we widely use internal fields and methods */ 161 AutoWriteLock alock 161 AutoWriteLock alock(pConsole); 162 162 163 163 /* Save the VM pointer in the machine object */ 164 164 pConsole->mpVM = pVM; 165 165 166 ComPtr 166 ComPtr<IMachine> pMachine = pConsole->machine(); 167 167 168 168 int rc; … … 188 188 hrc = virtualBox->COMGETTER(Host)(host.asOutParam()); H(); 189 189 190 ComPtr 190 ComPtr<ISystemProperties> systemProperties; 191 191 hrc = virtualBox->COMGETTER(SystemProperties)(systemProperties.asOutParam()); H(); 192 192 … … 268 268 hrc = pMachine->COMGETTER(OSTypeId)(osTypeId.asOutParam()); H(); 269 269 270 ComPtr 270 ComPtr<IGuestOSType> guestOSType; 271 271 hrc = virtualBox->GetGuestOSType(osTypeId, guestOSType.asOutParam()); H(); 272 272 … … 1105 1105 /* Pass all custom parameters. */ 1106 1106 bool fHostIP = true; 1107 SafeArray 1108 SafeArray 1107 SafeArray<BSTR> names; 1108 SafeArray<BSTR> values; 1109 1109 hrc = hardDisk->GetProperties (NULL, 1110 1110 ComSafeArrayAsOutParam (names), … … 1147 1147 1148 1148 /* Pass all custom parameters. */ 1149 SafeArray 1150 SafeArray 1149 SafeArray<BSTR> names; 1150 SafeArray<BSTR> values; 1151 1151 hrc = hardDisk->GetProperties (NULL, 1152 1152 ComSafeArrayAsOutParam (names), … … 1702 1702 rc = pConsole->mVMMDev->hgcmLoadService ("VBoxSharedClipboard", "VBoxSharedClipboard"); 1703 1703 1704 if (RT_FAILURE 1704 if (RT_FAILURE(rc)) 1705 1705 { 1706 1706 LogRel(("VBoxSharedClipboard is not available. rc = %Rrc\n", rc)); … … 1801 1801 rc = pConsole->mVMMDev->hgcmLoadService ("VBoxGuestPropSvc", "VBoxGuestPropSvc"); 1802 1802 1803 if (RT_FAILURE 1803 if (RT_FAILURE(rc)) 1804 1804 { 1805 1805 LogRel(("VBoxGuestPropSvc is not available. rc = %Rrc\n", rc)); … … 2018 2018 int rc2 = VMR3AtStateRegister (pVM, Console::vmstateChangeCallback, pConsole); 2019 2019 AssertRC (rc2); 2020 if (RT_SUCCESS 2020 if (RT_SUCCESS(rc)) 2021 2021 rc = rc2; 2022 2022 … … 2024 2024 rc2 = VMR3AtRuntimeErrorRegister (pVM, Console::setVMRuntimeErrorCallback, pConsole); 2025 2025 AssertRC (rc2); 2026 if (RT_SUCCESS 2026 if (RT_SUCCESS(rc)) 2027 2027 rc = rc2; 2028 2028 … … 2056 2056 int rcRet = VINF_SUCCESS; 2057 2057 2058 AutoCaller autoCaller 2058 AutoCaller autoCaller(pThis); 2059 2059 AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED); 2060 2060 … … 2064 2064 * meAttachmentType member. 2065 2065 */ 2066 AutoWriteLock alock 2066 AutoWriteLock alock(pThis); 2067 2067 2068 2068 PVM pVM = pThis->mpVM; … … 2075 2075 { 2076 2076 HRESULT hrc; 2077 ComPtr 2077 ComPtr<IMachine> pMachine = pThis->machine(); 2078 2078 2079 2079 ComPtr<IVirtualBox> virtualBox; -
trunk/src/VBox/Main/ConsoleVRDPServer.cpp
r21726 r21878 1112 1112 AssertComRC(rc2); 1113 1113 1114 if (SUCCEEDED 1114 if (SUCCEEDED(rc2) && vrdpEnabled) 1115 1115 { 1116 1116 if (loadVRDPLibrary ()) … … 1279 1279 int rc = RTSemEventCreate (&mUSBBackends.event); 1280 1280 1281 if (RT_FAILURE 1281 if (RT_FAILURE(rc)) 1282 1282 { 1283 1283 AssertFailed (); … … 1285 1285 } 1286 1286 1287 if (RT_SUCCESS 1287 if (RT_SUCCESS(rc)) 1288 1288 { 1289 1289 rc = RTThreadCreate (&mUSBBackends.thread, threadRemoteUSB, this, 65536, … … 1291 1291 } 1292 1292 1293 if (RT_FAILURE 1293 if (RT_FAILURE(rc)) 1294 1294 { 1295 1295 LogRel(("Warning: could not start the remote USB thread, rc = %Rrc!!!\n", rc)); … … 1301 1301 rc = RTThreadUserWait (mUSBBackends.thread, 60000); 1302 1302 AssertRC (rc); 1303 Assert (mUSBBackends.fThreadRunning || RT_FAILURE 1303 Assert (mUSBBackends.fThreadRunning || RT_FAILURE(rc)); 1304 1304 } 1305 1305 } … … 1365 1365 1366 1366 int rc = RTLdrLoad (filename.raw(), &mAuthLibrary); 1367 if (RT_FAILURE 1367 if (RT_FAILURE(rc)) 1368 1368 LogRel(("VRDPAUTH: Failed to load external authentication library. Error code: %Rrc\n", rc)); 1369 1369 1370 if (RT_SUCCESS 1370 if (RT_SUCCESS(rc)) 1371 1371 { 1372 1372 /* Get the entry point. */ 1373 1373 mpfnAuthEntry2 = NULL; 1374 1374 int rc2 = RTLdrGetSymbol(mAuthLibrary, "VRDPAuth2", (void**)&mpfnAuthEntry2); 1375 if (RT_FAILURE 1375 if (RT_FAILURE(rc2)) 1376 1376 { 1377 1377 if (rc2 != VERR_SYMBOL_NOT_FOUND) … … 1385 1385 mpfnAuthEntry = NULL; 1386 1386 rc2 = RTLdrGetSymbol(mAuthLibrary, "VRDPAuth", (void**)&mpfnAuthEntry); 1387 if (RT_FAILURE 1387 if (RT_FAILURE(rc2)) 1388 1388 { 1389 1389 if (rc2 != VERR_SYMBOL_NOT_FOUND) … … 1401 1401 } 1402 1402 1403 if (RT_FAILURE 1403 if (RT_FAILURE(rc)) 1404 1404 { 1405 1405 mConsole->reportAuthLibraryError (filename.raw(), rc); … … 1597 1597 int rc = lockConsoleVRDPServer (); 1598 1598 1599 if (RT_SUCCESS 1599 if (RT_SUCCESS(rc)) 1600 1600 { 1601 1601 if (mcClipboardRefs == 0) … … 1603 1603 rc = HGCMHostRegisterServiceExtension (&mhClipboard, "VBoxSharedClipboard", ClipboardServiceExtension, this); 1604 1604 1605 if (RT_SUCCESS 1605 if (RT_SUCCESS(rc)) 1606 1606 { 1607 1607 mcClipboardRefs++; … … 1617 1617 int rc = lockConsoleVRDPServer (); 1618 1618 1619 if (RT_SUCCESS 1619 if (RT_SUCCESS(rc)) 1620 1620 { 1621 1621 mcClipboardRefs--; … … 1648 1648 int rc = lockConsoleVRDPServer (); 1649 1649 1650 if (RT_SUCCESS 1650 if (RT_SUCCESS(rc)) 1651 1651 { 1652 1652 pRemoteUSBBackend->pNext = mUSBBackends.pHead; … … 1670 1670 } 1671 1671 1672 if (RT_FAILURE 1672 if (RT_FAILURE(rc)) 1673 1673 { 1674 1674 pRemoteUSBBackend->Release (); … … 1688 1688 int rc = lockConsoleVRDPServer (); 1689 1689 1690 if (RT_SUCCESS 1690 if (RT_SUCCESS(rc)) 1691 1691 { 1692 1692 pRemoteUSBBackend = usbBackendFind (u32ClientId); … … 1717 1717 int rc = lockConsoleVRDPServer (); 1718 1718 1719 if (RT_SUCCESS 1719 if (RT_SUCCESS(rc)) 1720 1720 { 1721 1721 pRemoteUSBBackend = usbBackendFind (u32ClientId); … … 1757 1757 int rc = lockConsoleVRDPServer (); 1758 1758 1759 if (RT_SUCCESS 1759 if (RT_SUCCESS(rc)) 1760 1760 { 1761 1761 pRemoteUSBBackend = usbBackendFindByUUID (pGuid); … … 1785 1785 int rc = lockConsoleVRDPServer (); 1786 1786 1787 if (RT_SUCCESS 1787 if (RT_SUCCESS(rc)) 1788 1788 { 1789 1789 if (pRemoteUSBBackend == NULL) … … 2049 2049 HRESULT RemoteDisplayInfo::init (Console *aParent) 2050 2050 { 2051 LogFlowThisFunc 2051 LogFlowThisFunc(("aParent=%p\n", aParent)); 2052 2052 2053 2053 ComAssertRet (aParent, E_INVALIDARG); 2054 2054 2055 2055 /* Enclose the state transition NotReady->InInit->Ready */ 2056 AutoInitSpan autoInitSpan 2057 AssertReturn 2058 2059 unconst 2056 AutoInitSpan autoInitSpan(this); 2057 AssertReturn(autoInitSpan.isOk(), E_FAIL); 2058 2059 unconst(mParent) = aParent; 2060 2060 2061 2061 /* Confirm a successful initialization */ … … 2071 2071 void RemoteDisplayInfo::uninit() 2072 2072 { 2073 LogFlowThisFunc 2073 LogFlowThisFunc(("\n")); 2074 2074 2075 2075 /* Enclose the state transition Ready->InUninit->NotReady */ 2076 AutoUninitSpan autoUninitSpan 2076 AutoUninitSpan autoUninitSpan(this); 2077 2077 if (autoUninitSpan.uninitDone()) 2078 2078 return; 2079 2079 2080 unconst 2080 unconst(mParent).setNull(); 2081 2081 } 2082 2082 … … 2090 2090 return E_POINTER; \ 2091 2091 \ 2092 AutoCaller autoCaller 2093 CheckComRCReturnRC 2092 AutoCaller autoCaller(this); \ 2093 CheckComRCReturnRC(autoCaller.rc()); \ 2094 2094 \ 2095 2095 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2096 AutoWriteLock alock 2096 AutoWriteLock alock(this); \ 2097 2097 \ 2098 2098 uint32_t value; \ … … 2113 2113 return E_POINTER; \ 2114 2114 \ 2115 AutoCaller autoCaller 2116 CheckComRCReturnRC 2115 AutoCaller autoCaller(this); \ 2116 CheckComRCReturnRC(autoCaller.rc()); \ 2117 2117 \ 2118 2118 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2119 AutoWriteLock alock 2119 AutoWriteLock alock(this); \ 2120 2120 \ 2121 2121 _aType value; \ … … 2136 2136 return E_POINTER; \ 2137 2137 \ 2138 AutoCaller autoCaller 2139 CheckComRCReturnRC 2138 AutoCaller autoCaller(this); \ 2139 CheckComRCReturnRC(autoCaller.rc()); \ 2140 2140 \ 2141 2141 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 2142 AutoWriteLock alock 2142 AutoWriteLock alock(this); \ 2143 2143 \ 2144 2144 uint32_t cbOut = 0; \ … … 2150 2150 { \ 2151 2151 Bstr str(""); \ 2152 str.cloneTo 2152 str.cloneTo(a##_aName); \ 2153 2153 return S_OK; \ 2154 2154 } \ … … 2169 2169 Bstr str(pchBuffer); \ 2170 2170 \ 2171 str.cloneTo 2171 str.cloneTo(a##_aName); \ 2172 2172 \ 2173 2173 RTMemTmpFree (pchBuffer); \ -
trunk/src/VBox/Main/DHCPServerImpl.cpp
r21860 r21878 46 46 { 47 47 /* Enclose the state transition Ready->InUninit->NotReady */ 48 AutoUninitSpan autoUninitSpan 48 AutoUninitSpan autoUninitSpan(this); 49 49 if (autoUninitSpan.uninitDone()) 50 50 return; … … 56 56 mVirtualBox->removeDependentChild (this); 57 57 58 unconst 58 unconst(mVirtualBox).setNull(); 59 59 } 60 60 61 61 HRESULT DHCPServer::init(VirtualBox *aVirtualBox, IN_BSTR aName) 62 62 { 63 AssertReturn 64 65 AutoInitSpan autoInitSpan 66 AssertReturn 63 AssertReturn(aName != NULL, E_INVALIDARG); 64 65 AutoInitSpan autoInitSpan(this); 66 AssertReturn(autoInitSpan.isOk(), E_FAIL); 67 67 68 68 /* share VirtualBox weakly (parent remains NULL so far) */ 69 unconst 69 unconst(mVirtualBox) = aVirtualBox; 70 70 71 71 unconst(mName) = aName; … … 91 91 92 92 /* Enclose the state transition NotReady->InInit->Ready */ 93 AutoInitSpan autoInitSpan 94 AssertReturn 93 AutoInitSpan autoInitSpan(this); 94 AssertReturn(autoInitSpan.isOk(), E_FAIL); 95 95 96 96 /* share VirtualBox weakly (parent remains NULL so far) */ 97 unconst 97 unconst(mVirtualBox) = aVirtualBox; 98 98 99 99 aVirtualBox->addDependentChild (this); … … 115 115 using namespace settings; 116 116 117 AssertReturn 118 119 AutoCaller autoCaller 120 CheckComRCReturnRC 121 122 AutoReadLock alock 117 AssertReturn(!aParentNode.isNull(), E_FAIL); 118 119 AutoCaller autoCaller(this); 120 CheckComRCReturnRC(autoCaller.rc()); 121 122 AutoReadLock alock(this); 123 123 124 124 Key aNode = aParentNode.appendKey ("DHCPServer"); … … 139 139 CheckComArgOutPointerValid(aName); 140 140 141 AutoCaller autoCaller 142 CheckComRCReturnRC 141 AutoCaller autoCaller(this); 142 CheckComRCReturnRC(autoCaller.rc()); 143 143 144 144 mName.cloneTo(aName); … … 151 151 CheckComArgOutPointerValid(aEnabled); 152 152 153 AutoCaller autoCaller 154 CheckComRCReturnRC 153 AutoCaller autoCaller(this); 154 CheckComRCReturnRC(autoCaller.rc()); 155 155 156 156 *aEnabled = m.enabled; … … 161 161 STDMETHODIMP DHCPServer::COMSETTER(Enabled) (BOOL aEnabled) 162 162 { 163 AutoCaller autoCaller 164 CheckComRCReturnRC 163 AutoCaller autoCaller(this); 164 CheckComRCReturnRC(autoCaller.rc()); 165 165 166 166 /* VirtualBox::saveSettings() needs a write lock */ … … 178 178 CheckComArgOutPointerValid(aIPAddress); 179 179 180 AutoCaller autoCaller 181 CheckComRCReturnRC 180 AutoCaller autoCaller(this); 181 CheckComRCReturnRC(autoCaller.rc()); 182 182 183 183 m.IPAddress.cloneTo(aIPAddress); … … 190 190 CheckComArgOutPointerValid(aNetworkMask); 191 191 192 AutoCaller autoCaller 193 CheckComRCReturnRC 192 AutoCaller autoCaller(this); 193 CheckComRCReturnRC(autoCaller.rc()); 194 194 195 195 m.networkMask.cloneTo(aNetworkMask); … … 202 202 CheckComArgOutPointerValid(aIPAddress); 203 203 204 AutoCaller autoCaller 205 CheckComRCReturnRC 204 AutoCaller autoCaller(this); 205 CheckComRCReturnRC(autoCaller.rc()); 206 206 207 207 m.lowerIP.cloneTo(aIPAddress); … … 214 214 CheckComArgOutPointerValid(aIPAddress); 215 215 216 AutoCaller autoCaller 217 CheckComRCReturnRC 216 AutoCaller autoCaller(this); 217 CheckComRCReturnRC(autoCaller.rc()); 218 218 219 219 m.upperIP.cloneTo(aIPAddress); … … 224 224 STDMETHODIMP DHCPServer::SetConfiguration (IN_BSTR aIPAddress, IN_BSTR aNetworkMask, IN_BSTR aLowerIP, IN_BSTR aUpperIP) 225 225 { 226 AssertReturn 227 AssertReturn 228 AssertReturn 229 AssertReturn 230 231 AutoCaller autoCaller 232 CheckComRCReturnRC 226 AssertReturn(aIPAddress != NULL, E_INVALIDARG); 227 AssertReturn(aNetworkMask != NULL, E_INVALIDARG); 228 AssertReturn(aLowerIP != NULL, E_INVALIDARG); 229 AssertReturn(aUpperIP != NULL, E_INVALIDARG); 230 231 AutoCaller autoCaller(this); 232 CheckComRCReturnRC(autoCaller.rc()); 233 233 234 234 /* VirtualBox::saveSettings() needs a write lock */ -
trunk/src/VBox/Main/DHCPServerRunner.cpp
r21860 r21878 122 122 123 123 int rc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &mProcess); 124 if (RT_FAILURE 124 if (RT_FAILURE(rc)) 125 125 mProcess = NIL_RTPROCESS; 126 126 -
trunk/src/VBox/Main/DVDDriveImpl.cpp
r19511 r21878 63 63 HRESULT DVDDrive::init (Machine *aParent) 64 64 { 65 LogFlowThisFunc 65 LogFlowThisFunc(("aParent=%p\n", aParent)); 66 66 67 67 ComAssertRet (aParent, E_INVALIDARG); 68 68 69 69 /* Enclose the state transition NotReady->InInit->Ready */ 70 AutoInitSpan autoInitSpan 71 AssertReturn 72 73 unconst 70 AutoInitSpan autoInitSpan(this); 71 AssertReturn(autoInitSpan.isOk(), E_FAIL); 72 73 unconst(mParent) = aParent; 74 74 /* mPeer is left null */ 75 75 … … 94 94 HRESULT DVDDrive::init (Machine *aParent, DVDDrive *aThat) 95 95 { 96 LogFlowThisFunc 96 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 97 97 98 98 ComAssertRet (aParent && aThat, E_INVALIDARG); 99 99 100 100 /* Enclose the state transition NotReady->InInit->Ready */ 101 AutoInitSpan autoInitSpan 102 AssertReturn 103 104 unconst 105 unconst 101 AutoInitSpan autoInitSpan(this); 102 AssertReturn(autoInitSpan.isOk(), E_FAIL); 103 104 unconst(mParent) = aParent; 105 unconst(mPeer) = aThat; 106 106 107 107 AutoCaller thatCaller (aThat); 108 AssertComRCReturnRC 108 AssertComRCReturnRC(thatCaller.rc()); 109 109 110 110 AutoReadLock thatLock (aThat); … … 126 126 HRESULT DVDDrive::initCopy (Machine *aParent, DVDDrive *aThat) 127 127 { 128 LogFlowThisFunc 128 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 129 129 130 130 ComAssertRet (aParent && aThat, E_INVALIDARG); 131 131 132 132 /* Enclose the state transition NotReady->InInit->Ready */ 133 AutoInitSpan autoInitSpan 134 AssertReturn 135 136 unconst 133 AutoInitSpan autoInitSpan(this); 134 AssertReturn(autoInitSpan.isOk(), E_FAIL); 135 136 unconst(mParent) = aParent; 137 137 /* mPeer is left null */ 138 138 139 139 AutoCaller thatCaller (aThat); 140 AssertComRCReturnRC 140 AssertComRCReturnRC(thatCaller.rc()); 141 141 142 142 AutoReadLock thatLock (aThat); … … 166 166 void DVDDrive::uninit() 167 167 { 168 LogFlowThisFunc 168 LogFlowThisFunc(("\n")); 169 169 170 170 /* Enclose the state transition Ready->InUninit->NotReady */ 171 AutoUninitSpan autoUninitSpan 171 AutoUninitSpan autoUninitSpan(this); 172 172 if (autoUninitSpan.uninitDone()) 173 173 return; … … 189 189 m.free(); 190 190 191 unconst 192 unconst 191 unconst(mPeer).setNull(); 192 unconst(mParent).setNull(); 193 193 } 194 194 … … 200 200 CheckComArgOutPointerValid(aState); 201 201 202 AutoCaller autoCaller 203 CheckComRCReturnRC 204 205 AutoReadLock alock 202 AutoCaller autoCaller(this); 203 CheckComRCReturnRC(autoCaller.rc()); 204 205 AutoReadLock alock(this); 206 206 207 207 *aState = m->state; … … 214 214 CheckComArgOutPointerValid(aPassthrough); 215 215 216 AutoCaller autoCaller 217 CheckComRCReturnRC 218 219 AutoReadLock alock 216 AutoCaller autoCaller(this); 217 CheckComRCReturnRC(autoCaller.rc()); 218 219 AutoReadLock alock(this); 220 220 221 221 *aPassthrough = m->passthrough; … … 226 226 STDMETHODIMP DVDDrive::COMSETTER(Passthrough) (BOOL aPassthrough) 227 227 { 228 AutoCaller autoCaller 229 CheckComRCReturnRC 228 AutoCaller autoCaller(this); 229 CheckComRCReturnRC(autoCaller.rc()); 230 230 231 231 /* the machine needs to be mutable */ 232 232 Machine::AutoMutableStateDependency adep (mParent); 233 CheckComRCReturnRC 234 235 AutoWriteLock alock 233 CheckComRCReturnRC(adep.rc()); 234 235 AutoWriteLock alock(this); 236 236 237 237 if (m->passthrough != aPassthrough) … … 252 252 CheckComArgExpr(aImageId, !imageId.isEmpty()); 253 253 254 AutoCaller autoCaller 255 CheckComRCReturnRC 254 AutoCaller autoCaller(this); 255 CheckComRCReturnRC(autoCaller.rc()); 256 256 257 257 /* the machine needs to be mutable */ 258 258 Machine::AutoMutableStateDependency adep (mParent); 259 CheckComRCReturnRC 260 261 AutoWriteLock alock 259 CheckComRCReturnRC(adep.rc()); 260 261 AutoWriteLock alock(this); 262 262 263 263 HRESULT rc = E_FAIL; … … 270 270 true /* aSetError */, &image); 271 271 272 if (SUCCEEDED 272 if (SUCCEEDED(rc)) 273 273 { 274 274 if (m->state != DriveState_ImageMounted || … … 276 276 { 277 277 rc = image->attachTo (mParent->id(), mParent->snapshotId()); 278 if (SUCCEEDED 278 if (SUCCEEDED(rc)) 279 279 { 280 280 /* umount() will backup data */ 281 281 rc = unmount(); 282 282 283 if (SUCCEEDED 283 if (SUCCEEDED(rc)) 284 284 { 285 285 /* lock the image for reading if the VM is online. It will … … 291 291 } 292 292 293 if (SUCCEEDED 293 if (SUCCEEDED(rc)) 294 294 { 295 295 m->image = image; … … 312 312 CheckComArgNotNull(aHostDVDDrive); 313 313 314 AutoCaller autoCaller 315 CheckComRCReturnRC 314 AutoCaller autoCaller(this); 315 CheckComRCReturnRC(autoCaller.rc()); 316 316 317 317 /* the machine needs to be mutable */ 318 318 Machine::AutoMutableStateDependency adep (mParent); 319 CheckComRCReturnRC 320 321 AutoWriteLock alock 319 CheckComRCReturnRC(adep.rc()); 320 321 AutoWriteLock alock(this); 322 322 323 323 if (m->state != DriveState_HostDriveCaptured || … … 326 326 /* umount() will backup data */ 327 327 HRESULT rc = unmount(); 328 if (SUCCEEDED 328 if (SUCCEEDED(rc)) 329 329 { 330 330 m->hostDrive = aHostDVDDrive; … … 343 343 STDMETHODIMP DVDDrive::Unmount() 344 344 { 345 AutoCaller autoCaller 346 CheckComRCReturnRC 345 AutoCaller autoCaller(this); 346 CheckComRCReturnRC(autoCaller.rc()); 347 347 348 348 /* the machine needs to be mutable */ 349 349 Machine::AutoMutableStateDependency adep (mParent); 350 CheckComRCReturnRC 351 352 AutoWriteLock alock 350 CheckComRCReturnRC(adep.rc()); 351 352 AutoWriteLock alock(this); 353 353 354 354 if (m->state != DriveState_NotMounted) … … 356 356 /* umount() will backup data */ 357 357 HRESULT rc = unmount(); 358 if (SUCCEEDED 358 if (SUCCEEDED(rc)) 359 359 { 360 360 m->state = DriveState_NotMounted; … … 376 376 CheckComArgOutPointerValid(aDVDImage); 377 377 378 AutoCaller autoCaller 379 CheckComRCReturnRC 380 381 AutoReadLock alock 382 383 m->image.queryInterfaceTo 378 AutoCaller autoCaller(this); 379 CheckComRCReturnRC(autoCaller.rc()); 380 381 AutoReadLock alock(this); 382 383 m->image.queryInterfaceTo(aDVDImage); 384 384 385 385 return S_OK; … … 390 390 CheckComArgOutPointerValid(aHostDrive); 391 391 392 AutoCaller autoCaller 393 CheckComRCReturnRC 394 395 AutoReadLock alock 396 397 m->hostDrive.queryInterfaceTo 392 AutoCaller autoCaller(this); 393 CheckComRCReturnRC(autoCaller.rc()); 394 395 AutoReadLock alock(this); 396 397 m->hostDrive.queryInterfaceTo(aHostDrive); 398 398 399 399 return S_OK; … … 415 415 using namespace settings; 416 416 417 AssertReturn 418 419 AutoCaller autoCaller 420 AssertComRCReturnRC 421 422 AutoWriteLock alock 417 AssertReturn(!aMachineNode.isNull(), E_FAIL); 418 419 AutoCaller autoCaller(this); 420 AssertComRCReturnRC(autoCaller.rc()); 421 422 AutoWriteLock alock(this); 423 423 424 424 /* Note: we assume that the default values for attributes of optional … … 447 447 Guid uuid = typeNode.value <Guid> ("uuid"); 448 448 rc = MountImage (uuid.toUtf16()); 449 CheckComRCReturnRC 449 CheckComRCReturnRC(rc); 450 450 } 451 451 else if (!(typeNode = dvdDriveNode.findKey ("HostDrive")).isNull()) … … 455 455 456 456 /* find the corresponding object */ 457 ComObjPtr 458 459 com::SafeIfaceArray 457 ComObjPtr<Host> host = mParent->virtualBox()->host(); 458 459 com::SafeIfaceArray<IHostDVDDrive> coll; 460 460 rc = host->COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(coll)); 461 461 AssertComRC (rc); 462 462 463 ComPtr 463 ComPtr<IHostDVDDrive> drive; 464 464 rc = host->FindHostDVDDrive (src, drive.asOutParam()); 465 465 466 if (SUCCEEDED 466 if (SUCCEEDED(rc)) 467 467 { 468 468 rc = CaptureHostDrive (drive); 469 CheckComRCReturnRC 469 CheckComRCReturnRC(rc); 470 470 } 471 471 else if (rc == E_INVALIDARG) … … 474 474 * assume it will be available later and create an 475 475 * extra object now */ 476 ComObjPtr 476 ComObjPtr<HostDVDDrive> hostDrive; 477 477 hostDrive.createObject(); 478 478 rc = hostDrive->init (src); 479 479 AssertComRC (rc); 480 480 rc = CaptureHostDrive (hostDrive); 481 CheckComRCReturnRC 481 CheckComRCReturnRC(rc); 482 482 } 483 483 else … … 499 499 using namespace settings; 500 500 501 AssertReturn 502 503 AutoCaller autoCaller 504 AssertComRCReturnRC 505 506 AutoReadLock alock 501 AssertReturn(!aMachineNode.isNull(), E_FAIL); 502 503 AutoCaller autoCaller(this); 504 AssertComRCReturnRC(autoCaller.rc()); 505 506 AutoReadLock alock(this); 507 507 508 508 Key node = aMachineNode.createKey ("DVDDrive"); … … 555 555 { 556 556 /* sanity */ 557 AutoCaller autoCaller 557 AutoCaller autoCaller(this); 558 558 AssertComRCReturn (autoCaller.rc(), false); 559 559 … … 562 562 AssertComRCReturn (adep.rc(), false); 563 563 564 AutoWriteLock alock 564 AutoWriteLock alock(this); 565 565 566 566 bool changed = false; … … 618 618 { 619 619 /* sanity */ 620 AutoCaller autoCaller 620 AutoCaller autoCaller(this); 621 621 AssertComRCReturnVoid (autoCaller.rc()); 622 622 … … 649 649 650 650 /* sanity */ 651 AutoCaller autoCaller 651 AutoCaller autoCaller(this); 652 652 AssertComRCReturnVoid (autoCaller.rc()); 653 653 … … 671 671 HRESULT DVDDrive::unmount() 672 672 { 673 AssertReturn 673 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 674 674 675 675 /* we need adep for the state check */ -
trunk/src/VBox/Main/DisplayImpl.cpp
r21796 r21878 173 173 HRESULT Display::init (Console *aParent) 174 174 { 175 LogFlowThisFunc 175 LogFlowThisFunc(("aParent=%p\n", aParent)); 176 176 177 177 ComAssertRet (aParent, E_INVALIDARG); 178 178 179 179 /* Enclose the state transition NotReady->InInit->Ready */ 180 AutoInitSpan autoInitSpan 181 AssertReturn 182 183 unconst 180 AutoInitSpan autoInitSpan(this); 181 AssertReturn(autoInitSpan.isOk(), E_FAIL); 182 183 unconst(mParent) = aParent; 184 184 185 185 // by default, we have an internal framebuffer which is … … 229 229 void Display::uninit() 230 230 { 231 LogFlowThisFunc 231 LogFlowThisFunc(("\n")); 232 232 233 233 /* Enclose the state transition Ready->InUninit->NotReady */ 234 AutoUninitSpan autoUninitSpan 234 AutoUninitSpan autoUninitSpan(this); 235 235 if (autoUninitSpan.uninitDone()) 236 236 return; … … 243 243 mParent->UnregisterCallback (this); 244 244 245 unconst 245 unconst(mParent).setNull(); 246 246 247 247 if (mpDrv) … … 1317 1317 CheckComArgNotNull(width); 1318 1318 1319 AutoCaller autoCaller 1320 CheckComRCReturnRC 1321 1322 AutoWriteLock alock 1319 AutoCaller autoCaller(this); 1320 CheckComRCReturnRC(autoCaller.rc()); 1321 1322 AutoWriteLock alock(this); 1323 1323 1324 1324 CHECK_CONSOLE_DRV (mpDrv); … … 1339 1339 CheckComArgNotNull(height); 1340 1340 1341 AutoCaller autoCaller 1342 CheckComRCReturnRC 1343 1344 AutoWriteLock alock 1341 AutoCaller autoCaller(this); 1342 CheckComRCReturnRC(autoCaller.rc()); 1343 1344 AutoWriteLock alock(this); 1345 1345 1346 1346 CHECK_CONSOLE_DRV (mpDrv); … … 1362 1362 return E_INVALIDARG; 1363 1363 1364 AutoCaller autoCaller 1365 CheckComRCReturnRC 1366 1367 AutoWriteLock alock 1364 AutoCaller autoCaller(this); 1365 CheckComRCReturnRC(autoCaller.rc()); 1366 1367 AutoWriteLock alock(this); 1368 1368 1369 1369 CHECK_CONSOLE_DRV (mpDrv); … … 1389 1389 CheckComArgOutPointerValid(aFramebuffer); 1390 1390 1391 AutoCaller autoCaller 1392 CheckComRCReturnRC 1393 1394 AutoWriteLock alock 1391 AutoCaller autoCaller(this); 1392 CheckComRCReturnRC(autoCaller.rc()); 1393 1394 AutoWriteLock alock(this); 1395 1395 1396 1396 Console::SafeVMPtrQuiet pVM (mParent); … … 1405 1405 int vrc = VMR3ReqCall (pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 1406 1406 (PFNRT) changeFramebuffer, 3, this, aFramebuffer, aScreenId); 1407 if (RT_SUCCESS 1407 if (RT_SUCCESS(vrc)) 1408 1408 vrc = pReq->iStatus; 1409 1409 VMR3ReqFree (pReq); … … 1430 1430 CheckComArgOutPointerValid(aFramebuffer); 1431 1431 1432 AutoCaller autoCaller 1433 CheckComRCReturnRC 1434 1435 AutoWriteLock alock 1432 AutoCaller autoCaller(this); 1433 CheckComRCReturnRC(autoCaller.rc()); 1434 1435 AutoWriteLock alock(this); 1436 1436 1437 1437 /* @todo this should be actually done on EMT. */ … … 1452 1452 ULONG aBitsPerPixel, ULONG aDisplay) 1453 1453 { 1454 AutoCaller autoCaller 1455 CheckComRCReturnRC 1456 1457 AutoWriteLock alock 1454 AutoCaller autoCaller(this); 1455 CheckComRCReturnRC(autoCaller.rc()); 1456 1457 AutoWriteLock alock(this); 1458 1458 1459 1459 CHECK_CONSOLE_DRV (mpDrv); … … 1502 1502 STDMETHODIMP Display::SetSeamlessMode (BOOL enabled) 1503 1503 { 1504 AutoCaller autoCaller 1505 CheckComRCReturnRC 1506 1507 AutoWriteLock alock 1504 AutoCaller autoCaller(this); 1505 CheckComRCReturnRC(autoCaller.rc()); 1506 1507 AutoWriteLock alock(this); 1508 1508 1509 1509 /* Have to leave the lock because the pfnRequestSeamlessChange will call EMT. */ … … 1532 1532 CheckComArgExpr(height, height != 0); 1533 1533 1534 AutoCaller autoCaller 1535 CheckComRCReturnRC 1536 1537 AutoWriteLock alock 1534 AutoCaller autoCaller(this); 1535 CheckComRCReturnRC(autoCaller.rc()); 1536 1537 AutoWriteLock alock(this); 1538 1538 1539 1539 CHECK_CONSOLE_DRV (mpDrv); 1540 1540 1541 1541 Console::SafeVMPtr pVM (mParent); 1542 CheckComRCReturnRC 1542 CheckComRCReturnRC(pVM.rc()); 1543 1543 1544 1544 HRESULT rc = S_OK; … … 1588 1588 1589 1589 STDMETHODIMP Display::TakeScreenShotSlow (ULONG width, ULONG height, 1590 ComSafeArrayOut 1590 ComSafeArrayOut(BYTE, aScreenData)) 1591 1591 { 1592 1592 HRESULT rc = S_OK; … … 1615 1615 CheckComArgExpr(height, height != 0); 1616 1616 1617 AutoCaller autoCaller 1618 CheckComRCReturnRC 1619 1620 AutoWriteLock alock 1617 AutoCaller autoCaller(this); 1618 CheckComRCReturnRC(autoCaller.rc()); 1619 1620 AutoWriteLock alock(this); 1621 1621 1622 1622 CHECK_CONSOLE_DRV (mpDrv); 1623 1623 1624 1624 Console::SafeVMPtr pVM (mParent); 1625 CheckComRCReturnRC 1625 CheckComRCReturnRC(pVM.rc()); 1626 1626 1627 1627 /* … … 1674 1674 LogFlowFuncEnter(); 1675 1675 1676 AutoCaller autoCaller 1677 CheckComRCReturnRC 1678 1679 AutoWriteLock alock 1676 AutoCaller autoCaller(this); 1677 CheckComRCReturnRC(autoCaller.rc()); 1678 1679 AutoWriteLock alock(this); 1680 1680 1681 1681 CHECK_CONSOLE_DRV (mpDrv); 1682 1682 1683 1683 Console::SafeVMPtr pVM (mParent); 1684 CheckComRCReturnRC 1684 CheckComRCReturnRC(pVM.rc()); 1685 1685 1686 1686 HRESULT rc = S_OK; … … 1719 1719 LogFlowFunc (("\n")); 1720 1720 1721 /// @todo (dmik) can we AutoWriteLock alock 1721 /// @todo (dmik) can we AutoWriteLock alock(this); here? 1722 1722 // do it when we switch this class to VirtualBoxBase_NEXT. 1723 1723 // This will require general code review and may add some details. … … 1727 1727 // (and therefore don't use Display lock at all here to save some 1728 1728 // milliseconds). 1729 AutoCaller autoCaller 1730 CheckComRCReturnRC 1729 AutoCaller autoCaller(this); 1730 CheckComRCReturnRC(autoCaller.rc()); 1731 1731 1732 1732 /* this is only valid for external framebuffers */ … … 1755 1755 LogFlowFunc (("\n")); 1756 1756 1757 /// @todo (dmik) can we AutoWriteLock alock 1757 /// @todo (dmik) can we AutoWriteLock alock(this); here? 1758 1758 // do it when we switch this class to VirtualBoxBase_NEXT. 1759 1759 // Tthis will require general code review and may add some details. … … 1763 1763 // (and therefore don't use Display lock at all here to save some 1764 1764 // milliseconds). 1765 AutoCaller autoCaller 1766 CheckComRCReturnRC 1765 AutoCaller autoCaller(this); 1766 CheckComRCReturnRC(autoCaller.rc()); 1767 1767 1768 1768 /* this is only valid for external framebuffers */ … … 1889 1889 LogFlowFunc (("uScreenId = %d\n", uScreenId)); 1890 1890 1891 AssertReturn 1892 AssertReturn 1893 1894 AutoCaller autoCaller 1895 CheckComRCReturnRC 1896 1897 AutoWriteLock alock 1891 AssertReturn(that, VERR_INVALID_PARAMETER); 1892 AssertReturn(uScreenId < that->mcMonitors, VERR_INVALID_PARAMETER); 1893 1894 AutoCaller autoCaller(that); 1895 CheckComRCReturnRC(autoCaller.rc()); 1896 1897 AutoWriteLock alock(that); 1898 1898 1899 1899 DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId]; -
trunk/src/VBox/Main/FloppyDriveImpl.cpp
r19511 r21878 63 63 HRESULT FloppyDrive::init (Machine *aParent) 64 64 { 65 LogFlowThisFunc 65 LogFlowThisFunc(("aParent=%p\n", aParent)); 66 66 67 67 ComAssertRet (aParent, E_INVALIDARG); 68 68 69 69 /* Enclose the state transition NotReady->InInit->Ready */ 70 AutoInitSpan autoInitSpan 71 AssertReturn 72 73 unconst 70 AutoInitSpan autoInitSpan(this); 71 AssertReturn(autoInitSpan.isOk(), E_FAIL); 72 73 unconst(mParent) = aParent; 74 74 /* mPeer is left null */ 75 75 … … 94 94 HRESULT FloppyDrive::init (Machine *aParent, FloppyDrive *aThat) 95 95 { 96 LogFlowThisFunc 96 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 97 97 98 98 ComAssertRet (aParent && aThat, E_INVALIDARG); 99 99 100 100 /* Enclose the state transition NotReady->InInit->Ready */ 101 AutoInitSpan autoInitSpan 102 AssertReturn 103 104 unconst 105 unconst 101 AutoInitSpan autoInitSpan(this); 102 AssertReturn(autoInitSpan.isOk(), E_FAIL); 103 104 unconst(mParent) = aParent; 105 unconst(mPeer) = aThat; 106 106 107 107 AutoCaller thatCaller (aThat); 108 AssertComRCReturnRC 108 AssertComRCReturnRC(thatCaller.rc()); 109 109 110 110 AutoReadLock thatLock (aThat); … … 126 126 HRESULT FloppyDrive::initCopy (Machine *aParent, FloppyDrive *aThat) 127 127 { 128 LogFlowThisFunc 128 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 129 129 130 130 ComAssertRet (aParent && aThat, E_INVALIDARG); 131 131 132 132 /* Enclose the state transition NotReady->InInit->Ready */ 133 AutoInitSpan autoInitSpan 134 AssertReturn 135 136 unconst 133 AutoInitSpan autoInitSpan(this); 134 AssertReturn(autoInitSpan.isOk(), E_FAIL); 135 136 unconst(mParent) = aParent; 137 137 /* mPeer is left null */ 138 138 139 139 AutoCaller thatCaller (aThat); 140 AssertComRCReturnRC 140 AssertComRCReturnRC(thatCaller.rc()); 141 141 142 142 AutoReadLock thatLock (aThat); … … 166 166 void FloppyDrive::uninit() 167 167 { 168 LogFlowThisFunc 168 LogFlowThisFunc(("\n")); 169 169 170 170 /* Enclose the state transition Ready->InUninit->NotReady */ 171 AutoUninitSpan autoUninitSpan 171 AutoUninitSpan autoUninitSpan(this); 172 172 if (autoUninitSpan.uninitDone()) 173 173 return; … … 189 189 m.free(); 190 190 191 unconst 192 unconst 191 unconst(mPeer).setNull(); 192 unconst(mParent).setNull(); 193 193 } 194 194 … … 200 200 CheckComArgOutPointerValid(aEnabled); 201 201 202 AutoCaller autoCaller 203 CheckComRCReturnRC 204 205 AutoReadLock alock 202 AutoCaller autoCaller(this); 203 CheckComRCReturnRC(autoCaller.rc()); 204 205 AutoReadLock alock(this); 206 206 207 207 *aEnabled = m->enabled; … … 212 212 STDMETHODIMP FloppyDrive::COMSETTER(Enabled) (BOOL aEnabled) 213 213 { 214 LogFlowThisFunc 215 216 AutoCaller autoCaller 217 CheckComRCReturnRC 214 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 215 216 AutoCaller autoCaller(this); 217 CheckComRCReturnRC(autoCaller.rc()); 218 218 219 219 /* the machine needs to be mutable */ 220 220 Machine::AutoMutableStateDependency adep (mParent); 221 CheckComRCReturnRC 222 223 AutoWriteLock alock 221 CheckComRCReturnRC(adep.rc()); 222 223 AutoWriteLock alock(this); 224 224 225 225 if (m->enabled != aEnabled) … … 241 241 CheckComArgOutPointerValid(aState); 242 242 243 AutoCaller autoCaller 244 CheckComRCReturnRC 245 246 AutoReadLock alock 243 AutoCaller autoCaller(this); 244 CheckComRCReturnRC(autoCaller.rc()); 245 246 AutoReadLock alock(this); 247 247 248 248 *aState = m->state; … … 259 259 CheckComArgExpr(aImageId, !imageId.isEmpty()); 260 260 261 AutoCaller autoCaller 262 CheckComRCReturnRC 261 AutoCaller autoCaller(this); 262 CheckComRCReturnRC(autoCaller.rc()); 263 263 264 264 /* the machine needs to be mutable */ 265 265 Machine::AutoMutableStateDependency adep (mParent); 266 CheckComRCReturnRC 267 268 AutoWriteLock alock 266 CheckComRCReturnRC(adep.rc()); 267 268 AutoWriteLock alock(this); 269 269 270 270 HRESULT rc = E_FAIL; … … 277 277 true /* aSetError */, &image); 278 278 279 if (SUCCEEDED 279 if (SUCCEEDED(rc)) 280 280 { 281 281 if (m->state != DriveState_ImageMounted || … … 283 283 { 284 284 rc = image->attachTo (mParent->id(), mParent->snapshotId()); 285 if (SUCCEEDED 285 if (SUCCEEDED(rc)) 286 286 { 287 287 /* umount() will backup data */ 288 288 rc = unmount(); 289 289 290 if (SUCCEEDED 290 if (SUCCEEDED(rc)) 291 291 { 292 292 /* lock the image for reading if the VM is online. It will … … 298 298 } 299 299 300 if (SUCCEEDED 300 if (SUCCEEDED(rc)) 301 301 { 302 302 m->image = image; … … 319 319 CheckComArgNotNull(aHostFloppyDrive); 320 320 321 AutoCaller autoCaller 322 CheckComRCReturnRC 321 AutoCaller autoCaller(this); 322 CheckComRCReturnRC(autoCaller.rc()); 323 323 324 324 /* the machine needs to be mutable */ 325 325 Machine::AutoMutableStateDependency adep (mParent); 326 CheckComRCReturnRC 327 328 AutoWriteLock alock 326 CheckComRCReturnRC(adep.rc()); 327 328 AutoWriteLock alock(this); 329 329 330 330 if (m->state != DriveState_HostDriveCaptured || … … 333 333 /* umount() will backup data */ 334 334 HRESULT rc = unmount(); 335 if (SUCCEEDED 335 if (SUCCEEDED(rc)) 336 336 { 337 337 m->hostDrive = aHostFloppyDrive; … … 350 350 STDMETHODIMP FloppyDrive::Unmount() 351 351 { 352 AutoCaller autoCaller 353 CheckComRCReturnRC 352 AutoCaller autoCaller(this); 353 CheckComRCReturnRC(autoCaller.rc()); 354 354 355 355 /* the machine needs to be mutable */ 356 356 Machine::AutoMutableStateDependency adep (mParent); 357 CheckComRCReturnRC 358 359 AutoWriteLock alock 357 CheckComRCReturnRC(adep.rc()); 358 359 AutoWriteLock alock(this); 360 360 361 361 if (m->state != DriveState_NotMounted) … … 363 363 /* umount() will backup data */ 364 364 HRESULT rc = unmount(); 365 if (SUCCEEDED 365 if (SUCCEEDED(rc)) 366 366 { 367 367 m->state = DriveState_NotMounted; … … 383 383 CheckComArgOutPointerValid(aFloppyImage); 384 384 385 AutoCaller autoCaller 386 CheckComRCReturnRC 387 388 AutoReadLock alock 389 390 m->image.queryInterfaceTo 385 AutoCaller autoCaller(this); 386 CheckComRCReturnRC(autoCaller.rc()); 387 388 AutoReadLock alock(this); 389 390 m->image.queryInterfaceTo(aFloppyImage); 391 391 392 392 return S_OK; … … 397 397 CheckComArgOutPointerValid(aHostDrive); 398 398 399 AutoCaller autoCaller 400 CheckComRCReturnRC 401 402 AutoReadLock alock 403 404 m->hostDrive.queryInterfaceTo 399 AutoCaller autoCaller(this); 400 CheckComRCReturnRC(autoCaller.rc()); 401 402 AutoReadLock alock(this); 403 404 m->hostDrive.queryInterfaceTo(aHostDrive); 405 405 406 406 return S_OK; … … 422 422 using namespace settings; 423 423 424 AssertReturn 425 426 AutoCaller autoCaller 427 AssertComRCReturnRC 428 429 AutoWriteLock alock 424 AssertReturn(!aMachineNode.isNull(), E_FAIL); 425 426 AutoCaller autoCaller(this); 427 AssertComRCReturnRC(autoCaller.rc()); 428 429 AutoWriteLock alock(this); 430 430 431 431 /* Note: we assume that the default values for attributes of optional … … 454 454 Guid uuid = typeNode.value <Guid> ("uuid"); 455 455 rc = MountImage (uuid.toUtf16()); 456 CheckComRCReturnRC 456 CheckComRCReturnRC(rc); 457 457 } 458 458 else if (!(typeNode = floppyDriveNode.findKey ("HostDrive")).isNull()) … … 462 462 463 463 /* find the corresponding object */ 464 ComObjPtr 465 466 com::SafeIfaceArray 464 ComObjPtr<Host> host = mParent->virtualBox()->host(); 465 466 com::SafeIfaceArray<IHostFloppyDrive> coll; 467 467 rc = host->COMGETTER(FloppyDrives) (ComSafeArrayAsOutParam(coll)); 468 468 AssertComRC (rc); 469 469 470 ComPtr 470 ComPtr<IHostFloppyDrive> drive; 471 471 rc = host->FindHostFloppyDrive (src, drive.asOutParam()); 472 472 473 if (SUCCEEDED 473 if (SUCCEEDED(rc)) 474 474 { 475 475 rc = CaptureHostDrive (drive); 476 CheckComRCReturnRC 476 CheckComRCReturnRC(rc); 477 477 } 478 478 else if (rc == E_INVALIDARG) … … 481 481 * assume it will be available later and create an 482 482 * extra object now */ 483 ComObjPtr 483 ComObjPtr<HostFloppyDrive> hostDrive; 484 484 hostDrive.createObject(); 485 485 rc = hostDrive->init (src); 486 486 AssertComRC (rc); 487 487 rc = CaptureHostDrive (hostDrive); 488 CheckComRCReturnRC 488 CheckComRCReturnRC(rc); 489 489 } 490 490 else … … 506 506 using namespace settings; 507 507 508 AssertReturn 509 510 AutoCaller autoCaller 511 AssertComRCReturnRC 512 513 AutoReadLock alock 508 AssertReturn(!aMachineNode.isNull(), E_FAIL); 509 510 AutoCaller autoCaller(this); 511 AssertComRCReturnRC(autoCaller.rc()); 512 513 AutoReadLock alock(this); 514 514 515 515 Key node = aMachineNode.createKey ("FloppyDrive"); … … 562 562 { 563 563 /* sanity */ 564 AutoCaller autoCaller 564 AutoCaller autoCaller(this); 565 565 AssertComRCReturn (autoCaller.rc(), false); 566 566 … … 569 569 AssertComRCReturn (adep.rc(), false); 570 570 571 AutoWriteLock alock 571 AutoWriteLock alock(this); 572 572 573 573 bool changed = false; … … 626 626 { 627 627 /* sanity */ 628 AutoCaller autoCaller 628 AutoCaller autoCaller(this); 629 629 AssertComRCReturnVoid (autoCaller.rc()); 630 630 … … 655 655 { 656 656 /* sanity */ 657 AutoCaller autoCaller 657 AutoCaller autoCaller(this); 658 658 AssertComRCReturnVoid (autoCaller.rc()); 659 659 … … 677 677 HRESULT FloppyDrive::unmount() 678 678 { 679 AssertReturn 679 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 680 680 681 681 /* we need adep for the state check */ -
trunk/src/VBox/Main/GuestImpl.cpp
r21219 r21878 59 59 HRESULT Guest::init (Console *aParent) 60 60 { 61 LogFlowThisFunc 61 LogFlowThisFunc(("aParent=%p\n", aParent)); 62 62 63 63 ComAssertRet (aParent, E_INVALIDARG); 64 64 65 65 /* Enclose the state transition NotReady->InInit->Ready */ 66 AutoInitSpan autoInitSpan 67 AssertReturn 68 69 unconst 66 AutoInitSpan autoInitSpan(this); 67 AssertReturn(autoInitSpan.isOk(), E_FAIL); 68 69 unconst(mParent) = aParent; 70 70 71 71 /* mData.mAdditionsActive is FALSE */ … … 103 103 void Guest::uninit() 104 104 { 105 LogFlowThisFunc 105 LogFlowThisFunc(("\n")); 106 106 107 107 /* Enclose the state transition Ready->InUninit->NotReady */ 108 AutoUninitSpan autoUninitSpan 108 AutoUninitSpan autoUninitSpan(this); 109 109 if (autoUninitSpan.uninitDone()) 110 110 return; 111 111 112 unconst 112 unconst(mParent).setNull(); 113 113 } 114 114 … … 120 120 CheckComArgOutPointerValid(aOSTypeId); 121 121 122 AutoCaller autoCaller 123 CheckComRCReturnRC 124 125 AutoReadLock alock 122 AutoCaller autoCaller(this); 123 CheckComRCReturnRC(autoCaller.rc()); 124 125 AutoReadLock alock(this); 126 126 127 127 // redirect the call to IMachine if no additions are installed … … 129 129 return mParent->machine()->COMGETTER(OSTypeId) (aOSTypeId); 130 130 131 mData.mOSTypeId.cloneTo 131 mData.mOSTypeId.cloneTo(aOSTypeId); 132 132 133 133 return S_OK; … … 138 138 CheckComArgOutPointerValid(aAdditionsActive); 139 139 140 AutoCaller autoCaller 141 CheckComRCReturnRC 142 143 AutoReadLock alock 140 AutoCaller autoCaller(this); 141 CheckComRCReturnRC(autoCaller.rc()); 142 143 AutoReadLock alock(this); 144 144 145 145 *aAdditionsActive = mData.mAdditionsActive; … … 152 152 CheckComArgOutPointerValid(aAdditionsVersion); 153 153 154 AutoCaller autoCaller 155 CheckComRCReturnRC 156 157 AutoReadLock alock 158 159 mData.mAdditionsVersion.cloneTo 154 AutoCaller autoCaller(this); 155 CheckComRCReturnRC(autoCaller.rc()); 156 157 AutoReadLock alock(this); 158 159 mData.mAdditionsVersion.cloneTo(aAdditionsVersion); 160 160 161 161 return S_OK; … … 166 166 CheckComArgOutPointerValid(aSupportsSeamless); 167 167 168 AutoCaller autoCaller 169 CheckComRCReturnRC 170 171 AutoReadLock alock 168 AutoCaller autoCaller(this); 169 CheckComRCReturnRC(autoCaller.rc()); 170 171 AutoReadLock alock(this); 172 172 173 173 *aSupportsSeamless = mData.mSupportsSeamless; … … 180 180 CheckComArgOutPointerValid(aSupportsGraphics); 181 181 182 AutoCaller autoCaller 183 CheckComRCReturnRC 184 185 AutoReadLock alock 182 AutoCaller autoCaller(this); 183 CheckComRCReturnRC(autoCaller.rc()); 184 185 AutoReadLock alock(this); 186 186 187 187 *aSupportsGraphics = mData.mSupportsGraphics; … … 194 194 CheckComArgOutPointerValid(aMemoryBalloonSize); 195 195 196 AutoCaller autoCaller 197 CheckComRCReturnRC 198 199 AutoReadLock alock 196 AutoCaller autoCaller(this); 197 CheckComRCReturnRC(autoCaller.rc()); 198 199 AutoReadLock alock(this); 200 200 201 201 *aMemoryBalloonSize = mMemoryBalloonSize; … … 206 206 STDMETHODIMP Guest::COMSETTER(MemoryBalloonSize) (ULONG aMemoryBalloonSize) 207 207 { 208 AutoCaller autoCaller 209 CheckComRCReturnRC 210 211 AutoWriteLock alock 208 AutoCaller autoCaller(this); 209 CheckComRCReturnRC(autoCaller.rc()); 210 211 AutoWriteLock alock(this); 212 212 213 213 HRESULT ret = mParent->machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize); … … 228 228 CheckComArgOutPointerValid(aUpdateInterval); 229 229 230 AutoCaller autoCaller 231 CheckComRCReturnRC 232 233 AutoReadLock alock 230 AutoCaller autoCaller(this); 231 CheckComRCReturnRC(autoCaller.rc()); 232 233 AutoReadLock alock(this); 234 234 235 235 *aUpdateInterval = mStatUpdateInterval; … … 240 240 STDMETHODIMP Guest::COMSETTER(StatisticsUpdateInterval) (ULONG aUpdateInterval) 241 241 { 242 AutoCaller autoCaller 243 CheckComRCReturnRC 244 245 AutoWriteLock alock 242 AutoCaller autoCaller(this); 243 CheckComRCReturnRC(autoCaller.rc()); 244 245 AutoWriteLock alock(this); 246 246 247 247 HRESULT ret = mParent->machine()->COMSETTER(StatisticsUpdateInterval)(aUpdateInterval); … … 265 265 CheckComArgNotNull(aDomain); 266 266 267 AutoCaller autoCaller 268 CheckComRCReturnRC 267 AutoCaller autoCaller(this); 268 CheckComRCReturnRC(autoCaller.rc()); 269 269 270 270 /* forward the information to the VMM device */ … … 318 318 Assert(aVersion.isNull() || !aVersion.isEmpty()); 319 319 320 AutoCaller autoCaller 320 AutoCaller autoCaller(this); 321 321 AssertComRCReturnVoid (autoCaller.rc()); 322 322 323 AutoWriteLock alock 323 AutoWriteLock alock(this); 324 324 325 325 mData.mAdditionsVersion = aVersion; … … 331 331 void Guest::setSupportsSeamless (BOOL aSupportsSeamless) 332 332 { 333 AutoCaller autoCaller 333 AutoCaller autoCaller(this); 334 334 AssertComRCReturnVoid (autoCaller.rc()); 335 335 336 AutoWriteLock alock 336 AutoWriteLock alock(this); 337 337 338 338 mData.mSupportsSeamless = aSupportsSeamless; … … 341 341 void Guest::setSupportsGraphics (BOOL aSupportsGraphics) 342 342 { 343 AutoCaller autoCaller 343 AutoCaller autoCaller(this); 344 344 AssertComRCReturnVoid (autoCaller.rc()); 345 345 346 AutoWriteLock alock 346 AutoWriteLock alock(this); 347 347 348 348 mData.mSupportsGraphics = aSupportsGraphics; -
trunk/src/VBox/Main/GuestOSTypeImpl.cpp
r21607 r21878 75 75 { 76 76 #if 0 77 LogFlowThisFunc 77 LogFlowThisFunc(("aFamilyId='%s', aFamilyDescription='%s', " 78 78 "aId='%s', aDescription='%s', " 79 79 "aType=%d, aOSHint=%x, " … … 90 90 91 91 /* Enclose the state transition NotReady->InInit->Ready */ 92 AutoInitSpan autoInitSpan 93 AssertReturn 94 95 unconst 96 unconst 97 unconst 98 unconst 99 unconst 100 unconst 101 unconst 102 unconst 103 unconst 104 unconst 105 unconst 92 AutoInitSpan autoInitSpan(this); 93 AssertReturn(autoInitSpan.isOk(), E_FAIL); 94 95 unconst(mFamilyID) = aFamilyId; 96 unconst(mFamilyDescription) = aFamilyDescription; 97 unconst(mID) = aId; 98 unconst(mDescription) = aDescription; 99 unconst(mOSType) = aOSType; 100 unconst(mOSHint) = aOSHint; 101 unconst(mRAMSize) = aRAMSize; 102 unconst(mVRAMSize) = aVRAMSize; 103 unconst(mHDDSize) = aHDDSize; 104 unconst(mNetworkAdapterType) = aNetworkAdapterType; 105 unconst(mNumSerialEnabled) = aNumSerialEnabled; 106 106 107 107 /* Confirm a successful initialization when it's the case */ … … 118 118 { 119 119 /* Enclose the state transition Ready->InUninit->NotReady */ 120 AutoUninitSpan autoUninitSpan 120 AutoUninitSpan autoUninitSpan(this); 121 121 if (autoUninitSpan.uninitDone()) 122 122 return; … … 130 130 CheckComArgOutPointerValid(aFamilyId); 131 131 132 AutoCaller autoCaller 133 CheckComRCReturnRC 132 AutoCaller autoCaller(this); 133 CheckComRCReturnRC(autoCaller.rc()); 134 134 135 135 /* mFamilyID is constant during life time, no need to lock */ 136 mFamilyID.cloneTo 136 mFamilyID.cloneTo(aFamilyId); 137 137 138 138 return S_OK; … … 143 143 CheckComArgOutPointerValid(aFamilyDescription); 144 144 145 AutoCaller autoCaller 146 CheckComRCReturnRC 145 AutoCaller autoCaller(this); 146 CheckComRCReturnRC(autoCaller.rc()); 147 147 148 148 /* mFamilyDescription is constant during life time, no need to lock */ 149 mFamilyDescription.cloneTo 149 mFamilyDescription.cloneTo(aFamilyDescription); 150 150 151 151 return S_OK; … … 156 156 CheckComArgOutPointerValid(aId); 157 157 158 AutoCaller autoCaller 159 CheckComRCReturnRC 158 AutoCaller autoCaller(this); 159 CheckComRCReturnRC(autoCaller.rc()); 160 160 161 161 /* mID is constant during life time, no need to lock */ 162 mID.cloneTo 162 mID.cloneTo(aId); 163 163 164 164 return S_OK; … … 169 169 CheckComArgOutPointerValid(aDescription); 170 170 171 AutoCaller autoCaller 172 CheckComRCReturnRC 171 AutoCaller autoCaller(this); 172 CheckComRCReturnRC(autoCaller.rc()); 173 173 174 174 /* mDescription is constant during life time, no need to lock */ 175 mDescription.cloneTo 175 mDescription.cloneTo(aDescription); 176 176 177 177 return S_OK; … … 182 182 CheckComArgOutPointerValid(aIs64Bit); 183 183 184 AutoCaller autoCaller 185 CheckComRCReturnRC 184 AutoCaller autoCaller(this); 185 CheckComRCReturnRC(autoCaller.rc()); 186 186 187 187 /* mIs64Bit is constant during life time, no need to lock */ … … 195 195 CheckComArgOutPointerValid(aRecommendedIOAPIC); 196 196 197 AutoCaller autoCaller 198 CheckComRCReturnRC 197 AutoCaller autoCaller(this); 198 CheckComRCReturnRC(autoCaller.rc()); 199 199 200 200 /* mRecommendedIOAPIC is constant during life time, no need to lock */ … … 208 208 CheckComArgOutPointerValid(aRecommendedVirtEx); 209 209 210 AutoCaller autoCaller 211 CheckComRCReturnRC 210 AutoCaller autoCaller(this); 211 CheckComRCReturnRC(autoCaller.rc()); 212 212 213 213 /* mRecommendedVirtEx is constant during life time, no need to lock */ … … 221 221 CheckComArgOutPointerValid(aRAMSize); 222 222 223 AutoCaller autoCaller 224 CheckComRCReturnRC 223 AutoCaller autoCaller(this); 224 CheckComRCReturnRC(autoCaller.rc()); 225 225 226 226 /* mRAMSize is constant during life time, no need to lock */ … … 234 234 CheckComArgOutPointerValid(aVRAMSize); 235 235 236 AutoCaller autoCaller 237 CheckComRCReturnRC 236 AutoCaller autoCaller(this); 237 CheckComRCReturnRC(autoCaller.rc()); 238 238 239 239 /* mVRAMSize is constant during life time, no need to lock */ … … 247 247 CheckComArgOutPointerValid(aHDDSize); 248 248 249 AutoCaller autoCaller 250 CheckComRCReturnRC 249 AutoCaller autoCaller(this); 250 CheckComRCReturnRC(autoCaller.rc()); 251 251 252 252 /* mHDDSize is constant during life time, no need to lock */ … … 260 260 CheckComArgOutPointerValid(aNetworkAdapterType); 261 261 262 AutoCaller autoCaller 263 CheckComRCReturnRC 262 AutoCaller autoCaller(this); 263 CheckComRCReturnRC(autoCaller.rc()); 264 264 265 265 /* mNetworkAdapterType is constant during life time, no need to lock */ -
trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp
r17671 r21878 52 52 LONG aDevice, bool aImplicit /*= false*/) 53 53 { 54 AssertReturn 54 AssertReturn(aHD, E_INVALIDARG); 55 55 56 56 /* Enclose the state transition NotReady->InInit->Ready */ 57 AutoInitSpan autoInitSpan 58 AssertReturn 57 AutoInitSpan autoInitSpan(this); 58 AssertReturn(autoInitSpan.isOk(), E_FAIL); 59 59 60 60 m.hardDisk = aHD; 61 unconst 62 unconst 63 unconst 61 unconst(m.controller) = aController; 62 unconst(m.port) = aPort; 63 unconst(m.device) = aDevice; 64 64 65 65 m.implicit = aImplicit; … … 78 78 { 79 79 /* Enclose the state transition Ready->InUninit->NotReady */ 80 AutoUninitSpan autoUninitSpan 80 AutoUninitSpan autoUninitSpan(this); 81 81 if (autoUninitSpan.uninitDone()) 82 82 return; … … 90 90 CheckComArgOutPointerValid(aHardDisk); 91 91 92 AutoCaller autoCaller 93 CheckComRCReturnRC 92 AutoCaller autoCaller(this); 93 CheckComRCReturnRC(autoCaller.rc()); 94 94 95 AutoReadLock alock 95 AutoReadLock alock(this); 96 96 97 m.hardDisk.queryInterfaceTo 97 m.hardDisk.queryInterfaceTo(aHardDisk); 98 98 99 99 return S_OK; … … 104 104 CheckComArgOutPointerValid(aController); 105 105 106 AutoCaller autoCaller 107 CheckComRCReturnRC 106 AutoCaller autoCaller(this); 107 CheckComRCReturnRC(autoCaller.rc()); 108 108 109 109 /* m.controller is constant during life time, no need to lock */ … … 117 117 CheckComArgOutPointerValid(aPort); 118 118 119 AutoCaller autoCaller 120 CheckComRCReturnRC 119 AutoCaller autoCaller(this); 120 CheckComRCReturnRC(autoCaller.rc()); 121 121 122 122 /* m.port is constant during life time, no need to lock */ … … 130 130 CheckComArgOutPointerValid(aDevice); 131 131 132 AutoCaller autoCaller 133 CheckComRCReturnRC 132 AutoCaller autoCaller(this); 133 CheckComRCReturnRC(autoCaller.rc()); 134 134 135 135 /* m.device is constant during life time, no need to lock */ -
trunk/src/VBox/Main/HardDiskFormatImpl.cpp
r16873 r21878 52 52 HRESULT HardDiskFormat::init (const VDBACKENDINFO *aVDInfo) 53 53 { 54 LogFlowThisFunc 54 LogFlowThisFunc(("aVDInfo=%p\n", aVDInfo)); 55 55 56 56 ComAssertRet (aVDInfo, E_INVALIDARG); 57 57 58 58 /* Enclose the state transition NotReady->InInit->Ready */ 59 AutoInitSpan autoInitSpan 60 AssertReturn 59 AutoInitSpan autoInitSpan(this); 60 AssertReturn(autoInitSpan.isOk(), E_FAIL); 61 61 62 62 /* The ID of the backend */ 63 unconst 63 unconst(m.id) = aVDInfo->pszBackend; 64 64 /* The Name of the backend */ 65 65 /* Use id for now as long as VDBACKENDINFO hasn't any extra 66 66 * name/description field. */ 67 unconst 67 unconst(m.name) = aVDInfo->pszBackend; 68 68 /* The capabilities of the backend */ 69 unconst 69 unconst(m.capabilities) = aVDInfo->uBackendCaps; 70 70 /* Save the supported file extensions in a list */ 71 71 if (aVDInfo->papszFileExtensions) … … 74 74 while (*papsz != NULL) 75 75 { 76 unconst 76 unconst(m.fileExtensions).push_back (*papsz); 77 77 ++ papsz; 78 78 } … … 137 137 flags, 138 138 defaultValue }; 139 unconst 139 unconst(m.properties).push_back (prop); 140 140 ++ pa; 141 141 } … … 154 154 void HardDiskFormat::uninit() 155 155 { 156 LogFlowThisFunc 156 LogFlowThisFunc(("\n")); 157 157 158 158 /* Enclose the state transition Ready->InUninit->NotReady */ 159 AutoUninitSpan autoUninitSpan 159 AutoUninitSpan autoUninitSpan(this); 160 160 if (autoUninitSpan.uninitDone()) 161 161 return; 162 162 163 unconst 164 unconst 165 unconst 166 unconst 167 unconst 163 unconst(m.properties).clear(); 164 unconst(m.fileExtensions).clear(); 165 unconst(m.capabilities) = 0; 166 unconst(m.name).setNull(); 167 unconst(m.id).setNull(); 168 168 } 169 169 … … 175 175 CheckComArgOutPointerValid(aId); 176 176 177 AutoCaller autoCaller 178 CheckComRCReturnRC 179 180 /* this is const, no need to lock */ 181 m.id.cloneTo 177 AutoCaller autoCaller(this); 178 CheckComRCReturnRC(autoCaller.rc()); 179 180 /* this is const, no need to lock */ 181 m.id.cloneTo(aId); 182 182 183 183 return S_OK; … … 188 188 CheckComArgOutPointerValid(aName); 189 189 190 AutoCaller autoCaller 191 CheckComRCReturnRC 192 193 /* this is const, no need to lock */ 194 m.name.cloneTo 190 AutoCaller autoCaller(this); 191 CheckComRCReturnRC(autoCaller.rc()); 192 193 /* this is const, no need to lock */ 194 m.name.cloneTo(aName); 195 195 196 196 return S_OK; … … 198 198 199 199 STDMETHODIMP HardDiskFormat:: 200 COMGETTER(FileExtensions)(ComSafeArrayOut 201 { 202 if (ComSafeArrayOutIsNull 200 COMGETTER(FileExtensions)(ComSafeArrayOut(BSTR, aFileExtensions)) 201 { 202 if (ComSafeArrayOutIsNull(aFileExtensions)) 203 203 return E_POINTER; 204 204 205 AutoCaller autoCaller 206 CheckComRCReturnRC 207 208 /* this is const, no need to lock */ 209 com::SafeArray 205 AutoCaller autoCaller(this); 206 CheckComRCReturnRC(autoCaller.rc()); 207 208 /* this is const, no need to lock */ 209 com::SafeArray<BSTR> fileExtentions (m.fileExtensions.size()); 210 210 int i = 0; 211 211 for (BstrList::const_iterator it = m.fileExtensions.begin(); 212 212 it != m.fileExtensions.end(); ++ it, ++ i) 213 (*it).cloneTo 214 fileExtentions.detachTo (ComSafeArrayOutArg(aFileExtensions));213 (*it).cloneTo(&fileExtentions [i]); 214 fileExtentions.detachTo(ComSafeArrayOutArg(aFileExtensions)); 215 215 216 216 return S_OK; … … 221 221 CheckComArgOutPointerValid(aCaps); 222 222 223 AutoCaller autoCaller 224 CheckComRCReturnRC 223 AutoCaller autoCaller(this); 224 CheckComRCReturnRC(autoCaller.rc()); 225 225 226 226 /* m.capabilities is const, no need to lock */ … … 237 237 } 238 238 239 STDMETHODIMP HardDiskFormat::DescribeProperties(ComSafeArrayOut 240 ComSafeArrayOut 241 ComSafeArrayOut 242 ComSafeArrayOut 243 ComSafeArrayOut 239 STDMETHODIMP HardDiskFormat::DescribeProperties(ComSafeArrayOut(BSTR, aNames), 240 ComSafeArrayOut(BSTR, aDescriptions), 241 ComSafeArrayOut(DataType_T, aTypes), 242 ComSafeArrayOut(ULONG, aFlags), 243 ComSafeArrayOut(BSTR, aDefaults)) 244 244 { 245 245 CheckComArgSafeArrayNotNull(aNames); … … 249 249 CheckComArgSafeArrayNotNull(aDefaults); 250 250 251 AutoCaller autoCaller 252 CheckComRCReturnRC 253 254 /* this is const, no need to lock */ 255 com::SafeArray 256 com::SafeArray 257 com::SafeArray 258 com::SafeArray 259 com::SafeArray 251 AutoCaller autoCaller(this); 252 CheckComRCReturnRC(autoCaller.rc()); 253 254 /* this is const, no need to lock */ 255 com::SafeArray<BSTR> propertyNames (m.properties.size()); 256 com::SafeArray<BSTR> propertyDescriptions (m.properties.size()); 257 com::SafeArray<DataType_T> propertyTypes (m.properties.size()); 258 com::SafeArray<ULONG> propertyFlags (m.properties.size()); 259 com::SafeArray<BSTR> propertyDefaults (m.properties.size()); 260 260 261 261 int i = 0; … … 264 264 { 265 265 const Property &prop = (*it); 266 prop.name.cloneTo 267 prop.description.cloneTo 266 prop.name.cloneTo(&propertyNames [i]); 267 prop.description.cloneTo(&propertyDescriptions [i]); 268 268 propertyTypes [i] = prop.type; 269 269 propertyFlags [i] = prop.flags; 270 prop.defaultValue.cloneTo 270 prop.defaultValue.cloneTo(&propertyDefaults [i]); 271 271 } 272 272 273 propertyNames.detachTo (ComSafeArrayOutArg(aNames));274 propertyDescriptions.detachTo (ComSafeArrayOutArg(aDescriptions));275 propertyTypes.detachTo (ComSafeArrayOutArg(aTypes));276 propertyFlags.detachTo (ComSafeArrayOutArg(aFlags));277 propertyDefaults.detachTo (ComSafeArrayOutArg(aDefaults));273 propertyNames.detachTo(ComSafeArrayOutArg(aNames)); 274 propertyDescriptions.detachTo(ComSafeArrayOutArg(aDescriptions)); 275 propertyTypes.detachTo(ComSafeArrayOutArg(aTypes)); 276 propertyFlags.detachTo(ComSafeArrayOutArg(aFlags)); 277 propertyDefaults.detachTo(ComSafeArrayOutArg(aDefaults)); 278 278 279 279 return S_OK; -
trunk/src/VBox/Main/HardDiskImpl.cpp
r21806 r21878 64 64 VirtualBoxBaseProto::AutoCaller autoCaller; 65 65 66 ComObjPtr 66 ComObjPtr<Progress> progress; 67 67 Operation operation; 68 68 … … 250 250 for (iterator it = begin(); it != end(); ++ it) 251 251 { 252 AutoWriteLock alock 252 AutoWriteLock alock(*it); 253 253 Assert ((*it)->m.state == MediaState_LockedWrite || 254 254 (*it)->m.state == MediaState_Deleting); … … 268 268 { 269 269 HRESULT rc = aHardDisk->addCaller(); 270 CheckComRCReturnRC 271 272 AutoWriteLock alock 270 CheckComRCReturnRC(rc); 271 272 AutoWriteLock alock(aHardDisk); 273 273 274 274 if (mForward) … … 288 288 MediaState_T m; 289 289 rc = aHardDisk->COMGETTER(State)(&m); 290 CheckComRCReturnRC 290 CheckComRCReturnRC(rc); 291 291 /* go to Deleting */ 292 292 switch (m) … … 308 308 { 309 309 rc = aHardDisk->mParent->addCaller(); 310 CheckComRCReturnRC 310 CheckComRCReturnRC(rc); 311 311 312 312 mParent = aHardDisk->mParent; … … 320 320 { 321 321 rc = (*it)->addCaller(); 322 CheckComRCReturnRC 322 CheckComRCReturnRC(rc); 323 323 324 324 rc = (*it)->LockWrite (NULL); … … 339 339 { 340 340 HRESULT rc = aHardDisk->addCaller(); 341 CheckComRCReturnRC 342 343 AutoWriteLock alock 341 CheckComRCReturnRC(rc); 342 343 AutoWriteLock alock(aHardDisk); 344 344 345 345 if (!mForward) … … 369 369 { 370 370 HRESULT rc = aHardDisk->addCaller(); 371 CheckComRCReturnRC 372 373 AutoWriteLock alock 371 CheckComRCReturnRC(rc); 372 373 AutoWriteLock alock(aHardDisk); 374 374 375 375 rc = checkChildrenAndAttachments (aHardDisk); … … 401 401 402 402 HardDisk *source() const 403 { AssertReturn 403 { AssertReturn(size() > 0, NULL); return mForward ? front() : back(); } 404 404 405 405 HardDisk *target() const 406 { AssertReturn 406 { AssertReturn(size() > 0, NULL); return mForward ? back() : front(); } 407 407 408 408 protected: … … 467 467 468 468 /** Parent of the source when forward merge (if any) */ 469 ComObjPtr 469 ComObjPtr<HardDisk> mParent; 470 470 /** Children of the source when backward merge (if any) */ 471 471 List mChildren; … … 496 496 for (List::const_iterator it = begin(); it != end(); ++ it) 497 497 { 498 AutoWriteLock alock 498 AutoWriteLock alock(*it); 499 499 if (it == last) 500 500 { … … 521 521 { 522 522 HRESULT rc = aHardDisk->addCaller(); 523 CheckComRCReturnRC 523 CheckComRCReturnRC(rc); 524 524 525 525 push_front (aHardDisk); … … 540 540 MediaState_T mediaState; 541 541 rc = (*it)->LockRead(&mediaState); 542 CheckComRCReturnRC 542 CheckComRCReturnRC(rc); 543 543 544 544 if (mediaState == MediaState_Inaccessible) 545 545 { 546 546 rc = (*it)->COMGETTER(State) (&mediaState); 547 CheckComRCReturnRC 547 CheckComRCReturnRC(rc); 548 548 Assert (mediaState == MediaState_LockedRead); 549 549 … … 552 552 Bstr error; 553 553 rc = (*it)->COMGETTER(LastAccessError) (error.asOutParam()); 554 CheckComRCReturnRC 554 CheckComRCReturnRC(rc); 555 555 556 556 if (!error.isEmpty()) … … 575 575 576 576 eik.restore(); 577 CheckComRCReturnRC 577 CheckComRCReturnRC((HRESULT) mrc); 578 578 579 579 return S_OK; … … 597 597 else 598 598 rc = (*it)->LockRead(&mediaState); 599 CheckComRCReturnRC 599 CheckComRCReturnRC(rc); 600 600 601 601 if (mediaState == MediaState_Inaccessible) 602 602 { 603 603 rc = (*it)->COMGETTER(State) (&mediaState); 604 CheckComRCReturnRC 604 CheckComRCReturnRC(rc); 605 605 if (it == last) 606 606 Assert (mediaState == MediaState_LockedWrite); … … 612 612 Bstr error; 613 613 rc = (*it)->COMGETTER(LastAccessError) (error.asOutParam()); 614 CheckComRCReturnRC 614 CheckComRCReturnRC(rc); 615 615 616 616 if (!error.isEmpty()) … … 635 635 636 636 eik.restore(); 637 CheckComRCReturnRC 637 CheckComRCReturnRC((HRESULT) mrc); 638 638 639 639 return S_OK; … … 743 743 CBSTR aLocation) 744 744 { 745 AssertReturn 746 AssertReturn 745 AssertReturn(aVirtualBox != NULL, E_FAIL); 746 AssertReturn(aFormat != NULL && *aFormat != '\0', E_FAIL); 747 747 748 748 /* Enclose the state transition NotReady->InInit->Ready */ 749 AutoInitSpan autoInitSpan 750 AssertReturn 749 AutoInitSpan autoInitSpan(this); 750 AssertReturn(autoInitSpan.isOk(), E_FAIL); 751 751 752 752 HRESULT rc = S_OK; 753 753 754 754 /* share VirtualBox weakly (parent remains NULL so far) */ 755 unconst 755 unconst(mVirtualBox) = aVirtualBox; 756 756 757 757 /* register with VirtualBox early, since uninit() will … … 765 765 766 766 rc = setFormat (aFormat); 767 CheckComRCReturnRC 767 CheckComRCReturnRC(rc); 768 768 769 769 if (mm.formatObj->capabilities() & HardDiskFormatCapabilities_File) 770 770 { 771 771 rc = setLocation (aLocation); 772 CheckComRCReturnRC 772 CheckComRCReturnRC(rc); 773 773 } 774 774 else 775 775 { 776 776 rc = setLocation (aLocation); 777 CheckComRCReturnRC 777 CheckComRCReturnRC(rc); 778 778 779 779 /// @todo later we may want to use a pfnComposeLocation backend info … … 791 791 * Created state here and also add it to the registry */ 792 792 m.state = MediaState_Created; 793 unconst 793 unconst(m.id).create(); 794 794 rc = mVirtualBox->registerHardDisk (this); 795 795 … … 803 803 804 804 /* Confirm a successful initialization when it's the case */ 805 if (SUCCEEDED 805 if (SUCCEEDED(rc)) 806 806 autoInitSpan.setSucceeded(); 807 807 … … 837 837 const Guid &aParentId) 838 838 { 839 AssertReturn 840 AssertReturn 839 AssertReturn(aVirtualBox, E_INVALIDARG); 840 AssertReturn(aLocation, E_INVALIDARG); 841 841 842 842 /* Enclose the state transition NotReady->InInit->Ready */ 843 AutoInitSpan autoInitSpan 844 AssertReturn 843 AutoInitSpan autoInitSpan(this); 844 AssertReturn(autoInitSpan.isOk(), E_FAIL); 845 845 846 846 HRESULT rc = S_OK; 847 847 848 848 /* share VirtualBox weakly (parent remains NULL so far) */ 849 unconst 849 unconst(mVirtualBox) = aVirtualBox; 850 850 851 851 /* register with VirtualBox early, since uninit() will … … 860 860 861 861 rc = setLocation (aLocation); 862 CheckComRCReturnRC 862 CheckComRCReturnRC(rc); 863 863 864 864 /* save the new uuid values, will be used by queryInfo() */ … … 890 890 891 891 /* Confirm a successful initialization when it's the case */ 892 if (SUCCEEDED 892 if (SUCCEEDED(rc)) 893 893 autoInitSpan.setSucceeded(); 894 894 … … 912 912 using namespace settings; 913 913 914 AssertReturn 914 AssertReturn(aVirtualBox, E_INVALIDARG); 915 915 916 916 /* Enclose the state transition NotReady->InInit->Ready */ 917 AutoInitSpan autoInitSpan 918 AssertReturn 917 AutoInitSpan autoInitSpan(this); 918 AssertReturn(autoInitSpan.isOk(), E_FAIL); 919 919 920 920 HRESULT rc = S_OK; 921 921 922 922 /* share VirtualBox and parent weakly */ 923 unconst 923 unconst(mVirtualBox) = aVirtualBox; 924 924 925 925 /* register with VirtualBox/parent early, since uninit() will … … 942 942 943 943 /* required */ 944 unconst 944 unconst(m.id) = aNode.value <Guid> ("uuid"); 945 945 946 946 /* optional */ … … 953 953 /* required */ 954 954 Bstr format = aNode.stringValue ("format"); 955 AssertReturn 955 AssertReturn(!format.isNull(), E_FAIL); 956 956 rc = setFormat (format); 957 CheckComRCReturnRC 957 CheckComRCReturnRC(rc); 958 958 959 959 /* optional, only for diffs, default is false */ … … 979 979 Bstr location = aNode.stringValue ("location"); 980 980 rc = setLocation (location); 981 CheckComRCReturnRC 981 CheckComRCReturnRC(rc); 982 982 983 983 /* type is only for base hard disks */ … … 995 995 } 996 996 997 LogFlowThisFunc 997 LogFlowThisFunc(("m.locationFull='%ls', mm.format=%ls, m.id={%RTuuid}\n", 998 998 m.locationFull.raw(), mm.format.raw(), m.id.raw())); 999 999 … … 1020 1020 1021 1021 /* Confirm a successful initialization when it's the case */ 1022 if (SUCCEEDED 1022 if (SUCCEEDED(rc)) 1023 1023 autoInitSpan.setSucceeded(); 1024 1024 … … 1039 1039 { 1040 1040 /* Enclose the state transition Ready->InUninit->NotReady */ 1041 AutoUninitSpan autoUninitSpan 1041 AutoUninitSpan autoUninitSpan(this); 1042 1042 if (autoUninitSpan.uninitDone()) 1043 1043 return; … … 1075 1075 } 1076 1076 1077 unconst 1077 unconst(mVirtualBox).setNull(); 1078 1078 } 1079 1079 … … 1086 1086 return E_POINTER; 1087 1087 1088 AutoCaller autoCaller 1089 CheckComRCReturnRC 1088 AutoCaller autoCaller(this); 1089 CheckComRCReturnRC(autoCaller.rc()); 1090 1090 1091 1091 /* no need to lock, mm.format is const */ 1092 mm.format.cloneTo 1092 mm.format.cloneTo(aFormat); 1093 1093 1094 1094 return S_OK; … … 1100 1100 return E_POINTER; 1101 1101 1102 AutoCaller autoCaller 1103 CheckComRCReturnRC 1104 1105 AutoReadLock alock 1102 AutoCaller autoCaller(this); 1103 CheckComRCReturnRC(autoCaller.rc()); 1104 1105 AutoReadLock alock(this); 1106 1106 1107 1107 *aType = mm.type; … … 1112 1112 STDMETHODIMP HardDisk::COMSETTER(Type) (HardDiskType_T aType) 1113 1113 { 1114 AutoCaller autoCaller 1115 CheckComRCReturnRC 1114 AutoCaller autoCaller(this); 1115 CheckComRCReturnRC(autoCaller.rc()); 1116 1116 1117 1117 /* VirtualBox::saveSettings() needs a write lock */ … … 1183 1183 return E_POINTER; 1184 1184 1185 AutoCaller autoCaller 1186 CheckComRCReturnRC 1185 AutoCaller autoCaller(this); 1186 CheckComRCReturnRC(autoCaller.rc()); 1187 1187 1188 1188 /* we access mParent */ 1189 1189 AutoReadLock treeLock (this->treeLock()); 1190 1190 1191 mParent.queryInterfaceTo 1191 mParent.queryInterfaceTo(aParent); 1192 1192 1193 1193 return S_OK; 1194 1194 } 1195 1195 1196 STDMETHODIMP HardDisk::COMGETTER(Children) (ComSafeArrayOut 1197 { 1198 if (ComSafeArrayOutIsNull 1196 STDMETHODIMP HardDisk::COMGETTER(Children) (ComSafeArrayOut(IHardDisk *, aChildren)) 1197 { 1198 if (ComSafeArrayOutIsNull(aChildren)) 1199 1199 return E_POINTER; 1200 1200 1201 AutoCaller autoCaller 1202 CheckComRCReturnRC 1201 AutoCaller autoCaller(this); 1202 CheckComRCReturnRC(autoCaller.rc()); 1203 1203 1204 1204 /* we access children */ … … 1206 1206 1207 1207 SafeIfaceArray<IHardDisk> children (this->children()); 1208 children.detachTo (ComSafeArrayOutArg(aChildren));1208 children.detachTo(ComSafeArrayOutArg(aChildren)); 1209 1209 1210 1210 return S_OK; … … 1218 1218 /* root() will do callers/locking */ 1219 1219 1220 root().queryInterfaceTo 1220 root().queryInterfaceTo(aRoot); 1221 1221 1222 1222 return S_OK; … … 1228 1228 return E_POINTER; 1229 1229 1230 AutoCaller autoCaller 1231 CheckComRCReturnRC 1230 AutoCaller autoCaller(this); 1231 CheckComRCReturnRC(autoCaller.rc()); 1232 1232 1233 1233 /* isRadOnly() will do locking */ … … 1240 1240 STDMETHODIMP HardDisk::COMGETTER(LogicalSize) (ULONG64 *aLogicalSize) 1241 1241 { 1242 CheckComArgOutPointerValid 1243 1244 { 1245 AutoCaller autoCaller 1246 CheckComRCReturnRC 1247 1248 AutoReadLock alock 1242 CheckComArgOutPointerValid(aLogicalSize); 1243 1244 { 1245 AutoCaller autoCaller(this); 1246 CheckComRCReturnRC(autoCaller.rc()); 1247 1248 AutoReadLock alock(this); 1249 1249 1250 1250 /* we access mParent */ … … 1270 1270 STDMETHODIMP HardDisk::COMGETTER(AutoReset) (BOOL *aAutoReset) 1271 1271 { 1272 CheckComArgOutPointerValid 1273 1274 AutoCaller autoCaller 1275 CheckComRCReturnRC 1276 1277 AutoReadLock alock 1272 CheckComArgOutPointerValid(aAutoReset); 1273 1274 AutoCaller autoCaller(this); 1275 CheckComRCReturnRC(autoCaller.rc()); 1276 1277 AutoReadLock alock(this); 1278 1278 1279 1279 if (mParent.isNull()) … … 1287 1287 STDMETHODIMP HardDisk::COMSETTER(AutoReset) (BOOL aAutoReset) 1288 1288 { 1289 AutoCaller autoCaller 1290 CheckComRCReturnRC 1289 AutoCaller autoCaller(this); 1290 CheckComRCReturnRC(autoCaller.rc()); 1291 1291 1292 1292 /* VirtualBox::saveSettings() needs a write lock */ … … 1314 1314 { 1315 1315 CheckComArgStrNotEmptyOrNull (aName); 1316 CheckComArgOutPointerValid 1317 1318 AutoCaller autoCaller 1319 CheckComRCReturnRC 1320 1321 AutoReadLock alock 1316 CheckComArgOutPointerValid(aValue); 1317 1318 AutoCaller autoCaller(this); 1319 CheckComRCReturnRC(autoCaller.rc()); 1320 1321 AutoReadLock alock(this); 1322 1322 1323 1323 Data::PropertyMap::const_iterator it = mm.properties.find (Bstr (aName)); … … 1327 1327 1328 1328 if (it->second.isEmpty()) 1329 Bstr("").cloneTo 1329 Bstr("").cloneTo(aValue); 1330 1330 else 1331 it->second.cloneTo 1331 it->second.cloneTo(aValue); 1332 1332 1333 1333 return S_OK; … … 1338 1338 CheckComArgStrNotEmptyOrNull (aName); 1339 1339 1340 AutoCaller autoCaller 1341 CheckComRCReturnRC 1340 AutoCaller autoCaller(this); 1341 CheckComRCReturnRC(autoCaller.rc()); 1342 1342 1343 1343 /* VirtualBox::saveSettings() needs a write lock */ … … 1369 1369 1370 1370 STDMETHODIMP HardDisk::GetProperties(IN_BSTR aNames, 1371 ComSafeArrayOut 1372 ComSafeArrayOut 1373 { 1374 CheckComArgOutSafeArrayPointerValid 1375 CheckComArgOutSafeArrayPointerValid 1376 1377 AutoCaller autoCaller 1378 CheckComRCReturnRC 1379 1380 AutoReadLock alock 1371 ComSafeArrayOut(BSTR, aReturnNames), 1372 ComSafeArrayOut(BSTR, aReturnValues)) 1373 { 1374 CheckComArgOutSafeArrayPointerValid(aReturnNames); 1375 CheckComArgOutSafeArrayPointerValid(aReturnValues); 1376 1377 AutoCaller autoCaller(this); 1378 CheckComRCReturnRC(autoCaller.rc()); 1379 1380 AutoReadLock alock(this); 1381 1381 1382 1382 /// @todo make use of aNames according to the documentation 1383 1383 NOREF (aNames); 1384 1384 1385 com::SafeArray 1386 com::SafeArray 1385 com::SafeArray<BSTR> names (mm.properties.size()); 1386 com::SafeArray<BSTR> values (mm.properties.size()); 1387 1387 size_t i = 0; 1388 1388 … … 1390 1390 it != mm.properties.end(); ++ it) 1391 1391 { 1392 it->first.cloneTo 1392 it->first.cloneTo(&names [i]); 1393 1393 if (it->second.isEmpty()) 1394 1394 Bstr("").cloneTo(&values [i]); 1395 1395 else 1396 it->second.cloneTo 1396 it->second.cloneTo(&values [i]); 1397 1397 ++ i; 1398 1398 } 1399 1399 1400 names.detachTo (ComSafeArrayOutArg(aReturnNames));1401 values.detachTo (ComSafeArrayOutArg(aReturnValues));1400 names.detachTo(ComSafeArrayOutArg(aReturnNames)); 1401 values.detachTo(ComSafeArrayOutArg(aReturnValues)); 1402 1402 1403 1403 return S_OK; … … 1410 1410 CheckComArgSafeArrayNotNull (aValues); 1411 1411 1412 AutoCaller autoCaller 1413 CheckComRCReturnRC 1412 AutoCaller autoCaller(this); 1413 CheckComRCReturnRC(autoCaller.rc()); 1414 1414 1415 1415 /* VirtualBox::saveSettings() needs a write lock */ 1416 1416 AutoMultiWriteLock2 alock (mVirtualBox, this); 1417 1417 1418 com::SafeArray 1419 com::SafeArray 1418 com::SafeArray<IN_BSTR> names (ComSafeArrayInArg (aNames)); 1419 com::SafeArray<IN_BSTR> values (ComSafeArrayInArg (aValues)); 1420 1420 1421 1421 /* first pass: validate names */ … … 1431 1431 { 1432 1432 Data::PropertyMap::iterator it = mm.properties.find (Bstr (names [i])); 1433 AssertReturn 1433 AssertReturn(it != mm.properties.end(), E_FAIL); 1434 1434 1435 1435 if (values[i] && !*values[i]) … … 1448 1448 IProgress **aProgress) 1449 1449 { 1450 CheckComArgOutPointerValid 1451 1452 AutoCaller autoCaller 1453 CheckComRCReturnRC 1454 1455 AutoWriteLock alock 1450 CheckComArgOutPointerValid(aProgress); 1451 1452 AutoCaller autoCaller(this); 1453 CheckComRCReturnRC(autoCaller.rc()); 1454 1455 AutoWriteLock alock(this); 1456 1456 1457 1457 aVariant = (HardDiskVariant_T)((unsigned)aVariant & (unsigned)~HardDiskVariant_Diff); … … 1475 1475 } 1476 1476 1477 ComObjPtr 1477 ComObjPtr<Progress> progress; 1478 1478 progress.createObject(); 1479 1479 /// @todo include fixed/dynamic … … 1483 1483 : BstrFmt (tr ("Creating dynamic hard disk storage unit '%ls'"), m.locationFull.raw()), 1484 1484 TRUE /* aCancelable */); 1485 CheckComRCReturnRC 1485 CheckComRCReturnRC(rc); 1486 1486 1487 1487 /* setup task object and thread to carry out the operation … … 1489 1489 1490 1490 std::auto_ptr <Task> task (new Task (this, progress, Task::CreateBase)); 1491 AssertComRCReturnRC 1491 AssertComRCReturnRC(task->autoCaller.rc()); 1492 1492 1493 1493 task->d.size = aLogicalSize; … … 1495 1495 1496 1496 rc = task->startThread(); 1497 CheckComRCReturnRC 1497 CheckComRCReturnRC(rc); 1498 1498 1499 1499 /* go to Creating state on success */ … … 1504 1504 1505 1505 /* return progress to the caller */ 1506 progress.queryInterfaceTo 1506 progress.queryInterfaceTo(aProgress); 1507 1507 1508 1508 return S_OK; … … 1511 1511 STDMETHODIMP HardDisk::DeleteStorage (IProgress **aProgress) 1512 1512 { 1513 CheckComArgOutPointerValid 1514 1515 AutoCaller autoCaller 1516 CheckComRCReturnRC 1517 1518 ComObjPtr 1513 CheckComArgOutPointerValid(aProgress); 1514 1515 AutoCaller autoCaller(this); 1516 CheckComRCReturnRC(autoCaller.rc()); 1517 1518 ComObjPtr<Progress> progress; 1519 1519 1520 1520 HRESULT rc = deleteStorageNoWait (progress); 1521 if (SUCCEEDED 1521 if (SUCCEEDED(rc)) 1522 1522 { 1523 1523 /* return progress to the caller */ 1524 progress.queryInterfaceTo 1524 progress.queryInterfaceTo(aProgress); 1525 1525 } 1526 1526 … … 1533 1533 { 1534 1534 CheckComArgNotNull (aTarget); 1535 CheckComArgOutPointerValid 1536 1537 AutoCaller autoCaller 1538 CheckComRCReturnRC 1535 CheckComArgOutPointerValid(aProgress); 1536 1537 AutoCaller autoCaller(this); 1538 CheckComRCReturnRC(autoCaller.rc()); 1539 1539 1540 1540 ComObjPtr<HardDisk> diff; 1541 1541 HRESULT rc = mVirtualBox->cast (aTarget, diff); 1542 CheckComRCReturnRC 1543 1544 AutoWriteLock alock 1542 CheckComRCReturnRC(rc); 1543 1544 AutoWriteLock alock(this); 1545 1545 1546 1546 if (mm.type == HardDiskType_Writethrough) … … 1552 1552 * created */ 1553 1553 rc = LockRead (NULL); 1554 CheckComRCReturnRC 1555 1556 ComObjPtr 1554 CheckComRCReturnRC(rc); 1555 1556 ComObjPtr<Progress> progress; 1557 1557 1558 1558 rc = createDiffStorageNoWait (diff, aVariant, progress); … … 1566 1566 { 1567 1567 /* return progress to the caller */ 1568 progress.queryInterfaceTo 1568 progress.queryInterfaceTo(aProgress); 1569 1569 } 1570 1570 … … 1574 1574 STDMETHODIMP HardDisk::MergeTo (IN_BSTR /* aTargetId */, IProgress ** /* aProgress */) 1575 1575 { 1576 AutoCaller autoCaller 1577 CheckComRCReturnRC 1576 AutoCaller autoCaller(this); 1577 CheckComRCReturnRC(autoCaller.rc()); 1578 1578 1579 1579 ReturnComNotImplemented(); … … 1586 1586 { 1587 1587 CheckComArgNotNull (aTarget); 1588 CheckComArgOutPointerValid 1589 1590 AutoCaller autoCaller 1591 CheckComRCReturnRC 1592 1593 ComObjPtr 1588 CheckComArgOutPointerValid(aProgress); 1589 1590 AutoCaller autoCaller(this); 1591 CheckComRCReturnRC(autoCaller.rc()); 1592 1593 ComObjPtr<HardDisk> target; 1594 1594 HRESULT rc = mVirtualBox->cast (aTarget, target); 1595 CheckComRCReturnRC 1596 ComObjPtr 1595 CheckComRCReturnRC(rc); 1596 ComObjPtr<HardDisk> parent; 1597 1597 if (aParent) 1598 1598 { 1599 1599 rc = mVirtualBox->cast (aParent, parent); 1600 CheckComRCReturnRC 1600 CheckComRCReturnRC(rc); 1601 1601 } 1602 1602 1603 1603 AutoMultiWriteLock3 alock (this, target, parent); 1604 1604 1605 ComObjPtr 1605 ComObjPtr<Progress> progress; 1606 1606 1607 1607 try … … 1689 1689 } 1690 1690 1691 if (SUCCEEDED 1691 if (SUCCEEDED(rc)) 1692 1692 { 1693 1693 /* return progress to the caller */ 1694 progress.queryInterfaceTo 1694 progress.queryInterfaceTo(aProgress); 1695 1695 } 1696 1696 … … 1700 1700 STDMETHODIMP HardDisk::Compact (IProgress **aProgress) 1701 1701 { 1702 CheckComArgOutPointerValid 1703 1704 AutoCaller autoCaller 1705 CheckComRCReturnRC 1706 1707 AutoWriteLock alock 1708 1709 ComObjPtr 1702 CheckComArgOutPointerValid(aProgress); 1703 1704 AutoCaller autoCaller(this); 1705 CheckComRCReturnRC(autoCaller.rc()); 1706 1707 AutoWriteLock alock(this); 1708 1709 ComObjPtr<Progress> progress; 1710 1710 1711 1711 HRESULT rc = S_OK; … … 1755 1755 } 1756 1756 1757 if (SUCCEEDED 1757 if (SUCCEEDED(rc)) 1758 1758 { 1759 1759 /* return progress to the caller */ 1760 progress.queryInterfaceTo 1760 progress.queryInterfaceTo(aProgress); 1761 1761 } 1762 1762 … … 1766 1766 STDMETHODIMP HardDisk::Reset (IProgress **aProgress) 1767 1767 { 1768 CheckComArgOutPointerValid 1769 1770 AutoCaller autoCaller 1771 CheckComRCReturnRC 1772 1773 AutoWriteLock alock 1768 CheckComArgOutPointerValid(aProgress); 1769 1770 AutoCaller autoCaller(this); 1771 CheckComRCReturnRC(autoCaller.rc()); 1772 1773 AutoWriteLock alock(this); 1774 1774 1775 1775 if (mParent.isNull()) … … 1779 1779 1780 1780 HRESULT rc = canClose(); 1781 CheckComRCReturnRC 1781 CheckComRCReturnRC(rc); 1782 1782 1783 1783 rc = LockWrite (NULL); 1784 CheckComRCReturnRC 1785 1786 ComObjPtr 1784 CheckComRCReturnRC(rc); 1785 1786 ComObjPtr<Progress> progress; 1787 1787 1788 1788 try … … 1821 1821 { 1822 1822 /* return progress to the caller */ 1823 progress.queryInterfaceTo 1823 progress.queryInterfaceTo(aProgress); 1824 1824 } 1825 1825 … … 1845 1845 AssertReturnVoid (aNewPath); 1846 1846 1847 AutoCaller autoCaller 1847 AutoCaller autoCaller(this); 1848 1848 AssertComRCReturnVoid (autoCaller.rc()); 1849 1849 1850 AutoWriteLock alock 1850 AutoWriteLock alock(this); 1851 1851 1852 1852 /* we access children() */ … … 1876 1876 * @note Locks treeLock() for reading. 1877 1877 */ 1878 ComObjPtr 1879 { 1880 ComObjPtr 1878 ComObjPtr<HardDisk> HardDisk::root (uint32_t *aLevel /*= NULL*/) 1879 { 1880 ComObjPtr<HardDisk> root; 1881 1881 uint32_t level; 1882 1882 1883 AutoCaller autoCaller 1884 AssertReturn 1883 AutoCaller autoCaller(this); 1884 AssertReturn(autoCaller.isOk(), root); 1885 1885 1886 1886 /* we access mParent */ … … 1895 1895 { 1896 1896 AutoCaller rootCaller (root); 1897 AssertReturn 1897 AssertReturn(rootCaller.isOk(), root); 1898 1898 1899 1899 if (root->mParent.isNull()) … … 1920 1920 bool HardDisk::isReadOnly() 1921 1921 { 1922 AutoCaller autoCaller 1922 AutoCaller autoCaller(this); 1923 1923 AssertComRCReturn (autoCaller.rc(), false); 1924 1924 1925 AutoReadLock alock 1925 AutoReadLock alock(this); 1926 1926 1927 1927 /* we access children */ … … 1969 1969 using namespace settings; 1970 1970 1971 AssertReturn 1972 1973 AutoCaller autoCaller 1974 CheckComRCReturnRC 1975 1976 AutoReadLock alock 1971 AssertReturn(!aParentNode.isNull(), E_FAIL); 1972 1973 AutoCaller autoCaller(this); 1974 CheckComRCReturnRC(autoCaller.rc()); 1975 1976 AutoReadLock alock(this); 1977 1977 1978 1978 /* we access mParent */ … … 2026 2026 { 2027 2027 HRESULT rc = (*it)->saveSettings (diskNode); 2028 AssertComRCReturnRC 2028 AssertComRCReturnRC(rc); 2029 2029 } 2030 2030 … … 2046 2046 HRESULT HardDisk::compareLocationTo (const char *aLocation, int &aResult) 2047 2047 { 2048 AutoCaller autoCaller 2049 AssertComRCReturnRC 2050 2051 AutoReadLock alock 2048 AutoCaller autoCaller(this); 2049 AssertComRCReturnRC(autoCaller.rc()); 2050 2051 AutoReadLock alock(this); 2052 2052 2053 2053 Utf8Str locationFull (m.locationFull); … … 2070 2070 2071 2071 int vrc = mVirtualBox->calculateFullPath (location, location); 2072 if (RT_FAILURE 2072 if (RT_FAILURE(vrc)) 2073 2073 return setError (E_FAIL, 2074 2074 tr ("Invalid hard disk storage file location '%s' (%Rrc)"), … … 2120 2120 HRESULT HardDisk::prepareDiscard (MergeChain * &aChain) 2121 2121 { 2122 AutoCaller autoCaller 2123 AssertComRCReturnRC 2122 AutoCaller autoCaller(this); 2123 AssertComRCReturnRC(autoCaller.rc()); 2124 2124 2125 2125 aChain = NULL; 2126 2126 2127 AutoWriteLock alock 2127 AutoWriteLock alock(this); 2128 2128 2129 2129 /* we access mParent & children() */ 2130 2130 AutoReadLock treeLock (this->treeLock()); 2131 2131 2132 AssertReturn 2132 AssertReturn(mm.type == HardDiskType_Normal, E_FAIL); 2133 2133 2134 2134 if (children().size() == 0) … … 2170 2170 * time when discard() is called, there must be no any attachments at all 2171 2171 * (the code calling prepareDiscard() should detach). */ 2172 AssertReturn 2172 AssertReturn(m.backRefs.size() == 1 && 2173 2173 !m.backRefs.front().inCurState && 2174 2174 m.backRefs.front().snapshotIds.size() == 1, E_FAIL); … … 2248 2248 * reading or writing. 2249 2249 */ 2250 HRESULT HardDisk::discard (ComObjPtr 2251 { 2252 AssertReturn 2253 2254 ComObjPtr 2250 HRESULT HardDisk::discard (ComObjPtr<Progress> &aProgress, MergeChain *aChain) 2251 { 2252 AssertReturn(!aProgress.isNull(), E_FAIL); 2253 2254 ComObjPtr<HardDisk> hdFrom; 2255 2255 2256 2256 HRESULT rc = S_OK; 2257 2257 2258 2258 { 2259 AutoCaller autoCaller 2260 AssertComRCReturnRC 2259 AutoCaller autoCaller(this); 2260 AssertComRCReturnRC(autoCaller.rc()); 2261 2261 2262 2262 aProgress->setNextOperation(BstrFmt(tr("Discarding hard disk '%s'"), name().raw()), … … 2265 2265 if (aChain == NULL) 2266 2266 { 2267 AutoWriteLock alock 2267 AutoWriteLock alock(this); 2268 2268 2269 2269 /* we access mParent & children() */ … … 2300 2300 } 2301 2301 2302 if (SUCCEEDED 2302 if (SUCCEEDED(rc)) 2303 2303 { 2304 2304 /* mergeToAndWait() cannot uninitialize the initiator because of … … 2323 2323 void HardDisk::cancelDiscard (MergeChain *aChain) 2324 2324 { 2325 AutoCaller autoCaller 2325 AutoCaller autoCaller(this); 2326 2326 AssertComRCReturnVoid (autoCaller.rc()); 2327 2327 2328 2328 if (aChain == NULL) 2329 2329 { 2330 AutoWriteLock alock 2330 AutoWriteLock alock(this); 2331 2331 2332 2332 /* we access mParent & children() */ … … 2364 2364 Bstr format; 2365 2365 2366 AutoCaller autoCaller 2366 AutoCaller autoCaller(this); 2367 2367 AssertComRCReturn (autoCaller.rc(), format); 2368 2368 … … 2406 2406 * writing. 2407 2407 */ 2408 HRESULT HardDisk::deleteStorage (ComObjPtr 2409 { 2410 AssertReturn 2408 HRESULT HardDisk::deleteStorage (ComObjPtr<Progress> *aProgress, bool aWait) 2409 { 2410 AssertReturn(aProgress != NULL || aWait == true, E_FAIL); 2411 2411 2412 2412 /* unregisterWithVirtualBox() needs a write lock. We want to unregister … … 2418 2418 AutoWriteLock vboxLock (mVirtualBox); 2419 2419 2420 AutoWriteLock alock 2420 AutoWriteLock alock(this); 2421 2421 2422 2422 if (!(mm.formatObj->capabilities() & … … 2449 2449 2450 2450 HRESULT rc = canClose(); 2451 CheckComRCReturnRC 2451 CheckComRCReturnRC(rc); 2452 2452 2453 2453 /* go to Deleting state before leaving the lock */ … … 2470 2470 m.state = MediaState_Created; 2471 2471 2472 CheckComRCReturnRC 2473 2474 ComObjPtr 2472 CheckComRCReturnRC(rc); 2473 2474 ComObjPtr<Progress> progress; 2475 2475 2476 2476 if (aProgress != NULL) … … 2487 2487 m.locationFull.raw()), 2488 2488 FALSE /* aCancelable */); 2489 CheckComRCReturnRC 2489 CheckComRCReturnRC(rc); 2490 2490 } 2491 2491 } 2492 2492 2493 2493 std::auto_ptr <Task> task (new Task (this, progress, Task::Delete)); 2494 AssertComRCReturnRC 2494 AssertComRCReturnRC(task->autoCaller.rc()); 2495 2495 2496 2496 if (aWait) … … 2504 2504 { 2505 2505 rc = task->startThread(); 2506 CheckComRCReturnRC 2506 CheckComRCReturnRC(rc); 2507 2507 2508 2508 /* go to Deleting state before leaving the lock */ … … 2562 2562 bool aWait) 2563 2563 { 2564 AssertReturn 2565 AssertReturn 2566 2567 AutoCaller autoCaller 2568 CheckComRCReturnRC 2564 AssertReturn(!aTarget.isNull(), E_FAIL); 2565 AssertReturn(aProgress != NULL || aWait == true, E_FAIL); 2566 2567 AutoCaller autoCaller(this); 2568 CheckComRCReturnRC(autoCaller.rc()); 2569 2569 2570 2570 AutoCaller targetCaller (aTarget); 2571 CheckComRCReturnRC 2571 CheckComRCReturnRC(targetCaller.rc()); 2572 2572 2573 2573 AutoMultiWriteLock2 alock (this, aTarget); 2574 2574 2575 AssertReturn 2575 AssertReturn(mm.type != HardDiskType_Writethrough, E_FAIL); 2576 2576 2577 2577 /* Note: MediaState_LockedWrite is ok when taking an online snapshot */ 2578 AssertReturn 2578 AssertReturn(m.state == MediaState_LockedRead || 2579 2579 m.state == MediaState_LockedWrite, E_FAIL); 2580 2580 … … 2610 2610 } 2611 2611 2612 ComObjPtr 2612 ComObjPtr<Progress> progress; 2613 2613 2614 2614 if (aProgress != NULL) … … 2625 2625 aTarget->m.locationFull.raw()), 2626 2626 TRUE /* aCancelable */); 2627 CheckComRCReturnRC 2627 CheckComRCReturnRC(rc); 2628 2628 } 2629 2629 } … … 2633 2633 2634 2634 std::auto_ptr <Task> task (new Task (this, progress, Task::CreateDiff)); 2635 AssertComRCReturnRC 2635 AssertComRCReturnRC(task->autoCaller.rc()); 2636 2636 2637 2637 task->setData (aTarget); … … 2652 2652 { 2653 2653 rc = task->startThread(); 2654 CheckComRCReturnRC 2654 CheckComRCReturnRC(rc); 2655 2655 2656 2656 /* go to Creating state before leaving the lock */ … … 2697 2697 bool aIgnoreAttachments /*= false*/) 2698 2698 { 2699 AssertReturn 2700 2701 AutoCaller autoCaller 2702 AssertComRCReturnRC 2699 AssertReturn(aTarget != NULL, E_FAIL); 2700 2701 AutoCaller autoCaller(this); 2702 AssertComRCReturnRC(autoCaller.rc()); 2703 2703 2704 2704 AutoCaller targetCaller (aTarget); 2705 AssertComRCReturnRC 2705 AssertComRCReturnRC(targetCaller.rc()); 2706 2706 2707 2707 aChain = NULL; … … 2731 2731 Bstr tgtLoc; 2732 2732 { 2733 AutoReadLock alock 2733 AutoReadLock alock(this); 2734 2734 tgtLoc = aTarget->locationFull(); 2735 2735 } 2736 2736 2737 AutoReadLock alock 2737 AutoReadLock alock(this); 2738 2738 return setError (E_FAIL, 2739 2739 tr ("Hard disks '%ls' and '%ls' are unrelated"), … … 2758 2758 else 2759 2759 rc = chain->addIntermediate (last); 2760 CheckComRCReturnRC 2760 CheckComRCReturnRC(rc); 2761 2761 2762 2762 if (last == first) … … 2843 2843 */ 2844 2844 HRESULT HardDisk::mergeTo(MergeChain *aChain, 2845 ComObjPtr 2845 ComObjPtr<Progress> *aProgress, 2846 2846 bool aWait) 2847 2847 { 2848 AssertReturn 2849 AssertReturn 2850 2851 AutoCaller autoCaller 2852 CheckComRCReturnRC 2848 AssertReturn(aChain != NULL, E_FAIL); 2849 AssertReturn(aProgress != NULL || aWait == true, E_FAIL); 2850 2851 AutoCaller autoCaller(this); 2852 CheckComRCReturnRC(autoCaller.rc()); 2853 2853 2854 2854 HRESULT rc = S_OK; 2855 2855 2856 ComObjPtr 2856 ComObjPtr<Progress> progress; 2857 2857 2858 2858 if (aProgress != NULL) … … 2864 2864 if (progress.isNull()) 2865 2865 { 2866 AutoReadLock alock 2866 AutoReadLock alock(this); 2867 2867 2868 2868 progress.createObject(); … … 2871 2871 name().raw(), aChain->target()->name().raw()), 2872 2872 TRUE /* aCancelable */); 2873 CheckComRCReturnRC 2873 CheckComRCReturnRC(rc); 2874 2874 } 2875 2875 } … … 2879 2879 2880 2880 std::auto_ptr <Task> task (new Task (this, progress, Task::Merge)); 2881 AssertComRCReturnRC 2881 AssertComRCReturnRC(task->autoCaller.rc()); 2882 2882 2883 2883 task->setData (aChain); … … 2895 2895 { 2896 2896 rc = task->startThread(); 2897 CheckComRCReturnRC 2897 CheckComRCReturnRC(rc); 2898 2898 } 2899 2899 … … 2920 2920 void HardDisk::cancelMergeTo (MergeChain *aChain) 2921 2921 { 2922 AutoCaller autoCaller 2922 AutoCaller autoCaller(this); 2923 2923 AssertComRCReturnVoid (autoCaller.rc()); 2924 2924 … … 2958 2958 CheckComArgStrNotEmptyOrNull (aLocation); 2959 2959 2960 AutoCaller autoCaller 2961 AssertComRCReturnRC 2960 AutoCaller autoCaller(this); 2961 AssertComRCReturnRC(autoCaller.rc()); 2962 2962 2963 2963 /* formatObj may be null only when initializing from an existing path and 2964 2964 * no format is known yet */ 2965 AssertReturn 2965 AssertReturn((!mm.format.isNull() && !mm.formatObj.isNull()) || 2966 2966 (autoCaller.state() == InInit && 2967 2967 m.state != MediaState_NotCreated && m.id.isEmpty() && … … 3020 3020 Utf8Str locationFull; 3021 3021 int vrc = mVirtualBox->calculateFullPath (location, locationFull); 3022 if (RT_FAILURE 3022 if (RT_FAILURE(vrc)) 3023 3023 return setError (VBOX_E_FILE_ERROR, 3024 3024 tr ("Invalid hard disk storage file location '%s' (%Rrc)"), … … 3034 3034 RTFILE file; 3035 3035 vrc = RTFileOpen (&file, locationFull, RTFILE_O_READ); 3036 if (RT_SUCCESS 3036 if (RT_SUCCESS(vrc)) 3037 3037 RTFileClose (file); 3038 3038 } 3039 if (RT_SUCCESS 3039 if (RT_SUCCESS(vrc)) 3040 3040 { 3041 3041 vrc = VDGetFormat (locationFull, &backendName); … … 3048 3048 } 3049 3049 3050 if (RT_FAILURE 3050 if (RT_FAILURE(vrc)) 3051 3051 { 3052 3052 if (vrc == VERR_FILE_NOT_FOUND || vrc == VERR_PATH_NOT_FOUND) … … 3067 3067 /* setFormat() must not fail since we've just used the backend so 3068 3068 * the format object must be there */ 3069 AssertComRCReturnRC 3069 AssertComRCReturnRC(rc); 3070 3070 } 3071 3071 … … 3082 3082 * also do that if we didn't generate it to make sure it is 3083 3083 * either generated by us or reset to null */ 3084 unconst 3084 unconst(m.id) = id; 3085 3085 } 3086 3086 } … … 3115 3115 AutoReadLock propsLock (mVirtualBox->systemProperties()); 3116 3116 3117 unconst 3117 unconst(mm.formatObj) 3118 3118 = mVirtualBox->systemProperties()->hardDiskFormat (aFormat); 3119 3119 if (mm.formatObj.isNull()) … … 3124 3124 * uninitialization */ 3125 3125 HRESULT rc = mm.formatObj->addCaller(); 3126 AssertComRCReturnRC 3126 AssertComRCReturnRC(rc); 3127 3127 3128 3128 /* get properties (preinsert them as keys in the map). Note that the … … 3141 3141 } 3142 3142 3143 unconst 3143 unconst(mm.format) = aFormat; 3144 3144 3145 3145 return S_OK; … … 3164 3164 HRESULT HardDisk::queryInfo() 3165 3165 { 3166 AutoWriteLock alock 3167 3168 AssertReturn 3166 AutoWriteLock alock(this); 3167 3168 AssertReturn(m.state == MediaState_Created || 3169 3169 m.state == MediaState_Inaccessible || 3170 3170 m.state == MediaState_LockedRead || … … 3257 3257 flags, 3258 3258 mm.vdDiskIfaces); 3259 if (RT_FAILURE 3259 if (RT_FAILURE(vrc)) 3260 3260 { 3261 3261 lastAccessError = Utf8StrFmt ( … … 3517 3517 const ComObjPtr<HardDisk, ComWeakRef> parent = mParent; 3518 3518 3519 AssertReturn 3519 AssertReturn(children().size() == 0, E_FAIL); 3520 3520 3521 3521 if (!mParent.isNull()) … … 3623 3623 { 3624 3624 HardDisk *that = static_cast<HardDisk*>(pvUser); 3625 AssertReturn 3625 AssertReturn(that != NULL, VERR_GENERAL_FAILURE); 3626 3626 3627 3627 if (that->mm.vdProgress != NULL) … … 3647 3647 { 3648 3648 HardDisk *that = static_cast<HardDisk*>(pvUser); 3649 AssertReturn 3649 AssertReturn(that != NULL, false); 3650 3650 3651 3651 /* we always return true since the only keys we have are those found in … … 3658 3658 size_t *pcbValue) 3659 3659 { 3660 AssertReturn 3660 AssertReturn(VALID_PTR (pcbValue), VERR_INVALID_POINTER); 3661 3661 3662 3662 HardDisk *that = static_cast<HardDisk*>(pvUser); 3663 AssertReturn 3663 AssertReturn(that != NULL, VERR_GENERAL_FAILURE); 3664 3664 3665 3665 Data::PropertyMap::const_iterator it = … … 3681 3681 char *pszValue, size_t cchValue) 3682 3682 { 3683 AssertReturn 3683 AssertReturn(VALID_PTR (pszValue), VERR_INVALID_POINTER); 3684 3684 3685 3685 HardDisk *that = static_cast<HardDisk*>(pvUser); 3686 AssertReturn 3686 AssertReturn(that != NULL, VERR_GENERAL_FAILURE); 3687 3687 3688 3688 Data::PropertyMap::const_iterator it = … … 3716 3716 { 3717 3717 std::auto_ptr <Task> task (static_cast <Task *> (pvUser)); 3718 AssertReturn 3718 AssertReturn(task.get(), VERR_GENERAL_FAILURE); 3719 3719 3720 3720 bool isAsync = thread != NIL_RTTHREAD; … … 3753 3753 id.create(); 3754 3754 /* VirtualBox::registerHardDisk() will need UUID */ 3755 unconst 3755 unconst(that->m.id) = id; 3756 3756 } 3757 3757 … … 3788 3788 NULL, that->mm.vdDiskIfaces); 3789 3789 3790 if (RT_FAILURE 3790 if (RT_FAILURE(vrc)) 3791 3791 { 3792 3792 throw setError (E_FAIL, … … 3804 3804 catch (HRESULT aRC) { rc = aRC; } 3805 3805 3806 if (SUCCEEDED 3806 if (SUCCEEDED(rc)) 3807 3807 { 3808 3808 /* register with mVirtualBox as the last step and move to … … 3814 3814 thatLock.maybeEnter(); 3815 3815 3816 if (SUCCEEDED 3816 if (SUCCEEDED(rc)) 3817 3817 { 3818 3818 that->m.state = MediaState_Created; … … 3828 3828 /* reset UUID to prevent it from being reused next time */ 3829 3829 if (generateUuid) 3830 unconst 3830 unconst(that->m.id).clear(); 3831 3831 } 3832 3832 … … 3855 3855 targetId.create(); 3856 3856 /* VirtualBox::registerHardDisk() will need UUID */ 3857 unconst 3857 unconst(target->m.id) = targetId; 3858 3858 } 3859 3859 … … 3886 3886 VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO, 3887 3887 that->mm.vdDiskIfaces); 3888 if (RT_FAILURE 3888 if (RT_FAILURE(vrc)) 3889 3889 { 3890 3890 throw setError (E_FAIL, … … 3912 3912 that->mm.vdProgress = NULL; 3913 3913 3914 if (RT_FAILURE 3914 if (RT_FAILURE(vrc)) 3915 3915 { 3916 3916 throw setError (E_FAIL, … … 3928 3928 catch (HRESULT aRC) { rc = aRC; } 3929 3929 3930 if (SUCCEEDED 3930 if (SUCCEEDED(rc)) 3931 3931 { 3932 3932 /* we set mParent & children() (note that thatLock is released … … 3964 3964 thatLock.maybeEnter(); 3965 3965 3966 if (SUCCEEDED 3966 if (SUCCEEDED(rc)) 3967 3967 { 3968 3968 target->m.state = MediaState_Created; … … 3980 3980 /* reset UUID to prevent it from being reused next time */ 3981 3981 if (generateUuid) 3982 unconst 3982 unconst(target->m.id).clear(); 3983 3983 } 3984 3984 … … 4062 4062 VD_OPEN_FLAGS_INFO : 0, 4063 4063 (*it)->mm.vdDiskIfaces); 4064 if (RT_FAILURE 4064 if (RT_FAILURE(vrc)) 4065 4065 throw vrc; 4066 4066 #if 0 … … 4084 4084 that->mm.vdProgress = NULL; 4085 4085 4086 if (RT_FAILURE 4086 if (RT_FAILURE(vrc)) 4087 4087 throw vrc; 4088 4088 … … 4095 4095 * is the only image in the container on success) */ 4096 4096 vrc = VDSetParentUuid (hdd, 0, chain->parent()->m.id); 4097 if (RT_FAILURE 4097 if (RT_FAILURE(vrc)) 4098 4098 throw vrc; 4099 4099 } … … 4113 4113 VD_OPEN_FLAGS_INFO, 4114 4114 (*it)->mm.vdDiskIfaces); 4115 if (RT_FAILURE 4115 if (RT_FAILURE(vrc)) 4116 4116 throw vrc; 4117 4117 4118 4118 vrc = VDSetParentUuid (hdd, 1, 4119 4119 chain->target()->m.id); 4120 if (RT_FAILURE 4120 if (RT_FAILURE(vrc)) 4121 4121 throw vrc; 4122 4122 4123 4123 vrc = VDClose (hdd, false /* fDelete */); 4124 if (RT_FAILURE 4124 if (RT_FAILURE(vrc)) 4125 4125 throw vrc; 4126 4126 } … … 4146 4146 bool saveSettingsFailed = false; 4147 4147 4148 if (SUCCEEDED 4148 if (SUCCEEDED(rc)) 4149 4149 { 4150 4150 /* all hard disks but the target were successfully deleted by … … 4221 4221 rc = that->mVirtualBox->saveSettings(); 4222 4222 4223 if (SUCCEEDED 4223 if (SUCCEEDED(rc)) 4224 4224 { 4225 4225 /* unregister and uninitialize all hard disks in the chain … … 4330 4330 targetId.create(); 4331 4331 /* VirtualBox::registerHardDisk() will need UUID */ 4332 unconst 4332 unconst(target->m.id) = targetId; 4333 4333 } 4334 4334 … … 4353 4353 VD_OPEN_FLAGS_READONLY, 4354 4354 (*it)->mm.vdDiskIfaces); 4355 if (RT_FAILURE 4355 if (RT_FAILURE(vrc)) 4356 4356 { 4357 4357 throw setError (E_FAIL, … … 4399 4399 ((*it)->m.state == MediaState_LockedWrite) ? VD_OPEN_FLAGS_NORMAL : VD_OPEN_FLAGS_READONLY, 4400 4400 (*it)->mm.vdDiskIfaces); 4401 if (RT_FAILURE 4401 if (RT_FAILURE(vrc)) 4402 4402 { 4403 4403 throw setError (E_FAIL, … … 4418 4418 that->mm.vdProgress = NULL; 4419 4419 4420 if (RT_FAILURE 4420 if (RT_FAILURE(vrc)) 4421 4421 { 4422 4422 throw setError (E_FAIL, … … 4440 4440 if (target->m.state == MediaState_Creating) 4441 4441 { 4442 if (SUCCEEDED 4442 if (SUCCEEDED(rc)) 4443 4443 { 4444 4444 /* we set mParent & children() (note that thatLock is released … … 4482 4482 if (target->m.state == MediaState_Creating) 4483 4483 { 4484 if (SUCCEEDED 4484 if (SUCCEEDED(rc)) 4485 4485 { 4486 4486 target->m.state = MediaState_Created; … … 4496 4496 /* reset UUID to prevent it from being reused next time */ 4497 4497 if (generateUuid) 4498 unconst 4498 unconst(target->m.id).clear(); 4499 4499 } 4500 4500 } … … 4536 4536 VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO, 4537 4537 that->mm.vdDiskIfaces); 4538 if (RT_SUCCESS 4538 if (RT_SUCCESS(vrc)) 4539 4539 vrc = VDClose (hdd, true /* fDelete */); 4540 4540 4541 if (RT_FAILURE 4541 if (RT_FAILURE(vrc)) 4542 4542 { 4543 4543 throw setError (E_FAIL, … … 4562 4562 4563 4563 /* Reset UUID to prevent Create* from reusing it again */ 4564 unconst 4564 unconst(that->m.id).clear(); 4565 4565 4566 4566 break; … … 4604 4604 VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO, 4605 4605 that->mm.vdDiskIfaces); 4606 if (RT_SUCCESS 4606 if (RT_SUCCESS(vrc)) 4607 4607 vrc = VDClose (hdd, true /* fDelete */); 4608 4608 4609 if (RT_FAILURE 4609 if (RT_FAILURE(vrc)) 4610 4610 { 4611 4611 throw setError (E_FAIL, … … 4618 4618 VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO, 4619 4619 that->mm.vdDiskIfaces); 4620 if (RT_FAILURE 4620 if (RT_FAILURE(vrc)) 4621 4621 { 4622 4622 throw setError (E_FAIL, … … 4639 4639 that->mm.vdProgress = NULL; 4640 4640 4641 if (RT_FAILURE 4641 if (RT_FAILURE(vrc)) 4642 4642 { 4643 4643 throw setError (E_FAIL, … … 4709 4709 (it == last) ? VD_OPEN_FLAGS_NORMAL : VD_OPEN_FLAGS_READONLY, 4710 4710 (*it)->mm.vdDiskIfaces); 4711 if (RT_FAILURE 4711 if (RT_FAILURE(vrc)) 4712 4712 { 4713 4713 throw setError (E_FAIL, … … 4730 4730 that->mm.vdProgress = NULL; 4731 4731 4732 if (RT_FAILURE 4732 if (RT_FAILURE(vrc)) 4733 4733 { 4734 4734 if (vrc == VERR_NOT_SUPPORTED) -
trunk/src/VBox/Main/HostDVDDriveImpl.cpp
r20977 r21878 57 57 58 58 /* Enclose the state transition NotReady->InInit->Ready */ 59 AutoInitSpan autoInitSpan 60 AssertReturn 59 AutoInitSpan autoInitSpan(this); 60 AssertReturn(autoInitSpan.isOk(), E_FAIL); 61 61 62 unconst 62 unconst(mName) = aName; 63 63 if (!aUdi) 64 unconst 64 unconst(mUdi) = ""; 65 65 else 66 unconst 66 unconst(mUdi) = aUdi; 67 67 if (!aDescription) 68 unconst 68 unconst(mDescription) = ""; 69 69 else 70 unconst 70 unconst(mDescription) = aDescription; 71 71 72 72 /* Confirm the successful initialization */ … … 83 83 { 84 84 /* Enclose the state transition Ready->InUninit->NotReady */ 85 AutoUninitSpan autoUninitSpan 85 AutoUninitSpan autoUninitSpan(this); 86 86 if (autoUninitSpan.uninitDone()) 87 87 return; 88 88 89 unconst 90 unconst 89 unconst(mDescription).setNull(); 90 unconst(mName).setNull(); 91 91 } 92 92 … … 98 98 CheckComArgOutPointerValid(aName); 99 99 100 AutoCaller autoCaller 101 CheckComRCReturnRC 100 AutoCaller autoCaller(this); 101 CheckComRCReturnRC(autoCaller.rc()); 102 102 103 103 /* mName is constant during life time, no need to lock */ 104 104 105 mName.cloneTo 105 mName.cloneTo(aName); 106 106 107 107 return S_OK; … … 112 112 CheckComArgOutPointerValid(aDescription); 113 113 114 AutoCaller autoCaller 115 CheckComRCReturnRC 114 AutoCaller autoCaller(this); 115 CheckComRCReturnRC(autoCaller.rc()); 116 116 117 117 /* mDescription is constant during life time, no need to lock */ 118 118 119 mDescription.cloneTo 119 mDescription.cloneTo(aDescription); 120 120 121 121 return S_OK; … … 126 126 CheckComArgOutPointerValid(aUdi); 127 127 128 AutoCaller autoCaller 129 CheckComRCReturnRC 128 AutoCaller autoCaller(this); 129 CheckComRCReturnRC(autoCaller.rc()); 130 130 131 131 /* mUdi is constant during life time, no need to lock */ 132 132 133 mUdi.cloneTo 133 mUdi.cloneTo(aUdi); 134 134 135 135 return S_OK; -
trunk/src/VBox/Main/HostFloppyDriveImpl.cpp
r20977 r21878 57 57 58 58 /* Enclose the state transition NotReady->InInit->Ready */ 59 AutoInitSpan autoInitSpan 60 AssertReturn 59 AutoInitSpan autoInitSpan(this); 60 AssertReturn(autoInitSpan.isOk(), E_FAIL); 61 61 62 unconst 62 unconst(mName) = aName; 63 63 if (!aUdi) 64 unconst 64 unconst(mUdi) = ""; 65 65 else 66 unconst 66 unconst(mUdi) = aUdi; 67 67 if (!aDescription) 68 unconst 68 unconst(mDescription) = ""; 69 69 else 70 unconst 70 unconst(mDescription) = aDescription; 71 71 72 72 /* Confirm the successful initialization */ … … 84 84 { 85 85 /* Enclose the state transition Ready->InUninit->NotReady */ 86 AutoUninitSpan autoUninitSpan 86 AutoUninitSpan autoUninitSpan(this); 87 87 if (autoUninitSpan.uninitDone()) 88 88 return; 89 89 90 unconst 90 unconst(mName).setNull(); 91 91 } 92 92 … … 98 98 CheckComArgOutPointerValid(aName); 99 99 100 AutoCaller autoCaller 101 CheckComRCReturnRC 100 AutoCaller autoCaller(this); 101 CheckComRCReturnRC(autoCaller.rc()); 102 102 103 103 /* mName is constant during life time, no need to lock */ 104 104 105 mName.cloneTo 105 mName.cloneTo(aName); 106 106 107 107 return S_OK; … … 112 112 CheckComArgOutPointerValid(aDescription); 113 113 114 AutoCaller autoCaller 115 CheckComRCReturnRC 114 AutoCaller autoCaller(this); 115 CheckComRCReturnRC(autoCaller.rc()); 116 116 117 117 /* mDescription is constant during life time, no need to lock */ 118 118 119 mDescription.cloneTo 119 mDescription.cloneTo(aDescription); 120 120 121 121 return S_OK; … … 126 126 CheckComArgOutPointerValid(aUdi); 127 127 128 AutoCaller autoCaller 129 CheckComRCReturnRC 128 AutoCaller autoCaller(this); 129 CheckComRCReturnRC(autoCaller.rc()); 130 130 131 131 /* mUdi is constant during life time, no need to lock */ 132 132 133 mUdi.cloneTo 133 mUdi.cloneTo(aUdi); 134 134 135 135 return S_OK; -
trunk/src/VBox/Main/HostImpl.cpp
r21823 r21878 165 165 HRESULT Host::init(VirtualBox *aParent) 166 166 { 167 LogFlowThisFunc 167 LogFlowThisFunc(("aParent=%p\n", aParent)); 168 168 169 169 /* Enclose the state transition NotReady->InInit->Ready */ 170 AutoInitSpan autoInitSpan 171 AssertReturn 170 AutoInitSpan autoInitSpan(this); 171 AssertReturn(autoInitSpan.isOk(), E_FAIL); 172 172 173 173 mParent = aParent; … … 270 270 void Host::uninit() 271 271 { 272 LogFlowThisFunc 272 LogFlowThisFunc(("\n")); 273 273 274 274 /* Enclose the state transition Ready->InUninit->NotReady */ 275 AutoUninitSpan autoUninitSpan 275 AutoUninitSpan autoUninitSpan(this); 276 276 if (autoUninitSpan.uninitDone()) 277 277 return; … … 284 284 /* wait for USB proxy service to terminate before we uninit all USB 285 285 * devices */ 286 LogFlowThisFunc 286 LogFlowThisFunc(("Stopping USB proxy service...\n")); 287 287 delete mUSBProxyService; 288 288 mUSBProxyService = NULL; 289 LogFlowThisFunc 289 LogFlowThisFunc(("Done stopping USB proxy service.\n")); 290 290 #endif 291 291 … … 309 309 * @param drives address of result pointer 310 310 */ 311 STDMETHODIMP Host::COMGETTER(DVDDrives) (ComSafeArrayOut 311 STDMETHODIMP Host::COMGETTER(DVDDrives) (ComSafeArrayOut(IHostDVDDrive *, aDrives)) 312 312 { 313 313 CheckComArgOutSafeArrayPointerValid(aDrives); 314 314 315 AutoCaller autoCaller 316 CheckComRCReturnRC 317 318 AutoWriteLock alock 315 AutoCaller autoCaller(this); 316 CheckComRCReturnRC(autoCaller.rc()); 317 318 AutoWriteLock alock(this); 319 319 320 320 std::list< ComObjPtr<HostDVDDrive> > list; … … 333 333 { 334 334 driveName[0] = *p; 335 ComObjPtr 335 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 336 336 hostDVDDriveObj.createObject(); 337 337 hostDVDDriveObj->init (Bstr (driveName)); … … 359 359 if (validateDevice(cdromDrive, true)) 360 360 { 361 ComObjPtr 361 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 362 362 hostDVDDriveObj.createObject(); 363 363 hostDVDDriveObj->init (Bstr (cdromDrive)); … … 373 373 if (validateDevice("/cdrom/cdrom0", true)) 374 374 { 375 ComObjPtr 375 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 376 376 hostDVDDriveObj.createObject(); 377 377 hostDVDDriveObj->init (Bstr ("cdrom/cdrom0")); … … 385 385 386 386 #elif defined(RT_OS_LINUX) 387 if (RT_SUCCESS 387 if (RT_SUCCESS(mHostDrives.updateDVDs())) 388 388 for (DriveInfoList::const_iterator it = mHostDrives.DVDBegin(); 389 SUCCEEDED 389 SUCCEEDED(rc) && it != mHostDrives.DVDEnd(); ++it) 390 390 { 391 391 ComObjPtr<HostDVDDrive> hostDVDDriveObj; … … 393 393 Bstr udi(it->mUdi); 394 394 Bstr description(it->mDescription); 395 if (SUCCEEDED 395 if (SUCCEEDED(rc)) 396 396 rc = hostDVDDriveObj.createObject(); 397 if (SUCCEEDED 397 if (SUCCEEDED(rc)) 398 398 rc = hostDVDDriveObj->init (device, udi, description); 399 if (SUCCEEDED 399 if (SUCCEEDED(rc)) 400 400 list.push_back(hostDVDDriveObj); 401 401 } … … 425 425 #endif 426 426 427 SafeIfaceArray 427 SafeIfaceArray<IHostDVDDrive> array (list); 428 428 array.detachTo(ComSafeArrayOutArg(aDrives)); 429 429 } … … 441 441 * @param drives address of result pointer 442 442 */ 443 STDMETHODIMP Host::COMGETTER(FloppyDrives) (ComSafeArrayOut 443 STDMETHODIMP Host::COMGETTER(FloppyDrives) (ComSafeArrayOut(IHostFloppyDrive *, aDrives)) 444 444 { 445 445 CheckComArgOutPointerValid(aDrives); … … 450 450 AutoWriteLock alock(this); 451 451 452 std::list<ComObjPtr 452 std::list<ComObjPtr<HostFloppyDrive> > list; 453 453 HRESULT rc = S_OK; 454 454 … … 466 466 { 467 467 driveName[0] = *p; 468 ComObjPtr 468 ComObjPtr<HostFloppyDrive> hostFloppyDriveObj; 469 469 hostFloppyDriveObj.createObject(); 470 470 hostFloppyDriveObj->init (Bstr (driveName)); … … 476 476 delete[] hostDrives; 477 477 #elif defined(RT_OS_LINUX) 478 if (RT_SUCCESS 478 if (RT_SUCCESS(mHostDrives.updateFloppies())) 479 479 for (DriveInfoList::const_iterator it = mHostDrives.FloppyBegin(); 480 SUCCEEDED 480 SUCCEEDED(rc) && it != mHostDrives.FloppyEnd(); ++it) 481 481 { 482 482 ComObjPtr<HostFloppyDrive> hostFloppyDriveObj; … … 484 484 Bstr udi(it->mUdi); 485 485 Bstr description(it->mDescription); 486 if (SUCCEEDED 486 if (SUCCEEDED(rc)) 487 487 rc = hostFloppyDriveObj.createObject(); 488 if (SUCCEEDED 488 if (SUCCEEDED(rc)) 489 489 rc = hostFloppyDriveObj->init (device, udi, description); 490 if (SUCCEEDED 490 if (SUCCEEDED(rc)) 491 491 list.push_back(hostFloppyDriveObj); 492 492 } … … 496 496 497 497 SafeIfaceArray<IHostFloppyDrive> collection (list); 498 collection.detachTo(ComSafeArrayOutArg 498 collection.detachTo(ComSafeArrayOutArg(aDrives)); 499 499 } 500 500 catch(std::bad_alloc &e) … … 509 509 # define VBOX_APP_NAME L"VirtualBox" 510 510 511 static int vboxNetWinAddComponent(std::list <ComObjPtr 511 static int vboxNetWinAddComponent(std::list <ComObjPtr<HostNetworkInterface> > * pPist, INetCfgComponent * pncc) 512 512 { 513 513 LPWSTR lpszName; … … 530 530 { 531 531 /* create a new object and add it to the list */ 532 ComObjPtr 532 ComObjPtr<HostNetworkInterface> iface; 533 533 iface.createObject(); 534 534 /* remove the curly bracket at the end */ 535 if (SUCCEEDED 535 if (SUCCEEDED(iface->init (name, Guid (IfGuid), HostNetworkInterfaceType_Bridged))) 536 536 { 537 537 // iface->setVirtualBox(mParent); … … 556 556 * @param drives address of result pointer 557 557 */ 558 STDMETHODIMP Host::COMGETTER(NetworkInterfaces) (ComSafeArrayOut 558 STDMETHODIMP Host::COMGETTER(NetworkInterfaces) (ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) 559 559 { 560 560 #if defined(RT_OS_WINDOWS) || defined(VBOX_WITH_NETFLT) /*|| defined(RT_OS_OS2)*/ 561 if (ComSafeArrayOutIsNull 561 if (ComSafeArrayOutIsNull(aNetworkInterfaces)) 562 562 return E_POINTER; 563 563 564 AutoCaller autoCaller 565 CheckComRCReturnRC 566 567 AutoWriteLock alock 568 569 std::list <ComObjPtr 564 AutoCaller autoCaller(this); 565 CheckComRCReturnRC(autoCaller.rc()); 566 567 AutoWriteLock alock(this); 568 569 std::list <ComObjPtr<HostNetworkInterface> > list; 570 570 571 571 #ifdef VBOX_WITH_HOSTNETIF_API … … 820 820 #endif 821 821 822 std::list <ComObjPtr 822 std::list <ComObjPtr<HostNetworkInterface> >::iterator it; 823 823 for (it = list.begin(); it != list.end(); ++it) 824 824 { … … 827 827 828 828 829 SafeIfaceArray 830 networkInterfaces.detachTo (ComSafeArrayOutArg(aNetworkInterfaces));829 SafeIfaceArray<IHostNetworkInterface> networkInterfaces (list); 830 networkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces)); 831 831 832 832 return S_OK; … … 838 838 } 839 839 840 STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut 840 STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut(IHostUSBDevice *, aUSBDevices)) 841 841 { 842 842 #ifdef VBOX_WITH_USB 843 843 CheckComArgOutSafeArrayPointerValid(aUSBDevices); 844 844 845 AutoCaller autoCaller 846 CheckComRCReturnRC 847 848 AutoWriteLock alock 845 AutoCaller autoCaller(this); 846 CheckComRCReturnRC(autoCaller.rc()); 847 848 AutoWriteLock alock(this); 849 849 850 850 MultiResult rc = checkUSBProxyService(); 851 CheckComRCReturnRC 851 CheckComRCReturnRC(rc); 852 852 853 853 return mUSBProxyService->getDeviceCollection (ComSafeArrayOutArg(aUSBDevices)); … … 865 865 } 866 866 867 STDMETHODIMP Host::COMGETTER(USBDeviceFilters) (ComSafeArrayOut 867 STDMETHODIMP Host::COMGETTER(USBDeviceFilters) (ComSafeArrayOut(IHostUSBDeviceFilter *, aUSBDeviceFilters)) 868 868 { 869 869 #ifdef VBOX_WITH_USB 870 870 CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters); 871 871 872 AutoCaller autoCaller 873 CheckComRCReturnRC 874 875 AutoWriteLock alock 872 AutoCaller autoCaller(this); 873 CheckComRCReturnRC(autoCaller.rc()); 874 875 AutoWriteLock alock(this); 876 876 877 877 MultiResult rc = checkUSBProxyService(); 878 CheckComRCReturnRC 879 880 SafeIfaceArray 881 collection.detachTo (ComSafeArrayOutArg(aUSBDeviceFilters));878 CheckComRCReturnRC(rc); 879 880 SafeIfaceArray<IHostUSBDeviceFilter> collection (mUSBDeviceFilters); 881 collection.detachTo(ComSafeArrayOutArg(aUSBDeviceFilters)); 882 882 883 883 return rc; … … 903 903 { 904 904 CheckComArgOutPointerValid(aCount); 905 // AutoCaller autoCaller 906 // CheckComRCReturnRC 907 908 // AutoReadLock alock 905 // AutoCaller autoCaller(this); 906 // CheckComRCReturnRC(autoCaller.rc()); 907 908 // AutoReadLock alock(this); 909 909 910 910 *aCount = RTMpGetPresentCount(); … … 921 921 { 922 922 CheckComArgOutPointerValid(aCount); 923 // AutoCaller autoCaller 924 // CheckComRCReturnRC 925 926 // AutoReadLock alock 923 // AutoCaller autoCaller(this); 924 // CheckComRCReturnRC(autoCaller.rc()); 925 926 // AutoReadLock alock(this); 927 927 928 928 *aCount = RTMpGetOnlineCount(); … … 940 940 { 941 941 CheckComArgOutPointerValid(aSpeed); 942 // AutoCaller autoCaller 943 // CheckComRCReturnRC 944 945 // AutoReadLock alock 942 // AutoCaller autoCaller(this); 943 // CheckComRCReturnRC(autoCaller.rc()); 944 945 // AutoReadLock alock(this); 946 946 947 947 *aSpeed = RTMpGetMaxFrequency(aCpuId); … … 958 958 { 959 959 CheckComArgOutPointerValid(aDescription); 960 // AutoCaller autoCaller 961 // CheckComRCReturnRC 962 963 // AutoReadLock alock 960 // AutoCaller autoCaller(this); 961 // CheckComRCReturnRC(autoCaller.rc()); 962 963 // AutoReadLock alock(this); 964 964 965 965 … … 968 968 if (RT_FAILURE(vrc)) 969 969 return E_FAIL; /** @todo error reporting? */ 970 Bstr (szCPUModel).cloneTo 970 Bstr (szCPUModel).cloneTo(aDescription); 971 971 return S_OK; 972 972 } … … 982 982 { 983 983 CheckComArgOutPointerValid(aSupported); 984 AutoCaller autoCaller 985 CheckComRCReturnRC 986 987 AutoReadLock alock 984 AutoCaller autoCaller(this); 985 CheckComRCReturnRC(autoCaller.rc()); 986 987 AutoReadLock alock(this); 988 988 989 989 switch (aFeature) … … 1016 1016 { 1017 1017 CheckComArgOutPointerValid(aSize); 1018 AutoCaller autoCaller 1019 CheckComRCReturnRC 1020 1021 AutoWriteLock alock 1018 AutoCaller autoCaller(this); 1019 CheckComRCReturnRC(autoCaller.rc()); 1020 1021 AutoWriteLock alock(this); 1022 1022 1023 1023 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ … … 1041 1041 { 1042 1042 CheckComArgOutPointerValid(aAvailable); 1043 AutoCaller autoCaller 1044 CheckComRCReturnRC 1045 1046 AutoWriteLock alock 1043 AutoCaller autoCaller(this); 1044 CheckComRCReturnRC(autoCaller.rc()); 1045 1046 AutoWriteLock alock(this); 1047 1047 1048 1048 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ … … 1066 1066 { 1067 1067 CheckComArgOutPointerValid(aOs); 1068 // AutoCaller autoCaller 1069 // CheckComRCReturnRC 1070 1071 // AutoReadLock alock 1068 // AutoCaller autoCaller(this); 1069 // CheckComRCReturnRC(autoCaller.rc()); 1070 1071 // AutoReadLock alock(this); 1072 1072 1073 1073 char szOSName[80]; … … 1075 1075 if (RT_FAILURE(vrc)) 1076 1076 return E_FAIL; /** @todo error reporting? */ 1077 Bstr (szOSName).cloneTo 1077 Bstr (szOSName).cloneTo(aOs); 1078 1078 return S_OK; 1079 1079 } … … 1088 1088 { 1089 1089 CheckComArgOutPointerValid(aVersion); 1090 // AutoCaller autoCaller 1091 // CheckComRCReturnRC 1092 1093 // AutoReadLock alock 1090 // AutoCaller autoCaller(this); 1091 // CheckComRCReturnRC(autoCaller.rc()); 1092 1093 // AutoReadLock alock(this); 1094 1094 1095 1095 /* Get the OS release. Reserve some buffer space for the service pack. */ … … 1114 1114 } 1115 1115 1116 Bstr (szOSRelease).cloneTo 1116 Bstr (szOSRelease).cloneTo(aVersion); 1117 1117 return S_OK; 1118 1118 } … … 1127 1127 { 1128 1128 CheckComArgOutPointerValid(aUTCTime); 1129 // AutoCaller autoCaller 1130 // CheckComRCReturnRC 1131 1132 // AutoReadLock alock 1129 // AutoCaller autoCaller(this); 1130 // CheckComRCReturnRC(autoCaller.rc()); 1131 1132 // AutoReadLock alock(this); 1133 1133 1134 1134 RTTIMESPEC now; … … 1141 1141 { 1142 1142 CheckComArgOutPointerValid(aSupported); 1143 AutoCaller autoCaller 1144 CheckComRCReturnRC 1145 1146 AutoReadLock alock 1143 AutoCaller autoCaller(this); 1144 CheckComRCReturnRC(autoCaller.rc()); 1145 1146 AutoReadLock alock(this); 1147 1147 1148 1148 *aSupported = f3DAccelerationSupported; … … 1160 1160 CheckComArgOutPointerValid(aProgress); 1161 1161 1162 AutoCaller autoCaller 1163 CheckComRCReturnRC 1164 1165 AutoWriteLock alock 1162 AutoCaller autoCaller(this); 1163 CheckComRCReturnRC(autoCaller.rc()); 1164 1165 AutoWriteLock alock(this); 1166 1166 1167 1167 int r = NetIfCreateHostOnlyNetworkInterface (mParent, aHostNetworkInterface, aProgress); … … 1182 1182 CheckComArgOutPointerValid(aProgress); 1183 1183 1184 AutoCaller autoCaller 1185 CheckComRCReturnRC 1186 1187 AutoWriteLock alock 1184 AutoCaller autoCaller(this); 1185 CheckComRCReturnRC(autoCaller.rc()); 1186 1187 AutoWriteLock alock(this); 1188 1188 1189 1189 /* first check whether an interface with the given name already exists */ 1190 1190 { 1191 ComPtr 1191 ComPtr<IHostNetworkInterface> iface; 1192 1192 if (FAILED (FindHostNetworkInterfaceById (aId, iface.asOutParam()))) 1193 1193 return setError (VBOX_E_OBJECT_NOT_FOUND, … … 1211 1211 CheckComArgOutPointerValid(aFilter); 1212 1212 1213 AutoCaller autoCaller 1214 CheckComRCReturnRC 1215 1216 AutoWriteLock alock 1217 1218 ComObjPtr 1213 AutoCaller autoCaller(this); 1214 CheckComRCReturnRC(autoCaller.rc()); 1215 1216 AutoWriteLock alock(this); 1217 1218 ComObjPtr<HostUSBDeviceFilter> filter; 1219 1219 filter.createObject(); 1220 1220 HRESULT rc = filter->init (this, aName); 1221 1221 ComAssertComRCRet (rc, rc); 1222 rc = filter.queryInterfaceTo 1222 rc = filter.queryInterfaceTo(aFilter); 1223 1223 AssertComRCReturn (rc, rc); 1224 1224 return S_OK; … … 1239 1239 1240 1240 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1241 AutoCaller autoCaller 1242 CheckComRCReturnRC 1243 1244 AutoWriteLock alock 1241 AutoCaller autoCaller(this); 1242 CheckComRCReturnRC(autoCaller.rc()); 1243 1244 AutoWriteLock alock(this); 1245 1245 1246 1246 MultiResult rc = checkUSBProxyService(); 1247 CheckComRCReturnRC 1248 1249 ComObjPtr 1247 CheckComRCReturnRC(rc); 1248 1249 ComObjPtr<HostUSBDeviceFilter> filter = getDependentChild (aFilter); 1250 1250 if (!filter) 1251 1251 return setError (VBOX_E_INVALID_OBJECT_STATE, … … 1290 1290 1291 1291 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1292 AutoCaller autoCaller 1293 CheckComRCReturnRC 1294 1295 AutoWriteLock alock 1292 AutoCaller autoCaller(this); 1293 CheckComRCReturnRC(autoCaller.rc()); 1294 1295 AutoWriteLock alock(this); 1296 1296 1297 1297 MultiResult rc = checkUSBProxyService(); 1298 CheckComRCReturnRC 1298 CheckComRCReturnRC(rc); 1299 1299 1300 1300 if (!mUSBDeviceFilters.size()) … … 1307 1307 aPosition, mUSBDeviceFilters.size() - 1); 1308 1308 1309 ComObjPtr 1309 ComObjPtr<HostUSBDeviceFilter> filter; 1310 1310 { 1311 1311 /* iterate to the position... */ … … 1319 1319 } 1320 1320 1321 filter.queryInterfaceTo 1321 filter.queryInterfaceTo(aFilter); 1322 1322 1323 1323 /* notify the proxy (only when the filter is active) */ … … 1349 1349 using namespace settings; 1350 1350 1351 AutoCaller autoCaller 1352 CheckComRCReturnRC 1353 1354 AutoWriteLock alock 1355 1356 AssertReturn 1351 AutoCaller autoCaller(this); 1352 CheckComRCReturnRC(autoCaller.rc()); 1353 1354 AutoWriteLock alock(this); 1355 1356 AssertReturn(!aGlobal.isNull(), E_FAIL); 1357 1357 1358 1358 HRESULT rc = S_OK; … … 1385 1385 AssertMsgFailed (("Invalid action: '%s'\n", actionStr)); 1386 1386 1387 ComObjPtr 1387 ComObjPtr<HostUSBDeviceFilter> filterObj; 1388 1388 filterObj.createObject(); 1389 1389 rc = filterObj->init (this, … … 1413 1413 using namespace settings; 1414 1414 1415 AutoCaller autoCaller 1416 CheckComRCReturnRC 1417 1418 AutoWriteLock alock 1415 AutoCaller autoCaller(this); 1416 CheckComRCReturnRC(autoCaller.rc()); 1417 1418 AutoWriteLock alock(this); 1419 1419 1420 1420 ComAssertRet (!aGlobal.isNull(), E_FAIL); … … 1493 1493 BOOL aActiveChanged /* = FALSE */) 1494 1494 { 1495 AutoCaller autoCaller 1496 CheckComRCReturnRC 1497 1498 AutoWriteLock alock 1495 AutoCaller autoCaller(this); 1496 CheckComRCReturnRC(autoCaller.rc()); 1497 1498 AutoWriteLock alock(this); 1499 1499 1500 1500 if (aFilter->mInList) … … 1544 1544 void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters, VirtualBox::SessionMachineVector *aMachines) 1545 1545 { 1546 AutoWriteLock alock 1546 AutoWriteLock alock(this); 1547 1547 1548 1548 mParent->getOpenedMachines (*aMachines); … … 1565 1565 * @retval list drives found will be attached to this list 1566 1566 */ 1567 bool Host::getDVDInfoFromHal(std::list <ComObjPtr 1567 bool Host::getDVDInfoFromHal(std::list <ComObjPtr<HostDVDDrive> > &list) 1568 1568 { 1569 1569 bool halSuccess = false; … … 1643 1643 description = product; 1644 1644 } 1645 ComObjPtr 1645 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 1646 1646 hostDVDDriveObj.createObject(); 1647 1647 hostDVDDriveObj->init (Bstr (devNode), … … 1658 1658 gDBusErrorFree(&dbusError); 1659 1659 } 1660 ComObjPtr 1660 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 1661 1661 hostDVDDriveObj.createObject(); 1662 1662 hostDVDDriveObj->init (Bstr (devNode), … … 1737 1737 * @retval list drives found will be attached to this list 1738 1738 */ 1739 bool Host::getFloppyInfoFromHal(std::list <ComObjPtr 1739 bool Host::getFloppyInfoFromHal(std::list <ComObjPtr<HostFloppyDrive> > &list) 1740 1740 { 1741 1741 bool halSuccess = false; … … 1807 1807 description = product; 1808 1808 } 1809 ComObjPtr 1809 ComObjPtr<HostFloppyDrive> hostFloppyDrive; 1810 1810 hostFloppyDrive.createObject(); 1811 1811 hostFloppyDrive->init (Bstr (devNode), … … 1822 1822 gDBusErrorFree(&dbusError); 1823 1823 } 1824 ComObjPtr 1824 ComObjPtr<HostFloppyDrive> hostFloppyDrive; 1825 1825 hostFloppyDrive.createObject(); 1826 1826 hostFloppyDrive->init (Bstr (devNode), … … 1895 1895 * Helper function to parse the given mount file and add found entries 1896 1896 */ 1897 void Host::parseMountTable(char *mountTable, std::list <ComObjPtr 1897 void Host::parseMountTable(char *mountTable, std::list <ComObjPtr<HostDVDDrive> > &list) 1898 1898 { 1899 1899 #ifdef RT_OS_LINUX … … 1945 1945 if (validateDevice(mnt_dev, true)) 1946 1946 { 1947 ComObjPtr 1947 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 1948 1948 hostDVDDriveObj.createObject(); 1949 1949 hostDVDDriveObj->init (Bstr (mnt_dev)); … … 1977 1977 if (validateDevice(rawDevName, true)) 1978 1978 { 1979 ComObjPtr 1979 ComObjPtr<HostDVDDrive> hostDVDDriveObj; 1980 1980 hostDVDDriveObj.createObject(); 1981 1981 hostDVDDriveObj->init (Bstr (rawDevName)); … … 2073 2073 HRESULT Host::checkUSBProxyService() 2074 2074 { 2075 AutoCaller autoCaller 2076 CheckComRCReturnRC 2077 2078 AutoWriteLock alock 2079 2080 AssertReturn 2075 AutoCaller autoCaller(this); 2076 CheckComRCReturnRC(autoCaller.rc()); 2077 2078 AutoWriteLock alock(this); 2079 2080 AssertReturn(mUSBProxyService, E_FAIL); 2081 2081 if (!mUSBProxyService->isActive()) 2082 2082 { … … 2132 2132 /* Create and register base metrics */ 2133 2133 IUnknown *objptr; 2134 ComObjPtr 2135 tmp.queryInterfaceTo 2134 ComObjPtr<Host> tmp = this; 2135 tmp.queryInterfaceTo(&objptr); 2136 2136 pm::BaseMetric *cpuLoad = new pm::HostCpuLoadRaw (hal, objptr, cpuLoadUser, cpuLoadKernel, 2137 2137 cpuLoadIdle); … … 2214 2214 *aDrive = NULL; 2215 2215 2216 SafeIfaceArray 2216 SafeIfaceArray<IHostDVDDrive> drivevec; 2217 2217 HRESULT rc = COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(drivevec)); 2218 CheckComRCReturnRC 2218 CheckComRCReturnRC(rc); 2219 2219 2220 2220 for (size_t i = 0; i < drivevec.size(); ++i) … … 2222 2222 Bstr name; 2223 2223 rc = drivevec[i]->COMGETTER(Name) (name.asOutParam()); 2224 CheckComRCReturnRC 2224 CheckComRCReturnRC(rc); 2225 2225 if (name == aName) 2226 2226 { … … 2229 2229 Bstr udi, description; 2230 2230 rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam()); 2231 CheckComRCReturnRC 2231 CheckComRCReturnRC(rc); 2232 2232 rc = drivevec[i]->COMGETTER(Description) (description.asOutParam()); 2233 CheckComRCReturnRC 2233 CheckComRCReturnRC(rc); 2234 2234 found->init(name, udi, description); 2235 2235 return found.queryInterfaceTo(aDrive); … … 2248 2248 *aDrive = NULL; 2249 2249 2250 SafeIfaceArray 2250 SafeIfaceArray<IHostFloppyDrive> drivevec; 2251 2251 HRESULT rc = COMGETTER(FloppyDrives) (ComSafeArrayAsOutParam(drivevec)); 2252 CheckComRCReturnRC 2252 CheckComRCReturnRC(rc); 2253 2253 2254 2254 for (size_t i = 0; i < drivevec.size(); ++i) … … 2256 2256 Bstr name; 2257 2257 rc = drivevec[i]->COMGETTER(Name) (name.asOutParam()); 2258 CheckComRCReturnRC 2258 CheckComRCReturnRC(rc); 2259 2259 if (name == aName) 2260 2260 { … … 2263 2263 Bstr udi, description; 2264 2264 rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam()); 2265 CheckComRCReturnRC 2265 CheckComRCReturnRC(rc); 2266 2266 rc = drivevec[i]->COMGETTER(Description) (description.asOutParam()); 2267 CheckComRCReturnRC 2267 CheckComRCReturnRC(rc); 2268 2268 found->init(name, udi, description); 2269 2269 return found.queryInterfaceTo(aDrive); … … 2286 2286 2287 2287 *networkInterface = NULL; 2288 ComObjPtr 2289 std::list <ComObjPtr 2288 ComObjPtr<HostNetworkInterface> found; 2289 std::list <ComObjPtr<HostNetworkInterface> > list; 2290 2290 int rc = NetIfList(list); 2291 2291 if (RT_FAILURE(rc)) … … 2294 2294 return E_FAIL; 2295 2295 } 2296 std::list <ComObjPtr 2296 std::list <ComObjPtr<HostNetworkInterface> >::iterator it; 2297 2297 for (it = list.begin(); it != list.end(); ++it) 2298 2298 { … … 2309 2309 found->setVirtualBox(mParent); 2310 2310 2311 return found.queryInterfaceTo 2311 return found.queryInterfaceTo(networkInterface); 2312 2312 #endif 2313 2313 } … … 2324 2324 2325 2325 *networkInterface = NULL; 2326 ComObjPtr 2327 std::list <ComObjPtr 2326 ComObjPtr<HostNetworkInterface> found; 2327 std::list <ComObjPtr<HostNetworkInterface> > list; 2328 2328 int rc = NetIfList(list); 2329 2329 if (RT_FAILURE(rc)) … … 2332 2332 return E_FAIL; 2333 2333 } 2334 std::list <ComObjPtr 2334 std::list <ComObjPtr<HostNetworkInterface> >::iterator it; 2335 2335 for (it = list.begin(); it != list.end(); ++it) 2336 2336 { … … 2347 2347 found->setVirtualBox(mParent); 2348 2348 2349 return found.queryInterfaceTo 2350 #endif 2351 } 2352 2353 STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type, ComSafeArrayOut 2354 { 2355 std::list <ComObjPtr 2349 return found.queryInterfaceTo(networkInterface); 2350 #endif 2351 } 2352 2353 STDMETHODIMP Host::FindHostNetworkInterfacesOfType(HostNetworkInterfaceType_T type, ComSafeArrayOut(IHostNetworkInterface *, aNetworkInterfaces)) 2354 { 2355 std::list <ComObjPtr<HostNetworkInterface> > allList; 2356 2356 int rc = NetIfList(allList); 2357 2357 if(RT_FAILURE(rc)) 2358 2358 return E_FAIL; 2359 2359 2360 std::list <ComObjPtr 2361 2362 std::list <ComObjPtr 2360 std::list <ComObjPtr<HostNetworkInterface> > resultList; 2361 2362 std::list <ComObjPtr<HostNetworkInterface> >::iterator it; 2363 2363 for (it = allList.begin(); it != allList.end(); ++it) 2364 2364 { … … 2375 2375 } 2376 2376 2377 SafeIfaceArray 2378 filteredNetworkInterfaces.detachTo (ComSafeArrayOutArg(aNetworkInterfaces));2377 SafeIfaceArray<IHostNetworkInterface> filteredNetworkInterfaces (resultList); 2378 filteredNetworkInterfaces.detachTo(ComSafeArrayOutArg(aNetworkInterfaces)); 2379 2379 2380 2380 return S_OK; … … 2389 2389 *aDevice = NULL; 2390 2390 2391 SafeIfaceArray 2391 SafeIfaceArray<IHostUSBDevice> devsvec; 2392 2392 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2393 CheckComRCReturnRC 2393 CheckComRCReturnRC(rc); 2394 2394 2395 2395 for (size_t i = 0; i < devsvec.size(); ++i) … … 2397 2397 Bstr address; 2398 2398 rc = devsvec[i]->COMGETTER(Address) (address.asOutParam()); 2399 CheckComRCReturnRC 2399 CheckComRCReturnRC(rc); 2400 2400 if (address == aAddress) 2401 2401 { 2402 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo 2402 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice); 2403 2403 } 2404 2404 } … … 2423 2423 *aDevice = NULL; 2424 2424 2425 SafeIfaceArray 2425 SafeIfaceArray<IHostUSBDevice> devsvec; 2426 2426 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2427 CheckComRCReturnRC 2427 CheckComRCReturnRC(rc); 2428 2428 2429 2429 for (size_t i = 0; i < devsvec.size(); ++i) … … 2431 2431 Bstr id; 2432 2432 rc = devsvec[i]->COMGETTER(Id) (id.asOutParam()); 2433 CheckComRCReturnRC 2433 CheckComRCReturnRC(rc); 2434 2434 if (id == aId) 2435 2435 { 2436 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo 2436 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo(aDevice); 2437 2437 } 2438 2438 } -
trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp
r19239 r21878 60 60 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, Guid aGuid, HostNetworkInterfaceType_T ifType) 61 61 { 62 LogFlowThisFunc 62 LogFlowThisFunc(("aInterfaceName={%ls}, aGuid={%s}\n", 63 63 aInterfaceName.raw(), aGuid.toString().raw())); 64 64 … … 67 67 68 68 /* Enclose the state transition NotReady->InInit->Ready */ 69 AutoInitSpan autoInitSpan 70 AssertReturn 71 72 unconst 73 unconst 69 AutoInitSpan autoInitSpan(this); 70 AssertReturn(autoInitSpan.isOk(), E_FAIL); 71 72 unconst(mInterfaceName) = aInterfaceName; 73 unconst(mGuid) = aGuid; 74 74 mIfType = ifType; 75 75 … … 117 117 HRESULT HostNetworkInterface::init (Bstr aInterfaceName, HostNetworkInterfaceType_T ifType, PNETIFINFO pIf) 118 118 { 119 // LogFlowThisFunc 119 // LogFlowThisFunc(("aInterfaceName={%ls}, aGuid={%s}\n", 120 120 // aInterfaceName.raw(), aGuid.toString().raw())); 121 121 … … 125 125 126 126 /* Enclose the state transition NotReady->InInit->Ready */ 127 AutoInitSpan autoInitSpan 128 AssertReturn 129 130 unconst 131 unconst 127 AutoInitSpan autoInitSpan(this); 128 AssertReturn(autoInitSpan.isOk(), E_FAIL); 129 130 unconst(mInterfaceName) = aInterfaceName; 131 unconst(mGuid) = pIf->Uuid; 132 132 mIfType = ifType; 133 133 … … 166 166 CheckComArgOutPointerValid(aInterfaceName); 167 167 168 AutoCaller autoCaller 169 CheckComRCReturnRC 170 171 mInterfaceName.cloneTo 168 AutoCaller autoCaller(this); 169 CheckComRCReturnRC(autoCaller.rc()); 170 171 mInterfaceName.cloneTo(aInterfaceName); 172 172 173 173 return S_OK; … … 184 184 CheckComArgOutPointerValid(aGuid); 185 185 186 AutoCaller autoCaller 187 CheckComRCReturnRC 188 189 mGuid.toUtf16().cloneTo 186 AutoCaller autoCaller(this); 187 CheckComRCReturnRC(autoCaller.rc()); 188 189 mGuid.toUtf16().cloneTo(aGuid); 190 190 191 191 return S_OK; … … 196 196 CheckComArgOutPointerValid(aDhcpEnabled); 197 197 198 AutoCaller autoCaller 199 CheckComRCReturnRC 198 AutoCaller autoCaller(this); 199 CheckComRCReturnRC(autoCaller.rc()); 200 200 201 201 *aDhcpEnabled = m.dhcpEnabled; … … 215 215 CheckComArgOutPointerValid(aIPAddress); 216 216 217 AutoCaller autoCaller 218 CheckComRCReturnRC 217 AutoCaller autoCaller(this); 218 CheckComRCReturnRC(autoCaller.rc()); 219 219 220 220 if (m.IPAddress == 0) … … 250 250 CheckComArgOutPointerValid(aNetworkMask); 251 251 252 AutoCaller autoCaller 253 CheckComRCReturnRC 252 AutoCaller autoCaller(this); 253 CheckComRCReturnRC(autoCaller.rc()); 254 254 255 255 if (m.networkMask == 0) … … 297 297 CheckComArgOutPointerValid(aIPV6Address); 298 298 299 AutoCaller autoCaller 300 CheckComRCReturnRC 301 302 m.IPV6Address.cloneTo 299 AutoCaller autoCaller(this); 300 CheckComRCReturnRC(autoCaller.rc()); 301 302 m.IPV6Address.cloneTo(aIPV6Address); 303 303 304 304 return S_OK; … … 315 315 CheckComArgOutPointerValid(aIPV6NetworkMaskPrefixLength); 316 316 317 AutoCaller autoCaller 318 CheckComRCReturnRC 317 AutoCaller autoCaller(this); 318 CheckComRCReturnRC(autoCaller.rc()); 319 319 320 320 *aIPV6NetworkMaskPrefixLength = m.IPV6NetworkMaskPrefixLength; … … 333 333 CheckComArgOutPointerValid(aHardwareAddress); 334 334 335 AutoCaller autoCaller 336 CheckComRCReturnRC 337 338 m.hardwareAddress.cloneTo 335 AutoCaller autoCaller(this); 336 CheckComRCReturnRC(autoCaller.rc()); 337 338 m.hardwareAddress.cloneTo(aHardwareAddress); 339 339 340 340 return S_OK; … … 351 351 CheckComArgOutPointerValid(aType); 352 352 353 AutoCaller autoCaller 354 CheckComRCReturnRC 353 AutoCaller autoCaller(this); 354 CheckComRCReturnRC(autoCaller.rc()); 355 355 356 356 *aType = m.mediumType; … … 369 369 CheckComArgOutPointerValid(aStatus); 370 370 371 AutoCaller autoCaller 372 CheckComRCReturnRC 371 AutoCaller autoCaller(this); 372 CheckComRCReturnRC(autoCaller.rc()); 373 373 374 374 *aStatus = m.status; … … 387 387 CheckComArgOutPointerValid(aType); 388 388 389 AutoCaller autoCaller 390 CheckComRCReturnRC 389 AutoCaller autoCaller(this); 390 CheckComRCReturnRC(autoCaller.rc()); 391 391 392 392 *aType = mIfType; … … 398 398 STDMETHODIMP HostNetworkInterface::COMGETTER(NetworkName) (BSTR *aNetworkName) 399 399 { 400 AutoCaller autoCaller 401 CheckComRCReturnRC 400 AutoCaller autoCaller(this); 401 CheckComRCReturnRC(autoCaller.rc()); 402 402 403 403 Utf8Str utf8Name("HostInterfaceNetworking-"); 404 404 utf8Name.append(Utf8Str(mInterfaceName)) ; 405 405 Bstr netName(utf8Name); 406 netName.detachTo 406 netName.detachTo(aNetworkName); 407 407 408 408 return S_OK; … … 414 414 return E_NOTIMPL; 415 415 #else 416 AutoCaller autoCaller 417 CheckComRCReturnRC 416 AutoCaller autoCaller(this); 417 CheckComRCReturnRC(autoCaller.rc()); 418 418 419 419 if (Bstr(aIPAddress).isEmpty()) … … 481 481 return E_INVALIDARG; 482 482 483 AutoCaller autoCaller 484 CheckComRCReturnRC 483 AutoCaller autoCaller(this); 484 CheckComRCReturnRC(autoCaller.rc()); 485 485 486 486 int rc = S_OK; … … 516 516 return E_NOTIMPL; 517 517 #else 518 AutoCaller autoCaller 519 CheckComRCReturnRC 518 AutoCaller autoCaller(this); 519 CheckComRCReturnRC(autoCaller.rc()); 520 520 521 521 int rc = NetIfEnableDynamicIpConfig(mVBox, this); … … 534 534 return E_NOTIMPL; 535 535 #else 536 AutoCaller autoCaller 537 CheckComRCReturnRC 536 AutoCaller autoCaller(this); 537 CheckComRCReturnRC(autoCaller.rc()); 538 538 539 539 int rc = NetIfDhcpRediscover(mVBox, this); … … 550 550 { 551 551 HRESULT hrc; 552 AutoCaller autoCaller 553 CheckComRCReturnRC 552 AutoCaller autoCaller(this); 553 CheckComRCReturnRC(autoCaller.rc()); 554 554 mVBox = pVBox; 555 555 -
trunk/src/VBox/Main/HostPower.cpp
r21395 r21878 68 68 { 69 69 /* get the remote console */ 70 ComPtr 70 ComPtr<IConsole> console; 71 71 rc = controls [i]->GetRemoteConsole (console.asOutParam()); 72 72 /* the VM could have been powered down and closed or whatever */ … … 136 136 { 137 137 /* get the remote console */ 138 ComPtr 138 ComPtr<IConsole> console; 139 139 rc = controls [i]->GetRemoteConsole (console.asOutParam()); 140 140 /* the VM could have been powered down and closed or whatever */ … … 153 153 LONG iRc; 154 154 rc = progress->WaitForCompletion(-1); 155 if (SUCCEEDED 155 if (SUCCEEDED(rc)) 156 156 progress->COMGETTER(ResultCode) (&iRc); 157 157 rc = iRc; 158 158 159 AssertMsg (SUCCEEDED 159 AssertMsg (SUCCEEDED(rc), ("SaveState WaitForCompletion " 160 160 "failed with %Rhrc (%#08X)\n", rc, rc)); 161 161 162 if (SUCCEEDED 162 if (SUCCEEDED(rc)) 163 163 ++ saved; 164 164 } -
trunk/src/VBox/Main/KeyboardImpl.cpp
r15715 r21878 85 85 HRESULT Keyboard::init (Console *aParent) 86 86 { 87 LogFlowThisFunc 87 LogFlowThisFunc(("aParent=%p\n", aParent)); 88 88 89 89 ComAssertRet (aParent, E_INVALIDARG); 90 90 91 91 /* Enclose the state transition NotReady->InInit->Ready */ 92 AutoInitSpan autoInitSpan 93 AssertReturn 94 95 unconst 92 AutoInitSpan autoInitSpan(this); 93 AssertReturn(autoInitSpan.isOk(), E_FAIL); 94 95 unconst(mParent) = aParent; 96 96 97 97 /* Confirm a successful initialization */ … … 107 107 void Keyboard::uninit() 108 108 { 109 LogFlowThisFunc 109 LogFlowThisFunc(("\n")); 110 110 111 111 /* Enclose the state transition Ready->InUninit->NotReady */ 112 AutoUninitSpan autoUninitSpan 112 AutoUninitSpan autoUninitSpan(this); 113 113 if (autoUninitSpan.uninitDone()) 114 114 return; … … 121 121 mfVMMDevInited = true; 122 122 123 unconst 123 unconst(mParent).setNull(); 124 124 } 125 125 … … 134 134 HRESULT rc = S_OK; 135 135 136 AutoCaller autoCaller 137 CheckComRCReturnRC 138 139 AutoWriteLock alock 136 AutoCaller autoCaller(this); 137 CheckComRCReturnRC(autoCaller.rc()); 138 139 AutoWriteLock alock(this); 140 140 141 141 CHECK_CONSOLE_DRV (mpDrv); … … 143 143 int vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)scancode); 144 144 145 if (RT_FAILURE 145 if (RT_FAILURE(vrc)) 146 146 rc = setError (VBOX_E_IPRT_ERROR, 147 147 tr ("Could not send scan code 0x%08X to the virtual keyboard (%Rrc)"), … … 169 169 return E_INVALIDARG; 170 170 171 AutoCaller autoCaller 172 CheckComRCReturnRC 173 174 AutoWriteLock alock 171 AutoCaller autoCaller(this); 172 CheckComRCReturnRC(autoCaller.rc()); 173 174 AutoWriteLock alock(this); 175 175 176 176 CHECK_CONSOLE_DRV (mpDrv); 177 177 178 com::SafeArray 178 com::SafeArray<LONG> keys (ComSafeArrayInArg (scancodes)); 179 179 int vrc = VINF_SUCCESS; 180 180 181 for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS 181 for (uint32_t i = 0; (i < keys.size()) && RT_SUCCESS(vrc); i++) 182 182 vrc = mpDrv->pUpPort->pfnPutEvent (mpDrv->pUpPort, (uint8_t)keys [i]); 183 183 184 if (RT_FAILURE 184 if (RT_FAILURE(vrc)) 185 185 return setError (VBOX_E_IPRT_ERROR, 186 186 tr ("Could not send all scan codes to the virtual keyboard (%Rrc)"), … … 319 319 void *pv; 320 320 rc = CFGMR3QueryPtr (pCfgHandle, "Object", &pv); 321 if (RT_FAILURE 321 if (RT_FAILURE(rc)) 322 322 { 323 323 AssertMsgFailed (("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc)); -
trunk/src/VBox/Main/MachineDebuggerImpl.cpp
r19500 r21878 51 51 HRESULT MachineDebugger::FinalConstruct() 52 52 { 53 unconst 53 unconst(mParent) = NULL; 54 54 return S_OK; 55 55 } … … 71 71 HRESULT MachineDebugger::init (Console *aParent) 72 72 { 73 LogFlowThisFunc 73 LogFlowThisFunc(("aParent=%p\n", aParent)); 74 74 75 75 ComAssertRet (aParent, E_INVALIDARG); 76 76 77 77 /* Enclose the state transition NotReady->InInit->Ready */ 78 AutoInitSpan autoInitSpan 79 AssertReturn 80 81 unconst 78 AutoInitSpan autoInitSpan(this); 79 AssertReturn(autoInitSpan.isOk(), E_FAIL); 80 81 unconst(mParent) = aParent; 82 82 83 83 mSinglestepQueued = ~0; … … 102 102 void MachineDebugger::uninit() 103 103 { 104 LogFlowThisFunc 104 LogFlowThisFunc(("\n")); 105 105 106 106 /* Enclose the state transition Ready->InUninit->NotReady */ 107 AutoUninitSpan autoUninitSpan 107 AutoUninitSpan autoUninitSpan(this); 108 108 if (autoUninitSpan.uninitDone()) 109 109 return; 110 110 111 unconst 111 unconst(mParent).setNull(); 112 112 mFlushMode = false; 113 113 } … … 126 126 CheckComArgOutPointerValid(aEnabled); 127 127 128 AutoCaller autoCaller 129 CheckComRCReturnRC 128 AutoCaller autoCaller(this); 129 CheckComRCReturnRC(autoCaller.rc()); 130 130 131 131 /** @todo */ … … 141 141 STDMETHODIMP MachineDebugger::COMSETTER(Singlestep) (BOOL aEnable) 142 142 { 143 AutoCaller autoCaller 144 CheckComRCReturnRC 143 AutoCaller autoCaller(this); 144 CheckComRCReturnRC(autoCaller.rc()); 145 145 146 146 /** @todo */ … … 158 158 CheckComArgOutPointerValid(aEnabled); 159 159 160 AutoCaller autoCaller 161 CheckComRCReturnRC 162 163 AutoReadLock alock 160 AutoCaller autoCaller(this); 161 CheckComRCReturnRC(autoCaller.rc()); 162 163 AutoReadLock alock(this); 164 164 165 165 Console::SafeVMPtrQuiet pVM (mParent); … … 181 181 STDMETHODIMP MachineDebugger::COMSETTER(RecompileUser) (BOOL aEnable) 182 182 { 183 LogFlowThisFunc 184 185 AutoCaller autoCaller 186 CheckComRCReturnRC 187 188 AutoWriteLock alock 183 LogFlowThisFunc(("enable=%d\n", aEnable)); 184 185 AutoCaller autoCaller(this); 186 CheckComRCReturnRC(autoCaller.rc()); 187 188 AutoWriteLock alock(this); 189 189 190 190 if (queueSettings()) … … 196 196 197 197 Console::SafeVMPtr pVM (mParent); 198 CheckComRCReturnRC 198 CheckComRCReturnRC(pVM.rc()); 199 199 200 200 PVMREQ pReq; … … 202 202 int rcVBox = VMR3ReqCall (pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 203 203 (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag); 204 if (RT_SUCCESS 204 if (RT_SUCCESS(rcVBox)) 205 205 { 206 206 rcVBox = pReq->iStatus; … … 208 208 } 209 209 210 if (RT_SUCCESS 210 if (RT_SUCCESS(rcVBox)) 211 211 return S_OK; 212 212 … … 226 226 CheckComArgOutPointerValid(aEnabled); 227 227 228 AutoCaller autoCaller 229 CheckComRCReturnRC 230 231 AutoReadLock alock 228 AutoCaller autoCaller(this); 229 CheckComRCReturnRC(autoCaller.rc()); 230 231 AutoReadLock alock(this); 232 232 233 233 Console::SafeVMPtrQuiet pVM (mParent); … … 249 249 STDMETHODIMP MachineDebugger::COMSETTER(RecompileSupervisor) (BOOL aEnable) 250 250 { 251 LogFlowThisFunc 252 253 AutoCaller autoCaller 254 CheckComRCReturnRC 255 256 AutoWriteLock alock 251 LogFlowThisFunc(("enable=%d\n", aEnable)); 252 253 AutoCaller autoCaller(this); 254 CheckComRCReturnRC(autoCaller.rc()); 255 256 AutoWriteLock alock(this); 257 257 258 258 if (queueSettings()) … … 264 264 265 265 Console::SafeVMPtr pVM (mParent); 266 CheckComRCReturnRC 266 CheckComRCReturnRC(pVM.rc()); 267 267 268 268 PVMREQ pReq; … … 270 270 int rcVBox = VMR3ReqCall (pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 271 271 (PFNRT)EMR3RawSetMode, 2, pVM.raw(), rawModeFlag); 272 if (RT_SUCCESS 272 if (RT_SUCCESS(rcVBox)) 273 273 { 274 274 rcVBox = pReq->iStatus; … … 276 276 } 277 277 278 if (RT_SUCCESS 278 if (RT_SUCCESS(rcVBox)) 279 279 return S_OK; 280 280 … … 294 294 CheckComArgOutPointerValid(aEnabled); 295 295 296 AutoCaller autoCaller 297 CheckComRCReturnRC 298 299 AutoReadLock alock 296 AutoCaller autoCaller(this); 297 CheckComRCReturnRC(autoCaller.rc()); 298 299 AutoReadLock alock(this); 300 300 301 301 Console::SafeVMPtrQuiet pVM (mParent); … … 317 317 STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled) (BOOL aEnable) 318 318 { 319 LogFlowThisFunc 320 321 AutoCaller autoCaller 322 CheckComRCReturnRC 323 324 AutoWriteLock alock 319 LogFlowThisFunc(("enable=%d\n", aEnable)); 320 321 AutoCaller autoCaller(this); 322 CheckComRCReturnRC(autoCaller.rc()); 323 324 AutoWriteLock alock(this); 325 325 326 326 if (queueSettings()) … … 332 332 333 333 Console::SafeVMPtr pVM (mParent); 334 CheckComRCReturnRC 334 CheckComRCReturnRC(pVM.rc()); 335 335 336 336 PATMR3AllowPatching (pVM, aEnable); … … 349 349 CheckComArgOutPointerValid(aEnabled); 350 350 351 AutoCaller autoCaller 352 CheckComRCReturnRC 353 354 AutoReadLock alock 351 AutoCaller autoCaller(this); 352 CheckComRCReturnRC(autoCaller.rc()); 353 354 AutoReadLock alock(this); 355 355 356 356 Console::SafeVMPtrQuiet pVM (mParent); … … 372 372 STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled) (BOOL aEnable) 373 373 { 374 LogFlowThisFunc 375 376 AutoCaller autoCaller 377 CheckComRCReturnRC 378 379 AutoWriteLock alock 374 LogFlowThisFunc(("enable=%d\n", aEnable)); 375 376 AutoCaller autoCaller(this); 377 CheckComRCReturnRC(autoCaller.rc()); 378 379 AutoWriteLock alock(this); 380 380 381 381 if (queueSettings()) … … 387 387 388 388 Console::SafeVMPtr pVM (mParent); 389 CheckComRCReturnRC 389 CheckComRCReturnRC(pVM.rc()); 390 390 391 391 int vrc; … … 395 395 vrc = CSAMDisableScanning (pVM); 396 396 397 if (RT_FAILURE 397 if (RT_FAILURE(vrc)) 398 398 { 399 399 /** @todo handle error case */ … … 413 413 CheckComArgOutPointerValid(aEnabled); 414 414 415 AutoCaller autoCaller 416 CheckComRCReturnRC 415 AutoCaller autoCaller(this); 416 CheckComRCReturnRC(autoCaller.rc()); 417 417 418 418 #ifdef LOG_ENABLED 419 AutoReadLock alock 419 AutoReadLock alock(this); 420 420 421 421 const PRTLOGGER pLogInstance = RTLogDefaultInstance(); … … 436 436 STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled) (BOOL aEnabled) 437 437 { 438 LogFlowThisFunc 439 440 AutoCaller autoCaller 441 CheckComRCReturnRC 442 443 AutoWriteLock alock 438 LogFlowThisFunc(("aEnabled=%d\n", aEnabled)); 439 440 AutoCaller autoCaller(this); 441 CheckComRCReturnRC(autoCaller.rc()); 442 443 AutoWriteLock alock(this); 444 444 445 445 if (queueSettings()) … … 451 451 452 452 Console::SafeVMPtr pVM (mParent); 453 CheckComRCReturnRC 453 CheckComRCReturnRC(pVM.rc()); 454 454 455 455 #ifdef LOG_ENABLED 456 456 int vrc = DBGFR3LogModifyFlags (pVM, aEnabled ? "enabled" : "disabled"); 457 if (RT_FAILURE 457 if (RT_FAILURE(vrc)) 458 458 { 459 459 /** @todo handle error code. */ … … 474 474 CheckComArgOutPointerValid(aEnabled); 475 475 476 AutoCaller autoCaller 477 CheckComRCReturnRC 478 479 AutoReadLock alock 476 AutoCaller autoCaller(this); 477 CheckComRCReturnRC(autoCaller.rc()); 478 479 AutoReadLock alock(this); 480 480 481 481 Console::SafeVMPtrQuiet pVM (mParent); … … 499 499 CheckComArgOutPointerValid(aEnabled); 500 500 501 AutoCaller autoCaller 502 CheckComRCReturnRC 503 504 AutoReadLock alock 501 AutoCaller autoCaller(this); 502 CheckComRCReturnRC(autoCaller.rc()); 503 504 AutoReadLock alock(this); 505 505 506 506 Console::SafeVMPtrQuiet pVM (mParent); … … 524 524 CheckComArgOutPointerValid(aEnabled); 525 525 526 AutoCaller autoCaller 527 CheckComRCReturnRC 528 529 AutoReadLock alock 526 AutoCaller autoCaller(this); 527 CheckComRCReturnRC(autoCaller.rc()); 528 529 AutoReadLock alock(this); 530 530 531 531 Console::SafeVMPtrQuiet pVM (mParent); … … 549 549 CheckComArgOutPointerValid(aEnabled); 550 550 551 AutoCaller autoCaller 552 CheckComRCReturnRC 553 554 AutoReadLock alock 551 AutoCaller autoCaller(this); 552 CheckComRCReturnRC(autoCaller.rc()); 553 554 AutoReadLock alock(this); 555 555 556 556 Console::SafeVMPtrQuiet pVM (mParent); … … 577 577 CheckComArgOutPointerValid(aPct); 578 578 579 AutoCaller autoCaller 580 CheckComRCReturnRC 581 582 AutoReadLock alock 579 AutoCaller autoCaller(this); 580 CheckComRCReturnRC(autoCaller.rc()); 581 582 AutoReadLock alock(this); 583 583 584 584 Console::SafeVMPtrQuiet pVM (mParent); … … 603 603 return E_INVALIDARG; 604 604 605 AutoCaller autoCaller 606 CheckComRCReturnRC 607 608 AutoWriteLock alock 605 AutoCaller autoCaller(this); 606 CheckComRCReturnRC(autoCaller.rc()); 607 608 AutoWriteLock alock(this); 609 609 610 610 if (queueSettings()) … … 616 616 617 617 Console::SafeVMPtr pVM (mParent); 618 CheckComRCReturnRC 618 CheckComRCReturnRC(pVM.rc()); 619 619 620 620 int vrc = TMR3SetWarpDrive (pVM, aPct); 621 if (RT_FAILURE 621 if (RT_FAILURE(vrc)) 622 622 { 623 623 /** @todo handle error code. */ … … 640 640 CheckComArgOutPointerValid(aVm); 641 641 642 AutoCaller autoCaller 643 CheckComRCReturnRC 644 645 AutoReadLock alock 642 AutoCaller autoCaller(this); 643 CheckComRCReturnRC(autoCaller.rc()); 644 645 AutoReadLock alock(this); 646 646 647 647 Console::SafeVMPtr pVM (mParent); 648 CheckComRCReturnRC 648 CheckComRCReturnRC(pVM.rc()); 649 649 650 650 *aVm = (uintptr_t)pVM.raw(); … … 715 715 int vrc = STAMR3Snapshot (pVM, Utf8Str (aPattern).raw(), &pszSnapshot, NULL, 716 716 !!aWithDescriptions); 717 if (RT_FAILURE 717 if (RT_FAILURE(vrc)) 718 718 return vrc == VERR_NO_MEMORY ? E_OUTOFMEMORY : E_FAIL; 719 719 … … 722 722 * Until that's done, this method is kind of useless for debugger statistics GUI because 723 723 * of the amount statistics in a debug build. */ 724 Bstr (pszSnapshot).cloneTo 724 Bstr (pszSnapshot).cloneTo(aStats); 725 725 726 726 return S_OK; … … 735 735 STDMETHODIMP MachineDebugger::InjectNMI() 736 736 { 737 LogFlowThisFunc 738 739 AutoCaller autoCaller 740 CheckComRCReturnRC 741 742 AutoWriteLock alock 737 LogFlowThisFunc(("")); 738 739 AutoCaller autoCaller(this); 740 CheckComRCReturnRC(autoCaller.rc()); 741 742 AutoWriteLock alock(this); 743 743 744 744 Console::SafeVMPtr pVM (mParent); 745 CheckComRCReturnRC 745 CheckComRCReturnRC(pVM.rc()); 746 746 747 747 HWACCMR3InjectNMI(pVM); -
trunk/src/VBox/Main/MachineImpl.cpp
r21835 r21878 348 348 HRESULT Machine::FinalConstruct() 349 349 { 350 LogFlowThisFunc 350 LogFlowThisFunc(("\n")); 351 351 return S_OK; 352 352 } … … 354 354 void Machine::FinalRelease() 355 355 { 356 LogFlowThisFunc 356 LogFlowThisFunc(("\n")); 357 357 uninit(); 358 358 } … … 388 388 { 389 389 LogFlowThisFuncEnter(); 390 LogFlowThisFunc 391 392 AssertReturn 393 AssertReturn 394 AssertReturn 390 LogFlowThisFunc(("aConfigFile='%ls', aMode=%d\n", aConfigFile, aMode)); 391 392 AssertReturn(aParent, E_INVALIDARG); 393 AssertReturn(aConfigFile, E_INVALIDARG); 394 AssertReturn(aMode != Init_New || (aName != NULL && *aName != '\0'), 395 395 E_INVALIDARG); 396 AssertReturn 396 AssertReturn(aMode != Init_Registered || aId != NULL, E_FAIL); 397 397 398 398 /* Enclose the state transition NotReady->InInit->Ready */ 399 AutoInitSpan autoInitSpan 400 AssertReturn 399 AutoInitSpan autoInitSpan(this); 400 AssertReturn(autoInitSpan.isOk(), E_FAIL); 401 401 402 402 HRESULT rc = S_OK; 403 403 404 404 /* share the parent weakly */ 405 unconst 405 unconst(mParent) = aParent; 406 406 407 407 /* register with parent early, since uninit() will unconditionally … … 419 419 Utf8Str configFileFull; 420 420 int vrc = mParent->calculateFullPath (Utf8Str (aConfigFile), configFileFull); 421 if (RT_FAILURE 421 if (RT_FAILURE(vrc)) 422 422 return setError (VBOX_E_FILE_ERROR, 423 423 tr ("Invalid machine settings file name '%ls' (%Rrc)"), … … 432 432 /* store the supplied UUID (will be used to check for UUID consistency 433 433 * in loadSettings() */ 434 unconst 434 unconst(mData->mUuid) = *aId; 435 435 rc = registeredInit(); 436 436 } … … 447 447 RTFILE f = NIL_RTFILE; 448 448 int vrc = RTFileOpen (&f, configFileFull, RTFILE_O_READ); 449 if (RT_SUCCESS 449 if (RT_SUCCESS(vrc) || vrc == VERR_SHARING_VIOLATION) 450 450 { 451 451 rc = setError (VBOX_E_FILE_ERROR, 452 452 tr ("Machine settings file '%s' already exists"), 453 453 configFileFull.raw()); 454 if (RT_SUCCESS 454 if (RT_SUCCESS(vrc)) 455 455 RTFileClose (f); 456 456 } … … 466 466 AssertFailed(); 467 467 468 if (SUCCEEDED 468 if (SUCCEEDED(rc)) 469 469 rc = initDataAndChildObjects(); 470 470 471 if (SUCCEEDED 471 if (SUCCEEDED(rc)) 472 472 { 473 473 /* set to true now to cause uninit() to call … … 483 483 /* create the machine UUID */ 484 484 if (aId) 485 unconst 485 unconst(mData->mUuid) = *aId; 486 486 else 487 unconst 487 unconst(mData->mUuid).create(); 488 488 489 489 /* memorize the provided new machine's name */ … … 527 527 528 528 /* commit all changes made during the initialization */ 529 if (SUCCEEDED 529 if (SUCCEEDED(rc)) 530 530 commit(); 531 531 } … … 533 533 534 534 /* Confirm a successful initialization when it's the case */ 535 if (SUCCEEDED 535 if (SUCCEEDED(rc)) 536 536 { 537 537 if (mData->mAccessible) … … 541 541 } 542 542 543 LogFlowThisFunc 543 LogFlowThisFunc(("mName='%ls', mRegistered=%RTbool, mAccessible=%RTbool " 544 544 "rc=%08X\n", 545 545 !!mUserData ? mUserData->mName.raw() : NULL, … … 565 565 HRESULT Machine::registeredInit() 566 566 { 567 AssertReturn 568 AssertReturn 569 AssertReturn 567 AssertReturn(mType == IsMachine, E_FAIL); 568 AssertReturn(!mData->mUuid.isEmpty(), E_FAIL); 569 AssertReturn(!mData->mAccessible, E_FAIL); 570 570 571 571 HRESULT rc = lockConfig(); 572 572 573 if (SUCCEEDED 573 if (SUCCEEDED(rc)) 574 574 rc = initDataAndChildObjects(); 575 575 576 if (SUCCEEDED 576 if (SUCCEEDED(rc)) 577 577 { 578 578 /* Temporarily reset the registered flag in order to let setters … … 591 591 } 592 592 593 if (SUCCEEDED 593 if (SUCCEEDED(rc)) 594 594 { 595 595 /* Set mAccessible to TRUE only if we successfully locked and loaded … … 643 643 644 644 /* Enclose the state transition Ready->InUninit->NotReady */ 645 AutoUninitSpan autoUninitSpan 645 AutoUninitSpan autoUninitSpan(this); 646 646 if (autoUninitSpan.uninitDone()) 647 647 return; … … 650 650 Assert (!!mData); 651 651 652 LogFlowThisFunc 653 LogFlowThisFunc 652 LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed())); 653 LogFlowThisFunc(("mRegistered=%d\n", mData->mRegistered)); 654 654 655 655 /* Enter this object lock because there may be a SessionMachine instance … … 675 675 * still valid). We'll call it ourselves below. 676 676 */ 677 LogWarningThisFunc 677 LogWarningThisFunc(("Session machine is not NULL (%p), " 678 678 "the direct session is still open!\n", 679 679 (SessionMachine *) mData->mSession.mMachine)); … … 681 681 if (Global::IsOnlineOrTransient (mData->mMachineState)) 682 682 { 683 LogWarningThisFunc 683 LogWarningThisFunc(("Setting state to Aborted!\n")); 684 684 /* set machine state using SessionMachine reimplementation */ 685 685 static_cast <Machine *> (mData->mSession.mMachine) … … 704 704 if (isModified()) 705 705 { 706 LogWarningThisFunc 706 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 707 707 rollback (false /* aNotify */); 708 708 } … … 724 724 STDMETHODIMP Machine::COMGETTER(Parent) (IVirtualBox **aParent) 725 725 { 726 CheckComArgOutPointerValid 727 728 AutoLimitedCaller autoCaller 729 CheckComRCReturnRC 726 CheckComArgOutPointerValid(aParent); 727 728 AutoLimitedCaller autoCaller(this); 729 CheckComRCReturnRC(autoCaller.rc()); 730 730 731 731 /* mParent is constant during life time, no need to lock */ 732 mParent.queryInterfaceTo 732 mParent.queryInterfaceTo(aParent); 733 733 734 734 return S_OK; … … 737 737 STDMETHODIMP Machine::COMGETTER(Accessible) (BOOL *aAccessible) 738 738 { 739 CheckComArgOutPointerValid 740 741 AutoLimitedCaller autoCaller 742 CheckComRCReturnRC 743 744 AutoWriteLock alock 739 CheckComArgOutPointerValid(aAccessible); 740 741 AutoLimitedCaller autoCaller(this); 742 CheckComRCReturnRC(autoCaller.rc()); 743 744 AutoWriteLock alock(this); 745 745 746 746 HRESULT rc = S_OK; … … 750 750 /* try to initialize the VM once more if not accessible */ 751 751 752 AutoReinitSpan autoReinitSpan 753 AssertReturn 752 AutoReinitSpan autoReinitSpan(this); 753 AssertReturn(autoReinitSpan.isOk(), E_FAIL); 754 754 755 755 rc = registeredInit(); 756 756 757 if (SUCCEEDED 757 if (SUCCEEDED(rc) && mData->mAccessible) 758 758 { 759 759 autoReinitSpan.setSucceeded(); … … 761 761 /* make sure interesting parties will notice the accessibility 762 762 * state change */ 763 mParent->onMachineStateChange 764 mParent->onMachineDataChange 765 } 766 } 767 768 if (SUCCEEDED 763 mParent->onMachineStateChange(mData->mUuid, mData->mMachineState); 764 mParent->onMachineDataChange(mData->mUuid); 765 } 766 } 767 768 if (SUCCEEDED(rc)) 769 769 *aAccessible = mData->mAccessible; 770 770 … … 774 774 STDMETHODIMP Machine::COMGETTER(AccessError) (IVirtualBoxErrorInfo **aAccessError) 775 775 { 776 CheckComArgOutPointerValid 777 778 AutoLimitedCaller autoCaller 779 CheckComRCReturnRC 780 781 AutoReadLock alock 776 CheckComArgOutPointerValid(aAccessError); 777 778 AutoLimitedCaller autoCaller(this); 779 CheckComRCReturnRC(autoCaller.rc()); 780 781 AutoReadLock alock(this); 782 782 783 783 if (mData->mAccessible || !mData->mAccessError.isBasicAvailable()) … … 790 790 HRESULT rc = S_OK; 791 791 792 ComObjPtr 792 ComObjPtr<VirtualBoxErrorInfo> errorInfo; 793 793 rc = errorInfo.createObject(); 794 if (SUCCEEDED 794 if (SUCCEEDED(rc)) 795 795 { 796 796 errorInfo->init (mData->mAccessError.getResultCode(), … … 798 798 mData->mAccessError.getComponent(), 799 799 mData->mAccessError.getText()); 800 rc = errorInfo.queryInterfaceTo 800 rc = errorInfo.queryInterfaceTo(aAccessError); 801 801 } 802 802 … … 806 806 STDMETHODIMP Machine::COMGETTER(Name) (BSTR *aName) 807 807 { 808 CheckComArgOutPointerValid 809 810 AutoCaller autoCaller 811 CheckComRCReturnRC 812 813 AutoReadLock alock 814 815 mUserData->mName.cloneTo 808 CheckComArgOutPointerValid(aName); 809 810 AutoCaller autoCaller(this); 811 CheckComRCReturnRC(autoCaller.rc()); 812 813 AutoReadLock alock(this); 814 815 mUserData->mName.cloneTo(aName); 816 816 817 817 return S_OK; … … 826 826 tr ("Machine name cannot be empty")); 827 827 828 AutoCaller autoCaller 829 CheckComRCReturnRC 830 831 AutoWriteLock alock 832 833 HRESULT rc = checkStateDependency 834 CheckComRCReturnRC 828 AutoCaller autoCaller(this); 829 CheckComRCReturnRC(autoCaller.rc()); 830 831 AutoWriteLock alock(this); 832 833 HRESULT rc = checkStateDependency(MutableStateDep); 834 CheckComRCReturnRC(rc); 835 835 836 836 mUserData.backup(); … … 842 842 STDMETHODIMP Machine::COMGETTER(Description) (BSTR *aDescription) 843 843 { 844 CheckComArgOutPointerValid 845 846 AutoCaller autoCaller 847 CheckComRCReturnRC 848 849 AutoReadLock alock 850 851 mUserData->mDescription.cloneTo 844 CheckComArgOutPointerValid(aDescription); 845 846 AutoCaller autoCaller(this); 847 CheckComRCReturnRC(autoCaller.rc()); 848 849 AutoReadLock alock(this); 850 851 mUserData->mDescription.cloneTo(aDescription); 852 852 853 853 return S_OK; … … 856 856 STDMETHODIMP Machine::COMSETTER(Description) (IN_BSTR aDescription) 857 857 { 858 AutoCaller autoCaller 859 CheckComRCReturnRC 860 861 AutoWriteLock alock 862 863 HRESULT rc = checkStateDependency 864 CheckComRCReturnRC 858 AutoCaller autoCaller(this); 859 CheckComRCReturnRC(autoCaller.rc()); 860 861 AutoWriteLock alock(this); 862 863 HRESULT rc = checkStateDependency(MutableStateDep); 864 CheckComRCReturnRC(rc); 865 865 866 866 mUserData.backup(); … … 872 872 STDMETHODIMP Machine::COMGETTER(Id) (BSTR *aId) 873 873 { 874 CheckComArgOutPointerValid 875 876 AutoLimitedCaller autoCaller 877 CheckComRCReturnRC 878 879 AutoReadLock alock 880 881 mData->mUuid.toUtf16().cloneTo 874 CheckComArgOutPointerValid(aId); 875 876 AutoLimitedCaller autoCaller(this); 877 CheckComRCReturnRC(autoCaller.rc()); 878 879 AutoReadLock alock(this); 880 881 mData->mUuid.toUtf16().cloneTo(aId); 882 882 883 883 return S_OK; … … 886 886 STDMETHODIMP Machine::COMGETTER(OSTypeId) (BSTR *aOSTypeId) 887 887 { 888 CheckComArgOutPointerValid 889 890 AutoCaller autoCaller 891 CheckComRCReturnRC 892 893 AutoReadLock alock 894 895 mUserData->mOSTypeId.cloneTo 888 CheckComArgOutPointerValid(aOSTypeId); 889 890 AutoCaller autoCaller(this); 891 CheckComRCReturnRC(autoCaller.rc()); 892 893 AutoReadLock alock(this); 894 895 mUserData->mOSTypeId.cloneTo(aOSTypeId); 896 896 897 897 return S_OK; … … 902 902 CheckComArgNotNull (aOSTypeId); 903 903 904 AutoCaller autoCaller 905 CheckComRCReturnRC 904 AutoCaller autoCaller(this); 905 CheckComRCReturnRC(autoCaller.rc()); 906 906 907 907 /* look up the object by Id to check it is valid */ 908 ComPtr 908 ComPtr<IGuestOSType> guestOSType; 909 909 HRESULT rc = mParent->GetGuestOSType (aOSTypeId, 910 910 guestOSType.asOutParam()); 911 CheckComRCReturnRC 911 CheckComRCReturnRC(rc); 912 912 913 913 /* when setting, always use the "etalon" value for consistency -- lookup … … 915 915 Bstr osTypeId; 916 916 rc = guestOSType->COMGETTER(Id) (osTypeId.asOutParam()); 917 CheckComRCReturnRC 918 919 AutoWriteLock alock 920 921 rc = checkStateDependency 922 CheckComRCReturnRC 917 CheckComRCReturnRC(rc); 918 919 AutoWriteLock alock(this); 920 921 rc = checkStateDependency(MutableStateDep); 922 CheckComRCReturnRC(rc); 923 923 924 924 mUserData.backup(); … … 933 933 return E_POINTER; 934 934 935 AutoCaller autoCaller 936 CheckComRCReturnRC 937 938 AutoReadLock alock 939 940 mHWData->mHWVersion.cloneTo 935 AutoCaller autoCaller(this); 936 CheckComRCReturnRC(autoCaller.rc()); 937 938 AutoReadLock alock(this); 939 940 mHWData->mHWVersion.cloneTo(aHWVersion); 941 941 942 942 return S_OK; … … 952 952 tr ("Invalid hardware version: %ls\n"), aHWVersion); 953 953 954 AutoCaller autoCaller 955 CheckComRCReturnRC 956 957 AutoWriteLock alock 958 959 HRESULT rc = checkStateDependency 960 CheckComRCReturnRC 954 AutoCaller autoCaller(this); 955 CheckComRCReturnRC(autoCaller.rc()); 956 957 AutoWriteLock alock(this); 958 959 HRESULT rc = checkStateDependency(MutableStateDep); 960 CheckComRCReturnRC(rc); 961 961 962 962 mHWData.backup(); … … 971 971 return E_POINTER; 972 972 973 AutoCaller autoCaller 974 CheckComRCReturnRC 975 976 AutoReadLock alock 973 AutoCaller autoCaller(this); 974 CheckComRCReturnRC(autoCaller.rc()); 975 976 AutoReadLock alock(this); 977 977 978 978 *memorySize = mHWData->mMemorySize; … … 990 990 memorySize, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB); 991 991 992 AutoCaller autoCaller 993 CheckComRCReturnRC 994 995 AutoWriteLock alock 996 997 HRESULT rc = checkStateDependency 998 CheckComRCReturnRC 992 AutoCaller autoCaller(this); 993 CheckComRCReturnRC(autoCaller.rc()); 994 995 AutoWriteLock alock(this); 996 997 HRESULT rc = checkStateDependency(MutableStateDep); 998 CheckComRCReturnRC(rc); 999 999 1000 1000 mHWData.backup(); … … 1009 1009 return E_POINTER; 1010 1010 1011 AutoCaller autoCaller 1012 CheckComRCReturnRC 1013 1014 AutoReadLock alock 1011 AutoCaller autoCaller(this); 1012 CheckComRCReturnRC(autoCaller.rc()); 1013 1014 AutoReadLock alock(this); 1015 1015 1016 1016 *CPUCount = mHWData->mCPUCount; … … 1028 1028 CPUCount, SchemaDefs::MinCPUCount, SchemaDefs::MaxCPUCount); 1029 1029 1030 AutoCaller autoCaller 1031 CheckComRCReturnRC 1032 1033 AutoWriteLock alock 1034 1035 HRESULT rc = checkStateDependency 1036 CheckComRCReturnRC 1030 AutoCaller autoCaller(this); 1031 CheckComRCReturnRC(autoCaller.rc()); 1032 1033 AutoWriteLock alock(this); 1034 1035 HRESULT rc = checkStateDependency(MutableStateDep); 1036 CheckComRCReturnRC(rc); 1037 1037 1038 1038 mHWData.backup(); … … 1047 1047 return E_POINTER; 1048 1048 1049 AutoCaller autoCaller 1050 CheckComRCReturnRC 1051 1052 AutoReadLock alock 1049 AutoCaller autoCaller(this); 1050 CheckComRCReturnRC(autoCaller.rc()); 1051 1052 AutoReadLock alock(this); 1053 1053 1054 1054 *memorySize = mHWData->mVRAMSize; … … 1066 1066 memorySize, SchemaDefs::MinGuestVRAM, SchemaDefs::MaxGuestVRAM); 1067 1067 1068 AutoCaller autoCaller 1069 CheckComRCReturnRC 1070 1071 AutoWriteLock alock 1072 1073 HRESULT rc = checkStateDependency 1074 CheckComRCReturnRC 1068 AutoCaller autoCaller(this); 1069 CheckComRCReturnRC(autoCaller.rc()); 1070 1071 AutoWriteLock alock(this); 1072 1073 HRESULT rc = checkStateDependency(MutableStateDep); 1074 CheckComRCReturnRC(rc); 1075 1075 1076 1076 mHWData.backup(); … … 1086 1086 return E_POINTER; 1087 1087 1088 AutoCaller autoCaller 1089 CheckComRCReturnRC 1090 1091 AutoReadLock alock 1088 AutoCaller autoCaller(this); 1089 CheckComRCReturnRC(autoCaller.rc()); 1090 1091 AutoReadLock alock(this); 1092 1092 1093 1093 *memoryBalloonSize = mHWData->mMemoryBalloonSize; … … 1105 1105 memoryBalloonSize, 0, VMMDEV_MAX_MEMORY_BALLOON (mHWData->mMemorySize)); 1106 1106 1107 AutoCaller autoCaller 1108 CheckComRCReturnRC 1109 1110 AutoWriteLock alock 1111 1112 HRESULT rc = checkStateDependency 1113 CheckComRCReturnRC 1107 AutoCaller autoCaller(this); 1108 CheckComRCReturnRC(autoCaller.rc()); 1109 1110 AutoWriteLock alock(this); 1111 1112 HRESULT rc = checkStateDependency(MutableStateDep); 1113 CheckComRCReturnRC(rc); 1114 1114 1115 1115 mHWData.backup(); … … 1125 1125 return E_POINTER; 1126 1126 1127 AutoCaller autoCaller 1128 CheckComRCReturnRC 1129 1130 AutoReadLock alock 1127 AutoCaller autoCaller(this); 1128 CheckComRCReturnRC(autoCaller.rc()); 1129 1130 AutoReadLock alock(this); 1131 1131 1132 1132 *statisticsUpdateInterval = mHWData->mStatisticsUpdateInterval; … … 1138 1138 STDMETHODIMP Machine::COMSETTER(StatisticsUpdateInterval) (ULONG statisticsUpdateInterval) 1139 1139 { 1140 AutoCaller autoCaller 1141 CheckComRCReturnRC 1142 1143 AutoWriteLock alock 1144 1145 HRESULT rc = checkStateDependency 1146 CheckComRCReturnRC 1140 AutoCaller autoCaller(this); 1141 CheckComRCReturnRC(autoCaller.rc()); 1142 1143 AutoWriteLock alock(this); 1144 1145 HRESULT rc = checkStateDependency(MutableStateDep); 1146 CheckComRCReturnRC(rc); 1147 1147 1148 1148 mHWData.backup(); … … 1158 1158 return E_POINTER; 1159 1159 1160 AutoCaller autoCaller 1161 CheckComRCReturnRC 1162 1163 AutoReadLock alock 1160 AutoCaller autoCaller(this); 1161 CheckComRCReturnRC(autoCaller.rc()); 1162 1163 AutoReadLock alock(this); 1164 1164 1165 1165 *enabled = mHWData->mAccelerate3DEnabled; … … 1170 1170 STDMETHODIMP Machine::COMSETTER(Accelerate3DEnabled)(BOOL enable) 1171 1171 { 1172 AutoCaller autoCaller 1173 CheckComRCReturnRC 1174 1175 AutoWriteLock alock 1176 1177 HRESULT rc = checkStateDependency 1178 CheckComRCReturnRC 1172 AutoCaller autoCaller(this); 1173 CheckComRCReturnRC(autoCaller.rc()); 1174 1175 AutoWriteLock alock(this); 1176 1177 HRESULT rc = checkStateDependency(MutableStateDep); 1178 CheckComRCReturnRC(rc); 1179 1179 1180 1180 /** @todo check validity! */ … … 1192 1192 return E_POINTER; 1193 1193 1194 AutoCaller autoCaller 1195 CheckComRCReturnRC 1196 1197 AutoReadLock alock 1194 AutoCaller autoCaller(this); 1195 CheckComRCReturnRC(autoCaller.rc()); 1196 1197 AutoReadLock alock(this); 1198 1198 1199 1199 *monitorCount = mHWData->mMonitorCount; … … 1210 1210 monitorCount, 1, SchemaDefs::MaxGuestMonitors); 1211 1211 1212 AutoCaller autoCaller 1213 CheckComRCReturnRC 1214 1215 AutoWriteLock alock 1216 1217 HRESULT rc = checkStateDependency 1218 CheckComRCReturnRC 1212 AutoCaller autoCaller(this); 1213 CheckComRCReturnRC(autoCaller.rc()); 1214 1215 AutoWriteLock alock(this); 1216 1217 HRESULT rc = checkStateDependency(MutableStateDep); 1218 CheckComRCReturnRC(rc); 1219 1219 1220 1220 mHWData.backup(); … … 1229 1229 return E_POINTER; 1230 1230 1231 AutoCaller autoCaller 1232 CheckComRCReturnRC 1231 AutoCaller autoCaller(this); 1232 CheckComRCReturnRC(autoCaller.rc()); 1233 1233 1234 1234 /* mBIOSSettings is constant during life time, no need to lock */ 1235 mBIOSSettings.queryInterfaceTo 1235 mBIOSSettings.queryInterfaceTo(biosSettings); 1236 1236 1237 1237 return S_OK; … … 1243 1243 return E_POINTER; 1244 1244 1245 AutoCaller autoCaller 1246 CheckComRCReturnRC 1247 1248 AutoReadLock alock 1245 AutoCaller autoCaller(this); 1246 CheckComRCReturnRC(autoCaller.rc()); 1247 1248 AutoReadLock alock(this); 1249 1249 1250 1250 *enabled = mHWData->mHWVirtExEnabled; … … 1255 1255 STDMETHODIMP Machine::COMSETTER(HWVirtExEnabled)(BOOL enable) 1256 1256 { 1257 AutoCaller autoCaller 1258 CheckComRCReturnRC 1259 1260 AutoWriteLock alock 1261 1262 HRESULT rc = checkStateDependency 1263 CheckComRCReturnRC 1257 AutoCaller autoCaller(this); 1258 CheckComRCReturnRC(autoCaller.rc()); 1259 1260 AutoWriteLock alock(this); 1261 1262 HRESULT rc = checkStateDependency(MutableStateDep); 1263 CheckComRCReturnRC(rc); 1264 1264 1265 1265 /** @todo check validity! */ … … 1276 1276 return E_POINTER; 1277 1277 1278 AutoCaller autoCaller 1279 CheckComRCReturnRC 1280 1281 AutoReadLock alock 1278 AutoCaller autoCaller(this); 1279 CheckComRCReturnRC(autoCaller.rc()); 1280 1281 AutoReadLock alock(this); 1282 1282 1283 1283 *enabled = mHWData->mHWVirtExNestedPagingEnabled; … … 1288 1288 STDMETHODIMP Machine::COMSETTER(HWVirtExNestedPagingEnabled)(BOOL enable) 1289 1289 { 1290 AutoCaller autoCaller 1291 CheckComRCReturnRC 1292 1293 AutoWriteLock alock 1294 1295 HRESULT rc = checkStateDependency 1296 CheckComRCReturnRC 1290 AutoCaller autoCaller(this); 1291 CheckComRCReturnRC(autoCaller.rc()); 1292 1293 AutoWriteLock alock(this); 1294 1295 HRESULT rc = checkStateDependency(MutableStateDep); 1296 CheckComRCReturnRC(rc); 1297 1297 1298 1298 /** @todo check validity! */ … … 1309 1309 return E_POINTER; 1310 1310 1311 AutoCaller autoCaller 1312 CheckComRCReturnRC 1313 1314 AutoReadLock alock 1311 AutoCaller autoCaller(this); 1312 CheckComRCReturnRC(autoCaller.rc()); 1313 1314 AutoReadLock alock(this); 1315 1315 1316 1316 *enabled = mHWData->mHWVirtExVPIDEnabled; … … 1321 1321 STDMETHODIMP Machine::COMSETTER(HWVirtExVPIDEnabled)(BOOL enable) 1322 1322 { 1323 AutoCaller autoCaller 1324 CheckComRCReturnRC 1325 1326 AutoWriteLock alock 1327 1328 HRESULT rc = checkStateDependency 1329 CheckComRCReturnRC 1323 AutoCaller autoCaller(this); 1324 CheckComRCReturnRC(autoCaller.rc()); 1325 1326 AutoWriteLock alock(this); 1327 1328 HRESULT rc = checkStateDependency(MutableStateDep); 1329 CheckComRCReturnRC(rc); 1330 1330 1331 1331 /** @todo check validity! */ … … 1342 1342 return E_POINTER; 1343 1343 1344 AutoCaller autoCaller 1345 CheckComRCReturnRC 1346 1347 AutoReadLock alock 1344 AutoCaller autoCaller(this); 1345 CheckComRCReturnRC(autoCaller.rc()); 1346 1347 AutoReadLock alock(this); 1348 1348 1349 1349 *enabled = mHWData->mPAEEnabled; … … 1354 1354 STDMETHODIMP Machine::COMSETTER(PAEEnabled)(BOOL enable) 1355 1355 { 1356 AutoCaller autoCaller 1357 CheckComRCReturnRC 1358 1359 AutoWriteLock alock 1360 1361 HRESULT rc = checkStateDependency 1362 CheckComRCReturnRC 1356 AutoCaller autoCaller(this); 1357 CheckComRCReturnRC(autoCaller.rc()); 1358 1359 AutoWriteLock alock(this); 1360 1361 HRESULT rc = checkStateDependency(MutableStateDep); 1362 CheckComRCReturnRC(rc); 1363 1363 1364 1364 /** @todo check validity! */ … … 1372 1372 STDMETHODIMP Machine::COMGETTER(SnapshotFolder) (BSTR *aSnapshotFolder) 1373 1373 { 1374 CheckComArgOutPointerValid 1375 1376 AutoCaller autoCaller 1377 CheckComRCReturnRC 1378 1379 AutoReadLock alock 1380 1381 mUserData->mSnapshotFolderFull.cloneTo 1374 CheckComArgOutPointerValid(aSnapshotFolder); 1375 1376 AutoCaller autoCaller(this); 1377 CheckComRCReturnRC(autoCaller.rc()); 1378 1379 AutoReadLock alock(this); 1380 1381 mUserData->mSnapshotFolderFull.cloneTo(aSnapshotFolder); 1382 1382 1383 1383 return S_OK; … … 1394 1394 */ 1395 1395 1396 AutoCaller autoCaller 1397 CheckComRCReturnRC 1398 1399 AutoWriteLock alock 1400 1401 HRESULT rc = checkStateDependency 1402 CheckComRCReturnRC 1396 AutoCaller autoCaller(this); 1397 CheckComRCReturnRC(autoCaller.rc()); 1398 1399 AutoWriteLock alock(this); 1400 1401 HRESULT rc = checkStateDependency(MutableStateDep); 1402 CheckComRCReturnRC(rc); 1403 1403 1404 1404 if (!mData->mCurrentSnapshot.isNull()) … … 1425 1425 1426 1426 int vrc = calculateFullPath (snapshotFolder, snapshotFolder); 1427 if (RT_FAILURE 1427 if (RT_FAILURE(vrc)) 1428 1428 return setError (E_FAIL, 1429 1429 tr ("Invalid snapshot folder '%ls' (%Rrc)"), … … 1440 1440 COMGETTER(HardDiskAttachments) (ComSafeArrayOut(IHardDiskAttachment *, aAttachments)) 1441 1441 { 1442 if (ComSafeArrayOutIsNull 1442 if (ComSafeArrayOutIsNull(aAttachments)) 1443 1443 return E_POINTER; 1444 1444 1445 AutoCaller autoCaller 1446 CheckComRCReturnRC 1447 1448 AutoReadLock alock 1445 AutoCaller autoCaller(this); 1446 CheckComRCReturnRC(autoCaller.rc()); 1447 1448 AutoReadLock alock(this); 1449 1449 1450 1450 SafeIfaceArray<IHardDiskAttachment> attachments (mHDData->mAttachments); 1451 attachments.detachTo (ComSafeArrayOutArg(aAttachments));1451 attachments.detachTo(ComSafeArrayOutArg(aAttachments)); 1452 1452 1453 1453 return S_OK; … … 1460 1460 return E_POINTER; 1461 1461 1462 AutoCaller autoCaller 1463 CheckComRCReturnRC 1464 1465 AutoReadLock alock 1462 AutoCaller autoCaller(this); 1463 CheckComRCReturnRC(autoCaller.rc()); 1464 1465 AutoReadLock alock(this); 1466 1466 1467 1467 Assert (!!mVRDPServer); 1468 mVRDPServer.queryInterfaceTo 1468 mVRDPServer.queryInterfaceTo(vrdpServer); 1469 1469 1470 1470 return S_OK; … … 1480 1480 return E_POINTER; 1481 1481 1482 AutoCaller autoCaller 1483 CheckComRCReturnRC 1484 1485 AutoReadLock alock 1482 AutoCaller autoCaller(this); 1483 CheckComRCReturnRC(autoCaller.rc()); 1484 1485 AutoReadLock alock(this); 1486 1486 1487 1487 Assert (!!mDVDDrive); 1488 mDVDDrive.queryInterfaceTo 1488 mDVDDrive.queryInterfaceTo(dvdDrive); 1489 1489 return S_OK; 1490 1490 } … … 1495 1495 return E_POINTER; 1496 1496 1497 AutoCaller autoCaller 1498 CheckComRCReturnRC 1499 1500 AutoReadLock alock 1497 AutoCaller autoCaller(this); 1498 CheckComRCReturnRC(autoCaller.rc()); 1499 1500 AutoReadLock alock(this); 1501 1501 1502 1502 Assert (!!mFloppyDrive); 1503 mFloppyDrive.queryInterfaceTo 1503 mFloppyDrive.queryInterfaceTo(floppyDrive); 1504 1504 return S_OK; 1505 1505 } … … 1510 1510 return E_POINTER; 1511 1511 1512 AutoCaller autoCaller 1513 CheckComRCReturnRC 1514 1515 AutoReadLock alock 1516 1517 mAudioAdapter.queryInterfaceTo 1512 AutoCaller autoCaller(this); 1513 CheckComRCReturnRC(autoCaller.rc()); 1514 1515 AutoReadLock alock(this); 1516 1517 mAudioAdapter.queryInterfaceTo(audioAdapter); 1518 1518 return S_OK; 1519 1519 } … … 1522 1522 { 1523 1523 #ifdef VBOX_WITH_USB 1524 CheckComArgOutPointerValid 1525 1526 AutoCaller autoCaller 1527 CheckComRCReturnRC 1524 CheckComArgOutPointerValid(aUSBController); 1525 1526 AutoCaller autoCaller(this); 1527 CheckComRCReturnRC(autoCaller.rc()); 1528 1528 1529 1529 MultiResult rc = mParent->host()->checkUSBProxyService(); 1530 CheckComRCReturnRC 1531 1532 AutoReadLock alock 1533 1534 return rc = mUSBController.queryInterfaceTo 1530 CheckComRCReturnRC(rc); 1531 1532 AutoReadLock alock(this); 1533 1534 return rc = mUSBController.queryInterfaceTo(aUSBController); 1535 1535 #else 1536 1536 /* Note: The GUI depends on this method returning E_NOTIMPL with no … … 1544 1544 STDMETHODIMP Machine::COMGETTER(SettingsFilePath) (BSTR *aFilePath) 1545 1545 { 1546 CheckComArgOutPointerValid 1547 1548 AutoLimitedCaller autoCaller 1549 CheckComRCReturnRC 1550 1551 AutoReadLock alock 1552 1553 mData->mConfigFileFull.cloneTo 1546 CheckComArgOutPointerValid(aFilePath); 1547 1548 AutoLimitedCaller autoCaller(this); 1549 CheckComRCReturnRC(autoCaller.rc()); 1550 1551 AutoReadLock alock(this); 1552 1553 mData->mConfigFileFull.cloneTo(aFilePath); 1554 1554 return S_OK; 1555 1555 } … … 1558 1558 COMGETTER(SettingsFileVersion) (BSTR *aSettingsFileVersion) 1559 1559 { 1560 CheckComArgOutPointerValid 1561 1562 AutoCaller autoCaller 1563 CheckComRCReturnRC 1564 1565 AutoReadLock alock 1566 1567 mData->mSettingsFileVersion.cloneTo 1560 CheckComArgOutPointerValid(aSettingsFileVersion); 1561 1562 AutoCaller autoCaller(this); 1563 CheckComRCReturnRC(autoCaller.rc()); 1564 1565 AutoReadLock alock(this); 1566 1567 mData->mSettingsFileVersion.cloneTo(aSettingsFileVersion); 1568 1568 return S_OK; 1569 1569 } … … 1571 1571 STDMETHODIMP Machine::COMGETTER(SettingsModified) (BOOL *aModified) 1572 1572 { 1573 CheckComArgOutPointerValid 1574 1575 AutoCaller autoCaller 1576 CheckComRCReturnRC 1577 1578 AutoWriteLock alock 1579 1580 HRESULT rc = checkStateDependency 1581 CheckComRCReturnRC 1573 CheckComArgOutPointerValid(aModified); 1574 1575 AutoCaller autoCaller(this); 1576 CheckComRCReturnRC(autoCaller.rc()); 1577 1578 AutoWriteLock alock(this); 1579 1580 HRESULT rc = checkStateDependency(MutableStateDep); 1581 CheckComRCReturnRC(rc); 1582 1582 1583 1583 if (!isConfigLocked()) … … 1599 1599 STDMETHODIMP Machine::COMGETTER(SessionState) (SessionState_T *aSessionState) 1600 1600 { 1601 CheckComArgOutPointerValid 1602 1603 AutoCaller autoCaller 1604 CheckComRCReturnRC 1605 1606 AutoReadLock alock 1601 CheckComArgOutPointerValid(aSessionState); 1602 1603 AutoCaller autoCaller(this); 1604 CheckComRCReturnRC(autoCaller.rc()); 1605 1606 AutoReadLock alock(this); 1607 1607 1608 1608 *aSessionState = mData->mSession.mState; … … 1613 1613 STDMETHODIMP Machine::COMGETTER(SessionType) (BSTR *aSessionType) 1614 1614 { 1615 CheckComArgOutPointerValid 1616 1617 AutoCaller autoCaller 1618 CheckComRCReturnRC 1619 1620 AutoReadLock alock 1615 CheckComArgOutPointerValid(aSessionType); 1616 1617 AutoCaller autoCaller(this); 1618 CheckComRCReturnRC(autoCaller.rc()); 1619 1620 AutoReadLock alock(this); 1621 1621 1622 1622 if (mData->mSession.mType.isNull()) 1623 1623 Bstr("").cloneTo(aSessionType); 1624 1624 else 1625 mData->mSession.mType.cloneTo 1625 mData->mSession.mType.cloneTo(aSessionType); 1626 1626 1627 1627 return S_OK; … … 1630 1630 STDMETHODIMP Machine::COMGETTER(SessionPid) (ULONG *aSessionPid) 1631 1631 { 1632 CheckComArgOutPointerValid 1633 1634 AutoCaller autoCaller 1635 CheckComRCReturnRC 1636 1637 AutoReadLock alock 1632 CheckComArgOutPointerValid(aSessionPid); 1633 1634 AutoCaller autoCaller(this); 1635 CheckComRCReturnRC(autoCaller.rc()); 1636 1637 AutoReadLock alock(this); 1638 1638 1639 1639 *aSessionPid = mData->mSession.mPid; … … 1647 1647 return E_POINTER; 1648 1648 1649 AutoCaller autoCaller 1650 CheckComRCReturnRC 1651 1652 AutoReadLock alock 1649 AutoCaller autoCaller(this); 1650 CheckComRCReturnRC(autoCaller.rc()); 1651 1652 AutoReadLock alock(this); 1653 1653 1654 1654 *machineState = mData->mMachineState; … … 1659 1659 STDMETHODIMP Machine::COMGETTER(LastStateChange) (LONG64 *aLastStateChange) 1660 1660 { 1661 CheckComArgOutPointerValid 1662 1663 AutoCaller autoCaller 1664 CheckComRCReturnRC 1665 1666 AutoReadLock alock 1661 CheckComArgOutPointerValid(aLastStateChange); 1662 1663 AutoCaller autoCaller(this); 1664 CheckComRCReturnRC(autoCaller.rc()); 1665 1666 AutoReadLock alock(this); 1667 1667 1668 1668 *aLastStateChange = RTTimeSpecGetMilli (&mData->mLastStateChange); … … 1673 1673 STDMETHODIMP Machine::COMGETTER(StateFilePath) (BSTR *aStateFilePath) 1674 1674 { 1675 CheckComArgOutPointerValid 1676 1677 AutoCaller autoCaller 1678 CheckComRCReturnRC 1679 1680 AutoReadLock alock 1675 CheckComArgOutPointerValid(aStateFilePath); 1676 1677 AutoCaller autoCaller(this); 1678 CheckComRCReturnRC(autoCaller.rc()); 1679 1680 AutoReadLock alock(this); 1681 1681 1682 1682 if (mSSData->mStateFilePath.isEmpty()) 1683 1683 Bstr("").cloneTo(aStateFilePath); 1684 1684 else 1685 mSSData->mStateFilePath.cloneTo 1685 mSSData->mStateFilePath.cloneTo(aStateFilePath); 1686 1686 1687 1687 return S_OK; … … 1690 1690 STDMETHODIMP Machine::COMGETTER(LogFolder) (BSTR *aLogFolder) 1691 1691 { 1692 CheckComArgOutPointerValid 1693 1694 AutoCaller autoCaller 1695 AssertComRCReturnRC 1696 1697 AutoReadLock alock 1692 CheckComArgOutPointerValid(aLogFolder); 1693 1694 AutoCaller autoCaller(this); 1695 AssertComRCReturnRC(autoCaller.rc()); 1696 1697 AutoReadLock alock(this); 1698 1698 1699 1699 Utf8Str logFolder; 1700 1700 getLogFolder (logFolder); 1701 1701 1702 Bstr (logFolder).cloneTo 1702 Bstr (logFolder).cloneTo(aLogFolder); 1703 1703 1704 1704 return S_OK; … … 1707 1707 STDMETHODIMP Machine::COMGETTER(CurrentSnapshot) (ISnapshot **aCurrentSnapshot) 1708 1708 { 1709 CheckComArgOutPointerValid 1710 1711 AutoCaller autoCaller 1712 CheckComRCReturnRC 1713 1714 AutoReadLock alock 1715 1716 mData->mCurrentSnapshot.queryInterfaceTo 1709 CheckComArgOutPointerValid(aCurrentSnapshot); 1710 1711 AutoCaller autoCaller(this); 1712 CheckComRCReturnRC(autoCaller.rc()); 1713 1714 AutoReadLock alock(this); 1715 1716 mData->mCurrentSnapshot.queryInterfaceTo(aCurrentSnapshot); 1717 1717 1718 1718 return S_OK; … … 1721 1721 STDMETHODIMP Machine::COMGETTER(SnapshotCount)(ULONG *aSnapshotCount) 1722 1722 { 1723 CheckComArgOutPointerValid 1724 1725 AutoCaller autoCaller 1726 CheckComRCReturnRC 1723 CheckComArgOutPointerValid(aSnapshotCount); 1724 1725 AutoCaller autoCaller(this); 1726 CheckComRCReturnRC(autoCaller.rc()); 1727 1727 1728 1728 AutoReadLock alock(this); … … 1737 1737 STDMETHODIMP Machine::COMGETTER(CurrentStateModified) (BOOL *aCurrentStateModified) 1738 1738 { 1739 CheckComArgOutPointerValid 1740 1741 AutoCaller autoCaller 1742 CheckComRCReturnRC 1743 1744 AutoReadLock alock 1739 CheckComArgOutPointerValid(aCurrentStateModified); 1740 1741 AutoCaller autoCaller(this); 1742 CheckComRCReturnRC(autoCaller.rc()); 1743 1744 AutoReadLock alock(this); 1745 1745 1746 1746 /* Note: for machines with no snapshots, we always return FALSE … … 1755 1755 1756 1756 STDMETHODIMP 1757 Machine::COMGETTER(SharedFolders) (ComSafeArrayOut 1758 { 1759 CheckComArgOutSafeArrayPointerValid 1760 1761 AutoCaller autoCaller 1762 CheckComRCReturnRC 1763 1764 AutoReadLock alock 1765 1766 SafeIfaceArray 1767 folders.detachTo 1757 Machine::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 1758 { 1759 CheckComArgOutSafeArrayPointerValid(aSharedFolders); 1760 1761 AutoCaller autoCaller(this); 1762 CheckComRCReturnRC(autoCaller.rc()); 1763 1764 AutoReadLock alock(this); 1765 1766 SafeIfaceArray<ISharedFolder> folders (mHWData->mSharedFolders); 1767 folders.detachTo(ComSafeArrayOutArg(aSharedFolders)); 1768 1768 1769 1769 return S_OK; … … 1773 1773 Machine::COMGETTER(ClipboardMode) (ClipboardMode_T *aClipboardMode) 1774 1774 { 1775 CheckComArgOutPointerValid 1776 1777 AutoCaller autoCaller 1778 CheckComRCReturnRC 1779 1780 AutoReadLock alock 1775 CheckComArgOutPointerValid(aClipboardMode); 1776 1777 AutoCaller autoCaller(this); 1778 CheckComRCReturnRC(autoCaller.rc()); 1779 1780 AutoReadLock alock(this); 1781 1781 1782 1782 *aClipboardMode = mHWData->mClipboardMode; … … 1788 1788 Machine::COMSETTER(ClipboardMode) (ClipboardMode_T aClipboardMode) 1789 1789 { 1790 AutoCaller autoCaller 1791 CheckComRCReturnRC 1792 1793 AutoWriteLock alock 1794 1795 HRESULT rc = checkStateDependency 1796 CheckComRCReturnRC 1790 AutoCaller autoCaller(this); 1791 CheckComRCReturnRC(autoCaller.rc()); 1792 1793 AutoWriteLock alock(this); 1794 1795 HRESULT rc = checkStateDependency(MutableStateDep); 1796 CheckComRCReturnRC(rc); 1797 1797 1798 1798 mHWData.backup(); … … 1805 1805 Machine::COMGETTER(GuestPropertyNotificationPatterns) (BSTR *aPatterns) 1806 1806 { 1807 CheckComArgOutPointerValid 1808 1809 AutoCaller autoCaller 1810 CheckComRCReturnRC 1811 1812 AutoReadLock alock 1813 1814 mHWData->mGuestPropertyNotificationPatterns.cloneTo 1807 CheckComArgOutPointerValid(aPatterns); 1808 1809 AutoCaller autoCaller(this); 1810 CheckComRCReturnRC(autoCaller.rc()); 1811 1812 AutoReadLock alock(this); 1813 1814 mHWData->mGuestPropertyNotificationPatterns.cloneTo(aPatterns); 1815 1815 1816 1816 return RT_LIKELY (aPatterns != NULL) ? S_OK : E_OUTOFMEMORY; … … 1821 1821 { 1822 1822 AssertLogRelReturn (VALID_PTR (aPatterns), E_POINTER); 1823 AutoCaller autoCaller 1824 CheckComRCReturnRC 1825 1826 AutoWriteLock alock 1827 1828 HRESULT rc = checkStateDependency 1829 CheckComRCReturnRC 1823 AutoCaller autoCaller(this); 1824 CheckComRCReturnRC(autoCaller.rc()); 1825 1826 AutoWriteLock alock(this); 1827 1828 HRESULT rc = checkStateDependency(MutableStateDep); 1829 CheckComRCReturnRC(rc); 1830 1830 1831 1831 mHWData.backup(); … … 1839 1839 Machine::COMGETTER(StorageControllers) (ComSafeArrayOut(IStorageController *, aStorageControllers)) 1840 1840 { 1841 CheckComArgOutSafeArrayPointerValid 1842 1843 AutoCaller autoCaller 1844 CheckComRCReturnRC 1845 1846 AutoReadLock alock 1847 1848 SafeIfaceArray 1849 ctrls.detachTo 1841 CheckComArgOutSafeArrayPointerValid(aStorageControllers); 1842 1843 AutoCaller autoCaller(this); 1844 CheckComRCReturnRC(autoCaller.rc()); 1845 1846 AutoReadLock alock(this); 1847 1848 SafeIfaceArray<IStorageController> ctrls (*mStorageControllers.data()); 1849 ctrls.detachTo(ComSafeArrayOutArg(aStorageControllers)); 1850 1850 1851 1851 return S_OK; … … 1866 1866 tr ("Booting from USB device is currently not supported")); 1867 1867 1868 AutoCaller autoCaller 1869 CheckComRCReturnRC 1870 1871 AutoWriteLock alock 1872 1873 HRESULT rc = checkStateDependency 1874 CheckComRCReturnRC 1868 AutoCaller autoCaller(this); 1869 CheckComRCReturnRC(autoCaller.rc()); 1870 1871 AutoWriteLock alock(this); 1872 1873 HRESULT rc = checkStateDependency(MutableStateDep); 1874 CheckComRCReturnRC(rc); 1875 1875 1876 1876 mHWData.backup(); … … 1887 1887 aPosition, SchemaDefs::MaxBootPosition); 1888 1888 1889 AutoCaller autoCaller 1890 CheckComRCReturnRC 1891 1892 AutoReadLock alock 1889 AutoCaller autoCaller(this); 1890 CheckComRCReturnRC(autoCaller.rc()); 1891 1892 AutoReadLock alock(this); 1893 1893 1894 1894 *aDevice = mHWData->mBootOrder [aPosition - 1]; … … 1904 1904 aControllerName, aControllerPort, aDevice)); 1905 1905 1906 AutoCaller autoCaller 1907 CheckComRCReturnRC 1906 AutoCaller autoCaller(this); 1907 CheckComRCReturnRC(autoCaller.rc()); 1908 1908 1909 1909 /* VirtualBox::findHardDisk() need read lock; also we want to make sure the 1910 1910 * hard disk object we pick up doesn't get unregistered before we finish. */ 1911 1911 AutoReadLock vboxLock (mParent); 1912 AutoWriteLock alock 1913 1914 HRESULT rc = checkStateDependency 1915 CheckComRCReturnRC 1912 AutoWriteLock alock(this); 1913 1914 HRESULT rc = checkStateDependency(MutableStateDep); 1915 CheckComRCReturnRC(rc); 1916 1916 1917 1917 /// @todo NEWMEDIA implicit machine registration … … 1920 1920 tr ("Cannot attach hard disks to an unregistered machine")); 1921 1921 1922 AssertReturn 1922 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 1923 1923 1924 1924 if (Global::IsOnlineOrTransient (mData->mMachineState)) … … 1969 1969 ComObjPtr<HardDisk> hd; 1970 1970 rc = mParent->findHardDisk(&id, NULL, true /* aSetError */, &hd); 1971 CheckComRCReturnRC 1971 CheckComRCReturnRC(rc); 1972 1972 1973 1973 AutoCaller hdCaller (hd); 1974 CheckComRCReturnRC 1974 CheckComRCReturnRC(hdCaller.rc()); 1975 1975 1976 1976 AutoWriteLock hdLock (hd); … … 2004 2004 if (it != oldAtts.end()) 2005 2005 { 2006 AssertReturn 2006 AssertReturn(!indirect, E_FAIL); 2007 2007 2008 2008 /* see if it's the same bus/channel/device */ … … 2089 2089 hd = (*foundIt)->hardDisk(); 2090 2090 hdCaller.attach (hd); 2091 CheckComRCReturnRC 2091 CheckComRCReturnRC(hdCaller.rc()); 2092 2092 hdLock.attach (hd); 2093 2093 /* not implicit, doesn't require association with this VM */ … … 2156 2156 hd = base; 2157 2157 hdCaller.attach (hd); 2158 CheckComRCReturnRC 2158 CheckComRCReturnRC(hdCaller.rc()); 2159 2159 hdLock.attach (hd); 2160 2160 } … … 2167 2167 BstrFmt ("%ls"RTPATH_SLASH_STR, 2168 2168 mUserData->mSnapshotFolderFull.raw())); 2169 CheckComRCReturnRC 2169 CheckComRCReturnRC(rc); 2170 2170 2171 2171 /* make sure the hard disk is not modified before createDiffStorage() */ 2172 2172 rc = hd->LockRead (NULL); 2173 CheckComRCReturnRC 2173 CheckComRCReturnRC(rc); 2174 2174 2175 2175 /* will leave the lock before the potentially lengthy operation, so … … 2191 2191 hd->UnlockRead (NULL); 2192 2192 2193 CheckComRCReturnRC 2193 CheckComRCReturnRC(rc); 2194 2194 2195 2195 /* use the created diff for the actual attachment */ 2196 2196 hd = diff; 2197 2197 hdCaller.attach (hd); 2198 CheckComRCReturnRC 2198 CheckComRCReturnRC(hdCaller.rc()); 2199 2199 hdLock.attach (hd); 2200 2200 } … … 2204 2204 attachment.createObject(); 2205 2205 rc = attachment->init (hd, aControllerName, aControllerPort, aDevice, indirect); 2206 CheckComRCReturnRC 2206 CheckComRCReturnRC(rc); 2207 2207 2208 2208 if (associate) … … 2212 2212 /* here we can fail because of Deleting, or being in process of 2213 2213 * creating a Diff */ 2214 CheckComRCReturnRC 2214 CheckComRCReturnRC(rc); 2215 2215 } 2216 2216 … … 2229 2229 2230 2230 CheckComArgNotNull (aControllerName); 2231 CheckComArgOutPointerValid 2232 2233 AutoCaller autoCaller 2234 CheckComRCReturnRC 2235 2236 AutoReadLock alock 2231 CheckComArgOutPointerValid(aHardDisk); 2232 2233 AutoCaller autoCaller(this); 2234 CheckComRCReturnRC(autoCaller.rc()); 2235 2236 AutoReadLock alock(this); 2237 2237 2238 2238 *aHardDisk = NULL; … … 2248 2248 aDevice, aControllerPort, aControllerName); 2249 2249 2250 (*it)->hardDisk().queryInterfaceTo 2250 (*it)->hardDisk().queryInterfaceTo(aHardDisk); 2251 2251 2252 2252 return S_OK; … … 2261 2261 aControllerName, aControllerPort, aDevice)); 2262 2262 2263 AutoCaller autoCaller 2264 CheckComRCReturnRC 2265 2266 AutoWriteLock alock 2267 2268 HRESULT rc = checkStateDependency 2269 CheckComRCReturnRC 2270 2271 AssertReturn 2263 AutoCaller autoCaller(this); 2264 CheckComRCReturnRC(autoCaller.rc()); 2265 2266 AutoWriteLock alock(this); 2267 2268 HRESULT rc = checkStateDependency(MutableStateDep); 2269 CheckComRCReturnRC(rc); 2270 2271 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 2272 2272 2273 2273 if (Global::IsOnlineOrTransient (mData->mMachineState)) … … 2311 2311 setMachineState (oldState); 2312 2312 2313 CheckComRCReturnRC 2313 CheckComRCReturnRC(rc); 2314 2314 } 2315 2315 … … 2326 2326 STDMETHODIMP Machine::GetSerialPort (ULONG slot, ISerialPort **port) 2327 2327 { 2328 CheckComArgOutPointerValid 2328 CheckComArgOutPointerValid(port); 2329 2329 CheckComArgExpr (slot, slot < RT_ELEMENTS (mSerialPorts)); 2330 2330 2331 AutoCaller autoCaller 2332 CheckComRCReturnRC 2333 2334 AutoReadLock alock 2335 2336 mSerialPorts [slot].queryInterfaceTo 2331 AutoCaller autoCaller(this); 2332 CheckComRCReturnRC(autoCaller.rc()); 2333 2334 AutoReadLock alock(this); 2335 2336 mSerialPorts [slot].queryInterfaceTo(port); 2337 2337 2338 2338 return S_OK; … … 2341 2341 STDMETHODIMP Machine::GetParallelPort (ULONG slot, IParallelPort **port) 2342 2342 { 2343 CheckComArgOutPointerValid 2343 CheckComArgOutPointerValid(port); 2344 2344 CheckComArgExpr (slot, slot < RT_ELEMENTS (mParallelPorts)); 2345 2345 2346 AutoCaller autoCaller 2347 CheckComRCReturnRC 2348 2349 AutoReadLock alock 2350 2351 mParallelPorts [slot].queryInterfaceTo 2346 AutoCaller autoCaller(this); 2347 CheckComRCReturnRC(autoCaller.rc()); 2348 2349 AutoReadLock alock(this); 2350 2351 mParallelPorts [slot].queryInterfaceTo(port); 2352 2352 2353 2353 return S_OK; … … 2356 2356 STDMETHODIMP Machine::GetNetworkAdapter (ULONG slot, INetworkAdapter **adapter) 2357 2357 { 2358 CheckComArgOutPointerValid 2358 CheckComArgOutPointerValid(adapter); 2359 2359 CheckComArgExpr (slot, slot < RT_ELEMENTS (mNetworkAdapters)); 2360 2360 2361 AutoCaller autoCaller 2362 CheckComRCReturnRC 2363 2364 AutoReadLock alock 2365 2366 mNetworkAdapters [slot].queryInterfaceTo 2361 AutoCaller autoCaller(this); 2362 CheckComRCReturnRC(autoCaller.rc()); 2363 2364 AutoReadLock alock(this); 2365 2366 mNetworkAdapters [slot].queryInterfaceTo(adapter); 2367 2367 2368 2368 return S_OK; … … 2374 2374 STDMETHODIMP Machine::GetNextExtraDataKey (IN_BSTR aKey, BSTR *aNextKey, BSTR *aNextValue) 2375 2375 { 2376 CheckComArgOutPointerValid 2377 2378 AutoCaller autoCaller 2379 CheckComRCReturnRC 2376 CheckComArgOutPointerValid(aNextKey); 2377 2378 AutoCaller autoCaller(this); 2379 CheckComRCReturnRC(autoCaller.rc()); 2380 2380 2381 2381 /* start with nothing found */ … … 2394 2394 2395 2395 /* serialize file access (prevent writes) */ 2396 AutoReadLock alock 2396 AutoReadLock alock(this); 2397 2397 2398 2398 try … … 2407 2407 2408 2408 rc = VirtualBox::loadSettingsTree_Again (tree, file); 2409 CheckComRCReturnRC 2409 CheckComRCReturnRC(rc); 2410 2410 2411 2411 Key machineNode = tree.rootKey().key ("Machine"); … … 2425 2425 if (bstrInKey.isEmpty()) 2426 2426 { 2427 key.cloneTo 2427 key.cloneTo(aNextKey); 2428 2428 if (aNextValue) 2429 2429 { 2430 2430 Bstr val = (*it).stringValue ("value"); 2431 val.cloneTo 2431 val.cloneTo(aNextValue); 2432 2432 } 2433 2433 return S_OK; … … 2442 2442 { 2443 2443 Bstr key = (*it).stringValue ("name"); 2444 key.cloneTo 2444 key.cloneTo(aNextKey); 2445 2445 if (aNextValue) 2446 2446 { 2447 2447 Bstr val = (*it).stringValue ("value"); 2448 val.cloneTo 2448 val.cloneTo(aNextValue); 2449 2449 } 2450 2450 } … … 2480 2480 { 2481 2481 CheckComArgNotNull (aKey); 2482 CheckComArgOutPointerValid 2483 2484 AutoCaller autoCaller 2485 CheckComRCReturnRC 2482 CheckComArgOutPointerValid(aValue); 2483 2484 AutoCaller autoCaller(this); 2485 CheckComRCReturnRC(autoCaller.rc()); 2486 2486 2487 2487 /* serialize file access (prevent writes) */ 2488 AutoReadLock alock 2488 AutoReadLock alock(this); 2489 2489 2490 2490 /* start with nothing found */ … … 2499 2499 HRESULT rc = getExtraData(Utf8Str(aKey), val); 2500 2500 if (SUCCEEDED(rc)) 2501 val.cloneTo 2501 val.cloneTo(aValue); 2502 2502 2503 2503 return rc; … … 2519 2519 2520 2520 rc = VirtualBox::loadSettingsTree_Again (tree, file); 2521 CheckComRCReturnRC 2521 CheckComRCReturnRC(rc); 2522 2522 2523 2523 Key machineNode = tree.rootKey().key ("Machine"); … … 2554 2554 CheckComArgNotNull (aKey); 2555 2555 2556 AutoCaller autoCaller 2557 CheckComRCReturnRC 2556 AutoCaller autoCaller(this); 2557 CheckComRCReturnRC(autoCaller.rc()); 2558 2558 2559 2559 /* VirtualBox::onExtraDataCanChange() and saveSettings() need mParent … … 2565 2565 if (mType == IsSnapshotMachine) 2566 2566 { 2567 HRESULT rc = checkStateDependency 2568 CheckComRCReturnRC 2567 HRESULT rc = checkStateDependency(MutableStateDep); 2568 CheckComRCReturnRC(rc); 2569 2569 } 2570 2570 … … 2584 2584 { 2585 2585 rc = saveSettings(); 2586 CheckComRCReturnRC 2586 CheckComRCReturnRC(rc); 2587 2587 } 2588 2588 … … 2597 2597 2598 2598 rc = VirtualBox::loadSettingsTree_ForUpdate (tree, file); 2599 CheckComRCReturnRC 2599 CheckComRCReturnRC(rc); 2600 2600 2601 2601 const Utf8Str key = aKey; … … 2658 2658 rc = VirtualBox::saveSettingsTree (tree, file, 2659 2659 mData->mSettingsFileVersion); 2660 CheckComRCReturnRC 2660 CheckComRCReturnRC(rc); 2661 2661 } 2662 2662 } … … 2667 2667 2668 2668 /* fire a notification */ 2669 if (SUCCEEDED 2669 if (SUCCEEDED(rc) && changed) 2670 2670 mParent->onExtraDataChange (mData->mUuid, aKey, aValue); 2671 2671 … … 2675 2675 STDMETHODIMP Machine::SaveSettings() 2676 2676 { 2677 AutoCaller autoCaller 2678 CheckComRCReturnRC 2677 AutoCaller autoCaller(this); 2678 CheckComRCReturnRC(autoCaller.rc()); 2679 2679 2680 2680 /* saveSettings() needs mParent lock */ … … 2686 2686 MutableOrSavedStateDep : MutableStateDep; 2687 2687 2688 HRESULT rc = checkStateDependency 2689 CheckComRCReturnRC 2688 HRESULT rc = checkStateDependency(dep); 2689 CheckComRCReturnRC(rc); 2690 2690 2691 2691 /* the settings file path may never be null */ … … 2698 2698 STDMETHODIMP Machine::SaveSettingsWithBackup (BSTR *aBakFileName) 2699 2699 { 2700 CheckComArgOutPointerValid 2701 2702 AutoCaller autoCaller 2703 CheckComRCReturnRC 2700 CheckComArgOutPointerValid(aBakFileName); 2701 2702 AutoCaller autoCaller(this); 2703 CheckComRCReturnRC(autoCaller.rc()); 2704 2704 2705 2705 /* saveSettings() needs mParent lock */ … … 2711 2711 MutableOrSavedStateDep : MutableStateDep; 2712 2712 2713 HRESULT rc = checkStateDependency 2714 CheckComRCReturnRC 2713 HRESULT rc = checkStateDependency(dep); 2714 CheckComRCReturnRC(rc); 2715 2715 2716 2716 /* the settings file path may never be null */ … … 2725 2725 mData->mSettingsFileVersion, 2726 2726 bakFileName); 2727 CheckComRCReturnRC 2728 2729 bakFileName.cloneTo 2727 CheckComRCReturnRC(rc); 2728 2729 bakFileName.cloneTo(aBakFileName); 2730 2730 } 2731 2731 … … 2736 2736 STDMETHODIMP Machine::DiscardSettings() 2737 2737 { 2738 AutoCaller autoCaller 2739 CheckComRCReturnRC 2740 2741 AutoWriteLock alock 2742 2743 HRESULT rc = checkStateDependency 2744 CheckComRCReturnRC 2738 AutoCaller autoCaller(this); 2739 CheckComRCReturnRC(autoCaller.rc()); 2740 2741 AutoWriteLock alock(this); 2742 2743 HRESULT rc = checkStateDependency(MutableStateDep); 2744 CheckComRCReturnRC(rc); 2745 2745 2746 2746 /* … … 2755 2755 STDMETHODIMP Machine::DeleteSettings() 2756 2756 { 2757 AutoCaller autoCaller 2758 CheckComRCReturnRC 2759 2760 AutoWriteLock alock 2761 2762 HRESULT rc = checkStateDependency 2763 CheckComRCReturnRC 2757 AutoCaller autoCaller(this); 2758 CheckComRCReturnRC(autoCaller.rc()); 2759 2760 AutoWriteLock alock(this); 2761 2762 HRESULT rc = checkStateDependency(MutableStateDep); 2763 CheckComRCReturnRC(rc); 2764 2764 2765 2765 if (mData->mRegistered) … … 2772 2772 unlockConfig(); 2773 2773 int vrc = RTFileDelete (Utf8Str (mData->mConfigFileFull)); 2774 if (RT_FAILURE 2774 if (RT_FAILURE(vrc)) 2775 2775 return setError (VBOX_E_IPRT_ERROR, 2776 2776 tr ("Could not delete the settings file '%ls' (%Rrc)"), … … 2827 2827 STDMETHODIMP Machine::GetSnapshot (IN_BSTR aId, ISnapshot **aSnapshot) 2828 2828 { 2829 CheckComArgOutPointerValid 2830 2831 AutoCaller autoCaller 2832 CheckComRCReturnRC 2833 2834 AutoReadLock alock 2829 CheckComArgOutPointerValid(aSnapshot); 2830 2831 AutoCaller autoCaller(this); 2832 CheckComRCReturnRC(autoCaller.rc()); 2833 2834 AutoReadLock alock(this); 2835 2835 2836 2836 Guid id(aId); 2837 ComObjPtr 2837 ComObjPtr<Snapshot> snapshot; 2838 2838 2839 2839 HRESULT rc = findSnapshot (id, snapshot, true /* aSetError */); 2840 snapshot.queryInterfaceTo 2840 snapshot.queryInterfaceTo(aSnapshot); 2841 2841 2842 2842 return rc; … … 2846 2846 { 2847 2847 CheckComArgNotNull (aName); 2848 CheckComArgOutPointerValid 2849 2850 AutoCaller autoCaller 2851 CheckComRCReturnRC 2852 2853 AutoReadLock alock 2854 2855 ComObjPtr 2848 CheckComArgOutPointerValid(aSnapshot); 2849 2850 AutoCaller autoCaller(this); 2851 CheckComRCReturnRC(autoCaller.rc()); 2852 2853 AutoReadLock alock(this); 2854 2855 ComObjPtr<Snapshot> snapshot; 2856 2856 2857 2857 HRESULT rc = findSnapshot (aName, snapshot, true /* aSetError */); 2858 snapshot.queryInterfaceTo 2858 snapshot.queryInterfaceTo(aSnapshot); 2859 2859 2860 2860 return rc; … … 2875 2875 CheckComArgNotNull (aHostPath); 2876 2876 2877 AutoCaller autoCaller 2878 CheckComRCReturnRC 2879 2880 AutoWriteLock alock 2881 2882 HRESULT rc = checkStateDependency 2883 CheckComRCReturnRC 2884 2885 ComObjPtr 2877 AutoCaller autoCaller(this); 2878 CheckComRCReturnRC(autoCaller.rc()); 2879 2880 AutoWriteLock alock(this); 2881 2882 HRESULT rc = checkStateDependency(MutableStateDep); 2883 CheckComRCReturnRC(rc); 2884 2885 ComObjPtr<SharedFolder> sharedFolder; 2886 2886 rc = findSharedFolder (aName, sharedFolder, false /* aSetError */); 2887 if (SUCCEEDED 2887 if (SUCCEEDED(rc)) 2888 2888 return setError (VBOX_E_OBJECT_IN_USE, 2889 2889 tr ("Shared folder named '%ls' already exists"), aName); … … 2891 2891 sharedFolder.createObject(); 2892 2892 rc = sharedFolder->init (machine(), aName, aHostPath, aWritable); 2893 CheckComRCReturnRC 2893 CheckComRCReturnRC(rc); 2894 2894 2895 2895 mHWData.backup(); … … 2907 2907 CheckComArgNotNull (aName); 2908 2908 2909 AutoCaller autoCaller 2910 CheckComRCReturnRC 2911 2912 AutoWriteLock alock 2913 2914 HRESULT rc = checkStateDependency 2915 CheckComRCReturnRC 2916 2917 ComObjPtr 2909 AutoCaller autoCaller(this); 2910 CheckComRCReturnRC(autoCaller.rc()); 2911 2912 AutoWriteLock alock(this); 2913 2914 HRESULT rc = checkStateDependency(MutableStateDep); 2915 CheckComRCReturnRC(rc); 2916 2917 ComObjPtr<SharedFolder> sharedFolder; 2918 2918 rc = findSharedFolder (aName, sharedFolder, true /* aSetError */); 2919 CheckComRCReturnRC 2919 CheckComRCReturnRC(rc); 2920 2920 2921 2921 mHWData.backup(); … … 2931 2931 STDMETHODIMP Machine::CanShowConsoleWindow (BOOL *aCanShow) 2932 2932 { 2933 CheckComArgOutPointerValid 2933 CheckComArgOutPointerValid(aCanShow); 2934 2934 2935 2935 /* start with No */ 2936 2936 *aCanShow = FALSE; 2937 2937 2938 AutoCaller autoCaller 2939 AssertComRCReturnRC 2940 2941 ComPtr 2942 { 2943 AutoReadLock alock 2938 AutoCaller autoCaller(this); 2939 AssertComRCReturnRC(autoCaller.rc()); 2940 2941 ComPtr<IInternalSessionControl> directControl; 2942 { 2943 AutoReadLock alock(this); 2944 2944 2945 2945 if (mData->mSession.mState != SessionState_Open) … … 2961 2961 STDMETHODIMP Machine::ShowConsoleWindow (ULONG64 *aWinId) 2962 2962 { 2963 CheckComArgOutPointerValid 2964 2965 AutoCaller autoCaller 2963 CheckComArgOutPointerValid(aWinId); 2964 2965 AutoCaller autoCaller(this); 2966 2966 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 2967 2967 2968 ComPtr 2969 { 2970 AutoReadLock alock 2968 ComPtr<IInternalSessionControl> directControl; 2969 { 2970 AutoReadLock alock(this); 2971 2971 2972 2972 if (mData->mSession.mState != SessionState_Open) … … 2992 2992 #else 2993 2993 CheckComArgNotNull (aName); 2994 CheckComArgOutPointerValid 2995 CheckComArgOutPointerValid 2996 CheckComArgOutPointerValid 2997 2998 AutoCaller autoCaller 2999 CheckComRCReturnRC 3000 3001 AutoReadLock alock 2994 CheckComArgOutPointerValid(aValue); 2995 CheckComArgOutPointerValid(aTimestamp); 2996 CheckComArgOutPointerValid(aFlags); 2997 2998 AutoCaller autoCaller(this); 2999 CheckComRCReturnRC(autoCaller.rc()); 3000 3001 AutoReadLock alock(this); 3002 3002 3003 3003 using namespace guestProp; … … 3013 3013 { 3014 3014 char szFlags[MAX_FLAGS_LEN + 1]; 3015 it->mValue.cloneTo 3015 it->mValue.cloneTo(aValue); 3016 3016 *aTimestamp = it->mTimestamp; 3017 3017 writeFlags (it->mFlags, szFlags); 3018 Bstr (szFlags).cloneTo 3018 Bstr (szFlags).cloneTo(aFlags); 3019 3019 found = true; 3020 3020 } … … 3024 3024 else 3025 3025 { 3026 ComPtr 3026 ComPtr<IInternalSessionControl> directControl = 3027 3027 mData->mSession.mDirectControl; 3028 3028 … … 3086 3086 uint32_t fFlags = NILFLAG; 3087 3087 if ( (aFlags != NULL) 3088 && RT_FAILURE 3088 && RT_FAILURE(validateFlags (utf8Flags.raw(), &fFlags)) 3089 3089 ) 3090 3090 return setError(E_INVALIDARG, … … 3098 3098 3099 3099 rc = checkStateDependency(MutableStateDep); 3100 CheckComRCReturnRC 3100 CheckComRCReturnRC(rc); 3101 3101 3102 3102 rc = S_OK; … … 3111 3111 tr("Cannot set a transient property when the machine is not running")); 3112 3112 3113 if (SUCCEEDED 3113 if (SUCCEEDED(rc)) 3114 3114 { 3115 3115 for (HWData::GuestPropertyList::iterator it = … … 3137 3137 } 3138 3138 } 3139 if (found && SUCCEEDED 3139 if (found && SUCCEEDED(rc)) 3140 3140 { 3141 3141 if (*aValue) … … 3143 3143 RTTIMESPEC time; 3144 3144 property.mValue = aValue; 3145 property.mTimestamp = RTTimeSpecGetNano 3145 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow (&time)); 3146 3146 if (aFlags != NULL) 3147 3147 property.mFlags = fFlags; … … 3149 3149 } 3150 3150 } 3151 else if (SUCCEEDED 3151 else if (SUCCEEDED(rc) && *aValue) 3152 3152 { 3153 3153 RTTIMESPEC time; … … 3155 3155 property.mName = aName; 3156 3156 property.mValue = aValue; 3157 property.mTimestamp = RTTimeSpecGetNano 3157 property.mTimestamp = RTTimeSpecGetNano(RTTimeNow (&time)); 3158 3158 property.mFlags = fFlags; 3159 3159 mHWData->mGuestProperties.push_back (property); 3160 3160 } 3161 if ( SUCCEEDED 3161 if ( SUCCEEDED(rc) 3162 3162 && ( matchAll 3163 3163 || RTStrSimplePatternMultiMatch (utf8Patterns.raw(), RTSTR_MAX, … … 3169 3169 else 3170 3170 { 3171 ComPtr 3171 ComPtr<IInternalSessionControl> directControl = 3172 3172 mData->mSession.mDirectControl; 3173 3173 … … 3200 3200 3201 3201 STDMETHODIMP Machine:: 3202 EnumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut 3203 ComSafeArrayOut 3204 ComSafeArrayOut 3205 ComSafeArrayOut 3202 EnumerateGuestProperties (IN_BSTR aPatterns, ComSafeArrayOut(BSTR, aNames), 3203 ComSafeArrayOut(BSTR, aValues), 3204 ComSafeArrayOut(ULONG64, aTimestamps), 3205 ComSafeArrayOut(BSTR, aFlags)) 3206 3206 { 3207 3207 #if !defined (VBOX_WITH_GUEST_PROPS) … … 3211 3211 return E_POINTER; 3212 3212 3213 CheckComArgOutSafeArrayPointerValid 3214 CheckComArgOutSafeArrayPointerValid 3215 CheckComArgOutSafeArrayPointerValid 3216 CheckComArgOutSafeArrayPointerValid 3217 3218 AutoCaller autoCaller 3219 CheckComRCReturnRC 3220 3221 AutoReadLock alock 3213 CheckComArgOutSafeArrayPointerValid(aNames); 3214 CheckComArgOutSafeArrayPointerValid(aValues); 3215 CheckComArgOutSafeArrayPointerValid(aTimestamps); 3216 CheckComArgOutSafeArrayPointerValid(aFlags); 3217 3218 AutoCaller autoCaller(this); 3219 CheckComRCReturnRC(autoCaller.rc()); 3220 3221 AutoReadLock alock(this); 3222 3222 3223 3223 using namespace guestProp; … … 3248 3248 */ 3249 3249 size_t cEntries = propList.size(); 3250 SafeArray 3251 SafeArray 3252 SafeArray 3253 SafeArray 3250 SafeArray<BSTR> names (cEntries); 3251 SafeArray<BSTR> values (cEntries); 3252 SafeArray<ULONG64> timestamps (cEntries); 3253 SafeArray<BSTR> flags (cEntries); 3254 3254 size_t iProp = 0; 3255 3255 for (HWData::GuestPropertyList::iterator it = propList.begin(); … … 3257 3257 { 3258 3258 char szFlags[MAX_FLAGS_LEN + 1]; 3259 it->mName.cloneTo 3260 it->mValue.cloneTo 3259 it->mName.cloneTo(&names[iProp]); 3260 it->mValue.cloneTo(&values[iProp]); 3261 3261 timestamps[iProp] = it->mTimestamp; 3262 3262 writeFlags (it->mFlags, szFlags); 3263 Bstr (szFlags).cloneTo 3263 Bstr (szFlags).cloneTo(&flags[iProp]); 3264 3264 ++iProp; 3265 3265 } 3266 names.detachTo (ComSafeArrayOutArg(aNames));3267 values.detachTo (ComSafeArrayOutArg(aValues));3268 timestamps.detachTo (ComSafeArrayOutArg(aTimestamps));3269 flags.detachTo (ComSafeArrayOutArg(aFlags));3266 names.detachTo(ComSafeArrayOutArg(aNames)); 3267 values.detachTo(ComSafeArrayOutArg(aValues)); 3268 timestamps.detachTo(ComSafeArrayOutArg(aTimestamps)); 3269 flags.detachTo(ComSafeArrayOutArg(aFlags)); 3270 3270 rc = S_OK; 3271 3271 } 3272 3272 else 3273 3273 { 3274 ComPtr 3274 ComPtr<IInternalSessionControl> directControl = 3275 3275 mData->mSession.mDirectControl; 3276 3276 … … 3282 3282 else 3283 3283 rc = directControl->EnumerateGuestProperties (aPatterns, 3284 ComSafeArrayOutArg 3285 ComSafeArrayOutArg 3286 ComSafeArrayOutArg 3287 ComSafeArrayOutArg 3284 ComSafeArrayOutArg(aNames), 3285 ComSafeArrayOutArg(aValues), 3286 ComSafeArrayOutArg(aTimestamps), 3287 ComSafeArrayOutArg(aFlags)); 3288 3288 } 3289 3289 return rc; … … 3292 3292 3293 3293 STDMETHODIMP Machine:: 3294 GetHardDiskAttachmentsOfController(IN_BSTR aName, ComSafeArrayOut 3294 GetHardDiskAttachmentsOfController(IN_BSTR aName, ComSafeArrayOut(IHardDiskAttachment *, aAttachments)) 3295 3295 { 3296 3296 HDData::AttachmentList atts; … … 3300 3300 3301 3301 SafeIfaceArray<IHardDiskAttachment> attachments (atts); 3302 attachments.detachTo (ComSafeArrayOutArg(aAttachments));3302 attachments.detachTo(ComSafeArrayOutArg(aAttachments)); 3303 3303 3304 3304 return S_OK; … … 3318 3318 aConnectionType); 3319 3319 3320 AutoCaller autoCaller 3321 CheckComRCReturnRC 3322 3323 AutoWriteLock alock 3324 3325 HRESULT rc = checkStateDependency 3326 CheckComRCReturnRC 3320 AutoCaller autoCaller(this); 3321 CheckComRCReturnRC(autoCaller.rc()); 3322 3323 AutoWriteLock alock(this); 3324 3325 HRESULT rc = checkStateDependency(MutableStateDep); 3326 CheckComRCReturnRC(rc); 3327 3327 3328 3328 /* try to find one with the name first. */ … … 3330 3330 3331 3331 rc = getStorageControllerByName (aName, ctrl, false /* aSetError */); 3332 if (SUCCEEDED 3332 if (SUCCEEDED(rc)) 3333 3333 return setError (VBOX_E_OBJECT_IN_USE, 3334 3334 tr ("Storage controller named '%ls' already exists"), aName); … … 3336 3336 ctrl.createObject(); 3337 3337 rc = ctrl->init (this, aName, aConnectionType); 3338 CheckComRCReturnRC 3338 CheckComRCReturnRC(rc); 3339 3339 3340 3340 mStorageControllers.backup(); … … 3355 3355 CheckComArgStrNotEmptyOrNull(aName); 3356 3356 3357 AutoCaller autoCaller 3358 CheckComRCReturnRC 3359 3360 AutoReadLock alock 3361 3362 ComObjPtr 3357 AutoCaller autoCaller(this); 3358 CheckComRCReturnRC(autoCaller.rc()); 3359 3360 AutoReadLock alock(this); 3361 3362 ComObjPtr<StorageController> ctrl; 3363 3363 3364 3364 HRESULT rc = getStorageControllerByName (aName, ctrl, true /* aSetError */); 3365 if (SUCCEEDED 3366 ctrl.queryInterfaceTo 3365 if (SUCCEEDED(rc)) 3366 ctrl.queryInterfaceTo(aStorageController); 3367 3367 3368 3368 return rc; … … 3374 3374 CheckComArgStrNotEmptyOrNull(aName); 3375 3375 3376 AutoCaller autoCaller 3377 CheckComRCReturnRC 3378 3379 AutoWriteLock alock 3380 3381 HRESULT rc = checkStateDependency 3382 CheckComRCReturnRC 3383 3384 ComObjPtr 3376 AutoCaller autoCaller(this); 3377 CheckComRCReturnRC(autoCaller.rc()); 3378 3379 AutoWriteLock alock(this); 3380 3381 HRESULT rc = checkStateDependency(MutableStateDep); 3382 CheckComRCReturnRC(rc); 3383 3384 ComObjPtr<StorageController> ctrl; 3385 3385 rc = getStorageControllerByName (aName, ctrl, true /* aSetError */); 3386 CheckComRCReturnRC 3386 CheckComRCReturnRC(rc); 3387 3387 3388 3388 /* We can remove the controller only if there is no device attached. */ … … 3427 3427 HRESULT Machine::saveRegistryEntry (settings::Key &aEntryNode) 3428 3428 { 3429 AssertReturn 3430 3431 AutoLimitedCaller autoCaller 3432 AssertComRCReturnRC 3433 3434 AutoReadLock alock 3429 AssertReturn(!aEntryNode.isNull(), E_FAIL); 3430 3431 AutoLimitedCaller autoCaller(this); 3432 AssertComRCReturnRC(autoCaller.rc()); 3433 3434 AutoReadLock alock(this); 3435 3435 3436 3436 /* UUID */ … … 3455 3455 int Machine::calculateFullPath (const char *aPath, Utf8Str &aResult) 3456 3456 { 3457 AutoCaller autoCaller 3457 AutoCaller autoCaller(this); 3458 3458 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3459 3459 3460 AutoReadLock alock 3461 3462 AssertReturn 3460 AutoReadLock alock(this); 3461 3462 AssertReturn(!mData->mConfigFileFull.isNull(), VERR_GENERAL_FAILURE); 3463 3463 3464 3464 Utf8Str strSettingsDir = mData->mConfigFileFull; … … 3486 3486 void Machine::calculateRelativePath (const char *aPath, Utf8Str &aResult) 3487 3487 { 3488 AutoCaller autoCaller 3488 AutoCaller autoCaller(this); 3489 3489 AssertComRCReturn (autoCaller.rc(), (void) 0); 3490 3490 3491 AutoReadLock alock 3491 AutoReadLock alock(this); 3492 3492 3493 3493 AssertReturnVoid (!mData->mConfigFileFull.isNull()); … … 3513 3513 void Machine::getLogFolder (Utf8Str &aLogFolder) 3514 3514 { 3515 AutoCaller autoCaller 3515 AutoCaller autoCaller(this); 3516 3516 AssertComRCReturnVoid (autoCaller.rc()); 3517 3517 3518 AutoReadLock alock 3518 AutoReadLock alock(this); 3519 3519 3520 3520 Utf8Str settingsDir; … … 3541 3541 LogFlowThisFuncEnter(); 3542 3542 3543 AssertReturn 3544 3545 AutoCaller autoCaller 3546 CheckComRCReturnRC 3547 3548 AutoWriteLock alock 3543 AssertReturn(aControl, E_FAIL); 3544 3545 AutoCaller autoCaller(this); 3546 CheckComRCReturnRC(autoCaller.rc()); 3547 3548 AutoWriteLock alock(this); 3549 3549 3550 3550 if (!mData->mRegistered) … … 3552 3552 tr ("The machine '%ls' is not registered"), mUserData->mName.raw()); 3553 3553 3554 LogFlowThisFunc 3554 LogFlowThisFunc(("mSession.mState=%d\n", mData->mSession.mState)); 3555 3555 3556 3556 if (mData->mSession.mState == SessionState_Open || … … 3562 3562 3563 3563 /* may not be busy */ 3564 AssertReturn 3564 AssertReturn(!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL); 3565 3565 3566 3566 /* get the session PID */ … … 3576 3576 * started by #openRemoteSession(). */ 3577 3577 3578 LogFlowThisFunc 3578 LogFlowThisFunc(("mSession.mPid=%d(0x%x)\n", 3579 3579 mData->mSession.mPid, mData->mSession.mPid)); 3580 LogFlowThisFunc 3580 LogFlowThisFunc(("session.pid=%d(0x%x)\n", pid, pid)); 3581 3581 3582 3582 if (mData->mSession.mPid != pid) … … 3589 3589 3590 3590 /* create a SessionMachine object */ 3591 ComObjPtr 3591 ComObjPtr<SessionMachine> sessionMachine; 3592 3592 sessionMachine.createObject(); 3593 3593 HRESULT rc = sessionMachine->init (this); … … 3600 3600 * is possible due to the wrong lock order. */ 3601 3601 3602 if (SUCCEEDED 3602 if (SUCCEEDED(rc)) 3603 3603 { 3604 3604 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 3626 3626 alock.leave(); 3627 3627 3628 LogFlowThisFunc 3628 LogFlowThisFunc(("Calling AssignMachine()...\n")); 3629 3629 rc = aControl->AssignMachine (sessionMachine); 3630 LogFlowThisFunc 3630 LogFlowThisFunc(("AssignMachine() returned %08X\n", rc)); 3631 3631 3632 3632 /* The failure may occur w/o any error info (from RPC), so provide one */ … … 3635 3635 tr ("Failed to assign the machine to the session (%Rrc)"), rc); 3636 3636 3637 if (SUCCEEDED 3637 if (SUCCEEDED(rc) && origState == SessionState_Spawning) 3638 3638 { 3639 3639 /* complete the remote session initialization */ 3640 3640 3641 3641 /* get the console from the direct session */ 3642 ComPtr 3642 ComPtr<IConsole> console; 3643 3643 rc = aControl->GetRemoteConsole (console.asOutParam()); 3644 3644 ComAssertComRC (rc); 3645 3645 3646 if (SUCCEEDED 3646 if (SUCCEEDED(rc) && !console) 3647 3647 { 3648 3648 ComAssert (!!console); … … 3651 3651 3652 3652 /* assign machine & console to the remote session */ 3653 if (SUCCEEDED 3653 if (SUCCEEDED(rc)) 3654 3654 { 3655 3655 /* … … 3657 3657 * entry in remoteControls is that remote session 3658 3658 */ 3659 LogFlowThisFunc 3659 LogFlowThisFunc(("Calling AssignRemoteMachine()...\n")); 3660 3660 rc = mData->mSession.mRemoteControls.front()-> 3661 3661 AssignRemoteMachine (sessionMachine, console); 3662 LogFlowThisFunc 3662 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", rc)); 3663 3663 3664 3664 /* The failure may occur w/o any error info (from RPC), so provide one */ … … 3707 3707 { 3708 3708 /* memorize PID of the directly opened session */ 3709 if (SUCCEEDED 3709 if (SUCCEEDED(rc)) 3710 3710 mData->mSession.mPid = pid; 3711 3711 } 3712 3712 3713 if (SUCCEEDED 3713 if (SUCCEEDED(rc)) 3714 3714 { 3715 3715 /* memorize the direct session control and cache IUnknown for it */ … … 3722 3722 * identity checks (it will be internally cached within mDirectControl 3723 3723 * at least on XPCOM) */ 3724 ComPtr 3724 ComPtr<IUnknown> unk = mData->mSession.mDirectControl; 3725 3725 NOREF (unk); 3726 3726 } … … 3741 3741 sessionMachine->uninit(); 3742 3742 3743 LogFlowThisFunc 3743 LogFlowThisFunc(("rc=%08X\n", rc)); 3744 3744 LogFlowThisFuncLeave(); 3745 3745 return rc; … … 3756 3756 LogFlowThisFuncEnter(); 3757 3757 3758 AssertReturn 3759 AssertReturn 3760 3761 AutoCaller autoCaller 3762 CheckComRCReturnRC 3763 3764 AutoWriteLock alock 3758 AssertReturn(aControl, E_FAIL); 3759 AssertReturn(aProgress, E_FAIL); 3760 3761 AutoCaller autoCaller(this); 3762 CheckComRCReturnRC(autoCaller.rc()); 3763 3764 AutoWriteLock alock(this); 3765 3765 3766 3766 if (!mData->mRegistered) … … 3768 3768 tr ("The machine '%ls' is not registered"), mUserData->mName.raw()); 3769 3769 3770 LogFlowThisFunc 3770 LogFlowThisFunc(("mSession.mState=%d\n", mData->mSession.mState)); 3771 3771 3772 3772 if (mData->mSession.mState == SessionState_Open || … … 3779 3779 3780 3780 /* may not be busy */ 3781 AssertReturn 3781 AssertReturn(!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL); 3782 3782 3783 3783 /* get the path to the executable */ … … 3827 3827 else 3828 3828 vrc2 = RTEnvUnsetEx (env, var); 3829 if (RT_FAILURE 3829 if (RT_FAILURE(vrc2)) 3830 3830 break; 3831 3831 } … … 3833 3833 } 3834 3834 } 3835 if (RT_SUCCESS 3835 if (RT_SUCCESS(vrc2) && *var) 3836 3836 vrc2 = RTEnvPutEx (env, var); 3837 3837 … … 3945 3945 RTEnvDestroy (env); 3946 3946 3947 if (RT_FAILURE 3947 if (RT_FAILURE(vrc)) 3948 3948 return setError (VBOX_E_IPRT_ERROR, 3949 3949 tr ("Could not launch a process for the machine '%ls' (%Rrc)"), 3950 3950 mUserData->mName.raw(), vrc); 3951 3951 3952 LogFlowThisFunc 3952 LogFlowThisFunc(("launched.pid=%d(0x%x)\n", pid, pid)); 3953 3953 3954 3954 /* … … 3962 3962 3963 3963 /* inform the session that it will be a remote one */ 3964 LogFlowThisFunc 3964 LogFlowThisFunc(("Calling AssignMachine (NULL)...\n")); 3965 3965 HRESULT rc = aControl->AssignMachine (NULL); 3966 LogFlowThisFunc 3966 LogFlowThisFunc(("AssignMachine (NULL) returned %08X\n", rc)); 3967 3967 3968 3968 if (FAILED (rc)) … … 3995 3995 LogFlowThisFuncEnter(); 3996 3996 3997 AssertReturn 3998 3999 AutoCaller autoCaller 4000 CheckComRCReturnRC 4001 4002 AutoWriteLock alock 3997 AssertReturn(aControl, E_FAIL); 3998 3999 AutoCaller autoCaller(this); 4000 CheckComRCReturnRC(autoCaller.rc()); 4001 4002 AutoWriteLock alock(this); 4003 4003 4004 4004 if (!mData->mRegistered) … … 4006 4006 tr ("The machine '%ls' is not registered"), mUserData->mName.raw()); 4007 4007 4008 LogFlowThisFunc 4008 LogFlowThisFunc(("mSession.state=%d\n", mData->mSession.mState)); 4009 4009 4010 4010 if (mData->mSession.mState != SessionState_Open) … … 4019 4019 * lock here because GetRemoteConsole must not call us back). 4020 4020 */ 4021 ComPtr 4021 ComPtr<IConsole> console; 4022 4022 HRESULT rc = mData->mSession.mDirectControl-> 4023 4023 GetRemoteConsole (console.asOutParam()); … … 4031 4031 ComAssertRet (!console.isNull(), E_FAIL); 4032 4032 4033 ComObjPtr 4034 AssertReturn 4033 ComObjPtr<SessionMachine> sessionMachine = mData->mSession.mMachine; 4034 AssertReturn(!sessionMachine.isNull(), E_FAIL); 4035 4035 4036 4036 /* … … 4043 4043 4044 4044 /* attach the remote session to the machine */ 4045 LogFlowThisFunc 4045 LogFlowThisFunc(("Calling AssignRemoteMachine()...\n")); 4046 4046 rc = aControl->AssignRemoteMachine (sessionMachine, console); 4047 LogFlowThisFunc 4047 LogFlowThisFunc(("AssignRemoteMachine() returned %08X\n", rc)); 4048 4048 4049 4049 /* The failure may occur w/o any error info (from RPC), so provide one */ … … 4085 4085 */ 4086 4086 #if defined (RT_OS_WINDOWS) 4087 bool Machine::isSessionOpen (ComObjPtr 4088 ComPtr 4087 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 4088 ComPtr<IInternalSessionControl> *aControl /*= NULL*/, 4089 4089 HANDLE *aIPCSem /*= NULL*/, 4090 4090 bool aAllowClosing /*= false*/) 4091 4091 #elif defined (RT_OS_OS2) 4092 bool Machine::isSessionOpen (ComObjPtr 4093 ComPtr 4092 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 4093 ComPtr<IInternalSessionControl> *aControl /*= NULL*/, 4094 4094 HMTX *aIPCSem /*= NULL*/, 4095 4095 bool aAllowClosing /*= false*/) 4096 4096 #else 4097 bool Machine::isSessionOpen (ComObjPtr 4098 ComPtr 4097 bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 4098 ComPtr<IInternalSessionControl> *aControl /*= NULL*/, 4099 4099 bool aAllowClosing /*= false*/) 4100 4100 #endif 4101 4101 { 4102 AutoLimitedCaller autoCaller 4102 AutoLimitedCaller autoCaller(this); 4103 4103 AssertComRCReturn (autoCaller.rc(), false); 4104 4104 … … 4107 4107 return false; 4108 4108 4109 AutoReadLock alock 4109 AutoReadLock alock(this); 4110 4110 4111 4111 if (mData->mSession.mState == SessionState_Open || 4112 4112 (aAllowClosing && mData->mSession.mState == SessionState_Closing)) 4113 4113 { 4114 AssertReturn 4114 AssertReturn(!mData->mSession.mMachine.isNull(), false); 4115 4115 4116 4116 aMachine = mData->mSession.mMachine; … … 4146 4146 #endif 4147 4147 { 4148 AutoLimitedCaller autoCaller 4148 AutoLimitedCaller autoCaller(this); 4149 4149 AssertComRCReturn (autoCaller.rc(), false); 4150 4150 … … 4153 4153 return false; 4154 4154 4155 AutoReadLock alock 4155 AutoReadLock alock(this); 4156 4156 4157 4157 if (mData->mSession.mState == SessionState_Spawning) … … 4161 4161 if (aPID != NULL) 4162 4162 { 4163 AssertReturn 4163 AssertReturn(mData->mSession.mPid != NIL_RTPROCESS, false); 4164 4164 *aPID = mData->mSession.mPid; 4165 4165 } … … 4187 4187 bool Machine::checkForSpawnFailure() 4188 4188 { 4189 AutoCaller autoCaller 4189 AutoCaller autoCaller(this); 4190 4190 if (!autoCaller.isOk()) 4191 4191 { 4192 4192 /* nothing to do */ 4193 LogFlowThisFunc 4193 LogFlowThisFunc(("Already uninitialized!")); 4194 4194 return true; 4195 4195 } … … 4201 4201 { 4202 4202 /* nothing to do */ 4203 LogFlowThisFunc 4203 LogFlowThisFunc(("Not spawning any more!")); 4204 4204 return true; 4205 4205 } … … 4274 4274 HRESULT Machine::trySetRegistered (BOOL aRegistered) 4275 4275 { 4276 AssertReturn 4277 4278 AutoLimitedCaller autoCaller 4279 AssertComRCReturnRC 4280 4281 AutoWriteLock alock 4276 AssertReturn(mParent->isWriteLockOnCurrentThread(), E_FAIL); 4277 4278 AutoLimitedCaller autoCaller(this); 4279 AssertComRCReturnRC(autoCaller.rc()); 4280 4281 AutoWriteLock alock(this); 4282 4282 4283 4283 /* wait for state dependants to drop to zero */ … … 4291 4291 4292 4292 /* inaccessible machines can only be unregistered */ 4293 AssertReturn 4293 AssertReturn(!aRegistered, E_FAIL); 4294 4294 4295 4295 /* Uninitialize ourselves here because currently there may be no … … 4306 4306 } 4307 4307 4308 AssertReturn 4308 AssertReturn(autoCaller.state() == Ready, E_FAIL); 4309 4309 4310 4310 /* we will probably modify these and want to prevent concurrent … … 4364 4364 { 4365 4365 rc = saveSettings(); 4366 CheckComRCReturnRC 4366 CheckComRCReturnRC(rc); 4367 4367 } 4368 4368 4369 4369 /* Implicitly detach DVD/Floppy */ 4370 4370 rc = mDVDDrive->unmount(); 4371 if (SUCCEEDED 4371 if (SUCCEEDED(rc)) 4372 4372 rc = mFloppyDrive->unmount(); 4373 4373 4374 if (SUCCEEDED 4374 if (SUCCEEDED(rc)) 4375 4375 { 4376 4376 /* we may have had implicit modifications we want to fix on success */ … … 4411 4411 BOOL *aRegistered /* = NULL */) 4412 4412 { 4413 AutoCaller autoCaller 4414 AssertComRCReturnRC 4415 4416 AutoWriteLock alock 4417 4418 HRESULT rc = checkStateDependency 4419 CheckComRCReturnRC 4413 AutoCaller autoCaller(this); 4414 AssertComRCReturnRC(autoCaller.rc()); 4415 4416 AutoWriteLock alock(this); 4417 4418 HRESULT rc = checkStateDependency(aDepType); 4419 CheckComRCReturnRC(rc); 4420 4420 4421 4421 { … … 4454 4454 void Machine::releaseStateDependency() 4455 4455 { 4456 AutoCaller autoCaller 4456 AutoCaller autoCaller(this); 4457 4457 AssertComRCReturnVoid (autoCaller.rc()); 4458 4458 4459 AutoWriteLock alock 4459 AutoWriteLock alock(this); 4460 4460 4461 4461 AssertReturnVoid (mData->mMachineStateDeps != 0 … … 4505 4505 * lock. 4506 4506 */ 4507 HRESULT Machine::checkStateDependency 4507 HRESULT Machine::checkStateDependency(StateDependency aDepType) 4508 4508 { 4509 4509 switch (aDepType) … … 4550 4550 HRESULT Machine::initDataAndChildObjects() 4551 4551 { 4552 AutoCaller autoCaller 4553 AssertComRCReturnRC 4552 AutoCaller autoCaller(this); 4553 AssertComRCReturnRC(autoCaller.rc()); 4554 4554 AssertComRCReturn (autoCaller.state() == InInit || 4555 4555 autoCaller.state() == Limited, E_FAIL); 4556 4556 4557 AssertReturn 4557 AssertReturn(!mData->mAccessible, E_FAIL); 4558 4558 4559 4559 /* allocate data structures */ … … 4568 4568 4569 4569 /* create associated BIOS settings object */ 4570 unconst 4570 unconst(mBIOSSettings).createObject(); 4571 4571 mBIOSSettings->init (this); 4572 4572 4573 4573 #ifdef VBOX_WITH_VRDP 4574 4574 /* create an associated VRDPServer object (default is disabled) */ 4575 unconst 4575 unconst(mVRDPServer).createObject(); 4576 4576 mVRDPServer->init (this); 4577 4577 #endif 4578 4578 4579 4579 /* create an associated DVD drive object */ 4580 unconst 4580 unconst(mDVDDrive).createObject(); 4581 4581 mDVDDrive->init (this); 4582 4582 4583 4583 /* create an associated floppy drive object */ 4584 unconst 4584 unconst(mFloppyDrive).createObject(); 4585 4585 mFloppyDrive->init (this); 4586 4586 … … 4588 4588 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 4589 4589 { 4590 unconst 4590 unconst(mSerialPorts [slot]).createObject(); 4591 4591 mSerialPorts [slot]->init (this, slot); 4592 4592 } … … 4595 4595 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 4596 4596 { 4597 unconst 4597 unconst(mParallelPorts [slot]).createObject(); 4598 4598 mParallelPorts [slot]->init (this, slot); 4599 4599 } 4600 4600 4601 4601 /* create the audio adapter object (always present, default is disabled) */ 4602 unconst 4602 unconst(mAudioAdapter).createObject(); 4603 4603 mAudioAdapter->init (this); 4604 4604 4605 4605 /* create the USB controller object (always present, default is disabled) */ 4606 unconst 4606 unconst(mUSBController).createObject(); 4607 4607 mUSBController->init (this); 4608 4608 … … 4610 4610 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 4611 4611 { 4612 unconst 4612 unconst(mNetworkAdapters [slot]).createObject(); 4613 4613 mNetworkAdapters [slot]->init (this, slot); 4614 4614 } … … 4628 4628 void Machine::uninitDataAndChildObjects() 4629 4629 { 4630 AutoCaller autoCaller 4630 AutoCaller autoCaller(this); 4631 4631 AssertComRCReturnVoid (autoCaller.rc()); 4632 4632 AssertComRCReturnVoid (autoCaller.state() == InUninit || … … 4644 4644 { 4645 4645 mNetworkAdapters [slot]->uninit(); 4646 unconst 4646 unconst(mNetworkAdapters [slot]).setNull(); 4647 4647 } 4648 4648 } … … 4651 4651 { 4652 4652 mUSBController->uninit(); 4653 unconst 4653 unconst(mUSBController).setNull(); 4654 4654 } 4655 4655 … … 4657 4657 { 4658 4658 mAudioAdapter->uninit(); 4659 unconst 4659 unconst(mAudioAdapter).setNull(); 4660 4660 } 4661 4661 … … 4665 4665 { 4666 4666 mParallelPorts [slot]->uninit(); 4667 unconst 4667 unconst(mParallelPorts [slot]).setNull(); 4668 4668 } 4669 4669 } … … 4674 4674 { 4675 4675 mSerialPorts [slot]->uninit(); 4676 unconst 4676 unconst(mSerialPorts [slot]).setNull(); 4677 4677 } 4678 4678 } … … 4681 4681 { 4682 4682 mFloppyDrive->uninit(); 4683 unconst 4683 unconst(mFloppyDrive).setNull(); 4684 4684 } 4685 4685 … … 4687 4687 { 4688 4688 mDVDDrive->uninit(); 4689 unconst 4689 unconst(mDVDDrive).setNull(); 4690 4690 } 4691 4691 … … 4694 4694 { 4695 4695 mVRDPServer->uninit(); 4696 unconst 4696 unconst(mVRDPServer).setNull(); 4697 4697 } 4698 4698 #endif … … 4701 4701 { 4702 4702 mBIOSSettings->uninit(); 4703 unconst 4703 unconst(mBIOSSettings).setNull(); 4704 4704 } 4705 4705 … … 4758 4758 AssertReturnVoid (isWriteLockOnCurrentThread()); 4759 4759 4760 AutoWriteLock alock 4760 AutoWriteLock alock(this); 4761 4761 4762 4762 /* Wait for all state dependants if necessary */ … … 4767 4767 RTSemEventMultiCreate (&mData->mMachineStateDepsSem); 4768 4768 4769 LogFlowThisFunc 4769 LogFlowThisFunc(("Waiting for state deps (%d) to drop to zero...\n", 4770 4770 mData->mMachineStateDeps)); 4771 4771 … … 4797 4797 { 4798 4798 LogFlowThisFuncEnter(); 4799 LogFlowThisFunc 4800 4801 AutoCaller autoCaller 4799 LogFlowThisFunc(("aMachineState=%d\n", aMachineState)); 4800 4801 AutoCaller autoCaller(this); 4802 4802 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4803 4803 4804 AutoWriteLock alock 4804 AutoWriteLock alock(this); 4805 4805 4806 4806 /* wait for state dependants to drop to zero */ … … 4813 4813 RTTimeNow (&mData->mLastStateChange); 4814 4814 4815 mParent->onMachineStateChange 4815 mParent->onMachineStateChange(mData->mUuid, aMachineState); 4816 4816 } 4817 4817 … … 4835 4835 */ 4836 4836 HRESULT Machine::findSharedFolder (CBSTR aName, 4837 ComObjPtr 4837 ComObjPtr<SharedFolder> &aSharedFolder, 4838 4838 bool aSetError /* = false */) 4839 4839 { … … 4843 4843 ++ it) 4844 4844 { 4845 AutoWriteLock alock 4845 AutoWriteLock alock(*it); 4846 4846 found = (*it)->name() == aName; 4847 4847 if (found) … … 4871 4871 { 4872 4872 LogFlowThisFuncEnter(); 4873 AssertReturn 4874 4875 AutoCaller autoCaller 4876 AssertReturn 4873 AssertReturn(mType == IsMachine, E_FAIL); 4874 4875 AutoCaller autoCaller(this); 4876 AssertReturn(autoCaller.state() == InInit, E_FAIL); 4877 4877 4878 4878 HRESULT rc = S_OK; … … 4912 4912 } 4913 4913 else 4914 unconst 4914 unconst(mData->mUuid) = id; 4915 4915 4916 4916 /* name (required) */ … … 4934 4934 4935 4935 /* look up the object by Id to check it is valid */ 4936 ComPtr 4936 ComPtr<IGuestOSType> guestOSType; 4937 4937 rc = mParent->GetGuestOSType (mUserData->mOSTypeId, 4938 4938 guestOSType.asOutParam()); … … 4947 4947 Utf8Str stateFilePathFull = stateFilePath; 4948 4948 int vrc = calculateFullPath (stateFilePathFull, stateFilePathFull); 4949 if (RT_FAILURE 4949 if (RT_FAILURE(vrc)) 4950 4950 { 4951 4951 throw setError (E_FAIL, … … 5022 5022 * otherwise it will be not possible to change the settings 5023 5023 * somewehere in the code above because all setters will be 5024 * blocked by checkStateDependency 5024 * blocked by checkStateDependency(MutableStateDep). 5025 5025 */ 5026 5026 … … 5067 5067 using namespace settings; 5068 5068 5069 AssertReturn 5070 AssertReturn 5069 AssertReturn(!aNode.isNull(), E_INVALIDARG); 5070 AssertReturn(mType == IsMachine, E_FAIL); 5071 5071 5072 5072 /* create a snapshot machine object */ 5073 ComObjPtr 5073 ComObjPtr<SnapshotMachine> snapshotMachine; 5074 5074 snapshotMachine.createObject(); 5075 5075 … … 5086 5086 Utf8Str stateFilePathFull = stateFilePath; 5087 5087 int vrc = calculateFullPath (stateFilePathFull, stateFilePathFull); 5088 if (RT_FAILURE 5088 if (RT_FAILURE(vrc)) 5089 5089 return setError (E_FAIL, 5090 5090 tr ("Invalid saved state file path '%ls' (%Rrc)"), … … 5103 5103 rc = snapshotMachine->init (this, hardwareNode, storageNode, 5104 5104 uuid, stateFilePath); 5105 CheckComRCReturnRC 5105 CheckComRCReturnRC(rc); 5106 5106 } 5107 5107 5108 5108 /* create a snapshot object */ 5109 ComObjPtr 5109 ComObjPtr<Snapshot> snapshot; 5110 5110 snapshot.createObject(); 5111 5111 … … 5171 5171 using namespace settings; 5172 5172 5173 AssertReturn 5174 AssertReturn 5173 AssertReturn(!aNode.isNull(), E_INVALIDARG); 5174 AssertReturn(mType == IsMachine || mType == IsSnapshotMachine, E_FAIL); 5175 5175 5176 5176 HRESULT rc = S_OK; … … 5279 5279 /* RemoteDisplay */ 5280 5280 rc = mVRDPServer->loadSettings (aNode); 5281 CheckComRCReturnRC 5281 CheckComRCReturnRC(rc); 5282 5282 #endif 5283 5283 5284 5284 /* BIOS */ 5285 5285 rc = mBIOSSettings->loadSettings (aNode); 5286 CheckComRCReturnRC 5286 CheckComRCReturnRC(rc); 5287 5287 5288 5288 /* DVD drive */ 5289 5289 rc = mDVDDrive->loadSettings (aNode); 5290 CheckComRCReturnRC 5290 CheckComRCReturnRC(rc); 5291 5291 5292 5292 /* Floppy drive */ 5293 5293 rc = mFloppyDrive->loadSettings (aNode); 5294 CheckComRCReturnRC 5294 CheckComRCReturnRC(rc); 5295 5295 5296 5296 /* USB Controller */ 5297 5297 rc = mUSBController->loadSettings (aNode); 5298 CheckComRCReturnRC 5298 CheckComRCReturnRC(rc); 5299 5299 5300 5300 /* Network node (required) */ … … 5317 5317 5318 5318 rc = mNetworkAdapters [slot]->loadSettings (*it); 5319 CheckComRCReturnRC 5319 CheckComRCReturnRC(rc); 5320 5320 } 5321 5321 } … … 5337 5337 5338 5338 rc = mSerialPorts [slot]->loadSettings (*it); 5339 CheckComRCReturnRC 5339 CheckComRCReturnRC(rc); 5340 5340 } 5341 5341 } … … 5357 5357 5358 5358 rc = mParallelPorts [slot]->loadSettings (*it); 5359 CheckComRCReturnRC 5359 CheckComRCReturnRC(rc); 5360 5360 } 5361 5361 } … … 5363 5363 /* AudioAdapter */ 5364 5364 rc = mAudioAdapter->loadSettings (aNode); 5365 CheckComRCReturnRC 5365 CheckComRCReturnRC(rc); 5366 5366 5367 5367 /* Shared folders (required) */ … … 5383 5383 5384 5384 rc = CreateSharedFolder (name, hostPath, writable); 5385 CheckComRCReturnRC 5385 CheckComRCReturnRC(rc); 5386 5386 } 5387 5387 } … … 5477 5477 using namespace settings; 5478 5478 5479 AssertReturn 5480 AssertReturn 5479 AssertReturn(!aNode.isNull(), E_INVALIDARG); 5480 AssertReturn(mType == IsMachine || mType == IsSnapshotMachine, E_FAIL); 5481 5481 5482 5482 HRESULT rc = S_OK; … … 5534 5534 /* Try to find one with the name first. */ 5535 5535 rc = getStorageControllerByName (controllerName, ctl, false /* aSetError */); 5536 if (SUCCEEDED 5536 if (SUCCEEDED(rc)) 5537 5537 return setError (VBOX_E_OBJECT_IN_USE, 5538 5538 tr ("Storage controller named '%ls' already exists"), controllerName.raw()); … … 5540 5540 ctl.createObject(); 5541 5541 rc = ctl->init (this, controllerName, connection); 5542 CheckComRCReturnRC 5542 CheckComRCReturnRC(rc); 5543 5543 5544 5544 mStorageControllers->push_back (ctl); … … 5594 5594 using namespace settings; 5595 5595 5596 AssertReturn 5597 AssertReturn 5596 AssertReturn(!aNode.isNull(), E_INVALIDARG); 5597 AssertReturn((mType == IsMachine && aSnapshotId == NULL) || 5598 5598 (mType == IsSnapshotMachine && aSnapshotId != NULL), E_FAIL); 5599 5599 … … 5638 5638 ComObjPtr<HardDisk> hd; 5639 5639 rc = mParent->findHardDisk(&uuid, NULL, true /* aDoSetError */, &hd); 5640 CheckComRCReturnRC 5640 CheckComRCReturnRC(rc); 5641 5641 5642 5642 AutoWriteLock hdLock (hd); … … 5726 5726 using namespace settings; 5727 5727 5728 AssertReturn 5728 AssertReturn(aSnapshot && !aMachineNode.isNull() 5729 5729 && aSnapshotNode != NULL, E_FAIL); 5730 5730 … … 5758 5758 } 5759 5759 5760 AssertReturn 5760 AssertReturn(!snapshotsNode.isNull(), E_FAIL); 5761 5761 5762 5762 Key::List children = snapshotsNode.keys ("Snapshot"); … … 5782 5782 5783 5783 // we must always succesfully find the node 5784 AssertReturn 5785 AssertReturn 5784 AssertReturn(!snapshotNode.isNull(), E_FAIL); 5785 AssertReturn(!snapshotsNode.isNull(), E_FAIL); 5786 5786 5787 5787 if (aSnapshotsNode && (snapshotsNode != aMachineNode)) … … 5841 5841 bool aSetError /* = false */) 5842 5842 { 5843 AssertReturn 5843 AssertReturn(aName, E_INVALIDARG); 5844 5844 5845 5845 AutoReadLock chlock(snapshotsTreeLockHandle()); … … 5874 5874 */ 5875 5875 HRESULT Machine::getStorageControllerByName(CBSTR aName, 5876 ComObjPtr 5876 ComObjPtr<StorageController> &aStorageController, 5877 5877 bool aSetError /* = false */) 5878 5878 { 5879 AssertReturn 5879 AssertReturn(aName, E_INVALIDARG); 5880 5880 5881 5881 for (StorageControllerList::const_iterator it = … … 5900 5900 HDData::AttachmentList &atts) 5901 5901 { 5902 AutoCaller autoCaller 5902 AutoCaller autoCaller(this); 5903 5903 CheckComRCReturnRC(autoCaller.rc()); 5904 5904 … … 5933 5933 * currently differentiate it in callers of saveSettings() so we don't 5934 5934 * make difference here too. */ 5935 AssertReturn 5936 AssertReturn 5935 AssertReturn(mParent->isWriteLockOnCurrentThread(), E_FAIL); 5936 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 5937 5937 5938 5938 HRESULT rc = S_OK; … … 5955 5955 /* unlock the old config file */ 5956 5956 rc = unlockConfig(); 5957 CheckComRCReturnRC 5957 CheckComRCReturnRC(rc); 5958 5958 } 5959 5959 … … 5989 5989 /* perform real rename only if the machine is not new */ 5990 5990 vrc = RTPathRename (configDir.raw(), newConfigDir.raw(), 0); 5991 if (RT_FAILURE 5991 if (RT_FAILURE(vrc)) 5992 5992 { 5993 5993 rc = setError (E_FAIL, … … 6015 6015 /* perform real rename only if the machine is not new */ 6016 6016 vrc = RTFileRename (configFile.raw(), newConfigFile.raw(), 0); 6017 if (RT_FAILURE 6017 if (RT_FAILURE(vrc)) 6018 6018 { 6019 6019 rc = setError (E_FAIL, … … 6091 6091 /* lock the config again */ 6092 6092 HRESULT rc2 = lockConfig(); 6093 if (SUCCEEDED 6093 if (SUCCEEDED(rc)) 6094 6094 rc = rc2; 6095 6095 } 6096 6096 6097 CheckComRCReturnRC 6097 CheckComRCReturnRC(rc); 6098 6098 } 6099 6099 … … 6123 6123 RTFILE_O_READWRITE | RTFILE_O_CREATE | 6124 6124 RTFILE_O_DENY_WRITE); 6125 if (RT_SUCCESS 6125 if (RT_SUCCESS(vrc)) 6126 6126 { 6127 6127 vrc = RTFileWrite (mData->mHandleCfgFile, … … 6129 6129 strlen (gDefaultMachineConfig), NULL); 6130 6130 } 6131 if (RT_FAILURE 6131 if (RT_FAILURE(vrc)) 6132 6132 { 6133 6133 mData->mHandleCfgFile = NIL_RTFILE; … … 6169 6169 * currently differentiate it in callers of saveSettings() so we don't 6170 6170 * make difference here too. */ 6171 AssertReturn 6172 AssertReturn 6171 AssertReturn(mParent->isWriteLockOnCurrentThread(), E_FAIL); 6172 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 6173 6173 6174 6174 /* make sure child objects are unable to modify the settings while we are … … 6176 6176 ensureNoStateDependencies(); 6177 6177 6178 AssertReturn 6178 AssertReturn(mType == IsMachine || mType == IsSessionMachine, E_FAIL); 6179 6179 6180 6180 BOOL currentStateModified = mData->mCurrentStateModified; … … 6205 6205 bool isNew = false; 6206 6206 rc = prepareSaveSettings (isRenamed, isNew); 6207 CheckComRCReturnRC 6207 CheckComRCReturnRC(rc); 6208 6208 6209 6209 try … … 6362 6362 } 6363 6363 6364 if (SUCCEEDED 6364 if (SUCCEEDED(rc)) 6365 6365 { 6366 6366 commit(); … … 6378 6378 * inform callbacks. */ 6379 6379 if (mType == IsSessionMachine) 6380 mParent->onMachineDataChange 6381 } 6382 6383 LogFlowThisFunc 6380 mParent->onMachineDataChange(mData->mUuid); 6381 } 6382 6383 LogFlowThisFunc(("rc=%08X\n", rc)); 6384 6384 LogFlowThisFuncLeave(); 6385 6385 return rc; … … 6400 6400 HRESULT Machine::saveSnapshotSettings (Snapshot *aSnapshot, int aOpFlags) 6401 6401 { 6402 AutoCaller autoCaller 6402 AutoCaller autoCaller(this); 6403 6403 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 6404 6404 6405 AssertReturn 6405 AssertReturn(mType == IsMachine || mType == IsSessionMachine, E_FAIL); 6406 6406 6407 6407 /* This object's write lock is also necessary to serialize file access 6408 6408 * (prevent concurrent reads and writes) */ 6409 AutoWriteLock alock 6410 6411 AssertReturn 6409 AutoWriteLock alock(this); 6410 6411 AssertReturn(isConfigLocked(), E_FAIL); 6412 6412 6413 6413 HRESULT rc = S_OK; … … 6423 6423 6424 6424 rc = VirtualBox::loadSettingsTree_ForUpdate (tree, file); 6425 CheckComRCReturnRC 6425 CheckComRCReturnRC(rc); 6426 6426 6427 6427 Key machineNode = tree.rootKey().key ("Machine"); 6428 6428 6429 6429 rc = saveSnapshotSettingsWorker (machineNode, aSnapshot, aOpFlags); 6430 CheckComRCReturnRC 6430 CheckComRCReturnRC(rc); 6431 6431 6432 6432 /* save settings on success */ 6433 6433 rc = VirtualBox::saveSettingsTree (tree, file, 6434 6434 mData->mSettingsFileVersion); 6435 CheckComRCReturnRC 6435 CheckComRCReturnRC(rc); 6436 6436 } 6437 6437 catch (...) … … 6469 6469 using namespace settings; 6470 6470 6471 AssertReturn 6472 6473 AssertReturn 6471 AssertReturn(!aMachineNode.isNull(), E_FAIL); 6472 6473 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 6474 6474 6475 6475 int op = aOpFlags & SaveSS_OpMask; 6476 AssertReturn 6476 AssertReturn( 6477 6477 (aSnapshot && (op == SaveSS_AddOp || op == SaveSS_UpdateAttrsOp || 6478 6478 op == SaveSS_UpdateAllOp)) || … … 6511 6511 6512 6512 Assert (!!aSnapshot); 6513 ComObjPtr 6513 ComObjPtr<Snapshot> parent = aSnapshot->parent(); 6514 6514 6515 6515 if (op == SaveSS_AddOp) … … 6558 6558 * we need to inform callbacks manually. */ 6559 6559 if (mType == IsSessionMachine) 6560 mParent->onMachineDataChange 6560 mParent->onMachineDataChange(mData->mUuid); 6561 6561 } 6562 6562 } … … 6598 6598 while (0); 6599 6599 6600 if (SUCCEEDED 6600 if (SUCCEEDED(rc)) 6601 6601 { 6602 6602 /* update currentSnapshot when appropriate */ … … 6630 6630 using namespace settings; 6631 6631 6632 AssertReturn 6632 AssertReturn(!aNode.isNull(), E_INVALIDARG); 6633 6633 6634 6634 HRESULT rc = S_OK; … … 6731 6731 /* VRDP settings (optional) */ 6732 6732 rc = mVRDPServer->saveSettings (aNode); 6733 CheckComRCReturnRC 6733 CheckComRCReturnRC(rc); 6734 6734 #endif 6735 6735 6736 6736 /* BIOS (required) */ 6737 6737 rc = mBIOSSettings->saveSettings (aNode); 6738 CheckComRCReturnRC 6738 CheckComRCReturnRC(rc); 6739 6739 6740 6740 /* DVD drive (required) */ 6741 6741 rc = mDVDDrive->saveSettings (aNode); 6742 CheckComRCReturnRC 6742 CheckComRCReturnRC(rc); 6743 6743 6744 6744 /* Flooppy drive (required) */ 6745 6745 rc = mFloppyDrive->saveSettings (aNode); 6746 CheckComRCReturnRC 6746 CheckComRCReturnRC(rc); 6747 6747 6748 6748 /* USB Controller (required) */ 6749 6749 rc = mUSBController->saveSettings (aNode); 6750 CheckComRCReturnRC 6750 CheckComRCReturnRC(rc); 6751 6751 6752 6752 /* Network adapters (required) */ … … 6761 6761 6762 6762 rc = mNetworkAdapters [slot]->saveSettings (adapterNode); 6763 CheckComRCReturnRC 6763 CheckComRCReturnRC(rc); 6764 6764 } 6765 6765 } … … 6776 6776 6777 6777 rc = mSerialPorts [slot]->saveSettings (portNode); 6778 CheckComRCReturnRC 6778 CheckComRCReturnRC(rc); 6779 6779 } 6780 6780 } … … 6791 6791 6792 6792 rc = mParallelPorts [slot]->saveSettings (portNode); 6793 CheckComRCReturnRC 6793 CheckComRCReturnRC(rc); 6794 6794 } 6795 6795 } … … 6797 6797 /* Audio adapter */ 6798 6798 rc = mAudioAdapter->saveSettings (aNode); 6799 CheckComRCReturnRC 6799 CheckComRCReturnRC(rc); 6800 6800 6801 6801 /* Shared folders */ … … 6807 6807 ++ it) 6808 6808 { 6809 ComObjPtr 6809 ComObjPtr<SharedFolder> folder = *it; 6810 6810 6811 6811 Key folderNode = sharedFoldersNode.appendKey ("SharedFolder"); … … 6906 6906 using namespace settings; 6907 6907 6908 AssertReturn 6908 AssertReturn(!aNode.isNull(), E_INVALIDARG); 6909 6909 6910 6910 for (StorageControllerList::const_iterator … … 6915 6915 HRESULT rc; 6916 6916 const char *type = NULL; 6917 ComObjPtr 6917 ComObjPtr<StorageController> ctl = *it; 6918 6918 6919 6919 Key ctlNode = aNode.appendKey ("StorageController"); … … 6982 6982 using namespace settings; 6983 6983 6984 AssertReturn 6984 AssertReturn(!aNode.isNull(), E_INVALIDARG); 6985 6985 6986 6986 HDData::AttachmentList atts; … … 7025 7025 return S_OK; 7026 7026 7027 AutoCaller autoCaller 7027 AutoCaller autoCaller(this); 7028 7028 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 7029 7029 7030 7030 /* This object's write lock is also necessary to serialize file access 7031 7031 * (prevent concurrent reads and writes) */ 7032 AutoWriteLock alock 7033 7034 AssertReturn 7032 AutoWriteLock alock(this); 7033 7034 AssertReturn(isConfigLocked(), E_FAIL); 7035 7035 7036 7036 HRESULT rc = S_OK; … … 7046 7046 7047 7047 rc = VirtualBox::loadSettingsTree_ForUpdate (tree, file); 7048 CheckComRCReturnRC 7048 CheckComRCReturnRC(rc); 7049 7049 7050 7050 Key machineNode = tree.rootKey().key ("Machine"); … … 7087 7087 rc = VirtualBox::saveSettingsTree (tree, file, 7088 7088 mData->mSettingsFileVersion); 7089 CheckComRCReturnRC 7089 CheckComRCReturnRC(rc); 7090 7090 } 7091 7091 catch (...) … … 7129 7129 */ 7130 7130 HRESULT Machine::createImplicitDiffs (const Bstr &aFolder, 7131 ComObjPtr 7131 ComObjPtr<Progress> &aProgress, 7132 7132 bool aOnline) 7133 7133 { 7134 AssertReturn 7135 7136 AutoCaller autoCaller 7134 AssertReturn(!aFolder.isEmpty(), E_FAIL); 7135 7136 AutoCaller autoCaller(this); 7137 7137 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 7138 7138 7139 AutoWriteLock alock 7139 AutoWriteLock alock(this); 7140 7140 7141 7141 /* must be in a protective state because we leave the lock below */ 7142 AssertReturn 7142 AssertReturn(mData->mMachineState == MachineState_Saving || 7143 7143 mData->mMachineState == MachineState_Discarding, E_FAIL); 7144 7144 … … 7274 7274 HRESULT Machine::deleteImplicitDiffs() 7275 7275 { 7276 AutoCaller autoCaller 7276 AutoCaller autoCaller(this); 7277 7277 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 7278 7278 7279 AutoWriteLock alock 7280 7281 AssertReturn 7279 AutoWriteLock alock(this); 7280 7281 AssertReturn(mHDData.isBackedUp(), E_FAIL); 7282 7282 7283 7283 HRESULT rc = S_OK; … … 7379 7379 void Machine::fixupHardDisks(bool aCommit, bool aOnline /*= false*/) 7380 7380 { 7381 AutoCaller autoCaller 7381 AutoCaller autoCaller(this); 7382 7382 AssertComRCReturnVoid (autoCaller.rc()); 7383 7383 7384 AutoWriteLock alock 7384 AutoWriteLock alock(this); 7385 7385 7386 7386 /* no attach/detach operations -- nothing to do */ … … 7414 7414 mData->mSession.mLockedMedia.push_back ( 7415 7415 Data::Session::LockedMedia::value_type ( 7416 ComPtr 7416 ComPtr<IHardDisk> (hd), true)); 7417 7417 7418 7418 /* also, relock the old hard disk which is a base for the … … 7433 7433 mData->mSession.mLockedMedia.push_back ( 7434 7434 Data::Session::LockedMedia::value_type ( 7435 ComPtr 7435 ComPtr<IHardDisk> (parent), false)); 7436 7436 } 7437 7437 … … 7467 7467 rc = hd->UnlockWrite (&state); 7468 7468 /* the disk may be alredy relocked for reading above */ 7469 Assert (SUCCEEDED 7469 Assert (SUCCEEDED(rc) || state == MediaState_LockedRead); 7470 7470 } 7471 7471 } … … 7506 7506 RTFILE_O_READWRITE | RTFILE_O_OPEN | 7507 7507 RTFILE_O_DENY_WRITE); 7508 if (RT_FAILURE 7508 if (RT_FAILURE(vrc) && (vrc != VERR_FILE_NOT_FOUND)) 7509 7509 { 7510 7510 /* Open the associated config file only with read access. */ … … 7513 7513 RTFILE_O_READ | RTFILE_O_OPEN | 7514 7514 RTFILE_O_DENY_NONE); 7515 if (RT_FAILURE 7515 if (RT_FAILURE(vrc)) 7516 7516 { 7517 7517 /* We even cannot open it in read mode, so there's seriously … … 7538 7538 } 7539 7539 7540 LogFlowThisFunc 7540 LogFlowThisFunc(("mConfigFile={%ls}, mHandleCfgFile=%d, rc=%08X\n", 7541 7541 mData->mConfigFileFull.raw(), mData->mHandleCfgFile, rc)); 7542 7542 return rc; … … 7564 7564 } 7565 7565 7566 LogFlowThisFunc 7566 LogFlowThisFunc(("\n")); 7567 7567 7568 7568 return rc; … … 7586 7586 char *dirName = RTPathFilename(settingsDir); 7587 7587 7588 AssertReturn 7588 AssertReturn(dirName, false); 7589 7589 7590 7590 /* if we don't rename anything on name change, return false shorlty */ … … 7603 7603 bool Machine::isModified() 7604 7604 { 7605 AutoCaller autoCaller 7605 AutoCaller autoCaller(this); 7606 7606 AssertComRCReturn (autoCaller.rc(), false); 7607 7607 7608 AutoReadLock alock 7608 AutoReadLock alock(this); 7609 7609 7610 7610 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) … … 7657 7657 bool Machine::isReallyModified (bool aIgnoreUserData /* = false */) 7658 7658 { 7659 AutoCaller autoCaller 7659 AutoCaller autoCaller(this); 7660 7660 AssertComRCReturn (autoCaller.rc(), false); 7661 7661 7662 AutoReadLock alock 7662 AutoReadLock alock(this); 7663 7663 7664 7664 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) … … 7716 7716 void Machine::rollback (bool aNotify) 7717 7717 { 7718 AutoCaller autoCaller 7718 AutoCaller autoCaller(this); 7719 7719 AssertComRCReturn (autoCaller.rc(), (void) 0); 7720 7720 7721 AutoWriteLock alock 7721 AutoWriteLock alock(this); 7722 7722 7723 7723 /* check for changes in own data */ … … 7797 7797 usbChanged = false; 7798 7798 7799 ComPtr 7800 ComPtr 7801 ComPtr 7799 ComPtr<INetworkAdapter> networkAdapters [RT_ELEMENTS (mNetworkAdapters)]; 7800 ComPtr<ISerialPort> serialPorts [RT_ELEMENTS (mSerialPorts)]; 7801 ComPtr<IParallelPort> parallelPorts [RT_ELEMENTS (mParallelPorts)]; 7802 7802 7803 7803 if (mBIOSSettings) … … 7840 7840 /* inform the direct session about changes */ 7841 7841 7842 ComObjPtr 7842 ComObjPtr<Machine> that = this; 7843 7843 alock.leave(); 7844 7844 … … 7879 7879 void Machine::commit() 7880 7880 { 7881 AutoCaller autoCaller 7881 AutoCaller autoCaller(this); 7882 7882 AssertComRCReturnVoid (autoCaller.rc()); 7883 7883 … … 8025 8025 ++ it) 8026 8026 { 8027 ComObjPtr 8027 ComObjPtr<SharedFolder> folder; 8028 8028 folder.createObject(); 8029 8029 HRESULT rc = folder->initCopy (machine(), *it); … … 8048 8048 ++ it) 8049 8049 { 8050 ComObjPtr 8050 ComObjPtr<StorageController> ctrl; 8051 8051 ctrl.createObject(); 8052 8052 ctrl->initCopy (this, *it); … … 8133 8133 virtual void handler() = 0; 8134 8134 8135 ComObjPtr 8136 ComObjPtr 8135 ComObjPtr<SessionMachine> machine; 8136 ComObjPtr<Progress> progress; 8137 8137 const MachineState_T state; 8138 8138 … … 8162 8162 void handler() { machine->discardSnapshotHandler (*this); } 8163 8163 8164 ComObjPtr 8164 ComObjPtr<Snapshot> snapshot; 8165 8165 }; 8166 8166 … … 8183 8183 HRESULT SessionMachine::FinalConstruct() 8184 8184 { 8185 LogFlowThisFunc 8185 LogFlowThisFunc(("\n")); 8186 8186 8187 8187 /* set the proper type to indicate we're the SessionMachine instance */ 8188 unconst 8188 unconst(mType) = IsSessionMachine; 8189 8189 8190 8190 #if defined(RT_OS_WINDOWS) … … 8203 8203 void SessionMachine::FinalRelease() 8204 8204 { 8205 LogFlowThisFunc 8205 LogFlowThisFunc(("\n")); 8206 8206 8207 8207 uninit (Uninit::Unexpected); … … 8214 8214 { 8215 8215 LogFlowThisFuncEnter(); 8216 LogFlowThisFunc 8217 8218 AssertReturn 8219 8220 AssertReturn 8216 LogFlowThisFunc(("mName={%ls}\n", aMachine->mUserData->mName.raw())); 8217 8218 AssertReturn(aMachine, E_INVALIDARG); 8219 8220 AssertReturn(aMachine->lockHandle()->isWriteLockOnCurrentThread(), E_FAIL); 8221 8221 8222 8222 /* Enclose the state transition NotReady->InInit->Ready */ 8223 AutoInitSpan autoInitSpan 8224 AssertReturn 8223 AutoInitSpan autoInitSpan(this); 8224 AssertReturn(autoInitSpan.isOk(), E_FAIL); 8225 8225 8226 8226 /* create the interprocess semaphore */ … … 8297 8297 8298 8298 /* memorize the peer Machine */ 8299 unconst 8299 unconst(mPeer) = aMachine; 8300 8300 /* share the parent pointer */ 8301 unconst 8301 unconst(mParent) = aMachine->mParent; 8302 8302 8303 8303 /* take the pointers to data to share */ … … 8313 8313 while (it != aMachine->mStorageControllers->end()) 8314 8314 { 8315 ComObjPtr 8315 ComObjPtr<StorageController> ctl; 8316 8316 ctl.createObject(); 8317 8317 ctl->init(this, *it); … … 8320 8320 } 8321 8321 8322 unconst 8322 unconst(mBIOSSettings).createObject(); 8323 8323 mBIOSSettings->init (this, aMachine->mBIOSSettings); 8324 8324 #ifdef VBOX_WITH_VRDP 8325 8325 /* create another VRDPServer object that will be mutable */ 8326 unconst 8326 unconst(mVRDPServer).createObject(); 8327 8327 mVRDPServer->init (this, aMachine->mVRDPServer); 8328 8328 #endif 8329 8329 /* create another DVD drive object that will be mutable */ 8330 unconst 8330 unconst(mDVDDrive).createObject(); 8331 8331 mDVDDrive->init (this, aMachine->mDVDDrive); 8332 8332 /* create another floppy drive object that will be mutable */ 8333 unconst 8333 unconst(mFloppyDrive).createObject(); 8334 8334 mFloppyDrive->init (this, aMachine->mFloppyDrive); 8335 8335 /* create another audio adapter object that will be mutable */ 8336 unconst 8336 unconst(mAudioAdapter).createObject(); 8337 8337 mAudioAdapter->init (this, aMachine->mAudioAdapter); 8338 8338 /* create a list of serial ports that will be mutable */ 8339 8339 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 8340 8340 { 8341 unconst 8341 unconst(mSerialPorts [slot]).createObject(); 8342 8342 mSerialPorts [slot]->init (this, aMachine->mSerialPorts [slot]); 8343 8343 } … … 8345 8345 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 8346 8346 { 8347 unconst 8347 unconst(mParallelPorts [slot]).createObject(); 8348 8348 mParallelPorts [slot]->init (this, aMachine->mParallelPorts [slot]); 8349 8349 } 8350 8350 /* create another USB controller object that will be mutable */ 8351 unconst 8351 unconst(mUSBController).createObject(); 8352 8352 mUSBController->init (this, aMachine->mUSBController); 8353 8353 … … 8355 8355 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 8356 8356 { 8357 unconst 8357 unconst(mNetworkAdapters [slot]).createObject(); 8358 8358 mNetworkAdapters [slot]->init (this, aMachine->mNetworkAdapters [slot]); 8359 8359 } … … 8380 8380 { 8381 8381 LogFlowThisFuncEnter(); 8382 LogFlowThisFunc 8382 LogFlowThisFunc(("reason=%d\n", aReason)); 8383 8383 8384 8384 /* … … 8389 8389 * This self reference will be released as the very last step on return. 8390 8390 */ 8391 ComObjPtr 8391 ComObjPtr<SessionMachine> selfRef = this; 8392 8392 8393 8393 /* Enclose the state transition Ready->InUninit->NotReady */ 8394 AutoUninitSpan autoUninitSpan 8394 AutoUninitSpan autoUninitSpan(this); 8395 8395 if (autoUninitSpan.uninitDone()) 8396 8396 { 8397 LogFlowThisFunc 8397 LogFlowThisFunc(("Already uninitialized\n")); 8398 8398 LogFlowThisFuncLeave(); 8399 8399 return; … … 8406 8406 * below, the following is enough. 8407 8407 */ 8408 LogFlowThisFunc 8408 LogFlowThisFunc(("Initialization failed.\n")); 8409 8409 #if defined(RT_OS_WINDOWS) 8410 8410 if (mIPCSem) … … 8427 8427 uninitDataAndChildObjects(); 8428 8428 mData.free(); 8429 unconst 8430 unconst 8429 unconst(mParent).setNull(); 8430 unconst(mPeer).setNull(); 8431 8431 LogFlowThisFuncLeave(); 8432 8432 return; … … 8447 8447 if (aReason == Uninit::Abnormal) 8448 8448 { 8449 LogWarningThisFunc 8449 LogWarningThisFunc(("ABNORMAL client termination! (wasBusy=%d)\n", 8450 8450 Global::IsOnlineOrTransient (lastState))); 8451 8451 … … 8457 8457 if (isModified()) 8458 8458 { 8459 LogWarningThisFunc 8459 LogWarningThisFunc(("Discarding unsaved settings changes!\n")); 8460 8460 rollback (false /* aNotify */); 8461 8461 } … … 8464 8464 if (mSnapshotData.mStateFilePath) 8465 8465 { 8466 LogWarningThisFunc 8466 LogWarningThisFunc(("canceling failed save state request!\n")); 8467 8467 endSavingState (FALSE /* aSuccess */); 8468 8468 } 8469 8469 else if (!mSnapshotData.mSnapshot.isNull()) 8470 8470 { 8471 LogWarningThisFunc 8471 LogWarningThisFunc(("canceling untaken snapshot!\n")); 8472 8472 endTakingSnapshot (FALSE /* aSuccess */); 8473 8473 } … … 8518 8518 if (mData->mSession.mRemoteControls.size()) 8519 8519 { 8520 LogFlowThisFunc 8520 LogFlowThisFunc(("Closing remote sessions (%d):\n", 8521 8521 mData->mSession.mRemoteControls.size())); 8522 8522 … … 8525 8525 while (it != mData->mSession.mRemoteControls.end()) 8526 8526 { 8527 LogFlowThisFunc 8527 LogFlowThisFunc((" Calling remoteControl->Uninitialize()...\n")); 8528 8528 HRESULT rc = (*it)->Uninitialize(); 8529 LogFlowThisFunc 8529 LogFlowThisFunc((" remoteControl->Uninitialize() returned %08X\n", rc)); 8530 8530 if (FAILED (rc)) 8531 LogWarningThisFunc 8531 LogWarningThisFunc(("Forgot to close the remote session?\n")); 8532 8532 ++ it; 8533 8533 } … … 8548 8548 8549 8549 if ((aReason == Uninit::Unexpected)) 8550 LogWarningThisFunc 8550 LogWarningThisFunc(("Unexpected SessionMachine uninitialization!\n")); 8551 8551 8552 8552 if (aReason != Uninit::Normal) … … 8605 8605 alock.leave(); 8606 8606 8607 unconst 8608 unconst 8607 unconst(mParent).setNull(); 8608 unconst(mPeer).setNull(); 8609 8609 8610 8610 LogFlowThisFuncLeave(); … … 8620 8620 RWLockHandle *SessionMachine::lockHandle() const 8621 8621 { 8622 AssertReturn 8622 AssertReturn(!mPeer.isNull(), NULL); 8623 8623 return mPeer->lockHandle(); 8624 8624 } … … 8632 8632 STDMETHODIMP SessionMachine::SetRemoveSavedState(BOOL aRemove) 8633 8633 { 8634 AutoCaller autoCaller 8634 AutoCaller autoCaller(this); 8635 8635 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8636 8636 8637 AutoWriteLock alock 8637 AutoWriteLock alock(this); 8638 8638 8639 8639 mRemoveSavedState = aRemove; … … 8655 8655 STDMETHODIMP SessionMachine::GetIPCId (BSTR *aId) 8656 8656 { 8657 AutoCaller autoCaller 8657 AutoCaller autoCaller(this); 8658 8658 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8659 8659 8660 AutoReadLock alock 8660 AutoReadLock alock(this); 8661 8661 8662 8662 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 8663 mIPCSemName.cloneTo 8663 mIPCSemName.cloneTo(aId); 8664 8664 return S_OK; 8665 8665 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 8666 8666 # ifdef VBOX_WITH_NEW_SYS_V_KEYGEN 8667 mIPCKey.cloneTo 8667 mIPCKey.cloneTo(aId); 8668 8668 # else /* !VBOX_WITH_NEW_SYS_V_KEYGEN */ 8669 mData->mConfigFileFull.cloneTo 8669 mData->mConfigFileFull.cloneTo(aId); 8670 8670 # endif /* !VBOX_WITH_NEW_SYS_V_KEYGEN */ 8671 8671 return S_OK; … … 8685 8685 ULONG *aMaskedIfs) 8686 8686 { 8687 LogFlowThisFunc 8687 LogFlowThisFunc(("\n")); 8688 8688 8689 8689 CheckComArgNotNull (aUSBDevice); 8690 CheckComArgOutPointerValid 8691 8692 AutoCaller autoCaller 8690 CheckComArgOutPointerValid(aMatched); 8691 8692 AutoCaller autoCaller(this); 8693 8693 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8694 8694 … … 8709 8709 STDMETHODIMP SessionMachine::CaptureUSBDevice (IN_BSTR aId) 8710 8710 { 8711 LogFlowThisFunc 8712 8713 AutoCaller autoCaller 8714 AssertComRCReturnRC 8711 LogFlowThisFunc(("\n")); 8712 8713 AutoCaller autoCaller(this); 8714 AssertComRCReturnRC(autoCaller.rc()); 8715 8715 8716 8716 #ifdef VBOX_WITH_USB 8717 8717 /* if captureDeviceForVM() fails, it must have set extended error info */ 8718 8718 MultiResult rc = mParent->host()->checkUSBProxyService(); 8719 CheckComRCReturnRC 8719 CheckComRCReturnRC(rc); 8720 8720 8721 8721 USBProxyService *service = mParent->host()->usbProxyService(); 8722 AssertReturn 8722 AssertReturn(service, E_FAIL); 8723 8723 return service->captureDeviceForVM (this, Guid(aId)); 8724 8724 #else … … 8733 8733 STDMETHODIMP SessionMachine::DetachUSBDevice (IN_BSTR aId, BOOL aDone) 8734 8734 { 8735 LogFlowThisFunc 8736 8737 AutoCaller autoCaller 8735 LogFlowThisFunc(("\n")); 8736 8737 AutoCaller autoCaller(this); 8738 8738 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8739 8739 8740 8740 #ifdef VBOX_WITH_USB 8741 8741 USBProxyService *service = mParent->host()->usbProxyService(); 8742 AssertReturn 8742 AssertReturn(service, E_FAIL); 8743 8743 return service->detachDeviceFromVM (this, Guid(aId), !!aDone); 8744 8744 #else … … 8759 8759 STDMETHODIMP SessionMachine::AutoCaptureUSBDevices() 8760 8760 { 8761 LogFlowThisFunc 8762 8763 AutoCaller autoCaller 8761 LogFlowThisFunc(("\n")); 8762 8763 AutoCaller autoCaller(this); 8764 8764 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8765 8765 … … 8770 8770 8771 8771 USBProxyService *service = mParent->host()->usbProxyService(); 8772 AssertReturn 8772 AssertReturn(service, E_FAIL); 8773 8773 return service->autoCaptureDevicesForVM (this); 8774 8774 #else … … 8789 8789 STDMETHODIMP SessionMachine::DetachAllUSBDevices (BOOL aDone) 8790 8790 { 8791 LogFlowThisFunc 8792 8793 AutoCaller autoCaller 8791 LogFlowThisFunc(("\n")); 8792 8793 AutoCaller autoCaller(this); 8794 8794 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8795 8795 … … 8800 8800 8801 8801 USBProxyService *service = mParent->host()->usbProxyService(); 8802 AssertReturn 8802 AssertReturn(service, E_FAIL); 8803 8803 return service->detachAllDevicesFromVM (this, !!aDone, false /* aAbnormal */); 8804 8804 #else … … 8816 8816 LogFlowThisFuncEnter(); 8817 8817 8818 AssertReturn 8819 AssertReturn 8820 8821 AutoCaller autoCaller 8822 8823 LogFlowThisFunc 8818 AssertReturn(aSession, E_INVALIDARG); 8819 AssertReturn(aProgress, E_INVALIDARG); 8820 8821 AutoCaller autoCaller(this); 8822 8823 LogFlowThisFunc(("state=%d\n", autoCaller.state())); 8824 8824 /* 8825 8825 * We don't assert below because it might happen that a non-direct session 8826 8826 * informs us it is closed right after we've been uninitialized -- it's ok. 8827 8827 */ 8828 CheckComRCReturnRC 8828 CheckComRCReturnRC(autoCaller.rc()); 8829 8829 8830 8830 /* get IInternalSessionControl interface */ 8831 ComPtr 8831 ComPtr<IInternalSessionControl> control (aSession); 8832 8832 8833 8833 ComAssertRet (!control.isNull(), E_INVALIDARG); 8834 8834 8835 AutoWriteLock alock 8835 AutoWriteLock alock(this); 8836 8836 8837 8837 if (control.equalsTo (mData->mSession.mDirectControl)) … … 8849 8849 /* set direct control to NULL to release the remote instance */ 8850 8850 mData->mSession.mDirectControl.setNull(); 8851 LogFlowThisFunc 8851 LogFlowThisFunc(("Direct control is set to NULL\n")); 8852 8852 8853 8853 /* Create the progress object the client will use to wait until 8854 8854 * #checkForDeath() is called to uninitialize this session object after 8855 8855 * it releases the IPC semaphore. */ 8856 ComObjPtr 8856 ComObjPtr<Progress> progress; 8857 8857 progress.createObject(); 8858 8858 progress->init (mParent, static_cast <IMachine *> (mPeer), 8859 8859 Bstr (tr ("Closing session")), FALSE /* aCancelable */); 8860 progress.queryInterfaceTo 8860 progress.queryInterfaceTo(aProgress); 8861 8861 mData->mSession.mProgress = progress; 8862 8862 } … … 8889 8889 LogFlowThisFuncEnter(); 8890 8890 8891 AssertReturn 8892 AssertReturn 8893 8894 AutoCaller autoCaller 8891 AssertReturn(aProgress, E_INVALIDARG); 8892 AssertReturn(aStateFilePath, E_POINTER); 8893 8894 AutoCaller autoCaller(this); 8895 8895 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8896 8896 8897 AutoWriteLock alock 8898 8899 AssertReturn 8897 AutoWriteLock alock(this); 8898 8899 AssertReturn(mData->mMachineState == MachineState_Paused && 8900 8900 mSnapshotData.mLastState == MachineState_Null && 8901 8901 mSnapshotData.mProgressId.isEmpty() && … … 8927 8927 setMachineState (MachineState_Saving); 8928 8928 8929 stateFilePath.cloneTo 8929 stateFilePath.cloneTo(aStateFilePath); 8930 8930 8931 8931 return S_OK; … … 8937 8937 STDMETHODIMP SessionMachine::EndSavingState (BOOL aSuccess) 8938 8938 { 8939 LogFlowThisFunc 8940 8941 AutoCaller autoCaller 8939 LogFlowThisFunc(("\n")); 8940 8941 AutoCaller autoCaller(this); 8942 8942 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8943 8943 … … 8945 8945 AutoMultiWriteLock2 alock (mParent, this); 8946 8946 8947 AssertReturn 8947 AssertReturn(mData->mMachineState == MachineState_Saving && 8948 8948 mSnapshotData.mLastState != MachineState_Null && 8949 8949 !mSnapshotData.mProgressId.isEmpty() && … … 8970 8970 STDMETHODIMP SessionMachine::AdoptSavedState (IN_BSTR aSavedStateFile) 8971 8971 { 8972 LogFlowThisFunc 8973 8974 AssertReturn 8975 8976 AutoCaller autoCaller 8972 LogFlowThisFunc(("\n")); 8973 8974 AssertReturn(aSavedStateFile, E_INVALIDARG); 8975 8976 AutoCaller autoCaller(this); 8977 8977 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8978 8978 8979 AutoWriteLock alock 8980 8981 AssertReturn 8979 AutoWriteLock alock(this); 8980 8981 AssertReturn(mData->mMachineState == MachineState_PoweredOff || 8982 8982 mData->mMachineState == MachineState_Aborted, 8983 8983 E_FAIL); … … 8985 8985 Utf8Str stateFilePathFull = aSavedStateFile; 8986 8986 int vrc = calculateFullPath (stateFilePathFull, stateFilePathFull); 8987 if (RT_FAILURE 8987 if (RT_FAILURE(vrc)) 8988 8988 return setError (VBOX_E_FILE_ERROR, 8989 8989 tr ("Invalid saved state file path '%ls' (%Rrc)"), … … 9008 9008 LogFlowThisFuncEnter(); 9009 9009 9010 AssertReturn 9011 AssertReturn 9012 9013 LogFlowThisFunc 9014 9015 AutoCaller autoCaller 9010 AssertReturn(aInitiator && aName, E_INVALIDARG); 9011 AssertReturn(aStateFilePath && aServerProgress, E_POINTER); 9012 9013 LogFlowThisFunc(("aName='%ls'\n", aName)); 9014 9015 AutoCaller autoCaller(this); 9016 9016 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9017 9017 … … 9019 9019 AutoMultiWriteLock2 alock (mParent, this); 9020 9020 9021 AssertReturn 9021 AssertReturn((!Global::IsOnlineOrTransient (mData->mMachineState) || 9022 9022 mData->mMachineState == MachineState_Paused) && 9023 9023 mSnapshotData.mLastState == MachineState_Null && … … 9034 9034 * hard disks are fixed up */ 9035 9035 HRESULT rc = saveSettings(); 9036 CheckComRCReturnRC 9036 CheckComRCReturnRC(rc); 9037 9037 } 9038 9038 … … 9046 9046 ++ it) 9047 9047 { 9048 ComObjPtr 9048 ComObjPtr<HardDisk> hd = (*it)->hardDisk(); 9049 9049 AutoReadLock hdLock (hd); 9050 9050 if (hd->type() == HardDiskType_Writethrough) … … 9056 9056 #endif 9057 9057 9058 AssertReturn 9058 AssertReturn(aProgress || !takingSnapshotOnline, E_FAIL); 9059 9059 9060 9060 /* create an ID for the snapshot */ … … 9074 9074 { 9075 9075 HRESULT rc = VirtualBox::ensureFilePathExists (Utf8Str (stateFilePath)); 9076 CheckComRCReturnRC 9076 CheckComRCReturnRC(rc); 9077 9077 } 9078 9078 9079 9079 /* create a snapshot machine object */ 9080 ComObjPtr 9080 ComObjPtr<SnapshotMachine> snapshotMachine; 9081 9081 snapshotMachine.createObject(); 9082 9082 HRESULT rc = snapshotMachine->init (this, snapshotId, stateFilePath); … … 9092 9092 * hard disks + 1 (if the state is saved so we need to copy it) 9093 9093 */ 9094 ComObjPtr 9094 ComObjPtr<Progress> serverProgress; 9095 9095 serverProgress.createObject(); 9096 9096 { … … 9107 9107 9108 9108 /* create a combined server-side progress object when necessary */ 9109 ComObjPtr 9109 ComObjPtr<CombinedProgress> combinedProgress; 9110 9110 if (takingSnapshotOnline) 9111 9111 { … … 9118 9118 /* create a snapshot object */ 9119 9119 RTTIMESPEC time; 9120 ComObjPtr 9120 ComObjPtr<Snapshot> snapshot; 9121 9121 snapshot.createObject(); 9122 9122 rc = snapshot->init(mParent, … … 9127 9127 snapshotMachine, 9128 9128 mData->mCurrentSnapshot); 9129 AssertComRCReturnRC 9129 AssertComRCReturnRC(rc); 9130 9130 9131 9131 /* create and start the task on a separate thread (note that it will not … … 9135 9135 (void *) task, 9136 9136 0, RTTHREADTYPE_MAIN_WORKER, 0, "TakeSnapshot"); 9137 if (RT_FAILURE 9137 if (RT_FAILURE(vrc)) 9138 9138 { 9139 9139 snapshot->uninit(); … … 9152 9152 9153 9153 if (takingSnapshotOnline) 9154 stateFilePath.cloneTo 9154 stateFilePath.cloneTo(aStateFilePath); 9155 9155 else 9156 9156 *aStateFilePath = NULL; 9157 9157 9158 serverProgress.queryInterfaceTo 9158 serverProgress.queryInterfaceTo(aServerProgress); 9159 9159 9160 9160 LogFlowThisFuncLeave(); … … 9167 9167 STDMETHODIMP SessionMachine::EndTakingSnapshot (BOOL aSuccess) 9168 9168 { 9169 LogFlowThisFunc 9170 9171 AutoCaller autoCaller 9169 LogFlowThisFunc(("\n")); 9170 9171 AutoCaller autoCaller(this); 9172 9172 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9173 9173 9174 AutoWriteLock alock 9175 9176 AssertReturn 9174 AutoWriteLock alock(this); 9175 9176 AssertReturn(!aSuccess || 9177 9177 (mData->mMachineState == MachineState_Saving && 9178 9178 mSnapshotData.mLastState != MachineState_Null && … … 9198 9198 IProgress **aProgress) 9199 9199 { 9200 LogFlowThisFunc 9200 LogFlowThisFunc(("\n")); 9201 9201 9202 9202 Guid id(aId); 9203 AssertReturn 9204 AssertReturn 9205 9206 AutoCaller autoCaller 9203 AssertReturn(aInitiator && !id.isEmpty(), E_INVALIDARG); 9204 AssertReturn(aMachineState && aProgress, E_POINTER); 9205 9206 AutoCaller autoCaller(this); 9207 9207 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9208 9208 … … 9216 9216 ComObjPtr<Snapshot> snapshot; 9217 9217 HRESULT rc = findSnapshot(id, snapshot, true /* aSetError */); 9218 CheckComRCReturnRC 9218 CheckComRCReturnRC(rc); 9219 9219 9220 9220 AutoWriteLock snapshotLock(snapshot); … … 9251 9251 * 1 (preparing) + # of hard disks + 1 if the snapshot is online 9252 9252 */ 9253 ComObjPtr 9253 ComObjPtr<Progress> progress; 9254 9254 progress.createObject(); 9255 9255 rc = progress->init (mParent, aInitiator, … … 9267 9267 (void *) task, 9268 9268 0, RTTHREADTYPE_MAIN_WORKER, 0, "DiscardSnapshot"); 9269 if (RT_FAILURE 9269 if (RT_FAILURE(vrc)) 9270 9270 delete task; 9271 9271 ComAssertRCRet (vrc, E_FAIL); … … 9275 9275 9276 9276 /* return the progress to the caller */ 9277 progress.queryInterfaceTo 9277 progress.queryInterfaceTo(aProgress); 9278 9278 9279 9279 /* return the new state to the caller */ … … 9289 9289 IConsole *aInitiator, MachineState_T *aMachineState, IProgress **aProgress) 9290 9290 { 9291 LogFlowThisFunc 9292 9293 AssertReturn 9294 AssertReturn 9295 9296 AutoCaller autoCaller 9291 LogFlowThisFunc(("\n")); 9292 9293 AssertReturn(aInitiator, E_INVALIDARG); 9294 AssertReturn(aMachineState && aProgress, E_POINTER); 9295 9296 AutoCaller autoCaller(this); 9297 9297 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9298 9298 9299 AutoWriteLock alock 9299 AutoWriteLock alock(this); 9300 9300 9301 9301 ComAssertRet (!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL); … … 9309 9309 /* create a progress object. The number of operations is: 1 (preparing) + # 9310 9310 * of hard disks + 1 (if we need to copy the saved state file) */ 9311 ComObjPtr 9311 ComObjPtr<Progress> progress; 9312 9312 progress.createObject(); 9313 9313 { … … 9328 9328 (void *) task, 9329 9329 0, RTTHREADTYPE_MAIN_WORKER, 0, "DiscardCurState"); 9330 if (RT_FAILURE 9330 if (RT_FAILURE(vrc)) 9331 9331 { 9332 9332 delete task; … … 9338 9338 9339 9339 /* return the progress to the caller */ 9340 progress.queryInterfaceTo 9340 progress.queryInterfaceTo(aProgress); 9341 9341 9342 9342 /* return the new state to the caller */ … … 9353 9353 IProgress **aProgress) 9354 9354 { 9355 LogFlowThisFunc 9356 9357 AssertReturn 9358 AssertReturn 9359 9360 AutoCaller autoCaller 9355 LogFlowThisFunc(("\n")); 9356 9357 AssertReturn(aInitiator, E_INVALIDARG); 9358 AssertReturn(aMachineState && aProgress, E_POINTER); 9359 9360 AutoCaller autoCaller(this); 9361 9361 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9362 9362 9363 AutoWriteLock alock 9363 AutoWriteLock alock(this); 9364 9364 9365 9365 ComAssertRet (!Global::IsOnlineOrTransient (mData->mMachineState), E_FAIL); … … 9380 9380 * 1 if we need to copy the saved state file of the current snapshot * 2 9381 9381 */ 9382 ComObjPtr 9382 ComObjPtr<Progress> progress; 9383 9383 progress.createObject(); 9384 9384 { … … 9435 9435 9436 9436 STDMETHODIMP SessionMachine:: 9437 PullGuestProperties (ComSafeArrayOut 9438 ComSafeArrayOut 9439 ComSafeArrayOut 9440 ComSafeArrayOut 9441 { 9442 LogFlowThisFunc 9437 PullGuestProperties (ComSafeArrayOut(BSTR, aNames), 9438 ComSafeArrayOut(BSTR, aValues), 9439 ComSafeArrayOut(ULONG64, aTimestamps), 9440 ComSafeArrayOut(BSTR, aFlags)) 9441 { 9442 LogFlowThisFunc(("\n")); 9443 9443 9444 9444 #ifdef VBOX_WITH_GUEST_PROPS 9445 9445 using namespace guestProp; 9446 9446 9447 AutoCaller autoCaller 9447 AutoCaller autoCaller(this); 9448 9448 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9449 9449 9450 AutoReadLock alock 9451 9452 AssertReturn (!ComSafeArrayOutIsNull(aNames), E_POINTER);9453 AssertReturn (!ComSafeArrayOutIsNull(aValues), E_POINTER);9454 AssertReturn (!ComSafeArrayOutIsNull(aTimestamps), E_POINTER);9455 AssertReturn (!ComSafeArrayOutIsNull(aFlags), E_POINTER);9450 AutoReadLock alock(this); 9451 9452 AssertReturn(!ComSafeArrayOutIsNull(aNames), E_POINTER); 9453 AssertReturn(!ComSafeArrayOutIsNull(aValues), E_POINTER); 9454 AssertReturn(!ComSafeArrayOutIsNull(aTimestamps), E_POINTER); 9455 AssertReturn(!ComSafeArrayOutIsNull(aFlags), E_POINTER); 9456 9456 9457 9457 size_t cEntries = mHWData->mGuestProperties.size(); 9458 com::SafeArray 9459 com::SafeArray 9460 com::SafeArray 9461 com::SafeArray 9458 com::SafeArray<BSTR> names (cEntries); 9459 com::SafeArray<BSTR> values (cEntries); 9460 com::SafeArray<ULONG64> timestamps (cEntries); 9461 com::SafeArray<BSTR> flags (cEntries); 9462 9462 unsigned i = 0; 9463 9463 for (HWData::GuestPropertyList::iterator it = mHWData->mGuestProperties.begin(); … … 9465 9465 { 9466 9466 char szFlags[MAX_FLAGS_LEN + 1]; 9467 it->mName.cloneTo 9468 it->mValue.cloneTo 9467 it->mName.cloneTo(&names[i]); 9468 it->mValue.cloneTo(&values[i]); 9469 9469 timestamps[i] = it->mTimestamp; 9470 9470 writeFlags (it->mFlags, szFlags); 9471 Bstr (szFlags).cloneTo 9471 Bstr (szFlags).cloneTo(&flags[i]); 9472 9472 ++i; 9473 9473 } 9474 names.detachTo (ComSafeArrayOutArg(aNames));9475 values.detachTo (ComSafeArrayOutArg(aValues));9476 timestamps.detachTo (ComSafeArrayOutArg(aTimestamps));9477 flags.detachTo (ComSafeArrayOutArg(aFlags));9474 names.detachTo(ComSafeArrayOutArg(aNames)); 9475 values.detachTo(ComSafeArrayOutArg(aValues)); 9476 timestamps.detachTo(ComSafeArrayOutArg(aTimestamps)); 9477 flags.detachTo(ComSafeArrayOutArg(aFlags)); 9478 9478 mHWData->mPropertyServiceActive = true; 9479 9479 return S_OK; … … 9488 9488 ComSafeArrayIn (IN_BSTR, aFlags)) 9489 9489 { 9490 LogFlowThisFunc 9490 LogFlowThisFunc(("\n")); 9491 9491 9492 9492 #ifdef VBOX_WITH_GUEST_PROPS 9493 9493 using namespace guestProp; 9494 9494 9495 AutoCaller autoCaller 9495 AutoCaller autoCaller(this); 9496 9496 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9497 9497 9498 AutoWriteLock alock 9498 AutoWriteLock alock(this); 9499 9499 9500 9500 /* Temporarily reset the registered flag, so that our machine state … … 9504 9504 * the right way to handle this. */ 9505 9505 mData->mRegistered = FALSE; 9506 HRESULT rc = checkStateDependency 9507 LogRel (("checkStateDependency 9508 CheckComRCReturnRC 9506 HRESULT rc = checkStateDependency(MutableStateDep); 9507 LogRel (("checkStateDependency(MutableStateDep) returned 0x%x\n", rc)); 9508 CheckComRCReturnRC(rc); 9509 9509 9510 9510 // ComAssertRet (mData->mMachineState < MachineState_Running, E_FAIL); 9511 9511 9512 AssertReturn 9513 AssertReturn 9514 AssertReturn 9515 AssertReturn 9516 9517 com::SafeArray 9518 com::SafeArray 9519 com::SafeArray 9520 com::SafeArray 9512 AssertReturn(!ComSafeArrayInIsNull (aNames), E_POINTER); 9513 AssertReturn(!ComSafeArrayInIsNull (aValues), E_POINTER); 9514 AssertReturn(!ComSafeArrayInIsNull (aTimestamps), E_POINTER); 9515 AssertReturn(!ComSafeArrayInIsNull (aFlags), E_POINTER); 9516 9517 com::SafeArray<IN_BSTR> names (ComSafeArrayInArg (aNames)); 9518 com::SafeArray<IN_BSTR> values (ComSafeArrayInArg (aValues)); 9519 com::SafeArray<ULONG64> timestamps (ComSafeArrayInArg (aTimestamps)); 9520 com::SafeArray<IN_BSTR> flags (ComSafeArrayInArg (aFlags)); 9521 9521 DiscardSettings(); 9522 9522 mHWData.backup(); … … 9544 9544 ULONG64 aTimestamp, IN_BSTR aFlags) 9545 9545 { 9546 LogFlowThisFunc 9546 LogFlowThisFunc(("\n")); 9547 9547 9548 9548 #ifdef VBOX_WITH_GUEST_PROPS … … 9560 9560 9561 9561 uint32_t fFlags = NILFLAG; 9562 if ((aFlags != NULL) && RT_FAILURE 9562 if ((aFlags != NULL) && RT_FAILURE(validateFlags (utf8Flags.raw(), &fFlags))) 9563 9563 return E_INVALIDARG; 9564 9564 … … 9567 9567 matchAll = true; 9568 9568 9569 AutoCaller autoCaller 9570 CheckComRCReturnRC 9571 9572 AutoWriteLock alock 9573 9574 HRESULT rc = checkStateDependency 9575 CheckComRCReturnRC 9569 AutoCaller autoCaller(this); 9570 CheckComRCReturnRC(autoCaller.rc()); 9571 9572 AutoWriteLock alock(this); 9573 9574 HRESULT rc = checkStateDependency(MutableStateDep); 9575 CheckComRCReturnRC(rc); 9576 9576 9577 9577 mHWData.backup(); … … 9633 9633 * will deadlock. */ 9634 9634 { 9635 AutoCaller autoCaller 9635 AutoCaller autoCaller(this); 9636 9636 if (!autoCaller.isOk()) 9637 9637 { 9638 9638 /* return true if not ready, to cause the client watcher to exclude 9639 9639 * the corresponding session from watching */ 9640 LogFlowThisFunc 9640 LogFlowThisFunc(("Already uninitialized!")); 9641 9641 return true; 9642 9642 } 9643 9643 9644 AutoWriteLock alock 9644 AutoWriteLock alock(this); 9645 9645 9646 9646 /* Determine the reason of death: if the session state is Closing here, … … 9701 9701 HRESULT SessionMachine::onDVDDriveChange() 9702 9702 { 9703 LogFlowThisFunc 9704 9705 AutoCaller autoCaller 9703 LogFlowThisFunc(("\n")); 9704 9705 AutoCaller autoCaller(this); 9706 9706 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9707 9707 9708 ComPtr 9709 { 9710 AutoReadLock alock 9708 ComPtr<IInternalSessionControl> directControl; 9709 { 9710 AutoReadLock alock(this); 9711 9711 directControl = mData->mSession.mDirectControl; 9712 9712 } … … 9724 9724 HRESULT SessionMachine::onFloppyDriveChange() 9725 9725 { 9726 LogFlowThisFunc 9727 9728 AutoCaller autoCaller 9726 LogFlowThisFunc(("\n")); 9727 9728 AutoCaller autoCaller(this); 9729 9729 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9730 9730 9731 ComPtr 9732 { 9733 AutoReadLock alock 9731 ComPtr<IInternalSessionControl> directControl; 9732 { 9733 AutoReadLock alock(this); 9734 9734 directControl = mData->mSession.mDirectControl; 9735 9735 } … … 9747 9747 HRESULT SessionMachine::onNetworkAdapterChange (INetworkAdapter *networkAdapter) 9748 9748 { 9749 LogFlowThisFunc 9750 9751 AutoCaller autoCaller 9749 LogFlowThisFunc(("\n")); 9750 9751 AutoCaller autoCaller(this); 9752 9752 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9753 9753 9754 ComPtr 9755 { 9756 AutoReadLock alock 9754 ComPtr<IInternalSessionControl> directControl; 9755 { 9756 AutoReadLock alock(this); 9757 9757 directControl = mData->mSession.mDirectControl; 9758 9758 } … … 9770 9770 HRESULT SessionMachine::onSerialPortChange (ISerialPort *serialPort) 9771 9771 { 9772 LogFlowThisFunc 9773 9774 AutoCaller autoCaller 9772 LogFlowThisFunc(("\n")); 9773 9774 AutoCaller autoCaller(this); 9775 9775 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9776 9776 9777 ComPtr 9778 { 9779 AutoReadLock alock 9777 ComPtr<IInternalSessionControl> directControl; 9778 { 9779 AutoReadLock alock(this); 9780 9780 directControl = mData->mSession.mDirectControl; 9781 9781 } … … 9793 9793 HRESULT SessionMachine::onParallelPortChange (IParallelPort *parallelPort) 9794 9794 { 9795 LogFlowThisFunc 9796 9797 AutoCaller autoCaller 9795 LogFlowThisFunc(("\n")); 9796 9797 AutoCaller autoCaller(this); 9798 9798 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9799 9799 9800 ComPtr 9801 { 9802 AutoReadLock alock 9800 ComPtr<IInternalSessionControl> directControl; 9801 { 9802 AutoReadLock alock(this); 9803 9803 directControl = mData->mSession.mDirectControl; 9804 9804 } … … 9816 9816 HRESULT SessionMachine::onStorageControllerChange () 9817 9817 { 9818 LogFlowThisFunc 9819 9820 AutoCaller autoCaller 9818 LogFlowThisFunc(("\n")); 9819 9820 AutoCaller autoCaller(this); 9821 9821 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9822 9822 9823 ComPtr 9824 { 9825 AutoReadLock alock 9823 ComPtr<IInternalSessionControl> directControl; 9824 { 9825 AutoReadLock alock(this); 9826 9826 directControl = mData->mSession.mDirectControl; 9827 9827 } … … 9839 9839 HRESULT SessionMachine::onVRDPServerChange() 9840 9840 { 9841 LogFlowThisFunc 9842 9843 AutoCaller autoCaller 9841 LogFlowThisFunc(("\n")); 9842 9843 AutoCaller autoCaller(this); 9844 9844 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9845 9845 9846 ComPtr 9847 { 9848 AutoReadLock alock 9846 ComPtr<IInternalSessionControl> directControl; 9847 { 9848 AutoReadLock alock(this); 9849 9849 directControl = mData->mSession.mDirectControl; 9850 9850 } … … 9862 9862 HRESULT SessionMachine::onUSBControllerChange() 9863 9863 { 9864 LogFlowThisFunc 9865 9866 AutoCaller autoCaller 9864 LogFlowThisFunc(("\n")); 9865 9866 AutoCaller autoCaller(this); 9867 9867 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 9868 9868 9869 ComPtr 9870 { 9871 AutoReadLock alock 9869 ComPtr<IInternalSessionControl> directControl; 9870 { 9871 AutoReadLock alock(this); 9872 9872 directControl = mData->mSession.mDirectControl; 9873 9873 } … … 9885 9885 HRESULT SessionMachine::onSharedFolderChange() 9886 9886 { 9887 LogFlowThisFunc 9888 9889 AutoCaller autoCaller 9890 AssertComRCReturnRC 9891 9892 ComPtr 9893 { 9894 AutoReadLock alock 9887 LogFlowThisFunc(("\n")); 9888 9889 AutoCaller autoCaller(this); 9890 AssertComRCReturnRC(autoCaller.rc()); 9891 9892 ComPtr<IInternalSessionControl> directControl; 9893 { 9894 AutoReadLock alock(this); 9895 9895 directControl = mData->mSession.mDirectControl; 9896 9896 } … … 9909 9909 * @note Locks this object for reading. 9910 9910 */ 9911 bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr 9912 { 9913 AutoCaller autoCaller 9911 bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs) 9912 { 9913 AutoCaller autoCaller(this); 9914 9914 /* silently return if not ready -- this method may be called after the 9915 9915 * direct machine session has been called */ … … 9917 9917 return false; 9918 9918 9919 AutoReadLock alock 9919 AutoReadLock alock(this); 9920 9920 9921 9921 #ifdef VBOX_WITH_USB … … 9943 9943 ULONG aMaskedIfs) 9944 9944 { 9945 LogFlowThisFunc 9946 9947 AutoCaller autoCaller 9945 LogFlowThisFunc(("\n")); 9946 9947 AutoCaller autoCaller(this); 9948 9948 9949 9949 /* This notification may happen after the machine object has been 9950 9950 * uninitialized (the session was closed), so don't assert. */ 9951 CheckComRCReturnRC 9952 9953 ComPtr 9954 { 9955 AutoReadLock alock 9951 CheckComRCReturnRC(autoCaller.rc()); 9952 9953 ComPtr<IInternalSessionControl> directControl; 9954 { 9955 AutoReadLock alock(this); 9956 9956 directControl = mData->mSession.mDirectControl; 9957 9957 } … … 9975 9975 IVirtualBoxErrorInfo *aError) 9976 9976 { 9977 LogFlowThisFunc 9978 9979 AutoCaller autoCaller 9977 LogFlowThisFunc(("\n")); 9978 9979 AutoCaller autoCaller(this); 9980 9980 9981 9981 /* This notification may happen after the machine object has been 9982 9982 * uninitialized (the session was closed), so don't assert. */ 9983 CheckComRCReturnRC 9984 9985 ComPtr 9986 { 9987 AutoReadLock alock 9983 CheckComRCReturnRC(autoCaller.rc()); 9984 9985 ComPtr<IInternalSessionControl> directControl; 9986 { 9987 AutoReadLock alock(this); 9988 9988 directControl = mData->mSession.mDirectControl; 9989 9989 } … … 10017 10017 LogFlowThisFuncEnter(); 10018 10018 10019 AutoCaller autoCaller 10019 AutoCaller autoCaller(this); 10020 10020 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 10021 10021 … … 10065 10065 LogFlowThisFuncEnter(); 10066 10066 10067 AutoCaller autoCaller 10067 AutoCaller autoCaller(this); 10068 10068 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 10069 10069 10070 AutoWriteLock alock 10071 10072 AssertReturn 10070 AutoWriteLock alock(this); 10071 10072 AssertReturn(!mSnapshotData.mSnapshot.isNull(), E_FAIL); 10073 10073 10074 10074 MultiResult rc (S_OK); … … 10097 10097 } 10098 10098 10099 if (aSuccess && SUCCEEDED 10099 if (aSuccess && SUCCEEDED(rc)) 10100 10100 { 10101 10101 bool online = Global::IsOnline (mSnapshotData.mLastState); … … 10156 10156 LogFlowThisFuncEnter(); 10157 10157 10158 AutoCaller autoCaller 10159 10160 LogFlowThisFunc 10158 AutoCaller autoCaller(this); 10159 10160 LogFlowThisFunc(("state=%d\n", autoCaller.state())); 10161 10161 if (!autoCaller.isOk()) 10162 10162 { … … 10167 10167 } 10168 10168 10169 AutoWriteLock alock 10169 AutoWriteLock alock(this); 10170 10170 10171 10171 HRESULT rc = S_OK; … … 10173 10173 bool online = Global::IsOnline (mSnapshotData.mLastState); 10174 10174 10175 LogFlowThisFunc 10175 LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n", 10176 10176 online)); 10177 10177 … … 10183 10183 online); 10184 10184 10185 if (SUCCEEDED 10185 if (SUCCEEDED(rc) && mSnapshotData.mLastState == MachineState_Saved) 10186 10186 { 10187 10187 Utf8Str stateFrom = mSSData->mStateFilePath; 10188 10188 Utf8Str stateTo = mSnapshotData.mSnapshot->stateFilePath(); 10189 10189 10190 LogFlowThisFunc 10190 LogFlowThisFunc(("Copying the execution state from '%s' to '%s'...\n", 10191 10191 stateFrom.raw(), stateTo.raw())); 10192 10192 … … 10205 10205 alock.enter(); 10206 10206 10207 if (RT_FAILURE 10207 if (RT_FAILURE(vrc)) 10208 10208 rc = setError (E_FAIL, 10209 10209 tr ("Could not copy the state file '%s' to '%s' (%Rrc)"), … … 10216 10216 if (!online) 10217 10217 { 10218 LogFlowThisFunc 10218 LogFlowThisFunc(("Finalizing the taken snapshot (rc=%Rhrc)...\n", rc)); 10219 10219 10220 10220 { … … 10228 10228 mSnapshotData.mServerProgress->notifyComplete (rc); 10229 10229 10230 endTakingSnapshot (SUCCEEDED 10230 endTakingSnapshot (SUCCEEDED(rc)); 10231 10231 } 10232 10232 else … … 10282 10282 LogFlowThisFuncEnter(); 10283 10283 10284 AutoCaller autoCaller 10285 10286 LogFlowThisFunc 10284 AutoCaller autoCaller(this); 10285 10286 LogFlowThisFunc(("state=%d\n", autoCaller.state())); 10287 10287 if (!autoCaller.isOk()) 10288 10288 { … … 10317 10317 { 10318 10318 /* first pass: */ 10319 LogFlowThisFunc 10319 LogFlowThisFunc(("1: Checking hard disk merge prerequisites...\n")); 10320 10320 10321 10321 for (HDData::AttachmentList::const_iterator it = sm->mHDData->mAttachments.begin(); … … 10396 10396 { 10397 10397 /* in snapshot */ 10398 ComObjPtr 10398 ComObjPtr<Snapshot> snapshot; 10399 10399 rc2 = findSnapshot (snapshotId, snapshot); 10400 10400 AssertComRC (rc2); … … 10427 10427 10428 10428 /* second pass: */ 10429 LogFlowThisFunc 10429 LogFlowThisFunc(("2: Discarding snapshot...\n")); 10430 10430 10431 10431 { … … 10469 10469 10470 10470 /* third pass: */ 10471 LogFlowThisFunc 10471 LogFlowThisFunc(("3: Performing actual hard disk merging...\n")); 10472 10472 10473 10473 /* leave the locks before the potentially lengthy operation */ … … 10548 10548 } 10549 10549 10550 if (SUCCEEDED 10550 if (SUCCEEDED(rc)) 10551 10551 mParent->onSnapshotDiscarded (mData->mUuid, snapshotId); 10552 10552 10553 LogFlowThisFunc 10553 LogFlowThisFunc(("Done discarding snapshot (rc=%08X)\n", rc)); 10554 10554 LogFlowThisFuncLeave(); 10555 10555 } … … 10565 10565 LogFlowThisFuncEnter(); 10566 10566 10567 AutoCaller autoCaller 10568 10569 LogFlowThisFunc 10567 AutoCaller autoCaller(this); 10568 10569 LogFlowThisFunc(("state=%d\n", autoCaller.state())); 10570 10570 if (!autoCaller.isOk()) 10571 10571 { … … 10588 10588 vboxLock.unlock(); 10589 10589 10590 AutoWriteLock alock 10590 AutoWriteLock alock(this); 10591 10591 10592 10592 /* discard all current changes to mUserData (name, OSType etc.) (note that … … 10644 10644 10645 10645 { 10646 ComObjPtr 10646 ComObjPtr<Snapshot> curSnapshot = mData->mCurrentSnapshot; 10647 10647 AutoReadLock snapshotLock (curSnapshot); 10648 10648 … … 10655 10655 copyFrom(pSnapshotMachine); 10656 10656 10657 LogFlowThisFunc 10657 LogFlowThisFunc(("Restoring hard disks from the snapshot...\n")); 10658 10658 10659 10659 /* restore the attachmends from the snapshot */ … … 10691 10691 RTPATH_DELIMITER, mData->mUuid.raw()); 10692 10692 10693 LogFlowThisFunc 10693 LogFlowThisFunc(("Copying saved state file from '%s' to '%s'...\n", 10694 10694 snapStateFilePath.raw(), stateFilePath.raw())); 10695 10695 … … 10708 10708 snapshotLock.lock(); 10709 10709 10710 if (RT_SUCCESS 10710 if (RT_SUCCESS(vrc)) 10711 10711 { 10712 10712 mSSData->mStateFilePath = stateFilePath; … … 10756 10756 /// warning through the Progress object 10757 10757 HRESULT rc2 = (*it)->deleteStorageAndWait(); 10758 if (SUCCEEDED 10758 if (SUCCEEDED(rc2)) 10759 10759 (*it)->uninit(); 10760 10760 } … … 10823 10823 rc = rc2; 10824 10824 10825 if (SUCCEEDED 10825 if (SUCCEEDED(rc)) 10826 10826 { 10827 10827 /* now, delete the unused diffs (only on success!) and uninit them*/ … … 10833 10833 /// report a warning through the Progress object 10834 10834 HRESULT rc2 = (*it)->deleteStorageAndWait(); 10835 if (SUCCEEDED 10835 if (SUCCEEDED(rc2)) 10836 10836 (*it)->uninit(); 10837 10837 } … … 10865 10865 } 10866 10866 10867 if (SUCCEEDED 10867 if (SUCCEEDED(rc)) 10868 10868 mParent->onSnapshotDiscarded (mData->mUuid, Guid()); 10869 10869 10870 LogFlowThisFunc 10870 LogFlowThisFunc(("Done discarding current state (rc=%08X)\n", rc)); 10871 10871 10872 10872 LogFlowThisFuncLeave(); … … 10895 10895 HRESULT SessionMachine::lockMedia() 10896 10896 { 10897 AutoCaller autoCaller 10897 AutoCaller autoCaller(this); 10898 10898 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 10899 10899 10900 AutoWriteLock alock 10901 10902 AssertReturn 10900 AutoWriteLock alock(this); 10901 10902 AssertReturn(mData->mMachineState == MachineState_Starting || 10903 10903 mData->mMachineState == MachineState_Restoring, E_FAIL); 10904 10904 10905 typedef std::list <ComPtr 10905 typedef std::list <ComPtr<IMedium> > MediaList; 10906 10906 MediaList mediaToCheck; 10907 10907 MediaState_T mediaState; … … 10931 10931 mData->mSession.mLockedMedia.push_back ( 10932 10932 Data::Session::LockedMedia::value_type ( 10933 ComPtr 10933 ComPtr<IHardDisk> (hd), true)); 10934 10934 10935 10935 first = false; … … 10942 10942 mData->mSession.mLockedMedia.push_back ( 10943 10943 Data::Session::LockedMedia::value_type ( 10944 ComPtr 10944 ComPtr<IHardDisk> (hd), false)); 10945 10945 } 10946 10946 10947 10947 if (mediaState == MediaState_Inaccessible) 10948 mediaToCheck.push_back (ComPtr 10948 mediaToCheck.push_back (ComPtr<IHardDisk> (hd)); 10949 10949 10950 10950 /* no locks or callers here since there should be no way to … … 10960 10960 if (mDVDDrive->data()->state == DriveState_ImageMounted) 10961 10961 { 10962 ComObjPtr 10962 ComObjPtr<DVDImage> image = mDVDDrive->data()->image; 10963 10963 10964 10964 rc = image->LockRead (&mediaState); … … 10967 10967 mData->mSession.mLockedMedia.push_back ( 10968 10968 Data::Session::LockedMedia::value_type ( 10969 ComPtr 10969 ComPtr<IDVDImage> (image), false)); 10970 10970 10971 10971 if (mediaState == MediaState_Inaccessible) 10972 mediaToCheck.push_back (ComPtr 10972 mediaToCheck.push_back (ComPtr<IDVDImage> (image)); 10973 10973 } 10974 10974 } … … 10979 10979 if (mFloppyDrive->data()->state == DriveState_ImageMounted) 10980 10980 { 10981 ComObjPtr 10981 ComObjPtr<FloppyImage> image = mFloppyDrive->data()->image; 10982 10982 10983 10983 rc = image->LockRead (&mediaState); … … 10986 10986 mData->mSession.mLockedMedia.push_back ( 10987 10987 Data::Session::LockedMedia::value_type ( 10988 ComPtr 10988 ComPtr<IFloppyImage> (image), false)); 10989 10989 10990 10990 if (mediaState == MediaState_Inaccessible) 10991 mediaToCheck.push_back (ComPtr 10991 mediaToCheck.push_back (ComPtr<IFloppyImage> (image)); 10992 10992 } 10993 10993 } … … 11054 11054 void SessionMachine::unlockMedia() 11055 11055 { 11056 AutoCaller autoCaller 11056 AutoCaller autoCaller(this); 11057 11057 AssertComRCReturnVoid (autoCaller.rc()); 11058 11058 11059 AutoWriteLock alock 11059 AutoWriteLock alock(this); 11060 11060 11061 11061 /* we may be holding important error info on the current thread; … … 11078 11078 * Machine::fixupHardDisks(). The last can happen when e.g a DVD/Floppy 11079 11079 * image was unmounted at runtime. */ 11080 Assert (SUCCEEDED 11080 Assert (SUCCEEDED(rc) || state == MediaState_LockedRead || state == MediaState_Created); 11081 11081 } 11082 11082 … … 11092 11092 { 11093 11093 LogFlowThisFuncEnter(); 11094 LogFlowThisFunc 11095 11096 AutoCaller autoCaller 11094 LogFlowThisFunc(("aMachineState=%d\n", aMachineState)); 11095 11096 AutoCaller autoCaller(this); 11097 11097 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 11098 11098 11099 AutoWriteLock alock 11099 AutoWriteLock alock(this); 11100 11100 11101 11101 MachineState_T oldMachineState = mData->mMachineState; … … 11238 11238 } 11239 11239 11240 LogFlowThisFunc 11240 LogFlowThisFunc(("rc=%08X\n", rc)); 11241 11241 LogFlowThisFuncLeave(); 11242 11242 return rc; … … 11250 11250 HRESULT SessionMachine::updateMachineStateOnClient() 11251 11251 { 11252 AutoCaller autoCaller 11252 AutoCaller autoCaller(this); 11253 11253 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 11254 11254 11255 ComPtr 11256 { 11257 AutoReadLock alock 11258 AssertReturn 11255 ComPtr<IInternalSessionControl> directControl; 11256 { 11257 AutoReadLock alock(this); 11258 AssertReturn(!!mData, E_FAIL); 11259 11259 directControl = mData->mSession.mDirectControl; 11260 11260 … … 11271 11271 return S_OK; 11272 11272 11273 AssertReturn 11273 AssertReturn(!directControl.isNull(), E_FAIL); 11274 11274 } 11275 11275 … … 11280 11280 DECLCALLBACK(int) SessionMachine::taskHandler (RTTHREAD /* thread */, void *pvUser) 11281 11281 { 11282 AssertReturn 11282 AssertReturn(pvUser, VERR_INVALID_POINTER); 11283 11283 11284 11284 Task *task = static_cast <Task *> (pvUser); … … 11299 11299 HRESULT SnapshotMachine::FinalConstruct() 11300 11300 { 11301 LogFlowThisFunc 11301 LogFlowThisFunc(("\n")); 11302 11302 11303 11303 /* set the proper type to indicate we're the SnapshotMachine instance */ 11304 unconst 11304 unconst(mType) = IsSnapshotMachine; 11305 11305 11306 11306 return S_OK; … … 11309 11309 void SnapshotMachine::FinalRelease() 11310 11310 { 11311 LogFlowThisFunc 11311 LogFlowThisFunc(("\n")); 11312 11312 11313 11313 uninit(); … … 11329 11329 { 11330 11330 LogFlowThisFuncEnter(); 11331 LogFlowThisFunc 11332 11333 AssertReturn 11331 LogFlowThisFunc(("mName={%ls}\n", aSessionMachine->mUserData->mName.raw())); 11332 11333 AssertReturn(aSessionMachine && !Guid (aSnapshotId).isEmpty(), E_INVALIDARG); 11334 11334 11335 11335 /* Enclose the state transition NotReady->InInit->Ready */ 11336 AutoInitSpan autoInitSpan 11337 AssertReturn 11338 11339 AssertReturn 11336 AutoInitSpan autoInitSpan(this); 11337 AssertReturn(autoInitSpan.isOk(), E_FAIL); 11338 11339 AssertReturn(aSessionMachine->isWriteLockOnCurrentThread(), E_FAIL); 11340 11340 11341 11341 mSnapshotId = aSnapshotId; 11342 11342 11343 11343 /* memorize the primary Machine instance (i.e. not SessionMachine!) */ 11344 unconst 11344 unconst(mPeer) = aSessionMachine->mPeer; 11345 11345 /* share the parent pointer */ 11346 unconst 11346 unconst(mParent) = mPeer->mParent; 11347 11347 11348 11348 /* take the pointer to Data to share */ … … 11369 11369 ++ it) 11370 11370 { 11371 ComObjPtr 11371 ComObjPtr<SharedFolder> folder; 11372 11372 folder.createObject(); 11373 11373 rc = folder->initCopy (this, *it); 11374 CheckComRCReturnRC 11374 CheckComRCReturnRC(rc); 11375 11375 *it = folder; 11376 11376 } … … 11395 11395 ++ it) 11396 11396 { 11397 ComObjPtr 11397 ComObjPtr<StorageController> ctrl; 11398 11398 ctrl.createObject(); 11399 11399 ctrl->initCopy (this, *it); … … 11403 11403 /* create all other child objects that will be immutable private copies */ 11404 11404 11405 unconst 11405 unconst(mBIOSSettings).createObject(); 11406 11406 mBIOSSettings->initCopy (this, mPeer->mBIOSSettings); 11407 11407 11408 11408 #ifdef VBOX_WITH_VRDP 11409 unconst 11409 unconst(mVRDPServer).createObject(); 11410 11410 mVRDPServer->initCopy (this, mPeer->mVRDPServer); 11411 11411 #endif 11412 11412 11413 unconst 11413 unconst(mDVDDrive).createObject(); 11414 11414 mDVDDrive->initCopy (this, mPeer->mDVDDrive); 11415 11415 11416 unconst 11416 unconst(mFloppyDrive).createObject(); 11417 11417 mFloppyDrive->initCopy (this, mPeer->mFloppyDrive); 11418 11418 11419 unconst 11419 unconst(mAudioAdapter).createObject(); 11420 11420 mAudioAdapter->initCopy (this, mPeer->mAudioAdapter); 11421 11421 11422 unconst 11422 unconst(mUSBController).createObject(); 11423 11423 mUSBController->initCopy (this, mPeer->mUSBController); 11424 11424 11425 11425 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 11426 11426 { 11427 unconst 11427 unconst(mNetworkAdapters [slot]).createObject(); 11428 11428 mNetworkAdapters [slot]->initCopy (this, mPeer->mNetworkAdapters [slot]); 11429 11429 } … … 11431 11431 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 11432 11432 { 11433 unconst 11433 unconst(mSerialPorts [slot]).createObject(); 11434 11434 mSerialPorts [slot]->initCopy (this, mPeer->mSerialPorts [slot]); 11435 11435 } … … 11437 11437 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 11438 11438 { 11439 unconst 11439 unconst(mParallelPorts [slot]).createObject(); 11440 11440 mParallelPorts [slot]->initCopy (this, mPeer->mParallelPorts [slot]); 11441 11441 } … … 11466 11466 { 11467 11467 LogFlowThisFuncEnter(); 11468 LogFlowThisFunc 11469 11470 AssertReturn 11468 LogFlowThisFunc(("mName={%ls}\n", aMachine->mUserData->mName.raw())); 11469 11470 AssertReturn(aMachine && !aHWNode.isNull() && !aHDAsNode.isNull() && 11471 11471 !Guid (aSnapshotId).isEmpty(), 11472 11472 E_INVALIDARG); 11473 11473 11474 11474 /* Enclose the state transition NotReady->InInit->Ready */ 11475 AutoInitSpan autoInitSpan 11476 AssertReturn 11475 AutoInitSpan autoInitSpan(this); 11476 AssertReturn(autoInitSpan.isOk(), E_FAIL); 11477 11477 11478 11478 /* Don't need to lock aMachine when VirtualBox is starting up */ … … 11481 11481 11482 11482 /* memorize the primary Machine instance */ 11483 unconst 11483 unconst(mPeer) = aMachine; 11484 11484 /* share the parent pointer */ 11485 unconst 11485 unconst(mParent) = mPeer->mParent; 11486 11486 11487 11487 /* take the pointer to Data to share */ … … 11503 11503 /* create all other child objects that will be immutable private copies */ 11504 11504 11505 unconst 11505 unconst(mBIOSSettings).createObject(); 11506 11506 mBIOSSettings->init (this); 11507 11507 11508 11508 #ifdef VBOX_WITH_VRDP 11509 unconst 11509 unconst(mVRDPServer).createObject(); 11510 11510 mVRDPServer->init (this); 11511 11511 #endif 11512 11512 11513 unconst 11513 unconst(mDVDDrive).createObject(); 11514 11514 mDVDDrive->init (this); 11515 11515 11516 unconst 11516 unconst(mFloppyDrive).createObject(); 11517 11517 mFloppyDrive->init (this); 11518 11518 11519 unconst 11519 unconst(mAudioAdapter).createObject(); 11520 11520 mAudioAdapter->init (this); 11521 11521 11522 unconst 11522 unconst(mUSBController).createObject(); 11523 11523 mUSBController->init (this); 11524 11524 11525 11525 for (ULONG slot = 0; slot < RT_ELEMENTS (mNetworkAdapters); slot ++) 11526 11526 { 11527 unconst 11527 unconst(mNetworkAdapters [slot]).createObject(); 11528 11528 mNetworkAdapters [slot]->init (this, slot); 11529 11529 } … … 11531 11531 for (ULONG slot = 0; slot < RT_ELEMENTS (mSerialPorts); slot ++) 11532 11532 { 11533 unconst 11533 unconst(mSerialPorts [slot]).createObject(); 11534 11534 mSerialPorts [slot]->init (this, slot); 11535 11535 } … … 11537 11537 for (ULONG slot = 0; slot < RT_ELEMENTS (mParallelPorts); slot ++) 11538 11538 { 11539 unconst 11539 unconst(mParallelPorts [slot]).createObject(); 11540 11540 mParallelPorts [slot]->init (this, slot); 11541 11541 } … … 11544 11544 11545 11545 HRESULT rc = loadHardware (aHWNode); 11546 if (SUCCEEDED 11546 if (SUCCEEDED(rc)) 11547 11547 rc = loadStorageControllers (aHDAsNode, true /* aRegistered */, &mSnapshotId); 11548 11548 11549 if (SUCCEEDED 11549 if (SUCCEEDED(rc)) 11550 11550 { 11551 11551 /* commit all changes made during the initialization */ … … 11554 11554 11555 11555 /* Confirm a successful initialization when it's the case */ 11556 if (SUCCEEDED 11556 if (SUCCEEDED(rc)) 11557 11557 autoInitSpan.setSucceeded(); 11558 11558 … … 11569 11569 11570 11570 /* Enclose the state transition Ready->InUninit->NotReady */ 11571 AutoUninitSpan autoUninitSpan 11571 AutoUninitSpan autoUninitSpan(this); 11572 11572 if (autoUninitSpan.uninitDone()) 11573 11573 return; … … 11578 11578 mData.free(); 11579 11579 11580 unconst 11581 unconst 11580 unconst(mParent).setNull(); 11581 unconst(mPeer).setNull(); 11582 11582 11583 11583 LogFlowThisFuncLeave(); … … 11593 11593 RWLockHandle *SnapshotMachine::lockHandle() const 11594 11594 { 11595 AssertReturn 11595 AssertReturn(!mPeer.isNull(), NULL); 11596 11596 return mPeer->lockHandle(); 11597 11597 } … … 11608 11608 HRESULT SnapshotMachine::onSnapshotChange (Snapshot *aSnapshot) 11609 11609 { 11610 AutoWriteLock alock 11610 AutoWriteLock alock(this); 11611 11611 11612 11612 mPeer->saveSnapshotSettings (aSnapshot, SaveSS_UpdateAttrsOp); -
trunk/src/VBox/Main/Matching.cpp
r14772 r21878 112 112 vrc = RTStrToUInt64Ex(aFilter + aStart, &endptr, 0, &val.ull); 113 113 114 AssertReturn 114 AssertReturn(endptr, 0); 115 115 116 116 size_t parsed = endptr - aFilter; -
trunk/src/VBox/Main/MediumImpl.cpp
r20977 r21878 54 54 STDMETHODIMP MediumBase::COMGETTER(Id) (BSTR *aId) 55 55 { 56 CheckComArgOutPointerValid 57 58 AutoCaller autoCaller 59 CheckComRCReturnRC 60 61 AutoReadLock alock 62 63 m.id.toUtf16().cloneTo 56 CheckComArgOutPointerValid(aId); 57 58 AutoCaller autoCaller(this); 59 CheckComRCReturnRC(autoCaller.rc()); 60 61 AutoReadLock alock(this); 62 63 m.id.toUtf16().cloneTo(aId); 64 64 65 65 return S_OK; … … 68 68 STDMETHODIMP MediumBase::COMGETTER(Description) (BSTR *aDescription) 69 69 { 70 CheckComArgOutPointerValid 71 72 AutoCaller autoCaller 73 CheckComRCReturnRC 74 75 AutoReadLock alock 70 CheckComArgOutPointerValid(aDescription); 71 72 AutoCaller autoCaller(this); 73 CheckComRCReturnRC(autoCaller.rc()); 74 75 AutoReadLock alock(this); 76 76 77 77 if (m.description.isEmpty()) 78 78 Bstr("").cloneTo(aDescription); 79 79 else 80 m.description.cloneTo 80 m.description.cloneTo(aDescription); 81 81 82 82 return S_OK; … … 87 87 CheckComArgNotNull (aDescription); 88 88 89 AutoCaller autoCaller 90 CheckComRCReturnRC 91 92 AutoWriteLock alock 89 AutoCaller autoCaller(this); 90 CheckComRCReturnRC(autoCaller.rc()); 91 92 AutoWriteLock alock(this); 93 93 94 94 /// @todo update m.description and save the global registry (and local … … 103 103 CheckComArgOutPointerValid(aState); 104 104 105 AutoCaller autoCaller 106 CheckComRCReturnRC 105 AutoCaller autoCaller(this); 106 CheckComRCReturnRC(autoCaller.rc()); 107 107 108 108 /* queryInfo() locks this for writing. */ 109 AutoWriteLock alock 109 AutoWriteLock alock(this); 110 110 111 111 HRESULT rc = S_OK; … … 134 134 CheckComArgOutPointerValid(aLocation); 135 135 136 AutoCaller autoCaller 137 CheckComRCReturnRC 138 139 AutoReadLock alock 140 141 m.locationFull.cloneTo 136 AutoCaller autoCaller(this); 137 CheckComRCReturnRC(autoCaller.rc()); 138 139 AutoReadLock alock(this); 140 141 m.locationFull.cloneTo(aLocation); 142 142 143 143 return S_OK; … … 148 148 CheckComArgNotNull (aLocation); 149 149 150 AutoCaller autoCaller 151 CheckComRCReturnRC 152 153 AutoWriteLock alock 150 AutoCaller autoCaller(this); 151 CheckComRCReturnRC(autoCaller.rc()); 152 153 AutoWriteLock alock(this); 154 154 155 155 /// @todo NEWMEDIA for file names, add the default extension if no extension … … 167 167 STDMETHODIMP MediumBase::COMGETTER(Name) (BSTR *aName) 168 168 { 169 CheckComArgOutPointerValid 170 171 AutoCaller autoCaller 172 CheckComRCReturnRC 173 174 AutoReadLock alock 175 176 name().cloneTo 169 CheckComArgOutPointerValid(aName); 170 171 AutoCaller autoCaller(this); 172 CheckComRCReturnRC(autoCaller.rc()); 173 174 AutoReadLock alock(this); 175 176 name().cloneTo(aName); 177 177 178 178 return S_OK; … … 181 181 STDMETHODIMP MediumBase::COMGETTER(Size) (ULONG64 *aSize) 182 182 { 183 CheckComArgOutPointerValid 184 185 AutoCaller autoCaller 186 CheckComRCReturnRC 187 188 AutoReadLock alock 183 CheckComArgOutPointerValid(aSize); 184 185 AutoCaller autoCaller(this); 186 CheckComRCReturnRC(autoCaller.rc()); 187 188 AutoReadLock alock(this); 189 189 190 190 *aSize = m.size; … … 195 195 STDMETHODIMP MediumBase::COMGETTER(LastAccessError) (BSTR *aLastAccessError) 196 196 { 197 CheckComArgOutPointerValid 198 199 AutoCaller autoCaller 200 CheckComRCReturnRC 201 202 AutoReadLock alock 197 CheckComArgOutPointerValid(aLastAccessError); 198 199 AutoCaller autoCaller(this); 200 CheckComRCReturnRC(autoCaller.rc()); 201 202 AutoReadLock alock(this); 203 203 204 204 if (m.lastAccessError.isEmpty()) 205 205 Bstr("").cloneTo(aLastAccessError); 206 206 else 207 m.lastAccessError.cloneTo 208 209 return S_OK; 210 } 211 212 STDMETHODIMP MediumBase::COMGETTER(MachineIds) (ComSafeArrayOut 207 m.lastAccessError.cloneTo(aLastAccessError); 208 209 return S_OK; 210 } 211 212 STDMETHODIMP MediumBase::COMGETTER(MachineIds) (ComSafeArrayOut(BSTR,aMachineIds)) 213 213 { 214 214 if (ComSafeGUIDArrayOutIsNull (aMachineIds)) 215 215 return E_POINTER; 216 216 217 AutoCaller autoCaller 218 CheckComRCReturnRC 219 220 AutoReadLock alock 217 AutoCaller autoCaller(this); 218 CheckComRCReturnRC(autoCaller.rc()); 219 220 AutoReadLock alock(this); 221 221 222 222 com::SafeArray<BSTR> machineIds; … … 234 234 } 235 235 236 machineIds.detachTo (ComSafeArrayOutArg(aMachineIds));236 machineIds.detachTo(ComSafeArrayOutArg(aMachineIds)); 237 237 238 238 return S_OK; … … 243 243 244 244 STDMETHODIMP MediumBase::GetSnapshotIds (IN_BSTR aMachineId, 245 ComSafeArrayOut 245 ComSafeArrayOut(BSTR, aSnapshotIds)) 246 246 { 247 247 CheckComArgExpr (aMachineId, Guid (aMachineId).isEmpty() == false); 248 CheckComArgOutSafeArrayPointerValid 249 250 AutoCaller autoCaller 251 CheckComRCReturnRC 252 253 AutoReadLock alock 248 CheckComArgOutSafeArrayPointerValid(aSnapshotIds); 249 250 AutoCaller autoCaller(this); 251 CheckComRCReturnRC(autoCaller.rc()); 252 253 AutoReadLock alock(this); 254 254 255 255 com::SafeArray<BSTR> snapshotIds; … … 288 288 } 289 289 290 snapshotIds.detachTo (ComSafeArrayOutArg(aSnapshotIds));290 snapshotIds.detachTo(ComSafeArrayOutArg(aSnapshotIds)); 291 291 292 292 return S_OK; … … 299 299 STDMETHODIMP MediumBase::LockRead (MediaState_T *aState) 300 300 { 301 AutoCaller autoCaller 302 CheckComRCReturnRC 303 304 AutoWriteLock alock 301 AutoCaller autoCaller(this); 302 CheckComRCReturnRC(autoCaller.rc()); 303 304 AutoWriteLock alock(this); 305 305 306 306 /* return the current state before */ … … 346 346 STDMETHODIMP MediumBase::UnlockRead (MediaState_T *aState) 347 347 { 348 AutoCaller autoCaller 349 CheckComRCReturnRC 350 351 AutoWriteLock alock 348 AutoCaller autoCaller(this); 349 CheckComRCReturnRC(autoCaller.rc()); 350 351 AutoWriteLock alock(this); 352 352 353 353 HRESULT rc = S_OK; … … 398 398 STDMETHODIMP MediumBase::LockWrite (MediaState_T *aState) 399 399 { 400 AutoCaller autoCaller 401 CheckComRCReturnRC 402 403 AutoWriteLock alock 400 AutoCaller autoCaller(this); 401 CheckComRCReturnRC(autoCaller.rc()); 402 403 AutoWriteLock alock(this); 404 404 405 405 /* return the current state before */ … … 438 438 STDMETHODIMP MediumBase::UnlockWrite (MediaState_T *aState) 439 439 { 440 AutoCaller autoCaller 441 CheckComRCReturnRC 442 443 AutoWriteLock alock 440 AutoCaller autoCaller(this); 441 CheckComRCReturnRC(autoCaller.rc()); 442 443 AutoWriteLock alock(this); 444 444 445 445 HRESULT rc = S_OK; … … 474 474 { 475 475 AutoMayUninitSpan mayUninitSpan (this); 476 CheckComRCReturnRC 476 CheckComRCReturnRC(mayUninitSpan.rc()); 477 477 478 478 if (mayUninitSpan.alreadyInProgress()) … … 509 509 /* perform extra media-dependent close checks */ 510 510 HRESULT rc = canClose(); 511 CheckComRCReturnRC 511 CheckComRCReturnRC(rc); 512 512 513 513 if (wasCreated) … … 517 517 * failure to do so) */ 518 518 rc = unregisterWithVirtualBox(); 519 CheckComRCReturnRC 519 CheckComRCReturnRC(rc); 520 520 } 521 521 … … 540 540 HRESULT MediumBase::updatePath (const char *aOldPath, const char *aNewPath) 541 541 { 542 AssertReturn 543 AssertReturn 544 545 AutoCaller autoCaller 546 CheckComRCReturnRC 547 548 AutoWriteLock alock 549 550 LogFlowThisFunc 542 AssertReturn(aOldPath, E_FAIL); 543 AssertReturn(aNewPath, E_FAIL); 544 545 AutoCaller autoCaller(this); 546 CheckComRCReturnRC(autoCaller.rc()); 547 548 AutoWriteLock alock(this); 549 550 LogFlowThisFunc(("locationFull.before='%s'\n", m.locationFull.raw())); 551 551 552 552 Utf8Str path = m.locationFull; … … 560 560 mVirtualBox->calculateRelativePath (path, path); 561 561 562 unconst 563 unconst 564 565 LogFlowThisFunc 562 unconst(m.locationFull) = newPath; 563 unconst(m.location) = path; 564 565 LogFlowThisFunc(("locationFull.after='%s'\n", m.locationFull.raw())); 566 566 } 567 567 … … 579 579 const Guid &aSnapshotId /*= Guid::Empty*/) 580 580 { 581 AssertReturn 582 583 AutoCaller autoCaller 584 AssertComRCReturnRC 585 586 AutoWriteLock alock 581 AssertReturn(!aMachineId.isEmpty(), E_FAIL); 582 583 AutoCaller autoCaller(this); 584 AssertComRCReturnRC(autoCaller.rc()); 585 586 AutoWriteLock alock(this); 587 587 588 588 switch (m.state) … … 599 599 600 600 HRESULT rc = canAttach (aMachineId, aSnapshotId); 601 CheckComRCReturnRC 601 CheckComRCReturnRC(rc); 602 602 603 603 BackRefList::iterator it = … … 615 615 { 616 616 /* sanity: no duplicate attachments */ 617 AssertReturn 617 AssertReturn(!it->inCurState, E_FAIL); 618 618 it->inCurState = true; 619 619 … … 624 624 BackRef::GuidList::const_iterator jt = 625 625 std::find (it->snapshotIds.begin(), it->snapshotIds.end(), aSnapshotId); 626 AssertReturn 626 AssertReturn(jt == it->snapshotIds.end(), E_FAIL); 627 627 628 628 it->snapshotIds.push_back (aSnapshotId); … … 642 642 const Guid &aSnapshotId /*= Guid::Empty*/) 643 643 { 644 AssertReturn 645 646 AutoCaller autoCaller 647 AssertComRCReturnRC 648 649 AutoWriteLock alock 644 AssertReturn(!aMachineId.isEmpty(), E_FAIL); 645 646 AutoCaller autoCaller(this); 647 AssertComRCReturnRC(autoCaller.rc()); 648 649 AutoWriteLock alock(this); 650 650 651 651 BackRefList::iterator it = 652 652 std::find_if (m.backRefs.begin(), m.backRefs.end(), 653 653 BackRef::EqualsTo (aMachineId)); 654 AssertReturn 654 AssertReturn(it != m.backRefs.end(), E_FAIL); 655 655 656 656 if (aSnapshotId.isEmpty()) … … 665 665 std::find (it->snapshotIds.begin(), it->snapshotIds.end(), aSnapshotId); 666 666 667 AssertReturn 667 AssertReturn(jt != it->snapshotIds.end(), E_FAIL); 668 668 it->snapshotIds.erase (jt); 669 669 } … … 705 705 Utf8Str locationFull; 706 706 int vrc = mVirtualBox->calculateFullPath (Utf8Str (aLocation), locationFull); 707 if (RT_FAILURE 707 if (RT_FAILURE(vrc)) 708 708 return setError (E_FAIL, 709 709 tr ("Invalid image file location '%ls' (%Rrc)"), … … 729 729 HRESULT MediumBase::queryInfo() 730 730 { 731 AutoWriteLock alock 732 733 AssertReturn 731 AutoWriteLock alock(this); 732 733 AssertReturn(m.state == MediaState_Created || 734 734 m.state == MediaState_Inaccessible || 735 735 m.state == MediaState_LockedRead || … … 791 791 RTFILE file; 792 792 vrc = RTFileOpen (&file, Utf8Str (m.locationFull), RTFILE_O_READ); 793 if (RT_SUCCESS 793 if (RT_SUCCESS(vrc)) 794 794 { 795 795 vrc = RTFileGetSize (file, &m.size); … … 798 798 } 799 799 800 if (RT_FAILURE 800 if (RT_FAILURE(vrc)) 801 801 { 802 802 m.lastAccessError = Utf8StrFmt ( … … 805 805 } 806 806 807 success = (RT_SUCCESS 807 success = (RT_SUCCESS(vrc)); 808 808 } 809 809 … … 940 940 const Guid &aId) 941 941 { 942 LogFlowThisFunc 943 944 AssertReturn 945 AssertReturn 946 AssertReturn 942 LogFlowThisFunc(("aLocation='%ls', aId={%RTuuid}\n", aLocation, aId.raw())); 943 944 AssertReturn(aVirtualBox, E_INVALIDARG); 945 AssertReturn(aLocation, E_INVALIDARG); 946 AssertReturn(!aId.isEmpty(), E_INVALIDARG); 947 947 948 948 /* Enclose the state transition NotReady->InInit->Ready */ 949 AutoInitSpan autoInitSpan 950 AssertReturn 949 AutoInitSpan autoInitSpan(this); 950 AssertReturn(autoInitSpan.isOk(), E_FAIL); 951 951 952 952 HRESULT rc = S_OK; 953 953 954 954 /* share parent weakly */ 955 unconst 955 unconst(mVirtualBox) = aVirtualBox; 956 956 957 957 /* register with parent early, since uninit() will unconditionally … … 962 962 m.state = MediaState_Created; 963 963 964 unconst 964 unconst(m.id) = aId; 965 965 rc = setLocation (aLocation); 966 CheckComRCReturnRC 967 968 LogFlowThisFunc 966 CheckComRCReturnRC(rc); 967 968 LogFlowThisFunc(("m.locationFull='%ls'\n", m.locationFull.raw())); 969 969 970 970 /* get all the information about the medium from the file */ … … 980 980 981 981 /* Confirm a successful initialization when it's the case */ 982 if (SUCCEEDED 982 if (SUCCEEDED(rc)) 983 983 autoInitSpan.setSucceeded(); 984 984 … … 998 998 const settings::Key &aImageNode) 999 999 { 1000 AssertReturn 1000 AssertReturn(aVirtualBox, E_INVALIDARG); 1001 1001 1002 1002 /* Enclose the state transition NotReady->InInit->Ready */ 1003 AutoInitSpan autoInitSpan 1004 AssertReturn 1003 AutoInitSpan autoInitSpan(this); 1004 AssertReturn(autoInitSpan.isOk(), E_FAIL); 1005 1005 1006 1006 HRESULT rc = S_OK; 1007 1007 1008 1008 /* share parent weakly */ 1009 unconst 1009 unconst(mVirtualBox) = aVirtualBox; 1010 1010 1011 1011 /* register with parent early, since uninit() will unconditionally … … 1018 1018 1019 1019 /* required */ 1020 unconst 1020 unconst(m.id) = aImageNode.value <Guid> ("uuid"); 1021 1021 /* required */ 1022 1022 Bstr location = aImageNode.stringValue ("location"); 1023 1023 rc = setLocation (location); 1024 CheckComRCReturnRC 1024 CheckComRCReturnRC(rc); 1025 1025 /* optional */ 1026 1026 { … … 1030 1030 } 1031 1031 1032 LogFlowThisFunc 1032 LogFlowThisFunc(("m.locationFull='%ls', m.id={%RTuuid}\n", 1033 1033 m.locationFull.raw(), m.id.raw())); 1034 1034 … … 1041 1041 1042 1042 /* Confirm a successful initialization when it's the case */ 1043 if (SUCCEEDED 1043 if (SUCCEEDED(rc)) 1044 1044 autoInitSpan.setSucceeded(); 1045 1045 … … 1054 1054 void ImageMediumBase::protectedUninit() 1055 1055 { 1056 LogFlowThisFunc 1056 LogFlowThisFunc(("\n")); 1057 1057 1058 1058 /* Enclose the state transition Ready->InUninit->NotReady */ 1059 AutoUninitSpan autoUninitSpan 1059 AutoUninitSpan autoUninitSpan(this); 1060 1060 if (autoUninitSpan.uninitDone()) 1061 1061 return; … … 1063 1063 mVirtualBox->removeDependentChild (this); 1064 1064 1065 unconst 1065 unconst(mVirtualBox).setNull(); 1066 1066 } 1067 1067 … … 1081 1081 using namespace settings; 1082 1082 1083 AssertReturn 1084 1085 AutoCaller autoCaller 1086 CheckComRCReturnRC 1087 1088 AutoReadLock alock 1083 AssertReturn(!aImagesNode.isNull(), E_FAIL); 1084 1085 AutoCaller autoCaller(this); 1086 CheckComRCReturnRC(autoCaller.rc()); 1087 1088 AutoReadLock alock(this); 1089 1089 1090 1090 Key imageNode = aImagesNode.appendKey ("Image"); -
trunk/src/VBox/Main/MouseImpl.cpp
r21226 r21878 80 80 HRESULT Mouse::init (Console *parent) 81 81 { 82 LogFlowThisFunc 82 LogFlowThisFunc(("\n")); 83 83 84 84 ComAssertRet (parent, E_INVALIDARG); 85 85 86 86 /* Enclose the state transition NotReady->InInit->Ready */ 87 AutoInitSpan autoInitSpan 88 AssertReturn 87 AutoInitSpan autoInitSpan(this); 88 AssertReturn(autoInitSpan.isOk(), E_FAIL); 89 89 90 90 unconst(mParent) = parent; … … 109 109 void Mouse::uninit() 110 110 { 111 LogFlowThisFunc 111 LogFlowThisFunc(("\n")); 112 112 113 113 /* Enclose the state transition Ready->InUninit->NotReady */ 114 AutoUninitSpan autoUninitSpan 114 AutoUninitSpan autoUninitSpan(this); 115 115 if (autoUninitSpan.uninitDone()) 116 116 return; … … 120 120 mpDrv = NULL; 121 121 122 unconst 122 unconst(mParent).setNull(); 123 123 } 124 124 … … 138 138 return E_POINTER; 139 139 140 AutoCaller autoCaller 141 CheckComRCReturnRC 142 143 AutoWriteLock alock 140 AutoCaller autoCaller(this); 141 CheckComRCReturnRC(autoCaller.rc()); 142 143 AutoWriteLock alock(this); 144 144 145 145 CHECK_CONSOLE_DRV (mpDrv); … … 168 168 return E_POINTER; 169 169 170 AutoCaller autoCaller 171 CheckComRCReturnRC 172 173 AutoWriteLock alock 170 AutoCaller autoCaller(this); 171 CheckComRCReturnRC(autoCaller.rc()); 172 173 AutoWriteLock alock(this); 174 174 175 175 CHECK_CONSOLE_DRV (mpDrv); … … 202 202 HRESULT rc = S_OK; 203 203 204 AutoCaller autoCaller 205 CheckComRCReturnRC 206 207 AutoWriteLock alock 204 AutoCaller autoCaller(this); 205 CheckComRCReturnRC(autoCaller.rc()); 206 207 AutoWriteLock alock(this); 208 208 209 209 CHECK_CONSOLE_DRV (mpDrv); … … 236 236 237 237 int vrc = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, dx, dy, dz, fButtons); 238 if (RT_FAILURE 238 if (RT_FAILURE(vrc)) 239 239 rc = setError (VBOX_E_IPRT_ERROR, 240 240 tr ("Could not send the mouse event to the virtual mouse (%Rrc)"), … … 259 259 HRESULT rc = S_OK; 260 260 261 AutoCaller autoCaller 262 CheckComRCReturnRC 263 264 AutoWriteLock alock 261 AutoCaller autoCaller(this); 262 CheckComRCReturnRC(autoCaller.rc()); 263 264 AutoWriteLock alock(this); 265 265 266 266 CHECK_CONSOLE_DRV (mpDrv); … … 332 332 mLastAbsX = mouseXAbs; 333 333 mLastAbsY = mouseYAbs; 334 if (RT_FAILURE 334 if (RT_FAILURE(vrc)) 335 335 rc = setError (VBOX_E_IPRT_ERROR, 336 336 tr ("Could not send the mouse event to the virtual mouse (%Rrc)"), -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r21817 r21878 56 56 HRESULT NetworkAdapter::init (Machine *aParent, ULONG aSlot) 57 57 { 58 LogFlowThisFunc 58 LogFlowThisFunc(("aParent=%p, aSlot=%d\n", aParent, aSlot)); 59 59 60 60 ComAssertRet (aParent, E_INVALIDARG); … … 62 62 63 63 /* Enclose the state transition NotReady->InInit->Ready */ 64 AutoInitSpan autoInitSpan 65 AssertReturn 66 67 unconst 64 AutoInitSpan autoInitSpan(this); 65 AssertReturn(autoInitSpan.isOk(), E_FAIL); 66 67 unconst(mParent) = aParent; 68 68 /* mPeer is left null */ 69 69 … … 99 99 HRESULT NetworkAdapter::init (Machine *aParent, NetworkAdapter *aThat) 100 100 { 101 LogFlowThisFunc 101 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 102 102 103 103 ComAssertRet (aParent && aThat, E_INVALIDARG); 104 104 105 105 /* Enclose the state transition NotReady->InInit->Ready */ 106 AutoInitSpan autoInitSpan 107 AssertReturn 108 109 unconst 110 unconst 106 AutoInitSpan autoInitSpan(this); 107 AssertReturn(autoInitSpan.isOk(), E_FAIL); 108 109 unconst(mParent) = aParent; 110 unconst(mPeer) = aThat; 111 111 112 112 AutoCaller thatCaller (aThat); 113 AssertComRCReturnRC 113 AssertComRCReturnRC(thatCaller.rc()); 114 114 115 115 AutoReadLock thatLock (aThat); … … 131 131 HRESULT NetworkAdapter::initCopy (Machine *aParent, NetworkAdapter *aThat) 132 132 { 133 LogFlowThisFunc 133 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 134 134 135 135 ComAssertRet (aParent && aThat, E_INVALIDARG); 136 136 137 137 /* Enclose the state transition NotReady->InInit->Ready */ 138 AutoInitSpan autoInitSpan 139 AssertReturn 140 141 unconst 138 AutoInitSpan autoInitSpan(this); 139 AssertReturn(autoInitSpan.isOk(), E_FAIL); 140 141 unconst(mParent) = aParent; 142 142 /* mPeer is left null */ 143 143 144 144 AutoCaller thatCaller (aThat); 145 AssertComRCReturnRC 145 AssertComRCReturnRC(thatCaller.rc()); 146 146 147 147 AutoReadLock thatLock (aThat); … … 160 160 void NetworkAdapter::uninit() 161 161 { 162 LogFlowThisFunc 162 LogFlowThisFunc(("\n")); 163 163 164 164 /* Enclose the state transition Ready->InUninit->NotReady */ 165 AutoUninitSpan autoUninitSpan 165 AutoUninitSpan autoUninitSpan(this); 166 166 if (autoUninitSpan.uninitDone()) 167 167 return; … … 169 169 mData.free(); 170 170 171 unconst 172 unconst 171 unconst(mPeer).setNull(); 172 unconst(mParent).setNull(); 173 173 } 174 174 … … 180 180 CheckComArgOutPointerValid(aAdapterType); 181 181 182 AutoCaller autoCaller 183 CheckComRCReturnRC 184 185 AutoReadLock alock 182 AutoCaller autoCaller(this); 183 CheckComRCReturnRC(autoCaller.rc()); 184 185 AutoReadLock alock(this); 186 186 187 187 *aAdapterType = mData->mAdapterType; … … 192 192 STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType) (NetworkAdapterType_T aAdapterType) 193 193 { 194 AutoCaller autoCaller 195 CheckComRCReturnRC 196 197 /* the machine needs to be mutable */ 198 Machine::AutoMutableStateDependency adep (mParent); 199 CheckComRCReturnRC 200 201 AutoWriteLock alock 194 AutoCaller autoCaller(this); 195 CheckComRCReturnRC(autoCaller.rc()); 196 197 /* the machine needs to be mutable */ 198 Machine::AutoMutableStateDependency adep (mParent); 199 CheckComRCReturnRC(adep.rc()); 200 201 AutoWriteLock alock(this); 202 202 203 203 /* make sure the value is allowed */ … … 236 236 CheckComArgOutPointerValid(aSlot); 237 237 238 AutoCaller autoCaller 239 CheckComRCReturnRC 240 241 AutoReadLock alock 238 AutoCaller autoCaller(this); 239 CheckComRCReturnRC(autoCaller.rc()); 240 241 AutoReadLock alock(this); 242 242 243 243 *aSlot = mData->mSlot; … … 250 250 CheckComArgOutPointerValid(aEnabled); 251 251 252 AutoCaller autoCaller 253 CheckComRCReturnRC 254 255 AutoReadLock alock 252 AutoCaller autoCaller(this); 253 CheckComRCReturnRC(autoCaller.rc()); 254 255 AutoReadLock alock(this); 256 256 257 257 *aEnabled = mData->mEnabled; … … 262 262 STDMETHODIMP NetworkAdapter::COMSETTER(Enabled) (BOOL aEnabled) 263 263 { 264 AutoCaller autoCaller 265 CheckComRCReturnRC 266 267 /* the machine needs to be mutable */ 268 Machine::AutoMutableStateDependency adep (mParent); 269 CheckComRCReturnRC 270 271 AutoWriteLock alock 264 AutoCaller autoCaller(this); 265 CheckComRCReturnRC(autoCaller.rc()); 266 267 /* the machine needs to be mutable */ 268 Machine::AutoMutableStateDependency adep (mParent); 269 CheckComRCReturnRC(adep.rc()); 270 271 AutoWriteLock alock(this); 272 272 273 273 if (mData->mEnabled != aEnabled) … … 289 289 CheckComArgOutPointerValid(aMACAddress); 290 290 291 AutoCaller autoCaller 292 CheckComRCReturnRC 293 294 AutoReadLock alock 291 AutoCaller autoCaller(this); 292 CheckComRCReturnRC(autoCaller.rc()); 293 294 AutoReadLock alock(this); 295 295 296 296 ComAssertRet (!!mData->mMACAddress, E_FAIL); 297 297 298 mData->mMACAddress.cloneTo 298 mData->mMACAddress.cloneTo(aMACAddress); 299 299 300 300 return S_OK; … … 303 303 STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(IN_BSTR aMACAddress) 304 304 { 305 AutoCaller autoCaller 306 CheckComRCReturnRC 307 308 /* the machine needs to be mutable */ 309 Machine::AutoMutableStateDependency adep (mParent); 310 CheckComRCReturnRC 311 312 AutoWriteLock alock 305 AutoCaller autoCaller(this); 306 CheckComRCReturnRC(autoCaller.rc()); 307 308 /* the machine needs to be mutable */ 309 Machine::AutoMutableStateDependency adep (mParent); 310 CheckComRCReturnRC(adep.rc()); 311 312 AutoWriteLock alock(this); 313 313 314 314 HRESULT rc = S_OK; … … 360 360 rc = setError(E_INVALIDARG, tr("Invalid MAC address format")); 361 361 362 if (SUCCEEDED 362 if (SUCCEEDED(rc)) 363 363 { 364 364 mData.backup(); … … 386 386 CheckComArgOutPointerValid(aAttachmentType); 387 387 388 AutoCaller autoCaller 389 CheckComRCReturnRC 390 391 AutoReadLock alock 388 AutoCaller autoCaller(this); 389 CheckComRCReturnRC(autoCaller.rc()); 390 391 AutoReadLock alock(this); 392 392 393 393 *aAttachmentType = mData->mAttachmentType; … … 400 400 CheckComArgOutPointerValid(aHostInterface); 401 401 402 AutoCaller autoCaller 403 CheckComRCReturnRC 404 405 AutoReadLock alock 406 407 mData->mHostInterface.cloneTo 402 AutoCaller autoCaller(this); 403 CheckComRCReturnRC(autoCaller.rc()); 404 405 AutoReadLock alock(this); 406 407 mData->mHostInterface.cloneTo(aHostInterface); 408 408 409 409 return S_OK; … … 418 418 CheckComArgNotNull (aHostInterface); 419 419 420 AutoCaller autoCaller 421 CheckComRCReturnRC 422 423 /* the machine needs to be mutable */ 424 Machine::AutoMutableStateDependency adep (mParent); 425 CheckComRCReturnRC 426 427 AutoWriteLock alock 420 AutoCaller autoCaller(this); 421 CheckComRCReturnRC(autoCaller.rc()); 422 423 /* the machine needs to be mutable */ 424 Machine::AutoMutableStateDependency adep (mParent); 425 CheckComRCReturnRC(adep.rc()); 426 427 AutoWriteLock alock(this); 428 428 429 429 if (mData->mHostInterface != aHostInterface) … … 445 445 CheckComArgOutPointerValid(aInternalNetwork); 446 446 447 AutoCaller autoCaller 448 CheckComRCReturnRC 449 450 AutoReadLock alock 451 452 mData->mInternalNetwork.cloneTo 447 AutoCaller autoCaller(this); 448 CheckComRCReturnRC(autoCaller.rc()); 449 450 AutoReadLock alock(this); 451 452 mData->mInternalNetwork.cloneTo(aInternalNetwork); 453 453 454 454 return S_OK; … … 457 457 STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork) (IN_BSTR aInternalNetwork) 458 458 { 459 AutoCaller autoCaller 460 CheckComRCReturnRC 461 462 /* the machine needs to be mutable */ 463 Machine::AutoMutableStateDependency adep (mParent); 464 CheckComRCReturnRC 465 466 AutoWriteLock alock 459 AutoCaller autoCaller(this); 460 CheckComRCReturnRC(autoCaller.rc()); 461 462 /* the machine needs to be mutable */ 463 Machine::AutoMutableStateDependency adep (mParent); 464 CheckComRCReturnRC(adep.rc()); 465 466 AutoWriteLock alock(this); 467 467 468 468 if (mData->mInternalNetwork != aInternalNetwork) … … 493 493 CheckComArgOutPointerValid(aNATNetwork); 494 494 495 AutoCaller autoCaller 496 CheckComRCReturnRC 497 498 AutoReadLock alock 499 500 mData->mNATNetwork.cloneTo 495 AutoCaller autoCaller(this); 496 CheckComRCReturnRC(autoCaller.rc()); 497 498 AutoReadLock alock(this); 499 500 mData->mNATNetwork.cloneTo(aNATNetwork); 501 501 502 502 return S_OK; … … 505 505 STDMETHODIMP NetworkAdapter::COMSETTER(NATNetwork) (IN_BSTR aNATNetwork) 506 506 { 507 AutoCaller autoCaller 508 CheckComRCReturnRC 509 510 /* the machine needs to be mutable */ 511 Machine::AutoMutableStateDependency adep (mParent); 512 CheckComRCReturnRC 513 514 AutoWriteLock alock 507 AutoCaller autoCaller(this); 508 CheckComRCReturnRC(autoCaller.rc()); 509 510 /* the machine needs to be mutable */ 511 Machine::AutoMutableStateDependency adep (mParent); 512 CheckComRCReturnRC(adep.rc()); 513 514 AutoWriteLock alock(this); 515 515 516 516 if (mData->mNATNetwork != aNATNetwork) … … 532 532 CheckComArgOutPointerValid(aConnected); 533 533 534 AutoCaller autoCaller 535 CheckComRCReturnRC 536 537 AutoReadLock alock 534 AutoCaller autoCaller(this); 535 CheckComRCReturnRC(autoCaller.rc()); 536 537 AutoReadLock alock(this); 538 538 539 539 *aConnected = mData->mCableConnected; … … 544 544 STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected) (BOOL aConnected) 545 545 { 546 AutoCaller autoCaller 547 CheckComRCReturnRC 548 549 /* the machine needs to be mutable */ 550 Machine::AutoMutableStateDependency adep (mParent); 551 CheckComRCReturnRC 552 553 AutoWriteLock alock 546 AutoCaller autoCaller(this); 547 CheckComRCReturnRC(autoCaller.rc()); 548 549 /* the machine needs to be mutable */ 550 Machine::AutoMutableStateDependency adep (mParent); 551 CheckComRCReturnRC(adep.rc()); 552 553 AutoWriteLock alock(this); 554 554 555 555 if (aConnected != mData->mCableConnected) … … 571 571 CheckComArgOutPointerValid(aSpeed); 572 572 573 AutoCaller autoCaller 574 CheckComRCReturnRC 575 576 AutoReadLock alock 573 AutoCaller autoCaller(this); 574 CheckComRCReturnRC(autoCaller.rc()); 575 576 AutoReadLock alock(this); 577 577 578 578 *aSpeed = mData->mLineSpeed; … … 583 583 STDMETHODIMP NetworkAdapter::COMSETTER(LineSpeed) (ULONG aSpeed) 584 584 { 585 AutoCaller autoCaller 586 CheckComRCReturnRC 587 588 /* the machine needs to be mutable */ 589 Machine::AutoMutableStateDependency adep (mParent); 590 CheckComRCReturnRC 591 592 AutoWriteLock alock 585 AutoCaller autoCaller(this); 586 CheckComRCReturnRC(autoCaller.rc()); 587 588 /* the machine needs to be mutable */ 589 Machine::AutoMutableStateDependency adep (mParent); 590 CheckComRCReturnRC(adep.rc()); 591 592 AutoWriteLock alock(this); 593 593 594 594 if (aSpeed != mData->mLineSpeed) … … 610 610 CheckComArgOutPointerValid(aEnabled); 611 611 612 AutoCaller autoCaller 613 CheckComRCReturnRC 614 615 AutoReadLock alock 612 AutoCaller autoCaller(this); 613 CheckComRCReturnRC(autoCaller.rc()); 614 615 AutoReadLock alock(this); 616 616 617 617 *aEnabled = mData->mTraceEnabled; … … 621 621 STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled) (BOOL aEnabled) 622 622 { 623 AutoCaller autoCaller 624 CheckComRCReturnRC 625 626 /* the machine needs to be mutable */ 627 Machine::AutoMutableStateDependency adep (mParent); 628 CheckComRCReturnRC 629 630 AutoWriteLock alock 623 AutoCaller autoCaller(this); 624 CheckComRCReturnRC(autoCaller.rc()); 625 626 /* the machine needs to be mutable */ 627 Machine::AutoMutableStateDependency adep (mParent); 628 CheckComRCReturnRC(adep.rc()); 629 630 AutoWriteLock alock(this); 631 631 632 632 if (aEnabled != mData->mTraceEnabled) … … 648 648 CheckComArgOutPointerValid(aTraceFile); 649 649 650 AutoCaller autoCaller 651 CheckComRCReturnRC 652 653 AutoReadLock alock 654 655 mData->mTraceFile.cloneTo 650 AutoCaller autoCaller(this); 651 CheckComRCReturnRC(autoCaller.rc()); 652 653 AutoReadLock alock(this); 654 655 mData->mTraceFile.cloneTo(aTraceFile); 656 656 657 657 return S_OK; … … 660 660 STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile) (IN_BSTR aTraceFile) 661 661 { 662 AutoCaller autoCaller 663 CheckComRCReturnRC 664 665 /* the machine needs to be mutable */ 666 Machine::AutoMutableStateDependency adep (mParent); 667 CheckComRCReturnRC 668 669 AutoWriteLock alock 662 AutoCaller autoCaller(this); 663 CheckComRCReturnRC(autoCaller.rc()); 664 665 /* the machine needs to be mutable */ 666 Machine::AutoMutableStateDependency adep (mParent); 667 CheckComRCReturnRC(adep.rc()); 668 669 AutoWriteLock alock(this); 670 670 671 671 if (mData->mTraceFile != aTraceFile) … … 688 688 STDMETHODIMP NetworkAdapter::AttachToNAT() 689 689 { 690 AutoCaller autoCaller 691 CheckComRCReturnRC 692 693 /* the machine needs to be mutable */ 694 Machine::AutoMutableStateDependency adep (mParent); 695 CheckComRCReturnRC 696 697 AutoWriteLock alock 690 AutoCaller autoCaller(this); 691 CheckComRCReturnRC(autoCaller.rc()); 692 693 /* the machine needs to be mutable */ 694 Machine::AutoMutableStateDependency adep (mParent); 695 CheckComRCReturnRC(adep.rc()); 696 697 AutoWriteLock alock(this); 698 698 699 699 if (mData->mAttachmentType != NetworkAttachmentType_NAT) … … 718 718 STDMETHODIMP NetworkAdapter::AttachToBridgedInterface() 719 719 { 720 AutoCaller autoCaller 721 CheckComRCReturnRC 722 723 /* the machine needs to be mutable */ 724 Machine::AutoMutableStateDependency adep (mParent); 725 CheckComRCReturnRC 726 727 AutoWriteLock alock 720 AutoCaller autoCaller(this); 721 CheckComRCReturnRC(autoCaller.rc()); 722 723 /* the machine needs to be mutable */ 724 Machine::AutoMutableStateDependency adep (mParent); 725 CheckComRCReturnRC(adep.rc()); 726 727 AutoWriteLock alock(this); 728 728 729 729 /* don't do anything if we're already host interface attached */ … … 750 750 STDMETHODIMP NetworkAdapter::AttachToInternalNetwork() 751 751 { 752 AutoCaller autoCaller 753 CheckComRCReturnRC 754 755 /* the machine needs to be mutable */ 756 Machine::AutoMutableStateDependency adep (mParent); 757 CheckComRCReturnRC 758 759 AutoWriteLock alock 752 AutoCaller autoCaller(this); 753 CheckComRCReturnRC(autoCaller.rc()); 754 755 /* the machine needs to be mutable */ 756 Machine::AutoMutableStateDependency adep (mParent); 757 CheckComRCReturnRC(adep.rc()); 758 759 AutoWriteLock alock(this); 760 760 761 761 /* don't do anything if we're already internal network attached */ … … 790 790 STDMETHODIMP NetworkAdapter::AttachToHostOnlyInterface() 791 791 { 792 AutoCaller autoCaller 793 CheckComRCReturnRC 794 795 /* the machine needs to be mutable */ 796 Machine::AutoMutableStateDependency adep (mParent); 797 CheckComRCReturnRC 798 799 AutoWriteLock alock 792 AutoCaller autoCaller(this); 793 CheckComRCReturnRC(autoCaller.rc()); 794 795 /* the machine needs to be mutable */ 796 Machine::AutoMutableStateDependency adep (mParent); 797 CheckComRCReturnRC(adep.rc()); 798 799 AutoWriteLock alock(this); 800 800 801 801 /* don't do anything if we're already host interface attached */ … … 822 822 STDMETHODIMP NetworkAdapter::Detach() 823 823 { 824 AutoCaller autoCaller 825 CheckComRCReturnRC 826 827 /* the machine needs to be mutable */ 828 Machine::AutoMutableStateDependency adep (mParent); 829 CheckComRCReturnRC 830 831 AutoWriteLock alock 824 AutoCaller autoCaller(this); 825 CheckComRCReturnRC(autoCaller.rc()); 826 827 /* the machine needs to be mutable */ 828 Machine::AutoMutableStateDependency adep (mParent); 829 CheckComRCReturnRC(adep.rc()); 830 831 AutoWriteLock alock(this); 832 832 833 833 if (mData->mAttachmentType != NetworkAttachmentType_Null) … … 861 861 using namespace settings; 862 862 863 AssertReturn 864 865 AutoCaller autoCaller 866 AssertComRCReturnRC 867 868 AutoWriteLock alock 863 AssertReturn(!aAdapterNode.isNull(), E_FAIL); 864 865 AutoCaller autoCaller(this); 866 AssertComRCReturnRC(autoCaller.rc()); 867 868 AutoWriteLock alock(this); 869 869 870 870 /* Note: we assume that the default values for attributes of optional … … 902 902 /* MAC address (can be null) */ 903 903 rc = COMSETTER(MACAddress) (Bstr (aAdapterNode.stringValue ("MACAddress"))); 904 CheckComRCReturnRC 904 CheckComRCReturnRC(rc); 905 905 /* cable (required) */ 906 906 mData->mCableConnected = aAdapterNode.value <bool> ("cable"); … … 922 922 923 923 rc = AttachToNAT(); 924 CheckComRCReturnRC 924 CheckComRCReturnRC(rc); 925 925 } 926 926 else … … 935 935 936 936 rc = COMSETTER(HostInterface) (name); 937 CheckComRCReturnRC 937 CheckComRCReturnRC(rc); 938 938 939 939 rc = AttachToBridgedInterface(); 940 CheckComRCReturnRC 940 CheckComRCReturnRC(rc); 941 941 } 942 942 else … … 950 950 951 951 rc = AttachToInternalNetwork(); 952 CheckComRCReturnRC 952 CheckComRCReturnRC(rc); 953 953 } 954 954 else … … 961 961 962 962 rc = COMSETTER(HostInterface) (name); 963 CheckComRCReturnRC 963 CheckComRCReturnRC(rc); 964 964 #endif 965 965 966 966 /* Host Interface Networking */ 967 967 rc = AttachToHostOnlyInterface(); 968 CheckComRCReturnRC 968 CheckComRCReturnRC(rc); 969 969 } 970 970 else … … 972 972 /* Adapter has no children */ 973 973 rc = Detach(); 974 CheckComRCReturnRC 974 CheckComRCReturnRC(rc); 975 975 } 976 976 … … 991 991 using namespace settings; 992 992 993 AssertReturn 994 995 AutoCaller autoCaller 996 AssertComRCReturnRC 997 998 AutoReadLock alock 993 AssertReturn(!aAdapterNode.isNull(), E_FAIL); 994 995 AutoCaller autoCaller(this); 996 AssertComRCReturnRC(autoCaller.rc()); 997 998 AutoReadLock alock(this); 999 999 1000 1000 aAdapterNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 1087 1087 { 1088 1088 /* sanity */ 1089 AutoCaller autoCaller 1089 AutoCaller autoCaller(this); 1090 1090 AssertComRCReturn (autoCaller.rc(), false); 1091 1091 1092 AutoWriteLock alock 1092 AutoWriteLock alock(this); 1093 1093 1094 1094 bool changed = false; … … 1112 1112 { 1113 1113 /* sanity */ 1114 AutoCaller autoCaller 1114 AutoCaller autoCaller(this); 1115 1115 AssertComRCReturnVoid (autoCaller.rc()); 1116 1116 … … 1143 1143 1144 1144 /* sanity */ 1145 AutoCaller autoCaller 1145 AutoCaller autoCaller(this); 1146 1146 AssertComRCReturnVoid (autoCaller.rc()); 1147 1147 … … 1163 1163 1164 1164 /* sanity */ 1165 AutoCaller autoCaller 1165 AutoCaller autoCaller(this); 1166 1166 AssertComRCReturnVoid (autoCaller.rc()); 1167 1167 1168 AutoWriteLock alock 1168 AutoWriteLock alock(this); 1169 1169 1170 1170 bool e1000enabled = false; … … 1259 1259 RTStrPrintf (strMAC, sizeof(strMAC), "080027%02X%02X%02X", 1260 1260 guid.ptr()->au8[0], guid.ptr()->au8[1], guid.ptr()->au8[2]); 1261 LogFlowThisFunc 1261 LogFlowThisFunc(("generated MAC: '%s'\n", strMAC)); 1262 1262 mData->mMACAddress = strMAC; 1263 1263 } -
trunk/src/VBox/Main/ParallelPortImpl.cpp
r16560 r21878 55 55 HRESULT ParallelPort::init (Machine *aParent, ULONG aSlot) 56 56 { 57 LogFlowThisFunc 57 LogFlowThisFunc(("aParent=%p, aSlot=%d\n", aParent, aSlot)); 58 58 59 59 ComAssertRet (aParent, E_INVALIDARG); 60 60 61 61 /* Enclose the state transition NotReady->InInit->Ready */ 62 AutoInitSpan autoInitSpan 63 AssertReturn 64 65 unconst 62 AutoInitSpan autoInitSpan(this); 63 AssertReturn(autoInitSpan.isOk(), E_FAIL); 64 65 unconst(mParent) = aParent; 66 66 /* mPeer is left null */ 67 67 … … 89 89 HRESULT ParallelPort::init (Machine *aParent, ParallelPort *aThat) 90 90 { 91 LogFlowThisFunc 91 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 92 92 93 93 ComAssertRet (aParent && aThat, E_INVALIDARG); 94 94 95 95 /* Enclose the state transition NotReady->InInit->Ready */ 96 AutoInitSpan autoInitSpan 97 AssertReturn 98 99 unconst 100 unconst 96 AutoInitSpan autoInitSpan(this); 97 AssertReturn(autoInitSpan.isOk(), E_FAIL); 98 99 unconst(mParent) = aParent; 100 unconst(mPeer) = aThat; 101 101 102 102 AutoCaller thatCaller (aThat); 103 AssertComRCReturnRC 103 AssertComRCReturnRC(thatCaller.rc()); 104 104 105 105 AutoReadLock thatLock (aThat); … … 121 121 HRESULT ParallelPort::initCopy (Machine *aParent, ParallelPort *aThat) 122 122 { 123 LogFlowThisFunc 123 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 124 124 125 125 ComAssertRet (aParent && aThat, E_INVALIDARG); 126 126 127 127 /* Enclose the state transition NotReady->InInit->Ready */ 128 AutoInitSpan autoInitSpan 129 AssertReturn 130 131 unconst 128 AutoInitSpan autoInitSpan(this); 129 AssertReturn(autoInitSpan.isOk(), E_FAIL); 130 131 unconst(mParent) = aParent; 132 132 /* mPeer is left null */ 133 133 134 134 AutoCaller thatCaller (aThat); 135 AssertComRCReturnRC 135 AssertComRCReturnRC(thatCaller.rc()); 136 136 137 137 AutoReadLock thatLock (aThat); … … 150 150 void ParallelPort::uninit() 151 151 { 152 LogFlowThisFunc 152 LogFlowThisFunc(("\n")); 153 153 154 154 /* Enclose the state transition Ready->InUninit->NotReady */ 155 AutoUninitSpan autoUninitSpan 155 AutoUninitSpan autoUninitSpan(this); 156 156 if (autoUninitSpan.uninitDone()) 157 157 return; … … 159 159 mData.free(); 160 160 161 unconst 162 unconst 161 unconst(mPeer).setNull(); 162 unconst(mParent).setNull(); 163 163 } 164 164 … … 178 178 using namespace settings; 179 179 180 AssertReturn 181 182 AutoCaller autoCaller 183 AssertComRCReturnRC 184 185 AutoWriteLock alock 180 AssertReturn(!aPortNode.isNull(), E_FAIL); 181 182 AutoCaller autoCaller(this); 183 AssertComRCReturnRC(autoCaller.rc()); 184 185 AutoWriteLock alock(this); 186 186 187 187 /* Note: we assume that the default values for attributes of optional … … 206 206 207 207 HRESULT rc = checkSetPath (path); 208 CheckComRCReturnRC 208 CheckComRCReturnRC(rc); 209 209 mData->mPath = path; 210 210 … … 225 225 using namespace settings; 226 226 227 AssertReturn 228 229 AutoCaller autoCaller 230 AssertComRCReturnRC 231 232 AutoReadLock alock 227 AssertReturn(!aPortNode.isNull(), E_FAIL); 228 229 AutoCaller autoCaller(this); 230 AssertComRCReturnRC(autoCaller.rc()); 231 232 AutoReadLock alock(this); 233 233 234 234 aPortNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 249 249 { 250 250 /* sanity */ 251 AutoCaller autoCaller 251 AutoCaller autoCaller(this); 252 252 AssertComRCReturn (autoCaller.rc(), false); 253 253 254 AutoWriteLock alock 254 AutoWriteLock alock(this); 255 255 256 256 bool changed = false; … … 274 274 { 275 275 /* sanity */ 276 AutoCaller autoCaller 276 AutoCaller autoCaller(this); 277 277 AssertComRCReturnVoid (autoCaller.rc()); 278 278 … … 305 305 306 306 /* sanity */ 307 AutoCaller autoCaller 307 AutoCaller autoCaller(this); 308 308 AssertComRCReturnVoid (autoCaller.rc()); 309 309 … … 327 327 CheckComArgOutPointerValid(aEnabled); 328 328 329 AutoCaller autoCaller 330 CheckComRCReturnRC 331 332 AutoReadLock alock 329 AutoCaller autoCaller(this); 330 CheckComRCReturnRC(autoCaller.rc()); 331 332 AutoReadLock alock(this); 333 333 334 334 *aEnabled = mData->mEnabled; … … 339 339 STDMETHODIMP ParallelPort::COMSETTER(Enabled) (BOOL aEnabled) 340 340 { 341 LogFlowThisFunc 342 343 AutoCaller autoCaller 344 CheckComRCReturnRC 341 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 342 343 AutoCaller autoCaller(this); 344 CheckComRCReturnRC(autoCaller.rc()); 345 345 346 346 /* the machine needs to be mutable */ 347 347 Machine::AutoMutableStateDependency adep (mParent); 348 CheckComRCReturnRC 349 350 AutoWriteLock alock 348 CheckComRCReturnRC(adep.rc()); 349 350 AutoWriteLock alock(this); 351 351 352 352 if (mData->mEnabled != aEnabled) … … 375 375 CheckComArgOutPointerValid(aSlot); 376 376 377 AutoCaller autoCaller 378 CheckComRCReturnRC 379 380 AutoReadLock alock 377 AutoCaller autoCaller(this); 378 CheckComRCReturnRC(autoCaller.rc()); 379 380 AutoReadLock alock(this); 381 381 382 382 *aSlot = mData->mSlot; … … 389 389 CheckComArgOutPointerValid(aIRQ); 390 390 391 AutoCaller autoCaller 392 CheckComRCReturnRC 393 394 AutoReadLock alock 391 AutoCaller autoCaller(this); 392 CheckComRCReturnRC(autoCaller.rc()); 393 394 AutoReadLock alock(this); 395 395 396 396 *aIRQ = mData->mIRQ; … … 409 409 mData->mSlot, aIRQ, 255); 410 410 411 AutoCaller autoCaller 412 CheckComRCReturnRC 411 AutoCaller autoCaller(this); 412 CheckComRCReturnRC(autoCaller.rc()); 413 413 414 414 /* the machine needs to be mutable */ 415 415 Machine::AutoMutableStateDependency adep (mParent); 416 CheckComRCReturnRC 417 418 AutoWriteLock alock 416 CheckComRCReturnRC(adep.rc()); 417 418 AutoWriteLock alock(this); 419 419 420 420 HRESULT rc = S_OK; … … 443 443 CheckComArgOutPointerValid(aIOBase); 444 444 445 AutoCaller autoCaller 446 CheckComRCReturnRC 447 448 AutoReadLock alock 445 AutoCaller autoCaller(this); 446 CheckComRCReturnRC(autoCaller.rc()); 447 448 AutoReadLock alock(this); 449 449 450 450 *aIOBase = mData->mIOBase; … … 463 463 mData->mSlot, aIOBase, 0, 0xFFFF); 464 464 465 AutoCaller autoCaller 466 CheckComRCReturnRC 465 AutoCaller autoCaller(this); 466 CheckComRCReturnRC(autoCaller.rc()); 467 467 468 468 /* the machine needs to be mutable */ 469 469 Machine::AutoMutableStateDependency adep (mParent); 470 CheckComRCReturnRC 471 472 AutoWriteLock alock 470 CheckComRCReturnRC(adep.rc()); 471 472 AutoWriteLock alock(this); 473 473 474 474 HRESULT rc = S_OK; … … 497 497 CheckComArgOutPointerValid(aPath); 498 498 499 AutoCaller autoCaller 500 CheckComRCReturnRC 501 502 AutoReadLock alock 503 504 mData->mPath.cloneTo 499 AutoCaller autoCaller(this); 500 CheckComRCReturnRC(autoCaller.rc()); 501 502 AutoReadLock alock(this); 503 504 mData->mPath.cloneTo(aPath); 505 505 506 506 return S_OK; … … 512 512 HRESULT ParallelPort::checkSetPath (CBSTR aPath) 513 513 { 514 AssertReturn 514 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 515 515 516 516 if (mData->mEnabled && … … 526 526 STDMETHODIMP ParallelPort::COMSETTER(Path) (IN_BSTR aPath) 527 527 { 528 AutoCaller autoCaller 529 CheckComRCReturnRC 528 AutoCaller autoCaller(this); 529 CheckComRCReturnRC(autoCaller.rc()); 530 530 531 531 /* the machine needs to be mutable */ 532 532 Machine::AutoMutableStateDependency adep (mParent); 533 CheckComRCReturnRC 534 535 AutoWriteLock alock 533 CheckComRCReturnRC(adep.rc()); 534 535 AutoWriteLock alock(this); 536 536 537 537 /* we treat empty as null when e.g. saving to XML, do the same here */ … … 542 542 { 543 543 HRESULT rc = checkSetPath (aPath); 544 CheckComRCReturnRC 544 CheckComRCReturnRC(rc); 545 545 546 546 mData.backup(); -
trunk/src/VBox/Main/Performance.cpp
r17911 r21878 118 118 /*bool BaseMetric::associatedWith(ComPtr<IUnknown> object) 119 119 { 120 LogFlowThisFunc 120 LogFlowThisFunc(("mObject(%p) == object(%p) is %s.\n", mObject, object, mObject == object ? "true" : "false")); 121 121 return mObject == object; 122 122 }*/ … … 164 164 { 165 165 /* This is only possible if none of counters has changed! */ 166 LogFlowThisFunc 166 LogFlowThisFunc(("Impossible! User, kernel and idle raw " 167 167 "counters has not changed since last sample.\n" )); 168 168 mUser->put(0); … … 432 432 if (ComSafeArrayInIsNull(metricNames)) 433 433 { 434 com::SafeArray 434 com::SafeArray<BSTR> nameArray; 435 435 if (ComSafeArrayInIsNull(objects)) 436 436 { 437 com::SafeIfaceArray 437 com::SafeIfaceArray<IUnknown> objectArray; 438 438 objectArray.reset(0); 439 439 init(ComSafeArrayAsInParam(nameArray), … … 442 442 else 443 443 { 444 com::SafeIfaceArray 444 com::SafeIfaceArray<IUnknown> objectArray(ComSafeArrayInArg(objects)); 445 445 init(ComSafeArrayAsInParam(nameArray), 446 446 ComSafeArrayAsInParam(objectArray)); … … 449 449 else 450 450 { 451 com::SafeArray 451 com::SafeArray<IN_BSTR> nameArray(ComSafeArrayInArg(metricNames)); 452 452 if (ComSafeArrayInIsNull(objects)) 453 453 { 454 com::SafeIfaceArray 454 com::SafeIfaceArray<IUnknown> objectArray; 455 455 objectArray.reset(0); 456 456 init(ComSafeArrayAsInParam(nameArray), … … 459 459 else 460 460 { 461 com::SafeIfaceArray 461 com::SafeIfaceArray<IUnknown> objectArray(ComSafeArrayInArg(objects)); 462 462 init(ComSafeArrayAsInParam(nameArray), 463 463 ComSafeArrayAsInParam(objectArray)); … … 469 469 ComSafeArrayIn(IUnknown *, objects)) 470 470 { 471 com::SafeArray 472 com::SafeIfaceArray 471 com::SafeArray<IN_BSTR> nameArray(ComSafeArrayInArg(metricNames)); 472 com::SafeIfaceArray<IUnknown> objectArray(ComSafeArrayInArg(objects)); 473 473 474 474 if (!objectArray.size()) -
trunk/src/VBox/Main/PerformanceImpl.cpp
r21395 r21878 82 82 HRESULT PerformanceCollector::FinalConstruct() 83 83 { 84 LogFlowThisFunc 84 LogFlowThisFunc(("\n")); 85 85 86 86 return S_OK; … … 89 89 void PerformanceCollector::FinalRelease() 90 90 { 91 LogFlowThisFunc 91 LogFlowThisFunc(("\n")); 92 92 } 93 93 … … 101 101 { 102 102 /* Enclose the state transition NotReady->InInit->Ready */ 103 AutoInitSpan autoInitSpan 104 AssertReturn 103 AutoInitSpan autoInitSpan(this); 104 AssertReturn(autoInitSpan.isOk(), E_FAIL); 105 105 106 106 LogFlowThisFuncEnter(); … … 118 118 AssertMsgRC (vrc, ("Failed to create resource usage " 119 119 "sampling timer(%Rra)\n", vrc)); 120 if (RT_FAILURE 120 if (RT_FAILURE(vrc)) 121 121 rc = E_FAIL; 122 122 123 if (SUCCEEDED 123 if (SUCCEEDED(rc)) 124 124 autoInitSpan.setSucceeded(); 125 125 … … 139 139 140 140 /* Enclose the state transition Ready->InUninit->NotReady */ 141 AutoUninitSpan autoUninitSpan 141 AutoUninitSpan autoUninitSpan(this); 142 142 if (autoUninitSpan.uninitDone()) 143 143 { 144 LogFlowThisFunc 144 LogFlowThisFunc(("Already uninitialized.\n")); 145 145 LogFlowThisFuncLeave(); 146 146 return; … … 168 168 169 169 STDMETHODIMP 170 PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut 171 { 172 if (ComSafeArrayOutIsNull 170 PerformanceCollector::COMGETTER(MetricNames) (ComSafeArrayOut(BSTR, theMetricNames)) 171 { 172 if (ComSafeArrayOutIsNull(theMetricNames)) 173 173 return E_POINTER; 174 174 175 AutoCaller autoCaller 176 CheckComRCReturnRC 177 178 AutoReadLock alock 179 180 com::SafeArray 175 AutoCaller autoCaller(this); 176 CheckComRCReturnRC(autoCaller.rc()); 177 178 AutoReadLock alock(this); 179 180 com::SafeArray<BSTR> metricNames(RT_ELEMENTS(gMetricNames)); 181 181 for (size_t i = 0; i < RT_ELEMENTS(gMetricNames); i++) 182 182 { 183 183 Bstr(gMetricNames[i]).cloneTo(&metricNames[i]); 184 184 } 185 //gMetricNames.detachTo(ComSafeArrayOutArg 186 metricNames.detachTo (ComSafeArrayOutArg(theMetricNames));185 //gMetricNames.detachTo(ComSafeArrayOutArg(theMetricNames)); 186 metricNames.detachTo(ComSafeArrayOutArg(theMetricNames)); 187 187 188 188 return S_OK; … … 194 194 HRESULT PerformanceCollector::toIPerformanceMetric(pm::Metric *src, IPerformanceMetric **dst) 195 195 { 196 ComObjPtr 196 ComObjPtr<PerformanceMetric> metric; 197 197 HRESULT rc = metric.createObject(); 198 if (SUCCEEDED 198 if (SUCCEEDED(rc)) 199 199 rc = metric->init (src); 200 AssertComRCReturnRC 201 metric.queryInterfaceTo 200 AssertComRCReturnRC(rc); 201 metric.queryInterfaceTo(dst); 202 202 return rc; 203 203 } … … 205 205 HRESULT PerformanceCollector::toIPerformanceMetric(pm::BaseMetric *src, IPerformanceMetric **dst) 206 206 { 207 ComObjPtr 207 ComObjPtr<PerformanceMetric> metric; 208 208 HRESULT rc = metric.createObject(); 209 if (SUCCEEDED 209 if (SUCCEEDED(rc)) 210 210 rc = metric->init (src); 211 AssertComRCReturnRC 212 metric.queryInterfaceTo 211 AssertComRCReturnRC(rc); 212 metric.queryInterfaceTo(dst); 213 213 return rc; 214 214 } … … 217 217 PerformanceCollector::GetMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 218 218 ComSafeArrayIn (IUnknown *, objects), 219 ComSafeArrayOut 219 ComSafeArrayOut(IPerformanceMetric *, outMetrics)) 220 220 { 221 221 LogFlowThisFuncEnter(); 222 //LogFlowThisFunc 222 //LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); 223 223 224 224 HRESULT rc = S_OK; 225 225 226 AutoCaller autoCaller 227 CheckComRCReturnRC 226 AutoCaller autoCaller(this); 227 CheckComRCReturnRC(autoCaller.rc()); 228 228 229 229 pm::Filter filter (ComSafeArrayInArg (metricNames), 230 230 ComSafeArrayInArg (objects)); 231 231 232 AutoReadLock alock 232 AutoReadLock alock(this); 233 233 234 234 MetricList filteredMetrics; … … 242 242 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it) 243 243 { 244 ComObjPtr 244 ComObjPtr<PerformanceMetric> metric; 245 245 rc = metric.createObject(); 246 if (SUCCEEDED 246 if (SUCCEEDED(rc)) 247 247 rc = metric->init (*it); 248 AssertComRCReturnRC 248 AssertComRCReturnRC(rc); 249 249 LogFlow (("PerformanceCollector::GetMetrics() store a metric at " 250 250 "retMetrics[%d]...\n", i)); 251 metric.queryInterfaceTo 251 metric.queryInterfaceTo(&retMetrics [i++]); 252 252 } 253 retMetrics.detachTo 253 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 254 254 LogFlowThisFuncLeave(); 255 255 return rc; … … 260 260 ComSafeArrayIn (IUnknown *, objects), 261 261 ULONG aPeriod, ULONG aCount, 262 ComSafeArrayOut 262 ComSafeArrayOut(IPerformanceMetric *, 263 263 outMetrics)) 264 264 { 265 AutoCaller autoCaller 266 CheckComRCReturnRC 265 AutoCaller autoCaller(this); 266 CheckComRCReturnRC(autoCaller.rc()); 267 267 268 268 pm::Filter filter (ComSafeArrayInArg (metricNames), 269 269 ComSafeArrayInArg (objects)); 270 270 271 AutoWriteLock alock 271 AutoWriteLock alock(this); 272 272 273 273 HRESULT rc = S_OK; … … 298 298 int i = 0; 299 299 for (it = filteredMetrics.begin(); 300 it != filteredMetrics.end() && SUCCEEDED 300 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 301 301 rc = toIPerformanceMetric(*it, &retMetrics [i++]); 302 retMetrics.detachTo 302 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 303 303 304 304 LogFlowThisFuncLeave(); … … 309 309 PerformanceCollector::EnableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 310 310 ComSafeArrayIn (IUnknown *, objects), 311 ComSafeArrayOut 311 ComSafeArrayOut(IPerformanceMetric *, 312 312 outMetrics)) 313 313 { 314 AutoCaller autoCaller 315 CheckComRCReturnRC 314 AutoCaller autoCaller(this); 315 CheckComRCReturnRC(autoCaller.rc()); 316 316 317 317 pm::Filter filter (ComSafeArrayInArg (metricNames), 318 318 ComSafeArrayInArg (objects)); 319 319 320 AutoWriteLock alock 320 AutoWriteLock alock(this); /* Write lock is not needed atm since we are */ 321 321 /* fiddling with enable bit only, but we */ 322 322 /* care for those who come next :-). */ … … 335 335 int i = 0; 336 336 for (it = filteredMetrics.begin(); 337 it != filteredMetrics.end() && SUCCEEDED 337 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 338 338 rc = toIPerformanceMetric(*it, &retMetrics [i++]); 339 retMetrics.detachTo 339 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 340 340 341 341 LogFlowThisFuncLeave(); … … 346 346 PerformanceCollector::DisableMetrics (ComSafeArrayIn (IN_BSTR, metricNames), 347 347 ComSafeArrayIn (IUnknown *, objects), 348 ComSafeArrayOut 348 ComSafeArrayOut(IPerformanceMetric *, 349 349 outMetrics)) 350 350 { 351 AutoCaller autoCaller 352 CheckComRCReturnRC 351 AutoCaller autoCaller(this); 352 CheckComRCReturnRC(autoCaller.rc()); 353 353 354 354 pm::Filter filter (ComSafeArrayInArg (metricNames), 355 355 ComSafeArrayInArg (objects)); 356 356 357 AutoWriteLock alock 357 AutoWriteLock alock(this); /* Write lock is not needed atm since we are */ 358 358 /* fiddling with enable bit only, but we */ 359 359 /* care for those who come next :-). */ … … 372 372 int i = 0; 373 373 for (it = filteredMetrics.begin(); 374 it != filteredMetrics.end() && SUCCEEDED 374 it != filteredMetrics.end() && SUCCEEDED(rc); ++it) 375 375 rc = toIPerformanceMetric(*it, &retMetrics [i++]); 376 retMetrics.detachTo 376 retMetrics.detachTo(ComSafeArrayOutArg(outMetrics)); 377 377 378 378 LogFlowThisFuncLeave(); … … 383 383 PerformanceCollector::QueryMetricsData (ComSafeArrayIn (IN_BSTR, metricNames), 384 384 ComSafeArrayIn (IUnknown *, objects), 385 ComSafeArrayOut 386 ComSafeArrayOut 387 ComSafeArrayOut 388 ComSafeArrayOut 389 ComSafeArrayOut 390 ComSafeArrayOut 391 ComSafeArrayOut 392 ComSafeArrayOut 393 { 394 AutoCaller autoCaller 395 CheckComRCReturnRC 385 ComSafeArrayOut(BSTR, outMetricNames), 386 ComSafeArrayOut(IUnknown *, outObjects), 387 ComSafeArrayOut(BSTR, outUnits), 388 ComSafeArrayOut(ULONG, outScales), 389 ComSafeArrayOut(ULONG, outSequenceNumbers), 390 ComSafeArrayOut(ULONG, outDataIndices), 391 ComSafeArrayOut(ULONG, outDataLengths), 392 ComSafeArrayOut(LONG, outData)) 393 { 394 AutoCaller autoCaller(this); 395 CheckComRCReturnRC(autoCaller.rc()); 396 396 397 397 pm::Filter filter (ComSafeArrayInArg (metricNames), 398 398 ComSafeArrayInArg (objects)); 399 399 400 AutoReadLock alock 400 AutoReadLock alock(this); 401 401 402 402 /* Let's compute the size of the resulting flat array */ … … 414 414 size_t flatIndex = 0; 415 415 size_t numberOfMetrics = filteredMetrics.size(); 416 com::SafeArray 417 com::SafeIfaceArray 418 com::SafeArray 419 com::SafeArray 420 com::SafeArray 421 com::SafeArray 422 com::SafeArray 423 com::SafeArray 416 com::SafeArray<BSTR> retNames (numberOfMetrics); 417 com::SafeIfaceArray<IUnknown> retObjects (numberOfMetrics); 418 com::SafeArray<BSTR> retUnits (numberOfMetrics); 419 com::SafeArray<ULONG> retScales (numberOfMetrics); 420 com::SafeArray<ULONG> retSequenceNumbers (numberOfMetrics); 421 com::SafeArray<ULONG> retIndices (numberOfMetrics); 422 com::SafeArray<ULONG> retLengths (numberOfMetrics); 423 com::SafeArray<LONG> retData (flatSize); 424 424 425 425 for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i) … … 433 433 Bstr tmp((*it)->getName()); 434 434 tmp.detachTo(&retNames[i]); 435 (*it)->getObject().queryInterfaceTo 435 (*it)->getObject().queryInterfaceTo(&retObjects[i]); 436 436 tmp = (*it)->getUnit(); 437 437 tmp.detachTo(&retUnits[i]); … … 443 443 } 444 444 445 retNames.detachTo (ComSafeArrayOutArg(outMetricNames));446 retObjects.detachTo (ComSafeArrayOutArg(outObjects));447 retUnits.detachTo (ComSafeArrayOutArg(outUnits));448 retScales.detachTo (ComSafeArrayOutArg(outScales));449 retSequenceNumbers.detachTo (ComSafeArrayOutArg(outSequenceNumbers));450 retIndices.detachTo (ComSafeArrayOutArg(outDataIndices));451 retLengths.detachTo (ComSafeArrayOutArg(outDataLengths));452 retData.detachTo (ComSafeArrayOutArg(outData));445 retNames.detachTo(ComSafeArrayOutArg(outMetricNames)); 446 retObjects.detachTo(ComSafeArrayOutArg(outObjects)); 447 retUnits.detachTo(ComSafeArrayOutArg(outUnits)); 448 retScales.detachTo(ComSafeArrayOutArg(outScales)); 449 retSequenceNumbers.detachTo(ComSafeArrayOutArg(outSequenceNumbers)); 450 retIndices.detachTo(ComSafeArrayOutArg(outDataIndices)); 451 retLengths.detachTo(ComSafeArrayOutArg(outDataLengths)); 452 retData.detachTo(ComSafeArrayOutArg(outData)); 453 453 return S_OK; 454 454 } … … 460 460 { 461 461 //LogFlowThisFuncEnter(); 462 AutoCaller autoCaller 463 if (!SUCCEEDED 464 465 AutoWriteLock alock 462 AutoCaller autoCaller(this); 463 if (!SUCCEEDED(autoCaller.rc())) return; 464 465 AutoWriteLock alock(this); 466 466 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)baseMetric->getObject(), baseMetric->getName())); 467 467 m.baseMetrics.push_back (baseMetric); … … 472 472 { 473 473 //LogFlowThisFuncEnter(); 474 AutoCaller autoCaller 475 if (!SUCCEEDED 476 477 AutoWriteLock alock 474 AutoCaller autoCaller(this); 475 if (!SUCCEEDED(autoCaller.rc())) return; 476 477 AutoWriteLock alock(this); 478 478 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p name=%s\n", this, __PRETTY_FUNCTION__, (void *)metric->getObject(), metric->getName())); 479 479 m.metrics.push_back (metric); … … 481 481 } 482 482 483 void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr 483 void PerformanceCollector::unregisterBaseMetricsFor (const ComPtr<IUnknown> &aObject) 484 484 { 485 485 //LogFlowThisFuncEnter(); 486 AutoCaller autoCaller 487 if (!SUCCEEDED 488 489 AutoWriteLock alock 486 AutoCaller autoCaller(this); 487 if (!SUCCEEDED(autoCaller.rc())) return; 488 489 AutoWriteLock alock(this); 490 490 LogAleksey(("{%p} " LOG_FN_FMT ": before remove_if: m.baseMetrics.size()=%d\n", this, __PRETTY_FUNCTION__, m.baseMetrics.size())); 491 491 BaseMetricList::iterator it; … … 502 502 } 503 503 504 void PerformanceCollector::unregisterMetricsFor (const ComPtr 504 void PerformanceCollector::unregisterMetricsFor (const ComPtr<IUnknown> &aObject) 505 505 { 506 506 //LogFlowThisFuncEnter(); 507 AutoCaller autoCaller 508 if (!SUCCEEDED 509 510 AutoWriteLock alock 507 AutoCaller autoCaller(this); 508 if (!SUCCEEDED(autoCaller.rc())) return; 509 510 AutoWriteLock alock(this); 511 511 LogAleksey(("{%p} " LOG_FN_FMT ": obj=%p\n", this, __PRETTY_FUNCTION__, (void *)aObject)); 512 512 MetricList::iterator it; … … 524 524 void PerformanceCollector::suspendSampling() 525 525 { 526 AutoCaller autoCaller 527 if (!SUCCEEDED 526 AutoCaller autoCaller(this); 527 if (!SUCCEEDED(autoCaller.rc())) return; 528 528 529 529 int rc = RTTimerLRStop(m.sampler); … … 533 533 void PerformanceCollector::resumeSampling() 534 534 { 535 AutoCaller autoCaller 536 if (!SUCCEEDED 535 AutoCaller autoCaller(this); 536 if (!SUCCEEDED(autoCaller.rc())) return; 537 537 538 538 int rc = RTTimerLRStart(m.sampler, 0); … … 561 561 { 562 562 Log4(("{%p} " LOG_FN_FMT ": ENTER\n", this, __PRETTY_FUNCTION__)); 563 AutoWriteLock alock 563 AutoWriteLock alock(this); 564 564 565 565 pm::CollectorHints hints; … … 604 604 HRESULT PerformanceMetric::FinalConstruct() 605 605 { 606 LogFlowThisFunc 606 LogFlowThisFunc(("\n")); 607 607 608 608 return S_OK; … … 611 611 void PerformanceMetric::FinalRelease() 612 612 { 613 LogFlowThisFunc 613 LogFlowThisFunc(("\n")); 614 614 615 615 uninit (); … … 654 654 /// AutoReadLock? Is the underlying metric a constant object? 655 655 656 m.name.cloneTo 656 m.name.cloneTo(aMetricName); 657 657 return S_OK; 658 658 } … … 666 666 STDMETHODIMP PerformanceMetric::COMGETTER(Description) (BSTR *aDescription) 667 667 { 668 m.description.cloneTo 668 m.description.cloneTo(aDescription); 669 669 return S_OK; 670 670 } -
trunk/src/VBox/Main/ProgressImpl.cpp
r20220 r21878 103 103 104 104 AutoCaller autoCaller(this); 105 AssertReturn 105 AssertReturn(autoCaller.state() == InInit, E_FAIL); 106 106 107 107 #if !defined (VBOX_COM_INPROC) 108 AssertReturn 108 AssertReturn(aParent, E_INVALIDARG); 109 109 #else 110 AssertReturn 110 AssertReturn(aInitiator, E_INVALIDARG); 111 111 #endif 112 112 113 AssertReturn 113 AssertReturn(aDescription, E_INVALIDARG); 114 114 115 115 #if !defined (VBOX_COM_INPROC) 116 116 /* share parent weakly */ 117 unconst 117 unconst(mParent) = aParent; 118 118 119 119 /* register with parent early, since uninit() will unconditionally … … 127 127 * that it is the same as the parent */ 128 128 if (aInitiator && !mParent.equalsTo (aInitiator)) 129 unconst 129 unconst(mInitiator) = aInitiator; 130 130 #else 131 unconst 131 unconst(mInitiator) = aInitiator; 132 132 #endif 133 133 134 unconst 134 unconst(mId).create(); 135 135 if (aId) 136 mId.cloneTo 136 mId.cloneTo(aId); 137 137 138 138 #if !defined (VBOX_COM_INPROC) … … 142 142 #endif 143 143 144 unconst 144 unconst(mDescription) = aDescription; 145 145 146 146 return S_OK; … … 181 181 /* release initiator (effective only if mInitiator has been assigned in 182 182 * init()) */ 183 unconst 183 unconst(mInitiator).setNull(); 184 184 185 185 #if !defined (VBOX_COM_INPROC) … … 192 192 mParent->removeDependentChild (this); 193 193 194 unconst 194 unconst(mParent).setNull(); 195 195 } 196 196 #endif … … 208 208 209 209 /* mId is constant during life time, no need to lock */ 210 mId.toUtf16().cloneTo 210 mId.toUtf16().cloneTo(aId); 211 211 212 212 return S_OK; … … 221 221 222 222 /* mDescription is constant during life time, no need to lock */ 223 mDescription.cloneTo 223 mDescription.cloneTo(aDescription); 224 224 225 225 return S_OK; … … 237 237 #if !defined (VBOX_COM_INPROC) 238 238 if (mInitiator) 239 mInitiator.queryInterfaceTo 239 mInitiator.queryInterfaceTo(aInitiator); 240 240 else 241 mParent.queryInterfaceTo 241 mParent.queryInterfaceTo(aInitiator); 242 242 #else 243 mInitiator.queryInterfaceTo 243 mInitiator.queryInterfaceTo(aInitiator); 244 244 #endif 245 245 … … 254 254 CheckComRCReturnRC(autoCaller.rc()); 255 255 256 AutoReadLock alock 256 AutoReadLock alock(this); 257 257 258 258 *aCancelable = mCancelable; … … 325 325 AutoReadLock alock(this); 326 326 327 if (mCompleted && SUCCEEDED 327 if (mCompleted && SUCCEEDED(mResultCode)) 328 328 *aPercent = 100; 329 329 else … … 351 351 CheckComRCReturnRC(autoCaller.rc()); 352 352 353 AutoReadLock alock 353 AutoReadLock alock(this); 354 354 355 355 *aCompleted = mCompleted; … … 365 365 CheckComRCReturnRC(autoCaller.rc()); 366 366 367 AutoReadLock alock 367 AutoReadLock alock(this); 368 368 369 369 *aCanceled = mCanceled; … … 379 379 CheckComRCReturnRC(autoCaller.rc()); 380 380 381 AutoReadLock alock 381 AutoReadLock alock(this); 382 382 383 383 if (!mCompleted) … … 397 397 CheckComRCReturnRC(autoCaller.rc()); 398 398 399 AutoReadLock alock 399 AutoReadLock alock(this); 400 400 401 401 if (!mCompleted) … … 403 403 tr ("Error info is not available, operation is still in progress")); 404 404 405 mErrorInfo.queryInterfaceTo 405 mErrorInfo.queryInterfaceTo(aErrorInfo); 406 406 407 407 return S_OK; … … 415 415 CheckComRCReturnRC(autoCaller.rc()); 416 416 417 AutoReadLock alock 417 AutoReadLock alock(this); 418 418 419 419 *aOperationCount = m_cOperations; … … 429 429 CheckComRCReturnRC(autoCaller.rc()); 430 430 431 AutoReadLock alock 431 AutoReadLock alock(this); 432 432 433 433 *aOperation = m_ulCurrentOperation; … … 443 443 CheckComRCReturnRC(autoCaller.rc()); 444 444 445 AutoReadLock alock 445 AutoReadLock alock(this); 446 446 447 447 m_bstrOperationDescription.cloneTo(aOperationDescription); … … 457 457 CheckComRCReturnRC(autoCaller.rc()); 458 458 459 AutoReadLock alock 460 461 if (mCompleted && SUCCEEDED 459 AutoReadLock alock(this); 460 461 if (mCompleted && SUCCEEDED(mResultCode)) 462 462 *aOperationPercent = 100; 463 463 else … … 490 490 HRESULT ProgressBase::setErrorInfoOnThread (IProgress *aProgress) 491 491 { 492 AssertReturn 492 AssertReturn(aProgress != NULL, E_INVALIDARG); 493 493 494 494 LONG iRc; 495 495 HRESULT rc = aProgress->COMGETTER(ResultCode) (&iRc); 496 AssertComRCReturnRC 496 AssertComRCReturnRC(rc); 497 497 HRESULT resultCode = iRc; 498 498 … … 500 500 return resultCode; 501 501 502 ComPtr 502 ComPtr<IVirtualBoxErrorInfo> errorInfo; 503 503 rc = aProgress->COMGETTER(ErrorInfo) (errorInfo.asOutParam()); 504 AssertComRCReturnRC 504 AssertComRCReturnRC(rc); 505 505 506 506 if (!errorInfo.isNull()) … … 517 517 { 518 518 HRESULT rc = ProgressBase::FinalConstruct(); 519 CheckComRCReturnRC 519 CheckComRCReturnRC(rc); 520 520 521 521 mCompletedSem = NIL_RTSEMEVENTMULTI; … … 592 592 OUT_GUID aId /* = NULL */) 593 593 { 594 LogFlowThisFunc 594 LogFlowThisFunc(("aDescription=\"%ls\"\n", aDescription)); 595 595 596 596 AssertReturn(bstrFirstOperationDescription, E_INVALIDARG); … … 598 598 599 599 /* Enclose the state transition NotReady->InInit->Ready */ 600 AutoInitSpan autoInitSpan 601 AssertReturn 600 AutoInitSpan autoInitSpan(this); 601 AssertReturn(autoInitSpan.isOk(), E_FAIL); 602 602 603 603 HRESULT rc = S_OK; … … 608 608 #endif 609 609 aInitiator, aDescription, aId); 610 CheckComRCReturnRC 610 CheckComRCReturnRC(rc); 611 611 612 612 mCancelable = aCancelable; … … 626 626 627 627 /* Confirm a successful initialization when it's the case */ 628 if (SUCCEEDED 628 if (SUCCEEDED(rc)) 629 629 autoInitSpan.setSucceeded(); 630 630 … … 651 651 CBSTR aOperationDescription) 652 652 { 653 LogFlowThisFunc 653 LogFlowThisFunc(("aOperationDescription=\"%ls\"\n", aOperationDescription)); 654 654 655 655 /* Enclose the state transition NotReady->InInit->Ready */ 656 AutoInitSpan autoInitSpan 657 AssertReturn 656 AutoInitSpan autoInitSpan(this); 657 AssertReturn(autoInitSpan.isOk(), E_FAIL); 658 658 659 659 HRESULT rc = S_OK; 660 660 661 661 rc = ProgressBase::protectedInit (autoInitSpan); 662 CheckComRCReturnRC 662 CheckComRCReturnRC(rc); 663 663 664 664 mCancelable = aCancelable; … … 680 680 681 681 /* Confirm a successful initialization when it's the case */ 682 if (SUCCEEDED 682 if (SUCCEEDED(rc)) 683 683 autoInitSpan.setSucceeded(); 684 684 … … 693 693 void Progress::uninit() 694 694 { 695 LogFlowThisFunc 695 LogFlowThisFunc(("\n")); 696 696 697 697 /* Enclose the state transition Ready->InUninit->NotReady */ 698 AutoUninitSpan autoUninitSpan 698 AutoUninitSpan autoUninitSpan(this); 699 699 if (autoUninitSpan.uninitDone()) 700 700 return; … … 728 728 { 729 729 LogFlowThisFuncEnter(); 730 LogFlowThisFunc 730 LogFlowThisFunc(("aTimeout=%d\n", aTimeout)); 731 731 732 732 AutoCaller autoCaller(this); … … 759 759 RTSemEventMultiReset (mCompletedSem); 760 760 761 if (RT_FAILURE 761 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 762 762 break; 763 763 … … 770 770 } 771 771 772 if (RT_FAILURE 772 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 773 773 return setError (VBOX_E_IPRT_ERROR, 774 774 tr ("Failed to wait for the task completion (%Rrc)"), vrc); … … 789 789 { 790 790 LogFlowThisFuncEnter(); 791 LogFlowThisFunc 791 LogFlowThisFunc(("aOperation=%d, aTimeout=%d\n", aOperation, aTimeout)); 792 792 793 793 AutoCaller autoCaller(this); … … 826 826 RTSemEventMultiReset (mCompletedSem); 827 827 828 if (RT_FAILURE 828 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 829 829 break; 830 830 … … 837 837 } 838 838 839 if (RT_FAILURE 839 if (RT_FAILURE(vrc) && vrc != VERR_TIMEOUT) 840 840 return setError (E_FAIL, 841 841 tr ("Failed to wait for the operation completion (%Rrc)"), vrc); … … 874 874 { 875 875 AutoCaller autoCaller(this); 876 AssertComRCReturnRC 876 AssertComRCReturnRC(autoCaller.rc()); 877 877 878 878 AutoWriteLock alock(this); … … 886 886 } 887 887 else 888 AssertReturn 888 AssertReturn(!mCompleted && !mCanceled, E_FAIL); 889 889 890 890 m_ulOperationPercent = aPercent; … … 906 906 907 907 AutoCaller autoCaller(this); 908 AssertComRCReturnRC 909 910 AutoWriteLock alock(this); 911 912 AssertReturn 913 AssertReturn 908 AssertComRCReturnRC(autoCaller.rc()); 909 910 AutoWriteLock alock(this); 911 912 AssertReturn(!mCompleted && !mCanceled, E_FAIL); 913 AssertReturn(m_ulCurrentOperation + 1 < m_cOperations, E_FAIL); 914 914 915 915 ++m_ulCurrentOperation; … … 938 938 * such case). 939 939 * 940 * If the result code indicates a success (|SUCCEEDED 940 * If the result code indicates a success (|SUCCEEDED(@a aResultCode)|) then 941 941 * the current operation is set to the last. 942 942 * … … 949 949 { 950 950 AutoCaller autoCaller(this); 951 AssertComRCReturnRC 952 953 AutoWriteLock alock(this); 954 955 AssertReturn 951 AssertComRCReturnRC(autoCaller.rc()); 952 953 AutoWriteLock alock(this); 954 955 AssertReturn(mCompleted == FALSE, E_FAIL); 956 956 957 957 if (mCanceled && SUCCEEDED(aResultCode)) … … 969 969 #if !defined (VBOX_WITH_XPCOM) 970 970 971 ComPtr 971 ComPtr<IErrorInfo> err; 972 972 rc = ::GetErrorInfo (0, err.asOutParam()); 973 973 if (rc == S_OK && err) 974 974 { 975 rc = err.queryInterfaceTo 976 if (SUCCEEDED 975 rc = err.queryInterfaceTo(mErrorInfo.asOutParam()); 976 if (SUCCEEDED(rc) && !mErrorInfo) 977 977 rc = E_FAIL; 978 978 } … … 982 982 nsCOMPtr <nsIExceptionService> es; 983 983 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 984 if (NS_SUCCEEDED 984 if (NS_SUCCEEDED(rc)) 985 985 { 986 986 nsCOMPtr <nsIExceptionManager> em; 987 987 rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); 988 if (NS_SUCCEEDED 988 if (NS_SUCCEEDED(rc)) 989 989 { 990 ComPtr 990 ComPtr<nsIException> ex; 991 991 rc = em->GetCurrentException (ex.asOutParam()); 992 if (NS_SUCCEEDED 992 if (NS_SUCCEEDED(rc) && ex) 993 993 { 994 rc = ex.queryInterfaceTo 995 if (NS_SUCCEEDED 994 rc = ex.queryInterfaceTo(mErrorInfo.asOutParam()); 995 if (NS_SUCCEEDED(rc) && !mErrorInfo) 996 996 rc = E_FAIL; 997 997 } … … 1065 1065 { 1066 1066 AutoCaller autoCaller(this); 1067 AssertComRCReturnRC 1068 1069 AutoWriteLock alock(this); 1070 1071 AssertReturn 1067 AssertComRCReturnRC(autoCaller.rc()); 1068 1069 AutoWriteLock alock(this); 1070 1071 AssertReturn(mCompleted == FALSE, E_FAIL); 1072 1072 1073 1073 if (mCanceled && SUCCEEDED(aResultCode)) … … 1077 1077 mResultCode = aResultCode; 1078 1078 1079 AssertReturn 1080 1081 ComObjPtr 1079 AssertReturn(FAILED (aResultCode), E_FAIL); 1080 1081 ComObjPtr<VirtualBoxErrorInfo> errorInfo; 1082 1082 HRESULT rc = errorInfo.createObject(); 1083 1083 AssertComRC (rc); 1084 if (SUCCEEDED 1084 if (SUCCEEDED(rc)) 1085 1085 { 1086 1086 errorInfo->init (aResultCode, aIID, aComponent, aText); 1087 errorInfo.queryInterfaceTo 1087 errorInfo.queryInterfaceTo(mErrorInfo.asOutParam()); 1088 1088 } 1089 1089 … … 1108 1108 { 1109 1109 HRESULT rc = ProgressBase::FinalConstruct(); 1110 CheckComRCReturnRC 1110 CheckComRCReturnRC(rc); 1111 1111 1112 1112 mProgress = 0; … … 1141 1141 CBSTR aDescription, OUT_GUID aId) 1142 1142 { 1143 LogFlowThisFunc 1143 LogFlowThisFunc(("aDescription={%ls} mProgresses.size()=%d\n", 1144 1144 aDescription, mProgresses.size())); 1145 1145 … … 1151 1151 #endif 1152 1152 aInitiator, aDescription, aId); 1153 CheckComRCReturnRC 1153 CheckComRCReturnRC(rc); 1154 1154 1155 1155 mProgress = 0; /* the first object */ … … 1165 1165 rc = mProgresses [0]->COMGETTER(OperationDescription) ( 1166 1166 m_bstrOperationDescription.asOutParam()); 1167 CheckComRCReturnRC 1167 CheckComRCReturnRC(rc); 1168 1168 1169 1169 for (size_t i = 0; i < mProgresses.size(); i ++) … … 1173 1173 BOOL cancelable = FALSE; 1174 1174 rc = mProgresses [i]->COMGETTER(Cancelable) (&cancelable); 1175 CheckComRCReturnRC 1175 CheckComRCReturnRC(rc); 1176 1176 1177 1177 if (!cancelable) … … 1182 1182 ULONG opCount = 0; 1183 1183 rc = mProgresses [i]->COMGETTER(OperationCount) (&opCount); 1184 CheckComRCReturnRC 1184 CheckComRCReturnRC(rc); 1185 1185 1186 1186 m_cOperations += opCount; … … 1189 1189 1190 1190 rc = checkProgress(); 1191 CheckComRCReturnRC 1191 CheckComRCReturnRC(rc); 1192 1192 1193 1193 return rc; … … 1215 1215 { 1216 1216 /* Enclose the state transition NotReady->InInit->Ready */ 1217 AutoInitSpan autoInitSpan 1218 AssertReturn 1217 AutoInitSpan autoInitSpan(this); 1218 AssertReturn(autoInitSpan.isOk(), E_FAIL); 1219 1219 1220 1220 mProgresses.resize (2); … … 1229 1229 1230 1230 /* Confirm a successful initialization when it's the case */ 1231 if (SUCCEEDED 1231 if (SUCCEEDED(rc)) 1232 1232 autoInitSpan.setSucceeded(); 1233 1233 … … 1242 1242 void CombinedProgress::uninit() 1243 1243 { 1244 LogFlowThisFunc 1244 LogFlowThisFunc(("\n")); 1245 1245 1246 1246 /* Enclose the state transition Ready->InUninit->NotReady */ 1247 AutoUninitSpan autoUninitSpan 1247 AutoUninitSpan autoUninitSpan(this); 1248 1248 if (autoUninitSpan.uninitDone()) 1249 1249 return; … … 1268 1268 AutoWriteLock alock(this); 1269 1269 1270 if (mCompleted && SUCCEEDED 1270 if (mCompleted && SUCCEEDED(mResultCode)) 1271 1271 *aPercent = 100; 1272 1272 else 1273 1273 { 1274 1274 HRESULT rc = checkProgress(); 1275 CheckComRCReturnRC 1275 CheckComRCReturnRC(rc); 1276 1276 1277 1277 /* global percent = … … 1295 1295 1296 1296 HRESULT rc = checkProgress(); 1297 CheckComRCReturnRC 1297 CheckComRCReturnRC(rc); 1298 1298 1299 1299 return ProgressBase::COMGETTER(Completed) (aCompleted); … … 1311 1311 1312 1312 HRESULT rc = checkProgress(); 1313 CheckComRCReturnRC 1313 CheckComRCReturnRC(rc); 1314 1314 1315 1315 return ProgressBase::COMGETTER(Canceled) (aCanceled); … … 1327 1327 1328 1328 HRESULT rc = checkProgress(); 1329 CheckComRCReturnRC 1329 CheckComRCReturnRC(rc); 1330 1330 1331 1331 return ProgressBase::COMGETTER(ResultCode) (aResultCode); … … 1343 1343 1344 1344 HRESULT rc = checkProgress(); 1345 CheckComRCReturnRC 1345 CheckComRCReturnRC(rc); 1346 1346 1347 1347 return ProgressBase::COMGETTER(ErrorInfo) (aErrorInfo); … … 1359 1359 1360 1360 HRESULT rc = checkProgress(); 1361 CheckComRCReturnRC 1361 CheckComRCReturnRC(rc); 1362 1362 1363 1363 return ProgressBase::COMGETTER(Operation) (aOperation); … … 1375 1375 1376 1376 HRESULT rc = checkProgress(); 1377 CheckComRCReturnRC 1377 CheckComRCReturnRC(rc); 1378 1378 1379 1379 return ProgressBase::COMGETTER(OperationDescription) (aOperationDescription); … … 1391 1391 1392 1392 HRESULT rc = checkProgress(); 1393 CheckComRCReturnRC 1393 CheckComRCReturnRC(rc); 1394 1394 1395 1395 return ProgressBase::COMGETTER(OperationPercent) (aOperationPercent); … … 1408 1408 { 1409 1409 LogFlowThisFuncEnter(); 1410 LogFlowThisFunc 1410 LogFlowThisFunc(("aTtimeout=%d\n", aTimeout)); 1411 1411 1412 1412 AutoCaller autoCaller(this); … … 1433 1433 alock.enter(); 1434 1434 1435 if (SUCCEEDED 1435 if (SUCCEEDED(rc)) 1436 1436 rc = checkProgress(); 1437 1437 … … 1446 1446 } 1447 1447 1448 CheckComRCReturnRC 1448 CheckComRCReturnRC(rc); 1449 1449 } 1450 1450 … … 1463 1463 { 1464 1464 LogFlowThisFuncEnter(); 1465 LogFlowThisFunc 1465 LogFlowThisFunc(("aOperation=%d, aTimeout=%d\n", aOperation, aTimeout)); 1466 1466 1467 1467 AutoCaller autoCaller(this); … … 1503 1503 while (1); 1504 1504 1505 LogFlowThisFunc 1505 LogFlowThisFunc(("will wait for mProgresses [%d] (%d)\n", 1506 1506 progress, operation)); 1507 1507 … … 1522 1522 alock.enter(); 1523 1523 1524 if (SUCCEEDED 1524 if (SUCCEEDED(rc)) 1525 1525 rc = checkProgress(); 1526 1526 … … 1535 1535 } 1536 1536 1537 CheckComRCReturnRC 1537 CheckComRCReturnRC(rc); 1538 1538 } 1539 1539 … … 1573 1573 return S_OK; 1574 1574 1575 AssertReturn 1576 1577 ComPtr 1575 AssertReturn(mProgress < mProgresses.size(), E_FAIL); 1576 1577 ComPtr<IProgress> progress = mProgresses [mProgress]; 1578 1578 ComAssertRet (!progress.isNull(), E_FAIL); 1579 1579 … … 1630 1630 1631 1631 rc = progress->COMGETTER(OperationPercent) (&m_ulOperationPercent); 1632 if (SUCCEEDED 1632 if (SUCCEEDED(rc)) 1633 1633 { 1634 1634 ULONG operation = 0; 1635 1635 rc = progress->COMGETTER(Operation) (&operation); 1636 if (SUCCEEDED 1636 if (SUCCEEDED(rc) && mCompletedOperations + operation > m_ulCurrentOperation) 1637 1637 { 1638 1638 m_ulCurrentOperation = mCompletedOperations + operation; -
trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp
r19239 r21878 56 56 HRESULT RemoteUSBDevice::init (uint32_t u32ClientId, VRDPUSBDEVICEDESC *pDevDesc) 57 57 { 58 LogFlowThisFunc 58 LogFlowThisFunc(("u32ClientId=%d,pDevDesc=%p\n", u32ClientId, pDevDesc)); 59 59 60 60 /* Enclose the state transition NotReady->InInit->Ready */ 61 AutoInitSpan autoInitSpan 62 AssertReturn 63 64 unconst 65 66 unconst 67 unconst 68 unconst 69 70 unconst 71 unconst 72 unconst 61 AutoInitSpan autoInitSpan(this); 62 AssertReturn(autoInitSpan.isOk(), E_FAIL); 63 64 unconst(mData.id).create(); 65 66 unconst(mData.vendorId) = pDevDesc->idVendor; 67 unconst(mData.productId) = pDevDesc->idProduct; 68 unconst(mData.revision) = pDevDesc->bcdRev; 69 70 unconst(mData.manufacturer) = pDevDesc->oManufacturer? (char *)pDevDesc + pDevDesc->oManufacturer: ""; 71 unconst(mData.product) = pDevDesc->oProduct? (char *)pDevDesc + pDevDesc->oProduct: ""; 72 unconst(mData.serialNumber) = pDevDesc->oSerialNumber? (char *)pDevDesc + pDevDesc->oSerialNumber: ""; 73 73 74 74 char id[64]; 75 75 RTStrPrintf(id, sizeof (id), REMOTE_USB_BACKEND_PREFIX_S "0x%08X&0x%08X", pDevDesc->id, u32ClientId); 76 unconst 77 78 unconst 79 unconst 80 unconst 76 unconst(mData.address) = id; 77 78 unconst(mData.port) = pDevDesc->idPort; 79 unconst(mData.version) = pDevDesc->bcdUSB >> 8; 80 unconst(mData.portVersion) = mData.version; /** @todo fix this */ 81 81 82 82 mData.state = USBDeviceState_Available; 83 83 84 84 mData.dirty = false; 85 unconst 86 87 unconst 85 unconst(mData.devId) = pDevDesc->id; 86 87 unconst(mData.clientId) = u32ClientId; 88 88 89 89 /* Confirm a successful initialization */ … … 100 100 void RemoteUSBDevice::uninit() 101 101 { 102 LogFlowThisFunc 102 LogFlowThisFunc(("\n")); 103 103 104 104 /* Enclose the state transition Ready->InUninit->NotReady */ 105 AutoUninitSpan autoUninitSpan 105 AutoUninitSpan autoUninitSpan(this); 106 106 if (autoUninitSpan.uninitDone()) 107 107 return; 108 108 109 unconst 110 111 unconst 112 unconst 113 unconst 114 115 unconst 116 unconst 117 unconst 118 119 unconst 120 121 unconst 122 unconst 123 unconst 124 125 unconst 126 127 unconst 128 unconst 109 unconst(mData.id).clear(); 110 111 unconst(mData.vendorId) = 0; 112 unconst(mData.productId) = 0; 113 unconst(mData.revision) = 0; 114 115 unconst(mData.manufacturer).setNull(); 116 unconst(mData.product).setNull(); 117 unconst(mData.serialNumber).setNull(); 118 119 unconst(mData.address).setNull(); 120 121 unconst(mData.port) = 0; 122 unconst(mData.version) = 1; 123 unconst(mData.portVersion) = 1; 124 125 unconst(mData.dirty) = FALSE; 126 127 unconst(mData.devId) = 0; 128 unconst(mData.clientId) = 0; 129 129 } 130 130 … … 136 136 CheckComArgOutPointerValid(aId); 137 137 138 AutoCaller autoCaller 139 CheckComRCReturnRC 140 141 /* this is const, no need to lock */ 142 Bstr(mData.id).cloneTo 138 AutoCaller autoCaller(this); 139 CheckComRCReturnRC(autoCaller.rc()); 140 141 /* this is const, no need to lock */ 142 Bstr(mData.id).cloneTo(aId); 143 143 144 144 return S_OK; … … 149 149 CheckComArgOutPointerValid(aVendorId); 150 150 151 AutoCaller autoCaller 152 CheckComRCReturnRC 151 AutoCaller autoCaller(this); 152 CheckComRCReturnRC(autoCaller.rc()); 153 153 154 154 /* this is const, no need to lock */ … … 162 162 CheckComArgOutPointerValid(aProductId); 163 163 164 AutoCaller autoCaller 165 CheckComRCReturnRC 164 AutoCaller autoCaller(this); 165 CheckComRCReturnRC(autoCaller.rc()); 166 166 167 167 /* this is const, no need to lock */ … … 175 175 CheckComArgOutPointerValid(aRevision); 176 176 177 AutoCaller autoCaller 178 CheckComRCReturnRC 177 AutoCaller autoCaller(this); 178 CheckComRCReturnRC(autoCaller.rc()); 179 179 180 180 /* this is const, no need to lock */ … … 188 188 CheckComArgOutPointerValid(aManufacturer); 189 189 190 AutoCaller autoCaller 191 CheckComRCReturnRC 192 193 /* this is const, no need to lock */ 194 mData.manufacturer.cloneTo 190 AutoCaller autoCaller(this); 191 CheckComRCReturnRC(autoCaller.rc()); 192 193 /* this is const, no need to lock */ 194 mData.manufacturer.cloneTo(aManufacturer); 195 195 196 196 return S_OK; … … 201 201 CheckComArgOutPointerValid(aProduct); 202 202 203 AutoCaller autoCaller 204 CheckComRCReturnRC 205 206 /* this is const, no need to lock */ 207 mData.product.cloneTo 203 AutoCaller autoCaller(this); 204 CheckComRCReturnRC(autoCaller.rc()); 205 206 /* this is const, no need to lock */ 207 mData.product.cloneTo(aProduct); 208 208 209 209 return S_OK; … … 214 214 CheckComArgOutPointerValid(aSerialNumber); 215 215 216 AutoCaller autoCaller 217 CheckComRCReturnRC 218 219 /* this is const, no need to lock */ 220 mData.serialNumber.cloneTo 216 AutoCaller autoCaller(this); 217 CheckComRCReturnRC(autoCaller.rc()); 218 219 /* this is const, no need to lock */ 220 mData.serialNumber.cloneTo(aSerialNumber); 221 221 222 222 return S_OK; … … 227 227 CheckComArgOutPointerValid(aAddress); 228 228 229 AutoCaller autoCaller 230 CheckComRCReturnRC 231 232 /* this is const, no need to lock */ 233 mData.address.cloneTo 229 AutoCaller autoCaller(this); 230 CheckComRCReturnRC(autoCaller.rc()); 231 232 /* this is const, no need to lock */ 233 mData.address.cloneTo(aAddress); 234 234 235 235 return S_OK; … … 240 240 CheckComArgOutPointerValid(aPort); 241 241 242 AutoCaller autoCaller 243 CheckComRCReturnRC 242 AutoCaller autoCaller(this); 243 CheckComRCReturnRC(autoCaller.rc()); 244 244 245 245 /* this is const, no need to lock */ … … 253 253 CheckComArgOutPointerValid(aVersion); 254 254 255 AutoCaller autoCaller 256 CheckComRCReturnRC 255 AutoCaller autoCaller(this); 256 CheckComRCReturnRC(autoCaller.rc()); 257 257 258 258 /* this is const, no need to lock */ … … 266 266 CheckComArgOutPointerValid(aPortVersion); 267 267 268 AutoCaller autoCaller 269 CheckComRCReturnRC 268 AutoCaller autoCaller(this); 269 CheckComRCReturnRC(autoCaller.rc()); 270 270 271 271 /* this is const, no need to lock */ … … 279 279 CheckComArgOutPointerValid(aRemote); 280 280 281 AutoCaller autoCaller 282 CheckComRCReturnRC 281 AutoCaller autoCaller(this); 282 CheckComRCReturnRC(autoCaller.rc()); 283 283 284 284 /* RemoteUSBDevice is always remote. */ … … 296 296 CheckComArgOutPointerValid(aState); 297 297 298 AutoCaller autoCaller 299 CheckComRCReturnRC 300 301 AutoReadLock alock 298 AutoCaller autoCaller(this); 299 CheckComRCReturnRC(autoCaller.rc()); 300 301 AutoReadLock alock(this); 302 302 303 303 *aState = mData.state; -
trunk/src/VBox/Main/SerialPortImpl.cpp
r21607 r21878 56 56 HRESULT SerialPort::init (Machine *aParent, ULONG aSlot) 57 57 { 58 LogFlowThisFunc 58 LogFlowThisFunc(("aParent=%p, aSlot=%d\n", aParent, aSlot)); 59 59 60 60 ComAssertRet (aParent, E_INVALIDARG); 61 61 62 62 /* Enclose the state transition NotReady->InInit->Ready */ 63 AutoInitSpan autoInitSpan 64 AssertReturn 65 66 unconst 63 AutoInitSpan autoInitSpan(this); 64 AssertReturn(autoInitSpan.isOk(), E_FAIL); 65 66 unconst(mParent) = aParent; 67 67 /* mPeer is left null */ 68 68 … … 90 90 HRESULT SerialPort::init (Machine *aParent, SerialPort *aThat) 91 91 { 92 LogFlowThisFunc 92 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 93 93 94 94 ComAssertRet (aParent && aThat, E_INVALIDARG); 95 95 96 96 /* Enclose the state transition NotReady->InInit->Ready */ 97 AutoInitSpan autoInitSpan 98 AssertReturn 99 100 unconst 101 unconst 97 AutoInitSpan autoInitSpan(this); 98 AssertReturn(autoInitSpan.isOk(), E_FAIL); 99 100 unconst(mParent) = aParent; 101 unconst(mPeer) = aThat; 102 102 103 103 AutoCaller thatCaller (aThat); 104 AssertComRCReturnRC 104 AssertComRCReturnRC(thatCaller.rc()); 105 105 106 106 AutoReadLock thatLock (aThat); … … 122 122 HRESULT SerialPort::initCopy (Machine *aParent, SerialPort *aThat) 123 123 { 124 LogFlowThisFunc 124 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 125 125 126 126 ComAssertRet (aParent && aThat, E_INVALIDARG); 127 127 128 128 /* Enclose the state transition NotReady->InInit->Ready */ 129 AutoInitSpan autoInitSpan 130 AssertReturn 131 132 unconst 129 AutoInitSpan autoInitSpan(this); 130 AssertReturn(autoInitSpan.isOk(), E_FAIL); 131 132 unconst(mParent) = aParent; 133 133 /* mPeer is left null */ 134 134 135 135 AutoCaller thatCaller (aThat); 136 AssertComRCReturnRC 136 AssertComRCReturnRC(thatCaller.rc()); 137 137 138 138 AutoReadLock thatLock (aThat); … … 151 151 void SerialPort::uninit() 152 152 { 153 LogFlowThisFunc 153 LogFlowThisFunc(("\n")); 154 154 155 155 /* Enclose the state transition Ready->InUninit->NotReady */ 156 AutoUninitSpan autoUninitSpan 156 AutoUninitSpan autoUninitSpan(this); 157 157 if (autoUninitSpan.uninitDone()) 158 158 return; … … 160 160 mData.free(); 161 161 162 unconst 163 unconst 162 unconst(mPeer).setNull(); 163 unconst(mParent).setNull(); 164 164 } 165 165 … … 179 179 using namespace settings; 180 180 181 AssertReturn 182 183 AutoCaller autoCaller 184 AssertComRCReturnRC 185 186 AutoWriteLock alock 181 AssertReturn(!aPortNode.isNull(), E_FAIL); 182 183 AutoCaller autoCaller(this); 184 AssertComRCReturnRC(autoCaller.rc()); 185 186 AutoWriteLock alock(this); 187 187 188 188 /* Note: we assume that the default values for attributes of optional … … 219 219 Bstr path = aPortNode.stringValue ("path"); 220 220 HRESULT rc = checkSetPath (path); 221 CheckComRCReturnRC 221 CheckComRCReturnRC(rc); 222 222 mData->mPath = path; 223 223 … … 241 241 using namespace settings; 242 242 243 AssertReturn 244 245 AutoCaller autoCaller 246 AssertComRCReturnRC 247 248 AutoReadLock alock 243 AssertReturn(!aPortNode.isNull(), E_FAIL); 244 245 AutoCaller autoCaller(this); 246 AssertComRCReturnRC(autoCaller.rc()); 247 248 AutoReadLock alock(this); 249 249 250 250 aPortNode.setValue <bool> ("enabled", !!mData->mEnabled); … … 291 291 { 292 292 /* sanity */ 293 AutoCaller autoCaller 293 AutoCaller autoCaller(this); 294 294 AssertComRCReturn (autoCaller.rc(), false); 295 295 296 AutoWriteLock alock 296 AutoWriteLock alock(this); 297 297 298 298 bool changed = false; … … 316 316 { 317 317 /* sanity */ 318 AutoCaller autoCaller 318 AutoCaller autoCaller(this); 319 319 AssertComRCReturnVoid (autoCaller.rc()); 320 320 … … 347 347 348 348 /* sanity */ 349 AutoCaller autoCaller 349 AutoCaller autoCaller(this); 350 350 AssertComRCReturnVoid (autoCaller.rc()); 351 351 … … 367 367 368 368 /* sanity */ 369 AutoCaller autoCaller 369 AutoCaller autoCaller(this); 370 370 AssertComRCReturnVoid (autoCaller.rc()); 371 371 372 AutoWriteLock alock 372 AutoWriteLock alock(this); 373 373 374 374 uint32_t numSerialEnabled = aOsType->numSerialEnabled(); … … 388 388 CheckComArgOutPointerValid(aEnabled); 389 389 390 AutoCaller autoCaller 391 CheckComRCReturnRC 392 393 AutoReadLock alock 390 AutoCaller autoCaller(this); 391 CheckComRCReturnRC(autoCaller.rc()); 392 393 AutoReadLock alock(this); 394 394 395 395 *aEnabled = mData->mEnabled; … … 400 400 STDMETHODIMP SerialPort::COMSETTER(Enabled) (BOOL aEnabled) 401 401 { 402 LogFlowThisFunc 403 404 AutoCaller autoCaller 405 CheckComRCReturnRC 402 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 403 404 AutoCaller autoCaller(this); 405 CheckComRCReturnRC(autoCaller.rc()); 406 406 407 407 /* the machine needs to be mutable */ 408 408 Machine::AutoMutableStateDependency adep (mParent); 409 CheckComRCReturnRC 410 411 AutoWriteLock alock 409 CheckComRCReturnRC(adep.rc()); 410 411 AutoWriteLock alock(this); 412 412 413 413 if (mData->mEnabled != aEnabled) … … 429 429 CheckComArgOutPointerValid(aHostMode); 430 430 431 AutoCaller autoCaller 432 CheckComRCReturnRC 433 434 AutoReadLock alock 431 AutoCaller autoCaller(this); 432 CheckComRCReturnRC(autoCaller.rc()); 433 434 AutoReadLock alock(this); 435 435 436 436 *aHostMode = mData->mHostMode; … … 441 441 STDMETHODIMP SerialPort::COMSETTER(HostMode) (PortMode_T aHostMode) 442 442 { 443 AutoCaller autoCaller 444 CheckComRCReturnRC 443 AutoCaller autoCaller(this); 444 CheckComRCReturnRC(autoCaller.rc()); 445 445 446 446 /* the machine needs to be mutable */ 447 447 Machine::AutoMutableStateDependency adep (mParent); 448 CheckComRCReturnRC 449 450 AutoWriteLock alock 448 CheckComRCReturnRC(adep.rc()); 449 450 AutoWriteLock alock(this); 451 451 452 452 HRESULT rc = S_OK; … … 503 503 CheckComArgOutPointerValid(aSlot); 504 504 505 AutoCaller autoCaller 506 CheckComRCReturnRC 507 508 AutoReadLock alock 505 AutoCaller autoCaller(this); 506 CheckComRCReturnRC(autoCaller.rc()); 507 508 AutoReadLock alock(this); 509 509 510 510 *aSlot = mData->mSlot; … … 517 517 CheckComArgOutPointerValid(aIRQ); 518 518 519 AutoCaller autoCaller 520 CheckComRCReturnRC 521 522 AutoReadLock alock 519 AutoCaller autoCaller(this); 520 CheckComRCReturnRC(autoCaller.rc()); 521 522 AutoReadLock alock(this); 523 523 524 524 *aIRQ = mData->mIRQ; … … 537 537 mData->mSlot, aIRQ, 255); 538 538 539 AutoCaller autoCaller 540 CheckComRCReturnRC 539 AutoCaller autoCaller(this); 540 CheckComRCReturnRC(autoCaller.rc()); 541 541 542 542 /* the machine needs to be mutable */ 543 543 Machine::AutoMutableStateDependency adep (mParent); 544 CheckComRCReturnRC 545 546 AutoWriteLock alock 544 CheckComRCReturnRC(adep.rc()); 545 546 AutoWriteLock alock(this); 547 547 548 548 HRESULT rc = S_OK; … … 571 571 CheckComArgOutPointerValid(aIOBase); 572 572 573 AutoCaller autoCaller 574 CheckComRCReturnRC 575 576 AutoReadLock alock 573 AutoCaller autoCaller(this); 574 CheckComRCReturnRC(autoCaller.rc()); 575 576 AutoReadLock alock(this); 577 577 578 578 *aIOBase = mData->mIOBase; … … 591 591 mData->mSlot, aIOBase, 0, 0xFFFF); 592 592 593 AutoCaller autoCaller 594 CheckComRCReturnRC 593 AutoCaller autoCaller(this); 594 CheckComRCReturnRC(autoCaller.rc()); 595 595 596 596 /* the machine needs to be mutable */ 597 597 Machine::AutoMutableStateDependency adep (mParent); 598 CheckComRCReturnRC 599 600 AutoWriteLock alock 598 CheckComRCReturnRC(adep.rc()); 599 600 AutoWriteLock alock(this); 601 601 602 602 HRESULT rc = S_OK; … … 625 625 CheckComArgOutPointerValid(aPath); 626 626 627 AutoCaller autoCaller 628 CheckComRCReturnRC 629 630 AutoReadLock alock 631 632 mData->mPath.cloneTo 627 AutoCaller autoCaller(this); 628 CheckComRCReturnRC(autoCaller.rc()); 629 630 AutoReadLock alock(this); 631 632 mData->mPath.cloneTo(aPath); 633 633 634 634 return S_OK; … … 640 640 HRESULT SerialPort::checkSetPath (CBSTR aPath) 641 641 { 642 AssertReturn 642 AssertReturn(isWriteLockOnCurrentThread(), E_FAIL); 643 643 644 644 if ((mData->mHostMode == PortMode_HostDevice || … … 656 656 STDMETHODIMP SerialPort::COMSETTER(Path) (IN_BSTR aPath) 657 657 { 658 AutoCaller autoCaller 659 CheckComRCReturnRC 658 AutoCaller autoCaller(this); 659 CheckComRCReturnRC(autoCaller.rc()); 660 660 661 661 /* the machine needs to be mutable */ 662 662 Machine::AutoMutableStateDependency adep (mParent); 663 CheckComRCReturnRC 664 665 AutoWriteLock alock 663 CheckComRCReturnRC(adep.rc()); 664 665 AutoWriteLock alock(this); 666 666 667 667 /* we treat empty as null when e.g. saving to XML, do the same here */ … … 672 672 { 673 673 HRESULT rc = checkSetPath (aPath); 674 CheckComRCReturnRC 674 CheckComRCReturnRC(rc); 675 675 676 676 mData.backup(); … … 690 690 CheckComArgOutPointerValid(aServer); 691 691 692 AutoCaller autoCaller 693 CheckComRCReturnRC 694 695 AutoReadLock alock 692 AutoCaller autoCaller(this); 693 CheckComRCReturnRC(autoCaller.rc()); 694 695 AutoReadLock alock(this); 696 696 697 697 *aServer = mData->mServer; … … 702 702 STDMETHODIMP SerialPort::COMSETTER(Server) (BOOL aServer) 703 703 { 704 AutoCaller autoCaller 705 CheckComRCReturnRC 704 AutoCaller autoCaller(this); 705 CheckComRCReturnRC(autoCaller.rc()); 706 706 707 707 /* the machine needs to be mutable */ 708 708 Machine::AutoMutableStateDependency adep (mParent); 709 CheckComRCReturnRC 710 711 AutoWriteLock alock 709 CheckComRCReturnRC(adep.rc()); 710 711 AutoWriteLock alock(this); 712 712 713 713 if (mData->mServer != aServer) -
trunk/src/VBox/Main/SessionImpl.cpp
r21697 r21878 62 62 HRESULT Session::FinalConstruct() 63 63 { 64 LogFlowThisFunc 64 LogFlowThisFunc(("\n")); 65 65 66 66 return init(); … … 69 69 void Session::FinalRelease() 70 70 { 71 LogFlowThisFunc 71 LogFlowThisFunc(("\n")); 72 72 73 73 uninit (true /* aFinalRelease */); … … 83 83 { 84 84 /* Enclose the state transition NotReady->InInit->Ready */ 85 AutoInitSpan autoInitSpan 86 AssertReturn 85 AutoInitSpan autoInitSpan(this); 86 AssertReturn(autoInitSpan.isOk(), E_FAIL); 87 87 88 88 LogFlowThisFuncEnter(); … … 119 119 { 120 120 LogFlowThisFuncEnter(); 121 LogFlowThisFunc 121 LogFlowThisFunc(("aFinalRelease=%d\n", aFinalRelease)); 122 122 123 123 /* Enclose the state transition Ready->InUninit->NotReady */ 124 AutoUninitSpan autoUninitSpan 124 AutoUninitSpan autoUninitSpan(this); 125 125 if (autoUninitSpan.uninitDone()) 126 126 { 127 LogFlowThisFunc 127 LogFlowThisFunc(("Already uninitialized.\n")); 128 128 LogFlowThisFuncLeave(); 129 129 return; … … 131 131 132 132 /* close() needs write lock */ 133 AutoWriteLock alock 133 AutoWriteLock alock(this); 134 134 135 135 if (mState != SessionState_Closed) … … 152 152 CheckComArgOutPointerValid(aState); 153 153 154 AutoCaller autoCaller 155 CheckComRCReturnRC 156 157 AutoReadLock alock 154 AutoCaller autoCaller(this); 155 CheckComRCReturnRC(autoCaller.rc()); 156 157 AutoReadLock alock(this); 158 158 159 159 *aState = mState; … … 166 166 CheckComArgOutPointerValid(aType); 167 167 168 AutoCaller autoCaller 169 CheckComRCReturnRC 170 171 AutoReadLock alock 168 AutoCaller autoCaller(this); 169 CheckComRCReturnRC(autoCaller.rc()); 170 171 AutoReadLock alock(this); 172 172 173 173 CHECK_OPEN(); … … 181 181 CheckComArgOutPointerValid(aMachine); 182 182 183 AutoCaller autoCaller 184 CheckComRCReturnRC 185 186 AutoReadLock alock 183 AutoCaller autoCaller(this); 184 CheckComRCReturnRC(autoCaller.rc()); 185 186 AutoReadLock alock(this); 187 187 188 188 CHECK_OPEN(); … … 191 191 192 192 if (mConsole) 193 rc = mConsole->machine().queryInterfaceTo 193 rc = mConsole->machine().queryInterfaceTo(aMachine); 194 194 else 195 rc = mRemoteMachine.queryInterfaceTo 195 rc = mRemoteMachine.queryInterfaceTo(aMachine); 196 196 ComAssertComRC (rc); 197 197 … … 203 203 CheckComArgOutPointerValid(aConsole); 204 204 205 AutoCaller autoCaller 206 CheckComRCReturnRC 207 208 AutoReadLock alock 205 AutoCaller autoCaller(this); 206 CheckComRCReturnRC(autoCaller.rc()); 207 208 AutoReadLock alock(this); 209 209 210 210 CHECK_OPEN(); … … 213 213 214 214 if (mConsole) 215 rc = mConsole.queryInterfaceTo 215 rc = mConsole.queryInterfaceTo(aConsole); 216 216 else 217 rc = mRemoteConsole.queryInterfaceTo 217 rc = mRemoteConsole.queryInterfaceTo(aConsole); 218 218 ComAssertComRC (rc); 219 219 … … 226 226 STDMETHODIMP Session::Close() 227 227 { 228 LogFlowThisFunc 229 230 AutoCaller autoCaller 231 CheckComRCReturnRC 228 LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); 229 230 AutoCaller autoCaller(this); 231 CheckComRCReturnRC(autoCaller.rc()); 232 232 233 233 /* close() needs write lock */ 234 AutoWriteLock alock 234 AutoWriteLock alock(this); 235 235 236 236 CHECK_OPEN(); … … 244 244 STDMETHODIMP Session::GetPID (ULONG *aPid) 245 245 { 246 AssertReturn 247 248 AutoCaller autoCaller 249 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 250 251 AutoReadLock alock 246 AssertReturn(aPid, E_POINTER); 247 248 AutoCaller autoCaller(this); 249 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 250 251 AutoReadLock alock(this); 252 252 253 253 *aPid = (ULONG) RTProcSelf(); … … 260 260 { 261 261 LogFlowThisFuncEnter(); 262 AssertReturn 263 264 AutoCaller autoCaller 265 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 266 267 AutoReadLock alock 268 269 AssertReturn 262 AssertReturn(aConsole, E_POINTER); 263 264 AutoCaller autoCaller(this); 265 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 266 267 AutoReadLock alock(this); 268 269 AssertReturn(mState != SessionState_Closed, VBOX_E_INVALID_VM_STATE); 270 270 271 271 AssertMsgReturn (mType == SessionType_Direct && !!mConsole, … … 277 277 return VBOX_E_INVALID_VM_STATE; 278 278 279 mConsole.queryInterfaceTo 279 mConsole.queryInterfaceTo(aConsole); 280 280 281 281 LogFlowThisFuncLeave(); … … 287 287 { 288 288 LogFlowThisFuncEnter(); 289 LogFlowThisFunc 290 291 AutoCaller autoCaller 292 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 293 294 AutoWriteLock alock 295 296 AssertReturn 289 LogFlowThisFunc(("aMachine=%p\n", aMachine)); 290 291 AutoCaller autoCaller(this); 292 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 293 294 AutoWriteLock alock(this); 295 296 AssertReturn(mState == SessionState_Closed, VBOX_E_INVALID_VM_STATE); 297 297 298 298 if (!aMachine) … … 305 305 */ 306 306 307 AssertReturn 307 AssertReturn(mType == SessionType_Null, VBOX_E_INVALID_OBJECT_STATE); 308 308 mType = SessionType_Remote; 309 309 mState = SessionState_Spawning; … … 317 317 /* query IInternalMachineControl interface */ 318 318 mControl = aMachine; 319 AssertReturn 319 AssertReturn(!!mControl, E_FAIL); 320 320 321 321 rc = mConsole.createObject(); … … 331 331 * until the session is closed 332 332 */ 333 if (SUCCEEDED 333 if (SUCCEEDED(rc)) 334 334 rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam()); 335 335 336 if (SUCCEEDED 336 if (SUCCEEDED(rc)) 337 337 { 338 338 mType = SessionType_Direct; … … 347 347 } 348 348 349 LogFlowThisFunc 349 LogFlowThisFunc(("rc=%08X\n", rc)); 350 350 LogFlowThisFuncLeave(); 351 351 … … 356 356 { 357 357 LogFlowThisFuncEnter(); 358 LogFlowThisFunc 359 360 AssertReturn 361 362 AutoCaller autoCaller 363 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 364 365 AutoWriteLock alock 366 367 AssertReturn 358 LogFlowThisFunc(("aMachine=%p, aConsole=%p\n", aMachine, aConsole)); 359 360 AssertReturn(aMachine && aConsole, E_INVALIDARG); 361 362 AutoCaller autoCaller(this); 363 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 364 365 AutoWriteLock alock(this); 366 367 AssertReturn(mState == SessionState_Closed || 368 368 mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE); 369 369 … … 372 372 /* query IInternalMachineControl interface */ 373 373 mControl = aMachine; 374 AssertReturn 374 AssertReturn(!!mControl, E_FAIL); // This test appears to be redundant --JS 375 375 376 376 /// @todo (dmik) … … 399 399 rc = aMachine->COMGETTER(Parent) (mVirtualBox.asOutParam()); 400 400 401 if (SUCCEEDED 401 if (SUCCEEDED(rc)) 402 402 { 403 403 /* … … 420 420 } 421 421 422 LogFlowThisFunc 422 LogFlowThisFunc(("rc=%08X\n", rc)); 423 423 LogFlowThisFuncLeave(); 424 424 … … 428 428 STDMETHODIMP Session::UpdateMachineState (MachineState_T aMachineState) 429 429 { 430 AutoCaller autoCaller 430 AutoCaller autoCaller(this); 431 431 432 432 if (autoCaller.state() != Ready) … … 436 436 * return silently (not interested in the state change during uninit) 437 437 */ 438 LogFlowThisFunc 438 LogFlowThisFunc(("Already uninitialized.\n")); 439 439 return S_OK; 440 440 } 441 441 442 AutoReadLock alock 442 AutoReadLock alock(this); 443 443 444 444 if (mState == SessionState_Closing) 445 445 { 446 LogFlowThisFunc 446 LogFlowThisFunc(("Already being closed.\n")); 447 447 return S_OK; 448 448 } 449 449 450 AssertReturn 451 AssertReturn 452 453 AssertReturn 454 AssertReturn 450 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 451 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 452 453 AssertReturn(!mControl.isNull(), E_FAIL); 454 AssertReturn(!mConsole.isNull(), E_FAIL); 455 455 456 456 return mConsole->updateMachineState (aMachineState); … … 461 461 LogFlowThisFuncEnter(); 462 462 463 AutoCaller autoCaller 463 AutoCaller autoCaller(this); 464 464 465 465 HRESULT rc = S_OK; … … 468 468 { 469 469 /* close() needs write lock */ 470 AutoWriteLock alock 471 472 LogFlowThisFunc 470 AutoWriteLock alock(this); 471 472 LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); 473 473 474 474 if (mState == SessionState_Closing) 475 475 { 476 LogFlowThisFunc 476 LogFlowThisFunc(("Already being closed.\n")); 477 477 return S_OK; 478 478 } 479 479 480 AssertReturn 480 AssertReturn(mState == SessionState_Open || 481 481 mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE); 482 482 … … 490 490 * return silently 491 491 */ 492 LogFlowThisFunc 492 LogFlowThisFunc(("Already uninitialized.\n")); 493 493 } 494 494 else 495 495 { 496 LogWarningThisFunc 496 LogWarningThisFunc(("UNEXPECTED uninitialization!\n")); 497 497 rc = autoCaller.rc(); 498 498 } 499 499 500 LogFlowThisFunc 500 LogFlowThisFunc(("rc=%08X\n", rc)); 501 501 LogFlowThisFuncLeave(); 502 502 … … 506 506 STDMETHODIMP Session::OnDVDDriveChange() 507 507 { 508 LogFlowThisFunc 509 510 AutoCaller autoCaller 511 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 512 513 AutoReadLock alock 514 AssertReturn 515 AssertReturn 508 LogFlowThisFunc(("\n")); 509 510 AutoCaller autoCaller(this); 511 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 512 513 AutoReadLock alock(this); 514 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 515 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 516 516 517 517 return mConsole->onDVDDriveChange(); … … 520 520 STDMETHODIMP Session::OnFloppyDriveChange() 521 521 { 522 LogFlowThisFunc 523 524 AutoCaller autoCaller 525 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 526 527 AutoReadLock alock 528 AssertReturn 529 AssertReturn 522 LogFlowThisFunc(("\n")); 523 524 AutoCaller autoCaller(this); 525 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 526 527 AutoReadLock alock(this); 528 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 529 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 530 530 531 531 return mConsole->onFloppyDriveChange(); … … 534 534 STDMETHODIMP Session::OnNetworkAdapterChange(INetworkAdapter *networkAdapter) 535 535 { 536 LogFlowThisFunc 537 538 AutoCaller autoCaller 539 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 540 541 AutoReadLock alock 542 AssertReturn 543 AssertReturn 536 LogFlowThisFunc(("\n")); 537 538 AutoCaller autoCaller(this); 539 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 540 541 AutoReadLock alock(this); 542 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 543 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 544 544 545 545 return mConsole->onNetworkAdapterChange(networkAdapter); … … 548 548 STDMETHODIMP Session::OnSerialPortChange(ISerialPort *serialPort) 549 549 { 550 LogFlowThisFunc 551 552 AutoCaller autoCaller 553 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 554 555 AutoReadLock alock 556 AssertReturn 557 AssertReturn 550 LogFlowThisFunc(("\n")); 551 552 AutoCaller autoCaller(this); 553 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 554 555 AutoReadLock alock(this); 556 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 557 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 558 558 559 559 return mConsole->onSerialPortChange(serialPort); … … 562 562 STDMETHODIMP Session::OnParallelPortChange(IParallelPort *parallelPort) 563 563 { 564 LogFlowThisFunc 565 566 AutoCaller autoCaller 567 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 568 569 AutoReadLock alock 570 AssertReturn 571 AssertReturn 564 LogFlowThisFunc(("\n")); 565 566 AutoCaller autoCaller(this); 567 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 568 569 AutoReadLock alock(this); 570 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 571 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 572 572 573 573 return mConsole->onParallelPortChange(parallelPort); … … 576 576 STDMETHODIMP Session::OnStorageControllerChange() 577 577 { 578 LogFlowThisFunc 579 580 AutoCaller autoCaller 581 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 582 583 AutoReadLock alock 584 AssertReturn 585 AssertReturn 578 LogFlowThisFunc(("\n")); 579 580 AutoCaller autoCaller(this); 581 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 582 583 AutoReadLock alock(this); 584 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 585 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 586 586 587 587 return mConsole->onStorageControllerChange(); … … 590 590 STDMETHODIMP Session::OnVRDPServerChange() 591 591 { 592 LogFlowThisFunc 593 594 AutoCaller autoCaller 595 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 596 597 AutoReadLock alock 598 AssertReturn 599 AssertReturn 592 LogFlowThisFunc(("\n")); 593 594 AutoCaller autoCaller(this); 595 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 596 597 AutoReadLock alock(this); 598 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 599 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 600 600 601 601 return mConsole->onVRDPServerChange(); … … 604 604 STDMETHODIMP Session::OnUSBControllerChange() 605 605 { 606 LogFlowThisFunc 607 608 AutoCaller autoCaller 609 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 610 611 AutoReadLock alock 612 AssertReturn 613 AssertReturn 606 LogFlowThisFunc(("\n")); 607 608 AutoCaller autoCaller(this); 609 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 610 611 AutoReadLock alock(this); 612 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 613 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 614 614 615 615 return mConsole->onUSBControllerChange(); … … 618 618 STDMETHODIMP Session::OnSharedFolderChange (BOOL aGlobal) 619 619 { 620 LogFlowThisFunc 621 622 AutoCaller autoCaller 623 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 624 625 AutoReadLock alock 626 AssertReturn 627 AssertReturn 620 LogFlowThisFunc(("\n")); 621 622 AutoCaller autoCaller(this); 623 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 624 625 AutoReadLock alock(this); 626 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 627 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 628 628 629 629 return mConsole->onSharedFolderChange (aGlobal); … … 634 634 ULONG aMaskedIfs) 635 635 { 636 LogFlowThisFunc 637 638 AutoCaller autoCaller 639 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 640 641 AutoReadLock alock 642 AssertReturn 643 AssertReturn 636 LogFlowThisFunc(("\n")); 637 638 AutoCaller autoCaller(this); 639 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 640 641 AutoReadLock alock(this); 642 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 643 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 644 644 645 645 return mConsole->onUSBDeviceAttach (aDevice, aError, aMaskedIfs); … … 649 649 IVirtualBoxErrorInfo *aError) 650 650 { 651 LogFlowThisFunc 652 653 AutoCaller autoCaller 654 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 655 656 AutoReadLock alock 657 AssertReturn 658 AssertReturn 651 LogFlowThisFunc(("\n")); 652 653 AutoCaller autoCaller(this); 654 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 655 656 AutoReadLock alock(this); 657 AssertReturn(mState == SessionState_Open, VBOX_E_INVALID_VM_STATE); 658 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 659 659 660 660 return mConsole->onUSBDeviceDetach (aId, aError); … … 663 663 STDMETHODIMP Session::OnShowWindow (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId) 664 664 { 665 AutoCaller autoCaller 666 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 667 668 AutoReadLock alock 669 670 AssertReturn 665 AutoCaller autoCaller(this); 666 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 667 668 AutoReadLock alock(this); 669 670 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 671 671 672 672 if (mState != SessionState_Open) … … 688 688 { 689 689 #ifdef VBOX_WITH_GUEST_PROPS 690 AutoCaller autoCaller 690 AutoCaller autoCaller(this); 691 691 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 692 692 … … 695 695 tr ("Machine session is not open (session state: %d)."), 696 696 mState); 697 AssertReturn 697 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 698 698 CheckComArgNotNull(aName); 699 699 if (!aIsSetter && !VALID_PTR (aRetValue)) … … 725 725 { 726 726 #ifdef VBOX_WITH_GUEST_PROPS 727 AutoCaller autoCaller 727 AutoCaller autoCaller(this); 728 728 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 729 729 … … 732 732 tr ("Machine session is not open (session state: %d)."), 733 733 mState); 734 AssertReturn 734 AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE); 735 735 if (!VALID_PTR (aPatterns) && (aPatterns != NULL)) 736 736 return E_POINTER; 737 if (ComSafeArrayOutIsNull 737 if (ComSafeArrayOutIsNull(aNames)) 738 738 return E_POINTER; 739 if (ComSafeArrayOutIsNull 739 if (ComSafeArrayOutIsNull(aValues)) 740 740 return E_POINTER; 741 if (ComSafeArrayOutIsNull 741 if (ComSafeArrayOutIsNull(aTimestamps)) 742 742 return E_POINTER; 743 if (ComSafeArrayOutIsNull 743 if (ComSafeArrayOutIsNull(aFlags)) 744 744 return E_POINTER; 745 745 return mConsole->enumerateGuestProperties(aPatterns, … … 768 768 { 769 769 LogFlowThisFuncEnter(); 770 LogFlowThisFunc 770 LogFlowThisFunc(("aFinalRelease=%d, isFromServer=%d\n", 771 771 aFinalRelease, aFromServer)); 772 772 773 AutoCaller autoCaller 774 AssertComRCReturnRC 775 776 AutoWriteLock alock 777 778 LogFlowThisFunc 773 AutoCaller autoCaller(this); 774 AssertComRCReturnRC(autoCaller.rc()); 775 776 AutoWriteLock alock(this); 777 778 LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); 779 779 780 780 if (mState != SessionState_Open) … … 822 822 } 823 823 824 ComPtr 824 ComPtr<IProgress> progress; 825 825 826 826 if (!aFinalRelease && !aFromServer) … … 845 845 alock.leave(); 846 846 847 LogFlowThisFunc 847 LogFlowThisFunc(("Calling mControl->OnSessionEnd()...\n")); 848 848 HRESULT rc = mControl->OnSessionEnd (this, progress.asOutParam()); 849 LogFlowThisFunc 849 LogFlowThisFunc(("mControl->OnSessionEnd()=%08X\n", rc)); 850 850 851 851 alock.enter(); … … 897 897 Bstr ipcId; 898 898 rc = mControl->GetIPCId (ipcId.asOutParam()); 899 AssertComRCReturnRC 900 901 LogFlowThisFunc 899 AssertComRCReturnRC(rc); 900 901 LogFlowThisFunc(("ipcId='%ls'\n", ipcId.raw())); 902 902 903 903 #if defined(RT_OS_WINDOWS) … … 966 966 /* wait until thread init is completed */ 967 967 vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT); 968 AssertReturn (RT_SUCCESS(vrc) || vrc == VERR_INTERRUPTED, E_FAIL);968 AssertReturn(RT_SUCCESS(vrc) || vrc == VERR_INTERRUPTED, E_FAIL); 969 969 970 970 /* the thread must succeed */ 971 AssertReturn 971 AssertReturn((bool) data [2], E_FAIL); 972 972 973 973 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) … … 1039 1039 /* wait for the thread to finish */ 1040 1040 vrc = RTThreadUserWait (mIPCThread, RT_INDEFINITE_WAIT); 1041 Assert (RT_SUCCESS 1041 Assert (RT_SUCCESS(vrc) || vrc == VERR_INTERRUPTED); 1042 1042 1043 1043 mIPCThread = NIL_RTTHREAD; -
trunk/src/VBox/Main/SharedFolderImpl.cpp
r21079 r21878 70 70 { 71 71 /* Enclose the state transition NotReady->InInit->Ready */ 72 AutoInitSpan autoInitSpan 73 AssertReturn 74 75 unconst 72 AutoInitSpan autoInitSpan(this); 73 AssertReturn(autoInitSpan.isOk(), E_FAIL); 74 75 unconst(mMachine) = aMachine; 76 76 77 77 HRESULT rc = protectedInit (aMachine, aName, aHostPath, aWritable); 78 78 79 79 /* Confirm a successful initialization when it's the case */ 80 if (SUCCEEDED 80 if (SUCCEEDED(rc)) 81 81 autoInitSpan.setSucceeded(); 82 82 … … 99 99 100 100 /* Enclose the state transition NotReady->InInit->Ready */ 101 AutoInitSpan autoInitSpan 102 AssertReturn 103 104 unconst 101 AutoInitSpan autoInitSpan(this); 102 AssertReturn(autoInitSpan.isOk(), E_FAIL); 103 104 unconst(mMachine) = aMachine; 105 105 106 106 HRESULT rc = protectedInit (aMachine, aThat->m.name, … … 108 108 109 109 /* Confirm a successful initialization when it's the case */ 110 if (SUCCEEDED 110 if (SUCCEEDED(rc)) 111 111 autoInitSpan.setSucceeded(); 112 112 … … 128 128 { 129 129 /* Enclose the state transition NotReady->InInit->Ready */ 130 AutoInitSpan autoInitSpan 131 AssertReturn 132 133 unconst 130 AutoInitSpan autoInitSpan(this); 131 AssertReturn(autoInitSpan.isOk(), E_FAIL); 132 133 unconst(mConsole) = aConsole; 134 134 135 135 HRESULT rc = protectedInit (aConsole, aName, aHostPath, aWritable); 136 136 137 137 /* Confirm a successful initialization when it's the case */ 138 if (SUCCEEDED 138 if (SUCCEEDED(rc)) 139 139 autoInitSpan.setSucceeded(); 140 140 … … 156 156 { 157 157 /* Enclose the state transition NotReady->InInit->Ready */ 158 AutoInitSpan autoInitSpan 159 AssertReturn 160 161 unconst 158 AutoInitSpan autoInitSpan(this); 159 AssertReturn(autoInitSpan.isOk(), E_FAIL); 160 161 unconst(mVirtualBox) = aVirtualBox; 162 162 163 163 HRESULT rc = protectedInit (aVirtualBox, aName, aHostPath, aWritable); 164 164 165 165 /* Confirm a successful initialization when it's the case */ 166 if (SUCCEEDED 166 if (SUCCEEDED(rc)) 167 167 autoInitSpan.setSucceeded(); 168 168 … … 179 179 CBSTR aName, CBSTR aHostPath, BOOL aWritable) 180 180 { 181 LogFlowThisFunc 181 LogFlowThisFunc(("aName={%ls}, aHostPath={%ls}, aWritable={%d}\n", 182 182 aName, aHostPath, aWritable)); 183 183 … … 209 209 int vrc = RTPathAbsEx (NULL, hostPath, 210 210 hostPathFull, sizeof (hostPathFull)); 211 if (RT_FAILURE 211 if (RT_FAILURE(vrc)) 212 212 return setError (E_INVALIDARG, 213 213 tr ("Invalid shared folder path: '%s' (%Rrc)"), hostPath.raw(), vrc); … … 217 217 tr ("Shared folder path '%s' is not absolute"), hostPath.raw()); 218 218 219 unconst 219 unconst(mParent) = aParent; 220 220 221 221 /* register with parent */ 222 222 mParent->addDependentChild (this); 223 223 224 unconst 225 unconst 224 unconst(m.name) = aName; 225 unconst(m.hostPath) = hostPath; 226 226 m.writable = aWritable; 227 227 … … 235 235 void SharedFolder::uninit() 236 236 { 237 LogFlowThisFunc 237 LogFlowThisFunc(("\n")); 238 238 239 239 /* Enclose the state transition Ready->InUninit->NotReady */ 240 AutoUninitSpan autoUninitSpan 240 AutoUninitSpan autoUninitSpan(this); 241 241 if (autoUninitSpan.uninitDone()) 242 242 return; … … 245 245 mParent->removeDependentChild (this); 246 246 247 unconst 248 249 unconst 250 unconst 251 unconst 247 unconst(mParent) = NULL; 248 249 unconst(mMachine).setNull(); 250 unconst(mConsole).setNull(); 251 unconst(mVirtualBox).setNull(); 252 252 } 253 253 … … 259 259 CheckComArgOutPointerValid(aName); 260 260 261 AutoCaller autoCaller 262 CheckComRCReturnRC 261 AutoCaller autoCaller(this); 262 CheckComRCReturnRC(autoCaller.rc()); 263 263 264 264 /* mName is constant during life time, no need to lock */ 265 m.name.cloneTo 265 m.name.cloneTo(aName); 266 266 267 267 return S_OK; … … 272 272 CheckComArgOutPointerValid(aHostPath); 273 273 274 AutoCaller autoCaller 275 CheckComRCReturnRC 274 AutoCaller autoCaller(this); 275 CheckComRCReturnRC(autoCaller.rc()); 276 276 277 277 /* mHostPath is constant during life time, no need to lock */ 278 m.hostPath.cloneTo 278 m.hostPath.cloneTo(aHostPath); 279 279 280 280 return S_OK; … … 283 283 STDMETHODIMP SharedFolder::COMGETTER(Accessible) (BOOL *aAccessible) 284 284 { 285 CheckComArgOutPointerValid 286 287 AutoCaller autoCaller 288 CheckComRCReturnRC 285 CheckComArgOutPointerValid(aAccessible); 286 287 AutoCaller autoCaller(this); 288 CheckComRCReturnRC(autoCaller.rc()); 289 289 290 290 /* mName and mHostPath are constant during life time, no need to lock */ … … 296 296 sizeof (hostPathFull)) 297 297 : VERR_PATH_NOT_FOUND; 298 if (RT_SUCCESS 298 if (RT_SUCCESS(vrc)) 299 299 { 300 300 *aAccessible = TRUE; … … 302 302 } 303 303 304 AutoWriteLock alock 304 AutoWriteLock alock(this); 305 305 306 306 m.lastAccessError = BstrFmt ( 307 307 tr ("'%s' is not accessible (%Rrc)"), hostPath.raw(), vrc); 308 308 309 LogWarningThisFunc 309 LogWarningThisFunc(("m.lastAccessError=\"%ls\"\n", m.lastAccessError.raw())); 310 310 311 311 *aAccessible = FALSE; … … 324 324 STDMETHODIMP SharedFolder::COMGETTER(LastAccessError) (BSTR *aLastAccessError) 325 325 { 326 CheckComArgOutPointerValid 327 328 AutoCaller autoCaller 329 CheckComRCReturnRC 330 331 AutoReadLock alock 326 CheckComArgOutPointerValid(aLastAccessError); 327 328 AutoCaller autoCaller(this); 329 CheckComRCReturnRC(autoCaller.rc()); 330 331 AutoReadLock alock(this); 332 332 333 333 if (m.lastAccessError.isEmpty()) 334 334 Bstr("").cloneTo(aLastAccessError); 335 335 else 336 m.lastAccessError.cloneTo 336 m.lastAccessError.cloneTo(aLastAccessError); 337 337 338 338 return S_OK; -
trunk/src/VBox/Main/SnapshotImpl.cpp
r21835 r21878 130 130 131 131 /* Enclose the state transition Ready->InUninit->NotReady */ 132 AutoUninitSpan autoUninitSpan 132 AutoUninitSpan autoUninitSpan(this); 133 133 if (autoUninitSpan.uninitDone()) 134 134 return; … … 251 251 CheckComRCReturnRC(autoCaller.rc()); 252 252 253 AutoReadLock alock 253 AutoReadLock alock(this); 254 254 255 255 m->id.toUtf16().cloneTo(aId); … … 264 264 CheckComRCReturnRC(autoCaller.rc()); 265 265 266 AutoReadLock alock 266 AutoReadLock alock(this); 267 267 268 268 m->name.cloneTo(aName); … … 302 302 CheckComRCReturnRC(autoCaller.rc()); 303 303 304 AutoReadLock alock 304 AutoReadLock alock(this); 305 305 306 306 m->description.cloneTo(aDescription); … … 336 336 CheckComRCReturnRC(autoCaller.rc()); 337 337 338 AutoReadLock alock 338 AutoReadLock alock(this); 339 339 340 340 *aTimeStamp = RTTimeSpecGetMilli(&m->timeStamp); … … 349 349 CheckComRCReturnRC(autoCaller.rc()); 350 350 351 AutoReadLock alock 351 AutoReadLock alock(this); 352 352 353 353 *aOnline = !stateFilePath().isNull(); … … 362 362 CheckComRCReturnRC(autoCaller.rc()); 363 363 364 AutoReadLock alock 364 AutoReadLock alock(this); 365 365 366 366 m->pMachine.queryInterfaceTo(aMachine); … … 375 375 CheckComRCReturnRC(autoCaller.rc()); 376 376 377 AutoReadLock alock 378 379 mParent.queryInterfaceTo 380 return S_OK; 381 } 382 383 STDMETHODIMP Snapshot::COMGETTER(Children) (ComSafeArrayOut 377 AutoReadLock alock(this); 378 379 mParent.queryInterfaceTo(aParent); 380 return S_OK; 381 } 382 383 STDMETHODIMP Snapshot::COMGETTER(Children) (ComSafeArrayOut(ISnapshot *, aChildren)) 384 384 { 385 385 CheckComArgOutSafeArrayPointerValid(aChildren); … … 537 537 ComObjPtr<Snapshot> Snapshot::findChildOrSelf(IN_BSTR aName) 538 538 { 539 ComObjPtr 540 AssertReturn 539 ComObjPtr<Snapshot> child; 540 AssertReturn(aName, child); 541 541 542 542 AutoCaller autoCaller(this); 543 543 AssertComRC(autoCaller.rc()); 544 544 545 AutoReadLock alock 545 AutoReadLock alock(this); 546 546 547 547 if (m->name == aName) … … 673 673 Key hwNode = aNode.createKey ("Hardware"); 674 674 HRESULT rc = snapshotMachine->saveHardware(hwNode); 675 CheckComRCReturnRC 675 CheckComRCReturnRC(rc); 676 676 } 677 677 … … 680 680 Key storageNode = aNode.createKey ("StorageControllers"); 681 681 HRESULT rc = snapshotMachine->saveStorageControllers(storageNode); 682 CheckComRCReturnRC 682 CheckComRCReturnRC(rc); 683 683 } 684 684 } … … 698 698 Key snapshotNode = snapshotsNode.createKey("Snapshot"); 699 699 rc = (*it)->saveSnapshotImpl(snapshotNode, aAttrsOnly); 700 CheckComRCReturnRC 700 CheckComRCReturnRC(rc); 701 701 } 702 702 } -
trunk/src/VBox/Main/StorageControllerImpl.cpp
r17768 r21878 66 66 StorageBus_T aStorageBus) 67 67 { 68 LogFlowThisFunc 68 LogFlowThisFunc(("aParent=%p aName=\"%ls\"\n", aParent, aName)); 69 69 70 70 ComAssertRet (aParent && aName, E_INVALIDARG); … … 75 75 76 76 /* Enclose the state transition NotReady->InInit->Ready */ 77 AutoInitSpan autoInitSpan 78 AssertReturn 79 80 unconst 77 AutoInitSpan autoInitSpan(this); 78 AssertReturn(autoInitSpan.isOk(), E_FAIL); 79 80 unconst(mParent) = aParent; 81 81 /* mPeer is left null */ 82 82 … … 132 132 bool aReshare /* = false */) 133 133 { 134 LogFlowThisFunc 134 LogFlowThisFunc(("aParent=%p, aThat=%p, aReshare=%RTbool\n", 135 135 aParent, aThat, aReshare)); 136 136 … … 138 138 139 139 /* Enclose the state transition NotReady->InInit->Ready */ 140 AutoInitSpan autoInitSpan 141 AssertReturn 142 143 unconst 140 AutoInitSpan autoInitSpan(this); 141 AssertReturn(autoInitSpan.isOk(), E_FAIL); 142 143 unconst(mParent) = aParent; 144 144 145 145 /* register with parent early, since uninit() will unconditionally … … 149 149 /* sanity */ 150 150 AutoCaller thatCaller (aThat); 151 AssertComRCReturnRC 151 AssertComRCReturnRC(thatCaller.rc()); 152 152 153 153 if (aReshare) … … 155 155 AutoWriteLock thatLock (aThat); 156 156 157 unconst 157 unconst(aThat->mPeer) = this; 158 158 mData.attach (aThat->mData); 159 159 } 160 160 else 161 161 { 162 unconst 162 unconst(mPeer) = aThat; 163 163 164 164 AutoReadLock thatLock (aThat); … … 179 179 HRESULT StorageController::initCopy (Machine *aParent, StorageController *aThat) 180 180 { 181 LogFlowThisFunc 181 LogFlowThisFunc(("aParent=%p, aThat=%p\n", aParent, aThat)); 182 182 183 183 ComAssertRet (aParent && aThat, E_INVALIDARG); 184 184 185 185 /* Enclose the state transition NotReady->InInit->Ready */ 186 AutoInitSpan autoInitSpan 187 AssertReturn 188 189 unconst 186 AutoInitSpan autoInitSpan(this); 187 AssertReturn(autoInitSpan.isOk(), E_FAIL); 188 189 unconst(mParent) = aParent; 190 190 /* mPeer is left null */ 191 191 … … 193 193 194 194 AutoCaller thatCaller (aThat); 195 AssertComRCReturnRC 195 AssertComRCReturnRC(thatCaller.rc()); 196 196 197 197 AutoReadLock thatlock (aThat); … … 211 211 void StorageController::uninit() 212 212 { 213 LogFlowThisFunc 213 LogFlowThisFunc(("\n")); 214 214 215 215 /* Enclose the state transition Ready->InUninit->NotReady */ 216 AutoUninitSpan autoUninitSpan 216 AutoUninitSpan autoUninitSpan(this); 217 217 if (autoUninitSpan.uninitDone()) 218 218 return; … … 222 222 mParent->removeDependentChild (this); 223 223 224 unconst 225 unconst 224 unconst(mPeer).setNull(); 225 unconst(mParent).setNull(); 226 226 } 227 227 … … 233 233 CheckComArgOutPointerValid(aName); 234 234 235 AutoCaller autoCaller 236 CheckComRCReturnRC 235 AutoCaller autoCaller(this); 236 CheckComRCReturnRC(autoCaller.rc()); 237 237 238 238 /* mName is constant during life time, no need to lock */ 239 mData.data()->mName.cloneTo 239 mData.data()->mName.cloneTo(aName); 240 240 241 241 return S_OK; … … 246 246 CheckComArgOutPointerValid(aBus); 247 247 248 AutoCaller autoCaller 249 CheckComRCReturnRC 250 251 AutoReadLock alock 248 AutoCaller autoCaller(this); 249 CheckComRCReturnRC(autoCaller.rc()); 250 251 AutoReadLock alock(this); 252 252 253 253 *aBus = mData->mStorageBus; … … 260 260 CheckComArgOutPointerValid(aControllerType); 261 261 262 AutoCaller autoCaller 263 CheckComRCReturnRC 264 265 AutoReadLock alock 262 AutoCaller autoCaller(this); 263 CheckComRCReturnRC(autoCaller.rc()); 264 265 AutoReadLock alock(this); 266 266 267 267 *aControllerType = mData->mStorageControllerType; … … 272 272 STDMETHODIMP StorageController::COMSETTER(ControllerType) (StorageControllerType_T aControllerType) 273 273 { 274 AutoCaller autoCaller 275 CheckComRCReturnRC 276 277 AutoWriteLock alock 274 AutoCaller autoCaller(this); 275 CheckComRCReturnRC(autoCaller.rc()); 276 277 AutoWriteLock alock(this); 278 278 279 279 HRESULT rc = S_OK; … … 306 306 } 307 307 308 if (!SUCCEEDED 308 if (!SUCCEEDED(rc)) 309 309 return setError(rc, 310 310 tr ("Invalid controller type %d"), … … 320 320 CheckComArgOutPointerValid(aMaxDevices); 321 321 322 AutoCaller autoCaller 323 CheckComRCReturnRC 324 325 AutoReadLock alock 322 AutoCaller autoCaller(this); 323 CheckComRCReturnRC(autoCaller.rc()); 324 325 AutoReadLock alock(this); 326 326 327 327 switch (mData->mStorageBus) … … 351 351 CheckComArgOutPointerValid(aMinPortCount); 352 352 353 AutoCaller autoCaller 354 CheckComRCReturnRC 355 356 AutoReadLock alock 353 AutoCaller autoCaller(this); 354 CheckComRCReturnRC(autoCaller.rc()); 355 356 AutoReadLock alock(this); 357 357 358 358 switch (mData->mStorageBus) … … 384 384 CheckComArgOutPointerValid(aMaxPortCount); 385 385 386 AutoCaller autoCaller 387 CheckComRCReturnRC 388 389 AutoReadLock alock 386 AutoCaller autoCaller(this); 387 CheckComRCReturnRC(autoCaller.rc()); 388 389 AutoReadLock alock(this); 390 390 391 391 switch (mData->mStorageBus) … … 418 418 CheckComArgOutPointerValid(aPortCount); 419 419 420 AutoCaller autoCaller 421 CheckComRCReturnRC 422 423 AutoReadLock alock 420 AutoCaller autoCaller(this); 421 CheckComRCReturnRC(autoCaller.rc()); 422 423 AutoReadLock alock(this); 424 424 425 425 *aPortCount = mData->mPortCount; … … 431 431 STDMETHODIMP StorageController::COMSETTER(PortCount) (ULONG aPortCount) 432 432 { 433 LogFlowThisFunc 433 LogFlowThisFunc(("aPortCount=%u\n", aPortCount)); 434 434 435 435 switch (mData->mStorageBus) … … 473 473 } 474 474 475 AutoCaller autoCaller 476 CheckComRCReturnRC 475 AutoCaller autoCaller(this); 476 CheckComRCReturnRC(autoCaller.rc()); 477 477 478 478 /* the machine needs to be mutable */ 479 479 Machine::AutoMutableStateDependency adep (mParent); 480 CheckComRCReturnRC 481 482 AutoWriteLock alock 480 CheckComRCReturnRC(adep.rc()); 481 482 AutoWriteLock alock(this); 483 483 484 484 if (mData->mPortCount != aPortCount) … … 498 498 STDMETHODIMP StorageController::COMGETTER(Instance) (ULONG *aInstance) 499 499 { 500 AutoCaller autoCaller 501 CheckComRCReturnRC 500 AutoCaller autoCaller(this); 501 CheckComRCReturnRC(autoCaller.rc()); 502 502 503 503 /* The machine doesn't need to be mutable. */ 504 504 505 AutoReadLock alock 505 AutoReadLock alock(this); 506 506 507 507 *aInstance = mInstance; … … 512 512 STDMETHODIMP StorageController::COMSETTER(Instance) (ULONG aInstance) 513 513 { 514 AutoCaller autoCaller 515 CheckComRCReturnRC 514 AutoCaller autoCaller(this); 515 CheckComRCReturnRC(autoCaller.rc()); 516 516 517 517 /* The machine doesn't need to be mutable. */ 518 518 519 AutoWriteLock alock 519 AutoWriteLock alock(this); 520 520 521 521 mInstance = aInstance; … … 531 531 CheckComArgOutPointerValid(aPortNumber); 532 532 533 AutoCaller autoCaller 534 CheckComRCReturnRC 535 536 AutoReadLock alock 533 AutoCaller autoCaller(this); 534 CheckComRCReturnRC(autoCaller.rc()); 535 536 AutoReadLock alock(this); 537 537 538 538 if (mData->mStorageControllerType != StorageControllerType_IntelAhci) … … 563 563 STDMETHODIMP StorageController::SetIDEEmulationPort(LONG DevicePosition, LONG aPortNumber) 564 564 { 565 AutoCaller autoCaller 566 CheckComRCReturnRC 565 AutoCaller autoCaller(this); 566 CheckComRCReturnRC(autoCaller.rc()); 567 567 568 568 /* the machine needs to be mutable */ 569 569 Machine::AutoMutableStateDependency adep (mParent); 570 CheckComRCReturnRC 571 AutoWriteLock alock 570 CheckComRCReturnRC(adep.rc()); 571 AutoWriteLock alock(this); 572 572 573 573 if (mData->mStorageControllerType != StorageControllerType_IntelAhci) … … 607 607 bool StorageController::rollback() 608 608 { 609 AutoCaller autoCaller 609 AutoCaller autoCaller(this); 610 610 AssertComRCReturn (autoCaller.rc(), false); 611 611 612 AutoWriteLock alock 612 AutoWriteLock alock(this); 613 613 614 614 bool dataChanged = false; … … 632 632 { 633 633 /* sanity */ 634 AutoCaller autoCaller 634 AutoCaller autoCaller(this); 635 635 AssertComRCReturnVoid (autoCaller.rc()); 636 636 … … 664 664 { 665 665 /* sanity */ 666 AutoCaller autoCaller 666 AutoCaller autoCaller(this); 667 667 AssertComRCReturnVoid (autoCaller.rc()); 668 668 … … 683 683 } 684 684 685 unconst 685 unconst(mPeer).setNull(); 686 686 } 687 687 -
trunk/src/VBox/Main/SystemPropertiesImpl.cpp
r21446 r21878 67 67 HRESULT SystemProperties::init (VirtualBox *aParent) 68 68 { 69 LogFlowThisFunc 69 LogFlowThisFunc(("aParent=%p\n", aParent)); 70 70 71 71 ComAssertRet (aParent, E_FAIL); 72 72 73 73 /* Enclose the state transition NotReady->InInit->Ready */ 74 AutoInitSpan autoInitSpan 75 AssertReturn 76 77 unconst 74 AutoInitSpan autoInitSpan(this); 75 AssertReturn(autoInitSpan.isOk(), E_FAIL); 76 77 unconst(mParent) = aParent; 78 78 79 79 setDefaultMachineFolder (NULL); … … 99 99 int vrc = VDBackendInfo (RT_ELEMENTS (aVDInfo), aVDInfo, &cEntries); 100 100 AssertRC (vrc); 101 if (RT_SUCCESS 101 if (RT_SUCCESS(vrc)) 102 102 { 103 103 for (unsigned i = 0; i < cEntries; ++ i) 104 104 { 105 ComObjPtr 105 ComObjPtr<HardDiskFormat> hdf; 106 106 rc = hdf.createObject(); 107 107 CheckComRCBreakRC (rc); … … 149 149 150 150 /* Confirm a successful initialization */ 151 if (SUCCEEDED 151 if (SUCCEEDED(rc)) 152 152 autoInitSpan.setSucceeded(); 153 153 … … 161 161 void SystemProperties::uninit() 162 162 { 163 LogFlowThisFunc 163 LogFlowThisFunc(("\n")); 164 164 165 165 /* Enclose the state transition Ready->InUninit->NotReady */ 166 AutoUninitSpan autoUninitSpan 166 AutoUninitSpan autoUninitSpan(this); 167 167 if (autoUninitSpan.uninitDone()) 168 168 return; 169 169 170 unconst 170 unconst(mParent).setNull(); 171 171 } 172 172 … … 180 180 return E_POINTER; 181 181 182 AutoCaller autoCaller 183 CheckComRCReturnRC 182 AutoCaller autoCaller(this); 183 CheckComRCReturnRC(autoCaller.rc()); 184 184 185 185 /* no need to lock, this is const */ … … 195 195 return E_POINTER; 196 196 197 AutoCaller autoCaller 198 CheckComRCReturnRC 197 AutoCaller autoCaller(this); 198 CheckComRCReturnRC(autoCaller.rc()); 199 199 200 200 /* no need to lock, this is const */ … … 210 210 return E_POINTER; 211 211 212 AutoCaller autoCaller 213 CheckComRCReturnRC 212 AutoCaller autoCaller(this); 213 CheckComRCReturnRC(autoCaller.rc()); 214 214 215 215 /* no need to lock, this is const */ … … 224 224 return E_POINTER; 225 225 226 AutoCaller autoCaller 227 CheckComRCReturnRC 226 AutoCaller autoCaller(this); 227 CheckComRCReturnRC(autoCaller.rc()); 228 228 229 229 /* no need to lock, this is const */ … … 238 238 return E_POINTER; 239 239 240 AutoCaller autoCaller 241 CheckComRCReturnRC 240 AutoCaller autoCaller(this); 241 CheckComRCReturnRC(autoCaller.rc()); 242 242 243 243 /* no need to lock, this is const */ … … 252 252 return E_POINTER; 253 253 254 AutoCaller autoCaller 255 CheckComRCReturnRC 254 AutoCaller autoCaller(this); 255 CheckComRCReturnRC(autoCaller.rc()); 256 256 257 257 /* no need to lock, this is const */ … … 266 266 return E_POINTER; 267 267 268 AutoCaller autoCaller 269 CheckComRCReturnRC 268 AutoCaller autoCaller(this); 269 CheckComRCReturnRC(autoCaller.rc()); 270 270 271 271 /* no need to lock, this is const */ … … 280 280 return E_POINTER; 281 281 282 AutoCaller autoCaller 283 CheckComRCReturnRC 282 AutoCaller autoCaller(this); 283 CheckComRCReturnRC(autoCaller.rc()); 284 284 285 285 /** The BIOS supports currently 32 bit LBA numbers (implementing the full … … 303 303 return E_POINTER; 304 304 305 AutoCaller autoCaller 306 CheckComRCReturnRC 305 AutoCaller autoCaller(this); 306 CheckComRCReturnRC(autoCaller.rc()); 307 307 308 308 /* no need to lock, this is const */ … … 317 317 return E_POINTER; 318 318 319 AutoCaller autoCaller 320 CheckComRCReturnRC 319 AutoCaller autoCaller(this); 320 CheckComRCReturnRC(autoCaller.rc()); 321 321 322 322 /* no need to lock, this is const */ … … 331 331 return E_POINTER; 332 332 333 AutoCaller autoCaller 334 CheckComRCReturnRC 333 AutoCaller autoCaller(this); 334 CheckComRCReturnRC(autoCaller.rc()); 335 335 336 336 /* no need to lock, this is const */ … … 344 344 CheckComArgOutPointerValid(aMaxBootPosition); 345 345 346 AutoCaller autoCaller 347 CheckComRCReturnRC 346 AutoCaller autoCaller(this); 347 CheckComRCReturnRC(autoCaller.rc()); 348 348 349 349 /* no need to lock, this is const */ … … 357 357 CheckComArgOutPointerValid(aDefaultMachineFolder); 358 358 359 AutoCaller autoCaller 360 CheckComRCReturnRC 361 362 AutoReadLock alock 363 364 mDefaultMachineFolderFull.cloneTo 359 AutoCaller autoCaller(this); 360 CheckComRCReturnRC(autoCaller.rc()); 361 362 AutoReadLock alock(this); 363 364 mDefaultMachineFolderFull.cloneTo(aDefaultMachineFolder); 365 365 366 366 return S_OK; … … 369 369 STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder) (IN_BSTR aDefaultMachineFolder) 370 370 { 371 AutoCaller autoCaller 372 CheckComRCReturnRC 371 AutoCaller autoCaller(this); 372 CheckComRCReturnRC(autoCaller.rc()); 373 373 374 374 /* VirtualBox::saveSettings() needs a write lock */ … … 376 376 377 377 HRESULT rc = setDefaultMachineFolder (aDefaultMachineFolder); 378 if (SUCCEEDED 378 if (SUCCEEDED(rc)) 379 379 rc = mParent->saveSettings(); 380 380 … … 386 386 CheckComArgOutPointerValid(aDefaultHardDiskFolder); 387 387 388 AutoCaller autoCaller 389 CheckComRCReturnRC 390 391 AutoReadLock alock 392 393 mDefaultHardDiskFolderFull.cloneTo 388 AutoCaller autoCaller(this); 389 CheckComRCReturnRC(autoCaller.rc()); 390 391 AutoReadLock alock(this); 392 393 mDefaultHardDiskFolderFull.cloneTo(aDefaultHardDiskFolder); 394 394 395 395 return S_OK; … … 398 398 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFolder) (IN_BSTR aDefaultHardDiskFolder) 399 399 { 400 AutoCaller autoCaller 401 CheckComRCReturnRC 400 AutoCaller autoCaller(this); 401 CheckComRCReturnRC(autoCaller.rc()); 402 402 403 403 /* VirtualBox::saveSettings() needs a write lock */ … … 405 405 406 406 HRESULT rc = setDefaultHardDiskFolder (aDefaultHardDiskFolder); 407 if (SUCCEEDED 407 if (SUCCEEDED(rc)) 408 408 rc = mParent->saveSettings(); 409 409 … … 412 412 413 413 STDMETHODIMP SystemProperties:: 414 COMGETTER(HardDiskFormats) (ComSafeArrayOut 415 { 416 if (ComSafeArrayOutIsNull 417 return E_POINTER; 418 419 AutoCaller autoCaller 420 CheckComRCReturnRC 421 422 AutoReadLock alock 423 424 SafeIfaceArray 425 hardDiskFormats.detachTo (ComSafeArrayOutArg(aHardDiskFormats));414 COMGETTER(HardDiskFormats) (ComSafeArrayOut(IHardDiskFormat *, aHardDiskFormats)) 415 { 416 if (ComSafeArrayOutIsNull(aHardDiskFormats)) 417 return E_POINTER; 418 419 AutoCaller autoCaller(this); 420 CheckComRCReturnRC(autoCaller.rc()); 421 422 AutoReadLock alock(this); 423 424 SafeIfaceArray<IHardDiskFormat> hardDiskFormats (mHardDiskFormats); 425 hardDiskFormats.detachTo(ComSafeArrayOutArg(aHardDiskFormats)); 426 426 427 427 return S_OK; … … 432 432 CheckComArgOutPointerValid(aDefaultHardDiskFormat); 433 433 434 AutoCaller autoCaller 435 CheckComRCReturnRC 436 437 AutoReadLock alock 438 439 mDefaultHardDiskFormat.cloneTo 434 AutoCaller autoCaller(this); 435 CheckComRCReturnRC(autoCaller.rc()); 436 437 AutoReadLock alock(this); 438 439 mDefaultHardDiskFormat.cloneTo(aDefaultHardDiskFormat); 440 440 441 441 return S_OK; … … 444 444 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat) (IN_BSTR aDefaultHardDiskFormat) 445 445 { 446 AutoCaller autoCaller 447 CheckComRCReturnRC 446 AutoCaller autoCaller(this); 447 CheckComRCReturnRC(autoCaller.rc()); 448 448 449 449 /* VirtualBox::saveSettings() needs a write lock */ … … 451 451 452 452 HRESULT rc = setDefaultHardDiskFormat (aDefaultHardDiskFormat); 453 if (SUCCEEDED 453 if (SUCCEEDED(rc)) 454 454 rc = mParent->saveSettings(); 455 455 … … 461 461 CheckComArgOutPointerValid(aRemoteDisplayAuthLibrary); 462 462 463 AutoCaller autoCaller 464 CheckComRCReturnRC 465 466 AutoReadLock alock 467 468 mRemoteDisplayAuthLibrary.cloneTo 463 AutoCaller autoCaller(this); 464 CheckComRCReturnRC(autoCaller.rc()); 465 466 AutoReadLock alock(this); 467 468 mRemoteDisplayAuthLibrary.cloneTo(aRemoteDisplayAuthLibrary); 469 469 470 470 return S_OK; … … 473 473 STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary) (IN_BSTR aRemoteDisplayAuthLibrary) 474 474 { 475 AutoCaller autoCaller 476 CheckComRCReturnRC 475 AutoCaller autoCaller(this); 476 CheckComRCReturnRC(autoCaller.rc()); 477 477 478 478 /* VirtualBox::saveSettings() needs a write lock */ … … 480 480 481 481 HRESULT rc = setRemoteDisplayAuthLibrary (aRemoteDisplayAuthLibrary); 482 if (SUCCEEDED 482 if (SUCCEEDED(rc)) 483 483 rc = mParent->saveSettings(); 484 484 … … 490 490 CheckComArgOutPointerValid(aWebServiceAuthLibrary); 491 491 492 AutoCaller autoCaller 493 CheckComRCReturnRC 494 495 AutoReadLock alock 496 497 mWebServiceAuthLibrary.cloneTo 492 AutoCaller autoCaller(this); 493 CheckComRCReturnRC(autoCaller.rc()); 494 495 AutoReadLock alock(this); 496 497 mWebServiceAuthLibrary.cloneTo(aWebServiceAuthLibrary); 498 498 499 499 return S_OK; … … 502 502 STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary) (IN_BSTR aWebServiceAuthLibrary) 503 503 { 504 AutoCaller autoCaller 505 CheckComRCReturnRC 504 AutoCaller autoCaller(this); 505 CheckComRCReturnRC(autoCaller.rc()); 506 506 507 507 /* VirtualBox::saveSettings() needs a write lock */ … … 509 509 510 510 HRESULT rc = setWebServiceAuthLibrary (aWebServiceAuthLibrary); 511 if (SUCCEEDED 511 if (SUCCEEDED(rc)) 512 512 rc = mParent->saveSettings(); 513 513 … … 520 520 return E_POINTER; 521 521 522 AutoCaller autoCaller 523 CheckComRCReturnRC 524 525 AutoReadLock alock 522 AutoCaller autoCaller(this); 523 CheckComRCReturnRC(autoCaller.rc()); 524 525 AutoReadLock alock(this); 526 526 527 527 *count = mLogHistoryCount; … … 532 532 STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount) (ULONG count) 533 533 { 534 AutoCaller autoCaller 535 CheckComRCReturnRC 534 AutoCaller autoCaller(this); 535 CheckComRCReturnRC(autoCaller.rc()); 536 536 537 537 /* VirtualBox::saveSettings() needs a write lock */ … … 550 550 return E_POINTER; 551 551 552 AutoCaller autoCaller 553 CheckComRCReturnRC 554 555 AutoReadLock alock 552 AutoCaller autoCaller(this); 553 CheckComRCReturnRC(autoCaller.rc()); 554 555 AutoReadLock alock(this); 556 556 557 557 *aAudioDriver = mDefaultAudioDriver; … … 567 567 using namespace settings; 568 568 569 AutoCaller autoCaller 570 CheckComRCReturnRC 571 572 AutoWriteLock alock 573 574 AssertReturn 569 AutoCaller autoCaller(this); 570 CheckComRCReturnRC(autoCaller.rc()); 571 572 AutoWriteLock alock(this); 573 574 AssertReturn(!aGlobal.isNull(), E_FAIL); 575 575 576 576 HRESULT rc = S_OK; … … 582 582 bstr = properties.stringValue ("defaultMachineFolder"); 583 583 rc = setDefaultMachineFolder (bstr); 584 CheckComRCReturnRC 584 CheckComRCReturnRC(rc); 585 585 586 586 bstr = properties.stringValue ("defaultHardDiskFolder"); 587 587 rc = setDefaultHardDiskFolder (bstr); 588 CheckComRCReturnRC 588 CheckComRCReturnRC(rc); 589 589 590 590 bstr = properties.stringValue ("defaultHardDiskFormat"); 591 591 rc = setDefaultHardDiskFormat (bstr); 592 CheckComRCReturnRC 592 CheckComRCReturnRC(rc); 593 593 594 594 bstr = properties.stringValue ("remoteDisplayAuthLibrary"); 595 595 rc = setRemoteDisplayAuthLibrary (bstr); 596 CheckComRCReturnRC 596 CheckComRCReturnRC(rc); 597 597 598 598 bstr = properties.stringValue ("webServiceAuthLibrary"); 599 599 rc = setWebServiceAuthLibrary (bstr); 600 CheckComRCReturnRC 600 CheckComRCReturnRC(rc); 601 601 602 602 mLogHistoryCount = properties.valueOr <ULONG> ("LogHistoryCount", 3); … … 609 609 using namespace settings; 610 610 611 AutoCaller autoCaller 612 CheckComRCReturnRC 613 614 AutoReadLock alock 611 AutoCaller autoCaller(this); 612 CheckComRCReturnRC(autoCaller.rc()); 613 614 AutoReadLock alock(this); 615 615 616 616 ComAssertRet (!aGlobal.isNull(), E_FAIL); … … 651 651 * @return ComObjPtr<HardDiskFormat> 652 652 */ 653 ComObjPtr 654 { 655 ComObjPtr 656 657 AutoCaller autoCaller 653 ComObjPtr<HardDiskFormat> SystemProperties::hardDiskFormat (CBSTR aFormat) 654 { 655 ComObjPtr<HardDiskFormat> format; 656 657 AutoCaller autoCaller(this); 658 658 AssertComRCReturn (autoCaller.rc(), format); 659 659 660 AutoReadLock alock 660 AutoReadLock alock(this); 661 661 662 662 for (HardDiskFormatList::const_iterator it = mHardDiskFormats.begin(); … … 689 689 Utf8Str folder; 690 690 int vrc = mParent->calculateFullPath (path, folder); 691 if (RT_FAILURE 691 if (RT_FAILURE(vrc)) 692 692 return setError (E_FAIL, 693 693 tr ("Invalid default machine folder '%ls' (%Rrc)"), … … 711 711 Utf8Str folder; 712 712 int vrc = mParent->calculateFullPath (path, folder); 713 if (RT_FAILURE 713 if (RT_FAILURE(vrc)) 714 714 return setError (E_FAIL, 715 715 tr ("Invalid default hard disk folder '%ls' (%Rrc)"), -
trunk/src/VBox/Main/USBControllerImpl.cpp
r21823 r21878 70 70 HRESULT USBController::init (Machine *aParent) 71 71 { 72 LogFlowThisFunc 72 LogFlowThisFunc(("aParent=%p\n", aParent)); 73 73 74 74 ComAssertRet (aParent, E_INVALIDARG); 75 75 76 76 /* Enclose the state transition NotReady->InInit->Ready */ 77 AutoInitSpan autoInitSpan 78 AssertReturn 79 80 unconst 77 AutoInitSpan autoInitSpan(this); 78 AssertReturn(autoInitSpan.isOk(), E_FAIL); 79 80 unconst(mParent) = aParent; 81 81 /* mPeer is left null */ 82 82 … … 106 106 HRESULT USBController::init (Machine *aParent, USBController *aPeer) 107 107 { 108 LogFlowThisFunc 108 LogFlowThisFunc(("aParent=%p, aPeer=%p\n", aParent, aPeer)); 109 109 110 110 ComAssertRet (aParent && aPeer, E_INVALIDARG); 111 111 112 112 /* Enclose the state transition NotReady->InInit->Ready */ 113 AutoInitSpan autoInitSpan 114 AssertReturn 115 116 unconst 117 unconst 113 AutoInitSpan autoInitSpan(this); 114 AssertReturn(autoInitSpan.isOk(), E_FAIL); 115 116 unconst(mParent) = aParent; 117 unconst(mPeer) = aPeer; 118 118 119 119 AutoWriteLock thatlock (aPeer); … … 126 126 while (it != aPeer->mDeviceFilters->end()) 127 127 { 128 ComObjPtr 128 ComObjPtr<USBDeviceFilter> filter; 129 129 filter.createObject(); 130 130 filter->init (this, *it); … … 148 148 HRESULT USBController::initCopy (Machine *aParent, USBController *aPeer) 149 149 { 150 LogFlowThisFunc 150 LogFlowThisFunc(("aParent=%p, aPeer=%p\n", aParent, aPeer)); 151 151 152 152 ComAssertRet (aParent && aPeer, E_INVALIDARG); 153 153 154 154 /* Enclose the state transition NotReady->InInit->Ready */ 155 AutoInitSpan autoInitSpan 156 AssertReturn 157 158 unconst 155 AutoInitSpan autoInitSpan(this); 156 AssertReturn(autoInitSpan.isOk(), E_FAIL); 157 158 unconst(mParent) = aParent; 159 159 /* mPeer is left null */ 160 160 … … 168 168 while (it != aPeer->mDeviceFilters->end()) 169 169 { 170 ComObjPtr 170 ComObjPtr<USBDeviceFilter> filter; 171 171 filter.createObject(); 172 172 filter->initCopy (this, *it); … … 189 189 void USBController::uninit() 190 190 { 191 LogFlowThisFunc 191 LogFlowThisFunc(("\n")); 192 192 193 193 /* Enclose the state transition Ready->InUninit->NotReady */ 194 AutoUninitSpan autoUninitSpan 194 AutoUninitSpan autoUninitSpan(this); 195 195 if (autoUninitSpan.uninitDone()) 196 196 return; … … 204 204 mData.free(); 205 205 206 unconst 207 unconst 206 unconst(mPeer).setNull(); 207 unconst(mParent).setNull(); 208 208 } 209 209 … … 216 216 CheckComArgOutPointerValid(aEnabled); 217 217 218 AutoCaller autoCaller 219 CheckComRCReturnRC 220 221 AutoReadLock alock 218 AutoCaller autoCaller(this); 219 CheckComRCReturnRC(autoCaller.rc()); 220 221 AutoReadLock alock(this); 222 222 223 223 *aEnabled = mData->mEnabled; … … 229 229 STDMETHODIMP USBController::COMSETTER(Enabled) (BOOL aEnabled) 230 230 { 231 LogFlowThisFunc 232 233 AutoCaller autoCaller 234 CheckComRCReturnRC 231 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 232 233 AutoCaller autoCaller(this); 234 CheckComRCReturnRC(autoCaller.rc()); 235 235 236 236 /* the machine needs to be mutable */ 237 237 Machine::AutoMutableStateDependency adep (mParent); 238 CheckComRCReturnRC 239 240 AutoWriteLock alock 238 CheckComRCReturnRC(adep.rc()); 239 240 AutoWriteLock alock(this); 241 241 242 242 if (mData->mEnabled != aEnabled) … … 258 258 CheckComArgOutPointerValid(aEnabled); 259 259 260 AutoCaller autoCaller 261 CheckComRCReturnRC 262 263 AutoReadLock alock 260 AutoCaller autoCaller(this); 261 CheckComRCReturnRC(autoCaller.rc()); 262 263 AutoReadLock alock(this); 264 264 265 265 *aEnabled = mData->mEnabledEhci; … … 270 270 STDMETHODIMP USBController::COMSETTER(EnabledEhci) (BOOL aEnabled) 271 271 { 272 LogFlowThisFunc 273 274 AutoCaller autoCaller 275 CheckComRCReturnRC 272 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); 273 274 AutoCaller autoCaller(this); 275 CheckComRCReturnRC(autoCaller.rc()); 276 276 277 277 /* the machine needs to be mutable */ 278 278 Machine::AutoMutableStateDependency adep (mParent); 279 CheckComRCReturnRC 280 281 AutoWriteLock alock 279 CheckComRCReturnRC(adep.rc()); 280 281 AutoWriteLock alock(this); 282 282 283 283 if (mData->mEnabledEhci != aEnabled) … … 299 299 CheckComArgOutPointerValid(aUSBStandard); 300 300 301 AutoCaller autoCaller 302 CheckComRCReturnRC 301 AutoCaller autoCaller(this); 302 CheckComRCReturnRC(autoCaller.rc()); 303 303 304 304 /* not accessing data -- no need to lock */ … … 365 365 CheckComArgOutSafeArrayPointerValid(aDevicesFilters); 366 366 367 AutoCaller autoCaller 368 CheckComRCReturnRC 369 370 AutoReadLock alock 371 372 SafeIfaceArray 373 collection.detachTo (ComSafeArrayOutArg(aDevicesFilters));367 AutoCaller autoCaller(this); 368 CheckComRCReturnRC(autoCaller.rc()); 369 370 AutoReadLock alock(this); 371 372 SafeIfaceArray<IUSBDeviceFilter> collection (*mDeviceFilters.data()); 373 collection.detachTo(ComSafeArrayOutArg(aDevicesFilters)); 374 374 375 375 return S_OK; … … 394 394 CheckComArgStrNotEmptyOrNull(aName); 395 395 396 AutoCaller autoCaller 397 CheckComRCReturnRC 396 AutoCaller autoCaller(this); 397 CheckComRCReturnRC(autoCaller.rc()); 398 398 399 399 /* the machine needs to be mutable */ 400 400 Machine::AutoMutableStateDependency adep (mParent); 401 CheckComRCReturnRC 402 403 AutoWriteLock alock 404 405 ComObjPtr 401 CheckComRCReturnRC(adep.rc()); 402 403 AutoWriteLock alock(this); 404 405 ComObjPtr<USBDeviceFilter> filter; 406 406 filter.createObject(); 407 407 HRESULT rc = filter->init (this, aName); 408 408 ComAssertComRCRetRC (rc); 409 rc = filter.queryInterfaceTo 410 AssertComRCReturnRC 409 rc = filter.queryInterfaceTo(aFilter); 410 AssertComRCReturnRC(rc); 411 411 412 412 return S_OK; … … 425 425 CheckComArgNotNull(aFilter); 426 426 427 AutoCaller autoCaller 428 CheckComRCReturnRC 427 AutoCaller autoCaller(this); 428 CheckComRCReturnRC(autoCaller.rc()); 429 429 430 430 /* the machine needs to be mutable */ 431 431 Machine::AutoMutableStateDependency adep (mParent); 432 CheckComRCReturnRC 433 434 AutoWriteLock alock 435 436 ComObjPtr 432 CheckComRCReturnRC(adep.rc()); 433 434 AutoWriteLock alock(this); 435 436 ComObjPtr<USBDeviceFilter> filter = getDependentChild (aFilter); 437 437 if (!filter) 438 438 return setError (E_INVALIDARG, … … 488 488 CheckComArgOutPointerValid(aFilter); 489 489 490 AutoCaller autoCaller 491 CheckComRCReturnRC 490 AutoCaller autoCaller(this); 491 CheckComRCReturnRC(autoCaller.rc()); 492 492 493 493 /* the machine needs to be mutable */ 494 494 Machine::AutoMutableStateDependency adep (mParent); 495 CheckComRCReturnRC 496 497 AutoWriteLock alock 495 CheckComRCReturnRC(adep.rc()); 496 497 AutoWriteLock alock(this); 498 498 499 499 if (!mDeviceFilters->size()) … … 509 509 mDeviceFilters.backup(); 510 510 511 ComObjPtr 511 ComObjPtr<USBDeviceFilter> filter; 512 512 { 513 513 /* iterate to the position... */ … … 524 524 filter->unshare(); 525 525 526 filter.queryInterfaceTo 526 filter.queryInterfaceTo(aFilter); 527 527 528 528 /* notify the proxy (only when it makes sense) */ … … 563 563 using namespace settings; 564 564 565 AssertReturn 566 567 AutoCaller autoCaller 568 AssertComRCReturnRC 569 570 AutoWriteLock alock 565 AssertReturn(!aMachineNode.isNull(), E_FAIL); 566 567 AutoCaller autoCaller(this); 568 AssertComRCReturnRC(autoCaller.rc()); 569 570 AutoWriteLock alock(this); 571 571 572 572 /* Note: we assume that the default values for attributes of optional … … 612 612 ULONG maskedIfs = (*it).value <ULONG> ("maskedInterfaces"); 613 613 614 ComObjPtr 614 ComObjPtr<USBDeviceFilter> filterObj; 615 615 filterObj.createObject(); 616 616 rc = filterObj->init (this, … … 619 619 port, remote, maskedIfs); 620 620 /* error info is set by init() when appropriate */ 621 CheckComRCReturnRC 621 CheckComRCReturnRC(rc); 622 622 623 623 mDeviceFilters->push_back (filterObj); … … 640 640 using namespace settings; 641 641 642 AssertReturn 643 644 AutoCaller autoCaller 645 CheckComRCReturnRC 646 647 AutoReadLock alock 642 AssertReturn(!aMachineNode.isNull(), E_FAIL); 643 644 AutoCaller autoCaller(this); 645 CheckComRCReturnRC(autoCaller.rc()); 646 647 AutoReadLock alock(this); 648 648 649 649 /* first, delete the entry */ … … 724 724 bool USBController::isModified() 725 725 { 726 AutoCaller autoCaller 726 AutoCaller autoCaller(this); 727 727 AssertComRCReturn (autoCaller.rc(), false); 728 728 729 AutoReadLock alock 729 AutoReadLock alock(this); 730 730 731 731 if (mData.isBackedUp() … … 754 754 bool USBController::isReallyModified() 755 755 { 756 AutoCaller autoCaller 756 AutoCaller autoCaller(this); 757 757 AssertComRCReturn (autoCaller.rc(), false); 758 758 759 AutoReadLock alock 759 AutoReadLock alock(this); 760 760 761 761 if (mData.hasActualChanges()) … … 819 819 bool USBController::rollback() 820 820 { 821 AutoCaller autoCaller 821 AutoCaller autoCaller(this); 822 822 AssertComRCReturn (autoCaller.rc(), false); 823 823 … … 826 826 AssertComRCReturn (adep.rc(), false); 827 827 828 AutoWriteLock alock 828 AutoWriteLock alock(this); 829 829 830 830 bool dataChanged = false; … … 922 922 { 923 923 /* sanity */ 924 AutoCaller autoCaller 924 AutoCaller autoCaller(this); 925 925 AssertComRCReturnVoid (autoCaller.rc()); 926 926 … … 965 965 966 966 /* look if this filter has a peer filter */ 967 ComObjPtr 967 ComObjPtr<USBDeviceFilter> peer = (*it)->peer(); 968 968 if (!peer) 969 969 { … … 1030 1030 1031 1031 /* sanity */ 1032 AutoCaller autoCaller 1032 AutoCaller autoCaller(this); 1033 1033 AssertComRCReturnVoid (autoCaller.rc()); 1034 1034 … … 1062 1062 ++ it) 1063 1063 { 1064 ComObjPtr 1064 ComObjPtr<USBDeviceFilter> filter; 1065 1065 filter.createObject(); 1066 1066 filter->initCopy (this, *it); … … 1081 1081 BOOL aActiveChanged /* = FALSE */) 1082 1082 { 1083 AutoCaller autoCaller 1084 AssertComRCReturnRC 1083 AutoCaller autoCaller(this); 1084 AssertComRCReturnRC(autoCaller.rc()); 1085 1085 1086 1086 /* we need the machine state */ 1087 1087 Machine::AutoAnyStateDependency adep (mParent); 1088 AssertComRCReturnRC 1088 AssertComRCReturnRC(adep.rc()); 1089 1089 1090 1090 /* nothing to do if the machine isn't running */ … … 1137 1137 * @note Locks this object for reading. 1138 1138 */ 1139 bool USBController::hasMatchingFilter (const ComObjPtr 1140 { 1141 AutoCaller autoCaller 1139 bool USBController::hasMatchingFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs) 1140 { 1141 AutoCaller autoCaller(this); 1142 1142 AssertComRCReturn (autoCaller.rc(), false); 1143 1143 1144 AutoReadLock alock 1144 AutoReadLock alock(this); 1145 1145 1146 1146 /* Disabled USB controllers cannot actually work with USB devices */ … … 1180 1180 LogFlowThisFuncEnter(); 1181 1181 1182 AutoCaller autoCaller 1182 AutoCaller autoCaller(this); 1183 1183 AssertComRCReturn (autoCaller.rc(), false); 1184 1184 1185 AutoReadLock alock 1185 AutoReadLock alock(this); 1186 1186 1187 1187 /* Disabled USB controllers cannot actually work with USB devices */ … … 1265 1265 } 1266 1266 1267 LogFlowThisFunc 1267 LogFlowThisFunc(("returns: %d\n", match)); 1268 1268 LogFlowThisFuncLeave(); 1269 1269 … … 1281 1281 HRESULT USBController::notifyProxy (bool aInsertFilters) 1282 1282 { 1283 LogFlowThisFunc 1284 1285 AutoCaller autoCaller 1283 LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters)); 1284 1285 AutoCaller autoCaller(this); 1286 1286 AssertComRCReturn (autoCaller.rc(), false); 1287 1287 1288 AutoReadLock alock 1288 AutoReadLock alock(this); 1289 1289 1290 1290 USBProxyService *service = mParent->virtualBox()->host()->usbProxyService(); 1291 AssertReturn 1291 AssertReturn(service, E_FAIL); 1292 1292 1293 1293 DeviceFilterList::const_iterator it = mDeviceFilters->begin(); … … 1301 1301 if (aInsertFilters) 1302 1302 { 1303 AssertReturn 1303 AssertReturn(flt->id() == NULL, E_FAIL); 1304 1304 flt->id() = service->insertFilter (&flt->data().mUSBFilter); 1305 1305 } -
trunk/src/VBox/Main/USBDeviceImpl.cpp
r20976 r21878 51 51 HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice) 52 52 { 53 LogFlowThisFunc 53 LogFlowThisFunc(("aUSBDevice=%p\n", aUSBDevice)); 54 54 55 55 ComAssertRet (aUSBDevice, E_INVALIDARG); 56 56 57 57 /* Enclose the state transition NotReady->InInit->Ready */ 58 AutoInitSpan autoInitSpan 59 AssertReturn 60 61 HRESULT hrc = aUSBDevice->COMGETTER(VendorId)(&unconst 58 AutoInitSpan autoInitSpan(this); 59 AssertReturn(autoInitSpan.isOk(), E_FAIL); 60 61 HRESULT hrc = aUSBDevice->COMGETTER(VendorId)(&unconst(mData.vendorId)); 62 62 ComAssertComRCRet (hrc, hrc); 63 63 ComAssertRet (mData.vendorId, E_INVALIDARG); 64 64 65 hrc = aUSBDevice->COMGETTER(ProductId)(&unconst 66 ComAssertComRCRet (hrc, hrc); 67 68 hrc = aUSBDevice->COMGETTER(Revision)(&unconst 69 ComAssertComRCRet (hrc, hrc); 70 71 hrc = aUSBDevice->COMGETTER(Manufacturer)(unconst 72 ComAssertComRCRet (hrc, hrc); 73 74 hrc = aUSBDevice->COMGETTER(Product)(unconst 75 ComAssertComRCRet (hrc, hrc); 76 77 hrc = aUSBDevice->COMGETTER(SerialNumber)(unconst 78 ComAssertComRCRet (hrc, hrc); 79 80 hrc = aUSBDevice->COMGETTER(Address)(unconst 81 ComAssertComRCRet (hrc, hrc); 82 83 hrc = aUSBDevice->COMGETTER(Port)(&unconst 84 ComAssertComRCRet (hrc, hrc); 85 86 hrc = aUSBDevice->COMGETTER(Port)(&unconst 87 ComAssertComRCRet (hrc, hrc); 88 89 hrc = aUSBDevice->COMGETTER(Port)(&unconst 90 ComAssertComRCRet (hrc, hrc); 91 92 hrc = aUSBDevice->COMGETTER(Remote)(&unconst 65 hrc = aUSBDevice->COMGETTER(ProductId)(&unconst(mData.productId)); 66 ComAssertComRCRet (hrc, hrc); 67 68 hrc = aUSBDevice->COMGETTER(Revision)(&unconst(mData.revision)); 69 ComAssertComRCRet (hrc, hrc); 70 71 hrc = aUSBDevice->COMGETTER(Manufacturer)(unconst(mData.manufacturer).asOutParam()); 72 ComAssertComRCRet (hrc, hrc); 73 74 hrc = aUSBDevice->COMGETTER(Product)(unconst(mData.product).asOutParam()); 75 ComAssertComRCRet (hrc, hrc); 76 77 hrc = aUSBDevice->COMGETTER(SerialNumber)(unconst(mData.serialNumber).asOutParam()); 78 ComAssertComRCRet (hrc, hrc); 79 80 hrc = aUSBDevice->COMGETTER(Address)(unconst(mData.address).asOutParam()); 81 ComAssertComRCRet (hrc, hrc); 82 83 hrc = aUSBDevice->COMGETTER(Port)(&unconst(mData.port)); 84 ComAssertComRCRet (hrc, hrc); 85 86 hrc = aUSBDevice->COMGETTER(Port)(&unconst(mData.version)); 87 ComAssertComRCRet (hrc, hrc); 88 89 hrc = aUSBDevice->COMGETTER(Port)(&unconst(mData.portVersion)); 90 ComAssertComRCRet (hrc, hrc); 91 92 hrc = aUSBDevice->COMGETTER(Remote)(&unconst(mData.remote)); 93 93 ComAssertComRCRet (hrc, hrc); 94 94 … … 110 110 void OUSBDevice::uninit() 111 111 { 112 LogFlowThisFunc 112 LogFlowThisFunc(("\n")); 113 113 114 114 /* Enclose the state transition Ready->InUninit->NotReady */ 115 AutoUninitSpan autoUninitSpan 115 AutoUninitSpan autoUninitSpan(this); 116 116 if (autoUninitSpan.uninitDone()) 117 117 return; 118 118 119 unconst 120 121 unconst 122 unconst 123 unconst 124 125 unconst 126 unconst 127 unconst 128 129 unconst 130 131 unconst 132 unconst 133 unconst 134 135 unconst 119 unconst(mData.id).clear(); 120 121 unconst(mData.vendorId) = 0; 122 unconst(mData.productId) = 0; 123 unconst(mData.revision) = 0; 124 125 unconst(mData.manufacturer).setNull(); 126 unconst(mData.product).setNull(); 127 unconst(mData.serialNumber).setNull(); 128 129 unconst(mData.address).setNull(); 130 131 unconst(mData.port) = 0; 132 unconst(mData.version) = 1; 133 unconst(mData.portVersion) = 1; 134 135 unconst(mData.remote) = FALSE; 136 136 } 137 137 … … 149 149 CheckComArgOutPointerValid(aId); 150 150 151 AutoCaller autoCaller 152 CheckComRCReturnRC 153 154 /* this is const, no need to lock */ 155 Guid(mData.id).toString().cloneTo 151 AutoCaller autoCaller(this); 152 CheckComRCReturnRC(autoCaller.rc()); 153 154 /* this is const, no need to lock */ 155 Guid(mData.id).toString().cloneTo(aId); 156 156 157 157 return S_OK; … … 169 169 CheckComArgOutPointerValid(aVendorId); 170 170 171 AutoCaller autoCaller 172 CheckComRCReturnRC 171 AutoCaller autoCaller(this); 172 CheckComRCReturnRC(autoCaller.rc()); 173 173 174 174 /* this is const, no need to lock */ … … 189 189 CheckComArgOutPointerValid(aProductId); 190 190 191 AutoCaller autoCaller 192 CheckComRCReturnRC 191 AutoCaller autoCaller(this); 192 CheckComRCReturnRC(autoCaller.rc()); 193 193 194 194 /* this is const, no need to lock */ … … 209 209 CheckComArgOutPointerValid(aRevision); 210 210 211 AutoCaller autoCaller 212 CheckComRCReturnRC 211 AutoCaller autoCaller(this); 212 CheckComRCReturnRC(autoCaller.rc()); 213 213 214 214 /* this is const, no need to lock */ … … 228 228 CheckComArgOutPointerValid(aManufacturer); 229 229 230 AutoCaller autoCaller 231 CheckComRCReturnRC 232 233 /* this is const, no need to lock */ 234 mData.manufacturer.cloneTo 230 AutoCaller autoCaller(this); 231 CheckComRCReturnRC(autoCaller.rc()); 232 233 /* this is const, no need to lock */ 234 mData.manufacturer.cloneTo(aManufacturer); 235 235 236 236 return S_OK; … … 248 248 CheckComArgOutPointerValid(aProduct); 249 249 250 AutoCaller autoCaller 251 CheckComRCReturnRC 252 253 /* this is const, no need to lock */ 254 mData.product.cloneTo 250 AutoCaller autoCaller(this); 251 CheckComRCReturnRC(autoCaller.rc()); 252 253 /* this is const, no need to lock */ 254 mData.product.cloneTo(aProduct); 255 255 256 256 return S_OK; … … 268 268 CheckComArgOutPointerValid(aSerialNumber); 269 269 270 AutoCaller autoCaller 271 CheckComRCReturnRC 272 273 /* this is const, no need to lock */ 274 mData.serialNumber.cloneTo 270 AutoCaller autoCaller(this); 271 CheckComRCReturnRC(autoCaller.rc()); 272 273 /* this is const, no need to lock */ 274 mData.serialNumber.cloneTo(aSerialNumber); 275 275 276 276 return S_OK; … … 288 288 CheckComArgOutPointerValid(aAddress); 289 289 290 AutoCaller autoCaller 291 CheckComRCReturnRC 292 293 /* this is const, no need to lock */ 294 mData.address.cloneTo 290 AutoCaller autoCaller(this); 291 CheckComRCReturnRC(autoCaller.rc()); 292 293 /* this is const, no need to lock */ 294 mData.address.cloneTo(aAddress); 295 295 296 296 return S_OK; … … 301 301 CheckComArgOutPointerValid(aPort); 302 302 303 AutoCaller autoCaller 304 CheckComRCReturnRC 303 AutoCaller autoCaller(this); 304 CheckComRCReturnRC(autoCaller.rc()); 305 305 306 306 /* this is const, no need to lock */ … … 314 314 CheckComArgOutPointerValid(aVersion); 315 315 316 AutoCaller autoCaller 317 CheckComRCReturnRC 316 AutoCaller autoCaller(this); 317 CheckComRCReturnRC(autoCaller.rc()); 318 318 319 319 /* this is const, no need to lock */ … … 327 327 CheckComArgOutPointerValid(aPortVersion); 328 328 329 AutoCaller autoCaller 330 CheckComRCReturnRC 329 AutoCaller autoCaller(this); 330 CheckComRCReturnRC(autoCaller.rc()); 331 331 332 332 /* this is const, no need to lock */ … … 340 340 CheckComArgOutPointerValid(aRemote); 341 341 342 AutoCaller autoCaller 343 CheckComRCReturnRC 342 AutoCaller autoCaller(this); 343 CheckComRCReturnRC(autoCaller.rc()); 344 344 345 345 /* this is const, no need to lock */ -
trunk/src/VBox/Main/VMMDevInterface.cpp
r21227 r21878 132 132 int rc = RTSemEventWait (mCredentialsEvent, u32Timeout); 133 133 134 if (RT_SUCCESS 134 if (RT_SUCCESS(rc)) 135 135 { 136 136 *pu32CredentialsFlags = mu32CredentialsFlags; -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r21823 r21878 201 201 ++ mInitUninitWaiters; 202 202 203 LogFlowThisFunc 203 LogFlowThisFunc((mState == InInit ? 204 204 "Waiting for AutoInitSpan/AutoReinitSpan to " 205 205 "finish...\n" : … … 788 788 789 789 /* these are mandatory, others -- not */ 790 AssertReturn 790 AssertReturn((!aWarning && FAILED (aResultCode)) || 791 791 (aWarning && aResultCode != S_OK), 792 792 E_FAIL); 793 AssertReturn 793 AssertReturn(!aText.isEmpty(), E_FAIL); 794 794 795 795 /* reset the error severity bit if it's a warning */ … … 801 801 do 802 802 { 803 ComObjPtr 803 ComObjPtr<VirtualBoxErrorInfo> info; 804 804 rc = info.createObject(); 805 805 CheckComRCBreakRC (rc); … … 807 807 #if !defined (VBOX_WITH_XPCOM) 808 808 809 ComPtr 809 ComPtr<IVirtualBoxErrorInfo> curInfo; 810 810 if (preserve) 811 811 { 812 812 /* get the current error info if any */ 813 ComPtr 813 ComPtr<IErrorInfo> err; 814 814 rc = ::GetErrorInfo (0, err.asOutParam()); 815 815 CheckComRCBreakRC (rc); 816 rc = err.queryInterfaceTo 816 rc = err.queryInterfaceTo(curInfo.asOutParam()); 817 817 if (FAILED (rc)) 818 818 { 819 819 /* create a IVirtualBoxErrorInfo wrapper for the native 820 820 * IErrorInfo object */ 821 ComObjPtr 821 ComObjPtr<VirtualBoxErrorInfo> wrapper; 822 822 rc = wrapper.createObject(); 823 if (SUCCEEDED 823 if (SUCCEEDED(rc)) 824 824 { 825 825 rc = wrapper->init (err); 826 if (SUCCEEDED 826 if (SUCCEEDED(rc)) 827 827 curInfo = wrapper; 828 828 } … … 830 830 } 831 831 /* On failure, curInfo will stay null */ 832 Assert (SUCCEEDED 832 Assert (SUCCEEDED(rc) || curInfo.isNull()); 833 833 834 834 /* set the current error info and preserve the previous one if any */ … … 836 836 CheckComRCBreakRC (rc); 837 837 838 ComPtr 839 rc = info.queryInterfaceTo 840 if (SUCCEEDED 838 ComPtr<IErrorInfo> err; 839 rc = info.queryInterfaceTo(err.asOutParam()); 840 if (SUCCEEDED(rc)) 841 841 rc = ::SetErrorInfo (0, err); 842 842 … … 845 845 nsCOMPtr <nsIExceptionService> es; 846 846 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 847 if (NS_SUCCEEDED 847 if (NS_SUCCEEDED(rc)) 848 848 { 849 849 nsCOMPtr <nsIExceptionManager> em; … … 851 851 CheckComRCBreakRC (rc); 852 852 853 ComPtr 853 ComPtr<IVirtualBoxErrorInfo> curInfo; 854 854 if (preserve) 855 855 { 856 856 /* get the current error info if any */ 857 ComPtr 857 ComPtr<nsIException> ex; 858 858 rc = em->GetCurrentException (ex.asOutParam()); 859 859 CheckComRCBreakRC (rc); 860 rc = ex.queryInterfaceTo 860 rc = ex.queryInterfaceTo(curInfo.asOutParam()); 861 861 if (FAILED (rc)) 862 862 { 863 863 /* create a IVirtualBoxErrorInfo wrapper for the native 864 864 * nsIException object */ 865 ComObjPtr 865 ComObjPtr<VirtualBoxErrorInfo> wrapper; 866 866 rc = wrapper.createObject(); 867 if (SUCCEEDED 867 if (SUCCEEDED(rc)) 868 868 { 869 869 rc = wrapper->init (ex); 870 if (SUCCEEDED 870 if (SUCCEEDED(rc)) 871 871 curInfo = wrapper; 872 872 } … … 874 874 } 875 875 /* On failure, curInfo will stay null */ 876 Assert (SUCCEEDED 876 Assert (SUCCEEDED(rc) || curInfo.isNull()); 877 877 878 878 /* set the current error info and preserve the previous one if any */ … … 880 880 CheckComRCBreakRC (rc); 881 881 882 ComPtr 883 rc = info.queryInterfaceTo 884 if (SUCCEEDED 882 ComPtr<nsIException> ex; 883 rc = info.queryInterfaceTo(ex.asOutParam()); 884 if (SUCCEEDED(rc)) 885 885 rc = em->SetCurrentException (ex); 886 886 } … … 909 909 AssertComRC (rc); 910 910 911 return SUCCEEDED 911 return SUCCEEDED(rc) ? aResultCode : rc; 912 912 } 913 913 … … 932 932 LogFlowThisFuncEnter(); 933 933 934 AutoWriteLock alock 934 AutoWriteLock alock(this); 935 935 AutoWriteLock mapLock (mMapLock); 936 936 937 LogFlowThisFunc 937 LogFlowThisFunc(("count=%d...\n", mDependentChildren.size())); 938 938 939 939 if (mDependentChildren.size()) … … 972 972 alock.leave(); 973 973 974 LogFlowThisFunc 974 LogFlowThisFunc(("Waiting for uninitialization of all children...\n")); 975 975 976 976 RTSemEventWait (mUninitDoneSem, RT_INDEFINITE_WAIT); … … 994 994 * 995 995 * @param unk 996 * Pointer to map to the dependent child object (it is ComPtr 996 * Pointer to map to the dependent child object (it is ComPtr<IUnknown> 997 997 * rather than IUnknown *, to guarantee IUnknown * identity) 998 998 * @return … … 1000 1000 */ 1001 1001 VirtualBoxBase *VirtualBoxBaseWithChildren::getDependentChild ( 1002 const ComPtr 1003 { 1004 AssertReturn 1005 1006 AutoWriteLock alock 1002 const ComPtr<IUnknown> &unk) 1003 { 1004 AssertReturn(!!unk, NULL); 1005 1006 AutoWriteLock alock(mMapLock); 1007 1007 if (mUninitDoneSem != NIL_RTSEMEVENT) 1008 1008 return NULL; … … 1016 1016 /** Helper for addDependentChild() template method */ 1017 1017 void VirtualBoxBaseWithChildren::addDependentChild ( 1018 const ComPtr 1019 { 1020 AssertReturn 1021 1022 AutoWriteLock alock 1018 const ComPtr<IUnknown> &unk, VirtualBoxBase *child) 1019 { 1020 AssertReturn(!!unk && child, (void) 0); 1021 1022 AutoWriteLock alock(mMapLock); 1023 1023 1024 1024 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 1036 1036 1037 1037 /** Helper for removeDependentChild() template method */ 1038 void VirtualBoxBaseWithChildren::removeDependentChild (const ComPtr 1038 void VirtualBoxBaseWithChildren::removeDependentChild (const ComPtr<IUnknown> &unk) 1039 1039 { 1040 1040 /// @todo (r=dmik) see todo in VirtualBoxBase.h, in 1041 1041 // template <class C> void removeDependentChild (C *child) 1042 1042 1043 AssertReturn 1044 1045 AutoWriteLock alock 1043 AssertReturn(!!unk, (void) 0); 1044 1045 AutoWriteLock alock(mMapLock); 1046 1046 1047 1047 if (mUninitDoneSem != NIL_RTSEMEVENT) … … 1090 1090 void VirtualBoxBaseWithChildrenNEXT::uninitDependentChildren() 1091 1091 { 1092 AutoCaller autoCaller 1092 AutoCaller autoCaller(this); 1093 1093 1094 1094 /* sanity */ … … 1105 1105 * be deleted while we've released the lock */ 1106 1106 DependentChildren::iterator it = mDependentChildren.begin(); 1107 ComPtr 1107 ComPtr<IUnknown> unk = it->first; 1108 1108 Assert (!unk.isNull()); 1109 1109 … … 1144 1144 * map of dependent children. 1145 1145 * 1146 * Note that ComPtr 1146 * Note that ComPtr<IUnknown> is used as an argument instead of IUnknown * in 1147 1147 * order to guarantee IUnknown identity and disambiguation by doing 1148 1148 * QueryInterface (IUnknown) rather than a regular C cast. … … 1155 1155 VirtualBoxBase* VirtualBoxBaseWithChildrenNEXT::getDependentChild(const ComPtr<IUnknown> &aUnk) 1156 1156 { 1157 AssertReturn 1158 1159 AutoCaller autoCaller 1157 AssertReturn(!aUnk.isNull(), NULL); 1158 1159 AutoCaller autoCaller(this); 1160 1160 1161 1161 /* return NULL if uninitDependentChildren() is in action */ … … 1163 1163 return NULL; 1164 1164 1165 AutoReadLock alock 1165 AutoReadLock alock(childrenLock()); 1166 1166 1167 1167 DependentChildren::const_iterator it = mDependentChildren.find (aUnk); … … 1179 1179 AssertReturnVoid (aChild != NULL); 1180 1180 1181 AutoCaller autoCaller 1181 AutoCaller autoCaller(this); 1182 1182 1183 1183 /* sanity */ … … 1186 1186 autoCaller.state() == Limited); 1187 1187 1188 AutoWriteLock alock 1188 AutoWriteLock alock(childrenLock()); 1189 1189 1190 1190 std::pair <DependentChildren::iterator, bool> result = … … 1198 1198 AssertReturnVoid (aUnk); 1199 1199 1200 AutoCaller autoCaller 1200 AutoCaller autoCaller(this); 1201 1201 1202 1202 /* sanity */ … … 1206 1206 autoCaller.state() == Limited); 1207 1207 1208 AutoWriteLock alock 1208 AutoWriteLock alock(childrenLock()); 1209 1209 1210 1210 DependentChildren::size_type result = mDependentChildren.erase (aUnk); -
trunk/src/VBox/Main/VirtualBoxErrorInfoImpl.cpp
r21786 r21878 54 54 CheckComArgOutPointerValid(aIID); 55 55 56 mIID.toUtf16().cloneTo 56 mIID.toUtf16().cloneTo(aIID); 57 57 return S_OK; 58 58 } … … 62 62 CheckComArgOutPointerValid(aComponent); 63 63 64 mComponent.cloneTo 64 mComponent.cloneTo(aComponent); 65 65 return S_OK; 66 66 } … … 70 70 CheckComArgOutPointerValid(aText); 71 71 72 mText.cloneTo 72 mText.cloneTo(aText); 73 73 return S_OK; 74 74 } … … 79 79 80 80 /* this will set aNext to NULL if mNext is null */ 81 return mNext.queryInterfaceTo 81 return mNext.queryInterfaceTo(aNext); 82 82 } 83 83 … … 90 90 HRESULT VirtualBoxErrorInfo::init (IErrorInfo *aInfo) 91 91 { 92 AssertReturn 92 AssertReturn(aInfo, E_FAIL); 93 93 94 94 HRESULT rc = S_OK; … … 149 149 HRESULT VirtualBoxErrorInfo::init (nsIException *aInfo) 150 150 { 151 AssertReturn 151 AssertReturn(aInfo, E_FAIL); 152 152 153 153 HRESULT rc = S_OK; … … 176 176 CheckComArgOutPointerValid(aMessage); 177 177 178 Utf8Str (mText).cloneTo 178 Utf8Str (mText).cloneTo(aMessage); 179 179 return S_OK; 180 180 } … … 226 226 NS_IMETHODIMP VirtualBoxErrorInfo::GetInner (nsIException **aInner) 227 227 { 228 ComPtr 228 ComPtr<IVirtualBoxErrorInfo> info; 229 229 nsresult rv = COMGETTER(Next) (info.asOutParam()); 230 CheckComRCReturnRC 231 return info.queryInterfaceTo 230 CheckComRCReturnRC(rv); 231 return info.queryInterfaceTo(aInner); 232 232 } 233 233 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r21607 r21878 136 136 HRESULT VirtualBox::FinalConstruct() 137 137 { 138 LogFlowThisFunc 138 LogFlowThisFunc(("\n")); 139 139 140 140 return init(); … … 143 143 void VirtualBox::FinalRelease() 144 144 { 145 LogFlowThisFunc 145 LogFlowThisFunc(("\n")); 146 146 147 147 uninit(); … … 163 163 { 164 164 /* Enclose the state transition NotReady->InInit->Ready */ 165 AutoInitSpan autoInitSpan 166 AssertReturn 165 AutoInitSpan autoInitSpan(this); 166 AssertReturn(autoInitSpan.isOk(), E_FAIL); 167 167 168 168 LogFlow (("===========================================================\n")); … … 174 174 if (sPackageType.isNull()) 175 175 sPackageType = VBOX_PACKAGE_STRING; 176 LogFlowThisFunc 176 LogFlowThisFunc(("Version: %ls, Package: %ls\n", sVersion.raw(), sPackageType.raw())); 177 177 178 178 if (sSettingsFormatVersion.isNull()) 179 179 sSettingsFormatVersion = VBOX_XML_VERSION_FULL; 180 LogFlowThisFunc 180 LogFlowThisFunc(("Settings Format Version: %ls\n", 181 181 sSettingsFormatVersion.raw())); 182 182 … … 185 185 char homeDir [RTPATH_MAX]; 186 186 int vrc = com::GetVBoxUserHomeDirectory (homeDir, sizeof (homeDir)); 187 if (RT_FAILURE 187 if (RT_FAILURE(vrc)) 188 188 return setError (E_FAIL, 189 189 tr ("Could not create the VirtualBox home directory '%s'" … … 191 191 homeDir, vrc); 192 192 193 unconst 193 unconst(mData.mHomeDir) = homeDir; 194 194 } 195 195 … … 199 199 200 200 /* store the config file name */ 201 unconst 201 unconst(mData.mCfgFile.mName) = vboxConfigFile; 202 202 203 203 /* lock the config file */ 204 204 HRESULT rc = lockConfig(); 205 if (SUCCEEDED 205 if (SUCCEEDED(rc)) 206 206 { 207 207 if (!isConfigLocked()) … … 215 215 RTFILE_O_READWRITE | RTFILE_O_CREATE | 216 216 RTFILE_O_DENY_WRITE); 217 if (RT_SUCCESS 217 if (RT_SUCCESS(vrc)) 218 218 vrc = RTFileWrite (handle, 219 219 (void *) gDefaultGlobalConfig, 220 220 strlen (gDefaultGlobalConfig), NULL); 221 if (RT_FAILURE 221 if (RT_FAILURE(vrc)) 222 222 { 223 223 rc = setError (E_FAIL, tr ("Could not create the default settings file " … … 233 233 } 234 234 235 if (SUCCEEDED 235 if (SUCCEEDED(rc)) 236 236 { 237 237 try … … 252 252 #ifdef VBOX_WITH_RESOURCE_USAGE_API 253 253 /* create the performance collector object BEFORE host */ 254 unconst 254 unconst(mData.mPerformanceCollector).createObject(); 255 255 rc = mData.mPerformanceCollector->init(); 256 256 ComAssertComRCThrowRC (rc); … … 258 258 259 259 /* create the host object early, machines will need it */ 260 unconst 260 unconst(mData.mHost).createObject(); 261 261 rc = mData.mHost->init (this); 262 262 ComAssertComRCThrowRC (rc); … … 266 266 267 267 /* create the system properties object, someone may need it too */ 268 unconst 268 unconst(mData.mSystemProperties).createObject(); 269 269 rc = mData.mSystemProperties->init (this); 270 270 ComAssertComRCThrowRC (rc); … … 276 276 for (size_t i = 0; i < RT_ELEMENTS (Global::sOSTypes); ++ i) 277 277 { 278 ComObjPtr 278 ComObjPtr<GuestOSType> guestOSTypeObj; 279 279 rc = guestOSTypeObj.createObject(); 280 if (SUCCEEDED 280 if (SUCCEEDED(rc)) 281 281 { 282 282 rc = guestOSTypeObj->init (Global::sOSTypes [i].familyId, … … 291 291 Global::sOSTypes [i].networkAdapterType, 292 292 Global::sOSTypes [i].numSerialEnabled); 293 if (SUCCEEDED 293 if (SUCCEEDED(rc)) 294 294 mData.mGuestOSTypes.push_back (guestOSTypeObj); 295 295 } … … 312 312 /// @todo (r=dmik) add IVirtualBox::cleanupHardDisks() instead or similar 313 313 // for (HardDiskList::const_iterator it = mData.mHardDisks.begin(); 314 // it != mData.mHardDisks.end() && SUCCEEDED 314 // it != mData.mHardDisks.end() && SUCCEEDED(rc); 315 315 // ++ it) 316 316 // { … … 334 334 } 335 335 336 if (SUCCEEDED 336 if (SUCCEEDED(rc)) 337 337 { 338 338 /* start the client watcher thread */ 339 339 #if defined(RT_OS_WINDOWS) 340 unconst 340 unconst(mWatcherData.mUpdateReq) = ::CreateEvent (NULL, FALSE, FALSE, NULL); 341 341 #elif defined(RT_OS_OS2) 342 RTSemEventCreate (&unconst 342 RTSemEventCreate (&unconst(mWatcherData.mUpdateReq)); 343 343 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) 344 RTSemEventCreate (&unconst 344 RTSemEventCreate (&unconst(mWatcherData.mUpdateReq)); 345 345 #else 346 346 # error "Port me!" 347 347 #endif 348 int vrc = RTThreadCreate (&unconst 348 int vrc = RTThreadCreate (&unconst(mWatcherData.mThread), 349 349 ClientWatcher, (void *) this, 350 350 0, RTTHREADTYPE_MAIN_WORKER, 351 351 RTTHREADFLAGS_WAITABLE, "Watcher"); 352 352 ComAssertRC (vrc); 353 if (RT_FAILURE 353 if (RT_FAILURE(vrc)) 354 354 rc = E_FAIL; 355 355 } 356 356 357 if (SUCCEEDED 357 if (SUCCEEDED(rc)) do 358 358 { 359 359 /* start the async event handler thread */ 360 int vrc = RTThreadCreate (&unconst 361 &unconst 360 int vrc = RTThreadCreate (&unconst(mAsyncEventThread), AsyncEventHandler, 361 &unconst(mAsyncEventQ), 362 362 0, RTTHREADTYPE_MAIN_WORKER, 363 363 RTTHREADFLAGS_WAITABLE, "EventHandler"); … … 371 371 372 372 /* Confirm a successful initialization when it's the case */ 373 if (SUCCEEDED 373 if (SUCCEEDED(rc)) 374 374 autoInitSpan.setSucceeded(); 375 375 376 LogFlowThisFunc 376 LogFlowThisFunc(("rc=%08X\n", rc)); 377 377 LogFlowThisFuncLeave(); 378 378 LogFlow (("===========================================================\n")); … … 383 383 { 384 384 /* Enclose the state transition Ready->InUninit->NotReady */ 385 AutoUninitSpan autoUninitSpan 385 AutoUninitSpan autoUninitSpan(this); 386 386 if (autoUninitSpan.uninitDone()) 387 387 return; … … 389 389 LogFlow (("===========================================================\n")); 390 390 LogFlowThisFuncEnter(); 391 LogFlowThisFunc 391 LogFlowThisFunc(("initFailed()=%d\n", autoUninitSpan.initFailed())); 392 392 393 393 /* tell all our child objects we've been uninitialized */ 394 394 395 LogFlowThisFunc 395 LogFlowThisFunc(("Uninitializing machines (%d)...\n", mData.mMachines.size())); 396 396 if (mData.mMachines.size()) 397 397 { … … 426 426 { 427 427 mData.mSystemProperties->uninit(); 428 unconst 428 unconst(mData.mSystemProperties).setNull(); 429 429 } 430 430 … … 432 432 { 433 433 mData.mHost->uninit(); 434 unconst 434 unconst(mData.mHost).setNull(); 435 435 } 436 436 … … 439 439 { 440 440 mData.mPerformanceCollector->uninit(); 441 unconst 441 unconst(mData.mPerformanceCollector).setNull(); 442 442 } 443 443 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 446 446 unlockConfig(); 447 447 448 LogFlowThisFunc 448 LogFlowThisFunc(("Releasing callbacks...\n")); 449 449 if (mData.mCallbacks.size()) 450 450 { … … 455 455 } 456 456 457 LogFlowThisFunc 457 LogFlowThisFunc(("Terminating the async event handler...\n")); 458 458 if (mAsyncEventThread != NIL_RTTHREAD) 459 459 { … … 466 466 */ 467 467 int vrc = RTThreadWait (mAsyncEventThread, 60000, NULL); 468 if (RT_FAILURE 468 if (RT_FAILURE(vrc)) 469 469 LogWarningFunc (("RTThreadWait(%RTthrd) -> %Rrc\n", 470 470 mAsyncEventThread, vrc)); … … 476 476 } 477 477 478 unconst 479 unconst 480 } 481 482 LogFlowThisFunc 478 unconst(mAsyncEventThread) = NIL_RTTHREAD; 479 unconst(mAsyncEventQ) = NULL; 480 } 481 482 LogFlowThisFunc(("Terminating the client watcher...\n")); 483 483 if (mWatcherData.mThread != NIL_RTTHREAD) 484 484 { … … 487 487 /* wait for the termination */ 488 488 RTThreadWait (mWatcherData.mThread, RT_INDEFINITE_WAIT, NULL); 489 unconst 489 unconst(mWatcherData.mThread) = NIL_RTTHREAD; 490 490 } 491 491 mWatcherData.mProcesses.clear(); … … 494 494 { 495 495 ::CloseHandle (mWatcherData.mUpdateReq); 496 unconst 496 unconst(mWatcherData.mUpdateReq) = NULL; 497 497 } 498 498 #elif defined(RT_OS_OS2) … … 500 500 { 501 501 RTSemEventDestroy (mWatcherData.mUpdateReq); 502 unconst 502 unconst(mWatcherData.mUpdateReq) = NIL_RTSEMEVENT; 503 503 } 504 504 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) … … 506 506 { 507 507 RTSemEventDestroy (mWatcherData.mUpdateReq); 508 unconst 508 unconst(mWatcherData.mUpdateReq) = NIL_RTSEMEVENT; 509 509 } 510 510 #else … … 526 526 CheckComArgNotNull(aVersion); 527 527 528 AutoCaller autoCaller 529 CheckComRCReturnRC 530 531 sVersion.cloneTo 528 AutoCaller autoCaller(this); 529 CheckComRCReturnRC(autoCaller.rc()); 530 531 sVersion.cloneTo(aVersion); 532 532 return S_OK; 533 533 } … … 537 537 CheckComArgNotNull(aRevision); 538 538 539 AutoCaller autoCaller 540 CheckComRCReturnRC 539 AutoCaller autoCaller(this); 540 CheckComRCReturnRC(autoCaller.rc()); 541 541 542 542 *aRevision = sRevision; … … 548 548 CheckComArgNotNull(aPackageType); 549 549 550 AutoCaller autoCaller 551 CheckComRCReturnRC 552 553 sPackageType.cloneTo 550 AutoCaller autoCaller(this); 551 CheckComRCReturnRC(autoCaller.rc()); 552 553 sPackageType.cloneTo(aPackageType); 554 554 return S_OK; 555 555 } … … 559 559 CheckComArgNotNull(aHomeFolder); 560 560 561 AutoCaller autoCaller 562 CheckComRCReturnRC 561 AutoCaller autoCaller(this); 562 CheckComRCReturnRC(autoCaller.rc()); 563 563 564 564 /* mHomeDir is const and doesn't need a lock */ 565 mData.mHomeDir.cloneTo 565 mData.mHomeDir.cloneTo(aHomeFolder); 566 566 return S_OK; 567 567 } … … 571 571 CheckComArgNotNull(aSettingsFilePath); 572 572 573 AutoCaller autoCaller 574 CheckComRCReturnRC 573 AutoCaller autoCaller(this); 574 CheckComRCReturnRC(autoCaller.rc()); 575 575 576 576 /* mCfgFile.mName is const and doesn't need a lock */ 577 mData.mCfgFile.mName.cloneTo 577 mData.mCfgFile.mName.cloneTo(aSettingsFilePath); 578 578 return S_OK; 579 579 } … … 584 584 CheckComArgNotNull(aSettingsFileVersion); 585 585 586 AutoCaller autoCaller 587 CheckComRCReturnRC 588 589 AutoReadLock alock 590 591 mData.mSettingsFileVersion.cloneTo 586 AutoCaller autoCaller(this); 587 CheckComRCReturnRC(autoCaller.rc()); 588 589 AutoReadLock alock(this); 590 591 mData.mSettingsFileVersion.cloneTo(aSettingsFileVersion); 592 592 return S_OK; 593 593 } … … 598 598 CheckComArgNotNull(aSettingsFormatVersion); 599 599 600 AutoCaller autoCaller 601 CheckComRCReturnRC 602 603 sSettingsFormatVersion.cloneTo 600 AutoCaller autoCaller(this); 601 CheckComRCReturnRC(autoCaller.rc()); 602 603 sSettingsFormatVersion.cloneTo(aSettingsFormatVersion); 604 604 return S_OK; 605 605 } … … 609 609 CheckComArgOutSafeArrayPointerValid(aHost); 610 610 611 AutoCaller autoCaller 612 CheckComRCReturnRC 611 AutoCaller autoCaller(this); 612 CheckComRCReturnRC(autoCaller.rc()); 613 613 614 614 /* mHost is const, no need to lock */ 615 mData.mHost.queryInterfaceTo 615 mData.mHost.queryInterfaceTo(aHost); 616 616 return S_OK; 617 617 } … … 622 622 CheckComArgOutSafeArrayPointerValid(aSystemProperties); 623 623 624 AutoCaller autoCaller 625 CheckComRCReturnRC 624 AutoCaller autoCaller(this); 625 CheckComRCReturnRC(autoCaller.rc()); 626 626 627 627 /* mSystemProperties is const, no need to lock */ 628 mData.mSystemProperties.queryInterfaceTo 628 mData.mSystemProperties.queryInterfaceTo(aSystemProperties); 629 629 return S_OK; 630 630 } 631 631 632 632 STDMETHODIMP 633 VirtualBox::COMGETTER(Machines) (ComSafeArrayOut 634 { 635 if (ComSafeArrayOutIsNull 633 VirtualBox::COMGETTER(Machines) (ComSafeArrayOut(IMachine *, aMachines)) 634 { 635 if (ComSafeArrayOutIsNull(aMachines)) 636 636 return E_POINTER; 637 637 638 AutoCaller autoCaller 639 CheckComRCReturnRC 640 641 AutoReadLock alock 642 643 SafeIfaceArray 644 machines.detachTo (ComSafeArrayOutArg(aMachines));638 AutoCaller autoCaller(this); 639 CheckComRCReturnRC(autoCaller.rc()); 640 641 AutoReadLock alock(this); 642 643 SafeIfaceArray<IMachine> machines (mData.mMachines); 644 machines.detachTo(ComSafeArrayOutArg(aMachines)); 645 645 646 646 return S_OK; 647 647 } 648 648 649 STDMETHODIMP VirtualBox::COMGETTER(HardDisks) (ComSafeArrayOut 650 { 651 if (ComSafeArrayOutIsNull 649 STDMETHODIMP VirtualBox::COMGETTER(HardDisks) (ComSafeArrayOut(IHardDisk *, aHardDisks)) 650 { 651 if (ComSafeArrayOutIsNull(aHardDisks)) 652 652 return E_POINTER; 653 653 654 AutoCaller autoCaller 655 CheckComRCReturnRC 656 657 AutoReadLock alock 654 AutoCaller autoCaller(this); 655 CheckComRCReturnRC(autoCaller.rc()); 656 657 AutoReadLock alock(this); 658 658 659 659 SafeIfaceArray<IHardDisk> hardDisks (mData.mHardDisks); 660 hardDisks.detachTo (ComSafeArrayOutArg(aHardDisks));660 hardDisks.detachTo(ComSafeArrayOutArg(aHardDisks)); 661 661 662 662 return S_OK; … … 664 664 665 665 STDMETHODIMP 666 VirtualBox::COMGETTER(DVDImages) (ComSafeArrayOut 667 { 668 if (ComSafeArrayOutIsNull 666 VirtualBox::COMGETTER(DVDImages) (ComSafeArrayOut(IDVDImage *, aDVDImages)) 667 { 668 if (ComSafeArrayOutIsNull(aDVDImages)) 669 669 return E_POINTER; 670 670 671 AutoCaller autoCaller 672 CheckComRCReturnRC 673 674 AutoReadLock alock 675 676 SafeIfaceArray 677 images.detachTo (ComSafeArrayOutArg(aDVDImages));671 AutoCaller autoCaller(this); 672 CheckComRCReturnRC(autoCaller.rc()); 673 674 AutoReadLock alock(this); 675 676 SafeIfaceArray<IDVDImage> images (mData.mDVDImages); 677 images.detachTo(ComSafeArrayOutArg(aDVDImages)); 678 678 679 679 return S_OK; … … 683 683 VirtualBox::COMGETTER(FloppyImages) (ComSafeArrayOut(IFloppyImage *, aFloppyImages)) 684 684 { 685 if (ComSafeArrayOutIsNull 685 if (ComSafeArrayOutIsNull(aFloppyImages)) 686 686 return E_POINTER; 687 687 688 AutoCaller autoCaller 689 CheckComRCReturnRC 690 691 AutoReadLock alock 688 AutoCaller autoCaller(this); 689 CheckComRCReturnRC(autoCaller.rc()); 690 691 AutoReadLock alock(this); 692 692 693 693 SafeIfaceArray<IFloppyImage> images (mData.mFloppyImages); 694 images.detachTo (ComSafeArrayOutArg(aFloppyImages));694 images.detachTo(ComSafeArrayOutArg(aFloppyImages)); 695 695 696 696 return S_OK; 697 697 } 698 698 699 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations) (ComSafeArrayOut 699 STDMETHODIMP VirtualBox::COMGETTER(ProgressOperations) (ComSafeArrayOut(IProgress *, aOperations)) 700 700 { 701 701 CheckComArgOutSafeArrayPointerValid(aOperations); 702 702 703 AutoCaller autoCaller 704 CheckComRCReturnRC 703 AutoCaller autoCaller(this); 704 CheckComRCReturnRC(autoCaller.rc()); 705 705 706 706 /* protect mProgressOperations */ 707 707 AutoReadLock safeLock (mSafeLock); 708 708 709 SafeIfaceArray 710 progress.detachTo (ComSafeArrayOutArg(aOperations));709 SafeIfaceArray<IProgress> progress (mData.mProgressOperations); 710 progress.detachTo(ComSafeArrayOutArg(aOperations)); 711 711 712 712 return S_OK; 713 713 } 714 714 715 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes) (ComSafeArrayOut 715 STDMETHODIMP VirtualBox::COMGETTER(GuestOSTypes) (ComSafeArrayOut(IGuestOSType *, aGuestOSTypes)) 716 716 { 717 717 CheckComArgOutSafeArrayPointerValid(aGuestOSTypes); 718 718 719 AutoCaller autoCaller 720 CheckComRCReturnRC 721 722 AutoReadLock alock 723 724 SafeIfaceArray 725 ostypes.detachTo (ComSafeArrayOutArg(aGuestOSTypes));719 AutoCaller autoCaller(this); 720 CheckComRCReturnRC(autoCaller.rc()); 721 722 AutoReadLock alock(this); 723 724 SafeIfaceArray<IGuestOSType> ostypes (mData.mGuestOSTypes); 725 ostypes.detachTo(ComSafeArrayOutArg(aGuestOSTypes)); 726 726 727 727 return S_OK; … … 729 729 730 730 STDMETHODIMP 731 VirtualBox::COMGETTER(SharedFolders) (ComSafeArrayOut 731 VirtualBox::COMGETTER(SharedFolders) (ComSafeArrayOut(ISharedFolder *, aSharedFolders)) 732 732 { 733 733 #ifndef RT_OS_WINDOWS … … 737 737 CheckComArgOutSafeArrayPointerValid(aSharedFolders); 738 738 739 AutoCaller autoCaller 740 CheckComRCReturnRC 739 AutoCaller autoCaller(this); 740 CheckComRCReturnRC(autoCaller.rc()); 741 741 742 742 return setError (E_NOTIMPL, "Not yet implemented"); … … 749 749 CheckComArgOutSafeArrayPointerValid(aPerformanceCollector); 750 750 751 AutoCaller autoCaller 752 CheckComRCReturnRC 751 AutoCaller autoCaller(this); 752 CheckComRCReturnRC(autoCaller.rc()); 753 753 754 754 /* mPerformanceCollector is const, no need to lock */ 755 mData.mPerformanceCollector.queryInterfaceTo 755 mData.mPerformanceCollector.queryInterfaceTo(aPerformanceCollector); 756 756 757 757 return S_OK; … … 762 762 763 763 STDMETHODIMP 764 VirtualBox::COMGETTER(DHCPServers) (ComSafeArrayOut 765 { 766 if (ComSafeArrayOutIsNull 764 VirtualBox::COMGETTER(DHCPServers) (ComSafeArrayOut(IDHCPServer *, aDHCPServers)) 765 { 766 if (ComSafeArrayOutIsNull(aDHCPServers)) 767 767 return E_POINTER; 768 768 769 AutoCaller autoCaller 770 CheckComRCReturnRC 771 772 AutoReadLock alock 769 AutoCaller autoCaller(this); 770 CheckComRCReturnRC(autoCaller.rc()); 771 772 AutoReadLock alock(this); 773 773 774 774 SafeIfaceArray<IDHCPServer> svrs (mData.mDHCPServers); 775 svrs.detachTo (ComSafeArrayOutArg(aDHCPServers));775 svrs.detachTo(ComSafeArrayOutArg(aDHCPServers)); 776 776 777 777 return S_OK; … … 789 789 { 790 790 LogFlowThisFuncEnter(); 791 LogFlowThisFunc 791 LogFlowThisFunc(("aName=\"%ls\",aOsTypeId =\"%ls\",aBaseFolder=\"%ls\"\n", aName, aOsTypeId, aBaseFolder)); 792 792 793 793 CheckComArgStrNotEmptyOrNull (aName); 794 794 /** @todo tighten checks on aId? */ 795 CheckComArgOutPointerValid 796 797 AutoCaller autoCaller 798 CheckComRCReturnRC 795 CheckComArgOutPointerValid(aMachine); 796 797 AutoCaller autoCaller(this); 798 CheckComRCReturnRC(autoCaller.rc()); 799 799 800 800 /* Compose the settings file name using the following scheme: … … 819 819 820 820 /* create a new object */ 821 ComObjPtr 821 ComObjPtr<Machine> machine; 822 822 rc = machine.createObject(); 823 CheckComRCReturnRC 823 CheckComRCReturnRC(rc); 824 824 825 825 /* Create UUID if an empty one was specified. */ … … 853 853 rc = machine->init (this, settingsFile, Machine::Init_New, aName, osType, 854 854 TRUE /* aNameSync */, &id); 855 if (SUCCEEDED 855 if (SUCCEEDED(rc)) 856 856 { 857 857 /* set the return value */ 858 rc = machine.queryInterfaceTo 858 rc = machine.queryInterfaceTo(aMachine); 859 859 AssertComRC (rc); 860 860 } … … 874 874 CheckComArgStrNotEmptyOrNull (aSettingsFile); 875 875 /** @todo tighten checks on aId? */ 876 CheckComArgOutPointerValid 877 878 AutoCaller autoCaller 879 CheckComRCReturnRC 876 CheckComArgOutPointerValid(aMachine); 877 878 AutoCaller autoCaller(this); 879 CheckComRCReturnRC(autoCaller.rc()); 880 880 881 881 HRESULT rc = E_FAIL; … … 889 889 ComObjPtr<Machine> machine; 890 890 rc = machine.createObject(); 891 CheckComRCReturnRC 891 CheckComRCReturnRC(rc); 892 892 893 893 /* Create UUID if an empty one was specified. */ … … 921 921 rc = machine->init (this, Bstr (settingsFile), Machine::Init_New, 922 922 aName, osType, FALSE /* aNameSync */, &id); 923 if (SUCCEEDED 923 if (SUCCEEDED(rc)) 924 924 { 925 925 /* set the return value */ 926 rc = machine.queryInterfaceTo 926 rc = machine.queryInterfaceTo(aMachine); 927 927 AssertComRC (rc); 928 928 } … … 937 937 CheckComArgOutSafeArrayPointerValid(aMachine); 938 938 939 AutoCaller autoCaller 940 CheckComRCReturnRC 939 AutoCaller autoCaller(this); 940 CheckComRCReturnRC(autoCaller.rc()); 941 941 942 942 HRESULT rc = E_FAIL; … … 945 945 ComObjPtr<Machine> machine; 946 946 rc = machine.createObject(); 947 if (SUCCEEDED 947 if (SUCCEEDED(rc)) 948 948 { 949 949 /* initialize the machine object */ 950 950 rc = machine->init (this, aSettingsFile, Machine::Init_Existing); 951 if (SUCCEEDED 951 if (SUCCEEDED(rc)) 952 952 { 953 953 /* set the return value */ 954 rc = machine.queryInterfaceTo 954 rc = machine.queryInterfaceTo(aMachine); 955 955 ComAssertComRC (rc); 956 956 } … … 965 965 CheckComArgNotNull(aMachine); 966 966 967 AutoCaller autoCaller 968 CheckComRCReturnRC 967 AutoCaller autoCaller(this); 968 CheckComRCReturnRC(autoCaller.rc()); 969 969 970 970 HRESULT rc; … … 972 972 Bstr name; 973 973 rc = aMachine->COMGETTER(Name) (name.asOutParam()); 974 CheckComRCReturnRC 974 CheckComRCReturnRC(rc); 975 975 976 976 /* We need the children map lock here to keep the getDependentChild() result … … 996 996 997 997 /* fire an event */ 998 if (SUCCEEDED 998 if (SUCCEEDED(rc)) 999 999 onMachineRegistered (machine->id(), TRUE); 1000 1000 … … 1007 1007 CheckComArgOutSafeArrayPointerValid(aMachine); 1008 1008 1009 AutoCaller autoCaller 1010 CheckComRCReturnRC 1011 1012 ComObjPtr 1009 AutoCaller autoCaller(this); 1010 CheckComRCReturnRC(autoCaller.rc()); 1011 1012 ComObjPtr<Machine> machine; 1013 1013 HRESULT rc = findMachine (Guid (aId), true /* setError */, &machine); 1014 1014 1015 1015 /* the below will set *aMachine to NULL if machine is null */ 1016 machine.queryInterfaceTo 1016 machine.queryInterfaceTo(aMachine); 1017 1017 1018 1018 return rc; … … 1023 1023 { 1024 1024 LogFlowThisFuncEnter(); 1025 LogFlowThisFunc 1025 LogFlowThisFunc(("aName=\"%ls\", aMachine={%p}\n", aName, aMachine)); 1026 1026 1027 1027 CheckComArgNotNull(aName); 1028 1028 CheckComArgOutSafeArrayPointerValid(aMachine); 1029 1029 1030 AutoCaller autoCaller 1031 CheckComRCReturnRC 1030 AutoCaller autoCaller(this); 1031 CheckComRCReturnRC(autoCaller.rc()); 1032 1032 1033 1033 /* start with not found */ 1034 ComObjPtr 1034 ComObjPtr<Machine> machine; 1035 1035 MachineList machines; 1036 1036 { 1037 1037 /* take a copy for safe iteration outside the lock */ 1038 AutoReadLock alock 1038 AutoReadLock alock(this); 1039 1039 machines = mData.mMachines; 1040 1040 } … … 1057 1057 1058 1058 /* this will set (*machine) to NULL if machineObj is null */ 1059 machine.queryInterfaceTo 1059 machine.queryInterfaceTo(aMachine); 1060 1060 1061 1061 HRESULT rc = machine … … 1064 1064 tr ("Could not find a registered machine named '%ls'"), aName); 1065 1065 1066 LogFlowThisFunc 1066 LogFlowThisFunc(("rc=%08X\n", rc)); 1067 1067 LogFlowThisFuncLeave(); 1068 1068 … … 1078 1078 return E_INVALIDARG; 1079 1079 1080 AutoCaller autoCaller 1081 CheckComRCReturnRC 1082 1083 AutoWriteLock alock 1084 1085 ComObjPtr 1080 AutoCaller autoCaller(this); 1081 CheckComRCReturnRC(autoCaller.rc()); 1082 1083 AutoWriteLock alock(this); 1084 1085 ComObjPtr<Machine> machine; 1086 1086 1087 1087 HRESULT rc = findMachine (id, true /* setError */, &machine); 1088 CheckComRCReturnRC 1088 CheckComRCReturnRC(rc); 1089 1089 1090 1090 rc = machine->trySetRegistered (FALSE); 1091 CheckComRCReturnRC 1091 CheckComRCReturnRC(rc); 1092 1092 1093 1093 /* remove from the collection of registered machines */ … … 1098 1098 1099 1099 /* return the unregistered machine to the caller */ 1100 machine.queryInterfaceTo 1100 machine.queryInterfaceTo(aMachine); 1101 1101 1102 1102 /* fire an event */ … … 1110 1110 IHardDisk **aHardDisk) 1111 1111 { 1112 CheckComArgOutPointerValid 1113 1114 AutoCaller autoCaller 1115 CheckComRCReturnRC 1112 CheckComArgOutPointerValid(aHardDisk); 1113 1114 AutoCaller autoCaller(this); 1115 CheckComRCReturnRC(autoCaller.rc()); 1116 1116 1117 1117 /* we don't access non-const data members so no need to lock */ … … 1130 1130 rc = hardDisk->init(this, format, aLocation); 1131 1131 1132 if (SUCCEEDED 1133 hardDisk.queryInterfaceTo 1132 if (SUCCEEDED(rc)) 1133 hardDisk.queryInterfaceTo(aHardDisk); 1134 1134 1135 1135 return rc; … … 1147 1147 CheckComArgOutSafeArrayPointerValid(aHardDisk); 1148 1148 1149 AutoCaller autoCaller 1150 CheckComRCReturnRC 1149 AutoCaller autoCaller(this); 1150 CheckComRCReturnRC(autoCaller.rc()); 1151 1151 1152 1152 /* we don't access non-const data members so no need to lock */ … … 1171 1171 aSetParentId, parentId); 1172 1172 1173 if (SUCCEEDED 1173 if (SUCCEEDED(rc)) 1174 1174 { 1175 1175 rc = registerHardDisk (hardDisk); … … 1179 1179 * with the parent and this association needs to be broken. */ 1180 1180 1181 if (SUCCEEDED 1182 hardDisk.queryInterfaceTo 1181 if (SUCCEEDED(rc)) 1182 hardDisk.queryInterfaceTo(aHardDisk); 1183 1183 else 1184 1184 hardDisk->uninit(); … … 1193 1193 CheckComArgOutSafeArrayPointerValid(aHardDisk); 1194 1194 1195 AutoCaller autoCaller 1196 CheckComRCReturnRC 1195 AutoCaller autoCaller(this); 1196 CheckComRCReturnRC(autoCaller.rc()); 1197 1197 1198 1198 Guid id(aId); … … 1201 1201 1202 1202 /* the below will set *aHardDisk to NULL if hardDisk is null */ 1203 hardDisk.queryInterfaceTo 1203 hardDisk.queryInterfaceTo(aHardDisk); 1204 1204 1205 1205 return rc; … … 1212 1212 CheckComArgOutSafeArrayPointerValid(aHardDisk); 1213 1213 1214 AutoCaller autoCaller 1215 CheckComRCReturnRC 1214 AutoCaller autoCaller(this); 1215 CheckComRCReturnRC(autoCaller.rc()); 1216 1216 1217 1217 ComObjPtr<HardDisk> hardDisk; … … 1219 1219 1220 1220 /* the below will set *aHardDisk to NULL if hardDisk is null */ 1221 hardDisk.queryInterfaceTo 1221 hardDisk.queryInterfaceTo(aHardDisk); 1222 1222 1223 1223 return rc; … … 1231 1231 CheckComArgOutSafeArrayPointerValid(aDVDImage); 1232 1232 1233 AutoCaller autoCaller 1234 CheckComRCReturnRC 1233 AutoCaller autoCaller(this); 1234 CheckComRCReturnRC(autoCaller.rc()); 1235 1235 1236 1236 HRESULT rc = VBOX_E_FILE_ERROR; … … 1241 1241 id.create(); 1242 1242 1243 ComObjPtr 1243 ComObjPtr<DVDImage> image; 1244 1244 image.createObject(); 1245 1245 rc = image->init (this, aLocation, id); 1246 if (SUCCEEDED 1246 if (SUCCEEDED(rc)) 1247 1247 { 1248 1248 rc = registerDVDImage (image); 1249 1249 1250 if (SUCCEEDED 1251 image.queryInterfaceTo 1250 if (SUCCEEDED(rc)) 1251 image.queryInterfaceTo(aDVDImage); 1252 1252 } 1253 1253 … … 1260 1260 CheckComArgOutSafeArrayPointerValid(aDVDImage); 1261 1261 1262 AutoCaller autoCaller 1263 CheckComRCReturnRC 1262 AutoCaller autoCaller(this); 1263 CheckComRCReturnRC(autoCaller.rc()); 1264 1264 1265 1265 Guid id(aId); 1266 ComObjPtr 1266 ComObjPtr<DVDImage> image; 1267 1267 HRESULT rc = findDVDImage (&id, NULL, true /* setError */, &image); 1268 1268 1269 1269 /* the below will set *aDVDImage to NULL if image is null */ 1270 image.queryInterfaceTo 1270 image.queryInterfaceTo(aDVDImage); 1271 1271 1272 1272 return rc; … … 1279 1279 CheckComArgOutSafeArrayPointerValid(aDVDImage); 1280 1280 1281 AutoCaller autoCaller 1282 CheckComRCReturnRC 1283 1284 ComObjPtr 1281 AutoCaller autoCaller(this); 1282 CheckComRCReturnRC(autoCaller.rc()); 1283 1284 ComObjPtr<DVDImage> image; 1285 1285 HRESULT rc = findDVDImage (NULL, aLocation, true /* setError */, &image); 1286 1286 1287 1287 /* the below will set *aDVDImage to NULL if dvd is null */ 1288 image.queryInterfaceTo 1288 image.queryInterfaceTo(aDVDImage); 1289 1289 1290 1290 return rc; … … 1298 1298 CheckComArgOutSafeArrayPointerValid(aFloppyImage); 1299 1299 1300 AutoCaller autoCaller 1301 CheckComRCReturnRC 1300 AutoCaller autoCaller(this); 1301 CheckComRCReturnRC(autoCaller.rc()); 1302 1302 1303 1303 HRESULT rc = VBOX_E_FILE_ERROR; … … 1311 1311 image.createObject(); 1312 1312 rc = image->init (this, aLocation, id); 1313 if (SUCCEEDED 1313 if (SUCCEEDED(rc)) 1314 1314 { 1315 1315 rc = registerFloppyImage (image); 1316 1316 1317 if (SUCCEEDED 1318 image.queryInterfaceTo 1317 if (SUCCEEDED(rc)) 1318 image.queryInterfaceTo(aFloppyImage); 1319 1319 } 1320 1320 … … 1329 1329 CheckComArgOutSafeArrayPointerValid(aFloppyImage); 1330 1330 1331 AutoCaller autoCaller 1332 CheckComRCReturnRC 1331 AutoCaller autoCaller(this); 1332 CheckComRCReturnRC(autoCaller.rc()); 1333 1333 1334 1334 Guid id(aId); … … 1337 1337 1338 1338 /* the below will set *aFloppyImage to NULL if image is null */ 1339 image.queryInterfaceTo 1339 image.queryInterfaceTo(aFloppyImage); 1340 1340 1341 1341 return rc; … … 1349 1349 CheckComArgOutSafeArrayPointerValid(aFloppyImage); 1350 1350 1351 AutoCaller autoCaller 1352 CheckComRCReturnRC 1351 AutoCaller autoCaller(this); 1352 CheckComRCReturnRC(autoCaller.rc()); 1353 1353 1354 1354 ComObjPtr<FloppyImage> image; … … 1356 1356 1357 1357 /* the below will set *aFloppyImage to NULL if img is null */ 1358 image.queryInterfaceTo 1358 image.queryInterfaceTo(aFloppyImage); 1359 1359 1360 1360 return rc; … … 1385 1385 CheckComArgNotNull (aType); 1386 1386 1387 AutoCaller autoCaller 1388 CheckComRCReturnRC 1387 AutoCaller autoCaller(this); 1388 CheckComRCReturnRC(autoCaller.rc()); 1389 1389 1390 1390 /* first, look for a substitution */ … … 1401 1401 *aType = NULL; 1402 1402 1403 AutoReadLock alock 1403 AutoReadLock alock(this); 1404 1404 1405 1405 for (GuestOSTypeList::iterator it = mData.mGuestOSTypes.begin(); … … 1411 1411 if (typeId.compareIgnoreCase (id) == 0) 1412 1412 { 1413 (*it).queryInterfaceTo 1413 (*it).queryInterfaceTo(aType); 1414 1414 break; 1415 1415 } … … 1428 1428 CheckComArgNotNull(aHostPath); 1429 1429 1430 AutoCaller autoCaller 1431 CheckComRCReturnRC 1430 AutoCaller autoCaller(this); 1431 CheckComRCReturnRC(autoCaller.rc()); 1432 1432 1433 1433 return setError (E_NOTIMPL, "Not yet implemented"); … … 1438 1438 CheckComArgNotNull(aName); 1439 1439 1440 AutoCaller autoCaller 1441 CheckComRCReturnRC 1440 AutoCaller autoCaller(this); 1441 CheckComRCReturnRC(autoCaller.rc()); 1442 1442 1443 1443 return setError (E_NOTIMPL, "Not yet implemented"); … … 1452 1452 CheckComArgNotNull(aNextKey); 1453 1453 1454 AutoCaller autoCaller 1455 CheckComRCReturnRC 1454 AutoCaller autoCaller(this); 1455 CheckComRCReturnRC(autoCaller.rc()); 1456 1456 1457 1457 /* start with nothing found */ … … 1465 1465 1466 1466 /* serialize file access (prevent writes) */ 1467 AutoReadLock alock 1467 AutoReadLock alock(this); 1468 1468 1469 1469 try … … 1478 1478 1479 1479 rc = VirtualBox::loadSettingsTree_Again (tree, file); 1480 CheckComRCReturnRC 1480 CheckComRCReturnRC(rc); 1481 1481 1482 1482 Key globalNode = tree.rootKey().key ("Global"); … … 1496 1496 if (bstrInKey.isEmpty()) 1497 1497 { 1498 key.cloneTo 1498 key.cloneTo(aNextKey); 1499 1499 if (aNextValue) 1500 1500 { 1501 1501 Bstr val = (*it).stringValue ("value"); 1502 val.cloneTo 1502 val.cloneTo(aNextValue); 1503 1503 } 1504 1504 return S_OK; … … 1513 1513 { 1514 1514 Bstr key = (*it).stringValue ("name"); 1515 key.cloneTo 1515 key.cloneTo(aNextKey); 1516 1516 if (aNextValue) 1517 1517 { 1518 1518 Bstr val = (*it).stringValue ("value"); 1519 val.cloneTo 1519 val.cloneTo(aNextValue); 1520 1520 } 1521 1521 } … … 1553 1553 CheckComArgNotNull(aValue); 1554 1554 1555 AutoCaller autoCaller 1556 CheckComRCReturnRC 1555 AutoCaller autoCaller(this); 1556 CheckComRCReturnRC(autoCaller.rc()); 1557 1557 1558 1558 /* start with nothing found */ … … 1562 1562 1563 1563 /* serialize file access (prevent writes) */ 1564 AutoReadLock alock 1564 AutoReadLock alock(this); 1565 1565 1566 1566 try … … 1575 1575 1576 1576 rc = VirtualBox::loadSettingsTree_Again (tree, file); 1577 CheckComRCReturnRC 1577 CheckComRCReturnRC(rc); 1578 1578 1579 1579 const Utf8Str key = aKey; … … 1592 1592 { 1593 1593 Bstr val = (*it).stringValue ("value"); 1594 val.cloneTo 1594 val.cloneTo(aValue); 1595 1595 break; 1596 1596 } … … 1613 1613 CheckComArgNotNull(aKey); 1614 1614 1615 AutoCaller autoCaller 1616 CheckComRCReturnRC 1615 AutoCaller autoCaller(this); 1616 CheckComRCReturnRC(autoCaller.rc()); 1617 1617 1618 1618 Guid emptyGuid; … … 1627 1627 1628 1628 /* serialize file access (prevent concurrent reads and writes) */ 1629 AutoWriteLock alock 1629 AutoWriteLock alock(this); 1630 1630 1631 1631 try … … 1639 1639 1640 1640 rc = VirtualBox::loadSettingsTree_ForUpdate (tree, file); 1641 CheckComRCReturnRC 1641 CheckComRCReturnRC(rc); 1642 1642 1643 1643 const Utf8Str key = aKey; … … 1700 1700 rc = VirtualBox::saveSettingsTree (tree, file, 1701 1701 mData.mSettingsFileVersion); 1702 CheckComRCReturnRC 1702 CheckComRCReturnRC(rc); 1703 1703 } 1704 1704 } … … 1709 1709 1710 1710 /* fire a notification */ 1711 if (SUCCEEDED 1711 if (SUCCEEDED(rc) && changed) 1712 1712 onExtraDataChange (Guid::Empty, aKey, aValue); 1713 1713 … … 1722 1722 CheckComArgNotNull(aSession); 1723 1723 1724 AutoCaller autoCaller 1725 CheckComRCReturnRC 1724 AutoCaller autoCaller(this); 1725 CheckComRCReturnRC(autoCaller.rc()); 1726 1726 1727 1727 Guid id(aMachineId); 1728 ComObjPtr 1728 ComObjPtr<Machine> machine; 1729 1729 1730 1730 HRESULT rc = findMachine (id, true /* setError */, &machine); 1731 CheckComRCReturnRC 1731 CheckComRCReturnRC(rc); 1732 1732 1733 1733 /* check the session state */ 1734 1734 SessionState_T state; 1735 1735 rc = aSession->COMGETTER(State) (&state); 1736 CheckComRCReturnRC 1736 CheckComRCReturnRC(rc); 1737 1737 1738 1738 if (state != SessionState_Closed) … … 1741 1741 1742 1742 /* get the IInternalSessionControl interface */ 1743 ComPtr 1743 ComPtr<IInternalSessionControl> control = aSession; 1744 1744 ComAssertMsgRet (!!control, ("No IInternalSessionControl interface"), 1745 1745 E_INVALIDARG); … … 1747 1747 rc = machine->openSession (control); 1748 1748 1749 if (SUCCEEDED 1749 if (SUCCEEDED(rc)) 1750 1750 { 1751 1751 /* … … 1778 1778 CheckComArgOutSafeArrayPointerValid(aProgress); 1779 1779 1780 AutoCaller autoCaller 1781 CheckComRCReturnRC 1780 AutoCaller autoCaller(this); 1781 CheckComRCReturnRC(autoCaller.rc()); 1782 1782 1783 1783 Guid id(aMachineId); 1784 ComObjPtr 1784 ComObjPtr<Machine> machine; 1785 1785 1786 1786 HRESULT rc = findMachine (id, true /* setError */, &machine); 1787 CheckComRCReturnRC 1787 CheckComRCReturnRC(rc); 1788 1788 1789 1789 /* check the session state */ 1790 1790 SessionState_T state; 1791 1791 rc = aSession->COMGETTER(State) (&state); 1792 CheckComRCReturnRC 1792 CheckComRCReturnRC(rc); 1793 1793 1794 1794 if (state != SessionState_Closed) … … 1797 1797 1798 1798 /* get the IInternalSessionControl interface */ 1799 ComPtr 1799 ComPtr<IInternalSessionControl> control = aSession; 1800 1800 ComAssertMsgRet (!!control, ("No IInternalSessionControl interface"), 1801 1801 E_INVALIDARG); 1802 1802 1803 1803 /* create a progress object */ 1804 ComObjPtr 1804 ComObjPtr<Progress> progress; 1805 1805 progress.createObject(); 1806 1806 progress->init (this, static_cast <IMachine *> (machine), … … 1810 1810 rc = machine->openRemoteSession (control, aType, aEnvironment, progress); 1811 1811 1812 if (SUCCEEDED 1813 { 1814 progress.queryInterfaceTo 1812 if (SUCCEEDED(rc)) 1813 { 1814 progress.queryInterfaceTo(aProgress); 1815 1815 1816 1816 /* signal the client watcher thread */ … … 1832 1832 CheckComArgNotNull(aSession); 1833 1833 1834 AutoCaller autoCaller 1835 CheckComRCReturnRC 1834 AutoCaller autoCaller(this); 1835 CheckComRCReturnRC(autoCaller.rc()); 1836 1836 1837 1837 Guid id(aMachineId); 1838 ComObjPtr 1838 ComObjPtr<Machine> machine; 1839 1839 1840 1840 HRESULT rc = findMachine (id, true /* setError */, &machine); 1841 CheckComRCReturnRC 1841 CheckComRCReturnRC(rc); 1842 1842 1843 1843 /* check the session state */ 1844 1844 SessionState_T state; 1845 1845 rc = aSession->COMGETTER(State) (&state); 1846 CheckComRCReturnRC 1846 CheckComRCReturnRC(rc); 1847 1847 1848 1848 if (state != SessionState_Closed) … … 1851 1851 1852 1852 /* get the IInternalSessionControl interface */ 1853 ComPtr 1853 ComPtr<IInternalSessionControl> control = aSession; 1854 1854 ComAssertMsgRet (!!control, ("No IInternalSessionControl interface"), 1855 1855 E_INVALIDARG); … … 1865 1865 STDMETHODIMP VirtualBox::RegisterCallback (IVirtualBoxCallback *aCallback) 1866 1866 { 1867 LogFlowThisFunc 1867 LogFlowThisFunc(("aCallback=%p\n", aCallback)); 1868 1868 1869 1869 CheckComArgNotNull(aCallback); 1870 1870 1871 AutoCaller autoCaller 1872 CheckComRCReturnRC 1871 AutoCaller autoCaller(this); 1872 CheckComRCReturnRC(autoCaller.rc()); 1873 1873 1874 1874 #if 0 /** @todo r=bird,r=pritesh: must check that the interface id match correct or we might screw up with old code! */ … … 1880 1880 #endif 1881 1881 1882 AutoWriteLock alock 1882 AutoWriteLock alock(this); 1883 1883 mData.mCallbacks.push_back (CallbackList::value_type (aCallback)); 1884 1884 … … 1893 1893 CheckComArgNotNull(aCallback); 1894 1894 1895 AutoCaller autoCaller 1896 CheckComRCReturnRC 1895 AutoCaller autoCaller(this); 1896 CheckComRCReturnRC(autoCaller.rc()); 1897 1897 1898 1898 HRESULT rc = S_OK; 1899 1899 1900 AutoWriteLock alock 1900 AutoWriteLock alock(this); 1901 1901 1902 1902 CallbackList::iterator it; … … 1909 1909 mData.mCallbacks.erase (it); 1910 1910 1911 LogFlowThisFunc 1911 LogFlowThisFunc(("aCallback=%p, rc=%08X\n", aCallback, rc)); 1912 1912 return rc; 1913 1913 } … … 1922 1922 STDMETHODIMP VirtualBox::SaveSettings() 1923 1923 { 1924 AutoCaller autoCaller 1925 CheckComRCReturnRC 1924 AutoCaller autoCaller(this); 1925 CheckComRCReturnRC(autoCaller.rc()); 1926 1926 1927 1927 return saveSettings(); … … 1932 1932 CheckComArgNotNull(aBakFileName); 1933 1933 1934 AutoCaller autoCaller 1935 CheckComRCReturnRC 1934 AutoCaller autoCaller(this); 1935 CheckComRCReturnRC(autoCaller.rc()); 1936 1936 1937 1937 /* saveSettings() needs write lock */ 1938 AutoWriteLock alock 1938 AutoWriteLock alock(this); 1939 1939 1940 1940 /* perform backup only when there was auto-conversion */ … … 1946 1946 mData.mSettingsFileVersion, 1947 1947 bakFileName); 1948 CheckComRCReturnRC 1949 1950 bakFileName.cloneTo 1948 CheckComRCReturnRC(rc); 1949 1950 bakFileName.cloneTo(aBakFileName); 1951 1951 } 1952 1952 … … 1974 1974 HRESULT VirtualBox::postEvent (Event *event) 1975 1975 { 1976 AutoCaller autoCaller 1976 AutoCaller autoCaller(this); 1977 1977 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 1978 1978 … … 1985 1985 } 1986 1986 1987 AssertReturn 1988 AssertReturn 1987 AssertReturn(event, E_FAIL); 1988 AssertReturn(mAsyncEventQ, E_FAIL); 1989 1989 1990 1990 if (mAsyncEventQ->postEvent (event)) … … 2006 2006 CheckComArgNotNull(aProgress); 2007 2007 2008 AutoCaller autoCaller 2009 CheckComRCReturnRC 2008 AutoCaller autoCaller(this); 2009 CheckComRCReturnRC(autoCaller.rc()); 2010 2010 2011 2011 Bstr id; 2012 2012 HRESULT rc = aProgress->COMGETTER(Id) (id.asOutParam()); 2013 AssertComRCReturnRC 2013 AssertComRCReturnRC(rc); 2014 2014 2015 2015 /* protect mProgressOperations */ … … 2030 2030 HRESULT VirtualBox::removeProgress (IN_GUID aId) 2031 2031 { 2032 AutoCaller autoCaller 2033 CheckComRCReturnRC 2034 2035 ComPtr 2032 AutoCaller autoCaller(this); 2033 CheckComRCReturnRC(autoCaller.rc()); 2034 2035 ComPtr<IProgress> progress; 2036 2036 2037 2037 /* protect mProgressOperations */ … … 2049 2049 struct StartSVCHelperClientData 2050 2050 { 2051 ComObjPtr 2052 ComObjPtr 2051 ComObjPtr<VirtualBox> that; 2052 ComObjPtr<Progress> progress; 2053 2053 bool privileged; 2054 2054 VirtualBox::SVCHelperClientFunc func; … … 2108 2108 void *aUser, Progress *aProgress) 2109 2109 { 2110 AssertReturn 2111 AssertReturn 2112 2113 AutoCaller autoCaller 2114 CheckComRCReturnRC 2110 AssertReturn(aFunc, E_POINTER); 2111 AssertReturn(aProgress, E_POINTER); 2112 2113 AutoCaller autoCaller(this); 2114 CheckComRCReturnRC(autoCaller.rc()); 2115 2115 2116 2116 /* create the SVCHelperClientThread() argument */ 2117 2117 std::auto_ptr <StartSVCHelperClientData> 2118 2118 d (new StartSVCHelperClientData()); 2119 AssertReturn 2119 AssertReturn(d.get(), E_OUTOFMEMORY); 2120 2120 2121 2121 d->that = this; … … 2158 2158 { 2159 2159 AssertBreakStmt (d.get(), rc = E_POINTER); 2160 AssertReturn 2160 AssertReturn(!d->progress.isNull(), E_POINTER); 2161 2161 2162 2162 /* protect VirtualBox from uninitialization */ 2163 AutoCaller autoCaller 2163 AutoCaller autoCaller(d->that); 2164 2164 if (!autoCaller.isOk()) 2165 2165 { … … 2176 2176 vrc = client.create (Utf8StrFmt ("VirtualBox\\SVCHelper\\{%RTuuid}", 2177 2177 id.raw())); 2178 if (RT_FAILURE 2178 if (RT_FAILURE(vrc)) 2179 2179 { 2180 2180 rc = setError (E_FAIL, … … 2233 2233 const char *args[] = { exePath, "/Helper", client.name(), 0 }; 2234 2234 vrc = RTProcCreate (exePath, args, RTENV_DEFAULT, 0, &pid); 2235 if (RT_FAILURE 2235 if (RT_FAILURE(vrc)) 2236 2236 { 2237 2237 rc = setError (E_FAIL, … … 2243 2243 /* wait for the client to connect */ 2244 2244 vrc = client.connect(); 2245 if (RT_SUCCESS 2245 if (RT_SUCCESS(vrc)) 2246 2246 { 2247 2247 /* start the user supplied function */ … … 2253 2253 { 2254 2254 int vrc2 = client.write (SVCHlpMsg::Null); 2255 if (RT_SUCCESS 2255 if (RT_SUCCESS(vrc)) 2256 2256 vrc = vrc2; 2257 2257 } 2258 2258 2259 if (SUCCEEDED (rc) && RT_FAILURE(vrc))2259 if (SUCCEEDED(rc) && RT_FAILURE(vrc)) 2260 2260 { 2261 2261 rc = setError (E_FAIL, … … 2289 2289 void VirtualBox::updateClientWatcher() 2290 2290 { 2291 AutoCaller autoCaller 2291 AutoCaller autoCaller(this); 2292 2292 AssertComRCReturn (autoCaller.rc(), (void) 0); 2293 2293 2294 AssertReturn 2294 AssertReturn(mWatcherData.mThread != NIL_RTTHREAD, (void) 0); 2295 2295 2296 2296 /* sent an update request */ … … 2312 2312 void VirtualBox::addProcessToReap (RTPROCESS pid) 2313 2313 { 2314 AutoCaller autoCaller 2314 AutoCaller autoCaller(this); 2315 2315 AssertComRCReturn (autoCaller.rc(), (void) 0); 2316 2316 2317 2317 /// @todo (dmik) Win32? 2318 2318 #ifndef RT_OS_WINDOWS 2319 AutoWriteLock alock 2319 AutoWriteLock alock(this); 2320 2320 mWatcherData.mProcesses.push_back (pid); 2321 2321 #endif … … 2341 2341 {} 2342 2342 2343 void handleCallback (const ComPtr 2343 void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) 2344 2344 { 2345 2345 switch (what) … … 2374 2374 * @note Doesn't lock any object. 2375 2375 */ 2376 void VirtualBox::onMachineStateChange 2376 void VirtualBox::onMachineStateChange(const Guid &aId, MachineState_T aState) 2377 2377 { 2378 2378 postEvent (new MachineEvent (this, aId, aState)); … … 2382 2382 * @note Doesn't lock any object. 2383 2383 */ 2384 void VirtualBox::onMachineDataChange 2384 void VirtualBox::onMachineDataChange(const Guid &aId) 2385 2385 { 2386 2386 postEvent (new MachineEvent (this, aId)); … … 2393 2393 Bstr &aError) 2394 2394 { 2395 LogFlowThisFunc 2395 LogFlowThisFunc(("machine={%s} aKey={%ls} aValue={%ls}\n", 2396 2396 aId.toString().raw(), aKey, aValue)); 2397 2397 2398 AutoCaller autoCaller 2398 AutoCaller autoCaller(this); 2399 2399 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 2400 2400 2401 2401 CallbackList list; 2402 2402 { 2403 AutoReadLock alock 2403 AutoReadLock alock(this); 2404 2404 list = mData.mCallbacks; 2405 2405 } … … 2423 2423 } 2424 2424 2425 LogFlowThisFunc 2425 LogFlowThisFunc(("allowChange=%RTbool\n", allowChange)); 2426 2426 return allowChange; 2427 2427 } … … 2436 2436 {} 2437 2437 2438 void handleCallback (const ComPtr 2438 void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) 2439 2439 { 2440 2440 LogFlow (("OnExtraDataChange: machineId={%RTuuid}, key='%ls', val='%ls'\n", … … 2470 2470 {} 2471 2471 2472 void handleCallback (const ComPtr 2472 void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) 2473 2473 { 2474 2474 LogFlow (("OnSessionStateChange: machineId={%RTuuid}, sessionState=%d\n", … … 2501 2501 {} 2502 2502 2503 void handleCallback (const ComPtr 2503 void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) 2504 2504 { 2505 2505 Bstr mid = machineId.toUtf16(); … … 2567 2567 {} 2568 2568 2569 void handleCallback (const ComPtr 2569 void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) 2570 2570 { 2571 2571 LogFlow (("OnGuestPropertyChange: machineId={%RTuuid}, name='%ls', value='%ls', flags='%ls'\n", … … 2590 2590 * @note Locks this object for reading. 2591 2591 */ 2592 ComObjPtr 2593 { 2594 ComObjPtr 2595 2596 AutoCaller autoCaller 2592 ComObjPtr<GuestOSType> VirtualBox::getUnknownOSType() 2593 { 2594 ComObjPtr<GuestOSType> type; 2595 2596 AutoCaller autoCaller(this); 2597 2597 AssertComRCReturn (autoCaller.rc(), type); 2598 2598 2599 AutoReadLock alock 2599 AutoReadLock alock(this); 2600 2600 2601 2601 /* unknown type must always be the first */ … … 2625 2625 InternalControlVector *aControls /*= NULL*/) 2626 2626 { 2627 AutoCaller autoCaller 2627 AutoCaller autoCaller(this); 2628 2628 AssertComRCReturnVoid (autoCaller.rc()); 2629 2629 … … 2632 2632 aControls->clear(); 2633 2633 2634 AutoReadLock alock 2634 AutoReadLock alock(this); 2635 2635 2636 2636 for (MachineList::iterator it = mData.mMachines.begin(); … … 2638 2638 ++ it) 2639 2639 { 2640 ComObjPtr 2641 ComPtr 2640 ComObjPtr<SessionMachine> sm; 2641 ComPtr<IInternalSessionControl> ctl; 2642 2642 if ((*it)->isSessionOpen (sm, &ctl)) 2643 2643 { … … 2667 2667 */ 2668 2668 HRESULT VirtualBox::findMachine (const Guid &aId, bool aSetError, 2669 ComObjPtr 2670 { 2671 AutoCaller autoCaller 2669 ComObjPtr<Machine> *aMachine /* = NULL */) 2670 { 2671 AutoCaller autoCaller(this); 2672 2672 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 2673 2673 … … 2675 2675 2676 2676 { 2677 AutoReadLock alock 2677 AutoReadLock alock(this); 2678 2678 2679 2679 for (MachineList::iterator it = mData.mMachines.begin(); … … 2722 2722 bool aSetError, ComObjPtr<HardDisk> *aHardDisk /*= NULL*/) 2723 2723 { 2724 AssertReturn 2725 2726 AutoReadLock alock 2724 AssertReturn(aId || aLocation, E_INVALIDARG); 2725 2726 AutoReadLock alock(this); 2727 2727 2728 2728 /* first, look up by UUID in the map if UUID is provided */ … … 2751 2751 2752 2752 HRESULT rc = hd->compareLocationTo (location, result); 2753 CheckComRCReturnRC 2753 CheckComRCReturnRC(rc); 2754 2754 2755 2755 if (result == 0) … … 2798 2798 ComObjPtr<DVDImage> *aImage /* = NULL */) 2799 2799 { 2800 AssertReturn 2800 AssertReturn(aId || aLocation, E_INVALIDARG); 2801 2801 2802 2802 Utf8Str location; … … 2805 2805 { 2806 2806 int vrc = calculateFullPath (Utf8Str (aLocation), location); 2807 if (RT_FAILURE 2807 if (RT_FAILURE(vrc)) 2808 2808 return setError (VBOX_E_FILE_ERROR, 2809 2809 tr ("Invalid image file location '%ls' (%Rrc)"), … … 2811 2811 } 2812 2812 2813 AutoReadLock alock 2813 AutoReadLock alock(this); 2814 2814 2815 2815 bool found = false; … … 2870 2870 ComObjPtr<FloppyImage> *aImage /* = NULL */) 2871 2871 { 2872 AssertReturn 2872 AssertReturn(aId || aLocation, E_INVALIDARG); 2873 2873 2874 2874 Utf8Str location; … … 2877 2877 { 2878 2878 int vrc = calculateFullPath (Utf8Str (aLocation), location); 2879 if (RT_FAILURE 2879 if (RT_FAILURE(vrc)) 2880 2880 return setError (VBOX_E_FILE_ERROR, 2881 2881 tr ("Invalid image file location '%ls' (%Rrc)"), … … 2883 2883 } 2884 2884 2885 AutoReadLock alock 2885 AutoReadLock alock(this); 2886 2886 2887 2887 bool found = false; … … 2935 2935 int VirtualBox::calculateFullPath (const char *aPath, Utf8Str &aResult) 2936 2936 { 2937 AutoCaller autoCaller 2937 AutoCaller autoCaller(this); 2938 2938 AssertComRCReturn (autoCaller.rc(), VERR_GENERAL_FAILURE); 2939 2939 … … 2942 2942 char folder [RTPATH_MAX]; 2943 2943 int vrc = RTPathAbsEx (mData.mHomeDir, aPath, folder, sizeof (folder)); 2944 if (RT_SUCCESS 2944 if (RT_SUCCESS(vrc)) 2945 2945 aResult = folder; 2946 2946 … … 2961 2961 void VirtualBox::calculateRelativePath (const char *aPath, Utf8Str &aResult) 2962 2962 { 2963 AutoCaller autoCaller 2963 AutoCaller autoCaller(this); 2964 2964 AssertComRCReturnVoid (autoCaller.rc()); 2965 2965 … … 3002 3002 aConflict.setNull(); 3003 3003 3004 AssertReturn 3005 3006 AutoReadLock alock 3004 AssertReturn(!aId.isEmpty() && !aLocation.isEmpty(), E_FAIL); 3005 3006 AutoReadLock alock(this); 3007 3007 3008 3008 HRESULT rc = S_OK; … … 3011 3011 ComObjPtr<HardDisk> hardDisk; 3012 3012 rc = findHardDisk(&aId, aLocation, false /* aSetError */, &hardDisk); 3013 if (SUCCEEDED 3013 if (SUCCEEDED(rc)) 3014 3014 { 3015 3015 /* Note: no AutoCaller since bound to this */ … … 3025 3025 ComObjPtr<DVDImage> image; 3026 3026 rc = findDVDImage (&aId, aLocation, false /* aSetError */, &image); 3027 if (SUCCEEDED 3027 if (SUCCEEDED(rc)) 3028 3028 { 3029 3029 /* Note: no AutoCaller since bound to this */ … … 3039 3039 ComObjPtr<FloppyImage> image; 3040 3040 rc = findFloppyImage(&aId, aLocation, false /* aSetError */, &image); 3041 if (SUCCEEDED 3041 if (SUCCEEDED(rc)) 3042 3042 { 3043 3043 /* Note: no AutoCaller since bound to this */ … … 3066 3066 using namespace settings; 3067 3067 3068 AutoCaller autoCaller 3069 AssertReturn 3068 AutoCaller autoCaller(this); 3069 AssertReturn(autoCaller.state() == InInit, E_FAIL); 3070 3070 3071 3071 HRESULT rc = S_OK; … … 3081 3081 3082 3082 /* create a new machine object */ 3083 ComObjPtr 3083 ComObjPtr<Machine> machine; 3084 3084 rc = machine.createObject(); 3085 if (SUCCEEDED 3085 if (SUCCEEDED(rc)) 3086 3086 { 3087 3087 /* initialize the machine object and register it */ 3088 3088 rc = machine->init (this, src, Machine::Init_Registered, 3089 3089 NULL, NULL, FALSE, &uuid); 3090 if (SUCCEEDED 3090 if (SUCCEEDED(rc)) 3091 3091 rc = registerMachine (machine); 3092 3092 } … … 3109 3109 using namespace settings; 3110 3110 3111 AutoCaller autoCaller 3112 AssertReturn 3111 AutoCaller autoCaller(this); 3112 AssertReturn(autoCaller.state() == InInit, E_FAIL); 3113 3113 3114 3114 HRESULT rc = S_OK; … … 3201 3201 using namespace settings; 3202 3202 3203 AutoCaller autoCaller 3204 AssertReturn 3203 AutoCaller autoCaller(this); 3204 AssertReturn(autoCaller.state() == InInit, E_FAIL); 3205 3205 3206 3206 HRESULT rc = S_OK; … … 3247 3247 HRESULT VirtualBox::saveSettings() 3248 3248 { 3249 AutoCaller autoCaller 3249 AutoCaller autoCaller(this); 3250 3250 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3251 3251 3252 AssertReturn 3252 AssertReturn(!!mData.mCfgFile.mName, E_FAIL); 3253 3253 3254 3254 HRESULT rc = S_OK; 3255 3255 3256 3256 /* serialize file access (prevents concurrent reads and writes) */ 3257 AutoWriteLock alock 3257 AutoWriteLock alock(this); 3258 3258 3259 3259 try … … 3411 3411 ComAssertRet (aMachine, E_INVALIDARG); 3412 3412 3413 AutoCaller autoCaller 3414 CheckComRCReturnRC 3415 3416 AutoWriteLock alock 3413 AutoCaller autoCaller(this); 3414 CheckComRCReturnRC(autoCaller.rc()); 3415 3416 AutoWriteLock alock(this); 3417 3417 3418 3418 HRESULT rc = S_OK; 3419 3419 3420 3420 { 3421 ComObjPtr 3421 ComObjPtr<Machine> m; 3422 3422 rc = findMachine (aMachine->id(), false /* aDoSetError */, &m); 3423 if (SUCCEEDED 3423 if (SUCCEEDED(rc)) 3424 3424 { 3425 3425 /* sanity */ … … 3440 3440 /* Machine::trySetRegistered() will commit and save machine settings */ 3441 3441 rc = aMachine->trySetRegistered (TRUE); 3442 CheckComRCReturnRC 3442 CheckComRCReturnRC(rc); 3443 3443 } 3444 3444 … … 3470 3470 bool aSaveRegistry /*= true*/) 3471 3471 { 3472 AssertReturn 3473 3474 AutoCaller autoCaller 3472 AssertReturn(aHardDisk != NULL, E_INVALIDARG); 3473 3474 AutoCaller autoCaller(this); 3475 3475 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3476 3476 3477 AutoWriteLock alock 3477 AutoWriteLock alock(this); 3478 3478 3479 3479 AutoCaller hardDiskCaller (aHardDisk); … … 3486 3486 aHardDisk->locationFull(), 3487 3487 strConflict); 3488 CheckComRCReturnRC 3488 CheckComRCReturnRC(rc); 3489 3489 3490 3490 if (strConflict.length()) … … 3536 3536 bool aSaveRegistry /*= true*/) 3537 3537 { 3538 AssertReturn 3539 3540 AutoCaller autoCaller 3538 AssertReturn(aHardDisk != NULL, E_INVALIDARG); 3539 3540 AutoCaller autoCaller(this); 3541 3541 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3542 3542 3543 AutoWriteLock alock 3543 AutoWriteLock alock(this); 3544 3544 3545 3545 AutoCaller hardDiskCaller (aHardDisk); … … 3588 3588 bool aSaveRegistry /*= true*/) 3589 3589 { 3590 AssertReturn 3591 3592 AutoCaller autoCaller 3590 AssertReturn(aImage != NULL, E_INVALIDARG); 3591 3592 AutoCaller autoCaller(this); 3593 3593 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3594 3594 3595 AutoWriteLock alock 3595 AutoWriteLock alock(this); 3596 3596 3597 3597 AutoCaller imageCaller (aImage); … … 3604 3604 aImage->locationFull(), 3605 3605 strConflict); 3606 CheckComRCReturnRC 3606 CheckComRCReturnRC(rc); 3607 3607 3608 3608 if (strConflict.length()) … … 3647 3647 bool aSaveRegistry /*= true*/) 3648 3648 { 3649 AssertReturn 3650 3651 AutoCaller autoCaller 3649 AssertReturn(aImage != NULL, E_INVALIDARG); 3650 3651 AutoCaller autoCaller(this); 3652 3652 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3653 3653 3654 AutoWriteLock alock 3654 AutoWriteLock alock(this); 3655 3655 3656 3656 AutoCaller imageCaller (aImage); … … 3691 3691 bool aSaveRegistry /*= true*/) 3692 3692 { 3693 AssertReturn 3694 3695 AutoCaller autoCaller 3693 AssertReturn(aImage != NULL, E_INVALIDARG); 3694 3695 AutoCaller autoCaller(this); 3696 3696 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3697 3697 3698 AutoWriteLock alock 3698 AutoWriteLock alock(this); 3699 3699 3700 3700 AutoCaller imageCaller (aImage); … … 3707 3707 aImage->locationFull(), 3708 3708 strConflict); 3709 CheckComRCReturnRC 3709 CheckComRCReturnRC(rc); 3710 3710 3711 3711 if (strConflict.length()) … … 3750 3750 bool aSaveRegistry /*= true*/) 3751 3751 { 3752 AssertReturn 3753 3754 AutoCaller autoCaller 3752 AssertReturn(aImage != NULL, E_INVALIDARG); 3753 3754 AutoCaller autoCaller(this); 3755 3755 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3756 3756 3757 AutoWriteLock alock 3757 AutoWriteLock alock(this); 3758 3758 3759 3759 AutoCaller imageCaller (aImage); … … 3786 3786 * @note Locks #childrenLock() for reading. 3787 3787 */ 3788 HRESULT VirtualBox::cast (IHardDisk *aFrom, ComObjPtr 3789 { 3790 AssertReturn 3791 3792 AutoCaller autoCaller 3788 HRESULT VirtualBox::cast (IHardDisk *aFrom, ComObjPtr<HardDisk> &aTo) 3789 { 3790 AssertReturn(aFrom != NULL, E_INVALIDARG); 3791 3792 AutoCaller autoCaller(this); 3793 3793 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3794 3794 … … 3822 3822 HRESULT VirtualBox::updateSettings (const char *aOldPath, const char *aNewPath) 3823 3823 { 3824 LogFlowThisFunc 3825 3826 AssertReturn 3827 AssertReturn 3828 3829 AutoCaller autoCaller 3824 LogFlowThisFunc(("aOldPath={%s} aNewPath={%s}\n", aOldPath, aNewPath)); 3825 3826 AssertReturn(aOldPath, E_INVALIDARG); 3827 AssertReturn(aNewPath, E_INVALIDARG); 3828 3829 AutoCaller autoCaller(this); 3830 3830 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 3831 3831 3832 AutoWriteLock alock 3832 AutoWriteLock alock(this); 3833 3833 3834 3834 /* check DVD paths */ … … 3881 3881 { 3882 3882 int vrc = RTDirCreateFullPath(strDir, 0777); 3883 if (RT_FAILURE 3883 if (RT_FAILURE(vrc)) 3884 3884 { 3885 3885 return setError (E_FAIL, … … 4035 4035 { 4036 4036 Utf8Str tmp = nf; 4037 for (int i = 0; i <= 9 && RT_FAILURE 4037 for (int i = 0; i <= 9 && RT_FAILURE(vrc); ++ i) 4038 4038 { 4039 4039 nf = Utf8StrFmt ("%s.%d", tmp.raw(), i); … … 4043 4043 } 4044 4044 4045 if (RT_FAILURE 4045 if (RT_FAILURE(vrc)) 4046 4046 return setError (VBOX_E_IPRT_ERROR, 4047 4047 tr ("Could not copy the settings file '%s' to '%s' (%Rrc)"), … … 4115 4115 HRESULT VirtualBox::lockConfig() 4116 4116 { 4117 AutoCaller autoCaller 4117 AutoCaller autoCaller(this); 4118 4118 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4119 AssertReturn 4119 AssertReturn(autoCaller.state() == InInit, E_FAIL); 4120 4120 4121 4121 HRESULT rc = S_OK; … … 4129 4129 RTFILE_O_READWRITE | RTFILE_O_OPEN | 4130 4130 RTFILE_O_DENY_WRITE); 4131 if (RT_FAILURE 4131 if (RT_FAILURE(vrc) && (vrc != VERR_FILE_NOT_FOUND)) 4132 4132 { 4133 4133 /* Open the associated config file only with read access. */ … … 4136 4136 RTFILE_O_READ | RTFILE_O_OPEN | 4137 4137 RTFILE_O_DENY_NONE); 4138 if (RT_FAILURE 4138 if (RT_FAILURE(vrc)) 4139 4139 { 4140 4140 /* We even cannot open it in read mode, so there's seriously … … 4160 4160 } 4161 4161 4162 LogFlowThisFunc 4162 LogFlowThisFunc(("mCfgFile.mName='%ls', mCfgFile.mHandle=%d, rc=%08X\n", 4163 4163 mData.mCfgFile.mName.raw(), mData.mCfgFile.mHandle, rc)); 4164 4164 } … … 4174 4174 HRESULT VirtualBox::unlockConfig() 4175 4175 { 4176 AutoCaller autoCaller 4176 AutoCaller autoCaller(this); 4177 4177 AssertComRCReturn (autoCaller.rc(), E_FAIL); 4178 AssertReturn 4178 AssertReturn(autoCaller.state() == InUninit, E_FAIL); 4179 4179 4180 4180 HRESULT rc = S_OK; … … 4187 4187 mData.mCfgFile.mHandle = NIL_RTFILE; 4188 4188 mData.mCfgFile.mReadonly = FALSE; 4189 LogFlowThisFunc 4189 LogFlowThisFunc(("\n")); 4190 4190 } 4191 4191 … … 4225 4225 do 4226 4226 { 4227 AutoCaller autoCaller 4227 AutoCaller autoCaller(that); 4228 4228 /* VirtualBox has been early uninitialized, terminate */ 4229 4229 if (!autoCaller.isOk()) … … 4290 4290 ("MAXIMUM_WAIT_OBJECTS reached")); 4291 4291 4292 ComObjPtr 4292 ComObjPtr<SessionMachine> sm; 4293 4293 HANDLE ipcSem; 4294 4294 if ((*it)->isSessionOpenOrClosing (sm, NULL, &ipcSem)) … … 4356 4356 do 4357 4357 { 4358 AutoCaller autoCaller 4358 AutoCaller autoCaller(that); 4359 4359 /* VirtualBox has been early uninitialized, terminate */ 4360 4360 if (!autoCaller.isOk()) … … 4377 4377 bool updateSpawned = false; 4378 4378 4379 if (RT_SUCCESS 4379 if (RT_SUCCESS(vrc)) 4380 4380 { 4381 4381 /* update event is signaled */ … … 4482 4482 cnt)); 4483 4483 4484 ComObjPtr 4484 ComObjPtr<SessionMachine> sm; 4485 4485 HMTX ipcSem; 4486 4486 if ((*it)->isSessionOpenOrClosing (sm, NULL, &ipcSem)) … … 4543 4543 do 4544 4544 { 4545 AutoCaller autoCaller 4545 AutoCaller autoCaller(that); 4546 4546 if (!autoCaller.isOk()) 4547 4547 break; … … 4562 4562 break; 4563 4563 4564 if (RT_SUCCESS 4564 if (RT_SUCCESS(rc) || update || updateSpawned) 4565 4565 { 4566 /* RT_SUCCESS 4566 /* RT_SUCCESS(rc) means an update event is signaled */ 4567 4567 4568 4568 AutoReadLock thatLock (that); 4569 4569 4570 if (RT_SUCCESS 4570 if (RT_SUCCESS(rc) || update) 4571 4571 { 4572 4572 /* obtain a new set of opened machines */ … … 4576 4576 it != that->mData.mMachines.end(); ++ it) 4577 4577 { 4578 ComObjPtr 4578 ComObjPtr<SessionMachine> sm; 4579 4579 if ((*it)->isSessionOpenOrClosing (sm)) 4580 4580 machines.push_back (sm); … … 4585 4585 } 4586 4586 4587 if (RT_SUCCESS 4587 if (RT_SUCCESS(rc) || updateSpawned) 4588 4588 { 4589 4589 /* obtain a new set of spawned machines */ … … 4612 4612 /* reap child processes */ 4613 4613 { 4614 AutoWriteLock alock 4614 AutoWriteLock alock(that); 4615 4615 if (that->mWatcherData.mProcesses.size()) 4616 4616 { … … 4673 4673 LogFlowFuncEnter(); 4674 4674 4675 AssertReturn 4675 AssertReturn(pvUser, VERR_INVALID_POINTER); 4676 4676 4677 4677 // create an event queue for the current thread 4678 4678 EventQueue *eventQ = new EventQueue(); 4679 AssertReturn 4679 AssertReturn(eventQ, VERR_NO_MEMORY); 4680 4680 4681 4681 // return the queue to the one who created this thread … … 4690 4690 eventQ->handleEvent (event); 4691 4691 4692 AssertReturn 4692 AssertReturn(ok, VERR_GENERAL_FAILURE); 4693 4693 4694 4694 delete eventQ; … … 4714 4714 return NULL; 4715 4715 4716 AutoCaller autoCaller 4716 AutoCaller autoCaller(mVirtualBox); 4717 4717 if (!autoCaller.isOk()) 4718 4718 { … … 4728 4728 { 4729 4729 /* Make a copy to release the lock before iterating */ 4730 AutoReadLock alock 4730 AutoReadLock alock(mVirtualBox); 4731 4731 callbacks = CallbackVector (mVirtualBox->mData.mCallbacks.begin(), 4732 4732 mVirtualBox->mData.mCallbacks.end()); … … 4752 4752 CheckComArgNotNull(aServer); 4753 4753 4754 AutoCaller autoCaller 4755 CheckComRCReturnRC 4754 AutoCaller autoCaller(this); 4755 CheckComRCReturnRC(autoCaller.rc()); 4756 4756 4757 4757 ComObjPtr<DHCPServer> dhcpServer; 4758 4758 dhcpServer.createObject(); 4759 4759 HRESULT rc = dhcpServer->init (this, aName); 4760 CheckComRCReturnRC 4760 CheckComRCReturnRC(rc); 4761 4761 4762 4762 rc = registerDHCPServer(dhcpServer, true); 4763 CheckComRCReturnRC 4763 CheckComRCReturnRC(rc); 4764 4764 4765 4765 dhcpServer.queryInterfaceTo(aServer); … … 4778 4778 CheckComArgNotNull(aServer); 4779 4779 4780 AutoCaller autoCaller 4781 CheckComRCReturnRC 4782 4783 AutoWriteLock alock 4780 AutoCaller autoCaller(this); 4781 CheckComRCReturnRC(autoCaller.rc()); 4782 4783 AutoWriteLock alock(this); 4784 4784 4785 4785 HRESULT rc; 4786 4786 Bstr bstr; 4787 ComPtr 4787 ComPtr<DHCPServer> found; 4788 4788 4789 4789 for (DHCPServerList::const_iterator it = … … 4805 4805 return E_INVALIDARG; 4806 4806 4807 return found.queryInterfaceTo 4807 return found.queryInterfaceTo(aServer); 4808 4808 } 4809 4809 … … 4812 4812 CheckComArgNotNull(aServer); 4813 4813 4814 AutoCaller autoCaller 4815 CheckComRCReturnRC 4814 AutoCaller autoCaller(this); 4815 CheckComRCReturnRC(autoCaller.rc()); 4816 4816 4817 4817 HRESULT rc = unregisterDHCPServer(static_cast<DHCPServer *>(aServer), true); … … 4838 4838 bool aSaveRegistry /*= true*/) 4839 4839 { 4840 AssertReturn 4841 4842 AutoCaller autoCaller 4840 AssertReturn(aDHCPServer != NULL, E_INVALIDARG); 4841 4842 AutoCaller autoCaller(this); 4843 4843 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4844 4844 4845 AutoWriteLock alock 4845 AutoWriteLock alock(this); 4846 4846 4847 4847 AutoCaller dhcpServerCaller (aDHCPServer); … … 4853 4853 HRESULT rc; 4854 4854 rc = aDHCPServer->COMGETTER(NetworkName) (name.asOutParam()); 4855 CheckComRCReturnRC 4855 CheckComRCReturnRC(rc); 4856 4856 4857 4857 ComPtr<IDHCPServer> existing; … … 4893 4893 bool aSaveRegistry /*= true*/) 4894 4894 { 4895 AssertReturn 4896 4897 AutoCaller autoCaller 4895 AssertReturn(aDHCPServer != NULL, E_INVALIDARG); 4896 4897 AutoCaller autoCaller(this); 4898 4898 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 4899 4899 4900 AutoWriteLock alock 4900 AutoWriteLock alock(this); 4901 4901 4902 4902 AutoCaller dhcpServerCaller (aDHCPServer); -
trunk/src/VBox/Main/VirtualBoxImplExtra.cpp
r17911 r21878 201 201 int vrc = RTUtf16ToUtf8Ex (aValue.raw(), RTSTR_MAX, 202 202 &dummy2, strLen, &strLen); 203 if (RT_SUCCESS 203 if (RT_SUCCESS(vrc)) 204 204 { 205 205 /* the string only contains '\0' :) */ … … 216 216 } 217 217 218 if (RT_FAILURE 218 if (RT_FAILURE(vrc)) 219 219 throw xml::LogicError (RT_SRC_POS); 220 220 … … 241 241 RTUUID uuid; 242 242 int vrc = RTUuidFromStr (&uuid, buf); 243 if (RT_FAILURE 243 if (RT_FAILURE(vrc)) 244 244 throw ENoConversion(com::Utf8StrFmt("'%s' is not Guid (%Rrc)", aValue, vrc)); 245 245 … … 254 254 255 255 int vrc = RTUuidToStr (aValue.raw(), result.get() + 1, RTUUID_STR_LENGTH); 256 if (RT_FAILURE 256 if (RT_FAILURE(vrc)) 257 257 throw xml::LogicError (RT_SRC_POS); 258 258 -
trunk/src/VBox/Main/darwin/HostPowerDarwin.cpp
r18257 r21878 42 42 RTTHREADTYPE_IO, RTTHREADFLAGS_WAITABLE, "MainPower"); 43 43 44 if (RT_FAILURE 44 if (RT_FAILURE(rc)) 45 45 LogFlow (("RTThreadCreate failed with %Rrc\n", rc)); 46 46 } -
trunk/src/VBox/Main/darwin/NetIf-darwin.cpp
r20475 r21878 59 59 60 60 #if 0 61 int NetIfList(std::list <ComObjPtr 61 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 62 62 { 63 63 int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); … … 275 275 } 276 276 277 int NetIfList(std::list <ComObjPtr 277 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 278 278 { 279 279 int rc = VINF_SUCCESS; -
trunk/src/VBox/Main/freebsd/NetIf-freebsd.cpp
r18971 r21878 31 31 #include "Logging.h" 32 32 33 int NetIfList(std::list <ComObjPtr 33 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 34 34 { 35 35 /** @todo implement */ -
trunk/src/VBox/Main/generic/NetIf-generic.cpp
r19924 r21878 135 135 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) 136 136 /* create a progress object */ 137 ComObjPtr 137 ComObjPtr<Progress> progress; 138 138 progress.createObject(); 139 139 … … 147 147 if(SUCCEEDED(rc)) 148 148 { 149 CheckComRCReturnRC 150 progress.queryInterfaceTo 149 CheckComRCReturnRC(rc); 150 progress.queryInterfaceTo(aProgress); 151 151 152 152 char szAdpCtl[RTPATH_MAX]; … … 188 188 Bstr IfName(szBuf); 189 189 /* create a new uninitialized host interface object */ 190 ComObjPtr 190 ComObjPtr<HostNetworkInterface> iface; 191 191 iface.createObject(); 192 192 iface->init(IfName, HostNetworkInterfaceType_HostOnly, pInfo); 193 iface.queryInterfaceTo 193 iface.queryInterfaceTo(aHostNetworkInterface); 194 194 } 195 195 RTMemFree(pInfo); … … 218 218 #if defined(RT_OS_LINUX) || defined(RT_OS_DARWIN) 219 219 /* create a progress object */ 220 ComObjPtr 220 ComObjPtr<Progress> progress; 221 221 progress.createObject(); 222 222 ComPtr<IHost> host; … … 226 226 { 227 227 Bstr ifname; 228 ComPtr 228 ComPtr<IHostNetworkInterface> iface; 229 229 if (FAILED (host->FindHostNetworkInterfaceById (Guid(aId).toUtf16(), iface.asOutParam()))) 230 230 return VERR_INVALID_PARAMETER; … … 238 238 if(SUCCEEDED(rc)) 239 239 { 240 CheckComRCReturnRC 241 progress.queryInterfaceTo 242 iface.queryInterfaceTo 240 CheckComRCReturnRC(rc); 241 progress.queryInterfaceTo(aProgress); 242 iface.queryInterfaceTo(aHostNetworkInterface); 243 243 rc = NetIfAdpCtl(Utf8Str(ifname), "remove", NULL, NULL); 244 244 if (RT_FAILURE(rc)) -
trunk/src/VBox/Main/glue/ErrorInfo.cpp
r21783 r21878 54 54 #if !defined (VBOX_WITH_XPCOM) 55 55 56 ComPtr 56 ComPtr<IErrorInfo> err; 57 57 rc = ::GetErrorInfo (0, err.asOutParam()); 58 58 if (rc == S_OK && err) … … 61 61 mErrorInfo = err; 62 62 63 ComPtr 64 rc = err.queryInterfaceTo 65 if (SUCCEEDED 63 ComPtr<IVirtualBoxErrorInfo> info; 64 rc = err.queryInterfaceTo(info.asOutParam()); 65 if (SUCCEEDED(rc) && info) 66 66 init (info); 67 67 … … 71 71 72 72 rc = err->GetGUID (mInterfaceID.asOutParam()); 73 gotSomething |= SUCCEEDED 74 if (SUCCEEDED 73 gotSomething |= SUCCEEDED(rc); 74 if (SUCCEEDED(rc)) 75 75 GetInterfaceNameByIID (mInterfaceID, mInterfaceName.asOutParam()); 76 76 77 77 rc = err->GetSource (mComponent.asOutParam()); 78 gotSomething |= SUCCEEDED 78 gotSomething |= SUCCEEDED(rc); 79 79 80 80 rc = err->GetDescription (mText.asOutParam()); 81 gotSomething |= SUCCEEDED 81 gotSomething |= SUCCEEDED(rc); 82 82 83 83 if (gotSomething) … … 92 92 nsCOMPtr <nsIExceptionService> es; 93 93 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 94 if (NS_SUCCEEDED 94 if (NS_SUCCEEDED(rc)) 95 95 { 96 96 nsCOMPtr <nsIExceptionManager> em; 97 97 rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); 98 if (NS_SUCCEEDED 98 if (NS_SUCCEEDED(rc)) 99 99 { 100 ComPtr 100 ComPtr<nsIException> ex; 101 101 rc = em->GetCurrentException (ex.asOutParam()); 102 if (NS_SUCCEEDED 102 if (NS_SUCCEEDED(rc) && ex) 103 103 { 104 104 if (aKeepObj) 105 105 mErrorInfo = ex; 106 106 107 ComPtr 108 rc = ex.queryInterfaceTo 109 if (NS_SUCCEEDED 107 ComPtr<IVirtualBoxErrorInfo> info; 108 rc = ex.queryInterfaceTo(info.asOutParam()); 109 if (NS_SUCCEEDED(rc) && info) 110 110 init (info); 111 111 … … 115 115 116 116 rc = ex->GetResult (&mResultCode); 117 gotSomething |= NS_SUCCEEDED 117 gotSomething |= NS_SUCCEEDED(rc); 118 118 119 119 Utf8Str message; 120 120 rc = ex->GetMessage(message.asOutParam()); 121 121 message.jolt(); 122 gotSomething |= NS_SUCCEEDED 123 if (NS_SUCCEEDED 122 gotSomething |= NS_SUCCEEDED(rc); 123 if (NS_SUCCEEDED(rc)) 124 124 mText = message; 125 125 … … 151 151 #if !defined (VBOX_WITH_XPCOM) 152 152 153 ComPtr 154 ComPtr 155 HRESULT rc = iface.queryInterfaceTo 156 if (SUCCEEDED 153 ComPtr<IUnknown> iface = aI; 154 ComPtr<ISupportErrorInfo> serr; 155 HRESULT rc = iface.queryInterfaceTo(serr.asOutParam()); 156 if (SUCCEEDED(rc)) 157 157 { 158 158 rc = serr->InterfaceSupportsErrorInfo (aIID); 159 if (SUCCEEDED 159 if (SUCCEEDED(rc)) 160 160 init (aKeepObj); 161 161 } … … 184 184 185 185 rc = info->COMGETTER(ResultCode) (&lrc); mResultCode = lrc; 186 gotSomething |= SUCCEEDED 187 gotAll &= SUCCEEDED 186 gotSomething |= SUCCEEDED(rc); 187 gotAll &= SUCCEEDED(rc); 188 188 189 189 Bstr iid; 190 190 rc = info->COMGETTER(InterfaceID) (iid.asOutParam()); 191 gotSomething |= SUCCEEDED 192 gotAll &= SUCCEEDED 193 if (SUCCEEDED 191 gotSomething |= SUCCEEDED(rc); 192 gotAll &= SUCCEEDED(rc); 193 if (SUCCEEDED(rc)) 194 194 { 195 195 mInterfaceID = iid; … … 198 198 199 199 rc = info->COMGETTER(Component) (mComponent.asOutParam()); 200 gotSomething |= SUCCEEDED 201 gotAll &= SUCCEEDED 200 gotSomething |= SUCCEEDED(rc); 201 gotAll &= SUCCEEDED(rc); 202 202 203 203 rc = info->COMGETTER(Text) (mText.asOutParam()); 204 gotSomething |= SUCCEEDED 205 gotAll &= SUCCEEDED 206 207 ComPtr 204 gotSomething |= SUCCEEDED(rc); 205 gotAll &= SUCCEEDED(rc); 206 207 ComPtr<IVirtualBoxErrorInfo> next; 208 208 rc = info->COMGETTER(Next) (next.asOutParam()); 209 if (SUCCEEDED 209 if (SUCCEEDED(rc) && !next.isNull()) 210 210 { 211 211 mNext.reset (new ErrorInfo (next)); … … 216 216 else 217 217 mNext.reset(); 218 gotSomething |= SUCCEEDED 219 gotAll &= SUCCEEDED 218 gotSomething |= SUCCEEDED(rc); 219 gotAll &= SUCCEEDED(rc); 220 220 221 221 mIsBasicAvailable = gotSomething; … … 239 239 return; 240 240 241 ComPtr 241 ComPtr<IVirtualBoxErrorInfo> info; 242 242 HRESULT rc = progress->COMGETTER(ErrorInfo) (info.asOutParam()); 243 if (SUCCEEDED 243 if (SUCCEEDED(rc) && info) 244 244 init (info); 245 245 } … … 257 257 #if !defined (VBOX_WITH_XPCOM) 258 258 259 ComPtr 259 ComPtr<IErrorInfo> err; 260 260 if (!mErrorInfo.isNull()) 261 261 { 262 rc = mErrorInfo.queryInterfaceTo 262 rc = mErrorInfo.queryInterfaceTo(err.asOutParam()); 263 263 AssertComRC (rc); 264 264 } … … 269 269 nsCOMPtr <nsIExceptionService> es; 270 270 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 271 if (NS_SUCCEEDED 271 if (NS_SUCCEEDED(rc)) 272 272 { 273 273 nsCOMPtr <nsIExceptionManager> em; 274 274 rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); 275 if (NS_SUCCEEDED 275 if (NS_SUCCEEDED(rc)) 276 276 { 277 ComPtr 277 ComPtr<nsIException> ex; 278 278 if (!mErrorInfo.isNull()) 279 279 { 280 rc = mErrorInfo.queryInterfaceTo 280 rc = mErrorInfo.queryInterfaceTo(ex.asOutParam()); 281 281 AssertComRC (rc); 282 282 } … … 287 287 #endif // !defined (VBOX_WITH_XPCOM) 288 288 289 if (SUCCEEDED 289 if (SUCCEEDED(rc)) 290 290 { 291 291 mErrorInfo.setNull(); -
trunk/src/VBox/Main/glue/EventQueue.cpp
r16555 r21878 92 92 nsresult rc = NS_GetEventQueueService (getter_AddRefs (mEventQService)); 93 93 94 if (NS_SUCCEEDED 94 if (NS_SUCCEEDED(rc)) 95 95 { 96 96 rc = mEventQService->GetThreadEventQueue (NS_CURRENT_THREAD, … … 99 99 { 100 100 rc = mEventQService->CreateMonitoredThreadEventQueue(); 101 if (NS_SUCCEEDED 101 if (NS_SUCCEEDED(rc)) 102 102 { 103 103 mEQCreated = TRUE; … … 151 151 mEventQ->InitEvent (ev, this, plEventHandler, plEventDestructor); 152 152 HRESULT rc = mEventQ->PostEvent (ev); 153 return NS_SUCCEEDED 153 return NS_SUCCEEDED(rc); 154 154 155 155 #endif -
trunk/src/VBox/Main/glue/SupportErrorInfo.cpp
r20267 r21878 114 114 { 115 115 /* these are mandatory, others -- not */ 116 AssertReturn 116 AssertReturn((!aWarning && FAILED (aResultCode)) || 117 117 (aWarning && aResultCode != S_OK), 118 118 E_FAIL); 119 AssertReturn 120 AssertReturn 119 AssertReturn(aText != NULL, E_FAIL); 120 AssertReturn(*aText != '\0', E_FAIL); 121 121 122 122 /* reset the error severity bit if it's a warning */ … … 129 129 do 130 130 { 131 ComPtr 131 ComPtr<IVirtualBoxErrorInfo> info; 132 132 133 133 #if !defined (VBOX_WITH_XPCOM) 134 134 135 ComPtr 135 ComPtr<IVirtualBoxErrorInfo> curInfo; 136 136 if (preserve) 137 137 { 138 138 /* get the current error info if any */ 139 ComPtr 139 ComPtr<IErrorInfo> err; 140 140 rc = ::GetErrorInfo (0, err.asOutParam()); 141 141 CheckComRCBreakRC (rc); 142 rc = err.queryInterfaceTo 142 rc = err.queryInterfaceTo(curInfo.asOutParam()); 143 143 if (FAILED (rc)) 144 144 { 145 145 /* create a IVirtualBoxErrorInfo wrapper for the native 146 146 * IErrorInfo object */ 147 ComObjPtr 147 ComObjPtr<VirtualBoxErrorInfo> wrapper; 148 148 rc = wrapper.createObject(); 149 if (SUCCEEDED 149 if (SUCCEEDED(rc)) 150 150 { 151 151 rc = wrapper->init (err); 152 if (SUCCEEDED 152 if (SUCCEEDED(rc)) 153 153 curInfo = wrapper; 154 154 } … … 156 156 } 157 157 /* On failure, curInfo will stay null */ 158 Assert (SUCCEEDED 158 Assert (SUCCEEDED(rc) || curInfo.isNull()); 159 159 160 160 /* set the current error info and preserve the previous one if any */ … … 167 167 else 168 168 { 169 ComObjPtr 169 ComObjPtr<VirtualBoxErrorInfoGlue> infoObj; 170 170 rc = infoObj.createObject(); 171 171 CheckComRCBreakRC (rc); … … 183 183 else 184 184 { 185 ComObjPtr 185 ComObjPtr<VirtualBoxErrorInfo> infoObj; 186 186 rc = infoObj.createObject(); 187 187 CheckComRCBreakRC (rc); … … 193 193 } 194 194 195 ComPtr 196 rc = info.queryInterfaceTo 197 if (SUCCEEDED 195 ComPtr<IErrorInfo> err; 196 rc = info.queryInterfaceTo(err.asOutParam()); 197 if (SUCCEEDED(rc)) 198 198 rc = ::SetErrorInfo (0, err); 199 199 … … 202 202 nsCOMPtr <nsIExceptionService> es; 203 203 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 204 if (NS_SUCCEEDED 204 if (NS_SUCCEEDED(rc)) 205 205 { 206 206 nsCOMPtr <nsIExceptionManager> em; … … 208 208 CheckComRCBreakRC (rc); 209 209 210 ComPtr 210 ComPtr<IVirtualBoxErrorInfo> curInfo; 211 211 if (preserve) 212 212 { 213 213 /* get the current error info if any */ 214 ComPtr 214 ComPtr<nsIException> ex; 215 215 rc = em->GetCurrentException (ex.asOutParam()); 216 216 CheckComRCBreakRC (rc); 217 rc = ex.queryInterfaceTo 217 rc = ex.queryInterfaceTo(curInfo.asOutParam()); 218 218 if (FAILED (rc)) 219 219 { 220 220 /* create a IVirtualBoxErrorInfo wrapper for the native 221 221 * nsIException object */ 222 ComObjPtr 222 ComObjPtr<VirtualBoxErrorInfo> wrapper; 223 223 rc = wrapper.createObject(); 224 if (SUCCEEDED 224 if (SUCCEEDED(rc)) 225 225 { 226 226 rc = wrapper->init (ex); 227 if (SUCCEEDED 227 if (SUCCEEDED(rc)) 228 228 curInfo = wrapper; 229 229 } … … 231 231 } 232 232 /* On failure, curInfo will stay null */ 233 Assert (SUCCEEDED 233 Assert (SUCCEEDED(rc) || curInfo.isNull()); 234 234 235 235 /* set the current error info and preserve the previous one if any */ … … 242 242 else 243 243 { 244 ComObjPtr 244 ComObjPtr<VirtualBoxErrorInfoGlue> infoObj; 245 245 rc = infoObj.createObject(); 246 246 CheckComRCBreakRC (rc); … … 259 259 else 260 260 { 261 ComObjPtr 261 ComObjPtr<VirtualBoxErrorInfo> infoObj; 262 262 rc = infoObj.createObject(); 263 263 CheckComRCBreakRC (rc); … … 269 269 } 270 270 271 ComPtr 272 rc = info.queryInterfaceTo 273 if (SUCCEEDED 271 ComPtr<nsIException> ex; 272 rc = info.queryInterfaceTo(ex.asOutParam()); 273 if (SUCCEEDED(rc)) 274 274 rc = em->SetCurrentException (ex); 275 275 } … … 298 298 AssertComRC (rc); 299 299 300 return SUCCEEDED 300 return SUCCEEDED(rc) ? aResultCode : rc; 301 301 } 302 302 -
trunk/src/VBox/Main/glue/VirtualBoxErrorInfo.cpp
r21786 r21878 74 74 return E_POINTER; 75 75 76 mIID.toUtf16().cloneTo 76 mIID.toUtf16().cloneTo(aIID); 77 77 return S_OK; 78 78 } … … 83 83 return E_POINTER; 84 84 85 mComponent.cloneTo 85 mComponent.cloneTo(aComponent); 86 86 return S_OK; 87 87 } … … 92 92 return E_POINTER; 93 93 94 mText.cloneTo 94 mText.cloneTo(aText); 95 95 return S_OK; 96 96 } … … 102 102 103 103 /* this will set aNext to NULL if mNext is null */ 104 return mNext.queryInterfaceTo 104 return mNext.queryInterfaceTo(aNext); 105 105 } 106 106 … … 113 113 HRESULT VirtualBoxErrorInfo::init (IErrorInfo *aInfo) 114 114 { 115 AssertReturn 115 AssertReturn(aInfo, E_FAIL); 116 116 117 117 HRESULT rc = S_OK; … … 172 172 HRESULT VirtualBoxErrorInfo::init (nsIException *aInfo) 173 173 { 174 AssertReturn 174 AssertReturn(aInfo, E_FAIL); 175 175 176 176 HRESULT rc = S_OK; … … 200 200 return NS_ERROR_INVALID_POINTER; 201 201 202 Utf8Str (mText).cloneTo 202 Utf8Str (mText).cloneTo(aMessage); 203 203 return S_OK; 204 204 } … … 250 250 NS_IMETHODIMP VirtualBoxErrorInfo::GetInner (nsIException **aInner) 251 251 { 252 ComPtr 252 ComPtr<IVirtualBoxErrorInfo> info; 253 253 nsresult rv = COMGETTER(Next) (info.asOutParam()); 254 CheckComRCReturnRC 255 return info.queryInterfaceTo 254 CheckComRCReturnRC(rv); 255 return info.queryInterfaceTo(aInner); 256 256 } 257 257 … … 289 289 IVirtualBoxErrorInfo *aTail) 290 290 { 291 AssertReturn 292 AssertReturn 291 AssertReturn(aHead != NULL, E_INVALIDARG); 292 AssertReturn(aTail != NULL, E_INVALIDARG); 293 293 294 294 HRESULT rc = S_OK; 295 295 296 typedef std::list <ComPtr 296 typedef std::list <ComPtr<IVirtualBoxErrorInfo> > List; 297 297 List list; 298 298 299 ComPtr 299 ComPtr<IVirtualBoxErrorInfo> cur = aHead; 300 300 301 301 do 302 302 { 303 ComPtr 303 ComPtr<IVirtualBoxErrorInfo> next; 304 304 rc = cur->COMGETTER(Next) (next.asOutParam()); 305 CheckComRCReturnRC 305 CheckComRCReturnRC(rc); 306 306 307 307 if (next.isNull()) … … 323 323 for (List::iterator it = list.end(), prev = it; it != list.begin(); -- it) 324 324 { 325 ComObjPtr 325 ComObjPtr<VirtualBoxErrorInfoGlue> wrapper; 326 326 rc = wrapper.createObject(); 327 327 CheckComRCBreakRC (rc); … … 354 354 IVirtualBoxErrorInfo *aNext) 355 355 { 356 AssertReturn 356 AssertReturn(aReal != NULL, E_INVALIDARG); 357 357 358 358 mReal = aReal; … … 371 371 372 372 /* this will set aNext to NULL if mNext is null */ 373 return mNext.queryInterfaceTo 373 return mNext.queryInterfaceTo(aNext); 374 374 } 375 375 -
trunk/src/VBox/Main/glue/com.cpp
r13908 r21878 113 113 nsCOMPtr <nsIInterfaceInfoManager> iim = 114 114 do_GetService (NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID, &rv); 115 if (NS_SUCCEEDED 115 if (NS_SUCCEEDED(rv)) 116 116 { 117 117 nsCOMPtr <nsIInterfaceInfo> iinfo; 118 118 rv = iim->GetInfoForIID (&aIID, getter_AddRefs (iinfo)); 119 if (NS_SUCCEEDED 119 if (NS_SUCCEEDED(rv)) 120 120 { 121 121 const char *iname = NULL; 122 122 iinfo->GetNameShared (&iname); 123 123 char *utf8IName = NULL; 124 if (RT_SUCCESS 124 if (RT_SUCCESS(RTStrCurrentCPToUtf8 (&utf8IName, iname))) 125 125 { 126 126 PRTUTF16 utf16IName = NULL; 127 if (RT_SUCCESS 127 if (RT_SUCCESS(RTStrToUtf16 (utf8IName, &utf16IName))) 128 128 { 129 129 *aName = SysAllocString ((OLECHAR *) utf16IName); … … 140 140 int GetVBoxUserHomeDirectory (char *aDir, size_t aDirLen) 141 141 { 142 AssertReturn 143 AssertReturn 142 AssertReturn(aDir, VERR_INVALID_POINTER); 143 AssertReturn(aDirLen > 0, VERR_BUFFER_OVERFLOW); 144 144 145 145 /* start with null */ … … 156 156 char *VBoxUserHomeUtf8 = NULL; 157 157 vrc = RTStrCurrentCPToUtf8 (&VBoxUserHomeUtf8, VBoxUserHome); 158 if (RT_SUCCESS 158 if (RT_SUCCESS(vrc)) 159 159 { 160 160 vrc = RTPathAbs (VBoxUserHomeUtf8, path, sizeof (path)); 161 if (RT_SUCCESS 161 if (RT_SUCCESS(vrc)) 162 162 { 163 163 if (aDirLen < strlen (path) + 1) … … 173 173 /* compose the config directory (full path) */ 174 174 vrc = RTPathUserHome (path, sizeof (path)); 175 if (RT_SUCCESS 175 if (RT_SUCCESS(vrc)) 176 176 { 177 177 size_t len = … … 184 184 185 185 /* ensure the home directory exists */ 186 if (RT_SUCCESS 186 if (RT_SUCCESS(vrc)) 187 187 if (!RTDirExists (aDir)) 188 188 vrc = RTDirCreateFullPath (aDir, 0777); -
trunk/src/VBox/Main/glue/initterm.cpp
r18831 r21878 133 133 const char *aCurrProcDirLocation) 134 134 { 135 AssertReturn 136 AssertReturn 135 AssertReturn(aCompRegLocation, NS_ERROR_INVALID_ARG); 136 AssertReturn(aXPTIDatLocation, NS_ERROR_INVALID_ARG); 137 137 138 138 int vrc = RTStrUtf8ToCurrentCP (&mCompRegLocation, aCompRegLocation); 139 if (RT_SUCCESS 139 if (RT_SUCCESS(vrc)) 140 140 vrc = RTStrUtf8ToCurrentCP (&mXPTIDatLocation, aXPTIDatLocation); 141 if (RT_SUCCESS 141 if (RT_SUCCESS(vrc) && aComponentDirLocation) 142 142 vrc = RTStrUtf8ToCurrentCP (&mComponentDirLocation, aComponentDirLocation); 143 if (RT_SUCCESS 143 if (RT_SUCCESS(vrc) && aCurrProcDirLocation) 144 144 vrc = RTStrUtf8ToCurrentCP (&mCurrProcDirLocation, aCurrProcDirLocation); 145 145 146 return RT_SUCCESS 146 return RT_SUCCESS(vrc) ? NS_OK : NS_ERROR_OUT_OF_MEMORY; 147 147 } 148 148 … … 326 326 rc = NS_GetMainEventQ (getter_AddRefs (eventQ)); 327 327 328 if (NS_SUCCEEDED 328 if (NS_SUCCEEDED(rc)) 329 329 { 330 330 PRBool isOnMainThread = PR_FALSE; 331 331 rc = eventQ->IsOnCurrentThread (&isOnMainThread); 332 if (NS_SUCCEEDED 332 if (NS_SUCCEEDED(rc) && isOnMainThread) 333 333 ++ gXPCOMInitCount; 334 334 } … … 395 395 vrc = RTPathAppPrivateArch (appHomeDir, sizeof (appHomeDir)); 396 396 AssertRC (vrc); 397 if (RT_FAILURE 397 if (RT_FAILURE(vrc)) 398 398 { 399 399 rc = NS_ERROR_FAILURE; … … 431 431 char *appDirCP = NULL; 432 432 vrc = RTStrUtf8ToCurrentCP (&appDirCP, appHomeDir); 433 if (RT_SUCCESS 433 if (RT_SUCCESS(vrc)) 434 434 { 435 435 nsCOMPtr <nsILocalFile> file; 436 436 rc = NS_NewNativeLocalFile (nsEmbedCString (appDirCP), 437 437 PR_FALSE, getter_AddRefs (file)); 438 if (NS_SUCCEEDED 438 if (NS_SUCCEEDED(rc)) 439 439 appDir = do_QueryInterface (file, &rc); 440 440 … … 452 452 char *pathCP = NULL; 453 453 vrc = RTStrUtf8ToCurrentCP (&pathCP, appHomeDir); 454 if (RT_SUCCESS 454 if (RT_SUCCESS(vrc)) 455 455 { 456 456 vrc = RTEnvSet ("VBOX_XPCOM_HOME", pathCP); … … 466 466 appDir, dsProv); 467 467 468 if (NS_SUCCEEDED 468 if (NS_SUCCEEDED(rc)) 469 469 { 470 470 nsCOMPtr <nsIComponentRegistrar> registrar = 471 471 do_QueryInterface (serviceManager, &rc); 472 if (NS_SUCCEEDED 472 if (NS_SUCCEEDED(rc)) 473 473 { 474 474 rc = registrar->AutoRegister (nsnull); 475 if (NS_SUCCEEDED 475 if (NS_SUCCEEDED(rc)) 476 476 { 477 477 /* We succeeded, stop probing paths */ … … 513 513 rc = NS_GetMainEventQ (getter_AddRefs (eventQ)); 514 514 515 if (NS_SUCCEEDED 515 if (NS_SUCCEEDED(rc) || rc == NS_ERROR_NOT_AVAILABLE) 516 516 { 517 517 /* NS_ERROR_NOT_AVAILABLE seems to mean that … … 523 523 524 524 PRBool isOnMainThread = PR_FALSE; 525 if (NS_SUCCEEDED 525 if (NS_SUCCEEDED(rc)) 526 526 { 527 527 rc = eventQ->IsOnCurrentThread (&isOnMainThread); … … 534 534 } 535 535 536 if (NS_SUCCEEDED 536 if (NS_SUCCEEDED(rc) && isOnMainThread) 537 537 { 538 538 /* only the main thread needs to uninitialize XPCOM and only if -
trunk/src/VBox/Main/hgcm/HGCM.cpp
r21227 r21878 263 263 rc = RTLdrGetSymbol (m_hLdrMod, VBOX_HGCM_SVCLOAD_NAME, (void**)&m_pfnLoad); 264 264 265 if (RT_FAILURE 265 if (RT_FAILURE(rc) || !m_pfnLoad) 266 266 { 267 267 Log(("HGCMService::loadServiceDLL: Error resolving the service entry point %s, rc = %d, m_pfnLoad = %p\n", VBOX_HGCM_SVCLOAD_NAME, rc, m_pfnLoad)); … … 286 286 LogFlowFunc(("m_pfnLoad rc = %Rrc\n", rc)); 287 287 288 if (RT_SUCCESS 288 if (RT_SUCCESS(rc)) 289 289 { 290 290 if ( m_fntable.pfnUnload == NULL … … 475 475 int rc = hgcmMsgGet (ThreadHandle, &pMsgCore); 476 476 477 if (RT_FAILURE 477 if (RT_FAILURE(rc)) 478 478 { 479 479 /* The error means some serious unrecoverable problem in the hgcmMsg/hgcmThread layer. */ … … 646 646 } 647 647 648 if (RT_SUCCESS 648 if (RT_SUCCESS(rc)) 649 649 { 650 650 pSvc->m_hExtension = pMsg->handle; … … 805 805 rc = hgcmMsgSend (hMsg); 806 806 807 if (RT_SUCCESS 807 if (RT_SUCCESS(rc)) 808 808 { 809 809 hgcmThreadWait (m_thread); … … 884 884 int rc = HGCMService::ResolveService (&pSvc, pszServiceName); 885 885 886 if (RT_SUCCESS 886 if (RT_SUCCESS(rc)) 887 887 { 888 888 /* The service is already loaded. */ … … 1296 1296 rc = hgcmMsgSend (hMsg); 1297 1297 1298 if (RT_SUCCESS 1298 if (RT_SUCCESS(rc)) 1299 1299 { 1300 1300 /* Add the client Id to the array. */ … … 1361 1361 } 1362 1362 1363 if (RT_SUCCESS 1363 if (RT_SUCCESS(rc)) 1364 1364 { 1365 1365 /* Remove the client id from the array in any case. */ … … 1646 1646 int rc = hgcmMsgGet (ThreadHandle, &pMsgCore); 1647 1647 1648 if (RT_FAILURE 1648 if (RT_FAILURE(rc)) 1649 1649 { 1650 1650 /* The error means some serious unrecoverable problem in the hgcmMsg/hgcmThread layer. */ … … 1669 1669 rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName); 1670 1670 1671 if (RT_SUCCESS 1671 if (RT_SUCCESS(rc)) 1672 1672 { 1673 1673 /* Call the service instance method. */ … … 1724 1724 rc = HGCMService::ResolveService (&pService, pMsg->pszServiceName); 1725 1725 1726 if (RT_SUCCESS 1726 if (RT_SUCCESS(rc)) 1727 1727 { 1728 1728 rc = pService->HostCall (pMsg->u32Function, pMsg->cParms, pMsg->paParms); … … 1789 1789 rc = HGCMService::ResolveService (&pService, handle->pszServiceName); 1790 1790 1791 if (RT_SUCCESS 1791 if (RT_SUCCESS(rc)) 1792 1792 { 1793 1793 pService->RegisterExtension (handle, pMsg->pfnExtension, pMsg->pvExtension); … … 1796 1796 } 1797 1797 1798 if (RT_FAILURE 1798 if (RT_FAILURE(rc)) 1799 1799 { 1800 1800 RTMemFree (handle); … … 1816 1816 rc = HGCMService::ResolveService (&pService, pMsg->handle->pszServiceName); 1817 1817 1818 if (RT_SUCCESS 1818 if (RT_SUCCESS(rc)) 1819 1819 { 1820 1820 pService->UnregisterExtension (pMsg->handle); … … 2236 2236 rc = hgcmThreadCreate (&g_hgcmThread, "MainHGCMthread", hgcmThread, NULL); 2237 2237 2238 if (RT_FAILURE 2238 if (RT_FAILURE(rc)) 2239 2239 { 2240 2240 LogRel(("Failed to start HGCM thread. HGCM services will be unavailable!!! rc = %Rrc\n", rc)); … … 2256 2256 int rc = HGCMHostReset (); 2257 2257 2258 if (RT_SUCCESS 2258 if (RT_SUCCESS(rc)) 2259 2259 { 2260 2260 /* Send the quit message to the main hgcmThread. */ … … 2267 2267 rc = hgcmMsgSend (hMsg); 2268 2268 2269 if (RT_SUCCESS 2269 if (RT_SUCCESS(rc)) 2270 2270 { 2271 2271 /* Wait for the thread termination. */ -
trunk/src/VBox/Main/hgcm/HGCMThread.cpp
r13837 r21878 301 301 rc = RTThreadUserWait (thread, 30000); 302 302 AssertRC (rc); 303 Assert (!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE 303 Assert (!(m_fu32ThreadFlags & HGCMMSG_TF_INITIALIZING) || RT_FAILURE(rc)); 304 304 } 305 305 else … … 335 335 336 336 #ifdef LOG_ENABLED 337 if (RT_FAILURE 337 if (RT_FAILURE(rc)) 338 338 { 339 339 Log(("HGCMThread::MsgPost: FAILURE: could not obtain worker thread mutex, rc = %Rrc!!!\n", rc)); … … 476 476 rc = Enter (); 477 477 478 if (RT_FAILURE 478 if (RT_FAILURE(rc)) 479 479 { 480 480 break; … … 638 638 } 639 639 640 if (RT_SUCCESS 640 if (RT_SUCCESS(rc)) 641 641 { 642 642 *pHandle = handle; … … 739 739 int rc = hgcmMsgPostInternal (hMsg, pfnCallback, false); 740 740 741 if (RT_SUCCESS 741 if (RT_SUCCESS(rc)) 742 742 { 743 743 rc = VINF_HGCM_ASYNC_EXECUTE; -
trunk/src/VBox/Main/include/ApplianceImpl.h
r21827 r21878 86 86 private: 87 87 /** weak VirtualBox parent */ 88 const ComObjPtr 88 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 89 89 90 90 struct Data; // opaque, defined in ApplianceImpl.cpp -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r21823 r21878 107 107 private: 108 108 109 const ComObjPtr 110 const ComObjPtr 109 const ComObjPtr<Machine, ComWeakRef> mParent; 110 const ComObjPtr<AudioAdapter> mPeer; 111 111 112 112 Backupable <Data> mData; -
trunk/src/VBox/Main/include/AudioSnifferInterface.h
r14949 r21878 48 48 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns); 49 49 50 ComObjPtr 50 ComObjPtr<Console, ComWeakRef> mParent; 51 51 }; 52 52 -
trunk/src/VBox/Main/include/BIOSSettingsImpl.h
r21823 r21878 136 136 private: 137 137 138 ComObjPtr 139 ComObjPtr 138 ComObjPtr<Machine, ComWeakRef> mParent; 139 ComObjPtr<BIOSSettings> mPeer; 140 140 Backupable <Data> mData; 141 141 }; -
trunk/src/VBox/Main/include/ConsoleImpl.h
r21823 r21878 165 165 MachineDebugger *getMachineDebugger() const { return mDebugger; } 166 166 167 const ComPtr 167 const ComPtr<IMachine> &machine() const { return mMachine; } 168 168 169 169 /** Method is called only from ConsoleVRDPServer */ … … 389 389 BOOL mWritable; 390 390 }; 391 typedef std::map <Bstr, ComObjPtr 391 typedef std::map <Bstr, ComObjPtr<SharedFolder> > SharedFolderMap; 392 392 typedef std::map <Bstr, SharedFolderData> SharedFolderDataMap; 393 393 394 394 private: 395 395 396 typedef std::list <ComObjPtr 397 typedef std::list <ComObjPtr 396 typedef std::list <ComObjPtr<OUSBDevice> > USBDeviceList; 397 typedef std::list <ComObjPtr<RemoteUSBDevice> > RemoteUSBDeviceList; 398 398 399 399 HRESULT addVMCaller (bool aQuiet = false, bool aAllowNullVM = false); 400 400 void releaseVMCaller(); 401 401 402 HRESULT consoleInitReleaseLog (const ComPtr 402 HRESULT consoleInitReleaseLog (const ComPtr<IMachine> aMachine); 403 403 404 404 HRESULT powerUp (IProgress **aProgress, bool aPaused); … … 418 418 419 419 HRESULT findSharedFolder (CBSTR aName, 420 ComObjPtr 420 ComObjPtr<SharedFolder> &aSharedFolder, 421 421 bool aSetError = false); 422 422 … … 516 516 bool mSavedStateDataLoaded : 1; 517 517 518 const ComPtr 519 const ComPtr 520 521 const ComPtr 522 const ComPtr 523 const ComPtr 518 const ComPtr<IMachine> mMachine; 519 const ComPtr<IInternalMachineControl> mControl; 520 521 const ComPtr<IVRDPServer> mVRDPServer; 522 const ComPtr<IDVDDrive> mDVDDrive; 523 const ComPtr<IFloppyDrive> mFloppyDrive; 524 524 525 525 ConsoleVRDPServer * const mConsoleVRDPServer; 526 526 527 const ComObjPtr 528 const ComObjPtr 529 const ComObjPtr 530 const ComObjPtr 531 const ComObjPtr 532 const ComObjPtr 527 const ComObjPtr<Guest> mGuest; 528 const ComObjPtr<Keyboard> mKeyboard; 529 const ComObjPtr<Mouse> mMouse; 530 const ComObjPtr<Display> mDisplay; 531 const ComObjPtr<MachineDebugger> mDebugger; 532 const ComObjPtr<RemoteDisplayInfo> mRemoteDisplayInfo; 533 533 534 534 USBDeviceList mUSBDevices; … … 589 589 MachineState_T mMachineState; 590 590 591 typedef std::list <ComPtr 591 typedef std::list <ComPtr<IConsoleCallback> > CallbackList; 592 592 CallbackList mCallbacks; 593 593 -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r21823 r21878 286 286 private: 287 287 288 const ComObjPtr 288 const ComObjPtr<Console, ComWeakRef> mParent; 289 289 }; 290 290 -
trunk/src/VBox/Main/include/DHCPServerImpl.h
r21823 r21878 86 86 private: 87 87 /** weak VirtualBox parent */ 88 const ComObjPtr 88 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 89 89 90 90 const Bstr mName; -
trunk/src/VBox/Main/include/DVDDriveImpl.h
r21823 r21878 56 56 57 57 ComObjPtr<DVDImage> image; 58 ComPtr 58 ComPtr<IHostDVDDrive> hostDrive; 59 59 DriveState_T state; 60 60 BOOL passthrough; … … 121 121 private: 122 122 123 const ComObjPtr 124 const ComObjPtr 123 const ComObjPtr<Machine, ComWeakRef> mParent; 124 const ComObjPtr<DVDDrive> mPeer; 125 125 126 126 Backupable <Data> m; -
trunk/src/VBox/Main/include/DisplayImpl.h
r21823 r21878 280 280 static DECLCALLBACK(int) displaySSMLoad (PSSMHANDLE pSSM, void *pvUser, uint32_t u32Version); 281 281 282 const ComObjPtr 282 const ComObjPtr<Console, ComWeakRef> mParent; 283 283 /** Pointer to the associated display driver. */ 284 284 struct DRVMAINDISPLAY *mpDrv; -
trunk/src/VBox/Main/include/FloppyDriveImpl.h
r21823 r21878 57 57 BOOL enabled; 58 58 ComObjPtr<FloppyImage> image; 59 ComPtr 59 ComPtr<IHostFloppyDrive> hostDrive; 60 60 DriveState_T state; 61 61 }; … … 121 121 private: 122 122 123 const ComObjPtr 124 const ComObjPtr 123 const ComObjPtr<Machine, ComWeakRef> mParent; 124 const ComObjPtr<FloppyDrive> mPeer; 125 125 126 126 Backupable <Data> m; -
trunk/src/VBox/Main/include/GuestImpl.h
r21823 r21878 107 107 ULONG mCurrentGuestStat[GuestStatisticType_MaxVal]; 108 108 109 ComObjPtr 109 ComObjPtr<Console, ComWeakRef> mParent; 110 110 Data mData; 111 111 }; -
trunk/src/VBox/Main/include/HardDiskAttachmentImpl.h
r21823 r21878 64 64 } 65 65 66 const ComObjPtr 66 const ComObjPtr<HardDisk> hardDisk; 67 67 }; 68 68 -
trunk/src/VBox/Main/include/HardDiskImpl.h
r21823 r21878 156 156 * and implies the progress object will be used for waiting. 157 157 */ 158 HRESULT deleteStorageNoWait (ComObjPtr 158 HRESULT deleteStorageNoWait (ComObjPtr<Progress> &aProgress) 159 159 { return deleteStorage (&aProgress, false /* aWait */); } 160 160 … … 163 163 * blocking the current thread. 164 164 */ 165 HRESULT deleteStorageAndWait (ComObjPtr 165 HRESULT deleteStorageAndWait (ComObjPtr<Progress> *aProgress = NULL) 166 166 { return deleteStorage (aProgress, true /* aWait */); } 167 167 … … 172 172 HRESULT createDiffStorageNoWait (ComObjPtr<HardDisk> &aTarget, 173 173 HardDiskVariant_T aVariant, 174 ComObjPtr 174 ComObjPtr<Progress> &aProgress) 175 175 { return createDiffStorage (aTarget, aVariant, &aProgress, false /* aWait */); } 176 176 … … 181 181 HRESULT createDiffStorageAndWait (ComObjPtr<HardDisk> &aTarget, 182 182 HardDiskVariant_T aVariant, 183 ComObjPtr 183 ComObjPtr<Progress> *aProgress = NULL) 184 184 { return createDiffStorage (aTarget, aVariant, aProgress, true /* aWait */); } 185 185 … … 192 192 */ 193 193 HRESULT mergeToNoWait (MergeChain *aChain, 194 ComObjPtr 194 ComObjPtr<Progress> &aProgress) 195 195 { return mergeTo (aChain, &aProgress, false /* aWait */); } 196 196 … … 200 200 */ 201 201 HRESULT mergeToAndWait (MergeChain *aChain, 202 ComObjPtr 202 ComObjPtr<Progress> *aProgress = NULL) 203 203 { return mergeTo (aChain, aProgress, true /* aWait */); } 204 204 … … 208 208 209 209 HRESULT prepareDiscard (MergeChain * &aChain); 210 HRESULT discard (ComObjPtr 210 HRESULT discard (ComObjPtr<Progress> &aProgress, MergeChain *aChain); 211 211 void cancelDiscard (MergeChain *aChain); 212 212 … … 217 217 // a caller and a read lock before calling them!) 218 218 219 ComObjPtr 219 ComObjPtr<HardDisk> parent() const { return static_cast <HardDisk *> (mParent); } 220 220 HardDiskType_T type() const { return mm.type; } 221 221 … … 225 225 protected: 226 226 227 HRESULT deleteStorage (ComObjPtr 228 229 HRESULT createDiffStorage (ComObjPtr 227 HRESULT deleteStorage (ComObjPtr<Progress> *aProgress, bool aWait); 228 229 HRESULT createDiffStorage (ComObjPtr<HardDisk> &aTarget, 230 230 HardDiskVariant_T aVariant, 231 ComObjPtr 231 ComObjPtr<Progress> *aProgress, 232 232 bool aWait); 233 233 234 234 HRESULT mergeTo (MergeChain *aChain, 235 ComObjPtr 235 ComObjPtr<Progress> *aProgress, 236 236 bool aWait); 237 237 … … 285 285 286 286 /** weak parent */ 287 ComObjPtr 287 ComObjPtr<HardDisk, ComWeakRef> mParent; 288 288 289 289 struct Task; … … 306 306 307 307 const Bstr format; 308 ComObjPtr 308 ComObjPtr<HardDiskFormat> formatObj; 309 309 310 310 HardDiskType_T type; -
trunk/src/VBox/Main/include/HostImpl.h
r21823 r21878 119 119 120 120 #ifdef VBOX_WITH_USB 121 typedef std::list <ComObjPtr 121 typedef std::list <ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList; 122 122 123 123 /** Must be called from under this object's lock. */ … … 135 135 136 136 #if (defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)) && defined(VBOX_USE_LIBHAL) 137 bool getDVDInfoFromHal(std::list <ComObjPtr 138 bool getFloppyInfoFromHal(std::list <ComObjPtr 137 bool getDVDInfoFromHal(std::list <ComObjPtr<HostDVDDrive> > &list); 138 bool getFloppyInfoFromHal(std::list <ComObjPtr<HostFloppyDrive> > &list); 139 139 #endif 140 140 141 141 #if defined(RT_OS_SOLARIS) 142 void parseMountTable(char *mountTable, std::list <ComObjPtr 142 void parseMountTable(char *mountTable, std::list <ComObjPtr<HostDVDDrive> > &list); 143 143 bool validateDevice(const char *deviceNode, bool isCDROM); 144 144 #endif … … 146 146 #ifdef VBOX_WITH_USB 147 147 /** specialization for IHostUSBDeviceFilter */ 148 ComObjPtr 148 ComObjPtr<HostUSBDeviceFilter> getDependentChild (IHostUSBDeviceFilter *aFilter) 149 149 { 150 150 VirtualBoxBase *child = VirtualBoxBaseWithChildren:: 151 getDependentChild (ComPtr 151 getDependentChild (ComPtr<IUnknown> (aFilter)); 152 152 return child ? dynamic_cast <HostUSBDeviceFilter *> (child) 153 153 : NULL; … … 160 160 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 161 161 162 ComObjPtr 162 ComObjPtr<VirtualBox, ComWeakRef> mParent; 163 163 164 164 #ifdef VBOX_WITH_USB -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r21823 r21878 97 97 HostNetworkInterfaceType_T mIfType; 98 98 99 ComObjPtr 99 ComObjPtr<VirtualBox, ComWeakRef> mVBox; 100 100 101 101 struct Data -
trunk/src/VBox/Main/include/HostPower.h
r15905 r21878 53 53 protected: 54 54 55 ComObjPtr 55 ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 56 56 57 std::vector <ComPtr 57 std::vector <ComPtr<IConsole> > mConsoles; 58 58 }; 59 59 -
trunk/src/VBox/Main/include/KeyboardImpl.h
r21823 r21878 100 100 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns); 101 101 102 const ComObjPtr 102 const ComObjPtr<Console, ComWeakRef> mParent; 103 103 /** Pointer to the associated keyboard driver. */ 104 104 struct DRVMAINKEYBOARD *mpDrv; -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r21823 r21878 98 98 bool queueSettings() const; 99 99 100 const ComObjPtr 100 const ComObjPtr<Console, ComWeakRef> mParent; 101 101 // flags whether settings have been queued because 102 102 // they could not be sent to the VM (not up yet, etc.) -
trunk/src/VBox/Main/include/MachineImpl.h
r21835 r21878 111 111 { 112 112 /** Control of the direct session opened by openSession() */ 113 ComPtr 114 115 typedef std::list <ComPtr 113 ComPtr<IInternalSessionControl> mDirectControl; 114 115 typedef std::list <ComPtr<IInternalSessionControl> > RemoteControlList; 116 116 117 117 /** list of controls of all opened remote sessions */ … … 119 119 120 120 /** openRemoteSession() and OnSessionEnd() progress indicator */ 121 ComObjPtr 121 ComObjPtr<Progress> mProgress; 122 122 123 123 /** … … 135 135 136 136 /** Session machine object */ 137 ComObjPtr 137 ComObjPtr<SessionMachine> mMachine; 138 138 139 139 /** … … 142 142 * reading. 143 143 */ 144 typedef std::list <std::pair <ComPtr 144 typedef std::list <std::pair <ComPtr<IMedium>, bool > > LockedMedia; 145 145 LockedMedia mLockedMedia; 146 146 }; … … 276 276 DeviceType_T mBootOrder [SchemaDefs::MaxBootPosition]; 277 277 278 typedef std::list <ComObjPtr 278 typedef std::list <ComObjPtr<SharedFolder> > SharedFolderList; 279 279 SharedFolderList mSharedFolders; 280 280 ClipboardMode_T mClipboardMode; … … 597 597 * one) or after doing addCaller() manually. 598 598 */ 599 const ComObjPtr 599 const ComObjPtr<VirtualBox, ComWeakRef> &virtualBox() const { return mParent; } 600 600 601 601 /** … … 662 662 #if defined (RT_OS_WINDOWS) 663 663 664 bool isSessionOpen (ComObjPtr 665 ComPtr 664 bool isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 665 ComPtr<IInternalSessionControl> *aControl = NULL, 666 666 HANDLE *aIPCSem = NULL, bool aAllowClosing = false); 667 667 bool isSessionSpawning (RTPROCESS *aPID = NULL); 668 668 669 bool isSessionOpenOrClosing (ComObjPtr 670 ComPtr 669 bool isSessionOpenOrClosing (ComObjPtr<SessionMachine> &aMachine, 670 ComPtr<IInternalSessionControl> *aControl = NULL, 671 671 HANDLE *aIPCSem = NULL) 672 672 { return isSessionOpen (aMachine, aControl, aIPCSem, true /* aAllowClosing */); } … … 674 674 #elif defined (RT_OS_OS2) 675 675 676 bool isSessionOpen (ComObjPtr 677 ComPtr 676 bool isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 677 ComPtr<IInternalSessionControl> *aControl = NULL, 678 678 HMTX *aIPCSem = NULL, bool aAllowClosing = false); 679 679 680 680 bool isSessionSpawning (RTPROCESS *aPID = NULL); 681 681 682 bool isSessionOpenOrClosing (ComObjPtr 683 ComPtr 682 bool isSessionOpenOrClosing (ComObjPtr<SessionMachine> &aMachine, 683 ComPtr<IInternalSessionControl> *aControl = NULL, 684 684 HMTX *aIPCSem = NULL) 685 685 { return isSessionOpen (aMachine, aControl, aIPCSem, true /* aAllowClosing */); } … … 687 687 #else 688 688 689 bool isSessionOpen (ComObjPtr 690 ComPtr 689 bool isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 690 ComPtr<IInternalSessionControl> *aControl = NULL, 691 691 bool aAllowClosing = false); 692 692 bool isSessionSpawning(); 693 693 694 bool isSessionOpenOrClosing (ComObjPtr 695 ComPtr 694 bool isSessionOpenOrClosing (ComObjPtr<SessionMachine> &aMachine, 695 ComPtr<IInternalSessionControl> *aControl = NULL) 696 696 { return isSessionOpen (aMachine, aControl, true /* aAllowClosing */); } 697 697 … … 703 703 704 704 HRESULT getSharedFolder (CBSTR aName, 705 ComObjPtr 705 ComObjPtr<SharedFolder> &aSharedFolder, 706 706 bool aSetError = false) 707 707 { … … 753 753 754 754 HRESULT findSharedFolder (CBSTR aName, 755 ComObjPtr 755 ComObjPtr<SharedFolder> &aSharedFolder, 756 756 bool aSetError = false); 757 757 … … 770 770 settings::Key *aSnapshotNode); 771 771 772 HRESULT findSnapshot (const Guid &aId, ComObjPtr 772 HRESULT findSnapshot (const Guid &aId, ComObjPtr<Snapshot> &aSnapshot, 773 773 bool aSetError = false); 774 HRESULT findSnapshot (IN_BSTR aName, ComObjPtr 774 HRESULT findSnapshot (IN_BSTR aName, ComObjPtr<Snapshot> &aSnapshot, 775 775 bool aSetError = false); 776 776 777 777 HRESULT getStorageControllerByName(CBSTR aName, 778 ComObjPtr 778 ComObjPtr<StorageController> &aStorageController, 779 779 bool aSetError = false); 780 780 … … 817 817 818 818 HRESULT createImplicitDiffs (const Bstr &aFolder, 819 ComObjPtr 819 ComObjPtr<Progress> &aProgress, 820 820 bool aOnline); 821 821 HRESULT deleteImplicitDiffs(); … … 847 847 const InstanceType mType; 848 848 849 const ComObjPtr 850 851 const ComObjPtr 849 const ComObjPtr<Machine, ComWeakRef> mPeer; 850 851 const ComObjPtr<VirtualBox, ComWeakRef> mParent; 852 852 853 853 Shareable <Data> mData; … … 861 861 // so they cannot be a part of HWData 862 862 863 const ComObjPtr 864 const ComObjPtr 865 const ComObjPtr 866 const ComObjPtr 863 const ComObjPtr<VRDPServer> mVRDPServer; 864 const ComObjPtr<DVDDrive> mDVDDrive; 865 const ComObjPtr<FloppyDrive> mFloppyDrive; 866 const ComObjPtr<SerialPort> 867 867 mSerialPorts [SchemaDefs::SerialPortCount]; 868 const ComObjPtr 868 const ComObjPtr<ParallelPort> 869 869 mParallelPorts [SchemaDefs::ParallelPortCount]; 870 const ComObjPtr 871 const ComObjPtr 872 const ComObjPtr 873 const ComObjPtr 870 const ComObjPtr<AudioAdapter> mAudioAdapter; 871 const ComObjPtr<USBController> mUSBController; 872 const ComObjPtr<BIOSSettings> mBIOSSettings; 873 const ComObjPtr<NetworkAdapter> 874 874 mNetworkAdapters [SchemaDefs::NetworkAdapterCount]; 875 875 … … 977 977 HRESULT onSharedFolderChange(); 978 978 979 bool hasMatchingUSBFilter (const ComObjPtr 979 bool hasMatchingUSBFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 980 980 981 981 private: … … 988 988 989 989 // used when taking snapshot 990 ComObjPtr 991 ComObjPtr 992 ComObjPtr 990 ComObjPtr<Snapshot> mSnapshot; 991 ComObjPtr<Progress> mServerProgress; 992 ComObjPtr<CombinedProgress> mCombinedProgress; 993 993 994 994 // used when saving state … … 1016 1016 HRESULT endTakingSnapshot (BOOL aSuccess); 1017 1017 1018 typedef std::map <ComObjPtr 1018 typedef std::map <ComObjPtr<Machine>, MachineState_T> AffectedMachines; 1019 1019 1020 1020 void takeSnapshotHandler (TakeSnapshotTask &aTask); … … 1036 1036 HANDLE mIPCSem; 1037 1037 Bstr mIPCSemName; 1038 friend bool Machine::isSessionOpen (ComObjPtr 1039 ComPtr 1038 friend bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 1039 ComPtr<IInternalSessionControl> *aControl, 1040 1040 HANDLE *aIPCSem, bool aAllowClosing); 1041 1041 #elif defined (RT_OS_OS2) 1042 1042 HMTX mIPCSem; 1043 1043 Bstr mIPCSemName; 1044 friend bool Machine::isSessionOpen (ComObjPtr 1045 ComPtr 1044 friend bool Machine::isSessionOpen (ComObjPtr<SessionMachine> &aMachine, 1045 ComPtr<IInternalSessionControl> *aControl, 1046 1046 HMTX *aIPCSem, bool aAllowClosing); 1047 1047 #elif defined (VBOX_WITH_SYS_V_IPC_SESSION_WATCHER) -
trunk/src/VBox/Main/include/MediumImpl.h
r21823 r21878 172 172 173 173 /** weak VirtualBox parent */ 174 const ComObjPtr 174 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 175 175 176 176 struct Data -
trunk/src/VBox/Main/include/MouseImpl.h
r21823 r21878 101 101 static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns); 102 102 103 const ComObjPtr 103 const ComObjPtr<Console, ComWeakRef> mParent; 104 104 /** Pointer to the associated mouse driver. */ 105 105 struct DRVMAINMOUSE *mpDrv; -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r21823 r21878 157 157 void generateMACAddress(); 158 158 159 const ComObjPtr 160 const ComObjPtr 159 const ComObjPtr<Machine, ComWeakRef> mParent; 160 const ComObjPtr<NetworkAdapter> mPeer; 161 161 162 162 Backupable <Data> mData; -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r21823 r21878 119 119 HRESULT checkSetPath (CBSTR aPath); 120 120 121 const ComObjPtr 122 const ComObjPtr 121 const ComObjPtr<Machine, ComWeakRef> mParent; 122 const ComObjPtr<ParallelPort> mPeer; 123 123 124 124 Backupable <Data> mData; -
trunk/src/VBox/Main/include/PerformanceImpl.h
r21823 r21878 186 186 void registerBaseMetric (pm::BaseMetric *baseMetric); 187 187 void registerMetric (pm::Metric *metric); 188 void unregisterBaseMetricsFor (const ComPtr 189 void unregisterMetricsFor (const ComPtr 188 void unregisterBaseMetricsFor (const ComPtr<IUnknown> &object); 189 void unregisterMetricsFor (const ComPtr<IUnknown> &object); 190 190 191 191 void suspendSampling(); -
trunk/src/VBox/Main/include/ProgressImpl.h
r21823 r21878 98 98 #if !defined (VBOX_COM_INPROC) 99 99 /** Weak parent. */ 100 const ComObjPtr 101 #endif 102 103 const ComPtr 100 const ComObjPtr<VirtualBox, ComWeakRef> mParent; 101 #endif 102 103 const ComPtr<IUnknown> mInitiator; 104 104 105 105 const Guid mId; … … 114 114 BOOL mCanceled; 115 115 HRESULT mResultCode; 116 ComPtr 116 ComPtr<IVirtualBoxErrorInfo> mErrorInfo; 117 117 118 118 ULONG m_cOperations; // number of operations (so that progress dialog can display something like 1/3) … … 416 416 HRESULT checkProgress(); 417 417 418 typedef std::vector <ComPtr 418 typedef std::vector <ComPtr<IProgress> > ProgressVector; 419 419 ProgressVector mProgresses; 420 420 -
trunk/src/VBox/Main/include/SerialPortImpl.h
r21823 r21878 132 132 HRESULT checkSetPath (CBSTR aPath); 133 133 134 const ComObjPtr 135 const ComObjPtr 134 const ComObjPtr<Machine, ComWeakRef> mParent; 135 const ComObjPtr<SerialPort> mPeer; 136 136 137 137 Backupable <Data> mData; -
trunk/src/VBox/Main/include/SessionImpl.h
r21823 r21878 125 125 SessionType_T mType; 126 126 127 ComPtr 127 ComPtr<IInternalMachineControl> mControl; 128 128 129 ComObjPtr 129 ComObjPtr<Console> mConsole; 130 130 131 ComPtr 132 ComPtr 131 ComPtr<IMachine> mRemoteMachine; 132 ComPtr<IConsole> mRemoteConsole; 133 133 134 ComPtr 134 ComPtr<IVirtualBox> mVirtualBox; 135 135 136 136 /* interprocess semaphore handle (id) for the opened machine */ -
trunk/src/VBox/Main/include/SharedFolderImpl.h
r21823 r21878 104 104 105 105 /* weak parents (only one of them is not null) */ 106 const ComObjPtr 107 const ComObjPtr 108 const ComObjPtr 106 const ComObjPtr<Machine, ComWeakRef> mMachine; 107 const ComObjPtr<Console, ComWeakRef> mConsole; 108 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 109 109 110 110 Data m; -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r21823 r21878 142 142 143 143 /** @note this doesn't require a read lock since mParent is constant. */ 144 const ComObjPtr 144 const ComObjPtr<Machine, ComWeakRef> &parent() { return mParent; }; 145 145 146 146 const Backupable<Data> &data() { return mData; } 147 ComObjPtr 147 ComObjPtr<StorageController> peer() { return mPeer; } 148 148 149 149 // for VirtualBoxSupportErrorInfoImpl … … 157 157 const ComObjPtr<Machine, ComWeakRef> mParent; 158 158 /** Peer object. */ 159 const ComObjPtr 159 const ComObjPtr<StorageController> mPeer; 160 160 /** Data. */ 161 161 Backupable <Data> mData; -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r21823 r21878 98 98 HRESULT saveSettings (settings::Key &aGlobal); 99 99 100 ComObjPtr 100 ComObjPtr<HardDiskFormat> hardDiskFormat (CBSTR aFormat); 101 101 102 102 // public methods for internal purposes only … … 120 120 private: 121 121 122 typedef std::list <ComObjPtr 122 typedef std::list <ComObjPtr<HardDiskFormat> > HardDiskFormatList; 123 123 124 124 HRESULT setDefaultMachineFolder (CBSTR aPath); … … 129 129 HRESULT setWebServiceAuthLibrary (CBSTR aPath); 130 130 131 const ComObjPtr 131 const ComObjPtr<VirtualBox, ComWeakRef> mParent; 132 132 133 133 Bstr mDefaultMachineFolder; -
trunk/src/VBox/Main/include/USBControllerImpl.h
r21823 r21878 122 122 BOOL aActiveChanged = FALSE); 123 123 124 bool hasMatchingFilter (const ComObjPtr 124 bool hasMatchingFilter (const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 125 125 bool hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs); 126 126 … … 132 132 133 133 /** @note this doesn't require a read lock since mParent is constant. */ 134 const ComObjPtr 134 const ComObjPtr<Machine, ComWeakRef> &parent() { return mParent; }; 135 135 136 136 const Backupable<Data> &data() { return mData; } … … 143 143 #ifdef VBOX_WITH_USB 144 144 /** specialization for IUSBDeviceFilter */ 145 ComObjPtr 145 ComObjPtr<USBDeviceFilter> getDependentChild (IUSBDeviceFilter *aFilter) 146 146 { 147 147 VirtualBoxBase *child = VirtualBoxBaseWithChildrenNEXT:: 148 getDependentChild (ComPtr 148 getDependentChild (ComPtr<IUnknown> (aFilter)); 149 149 return child ? static_cast <USBDeviceFilter *> (child) 150 150 : NULL; … … 157 157 const ComObjPtr<Machine, ComWeakRef> mParent; 158 158 /** Peer object. */ 159 const ComObjPtr 159 const ComObjPtr<USBController> mPeer; 160 160 /** Data. */ 161 161 Backupable <Data> mData; … … 165 165 // so they cannot be a part of Data 166 166 167 typedef std::list <ComObjPtr 167 typedef std::list <ComObjPtr<USBDeviceFilter> > DeviceFilterList; 168 168 Backupable <DeviceFilterList> mDeviceFilters; 169 169 #endif /* VBOX_WITH_USB */ -
trunk/src/VBox/Main/include/VMMDev.h
r14949 r21878 65 65 static DECLCALLBACK(void) drvReset(PPDMDRVINS pDrvIns); 66 66 67 ComObjPtr 67 ComObjPtr<Console, ComWeakRef> mParent; 68 68 69 69 RTSEMEVENT mCredentialsEvent; -
trunk/src/VBox/Main/include/VRDPServerImpl.h
r21823 r21878 126 126 private: 127 127 128 const ComObjPtr 129 const ComObjPtr 128 const ComObjPtr<Machine, ComWeakRef> mParent; 129 const ComObjPtr<VRDPServer> mPeer; 130 130 131 131 Backupable <Data> mData; -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r21823 r21878 1942 1942 // dead-locks any more). 1943 1943 Assert (!child->isWriteLockOnCurrentThread() || child->lockHandle() == lockHandle()); 1944 removeDependentChild (ComPtr 1944 removeDependentChild (ComPtr<IUnknown> (child)); 1945 1945 } 1946 1946 … … 1949 1949 void uninitDependentChildren(); 1950 1950 1951 VirtualBoxBase *getDependentChild (const ComPtr 1951 VirtualBoxBase *getDependentChild (const ComPtr<IUnknown> &unk); 1952 1952 1953 1953 private: 1954 1954 1955 void addDependentChild (const ComPtr 1956 void removeDependentChild (const ComPtr 1955 void addDependentChild (const ComPtr<IUnknown> &unk, VirtualBoxBase *child); 1956 void removeDependentChild (const ComPtr<IUnknown> &unk); 1957 1957 1958 1958 typedef std::map <IUnknown *, VirtualBoxBase *> DependentChildren; … … 2068 2068 { 2069 2069 AssertReturnVoid (aChild != NULL); 2070 doAddDependentChild (ComPtr 2070 doAddDependentChild (ComPtr<IUnknown> (aChild), aChild); 2071 2071 } 2072 2072 2073 2073 /** 2074 2074 * Equivalent to template <class C> void addDependentChild (C *aChild) 2075 * but takes a ComObjPtr 2075 * but takes a ComObjPtr<C> argument. 2076 2076 */ 2077 2077 template <class C> 2078 void addDependentChild (const ComObjPtr 2078 void addDependentChild (const ComObjPtr<C> &aChild) 2079 2079 { 2080 2080 AssertReturnVoid (!aChild.isNull()); 2081 doAddDependentChild (ComPtr 2081 doAddDependentChild (ComPtr<IUnknown> (static_cast <C *> (aChild)), aChild); 2082 2082 } 2083 2083 … … 2113 2113 { 2114 2114 AssertReturnVoid (aChild != NULL); 2115 doRemoveDependentChild (ComPtr 2115 doRemoveDependentChild (ComPtr<IUnknown> (aChild)); 2116 2116 } 2117 2117 2118 2118 /** 2119 2119 * Equivalent to template <class C> void removeDependentChild (C *aChild) 2120 * but takes a ComObjPtr 2120 * but takes a ComObjPtr<C> argument. 2121 2121 */ 2122 2122 template <class C> 2123 void removeDependentChild (const ComObjPtr 2123 void removeDependentChild (const ComObjPtr<C> &aChild) 2124 2124 { 2125 2125 AssertReturnVoid (!aChild.isNull()); 2126 doRemoveDependentChild (ComPtr 2126 doRemoveDependentChild (ComPtr<IUnknown> (static_cast <C *> (aChild))); 2127 2127 } 2128 2128 … … 2131 2131 void uninitDependentChildren(); 2132 2132 2133 VirtualBoxBase *getDependentChild(const ComPtr 2133 VirtualBoxBase *getDependentChild(const ComPtr<IUnknown> &aUnk); 2134 2134 2135 2135 private: … … 2175 2175 public: 2176 2176 2177 typedef std::list <ComObjPtr 2177 typedef std::list <ComObjPtr<C> > DependentChildren; 2178 2178 2179 2179 VirtualBoxBaseWithTypedChildren() -
trunk/src/VBox/Main/include/VirtualBoxErrorInfoImpl.h
r21783 r21878 93 93 Guid mIID; 94 94 Bstr mComponent; 95 ComPtr 95 ComPtr<IVirtualBoxErrorInfo> mNext; 96 96 }; 97 97 -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r21823 r21878 74 74 public: 75 75 76 typedef std::list <ComPtr 77 typedef std::vector <ComPtr 78 79 typedef std::vector <ComObjPtr 80 typedef std::vector <ComObjPtr 81 82 typedef std::vector <ComPtr 76 typedef std::list <ComPtr<IVirtualBoxCallback> > CallbackList; 77 typedef std::vector <ComPtr<IVirtualBoxCallback> > CallbackVector; 78 79 typedef std::vector <ComObjPtr<SessionMachine> > SessionMachineVector; 80 typedef std::vector <ComObjPtr<Machine> > MachineVector; 81 82 typedef std::vector <ComPtr<IInternalSessionControl> > InternalControlVector; 83 83 84 84 class CallbackEvent; … … 224 224 IN_BSTR aFlags); 225 225 226 ComObjPtr 226 ComObjPtr<GuestOSType> getUnknownOSType(); 227 227 228 228 void getOpenedMachines (SessionMachineVector &aMachines, … … 240 240 241 241 HRESULT findMachine (const Guid &aId, bool aSetError, 242 ComObjPtr 242 ComObjPtr<Machine> *machine = NULL); 243 243 244 244 HRESULT findHardDisk(const Guid *aId, CBSTR aLocation, … … 249 249 bool aSetError, ComObjPtr<FloppyImage> *aImage = NULL); 250 250 251 const ComObjPtr 252 const ComObjPtr 251 const ComObjPtr<Host> &host() { return mData.mHost; } 252 const ComObjPtr<SystemProperties> &systemProperties() 253 253 { return mData.mSystemProperties; } 254 254 #ifdef VBOX_WITH_RESOURCE_USAGE_API 255 const ComObjPtr 255 const ComObjPtr<PerformanceCollector> &performanceCollector() 256 256 { return mData.mPerformanceCollector; } 257 257 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ … … 364 364 private: 365 365 366 typedef std::list <ComObjPtr 367 typedef std::list <ComObjPtr 368 369 typedef std::map <Guid, ComPtr 370 371 typedef std::list <ComObjPtr 372 typedef std::list <ComObjPtr 373 typedef std::list <ComObjPtr 374 typedef std::list <ComObjPtr 375 typedef std::list <ComObjPtr 366 typedef std::list <ComObjPtr<Machine> > MachineList; 367 typedef std::list <ComObjPtr<GuestOSType> > GuestOSTypeList; 368 369 typedef std::map <Guid, ComPtr<IProgress> > ProgressMap; 370 371 typedef std::list <ComObjPtr<HardDisk> > HardDiskList; 372 typedef std::list <ComObjPtr<DVDImage> > DVDImageList; 373 typedef std::list <ComObjPtr<FloppyImage> > FloppyImageList; 374 typedef std::list <ComObjPtr<SharedFolder> > SharedFolderList; 375 typedef std::list <ComObjPtr<DHCPServer> > DHCPServerList; 376 376 377 377 typedef std::map <Guid, ComObjPtr<HardDisk> > HardDiskMap; … … 430 430 431 431 // const objects not requiring locking 432 const ComObjPtr 433 const ComObjPtr 432 const ComObjPtr<Host> mHost; 433 const ComObjPtr<SystemProperties> mSystemProperties; 434 434 #ifdef VBOX_WITH_RESOURCE_USAGE_API 435 const ComObjPtr 435 const ComObjPtr<PerformanceCollector> mPerformanceCollector; 436 436 #endif /* VBOX_WITH_RESOURCE_USAGE_API */ 437 437 … … 544 544 void *handler(); 545 545 546 virtual void handleCallback (const ComPtr 546 virtual void handleCallback (const ComPtr<IVirtualBoxCallback> &aCallback) = 0; 547 547 548 548 private: … … 552 552 * is bound to the lifetime of the VirtualBox instance, so it's safe. 553 553 */ 554 ComObjPtr 554 ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 555 555 }; 556 556 -
trunk/src/VBox/Main/include/netif.h
r19433 r21878 79 79 #endif 80 80 81 int NetIfList(std::list <ComObjPtr 81 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list); 82 82 int NetIfEnableStaticIpConfig(VirtualBox *pVbox, HostNetworkInterface * pIf, ULONG aOldIp, ULONG aNewIp, ULONG aMask); 83 83 int NetIfEnableStaticIpConfigV6(VirtualBox *pVbox, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength); -
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r21713 r21878 118 118 int VBoxMainDriveInfo::updateDVDs () 119 119 { 120 LogFlowThisFunc 120 LogFlowThisFunc(("entered\n")); 121 121 int rc = VINF_SUCCESS; 122 122 bool success = false; /* Have we succeeded in finding anything yet? */ … … 127 127 /* Always allow the user to override our auto-detection using an 128 128 * environment variable. */ 129 if (RT_SUCCESS 129 if (RT_SUCCESS(rc) && (!success || testing())) 130 130 rc = getDriveInfoFromEnv ("VBOX_CDROM", &mDVDList, true /* isDVD */, 131 131 &success); 132 132 #ifdef VBOX_WITH_DBUS 133 if (RT_SUCCESS 133 if (RT_SUCCESS(rc) && RT_SUCCESS(VBoxLoadDBusLib()) && (!success || testing())) 134 134 rc = getDriveInfoFromHal(&mDVDList, true /* isDVD */, &success); 135 135 #endif /* VBOX_WITH_DBUS defined */ … … 139 139 * enumerate the /etc/fstab file (luckily there's an API to parse it) 140 140 * for CDROM devices. Ok, let's start! */ 141 if (RT_SUCCESS 141 if (RT_SUCCESS(rc) && (!success || testing())) 142 142 { 143 143 // this is a good guess usually … … 149 149 150 150 // check the drives that can be mounted 151 if (RT_SUCCESS 151 if (RT_SUCCESS(rc)) 152 152 rc = getDVDInfoFromMTab((char*)"/etc/fstab", &mDVDList); 153 153 } … … 158 158 rc = VERR_NO_MEMORY; 159 159 } 160 LogFlowThisFunc 160 LogFlowThisFunc(("rc=%Rrc\n", rc)); 161 161 return rc; 162 162 } … … 164 164 int VBoxMainDriveInfo::updateFloppies () 165 165 { 166 LogFlowThisFunc 166 LogFlowThisFunc(("entered\n")); 167 167 int rc = VINF_SUCCESS; 168 168 bool success = false; /* Have we succeeded in finding anything yet? */ … … 171 171 mFloppyList.clear (); 172 172 #if defined(RT_OS_LINUX) 173 if (RT_SUCCESS 173 if (RT_SUCCESS(rc) && (!success || testing())) 174 174 rc = getDriveInfoFromEnv ("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, 175 175 &success); 176 176 #ifdef VBOX_WITH_DBUS 177 if ( RT_SUCCESS 177 if ( RT_SUCCESS(rc) 178 178 && RT_SUCCESS(VBoxLoadDBusLib()) 179 179 && (!success || testing())) … … 185 185 * environment variable, skiping the detection. */ 186 186 187 if (RT_SUCCESS 187 if (RT_SUCCESS(rc) && (!success || testing())) 188 188 { 189 189 // we assume that a floppy is always /dev/fd[x] with x from 0 to 7 … … 202 202 rc = VERR_NO_MEMORY; 203 203 } 204 LogFlowThisFunc 204 LogFlowThisFunc(("rc=%Rrc\n", rc)); 205 205 return rc; 206 206 } … … 208 208 int VBoxMainUSBDeviceInfo::UpdateDevices () 209 209 { 210 LogFlowThisFunc 210 LogFlowThisFunc(("entered\n")); 211 211 int rc = VINF_SUCCESS; 212 212 bool success = false; /* Have we succeeded in finding anything yet? */ … … 217 217 #if defined(RT_OS_LINUX) 218 218 #ifdef VBOX_WITH_DBUS 219 if ( RT_SUCCESS 219 if ( RT_SUCCESS(rc) 220 220 && RT_SUCCESS(VBoxLoadDBusLib()) 221 221 && (!success || testing())) … … 223 223 /* Try the old API if the new one *succeeded* as only one of them will 224 224 * pick up devices anyway. */ 225 if (RT_SUCCESS 225 if (RT_SUCCESS(rc) && halSuccess && (!success || testing())) 226 226 rc = getOldUSBDeviceInfoFromHal(&mDeviceList, &halSuccess); 227 227 if (!success) … … 234 234 rc = VERR_NO_MEMORY; 235 235 } 236 LogFlowThisFunc 236 LogFlowThisFunc(("rc=%Rrc\n", rc)); 237 237 return rc; 238 238 } … … 272 272 rc = VERR_NOT_SUPPORTED; 273 273 DBusMessage *pMessage; 274 while ( RT_SUCCESS 274 while ( RT_SUCCESS(rc) 275 275 && (pMessage = dbus_connection_pop_message (mContext->mConnection.get())) != NULL) 276 276 dbus_message_unref (pMessage); /* empty the message queue. */ 277 if ( RT_SUCCESS 277 if ( RT_SUCCESS(rc) 278 278 && !dbus_connection_add_filter (mContext->mConnection.get(), 279 279 dbusFilterFunction, 280 280 (void *) &mContext->mTriggered, NULL)) 281 281 rc = VERR_NO_MEMORY; 282 if (RT_FAILURE 282 if (RT_FAILURE(rc)) 283 283 mContext->mConnection.reset(); 284 284 } … … 314 314 else 315 315 cRealMillies = DBUS_POLL_TIMEOUT; 316 while ( RT_SUCCESS 316 while ( RT_SUCCESS(rc) && connected && !mContext->mTriggered 317 317 && !mContext->mInterrupt) 318 318 { … … 439 439 rc = VERR_NO_MEMORY; 440 440 } 441 if (pszValue != NULL && RT_SUCCESS 441 if (pszValue != NULL && RT_SUCCESS(rc)) 442 442 { 443 443 char *pDrive = drive.get(); … … 492 492 RTMemAutoPtr <char, RTStrFree> mnt_type, mnt_dev; 493 493 char *tmp; 494 while (RT_SUCCESS 494 while (RT_SUCCESS(rc) && (mntent = getmntent(mtab))) 495 495 { 496 496 mnt_type = RTStrDup (mntent->mnt_type); … … 499 499 rc = VERR_NO_MEMORY; 500 500 // supermount fs case 501 if (RT_SUCCESS 501 if (RT_SUCCESS(rc) && strcmp(mnt_type.get(), "supermount") == 0) 502 502 { 503 503 tmp = strstr(mntent->mnt_opts, "fs="); … … 529 529 } 530 530 // use strstr here to cover things fs types like "udf,iso9660" 531 if (RT_SUCCESS 531 if (RT_SUCCESS(rc) && strstr(mnt_type.get(), "iso9660") == 0) 532 532 { 533 533 if (validateDevice(mnt_dev.get(), true)) … … 785 785 786 786 RTMemAutoPtr <DBusMessage, VBoxDBusMessageUnref> message, reply; 787 if (halSuccess && RT_SUCCESS 787 if (halSuccess && RT_SUCCESS(rc)) 788 788 { 789 789 message = dbus_message_new_method_call ("org.freedesktop.Hal", … … 794 794 rc = VERR_NO_MEMORY; 795 795 } 796 if (halSuccess && RT_SUCCESS 796 if (halSuccess && RT_SUCCESS(rc)) 797 797 { 798 798 DBusMessageIter iterAppend; … … 834 834 AssertPtrReturn (pszValue, VERR_INVALID_POINTER); 835 835 AssertPtrReturn (pMatches, VERR_INVALID_POINTER); 836 AssertReturn 836 AssertReturn(pfSuccess == NULL || VALID_PTR (pfSuccess), VERR_INVALID_POINTER); 837 837 LogFlowFunc (("pConnection=%p, pszKey=%s, pszValue=%s, pMatches=%p, pfSuccess=%p\n", 838 838 pConnection, pszKey, pszValue, pMatches, pfSuccess)); … … 843 843 DBusMessageIter iterFind, iterUdis; 844 844 845 if (halSuccess && RT_SUCCESS 845 if (halSuccess && RT_SUCCESS(rc)) 846 846 { 847 847 rc = halFindDeviceStringMatch (pConnection, pszKey, pszValue, … … 850 850 halSuccess = false; 851 851 } 852 if (halSuccess && RT_SUCCESS 852 if (halSuccess && RT_SUCCESS(rc)) 853 853 { 854 854 dbus_message_iter_init (replyFind.get(), &iterFind); … … 856 856 halSuccess = false; 857 857 } 858 if (halSuccess && RT_SUCCESS 858 if (halSuccess && RT_SUCCESS(rc)) 859 859 dbus_message_iter_recurse (&iterFind, &iterUdis); 860 for (; halSuccess && RT_SUCCESS 860 for (; halSuccess && RT_SUCCESS(rc) 861 861 && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; 862 862 dbus_message_iter_next(&iterUdis)) … … 928 928 if (!message) 929 929 rc = VERR_NO_MEMORY; 930 if (halSuccess && RT_SUCCESS 930 if (halSuccess && RT_SUCCESS(rc)) 931 931 { 932 932 reply = dbus_connection_send_with_reply_and_block (pConnection, … … 938 938 939 939 /* Parse the reply */ 940 if (halSuccess && RT_SUCCESS 940 if (halSuccess && RT_SUCCESS(rc)) 941 941 { 942 942 dbus_message_iter_init (reply.get(), &iterGet); … … 945 945 halSuccess = false; 946 946 } 947 if (halSuccess && RT_SUCCESS 947 if (halSuccess && RT_SUCCESS(rc)) 948 948 dbus_message_iter_recurse (&iterGet, &iterProps); 949 949 /* Go through all entries in the reply and see if any match our keys. */ 950 while ( halSuccess && RT_SUCCESS 950 while ( halSuccess && RT_SUCCESS(rc) 951 951 && dbus_message_iter_get_arg_type (&iterProps) 952 952 == DBUS_TYPE_DICT_ENTRY) … … 967 967 dbus_message_iter_next (&iterProps); 968 968 } 969 if (RT_SUCCESS 969 if (RT_SUCCESS(rc) && halSuccess) 970 970 *pMessage = reply.release(); 971 971 if (dbusError.HasName (DBUS_ERROR_NO_MEMORY)) … … 1004 1004 AssertPtrReturn (papszKeys, VERR_INVALID_POINTER); 1005 1005 AssertPtrReturn (pMatches, VERR_INVALID_POINTER); 1006 AssertReturn 1007 AssertReturn 1006 AssertReturn((pfMatches == NULL) || VALID_PTR (pfMatches), VERR_INVALID_POINTER); 1007 AssertReturn((pfSuccess == NULL) || VALID_PTR (pfSuccess), VERR_INVALID_POINTER); 1008 1008 AssertReturn(pMatches->empty(), VERR_INVALID_PARAMETER); 1009 1009 LogFlowFunc (("pConnection=%p, pszUdi=%s, cProps=%llu, papszKeys=%p, pMatches=%p, pfMatches=%p, pfSuccess=%p\n", … … 1075 1075 if (!dbusConnection) 1076 1076 halSuccess = false; 1077 if (halSuccess && RT_SUCCESS 1077 if (halSuccess && RT_SUCCESS(rc)) 1078 1078 { 1079 1079 rc = halFindDeviceStringMatch (dbusConnection.get(), "storage.drive_type", … … 1082 1082 halSuccess = false; 1083 1083 } 1084 if (halSuccess && RT_SUCCESS 1084 if (halSuccess && RT_SUCCESS(rc)) 1085 1085 { 1086 1086 dbus_message_iter_init (replyFind.get(), &iterFind); … … 1088 1088 halSuccess = false; 1089 1089 } 1090 if (halSuccess && RT_SUCCESS 1090 if (halSuccess && RT_SUCCESS(rc)) 1091 1091 dbus_message_iter_recurse (&iterFind, &iterUdis); 1092 for (; halSuccess && RT_SUCCESS 1092 for (; halSuccess && RT_SUCCESS(rc) 1093 1093 && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; 1094 1094 dbus_message_iter_next(&iterUdis)) … … 1166 1166 halSuccess = false; 1167 1167 /* Get an array of all devices in the usb_device subsystem */ 1168 if (halSuccess && RT_SUCCESS 1168 if (halSuccess && RT_SUCCESS(rc)) 1169 1169 { 1170 1170 rc = halFindDeviceStringMatch (dbusConnection.get(), "info.subsystem", … … 1173 1173 halSuccess = false; 1174 1174 } 1175 if (halSuccess && RT_SUCCESS 1175 if (halSuccess && RT_SUCCESS(rc)) 1176 1176 { 1177 1177 dbus_message_iter_init (replyFind.get(), &iterFind); … … 1181 1181 /* Recurse down into the array and query interesting information about the 1182 1182 * entries. */ 1183 if (halSuccess && RT_SUCCESS 1183 if (halSuccess && RT_SUCCESS(rc)) 1184 1184 dbus_message_iter_recurse (&iterFind, &iterUdis); 1185 for (; halSuccess && RT_SUCCESS 1185 for (; halSuccess && RT_SUCCESS(rc) 1186 1186 && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; 1187 1187 dbus_message_iter_next(&iterUdis)) … … 1251 1251 halSuccess = false; 1252 1252 /* Get an array of all devices in the usb_device subsystem */ 1253 if (halSuccess && RT_SUCCESS 1253 if (halSuccess && RT_SUCCESS(rc)) 1254 1254 { 1255 1255 rc = halFindDeviceStringMatch (dbusConnection.get(), "info.category", … … 1258 1258 halSuccess = false; 1259 1259 } 1260 if (halSuccess && RT_SUCCESS 1260 if (halSuccess && RT_SUCCESS(rc)) 1261 1261 { 1262 1262 dbus_message_iter_init (replyFind.get(), &iterFind); … … 1266 1266 /* Recurse down into the array and query interesting information about the 1267 1267 * entries. */ 1268 if (halSuccess && RT_SUCCESS 1268 if (halSuccess && RT_SUCCESS(rc)) 1269 1269 dbus_message_iter_recurse (&iterFind, &iterUdis); 1270 for (; halSuccess && RT_SUCCESS 1270 for (; halSuccess && RT_SUCCESS(rc) 1271 1271 && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; 1272 1272 dbus_message_iter_next(&iterUdis)) … … 1341 1341 if (!dbusConnection) 1342 1342 halSuccess = false; 1343 if (halSuccess && RT_SUCCESS 1343 if (halSuccess && RT_SUCCESS(rc)) 1344 1344 { 1345 1345 /* Look for children of the current UDI. */ … … 1349 1349 halSuccess = false; 1350 1350 } 1351 if (halSuccess && RT_SUCCESS 1351 if (halSuccess && RT_SUCCESS(rc)) 1352 1352 { 1353 1353 dbus_message_iter_init (replyFind.get(), &iterFind); … … 1355 1355 halSuccess = false; 1356 1356 } 1357 if (halSuccess && RT_SUCCESS 1357 if (halSuccess && RT_SUCCESS(rc)) 1358 1358 dbus_message_iter_recurse (&iterFind, &iterUdis); 1359 for (; halSuccess && RT_SUCCESS 1359 for (; halSuccess && RT_SUCCESS(rc) 1360 1360 && dbus_message_iter_get_arg_type (&iterUdis) == DBUS_TYPE_STRING; 1361 1361 dbus_message_iter_next(&iterUdis)) … … 1375 1375 if (!!replyGet && pszSysfsPath == NULL) 1376 1376 halSuccess = false; 1377 if ( halSuccess && RT_SUCCESS 1377 if ( halSuccess && RT_SUCCESS(rc) 1378 1378 && RTStrCmp (pszInfoSubsystem, "usb_device") != 0 /* Children of buses can also be devices. */ 1379 1379 && RTStrCmp (pszLinuxSubsystem, "usb_device") != 0) -
trunk/src/VBox/Main/linux/NetIf-linux.cpp
r20481 r21878 151 151 } 152 152 153 int NetIfList(std::list <ComObjPtr 153 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 154 154 { 155 155 char szDefaultIface[256]; -
trunk/src/VBox/Main/os2/NetIf-os2.cpp
r18732 r21878 33 33 #include "netif.h" 34 34 35 int NetIfList(std::list <ComObjPtr 35 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 36 36 { 37 37 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/solaris/NetIf-solaris.cpp
r19433 r21878 59 59 static void vboxSolarisAddHostIface(char *pszIface, int Instance, void *pvHostNetworkInterfaceList) 60 60 { 61 std::list<ComObjPtr <HostNetworkInterface> > *pList = (std::list<ComObjPtr<HostNetworkInterface> > *)pvHostNetworkInterfaceList;61 std::list<ComObjPtr<HostNetworkInterface> > *pList = (std::list<ComObjPtr<HostNetworkInterface> > *)pvHostNetworkInterfaceList; 62 62 Assert(pList); 63 63 … … 244 244 } 245 245 246 static bool vboxSolarisSortNICList(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr<HostNetworkInterface> Iface2)246 static bool vboxSolarisSortNICList(const ComObjPtr<HostNetworkInterface> Iface1, const ComObjPtr<HostNetworkInterface> Iface2) 247 247 { 248 248 Bstr Iface1Str; … … 255 255 } 256 256 257 static bool vboxSolarisSameNIC(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr<HostNetworkInterface> Iface2)257 static bool vboxSolarisSameNIC(const ComObjPtr<HostNetworkInterface> Iface1, const ComObjPtr<HostNetworkInterface> Iface2) 258 258 { 259 259 Bstr Iface1Str; … … 286 286 # endif /* VBOX_SOLARIS_NSL_RESOLVED */ 287 287 288 int NetIfList(std::list <ComObjPtr 288 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 289 289 { 290 290 … … 388 388 389 389 #else 390 int NetIfList(std::list <ComObjPtr 390 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 391 391 { 392 392 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/testcase/tstAPI.cpp
r20977 r21878 53 53 ComPtr<IUnknown> aObject); 54 54 static void queryMetrics (ComPtr<IVirtualBox> aVirtualBox, 55 ComPtr 55 ComPtr<IPerformanceCollector> collector, 56 56 ComSafeArrayIn (IUnknown *, objects)); 57 57 static void listAffectedMetrics(ComPtr<IVirtualBox> aVirtualBox, … … 73 73 Bstr guid; 74 74 CHECK_ERROR (machine, COMGETTER(Id) (guid.asOutParam())); 75 if (SUCCEEDED 75 if (SUCCEEDED(rc) && !guid.isEmpty()) { 76 76 RTPrintf ("Guid::toString(): {%s}\n", Utf8Str(guid).c_str()); 77 77 } else { … … 92 92 RTPrintf ("Are any settings modified?...\n"); 93 93 CHECK_ERROR (machine, COMGETTER(SettingsModified) (&modified)); 94 if (SUCCEEDED 94 if (SUCCEEDED(rc)) 95 95 RTPrintf ("%s\n", modified ? "yes" : "no"); 96 96 … … 99 99 CHECK_ERROR (machine, COMSETTER(MemorySize) (memorySizeBig)); 100 100 101 if (SUCCEEDED 101 if (SUCCEEDED(rc)) 102 102 { 103 103 RTPrintf ("Are any settings modified now?...\n"); … … 149 149 RTPrintf ("Saving machine settings...\n"); 150 150 CHECK_ERROR (machine, SaveSettings()); 151 if (SUCCEEDED 151 if (SUCCEEDED(rc)) 152 152 { 153 153 RTPrintf ("Are any settings modified after saving?...\n"); … … 185 185 CHECK_ERROR (machine, SetExtraData (extraDataKey, extraData)); 186 186 187 if (SUCCEEDED 187 if (SUCCEEDED(rc)) { 188 188 RTPrintf ("Getting extra data key {%ls} again...\n", extraDataKey.raw()); 189 189 CHECK_ERROR_RET (machine, GetExtraData (extraDataKey, extraData.asOutParam()), rc); … … 231 231 //////////////////////////////////////////////////////////////////////////// 232 232 233 ComPtr 234 ComPtr 233 ComPtr<IVirtualBox> virtualBox; 234 ComPtr<ISession> session; 235 235 236 236 #if 0 … … 284 284 285 285 for (;;) { 286 com::SafeIfaceArray 286 com::SafeIfaceArray<IProgress> operations; 287 287 288 288 CHECK_ERROR_BREAK (virtualBox, … … 309 309 { 310 310 { 311 ComPtr 311 ComPtr<IVirtualBox> virtualBox2; 312 312 313 313 RTPrintf ("Creating one more VirtualBox object...\n"); … … 323 323 Assert ((IVirtualBox *) virtualBox == (IVirtualBox *) virtualBox2); 324 324 325 ComPtr 326 ComPtr 325 ComPtr<IUnknown> unk (virtualBox); 326 ComPtr<IUnknown> unk2; 327 327 unk2 = virtualBox2; 328 328 … … 331 331 Assert ((IUnknown *) unk == (IUnknown *) unk2); 332 332 333 ComPtr 334 ComPtr 333 ComPtr<IVirtualBox> vb = unk; 334 ComPtr<IVirtualBox> vb2 = unk; 335 335 336 336 RTPrintf ("IVirtualBox(IUnknown(virtualBox))=%p IVirtualBox(IUnknown(virtualBox2))=%p\n", … … 340 340 341 341 { 342 ComPtr 342 ComPtr<IHost> host; 343 343 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam())); 344 344 RTPrintf (" IHost(host)=%p\n", (IHost *) host); 345 ComPtr 345 ComPtr<IUnknown> unk = host; 346 346 RTPrintf (" IUnknown(host)=%p\n", (IUnknown *) unk); 347 ComPtr 347 ComPtr<IHost> host_copy = unk; 348 348 RTPrintf (" IHost(host_copy)=%p\n", (IHost *) host_copy); 349 ComPtr 349 ComPtr<IUnknown> unk_copy = host_copy; 350 350 RTPrintf (" IUnknown(host_copy)=%p\n", (IUnknown *) unk_copy); 351 351 Assert ((IUnknown *) unk == (IUnknown *) unk_copy); 352 352 353 353 /* query IUnknown on IUnknown */ 354 ComPtr 355 unk_copy.queryInterfaceTo 354 ComPtr<IUnknown> unk_copy_copy; 355 unk_copy.queryInterfaceTo(unk_copy_copy.asOutParam()); 356 356 RTPrintf (" IUnknown(unk_copy)=%p\n", (IUnknown *) unk_copy_copy); 357 357 Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy); 358 358 /* query IUnknown on IUnknown in the opposite direction */ 359 unk_copy_copy.queryInterfaceTo 359 unk_copy_copy.queryInterfaceTo(unk_copy.asOutParam()); 360 360 RTPrintf (" IUnknown(unk_copy_copy)=%p\n", (IUnknown *) unk_copy); 361 361 Assert ((IUnknown *) unk_copy == (IUnknown *) unk_copy_copy); … … 398 398 RTPrintf ("Calling IVirtualBox::Machines...\n"); 399 399 400 com::SafeIfaceArray 400 com::SafeIfaceArray<IMachine> machines; 401 401 CHECK_ERROR_BREAK (virtualBox, 402 402 COMGETTER(Machines) (ComSafeArrayAsOutParam (machines))); … … 516 516 // call a method that will definitely fail 517 517 Guid uuid; 518 ComPtr 518 ComPtr<IHardDisk> hardDisk; 519 519 rc = virtualBox->GetHardDisk(uuid, hardDisk.asOutParam()); 520 520 RTPrintf ("virtualBox->GetHardDisk(null-uuid)=%08X\n", rc); … … 538 538 539 539 // call a method that will definitely fail 540 ComPtr 540 ComPtr<IMachine> machine; 541 541 rc = session->COMGETTER(Machine)(machine.asOutParam()); 542 542 RTPrintf ("session->COMGETTER(Machine)=%08X\n", rc); … … 564 564 do 565 565 { 566 ComPtr 566 ComPtr<IHardDisk> hd; 567 567 Bstr src = L"E:\\develop\\innotek\\images\\NewHardDisk.vdi"; 568 568 RTPrintf ("Opening the existing hard disk '%ls'...\n", src.raw()); … … 584 584 do 585 585 { 586 ComPtr 586 ComPtr<IVirtualDiskImage> vdi; 587 587 Bstr src = L"CreatorTest.vdi"; 588 588 RTPrintf ("Unregistering the hard disk '%ls'...\n", src.raw()); 589 589 CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage (src, vdi.asOutParam())); 590 ComPtr 590 ComPtr<IHardDisk> hd = vdi; 591 591 Guid id; 592 592 CHECK_ERROR_BREAK (hd, COMGETTER(Id) (id.asOutParam())); … … 609 609 Bstr dst = L"./clone.vdi"; 610 610 RTPrintf ("Cloning '%ls' to '%ls'...\n", src.raw(), dst.raw()); 611 ComPtr 611 ComPtr<IVirtualDiskImage> vdi; 612 612 CHECK_ERROR_BREAK (virtualBox, FindVirtualDiskImage (src, vdi.asOutParam())); 613 ComPtr 614 ComPtr 613 ComPtr<IHardDisk> hd = vdi; 614 ComPtr<IProgress> progress; 615 615 CHECK_ERROR_BREAK (hd, CloneToImage (dst, vdi.asOutParam(), progress.asOutParam())); 616 616 RTPrintf ("Waiting for completion...\n"); … … 636 636 do 637 637 { 638 ComPtr 638 ComPtr<IHardDisk> hd; 639 639 static const wchar_t *Names[] = 640 640 { … … 657 657 RTPrintf ("Searching for hard disk '%ls'...\n", src.raw()); 658 658 rc = virtualBox->FindHardDisk (src, hd.asOutParam()); 659 if (SUCCEEDED 659 if (SUCCEEDED(rc)) 660 660 { 661 661 Guid id; … … 666 666 id.raw(), location.raw()); 667 667 668 com::SafeArray 669 com::SafeArray 668 com::SafeArray<BSTR> names; 669 com::SafeArray<BSTR> values; 670 670 671 671 CHECK_ERROR_BREAK (hd, GetProperties (NULL, … … 705 705 do 706 706 { 707 ComPtr 707 ComPtr<IMachine> machine; 708 708 Bstr name = argc > 1 ? argv [1] : "dos"; 709 709 RTPrintf ("Getting a machine object named '%ls'...\n", name.raw()); … … 732 732 do 733 733 { 734 ComPtr 734 ComPtr<IMachine> machine; 735 735 #if defined (RT_OS_LINUX) 736 736 Bstr baseDir = L"/tmp/vbox"; … … 767 767 CHECK_ERROR_BREAK (machine, COMSETTER(Description) (desc)); 768 768 769 ComPtr 769 ComPtr<IGuestOSType> guestOSType; 770 770 Bstr type = L"os2warp45"; 771 771 CHECK_ERROR_BREAK (virtualBox, GetGuestOSType (type, guestOSType.asOutParam())); … … 786 786 do 787 787 { 788 ComPtr 788 ComPtr<IHost> host; 789 789 CHECK_RC_BREAK (virtualBox->COMGETTER(Host) (host.asOutParam())); 790 790 791 791 { 792 ComPtr 792 ComPtr<IHostDVDDriveCollection> coll; 793 793 CHECK_RC_BREAK (host->COMGETTER(DVDDrives) (coll.asOutParam())); 794 ComPtr 794 ComPtr<IHostDVDDriveEnumerator> enumerator; 795 795 CHECK_RC_BREAK (coll->Enumerate (enumerator.asOutParam())); 796 796 BOOL hasmore; 797 while (SUCCEEDED 797 while (SUCCEEDED(enumerator->HasMore (&hasmore)) && hasmore) 798 798 { 799 ComPtr 799 ComPtr<IHostDVDDrive> drive; 800 800 CHECK_RC_BREAK (enumerator->GetNext (drive.asOutParam())); 801 801 Bstr name; … … 805 805 CHECK_RC_BREAK (rc); 806 806 807 ComPtr 807 ComPtr<IHostDVDDrive> drive; 808 808 CHECK_ERROR (enumerator, GetNext (drive.asOutParam())); 809 809 CHECK_ERROR (coll, GetItemAt (1000, drive.asOutParam())); 810 810 CHECK_ERROR (coll, FindByName (Bstr ("R:"), drive.asOutParam())); 811 if (SUCCEEDED 811 if (SUCCEEDED(rc)) 812 812 { 813 813 Bstr name; … … 829 829 CHECK_ERROR_BREAK (virtualBox, 830 830 COMGETTER(SystemProperties) (systemProperties.asOutParam())); 831 com::SafeIfaceArray 831 com::SafeIfaceArray<IHardDiskFormat> hardDiskFormats; 832 832 CHECK_ERROR_BREAK (systemProperties, 833 833 COMGETTER(HardDiskFormats) (ComSafeArrayAsOutParam (hardDiskFormats))); … … 852 852 853 853 /* File extensions */ 854 com::SafeArray 854 com::SafeArray<BSTR> fileExtensions; 855 855 CHECK_ERROR_BREAK (hardDiskFormats [i], 856 856 COMGETTER(FileExtensions) (ComSafeArrayAsOutParam (fileExtensions))); … … 864 864 865 865 /* Configuration keys */ 866 com::SafeArray 867 com::SafeArray 868 com::SafeArray 869 com::SafeArray 870 com::SafeArray 866 com::SafeArray<BSTR> propertyNames; 867 com::SafeArray<BSTR> propertyDescriptions; 868 com::SafeArray<ULONG> propertyTypes; 869 com::SafeArray<ULONG> propertyFlags; 870 com::SafeArray<BSTR> propertyDefaults; 871 871 CHECK_ERROR_BREAK (hardDiskFormats [i], 872 872 DescribeProperties (ComSafeArrayAsOutParam (propertyNames), … … 906 906 { 907 907 { 908 com::SafeIfaceArray 908 com::SafeIfaceArray<IHardDisk> disks; 909 909 CHECK_ERROR_BREAK (virtualBox, 910 910 COMGETTER(HardDisks)(ComSafeArrayAsOutParam (disks))); … … 966 966 } 967 967 { 968 com::SafeIfaceArray 968 com::SafeIfaceArray<IDVDImage> images; 969 969 CHECK_ERROR_BREAK (virtualBox, 970 970 COMGETTER(DVDImages) (ComSafeArrayAsOutParam (images))); … … 1031 1031 do 1032 1032 { 1033 ComPtr 1033 ComPtr<IMachine> machine; 1034 1034 Bstr name = argc > 1 ? argv [1] : "dos"; 1035 1035 RTPrintf ("Getting a machine object named '%ls'...\n", name.raw()); … … 1040 1040 CHECK_RC_BREAK (virtualBox->OpenSession (session, guid)); 1041 1041 #if 1 1042 ComPtr 1042 ComPtr<IMachine> sessionMachine; 1043 1043 RTPrintf ("Getting sessioned machine object...\n"); 1044 1044 CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam())); … … 1048 1048 RTPrintf ("\n"); 1049 1049 RTPrintf ("Enabling the VRDP server (must succeed even if the VM is saved):\n"); 1050 ComPtr 1050 ComPtr<IVRDPServer> vrdp; 1051 1051 CHECK_ERROR_BREAK (sessionMachine, COMGETTER(VRDPServer) (vrdp.asOutParam())); 1052 1052 if (FAILED (vrdp->COMSETTER(Enabled) (TRUE))) … … 1063 1063 #endif 1064 1064 #if 0 1065 ComPtr 1065 ComPtr<IConsole> console; 1066 1066 RTPrintf ("Getting the console object...\n"); 1067 1067 CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam())); 1068 1068 RTPrintf ("Discarding the current machine state...\n"); 1069 ComPtr 1069 ComPtr<IProgress> progress; 1070 1070 CHECK_ERROR_BREAK (console, DiscardCurrentState (progress.asOutParam())); 1071 1071 RTPrintf ("Waiting for completion...\n"); … … 1076 1076 PRINT_ERROR_INFO (ei); 1077 1077 1078 ComPtr 1078 ComPtr<IUnknown> initiator; 1079 1079 CHECK_ERROR_BREAK (progress, COMGETTER(Initiator) (initiator.asOutParam())); 1080 1080 1081 1081 RTPrintf ("initiator(unk) = %p\n", (IUnknown *) initiator); 1082 RTPrintf ("console(unk) = %p\n", (IUnknown *) ComPtr 1082 RTPrintf ("console(unk) = %p\n", (IUnknown *) ComPtr<IUnknown> ((IConsole *) console)); 1083 1083 RTPrintf ("console = %p\n", (IConsole *) console); 1084 1084 } … … 1097 1097 do 1098 1098 { 1099 ComPtr 1099 ComPtr<IMachine> machine; 1100 1100 Bstr name = L"dos"; 1101 1101 RTPrintf ("Getting a machine object named '%ls'...\n", name.raw()); … … 1104 1104 CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam())); 1105 1105 RTPrintf ("Opening a remote session for this machine...\n"); 1106 ComPtr 1106 ComPtr<IProgress> progress; 1107 1107 CHECK_RC_BREAK (virtualBox->OpenRemoteSession (session, guid, Bstr("gui"), 1108 1108 NULL, progress.asOutParam())); 1109 1109 RTPrintf ("Waiting for the session to open...\n"); 1110 1110 CHECK_RC_BREAK (progress->WaitForCompletion (-1)); 1111 ComPtr 1111 ComPtr<IMachine> sessionMachine; 1112 1112 RTPrintf ("Getting sessioned machine object...\n"); 1113 1113 CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam())); 1114 ComPtr 1114 ComPtr<IConsole> console; 1115 1115 RTPrintf ("Getting console object...\n"); 1116 1116 CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam())); … … 1131 1131 do 1132 1132 { 1133 ComPtr 1133 ComPtr<IMachine> machine; 1134 1134 Bstr name = "dos"; 1135 1135 RTPrintf ("Getting a machine object named '%ls'...\n", name.raw()); … … 1139 1139 RTPrintf ("Opening an existing remote session for this machine...\n"); 1140 1140 CHECK_RC_BREAK (virtualBox->OpenExistingSession (session, guid)); 1141 ComPtr 1141 ComPtr<IMachine> sessionMachine; 1142 1142 RTPrintf ("Getting sessioned machine object...\n"); 1143 1143 CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam())); … … 1149 1149 #endif 1150 1150 #if 0 1151 ComPtr 1151 ComPtr<IConsole> console; 1152 1152 RTPrintf ("Getting console object...\n"); 1153 1153 CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam())); … … 1167 1167 do { 1168 1168 // Get host 1169 ComPtr 1169 ComPtr<IHost> host; 1170 1170 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 1171 1171 … … 1181 1181 do { 1182 1182 // Get host 1183 ComPtr 1183 ComPtr<IHost> host; 1184 1184 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 1185 1185 1186 com::SafeIfaceArray 1186 com::SafeIfaceArray<IHostNetworkInterface> hostNetworkInterfaces; 1187 1187 CHECK_ERROR_BREAK(host, 1188 1188 COMGETTER(NetworkInterfaces) (ComSafeArrayAsOutParam (hostNetworkInterfaces))); … … 1222 1222 do { 1223 1223 // Get collector 1224 ComPtr 1224 ComPtr<IPerformanceCollector> collector; 1225 1225 CHECK_ERROR_BREAK (virtualBox, 1226 1226 COMGETTER(PerformanceCollector) (collector.asOutParam())); … … 1230 1230 Bstr baseMetricNames[] = { L"CPU/Load,RAM/Usage" }; 1231 1231 com::SafeArray<BSTR> baseMetrics (1); 1232 baseMetricNames[0].cloneTo 1232 baseMetricNames[0].cloneTo(&baseMetrics [0]); 1233 1233 1234 1234 // Get host 1235 ComPtr 1235 ComPtr<IHost> host; 1236 1236 CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host) (host.asOutParam())); 1237 1237 1238 1238 // Get machine 1239 ComPtr 1239 ComPtr<IMachine> machine; 1240 1240 Bstr name = argc > 1 ? argv [1] : "dsl"; 1241 1241 Bstr sessionType = argc > 2 ? argv [2] : "vrdp"; … … 1247 1247 CHECK_RC_BREAK (machine->COMGETTER(Id) (guid.asOutParam())); 1248 1248 RTPrintf ("Opening a remote session for this machine...\n"); 1249 ComPtr 1249 ComPtr<IProgress> progress; 1250 1250 CHECK_RC_BREAK (virtualBox->OpenRemoteSession (session, guid, sessionType, 1251 1251 NULL, progress.asOutParam())); 1252 1252 RTPrintf ("Waiting for the session to open...\n"); 1253 1253 CHECK_RC_BREAK (progress->WaitForCompletion (-1)); 1254 ComPtr 1254 ComPtr<IMachine> sessionMachine; 1255 1255 RTPrintf ("Getting sessioned machine object...\n"); 1256 1256 CHECK_RC_BREAK (session->COMGETTER(Machine) (sessionMachine.asOutParam())); … … 1270 1270 1271 1271 // Get console 1272 ComPtr 1272 ComPtr<IConsole> console; 1273 1273 RTPrintf ("Getting console object...\n"); 1274 1274 CHECK_RC_BREAK (session->COMGETTER(Console) (console.asOutParam())); … … 1341 1341 RTPrintf ("Try to open %ls ...\n", ovf.raw()); 1342 1342 1343 ComPtr 1343 ComPtr<IAppliance> appliance; 1344 1344 CHECK_ERROR_BREAK (virtualBox, 1345 1345 CreateAppliance (appliance.asOutParam())); … … 1412 1412 ImportMachines (progress.asOutParam())); 1413 1413 CHECK_ERROR (progress, WaitForCompletion (-1)); 1414 if (SUCCEEDED 1414 if (SUCCEEDED(rc)) 1415 1415 { 1416 1416 /* Check if the import was successfully */ … … 1452 1452 #ifdef VBOX_WITH_RESOURCE_USAGE_API 1453 1453 static void queryMetrics (ComPtr<IVirtualBox> aVirtualBox, 1454 ComPtr 1454 ComPtr<IPerformanceCollector> collector, 1455 1455 ComSafeArrayIn (IUnknown *, objects)) 1456 1456 { … … 1460 1460 Bstr metricNames[] = { L"*" }; 1461 1461 com::SafeArray<BSTR> metrics (1); 1462 metricNames[0].cloneTo 1462 metricNames[0].cloneTo(&metrics [0]); 1463 1463 com::SafeArray<BSTR> retNames; 1464 1464 com::SafeIfaceArray<IUnknown> retObjects; -
trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp
r21436 r21878 46 46 g_testHostHardwareLinux = true; 47 47 rc = driveInfo.updateFloppies(); 48 if (RT_SUCCESS 48 if (RT_SUCCESS(rc)) 49 49 rc = driveInfo.updateDVDs(); 50 if (RT_FAILURE 50 if (RT_FAILURE(rc)) 51 51 { 52 52 RTPrintf("Failed to update the host drive information, error %Rrc\n", … … 79 79 VBoxMainUSBDeviceInfo deviceInfo; 80 80 rc = deviceInfo.UpdateDevices(); 81 if (RT_FAILURE 81 if (RT_FAILURE(rc)) 82 82 { 83 83 RTPrintf ("Failed to update the host USB device information, error %Rrc\n", -
trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp
r20267 r21878 589 589 nsCOMPtr <nsIExceptionService> es; 590 590 es = do_GetService (NS_EXCEPTIONSERVICE_CONTRACTID, &rc); 591 if (NS_SUCCEEDED 591 if (NS_SUCCEEDED(rc)) 592 592 { 593 593 nsCOMPtr <nsIExceptionManager> em; 594 594 rc = es->GetCurrentExceptionManager (getter_AddRefs (em)); 595 if (NS_SUCCEEDED 595 if (NS_SUCCEEDED(rc)) 596 596 { 597 597 nsCOMPtr<nsIException> ex; 598 598 rc = em->GetCurrentException (getter_AddRefs (ex)); 599 if (NS_SUCCEEDED 599 if (NS_SUCCEEDED(rc) && ex) 600 600 { 601 601 nsCOMPtr <IVirtualBoxErrorInfo> info; -
trunk/src/VBox/Main/webservice/vboxweb.h
r21763 r21878 38 38 ****************************************************************************/ 39 39 40 extern ComPtr 40 extern ComPtr<IVirtualBox> G_pVirtualBox; 41 41 extern bool g_fVerbose; 42 42 -
trunk/src/VBox/Main/win/HostPowerWin.cpp
r21243 r21878 43 43 RTTHREADTYPE_GUI, RTTHREADFLAGS_WAITABLE, "MainPower"); 44 44 45 if (RT_FAILURE 45 if (RT_FAILURE(rc)) 46 46 { 47 47 Log(("HostPowerServiceWin::HostPowerServiceWin: RTThreadCreate failed with %Rrc\n", rc)); -
trunk/src/VBox/Main/win/NetIf-win.cpp
r19598 r21878 202 202 /* for SVCHlpMsg::CreateHostOnlyNetworkInterface */ 203 203 Bstr name; 204 ComObjPtr 205 ComObjPtr 204 ComObjPtr<HostNetworkInterface> iface; 205 ComObjPtr<VirtualBox> vBox; 206 206 /* for SVCHlpMsg::RemoveHostOnlyNetworkInterface */ 207 207 Guid guid; … … 224 224 aClient, aProgress, aUser)); 225 225 226 AssertReturn 226 AssertReturn((aClient == NULL && aProgress == NULL && aVrc == NULL) || 227 227 (aClient != NULL && aProgress != NULL && aVrc != NULL), 228 228 E_POINTER); 229 AssertReturn 229 AssertReturn(aUser, E_POINTER); 230 230 231 231 std::auto_ptr <NetworkInterfaceHelperClientData> … … 250 250 /* write message and parameters */ 251 251 vrc = aClient->write (d->msgCode); 252 if (RT_FAILURE 252 if (RT_FAILURE(vrc)) break; 253 253 // vrc = aClient->write (Utf8Str (d->name)); 254 // if (RT_FAILURE 254 // if (RT_FAILURE(vrc)) break; 255 255 256 256 /* wait for a reply */ … … 261 261 262 262 vrc = aClient->read (reply); 263 if (RT_FAILURE 263 if (RT_FAILURE(vrc)) break; 264 264 265 265 switch (reply) … … 271 271 Utf8Str name; 272 272 vrc = aClient->read (name); 273 if (RT_FAILURE 273 if (RT_FAILURE(vrc)) break; 274 274 vrc = aClient->read (guid); 275 if (RT_FAILURE 275 if (RT_FAILURE(vrc)) break; 276 276 277 277 LogFlowFunc (("Network connection GUID = {%RTuuid}\n", guid.raw())); … … 296 296 Utf8Str errMsg; 297 297 vrc = aClient->read (errMsg); 298 if (RT_FAILURE 298 if (RT_FAILURE(vrc)) break; 299 299 300 300 rc = E_FAIL;//TODO: setError (E_FAIL, errMsg); … … 322 322 /* write message and parameters */ 323 323 vrc = aClient->write (d->msgCode); 324 if (RT_FAILURE 324 if (RT_FAILURE(vrc)) break; 325 325 vrc = aClient->write (d->guid); 326 if (RT_FAILURE 326 if (RT_FAILURE(vrc)) break; 327 327 328 328 /* wait for a reply */ … … 333 333 334 334 vrc = aClient->read (reply); 335 if (RT_FAILURE 335 if (RT_FAILURE(vrc)) break; 336 336 337 337 switch (reply) … … 349 349 Utf8Str errMsg; 350 350 vrc = aClient->read (errMsg); 351 if (RT_FAILURE 351 if (RT_FAILURE(vrc)) break; 352 352 353 353 rc = E_FAIL; // TODO: setError (E_FAIL, errMsg); … … 375 375 /* write message and parameters */ 376 376 vrc = aClient->write (d->msgCode); 377 if (RT_FAILURE 377 if (RT_FAILURE(vrc)) break; 378 378 vrc = aClient->write (d->guid); 379 if (RT_FAILURE 379 if (RT_FAILURE(vrc)) break; 380 380 381 381 /* wait for a reply */ … … 386 386 387 387 vrc = aClient->read (reply); 388 if (RT_FAILURE 388 if (RT_FAILURE(vrc)) break; 389 389 390 390 switch (reply) … … 402 402 Utf8Str errMsg; 403 403 vrc = aClient->read (errMsg); 404 if (RT_FAILURE 404 if (RT_FAILURE(vrc)) break; 405 405 406 406 rc = E_FAIL; // TODO: setError (E_FAIL, errMsg); … … 428 428 /* write message and parameters */ 429 429 vrc = aClient->write (d->msgCode); 430 if (RT_FAILURE 430 if (RT_FAILURE(vrc)) break; 431 431 vrc = aClient->write (d->guid); 432 if (RT_FAILURE 432 if (RT_FAILURE(vrc)) break; 433 433 vrc = aClient->write (d->u.StaticIP.IPAddress); 434 if (RT_FAILURE 434 if (RT_FAILURE(vrc)) break; 435 435 vrc = aClient->write (d->u.StaticIP.IPNetMask); 436 if (RT_FAILURE 436 if (RT_FAILURE(vrc)) break; 437 437 438 438 /* wait for a reply */ … … 443 443 444 444 vrc = aClient->read (reply); 445 if (RT_FAILURE 445 if (RT_FAILURE(vrc)) break; 446 446 447 447 switch (reply) … … 459 459 Utf8Str errMsg; 460 460 vrc = aClient->read (errMsg); 461 if (RT_FAILURE 461 if (RT_FAILURE(vrc)) break; 462 462 463 463 rc = E_FAIL; // TODO: setError (E_FAIL, errMsg); … … 485 485 /* write message and parameters */ 486 486 vrc = aClient->write (d->msgCode); 487 if (RT_FAILURE 487 if (RT_FAILURE(vrc)) break; 488 488 vrc = aClient->write (d->guid); 489 if (RT_FAILURE 489 if (RT_FAILURE(vrc)) break; 490 490 vrc = aClient->write (Utf8Str(d->u.StaticIPV6.IPV6Address)); 491 if (RT_FAILURE 491 if (RT_FAILURE(vrc)) break; 492 492 vrc = aClient->write (d->u.StaticIPV6.IPV6NetMaskLength); 493 if (RT_FAILURE 493 if (RT_FAILURE(vrc)) break; 494 494 495 495 /* wait for a reply */ … … 500 500 501 501 vrc = aClient->read (reply); 502 if (RT_FAILURE 502 if (RT_FAILURE(vrc)) break; 503 503 504 504 switch (reply) … … 516 516 Utf8Str errMsg; 517 517 vrc = aClient->read (errMsg); 518 if (RT_FAILURE 518 if (RT_FAILURE(vrc)) break; 519 519 520 520 rc = E_FAIL; // TODO: setError (E_FAIL, errMsg); … … 542 542 /* write message and parameters */ 543 543 vrc = aClient->write (d->msgCode); 544 if (RT_FAILURE 544 if (RT_FAILURE(vrc)) break; 545 545 vrc = aClient->write (d->guid); 546 if (RT_FAILURE 546 if (RT_FAILURE(vrc)) break; 547 547 548 548 /* wait for a reply */ … … 553 553 554 554 vrc = aClient->read (reply); 555 if (RT_FAILURE 555 if (RT_FAILURE(vrc)) break; 556 556 557 557 switch (reply) … … 569 569 Utf8Str errMsg; 570 570 vrc = aClient->read (errMsg); 571 if (RT_FAILURE 571 if (RT_FAILURE(vrc)) break; 572 572 573 573 rc = E_FAIL; // TODO: setError (E_FAIL, errMsg); … … 610 610 LogFlowFunc (("aClient={%p}, aMsgCode=%d\n", aClient, aMsgCode)); 611 611 612 AssertReturn 612 AssertReturn(aClient, VERR_INVALID_POINTER); 613 613 614 614 int vrc = VINF_SUCCESS; … … 623 623 // Utf8Str name; 624 624 // vrc = aClient->read (name); 625 // if (RT_FAILURE 625 // if (RT_FAILURE(vrc)) break; 626 626 627 627 Guid guid; … … 646 646 /* write success followed by GUID */ 647 647 vrc = aClient->write (SVCHlpMsg::CreateHostOnlyNetworkInterface_OK); 648 if (RT_FAILURE 648 if (RT_FAILURE(vrc)) break; 649 649 vrc = aClient->write (Utf8Str (name)); 650 if (RT_FAILURE 650 if (RT_FAILURE(vrc)) break; 651 651 vrc = aClient->write (guid); 652 if (RT_FAILURE 652 if (RT_FAILURE(vrc)) break; 653 653 } 654 654 else … … 660 660 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 661 661 vrc = aClient->write (SVCHlpMsg::Error); 662 if (RT_FAILURE 662 if (RT_FAILURE(vrc)) break; 663 663 vrc = aClient->write (errMsg); 664 if (RT_FAILURE 664 if (RT_FAILURE(vrc)) break; 665 665 } 666 666 … … 675 675 676 676 vrc = aClient->read (guid); 677 if (RT_FAILURE 677 if (RT_FAILURE(vrc)) break; 678 678 679 679 Utf8Str errMsg; … … 684 684 /* write parameter-less success */ 685 685 vrc = aClient->write (SVCHlpMsg::OK); 686 if (RT_FAILURE 686 if (RT_FAILURE(vrc)) break; 687 687 } 688 688 else … … 694 694 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 695 695 vrc = aClient->write (SVCHlpMsg::Error); 696 if (RT_FAILURE 696 if (RT_FAILURE(vrc)) break; 697 697 vrc = aClient->write (errMsg); 698 if (RT_FAILURE 698 if (RT_FAILURE(vrc)) break; 699 699 } 700 700 … … 709 709 ULONG maskLengthV6; 710 710 vrc = aClient->read (guid); 711 if (RT_FAILURE 711 if (RT_FAILURE(vrc)) break; 712 712 vrc = aClient->read (ipV6); 713 if (RT_FAILURE 713 if (RT_FAILURE(vrc)) break; 714 714 vrc = aClient->read (maskLengthV6); 715 if (RT_FAILURE 715 if (RT_FAILURE(vrc)) break; 716 716 717 717 Utf8Str errMsg; 718 718 vrc = VERR_NOT_IMPLEMENTED; 719 719 720 if (RT_SUCCESS 720 if (RT_SUCCESS(vrc)) 721 721 { 722 722 /* write success followed by GUID */ 723 723 vrc = aClient->write (SVCHlpMsg::OK); 724 if (RT_FAILURE 724 if (RT_FAILURE(vrc)) break; 725 725 } 726 726 else … … 730 730 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 731 731 vrc = aClient->write (SVCHlpMsg::Error); 732 if (RT_FAILURE 732 if (RT_FAILURE(vrc)) break; 733 733 vrc = aClient->write (errMsg); 734 if (RT_FAILURE 734 if (RT_FAILURE(vrc)) break; 735 735 } 736 736 … … 744 744 ULONG ip, mask; 745 745 vrc = aClient->read (guid); 746 if (RT_FAILURE 746 if (RT_FAILURE(vrc)) break; 747 747 vrc = aClient->read (ip); 748 if (RT_FAILURE 748 if (RT_FAILURE(vrc)) break; 749 749 vrc = aClient->read (mask); 750 if (RT_FAILURE 750 if (RT_FAILURE(vrc)) break; 751 751 752 752 Utf8Str errMsg; … … 757 757 /* write success followed by GUID */ 758 758 vrc = aClient->write (SVCHlpMsg::OK); 759 if (RT_FAILURE 759 if (RT_FAILURE(vrc)) break; 760 760 } 761 761 else … … 766 766 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 767 767 vrc = aClient->write (SVCHlpMsg::Error); 768 if (RT_FAILURE 768 if (RT_FAILURE(vrc)) break; 769 769 vrc = aClient->write (errMsg); 770 if (RT_FAILURE 770 if (RT_FAILURE(vrc)) break; 771 771 } 772 772 … … 779 779 Guid guid; 780 780 vrc = aClient->read (guid); 781 if (RT_FAILURE 781 if (RT_FAILURE(vrc)) break; 782 782 783 783 Utf8Str errMsg; … … 788 788 /* write success followed by GUID */ 789 789 vrc = aClient->write (SVCHlpMsg::OK); 790 if (RT_FAILURE 790 if (RT_FAILURE(vrc)) break; 791 791 } 792 792 else … … 797 797 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 798 798 vrc = aClient->write (SVCHlpMsg::Error); 799 if (RT_FAILURE 799 if (RT_FAILURE(vrc)) break; 800 800 vrc = aClient->write (errMsg); 801 if (RT_FAILURE 801 if (RT_FAILURE(vrc)) break; 802 802 } 803 803 … … 810 810 Guid guid; 811 811 vrc = aClient->read (guid); 812 if (RT_FAILURE 812 if (RT_FAILURE(vrc)) break; 813 813 814 814 Utf8Str errMsg; … … 819 819 /* write success followed by GUID */ 820 820 vrc = aClient->write (SVCHlpMsg::OK); 821 if (RT_FAILURE 821 if (RT_FAILURE(vrc)) break; 822 822 } 823 823 else … … 828 828 errMsg = Utf8StrFmt ("Unspecified error (%Rrc)", vrc); 829 829 vrc = aClient->write (SVCHlpMsg::Error); 830 if (RT_FAILURE 830 if (RT_FAILURE(vrc)) break; 831 831 vrc = aClient->write (errMsg); 832 if (RT_FAILURE 832 if (RT_FAILURE(vrc)) break; 833 833 } 834 834 … … 859 859 info.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX); 860 860 rc = GetVersionEx ((OSVERSIONINFO *) &info); 861 AssertReturn 861 AssertReturn(rc != 0, FALSE); 862 862 863 863 LogFlowFunc (("dwMajorVersion=%d, dwMinorVersion=%d\n", … … 897 897 /* end */ 898 898 899 static int vboxNetWinAddComponent(std::list <ComObjPtr 899 static int vboxNetWinAddComponent(std::list <ComObjPtr<HostNetworkInterface> > * pPist, INetCfgComponent * pncc, HostNetworkInterfaceType enmType) 900 900 { 901 901 LPWSTR lpszName; … … 926 926 } 927 927 /* create a new object and add it to the list */ 928 ComObjPtr 928 ComObjPtr<HostNetworkInterface> iface; 929 929 iface.createObject(); 930 930 /* remove the curly bracket at the end */ 931 if (SUCCEEDED 931 if (SUCCEEDED(iface->init (name, enmType, &Info))) 932 932 { 933 933 pPist->push_back (iface); … … 948 948 949 949 950 static int netIfListHostAdapters(std::list <ComObjPtr 950 static int netIfListHostAdapters(std::list <ComObjPtr<HostNetworkInterface> > &list) 951 951 { 952 952 #ifndef VBOX_WITH_NETFLT … … 1054 1054 #else 1055 1055 /* create a progress object */ 1056 ComObjPtr 1056 ComObjPtr<Progress> progress; 1057 1057 progress.createObject(); 1058 1058 … … 1066 1066 if(SUCCEEDED(rc)) 1067 1067 { 1068 CheckComRCReturnRC 1069 progress.queryInterfaceTo 1068 CheckComRCReturnRC(rc); 1069 progress.queryInterfaceTo(aProgress); 1070 1070 1071 1071 /* create a new uninitialized host interface object */ 1072 ComObjPtr 1072 ComObjPtr<HostNetworkInterface> iface; 1073 1073 iface.createObject(); 1074 iface.queryInterfaceTo 1074 iface.queryInterfaceTo(aHostNetworkInterface); 1075 1075 1076 1076 /* create the networkInterfaceHelperClient() argument */ 1077 1077 std::auto_ptr <NetworkInterfaceHelperClientData> 1078 1078 d (new NetworkInterfaceHelperClientData()); 1079 AssertReturn 1079 AssertReturn(d.get(), E_OUTOFMEMORY); 1080 1080 1081 1081 d->msgCode = SVCHlpMsg::CreateHostOnlyNetworkInterface; … … 1090 1090 progress); 1091 1091 1092 if (SUCCEEDED 1092 if (SUCCEEDED(rc)) 1093 1093 { 1094 1094 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1110 1110 #else 1111 1111 /* create a progress object */ 1112 ComObjPtr 1112 ComObjPtr<Progress> progress; 1113 1113 progress.createObject(); 1114 1114 ComPtr<IHost> host; … … 1121 1121 if(SUCCEEDED(rc)) 1122 1122 { 1123 CheckComRCReturnRC 1124 progress.queryInterfaceTo 1123 CheckComRCReturnRC(rc); 1124 progress.queryInterfaceTo(aProgress); 1125 1125 1126 1126 /* create the networkInterfaceHelperClient() argument */ 1127 1127 std::auto_ptr <NetworkInterfaceHelperClientData> 1128 1128 d (new NetworkInterfaceHelperClientData()); 1129 AssertReturn 1129 AssertReturn(d.get(), E_OUTOFMEMORY); 1130 1130 1131 1131 d->msgCode = SVCHlpMsg::RemoveHostOnlyNetworkInterface; … … 1138 1138 progress); 1139 1139 1140 if (SUCCEEDED 1140 if (SUCCEEDED(rc)) 1141 1141 { 1142 1142 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1165 1165 { 1166 1166 /* create a progress object */ 1167 ComObjPtr 1167 ComObjPtr<Progress> progress; 1168 1168 progress.createObject(); 1169 1169 // ComPtr<IHost> host; … … 1176 1176 if(SUCCEEDED(rc)) 1177 1177 { 1178 CheckComRCReturnRC 1179 // progress.queryInterfaceTo 1178 CheckComRCReturnRC(rc); 1179 // progress.queryInterfaceTo(aProgress); 1180 1180 1181 1181 /* create the networkInterfaceHelperClient() argument */ 1182 1182 std::auto_ptr <NetworkInterfaceHelperClientData> 1183 1183 d (new NetworkInterfaceHelperClientData()); 1184 AssertReturn 1184 AssertReturn(d.get(), E_OUTOFMEMORY); 1185 1185 1186 1186 d->msgCode = SVCHlpMsg::EnableStaticIpConfig; … … 1196 1196 progress); 1197 1197 1198 if (SUCCEEDED 1198 if (SUCCEEDED(rc)) 1199 1199 { 1200 1200 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1227 1227 { 1228 1228 /* create a progress object */ 1229 ComObjPtr 1229 ComObjPtr<Progress> progress; 1230 1230 progress.createObject(); 1231 1231 // ComPtr<IHost> host; … … 1238 1238 if(SUCCEEDED(rc)) 1239 1239 { 1240 CheckComRCReturnRC 1241 // progress.queryInterfaceTo 1240 CheckComRCReturnRC(rc); 1241 // progress.queryInterfaceTo(aProgress); 1242 1242 1243 1243 /* create the networkInterfaceHelperClient() argument */ 1244 1244 std::auto_ptr <NetworkInterfaceHelperClientData> 1245 1245 d (new NetworkInterfaceHelperClientData()); 1246 AssertReturn 1246 AssertReturn(d.get(), E_OUTOFMEMORY); 1247 1247 1248 1248 d->msgCode = SVCHlpMsg::EnableStaticIpConfigV6; … … 1258 1258 progress); 1259 1259 1260 if (SUCCEEDED 1260 if (SUCCEEDED(rc)) 1261 1261 { 1262 1262 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1289 1289 { 1290 1290 /* create a progress object */ 1291 ComObjPtr 1291 ComObjPtr<Progress> progress; 1292 1292 progress.createObject(); 1293 1293 // ComPtr<IHost> host; … … 1300 1300 if(SUCCEEDED(rc)) 1301 1301 { 1302 CheckComRCReturnRC 1303 // progress.queryInterfaceTo 1302 CheckComRCReturnRC(rc); 1303 // progress.queryInterfaceTo(aProgress); 1304 1304 1305 1305 /* create the networkInterfaceHelperClient() argument */ 1306 1306 std::auto_ptr <NetworkInterfaceHelperClientData> 1307 1307 d (new NetworkInterfaceHelperClientData()); 1308 AssertReturn 1308 AssertReturn(d.get(), E_OUTOFMEMORY); 1309 1309 1310 1310 d->msgCode = SVCHlpMsg::EnableDynamicIpConfig; … … 1318 1318 progress); 1319 1319 1320 if (SUCCEEDED 1320 if (SUCCEEDED(rc)) 1321 1321 { 1322 1322 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1349 1349 { 1350 1350 /* create a progress object */ 1351 ComObjPtr 1351 ComObjPtr<Progress> progress; 1352 1352 progress.createObject(); 1353 1353 // ComPtr<IHost> host; … … 1360 1360 if(SUCCEEDED(rc)) 1361 1361 { 1362 CheckComRCReturnRC 1363 // progress.queryInterfaceTo 1362 CheckComRCReturnRC(rc); 1363 // progress.queryInterfaceTo(aProgress); 1364 1364 1365 1365 /* create the networkInterfaceHelperClient() argument */ 1366 1366 std::auto_ptr <NetworkInterfaceHelperClientData> 1367 1367 d (new NetworkInterfaceHelperClientData()); 1368 AssertReturn 1368 AssertReturn(d.get(), E_OUTOFMEMORY); 1369 1369 1370 1370 d->msgCode = SVCHlpMsg::DhcpRediscover; … … 1378 1378 progress); 1379 1379 1380 if (SUCCEEDED 1380 if (SUCCEEDED(rc)) 1381 1381 { 1382 1382 /* d is now owned by netIfNetworkInterfaceHelperClient(), so release it */ … … 1394 1394 } 1395 1395 1396 int NetIfList(std::list <ComObjPtr 1396 int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list) 1397 1397 { 1398 1398 #ifndef VBOX_WITH_NETFLT -
trunk/src/VBox/Main/win/svchlp.cpp
r21404 r21878 65 65 int SVCHlpClient::create (const char *aName) 66 66 { 67 AssertReturn 67 AssertReturn(aName, VERR_INVALID_PARAMETER); 68 68 69 69 if (mIsOpen) … … 94 94 int SVCHlpClient::open (const char *aName) 95 95 { 96 AssertReturn 96 AssertReturn(aName, VERR_INVALID_PARAMETER); 97 97 98 98 if (mIsOpen) … … 161 161 int SVCHlpClient::write (const void *aVal, size_t aLen) 162 162 { 163 AssertReturn 164 AssertReturn 163 AssertReturn(aVal != NULL, VERR_INVALID_PARAMETER); 164 AssertReturn(aLen != 0, VERR_INVALID_PARAMETER); 165 165 166 166 if (!mIsOpen) … … 169 169 DWORD written = 0; 170 170 BOOL ok = WriteFile (mWriteEnd, aVal, (ULONG)aLen, &written, NULL); 171 AssertReturn 171 AssertReturn(!ok || written == aLen, VERR_GENERAL_FAILURE); 172 172 return ok ? VINF_SUCCESS : rtErrConvertFromWin32OnFailure(); 173 173 } … … 186 186 /* write string length */ 187 187 int vrc = write (len); 188 if (RT_SUCCESS 188 if (RT_SUCCESS(vrc)) 189 189 { 190 190 /* write string data */ … … 203 203 int SVCHlpClient::read (void *aVal, size_t aLen) 204 204 { 205 AssertReturn 206 AssertReturn 205 AssertReturn(aVal != NULL, VERR_INVALID_PARAMETER); 206 AssertReturn(aLen != 0, VERR_INVALID_PARAMETER); 207 207 208 208 if (!mIsOpen) … … 211 211 DWORD read = 0; 212 212 BOOL ok = ReadFile (mReadEnd, aVal, (ULONG)aLen, &read, NULL); 213 AssertReturn 213 AssertReturn(!ok || read == aLen, VERR_GENERAL_FAILURE); 214 214 return ok ? VINF_SUCCESS : rtErrConvertFromWin32OnFailure(); 215 215 } … … 224 224 /* read string length */ 225 225 int vrc = read (len); 226 if (RT_FAILURE 226 if (RT_FAILURE(vrc)) 227 227 return vrc; 228 228 … … 247 247 Utf8Str guidStr; 248 248 int vrc = read (guidStr); 249 if (RT_SUCCESS 249 if (RT_SUCCESS(vrc)) 250 250 aGuid = Guid (guidStr.c_str()); 251 251 return vrc; … … 266 266 { 267 267 vrc = read (msgCode); 268 if (RT_FAILURE 268 if (RT_FAILURE(vrc)) 269 269 return vrc; 270 270 … … 293 293 } 294 294 295 if (RT_FAILURE 295 if (RT_FAILURE(vrc)) 296 296 return vrc; 297 297 } -
trunk/src/VBox/Main/win/svcmain.cpp
r14831 r21878 243 243 vrc = VERR_INVALID_PARAMETER; 244 244 245 if (RT_SUCCESS 245 if (RT_SUCCESS(vrc)) 246 246 { 247 247 /* do the helper job */ 248 248 SVCHlpServer server; 249 249 vrc = server.open (pipeName); 250 if (RT_SUCCESS 250 if (RT_SUCCESS(vrc)) 251 251 vrc = server.run(); 252 252 } 253 if (RT_FAILURE 253 if (RT_FAILURE(vrc)) 254 254 { 255 255 Utf8Str err = Utf8StrFmt ( -
trunk/src/VBox/Main/xml/Settings.cpp
r21428 r21878 105 105 int64_t result; 106 106 int vrc = RTStrToInt64Full (aValue, 0, &result); 107 if (RT_SUCCESS 107 if (RT_SUCCESS(vrc)) 108 108 { 109 109 if (result >= (int64_t) aMin && result <= (int64_t) aMax) … … 115 115 uint64_t result; 116 116 int vrc = RTStrToUInt64Full (aValue, 0, &result); 117 if (RT_SUCCESS 117 if (RT_SUCCESS(vrc)) 118 118 { 119 119 if (result >= aMin && result <= aMax) … … 249 249 aBase = 10; 250 250 int vrc = RTStrFormatNumber (result.get(), aValue, aBase, 0, 0, flags); 251 if (RT_SUCCESS 251 if (RT_SUCCESS(vrc)) 252 252 return result; 253 253 … … 372 372 * from <Foo/> (where NULL is pretty much expected). */ 373 373 if (!mNodeText) 374 unconst 374 unconst(mNodeText) = 375 375 xmlNodeListGetString (mNode->doc, mNode->children, 0); 376 376 return (char *) mNodeText; … … 943 943 int XmlTreeBackend::ReadCallback (void *aCtxt, char *aBuf, int aLen) 944 944 { 945 AssertReturn 945 AssertReturn(aCtxt != NULL, 0); 946 946 947 947 Data::InputCtxt *ctxt = static_cast <Data::InputCtxt *> (aCtxt); … … 964 964 int XmlTreeBackend::WriteCallback (void *aCtxt, const char *aBuf, int aLen) 965 965 { 966 AssertReturn 966 AssertReturn(aCtxt != NULL, 0); 967 967 968 968 Data::OutputCtxt *ctxt = static_cast <Data::OutputCtxt *> (aCtxt); … … 985 985 int XmlTreeBackend::CloseCallback (void *aCtxt) 986 986 { 987 AssertReturn 987 AssertReturn(aCtxt != NULL, 0); 988 988 989 989 Data::IOCtxt *ctxt = static_cast <Data::IOCtxt *> (aCtxt); … … 1104 1104 xmlParserCtxtPtr aCtxt) 1105 1105 { 1106 AssertReturn 1106 AssertReturn(sThat != NULL, NULL); 1107 1107 1108 1108 if (sThat->m->inputResolver == NULL) -
trunk/src/VBox/Main/xpcom/server.cpp
r20630 r21878 269 269 nsresult postTo (nsIEventQueue *aEventQ) 270 270 { 271 AssertReturn 272 AssertReturn 271 AssertReturn(mEv.that == NULL, NS_ERROR_FAILURE); 272 AssertReturn(aEventQ, NS_ERROR_FAILURE); 273 273 nsresult rv = aEventQ->InitEvent (&mEv.e, NULL, 274 274 eventHandler, eventDestructor); 275 if (NS_SUCCEEDED 275 if (NS_SUCCEEDED(rv)) 276 276 { 277 277 mEv.that = this; 278 278 rv = aEventQ->PostEvent (&mEv.e); 279 if (NS_SUCCEEDED 279 if (NS_SUCCEEDED(rv)) 280 280 return rv; 281 281 } … … 358 358 int vrc = RTTimerLRStart (sTimer, uint64_t (VBoxSVC_ShutdownDelay) * 1000000); 359 359 AssertRC (vrc); 360 timerStarted = SUCCEEDED 360 timerStarted = SUCCEEDED(vrc); 361 361 } 362 362 else … … 476 476 477 477 /* create a critsect to protect object construction */ 478 if (RT_FAILURE 478 if (RT_FAILURE(RTCritSectInit (&sLock))) 479 479 return NS_ERROR_OUT_OF_MEMORY; 480 480 481 481 int vrc = RTTimerLRCreateEx (&sTimer, 0, 0, ShutdownTimer, NULL); 482 if (RT_FAILURE 482 if (RT_FAILURE(vrc)) 483 483 { 484 484 LogFlowFunc (("Failed to create a timer! (vrc=%Rrc)\n", vrc)); … … 696 696 const nsModuleComponentInfoEx *info) 697 697 { 698 AssertReturn 698 AssertReturn(result, NS_ERROR_INVALID_POINTER); 699 699 700 700 nsresult rv = NS_NewGenericFactory (result, info); 701 if (NS_SUCCEEDED 701 if (NS_SUCCEEDED(rv) && info && info->mFactoryConstructor) 702 702 { 703 703 rv = info->mFactoryConstructor(); … … 722 722 nsresult rc = NS_OK; 723 723 const nsModuleComponentInfoEx *info = components; 724 for (PRUint32 i = 0; i < count && NS_SUCCEEDED 724 for (PRUint32 i = 0; i < count && NS_SUCCEEDED(rc); i++, info++) 725 725 { 726 726 /* skip components w/o a constructor */ … … 729 729 nsIGenericFactory *factory; 730 730 rc = NS_NewGenericFactoryEx (&factory, info); 731 if (NS_SUCCEEDED 731 if (NS_SUCCEEDED(rc)) 732 732 { 733 733 rc = registrar->RegisterFactory (info->mCID, -
trunk/src/VBox/Main/xpcom/server_module.cpp
r21179 r21878 126 126 * executable is expected in the parent directory. */ 127 127 nsCOMPtr <nsIProperties> dirServ = do_GetService (NS_DIRECTORY_SERVICE_CONTRACTID, &rc); 128 if (NS_SUCCEEDED 128 if (NS_SUCCEEDED(rc)) 129 129 { 130 130 nsCOMPtr <nsIFile> componentDir; … … 132 132 NS_GET_IID (nsIFile), getter_AddRefs (componentDir)); 133 133 134 if (NS_SUCCEEDED 134 if (NS_SUCCEEDED(rc)) 135 135 { 136 136 nsCAutoString path; … … 201 201 RTPROCESS pid = NIL_RTPROCESS; 202 202 vrc = RTProcCreate (VBoxSVCPath, args, RTENV_DEFAULT, 0, &pid); 203 if (RT_FAILURE 203 if (RT_FAILURE(vrc)) 204 204 { 205 205 rc = NS_ERROR_FAILURE; … … 213 213 RTThreadSleep (VBoxSVC_WaitSlice); 214 214 rc = ipcServ->ResolveClientName (VBOXSVC_IPC_NAME, &serverID); 215 if (NS_SUCCEEDED 215 if (NS_SUCCEEDED(rc)) 216 216 break; 217 217 if (timeLeft <= VBoxSVC_WaitSlice) … … 241 241 (nsCID) NS_VIRTUALBOX_CID, 242 242 aIID, aResult); 243 if (NS_SUCCEEDED 243 if (NS_SUCCEEDED(rc)) 244 244 break; 245 245 … … 254 254 nsresult rc2 = 255 255 ipcServ->ResolveClientName (VBOXSVC_IPC_NAME, &serverID); 256 if (NS_SUCCEEDED 256 if (NS_SUCCEEDED(rc2)) 257 257 break; 258 258
Note:
See TracChangeset
for help on using the changeset viewer.