VirtualBox

source: vbox/trunk/src/VBox/Main/include/GuestSessionImpl.h@ 100842

Last change on this file since 100842 was 99739, checked in by vboxsync, 20 months ago

*: doxygen corrections (mostly about removing @returns from functions returning void).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.7 KB
Line 
1/* $Id: GuestSessionImpl.h 99739 2023-05-11 01:01:08Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Guest session handling.
4 */
5
6/*
7 * Copyright (C) 2012-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef MAIN_INCLUDED_GuestSessionImpl_h
29#define MAIN_INCLUDED_GuestSessionImpl_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34#include "GuestSessionWrap.h"
35#include "EventImpl.h"
36
37#include "GuestCtrlImplPrivate.h"
38#include "GuestProcessImpl.h"
39#include "GuestDirectoryImpl.h"
40#include "GuestFileImpl.h"
41#include "GuestFsObjInfoImpl.h"
42#include "GuestSessionImplTasks.h"
43
44#include <iprt/asm.h> /** @todo r=bird: Needed for ASMBitSet() in GuestSession::Data constructor. Removed when
45 * that is moved into the class implementation file as it should be. */
46#include <deque>
47
48class GuestSessionTaskInternalStart; /* Needed for i_startSessionThreadTask(). */
49
50/**
51 * Guest session implementation.
52 */
53class ATL_NO_VTABLE GuestSession
54 : public GuestSessionWrap
55 , public GuestBase
56{
57public:
58 /** @name COM and internal init/term/mapping cruft.
59 * @{ */
60 DECLARE_COMMON_CLASS_METHODS(GuestSession)
61
62 int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
63 void uninit(void);
64 HRESULT FinalConstruct(void);
65 void FinalRelease(void);
66 /** @} */
67
68private:
69
70 /** Wrapped @name IGuestSession properties.
71 * @{ */
72 HRESULT getUser(com::Utf8Str &aUser);
73 HRESULT getDomain(com::Utf8Str &aDomain);
74 HRESULT getName(com::Utf8Str &aName);
75 HRESULT getId(ULONG *aId);
76 HRESULT getTimeout(ULONG *aTimeout);
77 HRESULT setTimeout(ULONG aTimeout);
78 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
79 HRESULT getStatus(GuestSessionStatus_T *aStatus);
80 HRESULT getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges);
81 HRESULT setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges);
82 HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase);
83 HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
84 HRESULT getPathStyle(PathStyle_T *aPathStyle);
85 HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
86 HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
87 HRESULT getUserDocuments(com::Utf8Str &aUserDocuments);
88 HRESULT getUserHome(com::Utf8Str &aUserHome);
89 HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
90 HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
91 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
92 /** @} */
93
94 /** Wrapped @name IGuestSession methods.
95 * @{ */
96 HRESULT close();
97
98 HRESULT copyFromGuest(const std::vector<com::Utf8Str> &aSources,
99 const std::vector<com::Utf8Str> &aFilters,
100 const std::vector<com::Utf8Str> &aFlags,
101 const com::Utf8Str &aDestination,
102 ComPtr<IProgress> &aProgress);
103 HRESULT copyToGuest(const std::vector<com::Utf8Str> &aSources,
104 const std::vector<com::Utf8Str> &aFilters,
105 const std::vector<com::Utf8Str> &aFlags,
106 const com::Utf8Str &aDestination,
107 ComPtr<IProgress> &aProgress);
108
109 HRESULT directoryCopy(const com::Utf8Str &aSource,
110 const com::Utf8Str &aDestination,
111 const std::vector<DirectoryCopyFlag_T> &aFlags,
112 ComPtr<IProgress> &aProgress);
113 HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource,
114 const com::Utf8Str &aDestination,
115 const std::vector<DirectoryCopyFlag_T> &aFlags,
116 ComPtr<IProgress> &aProgress);
117 HRESULT directoryCopyToGuest(const com::Utf8Str &aSource,
118 const com::Utf8Str &aDestination,
119 const std::vector<DirectoryCopyFlag_T> &aFlags,
120 ComPtr<IProgress> &aProgress);
121 HRESULT directoryCreate(const com::Utf8Str &aPath,
122 ULONG aMode,
123 const std::vector<DirectoryCreateFlag_T> &aFlags);
124 HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
125 ULONG aMode,
126 const com::Utf8Str &aPath,
127 BOOL aSecure,
128 com::Utf8Str &aDirectory);
129 HRESULT directoryExists(const com::Utf8Str &aPath,
130 BOOL aFollowSymlinks,
131 BOOL *aExists);
132 HRESULT directoryOpen(const com::Utf8Str &aPath,
133 const com::Utf8Str &aFilter,
134 const std::vector<DirectoryOpenFlag_T> &aFlags,
135 ComPtr<IGuestDirectory> &aDirectory);
136 HRESULT directoryRemove(const com::Utf8Str &aPath);
137 HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
138 const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
139 ComPtr<IProgress> &aProgress);
140 HRESULT environmentScheduleSet(const com::Utf8Str &aName,
141 const com::Utf8Str &aValue);
142 HRESULT environmentScheduleUnset(const com::Utf8Str &aName);
143 HRESULT environmentGetBaseVariable(const com::Utf8Str &aName,
144 com::Utf8Str &aValue);
145 HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
146 BOOL *aExists);
147
148 HRESULT fileCopy(const com::Utf8Str &aSource,
149 const com::Utf8Str &aDestination,
150 const std::vector<FileCopyFlag_T> &aFlags,
151 ComPtr<IProgress> &aProgress);
152 HRESULT fileCopyToGuest(const com::Utf8Str &aSource,
153 const com::Utf8Str &aDestination,
154 const std::vector<FileCopyFlag_T> &aFlags,
155 ComPtr<IProgress> &aProgress);
156 HRESULT fileCopyFromGuest(const com::Utf8Str &aSource,
157 const com::Utf8Str &aDestination,
158 const std::vector<FileCopyFlag_T> &aFlags,
159 ComPtr<IProgress> &aProgress);
160 HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
161 ULONG aMode,
162 const com::Utf8Str &aPath,
163 BOOL aSecure,
164 ComPtr<IGuestFile> &aFile);
165 HRESULT fileExists(const com::Utf8Str &aPath,
166 BOOL aFollowSymlinks,
167 BOOL *aExists);
168 HRESULT fileOpen(const com::Utf8Str &aPath,
169 FileAccessMode_T aAccessMode,
170 FileOpenAction_T aOpenAction,
171 ULONG aCreationMode,
172 ComPtr<IGuestFile> &aFile);
173 HRESULT fileOpenEx(const com::Utf8Str &aPath,
174 FileAccessMode_T aAccessMode,
175 FileOpenAction_T aOpenAction,
176 FileSharingMode_T aSharingMode,
177 ULONG aCreationMode,
178 const std::vector<FileOpenExFlag_T> &aFlags,
179 ComPtr<IGuestFile> &aFile);
180 HRESULT fileQuerySize(const com::Utf8Str &aPath,
181 BOOL aFollowSymlinks,
182 LONG64 *aSize);
183 HRESULT fsQueryFreeSpace(const com::Utf8Str &aPath, LONG64 *aFreeSpace);
184 HRESULT fsQueryInfo(const com::Utf8Str &aPath, ComPtr<IGuestFsInfo> &aInfo);
185 HRESULT fsObjExists(const com::Utf8Str &aPath,
186 BOOL aFollowSymlinks,
187 BOOL *pfExists);
188 HRESULT fsObjQueryInfo(const com::Utf8Str &aPath,
189 BOOL aFollowSymlinks,
190 ComPtr<IGuestFsObjInfo> &aInfo);
191 HRESULT fsObjRemove(const com::Utf8Str &aPath);
192 HRESULT fsObjRemoveArray(const std::vector<com::Utf8Str> &aPaths,
193 ComPtr<IProgress> &aProgress);
194 HRESULT fsObjRename(const com::Utf8Str &aOldPath,
195 const com::Utf8Str &aNewPath,
196 const std::vector<FsObjRenameFlag_T> &aFlags);
197 HRESULT fsObjMove(const com::Utf8Str &aSource,
198 const com::Utf8Str &aDestination,
199 const std::vector<FsObjMoveFlag_T> &aFlags,
200 ComPtr<IProgress> &aProgress);
201 HRESULT fsObjMoveArray(const std::vector<com::Utf8Str> &aSource,
202 const com::Utf8Str &aDestination,
203 const std::vector<FsObjMoveFlag_T> &aFlags,
204 ComPtr<IProgress> &aProgress);
205 HRESULT fsObjCopyArray(const std::vector<com::Utf8Str> &aSource,
206 const com::Utf8Str &aDestination,
207 const std::vector<FileCopyFlag_T> &aFlags,
208 ComPtr<IProgress> &aProgress);
209 HRESULT fsObjSetACL(const com::Utf8Str &aPath,
210 BOOL aFollowSymlinks,
211 const com::Utf8Str &aAcl,
212 ULONG aMode);
213 HRESULT processCreate(const com::Utf8Str &aCommand,
214 const std::vector<com::Utf8Str> &aArguments,
215 const com::Utf8Str &aCwd,
216 const std::vector<com::Utf8Str> &aEnvironment,
217 const std::vector<ProcessCreateFlag_T> &aFlags,
218 ULONG aTimeoutMS,
219 ComPtr<IGuestProcess> &aGuestProcess);
220 HRESULT processCreateEx(const com::Utf8Str &aCommand,
221 const std::vector<com::Utf8Str> &aArguments,
222 const com::Utf8Str &aCwd,
223 const std::vector<com::Utf8Str> &aEnvironment,
224 const std::vector<ProcessCreateFlag_T> &aFlags,
225 ULONG aTimeoutMS,
226 ProcessPriority_T aPriority,
227 const std::vector<LONG> &aAffinity,
228 ComPtr<IGuestProcess> &aGuestProcess);
229 HRESULT processGet(ULONG aPid,
230 ComPtr<IGuestProcess> &aGuestProcess);
231 HRESULT symlinkCreate(const com::Utf8Str &aSource,
232 const com::Utf8Str &aTarget,
233 SymlinkType_T aType);
234 HRESULT symlinkExists(const com::Utf8Str &aSymlink,
235 BOOL *aExists);
236 HRESULT symlinkRead(const com::Utf8Str &aSymlink,
237 const std::vector<SymlinkReadFlag_T> &aFlags,
238 com::Utf8Str &aTarget);
239 HRESULT waitFor(ULONG aWaitFor,
240 ULONG aTimeoutMS,
241 GuestSessionWaitResult_T *aReason);
242 HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
243 ULONG aTimeoutMS,
244 GuestSessionWaitResult_T *aReason);
245 /** @} */
246
247 /** Map of guest directories. The key specifies the internal directory ID. */
248 typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
249 /** Map of guest files. The key specifies the internal file ID. */
250 typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
251 /** Map of guest processes. The key specifies the internal process number.
252 * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
253 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
254
255 /** Guest session object type enumeration. */
256 enum SESSIONOBJECTTYPE
257 {
258 /** Invalid session object type. */
259 SESSIONOBJECTTYPE_INVALID = 0,
260 /** Session object. */
261 SESSIONOBJECTTYPE_SESSION = 1,
262 /** Directory object. */
263 SESSIONOBJECTTYPE_DIRECTORY = 2,
264 /** File object. */
265 SESSIONOBJECTTYPE_FILE = 3,
266 /** Process object. */
267 SESSIONOBJECTTYPE_PROCESS = 4
268 };
269
270 struct SessionObject
271 {
272 /** Creation timestamp (in ms).
273 * @note not used by anyone at the moment. */
274 uint64_t msBirth;
275 /** The object type. */
276 SESSIONOBJECTTYPE enmType;
277 /** Weak pointer to the object itself.
278 * Is NULL for SESSIONOBJECTTYPE_SESSION because GuestSession doesn't
279 * inherit from GuestObject. */
280 GuestObject *pObject;
281 };
282
283 /** Map containing all objects bound to a guest session.
284 * The key specifies the (global) context ID. */
285 typedef std::map<uint32_t, SessionObject> SessionObjects;
286
287public:
288 /** @name Public internal methods.
289 * @todo r=bird: Most of these are public for no real reason...
290 * @{ */
291 HRESULT i_copyFromGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
292 ComPtr<IProgress> &pProgress);
293 HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
294 ComPtr<IProgress> &pProgress);
295 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest);
296 HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags);
297 bool i_directoryExists(const Utf8Str &strPath);
298 inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
299 int i_directoryUnregister(GuestDirectory *pDirectory);
300 int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest);
301 int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
302 int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
303 ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest);
304 int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
305 int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
306 int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
307 HRESULT i_fileCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, FileCopyFlag_T *pfFlags);
308 inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
309 int i_fileUnregister(GuestFile *pFile);
310 int i_fileRemove(const Utf8Str &strPath, int *pvrcGuest);
311 int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
312 FileSharingMode_T aSharingMode, ULONG aCreationMode,
313 const std::vector<FileOpenExFlag_T> &aFlags,
314 ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
315 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
316 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
317 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest);
318 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
319 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest);
320 int i_fsQueryInfo(const Utf8Str &strPath, PGSTCTLFSINFO pFsInfo, int *pvrcGuest);
321 int i_fsObjQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
322 const GuestCredentials &i_getCredentials(void);
323 EventSource *i_getEventSource(void) { return mEventSource; }
324 Utf8Str i_getName(void);
325 ULONG i_getId(void) { return mData.mSession.mID; }
326 bool i_isStarted(void) const;
327 HRESULT i_isStartedExternal(void);
328 bool i_isTerminated(void) const;
329 int i_onRemove(void);
330#ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
331 int i_onFsNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
332#endif
333 int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
334 PathStyle_T i_getGuestPathStyle(void);
335 static PathStyle_T i_getHostPathStyle(void);
336 int i_startSession(int *pvrcGuest);
337 int i_startSessionAsync(void);
338 Guest *i_getParent(void) { return mParent; }
339 uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
340 int i_objectRegister(GuestObject *pObject, SESSIONOBJECTTYPE enmType, uint32_t *pidObject);
341 int i_objectUnregister(uint32_t uObjectID);
342 int i_objectsUnregister(void);
343 int i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus);
344 int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest);
345 int i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest);
346 int i_pathUserHome(Utf8Str &strPath, int *pvrcGuest);
347 int i_processUnregister(GuestProcess *pProcess);
348 int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
349 inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
350 inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
351 int i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms,
352 uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION);
353 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession);
354 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */);
355 int i_shutdown(uint32_t fFlags, int *pvrcGuest);
356 int i_determineProtocolVersion(void);
357 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest);
358 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
359 GuestSessionStatus_T *pSessionStatus, int *pvrcGuest);
360 /** @} */
361
362 /** @name Public internal methods for supporting older Guest Additions via
363 * VBoxService' built-in toolbox (< 7.1).
364 * @{ */
365 int i_directoryCreateViaToolbox(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
366 int i_fileRemoveViaToolbox(const Utf8Str &strPath, int *pvrcGuest);
367 int i_fsCreateTempViaToolbox(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName,
368 uint32_t fMode, bool fSecure, int *pvrcGuest);
369 int i_fsObjQueryInfoViaToolbox(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
370 /** @} */
371
372public:
373
374 /** @name Static helper methods.
375 * @{ */
376 static Utf8Str i_guestErrorToString(int guestRc);
377 static bool i_isTerminated(GuestSessionStatus_T enmStatus);
378 static int i_startSessionThreadTask(GuestSessionTaskInternalStart *pTask);
379 /** @} */
380
381private:
382
383 /** Pointer to the parent (Guest). */
384 Guest *mParent;
385 /**
386 * The session's event source. This source is used for
387 * serving the internal listener as well as all other
388 * external listeners that may register to it.
389 *
390 * Note: This can safely be used without holding any locks.
391 * An AutoCaller suffices to prevent it being destroy while in use and
392 * internally there is a lock providing the necessary serialization.
393 */
394 const ComObjPtr<EventSource> mEventSource;
395
396 /** @todo r=bird: One of the core points of the DATA sub-structures in Main is
397 * hinding implementation details and stuff that requires including iprt/asm.h.
398 * The way it's used here totally defeats that purpose. You need to make it
399 * a pointer to a anynmous Data struct and define that structure in
400 * GuestSessionImpl.cpp and allocate it in the Init() function.
401 */
402 struct Data
403 {
404 /** The session credentials. */
405 GuestCredentials mCredentials;
406 /** The session's startup info. */
407 GuestSessionStartupInfo mSession;
408 /** The session's object ID.
409 * Needed for registering wait events which are bound directly to this session. */
410 uint32_t mObjectID;
411 /** The session's current status. */
412 GuestSessionStatus_T mStatus;
413 /** The set of environment changes for the session for use when
414 * creating new guest processes. */
415 GuestEnvironmentChanges mEnvironmentChanges;
416 /** Pointer to the immutable base environment for the session.
417 * @note This is not allocated until the guest reports it to the host. It is
418 * also shared with child processes.
419 * @todo This is actually not yet implemented, see
420 * GuestSession::i_onSessionStatusChange. */
421 GuestEnvironment const *mpBaseEnvironment;
422 /** Directory objects bound to this session. */
423 SessionDirectories mDirectories;
424 /** File objects bound to this session. */
425 SessionFiles mFiles;
426 /** Process objects bound to this session. */
427 SessionProcesses mProcesses;
428 /** Map of registered session objects (files, directories, ...). */
429 SessionObjects mObjects;
430 /** Guest control protocol version to be used.
431 * Guest Additions < VBox 4.3 have version 1, any newer version will have version 2.
432 * Set to 0 if a valid Guest Additions version was not found (yet). */
433 uint32_t mProtocolVersion;
434 /** Session timeout (in ms). */
435 uint32_t mTimeout;
436 /** The last returned session VBox status status returned from the guest side. */
437 int mVrc;
438 /** Object ID allocation bitmap; clear bits are free, set bits are busy. */
439 uint64_t bmObjectIds[VBOX_GUESTCTRL_MAX_OBJECTS / sizeof(uint64_t) / 8];
440
441 Data(void)
442 : mpBaseEnvironment(NULL)
443 {
444 RT_ZERO(bmObjectIds);
445 ASMBitSet(&bmObjectIds, VBOX_GUESTCTRL_MAX_OBJECTS - 1); /* Reserved for the session itself? */
446 ASMBitSet(&bmObjectIds, 0); /* Let's reserve this too. */
447 }
448 Data(const Data &rThat)
449 : mCredentials(rThat.mCredentials)
450 , mSession(rThat.mSession)
451 , mStatus(rThat.mStatus)
452 , mEnvironmentChanges(rThat.mEnvironmentChanges)
453 , mpBaseEnvironment(NULL)
454 , mDirectories(rThat.mDirectories)
455 , mFiles(rThat.mFiles)
456 , mProcesses(rThat.mProcesses)
457 , mObjects(rThat.mObjects)
458 , mProtocolVersion(rThat.mProtocolVersion)
459 , mTimeout(rThat.mTimeout)
460 , mVrc(rThat.mVrc)
461 {
462 memcpy(&bmObjectIds, &rThat.bmObjectIds, sizeof(bmObjectIds));
463 }
464 ~Data(void)
465 {
466 if (mpBaseEnvironment)
467 {
468 mpBaseEnvironment->releaseConst();
469 mpBaseEnvironment = NULL;
470 }
471 }
472 } mData;
473};
474
475#endif /* !MAIN_INCLUDED_GuestSessionImpl_h */
476
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette