HRESULT Guest::getOSTypeId(com::Utf8Str &aOSTypeId)
{
    HRESULT hrc = S_OK;
    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    if (!mData.mInterfaceVersion.isEmpty())
        aOSTypeId = mData.mOSTypeId;
    else
    {
        /* Redirect the call to IMachine if no additions are installed. */
        ComPtr<IMachine> ptrMachine(mParent->i_machine());
        alock.release();
        BSTR bstr;
        hrc = ptrMachine->COMGETTER(OSTypeId)(&bstr);
        aOSTypeId = bstr;
    }
    return hrc;
}
Beispiel #2
0
STDMETHODIMP Guest::COMGETTER(OSTypeId)(BSTR *a_pbstrOSTypeId)
{
    CheckComArgOutPointerValid(a_pbstrOSTypeId);

    AutoCaller autoCaller(this);
    HRESULT hrc = autoCaller.rc();
    if (SUCCEEDED(hrc))
    {
        AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
        if (!mData.mInterfaceVersion.isEmpty())
            mData.mOSTypeId.cloneTo(a_pbstrOSTypeId);
        else
        {
            /* Redirect the call to IMachine if no additions are installed. */
            ComPtr<IMachine> ptrMachine(mParent->machine());
            alock.release();
            hrc = ptrMachine->COMGETTER(OSTypeId)(a_pbstrOSTypeId);
        }
    }
    return hrc;
}