Changeset 55752 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 8, 2015 12:16:58 PM (10 years ago)
- Location:
- trunk/src/VBox/Main/cbinding
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/cbinding/VBoxCAPI.cpp
r54027 r55752 210 210 return S_OK; 211 211 #else /* !VBOX_WITH_XPCOM */ 212 VARTYPE vt = VT_UNKNOWN; 213 HRESULT rc = SafeArrayGetVartype(psa, &vt); 214 if (FAILED(rc)) 215 return rc; 216 if (vt == VT_BSTR) 217 { 218 /* Special treatment: strings are to be freed explicitly, see sample 219 * C binding code, so zap it here. No way to reach compatible code 220 * behavior between COM and XPCOM without this kind of trickery. */ 221 void *pData; 222 rc = SafeArrayAccessData(psa, &pData); 223 if (FAILED(rc)) 224 return rc; 225 ULONG cbElement = VBoxVTElemSize(vt); 226 if (!cbElement) 227 return E_INVALIDARG; 228 Assert(cbElement = psa->cbElements); 229 ULONG cElements = psa->rgsabound[0].cElements; 230 memset(pData, '\0', cbElement * cElements); 231 SafeArrayUnaccessData(psa); 232 } 212 233 return SafeArrayDestroy(psa); 213 234 #endif /* !VBOX_WITH_XPCOM */ -
trunk/src/VBox/Main/cbinding/tstCAPIGlue.c
r55400 r55752 9 9 10 10 /* 11 * Copyright (C) 2009-201 4Oracle Corporation11 * Copyright (C) 2009-2015 Oracle Corporation 12 12 * 13 13 * This file is part of VirtualBox Open Source Edition (OSE), as … … 756 756 ULONG i, cGroups; 757 757 g_pVBoxFuncs->pfnSafeArrayCopyOutParamHelper((void **)&groups, &cbGroups, VT_BSTR, groupsSA); 758 g_pVBoxFuncs->pfnSafeArrayDestroy(groupsSA); 758 759 cGroups = cbGroups / sizeof(groups[0]); 759 760 for (i = 0; i < cGroups; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.