1 |
|
---|
2 | /* $Id: GuestDirectoryImpl.cpp 42525 2012-08-02 10:24:28Z 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 "GuestDirectoryImpl.h"
|
---|
24 | #include "GuestCtrlImplPrivate.h"
|
---|
25 |
|
---|
26 | #include "Global.h"
|
---|
27 | #include "AutoCaller.h"
|
---|
28 |
|
---|
29 | #include <VBox/com/array.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | // constructor / destructor
|
---|
33 | /////////////////////////////////////////////////////////////////////////////
|
---|
34 |
|
---|
35 | DEFINE_EMPTY_CTOR_DTOR(GuestDirectory)
|
---|
36 |
|
---|
37 | HRESULT GuestDirectory::FinalConstruct(void)
|
---|
38 | {
|
---|
39 | LogFlowThisFunc(("\n"));
|
---|
40 | return BaseFinalConstruct();
|
---|
41 | }
|
---|
42 |
|
---|
43 | void GuestDirectory::FinalRelease(void)
|
---|
44 | {
|
---|
45 | LogFlowThisFuncEnter();
|
---|
46 | uninit();
|
---|
47 | BaseFinalRelease();
|
---|
48 | LogFlowThisFuncLeave();
|
---|
49 | }
|
---|
50 |
|
---|
51 | // public initializer/uninitializer for internal purposes only
|
---|
52 | /////////////////////////////////////////////////////////////////////////////
|
---|
53 |
|
---|
54 | int GuestDirectory::init(GuestSession *aSession, const Utf8Str &strPath)
|
---|
55 | {
|
---|
56 | /* Enclose the state transition NotReady->InInit->Ready. */
|
---|
57 | AutoInitSpan autoInitSpan(this);
|
---|
58 | AssertReturn(autoInitSpan.isOk(), E_FAIL);
|
---|
59 |
|
---|
60 | mData.mParent = aSession;
|
---|
61 | mData.mName = strPath;
|
---|
62 |
|
---|
63 | /* Confirm a successful initialization when it's the case. */
|
---|
64 | autoInitSpan.setSucceeded();
|
---|
65 |
|
---|
66 | return VINF_SUCCESS;
|
---|
67 | }
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Uninitializes the instance.
|
---|
71 | * Called from FinalRelease().
|
---|
72 | */
|
---|
73 | void GuestDirectory::uninit(void)
|
---|
74 | {
|
---|
75 | LogFlowThisFunc(("\n"));
|
---|
76 |
|
---|
77 | /* Enclose the state transition Ready->InUninit->NotReady. */
|
---|
78 | AutoUninitSpan autoUninitSpan(this);
|
---|
79 | if (autoUninitSpan.uninitDone())
|
---|
80 | return;
|
---|
81 | }
|
---|
82 |
|
---|
83 | // implementation of public getters/setters for attributes
|
---|
84 | /////////////////////////////////////////////////////////////////////////////
|
---|
85 |
|
---|
86 | STDMETHODIMP GuestDirectory::COMGETTER(DirectoryName)(BSTR *aName)
|
---|
87 | {
|
---|
88 | LogFlowThisFuncEnter();
|
---|
89 |
|
---|
90 | CheckComArgOutPointerValid(aName);
|
---|
91 |
|
---|
92 | AutoCaller autoCaller(this);
|
---|
93 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
94 |
|
---|
95 | AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
|
---|
96 |
|
---|
97 | mData.mName.cloneTo(aName);
|
---|
98 |
|
---|
99 | return S_OK;
|
---|
100 | }
|
---|
101 |
|
---|
102 | // implementation of public methods
|
---|
103 | /////////////////////////////////////////////////////////////////////////////
|
---|
104 |
|
---|
105 | STDMETHODIMP GuestDirectory::Read(IFsObjInfo **aInfo)
|
---|
106 | {
|
---|
107 | #ifndef VBOX_WITH_GUEST_CONTROL
|
---|
108 | ReturnComNotImplemented();
|
---|
109 | #else
|
---|
110 | AutoCaller autoCaller(this);
|
---|
111 | if (FAILED(autoCaller.rc())) return autoCaller.rc();
|
---|
112 |
|
---|
113 | ReturnComNotImplemented();
|
---|
114 | #endif /* VBOX_WITH_GUEST_CONTROL */
|
---|
115 | }
|
---|
116 |
|
---|