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
June 2008
----- 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
944 discussions
Start a n
N
ew thread
Rob Shearman : rpcrt4: Factor out string validation from NDR unmarshalling functions into a separate function , validate_string_data.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 33e907bc9db68ac54ba7b2cfcf30132adb4fd87f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=33e907bc9db68ac54ba7b2cfc…
Author: Rob Shearman <robertshearman(a)gmail.com> Date: Mon Jun 23 12:56:29 2008 +0100 rpcrt4: Factor out string validation from NDR unmarshalling functions into a separate function, validate_string_data. --- dlls/rpcrt4/ndr_marshall.c | 159 +++++++++++--------------------------------- 1 files changed, 40 insertions(+), 119 deletions(-) diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c index 15cd292..977effa 100644 --- a/dlls/rpcrt4/ndr_marshall.c +++ b/dlls/rpcrt4/ndr_marshall.c @@ -690,6 +690,37 @@ static inline void safe_copy_to_buffer(MIDL_STUB_MESSAGE *pStubMsg, const void * pStubMsg->Buffer += size; } +/* verify that string data sitting in the buffer is valid and safe to + * unmarshall */ +static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULONG esize) +{ + ULONG i; + + /* verify the buffer is safe to access */ + if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) || + (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd)) + { + ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize, + pStubMsg->BufferEnd, pStubMsg->Buffer); + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + + /* strings must always have null terminating bytes */ + if (bufsize < esize) + { + ERR("invalid string length of %d\n", bufsize / esize); + RpcRaiseException(RPC_S_INVALID_BOUND); + } + + for (i = bufsize - esize; i < bufsize; i++) + if (pStubMsg->Buffer[i] != 0) + { + ERR("string not null-terminated at byte position %d, data is 0x%x\n", + i, pStubMsg->Buffer[i]); + RpcRaiseException(RPC_S_INVALID_BOUND); + } +} + /* * NdrConformantString: * @@ -791,7 +822,7 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat ) { - ULONG bufsize, memsize, esize, i; + ULONG bufsize, memsize, esize; TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat); @@ -821,29 +852,7 @@ ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg, memsize = safe_multiply(esize, pStubMsg->MaxCount); bufsize = safe_multiply(esize, pStubMsg->ActualCount); - /* strings must always have null terminating bytes */ - if (bufsize < esize) - { - ERR("invalid string length of %d\n", pStubMsg->ActualCount); - RpcRaiseException(RPC_S_INVALID_BOUND); - } - - /* verify the buffer is safe to access */ - if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) || - (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd)) - { - ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize, - pStubMsg->BufferEnd, pStubMsg->Buffer); - RpcRaiseException(RPC_X_BAD_STUB_DATA); - } - - for (i = bufsize - esize; i < bufsize; i++) - if (pStubMsg->Buffer[i] != 0) - { - ERR("string not null-terminated at byte position %d, data is 0x%x\n", - i, pStubMsg->Buffer[i]); - RpcRaiseException(RPC_S_INVALID_BOUND); - } + validate_string_data(pStubMsg, bufsize, esize); safe_buffer_increment(pStubMsg, bufsize); pStubMsg->MemorySize += memsize; @@ -857,7 +866,7 @@ ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg, unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char** ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc ) { - ULONG bufsize, memsize, esize, i; + ULONG bufsize, memsize, esize; TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n", pStubMsg, *ppMemory, pFormat, fMustAlloc); @@ -892,32 +901,7 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg memsize = safe_multiply(esize, pStubMsg->MaxCount); bufsize = safe_multiply(esize, pStubMsg->ActualCount); - /* strings must always have null terminating bytes */ - if (bufsize < esize) - { - ERR("invalid string length of %d\n", pStubMsg->ActualCount); - RpcRaiseException(RPC_S_INVALID_BOUND); - return NULL; - } - - /* verify the buffer is safe to access */ - if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) || - (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd)) - { - ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize, - pStubMsg->BufferEnd, pStubMsg->Buffer); - RpcRaiseException(RPC_X_BAD_STUB_DATA); - return NULL; - } - - for (i = bufsize - esize; i < bufsize; i++) - if (pStubMsg->Buffer[i] != 0) - { - ERR("string not null-terminated at byte position %d, data is 0x%x\n", - i, pStubMsg->Buffer[i]); - RpcRaiseException(RPC_S_INVALID_BOUND); - return NULL; - } + validate_string_data(pStubMsg, bufsize, esize); if (fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, memsize); @@ -1002,7 +986,7 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - ULONG bufsize, memsize, esize, i, maxsize; + ULONG bufsize, memsize, esize, maxsize; TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n", pStubMsg, *ppMemory, pFormat, fMustAlloc); @@ -1027,31 +1011,7 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu memsize = esize * maxsize; bufsize = safe_multiply(esize, pStubMsg->ActualCount); - if (bufsize < esize) - { - ERR("invalid string length of %d\n", pStubMsg->ActualCount); - RpcRaiseException(RPC_S_INVALID_BOUND); - return NULL; - } - - /* verify the buffer is safe to access */ - if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) || - (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd)) - { - ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize, - pStubMsg->BufferEnd, pStubMsg->Buffer); - RpcRaiseException(RPC_X_BAD_STUB_DATA); - return NULL; - } - - /* strings must always have null terminating bytes */ - for (i = bufsize - esize; i < bufsize; i++) - if (pStubMsg->Buffer[i] != 0) - { - ERR("string not null-terminated at byte position %d, data is 0x%x\n", - i, pStubMsg->Buffer[i]); - RpcRaiseException(RPC_S_INVALID_BOUND); - } + validate_string_data(pStubMsg, bufsize, esize); if (fMustAlloc || !*ppMemory) *ppMemory = NdrAllocate(pStubMsg, memsize); @@ -1118,7 +1078,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - ULONG bufsize, memsize, esize, i, maxsize; + ULONG bufsize, memsize, esize, maxsize; TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat); @@ -1143,29 +1103,7 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg, memsize = esize * maxsize; bufsize = safe_multiply(esize, pStubMsg->ActualCount); - /* strings must always have null terminating bytes */ - if (bufsize < esize) - { - ERR("invalid string length of %d\n", pStubMsg->ActualCount); - RpcRaiseException(RPC_S_INVALID_BOUND); - } - - /* verify the buffer is safe to access */ - if ((pStubMsg->Buffer + bufsize < pStubMsg->Buffer) || - (pStubMsg->Buffer + bufsize > pStubMsg->BufferEnd)) - { - ERR("bufsize 0x%x exceeded buffer end %p of buffer %p\n", bufsize, - pStubMsg->BufferEnd, pStubMsg->Buffer); - RpcRaiseException(RPC_X_BAD_STUB_DATA); - } - - for (i = bufsize - esize; i < bufsize; i++) - if (pStubMsg->Buffer[i] != 0) - { - ERR("string not null-terminated at byte position %d, data is 0x%x\n", - i, pStubMsg->Buffer[i]); - RpcRaiseException(RPC_S_INVALID_BOUND); - } + validate_string_data(pStubMsg, bufsize, esize); safe_buffer_increment(pStubMsg, bufsize); pStubMsg->MemorySize += memsize; @@ -4309,24 +4247,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE if ((cvarray_type == RPC_FC_C_CSTRING) || (cvarray_type == RPC_FC_C_WSTRING)) - { - ULONG i; - /* strings must always have null terminating bytes */ - if (bufsize < esize) - { - ERR("invalid string length of %d\n", pStubMsg->ActualCount); - RpcRaiseException(RPC_S_INVALID_BOUND); - return NULL; - } - for (i = bufsize - esize; i < bufsize; i++) - if (pStubMsg->Buffer[i] != 0) - { - ERR("string not null-terminated at byte position %d, data is 0x%x\n", - i, pStubMsg->Buffer[i]); - RpcRaiseException(RPC_S_INVALID_BOUND); - return NULL; - } - } + validate_string_data(pStubMsg, bufsize, esize); /* copy the array data */ safe_copy_from_buffer(pStubMsg, *ppMemory + pCVStructFormat->memory_size, bufsize);
1
0
0
0
Rob Shearman : widl: Fix the embedded pointer offsets in generated code when the containing structure has padding .
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 28a9b94afcb03d0611ed202da694de94a4546bcf URL:
http://source.winehq.org/git/wine.git/?a=commit;h=28a9b94afcb03d0611ed202da…
Author: Rob Shearman <robertshearman(a)gmail.com> Date: Mon Jun 23 12:58:03 2008 +0100 widl: Fix the embedded pointer offsets in generated code when the containing structure has padding. Do so by calculating the alignment of members when iterating through the structures and adding it onto the buffer and memory offsets. Only call type_memsize once elsewhere in the embedded pointer processing functions since the return value will be the same from the second call. --- tools/widl/typegen.c | 127 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 88 insertions(+), 39 deletions(-) diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index ef222aa..7808cea 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1117,6 +1117,8 @@ static int write_no_repeat_pointer_descriptions( if (is_ptr(type) || (!type->declarray && is_conformant_array(type))) { + size_t memsize; + print_file(file, 2, "0x%02x, /* FC_NO_REPEAT */\n", RPC_FC_NO_REPEAT); print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD); @@ -1144,11 +1146,11 @@ static int write_no_repeat_pointer_descriptions( } align = 0; - *offset_in_memory += type_memsize(type, &align); + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; /* increment these separately as in the case of conformant (varying) * structures these start at different values */ - align = 0; - *offset_in_buffer += type_memsize(type, &align); + *offset_in_buffer += memsize; return 1; } @@ -1157,18 +1159,30 @@ static int write_no_repeat_pointer_descriptions( { const var_t *v; LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry ) + { + if (offset_in_memory && offset_in_buffer) + { + size_t padding; + align = 0; + type_memsize(v->type, &align); + padding = ROUNDING(*offset_in_memory, align); + *offset_in_memory += padding; + *offset_in_buffer += padding; + } written += write_no_repeat_pointer_descriptions( file, v->type, offset_in_memory, offset_in_buffer, typestring_offset); + } } else { + size_t memsize; align = 0; - *offset_in_memory += type_memsize(type, &align); + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; /* increment these separately as in the case of conformant (varying) * structures these start at different values */ - align = 0; - *offset_in_buffer += type_memsize(type, &align); + *offset_in_buffer += memsize; } return written; @@ -1186,16 +1200,19 @@ static int write_pointer_description_offsets( { if (offset_in_memory && offset_in_buffer) { + size_t memsize; + /* pointer instance */ /* FIXME: sometimes from end of structure, sometimes from beginning */ print_file(file, 2, "NdrFcShort(0x%x), /* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); print_file(file, 2, "NdrFcShort(0x%x), /* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); align = 0; - *offset_in_memory += type_memsize(type, &align); - /* FIXME: is there a case where these two are different? */ - align = 0; - *offset_in_buffer += type_memsize(type, &align); + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; + /* increment these separately as in the case of conformant (varying) + * structures these start at different values */ + *offset_in_buffer += memsize; } *typestring_offset += 4; @@ -1213,7 +1230,7 @@ static int write_pointer_description_offsets( { return write_pointer_description_offsets( file, attrs, type->ref, offset_in_memory, offset_in_buffer, - typestring_offset); + typestring_offset); } else if (is_non_complex_struct(type)) { @@ -1221,6 +1238,15 @@ static int write_pointer_description_offsets( const var_t *v; LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry ) { + if (offset_in_memory && offset_in_buffer) + { + size_t padding; + align = 0; + type_memsize(v->type, &align); + padding = ROUNDING(*offset_in_memory, align); + *offset_in_memory += padding; + *offset_in_buffer += padding; + } written += write_pointer_description_offsets( file, v->attrs, v->type, offset_in_memory, offset_in_buffer, typestring_offset); @@ -1228,14 +1254,16 @@ static int write_pointer_description_offsets( } else { - align = 0; - if (offset_in_memory) - *offset_in_memory += type_memsize(type, &align); - /* increment these separately as in the case of conformant (varying) - * structures these start at different values */ - align = 0; - if (offset_in_buffer) - *offset_in_buffer += type_memsize(type, &align); + if (offset_in_memory && offset_in_buffer) + { + size_t memsize; + align = 0; + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; + /* increment these separately as in the case of conformant (varying) + * structures these start at different values */ + *offset_in_buffer += memsize; + } } return written; @@ -1285,6 +1313,15 @@ static int write_fixed_array_pointer_descriptions( const var_t *v; LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry ) { + if (offset_in_memory && offset_in_buffer) + { + size_t padding; + align = 0; + type_memsize(v->type, &align); + padding = ROUNDING(*offset_in_memory, align); + *offset_in_memory += padding; + *offset_in_buffer += padding; + } pointer_count += write_fixed_array_pointer_descriptions( file, v->attrs, v->type, offset_in_memory, offset_in_buffer, typestring_offset); @@ -1292,14 +1329,16 @@ static int write_fixed_array_pointer_descriptions( } else { - align = 0; - if (offset_in_memory) - *offset_in_memory += type_memsize(type, &align); - /* increment these separately as in the case of conformant (varying) - * structures these start at different values */ - align = 0; - if (offset_in_buffer) - *offset_in_buffer += type_memsize(type, &align); + if (offset_in_memory && offset_in_buffer) + { + size_t memsize; + align = 0; + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; + /* increment these separately as in the case of conformant (varying) + * structures these start at different values */ + *offset_in_buffer += memsize; + } } return pointer_count; @@ -1369,8 +1408,6 @@ static int write_varying_array_pointer_descriptions( if (pointer_count > 0) { unsigned int increment_size; - size_t offset_of_array_pointer_mem = *offset_in_memory; - size_t offset_of_array_pointer_buf = *offset_in_buffer; align = 0; increment_size = type_memsize(type->ref, &align); @@ -1386,8 +1423,8 @@ static int write_varying_array_pointer_descriptions( *typestring_offset += 8; pointer_count = write_pointer_description_offsets( - file, attrs, type, &offset_of_array_pointer_mem, - &offset_of_array_pointer_buf, typestring_offset); + file, attrs, type, offset_in_memory, + offset_in_buffer, typestring_offset); } } else if (is_struct(type->type)) @@ -1395,6 +1432,15 @@ static int write_varying_array_pointer_descriptions( const var_t *v; LIST_FOR_EACH_ENTRY( v, type->fields_or_args, const var_t, entry ) { + if (offset_in_memory && offset_in_buffer) + { + size_t padding; + align = 0; + type_memsize(v->type, &align); + padding = ROUNDING(*offset_in_memory, align); + *offset_in_memory += padding; + *offset_in_buffer += padding; + } pointer_count += write_varying_array_pointer_descriptions( file, v->attrs, v->type, offset_in_memory, offset_in_buffer, typestring_offset); @@ -1402,13 +1448,16 @@ static int write_varying_array_pointer_descriptions( } else { - align = 0; - if (offset_in_memory) - *offset_in_memory += type_memsize(type, &align); - /* FIXME: is there a case where these two are different? */ - align = 0; - if (offset_in_buffer) - *offset_in_buffer += type_memsize(type, &align); + if (offset_in_memory && offset_in_buffer) + { + size_t memsize; + align = 0; + memsize = type_memsize(type, &align); + *offset_in_memory += memsize; + /* increment these separately as in the case of conformant (varying) + * structures these start at different values */ + *offset_in_buffer += memsize; + } } return pointer_count; @@ -1459,7 +1508,7 @@ static void write_pointer_description(FILE *file, type_t *type, typestring_offset); } - /* pass 4: search for pointers in varying arrays */ + /* pass 4: search for pointers in varying arrays */ offset_in_memory = 0; offset_in_buffer = conformance; write_varying_array_pointer_descriptions(
1
0
0
0
Rob Shearman : widl: Replace code to round up values and calculate padding with macros to improve readability .
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 5f1de5a11dd23727ce4d3bc2fa2f229761d9363e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5f1de5a11dd23727ce4d3bc2f…
Author: Rob Shearman <robertshearman(a)gmail.com> Date: Mon Jun 23 12:57:28 2008 +0100 widl: Replace code to round up values and calculate padding with macros to improve readability. --- tools/widl/typegen.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index e256fa5..ef222aa 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -41,6 +41,11 @@ #include "typegen.h" #include "expr.h" +/* round size up to multiple of alignment */ +#define ROUND_SIZE(size, alignment) (((size) + ((alignment) - 1)) & ~((alignment) - 1)) +/* value to add on to round size up to a multiple of alignment */ +#define ROUNDING(size, alignment) (((alignment) - 1) - (((size) + ((alignment) - 1)) & ((alignment) - 1))) + static const func_t *current_func; static const type_t *current_structure; static const type_t *current_iface; @@ -754,11 +759,11 @@ static size_t fields_memsize(const var_list_t *fields, unsigned int *align) *align = falign; have_align = TRUE; } - size = (size + (falign - 1)) & ~(falign - 1); + size = ROUND_SIZE(size, falign); size += fsize; } - size = (size + (*align - 1)) & ~(*align - 1); + size = ROUND_SIZE(size, *align); return size; } @@ -798,11 +803,11 @@ int get_padding(const var_list_t *fields) size_t size = type_memsize(ft, &align); if (salign == -1) salign = align; - offset = (offset + (align - 1)) & ~(align - 1); + offset = ROUND_SIZE(offset, align); offset += size; } - return ((offset + (salign - 1)) & ~(salign - 1)) - offset; + return ROUNDING(offset, salign); } size_t type_memsize(const type_t *t, unsigned int *align) @@ -1711,7 +1716,7 @@ static void write_struct_members(FILE *file, const type_t *type, error("write_struct_members: cannot align type %d\n", ft->type); } print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); - offset = (offset + (align - 1)) & ~(align - 1); + offset = ROUND_SIZE(offset, align); *typestring_offset += 1; } write_member_type(file, type, field->attrs, field->type, corroff, @@ -1720,7 +1725,7 @@ static void write_struct_members(FILE *file, const type_t *type, } } - padding = ((offset + (salign - 1)) & ~(salign - 1)) - offset; + padding = ROUNDING(offset, salign); if (padding) { print_file(file, 2, "0x%x,\t/* FC_STRUCTPAD%d */\n",
1
0
0
0
Alexandre Julliard : shell32/tests: Use the original path if GetLongPathNameA fails.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 7524019796b1e181fb220dd1ac293bde35bf707d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7524019796b1e181fb220dd1a…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jun 23 17:22:01 2008 +0200 shell32/tests: Use the original path if GetLongPathNameA fails. --- dlls/shell32/tests/shelllink.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index 5cbd8bf..54bb291 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -540,7 +540,7 @@ static void test_load_save(void) *p='\0'; /* IShellLink returns path in long form */ - pGetLongPathNameA(mypath, realpath, MAX_PATH); + if (!pGetLongPathNameA(mypath, realpath, MAX_PATH)) strcpy( realpath, mypath ); /* Overwrite the existing lnk file and point it to existing files */ desc.description="test 2";
1
0
0
0
Alexandre Julliard : winspool: Don't print NULL pointers in traces.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 8e2684fea4a1f456305da1e6ce36ca505d562259 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8e2684fea4a1f456305da1e6c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Jun 23 17:10:04 2008 +0200 winspool: Don't print NULL pointers in traces. --- dlls/winspool.drv/info.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 5057c0d..abc3397 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -2295,10 +2295,10 @@ BOOL WINAPI AddMonitorA(LPSTR pName, DWORD Level, LPBYTE pMonitors) MONITOR_INFO_2W mi2w; mi2a = (LPMONITOR_INFO_2A) pMonitors; - TRACE("(%s, %d, %p) : %s %s %s\n", debugstr_a(pName), Level, pMonitors, - mi2a ? debugstr_a(mi2a->pName) : NULL, - mi2a ? debugstr_a(mi2a->pEnvironment) : NULL, - mi2a ? debugstr_a(mi2a->pDLLName) : NULL); + TRACE("(%s, %d, %p) : %s %s %s\n", debugstr_a(pName), Level, pMonitors, + debugstr_a(mi2a ? mi2a->pName : NULL), + debugstr_a(mi2a ? mi2a->pEnvironment : NULL), + debugstr_a(mi2a ? mi2a->pDLLName : NULL)); if (Level != 2) { SetLastError(ERROR_INVALID_LEVEL); @@ -2371,10 +2371,10 @@ BOOL WINAPI AddMonitorW(LPWSTR pName, DWORD Level, LPBYTE pMonitors) BOOL res = FALSE; mi2w = (LPMONITOR_INFO_2W) pMonitors; - TRACE("(%s, %d, %p) : %s %s %s\n", debugstr_w(pName), Level, pMonitors, - mi2w ? debugstr_w(mi2w->pName) : NULL, - mi2w ? debugstr_w(mi2w->pEnvironment) : NULL, - mi2w ? debugstr_w(mi2w->pDLLName) : NULL); + TRACE("(%s, %d, %p) : %s %s %s\n", debugstr_w(pName), Level, pMonitors, + debugstr_w(mi2w ? mi2w->pName : NULL), + debugstr_w(mi2w ? mi2w->pEnvironment : NULL), + debugstr_w(mi2w ? mi2w->pDLLName : NULL)); if (Level != 2) { SetLastError(ERROR_INVALID_LEVEL); @@ -2665,7 +2665,7 @@ BOOL WINAPI DeletePortW (LPWSTR pName, HWND hWnd, LPWSTR pPortName) else { FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pPortName), - pm, pm ? debugstr_w(pm->dllname) : NULL, pui, pui ? debugstr_w(pui->dllname) : NULL); + pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ SetLastError(ERROR_NOT_SUPPORTED); @@ -6551,7 +6551,7 @@ BOOL WINAPI AddPortW(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName) else { FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pMonitorName), - pm, pm ? debugstr_w(pm->dllname) : NULL, pui, pui ? debugstr_w(pui->dllname) : NULL); + pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ SetLastError(ERROR_NOT_SUPPORTED); @@ -6989,7 +6989,7 @@ BOOL WINAPI ConfigurePortW(LPWSTR pName, HWND hWnd, LPWSTR pPortName) else { FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pPortName), - pm, pm ? debugstr_w(pm->dllname) : NULL, pui, pui ? debugstr_w(pui->dllname) : NULL); + pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ SetLastError(ERROR_NOT_SUPPORTED);
1
0
0
0
Michael Karcher : ddraw: Ensure to load wined3d before attempting to create a clipper.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 606186d4c5f1942e74c1bb1c563ea91252cfee8f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=606186d4c5f1942e74c1bb1c5…
Author: Michael Karcher <wine(a)mkarcher.dialup.fu-berlin.de> Date: Sat Jun 21 16:02:49 2008 +0200 ddraw: Ensure to load wined3d before attempting to create a clipper. --- dlls/ddraw/ddraw.c | 6 ++++++ dlls/ddraw/ddraw_private.h | 3 +++ dlls/ddraw/main.c | 38 ++++++++++++++++++++++++++------------ 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index ab78c4b..dfd77fa 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -3241,6 +3241,12 @@ DirectDrawCreateClipper(DWORD Flags, return CLASS_E_NOAGGREGATION; } + if (!LoadWineD3D()) + { + LeaveCriticalSection(&ddraw_cs); + return DDERR_NODIRECTDRAWSUPPORT; + } + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawClipperImpl)); if (object == NULL) diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index f256c50..9842260 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -644,6 +644,9 @@ void DDRAW_dump_cooperativelevel(DWORD cooplevel); * IDirect3DExecuteBuffer isn't in WineD3D */ void multiply_matrix(LPD3DMATRIX dest, const D3DMATRIX *src1, const D3DMATRIX *src2); +/* Helper function in main.c */ +BOOL LoadWineD3D(void); + /* Used for generic dumping */ typedef struct { diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index ac1378d..d03a89c 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -49,7 +49,6 @@ typedef IWineD3D* (WINAPI *fnWineDirect3DCreate)(UINT, UINT, IUnknown *); -static HMODULE hWineD3D = (HMODULE) -1; static fnWineDirect3DCreate pWineDirect3DCreate; WINE_DEFAULT_DEBUG_CHANNEL(ddraw); @@ -72,6 +71,31 @@ CRITICAL_SECTION ddraw_cs = { &ddraw_cs_debug, -1, 0, 0, 0, 0 }; /* value of ForceRefreshRate */ DWORD force_refresh_rate = 0; +/* + * Helper Function for DDRAW_Create and DirectDrawCreateClipper for + * lazy loading of the Wine D3D driver. + * + * Returns + * TRUE on success + * FALSE on failure. + */ + +BOOL LoadWineD3D(void) +{ + static HMODULE hWineD3D = (HMODULE) -1; + if (hWineD3D == (HMODULE) -1) + { + hWineD3D = LoadLibraryA("wined3d"); + if (hWineD3D) + { + pWineDirect3DCreate = (fnWineDirect3DCreate) GetProcAddress(hWineD3D, "WineDirect3DCreate"); + pWineDirect3DCreateClipper = (fnWineDirect3DCreateClipper) GetProcAddress(hWineD3D, "WineDirect3DCreateClipper"); + return TRUE; + } + } + return hWineD3D != NULL; +} + /*********************************************************************** * * Helper function for DirectDrawCreate and friends @@ -171,17 +195,7 @@ DDRAW_Create(const GUID *guid, This->orig_width = GetSystemMetrics(SM_CXSCREEN); This->orig_height = GetSystemMetrics(SM_CYSCREEN); - if (hWineD3D == (HMODULE) -1) - { - hWineD3D = LoadLibraryA("wined3d"); - if (hWineD3D) - { - pWineDirect3DCreate = (fnWineDirect3DCreate) GetProcAddress(hWineD3D, "WineDirect3DCreate"); - pWineDirect3DCreateClipper = (fnWineDirect3DCreateClipper) GetProcAddress(hWineD3D, "WineDirect3DCreateClipper"); - } - } - - if (!hWineD3D) + if (!LoadWineD3D()) { ERR("Couldn't load WineD3D - OpenGL libs not present?\n"); hr = DDERR_NODIRECTDRAWSUPPORT;
1
0
0
0
Marcus Meissner : ws2_32/tests: Initialize buffer to avoid valgrind warning .
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: ebe77399876cc566dc0817e5ce8d5370ffc0f0fc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ebe77399876cc566dc0817e5c…
Author: Marcus Meissner <marcus(a)jet.franken.de> Date: Mon Jun 23 08:44:19 2008 +0200 ws2_32/tests: Initialize buffer to avoid valgrind warning. --- dlls/ws2_32/tests/sock.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 79d2aeb..1256c2d 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1127,6 +1127,7 @@ static void test_UDP(void) char buf[16]; int ss, i, n_recv, n_sent; + memset (buf,0,sizeof(buf)); for ( i = NUM_UDP_PEERS - 1; i >= 0; i-- ) { ok ( ( peer[i].s = socket ( AF_INET, SOCK_DGRAM, 0 ) ) != INVALID_SOCKET, "UDP: socket failed\n" );
1
0
0
0
Dan Kegel : user32: Fix buffer length thinko in dde_client.c.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 81fee5208b90fad16e1a1d3c750e8ffe23144d8a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=81fee5208b90fad16e1a1d3c7…
Author: Dan Kegel <dank(a)kegel.com> Date: Sun Jun 22 22:37:11 2008 -0700 user32: Fix buffer length thinko in dde_client.c. --- dlls/user32/dde_client.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/user32/dde_client.c b/dlls/user32/dde_client.c index 31a1251..83bc9fb 100644 --- a/dlls/user32/dde_client.c +++ b/dlls/user32/dde_client.c @@ -576,7 +576,7 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c { if (clientUnicode) { - memSize = WideCharToMultiByte( CP_ACP, 0, pData, cbData, NULL, 0, NULL, NULL); + memSize = WideCharToMultiByte( CP_ACP, 0, pData, cbData / sizeof(WCHAR), NULL, 0, NULL, NULL); } else { @@ -601,7 +601,7 @@ static HGLOBAL WDML_BuildExecuteCommand(WDML_CONV* pConv, LPCVOID pData, DWORD c { if (clientUnicode) { - WideCharToMultiByte( CP_ACP, 0, pData, cbData, pDst, memSize, NULL, NULL); + WideCharToMultiByte( CP_ACP, 0, pData, cbData / sizeof(WCHAR), pDst, memSize, NULL, NULL); } else {
1
0
0
0
Detlef Riekenberg : avifil32: The array index is 0-based.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: dda737f36a5574942f9eeed3745d161a50c4a512 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=dda737f36a5574942f9eeed37…
Author: Detlef Riekenberg <wine.dev(a)web.de> Date: Sun Jun 22 22:23:28 2008 +0200 avifil32: The array index is 0-based. --- dlls/avifil32/api.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c index b7b21b9..12eb1b7 100644 --- a/dlls/avifil32/api.c +++ b/dlls/avifil32/api.c @@ -1524,7 +1524,7 @@ HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions) if (nStreams < 0 || ppOptions == NULL) return AVIERR_BADPARAM; - for (; nStreams > 0; nStreams--) { + for (nStreams--; nStreams >= 0; nStreams--) { if (ppOptions[nStreams] != NULL) { ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
1
0
0
0
Kai Blin : rpcrt4: Ignore the AuthzSvr parameter for RPC_C_AUTHN_WINNT.
by Alexandre Julliard
23 Jun '08
23 Jun '08
Module: wine Branch: master Commit: 533419cb35cdb1224e0d08059c922b4135366320 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=533419cb35cdb1224e0d08059…
Author: Kai Blin <kai.blin(a)gmail.com> Date: Mon Jun 23 09:52:23 2008 +0200 rpcrt4: Ignore the AuthzSvr parameter for RPC_C_AUTHN_WINNT. --- dlls/rpcrt4/rpc_binding.c | 6 ++++-- dlls/rpcrt4/tests/rpc.c | 4 ++++ include/rpcdce.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index b29ab13..333de3d 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -1404,7 +1404,8 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, return RPC_S_UNKNOWN_AUTHN_LEVEL; } - if (AuthzSvr) + /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */ + if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT) { FIXME("unsupported AuthzSvr %u\n", AuthzSvr); return RPC_S_UNKNOWN_AUTHZ_SERVICE; @@ -1533,7 +1534,8 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, return RPC_S_UNKNOWN_AUTHN_LEVEL; } - if (AuthzSvr) + /* RPC_C_AUTHN_WINNT ignores the AuthzSvr parameter */ + if (AuthzSvr && AuthnSvc != RPC_C_AUTHN_WINNT) { FIXME("unsupported AuthzSvr %u\n", AuthzSvr); return RPC_S_UNKNOWN_AUTHZ_SERVICE; diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c index 035cde7..4b34d12 100644 --- a/dlls/rpcrt4/tests/rpc.c +++ b/dlls/rpcrt4/tests/rpc.c @@ -260,6 +260,10 @@ todo_wine { ok(status == RPC_S_OK, "RpcBindingFromStringBinding failed (%lu)\n", status); + status = RpcBindingSetAuthInfo(IFoo_IfHandle, NULL, RPC_C_AUTHN_LEVEL_NONE, + RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME); + ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%lu)\n", status); + status = RpcMgmtStopServerListening(NULL); ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%lu)\n", status); diff --git a/include/rpcdce.h b/include/rpcdce.h index 0212c4c..6bc6561 100644 --- a/include/rpcdce.h +++ b/include/rpcdce.h @@ -139,6 +139,11 @@ typedef I_RPC_HANDLE *RPC_EP_INQ_HANDLE; #define RPC_C_AUTHN_MQ 100 #define RPC_C_AUTHN_DEFAULT 0xffffffff +#define RPC_C_AUTHZ_NONE 0 +#define RPC_C_AUTHZ_NAME 1 +#define RPC_C_AUTHZ_DCE 2 +#define RPC_C_AUTHZ_DEFAULT 0xffffffff + /* values for RPC_SECURITY_QOS*::ImpersonationType */ #define RPC_C_IMP_LEVEL_DEFAULT 0 #define RPC_C_IMP_LEVEL_ANONYMOUS 1
1
0
0
0
← Newer
1
...
37
38
39
40
41
42
43
...
95
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
88
89
90
91
92
93
94
95
Results per page:
10
25
50
100
200