VirtualBox

source: vbox/trunk/src/VBox/Main/include/HostDrivePartitionImpl.h@ 107044

Last change on this file since 107044 was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

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