2009/2/9 Alexandre Julliard <julli...@winehq.org>: > Rob Shearman <robertshear...@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