VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/GuestFsObjInfoImpl.cpp@ 47469

Last change on this file since 47469 was 42897, checked in by vboxsync, 12 years ago

Guest Control 2.0: Bugfixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.6 KB
Line 
1
2/* $Id: GuestFsObjInfoImpl.cpp 42897 2012-08-21 10:03:52Z 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 "GuestFsObjInfoImpl.h"
24#include "GuestCtrlImplPrivate.h"
25
26#include "Global.h"
27#include "AutoCaller.h"
28
29#include <VBox/com/array.h>
30
31#ifdef LOG_GROUP
32 #undef LOG_GROUP
33#endif
34#define LOG_GROUP LOG_GROUP_GUEST_CONTROL
35#include <VBox/log.h>
36
37
38// constructor / destructor
39/////////////////////////////////////////////////////////////////////////////
40
41DEFINE_EMPTY_CTOR_DTOR(GuestFsObjInfo)
42
43HRESULT GuestFsObjInfo::FinalConstruct(void)
44{
45 LogFlowThisFunc(("\n"));
46 return BaseFinalConstruct();
47}
48
49void GuestFsObjInfo::FinalRelease(void)
50{
51 LogFlowThisFuncEnter();
52 uninit();
53 BaseFinalRelease();
54 LogFlowThisFuncLeave();
55}
56
57// public initializer/uninitializer for internal purposes only
58/////////////////////////////////////////////////////////////////////////////
59
60int GuestFsObjInfo::init(const GuestFsObjData &objData)
61{
62 LogFlowThisFuncEnter();
63
64 /* Enclose the state transition NotReady->InInit->Ready. */
65 AutoInitSpan autoInitSpan(this);
66 AssertReturn(autoInitSpan.isOk(), E_FAIL);
67
68 mData = objData;
69
70 /* Confirm a successful initialization when it's the case. */
71 autoInitSpan.setSucceeded();
72
73 return VINF_SUCCESS;
74}
75
76/**
77 * Uninitializes the instance.
78 * Called from FinalRelease().
79 */
80void GuestFsObjInfo::uninit(void)
81{
82 LogFlowThisFunc(("\n"));
83
84 /* Enclose the state transition Ready->InUninit->NotReady. */
85 AutoUninitSpan autoUninitSpan(this);
86 if (autoUninitSpan.uninitDone())
87 return;
88}
89
90// implementation of public getters/setters for attributes
91/////////////////////////////////////////////////////////////////////////////
92
93STDMETHODIMP GuestFsObjInfo::COMGETTER(AccessTime)(LONG64 *aAccessTime)
94{
95#ifndef VBOX_WITH_GUEST_CONTROL
96 ReturnComNotImplemented();
97#else
98 AutoCaller autoCaller(this);
99 if (FAILED(autoCaller.rc())) return autoCaller.rc();
100
101 CheckComArgOutPointerValid(aAccessTime);
102
103 *aAccessTime = mData.mAccessTime;
104
105 return S_OK;
106#endif /* VBOX_WITH_GUEST_CONTROL */
107}
108
109STDMETHODIMP GuestFsObjInfo::COMGETTER(AllocatedSize)(LONG64 *aAllocatedSize)
110{
111#ifndef VBOX_WITH_GUEST_CONTROL
112 ReturnComNotImplemented();
113#else
114 AutoCaller autoCaller(this);
115 if (FAILED(autoCaller.rc())) return autoCaller.rc();
116
117 CheckComArgOutPointerValid(aAllocatedSize);
118
119 *aAllocatedSize = mData.mAllocatedSize;
120
121 return S_OK;
122#endif /* VBOX_WITH_GUEST_CONTROL */
123}
124
125STDMETHODIMP GuestFsObjInfo::COMGETTER(BirthTime)(LONG64 *aBirthTime)
126{
127#ifndef VBOX_WITH_GUEST_CONTROL
128 ReturnComNotImplemented();
129#else
130 AutoCaller autoCaller(this);
131 if (FAILED(autoCaller.rc())) return autoCaller.rc();
132
133 CheckComArgOutPointerValid(aBirthTime);
134
135 *aBirthTime = mData.mBirthTime;
136
137 return S_OK;
138#endif /* VBOX_WITH_GUEST_CONTROL */
139}
140
141STDMETHODIMP GuestFsObjInfo::COMGETTER(ChangeTime)(LONG64 *aChangeTime)
142{
143#ifndef VBOX_WITH_GUEST_CONTROL
144 ReturnComNotImplemented();
145#else
146 AutoCaller autoCaller(this);
147 if (FAILED(autoCaller.rc())) return autoCaller.rc();
148
149 CheckComArgOutPointerValid(aChangeTime);
150
151 *aChangeTime = mData.mChangeTime;
152
153 return S_OK;
154#endif /* VBOX_WITH_GUEST_CONTROL */
155}
156
157STDMETHODIMP GuestFsObjInfo::COMGETTER(DeviceNumber)(ULONG *aDeviceNumber)
158{
159#ifndef VBOX_WITH_GUEST_CONTROL
160 ReturnComNotImplemented();
161#else
162 AutoCaller autoCaller(this);
163 if (FAILED(autoCaller.rc())) return autoCaller.rc();
164
165 CheckComArgOutPointerValid(aDeviceNumber);
166
167 *aDeviceNumber = mData.mDeviceNumber;
168
169 return S_OK;
170#endif /* VBOX_WITH_GUEST_CONTROL */
171}
172
173STDMETHODIMP GuestFsObjInfo::COMGETTER(FileAttributes)(BSTR *aAttributes)
174{
175#ifndef VBOX_WITH_GUEST_CONTROL
176 ReturnComNotImplemented();
177#else
178 AutoCaller autoCaller(this);
179 if (FAILED(autoCaller.rc())) return autoCaller.rc();
180
181 CheckComArgOutPointerValid(aAttributes);
182
183 mData.mFileAttrs.cloneTo(aAttributes);
184
185 return S_OK;
186#endif /* VBOX_WITH_GUEST_CONTROL */
187}
188
189STDMETHODIMP GuestFsObjInfo::COMGETTER(GenerationId)(ULONG *aGenerationId)
190{
191#ifndef VBOX_WITH_GUEST_CONTROL
192 ReturnComNotImplemented();
193#else
194 AutoCaller autoCaller(this);
195 if (FAILED(autoCaller.rc())) return autoCaller.rc();
196
197 CheckComArgOutPointerValid(aGenerationId);
198
199 *aGenerationId = mData.mGenerationID;
200
201 return S_OK;
202#endif /* VBOX_WITH_GUEST_CONTROL */
203}
204
205STDMETHODIMP GuestFsObjInfo::COMGETTER(GID)(ULONG *aGID)
206{
207#ifndef VBOX_WITH_GUEST_CONTROL
208 ReturnComNotImplemented();
209#else
210 AutoCaller autoCaller(this);
211 if (FAILED(autoCaller.rc())) return autoCaller.rc();
212
213 CheckComArgOutPointerValid(aGID);
214
215 *aGID = mData.mGID;
216
217 return S_OK;
218#endif /* VBOX_WITH_GUEST_CONTROL */
219}
220
221STDMETHODIMP GuestFsObjInfo::COMGETTER(GroupName)(BSTR *aGroupName)
222{
223#ifndef VBOX_WITH_GUEST_CONTROL
224 ReturnComNotImplemented();
225#else
226 AutoCaller autoCaller(this);
227 if (FAILED(autoCaller.rc())) return autoCaller.rc();
228
229 CheckComArgOutPointerValid(aGroupName);
230
231 mData.mGroupName.cloneTo(aGroupName);
232
233 return S_OK;
234#endif /* VBOX_WITH_GUEST_CONTROL */
235}
236
237STDMETHODIMP GuestFsObjInfo::COMGETTER(HardLinks)(ULONG *aHardLinks)
238{
239#ifndef VBOX_WITH_GUEST_CONTROL
240 ReturnComNotImplemented();
241#else
242 AutoCaller autoCaller(this);
243 if (FAILED(autoCaller.rc())) return autoCaller.rc();
244
245 CheckComArgOutPointerValid(aHardLinks);
246
247 *aHardLinks = mData.mNumHardLinks;
248
249 return S_OK;
250#endif /* VBOX_WITH_GUEST_CONTROL */
251}
252
253STDMETHODIMP GuestFsObjInfo::COMGETTER(ModificationTime)(LONG64 *aModificationTime)
254{
255#ifndef VBOX_WITH_GUEST_CONTROL
256 ReturnComNotImplemented();
257#else
258 AutoCaller autoCaller(this);
259 if (FAILED(autoCaller.rc())) return autoCaller.rc();
260
261 CheckComArgOutPointerValid(aModificationTime);
262
263 *aModificationTime = mData.mModificationTime;
264
265 return S_OK;
266#endif /* VBOX_WITH_GUEST_CONTROL */
267}
268
269STDMETHODIMP GuestFsObjInfo::COMGETTER(Name)(BSTR *aName)
270{
271#ifndef VBOX_WITH_GUEST_CONTROL
272 ReturnComNotImplemented();
273#else
274 AutoCaller autoCaller(this);
275 if (FAILED(autoCaller.rc())) return autoCaller.rc();
276
277 CheckComArgOutPointerValid(aName);
278
279 mData.mName.cloneTo(aName);
280
281 return S_OK;
282#endif /* VBOX_WITH_GUEST_CONTROL */
283}
284
285STDMETHODIMP GuestFsObjInfo::COMGETTER(NodeId)(LONG64 *aNodeId)
286{
287#ifndef VBOX_WITH_GUEST_CONTROL
288 ReturnComNotImplemented();
289#else
290 AutoCaller autoCaller(this);
291 if (FAILED(autoCaller.rc())) return autoCaller.rc();
292
293 CheckComArgOutPointerValid(aNodeId);
294
295 *aNodeId = mData.mNodeID;
296
297 return S_OK;
298#endif /* VBOX_WITH_GUEST_CONTROL */
299}
300
301STDMETHODIMP GuestFsObjInfo::COMGETTER(NodeIdDevice)(ULONG *aNodeIdDevice)
302{
303#ifndef VBOX_WITH_GUEST_CONTROL
304 ReturnComNotImplemented();
305#else
306 AutoCaller autoCaller(this);
307 if (FAILED(autoCaller.rc())) return autoCaller.rc();
308
309 CheckComArgOutPointerValid(aNodeIdDevice);
310
311 *aNodeIdDevice = mData.mNodeIDDevice;
312
313 return S_OK;
314#endif /* VBOX_WITH_GUEST_CONTROL */
315}
316
317STDMETHODIMP GuestFsObjInfo::COMGETTER(ObjectSize)(LONG64 *aObjectSize)
318{
319#ifndef VBOX_WITH_GUEST_CONTROL
320 ReturnComNotImplemented();
321#else
322 AutoCaller autoCaller(this);
323 if (FAILED(autoCaller.rc())) return autoCaller.rc();
324
325 CheckComArgOutPointerValid(aObjectSize);
326
327 *aObjectSize = mData.mObjectSize;
328
329 return S_OK;
330#endif /* VBOX_WITH_GUEST_CONTROL */
331}
332
333STDMETHODIMP GuestFsObjInfo::COMGETTER(Type)(FsObjType_T *aType)
334{
335#ifndef VBOX_WITH_GUEST_CONTROL
336 ReturnComNotImplemented();
337#else
338 AutoCaller autoCaller(this);
339 if (FAILED(autoCaller.rc())) return autoCaller.rc();
340
341 CheckComArgOutPointerValid(aType);
342
343 *aType = mData.mType;
344
345 return S_OK;
346#endif /* VBOX_WITH_GUEST_CONTROL */
347}
348
349STDMETHODIMP GuestFsObjInfo::COMGETTER(UID)(ULONG *aUID)
350{
351#ifndef VBOX_WITH_GUEST_CONTROL
352 ReturnComNotImplemented();
353#else
354 AutoCaller autoCaller(this);
355 if (FAILED(autoCaller.rc())) return autoCaller.rc();
356
357 CheckComArgOutPointerValid(aUID);
358
359 *aUID = mData.mUID;
360
361 return S_OK;
362#endif /* VBOX_WITH_GUEST_CONTROL */
363}
364
365STDMETHODIMP GuestFsObjInfo::COMGETTER(UserFlags)(ULONG *aUserFlags)
366{
367#ifndef VBOX_WITH_GUEST_CONTROL
368 ReturnComNotImplemented();
369#else
370 AutoCaller autoCaller(this);
371 if (FAILED(autoCaller.rc())) return autoCaller.rc();
372
373 CheckComArgOutPointerValid(aUserFlags);
374
375 *aUserFlags = mData.mUserFlags;
376
377 return S_OK;
378#endif /* VBOX_WITH_GUEST_CONTROL */
379}
380
381STDMETHODIMP GuestFsObjInfo::COMGETTER(UserName)(BSTR *aUserName)
382{
383#ifndef VBOX_WITH_GUEST_CONTROL
384 ReturnComNotImplemented();
385#else
386 AutoCaller autoCaller(this);
387 if (FAILED(autoCaller.rc())) return autoCaller.rc();
388
389 CheckComArgOutPointerValid(aUserName);
390
391 mData.mUserName.cloneTo(aUserName);
392
393 return S_OK;
394#endif /* VBOX_WITH_GUEST_CONTROL */
395}
396
397STDMETHODIMP GuestFsObjInfo::COMGETTER(ACL)(BSTR *aACL)
398{
399#ifndef VBOX_WITH_GUEST_CONTROL
400 ReturnComNotImplemented();
401#else
402 AutoCaller autoCaller(this);
403 if (FAILED(autoCaller.rc())) return autoCaller.rc();
404
405 CheckComArgOutPointerValid(aACL);
406
407 mData.mACL.cloneTo(aACL);
408
409 return S_OK;
410#endif /* VBOX_WITH_GUEST_CONTROL */
411}
412
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use