1 | /* $Id: HostDrivePartitionImpl.h 85933 2020-08-28 16:49:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox Main - IHostDrivePartition implementation, VBoxSVC.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2019 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_HostDrivePartitionImpl_h
|
---|
19 | #define MAIN_INCLUDED_HostDrivePartitionImpl_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "HostDrivePartitionWrap.h"
|
---|
25 |
|
---|
26 | #include <iprt/dvm.h>
|
---|
27 |
|
---|
28 | class ATL_NO_VTABLE HostDrivePartition
|
---|
29 | : public HostDrivePartitionWrap
|
---|
30 | {
|
---|
31 | public:
|
---|
32 | DECLARE_EMPTY_CTOR_DTOR(HostDrivePartition)
|
---|
33 |
|
---|
34 | HRESULT FinalConstruct();
|
---|
35 | void FinalRelease();
|
---|
36 |
|
---|
37 | /** @name Public initializer/uninitializer for internal purposes only.
|
---|
38 | * @{ */
|
---|
39 | HRESULT initFromDvmVol(RTDVMVOLUME hVol);
|
---|
40 | void uninit();
|
---|
41 | /** @} */
|
---|
42 |
|
---|
43 | private:
|
---|
44 | /** @name wrapped IHostDrivePartition properties
|
---|
45 | * @{ */
|
---|
46 | /* Common: */
|
---|
47 | virtual HRESULT getNumber(ULONG *aNumber) RT_OVERRIDE { *aNumber = m.number; return S_OK; }
|
---|
48 | virtual HRESULT getSize(LONG64 *aSize) RT_OVERRIDE { *aSize = m.cbVol; return S_OK; }
|
---|
49 | virtual HRESULT getStart(LONG64 *aStart) RT_OVERRIDE { *aStart = m.offStart; return S_OK; }
|
---|
50 | virtual HRESULT getType(PartitionType_T *aType) RT_OVERRIDE { *aType = m.enmType; return S_OK; }
|
---|
51 | virtual HRESULT getActive(BOOL *aActive) RT_OVERRIDE { *aActive = m.active; return S_OK; }
|
---|
52 | /* MBR: */
|
---|
53 | virtual HRESULT getTypeMBR(ULONG *aTypeMBR) RT_OVERRIDE { *aTypeMBR = m.bMBRType; return S_OK; }
|
---|
54 | virtual HRESULT getStartCylinder(ULONG *aStartCylinder) RT_OVERRIDE { *aStartCylinder = m.firstCylinder; return S_OK; }
|
---|
55 | virtual HRESULT getStartHead(ULONG *aStartHead) RT_OVERRIDE { *aStartHead = m.firstHead; return S_OK; }
|
---|
56 | virtual HRESULT getStartSector(ULONG *aStartSector) RT_OVERRIDE { *aStartSector = m.firstSector; return S_OK; }
|
---|
57 | virtual HRESULT getEndCylinder(ULONG *aEndCylinder) RT_OVERRIDE { *aEndCylinder = m.lastCylinder; return S_OK; }
|
---|
58 | virtual HRESULT getEndHead(ULONG *aEndHead) RT_OVERRIDE { *aEndHead = m.lastHead; return S_OK; }
|
---|
59 | virtual HRESULT getEndSector(ULONG *aEndSector) RT_OVERRIDE { *aEndSector = m.lastSector; return S_OK; }
|
---|
60 | /* GPT: */
|
---|
61 | virtual HRESULT getTypeUuid(com::Guid &aTypeUuid) RT_OVERRIDE { aTypeUuid = m.typeUuid; return S_OK; }
|
---|
62 | virtual HRESULT getUuid(com::Guid &aUuid) RT_OVERRIDE { aUuid = m.uuid; return S_OK; }
|
---|
63 | virtual HRESULT getName(com::Utf8Str &aName) RT_OVERRIDE { return aName.assignEx(m.name); };
|
---|
64 | /** @} */
|
---|
65 |
|
---|
66 | /** Data. */
|
---|
67 | struct Data
|
---|
68 | {
|
---|
69 | Data()
|
---|
70 | : number(0)
|
---|
71 | , cbVol(0)
|
---|
72 | , offStart(0)
|
---|
73 | , enmType(PartitionType_Unknown)
|
---|
74 | , active(FALSE)
|
---|
75 | , bMBRType(0)
|
---|
76 | , firstCylinder(0)
|
---|
77 | , firstHead(0)
|
---|
78 | , firstSector(0)
|
---|
79 | , lastCylinder(0)
|
---|
80 | , lastHead(0)
|
---|
81 | , lastSector(0)
|
---|
82 | , typeUuid()
|
---|
83 | , uuid()
|
---|
84 | , name()
|
---|
85 | {
|
---|
86 | }
|
---|
87 |
|
---|
88 | ULONG number;
|
---|
89 | LONG64 cbVol;
|
---|
90 | LONG64 offStart;
|
---|
91 | PartitionType_T enmType;
|
---|
92 | BOOL active;
|
---|
93 | /** @name MBR specifics
|
---|
94 | * @{ */
|
---|
95 | uint8_t bMBRType;
|
---|
96 | uint16_t firstCylinder;
|
---|
97 | uint8_t firstHead;
|
---|
98 | uint8_t firstSector;
|
---|
99 | uint16_t lastCylinder;
|
---|
100 | uint8_t lastHead;
|
---|
101 | uint8_t lastSector;
|
---|
102 | /** @} */
|
---|
103 | /** @name GPT specifics
|
---|
104 | * @{ */
|
---|
105 | com::Guid typeUuid;
|
---|
106 | com::Guid uuid;
|
---|
107 | com::Utf8Str name;
|
---|
108 | /** @} */
|
---|
109 | };
|
---|
110 |
|
---|
111 | Data m;
|
---|
112 | };
|
---|
113 |
|
---|
114 | #endif /* !MAIN_INCLUDED_HostDrivePartitionImpl_h */
|
---|
115 |
|
---|
116 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|