GuestSessionImpl.cpp revision cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5f
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * VirtualBox Main - XXX.
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * Copyright (C) 2012 Oracle Corporation
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * available from http://www.virtualbox.org. This file is free software;
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync/*******************************************************************************
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync* Header Files *
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync*******************************************************************************/
4c4624089d6e1746a6c892750deb5dbe78eb2f42vboxsync// constructor / destructor
c0b6af690ad705bddfa87c643b89770a7a0aaf5avboxsync/////////////////////////////////////////////////////////////////////////////
c289b436b16d693c4513d0fccf2cc8ea6b2e93f2vboxsync// public initializer/uninitializer for internal purposes only
c289b436b16d693c4513d0fccf2cc8ea6b2e93f2vboxsync/////////////////////////////////////////////////////////////////////////////
c289b436b16d693c4513d0fccf2cc8ea6b2e93f2vboxsyncint GuestSession::init(Guest *aGuest, ULONG aSessionID,
c289b436b16d693c4513d0fccf2cc8ea6b2e93f2vboxsync Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName)
4c4624089d6e1746a6c892750deb5dbe78eb2f42vboxsync /* Enclose the state transition NotReady->InInit->Ready. */
cd7a8c034836a94a0c4f0adf9764f9ed661cdd01vboxsync AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
4c4624089d6e1746a6c892750deb5dbe78eb2f42vboxsync mData.mTimeout = 30 * 60 * 1000; /* Session timeout is 30 mins by default. */
1b396f7f5a76d66e62fc9d8e66dcbe8e7bf72039vboxsync /* Confirm a successful initialization when it's the case. */
cd7a8c034836a94a0c4f0adf9764f9ed661cdd01vboxsync * Uninitializes the instance.
29cd023599ef35a550e6fb350bf4feeed3bc8326vboxsync * Called from FinalRelease().
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync /* Enclose the state transition Ready->InUninit->NotReady. */
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync for (SessionFiles::iterator itFiles = mData.mFiles.begin();
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync// implementation of public getters/setters for attributes
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsync/////////////////////////////////////////////////////////////////////////////
fa94cbe3cda9a48bb743f0c2b26ec06927878830vboxsyncSTDMETHODIMP GuestSession::COMGETTER(User)(BSTR *aUser)
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
return VINF_SUCCESS;
return VERR_NOT_FOUND;
int GuestSession::dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData)
#ifdef DEBUG
int rc;
return rc;
return VINF_SUCCESS;
return VERR_NOT_FOUND;
return VINF_SUCCESS;
return VERR_NOT_FOUND;
int GuestSession::processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
return VERR_INVALID_PARAMETER;
return rc;
catch (int rc2)
return rc;
if (pProcess)
return VERR_COM_INVALID_OBJECT_STATE;
if (pProcess)
return VINF_SUCCESS;
return VERR_NOT_FOUND;
#ifndef VBOX_WITH_GUEST_CONTROL
uninit();
return S_OK;
STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aProgress)
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory)
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory)
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
return hr;
#ifndef VBOX_WITH_GUEST_CONTROL
return hr;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
STDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile)
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef 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
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
#ifndef VBOX_WITH_GUEST_CONTROL
HRESULT hr = ProcessCreateEx(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
ComSafeArrayInArg(aFlags), aTimeoutMS, ProcessPriority_Default, ComSafeArrayAsInParam(affinity), aProcess);
return hr;
STDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
#ifndef VBOX_WITH_GUEST_CONTROL
if (aArguments)
* have the chance of overwriting/deleting session entries.
if (aEnvironment)
if (aFlags)
if (aAffinity)
switch (rc)
case VERR_MAX_PROCS_REACHED:
return hr;
#ifndef VBOX_WITH_GUEST_CONTROL
if (aPID == 0)
return hr;
#ifndef VBOX_WITH_GUEST_CONTROL
return S_OK;
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
STDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL
#ifndef VBOX_WITH_GUEST_CONTROL