GuestImpl.cpp revision 26d2a42f095ded346df2e41cc4837cb426b4753a
/* $Id$ */
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#include "GuestImpl.h"
#include "Global.h"
#include "ConsoleImpl.h"
#include "VMMDev.h"
#include "Logging.h"
#include <iprt/cpputils.h>
// defines
/////////////////////////////////////////////////////////////////////////////
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void Guest::FinalRelease()
{
uninit ();
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the guest object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan (this);
/* mData.mAdditionsActive is FALSE */
/* Confirm a successful initialization when it's the case */
else
mMemoryBalloonSize = 0; /* Default is no ballooning */
else
mStatUpdateInterval = 0; /* Default is not to report guest statistics at all */
/* invalidate all stats */
for (int i=0;i<GuestStatisticType_MaxVal;i++)
/* start with sample 0 */
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
{
LogFlowThisFunc (("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan (this);
if (autoUninitSpan.uninitDone())
return;
}
// IGuest properties
/////////////////////////////////////////////////////////////////////////////
{
if (!aOSTypeId)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
// redirect the call to IMachine if no additions are installed
return S_OK;
}
{
if (!aAdditionsActive)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
if (!aAdditionsVersion)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
if (!aSupportsSeamless)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
if (!aSupportsGraphics)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
if (!aMemoryBalloonSize)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
{
/* forward the information to the VMM device */
if (vmmDev)
}
return ret;
}
{
if (!aUpdateInterval)
return E_POINTER;
AutoCaller autoCaller (this);
AutoReadLock alock (this);
return S_OK;
}
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
{
/* forward the information to the VMM device */
if (vmmDev)
}
return ret;
}
{
return E_INVALIDARG;
AutoCaller autoCaller (this);
/* forward the information to the VMM device */
if (vmmDev)
{
if (!aAllowInteractiveLogon)
return S_OK;
}
tr ("VMM device is not available (is the VM running?)"));
}
{
if (!aStatVal)
return E_INVALIDARG;
if (aCpuId != 0)
return E_INVALIDARG;
if (aStatistic >= GuestStatisticType_MaxVal)
return E_INVALIDARG;
/* not available or not yet reported? */
return E_INVALIDARG;
return S_OK;
}
{
if (aCpuId != 0)
return E_INVALIDARG;
if (aStatistic >= GuestStatisticType_MaxVal)
return E_INVALIDARG;
/* internal method assumes that the caller known what he's doing (no boundary checks) */
return S_OK;
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
}
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
}
{
AutoCaller autoCaller (this);
AutoWriteLock alock (this);
}