Changeset 59830 in vbox for trunk/include/VBox
- Timestamp:
- Feb 26, 2016 10:08:15 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105723
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/Service.h
r58329 r59830 4 4 5 5 /* 6 * Copyright (C) 2011-201 5Oracle Corporation6 * Copyright (C) 2011-2016 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 64 64 if (m_uMsg != uMsg) 65 65 { 66 LogFlowFunc(("Message type does not match (%u (buffer), %u (guest))\n", 67 m_uMsg, uMsg)); 66 LogFlowFunc(("Message type does not match (%RU32 (buffer), %RU32 (guest))\n", m_uMsg, uMsg)); 68 67 return VERR_INVALID_PARAMETER; 69 68 } 70 if (m_cParms !=cParms)69 if (m_cParms > cParms) 71 70 { 72 LogFlowFunc(("Parameter count does not match (%u (buffer), %u (guest))\n", 73 m_cParms, cParms)); 71 LogFlowFunc(("Parameter count does not match (%RU32 (buffer), %RU32 (guest))\n", m_cParms, cParms)); 74 72 return VERR_INVALID_PARAMETER; 75 73 } 76 74 77 int rc = copyParmsInternal(cParms, m_paParms, &aParms[0], false /* fCreatePtrs */); 78 79 // if (RT_FAILURE(rc)) 80 // cleanup(aParms); 81 return rc; 75 return copyParmsInternal(&aParms[0], cParms, m_paParms, m_cParms, false /* fDeepCopy */); 82 76 } 83 77 … … 117 111 } 118 112 119 static int copyParms( uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst)120 { 121 return copyParmsInternal( cParms, paParmsSrc, paParmsDst, false /* fCreatePtrs*/);113 static int copyParms(PVBOXHGCMSVCPARM paParmsDst, uint32_t cParmsDst, PVBOXHGCMSVCPARM paParmsSrc, uint32_t cParmsSrc) 114 { 115 return copyParmsInternal(paParmsDst, cParmsDst, paParmsSrc, cParmsSrc, false /* fDeepCopy */); 122 116 } 123 117 124 118 private: 125 119 126 uint32_t m_uMsg; 127 uint32_t m_cParms; 120 /** Stored message type. */ 121 uint32_t m_uMsg; 122 /** Number of stored HGCM parameters. */ 123 uint32_t m_cParms; 124 /** Stored HGCM parameters. */ 128 125 PVBOXHGCMSVCPARM m_paParms; 129 126 … … 146 143 } 147 144 148 int rc = copyParmsInternal(cParms, &aParms[0], m_paParms, true /* fCreatePtrs */); 149 145 int rc = copyParmsInternal(m_paParms, m_cParms, &aParms[0], cParms, true /* fDeepCopy */); 150 146 if (RT_FAILURE(rc)) 151 147 cleanup(); … … 154 150 } 155 151 156 static int copyParmsInternal(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst, bool fCreatePtrs) 157 { 152 static int copyParmsInternal(PVBOXHGCMSVCPARM paParmsDst, uint32_t cParmsDst, 153 PVBOXHGCMSVCPARM paParmsSrc, uint32_t cParmsSrc, 154 bool fDeepCopy) 155 { 156 AssertPtrReturn(paParmsSrc, VERR_INVALID_POINTER); 157 AssertPtrReturn(paParmsDst, VERR_INVALID_POINTER); 158 159 if (cParmsSrc > cParmsDst) 160 return VERR_BUFFER_OVERFLOW; 161 158 162 int rc = VINF_SUCCESS; 159 for (uint32_t i = 0; i < cParms ; ++i)163 for (uint32_t i = 0; i < cParmsSrc; i++) 160 164 { 161 165 paParmsDst[i].type = paParmsSrc[i].type; … … 174 178 case VBOX_HGCM_SVC_PARM_PTR: 175 179 { 176 /* Do we have to recreate the memory? */177 if (f CreatePtrs)180 /* Do we have to perform a deep copy? */ 181 if (fDeepCopy) 178 182 { 179 183 /* Yes, do so. */
Note:
See TracChangeset
for help on using the changeset viewer.