GuestSessionImpl.cpp revision ed9d3db07648c7e3a979105c15ad752ee9ea18de
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/* $Id$ */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/** @file
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * VirtualBox Main - XXX.
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/*
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Copyright (C) 2012 Oracle Corporation
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync *
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * available from http://www.virtualbox.org. This file is free software;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * you can redistribute it and/or modify it under the terms of the GNU
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * General Public License (GPL) as published by the Free Software
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/*******************************************************************************
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync* Header Files *
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync*******************************************************************************/
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "GuestImpl.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "GuestSessionImpl.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "Global.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "AutoCaller.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include "Logging.h"
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <iprt/env.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#include <VBox/com/array.h>
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync// constructor / destructor
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/////////////////////////////////////////////////////////////////////////////
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncDEFINE_EMPTY_CTOR_DTOR(GuestSession)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncHRESULT GuestSession::FinalConstruct(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFunc(("\n"));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return BaseFinalConstruct();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncvoid GuestSession::FinalRelease(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync BaseFinalRelease();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncLeave();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync// public initializer/uninitializer for internal purposes only
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/////////////////////////////////////////////////////////////////////////////
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::init(Guest *aGuest, ULONG aSessionID,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AssertPtrReturn(aGuest, VERR_INVALID_POINTER);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Enclose the state transition NotReady->InInit->Ready. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoInitSpan autoInitSpan(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mTimeout = 30 * 60 * 1000; /* Session timeout is 30 mins by default. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mParent = aGuest;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mId = aSessionID;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mCredentials.mUser = aUser;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mCredentials.mPassword = aPassword;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mCredentials.mDomain = aDomain;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mName = aName;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Confirm a successful initialization when it's the case. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync autoInitSpan.setSucceeded();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(VINF_SUCCESS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/**
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Uninitializes the instance.
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * Called from FinalRelease().
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncvoid GuestSession::uninit(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Enclose the state transition Ready->InUninit->NotReady. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoUninitSpan autoUninitSpan(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (autoUninitSpan.uninitDone())
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifdef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itDirs != mData.mDirectories.end(); ++itDirs)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync (*itDirs)->uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync (*itDirs).setNull();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mDirectories.clear();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionFiles::iterator itFiles = mData.mFiles.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itFiles != mData.mFiles.end(); ++itFiles)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync (*itFiles)->uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync (*itFiles).setNull();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mFiles.clear();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs != mData.mProcesses.end(); ++itProcs)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs->second->close();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs != mData.mProcesses.end(); ++itProcs)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs->second->uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs->second.setNull();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mProcesses.clear();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mParent->sessionClose(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncLeave();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync// implementation of public getters/setters for attributes
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/////////////////////////////////////////////////////////////////////////////
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::COMGETTER(User)(BSTR *aUser)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CheckComArgOutPointerValid(aUser);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mCredentials.mUser.cloneTo(aUser);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Domain)(BSTR *aDomain)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aDomain);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync mData.mCredentials.mDomain.cloneTo(aDomain);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Name)(BSTR *aName)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aName);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync mData.mName.cloneTo(aName);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Id)(ULONG *aId)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aId);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync *aId = mData.mId;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Timeout)(ULONG *aTimeout)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aTimeout);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync *aTimeout = mData.mTimeout;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutSafeArrayPointerValid(aEnvironment);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync size_t cEnvVars = mData.mEnvironment.Size();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFunc(("%s cEnvVars=%RU32\n", mData.mName.c_str(), cEnvVars));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync com::SafeArray<BSTR> environment(cEnvVars);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (size_t i = 0; i < cEnvVars; i++)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync Bstr strEnv(mData.mEnvironment.Get(i));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync strEnv.cloneTo(&environment[i]);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync environment.detachTo(ComSafeArrayOutArg(aEnvironment));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::COMGETTER(Processes)(ComSafeArrayOut(IGuestProcess *, aProcesses))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CheckComArgOutSafeArrayPointerValid(aProcesses);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SafeIfaceArray<IGuestProcess> collection(mData.mProcesses);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync collection.detachTo(ComSafeArrayOutArg(aProcesses));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::COMGETTER(Directories)(ComSafeArrayOut(IGuestDirectory *, aDirectories))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CheckComArgOutSafeArrayPointerValid(aDirectories);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SafeIfaceArray<IGuestDirectory> collection(mData.mDirectories);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync collection.detachTo(ComSafeArrayOutArg(aDirectories));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::COMGETTER(Files)(ComSafeArrayOut(IGuestFile *, aFiles))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CheckComArgOutSafeArrayPointerValid(aFiles);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SafeIfaceArray<IGuestFile> collection(mData.mFiles);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync collection.detachTo(ComSafeArrayOutArg(aFiles));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync// private methods
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/////////////////////////////////////////////////////////////////////////////
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::directoryClose(ComObjPtr<GuestDirectory> pDirectory)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itDirs != mData.mDirectories.end(); ++itDirs)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (pDirectory == (*itDirs))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mDirectories.erase(itDirs);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::dispatchToProcess(uint32_t uContextID, uint32_t uFunction, void *pvData, size_t cbData)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AssertPtrReturn(pvData, VERR_INVALID_POINTER);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AssertReturn(cbData, VERR_INVALID_PARAMETER);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SessionProcesses::const_iterator itProc
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync = mData.mProcesses.find(VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (itProc != mData.mProcesses.end())
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ComObjPtr<GuestProcess> pProcess(itProc->second);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync Assert(!pProcess.isNull());
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync alock.release();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = pProcess->callbackDispatcher(uContextID, uFunction, pvData, cbData);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = VERR_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(rc);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::fileClose(ComObjPtr<GuestFile> pFile)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionFiles::iterator itFiles = mData.mFiles.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itFiles != mData.mFiles.end(); ++itFiles)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (pFile == (*itFiles))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mFiles.erase(itFiles);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncconst GuestCredentials& GuestSession::getCredentials(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return mData.mCredentials;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncconst GuestEnvironment& GuestSession::getEnvironment(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return mData.mEnvironment;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::processClose(ComObjPtr<GuestProcess> pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync itProcs != mData.mProcesses.end(); ++itProcs)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (pProcess == itProcs->second)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mProcesses.erase(itProcs);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncint GuestSession::processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Validate flags. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (procInfo.mFlags)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if ( !(procInfo.mFlags & ProcessCreateFlag_IgnoreOrphanedProcesses)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync && !(procInfo.mFlags & ProcessCreateFlag_WaitForProcessStartOnly)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync && !(procInfo.mFlags & ProcessCreateFlag_Hidden)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync && !(procInfo.mFlags & ProcessCreateFlag_NoProfile))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_INVALID_PARAMETER;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Adjust timeout. If set to 0, we define
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * an infinite timeout. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (procInfo.mTimeoutMS == 0)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync procInfo.mTimeoutMS = UINT32_MAX;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /** @tood Implement process priority + affinity. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int rc = VERR_MAX_PROCS_REACHED;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (mData.mProcesses.size() >= VBOX_GUESTCTRL_MAX_PROCESSES)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Create a new (host-based) process ID and assign it. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ULONG uNewProcessID = 0;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ULONG uTries = 0;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (;;)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Is the context ID already used? */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (!processExists(uNewProcessID, NULL /* pProgress */))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Callback with context ID was not found. This means
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * we can use this context ID for our new callback we want
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync * to add below. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync break;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uNewProcessID++;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (++uTries == UINT32_MAX)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync break; /* Don't try too hard. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (RT_FAILURE(rc)) throw rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync try
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Create the process object. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync HRESULT hr = pProcess.createObject();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(hr)) throw VERR_COM_UNEXPECTED;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = pProcess->init(mData.mParent->getConsole() /* Console */, this /* Session */,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uNewProcessID, procInfo);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (RT_FAILURE(rc)) throw rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* Add the created process to our map. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mProcesses[uNewProcessID] = pProcess;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync catch (int rc2)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = rc2;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return rc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncinline bool GuestSession::processExists(ULONG uProcessID, ComObjPtr<GuestProcess> *pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SessionProcesses::const_iterator it = mData.mProcesses.find(uProcessID);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (it != mData.mProcesses.end())
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync *pProcess = it->second;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return true;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return false;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncinline int GuestSession::processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AssertReturn(uPID, false);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync /* pProcess is optional. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync SessionProcesses::iterator it = mData.mProcesses.begin();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync for (; it != mData.mProcesses.end(); it++)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ComObjPtr<GuestProcess> pCurProc = it->second;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller procCaller(pCurProc);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (procCaller.rc())
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_COM_INVALID_OBJECT_STATE;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (it->second->getPID() == uPID)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (pProcess)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync *pProcess = pCurProc;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VINF_SUCCESS;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return VERR_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync// implementation of public methods
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync/////////////////////////////////////////////////////////////////////////////
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::Close(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync uninit();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aProgress)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryExists(IN_BSTR aPath, BOOL *aExists)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::DirectorySetACL(IN_BSTR aPath, IN_BSTR aACL)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::EnvironmentClear(void)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync mData.mEnvironment.Clear();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::EnvironmentGet(IN_BSTR aName, BSTR *aValue)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return setError(E_INVALIDARG, tr("No value name specified"));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync CheckComArgOutPointerValid(aValue);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync Bstr strValue(mData.mEnvironment.Get(Utf8Str(aName)));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync strValue.cloneTo(aValue);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(S_OK);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return S_OK;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::EnvironmentSet(IN_BSTR aName, IN_BSTR aValue)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (RT_UNLIKELY((aName) == NULL || *(aName) == '\0'))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return setError(E_INVALIDARG, tr("No value name specified"));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync int rc = mData.mEnvironment.Set(Utf8Str(aName), Utf8Str(aValue));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowFuncLeaveRC(hr);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return hr;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::EnvironmentSetArray(ComSafeArrayIn(IN_BSTR, aValues))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aValues));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync int rc = VINF_SUCCESS;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync Utf8Str strEnv(environment[i]);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (!strEnv.isEmpty()) /* Silently skip empty entries. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync rc = mData.mEnvironment.Set(strEnv);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr = RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(hr);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return hr;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::EnvironmentUnset(IN_BSTR aName)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync mData.mEnvironment.Unset(Utf8Str(aName));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(S_OK);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileExists(IN_BSTR aPath, BOOL *aExists)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileQuerySize(IN_BSTR aPath, LONG64 *aSize)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::FileSetACL(IN_BSTR aPath, IN_BSTR aACL)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync com::SafeArray<LONG> affinity;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr = ProcessCreateEx(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ComSafeArrayInArg(aFlags), aTimeoutMS, ProcessPriority_Default, ComSafeArrayAsInParam(affinity), aProcess);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(hr);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return hr;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync IGuestProcess **aProcess)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (RT_UNLIKELY((aCommand) == NULL || *(aCommand) == '\0'))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return setError(E_INVALIDARG, tr("No command to execute specified"));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aProcess);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync GuestProcessInfo procInfo;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mCommand = Utf8Str(aCommand);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mFlags = ProcessCreateFlag_None;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (aArguments)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync com::SafeArray<IN_BSTR> arguments(ComSafeArrayInArg(aArguments));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync for (size_t i = 0; i < arguments.size(); i++)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mArguments.push_back(Utf8Str(arguments[i]));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync int rc = VINF_SUCCESS;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /*
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync * Create the process environment:
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync * - Apply the session environment in a first step, and
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync * - Apply environment variables specified by this call to
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync * have the chance of overwriting/deleting session entries.
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mEnvironment = mData.mEnvironment; /* Apply original session environment. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (aEnvironment)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aEnvironment));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync rc = mData.mEnvironment.Set(Utf8Str(environment[i]));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr = S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (RT_SUCCESS(rc))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (aFlags)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync com::SafeArray<ProcessCreateFlag_T> flags(ComSafeArrayInArg(aFlags));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync for (size_t i = 0; i < flags.size(); i++)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mFlags |= flags[i];
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mTimeoutMS = aTimeoutMS;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (aAffinity)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync com::SafeArray<LONG> affinity(ComSafeArrayInArg(aAffinity));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync for (size_t i = 0; i < affinity.size(); i++)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mAffinity[i] = affinity[i]; /** @todo Really necessary? Later. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync procInfo.mPriority = aPriority;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ComObjPtr<GuestProcess> pProcess;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync rc = processCreateExInteral(procInfo, pProcess);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (RT_SUCCESS(rc))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /* Return guest session to the caller. */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(hr2))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = VERR_COM_OBJECT_NOT_FOUND;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (RT_SUCCESS(rc))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync rc = pProcess->startProcessAsync();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (RT_FAILURE(rc))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync switch (rc)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync {
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync case VERR_MAX_PROCS_REACHED:
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of guest processes (%ld) reached"),
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync VERR_MAX_PROCS_REACHED);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync break;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /** @todo Add more errors here. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync default:
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest process, rc=%Rrc"), rc);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync break;
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync }
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync }
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowFuncLeaveRC(rc);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return hr;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::ProcessGet(ULONG aPID, IGuestProcess **aProcess)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFunc(("aPID=%RU32\n", aPID));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync CheckComArgOutPointerValid(aProcess);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (aPID == 0)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return setError(E_INVALIDARG, tr("No valid process ID (PID) specified"));
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr = S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ComObjPtr<GuestProcess> pProcess;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync int rc = processGetByPID(aPID, &pProcess);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (RT_FAILURE(rc))
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync hr = setError(E_INVALIDARG, tr("No process with PID %RU32 found"), aPID);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync /* This will set (*aProcess) to NULL if pProgress is NULL. */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync HRESULT hr2 = pProcess.queryInterfaceTo(aProcess);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (SUCCEEDED(hr))
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync hr = hr2;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFunc(("aProcess=%p, hr=%Rhrc\n", *aProcess, hr));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return hr;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::SetTimeout(ULONG aTimeoutMS)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (aTimeoutMS < 1000)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync return setError(E_INVALIDARG, tr("Invalid timeout value specified"));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync mData.mTimeout = aTimeoutMS;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFunc(("aTimeoutMS=%RU32\n", mData.mTimeout));
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync return S_OK;
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::SymlinkCreate(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsyncSTDMETHODIMP GuestSession::SymlinkExists(IN_BSTR aSymlink, BOOL *aExists)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::SymlinkRemoveDirectory(IN_BSTR aPath)
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsyncSTDMETHODIMP GuestSession::SymlinkRemoveFile(IN_BSTR aFile)
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync{
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#ifndef VBOX_WITH_GUEST_CONTROL
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#else
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync LogFlowThisFuncEnter();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync AutoCaller autoCaller(this);
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync if (FAILED(autoCaller.rc())) return autoCaller.rc();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync ReturnComNotImplemented();
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync#endif /* VBOX_WITH_GUEST_CONTROL */
50671c30431539dd7d6ff6a5f2ceb6c9f9f471b2vboxsync}
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync
9888fffcfbe2d41dce14a1249b12cb88cc9b149fvboxsync