diff options
Diffstat (limited to 'src/VBox/Main/src-all')
-rw-r--r-- | src/VBox/Main/src-all/DisplayPNGUtil.cpp | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/DisplayResampleImage.cpp | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/DisplayUtils.cpp | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/EventImpl.cpp | 434 | ||||
-rw-r--r-- | src/VBox/Main/src-all/ExtPackManagerImpl.cpp | 109 | ||||
-rw-r--r-- | src/VBox/Main/src-all/ExtPackUtil.cpp | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/Global.cpp | 164 | ||||
-rw-r--r-- | src/VBox/Main/src-all/Logging.cpp | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/ProgressImpl.cpp | 889 | ||||
-rw-r--r-- | src/VBox/Main/src-all/SharedFolderImpl.cpp | 46 | ||||
-rw-r--r-- | src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp | 27 | ||||
-rw-r--r-- | src/VBox/Main/src-all/win/VirtualBox_rgs.xsl | 2 | ||||
-rw-r--r-- | src/VBox/Main/src-all/win/comregister.cmd | 26 |
13 files changed, 680 insertions, 1027 deletions
diff --git a/src/VBox/Main/src-all/DisplayPNGUtil.cpp b/src/VBox/Main/src-all/DisplayPNGUtil.cpp index 345becfc..6515845b 100644 --- a/src/VBox/Main/src-all/DisplayPNGUtil.cpp +++ b/src/VBox/Main/src-all/DisplayPNGUtil.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/src-all/DisplayResampleImage.cpp b/src/VBox/Main/src-all/DisplayResampleImage.cpp index 85c29d65..d46bffae 100644 --- a/src/VBox/Main/src-all/DisplayResampleImage.cpp +++ b/src/VBox/Main/src-all/DisplayResampleImage.cpp @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2009 Oracle Corporation + * Copyright (C) 2009-2011 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/src-all/DisplayUtils.cpp b/src/VBox/Main/src-all/DisplayUtils.cpp index efc994f3..70e15559 100644 --- a/src/VBox/Main/src-all/DisplayUtils.cpp +++ b/src/VBox/Main/src-all/DisplayUtils.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2012 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/src-all/EventImpl.cpp b/src/VBox/Main/src-all/EventImpl.cpp index 03eb7e3c..820f84b9 100644 --- a/src/VBox/Main/src-all/EventImpl.cpp +++ b/src/VBox/Main/src-all/EventImpl.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010-2012 Oracle Corporation + * Copyright (C) 2010-2014 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -120,7 +120,7 @@ HRESULT VBoxEvent::init(IEventSource *aSource, VBoxEventType_T aType, BOOL aWait if (RT_FAILURE(vrc)) { - AssertFailed (); + AssertFailed(); return setError(E_FAIL, tr("Internal error (%Rrc)"), vrc); } @@ -155,19 +155,21 @@ STDMETHODIMP VBoxEvent::COMGETTER(Type)(VBoxEventType_T *aType) CheckComArgNotNull(aType); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); - // never changes till event alive, no locking? + // never changes while event alive, no locking *aType = m->mType; return S_OK; } -STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource* *aSource) +STDMETHODIMP VBoxEvent::COMGETTER(Source)(IEventSource **aSource) { CheckComArgOutPointerValid(aSource); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); m->mSource.queryInterfaceTo(aSource); return S_OK; @@ -178,9 +180,10 @@ STDMETHODIMP VBoxEvent::COMGETTER(Waitable)(BOOL *aWaitable) CheckComArgNotNull(aWaitable); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); - // never changes till event alive, no locking? + // never changes while event alive, no locking *aWaitable = m->mWaitable; return S_OK; } @@ -189,7 +192,8 @@ STDMETHODIMP VBoxEvent::COMGETTER(Waitable)(BOOL *aWaitable) STDMETHODIMP VBoxEvent::SetProcessed() { AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -209,7 +213,8 @@ STDMETHODIMP VBoxEvent::WaitProcessed(LONG aTimeout, BOOL *aResult) CheckComArgNotNull(aResult); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); { AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -249,8 +254,7 @@ STDMETHODIMP VBoxEvent::WaitProcessed(LONG aTimeout, BOOL *aResult) typedef std::list<Bstr> VetoList; struct VBoxVetoEvent::Data { - Data() - : + Data() : mVetoed(FALSE) {} BOOL mVetoed; @@ -281,7 +285,8 @@ HRESULT VBoxVetoEvent::init(IEventSource *aSource, VBoxEventType_T aType) HRESULT rc = S_OK; // all veto events are waitable rc = VBoxEvent::init(aSource, aType, TRUE); - if (FAILED(rc)) return rc; + if (FAILED(rc)) + return rc; m->mVetoed = FALSE; m->mVetoList.clear(); @@ -300,7 +305,8 @@ void VBoxVetoEvent::uninit() STDMETHODIMP VBoxVetoEvent::AddVeto(IN_BSTR aVeto) { AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -312,12 +318,13 @@ STDMETHODIMP VBoxVetoEvent::AddVeto(IN_BSTR aVeto) return S_OK; } -STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL * aResult) +STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL *aResult) { CheckComArgOutPointerValid(aResult); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); @@ -326,13 +333,14 @@ STDMETHODIMP VBoxVetoEvent::IsVetoed(BOOL * aResult) return S_OK; } -STDMETHODIMP VBoxVetoEvent::GetVetos(ComSafeArrayOut(BSTR, aVetos)) +STDMETHODIMP VBoxVetoEvent::GetVetos(ComSafeArrayOut(BSTR, aVetos)) { if (ComSafeArrayOutIsNull(aVetos)) return E_POINTER; AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); com::SafeArray<BSTR> vetos(m->mVetoList.size()); @@ -351,8 +359,8 @@ STDMETHODIMP VBoxVetoEvent::GetVetos(ComSafeArrayOut(BSTR, aVetos)) } static const int FirstEvent = (int)VBoxEventType_LastWildcard + 1; -static const int LastEvent = (int)VBoxEventType_Last; -static const int NumEvents = LastEvent - FirstEvent; +static const int LastEvent = (int)VBoxEventType_Last; +static const int NumEvents = LastEvent - FirstEvent; /** * Class replacing std::list and able to provide required stability @@ -367,24 +375,19 @@ public: * We have to be double linked, as structural modifications in list are delayed * till element removed, so we have to know our previous one to update its next */ - EventMapRecord* mNext; + EventMapRecord *mNext; bool mAlive; private: - EventMapRecord* mPrev; - ListenerRecord* mRef; /* must be weak reference */ + EventMapRecord *mPrev; + ListenerRecord *mRef; /* must be weak reference */ int32_t mRefCnt; public: - EventMapRecord(ListenerRecord* aRef) - : - mNext(0), - mAlive(true), - mPrev(0), - mRef(aRef), - mRefCnt(1) + EventMapRecord(ListenerRecord *aRef) : + mNext(0), mAlive(true), mPrev(0), mRef(aRef), mRefCnt(1) {} - EventMapRecord(EventMapRecord& aOther) + EventMapRecord(EventMapRecord &aOther) { mNext = aOther.mNext; mPrev = aOther.mPrev; @@ -408,7 +411,8 @@ public: void release() { - if (ASMAtomicDecS32(&mRefCnt) <= 0) delete this; + if (ASMAtomicDecS32(&mRefCnt) <= 0) + delete this; } // Called when an element is no longer needed @@ -418,7 +422,7 @@ public: release(); } - ListenerRecord* ref() + ListenerRecord *ref() { return mAlive ? mRef : 0; } @@ -473,7 +477,7 @@ public: EventMapRecord *pCur = mHead; while (pCur) { - EventMapRecord* aNext = pCur->mNext; + EventMapRecord *aNext = pCur->mNext; if (pCur->ref() == aRec) { if (pCur == mHead) @@ -495,13 +499,13 @@ public: { EventMapRecord *mCur; - iterator() - : mCur(0) + iterator() : + mCur(0) {} explicit - iterator(EventMapRecord *aCur) - : mCur(aCur) + iterator(EventMapRecord *aCur) : + mCur(aCur) { // Prevent element removal, till we're at it if (mCur) @@ -539,13 +543,13 @@ public: } bool - operator==(const EventMapList::iterator& aOther) const + operator==(const EventMapList::iterator &aOther) const { return mCur == aOther.mCur; } bool - operator!=(const EventMapList::iterator& aOther) const + operator!=(const EventMapList::iterator &aOther) const { return mCur != aOther.mCur; } @@ -563,7 +567,7 @@ public: }; typedef EventMapList EventMap[NumEvents]; -typedef std::map<IEvent*, int32_t> PendingEventsMap; +typedef std::map<IEvent *, int32_t> PendingEventsMap; typedef std::deque<ComPtr<IEvent> > PassiveQueue; class ListenerRecord @@ -571,7 +575,7 @@ class ListenerRecord private: ComPtr<IEventListener> mListener; BOOL mActive; - EventSource* mOwner; + EventSource *mOwner; RTSEMEVENT mQEvent; RTCRITSECT mcsQLock; @@ -580,24 +584,29 @@ private: uint64_t mLastRead; public: - ListenerRecord(IEventListener* aListener, - com::SafeArray<VBoxEventType_T>& aInterested, - BOOL aActive, - EventSource* aOwner); + ListenerRecord(IEventListener *aListener, + com::SafeArray<VBoxEventType_T> &aInterested, + BOOL aActive, + EventSource *aOwner); ~ListenerRecord(); - HRESULT process(IEvent* aEvent, BOOL aWaitable, PendingEventsMap::iterator& pit, AutoLockBase& alock); - HRESULT enqueue(IEvent* aEvent); - HRESULT dequeue(IEvent* *aEvent, LONG aTimeout, AutoLockBase& aAlock); - HRESULT eventProcessed(IEvent * aEvent, PendingEventsMap::iterator& pit); + HRESULT process(IEvent *aEvent, BOOL aWaitable, PendingEventsMap::iterator &pit, AutoLockBase &alock); + HRESULT enqueue(IEvent *aEvent); + HRESULT dequeue(IEvent **aEvent, LONG aTimeout, AutoLockBase &aAlock); + HRESULT eventProcessed(IEvent *aEvent, PendingEventsMap::iterator &pit); + void shutdown(); + void addRef() { ASMAtomicIncS32(&mRefCnt); } + void release() { - if (ASMAtomicDecS32(&mRefCnt) <= 0) delete this; + if (ASMAtomicDecS32(&mRefCnt) <= 0) + delete this; } + BOOL isActive() { return mActive; @@ -611,15 +620,13 @@ template<typename Held> class RecordHolder { public: - RecordHolder(Held* lr) - : - held(lr) + RecordHolder(Held *lr) : + held(lr) { addref(); } - RecordHolder(const RecordHolder& that) - : - held(that.held) + RecordHolder(const RecordHolder &that) : + held(that.held) { addref(); } @@ -633,7 +640,7 @@ public: release(); } - Held* obj() + Held *obj() { return held; } @@ -644,7 +651,7 @@ public: return *this; } private: - Held* held; + Held *held; void addref() { @@ -656,7 +663,7 @@ private: if (held) held->release(); } - void safe_assign (Held *that_p) + void safe_assign(Held *that_p) { if (that_p) that_p->addRef(); @@ -665,14 +672,17 @@ private: } }; -typedef std::map<IEventListener*, RecordHolder<ListenerRecord> > Listeners; +typedef std::map<IEventListener *, RecordHolder<ListenerRecord> > Listeners; struct EventSource::Data { - Data() {} + Data() : fShutdown(false) + {} + Listeners mListeners; EventMap mEvMap; PendingEventsMap mPendingMap; + bool fShutdown; }; /** @@ -685,42 +695,39 @@ static BOOL implies(VBoxEventType_T who, VBoxEventType_T what) case VBoxEventType_Any: return TRUE; case VBoxEventType_Vetoable: - return (what == VBoxEventType_OnExtraDataCanChange) - || (what == VBoxEventType_OnCanShowWindow); + return (what == VBoxEventType_OnExtraDataCanChange) + || (what == VBoxEventType_OnCanShowWindow); case VBoxEventType_MachineEvent: - return (what == VBoxEventType_OnMachineStateChanged) - || (what == VBoxEventType_OnMachineDataChanged) - || (what == VBoxEventType_OnMachineRegistered) - || (what == VBoxEventType_OnSessionStateChanged) - || (what == VBoxEventType_OnGuestPropertyChanged); + return (what == VBoxEventType_OnMachineStateChanged) + || (what == VBoxEventType_OnMachineDataChanged) + || (what == VBoxEventType_OnMachineRegistered) + || (what == VBoxEventType_OnSessionStateChanged) + || (what == VBoxEventType_OnGuestPropertyChanged); case VBoxEventType_SnapshotEvent: - return (what == VBoxEventType_OnSnapshotTaken) - || (what == VBoxEventType_OnSnapshotDeleted) - || (what == VBoxEventType_OnSnapshotChanged) - ; + return (what == VBoxEventType_OnSnapshotTaken) + || (what == VBoxEventType_OnSnapshotDeleted) + || (what == VBoxEventType_OnSnapshotChanged) ; case VBoxEventType_InputEvent: - return (what == VBoxEventType_OnKeyboardLedsChanged) - || (what == VBoxEventType_OnMousePointerShapeChanged) - || (what == VBoxEventType_OnMouseCapabilityChanged) - ; + return (what == VBoxEventType_OnKeyboardLedsChanged) + || (what == VBoxEventType_OnMousePointerShapeChanged) + || (what == VBoxEventType_OnMouseCapabilityChanged); case VBoxEventType_Invalid: return FALSE; default: - return who == what; + break; } + + return who == what; } -ListenerRecord::ListenerRecord(IEventListener* aListener, - com::SafeArray<VBoxEventType_T>& aInterested, - BOOL aActive, - EventSource* aOwner) - : - mActive(aActive), - mOwner(aOwner), - mRefCnt(0) +ListenerRecord::ListenerRecord(IEventListener *aListener, + com::SafeArray<VBoxEventType_T> &aInterested, + BOOL aActive, + EventSource *aOwner) : + mActive(aActive), mOwner(aOwner), mRefCnt(0) { mListener = aListener; - EventMap* aEvMap = &aOwner->m->mEvMap; + EventMap *aEvMap = &aOwner->m->mEvMap; for (size_t i = 0; i < aInterested.size(); ++i) { @@ -738,12 +745,12 @@ ListenerRecord::ListenerRecord(IEventListener* aListener, if (!mActive) { ::RTCritSectInit(&mcsQLock); - ::RTSemEventCreate (&mQEvent); + ::RTSemEventCreate(&mQEvent); mLastRead = RTTimeMilliTS(); } else { - mQEvent =NIL_RTSEMEVENT; + mQEvent = NIL_RTSEMEVENT; RT_ZERO(mcsQLock); mLastRead = 0; } @@ -752,7 +759,7 @@ ListenerRecord::ListenerRecord(IEventListener* aListener, ListenerRecord::~ListenerRecord() { /* Remove references to us from the event map */ - EventMap* aEvMap = &mOwner->m->mEvMap; + EventMap *aEvMap = &mOwner->m->mEvMap; for (int j = FirstEvent; j < LastEvent; j++) { (*aEvMap)[j - FirstEvent].remove(this); @@ -762,7 +769,7 @@ ListenerRecord::~ListenerRecord() { // at this moment nobody could add elements to our queue, so we can safely // clean it up, otherwise there will be pending events map elements - PendingEventsMap* aPem = &mOwner->m->mPendingMap; + PendingEventsMap *aPem = &mOwner->m->mPendingMap; while (true) { ComPtr<IEvent> aEvent; @@ -784,21 +791,21 @@ ListenerRecord::~ListenerRecord() } ::RTCritSectDelete(&mcsQLock); - ::RTSemEventDestroy(mQEvent); } + shutdown(); } -HRESULT ListenerRecord::process(IEvent* aEvent, - BOOL aWaitable, - PendingEventsMap::iterator& pit, - AutoLockBase& aAlock) +HRESULT ListenerRecord::process(IEvent *aEvent, + BOOL aWaitable, + PendingEventsMap::iterator &pit, + AutoLockBase &aAlock) { if (mActive) { /* * We release lock here to allow modifying ops on EventSource inside callback. */ - HRESULT rc = S_OK; + HRESULT rc = S_OK; if (mListener) { aAlock.release(); @@ -816,7 +823,7 @@ HRESULT ListenerRecord::process(IEvent* aEvent, } -HRESULT ListenerRecord::enqueue (IEvent* aEvent) +HRESULT ListenerRecord::enqueue(IEvent *aEvent) { AssertMsg(!mActive, ("must be passive\n")); @@ -827,7 +834,7 @@ HRESULT ListenerRecord::enqueue (IEvent* aEvent) // and events keep coming, or queue is oversized we shall unregister this listener. uint64_t sinceRead = RTTimeMilliTS() - mLastRead; size_t queueSize = mQueue.size(); - if ( (queueSize > 1000) || ((queueSize > 500) && (sinceRead > 60 * 1000))) + if ((queueSize > 1000) || ((queueSize > 500) && (sinceRead > 60 * 1000))) { ::RTCritSectLeave(&mcsQLock); return E_ABORT; @@ -843,15 +850,15 @@ HRESULT ListenerRecord::enqueue (IEvent* aEvent) ::RTCritSectLeave(&mcsQLock); - // notify waiters + // notify waiters ::RTSemEventSignal(mQEvent); return S_OK; } -HRESULT ListenerRecord::dequeue (IEvent* *aEvent, - LONG aTimeout, - AutoLockBase& aAlock) +HRESULT ListenerRecord::dequeue(IEvent **aEvent, + LONG aTimeout, + AutoLockBase &aAlock) { if (mActive) return VBOX_E_INVALID_OBJECT_STATE; @@ -863,7 +870,8 @@ HRESULT ListenerRecord::dequeue (IEvent* *aEvent, mLastRead = RTTimeMilliTS(); - if (mQueue.empty()) { + if (mQueue.empty()) + { ::RTCritSectLeave(&mcsQLock); // Speed up common case if (aTimeout == 0) @@ -891,7 +899,7 @@ HRESULT ListenerRecord::dequeue (IEvent* *aEvent, return S_OK; } -HRESULT ListenerRecord::eventProcessed (IEvent* aEvent, PendingEventsMap::iterator& pit) +HRESULT ListenerRecord::eventProcessed(IEvent *aEvent, PendingEventsMap::iterator &pit) { if (--pit->second == 0) { @@ -903,6 +911,16 @@ HRESULT ListenerRecord::eventProcessed (IEvent* aEvent, PendingEventsMap::iterat return S_OK; } +void ListenerRecord::shutdown() +{ + if (mQEvent != NIL_RTSEMEVENT) + { + RTSEMEVENT tmp = mQEvent; + mQEvent = NIL_RTSEMEVENT; + ::RTSemEventDestroy(tmp); + } +} + EventSource::EventSource() {} @@ -922,7 +940,7 @@ void EventSource::FinalRelease() BaseFinalRelease(); } -HRESULT EventSource::init(IUnknown *) +HRESULT EventSource::init() { HRESULT rc = S_OK; @@ -936,32 +954,58 @@ HRESULT EventSource::init(IUnknown *) void EventSource::uninit() { + { + // First of all (before even thinking about entering the uninit span): + // make sure that all listeners are are shut down (no pending events or + // wait calls), because they cannot be alive without the associated + // event source. Otherwise API clients which use long-term (or + // indefinite) waits will block VBoxSVC termination (just one example) + // for a long time or even infinitely long. + AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); + if (!m->fShutdown) + { + m->fShutdown = true; + for (Listeners::iterator it = m->mListeners.begin(); + it != m->mListeners.end(); + ++it) + { + it->second.obj()->shutdown(); + } + } + } + AutoUninitSpan autoUninitSpan(this); if (autoUninitSpan.uninitDone()) return; + m->mListeners.clear(); // m->mEvMap shall be cleared at this point too by destructors, assert? } -STDMETHODIMP EventSource::RegisterListener(IEventListener * aListener, +STDMETHODIMP EventSource::RegisterListener(IEventListener *aListener, ComSafeArrayIn(VBoxEventType_T, aInterested), - BOOL aActive) + BOOL aActive) { CheckComArgNotNull(aListener); CheckComArgSafeArrayNotNull(aInterested); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); { AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); + if (m->fShutdown) + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("This event source is already shut down")); + Listeners::const_iterator it = m->mListeners.find(aListener); if (it != m->mListeners.end()) return setError(E_INVALIDARG, tr("This listener already registered")); - com::SafeArray<VBoxEventType_T> interested(ComSafeArrayInArg (aInterested)); + com::SafeArray<VBoxEventType_T> interested(ComSafeArrayInArg(aInterested)); RecordHolder<ListenerRecord> lrh(new ListenerRecord(aListener, interested, aActive, this)); m->mListeners.insert(Listeners::value_type(aListener, lrh)); } @@ -973,12 +1017,13 @@ STDMETHODIMP EventSource::RegisterListener(IEventListener * aListener, return S_OK; } -STDMETHODIMP EventSource::UnregisterListener(IEventListener * aListener) +STDMETHODIMP EventSource::UnregisterListener(IEventListener *aListener) { CheckComArgNotNull(aListener); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); HRESULT rc; { @@ -988,6 +1033,7 @@ STDMETHODIMP EventSource::UnregisterListener(IEventListener * aListener) if (it != m->mListeners.end()) { + it->second.obj()->shutdown(); m->mListeners.erase(it); // destructor removes refs from the event map rc = S_OK; @@ -1009,15 +1055,16 @@ STDMETHODIMP EventSource::UnregisterListener(IEventListener * aListener) return rc; } -STDMETHODIMP EventSource::FireEvent(IEvent * aEvent, - LONG aTimeout, - BOOL *aProcessed) +STDMETHODIMP EventSource::FireEvent(IEvent *aEvent, + LONG aTimeout, + BOOL *aProcessed) { CheckComArgNotNull(aEvent); CheckComArgOutPointerValid(aProcessed); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); HRESULT hrc; BOOL aWaitable = FALSE; @@ -1026,6 +1073,10 @@ STDMETHODIMP EventSource::FireEvent(IEvent * aEvent, do { AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); + if (m->fShutdown) + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("This event source is already shut down")); + VBoxEventType_T evType; hrc = aEvent->COMGETTER(Type)(&evType); AssertComRCReturn(hrc, hrc); @@ -1072,7 +1123,10 @@ STDMETHODIMP EventSource::FireEvent(IEvent * aEvent, { Listeners::iterator lit = m->mListeners.find(record.obj()->mListener); if (lit != m->mListeners.end()) + { + lit->second.obj()->shutdown(); m->mListeners.erase(lit); + } } // anything else to do with cbRc? } @@ -1088,18 +1142,23 @@ STDMETHODIMP EventSource::FireEvent(IEvent * aEvent, } -STDMETHODIMP EventSource::GetEvent(IEventListener * aListener, - LONG aTimeout, - IEvent ** aEvent) +STDMETHODIMP EventSource::GetEvent(IEventListener *aListener, + LONG aTimeout, + IEvent **aEvent) { CheckComArgNotNull(aListener); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); + if (m->fShutdown) + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("This event source is already shut down")); + Listeners::iterator it = m->mListeners.find(aListener); HRESULT rc; @@ -1115,17 +1174,22 @@ STDMETHODIMP EventSource::GetEvent(IEventListener * aListener, return rc; } -STDMETHODIMP EventSource::EventProcessed(IEventListener * aListener, - IEvent * aEvent) +STDMETHODIMP EventSource::EventProcessed(IEventListener *aListener, + IEvent *aEvent) { CheckComArgNotNull(aListener); CheckComArgNotNull(aEvent); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); + if (m->fShutdown) + return setError(VBOX_E_INVALID_OBJECT_STATE, + tr("This event source is already shut down")); + Listeners::iterator it = m->mListeners.find(aListener); HRESULT rc; @@ -1134,11 +1198,11 @@ STDMETHODIMP EventSource::EventProcessed(IEventListener * aListener, if (it != m->mListeners.end()) { - ListenerRecord* aRecord = it->second.obj(); + ListenerRecord *aRecord = it->second.obj(); if (aRecord->isActive()) return setError(E_INVALIDARG, - tr("Only applicable to passive listeners")); + tr("Only applicable to passive listeners")); if (aWaitable) { @@ -1244,14 +1308,14 @@ public: BaseFinalRelease(); } - HRESULT init(IEventSource* aSource) + HRESULT init(IEventSource *aSource) { mSource = aSource; return S_OK; } // IEventListener methods - STDMETHOD(HandleEvent)(IEvent * aEvent) + STDMETHOD(HandleEvent)(IEvent *aEvent) { BOOL fProcessed = FALSE; if (mSource) @@ -1267,7 +1331,7 @@ class ATL_NO_VTABLE EventSourceAggregator : { typedef std::list <ComPtr<IEventSource> > EventSourceList; /* key is weak reference */ - typedef std::map<IEventListener*, ComPtr<IEventListener> > ProxyListenerMap; + typedef std::map<IEventListener *, ComPtr<IEventListener> > ProxyListenerMap; EventSourceList mEventSources; ProxyListenerMap mListenerProxies; @@ -1306,28 +1370,28 @@ public: HRESULT init(ComSafeArrayIn(IEventSource *, aSources)); // IEventSource methods - STDMETHOD(CreateListener)(IEventListener ** aListener); - STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource*, aSubordinates), - IEventSource ** aAggregator); - STDMETHOD(RegisterListener)(IEventListener * aListener, + STDMETHOD(CreateListener)(IEventListener **aListener); + STDMETHOD(CreateAggregator)(ComSafeArrayIn(IEventSource *, aSubordinates), + IEventSource **aAggregator); + STDMETHOD(RegisterListener)(IEventListener *aListener, ComSafeArrayIn(VBoxEventType_T, aInterested), - BOOL aActive); - STDMETHOD(UnregisterListener)(IEventListener * aListener); - STDMETHOD(FireEvent)(IEvent * aEvent, - LONG aTimeout, - BOOL *aProcessed); - STDMETHOD(GetEvent)(IEventListener * aListener, - LONG aTimeout, - IEvent * *aEvent); - STDMETHOD(EventProcessed)(IEventListener * aListener, - IEvent * aEvent); + BOOL aActive); + STDMETHOD(UnregisterListener)(IEventListener *aListener); + STDMETHOD(FireEvent)(IEvent *aEvent, + LONG aTimeout, + BOOL *aProcessed); + STDMETHOD(GetEvent)(IEventListener *aListener, + LONG aTimeout, + IEvent **aEvent); + STDMETHOD(EventProcessed)(IEventListener *aListener, + IEvent *aEvent); protected: - HRESULT createProxyListener(IEventListener * aListener, - IEventListener * *aProxy); - HRESULT getProxyListener (IEventListener * aListener, - IEventListener * *aProxy); - HRESULT removeProxyListener(IEventListener * aListener); + HRESULT createProxyListener(IEventListener *aListener, + IEventListener **aProxy); + HRESULT getProxyListener(IEventListener *aListener, + IEventListener **aProxy); + HRESULT removeProxyListener(IEventListener *aListener); }; #ifdef VBOX_WITH_XPCOM @@ -1346,47 +1410,48 @@ NS_IMPL_THREADSAFE_ISUPPORTS1_CI(EventSourceAggregator, IEventSource) #endif -STDMETHODIMP EventSource::CreateListener(IEventListener ** aListener) +STDMETHODIMP EventSource::CreateListener(IEventListener **aListener) { CheckComArgOutPointerValid(aListener); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); ComObjPtr<PassiveEventListener> listener; HRESULT rc = listener.createObject(); - ComAssertMsgRet(SUCCEEDED(rc), ("Could not create wrapper object (%Rrc)", rc), + ComAssertMsgRet(SUCCEEDED(rc), ("Could not create wrapper object (%Rhrc)", rc), E_FAIL); listener.queryInterfaceTo(aListener); return S_OK; } -STDMETHODIMP EventSource::CreateAggregator(ComSafeArrayIn(IEventSource*, aSubordinates), - IEventSource ** aResult) +STDMETHODIMP EventSource::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates), + IEventSource **aResult) { CheckComArgOutPointerValid(aResult); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); ComObjPtr<EventSourceAggregator> agg; HRESULT rc = agg.createObject(); - ComAssertMsgRet(SUCCEEDED(rc), ("Could not create aggregator (%Rrc)", rc), + ComAssertMsgRet(SUCCEEDED(rc), ("Could not create aggregator (%Rhrc)", rc), E_FAIL); rc = agg->init(ComSafeArrayInArg(aSubordinates)); if (FAILED(rc)) return rc; - agg.queryInterfaceTo(aResult); return S_OK; } -HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource*, aSourcesIn)) +HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource *, aSourcesIn)) { HRESULT rc; @@ -1394,10 +1459,10 @@ HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource*, aSourcesIn)) AssertReturn(autoInitSpan.isOk(), E_FAIL); rc = mSource.createObject(); - ComAssertMsgRet(SUCCEEDED(rc), ("Could not create source (%Rrc)", rc), + ComAssertMsgRet(SUCCEEDED(rc), ("Could not create source (%Rhrc)", rc), E_FAIL); - rc = mSource->init((IEventSource*)this); - ComAssertMsgRet(SUCCEEDED(rc), ("Could not init source (%Rrc)", rc), + rc = mSource->init(); + ComAssertMsgRet(SUCCEEDED(rc), ("Could not init source (%Rhrc)", rc), E_FAIL); com::SafeIfaceArray<IEventSource> aSources(ComSafeArrayInArg (aSourcesIn)); @@ -1416,26 +1481,27 @@ HRESULT EventSourceAggregator::init(ComSafeArrayIn(IEventSource*, aSourcesIn)) return rc; } -STDMETHODIMP EventSourceAggregator::CreateListener(IEventListener ** aListener) +STDMETHODIMP EventSourceAggregator::CreateListener(IEventListener **aListener) { return mSource->CreateListener(aListener); } -STDMETHODIMP EventSourceAggregator::CreateAggregator(ComSafeArrayIn(IEventSource*, aSubordinates), - IEventSource ** aResult) +STDMETHODIMP EventSourceAggregator::CreateAggregator(ComSafeArrayIn(IEventSource *, aSubordinates), + IEventSource **aResult) { return mSource->CreateAggregator(ComSafeArrayInArg(aSubordinates), aResult); } -STDMETHODIMP EventSourceAggregator::RegisterListener(IEventListener * aListener, +STDMETHODIMP EventSourceAggregator::RegisterListener(IEventListener *aListener, ComSafeArrayIn(VBoxEventType_T, aInterested), - BOOL aActive) + BOOL aActive) { CheckComArgNotNull(aListener); CheckComArgSafeArrayNotNull(aInterested); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); HRESULT rc; @@ -1460,12 +1526,13 @@ STDMETHODIMP EventSourceAggregator::RegisterListener(IEventListener * aListener, return rc; } -STDMETHODIMP EventSourceAggregator::UnregisterListener(IEventListener * aListener) +STDMETHODIMP EventSourceAggregator::UnregisterListener(IEventListener *aListener) { CheckComArgNotNull(aListener); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); HRESULT rc = S_OK; @@ -1488,19 +1555,20 @@ STDMETHODIMP EventSourceAggregator::UnregisterListener(IEventListener * aListene } -STDMETHODIMP EventSourceAggregator::FireEvent(IEvent * aEvent, - LONG aTimeout, - BOOL *aProcessed) +STDMETHODIMP EventSourceAggregator::FireEvent(IEvent *aEvent, + LONG aTimeout, + BOOL *aProcessed) { CheckComArgNotNull(aEvent); CheckComArgOutPointerValid(aProcessed); AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); + if (FAILED(autoCaller.rc())) + return autoCaller.rc(); HRESULT rc = S_OK; AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - /* Aggresgator event source shalln't have direct event firing, but we may + /* Aggregator event source shall not have direct event firing, but we may wish to support aggregation chains */ for (EventSourceList::const_iterator it = mEventSources.begin(); it != mEventSources.end(); ++it) @@ -1515,26 +1583,26 @@ STDMETHODIMP EventSourceAggregator::FireEvent(IEvent * aEvent, return S_OK; } -STDMETHODIMP EventSourceAggregator::GetEvent(IEventListener * aListener, - LONG aTimeout, - IEvent ** aEvent) +STDMETHODIMP EventSourceAggregator::GetEvent(IEventListener *aListener, + LONG aTimeout, + IEvent **aEvent) { return mSource->GetEvent(aListener, aTimeout, aEvent); } -STDMETHODIMP EventSourceAggregator::EventProcessed(IEventListener * aListener, - IEvent * aEvent) +STDMETHODIMP EventSourceAggregator::EventProcessed(IEventListener *aListener, + IEvent *aEvent) { return mSource->EventProcessed(aListener, aEvent); } -HRESULT EventSourceAggregator::createProxyListener(IEventListener * aListener, - IEventListener * *aProxy) +HRESULT EventSourceAggregator::createProxyListener(IEventListener *aListener, + IEventListener **aProxy) { ComObjPtr<ProxyEventListener> proxy; HRESULT rc = proxy.createObject(); - ComAssertMsgRet(SUCCEEDED(rc), ("Could not create proxy (%Rrc)", rc), + ComAssertMsgRet(SUCCEEDED(rc), ("Could not create proxy (%Rhrc)", rc), E_FAIL); rc = proxy->init(mSource); @@ -1552,8 +1620,8 @@ HRESULT EventSourceAggregator::createProxyListener(IEventListener * aListener, return S_OK; } -HRESULT EventSourceAggregator::getProxyListener(IEventListener * aListener, - IEventListener * *aProxy) +HRESULT EventSourceAggregator::getProxyListener(IEventListener *aListener, + IEventListener **aProxy) { ProxyListenerMap::const_iterator it = mListenerProxies.find(aListener); if (it == mListenerProxies.end()) @@ -1564,7 +1632,7 @@ HRESULT EventSourceAggregator::getProxyListener(IEventListener * aListener, return S_OK; } -HRESULT EventSourceAggregator::removeProxyListener(IEventListener * aListener) +HRESULT EventSourceAggregator::removeProxyListener(IEventListener *aListener) { ProxyListenerMap::iterator it = mListenerProxies.find(aListener); if (it == mListenerProxies.end()) diff --git a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp index 5b1a6929..7fcc55cd 100644 --- a/src/VBox/Main/src-all/ExtPackManagerImpl.cpp +++ b/src/VBox/Main/src-all/ExtPackManagerImpl.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2010 Oracle Corporation + * Copyright (C) 2010-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -44,8 +44,11 @@ #include "AutoCaller.h" #include "Global.h" #include "ProgressImpl.h" -#include "SystemPropertiesImpl.h" -#include "VirtualBoxImpl.h" +#if defined(VBOX_COM_INPROC) +# include "ConsoleImpl.h" +#else +# include "VirtualBoxImpl.h" +#endif /******************************************************************************* @@ -80,6 +83,7 @@ public: Utf8Str strWhyUnusable; }; +#if !defined(VBOX_COM_INPROC) /** * Private extension pack data. */ @@ -101,6 +105,7 @@ public: RTMEMEF_NEW_AND_DELETE_OPERATORS(); }; +#endif /** * Private extension pack data. @@ -150,8 +155,10 @@ struct ExtPackManager::Data Utf8Str strCertificatDirPath; /** The list of installed extension packs. */ ExtPackList llInstalledExtPacks; +#if !defined(VBOX_COM_INPROC) /** Pointer to the VirtualBox object, our parent. */ VirtualBox *pVirtualBox; +#endif /** The current context. */ VBOXEXTPACKCTX enmContext; #if !defined(RT_OS_WINDOWS) && !defined(RT_OS_DARWIN) @@ -162,6 +169,7 @@ struct ExtPackManager::Data RTMEMEF_NEW_AND_DELETE_OPERATORS(); }; +#if !defined(VBOX_COM_INPROC) /** * Extension pack installation job. */ @@ -705,6 +713,7 @@ STDMETHODIMP ExtPackFile::Install(BOOL a_fReplace, IN_BSTR a_bstrDisplayInfo, IP return hrc; } +#endif @@ -749,6 +758,7 @@ HRESULT ExtPack::initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, /* pfnFindModule = */ ExtPack::hlpFindModule, /* pfnGetFilePath = */ ExtPack::hlpGetFilePath, /* pfnGetContext = */ ExtPack::hlpGetContext, + /* pfnLoadHGCMService = */ ExtPack::hlpLoadHGCMService, /* pfnReserved1 = */ ExtPack::hlpReservedN, /* pfnReserved2 = */ ExtPack::hlpReservedN, /* pfnReserved3 = */ ExtPack::hlpReservedN, @@ -757,7 +767,6 @@ HRESULT ExtPack::initWithDir(VBOXEXTPACKCTX a_enmContext, const char *a_pszName, /* pfnReserved6 = */ ExtPack::hlpReservedN, /* pfnReserved7 = */ ExtPack::hlpReservedN, /* pfnReserved8 = */ ExtPack::hlpReservedN, - /* pfnReserved9 = */ ExtPack::hlpReservedN, /* u32EndMarker = */ VBOXEXTPACKHLP_VERSION }; @@ -1106,6 +1115,28 @@ HRESULT ExtPack::getVrdpLibraryName(Utf8Str *a_pstrVrdeLibrary) } /** + * Resolves the path to the module. + * + * @returns S_OK or COM error status with error information. + * @param a_pszModuleName The library. + * @param a_pstrLibrary Where to return the path on success. + * + * @remarks Caller holds the extension manager lock for reading, no locking + * necessary. + */ +HRESULT ExtPack::getLibraryName(const char *a_pszModuleName, Utf8Str *a_pstrLibrary) +{ + HRESULT hrc; + if (findModule(a_pszModuleName, NULL, VBOXEXTPACKMODKIND_R3, + a_pstrLibrary, NULL /*a_pfNative*/, NULL /*a_pObjInfo*/)) + hrc = S_OK; + else + hrc = setError(E_FAIL, tr("Failed to locate the module '%s' in extension pack '%s'"), + a_pszModuleName, m->Desc.strName.c_str()); + return hrc; +} + +/** * Check if this extension pack wishes to be the default VRDE provider. * * @returns @c true if it wants to and it is in a usable state, otherwise @@ -1572,6 +1603,33 @@ ExtPack::hlpGetContext(PCVBOXEXTPACKHLP pHlp) } /*static*/ DECLCALLBACK(int) +ExtPack::hlpLoadHGCMService(PCVBOXEXTPACKHLP pHlp, VBOXEXTPACK_IF_CS(IConsole) *pConsole, + const char *pszServiceLibrary, const char *pszServiceName) +{ +#ifdef VBOX_COM_INPROC + /* + * Validate the input and get our bearings. + */ + AssertPtrReturn(pszServiceLibrary, VERR_INVALID_POINTER); + AssertPtrReturn(pszServiceName, VERR_INVALID_POINTER); + + AssertPtrReturn(pHlp, VERR_INVALID_POINTER); + AssertReturn(pHlp->u32Version == VBOXEXTPACKHLP_VERSION, VERR_INVALID_POINTER); + ExtPack::Data *m = RT_FROM_CPP_MEMBER(pHlp, Data, Hlp); + AssertPtrReturn(m, VERR_INVALID_POINTER); + ExtPack *pThis = m->pThis; + AssertPtrReturn(pThis, VERR_INVALID_POINTER); + AssertPtrReturn(pConsole, VERR_INVALID_POINTER); + + Console *pCon = (Console *)pConsole; + return pCon->hgcmLoadService(pszServiceLibrary, pszServiceName); +#else + NOREF(pHlp); NOREF(pConsole); NOREF(pszServiceLibrary); NOREF(pszServiceName); +#endif + return VERR_INVALID_STATE; +} + +/*static*/ DECLCALLBACK(int) ExtPack::hlpReservedN(PCVBOXEXTPACKHLP pHlp) { /* @@ -1883,7 +1941,9 @@ HRESULT ExtPackManager::initExtPackManager(VirtualBox *a_pVirtualBox, VBOXEXTPAC m = new Data; m->strBaseDir = szBaseDir; m->strCertificatDirPath = szCertificatDir; +#if !defined(VBOX_COM_INPROC) m->pVirtualBox = a_pVirtualBox; +#endif m->enmContext = a_enmContext; /* @@ -2034,6 +2094,7 @@ STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IEx CheckComArgOutPointerValid(a_ppExtPackFile); AssertReturn(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON, E_UNEXPECTED); +#if !defined(VBOX_COM_INPROC) /* The API can optionally take a ::SHA-256=<hex-digest> attribute at the end of the file name. This is just a temporary measure for backporting, in 4.2 we'll add another parameter to the method. */ @@ -2057,6 +2118,9 @@ STDMETHODIMP ExtPackManager::OpenExtPackFile(IN_BSTR a_bstrTarballAndDigest, IEx NewExtPackFile.queryInterfaceTo(a_ppExtPackFile); return hrc; +#else + return E_NOTIMPL; +#endif } STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval, IN_BSTR a_bstrDisplayInfo, @@ -2067,6 +2131,7 @@ STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval *a_ppProgress = NULL; Assert(m->enmContext == VBOXEXTPACKCTX_PER_USER_DAEMON); +#if !defined(VBOX_COM_INPROC) AutoCaller autoCaller(this); HRESULT hrc = autoCaller.rc(); if (SUCCEEDED(hrc)) @@ -2115,6 +2180,9 @@ STDMETHODIMP ExtPackManager::Uninstall(IN_BSTR a_bstrName, BOOL a_fForcedRemoval } return hrc; +#else + return E_NOTIMPL; +#endif } STDMETHODIMP ExtPackManager::Cleanup(void) @@ -2448,6 +2516,7 @@ void ExtPackManager::removeExtPack(const char *a_pszName) AssertMsgFailed(("%s\n", a_pszName)); } +#if !defined(VBOX_COM_INPROC) /** * Refreshes the specified extension pack. * @@ -2670,7 +2739,7 @@ HRESULT ExtPackManager::doInstall(ExtPackFile *a_pExtPackFile, bool a_fReplace, LogRel(("ExtPackManager: Successfully installed extension pack '%s'.\n", pStrName->c_str())); else { - LogRel(("ExtPackManager: Installated hook for '%s' failed: %Rrc - %s\n", + LogRel(("ExtPackManager: Installed hook for '%s' failed: %Rrc - %s\n", pStrName->c_str(), ErrInfo.Core.rc, ErrInfo.Core.pszMsg)); /* @@ -2848,6 +2917,7 @@ void ExtPackManager::callAllVirtualBoxReadyHooks(void) it++; } } +#endif /** * Calls the pfnConsoleReady hook for all working extension packs. @@ -2875,6 +2945,7 @@ void ExtPackManager::callAllConsoleReadyHooks(IConsole *a_pConsole) } } +#if !defined(VBOX_COM_INPROC) /** * Calls the pfnVMCreated hook for all working extension packs. * @@ -2893,6 +2964,7 @@ void ExtPackManager::callAllVmCreatedHooks(IMachine *a_pMachine) for (ExtPackList::iterator it = llExtPacks.begin(); it != llExtPacks.end(); it++) (*it)->callVmCreatedHook(m->pVirtualBox, a_pMachine, &autoLock); } +#endif /** * Calls the pfnVMConfigureVMM hook for all working extension packs. @@ -3028,6 +3100,33 @@ int ExtPackManager::getVrdeLibraryPathForExtPack(Utf8Str const *a_pstrExtPack, U } /** + * Gets the full path to the specified library of the specified extension pack. + * + * @returns S_OK if a path is returned, COM error status and message return if + * not. + * @param a_pszModuleName The library. + * @param a_pstrExtPack The extension pack. + * @param a_pstrVrdeLibrary Where to return the path. + */ +HRESULT ExtPackManager::getLibraryPathForExtPack(const char *a_pszModuleName, Utf8Str const *a_pstrExtPack, Utf8Str *a_pstrLibrary) +{ + AutoCaller autoCaller(this); + HRESULT hrc = autoCaller.rc(); + if (SUCCEEDED(hrc)) + { + AutoReadLock autoLock(this COMMA_LOCKVAL_SRC_POS); + + ExtPack *pExtPack = findExtPack(a_pstrExtPack->c_str()); + if (pExtPack) + hrc = pExtPack->getLibraryName(a_pszModuleName, a_pstrLibrary); + else + hrc = setError(VBOX_E_OBJECT_NOT_FOUND, tr("No extension pack by the name '%s' was found"), a_pstrExtPack->c_str()); + } + + return hrc; +} + +/** * Gets the name of the default VRDE extension pack. * * @returns S_OK or some COM error status on red tape failure. diff --git a/src/VBox/Main/src-all/ExtPackUtil.cpp b/src/VBox/Main/src-all/ExtPackUtil.cpp index c7a1dacb..3e7aaf92 100644 --- a/src/VBox/Main/src-all/ExtPackUtil.cpp +++ b/src/VBox/Main/src-all/ExtPackUtil.cpp @@ -322,7 +322,7 @@ RTCString *VBoxExtPackLoadDescFromVfsFile(RTVFSFILE hVfsFile, PVBOXEXTPACKDESC a if (RT_SUCCESS(rc)) { xml::XmlMemParser Parser; - RTCString strFileName = VBOX_EXTPACK_DESCRIPTION_NAME; + RTCString strFileName = VBOX_EXTPACK_DESCRIPTION_NAME; try { Parser.read(pvFile, cbFile, strFileName, Doc); diff --git a/src/VBox/Main/src-all/Global.cpp b/src/VBox/Main/src-all/Global.cpp index 6ae03726..fdfac74b 100644 --- a/src/VBox/Main/src-all/Global.cpp +++ b/src/VBox/Main/src-all/Global.cpp @@ -6,7 +6,7 @@ */ /* - * Copyright (C) 2008-2012 Oracle Corporation + * Copyright (C) 2008-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -26,13 +26,17 @@ /* static */ const Global::OSType Global::sOSTypes[] = { - /* NOTE1: we assume that unknown is always the first entry! + /* NOTE1: we assume that unknown is always the first two entries! * NOTE2: please use powers of 2 when specifying the size of harddisks since * '2GB' looks better than '1.95GB' (= 2000MB) */ { "Other", "Other", "Other", "Other/Unknown", VBOXOSTYPE_Unknown, VBOXOSHINT_NONE, 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, + { "Other", "Other", "Other_64", "Other/Unknown (64-bit)", + VBOXOSTYPE_Unknown_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC, + 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, + StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Windows", "Microsoft Windows", "Windows31", "Windows 3.1", VBOXOSTYPE_Win31, VBOXOSHINT_FLOPPY, 32, 4, 1 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, @@ -57,7 +61,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Win2k, VBOXOSHINT_USBTABLET, 168, 16, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Windows", "Microsoft Windows", "WindowsXP", "Windows XP", + { "Windows", "Microsoft Windows", "WindowsXP", "Windows XP (32 bit)", VBOXOSTYPE_WinXP, VBOXOSHINT_USBTABLET, 192, 16, 10 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -65,7 +69,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_WinXP_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 192, 16, 10 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Windows", "Microsoft Windows", "Windows2003", "Windows 2003", + { "Windows", "Microsoft Windows", "Windows2003", "Windows 2003 (32 bit)", VBOXOSTYPE_Win2k3, VBOXOSHINT_USBTABLET, 256, 16, 20 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -73,7 +77,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Win2k3_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 256, 16, 20 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_HDA }, - { "Windows", "Microsoft Windows", "WindowsVista", "Windows Vista", + { "Windows", "Microsoft Windows", "WindowsVista", "Windows Vista (32 bit)", VBOXOSTYPE_WinVista, VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, @@ -81,7 +85,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_WinVista_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, - { "Windows", "Microsoft Windows", "Windows2008", "Windows 2008", + { "Windows", "Microsoft Windows", "Windows2008", "Windows 2008 (32 bit)", VBOXOSTYPE_Win2k8, VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, @@ -89,7 +93,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Win2k8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, - { "Windows", "Microsoft Windows", "Windows7", "Windows 7", + { "Windows", "Microsoft Windows", "Windows7", "Windows 7 (32 bit)", VBOXOSTYPE_Win7, VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, @@ -97,7 +101,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Win7_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 512, 16, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, - { "Windows", "Microsoft Windows", "Windows8", "Windows 8", + { "Windows", "Microsoft Windows", "Windows8", "Windows 8 (32 bit)", VBOXOSTYPE_Win8, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET | VBOXOSHINT_PAE, 1024,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, @@ -105,19 +109,31 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Win8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, + { "Windows", "Microsoft Windows", "Windows81", "Windows 8.1 (32 bit)", + VBOXOSTYPE_Win8, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET | VBOXOSHINT_PAE, + 1024,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, + { "Windows", "Microsoft Windows", "Windows81_64", "Windows 8.1 (64 bit)", + VBOXOSTYPE_Win8_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, + 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, { "Windows", "Microsoft Windows", "Windows2012_64", "Windows 2012 (64 bit)", VBOXOSTYPE_Win2k12_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 2048,128, 25 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_HDA }, - { "Windows", "Microsoft Windows", "WindowsNT", "Other Windows", + { "Windows", "Microsoft Windows", "WindowsNT", "Other Windows (32 bit)", VBOXOSTYPE_WinNT, VBOXOSHINT_NONE, 512, 16, 20 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, + { "Windows", "Microsoft Windows", "WindowsNT_64", "Other Windows (64-bit)", + VBOXOSTYPE_WinNT_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, + 512, 16, 20 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Linux", "Linux", "Linux22", "Linux 2.2", VBOXOSTYPE_Linux22, VBOXOSHINT_RTCUTC, 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Linux24", "Linux 2.4", + { "Linux", "Linux", "Linux24", "Linux 2.4 (32 bit)", VBOXOSTYPE_Linux24, VBOXOSHINT_RTCUTC, 128, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -125,31 +141,31 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Linux24_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC, 128, 4, 4 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Linux26", "Linux 2.6", + { "Linux", "Linux", "Linux26", "Linux 2.6 / 3.x (32 bit)", VBOXOSTYPE_Linux26, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 4, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Linux26_64", "Linux 2.6 (64 bit)", + { "Linux", "Linux", "Linux26_64", "Linux 2.6 / 3.x (64 bit)", VBOXOSTYPE_Linux26_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 4, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "ArchLinux", "Arch Linux", + { "Linux", "Linux", "ArchLinux", "Arch Linux (32 bit)", VBOXOSTYPE_ArchLinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Linux", "Linux", "ArchLinux_64", "Arch Linux (64 bit)", VBOXOSTYPE_ArchLinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Debian", "Debian", + { "Linux", "Linux", "Debian", "Debian (32 bit)", VBOXOSTYPE_Debian, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Linux", "Linux", "Debian_64", "Debian (64 bit)", VBOXOSTYPE_Debian_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97}, - { "Linux", "Linux", "OpenSUSE", "openSUSE", + { "Linux", "Linux", "OpenSUSE", "openSUSE (32 bit)", VBOXOSTYPE_OpenSUSE, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -157,7 +173,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_OpenSUSE_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Fedora", "Fedora", + { "Linux", "Linux", "Fedora", "Fedora (32 bit)", VBOXOSTYPE_FedoraCore, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 768, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -165,15 +181,15 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_FedoraCore_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 768, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Gentoo", "Gentoo", + { "Linux", "Linux", "Gentoo", "Gentoo (32 bit)", VBOXOSTYPE_Gentoo, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Linux", "Linux", "Gentoo_64", "Gentoo (64 bit)", VBOXOSTYPE_Gentoo_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, - 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Mandriva", "Mandriva", + { "Linux", "Linux", "Mandriva", "Mandriva (32 bit)", VBOXOSTYPE_Mandriva, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -181,7 +197,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Mandriva_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "RedHat", "Red Hat", + { "Linux", "Linux", "RedHat", "Red Hat (32 bit)", VBOXOSTYPE_RedHat, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -189,7 +205,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_RedHat_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Turbolinux", "Turbolinux", + { "Linux", "Linux", "Turbolinux", "Turbolinux (32 bit)", VBOXOSTYPE_Turbolinux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -197,7 +213,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Turbolinux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 384, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Ubuntu", "Ubuntu", + { "Linux", "Linux", "Ubuntu", "Ubuntu (32 bit)", VBOXOSTYPE_Ubuntu, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -205,7 +221,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Ubuntu_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Xandros", "Xandros", + { "Linux", "Linux", "Xandros", "Xandros (32 bit)", VBOXOSTYPE_Xandros, VBOXOSHINT_RTCUTC, 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -213,7 +229,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Xandros_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC, 256, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Oracle", "Oracle", + { "Linux", "Linux", "Oracle", "Oracle (32 bit)", VBOXOSTYPE_Oracle, VBOXOSHINT_RTCUTC | VBOXOSHINT_PAE, 512, 12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -221,11 +237,15 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Oracle_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC, 512, 12, 12 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Linux", "Linux", "Linux", "Other Linux", + { "Linux", "Linux", "Linux", "Other Linux (32 bit)", VBOXOSTYPE_Linux, VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, 256, 12, 8 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Solaris", "Solaris", "Solaris", "Oracle Solaris 10 5/09 and earlier", + { "Linux", "Linux", "Linux_64", "Other Linux (64-bit)", + VBOXOSTYPE_Linux_x64, VBOXOSHINT_64BIT | VBOXOSHINT_PAE | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 512, 12, 8 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, + StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, + { "Solaris", "Solaris", "Solaris", "Oracle Solaris 10 5/09 and earlier (32 bit)", VBOXOSTYPE_Solaris, VBOXOSHINT_NONE, 768, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -233,7 +253,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Solaris_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC, 1536, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "Solaris", "Solaris", "OpenSolaris", "Oracle Solaris 10 10/09 and later", + { "Solaris", "Solaris", "OpenSolaris", "Oracle Solaris 10 10/09 and later (32 bit)", VBOXOSTYPE_OpenSolaris, VBOXOSHINT_USBTABLET, 768, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -245,7 +265,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_Solaris11_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_USBTABLET, 1536, 12, 16 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "BSD", "BSD", "FreeBSD", "FreeBSD", + { "BSD", "BSD", "FreeBSD", "FreeBSD (32 bit)", VBOXOSTYPE_FreeBSD, VBOXOSHINT_NONE, 128, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -253,7 +273,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_FreeBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC, 128, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "BSD", "BSD", "OpenBSD", "OpenBSD", + { "BSD", "BSD", "OpenBSD", "OpenBSD (32 bit)", VBOXOSTYPE_OpenBSD, VBOXOSHINT_HWVIRTEX, 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -261,7 +281,7 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_OpenBSD_x64, VBOXOSHINT_64BIT | VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC, 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, - { "BSD", "BSD", "NetBSD", "NetBSD", + { "BSD", "BSD", "NetBSD", "NetBSD (32 bit)", VBOXOSTYPE_NetBSD, VBOXOSHINT_NONE, 64, 4, 2 * _1G64, NetworkAdapterType_I82540EM, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, @@ -289,15 +309,47 @@ const Global::OSType Global::sOSTypes[] = VBOXOSTYPE_OS2, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB, 96, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 1, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_SB16 }, - { "MacOS", "Mac OS X", "MacOS", "Mac OS X", - VBOXOSTYPE_MacOS, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET, - 2048, 4, 20 * _1G64, NetworkAdapterType_I82543GC, 0, - StorageControllerType_ICH6, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, + { "MacOS", "Mac OS X", "MacOS", "Mac OS X (32 bit)", + VBOXOSTYPE_MacOS, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_ICH9, AudioControllerType_HDA }, { "MacOS", "Mac OS X", "MacOS_64", "Mac OS X (64 bit)", - VBOXOSTYPE_MacOS_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_USBTABLET, - 2048, 4, 20 * _1G64, NetworkAdapterType_I82543GC, 0, - StorageControllerType_ICH6, StorageBus_IDE, StorageControllerType_IntelAhci, StorageBus_SATA, + VBOXOSTYPE_MacOS_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, + ChipsetType_ICH9, AudioControllerType_HDA }, + { "MacOS", "Mac OS X", "MacOS106", "Mac OS X 10.6 Snow Leopard (32 bit)", + VBOXOSTYPE_MacOS106, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, + ChipsetType_ICH9, AudioControllerType_HDA }, + { "MacOS", "Mac OS X", "MacOS106_64", "Mac OS X 10.6 Snow Leopard (64 bit)", + VBOXOSTYPE_MacOS106_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, + ChipsetType_ICH9, AudioControllerType_HDA }, + { "MacOS", "Mac OS X", "MacOS107_64", "Mac OS X 10.7 Lion (64 bit)", + VBOXOSTYPE_MacOS107_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, + ChipsetType_ICH9, AudioControllerType_HDA }, + { "MacOS", "Mac OS X", "MacOS108_64", "Mac OS X 10.8 Mountain Lion (64 bit)", /* Aka "Mountain Kitten". */ + VBOXOSTYPE_MacOS108_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, + ChipsetType_ICH9, AudioControllerType_HDA }, + { "MacOS", "Mac OS X", "MacOS109_64", "Mac OS X 10.9 Mavericks (64 bit)", /* Not to be confused with McCain. */ + VBOXOSTYPE_MacOS109_x64, VBOXOSHINT_HWVIRTEX | VBOXOSHINT_IOAPIC | VBOXOSHINT_EFI | VBOXOSHINT_PAE | VBOXOSHINT_64BIT + | VBOXOSHINT_USBHID | VBOXOSHINT_HPET | VBOXOSHINT_RTCUTC | VBOXOSHINT_USBTABLET, + 2048, 4, 20 * _1G64, NetworkAdapterType_I82545EM, 0, + StorageControllerType_IntelAhci, StorageBus_SATA, StorageControllerType_IntelAhci, StorageBus_SATA, ChipsetType_ICH9, AudioControllerType_HDA }, { "Other", "Other", "DOS", "DOS", VBOXOSTYPE_DOS, VBOXOSHINT_FLOPPY | VBOXOSHINT_NOUSB, @@ -312,7 +364,11 @@ const Global::OSType Global::sOSTypes[] = 64, 4, 2 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Other", "Other", "QNX", "QNX", +#ifdef VBOX_WITH_RAW_RING1 + VBOXOSTYPE_QNX, VBOXOSHINT_NONE, +#else VBOXOSTYPE_QNX, VBOXOSHINT_HWVIRTEX, +#endif 512, 4, 4 * _1G64, NetworkAdapterType_Am79C973, 0, StorageControllerType_PIIX4, StorageBus_IDE, StorageControllerType_PIIX4, StorageBus_IDE, ChipsetType_PIIX3, AudioControllerType_AC97 }, { "Other", "Other", "JRockitVE", "JRockitVE", @@ -434,6 +490,26 @@ Global::stringifyDeviceType(DeviceType_T aType) } } + +/*static*/ const char * +Global::stringifyReason(Reason_T aReason) +{ + switch (aReason) + { + case Reason_Unspecified: return "unspecified"; + case Reason_HostSuspend: return "host suspend"; + case Reason_HostResume: return "host resume"; + case Reason_HostBatteryLow: return "host battery low"; + default: + { + AssertMsgFailed(("%d (%#x)\n", aReason, aReason)); + static char s_szMsg[48]; + RTStrPrintf(s_szMsg, sizeof(s_szMsg), "invalid reason %#010x\n", aReason); + return s_szMsg; + } + } +} + /*static*/ int Global::vboxStatusCodeFromCOM(HRESULT aComStatus) { diff --git a/src/VBox/Main/src-all/Logging.cpp b/src/VBox/Main/src-all/Logging.cpp index 5b4095e6..21f9de65 100644 --- a/src/VBox/Main/src-all/Logging.cpp +++ b/src/VBox/Main/src-all/Logging.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2007 Oracle Corporation + * Copyright (C) 2006-2010 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/src-all/ProgressImpl.cpp b/src/VBox/Main/src-all/ProgressImpl.cpp index 3d78b2bc..fa3ecea8 100644 --- a/src/VBox/Main/src-all/ProgressImpl.cpp +++ b/src/VBox/Main/src-all/ProgressImpl.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2006-2012 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -18,15 +18,18 @@ #include <iprt/types.h> + #if defined(VBOX_WITH_XPCOM) #include <nsIServiceManager.h> #include <nsIExceptionService.h> #include <nsCOMPtr.h> #endif /* defined(VBOX_WITH_XPCOM) */ -#include "ProgressCombinedImpl.h" +#include "ProgressImpl.h" -#include "VirtualBoxImpl.h" +#if !defined(VBOX_COM_INPROC) +# include "VirtualBoxImpl.h" +#endif #include "VirtualBoxErrorInfoImpl.h" #include "Logging.h" @@ -36,181 +39,25 @@ #include <iprt/cpp/utils.h> #include <VBox/err.h> +#include "AutoCaller.h" -//////////////////////////////////////////////////////////////////////////////// -// ProgressBase class -//////////////////////////////////////////////////////////////////////////////// -// constructor / destructor -//////////////////////////////////////////////////////////////////////////////// - -ProgressBase::ProgressBase() +Progress::Progress() #if !defined(VBOX_COM_INPROC) : mParent(NULL) #endif { } -ProgressBase::~ProgressBase() +Progress::~Progress() { } -/** - * Subclasses must call this method from their FinalConstruct() implementations. - */ -HRESULT ProgressBase::FinalConstruct() -{ - mCancelable = FALSE; - mCompleted = FALSE; - mCanceled = FALSE; - mResultCode = S_OK; - - m_cOperations - = m_ulTotalOperationsWeight - = m_ulOperationsCompletedWeight - = m_ulCurrentOperation - = m_ulCurrentOperationWeight - = m_ulOperationPercent - = m_cMsTimeout - = 0; - - // get creation timestamp - m_ullTimestamp = RTTimeMilliTS(); - - m_pfnCancelCallback = NULL; - m_pvCancelUserArg = NULL; - - return BaseFinalConstruct(); -} - -// protected initializer/uninitializer for internal purposes only -//////////////////////////////////////////////////////////////////////////////// - -/** - * Initializes the progress base object. - * - * Subclasses should call this or any other #protectedInit() method from their - * init() implementations. - * - * @param aAutoInitSpan AutoInitSpan object instantiated by a subclass. - * @param aParent Parent object (only for server-side Progress objects). - * @param aInitiator Initiator of the task (for server-side objects. Can be - * NULL which means initiator = parent, otherwise must not - * be NULL). - * @param aDescription ask description. - * @param aID Address of result GUID structure (optional). - * - * @return COM result indicator. - */ -HRESULT ProgressBase::protectedInit(AutoInitSpan &aAutoInitSpan, -#if !defined(VBOX_COM_INPROC) - VirtualBox *aParent, -#endif - IUnknown *aInitiator, - CBSTR aDescription, - OUT_GUID aId /* = NULL */) -{ - /* Guarantees subclasses call this method at the proper time */ - NOREF(aAutoInitSpan); - - AutoCaller autoCaller(this); - AssertReturn(autoCaller.state() == InInit, E_FAIL); - -#if !defined(VBOX_COM_INPROC) - AssertReturn(aParent, E_INVALIDARG); -#else - AssertReturn(aInitiator, E_INVALIDARG); -#endif - - AssertReturn(aDescription, E_INVALIDARG); - -#if !defined(VBOX_COM_INPROC) - /* share parent weakly */ - unconst(mParent) = aParent; -#endif - -#if !defined(VBOX_COM_INPROC) - /* assign (and therefore addref) initiator only if it is not VirtualBox - * (to avoid cycling); otherwise mInitiator will remain null which means - * that it is the same as the parent */ - if (aInitiator) - { - ComObjPtr<VirtualBox> pVirtualBox(mParent); - if (!(pVirtualBox == aInitiator)) - unconst(mInitiator) = aInitiator; - } -#else - unconst(mInitiator) = aInitiator; -#endif - - unconst(mId).create(); - if (aId) - mId.cloneTo(aId); - -#if !defined(VBOX_COM_INPROC) - /* add to the global collection of progress operations (note: after - * creating mId) */ - mParent->addProgress(this); -#endif - - unconst(mDescription) = aDescription; - - return S_OK; -} - -/** - * Initializes the progress base object. - * - * This is a special initializer that doesn't initialize any field. Used by one - * of the Progress::init() forms to create sub-progress operations combined - * together using a CombinedProgress instance, so it doesn't require the parent, - * initiator, description and doesn't create an ID. - * - * Subclasses should call this or any other #protectedInit() method from their - * init() implementations. - * - * @param aAutoInitSpan AutoInitSpan object instantiated by a subclass. - */ -HRESULT ProgressBase::protectedInit(AutoInitSpan &aAutoInitSpan) -{ - /* Guarantees subclasses call this method at the proper time */ - NOREF(aAutoInitSpan); - - return S_OK; -} - -/** - * Uninitializes the instance. - * - * Subclasses should call this from their uninit() implementations. - * - * @param aAutoUninitSpan AutoUninitSpan object instantiated by a subclass. - * - * @note Using the mParent member after this method returns is forbidden. - */ -void ProgressBase::protectedUninit(AutoUninitSpan &aAutoUninitSpan) -{ - /* release initiator (effective only if mInitiator has been assigned in - * init()) */ - unconst(mInitiator).setNull(); - -#if !defined(VBOX_COM_INPROC) - if (mParent) - { - /* remove the added progress on failure to complete the initialization */ - if (aAutoUninitSpan.initFailed() && !mId.isEmpty()) - mParent->removeProgress(mId.ref()); - - unconst(mParent) = NULL; - } -#endif -} - // IProgress properties ///////////////////////////////////////////////////////////////////////////// -STDMETHODIMP ProgressBase::COMGETTER(Id)(BSTR *aId) +STDMETHODIMP Progress::COMGETTER(Id)(BSTR *aId) { CheckComArgOutPointerValid(aId); @@ -223,7 +70,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Id)(BSTR *aId) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Description)(BSTR *aDescription) +STDMETHODIMP Progress::COMGETTER(Description)(BSTR *aDescription) { CheckComArgOutPointerValid(aDescription); @@ -236,7 +83,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Description)(BSTR *aDescription) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Initiator)(IUnknown **aInitiator) +STDMETHODIMP Progress::COMGETTER(Initiator)(IUnknown **aInitiator) { CheckComArgOutPointerValid(aInitiator); @@ -260,7 +107,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Initiator)(IUnknown **aInitiator) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Cancelable)(BOOL *aCancelable) +STDMETHODIMP Progress::COMGETTER(Cancelable)(BOOL *aCancelable) { CheckComArgOutPointerValid(aCancelable); @@ -283,7 +130,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Cancelable)(BOOL *aCancelable) * * @return fractional percentage as a double value. */ -double ProgressBase::calcTotalPercent() +double Progress::calcTotalPercent() { // avoid division by zero if (m_ulTotalOperationsWeight == 0) @@ -301,7 +148,7 @@ double ProgressBase::calcTotalPercent() * * The caller should hold the object write lock. */ -void ProgressBase::checkForAutomaticTimeout(void) +void Progress::checkForAutomaticTimeout(void) { if ( m_cMsTimeout && mCancelable @@ -312,7 +159,7 @@ void ProgressBase::checkForAutomaticTimeout(void) } -STDMETHODIMP ProgressBase::COMGETTER(TimeRemaining)(LONG *aTimeRemaining) +STDMETHODIMP Progress::COMGETTER(TimeRemaining)(LONG *aTimeRemaining) { CheckComArgOutPointerValid(aTimeRemaining); @@ -335,7 +182,7 @@ STDMETHODIMP ProgressBase::COMGETTER(TimeRemaining)(LONG *aTimeRemaining) uint64_t ullTimeTotal = (uint64_t)(ullTimeElapsed * 100 / dPercentDone); uint64_t ullTimeRemaining = ullTimeTotal - ullTimeElapsed; -// Log(("ProgressBase::GetTimeRemaining: dPercentDone %RI32, ullTimeNow = %RI64, ullTimeElapsed = %RI64, ullTimeTotal = %RI64, ullTimeRemaining = %RI64\n", +// Log(("Progress::GetTimeRemaining: dPercentDone %RI32, ullTimeNow = %RI64, ullTimeElapsed = %RI64, ullTimeTotal = %RI64, ullTimeRemaining = %RI64\n", // (uint32_t)dPercentDone, ullTimeNow, ullTimeElapsed, ullTimeTotal, ullTimeRemaining)); *aTimeRemaining = (LONG)(ullTimeRemaining / 1000); @@ -345,7 +192,7 @@ STDMETHODIMP ProgressBase::COMGETTER(TimeRemaining)(LONG *aTimeRemaining) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Percent)(ULONG *aPercent) +STDMETHODIMP Progress::COMGETTER(Percent)(ULONG *aPercent) { CheckComArgOutPointerValid(aPercent); @@ -378,7 +225,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Percent)(ULONG *aPercent) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Completed)(BOOL *aCompleted) +STDMETHODIMP Progress::COMGETTER(Completed)(BOOL *aCompleted) { CheckComArgOutPointerValid(aCompleted); @@ -392,7 +239,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Completed)(BOOL *aCompleted) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Canceled)(BOOL *aCanceled) +STDMETHODIMP Progress::COMGETTER(Canceled)(BOOL *aCanceled) { CheckComArgOutPointerValid(aCanceled); @@ -406,7 +253,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Canceled)(BOOL *aCanceled) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(ResultCode)(LONG *aResultCode) +STDMETHODIMP Progress::COMGETTER(ResultCode)(LONG *aResultCode) { CheckComArgOutPointerValid(aResultCode); @@ -424,7 +271,7 @@ STDMETHODIMP ProgressBase::COMGETTER(ResultCode)(LONG *aResultCode) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **aErrorInfo) +STDMETHODIMP Progress::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **aErrorInfo) { CheckComArgOutPointerValid(aErrorInfo); @@ -442,7 +289,7 @@ STDMETHODIMP ProgressBase::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **aErrorInf return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(OperationCount)(ULONG *aOperationCount) +STDMETHODIMP Progress::COMGETTER(OperationCount)(ULONG *aOperationCount) { CheckComArgOutPointerValid(aOperationCount); @@ -456,7 +303,7 @@ STDMETHODIMP ProgressBase::COMGETTER(OperationCount)(ULONG *aOperationCount) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Operation)(ULONG *aOperation) +STDMETHODIMP Progress::COMGETTER(Operation)(ULONG *aOperation) { CheckComArgOutPointerValid(aOperation); @@ -470,7 +317,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Operation)(ULONG *aOperation) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(OperationDescription)(BSTR *aOperationDescription) +STDMETHODIMP Progress::COMGETTER(OperationDescription)(BSTR *aOperationDescription) { CheckComArgOutPointerValid(aOperationDescription); @@ -484,7 +331,7 @@ STDMETHODIMP ProgressBase::COMGETTER(OperationDescription)(BSTR *aOperationDescr return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(OperationPercent)(ULONG *aOperationPercent) +STDMETHODIMP Progress::COMGETTER(OperationPercent)(ULONG *aOperationPercent) { CheckComArgOutPointerValid(aOperationPercent); @@ -501,7 +348,7 @@ STDMETHODIMP ProgressBase::COMGETTER(OperationPercent)(ULONG *aOperationPercent) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(OperationWeight)(ULONG *aOperationWeight) +STDMETHODIMP Progress::COMGETTER(OperationWeight)(ULONG *aOperationWeight) { CheckComArgOutPointerValid(aOperationWeight); @@ -515,7 +362,7 @@ STDMETHODIMP ProgressBase::COMGETTER(OperationWeight)(ULONG *aOperationWeight) return S_OK; } -STDMETHODIMP ProgressBase::COMSETTER(Timeout)(ULONG aTimeout) +STDMETHODIMP Progress::COMSETTER(Timeout)(ULONG aTimeout) { AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); @@ -531,7 +378,7 @@ STDMETHODIMP ProgressBase::COMSETTER(Timeout)(ULONG aTimeout) return S_OK; } -STDMETHODIMP ProgressBase::COMGETTER(Timeout)(ULONG *aTimeout) +STDMETHODIMP Progress::COMGETTER(Timeout)(ULONG *aTimeout) { CheckComArgOutPointerValid(aTimeout); @@ -558,7 +405,7 @@ STDMETHODIMP ProgressBase::COMGETTER(Timeout)(ULONG *aTimeout) * @param pfnCallback The function to be called upon cancelation. * @param pvUser The callback argument. */ -bool ProgressBase::setCancelCallback(void (*pfnCallback)(void *), void *pvUser) +bool Progress::setCancelCallback(void (*pfnCallback)(void *), void *pvUser) { AutoCaller autoCaller(this); AssertComRCReturn(autoCaller.rc(), false); @@ -574,13 +421,29 @@ bool ProgressBase::setCancelCallback(void (*pfnCallback)(void *), void *pvUser) return true; } -//////////////////////////////////////////////////////////////////////////////// -// Progress class -//////////////////////////////////////////////////////////////////////////////// - HRESULT Progress::FinalConstruct() { - HRESULT rc = ProgressBase::FinalConstruct(); + mCancelable = FALSE; + mCompleted = FALSE; + mCanceled = FALSE; + mResultCode = S_OK; + + m_cOperations + = m_ulTotalOperationsWeight + = m_ulOperationsCompletedWeight + = m_ulCurrentOperation + = m_ulCurrentOperationWeight + = m_ulOperationPercent + = m_cMsTimeout + = 0; + + // get creation timestamp + m_ullTimestamp = RTTimeMilliTS(); + + m_pfnCancelCallback = NULL; + m_pvCancelUserArg = NULL; + + HRESULT rc = Progress::BaseFinalConstruct(); if (FAILED(rc)) return rc; mCompletedSem = NIL_RTSEMEVENTMULTI; @@ -636,16 +499,16 @@ void Progress::FinalRelease() * Even simpler, if you need no sub-operations at all, pass in cOperations = * ulTotalOperationsWeight = ulFirstOperationWeight = 1. * - * @param aParent See ProgressBase::init(). - * @param aInitiator See ProgressBase::init(). - * @param aDescription See ProgressBase::init(). + * @param aParent See Progress::init(). + * @param aInitiator See Progress::init(). + * @param aDescription See Progress::init(). * @param aCancelable Flag whether the task maybe canceled. * @param cOperations Number of operations within this task (at least 1). * @param ulTotalOperationsWeight Total weight of operations; must be the sum of ulFirstOperationWeight and * what is later passed with each subsequent setNextOperation() call. * @param bstrFirstOperationDescription Description of the first operation. * @param ulFirstOperationWeight Weight of first sub-operation. - * @param aId See ProgressBase::init(). + * @param aId See Progress::init(). */ HRESULT Progress::init( #if !defined(VBOX_COM_INPROC) @@ -676,11 +539,55 @@ HRESULT Progress::init( HRESULT rc = S_OK; - rc = ProgressBase::protectedInit(autoInitSpan, +// rc = Progress::init( +//#if !defined(VBOX_COM_INPROC) +// aParent, +//#endif +// aInitiator, aDescription, FALSE, aId); +// NA #if !defined(VBOX_COM_INPROC) - aParent, + AssertReturn(aParent, E_INVALIDARG); +#else + AssertReturn(aInitiator, E_INVALIDARG); +#endif + + AssertReturn(aDescription, E_INVALIDARG); + +#if !defined(VBOX_COM_INPROC) + /* share parent weakly */ + unconst(mParent) = aParent; #endif - aInitiator, aDescription, aId); + +#if !defined(VBOX_COM_INPROC) + /* assign (and therefore addref) initiator only if it is not VirtualBox + * * (to avoid cycling); otherwise mInitiator will remain null which means + * * that it is the same as the parent */ + if (aInitiator) + { + ComObjPtr<VirtualBox> pVirtualBox(mParent); + if (!(pVirtualBox == aInitiator)) + unconst(mInitiator) = aInitiator; + } +#else + unconst(mInitiator) = aInitiator; +#endif + + unconst(mId).create(); + if (aId) + mId.cloneTo(aId); + +#if !defined(VBOX_COM_INPROC) + /* add to the global collection of progress operations (note: after + * * creating mId) */ + mParent->addProgress(this); +#endif + + unconst(mDescription) = aDescription; + + +// end of assertion + + if (FAILED(rc)) return rc; mCancelable = aCancelable; @@ -710,7 +617,7 @@ HRESULT Progress::init( * the whole task. * * Objects initialized with this method are then combined together into the - * single task using a CombinedProgress instance, so it doesn't require the + * single task using a Progress instance, so it doesn't require the * parent, initiator, description and doesn't create an ID. Note that calling * respective getter methods on an object initialized with this method is * useless. Such objects are used only to provide a separate wait semaphore and @@ -731,8 +638,9 @@ HRESULT Progress::init(BOOL aCancelable, AssertReturn(autoInitSpan.isOk(), E_FAIL); HRESULT rc = S_OK; + /* Guarantees subclasses call this method at the proper time */ + NOREF(autoInitSpan); - rc = ProgressBase::protectedInit(autoInitSpan); if (FAILED(rc)) return rc; mCancelable = aCancelable; @@ -759,6 +667,7 @@ HRESULT Progress::init(BOOL aCancelable, return rc; } + /** * Uninitializes the instance and sets the ready flag to FALSE. * @@ -783,9 +692,23 @@ void Progress::uninit() RTSemEventMultiDestroy(mCompletedSem); - ProgressBase::protectedUninit(autoUninitSpan); + /* release initiator (effective only if mInitiator has been assigned in + * * init()) */ + unconst(mInitiator).setNull(); + +#if !defined(VBOX_COM_INPROC) + if (mParent) + { + /* remove the added progress on failure to complete the initialization */ + if (autoUninitSpan.initFailed() && mId.isValid() && !mId.isZero()) + mParent->removeProgress(mId.ref()); + + unconst(mParent) = NULL; + } +#endif } + // IProgress properties ///////////////////////////////////////////////////////////////////////////// @@ -962,7 +885,7 @@ STDMETHODIMP Progress::WaitForAsyncProgressCompletion(IProgress *pProgressAsync) * in the meantime more than one async operation was finished. So we * have to loop as long as we reached the same operation count. */ ULONG curOp; - for(;;) + for (;;) { rc = pProgressAsync->COMGETTER(Operation(&curOp)); if (FAILED(rc)) return rc; @@ -1321,571 +1244,3 @@ bool Progress::notifyPointOfNoReturn(void) return true; } -//////////////////////////////////////////////////////////////////////////////// -// CombinedProgress class -//////////////////////////////////////////////////////////////////////////////// - -HRESULT CombinedProgress::FinalConstruct() -{ - HRESULT rc = ProgressBase::FinalConstruct(); - if (FAILED(rc)) return rc; - - mProgress = 0; - mCompletedOperations = 0; - - return BaseFinalConstruct(); -} - -void CombinedProgress::FinalRelease() -{ - uninit(); - BaseFinalRelease(); -} - -// public initializer/uninitializer for internal purposes only -//////////////////////////////////////////////////////////////////////////////// - -/** - * Initializes this object based on individual combined progresses. - * Must be called only from #init()! - * - * @param aAutoInitSpan AutoInitSpan object instantiated by a subclass. - * @param aParent See ProgressBase::init(). - * @param aInitiator See ProgressBase::init(). - * @param aDescription See ProgressBase::init(). - * @param aId See ProgressBase::init(). - */ -HRESULT CombinedProgress::protectedInit(AutoInitSpan &aAutoInitSpan, -#if !defined(VBOX_COM_INPROC) - VirtualBox *aParent, -#endif - IUnknown *aInitiator, - CBSTR aDescription, OUT_GUID aId) -{ - LogFlowThisFunc(("aDescription={%ls} mProgresses.size()=%d\n", - aDescription, mProgresses.size())); - - HRESULT rc = S_OK; - - rc = ProgressBase::protectedInit(aAutoInitSpan, -#if !defined(VBOX_COM_INPROC) - aParent, -#endif - aInitiator, aDescription, aId); - if (FAILED(rc)) return rc; - - mProgress = 0; /* the first object */ - mCompletedOperations = 0; - - mCompleted = FALSE; - mCancelable = TRUE; /* until any progress returns FALSE */ - mCanceled = FALSE; - - m_cOperations = 0; /* will be calculated later */ - - m_ulCurrentOperation = 0; - rc = mProgresses[0]->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam()); - if (FAILED(rc)) return rc; - - for (size_t i = 0; i < mProgresses.size(); i ++) - { - if (mCancelable) - { - BOOL cancelable = FALSE; - rc = mProgresses[i]->COMGETTER(Cancelable)(&cancelable); - if (FAILED(rc)) return rc; - - if (!cancelable) - mCancelable = FALSE; - } - - { - ULONG opCount = 0; - rc = mProgresses[i]->COMGETTER(OperationCount)(&opCount); - if (FAILED(rc)) return rc; - - m_cOperations += opCount; - } - } - - rc = checkProgress(); - if (FAILED(rc)) return rc; - - return rc; -} - -/** - * Initializes the combined progress object given two normal progress - * objects. - * - * @param aParent See ProgressBase::init(). - * @param aInitiator See ProgressBase::init(). - * @param aDescription See ProgressBase::init(). - * @param aProgress1 First normal progress object. - * @param aProgress2 Second normal progress object. - * @param aId See ProgressBase::init(). - */ -HRESULT CombinedProgress::init( -#if !defined(VBOX_COM_INPROC) - VirtualBox *aParent, -#endif - IUnknown *aInitiator, - CBSTR aDescription, - IProgress *aProgress1, - IProgress *aProgress2, - OUT_GUID aId /* = NULL */) -{ - /* Enclose the state transition NotReady->InInit->Ready */ - AutoInitSpan autoInitSpan(this); - AssertReturn(autoInitSpan.isOk(), E_FAIL); - - mProgresses.resize(2); - mProgresses[0] = aProgress1; - mProgresses[1] = aProgress2; - - HRESULT rc = protectedInit(autoInitSpan, -#if !defined(VBOX_COM_INPROC) - aParent, -#endif - aInitiator, - aDescription, - aId); - - /* Confirm a successful initialization when it's the case */ - if (SUCCEEDED(rc)) - autoInitSpan.setSucceeded(); - - return rc; -} - -/** - * Uninitializes the instance and sets the ready flag to FALSE. - * - * Called either from FinalRelease() or by the parent when it gets destroyed. - */ -void CombinedProgress::uninit() -{ - LogFlowThisFunc(("\n")); - - /* Enclose the state transition Ready->InUninit->NotReady */ - AutoUninitSpan autoUninitSpan(this); - if (autoUninitSpan.uninitDone()) - return; - - mProgress = 0; - mProgresses.clear(); - - ProgressBase::protectedUninit(autoUninitSpan); -} - -// IProgress properties -//////////////////////////////////////////////////////////////////////////////// - -STDMETHODIMP CombinedProgress::COMGETTER(Percent)(ULONG *aPercent) -{ - CheckComArgOutPointerValid(aPercent); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - if (mCompleted && SUCCEEDED(mResultCode)) - *aPercent = 100; - else - { - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - /* global percent = - * (100 / m_cOperations) * mOperation + - * ((100 / m_cOperations) / 100) * m_ulOperationPercent */ - *aPercent = (100 * m_ulCurrentOperation + m_ulOperationPercent) / m_cOperations; - } - - return S_OK; -} - -STDMETHODIMP CombinedProgress::COMGETTER(Completed)(BOOL *aCompleted) -{ - CheckComArgOutPointerValid(aCompleted); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(Completed)(aCompleted); -} - -STDMETHODIMP CombinedProgress::COMGETTER(Canceled)(BOOL *aCanceled) -{ - CheckComArgOutPointerValid(aCanceled); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(Canceled)(aCanceled); -} - -STDMETHODIMP CombinedProgress::COMGETTER(ResultCode)(LONG *aResultCode) -{ - CheckComArgOutPointerValid(aResultCode); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(ResultCode)(aResultCode); -} - -STDMETHODIMP CombinedProgress::COMGETTER(ErrorInfo)(IVirtualBoxErrorInfo **aErrorInfo) -{ - CheckComArgOutPointerValid(aErrorInfo); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(ErrorInfo)(aErrorInfo); -} - -STDMETHODIMP CombinedProgress::COMGETTER(Operation)(ULONG *aOperation) -{ - CheckComArgOutPointerValid(aOperation); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(Operation)(aOperation); -} - -STDMETHODIMP CombinedProgress::COMGETTER(OperationDescription)(BSTR *aOperationDescription) -{ - CheckComArgOutPointerValid(aOperationDescription); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(OperationDescription)(aOperationDescription); -} - -STDMETHODIMP CombinedProgress::COMGETTER(OperationPercent)(ULONG *aOperationPercent) -{ - CheckComArgOutPointerValid(aOperationPercent); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - /* checkProgress needs a write lock */ - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - HRESULT rc = checkProgress(); - if (FAILED(rc)) return rc; - - return ProgressBase::COMGETTER(OperationPercent)(aOperationPercent); -} - -STDMETHODIMP CombinedProgress::COMSETTER(Timeout)(ULONG aTimeout) -{ - NOREF(aTimeout); - AssertFailed(); - return E_NOTIMPL; -} - -STDMETHODIMP CombinedProgress::COMGETTER(Timeout)(ULONG *aTimeout) -{ - CheckComArgOutPointerValid(aTimeout); - - AssertFailed(); - return E_NOTIMPL; -} - -// IProgress methods -///////////////////////////////////////////////////////////////////////////// - -/** - * @note XPCOM: when this method is called not on the main XPCOM thread, it - * simply blocks the thread until mCompletedSem is signalled. If the - * thread has its own event queue (hmm, what for?) that it must run, then - * calling this method will definitely freeze event processing. - */ -STDMETHODIMP CombinedProgress::WaitForCompletion(LONG aTimeout) -{ - LogFlowThisFuncEnter(); - LogFlowThisFunc(("aTtimeout=%d\n", aTimeout)); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - /* if we're already completed, take a shortcut */ - if (!mCompleted) - { - HRESULT rc = S_OK; - bool forever = aTimeout < 0; - int64_t timeLeft = aTimeout; - int64_t lastTime = RTTimeMilliTS(); - - while (!mCompleted && (forever || timeLeft > 0)) - { - alock.release(); - rc = mProgresses.back()->WaitForCompletion(forever ? -1 : (LONG) timeLeft); - alock.acquire(); - - if (SUCCEEDED(rc)) - rc = checkProgress(); - - if (FAILED(rc)) break; - - if (!forever) - { - int64_t now = RTTimeMilliTS(); - timeLeft -= now - lastTime; - lastTime = now; - } - } - - if (FAILED(rc)) return rc; - } - - LogFlowThisFuncLeave(); - - return S_OK; -} - -/** - * @note XPCOM: when this method is called not on the main XPCOM thread, it - * simply blocks the thread until mCompletedSem is signalled. If the - * thread has its own event queue (hmm, what for?) that it must run, then - * calling this method will definitely freeze event processing. - */ -STDMETHODIMP CombinedProgress::WaitForOperationCompletion(ULONG aOperation, LONG aTimeout) -{ - LogFlowThisFuncEnter(); - LogFlowThisFunc(("aOperation=%d, aTimeout=%d\n", aOperation, aTimeout)); - - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - if (aOperation >= m_cOperations) - return setError(E_FAIL, - tr("Operation number must be in range [0, %d]"), m_ulCurrentOperation - 1); - - /* if we're already completed or if the given operation is already done, - * then take a shortcut */ - if (!mCompleted && aOperation >= m_ulCurrentOperation) - { - HRESULT rc = S_OK; - - /* find the right progress object to wait for */ - size_t progress = mProgress; - ULONG operation = 0, completedOps = mCompletedOperations; - do - { - ULONG opCount = 0; - rc = mProgresses[progress]->COMGETTER(OperationCount)(&opCount); - if (FAILED(rc)) - return rc; - - if (completedOps + opCount > aOperation) - { - /* found the right progress object */ - operation = aOperation - completedOps; - break; - } - - completedOps += opCount; - progress ++; - ComAssertRet(progress < mProgresses.size(), E_FAIL); - } - while (1); - - LogFlowThisFunc(("will wait for mProgresses [%d] (%d)\n", - progress, operation)); - - bool forever = aTimeout < 0; - int64_t timeLeft = aTimeout; - int64_t lastTime = RTTimeMilliTS(); - - while (!mCompleted && aOperation >= m_ulCurrentOperation && - (forever || timeLeft > 0)) - { - alock.release(); - /* wait for the appropriate progress operation completion */ - rc = mProgresses[progress]-> WaitForOperationCompletion(operation, - forever ? -1 : (LONG) timeLeft); - alock.acquire(); - - if (SUCCEEDED(rc)) - rc = checkProgress(); - - if (FAILED(rc)) break; - - if (!forever) - { - int64_t now = RTTimeMilliTS(); - timeLeft -= now - lastTime; - lastTime = now; - } - } - - if (FAILED(rc)) return rc; - } - - LogFlowThisFuncLeave(); - - return S_OK; -} - -STDMETHODIMP CombinedProgress::Cancel() -{ - AutoCaller autoCaller(this); - if (FAILED(autoCaller.rc())) return autoCaller.rc(); - - AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); - - if (!mCancelable) - return setError(E_FAIL, tr("Operation cannot be canceled")); - - if (!mCanceled) - { - LogThisFunc(("Canceling\n")); - mCanceled = TRUE; -/** @todo Teleportation: Shouldn't this be propagated to mProgresses? If - * powerUp creates passes a combined progress object to the client, I - * won't get called back since I'm only getting the powerupProgress ... - * Or what? */ - if (m_pfnCancelCallback) - m_pfnCancelCallback(m_pvCancelUserArg); - - } - else - LogThisFunc(("Already canceled\n")); - - return S_OK; -} - -// private methods -//////////////////////////////////////////////////////////////////////////////// - -/** - * Fetches the properties of the current progress object and, if it is - * successfully completed, advances to the next uncompleted or unsuccessfully - * completed object in the vector of combined progress objects. - * - * @note Must be called from under this object's write lock! - */ -HRESULT CombinedProgress::checkProgress() -{ - /* do nothing if we're already marked ourselves as completed */ - if (mCompleted) - return S_OK; - - AssertReturn(mProgress < mProgresses.size(), E_FAIL); - - ComPtr<IProgress> progress = mProgresses[mProgress]; - ComAssertRet(!progress.isNull(), E_FAIL); - - HRESULT rc = S_OK; - BOOL fCompleted = FALSE; - - do - { - rc = progress->COMGETTER(Completed)(&fCompleted); - if (FAILED(rc)) - return rc; - - if (fCompleted) - { - rc = progress->COMGETTER(Canceled)(&mCanceled); - if (FAILED(rc)) - return rc; - - LONG iRc; - rc = progress->COMGETTER(ResultCode)(&iRc); - if (FAILED(rc)) - return rc; - mResultCode = iRc; - - if (FAILED(mResultCode)) - { - rc = progress->COMGETTER(ErrorInfo)(mErrorInfo.asOutParam()); - if (FAILED(rc)) - return rc; - } - - if (FAILED(mResultCode) || mCanceled) - { - mCompleted = TRUE; - } - else - { - ULONG opCount = 0; - rc = progress->COMGETTER(OperationCount)(&opCount); - if (FAILED(rc)) - return rc; - - mCompletedOperations += opCount; - mProgress ++; - - if (mProgress < mProgresses.size()) - progress = mProgresses[mProgress]; - else - mCompleted = TRUE; - } - } - } - while (fCompleted && !mCompleted); - - rc = progress->COMGETTER(OperationPercent)(&m_ulOperationPercent); - if (SUCCEEDED(rc)) - { - ULONG operation = 0; - rc = progress->COMGETTER(Operation)(&operation); - if (SUCCEEDED(rc) && mCompletedOperations + operation > m_ulCurrentOperation) - { - m_ulCurrentOperation = mCompletedOperations + operation; - rc = progress->COMGETTER(OperationDescription)(m_bstrOperationDescription.asOutParam()); - } - } - - return rc; -} -/* vi: set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/src/VBox/Main/src-all/SharedFolderImpl.cpp b/src/VBox/Main/src-all/SharedFolderImpl.cpp index 2edf2a2e..9f4ad6c7 100644 --- a/src/VBox/Main/src-all/SharedFolderImpl.cpp +++ b/src/VBox/Main/src-all/SharedFolderImpl.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2010 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -16,8 +16,10 @@ */ #include "SharedFolderImpl.h" -#include "VirtualBoxImpl.h" -#include "MachineImpl.h" +#if !defined(VBOX_COM_INPROC) +# include "VirtualBoxImpl.h" +# include "MachineImpl.h" +#endif #include "ConsoleImpl.h" #include "AutoCaller.h" @@ -50,9 +52,12 @@ struct SharedFolder::Data SharedFolder::SharedFolder() : mParent(NULL), +#if !defined(VBOX_COM_INPROC) mMachine(NULL), - mConsole(NULL), mVirtualBox(NULL) +#else + mConsole(NULL) +#endif { m = new Data; } @@ -77,6 +82,7 @@ void SharedFolder::FinalRelease() // public initializer/uninitializer for internal purposes only ///////////////////////////////////////////////////////////////////////////// +#if !defined(VBOX_COM_INPROC) /** * Initializes the shared folder object. * @@ -147,12 +153,14 @@ HRESULT SharedFolder::initCopy(Machine *aMachine, SharedFolder *aThat) return rc; } +# if 0 + /** * Initializes the shared folder object. * - * This variant initializes an instance that lives in the console address space. + * This variant initializes a global instance that lives in the server address space. It is not presently used. * - * @param aConsole Console parent object + * @param aVirtualBox VirtualBox parent object * @param aName logical name of the shared folder * @param aHostPath full path to the shared folder on the host * @param aWritable writable if true, readonly otherwise @@ -160,7 +168,7 @@ HRESULT SharedFolder::initCopy(Machine *aMachine, SharedFolder *aThat) * * @return COM result indicator */ -HRESULT SharedFolder::init(Console *aConsole, +HRESULT SharedFolder::init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, @@ -171,9 +179,9 @@ HRESULT SharedFolder::init(Console *aConsole, AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); - unconst(mConsole) = aConsole; + unconst(mVirtualBox) = aVirtualBox; - HRESULT rc = protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError); + HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount); /* Confirm a successful initialization when it's the case */ if (SUCCEEDED(rc)) @@ -182,14 +190,16 @@ HRESULT SharedFolder::init(Console *aConsole, return rc; } -#if 0 +# endif + +#else /** * Initializes the shared folder object. * - * This variant initializes a global instance that lives in the server address space. It is not presently used. + * This variant initializes an instance that lives in the console address space. * - * @param aVirtualBox VirtualBox parent object + * @param aConsole Console parent object * @param aName logical name of the shared folder * @param aHostPath full path to the shared folder on the host * @param aWritable writable if true, readonly otherwise @@ -197,7 +207,7 @@ HRESULT SharedFolder::init(Console *aConsole, * * @return COM result indicator */ -HRESULT SharedFolder::init(VirtualBox *aVirtualBox, +HRESULT SharedFolder::init(Console *aConsole, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, @@ -208,9 +218,9 @@ HRESULT SharedFolder::init(VirtualBox *aVirtualBox, AutoInitSpan autoInitSpan(this); AssertReturn(autoInitSpan.isOk(), E_FAIL); - unconst(mVirtualBox) = aVirtualBox; + unconst(mConsole) = aConsole; - HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount); + HRESULT rc = protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError); /* Confirm a successful initialization when it's the case */ if (SUCCEEDED(rc)) @@ -218,7 +228,6 @@ HRESULT SharedFolder::init(VirtualBox *aVirtualBox, return rc; } - #endif /** @@ -304,9 +313,12 @@ void SharedFolder::uninit() unconst(mParent) = NULL; +#if !defined(VBOX_COM_INPROC) unconst(mMachine) = NULL; - unconst(mConsole) = NULL; unconst(mVirtualBox) = NULL; +#else + unconst(mConsole) = NULL; +#endif } // ISharedFolder properties diff --git a/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp b/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp index 8aea252f..96ade446 100644 --- a/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp +++ b/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2012 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -30,6 +30,7 @@ HRESULT VirtualBoxErrorInfo::init(HRESULT aResultCode, IVirtualBoxErrorInfo *aNext) { m_resultCode = aResultCode; + m_resultDetail = 0; /* Not being used. */ m_IID = aIID; m_strComponent = pcszComponent; m_strText = strText; @@ -38,10 +39,24 @@ HRESULT VirtualBoxErrorInfo::init(HRESULT aResultCode, return S_OK; } +HRESULT VirtualBoxErrorInfo::initEx(HRESULT aResultCode, + LONG aResultDetail, + const GUID &aIID, + const char *pcszComponent, + const Utf8Str &strText, + IVirtualBoxErrorInfo *aNext) +{ + HRESULT hr = init(aResultCode, aIID, pcszComponent, strText, aNext); + m_resultDetail = aResultDetail; + + return hr; +} + HRESULT VirtualBoxErrorInfo::init(const com::ErrorInfo &info, IVirtualBoxErrorInfo *aNext) { m_resultCode = info.getResultCode(); + m_resultDetail = info.getResultDetail(); m_IID = info.getInterfaceID(); m_strComponent = info.getComponent(); m_strText = info.getText(); @@ -74,6 +89,14 @@ STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode)(LONG *aResultCode) return S_OK; } +STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultDetail)(LONG *aResultDetail) +{ + CheckComArgOutPointerValid(aResultDetail); + + *aResultDetail = m_resultDetail; + return S_OK; +} + STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID)(BSTR *aIID) { CheckComArgOutPointerValid(aIID); @@ -123,6 +146,7 @@ HRESULT VirtualBoxErrorInfo::init(IErrorInfo *aInfo) * corresponding fields will simply remain null in this case). */ m_resultCode = S_OK; + m_resultDetail = 0; rc = aInfo->GetGUID(m_IID.asOutParam()); AssertComRC(rc); Bstr bstrComponent; @@ -187,6 +211,7 @@ HRESULT VirtualBoxErrorInfo::init(nsIException *aInfo) rc = aInfo->GetResult(&m_resultCode); AssertComRC(rc); + m_resultDetail = 0; /* Not being used. */ char *pszMsg; /* No Utf8Str.asOutParam, different allocator! */ rc = aInfo->GetMessage(&pszMsg); diff --git a/src/VBox/Main/src-all/win/VirtualBox_rgs.xsl b/src/VBox/Main/src-all/win/VirtualBox_rgs.xsl index 0b2e4ba9..08dc63fd 100644 --- a/src/VBox/Main/src-all/win/VirtualBox_rgs.xsl +++ b/src/VBox/Main/src-all/win/VirtualBox_rgs.xsl @@ -5,7 +5,7 @@ * registry definitions necessary to properly register * VirtualBox Main API COM components. - Copyright (C) 2007 Oracle Corporation + Copyright (C) 2007-2012 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; diff --git a/src/VBox/Main/src-all/win/comregister.cmd b/src/VBox/Main/src-all/win/comregister.cmd index 1f8e312f..65f51c3b 100644 --- a/src/VBox/Main/src-all/win/comregister.cmd +++ b/src/VBox/Main/src-all/win/comregister.cmd @@ -6,7 +6,7 @@ REM (both inproc and out-of-process) REM
REM
-REM Copyright (C) 2006-2011 Oracle Corporation
+REM Copyright (C) 2006-2013 Oracle Corporation
REM
REM This file is part of VirtualBox Open Source Edition (OSE), as
REM available from http://www.virtualbox.org. This file is free software;
@@ -94,13 +94,31 @@ cd "%_SCRIPT_CURDIR%" REM
REM Do the registrations.
REM
-:register
+if "%ProgramW6432%x" == "x" goto register_x86
+goto register_amd64
+
+:register_x86
@echo on
-%_VBOX_DIR%VBoxSVC.exe /ReregServer
+%_VBOX_DIR%VBoxSVC.exe /UnregServer
regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
+@if "%1" == "-u" goto end
+%_VBOX_DIR%VBoxSVC.exe /RegServer
regsvr32 /s %_VBOX_DIR%VBoxC.dll
@echo off
+goto end
+
+REM Unregister both first, then register them. The order matters here.
+:register_amd64
+@echo on
+%_VBOX_DIR%VBoxSVC.exe /UnregServer
+%windir%\syswow64\regsvr32 /s /u %_VBOX_DIR%VBoxClient-x86.dll
+%windir%\system32\regsvr32 /s /u %_VBOX_DIR%VBoxC.dll
+@if "%1" == "-u" goto end
+%_VBOX_DIR%VBoxSVC.exe /RegServer
+%windir%\system32\regsvr32 /s %_VBOX_DIR%VBoxC.dll
+%windir%\syswow64\regsvr32 /s %_VBOX_DIR%VBoxClient-x86.dll
+@echo off
:end
-endlocal
+@endlocal
|