Changeset 73940 in vbox for trunk/include/VBox/HostServices
- Timestamp:
- Aug 29, 2018 8:11:54 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/Service.h
r73939 r73940 95 95 } 96 96 97 return copyParmsInternal(&aParms[0], cParms, m_paParms, m_cParms, false /* fDeepCopy */);97 return Message::CopyParms(&aParms[0], cParms, m_paParms, m_cParms, false /* fDeepCopy */); 98 98 } 99 99 … … 155 155 156 156 return VINF_SUCCESS; 157 }158 159 private:160 161 /** Stored message type. */162 uint32_t m_uMsg;163 /** Number of stored HGCM parameters. */164 uint32_t m_cParms;165 /** Stored HGCM parameters. */166 PVBOXHGCMSVCPARM m_paParms;167 168 int initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])169 {170 AssertReturn(cParms < 256, VERR_INVALID_PARAMETER);171 AssertPtrNullReturn(aParms, VERR_INVALID_PARAMETER);172 173 /* Cleanup old messages. */174 cleanup();175 176 m_uMsg = uMsg;177 m_cParms = cParms;178 179 int rc = VINF_SUCCESS;180 181 if (cParms)182 {183 m_paParms = (VBOXHGCMSVCPARM*)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * m_cParms);184 if (m_paParms)185 {186 rc = copyParmsInternal(m_paParms, m_cParms, &aParms[0], cParms, true /* fDeepCopy */);187 if (RT_FAILURE(rc))188 cleanup();189 }190 else191 rc = VERR_NO_MEMORY;192 }193 194 return rc;195 157 } 196 158 … … 207 169 * @remark Static convenience function. 208 170 */ 209 static int copyParmsInternal(PVBOXHGCMSVCPARM paParmsDst, uint32_t cParmsDst,210 211 171 static int CopyParms(PVBOXHGCMSVCPARM paParmsDst, uint32_t cParmsDst, 172 PVBOXHGCMSVCPARM paParmsSrc, uint32_t cParmsSrc, 173 bool fDeepCopy) 212 174 { 213 175 AssertPtrReturn(paParmsSrc, VERR_INVALID_POINTER); … … 287 249 } 288 250 251 private: 252 253 /** Stored message type. */ 254 uint32_t m_uMsg; 255 /** Number of stored HGCM parameters. */ 256 uint32_t m_cParms; 257 /** Stored HGCM parameters. */ 258 PVBOXHGCMSVCPARM m_paParms; 259 260 int initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) 261 { 262 AssertReturn(cParms < 256, VERR_INVALID_PARAMETER); 263 AssertPtrNullReturn(aParms, VERR_INVALID_PARAMETER); 264 265 /* Cleanup old messages. */ 266 cleanup(); 267 268 m_uMsg = uMsg; 269 m_cParms = cParms; 270 271 int rc = VINF_SUCCESS; 272 273 if (cParms) 274 { 275 m_paParms = (VBOXHGCMSVCPARM*)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * m_cParms); 276 if (m_paParms) 277 { 278 rc = Message::CopyParms(m_paParms, m_cParms, &aParms[0], cParms, true /* fDeepCopy */); 279 if (RT_FAILURE(rc)) 280 cleanup(); 281 } 282 else 283 rc = VERR_NO_MEMORY; 284 } 285 286 return rc; 287 } 288 289 289 /** 290 290 * Cleans up the message by free'ing all allocated parameters and resetting the rest.
Note:
See TracChangeset
for help on using the changeset viewer.