Changeset 3099 in vbox for trunk/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
- Timestamp:
- Jun 12, 2007 4:48:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp
r3097 r3099 28 28 #include <iprt/string.h> 29 29 #include <iprt/assert.h> 30 #include <iprt/alloca.h>31 30 32 31 /* These functions can be only used by VBoxGuest. */ … … 128 127 VMMDevHGCMCall *pHGCMCall; 129 128 uint32_t cbParms; 129 HGCMFunctionParameter *pParm; 130 unsigned iParm; 130 131 int rc; 131 132 … … 146 147 if (VBOX_SUCCESS(rc)) 147 148 { 148 void **papvCtx = NULL; 149 void *apvCtx[VBOX_HGCM_MAX_PARMS]; 150 memset (apvCtx, 0, sizeof (apvCtx)); 149 151 150 152 /* Initialize request memory */ … … 158 160 if (cbParms) 159 161 { 160 HGCMFunctionParameter *pParm;161 162 162 memcpy (VMMDEV_HGCM_CALL_PARMS(pHGCMCall), VBOXGUEST_HGCM_CALL_PARMS(pCallInfo), cbParms); 163 163 164 164 /* Lock user buffers. */ 165 if (pCallInfo->cParms > 0)166 {167 papvCtx = (void **)alloca(pCallInfo->cParms * sizeof (papvCtx[0]));168 memset (papvCtx, 0, pCallInfo->cParms * sizeof (papvCtx[0]));169 }170 171 165 pParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo); 172 unsigned iParm = 0; 173 for ( ; iParm < pCallInfo->cParms; iParm++, pParm++)166 167 for (iParm = 0; iParm < pCallInfo->cParms; iParm++, pParm++) 174 168 { 175 169 if ( pParm->type == VMMDevHGCMParmType_LinAddr_In … … 177 171 || pParm->type == VMMDevHGCMParmType_LinAddr) 178 172 { 179 rc = vbglLockLinear (& papvCtx[iParm], (void *)pParm->u.Pointer.u.linearAddr, pParm->u.Pointer.size);173 rc = vbglLockLinear (&apvCtx[iParm], (void *)pParm->u.Pointer.u.linearAddr, pParm->u.Pointer.size); 180 174 181 175 if (VBOX_FAILURE (rc)) … … 240 234 241 235 /* Unlock user buffers. */ 242 if (papvCtx != NULL) 243 { 244 HGCMFunctionParameter *pParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo); 245 246 unsigned iParm = 0; 247 for (; iParm < pCallInfo->cParms; iParm++, pParm++) 248 { 249 if ( pParm->type == VMMDevHGCMParmType_LinAddr_In 250 || pParm->type == VMMDevHGCMParmType_LinAddr_Out 251 || pParm->type == VMMDevHGCMParmType_LinAddr) 252 { 253 if (papvCtx[iParm] != NULL) 254 { 255 vbglUnlockLinear (papvCtx[iParm], (void *)pParm->u.Pointer.u.linearAddr, pParm->u.Pointer.size); 256 } 236 pParm = VBOXGUEST_HGCM_CALL_PARMS(pCallInfo); 237 238 for (iParm = 0; iParm < pCallInfo->cParms; iParm++, pParm++) 239 { 240 if ( pParm->type == VMMDevHGCMParmType_LinAddr_In 241 || pParm->type == VMMDevHGCMParmType_LinAddr_Out 242 || pParm->type == VMMDevHGCMParmType_LinAddr) 243 { 244 if (apvCtx[iParm] != NULL) 245 { 246 vbglUnlockLinear (apvCtx[iParm], (void *)pParm->u.Pointer.u.linearAddr, pParm->u.Pointer.size); 257 247 } 258 248 }
Note:
See TracChangeset
for help on using the changeset viewer.