VirtualBox

source: vbox/trunk/src/VBox/Main/include/SharedFolderImpl.h@ 40685

Last change on this file since 40685 was 35757, checked in by vboxsync, 14 years ago

Main: do not fail loading machine settings if a shared folder path is not absolute (that breaks importing OVF and machine folders from other hosts since the rules about what constitutes an absolute path differ between host OSes). Instead, issue a runtime warning if a shared folder path is not absolute or does not exist on the host when the VM is powered up.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2010 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 ____H_SHAREDFOLDERIMPL
19#define ____H_SHAREDFOLDERIMPL
20
21#include "VirtualBoxBase.h"
22#include <VBox/shflsvc.h>
23
24class Console;
25
26class ATL_NO_VTABLE SharedFolder :
27 public VirtualBoxBase,
28 VBOX_SCRIPTABLE_IMPL(ISharedFolder)
29{
30public:
31
32 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SharedFolder, ISharedFolder)
33
34 DECLARE_NOT_AGGREGATABLE(SharedFolder)
35
36 DECLARE_PROTECT_FINAL_CONSTRUCT()
37
38 BEGIN_COM_MAP(SharedFolder)
39 VBOX_DEFAULT_INTERFACE_ENTRIES (ISharedFolder)
40 END_COM_MAP()
41
42 DECLARE_EMPTY_CTOR_DTOR (SharedFolder)
43
44 HRESULT FinalConstruct();
45 void FinalRelease();
46
47 // public initializer/uninitializer for internal purposes only
48 HRESULT init(Machine *aMachine, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
49 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat);
50 HRESULT init(Console *aConsole, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
51// HRESULT init(VirtualBox *aVirtualBox, const Utf8Str &aName, const Utf8Str &aHostPath, bool aWritable, bool aAutoMount, bool fFailOnError);
52 void uninit();
53
54 // ISharedFolder properties
55 STDMETHOD(COMGETTER(Name)) (BSTR *aName);
56 STDMETHOD(COMGETTER(HostPath)) (BSTR *aHostPath);
57 STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
58 STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
59 STDMETHOD(COMGETTER(AutoMount)) (BOOL *aAutoMount);
60 STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
61
62 // public methods for internal purposes only
63 // (ensure there is a caller and a read lock before calling them!)
64
65 /**
66 * Public internal method. Returns the shared folder's name. Needs caller! Locking not necessary.
67 * @return
68 */
69 const Utf8Str& getName() const;
70
71 /**
72 * Public internal method. Returns the shared folder's host path. Needs caller! Locking not necessary.
73 * @return
74 */
75 const Utf8Str& getHostPath() const;
76
77 /**
78 * Public internal method. Returns true if the shared folder is writable. Needs caller and locking!
79 * @return
80 */
81 bool isWritable() const;
82
83 /**
84 * Public internal method. Returns true if the shared folder is auto-mounted. Needs caller and locking!
85 * @return
86 */
87 bool isAutoMounted() const;
88
89protected:
90
91 HRESULT protectedInit(VirtualBoxBase *aParent,
92 const Utf8Str &aName,
93 const Utf8Str &aHostPath,
94 bool aWritable,
95 bool aAutoMount,
96 bool fFailOnError);
97private:
98
99 VirtualBoxBase * const mParent;
100
101 /* weak parents (only one of them is not null) */
102 Machine * const mMachine;
103 Console * const mConsole;
104 VirtualBox * const mVirtualBox;
105
106 struct Data; // opaque data struct, defined in SharedFolderImpl.cpp
107 Data *m;
108};
109
110#endif // ____H_SHAREDFOLDERIMPL
111/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

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