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
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2014
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
730 discussions
Start a n
N
ew thread
[dquintana] 64630: [SHELL32] * Rewrite SHFileOperationA using human-readable code. CORE-8564
by dquintana@svn.reactos.org
Author: dquintana Date: Thu Oct 9 00:10:20 2014 New Revision: 64630 URL:
http://svn.reactos.org/svn/reactos?rev=64630&view=rev
Log: [SHELL32] * Rewrite SHFileOperationA using human-readable code. CORE-8564 Modified: branches/shell-experiments/dll/win32/shell32/shlfileop.cpp Modified: branches/shell-experiments/dll/win32/shell32/shlfileop.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
============================================================================== --- branches/shell-experiments/dll/win32/shell32/shlfileop.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shlfileop.cpp [iso-8859-1] Thu Oct 9 00:10:20 2014 @@ -940,38 +940,56 @@ /************************************************************************* * - * SHNameTranslate HelperFunction for SHFileOperationA - * - * Translates a list of 0 terminated ASCII strings into Unicode. If *wString - * is NULL, only the necessary size of the string is determined and returned, - * otherwise the ASCII strings are copied into it and the buffer is increased - * to point to the location after the final 0 termination char. - */ -static DWORD SHNameTranslate(LPWSTR* wString, LPCWSTR* pWToFrom, BOOL more) -{ - DWORD size = 0, aSize = 0; - LPCSTR aString = (LPCSTR)*pWToFrom; - - if (aString) - { + * _ConvertAtoW helper function for SHFileOperationA + * + * Converts a string or string-list to unicode. + */ +static DWORD _ConvertAtoW(PCSTR strSrc, PCWSTR* pStrDest, BOOL isList) +{ + *pStrDest = NULL; + + // If the input is null, nothing to convert. + if (!strSrc) + return 0; + + // Measure the total size, depending on if it's a zero-terminated list. + int sizeA = 0; + if (isList) + { + PCSTR tmpSrc = strSrc; + int size; do { - size = lstrlenA(aString) + 1; - aSize += size; - aString += size; - } while ((size != 1) && more); - - /* The two sizes might be different in the case of multibyte chars */ - size = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, 0); - if (*wString) /* only in the second loop */ - { - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)*pWToFrom, aSize, *wString, size); - *pWToFrom = *wString; - *wString += size; - } - } - return size; -} + size = lstrlenA(tmpSrc) + 1; + sizeA += size; + tmpSrc += size; + } while (size != 1); + } + else + { + sizeA = lstrlenA(strSrc) + 1; + } + + // Measure the + int sizeW = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, NULL, 0); + if (!sizeW) + return GetLastError(); + + PWSTR strDest = (PWSTR) HeapAlloc(GetProcessHeap(), 0, sizeW); + if (!strDest) + return ERROR_OUTOFMEMORY; + + int err = MultiByteToWideChar(CP_ACP, 0, strSrc, sizeA, strDest, sizeW); + if (!err) + { + HeapFree(GetProcessHeap(), 0, strDest); + return GetLastError(); + } + + *pStrDest = strDest; + return 0; +} + /************************************************************************* * SHFileOperationA [SHELL32.@] * @@ -990,40 +1008,53 @@ */ int WINAPI SHFileOperationA(LPSHFILEOPSTRUCTA lpFileOp) { - SHFILEOPSTRUCTW nFileOp = *((LPSHFILEOPSTRUCTW)lpFileOp); - int retCode = 0; - DWORD size; - LPWSTR ForFree = NULL, /* we change wString in SHNameTranslate and can't use it for freeing */ - wString = NULL; /* we change this in SHNameTranslate */ - - TRACE("\n"); - if (FO_DELETE == (nFileOp.wFunc & FO_MASK)) - nFileOp.pTo = NULL; /* we need a NULL or a valid pointer for translation */ - if (!(nFileOp.fFlags & FOF_SIMPLEPROGRESS)) - nFileOp.lpszProgressTitle = NULL; /* we need a NULL or a valid pointer for translation */ - while (1) /* every loop calculate size, second translate also, if we have storage for this */ - { - size = SHNameTranslate(&wString, &nFileOp.lpszProgressTitle, FALSE); /* no loop */ - size += SHNameTranslate(&wString, &nFileOp.pFrom, TRUE); /* internal loop */ - size += SHNameTranslate(&wString, &nFileOp.pTo, TRUE); /* internal loop */ - - if (ForFree) - { - retCode = SHFileOperationW(&nFileOp); - HeapFree(GetProcessHeap(), 0, ForFree); /* we cannot use wString, it was changed */ - break; - } - else - { - wString = ForFree = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); - if (ForFree) continue; - retCode = ERROR_OUTOFMEMORY; - nFileOp.fAnyOperationsAborted = TRUE; - SetLastError(retCode); - return retCode; - } - } - + int errCode, retCode; + SHFILEOPSTRUCTW nFileOp = { 0 }; + + // Convert A information to W + nFileOp.hwnd = lpFileOp->hwnd; + nFileOp.wFunc = lpFileOp->wFunc; + nFileOp.fFlags = lpFileOp->fFlags; + + errCode = _ConvertAtoW(lpFileOp->pFrom, &nFileOp.pFrom, TRUE); + if (errCode != 0) + goto cleanup; + + if (FO_DELETE != (nFileOp.wFunc & FO_MASK)) + { + errCode = _ConvertAtoW(lpFileOp->pTo, &nFileOp.pTo, TRUE); + if (errCode != 0) + goto cleanup; + } + + if (nFileOp.fFlags & FOF_SIMPLEPROGRESS) + { + errCode = _ConvertAtoW(lpFileOp->lpszProgressTitle, &nFileOp.lpszProgressTitle, FALSE); + if (errCode != 0) + goto cleanup; + } + + // Call the actual function + retCode = SHFileOperationW(&nFileOp); + + // Cleanup +cleanup: + if (nFileOp.pFrom) + HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pFrom); + if (nFileOp.pTo) + HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.pTo); + if (nFileOp.lpszProgressTitle) + HeapFree(GetProcessHeap(), 0, (PVOID) nFileOp.lpszProgressTitle); + + if (errCode != 0) + { + lpFileOp->fAnyOperationsAborted = TRUE; + SetLastError(errCode); + + return errCode; + } + + // Thankfully, the lpFileOp->hNameMappings = nFileOp.hNameMappings; lpFileOp->fAnyOperationsAborted = nFileOp.fAnyOperationsAborted; return retCode;
10 years, 3 months
1
0
0
0
[jgardou] 64629: reapply r64621 aka revert r64628, with various fixes: [WSHTCPIP] - Fix swapped function parameters [TCPIP] - Re-enable some code which got lost because of me being unable to deciph...
by jgardou@svn.reactos.org
Author: jgardou Date: Wed Oct 8 21:58:10 2014 New Revision: 64629 URL:
http://svn.reactos.org/svn/reactos?rev=64629&view=rev
Log: reapply r64621 aka revert r64628, with various fixes: [WSHTCPIP] - Fix swapped function parameters [TCPIP] - Re-enable some code which got lost because of me being unable to decipher this indentation mess. Added: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c (with props) Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c trunk/reactos/drivers/network/tcpip/CMakeLists.txt trunk/reactos/drivers/network/tcpip/include/info.h trunk/reactos/drivers/network/tcpip/include/tcp.h trunk/reactos/drivers/network/tcpip/tcpip/info.c trunk/reactos/include/psdk/tcpioctl.h trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c trunk/reactos/lib/drivers/lwip/src/include/rosip.h trunk/reactos/lib/drivers/lwip/src/rostcp.c Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshtcpip/wshtcpi…
============================================================================== --- trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -156,12 +156,18 @@ return NO_ERROR; } -UINT -GetAddressOption(INT Level, INT OptionName) +static +void +GetTdiTypeId( + _In_ INT Level, + _In_ INT OptionName, + _Out_ PULONG TdiType, + _Out_ PULONG TdiId) { switch (Level) { case SOL_SOCKET: + *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case SO_KEEPALIVE: @@ -174,21 +180,26 @@ break; case IPPROTO_IP: + *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case IP_TTL: - return AO_OPTION_TTL; + *TdiId = AO_OPTION_TTL; + return; case IP_DONTFRAGMENT: - return AO_OPTION_IP_DONTFRAGMENT; + *TdiId = AO_OPTION_IP_DONTFRAGMENT; + return; #if 0 case IP_RECEIVE_BROADCAST: - return AO_OPTION_BROADCAST; + *TdiId = AO_OPTION_BROADCAST; + return; #endif case IP_HDRINCL: - return AO_OPTION_IP_HDRINCL; + *TdiId = AO_OPTION_IP_HDRINCL; + return; default: break; @@ -198,10 +209,10 @@ case IPPROTO_TCP: switch (OptionName) { + *TdiType = INFO_TYPE_CONNECTION; case TCP_NODELAY: - /* FIXME: Return proper option */ - ASSERT(FALSE); - break; + *TdiId = TCP_SOCKET_NODELAY; + return; default: break; } @@ -211,7 +222,8 @@ } DPRINT1("Unknown level/option name: %d %d\n", Level, OptionName); - return 0; + *TdiType = 0; + *TdiId = 0; } INT @@ -642,7 +654,7 @@ IN INT OptionLength) { PSOCKET_CONTEXT Context = HelperDllSocketContext; - UINT RealOptionName; + ULONG TdiType, TdiId; INT Status; PTCP_REQUEST_SET_INFORMATION_EX Info; PQUEUED_REQUEST Queued, NextQueued; @@ -697,9 +709,11 @@ switch (OptionName) { case TCP_NODELAY: - /* FIXME -- Send this to TCPIP */ - DPRINT1("Set: TCP_NODELAY not yet supported\n"); - return 0; + if (OptionLength < sizeof(CHAR)) + { + return WSAEFAULT; + } + break; default: /* Invalid option */ @@ -714,8 +728,8 @@ } /* If we get here, GetAddressOption must return something valid */ - RealOptionName = GetAddressOption(Level, OptionName); - ASSERT(RealOptionName != 0); + GetTdiTypeId(Level, OptionName, &TdiType, &TdiId); + ASSERT((TdiId != 0) && (TdiType != 0)); Info = HeapAlloc(GetProcessHeap(), 0, sizeof(*Info) + OptionLength); if (!Info) @@ -724,8 +738,8 @@ Info->ID.toi_entity.tei_entity = Context->AddrFileEntityType; Info->ID.toi_entity.tei_instance = Context->AddrFileInstance; Info->ID.toi_class = INFO_CLASS_PROTOCOL; - Info->ID.toi_type = INFO_TYPE_ADDRESS_OBJECT; - Info->ID.toi_id = RealOptionName; + Info->ID.toi_type = TdiType; + Info->ID.toi_id = TdiId; Info->BufferSize = OptionLength; memcpy(Info->Buffer, OptionValue, OptionLength); Modified: trunk/reactos/drivers/network/tcpip/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/CMak…
============================================================================== --- trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -14,6 +14,7 @@ datalink/lan.c tcpip/ainfo.c tcpip/buffer.c + tcpip/cinfo.c tcpip/dispatch.c tcpip/fileobjs.c tcpip/iinfo.c Modified: trunk/reactos/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -183,6 +183,11 @@ PVOID Buffer, PUINT BufferSize); +TDI_STATUS SetConnectionInfo(TDIObjectID *ID, + PCONNECTION_ENDPOINT Connection, + PVOID Buffer, + UINT BufferSize); + /* Insert and remove entities */ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ); Modified: trunk/reactos/drivers/network/tcpip/include/tcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -186,6 +186,8 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Connection, PIRP Irp ); +NTSTATUS TCPSetNoDelay(PCONNECTION_ENDPOINT Connection, BOOLEAN Set); + VOID TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF); Added: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c (added) +++ trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -0,0 +1,32 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TCP/IP protocol driver + * FILE: tcpip/cinfo.c + * PURPOSE: Per-socket connection information. + * PROGRAMMER: Jérôme Gardou + */ + +#include "precomp.h" + +TDI_STATUS SetConnectionInfo(TDIObjectID *ID, + PCONNECTION_ENDPOINT Connection, + PVOID Buffer, + UINT BufferSize) +{ + ASSERT(ID->toi_type == INFO_TYPE_CONNECTION); + switch (ID->toi_id) + { + case TCP_SOCKET_NODELAY: + { + BOOLEAN Set; + if (BufferSize < sizeof(BOOLEAN)) + return TDI_INVALID_PARAMETER; + Set = *(BOOLEAN*)Buffer; + return TCPSetNoDelay(Connection, Set); + } + default: + DbgPrint("TCPIP: Unknown connection info ID: %u.\n", ID->toi_id); + } + + return TDI_INVALID_PARAMETER; +} Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ charset = UTF-8 Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -325,41 +325,59 @@ switch (ID->toi_class) { - case INFO_CLASS_PROTOCOL: - if (ID->toi_type == INFO_TYPE_ADDRESS_OBJECT) - { - if ((EntityListContext = GetContext(ID->toi_entity))) - return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); - else - return TDI_INVALID_PARAMETER; - } - - switch (ID->toi_id) - { - case IP_MIB_ARPTABLE_ENTRY_ID: - if (ID->toi_type != INFO_TYPE_PROVIDER) - return TDI_INVALID_PARAMETER; - - if (ID->toi_entity.tei_entity == AT_ENTITY) - if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiSetArptableMIB(EntityListContext, - Buffer, BufferSize); - else - return TDI_INVALID_PARAMETER; - else if (ID->toi_entity.tei_entity == CL_NL_ENTITY || - ID->toi_entity.tei_entity == CO_NL_ENTITY) - if ((EntityListContext = GetContext(ID->toi_entity))) - return InfoTdiSetRoute(EntityListContext, Buffer, BufferSize); - else + case INFO_CLASS_PROTOCOL: + { + switch (ID->toi_type) + { + case INFO_TYPE_ADDRESS_OBJECT: + { + if ((EntityListContext = GetContext(ID->toi_entity))) + return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); + else return TDI_INVALID_PARAMETER; - else - return TDI_INVALID_PARAMETER; - - default: - return TDI_INVALID_REQUEST; - } - - default: - return TDI_INVALID_REQUEST; - } -} + } + case INFO_TYPE_CONNECTION: + { + PADDRESS_FILE AddressFile = GetContext(ID->toi_entity); + if (AddressFile == NULL) + return TDI_INVALID_PARAMETER; + return SetConnectionInfo(ID, AddressFile->Connection, Buffer, BufferSize); + } + case INFO_TYPE_PROVIDER: + { + switch (ID->toi_id) + { + case IP_MIB_ARPTABLE_ENTRY_ID: + if (ID->toi_type != INFO_TYPE_PROVIDER) + return TDI_INVALID_PARAMETER; + + if (ID->toi_entity.tei_entity == AT_ENTITY) + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiSetArptableMIB(EntityListContext, Buffer, + BufferSize); + else + return TDI_INVALID_PARAMETER; + else if (ID->toi_entity.tei_entity == CL_NL_ENTITY + || ID->toi_entity.tei_entity == CO_NL_ENTITY) + if ((EntityListContext = GetContext(ID->toi_entity))) + return InfoTdiSetRoute(EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + else + return TDI_INVALID_PARAMETER; + + default: + return TDI_INVALID_REQUEST; + } + } + default: + DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information type for INFO_CLASS_PROTOCOL: %#x.\n", ID->toi_type); + return TDI_INVALID_PARAMETER; + } + break; + } + default: + DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information class %#x.\n", ID->toi_class); + return TDI_INVALID_REQUEST; + } +} Modified: trunk/reactos/include/psdk/tcpioctl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/tcpioctl.h?re…
============================================================================== --- trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -90,6 +90,9 @@ #define AO_OPTION_UNBIND 37 #define AO_OPTION_PROTECT 38 +/* TCP connection options */ +#define TCP_SOCKET_NODELAY 1 + typedef struct IFEntry { ULONG if_index; Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -674,4 +674,16 @@ return Found; } +NTSTATUS +TCPSetNoDelay( + PCONNECTION_ENDPOINT Connection, + BOOLEAN Set) +{ + if (Connection->SocketContext == NULL) + return STATUS_UNSUCCESSFUL; + LibTCPSetNoDelay(Connection->SocketContext, Set); + return STATUS_SUCCESS; +} + + /* EOF */ Modified: trunk/reactos/lib/drivers/lwip/src/include/rosip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/inclu…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -107,10 +107,11 @@ err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); +void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set); /* IP functions */ void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size); void LibIPInitialize(void); void LibIPShutdown(void); -#endif +#endif Modified: trunk/reactos/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/rostc…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Wed Oct 8 21:58:10 2014 @@ -829,3 +829,14 @@ return ERR_OK; } + +void +LibTCPSetNoDelay( + PTCP_PCB pcb, + BOOLEAN Set) +{ + if (Set) + pcb->flags |= TF_NODELAY; + else + pcb->flags &= ~TF_NODELAY; +}
10 years, 3 months
1
0
0
0
[jgardou] 64628: Revert r64621. It breaks internet connections.
by jgardou@svn.reactos.org
Author: jgardou Date: Wed Oct 8 21:16:00 2014 New Revision: 64628 URL:
http://svn.reactos.org/svn/reactos?rev=64628&view=rev
Log: Revert r64621. It breaks internet connections. Removed: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c trunk/reactos/drivers/network/tcpip/CMakeLists.txt trunk/reactos/drivers/network/tcpip/include/info.h trunk/reactos/drivers/network/tcpip/include/tcp.h trunk/reactos/drivers/network/tcpip/tcpip/info.c trunk/reactos/include/psdk/tcpioctl.h trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c trunk/reactos/lib/drivers/lwip/src/include/rosip.h trunk/reactos/lib/drivers/lwip/src/rostcp.c Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshtcpip/wshtcpi…
============================================================================== --- trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -156,18 +156,12 @@ return NO_ERROR; } -static -void -GetTdiTypeId( - _In_ INT Level, - _In_ INT OptionName, - _Out_ PULONG TdiType, - _Out_ PULONG TdiId) +UINT +GetAddressOption(INT Level, INT OptionName) { switch (Level) { case SOL_SOCKET: - *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case SO_KEEPALIVE: @@ -180,26 +174,21 @@ break; case IPPROTO_IP: - *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case IP_TTL: - *TdiId = AO_OPTION_TTL; - return; + return AO_OPTION_TTL; case IP_DONTFRAGMENT: - *TdiId = AO_OPTION_IP_DONTFRAGMENT; - return; + return AO_OPTION_IP_DONTFRAGMENT; #if 0 case IP_RECEIVE_BROADCAST: - *TdiId = AO_OPTION_BROADCAST; - return; + return AO_OPTION_BROADCAST; #endif case IP_HDRINCL: - *TdiId = AO_OPTION_IP_HDRINCL; - return; + return AO_OPTION_IP_HDRINCL; default: break; @@ -209,10 +198,10 @@ case IPPROTO_TCP: switch (OptionName) { - *TdiType = INFO_TYPE_CONNECTION; case TCP_NODELAY: - *TdiId = TCP_SOCKET_NODELAY; - return; + /* FIXME: Return proper option */ + ASSERT(FALSE); + break; default: break; } @@ -222,8 +211,7 @@ } DPRINT1("Unknown level/option name: %d %d\n", Level, OptionName); - *TdiType = 0; - *TdiId = 0; + return 0; } INT @@ -654,7 +642,7 @@ IN INT OptionLength) { PSOCKET_CONTEXT Context = HelperDllSocketContext; - ULONG TdiType, TdiId; + UINT RealOptionName; INT Status; PTCP_REQUEST_SET_INFORMATION_EX Info; PQUEUED_REQUEST Queued, NextQueued; @@ -709,11 +697,9 @@ switch (OptionName) { case TCP_NODELAY: - if (OptionLength < sizeof(CHAR)) - { - return WSAEFAULT; - } - break; + /* FIXME -- Send this to TCPIP */ + DPRINT1("Set: TCP_NODELAY not yet supported\n"); + return 0; default: /* Invalid option */ @@ -728,8 +714,8 @@ } /* If we get here, GetAddressOption must return something valid */ - GetTdiTypeId(Level, OptionName, &TdiId, &TdiType); - ASSERT((TdiId != 0) && (TdiType != 0)); + RealOptionName = GetAddressOption(Level, OptionName); + ASSERT(RealOptionName != 0); Info = HeapAlloc(GetProcessHeap(), 0, sizeof(*Info) + OptionLength); if (!Info) @@ -738,8 +724,8 @@ Info->ID.toi_entity.tei_entity = Context->AddrFileEntityType; Info->ID.toi_entity.tei_instance = Context->AddrFileInstance; Info->ID.toi_class = INFO_CLASS_PROTOCOL; - Info->ID.toi_type = TdiType; - Info->ID.toi_id = TdiId; + Info->ID.toi_type = INFO_TYPE_ADDRESS_OBJECT; + Info->ID.toi_id = RealOptionName; Info->BufferSize = OptionLength; memcpy(Info->Buffer, OptionValue, OptionLength); Modified: trunk/reactos/drivers/network/tcpip/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/CMak…
============================================================================== --- trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -14,7 +14,6 @@ datalink/lan.c tcpip/ainfo.c tcpip/buffer.c - tcpip/cinfo.c tcpip/dispatch.c tcpip/fileobjs.c tcpip/iinfo.c Modified: trunk/reactos/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -183,11 +183,6 @@ PVOID Buffer, PUINT BufferSize); -TDI_STATUS SetConnectionInfo(TDIObjectID *ID, - PCONNECTION_ENDPOINT Connection, - PVOID Buffer, - UINT BufferSize); - /* Insert and remove entities */ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ); Modified: trunk/reactos/drivers/network/tcpip/include/tcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -186,8 +186,6 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Connection, PIRP Irp ); -NTSTATUS TCPSetNoDelay(PCONNECTION_ENDPOINT Connection, BOOLEAN Set); - VOID TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF); Removed: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c (removed) @@ -1,32 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS TCP/IP protocol driver - * FILE: tcpip/cinfo.c - * PURPOSE: Per-socket connection information. - * PROGRAMMER: Jérôme Gardou - */ - -#include "precomp.h" - -TDI_STATUS SetConnectionInfo(TDIObjectID *ID, - PCONNECTION_ENDPOINT Connection, - PVOID Buffer, - UINT BufferSize) -{ - ASSERT(ID->toi_type == INFO_TYPE_CONNECTION); - switch (ID->toi_id) - { - case TCP_SOCKET_NODELAY: - { - BOOLEAN Set; - if (BufferSize < sizeof(BOOLEAN)) - return TDI_INVALID_PARAMETER; - Set = *(BOOLEAN*)Buffer; - return TCPSetNoDelay(Connection, Set); - } - default: - DbgPrint("TCPIP: Unknown connection info ID: %u.\n", ID->toi_id); - } - - return TDI_INVALID_PARAMETER; -} Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -326,25 +326,12 @@ switch (ID->toi_class) { case INFO_CLASS_PROTOCOL: - switch (ID->toi_type) + if (ID->toi_type == INFO_TYPE_ADDRESS_OBJECT) { - case INFO_TYPE_ADDRESS_OBJECT: - { - if ((EntityListContext = GetContext(ID->toi_entity))) - return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); - else - return TDI_INVALID_PARAMETER; - } - case INFO_TYPE_CONNECTION: - { - PADDRESS_FILE AddressFile = GetContext(ID->toi_entity); - if (AddressFile == NULL) - return TDI_INVALID_PARAMETER; - return SetConnectionInfo(ID, AddressFile->Connection, Buffer, BufferSize); - } - default: - DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information type for INFO_CLASS_PROTOCOL: 0x%#x.\n", ID->toi_type); - return TDI_INVALID_PARAMETER; + if ((EntityListContext = GetContext(ID->toi_entity))) + return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; } switch (ID->toi_id) Modified: trunk/reactos/include/psdk/tcpioctl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/tcpioctl.h?re…
============================================================================== --- trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -90,9 +90,6 @@ #define AO_OPTION_UNBIND 37 #define AO_OPTION_PROTECT 38 -/* TCP connection options */ -#define TCP_SOCKET_NODELAY 1 - typedef struct IFEntry { ULONG if_index; Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -674,16 +674,4 @@ return Found; } -NTSTATUS -TCPSetNoDelay( - PCONNECTION_ENDPOINT Connection, - BOOLEAN Set) -{ - if (Connection->SocketContext == NULL) - return STATUS_UNSUCCESSFUL; - LibTCPSetNoDelay(Connection->SocketContext, Set); - return STATUS_SUCCESS; -} - - /* EOF */ Modified: trunk/reactos/lib/drivers/lwip/src/include/rosip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/inclu…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -107,11 +107,10 @@ err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); -void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set); /* IP functions */ void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size); void LibIPInitialize(void); void LibIPShutdown(void); -#endif +#endif Modified: trunk/reactos/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/rostc…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Wed Oct 8 21:16:00 2014 @@ -829,14 +829,3 @@ return ERR_OK; } - -void -LibTCPSetNoDelay( - PTCP_PCB pcb, - BOOLEAN Set) -{ - if (Set) - pcb->flags |= TF_NODELAY; - else - pcb->flags &= ~TF_NODELAY; -}
10 years, 3 months
1
0
0
0
[akhaldi] 64627: [XMLLITE_WINETEST] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Oct 8 20:04:18 2014 New Revision: 64627 URL:
http://svn.reactos.org/svn/reactos?rev=64627&view=rev
Log: [XMLLITE_WINETEST] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/rostests/winetests/xmllite/writer.c Modified: trunk/rostests/winetests/xmllite/writer.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xmllite/writer.…
============================================================================== --- trunk/rostests/winetests/xmllite/writer.c [iso-8859-1] (original) +++ trunk/rostests/winetests/xmllite/writer.c [iso-8859-1] Wed Oct 8 20:04:18 2014 @@ -31,7 +31,7 @@ #include <windef.h> #include <winbase.h> #include <objbase.h> -//#include "ole2.h" +#include <ole2.h> #include <xmllite.h> #include <wine/test.h> @@ -74,20 +74,90 @@ static IUnknown testoutput = { &testoutputvtbl }; +static HRESULT WINAPI teststream_QueryInterface(ISequentialStream *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ISequentialStream)) + { + *obj = iface; + return S_OK; + } + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI teststream_AddRef(ISequentialStream *iface) +{ + return 2; +} + +static ULONG WINAPI teststream_Release(ISequentialStream *iface) +{ + return 1; +} + +static HRESULT WINAPI teststream_Read(ISequentialStream *iface, void *pv, ULONG cb, ULONG *pread) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static ULONG g_write_len; +static HRESULT WINAPI teststream_Write(ISequentialStream *iface, const void *pv, ULONG cb, ULONG *written) +{ + g_write_len = cb; + *written = cb; + return S_OK; +} + +static const ISequentialStreamVtbl teststreamvtbl = +{ + teststream_QueryInterface, + teststream_AddRef, + teststream_Release, + teststream_Read, + teststream_Write +}; + +static ISequentialStream teststream = { &teststreamvtbl }; + static void test_writer_create(void) { HRESULT hr; IXmlWriter *writer; + LONG_PTR value; /* crashes native */ if (0) { pCreateXmlWriter(&IID_IXmlWriter, NULL, NULL); - pCreateXmlWriter(NULL, (LPVOID*)&writer, NULL); + pCreateXmlWriter(NULL, (void**)&writer, NULL); } - hr = pCreateXmlWriter(&IID_IXmlWriter, (LPVOID*)&writer, NULL); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + /* check default properties values */ + value = 0; + hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ByteOrderMark, &value); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(value == TRUE, "got %ld\n", value); + + value = TRUE; + hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_Indent, &value); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(value == FALSE, "got %ld\n", value); + + value = TRUE; + hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, &value); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(value == FALSE, "got %ld\n", value); + + value = XmlConformanceLevel_Auto; + hr = IXmlWriter_GetProperty(writer, XmlWriterProperty_ConformanceLevel, &value); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + ok(value == XmlConformanceLevel_Document, "got %ld\n", value); + IXmlWriter_Release(writer); } @@ -116,6 +186,11 @@ IXmlWriterOutput *output; IUnknown *unk; HRESULT hr; + + output = NULL; + hr = pCreateXmlWriterOutputWithEncodingName(&testoutput, NULL, NULL, &output); + ok(hr == S_OK, "got %08x\n", hr); + IUnknown_Release(output); hr = pCreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output); ok(hr == S_OK, "got %08x\n", hr); @@ -127,6 +202,481 @@ IUnknown_Release(output); } +static void test_writestartdocument(void) +{ + static const char fullprolog[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; + static const char prologversion[] = "<?xml version=\"1.0\"?>"; + static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; + static const WCHAR xmlW[] = {'x','m','l',0}; + IXmlWriter *writer; + HGLOBAL hglobal; + IStream *stream; + HRESULT hr; + char *ptr; + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + /* output not set */ + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* nothing written yet */ + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, fullprolog, strlen(fullprolog)), "got %s, expected %s\n", ptr, fullprolog); + GlobalUnlock(hglobal); + + /* one more time */ + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + IStream_Release(stream); + + /* now add PI manually, and try to start a document */ + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + /* another attempt to add 'xml' PI */ + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, prologversion, strlen(prologversion)), "got %s\n", ptr); + GlobalUnlock(hglobal); + + IStream_Release(stream); + IXmlWriter_Release(writer); +} + +static void test_flush(void) +{ + IXmlWriter *writer; + HRESULT hr; + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)&teststream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + g_write_len = 0; + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(g_write_len > 0, "got %d\n", g_write_len); + + g_write_len = 1; + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(g_write_len == 0, "got %d\n", g_write_len); + + /* Release() flushes too */ + g_write_len = 1; + IXmlWriter_Release(writer); + ok(g_write_len == 0, "got %d\n", g_write_len); +} + +static void test_omitxmldeclaration(void) +{ + static const char prologversion[] = "<?xml version=\"1.0\"?>"; + static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; + static const WCHAR xmlW[] = {'x','m','l',0}; + IXmlWriter *writer; + HGLOBAL hglobal; + IStream *stream; + HRESULT hr; + char *ptr; + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!ptr, "got %p\n", ptr); + GlobalUnlock(hglobal); + + /* one more time */ + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + IStream_Release(stream); + + /* now add PI manually, and try to start a document */ + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, prologversion, strlen(prologversion)), "got %s\n", ptr); + GlobalUnlock(hglobal); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, prologversion, strlen(prologversion)), "got %s\n", ptr); + GlobalUnlock(hglobal); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, prologversion, strlen(prologversion)), "got %s\n", ptr); + GlobalUnlock(hglobal); + + /* another attempt to add 'xml' PI */ + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IStream_Release(stream); + IXmlWriter_Release(writer); +} + +static void test_bom(void) +{ + static const WCHAR versionW[] = {'v','e','r','s','i','o','n','=','"','1','.','0','"',0}; + static const WCHAR utf16W[] = {'u','t','f','-','1','6',0}; + static const WCHAR xmlW[] = {'x','m','l',0}; + static const WCHAR aW[] = {'a',0}; + IXmlWriterOutput *output; + unsigned char *ptr; + IXmlWriter *writer; + IStream *stream; + HGLOBAL hglobal; + HRESULT hr; + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + ok(hr == S_OK, "got %08x\n", hr); + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, output); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* BOM is on by default */ + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]); + GlobalUnlock(hglobal); + + IStream_Release(stream); + IUnknown_Release(output); + + /* start with PI */ + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, output); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteProcessingInstruction(writer, xmlW, versionW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]); + GlobalUnlock(hglobal); + + IUnknown_Release(output); + IStream_Release(stream); + + /* start with element */ + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, output); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]); + GlobalUnlock(hglobal); + + IUnknown_Release(output); + IStream_Release(stream); + + /* WriteElementString */ + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, output); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]); + GlobalUnlock(hglobal); + + IUnknown_Release(output); + IStream_Release(stream); + + IXmlWriter_Release(writer); +} + +static void test_writestartelement(void) +{ + static const WCHAR valueW[] = {'v','a','l','u','e',0}; + static const char *str = "<a><b>value</b>"; + static const WCHAR aW[] = {'a',0}; + static const WCHAR bW[] = {'b',0}; + char *ptr; + IXmlWriter *writer; + IStream *stream; + HGLOBAL hglobal; + HRESULT hr; + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, aW, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, aW); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, "<a", 2), "got %s\n", ptr); + GlobalUnlock(hglobal); + + hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Yes); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteProcessingInstruction(writer, aW, aW); + ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr); + + IStream_Release(stream); + IXmlWriter_Release(writer); + + /* WriteElementString */ + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, valueW); + ok(hr == E_UNEXPECTED, "got 0x%08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteElementString(writer, NULL, bW, NULL, valueW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, str, strlen(str)), "got %s\n", ptr); + GlobalUnlock(hglobal); + + IStream_Release(stream); + IXmlWriter_Release(writer); +} + +static void test_writeendelement(void) +{ + static const WCHAR aW[] = {'a',0}; + static const WCHAR bW[] = {'b',0}; + char *ptr; + IXmlWriter *writer; + IStream *stream; + HGLOBAL hglobal; + HRESULT hr; + + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); + ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); + + hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteStartElement(writer, NULL, bW, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteEndElement(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_WriteEndElement(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = GetHGlobalFromStream(stream, &hglobal); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ptr = GlobalLock(hglobal); + ok(!strncmp(ptr, "<a><b /></a>", 12), "got %s\n", ptr); + GlobalUnlock(hglobal); + + IXmlWriter_Release(writer); + IStream_Release(stream); +} + START_TEST(writer) { if (!init_pointers()) @@ -134,4 +684,10 @@ test_writer_create(); test_writeroutput(); -} + test_writestartdocument(); + test_writestartelement(); + test_writeendelement(); + test_flush(); + test_omitxmldeclaration(); + test_bom(); +}
10 years, 3 months
1
0
0
0
[akhaldi] 64626: [XMLLITE] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Oct 8 20:02:37 2014 New Revision: 64626 URL:
http://svn.reactos.org/svn/reactos?rev=64626&view=rev
Log: [XMLLITE] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/win32/xmllite/reader.c trunk/reactos/dll/win32/xmllite/writer.c trunk/reactos/dll/win32/xmllite/xmllite_private.h trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/xmllite/reader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/reader.c…
============================================================================== --- trunk/reactos/dll/win32/xmllite/reader.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/xmllite/reader.c [iso-8859-1] Wed Oct 8 20:02:37 2014 @@ -113,7 +113,7 @@ return type_names[nodetype]; } -static const char *debugstr_prop(XmlReaderProperty prop) +static const char *debugstr_reader_prop(XmlReaderProperty prop) { static const char * const prop_names[] = { @@ -144,6 +144,11 @@ { utf16W, XmlEncoding_UTF16, ~0 }, { utf8W, XmlEncoding_UTF8, CP_UTF8 } }; + +const WCHAR *get_encoding_name(xml_encoding encoding) +{ + return xml_encoding_map[encoding].name; +} typedef struct { @@ -248,14 +253,6 @@ return CONTAINING_RECORD(iface, xmlreaderinput, IXmlReaderInput_iface); } -static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) -{ - if (imalloc) - return IMalloc_Realloc(imalloc, mem, len); - else - return heap_realloc(mem, len); -} - /* reader memory allocation functions */ static inline void *reader_alloc(xmlreader *reader, size_t len) { @@ -363,12 +360,6 @@ reader_free(reader, v->str); *v = strval_empty; } -} - -/* returns length in WCHARs from 'start' to current buffer offset */ -static inline UINT reader_get_len(const xmlreader *reader, UINT start) -{ - return reader->input->buffer->utf16.cur - start; } static inline void reader_init_strvalue(UINT start, UINT len, strval *v) @@ -544,7 +535,7 @@ readerinput_free(input, buffer->data); } -static HRESULT get_code_page(xml_encoding encoding, UINT *cp) +HRESULT get_code_page(xml_encoding encoding, UINT *cp) { if (encoding == XmlEncoding_Unknown) { @@ -632,7 +623,7 @@ /* Queries already stored interface for IStream/ISequentialStream. Interface supplied on creation will be overwritten */ -static HRESULT readerinput_query_for_stream(xmlreaderinput *readerinput) +static inline HRESULT readerinput_query_for_stream(xmlreaderinput *readerinput) { HRESULT hr; @@ -2507,7 +2498,7 @@ { /* create IXmlReaderInput basing on supplied interface */ hr = CreateXmlReaderInputWithEncodingName(input, - NULL, NULL, FALSE, NULL, &readerinput); + This->imalloc, NULL, FALSE, NULL, &readerinput); if (hr != S_OK) return hr; This->input = impl_from_IXmlReaderInput(readerinput); } @@ -2527,7 +2518,7 @@ { xmlreader *This = impl_from_IXmlReader(iface); - TRACE("(%p)->(%s %p)\n", This, debugstr_prop(property), value); + TRACE("(%p)->(%s %p)\n", This, debugstr_reader_prop(property), value); if (!value) return E_INVALIDARG; @@ -2551,7 +2542,7 @@ { xmlreader *This = impl_from_IXmlReader(iface); - TRACE("(%p)->(%s %lu)\n", This, debugstr_prop(property), value); + TRACE("(%p)->(%s %lu)\n", This, debugstr_reader_prop(property), value); switch (property) { Modified: trunk/reactos/dll/win32/xmllite/writer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/writer.c…
============================================================================== --- trunk/reactos/dll/win32/xmllite/writer.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/xmllite/writer.c [iso-8859-1] Wed Oct 8 20:02:37 2014 @@ -2,6 +2,7 @@ * IXmlWriter implementation * * Copyright 2011 Alistair Leslie-Hughes + * Copyright 2014 Nikolay Sivov for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,22 +21,71 @@ #include "xmllite_private.h" +#include <wine/list.h> +#include <wine/unicode.h> + /* not defined in public headers */ DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); + +#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) + +static const WCHAR closeelementW[] = {'<','/'}; +static const WCHAR closepiW[] = {'?','>'}; +static const WCHAR ltW[] = {'<'}; +static const WCHAR gtW[] = {'>'}; + +struct output_buffer +{ + char *data; + unsigned int allocated; + unsigned int written; + UINT codepage; +}; + +typedef enum +{ + XmlWriterState_Initial, /* output is not set yet */ + XmlWriterState_Ready, /* SetOutput() was called, ready to start */ + XmlWriterState_PIDocStarted, /* document was started with manually added 'xml' PI */ + XmlWriterState_DocStarted, /* document was started with WriteStartDocument() */ + XmlWriterState_ElemStarted, /* writing element */ + XmlWriterState_Content /* content is accepted at this point */ +} XmlWriterState; typedef struct { IXmlWriterOutput IXmlWriterOutput_iface; LONG ref; IUnknown *output; + ISequentialStream *stream; IMalloc *imalloc; xml_encoding encoding; + struct output_buffer buffer; } xmlwriteroutput; + +static const struct IUnknownVtbl xmlwriteroutputvtbl; + +struct element +{ + struct list entry; + WCHAR *qname; + unsigned int len; /* qname length in chars */ +}; typedef struct _xmlwriter { IXmlWriter IXmlWriter_iface; LONG ref; + IMalloc *imalloc; + xmlwriteroutput *output; + BOOL indent; + BOOL bom; + BOOL omitxmldecl; + XmlConformanceLevel conformance; + XmlWriterState state; + BOOL bomwritten; + BOOL starttagopen; + struct list elements; } xmlwriter; static inline xmlwriter *impl_from_IXmlWriter(IXmlWriter *iface) @@ -48,7 +98,24 @@ return CONTAINING_RECORD(iface, xmlwriteroutput, IXmlWriterOutput_iface); } -/* reader input memory allocation functions */ +static const char *debugstr_writer_prop(XmlWriterProperty prop) +{ + static const char * const prop_names[] = + { + "MultiLanguage", + "Indent", + "ByteOrderMark", + "OmitXmlDeclaration", + "ConformanceLevel" + }; + + if (prop > _XmlWriterProperty_Last) + return wine_dbg_sprintf("unknown property=%d", prop); + + return prop_names[prop]; +} + +/* writer output memory allocation functions */ static inline void *writeroutput_alloc(xmlwriteroutput *output, size_t len) { return m_alloc(output->imalloc, len); @@ -57,6 +124,251 @@ static inline void writeroutput_free(xmlwriteroutput *output, void *mem) { m_free(output->imalloc, mem); +} + +static inline void *writeroutput_realloc(xmlwriteroutput *output, void *mem, size_t len) +{ + return m_realloc(output->imalloc, mem, len); +} + +/* writer memory allocation functions */ +static inline void *writer_alloc(xmlwriter *writer, size_t len) +{ + return m_alloc(writer->imalloc, len); +} + +static inline void writer_free(xmlwriter *writer, void *mem) +{ + m_free(writer->imalloc, mem); +} + +static struct element *alloc_element(xmlwriter *writer, const WCHAR *prefix, const WCHAR *local) +{ + struct element *ret; + int len; + + ret = writer_alloc(writer, sizeof(*ret)); + if (!ret) return ret; + + len = prefix ? strlenW(prefix) + 1 /* ':' */ : 0; + len += strlenW(local); + + ret->qname = writer_alloc(writer, (len + 1)*sizeof(WCHAR)); + ret->len = len; + if (prefix) { + static const WCHAR colonW[] = {':',0}; + strcpyW(ret->qname, prefix); + strcatW(ret->qname, colonW); + } + else + ret->qname[0] = 0; + strcatW(ret->qname, local); + + return ret; +} + +static void free_element(xmlwriter *writer, struct element *element) +{ + writer_free(writer, element->qname); + writer_free(writer, element); +} + +static void push_element(xmlwriter *writer, struct element *element) +{ + list_add_head(&writer->elements, &element->entry); +} + +static struct element *pop_element(xmlwriter *writer) +{ + struct element *element = LIST_ENTRY(list_head(&writer->elements), struct element, entry); + + if (element) + list_remove(&element->entry); + + return element; +} + +static HRESULT init_output_buffer(xmlwriteroutput *output) +{ + struct output_buffer *buffer = &output->buffer; + const int initial_len = 0x2000; + HRESULT hr; + UINT cp; + + hr = get_code_page(output->encoding, &cp); + if (FAILED(hr)) return hr; + + buffer->data = writeroutput_alloc(output, initial_len); + if (!buffer->data) return E_OUTOFMEMORY; + + memset(buffer->data, 0, 4); + buffer->allocated = initial_len; + buffer->written = 0; + buffer->codepage = cp; + + return S_OK; +} + +static void free_output_buffer(xmlwriteroutput *output) +{ + struct output_buffer *buffer = &output->buffer; + writeroutput_free(output, buffer->data); + buffer->data = NULL; + buffer->allocated = 0; + buffer->written = 0; +} + +static HRESULT grow_output_buffer(xmlwriteroutput *output, int length) +{ + struct output_buffer *buffer = &output->buffer; + /* grow if needed, plus 4 bytes to be sure null terminator will fit in */ + if (buffer->allocated < buffer->written + length + 4) { + int grown_size = max(2*buffer->allocated, buffer->allocated + length); + char *ptr = writeroutput_realloc(output, buffer->data, grown_size); + if (!ptr) return E_OUTOFMEMORY; + buffer->data = ptr; + buffer->allocated = grown_size; + } + + return S_OK; +} + +static HRESULT write_output_buffer(xmlwriteroutput *output, const WCHAR *data, int len) +{ + struct output_buffer *buffer = &output->buffer; + int length; + HRESULT hr; + char *ptr; + + if (buffer->codepage != ~0) { + length = WideCharToMultiByte(buffer->codepage, 0, data, len, NULL, 0, NULL, NULL); + hr = grow_output_buffer(output, length); + if (FAILED(hr)) return hr; + ptr = buffer->data + buffer->written; + length = WideCharToMultiByte(buffer->codepage, 0, data, len, ptr, length, NULL, NULL); + buffer->written += len == -1 ? length-1 : length; + } + else { + /* WCHAR data just copied */ + length = len == -1 ? strlenW(data) : len; + if (length) { + length *= sizeof(WCHAR); + + hr = grow_output_buffer(output, length); + if (FAILED(hr)) return hr; + ptr = buffer->data + buffer->written; + + memcpy(ptr, data, length); + buffer->written += length; + ptr += length; + /* null termination */ + *(WCHAR*)ptr = 0; + } + } + + return S_OK; +} + +static HRESULT write_output_buffer_quoted(xmlwriteroutput *output, const WCHAR *data, int len) +{ + static const WCHAR quoteW[] = {'"'}; + write_output_buffer(output, quoteW, ARRAY_SIZE(quoteW)); + write_output_buffer(output, data, len); + write_output_buffer(output, quoteW, ARRAY_SIZE(quoteW)); + return S_OK; +} + +/* TODO: test if we need to validate char range */ +static HRESULT write_output_qname(xmlwriteroutput *output, const WCHAR *prefix, const WCHAR *local_name) +{ + if (prefix) { + static const WCHAR colW[] = {':'}; + write_output_buffer(output, prefix, -1); + write_output_buffer(output, colW, ARRAY_SIZE(colW)); + } + + write_output_buffer(output, local_name, -1); + + return S_OK; +} + +static void writeroutput_release_stream(xmlwriteroutput *writeroutput) +{ + if (writeroutput->stream) { + ISequentialStream_Release(writeroutput->stream); + writeroutput->stream = NULL; + } +} + +static inline HRESULT writeroutput_query_for_stream(xmlwriteroutput *writeroutput) +{ + HRESULT hr; + + writeroutput_release_stream(writeroutput); + hr = IUnknown_QueryInterface(writeroutput->output, &IID_IStream, (void**)&writeroutput->stream); + if (hr != S_OK) + hr = IUnknown_QueryInterface(writeroutput->output, &IID_ISequentialStream, (void**)&writeroutput->stream); + + return hr; +} + +static HRESULT writeroutput_flush_stream(xmlwriteroutput *output) +{ + struct output_buffer *buffer; + ULONG written, offset = 0; + HRESULT hr; + + if (!output || !output->stream) + return S_OK; + + buffer = &output->buffer; + + /* It will loop forever until everything is written or an error occured. */ + do { + written = 0; + hr = ISequentialStream_Write(output->stream, buffer->data + offset, buffer->written, &written); + if (FAILED(hr)) { + WARN("write to stream failed (0x%08x)\n", hr); + buffer->written = 0; + return hr; + } + + offset += written; + buffer->written -= written; + } while (buffer->written > 0); + + return S_OK; +} + +static HRESULT write_encoding_bom(xmlwriter *writer) +{ + if (!writer->bom || writer->bomwritten) return S_OK; + + if (writer->output->encoding == XmlEncoding_UTF16) { + static const char utf16bom[] = {0xff, 0xfe}; + struct output_buffer *buffer = &writer->output->buffer; + int len = sizeof(utf16bom); + HRESULT hr; + + hr = grow_output_buffer(writer->output, len); + if (FAILED(hr)) return hr; + memcpy(buffer->data + buffer->written, utf16bom, len); + buffer->written += len; + } + + writer->bomwritten = TRUE; + return S_OK; +} + +static HRESULT writer_close_starttag(xmlwriter *writer) +{ + HRESULT hr; + + if (!writer->starttagopen) return S_OK; + hr = write_output_buffer(writer->output, gtW, ARRAY_SIZE(gtW)); + writer->starttagopen = FALSE; + writer->state = XmlWriterState_Content; + return hr; } static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject) @@ -91,38 +403,123 @@ TRACE("%p\n", This); ref = InterlockedDecrement(&This->ref); - if (ref == 0) - heap_free(This); + if (ref == 0) { + struct element *element, *element2; + IMalloc *imalloc = This->imalloc; + + IXmlWriter_Flush(iface); + if (This->output) IUnknown_Release(&This->output->IXmlWriterOutput_iface); + + /* element stack */ + LIST_FOR_EACH_ENTRY_SAFE(element, element2, &This->elements, struct element, entry) { + list_remove(&element->entry); + free_element(This, element); + } + + writer_free(This, This); + if (imalloc) IMalloc_Release(imalloc); + } return ref; } /*** IXmlWriter methods ***/ -static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *pOutput) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %p\n", This, pOutput); - - return E_NOTIMPL; -} - -static HRESULT WINAPI xmlwriter_GetProperty(IXmlWriter *iface, UINT nProperty, LONG_PTR *ppValue) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %u %p\n", This, nProperty, ppValue); - - return E_NOTIMPL; -} - -static HRESULT WINAPI xmlwriter_SetProperty(IXmlWriter *iface, UINT nProperty, LONG_PTR pValue) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %u %lu\n", This, nProperty, pValue); - - return E_NOTIMPL; +static HRESULT WINAPI xmlwriter_SetOutput(IXmlWriter *iface, IUnknown *output) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + IXmlWriterOutput *writeroutput; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, output); + + if (This->output) { + writeroutput_release_stream(This->output); + IUnknown_Release(&This->output->IXmlWriterOutput_iface); + This->output = NULL; + This->bomwritten = FALSE; + } + + /* just reset current output */ + if (!output) { + This->state = XmlWriterState_Initial; + return S_OK; + } + + /* now try IXmlWriterOutput, ISequentialStream, IStream */ + hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&writeroutput); + if (hr == S_OK) { + if (writeroutput->lpVtbl == &xmlwriteroutputvtbl) + This->output = impl_from_IXmlWriterOutput(writeroutput); + else { + ERR("got external IXmlWriterOutput implementation: %p, vtbl=%p\n", + writeroutput, writeroutput->lpVtbl); + IUnknown_Release(writeroutput); + return E_FAIL; + + } + } + + if (hr != S_OK || !writeroutput) { + /* create IXmlWriterOutput basing on supplied interface */ + hr = CreateXmlWriterOutputWithEncodingName(output, This->imalloc, NULL, &writeroutput); + if (hr != S_OK) return hr; + This->output = impl_from_IXmlWriterOutput(writeroutput); + } + + This->state = XmlWriterState_Ready; + return writeroutput_query_for_stream(This->output); +} + +static HRESULT WINAPI xmlwriter_GetProperty(IXmlWriter *iface, UINT property, LONG_PTR *value) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_writer_prop(property), value); + + if (!value) return E_INVALIDARG; + + switch (property) + { + case XmlWriterProperty_Indent: + *value = This->indent; + break; + case XmlWriterProperty_ByteOrderMark: + *value = This->bom; + break; + case XmlWriterProperty_OmitXmlDeclaration: + *value = This->omitxmldecl; + break; + case XmlWriterProperty_ConformanceLevel: + *value = This->conformance; + break; + default: + FIXME("Unimplemented property (%u)\n", property); + return E_NOTIMPL; + } + + return S_OK; +} + +static HRESULT WINAPI xmlwriter_SetProperty(IXmlWriter *iface, UINT property, LONG_PTR value) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + + TRACE("(%p)->(%s %lu)\n", This, debugstr_writer_prop(property), value); + + switch (property) + { + case XmlWriterProperty_ByteOrderMark: + This->bom = !!value; + break; + case XmlWriterProperty_OmitXmlDeclaration: + This->omitxmldecl = !!value; + break; + default: + FIXME("Unimplemented property (%u)\n", property); + return E_NOTIMPL; + } + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteAttributes(IXmlWriter *iface, IXmlReader *pReader, @@ -186,16 +583,39 @@ return E_NOTIMPL; } -static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pwszPrefix, - LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri, - LPCWSTR pwszValue) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %s %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName), - wine_dbgstr_w(pwszNamespaceUri), wine_dbgstr_w(pwszValue)); - - return E_NOTIMPL; +static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR prefix, + LPCWSTR local_name, LPCWSTR uri, LPCWSTR value) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + + TRACE("(%p)->(%s %s %s %s)\n", This, wine_dbgstr_w(prefix), wine_dbgstr_w(local_name), + wine_dbgstr_w(uri), wine_dbgstr_w(value)); + + switch (This->state) + { + case XmlWriterState_Initial: + return E_UNEXPECTED; + case XmlWriterState_ElemStarted: + writer_close_starttag(This); + break; + default: + ; + } + + write_encoding_bom(This); + write_output_buffer(This->output, ltW, ARRAY_SIZE(ltW)); + write_output_qname(This->output, prefix, local_name); + write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW)); + + if (value) + write_output_buffer(This->output, value, -1); + + write_output_buffer(This->output, closeelementW, ARRAY_SIZE(closeelementW)); + write_output_qname(This->output, prefix, local_name); + write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW)); + This->state = XmlWriterState_Content; + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteEndDocument(IXmlWriter *iface) @@ -210,10 +630,27 @@ static HRESULT WINAPI xmlwriter_WriteEndElement(IXmlWriter *iface) { xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p\n", This); - - return E_NOTIMPL; + struct element *element; + + TRACE("%p\n", This); + + element = pop_element(This); + if (!element) + return WR_E_INVALIDACTION; + + if (This->starttagopen) { + static WCHAR closetagW[] = {' ','/','>'}; + write_output_buffer(This->output, closetagW, ARRAY_SIZE(closetagW)); + This->starttagopen = FALSE; + } + else { + /* write full end tag */ + write_output_buffer(This->output, closeelementW, ARRAY_SIZE(closeelementW)); + write_output_buffer(This->output, element->qname, element->len); + write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW)); + } + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteEntityRef(IXmlWriter *iface, LPCWSTR pwszName) @@ -228,10 +665,21 @@ static HRESULT WINAPI xmlwriter_WriteFullEndElement(IXmlWriter *iface) { xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p\n", This); - - return E_NOTIMPL; + struct element *element; + + TRACE("%p\n", This); + + element = pop_element(This); + if (!element) + return WR_E_INVALIDACTION; + + /* write full end tag */ + write_output_buffer(This->output, closeelementW, ARRAY_SIZE(closeelementW)); + write_output_buffer(This->output, element->qname, element->len); + write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW)); + This->starttagopen = FALSE; + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteName(IXmlWriter *iface, LPCWSTR pwszName) @@ -272,14 +720,41 @@ return E_NOTIMPL; } -static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LPCWSTR pwszName, - LPCWSTR pwszText) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %s %s\n", This, wine_dbgstr_w(pwszName), wine_dbgstr_w(pwszText)); - - return E_NOTIMPL; +static HRESULT WINAPI xmlwriter_WriteProcessingInstruction(IXmlWriter *iface, LPCWSTR name, + LPCWSTR text) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + static const WCHAR xmlW[] = {'x','m','l',0}; + static const WCHAR openpiW[] = {'<','?'}; + static const WCHAR spaceW[] = {' '}; + + TRACE("(%p)->(%s %s)\n", This, wine_dbgstr_w(name), wine_dbgstr_w(text)); + + switch (This->state) + { + case XmlWriterState_Initial: + return E_UNEXPECTED; + case XmlWriterState_DocStarted: + if (!strcmpW(name, xmlW)) + return WR_E_INVALIDACTION; + break; + case XmlWriterState_ElemStarted: + return WR_E_INVALIDACTION; + default: + ; + } + + write_encoding_bom(This); + write_output_buffer(This->output, openpiW, ARRAY_SIZE(openpiW)); + write_output_buffer(This->output, name, -1); + write_output_buffer(This->output, spaceW, ARRAY_SIZE(spaceW)); + write_output_buffer(This->output, text, -1); + write_output_buffer(This->output, closepiW, ARRAY_SIZE(closepiW)); + + if (!strcmpW(name, xmlW)) + This->state = XmlWriterState_PIDocStarted; + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteQualifiedName(IXmlWriter *iface, LPCWSTR pwszLocalName, @@ -312,22 +787,86 @@ static HRESULT WINAPI xmlwriter_WriteStartDocument(IXmlWriter *iface, XmlStandalone standalone) { - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p\n", This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pwszPrefix, - LPCWSTR pwszLocalName, LPCWSTR pwszNamespaceUri) -{ - xmlwriter *This = impl_from_IXmlWriter(iface); - - FIXME("%p %s %s %s\n", This, wine_dbgstr_w(pwszPrefix), wine_dbgstr_w(pwszLocalName), - wine_dbgstr_w(pwszNamespaceUri)); - - return E_NOTIMPL; + static const WCHAR versionW[] = {'<','?','x','m','l',' ','v','e','r','s','i','o','n','=','"','1','.','0','"'}; + static const WCHAR encodingW[] = {' ','e','n','c','o','d','i','n','g','='}; + xmlwriter *This = impl_from_IXmlWriter(iface); + + TRACE("(%p)->(%d)\n", This, standalone); + + switch (This->state) + { + case XmlWriterState_Initial: + return E_UNEXPECTED; + case XmlWriterState_PIDocStarted: + This->state = XmlWriterState_DocStarted; + return S_OK; + case XmlWriterState_DocStarted: + case XmlWriterState_ElemStarted: + return WR_E_INVALIDACTION; + default: + ; + } + + write_encoding_bom(This); + This->state = XmlWriterState_DocStarted; + if (This->omitxmldecl) return S_OK; + + /* version */ + write_output_buffer(This->output, versionW, ARRAY_SIZE(versionW)); + + /* encoding */ + write_output_buffer(This->output, encodingW, ARRAY_SIZE(encodingW)); + write_output_buffer_quoted(This->output, get_encoding_name(This->output->encoding), -1); + + /* standalone */ + if (standalone == XmlStandalone_Omit) + write_output_buffer(This->output, closepiW, ARRAY_SIZE(closepiW)); + else { + static const WCHAR standaloneW[] = {' ','s','t','a','n','d','a','l','o','n','e','=','\"'}; + static const WCHAR yesW[] = {'y','e','s','\"','?','>'}; + static const WCHAR noW[] = {'n','o','\"','?','>'}; + + write_output_buffer(This->output, standaloneW, ARRAY_SIZE(standaloneW)); + if (standalone == XmlStandalone_Yes) + write_output_buffer(This->output, yesW, ARRAY_SIZE(yesW)); + else + write_output_buffer(This->output, noW, ARRAY_SIZE(noW)); + } + + return S_OK; +} + +static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR prefix, LPCWSTR local_name, LPCWSTR uri) +{ + xmlwriter *This = impl_from_IXmlWriter(iface); + struct element *element; + + TRACE("(%p)->(%s %s %s)\n", This, wine_dbgstr_w(prefix), wine_dbgstr_w(local_name), wine_dbgstr_w(uri)); + + if (This->state == XmlWriterState_Initial) + return E_UNEXPECTED; + + if (!local_name) + return E_INVALIDARG; + + /* close pending element */ + if (This->starttagopen) + write_output_buffer(This->output, gtW, ARRAY_SIZE(gtW)); + + element = alloc_element(This, prefix, local_name); + if (!element) + return E_OUTOFMEMORY; + + write_encoding_bom(This); + This->state = XmlWriterState_ElemStarted; + This->starttagopen = TRUE; + + push_element(This, element); + + write_output_buffer(This->output, ltW, ARRAY_SIZE(ltW)); + write_output_qname(This->output, prefix, local_name); + + return S_OK; } static HRESULT WINAPI xmlwriter_WriteString(IXmlWriter *iface, LPCWSTR pwszText) @@ -361,9 +900,9 @@ { xmlwriter *This = impl_from_IXmlWriter(iface); - FIXME("%p\n", This); - - return E_NOTIMPL; + TRACE("%p\n", This); + + return writeroutput_flush_stream(This->output); } static const struct IXmlWriterVtbl xmlwriter_vtbl = @@ -445,6 +984,8 @@ { IMalloc *imalloc = This->imalloc; if (This->output) IUnknown_Release(This->output); + if (This->stream) ISequentialStream_Release(This->stream); + free_output_buffer(This); writeroutput_free(This, This); if (imalloc) IMalloc_Release(imalloc); } @@ -459,13 +1000,11 @@ xmlwriteroutput_Release }; -HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc) +HRESULT WINAPI CreateXmlWriter(REFIID riid, void **obj, IMalloc *imalloc) { xmlwriter *writer; - TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), pObject, pMalloc); - - if (pMalloc) FIXME("custom IMalloc not supported yet\n"); + TRACE("(%s, %p, %p)\n", wine_dbgstr_guid(riid), obj, imalloc); if (!IsEqualGUID(riid, &IID_IXmlWriter)) { @@ -473,15 +1012,29 @@ return E_FAIL; } - writer = heap_alloc(sizeof(*writer)); + if (imalloc) + writer = IMalloc_Alloc(imalloc, sizeof(*writer)); + else + writer = heap_alloc(sizeof(*writer)); if(!writer) return E_OUTOFMEMORY; writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl; writer->ref = 1; - - *pObject = &writer->IXmlWriter_iface; - - TRACE("returning iface %p\n", *pObject); + writer->imalloc = imalloc; + if (imalloc) IMalloc_AddRef(imalloc); + writer->output = NULL; + writer->indent = FALSE; + writer->bom = TRUE; + writer->omitxmldecl = FALSE; + writer->conformance = XmlConformanceLevel_Document; + writer->state = XmlWriterState_Initial; + writer->bomwritten = FALSE; + writer->starttagopen = FALSE; + list_init(&writer->elements); + + *obj = &writer->IXmlWriter_iface; + + TRACE("returning iface %p\n", *obj); return S_OK; } @@ -491,11 +1044,15 @@ LPCWSTR encoding, IXmlWriterOutput **output) { + static const WCHAR utf8W[] = {'U','T','F','-','8',0}; xmlwriteroutput *writeroutput; + HRESULT hr; TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output); if (!stream || !output) return E_INVALIDARG; + + *output = NULL; if (imalloc) writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput)); @@ -507,7 +1064,13 @@ writeroutput->ref = 1; writeroutput->imalloc = imalloc; if (imalloc) IMalloc_AddRef(imalloc); - writeroutput->encoding = parse_encoding_name(encoding, -1); + writeroutput->encoding = parse_encoding_name(encoding ? encoding : utf8W, -1); + writeroutput->stream = NULL; + hr = init_output_buffer(writeroutput); + if (FAILED(hr)) { + IUnknown_Release(&writeroutput->IXmlWriterOutput_iface); + return hr; + } IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output); Modified: trunk/reactos/dll/win32/xmllite/xmllite_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/xmllite/xmllite_…
============================================================================== --- trunk/reactos/dll/win32/xmllite/xmllite_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/xmllite/xmllite_private.h [iso-8859-1] Wed Oct 8 20:02:37 2014 @@ -63,6 +63,14 @@ return heap_alloc(len); } +static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) +{ + if (imalloc) + return IMalloc_Realloc(imalloc, mem, len); + else + return heap_realloc(mem, len); +} + static inline void m_free(IMalloc *imalloc, void *mem) { if (imalloc) @@ -78,6 +86,8 @@ XmlEncoding_Unknown } xml_encoding; -xml_encoding parse_encoding_name(const WCHAR *name, int len) DECLSPEC_HIDDEN; +xml_encoding parse_encoding_name(const WCHAR*,int) DECLSPEC_HIDDEN; +HRESULT get_code_page(xml_encoding,UINT*) DECLSPEC_HIDDEN; +const WCHAR *get_encoding_name(xml_encoding) DECLSPEC_HIDDEN; #endif /* __XMLLITE_PRIVATE__ */ 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] Wed Oct 8 20:02:37 2014 @@ -227,7 +227,7 @@ reactos/dll/win32/xinput1_2 # Synced to Wine-1.7.17 reactos/dll/win32/xinput1_3 # Synced to Wine-1.7.17 reactos/dll/win32/xinput9_1_0 # Synced to Wine-1.7.17 -reactos/dll/win32/xmllite # Synced to Wine-1.7.17 +reactos/dll/win32/xmllite # Synced to Wine-1.7.27 reactos/dll/cpl/inetcpl # Synced to Wine-1.7.1
10 years, 3 months
1
0
0
0
[pschweitzer] 64625: [NTFS] Hello, please don't leak memory. Cheers. Spotted by Thomas
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Oct 8 20:02:09 2014 New Revision: 64625 URL:
http://svn.reactos.org/svn/reactos?rev=64625&view=rev
Log: [NTFS] Hello, please don't leak memory. Cheers. Spotted by Thomas Modified: trunk/reactos/drivers/filesystems/ntfs/fcb.c Modified: trunk/reactos/drivers/filesystems/ntfs/fcb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/f…
============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/fcb.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/fcb.c [iso-8859-1] Wed Oct 8 20:02:09 2014 @@ -285,18 +285,21 @@ if (!NT_SUCCESS(ReadFileRecord(Vcb, NTFS_FILE_ROOT, MftRecord))) { + ExFreePoolWithTag(MftRecord, TAG_NTFS); return NULL; } FileName = GetFileNameFromRecord(MftRecord); if (!FileName) { + ExFreePoolWithTag(MftRecord, TAG_NTFS); return NULL; } Fcb = NtfsCreateFCB(L"\\", Vcb); if (!Fcb) { + ExFreePoolWithTag(MftRecord, TAG_NTFS); return NULL; } @@ -314,6 +317,8 @@ NtfsFCBInitializeCache(Vcb, Fcb); NtfsAddFCBToTable(Vcb, Fcb); NtfsGrabFCB(Vcb, Fcb); + + ExFreePoolWithTag(MftRecord, TAG_NTFS); return Fcb; }
10 years, 3 months
1
0
0
0
[akhaldi] 64624: [WLDAP32] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Oct 8 19:57:11 2014 New Revision: 64624 URL:
http://svn.reactos.org/svn/reactos?rev=64624&view=rev
Log: [WLDAP32] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/win32/wldap32/lang/wldap32_En.rc trunk/reactos/dll/win32/wldap32/lang/wldap32_He.rc trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/wldap32/lang/wldap32_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/lang/wld…
============================================================================== --- trunk/reactos/dll/win32/wldap32/lang/wldap32_En.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/lang/wldap32_En.rc [iso-8859-1] Wed Oct 8 19:57:11 2014 @@ -110,7 +110,7 @@ 85 "Timeout" 86 "Auth Unknown" 87 "Filter Error" - 88 "User Cancelled" + 88 "User Canceled" 89 "Parameter Error" 90 "No Memory" 91 "Can't connect to the LDAP server" Modified: trunk/reactos/dll/win32/wldap32/lang/wldap32_He.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/lang/wld…
============================================================================== --- trunk/reactos/dll/win32/wldap32/lang/wldap32_He.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/lang/wldap32_He.rc [iso-8859-1] Wed Oct 8 19:57:11 2014 @@ -112,7 +112,7 @@ 85 "×ª× ××××" 86 "Auth Unknown" 87 "Filter Error" - 88 "User Cancelled" + 88 "User Canceled" 89 "Parameter Error" 90 "No Memory" 91 "Can't connect to the LDAP server" 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] Wed Oct 8 19:57:11 2014 @@ -219,7 +219,7 @@ reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 reactos/dll/win32/winscard # Synced to Wine-1.7.17 reactos/dll/win32/wintrust # Synced to Wine-1.7.27 -reactos/dll/win32/wldap32 # Synced to Wine-1.7.17 +reactos/dll/win32/wldap32 # Synced to Wine-1.7.27 reactos/dll/win32/wmi # Synced to Wine-1.7.17 reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.17 reactos/dll/win32/wuapi # Synced to Wine-1.7.17
10 years, 3 months
1
0
0
0
[akhaldi] 64623: [WINTRUST_WINETEST] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Oct 8 19:51:36 2014 New Revision: 64623 URL:
http://svn.reactos.org/svn/reactos?rev=64623&view=rev
Log: [WINTRUST_WINETEST] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/rostests/winetests/wintrust/crypt.c trunk/rostests/winetests/wintrust/softpub.c Modified: trunk/rostests/winetests/wintrust/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wintrust/crypt.…
============================================================================== --- trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] Wed Oct 8 19:51:36 2014 @@ -239,7 +239,7 @@ * FIXME: * We don't want to mess too much with these for now so we should delete only the ones * that shouldn't be there like the deadbeef ones. We first have to figure out if it's - * save to remove files and directories from CatRoot/CatRoot2. + * safe to remove files and directories from CatRoot/CatRoot2. */ ret = pCryptCATAdminAcquireContext(&hca, &dummy, 0); @@ -550,7 +550,9 @@ hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1); error = GetLastError(); ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); - ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", GetLastError()); + ok(error == ERROR_INVALID_PARAMETER || + error == ERROR_BAD_FORMAT, /* win 8 */ + "got %u\n", GetLastError()); SetLastError(0xdeadbeef); hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0); Modified: trunk/rostests/winetests/wintrust/softpub.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wintrust/softpu…
============================================================================== --- trunk/rostests/winetests/wintrust/softpub.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wintrust/softpub.c [iso-8859-1] Wed Oct 8 19:51:36 2014 @@ -222,6 +222,7 @@ } else skip("CertCreateCertificateContext failed: %08x\n", GetLastError()); + funcs->pfnFree(data.pasSigners); } }
10 years, 3 months
1
0
0
0
[akhaldi] 64622: [WINTRUST] * Sync with Wine 1.7.27. CORE-8540
by akhaldi@svn.reactos.org
Author: akhaldi Date: Wed Oct 8 19:51:13 2014 New Revision: 64622 URL:
http://svn.reactos.org/svn/reactos?rev=64622&view=rev
Log: [WINTRUST] * Sync with Wine 1.7.27. CORE-8540 Modified: trunk/reactos/dll/win32/wintrust/register.c trunk/reactos/dll/win32/wintrust/wintrust_main.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/wintrust/register.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/registe…
============================================================================== --- trunk/reactos/dll/win32/wintrust/register.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/register.c [iso-8859-1] Wed Oct 8 19:51:13 2014 @@ -896,6 +896,7 @@ NewProv.pwszVerifyFuncName = CryptSIPVerifyIndirectData; NewProv.pwszRemoveFuncName = CryptSIPRemoveSignedDataMsg; NewProv.pwszIsFunctionNameFmt2 = NULL; + NewProv.pwszGetCapFuncName = NULL; Ret = CryptSIPAddProvider(&NewProv); Modified: trunk/reactos/dll/win32/wintrust/wintrust_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wintrust/wintrus…
============================================================================== --- trunk/reactos/dll/win32/wintrust/wintrust_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wintrust/wintrust_main.c [iso-8859-1] Wed Oct 8 19:51:13 2014 @@ -40,20 +40,6 @@ void WINAPI WINTRUST_Free(void *p) { HeapFree(GetProcessHeap(), 0, p); -} - -/*********************************************************************** - * DllMain (WINTRUST.@) - */ -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) -{ - switch(reason) - { - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( inst ); - break; - } - return TRUE; } /*********************************************************************** 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] Wed Oct 8 19:51:13 2014 @@ -218,7 +218,7 @@ reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 reactos/dll/win32/winscard # Synced to Wine-1.7.17 -reactos/dll/win32/wintrust # Synced to Wine-1.7.17 +reactos/dll/win32/wintrust # Synced to Wine-1.7.27 reactos/dll/win32/wldap32 # Synced to Wine-1.7.17 reactos/dll/win32/wmi # Synced to Wine-1.7.17 reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.17
10 years, 3 months
1
0
0
0
[jgardou] 64621: [WSHTCPIP] - Implement IPPROTO_TCP:TCP_NODELAY case in WSHSetSocketInformation [TCPIP] - Implement setting TCP_SOCKET_NODELAY connection property.
by jgardou@svn.reactos.org
Author: jgardou Date: Wed Oct 8 19:50:38 2014 New Revision: 64621 URL:
http://svn.reactos.org/svn/reactos?rev=64621&view=rev
Log: [WSHTCPIP] - Implement IPPROTO_TCP:TCP_NODELAY case in WSHSetSocketInformation [TCPIP] - Implement setting TCP_SOCKET_NODELAY connection property. Added: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c (with props) Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c trunk/reactos/drivers/network/tcpip/CMakeLists.txt trunk/reactos/drivers/network/tcpip/include/info.h trunk/reactos/drivers/network/tcpip/include/tcp.h trunk/reactos/drivers/network/tcpip/tcpip/info.c trunk/reactos/include/psdk/tcpioctl.h trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c trunk/reactos/lib/drivers/lwip/src/include/rosip.h trunk/reactos/lib/drivers/lwip/src/rostcp.c Modified: trunk/reactos/dll/win32/wshtcpip/wshtcpip.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wshtcpip/wshtcpi…
============================================================================== --- trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wshtcpip/wshtcpip.c [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -156,12 +156,18 @@ return NO_ERROR; } -UINT -GetAddressOption(INT Level, INT OptionName) +static +void +GetTdiTypeId( + _In_ INT Level, + _In_ INT OptionName, + _Out_ PULONG TdiType, + _Out_ PULONG TdiId) { switch (Level) { case SOL_SOCKET: + *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case SO_KEEPALIVE: @@ -174,21 +180,26 @@ break; case IPPROTO_IP: + *TdiType = INFO_TYPE_ADDRESS_OBJECT; switch (OptionName) { case IP_TTL: - return AO_OPTION_TTL; + *TdiId = AO_OPTION_TTL; + return; case IP_DONTFRAGMENT: - return AO_OPTION_IP_DONTFRAGMENT; + *TdiId = AO_OPTION_IP_DONTFRAGMENT; + return; #if 0 case IP_RECEIVE_BROADCAST: - return AO_OPTION_BROADCAST; + *TdiId = AO_OPTION_BROADCAST; + return; #endif case IP_HDRINCL: - return AO_OPTION_IP_HDRINCL; + *TdiId = AO_OPTION_IP_HDRINCL; + return; default: break; @@ -198,10 +209,10 @@ case IPPROTO_TCP: switch (OptionName) { + *TdiType = INFO_TYPE_CONNECTION; case TCP_NODELAY: - /* FIXME: Return proper option */ - ASSERT(FALSE); - break; + *TdiId = TCP_SOCKET_NODELAY; + return; default: break; } @@ -211,7 +222,8 @@ } DPRINT1("Unknown level/option name: %d %d\n", Level, OptionName); - return 0; + *TdiType = 0; + *TdiId = 0; } INT @@ -642,7 +654,7 @@ IN INT OptionLength) { PSOCKET_CONTEXT Context = HelperDllSocketContext; - UINT RealOptionName; + ULONG TdiType, TdiId; INT Status; PTCP_REQUEST_SET_INFORMATION_EX Info; PQUEUED_REQUEST Queued, NextQueued; @@ -697,9 +709,11 @@ switch (OptionName) { case TCP_NODELAY: - /* FIXME -- Send this to TCPIP */ - DPRINT1("Set: TCP_NODELAY not yet supported\n"); - return 0; + if (OptionLength < sizeof(CHAR)) + { + return WSAEFAULT; + } + break; default: /* Invalid option */ @@ -714,8 +728,8 @@ } /* If we get here, GetAddressOption must return something valid */ - RealOptionName = GetAddressOption(Level, OptionName); - ASSERT(RealOptionName != 0); + GetTdiTypeId(Level, OptionName, &TdiId, &TdiType); + ASSERT((TdiId != 0) && (TdiType != 0)); Info = HeapAlloc(GetProcessHeap(), 0, sizeof(*Info) + OptionLength); if (!Info) @@ -724,8 +738,8 @@ Info->ID.toi_entity.tei_entity = Context->AddrFileEntityType; Info->ID.toi_entity.tei_instance = Context->AddrFileInstance; Info->ID.toi_class = INFO_CLASS_PROTOCOL; - Info->ID.toi_type = INFO_TYPE_ADDRESS_OBJECT; - Info->ID.toi_id = RealOptionName; + Info->ID.toi_type = TdiType; + Info->ID.toi_id = TdiId; Info->BufferSize = OptionLength; memcpy(Info->Buffer, OptionValue, OptionLength); Modified: trunk/reactos/drivers/network/tcpip/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/CMak…
============================================================================== --- trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/CMakeLists.txt [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -14,6 +14,7 @@ datalink/lan.c tcpip/ainfo.c tcpip/buffer.c + tcpip/cinfo.c tcpip/dispatch.c tcpip/fileobjs.c tcpip/iinfo.c Modified: trunk/reactos/drivers/network/tcpip/include/info.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/info.h [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -183,6 +183,11 @@ PVOID Buffer, PUINT BufferSize); +TDI_STATUS SetConnectionInfo(TDIObjectID *ID, + PCONNECTION_ENDPOINT Connection, + PVOID Buffer, + UINT BufferSize); + /* Insert and remove entities */ VOID InsertTDIInterfaceEntity( PIP_INTERFACE Interface ); Modified: trunk/reactos/drivers/network/tcpip/include/tcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
============================================================================== --- trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/include/tcp.h [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -186,6 +186,8 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Connection, PIRP Irp ); +NTSTATUS TCPSetNoDelay(PCONNECTION_ENDPOINT Connection, BOOLEAN Set); + VOID TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF); Added: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c (added) +++ trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -0,0 +1,32 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS TCP/IP protocol driver + * FILE: tcpip/cinfo.c + * PURPOSE: Per-socket connection information. + * PROGRAMMER: Jérôme Gardou + */ + +#include "precomp.h" + +TDI_STATUS SetConnectionInfo(TDIObjectID *ID, + PCONNECTION_ENDPOINT Connection, + PVOID Buffer, + UINT BufferSize) +{ + ASSERT(ID->toi_type == INFO_TYPE_CONNECTION); + switch (ID->toi_id) + { + case TCP_SOCKET_NODELAY: + { + BOOLEAN Set; + if (BufferSize < sizeof(BOOLEAN)) + return TDI_INVALID_PARAMETER; + Set = *(BOOLEAN*)Buffer; + return TCPSetNoDelay(Connection, Set); + } + default: + DbgPrint("TCPIP: Unknown connection info ID: %u.\n", ID->toi_id); + } + + return TDI_INVALID_PARAMETER; +} Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ charset = UTF-8 Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/drivers/network/tcpip/tcpip/cinfo.c ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: trunk/reactos/drivers/network/tcpip/tcpip/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
============================================================================== --- trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -326,12 +326,25 @@ switch (ID->toi_class) { case INFO_CLASS_PROTOCOL: - if (ID->toi_type == INFO_TYPE_ADDRESS_OBJECT) + switch (ID->toi_type) { - if ((EntityListContext = GetContext(ID->toi_entity))) - return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); - else - return TDI_INVALID_PARAMETER; + case INFO_TYPE_ADDRESS_OBJECT: + { + if ((EntityListContext = GetContext(ID->toi_entity))) + return SetAddressFileInfo(ID, EntityListContext, Buffer, BufferSize); + else + return TDI_INVALID_PARAMETER; + } + case INFO_TYPE_CONNECTION: + { + PADDRESS_FILE AddressFile = GetContext(ID->toi_entity); + if (AddressFile == NULL) + return TDI_INVALID_PARAMETER; + return SetConnectionInfo(ID, AddressFile->Connection, Buffer, BufferSize); + } + default: + DbgPrint("TCPIP: IOCTL_TCP_SET_INFORMATION_EX - Unrecognized information type for INFO_CLASS_PROTOCOL: 0x%#x.\n", ID->toi_type); + return TDI_INVALID_PARAMETER; } switch (ID->toi_id) Modified: trunk/reactos/include/psdk/tcpioctl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/tcpioctl.h?re…
============================================================================== --- trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/tcpioctl.h [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -90,6 +90,9 @@ #define AO_OPTION_UNBIND 37 #define AO_OPTION_PROTECT 38 +/* TCP connection options */ +#define TCP_SOCKET_NODELAY 1 + typedef struct IFEntry { ULONG if_index; Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
============================================================================== --- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -674,4 +674,16 @@ return Found; } +NTSTATUS +TCPSetNoDelay( + PCONNECTION_ENDPOINT Connection, + BOOLEAN Set) +{ + if (Connection->SocketContext == NULL) + return STATUS_UNSUCCESSFUL; + LibTCPSetNoDelay(Connection->SocketContext, Set); + return STATUS_SUCCESS; +} + + /* EOF */ Modified: trunk/reactos/lib/drivers/lwip/src/include/rosip.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/inclu…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -107,10 +107,11 @@ err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); +void LibTCPSetNoDelay(PTCP_PCB pcb, BOOLEAN Set); /* IP functions */ void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size); void LibIPInitialize(void); void LibIPShutdown(void); -#endif +#endif Modified: trunk/reactos/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/lwip/src/rostc…
============================================================================== --- trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Wed Oct 8 19:50:38 2014 @@ -829,3 +829,14 @@ return ERR_OK; } + +void +LibTCPSetNoDelay( + PTCP_PCB pcb, + BOOLEAN Set) +{ + if (Set) + pcb->flags |= TF_NODELAY; + else + pcb->flags &= ~TF_NODELAY; +}
10 years, 3 months
1
0
0
0
← Newer
1
...
51
52
53
54
55
56
57
...
73
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Results per page:
10
25
50
100
200