ReactOS.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
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
List overview
Download
Ros-diffs
April 2015
----- 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
ros-diffs@reactos.org
17 participants
481 discussions
Start a n
N
ew thread
[cwittich] 67124: [RTL] import LZNT1 decompression from wine staging
by cwittich@svn.reactos.org
Author: cwittich Date: Fri Apr 10 08:18:00 2015 New Revision: 67124 URL:
http://svn.reactos.org/svn/reactos?rev=67124&view=rev
Log: [RTL] import LZNT1 decompression from wine staging Modified: trunk/reactos/lib/rtl/compress.c Modified: trunk/reactos/lib/rtl/compress.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/compress.c?rev=671…
============================================================================== --- trunk/reactos/lib/rtl/compress.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/compress.c [iso-8859-1] Fri Apr 10 08:18:00 2015 @@ -4,6 +4,8 @@ * PURPOSE: Compression and decompression functions * FILE: lib/rtl/compress.c * PROGRAMER: Eric Kohl + Sebastian Lackner + Michael Müller */ /* INCLUDES *****************************************************************/ @@ -22,6 +24,198 @@ /* FUNCTIONS ****************************************************************/ + +/* Based on Wine Staging */ + +/* decompress a single LZNT1 chunk */ +static PUCHAR lznt1_decompress_chunk(UCHAR *dst, ULONG dst_size, UCHAR *src, ULONG src_size) +{ + UCHAR *src_cur, *src_end, *dst_cur, *dst_end; + ULONG displacement_bits, length_bits; + ULONG code_displacement, code_length; + WORD flags, code; + + src_cur = src; + src_end = src + src_size; + dst_cur = dst; + dst_end = dst + dst_size; + + /* Partial decompression is no error on Windows. */ + while (src_cur < src_end && dst_cur < dst_end) + { + /* read flags header */ + flags = 0x8000 | *src_cur++; + + /* parse following 8 entities, either uncompressed data or backwards reference */ + while ((flags & 0xFF00) && src_cur < src_end) + { + if (flags & 1) + { + /* backwards reference */ + if (src_cur + sizeof(WORD) > src_end) + return NULL; + code = *(WORD *)src_cur; + src_cur += sizeof(WORD); + + /* find length / displacement bits */ + for (displacement_bits = 12; displacement_bits > 4; displacement_bits--) + if ((1 << (displacement_bits - 1)) < dst_cur - dst) break; + length_bits = 16 - displacement_bits; + code_length = (code & ((1 << length_bits) - 1)) + 3; + code_displacement = (code >> length_bits) + 1; + + /* ensure reference is valid */ + if (dst_cur < dst + code_displacement) + return NULL; + + /* copy bytes of chunk - we can't use memcpy() + * since source and dest can be overlapping */ + while (code_length--) + { + if (dst_cur >= dst_end) return dst_cur; + *dst_cur = *(dst_cur - code_displacement); + dst_cur++; + } + } + else + { + /* uncompressed data */ + if (dst_cur >= dst_end) return dst_cur; + *dst_cur++ = *src_cur++; + } + flags >>= 1; + } + + } + + return dst_cur; +} + +/* decompress data encoded with LZNT1 */ +static NTSTATUS lznt1_decompress(UCHAR *dst, ULONG dst_size, UCHAR *src, ULONG src_size, + ULONG offset, ULONG *final_size, UCHAR *workspace) +{ + UCHAR *src_cur, *src_end, *dst_cur, *dst_end, *ptr; + ULONG chunk_size, block_size; + WORD chunk_header; + + src_cur = src; + src_end = src + src_size; + dst_cur = dst; + dst_end = dst + dst_size; + + if (src_cur + sizeof(WCHAR) > src_end) + return STATUS_BAD_COMPRESSION_BUFFER; + + /* skip over chunks which have a big distance (>= 0x1000) to the destination offset */ + while (offset >= 0x1000 && src_cur + sizeof(WCHAR) <= src_end) + { + /* read chunk header and extract size */ + chunk_header = *(WORD *)src_cur; + src_cur += sizeof(WCHAR); + if (!chunk_header) goto out; + chunk_size = (chunk_header & 0xFFF) + 1; + + /* ensure we have enough buffer to process chunk */ + if (src_cur + chunk_size > src_end) + return STATUS_BAD_COMPRESSION_BUFFER; + + src_cur += chunk_size; + offset -= 0x1000; + } + + /* this chunk is can be included partially */ + if (offset && src_cur + sizeof(WCHAR) <= src_end) + { + /* read chunk header and extract size */ + chunk_header = *(WORD *)src_cur; + src_cur += sizeof(WCHAR); + if (!chunk_header) goto out; + chunk_size = (chunk_header & 0xFFF) + 1; + + /* ensure we have enough buffer to process chunk */ + if (src_cur + chunk_size > src_end) + return STATUS_BAD_COMPRESSION_BUFFER; + + if (dst_cur >= dst_end) + goto out; + + if (chunk_header & 0x8000) + { + /* compressed chunk */ + if (!workspace) return STATUS_ACCESS_VIOLATION; + ptr = lznt1_decompress_chunk(workspace, 0x1000, src_cur, chunk_size); + if (!ptr) return STATUS_BAD_COMPRESSION_BUFFER; + if (ptr - workspace > offset) + { + block_size = min((ptr - workspace) - offset, dst_end - dst_cur); + memcpy(dst_cur, workspace + offset, block_size); + dst_cur += block_size; + } + } + else + { + /* uncompressed chunk */ + if (chunk_size > offset) + { + block_size = min(chunk_size - offset, dst_end - dst_cur); + memcpy(dst_cur, src_cur + offset, block_size); + dst_cur += block_size; + } + } + + src_cur += chunk_size; + } + + while (src_cur + sizeof(WCHAR) <= src_end) + { + /* read chunk header and extract size */ + chunk_header = *(WORD *)src_cur; + src_cur += sizeof(WCHAR); + if (!chunk_header) goto out; + chunk_size = (chunk_header & 0xFFF) + 1; + + /* ensure we have enough buffer to process chunk */ + if (src_cur + chunk_size > src_end) + return STATUS_BAD_COMPRESSION_BUFFER; + + /* add padding if required */ + block_size = ((dst_cur - dst) + offset) & 0xFFF; + if (block_size) + { + block_size = 0x1000 - block_size; + if (dst_cur + block_size >= dst_end) + goto out; + memset(dst_cur, 0, block_size); + dst_cur += block_size; + } + else if (dst_cur >= dst_end) + goto out; + + if (chunk_header & 0x8000) + { + /* compressed chunk */ + dst_cur = lznt1_decompress_chunk(dst_cur, dst_end - dst_cur, src_cur, chunk_size); + if (!dst_cur) return STATUS_BAD_COMPRESSION_BUFFER; + } + else + { + /* uncompressed chunk */ + block_size = min(chunk_size, dst_end - dst_cur); + memcpy(dst_cur, src_cur, block_size); + dst_cur += block_size; + } + + src_cur += chunk_size; + } + +out: + if (final_size) + *final_size = dst_cur - dst; + + return STATUS_SUCCESS; + +} static NTSTATUS @@ -111,23 +305,6 @@ return STATUS_NOT_IMPLEMENTED; } - -/* - * @unimplemented - */ -NTSTATUS NTAPI -RtlDecompressBuffer(IN USHORT CompressionFormat, - OUT PUCHAR UncompressedBuffer, - IN ULONG UncompressedBufferSize, - IN PUCHAR CompressedBuffer, - IN ULONG CompressedBufferSize, - OUT PULONG FinalUncompressedSize) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - - /* * @unimplemented */ @@ -144,24 +321,52 @@ return STATUS_NOT_IMPLEMENTED; } - -/* - * @unimplemented - */ -NTSTATUS NTAPI -RtlDecompressFragment(IN USHORT CompressionFormat, - OUT PUCHAR UncompressedFragment, - IN ULONG UncompressedFragmentSize, - IN PUCHAR CompressedBuffer, - IN ULONG CompressedBufferSize, - IN ULONG FragmentOffset, - OUT PULONG FinalUncompressedSize, - IN PVOID WorkSpace) -{ - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - +/* + * @implemented + */ +NTSTATUS NTAPI +RtlDecompressFragment(IN USHORT format, + OUT PUCHAR uncompressed, + IN ULONG uncompressed_size, + IN PUCHAR compressed, + IN ULONG compressed_size, + IN ULONG offset, + OUT PULONG final_size, + IN PVOID workspace) +{ + DPRINT("0x%04x, %p, %u, %p, %u, %u, %p, %p :stub\n", format, uncompressed, + uncompressed_size, compressed, compressed_size, offset, final_size, workspace); + + switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + { + case COMPRESSION_FORMAT_LZNT1: + return lznt1_decompress(uncompressed, uncompressed_size, compressed, + compressed_size, offset, final_size, workspace); + + case COMPRESSION_FORMAT_NONE: + case COMPRESSION_FORMAT_DEFAULT: + return STATUS_INVALID_PARAMETER; + + default: + DPRINT1("format %d not implemented\n", format); + return STATUS_UNSUPPORTED_COMPRESSION; + } +} + +/* + * @implemented + */ +NTSTATUS NTAPI +RtlDecompressBuffer(IN USHORT CompressionFormat, + OUT PUCHAR UncompressedBuffer, + IN ULONG UncompressedBufferSize, + IN PUCHAR CompressedBuffer, + IN ULONG CompressedBufferSize, + OUT PULONG FinalUncompressedSize) +{ + return RtlDecompressFragment(CompressionFormat, UncompressedBuffer, UncompressedBufferSize, + CompressedBuffer, CompressedBufferSize, 0, FinalUncompressedSize, NULL); +} /* * @unimplemented
9 years, 8 months
1
0
0
0
[tfaber] 67123: [KERNEL32] - Fix setting the hour in FileTimeToDosDateTime CORE-9510 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Apr 9 20:19:55 2015 New Revision: 67123 URL:
http://svn.reactos.org/svn/reactos?rev=67123&view=rev
Log: [KERNEL32] - Fix setting the hour in FileTimeToDosDateTime CORE-9510 #resolve Modified: trunk/reactos/dll/win32/kernel32/client/time.c Modified: trunk/reactos/dll/win32/kernel32/client/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/time.c [iso-8859-1] Thu Apr 9 20:19:55 2015 @@ -62,7 +62,7 @@ ((TimeFields.Year - 1980) << 9); *lpFatTime = (TimeFields.Second >> 1) | (TimeFields.Minute << 5) | - (TimeFields.Hour << 16); + (TimeFields.Hour << 11); return TRUE; }
9 years, 8 months
1
0
0
0
[tfaber] 67122: [RTL] - Implement RtlIpv6AddressToString*. Patch by Mark Jansen. CORE-6490
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Apr 9 19:42:18 2015 New Revision: 67122 URL:
http://svn.reactos.org/svn/reactos?rev=67122&view=rev
Log: [RTL] - Implement RtlIpv6AddressToString*. Patch by Mark Jansen. CORE-6490 Modified: trunk/reactos/lib/rtl/network.c Modified: trunk/reactos/lib/rtl/network.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/network.c?rev=6712…
============================================================================== --- trunk/reactos/lib/rtl/network.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/network.c [iso-8859-1] Thu Apr 9 19:42:18 2015 @@ -18,6 +18,12 @@ /* maximum length of an ipv4 port expressed as a string */ #define IPV4_PORT_STRING_MAX_LEN 7 /* with the leading ':' */ + +/* maximum length of an ipv6 string for RtlIpv6AddressToString */ +#define RTLIPV6A2S_MAX_LEN 46 + +/* maximum length of an ipv6 string with scope and port for RtlIpv6AddressToStringEx */ +#define RTLIPV6A2SEX_MAX_LEN 65 /* network to host order conversion for little endian machines */ #define WN2H(w) (((w & 0xFF00) >> 8) | ((w & 0x00FF) << 8)) @@ -443,20 +449,38 @@ } /* -* @unimplemented +* @implemented */ PSTR NTAPI RtlIpv6AddressToStringA( _In_ const struct in6_addr *Addr, - _Out_writes_(46) PSTR S) -{ - UNIMPLEMENTED; - return NULL; -} - -/* -* @unimplemented + _Out_writes_(RTLIPV6A2S_MAX_LEN) PSTR S) +{ + WCHAR Buffer[RTLIPV6A2S_MAX_LEN]; + PWSTR Result; + NTSTATUS Status; + + if (!S) + return (PSTR)~0; + + Buffer[0] = 0; + Result = RtlIpv6AddressToStringW(Addr, Buffer); + if (Result == (PWSTR)~0) + return (PSTR)~0; + + ASSERT(Result >= Buffer); + ASSERT(Result < Buffer + RTL_NUMBER_OF(Buffer)); + + Status = RtlUnicodeToMultiByteN(S, RTLIPV6A2S_MAX_LEN, NULL, Buffer, (wcslen(Buffer) + 1) * sizeof(WCHAR)); + if (!NT_SUCCESS(Status)) + return (PSTR)~0; + + return S + strlen(S); +} + +/* +* @implemented */ NTSTATUS NTAPI @@ -467,25 +491,135 @@ _Out_writes_to_(*AddressStringLength, *AddressStringLength) PSTR AddressString, _Inout_ PULONG AddressStringLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; -} - -/* -* @unimplemented + WCHAR Buffer[RTLIPV6A2SEX_MAX_LEN]; + NTSTATUS Status; + + if (!Address || !AddressString || !AddressStringLength) + return STATUS_INVALID_PARAMETER; + + Status = RtlIpv6AddressToStringExW(Address, ScopeId, Port, Buffer, AddressStringLength); + if (!NT_SUCCESS(Status)) + return Status; + + Status = RtlUnicodeToMultiByteN(AddressString, RTLIPV6A2SEX_MAX_LEN, NULL, Buffer, (wcslen(Buffer) + 1) * sizeof(WCHAR)); + if (!NT_SUCCESS(Status)) + return STATUS_INVALID_PARAMETER; + + return STATUS_SUCCESS; +} + +/* +* @implemented */ PWSTR NTAPI RtlIpv6AddressToStringW( _In_ const struct in6_addr *Addr, - _Out_writes_(46) PWSTR S) -{ - UNIMPLEMENTED; - return NULL; -} - -/* -* @unimplemented + _Out_writes_(RTLIPV6A2S_MAX_LEN) PWSTR S) +{ + NTSTATUS Status; + UINT Parts = 8, n; + BOOLEAN SkipOnce = TRUE; + PWSTR End; + size_t Remaining; + + if (!S) + return (PWSTR)~0; + + Remaining = RTLIPV6A2S_MAX_LEN; + /* does it look like an ipv4 address contained in an ipv6?
http://tools.ietf.org/html/rfc2765
*/ + if (!Addr->s6_words[0] && !Addr->s6_words[1] && !Addr->s6_words[2] && !Addr->s6_words[3] && Addr->s6_words[6]) + { + PWSTR Prefix = NULL; + if (Addr->s6_words[4] == 0xffff && !Addr->s6_words[5]) + Prefix = L"ffff:0:"; + else if (!Addr->s6_words[4] && Addr->s6_words[5] == 0xffff) + Prefix = L"ffff:"; + else if (!Addr->s6_words[4] && !Addr->s6_words[5]) + Prefix = L""; + if (Prefix != NULL) + { + Status = RtlStringCchPrintfExW(S, + Remaining, + &End, + NULL, + 0, + L"::%ls%u.%u.%u.%u", + Prefix, + Addr->s6_bytes[12], + Addr->s6_bytes[13], + Addr->s6_bytes[14], + Addr->s6_bytes[15]); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + return (PWSTR)~0; + return End; + } + } + + /* does it look like an ISATAP address?
http://tools.ietf.org/html/rfc5214
*/ + if (!(Addr->s6_words[4] & 0xfffd) && Addr->s6_words[5] == 0xfe5e) + Parts = 6; + + for (n = 0; n < Parts; ++n) + { + if (SkipOnce && ((n + 1) < Parts) && !Addr->s6_words[n] && !Addr->s6_words[n + 1]) + { + SkipOnce = FALSE; + while (!Addr->s6_words[n + 1] && (n + 1) < Parts) + ++n; + *S++ = ':'; + Remaining--; + if ((n + 1) >= Parts) + { + *S++ = ':'; + Remaining--; + } + } + else + { + if (n) + { + *S++ = ':'; + Remaining--; + } + Status = RtlStringCchPrintfExW(S, + Remaining, + &End, + &Remaining, + 0, + L"%x", + WN2H(Addr->s6_words[n])); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + return (PWSTR)~0; + S = End; + } + } + if (Parts < 8) + { + Status = RtlStringCchPrintfExW(S, + Remaining, + &End, + NULL, + 0, + L":%u.%u.%u.%u", + Addr->s6_bytes[12], + Addr->s6_bytes[13], + Addr->s6_bytes[14], + Addr->s6_bytes[15]); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + return (PWSTR)~0; + + return End; + } + *S = UNICODE_NULL; + return S; +} + +/* +* @implemented */ NTSTATUS NTAPI @@ -496,8 +630,68 @@ _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString, _Inout_ PULONG AddressStringLength) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + WCHAR Buffer[RTLIPV6A2SEX_MAX_LEN]; + PWCHAR S = Buffer; + NTSTATUS Status; + ULONG Length; + size_t Remaining; + + if (!Address || !AddressString || !AddressStringLength) + return STATUS_INVALID_PARAMETER; + + if (Port) + *S++ = L'['; + + S = RtlIpv6AddressToStringW(Address, S); + ASSERT(S != (PCWSTR)~0); + if (S == (PCWSTR)~0) + return STATUS_INVALID_PARAMETER; + + ASSERT(S >= Buffer); + ASSERT(S <= Buffer + RTLIPV6A2S_MAX_LEN + 1); + Remaining = RTL_NUMBER_OF(Buffer) - (S - Buffer); + ASSERT(Remaining >= RTLIPV6A2SEX_MAX_LEN - RTLIPV6A2S_MAX_LEN); + + if (ScopeId) + { + Status = RtlStringCchPrintfExW(S, + Remaining, + &S, + &Remaining, + 0, + L"%%%u", + ScopeId); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + return STATUS_INVALID_PARAMETER; + } + + if (Port) + { + Status = RtlStringCchPrintfExW(S, + Remaining, + &S, + &Remaining, + 0, + L"]:%u", + WN2H(Port)); + ASSERT(Status == STATUS_SUCCESS); + if (!NT_SUCCESS(Status)) + return STATUS_INVALID_PARAMETER; + } + + Length = S - Buffer; + ASSERT(Buffer[Length] == UNICODE_NULL); + if (*AddressStringLength > Length) + { + Status = RtlStringCchCopyW(AddressString, *AddressStringLength, Buffer); + ASSERT(Status == STATUS_SUCCESS); + *AddressStringLength = Length + 1; + return STATUS_SUCCESS; + } + + *AddressStringLength = Length + 1; + return STATUS_INVALID_PARAMETER; } /*
9 years, 8 months
1
0
0
0
[tfaber] 67121: [WS2_32] - Import GetAddrInfoW and GetNameInfoW from Wine - Put Wine code in wine/ subfolder CORE-9509 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Apr 9 16:14:46 2015 New Revision: 67121 URL:
http://svn.reactos.org/svn/reactos?rev=67121&view=rev
Log: [WS2_32] - Import GetAddrInfoW and GetNameInfoW from Wine - Put Wine code in wine/ subfolder CORE-9509 #resolve Added: trunk/reactos/dll/win32/ws2_32/wine/ (with props) trunk/reactos/dll/win32/ws2_32/wine/async.c - copied unchanged from r67118, trunk/reactos/dll/win32/ws2_32/misc/async.c trunk/reactos/dll/win32/ws2_32/wine/socket.c (with props) Removed: trunk/reactos/dll/win32/ws2_32/misc/async.c Modified: trunk/reactos/dll/win32/ws2_32/CMakeLists.txt trunk/reactos/dll/win32/ws2_32/misc/stubs.c Modified: trunk/reactos/dll/win32/ws2_32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/CMakeList…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/CMakeLists.txt [iso-8859-1] Thu Apr 9 16:14:46 2015 @@ -19,7 +19,8 @@ add_library(ws2_32 SHARED ${SOURCE} - misc/async.c + wine/async.c + wine/socket.c ws2_32.rc ${CMAKE_CURRENT_BINARY_DIR}/ws2_32.def) Removed: trunk/reactos/dll/win32/ws2_32/misc/async.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/asyn…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/misc/async.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/misc/async.c (removed) @@ -1,440 +0,0 @@ -/* Async WINSOCK DNS services - * - * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka. - * Copyright (C) 1999 Marcus Meissner - * Copyright (C) 2009 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - * - * NOTE: If you make any changes to fix a particular app, make sure - * they don't break something else like Netscape or telnet and ftp - * clients and servers (
www.winsite.com
got a lot of those). - * - * FIXME: - * - Add WSACancel* and correct handle management. (works rather well for - * now without it.) - * - Verify & Check all calls for correctness - * (currently only WSAGetHostByName*, WSAGetServByPort* calls) - * - Check error returns. - * - mirc/mirc32 Finger @linux.kernel.org sometimes fails in threaded mode. - * (not sure why) - * - This implementation did ignore the "NOTE:" section above (since the - * whole stuff did not work anyway to other changes). - */ - -#define WIN32_NO_STATUS -#define _INC_WINDOWS -#define COM_NO_WINDOWS_H - -#include <wine/config.h> - -#include <stdarg.h> -#include <windef.h> -#include <winbase.h> -#include <winuser.h> -#include <winsock2.h> - -#include <wine/debug.h> - -WINE_DEFAULT_DEBUG_CHANNEL(winsock); - - -struct async_query_header -{ - HWND hWnd; - UINT uMsg; - void *sbuf; - INT sbuflen; - HANDLE handle; -}; - -struct async_query_gethostbyname -{ - struct async_query_header query; - char *host_name; -}; - -struct async_query_gethostbyaddr -{ - struct async_query_header query; - char *host_addr; - int host_len; - int host_type; -}; - -struct async_query_getprotobyname -{ - struct async_query_header query; - char *proto_name; -}; - -struct async_query_getprotobynumber -{ - struct async_query_header query; - int proto_number; -}; - -struct async_query_getservbyname -{ - struct async_query_header query; - char *serv_name; - char *serv_proto; -}; - -struct async_query_getservbyport -{ - struct async_query_header query; - char *serv_proto; - int serv_port; -}; - - -/* ----------------------------------- helper functions - */ - -static int list_size(char** l, int item_size) -{ - int i,j = 0; - if(l) - { for(i=0;l[i];i++) - j += (item_size) ? item_size : strlen(l[i]) + 1; - j += (i + 1) * sizeof(char*); } - return j; -} - -static int list_dup(char** l_src, char* ref, int item_size) -{ - char* p = ref; - char** l_to = (char**)ref; - int i,j,k; - - for(j=0;l_src[j];j++) ; - p += (j + 1) * sizeof(char*); - for(i=0;i<j;i++) - { l_to[i] = p; - k = ( item_size ) ? item_size : strlen(l_src[i]) + 1; - memcpy(p, l_src[i], k); p += k; } - l_to[i] = NULL; - return (p - ref); -} - -static DWORD finish_query( struct async_query_header *query, LPARAM lparam ) -{ - PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam ); - HeapFree( GetProcessHeap(), 0, query ); - return 0; -} - -/* ----- hostent */ - -static LPARAM copy_he(void *base, int size, const struct hostent *he) -{ - char *p; - int needed; - struct hostent *to = base; - - if (!he) return MAKELPARAM( 0, GetLastError() ); - - needed = sizeof(struct hostent) + strlen(he->h_name) + 1 + - list_size(he->h_aliases, 0) + - list_size(he->h_addr_list, he->h_length ); - if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); - - to->h_addrtype = he->h_addrtype; - to->h_length = he->h_length; - p = (char *)(to + 1); - to->h_name = p; - strcpy(p, he->h_name); p += strlen(p) + 1; - to->h_aliases = (char **)p; - p += list_dup(he->h_aliases, p, 0); - to->h_addr_list = (char **)p; - list_dup(he->h_addr_list, p, he->h_length); - return MAKELPARAM( needed, 0 ); -} - -static DWORD WINAPI async_gethostbyname(LPVOID arg) -{ - struct async_query_gethostbyname *aq = arg; - struct hostent *he = gethostbyname( aq->host_name ); - - return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); -} - -static DWORD WINAPI async_gethostbyaddr(LPVOID arg) -{ - struct async_query_gethostbyaddr *aq = arg; - struct hostent *he = gethostbyaddr( aq->host_addr, aq->host_len, aq->host_type ); - - return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); -} - -/* ----- protoent */ - -static LPARAM copy_pe(void *base, int size, const struct protoent* pe) -{ - char *p; - int needed; - struct protoent *to = base; - - if (!pe) return MAKELPARAM( 0, GetLastError() ); - - needed = sizeof(struct protoent) + strlen(pe->p_name) + 1 + list_size(pe->p_aliases, 0); - if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); - - to->p_proto = pe->p_proto; - p = (char *)(to + 1); - to->p_name = p; - strcpy(p, pe->p_name); p += strlen(p) + 1; - to->p_aliases = (char **)p; - list_dup(pe->p_aliases, p, 0); - return MAKELPARAM( needed, 0 ); -} - -static DWORD WINAPI async_getprotobyname(LPVOID arg) -{ - struct async_query_getprotobyname *aq = arg; - struct protoent *pe = getprotobyname( aq->proto_name ); - - return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); -} - -static DWORD WINAPI async_getprotobynumber(LPVOID arg) -{ - struct async_query_getprotobynumber *aq = arg; - struct protoent *pe = getprotobynumber( aq->proto_number ); - - return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); -} - -/* ----- servent */ - -static LPARAM copy_se(void *base, int size, const struct servent* se) -{ - char *p; - int needed; - struct servent *to = base; - - if (!se) return MAKELPARAM( 0, GetLastError() ); - - needed = sizeof(struct servent) + strlen(se->s_proto) + strlen(se->s_name) + 2 + list_size(se->s_aliases, 0); - if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); - - to->s_port = se->s_port; - p = (char *)(to + 1); - to->s_name = p; - strcpy(p, se->s_name); p += strlen(p) + 1; - to->s_proto = p; - strcpy(p, se->s_proto); p += strlen(p) + 1; - to->s_aliases = (char **)p; - list_dup(se->s_aliases, p, 0); - return MAKELPARAM( needed, 0 ); -} - -static DWORD WINAPI async_getservbyname(LPVOID arg) -{ - struct async_query_getservbyname *aq = arg; - struct servent *se = getservbyname( aq->serv_name, aq->serv_proto ); - - return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); -} - -static DWORD WINAPI async_getservbyport(LPVOID arg) -{ - struct async_query_getservbyport *aq = arg; - struct servent *se = getservbyport( aq->serv_port, aq->serv_proto ); - - return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); -} - - -/**************************************************************************** - * The main async help function. - * - * It either starts a thread or just calls the function directly for platforms - * with no thread support. This relies on the fact that PostMessage() does - * not actually call the windowproc before the function returns. - */ -static HANDLE run_query( HWND hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, - struct async_query_header *query, void *sbuf, INT sbuflen ) -{ - static LONG next_handle = 0xdead; - HANDLE thread; - ULONG handle; - do - handle = LOWORD( InterlockedIncrement( &next_handle )); - while (!handle); /* avoid handle 0 */ - - query->hWnd = hWnd; - query->uMsg = uMsg; - query->handle = UlongToHandle( handle ); - query->sbuf = sbuf; - query->sbuflen = sbuflen; - - thread = CreateThread( NULL, 0, func, query, 0, NULL ); - if (!thread) - { - SetLastError( WSAEWOULDBLOCK ); - HeapFree( GetProcessHeap(), 0, query ); - return 0; - } - CloseHandle( thread ); - return UlongToHandle( handle ); -} - - -/*********************************************************************** - * WSAAsyncGetHostByAddr (WS2_32.102) - */ -HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr, - INT len, INT type, LPSTR sbuf, INT buflen) -{ - struct async_query_gethostbyaddr *aq; - - TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len ); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - aq->host_addr = (char *)(aq + 1); - aq->host_len = len; - aq->host_type = type; - memcpy( aq->host_addr, addr, len ); - return run_query( hWnd, uMsg, async_gethostbyaddr, &aq->query, sbuf, buflen ); -} - -/*********************************************************************** - * WSAAsyncGetHostByName (WS2_32.103) - */ -HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPSTR sbuf, INT buflen) -{ - struct async_query_gethostbyname *aq; - unsigned int len = strlen(name) + 1; - - TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - aq->host_name = (char *)(aq + 1); - strcpy( aq->host_name, name ); - return run_query( hWnd, uMsg, async_gethostbyname, &aq->query, sbuf, buflen ); -} - -/*********************************************************************** - * WSAAsyncGetProtoByName (WS2_32.105) - */ -HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPSTR sbuf, INT buflen) -{ - struct async_query_getprotobyname *aq; - unsigned int len = strlen(name) + 1; - - TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - aq->proto_name = (char *)(aq + 1); - strcpy( aq->proto_name, name ); - return run_query( hWnd, uMsg, async_getprotobyname, &aq->query, sbuf, buflen ); -} - - -/*********************************************************************** - * WSAAsyncGetProtoByNumber (WS2_32.104) - */ -HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number, - LPSTR sbuf, INT buflen) -{ - struct async_query_getprotobynumber *aq; - - TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - aq->proto_number = number; - return run_query( hWnd, uMsg, async_getprotobynumber, &aq->query, sbuf, buflen ); -} - -/*********************************************************************** - * WSAAsyncGetServByName (WS2_32.107) - */ -HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPCSTR proto, LPSTR sbuf, INT buflen) -{ - struct async_query_getservbyname *aq; - unsigned int len1 = strlen(name) + 1; - unsigned int len2 = proto ? strlen(proto) + 1 : 0; - - TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto)); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - - aq->serv_name = (char *)(aq + 1); - strcpy( aq->serv_name, name ); - - if (proto) - { - aq->serv_proto = aq->serv_name + len1; - strcpy( aq->serv_proto, proto ); - } - else - aq->serv_proto = NULL; - - return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen ); -} - -/*********************************************************************** - * WSAAsyncGetServByPort (WS2_32.106) - */ -HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, - LPCSTR proto, LPSTR sbuf, INT buflen) -{ - struct async_query_getservbyport *aq; - unsigned int len = proto ? strlen(proto) + 1 : 0; - - TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); - - if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) - { - SetLastError( WSAEWOULDBLOCK ); - return 0; - } - - if (proto) - { - aq->serv_proto = (char *)(aq + 1); - strcpy( aq->serv_proto, proto ); - } - else - aq->serv_proto = NULL; - - aq->serv_port = port; - - return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen ); -} Modified: trunk/reactos/dll/win32/ws2_32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/stub…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/misc/stubs.c [iso-8859-1] Thu Apr 9 16:14:46 2015 @@ -930,39 +930,4 @@ return FALSE; } -/* - * @unimplemented - */ -INT -EXPORT -GetAddrInfoW(IN PCWSTR pszNodeName, - IN PCWSTR pszServiceName, - IN const ADDRINFOW *ptHints, - OUT PADDRINFOW *pptResult) -{ - UNIMPLEMENTED - - WSASetLastError(EAI_FAIL); - return EAI_FAIL; -} - -/* - * @unimplemented - */ -INT -EXPORT -GetNameInfoW(IN CONST SOCKADDR *pSockaddr, - IN socklen_t SockaddrLength, - OUT PWCHAR pNodeBuffer, - IN DWORD NodeBufferSize, - OUT PWCHAR pServiceBuffer, - IN DWORD ServiceBufferSize, - IN INT Flags) -{ - UNIMPLEMENTED - - WSASetLastError(EAI_FAIL); - return EAI_FAIL; -} - /* EOF */ Propchange: trunk/reactos/dll/win32/ws2_32/wine/ ------------------------------------------------------------------------------ bugtraq:message = See issue %BUGID% for more details. Propchange: trunk/reactos/dll/win32/ws2_32/wine/ ------------------------------------------------------------------------------ bugtraq:url =
https://jira.reactos.org/browse/%BUGID%
Propchange: trunk/reactos/dll/win32/ws2_32/wine/ ------------------------------------------------------------------------------ tsvn:logminsize = 10 Added: trunk/reactos/dll/win32/ws2_32/wine/socket.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/wine/sock…
============================================================================== --- trunk/reactos/dll/win32/ws2_32/wine/socket.c (added) +++ trunk/reactos/dll/win32/ws2_32/wine/socket.c [iso-8859-1] Thu Apr 9 16:14:46 2015 @@ -0,0 +1,198 @@ +/* + * based on Windows Sockets 1.1 specs + * + * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka. + * Copyright (C) 2001 Stefan Leichter + * Copyright (C) 2004 Hans Leidekker + * Copyright (C) 2005 Marcus Meissner + * Copyright (C) 2006-2008 Kai Blin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + * NOTE: If you make any changes to fix a particular app, make sure + * they don't break something else like Netscape or telnet and ftp + * clients and servers (
www.winsite.com
got a lot of those). + */ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H +#include <windef.h> +#include <winbase.h> +#include <winnls.h> +#include <ws2tcpip.h> + +static inline void FreeAddrInfoW_(struct addrinfoW *pAddrInfo) +{ + freeaddrinfo((struct addrinfo *)pAddrInfo); +} +#define FreeAddrInfoW FreeAddrInfoW_ + +static struct addrinfoW *addrinfo_AtoW(const struct addrinfo *ai) +{ + struct addrinfoW *ret; + + if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct addrinfoW)))) return NULL; + ret->ai_flags = ai->ai_flags; + ret->ai_family = ai->ai_family; + ret->ai_socktype = ai->ai_socktype; + ret->ai_protocol = ai->ai_protocol; + ret->ai_addrlen = ai->ai_addrlen; + ret->ai_canonname = NULL; + ret->ai_addr = NULL; + ret->ai_next = NULL; + if (ai->ai_canonname) + { + int len = MultiByteToWideChar(CP_ACP, 0, ai->ai_canonname, -1, NULL, 0); + if (!(ret->ai_canonname = HeapAlloc(GetProcessHeap(), 0, len))) + { + HeapFree(GetProcessHeap(), 0, ret); + return NULL; + } + MultiByteToWideChar(CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len); + } + if (ai->ai_addr) + { + if (!(ret->ai_addr = HeapAlloc(GetProcessHeap(), 0, ai->ai_addrlen))) + { + HeapFree(GetProcessHeap(), 0, ret->ai_canonname); + HeapFree(GetProcessHeap(), 0, ret); + return NULL; + } + memcpy(ret->ai_addr, ai->ai_addr, ai->ai_addrlen); + } + return ret; +} + +static struct addrinfoW *addrinfo_list_AtoW(const struct addrinfo *info) +{ + struct addrinfoW *ret, *infoW; + + if (!(ret = infoW = addrinfo_AtoW(info))) return NULL; + while (info->ai_next) + { + if (!(infoW->ai_next = addrinfo_AtoW(info->ai_next))) + { + FreeAddrInfoW(ret); + return NULL; + } + infoW = infoW->ai_next; + info = info->ai_next; + } + return ret; +} + +static struct addrinfo *addrinfo_WtoA(const struct addrinfoW *ai) +{ + struct addrinfo *ret; + + if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct addrinfo)))) return NULL; + ret->ai_flags = ai->ai_flags; + ret->ai_family = ai->ai_family; + ret->ai_socktype = ai->ai_socktype; + ret->ai_protocol = ai->ai_protocol; + ret->ai_addrlen = ai->ai_addrlen; + ret->ai_canonname = NULL; + ret->ai_addr = NULL; + ret->ai_next = NULL; + if (ai->ai_canonname) + { + int len = WideCharToMultiByte(CP_ACP, 0, ai->ai_canonname, -1, NULL, 0, NULL, NULL); + if (!(ret->ai_canonname = HeapAlloc(GetProcessHeap(), 0, len))) + { + HeapFree(GetProcessHeap(), 0, ret); + return NULL; + } + WideCharToMultiByte(CP_ACP, 0, ai->ai_canonname, -1, ret->ai_canonname, len, NULL, NULL); + } + if (ai->ai_addr) + { + if (!(ret->ai_addr = HeapAlloc(GetProcessHeap(), 0, sizeof(struct sockaddr)))) + { + HeapFree(GetProcessHeap(), 0, ret->ai_canonname); + HeapFree(GetProcessHeap(), 0, ret); + return NULL; + } + memcpy(ret->ai_addr, ai->ai_addr, sizeof(struct sockaddr)); + } + return ret; +} + +/*********************************************************************** + * GetAddrInfoW (WS2_32.@) + */ +int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hints, PADDRINFOW *res) +{ + int ret, len; + char *nodenameA = NULL, *servnameA = NULL; + struct addrinfo *resA, *hintsA = NULL; + + *res = NULL; + if (nodename) + { + len = WideCharToMultiByte(CP_ACP, 0, nodename, -1, NULL, 0, NULL, NULL); + if (!(nodenameA = HeapAlloc(GetProcessHeap(), 0, len))) return EAI_MEMORY; + WideCharToMultiByte(CP_ACP, 0, nodename, -1, nodenameA, len, NULL, NULL); + } + if (servname) + { + len = WideCharToMultiByte(CP_ACP, 0, servname, -1, NULL, 0, NULL, NULL); + if (!(servnameA = HeapAlloc(GetProcessHeap(), 0, len))) + { + HeapFree(GetProcessHeap(), 0, nodenameA); + return EAI_MEMORY; + } + WideCharToMultiByte(CP_ACP, 0, servname, -1, servnameA, len, NULL, NULL); + } + + if (hints) hintsA = addrinfo_WtoA(hints); + ret = getaddrinfo(nodenameA, servnameA, hintsA, &resA); + freeaddrinfo(hintsA); + + if (!ret) + { + *res = addrinfo_list_AtoW(resA); + freeaddrinfo(resA); + } + + HeapFree(GetProcessHeap(), 0, nodenameA); + HeapFree(GetProcessHeap(), 0, servnameA); + return ret; +} + +int WINAPI GetNameInfoW(const SOCKADDR *sa, socklen_t salen, PWCHAR host, + DWORD hostlen, PWCHAR serv, DWORD servlen, INT flags) +{ + int ret; + char *hostA = NULL, *servA = NULL; + + if (host && (!(hostA = HeapAlloc(GetProcessHeap(), 0, hostlen)))) return EAI_MEMORY; + if (serv && (!(servA = HeapAlloc(GetProcessHeap(), 0, servlen)))) + { + HeapFree(GetProcessHeap(), 0, hostA); + return EAI_MEMORY; + } + + ret = getnameinfo(sa, salen, hostA, hostlen, servA, servlen, flags); + if (!ret) + { + if (host) MultiByteToWideChar(CP_ACP, 0, hostA, -1, host, hostlen); + if (serv) MultiByteToWideChar(CP_ACP, 0, servA, -1, serv, servlen); + } + + HeapFree(GetProcessHeap(), 0, hostA); + HeapFree(GetProcessHeap(), 0, servA); + return ret; +} Propchange: trunk/reactos/dll/win32/ws2_32/wine/socket.c ------------------------------------------------------------------------------ svn:eol-style = native
9 years, 8 months
1
0
0
0
[akhaldi] 67120: [KERNEL32_VISTA] Add and export IdnTo{Ascii, Unicode}. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 16:02:48 2015 New Revision: 67120 URL:
http://svn.reactos.org/svn/reactos?rev=67120&view=rev
Log: [KERNEL32_VISTA] Add and export IdnTo{Ascii,Unicode}. CORE-9246 Added: trunk/reactos/dll/win32/kernel32_vista/IdnToAscii.c (with props) trunk/reactos/dll/win32/kernel32_vista/IdnToUnicode.c (with props) trunk/reactos/dll/win32/kernel32_vista/nameprep.c (with props) Modified: trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/kernel32_vista/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/C…
Added: trunk/reactos/dll/win32/kernel32_vista/IdnToAscii.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/I…
Added: trunk/reactos/dll/win32/kernel32_vista/IdnToUnicode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/I…
Modified: trunk/reactos/dll/win32/kernel32_vista/kernel32_vista.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/k…
Added: trunk/reactos/dll/win32/kernel32_vista/nameprep.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32_vista/n…
9 years, 8 months
1
0
0
0
[akhaldi] 67119: [PSDK] Add missing IdnTo{Ascii, Unicode} declarations.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 16:02:32 2015 New Revision: 67119 URL:
http://svn.reactos.org/svn/reactos?rev=67119&view=rev
Log: [PSDK] Add missing IdnTo{Ascii,Unicode} declarations. Modified: trunk/reactos/include/psdk/winnls.h Modified: trunk/reactos/include/psdk/winnls.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnls.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winnls.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winnls.h [iso-8859-1] Thu Apr 9 16:02:32 2015 @@ -846,6 +846,29 @@ LANGID WINAPI GetUserDefaultLangID(void); LCID WINAPI GetUserDefaultLCID(void); GEOID WINAPI GetUserGeoID(_In_ GEOCLASS); + +#if (WINVER >= 0x0600) + +int +WINAPI +IdnToAscii( + _In_ DWORD dwFlags, + _In_reads_(cchUnicodeChar) LPCWSTR lpUnicodeCharStr, + _In_ int cchUnicodeChar, + _Out_writes_opt_(cchASCIIChar) LPWSTR lpASCIICharStr, + _In_ int cchASCIIChar); + +int +WINAPI +IdnToUnicode( + _In_ DWORD dwFlags, + _In_reads_(cchASCIIChar) LPCWSTR lpASCIICharStr, + _In_ int cchASCIIChar, + _Out_writes_opt_(cchUnicodeChar) LPWSTR lpUnicodeCharStr, + _In_ int cchUnicodeChar); + +#endif /* WINVER >= 0x0600 */ + BOOL WINAPI IsDBCSLeadByte(_In_ BYTE); BOOL WINAPI IsDBCSLeadByteEx(_In_ UINT, _In_ BYTE);
9 years, 8 months
1
0
0
0
[akhaldi] 67118: [SECUR32_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 14:26:41 2015 New Revision: 67118 URL:
http://svn.reactos.org/svn/reactos?rev=67118&view=rev
Log: [SECUR32_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/secur32/ntlm.c trunk/rostests/winetests/secur32/schannel.c Modified: trunk/rostests/winetests/secur32/ntlm.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/ntlm.c?…
============================================================================== --- trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] (original) +++ trunk/rostests/winetests/secur32/ntlm.c [iso-8859-1] Thu Apr 9 14:26:41 2015 @@ -1366,9 +1366,8 @@ InitFunctionPtrs(); if(pFreeCredentialsHandle && pDeleteSecurityContext && - pDeleteSecurityContext && pAcquireCredentialsHandleA && - pInitializeSecurityContextA && pCompleteAuthToken && - pQuerySecurityPackageInfoA) + pAcquireCredentialsHandleA && pInitializeSecurityContextA && + pCompleteAuthToken && pQuerySecurityPackageInfoA) { if(!testAcquireCredentialsHandle()) goto cleanup; Modified: trunk/rostests/winetests/secur32/schannel.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/secur32/schanne…
============================================================================== --- trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] (original) +++ trunk/rostests/winetests/secur32/schannel.c [iso-8859-1] Thu Apr 9 14:26:41 2015 @@ -518,7 +518,7 @@ cert_cnt++; } - ok(cert_cnt == 2, "cert_cnt = %u\n", cert_cnt); + ok(cert_cnt == 3, "cert_cnt = %u\n", cert_cnt); ok(incl_remote, "context does not contain cert itself\n"); } @@ -534,7 +534,7 @@ cred->aphMappers = NULL; cred->cSupportedAlgs = 0; cred->palgSupportedAlgs = NULL; - cred->grbitEnabledProtocols = SP_PROT_SSL3_CLIENT; + cred->grbitEnabledProtocols = SP_PROT_TLS1_CLIENT; cred->dwMinimumCipherStrength = 0; cred->dwMaximumCipherStrength = 0; cred->dwSessionLifespan = 0; @@ -686,7 +686,7 @@ ok(status == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", status); if (status != SEC_E_OK) return; - test_supported_protocols(&cred_handle, SP_PROT_SSL3_CLIENT); + test_supported_protocols(&cred_handle, SP_PROT_TLS1_CLIENT); /* Initialize the connection */ init_buffers(&buffers[0], 4, buf_size); @@ -701,6 +701,19 @@ buffers[1].cBuffers = 1; buffers[1].pBuffers[0].BufferType = SECBUFFER_TOKEN; buffers[0].pBuffers[0].cbBuffer = 1; + memset(buffers[1].pBuffers[0].pvBuffer, 0xfa, buf_size); + status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", + ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, + 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); +todo_wine + ok(status == SEC_E_INVALID_TOKEN, "Expected SEC_E_INVALID_TOKEN, got %08x\n", status); +todo_wine + ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n"); + + buffers[1].cBuffers = 1; + buffers[1].pBuffers[0].BufferType = SECBUFFER_TOKEN; + buffers[0].pBuffers[0].cbBuffer = 1; + memset(buffers[1].pBuffers[0].pvBuffer, 0, buf_size); status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL); @@ -708,6 +721,7 @@ todo_wine ok(buffers[0].pBuffers[0].cbBuffer == 0, "Output buffer size was not set to 0.\n"); + buffers[0].pBuffers[0].cbBuffer = 0; status = pInitializeSecurityContextA(&cred_handle, &context, (SEC_CHAR *)"localhost", ISC_REQ_CONFIDENTIALITY|ISC_REQ_STREAM, 0, 0, &buffers[1], 0, NULL, &buffers[0], &attrs, NULL);
9 years, 8 months
1
0
0
0
[akhaldi] 67117: [WINHTTP_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 13:31:23 2015 New Revision: 67117 URL:
http://svn.reactos.org/svn/reactos?rev=67117&view=rev
Log: [WINHTTP_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/rostests/winetests/winhttp/notification.c trunk/rostests/winetests/winhttp/url.c trunk/rostests/winetests/winhttp/winhttp.c Modified: trunk/rostests/winetests/winhttp/notification.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/notific…
============================================================================== --- trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] (original) +++ trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] Thu Apr 9 13:31:23 2015 @@ -186,6 +186,11 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + goto done; + } ok(ret, "failed to send request %u\n", GetLastError()); setup_test( &info, winhttp_receive_response, __LINE__ ); @@ -209,6 +214,11 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + goto done; + } ok(ret, "failed to send request %u\n", GetLastError()); setup_test( &info, winhttp_receive_response, __LINE__ ); @@ -253,6 +263,11 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + goto done; + } ok(ret, "failed to send request %u\n", GetLastError()); setup_test( &info, winhttp_receive_response, __LINE__ ); @@ -276,6 +291,11 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + goto done; + } ok(ret, "failed to send request %u\n", GetLastError()); setup_test( &info, winhttp_receive_response, __LINE__ ); @@ -288,6 +308,7 @@ ok(status == 200, "request failed unexpectedly %u\n", status); setup_test( &info, winhttp_close_handle, __LINE__ ); +done: WinHttpCloseHandle( req ); WinHttpCloseHandle( con ); WinHttpCloseHandle( ses ); @@ -353,6 +374,11 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + goto done; + } ok(ret, "failed to send request %u\n", GetLastError()); setup_test( &info, winhttp_receive_response, __LINE__ ); @@ -365,6 +391,7 @@ ok(status == 200, "request failed unexpectedly %u\n", status); setup_test( &info, winhttp_close_handle, __LINE__ ); +done: WinHttpCloseHandle( req ); WinHttpCloseHandle( con ); WinHttpCloseHandle( ses ); @@ -435,6 +462,15 @@ setup_test( &info, winhttp_send_request, __LINE__ ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); + if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + { + skip("connection failed, skipping\n"); + WinHttpCloseHandle( req ); + WinHttpCloseHandle( con ); + WinHttpCloseHandle( ses ); + CloseHandle( info.wait ); + return; + } ok(ret, "failed to send request %u\n", GetLastError()); WaitForSingleObject( info.wait, INFINITE ); Modified: trunk/rostests/winetests/winhttp/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/url.c?r…
============================================================================== --- trunk/rostests/winetests/winhttp/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/winhttp/url.c [iso-8859-1] Thu Apr 9 13:31:23 2015 @@ -38,40 +38,37 @@ static const WCHAR url1[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url2[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url3[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0}; -static const WCHAR url4[] = +static const WCHAR url2[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0}; +static const WCHAR url3[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url5[] = {'h','t','t','p',':','/','/',0}; -static const WCHAR url6[] = +static const WCHAR url4[] = {'h','t','t','p',':','/','/',0}; +static const WCHAR url5[] = {'f','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url7[] = +static const WCHAR url6[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','2','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url8[] = +static const WCHAR url7[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t', '%','2','0','!','%','2','2','%','2','3','$','%','2','5','&','\'','(',')','*','+',',','-','.','/',':',';','%','3','C','=','%','3','E','?','@','%', '5','B','%','5','C','%','5','D','%','5','E','_','%','6','0','%','7','B','%','7','C','%','7','D','%','7','E',0}; +static const WCHAR url8[] = + {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', + '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; static const WCHAR url9[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; + '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; static const WCHAR url10[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url11[] = {'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; +static const WCHAR url11[] = + {'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0}; static const WCHAR url12[] = - {'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0}; + {'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0}; static const WCHAR url13[] = - {'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0}; -static const WCHAR url14[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o',' ','g','/','p','a','t','h',' ','w','i','t','h',' ','s','p','a','c','e','s',0}; -static const WCHAR url15[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0}; +static const WCHAR url14[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0}; static const WCHAR url_k1[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', @@ -214,7 +211,7 @@ ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); ok( len == 56, "expected len 56 got %u\n", len ); - ok( !lstrcmpW( url, url3 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url2 ), "url doesn't match\n" ); /* valid password, NULL username */ fill_url_components( &uc ); @@ -243,7 +240,7 @@ ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); ok( len == 38, "expected len 38 got %u\n", len ); - ok( !lstrcmpW( url, url4 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url3 ), "url doesn't match\n" ); /* empty username, empty password */ fill_url_components( &uc ); @@ -254,7 +251,7 @@ ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); ok( len == 56, "expected len 56 got %u\n", len ); - ok( !lstrcmpW( url, url5 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url4 ), "url doesn't match\n" ); /* nScheme has lower precedence than lpszScheme */ fill_url_components( &uc ); @@ -264,8 +261,8 @@ len = 256; ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); - ok( len == lstrlenW( url6 ), "expected len %d got %u\n", lstrlenW( url6 ) + 1, len ); - ok( !lstrcmpW( url, url6 ), "url doesn't match\n" ); + ok( len == lstrlenW( url5 ), "expected len %d got %u\n", lstrlenW( url5 ) + 1, len ); + ok( !lstrcmpW( url, url5 ), "url doesn't match\n" ); /* non-standard port */ uc.lpszScheme = http; @@ -276,7 +273,7 @@ ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); ok( len == 59, "expected len 59 got %u\n", len ); - ok( !lstrcmpW( url, url7 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url6 ), "url doesn't match\n" ); /* escape extra info */ fill_url_components( &uc ); @@ -287,7 +284,7 @@ ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len ); ok( ret, "expected success\n" ); ok( len == 113, "expected len 113 got %u\n", len ); - ok( !lstrcmpW( url, url8 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url7 ), "url doesn't match\n" ); /* NULL lpszScheme, 0 nScheme and nPort */ fill_url_components( &uc ); @@ -300,7 +297,7 @@ ret = WinHttpCreateUrl( &uc, 0, url, &len ); ok( ret, "expected success\n" ); ok( len == 58, "expected len 58 got %u\n", len ); - ok( !lstrcmpW( url, url9 ), "url doesn't match\n" ); + ok( !lstrcmpW( url, url8 ), "url doesn't match\n" ); HeapFree( GetProcessHeap(), 0, url ); } @@ -480,7 +477,7 @@ ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n", uc.dwExtraInfoLength ); reset_url_components( &uc ); - ret = WinHttpCrackUrl( url5, 0, 0, &uc ); + ret = WinHttpCrackUrl( url4, 0, 0, &uc ); ok( !ret, "WinHttpCrackUrl succeeded\n" ); reset_url_components( &uc ); @@ -496,7 +493,7 @@ /* decoding without buffers */ reset_url_components( &uc ); SetLastError(0xdeadbeef); - ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc ); + ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc ); error = GetLastError(); ok( !ret, "WinHttpCrackUrl succeeded\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u, expected ERROR_INVALID_PARAMETER\n", error ); @@ -517,7 +514,7 @@ uc.dwExtraInfoLength = 40; path[0] = 0; - ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc ); + ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc ); ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() ); ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected path\n" ); ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n", uc.dwUrlPathLength ); @@ -541,7 +538,7 @@ uc.dwExtraInfoLength = 20; path[0] = 0; - ret = WinHttpCrackUrl( url7, 0, 0, &uc ); + ret = WinHttpCrackUrl( url6, 0, 0, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected host name: %s\n", wine_dbgstr_w(uc.lpszHostName) ); ok( uc.dwHostNameLength == 14, "unexpected host name length: %d\n", uc.dwHostNameLength ); @@ -549,17 +546,17 @@ /* decoding without buffers */ reset_url_components( &uc ); + ret = WinHttpCrackUrl( url8, 0, 0, &uc ); + ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); + ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort ); + + reset_url_components( &uc ); ret = WinHttpCrackUrl( url9, 0, 0, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); - ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort ); + ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort ); reset_url_components( &uc ); ret = WinHttpCrackUrl( url10, 0, 0, &uc ); - ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); - ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort ); - - reset_url_components( &uc ); - ret = WinHttpCrackUrl( url11, 0, 0, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort ); @@ -578,19 +575,19 @@ ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error ); reset_url_components( &uc ); - ret = WinHttpCrackUrl( url12, 0, 0, &uc); + ret = WinHttpCrackUrl( url11, 0, 0, &uc); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" ); - ok( uc.lpszScheme == url12,"unexpected scheme\n" ); + ok( uc.lpszScheme == url11,"unexpected scheme\n" ); ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" ); ok( uc.lpszUserName == NULL, "unexpected username\n" ); ok( uc.lpszPassword == NULL, "unexpected password\n" ); - ok( uc.lpszHostName == url12 + 7, "unexpected hostname\n" ); + ok( uc.lpszHostName == url11 + 7, "unexpected hostname\n" ); ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" ); ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort ); - ok( uc.lpszUrlPath == url12 + 18, "unexpected path\n" ); + ok( uc.lpszUrlPath == url11 + 18, "unexpected path\n" ); ok( uc.dwUrlPathLength == 5, "unexpected path length\n" ); - ok( uc.lpszExtraInfo == url12 + 23, "unexpected extra info\n" ); + ok( uc.lpszExtraInfo == url11 + 23, "unexpected extra info\n" ); ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" ); uc.lpszScheme = scheme; @@ -606,7 +603,7 @@ uc.lpszExtraInfo = NULL; uc.dwExtraInfoLength = 0; uc.nPort = 0; - ret = WinHttpCrackUrl( url13, 0, ICU_DECODE, &uc ); + ret = WinHttpCrackUrl( url12, 0, ICU_DECODE, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); uc.lpszScheme = scheme; @@ -622,7 +619,7 @@ uc.lpszExtraInfo = NULL; uc.dwExtraInfoLength = 0; uc.nPort = 0; - ret = WinHttpCrackUrl( url14, 0, ICU_ESCAPE|ICU_DECODE, &uc ); + ret = WinHttpCrackUrl( url13, 0, ICU_ESCAPE|ICU_DECODE, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" ); ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" ); @@ -642,19 +639,19 @@ uc.dwUrlPathLength = ~0u; uc.lpszExtraInfo = NULL; uc.dwExtraInfoLength = ~0u; - ret = WinHttpCrackUrl( url15, 0, 0, &uc ); + ret = WinHttpCrackUrl( url14, 0, 0, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme) ); ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength ); ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n", uc.nScheme ); - ok( !lstrcmpW( uc.lpszHostName, url15 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) ); + ok( !lstrcmpW( uc.lpszHostName, url14 + 7 ), "unexpected hostname %s\n", wine_dbgstr_w(uc.lpszHostName) ); ok( uc.dwHostNameLength == 14, "unexpected length %u\n", uc.dwHostNameLength ); ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort ); ok( !uc.lpszUserName, "unexpected username\n" ); ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength ); ok( !uc.lpszPassword, "unexpected password\n" ); ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength ); - ok( !lstrcmpW( uc.lpszUrlPath, url15 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) ); + ok( !lstrcmpW( uc.lpszUrlPath, url14 + 21 ), "unexpected path %s\n", wine_dbgstr_w(uc.lpszUrlPath) ); ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength ); ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n", wine_dbgstr_w(uc.lpszExtraInfo) ); ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n", uc.dwExtraInfoLength ); @@ -675,7 +672,7 @@ uc.lpszExtraInfo = NULL; uc.dwExtraInfoLength = 0; SetLastError( 0xdeadbeef ); - ret = WinHttpCrackUrl( url15, 0, 0, &uc ); + ret = WinHttpCrackUrl( url14, 0, 0, &uc ); error = GetLastError(); ok( !ret, "WinHttpCrackUrl succeeded\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); Modified: trunk/rostests/winetests/winhttp/winhttp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/winhttp…
============================================================================== --- trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] (original) +++ trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] Thu Apr 9 13:31:23 2015 @@ -882,12 +882,15 @@ ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT, &info, &size ); ok(ret, "failed to retrieve certificate info %u\n", GetLastError()); - trace("lpszSubjectInfo %s\n", wine_dbgstr_w(info.lpszSubjectInfo)); - trace("lpszIssuerInfo %s\n", wine_dbgstr_w(info.lpszIssuerInfo)); - trace("lpszProtocolName %s\n", wine_dbgstr_w(info.lpszProtocolName)); - trace("lpszSignatureAlgName %s\n", wine_dbgstr_w(info.lpszSignatureAlgName)); - trace("lpszEncryptionAlgName %s\n", wine_dbgstr_w(info.lpszEncryptionAlgName)); - trace("dwKeySize %u\n", info.dwKeySize); + if (ret) + { + trace("lpszSubjectInfo %s\n", wine_dbgstr_w(info.lpszSubjectInfo)); + trace("lpszIssuerInfo %s\n", wine_dbgstr_w(info.lpszIssuerInfo)); + trace("lpszProtocolName %s\n", wine_dbgstr_w(info.lpszProtocolName)); + trace("lpszSignatureAlgName %s\n", wine_dbgstr_w(info.lpszSignatureAlgName)); + trace("lpszEncryptionAlgName %s\n", wine_dbgstr_w(info.lpszEncryptionAlgName)); + trace("dwKeySize %u\n", info.dwKeySize); + } ret = WinHttpReceiveResponse(req, NULL); ok(ret, "failed to receive response %u\n", GetLastError()); @@ -957,7 +960,7 @@ ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); - if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT) + if (!ret && (GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT || GetLastError() == ERROR_WINHTTP_TIMEOUT)) { skip("connection failed, skipping\n"); goto done; @@ -1804,6 +1807,10 @@ "Server: winetest\r\n" "\r\n"; +static const char notmodified[] = +"HTTP/1.1 304 Not Modified\r\n" +"\r\n"; + static const char noauthmsg[] = "HTTP/1.1 401 Unauthorized\r\n" "Server: winetest\r\n" @@ -1811,6 +1818,17 @@ "WWW-Authenticate: Basic realm=\"placebo\"\r\n" "\r\n"; +static const char okauthmsg[] = +"HTTP/1.1 200 OK\r\n" +"Server: winetest\r\n" +"Connection: close\r\n" +"\r\n"; + +static const char headmsg[] = +"HTTP/1.1 200 OK\r\n" +"Content-Length: 100\r\n" +"\r\n"; + struct server_info { HANDLE event; @@ -1822,7 +1840,7 @@ static DWORD CALLBACK server_thread(LPVOID param) { struct server_info *si = param; - int r, c, i, on; + int r, c = -1, i, on; SOCKET s; struct sockaddr_in sa; char buffer[0x100]; @@ -1851,7 +1869,7 @@ SetEvent(si->event); do { - c = accept(s, NULL, NULL); + if (c == -1) c = accept(s, NULL, NULL); memset(buffer, 0, sizeof buffer); for(i = 0; i < sizeof buffer - 1; i++) @@ -1872,7 +1890,7 @@ if (strstr(buffer, "/auth")) { if (strstr(buffer, "Authorization: Basic dXNlcjpwd2Q=")) - send(c, okmsg, sizeof okmsg - 1, 0); + send(c, okauthmsg, sizeof okauthmsg - 1, 0); else send(c, noauthmsg, sizeof noauthmsg - 1, 0); } @@ -1890,6 +1908,17 @@ if (strstr(buffer, "GET /no_content")) { send(c, nocontentmsg, sizeof nocontentmsg - 1, 0); + continue; + } + if (strstr(buffer, "GET /not_modified")) + { + send(c, notmodified, sizeof notmodified - 1, 0); + continue; + } + if (strstr(buffer, "HEAD /head")) + { + send(c, headmsg, sizeof headmsg - 1, 0); + continue; } if (strstr(buffer, "GET /quit")) { @@ -1899,6 +1928,7 @@ } shutdown(c, 2); closesocket(c); + c = -1; } while (!last_request); @@ -2132,7 +2162,7 @@ { static const WCHAR no_contentW[] = {'/','n','o','_','c','o','n','t','e','n','t',0}; HINTERNET ses, con, req; - WCHAR buf[128]; + char buf[128]; DWORD size, len = sizeof(buf), bytes_read, status; BOOL ret; @@ -2184,6 +2214,7 @@ ok(size == 0, "expected 0, got %d\n", size); ret = WinHttpReadData(req, buf, len, &bytes_read); + ok(ret, "expected success\n"); ok( bytes_read == 0, "expected 0, got %u available\n", bytes_read ); size = 12345; @@ -2203,6 +2234,114 @@ WinHttpCloseHandle(con); WinHttpCloseHandle(ses); +} + +static void test_head_request(int port) +{ + static const WCHAR verbW[] = {'H','E','A','D',0}; + static const WCHAR headW[] = {'/','h','e','a','d',0}; + HINTERNET ses, con, req; + char buf[128]; + DWORD size, len, count, status; + BOOL ret; + + ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ok(ses != NULL, "failed to open session %u\n", GetLastError()); + + con = WinHttpConnect(ses, localhostW, port, 0); + ok(con != NULL, "failed to open a connection %u\n", GetLastError()); + + req = WinHttpOpenRequest(con, verbW, headW, NULL, NULL, NULL, 0); + ok(req != NULL, "failed to open a request %u\n", GetLastError()); + + ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); + ok(ret, "failed to send request %u\n", GetLastError()); + + ret = WinHttpReceiveResponse(req, NULL); + ok(ret, "failed to receive response %u\n", GetLastError()); + + status = 0xdeadbeef; + size = sizeof(status); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER, + NULL, &status, &size, NULL); + ok(ret, "failed to get status code %u\n", GetLastError()); + ok(status == 200, "got %u\n", status); + + len = 0xdeadbeef; + size = sizeof(len); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CONTENT_LENGTH | WINHTTP_QUERY_FLAG_NUMBER, + NULL, &len, &size, 0); + ok(ret, "failed to get content-length header %u\n", GetLastError()); + ok(len == 100, "got %u\n", len); + + count = 0xdeadbeef; + ret = WinHttpQueryDataAvailable(req, &count); + ok(ret, "failed to query data available %u\n", GetLastError()); + ok(!count, "got %u\n", count); + + len = sizeof(buf); + count = 0xdeadbeef; + ret = WinHttpReadData(req, buf, len, &count); + ok(ret, "failed to read data %u\n", GetLastError()); + ok(!count, "got %u\n", count); + + count = 0xdeadbeef; + ret = WinHttpQueryDataAvailable(req, &count); + ok(ret, "failed to query data available %u\n", GetLastError()); + ok(!count, "got %u\n", count); + + WinHttpCloseHandle(req); + WinHttpCloseHandle(con); + WinHttpCloseHandle(ses); +} + +static void test_not_modified(int port) +{ + static const WCHAR pathW[] = {'/','n','o','t','_','m','o','d','i','f','i','e','d',0}; + static const WCHAR ifmodifiedW[] = {'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',':',' '}; + BOOL ret; + HINTERNET session, request, connection; + DWORD status, size, start = GetTickCount(); + SYSTEMTIME st; + WCHAR today[(sizeof(ifmodifiedW) + WINHTTP_TIME_FORMAT_BUFSIZE)/sizeof(WCHAR) + 3]; + + memcpy(today, ifmodifiedW, sizeof(ifmodifiedW)); + GetSystemTime(&st); + WinHttpTimeFromSystemTime(&st, &today[sizeof(ifmodifiedW)/sizeof(WCHAR)]); + + session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); + ok(session != NULL, "WinHttpOpen failed: %u\n", GetLastError()); + + connection = WinHttpConnect(session, localhostW, port, 0); + ok(connection != NULL, "WinHttpConnect failed: %u\n", GetLastError()); + + request = WinHttpOpenRequest(connection, NULL, pathW, NULL, WINHTTP_NO_REFERER, + WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_BYPASS_PROXY_CACHE); + ok(request != NULL, "WinHttpOpenrequest failed: %u\n", GetLastError()); + + ret = WinHttpSendRequest(request, today, ~0u, NULL, 0, 0, 0); + ok(ret, "WinHttpSendRequest failed: %u\n", GetLastError()); + + ret = WinHttpReceiveResponse(request, NULL); + ok(ret, "WinHttpReceiveResponse failed: %u\n", GetLastError()); + + size = sizeof(status); + ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER, + NULL, &status, &size, NULL); + ok(ret, "WinHttpQueryHeaders failed: %u\n", GetLastError()); + ok(status == HTTP_STATUS_NOT_MODIFIED, "got %u\n", status); + + size = 0xdeadbeef; + ret = WinHttpQueryDataAvailable(request, &size); + ok(ret, "WinHttpQueryDataAvailable failed: %u\n", GetLastError()); + ok(!size, "got %u\n", size); + + WinHttpCloseHandle(request); + WinHttpCloseHandle(connection); + WinHttpCloseHandle(session); + start = GetTickCount() - start; + ok(start <= 2000, "Expected less than 2 seconds for the test, got %u ms\n", start); } static void test_bad_header( int port ) @@ -2491,11 +2630,15 @@ IWinHttpRequest *req; BSTR method, url, username, password, response = NULL, status_text = NULL, headers = NULL; BSTR date, today, connection, value = NULL; - VARIANT async, empty, timeout, body, proxy_server, bypass_list, data; + VARIANT async, empty, timeout, body, body2, proxy_server, bypass_list, data; VARIANT_BOOL succeeded; LONG status; WCHAR todayW[WINHTTP_TIME_FORMAT_BUFSIZE]; SYSTEMTIME st; + IStream *stream, *stream2; + LARGE_INTEGER pos; + char buf[128]; + DWORD count; GetSystemTime( &st ); WinHttpTimeFromSystemTime( &st, todayW ); @@ -2547,8 +2690,7 @@ hr = IWinHttpRequest_Abort( req ); ok( hr == S_OK, "got %08x\n", hr ); - hr = IWinHttpRequest_Release( req ); - ok( hr == S_OK, "got %08x\n", hr ); + IWinHttpRequest_Release( req ); hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER, &IID_IWinHttpRequest, (void **)&req ); ok( hr == S_OK, "got %08x\n", hr ); @@ -2581,8 +2723,7 @@ hr = IWinHttpRequest_Abort( req ); ok( hr == S_OK, "got %08x\n", hr ); - hr = IWinHttpRequest_Release( req ); - ok( hr == S_OK, "got %08x\n", hr ); + IWinHttpRequest_Release( req ); hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER, &IID_IWinHttpRequest, (void **)&req ); ok( hr == S_OK, "got %08x\n", hr ); @@ -2841,6 +2982,41 @@ hr = VariantClear( &body ); ok( hr == S_OK, "got %08x\n", hr ); + VariantInit( &body ); + V_VT( &body ) = VT_ERROR; + hr = IWinHttpRequest_get_ResponseStream( req, &body ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_VT( &body ) == VT_UNKNOWN, "got %08x\n", V_VT( &body ) ); + + hr = IUnknown_QueryInterface( V_UNKNOWN( &body ), &IID_IStream, (void **)&stream ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_UNKNOWN( &body ) == (IUnknown *)stream, "got different interface pointer\n" ); + + buf[0] = 0; + count = 0xdeadbeef; + hr = IStream_Read( stream, buf, 128, &count ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( count != 0xdeadbeef, "count not set\n" ); + ok( buf[0], "no data\n" ); + + VariantInit( &body2 ); + V_VT( &body2 ) = VT_ERROR; + hr = IWinHttpRequest_get_ResponseStream( req, &body2 ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_VT( &body2 ) == VT_UNKNOWN, "got %08x\n", V_VT( &body2 ) ); + ok( V_UNKNOWN( &body ) != V_UNKNOWN( &body2 ), "got same interface pointer\n" ); + + hr = IUnknown_QueryInterface( V_UNKNOWN( &body2 ), &IID_IStream, (void **)&stream2 ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( V_UNKNOWN( &body2 ) == (IUnknown *)stream2, "got different interface pointer\n" ); + IStream_Release( stream2 ); + + hr = VariantClear( &body ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = VariantClear( &body2 ); + ok( hr == S_OK, "got %08x\n", hr ); + hr = IWinHttpRequest_SetProxy( req, HTTPREQUEST_PROXYSETTING_PROXY, proxy_server, bypass_list ); ok( hr == S_OK, "got %08x\n", hr ); @@ -2870,8 +3046,35 @@ hr = IWinHttpRequest_Abort( req ); ok( hr == S_OK, "got %08x\n", hr ); - hr = IWinHttpRequest_Release( req ); - ok( hr == S_OK, "got %08x\n", hr ); + IWinHttpRequest_Release( req ); + + pos.QuadPart = 0; + IStream_Seek( stream, pos, STREAM_SEEK_SET, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + buf[0] = 0; + count = 0xdeadbeef; + hr = IStream_Read( stream, buf, 128, &count ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( count != 0xdeadbeef, "count not set\n" ); + ok( buf[0], "no data\n" ); + IStream_Release( stream ); + + hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER, &IID_IWinHttpRequest, (void **)&req ); + ok( hr == S_OK, "got %08x\n", hr ); + + V_VT( &async ) = VT_I4; + V_I4( &async ) = 1; + hr = IWinHttpRequest_Open( req, method, url, async ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = IWinHttpRequest_Send( req, empty ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = IWinHttpRequest_WaitForResponse( req, timeout, &succeeded ); + ok( hr == S_OK, "got %08x\n", hr ); + + IWinHttpRequest_Release( req ); SysFreeString( method ); SysFreeString( url ); @@ -3047,12 +3250,8 @@ options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A; memset( &info, 0, sizeof(info) ); - SetLastError(0xdeadbeef); ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); - error = GetLastError(); - if (!ret) ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED || - error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n", error ); - else + if (ret) { trace("Proxy.AccessType=%u\n", info.dwAccessType); trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy)); @@ -3066,11 +3265,8 @@ options.lpszAutoConfigUrl = wpadW; memset( &info, 0, sizeof(info) ); - SetLastError(0xdeadbeef); ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); - error = GetLastError(); - if (!ret) ok( error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n", error ); - else + if (ret) { trace("Proxy.AccessType=%u\n", info.dwAccessType); trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy)); @@ -3204,6 +3400,8 @@ test_basic_request(si.port, NULL, basicW); test_no_headers(si.port); test_no_content(si.port); + test_head_request(si.port); + test_not_modified(si.port); test_basic_authentication(si.port); test_bad_header(si.port); test_multiple_reads(si.port);
9 years, 8 months
1
0
0
0
[akhaldi] 67116: [WINHTTP] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 13:29:04 2015 New Revision: 67116 URL:
http://svn.reactos.org/svn/reactos?rev=67116&view=rev
Log: [WINHTTP] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/winhttp/main.c trunk/reactos/dll/win32/winhttp/net.c trunk/reactos/dll/win32/winhttp/request.c trunk/reactos/dll/win32/winhttp/session.c trunk/reactos/dll/win32/winhttp/winhttp_private.h trunk/reactos/dll/win32/winhttp/winhttp_ros.diff trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/winhttp/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/main.c?r…
============================================================================== --- trunk/reactos/dll/win32/winhttp/main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/main.c [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -37,6 +37,7 @@ case DLL_PROCESS_DETACH: if (lpv) break; netconn_unload(); + release_typelib(); break; } return TRUE; Modified: trunk/reactos/dll/win32/winhttp/net.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/net.c?re…
============================================================================== --- trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/net.c [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -733,16 +733,8 @@ if(!netconn_connected(conn)) return 0; - if(conn->secure) { + if(conn->secure) return conn->peek_len; - }else { -#ifdef FIONREAD - ULONG unread; - - if(!ioctlsocket(conn->socket, FIONREAD, &unread)) - return unread; -#endif - } return 0; } Modified: trunk/reactos/dll/win32/winhttp/request.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/request.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/request.c [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -167,20 +167,87 @@ NULL /* WINHTTP_QUERY_PASSPORT_CONFIG = 78 */ }; -static DWORD CALLBACK task_thread( LPVOID param ) -{ - task_header_t *task = param; - - task->proc( task ); - - release_object( &task->request->hdr ); - heap_free( task ); - return ERROR_SUCCESS; +static task_header_t *dequeue_task( request_t *request ) +{ + task_header_t *task; + + EnterCriticalSection( &request->task_cs ); + TRACE("%u tasks queued\n", list_count( &request->task_queue )); + task = LIST_ENTRY( list_head( &request->task_queue ), task_header_t, entry ); + if (task) list_remove( &task->entry ); + LeaveCriticalSection( &request->task_cs ); + + TRACE("returning task %p\n", task); + return task; +} + +static DWORD CALLBACK task_proc( LPVOID param ) +{ + request_t *request = param; + HANDLE handles[2]; + + handles[0] = request->task_wait; + handles[1] = request->task_cancel; + for (;;) + { + DWORD err = WaitForMultipleObjects( 2, handles, FALSE, INFINITE ); + switch (err) + { + case WAIT_OBJECT_0: + { + task_header_t *task; + while ((task = dequeue_task( request ))) + { + task->proc( task ); + release_object( &task->request->hdr ); + heap_free( task ); + } + break; + } + case WAIT_OBJECT_0 + 1: + TRACE("exiting\n"); + return 0; + + default: + ERR("wait failed %u (%u)\n", err, GetLastError()); + break; + } + } + return 0; } static BOOL queue_task( task_header_t *task ) { - return QueueUserWorkItem( task_thread, task, WT_EXECUTELONGFUNCTION ); + request_t *request = task->request; + + if (!request->task_thread) + { + if (!(request->task_wait = CreateEventW( NULL, FALSE, FALSE, NULL ))) return FALSE; + if (!(request->task_cancel = CreateEventW( NULL, FALSE, FALSE, NULL ))) + { + CloseHandle( request->task_wait ); + request->task_wait = NULL; + return FALSE; + } + if (!(request->task_thread = CreateThread( NULL, 0, task_proc, request, 0, NULL ))) + { + CloseHandle( request->task_wait ); + request->task_wait = NULL; + CloseHandle( request->task_cancel ); + request->task_cancel = NULL; + return FALSE; + } + InitializeCriticalSection( &request->task_cs ); + request->task_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": request.task_cs"); + } + + EnterCriticalSection( &request->task_cs ); + TRACE("queueing task %p\n", task ); + list_add_tail( &request->task_queue, &task->entry ); + LeaveCriticalSection( &request->task_cs ); + + SetEvent( request->task_wait ); + return TRUE; } static void free_header( header_t *header ) @@ -1792,24 +1859,28 @@ } /* set the request content length based on the headers */ -static DWORD set_content_length( request_t *request ) +static DWORD set_content_length( request_t *request, DWORD status ) { WCHAR encoding[20]; - DWORD buflen; - - buflen = sizeof(request->content_length); - if (!query_headers( request, WINHTTP_QUERY_CONTENT_LENGTH|WINHTTP_QUERY_FLAG_NUMBER, - NULL, &request->content_length, &buflen, NULL )) - request->content_length = ~0u; - - buflen = sizeof(encoding); - if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) && - !strcmpiW( encoding, chunkedW )) - { - request->content_length = ~0u; - request->read_chunked = TRUE; - request->read_chunked_size = ~0u; - request->read_chunked_eof = FALSE; + DWORD buflen = sizeof(request->content_length); + + if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !strcmpW( request->verb, headW )) + request->content_length = 0; + else + { + if (!query_headers( request, WINHTTP_QUERY_CONTENT_LENGTH|WINHTTP_QUERY_FLAG_NUMBER, + NULL, &request->content_length, &buflen, NULL )) + request->content_length = ~0u; + + buflen = sizeof(encoding); + if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) && + !strcmpiW( encoding, chunkedW )) + { + request->content_length = ~0u; + request->read_chunked = TRUE; + request->read_chunked_size = ~0u; + request->read_chunked_eof = FALSE; + } } request->content_read = 0; return request->content_length; @@ -1958,6 +2029,7 @@ /* check if we have reached the end of the data to read */ static BOOL end_of_read_data( request_t *request ) { + if (!request->content_length) return TRUE; if (request->read_chunked) return request->read_chunked_eof; if (request->content_length == ~0u) return FALSE; return (request->content_length == request->content_read); @@ -2138,6 +2210,7 @@ DWORD bytes_read; char buffer[2048]; + refill_buffer( request, FALSE ); for (;;) { if (!read_data( request, buffer, sizeof(buffer), &bytes_read, FALSE ) || !bytes_read) return; @@ -2291,7 +2364,7 @@ query = WINHTTP_QUERY_STATUS_CODE | WINHTTP_QUERY_FLAG_NUMBER; if (!(ret = query_headers( request, query, NULL, &status, &size, NULL ))) break; - set_content_length( request ); + set_content_length( request, status ); if (!(request->hdr.disable_flags & WINHTTP_DISABLE_COOKIES)) record_cookies( request ); @@ -2303,27 +2376,22 @@ if (!(ret = handle_redirect( request, status ))) break; /* recurse synchronously */ - send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ); - continue; + if ((ret = send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ))) continue; } else if (status == HTTP_STATUS_DENIED || status == HTTP_STATUS_PROXY_AUTH_REQ) { if (request->hdr.disable_flags & WINHTTP_DISABLE_AUTHENTICATION) break; drain_content( request ); - if (!handle_authorization( request, status )) - { - ret = TRUE; - break; - } + if (!handle_authorization( request, status )) break; + /* recurse synchronously */ - send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ); - continue; + if ((ret = send_request( request, NULL, 0, request->optional, request->optional_len, 0, 0, FALSE ))) continue; } break; } - if (ret) refill_buffer( request, FALSE ); + if (request->content_length) refill_buffer( request, FALSE ); if (async) { @@ -2387,8 +2455,11 @@ static BOOL query_data_available( request_t *request, DWORD *available, BOOL async ) { - DWORD count = get_available_data( request ); - + DWORD count = 0; + + if (end_of_read_data( request )) goto done; + + count = get_available_data( request ); if (!request->read_chunked) count += netconn_query_data_available( &request->netconn ); if (!count) @@ -2399,6 +2470,7 @@ count += netconn_query_data_available( &request->netconn ); } +done: if (async) send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, &count, sizeof(count) ); TRACE("%u bytes available\n", count); if (available) *available = count; @@ -2747,7 +2819,20 @@ ITypeInfo_Release( typeinfo ); } *ret = winhttp_typeinfo[tid]; + ITypeInfo_AddRef(winhttp_typeinfo[tid]); return S_OK; +} + +void release_typelib(void) +{ + unsigned i; + + for (i = 0; i < sizeof(winhttp_typeinfo)/sizeof(*winhttp_typeinfo); i++) + if (winhttp_typeinfo[i]) + ITypeInfo_Release(winhttp_typeinfo[i]); + + if (winhttp_typelib) + ITypeLib_Release(winhttp_typelib); } static HRESULT WINAPI winhttp_request_GetTypeInfo( @@ -2922,7 +3007,7 @@ request->bytes_read = 0; request->error = ERROR_SUCCESS; request->logon_policy = WINHTTP_AUTOLOGON_SECURITY_LEVEL_MEDIUM; - request->disable_feature = WINHTTP_DISABLE_AUTHENTICATION; + request->disable_feature = 0; request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; request->proxy.lpszProxy = NULL; request->proxy.lpszProxyBypass = NULL; @@ -2982,7 +3067,7 @@ path[uc.dwUrlPathLength + uc.dwExtraInfoLength] = 0; if (!(verb = strdupW( method ))) goto error; - if (V_VT( &async ) == VT_BOOL && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC; + if (SUCCEEDED( VariantChangeType( &async, &async, 0, VT_BOOL )) && V_BOOL( &async )) flags |= WINHTTP_FLAG_ASYNC; if (!(hsession = WinHttpOpen( user_agentW, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, NULL, NULL, flags ))) { err = get_last_error(); @@ -3569,6 +3654,11 @@ if (!body) return E_INVALIDARG; EnterCriticalSection( &request->cs ); + if (request->state < REQUEST_STATE_SENT) + { + err = ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND; + goto done; + } if (!(sa = SafeArrayCreateVector( VT_UI1, 0, request->offset ))) { err = ERROR_OUTOFMEMORY; @@ -3595,12 +3685,203 @@ return HRESULT_FROM_WIN32( err ); } +struct stream +{ + IStream IStream_iface; + LONG refs; + char *data; + ULARGE_INTEGER pos, size; +}; + +static inline struct stream *impl_from_IStream( IStream *iface ) +{ + return CONTAINING_RECORD( iface, struct stream, IStream_iface ); +} + +static HRESULT WINAPI stream_QueryInterface( IStream *iface, REFIID riid, void **obj ) +{ + struct stream *stream = impl_from_IStream( iface ); + + TRACE("%p, %s, %p\n", stream, debugstr_guid(riid), obj); + + if (IsEqualGUID( riid, &IID_IStream ) || IsEqualGUID( riid, &IID_IUnknown )) + { + *obj = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IStream_AddRef( iface ); + return S_OK; +} + +static ULONG WINAPI stream_AddRef( IStream *iface ) +{ + struct stream *stream = impl_from_IStream( iface ); + return InterlockedIncrement( &stream->refs ); +} + +static ULONG WINAPI stream_Release( IStream *iface ) +{ + struct stream *stream = impl_from_IStream( iface ); + LONG refs = InterlockedDecrement( &stream->refs ); + if (!refs) + { + heap_free( stream->data ); + heap_free( stream ); + } + return refs; +} + +static HRESULT WINAPI stream_Read( IStream *iface, void *buf, ULONG len, ULONG *read ) +{ + struct stream *stream = impl_from_IStream( iface ); + ULONG size; + + if (stream->pos.QuadPart >= stream->size.QuadPart) + { + *read = 0; + return S_FALSE; + } + + size = min( stream->size.QuadPart - stream->pos.QuadPart, len ); + memcpy( buf, stream->data + stream->pos.QuadPart, size ); + stream->pos.QuadPart += size; + *read = size; + + return S_OK; +} + +static HRESULT WINAPI stream_Write( IStream *iface, const void *buf, ULONG len, ULONG *written ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Seek( IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *newpos ) +{ + struct stream *stream = impl_from_IStream( iface ); + + if (origin == STREAM_SEEK_SET) + stream->pos.QuadPart = move.QuadPart; + else if (origin == STREAM_SEEK_CUR) + stream->pos.QuadPart += move.QuadPart; + else if (origin == STREAM_SEEK_END) + stream->pos.QuadPart = stream->size.QuadPart - move.QuadPart; + + if (newpos) newpos->QuadPart = stream->pos.QuadPart; + return S_OK; +} + +static HRESULT WINAPI stream_SetSize( IStream *iface, ULARGE_INTEGER newsize ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_CopyTo( IStream *iface, IStream *stream, ULARGE_INTEGER len, ULARGE_INTEGER *read, + ULARGE_INTEGER *written ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Commit( IStream *iface, DWORD flags ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Revert( IStream *iface ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_LockRegion( IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_UnlockRegion( IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Stat( IStream *iface, STATSTG *stg, DWORD flag ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI stream_Clone( IStream *iface, IStream **stream ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const IStreamVtbl stream_vtbl = +{ + stream_QueryInterface, + stream_AddRef, + stream_Release, + stream_Read, + stream_Write, + stream_Seek, + stream_SetSize, + stream_CopyTo, + stream_Commit, + stream_Revert, + stream_LockRegion, + stream_UnlockRegion, + stream_Stat, + stream_Clone +}; + static HRESULT WINAPI winhttp_request_get_ResponseStream( IWinHttpRequest *iface, VARIANT *body ) { - FIXME("\n"); - return E_NOTIMPL; + struct winhttp_request *request = impl_from_IWinHttpRequest( iface ); + DWORD err = ERROR_SUCCESS; + struct stream *stream; + + TRACE("%p, %p\n", request, body); + + if (!body) return E_INVALIDARG; + + EnterCriticalSection( &request->cs ); + if (request->state < REQUEST_STATE_SENT) + { + err = ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND; + goto done; + } + if (!(stream = heap_alloc( sizeof(*stream) ))) + { + err = ERROR_OUTOFMEMORY; + goto done; + } + stream->IStream_iface.lpVtbl = &stream_vtbl; + stream->refs = 1; + if (!(stream->data = heap_alloc( request->offset ))) + { + heap_free( stream ); + err = ERROR_OUTOFMEMORY; + goto done; + } + memcpy( stream->data, request->buffer, request->offset ); + stream->pos.QuadPart = 0; + stream->size.QuadPart = request->offset; + V_VT( body ) = VT_UNKNOWN; + V_UNKNOWN( body ) = (IUnknown *)&stream->IStream_iface; + +done: + LeaveCriticalSection( &request->cs ); + return HRESULT_FROM_WIN32( err ); } static HRESULT WINAPI winhttp_request_get_Option( Modified: trunk/reactos/dll/win32/winhttp/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/session.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -42,9 +42,12 @@ void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen ) { - TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen); - - if (hdr->callback && (hdr->notify_mask & status)) hdr->callback( hdr->handle, hdr->context, status, info, buflen ); + if (hdr->callback && (hdr->notify_mask & status)) + { + TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen); + hdr->callback( hdr->handle, hdr->context, status, info, buflen ); + TRACE("returning from 0x%08x callback\n", status); + } } /*********************************************************************** @@ -536,6 +539,15 @@ TRACE("%p\n", request); + if (request->task_thread) + { + SetEvent( request->task_cancel ); + WaitForSingleObject( request->task_thread, INFINITE ); + CloseHandle( request->task_thread ); + CloseHandle( request->task_cancel ); + CloseHandle( request->task_wait ); + DeleteCriticalSection( &request->task_cs ); + } release_object( &request->connect->hdr ); destroy_authinfo( request->authinfo ); @@ -1037,6 +1049,7 @@ request->hdr.context = connect->hdr.context; request->hdr.redirect_policy = connect->hdr.redirect_policy; list_init( &request->hdr.children ); + list_init( &request->task_queue ); addref_object( &connect->hdr ); request->connect = connect; Modified: trunk/reactos/dll/win32/winhttp/winhttp_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/winhttp_…
============================================================================== --- trunk/reactos/dll/win32/winhttp/winhttp_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/winhttp_private.h [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -209,19 +209,25 @@ BOOL read_chunked_size; /* chunk size remaining */ DWORD read_pos; /* current read position in read_buf */ DWORD read_size; /* valid data size in read_buf */ - char read_buf[4096]; /* buffer for already read but not returned data */ + char read_buf[8192]; /* buffer for already read but not returned data */ header_t *headers; DWORD num_headers; WCHAR **accept_types; DWORD num_accept_types; struct authinfo *authinfo; struct authinfo *proxy_authinfo; + HANDLE task_wait; + HANDLE task_cancel; + HANDLE task_thread; + struct list task_queue; + CRITICAL_SECTION task_cs; } request_t; typedef struct _task_header_t task_header_t; struct _task_header_t { + struct list entry; request_t *request; void (*proc)( task_header_t * ); }; @@ -298,6 +304,7 @@ void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN; extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN; +void release_typelib( void ) DECLSPEC_HIDDEN; static inline void *heap_alloc( SIZE_T size ) { Modified: trunk/reactos/dll/win32/winhttp/winhttp_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/winhttp_…
============================================================================== --- trunk/reactos/dll/win32/winhttp/winhttp_ros.diff [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/winhttp_ros.diff [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -1,7 +1,7 @@ -diff -prudN e:\Wine\dlls\winhttp/net.c e:\reactos-clean\dll\win32\winhttp/net.c ---- e:\Wine\dlls\winhttp/net.c 2013-03-16 11:54:52.602606100 +0100 -+++ e:\reactos-clean\dll\win32\winhttp/net.c 2013-05-21 20:25:32.595598100 +0100 -@@ -73,6 +77,7 @@ static CRITICAL_SECTION cs_gethostbyname +diff -pudN e:\wine\dlls\winhttp/net.c dll\win32\winhttp/net.c +--- e:\wine\dlls\winhttp/net.c 2015-02-21 17:13:15.365542100 +0100 ++++ dll\win32\winhttp/net.c 2015-04-09 13:48:12.485050200 +0100 +@@ -73,6 +50,7 @@ static CRITICAL_SECTION cs_gethostbyname #endif /* translate a unix error code into a winsock error code */ @@ -9,7 +9,7 @@ static int sock_get_error( int err ) { #if !defined(__MINGW32__) && !defined (_MSC_VER) -@@ -138,6 +143,15 @@ static int sock_get_error( int err ) +@@ -138,6 +116,15 @@ static int sock_get_error( int err ) #endif return err; } @@ -23,14 +23,14 @@ +#define ioctlsocket unix_ioctl +#endif - static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags ) + static int sock_send(int fd, const void *msg, size_t len, int flags) { -@@ -344,11 +358,17 @@ BOOL netconn_connect( netconn_t *conn, c +@@ -366,11 +353,17 @@ BOOL netconn_connect( netconn_t *conn, c res = sock_get_error( errno ); if (res == WSAEWOULDBLOCK || res == WSAEINPROGRESS) { - struct pollfd pfd; -+ // ReactOS: use select instead of poll ++ /* ReactOS: use select instead of poll */ + fd_set outfd; + struct timeval tv; @@ -47,58 +47,18 @@ ret = TRUE; else res = sock_get_error( errno ); -@@ -442,7 +462,7 @@ BOOL netconn_secure_connect( netconn_t * - read_buf_size += 1024; - } +diff -pudN e:\wine\dlls\winhttp/request.c dll\win32\winhttp/request.c +--- e:\wine\dlls\winhttp/request.c 2015-02-22 13:25:32.479716600 +0100 ++++ dll\win32\winhttp/request.c 2015-04-09 13:49:32.753638400 +0100 +@@ -1275,6 +1264,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNE + return ret; + } -- size = recv(conn->socket, read_buf+in_bufs[0].cbBuffer, read_buf_size-in_bufs[0].cbBuffer, 0); -+ size = recv(conn->socket, (char *)(read_buf+in_bufs[0].cbBuffer), read_buf_size-in_bufs[0].cbBuffer, 0); - if(size < 1) { - WARN("recv error\n"); - status = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; -@@ -754,7 +774,8 @@ BOOL netconn_query_data_available( netco ++#undef ARRAYSIZE + #define ARRAYSIZE(array) (sizeof(array) / sizeof((array)[0])) - BOOL netconn_get_next_line( netconn_t *conn, char *buffer, DWORD *buflen ) - { -- struct pollfd pfd; -+ // ReactOS: use select instead of poll -+ fd_set infd; - BOOL ret = FALSE; - DWORD recvd = 0; - -@@ -786,19 +807,21 @@ BOOL netconn_get_next_line( netconn_t *c - return ret; - } - -- pfd.fd = conn->socket; -- pfd.events = POLLIN; -+ FD_ZERO(&infd); -+ FD_SET(conn->socket, &infd); -+ - while (recvd < *buflen) - { -- int timeout, res; -- struct timeval tv; -+ int res; -+ struct timeval tv, *ptv; - socklen_t len = sizeof(tv); - - if ((res = getsockopt( conn->socket, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, &len ) != -1)) -- timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000; -+ ptv = &tv; - else -- timeout = -1; -- if (poll( &pfd, 1, timeout ) > 0) -+ ptv = NULL; -+ -+ if (select( 0, &infd, NULL, NULL, ptv ) > 0) - { - if ((res = recv( conn->socket, &buffer[recvd], 1, 0 )) <= 0) - { -diff -prudN e:\Wine\dlls\winhttp/request.c e:\reactos-clean\dll\win32\winhttp/request.c ---- e:\Wine\dlls\winhttp/request.c 2013-03-16 11:54:52.603606700 +0100 -+++ e:\reactos-clean\dll\win32\winhttp/request.c 2013-05-21 20:05:12.642413600 +0100 -@@ -2254,8 +2260,8 @@ static void free_request( struct winhttp + static const WCHAR basicW[] = {'B','a','s','i','c',0}; +@@ -2722,8 +2712,8 @@ static void free_request( struct winhttp CloseHandle( request->thread ); CloseHandle( request->wait ); CloseHandle( request->cancel ); @@ -109,7 +69,7 @@ heap_free( request->buffer ); heap_free( request->verb ); VariantClear( &request->data ); -@@ -2446,16 +2452,16 @@ static HRESULT WINAPI winhttp_request_Se +@@ -2927,16 +2917,16 @@ static HRESULT WINAPI winhttp_request_Se { case HTTPREQUEST_PROXYSETTING_DEFAULT: request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; @@ -130,7 +90,7 @@ request->proxy.lpszProxy = NULL; request->proxy.lpszProxyBypass = NULL; break; -@@ -2464,12 +2470,12 @@ static HRESULT WINAPI winhttp_request_Se +@@ -2945,12 +2935,12 @@ static HRESULT WINAPI winhttp_request_Se request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; if (V_VT( &proxy_server ) == VT_BSTR) { @@ -145,26 +105,10 @@ request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) ); } break; -diff -prudN e:\Wine\dlls\winhttp/rsrc.rc e:\reactos-clean\dll\win32\winhttp/rsrc.rc ---- e:\Wine\dlls\winhttp/rsrc.rc 2011-11-24 17:55:02.335439900 +0100 -+++ e:\reactos-clean\dll\win32\winhttp/rsrc.rc 2012-07-20 21:40:58.173741700 +0100 -@@ -16,6 +16,12 @@ - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -+/* @makedep: winhttp_tlb.tlb */ -+1 TYPELIB winhttp_tlb.tlb -+ -+/* @makedep: winhttp_tlb.rgs */ -+1 WINE_REGISTRY winhttp_tlb.rgs -+ - /* @makedep: pac.js */ - pac.js 40 "pac.js" - -diff -prudN e:\Wine\dlls\winhttp/session.c e:\reactos-clean\dll\win32\winhttp/session.c ---- e:\Wine\dlls\winhttp/session.c 2013-03-16 11:54:52.604607400 +0100 -+++ e:\reactos-clean\dll\win32\winhttp/session.c 2013-05-21 20:19:52.231665900 +0100 -@@ -100,6 +100,9 @@ static void session_destroy( object_head +diff -pudN e:\wine\dlls\winhttp/session.c dll\win32\winhttp/session.c +--- e:\wine\dlls\winhttp/session.c 2015-02-22 13:25:32.480717300 +0100 ++++ dll\win32\winhttp/session.c 2015-04-09 13:50:02.955100200 +0100 +@@ -109,6 +81,9 @@ static void session_destroy( object_head heap_free( session->proxy_username ); heap_free( session->proxy_password ); heap_free( session ); @@ -174,7 +118,7 @@ } static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen ) -@@ -211,6 +214,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag +@@ -220,6 +195,11 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag { session_t *session; HINTERNET handle = NULL; @@ -186,7 +130,7 @@ TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags); -@@ -237,14 +245,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag +@@ -246,14 +226,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR ag session->access = info.dwAccessType; if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy ))) { @@ -205,7 +149,7 @@ goto end; } } -@@ -594,7 +602,7 @@ static WCHAR *blob_to_str( DWORD encodin +@@ -615,7 +595,7 @@ static WCHAR *blob_to_str( DWORD encodin static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage ) { Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Thu Apr 9 13:29:04 2015 @@ -213,7 +213,7 @@ reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.27 reactos/dll/win32/winemp3.acm # Synced to Wine-1.7.27 reactos/dll/win32/wing32 # Out of sync -reactos/dll/win32/winhttp # Synced to Wine-1.7.27 +reactos/dll/win32/winhttp # Synced to WineStaging-1.7.37 reactos/dll/win32/wininet # Synced to Wine-1.7.27 reactos/dll/win32/winmm # Forked at Wine-20050628 reactos/dll/win32/winmm/midimap # Forked at Wine-20050628
9 years, 8 months
1
0
0
0
[akhaldi] 67115: [URLMON] Stub and export IEInstallScope. Needed by urlmon:misc test.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 9 13:15:15 2015 New Revision: 67115 URL:
http://svn.reactos.org/svn/reactos?rev=67115&view=rev
Log: [URLMON] Stub and export IEInstallScope. Needed by urlmon:misc test. Modified: trunk/reactos/dll/win32/urlmon/urlmon.spec Modified: trunk/reactos/dll/win32/urlmon/urlmon.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/urlmon/urlmon.sp…
============================================================================== --- trunk/reactos/dll/win32/urlmon/urlmon.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/urlmon/urlmon.spec [iso-8859-1] Thu Apr 9 13:15:15 2015 @@ -85,7 +85,7 @@ 184 stdcall HlinkNavigateString(ptr wstr) 185 stdcall HlinkSimpleNavigateToMoniker(ptr wstr wstr ptr ptr ptr long long) 186 stdcall HlinkSimpleNavigateToString(wstr wstr wstr ptr ptr ptr long long) -#187 IEInstallScope +187 stdcall -stub IEInstallScope(ptr) #188 InstallFlash #189 IntlPercentEncodeNormalize 190 stdcall IsAsyncMoniker(ptr)
9 years, 8 months
1
0
0
0
← Newer
1
...
34
35
36
37
38
39
40
...
49
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
Results per page:
10
25
50
100
200