Changeset 52442 in vbox
- Timestamp:
- Aug 21, 2014 4:03:15 PM (10 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r51436 r52442 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 19 19 #define ____H_CONSOLEVRDPSERVER 20 20 21 #include "VRDEServerInfoWrap.h" 21 22 #include "RemoteUSBBackend.h" 22 23 #include "HGCM.h" … … 364 365 365 366 class ATL_NO_VTABLE VRDEServerInfo : 366 public VirtualBoxBase, 367 VBOX_SCRIPTABLE_IMPL(IVRDEServerInfo) 367 public VRDEServerInfoWrap 368 368 { 369 369 public: 370 371 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VRDEServerInfo, IVRDEServerInfo)372 373 370 DECLARE_NOT_AGGREGATABLE(VRDEServerInfo) 374 371 375 DECLARE_PROTECT_FINAL_CONSTRUCT() 376 377 BEGIN_COM_MAP(VRDEServerInfo) 378 VBOX_DEFAULT_INTERFACE_ENTRIES(IVRDEServerInfo) 379 END_COM_MAP() 380 381 DECLARE_EMPTY_CTOR_DTOR (VRDEServerInfo) 372 DECLARE_EMPTY_CTOR_DTOR(VRDEServerInfo) 382 373 383 374 HRESULT FinalConstruct(); … … 385 376 386 377 /* Public initializer/uninitializer for internal purposes only. */ 387 HRESULT init 378 HRESULT init(Console *aParent); 388 379 void uninit(); 389 380 390 /* IVRDEServerInfo properties */391 #define DECL_GETTER(_aType, _aName) STDMETHOD(COMGETTER(_aName)) (_aType *a##_aName)392 DECL_GETTER (BOOL, Active);393 DECL_GETTER (LONG, Port);394 DECL_GETTER (ULONG, NumberOfClients);395 DECL_GETTER (LONG64, BeginTime);396 DECL_GETTER (LONG64, EndTime);397 DECL_GETTER (LONG64, BytesSent);398 DECL_GETTER (LONG64, BytesSentTotal);399 DECL_GETTER (LONG64, BytesReceived);400 DECL_GETTER (LONG64, BytesReceivedTotal);401 DECL_GETTER (BSTR, User);402 DECL_GETTER (BSTR, Domain);403 DECL_GETTER (BSTR, ClientName);404 DECL_GETTER (BSTR, ClientIP);405 DECL_GETTER (ULONG, ClientVersion);406 DECL_GETTER (ULONG, EncryptionStyle);407 #undef DECL_GETTER408 409 381 private: 382 // wrapped IVRDEServerInfo properties 383 #define DECL_GETTER(_aType, _aName) virtual HRESULT get##_aName(_aType *a##_aName) 384 #define DECL_GETTER_REF(_aType, _aName) virtual HRESULT get##_aName(_aType &a##_aName) 385 DECL_GETTER(BOOL, Active); 386 DECL_GETTER(LONG, Port); 387 DECL_GETTER(ULONG, NumberOfClients); 388 DECL_GETTER(LONG64, BeginTime); 389 DECL_GETTER(LONG64, EndTime); 390 DECL_GETTER(LONG64, BytesSent); 391 DECL_GETTER(LONG64, BytesSentTotal); 392 DECL_GETTER(LONG64, BytesReceived); 393 DECL_GETTER(LONG64, BytesReceivedTotal); 394 DECL_GETTER_REF(com::Utf8Str, User); 395 DECL_GETTER_REF(com::Utf8Str, Domain); 396 DECL_GETTER_REF(com::Utf8Str, ClientName); 397 DECL_GETTER_REF(com::Utf8Str, ClientIP); 398 DECL_GETTER(ULONG, ClientVersion); 399 DECL_GETTER(ULONG, EncryptionStyle); 400 #undef DECL_GETTER_REF 401 #undef DECL_GETTER 410 402 411 403 Console * const mParent; -
trunk/src/VBox/Main/include/VirtualBoxClientImpl.h
r44970 r52442 6 6 7 7 /* 8 * Copyright (C) 2010-201 3Oracle Corporation8 * Copyright (C) 2010-2014 Oracle Corporation 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #define ____H_VIRTUALBOXCLIENTIMPL 21 21 22 #include "VirtualBox Base.h"22 #include "VirtualBoxClientWrap.h" 23 23 #include "EventImpl.h" 24 24 … … 28 28 29 29 class ATL_NO_VTABLE VirtualBoxClient : 30 public VirtualBoxBase, 31 VBOX_SCRIPTABLE_IMPL(IVirtualBoxClient) 30 public VirtualBoxClientWrap 32 31 #ifdef RT_OS_WINDOWS 33 32 , public CComCoClass<VirtualBoxClient, &CLSID_VirtualBoxClient> … … 35 34 { 36 35 public: 37 38 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(VirtualBoxClient, IVirtualBoxClient)39 40 36 DECLARE_CLASSFACTORY() 41 37 42 38 DECLARE_REGISTRY_RESOURCEID(IDR_VIRTUALBOX) 39 43 40 DECLARE_NOT_AGGREGATABLE(VirtualBoxClient) 44 45 DECLARE_PROTECT_FINAL_CONSTRUCT()46 47 BEGIN_COM_MAP(VirtualBoxClient)48 VBOX_DEFAULT_INTERFACE_ENTRIES(IVirtualBoxClient)49 END_COM_MAP()50 41 51 42 HRESULT FinalConstruct(); … … 56 47 void uninit(); 57 48 58 // IUSBDevice properties 59 STDMETHOD(COMGETTER(VirtualBox))(IVirtualBox **aVirtualBox);60 STDMETHOD(COMGETTER(Session))(ISession **aSession);61 STDMETHOD(COMGETTER(EventSource))(IEventSource **aEventSource);62 STDMETHOD(CheckMachineError)(IMachine *aMachine);49 private: 50 // wrapped IVirtualBoxClient properties 51 virtual HRESULT getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox); 52 virtual HRESULT getSession(ComPtr<ISession> &aSession); 53 virtual HRESULT getEventSource(ComPtr<IEventSource> &aEventSource); 63 54 64 private: 55 // wrapped IVirtualBoxClient methods 56 virtual HRESULT checkMachineError(const ComPtr<IMachine> &aMachine); 57 65 58 /** Instance counter for simulating something similar to a singleton. 66 59 * Only the first instance will be a usable object, all additional -
trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp
r52064 r52442 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 4082 4082 4083 4083 #define IMPL_GETTER_BOOL(_aType, _aName, _aIndex) \ 4084 STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)\4084 HRESULT VRDEServerInfo::get##_aName(_aType *a##_aName) \ 4085 4085 { \ 4086 if (!a##_aName) \4087 return E_POINTER; \4088 \4089 AutoCaller autoCaller(this); \4090 if (FAILED(autoCaller.rc())) return autoCaller.rc(); \4091 \4092 4086 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 4093 4087 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); \ … … 4096 4090 uint32_t cbOut = 0; \ 4097 4091 \ 4098 mParent->i_consoleVRDPServer()->QueryInfo 4092 mParent->i_consoleVRDPServer()->QueryInfo \ 4099 4093 (_aIndex, &value, sizeof(value), &cbOut); \ 4100 4094 \ … … 4106 4100 4107 4101 #define IMPL_GETTER_SCALAR(_aType, _aName, _aIndex, _aValueMask) \ 4108 STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)\4102 HRESULT VRDEServerInfo::get##_aName(_aType *a##_aName) \ 4109 4103 { \ 4110 if (!a##_aName) \4111 return E_POINTER; \4112 \4113 AutoCaller autoCaller(this); \4114 if (FAILED(autoCaller.rc())) return autoCaller.rc(); \4115 \4116 4104 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 4117 4105 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); \ … … 4120 4108 uint32_t cbOut = 0; \ 4121 4109 \ 4122 mParent->i_consoleVRDPServer()->QueryInfo 4110 mParent->i_consoleVRDPServer()->QueryInfo \ 4123 4111 (_aIndex, &value, sizeof(value), &cbOut); \ 4124 4112 \ … … 4130 4118 extern void IMPL_GETTER_SCALAR_DUMMY(void) 4131 4119 4132 #define IMPL_GETTER_ BSTR(_aType, _aName, _aIndex)\4133 STDMETHODIMP VRDEServerInfo::COMGETTER(_aName)(_aType *a##_aName)\4120 #define IMPL_GETTER_UTF8STR(_aType, _aName, _aIndex) \ 4121 HRESULT VRDEServerInfo::get##_aName(_aType &a##_aName) \ 4134 4122 { \ 4135 if (!a##_aName) \4136 return E_POINTER; \4137 \4138 AutoCaller autoCaller(this); \4139 if (FAILED(autoCaller.rc())) return autoCaller.rc(); \4140 \4141 4123 /* todo: Not sure if a AutoReadLock would be sufficient. */ \ 4142 4124 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); \ … … 4144 4126 uint32_t cbOut = 0; \ 4145 4127 \ 4146 mParent->i_consoleVRDPServer()->QueryInfo 4128 mParent->i_consoleVRDPServer()->QueryInfo \ 4147 4129 (_aIndex, NULL, 0, &cbOut); \ 4148 4130 \ 4149 4131 if (cbOut == 0) \ 4150 4132 { \ 4151 Bstr str(""); \ 4152 str.cloneTo(a##_aName); \ 4133 a##_aName = Utf8Str::Empty; \ 4153 4134 return S_OK; \ 4154 4135 } \ … … 4164 4145 } \ 4165 4146 \ 4166 mParent->i_consoleVRDPServer()->QueryInfo 4147 mParent->i_consoleVRDPServer()->QueryInfo \ 4167 4148 (_aIndex, pchBuffer, cbOut, &cbOut); \ 4168 4149 \ 4169 Bstr str(pchBuffer); \ 4170 \ 4171 str.cloneTo(a##_aName); \ 4150 a##_aName = pchBuffer; \ 4172 4151 \ 4173 4152 RTMemTmpFree(pchBuffer); \ … … 4186 4165 IMPL_GETTER_SCALAR (LONG64, BytesReceived, VRDE_QI_BYTES_RECEIVED, INT64_MAX); 4187 4166 IMPL_GETTER_SCALAR (LONG64, BytesReceivedTotal, VRDE_QI_BYTES_RECEIVED_TOTAL, INT64_MAX); 4188 IMPL_GETTER_ BSTR (BSTR,User, VRDE_QI_USER);4189 IMPL_GETTER_ BSTR (BSTR,Domain, VRDE_QI_DOMAIN);4190 IMPL_GETTER_ BSTR (BSTR,ClientName, VRDE_QI_CLIENT_NAME);4191 IMPL_GETTER_ BSTR (BSTR,ClientIP, VRDE_QI_CLIENT_IP);4167 IMPL_GETTER_UTF8STR(Utf8Str, User, VRDE_QI_USER); 4168 IMPL_GETTER_UTF8STR(Utf8Str, Domain, VRDE_QI_DOMAIN); 4169 IMPL_GETTER_UTF8STR(Utf8Str, ClientName, VRDE_QI_CLIENT_NAME); 4170 IMPL_GETTER_UTF8STR(Utf8Str, ClientIP, VRDE_QI_CLIENT_IP); 4192 4171 IMPL_GETTER_SCALAR (ULONG, ClientVersion, VRDE_QI_CLIENT_VERSION, 0); 4193 4172 IMPL_GETTER_SCALAR (ULONG, EncryptionStyle, VRDE_QI_ENCRYPTION_STYLE, 0); 4194 4173 4195 #undef IMPL_GETTER_ BSTR4174 #undef IMPL_GETTER_UTF8STR 4196 4175 #undef IMPL_GETTER_SCALAR 4197 4176 #undef IMPL_GETTER_BOOL -
trunk/src/VBox/Main/src-client/VirtualBoxClientImpl.cpp
r50544 r52442 5 5 6 6 /* 7 * Copyright (C) 2010-201 3Oracle Corporation7 * Copyright (C) 2010-2014 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 148 148 * @param aVirtualBox Address of result variable. 149 149 */ 150 STDMETHODIMP VirtualBoxClient::COMGETTER(VirtualBox)(IVirtualBox **aVirtualBox) 151 { 152 CheckComArgOutPointerValid(aVirtualBox); 153 154 AutoCaller autoCaller(this); 155 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 156 150 HRESULT VirtualBoxClient::getVirtualBox(ComPtr<IVirtualBox> &aVirtualBox) 151 { 157 152 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 158 mData.m_pVirtualBox.queryInterfaceTo(aVirtualBox);153 aVirtualBox = mData.m_pVirtualBox; 159 154 return S_OK; 160 155 } … … 166 161 * @param aSession Address of result variable. 167 162 */ 168 STDMETHODIMP VirtualBoxClient::COMGETTER(Session)(ISession **aSession) 169 { 170 HRESULT rc; 171 CheckComArgOutPointerValid(aSession); 172 173 AutoCaller autoCaller(this); 174 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 175 163 HRESULT VirtualBoxClient::getSession(ComPtr<ISession> &aSession) 164 { 176 165 /* this is not stored in this object, no need to lock */ 177 166 ComPtr<ISession> pSession; 178 rc = pSession.createInprocObject(CLSID_Session);167 HRESULT rc = pSession.createInprocObject(CLSID_Session); 179 168 if (SUCCEEDED(rc)) 180 pSession.queryInterfaceTo(aSession); 181 169 aSession = pSession; 182 170 return rc; 183 171 } … … 189 177 * @param aEventSource Address of result variable. 190 178 */ 191 STDMETHODIMP VirtualBoxClient::COMGETTER(EventSource)(IEventSource **aEventSource) 192 { 193 CheckComArgOutPointerValid(aEventSource); 194 195 AutoCaller autoCaller(this); 196 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 197 179 HRESULT VirtualBoxClient::getEventSource(ComPtr<IEventSource> &aEventSource) 180 { 198 181 /* this is const, no need to lock */ 199 mData.m_pEventSource.queryInterfaceTo(aEventSource); 200 201 return mData.m_pEventSource.isNull() ? E_FAIL : S_OK; 202 } 182 aEventSource = mData.m_pEventSource; 183 return aEventSource.isNull() ? E_FAIL : S_OK; 184 } 185 186 // IVirtualBoxClient methods 187 ///////////////////////////////////////////////////////////////////////////// 203 188 204 189 /** … … 208 193 * @param aMachine Machine object to check. 209 194 */ 210 STDMETHODIMP VirtualBoxClient::CheckMachineError(IMachine *aMachine) 211 { 212 HRESULT rc; 213 CheckComArgNotNull(aMachine); 214 195 HRESULT VirtualBoxClient::checkMachineError(const ComPtr<IMachine> &aMachine) 196 { 215 197 BOOL fAccessible = FALSE; 216 rc = aMachine->COMGETTER(Accessible)(&fAccessible);198 HRESULT rc = aMachine->COMGETTER(Accessible)(&fAccessible); 217 199 if (FAILED(rc)) 218 200 return setError(rc, tr("Could not check the accessibility status of the VM")); -
trunk/src/VBox/Main/src-client/xpcom/module.cpp
r52400 r52442 29 29 #include "VirtualBox_XPCOM.h" 30 30 31 #include "AdditionsFacilityImpl.h" 32 #include "ConsoleImpl.h" 33 #include "ConsoleVRDPServer.h" 34 #include "DisplayImpl.h" 35 #ifdef VBOX_WITH_EXTPACK 36 # include "ExtPackManagerImpl.h" 37 #endif 38 #include "GuestImpl.h" 39 #ifdef VBOX_WITH_GUEST_CONTROL 40 # include "GuestDirectoryImpl.h" 41 # include "GuestFileImpl.h" 42 # include "GuestFsObjInfoImpl.h" 43 # include "GuestProcessImpl.h" 44 # include "GuestSessionImpl.h" 45 #endif 46 #include "KeyboardImpl.h" 47 #include "MachineDebuggerImpl.h" 48 #include "MouseImpl.h" 49 #include "NATEngineImpl.h" 50 #include "NetworkAdapterImpl.h" 51 #include "ProgressImpl.h" 31 #include "SessionImpl.h" 32 #include "VirtualBoxClientImpl.h" 52 33 #include "RemoteUSBDeviceImpl.h" 53 #include "SessionImpl.h"54 #include "SharedFolderImpl.h"55 34 #include "USBDeviceImpl.h" 56 #include "VirtualBoxClientImpl.h"57 35 58 36 #include "Logging.h" … … 60 38 // XPCOM glue code unfolding 61 39 62 NS_DECL_CLASSINFO(VirtualBoxClient)63 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VirtualBoxClient, IVirtualBoxClient)64 65 40 #ifndef VBOX_COM_INPROC_API_CLIENT 66 41 NS_DECL_CLASSINFO(RemoteUSBDevice) 67 42 NS_IMPL_THREADSAFE_ISUPPORTS2_CI(RemoteUSBDevice, IHostUSBDevice, IUSBDevice) 68 NS_DECL_CLASSINFO(VRDEServerInfo)69 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(VRDEServerInfo, IVRDEServerInfo)70 #ifdef VBOX_WITH_EXTPACK71 // deliberately omit ExtPackFile as it's unusable in the client context72 // NS_DECL_CLASSINFO(ExtPackFile)73 // NS_IMPL_THREADSAFE_ISUPPORTS2_CI(ExtPackFile, IExtPackFile, IExtPackBase)74 #endif75 76 43 #endif /* VBOX_COM_INPROC_API_CLIENT */ 77 44 … … 83 50 NS_DECL_CI_INTERFACE_GETTER(SessionWrap) 84 51 extern nsIClassInfo *NS_CLASSINFO_NAME(SessionWrap); 52 53 /* 54 * Declare extern variables here to tell the compiler that 55 * NS_DECL_CLASSINFO(VirtualBoxClientWrap) 56 * already exists in the VBoxAPIWrap library. 57 */ 58 NS_DECL_CI_INTERFACE_GETTER(VirtualBoxClientWrap) 59 extern nsIClassInfo *NS_CLASSINFO_NAME(VirtualBoxClientWrap); 85 60 86 61 /** … … 166 141 NULL, // deregistration function 167 142 NULL, // destructor function 168 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClient ), // interfaces function143 NS_CI_INTERFACE_GETTER_NAME(VirtualBoxClientWrap), // interfaces function 169 144 NULL, // language helper 170 &NS_CLASSINFO_NAME(VirtualBoxClient ) // global class info & flags145 &NS_CLASSINFO_NAME(VirtualBoxClientWrap) // global class info & flags 171 146 }, 172 147 };
Note:
See TracChangeset
for help on using the changeset viewer.