Rob Shearman <robertshear...@gmail.com> writes: > 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.
The exact value doesn't matter, but it seems to me that it won't get unmarshaled correctly if the value happens to be 0. Am I missing something? > 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. Without relaxing the tests you could still write the pointer and only store 0x2 when you would have stored 0 for a non-null pointer. -- Alexandre Julliard julli...@winehq.org