[1] | 1 | /** @file
|
---|
| 2 | *
|
---|
| 3 | * VirtualBox COM class implementation
|
---|
| 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[8155] | 7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
[1] | 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
|
---|
[5999] | 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.
|
---|
[8155] | 16 | *
|
---|
| 17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
| 18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
| 19 | * additional information or have any questions.
|
---|
[1] | 20 | */
|
---|
| 21 |
|
---|
| 22 | #include "GuestOSTypeImpl.h"
|
---|
| 23 | #include "Logging.h"
|
---|
[3007] | 24 | #include <iprt/cpputils.h>
|
---|
[1] | 25 |
|
---|
| 26 | // constructor / destructor
|
---|
| 27 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 28 |
|
---|
| 29 | GuestOSType::GuestOSType()
|
---|
[7233] | 30 | : mOSType (VBOXOSTYPE_Unknown)
|
---|
[15064] | 31 | , mOSHint (VBOXOSHINT_NONE)
|
---|
[2567] | 32 | , mRAMSize (0), mVRAMSize (0)
|
---|
| 33 | , mHDDSize (0), mMonitorCount (0)
|
---|
[14664] | 34 | , mNetworkAdapterType (NetworkAdapterType_Am79C973)
|
---|
[1] | 35 | {
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | GuestOSType::~GuestOSType()
|
---|
| 39 | {
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[2567] | 42 | HRESULT GuestOSType::FinalConstruct()
|
---|
| 43 | {
|
---|
| 44 | return S_OK;
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | void GuestOSType::FinalRelease()
|
---|
| 48 | {
|
---|
| 49 | uninit();
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[1] | 52 | // public initializer/uninitializer for internal purposes only
|
---|
| 53 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 54 |
|
---|
| 55 | /**
|
---|
| 56 | * Initializes the guest OS type object.
|
---|
| 57 | *
|
---|
| 58 | * @returns COM result indicator
|
---|
[14437] | 59 | * @param aFamilyId os family short name string
|
---|
| 60 | * @param aFamilyDescription os family name string
|
---|
| 61 | * @param aId os short name string
|
---|
| 62 | * @param aDescription os name string
|
---|
| 63 | * @param aOSType global OS type ID
|
---|
[15064] | 64 | * @param aOSHint os configuration hint
|
---|
[14437] | 65 | * @param aRAMSize recommended RAM size in megabytes
|
---|
| 66 | * @param aVRAMSize recommended video memory size in megabytes
|
---|
| 67 | * @param aHDDSize recommended HDD size in megabytes
|
---|
[1] | 68 | */
|
---|
[14437] | 69 | HRESULT GuestOSType::init (const char *aFamilyId, const char *aFamilyDescription,
|
---|
| 70 | const char *aId, const char *aDescription,
|
---|
[15064] | 71 | VBOXOSTYPE aOSType, uint32_t aOSHint,
|
---|
[14664] | 72 | uint32_t aRAMSize, uint32_t aVRAMSize, uint32_t aHDDSize,
|
---|
| 73 | NetworkAdapterType_T aNetworkAdapterType)
|
---|
[1] | 74 | {
|
---|
[14930] | 75 | #if 0
|
---|
[14437] | 76 | LogFlowThisFunc (("aFamilyId='%s', aFamilyDescription='%s', "
|
---|
| 77 | "aId='%s', aDescription='%s', "
|
---|
[15064] | 78 | "aType=%d, aOSHint=%x, "
|
---|
[14664] | 79 | "aRAMSize=%d, aVRAMSize=%d, aHDDSize=%d, "
|
---|
| 80 | "aNetworkAdapterType=%d\n",
|
---|
[14437] | 81 | aFamilyId, aFamilyDescription,
|
---|
| 82 | aId, aDescription,
|
---|
[15064] | 83 | aOSType, aOSHint,
|
---|
[14664] | 84 | aRAMSize, aVRAMSize, aHDDSize,
|
---|
| 85 | aNetworkAdapterType));
|
---|
[14930] | 86 | #endif
|
---|
[1] | 87 |
|
---|
[14437] | 88 | ComAssertRet (aFamilyId && aFamilyDescription && aId && aDescription, E_INVALIDARG);
|
---|
[1] | 89 |
|
---|
[2567] | 90 | /* Enclose the state transition NotReady->InInit->Ready */
|
---|
| 91 | AutoInitSpan autoInitSpan (this);
|
---|
[14579] | 92 | AssertReturn (autoInitSpan.isOk(), E_FAIL);
|
---|
[1] | 93 |
|
---|
[14437] | 94 | unconst (mFamilyID) = aFamilyId;
|
---|
| 95 | unconst (mFamilyDescription) = aFamilyDescription;
|
---|
[2567] | 96 | unconst (mID) = aId;
|
---|
| 97 | unconst (mDescription) = aDescription;
|
---|
| 98 | unconst (mOSType) = aOSType;
|
---|
[15064] | 99 | unconst (mOSHint) = aOSHint;
|
---|
[2567] | 100 | unconst (mRAMSize) = aRAMSize;
|
---|
| 101 | unconst (mVRAMSize) = aVRAMSize;
|
---|
| 102 | unconst (mHDDSize) = aHDDSize;
|
---|
[14664] | 103 | unconst (mNetworkAdapterType) = aNetworkAdapterType;
|
---|
[2567] | 104 |
|
---|
| 105 | /* Confirm a successful initialization when it's the case */
|
---|
| 106 | autoInitSpan.setSucceeded();
|
---|
| 107 |
|
---|
[1] | 108 | return S_OK;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
[2567] | 111 | /**
|
---|
| 112 | * Uninitializes the instance and sets the ready flag to FALSE.
|
---|
| 113 | * Called either from FinalRelease() or by the parent when it gets destroyed.
|
---|
| 114 | */
|
---|
| 115 | void GuestOSType::uninit()
|
---|
| 116 | {
|
---|
| 117 | /* Enclose the state transition Ready->InUninit->NotReady */
|
---|
| 118 | AutoUninitSpan autoUninitSpan (this);
|
---|
| 119 | if (autoUninitSpan.uninitDone())
|
---|
| 120 | return;
|
---|
| 121 | }
|
---|
| 122 |
|
---|
[1] | 123 | // IGuestOSType properties
|
---|
| 124 | /////////////////////////////////////////////////////////////////////////////
|
---|
| 125 |
|
---|
[14437] | 126 | STDMETHODIMP GuestOSType::COMGETTER(FamilyId) (BSTR *aFamilyId)
|
---|
| 127 | {
|
---|
[14972] | 128 | CheckComArgOutPointerValid(aFamilyId);
|
---|
[14437] | 129 |
|
---|
| 130 | AutoCaller autoCaller (this);
|
---|
| 131 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 132 |
|
---|
| 133 | /* mFamilyID is constant during life time, no need to lock */
|
---|
| 134 | mFamilyID.cloneTo (aFamilyId);
|
---|
| 135 |
|
---|
| 136 | return S_OK;
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | STDMETHODIMP GuestOSType::COMGETTER(FamilyDescription) (BSTR *aFamilyDescription)
|
---|
| 140 | {
|
---|
[14972] | 141 | CheckComArgOutPointerValid(aFamilyDescription);
|
---|
[14437] | 142 |
|
---|
| 143 | AutoCaller autoCaller (this);
|
---|
| 144 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 145 |
|
---|
| 146 | /* mFamilyDescription is constant during life time, no need to lock */
|
---|
| 147 | mFamilyDescription.cloneTo (aFamilyDescription);
|
---|
| 148 |
|
---|
| 149 | return S_OK;
|
---|
| 150 | }
|
---|
| 151 |
|
---|
[2567] | 152 | STDMETHODIMP GuestOSType::COMGETTER(Id) (BSTR *aId)
|
---|
[1] | 153 | {
|
---|
[14972] | 154 | CheckComArgOutPointerValid(aId);
|
---|
[1] | 155 |
|
---|
[2567] | 156 | AutoCaller autoCaller (this);
|
---|
| 157 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 158 |
|
---|
| 159 | /* mID is constant during life time, no need to lock */
|
---|
| 160 | mID.cloneTo (aId);
|
---|
| 161 |
|
---|
[1] | 162 | return S_OK;
|
---|
| 163 | }
|
---|
| 164 |
|
---|
[2567] | 165 | STDMETHODIMP GuestOSType::COMGETTER(Description) (BSTR *aDescription)
|
---|
[1] | 166 | {
|
---|
[14972] | 167 | CheckComArgOutPointerValid(aDescription);
|
---|
[1] | 168 |
|
---|
[2567] | 169 | AutoCaller autoCaller (this);
|
---|
| 170 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 171 |
|
---|
| 172 | /* mDescription is constant during life time, no need to lock */
|
---|
| 173 | mDescription.cloneTo (aDescription);
|
---|
| 174 |
|
---|
[1] | 175 | return S_OK;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
[14437] | 178 | STDMETHODIMP GuestOSType::COMGETTER(Is64Bit) (BOOL *aIs64Bit)
|
---|
| 179 | {
|
---|
[14972] | 180 | CheckComArgOutPointerValid(aIs64Bit);
|
---|
[14437] | 181 |
|
---|
| 182 | AutoCaller autoCaller (this);
|
---|
| 183 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 184 |
|
---|
| 185 | /* mIs64Bit is constant during life time, no need to lock */
|
---|
[15064] | 186 | *aIs64Bit = !!(mOSHint & VBOXOSHINT_64BIT);
|
---|
[14437] | 187 |
|
---|
| 188 | return S_OK;
|
---|
| 189 | }
|
---|
| 190 |
|
---|
[14664] | 191 | STDMETHODIMP GuestOSType::COMGETTER(RecommendedIOAPIC) (BOOL *aRecommendedIOAPIC)
|
---|
| 192 | {
|
---|
[14972] | 193 | CheckComArgOutPointerValid(aRecommendedIOAPIC);
|
---|
[14664] | 194 |
|
---|
| 195 | AutoCaller autoCaller (this);
|
---|
| 196 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 197 |
|
---|
| 198 | /* mRecommendedIOAPIC is constant during life time, no need to lock */
|
---|
[15064] | 199 | *aRecommendedIOAPIC = !!(mOSHint & VBOXOSHINT_IOAPIC);
|
---|
[14664] | 200 |
|
---|
| 201 | return S_OK;
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 | STDMETHODIMP GuestOSType::COMGETTER(RecommendedVirtEx) (BOOL *aRecommendedVirtEx)
|
---|
| 205 | {
|
---|
[14972] | 206 | CheckComArgOutPointerValid(aRecommendedVirtEx);
|
---|
[14664] | 207 |
|
---|
| 208 | AutoCaller autoCaller (this);
|
---|
| 209 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 210 |
|
---|
| 211 | /* mRecommendedVirtEx is constant during life time, no need to lock */
|
---|
[15064] | 212 | *aRecommendedVirtEx = !!(mOSHint & VBOXOSHINT_HWVIRTEX);
|
---|
[14664] | 213 |
|
---|
| 214 | return S_OK;
|
---|
| 215 | }
|
---|
| 216 |
|
---|
[2567] | 217 | STDMETHODIMP GuestOSType::COMGETTER(RecommendedRAM) (ULONG *aRAMSize)
|
---|
[1] | 218 | {
|
---|
[14972] | 219 | CheckComArgOutPointerValid(aRAMSize);
|
---|
[1] | 220 |
|
---|
[2567] | 221 | AutoCaller autoCaller (this);
|
---|
| 222 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 223 |
|
---|
| 224 | /* mRAMSize is constant during life time, no need to lock */
|
---|
| 225 | *aRAMSize = mRAMSize;
|
---|
| 226 |
|
---|
[1] | 227 | return S_OK;
|
---|
| 228 | }
|
---|
| 229 |
|
---|
[2567] | 230 | STDMETHODIMP GuestOSType::COMGETTER(RecommendedVRAM) (ULONG *aVRAMSize)
|
---|
[1] | 231 | {
|
---|
[14972] | 232 | CheckComArgOutPointerValid(aVRAMSize);
|
---|
[1] | 233 |
|
---|
[2567] | 234 | AutoCaller autoCaller (this);
|
---|
| 235 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 236 |
|
---|
| 237 | /* mVRAMSize is constant during life time, no need to lock */
|
---|
| 238 | *aVRAMSize = mVRAMSize;
|
---|
| 239 |
|
---|
[1] | 240 | return S_OK;
|
---|
| 241 | }
|
---|
| 242 |
|
---|
[2567] | 243 | STDMETHODIMP GuestOSType::COMGETTER(RecommendedHDD) (ULONG *aHDDSize)
|
---|
[1] | 244 | {
|
---|
[14972] | 245 | CheckComArgOutPointerValid(aHDDSize);
|
---|
[1] | 246 |
|
---|
[2567] | 247 | AutoCaller autoCaller (this);
|
---|
| 248 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 249 |
|
---|
| 250 | /* mHDDSize is constant during life time, no need to lock */
|
---|
| 251 | *aHDDSize = mHDDSize;
|
---|
| 252 |
|
---|
[1] | 253 | return S_OK;
|
---|
| 254 | }
|
---|
[14664] | 255 |
|
---|
| 256 | STDMETHODIMP GuestOSType::COMGETTER(AdapterType) (NetworkAdapterType_T *aNetworkAdapterType)
|
---|
| 257 | {
|
---|
[14972] | 258 | CheckComArgOutPointerValid(aNetworkAdapterType);
|
---|
[14664] | 259 |
|
---|
| 260 | AutoCaller autoCaller (this);
|
---|
| 261 | CheckComRCReturnRC (autoCaller.rc());
|
---|
| 262 |
|
---|
| 263 | /* mNetworkAdapterType is constant during life time, no need to lock */
|
---|
| 264 | *aNetworkAdapterType = mNetworkAdapterType;
|
---|
| 265 |
|
---|
| 266 | return S_OK;
|
---|
| 267 | }
|
---|
[14772] | 268 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|