1 | /* $Id: MediumIOImpl.h 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation - MediumIO.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2018-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_MediumIOImpl_h
|
---|
29 | #define MAIN_INCLUDED_MediumIOImpl_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "MediumIOWrap.h"
|
---|
35 | #include "VirtualBoxBase.h"
|
---|
36 | #include "AutoCaller.h"
|
---|
37 |
|
---|
38 | class ATL_NO_VTABLE MediumIO :
|
---|
39 | public MediumIOWrap
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | /** @name Dummy/standard constructors and destructors.
|
---|
43 | * @{ */
|
---|
44 | DECLARE_COMMON_CLASS_METHODS(MediumIO)
|
---|
45 | HRESULT FinalConstruct();
|
---|
46 | void FinalRelease();
|
---|
47 | /** @} */
|
---|
48 |
|
---|
49 | /** @name Initializer & uninitializer.
|
---|
50 | * @{ */
|
---|
51 | HRESULT initForMedium(Medium *pMedium, VirtualBox *pVirtualBox, bool fWritable,
|
---|
52 | com::Utf8Str const &rStrKeyId, com::Utf8Str const &rStrPassword);
|
---|
53 | void uninit();
|
---|
54 | /** @} */
|
---|
55 |
|
---|
56 | private:
|
---|
57 | /** @name Wrapped IMediumIO properties
|
---|
58 | * @{ */
|
---|
59 | HRESULT getMedium(ComPtr<IMedium> &a_rPtrMedium);
|
---|
60 | HRESULT getWritable(BOOL *a_fWritable);
|
---|
61 | HRESULT getExplorer(ComPtr<IVFSExplorer> &a_rPtrExplorer);
|
---|
62 | /** @} */
|
---|
63 |
|
---|
64 | /** @name Wrapped IMediumIO methods
|
---|
65 | * @{ */
|
---|
66 | HRESULT read(LONG64 a_off, ULONG a_cbRead, std::vector<BYTE> &a_rData);
|
---|
67 | HRESULT write(LONG64 a_off, const std::vector<BYTE> &a_rData, ULONG *a_pcbWritten);
|
---|
68 | HRESULT formatFAT(BOOL a_fQuick);
|
---|
69 | HRESULT initializePartitionTable(PartitionTableType_T a_enmFormat, BOOL a_fWholeDiskInOneEntry);
|
---|
70 | HRESULT convertToStream(const com::Utf8Str &aFormat,
|
---|
71 | const std::vector<MediumVariant_T> &aVariant,
|
---|
72 | ULONG aBufferSize,
|
---|
73 | ComPtr<IDataStream> &aStream,
|
---|
74 | ComPtr<IProgress> &aProgress);
|
---|
75 | HRESULT close();
|
---|
76 | /** @} */
|
---|
77 |
|
---|
78 | /** @name Internal workers.
|
---|
79 | * @{ */
|
---|
80 | void i_close();
|
---|
81 | /** @} */
|
---|
82 |
|
---|
83 | struct Data;
|
---|
84 | Data *m;
|
---|
85 |
|
---|
86 | class StreamTask;
|
---|
87 | friend class StreamTask;
|
---|
88 | };
|
---|
89 |
|
---|
90 | #endif /* !MAIN_INCLUDED_MediumIOImpl_h */
|
---|
91 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|
92 |
|
---|