VirtualBox

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

最後變更 在這個檔案從62370是 62370,由 vboxsync 提交於 9 年 前

Main: a few fixes for -Wunused -Wconversion

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 24.3 KB
 
1/* $Id: GuestSessionImpl.h 62370 2016-07-20 17:12:05Z vboxsync $ */
2/** @file
3 * VirtualBox Main - Guest session handling.
4 */
5
6/*
7 * Copyright (C) 2012-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.alldomusa.eu.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_GUESTSESSIONIMPL
19#define ____H_GUESTSESSIONIMPL
20
21#include "GuestSessionWrap.h"
22#include "EventImpl.h"
23
24#include "GuestCtrlImplPrivate.h"
25#include "GuestProcessImpl.h"
26#include "GuestDirectoryImpl.h"
27#include "GuestFileImpl.h"
28#include "GuestFsObjInfoImpl.h"
29#include "ThreadTask.h"
30
31#include <iprt/isofs.h> /* For UpdateAdditions. */
32
33class Guest;
34
35/**
36 * Abstract base class for a lenghtly per-session operation which
37 * runs in a Main worker thread.
38 */
39class GuestSessionTask : public ThreadTask
40{
41public:
42
43 GuestSessionTask(GuestSession *pSession);
44
45 virtual ~GuestSessionTask(void);
46
47public:
48
49 virtual int Run(void) = 0;
50 virtual int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress) = 0;
51
52 HRESULT Init(const Utf8Str &strTaskDesc)
53 {
54 HRESULT hr = S_OK;
55 setTaskDesc(strTaskDesc);
56 hr = createAndSetProgressObject();
57 return hr;
58 }
59
60 const ComObjPtr<Progress>& GetProgressObject() const {return mProgress;}
61
62protected:
63
64 int getGuestProperty(const ComObjPtr<Guest> &pGuest,
65 const Utf8Str &strPath, Utf8Str &strValue);
66 int setProgress(ULONG uPercent);
67 int setProgressSuccess(void);
68 HRESULT setProgressErrorMsg(HRESULT hr, const Utf8Str &strMsg);
69 inline void setTaskDesc(const Utf8Str &strTaskDesc) throw()
70 {
71 mDesc = strTaskDesc;
72 }
73
74 HRESULT createAndSetProgressObject();
75protected:
76
77 Utf8Str mDesc;
78 GuestSession *mSession;
79 /** Progress object for getting updated when running
80 * asynchronously. Optional. */
81 ComObjPtr<Progress> mProgress;
82};
83
84/**
85 * Task for opening a guest session.
86 */
87class SessionTaskOpen : public GuestSessionTask
88{
89public:
90
91 SessionTaskOpen(GuestSession *pSession,
92 uint32_t uFlags,
93 uint32_t uTimeoutMS);
94
95 virtual ~SessionTaskOpen(void);
96
97public:
98
99 int Run(int *pGuestRc);
100 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
101 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);
102 void handler()
103 {
104 int vrc = SessionTaskOpen::taskThread(NULL, this);
105 NOREF(vrc);
106 }
107
108protected:
109
110 /** Session creation flags. */
111 uint32_t mFlags;
112 /** Session creation timeout (in ms). */
113 uint32_t mTimeoutMS;
114};
115
116/**
117 * Task for copying files from host to the guest.
118 */
119class SessionTaskCopyTo : public GuestSessionTask
120{
121public:
122
123 SessionTaskCopyTo(GuestSession *pSession,
124 const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags);
125
126 SessionTaskCopyTo(GuestSession *pSession,
127 PRTFILE pSourceFile, size_t cbSourceOffset, uint64_t cbSourceSize,
128 const Utf8Str &strDest, uint32_t uFlags);
129
130 virtual ~SessionTaskCopyTo(void);
131
132public:
133
134 int Run(void);
135 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
136 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);
137 void handler()
138 {
139 int vrc = SessionTaskCopyTo::taskThread(NULL, this);
140 NOREF(vrc);
141 }
142
143protected:
144
145 Utf8Str mSource;
146 PRTFILE mSourceFile;
147 size_t mSourceOffset;
148 uint64_t mSourceSize;
149 Utf8Str mDest;
150 uint32_t mCopyFileFlags;
151};
152
153/**
154 * Task for copying files from guest to the host.
155 */
156class SessionTaskCopyFrom : public GuestSessionTask
157{
158public:
159
160 SessionTaskCopyFrom(GuestSession *pSession,
161 const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags);
162
163 virtual ~SessionTaskCopyFrom(void);
164
165public:
166
167 int Run(void);
168 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
169 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);
170 void handler()
171 {
172 int vrc = SessionTaskCopyFrom::taskThread(NULL, this);
173 NOREF(vrc);
174 }
175
176protected:
177
178 Utf8Str mSource;
179 Utf8Str mDest;
180 uint32_t mFlags;
181};
182
183/**
184 * Task for automatically updating the Guest Additions on the guest.
185 */
186class SessionTaskUpdateAdditions : public GuestSessionTask
187{
188public:
189
190 SessionTaskUpdateAdditions(GuestSession *pSession,
191 const Utf8Str &strSource, const ProcessArguments &aArguments,
192 uint32_t uFlags);
193
194 virtual ~SessionTaskUpdateAdditions(void);
195
196public:
197
198 int Run(void);
199 int RunAsync(const Utf8Str &strDesc, ComObjPtr<Progress> &pProgress);
200 static DECLCALLBACK(int) taskThread(RTTHREAD Thread, void *pvUser);
201 void handler()
202 {
203 int vrc = SessionTaskUpdateAdditions::taskThread(NULL, this);
204 NOREF(vrc);
205 }
206
207protected:
208
209 /**
210 * Suported OS types for automatic updating.
211 */
212 enum eOSType
213 {
214 eOSType_Unknown = 0,
215 eOSType_Windows = 1,
216 eOSType_Linux = 2,
217 eOSType_Solaris = 3
218 };
219
220 /**
221 * Structure representing a file to
222 * get off the .ISO, copied to the guest.
223 */
224 struct InstallerFile
225 {
226 InstallerFile(const Utf8Str &aSource,
227 const Utf8Str &aDest,
228 uint32_t aFlags = 0)
229 : strSource(aSource),
230 strDest(aDest),
231 fFlags(aFlags) { }
232
233 InstallerFile(const Utf8Str &aSource,
234 const Utf8Str &aDest,
235 uint32_t aFlags,
236 GuestProcessStartupInfo startupInfo)
237 : strSource(aSource),
238 strDest(aDest),
239 fFlags(aFlags),
240 mProcInfo(startupInfo)
241 {
242 mProcInfo.mExecutable = strDest;
243 if (mProcInfo.mName.isEmpty())
244 mProcInfo.mName = strDest;
245 }
246
247 /** Source file on .ISO. */
248 Utf8Str strSource;
249 /** Destination file on the guest. */
250 Utf8Str strDest;
251 /** File flags. */
252 uint32_t fFlags;
253 /** Optional arguments if this file needs to be
254 * executed. */
255 GuestProcessStartupInfo mProcInfo;
256 };
257
258 int i_addProcessArguments(ProcessArguments &aArgumentsDest,
259 const ProcessArguments &aArgumentsSource);
260 int i_copyFileToGuest(GuestSession *pSession, PRTISOFSFILE pISO,
261 Utf8Str const &strFileSource, const Utf8Str &strFileDest,
262 bool fOptional, uint32_t *pcbSize);
263 int i_runFileOnGuest(GuestSession *pSession, GuestProcessStartupInfo &procInfo);
264
265 /** Files to handle. */
266 std::vector<InstallerFile> mFiles;
267 /** The (optionally) specified Guest Additions .ISO on the host
268 * which will be used for the updating process. */
269 Utf8Str mSource;
270 /** (Optional) installer command line arguments. */
271 ProcessArguments mArguments;
272 /** Update flags. */
273 uint32_t mFlags;
274};
275
276/**
277 * Guest session implementation.
278 */
279class ATL_NO_VTABLE GuestSession :
280 public GuestSessionWrap,
281 public GuestBase
282{
283public:
284 /** @name COM and internal init/term/mapping cruft.
285 * @{ */
286 DECLARE_EMPTY_CTOR_DTOR(GuestSession)
287
288 int init(Guest *pGuest, const GuestSessionStartupInfo &ssInfo, const GuestCredentials &guestCreds);
289 void uninit(void);
290 HRESULT FinalConstruct(void);
291 void FinalRelease(void);
292 /** @} */
293
294private:
295
296 /** Wrapped @name IGuestSession properties.
297 * @{ */
298 HRESULT getUser(com::Utf8Str &aUser);
299 HRESULT getDomain(com::Utf8Str &aDomain);
300 HRESULT getName(com::Utf8Str &aName);
301 HRESULT getId(ULONG *aId);
302 HRESULT getTimeout(ULONG *aTimeout);
303 HRESULT setTimeout(ULONG aTimeout);
304 HRESULT getProtocolVersion(ULONG *aProtocolVersion);
305 HRESULT getStatus(GuestSessionStatus_T *aStatus);
306 HRESULT getEnvironmentChanges(std::vector<com::Utf8Str> &aEnvironmentChanges);
307 HRESULT setEnvironmentChanges(const std::vector<com::Utf8Str> &aEnvironmentChanges);
308 HRESULT getEnvironmentBase(std::vector<com::Utf8Str> &aEnvironmentBase);
309 HRESULT getProcesses(std::vector<ComPtr<IGuestProcess> > &aProcesses);
310 HRESULT getPathStyle(PathStyle_T *aPathStyle);
311 HRESULT getCurrentDirectory(com::Utf8Str &aCurrentDirectory);
312 HRESULT setCurrentDirectory(const com::Utf8Str &aCurrentDirectory);
313 HRESULT getDirectories(std::vector<ComPtr<IGuestDirectory> > &aDirectories);
314 HRESULT getFiles(std::vector<ComPtr<IGuestFile> > &aFiles);
315 HRESULT getEventSource(ComPtr<IEventSource> &aEventSource);
316 /** @} */
317
318 /** Wrapped @name IGuestSession methods.
319 * @{ */
320 HRESULT close();
321
322 HRESULT directoryCopy(const com::Utf8Str &aSource,
323 const com::Utf8Str &aDestination,
324 const std::vector<DirectoryCopyFlags_T> &aFlags,
325 ComPtr<IProgress> &aProgress);
326 HRESULT directoryCopyFromGuest(const com::Utf8Str &aSource,
327 const com::Utf8Str &aDestination,
328 const std::vector<DirectoryCopyFlags_T> &aFlags,
329 ComPtr<IProgress> &aProgress);
330 HRESULT directoryCopyToGuest(const com::Utf8Str &aSource,
331 const com::Utf8Str &aDestination,
332 const std::vector<DirectoryCopyFlags_T> &aFlags,
333 ComPtr<IProgress> &aProgress);
334 HRESULT directoryCreate(const com::Utf8Str &aPath,
335 ULONG aMode,
336 const std::vector<DirectoryCreateFlag_T> &aFlags);
337 HRESULT directoryCreateTemp(const com::Utf8Str &aTemplateName,
338 ULONG aMode,
339 const com::Utf8Str &aPath,
340 BOOL aSecure,
341 com::Utf8Str &aDirectory);
342 HRESULT directoryExists(const com::Utf8Str &aPath,
343 BOOL aFollowSymlinks,
344 BOOL *aExists);
345 HRESULT directoryOpen(const com::Utf8Str &aPath,
346 const com::Utf8Str &aFilter,
347 const std::vector<DirectoryOpenFlag_T> &aFlags,
348 ComPtr<IGuestDirectory> &aDirectory);
349 HRESULT directoryRemove(const com::Utf8Str &aPath);
350 HRESULT directoryRemoveRecursive(const com::Utf8Str &aPath,
351 const std::vector<DirectoryRemoveRecFlag_T> &aFlags,
352 ComPtr<IProgress> &aProgress);
353 HRESULT environmentScheduleSet(const com::Utf8Str &aName,
354 const com::Utf8Str &aValue);
355 HRESULT environmentScheduleUnset(const com::Utf8Str &aName);
356 HRESULT environmentGetBaseVariable(const com::Utf8Str &aName,
357 com::Utf8Str &aValue);
358 HRESULT environmentDoesBaseVariableExist(const com::Utf8Str &aName,
359 BOOL *aExists);
360
361 HRESULT fileCopy(const com::Utf8Str &aSource,
362 const com::Utf8Str &aDestination,
363 const std::vector<FileCopyFlag_T> &aFlags,
364 ComPtr<IProgress> &aProgress);
365 HRESULT fileCopyToGuest(const com::Utf8Str &aSource,
366 const com::Utf8Str &aDestination,
367 const std::vector<FileCopyFlag_T> &aFlags,
368 ComPtr<IProgress> &aProgress);
369 HRESULT fileCopyFromGuest(const com::Utf8Str &aSource,
370 const com::Utf8Str &aDestination,
371 const std::vector<FileCopyFlag_T> &aFlags,
372 ComPtr<IProgress> &aProgress);
373 HRESULT fileCreateTemp(const com::Utf8Str &aTemplateName,
374 ULONG aMode,
375 const com::Utf8Str &aPath,
376 BOOL aSecure,
377 ComPtr<IGuestFile> &aFile);
378 HRESULT fileExists(const com::Utf8Str &aPath,
379 BOOL aFollowSymlinks,
380 BOOL *aExists);
381 HRESULT fileOpen(const com::Utf8Str &aPath,
382 FileAccessMode_T aAccessMode,
383 FileOpenAction_T aOpenAction,
384 ULONG aCreationMode,
385 ComPtr<IGuestFile> &aFile);
386 HRESULT fileOpenEx(const com::Utf8Str &aPath,
387 FileAccessMode_T aAccessMode,
388 FileOpenAction_T aOpenAction,
389 FileSharingMode_T aSharingMode,
390 ULONG aCreationMode,
391 const std::vector<FileOpenExFlags_T> &aFlags,
392 ComPtr<IGuestFile> &aFile);
393 HRESULT fileQuerySize(const com::Utf8Str &aPath,
394 BOOL aFollowSymlinks,
395 LONG64 *aSize);
396 HRESULT fsObjExists(const com::Utf8Str &aPath,
397 BOOL aFollowSymlinks,
398 BOOL *pfExists);
399 HRESULT fsObjQueryInfo(const com::Utf8Str &aPath,
400 BOOL aFollowSymlinks,
401 ComPtr<IGuestFsObjInfo> &aInfo);
402 HRESULT fsObjRemove(const com::Utf8Str &aPath);
403 HRESULT fsObjRename(const com::Utf8Str &aOldPath,
404 const com::Utf8Str &aNewPath,
405 const std::vector<FsObjRenameFlag_T> &aFlags);
406 HRESULT fsObjMove(const com::Utf8Str &aSource,
407 const com::Utf8Str &aDestination,
408 const std::vector<FsObjMoveFlags_T> &aFlags,
409 ComPtr<IProgress> &aProgress);
410 HRESULT fsObjSetACL(const com::Utf8Str &aPath,
411 BOOL aFollowSymlinks,
412 const com::Utf8Str &aAcl,
413 ULONG aMode);
414 HRESULT processCreate(const com::Utf8Str &aCommand,
415 const std::vector<com::Utf8Str> &aArguments,
416 const std::vector<com::Utf8Str> &aEnvironment,
417 const std::vector<ProcessCreateFlag_T> &aFlags,
418 ULONG aTimeoutMS,
419 ComPtr<IGuestProcess> &aGuestProcess);
420 HRESULT processCreateEx(const com::Utf8Str &aCommand,
421 const std::vector<com::Utf8Str> &aArguments,
422 const std::vector<com::Utf8Str> &aEnvironment,
423 const std::vector<ProcessCreateFlag_T> &aFlags,
424 ULONG aTimeoutMS,
425 ProcessPriority_T aPriority,
426 const std::vector<LONG> &aAffinity,
427 ComPtr<IGuestProcess> &aGuestProcess);
428 HRESULT processGet(ULONG aPid,
429 ComPtr<IGuestProcess> &aGuestProcess);
430 HRESULT symlinkCreate(const com::Utf8Str &aSource,
431 const com::Utf8Str &aTarget,
432 SymlinkType_T aType);
433 HRESULT symlinkExists(const com::Utf8Str &aSymlink,
434 BOOL *aExists);
435 HRESULT symlinkRead(const com::Utf8Str &aSymlink,
436 const std::vector<SymlinkReadFlag_T> &aFlags,
437 com::Utf8Str &aTarget);
438 HRESULT waitFor(ULONG aWaitFor,
439 ULONG aTimeoutMS,
440 GuestSessionWaitResult_T *aReason);
441 HRESULT waitForArray(const std::vector<GuestSessionWaitForFlag_T> &aWaitFor,
442 ULONG aTimeoutMS,
443 GuestSessionWaitResult_T *aReason);
444 /** @} */
445
446 /** Map of guest directories. The key specifies the internal directory ID. */
447 typedef std::map <uint32_t, ComObjPtr<GuestDirectory> > SessionDirectories;
448 /** Map of guest files. The key specifies the internal file ID. */
449 typedef std::map <uint32_t, ComObjPtr<GuestFile> > SessionFiles;
450 /** Map of guest processes. The key specifies the internal process number.
451 * To retrieve the process' guest PID use the Id() method of the IProcess interface. */
452 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses;
453
454public:
455 /** @name Public internal methods.
456 * @todo r=bird: Most of these are public for no real reason...
457 * @{ */
458 int i_closeSession(uint32_t uFlags, uint32_t uTimeoutMS, int *pGuestRc);
459 inline bool i_directoryExists(uint32_t uDirID, ComObjPtr<GuestDirectory> *pDir);
460 int i_directoryRemoveFromList(GuestDirectory *pDirectory);
461 int i_directoryRemoveInternal(const Utf8Str &strPath, uint32_t uFlags, int *pGuestRc);
462 int i_directoryCreateInternal(const Utf8Str &strPath, uint32_t uMode, uint32_t uFlags, int *pGuestRc);
463 int i_objectCreateTempInternal(const Utf8Str &strTemplate, const Utf8Str &strPath, bool fDirectory,
464 Utf8Str &strName, int *pGuestRc);
465 int i_directoryOpenInternal(const GuestDirectoryOpenInfo &openInfo,
466 ComObjPtr<GuestDirectory> &pDirectory, int *pGuestRc);
467 int i_directoryQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
468 int i_dispatchToDirectory(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
469 int i_dispatchToFile(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
470 int i_dispatchToObject(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
471 int i_dispatchToProcess(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
472 int i_dispatchToThis(PVBOXGUESTCTRLHOSTCBCTX pCtxCb, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
473 inline bool i_fileExists(uint32_t uFileID, ComObjPtr<GuestFile> *pFile);
474 int i_fileRemoveFromList(GuestFile *pFile);
475 int i_fileRemoveInternal(const Utf8Str &strPath, int *pGuestRc);
476 int i_fileOpenInternal(const GuestFileOpenInfo &openInfo, ComObjPtr<GuestFile> &pFile, int *pGuestRc);
477 int i_fileQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
478 int i_fileQuerySizeInternal(const Utf8Str &strPath, bool fFollowSymlinks, int64_t *pllSize, int *pGuestRc);
479 int i_fsQueryInfoInternal(const Utf8Str &strPath, bool fFollowSymlinks, GuestFsObjData &objData, int *pGuestRc);
480 const GuestCredentials &i_getCredentials(void);
481 EventSource *i_getEventSource(void) { return mEventSource; }
482 Utf8Str i_getName(void);
483 ULONG i_getId(void) { return mData.mSession.mID; }
484 static Utf8Str i_guestErrorToString(int guestRc);
485 HRESULT i_isReadyExternal(void);
486 int i_onRemove(void);
487 int i_onSessionStatusChange(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCbData);
488 int i_startSessionInternal(int *pGuestRc);
489 int i_startSessionAsync(void);
490 static DECLCALLBACK(int)
491 i_startSessionThread(RTTHREAD Thread, void *pvUser);
492 Guest *i_getParent(void) { return mParent; }
493 uint32_t i_getProtocolVersion(void) { return mData.mProtocolVersion; }
494 int i_pathRenameInternal(const Utf8Str &strSource, const Utf8Str &strDest, uint32_t uFlags,
495 int *pGuestRc);
496 int i_processRemoveFromList(GuestProcess *pProcess);
497 int i_processCreateExInternal(GuestProcessStartupInfo &procInfo, ComObjPtr<GuestProcess> &pProgress);
498 inline bool i_processExists(uint32_t uProcessID, ComObjPtr<GuestProcess> *pProcess);
499 inline int i_processGetByPID(ULONG uPID, ComObjPtr<GuestProcess> *pProcess);
500 int i_sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms);
501 static HRESULT i_setErrorExternal(VirtualBoxBase *pInterface, int guestRc);
502 int i_setSessionStatus(GuestSessionStatus_T sessionStatus, int sessionRc);
503 int i_signalWaiters(GuestSessionWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS */);
504 int i_startTaskAsync(const Utf8Str &strTaskDesc, GuestSessionTask *pTask,
505 ComObjPtr<Progress> &pProgress);
506 int i_determineProtocolVersion(void);
507 int i_waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestSessionWaitResult_T &waitResult, int *pGuestRc);
508 int i_waitForStatusChange(GuestWaitEvent *pEvent, uint32_t fWaitFlags, uint32_t uTimeoutMS,
509 GuestSessionStatus_T *pSessionStatus, int *pGuestRc);
510 /** @} */
511
512private:
513
514 /** Pointer to the parent (Guest). */
515 Guest *mParent;
516 /**
517 * The session's event source. This source is used for
518 * serving the internal listener as well as all other
519 * external listeners that may register to it.
520 *
521 * Note: This can safely be used without holding any locks.
522 * An AutoCaller suffices to prevent it being destroy while in use and
523 * internally there is a lock providing the necessary serialization.
524 */
525 const ComObjPtr<EventSource> mEventSource;
526
527 struct Data
528 {
529 /** The session credentials. */
530 GuestCredentials mCredentials;
531 /** The session's startup info. */
532 GuestSessionStartupInfo mSession;
533 /** The session's current status. */
534 GuestSessionStatus_T mStatus;
535 /** The set of environment changes for the session for use when
536 * creating new guest processes. */
537 GuestEnvironmentChanges mEnvironmentChanges;
538 /** Pointer to the immutable base environment for the session.
539 * @note This is not allocated until the guest reports it to the host. It is
540 * also shared with child processes. */
541 GuestEnvironment const *mpBaseEnvironment;
542 /** Directory objects bound to this session. */
543 SessionDirectories mDirectories;
544 /** File objects bound to this session. */
545 SessionFiles mFiles;
546 /** Process objects bound to this session. */
547 SessionProcesses mProcesses;
548 /** Guest control protocol version to be used.
549 * Guest Additions < VBox 4.3 have version 1,
550 * any newer version will have version 2. */
551 uint32_t mProtocolVersion;
552 /** Session timeout (in ms). */
553 uint32_t mTimeout;
554 /** Total number of session objects (processes,
555 * files, ...). */
556 uint32_t mNumObjects;
557 /** The last returned session status
558 * returned from the guest side. */
559 int mRC;
560
561 Data(void)
562 : mpBaseEnvironment(NULL)
563 { }
564 Data(const Data &rThat)
565 : mCredentials(rThat.mCredentials)
566 , mSession(rThat.mSession)
567 , mStatus(rThat.mStatus)
568 , mEnvironmentChanges(rThat.mEnvironmentChanges)
569 , mpBaseEnvironment(NULL)
570 , mDirectories(rThat.mDirectories)
571 , mFiles(rThat.mFiles)
572 , mProcesses(rThat.mProcesses)
573 , mProtocolVersion(rThat.mProtocolVersion)
574 , mTimeout(rThat.mTimeout)
575 , mNumObjects(rThat.mNumObjects)
576 , mRC(rThat.mRC)
577 { }
578 ~Data(void)
579 {
580 if (mpBaseEnvironment)
581 {
582 mpBaseEnvironment->releaseConst();
583 mpBaseEnvironment = NULL;
584 }
585 }
586 } mData;
587};
588
589#endif /* !____H_GUESTSESSIONIMPL */
590
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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