Changeset 49951 in vbox
- Timestamp:
- Dec 17, 2013 11:44:22 AM (11 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r48989 r49951 7 7 8 8 /* 9 * Copyright (C) 2006-201 2Oracle Corporation9 * Copyright (C) 2006-2013 Oracle Corporation 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define ____H_NETWORKADAPTER 22 22 23 #include "VirtualBoxBase.h" 24 #include "NATEngineImpl.h" 25 #include "BandwidthGroupImpl.h" 23 #include "NetworkAdapterWrap.h" 26 24 27 25 class GuestOSType; 26 class BandwidthControl; 27 class BandwidthGroup; 28 class NATEngine; 28 29 29 30 namespace settings … … 33 34 34 35 class ATL_NO_VTABLE NetworkAdapter : 35 public VirtualBoxBase, 36 VBOX_SCRIPTABLE_IMPL(INetworkAdapter) 36 public NetworkAdapterWrap 37 37 { 38 38 public: 39 40 DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter) 41 42 HRESULT FinalConstruct(); 43 void FinalRelease(); 44 45 // public initializer/uninitializer for internal purposes only 46 HRESULT init(Machine *aParent, ULONG aSlot); 47 HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false); 48 HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat); 49 void uninit(); 50 51 // public methods only for internal purposes 52 HRESULT i_loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data); 53 HRESULT i_saveSettings(settings::NetworkAdapter &data); 54 55 bool i_isModified(); 56 void i_rollback(); 57 void i_commit(); 58 void i_copyFrom(NetworkAdapter *aThat); 59 void i_applyDefaults(GuestOSType *aOsType); 60 61 ComObjPtr<NetworkAdapter> i_getPeer(); 62 63 private: 64 65 // wrapped INetworkAdapter properties 66 HRESULT getAdapterType(NetworkAdapterType_T *aAdapterType); 67 HRESULT setAdapterType(NetworkAdapterType_T aAdapterType); 68 HRESULT getSlot(ULONG *aSlot); 69 HRESULT getEnabled(BOOL *aEnabled); 70 HRESULT setEnabled(BOOL aEnabled); 71 HRESULT getMACAddress(com::Utf8Str &aMACAddress); 72 HRESULT setMACAddress(const com::Utf8Str &aMACAddress); 73 HRESULT getAttachmentType(NetworkAttachmentType_T *aAttachmentType); 74 HRESULT setAttachmentType(NetworkAttachmentType_T aAttachmentType); 75 HRESULT getBridgedInterface(com::Utf8Str &aBridgedInterface); 76 HRESULT setBridgedInterface(const com::Utf8Str &aBridgedInterface); 77 HRESULT getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface); 78 HRESULT setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface); 79 HRESULT getInternalNetwork(com::Utf8Str &aInternalNetwork); 80 HRESULT setInternalNetwork(const com::Utf8Str &aInternalNetwork); 81 HRESULT getNATNetwork(com::Utf8Str &aNATNetwork); 82 HRESULT setNATNetwork(const com::Utf8Str &aNATNetwork); 83 HRESULT getGenericDriver(com::Utf8Str &aGenericDriver); 84 HRESULT setGenericDriver(const com::Utf8Str &aGenericDriver); 85 HRESULT getCableConnected(BOOL *aCableConnected); 86 HRESULT setCableConnected(BOOL aCableConnected); 87 HRESULT getLineSpeed(ULONG *aLineSpeed); 88 HRESULT setLineSpeed(ULONG aLineSpeed); 89 HRESULT getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy); 90 HRESULT setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy); 91 HRESULT getTraceEnabled(BOOL *aTraceEnabled); 92 HRESULT setTraceEnabled(BOOL aTraceEnabled); 93 HRESULT getTraceFile(com::Utf8Str &aTraceFile); 94 HRESULT setTraceFile(const com::Utf8Str &aTraceFile); 95 HRESULT getNATEngine(ComPtr<INATEngine> &aNATEngine); 96 HRESULT getBootPriority(ULONG *aBootPriority); 97 HRESULT setBootPriority(ULONG aBootPriority); 98 HRESULT getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup); 99 HRESULT setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup); 100 101 // wrapped INetworkAdapter methods 102 HRESULT getProperty(const com::Utf8Str &aKey, 103 com::Utf8Str &aValue); 104 HRESULT setProperty(const com::Utf8Str &aKey, 105 const com::Utf8Str &aValue); 106 HRESULT getProperties(const com::Utf8Str &aNames, 107 std::vector<com::Utf8Str> &aReturnNames, 108 std::vector<com::Utf8Str> &aReturnValues); 109 // Misc. 110 void i_generateMACAddress(); 111 HRESULT i_updateMacAddress(Utf8Str aMacAddress); 112 void i_updateBandwidthGroup(BandwidthGroup *aBwGroup); 113 HRESULT i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName); 114 HRESULT i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName); 115 116 typedef std::map<com::Utf8Str, com::Utf8Str> StringsMap; 39 117 40 118 struct Data … … 56 134 ULONG mSlot; 57 135 BOOL mEnabled; 58 Bstr mMACAddress;136 com::Utf8Str mMACAddress; 59 137 NetworkAttachmentType_T mAttachmentType; 60 138 BOOL mCableConnected; … … 62 140 NetworkAdapterPromiscModePolicy_T mPromiscModePolicy; 63 141 BOOL mTraceEnabled; 64 Bstr mTraceFile;65 Bstr mBridgedInterface;66 Bstr mHostOnlyInterface;67 Bstr mInternalNetwork;68 Bstr mNATNetwork;69 Bstr mGenericDriver;70 settings::StringsMap mGenericProperties;142 com::Utf8Str mTraceFile; 143 com::Utf8Str mBridgedInterface; 144 com::Utf8Str mHostOnlyInterface; 145 com::Utf8Str mInternalNetwork; 146 com::Utf8Str mNATNetwork; 147 com::Utf8Str mGenericDriver; 148 StringsMap mGenericProperties; 71 149 ULONG mBootPriority; 72 Utf8Str mBandwidthGroup;150 com::Utf8Str mBandwidthGroup; 73 151 }; 74 75 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(NetworkAdapter, INetworkAdapter)76 77 DECLARE_NOT_AGGREGATABLE(NetworkAdapter)78 79 DECLARE_PROTECT_FINAL_CONSTRUCT()80 81 BEGIN_COM_MAP(NetworkAdapter)82 VBOX_DEFAULT_INTERFACE_ENTRIES(INetworkAdapter)83 END_COM_MAP()84 85 DECLARE_EMPTY_CTOR_DTOR(NetworkAdapter)86 87 HRESULT FinalConstruct();88 void FinalRelease();89 90 // public initializer/uninitializer for internal purposes only91 HRESULT init(Machine *aParent, ULONG aSlot);92 HRESULT init(Machine *aParent, NetworkAdapter *aThat, bool aReshare = false);93 HRESULT initCopy(Machine *aParent, NetworkAdapter *aThat);94 void uninit();95 96 // INetworkAdapter properties97 STDMETHOD(COMGETTER(AdapterType))(NetworkAdapterType_T *aAdapterType);98 STDMETHOD(COMSETTER(AdapterType))(NetworkAdapterType_T aAdapterType);99 STDMETHOD(COMGETTER(Slot))(ULONG *aSlot);100 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);101 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);102 STDMETHOD(COMGETTER(MACAddress))(BSTR *aMACAddress);103 STDMETHOD(COMSETTER(MACAddress))(IN_BSTR aMACAddress);104 STDMETHOD(COMGETTER(AttachmentType))(NetworkAttachmentType_T *aAttachmentType);105 STDMETHOD(COMSETTER(AttachmentType))(NetworkAttachmentType_T aAttachmentType);106 STDMETHOD(COMGETTER(BridgedInterface))(BSTR *aBridgedInterface);107 STDMETHOD(COMSETTER(BridgedInterface))(IN_BSTR aBridgedInterface);108 STDMETHOD(COMGETTER(HostOnlyInterface))(BSTR *aHostOnlyInterface);109 STDMETHOD(COMSETTER(HostOnlyInterface))(IN_BSTR aHostOnlyInterface);110 STDMETHOD(COMGETTER(InternalNetwork))(BSTR *aInternalNetwork);111 STDMETHOD(COMSETTER(InternalNetwork))(IN_BSTR aInternalNetwork);112 STDMETHOD(COMGETTER(NATNetwork))(BSTR *aNATNetwork);113 STDMETHOD(COMSETTER(NATNetwork))(IN_BSTR aNATNetwork);114 STDMETHOD(COMGETTER(GenericDriver))(BSTR *aGenericDriver);115 STDMETHOD(COMSETTER(GenericDriver))(IN_BSTR aGenericDriver);116 STDMETHOD(COMGETTER(CableConnected))(BOOL *aConnected);117 STDMETHOD(COMSETTER(CableConnected))(BOOL aConnected);118 STDMETHOD(COMGETTER(TraceEnabled))(BOOL *aEnabled);119 STDMETHOD(COMSETTER(TraceEnabled))(BOOL aEnabled);120 STDMETHOD(COMGETTER(LineSpeed))(ULONG *aSpeed);121 STDMETHOD(COMSETTER(LineSpeed))(ULONG aSpeed);122 STDMETHOD(COMGETTER(PromiscModePolicy))(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy);123 STDMETHOD(COMSETTER(PromiscModePolicy))(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy);124 STDMETHOD(COMGETTER(TraceFile))(BSTR *aTraceFile);125 STDMETHOD(COMSETTER(TraceFile))(IN_BSTR aTraceFile);126 STDMETHOD(COMGETTER(NATEngine))(INATEngine **aNATEngine);127 STDMETHOD(COMGETTER(BootPriority))(ULONG *aBootPriority);128 STDMETHOD(COMSETTER(BootPriority))(ULONG aBootPriority);129 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup);130 STDMETHOD(COMSETTER(BandwidthGroup))(IBandwidthGroup *aBwGroup);131 132 // INetworkAdapter methods133 STDMETHOD(GetProperty)(IN_BSTR aName, BSTR *aValue);134 STDMETHOD(SetProperty)(IN_BSTR aName, IN_BSTR aValue);135 STDMETHOD(GetProperties)(IN_BSTR aNames,136 ComSafeArrayOut(BSTR, aReturnNames),137 ComSafeArrayOut(BSTR, aReturnValues));138 139 // public methods only for internal purposes140 141 HRESULT loadSettings(BandwidthControl *bwctl, const settings::NetworkAdapter &data);142 HRESULT saveSettings(settings::NetworkAdapter &data);143 144 bool isModified();145 void rollback();146 void commit();147 void copyFrom(NetworkAdapter *aThat);148 void applyDefaults(GuestOSType *aOsType);149 150 ComObjPtr<NetworkAdapter> getPeer();151 152 private:153 154 void generateMACAddress();155 HRESULT updateMacAddress(Utf8Str aMacAddress);156 void updateBandwidthGroup(BandwidthGroup *aBwGroup);157 HRESULT checkAndSwitchFromNatNetworking(IN_BSTR aNatNetworkName);158 HRESULT switchToNatNetworking(IN_BSTR aNatNetworkName);159 152 160 153 Machine * const mParent; -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r47991 r49951 21 21 #define ____H_SYSTEMPROPERTIESIMPL 22 22 23 #include "VirtualBoxBase.h"24 23 #include "MediumFormatImpl.h" 24 #include "SystemPropertiesWrap.h" 25 25 26 #include <VBox/com/array.h>27 28 #include <list>29 26 30 27 namespace settings … … 34 31 35 32 class ATL_NO_VTABLE SystemProperties : 36 public VirtualBoxBase, 37 VBOX_SCRIPTABLE_IMPL(ISystemProperties) 33 public SystemPropertiesWrap 38 34 { 39 35 public: 40 41 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(SystemProperties, ISystemProperties) 42 43 DECLARE_NOT_AGGREGATABLE(SystemProperties) 44 45 DECLARE_PROTECT_FINAL_CONSTRUCT() 46 47 BEGIN_COM_MAP(SystemProperties) 48 VBOX_DEFAULT_INTERFACE_ENTRIES(ISystemProperties) 49 END_COM_MAP() 36 typedef std::list<ComObjPtr<MediumFormat> > MediumFormatList; 50 37 51 38 DECLARE_EMPTY_CTOR_DTOR(SystemProperties) … … 58 45 void uninit(); 59 46 60 // ISystemProperties properties61 STDMETHOD(COMGETTER(MinGuestRAM))(ULONG *minRAM);62 STDMETHOD(COMGETTER(MaxGuestRAM))(ULONG *maxRAM);63 STDMETHOD(COMGETTER(MinGuestVRAM))(ULONG *minVRAM);64 STDMETHOD(COMGETTER(MaxGuestVRAM))(ULONG *maxVRAM);65 STDMETHOD(COMGETTER(MinGuestCPUCount))(ULONG *minCPUCount);66 STDMETHOD(COMGETTER(MaxGuestCPUCount))(ULONG *maxCPUCount);67 STDMETHOD(COMGETTER(MaxGuestMonitors))(ULONG *maxMonitors);68 STDMETHOD(COMGETTER(InfoVDSize))(LONG64 *infoVDSize);69 STDMETHOD(COMGETTER(SerialPortCount))(ULONG *count);70 STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count);71 STDMETHOD(COMGETTER(MaxBootPosition))(ULONG *aMaxBootPosition);72 STDMETHOD(COMGETTER(ExclusiveHwVirt))(BOOL *aExclusiveHwVirt);73 STDMETHOD(COMSETTER(ExclusiveHwVirt))(BOOL aExclusiveHwVirt);74 STDMETHOD(COMGETTER(LoggingLevel))(BSTR *aLoggingLevel);75 STDMETHOD(COMSETTER(LoggingLevel))(IN_BSTR aLoggingLevel);76 STDMETHOD(COMGETTER(DefaultMachineFolder))(BSTR *aDefaultMachineFolder);77 STDMETHOD(COMSETTER(DefaultMachineFolder))(IN_BSTR aDefaultMachineFolder);78 STDMETHOD(COMGETTER(MediumFormats))(ComSafeArrayOut(IMediumFormat *, aMediumFormats));79 STDMETHOD(COMGETTER(DefaultHardDiskFormat))(BSTR *aDefaultHardDiskFormat);80 STDMETHOD(COMSETTER(DefaultHardDiskFormat))(IN_BSTR aDefaultHardDiskFormat);81 STDMETHOD(COMGETTER(FreeDiskSpaceWarning))(LONG64 *aFreeDiskSpace);82 STDMETHOD(COMSETTER(FreeDiskSpaceWarning))(LONG64 aFreeDiskSpace);83 STDMETHOD(COMGETTER(FreeDiskSpacePercentWarning))(ULONG *aFreeDiskSpacePercent);84 STDMETHOD(COMSETTER(FreeDiskSpacePercentWarning))(ULONG aFreeDiskSpacePercent);85 STDMETHOD(COMGETTER(FreeDiskSpaceError))(LONG64 *aFreeDiskSpace);86 STDMETHOD(COMSETTER(FreeDiskSpaceError))(LONG64 aFreeDiskSpace);87 STDMETHOD(COMGETTER(FreeDiskSpacePercentError))(ULONG *aFreeDiskSpacePercent);88 STDMETHOD(COMSETTER(FreeDiskSpacePercentError))(ULONG aFreeDiskSpacePercent);89 STDMETHOD(COMGETTER(VRDEAuthLibrary))(BSTR *aVRDEAuthLibrary);90 STDMETHOD(COMSETTER(VRDEAuthLibrary))(IN_BSTR aVRDEAuthLibrary);91 STDMETHOD(COMGETTER(WebServiceAuthLibrary))(BSTR *aWebServiceAuthLibrary);92 STDMETHOD(COMSETTER(WebServiceAuthLibrary))(IN_BSTR aWebServiceAuthLibrary);93 STDMETHOD(COMGETTER(DefaultVRDEExtPack))(BSTR *aExtPack);94 STDMETHOD(COMSETTER(DefaultVRDEExtPack))(IN_BSTR aExtPack);95 STDMETHOD(COMGETTER(LogHistoryCount))(ULONG *count);96 STDMETHOD(COMSETTER(LogHistoryCount))(ULONG count);97 STDMETHOD(COMGETTER(DefaultAudioDriver))(AudioDriverType_T *aAudioDriver);98 STDMETHOD(COMGETTER(AutostartDatabasePath))(BSTR *aAutostartDbPath);99 STDMETHOD(COMSETTER(AutostartDatabasePath))(IN_BSTR aAutostartDbPath);100 STDMETHOD(COMGETTER(DefaultAdditionsISO))(BSTR *aDefaultAdditionsISO);101 STDMETHOD(COMSETTER(DefaultAdditionsISO))(IN_BSTR aDefaultAdditionsISO);102 STDMETHOD(COMGETTER(DefaultFrontend))(BSTR *aDefaultFrontend);103 STDMETHOD(COMSETTER(DefaultFrontend))(IN_BSTR aDefaultFrontend);104 105 STDMETHOD(GetMaxNetworkAdapters)(ChipsetType_T aChipset, ULONG *aMaxInstances);106 STDMETHOD(GetMaxNetworkAdaptersOfType)(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *aMaxInstances);107 STDMETHOD(GetMaxDevicesPerPortForStorageBus)(StorageBus_T aBus, ULONG *aMaxDevicesPerPort);108 STDMETHOD(GetMinPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMinPortCount);109 STDMETHOD(GetMaxPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMaxPortCount);110 STDMETHOD(GetMaxInstancesOfStorageBus)(ChipsetType_T aChipset, StorageBus_T aBus, ULONG *aMaxInstances);111 STDMETHOD(GetDeviceTypesForStorageBus)(StorageBus_T aBus, ComSafeArrayOut(DeviceType_T, aDeviceTypes));112 STDMETHOD(GetDefaultIoCacheSettingForStorageController)(StorageControllerType_T aControllerType, BOOL *aEnabled);113 STDMETHOD(GetMaxInstancesOfUSBControllerType)(ChipsetType_T aChipset, USBControllerType_T aType, ULONG *aMaxInstances);114 115 // public methods only for internal purposes116 117 HRESULT loadSettings(const settings::SystemProperties &data);118 HRESULT saveSettings(settings::SystemProperties &data);119 120 ComObjPtr<MediumFormat> mediumFormat(const Utf8Str &aFormat);121 ComObjPtr<MediumFormat> mediumFormatFromExtension(const Utf8Str &aExt);122 123 47 // public methods for internal purposes only 124 48 // (ensure there is a caller and a read lock before calling them!) 49 HRESULT i_loadSettings(const settings::SystemProperties &data); 50 HRESULT i_saveSettings(settings::SystemProperties &data); 51 52 ComObjPtr<MediumFormat> i_mediumFormat(const Utf8Str &aFormat); 53 ComObjPtr<MediumFormat> i_mediumFormatFromExtension(const Utf8Str &aExt); 125 54 126 55 private: 127 56 128 typedef std::list<ComObjPtr<MediumFormat> > MediumFormatList; 57 // wrapped ISystemProperties properties 58 HRESULT getMinGuestRAM(ULONG *aMinGuestRAM); 59 HRESULT getMaxGuestRAM(ULONG *aMaxGuestRAM); 60 HRESULT getMinGuestVRAM(ULONG *aMinGuestVRAM); 61 HRESULT getMaxGuestVRAM(ULONG *aMaxGuestVRAM); 62 HRESULT getMinGuestCPUCount(ULONG *aMinGuestCPUCount); 63 HRESULT getMaxGuestCPUCount(ULONG *aMaxGuestCPUCount); 64 HRESULT getMaxGuestMonitors(ULONG *aMaxGuestMonitors); 65 HRESULT getInfoVDSize(LONG64 *aInfoVDSize); 66 HRESULT getSerialPortCount(ULONG *aSerialPortCount); 67 HRESULT getParallelPortCount(ULONG *aParallelPortCount); 68 HRESULT getMaxBootPosition(ULONG *aMaxBootPosition); 69 HRESULT getExclusiveHwVirt(BOOL *aExclusiveHwVirt); 70 HRESULT setExclusiveHwVirt(BOOL aExclusiveHwVirt); 71 HRESULT getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder); 72 HRESULT setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder); 73 HRESULT getLoggingLevel(com::Utf8Str &aLoggingLevel); 74 HRESULT setLoggingLevel(const com::Utf8Str &aLoggingLevel); 75 HRESULT getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats); 76 HRESULT getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat); 77 HRESULT setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat); 78 HRESULT getFreeDiskSpaceWarning(LONG64 *aFreeDiskSpaceWarning); 79 HRESULT setFreeDiskSpaceWarning(LONG64 aFreeDiskSpaceWarning); 80 HRESULT getFreeDiskSpacePercentWarning(ULONG *aFreeDiskSpacePercentWarning); 81 HRESULT setFreeDiskSpacePercentWarning(ULONG aFreeDiskSpacePercentWarning); 82 HRESULT getFreeDiskSpaceError(LONG64 *aFreeDiskSpaceError); 83 HRESULT setFreeDiskSpaceError(LONG64 aFreeDiskSpaceError); 84 HRESULT getFreeDiskSpacePercentError(ULONG *aFreeDiskSpacePercentError); 85 HRESULT setFreeDiskSpacePercentError(ULONG aFreeDiskSpacePercentError); 86 HRESULT getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary); 87 HRESULT setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary); 88 HRESULT getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary); 89 HRESULT setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary); 90 HRESULT getDefaultVRDEExtPack(com::Utf8Str &aDefaultVRDEExtPack); 91 HRESULT setDefaultVRDEExtPack(const com::Utf8Str &aDefaultVRDEExtPack); 92 HRESULT getLogHistoryCount(ULONG *aLogHistoryCount); 93 HRESULT setLogHistoryCount(ULONG aLogHistoryCount); 94 HRESULT getDefaultAudioDriver(AudioDriverType_T *aDefaultAudioDriver); 95 HRESULT getAutostartDatabasePath(com::Utf8Str &aAutostartDatabasePath); 96 HRESULT setAutostartDatabasePath(const com::Utf8Str &aAutostartDatabasePath); 97 HRESULT getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO); 98 HRESULT setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO); 99 HRESULT getDefaultFrontend(com::Utf8Str &aDefaultFrontend); 100 HRESULT setDefaultFrontend(const com::Utf8Str &aDefaultFrontend); 129 101 130 HRESULT getUserHomeDirectory(Utf8Str &strPath); 131 HRESULT setDefaultMachineFolder(const Utf8Str &aPath); 132 HRESULT setLoggingLevel(const Utf8Str &aLoggingLevel); 133 HRESULT setDefaultHardDiskFormat(const Utf8Str &aFormat); 102 // wrapped ISystemProperties methods 103 HRESULT getMaxNetworkAdapters(ChipsetType_T aChipset, 104 ULONG *aMaxNetworkAdapters); 105 HRESULT getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, 106 NetworkAttachmentType_T aType, 107 ULONG *aMaxNetworkAdapters); 108 HRESULT getMaxDevicesPerPortForStorageBus(StorageBus_T aBus, 109 ULONG *aMaxDevicesPerPort); 110 HRESULT getMinPortCountForStorageBus(StorageBus_T aBus, 111 ULONG *aMinPortCount); 112 HRESULT getMaxPortCountForStorageBus(StorageBus_T aBus, 113 ULONG *aMaxPortCount); 114 HRESULT getMaxInstancesOfStorageBus(ChipsetType_T aChipset, 115 StorageBus_T aBus, 116 ULONG *aMaxInstances); 117 HRESULT getDeviceTypesForStorageBus(StorageBus_T aBus, 118 std::vector<DeviceType_T> &aDeviceTypes); 119 HRESULT getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType, 120 BOOL *aEnabled); 121 HRESULT getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset, 122 USBControllerType_T aType, 123 ULONG *aMaxInstances); 134 124 135 HRESULT setVRDEAuthLibrary(const Utf8Str &aPath); 136 HRESULT setWebServiceAuthLibrary(const Utf8Str &aPath); 137 HRESULT setDefaultVRDEExtPack(const Utf8Str &aPath); 138 HRESULT setAutostartDatabasePath(const Utf8Str &aPath); 139 HRESULT setDefaultAdditionsISO(const Utf8Str &aPath); 140 HRESULT setDefaultFrontend(const Utf8Str &aPath); 125 HRESULT i_getUserHomeDirectory(Utf8Str &strPath); 126 HRESULT i_setDefaultMachineFolder(const Utf8Str &strPath); 127 HRESULT i_setLoggingLevel(const com::Utf8Str &aLoggingLevel); 128 HRESULT i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat); 129 HRESULT i_setVRDEAuthLibrary(const com::Utf8Str &aPath); 130 131 HRESULT i_setWebServiceAuthLibrary(const com::Utf8Str &aPath); 132 HRESULT i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack); 133 HRESULT i_setAutostartDatabasePath(const com::Utf8Str &aPath); 134 HRESULT i_setDefaultAdditionsISO(const com::Utf8Str &aPath); 135 HRESULT i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend); 141 136 142 137 VirtualBox * const mParent; … … 144 139 settings::SystemProperties *m; 145 140 146 MediumFormatList 141 MediumFormatList m_llMediumFormats; 147 142 148 143 friend class VirtualBox; -
trunk/src/VBox/Main/include/USBDeviceFilterImpl.h
r47376 r49951 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_USBDEVICEFILTERIMPL 20 20 21 #include "VirtualBoxBase.h"22 23 21 #include "Matching.h" 24 22 #include <VBox/usbfilter.h> 23 #include "USBDeviceFilterWrap.h" 25 24 26 25 class USBDeviceFilters; … … 35 34 36 35 class ATL_NO_VTABLE USBDeviceFilter : 37 public VirtualBoxBase, 38 VBOX_SCRIPTABLE_IMPL(IUSBDeviceFilter) 36 public USBDeviceFilterWrap 39 37 { 40 38 public: … … 67 65 }; 68 66 69 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBDeviceFilter, IUSBDeviceFilter) 70 71 DECLARE_NOT_AGGREGATABLE(USBDeviceFilter) 72 73 DECLARE_PROTECT_FINAL_CONSTRUCT() 74 75 BEGIN_COM_MAP(USBDeviceFilter) 76 VBOX_DEFAULT_INTERFACE_ENTRIES (IUSBDeviceFilter) 77 END_COM_MAP() 78 79 DECLARE_EMPTY_CTOR_DTOR (USBDeviceFilter) 67 DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilter) 80 68 81 69 HRESULT FinalConstruct(); … … 91 79 void uninit(); 92 80 93 // IUSBDeviceFilter properties94 STDMETHOD(COMGETTER(Name)) (BSTR *aName);95 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);96 STDMETHOD(COMGETTER(Active)) (BOOL *aActive);97 STDMETHOD(COMSETTER(Active)) (BOOL aActive);98 STDMETHOD(COMGETTER(VendorId)) (BSTR *aVendorId);99 STDMETHOD(COMSETTER(VendorId)) (IN_BSTR aVendorId);100 STDMETHOD(COMGETTER(ProductId)) (BSTR *aProductId);101 STDMETHOD(COMSETTER(ProductId)) (IN_BSTR aProductId);102 STDMETHOD(COMGETTER(Revision)) (BSTR *aRevision);103 STDMETHOD(COMSETTER(Revision)) (IN_BSTR aRevision);104 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);105 STDMETHOD(COMSETTER(Manufacturer)) (IN_BSTR aManufacturer);106 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);107 STDMETHOD(COMSETTER(Product)) (IN_BSTR aProduct);108 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);109 STDMETHOD(COMSETTER(SerialNumber)) (IN_BSTR aSerialNumber);110 STDMETHOD(COMGETTER(Port)) (BSTR *aPort);111 STDMETHOD(COMSETTER(Port)) (IN_BSTR aPort);112 STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);113 STDMETHOD(COMSETTER(Remote)) (IN_BSTR aRemote);114 STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);115 STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);116 117 81 // public methods only for internal purposes 118 bool i sModified();119 void rollback();120 void commit();82 bool i_isModified(); 83 void i_rollback(); 84 void i_commit(); 121 85 122 86 void unshare(); … … 124 88 // public methods for internal purposes only 125 89 // (ensure there is a caller and a read lock before calling them!) 126 127 void *& getId() { return mData.data()->mId; } 128 129 const Data& getData() { return *mData.data(); } 130 ComObjPtr<USBDeviceFilter> peer() { return mPeer; } 90 void *& i_getId() { return mData.data()->mId; } 91 const Data& i_getData() { return *mData.data(); } 92 ComObjPtr<USBDeviceFilter> i_peer() { return mPeer; } 131 93 132 94 // tr() wants to belong to a class it seems, thus this one here. 133 static HRESULT usbFilterFieldFromString(PUSBFILTER aFilter,134 USBFILTERIDX aIdx,135 const Utf8Str &aValue,136 Utf8Str &aErrStr);137 138 static const char* describeUSBFilterIdx(USBFILTERIDX aIdx);95 static HRESULT i_usbFilterFieldFromString(PUSBFILTER aFilter, 96 USBFILTERIDX aIdx, 97 const Utf8Str &aValue, 98 Utf8Str &aErrStr); 99 100 static const char* i_describeUSBFilterIdx(USBFILTERIDX aIdx); 139 101 140 102 private: 141 HRESULT usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr); 142 HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, IN_BSTR aStr); 143 HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, const Utf8Str &strNew); 103 104 // wrapped IUSBDeviceFilter properties 105 HRESULT getName(com::Utf8Str &aName); 106 HRESULT setName(const com::Utf8Str &aName); 107 HRESULT getActive(BOOL *aActive); 108 HRESULT setActive(BOOL aActive); 109 HRESULT getVendorId(com::Utf8Str &aVendorId); 110 HRESULT setVendorId(const com::Utf8Str &aVendorId); 111 HRESULT getProductId(com::Utf8Str &aProductId); 112 HRESULT setProductId(const com::Utf8Str &aProductId); 113 HRESULT getRevision(com::Utf8Str &aRevision); 114 HRESULT setRevision(const com::Utf8Str &aRevision); 115 HRESULT getManufacturer(com::Utf8Str &aManufacturer); 116 HRESULT setManufacturer(const com::Utf8Str &aManufacturer); 117 HRESULT getProduct(com::Utf8Str &aProduct); 118 HRESULT setProduct(const com::Utf8Str &aProduct); 119 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber); 120 HRESULT setSerialNumber(const com::Utf8Str &aSerialNumber); 121 HRESULT getPort(com::Utf8Str &aPort); 122 HRESULT setPort(const com::Utf8Str &aPort); 123 HRESULT getRemote(com::Utf8Str &aRemote); 124 HRESULT setRemote(const com::Utf8Str &aRemote); 125 HRESULT getMaskedInterfaces(ULONG *aMaskedInterfaces); 126 HRESULT setMaskedInterfaces(ULONG aMaskedInterfaces); 127 128 // wrapped IUSBDeviceFilter methods 129 HRESULT i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr); 130 HRESULT i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &strNew); 144 131 145 132 USBDeviceFilters * const mParent; … … 156 143 friend class USBDeviceFilters; 157 144 }; 145 #include "HostUSBDeviceFilterWrap.h" 158 146 159 147 // HostUSBDeviceFilter … … 161 149 162 150 class ATL_NO_VTABLE HostUSBDeviceFilter : 163 public VirtualBoxBase, 164 VBOX_SCRIPTABLE_IMPL(IHostUSBDeviceFilter) 151 public HostUSBDeviceFilterWrap 165 152 { 166 153 public: … … 170 157 Data() {} 171 158 }; 172 173 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(HostUSBDeviceFilter, IHostUSBDeviceFilter)174 175 DECLARE_NOT_AGGREGATABLE(HostUSBDeviceFilter)176 177 DECLARE_PROTECT_FINAL_CONSTRUCT()178 179 BEGIN_COM_MAP(HostUSBDeviceFilter)180 COM_INTERFACE_ENTRY(IUSBDeviceFilter)181 VBOX_DEFAULT_INTERFACE_ENTRIES(IHostUSBDeviceFilter)182 END_COM_MAP()183 159 184 160 DECLARE_EMPTY_CTOR_DTOR (HostUSBDeviceFilter) … … 193 169 void uninit(); 194 170 195 // IUSBDeviceFilter properties196 STDMETHOD(COMGETTER(Name)) (BSTR *aName);197 STDMETHOD(COMSETTER(Name)) (IN_BSTR aName);198 STDMETHOD(COMGETTER(Active)) (BOOL *aActive);199 STDMETHOD(COMSETTER(Active)) (BOOL aActive);200 STDMETHOD(COMGETTER(VendorId)) (BSTR *aVendorId);201 STDMETHOD(COMSETTER(VendorId)) (IN_BSTR aVendorId);202 STDMETHOD(COMGETTER(ProductId)) (BSTR *aProductId);203 STDMETHOD(COMSETTER(ProductId)) (IN_BSTR aProductId);204 STDMETHOD(COMGETTER(Revision)) (BSTR *aRevision);205 STDMETHOD(COMSETTER(Revision)) (IN_BSTR aRevision);206 STDMETHOD(COMGETTER(Manufacturer)) (BSTR *aManufacturer);207 STDMETHOD(COMSETTER(Manufacturer)) (IN_BSTR aManufacturer);208 STDMETHOD(COMGETTER(Product)) (BSTR *aProduct);209 STDMETHOD(COMSETTER(Product)) (IN_BSTR aProduct);210 STDMETHOD(COMGETTER(SerialNumber)) (BSTR *aSerialNumber);211 STDMETHOD(COMSETTER(SerialNumber)) (IN_BSTR aSerialNumber);212 STDMETHOD(COMGETTER(Port)) (BSTR *aPort);213 STDMETHOD(COMSETTER(Port)) (IN_BSTR aPort);214 STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);215 STDMETHOD(COMSETTER(Remote)) (IN_BSTR aRemote);216 STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);217 STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);218 219 // IHostUSBDeviceFilter properties220 STDMETHOD(COMGETTER(Action)) (USBDeviceFilterAction_T *aAction);221 STDMETHOD(COMSETTER(Action)) (USBDeviceFilterAction_T aAction);222 223 171 // public methods for internal purposes only 224 172 // (ensure there is a caller and a read lock before calling them!) 225 void saveSettings(settings::USBDeviceFilter &data);226 227 void*& getId() { return mData.data()->mId; }228 229 const Data& getData() { return *mData.data(); }173 void i_saveSettings(settings::USBDeviceFilter &data); 174 175 void*& i_getId() { return mData.data()->mId; } 176 177 const Data& i_getData() { return *mData.data(); } 230 178 231 179 // util::Lockable interface 232 RWLockHandle * lockHandle() const;180 RWLockHandle *i_lockHandle() const; 233 181 234 182 private: 235 HRESULT usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr); 236 HRESULT usbFilterFieldSetter(USBFILTERIDX aIdx, Bstr aStr); 183 184 // wrapped IHostUSBDeviceFilter properties 185 HRESULT getName(com::Utf8Str &aName); 186 HRESULT setName(const com::Utf8Str &aName); 187 HRESULT getActive(BOOL *aActive); 188 HRESULT setActive(BOOL aActive); 189 HRESULT getVendorId(com::Utf8Str &aVendorId); 190 HRESULT setVendorId(const com::Utf8Str &aVendorId); 191 HRESULT getProductId(com::Utf8Str &aProductId); 192 HRESULT setProductId(const com::Utf8Str &aProductId); 193 HRESULT getRevision(com::Utf8Str &aRevision); 194 HRESULT setRevision(const com::Utf8Str &aRevision); 195 HRESULT getManufacturer(com::Utf8Str &aManufacturer); 196 HRESULT setManufacturer(const com::Utf8Str &aManufacturer); 197 HRESULT getProduct(com::Utf8Str &aProduct); 198 HRESULT setProduct(const com::Utf8Str &aProduct); 199 HRESULT getSerialNumber(com::Utf8Str &aSerialNumber); 200 HRESULT setSerialNumber(const com::Utf8Str &aSerialNumber); 201 HRESULT getPort(com::Utf8Str &aPort); 202 HRESULT setPort(const com::Utf8Str &aPort); 203 HRESULT getRemote(com::Utf8Str &aRemote); 204 HRESULT setRemote(const com::Utf8Str &aRemote); 205 HRESULT getMaskedInterfaces(ULONG *aMaskedInterfaces); 206 HRESULT setMaskedInterfaces(ULONG aMaskedInterfaces); 207 208 // wrapped IHostUSBDeviceFilter properties 209 HRESULT getAction(USBDeviceFilterAction_T *aAction); 210 HRESULT setAction(USBDeviceFilterAction_T aAction); 211 212 HRESULT i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr); 213 HRESULT i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &aStr); 237 214 238 215 Host * const mParent; -
trunk/src/VBox/Main/include/USBDeviceFiltersImpl.h
r47401 r49951 21 21 #define ____H_USBDEVICEFILTERSIMPL 22 22 23 #include " VirtualBoxBase.h"23 #include "USBDeviceFiltersWrap.h" 24 24 25 25 class HostUSBDevice; … … 32 32 33 33 class ATL_NO_VTABLE USBDeviceFilters : 34 public VirtualBoxBase, 35 VBOX_SCRIPTABLE_IMPL(IUSBDeviceFilters) 34 public USBDeviceFiltersWrap 36 35 { 37 36 public: 38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(USBDeviceFilters, IUSBDeviceFilters)39 40 DECLARE_NOT_AGGREGATABLE(USBDeviceFilters)41 42 DECLARE_PROTECT_FINAL_CONSTRUCT()43 44 BEGIN_COM_MAP(USBDeviceFilters)45 VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBDeviceFilters)46 END_COM_MAP()47 37 48 38 DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilters) … … 57 47 void uninit(); 58 48 59 // IUSBDeviceFilters attributes 60 STDMETHOD(COMGETTER(DeviceFilters))(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters)); 49 // public methods only for internal purposes 50 HRESULT i_loadSettings(const settings::USB &data); 51 HRESULT i_saveSettings(settings::USB &data); 61 52 62 // IUSBDeviceFilters methods 63 STDMETHOD(CreateDeviceFilter)(IN_BSTR aName, IUSBDeviceFilter **aFilter); 64 STDMETHOD(InsertDeviceFilter)(ULONG aPosition, IUSBDeviceFilter *aFilter); 65 STDMETHOD(RemoveDeviceFilter)(ULONG aPosition, IUSBDeviceFilter **aFilter); 66 67 // public methods only for internal purposes 68 69 HRESULT loadSettings(const settings::USB &data); 70 HRESULT saveSettings(settings::USB &data); 71 72 void rollback(); 73 void commit(); 74 void copyFrom(USBDeviceFilters *aThat); 53 void i_rollback(); 54 void i_commit(); 55 void i_copyFrom(USBDeviceFilters *aThat); 75 56 76 57 #ifdef VBOX_WITH_USB 77 HRESULT onDeviceFilterChange(USBDeviceFilter *aFilter, 78 BOOL aActiveChanged = FALSE); 79 80 bool hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 81 bool hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs); 82 83 HRESULT notifyProxy(bool aInsertFilters); 58 HRESULT i_onDeviceFilterChange(USBDeviceFilter *aFilter, 59 BOOL aActiveChanged = FALSE); 60 bool i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); 61 bool i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs); 62 HRESULT i_notifyProxy(bool aInsertFilters); 84 63 #endif /* VBOX_WITH_USB */ 85 64 86 65 // public methods for internal purposes only 87 66 // (ensure there is a caller and a read lock before calling them!) 88 Machine* getMachine();67 Machine* i_getMachine(); 89 68 90 69 private: 91 70 92 void printList(); 71 // Wrapped IUSBDeviceFilters attributes 72 HRESULT getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters); 93 73 74 // wrapped IUSBDeviceFilters methods 75 HRESULT createDeviceFilter(const com::Utf8Str &aName, 76 ComPtr<IUSBDeviceFilter> &aFilter); 77 HRESULT insertDeviceFilter(ULONG aPosition, 78 const ComPtr<IUSBDeviceFilter> &aFilter); 79 HRESULT removeDeviceFilter(ULONG aPosition, 80 ComPtr<IUSBDeviceFilter> &aFilter); 94 81 struct Data; 95 82 Data *m; -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r49760 r49951 616 616 SystemProperties *pSysProps = mVirtualBox->getSystemProperties(); 617 617 { 618 ComObjPtr<MediumFormat> trgFormat = pSysProps-> mediumFormatFromExtension("iso");618 ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("iso"); 619 619 if (trgFormat.isNull()) 620 620 return setError(E_FAIL, tr("Can't find appropriate medium format for ISO type of a virtual disk.")); … … 630 630 631 631 { 632 ComObjPtr<MediumFormat> trgFormat = pSysProps-> mediumFormatFromExtension("vmdk");632 ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("vmdk"); 633 633 if (trgFormat.isNull()) 634 634 return setError(E_FAIL, tr("Can't find appropriate medium format for VMDK type of a virtual disk.")); … … 647 647 648 648 { 649 ComObjPtr<MediumFormat> trgFormat = pSysProps-> mediumFormatFromExtension("vhd");649 ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension("vhd"); 650 650 if (trgFormat.isNull()) 651 651 return setError(E_FAIL, tr("Can't find appropriate medium format for VHD type of a virtual disk.")); … … 747 747 if (pszExt) 748 748 pszExt++; 749 mf = pSysProps-> mediumFormatFromExtension(pszExt);749 mf = pSysProps->i_mediumFormatFromExtension(pszExt); 750 750 } 751 751 } 752 752 else 753 mf = pSysProps-> mediumFormat(strSrcFormat);753 mf = pSysProps->i_mediumFormat(strSrcFormat); 754 754 755 755 if (mf.isNull()) -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r49795 r49951 2059 2059 AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS); 2060 2060 // We are always exporting to VMDK stream optimized for now 2061 formatTemp = pSysProps-> mediumFormatFromExtension("iso");2062 2063 format = pSysProps-> mediumFormat("VMDK");2061 formatTemp = pSysProps->i_mediumFormatFromExtension("iso"); 2062 2063 format = pSysProps->i_mediumFormat("VMDK"); 2064 2064 if (format.isNull()) 2065 2065 throw setError(VBOX_E_NOT_SUPPORTED, -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r49795 r49951 2358 2358 const char *pszSuff = RTPathSuffix(strTargetPath->c_str()); 2359 2359 /* Figure out which format the user like to have. Default is VMDK. */ 2360 ComObjPtr<MediumFormat> trgFormat = pSysProps-> mediumFormatFromExtension(&pszSuff[1]);2360 ComObjPtr<MediumFormat> trgFormat = pSysProps->i_mediumFormatFromExtension(&pszSuff[1]); 2361 2361 if (trgFormat.isNull()) 2362 2362 throw setError(VBOX_E_NOT_SUPPORTED, -
trunk/src/VBox/Main/src-server/HostImpl.cpp
r49872 r49951 1409 1409 /* notify the proxy (only when the filter is active) */ 1410 1410 if ( m->pUSBProxyService->isActive() 1411 && pFilter-> getData().mActive)1412 { 1413 ComAssertRet(pFilter-> getId() == NULL, E_FAIL);1414 pFilter-> getId() = m->pUSBProxyService->insertFilter(&pFilter->getData().mUSBFilter);1411 && pFilter->i_getData().mActive) 1412 { 1413 ComAssertRet(pFilter->i_getId() == NULL, E_FAIL); 1414 pFilter->i_getId() = m->pUSBProxyService->insertFilter(&pFilter->i_getData().mUSBFilter); 1415 1415 } 1416 1416 … … 1463 1463 1464 1464 /* notify the proxy (only when the filter is active) */ 1465 if (m->pUSBProxyService->isActive() && filter-> getData().mActive)1466 { 1467 ComAssertRet(filter-> getId() != NULL, E_FAIL);1468 m->pUSBProxyService->removeFilter(filter-> getId());1469 filter-> getId() = NULL;1465 if (m->pUSBProxyService->isActive() && filter->i_getData().mActive) 1466 { 1467 ComAssertRet(filter->i_getId() != NULL, E_FAIL); 1468 m->pUSBProxyService->removeFilter(filter->i_getId()); 1469 filter->i_getId() = NULL; 1470 1470 } 1471 1471 … … 1742 1742 1743 1743 /* notify the proxy (only when the filter is active) */ 1744 if (pFilter-> getData().mActive)1744 if (pFilter->i_getData().mActive) 1745 1745 { 1746 1746 HostUSBDeviceFilter *flt = pFilter; /* resolve ambiguity */ 1747 flt-> getId() = m->pUSBProxyService->insertFilter(&pFilter->getData().mUSBFilter);1747 flt->i_getId() = m->pUSBProxyService->insertFilter(&pFilter->i_getData().mUSBFilter); 1748 1748 } 1749 1749 } … … 1771 1771 ComObjPtr<HostUSBDeviceFilter> pFilter = *it; 1772 1772 settings::USBDeviceFilter f; 1773 pFilter-> saveSettings(f);1773 pFilter->i_saveSettings(f); 1774 1774 data.llUSBDeviceFilters.push_back(f); 1775 1775 } … … 2220 2220 { 2221 2221 // insert/remove the filter from the proxy 2222 if (aFilter-> getData().mActive)2222 if (aFilter->i_getData().mActive) 2223 2223 { 2224 ComAssertRet(aFilter-> getId() == NULL, E_FAIL);2225 aFilter-> getId() = m->pUSBProxyService->insertFilter(&aFilter->getData().mUSBFilter);2224 ComAssertRet(aFilter->i_getId() == NULL, E_FAIL); 2225 aFilter->i_getId() = m->pUSBProxyService->insertFilter(&aFilter->i_getData().mUSBFilter); 2226 2226 } 2227 2227 else 2228 2228 { 2229 ComAssertRet(aFilter-> getId() != NULL, E_FAIL);2230 m->pUSBProxyService->removeFilter(aFilter-> getId());2231 aFilter-> getId() = NULL;2229 ComAssertRet(aFilter->i_getId() != NULL, E_FAIL); 2230 m->pUSBProxyService->removeFilter(aFilter->i_getId()); 2231 aFilter->i_getId() = NULL; 2232 2232 } 2233 2233 } 2234 2234 else 2235 2235 { 2236 if (aFilter-> getData().mActive)2236 if (aFilter->i_getData().mActive) 2237 2237 { 2238 2238 // update the filter in the proxy 2239 ComAssertRet(aFilter-> getId() != NULL, E_FAIL);2240 m->pUSBProxyService->removeFilter(aFilter-> getId());2241 aFilter-> getId() = m->pUSBProxyService->insertFilter(&aFilter->getData().mUSBFilter);2239 ComAssertRet(aFilter->i_getId() != NULL, E_FAIL); 2240 m->pUSBProxyService->removeFilter(aFilter->i_getId()); 2241 aFilter->i_getId() = m->pUSBProxyService->insertFilter(&aFilter->i_getData().mUSBFilter); 2242 2242 } 2243 2243 } -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r49871 r49951 344 344 /* Apply network adapters defaults */ 345 345 for (ULONG slot = 0; slot < mNetworkAdapters.size(); ++slot) 346 mNetworkAdapters[slot]-> applyDefaults(aOsType);346 mNetworkAdapters[slot]->i_applyDefaults(aOsType); 347 347 348 348 /* Apply serial port defaults */ … … 9376 9376 9377 9377 /* USB device filters */ 9378 rc = mUSBDeviceFilters-> loadSettings(data.usbSettings);9378 rc = mUSBDeviceFilters->i_loadSettings(data.usbSettings); 9379 9379 if (FAILED(rc)) return rc; 9380 9380 … … 9401 9401 /* slot unicity is guaranteed by XML Schema */ 9402 9402 AssertBreak(nic.ulSlot < mNetworkAdapters.size()); 9403 rc = mNetworkAdapters[nic.ulSlot]-> loadSettings(mBandwidthControl, nic);9403 rc = mNetworkAdapters[nic.ulSlot]->i_loadSettings(mBandwidthControl, nic); 9404 9404 if (FAILED(rc)) return rc; 9405 9405 } … … 10678 10678 10679 10679 /* USB device filters (required) */ 10680 rc = mUSBDeviceFilters-> saveSettings(data.usbSettings);10680 rc = mUSBDeviceFilters->i_saveSettings(data.usbSettings); 10681 10681 if (FAILED(rc)) throw rc; 10682 10682 … … 10694 10694 if (mNetworkAdapters[slot]) 10695 10695 { 10696 rc = mNetworkAdapters[slot]-> saveSettings(nic);10696 rc = mNetworkAdapters[slot]->i_saveSettings(nic); 10697 10697 if (FAILED(rc)) throw rc; 10698 10698 … … 12120 12120 12121 12121 if (mUSBDeviceFilters && (mData->flModifications & IsModified_USB)) 12122 mUSBDeviceFilters-> rollback();12122 mUSBDeviceFilters->i_rollback(); 12123 12123 12124 12124 if (mBandwidthControl && (mData->flModifications & IsModified_BandwidthControl)) … … 12134 12134 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++) 12135 12135 if ( mNetworkAdapters[slot] 12136 && mNetworkAdapters[slot]->i sModified())12136 && mNetworkAdapters[slot]->i_isModified()) 12137 12137 { 12138 mNetworkAdapters[slot]-> rollback();12138 mNetworkAdapters[slot]->i_rollback(); 12139 12139 networkAdapters[slot] = mNetworkAdapters[slot]; 12140 12140 } … … 12225 12225 mVRDEServer->i_commit(); 12226 12226 mAudioAdapter->i_commit(); 12227 mUSBDeviceFilters-> commit();12227 mUSBDeviceFilters->i_commit(); 12228 12228 mBandwidthControl->i_commit(); 12229 12229 … … 12238 12238 /* commit everything, even the ones which will go away */ 12239 12239 for (size_t slot = 0; slot < mNetworkAdapters.size(); slot++) 12240 mNetworkAdapters[slot]-> commit();12240 mNetworkAdapters[slot]->i_commit(); 12241 12241 /* copy over the new entries, creating a peer and uninit the original */ 12242 12242 mPeer->mNetworkAdapters.resize(RT_MAX(newSize, mPeer->mNetworkAdapters.size())); … … 12244 12244 { 12245 12245 /* look if this adapter has a peer device */ 12246 ComObjPtr<NetworkAdapter> peer = mNetworkAdapters[slot]-> getPeer();12246 ComObjPtr<NetworkAdapter> peer = mNetworkAdapters[slot]->i_getPeer(); 12247 12247 if (!peer) 12248 12248 { … … 12276 12276 { 12277 12277 for (size_t slot = 0; slot < mNetworkAdapters.size(); slot++) 12278 mNetworkAdapters[slot]-> commit();12278 mNetworkAdapters[slot]->i_commit(); 12279 12279 } 12280 12280 … … 12474 12474 mVRDEServer->i_copyFrom(aThat->mVRDEServer); 12475 12475 mAudioAdapter->i_copyFrom(aThat->mAudioAdapter); 12476 mUSBDeviceFilters-> copyFrom(aThat->mUSBDeviceFilters);12476 mUSBDeviceFilters->i_copyFrom(aThat->mUSBDeviceFilters); 12477 12477 mBandwidthControl->i_copyFrom(aThat->mBandwidthControl); 12478 12478 … … 12505 12505 mNetworkAdapters.resize(aThat->mNetworkAdapters.size()); 12506 12506 for (ULONG slot = 0; slot < mNetworkAdapters.size(); slot++) 12507 mNetworkAdapters[slot]-> copyFrom(aThat->mNetworkAdapters[slot]);12507 mNetworkAdapters[slot]->i_copyFrom(aThat->mNetworkAdapters[slot]); 12508 12508 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 12509 12509 mSerialPorts[slot]->i_copyFrom(aThat->mSerialPorts[slot]); … … 12974 12974 * This is identical to SessionMachine::DetachAllUSBDevices except 12975 12975 * for the aAbnormal argument. */ 12976 HRESULT rc = mUSBDeviceFilters-> notifyProxy(false /* aInsertFilters */);12976 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */); 12977 12977 AssertComRC(rc); 12978 12978 NOREF(rc); … … 13422 13422 13423 13423 #ifdef VBOX_WITH_USB 13424 *aMatched = mUSBDeviceFilters-> hasMatchingFilter(aUSBDevice, aMaskedIfs);13424 *aMatched = mUSBDeviceFilters->i_hasMatchingFilter(aUSBDevice, aMaskedIfs); 13425 13425 #else 13426 13426 NOREF(aUSBDevice); … … 13494 13494 13495 13495 #ifdef VBOX_WITH_USB 13496 HRESULT rc = mUSBDeviceFilters-> notifyProxy(true /* aInsertFilters */);13496 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(true /* aInsertFilters */); 13497 13497 AssertComRC(rc); 13498 13498 NOREF(rc); … … 13524 13524 13525 13525 #ifdef VBOX_WITH_USB 13526 HRESULT rc = mUSBDeviceFilters-> notifyProxy(false /* aInsertFilters */);13526 HRESULT rc = mUSBDeviceFilters->i_notifyProxy(false /* aInsertFilters */); 13527 13527 AssertComRC(rc); 13528 13528 NOREF(rc); … … 14510 14510 * elsewhere... */ 14511 14511 alock.release(); 14512 return mUSBDeviceFilters-> hasMatchingFilter(aDevice, aMaskedIfs);14512 return mUSBDeviceFilters->i_hasMatchingFilter(aDevice, aMaskedIfs); 14513 14513 default: break; 14514 14514 } -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r49871 r49951 6160 6160 AutoReadLock propsLock(pSysProps COMMA_LOCKVAL_SRC_POS); 6161 6161 6162 unconst(m->formatObj) = pSysProps-> mediumFormat(aFormat);6162 unconst(m->formatObj) = pSysProps->i_mediumFormat(aFormat); 6163 6163 if (m->formatObj.isNull()) 6164 6164 return setError(E_INVALIDARG, -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r49871 r49951 48 48 HRESULT NetworkAdapter::FinalConstruct() 49 49 { 50 51 50 return BaseFinalConstruct(); 52 51 } … … 96 95 * changing some other property (i.e. after mData.backup()) and after the 97 96 * subsequent mData.rollback(). */ 98 generateMACAddress();97 i_generateMACAddress(); 99 98 100 99 /* Confirm a successful initialization */ … … 213 212 } 214 213 215 // INetworkAdapter properties214 // wrapped INetworkAdapter properties 216 215 //////////////////////////////////////////////////////////////////////////////// 217 218 STDMETHODIMP NetworkAdapter::COMGETTER(AdapterType)(NetworkAdapterType_T *aAdapterType) 219 { 220 CheckComArgOutPointerValid(aAdapterType); 221 222 AutoCaller autoCaller(this); 223 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 224 216 HRESULT NetworkAdapter::getAdapterType(NetworkAdapterType_T *aAdapterType) 217 { 225 218 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 226 219 … … 230 223 } 231 224 232 STDMETHODIMP NetworkAdapter::COMSETTER(AdapterType)(NetworkAdapterType_T aAdapterType) 233 { 234 AutoCaller autoCaller(this); 235 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 236 225 HRESULT NetworkAdapter::setAdapterType(NetworkAdapterType_T aAdapterType) 226 { 237 227 /* the machine needs to be mutable */ 238 228 AutoMutableStateDependency adep(mParent); … … 282 272 } 283 273 284 STDMETHODIMP NetworkAdapter::COMGETTER(Slot)(ULONG *aSlot) 285 { 286 CheckComArgOutPointerValid(aSlot); 287 288 AutoCaller autoCaller(this); 289 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 290 274 275 HRESULT NetworkAdapter::getSlot(ULONG *aSlot) 276 { 291 277 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 292 278 … … 296 282 } 297 283 298 STDMETHODIMP NetworkAdapter::COMGETTER(Enabled)(BOOL *aEnabled) 299 { 300 CheckComArgOutPointerValid(aEnabled); 301 302 AutoCaller autoCaller(this); 303 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 304 284 HRESULT NetworkAdapter::getEnabled(BOOL *aEnabled) 285 { 305 286 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 306 287 … … 310 291 } 311 292 312 STDMETHODIMP NetworkAdapter::COMSETTER(Enabled)(BOOL aEnabled) 313 { 314 AutoCaller autoCaller(this); 315 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 316 293 HRESULT NetworkAdapter::setEnabled(BOOL aEnabled) 294 { 317 295 /* the machine needs to be mutable */ 318 296 AutoMutableStateDependency adep(mParent); … … 342 320 } 343 321 344 STDMETHODIMP NetworkAdapter::COMGETTER(MACAddress)(BSTR *aMACAddress) 345 { 346 CheckComArgOutPointerValid(aMACAddress); 347 348 AutoCaller autoCaller(this); 349 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 350 322 HRESULT NetworkAdapter::getMACAddress(com::Utf8Str &aMACAddress) 323 { 351 324 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 352 325 353 326 ComAssertRet(!mData->mMACAddress.isEmpty(), E_FAIL); 354 327 355 mData->mMACAddress.cloneTo(aMACAddress);356 357 return S_OK; 358 } 359 360 HRESULT NetworkAdapter:: updateMacAddress(Utf8Str aMACAddress)328 aMACAddress = mData->mMACAddress; 329 330 return S_OK; 331 } 332 333 HRESULT NetworkAdapter::i_updateMacAddress(Utf8Str aMACAddress) 361 334 { 362 335 HRESULT rc = S_OK; … … 366 339 */ 367 340 if (aMACAddress.isEmpty()) 368 generateMACAddress();341 i_generateMACAddress(); 369 342 else 370 343 { … … 409 382 } 410 383 411 STDMETHODIMP NetworkAdapter::COMSETTER(MACAddress)(IN_BSTR aMACAddress) 412 { 413 AutoCaller autoCaller(this); 414 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 415 384 HRESULT NetworkAdapter::setMACAddress(const com::Utf8Str &aMACAddress) 385 { 416 386 /* the machine needs to be mutable */ 417 387 AutoMutableStateDependency adep(mParent); 418 388 if (FAILED(adep.rc())) return adep.rc(); 419 389 420 421 390 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 422 391 mData.backup(); 423 392 424 HRESULT rc = updateMacAddress(aMACAddress);393 HRESULT rc = i_updateMacAddress(aMACAddress); 425 394 if (SUCCEEDED(rc)) 426 395 { … … 428 397 // leave the lock before informing callbacks 429 398 alock.release(); 399 430 400 431 401 AutoWriteLock mlock(mParent COMMA_LOCKVAL_SRC_POS); // mParent is const, no need to lock … … 441 411 } 442 412 443 STDMETHODIMP NetworkAdapter::COMGETTER(AttachmentType)(NetworkAttachmentType_T *aAttachmentType) 444 { 445 CheckComArgOutPointerValid(aAttachmentType); 446 447 AutoCaller autoCaller(this); 448 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 449 413 HRESULT NetworkAdapter::getAttachmentType(NetworkAttachmentType_T *aAttachmentType) 414 { 450 415 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 451 416 … … 455 420 } 456 421 457 STDMETHODIMP NetworkAdapter::COMSETTER(AttachmentType)(NetworkAttachmentType_T aAttachmentType) 458 { 459 AutoCaller autoCaller(this); 460 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 461 422 HRESULT NetworkAdapter::setAttachmentType(NetworkAttachmentType_T aAttachmentType) 423 { 462 424 /* the machine needs to be mutable */ 463 425 AutoMutableStateDependency adep(mParent); … … 496 458 497 459 if (oldAttachmentType == NetworkAttachmentType_NATNetwork) 498 checkAndSwitchFromNatNetworking(mData->mNATNetwork.raw());460 i_checkAndSwitchFromNatNetworking(mData->mNATNetwork); 499 461 500 462 if (aAttachmentType == NetworkAttachmentType_NATNetwork) 501 switchToNatNetworking(mData->mNATNetwork.raw());463 i_switchToNatNetworking(mData->mNATNetwork); 502 464 503 465 /* Adapt the CFGM logic and notify the guest => changeAdapter=TRUE. */ … … 508 470 } 509 471 510 STDMETHODIMP NetworkAdapter::COMGETTER(BridgedInterface)(BSTR *aBridgedInterface) 511 { 512 CheckComArgOutPointerValid(aBridgedInterface); 513 514 AutoCaller autoCaller(this); 515 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 516 517 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 518 519 mData->mBridgedInterface.cloneTo(aBridgedInterface); 520 521 return S_OK; 522 } 523 524 STDMETHODIMP NetworkAdapter::COMSETTER(BridgedInterface)(IN_BSTR aBridgedInterface) 525 { 526 Bstr bstrEmpty(""); 527 if (!aBridgedInterface) 528 aBridgedInterface = bstrEmpty.raw(); 529 530 AutoCaller autoCaller(this); 531 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 532 472 HRESULT NetworkAdapter::getBridgedInterface(com::Utf8Str &aBridgedInterface) 473 { 474 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 475 476 aBridgedInterface = mData->mBridgedInterface; 477 478 return S_OK; 479 } 480 481 HRESULT NetworkAdapter::setBridgedInterface(const com::Utf8Str &aBridgedInterface) 482 { 533 483 /* the machine needs to be mutable */ 534 484 AutoMutableStateDependency adep(mParent); … … 541 491 /* if an empty/null string is to be set, bridged interface must be 542 492 * turned off */ 543 if ( (aBridgedInterface == NULL || *aBridgedInterface == '\0')493 if (aBridgedInterface.isEmpty() 544 494 && mData->mAttachmentType == NetworkAttachmentType_Bridged) 545 495 { … … 568 518 } 569 519 570 STDMETHODIMP NetworkAdapter::COMGETTER(HostOnlyInterface)(BSTR *aHostOnlyInterface) 571 { 572 CheckComArgOutPointerValid(aHostOnlyInterface); 573 574 AutoCaller autoCaller(this); 575 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 576 577 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 578 579 mData->mHostOnlyInterface.cloneTo(aHostOnlyInterface); 580 581 return S_OK; 582 } 583 584 STDMETHODIMP NetworkAdapter::COMSETTER(HostOnlyInterface)(IN_BSTR aHostOnlyInterface) 585 { 586 Bstr bstrEmpty(""); 587 if (!aHostOnlyInterface) 588 aHostOnlyInterface = bstrEmpty.raw(); 589 590 AutoCaller autoCaller(this); 591 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 592 520 HRESULT NetworkAdapter::getHostOnlyInterface(com::Utf8Str &aHostOnlyInterface) 521 { 522 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 523 524 aHostOnlyInterface = mData->mHostOnlyInterface; 525 526 return S_OK; 527 } 528 529 HRESULT NetworkAdapter::setHostOnlyInterface(const com::Utf8Str &aHostOnlyInterface) 530 { 593 531 /* the machine needs to be mutable */ 594 532 AutoMutableStateDependency adep(mParent); … … 601 539 /* if an empty/null string is to be set, host only interface must be 602 540 * turned off */ 603 if ( (aHostOnlyInterface == NULL || *aHostOnlyInterface == '\0')604 && mData->mAttachmentType == NetworkAttachmentType_HostOnly)541 if ( aHostOnlyInterface.isEmpty() 542 && mData->mAttachmentType == NetworkAttachmentType_HostOnly) 605 543 { 606 544 return setError(E_FAIL, … … 612 550 613 551 m_fModified = true; 552 614 553 // leave the lock before informing callbacks 615 554 alock.release(); … … 628 567 } 629 568 630 STDMETHODIMP NetworkAdapter::COMGETTER(InternalNetwork)(BSTR *aInternalNetwork) 631 { 632 CheckComArgOutPointerValid(aInternalNetwork); 633 634 AutoCaller autoCaller(this); 635 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 636 637 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 638 639 mData->mInternalNetwork.cloneTo(aInternalNetwork); 640 641 return S_OK; 642 } 643 644 STDMETHODIMP NetworkAdapter::COMSETTER(InternalNetwork)(IN_BSTR aInternalNetwork) 645 { 646 AutoCaller autoCaller(this); 647 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 648 569 570 HRESULT NetworkAdapter::getInternalNetwork(com::Utf8Str &aInternalNetwork) 571 { 572 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 573 574 aInternalNetwork = mData->mInternalNetwork; 575 576 return S_OK; 577 } 578 579 HRESULT NetworkAdapter::setInternalNetwork(const com::Utf8Str &aInternalNetwork) 580 { 649 581 /* the machine needs to be mutable */ 650 582 AutoMutableStateDependency adep(mParent); … … 657 589 /* if an empty/null string is to be set, internal networking must be 658 590 * turned off */ 659 if ( (aInternalNetwork == NULL || *aInternalNetwork == '\0') 660 && mData->mAttachmentType == NetworkAttachmentType_Internal) 591 if (aInternalNetwork.isEmpty() && mData->mAttachmentType == NetworkAttachmentType_Internal) 661 592 { 662 593 return setError(E_FAIL, 663 594 tr("Empty or null internal network name is not valid")); 664 595 } 665 666 596 mData.backup(); 667 597 mData->mInternalNetwork = aInternalNetwork; … … 684 614 } 685 615 686 STDMETHODIMP NetworkAdapter::COMGETTER(NATNetwork)(BSTR *aNATNetwork) 687 { 688 CheckComArgOutPointerValid(aNATNetwork); 689 690 AutoCaller autoCaller(this); 691 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 692 693 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 694 695 mData->mNATNetwork.cloneTo(aNATNetwork); 696 697 return S_OK; 698 } 699 700 STDMETHODIMP NetworkAdapter::COMSETTER(NATNetwork)(IN_BSTR aNATNetwork) 701 { 702 Bstr bstrEmpty(""); 703 if (!aNATNetwork) 704 aNATNetwork = bstrEmpty.raw(); 705 706 AutoCaller autoCaller(this); 707 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 616 HRESULT NetworkAdapter::getNATNetwork(com::Utf8Str &aNATNetwork) 617 { 618 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 619 620 aNATNetwork = mData->mNATNetwork; 621 622 return S_OK; 623 } 624 625 626 HRESULT NetworkAdapter::setNATNetwork(const com::Utf8Str &aNATNetwork) 627 { 628 708 629 709 630 /* the machine needs to be mutable */ … … 715 636 if (mData->mNATNetwork != aNATNetwork) 716 637 { 717 718 638 /* if an empty/null string is to be set, host only interface must be 719 639 * turned off */ 720 if ( (aNATNetwork == NULL || *aNATNetwork == '\0')640 if (aNATNetwork.isEmpty() 721 641 && mData->mAttachmentType == NetworkAttachmentType_NATNetwork) 722 {723 642 return setError(E_FAIL, 724 643 tr("Empty or null NAT network name is not valid")); 725 }726 644 727 645 mData.backup(); … … 737 655 mParent->setModified(Machine::IsModified_NetworkAdapters); 738 656 mlock.release(); 739 740 checkAndSwitchFromNatNetworking(oldNatNetworkName.raw()); 741 742 switchToNatNetworking(aNATNetwork); 743 657 i_checkAndSwitchFromNatNetworking(oldNatNetworkName.raw()); 658 659 i_switchToNatNetworking(aNATNetwork); 744 660 /* When changing the host adapter, adapt the CFGM logic to make this 745 661 * change immediately effect and to notify the guest that the network … … 751 667 } 752 668 753 STDMETHODIMP NetworkAdapter::COMGETTER(GenericDriver)(BSTR *aGenericDriver) 754 { 755 CheckComArgOutPointerValid(aGenericDriver); 756 757 AutoCaller autoCaller(this); 758 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 759 760 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 761 762 mData->mGenericDriver.cloneTo(aGenericDriver); 763 764 return S_OK; 765 } 766 767 STDMETHODIMP NetworkAdapter::COMSETTER(GenericDriver)(IN_BSTR aGenericDriver) 768 { 769 Bstr bstrEmpty(""); 770 if (!aGenericDriver) 771 aGenericDriver = bstrEmpty.raw(); 772 773 AutoCaller autoCaller(this); 774 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 775 669 HRESULT NetworkAdapter::getGenericDriver(com::Utf8Str &aGenericDriver) 670 { 671 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 672 673 aGenericDriver = mData->mGenericDriver; 674 675 return S_OK; 676 } 677 678 HRESULT NetworkAdapter::setGenericDriver(const com::Utf8Str &aGenericDriver) 679 { 776 680 /* the machine needs to be mutable */ 777 681 AutoMutableStateDependency adep(mParent); … … 794 698 } 795 699 796 STDMETHODIMP NetworkAdapter::COMGETTER(CableConnected)(BOOL *aConnected) 797 { 798 CheckComArgOutPointerValid(aConnected); 799 800 AutoCaller autoCaller(this); 801 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 802 700 701 HRESULT NetworkAdapter::getCableConnected(BOOL *aConnected) 702 { 803 703 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 804 704 … … 808 708 } 809 709 810 STDMETHODIMP NetworkAdapter::COMSETTER(CableConnected)(BOOL aConnected) 811 { 812 AutoCaller autoCaller(this); 813 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 814 710 711 HRESULT NetworkAdapter::setCableConnected(BOOL aConnected) 712 { 815 713 /* the machine needs to be mutable */ 816 714 AutoMutableStateDependency adep(mParent); … … 839 737 } 840 738 841 STDMETHODIMP NetworkAdapter::COMGETTER(LineSpeed)(ULONG *aSpeed) 842 { 843 CheckComArgOutPointerValid(aSpeed); 844 845 AutoCaller autoCaller(this); 846 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 847 739 740 HRESULT NetworkAdapter::getLineSpeed(ULONG *aSpeed) 741 { 848 742 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 849 743 … … 853 747 } 854 748 855 STDMETHODIMP NetworkAdapter::COMSETTER(LineSpeed)(ULONG aSpeed) 856 { 857 AutoCaller autoCaller(this); 858 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 859 749 HRESULT NetworkAdapter::setLineSpeed(ULONG aSpeed) 750 { 860 751 /* the machine needs to be mutable */ 861 752 AutoMutableStateDependency adep(mParent); … … 884 775 } 885 776 886 887 STDMETHODIMP NetworkAdapter::COMGETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy) 888 { 889 CheckComArgOutPointerValid(aPromiscModePolicy); 890 891 AutoCaller autoCaller(this); 892 HRESULT hrc = autoCaller.rc(); 893 if (SUCCEEDED(hrc)) 894 { 895 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 896 *aPromiscModePolicy = mData->mPromiscModePolicy; 897 } 898 return hrc; 899 } 900 901 STDMETHODIMP NetworkAdapter::COMSETTER(PromiscModePolicy)(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy) 777 HRESULT NetworkAdapter::getPromiscModePolicy(NetworkAdapterPromiscModePolicy_T *aPromiscModePolicy) 778 { 779 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 780 781 *aPromiscModePolicy = mData->mPromiscModePolicy; 782 783 return S_OK; 784 } 785 786 HRESULT NetworkAdapter::setPromiscModePolicy(NetworkAdapterPromiscModePolicy_T aPromiscModePolicy) 902 787 { 903 788 switch (aPromiscModePolicy) … … 932 817 } 933 818 934 STDMETHODIMP NetworkAdapter::COMGETTER(TraceEnabled)(BOOL *aEnabled) 935 { 936 CheckComArgOutPointerValid(aEnabled); 937 938 AutoCaller autoCaller(this); 939 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 819 820 HRESULT NetworkAdapter::getTraceEnabled(BOOL *aEnabled) 821 { 940 822 941 823 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 942 824 943 825 *aEnabled = mData->mTraceEnabled; 944 return S_OK; 945 } 946 947 STDMETHODIMP NetworkAdapter::COMSETTER(TraceEnabled)(BOOL aEnabled) 948 { 949 AutoCaller autoCaller(this); 950 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 951 826 827 return S_OK; 828 } 829 830 HRESULT NetworkAdapter::setTraceEnabled(BOOL aEnabled) 831 { 952 832 /* the machine needs to be mutable */ 953 833 AutoMutableStateDependency adep(mParent); … … 976 856 } 977 857 978 STDMETHODIMP NetworkAdapter::COMGETTER(TraceFile)(BSTR *aTraceFile) 979 { 980 CheckComArgOutPointerValid(aTraceFile); 981 982 AutoCaller autoCaller(this); 983 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 984 985 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 986 987 mData->mTraceFile.cloneTo(aTraceFile); 988 989 return S_OK; 990 } 991 992 STDMETHODIMP NetworkAdapter::COMSETTER(TraceFile)(IN_BSTR aTraceFile) 993 { 994 AutoCaller autoCaller(this); 995 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 996 858 HRESULT NetworkAdapter::getTraceFile(com::Utf8Str &aTraceFile) 859 { 860 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 861 862 aTraceFile = mData->mTraceFile; 863 864 return S_OK; 865 } 866 867 868 HRESULT NetworkAdapter::setTraceFile(const com::Utf8Str &aTraceFile) 869 { 997 870 /* the machine needs to be mutable */ 998 871 AutoMutableStateDependency adep(mParent); … … 1021 894 } 1022 895 1023 STDMETHODIMP NetworkAdapter::COMGETTER(NATEngine)(INATEngine **aNATEngine) 1024 { 1025 CheckComArgOutPointerValid(aNATEngine); 1026 1027 AutoCaller autoCaller(this); 1028 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1029 1030 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1031 1032 mNATEngine.queryInterfaceTo(aNATEngine); 1033 1034 return S_OK; 1035 } 1036 1037 STDMETHODIMP NetworkAdapter::COMGETTER(BootPriority)(ULONG *aBootPriority) 1038 { 1039 CheckComArgOutPointerValid(aBootPriority); 1040 1041 AutoCaller autoCaller(this); 1042 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1043 896 HRESULT NetworkAdapter::getNATEngine(ComPtr<INATEngine> &aNATEngine) 897 { 898 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 899 900 aNATEngine = mNATEngine; 901 902 return S_OK; 903 } 904 905 HRESULT NetworkAdapter::getBootPriority(ULONG *aBootPriority) 906 { 1044 907 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1045 908 … … 1049 912 } 1050 913 1051 STDMETHODIMP NetworkAdapter::COMSETTER(BootPriority)(ULONG aBootPriority) 1052 { 1053 AutoCaller autoCaller(this); 1054 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1055 914 HRESULT NetworkAdapter::setBootPriority(ULONG aBootPriority) 915 { 1056 916 /* the machine needs to be mutable */ 1057 917 AutoMutableStateDependency adep(mParent); … … 1080 940 } 1081 941 1082 // INetworkAdapter methods942 // wrapped INetworkAdapter methods 1083 943 //////////////////////////////////////////////////////////////////////////////// 1084 944 1085 STDMETHODIMP NetworkAdapter::GetProperty(IN_BSTR aKey, BSTR *aValue) 1086 { 1087 CheckComArgOutPointerValid(aValue); 1088 1089 AutoCaller autoCaller(this); 1090 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1091 1092 Bstr key = aKey; 1093 Bstr value; 1094 1095 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1096 1097 Utf8Str strKey(key); 1098 settings::StringsMap::const_iterator it = mData->mGenericProperties.find(strKey); 945 HRESULT NetworkAdapter::getProperty(const com::Utf8Str &aKey, com::Utf8Str &aValue) 946 { 947 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 948 aValue = ""; 949 settings::StringsMap::const_iterator it = mData->mGenericProperties.find(aKey); 1099 950 if (it != mData->mGenericProperties.end()) 1100 { 1101 value = it->second; // source is a Utf8Str 1102 value.cloneTo(aValue); 1103 } 1104 1105 return S_OK; 1106 } 1107 1108 STDMETHODIMP NetworkAdapter::SetProperty(IN_BSTR aKey, IN_BSTR aValue) 951 aValue = it->second; // source is a Utf8Str 952 953 return S_OK; 954 } 955 956 HRESULT NetworkAdapter::setProperty(const com::Utf8Str &aKey, const com::Utf8Str &aValue) 1109 957 { 1110 958 LogFlowThisFunc(("\n")); 1111 1112 AutoCaller autoCaller(this);1113 if (FAILED(autoCaller.rc())) return autoCaller.rc();1114 1115 959 /* The machine needs to be mutable. */ 1116 960 AutoMutableStateDependency adep(mParent); 1117 961 if (FAILED(adep.rc())) return adep.rc(); 1118 1119 Bstr key = aKey; 1120 1121 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1122 962 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1123 963 bool fGenericChange = (mData->mAttachmentType == NetworkAttachmentType_Generic); 1124 1125 964 /* Generic properties processing. 1126 965 * Look up the old value first; if nothing's changed then do nothing. 1127 966 */ 1128 Utf8Str strValue(aValue);1129 Utf8Str strKey(aKey);1130 967 Utf8Str strOldValue; 1131 1132 settings::StringsMap::const_iterator it = mData->mGenericProperties.find(strKey); 968 settings::StringsMap::const_iterator it = mData->mGenericProperties.find(aKey); 1133 969 if (it != mData->mGenericProperties.end()) 1134 970 strOldValue = it->second; 1135 971 1136 if (strOldValue != strValue)1137 { 1138 if ( strValue.isEmpty())1139 mData->mGenericProperties.erase( strKey);972 if (strOldValue != aValue) 973 { 974 if (aValue.isEmpty()) 975 mData->mGenericProperties.erase(aKey); 1140 976 else 1141 mData->mGenericProperties[ strKey] = strValue;977 mData->mGenericProperties[aKey] = aValue; 1142 978 1143 979 /* leave the lock before informing callbacks */ … … 1158 994 } 1159 995 1160 STDMETHODIMP NetworkAdapter::GetProperties(IN_BSTR aNames, 1161 ComSafeArrayOut(BSTR, aReturnNames), 1162 ComSafeArrayOut(BSTR, aReturnValues)) 1163 { 1164 CheckComArgOutSafeArrayPointerValid(aReturnNames); 1165 CheckComArgOutSafeArrayPointerValid(aReturnValues); 1166 1167 AutoCaller autoCaller(this); 1168 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1169 996 HRESULT NetworkAdapter::getProperties(const com::Utf8Str &aNames, 997 std::vector<com::Utf8Str> &aReturnNames, 998 std::vector<com::Utf8Str> &aReturnValues) 999 { 1170 1000 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1171 1001 1172 1002 /// @todo make use of aNames according to the documentation 1173 1003 NOREF(aNames); 1174 1175 com::SafeArray<BSTR> names(mData->mGenericProperties.size());1176 com::SafeArray<BSTR> values(mData->mGenericProperties.size()); 1004 aReturnNames.resize(mData->mGenericProperties.size()); 1005 aReturnValues.resize(mData->mGenericProperties.size()); 1006 1177 1007 size_t i = 0; 1178 1008 1179 1009 for (settings::StringsMap::const_iterator it = mData->mGenericProperties.begin(); 1180 1010 it != mData->mGenericProperties.end(); 1181 ++it) 1182 { 1183 it->first.cloneTo(&names[i]); 1184 it->second.cloneTo(&values[i]); 1185 ++i; 1186 } 1187 1188 names.detachTo(ComSafeArrayOutArg(aReturnNames)); 1189 values.detachTo(ComSafeArrayOutArg(aReturnValues)); 1011 ++it, ++i) 1012 { 1013 aReturnNames[i] = it->first; 1014 aReturnValues[i] = it->second; 1015 } 1190 1016 1191 1017 return S_OK; … … 1205 1031 * @note Locks this object for writing. 1206 1032 */ 1207 HRESULT NetworkAdapter:: loadSettings(BandwidthControl *bwctl,1208 const settings::NetworkAdapter &data)1033 HRESULT NetworkAdapter::i_loadSettings(BandwidthControl *bwctl, 1034 const settings::NetworkAdapter &data) 1209 1035 { 1210 1036 AutoCaller autoCaller(this); … … 1229 1055 mData->mEnabled = data.fEnabled; 1230 1056 /* MAC address (can be null) */ 1231 rc = updateMacAddress(data.strMACAddress);1057 rc = i_updateMacAddress(data.strMACAddress); 1232 1058 if (FAILED(rc)) return rc; 1233 1059 /* cable (required) */ … … 1280 1106 * @note Locks this object for reading. 1281 1107 */ 1282 HRESULT NetworkAdapter:: saveSettings(settings::NetworkAdapter &data)1108 HRESULT NetworkAdapter::i_saveSettings(settings::NetworkAdapter &data) 1283 1109 { 1284 1110 AutoCaller autoCaller(this); … … 1330 1156 * @return 1331 1157 */ 1332 bool NetworkAdapter::isModified() { 1333 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1158 bool NetworkAdapter::i_isModified() { 1159 1160 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1161 1334 1162 bool fChanged = m_fModified; 1335 1163 fChanged |= (mData->mAdapterType == NetworkAttachmentType_NAT? mNATEngine->i_isModified() : false); … … 1340 1168 * @note Locks this object for writing. 1341 1169 */ 1342 void NetworkAdapter:: rollback()1170 void NetworkAdapter::i_rollback() 1343 1171 { 1344 1172 /* sanity */ … … 1355 1183 * for writing) if there is one. 1356 1184 */ 1357 void NetworkAdapter:: commit()1185 void NetworkAdapter::i_commit() 1358 1186 { 1359 1187 /* sanity */ … … 1384 1212 * represented by @a aThat (locked for reading). 1385 1213 */ 1386 void NetworkAdapter:: copyFrom(NetworkAdapter *aThat)1214 void NetworkAdapter::i_copyFrom(NetworkAdapter *aThat) 1387 1215 { 1388 1216 AssertReturnVoid(aThat != NULL); … … 1405 1233 } 1406 1234 1407 void NetworkAdapter:: applyDefaults(GuestOSType *aOsType)1235 void NetworkAdapter::i_applyDefaults(GuestOSType *aOsType) 1408 1236 { 1409 1237 AssertReturnVoid(aOsType != NULL); … … 1440 1268 } 1441 1269 1442 ComObjPtr<NetworkAdapter> NetworkAdapter:: getPeer()1270 ComObjPtr<NetworkAdapter> NetworkAdapter::i_getPeer() 1443 1271 { 1444 1272 return mPeer; … … 1456 1284 * span. 1457 1285 */ 1458 void NetworkAdapter:: generateMACAddress()1286 void NetworkAdapter::i_generateMACAddress() 1459 1287 { 1460 1288 Utf8Str mac; … … 1464 1292 } 1465 1293 1466 STDMETHODIMP NetworkAdapter::COMGETTER(BandwidthGroup)(IBandwidthGroup **aBwGroup)1294 HRESULT NetworkAdapter::getBandwidthGroup(ComPtr<IBandwidthGroup> &aBandwidthGroup) 1467 1295 { 1468 1296 LogFlowThisFuncEnter(); 1469 CheckComArgOutPointerValid(aBwGroup);1470 1297 1471 1298 HRESULT hrc = S_OK; 1472 1473 AutoCaller autoCaller(this);1474 if (FAILED(autoCaller.rc())) return autoCaller.rc();1475 1299 1476 1300 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1482 1306 1483 1307 Assert(SUCCEEDED(hrc)); /* This is not allowed to fail because the existence of the group was checked when it was attached. */ 1484 1485 1308 if (SUCCEEDED(hrc)) 1486 pBwGroup.queryInterfaceTo(aB wGroup);1309 pBwGroup.queryInterfaceTo(aBandwidthGroup.asOutParam()); 1487 1310 } 1488 1311 … … 1491 1314 } 1492 1315 1493 STDMETHODIMP NetworkAdapter::COMSETTER(BandwidthGroup)(IBandwidthGroup *aBwGroup)1316 HRESULT NetworkAdapter::setBandwidthGroup(const ComPtr<IBandwidthGroup> &aBandwidthGroup) 1494 1317 { 1495 1318 LogFlowThisFuncEnter(); 1496 1319 1497 AutoCaller autoCaller(this);1498 if (FAILED(autoCaller.rc())) return autoCaller.rc();1499 1500 1320 /* the machine needs to be mutable */ 1501 1321 AutoMutableStateDependency adep(mParent); … … 1504 1324 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1505 1325 1326 IBandwidthGroup *iBw = aBandwidthGroup; 1506 1327 Utf8Str strBwGroup; 1507 if (aBwGroup) 1508 strBwGroup = static_cast<BandwidthGroup*>(aBwGroup)->i_getName(); 1328 if (aBandwidthGroup) 1329 strBwGroup = static_cast<BandwidthGroup *>(iBw)->i_getName(); 1330 1509 1331 if (mData->mBandwidthGroup != strBwGroup) 1510 1332 { … … 1517 1339 } 1518 1340 1519 updateBandwidthGroup(pBwGroup);1341 i_updateBandwidthGroup(pBwGroup); 1520 1342 1521 1343 m_fModified = true; … … 1535 1357 } 1536 1358 1537 void NetworkAdapter:: updateBandwidthGroup(BandwidthGroup *aBwGroup)1359 void NetworkAdapter::i_updateBandwidthGroup(BandwidthGroup *aBwGroup) 1538 1360 { 1539 1361 LogFlowThisFuncEnter(); … … 1565 1387 1566 1388 1567 HRESULT NetworkAdapter::checkAndSwitchFromNatNetworking(IN_BSTR networkName) 1568 { 1389 HRESULT NetworkAdapter::i_checkAndSwitchFromNatNetworking(com::Utf8Str networkName) 1390 { 1391 HRESULT hrc; 1569 1392 MachineState_T state; 1570 1393 1571 HRESULThrc = mParent->COMGETTER(State)(&state);1394 hrc = mParent->COMGETTER(State)(&state); 1572 1395 if (FAILED(hrc)) 1573 1396 return hrc; 1574 1397 1575 if (state == MachineState_Running) 1398 if ( mData->mAttachmentType == NetworkAttachmentType_NATNetwork 1399 && state == MachineState_Running) 1576 1400 { 1577 1401 Bstr bstrName; 1578 1402 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1579 LogRel(("VM '%ls' stops using NAT network '%ls'\n", bstrName.raw(), networkName));1580 int natCount = mParent->getVirtualBox()->natNetworkRefDec( networkName);1403 LogRel(("VM '%ls' stops using NAT network '%ls'\n", bstrName.raw(), Bstr(networkName).raw())); 1404 int natCount = mParent->getVirtualBox()->natNetworkRefDec(Bstr(networkName).raw()); 1581 1405 if (natCount == -1) 1582 1406 return E_INVALIDARG; /* no such network */ … … 1587 1411 1588 1412 1589 HRESULT NetworkAdapter::switchToNatNetworking(IN_BSTR aNatNetworkName) 1590 { 1413 HRESULT NetworkAdapter::i_switchToNatNetworking(const com::Utf8Str &aNatNetworkName) 1414 { 1415 HRESULT hrc; 1591 1416 MachineState_T state; 1592 1417 1593 HRESULThrc = mParent->COMGETTER(State)(&state);1418 hrc = mParent->COMGETTER(State)(&state); 1594 1419 if (FAILED(hrc)) 1595 1420 return hrc; … … 1599 1424 Bstr bstrName; 1600 1425 hrc = mParent->COMGETTER(Name)(bstrName.asOutParam()); 1601 LogRel(("VM '%ls' starts using NAT network '%ls'\n", bstrName.raw(), aNatNetworkName));1602 int natCount = mParent->getVirtualBox()->natNetworkRefInc( aNatNetworkName);1426 LogRel(("VM '%ls' starts using NAT network '%ls'\n", bstrName.raw(), Bstr(aNatNetworkName).raw())); 1427 int natCount = mParent->getVirtualBox()->natNetworkRefInc(Bstr(aNatNetworkName).raw()); 1603 1428 if (natCount == -1) 1604 1429 return E_INVALIDARG; /* not found */ -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r48985 r49951 90 90 unconst(mParent) = aParent; 91 91 92 setDefaultMachineFolder(Utf8Str::Empty);93 setLoggingLevel(Utf8Str::Empty);94 setDefaultHardDiskFormat(Utf8Str::Empty);95 96 setVRDEAuthLibrary(Utf8Str::Empty);97 setDefaultVRDEExtPack(Utf8Str::Empty);92 i_setDefaultMachineFolder(Utf8Str::Empty); 93 i_setLoggingLevel(Utf8Str::Empty); 94 i_setDefaultHardDiskFormat(Utf8Str::Empty); 95 96 i_setVRDEAuthLibrary(Utf8Str::Empty); 97 i_setDefaultVRDEExtPack(Utf8Str::Empty); 98 98 99 99 m->ulLogHistoryCount = 3; … … 160 160 } 161 161 162 // ISystemProperties properties162 // wrapped ISystemProperties properties 163 163 ///////////////////////////////////////////////////////////////////////////// 164 164 165 166 STDMETHODIMP SystemProperties::COMGETTER(MinGuestRAM)(ULONG *minRAM) 167 { 168 CheckComArgOutPointerValid(minRAM); 169 170 AutoCaller autoCaller(this); 171 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 172 165 HRESULT SystemProperties::getMinGuestRAM(ULONG *minRAM) 166 167 { 173 168 /* no need to lock, this is const */ 174 169 AssertCompile(MM_RAM_MIN_IN_MB >= SchemaDefs::MinGuestRAM); … … 178 173 } 179 174 180 STDMETHODIMP SystemProperties::COMGETTER(MaxGuestRAM)(ULONG *maxRAM) 181 { 182 CheckComArgOutPointerValid(maxRAM); 183 184 AutoCaller autoCaller(this); 185 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 186 175 HRESULT SystemProperties::getMaxGuestRAM(ULONG *maxRAM) 176 { 187 177 /* no need to lock, this is const */ 188 178 AssertCompile(MM_RAM_MAX_IN_MB <= SchemaDefs::MaxGuestRAM); … … 194 184 } 195 185 196 STDMETHODIMP SystemProperties::COMGETTER(MinGuestVRAM)(ULONG *minVRAM) 197 { 198 CheckComArgOutPointerValid(minVRAM); 199 200 AutoCaller autoCaller(this); 201 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 202 186 HRESULT SystemProperties::getMinGuestVRAM(ULONG *minVRAM) 187 { 203 188 /* no need to lock, this is const */ 204 189 *minVRAM = SchemaDefs::MinGuestVRAM; … … 207 192 } 208 193 209 STDMETHODIMP SystemProperties::COMGETTER(MaxGuestVRAM)(ULONG *maxVRAM) 210 { 211 CheckComArgOutPointerValid(maxVRAM); 212 213 AutoCaller autoCaller(this); 214 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 215 194 HRESULT SystemProperties::getMaxGuestVRAM(ULONG *maxVRAM) 195 { 216 196 /* no need to lock, this is const */ 217 197 *maxVRAM = SchemaDefs::MaxGuestVRAM; … … 220 200 } 221 201 222 STDMETHODIMP SystemProperties::COMGETTER(MinGuestCPUCount)(ULONG *minCPUCount) 223 { 224 CheckComArgOutPointerValid(minCPUCount); 225 226 AutoCaller autoCaller(this); 227 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 228 202 HRESULT SystemProperties::getMinGuestCPUCount(ULONG *minCPUCount) 203 { 229 204 /* no need to lock, this is const */ 230 205 *minCPUCount = SchemaDefs::MinCPUCount; // VMM_MIN_CPU_COUNT … … 233 208 } 234 209 235 STDMETHODIMP SystemProperties::COMGETTER(MaxGuestCPUCount)(ULONG *maxCPUCount) 236 { 237 CheckComArgOutPointerValid(maxCPUCount); 238 239 AutoCaller autoCaller(this); 240 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 241 210 HRESULT SystemProperties::getMaxGuestCPUCount(ULONG *maxCPUCount) 211 { 242 212 /* no need to lock, this is const */ 243 213 *maxCPUCount = SchemaDefs::MaxCPUCount; // VMM_MAX_CPU_COUNT … … 246 216 } 247 217 248 STDMETHODIMP SystemProperties::COMGETTER(MaxGuestMonitors)(ULONG *maxMonitors) 249 { 250 CheckComArgOutPointerValid(maxMonitors); 251 252 AutoCaller autoCaller(this); 253 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 218 HRESULT SystemProperties::getMaxGuestMonitors(ULONG *maxMonitors) 219 { 254 220 255 221 /* no need to lock, this is const */ … … 259 225 } 260 226 261 STDMETHODIMP SystemProperties::COMGETTER(InfoVDSize)(LONG64 *infoVDSize) 262 { 263 CheckComArgOutPointerValid(infoVDSize); 264 265 AutoCaller autoCaller(this); 266 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 267 227 228 HRESULT SystemProperties::getInfoVDSize(LONG64 *infoVDSize) 229 { 268 230 /* 269 231 * The BIOS supports currently 32 bit LBA numbers (implementing the full … … 287 249 } 288 250 289 STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) 290 { 291 CheckComArgOutPointerValid(count); 292 293 AutoCaller autoCaller(this); 294 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 295 251 252 HRESULT SystemProperties::getSerialPortCount(ULONG *count) 253 { 296 254 /* no need to lock, this is const */ 297 255 *count = SchemaDefs::SerialPortCount; … … 300 258 } 301 259 302 STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count) 303 { 304 CheckComArgOutPointerValid(count); 305 306 AutoCaller autoCaller(this); 307 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 308 260 261 HRESULT SystemProperties::getParallelPortCount(ULONG *count) 262 { 309 263 /* no need to lock, this is const */ 310 264 *count = SchemaDefs::ParallelPortCount; … … 313 267 } 314 268 315 STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition) 316 { 317 CheckComArgOutPointerValid(aMaxBootPosition); 318 319 AutoCaller autoCaller(this); 320 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 321 269 270 HRESULT SystemProperties::getMaxBootPosition(ULONG *aMaxBootPosition) 271 { 322 272 /* no need to lock, this is const */ 323 273 *aMaxBootPosition = SchemaDefs::MaxBootPosition; … … 327 277 328 278 329 STDMETHODIMP SystemProperties::COMGETTER(ExclusiveHwVirt)(BOOL *aExclusiveHwVirt) 330 { 331 CheckComArgOutPointerValid(aExclusiveHwVirt); 332 333 AutoCaller autoCaller(this); 334 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 335 279 HRESULT SystemProperties::getExclusiveHwVirt(BOOL *aExclusiveHwVirt) 280 { 336 281 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 337 282 … … 341 286 } 342 287 343 STDMETHODIMP SystemProperties::COMSETTER(ExclusiveHwVirt)(BOOL aExclusiveHwVirt) 344 { 345 AutoCaller autoCaller(this); 346 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 347 288 HRESULT SystemProperties::setExclusiveHwVirt(BOOL aExclusiveHwVirt) 289 { 348 290 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 349 291 m->fExclusiveHwVirt = !!aExclusiveHwVirt; … … 357 299 } 358 300 359 STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count) 360 { 361 CheckComArgOutPointerValid(count); 362 363 AutoCaller autoCaller(this); 364 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 365 301 HRESULT SystemProperties::getMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *aMaxNetworkAdapters) 302 { 366 303 /* no need for locking, no state */ 367 304 uint32_t uResult = Global::getMaxNetworkAdapters(aChipset); 368 305 if (uResult == 0) 369 306 AssertMsgFailed(("Invalid chipset type %d\n", aChipset)); 370 371 *count = uResult; 372 373 return S_OK; 374 } 375 376 STDMETHODIMP SystemProperties::GetMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count) 377 { 378 CheckComArgOutPointerValid(count); 379 380 AutoCaller autoCaller(this); 381 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 382 307 *aMaxNetworkAdapters = uResult; 308 return S_OK; 309 } 310 311 HRESULT SystemProperties::getMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count) 312 { 383 313 /* no need for locking, no state */ 384 314 uint32_t uResult = Global::getMaxNetworkAdapters(aChipset); … … 409 339 410 340 411 STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aBus, 412 ULONG *aMaxDevicesPerPort) 413 { 414 CheckComArgOutPointerValid(aMaxDevicesPerPort); 415 416 AutoCaller autoCaller(this); 417 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 418 341 HRESULT SystemProperties::getMaxDevicesPerPortForStorageBus(StorageBus_T aBus, 342 ULONG *aMaxDevicesPerPort) 343 { 419 344 /* no need to lock, this is const */ 420 345 switch (aBus) … … 444 369 } 445 370 446 STDMETHODIMP SystemProperties::GetMinPortCountForStorageBus(StorageBus_T aBus, 447 ULONG *aMinPortCount) 448 { 449 CheckComArgOutPointerValid(aMinPortCount); 450 451 AutoCaller autoCaller(this); 452 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 453 371 HRESULT SystemProperties::getMinPortCountForStorageBus(StorageBus_T aBus, 372 ULONG *aMinPortCount) 373 { 454 374 /* no need to lock, this is const */ 455 375 switch (aBus) … … 488 408 } 489 409 490 STDMETHODIMP SystemProperties::GetMaxPortCountForStorageBus(StorageBus_T aBus, 491 ULONG *aMaxPortCount) 492 { 493 CheckComArgOutPointerValid(aMaxPortCount); 494 495 AutoCaller autoCaller(this); 496 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 497 410 HRESULT SystemProperties::getMaxPortCountForStorageBus(StorageBus_T aBus, 411 ULONG *aMaxPortCount) 412 { 498 413 /* no need to lock, this is const */ 499 414 switch (aBus) … … 536 451 } 537 452 538 STDMETHODIMP SystemProperties::GetMaxInstancesOfStorageBus(ChipsetType_T aChipset, 539 StorageBus_T aBus, 540 ULONG *aMaxInstances) 541 { 542 CheckComArgOutPointerValid(aMaxInstances); 543 544 AutoCaller autoCaller(this); 545 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 546 453 HRESULT SystemProperties::getMaxInstancesOfStorageBus(ChipsetType_T aChipset, 454 StorageBus_T aBus, 455 ULONG *aMaxInstances) 456 { 547 457 ULONG cCtrs = 0; 548 458 … … 571 481 } 572 482 573 STDMETHODIMP SystemProperties::GetDeviceTypesForStorageBus(StorageBus_T aBus, 574 ComSafeArrayOut(DeviceType_T, aDeviceTypes)) 575 { 576 CheckComArgOutSafeArrayPointerValid(aDeviceTypes); 577 578 AutoCaller autoCaller(this); 579 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 483 HRESULT SystemProperties::getDeviceTypesForStorageBus(StorageBus_T aBus, 484 std::vector<DeviceType_T> &aDeviceTypes) 485 { 486 aDeviceTypes.resize(0); 580 487 581 488 /* no need to lock, this is const */ … … 588 495 case StorageBus_USB: 589 496 { 590 com::SafeArray<DeviceType_T> saDeviceTypes(2); 591 saDeviceTypes[0] = DeviceType_DVD; 592 saDeviceTypes[1] = DeviceType_HardDisk; 593 saDeviceTypes.detachTo(ComSafeArrayOutArg(aDeviceTypes)); 497 aDeviceTypes.resize(2); 498 aDeviceTypes[0] = DeviceType_DVD; 499 aDeviceTypes[1] = DeviceType_HardDisk; 594 500 break; 595 501 } 596 502 case StorageBus_Floppy: 597 503 { 598 com::SafeArray<DeviceType_T> saDeviceTypes(1); 599 saDeviceTypes[0] = DeviceType_Floppy; 600 saDeviceTypes.detachTo(ComSafeArrayOutArg(aDeviceTypes)); 504 aDeviceTypes.resize(1); 505 aDeviceTypes[0] = DeviceType_Floppy; 601 506 break; 602 507 } … … 608 513 } 609 514 610 STDMETHODIMP SystemProperties::GetDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType, BOOL *aEnabled) 611 { 612 CheckComArgOutPointerValid(aEnabled); 613 614 AutoCaller autoCaller(this); 615 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 616 515 HRESULT SystemProperties::getDefaultIoCacheSettingForStorageController(StorageControllerType_T aControllerType, 516 BOOL *aEnabled) 517 { 617 518 /* no need to lock, this is const */ 618 519 switch (aControllerType) … … 637 538 } 638 539 639 STDMETHODIMP SystemProperties::GetMaxInstancesOfUSBControllerType(ChipsetType_T aChipset,640 641 540 HRESULT SystemProperties::getMaxInstancesOfUSBControllerType(ChipsetType_T aChipset, 541 USBControllerType_T aType, 542 ULONG *aMaxInstances) 642 543 { 643 544 NOREF(aChipset); 644 CheckComArgOutPointerValid(aMaxInstances);645 646 AutoCaller autoCaller(this);647 if (FAILED(autoCaller.rc())) return autoCaller.rc();648 649 545 ULONG cCtrs = 0; 650 546 … … 667 563 } 668 564 669 STDMETHODIMP SystemProperties::COMGETTER(DefaultMachineFolder)(BSTR *aDefaultMachineFolder) 670 { 671 CheckComArgOutPointerValid(aDefaultMachineFolder); 672 673 AutoCaller autoCaller(this); 674 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 675 676 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 677 678 m->strDefaultMachineFolder.cloneTo(aDefaultMachineFolder); 679 680 return S_OK; 681 } 682 683 STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder)(IN_BSTR aDefaultMachineFolder) 684 { 685 AutoCaller autoCaller(this); 686 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 687 565 HRESULT SystemProperties::getDefaultMachineFolder(com::Utf8Str &aDefaultMachineFolder) 566 { 567 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 568 aDefaultMachineFolder = m->strDefaultMachineFolder; 569 return S_OK; 570 } 571 572 HRESULT SystemProperties::setDefaultMachineFolder(const com::Utf8Str &aDefaultMachineFolder) 573 { 688 574 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 689 HRESULT rc = setDefaultMachineFolder(aDefaultMachineFolder);575 HRESULT rc = i_setDefaultMachineFolder(aDefaultMachineFolder); 690 576 alock.release(); 691 692 577 if (SUCCEEDED(rc)) 693 578 { … … 700 585 } 701 586 702 STDMETHODIMP SystemProperties::COMGETTER(LoggingLevel)(BSTR *aLoggingLevel) 703 { 704 CheckComArgOutPointerValid(aLoggingLevel); 705 706 AutoCaller autoCaller(this); 707 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 708 709 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 710 711 Utf8Str useLoggingLevel(m->strLoggingLevel); 712 if (useLoggingLevel.isEmpty()) 713 useLoggingLevel = VBOXSVC_LOG_DEFAULT; 714 715 useLoggingLevel.cloneTo(aLoggingLevel); 716 return S_OK; 717 } 718 719 720 STDMETHODIMP SystemProperties::COMSETTER(LoggingLevel)(IN_BSTR aLoggingLevel) 721 { 722 AutoCaller autoCaller(this); 723 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 724 587 HRESULT SystemProperties::getLoggingLevel(com::Utf8Str &aLoggingLevel) 588 { 589 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 590 591 aLoggingLevel = m->strLoggingLevel; 592 593 if (aLoggingLevel.isEmpty()) 594 aLoggingLevel = VBOXSVC_LOG_DEFAULT; 595 596 return S_OK; 597 } 598 599 600 HRESULT SystemProperties::setLoggingLevel(const com::Utf8Str &aLoggingLevel) 601 { 725 602 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 726 HRESULT rc = setLoggingLevel(aLoggingLevel);603 HRESULT rc = i_setLoggingLevel(aLoggingLevel); 727 604 alock.release(); 728 605 … … 733 610 } 734 611 else 735 LogRel(("Cannot set passed logging level=%ls, or the default one - Error=%Rhrc \n", aLoggingLevel, rc));612 LogRel(("Cannot set passed logging level=%ls, or the default one - Error=%Rhrc \n", Bstr(aLoggingLevel).raw(), rc)); 736 613 737 614 return rc; 738 615 } 739 616 740 STDMETHODIMP SystemProperties::COMGETTER(MediumFormats)(ComSafeArrayOut(IMediumFormat *, aMediumFormats)) 741 { 742 CheckComArgOutSafeArrayPointerValid(aMediumFormats); 743 744 AutoCaller autoCaller(this); 745 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 746 747 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 748 749 SafeIfaceArray<IMediumFormat> mediumFormats(m_llMediumFormats); 750 mediumFormats.detachTo(ComSafeArrayOutArg(aMediumFormats)); 751 752 return S_OK; 753 } 754 755 STDMETHODIMP SystemProperties::COMGETTER(DefaultHardDiskFormat)(BSTR *aDefaultHardDiskFormat) 756 { 757 CheckComArgOutPointerValid(aDefaultHardDiskFormat); 758 759 AutoCaller autoCaller(this); 760 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 761 762 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 763 764 m->strDefaultHardDiskFormat.cloneTo(aDefaultHardDiskFormat); 765 766 return S_OK; 767 } 768 769 STDMETHODIMP SystemProperties::COMSETTER(DefaultHardDiskFormat)(IN_BSTR aDefaultHardDiskFormat) 770 { 771 AutoCaller autoCaller(this); 772 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 773 617 HRESULT SystemProperties::getMediumFormats(std::vector<ComPtr<IMediumFormat> > &aMediumFormats) 618 { 619 MediumFormatList mediumFormats(m_llMediumFormats); 620 aMediumFormats.resize(mediumFormats.size()); 621 size_t i = 0; 622 for (MediumFormatList::const_iterator it = mediumFormats.begin(); it != mediumFormats.end(); ++it, ++i) 623 (*it).queryInterfaceTo(aMediumFormats[i].asOutParam()); 624 return S_OK; 625 } 626 627 HRESULT SystemProperties::getDefaultHardDiskFormat(com::Utf8Str &aDefaultHardDiskFormat) 628 { 629 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 630 aDefaultHardDiskFormat = m->strDefaultHardDiskFormat; 631 return S_OK; 632 } 633 634 635 HRESULT SystemProperties::setDefaultHardDiskFormat(const com::Utf8Str &aDefaultHardDiskFormat) 636 { 774 637 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 775 HRESULT rc = setDefaultHardDiskFormat(aDefaultHardDiskFormat);638 HRESULT rc = i_setDefaultHardDiskFormat(aDefaultHardDiskFormat); 776 639 alock.release(); 777 778 640 if (SUCCEEDED(rc)) 779 641 { … … 786 648 } 787 649 788 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceWarning)(LONG64 *aFreeSpace) 789 { 790 CheckComArgOutPointerValid(aFreeSpace); 791 650 HRESULT SystemProperties::getFreeDiskSpaceWarning(LONG64 *aFreeSpace) 651 { 652 NOREF(aFreeSpace); 792 653 ReturnComNotImplemented(); 793 654 } 794 655 795 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceWarning)(LONG64 /* aFreeSpace */)656 HRESULT SystemProperties::setFreeDiskSpaceWarning(LONG64 /* aFreeSpace */) 796 657 { 797 658 ReturnComNotImplemented(); 798 659 } 799 660 800 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentWarning)(ULONG *aFreeSpacePercent) 801 { 802 CheckComArgOutPointerValid(aFreeSpacePercent); 803 661 HRESULT SystemProperties::getFreeDiskSpacePercentWarning(ULONG *aFreeSpacePercent) 662 { 663 NOREF(aFreeSpacePercent); 804 664 ReturnComNotImplemented(); 805 665 } 806 666 807 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentWarning)(ULONG /* aFreeSpacePercent */)667 HRESULT SystemProperties::setFreeDiskSpacePercentWarning(ULONG /* aFreeSpacePercent */) 808 668 { 809 669 ReturnComNotImplemented(); 810 670 } 811 671 812 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpaceError)(LONG64 *aFreeSpace) 813 { 814 CheckComArgOutPointerValid(aFreeSpace); 815 672 HRESULT SystemProperties::getFreeDiskSpaceError(LONG64 *aFreeSpace) 673 { 674 NOREF(aFreeSpace); 816 675 ReturnComNotImplemented(); 817 676 } 818 677 819 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpaceError)(LONG64 /* aFreeSpace */)678 HRESULT SystemProperties::setFreeDiskSpaceError(LONG64 /* aFreeSpace */) 820 679 { 821 680 ReturnComNotImplemented(); 822 681 } 823 682 824 STDMETHODIMP SystemProperties::COMGETTER(FreeDiskSpacePercentError)(ULONG *aFreeSpacePercent) 825 { 826 CheckComArgOutPointerValid(aFreeSpacePercent); 827 683 HRESULT SystemProperties::getFreeDiskSpacePercentError(ULONG *aFreeSpacePercent) 684 { 685 NOREF(aFreeSpacePercent); 828 686 ReturnComNotImplemented(); 829 687 } 830 688 831 STDMETHODIMP SystemProperties::COMSETTER(FreeDiskSpacePercentError)(ULONG /* aFreeSpacePercent */)689 HRESULT SystemProperties::setFreeDiskSpacePercentError(ULONG /* aFreeSpacePercent */) 832 690 { 833 691 ReturnComNotImplemented(); 834 692 } 835 693 836 STDMETHODIMP SystemProperties::COMGETTER(VRDEAuthLibrary)(BSTR *aVRDEAuthLibrary) 837 { 838 CheckComArgOutPointerValid(aVRDEAuthLibrary); 839 840 AutoCaller autoCaller(this); 841 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 842 843 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 844 845 m->strVRDEAuthLibrary.cloneTo(aVRDEAuthLibrary); 846 847 return S_OK; 848 } 849 850 STDMETHODIMP SystemProperties::COMSETTER(VRDEAuthLibrary)(IN_BSTR aVRDEAuthLibrary) 851 { 852 AutoCaller autoCaller(this); 853 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 854 694 HRESULT SystemProperties::getVRDEAuthLibrary(com::Utf8Str &aVRDEAuthLibrary) 695 { 696 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 697 698 aVRDEAuthLibrary = m->strVRDEAuthLibrary; 699 700 return S_OK; 701 } 702 703 HRESULT SystemProperties::setVRDEAuthLibrary(const com::Utf8Str &aVRDEAuthLibrary) 704 { 855 705 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 856 HRESULT rc = setVRDEAuthLibrary(aVRDEAuthLibrary);706 HRESULT rc = i_setVRDEAuthLibrary(aVRDEAuthLibrary); 857 707 alock.release(); 858 859 708 if (SUCCEEDED(rc)) 860 709 { … … 867 716 } 868 717 869 STDMETHODIMP SystemProperties::COMGETTER(WebServiceAuthLibrary)(BSTR *aWebServiceAuthLibrary) 870 { 871 CheckComArgOutPointerValid(aWebServiceAuthLibrary); 872 873 AutoCaller autoCaller(this); 874 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 875 876 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 877 878 m->strWebServiceAuthLibrary.cloneTo(aWebServiceAuthLibrary); 879 880 return S_OK; 881 } 882 883 STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary)(IN_BSTR aWebServiceAuthLibrary) 884 { 885 AutoCaller autoCaller(this); 886 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 887 718 HRESULT SystemProperties::getWebServiceAuthLibrary(com::Utf8Str &aWebServiceAuthLibrary) 719 { 720 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 721 722 aWebServiceAuthLibrary = m->strWebServiceAuthLibrary; 723 724 return S_OK; 725 } 726 727 HRESULT SystemProperties::setWebServiceAuthLibrary(const com::Utf8Str &aWebServiceAuthLibrary) 728 { 888 729 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 889 HRESULT rc = setWebServiceAuthLibrary(aWebServiceAuthLibrary);730 HRESULT rc = i_setWebServiceAuthLibrary(aWebServiceAuthLibrary); 890 731 alock.release(); 891 732 … … 900 741 } 901 742 902 STDMETHODIMP SystemProperties::COMGETTER(DefaultVRDEExtPack)(BSTR *aExtPack) 903 { 904 CheckComArgOutPointerValid(aExtPack); 905 906 AutoCaller autoCaller(this); 907 HRESULT hrc = autoCaller.rc(); 743 HRESULT SystemProperties::getDefaultVRDEExtPack(com::Utf8Str &aExtPack) 744 { 745 HRESULT hrc = S_OK; 746 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 747 Utf8Str strExtPack(m->strDefaultVRDEExtPack); 748 if (strExtPack.isNotEmpty()) 749 { 750 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 751 hrc = S_OK; 752 else 753 #ifdef VBOX_WITH_EXTPACK 754 hrc = mParent->getExtPackManager()->checkVrdeExtPack(&strExtPack); 755 #else 756 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str()); 757 #endif 758 } 759 else 760 { 761 #ifdef VBOX_WITH_EXTPACK 762 hrc = mParent->getExtPackManager()->getDefaultVrdeExtPack(&strExtPack); 763 #endif 764 if (strExtPack.isEmpty()) 765 { 766 /* 767 * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed. 768 * This is hardcoded uglyness, sorry. 769 */ 770 char szPath[RTPATH_MAX]; 771 int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath)); 772 if (RT_SUCCESS(vrc)) 773 vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP"); 774 if (RT_SUCCESS(vrc)) 775 vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff()); 776 if (RT_SUCCESS(vrc) && RTFileExists(szPath)) 777 { 778 /* Illegal extpack name, so no conflict. */ 779 strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME; 780 } 781 } 782 } 783 908 784 if (SUCCEEDED(hrc)) 909 { 910 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 911 Utf8Str strExtPack(m->strDefaultVRDEExtPack); 912 if (strExtPack.isNotEmpty()) 913 { 914 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 915 hrc = S_OK; 916 else 785 aExtPack = strExtPack; 786 787 return S_OK; 788 } 789 790 791 HRESULT SystemProperties::setDefaultVRDEExtPack(const com::Utf8Str &aExtPack) 792 { 793 HRESULT hrc = S_OK; 794 if (aExtPack.isNotEmpty()) 795 { 796 if (aExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 797 hrc = S_OK; 798 else 917 799 #ifdef VBOX_WITH_EXTPACK 918 hrc = mParent->getExtPackManager()->checkVrdeExtPack(&strExtPack);800 hrc = mParent->getExtPackManager()->checkVrdeExtPack(&aExtPack); 919 801 #else 920 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str());802 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), aExtPack.c_str()); 921 803 #endif 922 } 923 else 924 { 925 #ifdef VBOX_WITH_EXTPACK 926 hrc = mParent->getExtPackManager()->getDefaultVrdeExtPack(&strExtPack); 927 #endif 928 if (strExtPack.isEmpty()) 929 { 930 /* 931 * Klugde - check if VBoxVRDP.dll/.so/.dylib is installed. 932 * This is hardcoded uglyness, sorry. 933 */ 934 char szPath[RTPATH_MAX]; 935 int vrc = RTPathAppPrivateArch(szPath, sizeof(szPath)); 936 if (RT_SUCCESS(vrc)) 937 vrc = RTPathAppend(szPath, sizeof(szPath), "VBoxVRDP"); 938 if (RT_SUCCESS(vrc)) 939 vrc = RTStrCat(szPath, sizeof(szPath), RTLdrGetSuff()); 940 if (RT_SUCCESS(vrc) && RTFileExists(szPath)) 941 { 942 /* Illegal extpack name, so no conflict. */ 943 strExtPack = VBOXVRDP_KLUDGE_EXTPACK_NAME; 944 } 945 } 946 } 947 804 } 805 if (SUCCEEDED(hrc)) 806 { 807 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 808 hrc = i_setDefaultVRDEExtPack(aExtPack); 948 809 if (SUCCEEDED(hrc)) 949 strExtPack.cloneTo(aExtPack); 950 } 951 952 return S_OK; 953 } 954 955 STDMETHODIMP SystemProperties::COMSETTER(DefaultVRDEExtPack)(IN_BSTR aExtPack) 956 { 957 CheckComArgNotNull(aExtPack); 958 Utf8Str strExtPack(aExtPack); 959 960 AutoCaller autoCaller(this); 961 HRESULT hrc = autoCaller.rc(); 962 if (SUCCEEDED(hrc)) 963 { 964 if (strExtPack.isNotEmpty()) 965 { 966 if (strExtPack.equals(VBOXVRDP_KLUDGE_EXTPACK_NAME)) 967 hrc = S_OK; 968 else 969 #ifdef VBOX_WITH_EXTPACK 970 hrc = mParent->getExtPackManager()->checkVrdeExtPack(&strExtPack); 971 #else 972 hrc = setError(E_FAIL, tr("The extension pack '%s' does not exist"), strExtPack.c_str()); 973 #endif 974 } 975 if (SUCCEEDED(hrc)) 976 { 977 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 978 hrc = setDefaultVRDEExtPack(aExtPack); 979 if (SUCCEEDED(hrc)) 980 { 981 /* VirtualBox::saveSettings() needs the VirtualBox write lock. */ 982 alock.release(); 983 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 984 hrc = mParent->saveSettings(); 985 } 810 { 811 /* VirtualBox::saveSettings() needs the VirtualBox write lock. */ 812 alock.release(); 813 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 814 hrc = mParent->saveSettings(); 986 815 } 987 816 } … … 990 819 } 991 820 992 STDMETHODIMP SystemProperties::COMGETTER(LogHistoryCount)(ULONG *count) 993 { 994 CheckComArgOutPointerValid(count); 995 996 AutoCaller autoCaller(this); 997 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 998 821 822 HRESULT SystemProperties::getLogHistoryCount(ULONG *count) 823 { 999 824 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1000 825 … … 1004 829 } 1005 830 1006 STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount)(ULONG count) 1007 { 1008 AutoCaller autoCaller(this); 1009 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1010 831 832 HRESULT SystemProperties::setLogHistoryCount(ULONG count) 833 { 1011 834 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1012 835 m->ulLogHistoryCount = count; … … 1020 843 } 1021 844 1022 STDMETHODIMP SystemProperties::COMGETTER(DefaultAudioDriver)(AudioDriverType_T *aAudioDriver) 1023 { 1024 CheckComArgOutPointerValid(aAudioDriver); 1025 1026 AutoCaller autoCaller(this); 1027 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1028 845 HRESULT SystemProperties::getDefaultAudioDriver(AudioDriverType_T *aAudioDriver) 846 { 1029 847 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1030 848 … … 1034 852 } 1035 853 1036 STDMETHODIMP SystemProperties::COMGETTER(AutostartDatabasePath)(BSTR *aAutostartDbPath) 1037 { 1038 CheckComArgOutPointerValid(aAutostartDbPath); 1039 1040 AutoCaller autoCaller(this); 1041 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1042 1043 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1044 1045 m->strAutostartDatabasePath.cloneTo(aAutostartDbPath); 1046 1047 return S_OK; 1048 } 1049 1050 STDMETHODIMP SystemProperties::COMSETTER(AutostartDatabasePath)(IN_BSTR aAutostartDbPath) 1051 { 1052 AutoCaller autoCaller(this); 1053 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1054 854 HRESULT SystemProperties::getAutostartDatabasePath(com::Utf8Str &aAutostartDbPath) 855 { 856 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 857 858 aAutostartDbPath = m->strAutostartDatabasePath; 859 860 return S_OK; 861 } 862 863 HRESULT SystemProperties::setAutostartDatabasePath(const com::Utf8Str &aAutostartDbPath) 864 { 1055 865 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1056 HRESULT rc = setAutostartDatabasePath(aAutostartDbPath);866 HRESULT rc = i_setAutostartDatabasePath(aAutostartDbPath); 1057 867 alock.release(); 1058 868 … … 1067 877 } 1068 878 1069 STDMETHODIMP SystemProperties::COMGETTER(DefaultAdditionsISO)(BSTR *aDefaultAdditionsISO) 1070 { 1071 CheckComArgOutPointerValid(aDefaultAdditionsISO); 1072 1073 AutoCaller autoCaller(this); 1074 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1075 879 HRESULT SystemProperties::getDefaultAdditionsISO(com::Utf8Str &aDefaultAdditionsISO) 880 { 1076 881 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1077 882 … … 1087 892 alock.acquire(); 1088 893 } 1089 m->strDefaultAdditionsISO.cloneTo(aDefaultAdditionsISO); 1090 1091 return S_OK; 1092 } 1093 1094 STDMETHODIMP SystemProperties::COMSETTER(DefaultAdditionsISO)(IN_BSTR aDefaultAdditionsISO) 1095 { 1096 AutoCaller autoCaller(this); 1097 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1098 894 aDefaultAdditionsISO = m->strDefaultAdditionsISO; 895 896 return S_OK; 897 } 898 899 HRESULT SystemProperties::setDefaultAdditionsISO(const com::Utf8Str &aDefaultAdditionsISO) 900 { 1099 901 /** @todo not yet implemented, settings handling is missing */ 1100 902 ReturnComNotImplemented(); … … 1114 916 } 1115 917 1116 STDMETHODIMP SystemProperties::COMGETTER(DefaultFrontend)(BSTR *aDefaultFrontend) 1117 { 1118 CheckComArgOutPointerValid(aDefaultFrontend); 1119 1120 AutoCaller autoCaller(this); 1121 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1122 1123 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1124 m->strDefaultFrontend.cloneTo(aDefaultFrontend); 1125 1126 return S_OK; 1127 } 1128 1129 STDMETHODIMP SystemProperties::COMSETTER(DefaultFrontend)(IN_BSTR aDefaultFrontend) 1130 { 1131 AutoCaller autoCaller(this); 1132 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1133 918 HRESULT SystemProperties::getDefaultFrontend(com::Utf8Str &aDefaultFrontend) 919 { 920 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 921 aDefaultFrontend = m->strDefaultFrontend; 922 return S_OK; 923 } 924 925 HRESULT SystemProperties::setDefaultFrontend(const com::Utf8Str &aDefaultFrontend) 926 { 1134 927 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1135 928 if (m->strDefaultFrontend == Utf8Str(aDefaultFrontend)) … … 1151 944 ///////////////////////////////////////////////////////////////////////////// 1152 945 1153 HRESULT SystemProperties:: loadSettings(const settings::SystemProperties &data)946 HRESULT SystemProperties::i_loadSettings(const settings::SystemProperties &data) 1154 947 { 1155 948 AutoCaller autoCaller(this); … … 1157 950 1158 951 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1159 1160 952 HRESULT rc = S_OK; 1161 1162 rc = setDefaultMachineFolder(data.strDefaultMachineFolder); 953 rc = i_setDefaultMachineFolder(data.strDefaultMachineFolder); 1163 954 if (FAILED(rc)) return rc; 1164 955 1165 rc = setLoggingLevel(data.strLoggingLevel);956 rc = i_setLoggingLevel(data.strLoggingLevel); 1166 957 if (FAILED(rc)) return rc; 1167 958 1168 rc = setDefaultHardDiskFormat(data.strDefaultHardDiskFormat);959 rc = i_setDefaultHardDiskFormat(data.strDefaultHardDiskFormat); 1169 960 if (FAILED(rc)) return rc; 1170 961 1171 rc = setVRDEAuthLibrary(data.strVRDEAuthLibrary);962 rc = i_setVRDEAuthLibrary(data.strVRDEAuthLibrary); 1172 963 if (FAILED(rc)) return rc; 1173 964 1174 rc = setWebServiceAuthLibrary(data.strWebServiceAuthLibrary);965 rc = i_setWebServiceAuthLibrary(data.strWebServiceAuthLibrary); 1175 966 if (FAILED(rc)) return rc; 1176 967 1177 rc = setDefaultVRDEExtPack(data.strDefaultVRDEExtPack);968 rc = i_setDefaultVRDEExtPack(data.strDefaultVRDEExtPack); 1178 969 if (FAILED(rc)) return rc; 1179 970 … … 1181 972 m->fExclusiveHwVirt = data.fExclusiveHwVirt; 1182 973 1183 rc = setAutostartDatabasePath(data.strAutostartDatabasePath);974 rc = i_setAutostartDatabasePath(data.strAutostartDatabasePath); 1184 975 if (FAILED(rc)) return rc; 1185 976 … … 1188 979 * file may not exist, and in this case keep the empty string */ 1189 980 ErrorInfoKeeper eik; 1190 (void) setDefaultAdditionsISO(data.strDefaultAdditionsISO);1191 } 1192 1193 rc = setDefaultFrontend(data.strDefaultFrontend);981 (void)i_setDefaultAdditionsISO(data.strDefaultAdditionsISO); 982 } 983 984 rc = i_setDefaultFrontend(data.strDefaultFrontend); 1194 985 if (FAILED(rc)) return rc; 1195 986 … … 1197 988 } 1198 989 1199 HRESULT SystemProperties:: saveSettings(settings::SystemProperties &data)990 HRESULT SystemProperties::i_saveSettings(settings::SystemProperties &data) 1200 991 { 1201 992 AutoCaller autoCaller(this); … … 1217 1008 * @return ComObjPtr<MediumFormat> 1218 1009 */ 1219 ComObjPtr<MediumFormat> SystemProperties:: mediumFormat(const Utf8Str &aFormat)1010 ComObjPtr<MediumFormat> SystemProperties::i_mediumFormat(const Utf8Str &aFormat) 1220 1011 { 1221 1012 ComObjPtr<MediumFormat> format; … … 1250 1041 * @return ComObjPtr<MediumFormat> 1251 1042 */ 1252 ComObjPtr<MediumFormat> SystemProperties:: mediumFormatFromExtension(const Utf8Str &aExt)1043 ComObjPtr<MediumFormat> SystemProperties::i_mediumFormatFromExtension(const Utf8Str &aExt) 1253 1044 { 1254 1045 ComObjPtr<MediumFormat> format; … … 1290 1081 * @return 1291 1082 */ 1292 HRESULT SystemProperties:: getUserHomeDirectory(Utf8Str &strPath)1083 HRESULT SystemProperties::i_getUserHomeDirectory(Utf8Str &strPath) 1293 1084 { 1294 1085 char szHome[RTPATH_MAX]; … … 1310 1101 * @return 1311 1102 */ 1312 HRESULT SystemProperties:: setDefaultMachineFolder(const Utf8Str &strPath)1103 HRESULT SystemProperties::i_setDefaultMachineFolder(const Utf8Str &strPath) 1313 1104 { 1314 1105 Utf8Str path(strPath); // make modifiable … … 1320 1111 { 1321 1112 // new default with VirtualBox 4.0: "$HOME/VirtualBox VMs" 1322 HRESULT rc = getUserHomeDirectory(path);1113 HRESULT rc = i_getUserHomeDirectory(path); 1323 1114 if (FAILED(rc)) return rc; 1324 1115 path += RTPATH_SLASH_STR "VirtualBox VMs"; … … 1335 1126 } 1336 1127 1337 HRESULT SystemProperties:: setLoggingLevel(constUtf8Str &aLoggingLevel)1128 HRESULT SystemProperties::i_setLoggingLevel(const com::Utf8Str &aLoggingLevel) 1338 1129 { 1339 1130 Utf8Str useLoggingLevel(aLoggingLevel); … … 1360 1151 } 1361 1152 1362 HRESULT SystemProperties:: setDefaultHardDiskFormat(constUtf8Str &aFormat)1153 HRESULT SystemProperties::i_setDefaultHardDiskFormat(const com::Utf8Str &aFormat) 1363 1154 { 1364 1155 if (!aFormat.isEmpty()) … … 1370 1161 } 1371 1162 1372 HRESULT SystemProperties:: setVRDEAuthLibrary(constUtf8Str &aPath)1163 HRESULT SystemProperties::i_setVRDEAuthLibrary(const com::Utf8Str &aPath) 1373 1164 { 1374 1165 if (!aPath.isEmpty()) … … 1380 1171 } 1381 1172 1382 HRESULT SystemProperties:: setWebServiceAuthLibrary(constUtf8Str &aPath)1173 HRESULT SystemProperties::i_setWebServiceAuthLibrary(const com::Utf8Str &aPath) 1383 1174 { 1384 1175 if (!aPath.isEmpty()) … … 1390 1181 } 1391 1182 1392 HRESULT SystemProperties:: setDefaultVRDEExtPack(constUtf8Str &aExtPack)1183 HRESULT SystemProperties::i_setDefaultVRDEExtPack(const com::Utf8Str &aExtPack) 1393 1184 { 1394 1185 m->strDefaultVRDEExtPack = aExtPack; … … 1397 1188 } 1398 1189 1399 HRESULT SystemProperties:: setAutostartDatabasePath(constUtf8Str &aPath)1190 HRESULT SystemProperties::i_setAutostartDatabasePath(const com::Utf8Str &aPath) 1400 1191 { 1401 1192 HRESULT rc = S_OK; … … 1427 1218 } 1428 1219 1429 HRESULT SystemProperties:: setDefaultAdditionsISO(constUtf8Str &aPath)1430 { 1431 Utf8Str path(aPath);1220 HRESULT SystemProperties::i_setDefaultAdditionsISO(const com::Utf8Str &aPath) 1221 { 1222 com::Utf8Str path(aPath); 1432 1223 if (path.isEmpty()) 1433 1224 { … … 1443 1234 vrc = RTPathUserHome(strTemp, sizeof(strTemp)); 1444 1235 AssertRC(vrc); 1445 Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, VirtualBox::getVersionNormalized().raw());1236 Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, Bstr(VirtualBox::getVersionNormalized()).raw()); 1446 1237 1447 1238 /* Check the standard image locations */ … … 1472 1263 } 1473 1264 1474 HRESULT SystemProperties:: setDefaultFrontend(constUtf8Str &aDefaultFrontend)1265 HRESULT SystemProperties::i_setDefaultFrontend(const com::Utf8Str &aDefaultFrontend) 1475 1266 { 1476 1267 m->strDefaultFrontend = aDefaultFrontend; -
trunk/src/VBox/Main/src-server/USBDeviceFilterImpl.cpp
r49742 r49951 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 41 41 * @param aStr The output string. 42 42 */ 43 static void usbFilterFieldToString(PCUSBFILTER aFilter, USBFILTERIDX aIdx, Utf8Str &out)43 static void i_usbFilterFieldToString(PCUSBFILTER aFilter, USBFILTERIDX aIdx, Utf8Str &out) 44 44 { 45 45 const USBFILTERMATCH matchingMethod = USBFilterGetMatchingMethod(aFilter, aIdx); … … 62 62 63 63 /*static*/ 64 const char* USBDeviceFilter:: describeUSBFilterIdx(USBFILTERIDX aIdx)64 const char* USBDeviceFilter::i_describeUSBFilterIdx(USBFILTERIDX aIdx) 65 65 { 66 66 switch (aIdx) … … 92 92 * @remark The idea was to have this as a static function, but tr() doesn't wanna work without a class :-/ 93 93 */ 94 /*static*/ HRESULT USBDeviceFilter:: usbFilterFieldFromString(PUSBFILTER aFilter,95 USBFILTERIDX aIdx,96 const Utf8Str &aValue,97 Utf8Str &aErrStr)94 /*static*/ HRESULT USBDeviceFilter::i_usbFilterFieldFromString(PUSBFILTER aFilter, 95 USBFILTERIDX aIdx, 96 const Utf8Str &aValue, 97 Utf8Str &aErrStr) 98 98 { 99 99 int vrc; 100 // Utf8Str str (aStr);101 100 if (aValue.isEmpty()) 102 101 vrc = USBFilterSetIgnore(aFilter, aIdx); … … 123 122 else 124 123 { 125 aErrStr = Utf8StrFmt(tr("The %s value '%s' is too big (max 0xFFFF)"), describeUSBFilterIdx(aIdx), pcszValue);124 aErrStr = Utf8StrFmt(tr("The %s value '%s' is too big (max 0xFFFF)"), i_describeUSBFilterIdx(aIdx), pcszValue); 126 125 return E_INVALIDARG; 127 126 } … … 151 150 if (vrc == VERR_INVALID_PARAMETER) 152 151 { 153 aErrStr = Utf8StrFmt(tr("The %s filter expression '%s' is not valid"), describeUSBFilterIdx(aIdx), aValue.c_str());152 aErrStr = Utf8StrFmt(tr("The %s filter expression '%s' is not valid"), i_describeUSBFilterIdx(aIdx), aValue.c_str()); 154 153 return E_INVALIDARG; 155 154 } 156 155 if (vrc == VERR_BUFFER_OVERFLOW) 157 156 { 158 aErrStr = Utf8StrFmt(tr("Insufficient expression space for the '%s' filter expression '%s'"), describeUSBFilterIdx(aIdx), aValue.c_str());157 aErrStr = Utf8StrFmt(tr("Insufficient expression space for the '%s' filter expression '%s'"), i_describeUSBFilterIdx(aIdx), aValue.c_str()); 159 158 return E_FAIL; 160 159 } 161 160 AssertRC(vrc); 162 aErrStr = Utf8StrFmt(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"), vrc, describeUSBFilterIdx(aIdx), aValue.c_str());161 aErrStr = Utf8StrFmt(tr("Encountered unexpected status %Rrc when setting '%s' to '%s'"), vrc, i_describeUSBFilterIdx(aIdx), aValue.c_str()); 163 162 return E_FAIL; 164 163 } … … 237 236 do 238 237 { 239 rc = usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);240 if (FAILED(rc)) break; 241 242 rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);243 if (FAILED(rc)) break; 244 245 rc = usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);246 if (FAILED(rc)) break; 247 248 rc = usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);249 if (FAILED(rc)) break; 250 251 rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, data.strProduct);252 if (FAILED(rc)) break; 253 254 rc = usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);255 if (FAILED(rc)) break; 256 257 rc = usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);238 rc = i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId); 239 if (FAILED(rc)) break; 240 241 rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId); 242 if (FAILED(rc)) break; 243 244 rc = i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision); 245 if (FAILED(rc)) break; 246 247 rc = i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer); 248 if (FAILED(rc)) break; 249 250 rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, data.strProduct); 251 if (FAILED(rc)) break; 252 253 rc = i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber); 254 if (FAILED(rc)) break; 255 256 rc = i_usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort); 258 257 if (FAILED(rc)) break; 259 258 … … 440 439 //////////////////////////////////////////////////////////////////////////////// 441 440 442 STDMETHODIMP USBDeviceFilter::COMGETTER(Name) (BSTR *aName) 443 { 444 CheckComArgOutPointerValid(aName); 445 446 AutoCaller autoCaller(this); 447 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 448 441 HRESULT USBDeviceFilter::getName(com::Utf8Str &aName) 442 { 449 443 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 450 444 451 mData->mName.cloneTo(aName); 452 453 return S_OK; 454 } 455 456 STDMETHODIMP USBDeviceFilter::COMSETTER(Name) (IN_BSTR aName) 457 { 458 CheckComArgStrNotEmptyOrNull(aName); 459 460 AutoCaller autoCaller(this); 461 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 462 445 aName = mData->mName; 446 447 return S_OK; 448 } 449 450 HRESULT USBDeviceFilter::setName(const com::Utf8Str &aName) 451 { 463 452 /* the machine needs to be mutable */ 464 AutoMutableStateDependency adep(mParent-> getMachine());453 AutoMutableStateDependency adep(mParent->i_getMachine()); 465 454 if (FAILED(adep.rc())) return adep.rc(); 466 455 … … 470 459 { 471 460 m_fModified = true; 472 ComObjPtr<Machine> pMachine = mParent-> getMachine();461 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 473 462 474 463 mData.backup(); … … 482 471 mlock.release(); 483 472 484 return mParent->onDeviceFilterChange(this); 485 } 486 487 return S_OK; 488 } 489 490 STDMETHODIMP USBDeviceFilter::COMGETTER(Active) (BOOL *aActive) 491 { 492 CheckComArgOutPointerValid(aActive); 493 494 AutoCaller autoCaller(this); 495 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 496 473 return mParent->i_onDeviceFilterChange(this); 474 } 475 476 return S_OK; 477 } 478 479 HRESULT USBDeviceFilter::getActive(BOOL *aActive) 480 { 497 481 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 498 482 … … 502 486 } 503 487 504 STDMETHODIMP USBDeviceFilter::COMSETTER(Active) (BOOL aActive) 505 { 506 AutoCaller autoCaller(this); 507 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 508 488 HRESULT USBDeviceFilter::setActive(const BOOL aActive) 489 { 509 490 /* the machine needs to be mutable */ 510 AutoMutableStateDependency adep(mParent-> getMachine());491 AutoMutableStateDependency adep(mParent->i_getMachine()); 511 492 if (FAILED(adep.rc())) return adep.rc(); 512 493 … … 516 497 { 517 498 m_fModified = true; 518 ComObjPtr<Machine> pMachine = mParent-> getMachine();499 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 519 500 520 501 mData.backup(); … … 528 509 mlock.release(); 529 510 530 return mParent->onDeviceFilterChange(this, TRUE /* aActiveChanged */); 531 } 532 533 return S_OK; 534 } 535 536 STDMETHODIMP USBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId) 537 { 538 return usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId); 539 } 540 541 STDMETHODIMP USBDeviceFilter::COMSETTER(VendorId) (IN_BSTR aVendorId) 542 { 543 return usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId); 544 } 545 546 STDMETHODIMP USBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId) 547 { 548 return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId); 549 } 550 551 STDMETHODIMP USBDeviceFilter::COMSETTER(ProductId) (IN_BSTR aProductId) 552 { 553 return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId); 554 } 555 556 STDMETHODIMP USBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision) 557 { 558 return usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision); 559 } 560 561 STDMETHODIMP USBDeviceFilter::COMSETTER(Revision) (IN_BSTR aRevision) 562 { 563 return usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision); 564 } 565 566 STDMETHODIMP USBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer) 567 { 568 return usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 569 } 570 571 STDMETHODIMP USBDeviceFilter::COMSETTER(Manufacturer) (IN_BSTR aManufacturer) 572 { 573 return usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 574 } 575 576 STDMETHODIMP USBDeviceFilter::COMGETTER(Product) (BSTR *aProduct) 577 { 578 return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct); 579 } 580 581 STDMETHODIMP USBDeviceFilter::COMSETTER(Product) (IN_BSTR aProduct) 582 { 583 return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct); 584 } 585 586 STDMETHODIMP USBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber) 587 { 588 return usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 589 } 590 591 STDMETHODIMP USBDeviceFilter::COMSETTER(SerialNumber) (IN_BSTR aSerialNumber) 592 { 593 return usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 594 } 595 596 STDMETHODIMP USBDeviceFilter::COMGETTER(Port) (BSTR *aPort) 597 { 598 return usbFilterFieldGetter(USBFILTERIDX_PORT, aPort); 599 } 600 601 STDMETHODIMP USBDeviceFilter::COMSETTER(Port) (IN_BSTR aPort) 602 { 603 return usbFilterFieldSetter(USBFILTERIDX_PORT, aPort); 604 } 605 606 STDMETHODIMP USBDeviceFilter::COMGETTER(Remote) (BSTR *aRemote) 607 { 608 CheckComArgOutPointerValid(aRemote); 609 610 AutoCaller autoCaller(this); 611 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 612 511 return mParent->i_onDeviceFilterChange(this, TRUE /* aActiveChanged */); 512 } 513 514 return S_OK; 515 } 516 517 HRESULT USBDeviceFilter::getVendorId(com::Utf8Str &aVendorId) 518 { 519 return i_usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId); 520 } 521 522 HRESULT USBDeviceFilter::setVendorId(const com::Utf8Str &aVendorId) 523 { 524 return i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, Bstr(aVendorId).raw()); 525 } 526 527 HRESULT USBDeviceFilter::getProductId(com::Utf8Str &aProductId) 528 { 529 return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId); 530 } 531 532 HRESULT USBDeviceFilter::setProductId(const com::Utf8Str &aProductId) 533 { 534 return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId); 535 } 536 537 HRESULT USBDeviceFilter::getRevision(com::Utf8Str &aRevision) 538 { 539 return i_usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision); 540 } 541 542 HRESULT USBDeviceFilter::setRevision(const com::Utf8Str &aRevision) 543 { 544 return i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, Bstr(aRevision).raw()); 545 } 546 547 HRESULT USBDeviceFilter::getManufacturer(com::Utf8Str &aManufacturer) 548 { 549 return i_usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 550 } 551 552 HRESULT USBDeviceFilter::setManufacturer(const com::Utf8Str &aManufacturer) 553 { 554 return i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, Bstr(aManufacturer).raw()); 555 } 556 557 HRESULT USBDeviceFilter::getProduct(com::Utf8Str &aProduct) 558 { 559 return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct); 560 } 561 562 HRESULT USBDeviceFilter::setProduct(const com::Utf8Str &aProduct) 563 { 564 return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, Bstr(aProduct).raw()); 565 } 566 567 HRESULT USBDeviceFilter::getSerialNumber(com::Utf8Str &aSerialNumber) 568 { 569 return i_usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 570 } 571 572 HRESULT USBDeviceFilter::setSerialNumber(const com::Utf8Str &aSerialNumber) 573 { 574 return i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, Bstr(aSerialNumber).raw()); 575 } 576 577 HRESULT USBDeviceFilter::getPort(com::Utf8Str &aPort) 578 { 579 return i_usbFilterFieldGetter(USBFILTERIDX_PORT, aPort); 580 } 581 582 HRESULT USBDeviceFilter::setPort(const com::Utf8Str &aPort) 583 { 584 return i_usbFilterFieldSetter(USBFILTERIDX_PORT, Bstr(aPort).raw()); 585 } 586 587 588 HRESULT USBDeviceFilter::getRemote(com::Utf8Str &aRemote) 589 { 613 590 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 614 591 615 mData->mRemote.string().cloneTo(aRemote); 616 617 return S_OK; 618 } 619 620 STDMETHODIMP USBDeviceFilter::COMSETTER(Remote) (IN_BSTR aRemote) 621 { 622 AutoCaller autoCaller(this); 623 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 624 592 aRemote = mData->mRemote.string(); 593 594 return S_OK; 595 } 596 597 HRESULT USBDeviceFilter::setRemote(const com::Utf8Str &aRemote) 598 { 625 599 /* the machine needs to be mutable */ 626 AutoMutableStateDependency adep(mParent-> getMachine());600 AutoMutableStateDependency adep(mParent->i_getMachine()); 627 601 if (FAILED(adep.rc())) return adep.rc(); 628 629 602 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 630 631 if (mData->mRemote.string() != aRemote) 632 { 633 Data::BOOLFilter flt = aRemote; 603 Bstr bRemote = Bstr(aRemote).raw(); 604 605 if (mData->mRemote.string() != bRemote) 606 { 607 Data::BOOLFilter flt = bRemote; 634 608 ComAssertRet(!flt.isNull(), E_FAIL); 635 609 if (!flt.isValid()) 636 610 return setError(E_INVALIDARG, 637 611 tr("Remote state filter string '%ls' is not valid (error at position %d)"), 638 aRemote, flt.errorPosition() + 1);612 bRemote.raw(), flt.errorPosition() + 1); 639 613 640 614 m_fModified = true; 641 ComObjPtr<Machine> pMachine = mParent-> getMachine();615 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 642 616 643 617 mData.backup(); … … 651 625 mlock.release(); 652 626 653 return mParent->onDeviceFilterChange(this); 654 } 655 656 return S_OK; 657 } 658 659 STDMETHODIMP USBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs) 660 { 661 CheckComArgOutPointerValid(aMaskedIfs); 662 663 AutoCaller autoCaller(this); 664 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 665 627 return mParent->i_onDeviceFilterChange(this); 628 } 629 return S_OK; 630 } 631 632 633 HRESULT USBDeviceFilter::getMaskedInterfaces(ULONG *aMaskedIfs) 634 { 666 635 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 667 636 … … 671 640 } 672 641 673 STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs) 674 { 675 AutoCaller autoCaller(this); 676 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 677 642 HRESULT USBDeviceFilter::setMaskedInterfaces(ULONG aMaskedIfs) 643 { 678 644 /* the machine needs to be mutable */ 679 AutoMutableStateDependency adep(mParent-> getMachine());645 AutoMutableStateDependency adep(mParent->i_getMachine()); 680 646 if (FAILED(adep.rc())) return adep.rc(); 681 647 … … 685 651 { 686 652 m_fModified = true; 687 ComObjPtr<Machine> pMachine = mParent-> getMachine();653 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 688 654 689 655 mData.backup(); 690 656 mData->mMaskedIfs = aMaskedIfs; 691 692 657 // leave the lock before informing callbacks 693 658 alock.release(); … … 697 662 mlock.release(); 698 663 699 return mParent-> onDeviceFilterChange(this);664 return mParent->i_onDeviceFilterChange(this); 700 665 } 701 666 … … 706 671 //////////////////////////////////////////////////////////////////////////////// 707 672 708 bool USBDeviceFilter::i sModified()673 bool USBDeviceFilter::i_isModified() 709 674 { 710 675 AutoCaller autoCaller(this); … … 718 683 * @note Locks this object for writing. 719 684 */ 720 void USBDeviceFilter:: rollback()685 void USBDeviceFilter::i_rollback() 721 686 { 722 687 /* sanity */ … … 733 698 * for writing) if there is one. 734 699 */ 735 void USBDeviceFilter:: commit()700 void USBDeviceFilter::i_commit() 736 701 { 737 702 /* sanity */ … … 799 764 * @return COM status. 800 765 */ 801 HRESULT USBDeviceFilter::usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr) 802 { 803 CheckComArgOutPointerValid(aStr); 804 805 AutoCaller autoCaller(this); 806 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 807 766 HRESULT USBDeviceFilter::i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr) 767 { 808 768 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 809 769 810 Utf8Str str; 811 usbFilterFieldToString(&mData->mUSBFilter, aIdx, str); 812 813 str.cloneTo(aStr); 814 770 i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr); 815 771 return S_OK; 816 772 } … … 824 780 * @return COM status. 825 781 */ 826 HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx, 827 const Utf8Str &strNew) 828 { 829 AutoCaller autoCaller(this); 830 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 831 782 HRESULT USBDeviceFilter::i_usbFilterFieldSetter(USBFILTERIDX aIdx, 783 const com::Utf8Str &strNew) 784 { 832 785 /* the machine needs to be mutable */ 833 AutoMutableStateDependency adep(mParent-> getMachine());786 AutoMutableStateDependency adep(mParent->i_getMachine()); 834 787 if (FAILED(adep.rc())) return adep.rc(); 835 788 836 789 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 837 790 838 Utf8Str strOld; 839 usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld); 791 792 com::Utf8Str strOld; 793 i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld); 840 794 if (strOld != strNew) 841 795 { 842 796 m_fModified = true; 843 ComObjPtr<Machine> pMachine = mParent-> getMachine();797 ComObjPtr<Machine> pMachine = mParent->i_getMachine(); 844 798 845 799 mData.backup(); 846 800 847 Utf8Str errStr;848 HRESULT rc = usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr);801 com::Utf8Str errStr; 802 HRESULT rc = i_usbFilterFieldFromString(&mData->mUSBFilter, aIdx, strNew, errStr); 849 803 if (FAILED(rc)) 850 804 { … … 860 814 mlock.release(); 861 815 862 return mParent->onDeviceFilterChange(this); 863 } 864 865 return S_OK; 866 } 867 868 /** 869 * Generic USB filter field setter, expects UTF-16 input. 870 * 871 * @param aIdx The field index. 872 * @param aStr The new value. 873 * 874 * @return COM status. 875 */ 876 HRESULT USBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx, 877 IN_BSTR aStr) 878 { 879 return usbFilterFieldSetter(aIdx, Utf8Str(aStr)); 816 return mParent->i_onDeviceFilterChange(this); 817 } 818 819 return S_OK; 880 820 } 881 821 … … 948 888 do 949 889 { 950 rc = COMSETTER(Action)(data.action);951 if (FAILED(rc)) break; 952 953 rc = usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId);954 if (FAILED(rc)) break; 955 956 rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId);957 if (FAILED(rc)) break; 958 959 rc = usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision);960 if (FAILED(rc)) break; 961 962 rc = usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer);963 if (FAILED(rc)) break; 964 965 rc = usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProduct);966 if (FAILED(rc)) break; 967 968 rc = usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber);969 if (FAILED(rc)) break; 970 971 rc = usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort);890 rc = setAction(data.action); 891 if (FAILED(rc)) break; 892 893 rc = i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, data.strVendorId); 894 if (FAILED(rc)) break; 895 896 rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProductId); 897 if (FAILED(rc)) break; 898 899 rc = i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, data.strRevision); 900 if (FAILED(rc)) break; 901 902 rc = i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer); 903 if (FAILED(rc)) break; 904 905 rc = i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, data.strProduct); 906 if (FAILED(rc)) break; 907 908 rc = i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber); 909 if (FAILED(rc)) break; 910 911 rc = i_usbFilterFieldSetter(USBFILTERIDX_PORT, data.strPort); 972 912 if (FAILED(rc)) break; 973 913 } … … 1044 984 * to be our parent. 1045 985 */ 1046 RWLockHandle *HostUSBDeviceFilter:: lockHandle() const986 RWLockHandle *HostUSBDeviceFilter::i_lockHandle() const 1047 987 { 1048 988 return mParent->lockHandle(); … … 1052 992 // IUSBDeviceFilter properties 1053 993 //////////////////////////////////////////////////////////////////////////////// 1054 1055 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Name) (BSTR *aName) 1056 { 1057 CheckComArgOutPointerValid(aName); 1058 1059 AutoCaller autoCaller(this); 1060 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1061 994 HRESULT HostUSBDeviceFilter::getName(com::Utf8Str &aName) 995 { 1062 996 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1063 997 1064 mData->mName.cloneTo(aName); 1065 1066 return S_OK; 1067 } 1068 1069 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Name) (IN_BSTR aName) 1070 { 1071 CheckComArgStrNotEmptyOrNull(aName); 1072 1073 AutoCaller autoCaller(this); 1074 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1075 998 aName = mData->mName; 999 1000 return S_OK; 1001 } 1002 1003 1004 HRESULT HostUSBDeviceFilter::setName(const com::Utf8Str &aName) 1005 { 1076 1006 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1077 1007 … … 1089 1019 } 1090 1020 1091 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Active) (BOOL *aActive) 1092 { 1093 CheckComArgOutPointerValid(aActive); 1094 1095 AutoCaller autoCaller(this); 1096 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1097 1021 1022 HRESULT HostUSBDeviceFilter::getActive(BOOL *aActive) 1023 { 1098 1024 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1099 1025 … … 1103 1029 } 1104 1030 1105 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Active) (BOOL aActive) 1106 { 1107 AutoCaller autoCaller(this); 1108 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1109 1031 1032 HRESULT HostUSBDeviceFilter::setActive(BOOL aActive) 1033 { 1110 1034 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1111 1035 … … 1123 1047 } 1124 1048 1125 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId) 1126 { 1127 return usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId); 1128 } 1129 1130 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(VendorId) (IN_BSTR aVendorId) 1131 { 1132 return usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId); 1133 } 1134 1135 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId) 1136 { 1137 return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId); 1138 } 1139 1140 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(ProductId) (IN_BSTR aProductId) 1141 { 1142 return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId); 1143 } 1144 1145 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision) 1146 { 1147 return usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision); 1148 } 1149 1150 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Revision) (IN_BSTR aRevision) 1151 { 1152 return usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision); 1153 } 1154 1155 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer) 1156 { 1157 return usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 1158 } 1159 1160 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Manufacturer) (IN_BSTR aManufacturer) 1161 { 1162 return usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 1163 } 1164 1165 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Product) (BSTR *aProduct) 1166 { 1167 return usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct); 1168 } 1169 1170 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Product) (IN_BSTR aProduct) 1171 { 1172 return usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct); 1173 } 1174 1175 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber) 1176 { 1177 return usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 1178 } 1179 1180 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(SerialNumber) (IN_BSTR aSerialNumber) 1181 { 1182 return usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 1183 } 1184 1185 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Port) (BSTR *aPort) 1186 { 1187 return usbFilterFieldGetter(USBFILTERIDX_PORT, aPort); 1188 } 1189 1190 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Port) (IN_BSTR aPort) 1191 { 1192 return usbFilterFieldSetter(USBFILTERIDX_PORT, aPort); 1193 } 1194 1195 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Remote) (BSTR *aRemote) 1196 { 1197 CheckComArgOutPointerValid(aRemote); 1198 1199 AutoCaller autoCaller(this); 1200 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1201 1049 HRESULT HostUSBDeviceFilter::getVendorId(com::Utf8Str &aVendorId) 1050 { 1051 return i_usbFilterFieldGetter(USBFILTERIDX_VENDOR_ID, aVendorId); 1052 } 1053 1054 HRESULT HostUSBDeviceFilter::setVendorId(const com::Utf8Str &aVendorId) 1055 { 1056 return i_usbFilterFieldSetter(USBFILTERIDX_VENDOR_ID, aVendorId); 1057 } 1058 1059 HRESULT HostUSBDeviceFilter::getProductId(com::Utf8Str &aProductId) 1060 { 1061 return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_ID, aProductId); 1062 } 1063 1064 HRESULT HostUSBDeviceFilter::setProductId(const com::Utf8Str &aProductId) 1065 { 1066 return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_ID, aProductId); 1067 } 1068 1069 HRESULT HostUSBDeviceFilter::getRevision(com::Utf8Str &aRevision) 1070 { 1071 return i_usbFilterFieldGetter(USBFILTERIDX_DEVICE, aRevision); 1072 } 1073 1074 HRESULT HostUSBDeviceFilter::setRevision(const com::Utf8Str &aRevision) 1075 { 1076 return i_usbFilterFieldSetter(USBFILTERIDX_DEVICE, aRevision); 1077 } 1078 1079 HRESULT HostUSBDeviceFilter::getManufacturer(com::Utf8Str &aManufacturer) 1080 { 1081 return i_usbFilterFieldGetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 1082 } 1083 1084 HRESULT HostUSBDeviceFilter::setManufacturer(const com::Utf8Str &aManufacturer) 1085 { 1086 return i_usbFilterFieldSetter(USBFILTERIDX_MANUFACTURER_STR, aManufacturer); 1087 } 1088 1089 HRESULT HostUSBDeviceFilter::getProduct(com::Utf8Str &aProduct) 1090 { 1091 return i_usbFilterFieldGetter(USBFILTERIDX_PRODUCT_STR, aProduct); 1092 } 1093 1094 HRESULT HostUSBDeviceFilter::setProduct(const com::Utf8Str &aProduct) 1095 { 1096 return i_usbFilterFieldSetter(USBFILTERIDX_PRODUCT_STR, aProduct); 1097 } 1098 1099 HRESULT HostUSBDeviceFilter::getSerialNumber(com::Utf8Str &aSerialNumber) 1100 { 1101 return i_usbFilterFieldGetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 1102 } 1103 1104 HRESULT HostUSBDeviceFilter::setSerialNumber(const com::Utf8Str &aSerialNumber) 1105 { 1106 return i_usbFilterFieldSetter(USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber); 1107 } 1108 1109 HRESULT HostUSBDeviceFilter::getPort(com::Utf8Str &aPort) 1110 { 1111 return i_usbFilterFieldGetter(USBFILTERIDX_PORT, aPort); 1112 } 1113 1114 HRESULT HostUSBDeviceFilter::setPort(const com::Utf8Str &aPort) 1115 { 1116 return i_usbFilterFieldSetter(USBFILTERIDX_PORT, aPort); 1117 } 1118 1119 HRESULT HostUSBDeviceFilter::getRemote(com::Utf8Str &aRemote) 1120 { 1202 1121 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1203 1122 1204 mData->mRemote.string().cloneTo(aRemote);1205 1206 return S_OK; 1207 } 1208 1209 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Remote) (IN_BSTR/* aRemote */)1123 aRemote = mData->mRemote.string(); 1124 1125 return S_OK; 1126 } 1127 1128 HRESULT HostUSBDeviceFilter::setRemote(const com::Utf8Str & /* aRemote */) 1210 1129 { 1211 1130 return setError(E_NOTIMPL, … … 1213 1132 } 1214 1133 1215 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs) 1216 { 1217 CheckComArgOutPointerValid(aMaskedIfs); 1218 1219 AutoCaller autoCaller(this); 1220 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1221 1134 1135 HRESULT HostUSBDeviceFilter::getMaskedInterfaces(ULONG *aMaskedIfs) 1136 { 1222 1137 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1223 1138 … … 1226 1141 return S_OK; 1227 1142 } 1228 1229 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG /* aMaskedIfs */) 1143 HRESULT HostUSBDeviceFilter::setMaskedInterfaces(ULONG /* aMaskedIfs */) 1230 1144 { 1231 1145 return setError(E_NOTIMPL, … … 1233 1147 } 1234 1148 1235 // IHostUSBDeviceFilter properties 1236 //////////////////////////////////////////////////////////////////////////////// 1237 1238 STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Action) (USBDeviceFilterAction_T *aAction) 1149 // wrapped IHostUSBDeviceFilter properties 1150 //////////////////////////////////////////////////////////////////////////////// 1151 HRESULT HostUSBDeviceFilter::getAction(USBDeviceFilterAction_T *aAction) 1239 1152 { 1240 1153 CheckComArgOutPointerValid(aAction); 1241 1242 AutoCaller autoCaller(this);1243 if (FAILED(autoCaller.rc())) return autoCaller.rc();1244 1154 1245 1155 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1255 1165 } 1256 1166 1257 STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Action) (USBDeviceFilterAction_T aAction) 1258 { 1259 AutoCaller autoCaller(this); 1260 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1261 1167 1168 HRESULT HostUSBDeviceFilter::setAction(USBDeviceFilterAction_T aAction) 1169 { 1262 1170 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1263 1171 … … 1292 1200 } 1293 1201 1202 1203 // IHostUSBDeviceFilter properties 1204 //////////////////////////////////////////////////////////////////////////////// 1294 1205 /** 1295 1206 * Generic USB filter field getter. … … 1300 1211 * @return COM status. 1301 1212 */ 1302 HRESULT HostUSBDeviceFilter::usbFilterFieldGetter(USBFILTERIDX aIdx, BSTR *aStr) 1303 { 1304 CheckComArgOutPointerValid(aStr); 1305 1306 AutoCaller autoCaller(this); 1307 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1308 1213 HRESULT HostUSBDeviceFilter::i_usbFilterFieldGetter(USBFILTERIDX aIdx, com::Utf8Str &aStr) 1214 { 1309 1215 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1310 1311 Utf8Str str; 1312 usbFilterFieldToString(&mData->mUSBFilter, aIdx, str); 1313 1314 str.cloneTo(aStr); 1315 1316 return S_OK; 1317 } 1318 1319 void HostUSBDeviceFilter::saveSettings(settings::USBDeviceFilter &data) 1216 i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, aStr); 1217 return S_OK; 1218 } 1219 1220 void HostUSBDeviceFilter::i_saveSettings(settings::USBDeviceFilter &data) 1320 1221 { 1321 1222 AutoCaller autoCaller(this); … … 1323 1224 1324 1225 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1325 1326 1226 data.strName = mData->mName; 1327 1227 data.fActive = !!mData->mActive; 1328 1329 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId); 1330 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId); 1331 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision); 1332 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer); 1333 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct); 1334 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber); 1335 usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PORT, data.strPort); 1228 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_VENDOR_ID, data.strVendorId); 1229 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_ID, data.strProductId); 1230 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_DEVICE, data.strRevision); 1231 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_MANUFACTURER_STR, data.strManufacturer); 1232 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PRODUCT_STR, data.strProduct); 1233 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_SERIAL_NUMBER_STR, data.strSerialNumber); 1234 i_usbFilterFieldToString(&mData->mUSBFilter, USBFILTERIDX_PORT, data.strPort); 1336 1235 1337 1236 COMGETTER(Action)(&data.action); … … 1348 1247 * @return COM status. 1349 1248 */ 1350 HRESULT HostUSBDeviceFilter::usbFilterFieldSetter(USBFILTERIDX aIdx, Bstr aStr) 1351 { 1352 AutoCaller autoCaller(this); 1353 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1354 1249 HRESULT HostUSBDeviceFilter::i_usbFilterFieldSetter(USBFILTERIDX aIdx, const com::Utf8Str &aStr) 1250 { 1355 1251 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1356 1357 1252 Utf8Str strOld; 1358 Utf8Str strNew(aStr); 1359 usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld); 1360 if (strOld != strNew) 1253 i_usbFilterFieldToString(&mData->mUSBFilter, aIdx, strOld); 1254 if (strOld != aStr) 1361 1255 { 1362 1256 //mData.backup(); 1363 1364 Utf8Str errStr; 1365 HRESULT rc = USBDeviceFilter::usbFilterFieldFromString(&mData->mUSBFilter, aIdx, aStr, errStr); 1257 com::Utf8Str errStr; 1258 HRESULT rc = USBDeviceFilter::i_usbFilterFieldFromString(&mData->mUSBFilter, aIdx, aStr, errStr); 1366 1259 if (FAILED(rc)) 1367 1260 { -
trunk/src/VBox/Main/src-server/USBDeviceFiltersImpl.cpp
r49742 r49951 290 290 291 291 292 STDMETHODIMP USBDeviceFilters::COMGETTER(DeviceFilters)(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters)) 293 { 294 #ifdef VBOX_WITH_USB 295 CheckComArgOutSafeArrayPointerValid(aDevicesFilters); 296 297 AutoCaller autoCaller(this); 298 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 299 292 HRESULT USBDeviceFilters::getDeviceFilters(std::vector<ComPtr<IUSBDeviceFilter> > &aDeviceFilters) 293 { 294 #ifdef VBOX_WITH_USB 300 295 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 301 296 302 297 SafeIfaceArray<IUSBDeviceFilter> collection(*m->llDeviceFilters.data()); 303 collection.detachTo(ComSafeArrayOutArg(aDevicesFilters)); 298 aDeviceFilters.resize(collection.size()); 299 if (collection.size()) 300 for (size_t i = 0; i < collection.size(); ++i) 301 aDeviceFilters[i] = collection[i]; 304 302 305 303 return S_OK; 306 304 #else 307 NOREF(aDevice sFilters);305 NOREF(aDeviceFilters); 308 306 # ifndef RT_OS_WINDOWS 309 NOREF(aDevice sFiltersSize);307 NOREF(aDeviceFilters); 310 308 # endif 311 309 ReturnComNotImplemented(); … … 313 311 } 314 312 315 // IUSBDeviceFilters methods313 // wrapped IUSBDeviceFilters methods 316 314 ///////////////////////////////////////////////////////////////////////////// 317 315 318 STDMETHODIMP USBDeviceFilters::CreateDeviceFilter(IN_BSTR aName, 319 IUSBDeviceFilter **aFilter) 320 { 321 #ifdef VBOX_WITH_USB 322 CheckComArgOutPointerValid(aFilter); 323 324 CheckComArgStrNotEmptyOrNull(aName); 325 326 AutoCaller autoCaller(this); 327 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 316 HRESULT USBDeviceFilters::createDeviceFilter(const com::Utf8Str &aName, 317 ComPtr<IUSBDeviceFilter> &aFilter) 318 319 { 320 #ifdef VBOX_WITH_USB 328 321 329 322 /* the machine needs to be mutable */ … … 335 328 ComObjPtr<USBDeviceFilter> pFilter; 336 329 pFilter.createObject(); 337 HRESULT rc = pFilter->init(this, aName);330 HRESULT rc = pFilter->init(this, Bstr(aName).raw()); 338 331 ComAssertComRCRetRC(rc); 339 rc = pFilter.queryInterfaceTo(aFilter );332 rc = pFilter.queryInterfaceTo(aFilter.asOutParam()); 340 333 AssertComRCReturnRC(rc); 341 334 … … 348 341 } 349 342 350 STDMETHODIMP USBDeviceFilters::InsertDeviceFilter(ULONG aPosition, 351 IUSBDeviceFilter *aFilter) 352 { 353 #ifdef VBOX_WITH_USB 354 355 CheckComArgNotNull(aFilter); 356 357 AutoCaller autoCaller(this); 358 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 343 344 HRESULT USBDeviceFilters::insertDeviceFilter(ULONG aPosition, 345 const ComPtr<IUSBDeviceFilter> &aFilter) 346 { 347 #ifdef VBOX_WITH_USB 359 348 360 349 /* the machine needs to be mutable */ … … 364 353 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 365 354 366 ComObjPtr<USBDeviceFilter> pFilter = static_cast<USBDeviceFilter*>(aFilter); 355 IUSBDeviceFilter *iFilter = aFilter; 356 ComObjPtr<USBDeviceFilter> pFilter = static_cast<USBDeviceFilter*>(iFilter); 367 357 368 358 if (pFilter->mInList) … … 387 377 388 378 /* notify the proxy (only when it makes sense) */ 389 if (pFilter-> getData().mActive && Global::IsOnline(adep.machineState())390 && pFilter-> getData().mRemote.isMatch(false))379 if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState()) 380 && pFilter->i_getData().mRemote.isMatch(false)) 391 381 { 392 382 USBProxyService *pProxySvc = m->pHost->i_usbProxyService(); 393 383 ComAssertRet(pProxySvc, E_FAIL); 394 384 395 ComAssertRet(pFilter-> getId() == NULL, E_FAIL);396 pFilter-> getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);385 ComAssertRet(pFilter->i_getId() == NULL, E_FAIL); 386 pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter); 397 387 } 398 388 … … 413 403 } 414 404 415 STDMETHODIMP USBDeviceFilters::RemoveDeviceFilter(ULONG aPosition, 416 IUSBDeviceFilter **aFilter) 417 { 418 #ifdef VBOX_WITH_USB 419 420 CheckComArgOutPointerValid(aFilter); 421 422 AutoCaller autoCaller(this); 423 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 424 405 HRESULT USBDeviceFilters::removeDeviceFilter(ULONG aPosition, 406 ComPtr<IUSBDeviceFilter> &aFilter) 407 { 408 #ifdef VBOX_WITH_USB 425 409 /* the machine needs to be mutable */ 426 410 AutoMutableStateDependency adep(m->pParent); … … 455 439 /* cancel sharing (make an independent copy of data) */ 456 440 pFilter->unshare(); 457 458 pFilter.queryInterfaceTo(aFilter); 441 pFilter.queryInterfaceTo(aFilter.asOutParam()); 442 459 443 460 444 /* notify the proxy (only when it makes sense) */ 461 if (pFilter-> getData().mActive && Global::IsOnline(adep.machineState())462 && pFilter-> getData().mRemote.isMatch(false))445 if (pFilter->i_getData().mActive && Global::IsOnline(adep.machineState()) 446 && pFilter->i_getData().mRemote.isMatch(false)) 463 447 { 464 448 USBProxyService *pProxySvc = m->pHost->i_usbProxyService(); 465 449 ComAssertRet(pProxySvc, E_FAIL); 466 450 467 ComAssertRet(pFilter-> getId() != NULL, E_FAIL);468 pProxySvc->removeFilter(pFilter-> getId());469 pFilter-> getId() = NULL;451 ComAssertRet(pFilter->i_getId() != NULL, E_FAIL); 452 pProxySvc->removeFilter(pFilter->i_getId()); 453 pFilter->i_getId() = NULL; 470 454 } 471 455 … … 497 481 * @note Does not lock "this" as Machine::loadHardware, which calls this, does not lock either. 498 482 */ 499 HRESULT USBDeviceFilters:: loadSettings(const settings::USB &data)483 HRESULT USBDeviceFilters::i_loadSettings(const settings::USB &data) 500 484 { 501 485 AutoCaller autoCaller(this); … … 540 524 * @note Locks this object for reading. 541 525 */ 542 HRESULT USBDeviceFilters:: saveSettings(settings::USB &data)526 HRESULT USBDeviceFilters::i_saveSettings(settings::USB &data) 543 527 { 544 528 AutoCaller autoCaller(this); … … 555 539 { 556 540 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 557 const USBDeviceFilter::Data &filterData = (*it)-> getData();541 const USBDeviceFilter::Data &filterData = (*it)->i_getData(); 558 542 559 543 Bstr str; … … 587 571 588 572 /** @note Locks objects for writing! */ 589 void USBDeviceFilters:: rollback()573 void USBDeviceFilters::i_rollback() 590 574 { 591 575 AutoCaller autoCaller(this); … … 614 598 { 615 599 /* notify the proxy (only when it makes sense) */ 616 if ((*it)-> getData().mActive &&600 if ((*it)->i_getData().mActive && 617 601 Global::IsOnline(adep.machineState()) 618 && (*it)-> getData().mRemote.isMatch(false))602 && (*it)->i_getData().mRemote.isMatch(false)) 619 603 { 620 604 USBDeviceFilter *pFilter = *it; 621 Assert(pFilter-> getId() != NULL);622 pProxySvc->removeFilter(pFilter-> getId());623 pFilter-> getId() = NULL;605 Assert(pFilter->i_getId() != NULL); 606 pProxySvc->removeFilter(pFilter->i_getId()); 607 pFilter->i_getId() = NULL; 624 608 } 625 609 … … 640 624 { 641 625 /* notify the proxy (only when necessary) */ 642 if ((*it)-> getData().mActive643 && (*it)-> getData().mRemote.isMatch(false))626 if ((*it)->i_getData().mActive 627 && (*it)->i_getData().mRemote.isMatch(false)) 644 628 { 645 629 USBDeviceFilter *pFilter = *it; /* resolve ambiguity */ 646 Assert(pFilter-> getId() == NULL);647 pFilter-> getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);630 Assert(pFilter->i_getId() == NULL); 631 pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter); 648 632 } 649 633 } … … 663 647 while (it != m->llDeviceFilters->end()) 664 648 { 665 if ((*it)->i sModified())649 if ((*it)->i_isModified()) 666 650 { 667 (*it)-> rollback();651 (*it)->i_rollback(); 668 652 /* call this to notify the USB proxy about changes */ 669 onDeviceFilterChange(*it);653 i_onDeviceFilterChange(*it); 670 654 } 671 655 ++it; … … 679 663 * for writing) if there is one. 680 664 */ 681 void USBDeviceFilters:: commit()665 void USBDeviceFilters::i_commit() 682 666 { 683 667 /* sanity */ … … 711 695 while (it != m->llDeviceFilters->end()) 712 696 { 713 (*it)-> commit();697 (*it)->i_commit(); 714 698 715 699 /* look if this filter has a peer filter */ 716 ComObjPtr<USBDeviceFilter> peer = (*it)-> peer();700 ComObjPtr<USBDeviceFilter> peer = (*it)->i_peer(); 717 701 if (!peer) 718 702 { … … 763 747 while (it != m->llDeviceFilters->end()) 764 748 { 765 (*it)-> commit();749 (*it)->i_commit(); 766 750 ++it; 767 751 } … … 774 758 * represented by @a aThat (locked for reading). 775 759 */ 776 void USBDeviceFilters:: copyFrom(USBDeviceFilters *aThat)760 void USBDeviceFilters::i_copyFrom(USBDeviceFilters *aThat) 777 761 { 778 762 AssertReturnVoid(aThat != NULL); … … 825 809 * @note Locks nothing. 826 810 */ 827 HRESULT USBDeviceFilters:: onDeviceFilterChange(USBDeviceFilter *aFilter,828 BOOL aActiveChanged /* = FALSE */)811 HRESULT USBDeviceFilters::i_onDeviceFilterChange(USBDeviceFilter *aFilter, 812 BOOL aActiveChanged /* = FALSE */) 829 813 { 830 814 AutoCaller autoCaller(this); … … 849 833 if (aActiveChanged) 850 834 { 851 if (aFilter-> getData().mRemote.isMatch(false))835 if (aFilter->i_getData().mRemote.isMatch(false)) 852 836 { 853 837 /* insert/remove the filter from the proxy */ 854 if (aFilter-> getData().mActive)838 if (aFilter->i_getData().mActive) 855 839 { 856 ComAssertRet(aFilter-> getId() == NULL, E_FAIL);857 aFilter-> getId() = pProxySvc->insertFilter(&aFilter->getData().mUSBFilter);840 ComAssertRet(aFilter->i_getId() == NULL, E_FAIL); 841 aFilter->i_getId() = pProxySvc->insertFilter(&aFilter->i_getData().mUSBFilter); 858 842 } 859 843 else 860 844 { 861 ComAssertRet(aFilter-> getId() != NULL, E_FAIL);862 pProxySvc->removeFilter(aFilter-> getId());863 aFilter-> getId() = NULL;845 ComAssertRet(aFilter->i_getId() != NULL, E_FAIL); 846 pProxySvc->removeFilter(aFilter->i_getId()); 847 aFilter->i_getId() = NULL; 864 848 } 865 849 } … … 867 851 else 868 852 { 869 if (aFilter-> getData().mActive)853 if (aFilter->i_getData().mActive) 870 854 { 871 855 /* update the filter in the proxy */ 872 ComAssertRet(aFilter-> getId() != NULL, E_FAIL);873 pProxySvc->removeFilter(aFilter-> getId());874 if (aFilter-> getData().mRemote.isMatch(false))856 ComAssertRet(aFilter->i_getId() != NULL, E_FAIL); 857 pProxySvc->removeFilter(aFilter->i_getId()); 858 if (aFilter->i_getData().mRemote.isMatch(false)) 875 859 { 876 aFilter-> getId() = pProxySvc->insertFilter(&aFilter->getData().mUSBFilter);860 aFilter->i_getId() = pProxySvc->insertFilter(&aFilter->i_getData().mUSBFilter); 877 861 } 878 862 } … … 891 875 * @note Locks this object for reading. 892 876 */ 893 bool USBDeviceFilters:: hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs)877 bool USBDeviceFilters::i_hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs) 894 878 { 895 879 AutoCaller autoCaller(this); … … 908 892 { 909 893 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 910 if (aDevice->isMatch((*it)-> getData()))894 if (aDevice->isMatch((*it)->i_getData())) 911 895 { 912 *aMaskedIfs = (*it)-> getData().mMaskedIfs;896 *aMaskedIfs = (*it)->i_getData().mMaskedIfs; 913 897 return true; 914 898 } … … 930 914 * @note Locks this object for reading. 931 915 */ 932 bool USBDeviceFilters:: hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs)916 bool USBDeviceFilters::i_hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs) 933 917 { 934 918 LogFlowThisFuncEnter(); … … 1005 989 { 1006 990 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 1007 const USBDeviceFilter::Data &aData = (*it)-> getData();991 const USBDeviceFilter::Data &aData = (*it)->i_getData(); 1008 992 1009 993 if (!aData.mActive) … … 1033 1017 * @note Locks this object for reading. 1034 1018 */ 1035 HRESULT USBDeviceFilters:: notifyProxy(bool aInsertFilters)1019 HRESULT USBDeviceFilters::i_notifyProxy(bool aInsertFilters) 1036 1020 { 1037 1021 LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters)); … … 1051 1035 1052 1036 /* notify the proxy (only if the filter is active) */ 1053 if ( pFilter-> getData().mActive1054 && pFilter-> getData().mRemote.isMatch(false) /* and if the filter is NOT remote */1037 if ( pFilter->i_getData().mActive 1038 && pFilter->i_getData().mRemote.isMatch(false) /* and if the filter is NOT remote */ 1055 1039 ) 1056 1040 { 1057 1041 if (aInsertFilters) 1058 1042 { 1059 AssertReturn(pFilter-> getId() == NULL, E_FAIL);1060 pFilter-> getId() = pProxySvc->insertFilter(&pFilter->getData().mUSBFilter);1043 AssertReturn(pFilter->i_getId() == NULL, E_FAIL); 1044 pFilter->i_getId() = pProxySvc->insertFilter(&pFilter->i_getData().mUSBFilter); 1061 1045 } 1062 1046 else … … 1065 1049 * when this method gets called (as a result of an early VM 1066 1050 * process crash for example. So, don't assert that ID != NULL. */ 1067 if (pFilter-> getId() != NULL)1051 if (pFilter->i_getId() != NULL) 1068 1052 { 1069 pProxySvc->removeFilter(pFilter-> getId());1070 pFilter-> getId() = NULL;1053 pProxySvc->removeFilter(pFilter->i_getId()); 1054 pFilter->i_getId() = NULL; 1071 1055 } 1072 1056 } … … 1078 1062 } 1079 1063 1080 Machine* USBDeviceFilters:: getMachine()1064 Machine* USBDeviceFilters::i_getMachine() 1081 1065 { 1082 1066 return m->pParent; -
trunk/src/VBox/Main/src-server/USBProxyService.cpp
r49742 r49951 422 422 { 423 423 AutoWriteLock filterLock(*it COMMA_LOCKVAL_SRC_POS); 424 const HostUSBDeviceFilter::Data &data = (*it)-> getData();424 const HostUSBDeviceFilter::Data &data = (*it)->i_getData(); 425 425 if (aDevice->isMatch(data)) 426 426 { -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r49795 r49951 442 442 ComAssertComRCThrowRC(rc); 443 443 444 rc = m->pSystemProperties-> loadSettings(m->pMainConfigFile->systemProperties);444 rc = m->pSystemProperties->i_loadSettings(m->pMainConfigFile->systemProperties); 445 445 if (FAILED(rc)) throw rc; 446 446 … … 4268 4268 if (FAILED(rc)) throw rc; 4269 4269 4270 rc = m->pSystemProperties-> saveSettings(m->pMainConfigFile->systemProperties);4270 rc = m->pSystemProperties->i_saveSettings(m->pMainConfigFile->systemProperties); 4271 4271 if (FAILED(rc)) throw rc; 4272 4272 -
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r49871 r49951 122 122 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SharedFolder, ISharedFolder) 123 123 124 NS_DECL_CLASSINFO(NetworkAdapter)125 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(NetworkAdapter, INetworkAdapter)126 127 NS_DECL_CLASSINFO(USBDeviceFilters)128 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDeviceFilters, IUSBDeviceFilters)129 130 124 #ifdef VBOX_WITH_USB 131 NS_DECL_CLASSINFO(USBDeviceFilter)132 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(USBDeviceFilter, IUSBDeviceFilter)133 134 125 NS_DECL_CLASSINFO(HostUSBDevice) 135 126 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(HostUSBDevice, IUSBDevice, IHostUSBDevice) 136 127 137 NS_DECL_CLASSINFO(HostUSBDeviceFilter)138 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(HostUSBDeviceFilter, IUSBDeviceFilter, IHostUSBDeviceFilter)139 128 #endif 140 141 NS_DECL_CLASSINFO(SystemProperties)142 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(SystemProperties, ISystemProperties)143 129 144 130 #ifdef VBOX_WITH_RESOURCE_USAGE_API -
trunk/src/VBox/Main/testcase/Makefile.kmk
r49906 r49951 161 161 # tstUSBProxyLinux 162 162 # 163 tstUSBProxyLinux_TEMPLATE = VBOX R3TSTNPEXE163 tstUSBProxyLinux_TEMPLATE = VBOXMAINCLIENTTSTEXE 164 164 tstUSBProxyLinux_SOURCES = \ 165 165 tstUSBProxyLinux.cpp \ … … 171 171 $(VBOX_PATH_SDK)/bindings/xpcom/include \ 172 172 $(VBOX_PATH_SDK)/bindings/xpcom/include/nsprpub \ 173 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom 173 $(VBOX_PATH_SDK)/bindings/xpcom/include/xpcom \ 174 $(VBOX_MAIN_APIWRAPPER_INCS) 174 175 tstUSBProxyLinux_DEFS = \ 175 176 UNIT_TEST \
Note:
See TracChangeset
for help on using the changeset viewer.