winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2006
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
863 discussions
Start a n
N
ew thread
Robert Shearman : rpcrt4: Align conformances and variances correctly, according the the DCE/RPC spec.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: c3a087eb45abc725061d315a17a232cc697ed1d1 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=c3a087eb45abc725061d315…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:13:25 2006 +0100 rpcrt4: Align conformances and variances correctly, according the the DCE/RPC spec. --- dlls/rpcrt4/ndr_marshall.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index a3bdcf5..bbf9dd3 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -308,6 +308,7 @@ static inline BOOL IsConformanceOrVarian PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) { + ALIGN_POINTER(pStubMsg->Buffer, 4); pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); pStubMsg->Buffer += 4; TRACE("unmarshalled conformance is %ld\n", pStubMsg->MaxCount); @@ -326,6 +327,7 @@ static inline PFORMAT_STRING ReadVarianc goto done; } + ALIGN_POINTER(pStubMsg->Buffer, 4); pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); pStubMsg->Buffer += 4; TRACE("offset is %ld\n", pStubMsg->Offset); @@ -343,6 +345,7 @@ done: /* writes the conformance value to the buffer */ static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) { + ALIGN_POINTER(pStubMsg->Buffer, 4); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); pStubMsg->Buffer += 4; } @@ -350,6 +353,7 @@ static inline void WriteConformance(MIDL /* writes the variance values to the buffer */ static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) { + ALIGN_POINTER(pStubMsg->Buffer, 4); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); pStubMsg->Buffer += 4; NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount); @@ -359,12 +363,14 @@ static inline void WriteVariance(MIDL_ST /* requests buffer space for the conformance value */ static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) { + ALIGN_LENGTH(pStubMsg->BufferLength, 4); pStubMsg->BufferLength += 4; } /* requests buffer space for the variance values */ static inline void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg) { + ALIGN_LENGTH(pStubMsg->BufferLength, 4); pStubMsg->BufferLength += 8; }
1
0
0
0
Robert Shearman : rpcrt4: Move the writing and sizing of variances and conformances to common functions .
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 265045d251c0966fff6170168dbf84003a33444b URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=265045d251c0966fff61701…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:13:15 2006 +0100 rpcrt4: Move the writing and sizing of variances and conformances to common functions. --- dlls/rpcrt4/ndr_marshall.c | 88 +++++++++++++++++++++++++++----------------- 1 files changed, 53 insertions(+), 35 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index a4fa2d7..a3bdcf5 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -340,6 +340,34 @@ done: return pFormat+4; } +/* writes the conformance value to the buffer */ +static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) +{ + NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); + pStubMsg->Buffer += 4; +} + +/* writes the variance values to the buffer */ +static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) +{ + NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); + pStubMsg->Buffer += 4; + NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount); + pStubMsg->Buffer += 4; +} + +/* requests buffer space for the conformance value */ +static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) +{ + pStubMsg->BufferLength += 4; +} + +/* requests buffer space for the variance values */ +static inline void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg) +{ + pStubMsg->BufferLength += 8; +} + PFORMAT_STRING ComputeConformanceOrVariance( MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG_PTR def, ULONG *pCount) @@ -483,7 +511,6 @@ unsigned char *WINAPI NdrConformantStrin unsigned char *pszMessage, PFORMAT_STRING pFormat) { unsigned long len, esize; - unsigned char *c; TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat); @@ -510,15 +537,13 @@ unsigned char *WINAPI NdrConformantStrin assert( (pStubMsg->BufferLength >= (len*esize + 13)) && (pStubMsg->Buffer != NULL) ); - c = pStubMsg->Buffer; - memset(c, 0, 12); - NDR_LOCAL_UINT32_WRITE(c, len); /* max length: strlen + 1 (for '\0') */ - c += 8; /* offset: 0 */ - NDR_LOCAL_UINT32_WRITE(c, len); /* actual length: (same) */ - c += 4; - memcpy(c, pszMessage, len*esize); /* the string itself */ - c += len*esize; - pStubMsg->Buffer = c; + pStubMsg->MaxCount = pStubMsg->ActualCount = len; + pStubMsg->Offset = 0; + WriteConformance(pStubMsg); + WriteVariance(pStubMsg); + + memcpy(pStubMsg->Buffer, pszMessage, len*esize); /* the string itself */ + pStubMsg->Buffer += len*esize; STD_OVERFLOW_CHECK(pStubMsg); @@ -534,16 +559,19 @@ void WINAPI NdrConformantStringBufferSiz { TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat); + SizeConformance(pStubMsg); + SizeVariance(pStubMsg); + assert(pFormat); if (*pFormat == RPC_FC_C_CSTRING) { - /* we need 12 octets for the [maxlen, offset, len] DWORDS, + 1 octet for '\0' */ + /* we need + 1 octet for '\0' */ TRACE("string=%s\n", debugstr_a((char*)pMemory)); - pStubMsg->BufferLength += strlen((char*)pMemory) + 13 + BUFFER_PARANOIA; + pStubMsg->BufferLength += strlen((char*)pMemory) + 1 + BUFFER_PARANOIA; } else if (*pFormat == RPC_FC_C_WSTRING) { - /* we need 12 octets for the [maxlen, offset, len] DWORDS, + 2 octets for L'\0' */ + /* we need + 2 octets for L'\0' */ TRACE("string=%s\n", debugstr_w((LPWSTR)pMemory)); - pStubMsg->BufferLength += strlenW((LPWSTR)pMemory)*2 + 14 + BUFFER_PARANOIA; + pStubMsg->BufferLength += strlenW((LPWSTR)pMemory)*2 + 2 + BUFFER_PARANOIA; } else { ERR("Unhandled string type: %#x\n", *pFormat); @@ -1914,8 +1942,7 @@ unsigned char * WINAPI NdrConformantArra pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); size = pStubMsg->MaxCount; - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, size); - pStubMsg->Buffer += 4; + WriteConformance(pStubMsg); ALIGN_POINTER(pStubMsg->Buffer, alignment); @@ -1977,7 +2004,8 @@ void WINAPI NdrConformantArrayBufferSize pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); size = pStubMsg->MaxCount; - pStubMsg->BufferLength += 4; + + SizeVariance(pStubMsg); ALIGN_LENGTH(pStubMsg->BufferLength, alignment); @@ -2043,12 +2071,8 @@ unsigned char* WINAPI NdrConformantVaryi pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); - pStubMsg->Buffer += 4; - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); - pStubMsg->Buffer += 4; - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount); - pStubMsg->Buffer += 4; + WriteConformance(pStubMsg); + WriteVariance(pStubMsg); ALIGN_POINTER(pStubMsg->Buffer, alignment); @@ -2146,8 +2170,8 @@ void WINAPI NdrConformantVaryingArrayBuf /* compute length */ pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); - /* conformance + offset + variance */ - pStubMsg->BufferLength += 3 * sizeof(DWORD); + SizeConformance(pStubMsg); + SizeVariance(pStubMsg); ALIGN_LENGTH(pStubMsg->BufferLength, alignment); @@ -2200,15 +2224,9 @@ unsigned char * WINAPI NdrComplexArrayMa pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); TRACE("variance = %ld\n", pStubMsg->ActualCount); - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); - pStubMsg->Buffer += 4; + WriteConformance(pStubMsg); if (variance_present) - { - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); - pStubMsg->Buffer += 4; - NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount); - pStubMsg->Buffer += 4; - } + WriteVariance(pStubMsg); ALIGN_POINTER(pStubMsg->Buffer, alignment); @@ -2292,14 +2310,14 @@ void WINAPI NdrComplexArrayBufferSize(PM pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); TRACE("conformance = %ld\n", pStubMsg->MaxCount); - pStubMsg->BufferLength += sizeof(ULONG); + SizeConformance(pStubMsg); variance_present = IsConformanceOrVariancePresent(pFormat); pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); TRACE("variance = %ld\n", pStubMsg->ActualCount); if (variance_present) - pStubMsg->BufferLength += 2*sizeof(ULONG); + SizeVariance(pStubMsg); ALIGN_LENGTH(pStubMsg->BufferLength, alignment);
1
0
0
0
Robert Shearman : rpcrt4: Correctly align the buffer to read/ write array data to.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 4b4192f3a58a3d2addc1f385114f91b377e61848 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=4b4192f3a58a3d2addc1f38…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:12:52 2006 +0100 rpcrt4: Correctly align the buffer to read/write array data to. --- dlls/rpcrt4/ndr_marshall.c | 46 +++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 43 insertions(+), 3 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 567ae0b..a4fa2d7 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1906,6 +1906,8 @@ unsigned char * WINAPI NdrConformantArra PFORMAT_STRING pFormat) { DWORD size = 0, esize = *(const WORD*)(pFormat+2); + unsigned char alignment = pFormat[1] + 1; + TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); @@ -1915,6 +1917,8 @@ unsigned char * WINAPI NdrConformantArra NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, size); pStubMsg->Buffer += 4; + ALIGN_POINTER(pStubMsg->Buffer, alignment); + memcpy(pStubMsg->Buffer, pMemory, size*esize); pStubMsg->BufferMark = pStubMsg->Buffer; pStubMsg->Buffer += size*esize; @@ -1935,6 +1939,8 @@ unsigned char * WINAPI NdrConformantArra unsigned char fMustAlloc) { DWORD size = 0, esize = *(const WORD*)(pFormat+2); + unsigned char alignment = pFormat[1] + 1; + TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); @@ -1944,6 +1950,8 @@ unsigned char * WINAPI NdrConformantArra if (fMustAlloc || !*ppMemory) *ppMemory = NdrAllocate(pStubMsg, size*esize); + ALIGN_POINTER(pStubMsg->Buffer, alignment); + memcpy(*ppMemory, pStubMsg->Buffer, size*esize); pStubMsg->BufferMark = pStubMsg->Buffer; @@ -1962,14 +1970,19 @@ void WINAPI NdrConformantArrayBufferSize PFORMAT_STRING pFormat) { DWORD size = 0, esize = *(const WORD*)(pFormat+2); + unsigned char alignment = pFormat[1] + 1; + TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); if (pFormat[0] != RPC_FC_CARRAY) FIXME("format=%d\n", pFormat[0]); pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0); size = pStubMsg->MaxCount; + pStubMsg->BufferLength += 4; + + ALIGN_LENGTH(pStubMsg->BufferLength, alignment); /* conformance value plus array */ - pStubMsg->BufferLength += sizeof(DWORD) + size*esize; + pStubMsg->BufferLength += size*esize; EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); } @@ -2015,6 +2028,7 @@ unsigned char* WINAPI NdrConformantVaryi unsigned char* pMemory, PFORMAT_STRING pFormat ) { + unsigned char alignment = pFormat[1] + 1; DWORD esize = *(const WORD*)(pFormat+2); TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); @@ -2036,6 +2050,8 @@ unsigned char* WINAPI NdrConformantVaryi NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->ActualCount); pStubMsg->Buffer += 4; + ALIGN_POINTER(pStubMsg->Buffer, alignment); + memcpy(pStubMsg->Buffer, pMemory + pStubMsg->Offset, pStubMsg->ActualCount*esize); pStubMsg->BufferMark = pStubMsg->Buffer; pStubMsg->Buffer += pStubMsg->ActualCount*esize; @@ -2056,6 +2072,7 @@ unsigned char* WINAPI NdrConformantVaryi PFORMAT_STRING pFormat, unsigned char fMustAlloc ) { + unsigned char alignment = pFormat[1] + 1; DWORD esize = *(const WORD*)(pFormat+2); TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); @@ -2066,9 +2083,12 @@ unsigned char* WINAPI NdrConformantVaryi RpcRaiseException(RPC_S_INTERNAL_ERROR); return NULL; } + pFormat = ReadConformance(pStubMsg, pFormat); pFormat = ReadVariance(pStubMsg, pFormat); + ALIGN_POINTER(pStubMsg->Buffer, alignment); + if (!*ppMemory || fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, pStubMsg->MaxCount * esize); memcpy(*ppMemory + pStubMsg->Offset, pStubMsg->Buffer, pStubMsg->ActualCount * esize); @@ -2109,6 +2129,7 @@ void WINAPI NdrConformantVaryingArrayFre void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat ) { + unsigned char alignment = pFormat[1] + 1; DWORD esize = *(const WORD*)(pFormat+2); TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat); @@ -2125,8 +2146,12 @@ void WINAPI NdrConformantVaryingArrayBuf /* compute length */ pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0); - /* conformance + offset + variance + array */ - pStubMsg->BufferLength += 3*sizeof(DWORD) + pStubMsg->ActualCount*esize; + /* conformance + offset + variance */ + pStubMsg->BufferLength += 3 * sizeof(DWORD); + + ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + + pStubMsg->BufferLength += pStubMsg->ActualCount*esize; EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat); } @@ -2152,6 +2177,7 @@ unsigned char * WINAPI NdrComplexArrayMa { ULONG count, def; BOOL variance_present; + unsigned char alignment; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); @@ -2162,6 +2188,8 @@ unsigned char * WINAPI NdrComplexArrayMa return NULL; } + alignment = pFormat[1] + 1; + def = *(const WORD*)&pFormat[2]; pFormat += 4; @@ -2182,6 +2210,8 @@ unsigned char * WINAPI NdrComplexArrayMa pStubMsg->Buffer += 4; } + ALIGN_POINTER(pStubMsg->Buffer, alignment); + for (count = 0; count < pStubMsg->ActualCount; count++) pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL); @@ -2199,6 +2229,7 @@ unsigned char * WINAPI NdrComplexArrayUn unsigned char fMustAlloc) { ULONG count, esize; + unsigned char alignment; unsigned char *pMemory; TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); @@ -2210,6 +2241,8 @@ unsigned char * WINAPI NdrComplexArrayUn return NULL; } + alignment = pFormat[1] + 1; + pFormat += 4; pFormat = ReadConformance(pStubMsg, pFormat); @@ -2223,6 +2256,8 @@ unsigned char * WINAPI NdrComplexArrayUn memset(*ppMemory, 0, pStubMsg->MaxCount * esize); } + ALIGN_POINTER(pStubMsg->Buffer, alignment); + pMemory = *ppMemory; for (count = 0; count < pStubMsg->ActualCount; count++) pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc); @@ -2238,6 +2273,7 @@ void WINAPI NdrComplexArrayBufferSize(PM PFORMAT_STRING pFormat) { ULONG count, def; + unsigned char alignment; BOOL variance_present; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); @@ -2249,6 +2285,8 @@ void WINAPI NdrComplexArrayBufferSize(PM return; } + alignment = pFormat[1] + 1; + def = *(const WORD*)&pFormat[2]; pFormat += 4; @@ -2263,6 +2301,8 @@ void WINAPI NdrComplexArrayBufferSize(PM if (variance_present) pStubMsg->BufferLength += 2*sizeof(ULONG); + ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + for (count=0; count < pStubMsg->ActualCount; count++) pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL); }
1
0
0
0
Robert Shearman : rpcrt4: Correctly align the buffer before reading/ writing structure data.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 95d79e2c581d9ea734290c224c1cef1302b6358a URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=95d79e2c581d9ea734290c2…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:12:30 2006 +0100 rpcrt4: Correctly align the buffer before reading/writing structure data. --- dlls/rpcrt4/ndr_marshall.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index ac38bce..567ae0b 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1321,6 +1321,8 @@ unsigned char * WINAPI NdrSimpleStructMa unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); + ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + memcpy(pStubMsg->Buffer, pMemory, size); pStubMsg->BufferMark = pStubMsg->Buffer; pStubMsg->Buffer += size; @@ -1344,6 +1346,8 @@ unsigned char * WINAPI NdrSimpleStructUn unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); + ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + if (fMustAlloc) { *ppMemory = NdrAllocate(pStubMsg, size); memcpy(*ppMemory, pStubMsg->Buffer, size); @@ -1396,6 +1400,9 @@ void WINAPI NdrSimpleStructBufferSize(PM { unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); + + ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + pStubMsg->BufferLength += size; if (pFormat[0] != RPC_FC_STRUCT) EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat+4); @@ -1751,6 +1758,8 @@ unsigned char * WINAPI NdrComplexStructM TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); + ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + pFormat += 4; if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; @@ -1786,6 +1795,8 @@ unsigned char * WINAPI NdrComplexStructU TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); + ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + if (fMustAlloc || !*ppMemory) { *ppMemory = NdrAllocate(pStubMsg, size); @@ -1819,6 +1830,8 @@ void WINAPI NdrComplexStructBufferSize(P TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); + ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + pFormat += 4; if (*(const WORD*)pFormat) conf_array = pFormat + *(const WORD*)pFormat; pFormat += 2; @@ -2479,6 +2492,8 @@ unsigned char * WINAPI NdrConformantStr return NULL; } + ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1); + TRACE("memory_size = %d\n", pCStructFormat->memory_size); /* copy constant sized part of struct */ @@ -2516,6 +2531,8 @@ unsigned char * WINAPI NdrConformantStr return NULL; } + ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1); + TRACE("memory_size = %d\n", pCStructFormat->memory_size); /* work out how much memory to allocate if we need to do so */ @@ -2571,6 +2588,8 @@ void WINAPI NdrConformantStructBufferSiz return; } + ALIGN_LENGTH(pStubMsg->BufferLength, pCStructFormat->alignment + 1); + TRACE("memory_size = %d\n", pCStructFormat->memory_size); /* add constant sized part of struct to buffer size */
1
0
0
0
Robert Shearman : rpcrt4: Rename NonEncapsulatedUnionSize to NdrNonEncapsulatedUnionMemorySize.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 5616c4150c0ab97d5ecba67935fd86e492a5f48b URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=5616c4150c0ab97d5ecba67…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:12:20 2006 +0100 rpcrt4: Rename NonEncapsulatedUnionSize to NdrNonEncapsulatedUnionMemorySize. --- dlls/rpcrt4/ndr_marshall.c | 27 ++++++++++----------------- 1 files changed, 10 insertions(+), 17 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 836b6ca..ac38bce 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -1427,20 +1427,6 @@ void WINAPI NdrSimpleStructFree(PMIDL_ST } -static long NonEncapsulatedUnionSize(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat) -{ - pFormat += 2; - if (pStubMsg->fHasNewCorrDesc) - pFormat += 6; - else - pFormat += 4; - - pFormat += *(const SHORT*)pFormat; - TRACE("size %d\n", *(const SHORT*)pFormat); - return *(const SHORT*)pFormat; -} - unsigned long WINAPI EmbeddedComplexSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { @@ -1453,7 +1439,7 @@ unsigned long WINAPI EmbeddedComplexSize case RPC_FC_USER_MARSHAL: return *(const WORD*)&pFormat[4]; case RPC_FC_NON_ENCAPSULATED_UNION: - return NonEncapsulatedUnionSize(pStubMsg, pFormat); + return NdrNonEncapsulatedUnionMemorySize(pStubMsg, pFormat); default: FIXME("unhandled embedded type %02x\n", *pFormat); } @@ -3109,8 +3095,15 @@ void WINAPI NdrNonEncapsulatedUnionBuffe unsigned long WINAPI NdrNonEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - FIXME("stub\n"); - return 0; + pFormat += 2; + if (pStubMsg->fHasNewCorrDesc) + pFormat += 6; + else + pFormat += 4; + + pFormat += *(const SHORT*)pFormat; + TRACE("size %d\n", *(const SHORT*)pFormat); + return *(const SHORT*)pFormat; } /***********************************************************************
1
0
0
0
Robert Shearman : rpcrt4: Remove unintuitive requirement to pass the required alignment boundary minus one into the alignment macros .
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 75fe824e89154686ada6703efc939130448c5914 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=75fe824e89154686ada6703…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:12:07 2006 +0100 rpcrt4: Remove unintuitive requirement to pass the required alignment boundary minus one into the alignment macros. --- dlls/rpcrt4/ndr_marshall.c | 66 ++++++++++++++++++++++---------------------- 1 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 871bb57..836b6ca 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -90,9 +90,9 @@ # define NDR_LOCAL_UINT32_READ(pchar) \ LITTLE_ENDIAN_UINT32_READ(pchar) #endif -/* _Align must be the desired alignment minus 1, - * e.g. ALIGN_LENGTH(len, 3) to align on a dword boundary. */ -#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align)) +/* _Align must be the desired alignment, + * e.g. ALIGN_LENGTH(len, 4) to align on a dword boundary. */ +#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align)-1)&~((_Align)-1)) #define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align)) #define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align) #define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align) @@ -1494,10 +1494,10 @@ unsigned char * WINAPI ComplexMarshall(P pMemory += 4; break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 3); + ALIGN_POINTER(pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 7); + ALIGN_POINTER(pMemory, 8); break; case RPC_FC_STRUCTPAD2: pMemory += 2; @@ -1560,10 +1560,10 @@ unsigned char * WINAPI ComplexUnmarshall pMemory += 4; break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 3); + ALIGN_POINTER(pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 7); + ALIGN_POINTER(pMemory, 8); break; case RPC_FC_STRUCTPAD2: pMemory += 2; @@ -1620,10 +1620,10 @@ unsigned char * WINAPI ComplexBufferSize pMemory += 4; break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 3); + ALIGN_POINTER(pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 7); + ALIGN_POINTER(pMemory, 8); break; case RPC_FC_STRUCTPAD2: pMemory += 2; @@ -1676,10 +1676,10 @@ unsigned char * WINAPI ComplexFree(PMIDL pMemory += 4; break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 3); + ALIGN_POINTER(pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 7); + ALIGN_POINTER(pMemory, 8); break; case RPC_FC_STRUCTPAD2: pMemory += 2; @@ -1726,10 +1726,10 @@ unsigned long WINAPI ComplexStructSize(P size += 4; break; case RPC_FC_ALIGNM4: - ALIGN_LENGTH(size, 3); + ALIGN_LENGTH(size, 4); break; case RPC_FC_ALIGNM8: - ALIGN_LENGTH(size, 7); + ALIGN_LENGTH(size, 8); break; case RPC_FC_STRUCTPAD2: size += 2; @@ -2976,13 +2976,13 @@ static long unmarshall_discriminant(PMID case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); discriminant = *(USHORT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(USHORT); break; case RPC_FC_LONG: case RPC_FC_ULONG: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); discriminant = *(ULONG *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(ULONG); break; @@ -3252,7 +3252,7 @@ static unsigned char *WINAPI NdrBaseType case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); *(USHORT *)pStubMsg->Buffer = *(USHORT *)pMemory; pStubMsg->Buffer += sizeof(USHORT); TRACE("value: 0x%04x\n", *(USHORT *)pMemory); @@ -3261,23 +3261,23 @@ static unsigned char *WINAPI NdrBaseType case RPC_FC_ULONG: case RPC_FC_ERROR_STATUS_T: case RPC_FC_ENUM32: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); *(ULONG *)pStubMsg->Buffer = *(ULONG *)pMemory; pStubMsg->Buffer += sizeof(ULONG); TRACE("value: 0x%08lx\n", *(ULONG *)pMemory); break; case RPC_FC_FLOAT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(float) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(float)); *(float *)pStubMsg->Buffer = *(float *)pMemory; pStubMsg->Buffer += sizeof(float); break; case RPC_FC_DOUBLE: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(double) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(double)); *(double *)pStubMsg->Buffer = *(double *)pMemory; pStubMsg->Buffer += sizeof(double); break; case RPC_FC_HYPER: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG)); *(ULONGLONG *)pStubMsg->Buffer = *(ULONGLONG *)pMemory; pStubMsg->Buffer += sizeof(ULONGLONG); TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory)); @@ -3286,7 +3286,7 @@ static unsigned char *WINAPI NdrBaseType /* only 16-bits on the wire, so do a sanity check */ if (*(UINT *)pMemory > USHRT_MAX) RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE); - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); *(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory; pStubMsg->Buffer += sizeof(USHORT); TRACE("value: 0x%04x\n", *(UINT *)pMemory); @@ -3330,7 +3330,7 @@ static unsigned char *WINAPI NdrBaseType case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); **(USHORT **)ppMemory = *(USHORT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(USHORT); TRACE("value: 0x%04x\n", **(USHORT **)ppMemory); @@ -3339,31 +3339,31 @@ static unsigned char *WINAPI NdrBaseType case RPC_FC_ULONG: case RPC_FC_ERROR_STATUS_T: case RPC_FC_ENUM32: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); **(ULONG **)ppMemory = *(ULONG *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(ULONG); TRACE("value: 0x%08lx\n", **(ULONG **)ppMemory); break; case RPC_FC_FLOAT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(float) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(float)); **(float **)ppMemory = *(float *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(float); TRACE("value: %f\n", **(float **)ppMemory); break; case RPC_FC_DOUBLE: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(double) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(double)); **(double **)ppMemory = *(double*)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(double); TRACE("value: %f\n", **(double **)ppMemory); break; case RPC_FC_HYPER: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG)); **(ULONGLONG **)ppMemory = *(ULONGLONG *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(ULONGLONG); TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory)); break; case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT) - 1); + ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); /* 16-bits on the wire, but int in memory */ **(UINT **)ppMemory = *(USHORT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(USHORT); @@ -3400,29 +3400,29 @@ static void WINAPI NdrBaseTypeBufferSize case RPC_FC_SHORT: case RPC_FC_USHORT: case RPC_FC_ENUM16: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT)); pStubMsg->BufferLength += sizeof(USHORT); break; case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG)); pStubMsg->BufferLength += sizeof(ULONG); break; case RPC_FC_FLOAT: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float)); pStubMsg->BufferLength += sizeof(float); break; case RPC_FC_DOUBLE: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double)); pStubMsg->BufferLength += sizeof(double); break; case RPC_FC_HYPER: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG)); pStubMsg->BufferLength += sizeof(ULONGLONG); break; case RPC_FC_ERROR_STATUS_T: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t) - 1); + ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t)); pStubMsg->BufferLength += sizeof(error_status_t); break; default:
1
0
0
0
Robert Shearman : ole32: Exception handling shouldn' t be needed around the call to IRpcStubBuffer_Invoke.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: af6d97ad36df10288f3f224ff6515e426a8db63c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=af6d97ad36df10288f3f224…
Author: Robert Shearman <rob(a)codeweavers.com> Date: Wed May 10 13:11:49 2006 +0100 ole32: Exception handling shouldn't be needed around the call to IRpcStubBuffer_Invoke. It should have its own exception handler to catch any exceptions that are raised. --- dlls/ole32/rpc.c | 20 ++------------------ 1 files changed, 2 insertions(+), 18 deletions(-) diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c index d849c6e..4152198 100644 --- a/dlls/ole32/rpc.c +++ b/dlls/ole32/rpc.c @@ -43,9 +43,7 @@ #include "rpc.h" #include "winerror.h" #include "winreg.h" #include "wtypes.h" -#include "excpt.h" #include "wine/unicode.h" -#include "wine/exception.h" #include "compobj_private.h" @@ -114,13 +112,6 @@ struct dispatch_params HRESULT hr; /* hresult (out) */ }; -static WINE_EXCEPTION_FILTER(ole_filter) -{ - if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) - return EXCEPTION_CONTINUE_SEARCH; - return EXCEPTION_EXECUTE_HANDLER; -} - static HRESULT WINAPI RpcChannelBuffer_QueryInterface(LPRPCCHANNELBUFFER iface, REFIID riid, LPVOID *ppv) { *ppv = NULL; @@ -510,15 +501,8 @@ HRESULT RPC_CreateServerChannel(IRpcChan void RPC_ExecuteCall(struct dispatch_params *params) { - __TRY - { - params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan); - } - __EXCEPT(ole_filter) - { - params->hr = GetExceptionCode(); - } - __ENDTRY + params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan); + IRpcStubBuffer_Release(params->stub); IRpcChannelBuffer_Release(params->chan); if (params->handle) SetEvent(params->handle);
1
0
0
0
Huw Davies : oleaut32: Correctly handle the case when the number of bytes in a BSTR is odd.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 40986cd729afbbcffa4afca1c7815ff2f5492793 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=40986cd729afbbcffa4afca…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed May 10 12:41:32 2006 +0100 oleaut32: Correctly handle the case when the number of bytes in a BSTR is odd. --- dlls/oleaut32/tests/usrmarshal.c | 88 +++++++++++++++++++++++++++++++++----- dlls/oleaut32/usrmarshal.c | 21 +++++---- 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/dlls/oleaut32/tests/usrmarshal.c b/dlls/oleaut32/tests/usrmarshal.c index b0f3808..4433f50 100644 --- a/dlls/oleaut32/tests/usrmarshal.c +++ b/dlls/oleaut32/tests/usrmarshal.c @@ -227,20 +227,20 @@ static void test_marshal_LPSAFEARRAY(voi static void check_bstr(void *buffer, BSTR b) { DWORD *wireb = buffer; - DWORD len = SysStringLen(b); + DWORD len = SysStringByteLen(b); - ok(*wireb == len, "wv[0] %08lx\n", *wireb); + ok(*wireb == (len + 1) / 2, "wv[0] %08lx\n", *wireb); wireb++; - if(len) - ok(*wireb == len * 2, "wv[1] %08lx\n", *wireb); + if(b) + ok(*wireb == len, "wv[1] %08lx\n", *wireb); else ok(*wireb == 0xffffffff, "wv[1] %08lx\n", *wireb); wireb++; - ok(*wireb == len, "wv[2] %08lx\n", *wireb); + ok(*wireb == (len + 1) / 2, "wv[2] %08lx\n", *wireb); if(len) { wireb++; - ok(!memcmp(wireb, b, len * 2), "strings differ\n"); + ok(!memcmp(wireb, b, (len + 1) & ~1), "strings differ\n"); } return; } @@ -250,7 +250,7 @@ static void test_marshal_BSTR(void) unsigned long size; MIDL_STUB_MESSAGE stubMsg = { 0 }; USER_MARSHAL_CB umcb = { 0 }; - unsigned char *buffer; + unsigned char *buffer, *next; BSTR b, b2; WCHAR str[] = {'m','a','r','s','h','a','l',' ','t','e','s','t','1',0}; DWORD len; @@ -271,14 +271,16 @@ static void test_marshal_BSTR(void) ok(size == 38, "size %ld\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); - BSTR_UserMarshal(&umcb.Flags, buffer, &b); + next = BSTR_UserMarshal(&umcb.Flags, buffer, &b); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); check_bstr(buffer, b); if (BSTR_UNMARSHAL_WORKS) { b2 = NULL; - BSTR_UserUnmarshal(&umcb.Flags, buffer, &b2); - ok(b2 != NULL, "NULL LPSAFEARRAY didn't unmarshal\n"); + next = BSTR_UserUnmarshal(&umcb.Flags, buffer, &b2); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + ok(b2 != NULL, "BSTR didn't unmarshal\n"); ok(!memcmp(b, b2, (len + 1) * 2), "strings differ\n"); BSTR_UserFree(&umcb.Flags, &b2); } @@ -291,11 +293,75 @@ static void test_marshal_BSTR(void) ok(size == 12, "size %ld\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); - BSTR_UserMarshal(&umcb.Flags, buffer, &b); + next = BSTR_UserMarshal(&umcb.Flags, buffer, &b); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); check_bstr(buffer, b); + if (BSTR_UNMARSHAL_WORKS) + { + b2 = NULL; + next = BSTR_UserUnmarshal(&umcb.Flags, buffer, &b2); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + ok(b2 == NULL, "NULL BSTR didn't unmarshal\n"); + BSTR_UserFree(&umcb.Flags, &b2); + } HeapFree(GetProcessHeap(), 0, buffer); + b = SysAllocStringByteLen("abc", 3); + *(((char*)b) + 3) = 'd'; + len = SysStringLen(b); + ok(len == 1, "get %ld\n", len); + len = SysStringByteLen(b); + ok(len == 3, "get %ld\n", len); + + size = BSTR_UserSize(&umcb.Flags, 0, &b); + ok(size == 16, "size %ld\n", size); + + buffer = HeapAlloc(GetProcessHeap(), 0, size); + memset(buffer, 0xcc, size); + next = BSTR_UserMarshal(&umcb.Flags, buffer, &b); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + check_bstr(buffer, b); + ok(buffer[15] == 'd', "buffer[15] %02x\n", buffer[15]); + + if (BSTR_UNMARSHAL_WORKS) + { + b2 = NULL; + next = BSTR_UserUnmarshal(&umcb.Flags, buffer, &b2); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + ok(b2 != NULL, "BSTR didn't unmarshal\n"); + ok(!memcmp(b, b2, len), "strings differ\n"); + BSTR_UserFree(&umcb.Flags, &b2); + } + HeapFree(GetProcessHeap(), 0, buffer); + SysFreeString(b); + + b = SysAllocStringByteLen("", 0); + len = SysStringLen(b); + ok(len == 0, "get %ld\n", len); + len = SysStringByteLen(b); + ok(len == 0, "get %ld\n", len); + + size = BSTR_UserSize(&umcb.Flags, 0, &b); + ok(size == 12, "size %ld\n", size); + + buffer = HeapAlloc(GetProcessHeap(), 0, size); + next = BSTR_UserMarshal(&umcb.Flags, buffer, &b); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + check_bstr(buffer, b); + + if (BSTR_UNMARSHAL_WORKS) + { + b2 = NULL; + next = BSTR_UserUnmarshal(&umcb.Flags, buffer, &b2); + ok(next == buffer + size, "got %p expect %p\n", next, buffer + size); + ok(b2 != NULL, "NULL LPSAFEARRAY didn't unmarshal\n"); + len = SysStringByteLen(b2); + ok(len == 0, "byte len %ld\n", len); + BSTR_UserFree(&umcb.Flags, &b2); + } + HeapFree(GetProcessHeap(), 0, buffer); + SysFreeString(b); } static void check_variant_header(DWORD *wirev, VARIANT *v, unsigned long size) diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c index 002df90..dd397c0 100644 --- a/dlls/oleaut32/usrmarshal.c +++ b/dlls/oleaut32/usrmarshal.c @@ -152,7 +152,7 @@ unsigned long WINAPI BSTR_UserSize(unsig TRACE("(%lx,%ld,%p) => %p\n", *pFlags, Start, pstr, *pstr); if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr)); ALIGN_LENGTH(Start, 3); - Start += sizeof(bstr_wire_t) + sizeof(OLECHAR) * (SysStringLen(*pstr)); + Start += sizeof(bstr_wire_t) + ((SysStringByteLen(*pstr) + 1) & ~1); TRACE("returning %ld\n", Start); return Start; } @@ -160,19 +160,21 @@ unsigned long WINAPI BSTR_UserSize(unsig unsigned char * WINAPI BSTR_UserMarshal(unsigned long *pFlags, unsigned char *Buffer, BSTR *pstr) { bstr_wire_t *header; + DWORD len = SysStringByteLen(*pstr); + TRACE("(%lx,%p,%p) => %p\n", *pFlags, Buffer, pstr, *pstr); if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr)); ALIGN_POINTER(Buffer, 3); header = (bstr_wire_t*)Buffer; - header->len = header->len2 = SysStringLen(*pstr); - if (header->len) + header->len = header->len2 = (len + 1) / 2; + if (*pstr) { - header->byte_len = header->len * sizeof(OLECHAR); - memcpy(header + 1, *pstr, header->byte_len); + header->byte_len = len; + memcpy(header + 1, *pstr, header->len * 2); } else - header->byte_len = 0xffffffff; /* special case for an empty string */ + header->byte_len = 0xffffffff; /* special case for a null bstr */ return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len; } @@ -187,14 +189,15 @@ unsigned char * WINAPI BSTR_UserUnmarsha if(header->len != header->len2) FIXME("len %08lx != len2 %08lx\n", header->len, header->len2); - if(header->len) - SysReAllocStringLen(pstr, (OLECHAR*)(header + 1), header->len); - else if (*pstr) + if(*pstr) { SysFreeString(*pstr); *pstr = NULL; } + if(header->byte_len != 0xffffffff) + *pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len); + if (*pstr) TRACE("string=%s\n", debugstr_w(*pstr)); return Buffer + sizeof(*header) + sizeof(OLECHAR) * header->len; }
1
0
0
0
Huw Davies : oleaut32: Support VT_SAFEARRAY in the typelib marshaler.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: 86d9457cdc0307e0594cd352c6c57c091e40d084 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=86d9457cdc0307e0594cd35…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed May 10 12:11:22 2006 +0100 oleaut32: Support VT_SAFEARRAY in the typelib marshaler. Based on a patch by Rob Shearman. --- dlls/oleaut32/tmarshal.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index 0a6e939..139662d 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -42,6 +42,7 @@ #include "winreg.h" #include "winuser.h" #include "ole2.h" +#include "propidl.h" /* for LPSAFEARRAY_User* functions */ #include "typelib.h" #include "variant.h" #include "wine/debug.h" @@ -802,6 +803,17 @@ serialize_param( if (debugout) TRACE_(olerelay)("]"); return S_OK; } + case VT_SAFEARRAY: { + if (writeit) + { + unsigned long flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION); + unsigned long size = LPSAFEARRAY_UserSize(&flags, buf->curoff, (LPSAFEARRAY *)arg); + xbuf_resize(buf, size); + LPSAFEARRAY_UserMarshal(&flags, buf->base + buf->curoff, (LPSAFEARRAY *)arg); + buf->curoff = size; + } + return S_OK; + } default: ERR("Unhandled marshal type %d.\n",tdesc->vt); return S_OK; @@ -1131,6 +1143,16 @@ deserialize_param( ); return S_OK; } + case VT_SAFEARRAY: { + if (readit) + { + unsigned long flags = MAKELONG(MSHCTX_DIFFERENTMACHINE, NDR_LOCAL_DATA_REPRESENTATION); + unsigned char *buffer; + buffer = LPSAFEARRAY_UserUnmarshal(&flags, buf->base + buf->curoff, (LPSAFEARRAY *)arg); + buf->curoff = buffer - buf->base; + } + return S_OK; + } default: ERR("No handler for VT type %d!\n",tdesc->vt); return S_OK;
1
0
0
0
Huw Davies : oleaut32: Add a function to grow the marshal state buffer to a specified size.
by Alexandre Julliard
10 May '06
10 May '06
Module: wine Branch: refs/heads/master Commit: d0bdf685f56414de7d4d1a0254d3d2d6ef88e67a URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=d0bdf685f56414de7d4d1a0…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed May 10 11:55:37 2006 +0100 oleaut32: Add a function to grow the marshal state buffer to a specified size. --- dlls/oleaut32/tmarshal.c | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index 249524a..0a6e939 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -68,19 +68,35 @@ static char *relaystr(WCHAR *in) { } static HRESULT -xbuf_add(marshal_state *buf, LPBYTE stuff, DWORD size) { - while (buf->size - buf->curoff < size) { - if (buf->base) { - buf->size += 100; - buf->base = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,buf->base,buf->size); - if (!buf->base) - return E_OUTOFMEMORY; - } else { - buf->base = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,32); - buf->size = 32; - if (!buf->base) - return E_OUTOFMEMORY; - } +xbuf_resize(marshal_state *buf, DWORD newsize) +{ + if(buf->size >= newsize) + return S_FALSE; + + if(buf->base) + { + buf->base = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buf->base, newsize); + if(!buf->base) + return E_OUTOFMEMORY; + } + else + { + buf->base = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newsize); + if(!buf->base) + return E_OUTOFMEMORY; + } + return S_OK; +} + +static HRESULT +xbuf_add(marshal_state *buf, LPBYTE stuff, DWORD size) +{ + HRESULT hr; + + if(buf->size - buf->curoff < size) + { + hr = xbuf_resize(buf, buf->size + size + 100); + if(FAILED(hr)) return hr; } memcpy(buf->base+buf->curoff,stuff,size); buf->curoff += size;
1
0
0
0
← Newer
1
...
55
56
57
58
59
60
61
...
87
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Results per page:
10
25
50
100
200