zzzzzz not a very exciting patch. I think NDR allows various endiannesses depending on the headers... not sure how we'll deal with that yet; first things first: I want hello world, then I'll start worrying about actual compliance with the spec. LICENSE: X11 CHANGELOG: * dlls/rpcrt4/ndr_marshall.c: Greg Turner <gmturner007@ameritech.net> - Fix endianness dependency in the (there is only one :) ) marshall function. -- gmt "The purpose of government is to rein in the rights of the people" --President Bill Clinton, MTV interview, 1993
diff -ur -x CVS -x 'bigdif*' ../wine.test/dlls/rpcrt4/ndr_marshall.c ./dlls/rpcrt4/ndr_marshall.c --- ../wine.test/dlls/rpcrt4/ndr_marshall.c 2002-10-26 04:02:37.000000000 -0500 +++ ./dlls/rpcrt4/ndr_marshall.c 2002-10-26 13:30:34.000000000 -0500 @@ -42,6 +42,27 @@ #define BUFFER_PARANOIA 40 +#if defined(__i386__) + #define LITTLE_ENDIAN_32_WRITE(pchar, word32) \ + (*((UINT32 *)(pchar)) = (word32)) + + #define LITTLE_ENDIAN_32_READ(pchar) \ + (*((UINT32 *)(pchar))) +#else + /* these would work for i386 too, but less efficient */ + #define LITTLE_ENDIAN_32_WRITE(pchar, word32) \ + (*(pchar) = LOBYTE(LOWORD(word32)), \ + *((pchar)+1) = HIBYTE(LOWORD(word32)), \ + *((pchar)+2) = LOBYTE(HIWORD(word32)), \ + *((pchar)+3) = HIBYTE(HIWORD(word32)), \ + (word32)) + + #define LITTLE_ENDIAN_32_READ(pchar) \ + (MAKELONG( \ + MAKEWORD(*(pchar), *((pchar)+1)) \ + MAKEWORD(*((pchar)+2), *((pchar)+3))) +#endif + /*********************************************************************** * NdrConformantStringMarshall [RPCRT4.@] */ @@ -59,9 +80,9 @@ /* in DCE terminology this is a Conformant Varying String */ c = pStubMsg->Buffer; memset(c, 0, 12); - *((UINT32 *)c) = len + 1; /* max length: strlen + 1 (for '\0') */ - c += 8; /* offset: 0 */ - *((UINT32 *)c) = len + 1; /* actual length: (same) */ + LITTLE_ENDIAN_32_WRITE(c, len + 1); /* max length: strlen + 1 (for '\0') */ + c += 8; /* offset: 0 */ + LITTLE_ENDIAN_32_WRITE(c, len + 1); /* actual length: (same) */ c += 4; for (i = 0; i <= len; i++) *(c++) = *(pszMessage++); /* copy the string itself into the remaining space */