Changeset 85318 in vbox for trunk/src/VBox/HostServices/common
- Timestamp:
- Jul 13, 2020 9:07:41 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139296
- Location:
- trunk/src/VBox/HostServices/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/common/client.cpp
r82968 r85318 27 27 using namespace HGCM; 28 28 29 Client::Client(uint32_t uClientID)30 : m_ uClientID(uClientID)29 Client::Client(uint32_t idClient) 30 : m_idClient(idClient) 31 31 , m_uProtocolVer(0) 32 32 , m_fDeferred(false) … … 49 49 * @param rcOp Return code to return to the guest side. 50 50 */ 51 int Client::completeInternal(VBOXHGCMCALLHANDLE hHandle, int rcOp) 52 { 53 LogFlowThisFunc((" uClientID=%RU32\n", m_uClientID));51 int Client::completeInternal(VBOXHGCMCALLHANDLE hHandle, int rcOp) RT_NOEXCEPT 52 { 53 LogFlowThisFunc(("idClient=%RU32\n", m_idClient)); 54 54 55 55 if ( m_SvcCtx.pHelpers … … 68 68 * Resets the client's internal state. 69 69 */ 70 void Client::reset(void) 70 void Client::reset(void) RT_NOEXCEPT 71 71 { 72 72 m_fDeferred = false; … … 83 83 * @param rcOp Return code to return to the guest side. 84 84 */ 85 int Client::Complete(VBOXHGCMCALLHANDLE hHandle, int rcOp /* = VINF_SUCCESS */) 85 int Client::Complete(VBOXHGCMCALLHANDLE hHandle, int rcOp /* = VINF_SUCCESS */) RT_NOEXCEPT 86 86 { 87 87 return completeInternal(hHandle, rcOp); … … 95 95 * @param rcOp Return code to return to the guest side. 96 96 */ 97 int Client::CompleteDeferred(int rcOp) 97 int Client::CompleteDeferred(int rcOp) RT_NOEXCEPT 98 98 { 99 99 if (m_fDeferred) … … 108 108 } 109 109 110 AssertMsg(m_fDeferred, ("Client %RU32 is not in deferred mode\n", m_ uClientID));110 AssertMsg(m_fDeferred, ("Client %RU32 is not in deferred mode\n", m_idClient)); 111 111 return VERR_INVALID_STATE; 112 112 } … … 117 117 * @returns HGCM handle. 118 118 */ 119 VBOXHGCMCALLHANDLE Client::GetHandle(void) const 119 VBOXHGCMCALLHANDLE Client::GetHandle(void) const RT_NOEXCEPT 120 120 { 121 121 return m_Deferred.hHandle; … … 127 127 * @returns HGCM handle. 128 128 */ 129 uint32_t Client::GetMsgType(void) const 129 uint32_t Client::GetMsgType(void) const RT_NOEXCEPT 130 130 { 131 131 return m_Deferred.uType; 132 132 } 133 133 134 uint32_t Client::GetMsgParamCount(void) const 134 uint32_t Client::GetMsgParamCount(void) const RT_NOEXCEPT 135 135 { 136 136 return m_Deferred.cParms; … … 142 142 * @returns The client's (HGCM) ID. 143 143 */ 144 uint32_t Client::GetClientID(void) const 145 { 146 return m_ uClientID;144 uint32_t Client::GetClientID(void) const RT_NOEXCEPT 145 { 146 return m_idClient; 147 147 } 148 148 … … 152 152 * @returns Protocol version, or 0 if not set. 153 153 */ 154 uint32_t Client::GetProtocolVer(void) const 154 uint32_t Client::GetProtocolVer(void) const RT_NOEXCEPT 155 155 { 156 156 return m_uProtocolVer; … … 162 162 * @returns \c True if in deferred mode, \c False if not. 163 163 */ 164 bool Client::IsDeferred(void) const 164 bool Client::IsDeferred(void) const RT_NOEXCEPT 165 165 { 166 166 return m_fDeferred; … … 171 171 * until CompleteDeferred() has been called. 172 172 */ 173 void Client::SetDeferred(VBOXHGCMCALLHANDLE hHandle, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 174 { 175 LogFlowThisFunc(("uClient=%RU32\n", m_ uClientID));173 void Client::SetDeferred(VBOXHGCMCALLHANDLE hHandle, uint32_t u32Function, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) RT_NOEXCEPT 174 { 175 LogFlowThisFunc(("uClient=%RU32\n", m_idClient)); 176 176 177 177 #ifndef DEBUG_bird /** r=bird: This bugger triggers in the DnD service when restoring saved state. Not tested? */ … … 192 192 * @param uVersion Version number to set. 193 193 */ 194 void Client::SetProtocolVer(uint32_t uVersion) 194 void Client::SetProtocolVer(uint32_t uVersion) RT_NOEXCEPT 195 195 { 196 196 m_uProtocolVer = uVersion; … … 202 202 * @param SvcCtx Service context to set. 203 203 */ 204 void Client::SetSvcContext(const VBOXHGCMSVCTX &SvcCtx) 204 void Client::SetSvcContext(const VBOXHGCMSVCTX &SvcCtx) RT_NOEXCEPT 205 205 { 206 206 m_SvcCtx = SvcCtx; … … 216 216 * @param cParms Number of parameters the message needs. 217 217 */ 218 int Client::SetDeferredMsgInfo(uint32_t uMsg, uint32_t cParms) 218 int Client::SetDeferredMsgInfo(uint32_t uMsg, uint32_t cParms) RT_NOEXCEPT 219 219 { 220 220 if (m_fDeferred) … … 243 243 * @param pMessage Message to get message type and required parameters from. 244 244 */ 245 int Client::SetDeferredMsgInfo(const Message *pMessage) 245 int Client::SetDeferredMsgInfo(const Message *pMessage) RT_NOEXCEPT 246 246 { 247 247 AssertPtrReturn(pMessage, VERR_INVALID_POINTER); -
trunk/src/VBox/HostServices/common/message.cpp
r82968 r85318 23 23 : m_uMsg(0) 24 24 , m_cParms(0) 25 , m_paParms(NULL) { } 25 , m_paParms(NULL) 26 { 27 } 26 28 27 29 Message::Message(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) … … 41 43 * Resets the message by free'ing all allocated parameters and resetting the rest. 42 44 */ 43 void Message::reset(void) 45 void Message::reset(void) RT_NOEXCEPT 44 46 { 45 47 if (m_paParms) … … 67 69 * @returns Parameter count. 68 70 */ 69 uint32_t Message::GetParamCount(void) const 71 uint32_t Message::GetParamCount(void) const RT_NOEXCEPT 70 72 { 71 73 return m_cParms; … … 80 82 * @param aParms Where to store the HGCM parameter data. 81 83 */ 82 int Message::GetData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) const 84 int Message::GetData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) const RT_NOEXCEPT 83 85 { 84 86 if (m_uMsg != uMsg) … … 103 105 * @param pu32Info Where to store the parameter value. 104 106 */ 105 int Message::GetParmU32(uint32_t uParm, uint32_t *pu32Info) const 107 int Message::GetParmU32(uint32_t uParm, uint32_t *pu32Info) const RT_NOEXCEPT 106 108 { 107 109 AssertPtrNullReturn(pu32Info, VERR_INVALID_PARAMETER); … … 121 123 * @param pu64Info Where to store the parameter value. 122 124 */ 123 int Message::GetParmU64(uint32_t uParm, uint64_t *pu64Info) const 125 int Message::GetParmU64(uint32_t uParm, uint64_t *pu64Info) const RT_NOEXCEPT 124 126 { 125 127 AssertPtrNullReturn(pu64Info, VERR_INVALID_PARAMETER); … … 142 144 * @remarks Does not copy (store) the actual content of the pointer (deep copy). 143 145 */ 144 int Message::GetParmPtr(uint32_t uParm, void **ppvAddr, uint32_t *pcbSize) const 146 int Message::GetParmPtr(uint32_t uParm, void **ppvAddr, uint32_t *pcbSize) const RT_NOEXCEPT 145 147 { 146 148 AssertPtrNullReturn(ppvAddr, VERR_INVALID_PARAMETER); … … 160 162 * @returns Message type. 161 163 */ 162 uint32_t Message::GetType(void) const 164 uint32_t Message::GetType(void) const RT_NOEXCEPT 163 165 { 164 166 return m_uMsg; … … 180 182 int Message::CopyParms(PVBOXHGCMSVCPARM paParmsDst, uint32_t cParmsDst, 181 183 PVBOXHGCMSVCPARM paParmsSrc, uint32_t cParmsSrc, 182 bool fDeepCopy) 184 bool fDeepCopy) RT_NOEXCEPT 183 185 { 184 186 AssertPtrReturn(paParmsSrc, VERR_INVALID_POINTER); … … 188 190 return VERR_BUFFER_OVERFLOW; 189 191 190 int rc = VINF_SUCCESS;191 192 for (uint32_t i = 0; i < cParmsSrc; i++) 192 193 { … … 215 216 paParmsDst[i].u.pointer.addr = RTMemAlloc(paParmsDst[i].u.pointer.size); 216 217 if (!paParmsDst[i].u.pointer.addr) 217 { 218 rc = VERR_NO_MEMORY; 219 break; 220 } 218 return VERR_NO_MEMORY; 221 219 } 222 220 } … … 225 223 /* No, but we have to check if there is enough room. */ 226 224 if (paParmsDst[i].u.pointer.size < paParmsSrc[i].u.pointer.size) 227 { 228 rc = VERR_BUFFER_OVERFLOW; 229 break; 230 } 225 return VERR_BUFFER_OVERFLOW; 231 226 } 232 227 … … 235 230 if ( paParmsDst[i].u.pointer.addr 236 231 && paParmsDst[i].u.pointer.size) 237 {238 232 memcpy(paParmsDst[i].u.pointer.addr, 239 233 paParmsSrc[i].u.pointer.addr, 240 234 RT_MIN(paParmsDst[i].u.pointer.size, paParmsSrc[i].u.pointer.size)); 241 }242 235 else 243 r c =VERR_INVALID_POINTER;236 return VERR_INVALID_POINTER; 244 237 } 245 238 break; … … 248 241 { 249 242 AssertMsgFailed(("Unknown HGCM type %u\n", paParmsSrc[i].type)); 250 rc = VERR_INVALID_PARAMETER; 251 break; 243 return VERR_INVALID_PARAMETER; 252 244 } 253 245 } 254 if (RT_FAILURE(rc)) 255 break; 256 } 257 return rc; 246 } 247 return VINF_SUCCESS; 258 248 } 259 249 … … 266 256 * @param aParms Array of parameters to set. 267 257 */ 268 int Message::initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) 269 { 258 int Message::initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) RT_NOEXCEPT 259 { 260 /** @todo r=bird: There is a define for the max number of HGCM parameters, 261 * it's way smaller than 256, something like 61 IIRC. */ 270 262 AssertReturn(cParms < 256, VERR_INVALID_PARAMETER); 271 263 AssertPtrNullReturn(aParms, VERR_INVALID_PARAMETER);
Note:
See TracChangeset
for help on using the changeset viewer.