- Timestamp:
- May 7, 2012 1:28:04 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 1 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/NetworkAdapterImpl.cpp
r28800 r41184 187 187 AssertMsgFailed(("Invalid file descriptor: %ld.\n", tapFileDescriptor)); 188 188 189 // setError VirtualBoxSupportErrorInfoImplBase which 190 // is a parent class of NetworAdapter in the COM flavored version 191 // return setError (E_INVALIDARG, 192 // tr ("Invalid file descriptor: %ld"), tapFileDescriptor); 193 194 return S_OK; 195 189 return setError (E_INVALIDARG, 190 tr ("Invalid file descriptor: %ld"), tapFileDescriptor); 196 191 } 197 192 -
trunk/src/VBox/Frontends/VBoxBFE/VirtualBoxBase.h
r36120 r41184 81 81 82 82 /** 83 * A special version of the Assert macro to be used within VirtualBoxBase 84 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 83 * Assert macro wrapper. 85 84 * 86 85 * In the debug build, this macro is equivalent to Assert. 87 * In the release build, this macro uses |setError (E_FAIL, ...)| to set the 88 * error info from the asserted expression. 89 * 90 * @see VirtualBoxSupportErrorInfoImpl::setError 86 * In the release build, this is a no-op. 91 87 * 92 88 * @param expr Expression which should be true. … … 100 96 101 97 /** 102 * A special version of the AssertMsg macro to be used within VirtualBoxBase 103 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 98 * AssertMsg macro wrapper. 99 * 100 * In the debug build, this macro is equivalent to AssertMsg. 101 * In the release build, this is a no-op. 104 102 * 105 103 * See ComAssert for more info. … … 116 114 117 115 /** 118 * A special version of the AssertRC macro to be used within VirtualBoxBase 119 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 116 * AssertRC macro wrapper. 117 * 118 * In the debug build, this macro is equivalent to AssertRC. 119 * In the release build, this is a no-op. 120 120 * 121 121 * See ComAssert for more info. … … 130 130 131 131 /** 132 * A special version of the AssertMsgRC macro to be used within VirtualBoxBase 133 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 132 * AssertMsgRC macro wrapper. 133 * 134 * In the debug build, this macro is equivalent to AssertMsgRC. 135 * In the release build, this is a no-op. 134 136 * 135 137 * See ComAssert for more info. … … 146 148 147 149 /** 148 * A special version of the AssertFailed macro to be used within VirtualBoxBase 149 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 150 * AssertFailed macro wrapper. 151 * 152 * In the debug build, this macro is equivalent to AssertFailed. 153 * In the release build, this is a no-op. 150 154 * 151 155 * See ComAssert for more info. … … 159 163 160 164 /** 161 * A special version of the AssertMsgFailed macro to be used within VirtualBoxBase 162 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 165 * AssertMsgFailed macro wrapper. 166 * 167 * In the debug build, this macro is equivalent to AssertMsgFailed. 168 * In the release build, this is a no-op. 163 169 * 164 170 * See ComAssert for more info. … … 174 180 175 181 /** 176 * A special version of the AssertComRC macro to be used within VirtualBoxBase 177 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template. 182 * AssertComRC macro wrapper. 183 * 184 * In the debug build, this macro is equivalent to AssertComRC. 185 * In the release build, this is a no-op. 178 186 * 179 187 * See ComAssert for more info. … … 246 254 * This macro <b>must</b> be used at the beginning of all interface methods 247 255 * (right after entering the class lock) in classes derived from both 248 * VirtualBoxBase and VirtualBoxSupportErrorInfoImpl.256 * VirtualBoxBase. 249 257 */ 250 258 #define CHECK_READY() \ -
trunk/src/VBox/Main/Makefile.kmk
r41040 r41184 706 706 glue/EventQueue.cpp \ 707 707 glue/ErrorInfo.cpp \ 708 glue/errorprint.cpp \ 709 glue/VirtualBoxErrorInfo.cpp 708 glue/errorprint.cpp 710 709 VBoxCOM_INCS += \ 711 710 include -
trunk/src/VBox/Main/include/FramebufferImpl.h
r35638 r41184 26 26 class ATL_NO_VTABLE Framebuffer : 27 27 public VirtualBoxBase, 28 public VirtualBoxSupportErrorInfoImpl<Framebuffer, IFramebuffer>,29 28 public VirtualBoxSupportTranslation<Framebuffer>, 30 29 VBOX_SCRIPTABLE_IMPL(IFramebuffer) … … 73 72 74 73 STDMETHOD(ProcessVHWACommand)(BYTE *pCommand) = 0; 75 76 // for VirtualBoxSupportErrorInfoImpl77 static const wchar_t *getComponentName() { return L"Framebuffer"; }78 79 74 }; 80 75 -
trunk/src/VBox/Main/include/ProgressProxyImpl.h
r35638 r41184 28 28 */ 29 29 class ATL_NO_VTABLE ProgressProxy : 30 //public com::SupportErrorInfoDerived<Progress, ProgressProxy, IProgress>,31 30 public Progress 32 31 { … … 94 93 bool setOtherProgressObject(IProgress *pOtherProgress); 95 94 96 /** For com::SupportErrorInfoImpl. */97 static const char *ComponentName() { return "ProgressProxy"; }98 99 95 protected: 100 96 void clearOtherProgressObjectInternal(bool fEarly); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r40432 r41184 146 146 /** 147 147 * Special version of the Assert macro to be used within VirtualBoxBase 148 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.148 * subclasses. 149 149 * 150 150 * In the debug build, this macro is equivalent to Assert. … … 152 152 * error info from the asserted expression. 153 153 * 154 * @see VirtualBox SupportErrorInfoImpl::setError154 * @see VirtualBoxBase::setError 155 155 * 156 156 * @param expr Expression which should be true. … … 170 170 /** 171 171 * Special version of the AssertFailed macro to be used within VirtualBoxBase 172 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.172 * subclasses. 173 173 * 174 174 * In the debug build, this macro is equivalent to AssertFailed. … … 176 176 * error info from the asserted expression. 177 177 * 178 * @see VirtualBox SupportErrorInfoImpl::setError178 * @see VirtualBoxBase::setError 179 179 * 180 180 */ … … 192 192 /** 193 193 * Special version of the AssertMsg macro to be used within VirtualBoxBase 194 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.194 * subclasses. 195 195 * 196 196 * See ComAssert for more info. … … 213 213 /** 214 214 * Special version of the AssertRC macro to be used within VirtualBoxBase 215 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.215 * subclasses. 216 216 * 217 217 * See ComAssert for more info. … … 227 227 /** 228 228 * Special version of the AssertMsgRC macro to be used within VirtualBoxBase 229 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.229 * subclasses. 230 230 * 231 231 * See ComAssert for more info. … … 242 242 /** 243 243 * Special version of the AssertComRC macro to be used within VirtualBoxBase 244 * subclasses that also inherit the VirtualBoxSupportErrorInfoImpl template.244 * subclasses. 245 245 * 246 246 * See ComAssert for more info. -
trunk/src/VBox/Main/src-all/ProgressImpl.cpp
r40257 r41184 1235 1235 * Marks the operation as complete and attaches full error info. 1236 1236 * 1237 * See com::SupportErrorInfoImpl::setError(HRESULT, const GUID &, const wchar_t1237 * See VirtualBoxBase::setError(HRESULT, const GUID &, const wchar_t 1238 1238 * *, const char *, ...) for more info. 1239 1239 * -
trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp
r41104 r41184 739 739 740 740 /** 741 * Places the managed VirtualBoxBase object to 741 * Places the managed VirtualBoxBase object to Ready/Limited state if the 742 742 * initialization succeeded or partly succeeded, or places it to InitFailed 743 743 * state and calls the object's uninit() method. -
trunk/src/VBox/Main/src-all/VirtualBoxErrorInfoImpl.cpp
r38533 r41184 1 1 /** @file 2 2 * 3 * VirtualBoxErrorInfo COM class eimplementation3 * VirtualBoxErrorInfo COM class implementation 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 66 66 //////////////////////////////////////////////////////////////////////////////// 67 67 68 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode) 68 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(ResultCode)(LONG *aResultCode) 69 69 { 70 70 CheckComArgOutPointerValid(aResultCode); … … 74 74 } 75 75 76 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID) 76 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(InterfaceID)(BSTR *aIID) 77 77 { 78 78 CheckComArgOutPointerValid(aIID); … … 82 82 } 83 83 84 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component) 84 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Component)(BSTR *aComponent) 85 85 { 86 86 CheckComArgOutPointerValid(aComponent); … … 90 90 } 91 91 92 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text) 92 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Text)(BSTR *aText) 93 93 { 94 94 CheckComArgOutPointerValid(aText); … … 98 98 } 99 99 100 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Next) 100 STDMETHODIMP VirtualBoxErrorInfo::COMGETTER(Next)(IVirtualBoxErrorInfo **aNext) 101 101 { 102 102 CheckComArgOutPointerValid(aNext); … … 112 112 * object. 113 113 */ 114 HRESULT VirtualBoxErrorInfo::init 114 HRESULT VirtualBoxErrorInfo::init(IErrorInfo *aInfo) 115 115 { 116 116 AssertReturn(aInfo, E_FAIL); … … 124 124 m_resultCode = S_OK; 125 125 rc = aInfo->GetGUID(m_IID.asOutParam()); 126 AssertComRC 126 AssertComRC(rc); 127 127 Bstr bstrComponent; 128 128 rc = aInfo->GetSource(bstrComponent.asOutParam()); 129 AssertComRC 129 AssertComRC(rc); 130 130 m_strComponent = bstrComponent; 131 131 Bstr bstrText; 132 132 rc = aInfo->GetDescription(bstrText.asOutParam()); 133 AssertComRC 133 AssertComRC(rc); 134 134 m_strText = bstrText; 135 135 … … 140 140 //////////////////////////////////////////////////////////////////////////////// 141 141 142 STDMETHODIMP VirtualBoxErrorInfo::GetDescription 143 { 144 return COMGETTER(Text) 145 } 146 147 STDMETHODIMP VirtualBoxErrorInfo::GetGUID 142 STDMETHODIMP VirtualBoxErrorInfo::GetDescription(BSTR *description) 143 { 144 return COMGETTER(Text)(description); 145 } 146 147 STDMETHODIMP VirtualBoxErrorInfo::GetGUID(GUID *guid) 148 148 { 149 149 Bstr iid; 150 HRESULT rc = COMGETTER(InterfaceID) 150 HRESULT rc = COMGETTER(InterfaceID)(iid.asOutParam()); 151 151 if (SUCCEEDED(rc)) 152 152 *guid = Guid(iid).ref(); … … 154 154 } 155 155 156 STDMETHODIMP VirtualBoxErrorInfo::GetHelpContext 156 STDMETHODIMP VirtualBoxErrorInfo::GetHelpContext(DWORD *pdwHelpContext) 157 157 { 158 158 return E_NOTIMPL; 159 159 } 160 160 161 STDMETHODIMP VirtualBoxErrorInfo::GetHelpFile 161 STDMETHODIMP VirtualBoxErrorInfo::GetHelpFile(BSTR *pbstrHelpFile) 162 162 { 163 163 return E_NOTIMPL; 164 164 } 165 165 166 STDMETHODIMP VirtualBoxErrorInfo::GetSource 167 { 168 return COMGETTER(Component) 166 STDMETHODIMP VirtualBoxErrorInfo::GetSource(BSTR *source) 167 { 168 return COMGETTER(Component)(source); 169 169 } 170 170 … … 206 206 207 207 /* readonly attribute string message; */ 208 NS_IMETHODIMP VirtualBoxErrorInfo::GetMessage 208 NS_IMETHODIMP VirtualBoxErrorInfo::GetMessage(char **aMessage) 209 209 { 210 210 CheckComArgOutPointerValid(aMessage); … … 215 215 216 216 /* readonly attribute nsresult result; */ 217 NS_IMETHODIMP VirtualBoxErrorInfo::GetResult 217 NS_IMETHODIMP VirtualBoxErrorInfo::GetResult(nsresult *aResult) 218 218 { 219 219 if (!aResult) … … 221 221 222 222 PRInt32 lrc; 223 nsresult rc = COMGETTER(ResultCode) 223 nsresult rc = COMGETTER(ResultCode)(&lrc); 224 224 if (SUCCEEDED(rc)) 225 225 *aResult = lrc; … … 228 228 229 229 /* readonly attribute string name; */ 230 NS_IMETHODIMP VirtualBoxErrorInfo::GetName 230 NS_IMETHODIMP VirtualBoxErrorInfo::GetName(char ** /* aName */) 231 231 { 232 232 return NS_ERROR_NOT_IMPLEMENTED; … … 234 234 235 235 /* readonly attribute string filename; */ 236 NS_IMETHODIMP VirtualBoxErrorInfo::GetFilename 236 NS_IMETHODIMP VirtualBoxErrorInfo::GetFilename(char ** /* aFilename */) 237 237 { 238 238 return NS_ERROR_NOT_IMPLEMENTED; … … 240 240 241 241 /* readonly attribute PRUint32 lineNumber; */ 242 NS_IMETHODIMP VirtualBoxErrorInfo::GetLineNumber 242 NS_IMETHODIMP VirtualBoxErrorInfo::GetLineNumber(PRUint32 * /* aLineNumber */) 243 243 { 244 244 return NS_ERROR_NOT_IMPLEMENTED; … … 246 246 247 247 /* readonly attribute PRUint32 columnNumber; */ 248 NS_IMETHODIMP VirtualBoxErrorInfo::GetColumnNumber 248 NS_IMETHODIMP VirtualBoxErrorInfo::GetColumnNumber(PRUint32 * /*aColumnNumber */) 249 249 { 250 250 return NS_ERROR_NOT_IMPLEMENTED; … … 252 252 253 253 /* readonly attribute nsIStackFrame location; */ 254 NS_IMETHODIMP VirtualBoxErrorInfo::GetLocation 254 NS_IMETHODIMP VirtualBoxErrorInfo::GetLocation(nsIStackFrame ** /* aLocation */) 255 255 { 256 256 return NS_ERROR_NOT_IMPLEMENTED; … … 258 258 259 259 /* readonly attribute nsIException inner; */ 260 NS_IMETHODIMP VirtualBoxErrorInfo::GetInner 260 NS_IMETHODIMP VirtualBoxErrorInfo::GetInner(nsIException **aInner) 261 261 { 262 262 ComPtr<IVirtualBoxErrorInfo> info; 263 nsresult rv = COMGETTER(Next) 263 nsresult rv = COMGETTER(Next)(info.asOutParam()); 264 264 if (FAILED(rv)) return rv; 265 265 return info.queryInterfaceTo(aInner); … … 267 267 268 268 /* readonly attribute nsISupports data; */ 269 NS_IMETHODIMP VirtualBoxErrorInfo::GetData 270 { 271 return NS_ERROR_NOT_IMPLEMENTED; 272 } 273 274 /* string toString 275 NS_IMETHODIMP VirtualBoxErrorInfo::ToString 276 { 277 return NS_ERROR_NOT_IMPLEMENTED; 278 } 279 280 NS_IMPL_THREADSAFE_ISUPPORTS2 281 269 NS_IMETHODIMP VirtualBoxErrorInfo::GetData(nsISupports ** /* aData */) 270 { 271 return NS_ERROR_NOT_IMPLEMENTED; 272 } 273 274 /* string toString(); */ 275 NS_IMETHODIMP VirtualBoxErrorInfo::ToString(char ** /* retval */) 276 { 277 return NS_ERROR_NOT_IMPLEMENTED; 278 } 279 280 NS_IMPL_THREADSAFE_ISUPPORTS2(VirtualBoxErrorInfo, 281 nsIException, IVirtualBoxErrorInfo) 282 282 283 283 #endif // defined(VBOX_WITH_XPCOM) -
trunk/src/VBox/Main/src-server/USBControllerImpl.cpp
r38441 r41184 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 86 86 ///////////////////////////////////////////////////////////////////////////// 87 87 88 DEFINE_EMPTY_CTOR_DTOR 88 DEFINE_EMPTY_CTOR_DTOR(USBController) 89 89 90 90 HRESULT USBController::FinalConstruct() … … 262 262 ///////////////////////////////////////////////////////////////////////////// 263 263 264 STDMETHODIMP USBController::COMGETTER(Enabled) 264 STDMETHODIMP USBController::COMGETTER(Enabled)(BOOL *aEnabled) 265 265 { 266 266 CheckComArgOutPointerValid(aEnabled); … … 277 277 278 278 279 STDMETHODIMP USBController::COMSETTER(Enabled) 279 STDMETHODIMP USBController::COMSETTER(Enabled)(BOOL aEnabled) 280 280 { 281 281 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); … … 308 308 } 309 309 310 STDMETHODIMP USBController::COMGETTER(EnabledEhci) 310 STDMETHODIMP USBController::COMGETTER(EnabledEhci)(BOOL *aEnabled) 311 311 { 312 312 CheckComArgOutPointerValid(aEnabled); … … 322 322 } 323 323 324 STDMETHODIMP USBController::COMSETTER(EnabledEhci) 324 STDMETHODIMP USBController::COMSETTER(EnabledEhci)(BOOL aEnabled) 325 325 { 326 326 LogFlowThisFunc(("aEnabled=%RTbool\n", aEnabled)); … … 353 353 } 354 354 355 STDMETHODIMP USBController::COMGETTER(ProxyAvailable) 355 STDMETHODIMP USBController::COMGETTER(ProxyAvailable)(BOOL *aEnabled) 356 356 { 357 357 CheckComArgOutPointerValid(aEnabled); … … 371 371 } 372 372 373 STDMETHODIMP USBController::COMGETTER(USBStandard) 373 STDMETHODIMP USBController::COMGETTER(USBStandard)(USHORT *aUSBStandard) 374 374 { 375 375 CheckComArgOutPointerValid(aUSBStandard); … … 399 399 DECLARE_PROTECT_FINAL_CONSTRUCT() 400 400 BEGIN_COM_MAP(USBDeviceFilter) 401 COM_INTERFACE_ENTRY(ISupportErrorInfo) 402 COM_INTERFACE_ENTRY(IUSBDeviceFilter) 401 VBOX_DEFAULT_INTERFACE_ENTRIES(IUSBDeviceFilter) 403 402 END_COM_MAP() 404 403 405 DECLARE_EMPTY_CTOR_DTOR 404 DECLARE_EMPTY_CTOR_DTOR(USBDeviceFilter) 406 405 407 406 // IUSBDeviceFilter properties 408 STDMETHOD(COMGETTER(Name)) 409 STDMETHOD(COMSETTER(Name)) 410 STDMETHOD(COMGETTER(Active)) 411 STDMETHOD(COMSETTER(Active)) 412 STDMETHOD(COMGETTER(VendorId)) 413 STDMETHOD(COMSETTER(VendorId)) 414 STDMETHOD(COMGETTER(ProductId)) 415 STDMETHOD(COMSETTER(ProductId)) 416 STDMETHOD(COMGETTER(Revision)) 417 STDMETHOD(COMSETTER(Revision)) 418 STDMETHOD(COMGETTER(Manufacturer)) 419 STDMETHOD(COMSETTER(Manufacturer)) 420 STDMETHOD(COMGETTER(Product)) 421 STDMETHOD(COMSETTER(Product)) 422 STDMETHOD(COMGETTER(SerialNumber)) 423 STDMETHOD(COMSETTER(SerialNumber)) 424 STDMETHOD(COMGETTER(Port)) 425 STDMETHOD(COMSETTER(Port)) 426 STDMETHOD(COMGETTER(Remote)) 427 STDMETHOD(COMSETTER(Remote)) 428 STDMETHOD(COMGETTER(MaskedInterfaces)) 429 STDMETHOD(COMSETTER(MaskedInterfaces)) 407 STDMETHOD(COMGETTER(Name))(BSTR *aName); 408 STDMETHOD(COMSETTER(Name))(IN_BSTR aName); 409 STDMETHOD(COMGETTER(Active))(BOOL *aActive); 410 STDMETHOD(COMSETTER(Active))(BOOL aActive); 411 STDMETHOD(COMGETTER(VendorId))(BSTR *aVendorId); 412 STDMETHOD(COMSETTER(VendorId))(IN_BSTR aVendorId); 413 STDMETHOD(COMGETTER(ProductId))(BSTR *aProductId); 414 STDMETHOD(COMSETTER(ProductId))(IN_BSTR aProductId); 415 STDMETHOD(COMGETTER(Revision))(BSTR *aRevision); 416 STDMETHOD(COMSETTER(Revision))(IN_BSTR aRevision); 417 STDMETHOD(COMGETTER(Manufacturer))(BSTR *aManufacturer); 418 STDMETHOD(COMSETTER(Manufacturer))(IN_BSTR aManufacturer); 419 STDMETHOD(COMGETTER(Product))(BSTR *aProduct); 420 STDMETHOD(COMSETTER(Product))(IN_BSTR aProduct); 421 STDMETHOD(COMGETTER(SerialNumber))(BSTR *aSerialNumber); 422 STDMETHOD(COMSETTER(SerialNumber))(IN_BSTR aSerialNumber); 423 STDMETHOD(COMGETTER(Port))(BSTR *aPort); 424 STDMETHOD(COMSETTER(Port))(IN_BSTR aPort); 425 STDMETHOD(COMGETTER(Remote))(BSTR *aRemote); 426 STDMETHOD(COMSETTER(Remote))(IN_BSTR aRemote); 427 STDMETHOD(COMGETTER(MaskedInterfaces))(ULONG *aMaskedIfs); 428 STDMETHOD(COMSETTER(MaskedInterfaces))(ULONG aMaskedIfs); 430 429 }; 431 430 #endif /* !VBOX_WITH_USB */ 432 431 433 432 434 STDMETHODIMP USBController::COMGETTER(DeviceFilters) 433 STDMETHODIMP USBController::COMGETTER(DeviceFilters)(ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters)) 435 434 { 436 435 #ifdef VBOX_WITH_USB … … 438 437 439 438 AutoCaller autoCaller(this); 440 if 439 if(FAILED(autoCaller.rc())) return autoCaller.rc(); 441 440 442 441 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 443 442 444 SafeIfaceArray<IUSBDeviceFilter> collection 443 SafeIfaceArray<IUSBDeviceFilter> collection(*m->llDeviceFilters.data()); 445 444 collection.detachTo(ComSafeArrayOutArg(aDevicesFilters)); 446 445 … … 458 457 ///////////////////////////////////////////////////////////////////////////// 459 458 460 STDMETHODIMP USBController::CreateDeviceFilter 461 459 STDMETHODIMP USBController::CreateDeviceFilter(IN_BSTR aName, 460 IUSBDeviceFilter **aFilter) 462 461 { 463 462 #ifdef VBOX_WITH_USB … … 477 476 ComObjPtr<USBDeviceFilter> filter; 478 477 filter.createObject(); 479 HRESULT rc = filter->init 480 ComAssertComRCRetRC 478 HRESULT rc = filter->init(this, aName); 479 ComAssertComRCRetRC(rc); 481 480 rc = filter.queryInterfaceTo(aFilter); 482 481 AssertComRCReturnRC(rc); … … 509 508 // @todo r=dj make sure the input object is actually from us 510 509 // if (!filter) 511 // return setError 512 // tr 510 // return setError(E_INVALIDARG, 511 // tr("The given USB device filter is not created within " 513 512 // "this VirtualBox instance")); 514 513 … … 525 524 { 526 525 it = m->llDeviceFilters->begin(); 527 std::advance 526 std::advance(it, aPosition); 528 527 } 529 528 else 530 529 it = m->llDeviceFilters->end(); 531 530 /* ...and insert */ 532 m->llDeviceFilters->insert 531 m->llDeviceFilters->insert(it, filter); 533 532 filter->mInList = true; 534 533 535 534 /* notify the proxy (only when it makes sense) */ 536 535 if (filter->getData().mActive && Global::IsOnline(adep.machineState()) 537 && filter->getData().mRemote.isMatch 536 && filter->getData().mRemote.isMatch(false)) 538 537 { 539 538 USBProxyService *service = m->pHost->usbProxyService(); … … 541 540 542 541 ComAssertRet(filter->getId() == NULL, E_FAIL); 543 filter->getId() = service->insertFilter 542 filter->getId() = service->insertFilter(&filter->getData().mUSBFilter); 544 543 } 545 544 … … 592 591 /* iterate to the position... */ 593 592 DeviceFilterList::iterator it = m->llDeviceFilters->begin(); 594 std::advance 593 std::advance(it, aPosition); 595 594 /* ...get an element from there... */ 596 595 filter = *it; 597 596 /* ...and remove */ 598 597 filter->mInList = false; 599 m->llDeviceFilters->erase 598 m->llDeviceFilters->erase(it); 600 599 } 601 600 … … 607 606 /* notify the proxy (only when it makes sense) */ 608 607 if (filter->getData().mActive && Global::IsOnline(adep.machineState()) 609 && filter->getData().mRemote.isMatch 608 && filter->getData().mRemote.isMatch(false)) 610 609 { 611 610 USBProxyService *service = m->pHost->usbProxyService(); … … 719 718 (*it)->COMGETTER(ProductId)(str.asOutParam()); 720 719 f.strProductId = str; 721 (*it)->COMGETTER (Revision)(str.asOutParam());720 (*it)->COMGETTER(Revision)(str.asOutParam()); 722 721 f.strRevision = str; 723 (*it)->COMGETTER (Manufacturer)(str.asOutParam());722 (*it)->COMGETTER(Manufacturer)(str.asOutParam()); 724 723 f.strManufacturer = str; 725 (*it)->COMGETTER (Product)(str.asOutParam());724 (*it)->COMGETTER(Product)(str.asOutParam()); 726 725 f.strProduct = str; 727 (*it)->COMGETTER (SerialNumber)(str.asOutParam());726 (*it)->COMGETTER(SerialNumber)(str.asOutParam()); 728 727 f.strSerialNumber = str; 729 (*it)->COMGETTER (Port)(str.asOutParam());728 (*it)->COMGETTER(Port)(str.asOutParam()); 730 729 f.strPort = str; 731 730 f.strRemote = filterData.mRemote.string(); … … 765 764 while (it != m->llDeviceFilters->end()) 766 765 { 767 if (std::find 766 if (std::find(backedList->begin(), backedList->end(), *it) == 768 767 backedList->end()) 769 768 { 770 769 /* notify the proxy (only when it makes sense) */ 771 770 if ((*it)->getData().mActive && 772 Global::IsOnline 773 && (*it)->getData().mRemote.isMatch 771 Global::IsOnline(adep.machineState()) 772 && (*it)->getData().mRemote.isMatch(false)) 774 773 { 775 774 USBDeviceFilter *filter = *it; … … 784 783 } 785 784 786 if (Global::IsOnline 785 if (Global::IsOnline(adep.machineState())) 787 786 { 788 787 /* find all removed old filters (absent in the new list) … … 791 790 while (it != backedList->end()) 792 791 { 793 if (std::find 792 if (std::find(m->llDeviceFilters->begin(), m->llDeviceFilters->end(), *it) == 794 793 m->llDeviceFilters->end()) 795 794 { 796 795 /* notify the proxy (only when necessary) */ 797 796 if ((*it)->getData().mActive 798 && (*it)->getData().mRemote.isMatch 797 && (*it)->getData().mRemote.isMatch(false)) 799 798 { 800 799 USBDeviceFilter *flt = *it; /* resolve ambiguity */ … … 838 837 /* sanity */ 839 838 AutoCaller autoCaller(this); 840 AssertComRCReturnVoid 839 AssertComRCReturnVoid(autoCaller.rc()); 841 840 842 841 /* sanity too */ 843 842 AutoCaller peerCaller(m->pPeer); 844 AssertComRCReturnVoid 843 AssertComRCReturnVoid(peerCaller.rc()); 845 844 846 845 /* lock both for writing since we modify both (mPeer is "master" so locked … … 894 893 } 895 894 /* and add it to the new list */ 896 newList->push_back 895 newList->push_back(peer); 897 896 898 897 ++ it; … … 940 939 * represented by @a aThat (locked for reading). 941 940 */ 942 void USBController::copyFrom 943 { 944 AssertReturnVoid 941 void USBController::copyFrom(USBController *aThat) 942 { 943 AssertReturnVoid(aThat != NULL); 945 944 946 945 /* sanity */ 947 946 AutoCaller autoCaller(this); 948 AssertComRCReturnVoid 947 AssertComRCReturnVoid(autoCaller.rc()); 949 948 950 949 /* sanity too */ 951 AutoCaller thatCaller 952 AssertComRCReturnVoid 950 AutoCaller thatCaller(aThat); 951 AssertComRCReturnVoid(thatCaller.rc()); 953 952 954 953 /* even more sanity */ 955 954 AutoAnyStateDependency adep(m->pParent); 956 AssertComRCReturnVoid 955 AssertComRCReturnVoid(adep.rc()); 957 956 /* Machine::copyFrom() may not be called when the VM is running */ 958 AssertReturnVoid (!Global::IsOnline(adep.machineState()));957 AssertReturnVoid(!Global::IsOnline(adep.machineState())); 959 958 960 959 /* peer is not modified, lock it for reading (aThat is "master" so locked … … 980 979 ComObjPtr<USBDeviceFilter> filter; 981 980 filter.createObject(); 982 filter->initCopy 983 m->llDeviceFilters->push_back 981 filter->initCopy(this, *it); 982 m->llDeviceFilters->push_back(filter); 984 983 } 985 984 … … 994 993 * @note Locks nothing. 995 994 */ 996 HRESULT USBController::onDeviceFilterChange 997 995 HRESULT USBController::onDeviceFilterChange(USBDeviceFilter *aFilter, 996 BOOL aActiveChanged /* = FALSE */) 998 997 { 999 998 AutoCaller autoCaller(this); … … 1005 1004 1006 1005 /* nothing to do if the machine isn't running */ 1007 if (!Global::IsOnline 1006 if (!Global::IsOnline(adep.machineState())) 1008 1007 return S_OK; 1009 1008 … … 1018 1017 if (aActiveChanged) 1019 1018 { 1020 if (aFilter->getData().mRemote.isMatch 1019 if (aFilter->getData().mRemote.isMatch(false)) 1021 1020 { 1022 1021 /* insert/remove the filter from the proxy */ … … 1041 1040 ComAssertRet(aFilter->getId() != NULL, E_FAIL); 1042 1041 service->removeFilter(aFilter->getId()); 1043 if (aFilter->getData().mRemote.isMatch 1042 if (aFilter->getData().mRemote.isMatch(false)) 1044 1043 { 1045 1044 aFilter->getId() = service->insertFilter(&aFilter->getData().mUSBFilter); … … 1060 1059 * @note Locks this object for reading. 1061 1060 */ 1062 bool USBController::hasMatchingFilter 1063 { 1064 AutoCaller autoCaller(this); 1065 AssertComRCReturn 1061 bool USBController::hasMatchingFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs) 1062 { 1063 AutoCaller autoCaller(this); 1064 AssertComRCReturn(autoCaller.rc(), false); 1066 1065 1067 1066 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1099 1098 * @note Locks this object for reading. 1100 1099 */ 1101 bool USBController::hasMatchingFilter 1100 bool USBController::hasMatchingFilter(IUSBDevice *aUSBDevice, ULONG *aMaskedIfs) 1102 1101 { 1103 1102 LogFlowThisFuncEnter(); 1104 1103 1105 1104 AutoCaller autoCaller(this); 1106 AssertComRCReturn 1105 AssertComRCReturn(autoCaller.rc(), false); 1107 1106 1108 1107 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1116 1115 /* query fields */ 1117 1116 USBFILTER dev; 1118 USBFilterInit 1117 USBFilterInit(&dev, USBFILTERTYPE_CAPTURE); 1119 1118 1120 1119 USHORT vendorId = 0; 1121 rc = aUSBDevice->COMGETTER(VendorId) 1120 rc = aUSBDevice->COMGETTER(VendorId)(&vendorId); 1122 1121 ComAssertComRCRet(rc, false); 1123 1122 ComAssertRet(vendorId, false); 1124 int vrc = USBFilterSetNumExact 1123 int vrc = USBFilterSetNumExact(&dev, USBFILTERIDX_VENDOR_ID, vendorId, true); AssertRC(vrc); 1125 1124 1126 1125 USHORT productId = 0; 1127 rc = aUSBDevice->COMGETTER(ProductId) 1126 rc = aUSBDevice->COMGETTER(ProductId)(&productId); 1128 1127 ComAssertComRCRet(rc, false); 1129 vrc = USBFilterSetNumExact 1128 vrc = USBFilterSetNumExact(&dev, USBFILTERIDX_PRODUCT_ID, productId, true); AssertRC(vrc); 1130 1129 1131 1130 USHORT revision; 1132 rc = aUSBDevice->COMGETTER(Revision) 1131 rc = aUSBDevice->COMGETTER(Revision)(&revision); 1133 1132 ComAssertComRCRet(rc, false); 1134 vrc = USBFilterSetNumExact 1133 vrc = USBFilterSetNumExact(&dev, USBFILTERIDX_DEVICE, revision, true); AssertRC(vrc); 1135 1134 1136 1135 Bstr manufacturer; 1137 rc = aUSBDevice->COMGETTER(Manufacturer) 1136 rc = aUSBDevice->COMGETTER(Manufacturer)(manufacturer.asOutParam()); 1138 1137 ComAssertComRCRet(rc, false); 1139 1138 if (!manufacturer.isEmpty()) 1140 USBFilterSetStringExact 1139 USBFilterSetStringExact(&dev, USBFILTERIDX_MANUFACTURER_STR, Utf8Str(manufacturer).c_str(), true); 1141 1140 1142 1141 Bstr product; 1143 rc = aUSBDevice->COMGETTER(Product) 1142 rc = aUSBDevice->COMGETTER(Product)(product.asOutParam()); 1144 1143 ComAssertComRCRet(rc, false); 1145 1144 if (!product.isEmpty()) 1146 USBFilterSetStringExact 1145 USBFilterSetStringExact(&dev, USBFILTERIDX_PRODUCT_STR, Utf8Str(product).c_str(), true); 1147 1146 1148 1147 Bstr serialNumber; 1149 rc = aUSBDevice->COMGETTER(SerialNumber) 1148 rc = aUSBDevice->COMGETTER(SerialNumber)(serialNumber.asOutParam()); 1150 1149 ComAssertComRCRet(rc, false); 1151 1150 if (!serialNumber.isEmpty()) 1152 USBFilterSetStringExact 1151 USBFilterSetStringExact(&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber).c_str(), true); 1153 1152 1154 1153 Bstr address; 1155 rc = aUSBDevice->COMGETTER(Address) 1154 rc = aUSBDevice->COMGETTER(Address)(address.asOutParam()); 1156 1155 ComAssertComRCRet(rc, false); 1157 1156 … … 1159 1158 rc = aUSBDevice->COMGETTER(Port)(&port); 1160 1159 ComAssertComRCRet(rc, false); 1161 USBFilterSetNumExact 1160 USBFilterSetNumExact(&dev, USBFILTERIDX_PORT, port, true); 1162 1161 1163 1162 BOOL remote = FALSE; … … 1178 1177 if (!aData.mActive) 1179 1178 continue; 1180 if (!aData.mRemote.isMatch 1179 if (!aData.mRemote.isMatch(remote)) 1181 1180 continue; 1182 if (!USBFilterMatch 1181 if (!USBFilterMatch(&aData.mUSBFilter, &dev)) 1183 1182 continue; 1184 1183 … … 1202 1201 * @note Locks this object for reading. 1203 1202 */ 1204 HRESULT USBController::notifyProxy 1203 HRESULT USBController::notifyProxy(bool aInsertFilters) 1205 1204 { 1206 1205 LogFlowThisFunc(("aInsertFilters=%RTbool\n", aInsertFilters)); 1207 1206 1208 1207 AutoCaller autoCaller(this); 1209 AssertComRCReturn 1208 AssertComRCReturn(autoCaller.rc(), false); 1210 1209 1211 1210 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1221 1220 /* notify the proxy (only if the filter is active) */ 1222 1221 if (flt->getData().mActive 1223 && flt->getData().mRemote.isMatch 1222 && flt->getData().mRemote.isMatch(false) /* and if the filter is NOT remote */ 1224 1223 ) 1225 1224 {
Note:
See TracChangeset
for help on using the changeset viewer.