oleaut32: Fix SAFEARRAY marshalling on 64-bit platforms.

Rob Shearman robertshearman at gmail.com
Mon Feb 9 07:56:15 CST 2009


2009/2/9 Alexandre Julliard <julliard at winehq.org>:
> Rob Shearman <robertshearman at gmail.com> writes:
>
>> @@ -874,8 +874,8 @@ unsigned char * WINAPI LPSAFEARRAY_UserMarshal(ULONG *pFlags, unsigned char *Buf
>>
>>          *(ULONG *)Buffer = ulCellCount;
>>          Buffer += sizeof(ULONG);
>> -        *(ULONG_PTR *)Buffer = (ULONG_PTR)psa->pvData;
>> -        Buffer += sizeof(ULONG_PTR);
>> +        *(ULONG *)Buffer = (ULONG)(ULONG_PTR)psa->pvData;
>> +        Buffer += sizeof(ULONG);
>
> Wouldn't this break if the pointer happens to be 4Gb-aligned?

It would write 0 into memory, yes, but the value written here isn't
used during unmarshalling so it is fine and I believe this matches
what native does.

If we wanted to relax the tests, we could change this to "*(ULONG
*)Buffer = psa->pvData ? 0x2 : 0x0" and check the value during
unmarshalling to be totally correct with the NDR-formatted data that
we are writing.

-- 
Rob Shearman



More information about the wine-devel mailing list