2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/* $Id$ */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/** @file
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * VirtualBox Main - Guest session handling.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * Copyright (C) 2012-2013 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#ifndef ____H_GUESTSESSIONIMPL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#define ____H_GUESTSESSIONIMPL
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync#include "GuestSessionWrap.h"
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync#include "EventImpl.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
5f2b03bf7695dabd71222dba123532a3f76828c1vboxsync#include "GuestCtrlImplPrivate.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "GuestProcessImpl.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "GuestDirectoryImpl.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#include "GuestFileImpl.h"
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync#include "GuestFsObjInfoImpl.h"
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
c4b821bf03ae7641a0791e3fd161247e66433b68vboxsync#include <iprt/isofs.h> /* For UpdateAdditions. */
c4b821bf03ae7641a0791e3fd161247e66433b68vboxsync
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsyncclass Guest;
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/**
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Abstract base class for a lenghtly per-session operation which
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * runs in a Main worker thread.
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncclass GuestSessionTask
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync GuestSessionTask(GuestSession *pSession);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync virtual ~GuestSessionTask(void);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync virtual int Run(void) = 0;
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync virtual int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress) = 0;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsyncprotected:
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync int getGuestProperty(const ComObjPtr<Guest> &pGuest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const Utf8Str &strPath, Utf8Str &strValue);
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync int setProgress(ULONG uPercent);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync int setProgressSuccess(void);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncprotected:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str mDesc;
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync GuestSession *mSession;
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync /** Progress object for getting updated when running
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync * asynchronously. Optional. */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync ComObjPtr<Progress> mProgress;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync};
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync/**
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * Task for opening a guest session.
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsyncclass SessionTaskOpen : public GuestSessionTask
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync{
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsyncpublic:
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync SessionTaskOpen(GuestSession *pSession,
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync uint32_t uFlags,
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync uint32_t uTimeoutMS);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync virtual ~SessionTaskOpen(void);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsyncpublic:
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync int Run(int *pGuestRc);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync static int taskThread(RTTHREAD Thread, void *pvUser);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsyncprotected:
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /** Session creation flags. */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync uint32_t mFlags;
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /** Session creation timeout (in ms). */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync uint32_t mTimeoutMS;
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync};
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync/**
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Task for copying files from host to the guest.
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncclass SessionTaskCopyTo : public GuestSessionTask
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync SessionTaskCopyTo(GuestSession *pSession,
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync SessionTaskCopyTo(GuestSession *pSession,
c740281e4f5e61397e892447aeef2a7bdbbaaf8dvboxsync PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize,
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync const Utf8Str &strDest, uint32_t uFlags);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync virtual ~SessionTaskCopyTo(void);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync int Run(void);
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync static int taskThread(RTTHREAD Thread, void *pvUser);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncprotected:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str mSource;
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync PRTFILE mSourceFile;
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync size_t mSourceOffset;
3d33b6a3faf40871bae75119c2569cdc4acb2d46vboxsync uint64_t mSourceSize;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str mDest;
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync uint32_t mCopyFileFlags;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync};
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync/**
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Task for copying files from guest to the host.
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync */
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncclass SessionTaskCopyFrom : public GuestSessionTask
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync{
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync SessionTaskCopyFrom(GuestSession *pSession,
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync virtual ~SessionTaskCopyFrom(void);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncpublic:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync int Run(void);
6b9d50a0f466bd5a61458ed53925480ab28a3c17vboxsync int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync static int taskThread(RTTHREAD Thread, void *pvUser);
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsyncprotected:
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str mSource;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync Utf8Str mDest;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync uint32_t mFlags;
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync};
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync/**
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync * Task for automatically updating the Guest Additions on the guest.
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync */
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsyncclass SessionTaskUpdateAdditions : public GuestSessionTask
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync{
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsyncpublic:
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync SessionTaskUpdateAdditions(GuestSession *pSession,
2e4df4fd9eace3c61be68bb5eb12a93f9a79334dvboxsync const Utf8Str &strSource, const ProcessArguments &aArguments,
2e4df4fd9eace3c61be68bb5eb12a93f9a79334dvboxsync uint32_t uFlags);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync virtual ~SessionTaskUpdateAdditions(void);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsyncpublic:
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync int Run(void);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync static int taskThread(RTTHREAD Thread, void *pvUser);
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsyncprotected:
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /**
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync * Suported OS types for automatic updating.
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync enum eOSType
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync {
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync eOSType_Unknown = 0,
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync eOSType_Windows = 1,
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync eOSType_Linux = 2,
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync eOSType_Solaris = 3
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync };
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /**
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync * Structure representing a file to
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync * get off the .ISO, copied to the guest.
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync struct InstallerFile
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync {
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync InstallerFile(const Utf8Str &aSource,
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync const Utf8Str &aDest,
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync uint32_t aFlags = 0)
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync : strSource(aSource),
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync strDest(aDest),
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync fFlags(aFlags) { }
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync InstallerFile(const Utf8Str &aSource,
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync const Utf8Str &aDest,
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync uint32_t aFlags,
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync GuestProcessStartupInfo startupInfo)
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync : strSource(aSource),
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync strDest(aDest),
7c3bf57b1f6df237b1075e7cae6b188db6fc636avboxsync fFlags(aFlags),
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync mProcInfo(startupInfo)
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync {
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync mProcInfo.mCommand = strDest;
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync if (mProcInfo.mName.isEmpty())
3c6306a66deef467e3c13483dd6529e1e1c6b822vboxsync mProcInfo.mName = strDest;
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync }
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /** Source file on .ISO. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync Utf8Str strSource;
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /** Destination file on the guest. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync Utf8Str strDest;
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /** File flags. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync uint32_t fFlags;
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /** Optional arguments if this file needs to be
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync * executed. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync GuestProcessStartupInfo mProcInfo;
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync };
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_addProcessArguments(ProcessArguments &aArgumentsDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const ProcessArguments &aArgumentsSource);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync Utf8Str const &strFileSource, const Utf8Str &strFileDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync bool fOptional, uint32_t *pcbSize);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo);
c4b821bf03ae7641a0791e3fd161247e66433b68vboxsync
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync /** Files to handle. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync std::vector<InstallerFile> mFiles;
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync /** The (optionally) specified Guest Additions .ISO on the host
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync * which will be used for the updating process. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync Utf8Str mSource;
2e4df4fd9eace3c61be68bb5eb12a93f9a79334dvboxsync /** (Optional) installer command line arguments. */
2e4df4fd9eace3c61be68bb5eb12a93f9a79334dvboxsync ProcessArguments mArguments;
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync /** Update flags. */
cd059a6642b11828bd0ad8b3108f5f7f611d144fvboxsync uint32_t mFlags;
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync};
88cc9bf61296bc5526344415167bb2625ae1dd99vboxsync
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync/**
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync * Guest session implementation.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncclass ATL_NO_VTABLE GuestSession :
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync public GuestSessionWrap,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync public GuestBase
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync{
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncpublic:
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name COM and internal init/term/mapping cruft.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * @{ */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync DECLARE_EMPTY_CTOR_DTOR(GuestSession)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync void uninit(void);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync HRESULT FinalConstruct(void);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync void FinalRelease(void);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @} */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsyncprivate:
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync /** Wrapped @name IGuestSession properties.
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync * @{ */
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getUser(com::Utf8Str &aUser);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getDomain(com::Utf8Str &aDomain);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getName(com::Utf8Str &aName);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getId(ULONG *aId);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getTimeout(ULONG *aTimeout);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT setTimeout(ULONG aTimeout);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getProtocolVersion(ULONG *aProtocolVersion);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getStatus(GuestSessionStatus_T *aStatus);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getEnvironment(std::vector<com::Utf8Str> &aEnvironment);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT setEnvironment(const std::vector<com::Utf8Str> &aEnvironment);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync /** @} */
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync /** Wrapped @name IGuestSession methods.
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync * @{ */
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT close();
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT copyFrom(const com::Utf8Str &aSource,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<CopyFileFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IProgress> &aProgress);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT copyTo(const com::Utf8Str &aSource,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<CopyFileFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IProgress> &aProgress);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryCreate(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<DirectoryCreateFlag_T> &aFlags);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync BOOL aSecure,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync com::Utf8Str &aDirectory);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryExists(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync BOOL *aExists);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryOpen(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aFilter,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<DirectoryOpenFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestDirectory> &aDirectory);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryQueryInfo(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestFsObjInfo> &aInfo);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryRemove(const com::Utf8Str &aPath);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IProgress> &aProgress);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directoryRename(const com::Utf8Str &aSource,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<PathRenameFlag_T> &aFlags);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT directorySetACL(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aAcl);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT environmentClear();
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT environmentGet(const com::Utf8Str &aName,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync com::Utf8Str &aValue);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT environmentSet(const com::Utf8Str &aName,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aValue);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT environmentUnset(const com::Utf8Str &aName);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync BOOL aSecure,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestFile> &aFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileExists(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync BOOL *aExists);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileRemove(const com::Utf8Str &aPath);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileOpen(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aOpenMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDisposition,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aCreationMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestFile> &aFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileOpenEx(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aOpenMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDisposition,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aSharingMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aCreationMode,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync LONG64 aOffset,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestFile> &aFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileQueryInfo(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestFsObjInfo> &aInfo);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileQuerySize(const com::Utf8Str &aPath,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync LONG64 *aSize);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileRename(const com::Utf8Str &aSource,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aDest,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<PathRenameFlag_T> &aFlags);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT fileSetACL(const com::Utf8Str &aFile,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aAcl);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT processCreate(const com::Utf8Str &aCommand,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<com::Utf8Str> &aArguments,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<com::Utf8Str> &aEnvironment,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<ProcessCreateFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aTimeoutMS,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestProcess> &aGuestProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT processCreateEx(const com::Utf8Str &aCommand,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<com::Utf8Str> &aArguments,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<com::Utf8Str> &aEnvironment,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<ProcessCreateFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aTimeoutMS,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ProcessPriority_T aPriority,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<LONG> &aAffinity,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestProcess> &aGuestProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT processGet(ULONG aPid,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ComPtr<IGuestProcess> &aGuestProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT symlinkCreate(const com::Utf8Str &aSource,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const com::Utf8Str &aTarget,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync SymlinkType_T aType);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT symlinkExists(const com::Utf8Str &aSymlink,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync BOOL *aExists);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT symlinkRead(const com::Utf8Str &aSymlink,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const std::vector<SymlinkReadFlag_T> &aFlags,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync com::Utf8Str &aTarget);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT symlinkRemoveDirectory(const com::Utf8Str &aPath);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT symlinkRemoveFile(const com::Utf8Str &aFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT waitFor(ULONG aWaitFor,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aTimeoutMS,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync GuestSessionWaitResult_T *aReason);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG aTimeoutMS,
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync GuestSessionWaitResult_T *aReason);
8d9dcfac5d32ad4c7ddc2f16980419bdc132efe5vboxsync /** @} */
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync /** Map of guest directories. The key specifies the internal directory ID. */
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /** Map of guest files. The key specifies the internal file ID. */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
687794577e2e35c3cae67e692a7f2130d1262a82vboxsync /** Map of guest processes. The key specifies the internal process number.
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
cc1ef2ef9bbc6a0ff964928d61b7298e5bfcce5fvboxsync typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
7862f4bd000f1eb6c86289f5ac2849e9cf943ca9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncpublic:
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @name Public internal methods.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * @{ */
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_directoryRemoveFromList(GuestDirectory *pDirectory);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync Utf8Str &strName, int *pGuestRc);
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_directoryQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fileRemoveFromList(GuestFile *pFile);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fileQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fileQuerySizeInternal(const Utf8Str &strPath, int64_t *pllSize, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_fsQueryInfoInternal(const Utf8Str &strPath, GuestFsObjData &objData, int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const GuestCredentials &i_getCredentials(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync const GuestEnvironment &i_getEnvironment(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync EventSource *i_getEventSource(void) { return mEventSource; }
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync Utf8Str i_getName(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync ULONG i_getId(void) { return mData.mSession.mID; }
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync static Utf8Str i_guestErrorToString(int guestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync HRESULT i_isReadyExternal(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_onRemove(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_startSessionInternal(int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_startSessionAsync(void);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync static DECLCALLBACK(int)
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync i_startSessionThread(RTTHREAD Thread, void *pvUser);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync Guest *i_getParent(void) { return mParent; }
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags,
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int *pGuestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_processRemoveFromList(GuestProcess *pProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_processCreateExInteral(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync static HRESULT i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int i_startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask,
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync ComObjPtr<Progress> &pProgress);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_queryInfo(void);
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
b10a13ee0c4f4df2aa7cf2b164f0073fbd42e93cvboxsync GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync /** @} */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncprivate:
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync /** Pointer to the parent (Guest). */
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync Guest *mParent;
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync /**
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync * The session's event source. This source is used for
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync * serving the internal listener as well as all other
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync * external listeners that may register to it.
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync *
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync * Note: This can safely be used without holding any locks.
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync * An AutoCaller suffices to prevent it being destroy while in use and
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync * internally there is a lock providing the necessary serialization.
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync */
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync const ComObjPtr<EventSource> mEventSource;
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync struct Data
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync {
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync /** The session credentials. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync GuestCredentials mCredentials;
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync /** The session's startup info. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync GuestSessionStartupInfo mSession;
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync /** The session's current status. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync GuestSessionStatus_T mStatus;
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** The session's environment block. Can be
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync * overwritten/extended by ProcessCreate(Ex). */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync GuestEnvironment mEnvironment;
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** Directory objects bound to this session. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync SessionDirectories mDirectories;
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** File objects bound to this session. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync SessionFiles mFiles;
02f7c106d33c45f99ec412a5fe0adde868f700fcvboxsync /** Process objects bound to this session. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync SessionProcesses mProcesses;
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync /** Guest control protocol version to be used.
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * Guest Additions < VBox 4.3 have version 1,
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * any newer version will have version 2. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync uint32_t mProtocolVersion;
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync /** Session timeout (in ms). */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync uint32_t mTimeout;
04f6f18325971f796623469adcf39ba2b2939ed3vboxsync /** Total number of session objects (processes,
04f6f18325971f796623469adcf39ba2b2939ed3vboxsync * files, ...). */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync uint32_t mNumObjects;
9bff17fe6983cfda2ddd98f1979841bcb48e78e7vboxsync /** The last returned session status
9bff17fe6983cfda2ddd98f1979841bcb48e78e7vboxsync * returned from the guest side. */
9bff17fe6983cfda2ddd98f1979841bcb48e78e7vboxsync int mRC;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync } mData;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync};
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync#endif /* !____H_GUESTSESSIONIMPL */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync