GuestSessionImpl.cpp revision 9bff17fe6983cfda2ddd98f1979841bcb48e78e7
/* $Id$ */
/** @file
* VirtualBox Main - Guest session handling.
*/
/*
* Copyright (C) 2012-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;
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "GuestImpl.h"
#include "GuestSessionImpl.h"
#include "GuestCtrlImplPrivate.h"
#include "Global.h"
#include "AutoCaller.h"
#include "ProgressImpl.h"
#include "VMMDev.h"
#include <memory> /* For auto_ptr. */
#ifdef LOG_GROUP
#endif
#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
/**
* Base class representing an internal
* asynchronous session task.
*/
class GuestSessionTaskInternal
{
public:
mRC(VINF_SUCCESS) { }
virtual ~GuestSessionTaskInternal(void) { }
protected:
int mRC;
};
/**
* Class for asynchronously opening a guest session.
*/
class GuestSessionTaskInternalOpen : public GuestSessionTaskInternal
{
public:
: GuestSessionTaskInternal(pSession) { }
};
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
LogFlowThisFunc(("\n"));
mData.mWaitCount = 0;
return BaseFinalConstruct();
}
void GuestSession::FinalRelease(void)
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes a guest session but does *not* open in on the guest side
* yet. This needs to be done via the openSession() / openSessionAsync calls.
*
* @return IPRT status code.
** @todo Docs!
*/
const GuestCredentials &guestCreds)
{
LogFlowThisFunc(("pGuest=%p, ssInfo=%p, guestCreds=%p\n",
/* Enclose the state transition NotReady->InInit->Ready. */
AutoInitSpan autoInitSpan(this);
/* Copy over startup info. */
/** @todo Use an overloaded copy operator. Later. */
/** @todo Use an overloaded copy operator. Later. */
mData.mNumObjects = 0;
if (RT_SUCCESS(rc))
{
/* Confirm a successful initialization when it's the case. */
}
else
return rc;
}
/**
* Uninitializes the instance.
* Called from FinalRelease().
*/
void GuestSession::uninit(void)
{
/* Enclose the state transition Ready->InUninit->NotReady. */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
int rc = VINF_SUCCESS;
#ifndef VBOX_WITH_GUEST_CONTROL
LogFlowThisFunc(("Closing directories (%RU64 total)\n",
{
#ifdef DEBUG
#endif
}
LogFlowThisFunc(("Closing files (%RU64 total)\n",
{
#ifdef DEBUG
#endif
}
LogFlowThisFunc(("Closing processes (%RU64 total)\n",
{
#ifdef DEBUG
#endif
}
#endif
}
/////////////////////////////////////////////////////////////////////////////
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
LogFlowThisFunc(("[%s]: cEnvVars=%RU32\n",
{
}
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
int rc = VINF_SUCCESS;
{
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
// private methods
///////////////////////////////////////////////////////////////////////////////
{
/* Legacy Guest Additions don't support opening dedicated
guest sessions. */
{
LogFlowThisFunc(("Installed Guest Additions don't support closing dedicated sessions, skipping\n"));
return VINF_SUCCESS;
}
/** @todo uFlags validation. */
/* Destroy a pending callback request. */
if (RT_SUCCESS(vrc))
{
/* The context ID only contains this session's ID; all other
* parameters like object and the count itself are not needed
* and therefore 0. */
0 /* Object */, 0 /* Count */);
int i = 0;
}
if (RT_SUCCESS(vrc))
{
/*
* Let's wait for the process being started.
*/
{
if (RT_SUCCESS(guestRc))
{
/* Nothing to do here right now. */
}
else
if (pGuestRc)
}
}
return vrc;
}
{
{
if (pDirectory == (*itDirs))
{
LogFlowFunc(("Removing directory \"%s\" (Session: %RU32) (now total %ld directories)\n",
return VINF_SUCCESS;
}
}
return VERR_NOT_FOUND;
}
int GuestSession::directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc)
{
LogFlowThisFunc(("strPath=%s, uMode=%x, uFlags=%x\n",
int vrc = VINF_SUCCESS;
/* Construct arguments. */
procInfo.mArguments.push_back(Utf8Str("--parents")); /* We also want to create the parent directories. */
if (uMode)
{
char szMode[16];
{
}
else
}
if (RT_SUCCESS(vrc))
{
int guestRc;
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
}
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
}
}
return vrc;
}
int GuestSession::directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
{
if (RT_SUCCESS(vrc))
{
}
return vrc;
}
{
if (fDirectory)
{
}
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
}
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
}
&& pGuestRc)
return vrc;
}
{
LogFlowThisFunc(("strPath=%s, strPath=%s, uFlags=%x\n",
/* Create the directory object. */
return VERR_COM_UNEXPECTED;
if (RT_FAILURE(vrc))
return vrc;
/* Add the created directory to our vector. */
LogFlowFunc(("Added new directory \"%s\" (Session: %RU32)\n",
return vrc;
}
{
#ifdef DEBUG
LogFlowFunc(("uFileID=%RU32 (%RU32 total)\n",
#endif
int rc;
{
}
else
rc = VERR_NOT_FOUND;
return rc;
}
int GuestSession::dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb)
{
#ifdef DEBUG
LogFlowFunc(("uProcessID=%RU32 (%RU32 total)\n",
#endif
int rc;
{
/* Set protocol version so that pSvcCb can
* be interpreted right. */
}
else
rc = VERR_NOT_FOUND;
return rc;
}
{
#ifdef DEBUG
LogFlowThisFunc(("ID=%RU32, uContextID=%RU32, uFunction=%RU32, pSvcCb=%p\n",
#endif
int rc = VINF_SUCCESS;
{
case GUEST_DISCONNECTED:
/** @todo Handle closing all processes. */
break;
case GUEST_SESSION_NOTIFY:
{
break;
}
default:
/* Silently skip unknown callbacks. */
break;
}
return rc;
}
{
{
if (pFile)
return true;
}
return false;
}
{
{
{
LogFlowThisFunc(("Removing file \"%s\" (Session: %RU32) (now total %ld files, %ld objects)\n",
#ifdef DEBUG
#endif
mData.mNumObjects--;
return VINF_SUCCESS;
}
}
return VERR_NOT_FOUND;
}
{
if (RT_SUCCESS(vrc))
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
}
&& pGuestRc)
return vrc;
}
int GuestSession::fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc)
{
LogFlowThisFunc(("strPath=%s, strOpenMode=%s, strDisposition=%s, uCreationMode=%x, iOffset=%RI64\n",
int rc = VERR_MAX_PROCS_REACHED;
return rc;
/* Create a new (host-based) file ID and assign it. */
uint32_t uNewFileID = 0;
for (;;)
{
/* Is the file ID already used? */
{
/* Callback with context ID was not found. This means
* we can use this context ID for our new callback we want
* to add below. */
rc = VINF_SUCCESS;
break;
}
uNewFileID++;
if (uNewFileID == VBOX_GUESTCTRL_MAX_OBJECTS)
uNewFileID = 0;
if (++uTries == UINT32_MAX)
break; /* Don't try too hard. */
}
if (RT_FAILURE(rc))
return rc;
/* Create the directory object. */
return VERR_COM_UNEXPECTED;
if (RT_FAILURE(rc))
return rc;
/* Add the created file to our vector. */
mData.mNumObjects++;
LogFlowFunc(("Added new file \"%s\" (Session: %RU32) (now total %ld files, %ld objects)\n",
return rc;
}
int GuestSession::fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
{
if (RT_SUCCESS(vrc))
{
}
return vrc;
}
{
if (RT_SUCCESS(vrc))
return vrc;
}
int GuestSession::fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc)
{
/** @todo Merge this with IGuestFile::queryInfo(). */
/* Construct arguments. */
if (RT_SUCCESS(vrc))
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(guestRc))
{
/** @todo Check for more / validate blocks! */
if (RT_SUCCESS(vrc))
}
}
&& pGuestRc)
return vrc;
}
{
return mData.mCredentials;
}
{
return mData.mEnvironment;
}
{
}
/* static */
{
/** @todo pData->u32Flags: int vs. uint32 -- IPRT errors are *negative* !!! */
switch (guestRc)
{
case VERR_INVALID_VM_HANDLE:
break;
break;
break;
case VERR_TIMEOUT:
break;
case VERR_CANCELLED:
break;
case VERR_PERMISSION_DENIED:
break;
case VERR_MAX_PROCS_REACHED:
break;
case VERR_NOT_EQUAL: /** @todo Imprecise to the user; can mean anything and all. */
break;
case VERR_NOT_FOUND:
break;
default:
break;
}
return strError;
}
/** No locking! */
{
/* pCallback is optional. */
return VERR_INVALID_PARAMETER;
/* pSvcCb->mpaParms[0] always contains the context ID. */
LogFlowThisFunc(("ID=%RU32, uType=%RU32, rc=%Rrc, pCallback=%p, pData=%p\n",
int vrc = VINF_SUCCESS;
{
break;
break;
break;
break;
break;
break;
default:
break;
}
if (RT_SUCCESS(vrc))
{
if (RT_FAILURE(guestRc))
}
else if (vrc == VERR_NOT_SUPPORTED)
{
/* Also let the callback know. */
}
/*
* Now do the signalling stuff.
*/
if (pCallback)
{
}
LogFlowThisFunc(("ID=%RU32, guestRc=%Rrc\n",
return vrc;
}
{
LogFlowThisFunc(("uProtocolVersion=%RU32, openFlags=%x, openTimeoutMS=%RU32\n",
/* Legacy Guest Additions don't support opening dedicated
guest sessions. Simply return success here. */
{
LogFlowThisFunc(("Installed Guest Additions don't support opening dedicated sessions, skipping\n"));
return VINF_SUCCESS;
}
/** @todo mData.mSession.uFlags validation. */
/* Set current session status. */
/* Destroy a pending callback request. */
if (RT_SUCCESS(vrc))
{
0 /* Object */, 0 /* Count */);
int i = 0;
}
if (RT_SUCCESS(vrc))
{
/*
* Let's wait for the process being started.
*/
{
if (RT_SUCCESS(guestRc))
{
/* Nothing to do here right now. */
}
else
if (pGuestRc)
}
}
/* Destroy callback. */
return vrc;
}
int GuestSession::startSessionAsync(void)
{
int vrc;
try
{
/* Asynchronously open the session on the guest by kicking off a
* worker thread. */
"gctlSesStart");
if (RT_SUCCESS(vrc))
{
/* pTask is now owned by openSessionThread(), so release it. */
}
}
{
}
return vrc;
}
/* static */
{
std::auto_ptr<GuestSessionTaskInternalOpen> pTask(static_cast<GuestSessionTaskInternalOpen*>(pvUser));
/* Nothing to do here anymore. */
return vrc;
}
{
int rc = VERR_NOT_FOUND;
{
{
LogFlowFunc(("Removing process (Session: %RU32) with process ID=%RU32, guest PID=%RU32 (now total %ld processes, %ld objects)\n",
mData.mSession.mID, pCurProc->getObjectID(), uPID, mData.mProcesses.size() - 1, mData.mNumObjects - 1));
mData.mNumObjects--;
rc = VINF_SUCCESS;
break;
}
}
return rc;
}
/**
* Creates but does *not* start the process yet. See GuestProcess::startProcess() or
* GuestProcess::startProcessAsync() for that.
*
* @return IPRT status code.
* @param procInfo
* @param pProcess
*/
int GuestSession::processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
{
LogFlowFunc(("mCmd=%s, mFlags=%x, mTimeoutMS=%RU32\n",
#ifdef DEBUG
{
LogFlowFunc(("Arguments:"));
{
it++;
}
LogFlow(("\n"));
}
#endif
/* Validate flags. */
{
{
return VERR_INVALID_PARAMETER;
}
}
)
)
{
return VERR_INVALID_PARAMETER;
}
/* Adjust timeout. If set to 0, we define
* an infinite timeout. */
if (procInfo.mTimeoutMS == 0)
/** @tood Implement process priority + affinity. */
int rc = VERR_MAX_PROCS_REACHED;
return rc;
/* Create a new (host-based) process ID and assign it. */
uint32_t uNewProcessID = 0;
for (;;)
{
/* Is the context ID already used? */
{
/* Callback with context ID was not found. This means
* we can use this context ID for our new callback we want
* to add below. */
rc = VINF_SUCCESS;
break;
}
uNewProcessID = 0;
if (++uTries == VBOX_GUESTCTRL_MAX_OBJECTS)
break; /* Don't try too hard. */
}
if (RT_FAILURE(rc))
return rc;
/* Create the process object. */
return VERR_COM_UNEXPECTED;
if (RT_FAILURE(rc))
return rc;
/* Add the created process to our map. */
mData.mNumObjects++;
LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32 (now total %ld processes, %ld objects)\n",
return rc;
}
{
{
if (pProcess)
return true;
}
return false;
}
{
AssertReturn(uPID, false);
/* pProcess is optional. */
{
if (procCaller.rc())
return VERR_COM_INVALID_OBJECT_STATE;
{
if (pProcess)
return VINF_SUCCESS;
}
}
return VERR_NOT_FOUND;
}
{
#ifndef VBOX_GUESTCTRL_TEST_CASE
/* Forward the information to the VMM device. */
if (RT_FAILURE(vrc))
{
/** @todo What to do here? */
}
#else
/* Not needed within testcases. */
int vrc = VINF_SUCCESS;
#endif
return vrc;
}
/* static */
{
}
{
/* Create the progress object. */
return VERR_COM_UNEXPECTED;
TRUE /* aCancelable */);
return VERR_COM_UNEXPECTED;
/* Initialize our worker task. */
if (RT_FAILURE(rc))
return rc;
/* Don't destruct on success. */
return rc;
}
/**
* This is necessary to know which guest control protocol version to use,
* among other things (later).
*
* @return IPRT status code.
*/
int GuestSession::queryInfo(void)
{
#ifndef DEBUG_andy
/* Since the new functions are not fully implemented yet, force Main
to use protocol ver 1 so far. */
#else
#if 1
/* For debugging only: Hardcode version. */
#else
/*
* Try querying the guest control protocol version running on the guest.
* This is done using the Guest Additions version
*/
? 2 /* Guest control 2.0. */
: 1; /* Legacy guest control (VBox < 4.3). */
/* Build revision is ignored. */
/* Tell the user but don't bitch too often. */
static short s_gctrlLegacyWarning = 0;
LogRel((tr("Warning: Guest Additions are older (%ld.%ld) than host capabilities for guest control, please upgrade them. Using protocol version %ld now\n"),
VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions), VBOX_FULL_VERSION_GET_MINOR(uVerAdditions), mData.mProtocolVersion));
#endif
#endif
return VINF_SUCCESS;
}
int GuestSession::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc)
{
LogFlowThisFunc(("fWaitFlags=0x%x, uTimeoutMS=%RU32, mStatus=%RU32, mWaitCount=%RU32, mWaitEvent=%p, pGuestRc=%p\n",
/* Did some error occur before? Then skip waiting and return. */
{
AssertMsg(RT_FAILURE(mData.mRC), ("No error rc (%Rrc) set when guest session indicated an error\n", mData.mRC));
if (pGuestRc)
return VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
}
{
{
case GuestSessionStatus_Down:
break;
break;
case GuestSessionStatus_Error:
/* Handled above. */
break;
break;
/* Do the waiting below. */
break;
default:
return VERR_NOT_IMPLEMENTED;
}
}
else if (fWaitFlags & GuestSessionWaitForFlag_Start)
{
{
case GuestSessionStatus_Down:
break;
case GuestSessionStatus_Error:
break;
break;
/* Do the waiting below. */
break;
default:
return VERR_NOT_IMPLEMENTED;
}
}
LogFlowThisFunc(("sessionStatus=%ld, sessionRc=%Rrc, waitResult=%ld\n",
/* No waiting needed? Return immediately using the last set error. */
{
if (pGuestRc)
return RT_SUCCESS(mData.mRC) ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
}
return VERR_ALREADY_EXISTS;
mData.mWaitCount++;
int vrc = VINF_SUCCESS;
try
{
}
{
}
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(vrc))
{
if (pGuestRc)
vrc = RT_SUCCESS(waitRc) ? VINF_SUCCESS : VERR_GENERAL_FAILURE; /** @todo Special guest control rc needed! */
}
/* Note: The caller always is responsible of deleting the
* stuff it created before. See close() for more information. */
delete mData.mWaitEvent;
}
mData.mWaitCount--;
return vrc;
}
// implementation of public methods
/////////////////////////////////////////////////////////////////////////////
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
/* Close session on guest session. */
int guestRc;
&guestRc);
/* On failure don't return here, instead do all the cleanup
* work first and then return an error. */
/* Remove ourselves from the session list. */
if (RT_SUCCESS(rc))
/*
* Release autocaller before calling uninit.
*/
uninit();
if (RT_FAILURE(rc))
{
/** @todo Handle guestRc! */
return setError(VBOX_E_IPRT_ERROR,
}
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (aFlags)
{
}
try
{
int rc = startTaskAsync(Utf8StrFmt(tr("Copying \"%ls\" from guest to \"%ls\" on the host"), aSource, aDest),
if (RT_SUCCESS(rc))
{
/* Return progress to the caller. */
}
else
}
{
hr = E_OUTOFMEMORY;
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(CopyFileFlag_T, aFlags), IProgress **aProgress)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (aFlags)
{
}
try
{
int rc = startTaskAsync(Utf8StrFmt(tr("Copying \"%ls\" from host to \"%ls\" on the guest"), aSource, aDest),
if (RT_SUCCESS(rc))
{
/* Return progress to the caller. */
}
else
}
{
hr = E_OUTOFMEMORY;
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (aFlags)
{
if (fFlags)
{
if (!(fFlags & DirectoryCreateFlag_Parents))
}
}
if (RT_FAILURE(rc))
{
switch (rc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
case VERR_INVALID_PARAMETER:
break;
case VERR_BROKEN_PIPE:
break;
case VERR_CANT_CREATE:
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, BSTR *aDirectory)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(rc))
{
}
else
{
switch (rc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
default:
hr = setError(VBOX_E_IPRT_ERROR, tr("Temporary directory creation \"%s\" with template \"%s\" failed: %Rrc"),
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(rc))
{
}
else
{
switch (rc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, ComSafeArrayIn(DirectoryOpenFlag_T, aFlags), IGuestDirectory **aDirectory)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (aFlags)
{
if (fFlags)
}
if (RT_SUCCESS(rc))
{
/* Return directory object to the caller. */
}
else
{
switch (rc)
{
case VERR_INVALID_PARAMETER:
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(vrc))
{
{
if (RT_SUCCESS(vrc))
{
}
}
}
if (RT_FAILURE(vrc))
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
case VERR_NOT_A_DIRECTORY:
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
return S_OK;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aPath, BOOL aSecure, IGuestFile **aFile)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(vrc))
{
return S_OK;
}
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
case VERR_NOT_A_FILE:
break;
default:
break;
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
int guestRc;
if (RT_FAILURE(vrc))
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
/** @todo Validate open mode. */
/** @todo Validate disposition mode. */
/** @todo Validate creation mode. */
uint32_t uCreationMode = 0;
if (RT_SUCCESS(vrc))
{
/* Return directory object to the caller. */
}
else
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(vrc))
{
if (RT_SUCCESS(vrc))
{
}
}
if (RT_FAILURE(vrc))
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
case VERR_NOT_A_FILE:
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (RT_SUCCESS(vrc))
{
}
else
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
ComSafeArrayInArg(aFlags), aTimeoutMS, ProcessPriority_Default, ComSafeArrayAsInParam(affinity), aProcess);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
if (aArguments)
{
}
int rc = VINF_SUCCESS;
/*
* Create the process environment:
* - Apply the session environment in a first step, and
* - Apply environment variables specified by this call to
* have the chance of overwriting/deleting session entries.
*/
if (aEnvironment)
{
}
if (RT_SUCCESS(rc))
{
if (aFlags)
{
}
if (aAffinity)
{
{
if (affinity[i])
}
}
if (RT_SUCCESS(rc))
{
/* Return guest session to the caller. */
if (RT_SUCCESS(rc))
}
}
if (RT_FAILURE(rc))
{
switch (rc)
{
case VERR_MAX_PROCS_REACHED:
break;
/** @todo Add more errors here. */
default:
break;
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
if (aPID == 0)
AutoCaller autoCaller(this);
if (RT_FAILURE(rc))
/* This will set (*aProcess) to NULL if pProgress is NULL. */
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::WaitFor(ULONG aWaitFlags, ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
/*
* Note: Do not hold any locks here while waiting!
*/
if (RT_SUCCESS(vrc))
{
*aReason = waitResult;
}
else
{
switch (vrc)
{
case VERR_GENERAL_FAILURE: /** @todo Special guest control rc needed! */
break;
case VERR_TIMEOUT:
break;
default:
{
tr("Waiting for guest session \"%s\" failed: %Rrc"),
break;
}
}
}
return hr;
#endif /* VBOX_WITH_GUEST_CONTROL */
}
STDMETHODIMP GuestSession::WaitForArray(ComSafeArrayIn(GuestSessionWaitForFlag_T, aFlags), ULONG aTimeoutMS, GuestSessionWaitResult_T *aReason)
{
#ifndef VBOX_WITH_GUEST_CONTROL
#else
AutoCaller autoCaller(this);
/*
* Note: Do not hold any locks here while waiting!
*/
#endif /* VBOX_WITH_GUEST_CONTROL */
}