Changeset 55353 in vbox for trunk/include/VBox
- Timestamp:
- Apr 21, 2015 1:10:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/Service.h
r50561 r55353 41 41 class Message 42 42 { 43 /* Contains a copy of HGCM parameters. */ 43 44 public: 44 45 Message(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) … … 47 48 , m_paParms(0) 48 49 { 49 setData(uMsg, cParms, aParms);50 initData(uMsg, cParms, aParms); 50 51 } 51 52 ~Message() … … 72 73 } 73 74 74 int rc = copyParms (cParms, m_paParms, &aParms[0], false /* fCreatePtrs */);75 int rc = copyParmsInternal(cParms, m_paParms, &aParms[0], false /* fCreatePtrs */); 75 76 76 77 // if (RT_FAILURE(rc)) 77 78 // cleanup(aParms); 78 return rc;79 }80 int setData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[])81 {82 AssertReturn(cParms < 256, VERR_INVALID_PARAMETER);83 AssertPtrNullReturn(aParms, VERR_INVALID_PARAMETER);84 85 /* Cleanup old messages. */86 cleanup();87 88 m_uMsg = uMsg;89 m_cParms = cParms;90 91 if (cParms > 0)92 {93 m_paParms = (VBOXHGCMSVCPARM*)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * m_cParms);94 if (!m_paParms)95 return VERR_NO_MEMORY;96 }97 98 int rc = copyParms(cParms, &aParms[0], m_paParms, true /* fCreatePtrs */);99 100 if (RT_FAILURE(rc))101 cleanup();102 103 79 return rc; 104 80 } … … 137 113 } 138 114 139 int copyParms(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst, bool fCreatePtrs) const 115 int copyParms(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst) const 116 { 117 return copyParmsInternal(cParms, paParmsSrc, paParmsDst, false /* fCreatePtrs */); 118 } 119 120 private: 121 uint32_t m_uMsg; 122 uint32_t m_cParms; 123 PVBOXHGCMSVCPARM m_paParms; 124 125 int initData(uint32_t uMsg, uint32_t cParms, VBOXHGCMSVCPARM aParms[]) 126 { 127 AssertReturn(cParms < 256, VERR_INVALID_PARAMETER); 128 AssertPtrNullReturn(aParms, VERR_INVALID_PARAMETER); 129 130 /* Cleanup old messages. */ 131 cleanup(); 132 133 m_uMsg = uMsg; 134 m_cParms = cParms; 135 136 if (cParms > 0) 137 { 138 m_paParms = (VBOXHGCMSVCPARM*)RTMemAllocZ(sizeof(VBOXHGCMSVCPARM) * m_cParms); 139 if (!m_paParms) 140 return VERR_NO_MEMORY; 141 } 142 143 int rc = copyParmsInternal(cParms, &aParms[0], m_paParms, true /* fCreatePtrs */); 144 145 if (RT_FAILURE(rc)) 146 cleanup(); 147 148 return rc; 149 } 150 151 int copyParmsInternal(uint32_t cParms, PVBOXHGCMSVCPARM paParmsSrc, PVBOXHGCMSVCPARM paParmsDst, bool fCreatePtrs) const 140 152 { 141 153 int rc = VINF_SUCCESS; … … 219 231 m_uMsg = 0; 220 232 } 221 222 protected:223 uint32_t m_uMsg;224 uint32_t m_cParms;225 PVBOXHGCMSVCPARM m_paParms;226 233 }; 227 234
Note:
See TracChangeset
for help on using the changeset viewer.