1 | /* $Id: MediumIOImpl.h 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox COM class implementation - MediumIO.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2018-2022 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_MediumIOImpl_h
|
---|
19 | #define MAIN_INCLUDED_MediumIOImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "MediumIOWrap.h"
|
---|
25 | #include "VirtualBoxBase.h"
|
---|
26 | #include "AutoCaller.h"
|
---|
27 |
|
---|
28 | class ATL_NO_VTABLE MediumIO :
|
---|
29 | public MediumIOWrap
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | /** @name Dummy/standard constructors and destructors.
|
---|
33 | * @{ */
|
---|
34 | DECLARE_COMMON_CLASS_METHODS(MediumIO)
|
---|
35 | HRESULT FinalConstruct();
|
---|
36 | void FinalRelease();
|
---|
37 | /** @} */
|
---|
38 |
|
---|
39 | /** @name Initializer & uninitializer.
|
---|
40 | * @{ */
|
---|
41 | HRESULT initForMedium(Medium *pMedium, VirtualBox *pVirtualBox, bool fWritable,
|
---|
42 | com::Utf8Str const &rStrKeyId, com::Utf8Str const &rStrPassword);
|
---|
43 | void uninit();
|
---|
44 | /** @} */
|
---|
45 |
|
---|
46 | private:
|
---|
47 | /** @name Wrapped IMediumIO properties
|
---|
48 | * @{ */
|
---|
49 | HRESULT getMedium(ComPtr<IMedium> &a_rPtrMedium);
|
---|
50 | HRESULT getWritable(BOOL *a_fWritable);
|
---|
51 | HRESULT getExplorer(ComPtr<IVFSExplorer> &a_rPtrExplorer);
|
---|
52 | /** @} */
|
---|
53 |
|
---|
54 | /** @name Wrapped IMediumIO methods
|
---|
55 | * @{ */
|
---|
56 | HRESULT read(LONG64 a_off, ULONG a_cbRead, std::vector<BYTE> &a_rData);
|
---|
57 | HRESULT write(LONG64 a_off, const std::vector<BYTE> &a_rData, ULONG *a_pcbWritten);
|
---|
58 | HRESULT formatFAT(BOOL a_fQuick);
|
---|
59 | HRESULT initializePartitionTable(PartitionTableType_T a_enmFormat, BOOL a_fWholeDiskInOneEntry);
|
---|
60 | HRESULT convertToStream(const com::Utf8Str &aFormat,
|
---|
61 | const std::vector<MediumVariant_T> &aVariant,
|
---|
62 | ULONG aBufferSize,
|
---|
63 | ComPtr<IDataStream> &aStream,
|
---|
64 | ComPtr<IProgress> &aProgress);
|
---|
65 | HRESULT close();
|
---|
66 | /** @} */
|
---|
67 |
|
---|
68 | /** @name Internal workers.
|
---|
69 | * @{ */
|
---|
70 | void i_close();
|
---|
71 | /** @} */
|
---|
72 |
|
---|
73 | struct Data;
|
---|
74 | Data *m;
|
---|
75 |
|
---|
76 | class StreamTask;
|
---|
77 | friend class StreamTask;
|
---|
78 | };
|
---|
79 |
|
---|
80 | #endif /* !MAIN_INCLUDED_MediumIOImpl_h */
|
---|
81 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|
82 |
|
---|