oleaut32: Fix safe array marshalling on 64-bit.

This commit is contained in:
Alexandre Julliard 2009-07-10 19:13:27 +02:00
parent a0b8ec0e1b
commit 74c985aad1
1 changed files with 11 additions and 11 deletions

View File

@ -232,7 +232,7 @@ static unsigned int get_type_size(ULONG *pFlags, VARTYPE vt)
case VT_DECIMAL: case VT_DECIMAL:
return sizeof(DECIMAL); return sizeof(DECIMAL);
case VT_BSTR: case VT_BSTR:
return sizeof(BSTR); return sizeof(ULONG);
case VT_VARIANT: case VT_VARIANT:
return sizeof(VARIANT); return sizeof(VARIANT);
case VT_UNKNOWN: case VT_UNKNOWN:
@ -764,7 +764,7 @@ ULONG WINAPI LPSAFEARRAY_UserSize(ULONG *pFlags, ULONG StartingSize, LPSAFEARRAY
HRESULT hr; HRESULT hr;
size += sizeof(ULONG); size += sizeof(ULONG);
size += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs); size += 2 * sizeof(USHORT) + 2 * sizeof(ULONG);
sftype = SAFEARRAY_GetUnionType(psa); sftype = SAFEARRAY_GetUnionType(psa);
size += sizeof(ULONG); size += sizeof(ULONG);
@ -850,23 +850,23 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf
VARTYPE vt; VARTYPE vt;
SAFEARRAY *psa = *ppsa; SAFEARRAY *psa = *ppsa;
ULONG ulCellCount = SAFEARRAY_GetCellCount(psa); ULONG ulCellCount = SAFEARRAY_GetCellCount(psa);
wireSAFEARRAY wiresa;
SF_TYPE sftype; SF_TYPE sftype;
GUID guid; GUID guid;
*(ULONG *)Buffer = psa->cDims; *(ULONG *)Buffer = psa->cDims;
Buffer += sizeof(ULONG); Buffer += sizeof(ULONG);
wiresa = (wireSAFEARRAY)Buffer; *(USHORT *)Buffer = psa->cDims;
wiresa->cDims = psa->cDims; Buffer += sizeof(USHORT);
wiresa->fFeatures = psa->fFeatures; *(USHORT *)Buffer = psa->fFeatures;
wiresa->cbElements = psa->cbElements; Buffer += sizeof(USHORT);
*(ULONG *)Buffer = psa->cbElements;
Buffer += sizeof(ULONG);
hr = SafeArrayGetVartype(psa, &vt); hr = SafeArrayGetVartype(psa, &vt);
if (FAILED(hr)) vt = 0; if (FAILED(hr)) vt = 0;
wiresa->cLocks = (USHORT)psa->cLocks | (vt << 16); *(ULONG *)Buffer = (USHORT)psa->cLocks | (vt << 16);
Buffer += sizeof(ULONG);
Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs);
sftype = SAFEARRAY_GetUnionType(psa); sftype = SAFEARRAY_GetUnionType(psa);
*(ULONG *)Buffer = sftype; *(ULONG *)Buffer = sftype;
@ -987,7 +987,7 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
Buffer += sizeof(ULONG); Buffer += sizeof(ULONG);
wiresa = (wireSAFEARRAY)Buffer; wiresa = (wireSAFEARRAY)Buffer;
Buffer += FIELD_OFFSET(struct _wireSAFEARRAY, uArrayStructs); Buffer += 2 * sizeof(USHORT) + 2 * sizeof(ULONG);
if (cDims != wiresa->cDims) if (cDims != wiresa->cDims)
RpcRaiseException(RPC_S_INVALID_BOUND); RpcRaiseException(RPC_S_INVALID_BOUND);