GuestSessionImpl.cpp revision 7b9f0c34e9ea328981c99e97054bdf8684d9d620
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/* $Id$ */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/** @file
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox Main - XXX.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Copyright (C) 2012 Oracle Corporation
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync *
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * available from http://www.virtualbox.org. This file is free software;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * General Public License (GPL) as published by the Free Software
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*******************************************************************************
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync* Header Files *
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync*******************************************************************************/
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#include "GuestImpl.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "GuestSessionImpl.h"
7b9f0c34e9ea328981c99e97054bdf8684d9d620vboxsync#include "GuestCtrlImplPrivate.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "Global.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "AutoCaller.h"
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include <iprt/env.h>
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync#include <VBox/com/array.h>
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync#include <VBox/version.h>
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// constructor / destructor
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncDEFINE_EMPTY_CTOR_DTOR(GuestSession)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncHRESULT GuestSession::FinalConstruct(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFunc(("\n"));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return BaseFinalConstruct();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncvoid GuestSession::FinalRelease(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync uninit();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync BaseFinalRelease();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncLeave();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// public initializer/uninitializer for internal purposes only
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/////////////////////////////////////////////////////////////////////////////
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncint GuestSession::init(Guest *aGuest, ULONG aSessionID,
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AssertPtrReturn(aGuest, VERR_INVALID_POINTER);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync /* Enclose the state transition NotReady->InInit->Ready. */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoInitSpan autoInitSpan(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mTimeout = 30 * 60 * 1000; /* Session timeout is 30 mins by default. */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mParent = aGuest;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mId = aSessionID;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mCredentials.mUser = aUser;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mCredentials.mPassword = aPassword;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mCredentials.mDomain = aDomain;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mName = aName;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync /* Confirm a successful initialization when it's the case. */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync autoInitSpan.setSucceeded();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowFuncLeaveRC(VINF_SUCCESS);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return VINF_SUCCESS;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync/**
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Uninitializes the instance.
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Called from FinalRelease().
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncvoid GuestSession::uninit(void)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync /* Enclose the state transition Ready->InUninit->NotReady. */
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync AutoUninitSpan autoUninitSpan(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (autoUninitSpan.uninitDone())
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifdef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itDirs != mData.mDirectories.end(); ++itDirs)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync (*itDirs)->uninit();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync (*itDirs).setNull();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mDirectories.clear();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync for (SessionFiles::iterator itFiles = mData.mFiles.begin();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itFiles != mData.mFiles.end(); ++itFiles)
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync (*itFiles)->uninit();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync (*itFiles).setNull();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
b1cc3e87518139898395f96974ecff9e6bf228fbvboxsync mData.mFiles.clear();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itProcs != mData.mProcesses.end(); ++itProcs)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itProcs->second->close();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itProcs != mData.mProcesses.end(); ++itProcs)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itProcs->second->uninit();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itProcs->second.setNull();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mProcesses.clear();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mParent->sessionClose(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFuncLeave();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync// implementation of public getters/setters for attributes
388b6b190a5407548753b7fde12fa58134ec3563vboxsync/////////////////////////////////////////////////////////////////////////////
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(User)(BSTR *aUser)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutPointerValid(aUser);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync mData.mCredentials.mUser.cloneTo(aUser);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Domain)(BSTR *aDomain)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutPointerValid(aDomain);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync mData.mCredentials.mDomain.cloneTo(aDomain);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Name)(BSTR *aName)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutPointerValid(aName);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync mData.mName.cloneTo(aName);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Id)(ULONG *aId)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutPointerValid(aId);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync *aId = mData.mId;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Timeout)(ULONG *aTimeout)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutPointerValid(aTimeout);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync *aTimeout = mData.mTimeout;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMSETTER(Timeout)(ULONG aTimeout)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync mData.mTimeout = aTimeout;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutSafeArrayPointerValid(aEnvironment);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync size_t cEnvVars = mData.mEnvironment.Size();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFunc(("%s cEnvVars=%RU32\n", mData.mName.c_str(), cEnvVars));
388b6b190a5407548753b7fde12fa58134ec3563vboxsync com::SafeArray<BSTR> environment(cEnvVars);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync for (size_t i = 0; i < cEnvVars; i++)
388b6b190a5407548753b7fde12fa58134ec3563vboxsync {
388b6b190a5407548753b7fde12fa58134ec3563vboxsync Bstr strEnv(mData.mEnvironment.Get(i));
388b6b190a5407548753b7fde12fa58134ec3563vboxsync strEnv.cloneTo(&environment[i]);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync }
388b6b190a5407548753b7fde12fa58134ec3563vboxsync environment.detachTo(ComSafeArrayOutArg(aEnvironment));
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Processes)(ComSafeArrayOut(IGuestProcess *, aProcesses))
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutSafeArrayPointerValid(aProcesses);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync SafeIfaceArray<IGuestProcess> collection(mData.mProcesses);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync collection.detachTo(ComSafeArrayOutArg(aProcesses));
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Directories)(ComSafeArrayOut(IGuestDirectory *, aDirectories))
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
388b6b190a5407548753b7fde12fa58134ec3563vboxsync ReturnComNotImplemented();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#else
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowThisFuncEnter();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync CheckComArgOutSafeArrayPointerValid(aDirectories);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoCaller autoCaller(this);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync SafeIfaceArray<IGuestDirectory> collection(mData.mDirectories);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync collection.detachTo(ComSafeArrayOutArg(aDirectories));
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsync LogFlowFuncLeaveRC(S_OK);
388b6b190a5407548753b7fde12fa58134ec3563vboxsync return S_OK;
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
388b6b190a5407548753b7fde12fa58134ec3563vboxsync}
388b6b190a5407548753b7fde12fa58134ec3563vboxsync
388b6b190a5407548753b7fde12fa58134ec3563vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Files)(ComSafeArrayOut(IGuestFile *, aFiles))
388b6b190a5407548753b7fde12fa58134ec3563vboxsync{
388b6b190a5407548753b7fde12fa58134ec3563vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#else
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync CheckComArgOutSafeArrayPointerValid(aFiles);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoCaller autoCaller(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync SafeIfaceArray<IGuestFile> collection(mData.mFiles);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync collection.detachTo(ComSafeArrayOutArg(aFiles));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowFuncLeaveRC(S_OK);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return S_OK;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync// private methods
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync/////////////////////////////////////////////////////////////////////////////
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncint GuestSession::directoryClose(ComObjPtr<GuestDirectory> pDirectory)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync itDirs != mData.mDirectories.end(); ++itDirs)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (pDirectory == (*itDirs))
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync mData.mDirectories.erase(itDirs);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return VINF_SUCCESS;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return VERR_NOT_FOUND;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncint GuestSession::dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync uint32_t uProcessID = VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifdef DEBUG
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowFunc(("uProcessID=%RU32 (%RU32 total)\n",
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync uProcessID, mData.mProcesses.size()));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync int rc;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync SessionProcesses::const_iterator itProc
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync = mData.mProcesses.find(uProcessID);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (itProc != mData.mProcesses.end())
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync {
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ComObjPtr<GuestProcess> pProcess(itProc->second);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Assert(!pProcess.isNull());
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync alock.release();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync rc = pProcess->callbackDispatcher(uContextID, uFunction, pvData, cbData);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync }
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync else
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync rc = VERR_NOT_FOUND;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowFuncLeaveRC(rc);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return rc;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncint GuestSession::fileClose(ComObjPtr<GuestFile> pFile)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync for (SessionFiles::iterator itFiles = mData.mFiles.begin();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync itFiles != mData.mFiles.end(); ++itFiles)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (pFile == (*itFiles))
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync {
c142e0f462e6c921a73d84ee50f41396b3a99db5vboxsync mData.mFiles.erase(itFiles);
c142e0f462e6c921a73d84ee50f41396b3a99db5vboxsync return VINF_SUCCESS;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VERR_NOT_FOUND;
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync}
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsyncconst GuestCredentials& GuestSession::getCredentials(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync return mData.mCredentials;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync}
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncconst GuestEnvironment& GuestSession::getEnvironment(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync return mData.mEnvironment;
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncint GuestSession::processClose(ComObjPtr<GuestProcess> pProcess)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync itProcs != mData.mProcesses.end(); ++itProcs)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (pProcess == itProcs->second)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync mData.mProcesses.erase(itProcs);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VINF_SUCCESS;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VERR_NOT_FOUND;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncint GuestSession::processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync{
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync LogFlowFunc(("mCmd=%s, mFlags=%x, mTimeoutMS=%RU32\n",
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync procInfo.mCommand.c_str(), procInfo.mFlags, procInfo.mTimeoutMS));
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync /* Validate flags. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (procInfo.mFlags)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync {
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync if ( !(procInfo.mFlags & ProcessCreateFlag_IgnoreOrphanedProcesses)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync && !(procInfo.mFlags & ProcessCreateFlag_WaitForProcessStartOnly)
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync && !(procInfo.mFlags & ProcessCreateFlag_Hidden)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync && !(procInfo.mFlags & ProcessCreateFlag_NoProfile)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync && !(procInfo.mFlags & ProcessCreateFlag_WaitForStdOut)
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync && !(procInfo.mFlags & ProcessCreateFlag_WaitForStdErr))
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync {
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync return VERR_INVALID_PARAMETER;
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync }
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync }
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync /* Adjust timeout. If set to 0, we define
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync * an infinite timeout. */
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync if (procInfo.mTimeoutMS == 0)
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync procInfo.mTimeoutMS = UINT32_MAX;
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync /** @tood Implement process priority + affinity. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync int rc = VERR_MAX_PROCS_REACHED;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync if (mData.mProcesses.size() >= VBOX_GUESTCTRL_MAX_PROCESSES)
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync return rc;
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /* Create a new (host-based) process ID and assign it. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ULONG uNewProcessID = 0;
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync ULONG uTries = 0;
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync for (;;)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Is the context ID already used? */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (!processExists(uNewProcessID, NULL /* pProgress */))
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Callback with context ID was not found. This means
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync * we can use this context ID for our new callback we want
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * to add below. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync rc = VINF_SUCCESS;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync break;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync uNewProcessID++;
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (++uTries == UINT32_MAX)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync break; /* Don't try too hard. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (RT_FAILURE(rc)) throw rc;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync try
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync /* Create the process object. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync HRESULT hr = pProcess.createObject();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (FAILED(hr)) throw VERR_COM_UNEXPECTED;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync rc = pProcess->init(mData.mParent->getConsole() /* Console */, this /* Session */,
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync uNewProcessID, procInfo);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (RT_FAILURE(rc)) throw rc;
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Add the created process to our map. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync mData.mProcesses[uNewProcessID] = pProcess;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32\n",
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync mData.mId, uNewProcessID));
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync catch (int rc2)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync rc = rc2;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return rc;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncinline bool GuestSession::processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess)
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync SessionProcesses::const_iterator it = mData.mProcesses.find(uProcessID);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (it != mData.mProcesses.end())
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (pProcess)
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync *pProcess = it->second;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return true;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return false;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsyncinline int GuestSession::processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertReturn(uPID, false);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* pProcess is optional. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync SessionProcesses::iterator it = mData.mProcesses.begin();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync for (; it != mData.mProcesses.end(); it++)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ComObjPtr<GuestProcess> pCurProc = it->second;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller procCaller(pCurProc);
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (procCaller.rc())
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VERR_COM_INVALID_OBJECT_STATE;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (it->second->getPID() == uPID)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (pProcess)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync *pProcess = pCurProc;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VINF_SUCCESS;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync }
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync return VERR_NOT_FOUND;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/**
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Queries/collects information prior to establishing a guest session.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This is necessary to know which guest control protocol version to use,
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * among other things (later).
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync *
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * @return IPRT status code.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsyncint GuestSession::queryInfo(void)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /*
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Try querying the guest control protocol version running on the guest.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This is done using the Guest Additions version
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ComObjPtr<Guest> pGuest = mData.mParent;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync Assert(!pGuest.isNull());
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync uint32_t uVerAdditions = pGuest->getAdditionsVersion();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync mData.mProtocolVersion = ( VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions) >= 4
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync && VBOX_FULL_VERSION_GET_MINOR(uVerAdditions) >= 2 )
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ? 2 /* Guest control 2.0. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync : 1; /* Legacy guest control (VBox < 4.2). */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Build revision is ignored. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /* Tell the user but don't bitch too often. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync static short s_gctrlLegacyWarning = 0;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (s_gctrlLegacyWarning++ < 3) /** @todo Find a bit nicer text. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogRel((tr("Warning: Guest Additions are older (%ld.%ld) than host capabilities for guest control, please upgrade them. Using protocol version %ld now\n"),
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync VBOX_FULL_VERSION_GET_MAJOR(uVerAdditions), VBOX_FULL_VERSION_GET_MINOR(uVerAdditions), mData.mProtocolVersion));
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync return VINF_SUCCESS;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync// implementation of public methods
7e8ef90d3160234df0f254131b87af4243d79476vboxsync/////////////////////////////////////////////////////////////////////////////
7e8ef90d3160234df0f254131b87af4243d79476vboxsync
7e8ef90d3160234df0f254131b87af4243d79476vboxsyncSTDMETHODIMP GuestSession::Close(void)
7e8ef90d3160234df0f254131b87af4243d79476vboxsync{
7e8ef90d3160234df0f254131b87af4243d79476vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
7e8ef90d3160234df0f254131b87af4243d79476vboxsync ReturnComNotImplemented();
7e8ef90d3160234df0f254131b87af4243d79476vboxsync#else
7e8ef90d3160234df0f254131b87af4243d79476vboxsync LogFlowThisFuncEnter();
7e8ef90d3160234df0f254131b87af4243d79476vboxsync
7e8ef90d3160234df0f254131b87af4243d79476vboxsync uninit();
7e8ef90d3160234df0f254131b87af4243d79476vboxsync
7e8ef90d3160234df0f254131b87af4243d79476vboxsync LogFlowFuncLeaveRC(S_OK);
7e8ef90d3160234df0f254131b87af4243d79476vboxsync return S_OK;
7e8ef90d3160234df0f254131b87af4243d79476vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
7e8ef90d3160234df0f254131b87af4243d79476vboxsync}
7e8ef90d3160234df0f254131b87af4243d79476vboxsync
7e8ef90d3160234df0f254131b87af4243d79476vboxsyncSTDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
7e8ef90d3160234df0f254131b87af4243d79476vboxsync{
7e8ef90d3160234df0f254131b87af4243d79476vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
06ea6bcf23874b662d499b3f130024c98b2dd7a6vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#else
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync AutoCaller autoCaller(this);
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync}
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsyncSTDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aProgress)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync LogFlowThisFuncEnter();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync AutoCaller autoCaller(this);
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ReturnComNotImplemented();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync}
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsyncSTDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory)
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync{
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ReturnComNotImplemented();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#else
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync LogFlowThisFuncEnter();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync AutoCaller autoCaller(this);
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ReturnComNotImplemented();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync}
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsyncSTDMETHODIMP GuestSession::DirectoryExists(IN_BSTR aPath, BOOL *aExists)
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync{
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync ReturnComNotImplemented();
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::DirectoryQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#else
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync}
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#else
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncSTDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync{
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync AutoCaller autoCaller(this);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync}
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsyncSTDMETHODIMP GuestSession::DirectorySetACL(IN_BSTR aPath, IN_BSTR aACL)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync{
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoCaller autoCaller(this);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync ReturnComNotImplemented();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync}
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsyncSTDMETHODIMP GuestSession::EnvironmentClear(void)
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync{
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync ReturnComNotImplemented();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#else
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowThisFuncEnter();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoCaller autoCaller(this);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync mData.mEnvironment.Clear();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowFuncLeaveRC(S_OK);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync return S_OK;
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync}
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsyncSTDMETHODIMP GuestSession::EnvironmentGet(IN_BSTR aName, BSTR *aValue)
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync{
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync ReturnComNotImplemented();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#else
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowThisFuncEnter();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync return setError(E_INVALIDARG, tr("No value name specified"));
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync CheckComArgOutPointerValid(aValue);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoCaller autoCaller(this);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync Bstr strValue(mData.mEnvironment.Get(Utf8Str(aName)));
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync strValue.cloneTo(aValue);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowFuncLeaveRC(S_OK);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync return S_OK;
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync}
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsyncSTDMETHODIMP GuestSession::EnvironmentSet(IN_BSTR aName, IN_BSTR aValue)
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync{
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync ReturnComNotImplemented();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#else
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowThisFuncEnter();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync return setError(E_INVALIDARG, tr("No value name specified"));
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoCaller autoCaller(this);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync int rc = mData.mEnvironment.Set(Utf8Str(aName), Utf8Str(aValue));
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowFuncLeaveRC(hr);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync return hr;
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync}
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsyncSTDMETHODIMP GuestSession::EnvironmentSetArray(ComSafeArrayIn(IN_BSTR, aValues))
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync{
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync ReturnComNotImplemented();
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync#else
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync LogFlowThisFuncEnter();
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync AutoCaller autoCaller(this);
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aValues));
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync int rc = VINF_SUCCESS;
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync {
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync Utf8Str strEnv(environment[i]);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync if (!strEnv.isEmpty()) /* Silently skip empty entries. */
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync rc = mData.mEnvironment.Set(strEnv);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync }
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync LogFlowFuncLeaveRC(hr);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync return hr;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync}
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsyncSTDMETHODIMP GuestSession::EnvironmentUnset(IN_BSTR aName)
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync{
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync ReturnComNotImplemented();
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync#else
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync LogFlowThisFuncEnter();
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync AutoCaller autoCaller(this);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync mData.mEnvironment.Unset(Utf8Str(aName));
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowFuncLeaveRC(S_OK);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync return S_OK;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync}
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsyncSTDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync{
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileExists(IN_BSTR aPath, BOOL *aExists)
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile)
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileQuerySize(IN_BSTR aPath, LONG64 *aSize)
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath)
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#else
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync LogFlowThisFuncEnter();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync AutoCaller autoCaller(this);
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync ReturnComNotImplemented();
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync}
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsyncSTDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync{
e378dfdadd62aadc0a012c9953322d979d7606e6vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync ReturnComNotImplemented();
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync#else
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync LogFlowThisFuncEnter();
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync AutoCaller autoCaller(this);
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync ReturnComNotImplemented();
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync}
40c1a23e86c79b24a917a43c186b2e54504d12c1vboxsync
40c1a23e86c79b24a917a43c186b2e54504d12c1vboxsyncSTDMETHODIMP GuestSession::FileSetACL(IN_BSTR aPath, IN_BSTR aACL)
40c1a23e86c79b24a917a43c186b2e54504d12c1vboxsync{
40c1a23e86c79b24a917a43c186b2e54504d12c1vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
40c1a23e86c79b24a917a43c186b2e54504d12c1vboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync AutoCaller autoCaller(this);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync}
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsyncSTDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync{
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync com::SafeArray<LONG> affinity;
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync HRESULT hr = ProcessCreateEx(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync ComSafeArrayInArg(aFlags), aTimeoutMS, ProcessPriority_Default, ComSafeArrayAsInParam(affinity), aProcess);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowFuncLeaveRC(hr);
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync return hr;
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync}
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsyncSTDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
7e8ef90d3160234df0f254131b87af4243d79476vboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
7e8ef90d3160234df0f254131b87af4243d79476vboxsync ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
7e8ef90d3160234df0f254131b87af4243d79476vboxsync IGuestProcess **aProcess)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync{
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (RT_UNLIKELY((aCommand) == NULL || *(aCommand) == '\0'))
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync return setError(E_INVALIDARG, tr("No command to execute specified"));
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync CheckComArgOutPointerValid(aProcess);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync AutoCaller autoCaller(this);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync GuestProcessInfo procInfo;
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync procInfo.mCommand = Utf8Str(aCommand);
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync procInfo.mFlags = ProcessCreateFlag_None;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync if (aArguments)
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync {
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync com::SafeArray<IN_BSTR> arguments(ComSafeArrayInArg(aArguments));
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync for (size_t i = 0; i < arguments.size(); i++)
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync procInfo.mArguments.push_back(Utf8Str(arguments[i]));
907b6adfa052386a0666d5557bee9bdbc100c2e5vboxsync }
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync int rc = VINF_SUCCESS;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync /*
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync * Create the process environment:
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync * - Apply the session environment in a first step, and
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync * - Apply environment variables specified by this call to
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync * have the chance of overwriting/deleting session entries.
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync procInfo.mEnvironment = mData.mEnvironment; /* Apply original session environment. */
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync if (aEnvironment)
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync {
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aEnvironment));
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync rc = procInfo.mEnvironment.Set(Utf8Str(environment[i]));
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync }
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync HRESULT hr = S_OK;
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync if (RT_SUCCESS(rc))
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync {
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync if (aFlags)
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync {
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync com::SafeArray<ProcessCreateFlag_T> flags(ComSafeArrayInArg(aFlags));
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync for (size_t i = 0; i < flags.size(); i++)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync procInfo.mFlags |= flags[i];
ed9d3db07648c7e3a979105c15ad752ee9ea18devboxsync }
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync procInfo.mTimeoutMS = aTimeoutMS;
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync if (aAffinity)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync {
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync com::SafeArray<LONG> affinity(ComSafeArrayInArg(aAffinity));
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync for (size_t i = 0; i < affinity.size(); i++)
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync procInfo.mAffinity[i] = affinity[i]; /** @todo Really necessary? Later. */
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync }
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync procInfo.mPriority = aPriority;
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ComObjPtr<GuestProcess> pProcess;
ccbdc11833996cb9f3be7868f1ebaefcacafb94dvboxsync rc = processCreateExInteral(procInfo, pProcess);
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync if (RT_SUCCESS(rc))
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync {
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync /* Return guest session to the caller. */
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync if (FAILED(hr2))
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync rc = VERR_COM_OBJECT_NOT_FOUND;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync if (RT_SUCCESS(rc))
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync rc = pProcess->startProcessAsync();
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync }
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync }
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync if (RT_FAILURE(rc))
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync {
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync switch (rc)
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync {
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync case VERR_MAX_PROCS_REACHED:
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of guest processes per session (%ld) reached"),
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync VBOX_GUESTCTRL_MAX_PROCESSES);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync break;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync /** @todo Add more errors here. */
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync default:
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest process, rc=%Rrc"), rc);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync break;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync }
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync }
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync LogFlowFuncLeaveRC(rc);
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync return hr;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync}
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsyncSTDMETHODIMP GuestSession::ProcessGet(ULONG aPID, IGuestProcess **aProcess)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#else
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFunc(("aPID=%RU32\n", aPID));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync CheckComArgOutPointerValid(aProcess);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (aPID == 0)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return setError(E_INVALIDARG, tr("No valid process ID (PID) specified"));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoCaller autoCaller(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync HRESULT hr = S_OK;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ComObjPtr<GuestProcess> pProcess;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync int rc = processGetByPID(aPID, &pProcess);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (RT_FAILURE(rc))
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPID);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync /* This will set (*aProcess) to NULL if pProgress is NULL. */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (SUCCEEDED(hr))
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync hr = hr2;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", *aProcess, hr));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return hr;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#if 0
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncSTDMETHODIMP GuestSession::SetTimeout(ULONG aTimeoutMS)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#else
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync LogFlowThisFuncEnter();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync AutoCaller autoCaller(this);
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync if (aTimeoutMS < 1000)
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync return setError(E_INVALIDARG, tr("Invalid timeout value specified"));
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync mData.mTimeout = aTimeoutMS;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFunc(("aTimeoutMS=%RU32\n", mData.mTimeout));
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync return S_OK;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync}
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync#endif
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsyncSTDMETHODIMP GuestSession::SymlinkCreate(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType)
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync{
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync ReturnComNotImplemented();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync#else
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync AutoCaller autoCaller(this);
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync ReturnComNotImplemented();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync}
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsyncSTDMETHODIMP GuestSession::SymlinkExists(IN_BSTR aSymlink, BOOL *aExists)
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync ReturnComNotImplemented();
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync#else
f9ce005e61f0fbb51a2cabc53d58c3485151faa9vboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsyncSTDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync{
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#else
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync LogFlowThisFuncEnter();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AutoCaller autoCaller(this);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncSTDMETHODIMP GuestSession::SymlinkRemoveDirectory(IN_BSTR aPath)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync#else
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoCaller autoCaller(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync}
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncSTDMETHODIMP GuestSession::SymlinkRemoveFile(IN_BSTR aFile)
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#else
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync LogFlowThisFuncEnter();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync AutoCaller autoCaller(this);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ReturnComNotImplemented();
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync}
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync