本文整理汇总了C++中AssertComRCReturn函数的典型用法代码示例。如果您正苦于以下问题:C++ AssertComRCReturn函数的具体用法?C++ AssertComRCReturn怎么用?C++ AssertComRCReturn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertComRCReturn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroyClientListener
int destroyClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr)
{
if (listener)
{
ComPtr<IEventSource> esVBox;
HRESULT hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam());
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
if (!esVBox.isNull())
{
hrc = esVBox->UnregisterListener(listener);
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
}
listener.setNull();
}
return VINF_SUCCESS;
}
示例2: AssertComRCReturn
int VBoxNetBaseService::init()
{
if (isMainNeeded())
{
HRESULT hrc = com::Initialize();
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
hrc = virtualboxClient.createInprocObject(CLSID_VirtualBoxClient);
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
hrc = virtualboxClient->COMGETTER(VirtualBox)(virtualbox.asOutParam());
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
}
return VINF_SUCCESS;
}
示例3: autoCaller
bool ParallelPort::i_hasDefaults()
{
/* sanity */
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), true);
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
if (!m->bd->fEnabled)
{
/* Could be default, check the IO base and IRQ. */
switch (m->bd->ulSlot)
{
case 0:
if (m->bd->ulIOBase == 0x378 && m->bd->ulIRQ == 7)
return true;
break;
case 1:
if (m->bd->ulIOBase == 0x278 && m->bd->ulIRQ == 5)
return true;
break;
default:
AssertMsgFailed(("Parallel port slot %u exceeds limit\n", m->bd->ulSlot));
break;
}
/* Detect old-style defaults (0x378, irq 4) in any slot, they are still
* in place for many VMs created by old VirtualBox versions. */
if (m->bd->ulIOBase == 0x378 && m->bd->ulIRQ == 4)
return true;
}
return false;
}
示例4: autoCaller
/**
* Returns a medium format object corresponding to the given file extension or
* null if no such format.
*
* @param aExt File extension.
*
* @return ComObjPtr<MediumFormat>
*/
ComObjPtr<MediumFormat> SystemProperties::i_mediumFormatFromExtension(const Utf8Str &aExt)
{
ComObjPtr<MediumFormat> format;
AutoCaller autoCaller(this);
AssertComRCReturn (autoCaller.rc(), format);
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
bool fFound = false;
for (MediumFormatList::const_iterator it = m_llMediumFormats.begin();
it != m_llMediumFormats.end() && !fFound;
++it)
{
/* MediumFormat is all const, no need to lock */
MediumFormat::StrArray aFileList = (*it)->i_getFileExtensions();
for (MediumFormat::StrArray::const_iterator it1 = aFileList.begin();
it1 != aFileList.end();
++it1)
{
if ((*it1).compare(aExt, Utf8Str::CaseInsensitive) == 0)
{
format = *it;
fFound = true;
break;
}
}
}
return format;
}
示例5: Assert
/* static */
int NativeEventQueue::init()
{
Assert(sMainQueue == NULL);
Assert(RTThreadIsMain(RTThreadSelf()));
try
{
sMainQueue = new NativeEventQueue();
AssertPtr(sMainQueue);
#ifdef VBOX_WITH_XPCOM
/* Check that it actually is the main event queue, i.e. that
we're called on the right thread. */
nsCOMPtr<nsIEventQueue> q;
nsresult rv = NS_GetMainEventQ(getter_AddRefs(q));
AssertComRCReturn(rv, VERR_INVALID_POINTER);
Assert(q == sMainQueue->mEventQ);
/* Check that it's a native queue. */
PRBool fIsNative = PR_FALSE;
rv = sMainQueue->mEventQ->IsQueueNative(&fIsNative);
Assert(NS_SUCCEEDED(rv) && fIsNative);
#endif // VBOX_WITH_XPCOM
}
catch (std::bad_alloc &ba)
{
NOREF(ba);
return VERR_NO_MEMORY;
}
return VINF_SUCCESS;
}
示例6: autoCaller
STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId)
{
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
#ifndef VBOX_COM_INPROC_API_CLIENT
AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
#endif
if (mState != SessionState_Locked)
{
/* the call from Machine issued when the session is open can arrive
* after the session starts closing or gets closed. Note that when
* aCheck is false, we return E_FAIL to indicate that aWinId we return
* is not valid */
*aCanShow = FALSE;
*aWinId = 0;
return aCheck ? S_OK : E_FAIL;
}
#ifndef VBOX_COM_INPROC_API_CLIENT
return mConsole->onShowWindow(aCheck, aCanShow, aWinId);
#else
return S_OK;
#endif
}
示例7: autoCaller
/**
* Returns true if the given USB device matches to at least one of
* this controller's USB device filters.
*
* A HostUSBDevice specific version.
*
* @note Locks this object for reading.
*/
bool USBDeviceFilters::i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
{
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), false);
/* It is not possible to work with USB device if there is no USB controller present. */
if (!m->pParent->i_isUSBControllerPresent())
return false;
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
/* apply self filters */
for (DeviceFilterList::const_iterator it = m->llDeviceFilters->begin();
it != m->llDeviceFilters->end();
++it)
{
AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS);
if (aDevice->i_isMatch((*it)->i_getData()))
{
*aMaskedIfs = (*it)->i_getData().mMaskedIfs;
return true;
}
}
return false;
}
示例8: LogFlowThisFuncEnter
STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)
{
LogFlowThisFuncEnter();
AssertReturn(aConsole, E_POINTER);
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
AssertReturn(mState != SessionState_Unlocked, VBOX_E_INVALID_VM_STATE);
#ifndef VBOX_COM_INPROC_API_CLIENT
AssertMsgReturn(mType == SessionType_WriteLock && !!mConsole,
("This is not a direct session!\n"),
VBOX_E_INVALID_OBJECT_STATE);
/* return a failure if the session already transitioned to Closing
* but the server hasn't processed Machine::OnSessionEnd() yet. */
if (mState != SessionState_Locked)
return VBOX_E_INVALID_VM_STATE;
mConsole.queryInterfaceTo(aConsole);
LogFlowThisFuncLeave();
return S_OK;
#else /* VBOX_COM_INPROC_API_CLIENT */
AssertFailed();
return VBOX_E_INVALID_OBJECT_STATE;
#endif /* VBOX_COM_INPROC_API_CLIENT */
}
示例9: autoCaller
bool USBDeviceFilter::i_isModified()
{
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), false);
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
return m_fModified;
}
示例10: autoCaller
STDMETHODIMP Session::EnableVMMStatistics(BOOL aEnable)
{
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
mConsole->enableVMMStatistics(aEnable);
return S_OK;
}
示例11: DECLCALLBACK
DECLCALLBACK(int) VBoxNetBaseService::Data::recvLoop(RTTHREAD, void *pvUser)
{
VBoxNetBaseService *pThis = static_cast<VBoxNetBaseService *>(pvUser);
HRESULT hrc = com::Initialize();
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
pThis->doReceiveLoop();
return VINF_SUCCESS;
}
示例12: autoCaller
STDMETHODIMP Session::SaveStateWithReason(Reason_T aReason, IProgress **aProgress)
{
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
return mConsole->saveState(aReason, aProgress);
}
示例13: createClientListener
int createClientListener(ComNatListenerPtr& listener, const ComVirtualBoxClientPtr& vboxclientptr,
NATNetworkEventAdapter *adapter, /* const */ ComEventTypeArray& events)
{
ComObjPtr<NATNetworkListenerImpl> obj;
HRESULT hrc = obj.createObject();
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
hrc = obj->init(new NATNetworkListener(), adapter);
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
ComPtr<IEventSource> esVBox;
hrc = vboxclientptr->COMGETTER(EventSource)(esVBox.asOutParam());
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
listener = obj;
hrc = esVBox->RegisterListener(listener, ComSafeArrayAsInParam(events), true);
AssertComRCReturn(hrc, VERR_INTERNAL_ERROR);
return VINF_SUCCESS;
}
示例14: LogFlowThisFunc
STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove)
{
LogFlowThisFunc(("\n"));
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove);
}
示例15: LogFlowThisFunc
STDMETHODIMP Session::OnDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode)
{
LogFlowThisFunc(("\n"));
AutoCaller autoCaller(this);
AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
return mConsole->onDragAndDropModeChange(aDragAndDropMode);
}