1 | /* $Id: GuestDirectoryImpl.h 84648 2020-06-03 08:11:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - Guest directory handling implementation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2020 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.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 MAIN_INCLUDED_GuestDirectoryImpl_h
|
---|
19 | #define MAIN_INCLUDED_GuestDirectoryImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "GuestDirectoryWrap.h"
|
---|
25 | #include "GuestFsObjInfoImpl.h"
|
---|
26 | #include "GuestProcessImpl.h"
|
---|
27 |
|
---|
28 | class GuestSession;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * TODO
|
---|
32 | */
|
---|
33 | class ATL_NO_VTABLE GuestDirectory :
|
---|
34 | public GuestDirectoryWrap,
|
---|
35 | public GuestObject
|
---|
36 | {
|
---|
37 | public:
|
---|
38 | /** @name COM and internal init/term/mapping cruft.
|
---|
39 | * @{ */
|
---|
40 | DECLARE_EMPTY_CTOR_DTOR(GuestDirectory)
|
---|
41 |
|
---|
42 | int init(Console *pConsole, GuestSession *pSession, ULONG aObjectID, const GuestDirectoryOpenInfo &openInfo);
|
---|
43 | void uninit(void);
|
---|
44 |
|
---|
45 | HRESULT FinalConstruct(void);
|
---|
46 | void FinalRelease(void);
|
---|
47 | /** @} */
|
---|
48 |
|
---|
49 | public:
|
---|
50 | /** @name Implemented virtual methods from GuestObject.
|
---|
51 | * @{ */
|
---|
52 | int i_callbackDispatcher(PVBOXGUESTCTRLHOSTCBCTX pCbCtx, PVBOXGUESTCTRLHOSTCALLBACK pSvcCb);
|
---|
53 | int i_onUnregister(void);
|
---|
54 | int i_onSessionStatusChange(GuestSessionStatus_T enmSessionStatus);
|
---|
55 | /** @} */
|
---|
56 |
|
---|
57 | public:
|
---|
58 | /** @name Public internal methods.
|
---|
59 | * @{ */
|
---|
60 | int i_closeInternal(int *pGuestRc);
|
---|
61 | int i_read(ComObjPtr<GuestFsObjInfo> &fsObjInfo, int *pGuestRc);
|
---|
62 | int i_readInternal(GuestFsObjData &objData, int *prcGuest);
|
---|
63 | /** @} */
|
---|
64 |
|
---|
65 | public:
|
---|
66 | /** @name Public static internal methods.
|
---|
67 | * @{ */
|
---|
68 | static Utf8Str i_guestErrorToString(int rcGuest, const char *pcszWhat);
|
---|
69 | /** @} */
|
---|
70 |
|
---|
71 | private:
|
---|
72 |
|
---|
73 | /** Wrapped @name IGuestDirectory properties
|
---|
74 | * @{ */
|
---|
75 | HRESULT getDirectoryName(com::Utf8Str &aDirectoryName);
|
---|
76 | HRESULT getFilter(com::Utf8Str &aFilter);
|
---|
77 | /** @} */
|
---|
78 |
|
---|
79 | /** Wrapped @name IGuestDirectory methods.
|
---|
80 | * @{ */
|
---|
81 | HRESULT close();
|
---|
82 | HRESULT read(ComPtr<IFsObjInfo> &aObjInfo);
|
---|
83 | /** @} */
|
---|
84 |
|
---|
85 | struct Data
|
---|
86 | {
|
---|
87 | /** The directory's open info. */
|
---|
88 | GuestDirectoryOpenInfo mOpenInfo;
|
---|
89 | /** The process tool instance to use. */
|
---|
90 | GuestProcessTool mProcessTool;
|
---|
91 | /** Object data cache.
|
---|
92 | * Its mName attribute acts as a beacon if the cache is valid or not. */
|
---|
93 | GuestFsObjData mObjData;
|
---|
94 | } mData;
|
---|
95 | };
|
---|
96 |
|
---|
97 | #endif /* !MAIN_INCLUDED_GuestDirectoryImpl_h */
|
---|
98 |
|
---|