Changeset 52232 in vbox
- Timestamp:
- Jul 29, 2014 8:43:59 PM (10 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r51903 r52232 833 833 src-client/xpcom/module.cpp 834 834 endif 835 VBoxClient-x86_LIBS = $(NO_SUCH_VARIABLE) 835 VBoxClient-x86_LIBS = \ 836 $(PATH_STAGE_LIB)/VBoxAPIWrap-x86$(VBOX_SUFF_LIB) 836 837 VBoxClient-x86_LIBS.win = $(NO_SUCH_VARIABLE) 837 838 VBoxClient-x86_CLEAN.win += $(VBoxClient-x86_0_OUTDIR)/VBoxClient-x86.rgs -
trunk/src/VBox/Main/include/SessionImpl.h
r51476 r52232 18 18 #define ____H_SESSIONIMPL 19 19 20 #include " VirtualBoxBase.h"20 #include "SessionWrap.h" 21 21 #include "ConsoleImpl.h" 22 22 … … 29 29 #endif 30 30 class ATL_NO_VTABLE Session : 31 public VirtualBoxBase, 32 VBOX_SCRIPTABLE_IMPL(ISession), 33 VBOX_SCRIPTABLE_IMPL(IInternalSessionControl) 31 public SessionWrap 34 32 #ifdef RT_OS_WINDOWS 35 33 , public CComCoClass<Session, &CLSID_Session> … … 38 36 public: 39 37 40 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(Session, ISession)41 42 38 DECLARE_CLASSFACTORY() 43 39 44 40 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX) 41 45 42 DECLARE_NOT_AGGREGATABLE(Session) 46 43 47 DECLARE_PROTECT_FINAL_CONSTRUCT() 48 49 BEGIN_COM_MAP(Session) 50 VBOX_DEFAULT_INTERFACE_ENTRIES(ISession) 51 COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl) 52 COM_INTERFACE_ENTRY(IInternalSessionControl) 53 END_COM_MAP() 44 DECLARE_EMPTY_CTOR_DTOR(Session) 54 45 55 46 HRESULT FinalConstruct(); … … 60 51 void uninit(); 61 52 62 // ISession properties63 STDMETHOD(COMGETTER(State))(SessionState_T *aState);64 STDMETHOD(COMGETTER(Type))(SessionType_T *aType);65 STDMETHOD(COMGETTER(Machine))(IMachine **aMachine);66 STDMETHOD(COMGETTER(Console))(IConsole **aConsole);67 68 // ISession methods69 STDMETHOD(UnlockMachine)();70 71 // IInternalSessionControl methods72 STDMETHOD(GetPID)(ULONG *aPid);73 STDMETHOD(GetRemoteConsole)(IConsole **aConsole);74 53 #ifndef VBOX_WITH_GENERIC_SESSION_WATCHER 75 54 STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IN_BSTR aTokenId); … … 77 56 STDMETHOD(AssignMachine)(IMachine *aMachine, LockType_T aLockType, IToken *aToken); 78 57 #endif /* VBOX_WITH_GENERIC_SESSION_WATCHER */ 79 STDMETHOD(AssignRemoteMachine)(IMachine *aMachine, IConsole *aConsole);80 STDMETHOD(UpdateMachineState)(MachineState_T aMachineState);81 STDMETHOD(Uninitialize)();82 STDMETHOD(OnNetworkAdapterChange)(INetworkAdapter *networkAdapter, BOOL changeAdapter);83 STDMETHOD(OnSerialPortChange)(ISerialPort *serialPort);84 STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);85 STDMETHOD(OnStorageControllerChange)();86 STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);87 STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove);88 STDMETHOD(OnCPUExecutionCapChange)(ULONG aExecutionCap);89 STDMETHOD(OnVRDEServerChange)(BOOL aRestart);90 STDMETHOD(OnVideoCaptureChange)();91 STDMETHOD(OnUSBControllerChange)();92 STDMETHOD(OnSharedFolderChange)(BOOL aGlobal);93 STDMETHOD(OnClipboardModeChange)(ClipboardMode_T aClipboardMode);94 STDMETHOD(OnDnDModeChange)(DnDMode_T aDnDMode);95 STDMETHOD(OnUSBDeviceAttach)(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);96 STDMETHOD(OnUSBDeviceDetach)(IN_BSTR aId, IVirtualBoxErrorInfo *aError);97 STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);98 STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup);99 STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);100 STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,101 BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags);102 STDMETHOD(EnumerateGuestProperties)(IN_BSTR aPatterns,103 ComSafeArrayOut(BSTR, aNames),104 ComSafeArrayOut(BSTR, aValues),105 ComSafeArrayOut(LONG64, aTimestamps),106 ComSafeArrayOut(BSTR, aFlags));107 STDMETHOD(OnlineMergeMedium)(IMediumAttachment *aMediumAttachment,108 ULONG aSourceIdx, ULONG aTargetIdx,109 IProgress *aProgress);110 STDMETHOD(EnableVMMStatistics)(BOOL aEnable);111 STDMETHOD(PauseWithReason)(Reason_T aReason);112 STDMETHOD(ResumeWithReason)(Reason_T aReason);113 STDMETHOD(SaveStateWithReason)(Reason_T aReason, IProgress **aProgress);114 58 115 59 private: 116 60 61 // Wrapped Isession properties 62 HRESULT getState(SessionState_T *aState); 63 HRESULT getType(SessionType_T *aType); 64 HRESULT getMachine(ComPtr<IMachine> &aMachine); 65 HRESULT getConsole(ComPtr<IConsole> &aConsole); 66 67 // Wrapped Isession methods 68 HRESULT unlockMachine(); 69 HRESULT getPID(ULONG *aPid); 70 HRESULT getRemoteConsole(ComPtr<IConsole> &aConsole); 71 HRESULT assignRemoteMachine(const ComPtr<IMachine> &aMachine, 72 const ComPtr<IConsole> &aConsole); 73 HRESULT updateMachineState(MachineState_T aMachineState); 74 HRESULT uninitialize(); 75 HRESULT onNetworkAdapterChange(const ComPtr<INetworkAdapter> &aNetworkAdapter, 76 BOOL aChangeAdapter); 77 HRESULT onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort); 78 HRESULT onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort); 79 HRESULT onStorageControllerChange(); 80 HRESULT onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment, 81 BOOL aForce); 82 HRESULT onStorageDeviceChange(const ComPtr<IMediumAttachment> &aMediumAttachment, 83 BOOL aRemove, 84 BOOL aSilent); 85 HRESULT onClipboardModeChange(ClipboardMode_T aClipboardMode); 86 HRESULT onDnDModeChange(DnDMode_T aDndMode); 87 HRESULT onCPUChange(ULONG aCpu, 88 BOOL aAdd); 89 HRESULT onCPUExecutionCapChange(ULONG aExecutionCap); 90 HRESULT onVRDEServerChange(BOOL aRestart); 91 HRESULT onVideoCaptureChange(); 92 HRESULT onUSBControllerChange(); 93 HRESULT onSharedFolderChange(BOOL aGlobal); 94 HRESULT onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice, 95 const ComPtr<IVirtualBoxErrorInfo> &aError, 96 ULONG aMaskedInterfaces); 97 HRESULT onUSBDeviceDetach(const com::Guid &aId, 98 const ComPtr<IVirtualBoxErrorInfo> &aError); 99 HRESULT onShowWindow(BOOL aCheck, 100 BOOL *aCanShow, 101 LONG64 *aWinId); 102 HRESULT onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup); 103 HRESULT accessGuestProperty(const com::Utf8Str &aName, 104 const com::Utf8Str &aValue, 105 const com::Utf8Str &aFlags, 106 BOOL aIsSetter, 107 com::Utf8Str &aRetValue, 108 LONG64 *aRetTimestamp, 109 com::Utf8Str &aRetFlags); 110 HRESULT enumerateGuestProperties(const com::Utf8Str &aPatterns, 111 std::vector<com::Utf8Str> &aKeys, 112 std::vector<com::Utf8Str> &aValues, 113 std::vector<LONG64> &aTimestamps, 114 std::vector<com::Utf8Str> &aFlags); 115 HRESULT onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment, 116 ULONG aSourceIdx, 117 ULONG aTargetIdx, 118 const ComPtr<IProgress> &aProgress); 119 HRESULT enableVMMStatistics(BOOL aEnable); 120 HRESULT pauseWithReason(Reason_T aReason); 121 HRESULT resumeWithReason(Reason_T aReason); 122 HRESULT saveStateWithReason(Reason_T aReason, 123 ComPtr<IProgress> &aProgress); 117 124 HRESULT unlockMachine(bool aFinalRelease, bool aFromServer); 118 125 -
trunk/src/VBox/Main/src-client/SessionImpl.cpp
r51903 r52232 35 35 do { \ 36 36 if (mState != SessionState_Locked) \ 37 return setError(E_UNEXPECTED, tr ("The session is not locked (session state: %s)"), Global::stringifySessionState(mState)); \ 37 return setError(E_UNEXPECTED, tr ("The session is not locked (session state: %s)"), \ 38 Global::stringifySessionState(mState)); \ 38 39 } while (0) 39 40 40 41 // constructor / destructor 41 42 ///////////////////////////////////////////////////////////////////////////// 43 44 Session::Session() 45 { 46 } 47 48 Session::~Session() 49 { 50 } 42 51 43 52 HRESULT Session::FinalConstruct() … … 124 133 ///////////////////////////////////////////////////////////////////////////// 125 134 126 STDMETHODIMP Session::COMGETTER(State)(SessionState_T *aState) 127 { 128 CheckComArgOutPointerValid(aState); 129 130 AutoCaller autoCaller(this); 131 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 132 135 HRESULT Session::getState(SessionState_T *aState) 136 { 133 137 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 134 138 … … 138 142 } 139 143 140 STDMETHODIMP Session::COMGETTER(Type)(SessionType_T *aType) 141 { 142 CheckComArgOutPointerValid(aType); 143 144 AutoCaller autoCaller(this); 145 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 146 144 HRESULT Session::getType(SessionType_T *aType) 145 { 147 146 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 148 147 … … 153 152 } 154 153 155 STDMETHODIMP Session::COMGETTER(Machine)(IMachine **aMachine) 156 { 157 CheckComArgOutPointerValid(aMachine); 158 159 AutoCaller autoCaller(this); 160 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 161 154 HRESULT Session::getMachine(ComPtr<IMachine> &aMachine) 155 { 162 156 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 163 157 … … 167 161 #ifndef VBOX_COM_INPROC_API_CLIENT 168 162 if (mConsole) 169 rc = mConsole->i_machine().queryInterfaceTo(aMachine);163 rc = mConsole->i_machine().queryInterfaceTo(aMachine.asOutParam()); 170 164 else 171 165 #endif 172 rc = mRemoteMachine.queryInterfaceTo(aMachine);166 rc = mRemoteMachine.queryInterfaceTo(aMachine.asOutParam()); 173 167 if (FAILED(rc)) 174 168 { … … 188 182 } 189 183 190 STDMETHODIMP Session::COMGETTER(Console)(IConsole **aConsole) 191 { 192 CheckComArgOutPointerValid(aConsole); 193 194 AutoCaller autoCaller(this); 195 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 196 184 HRESULT Session::getConsole(ComPtr<IConsole> &aConsole) 185 { 197 186 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 198 187 199 188 CHECK_OPEN(); 200 189 201 HRESULT rc ;190 HRESULT rc = S_OK; 202 191 #ifndef VBOX_COM_INPROC_API_CLIENT 203 192 if (mConsole) 204 rc = mConsole.queryInterfaceTo(aConsole );193 rc = mConsole.queryInterfaceTo(aConsole.asOutParam()); 205 194 else 206 195 #endif 207 rc = mRemoteConsole.queryInterfaceTo(aConsole );196 rc = mRemoteConsole.queryInterfaceTo(aConsole.asOutParam()); 208 197 209 198 if (FAILED(rc)) … … 226 215 // ISession methods 227 216 ///////////////////////////////////////////////////////////////////////////// 228 229 STDMETHODIMP Session::UnlockMachine() 217 HRESULT Session::unlockMachine() 230 218 { 231 219 LogFlowThisFunc(("mState=%d, mType=%d\n", mState, mType)); 232 233 AutoCaller autoCaller(this);234 if (FAILED(autoCaller.rc())) return autoCaller.rc();235 220 236 221 /* close() needs write lock */ … … 244 229 // IInternalSessionControl methods 245 230 ///////////////////////////////////////////////////////////////////////////// 246 247 STDMETHODIMP Session::GetPID(ULONG *aPid) 248 { 249 AssertReturn(aPid, E_POINTER); 250 251 AutoCaller autoCaller(this); 252 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 253 231 HRESULT Session::getPID(ULONG *aPid) 232 { 254 233 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 255 234 … … 260 239 } 261 240 262 STDMETHODIMP Session::GetRemoteConsole(IConsole **aConsole)241 HRESULT Session::getRemoteConsole(ComPtr<IConsole> &aConsole) 263 242 { 264 243 LogFlowThisFuncEnter(); 265 AssertReturn(aConsole, E_POINTER);266 267 AutoCaller autoCaller(this);268 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());269 244 270 245 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 280 255 return VBOX_E_INVALID_VM_STATE; 281 256 282 mConsole.queryInterfaceTo(aConsole );257 mConsole.queryInterfaceTo(aConsole.asOutParam()); 283 258 284 259 LogFlowThisFuncLeave(); … … 398 373 } 399 374 400 STDMETHODIMP Session::AssignRemoteMachine(IMachine *aMachine, IConsole *aConsole) 401 { 402 LogFlowThisFuncEnter(); 403 LogFlowThisFunc(("aMachine=%p, aConsole=%p\n", aMachine, aConsole)); 404 375 HRESULT Session::assignRemoteMachine(const ComPtr<IMachine> &aMachine, 376 const ComPtr<IConsole> &aConsole) 377 378 { 405 379 AssertReturn(aMachine && aConsole, E_INVALIDARG); 406 380 407 AutoCaller autoCaller(this);408 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());409 410 381 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 411 382 412 383 AssertReturn(mState == SessionState_Unlocked || 413 384 mState == SessionState_Spawning, VBOX_E_INVALID_VM_STATE); 414 385 415 386 HRESULT rc = E_FAIL; … … 471 442 } 472 443 473 STDMETHODIMP Session::UpdateMachineState(MachineState_T aMachineState) 474 { 475 AutoCaller autoCaller(this); 444 HRESULT Session::updateMachineState(MachineState_T aMachineState) 445 { 476 446 477 447 if (getObjectState().getState() != ObjectState::Ready) … … 506 476 } 507 477 508 STDMETHODIMP Session::Uninitialize()478 HRESULT Session::uninitialize() 509 479 { 510 480 LogFlowThisFuncEnter(); … … 556 526 } 557 527 558 STDMETHODIMP Session::OnNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter) 559 { 560 LogFlowThisFunc(("\n")); 561 562 AutoCaller autoCaller(this); 563 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 564 565 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 566 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 567 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 568 #ifndef VBOX_COM_INPROC_API_CLIENT 569 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 570 571 return mConsole->i_onNetworkAdapterChange(networkAdapter, changeAdapter); 572 #else 573 return S_OK; 574 #endif 575 } 576 577 STDMETHODIMP Session::OnSerialPortChange(ISerialPort *serialPort) 578 { 579 LogFlowThisFunc(("\n")); 580 581 AutoCaller autoCaller(this); 582 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 583 584 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 585 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 586 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 587 #ifndef VBOX_COM_INPROC_API_CLIENT 588 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 589 590 return mConsole->i_onSerialPortChange(serialPort); 591 #else 592 return S_OK; 593 #endif 594 } 595 596 STDMETHODIMP Session::OnParallelPortChange(IParallelPort *parallelPort) 597 { 598 LogFlowThisFunc(("\n")); 599 600 AutoCaller autoCaller(this); 601 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 602 603 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 604 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 605 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 606 #ifndef VBOX_COM_INPROC_API_CLIENT 607 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 608 609 return mConsole->i_onParallelPortChange(parallelPort); 610 #else 611 return S_OK; 612 #endif 613 } 614 615 STDMETHODIMP Session::OnStorageControllerChange() 616 { 617 LogFlowThisFunc(("\n")); 618 619 AutoCaller autoCaller(this); 620 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 528 HRESULT Session::onNetworkAdapterChange(const ComPtr<INetworkAdapter> &aNetworkAdapter, 529 BOOL aChangeAdapter) 530 531 { 532 LogFlowThisFunc(("\n")); 533 534 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 535 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 536 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 537 #ifndef VBOX_COM_INPROC_API_CLIENT 538 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 539 540 return mConsole->i_onNetworkAdapterChange(aNetworkAdapter, aChangeAdapter); 541 #else 542 return S_OK; 543 #endif 544 } 545 546 HRESULT Session::onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort) 547 { 548 LogFlowThisFunc(("\n")); 549 550 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 551 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 552 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 553 #ifndef VBOX_COM_INPROC_API_CLIENT 554 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 555 556 return mConsole->i_onSerialPortChange(aSerialPort); 557 #else 558 return S_OK; 559 #endif 560 } 561 562 HRESULT Session::onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort) 563 { 564 LogFlowThisFunc(("\n")); 565 566 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 567 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 568 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 569 #ifndef VBOX_COM_INPROC_API_CLIENT 570 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 571 572 return mConsole->i_onParallelPortChange(aParallelPort); 573 #else 574 return S_OK; 575 #endif 576 } 577 578 HRESULT Session::onStorageControllerChange() 579 { 580 LogFlowThisFunc(("\n")); 621 581 622 582 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 632 592 } 633 593 634 STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce) 635 { 636 LogFlowThisFunc(("\n")); 637 638 AutoCaller autoCaller(this); 639 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 594 HRESULT Session::onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment, 595 BOOL aForce) 596 { 597 LogFlowThisFunc(("\n")); 640 598 641 599 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 651 609 } 652 610 653 STDMETHODIMP Session::OnCPUChange(ULONG aCPU, BOOL aRemove) 654 { 655 LogFlowThisFunc(("\n")); 656 657 AutoCaller autoCaller(this); 658 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 659 660 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 661 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 662 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 663 #ifndef VBOX_COM_INPROC_API_CLIENT 664 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 665 666 return mConsole->i_onCPUChange(aCPU, aRemove); 667 #else 668 return S_OK; 669 #endif 670 } 671 672 STDMETHODIMP Session::OnCPUExecutionCapChange(ULONG aExecutionCap) 673 { 674 LogFlowThisFunc(("\n")); 675 676 AutoCaller autoCaller(this); 677 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 611 HRESULT Session::onCPUChange(ULONG aCpu, BOOL aAdd) 612 { 613 LogFlowThisFunc(("\n")); 614 615 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 616 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 617 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 618 #ifndef VBOX_COM_INPROC_API_CLIENT 619 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 620 621 return mConsole->i_onCPUChange(aCpu, aAdd); 622 #else 623 return S_OK; 624 #endif 625 } 626 627 HRESULT Session::onCPUExecutionCapChange(ULONG aExecutionCap) 628 { 629 LogFlowThisFunc(("\n")); 678 630 679 631 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 689 641 } 690 642 691 STDMETHODIMP Session::OnVRDEServerChange(BOOL aRestart) 692 { 693 LogFlowThisFunc(("\n")); 694 695 AutoCaller autoCaller(this); 696 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 643 HRESULT Session::onVRDEServerChange(BOOL aRestart) 644 { 645 LogFlowThisFunc(("\n")); 697 646 698 647 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 708 657 } 709 658 710 STDMETHODIMP Session::OnVideoCaptureChange() 711 { 712 LogFlowThisFunc(("\n")); 713 714 AutoCaller autoCaller(this); 715 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 659 HRESULT Session::onVideoCaptureChange() 660 { 661 LogFlowThisFunc(("\n")); 716 662 717 663 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 727 673 } 728 674 729 STDMETHODIMP Session::OnUSBControllerChange() 730 { 731 LogFlowThisFunc(("\n")); 732 733 AutoCaller autoCaller(this); 734 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 675 HRESULT Session::onUSBControllerChange() 676 { 677 LogFlowThisFunc(("\n")); 735 678 736 679 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 746 689 } 747 690 748 STDMETHODIMP Session::OnSharedFolderChange(BOOL aGlobal) 749 { 750 LogFlowThisFunc(("\n")); 751 752 AutoCaller autoCaller(this); 753 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 691 HRESULT Session::onSharedFolderChange(BOOL aGlobal) 692 { 693 LogFlowThisFunc(("\n")); 754 694 755 695 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 765 705 } 766 706 767 STDMETHODIMP Session::OnClipboardModeChange(ClipboardMode_T aClipboardMode) 768 { 769 LogFlowThisFunc(("\n")); 770 771 AutoCaller autoCaller(this); 772 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 707 HRESULT Session::onClipboardModeChange(ClipboardMode_T aClipboardMode) 708 { 709 LogFlowThisFunc(("\n")); 773 710 774 711 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 784 721 } 785 722 786 STDMETHODIMP Session::OnDnDModeChange(DnDMode_T aDragAndDropMode) 787 { 788 LogFlowThisFunc(("\n")); 789 790 AutoCaller autoCaller(this); 791 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 792 793 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 794 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 795 #ifndef VBOX_COM_INPROC_API_CLIENT 796 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 797 798 return mConsole->i_onDnDModeChange(aDragAndDropMode); 799 #else 800 return S_OK; 801 #endif 802 } 803 804 STDMETHODIMP Session::OnUSBDeviceAttach(IUSBDevice *aDevice, 805 IVirtualBoxErrorInfo *aError, 806 ULONG aMaskedIfs) 807 { 808 LogFlowThisFunc(("\n")); 809 810 AutoCaller autoCaller(this); 811 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 812 813 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 814 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 815 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 816 #ifndef VBOX_COM_INPROC_API_CLIENT 817 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 818 819 return mConsole->i_onUSBDeviceAttach(aDevice, aError, aMaskedIfs); 820 #else 821 return S_OK; 822 #endif 823 } 824 825 STDMETHODIMP Session::OnUSBDeviceDetach(IN_BSTR aId, 826 IVirtualBoxErrorInfo *aError) 827 { 828 LogFlowThisFunc(("\n")); 829 830 AutoCaller autoCaller(this); 831 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 832 833 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 834 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 835 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 836 #ifndef VBOX_COM_INPROC_API_CLIENT 837 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 838 839 return mConsole->i_onUSBDeviceDetach(aId, aError); 840 #else 841 return S_OK; 842 #endif 843 } 844 845 STDMETHODIMP Session::OnShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) 846 { 847 AutoCaller autoCaller(this); 848 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 849 723 HRESULT Session::onDnDModeChange(DnDMode_T aDndMode) 724 { 725 LogFlowThisFunc(("\n")); 726 727 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 728 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 729 #ifndef VBOX_COM_INPROC_API_CLIENT 730 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 731 732 return mConsole->i_onDnDModeChange(aDndMode); 733 #else 734 return S_OK; 735 #endif 736 } 737 738 HRESULT Session::onUSBDeviceAttach(const ComPtr<IUSBDevice> &aDevice, 739 const ComPtr<IVirtualBoxErrorInfo> &aError, 740 ULONG aMaskedInterfaces) 741 { 742 LogFlowThisFunc(("\n")); 743 744 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 745 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 746 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 747 #ifndef VBOX_COM_INPROC_API_CLIENT 748 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 749 750 return mConsole->i_onUSBDeviceAttach(aDevice, aError, aMaskedInterfaces); 751 #else 752 return S_OK; 753 #endif 754 } 755 756 HRESULT Session::onUSBDeviceDetach(const com::Guid &aId, 757 const ComPtr<IVirtualBoxErrorInfo> &aError) 758 { 759 LogFlowThisFunc(("\n")); 760 761 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 762 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 763 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 764 #ifndef VBOX_COM_INPROC_API_CLIENT 765 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 766 767 return mConsole->i_onUSBDeviceDetach(aId.toUtf16().raw(), aError); 768 #else 769 return S_OK; 770 #endif 771 } 772 773 HRESULT Session::onShowWindow(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId) 774 { 850 775 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 851 776 … … 873 798 } 874 799 875 STDMETHODIMP Session::OnBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) 876 { 877 LogFlowThisFunc(("\n")); 878 879 AutoCaller autoCaller(this); 880 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 800 HRESULT Session::onBandwidthGroupChange(const ComPtr<IBandwidthGroup> &aBandwidthGroup) 801 { 802 LogFlowThisFunc(("\n")); 881 803 882 804 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 892 814 } 893 815 894 STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent) 895 { 896 LogFlowThisFunc(("\n")); 897 898 AutoCaller autoCaller(this); 899 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 816 HRESULT Session::onStorageDeviceChange(const ComPtr<IMediumAttachment> &aMediumAttachment, BOOL aRemove, BOOL aSilent) 817 { 818 LogFlowThisFunc(("\n")); 900 819 901 820 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); … … 911 830 } 912 831 913 STDMETHODIMP Session::AccessGuestProperty(IN_BSTR aName, IN_BSTR aValue, IN_BSTRaFlags,914 BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags)832 HRESULT Session::accessGuestProperty(const com::Utf8Str &aName, const com::Utf8Str &aValue, const com::Utf8Str &aFlags, 833 BOOL aIsSetter, com::Utf8Str &aRetValue, LONG64 *aRetTimestamp, com::Utf8Str &aRetFlags) 915 834 { 916 835 #ifdef VBOX_WITH_GUEST_PROPS 917 836 # ifndef VBOX_COM_INPROC_API_CLIENT 918 AutoCaller autoCaller(this);919 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());920 921 837 if (mState != SessionState_Locked) 922 838 return setError(VBOX_E_INVALID_VM_STATE, … … 924 840 Global::stringifySessionState(mState)); 925 841 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 926 CheckComArgStrNotEmptyOrNull(aName); 927 if (!aIsSetter && !VALID_PTR(aRetValue)) 928 return E_POINTER; 842 if (aName.isEmpty()) 843 return E_INVALIDARG; 929 844 if (!aIsSetter && !VALID_PTR(aRetTimestamp)) 930 845 return E_POINTER; 931 if (!aIsSetter && !VALID_PTR(aRetFlags))932 return E_POINTER;933 /* aValue can be NULL for a setter call if the property is to be deleted. */934 if (aIsSetter && (aValue != NULL) && !VALID_PTR(aValue))935 return setError(E_INVALIDARG, tr("Invalid value pointer"));936 /* aFlags can be null if it is to be left as is */937 if (aIsSetter && (aFlags != NULL) && !VALID_PTR(aFlags))938 return setError(E_INVALIDARG, tr("Invalid flags pointer"));939 846 940 847 /* If this session is not in a VM process fend off the call. The caller … … 944 851 945 852 if (!aIsSetter) 946 return mConsole->i_getGuestProperty(aName, aRetValue, aRetTimestamp, aRetFlags); 853 { 854 Bstr bstrRetValue; 855 Bstr bstrRetFlags; 856 HRESULT hr = mConsole->i_getGuestProperty(Bstr(aName).raw(), 857 bstrRetValue.asOutParam(), aRetTimestamp, bstrRetFlags.asOutParam()); 858 if (SUCCEEDED(hr)) 859 { 860 aRetValue = bstrRetValue; 861 aRetFlags = bstrRetFlags; 862 } 863 return hr; 864 } 947 865 else 948 return mConsole->i_setGuestProperty( aName, aValue, aFlags);866 return mConsole->i_setGuestProperty(Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw()); 949 867 950 868 # else /* VBOX_COM_INPROC_API_CLIENT */ … … 960 878 } 961 879 962 STDMETHODIMP Session::EnumerateGuestProperties(IN_BSTRaPatterns,963 ComSafeArrayOut(BSTR, aNames),964 ComSafeArrayOut(BSTR, aValues),965 ComSafeArrayOut(LONG64, aTimestamps),966 ComSafeArrayOut(BSTR, aFlags))880 HRESULT Session::enumerateGuestProperties(const com::Utf8Str &aPatterns, 881 std::vector<com::Utf8Str> &aKeys, 882 std::vector<com::Utf8Str> &aValues, 883 std::vector<LONG64> &aTimestamps, 884 std::vector<com::Utf8Str> &aFlags) 967 885 { 968 886 #if defined(VBOX_WITH_GUEST_PROPS) && !defined(VBOX_COM_INPROC_API_CLIENT) 969 AutoCaller autoCaller(this);970 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());971 972 887 if (mState != SessionState_Locked) 973 888 return setError(VBOX_E_INVALID_VM_STATE, … … 975 890 Global::stringifySessionState(mState)); 976 891 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 977 if (!VALID_PTR(aPatterns) && (aPatterns != NULL))978 return E_POINTER;979 if (ComSafeArrayOutIsNull(aNames))980 return E_POINTER;981 if (ComSafeArrayOutIsNull(aValues))982 return E_POINTER;983 if (ComSafeArrayOutIsNull(aTimestamps))984 return E_POINTER;985 if (ComSafeArrayOutIsNull(aFlags))986 return E_POINTER;987 892 988 893 /* If this session is not in a VM process fend off the call. The caller … … 991 896 return E_ACCESSDENIED; 992 897 993 return mConsole->i_enumerateGuestProperties(aPatterns, 994 ComSafeArrayOutArg(aNames), 995 ComSafeArrayOutArg(aValues), 996 ComSafeArrayOutArg(aTimestamps), 997 ComSafeArrayOutArg(aFlags)); 898 com::SafeArray<BSTR> arrKeys; 899 com::SafeArray<BSTR> arrValues; 900 com::SafeArray<LONG64> arrTimestamps; 901 com::SafeArray<BSTR> arrFlags; 902 903 HRESULT hrc = mConsole->i_enumerateGuestProperties(Bstr(aPatterns).raw(), 904 ComSafeArrayAsOutParam(arrKeys), 905 ComSafeArrayAsOutParam(arrValues), 906 ComSafeArrayAsOutParam(arrTimestamps), 907 ComSafeArrayAsOutParam(arrFlags)); 908 909 size_t i = 0; 910 aKeys.resize(arrKeys.size()); 911 for(i = 0; i < arrKeys.size(); ++i) 912 aKeys[i] = arrKeys[i]; 913 aValues.resize(arrValues.size()); 914 for(i = 0; i < arrValues.size(); ++i) 915 aValues[i] = arrValues[i]; 916 aTimestamps.resize(arrTimestamps.size()); 917 for(i = 0; i < arrTimestamps.size(); ++i) 918 aTimestamps[i] = arrTimestamps[i]; 919 aFlags.resize(arrFlags.size()); 920 for(i = 0; i < arrFlags.size(); ++i) 921 aFlags[i] = arrFlags[i]; 922 923 return hrc; 924 998 925 #else /* VBOX_WITH_GUEST_PROPS not defined */ 999 926 ReturnComNotImplemented(); … … 1001 928 } 1002 929 1003 STDMETHODIMP Session::OnlineMergeMedium(IMediumAttachment *aMediumAttachment, 1004 ULONG aSourceIdx, ULONG aTargetIdx, 1005 IProgress *aProgress) 1006 { 1007 AutoCaller autoCaller(this); 1008 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1009 930 HRESULT Session::onlineMergeMedium(const ComPtr<IMediumAttachment> &aMediumAttachment, ULONG aSourceIdx, 931 ULONG aTargetIdx, const ComPtr<IProgress> &aProgress) 932 { 1010 933 if (mState != SessionState_Locked) 1011 934 return setError(VBOX_E_INVALID_VM_STATE, … … 1015 938 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 1016 939 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 1017 CheckComArgNotNull(aMediumAttachment);1018 940 1019 941 return mConsole->i_onlineMergeMedium(aMediumAttachment, … … 1026 948 } 1027 949 1028 STDMETHODIMP Session::EnableVMMStatistics(BOOL aEnable) 1029 { 1030 AutoCaller autoCaller(this); 1031 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1032 950 HRESULT Session::enableVMMStatistics(BOOL aEnable) 951 { 1033 952 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1034 953 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); … … 1046 965 } 1047 966 1048 STDMETHODIMP Session::PauseWithReason(Reason_T aReason) 1049 { 1050 AutoCaller autoCaller(this); 1051 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1052 967 HRESULT Session::pauseWithReason(Reason_T aReason) 968 { 1053 969 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1054 970 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); … … 1064 980 } 1065 981 1066 STDMETHODIMP Session::ResumeWithReason(Reason_T aReason) 1067 { 1068 AutoCaller autoCaller(this); 1069 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1070 982 HRESULT Session::resumeWithReason(Reason_T aReason) 983 { 1071 984 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1072 985 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); … … 1082 995 } 1083 996 1084 STDMETHODIMP Session::SaveStateWithReason(Reason_T aReason, IProgress **aProgress) 1085 { 1086 AutoCaller autoCaller(this); 1087 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1088 1089 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1090 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 1091 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 1092 #ifndef VBOX_COM_INPROC_API_CLIENT 1093 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 1094 1095 return mConsole->i_saveState(aReason, aProgress); 997 HRESULT Session::saveStateWithReason(Reason_T aReason, ComPtr<IProgress> &aProgress) 998 { 999 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1000 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 1001 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 1002 #ifndef VBOX_COM_INPROC_API_CLIENT 1003 AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE); 1004 1005 return mConsole->i_saveState(aReason, aProgress.asOutParam()); 1096 1006 #else 1097 1007 AssertFailed(); … … 1117 1027 LogFlowThisFunc(("aFinalRelease=%d, isFromServer=%d\n", 1118 1028 aFinalRelease, aFromServer)); 1119 1120 AutoCaller autoCaller(this);1121 AssertComRCReturnRC(autoCaller.rc());1122 1029 1123 1030 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); -
trunk/src/VBox/Main/src-client/xpcom/module.cpp
r52082 r52232 62 62 NS_DECL_CLASSINFO(VirtualBoxClient) 63 63 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient) 64 NS_DECL_CLASSINFO(Session)65 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(Session, ISession, IInternalSessionControl)66 64 67 65 #ifndef VBOX_COM_INPROC_API_CLIENT … … 79 77 80 78 #endif /* VBOX_COM_INPROC_API_CLIENT */ 79 80 /* 81 * Declare extern variables here to tell the compiler that 82 * NS_DECL_CLASSINFO(SessionWrap) 83 * already exists in the VBoxAPIWrap library. 84 */ 85 NS_DECL_CI_INTERFACE_GETTER(SessionWrap) 86 extern nsIClassInfo *NS_CLASSINFO_NAME(SessionWrap); 81 87 82 88 /** … … 151 157 // SessionClassFactory::releaseInstance, 152 158 NULL, // destructor function 153 NS_CI_INTERFACE_GETTER_NAME(Session ), // interfaces function159 NS_CI_INTERFACE_GETTER_NAME(SessionWrap), // interfaces function 154 160 NULL, // language helper 155 &NS_CLASSINFO_NAME(Session ) // global class info & flags161 &NS_CLASSINFO_NAME(SessionWrap) // global class info & flags 156 162 }, 157 163 {
Note:
See TracChangeset
for help on using the changeset viewer.