VirtualBox

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

Last change on this file since 98713 was 98713, checked in by vboxsync, 22 months ago

Guest Control/Main: Moved legacy (VBoxService toolbox) code paths into dedicated XXXviaToolbox() functions. bugref:9783

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.4 KB
Line 
1/* $Id: GuestSessionImpl.h 98713 2023-02-24 10:15:30Z 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 std::vector<com::Utf8Str> &aEnvironment,
216 const std::vector<ProcessCreateFlag_T> &aFlags,
217 ULONG aTimeoutMS,
218 ComPtr<IGuestProcess> &aGuestProcess);
219 HRESULT processCreateEx(const com::Utf8Str &aCommand,
220 const std::vector<com::Utf8Str> &aArguments,
221 const std::vector<com::Utf8Str> &aEnvironment,
222 const std::vector<ProcessCreateFlag_T> &aFlags,
223 ULONG aTimeoutMS,
224 ProcessPriority_T aPriority,
225 const std::vector<LONG> &aAffinity,
226 ComPtr<IGuestProcess> &aGuestProcess);
227 HRESULT processGet(ULONG aPid,
228 ComPtr<IGuestProcess> &aGuestProcess);
229 HRESULT symlinkCreate(const com::Utf8Str &aSource,
230 const com::Utf8Str &aTarget,
231 SymlinkType_T aType);
232 HRESULT symlinkExists(const com::Utf8Str &aSymlink,
233 BOOL *aExists);
234 HRESULT symlinkRead(const com::Utf8Str &aSymlink,
235 const std::vector<SymlinkReadFlag_T> &aFlags,
236 com::Utf8Str &aTarget);
237 HRESULT waitFor(ULONG aWaitFor,
238 ULONG aTimeoutMS,
239 GuestSessionWaitResult_T *aReason);
240 HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
241 ULONG aTimeoutMS,
242 GuestSessionWaitResult_T *aReason);
243 /** @} */
244
245 /** Map of guest directories. The key specifies the internal directory ID. */
246 typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
247 /** Map of guest files. The key specifies the internal file ID. */
248 typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
249 /** Map of guest processes. The key specifies the internal process number.
250 * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
251 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
252
253 /** Guest session object type enumeration. */
254 enum SESSIONOBJECTTYPE
255 {
256 /** Invalid session object type. */
257 SESSIONOBJECTTYPE_INVALID = 0,
258 /** Session object. */
259 SESSIONOBJECTTYPE_SESSION = 1,
260 /** Directory object. */
261 SESSIONOBJECTTYPE_DIRECTORY = 2,
262 /** File object. */
263 SESSIONOBJECTTYPE_FILE = 3,
264 /** Process object. */
265 SESSIONOBJECTTYPE_PROCESS = 4
266 };
267
268 struct SessionObject
269 {
270 /** Creation timestamp (in ms).
271 * @note not used by anyone at the moment. */
272 uint64_t msBirth;
273 /** The object type. */
274 SESSIONOBJECTTYPE enmType;
275 /** Weak pointer to the object itself.
276 * Is NULL for SESSIONOBJECTTYPE_SESSION because GuestSession doesn't
277 * inherit from GuestObject. */
278 GuestObject *pObject;
279 };
280
281 /** Map containing all objects bound to a guest session.
282 * The key specifies the (global) context ID. */
283 typedef std::map<uint32_t, SessionObject> SessionObjects;
284
285public:
286 /** @name Public internal methods.
287 * @todo r=bird: Most of these are public for no real reason...
288 * @{ */
289 HRESULT i_copyFromGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
290 ComPtr<IProgress> &pProgress);
291 HRESULT i_copyToGuest(const GuestSessionFsSourceSet &SourceSet, const com::Utf8Str &strDestination,
292 ComPtr<IProgress> &pProgress);
293 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pvrcGuest);
294 HRESULT i_directoryCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, DirectoryCopyFlag_T *pfFlags);
295 bool i_directoryExists(const Utf8Str &strPath);
296 inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
297 int i_directoryUnregister(GuestDirectory *pDirectory);
298 int i_directoryRemove(const Utf8Str &strPath, uint32_t fFlags, int *pvrcGuest);
299 int i_directoryCreate(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
300 int i_directoryOpen(const GuestDirectoryOpenInfo &openInfo,
301 ComObjPtr<GuestDirectory> &pDirectory, int *pvrcGuest);
302 int i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
303 int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
304 int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
305 HRESULT i_fileCopyFlagFromStr(const com::Utf8Str &strFlags, bool fStrict, FileCopyFlag_T *pfFlags);
306 inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
307 int i_fileUnregister(GuestFile *pFile);
308 int i_fileRemove(const Utf8Str &strPath, int *pvrcGuest);
309 int i_fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
310 FileSharingMode_T aSharingMode, ULONG aCreationMode,
311 const std::vector<FileOpenExFlag_T> &aFlags,
312 ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
313 int i_fileOpen(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pvrcGuest);
314 int i_fileQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
315 int i_fileQuerySize(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pvrcGuest);
316 int i_fsCreateTemp(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
317 Utf8Str &strName, uint32_t fMode, bool fSecure, int *pvrcGuest);
318 int i_fsQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
319 const GuestCredentials &i_getCredentials(void);
320 EventSource *i_getEventSource(void) { return mEventSource; }
321 Utf8Str i_getName(void);
322 ULONG i_getId(void) { return mData.mSession.mID; }
323 bool i_isStarted(void) const;
324 HRESULT i_isStartedExternal(void);
325 bool i_isTerminated(void) const;
326 int i_onRemove(void);
327#ifdef VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS
328 int i_onFsNotify(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
329#endif
330 int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
331 PathStyle_T i_getGuestPathStyle(void);
332 static PathStyle_T i_getHostPathStyle(void);
333 int i_startSession(int *pvrcGuest);
334 int i_startSessionAsync(void);
335 Guest *i_getParent(void) { return mParent; }
336 uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
337 int i_objectRegister(GuestObject *pObject, SESSIONOBJECTTYPE enmType, uint32_t *pidObject);
338 int i_objectUnregister(uint32_t uObjectID);
339 int i_objectsUnregister(void);
340 int i_objectsNotifyAboutStatusChange(GuestSessionStatus_T enmSessionStatus);
341 int i_pathRename(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags, int *pvrcGuest);
342 int i_pathUserDocuments(Utf8Str &strPath, int *pvrcGuest);
343 int i_pathUserHome(Utf8Str &strPath, int *pvrcGuest);
344 int i_processUnregister(GuestProcess *pProcess);
345 int i_processCreateEx(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
346 inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
347 inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
348 int i_sendMessage(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms,
349 uint64_t fDst = VBOX_GUESTCTRL_DST_SESSION);
350 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int vrcSession);
351 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int vrc /*= VINF_SUCCESS */);
352 int i_shutdown(uint32_t fFlags, int *pvrcGuest);
353 int i_determineProtocolVersion(void);
354 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pvrcGuest);
355 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
356 GuestSessionStatus_T *pSessionStatus, int *pvrcGuest);
357 /** @} */
358
359 /** @name Public internal methods for supporting older Guest Additions via
360 VBoxService' built-in toolbox (< 7.1). */
361 int i_directoryCreateViaToolbox(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pvrcGuest);
362 int i_fileRemoveViaToolbox(const Utf8Str &strPath, int *pvrcGuest);
363 int i_fsCreateTempViaToolbox(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory, Utf8Str &strName,
364 uint32_t fMode, bool fSecure, int *pvrcGuest);
365 int i_fsQueryInfoViaToolbox(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pvrcGuest);
366 /** @} */
367
368public:
369
370 /** @name Static helper methods.
371 * @{ */
372 static Utf8Str i_guestErrorToString(int guestRc);
373 static bool i_isTerminated(GuestSessionStatus_T enmStatus);
374 static int i_startSessionThreadTask(GuestSessionTaskInternalStart *pTask);
375 /** @} */
376
377private:
378
379 /** Pointer to the parent (Guest). */
380 Guest *mParent;
381 /**
382 * The session's event source. This source is used for
383 * serving the internal listener as well as all other
384 * external listeners that may register to it.
385 *
386 * Note: This can safely be used without holding any locks.
387 * An AutoCaller suffices to prevent it being destroy while in use and
388 * internally there is a lock providing the necessary serialization.
389 */
390 const ComObjPtr<EventSource> mEventSource;
391
392 /** @todo r=bird: One of the core points of the DATA sub-structures in Main is
393 * hinding implementation details and stuff that requires including iprt/asm.h.
394 * The way it's used here totally defeats that purpose. You need to make it
395 * a pointer to a anynmous Data struct and define that structure in
396 * GuestSessionImpl.cpp and allocate it in the Init() function.
397 */
398 struct Data
399 {
400 /** The session credentials. */
401 GuestCredentials mCredentials;
402 /** The session's startup info. */
403 GuestSessionStartupInfo mSession;
404 /** The session's object ID.
405 * Needed for registering wait events which are bound directly to this session. */
406 uint32_t mObjectID;
407 /** The session's current status. */
408 GuestSessionStatus_T mStatus;
409 /** The set of environment changes for the session for use when
410 * creating new guest processes. */
411 GuestEnvironmentChanges mEnvironmentChanges;
412 /** Pointer to the immutable base environment for the session.
413 * @note This is not allocated until the guest reports it to the host. It is
414 * also shared with child processes.
415 * @todo This is actually not yet implemented, see
416 * GuestSession::i_onSessionStatusChange. */
417 GuestEnvironment const *mpBaseEnvironment;
418 /** Directory objects bound to this session. */
419 SessionDirectories mDirectories;
420 /** File objects bound to this session. */
421 SessionFiles mFiles;
422 /** Process objects bound to this session. */
423 SessionProcesses mProcesses;
424 /** Map of registered session objects (files, directories, ...). */
425 SessionObjects mObjects;
426 /** Guest control protocol version to be used.
427 * Guest Additions < VBox 4.3 have version 1,
428 * any newer version will have version 2. */
429 uint32_t mProtocolVersion;
430 /** Session timeout (in ms). */
431 uint32_t mTimeout;
432 /** The last returned session VBox status status returned from the guest side. */
433 int mVrc;
434 /** Object ID allocation bitmap; clear bits are free, set bits are busy. */
435 uint64_t bmObjectIds[VBOX_GUESTCTRL_MAX_OBJECTS / sizeof(uint64_t) / 8];
436
437 Data(void)
438 : mpBaseEnvironment(NULL)
439 {
440 RT_ZERO(bmObjectIds);
441 ASMBitSet(&bmObjectIds, VBOX_GUESTCTRL_MAX_OBJECTS - 1); /* Reserved for the session itself? */
442 ASMBitSet(&bmObjectIds, 0); /* Let's reserve this too. */
443 }
444 Data(const Data &rThat)
445 : mCredentials(rThat.mCredentials)
446 , mSession(rThat.mSession)
447 , mStatus(rThat.mStatus)
448 , mEnvironmentChanges(rThat.mEnvironmentChanges)
449 , mpBaseEnvironment(NULL)
450 , mDirectories(rThat.mDirectories)
451 , mFiles(rThat.mFiles)
452 , mProcesses(rThat.mProcesses)
453 , mObjects(rThat.mObjects)
454 , mProtocolVersion(rThat.mProtocolVersion)
455 , mTimeout(rThat.mTimeout)
456 , mVrc(rThat.mVrc)
457 {
458 memcpy(&bmObjectIds, &rThat.bmObjectIds, sizeof(bmObjectIds));
459 }
460 ~Data(void)
461 {
462 if (mpBaseEnvironment)
463 {
464 mpBaseEnvironment->releaseConst();
465 mpBaseEnvironment = NULL;
466 }
467 }
468 } mData;
469};
470
471#endif /* !MAIN_INCLUDED_GuestSessionImpl_h */
472
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