VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp@ 42107

Last change on this file since 42107 was 42106, checked in by vboxsync, 13 years ago

Build fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.0 KB
Line 
1
2/* $Id: GuestSessionImpl.cpp 42106 2012-07-11 12:08:25Z vboxsync $ */
3/** @file
4 * VirtualBox Main - XXX.
5 */
6
7/*
8 * Copyright (C) 2012 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19
20/*******************************************************************************
21* Header Files *
22*******************************************************************************/
23#include "GuestImpl.h"
24#include "GuestSessionImpl.h"
25
26#include "Global.h"
27#include "AutoCaller.h"
28#include "Logging.h"
29
30#include <VBox/com/array.h>
31
32
33// constructor / destructor
34/////////////////////////////////////////////////////////////////////////////
35
36DEFINE_EMPTY_CTOR_DTOR(GuestSession)
37
38HRESULT GuestSession::FinalConstruct(void)
39{
40 LogFlowThisFunc(("\n"));
41 return BaseFinalConstruct();
42}
43
44void GuestSession::FinalRelease(void)
45{
46 LogFlowThisFuncEnter();
47 uninit();
48 BaseFinalRelease();
49 LogFlowThisFuncLeave();
50}
51
52// public initializer/uninitializer for internal purposes only
53/////////////////////////////////////////////////////////////////////////////
54
55int GuestSession::init(Guest *aGuest,
56 Utf8Str aUser, Utf8Str aPassword, Utf8Str aDomain, Utf8Str aName)
57{
58 /* Enclose the state transition NotReady->InInit->Ready. */
59 AutoInitSpan autoInitSpan(this);
60 AssertReturn(autoInitSpan.isOk(), VERR_OBJECT_DESTROYED);
61
62 mData.mParent = aGuest;
63
64 mData.mUser = aUser;
65 mData.mPassword = aPassword;
66 mData.mDomain = aDomain;
67 mData.mName = aName;
68
69 /* Confirm a successful initialization when it's the case. */
70 autoInitSpan.setSucceeded();
71
72 return VINF_SUCCESS;
73}
74
75/**
76 * Uninitializes the instance.
77 * Called from FinalRelease().
78 */
79void GuestSession::uninit(void)
80{
81 LogFlowThisFunc(("\n"));
82
83 /* Enclose the state transition Ready->InUninit->NotReady. */
84 AutoUninitSpan autoUninitSpan(this);
85 if (autoUninitSpan.uninitDone())
86 return;
87
88#ifdef VBOX_WITH_GUEST_CONTROL
89 for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
90 itDirs != mData.mDirectories.end(); ++itDirs)
91 {
92 (*itDirs)->uninit();
93 (*itDirs).setNull();
94 }
95 mData.mDirectories.clear();
96
97 for (SessionFiles::iterator itFiles = mData.mFiles.begin();
98 itFiles != mData.mFiles.end(); ++itFiles)
99 {
100 (*itFiles)->uninit();
101 (*itFiles).setNull();
102 }
103 mData.mFiles.clear();
104
105 for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
106 itProcs != mData.mProcesses.end(); ++itProcs)
107 {
108 (*itProcs)->uninit();
109 (*itProcs).setNull();
110 }
111 mData.mProcesses.clear();
112
113 mData.mParent->sessionClose(this);
114#endif
115}
116
117// implementation of public getters/setters for attributes
118/////////////////////////////////////////////////////////////////////////////
119
120STDMETHODIMP GuestSession::COMGETTER(User)(BSTR *aUser)
121{
122#ifndef VBOX_WITH_GUEST_CONTROL
123 ReturnComNotImplemented();
124#else
125 CheckComArgOutPointerValid(aUser);
126
127 AutoCaller autoCaller(this);
128 if (FAILED(autoCaller.rc())) return autoCaller.rc();
129
130 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
131
132 mData.mUser.cloneTo(aUser);
133
134 return S_OK;
135#endif /* VBOX_WITH_GUEST_CONTROL */
136}
137
138STDMETHODIMP GuestSession::COMGETTER(Domain)(BSTR *aDomain)
139{
140#ifndef VBOX_WITH_GUEST_CONTROL
141 ReturnComNotImplemented();
142#else
143 CheckComArgOutPointerValid(aDomain);
144
145 AutoCaller autoCaller(this);
146 if (FAILED(autoCaller.rc())) return autoCaller.rc();
147
148 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
149
150 mData.mDomain.cloneTo(aDomain);
151
152 return S_OK;
153#endif /* VBOX_WITH_GUEST_CONTROL */
154}
155
156STDMETHODIMP GuestSession::COMGETTER(Name)(BSTR *aName)
157{
158#ifndef VBOX_WITH_GUEST_CONTROL
159 ReturnComNotImplemented();
160#else
161 CheckComArgOutPointerValid(aName);
162
163 AutoCaller autoCaller(this);
164 if (FAILED(autoCaller.rc())) return autoCaller.rc();
165
166 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
167
168 mData.mName.cloneTo(aName);
169
170 return S_OK;
171#endif /* VBOX_WITH_GUEST_CONTROL */
172}
173
174STDMETHODIMP GuestSession::COMGETTER(Id)(ULONG *aId)
175{
176#ifndef VBOX_WITH_GUEST_CONTROL
177 ReturnComNotImplemented();
178#else
179 CheckComArgOutPointerValid(aId);
180
181 AutoCaller autoCaller(this);
182 if (FAILED(autoCaller.rc())) return autoCaller.rc();
183
184 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
185
186 *aId = mData.mId;
187
188 return S_OK;
189#endif /* VBOX_WITH_GUEST_CONTROL */
190}
191
192STDMETHODIMP GuestSession::COMGETTER(Timeout)(ULONG *aTimeout)
193{
194#ifndef VBOX_WITH_GUEST_CONTROL
195 ReturnComNotImplemented();
196#else
197 CheckComArgOutPointerValid(aTimeout);
198
199 AutoCaller autoCaller(this);
200 if (FAILED(autoCaller.rc())) return autoCaller.rc();
201
202 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
203
204 *aTimeout = mData.mTimeout;
205
206 return S_OK;
207#endif /* VBOX_WITH_GUEST_CONTROL */
208}
209
210STDMETHODIMP GuestSession::COMGETTER(Environment)(ComSafeArrayOut(BSTR, aEnvironment))
211{
212#ifndef VBOX_WITH_GUEST_CONTROL
213 ReturnComNotImplemented();
214#else
215 CheckComArgOutSafeArrayPointerValid(aEnvironment);
216
217 AutoCaller autoCaller(this);
218 if (FAILED(autoCaller.rc())) return autoCaller.rc();
219
220 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
221
222 com::SafeArray<BSTR> collection(mData.mEnvironment.size());
223 size_t s = 0;
224 for (SessionEnvironment::const_iterator it = mData.mEnvironment.begin();
225 it != mData.mEnvironment.end();
226 ++it, ++s)
227 {
228 /** @todo */
229 }
230
231 collection.detachTo(ComSafeArrayOutArg(aEnvironment));
232
233 return S_OK;
234#endif /* VBOX_WITH_GUEST_CONTROL */
235}
236
237STDMETHODIMP GuestSession::COMGETTER(Processes)(ComSafeArrayOut(IGuestProcess *, aProcesses))
238{
239#ifndef VBOX_WITH_GUEST_CONTROL
240 ReturnComNotImplemented();
241#else
242 CheckComArgOutSafeArrayPointerValid(aProcesses);
243
244 AutoCaller autoCaller(this);
245 if (FAILED(autoCaller.rc())) return autoCaller.rc();
246
247 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
248
249 SafeIfaceArray<IGuestProcess> collection(mData.mProcesses);
250 collection.detachTo(ComSafeArrayOutArg(aProcesses));
251
252 return S_OK;
253#endif /* VBOX_WITH_GUEST_CONTROL */
254}
255
256STDMETHODIMP GuestSession::COMGETTER(Directories)(ComSafeArrayOut(IGuestDirectory *, aDirectories))
257{
258#ifndef VBOX_WITH_GUEST_CONTROL
259 ReturnComNotImplemented();
260#else
261 CheckComArgOutSafeArrayPointerValid(aDirectories);
262
263 AutoCaller autoCaller(this);
264 if (FAILED(autoCaller.rc())) return autoCaller.rc();
265
266 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
267
268 SafeIfaceArray<IGuestDirectory> collection(mData.mDirectories);
269 collection.detachTo(ComSafeArrayOutArg(aDirectories));
270
271 return S_OK;
272#endif /* VBOX_WITH_GUEST_CONTROL */
273}
274
275STDMETHODIMP GuestSession::COMGETTER(Files)(ComSafeArrayOut(IGuestFile *, aFiles))
276{
277#ifndef VBOX_WITH_GUEST_CONTROL
278 ReturnComNotImplemented();
279#else
280 CheckComArgOutSafeArrayPointerValid(aFiles);
281
282 AutoCaller autoCaller(this);
283 if (FAILED(autoCaller.rc())) return autoCaller.rc();
284
285 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
286
287 SafeIfaceArray<IGuestFile> collection(mData.mFiles);
288 collection.detachTo(ComSafeArrayOutArg(aFiles));
289
290 return S_OK;
291#endif /* VBOX_WITH_GUEST_CONTROL */
292}
293
294// private methods
295/////////////////////////////////////////////////////////////////////////////
296
297int GuestSession::directoryClose(ComObjPtr<GuestDirectory> pDirectory)
298{
299 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
300
301 for (SessionDirectories::iterator itDirs = mData.mDirectories.begin();
302 itDirs != mData.mDirectories.end(); ++itDirs)
303 {
304 if (pDirectory == (*itDirs))
305 {
306 mData.mDirectories.remove((*itDirs));
307 return VINF_SUCCESS;
308 }
309 }
310
311 return VERR_NOT_FOUND;
312}
313
314int GuestSession::fileClose(ComObjPtr<GuestFile> pFile)
315{
316 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
317
318 for (SessionFiles::iterator itFiles = mData.mFiles.begin();
319 itFiles != mData.mFiles.end(); ++itFiles)
320 {
321 if (pFile == (*itFiles))
322 {
323 mData.mFiles.remove((*itFiles));
324 return VINF_SUCCESS;
325 }
326 }
327
328 return VERR_NOT_FOUND;
329}
330
331int GuestSession::processClose(ComObjPtr<GuestProcess> pProcess)
332{
333 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
334
335 for (SessionProcesses::iterator itProcs = mData.mProcesses.begin();
336 itProcs != mData.mProcesses.end(); ++itProcs)
337 {
338 if (pProcess == (*itProcs))
339 {
340 mData.mProcesses.remove((*itProcs));
341 return VINF_SUCCESS;
342 }
343 }
344
345 return VERR_NOT_FOUND;
346}
347
348int GuestSession::processCreateExInteral(const Utf8Str &aCommand, ComSafeArrayIn(Utf8Str, aArguments), ComSafeArrayIn(Utf8Str, aEnvironment),
349 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
350 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
351 IGuestProcess **aProcess)
352{
353 AssertPtrReturn(aProcess, VERR_INVALID_POINTER);
354
355 /* Validate flags. */
356 com::SafeArray<ProcessCreateFlag_T> arrFlags(ComSafeArrayInArg(aFlags));
357 for (size_t i = 0; i < arrFlags.size(); i++)
358 {
359 if (arrFlags[i] == ExecuteProcessFlag_None)
360 continue;
361
362 if ( !(arrFlags[i] & ExecuteProcessFlag_IgnoreOrphanedProcesses)
363 && !(arrFlags[i] & ExecuteProcessFlag_WaitForProcessStartOnly)
364 && !(arrFlags[i] & ExecuteProcessFlag_Hidden)
365 && !(arrFlags[i] & ExecuteProcessFlag_NoProfile))
366 {
367 return VERR_INVALID_PARAMETER;
368 }
369 }
370
371 /* Adjust timeout. If set to 0, we define
372 * an infinite timeout. */
373 if (aTimeoutMS == 0)
374 aTimeoutMS = UINT32_MAX;
375
376 /** @tood Implement process priority + affinity. */
377
378 int rc;
379 ComObjPtr<GuestProcess> pGuestProcess;
380 try
381 {
382 /* Create the session object. */
383 HRESULT hr = pGuestProcess.createObject();
384 if (FAILED(hr)) throw VERR_COM_UNEXPECTED;
385
386 rc = pGuestProcess->init(this,
387 aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
388 ComSafeArrayInArg(aFlags), aTimeoutMS,
389 aPriority, ComSafeArrayInArg(aAffinity));
390 if (RT_FAILURE(rc)) throw rc;
391
392 mData.mProcesses.push_back(pGuestProcess);
393
394 /* Return guest session to the caller. */
395 hr = pGuestProcess.queryInterfaceTo(aProcess);
396 if (FAILED(hr)) throw VERR_COM_OBJECT_NOT_FOUND;
397 }
398 catch (int rc2)
399 {
400 rc = rc2;
401 }
402
403 return rc;
404
405#if 0
406 int rc = VINF_SUCCESS;
407
408 char **papszArgv = NULL;
409 try
410 {
411 /* Prepare arguments. */
412 uint32_t uNumArgs = 0;
413 if (aArguments)
414 {
415 com::SafeArray<IN_BSTR> args(ComSafeArrayInArg(aArguments));
416 uNumArgs = args.size();
417 papszArgv = (char**)RTMemAlloc(sizeof(char*) * (uNumArgs + 1));
418 AssertReturn(papszArgv, VERR_NO_MEMORY);
419 for (unsigned i = 0; RT_SUCCESS(rc) && i < uNumArgs; i++)
420 rc = RTUtf16ToUtf8(args[i], &papszArgv[i]);
421 papszArgv[uNumArgs] = NULL;
422
423 if (RT_FAILURE(rc))
424 return rc;
425 }
426
427 char *pszArgs = NULL;
428 if (uNumArgs)
429 {
430 rc = RTGetOptArgvToString(&pszArgs, papszArgv, RTGETOPTARGV_CNV_QUOTE_MS_CRT);
431 if (RT_FAILURE(rc)) throw rc;
432 }
433
434 /* Get number of arguments. */
435 uint32_t cbArgs = pszArgs ? strlen(pszArgs) + 1 : 0; /* Include terminating zero. */
436
437 /* Prepare environment. */
438 void *pvEnv = NULL;
439 uint32_t uNumEnv = 0;
440 uint32_t cbEnv = 0;
441 if (aEnvironment)
442 {
443 com::SafeArray<IN_BSTR> env(ComSafeArrayInArg(aEnvironment));
444
445 for (unsigned i = 0; RT_SUCCESS(rc) && i < env.size(); i++)
446 rc = prepareExecuteEnv(Utf8Str(env[i]).c_str(), &pvEnv, &cbEnv, &uNumEnv);
447 }
448 }
449 catch (int eRc)
450 {
451
452
453 rc = exRc;
454 }
455
456 for (unsigned i = 0; i < uNumArgs; i++)
457 RTMemFree(papszArgv[i]);
458 RTMemFree(papszArgv);
459#endif
460
461 return rc;
462}
463
464// implementation of public methods
465/////////////////////////////////////////////////////////////////////////////
466
467STDMETHODIMP GuestSession::Close(void)
468{
469#ifndef VBOX_WITH_GUEST_CONTROL
470 ReturnComNotImplemented();
471#else
472 uninit();
473
474 return S_OK;
475#endif /* VBOX_WITH_GUEST_CONTROL */
476}
477
478STDMETHODIMP GuestSession::CopyFrom(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
479{
480#ifndef VBOX_WITH_GUEST_CONTROL
481 ReturnComNotImplemented();
482#else
483 AutoCaller autoCaller(this);
484 if (FAILED(autoCaller.rc())) return autoCaller.rc();
485
486 ReturnComNotImplemented();
487#endif /* VBOX_WITH_GUEST_CONTROL */
488}
489
490STDMETHODIMP GuestSession::CopyTo(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(ULONG, aFlags), IProgress **aProgress)
491{
492#ifndef VBOX_WITH_GUEST_CONTROL
493 ReturnComNotImplemented();
494#else
495 AutoCaller autoCaller(this);
496 if (FAILED(autoCaller.rc())) return autoCaller.rc();
497
498 ReturnComNotImplemented();
499#endif /* VBOX_WITH_GUEST_CONTROL */
500}
501
502STDMETHODIMP GuestSession::DirectoryCreate(IN_BSTR aPath, ULONG aMode, ULONG aFlags, IGuestDirectory **aProgress)
503{
504#ifndef VBOX_WITH_GUEST_CONTROL
505 ReturnComNotImplemented();
506#else
507 AutoCaller autoCaller(this);
508 if (FAILED(autoCaller.rc())) return autoCaller.rc();
509
510 ReturnComNotImplemented();
511#endif /* VBOX_WITH_GUEST_CONTROL */
512}
513
514STDMETHODIMP GuestSession::DirectoryCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestDirectory **aDirectory)
515{
516#ifndef VBOX_WITH_GUEST_CONTROL
517 ReturnComNotImplemented();
518#else
519 AutoCaller autoCaller(this);
520 if (FAILED(autoCaller.rc())) return autoCaller.rc();
521
522 ReturnComNotImplemented();
523#endif /* VBOX_WITH_GUEST_CONTROL */
524}
525
526STDMETHODIMP GuestSession::DirectoryExists(IN_BSTR aPath, BOOL *aExists)
527{
528#ifndef VBOX_WITH_GUEST_CONTROL
529 ReturnComNotImplemented();
530#else
531 AutoCaller autoCaller(this);
532 if (FAILED(autoCaller.rc())) return autoCaller.rc();
533
534 ReturnComNotImplemented();
535#endif /* VBOX_WITH_GUEST_CONTROL */
536}
537
538STDMETHODIMP GuestSession::DirectoryOpen(IN_BSTR aPath, IN_BSTR aFilter, IN_BSTR aFlags, IGuestDirectory **aDirectory)
539{
540#ifndef VBOX_WITH_GUEST_CONTROL
541 ReturnComNotImplemented();
542#else
543 AutoCaller autoCaller(this);
544 if (FAILED(autoCaller.rc())) return autoCaller.rc();
545
546 ReturnComNotImplemented();
547#endif /* VBOX_WITH_GUEST_CONTROL */
548}
549
550STDMETHODIMP GuestSession::DirectoryQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
551{
552#ifndef VBOX_WITH_GUEST_CONTROL
553 ReturnComNotImplemented();
554#else
555 AutoCaller autoCaller(this);
556 if (FAILED(autoCaller.rc())) return autoCaller.rc();
557
558 ReturnComNotImplemented();
559#endif /* VBOX_WITH_GUEST_CONTROL */
560}
561
562STDMETHODIMP GuestSession::DirectoryRemove(IN_BSTR aPath)
563{
564#ifndef VBOX_WITH_GUEST_CONTROL
565 ReturnComNotImplemented();
566#else
567 AutoCaller autoCaller(this);
568 if (FAILED(autoCaller.rc())) return autoCaller.rc();
569
570 ReturnComNotImplemented();
571#endif /* VBOX_WITH_GUEST_CONTROL */
572}
573
574STDMETHODIMP GuestSession::DirectoryRemoveRecursive(IN_BSTR aPath, ComSafeArrayIn(DirectoryRemoveRecFlag_T, aFlags), IProgress **aProgress)
575{
576#ifndef VBOX_WITH_GUEST_CONTROL
577 ReturnComNotImplemented();
578#else
579 AutoCaller autoCaller(this);
580 if (FAILED(autoCaller.rc())) return autoCaller.rc();
581
582 ReturnComNotImplemented();
583#endif /* VBOX_WITH_GUEST_CONTROL */
584}
585
586STDMETHODIMP GuestSession::DirectoryRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
587{
588#ifndef VBOX_WITH_GUEST_CONTROL
589 ReturnComNotImplemented();
590#else
591 AutoCaller autoCaller(this);
592 if (FAILED(autoCaller.rc())) return autoCaller.rc();
593
594 ReturnComNotImplemented();
595#endif /* VBOX_WITH_GUEST_CONTROL */
596}
597
598STDMETHODIMP GuestSession::DirectorySetACL(IN_BSTR aPath, IN_BSTR aACL)
599{
600#ifndef VBOX_WITH_GUEST_CONTROL
601 ReturnComNotImplemented();
602#else
603 AutoCaller autoCaller(this);
604 if (FAILED(autoCaller.rc())) return autoCaller.rc();
605
606 ReturnComNotImplemented();
607#endif /* VBOX_WITH_GUEST_CONTROL */
608}
609
610STDMETHODIMP GuestSession::EnvironmentClear(void)
611{
612#ifndef VBOX_WITH_GUEST_CONTROL
613 ReturnComNotImplemented();
614#else
615 AutoCaller autoCaller(this);
616 if (FAILED(autoCaller.rc())) return autoCaller.rc();
617
618 ReturnComNotImplemented();
619#endif /* VBOX_WITH_GUEST_CONTROL */
620}
621
622STDMETHODIMP GuestSession::EnvironmentSet(IN_BSTR aName, IN_BSTR aValue)
623{
624#ifndef VBOX_WITH_GUEST_CONTROL
625 ReturnComNotImplemented();
626#else
627 AutoCaller autoCaller(this);
628 if (FAILED(autoCaller.rc())) return autoCaller.rc();
629
630 ReturnComNotImplemented();
631#endif /* VBOX_WITH_GUEST_CONTROL */
632}
633
634STDMETHODIMP GuestSession::EnvironmentSetArray(ComSafeArrayIn(IN_BSTR, aValues))
635{
636#ifndef VBOX_WITH_GUEST_CONTROL
637 ReturnComNotImplemented();
638#else
639 AutoCaller autoCaller(this);
640 if (FAILED(autoCaller.rc())) return autoCaller.rc();
641
642 ReturnComNotImplemented();
643#endif /* VBOX_WITH_GUEST_CONTROL */
644}
645
646STDMETHODIMP GuestSession::EnvironmentUnset(IN_BSTR aName)
647{
648#ifndef VBOX_WITH_GUEST_CONTROL
649 ReturnComNotImplemented();
650#else
651 AutoCaller autoCaller(this);
652 if (FAILED(autoCaller.rc())) return autoCaller.rc();
653
654 ReturnComNotImplemented();
655#endif /* VBOX_WITH_GUEST_CONTROL */
656}
657
658STDMETHODIMP GuestSession::FileCreateTemp(IN_BSTR aTemplate, ULONG aMode, IN_BSTR aName, IGuestFile **aFile)
659{
660#ifndef VBOX_WITH_GUEST_CONTROL
661 ReturnComNotImplemented();
662#else
663 AutoCaller autoCaller(this);
664 if (FAILED(autoCaller.rc())) return autoCaller.rc();
665
666 ReturnComNotImplemented();
667#endif /* VBOX_WITH_GUEST_CONTROL */
668}
669
670STDMETHODIMP GuestSession::FileExists(IN_BSTR aPath, BOOL *aExists)
671{
672#ifndef VBOX_WITH_GUEST_CONTROL
673 ReturnComNotImplemented();
674#else
675 AutoCaller autoCaller(this);
676 if (FAILED(autoCaller.rc())) return autoCaller.rc();
677
678 ReturnComNotImplemented();
679#endif /* VBOX_WITH_GUEST_CONTROL */
680}
681
682STDMETHODIMP GuestSession::FileOpen(IN_BSTR aPath, IN_BSTR aOpenMode, IN_BSTR aDisposition, ULONG aCreationMode, LONG64 aOffset, IGuestFile **aFile)
683{
684#ifndef VBOX_WITH_GUEST_CONTROL
685 ReturnComNotImplemented();
686#else
687 AutoCaller autoCaller(this);
688 if (FAILED(autoCaller.rc())) return autoCaller.rc();
689
690 ReturnComNotImplemented();
691#endif /* VBOX_WITH_GUEST_CONTROL */
692}
693
694STDMETHODIMP GuestSession::FileQueryInfo(IN_BSTR aPath, IGuestFsObjInfo **aInfo)
695{
696#ifndef VBOX_WITH_GUEST_CONTROL
697 ReturnComNotImplemented();
698#else
699 AutoCaller autoCaller(this);
700 if (FAILED(autoCaller.rc())) return autoCaller.rc();
701
702 ReturnComNotImplemented();
703#endif /* VBOX_WITH_GUEST_CONTROL */
704}
705
706STDMETHODIMP GuestSession::FileQuerySize(IN_BSTR aPath, LONG64 *aSize)
707{
708#ifndef VBOX_WITH_GUEST_CONTROL
709 ReturnComNotImplemented();
710#else
711 AutoCaller autoCaller(this);
712 if (FAILED(autoCaller.rc())) return autoCaller.rc();
713
714 ReturnComNotImplemented();
715#endif /* VBOX_WITH_GUEST_CONTROL */
716}
717
718STDMETHODIMP GuestSession::FileRemove(IN_BSTR aPath)
719{
720#ifndef VBOX_WITH_GUEST_CONTROL
721 ReturnComNotImplemented();
722#else
723 AutoCaller autoCaller(this);
724 if (FAILED(autoCaller.rc())) return autoCaller.rc();
725
726 ReturnComNotImplemented();
727#endif /* VBOX_WITH_GUEST_CONTROL */
728}
729
730STDMETHODIMP GuestSession::FileRename(IN_BSTR aSource, IN_BSTR aDest, ComSafeArrayIn(PathRenameFlag_T, aFlags))
731{
732#ifndef VBOX_WITH_GUEST_CONTROL
733 ReturnComNotImplemented();
734#else
735 AutoCaller autoCaller(this);
736 if (FAILED(autoCaller.rc())) return autoCaller.rc();
737
738 ReturnComNotImplemented();
739#endif /* VBOX_WITH_GUEST_CONTROL */
740}
741
742STDMETHODIMP GuestSession::FileSetACL(IN_BSTR aPath, IN_BSTR aACL)
743{
744#ifndef VBOX_WITH_GUEST_CONTROL
745 ReturnComNotImplemented();
746#else
747 AutoCaller autoCaller(this);
748 if (FAILED(autoCaller.rc())) return autoCaller.rc();
749
750 ReturnComNotImplemented();
751#endif /* VBOX_WITH_GUEST_CONTROL */
752}
753
754STDMETHODIMP GuestSession::ProcessCreate(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
755 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS, IGuestProcess **aProcess)
756{
757#ifndef VBOX_WITH_GUEST_CONTROL
758 ReturnComNotImplemented();
759#else
760 AutoCaller autoCaller(this);
761 if (FAILED(autoCaller.rc())) return autoCaller.rc();
762
763 CheckComArgOutPointerValid(aProcess);
764
765 com::SafeArray<LONG> aAffinity; /** @todo Process affinity, not used yet. */
766
767 int rc = processCreateExInteral(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
768 ComSafeArrayInArg(aFlags), aTimeoutMS,
769 ProcessPriority_Default, ComSafeArrayAsInParam(aAffinity), aProcess);
770 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
771#endif /* VBOX_WITH_GUEST_CONTROL */
772}
773
774STDMETHODIMP GuestSession::ProcessCreateEx(IN_BSTR aCommand, ComSafeArrayIn(IN_BSTR, aArguments), ComSafeArrayIn(IN_BSTR, aEnvironment),
775 ComSafeArrayIn(ProcessCreateFlag_T, aFlags), ULONG aTimeoutMS,
776 ProcessPriority_T aPriority, ComSafeArrayIn(LONG, aAffinity),
777 IGuestProcess **aProcess)
778{
779#ifndef VBOX_WITH_GUEST_CONTROL
780 ReturnComNotImplemented();
781#else
782 AutoCaller autoCaller(this);
783 if (FAILED(autoCaller.rc())) return autoCaller.rc();
784
785 CheckComArgOutPointerValid(aProcess);
786
787 int rc = processCreateExInteral(aCommand, ComSafeArrayInArg(aArguments), ComSafeArrayInArg(aEnvironment),
788 ComSafeArrayInArg(aFlags), aTimeoutMS,
789 aPriority, ComSafeArrayInArg(aAffinity), aProcess);
790 return RT_SUCCESS(rc) ? S_OK : VBOX_E_IPRT_ERROR;
791#endif /* VBOX_WITH_GUEST_CONTROL */
792}
793
794STDMETHODIMP GuestSession::ProcessGet(ULONG aPID, IGuestProcess **aProcess)
795{
796#ifndef VBOX_WITH_GUEST_CONTROL
797 ReturnComNotImplemented();
798#else
799 AutoCaller autoCaller(this);
800 if (FAILED(autoCaller.rc())) return autoCaller.rc();
801
802 ReturnComNotImplemented();
803#endif /* VBOX_WITH_GUEST_CONTROL */
804}
805
806STDMETHODIMP GuestSession::SetTimeout(ULONG aTimeoutMS)
807{
808#ifndef VBOX_WITH_GUEST_CONTROL
809 ReturnComNotImplemented();
810#else
811 AutoCaller autoCaller(this);
812 if (FAILED(autoCaller.rc())) return autoCaller.rc();
813
814 ReturnComNotImplemented();
815#endif /* VBOX_WITH_GUEST_CONTROL */
816}
817
818STDMETHODIMP GuestSession::SymlinkCreate(IN_BSTR aSource, IN_BSTR aTarget, SymlinkType_T aType)
819{
820#ifndef VBOX_WITH_GUEST_CONTROL
821 ReturnComNotImplemented();
822#else
823 AutoCaller autoCaller(this);
824 if (FAILED(autoCaller.rc())) return autoCaller.rc();
825
826 ReturnComNotImplemented();
827#endif /* VBOX_WITH_GUEST_CONTROL */
828}
829
830STDMETHODIMP GuestSession::SymlinkExists(IN_BSTR aSymlink, BOOL *aExists)
831{
832#ifndef VBOX_WITH_GUEST_CONTROL
833 ReturnComNotImplemented();
834#else
835 AutoCaller autoCaller(this);
836 if (FAILED(autoCaller.rc())) return autoCaller.rc();
837
838 ReturnComNotImplemented();
839#endif /* VBOX_WITH_GUEST_CONTROL */
840}
841
842STDMETHODIMP GuestSession::SymlinkRead(IN_BSTR aSymlink, ComSafeArrayIn(SymlinkReadFlag_T, aFlags), BSTR *aTarget)
843{
844#ifndef VBOX_WITH_GUEST_CONTROL
845 ReturnComNotImplemented();
846#else
847 AutoCaller autoCaller(this);
848 if (FAILED(autoCaller.rc())) return autoCaller.rc();
849
850 ReturnComNotImplemented();
851#endif /* VBOX_WITH_GUEST_CONTROL */
852}
853
854STDMETHODIMP GuestSession::SymlinkRemoveDirectory(IN_BSTR aPath)
855{
856#ifndef VBOX_WITH_GUEST_CONTROL
857 ReturnComNotImplemented();
858#else
859 AutoCaller autoCaller(this);
860 if (FAILED(autoCaller.rc())) return autoCaller.rc();
861
862 ReturnComNotImplemented();
863#endif /* VBOX_WITH_GUEST_CONTROL */
864}
865
866STDMETHODIMP GuestSession::SymlinkRemoveFile(IN_BSTR aFile)
867{
868#ifndef VBOX_WITH_GUEST_CONTROL
869 ReturnComNotImplemented();
870#else
871 AutoCaller autoCaller(this);
872 if (FAILED(autoCaller.rc())) return autoCaller.rc();
873
874 ReturnComNotImplemented();
875#endif /* VBOX_WITH_GUEST_CONTROL */
876}
877
Note: See TracBrowser for help on using the repository browser.

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