diff options
Diffstat (limited to 'src/VBox/Main/src-server/SystemPropertiesImpl.cpp')
-rw-r--r-- | src/VBox/Main/src-server/SystemPropertiesImpl.cpp | 78 |
1 files changed, 64 insertions, 14 deletions
diff --git a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp index 1dbd8ed83..813bbd53d 100644 --- a/src/VBox/Main/src-server/SystemPropertiesImpl.cpp +++ b/src/VBox/Main/src-server/SystemPropertiesImpl.cpp @@ -1,4 +1,4 @@ -/* $Id: SystemPropertiesImpl.cpp $ */ +/* $Id: SystemPropertiesImpl.cpp 37423 2011-06-12 18:37:56Z vboxsync $ */ /** @file * @@ -61,12 +61,13 @@ SystemProperties::~SystemProperties() HRESULT SystemProperties::FinalConstruct() { - return S_OK; + return BaseFinalConstruct(); } void SystemProperties::FinalRelease() { uninit(); + BaseFinalRelease(); } // public methods only for internal purposes @@ -273,7 +274,7 @@ STDMETHODIMP SystemProperties::COMGETTER(InfoVDSize)(LONG64 *infoVDSize) return S_OK; } -STDMETHODIMP SystemProperties::COMGETTER(NetworkAdapterCount)(ULONG *count) +STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) { CheckComArgOutPointerValid(count); @@ -281,12 +282,12 @@ STDMETHODIMP SystemProperties::COMGETTER(NetworkAdapterCount)(ULONG *count) if (FAILED(autoCaller.rc())) return autoCaller.rc(); /* no need to lock, this is const */ - *count = SchemaDefs::NetworkAdapterCount; + *count = SchemaDefs::SerialPortCount; return S_OK; } -STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) +STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count) { CheckComArgOutPointerValid(count); @@ -294,37 +295,87 @@ STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) if (FAILED(autoCaller.rc())) return autoCaller.rc(); /* no need to lock, this is const */ - *count = SchemaDefs::SerialPortCount; + *count = SchemaDefs::ParallelPortCount; return S_OK; } -STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count) +STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition) { - CheckComArgOutPointerValid(count); + CheckComArgOutPointerValid(aMaxBootPosition); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); /* no need to lock, this is const */ - *count = SchemaDefs::ParallelPortCount; + *aMaxBootPosition = SchemaDefs::MaxBootPosition; return S_OK; } -STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition) + +STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count) { - CheckComArgOutPointerValid(aMaxBootPosition); + CheckComArgOutPointerValid(count); AutoCaller autoCaller(this); if (FAILED(autoCaller.rc())) return autoCaller.rc(); - /* no need to lock, this is const */ - *aMaxBootPosition = SchemaDefs::MaxBootPosition; + ULONG uResult = 0; + + /* no need for locking, no state */ + switch (aChipset) + { + case ChipsetType_PIIX3: + uResult = SchemaDefs::NetworkAdapterCount; /* == 8 */ + break; + case ChipsetType_ICH9: + uResult = 36; + break; + default: + AssertMsgFailed(("Invalid chipset type %d\n", aChipset)); + } + + *count = uResult; return S_OK; } +STDMETHODIMP SystemProperties::GetMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count) +{ + CheckComArgOutPointerValid(count); + + AutoCaller autoCaller(this); + if (FAILED(autoCaller.rc())) return autoCaller.rc(); + + ULONG uResult = 0; + HRESULT rc = GetMaxNetworkAdapters(aChipset, &uResult); + if (FAILED(rc)) + return rc; + + /* no need for locking, no state */ + switch (aType) + { + case NetworkAttachmentType_NAT: + case NetworkAttachmentType_Internal: + /* chipset default is OK */ + break; + case NetworkAttachmentType_Bridged: + /* Maybe use current host interface count here? */ + break; + case NetworkAttachmentType_HostOnly: + uResult = 8; + break; + default: + AssertMsgFailed(("Unhandled attachment type %d\n", aType)); + } + + *count = uResult; + + return S_OK; +} + + STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aBus, ULONG *aMaxDevicesPerPort) { @@ -1084,4 +1135,3 @@ HRESULT SystemProperties::setDefaultVRDEExtPack(const Utf8Str &aExtPack) return S_OK; } - |